A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
feat(app): ask for date of birth and remove underage accounts
Hampus1b661917f1d7
diff --git a/fluxer_app/src/features/app/components/layout/AppLayout.tsx b/fluxer_app/src/features/app/components/layout/AppLayout.tsxindex ab3cb4cfc..0f778d972 100644--- a/fluxer_app/src/features/app/components/layout/AppLayout.tsx+++ b/fluxer_app/src/features/app/components/layout/AppLayout.tsx@@ -2,9 +2,11 @@import styles from '@app/features/app/components/layout/AppLayout.module.css';import {useAppLayoutState} from '@app/features/app/components/layout/app_layout/AppLayoutHooks';+import {DateOfBirthGate} from '@app/features/auth/components/date_of_birth/DateOfBirthGate';import Authentication from '@app/features/auth/state/Authentication';import GatewaySessions from '@app/features/gateway/transport/GatewaySessionPool';import {RecoveryKitReminderGate} from '@app/features/user/components/RecoveryKitReminderGate';+import Users from '@app/features/user/state/Users';import {MediaDeviceStartupPreloadManager} from '@app/features/voice/components/MediaDeviceStartupPreloadManager';import {NewDeviceMonitoringManager} from '@app/features/voice/components/NewDeviceMonitoringManager';import {VoiceReconnectionManager} from '@app/features/voice/components/VoiceReconnectionManager';@@ -16,20 +18,23 @@ export const AppLayout = observer(({children}: {children: React.ReactNode}) => {const isAuthenticated = Authentication.isAuthenticated;const socket = GatewaySessions.foregroundConnection.socket;const appState = useAppLayoutState();+ const dateOfBirthRequired = isAuthenticated && Users.currentUser?.dateOfBirthRequired === true;+ const managersEnabled = isAuthenticated && !dateOfBirthRequired;return (<>- {isAuthenticated && socket && <VoiceReconnectionManager data-flx="app.app-layout.voice-reconnection-manager" />}- {isAuthenticated && (+ {managersEnabled && socket && <VoiceReconnectionManager data-flx="app.app-layout.voice-reconnection-manager" />}+ {managersEnabled && (<MediaDeviceStartupPreloadManager data-flx="app.app-layout.media-device-startup-preload-manager" />)}- {isAuthenticated && <NewDeviceMonitoringManager data-flx="app.app-layout.new-device-monitoring-manager" />}- {isAuthenticated && <RecoveryKitReminderGate data-flx="app.app-layout.recovery-kit-reminder-gate" />}+ {managersEnabled && <NewDeviceMonitoringManager data-flx="app.app-layout.new-device-monitoring-manager" />}+ {managersEnabled && <RecoveryKitReminderGate data-flx="app.app-layout.recovery-kit-reminder-gate" />}<divclassName={clsx(styles.appLayout, appState.isStandalone && styles.appLayoutStandalone)}data-flx="app.app-layout.app-layout">{children}</div>+ {dateOfBirthRequired && <DateOfBirthGate data-flx="app.app-layout.date-of-birth-gate" />}</>);});diff --git a/fluxer_app/src/features/auth/components/AgeBlockedNotice.tsx b/fluxer_app/src/features/auth/components/AgeBlockedNotice.tsxnew file mode 100644index 000000000..ab13bd6d4--- /dev/null+++ b/fluxer_app/src/features/auth/components/AgeBlockedNotice.tsx@@ -0,0 +1,38 @@+// SPDX-License-Identifier: AGPL-3.0-or-later++import RuntimeConfig from '@app/features/app/state/RuntimeConfig';+import loginStyles from '@app/features/auth/components/pages/LoginPage.module.css';+import styles from '@app/features/auth/flow/identifier_first/AuthIdentifierFirstStep.module.css';+import {msg} from '@lingui/core/macro';+import {useLingui} from '@lingui/react/macro';++const AGE_BLOCKED_TITLE_DESCRIPTOR = msg({+ message: "You can't use {productName} yet",+ comment:+ 'Heading shown after someone enters a date of birth below the minimum age. Calm and neutral. productName is the app name.',+});+export const AGE_BLOCKED_BODY_DESCRIPTOR = msg({+ message: 'You need to be a little older to have an account.',+ comment:+ 'Text shown instead of account creation for a day after someone entered a date of birth below the minimum age.',+});+const AGE_BLOCKED_DELETION_DESCRIPTOR = msg({+ message:+ "You need to be a little older to have an account. We've signed you out, and this account and the date you entered will be deleted.",+ comment:+ 'Text under the heading shown right after someone enters a date of birth below the minimum age. Calm and neutral.',+});++export function AgeBlockedNotice({accountDeleted = false}: {accountDeleted?: boolean}) {+ const {i18n} = useLingui();+ return (+ <flx-auth-age-blocked-notice className="flx-element" role="status" data-flx="auth.age-blocked-notice">+ <h1 className={loginStyles.title} dir="auto" data-flx="auth.age-blocked-notice.title">+ {i18n._(AGE_BLOCKED_TITLE_DESCRIPTOR, {productName: RuntimeConfig.productName})}+ </h1>+ <p className={styles.description} dir="auto" data-flx="auth.age-blocked-notice.body">+ {i18n._(accountDeleted ? AGE_BLOCKED_DELETION_DESCRIPTOR : AGE_BLOCKED_BODY_DESCRIPTOR)}+ </p>+ </flx-auth-age-blocked-notice>+ );+}diff --git a/fluxer_app/src/features/auth/components/AgeBlockedRemovalGate.tsx b/fluxer_app/src/features/auth/components/AgeBlockedRemovalGate.tsxnew file mode 100644index 000000000..283774aea--- /dev/null+++ b/fluxer_app/src/features/auth/components/AgeBlockedRemovalGate.tsx@@ -0,0 +1,27 @@+// SPDX-License-Identifier: AGPL-3.0-or-later++import {AgeBlockedNotice} from '@app/features/auth/components/AgeBlockedNotice';+import {SIGN_IN_TO_EXISTING_ACCOUNT_DESCRIPTOR} from '@app/features/auth/flow/identifier_first/AuthIdentifierFirstStep';+import styles from '@app/features/auth/flow/identifier_first/AuthIdentifierFirstStep.module.css';+import {QuietButton} from '@app/features/auth/flow/QuietButton';+import {isAgeBlocked, takeAgeBlockedAccountRemoved} from '@app/features/auth/state/AccountEntryStorage';+import {useLingui} from '@lingui/react/macro';+import {type ReactNode, useState} from 'react';++export function AgeBlockedRemovalGate({children}: {children: ReactNode}) {+ const {i18n} = useLingui();+ const [accountRemoved, setAccountRemoved] = useState(() => isAgeBlocked() && takeAgeBlockedAccountRemoved());+ if (!accountRemoved) {+ return children;+ }+ return (+ <>+ <AgeBlockedNotice accountDeleted data-flx="auth.age-blocked-removal-gate.notice" />+ <div className={styles.quietActions} data-flx="auth.age-blocked-removal-gate.actions">+ <QuietButton onClick={() => setAccountRemoved(false)} data-flx="auth.age-blocked-removal-gate.sign-in-existing">+ {i18n._(SIGN_IN_TO_EXISTING_ACCOUNT_DESCRIPTOR)}+ </QuietButton>+ </div>+ </>+ );+}diff --git a/fluxer_app/src/features/auth/components/date_of_birth/DateOfBirthGate.module.css b/fluxer_app/src/features/auth/components/date_of_birth/DateOfBirthGate.module.cssnew file mode 100644index 000000000..d20e99f4c--- /dev/null+++ b/fluxer_app/src/features/auth/components/date_of_birth/DateOfBirthGate.module.css@@ -0,0 +1,34 @@+/* SPDX-License-Identifier: AGPL-3.0-or-later */++.form {+ display: flex;+ flex-direction: column;+ gap: 1.125rem;+ padding: 2rem;+ box-sizing: border-box;+}++.title {+ margin: 0;+ text-align: center;+ font-size: 1.25rem;+ font-weight: 600;+ color: var(--text-primary);+}++.title:focus {+ outline: none;+}++.description {+ margin: 0;+ text-align: center;+ font-size: 0.875rem;+ line-height: 1.25rem;+ color: var(--text-secondary);+}++.footer {+ display: flex;+ justify-content: center;+}diff --git a/fluxer_app/src/features/auth/components/date_of_birth/DateOfBirthGate.tsx b/fluxer_app/src/features/auth/components/date_of_birth/DateOfBirthGate.tsxnew file mode 100644index 000000000..401028e2b--- /dev/null+++ b/fluxer_app/src/features/auth/components/date_of_birth/DateOfBirthGate.tsx@@ -0,0 +1,158 @@+// SPDX-License-Identifier: AGPL-3.0-or-later++import {LogoutModal} from '@app/features/app/components/dialogs/components/LogoutModal';+import * as Modal from '@app/features/app/components/dialogs/Modal';+import KeybindManager from '@app/features/app/keybindings/KeybindManager';+import RuntimeConfig from '@app/features/app/state/RuntimeConfig';+import * as AuthenticationCommands from '@app/features/auth/commands/AuthenticationCommands';+import styles from '@app/features/auth/components/date_of_birth/DateOfBirthGate.module.css';+import {DateOfBirthField} from '@app/features/auth/flow/DateOfBirthField';+import {isPlausibleDateOfBirthInput} from '@app/features/auth/flow/DateOfBirthRules';+import {QuietButton} from '@app/features/auth/flow/QuietButton';+import {getAuthErrorMessage} from '@app/features/auth/hooks/useAuthForm';+import {markAgeBlocked} from '@app/features/auth/state/AccountEntryStorage';+import {setDateOfBirthStepOpen} from '@app/features/auth/state/DateOfBirthStep';+import {openGuildWhenAvailable} from '@app/features/guild/commands/GuildVisitCommands';+import {CONTINUE_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';+import {failureCode} from '@app/features/platform/utils/ResponseInspection';+import {Button} from '@app/features/ui/button/Button';+import * as ModalCommands from '@app/features/ui/commands/ModalCommands';+import {modal} from '@app/features/ui/commands/ModalCommands';+import ModalState from '@app/features/ui/state/Modal';+import {+ ModalStackContext,+ type ModalStackContextValue,+ UNSTACKED_MODAL_CONTEXT,+} from '@app/features/ui/utils/ModalStackContext';+import * as AccountTierCommands from '@app/features/user/commands/AccountTierCommands';+import {APIErrorCodes} from '@fluxer/constants/src/ApiErrorCodes';+import {msg} from '@lingui/core/macro';+import {useLingui} from '@lingui/react/macro';+import {observer} from 'mobx-react-lite';+import {type FormEvent, useEffect, useLayoutEffect, useRef, useState} from 'react';++const BEHIND_STACKED_MODAL_PLACEMENT: ModalStackContextValue = {...UNSTACKED_MODAL_CONTEXT, isTopmost: false};++const DATE_OF_BIRTH_TITLE_DESCRIPTOR = msg({+ message: 'When is your birthday?',+ comment: 'Heading of the date of birth step that everyone completes once before using the app.',+});+const DATE_OF_BIRTH_TEXT_DESCRIPTOR = msg({+ message:+ "{productName} uses your date of birth to match content and settings to your age. It isn't shown to anyone. You can't change it later.",+ comment:+ 'Text under the date of birth heading. productName is the app name. The last sentence says the date of birth cannot be changed once entered.',+});+const SIGN_OUT_DESCRIPTOR = msg({+ message: 'Sign out',+ comment: 'Quiet text button on the date of birth step that signs out instead.',+});++function ignoreDismiss(): void {}++function formatDateOfBirth(year: string, month: string, day: string): string | null {+ if (!isPlausibleDateOfBirthInput(year, month, day)) return null;+ return `${year.padStart(4, '0')}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`;+}++export const DateOfBirthGate = observer(() => {+ const {i18n} = useLingui();+ const titleRef = useRef<HTMLHeadingElement | null>(null);+ useEffect(() => {+ setDateOfBirthStepOpen(true);+ return () => setDateOfBirthStepOpen(false);+ }, []);+ useLayoutEffect(() => {+ KeybindManager.suspend();+ return () => KeybindManager.resume();+ }, []);+ const [month, setMonth] = useState('');+ const [day, setDay] = useState('');+ const [year, setYear] = useState('');+ const [submitting, setSubmitting] = useState(false);+ const [error, setError] = useState<string | null>(null);+ const dateOfBirth = formatDateOfBirth(year, month, day);+ const handleSubmit = async (event: FormEvent<HTMLFormElement>) => {+ event.preventDefault();+ if (dateOfBirth === null || submitting) return;+ setSubmitting(true);+ setError(null);+ try {+ const entry = await AccountTierCommands.setDateOfBirth(dateOfBirth);+ if (entry !== null) {+ void openGuildWhenAvailable(entry.guild_id);+ }+ } catch (caught) {+ if (failureCode(caught) === APIErrorCodes.ACCOUNT_BELOW_MINIMUM_AGE) {+ markAgeBlocked({accountRemoved: true});+ void AuthenticationCommands.logout({notifyServer: false});+ return;+ }+ setError(getAuthErrorMessage(caught, i18n));+ } finally {+ setSubmitting(false);+ }+ };+ const title = i18n._(DATE_OF_BIRTH_TITLE_DESCRIPTOR);+ const stackPlacement = ModalState.hasModalOpen() ? BEHIND_STACKED_MODAL_PLACEMENT : UNSTACKED_MODAL_CONTEXT;+ return (+ <ModalStackContext.Provider value={stackPlacement}>+ <Modal.Root+ size="small"+ centered+ backdropTone="strong"+ disableHistoryManagement+ onClose={ignoreDismiss}+ initialFocusRef={titleRef}+ data-flx="auth.date-of-birth-gate"+ >+ <Modal.ScreenReaderLabel text={title} data-flx="auth.date-of-birth-gate.screen-reader-label" />+ <Modal.Content padding="none" data-flx="auth.date-of-birth-gate.content">+ <form className={styles.form} onSubmit={handleSubmit} data-flx="auth.date-of-birth-gate.form">+ <h1+ ref={titleRef}+ className={styles.title}+ dir="auto"+ tabIndex={-1}+ data-flx="auth.date-of-birth-gate.title"+ >+ {title}+ </h1>+ <p className={styles.description} dir="auto" data-flx="auth.date-of-birth-gate.description">+ {i18n._(DATE_OF_BIRTH_TEXT_DESCRIPTOR, {productName: RuntimeConfig.productName})}+ </p>+ <DateOfBirthField+ selectedMonth={month}+ selectedDay={day}+ selectedYear={year}+ onMonthChange={setMonth}+ onDayChange={setDay}+ onYearChange={setYear}+ error={error ?? undefined}+ data-flx="auth.date-of-birth-gate.date-of-birth-field"+ />+ <Button+ type="submit"+ fitContainer+ submitting={submitting}+ disabled={dateOfBirth === null}+ data-flx="auth.date-of-birth-gate.button.submit"+ >+ {i18n._(CONTINUE_DESCRIPTOR)}+ </Button>+ <div className={styles.footer} data-flx="auth.date-of-birth-gate.footer">+ <QuietButton+ onClick={() =>+ ModalCommands.push(modal(() => <LogoutModal data-flx="auth.date-of-birth-gate.logout-modal" />))+ }+ data-flx="auth.date-of-birth-gate.button.sign-out"+ >+ {i18n._(SIGN_OUT_DESCRIPTOR)}+ </QuietButton>+ </div>+ </form>+ </Modal.Content>+ </Modal.Root>+ </ModalStackContext.Provider>+ );+});diff --git a/fluxer_app/src/features/auth/flow/DateOfBirthField.tsx b/fluxer_app/src/features/auth/flow/DateOfBirthField.tsxindex a3c1841b6..efd65e129 100644--- a/fluxer_app/src/features/auth/flow/DateOfBirthField.tsx+++ b/fluxer_app/src/features/auth/flow/DateOfBirthField.tsx@@ -1,6 +1,7 @@// SPDX-License-Identifier: AGPL-3.0-or-laterimport styles from '@app/features/auth/flow/DateOfBirthField.module.css';+import {dateOfBirthYearRange, isPlausibleDateOfBirthInput} from '@app/features/auth/flow/DateOfBirthRules';import {PASSWORD_MANAGER_IGNORE_ATTRIBUTES} from '@app/features/platform/utils/PasswordManagerAutocomplete';import {Combobox} from '@app/features/ui/components/form/FormCombobox';import FocusRing from '@app/features/ui/focus_ring/FocusRing';@@ -11,7 +12,7 @@ import {msg} from '@lingui/core/macro';import {Trans, useLingui} from '@lingui/react/macro';import {observer} from 'mobx-react-lite';import type React from 'react';-import {useMemo} from 'react';+import {useId, useMemo} from 'react';const DATE_OF_BIRTH_DESCRIPTOR = msg({message: 'Date of birth',@@ -30,8 +31,21 @@ const YEAR_DESCRIPTOR = msg({comment: 'Short label in the authentication date of birth field. Keep the tone plain and specific.',});+const ENTER_YOUR_REAL_DATE_OF_BIRTH_DESCRIPTOR = msg({+ message: 'Enter your real date of birth.',+ comment:+ 'Calm error under the date of birth field when the date is today, in the future, impossible, or more than 120 years ago.',+});+type DateFieldType = 'month' | 'day' | 'year';+function useDateOfBirthError(year: string, month: string, day: string, error: string | undefined): string | undefined {+ const {i18n} = useLingui();+ if (error) return error;+ if (!year || !month || !day || isPlausibleDateOfBirthInput(year, month, day)) return undefined;+ return i18n._(ENTER_YOUR_REAL_DATE_OF_BIRTH_DESCRIPTOR);+}+interface DateOfBirthFieldProps {selectedMonth: string;selectedDay: string;@@ -62,10 +76,11 @@ function NativeDatePicker({error,}: NativeDatePickerProps) {const {i18n} = useLingui();+ const inputId = useId();const dateOfBirthPlaceholder = i18n._(DATE_OF_BIRTH_DESCRIPTOR);- const currentYear = new Date().getFullYear();- const minDate = `${currentYear - 150}-01-01`;- const maxDate = `${currentYear}-12-31`;+ const yearRange = dateOfBirthYearRange();+ const minDate = `${yearRange.oldest}-01-01`;+ const maxDate = `${yearRange.newest}-12-31`;const dateValue = useMemo(() => {if (!selectedYear || !selectedMonth || !selectedDay) {return '';@@ -94,9 +109,13 @@ function NativeDatePicker({className={styles.labelContainer}data-flx="auth.flow.date-of-birth-field.native-date-picker.label-container">- <legend className={styles.legend} data-flx="auth.flow.date-of-birth-field.native-date-picker.legend">+ <label+ htmlFor={inputId}+ className={styles.legend}+ data-flx="auth.flow.date-of-birth-field.native-date-picker.legend"+ ><Trans>Date of birth</Trans>- </legend>+ </label></div><divclassName={styles.inputsContainer}@@ -104,6 +123,7 @@ function NativeDatePicker({><FocusRing offset={-2} data-flx="auth.flow.date-of-birth-field.native-date-picker.focus-ring"><input+ id={inputId}type="date"data-flx="auth.flow.date-of-birth-field.native-date-picker.native-date-input.date-change"{...PASSWORD_MANAGER_IGNORE_ATTRIBUTES}@@ -114,10 +134,16 @@ function NativeDatePicker({max={maxDate}placeholder={dateOfBirthPlaceholder}aria-invalid={!!error || undefined}+ aria-describedby={error ? `${inputId}-error` : undefined}/></FocusRing>{error && (- <span className={styles.errorText} data-flx="auth.flow.date-of-birth-field.native-date-picker.error-text">+ <span+ id={`${inputId}-error`}+ className={styles.errorText}+ role="alert"+ data-flx="auth.flow.date-of-birth-field.native-date-picker.error-text"+ >{error}</span>)}@@ -133,17 +159,17 @@ export const DateOfBirthField = observer(function DateOfBirthField({onMonthChange,onDayChange,onYearChange,- error,+ error: externalError,}: DateOfBirthFieldProps) {const {i18n} = useLingui();+ const error = useDateOfBirthError(selectedYear, selectedMonth, selectedDay, externalError);const monthPlaceholder = i18n._(MONTH_DESCRIPTOR);const dayPlaceholder = i18n._(DAY_DESCRIPTOR);const yearPlaceholder = i18n._(YEAR_DESCRIPTOR);const locale = getCurrentLocale();const fieldOrder = useMemo(() => getDateFieldOrder(locale), [locale]);const dateOptions = useMemo(() => {- const currentDate = new Date();- const currentYear = currentDate.getFullYear();+ const yearRange = dateOfBirthYearRange();const monthNames = getMonthNames(locale);const allMonths = Array.from({length: 12}, (_, index) => {return {@@ -152,7 +178,7 @@ export const DateOfBirthField = observer(function DateOfBirthField({};});const years = [];- for (let year = currentYear; year >= currentYear - 150; year--) {+ for (let year = yearRange.newest; year >= yearRange.oldest; year--) {years.push({value: String(year),label: String(year),@@ -269,7 +295,7 @@ export const DateOfBirthField = observer(function DateOfBirthField({{orderedFields}</div>{error && (- <span className={styles.errorText} data-flx="auth.flow.date-of-birth-field.error-text">+ <span className={styles.errorText} role="alert" data-flx="auth.flow.date-of-birth-field.error-text">{error}</span>)}diff --git a/fluxer_app/src/features/auth/flow/DateOfBirthRules.ts b/fluxer_app/src/features/auth/flow/DateOfBirthRules.tsnew file mode 100644index 000000000..c4c6a9011--- /dev/null+++ b/fluxer_app/src/features/auth/flow/DateOfBirthRules.ts@@ -0,0 +1,22 @@+// SPDX-License-Identifier: AGPL-3.0-or-later++import type {RuntimeConfigSnapshot} from '@app/features/app/state/InstanceSnapshotStore';+import {isPlausibleDateOfBirth, MAXIMUM_PLAUSIBLE_AGE} from '@fluxer/constants/src/RegionalMinimumAge';++function localToday(now: Date) {+ return {year: now.getFullYear(), month: now.getMonth() + 1, day: now.getDate()};+}++export function isPlausibleDateOfBirthInput(year: string, month: string, day: string, now: Date = new Date()): boolean {+ if (!/^\d{1,4}$/.test(year) || !/^\d{1,2}$/.test(month) || !/^\d{1,2}$/.test(day)) return false;+ return isPlausibleDateOfBirth({year: Number(year), month: Number(month), day: Number(day)}, localToday(now));+}++export function dateOfBirthYearRange(now: Date = new Date()): {newest: number; oldest: number} {+ const year = now.getFullYear();+ return {newest: year, oldest: year - MAXIMUM_PLAUSIBLE_AGE};+}++export function asksDateOfBirthAtSignUp(snapshot: RuntimeConfigSnapshot): boolean {+ return snapshot.appPublic.registration.collect_date_of_birth && snapshot.features.date_of_birth_step !== true;+}diff --git a/fluxer_app/src/features/auth/state/DateOfBirthStep.ts b/fluxer_app/src/features/auth/state/DateOfBirthStep.tsnew file mode 100644index 000000000..e3c14cadd--- /dev/null+++ b/fluxer_app/src/features/auth/state/DateOfBirthStep.ts@@ -0,0 +1,17 @@+// SPDX-License-Identifier: AGPL-3.0-or-later++import {observable, runInAction, when} from 'mobx';++const open = observable.box(false);++export function setDateOfBirthStepOpen(value: boolean): void {+ runInAction(() => open.set(value));+}++export function isDateOfBirthStepOpen(): boolean {+ return open.get();+}++export function whenDateOfBirthStepClosed(): Promise<void> {+ return when(() => !open.get());+}diff --git a/fluxer_app/src/features/premium/commands/PremiumCommands.ts b/fluxer_app/src/features/premium/commands/PremiumCommands.tsindex d6e912bdc..4ecf54323 100644--- a/fluxer_app/src/features/premium/commands/PremiumCommands.ts+++ b/fluxer_app/src/features/premium/commands/PremiumCommands.ts@@ -3,6 +3,7 @@import {showPremiumActionErrorModal} from '@app/features/app/components/dialogs/components/plutonium/utils/PremiumActionErrorModal';import {Endpoints} from '@app/features/app/constants/Endpoints';import GeoIP from '@app/features/app/state/GeoIP';+import {whenDateOfBirthStepClosed} from '@app/features/auth/state/DateOfBirthStep';import {http} from '@app/features/platform/transport/RestTransport';import {Logger} from '@app/features/platform/utils/AppLogger';import {isAbortError} from '@app/features/platform/utils/PlatformHelpers';@@ -101,6 +102,7 @@ async function fetchPremiumState(countryCode?: string): Promise<PremiumStateResp}export async function refreshPremiumState(countryCode?: string): Promise<PremiumStateResponse> {+ await whenDateOfBirthStepClosed();const currentUserId = Users.currentUser?.id;if (currentUserId) {PremiumState.beginLoad(currentUserId);