@jsb188/react 1.1.8 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,17 @@
1
- import { clearAppCache, fetchLightModeSetting, isSystemDarkMode, saveAuthTokenToPlatform } from '@jsb188/app/platform';
2
- import type { AccountData, AccountSettings, AuthenticationData, LightModeEnum } from '@jsb188/app/types/auth.d';
3
- import { setAuthToken } from '@jsb188/app/utils/api';
4
- import { buildSingleText, guessFirstName } from '@jsb188/app/utils/string';
1
+ import {
2
+ clearAppCache,
3
+ fetchLightModeSetting,
4
+ isSystemDarkMode,
5
+ saveAuthTokenToPlatform,
6
+ } from '@jsb188/app/platform.ts';
7
+ import type {
8
+ AccountData,
9
+ AccountSettings,
10
+ AuthenticationData,
11
+ LightModeEnum,
12
+ } from '@jsb188/app/types/auth.d.ts';
13
+ import { setAuthToken } from '@jsb188/app/utils/api.ts';
14
+ import { getDisplayName } from '@jsb188/app/utils/string.ts';
5
15
  import { createContext, useContext } from 'react';
6
16
 
7
17
  /**
@@ -9,21 +19,20 @@ import { createContext, useContext } from 'react';
9
19
  */
10
20
 
11
21
  type AppContextAction = {
12
- __type: (
13
- // App initialization
14
- | 'APP_INIT'
15
- // Auth setup
16
- | 'APP_LOGIN'
17
- | 'APP_GUEST'
18
- | 'APP_EDIT_AUTH'
19
- | 'APP_EDIT_ACCOUNT'
20
- | 'APP_SWITCH_PRIMARY_ORGANIZATION'
21
- // Account theme
22
- | 'APP_THEME'
23
- | 'APP_SYSTEM_LIGHT_MODE'
24
- | 'APP_LIGHT_MODE'
25
- );
26
- data?: any;
22
+ __type: // App initialization
23
+ | 'APP_INIT'
24
+ // Auth setup
25
+ | 'APP_LOGIN'
26
+ | 'APP_GUEST'
27
+ | 'APP_REFRESH_AUTH'
28
+ | 'APP_EDIT_AUTH'
29
+ | 'APP_EDIT_ACCOUNT'
30
+ | 'APP_SWITCH_PRIMARY_ORGANIZATION'
31
+ // Account theme
32
+ | 'APP_THEME'
33
+ | 'APP_SYSTEM_LIGHT_MODE'
34
+ | 'APP_LIGHT_MODE';
35
+ data?: any;
27
36
  };
28
37
 
29
38
  export type AppContextDispatch = (action: AppContextAction) => void;
@@ -35,33 +44,34 @@ export type CurrentAccountObj = ReturnType<typeof useCurrentAccount>;
35
44
  */
36
45
 
37
46
  export type AppAppearanceType = {
38
- realLightMode: LightModeEnum;
39
- lightMode: LightModeEnum;
40
- previewLightMode: LightModeEnum;
41
- previewTheme: string | null;
47
+ realLightMode: LightModeEnum;
48
+ lightMode: LightModeEnum;
49
+ previewLightMode: LightModeEnum;
50
+ previewTheme: Record<string, any> | null;
42
51
  };
43
52
 
44
53
  export type AppContextData = {
45
- // Required for app
46
- init: 0 | 1 | 2; // 0 = not initialized,; 1 = loading; 2 = initialized
47
- authorization: string; // This is token
48
- networkError: boolean;
49
-
50
- // Authentication data
51
- account: AccountData | null;
52
- primaryOrganizationId: string | null;
53
-
54
- // Account settings & state
55
- settings: AccountSettings;
56
- activated: boolean;
57
- hasPassword: boolean;
58
- webVersion: string | null;
59
- alertUpdatesOnMount: boolean;
60
-
61
- // Preview theme overrides active theme
62
- systemLightMode: 'LIGHT' | 'DARK';
63
- previewLightMode: LightModeEnum | null;
64
- previewTheme: string | null;
54
+ // Required for app
55
+ init: 0 | 1 | 2; // 0 = not initialized,; 1 = loading; 2 = initialized
56
+ authorization: string; // This is token
57
+ networkError: boolean;
58
+
59
+ // Authentication data
60
+ account: AccountData | null;
61
+ primaryOrganizationId: string | null;
62
+ cacheAuthorizationEpoch: string | null;
63
+
64
+ // Account settings & state
65
+ settings: AccountSettings;
66
+ activated: boolean;
67
+ hasPassword: boolean;
68
+ webVersion: string | null;
69
+ alertUpdatesOnMount: boolean;
70
+
71
+ // Preview theme overrides active theme
72
+ systemLightMode: 'LIGHT' | 'DARK';
73
+ previewLightMode: LightModeEnum | null;
74
+ previewTheme: Record<string, any> | null;
65
75
  };
66
76
 
67
77
  /**
@@ -69,29 +79,27 @@ export type AppContextData = {
69
79
  */
70
80
 
71
81
  export const DEFAULT_APP_CONTEXT = {
72
- init: 0,
73
- authorization: '',
74
- networkError: false,
75
-
76
- account: null,
77
- primaryOrganizationId: null,
78
-
79
- settings: {
80
- theme: null,
81
- lightMode: 'LIGHT',
82
- timeZone: null,
83
- showSelfAvatar: false,
84
- isBubbleOther: false,
85
- showOtherAvatar: false,
86
- },
87
- activated: false,
88
- hasPassword: false,
89
- webVersion: null,
90
- alertUpdatesOnMount: false,
91
-
92
- systemLightMode: 'LIGHT',
93
- previewLightMode: null,
94
- previewTheme: null,
82
+ init: 0,
83
+ authorization: '',
84
+ networkError: false,
85
+
86
+ account: null,
87
+ primaryOrganizationId: null,
88
+ cacheAuthorizationEpoch: null,
89
+
90
+ settings: {
91
+ theme: null,
92
+ lightMode: 'LIGHT',
93
+ timeZone: null,
94
+ },
95
+ activated: false,
96
+ hasPassword: false,
97
+ webVersion: null,
98
+ alertUpdatesOnMount: false,
99
+
100
+ systemLightMode: 'LIGHT',
101
+ previewLightMode: null,
102
+ previewTheme: null,
95
103
  } as AppContextData;
96
104
 
97
105
  /**
@@ -99,32 +107,38 @@ export const DEFAULT_APP_CONTEXT = {
99
107
  */
100
108
 
101
109
  function ensureLightModeSetting(lightMode?: LightModeEnum): LightModeEnum {
102
- return lightMode && ['LIGHT', 'DARK', 'SYSTEM'].includes(lightMode || '') ? lightMode : 'LIGHT';
110
+ return lightMode && ['LIGHT', 'DARK', 'SYSTEM'].includes(lightMode || '')
111
+ ? lightMode
112
+ : 'LIGHT';
103
113
  }
104
114
 
105
115
  /**
106
116
  * App log in with Promise
107
117
  */
108
118
 
109
- export function onAccountLogin(auth: any, dispatchApp: AppContextDispatch, otherCB?: (auth: any) => void) {
110
- if (auth && auth?.token && auth.activated && auth.account) {
111
- console.log('.. 🥝 logged into account ..');
112
-
113
- saveAuthTokenToPlatform(auth.token, () => {
114
- clearAppCache();
115
- dispatchApp({
116
- __type: 'APP_LOGIN',
117
- data: auth,
118
- });
119
-
120
- if (otherCB) {
121
- otherCB(auth);
122
- }
123
- });
124
- } else {
125
- console.log(auth);
126
- console.warn('Developer error in onAccountLogin()');
127
- }
119
+ export function onAccountLogin(
120
+ auth: any,
121
+ dispatchApp: AppContextDispatch,
122
+ otherCB?: (auth: any) => void,
123
+ ) {
124
+ if (auth && auth?.token && auth.activated && auth.account) {
125
+ console.log('.. 🥝 logged into account ..');
126
+
127
+ saveAuthTokenToPlatform(auth.token, () => {
128
+ clearAppCache();
129
+ dispatchApp({
130
+ __type: 'APP_LOGIN',
131
+ data: auth,
132
+ });
133
+
134
+ if (otherCB) {
135
+ otherCB(auth);
136
+ }
137
+ });
138
+ } else {
139
+ console.log(auth);
140
+ console.warn('Developer error in onAccountLogin()');
141
+ }
128
142
  }
129
143
 
130
144
  /**
@@ -132,15 +146,15 @@ export function onAccountLogin(auth: any, dispatchApp: AppContextDispatch, other
132
146
  */
133
147
 
134
148
  export function onGuestInit(error: any, dispatchApp: AppContextDispatch) {
135
- fetchLightModeSetting(null, (lightMode) => {
136
- dispatchApp({
137
- __type: 'APP_GUEST',
138
- data: {
139
- error,
140
- lightMode,
141
- },
142
- });
143
- });
149
+ fetchLightModeSetting(null, (lightMode) => {
150
+ dispatchApp({
151
+ __type: 'APP_GUEST',
152
+ data: {
153
+ error,
154
+ lightMode,
155
+ },
156
+ });
157
+ });
144
158
  }
145
159
 
146
160
  /**
@@ -148,24 +162,23 @@ export function onGuestInit(error: any, dispatchApp: AppContextDispatch) {
148
162
  */
149
163
 
150
164
  export function getTheme(
151
- appState: AppContextData,
152
- priority: 'PREVIEW' | 'ACCOUNT' | 'ACTIVE'
165
+ appState: AppContextData,
166
+ priority: 'PREVIEW' | 'ACCOUNT' | 'ACTIVE',
153
167
  ) {
154
- let lightMode = appState.previewLightMode || appState.settings.lightMode;
155
- if (lightMode === 'SYSTEM') {
156
- lightMode = appState.systemLightMode;
157
- }
158
-
159
- const theme = (
160
- (priority === 'PREVIEW' && appState.previewTheme) ||
161
- appState.settings.theme ||
162
- ''
163
- );
164
-
165
- return {
166
- lightMode,
167
- theme,
168
- };
168
+ let lightMode = appState.previewLightMode || appState.settings.lightMode;
169
+ if (lightMode === 'SYSTEM') {
170
+ lightMode = appState.systemLightMode;
171
+ }
172
+
173
+ const theme =
174
+ (priority === 'PREVIEW' && appState.previewTheme) ||
175
+ appState.settings.theme ||
176
+ '';
177
+
178
+ return {
179
+ lightMode: lightMode || 'LIGHT',
180
+ theme,
181
+ };
169
182
  }
170
183
 
171
184
  /**
@@ -173,17 +186,17 @@ export function getTheme(
173
186
  */
174
187
 
175
188
  export function getPreviewAppearance(appState: AppContextData) {
176
- let realLightMode = appState.previewLightMode || appState.settings.lightMode;
177
- if (realLightMode === 'SYSTEM') {
178
- realLightMode = appState.systemLightMode;
179
- }
180
-
181
- return {
182
- realLightMode,
183
- lightMode: appState.settings.lightMode,
184
- previewLightMode: appState.previewLightMode,
185
- previewTheme: appState.previewTheme,
186
- };
189
+ let realLightMode = appState.previewLightMode || appState.settings.lightMode;
190
+ if (realLightMode === 'SYSTEM') {
191
+ realLightMode = appState.systemLightMode;
192
+ }
193
+
194
+ return {
195
+ realLightMode,
196
+ lightMode: appState.settings.lightMode,
197
+ previewLightMode: appState.previewLightMode,
198
+ previewTheme: appState.previewTheme,
199
+ };
187
200
  }
188
201
 
189
202
  /**
@@ -191,51 +204,52 @@ export function getPreviewAppearance(appState: AppContextData) {
191
204
  */
192
205
 
193
206
  export function mergeAuthToDefaultValues(
194
- auth?: AuthenticationData | null,
195
- authToken?: string | null,
207
+ auth?: AuthenticationData | null,
208
+ authToken?: string | null,
196
209
  ) {
197
- if (auth?.token && auth?.account?.id) {
198
- let systemLightMode = 'LIGHT';
199
- if (isSystemDarkMode()) {
200
- systemLightMode = 'DARK';
201
- }
202
-
203
- setAuthToken(auth.token);
204
-
205
- const authSettings = {
206
- ...DEFAULT_APP_CONTEXT.settings,
207
- ...auth.account.settings
208
- };
209
-
210
- authSettings.lightMode = ensureLightModeSetting(authSettings.lightMode);
211
-
212
- return {
213
- ...DEFAULT_APP_CONTEXT,
214
- init: 1, // Always 1 because we're always using SSR for authentication
215
- authorization: auth.token,
216
- account: auth.account,
217
- primaryOrganizationId: auth.primaryOrganizationId || null,
218
- settings: authSettings,
219
-
220
- alertUpdatesOnMount: auth.alertUpdatesOnMount,
221
- hasPassword: auth.hasPassword,
222
- webVersion: auth.webVersion,
223
-
224
- // Theme
225
- systemLightMode,
226
- previewLightMode: null,
227
- previewTheme: null,
228
- };
229
- } else if (authToken) {
230
- setAuthToken(authToken);
231
- return {
232
- ...DEFAULT_APP_CONTEXT,
233
- authorization: authToken || ''
234
- };
235
- }
236
-
237
- setAuthToken(null);
238
- return DEFAULT_APP_CONTEXT;
210
+ if (auth?.token && auth?.account?.id) {
211
+ let systemLightMode = 'LIGHT';
212
+ if (isSystemDarkMode()) {
213
+ systemLightMode = 'DARK';
214
+ }
215
+
216
+ setAuthToken(auth.token);
217
+
218
+ const authSettings = {
219
+ ...DEFAULT_APP_CONTEXT.settings,
220
+ ...auth.account.settings,
221
+ };
222
+
223
+ authSettings.lightMode = ensureLightModeSetting(authSettings.lightMode);
224
+
225
+ return {
226
+ ...DEFAULT_APP_CONTEXT,
227
+ init: 1, // Always 1 because we're always using SSR for authentication
228
+ authorization: auth.token,
229
+ account: auth.account,
230
+ primaryOrganizationId: auth.primaryOrganizationId || null,
231
+ cacheAuthorizationEpoch: auth.cacheAuthorizationEpoch || null,
232
+ settings: authSettings,
233
+
234
+ alertUpdatesOnMount: auth.alertUpdatesOnMount,
235
+ hasPassword: auth.hasPassword,
236
+ webVersion: auth.webVersion,
237
+
238
+ // Theme
239
+ systemLightMode,
240
+ previewLightMode: null,
241
+ previewTheme: null,
242
+ };
243
+ } else if (authToken) {
244
+ setAuthToken(authToken);
245
+ return {
246
+ ...DEFAULT_APP_CONTEXT,
247
+ authorization: authToken || '',
248
+ };
249
+ }
250
+
251
+ setAuthToken(null);
252
+ return DEFAULT_APP_CONTEXT;
239
253
  }
240
254
 
241
255
  /**
@@ -243,129 +257,152 @@ export function mergeAuthToDefaultValues(
243
257
  */
244
258
 
245
259
  export const appReducer = (state: AppContextData, action: AppContextAction) => {
246
- const { __type, data } = action;
247
-
248
- switch (__type) {
249
- case 'APP_INIT': {
250
- return {
251
- ...state,
252
- init: state.init === 1 ? 2 : 1,
253
- };
254
- }
255
- case 'APP_LOGIN': {
256
- return mergeAuthToDefaultValues(data);
257
- }
258
- case 'APP_GUEST': {
259
- const networkError = data.error?.errorCode === 'network_error';
260
- if (networkError) {
261
- console.log('.. ❌ network error ..');
262
- } else {
263
- console.log('.. 🥝 guest entered ..');
264
- }
265
-
266
- clearAppCache();
267
- setAuthToken(null);
268
-
269
- return {
270
- ...DEFAULT_APP_CONTEXT,
271
- init: 2,
272
- authorization: '',
273
- networkError,
274
-
275
- // Theme
276
- previewLightMode: null,
277
- previewTheme: null,
278
- };
279
- }
280
- case 'APP_EDIT_AUTH': {
281
- if (data.id === state.account?.id) {
282
- return {
283
- ...state,
284
- hasPassword: typeof data.hasPassword === 'boolean' ? data.hasPassword : state.hasPassword,
285
- account: !data.email ? state.account : {
286
- ...state.account,
287
- email: data.email
288
- },
289
- };
290
- }
291
- return state;
292
- }
293
- case 'APP_EDIT_ACCOUNT': {
294
- if (data.id === state.account?.id) {
295
- return {
296
- ...state,
297
-
298
- // Account
299
- account: {
300
- ...state.account,
301
- ...data,
302
- plus: !data.plus ? state.account?.plus : {
303
- ...state.account?.plus,
304
- ...data.plus,
305
- },
306
- },
307
- settings: !data.settings ? state.settings : {
308
- ...DEFAULT_APP_CONTEXT.settings,
309
- ...data.settings,
310
- }
311
- };
312
- }
313
- return state;
314
- }
315
- case 'APP_SWITCH_PRIMARY_ORGANIZATION': {
316
- return {
317
- ...state,
318
- primaryOrganizationId: data.primaryOrganizationId
319
- };
320
- }
321
- case 'APP_THEME': {
322
- if (!data?.preview) {
323
- // Active theme
324
- return {
325
- ...state,
326
- previewTheme: null,
327
- };
328
- }
329
-
330
- // Is preview theme
331
- return {
332
- ...state,
333
- previewTheme: data.theme,
334
- };
335
- }
336
- case 'APP_LIGHT_MODE': {
337
- if (!data.lightMode && !data.preview) {
338
- console.warn('Developer error in setLightMode(): You cannot set active lightMode to null.');
339
- return state;
340
- } else if (data.preview) {
341
- return {
342
- ...state,
343
- previewLightMode: data.lightMode,
344
- };
345
- }
346
-
347
- return {
348
- ...state,
349
- previewLightMode: null,
350
- };
351
- }
352
- case 'APP_SYSTEM_LIGHT_MODE': {
353
- return {
354
- ...state,
355
- systemLightMode: data.lightMode,
356
- };
357
- }
358
- default:
359
- console.dev('Unknown app reducer action type:', __type);
360
- return state;
361
- }
260
+ const { __type, data } = action;
261
+
262
+ switch (__type) {
263
+ case 'APP_INIT': {
264
+ return {
265
+ ...state,
266
+ init: state.init === 1 ? 2 : 1,
267
+ };
268
+ }
269
+ case 'APP_LOGIN': {
270
+ return mergeAuthToDefaultValues(data);
271
+ }
272
+ case 'APP_REFRESH_AUTH': {
273
+ const authorization = data?.authorization || '';
274
+ if (!authorization) {
275
+ return state;
276
+ }
277
+
278
+ setAuthToken(authorization);
279
+ return {
280
+ ...state,
281
+ authorization,
282
+ };
283
+ }
284
+ case 'APP_GUEST': {
285
+ const networkError = data.error?.errorCode === 'network_error';
286
+ if (networkError) {
287
+ console.log('.. ❌ network error ..');
288
+ } else {
289
+ console.log('.. 🥝 guest entered ..');
290
+ }
291
+
292
+ clearAppCache();
293
+ setAuthToken(null);
294
+
295
+ return {
296
+ ...DEFAULT_APP_CONTEXT,
297
+ init: 2,
298
+ authorization: '',
299
+ networkError,
300
+
301
+ // Theme
302
+ previewLightMode: null,
303
+ previewTheme: null,
304
+ };
305
+ }
306
+ case 'APP_EDIT_AUTH': {
307
+ if (data.id === state.account?.id) {
308
+ return {
309
+ ...state,
310
+ hasPassword:
311
+ typeof data.hasPassword === 'boolean'
312
+ ? data.hasPassword
313
+ : state.hasPassword,
314
+ account: !data.email
315
+ ? state.account
316
+ : {
317
+ ...state.account,
318
+ email: data.email,
319
+ },
320
+ };
321
+ }
322
+ return state;
323
+ }
324
+ case 'APP_EDIT_ACCOUNT': {
325
+ if (data.id === state.account?.id) {
326
+ return {
327
+ ...state,
328
+
329
+ // Account
330
+ account: {
331
+ ...state.account,
332
+ ...data,
333
+ plus: !data.plus
334
+ ? state.account?.plus
335
+ : {
336
+ ...state.account?.plus,
337
+ ...data.plus,
338
+ },
339
+ },
340
+ settings: !data.settings
341
+ ? state.settings
342
+ : {
343
+ ...DEFAULT_APP_CONTEXT.settings,
344
+ ...data.settings,
345
+ },
346
+ };
347
+ }
348
+ return state;
349
+ }
350
+ case 'APP_SWITCH_PRIMARY_ORGANIZATION': {
351
+ return {
352
+ ...state,
353
+ primaryOrganizationId: data.primaryOrganizationId,
354
+ };
355
+ }
356
+ case 'APP_THEME': {
357
+ if (!data?.preview) {
358
+ // Active theme
359
+ return {
360
+ ...state,
361
+ previewTheme: null,
362
+ };
363
+ }
364
+
365
+ // Is preview theme
366
+ return {
367
+ ...state,
368
+ previewTheme: data.theme,
369
+ };
370
+ }
371
+ case 'APP_LIGHT_MODE': {
372
+ if (!data.lightMode && !data.preview) {
373
+ console.warn(
374
+ 'Developer error in setLightMode(): You cannot set active lightMode to null.',
375
+ );
376
+ return state;
377
+ } else if (data.preview) {
378
+ return {
379
+ ...state,
380
+ previewLightMode: data.lightMode,
381
+ };
382
+ }
383
+
384
+ return {
385
+ ...state,
386
+ previewLightMode: null,
387
+ };
388
+ }
389
+ case 'APP_SYSTEM_LIGHT_MODE': {
390
+ return {
391
+ ...state,
392
+ systemLightMode: data.lightMode,
393
+ };
394
+ }
395
+ default:
396
+ console.dev('Unknown app reducer action type:', __type);
397
+ return state;
398
+ }
362
399
  };
363
400
 
364
401
  export const AppContext = createContext({
365
- appState: DEFAULT_APP_CONTEXT as AppContextData,
366
- dispatchApp: (() => {
367
- console.warn('AppContext has been re-initialized due to hot refresh.');
368
- }) as AppContextDispatch
402
+ appState: DEFAULT_APP_CONTEXT as AppContextData,
403
+ dispatchApp: (() => {
404
+ console.warn('AppContext has been re-initialized due to hot refresh.');
405
+ }) as AppContextDispatch,
369
406
  });
370
407
 
371
408
  /**
@@ -373,31 +410,44 @@ export const AppContext = createContext({
373
410
  */
374
411
 
375
412
  export function useCurrentAccount() {
376
- const { appState: { activated, hasPassword, webVersion, alertUpdatesOnMount, account, settings, primaryOrganizationId }, dispatchApp } = useContext(AppContext);
377
- const hasName = !!account?.profile?.firstName || !!account?.profile?.lastName;
378
- const fullName = buildSingleText([account?.profile?.firstName, account?.profile?.lastName], ' ');
379
- const displayName = guessFirstName(fullName, 8);
380
-
381
- return {
382
- // Dispatch
383
- dispatchApp,
384
-
385
- // App state
386
- account,
387
- settings,
388
- activated,
389
- hasPassword,
390
- webVersion,
391
- alertUpdatesOnMount,
392
-
393
- // Computed
394
- isLoggedIn: !!account?.id,
395
- hasName,
396
- fullName,
397
- displayName,
398
- labelName: displayName || account?.email?.address || '?',
399
- primaryOrganizationId
400
- };
413
+ const {
414
+ appState: {
415
+ activated,
416
+ hasPassword,
417
+ webVersion,
418
+ alertUpdatesOnMount,
419
+ account,
420
+ settings,
421
+ primaryOrganizationId,
422
+ },
423
+ dispatchApp,
424
+ } = useContext(AppContext);
425
+ const hasName = !!account?.profile?.firstName || !!account?.profile?.lastName;
426
+ const { fullName, displayName } = getDisplayName(
427
+ account?.profile?.firstName,
428
+ account?.profile?.lastName,
429
+ );
430
+
431
+ return {
432
+ // Dispatch
433
+ dispatchApp,
434
+
435
+ // App state
436
+ account,
437
+ settings,
438
+ activated,
439
+ hasPassword,
440
+ webVersion,
441
+ alertUpdatesOnMount,
442
+
443
+ // Computed
444
+ isLoggedIn: !!account?.id,
445
+ hasName,
446
+ fullName,
447
+ displayName,
448
+ labelName: displayName || account?.email?.address || '?',
449
+ primaryOrganizationId,
450
+ };
401
451
  }
402
452
 
403
453
  /**
@@ -405,6 +455,8 @@ export function useCurrentAccount() {
405
455
  */
406
456
 
407
457
  export function useIsLoggedIn() {
408
- const { appState: { account } } = useContext(AppContext);
409
- return !!account?.id;
458
+ const {
459
+ appState: { account },
460
+ } = useContext(AppContext);
461
+ return !!account?.id;
410
462
  }