@redneckz/wildless-cms-uni-blocks 0.14.580 → 0.14.582
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/RetailApi.d.ts +9 -0
- package/bundle/api/RetailApi/RetailApiTypes.d.ts +83 -0
- package/bundle/api/RetailApi/utils/getUpdateUserProfile.d.ts +3 -0
- package/bundle/api/RetailApi/utils/getUpdateUserTask.d.ts +2 -0
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +281 -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 +6 -0
- package/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
- package/bundle/hooks/useLeadFormData.d.ts +4 -1
- package/bundle/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +2 -0
- package/dist/api/RetailApi/RetailApi.d.ts +9 -0
- package/dist/api/RetailApi/RetailApi.js +29 -0
- package/dist/api/RetailApi/RetailApi.js.map +1 -0
- package/dist/api/RetailApi/RetailApiTypes.d.ts +83 -0
- package/dist/api/RetailApi/RetailApiTypes.js +2 -0
- package/dist/api/RetailApi/RetailApiTypes.js.map +1 -0
- package/dist/api/RetailApi/utils/getUpdateUserProfile.d.ts +3 -0
- package/dist/api/RetailApi/utils/getUpdateUserProfile.js +27 -0
- package/dist/api/RetailApi/utils/getUpdateUserProfile.js.map +1 -0
- package/dist/api/RetailApi/utils/getUpdateUserTask.d.ts +2 -0
- package/dist/api/RetailApi/utils/getUpdateUserTask.js +43 -0
- package/dist/api/RetailApi/utils/getUpdateUserTask.js.map +1 -0
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +9 -23
- 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 +6 -0
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +69 -0
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -0
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.js +11 -0
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -0
- package/dist/hooks/useLeadFormData.d.ts +4 -1
- package/dist/hooks/useLeadFormData.js +4 -1
- package/dist/hooks/useLeadFormData.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
- package/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
- package/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +2 -0
- package/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js +19 -11
- package/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
- package/lib/api/RetailApi/RetailApi.d.ts +9 -0
- package/lib/api/RetailApi/RetailApi.js +27 -0
- package/lib/api/RetailApi/RetailApi.js.map +1 -0
- package/lib/api/RetailApi/RetailApiTypes.d.ts +83 -0
- package/lib/api/RetailApi/RetailApiTypes.js +2 -0
- package/lib/api/RetailApi/RetailApiTypes.js.map +1 -0
- package/lib/api/RetailApi/utils/getUpdateUserProfile.d.ts +3 -0
- package/lib/api/RetailApi/utils/getUpdateUserProfile.js +24 -0
- package/lib/api/RetailApi/utils/getUpdateUserProfile.js.map +1 -0
- package/lib/api/RetailApi/utils/getUpdateUserTask.d.ts +2 -0
- package/lib/api/RetailApi/utils/getUpdateUserTask.js +40 -0
- package/lib/api/RetailApi/utils/getUpdateUserTask.js.map +1 -0
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +10 -24
- 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 +6 -0
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +66 -0
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -0
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.js +8 -0
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -0
- package/lib/hooks/useLeadFormData.d.ts +4 -1
- package/lib/hooks/useLeadFormData.js +4 -1
- package/lib/hooks/useLeadFormData.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
- package/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
- package/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +2 -0
- package/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js +19 -11
- package/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
- package/mobile/bundle/api/RetailApi/RetailApi.d.ts +9 -0
- package/mobile/bundle/api/RetailApi/RetailApiTypes.d.ts +83 -0
- package/mobile/bundle/api/RetailApi/utils/getUpdateUserProfile.d.ts +3 -0
- package/mobile/bundle/api/RetailApi/utils/getUpdateUserTask.d.ts +2 -0
- package/mobile/bundle/bundle.umd.js +281 -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 +6 -0
- package/mobile/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
- package/mobile/bundle/hooks/useLeadFormData.d.ts +4 -1
- package/mobile/bundle/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +2 -0
- package/mobile/dist/api/RetailApi/RetailApi.d.ts +9 -0
- package/mobile/dist/api/RetailApi/RetailApi.js +29 -0
- package/mobile/dist/api/RetailApi/RetailApi.js.map +1 -0
- package/mobile/dist/api/RetailApi/RetailApiTypes.d.ts +83 -0
- package/mobile/dist/api/RetailApi/RetailApiTypes.js +2 -0
- package/mobile/dist/api/RetailApi/RetailApiTypes.js.map +1 -0
- package/mobile/dist/api/RetailApi/utils/getUpdateUserProfile.d.ts +3 -0
- package/mobile/dist/api/RetailApi/utils/getUpdateUserProfile.js +27 -0
- package/mobile/dist/api/RetailApi/utils/getUpdateUserProfile.js.map +1 -0
- package/mobile/dist/api/RetailApi/utils/getUpdateUserTask.d.ts +2 -0
- package/mobile/dist/api/RetailApi/utils/getUpdateUserTask.js +43 -0
- package/mobile/dist/api/RetailApi/utils/getUpdateUserTask.js.map +1 -0
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +9 -23
- 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 +6 -0
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +69 -0
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -0
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js +11 -0
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -0
- package/mobile/dist/hooks/useLeadFormData.d.ts +4 -1
- package/mobile/dist/hooks/useLeadFormData.js +4 -1
- package/mobile/dist/hooks/useLeadFormData.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
- package/mobile/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +2 -0
- package/mobile/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js +19 -11
- package/mobile/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
- package/mobile/lib/api/RetailApi/RetailApi.d.ts +9 -0
- package/mobile/lib/api/RetailApi/RetailApi.js +27 -0
- package/mobile/lib/api/RetailApi/RetailApi.js.map +1 -0
- package/mobile/lib/api/RetailApi/RetailApiTypes.d.ts +83 -0
- package/mobile/lib/api/RetailApi/RetailApiTypes.js +2 -0
- package/mobile/lib/api/RetailApi/RetailApiTypes.js.map +1 -0
- package/mobile/lib/api/RetailApi/utils/getUpdateUserProfile.d.ts +3 -0
- package/mobile/lib/api/RetailApi/utils/getUpdateUserProfile.js +24 -0
- package/mobile/lib/api/RetailApi/utils/getUpdateUserProfile.js.map +1 -0
- package/mobile/lib/api/RetailApi/utils/getUpdateUserTask.d.ts +2 -0
- package/mobile/lib/api/RetailApi/utils/getUpdateUserTask.js +40 -0
- package/mobile/lib/api/RetailApi/utils/getUpdateUserTask.js.map +1 -0
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +10 -24
- 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 +6 -0
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +66 -0
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -0
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js +8 -0
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -0
- package/mobile/lib/hooks/useLeadFormData.d.ts +4 -1
- package/mobile/lib/hooks/useLeadFormData.js +4 -1
- package/mobile/lib/hooks/useLeadFormData.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
- package/mobile/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +2 -0
- package/mobile/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js +19 -11
- package/mobile/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
- package/mobile/src/api/RetailApi/RetailApi.ts +51 -0
- package/mobile/src/api/RetailApi/RetailApiTypes.ts +91 -0
- package/mobile/src/api/RetailApi/utils/getUpdateUserProfile.ts +44 -0
- package/mobile/src/api/RetailApi/utils/getUpdateUserTask.ts +46 -0
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +11 -26
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +2 -0
- package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +74 -0
- package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +8 -0
- package/mobile/src/hooks/useLeadFormData.ts +10 -3
- package/mobile/src/ui-kit/FormField/Fields/DesiredMeetingDateField.tsx +2 -2
- package/mobile/src/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.tsx +32 -14
- package/package.json +2 -2
- package/src/api/RetailApi/RetailApi.ts +51 -0
- package/src/api/RetailApi/RetailApiTypes.ts +91 -0
- package/src/api/RetailApi/utils/getUpdateUserProfile.ts +44 -0
- package/src/api/RetailApi/utils/getUpdateUserTask.ts +46 -0
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.tsx +1 -0
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +11 -26
- package/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +2 -0
- package/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +74 -0
- package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +8 -0
- package/src/hooks/useLeadFormData.ts +10 -3
- package/src/ui-kit/FormField/Fields/DesiredMeetingDateField.tsx +2 -2
- package/src/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.fixture.tsx +5 -4
- package/src/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.tsx +32 -14
- package/bundle/components/ApplicationLeadForm/getFormatData.d.ts +0 -2
- package/bundle/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.d.ts +0 -13
- package/dist/components/ApplicationLeadForm/getFormatData.d.ts +0 -2
- package/dist/components/ApplicationLeadForm/getFormatData.js +0 -13
- package/dist/components/ApplicationLeadForm/getFormatData.js.map +0 -1
- package/dist/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.d.ts +0 -13
- package/dist/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js +0 -30
- package/dist/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js.map +0 -1
- package/lib/components/ApplicationLeadForm/getFormatData.d.ts +0 -2
- package/lib/components/ApplicationLeadForm/getFormatData.js +0 -10
- package/lib/components/ApplicationLeadForm/getFormatData.js.map +0 -1
- package/lib/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.d.ts +0 -13
- package/lib/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js +0 -27
- package/lib/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js.map +0 -1
- package/mobile/bundle/components/ApplicationLeadForm/getFormatData.d.ts +0 -2
- package/mobile/bundle/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.d.ts +0 -13
- package/mobile/dist/components/ApplicationLeadForm/getFormatData.d.ts +0 -2
- package/mobile/dist/components/ApplicationLeadForm/getFormatData.js +0 -13
- package/mobile/dist/components/ApplicationLeadForm/getFormatData.js.map +0 -1
- package/mobile/dist/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.d.ts +0 -13
- package/mobile/dist/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js +0 -30
- package/mobile/dist/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js.map +0 -1
- package/mobile/lib/components/ApplicationLeadForm/getFormatData.d.ts +0 -2
- package/mobile/lib/components/ApplicationLeadForm/getFormatData.js +0 -10
- package/mobile/lib/components/ApplicationLeadForm/getFormatData.js.map +0 -1
- package/mobile/lib/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.d.ts +0 -13
- package/mobile/lib/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js +0 -27
- package/mobile/lib/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js.map +0 -1
- package/mobile/src/components/ApplicationLeadForm/getFormatData.tsx +0 -17
- package/mobile/src/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.tsx +0 -36
- package/src/components/ApplicationLeadForm/getFormatData.tsx +0 -17
- package/src/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.tsx +0 -36
package/bundle/bundle.umd.js
CHANGED
|
@@ -862,7 +862,7 @@
|
|
|
862
862
|
const url = isNaturalPerson ? '/api/v1/lead' : '/api/v1/sendcorporatelead';
|
|
863
863
|
const submitBody = {
|
|
864
864
|
typeForm,
|
|
865
|
-
...getRegion$
|
|
865
|
+
...getRegion$1(region, isNaturalPerson),
|
|
866
866
|
...getEmail(email, isNaturalPerson),
|
|
867
867
|
...getPhone(phone),
|
|
868
868
|
...getFormatDate(desiredMeetingDate, 'desiredMeetingDate'),
|
|
@@ -900,7 +900,7 @@
|
|
|
900
900
|
}
|
|
901
901
|
const getPhone = (phone) => (phone ? { phone: formatPhone(phone) } : {});
|
|
902
902
|
const getFormatDate = (date, key = 'birthday') => date ? { [key]: formatDate(date) } : {};
|
|
903
|
-
const getRegion$
|
|
903
|
+
const getRegion$1 = (region, isNaturalPerson = true) => ({
|
|
904
904
|
[isNaturalPerson ? 'regionBranch' : 'region']: region,
|
|
905
905
|
});
|
|
906
906
|
const getEmail = (email, isNaturalPerson = true) => ({
|
|
@@ -1677,7 +1677,10 @@
|
|
|
1677
1677
|
|
|
1678
1678
|
const useLeadFormData = (typeField) => {
|
|
1679
1679
|
const { data, error } = useAsyncData(`https://portal-ui-cc.cprb.dev.rshbdev.ru/light-api-cash/v1/dictionary?dictionaryType=${typeField}`, fetchData);
|
|
1680
|
-
|
|
1680
|
+
if (data && 'errorMessage' in data) {
|
|
1681
|
+
return { error };
|
|
1682
|
+
}
|
|
1683
|
+
return { data: data, error };
|
|
1681
1684
|
};
|
|
1682
1685
|
const fetchData = async (url) => {
|
|
1683
1686
|
const result = await fetchJSON(url, { method: 'POST' });
|
|
@@ -1863,7 +1866,7 @@
|
|
|
1863
1866
|
|
|
1864
1867
|
const ConsentToReceiveMaterialsField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u0421\u043E\u0433\u043B\u0430\u0441\u0435\u043D \u043D\u0430 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u0435 \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u043E\u043D\u043D\u044B\u0445 \u0438 \u0430\u043D\u0430\u043B\u0438\u0442\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B\u043E\u0432 \u043F\u043E \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0447\u0442\u0435", ...getValidation(field('consentToReceiveMaterials'), validatorObj.consentToReceiveMaterials, input?.required) })));
|
|
1865
1868
|
|
|
1866
|
-
const DesiredMeetingDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\
|
|
1869
|
+
const DesiredMeetingDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0416\u0435\u043B\u0430\u0435\u043C\u0430\u044F \u0434\u0430\u0442\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0438", ...getValidation(field('desiredMeetingDate'), validatorObj.meetingDay, input?.required) })));
|
|
1867
1870
|
|
|
1868
1871
|
const EducationField = JSX(({ field, input }) => {
|
|
1869
1872
|
const { data: education } = useLeadFormData('EDUCATION_LEVEL');
|
|
@@ -2208,19 +2211,19 @@
|
|
|
2208
2211
|
};
|
|
2209
2212
|
|
|
2210
2213
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2211
|
-
const getFormatData
|
|
2214
|
+
const getFormatData = (data) => {
|
|
2212
2215
|
const { acquiringType, onlineCheckout, posTerminal, amount, term, annualRevenue, serviceType, vedTypes, region, ...usedData } = data;
|
|
2213
2216
|
const partnerComments = acquiringType || annualRevenue ? getPartnerComments(data) : null;
|
|
2214
2217
|
const formatData = {
|
|
2215
2218
|
...usedData,
|
|
2216
2219
|
...getVedTypes(vedTypes),
|
|
2217
|
-
...getRegion
|
|
2220
|
+
...getRegion(region),
|
|
2218
2221
|
...(partnerComments ? { partnerComments } : {}),
|
|
2219
2222
|
...(serviceType ? { typeForm: serviceType } : {}),
|
|
2220
2223
|
};
|
|
2221
2224
|
return Object.fromEntries(Object.entries(formatData)?.map(([k, v]) => [k, v?.key || v]));
|
|
2222
2225
|
};
|
|
2223
|
-
const getRegion
|
|
2226
|
+
const getRegion = (region) => region?.key || region?.text ? { region: region?.text || region?.key } : {};
|
|
2224
2227
|
const getVedTypes = (vedTypes) => vedTypes
|
|
2225
2228
|
? {
|
|
2226
2229
|
vedTypes: Object.fromEntries(VED_TYPES.map((v) => [v, v === vedTypes])),
|
|
@@ -2273,7 +2276,7 @@
|
|
|
2273
2276
|
|
|
2274
2277
|
const renderContacts = () => (jsxs("div", { className: "space-y-m", children: [jsx(Heading, { headingType: "h6", title: "\u0418\u043B\u0438 \u0441\u0432\u044F\u0436\u0438\u0442\u0435\u0441\u044C \u0441 \u043D\u0430\u043C\u0438 \u0443\u0434\u043E\u0431\u043D\u044B\u043C \u0441\u043F\u043E\u0441\u043E\u0431\u043E\u043C", className: "@xl:text-center" }), jsxs("div", { className: "flex sm:justify-center gap-xl", children: [jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", href: `tel:8 (800) 200-78-70`, "aria-label": "\u0442\u0435\u043B\u0435\u0444\u043E\u043D 8 (800) 200-78-70", children: [jsx(Img, { image: { icon: 'PhoneIcon' }, width: "24", height: "24" }), jsx("span", { children: "8 (800) 200-78-70" })] }), jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", "aria-label": "\u043F\u043E\u0447\u0442\u0430 ved@rshb.ru", href: `mailto:ved@rshb.ru`, children: [jsx(Img, { image: { icon: 'MailIcon' }, width: "24", height: "24" }), jsx("span", { children: "ved@rshb.ru" })] })] })] }));
|
|
2275
2278
|
|
|
2276
|
-
const API
|
|
2279
|
+
const API = LeadServiceAPI();
|
|
2277
2280
|
const ApplicationForm = JSX(
|
|
2278
2281
|
// eslint-disable-next-line max-lines-per-function
|
|
2279
2282
|
({ className, title, typeForm = '', sections = [], button, link, endpoint, additionalParams, isContacts, data, ...rest }) => {
|
|
@@ -2286,8 +2289,8 @@
|
|
|
2286
2289
|
if (!isValidationSuccess(feedbackValidator(formData))) {
|
|
2287
2290
|
return 'Fail';
|
|
2288
2291
|
}
|
|
2289
|
-
const formatData = getFormatData
|
|
2290
|
-
const status = (await API
|
|
2292
|
+
const formatData = getFormatData({ ...formData, ...additionalParams });
|
|
2293
|
+
const status = (await API.send(formatData, endpoint === 'lead')) ? 'OK' : 'Fail';
|
|
2291
2294
|
setResponseType(status);
|
|
2292
2295
|
if (status) {
|
|
2293
2296
|
const responseTypeDialog = useResponseTypeDialog({ responseType: status, typeForm });
|
|
@@ -2330,16 +2333,6 @@
|
|
|
2330
2333
|
'consentToReceiveMaterials',
|
|
2331
2334
|
];
|
|
2332
2335
|
|
|
2333
|
-
const getFormatData = (data) => {
|
|
2334
|
-
const { region, ...usedData } = data;
|
|
2335
|
-
const formatData = {
|
|
2336
|
-
...usedData,
|
|
2337
|
-
...getRegion(region),
|
|
2338
|
-
};
|
|
2339
|
-
return Object.fromEntries(Object.entries(formatData)?.map(([k, v]) => [k, v?.key || v]));
|
|
2340
|
-
};
|
|
2341
|
-
const getRegion = (region) => region?.key || region?.text ? { region: region?.text || region?.key } : {};
|
|
2342
|
-
|
|
2343
2336
|
const initialFormState = {
|
|
2344
2337
|
typeForm: '',
|
|
2345
2338
|
region: { key: '', text: '' },
|
|
@@ -2439,27 +2432,280 @@
|
|
|
2439
2432
|
|
|
2440
2433
|
const renderSubmitButton = (button, className) => (jsx(Button, { className: style('w-full @xl:w-auto', className), type: "submit", children: button?.text ? button.text : 'Отправить заявку' }));
|
|
2441
2434
|
|
|
2442
|
-
const
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2435
|
+
const getAthorizationHeaders = () => {
|
|
2436
|
+
const token = sessionStorage.getItem('accessToken');
|
|
2437
|
+
return token ? { Authorization: `Bearer ${token}` } : null;
|
|
2438
|
+
};
|
|
2439
|
+
const isJSON = (response) => response.headers.get('Content-Type') === 'application/json';
|
|
2440
|
+
const request = async (url, method, body) => await fetch('https://retail-light-api.cprb.dev.rshbdev.ru/api/v1' + url, {
|
|
2441
|
+
method,
|
|
2442
|
+
headers: {
|
|
2443
|
+
'Content-Type': 'application/json',
|
|
2444
|
+
...getAthorizationHeaders(),
|
|
2445
|
+
},
|
|
2446
|
+
credentials: 'include',
|
|
2447
|
+
body: body ? JSON.stringify(body) : null,
|
|
2448
|
+
}).then((response) => (isJSON(response) ? response.json() : response));
|
|
2449
|
+
const saveToken = (data) => {
|
|
2450
|
+
sessionStorage.setItem('accessToken', data.access_token);
|
|
2451
|
+
sessionStorage.setItem('refreshToken', data.refresh_token);
|
|
2452
|
+
};
|
|
2453
|
+
const RETAIL_API = {
|
|
2454
|
+
CreateUserProfile: async (body) => await request('/public-data/createUserProfile', 'POST', body),
|
|
2455
|
+
UpdateUserProfile: async (body) => await request('/user-data/updateUserProfile', 'PUT', body),
|
|
2456
|
+
CreateDraftTask: async (body) => await request('/user-data/createDraftTask', 'POST', body),
|
|
2457
|
+
UpdateUserTask: async (body) => await request('/user-data/updateUserTask', 'PUT', body),
|
|
2458
|
+
SendCode: async (body) => await request('/sms/sendCode', 'POST', body),
|
|
2459
|
+
CheckCode: async (body) => await request('/sms/checkCode', 'POST', body).then(saveToken),
|
|
2460
|
+
};
|
|
2461
|
+
|
|
2462
|
+
const getUpdateUserProfileData = (profileId, formData) => {
|
|
2463
|
+
const { name = '', surname = '', middleName = '', birthday = '', phone = '', email = '', processPersonalDataLeadFlg, consentProviderFlg, consentPfrFlg, consentPhotoFlg, consentAssignmentClaimsFlg, consentCollectionFlg, consentInformFlg, } = formData;
|
|
2464
|
+
return {
|
|
2465
|
+
profile: {
|
|
2466
|
+
id: profileId,
|
|
2467
|
+
name,
|
|
2468
|
+
surname,
|
|
2469
|
+
midname: middleName,
|
|
2470
|
+
birthDate: birthday && formatDate(birthday, true),
|
|
2471
|
+
email,
|
|
2472
|
+
phone: formatPhone(phone),
|
|
2473
|
+
processPersonalDataLeadFlg: Boolean(processPersonalDataLeadFlg),
|
|
2474
|
+
consentProviderFlg: Boolean(consentProviderFlg),
|
|
2475
|
+
consentPfrFlg: Boolean(consentPfrFlg),
|
|
2476
|
+
consentPhotoFlg: Boolean(consentPhotoFlg),
|
|
2477
|
+
consentAssignmentClaimsFlg: Boolean(consentAssignmentClaimsFlg),
|
|
2478
|
+
consentCollectionFlg: Boolean(consentCollectionFlg),
|
|
2479
|
+
consentInformFlg: Boolean(consentInformFlg),
|
|
2480
|
+
},
|
|
2481
|
+
};
|
|
2482
|
+
};
|
|
2483
|
+
|
|
2484
|
+
/* eslint-disable max-params */
|
|
2485
|
+
const getUpdateUserTaskData = (participantId, taskId, profileId, formatData) => ({
|
|
2486
|
+
sendToBank: true,
|
|
2487
|
+
taskKind: 'SHORT',
|
|
2488
|
+
task: {
|
|
2489
|
+
taskSource: globalThis.location.origin,
|
|
2490
|
+
id: taskId,
|
|
2491
|
+
participants: [
|
|
2492
|
+
{
|
|
2493
|
+
birthDate: formatData?.birthDate,
|
|
2494
|
+
id: participantId,
|
|
2495
|
+
midname: formatData?.midname,
|
|
2496
|
+
name: formatData?.name,
|
|
2497
|
+
surname: formatData?.surname,
|
|
2498
|
+
profile: {
|
|
2499
|
+
id: profileId,
|
|
2500
|
+
},
|
|
2501
|
+
participantContacts: [
|
|
2502
|
+
{
|
|
2503
|
+
contactTypeCd: {
|
|
2504
|
+
key: 'EMAIL',
|
|
2505
|
+
},
|
|
2506
|
+
value: formatData?.email,
|
|
2507
|
+
},
|
|
2508
|
+
{
|
|
2509
|
+
contactTypeCd: {
|
|
2510
|
+
key: 'MAIN_PHONE',
|
|
2511
|
+
},
|
|
2512
|
+
value: formatData?.phone,
|
|
2513
|
+
},
|
|
2514
|
+
],
|
|
2515
|
+
roleCd: {
|
|
2516
|
+
key: 'BORROWER',
|
|
2517
|
+
value: 'Заемщик',
|
|
2518
|
+
},
|
|
2519
|
+
},
|
|
2520
|
+
],
|
|
2521
|
+
},
|
|
2522
|
+
});
|
|
2523
|
+
|
|
2524
|
+
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, {
|
|
2525
|
+
'backdrop-blur': blur,
|
|
2526
|
+
}), 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" }) })));
|
|
2527
|
+
|
|
2528
|
+
const Timer = JSX(({ time, setTime, className }) => {
|
|
2529
|
+
useEffect(() => {
|
|
2530
|
+
const timer = setInterval(() => {
|
|
2531
|
+
setTime(time - 1);
|
|
2532
|
+
}, 1000);
|
|
2533
|
+
if (time === 0) {
|
|
2534
|
+
clearInterval(timer);
|
|
2535
|
+
}
|
|
2536
|
+
return () => {
|
|
2537
|
+
clearInterval(timer);
|
|
2538
|
+
};
|
|
2539
|
+
}, [time]);
|
|
2540
|
+
return jsx("span", { className: className, children: secondsToMinSecPadded(time) });
|
|
2541
|
+
});
|
|
2542
|
+
const secondsToMinSecPadded = (time) => {
|
|
2543
|
+
const minutes = `${Math.floor(time / 60)}`.padStart(2, '0');
|
|
2544
|
+
const seconds = `${time % 60}`.padStart(2, '0');
|
|
2545
|
+
return `${minutes}:${seconds}`;
|
|
2546
|
+
};
|
|
2547
|
+
|
|
2548
|
+
const InputCode = JSX(({ values, setValues, hasError }) => {
|
|
2549
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
2550
|
+
const inputRefs = useRef([]);
|
|
2551
|
+
useEffect(() => {
|
|
2552
|
+
inputRefs.current?.[activeIndex]?.focus();
|
|
2553
|
+
}, [activeIndex]);
|
|
2554
|
+
const handleChange = useCallback((index) => (event) => {
|
|
2555
|
+
const { value } = event.currentTarget;
|
|
2556
|
+
const isLastIndex = index === values.length - 1;
|
|
2557
|
+
const isMultipleCharacters = value.length > 1;
|
|
2558
|
+
if (isLastIndex && isMultipleCharacters) {
|
|
2559
|
+
return;
|
|
2560
|
+
}
|
|
2561
|
+
setValues(values.map((_, i) => (i === index ? value : _)));
|
|
2562
|
+
setActiveIndex(index + 1);
|
|
2563
|
+
}, [values]);
|
|
2564
|
+
const handleKeyDown = useCallback((currentIndex) => (event) => {
|
|
2565
|
+
const { key } = event;
|
|
2566
|
+
if (key === 'Backspace' && !values[currentIndex]) {
|
|
2567
|
+
const previousIndex = currentIndex > 0 ? currentIndex - 1 : values.length - 1;
|
|
2568
|
+
const updatedValues = values.map((value, index) => (index === previousIndex ? '' : value));
|
|
2569
|
+
setValues(updatedValues);
|
|
2570
|
+
setActiveIndex(previousIndex);
|
|
2571
|
+
}
|
|
2572
|
+
}, [values]);
|
|
2573
|
+
const handlePaste = useCallback((event) => {
|
|
2574
|
+
event.preventDefault();
|
|
2575
|
+
const pastedData = event.clipboardData.getData('text');
|
|
2576
|
+
const updatedValues = values.map((_, idx) => (idx < pastedData.length ? pastedData[idx] : _));
|
|
2577
|
+
setValues(updatedValues);
|
|
2578
|
+
setActiveIndex(updatedValues.length - 1);
|
|
2579
|
+
}, [values]);
|
|
2580
|
+
return (jsxs("div", { className: "flex flex-col gap-2 text-center", children: [jsx("div", { children: values.map((value, index) => (jsx("input", { type: "number", maxLength: 1, value: value, onChange: handleChange(index), onPaste: handlePaste, ref: (ref) => {
|
|
2581
|
+
if (!inputRefs.current) {
|
|
2582
|
+
inputRefs.current = [];
|
|
2583
|
+
}
|
|
2584
|
+
inputRefs.current[index] = ref;
|
|
2585
|
+
}, onFocus: (event) => event.target.select(), onKeyDown: handleKeyDown(index), className: getInputStyle(index, values, hasError) }, index))) }), hasError ? jsx("div", { className: "text-error", children: "\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043E\u0434" }) : null] }));
|
|
2586
|
+
});
|
|
2587
|
+
const getInputStyle = (index, values, hasError = false) => {
|
|
2588
|
+
const isInputEmpty = !values[index];
|
|
2589
|
+
return `w-16 h-20 text-3xl text-center p-2 m-2 border ${hasError && isInputEmpty ? 'border-error' : 'border-gray'} rounded-md caret-transparent outline-none`;
|
|
2590
|
+
};
|
|
2591
|
+
|
|
2592
|
+
const SubmitButton = JSX(({ isDisabled, onClick, text }) => {
|
|
2593
|
+
return (jsx(Button, { type: "button", onClick: onClick, disabled: isDisabled, children: jsx(Text, { font: "font-medium", children: text }) }));
|
|
2594
|
+
});
|
|
2595
|
+
|
|
2596
|
+
const VerifyPhoneDialog = JSX(({ title, phone, description, __html, code = true, codeLength = 4, textButton = '', onClose, }) => {
|
|
2597
|
+
const { close } = useDialogManager();
|
|
2598
|
+
const [values, setValues] = useState(Array(codeLength).fill(''));
|
|
2599
|
+
const [hasError, setHasError] = useState(false);
|
|
2600
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
2601
|
+
const [timeNextReq, setTimeNextReq] = useState(180);
|
|
2602
|
+
const isValidCode = useMemo(() => values.every(Boolean), [values]);
|
|
2603
|
+
useEffect(() => {
|
|
2604
|
+
RETAIL_API.SendCode({
|
|
2605
|
+
phoneNumber: phone,
|
|
2606
|
+
smsCodesSetName: { key: 'AUTHENTICATION' },
|
|
2607
|
+
});
|
|
2608
|
+
}, []);
|
|
2609
|
+
const handleSubmit = useCallback(async () => {
|
|
2610
|
+
try {
|
|
2611
|
+
setIsLoading(true);
|
|
2612
|
+
await RETAIL_API.CheckCode({
|
|
2613
|
+
smsText: values.join(''),
|
|
2614
|
+
smsCodesSetName: { key: 'AUTHENTICATION' },
|
|
2615
|
+
});
|
|
2616
|
+
close();
|
|
2617
|
+
onClose && onClose();
|
|
2618
|
+
}
|
|
2619
|
+
catch {
|
|
2620
|
+
setIsLoading(false);
|
|
2621
|
+
setHasError(true);
|
|
2622
|
+
}
|
|
2623
|
+
}, [values]);
|
|
2624
|
+
return (jsx(Dialog, { className: "my-6xl max-w-3xl w-full min-h-fit mx-auto rounded-lg", children: jsxs("div", { className: "flex flex-col gap-lg items-center rounded-md", children: [jsx(Headline, { className: "w-full", title: title, description: description, headlineVersion: "S", isEmbedded: true }), code ? jsx(InputCode, { values: values, setValues: setValues, hasError: hasError }) : null, timeNextReq ? (jsxs("div", { className: "flex flex-row text-l font-light text-primary-main", children: ["\u041F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u043D\u043E\u0432\u044B\u0439 \u043A\u043E\u0434 \u043C\u043E\u0436\u043D\u043E \u0447\u0435\u0440\u0435\u0437", jsx(Timer, { className: "text-primary-main ml-1", time: timeNextReq, setTime: setTimeNextReq })] })) : (jsx(LinkButton, { className: "text-primary-main", children: "\u041F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u043D\u043E\u0432\u044B\u0439 \u043A\u043E\u0434" })), jsx(RichText, { itemSize: "list-s", __html: __html }), textButton ? (jsx(SubmitButton, { isDisabled: !isValidCode, onClick: handleSubmit, text: textButton })) : null, isLoading ? jsx(Loader, { blur: false }) : null] }) }));
|
|
2625
|
+
});
|
|
2626
|
+
|
|
2627
|
+
const useVerifyPhoneDialog = (props) => {
|
|
2628
|
+
const { open, close } = useDialogManager();
|
|
2629
|
+
return {
|
|
2630
|
+
open: (options = {}) => open(jsx(VerifyPhoneDialog, { ...props }), options),
|
|
2631
|
+
close,
|
|
2632
|
+
};
|
|
2633
|
+
};
|
|
2634
|
+
|
|
2635
|
+
const useApplicationLeadApi = (inputs, programId) => {
|
|
2636
|
+
const [responseStatus, setResponseStatus] = useState('');
|
|
2637
|
+
// eslint-disable-next-line consistent-return
|
|
2449
2638
|
const handleSubmit = useCallback(async (formData) => {
|
|
2450
2639
|
const feedbackValidator = objectValidator(getObjectValidator(inputs));
|
|
2451
2640
|
if (!isValidationSuccess(feedbackValidator(formData))) {
|
|
2452
2641
|
return 'Fail';
|
|
2453
2642
|
}
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
const
|
|
2459
|
-
|
|
2643
|
+
try {
|
|
2644
|
+
const { profile } = await RETAIL_API.CreateUserProfile({
|
|
2645
|
+
profile: { phone: formatPhone(formData.phone) },
|
|
2646
|
+
});
|
|
2647
|
+
const profileId = profile?.id;
|
|
2648
|
+
if (profileId && formData?.phone) {
|
|
2649
|
+
const handleSuccessVerify = async () => {
|
|
2650
|
+
try {
|
|
2651
|
+
await RETAIL_API.UpdateUserProfile(getUpdateUserProfileData(profileId, formData));
|
|
2652
|
+
const { taskId, participantId } = await RETAIL_API.CreateDraftTask({
|
|
2653
|
+
profileId,
|
|
2654
|
+
programId,
|
|
2655
|
+
});
|
|
2656
|
+
await RETAIL_API.UpdateUserTask(getUpdateUserTaskData(participantId, taskId, profileId, formData));
|
|
2657
|
+
setResponseStatus('OK');
|
|
2658
|
+
}
|
|
2659
|
+
catch {
|
|
2660
|
+
setResponseStatus('Fail');
|
|
2661
|
+
}
|
|
2662
|
+
};
|
|
2663
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
2664
|
+
const verifyPhoneDialog = useVerifyPhoneDialog({
|
|
2665
|
+
onClose: handleSuccessVerify,
|
|
2666
|
+
...verifyPhoneContent(formData?.phone),
|
|
2667
|
+
});
|
|
2668
|
+
verifyPhoneDialog.open();
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
catch {
|
|
2672
|
+
setResponseStatus('Fail');
|
|
2460
2673
|
}
|
|
2461
|
-
return status;
|
|
2462
2674
|
}, []);
|
|
2675
|
+
return {
|
|
2676
|
+
handleSubmit,
|
|
2677
|
+
responseStatus,
|
|
2678
|
+
};
|
|
2679
|
+
};
|
|
2680
|
+
const verifyPhoneContent = (phone) => ({
|
|
2681
|
+
title: 'Подтвердите номер телефона',
|
|
2682
|
+
description: `Мы отправили код на ${phone}`,
|
|
2683
|
+
phone: formatPhone(phone),
|
|
2684
|
+
textButton: 'Оформить',
|
|
2685
|
+
__html: `<span>Вводя код, я подтверждаю, что ознакомлен и подписываю:</span>
|
|
2686
|
+
<ul><li>соглашение о порядке использования простой электронной подписи,
|
|
2687
|
+
</li><li>согласие на обработку персональных данных,
|
|
2688
|
+
</li><li>предоставление и подписание прочих согласий Банка,
|
|
2689
|
+
</li><li>согласие на запрос в ПФР</li></ul>`,
|
|
2690
|
+
});
|
|
2691
|
+
|
|
2692
|
+
const useInitApplicationLead = () => {
|
|
2693
|
+
useEffect(() => {
|
|
2694
|
+
sessionStorage.removeItem('accessToken');
|
|
2695
|
+
sessionStorage.removeItem('refreshToken');
|
|
2696
|
+
}, []);
|
|
2697
|
+
};
|
|
2698
|
+
|
|
2699
|
+
const ApplicationLeadForm = JSX(({ className, title, programId, typeForm = '', sections = [], button, ...rest }) => {
|
|
2700
|
+
const inputs = (sections?.flatMap((_) => _?.inputs) || []);
|
|
2701
|
+
const initialFormState = getInitialFormState(inputs, typeForm);
|
|
2702
|
+
const [responseType, setResponseType] = useState('');
|
|
2703
|
+
useInitApplicationLead();
|
|
2704
|
+
const { handleSubmit, responseStatus } = useApplicationLeadApi(inputs, programId || '');
|
|
2705
|
+
if (responseStatus) {
|
|
2706
|
+
const responseTypeDialog = useResponseTypeDialog({ responseType: responseStatus, typeForm });
|
|
2707
|
+
responseTypeDialog.open();
|
|
2708
|
+
}
|
|
2463
2709
|
const [, { field, onSubmit, reset }] = useForm(initialFormState, { onSubmit: handleSubmit });
|
|
2464
2710
|
useEffect(() => {
|
|
2465
2711
|
if (responseType === 'OK') {
|
|
@@ -5565,10 +5811,6 @@
|
|
|
5565
5811
|
const isClient = !isSSR();
|
|
5566
5812
|
const ClientOnly = JSX(({ children }) => (isClient ? children : null));
|
|
5567
5813
|
|
|
5568
|
-
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, {
|
|
5569
|
-
'backdrop-blur': blur,
|
|
5570
|
-
}), 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" }) })));
|
|
5571
|
-
|
|
5572
5814
|
const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
|
|
5573
5815
|
const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
|
|
5574
5816
|
function renderClusterer({ yandexMaps, map, points, isLoad, }) {
|
|
@@ -6941,7 +7183,7 @@
|
|
|
6941
7183
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
6942
7184
|
});
|
|
6943
7185
|
|
|
6944
|
-
const packageVersion = "0.14.
|
|
7186
|
+
const packageVersion = "0.14.581";
|
|
6945
7187
|
|
|
6946
7188
|
exports.Blocks = Blocks;
|
|
6947
7189
|
exports.ContentPage = ContentPage;
|