@redneckz/wildless-cms-uni-blocks 0.14.619 → 0.14.620
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/api/RetailAPI/getLink.d.ts +7 -0
- package/bundle/api/RetailAPI/updateProfileEsia.d.ts +66 -0
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +100 -39
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +2 -0
- package/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -1
- package/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +3 -1
- package/bundle/icons/IconName.d.ts +4 -2
- package/bundle/ui-kit/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -1
- package/bundle/ui-kit/EsiaLoginDialog/EsiaLoginDialog.d.ts +4 -0
- package/bundle/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.d.ts +9 -0
- package/cosmos-static/icons/GosUslugiIcon.svg +1 -0
- package/dist/api/RetailAPI/getLink.d.ts +7 -0
- package/dist/api/RetailAPI/getLink.js +6 -0
- package/dist/api/RetailAPI/getLink.js.map +1 -0
- package/dist/api/RetailAPI/updateProfileEsia.d.ts +66 -0
- package/dist/api/RetailAPI/updateProfileEsia.js +6 -0
- package/dist/api/RetailAPI/updateProfileEsia.js.map +1 -0
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +5 -3
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +2 -0
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -1
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +28 -21
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +3 -1
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.js +34 -3
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/dist/icons/IconName.d.ts +4 -2
- package/dist/icons/IconName.js +3 -1
- package/dist/icons/IconName.js.map +1 -1
- package/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -1
- package/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +4 -7
- package/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
- package/dist/ui-kit/EsiaLoginDialog/EsiaLoginDialog.d.ts +4 -0
- package/dist/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js +21 -0
- package/dist/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js.map +1 -0
- package/dist/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.d.ts +9 -0
- package/dist/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.js +19 -0
- package/dist/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.js.map +1 -0
- package/lib/api/RetailAPI/getLink.d.ts +7 -0
- package/lib/api/RetailAPI/getLink.js +3 -0
- package/lib/api/RetailAPI/getLink.js.map +1 -0
- package/lib/api/RetailAPI/updateProfileEsia.d.ts +66 -0
- package/lib/api/RetailAPI/updateProfileEsia.js +3 -0
- package/lib/api/RetailAPI/updateProfileEsia.js.map +1 -0
- package/lib/common.css +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +6 -4
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +2 -0
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +28 -21
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +3 -1
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.js +35 -4
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/lib/icons/IconName.d.ts +4 -2
- package/lib/icons/IconName.js +3 -1
- package/lib/icons/IconName.js.map +1 -1
- package/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -1
- package/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +4 -7
- package/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
- package/lib/ui-kit/EsiaLoginDialog/EsiaLoginDialog.d.ts +4 -0
- package/lib/ui-kit/EsiaLoginDialog/EsiaLoginDialog.fixture.d.ts +6 -0
- package/lib/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js +19 -0
- package/lib/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js.map +1 -0
- package/lib/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.d.ts +9 -0
- package/lib/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.js +16 -0
- package/lib/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.js.map +1 -0
- package/mobile/bundle/api/RetailAPI/getLink.d.ts +7 -0
- package/mobile/bundle/api/RetailAPI/updateProfileEsia.d.ts +66 -0
- package/mobile/bundle/bundle.umd.js +100 -39
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +2 -0
- package/mobile/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -1
- package/mobile/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +3 -1
- package/mobile/bundle/icons/IconName.d.ts +4 -2
- package/mobile/bundle/ui-kit/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -1
- package/mobile/bundle/ui-kit/EsiaLoginDialog/EsiaLoginDialog.d.ts +4 -0
- package/mobile/bundle/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.d.ts +9 -0
- package/mobile/dist/api/RetailAPI/getLink.d.ts +7 -0
- package/mobile/dist/api/RetailAPI/getLink.js +6 -0
- package/mobile/dist/api/RetailAPI/getLink.js.map +1 -0
- package/mobile/dist/api/RetailAPI/updateProfileEsia.d.ts +66 -0
- package/mobile/dist/api/RetailAPI/updateProfileEsia.js +6 -0
- package/mobile/dist/api/RetailAPI/updateProfileEsia.js.map +1 -0
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +5 -3
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +2 -0
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -1
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +28 -21
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +3 -1
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js +34 -3
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/mobile/dist/icons/IconName.d.ts +4 -2
- package/mobile/dist/icons/IconName.js +3 -1
- package/mobile/dist/icons/IconName.js.map +1 -1
- package/mobile/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -1
- package/mobile/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +4 -7
- package/mobile/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
- package/mobile/dist/ui-kit/EsiaLoginDialog/EsiaLoginDialog.d.ts +4 -0
- package/mobile/dist/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js +21 -0
- package/mobile/dist/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js.map +1 -0
- package/mobile/dist/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.d.ts +9 -0
- package/mobile/dist/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.js +19 -0
- package/mobile/dist/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.js.map +1 -0
- package/mobile/lib/api/RetailAPI/getLink.d.ts +7 -0
- package/mobile/lib/api/RetailAPI/getLink.js +3 -0
- package/mobile/lib/api/RetailAPI/getLink.js.map +1 -0
- package/mobile/lib/api/RetailAPI/updateProfileEsia.d.ts +66 -0
- package/mobile/lib/api/RetailAPI/updateProfileEsia.js +3 -0
- package/mobile/lib/api/RetailAPI/updateProfileEsia.js.map +1 -0
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +6 -4
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +2 -0
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +28 -21
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +3 -1
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js +35 -4
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/mobile/lib/icons/IconName.d.ts +4 -2
- package/mobile/lib/icons/IconName.js +3 -1
- package/mobile/lib/icons/IconName.js.map +1 -1
- package/mobile/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -1
- package/mobile/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +4 -7
- package/mobile/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
- package/mobile/lib/ui-kit/EsiaLoginDialog/EsiaLoginDialog.d.ts +4 -0
- package/mobile/lib/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js +19 -0
- package/mobile/lib/ui-kit/EsiaLoginDialog/EsiaLoginDialog.js.map +1 -0
- package/mobile/lib/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.d.ts +9 -0
- package/mobile/lib/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.js +16 -0
- package/mobile/lib/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.js.map +1 -0
- package/mobile/src/api/RetailAPI/getLink.ts +12 -0
- package/mobile/src/api/RetailAPI/updateProfileEsia.ts +71 -0
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +16 -3
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +2 -0
- package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +53 -26
- package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +40 -4
- package/mobile/src/icons/GosUslugiIcon.svg +11 -0
- package/mobile/src/icons/IconName.ts +5 -5
- package/mobile/src/ui-kit/ConsentBkiDialog/useConsentBkiDialog.tsx +4 -8
- package/mobile/src/ui-kit/EsiaLoginDialog/EsiaLoginDialog.tsx +44 -0
- package/mobile/src/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.tsx +23 -0
- package/package.json +1 -1
- package/src/api/RetailAPI/getLink.ts +12 -0
- package/src/api/RetailAPI/updateProfileEsia.ts +71 -0
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +16 -3
- package/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +2 -0
- package/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +53 -26
- package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +40 -4
- package/src/icons/GosUslugiIcon.svg +11 -0
- package/src/icons/IconName.ts +360 -6
- package/src/ui-kit/ConsentBkiDialog/useConsentBkiDialog.tsx +4 -8
- package/src/ui-kit/EsiaLoginDialog/EsiaLoginDialog.fixture.tsx +7 -0
- package/src/ui-kit/EsiaLoginDialog/EsiaLoginDialog.tsx +44 -0
- package/src/ui-kit/EsiaLoginDialog/useEsiaLoginDialog.tsx +23 -0
|
@@ -2764,6 +2764,10 @@
|
|
|
2764
2764
|
return [storedValue, setValue];
|
|
2765
2765
|
}
|
|
2766
2766
|
|
|
2767
|
+
const Loader = JSX(({ color = 'text-primary-main', position = 'absolute', blur = true }) => (jsx("div", { className: style('flex justify-center items-center h-full w-full z-50', position, {
|
|
2768
|
+
'backdrop-blur': blur,
|
|
2769
|
+
}), children: jsx("div", { className: style('inline-block h-28 w-28', 'animate-spin rounded-full', 'border-8 border-solid border-current', 'border-r-transparent', color), role: "status" }) })));
|
|
2770
|
+
|
|
2767
2771
|
const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
|
|
2768
2772
|
const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
|
|
2769
2773
|
const onToggle = useCallback(() => {
|
|
@@ -3019,10 +3023,6 @@
|
|
|
3019
3023
|
};
|
|
3020
3024
|
};
|
|
3021
3025
|
|
|
3022
|
-
const Loader = JSX(({ color = 'text-primary-main', position = 'absolute', blur = true }) => (jsx("div", { className: style('flex justify-center items-center h-full w-full z-50', position, {
|
|
3023
|
-
'backdrop-blur': blur,
|
|
3024
|
-
}), children: jsx("div", { className: style('inline-block h-28 w-28', 'animate-spin rounded-full', 'border-8 border-solid border-current', 'border-r-transparent', color), role: "status" }) })));
|
|
3025
|
-
|
|
3026
3026
|
const Timer = JSX(({ time, setTime, className }) => {
|
|
3027
3027
|
useEffect(() => {
|
|
3028
3028
|
const timer = setInterval(() => {
|
|
@@ -3226,12 +3226,9 @@
|
|
|
3226
3226
|
];
|
|
3227
3227
|
const CONSENT_BKI_ID = 2;
|
|
3228
3228
|
|
|
3229
|
-
const useConsentBkiDialog = () => {
|
|
3229
|
+
const useConsentBkiDialog = (onClose) => {
|
|
3230
3230
|
const { open, closeAll } = useDialogManager();
|
|
3231
3231
|
const verifyPhoneDialog = useVerifyPhoneDialog();
|
|
3232
|
-
const redirectToCreditForm = () => {
|
|
3233
|
-
globalThis.location.href = '/credit-lead';
|
|
3234
|
-
};
|
|
3235
3232
|
const handleSuccessVerify = (profileId) => async (smsCode) => {
|
|
3236
3233
|
if (profileId) {
|
|
3237
3234
|
await updateUserProfile({
|
|
@@ -3242,7 +3239,7 @@
|
|
|
3242
3239
|
},
|
|
3243
3240
|
});
|
|
3244
3241
|
}
|
|
3245
|
-
|
|
3242
|
+
onClose();
|
|
3246
3243
|
};
|
|
3247
3244
|
const handleSubmitBkiConstent = (phone, profileId) => async (confirmStatus) => {
|
|
3248
3245
|
await closeAll();
|
|
@@ -3250,11 +3247,11 @@
|
|
|
3250
3247
|
verifyPhoneDialog.open(handleSuccessVerify(profileId), verifyPhoneContent$1(phone));
|
|
3251
3248
|
}
|
|
3252
3249
|
else {
|
|
3253
|
-
|
|
3250
|
+
onClose();
|
|
3254
3251
|
}
|
|
3255
3252
|
};
|
|
3256
3253
|
return {
|
|
3257
|
-
open: (phone, profileId) => open(jsx(ConsentBkiDialog, { handleSubmit: handleSubmitBkiConstent(phone, profileId), onClose:
|
|
3254
|
+
open: (phone, profileId) => open(jsx(ConsentBkiDialog, { handleSubmit: handleSubmitBkiConstent(phone, profileId), onClose: onClose })),
|
|
3258
3255
|
};
|
|
3259
3256
|
};
|
|
3260
3257
|
const verifyPhoneContent$1 = (phone) => ({
|
|
@@ -3266,12 +3263,39 @@
|
|
|
3266
3263
|
<ul><li>согласие на запрос информации в БКИ</li></ul>`,
|
|
3267
3264
|
});
|
|
3268
3265
|
|
|
3269
|
-
const
|
|
3266
|
+
const getLink = (body) => doRequest('/esia/getLink', 'POST', body);
|
|
3267
|
+
|
|
3268
|
+
const EsiaLoginDialog = JSX(function ({ handleClose }) {
|
|
3269
|
+
const handleAuth = useCallback(async () => {
|
|
3270
|
+
const resp = await getLink({
|
|
3271
|
+
redirectUri: globalThis.location.href + '&esiaAuth=true',
|
|
3272
|
+
});
|
|
3273
|
+
if (resp) {
|
|
3274
|
+
globalThis.location.href = resp.link;
|
|
3275
|
+
}
|
|
3276
|
+
}, []);
|
|
3277
|
+
return (jsx(Dialog, { className: "my-6xl max-w-lg w-full min-h-fit mx-auto rounded-lg", onClose: handleClose, children: jsxs("div", { className: "flex flex-col gap-lg items-center rounded-md", children: [jsxs("div", { className: "flex items-center justify-around w-full", children: [jsxs("ul", { className: "list-disc", children: [jsx("li", { children: "\u0412\u0435\u0440\u043E\u044F\u0442\u043D\u043E\u0441\u0442\u044C \u043E\u0434\u043E\u0431\u0440\u0435\u043D\u0438\u044F \u0432\u044B\u0448\u0435" }), jsx("li", { children: "\u0411\u0435\u0437 \u0441\u043F\u0440\u0430\u0432\u043E\u043A \u043E \u0434\u043E\u0445\u043E\u0434\u0430\u0445 \u0438 \u0442\u0440\u0443\u0434\u043E\u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0435" }), jsx("li", { children: "\u0421 \u0437\u0430\u0449\u0438\u0442\u043E\u0439 \u0412\u0430\u0448\u0438\u0445 \u0434\u0430\u043D\u043D\u044B\u0445" })] }), jsx(Img, { image: { icon: 'GosUslugiIcon', iconVersion: 'normal' }, height: "70" })] }), jsxs("div", { className: "flex items-center justify-between w-full m-0", children: [jsx(Button, { type: "button", onClick: handleAuth, children: "\u0417\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u044C \u0447\u0435\u0440\u0435\u0437 \u0413\u043E\u0441\u0443\u0441\u043B\u0443\u0433\u0438" }), jsx(Button, { type: "button", version: "secondary", onClick: handleClose, children: "\u041F\u0440\u043E\u043F\u0443\u0441\u0442\u0438\u0442\u044C" })] })] }) }));
|
|
3278
|
+
});
|
|
3279
|
+
|
|
3280
|
+
const useEsiaLoginDialog = (nextStepLink) => {
|
|
3281
|
+
const { open, close } = useDialogManager();
|
|
3282
|
+
const handleClose = useCallback(() => {
|
|
3283
|
+
close();
|
|
3284
|
+
globalThis.location.href = nextStepLink;
|
|
3285
|
+
}, []);
|
|
3286
|
+
return {
|
|
3287
|
+
open: (options = {}) => open(jsx(EsiaLoginDialog, { handleClose: handleClose }), options),
|
|
3288
|
+
close,
|
|
3289
|
+
};
|
|
3290
|
+
};
|
|
3291
|
+
|
|
3292
|
+
const useApplicationLeadApi = ({ inputs, programId, nextStepLink, saveForm, }) => {
|
|
3270
3293
|
const [responseStatus, setResponseStatus] = useState('');
|
|
3271
3294
|
const [, setTaskId] = useLocalStorage('taskId');
|
|
3272
3295
|
const [, setProfileId] = useLocalStorage('profileId');
|
|
3273
3296
|
const [, setParticipantId] = useLocalStorage('participantId');
|
|
3274
|
-
const
|
|
3297
|
+
const esiaLoginDialog = useEsiaLoginDialog(nextStepLink);
|
|
3298
|
+
const consentBkiDialog = useConsentBkiDialog(esiaLoginDialog.open);
|
|
3275
3299
|
const verifyPhoneDialog = useVerifyPhoneDialog();
|
|
3276
3300
|
const saveUserData = useCallback((participantId, taskId, profileId) => {
|
|
3277
3301
|
setParticipantId(participantId);
|
|
@@ -3285,40 +3309,29 @@
|
|
|
3285
3309
|
return 'Fail';
|
|
3286
3310
|
}
|
|
3287
3311
|
try {
|
|
3288
|
-
const { profile } = await createUserProfile({
|
|
3312
|
+
const { profile: { id: profileId }, } = await createUserProfile({
|
|
3289
3313
|
profile: { phone: formatPhone(formData.phone) },
|
|
3290
3314
|
});
|
|
3291
|
-
const profileId = profile?.id;
|
|
3292
|
-
const transformedForm = transformOtherConsentsField(formData);
|
|
3293
3315
|
if (profileId && formData?.phone) {
|
|
3294
3316
|
const handleSuccessVerify = async () => {
|
|
3295
3317
|
try {
|
|
3296
|
-
await
|
|
3297
|
-
const { taskId, participantId } = await createDraftTask({
|
|
3298
|
-
profileId,
|
|
3318
|
+
await updateUserData({
|
|
3299
3319
|
programId,
|
|
3300
|
-
});
|
|
3301
|
-
await updateUserTask(getUpdateUserTaskData({
|
|
3302
|
-
participantId,
|
|
3303
|
-
taskId,
|
|
3304
3320
|
profileId,
|
|
3305
|
-
formData
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3321
|
+
formData,
|
|
3322
|
+
saveUserData,
|
|
3323
|
+
saveForm,
|
|
3324
|
+
});
|
|
3325
|
+
consentBkiDialog.open(formData.phone, profileId);
|
|
3309
3326
|
}
|
|
3310
3327
|
catch {
|
|
3311
3328
|
setResponseStatus('Fail');
|
|
3312
3329
|
}
|
|
3313
3330
|
};
|
|
3314
|
-
const handleCloseVerify = async () => {
|
|
3315
|
-
await handleSuccessVerify();
|
|
3316
|
-
consentBkiDialog.open(formData.phone, profileId);
|
|
3317
|
-
};
|
|
3318
3331
|
const acceptedConsents = Object.keys(CONSENTS)
|
|
3319
3332
|
.filter((_) => formData[_])
|
|
3320
3333
|
.map((_) => CONSENTS[_]?.text);
|
|
3321
|
-
verifyPhoneDialog.open(
|
|
3334
|
+
verifyPhoneDialog.open(handleSuccessVerify, verifyPhoneContent(formData?.phone, acceptedConsents));
|
|
3322
3335
|
}
|
|
3323
3336
|
}
|
|
3324
3337
|
catch {
|
|
@@ -3330,6 +3343,22 @@
|
|
|
3330
3343
|
responseStatus,
|
|
3331
3344
|
};
|
|
3332
3345
|
};
|
|
3346
|
+
const updateUserData = async ({ programId, profileId, formData, saveUserData, saveForm, }) => {
|
|
3347
|
+
const transformedForm = transformOtherConsentsField(formData);
|
|
3348
|
+
await updateUserProfile(getUpdateUserProfileData(profileId, transformedForm));
|
|
3349
|
+
const { taskId, participantId } = await createDraftTask({
|
|
3350
|
+
profileId,
|
|
3351
|
+
programId,
|
|
3352
|
+
});
|
|
3353
|
+
await updateUserTask(getUpdateUserTaskData({
|
|
3354
|
+
participantId,
|
|
3355
|
+
taskId,
|
|
3356
|
+
profileId,
|
|
3357
|
+
formData: transformedForm,
|
|
3358
|
+
}));
|
|
3359
|
+
saveUserData(participantId, taskId, profileId);
|
|
3360
|
+
saveForm(formData);
|
|
3361
|
+
};
|
|
3333
3362
|
const verifyPhoneContent = (phone, consents) => ({
|
|
3334
3363
|
title: 'Подтвердите номер телефона',
|
|
3335
3364
|
description: `Мы отправили код на ${phone}`,
|
|
@@ -3348,22 +3377,54 @@
|
|
|
3348
3377
|
};
|
|
3349
3378
|
};
|
|
3350
3379
|
|
|
3351
|
-
const
|
|
3380
|
+
const updateProfileEsia = (body) => doRequest('/esia/updateProfileEsia', 'POST', body);
|
|
3381
|
+
|
|
3382
|
+
const useInitApplicationLead = (nextStepLink) => {
|
|
3383
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
3384
|
+
const [profileId] = useLocalStorage('profileId');
|
|
3385
|
+
const [, setEsiaData] = useLocalStorage('esiaData');
|
|
3386
|
+
const params = new URLSearchParams(decodeURIComponent(window.location.search));
|
|
3387
|
+
const esiaAuth = params.get('esiaAuth');
|
|
3388
|
+
const updateEsiaProfile = useCallback(async () => {
|
|
3389
|
+
const code = params.get('code');
|
|
3390
|
+
const state = params.get('state');
|
|
3391
|
+
if (profileId && code && state) {
|
|
3392
|
+
const data = await updateProfileEsia({
|
|
3393
|
+
profileId: profileId,
|
|
3394
|
+
code,
|
|
3395
|
+
state,
|
|
3396
|
+
redirectUri: globalThis.location.href,
|
|
3397
|
+
});
|
|
3398
|
+
setEsiaData(JSON.stringify(data));
|
|
3399
|
+
globalThis.location.href = nextStepLink;
|
|
3400
|
+
}
|
|
3401
|
+
}, []);
|
|
3352
3402
|
useEffect(() => {
|
|
3353
|
-
|
|
3354
|
-
|
|
3403
|
+
if (esiaAuth) {
|
|
3404
|
+
setIsLoading(true);
|
|
3405
|
+
updateEsiaProfile();
|
|
3406
|
+
}
|
|
3407
|
+
else {
|
|
3408
|
+
setEsiaData('');
|
|
3409
|
+
sessionStorage.removeItem('accessToken');
|
|
3410
|
+
sessionStorage.removeItem('refreshToken');
|
|
3411
|
+
}
|
|
3355
3412
|
}, []);
|
|
3413
|
+
return {
|
|
3414
|
+
isLoading,
|
|
3415
|
+
};
|
|
3356
3416
|
};
|
|
3357
3417
|
|
|
3358
|
-
const ApplicationLeadForm = JSX(({ className, title, programId = '', typeForm = '', sections = [], button, ...rest }) => {
|
|
3418
|
+
const ApplicationLeadForm = JSX(({ className, title, programId = '', nextStepLink = '/credit-lead', typeForm = '', sections = [], button, ...rest }) => {
|
|
3359
3419
|
const inputs = (sections?.flatMap((_) => _?.inputs) || []);
|
|
3360
3420
|
const [responseType, setResponseType] = useState('');
|
|
3361
|
-
useInitApplicationLead();
|
|
3421
|
+
const { isLoading } = useInitApplicationLead(nextStepLink);
|
|
3362
3422
|
const [leadForm, setLeadForm] = useLocalStorage('leadForm');
|
|
3363
3423
|
const initialFormState = getInitialFormState$1(inputs, leadForm, typeForm);
|
|
3364
3424
|
const { handleSubmit, responseStatus } = useApplicationLeadApi({
|
|
3365
3425
|
inputs,
|
|
3366
3426
|
programId,
|
|
3427
|
+
nextStepLink,
|
|
3367
3428
|
saveForm: setLeadForm,
|
|
3368
3429
|
});
|
|
3369
3430
|
if (responseStatus) {
|
|
@@ -3377,7 +3438,7 @@
|
|
|
3377
3438
|
reset();
|
|
3378
3439
|
}
|
|
3379
3440
|
}, [responseType]);
|
|
3380
|
-
return (jsx(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: jsxs("form", { onSubmit: onSubmit, className: "space-y-m", children: [sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), renderInputs$1({ field, inputs: _?.inputs })] }, `section-${i}`))), renderSubmitButton(button)] }) }));
|
|
3441
|
+
return (jsx(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: jsxs("form", { onSubmit: onSubmit, className: "space-y-m relative", children: [isLoading ? jsx(Loader, { blur: false }) : null, sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), renderInputs$1({ field, inputs: _?.inputs })] }, `section-${i}`))), renderSubmitButton(button)] }) }));
|
|
3381
3442
|
});
|
|
3382
3443
|
|
|
3383
3444
|
const NotFound = JSX(({ title, description }) => {
|
|
@@ -7792,7 +7853,7 @@
|
|
|
7792
7853
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
7793
7854
|
});
|
|
7794
7855
|
|
|
7795
|
-
const packageVersion = "0.14.
|
|
7856
|
+
const packageVersion = "0.14.619";
|
|
7796
7857
|
|
|
7797
7858
|
exports.Blocks = Blocks;
|
|
7798
7859
|
exports.ContentPage = ContentPage;
|