@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
package/bundle/bundle.umd.js
CHANGED
|
@@ -3229,12 +3229,13 @@
|
|
|
3229
3229
|
|
|
3230
3230
|
const ERROR_MESSAGE = 'Некорректно заполненное поле';
|
|
3231
3231
|
const ADDRESS_ERROR_MESSAGE = 'Укажите регион, город/населенный пункт, улицу, дом';
|
|
3232
|
+
const codeWordPattern = /^[0-9\u0400-\u04FF-\s]+$/u;
|
|
3232
3233
|
const retailCyrillicPattern = /^[\u0400-\u04FF-\s]+$/u;
|
|
3233
3234
|
const retailNotCyrillicPattern = /^(?!\s*$)[^\p{Script=Cyrillic}]+$/u;
|
|
3234
3235
|
const addressDaDataValidate = (address) => Boolean(address.region && (address.city || address.locality) && address.house);
|
|
3235
3236
|
const addressDaDataValidator = () => validator(addressDaDataValidate)(ADDRESS_ERROR_MESSAGE);
|
|
3236
3237
|
const addressOrganizationValidator = () => validator((address) => Boolean(address.fiasCode && (address.city || address.locality) && address.house))(ADDRESS_ERROR_MESSAGE);
|
|
3237
|
-
const codeWordValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length >= 3 && _.length <= 21 &&
|
|
3238
|
+
const codeWordValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length >= 3 && _.length <= 21 && codeWordPattern.test(_))(errorMsg ?? ERROR_MESSAGE);
|
|
3238
3239
|
const nameRetailValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length > 1 && retailCyrillicPattern.test(_))(errorMsg ?? ERROR_MESSAGE);
|
|
3239
3240
|
const jobNumberValidator = (errorMsg) => validator((_) => typeof _ === 'string' && /^[0-9]{1,2}$/g.test(_))(errorMsg ?? ERROR_MESSAGE);
|
|
3240
3241
|
const lengthStringValidator = (inputLength, errorMsg, isFixLength) => validator((_) => typeof _ === 'string' &&
|
|
@@ -5351,7 +5352,7 @@
|
|
|
5351
5352
|
};
|
|
5352
5353
|
const autoTranslateToLatin = (str) => str.replace(/[А-ЯЁа-яё,. -]/g, (_) => REPLACER[_.toLowerCase()].toUpperCase() || '');
|
|
5353
5354
|
|
|
5354
|
-
const MAX_LENGTH$1 =
|
|
5355
|
+
const MAX_LENGTH$1 = 20;
|
|
5355
5356
|
const LatinNameField = JSX(({ field, input }) => {
|
|
5356
5357
|
const latinSurname = field('latinSurname')?.value;
|
|
5357
5358
|
const name = field('name')?.value;
|
|
@@ -5367,7 +5368,7 @@
|
|
|
5367
5368
|
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 }));
|
|
5368
5369
|
});
|
|
5369
5370
|
|
|
5370
|
-
const MAX_LENGTH =
|
|
5371
|
+
const MAX_LENGTH = 20;
|
|
5371
5372
|
const LatinSurnameField = JSX(({ field, input }) => {
|
|
5372
5373
|
const latinName = field('latinName')?.value;
|
|
5373
5374
|
const surname = field('surname')?.value;
|
|
@@ -5721,9 +5722,7 @@
|
|
|
5721
5722
|
|
|
5722
5723
|
const updateUserTask = (body) => doRequest('/user-data/updateUserTask', 'PUT', body);
|
|
5723
5724
|
|
|
5724
|
-
const sendCode = (body) => doRequest('/sms/sendCode', 'POST', body)
|
|
5725
|
-
.then((res) => res.text())
|
|
5726
|
-
.then((text) => text === 'OK');
|
|
5725
|
+
const sendCode = (body) => doRequest('/sms/sendCode', 'POST', body);
|
|
5727
5726
|
|
|
5728
5727
|
const ICON_SIZE = { width: '118', height: '24' };
|
|
5729
5728
|
|
|
@@ -5786,16 +5785,15 @@
|
|
|
5786
5785
|
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] }) }));
|
|
5787
5786
|
});
|
|
5788
5787
|
|
|
5789
|
-
const checkCode = async (body) =>
|
|
5788
|
+
const checkCode = async (body) => await doRequest('/sms/checkCode', 'POST', body);
|
|
5789
|
+
|
|
5790
5790
|
const saveToken = (data) => {
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
globalThis.sessionStorage.setItem('refreshToken', data.refresh_token);
|
|
5794
|
-
}
|
|
5791
|
+
globalThis.sessionStorage.setItem('accessToken', data.access_token);
|
|
5792
|
+
globalThis.sessionStorage.setItem('refreshToken', data.refresh_token);
|
|
5795
5793
|
};
|
|
5796
5794
|
|
|
5797
5795
|
const TIME_TO_RESEND = 180;
|
|
5798
|
-
const useVerifyPhoneDialogSubmit = ({ values, onSuccess, }) => {
|
|
5796
|
+
const useVerifyPhoneDialogSubmit = ({ values, onSuccess, onFail, }) => {
|
|
5799
5797
|
const sessionStore = useSessionStore();
|
|
5800
5798
|
const attempts = sessionStore.smsCode?.attempts || 0;
|
|
5801
5799
|
const timer = Math.max(getTimer(sessionStore.smsCode?.sendTime || Date.now()), 0);
|
|
@@ -5806,27 +5804,30 @@
|
|
|
5806
5804
|
const isTimeExpired = Boolean(timeNextReq === 0 && sessionStore.smsCode?.sendTime);
|
|
5807
5805
|
const isSubmitButtonDisabled = attempts > 2 || isTimeExpired || !values.every(Boolean);
|
|
5808
5806
|
const handleSubmit = useCallback(async () => {
|
|
5809
|
-
|
|
5810
|
-
sessionStore.smsCode
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5807
|
+
sessionStore.smsCode = {
|
|
5808
|
+
...sessionStore.smsCode,
|
|
5809
|
+
attempts: attempts + 1,
|
|
5810
|
+
};
|
|
5811
|
+
startLoading();
|
|
5812
|
+
const response = await checkCode({
|
|
5813
|
+
smsText: values.join(''),
|
|
5814
|
+
smsCodesSetName: { key: 'AUTHENTICATION' },
|
|
5815
|
+
});
|
|
5816
|
+
if (response.ok) {
|
|
5817
|
+
const data = (await response.json());
|
|
5818
|
+
saveToken(data);
|
|
5819
5819
|
setTimeNextReq(0);
|
|
5820
5820
|
resetError();
|
|
5821
5821
|
sessionStore.smsCode = null;
|
|
5822
5822
|
onSuccess?.(values.join(''));
|
|
5823
5823
|
}
|
|
5824
|
-
|
|
5824
|
+
else if (response.status === 403) {
|
|
5825
5825
|
setErrorText(attempts > 1 ? 'Исчерпан лимит ввода смс-кода' : 'Неверный код');
|
|
5826
5826
|
}
|
|
5827
|
-
|
|
5828
|
-
|
|
5827
|
+
else {
|
|
5828
|
+
onFail();
|
|
5829
5829
|
}
|
|
5830
|
+
endLoading();
|
|
5830
5831
|
}, [values, attempts]);
|
|
5831
5832
|
useEffect(() => {
|
|
5832
5833
|
if (isTimeExpired) {
|
|
@@ -5849,12 +5850,13 @@
|
|
|
5849
5850
|
};
|
|
5850
5851
|
|
|
5851
5852
|
const CODE_LENGTH = 4;
|
|
5852
|
-
const VerifyPhoneDialog = JSX(({ phone, withDescription = true, consents, onSuccess = noop, onClose = noop }) => {
|
|
5853
|
+
const VerifyPhoneDialog = JSX(({ phone, withDescription = true, consents, onSuccess = noop, onClose = noop, onFail = noop, }) => {
|
|
5853
5854
|
const [values, setValues] = useState(Array(CODE_LENGTH).fill(''));
|
|
5854
5855
|
const sessionStore = useSessionStore();
|
|
5855
5856
|
const { handleSubmit, hasError, errorText, isLoading, timeNextReq, isSubmitButtonDisabled, setTimeNextReq, setErrorText, } = useVerifyPhoneDialogSubmit({
|
|
5856
5857
|
values,
|
|
5857
5858
|
onSuccess,
|
|
5859
|
+
onFail,
|
|
5858
5860
|
});
|
|
5859
5861
|
const captchaDialog = useDialog(CaptchaDialog);
|
|
5860
5862
|
const phoneNumber = formatPhone(phone);
|
|
@@ -5864,7 +5866,7 @@
|
|
|
5864
5866
|
phoneNumber,
|
|
5865
5867
|
smsCodesSetName: { key: 'AUTHENTICATION' },
|
|
5866
5868
|
});
|
|
5867
|
-
if (response) {
|
|
5869
|
+
if (response.ok) {
|
|
5868
5870
|
setTimeNextReq(TIME_TO_RESEND);
|
|
5869
5871
|
restartTimer(TIME_TO_RESEND);
|
|
5870
5872
|
setErrorText('');
|
|
@@ -5873,10 +5875,13 @@
|
|
|
5873
5875
|
attempts: 0,
|
|
5874
5876
|
};
|
|
5875
5877
|
}
|
|
5876
|
-
else {
|
|
5878
|
+
else if (response.status === 429) {
|
|
5877
5879
|
captchaDialog.open({ phoneNumber, sendCode: handleSendCode });
|
|
5878
5880
|
}
|
|
5879
|
-
|
|
5881
|
+
else {
|
|
5882
|
+
onFail();
|
|
5883
|
+
}
|
|
5884
|
+
}, [phoneNumber, restartTimer]);
|
|
5880
5885
|
useEffect(() => {
|
|
5881
5886
|
if (!sessionStore.smsCode?.sendTime) {
|
|
5882
5887
|
handleSendCode();
|
|
@@ -6400,9 +6405,8 @@
|
|
|
6400
6405
|
|
|
6401
6406
|
/* eslint-disable max-lines */
|
|
6402
6407
|
// eslint-disable-next-line max-lines-per-function
|
|
6403
|
-
const useApplicationLeadApi = ({ programId, nextStepLink, productType, data, }) => {
|
|
6408
|
+
const useApplicationLeadApi = ({ programId, nextStepLink, productType, data, changeSubmitFormStatus, }) => {
|
|
6404
6409
|
const [isSending, { setTrue: startSending, setFalse: endSending }] = useBool(false);
|
|
6405
|
-
const [ok, setOK] = useState();
|
|
6406
6410
|
const saveUserData = useSaveUserData();
|
|
6407
6411
|
const sessionStore = useSessionStore();
|
|
6408
6412
|
const leadFormStore = useLeadFormStore();
|
|
@@ -6414,6 +6418,10 @@
|
|
|
6414
6418
|
const consentBkiDialog = useConsentBkiDialog(goToNextStep);
|
|
6415
6419
|
const verifyPhoneDialog = useDialog(VerifyPhoneDialog);
|
|
6416
6420
|
const draftDialog = useDraftDialog();
|
|
6421
|
+
const handleFailSendForm = () => {
|
|
6422
|
+
verifyPhoneDialog.close();
|
|
6423
|
+
changeSubmitFormStatus(false);
|
|
6424
|
+
};
|
|
6417
6425
|
const handleSubmit = useCallback(async (formData) => {
|
|
6418
6426
|
try {
|
|
6419
6427
|
startSending();
|
|
@@ -6464,7 +6472,7 @@
|
|
|
6464
6472
|
}
|
|
6465
6473
|
}
|
|
6466
6474
|
catch {
|
|
6467
|
-
|
|
6475
|
+
handleFailSendForm();
|
|
6468
6476
|
}
|
|
6469
6477
|
};
|
|
6470
6478
|
const acceptedConsents = getAcceptedConsents(transformedFormData, productType);
|
|
@@ -6472,16 +6480,17 @@
|
|
|
6472
6480
|
phone: transformedFormData.phone,
|
|
6473
6481
|
consents: acceptedConsents,
|
|
6474
6482
|
onSuccess: handleSuccessVerify,
|
|
6483
|
+
onFail: handleFailSendForm,
|
|
6475
6484
|
});
|
|
6476
6485
|
}
|
|
6477
6486
|
catch {
|
|
6478
|
-
|
|
6487
|
+
handleFailSendForm();
|
|
6479
6488
|
}
|
|
6480
6489
|
finally {
|
|
6481
6490
|
endSending();
|
|
6482
6491
|
}
|
|
6483
6492
|
}, []);
|
|
6484
|
-
return { isSending,
|
|
6493
|
+
return { isSending, handleSubmit };
|
|
6485
6494
|
};
|
|
6486
6495
|
const getAcceptedConsents = (formData, productType) => {
|
|
6487
6496
|
const consents = productTypeToConsentsMap[productType];
|
|
@@ -6923,6 +6932,7 @@
|
|
|
6923
6932
|
|
|
6924
6933
|
const ApplicationLeadForm = JSX(({ className, title, programId = '', nextStepLink = '/credit-lead', button, productType = 'credit', data, ...rest }) => {
|
|
6925
6934
|
const [esiaStatus, setEsiaStatus] = useState();
|
|
6935
|
+
const [ok, setOK] = useState();
|
|
6926
6936
|
const [attemptsWithoutConsents, setAttemptsWithoutConsents] = useState(0);
|
|
6927
6937
|
const leadForm = useRef(null);
|
|
6928
6938
|
const applicationFormData = useMemo(() => getApplicationFormData(productType), [productType]);
|
|
@@ -6931,6 +6941,9 @@
|
|
|
6931
6941
|
useIFrameMode();
|
|
6932
6942
|
const extendedValidatorObj = useMemo(() => getExtendedValidatorObj(productType), [productType]);
|
|
6933
6943
|
const formValidator = useMemo(() => getFormValidator(inputs, extendedValidatorObj), [inputs, extendedValidatorObj]);
|
|
6944
|
+
const changeSubmitFormStatus = (status) => {
|
|
6945
|
+
setOK(status);
|
|
6946
|
+
};
|
|
6934
6947
|
const initialFormState = useInitApplicationLead({
|
|
6935
6948
|
inputs,
|
|
6936
6949
|
nextStepLink,
|
|
@@ -6938,11 +6951,12 @@
|
|
|
6938
6951
|
setEsiaStatus,
|
|
6939
6952
|
esiaAuthSuccess: esiaStatus === EsiaStatuses.Success,
|
|
6940
6953
|
});
|
|
6941
|
-
const { isSending,
|
|
6954
|
+
const { isSending, handleSubmit } = useApplicationLeadApi({
|
|
6942
6955
|
programId,
|
|
6943
6956
|
nextStepLink,
|
|
6944
6957
|
productType,
|
|
6945
6958
|
data,
|
|
6959
|
+
changeSubmitFormStatus,
|
|
6946
6960
|
});
|
|
6947
6961
|
const [, { field, onSubmit, reset }] = useForm(initialFormState, {
|
|
6948
6962
|
formValidator,
|
|
@@ -6961,7 +6975,10 @@
|
|
|
6961
6975
|
const responseTypeDialog = useDialog(ResponseTypeDialog);
|
|
6962
6976
|
useEffect(() => {
|
|
6963
6977
|
if (ok !== undefined) {
|
|
6964
|
-
responseTypeDialog.open({
|
|
6978
|
+
responseTypeDialog.open({
|
|
6979
|
+
ok,
|
|
6980
|
+
onClose: () => changeSubmitFormStatus(undefined),
|
|
6981
|
+
});
|
|
6965
6982
|
}
|
|
6966
6983
|
}, [ok]);
|
|
6967
6984
|
useEffect(() => {
|
|
@@ -10293,7 +10310,7 @@
|
|
|
10293
10310
|
name: 'infoCard',
|
|
10294
10311
|
label:
|
|
10295
10312
|
// eslint-disable-next-line max-len
|
|
10296
|
-
'Количество символов ограничивается
|
|
10313
|
+
'Количество символов ограничивается 20. При этом, если фамилия и имя на карте содержит более 21 символа, то необходимо сократить имя и указывать на карте только первую букву имени и фамилию, если при таком сокращении фамилия и имя не умещается в количество символов – 20, то указывать только фамилию.',
|
|
10297
10314
|
},
|
|
10298
10315
|
],
|
|
10299
10316
|
},
|
|
@@ -12196,7 +12213,7 @@
|
|
|
12196
12213
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
12197
12214
|
});
|
|
12198
12215
|
|
|
12199
|
-
const packageVersion = "0.14.
|
|
12216
|
+
const packageVersion = "0.14.927";
|
|
12200
12217
|
|
|
12201
12218
|
exports.Blocks = Blocks;
|
|
12202
12219
|
exports.ContentPage = ContentPage;
|