@opexa/portal-components 0.0.500 → 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.
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.500",
3
+ "version": "0.0.501",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",