@opexa/portal-components 0.1.29 → 0.1.31

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.
@@ -17,7 +17,7 @@ import { useProfileCompletionQuery } from '../../client/hooks/useProfileCompleti
17
17
  import { useSignOutMutation } from '../../client/hooks/useSignOutMutation.js';
18
18
  import { useUnreadMessagesCountQuery } from '../../client/hooks/useUnreadMessagesCountQuery.js';
19
19
  import { getSession } from '../../client/services/getSession.js';
20
- import { BIOMETRIC_STORAGE_KEY } from '../../client/utils/biometric.js';
20
+ import { clearLocalStorageOnLogout } from '../../utils/clear-local-storage-on-logout.js';
21
21
  import { AlertCircleIcon } from '../../icons/AlertCircleIcon.js';
22
22
  import { Bell01Icon } from '../../icons/Bell01Icon.js';
23
23
  import { ChevronRightIcon } from '../../icons/ChevronRightIcon.js';
@@ -124,16 +124,7 @@ function Links({ router, classNames, }) {
124
124
  })));
125
125
  const signOutMutation = useSignOutMutation({
126
126
  onSuccess: async () => {
127
- const keepLocal = new Set([BIOMETRIC_STORAGE_KEY]);
128
- for (let i = 0; i < localStorage.length;) {
129
- const key = localStorage.key(i);
130
- if (key && !keepLocal.has(key)) {
131
- localStorage.removeItem(key);
132
- }
133
- else {
134
- i++;
135
- }
136
- }
127
+ clearLocalStorageOnLogout();
137
128
  const keepSession = new Set(['accessGranted']);
138
129
  for (let i = 0; i < sessionStorage.length;) {
139
130
  const key = sessionStorage.key(i);
@@ -11,8 +11,8 @@ import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
11
11
  import { useSessionQuery } from '../../client/hooks/useSessionQuery.js';
12
12
  import { useSignOutMutation } from '../../client/hooks/useSignOutMutation.js';
13
13
  import { getSession } from '../../client/services/getSession.js';
14
- import { BIOMETRIC_STORAGE_KEY } from '../../client/utils/biometric.js';
15
14
  import { TERMS_OF_USE_PENDING_STORAGE_KEY } from '../../constants/index.js';
15
+ import { clearLocalStorageOnLogout } from '../../utils/clear-local-storage-on-logout.js';
16
16
  import { setDisclaimerAccepted } from '../../utils/disclaimer-cooldown.js';
17
17
  import { AlertCircleIcon } from '../../icons/AlertCircleIcon.js';
18
18
  import { CheckIcon } from '../../icons/CheckIcon.js';
@@ -57,17 +57,7 @@ export function DisclaimerV2(props) {
57
57
  ]);
58
58
  const signOutMutation = useSignOutMutation({
59
59
  async onSuccess() {
60
- // Clear everything except the 'biometric' entry
61
- const keep = new Set([BIOMETRIC_STORAGE_KEY]);
62
- for (let i = 0; i < localStorage.length;) {
63
- const key = localStorage.key(i);
64
- if (key && !keep.has(key)) {
65
- localStorage.removeItem(key);
66
- }
67
- else {
68
- i++;
69
- }
70
- }
60
+ clearLocalStorageOnLogout();
71
61
  sessionStorage.clear();
72
62
  },
73
63
  });
@@ -16,7 +16,7 @@ import { useMemberVerificationQuery } from '../../../client/hooks/useMemberVerif
16
16
  import { useSignOutMutation } from '../../../client/hooks/useSignOutMutation.js';
17
17
  import { useUpdateMemberVerificationMutation } from '../../../client/hooks/useUpdateMemberVerificationMutation.js';
18
18
  import { getSession } from '../../../client/services/getSession.js';
19
- import { BIOMETRIC_STORAGE_KEY } from '../../../client/utils/biometric.js';
19
+ import { clearLocalStorageOnLogout } from '../../../utils/clear-local-storage-on-logout.js';
20
20
  import { toaster } from '../../../client/utils/toaster.js';
21
21
  import { CheckIcon } from '../../../icons/CheckIcon.js';
22
22
  import { ChevronDownIcon } from '../../../icons/ChevronDownIcon.js';
@@ -122,16 +122,7 @@ export function PersonalInformation() {
122
122
  const router = useRouter();
123
123
  const signOutMutation = useSignOutMutation({
124
124
  async onSuccess() {
125
- const keep = new Set([BIOMETRIC_STORAGE_KEY]);
126
- for (let i = 0; i < localStorage.length;) {
127
- const key = localStorage.key(i);
128
- if (key && !keep.has(key)) {
129
- localStorage.removeItem(key);
130
- }
131
- else {
132
- i++;
133
- }
134
- }
125
+ clearLocalStorageOnLogout();
135
126
  sessionStorage.clear();
136
127
  router.replace('/');
137
128
  },
@@ -17,7 +17,7 @@ import { useSignOutMutation } from '../../../client/hooks/useSignOutMutation.js'
17
17
  import { useUpdateAccountMutation } from '../../../client/hooks/useUpdateAccountMutation.js';
18
18
  import { useUpdateMemberVerificationMutation } from '../../../client/hooks/useUpdateMemberVerificationMutation.js';
19
19
  import { getSession } from '../../../client/services/getSession.js';
20
- import { BIOMETRIC_STORAGE_KEY } from '../../../client/utils/biometric.js';
20
+ import { clearLocalStorageOnLogout } from '../../../utils/clear-local-storage-on-logout.js';
21
21
  import { toaster } from '../../../client/utils/toaster.js';
22
22
  import { ObjectType } from '../../../services/ObjectType.js';
23
23
  import { unregisterFCMDevice } from '../../../services/trigger.js';
@@ -102,16 +102,7 @@ export function PersonalInformation() {
102
102
  });
103
103
  const signOutMutation = useSignOutMutation({
104
104
  async onSuccess() {
105
- const keep = new Set([BIOMETRIC_STORAGE_KEY]);
106
- for (let i = 0; i < localStorage.length;) {
107
- const key = localStorage.key(i);
108
- if (key && !keep.has(key)) {
109
- localStorage.removeItem(key);
110
- }
111
- else {
112
- i++;
113
- }
114
- }
105
+ clearLocalStorageOnLogout();
115
106
  sessionStorage.clear();
116
107
  router.replace('/');
117
108
  },
@@ -11,7 +11,7 @@ import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
11
11
  import { useSessionQuery } from '../../client/hooks/useSessionQuery.js';
12
12
  import { useSignOutMutation } from '../../client/hooks/useSignOutMutation.js';
13
13
  import { getSession } from '../../client/services/getSession.js';
14
- import { BIOMETRIC_STORAGE_KEY } from '../../client/utils/biometric.js';
14
+ import { clearLocalStorageOnLogout } from '../../utils/clear-local-storage-on-logout.js';
15
15
  import { FileCheck02Icon } from '../../icons/FileCheck02Icon.js';
16
16
  import { XIcon } from '../../icons/XIcon.js';
17
17
  import pagcorLogo from '../../images/pagcor.png';
@@ -36,17 +36,7 @@ export function KYCReminder({ enablePendingKycReminder = false, ...props }) {
36
36
  })));
37
37
  const signOutMutation = useSignOutMutation({
38
38
  async onSuccess() {
39
- // Clear everything except the 'biometric' entry
40
- const keep = new Set([BIOMETRIC_STORAGE_KEY]);
41
- for (let i = 0; i < localStorage.length;) {
42
- const key = localStorage.key(i);
43
- if (key && !keep.has(key)) {
44
- localStorage.removeItem(key);
45
- }
46
- else {
47
- i++;
48
- }
49
- }
39
+ clearLocalStorageOnLogout();
50
40
  sessionStorage.clear();
51
41
  router.replace('/');
52
42
  },
@@ -44,6 +44,15 @@ export function KycOpenOnHomeMount({ isSkippable, bypassKycCheck, enablePendingK
44
44
  }
45
45
  return;
46
46
  }
47
+ if (isVerificationLocked) {
48
+ if (isKycOpen && !isKycReminderOpen) {
49
+ return;
50
+ }
51
+ setkycOpen(false);
52
+ setkycAccountVerificationRequired(false);
53
+ setkycReminderOpen(true);
54
+ return;
55
+ }
47
56
  // If a resubmission is already pending review, do not re-open KYC.
48
57
  if (isPending) {
49
58
  setkycOpen(false);
@@ -4,7 +4,7 @@ import { useRouter } from 'next/navigation';
4
4
  import invariant from 'tiny-invariant';
5
5
  import { useSignOutMutation } from '../../../client/hooks/useSignOutMutation.js';
6
6
  import { getSession } from '../../../client/services/getSession.js';
7
- import { BIOMETRIC_STORAGE_KEY } from '../../../client/utils/biometric.js';
7
+ import { clearLocalStorageOnLogout } from '../../../utils/clear-local-storage-on-logout.js';
8
8
  import { unregisterFCMDevice } from '../../../services/trigger.js';
9
9
  import { getQueryClient } from '../../../utils/getQueryClient.js';
10
10
  import { getSessionQueryKey } from '../../../utils/queryKeys.js';
@@ -13,17 +13,7 @@ export function useLogout(options = {}) {
13
13
  const router = useRouter();
14
14
  const signOutMutation = useSignOutMutation({
15
15
  async onSuccess() {
16
- // Clear everything except the 'biometric' entry
17
- const keep = new Set([BIOMETRIC_STORAGE_KEY]);
18
- for (let i = 0; i < localStorage.length;) {
19
- const key = localStorage.key(i);
20
- if (key && !keep.has(key)) {
21
- localStorage.removeItem(key);
22
- }
23
- else {
24
- i++;
25
- }
26
- }
16
+ clearLocalStorageOnLogout();
27
17
  sessionStorage.clear();
28
18
  router.replace('/');
29
19
  },
@@ -0,0 +1,2 @@
1
+ export declare const LOGOUT_PRESERVED_LOCAL_STORAGE_KEYS: Set<string>;
2
+ export declare function clearLocalStorageOnLogout(): void;
@@ -0,0 +1,17 @@
1
+ import { BIOMETRIC_STORAGE_KEY } from '../client/utils/biometric.js';
2
+ import { DISCLAIMER_ACCEPTED_KEY } from '../constants/index.js';
3
+ export const LOGOUT_PRESERVED_LOCAL_STORAGE_KEYS = new Set([
4
+ BIOMETRIC_STORAGE_KEY,
5
+ DISCLAIMER_ACCEPTED_KEY,
6
+ ]);
7
+ export function clearLocalStorageOnLogout() {
8
+ for (let i = 0; i < localStorage.length;) {
9
+ const key = localStorage.key(i);
10
+ if (key && !LOGOUT_PRESERVED_LOCAL_STORAGE_KEYS.has(key)) {
11
+ localStorage.removeItem(key);
12
+ }
13
+ else {
14
+ i++;
15
+ }
16
+ }
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",