The stored country name, or undefined if unset/invalid
await getUserCountryName() // "United States"
export async function getUserCountryName(): Promise<string | undefined> {
const stored = await cstorage.local.get([CACHE.USER_SETTINGS]);
const settings: unknown = stored[CACHE.USER_SETTINGS];
if (typeof settings !== 'object' || settings === null) {
return undefined;
}
const country = (settings as Record<string, unknown>).country;
return typeof country === 'string' ? country : undefined;
}
Reads the user's selected country (full name) from persisted user settings. The
countryfield is kept in sync with thelocationcode by the settings reducer, so consumers that need a full country name can read it directly.