@opexa/portal-components 0.0.686 → 0.0.688

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.
@@ -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
- 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(QrCode.DownloadTrigger, { fileName: `qrcode-${Date.now()}`, mimeType: "image/png", className: "mt-5 block w-full text-center font-semibold text-sm text-text-secondary-700", children: "Download QR Code" }))] }));
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,12 +17,6 @@ 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
- });
26
20
  const router = useRouter();
27
21
  const globalStore = useGlobalStore(useShallow((ctx) => ({
28
22
  kyc: ctx.kyc,
@@ -50,22 +44,9 @@ export function KYCReminder(props) {
50
44
  });
51
45
  const { data: session, isLoading: sessionLoading } = useSessionQuery();
52
46
  const { data: account, isLoading: accountLoading } = useAccountQuery();
53
- console.log('[KYCReminder] Query states:', {
54
- sessionLoading,
55
- accountLoading,
56
- sessionStatus: session?.status,
57
- hasAccount: !!account
58
- });
59
47
  const isPending = account?.verificationStatus === 'PENDING';
60
48
  const isNotVerified = account?.verificationStatus === 'UNVERIFIED';
61
49
  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
- });
69
50
  const daysFromCreationToNow = useMemo(() => {
70
51
  if (!account?.dateTimeCreated)
71
52
  return 0;
@@ -73,12 +54,6 @@ export function KYCReminder(props) {
73
54
  const now = new Date();
74
55
  return differenceInCalendarDays(now, creationDate);
75
56
  }, [account?.dateTimeCreated]);
76
- console.log('[KYCReminder] Account timing:', {
77
- dateTimeCreated: account?.dateTimeCreated,
78
- daysFromCreationToNow,
79
- isWithin3Days: daysFromCreationToNow <= 3,
80
- isAfter1Day: daysFromCreationToNow > 1
81
- });
82
57
  const isAccountReady = !accountLoading;
83
58
  const isSessionReady = !sessionLoading && session?.status === 'authenticated';
84
59
  const isKYCReminderOpen = globalStore.kycReminder.open && !globalStore.kyc.open;
@@ -86,49 +61,13 @@ export function KYCReminder(props) {
86
61
  const isKYCStateRelevant = isNotVerified ||
87
62
  (isPending && isVerificationLocked) ||
88
63
  (isNotVerified && isVerificationLocked);
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);
64
+ return (_jsx(Dialog.Root, { open: isSessionReady &&
65
+ isAccountReady &&
66
+ isKYCReminderOpen &&
67
+ isKYCStateRelevant &&
68
+ isResponsibleGamingReminderClosed, onOpenChange: (details) => {
118
69
  globalStore.kycReminder.setOpen(details.open);
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: () => {
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: [!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: () => {
132
71
  api.setOpen(false);
133
72
  globalStore.kyc.setOpen(true);
134
73
  }, children: "Complete KYC" }), ' ', _jsx(Button, { className: "bg-transparent text-text-brand-primary-600", onClick: () => {
@@ -1,4 +1 @@
1
- export interface KycOpenOnHomeMountProps {
2
- isSkippable?: boolean;
3
- }
4
- export declare function KycOpenOnHomeMount(props: KycOpenOnHomeMountProps): null;
1
+ export declare function KycOpenOnHomeMount(): null;
@@ -3,43 +3,13 @@ import { useEffect } from 'react';
3
3
  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
- export function KycOpenOnHomeMount(props) {
7
- console.log('[KycOpenOnHomeMount] Component mounted with props:', props);
6
+ export function KycOpenOnHomeMount() {
8
7
  const setkycReminderOpen = useGlobalStore((s) => s.kycReminder.setOpen);
9
8
  const setkycOpen = useGlobalStore((s) => s.kyc.setOpen);
10
9
  const { data: verification, isLoading: verificationLoading } = useMemberVerificationQuery();
11
10
  const { data: account, isLoading: accountLoading } = useAccountQuery();
12
- console.log('[KycOpenOnHomeMount] Query states:', {
13
- verificationLoading,
14
- accountLoading,
15
- hasVerificationData: !!verification,
16
- hasAccountData: !!account
17
- });
18
11
  const isVerificationLocked = account?.status === 'VERIFICATION_LOCKED';
19
12
  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
- });
43
13
  const hasntSubmittedCompliantDocs = account?.verified ||
44
14
  verification?.sumsubVerified ||
45
15
  verification?.status === 'APPROVED' ||
@@ -62,57 +32,28 @@ export function KycOpenOnHomeMount(props) {
62
32
  !verification?.permanentAddress ||
63
33
  !verification?.placeOfBirth ||
64
34
  !verification?.address;
65
- console.log('[KycOpenOnHomeMount] KYC status calculations:', {
66
- hasntSubmittedCompliantDocs,
67
- hasntCompletedKYC,
68
- isSkippable: props.isSkippable
69
- });
70
35
  useEffect(() => {
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
- });
36
+ console.log(hasntSubmittedCompliantDocs, hasntCompletedKYC);
81
37
  if (!verificationLoading && !accountLoading) {
82
- console.log('[KycOpenOnHomeMount] Queries loaded, processing logic...');
83
38
  // Handle pending case with feature flag
84
39
  if (isPending) {
85
- console.log('[KycOpenOnHomeMount] Account is pending - closing KYC modal, opening reminder');
86
40
  setkycOpen(false);
87
41
  setkycReminderOpen(true);
88
42
  }
89
43
  if (hasntSubmittedCompliantDocs || hasntCompletedKYC) {
90
- if (props.isSkippable) {
91
- console.log('[KycOpenOnHomeMount] KYC incomplete but skippable - opening reminder');
92
- setkycReminderOpen(true);
93
- }
94
- else {
95
- console.log('[KycOpenOnHomeMount] KYC incomplete and not skippable - opening KYC modal');
96
- setkycOpen(true);
97
- }
44
+ setkycReminderOpen(true);
98
45
  }
99
46
  else if ((!hasntSubmittedCompliantDocs && hasntCompletedKYC) ||
100
47
  isVerificationLocked) {
101
- console.log('[KycOpenOnHomeMount] Partial completion or verification locked - opening reminder');
102
48
  setkycReminderOpen(true);
103
49
  }
104
50
  else {
105
- console.log('[KycOpenOnHomeMount] KYC complete - closing reminder');
106
51
  setkycReminderOpen(false);
107
52
  }
108
53
  }
109
- else {
110
- console.log('[KycOpenOnHomeMount] Still loading queries, skipping logic');
111
- }
112
54
  }, [
113
55
  setkycReminderOpen,
114
56
  setkycOpen,
115
- props.isSkippable,
116
57
  hasntSubmittedCompliantDocs,
117
58
  verificationLoading,
118
59
  accountLoading,