@opexa/portal-components 0.0.390 → 0.0.391
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.
|
@@ -85,14 +85,23 @@ export function SignUpDefaultForm() {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
}),
|
|
88
|
-
|
|
88
|
+
firstName: z
|
|
89
89
|
.string()
|
|
90
90
|
.transform((val) => val.trim())
|
|
91
91
|
.refine((val) => val.length >= 2, {
|
|
92
|
-
message: '
|
|
92
|
+
message: 'First name must be 2 or more characters',
|
|
93
93
|
})
|
|
94
94
|
.refine((val) => val.length <= 50, {
|
|
95
|
-
message: '
|
|
95
|
+
message: 'First name must not be more than 50 characters',
|
|
96
|
+
}),
|
|
97
|
+
lastName: z
|
|
98
|
+
.string()
|
|
99
|
+
.transform((val) => val.trim())
|
|
100
|
+
.refine((val) => val.length >= 2, {
|
|
101
|
+
message: 'Last name must be 2 or more characters',
|
|
102
|
+
})
|
|
103
|
+
.refine((val) => val.length <= 50, {
|
|
104
|
+
message: 'Last name must not be more than 50 characters',
|
|
96
105
|
}),
|
|
97
106
|
birthDay: z
|
|
98
107
|
.date({
|
|
@@ -127,7 +136,8 @@ export function SignUpDefaultForm() {
|
|
|
127
136
|
mode: 'all',
|
|
128
137
|
resolver: zodResolver(Step1Definition),
|
|
129
138
|
defaultValues: {
|
|
130
|
-
|
|
139
|
+
firstName: '',
|
|
140
|
+
lastName: '',
|
|
131
141
|
mobileNumber: '',
|
|
132
142
|
branchCode: signUpProps?.branches?.length
|
|
133
143
|
? signUpProps.branches[0]?.code
|
|
@@ -169,7 +179,7 @@ export function SignUpDefaultForm() {
|
|
|
169
179
|
}
|
|
170
180
|
}), children: [_jsxs(Field.Root, { invalid: !!step1Form.formState.errors.mobileNumber, children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsxs("div", { className: "-translate-y-1/2 absolute top-1/2 left-3.5 flex shrink-0 items-center gap-md", children: [_jsx(localeInfo.country.flag, { className: "size-5" }), _jsx("span", { className: "text-text-placeholder", children: localeInfo.mobileNumber.areaCode })] }), _jsx(Field.Input, { style: {
|
|
171
181
|
paddingLeft: `calc(2.75rem + ${localeInfo.mobileNumber.areaCode.length}ch)`,
|
|
172
|
-
}, ...step1Form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.mobileNumber?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.
|
|
182
|
+
}, ...step1Form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.mobileNumber?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.firstName, className: "mt-xl", children: [_jsx(Field.Label, { children: "First Name" }), _jsx(Field.Input, { placeholder: "Enter your real name", ...step1Form.register('firstName') }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.firstName?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.lastName, className: "mt-xl", children: [_jsx(Field.Label, { children: "Last Name" }), _jsx(Field.Input, { placeholder: "Enter your real name", ...step1Form.register('lastName') }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.lastName?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.birthDay, className: "mt-xl", children: [_jsx(DateOfBirthField, { value: birthDay, onChange: (value) => {
|
|
173
183
|
if (!value)
|
|
174
184
|
return;
|
|
175
185
|
step1Form.setValue('birthDay', value, {
|
|
@@ -232,11 +242,12 @@ export function SignUpDefaultForm() {
|
|
|
232
242
|
verificationCode: verificationCode.join(''),
|
|
233
243
|
referralCode: search.get('referralCode') ?? undefined,
|
|
234
244
|
//new signup
|
|
235
|
-
...(
|
|
245
|
+
...(signUpProps?.branches &&
|
|
246
|
+
signUpProps.branches.length > 0 && {
|
|
236
247
|
branchCode: step1Form.getValues('branchCode'),
|
|
237
|
-
realName: step1Form.getValues('realName'),
|
|
238
|
-
birthDay: format(step1Form.getValues('birthDay'), 'yyyy-MM-dd'),
|
|
239
248
|
}),
|
|
249
|
+
realName: `${step1Form.getValues('firstName')} ${step1Form.getValues('lastName')}`,
|
|
250
|
+
birthDay: format(step1Form.getValues('birthDay'), 'yyyy-MM-dd'),
|
|
240
251
|
});
|
|
241
252
|
const name = mobileNumberParser.format(mobileNumber);
|
|
242
253
|
const password = `${name}${id}`;
|
|
@@ -261,26 +272,6 @@ export function SignUpDefaultForm() {
|
|
|
261
272
|
globalStore.signIn.setOpen(true);
|
|
262
273
|
return;
|
|
263
274
|
}
|
|
264
|
-
else if (!enabled) {
|
|
265
|
-
const pollUpdateAccount = createPoll(async () => {
|
|
266
|
-
try {
|
|
267
|
-
await updateAccountMutation.mutateAsync({
|
|
268
|
-
branchCode: step1Form.getValues('branchCode'),
|
|
269
|
-
realName: step1Form.getValues('realName'),
|
|
270
|
-
birthDay: format(step1Form.getValues('birthDay'), 'yyyy-MM-dd'),
|
|
271
|
-
});
|
|
272
|
-
return true;
|
|
273
|
-
}
|
|
274
|
-
catch {
|
|
275
|
-
return false;
|
|
276
|
-
}
|
|
277
|
-
}, {
|
|
278
|
-
until: (ok) => ok,
|
|
279
|
-
maxAttempt: 8,
|
|
280
|
-
interval: 250,
|
|
281
|
-
});
|
|
282
|
-
await pollUpdateAccount();
|
|
283
|
-
}
|
|
284
275
|
globalStore.signUp.setOpen(false);
|
|
285
276
|
globalStore.kycReminder.setOpen(true);
|
|
286
277
|
step1Form.reset();
|