@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.
Files changed (196) hide show
  1. package/bundle/api/RetailApi/RetailApi.d.ts +9 -0
  2. package/bundle/api/RetailApi/RetailApiTypes.d.ts +83 -0
  3. package/bundle/api/RetailApi/utils/getUpdateUserProfile.d.ts +3 -0
  4. package/bundle/api/RetailApi/utils/getUpdateUserTask.d.ts +2 -0
  5. package/bundle/blocks.schema.json +1 -1
  6. package/bundle/bundle.umd.js +281 -39
  7. package/bundle/bundle.umd.min.js +1 -1
  8. package/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +2 -0
  9. package/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +6 -0
  10. package/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
  11. package/bundle/hooks/useLeadFormData.d.ts +4 -1
  12. package/bundle/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +2 -0
  13. package/dist/api/RetailApi/RetailApi.d.ts +9 -0
  14. package/dist/api/RetailApi/RetailApi.js +29 -0
  15. package/dist/api/RetailApi/RetailApi.js.map +1 -0
  16. package/dist/api/RetailApi/RetailApiTypes.d.ts +83 -0
  17. package/dist/api/RetailApi/RetailApiTypes.js +2 -0
  18. package/dist/api/RetailApi/RetailApiTypes.js.map +1 -0
  19. package/dist/api/RetailApi/utils/getUpdateUserProfile.d.ts +3 -0
  20. package/dist/api/RetailApi/utils/getUpdateUserProfile.js +27 -0
  21. package/dist/api/RetailApi/utils/getUpdateUserProfile.js.map +1 -0
  22. package/dist/api/RetailApi/utils/getUpdateUserTask.d.ts +2 -0
  23. package/dist/api/RetailApi/utils/getUpdateUserTask.js +43 -0
  24. package/dist/api/RetailApi/utils/getUpdateUserTask.js.map +1 -0
  25. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +9 -23
  26. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  27. package/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +2 -0
  28. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +6 -0
  29. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +69 -0
  30. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -0
  31. package/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
  32. package/dist/components/ApplicationLeadForm/useInitApplicationLead.js +11 -0
  33. package/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -0
  34. package/dist/hooks/useLeadFormData.d.ts +4 -1
  35. package/dist/hooks/useLeadFormData.js +4 -1
  36. package/dist/hooks/useLeadFormData.js.map +1 -1
  37. package/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
  38. package/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
  39. package/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +2 -0
  40. package/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js +19 -11
  41. package/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  42. package/lib/api/RetailApi/RetailApi.d.ts +9 -0
  43. package/lib/api/RetailApi/RetailApi.js +27 -0
  44. package/lib/api/RetailApi/RetailApi.js.map +1 -0
  45. package/lib/api/RetailApi/RetailApiTypes.d.ts +83 -0
  46. package/lib/api/RetailApi/RetailApiTypes.js +2 -0
  47. package/lib/api/RetailApi/RetailApiTypes.js.map +1 -0
  48. package/lib/api/RetailApi/utils/getUpdateUserProfile.d.ts +3 -0
  49. package/lib/api/RetailApi/utils/getUpdateUserProfile.js +24 -0
  50. package/lib/api/RetailApi/utils/getUpdateUserProfile.js.map +1 -0
  51. package/lib/api/RetailApi/utils/getUpdateUserTask.d.ts +2 -0
  52. package/lib/api/RetailApi/utils/getUpdateUserTask.js +40 -0
  53. package/lib/api/RetailApi/utils/getUpdateUserTask.js.map +1 -0
  54. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +10 -24
  55. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  56. package/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +2 -0
  57. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +6 -0
  58. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +66 -0
  59. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -0
  60. package/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
  61. package/lib/components/ApplicationLeadForm/useInitApplicationLead.js +8 -0
  62. package/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -0
  63. package/lib/hooks/useLeadFormData.d.ts +4 -1
  64. package/lib/hooks/useLeadFormData.js +4 -1
  65. package/lib/hooks/useLeadFormData.js.map +1 -1
  66. package/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
  67. package/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
  68. package/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +2 -0
  69. package/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js +19 -11
  70. package/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  71. package/mobile/bundle/api/RetailApi/RetailApi.d.ts +9 -0
  72. package/mobile/bundle/api/RetailApi/RetailApiTypes.d.ts +83 -0
  73. package/mobile/bundle/api/RetailApi/utils/getUpdateUserProfile.d.ts +3 -0
  74. package/mobile/bundle/api/RetailApi/utils/getUpdateUserTask.d.ts +2 -0
  75. package/mobile/bundle/bundle.umd.js +281 -39
  76. package/mobile/bundle/bundle.umd.min.js +1 -1
  77. package/mobile/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +2 -0
  78. package/mobile/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +6 -0
  79. package/mobile/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
  80. package/mobile/bundle/hooks/useLeadFormData.d.ts +4 -1
  81. package/mobile/bundle/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +2 -0
  82. package/mobile/dist/api/RetailApi/RetailApi.d.ts +9 -0
  83. package/mobile/dist/api/RetailApi/RetailApi.js +29 -0
  84. package/mobile/dist/api/RetailApi/RetailApi.js.map +1 -0
  85. package/mobile/dist/api/RetailApi/RetailApiTypes.d.ts +83 -0
  86. package/mobile/dist/api/RetailApi/RetailApiTypes.js +2 -0
  87. package/mobile/dist/api/RetailApi/RetailApiTypes.js.map +1 -0
  88. package/mobile/dist/api/RetailApi/utils/getUpdateUserProfile.d.ts +3 -0
  89. package/mobile/dist/api/RetailApi/utils/getUpdateUserProfile.js +27 -0
  90. package/mobile/dist/api/RetailApi/utils/getUpdateUserProfile.js.map +1 -0
  91. package/mobile/dist/api/RetailApi/utils/getUpdateUserTask.d.ts +2 -0
  92. package/mobile/dist/api/RetailApi/utils/getUpdateUserTask.js +43 -0
  93. package/mobile/dist/api/RetailApi/utils/getUpdateUserTask.js.map +1 -0
  94. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +9 -23
  95. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  96. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +2 -0
  97. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +6 -0
  98. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +69 -0
  99. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -0
  100. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
  101. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js +11 -0
  102. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -0
  103. package/mobile/dist/hooks/useLeadFormData.d.ts +4 -1
  104. package/mobile/dist/hooks/useLeadFormData.js +4 -1
  105. package/mobile/dist/hooks/useLeadFormData.js.map +1 -1
  106. package/mobile/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
  107. package/mobile/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
  108. package/mobile/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +2 -0
  109. package/mobile/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js +19 -11
  110. package/mobile/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  111. package/mobile/lib/api/RetailApi/RetailApi.d.ts +9 -0
  112. package/mobile/lib/api/RetailApi/RetailApi.js +27 -0
  113. package/mobile/lib/api/RetailApi/RetailApi.js.map +1 -0
  114. package/mobile/lib/api/RetailApi/RetailApiTypes.d.ts +83 -0
  115. package/mobile/lib/api/RetailApi/RetailApiTypes.js +2 -0
  116. package/mobile/lib/api/RetailApi/RetailApiTypes.js.map +1 -0
  117. package/mobile/lib/api/RetailApi/utils/getUpdateUserProfile.d.ts +3 -0
  118. package/mobile/lib/api/RetailApi/utils/getUpdateUserProfile.js +24 -0
  119. package/mobile/lib/api/RetailApi/utils/getUpdateUserProfile.js.map +1 -0
  120. package/mobile/lib/api/RetailApi/utils/getUpdateUserTask.d.ts +2 -0
  121. package/mobile/lib/api/RetailApi/utils/getUpdateUserTask.js +40 -0
  122. package/mobile/lib/api/RetailApi/utils/getUpdateUserTask.js.map +1 -0
  123. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +10 -24
  124. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  125. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +2 -0
  126. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +6 -0
  127. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +66 -0
  128. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -0
  129. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
  130. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js +8 -0
  131. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -0
  132. package/mobile/lib/hooks/useLeadFormData.d.ts +4 -1
  133. package/mobile/lib/hooks/useLeadFormData.js +4 -1
  134. package/mobile/lib/hooks/useLeadFormData.js.map +1 -1
  135. package/mobile/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
  136. package/mobile/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
  137. package/mobile/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +2 -0
  138. package/mobile/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js +19 -11
  139. package/mobile/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  140. package/mobile/src/api/RetailApi/RetailApi.ts +51 -0
  141. package/mobile/src/api/RetailApi/RetailApiTypes.ts +91 -0
  142. package/mobile/src/api/RetailApi/utils/getUpdateUserProfile.ts +44 -0
  143. package/mobile/src/api/RetailApi/utils/getUpdateUserTask.ts +46 -0
  144. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +11 -26
  145. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +2 -0
  146. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +74 -0
  147. package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +8 -0
  148. package/mobile/src/hooks/useLeadFormData.ts +10 -3
  149. package/mobile/src/ui-kit/FormField/Fields/DesiredMeetingDateField.tsx +2 -2
  150. package/mobile/src/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.tsx +32 -14
  151. package/package.json +2 -2
  152. package/src/api/RetailApi/RetailApi.ts +51 -0
  153. package/src/api/RetailApi/RetailApiTypes.ts +91 -0
  154. package/src/api/RetailApi/utils/getUpdateUserProfile.ts +44 -0
  155. package/src/api/RetailApi/utils/getUpdateUserTask.ts +46 -0
  156. package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.tsx +1 -0
  157. package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +11 -26
  158. package/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +2 -0
  159. package/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +74 -0
  160. package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +8 -0
  161. package/src/hooks/useLeadFormData.ts +10 -3
  162. package/src/ui-kit/FormField/Fields/DesiredMeetingDateField.tsx +2 -2
  163. package/src/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.fixture.tsx +5 -4
  164. package/src/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.tsx +32 -14
  165. package/bundle/components/ApplicationLeadForm/getFormatData.d.ts +0 -2
  166. package/bundle/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.d.ts +0 -13
  167. package/dist/components/ApplicationLeadForm/getFormatData.d.ts +0 -2
  168. package/dist/components/ApplicationLeadForm/getFormatData.js +0 -13
  169. package/dist/components/ApplicationLeadForm/getFormatData.js.map +0 -1
  170. package/dist/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.d.ts +0 -13
  171. package/dist/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js +0 -30
  172. package/dist/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js.map +0 -1
  173. package/lib/components/ApplicationLeadForm/getFormatData.d.ts +0 -2
  174. package/lib/components/ApplicationLeadForm/getFormatData.js +0 -10
  175. package/lib/components/ApplicationLeadForm/getFormatData.js.map +0 -1
  176. package/lib/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.d.ts +0 -13
  177. package/lib/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js +0 -27
  178. package/lib/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js.map +0 -1
  179. package/mobile/bundle/components/ApplicationLeadForm/getFormatData.d.ts +0 -2
  180. package/mobile/bundle/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.d.ts +0 -13
  181. package/mobile/dist/components/ApplicationLeadForm/getFormatData.d.ts +0 -2
  182. package/mobile/dist/components/ApplicationLeadForm/getFormatData.js +0 -13
  183. package/mobile/dist/components/ApplicationLeadForm/getFormatData.js.map +0 -1
  184. package/mobile/dist/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.d.ts +0 -13
  185. package/mobile/dist/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js +0 -30
  186. package/mobile/dist/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js.map +0 -1
  187. package/mobile/lib/components/ApplicationLeadForm/getFormatData.d.ts +0 -2
  188. package/mobile/lib/components/ApplicationLeadForm/getFormatData.js +0 -10
  189. package/mobile/lib/components/ApplicationLeadForm/getFormatData.js.map +0 -1
  190. package/mobile/lib/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.d.ts +0 -13
  191. package/mobile/lib/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js +0 -27
  192. package/mobile/lib/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.js.map +0 -1
  193. package/mobile/src/components/ApplicationLeadForm/getFormatData.tsx +0 -17
  194. package/mobile/src/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.tsx +0 -36
  195. package/src/components/ApplicationLeadForm/getFormatData.tsx +0 -17
  196. package/src/ui-kit/VerifyPhoneDialog/submitVerifyPhoneForm.tsx +0 -36
@@ -870,7 +870,7 @@
870
870
  const url = isNaturalPerson ? '/api/v1/lead' : '/api/v1/sendcorporatelead';
871
871
  const submitBody = {
872
872
  typeForm,
873
- ...getRegion$2(region, isNaturalPerson),
873
+ ...getRegion$1(region, isNaturalPerson),
874
874
  ...getEmail(email, isNaturalPerson),
875
875
  ...getPhone(phone),
876
876
  ...getFormatDate(desiredMeetingDate, 'desiredMeetingDate'),
@@ -908,7 +908,7 @@
908
908
  }
909
909
  const getPhone = (phone) => (phone ? { phone: formatPhone(phone) } : {});
910
910
  const getFormatDate = (date, key = 'birthday') => date ? { [key]: formatDate(date) } : {};
911
- const getRegion$2 = (region, isNaturalPerson = true) => ({
911
+ const getRegion$1 = (region, isNaturalPerson = true) => ({
912
912
  [isNaturalPerson ? 'regionBranch' : 'region']: region,
913
913
  });
914
914
  const getEmail = (email, isNaturalPerson = true) => ({
@@ -1685,7 +1685,10 @@
1685
1685
 
1686
1686
  const useLeadFormData = (typeField) => {
1687
1687
  const { data, error } = useAsyncData(`https://portal-ui-cc.cprb.dev.rshbdev.ru/light-api-cash/v1/dictionary?dictionaryType=${typeField}`, fetchData);
1688
- return { data, error };
1688
+ if (data && 'errorMessage' in data) {
1689
+ return { error };
1690
+ }
1691
+ return { data: data, error };
1689
1692
  };
1690
1693
  const fetchData = async (url) => {
1691
1694
  const result = await fetchJSON(url, { method: 'POST' });
@@ -1871,7 +1874,7 @@
1871
1874
 
1872
1875
  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) })));
1873
1876
 
1874
- const DesiredMeetingDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field('birthday'), validatorObj.birthday, input?.required) })));
1877
+ 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) })));
1875
1878
 
1876
1879
  const EducationField = JSX(({ field, input }) => {
1877
1880
  const { data: education } = useLeadFormData('EDUCATION_LEVEL');
@@ -2216,19 +2219,19 @@
2216
2219
  };
2217
2220
 
2218
2221
  /* eslint-disable @typescript-eslint/no-unused-vars */
2219
- const getFormatData$1 = (data) => {
2222
+ const getFormatData = (data) => {
2220
2223
  const { acquiringType, onlineCheckout, posTerminal, amount, term, annualRevenue, serviceType, vedTypes, region, ...usedData } = data;
2221
2224
  const partnerComments = acquiringType || annualRevenue ? getPartnerComments(data) : null;
2222
2225
  const formatData = {
2223
2226
  ...usedData,
2224
2227
  ...getVedTypes(vedTypes),
2225
- ...getRegion$1(region),
2228
+ ...getRegion(region),
2226
2229
  ...(partnerComments ? { partnerComments } : {}),
2227
2230
  ...(serviceType ? { typeForm: serviceType } : {}),
2228
2231
  };
2229
2232
  return Object.fromEntries(Object.entries(formatData)?.map(([k, v]) => [k, v?.key || v]));
2230
2233
  };
2231
- const getRegion$1 = (region) => region?.key || region?.text ? { region: region?.text || region?.key } : {};
2234
+ const getRegion = (region) => region?.key || region?.text ? { region: region?.text || region?.key } : {};
2232
2235
  const getVedTypes = (vedTypes) => vedTypes
2233
2236
  ? {
2234
2237
  vedTypes: Object.fromEntries(VED_TYPES.map((v) => [v, v === vedTypes])),
@@ -2281,7 +2284,7 @@
2281
2284
 
2282
2285
  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" })] })] })] }));
2283
2286
 
2284
- const API$1 = LeadServiceAPI();
2287
+ const API = LeadServiceAPI();
2285
2288
  const ApplicationForm = JSX(
2286
2289
  // eslint-disable-next-line max-lines-per-function
2287
2290
  ({ className, title, typeForm = '', sections = [], button, link, endpoint, additionalParams, isContacts, data, ...rest }) => {
@@ -2294,8 +2297,8 @@
2294
2297
  if (!isValidationSuccess(feedbackValidator(formData))) {
2295
2298
  return 'Fail';
2296
2299
  }
2297
- const formatData = getFormatData$1({ ...formData, ...additionalParams });
2298
- const status = (await API$1.send(formatData, endpoint === 'lead')) ? 'OK' : 'Fail';
2300
+ const formatData = getFormatData({ ...formData, ...additionalParams });
2301
+ const status = (await API.send(formatData, endpoint === 'lead')) ? 'OK' : 'Fail';
2299
2302
  setResponseType(status);
2300
2303
  if (status) {
2301
2304
  const responseTypeDialog = useResponseTypeDialog({ responseType: status, typeForm });
@@ -2338,16 +2341,6 @@
2338
2341
  'consentToReceiveMaterials',
2339
2342
  ];
2340
2343
 
2341
- const getFormatData = (data) => {
2342
- const { region, ...usedData } = data;
2343
- const formatData = {
2344
- ...usedData,
2345
- ...getRegion(region),
2346
- };
2347
- return Object.fromEntries(Object.entries(formatData)?.map(([k, v]) => [k, v?.key || v]));
2348
- };
2349
- const getRegion = (region) => region?.key || region?.text ? { region: region?.text || region?.key } : {};
2350
-
2351
2344
  const initialFormState = {
2352
2345
  typeForm: '',
2353
2346
  region: { key: '', text: '' },
@@ -2447,27 +2440,280 @@
2447
2440
 
2448
2441
  const renderSubmitButton = (button, className) => (jsx(Button, { className: style('w-full @xl:w-auto', className), type: "submit", children: button?.text ? button.text : 'Отправить заявку' }));
2449
2442
 
2450
- const API = LeadServiceAPI();
2451
- const ApplicationLeadForm = JSX(
2452
- // eslint-disable-next-line max-lines-per-function
2453
- ({ className, title, typeForm = '', sections = [], button, endpoint, ...rest }) => {
2454
- const inputs = (sections?.flatMap((_) => _?.inputs) || []);
2455
- const initialFormState = getInitialFormState(inputs, typeForm);
2456
- const [responseType, setResponseType] = useState('');
2443
+ const getAthorizationHeaders = () => {
2444
+ const token = sessionStorage.getItem('accessToken');
2445
+ return token ? { Authorization: `Bearer ${token}` } : null;
2446
+ };
2447
+ const isJSON = (response) => response.headers.get('Content-Type') === 'application/json';
2448
+ const request = async (url, method, body) => await fetch('https://retail-light-api.cprb.dev.rshbdev.ru/api/v1' + url, {
2449
+ method,
2450
+ headers: {
2451
+ 'Content-Type': 'application/json',
2452
+ ...getAthorizationHeaders(),
2453
+ },
2454
+ credentials: 'include',
2455
+ body: body ? JSON.stringify(body) : null,
2456
+ }).then((response) => (isJSON(response) ? response.json() : response));
2457
+ const saveToken = (data) => {
2458
+ sessionStorage.setItem('accessToken', data.access_token);
2459
+ sessionStorage.setItem('refreshToken', data.refresh_token);
2460
+ };
2461
+ const RETAIL_API = {
2462
+ CreateUserProfile: async (body) => await request('/public-data/createUserProfile', 'POST', body),
2463
+ UpdateUserProfile: async (body) => await request('/user-data/updateUserProfile', 'PUT', body),
2464
+ CreateDraftTask: async (body) => await request('/user-data/createDraftTask', 'POST', body),
2465
+ UpdateUserTask: async (body) => await request('/user-data/updateUserTask', 'PUT', body),
2466
+ SendCode: async (body) => await request('/sms/sendCode', 'POST', body),
2467
+ CheckCode: async (body) => await request('/sms/checkCode', 'POST', body).then(saveToken),
2468
+ };
2469
+
2470
+ const getUpdateUserProfileData = (profileId, formData) => {
2471
+ const { name = '', surname = '', middleName = '', birthday = '', phone = '', email = '', processPersonalDataLeadFlg, consentProviderFlg, consentPfrFlg, consentPhotoFlg, consentAssignmentClaimsFlg, consentCollectionFlg, consentInformFlg, } = formData;
2472
+ return {
2473
+ profile: {
2474
+ id: profileId,
2475
+ name,
2476
+ surname,
2477
+ midname: middleName,
2478
+ birthDate: birthday && formatDate(birthday, true),
2479
+ email,
2480
+ phone: formatPhone(phone),
2481
+ processPersonalDataLeadFlg: Boolean(processPersonalDataLeadFlg),
2482
+ consentProviderFlg: Boolean(consentProviderFlg),
2483
+ consentPfrFlg: Boolean(consentPfrFlg),
2484
+ consentPhotoFlg: Boolean(consentPhotoFlg),
2485
+ consentAssignmentClaimsFlg: Boolean(consentAssignmentClaimsFlg),
2486
+ consentCollectionFlg: Boolean(consentCollectionFlg),
2487
+ consentInformFlg: Boolean(consentInformFlg),
2488
+ },
2489
+ };
2490
+ };
2491
+
2492
+ /* eslint-disable max-params */
2493
+ const getUpdateUserTaskData = (participantId, taskId, profileId, formatData) => ({
2494
+ sendToBank: true,
2495
+ taskKind: 'SHORT',
2496
+ task: {
2497
+ taskSource: globalThis.location.origin,
2498
+ id: taskId,
2499
+ participants: [
2500
+ {
2501
+ birthDate: formatData?.birthDate,
2502
+ id: participantId,
2503
+ midname: formatData?.midname,
2504
+ name: formatData?.name,
2505
+ surname: formatData?.surname,
2506
+ profile: {
2507
+ id: profileId,
2508
+ },
2509
+ participantContacts: [
2510
+ {
2511
+ contactTypeCd: {
2512
+ key: 'EMAIL',
2513
+ },
2514
+ value: formatData?.email,
2515
+ },
2516
+ {
2517
+ contactTypeCd: {
2518
+ key: 'MAIN_PHONE',
2519
+ },
2520
+ value: formatData?.phone,
2521
+ },
2522
+ ],
2523
+ roleCd: {
2524
+ key: 'BORROWER',
2525
+ value: 'Заемщик',
2526
+ },
2527
+ },
2528
+ ],
2529
+ },
2530
+ });
2531
+
2532
+ 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, {
2533
+ 'backdrop-blur': blur,
2534
+ }), 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" }) })));
2535
+
2536
+ const Timer = JSX(({ time, setTime, className }) => {
2537
+ useEffect(() => {
2538
+ const timer = setInterval(() => {
2539
+ setTime(time - 1);
2540
+ }, 1000);
2541
+ if (time === 0) {
2542
+ clearInterval(timer);
2543
+ }
2544
+ return () => {
2545
+ clearInterval(timer);
2546
+ };
2547
+ }, [time]);
2548
+ return jsx("span", { className: className, children: secondsToMinSecPadded(time) });
2549
+ });
2550
+ const secondsToMinSecPadded = (time) => {
2551
+ const minutes = `${Math.floor(time / 60)}`.padStart(2, '0');
2552
+ const seconds = `${time % 60}`.padStart(2, '0');
2553
+ return `${minutes}:${seconds}`;
2554
+ };
2555
+
2556
+ const InputCode = JSX(({ values, setValues, hasError }) => {
2557
+ const [activeIndex, setActiveIndex] = useState(0);
2558
+ const inputRefs = useRef([]);
2559
+ useEffect(() => {
2560
+ inputRefs.current?.[activeIndex]?.focus();
2561
+ }, [activeIndex]);
2562
+ const handleChange = useCallback((index) => (event) => {
2563
+ const { value } = event.currentTarget;
2564
+ const isLastIndex = index === values.length - 1;
2565
+ const isMultipleCharacters = value.length > 1;
2566
+ if (isLastIndex && isMultipleCharacters) {
2567
+ return;
2568
+ }
2569
+ setValues(values.map((_, i) => (i === index ? value : _)));
2570
+ setActiveIndex(index + 1);
2571
+ }, [values]);
2572
+ const handleKeyDown = useCallback((currentIndex) => (event) => {
2573
+ const { key } = event;
2574
+ if (key === 'Backspace' && !values[currentIndex]) {
2575
+ const previousIndex = currentIndex > 0 ? currentIndex - 1 : values.length - 1;
2576
+ const updatedValues = values.map((value, index) => (index === previousIndex ? '' : value));
2577
+ setValues(updatedValues);
2578
+ setActiveIndex(previousIndex);
2579
+ }
2580
+ }, [values]);
2581
+ const handlePaste = useCallback((event) => {
2582
+ event.preventDefault();
2583
+ const pastedData = event.clipboardData.getData('text');
2584
+ const updatedValues = values.map((_, idx) => (idx < pastedData.length ? pastedData[idx] : _));
2585
+ setValues(updatedValues);
2586
+ setActiveIndex(updatedValues.length - 1);
2587
+ }, [values]);
2588
+ 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) => {
2589
+ if (!inputRefs.current) {
2590
+ inputRefs.current = [];
2591
+ }
2592
+ inputRefs.current[index] = ref;
2593
+ }, 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] }));
2594
+ });
2595
+ const getInputStyle = (index, values, hasError = false) => {
2596
+ const isInputEmpty = !values[index];
2597
+ 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`;
2598
+ };
2599
+
2600
+ const SubmitButton = JSX(({ isDisabled, onClick, text }) => {
2601
+ return (jsx(Button, { type: "button", onClick: onClick, disabled: isDisabled, children: jsx(Text, { font: "font-medium", children: text }) }));
2602
+ });
2603
+
2604
+ const VerifyPhoneDialog = JSX(({ title, phone, description, __html, code = true, codeLength = 4, textButton = '', onClose, }) => {
2605
+ const { close } = useDialogManager();
2606
+ const [values, setValues] = useState(Array(codeLength).fill(''));
2607
+ const [hasError, setHasError] = useState(false);
2608
+ const [isLoading, setIsLoading] = useState(false);
2609
+ const [timeNextReq, setTimeNextReq] = useState(180);
2610
+ const isValidCode = useMemo(() => values.every(Boolean), [values]);
2611
+ useEffect(() => {
2612
+ RETAIL_API.SendCode({
2613
+ phoneNumber: phone,
2614
+ smsCodesSetName: { key: 'AUTHENTICATION' },
2615
+ });
2616
+ }, []);
2617
+ const handleSubmit = useCallback(async () => {
2618
+ try {
2619
+ setIsLoading(true);
2620
+ await RETAIL_API.CheckCode({
2621
+ smsText: values.join(''),
2622
+ smsCodesSetName: { key: 'AUTHENTICATION' },
2623
+ });
2624
+ close();
2625
+ onClose && onClose();
2626
+ }
2627
+ catch {
2628
+ setIsLoading(false);
2629
+ setHasError(true);
2630
+ }
2631
+ }, [values]);
2632
+ 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] }) }));
2633
+ });
2634
+
2635
+ const useVerifyPhoneDialog = (props) => {
2636
+ const { open, close } = useDialogManager();
2637
+ return {
2638
+ open: (options = {}) => open(jsx(VerifyPhoneDialog, { ...props }), options),
2639
+ close,
2640
+ };
2641
+ };
2642
+
2643
+ const useApplicationLeadApi = (inputs, programId) => {
2644
+ const [responseStatus, setResponseStatus] = useState('');
2645
+ // eslint-disable-next-line consistent-return
2457
2646
  const handleSubmit = useCallback(async (formData) => {
2458
2647
  const feedbackValidator = objectValidator(getObjectValidator(inputs));
2459
2648
  if (!isValidationSuccess(feedbackValidator(formData))) {
2460
2649
  return 'Fail';
2461
2650
  }
2462
- const formatData = getFormatData(formData);
2463
- const status = (await API.send(formatData, endpoint === 'lead')) ? 'OK' : 'Fail';
2464
- setResponseType(status);
2465
- if (status) {
2466
- const responseTypeDialog = useResponseTypeDialog({ responseType: status, typeForm });
2467
- responseTypeDialog.open();
2651
+ try {
2652
+ const { profile } = await RETAIL_API.CreateUserProfile({
2653
+ profile: { phone: formatPhone(formData.phone) },
2654
+ });
2655
+ const profileId = profile?.id;
2656
+ if (profileId && formData?.phone) {
2657
+ const handleSuccessVerify = async () => {
2658
+ try {
2659
+ await RETAIL_API.UpdateUserProfile(getUpdateUserProfileData(profileId, formData));
2660
+ const { taskId, participantId } = await RETAIL_API.CreateDraftTask({
2661
+ profileId,
2662
+ programId,
2663
+ });
2664
+ await RETAIL_API.UpdateUserTask(getUpdateUserTaskData(participantId, taskId, profileId, formData));
2665
+ setResponseStatus('OK');
2666
+ }
2667
+ catch {
2668
+ setResponseStatus('Fail');
2669
+ }
2670
+ };
2671
+ // eslint-disable-next-line react-hooks/rules-of-hooks
2672
+ const verifyPhoneDialog = useVerifyPhoneDialog({
2673
+ onClose: handleSuccessVerify,
2674
+ ...verifyPhoneContent(formData?.phone),
2675
+ });
2676
+ verifyPhoneDialog.open();
2677
+ }
2678
+ }
2679
+ catch {
2680
+ setResponseStatus('Fail');
2468
2681
  }
2469
- return status;
2470
2682
  }, []);
2683
+ return {
2684
+ handleSubmit,
2685
+ responseStatus,
2686
+ };
2687
+ };
2688
+ const verifyPhoneContent = (phone) => ({
2689
+ title: 'Подтвердите номер телефона',
2690
+ description: `Мы отправили код на ${phone}`,
2691
+ phone: formatPhone(phone),
2692
+ textButton: 'Оформить',
2693
+ __html: `<span>Вводя код, я подтверждаю, что ознакомлен и подписываю:</span>
2694
+ <ul><li>соглашение о порядке использования простой электронной подписи,
2695
+ </li><li>согласие на обработку персональных данных,
2696
+ </li><li>предоставление и подписание прочих согласий Банка,
2697
+ </li><li>согласие на запрос в ПФР</li></ul>`,
2698
+ });
2699
+
2700
+ const useInitApplicationLead = () => {
2701
+ useEffect(() => {
2702
+ sessionStorage.removeItem('accessToken');
2703
+ sessionStorage.removeItem('refreshToken');
2704
+ }, []);
2705
+ };
2706
+
2707
+ const ApplicationLeadForm = JSX(({ className, title, programId, typeForm = '', sections = [], button, ...rest }) => {
2708
+ const inputs = (sections?.flatMap((_) => _?.inputs) || []);
2709
+ const initialFormState = getInitialFormState(inputs, typeForm);
2710
+ const [responseType, setResponseType] = useState('');
2711
+ useInitApplicationLead();
2712
+ const { handleSubmit, responseStatus } = useApplicationLeadApi(inputs, programId || '');
2713
+ if (responseStatus) {
2714
+ const responseTypeDialog = useResponseTypeDialog({ responseType: responseStatus, typeForm });
2715
+ responseTypeDialog.open();
2716
+ }
2471
2717
  const [, { field, onSubmit, reset }] = useForm(initialFormState, { onSubmit: handleSubmit });
2472
2718
  useEffect(() => {
2473
2719
  if (responseType === 'OK') {
@@ -4924,10 +5170,6 @@
4924
5170
  const isClient = !isSSR();
4925
5171
  const ClientOnly = JSX(({ children }) => (isClient ? children : null));
4926
5172
 
4927
- 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, {
4928
- 'backdrop-blur': blur,
4929
- }), 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" }) })));
4930
-
4931
5173
  const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
4932
5174
  const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
4933
5175
  function renderClusterer({ yandexMaps, map, points, isLoad, }) {
@@ -6568,7 +6810,7 @@
6568
6810
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
6569
6811
  });
6570
6812
 
6571
- const packageVersion = "0.14.579";
6813
+ const packageVersion = "0.14.581";
6572
6814
 
6573
6815
  exports.Blocks = Blocks;
6574
6816
  exports.ContentPage = ContentPage;