+33
-45
src/ageAssurance/components/NoAccessScreen.tsx
+33
-45
src/ageAssurance/components/NoAccessScreen.tsx
···
9
9
useCreateSupportLink,
10
10
} from '#/lib/hooks/useCreateSupportLink'
11
11
import {dateDiff, useGetTimeAgo} from '#/lib/hooks/useTimeAgo'
12
-
import {isAppPassword} from '#/lib/jwt'
13
12
import {logger} from '#/logger'
14
13
import {isWeb} from '#/platform/detection'
15
14
import {isNative} from '#/platform/detection'
16
15
import {useIsBirthdateUpdateAllowed} from '#/state/birthdate'
17
-
import {useSession, useSessionApi} from '#/state/session'
16
+
import {useSessionApi} from '#/state/session'
18
17
import {atoms as a, useBreakpoints, useTheme, web} from '#/alf'
19
18
import {Admonition} from '#/components/Admonition'
20
19
import {AgeAssuranceAppealDialog} from '#/components/ageAssurance/AgeAssuranceAppealDialog'
···
30
29
import {createStaticClick, SimpleInlineLinkText} from '#/components/Link'
31
30
import {Outlet as PortalOutlet} from '#/components/Portal'
32
31
import * as Toast from '#/components/Toast'
33
-
import {Span, Text} from '#/components/Typography'
32
+
import {Text} from '#/components/Typography'
34
33
import {BottomSheetOutlet} from '#/../modules/bottom-sheet'
35
34
import {useAgeAssurance} from '#/ageAssurance'
36
35
import {useAgeAssuranceDataContext} from '#/ageAssurance/data'
···
55
54
const {logoutCurrentAccount} = useSessionApi()
56
55
const createSupportLink = useCreateSupportLink()
57
56
58
-
const {currentAccount} = useSession()
59
-
const isUsingAppPassword = isAppPassword(currentAccount?.accessJwt || '')
60
-
61
57
const aa = useAgeAssurance()
62
58
const isBlocked = aa.state.status === aa.Status.Blocked
63
59
const isAARegion = !!region
···
89
85
logoutCurrentAccount('AgeAssuranceNoAccessScreen')
90
86
}, [logoutCurrentAccount])
91
87
92
-
const birthdateUpdateText = canUpdateBirthday ? (
93
-
<Text style={[textStyles]}>
88
+
const orgAdmonition = (
89
+
<Admonition type="tip">
94
90
<Trans>
95
-
If you believe your birthdate is incorrect, you can update it by{' '}
96
-
<SimpleInlineLinkText
97
-
label={_(msg`Click here to update your birthdate`)}
98
-
style={[textStyles]}
99
-
{...createStaticClick(() => {
100
-
logger.metric('ageAssurance:noAccessScreen:openBirthdateDialog', {})
101
-
birthdateControl.open()
102
-
})}>
103
-
clicking here
104
-
</SimpleInlineLinkText>
105
-
.
91
+
For organizational accounts, use the birthdate of the person who is
92
+
responsible for the account.
106
93
</Trans>
107
-
</Text>
94
+
</Admonition>
95
+
)
96
+
97
+
const birthdateUpdateText = canUpdateBirthday ? (
98
+
<>
99
+
<Text style={[textStyles]}>
100
+
<Trans>
101
+
If you believe your birthdate is incorrect, you can update it by{' '}
102
+
<SimpleInlineLinkText
103
+
label={_(msg`Click here to update your birthdate`)}
104
+
style={[textStyles]}
105
+
{...createStaticClick(() => {
106
+
logger.metric(
107
+
'ageAssurance:noAccessScreen:openBirthdateDialog',
108
+
{},
109
+
)
110
+
birthdateControl.open()
111
+
})}>
112
+
clicking here
113
+
</SimpleInlineLinkText>
114
+
.
115
+
</Trans>
116
+
</Text>
117
+
118
+
{orgAdmonition}
119
+
</>
108
120
) : (
109
121
<Text style={[textStyles]}>
110
122
<Trans>
···
120
132
</Text>
121
133
)
122
134
123
-
const orgAdmonition = (
124
-
<Admonition type="tip">
125
-
<Trans>
126
-
For organizational accounts, use the birthdate of the person who is
127
-
responsible for the account.
128
-
</Trans>
129
-
</Admonition>
130
-
)
131
-
132
135
return (
133
136
<>
134
137
<View style={[a.util_screen_outer, a.flex_1]}>
···
175
178
</Text>
176
179
177
180
{!isBlocked && birthdateUpdateText}
178
-
179
-
{orgAdmonition}
180
181
</View>
181
182
182
183
<AccessSection />
···
191
192
</Text>
192
193
193
194
{birthdateUpdateText}
194
-
195
-
{orgAdmonition}
196
195
</View>
197
196
)}
198
197
</>
···
224
223
</ButtonText>
225
224
</Button>
226
225
227
-
{isUsingAppPassword ? (
228
-
<Admonition type="info">
229
-
<Trans>
230
-
Hmm, it looks like you're logged in with an{' '}
231
-
<Span style={[a.italic]}>App Password</Span>. To set your
232
-
birthdate, you'll need to log in with your main account
233
-
password, or ask whomever controls this account to do so.
234
-
</Trans>
235
-
</Admonition>
236
-
) : (
237
-
orgAdmonition
238
-
)}
226
+
{orgAdmonition}
239
227
</View>
240
228
)}
241
229
+14
-1
src/components/dialogs/BirthDateSettings.tsx
+14
-1
src/components/dialogs/BirthDateSettings.tsx
···
4
4
import {useLingui} from '@lingui/react'
5
5
6
6
import {useCleanError} from '#/lib/hooks/useCleanError'
7
+
import {isAppPassword} from '#/lib/jwt'
7
8
import {getAge, getDateAgo} from '#/lib/strings/time'
8
9
import {logger} from '#/logger'
9
10
import {isIOS, isWeb} from '#/platform/detection'
···
15
16
usePreferencesQuery,
16
17
type UsePreferencesQueryResponse,
17
18
} from '#/state/queries/preferences'
19
+
import {useSession} from '#/state/session'
18
20
import {ErrorMessage} from '#/view/com/util/error/ErrorMessage'
19
21
import {atoms as a, useTheme, web} from '#/alf'
20
22
import {Admonition} from '#/components/Admonition'
···
23
25
import {DateField} from '#/components/forms/DateField'
24
26
import {SimpleInlineLinkText} from '#/components/Link'
25
27
import {Loader} from '#/components/Loader'
26
-
import {Text} from '#/components/Typography'
28
+
import {Span, Text} from '#/components/Typography'
27
29
28
30
export function BirthDateSettingsDialog({
29
31
control,
···
34
36
const {_} = useLingui()
35
37
const {isLoading, error, data: preferences} = usePreferencesQuery()
36
38
const isBirthdateUpdateAllowed = useIsBirthdateUpdateAllowed()
39
+
const {currentAccount} = useSession()
40
+
const isUsingAppPassword = isAppPassword(currentAccount?.accessJwt || '')
37
41
38
42
return (
39
43
<Dialog.Outer control={control} nativeOptions={{preventExpansion: true}}>
···
65
69
}
66
70
style={[a.rounded_sm]}
67
71
/>
72
+
) : isUsingAppPassword ? (
73
+
<Admonition type="info">
74
+
<Trans>
75
+
Hmm, it looks like you're logged in with an{' '}
76
+
<Span style={[a.italic]}>App Password</Span>. To set your
77
+
birthdate, you'll need to log in with your main account
78
+
password, or ask whomever controls this account to do so.
79
+
</Trans>
80
+
</Admonition>
68
81
) : (
69
82
<BirthdayInner control={control} preferences={preferences} />
70
83
)}