From c3f8e41a667aa4a9dc91f57e5dab27f0a2a055c2 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 8 Jun 2026 19:29:46 -0500 Subject: [PATCH] Add AA const file to help with circular import --- src/ageAssurance/const.ts | 28 +++++++++++++++++++++++++++ src/ageAssurance/index.tsx | 1 - src/ageAssurance/util.ts | 20 +------------------ src/screens/Signup/StepInfo/index.tsx | 2 +- 4 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 src/ageAssurance/const.ts diff --git a/src/ageAssurance/const.ts b/src/ageAssurance/const.ts new file mode 100644 index 0000000000..bd79353b51 --- /dev/null +++ b/src/ageAssurance/const.ts @@ -0,0 +1,28 @@ +import { + ageAssuranceRuleIDs as ids, + type AppBskyAgeassuranceDefs, +} from '@atproto/api' + +import {AgeAssuranceAccess} from '#/ageAssurance/types' + +/** + * Minimum age required to access the app at all. + */ +export const MIN_ACCESS_AGE = 13 + +export const FALLBACK_REGION_CONFIG: AppBskyAgeassuranceDefs.ConfigRegion = { + countryCode: '*', + regionCode: undefined, + minAccessAge: MIN_ACCESS_AGE, + rules: [ + { + $type: ids.IfDeclaredOverAge, + age: MIN_ACCESS_AGE, + access: AgeAssuranceAccess.Full, + }, + { + $type: ids.Default, + access: AgeAssuranceAccess.None, + }, + ], +} diff --git a/src/ageAssurance/index.tsx b/src/ageAssurance/index.tsx index 4d75f6e946..20bcc2bdb8 100644 --- a/src/ageAssurance/index.tsx +++ b/src/ageAssurance/index.tsx @@ -32,7 +32,6 @@ export { usePatchServerState as usePatchAgeAssuranceServerState, } from '#/ageAssurance/data' export {logger} from '#/ageAssurance/logger' -export {MIN_ACCESS_AGE} from '#/ageAssurance/util' const AgeAssuranceStateContext = createContext<{ Access: typeof AgeAssuranceAccess diff --git a/src/ageAssurance/util.ts b/src/ageAssurance/util.ts index 470a1ddf32..72754967fb 100644 --- a/src/ageAssurance/util.ts +++ b/src/ageAssurance/util.ts @@ -1,6 +1,5 @@ import {useMemo} from 'react' import { - ageAssuranceRuleIDs as ids, type AppBskyAgeassuranceDefs, getAgeAssuranceRegionConfig, type ModerationPrefs, @@ -8,6 +7,7 @@ import { import {getAge} from '#/lib/strings/time' import {DEFAULT_LOGGED_OUT_LABEL_PREFERENCES} from '#/state/queries/preferences/moderation' +import {FALLBACK_REGION_CONFIG, MIN_ACCESS_AGE} from '#/ageAssurance/const' import {useAgeAssuranceServerDataContext} from '#/ageAssurance/data' import { AgeAssuranceAccess, @@ -17,24 +17,6 @@ import { } from '#/ageAssurance/types' import {type Geolocation, useGeolocation} from '#/geolocation' -export const MIN_ACCESS_AGE = 13 -const FALLBACK_REGION_CONFIG: AppBskyAgeassuranceDefs.ConfigRegion = { - countryCode: '*', - regionCode: undefined, - minAccessAge: MIN_ACCESS_AGE, - rules: [ - { - $type: ids.IfDeclaredOverAge, - age: MIN_ACCESS_AGE, - access: AgeAssuranceAccess.Full, - }, - { - $type: ids.Default, - access: AgeAssuranceAccess.None, - }, - ], -} - /** * Get age assurance region config based on geolocation, with fallback to * app defaults if no region config is found. diff --git a/src/screens/Signup/StepInfo/index.tsx b/src/screens/Signup/StepInfo/index.tsx index 65b2791c29..5d1ecae014 100644 --- a/src/screens/Signup/StepInfo/index.tsx +++ b/src/screens/Signup/StepInfo/index.tsx @@ -24,9 +24,9 @@ import {createStaticClick, SimpleInlineLinkText} from '#/components/Link' import {Loader} from '#/components/Loader' import {usePreemptivelyCompleteActivePolicyUpdate} from '#/components/PolicyUpdateOverlay/usePreemptivelyCompleteActivePolicyUpdate' import * as Toast from '#/components/Toast' +import {MIN_ACCESS_AGE} from '#/ageAssurance/const' import { isUnderAge, - MIN_ACCESS_AGE, useAgeAssuranceRegionConfigWithFallback, } from '#/ageAssurance/util' import {useAnalytics} from '#/analytics'