@opexa/portal-components 0.0.685 → 0.0.687
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.
- package/dist/components/AccountInfo/GoogleDisconnect.d.ts +7 -0
- package/dist/components/AccountInfo/GoogleDisconnect.js +11 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHQRCode.js +34 -1
- package/dist/components/KYC/KYCReminder.lazy.js +67 -6
- package/dist/components/KYC/KYCVerificationStatus.lazy.js +4 -7
- package/dist/components/KYC/KycOpenOnHomeMount.js +54 -1
- package/dist/components/PortalProvider/CXDTokenObserver.js +11 -11
- package/dist/icons/LinkBrokenIcon.d.ts +2 -0
- package/dist/icons/LinkBrokenIcon.js +4 -0
- package/dist/ui/AlertDialog/AlertDialog.d.ts +55 -55
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +5 -5
- package/dist/ui/Badge/Badge.d.ts +12 -12
- package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
- package/dist/ui/Badge/badge.recipe.d.ts +3 -3
- package/dist/ui/Carousel/Carousel.d.ts +45 -45
- package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
- package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
- package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
- package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
- package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
- package/dist/ui/Combobox/Combobox.d.ts +42 -42
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
- package/dist/ui/Dialog/Dialog.d.ts +33 -33
- package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
- package/dist/ui/Drawer/Drawer.d.ts +33 -33
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/Menu/Menu.d.ts +198 -198
- package/dist/ui/Menu/menu.recipe.d.ts +11 -11
- package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
- package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
- package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
- package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
- package/dist/ui/Popover/Popover.d.ts +88 -88
- package/dist/ui/Popover/popover.recipe.d.ts +8 -8
- package/dist/ui/Select/Select.d.ts +45 -45
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/table.anatomy.d.ts +1 -1
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/dist/ui/Tabs/Tabs.d.ts +15 -15
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/package.json +1 -1
- package/dist/components/Banner/Banner.client.d.ts +0 -12
- package/dist/components/Banner/Banner.client.js +0 -49
- package/dist/components/PortalProvider/AndroidOnlyComponents.d.ts +0 -1
- package/dist/components/PortalProvider/AndroidOnlyComponents.js +0 -12
- package/dist/components/SignIn/utils.d.ts +0 -8
- package/dist/components/SignIn/utils.js +0 -26
- package/dist/constants/Branches.d.ts +0 -2
- package/dist/constants/Branches.js +0 -42
- package/dist/third-parties/FacebookPixel/FacebookPixel.d.ts +0 -4
- package/dist/third-parties/FacebookPixel/FacebookPixel.js +0 -4
- package/dist/third-parties/FacebookPixel/api.d.ts +0 -0
- package/dist/third-parties/FacebookPixel/api.js +0 -1
- package/dist/third-parties/FacebookPixel/index.d.ts +0 -1
- package/dist/third-parties/FacebookPixel/index.js +0 -1
- package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +0 -4
- package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +0 -4
- package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
- package/dist/third-parties/GoogleRecaptcha/api.js +0 -1
- package/dist/third-parties/GoogleRecaptcha/index.d.ts +0 -1
- package/dist/third-parties/GoogleRecaptcha/index.js +0 -1
- package/dist/third-parties/index.d.ts +0 -2
- package/dist/third-parties/index.js +0 -2
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type UseDisclosureReturn } from '../../client/hooks/useDisclosure';
|
|
2
|
+
interface GoogleDisconnectProps {
|
|
3
|
+
onConfirmAction?: (ctx: UseDisclosureReturn) => React.ReactNode;
|
|
4
|
+
children?: (ctx: UseDisclosureReturn) => React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare function GoogleDisconnect(props: GoogleDisconnectProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useDisclosure, } from '../../client/hooks/useDisclosure.js';
|
|
4
|
+
import { LinkBrokenIcon } from '../../icons/LinkBrokenIcon.js';
|
|
5
|
+
import { XIcon } from '../../icons/XIcon.js';
|
|
6
|
+
import { Dialog } from '../../ui/Dialog/index.js';
|
|
7
|
+
import { Portal } from '../../ui/Portal/index.js';
|
|
8
|
+
export function GoogleDisconnect(props) {
|
|
9
|
+
const disclosure = useDisclosure();
|
|
10
|
+
return (_jsxs(_Fragment, { children: [props.children?.(disclosure), _jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: disclosure.open, onOpenChange: (details) => disclosure.setOpen(details.open), closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "mx-auto min-h-auto max-w-[25rem] overflow-y-auto rounded-xl p-6", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col ", children: [_jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-brand", children: _jsx(LinkBrokenIcon, {}) }), _jsx("h2", { className: "mb-1 text-center font-semibold text-lg xl:mt-xl", children: "Disconnect Google Account" }), _jsx("p", { className: "text-center text-sm text-text-tertiary-600 leading-2xl", children: "Are you sure you want to disconnect your Google account? This may affect your ability to log in or sync data." })] }), _jsx("div", { className: "pt-6", children: props.onConfirmAction?.(disclosure) })] }) })] }) })] }));
|
|
11
|
+
}
|
|
@@ -11,6 +11,10 @@ export function QRPHQRCode(props) {
|
|
|
11
11
|
const QRCode = await import('qrcode');
|
|
12
12
|
const dataUrl = await QRCode.toDataURL(props.qrCodeString, {
|
|
13
13
|
type: 'image/png',
|
|
14
|
+
color: {
|
|
15
|
+
light: '#FFFFFF',
|
|
16
|
+
dark: '#000000',
|
|
17
|
+
},
|
|
14
18
|
});
|
|
15
19
|
const base64 = dataUrl.split(',')[1];
|
|
16
20
|
try {
|
|
@@ -32,5 +36,34 @@ export function QRPHQRCode(props) {
|
|
|
32
36
|
});
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
|
-
|
|
39
|
+
async function handleWebDownload() {
|
|
40
|
+
try {
|
|
41
|
+
const QRCode = await import('qrcode');
|
|
42
|
+
const dataUrl = await QRCode.toDataURL(props.qrCodeString, {
|
|
43
|
+
type: 'image/png',
|
|
44
|
+
color: {
|
|
45
|
+
light: '#FFFFFF',
|
|
46
|
+
dark: '#000000',
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
const link = document.createElement('a');
|
|
50
|
+
link.href = dataUrl;
|
|
51
|
+
link.download = `qrcode-${Date.now()}.png`;
|
|
52
|
+
document.body.appendChild(link);
|
|
53
|
+
link.click();
|
|
54
|
+
document.body.removeChild(link);
|
|
55
|
+
toaster.success({
|
|
56
|
+
title: 'QR Code successfully saved to your device',
|
|
57
|
+
description: 'To continue with your deposit, please upload the QR code in your banking app.',
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.log(error, 'error');
|
|
62
|
+
toaster.error({
|
|
63
|
+
title: 'Failed to save QR Code',
|
|
64
|
+
description: 'An error occurred while saving the QR code to your device.',
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return (_jsxs(QrCode.Root, { value: props.qrCodeString, className: "mx-auto mt-6 w-[12.5rem] rounded-lg border border-border-primary bg-bg-brand-secondary-alt p-5 lg:w-[13rem] lg:p-6", children: [_jsxs("div", { className: "relative", children: [_jsx(QrCode.Frame, { className: "mx-auto size-[10rem] rounded-[0.25rem] border border-border-primary bg-white", children: _jsx(QrCode.Pattern, {}) }), _jsx(QrCode.Overlay, { className: "bg-white p-0.5", children: _jsx(Image, { src: qrphIcon, alt: "", className: "size-8", width: 40, height: 40 }) })] }), Capacitor.isNativePlatform() ? (_jsx("button", { type: "button", onClick: handleNativeDownload, className: "mt-5 block w-full text-center font-semibold text-sm text-text-secondary-700", children: "Download QR Code to Device" })) : (_jsx("button", { type: "button", onClick: handleWebDownload, className: "mt-5 block w-full text-center font-semibold text-sm text-text-secondary-700", children: "Download QR Code" }))] }));
|
|
36
69
|
}
|
|
@@ -17,6 +17,12 @@ import { Button } from '../../ui/Button/index.js';
|
|
|
17
17
|
import { Dialog } from '../../ui/Dialog/index.js';
|
|
18
18
|
import { Portal } from '../../ui/Portal/index.js';
|
|
19
19
|
export function KYCReminder(props) {
|
|
20
|
+
console.log('[KYCReminder] Component rendered with props:', {
|
|
21
|
+
siteName: props.siteName,
|
|
22
|
+
hasLogo: !!props.logo,
|
|
23
|
+
hasTitleBgColor: !!props.titleBgColor,
|
|
24
|
+
hasDescriptionBgColor: !!props.descriptionBgColor
|
|
25
|
+
});
|
|
20
26
|
const router = useRouter();
|
|
21
27
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
22
28
|
kyc: ctx.kyc,
|
|
@@ -44,9 +50,22 @@ export function KYCReminder(props) {
|
|
|
44
50
|
});
|
|
45
51
|
const { data: session, isLoading: sessionLoading } = useSessionQuery();
|
|
46
52
|
const { data: account, isLoading: accountLoading } = useAccountQuery();
|
|
53
|
+
console.log('[KYCReminder] Query states:', {
|
|
54
|
+
sessionLoading,
|
|
55
|
+
accountLoading,
|
|
56
|
+
sessionStatus: session?.status,
|
|
57
|
+
hasAccount: !!account
|
|
58
|
+
});
|
|
47
59
|
const isPending = account?.verificationStatus === 'PENDING';
|
|
48
60
|
const isNotVerified = account?.verificationStatus === 'UNVERIFIED';
|
|
49
61
|
const isVerificationLocked = account?.status === 'VERIFICATION_LOCKED';
|
|
62
|
+
console.log('[KYCReminder] Account verification states:', {
|
|
63
|
+
verificationStatus: account?.verificationStatus,
|
|
64
|
+
accountStatus: account?.status,
|
|
65
|
+
isPending,
|
|
66
|
+
isNotVerified,
|
|
67
|
+
isVerificationLocked
|
|
68
|
+
});
|
|
50
69
|
const daysFromCreationToNow = useMemo(() => {
|
|
51
70
|
if (!account?.dateTimeCreated)
|
|
52
71
|
return 0;
|
|
@@ -54,6 +73,12 @@ export function KYCReminder(props) {
|
|
|
54
73
|
const now = new Date();
|
|
55
74
|
return differenceInCalendarDays(now, creationDate);
|
|
56
75
|
}, [account?.dateTimeCreated]);
|
|
76
|
+
console.log('[KYCReminder] Account timing:', {
|
|
77
|
+
dateTimeCreated: account?.dateTimeCreated,
|
|
78
|
+
daysFromCreationToNow,
|
|
79
|
+
isWithin3Days: daysFromCreationToNow <= 3,
|
|
80
|
+
isAfter1Day: daysFromCreationToNow > 1
|
|
81
|
+
});
|
|
57
82
|
const isAccountReady = !accountLoading;
|
|
58
83
|
const isSessionReady = !sessionLoading && session?.status === 'authenticated';
|
|
59
84
|
const isKYCReminderOpen = globalStore.kycReminder.open && !globalStore.kyc.open;
|
|
@@ -61,13 +86,49 @@ export function KYCReminder(props) {
|
|
|
61
86
|
const isKYCStateRelevant = isNotVerified ||
|
|
62
87
|
(isPending && isVerificationLocked) ||
|
|
63
88
|
(isNotVerified && isVerificationLocked);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
89
|
+
console.log('[KYCReminder] Global store states:', {
|
|
90
|
+
kycReminderOpen: globalStore.kycReminder.open,
|
|
91
|
+
kycOpen: globalStore.kyc.open,
|
|
92
|
+
responsibleGamingReminderOpen: globalStore.responsibleGamingReminder.open,
|
|
93
|
+
isKYCReminderOpen,
|
|
94
|
+
isResponsibleGamingReminderClosed
|
|
95
|
+
});
|
|
96
|
+
console.log('[KYCReminder] Ready states:', {
|
|
97
|
+
isAccountReady,
|
|
98
|
+
isSessionReady,
|
|
99
|
+
isKYCStateRelevant
|
|
100
|
+
});
|
|
101
|
+
const shouldModalOpen = isSessionReady &&
|
|
102
|
+
isAccountReady &&
|
|
103
|
+
isKYCReminderOpen &&
|
|
104
|
+
isKYCStateRelevant &&
|
|
105
|
+
isResponsibleGamingReminderClosed;
|
|
106
|
+
console.log('[KYCReminder] Final modal decision:', {
|
|
107
|
+
shouldModalOpen,
|
|
108
|
+
conditions: {
|
|
109
|
+
isSessionReady,
|
|
110
|
+
isAccountReady,
|
|
111
|
+
isKYCReminderOpen,
|
|
112
|
+
isKYCStateRelevant,
|
|
113
|
+
isResponsibleGamingReminderClosed
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return (_jsx(Dialog.Root, { open: shouldModalOpen, onOpenChange: (details) => {
|
|
117
|
+
console.log('[KYCReminder] Dialog open change:', details);
|
|
69
118
|
globalStore.kycReminder.setOpen(details.open);
|
|
70
|
-
}, closeOnEscape: false, closeOnInteractOutside: false, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "mx-auto h-fit max-w-[calc(100dvw-1rem)] overflow-y-auto rounded-lg bg-bg-primary lg:max-w-[400px]", children: [
|
|
119
|
+
}, closeOnEscape: false, closeOnInteractOutside: false, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "mx-auto h-fit max-w-[calc(100dvw-1rem)] overflow-y-auto rounded-lg bg-bg-primary lg:max-w-[400px]", children: [(() => {
|
|
120
|
+
const condition1 = !isPending && isNotVerified && isVerificationLocked;
|
|
121
|
+
const condition2 = isNotVerified && daysFromCreationToNow <= 3 && daysFromCreationToNow > 1 && !isVerificationLocked;
|
|
122
|
+
const condition3 = isNotVerified && !isVerificationLocked && !(daysFromCreationToNow <= 3 && daysFromCreationToNow > 1);
|
|
123
|
+
const condition4 = isPending && isVerificationLocked;
|
|
124
|
+
console.log('[KYCReminder] Modal variant conditions:', {
|
|
125
|
+
condition1_TemporarilyLocked: condition1,
|
|
126
|
+
condition2_FriendlyReminder: condition2,
|
|
127
|
+
condition3_PersonalVerification: condition3,
|
|
128
|
+
condition4_VerificationInProgress: condition4
|
|
129
|
+
});
|
|
130
|
+
return null;
|
|
131
|
+
})(), !isPending && isNotVerified && isVerificationLocked && (_jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mx-auto mb-4 w-fit rounded-full p-2", children: _jsx(Image, { src: props.logo, alt: `${props.siteName} logo`, width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }) }), _jsx("h2", { className: `mt-4 font-semibold text-lg ${props.titleBgColor}`, children: "Temporarily Locked" }), _jsx("p", { className: `mt-xs text-sm text-text-tertiary-600 ${props.descriptionBgColor}`, children: "Your account has been locked due to incomplete verification. Please complete your verification to restore full access." }), _jsxs("div", { className: "mt-6 flex w-full items-center justify-center gap-3xl", children: [_jsx(Image, { src: props.pagcorLogo?.logo ?? pagcorLogo, alt: "PAGCOR logo", height: 88, width: 88, className: `h-[88px] w-auto shrink-0 ${props.pagcorLogo?.styles ?? ''}`, draggable: false, unoptimized: true }), _jsx(Image, { src: props.responsibleGamingLogo?.logo ?? responsibleGamingLogo, alt: "Responsible Gaming logo", height: 50, width: 186, className: `h-[50px] w-auto shrink-0 ${props.responsibleGamingLogo?.styles ?? ''}`, draggable: false, unoptimized: true })] }), _jsx(Dialog.Context, { children: (api) => (_jsxs("div", { className: "mt-6 space-y-lg", children: [_jsx(Button, { onClick: () => {
|
|
71
132
|
api.setOpen(false);
|
|
72
133
|
globalStore.kyc.setOpen(true);
|
|
73
134
|
}, children: "Complete KYC" }), ' ', _jsx(Button, { className: "bg-transparent text-text-brand-primary-600", onClick: () => {
|
|
@@ -19,18 +19,15 @@ export function KYCVerificationStatus() {
|
|
|
19
19
|
const icons = status === 'PENDING' ? bellIcon : alertIcon;
|
|
20
20
|
return (_jsx(Dialog.Root, { open: globalStore.kycVerificationStatus.open, onOpenChange: (details) => {
|
|
21
21
|
globalStore.kycVerificationStatus.setOpen(details.open);
|
|
22
|
-
}, closeOnEscape: false, closeOnInteractOutside: false, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)] flex items-center justify-center", children: _jsx(Dialog.Content, { className: "mx-auto h-fit w-[450px] overflow-y-auto rounded-lg bg-bg-primary", children: _jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mb-3xl grid h-[200px] w-full place-items-center rounded-xl bg-radial from-40% from-button-primary-bg to-bg-brand-solid", children: _jsx(Image, { src: icons, alt: "icon", className: "w-60 object-contain", draggable: false, width: 120, height: 120 }) }), _jsxs("h1", { className: "font-semibold text-lg text-white", children: [status === 'PENDING' && 'Verification in Progress', status === 'REJECTED' && 'Verification Rejected', status === 'UNVERIFIED'
|
|
23
|
-
(status === 'CREATED' && 'Verification Required')] }), _jsxs("p", { className: "mb-4xl text-[#94969C] text-base", children: [status === 'PENDING' &&
|
|
22
|
+
}, closeOnEscape: false, closeOnInteractOutside: false, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)] flex items-center justify-center", children: _jsx(Dialog.Content, { className: "mx-auto h-fit w-[450px] overflow-y-auto rounded-lg bg-bg-primary", children: _jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mb-3xl grid h-[200px] w-full place-items-center rounded-xl bg-radial from-40% from-button-primary-bg to-bg-brand-solid", children: _jsx(Image, { src: icons, alt: "icon", className: "w-60 object-contain", draggable: false, width: 120, height: 120 }) }), _jsxs("h1", { className: "font-semibold text-lg text-white", children: [status === 'PENDING' && 'Verification in Progress', status === 'REJECTED' && 'Verification Rejected', status === 'UNVERIFIED' && 'Verification Required'] }), _jsxs("p", { className: "mb-4xl text-[#94969C] text-base", children: [status === 'PENDING' &&
|
|
24
23
|
`Your account verification is still under review. Please wait
|
|
25
24
|
until it's approved before you can continue playing or
|
|
26
25
|
depositing.`, status === 'REJECTED' &&
|
|
27
|
-
'Your account verification was not approved. Please resubmit your verification to regain full access.', status === 'UNVERIFIED'
|
|
28
|
-
(status === '
|
|
29
|
-
'Your account is not yet verified. Please complete the verification process to continue playing or depositing.')] }), _jsxs(Button, { variant: "solid", className: twMerge('mb-2 w-full', status === 'PENDING' && 'hidden'), onClick: () => {
|
|
26
|
+
'Your account verification was not approved. Please resubmit your verification to regain full access.', status === 'UNVERIFIED' &&
|
|
27
|
+
'Your account is not yet verified. Please complete the verification process to continue playing or depositing.'] }), _jsxs(Button, { variant: "solid", className: twMerge('mb-2 w-full', status === 'PENDING' && 'hidden'), onClick: () => {
|
|
30
28
|
globalStore.kycVerificationStatus.setOpen(false);
|
|
31
29
|
globalStore.kyc.setOpen(true);
|
|
32
|
-
}, children: [status === 'REJECTED' && 'Resubmit Verification', status === 'UNVERIFIED'
|
|
33
|
-
(status === 'CREATED' && 'Verify Now')] }), _jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
30
|
+
}, children: [status === 'REJECTED' && 'Resubmit Verification', status === 'UNVERIFIED' && 'Verify Now'] }), _jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
34
31
|
globalStore.kycVerificationStatus.setOpen(false);
|
|
35
32
|
}, children: "Close" })] }) }) })] }) }));
|
|
36
33
|
}
|
|
@@ -4,12 +4,42 @@ import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
|
|
|
4
4
|
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
5
5
|
import { useMemberVerificationQuery } from '../../client/hooks/useMemberVerificationQuery.js';
|
|
6
6
|
export function KycOpenOnHomeMount(props) {
|
|
7
|
+
console.log('[KycOpenOnHomeMount] Component mounted with props:', props);
|
|
7
8
|
const setkycReminderOpen = useGlobalStore((s) => s.kycReminder.setOpen);
|
|
8
9
|
const setkycOpen = useGlobalStore((s) => s.kyc.setOpen);
|
|
9
10
|
const { data: verification, isLoading: verificationLoading } = useMemberVerificationQuery();
|
|
10
11
|
const { data: account, isLoading: accountLoading } = useAccountQuery();
|
|
12
|
+
console.log('[KycOpenOnHomeMount] Query states:', {
|
|
13
|
+
verificationLoading,
|
|
14
|
+
accountLoading,
|
|
15
|
+
hasVerificationData: !!verification,
|
|
16
|
+
hasAccountData: !!account
|
|
17
|
+
});
|
|
11
18
|
const isVerificationLocked = account?.status === 'VERIFICATION_LOCKED';
|
|
12
19
|
const isPending = account?.verificationStatus === 'PENDING';
|
|
20
|
+
console.log('[KycOpenOnHomeMount] Account status:', {
|
|
21
|
+
accountStatus: account?.status,
|
|
22
|
+
verificationStatus: account?.verificationStatus,
|
|
23
|
+
isVerificationLocked,
|
|
24
|
+
isPending,
|
|
25
|
+
verified: account?.verified
|
|
26
|
+
});
|
|
27
|
+
console.log('[KycOpenOnHomeMount] Verification data:', {
|
|
28
|
+
sumsubVerified: verification?.sumsubVerified,
|
|
29
|
+
status: verification?.status,
|
|
30
|
+
nationality: !!verification?.nationality,
|
|
31
|
+
natureOfWork: !!verification?.natureOfWork,
|
|
32
|
+
sourceOfIncome: !!verification?.sourceOfIncome,
|
|
33
|
+
permanentAddress: !!verification?.permanentAddress,
|
|
34
|
+
placeOfBirth: !!verification?.placeOfBirth,
|
|
35
|
+
address: !!verification?.address,
|
|
36
|
+
selfieImage: !!verification?.selfieImage,
|
|
37
|
+
idFrontImage: !!verification?.idFrontImage
|
|
38
|
+
});
|
|
39
|
+
console.log('[KycOpenOnHomeMount] Account KYC data:', {
|
|
40
|
+
realName: !!account?.realName,
|
|
41
|
+
birthDay: !!account?.birthDay
|
|
42
|
+
});
|
|
13
43
|
const hasntSubmittedCompliantDocs = account?.verified ||
|
|
14
44
|
verification?.sumsubVerified ||
|
|
15
45
|
verification?.status === 'APPROVED' ||
|
|
@@ -32,30 +62,53 @@ export function KycOpenOnHomeMount(props) {
|
|
|
32
62
|
!verification?.permanentAddress ||
|
|
33
63
|
!verification?.placeOfBirth ||
|
|
34
64
|
!verification?.address;
|
|
65
|
+
console.log('[KycOpenOnHomeMount] KYC status calculations:', {
|
|
66
|
+
hasntSubmittedCompliantDocs,
|
|
67
|
+
hasntCompletedKYC,
|
|
68
|
+
isSkippable: props.isSkippable
|
|
69
|
+
});
|
|
35
70
|
useEffect(() => {
|
|
36
|
-
console.log(
|
|
71
|
+
console.log('[KycOpenOnHomeMount] useEffect triggered');
|
|
72
|
+
console.log('[KycOpenOnHomeMount] Current state:', {
|
|
73
|
+
hasntSubmittedCompliantDocs,
|
|
74
|
+
hasntCompletedKYC,
|
|
75
|
+
verificationLoading,
|
|
76
|
+
accountLoading,
|
|
77
|
+
isPending,
|
|
78
|
+
isVerificationLocked,
|
|
79
|
+
isSkippable: props.isSkippable
|
|
80
|
+
});
|
|
37
81
|
if (!verificationLoading && !accountLoading) {
|
|
82
|
+
console.log('[KycOpenOnHomeMount] Queries loaded, processing logic...');
|
|
38
83
|
// Handle pending case with feature flag
|
|
39
84
|
if (isPending) {
|
|
85
|
+
console.log('[KycOpenOnHomeMount] Account is pending - closing KYC modal, opening reminder');
|
|
40
86
|
setkycOpen(false);
|
|
41
87
|
setkycReminderOpen(true);
|
|
42
88
|
}
|
|
43
89
|
if (hasntSubmittedCompliantDocs || hasntCompletedKYC) {
|
|
44
90
|
if (props.isSkippable) {
|
|
91
|
+
console.log('[KycOpenOnHomeMount] KYC incomplete but skippable - opening reminder');
|
|
45
92
|
setkycReminderOpen(true);
|
|
46
93
|
}
|
|
47
94
|
else {
|
|
95
|
+
console.log('[KycOpenOnHomeMount] KYC incomplete and not skippable - opening KYC modal');
|
|
48
96
|
setkycOpen(true);
|
|
49
97
|
}
|
|
50
98
|
}
|
|
51
99
|
else if ((!hasntSubmittedCompliantDocs && hasntCompletedKYC) ||
|
|
52
100
|
isVerificationLocked) {
|
|
101
|
+
console.log('[KycOpenOnHomeMount] Partial completion or verification locked - opening reminder');
|
|
53
102
|
setkycReminderOpen(true);
|
|
54
103
|
}
|
|
55
104
|
else {
|
|
105
|
+
console.log('[KycOpenOnHomeMount] KYC complete - closing reminder');
|
|
56
106
|
setkycReminderOpen(false);
|
|
57
107
|
}
|
|
58
108
|
}
|
|
109
|
+
else {
|
|
110
|
+
console.log('[KycOpenOnHomeMount] Still loading queries, skipping logic');
|
|
111
|
+
}
|
|
59
112
|
}, [
|
|
60
113
|
setkycReminderOpen,
|
|
61
114
|
setkycOpen,
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { addHours } from 'date-fns';
|
|
3
3
|
import { clamp } from 'lodash-es';
|
|
4
|
+
import { useSearchParams } from 'next/navigation';
|
|
4
5
|
import { useLocalStorage, useTimeout } from 'usehooks-ts';
|
|
5
6
|
import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
|
|
6
7
|
export function CXDTokenObserver() {
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const [cxd, setCxd, removeCxd] = useLocalStorage('
|
|
8
|
+
const searchParams = useSearchParams();
|
|
9
|
+
const cxdToken = searchParams.get('cxd');
|
|
10
|
+
const accountQuery = useAccountQuery();
|
|
11
|
+
const account = accountQuery.data;
|
|
12
|
+
const [cxd, setCxd, removeCxd] = useLocalStorage('WebPortalCellxpertCxd', null);
|
|
12
13
|
const now = new Date();
|
|
14
|
+
const shouldTimeoutRun = cxdToken && account;
|
|
13
15
|
const removeCxdUntilInMs = cxd?.timestamp
|
|
14
16
|
? clamp(cxd.timestamp - now.getTime(), 0, Infinity)
|
|
15
17
|
: 0;
|
|
16
18
|
useTimeout(() => {
|
|
17
|
-
const isSame = cxd?.cxd ===
|
|
19
|
+
const isSame = cxd?.cxd === cxdToken;
|
|
18
20
|
if (!isSame) {
|
|
19
21
|
const extendedTimestamp = addHours(new Date(), 6).getTime();
|
|
20
22
|
setCxd({
|
|
21
|
-
cxd:
|
|
23
|
+
cxd: cxdToken,
|
|
22
24
|
timestamp: extendedTimestamp,
|
|
23
25
|
});
|
|
24
26
|
}
|
|
25
|
-
},
|
|
26
|
-
useTimeout(() =>
|
|
27
|
-
removeCxd();
|
|
28
|
-
}, account ? removeCxdUntilInMs : null);
|
|
27
|
+
}, shouldTimeoutRun ? 100 : null);
|
|
28
|
+
useTimeout(() => removeCxd(), shouldTimeoutRun ? removeCxdUntilInMs : null);
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function LinkBrokenIcon(props) {
|
|
3
|
+
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", ...props, children: _jsx("path", { d: "M8.5 15.5L15.5 8.49998M9 4V2M15 20V22M4 9H2M20 15H22M4.91421 4.91421L3.5 3.5M19.0858 19.0857L20.5 20.4999M12 17.6568L9.87871 19.7781C8.31662 21.3402 5.78396 21.3402 4.22186 19.7781C2.65976 18.216 2.65976 15.6833 4.22186 14.1212L6.34318 11.9999M17.6569 11.9999L19.7782 9.87859C21.3403 8.31649 21.3403 5.78383 19.7782 4.22174C18.2161 2.65964 15.6835 2.65964 14.1214 4.22174L12 6.34306", stroke: "#FEDF89", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
4
|
+
}
|