@opexa/portal-components 0.0.981 → 0.0.983
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,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { ark } from '@ark-ui/react/factory';
|
|
4
4
|
import FacebookLogin from '@greatsumini/react-facebook-login';
|
|
5
5
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
@@ -160,7 +160,7 @@ function PersonalInfo(props) {
|
|
|
160
160
|
? data.birthDay
|
|
161
161
|
: undefined,
|
|
162
162
|
});
|
|
163
|
-
}), children: [_jsxs("div", { className: "px-4 py-5 lg:px-3xl lg:py-5", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.realName, readOnly: !!account?.realName, children: [_jsx(Field.Label, { children: "Full name" }), _jsx(Field.Input, { ...form.register('realName') }), _jsx(Field.ErrorText, { children: form.formState.errors.realName?.message })] }), _jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.birthDay, readOnly: !!account?.birthDay, children: [_jsx(Field.Label, { children: "Date of birth" }), _jsx(Field.Input, { type: "date", ...form.register('birthDay'), className: twMerge('h-full py-2.5', account?.birthDay && 'pointer-events-none') }), _jsx(Field.ErrorText, { children: form.formState.errors.birthDay?.message })] }), props.shouldShowBranchCode && (_jsxs(Field.Root, { className: "mt-6", readOnly: true, children: [_jsx(Field.Label, { children: "Branch Code" }), _jsx(Field.Input, { type: "text", disabled: true, value: displayBranchName ?? account?.branchCode ?? '' })] })),
|
|
163
|
+
}), children: [_jsxs("div", { className: "px-4 py-5 lg:px-3xl lg:py-5", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.realName, readOnly: !!account?.realName, children: [_jsx(Field.Label, { children: "Full name" }), _jsx(Field.Input, { ...form.register('realName') }), _jsx(Field.ErrorText, { children: form.formState.errors.realName?.message })] }), _jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.birthDay, readOnly: !!account?.birthDay, children: [_jsx(Field.Label, { children: "Date of birth" }), _jsx(Field.Input, { type: "date", ...form.register('birthDay'), className: twMerge('h-full py-2.5', account?.birthDay && 'pointer-events-none') }), _jsx(Field.ErrorText, { children: form.formState.errors.birthDay?.message })] }), props.shouldShowBranchCode && (_jsxs(Field.Root, { className: "mt-6", readOnly: true, children: [_jsx(Field.Label, { children: "Branch Code" }), _jsx(Field.Input, { type: "text", disabled: true, value: displayBranchName ?? account?.branchCode ?? '' })] })), _jsxs(Field.Root, { className: "mt-6", readOnly: true, children: [_jsx(Field.Label, { children: "Address" }), _jsx(Field.Input, { type: "text", readOnly: true, value: verification?.address ?? '' })] }), _jsxs(Field.Root, { className: "mt-6", readOnly: true, children: [_jsx(Field.Label, { children: "Nature of Work" }), _jsx(Field.Input, { type: "text", readOnly: true, value: verification?.natureOfWork ?? '' })] })] }), form.formState.isDirty && (_jsxs("div", { className: "flex justify-end gap-lg border-border-secondary border-t px-xl py-lg lg:px-3xl lg:py-xl", children: [_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, disabled: updateAccountMutation.isPending, onClick: () => form.reset(), children: "Cancel" }), _jsx(Button, { type: "submit", size: "sm", fullWidth: false, disabled: !form.formState.isValid || updateAccountMutation.isPending, children: "Save Changes" })] }))] })] }));
|
|
164
164
|
}
|
|
165
165
|
function ContactInfo({ variant }) {
|
|
166
166
|
const localeInfo = useLocaleInfo();
|
|
@@ -25,7 +25,8 @@ export function KYCDefault(props) {
|
|
|
25
25
|
const isDialogOpen = globalStore.kyc.open &&
|
|
26
26
|
!globalStore.kycReminder.open &&
|
|
27
27
|
!sessionLoading &&
|
|
28
|
-
!globalStore.disclaimer.open
|
|
28
|
+
!globalStore.disclaimer.open &&
|
|
29
|
+
!globalStore.updateMobilePhoneNumber.open;
|
|
29
30
|
return (_jsxs(_Fragment, { children: [_jsx(KYCDefaultContext, { value: kyc, children: _jsx(Dialog.Root, { open: isDialogOpen, onOpenChange: (details) => {
|
|
30
31
|
globalStore.kyc.setOpen(details.open);
|
|
31
32
|
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: kyc.reset, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { className: "fixed top-[57px] overflow-hidden", children: _jsx(Dialog.Content, { className: "mx-auto h-full w-full overflow-y-auto bg-bg-primary-alt md:max-h-[95vh] lg:w-fit", children: _jsxs("div", { className: "mt-[calc(var(--safe-area-inset-top)*3)] flex h-dvh w-full flex-col overflow-y-auto p-3xl sm:h-fit lg:w-[400px]", children: [_jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto mb-5 block h-7.5 w-auto", draggable: false }), _jsx(Indicator, {}), kyc.step === 1 && _jsx(IdentityVerification, {}), kyc.step === 2 && _jsx(PersonalInformation, {})] }) }) })] }) }) }), _jsx(KYCReminder, { ...props }), _jsx(KYCReview, {})] }));
|
|
@@ -28,11 +28,8 @@ export function KycOpenOnHomeMount(props) {
|
|
|
28
28
|
const hasSeenKycModal = sessionStorage.getItem('hasSeenKycModal');
|
|
29
29
|
const isFirstVisit = !hasSeenKycModal;
|
|
30
30
|
// Handle member verification locked FIRST (highest priority)
|
|
31
|
-
if (isVerificationLocked) {
|
|
32
|
-
setkycReminderOpen(true);
|
|
33
|
-
}
|
|
34
31
|
// Handle rejected verification status
|
|
35
|
-
|
|
32
|
+
if (isRejected) {
|
|
36
33
|
if (isFirstVisit) {
|
|
37
34
|
setkycReminderOpen(false);
|
|
38
35
|
setkycOpen(true);
|
|
@@ -55,6 +52,17 @@ export function KycOpenOnHomeMount(props) {
|
|
|
55
52
|
setkycOpen(!shouldShowReminder);
|
|
56
53
|
}
|
|
57
54
|
}
|
|
55
|
+
else if (isVerificationLocked) {
|
|
56
|
+
if (isFirstVisit) {
|
|
57
|
+
setkycReminderOpen(true);
|
|
58
|
+
setkycOpen(false);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
sessionStorage.setItem('hasSeenKycModal', 'true');
|
|
62
|
+
setkycReminderOpen(!shouldShowReminder);
|
|
63
|
+
setkycOpen(shouldShowReminder);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
58
66
|
// Handle completed kyc progress
|
|
59
67
|
else if (isKycCompleted) {
|
|
60
68
|
setkycReminderOpen(false);
|
|
@@ -5,8 +5,10 @@ import Image from 'next/image';
|
|
|
5
5
|
import { useEffect, useRef, useState } from 'react';
|
|
6
6
|
import { Controller, useForm } from 'react-hook-form';
|
|
7
7
|
import z from 'zod';
|
|
8
|
+
import { useShallow } from 'zustand/shallow';
|
|
8
9
|
import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
|
|
9
10
|
import { useCooldown } from '../../client/hooks/useCooldown.js';
|
|
11
|
+
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
10
12
|
import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
|
|
11
13
|
import { useMobileNumberParser } from '../../client/hooks/useMobileNumberParser.js';
|
|
12
14
|
import { useSendVerificationCodeMutation } from '../../client/hooks/useSendVerificationCodeMutation.js';
|
|
@@ -21,25 +23,31 @@ import { Field } from '../../ui/Field/index.js';
|
|
|
21
23
|
import { PinInput } from '../../ui/PinInput/index.js';
|
|
22
24
|
import { Portal } from '../../ui/Portal/index.js';
|
|
23
25
|
export function UpdateMobilePhoneNumber() {
|
|
26
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
27
|
+
updateMobilePhoneNumber: ctx.updateMobilePhoneNumber,
|
|
28
|
+
kyc: ctx.kyc,
|
|
29
|
+
})));
|
|
24
30
|
const accountQuery = useAccountQuery();
|
|
25
31
|
const account = accountQuery.data;
|
|
26
32
|
const isAccountLoading = accountQuery.isLoading;
|
|
27
33
|
const hasMobileNumber = !!account?.mobileNumber;
|
|
28
|
-
const [open, setOpen] = useState(false);
|
|
29
34
|
const hasExecuted = useRef(false);
|
|
30
35
|
useEffect(() => {
|
|
31
36
|
if (!isAccountLoading && !!account && !hasExecuted.current) {
|
|
32
37
|
if (!hasMobileNumber) {
|
|
33
|
-
|
|
34
|
-
setOpen(true);
|
|
35
|
-
}, 500);
|
|
38
|
+
globalStore.updateMobilePhoneNumber.setOpen(true);
|
|
36
39
|
}
|
|
37
40
|
else {
|
|
38
|
-
setOpen(false);
|
|
41
|
+
globalStore.updateMobilePhoneNumber.setOpen(false);
|
|
39
42
|
}
|
|
40
43
|
hasExecuted.current = true;
|
|
41
44
|
}
|
|
42
|
-
}, [
|
|
45
|
+
}, [
|
|
46
|
+
isAccountLoading,
|
|
47
|
+
account,
|
|
48
|
+
hasMobileNumber,
|
|
49
|
+
globalStore.updateMobilePhoneNumber,
|
|
50
|
+
]);
|
|
43
51
|
const [step, setStep] = useState(1);
|
|
44
52
|
const sendVerificationCodeMutation = useSendVerificationCodeMutation({
|
|
45
53
|
onSuccess: () => {
|
|
@@ -62,7 +70,8 @@ export function UpdateMobilePhoneNumber() {
|
|
|
62
70
|
title: 'Verification Successful',
|
|
63
71
|
description: 'Your mobile number has been verified.',
|
|
64
72
|
});
|
|
65
|
-
setOpen(false);
|
|
73
|
+
globalStore.updateMobilePhoneNumber.setOpen(false);
|
|
74
|
+
globalStore.kyc.setOpen(true);
|
|
66
75
|
},
|
|
67
76
|
onError: (err) => {
|
|
68
77
|
const errorMessage = err.message === 'Internal Server Error'
|
|
@@ -116,7 +125,7 @@ export function UpdateMobilePhoneNumber() {
|
|
|
116
125
|
duration: 1000 * 60,
|
|
117
126
|
});
|
|
118
127
|
const formRef = useRef(null);
|
|
119
|
-
return (_jsx(Dialog.Root, { open: open, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {
|
|
128
|
+
return (_jsx(Dialog.Root, { open: globalStore.updateMobilePhoneNumber.open, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { className: "flex items-center", children: _jsxs(Dialog.Content, { className: "flex w-[375px] flex-col items-center space-y-4 rounded-xl bg-[#111827] p-6 text-center", style: {
|
|
120
129
|
backgroundImage: `url(${lightBg.src})`,
|
|
121
130
|
}, children: [_jsx(Image, { src: inplayLogo, alt: "inplay logo", width: 82, height: 34, className: "h-auto w-[82px]" }), _jsxs("div", { children: [step === 1 && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "font-bold text-sm", children: ["Get ", _jsx("span", { className: "text-[#F05127]", children: "\u20B150 Bonus" }), " when you verify your account and play."] }), _jsxs("form", { className: "mt-3xl", onSubmit: step1Form.handleSubmit(async (data) => {
|
|
122
131
|
sendVerificationCodeMutation.mutateAsync({
|