@redneckz/wildless-cms-uni-blocks 0.14.926 → 0.14.928
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.
- package/bundle/bundle.umd.js +55 -38
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -2
- package/bundle/retail/api/checkCode.d.ts +1 -2
- package/bundle/retail/api/sendCode.d.ts +1 -1
- package/bundle/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +1 -0
- package/bundle/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +3 -2
- package/bundle/retail/utils/saveToken.d.ts +2 -0
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +10 -2
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -2
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +9 -5
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/dist/components/DebitForm/DebitFormStepsData.js +1 -1
- package/dist/components/DebitForm/DebitFormStepsData.js.map +1 -1
- package/dist/retail/api/checkCode.d.ts +1 -2
- package/dist/retail/api/checkCode.js +2 -9
- package/dist/retail/api/checkCode.js.map +1 -1
- package/dist/retail/api/esiaRequestProfile.js +2 -2
- package/dist/retail/api/esiaRequestProfile.js.map +1 -1
- package/dist/retail/api/sendCode.d.ts +1 -1
- package/dist/retail/api/sendCode.js +1 -3
- package/dist/retail/api/sendCode.js.map +1 -1
- package/dist/retail/components/Fields/LatinNameField.js +1 -1
- package/dist/retail/components/Fields/LatinSurnameField.js +1 -1
- package/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +1 -0
- package/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +8 -4
- package/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
- package/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +3 -2
- package/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +18 -14
- package/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
- package/dist/retail/utils/mockLocalStorage.js +4 -1
- package/dist/retail/utils/mockLocalStorage.js.map +1 -1
- package/dist/retail/utils/saveToken.d.ts +2 -0
- package/dist/retail/utils/saveToken.js +8 -0
- package/dist/retail/utils/saveToken.js.map +1 -0
- package/dist/retail/validator/validators.js +2 -2
- package/dist/retail/validator/validators.js.map +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +10 -2
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -2
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +10 -6
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/lib/components/DebitForm/DebitFormStepsData.js +1 -1
- package/lib/components/DebitForm/DebitFormStepsData.js.map +1 -1
- package/lib/retail/api/checkCode.d.ts +1 -2
- package/lib/retail/api/checkCode.js +2 -8
- package/lib/retail/api/checkCode.js.map +1 -1
- package/lib/retail/api/esiaRequestProfile.js +1 -1
- package/lib/retail/api/esiaRequestProfile.js.map +1 -1
- package/lib/retail/api/sendCode.d.ts +1 -1
- package/lib/retail/api/sendCode.js +1 -3
- package/lib/retail/api/sendCode.js.map +1 -1
- package/lib/retail/components/Fields/LatinNameField.js +1 -1
- package/lib/retail/components/Fields/LatinSurnameField.js +1 -1
- package/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +1 -0
- package/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +8 -4
- package/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
- package/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +3 -2
- package/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +18 -14
- package/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
- package/lib/retail/utils/mockLocalStorage.js +4 -1
- package/lib/retail/utils/mockLocalStorage.js.map +1 -1
- package/lib/retail/utils/saveToken.d.ts +2 -0
- package/lib/retail/utils/saveToken.js +5 -0
- package/lib/retail/utils/saveToken.js.map +1 -0
- package/lib/retail/validator/validators.js +2 -2
- package/lib/retail/validator/validators.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +55 -38
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -2
- package/mobile/bundle/retail/api/checkCode.d.ts +1 -2
- package/mobile/bundle/retail/api/sendCode.d.ts +1 -1
- package/mobile/bundle/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +1 -0
- package/mobile/bundle/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +3 -2
- package/mobile/bundle/retail/utils/saveToken.d.ts +2 -0
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +10 -2
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -2
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +9 -5
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/dist/components/DebitForm/DebitFormStepsData.js +1 -1
- package/mobile/dist/components/DebitForm/DebitFormStepsData.js.map +1 -1
- package/mobile/dist/retail/api/checkCode.d.ts +1 -2
- package/mobile/dist/retail/api/checkCode.js +2 -9
- package/mobile/dist/retail/api/checkCode.js.map +1 -1
- package/mobile/dist/retail/api/esiaRequestProfile.js +2 -2
- package/mobile/dist/retail/api/esiaRequestProfile.js.map +1 -1
- package/mobile/dist/retail/api/sendCode.d.ts +1 -1
- package/mobile/dist/retail/api/sendCode.js +1 -3
- package/mobile/dist/retail/api/sendCode.js.map +1 -1
- package/mobile/dist/retail/components/Fields/LatinNameField.js +1 -1
- package/mobile/dist/retail/components/Fields/LatinSurnameField.js +1 -1
- package/mobile/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +1 -0
- package/mobile/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +8 -4
- package/mobile/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
- package/mobile/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +3 -2
- package/mobile/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +18 -14
- package/mobile/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
- package/mobile/dist/retail/utils/mockLocalStorage.js +4 -1
- package/mobile/dist/retail/utils/mockLocalStorage.js.map +1 -1
- package/mobile/dist/retail/utils/saveToken.d.ts +2 -0
- package/mobile/dist/retail/utils/saveToken.js +8 -0
- package/mobile/dist/retail/utils/saveToken.js.map +1 -0
- package/mobile/dist/retail/validator/validators.js +2 -2
- package/mobile/dist/retail/validator/validators.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +10 -2
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -2
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +10 -6
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/lib/components/DebitForm/DebitFormStepsData.js +1 -1
- package/mobile/lib/components/DebitForm/DebitFormStepsData.js.map +1 -1
- package/mobile/lib/retail/api/checkCode.d.ts +1 -2
- package/mobile/lib/retail/api/checkCode.js +2 -8
- package/mobile/lib/retail/api/checkCode.js.map +1 -1
- package/mobile/lib/retail/api/esiaRequestProfile.js +1 -1
- package/mobile/lib/retail/api/esiaRequestProfile.js.map +1 -1
- package/mobile/lib/retail/api/sendCode.d.ts +1 -1
- package/mobile/lib/retail/api/sendCode.js +1 -3
- package/mobile/lib/retail/api/sendCode.js.map +1 -1
- package/mobile/lib/retail/components/Fields/LatinNameField.js +1 -1
- package/mobile/lib/retail/components/Fields/LatinSurnameField.js +1 -1
- package/mobile/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +1 -0
- package/mobile/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +8 -4
- package/mobile/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
- package/mobile/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +3 -2
- package/mobile/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +18 -14
- package/mobile/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
- package/mobile/lib/retail/utils/mockLocalStorage.js +4 -1
- package/mobile/lib/retail/utils/mockLocalStorage.js.map +1 -1
- package/mobile/lib/retail/utils/saveToken.d.ts +2 -0
- package/mobile/lib/retail/utils/saveToken.js +5 -0
- package/mobile/lib/retail/utils/saveToken.js.map +1 -0
- package/mobile/lib/retail/validator/validators.js +2 -2
- package/mobile/lib/retail/validator/validators.js.map +1 -1
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +10 -2
- package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +11 -5
- package/mobile/src/components/DebitForm/DebitFormStepsData.tsx +1 -1
- package/mobile/src/retail/api/checkCode.ts +2 -9
- package/mobile/src/retail/api/esiaRequestProfile.ts +2 -1
- package/mobile/src/retail/api/sendCode.ts +1 -4
- package/mobile/src/retail/components/Fields/LatinNameField.tsx +1 -1
- package/mobile/src/retail/components/Fields/LatinSurnameField.tsx +1 -1
- package/mobile/src/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.tsx +15 -4
- package/mobile/src/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +22 -15
- package/mobile/src/retail/utils/mockLocalStorage.ts +6 -2
- package/mobile/src/retail/utils/saveToken.ts +6 -0
- package/mobile/src/retail/validator/validators.ts +4 -4
- package/package.json +1 -1
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +10 -2
- package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +11 -5
- package/src/components/DebitForm/DebitFormStepsData.tsx +1 -1
- package/src/retail/api/checkCode.ts +2 -9
- package/src/retail/api/esiaRequestProfile.ts +2 -1
- package/src/retail/api/sendCode.ts +1 -4
- package/src/retail/components/Fields/LatinNameField.tsx +1 -1
- package/src/retail/components/Fields/LatinSurnameField.tsx +1 -1
- package/src/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.tsx +15 -4
- package/src/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +22 -15
- package/src/retail/utils/mockLocalStorage.ts +6 -2
- package/src/retail/utils/saveToken.ts +6 -0
- package/src/retail/validator/validators.ts +4 -4
|
@@ -3237,12 +3237,13 @@
|
|
|
3237
3237
|
|
|
3238
3238
|
const ERROR_MESSAGE = 'Некорректно заполненное поле';
|
|
3239
3239
|
const ADDRESS_ERROR_MESSAGE = 'Укажите регион, город/населенный пункт, улицу, дом';
|
|
3240
|
+
const codeWordPattern = /^[0-9\u0400-\u04FF-\s]+$/u;
|
|
3240
3241
|
const retailCyrillicPattern = /^[\u0400-\u04FF-\s]+$/u;
|
|
3241
3242
|
const retailNotCyrillicPattern = /^(?!\s*$)[^\p{Script=Cyrillic}]+$/u;
|
|
3242
3243
|
const addressDaDataValidate = (address) => Boolean(address.region && (address.city || address.locality) && address.house);
|
|
3243
3244
|
const addressDaDataValidator = () => validator(addressDaDataValidate)(ADDRESS_ERROR_MESSAGE);
|
|
3244
3245
|
const addressOrganizationValidator = () => validator((address) => Boolean(address.fiasCode && (address.city || address.locality) && address.house))(ADDRESS_ERROR_MESSAGE);
|
|
3245
|
-
const codeWordValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length >= 3 && _.length <= 21 &&
|
|
3246
|
+
const codeWordValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length >= 3 && _.length <= 21 && codeWordPattern.test(_))(errorMsg ?? ERROR_MESSAGE);
|
|
3246
3247
|
const nameRetailValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length > 1 && retailCyrillicPattern.test(_))(errorMsg ?? ERROR_MESSAGE);
|
|
3247
3248
|
const jobNumberValidator = (errorMsg) => validator((_) => typeof _ === 'string' && /^[0-9]{1,2}$/g.test(_))(errorMsg ?? ERROR_MESSAGE);
|
|
3248
3249
|
const lengthStringValidator = (inputLength, errorMsg, isFixLength) => validator((_) => typeof _ === 'string' &&
|
|
@@ -5359,7 +5360,7 @@
|
|
|
5359
5360
|
};
|
|
5360
5361
|
const autoTranslateToLatin = (str) => str.replace(/[А-ЯЁа-яё,. -]/g, (_) => REPLACER[_.toLowerCase()].toUpperCase() || '');
|
|
5361
5362
|
|
|
5362
|
-
const MAX_LENGTH$1 =
|
|
5363
|
+
const MAX_LENGTH$1 = 20;
|
|
5363
5364
|
const LatinNameField = JSX(({ field, input }) => {
|
|
5364
5365
|
const latinSurname = field('latinSurname')?.value;
|
|
5365
5366
|
const name = field('name')?.value;
|
|
@@ -5375,7 +5376,7 @@
|
|
|
5375
5376
|
return (jsx(InputControl, { label: "\u0418\u043C\u044F", placeholder: "\u0418\u043C\u044F \u043B\u0430\u0442\u0438\u043D\u0441\u043A\u0438\u043C\u0438 \u0431\u0443\u043A\u0432\u0430\u043C\u0438", maxLength: Math.max(MAX_LENGTH$1 - latinSurname?.length, 1), ...field(input?.name ?? ''), onChange: onChange, ...input }));
|
|
5376
5377
|
});
|
|
5377
5378
|
|
|
5378
|
-
const MAX_LENGTH =
|
|
5379
|
+
const MAX_LENGTH = 20;
|
|
5379
5380
|
const LatinSurnameField = JSX(({ field, input }) => {
|
|
5380
5381
|
const latinName = field('latinName')?.value;
|
|
5381
5382
|
const surname = field('surname')?.value;
|
|
@@ -5729,9 +5730,7 @@
|
|
|
5729
5730
|
|
|
5730
5731
|
const updateUserTask = (body) => doRequest('/user-data/updateUserTask', 'PUT', body);
|
|
5731
5732
|
|
|
5732
|
-
const sendCode = (body) => doRequest('/sms/sendCode', 'POST', body)
|
|
5733
|
-
.then((res) => res.text())
|
|
5734
|
-
.then((text) => text === 'OK');
|
|
5733
|
+
const sendCode = (body) => doRequest('/sms/sendCode', 'POST', body);
|
|
5735
5734
|
|
|
5736
5735
|
const ICON_SIZE = { width: '103', height: '21' };
|
|
5737
5736
|
|
|
@@ -5794,16 +5793,15 @@
|
|
|
5794
5793
|
return (jsx(Dialog, { head: jsx(Logo, {}), onClose: onClose, children: jsxs("div", { className: "flex flex-col gap-lg items-center", children: [jsxs("div", { className: "flex", children: [jsx("img", { className: "grow", src: captcha }), jsx(Button, { className: "w-8", embedded: true, onClick: handleCreateCaptcha, children: jsx(Icon, { iconVersion: "normal", name: "RefreshIcon" }) })] }), jsx(Input, { className: "w-80", onChange: setCode, value: code, placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0434 \u0441 \u043A\u0430\u0440\u0442\u0438\u043D\u043A\u0438" }), hasError ? jsx("div", { className: "text-error", children: "\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043E\u0434" }) : null, jsxs("div", { className: "flex w-80 justify-between", children: [jsx(Button, { version: "secondary", onClick: closeAll, children: "\u0412\u0435\u0440\u043D\u0443\u0442\u044C\u0441\u044F" }), jsx(SubmitButton$1, { version: "secondary", disabled: !code, onClick: handleCheckCaptcha, children: "\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C" })] }), isLoading ? jsx(Loader, { blur: false }) : null] }) }));
|
|
5795
5794
|
});
|
|
5796
5795
|
|
|
5797
|
-
const checkCode = async (body) =>
|
|
5796
|
+
const checkCode = async (body) => await doRequest('/sms/checkCode', 'POST', body);
|
|
5797
|
+
|
|
5798
5798
|
const saveToken = (data) => {
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
globalThis.sessionStorage.setItem('refreshToken', data.refresh_token);
|
|
5802
|
-
}
|
|
5799
|
+
globalThis.sessionStorage.setItem('accessToken', data.access_token);
|
|
5800
|
+
globalThis.sessionStorage.setItem('refreshToken', data.refresh_token);
|
|
5803
5801
|
};
|
|
5804
5802
|
|
|
5805
5803
|
const TIME_TO_RESEND = 180;
|
|
5806
|
-
const useVerifyPhoneDialogSubmit = ({ values, onSuccess, }) => {
|
|
5804
|
+
const useVerifyPhoneDialogSubmit = ({ values, onSuccess, onFail, }) => {
|
|
5807
5805
|
const sessionStore = useSessionStore();
|
|
5808
5806
|
const attempts = sessionStore.smsCode?.attempts || 0;
|
|
5809
5807
|
const timer = Math.max(getTimer(sessionStore.smsCode?.sendTime || Date.now()), 0);
|
|
@@ -5814,27 +5812,30 @@
|
|
|
5814
5812
|
const isTimeExpired = Boolean(timeNextReq === 0 && sessionStore.smsCode?.sendTime);
|
|
5815
5813
|
const isSubmitButtonDisabled = attempts > 2 || isTimeExpired || !values.every(Boolean);
|
|
5816
5814
|
const handleSubmit = useCallback(async () => {
|
|
5817
|
-
|
|
5818
|
-
sessionStore.smsCode
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5815
|
+
sessionStore.smsCode = {
|
|
5816
|
+
...sessionStore.smsCode,
|
|
5817
|
+
attempts: attempts + 1,
|
|
5818
|
+
};
|
|
5819
|
+
startLoading();
|
|
5820
|
+
const response = await checkCode({
|
|
5821
|
+
smsText: values.join(''),
|
|
5822
|
+
smsCodesSetName: { key: 'AUTHENTICATION' },
|
|
5823
|
+
});
|
|
5824
|
+
if (response.ok) {
|
|
5825
|
+
const data = (await response.json());
|
|
5826
|
+
saveToken(data);
|
|
5827
5827
|
setTimeNextReq(0);
|
|
5828
5828
|
resetError();
|
|
5829
5829
|
sessionStore.smsCode = null;
|
|
5830
5830
|
onSuccess?.(values.join(''));
|
|
5831
5831
|
}
|
|
5832
|
-
|
|
5832
|
+
else if (response.status === 403) {
|
|
5833
5833
|
setErrorText(attempts > 1 ? 'Исчерпан лимит ввода смс-кода' : 'Неверный код');
|
|
5834
5834
|
}
|
|
5835
|
-
|
|
5836
|
-
|
|
5835
|
+
else {
|
|
5836
|
+
onFail();
|
|
5837
5837
|
}
|
|
5838
|
+
endLoading();
|
|
5838
5839
|
}, [values, attempts]);
|
|
5839
5840
|
useEffect(() => {
|
|
5840
5841
|
if (isTimeExpired) {
|
|
@@ -5857,12 +5858,13 @@
|
|
|
5857
5858
|
};
|
|
5858
5859
|
|
|
5859
5860
|
const CODE_LENGTH = 4;
|
|
5860
|
-
const VerifyPhoneDialog = JSX(({ phone, withDescription = true, consents, onSuccess = noop, onClose = noop }) => {
|
|
5861
|
+
const VerifyPhoneDialog = JSX(({ phone, withDescription = true, consents, onSuccess = noop, onClose = noop, onFail = noop, }) => {
|
|
5861
5862
|
const [values, setValues] = useState(Array(CODE_LENGTH).fill(''));
|
|
5862
5863
|
const sessionStore = useSessionStore();
|
|
5863
5864
|
const { handleSubmit, hasError, errorText, isLoading, timeNextReq, isSubmitButtonDisabled, setTimeNextReq, setErrorText, } = useVerifyPhoneDialogSubmit({
|
|
5864
5865
|
values,
|
|
5865
5866
|
onSuccess,
|
|
5867
|
+
onFail,
|
|
5866
5868
|
});
|
|
5867
5869
|
const captchaDialog = useDialog(CaptchaDialog);
|
|
5868
5870
|
const phoneNumber = formatPhone(phone);
|
|
@@ -5872,7 +5874,7 @@
|
|
|
5872
5874
|
phoneNumber,
|
|
5873
5875
|
smsCodesSetName: { key: 'AUTHENTICATION' },
|
|
5874
5876
|
});
|
|
5875
|
-
if (response) {
|
|
5877
|
+
if (response.ok) {
|
|
5876
5878
|
setTimeNextReq(TIME_TO_RESEND);
|
|
5877
5879
|
restartTimer(TIME_TO_RESEND);
|
|
5878
5880
|
setErrorText('');
|
|
@@ -5881,10 +5883,13 @@
|
|
|
5881
5883
|
attempts: 0,
|
|
5882
5884
|
};
|
|
5883
5885
|
}
|
|
5884
|
-
else {
|
|
5886
|
+
else if (response.status === 429) {
|
|
5885
5887
|
captchaDialog.open({ phoneNumber, sendCode: handleSendCode });
|
|
5886
5888
|
}
|
|
5887
|
-
|
|
5889
|
+
else {
|
|
5890
|
+
onFail();
|
|
5891
|
+
}
|
|
5892
|
+
}, [phoneNumber, restartTimer]);
|
|
5888
5893
|
useEffect(() => {
|
|
5889
5894
|
if (!sessionStore.smsCode?.sendTime) {
|
|
5890
5895
|
handleSendCode();
|
|
@@ -6408,9 +6413,8 @@
|
|
|
6408
6413
|
|
|
6409
6414
|
/* eslint-disable max-lines */
|
|
6410
6415
|
// eslint-disable-next-line max-lines-per-function
|
|
6411
|
-
const useApplicationLeadApi = ({ programId, nextStepLink, productType, data, }) => {
|
|
6416
|
+
const useApplicationLeadApi = ({ programId, nextStepLink, productType, data, changeSubmitFormStatus, }) => {
|
|
6412
6417
|
const [isSending, { setTrue: startSending, setFalse: endSending }] = useBool(false);
|
|
6413
|
-
const [ok, setOK] = useState();
|
|
6414
6418
|
const saveUserData = useSaveUserData();
|
|
6415
6419
|
const sessionStore = useSessionStore();
|
|
6416
6420
|
const leadFormStore = useLeadFormStore();
|
|
@@ -6422,6 +6426,10 @@
|
|
|
6422
6426
|
const consentBkiDialog = useConsentBkiDialog(goToNextStep);
|
|
6423
6427
|
const verifyPhoneDialog = useDialog(VerifyPhoneDialog);
|
|
6424
6428
|
const draftDialog = useDraftDialog();
|
|
6429
|
+
const handleFailSendForm = () => {
|
|
6430
|
+
verifyPhoneDialog.close();
|
|
6431
|
+
changeSubmitFormStatus(false);
|
|
6432
|
+
};
|
|
6425
6433
|
const handleSubmit = useCallback(async (formData) => {
|
|
6426
6434
|
try {
|
|
6427
6435
|
startSending();
|
|
@@ -6472,7 +6480,7 @@
|
|
|
6472
6480
|
}
|
|
6473
6481
|
}
|
|
6474
6482
|
catch {
|
|
6475
|
-
|
|
6483
|
+
handleFailSendForm();
|
|
6476
6484
|
}
|
|
6477
6485
|
};
|
|
6478
6486
|
const acceptedConsents = getAcceptedConsents(transformedFormData, productType);
|
|
@@ -6480,16 +6488,17 @@
|
|
|
6480
6488
|
phone: transformedFormData.phone,
|
|
6481
6489
|
consents: acceptedConsents,
|
|
6482
6490
|
onSuccess: handleSuccessVerify,
|
|
6491
|
+
onFail: handleFailSendForm,
|
|
6483
6492
|
});
|
|
6484
6493
|
}
|
|
6485
6494
|
catch {
|
|
6486
|
-
|
|
6495
|
+
handleFailSendForm();
|
|
6487
6496
|
}
|
|
6488
6497
|
finally {
|
|
6489
6498
|
endSending();
|
|
6490
6499
|
}
|
|
6491
6500
|
}, []);
|
|
6492
|
-
return { isSending,
|
|
6501
|
+
return { isSending, handleSubmit };
|
|
6493
6502
|
};
|
|
6494
6503
|
const getAcceptedConsents = (formData, productType) => {
|
|
6495
6504
|
const consents = productTypeToConsentsMap[productType];
|
|
@@ -6931,6 +6940,7 @@
|
|
|
6931
6940
|
|
|
6932
6941
|
const ApplicationLeadForm = JSX(({ className, title, programId = '', nextStepLink = '/credit-lead', button, productType = 'credit', data, ...rest }) => {
|
|
6933
6942
|
const [esiaStatus, setEsiaStatus] = useState();
|
|
6943
|
+
const [ok, setOK] = useState();
|
|
6934
6944
|
const [attemptsWithoutConsents, setAttemptsWithoutConsents] = useState(0);
|
|
6935
6945
|
const leadForm = useRef(null);
|
|
6936
6946
|
const applicationFormData = useMemo(() => getApplicationFormData(productType), [productType]);
|
|
@@ -6939,6 +6949,9 @@
|
|
|
6939
6949
|
useIFrameMode();
|
|
6940
6950
|
const extendedValidatorObj = useMemo(() => getExtendedValidatorObj(productType), [productType]);
|
|
6941
6951
|
const formValidator = useMemo(() => getFormValidator(inputs, extendedValidatorObj), [inputs, extendedValidatorObj]);
|
|
6952
|
+
const changeSubmitFormStatus = (status) => {
|
|
6953
|
+
setOK(status);
|
|
6954
|
+
};
|
|
6942
6955
|
const initialFormState = useInitApplicationLead({
|
|
6943
6956
|
inputs,
|
|
6944
6957
|
nextStepLink,
|
|
@@ -6946,11 +6959,12 @@
|
|
|
6946
6959
|
setEsiaStatus,
|
|
6947
6960
|
esiaAuthSuccess: esiaStatus === EsiaStatuses.Success,
|
|
6948
6961
|
});
|
|
6949
|
-
const { isSending,
|
|
6962
|
+
const { isSending, handleSubmit } = useApplicationLeadApi({
|
|
6950
6963
|
programId,
|
|
6951
6964
|
nextStepLink,
|
|
6952
6965
|
productType,
|
|
6953
6966
|
data,
|
|
6967
|
+
changeSubmitFormStatus,
|
|
6954
6968
|
});
|
|
6955
6969
|
const [, { field, onSubmit, reset }] = useForm(initialFormState, {
|
|
6956
6970
|
formValidator,
|
|
@@ -6969,7 +6983,10 @@
|
|
|
6969
6983
|
const responseTypeDialog = useDialog(ResponseTypeDialog);
|
|
6970
6984
|
useEffect(() => {
|
|
6971
6985
|
if (ok !== undefined) {
|
|
6972
|
-
responseTypeDialog.open({
|
|
6986
|
+
responseTypeDialog.open({
|
|
6987
|
+
ok,
|
|
6988
|
+
onClose: () => changeSubmitFormStatus(undefined),
|
|
6989
|
+
});
|
|
6973
6990
|
}
|
|
6974
6991
|
}, [ok]);
|
|
6975
6992
|
useEffect(() => {
|
|
@@ -10285,7 +10302,7 @@
|
|
|
10285
10302
|
name: 'infoCard',
|
|
10286
10303
|
label:
|
|
10287
10304
|
// eslint-disable-next-line max-len
|
|
10288
|
-
'Количество символов ограничивается
|
|
10305
|
+
'Количество символов ограничивается 20. При этом, если фамилия и имя на карте содержит более 21 символа, то необходимо сократить имя и указывать на карте только первую букву имени и фамилию, если при таком сокращении фамилия и имя не умещается в количество символов – 20, то указывать только фамилию.',
|
|
10289
10306
|
},
|
|
10290
10307
|
],
|
|
10291
10308
|
},
|
|
@@ -11927,7 +11944,7 @@
|
|
|
11927
11944
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
11928
11945
|
});
|
|
11929
11946
|
|
|
11930
|
-
const packageVersion = "0.14.
|
|
11947
|
+
const packageVersion = "0.14.927";
|
|
11931
11948
|
|
|
11932
11949
|
exports.Blocks = Blocks;
|
|
11933
11950
|
exports.ContentPage = ContentPage;
|