@opexa/portal-components 0.0.499 → 0.0.501
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.
|
@@ -7,7 +7,6 @@ import { useFeatureFlag } from '../../../client/hooks/useFeatureFlag.js';
|
|
|
7
7
|
import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
|
|
8
8
|
import { useMemberVerificationQuery } from '../../../client/hooks/useMemberVerificationQuery.js';
|
|
9
9
|
import { useSessionQuery } from '../../../client/hooks/useSessionQuery.js';
|
|
10
|
-
import { XIcon } from '../../../icons/XIcon.js';
|
|
11
10
|
import { Dialog } from '../../../ui/Dialog/index.js';
|
|
12
11
|
import { Portal } from '../../../ui/Portal/index.js';
|
|
13
12
|
import { KYCReminder } from '../KYCReminder.js';
|
|
@@ -24,7 +23,6 @@ export function KYCDefault(props) {
|
|
|
24
23
|
const { data: session, isLoading: sessionLoading } = useSessionQuery();
|
|
25
24
|
const { data: account, isLoading: accountLoading } = useAccountQuery();
|
|
26
25
|
const { data: verification } = useMemberVerificationQuery();
|
|
27
|
-
const isVerificationLocked = account?.status === 'VERIFICATION_LOCKED';
|
|
28
26
|
const isBasicInfoCompleted = account?.realName !== null && account?.birthDay !== null;
|
|
29
27
|
const isUploadCompleted = verification?.idFrontImage && verification?.selfieImage;
|
|
30
28
|
const isRejected = verification?.status === 'REJECTED';
|
|
@@ -51,5 +49,5 @@ export function KYCDefault(props) {
|
|
|
51
49
|
session?.status !== 'unauthenticated';
|
|
52
50
|
return (_jsxs(_Fragment, { children: [_jsx(KYCDefaultContext, { value: kyc, children: _jsx(Dialog.Root, { open: isDialogOpen, onOpenChange: (details) => {
|
|
53
51
|
globalStore.kyc.setOpen(details.open);
|
|
54
|
-
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: kyc.reset, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsx(Dialog.Content, { className: "mx-auto min-h-full w-full overflow-y-auto bg-bg-primary-alt lg:min-h-auto lg:w-fit", children: _jsxs("div", { className: "flex h-dvh w-full flex-col overflow-y-auto p-3xl sm:h-fit sm:overflow-auto lg:w-[400px]", children: [
|
|
52
|
+
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: kyc.reset, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsx(Dialog.Content, { className: "mx-auto mt-[10rem] min-h-full w-full overflow-y-auto bg-bg-primary-alt lg:min-h-auto lg:w-fit", children: _jsxs("div", { className: "flex h-dvh w-full flex-col overflow-y-auto p-3xl sm:h-fit sm:overflow-auto 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(BasicInformation, {}), kyc.step === 2 && _jsx(IdentityVerification, {}), kyc.step === 3 && _jsx(PersonalInformation, {})] }) }) })] }) }) }), _jsx(KYCReminder, { ...props })] }));
|
|
55
53
|
}
|
|
@@ -3,8 +3,10 @@ import { zodResolver } from '@hookform/resolvers/zod';
|
|
|
3
3
|
import { useForm } from 'react-hook-form';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { useShallow } from 'zustand/shallow';
|
|
6
|
+
import { useAccountQuery } from '../../../client/hooks/useAccountQuery.js';
|
|
6
7
|
import { useApproveMemberVerification } from '../../../client/hooks/useApproveMemberVerification.js';
|
|
7
8
|
import { useCreateMemberVerificationMutation } from '../../../client/hooks/useCreateMemberVerificationMutation.js';
|
|
9
|
+
import { useFeatureFlag } from '../../../client/hooks/useFeatureFlag.js';
|
|
8
10
|
import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
|
|
9
11
|
import { useMemberVerificationQuery } from '../../../client/hooks/useMemberVerificationQuery.js';
|
|
10
12
|
import { useUpdateMemberVerificationMutation } from '../../../client/hooks/useUpdateMemberVerificationMutation.js';
|
|
@@ -17,8 +19,6 @@ import { Field } from '../../../ui/Field/index.js';
|
|
|
17
19
|
import { getQueryClient } from '../../../utils/getQueryClient.js';
|
|
18
20
|
import { getMemberVerificationQueryKey } from '../../../utils/queryKeys.js';
|
|
19
21
|
import { useKYCDefaultContext } from './KYCDefaultContext.js';
|
|
20
|
-
import { useAccountQuery } from '../../../client/hooks/useAccountQuery.js';
|
|
21
|
-
import { useFeatureFlag } from '../../../client/hooks/useFeatureFlag.js';
|
|
22
22
|
const definition = z.object({
|
|
23
23
|
address: z.string().trim().min(1, 'Current address is required'),
|
|
24
24
|
permanentAddress: z.string().trim().min(1, 'Permanent address is required'),
|
|
@@ -109,6 +109,9 @@ export function PersonalInformation() {
|
|
|
109
109
|
return (_jsxs("div", { children: [_jsx(Dialog.Title, { className: "text-center font-semibold text-lg", children: "Personal Information" }), _jsx(Dialog.Description, { className: "mt-xs text-center text-sm text-text-secondary-700", children: "Provide your basic details and work info." }), _jsxs("form", { className: "mt-7", onSubmit: form.handleSubmit(onSubmit), children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.permanentAddress, children: [_jsx(Field.Label, { children: "Permanent address" }), _jsx(Field.Input, { placeholder: "Enter your permanent address", ...form.register('permanentAddress') }), _jsx(Field.ErrorText, { children: form.formState.errors.permanentAddress?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.address, children: [_jsx(Field.Label, { children: "Current address" }), _jsx(Field.Input, { placeholder: "Enter your current address", ...form.register('address') }), _jsx(Field.ErrorText, { children: form.formState.errors.address?.message })] }), _jsxs(Checkbox.Root, { className: "mt-md", checked: address !== '' &&
|
|
110
110
|
permanentAddress !== '' &&
|
|
111
111
|
address === permanentAddress, onCheckedChange: (details) => {
|
|
112
|
+
const isActive = address !== '' &&
|
|
113
|
+
permanentAddress !== '' &&
|
|
114
|
+
address === permanentAddress;
|
|
112
115
|
if (details.checked === true) {
|
|
113
116
|
form.setValue('address', form.getValues('permanentAddress'), {
|
|
114
117
|
shouldDirty: true,
|
|
@@ -116,6 +119,12 @@ export function PersonalInformation() {
|
|
|
116
119
|
shouldValidate: true,
|
|
117
120
|
});
|
|
118
121
|
}
|
|
122
|
+
else if (isActive && details.checked === false) {
|
|
123
|
+
form.reset({
|
|
124
|
+
...form.getValues(),
|
|
125
|
+
address: '',
|
|
126
|
+
});
|
|
127
|
+
}
|
|
119
128
|
}, disabled: !permanentAddress, children: [_jsx(Checkbox.Control, { children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsx(Checkbox.Label, { children: "Use permanent address as current address" }), _jsx(Checkbox.HiddenInput, {})] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.sourceOfIncome, children: [_jsx(Field.Label, { children: "Source of income" }), _jsx(Field.Input, { placeholder: "Enter your source of income", ...form.register('sourceOfIncome') }), _jsx(Field.ErrorText, { children: form.formState.errors.sourceOfIncome?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.natureOfWork, children: [_jsx(Field.Label, { children: "Work Description" }), _jsx(Field.Input, { placeholder: "Enter your work description", ...form.register('natureOfWork') }), _jsx(Field.ErrorText, { children: form.formState.errors.natureOfWork?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.placeOfBirth, children: [_jsx(Field.Label, { children: "Place of birth" }), _jsx(Field.Input, { placeholder: "Enter your place of birth", ...form.register('placeOfBirth') }), _jsx(Field.ErrorText, { children: form.formState.errors.placeOfBirth?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.nationality, children: [_jsx(Field.Label, { children: "Nationality" }), _jsx(Field.Input, { placeholder: "Enter your nationality", ...form.register('nationality') }), _jsx(Field.ErrorText, { children: form.formState.errors.nationality?.message })] }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: updateMemberVerificationMutation.isPending ||
|
|
120
129
|
createMemberVerificationMutation.isPending, children: "Continue" }), !(featureFlag.enabled && isVerificationLocked) && (_jsx(Button, { variant: "outline", colorScheme: "gray", className: "mt-lg", onClick: () => {
|
|
121
130
|
globalStore.kyc.setOpen(false);
|