mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import {type LogEvents} from '#/lib/statsig/statsig'
2import {type PersistedAccount} from '#/state/persisted'
3
4export type SessionAccount = PersistedAccount
5
6export type SessionStateContext = {
7 accounts: SessionAccount[]
8 currentAccount: SessionAccount | undefined
9 hasSession: boolean
10}
11
12export type SessionApiContext = {
13 createAccount: (
14 props: {
15 service: string
16 email: string
17 password: string
18 handle: string
19 birthDate: Date
20 inviteCode?: string
21 verificationPhone?: string
22 verificationCode?: string
23 },
24 metrics: LogEvents['account:create:success'],
25 ) => Promise<void>
26 login: (
27 props: {
28 service: string
29 identifier: string
30 password: string
31 authFactorToken?: string | undefined
32 },
33 logContext: LogEvents['account:loggedIn']['logContext'],
34 ) => Promise<void>
35 logoutCurrentAccount: (
36 logContext: LogEvents['account:loggedOut']['logContext'],
37 ) => void
38 logoutEveryAccount: (
39 logContext: LogEvents['account:loggedOut']['logContext'],
40 ) => void
41 resumeSession: (account: SessionAccount) => Promise<void>
42 removeAccount: (account: SessionAccount) => void
43}