@opexa/portal-components 0.0.975 → 0.0.976
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 } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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';
|
|
@@ -13,8 +13,10 @@ import { z } from 'zod';
|
|
|
13
13
|
import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
|
|
14
14
|
import { useDisclosure } from '../../client/hooks/useDisclosure.js';
|
|
15
15
|
import { useFacebookClientQuery } from '../../client/hooks/useFacebookClientQuery.js';
|
|
16
|
+
import { useFeatureFlag } from '../../client/hooks/useFeatureFlag.js';
|
|
16
17
|
import { useGoogleClientIdQuery } from '../../client/hooks/useGoogleClientIdQuery.js';
|
|
17
18
|
import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
|
|
19
|
+
import { useMemberVerificationQuery } from '../../client/hooks/useMemberVerificationQuery.js';
|
|
18
20
|
import { useMobileNumberParser } from '../../client/hooks/useMobileNumberParser.js';
|
|
19
21
|
import { useProfileCompletionQuery } from '../../client/hooks/useProfileCompletionQuery.js';
|
|
20
22
|
import { useSessionQuery } from '../../client/hooks/useSessionQuery.js';
|
|
@@ -93,6 +95,9 @@ function ProfileInfo({ avatar }) {
|
|
|
93
95
|
function PersonalInfo(props) {
|
|
94
96
|
const accountQuery = useAccountQuery();
|
|
95
97
|
const account = accountQuery.data;
|
|
98
|
+
const featureFlag = useFeatureFlag();
|
|
99
|
+
const verificationQuery = useMemberVerificationQuery();
|
|
100
|
+
const verification = verificationQuery.data;
|
|
96
101
|
const updateAccountMutation = useUpdateAccountMutation({
|
|
97
102
|
onSuccess() {
|
|
98
103
|
toaster.success({
|
|
@@ -155,7 +160,7 @@ function PersonalInfo(props) {
|
|
|
155
160
|
? data.birthDay
|
|
156
161
|
: undefined,
|
|
157
162
|
});
|
|
158
|
-
}), 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",
|
|
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 ?? '' })] })), featureFlag.enabled && (_jsxs(_Fragment, { children: [_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" })] }))] })] }));
|
|
159
164
|
}
|
|
160
165
|
function ContactInfo({ variant }) {
|
|
161
166
|
const localeInfo = useLocaleInfo();
|
|
@@ -15,16 +15,18 @@ import { useKYCDefault } from './useKYCDefault.js';
|
|
|
15
15
|
export function KYCDefault(props) {
|
|
16
16
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
17
17
|
kyc: ctx.kyc,
|
|
18
|
+
disclaimer: ctx.disclaimer,
|
|
18
19
|
kycReminder: ctx.kycReminder,
|
|
19
20
|
responsibleGamingReminder: ctx.responsibleGamingReminder,
|
|
20
21
|
updateMobilePhoneNumber: ctx.updateMobilePhoneNumber,
|
|
21
22
|
})));
|
|
22
23
|
const kyc = useKYCDefault(props?.isSkippable ?? false, props?.hasKYCReviewPromo ?? false);
|
|
23
24
|
const { isLoading: sessionLoading } = useSessionQuery();
|
|
24
|
-
const isDialogOpen =
|
|
25
|
-
globalStore.
|
|
25
|
+
const isDialogOpen = globalStore.kyc.open &&
|
|
26
|
+
!globalStore.kycReminder.open &&
|
|
26
27
|
!sessionLoading &&
|
|
27
|
-
!globalStore.updateMobilePhoneNumber.open
|
|
28
|
+
!globalStore.updateMobilePhoneNumber.open &&
|
|
29
|
+
!globalStore.disclaimer.open;
|
|
28
30
|
return (_jsxs(_Fragment, { children: [_jsx(KYCDefaultContext, { value: kyc, children: _jsx(Dialog.Root, { open: isDialogOpen, onOpenChange: (details) => {
|
|
29
31
|
globalStore.kyc.setOpen(details.open);
|
|
30
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, {})] }));
|