@redneckz/wildless-cms-uni-blocks 0.14.588 → 0.14.589

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 (204) hide show
  1. package/bundle/api/RetailApi/RetailApi.d.ts +3 -1
  2. package/bundle/api/RetailApi/RetailApiTypes.d.ts +3 -0
  3. package/bundle/blocks.schema.json +1 -1
  4. package/bundle/bundle.umd.js +166 -58
  5. package/bundle/bundle.umd.min.js +1 -1
  6. package/bundle/icons/IconName.d.ts +4 -2
  7. package/bundle/ui-kit/CaptchaDialog/CaptchaDialog.d.ts +7 -0
  8. package/bundle/ui-kit/CaptchaDialog/checkCaptcha.d.ts +8 -0
  9. package/bundle/ui-kit/CaptchaDialog/createCaptcha.d.ts +1 -0
  10. package/bundle/ui-kit/CaptchaDialog/useCaptchaDialog.d.ts +6 -0
  11. package/bundle/ui-kit/VerifyPhoneDialog/InputCode.d.ts +1 -0
  12. package/bundle/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -3
  13. package/bundle/ui-kit/VerifyPhoneDialog/handleSendCode.d.ts +15 -0
  14. package/bundle/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +16 -0
  15. package/cosmos-static/icons/RefreshIcon.svg +1 -0
  16. package/cosmos-static/icons/sprites.svg +1 -0
  17. package/dist/api/RetailApi/RetailApi.d.ts +3 -1
  18. package/dist/api/RetailApi/RetailApi.js +15 -1
  19. package/dist/api/RetailApi/RetailApi.js.map +1 -1
  20. package/dist/api/RetailApi/RetailApiTypes.d.ts +3 -0
  21. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +3 -4
  22. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  23. package/dist/icons/IconName.d.ts +4 -2
  24. package/dist/icons/IconName.js +3 -1
  25. package/dist/icons/IconName.js.map +1 -1
  26. package/dist/ui-kit/CaptchaDialog/CaptchaDialog.d.ts +7 -0
  27. package/dist/ui-kit/CaptchaDialog/CaptchaDialog.js +22 -0
  28. package/dist/ui-kit/CaptchaDialog/CaptchaDialog.js.map +1 -0
  29. package/dist/ui-kit/CaptchaDialog/checkCaptcha.d.ts +8 -0
  30. package/dist/ui-kit/CaptchaDialog/checkCaptcha.js +16 -0
  31. package/dist/ui-kit/CaptchaDialog/checkCaptcha.js.map +1 -0
  32. package/dist/ui-kit/CaptchaDialog/createCaptcha.d.ts +1 -0
  33. package/dist/ui-kit/CaptchaDialog/createCaptcha.js +9 -0
  34. package/dist/ui-kit/CaptchaDialog/createCaptcha.js.map +1 -0
  35. package/dist/ui-kit/CaptchaDialog/useCaptchaDialog.d.ts +6 -0
  36. package/dist/ui-kit/CaptchaDialog/useCaptchaDialog.js +15 -0
  37. package/dist/ui-kit/CaptchaDialog/useCaptchaDialog.js.map +1 -0
  38. package/dist/ui-kit/VerifyPhoneDialog/InputCode.d.ts +1 -0
  39. package/dist/ui-kit/VerifyPhoneDialog/InputCode.js +2 -2
  40. package/dist/ui-kit/VerifyPhoneDialog/InputCode.js.map +1 -1
  41. package/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -3
  42. package/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js +20 -29
  43. package/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  44. package/dist/ui-kit/VerifyPhoneDialog/handleSendCode.d.ts +15 -0
  45. package/dist/ui-kit/VerifyPhoneDialog/handleSendCode.js +21 -0
  46. package/dist/ui-kit/VerifyPhoneDialog/handleSendCode.js.map +1 -0
  47. package/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js +1 -1
  48. package/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js.map +1 -1
  49. package/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +16 -0
  50. package/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +59 -0
  51. package/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -0
  52. package/lib/api/RetailApi/RetailApi.d.ts +3 -1
  53. package/lib/api/RetailApi/RetailApi.js +15 -1
  54. package/lib/api/RetailApi/RetailApi.js.map +1 -1
  55. package/lib/api/RetailApi/RetailApiTypes.d.ts +3 -0
  56. package/lib/common.css +1 -1
  57. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +3 -4
  58. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  59. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +1 -1
  60. package/lib/icons/IconName.d.ts +4 -2
  61. package/lib/icons/IconName.js +3 -1
  62. package/lib/icons/IconName.js.map +1 -1
  63. package/lib/ui-kit/CaptchaDialog/CaptchaDialog.d.ts +7 -0
  64. package/lib/ui-kit/CaptchaDialog/CaptchaDialog.fixture.d.ts +6 -0
  65. package/lib/ui-kit/CaptchaDialog/CaptchaDialog.js +20 -0
  66. package/lib/ui-kit/CaptchaDialog/CaptchaDialog.js.map +1 -0
  67. package/lib/ui-kit/CaptchaDialog/checkCaptcha.d.ts +8 -0
  68. package/lib/ui-kit/CaptchaDialog/checkCaptcha.js +13 -0
  69. package/lib/ui-kit/CaptchaDialog/checkCaptcha.js.map +1 -0
  70. package/lib/ui-kit/CaptchaDialog/createCaptcha.d.ts +1 -0
  71. package/lib/ui-kit/CaptchaDialog/createCaptcha.js +6 -0
  72. package/lib/ui-kit/CaptchaDialog/createCaptcha.js.map +1 -0
  73. package/lib/ui-kit/CaptchaDialog/useCaptchaDialog.d.ts +6 -0
  74. package/lib/ui-kit/CaptchaDialog/useCaptchaDialog.js +12 -0
  75. package/lib/ui-kit/CaptchaDialog/useCaptchaDialog.js.map +1 -0
  76. package/lib/ui-kit/VerifyPhoneDialog/InputCode.d.ts +1 -0
  77. package/lib/ui-kit/VerifyPhoneDialog/InputCode.js +2 -2
  78. package/lib/ui-kit/VerifyPhoneDialog/InputCode.js.map +1 -1
  79. package/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -3
  80. package/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js +21 -30
  81. package/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  82. package/lib/ui-kit/VerifyPhoneDialog/handleSendCode.d.ts +15 -0
  83. package/lib/ui-kit/VerifyPhoneDialog/handleSendCode.js +18 -0
  84. package/lib/ui-kit/VerifyPhoneDialog/handleSendCode.js.map +1 -0
  85. package/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js +1 -1
  86. package/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js.map +1 -1
  87. package/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +16 -0
  88. package/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +56 -0
  89. package/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -0
  90. package/mobile/bundle/api/RetailApi/RetailApi.d.ts +3 -1
  91. package/mobile/bundle/api/RetailApi/RetailApiTypes.d.ts +3 -0
  92. package/mobile/bundle/bundle.umd.js +166 -58
  93. package/mobile/bundle/bundle.umd.min.js +1 -1
  94. package/mobile/bundle/icons/IconName.d.ts +4 -2
  95. package/mobile/bundle/ui-kit/CaptchaDialog/CaptchaDialog.d.ts +7 -0
  96. package/mobile/bundle/ui-kit/CaptchaDialog/checkCaptcha.d.ts +8 -0
  97. package/mobile/bundle/ui-kit/CaptchaDialog/createCaptcha.d.ts +1 -0
  98. package/mobile/bundle/ui-kit/CaptchaDialog/useCaptchaDialog.d.ts +6 -0
  99. package/mobile/bundle/ui-kit/VerifyPhoneDialog/InputCode.d.ts +1 -0
  100. package/mobile/bundle/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -3
  101. package/mobile/bundle/ui-kit/VerifyPhoneDialog/handleSendCode.d.ts +15 -0
  102. package/mobile/bundle/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +16 -0
  103. package/mobile/dist/api/RetailApi/RetailApi.d.ts +3 -1
  104. package/mobile/dist/api/RetailApi/RetailApi.js +15 -1
  105. package/mobile/dist/api/RetailApi/RetailApi.js.map +1 -1
  106. package/mobile/dist/api/RetailApi/RetailApiTypes.d.ts +3 -0
  107. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +3 -4
  108. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  109. package/mobile/dist/icons/IconName.d.ts +4 -2
  110. package/mobile/dist/icons/IconName.js +3 -1
  111. package/mobile/dist/icons/IconName.js.map +1 -1
  112. package/mobile/dist/ui-kit/CaptchaDialog/CaptchaDialog.d.ts +7 -0
  113. package/mobile/dist/ui-kit/CaptchaDialog/CaptchaDialog.js +22 -0
  114. package/mobile/dist/ui-kit/CaptchaDialog/CaptchaDialog.js.map +1 -0
  115. package/mobile/dist/ui-kit/CaptchaDialog/checkCaptcha.d.ts +8 -0
  116. package/mobile/dist/ui-kit/CaptchaDialog/checkCaptcha.js +16 -0
  117. package/mobile/dist/ui-kit/CaptchaDialog/checkCaptcha.js.map +1 -0
  118. package/mobile/dist/ui-kit/CaptchaDialog/createCaptcha.d.ts +1 -0
  119. package/mobile/dist/ui-kit/CaptchaDialog/createCaptcha.js +9 -0
  120. package/mobile/dist/ui-kit/CaptchaDialog/createCaptcha.js.map +1 -0
  121. package/mobile/dist/ui-kit/CaptchaDialog/useCaptchaDialog.d.ts +6 -0
  122. package/mobile/dist/ui-kit/CaptchaDialog/useCaptchaDialog.js +15 -0
  123. package/mobile/dist/ui-kit/CaptchaDialog/useCaptchaDialog.js.map +1 -0
  124. package/mobile/dist/ui-kit/VerifyPhoneDialog/InputCode.d.ts +1 -0
  125. package/mobile/dist/ui-kit/VerifyPhoneDialog/InputCode.js +2 -2
  126. package/mobile/dist/ui-kit/VerifyPhoneDialog/InputCode.js.map +1 -1
  127. package/mobile/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -3
  128. package/mobile/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js +20 -29
  129. package/mobile/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  130. package/mobile/dist/ui-kit/VerifyPhoneDialog/handleSendCode.d.ts +15 -0
  131. package/mobile/dist/ui-kit/VerifyPhoneDialog/handleSendCode.js +21 -0
  132. package/mobile/dist/ui-kit/VerifyPhoneDialog/handleSendCode.js.map +1 -0
  133. package/mobile/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js +1 -1
  134. package/mobile/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js.map +1 -1
  135. package/mobile/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +16 -0
  136. package/mobile/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +59 -0
  137. package/mobile/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -0
  138. package/mobile/lib/api/RetailApi/RetailApi.d.ts +3 -1
  139. package/mobile/lib/api/RetailApi/RetailApi.js +15 -1
  140. package/mobile/lib/api/RetailApi/RetailApi.js.map +1 -1
  141. package/mobile/lib/api/RetailApi/RetailApiTypes.d.ts +3 -0
  142. package/mobile/lib/common.css +1 -1
  143. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +3 -4
  144. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  145. package/mobile/lib/icons/IconName.d.ts +4 -2
  146. package/mobile/lib/icons/IconName.js +3 -1
  147. package/mobile/lib/icons/IconName.js.map +1 -1
  148. package/mobile/lib/ui-kit/CaptchaDialog/CaptchaDialog.d.ts +7 -0
  149. package/mobile/lib/ui-kit/CaptchaDialog/CaptchaDialog.js +20 -0
  150. package/mobile/lib/ui-kit/CaptchaDialog/CaptchaDialog.js.map +1 -0
  151. package/mobile/lib/ui-kit/CaptchaDialog/checkCaptcha.d.ts +8 -0
  152. package/mobile/lib/ui-kit/CaptchaDialog/checkCaptcha.js +13 -0
  153. package/mobile/lib/ui-kit/CaptchaDialog/checkCaptcha.js.map +1 -0
  154. package/mobile/lib/ui-kit/CaptchaDialog/createCaptcha.d.ts +1 -0
  155. package/mobile/lib/ui-kit/CaptchaDialog/createCaptcha.js +6 -0
  156. package/mobile/lib/ui-kit/CaptchaDialog/createCaptcha.js.map +1 -0
  157. package/mobile/lib/ui-kit/CaptchaDialog/useCaptchaDialog.d.ts +6 -0
  158. package/mobile/lib/ui-kit/CaptchaDialog/useCaptchaDialog.js +12 -0
  159. package/mobile/lib/ui-kit/CaptchaDialog/useCaptchaDialog.js.map +1 -0
  160. package/mobile/lib/ui-kit/VerifyPhoneDialog/InputCode.d.ts +1 -0
  161. package/mobile/lib/ui-kit/VerifyPhoneDialog/InputCode.js +2 -2
  162. package/mobile/lib/ui-kit/VerifyPhoneDialog/InputCode.js.map +1 -1
  163. package/mobile/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -3
  164. package/mobile/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js +21 -30
  165. package/mobile/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  166. package/mobile/lib/ui-kit/VerifyPhoneDialog/handleSendCode.d.ts +15 -0
  167. package/mobile/lib/ui-kit/VerifyPhoneDialog/handleSendCode.js +18 -0
  168. package/mobile/lib/ui-kit/VerifyPhoneDialog/handleSendCode.js.map +1 -0
  169. package/mobile/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js +1 -1
  170. package/mobile/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js.map +1 -1
  171. package/mobile/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +16 -0
  172. package/mobile/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +56 -0
  173. package/mobile/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -0
  174. package/mobile/src/api/RetailApi/RetailApi.ts +18 -1
  175. package/mobile/src/api/RetailApi/RetailApiTypes.ts +4 -0
  176. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +3 -4
  177. package/mobile/src/icons/IconName.ts +5 -5
  178. package/mobile/src/icons/RefreshIcon.svg +3 -0
  179. package/mobile/src/ui-kit/CaptchaDialog/CaptchaDialog.tsx +68 -0
  180. package/mobile/src/ui-kit/CaptchaDialog/checkCaptcha.ts +25 -0
  181. package/mobile/src/ui-kit/CaptchaDialog/createCaptcha.ts +6 -0
  182. package/mobile/src/ui-kit/CaptchaDialog/useCaptchaDialog.tsx +12 -0
  183. package/mobile/src/ui-kit/VerifyPhoneDialog/InputCode.tsx +3 -2
  184. package/mobile/src/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.tsx +66 -51
  185. package/mobile/src/ui-kit/VerifyPhoneDialog/handleSendCode.ts +37 -0
  186. package/mobile/src/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.tsx +2 -1
  187. package/mobile/src/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +71 -0
  188. package/package.json +2 -2
  189. package/src/api/RetailApi/RetailApi.ts +18 -1
  190. package/src/api/RetailApi/RetailApiTypes.ts +4 -0
  191. package/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +3 -4
  192. package/src/icons/IconName.ts +353 -6
  193. package/src/icons/RefreshIcon.svg +3 -0
  194. package/src/ui-kit/CaptchaDialog/CaptchaDialog.fixture.tsx +11 -0
  195. package/src/ui-kit/CaptchaDialog/CaptchaDialog.tsx +68 -0
  196. package/src/ui-kit/CaptchaDialog/checkCaptcha.ts +25 -0
  197. package/src/ui-kit/CaptchaDialog/createCaptcha.ts +6 -0
  198. package/src/ui-kit/CaptchaDialog/useCaptchaDialog.tsx +12 -0
  199. package/src/ui-kit/VerifyPhoneDialog/InputCode.tsx +3 -2
  200. package/src/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.fixture.tsx +11 -8
  201. package/src/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.tsx +66 -51
  202. package/src/ui-kit/VerifyPhoneDialog/handleSendCode.ts +37 -0
  203. package/src/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.tsx +2 -1
  204. package/src/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +71 -0
@@ -1130,9 +1130,9 @@
1130
1130
  onChange && onChange(!value);
1131
1131
  }, [onChange, disabled, value]);
1132
1132
  const icon = isRadio ? (jsx("div", { className: "absolute left-1 w-3 h-3 rounded-full bg-primary-main" })) : (jsx(SVG, { paths: CHECK_PATHS, className: "absolute left-1 ml-px block", width: "11", height: "9", fill: "white", viewBox: "0 0 11 9" }));
1133
- return (jsx("div", { className: className, children: jsxs("label", { className: style('flex items-center relative group/box', getCursorStyle(disabled)), onClick: handleChange, children: [jsx("div", { className: style(defaultCheckStyle, 'm-0', isRadio ? 'rounded-full border-2' : checkboxStyle(value), !disabled && value ? 'border-primary-main' : 'border-gray', disabled ? 'bg-main-disabled' : 'group-hover/box:border-primary-hover'), role: role(isRadio), "aria-checked": Boolean(value), "aria-disabled": Boolean(disabled), "aria-label": text }), value ? icon : null, renderText$2(text)] }) }));
1133
+ return (jsx("div", { className: className, children: jsxs("label", { className: style('flex items-center relative group/box', getCursorStyle(disabled)), onClick: handleChange, children: [jsx("div", { className: style(defaultCheckStyle, 'm-0', isRadio ? 'rounded-full border-2' : checkboxStyle(value), !disabled && value ? 'border-primary-main' : 'border-gray', disabled ? 'bg-main-disabled' : 'group-hover/box:border-primary-hover'), role: role(isRadio), "aria-checked": Boolean(value), "aria-disabled": Boolean(disabled), "aria-label": text }), value ? icon : null, renderText$3(text)] }) }));
1134
1134
  });
1135
- const renderText$2 = (text) => text ? (jsx("div", { className: "ml-s", children: jsx(Text, { size: "text-l", font: "font-light", children: text }) })) : null;
1135
+ const renderText$3 = (text) => text ? (jsx("div", { className: "ml-s", children: jsx(Text, { size: "text-l", font: "font-light", children: text }) })) : null;
1136
1136
  const getCursorStyle = (disabled = false) => (disabled ? 'cursor-not-allowed' : 'cursor-pointer');
1137
1137
  const role = (isRadio = false) => (isRadio ? 'radio' : 'checkbox');
1138
1138
  const checkboxStyle = (value = false) => style('rounded border', { 'bg-primary-main': value });
@@ -2558,6 +2558,7 @@
2558
2558
 
2559
2559
  const renderSubmitButton = (button, className) => (jsx(Button, { className: style('w-full @xl:w-auto', className), type: "submit", children: button?.text ? button.text : 'Отправить заявку' }));
2560
2560
 
2561
+ const getResponse = (response) => (isJSON(response) ? response.json() : response);
2561
2562
  const getAthorizationHeaders = () => {
2562
2563
  const token = sessionStorage.getItem('accessToken');
2563
2564
  return token ? { Authorization: `Bearer ${token}` } : null;
@@ -2571,7 +2572,18 @@
2571
2572
  },
2572
2573
  credentials: 'include',
2573
2574
  body: body ? JSON.stringify(body) : null,
2574
- }).then((response) => (isJSON(response) ? response.json() : response));
2575
+ })
2576
+ .then((response) => {
2577
+ if (response.ok) {
2578
+ return getResponse(response);
2579
+ }
2580
+ else {
2581
+ throw response;
2582
+ }
2583
+ })
2584
+ .catch((error) => {
2585
+ throw error;
2586
+ });
2575
2587
  const saveToken = (data) => {
2576
2588
  sessionStorage.setItem('accessToken', data.access_token);
2577
2589
  sessionStorage.setItem('refreshToken', data.refresh_token);
@@ -2583,6 +2595,8 @@
2583
2595
  UpdateUserTask: async (body) => await request('/user-data/updateUserTask', 'PUT', body),
2584
2596
  SendCode: async (body) => await request('/sms/sendCode', 'POST', body),
2585
2597
  CheckCode: async (body) => await request('/sms/checkCode', 'POST', body).then(saveToken),
2598
+ CreateCaptcha: async (phoneNumber) => await request(`/sms/createCaptcha?phoneNumber=${phoneNumber}`, 'GET'),
2599
+ CheckCaptcha: async (body) => await request('/sms/checkCaptcha', 'POST', body),
2586
2600
  };
2587
2601
 
2588
2602
  const getUpdateUserProfileData = (profileId, formData) => {
@@ -2647,6 +2661,71 @@
2647
2661
  },
2648
2662
  });
2649
2663
 
2664
+ const ICON_SIZE$1 = { width: '103', height: '21' };
2665
+
2666
+ const logoTitleSizeStyle = 'text-s';
2667
+
2668
+ const ICON_VERSION_MAP = {
2669
+ 'bg-white': 'color',
2670
+ transparent: 'white',
2671
+ };
2672
+ const SVG_COLOR = {
2673
+ 'bg-white': 'text-primary-main',
2674
+ transparent: 'text-white',
2675
+ };
2676
+ const renderImage = (bgColor, image, size) => {
2677
+ const img = image?.src
2678
+ ? image
2679
+ : {
2680
+ icon: image?.icon || 'LogoIcon',
2681
+ iconVersion: ICON_VERSION_MAP[bgColor],
2682
+ };
2683
+ return (jsx(Img, { image: img, className: SVG_COLOR[bgColor], width: size?.width, height: size?.height }));
2684
+ };
2685
+
2686
+ const TEXT_COLOR = {
2687
+ 'bg-white': 'text-primary-text',
2688
+ transparent: 'text-white',
2689
+ };
2690
+ const Logo = JSX(({ className, href = '/', logo, children, targetBlank, bgColor = 'bg-white', showTitle = true, data, }) => (jsxs("a", { className: style('inline-flex items-center font-sans no-underline', className), href: logo?.href ?? href, target: targetBlank ? '_blank' : '_self', "aria-label": logo?.title ?? 'Россельхозбанк', ...getAspectsAttributes(data), children: [renderImage(bgColor, logo?.image, ICON_SIZE$1), showTitle
2691
+ ? children ?? (jsx("div", { className: "ml-s", children: jsx(Text, { font: "font-medium", color: TEXT_COLOR[bgColor], size: logoTitleSizeStyle, children: logo?.title ?? 'Россельхозбанк' }) }))
2692
+ : null] })));
2693
+
2694
+ const checkCaptcha = async ({ code, setHasError, close, sendCode = noop, }) => {
2695
+ const response = await RETAIL_API.CheckCaptcha({ captchaText: code });
2696
+ if ((await response.text()) === 'ERROR') {
2697
+ setHasError(true);
2698
+ }
2699
+ else {
2700
+ sendCode();
2701
+ close?.();
2702
+ }
2703
+ };
2704
+
2705
+ const createCaptcha = async (setCaptcha, phoneNumber) => {
2706
+ const response = await RETAIL_API.CreateCaptcha(phoneNumber);
2707
+ setCaptcha(URL.createObjectURL(await response.blob()));
2708
+ };
2709
+
2710
+ const CaptchaDialog = JSX(({ phoneNumber, close, sendCode, onClose }) => {
2711
+ const [captcha, setCaptcha] = useState('');
2712
+ const [code, setCode] = useState('');
2713
+ const [hasError, setHasError] = useState(false);
2714
+ useEffect(() => {
2715
+ createCaptcha(setCaptcha, phoneNumber);
2716
+ }, []);
2717
+ return (jsx(Dialog, { head: jsx(Logo, {}), onClose: onClose, className: "my-6xl max-w-lg w-full min-h-fit mx-auto rounded-lg", children: jsxs("div", { className: "flex flex-col gap-lg items-center rounded-md", children: [jsxs("div", { className: "flex h-[140px] w-[300px]", children: [jsx("img", { className: "grow", src: captcha }), jsx("div", { onClick: () => createCaptcha(setCaptcha, phoneNumber), className: "flex w-8 items-center justify-center cursor-pointer", children: jsx(Icon, { iconVersion: "normal", name: "RefreshIcon" }) })] }), jsx(Input, { className: "w-[300px]", onChange: setCode, value: code, placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0434 \u0441 \u043A\u0430\u0440\u0442\u0438\u043D\u043A\u0438" }), hasError ? jsx("div", { className: "text-error", children: "\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043E\u0434" }) : null, jsxs("div", { className: "flex w-[310px] justify-between", children: [jsx(Button, { onClick: close, version: "secondary", children: "\u0412\u0435\u0440\u043D\u0443\u0442\u044C\u0441\u044F" }), jsx(Button, { type: "submit", disabled: !code, onClick: () => checkCaptcha({ code, setHasError, close, sendCode }), version: "secondary", children: "\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C" })] })] }) }));
2718
+ });
2719
+
2720
+ const useCaptchaDialog = (initialProps, onClose) => {
2721
+ const { open, close, closeAll } = useDialogManager();
2722
+ return {
2723
+ open: () => open(jsx(CaptchaDialog, { close: close, onClose: onClose, ...initialProps })),
2724
+ close,
2725
+ closeAll,
2726
+ };
2727
+ };
2728
+
2650
2729
  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, {
2651
2730
  'backdrop-blur': blur,
2652
2731
  }), 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" }) })));
@@ -2671,7 +2750,24 @@
2671
2750
  return `${minutes}:${seconds}`;
2672
2751
  };
2673
2752
 
2674
- const InputCode = JSX(({ values, setValues, hasError }) => {
2753
+ const handleSendCode = async ({ phoneNumber, captchaDialog, setTimeNextReq, setIsTimerStarted, setAttemps, }) => {
2754
+ try {
2755
+ await RETAIL_API.SendCode({
2756
+ phoneNumber: phoneNumber,
2757
+ smsCodesSetName: { key: 'AUTHENTICATION' },
2758
+ });
2759
+ setAttemps(0);
2760
+ setTimeNextReq(180);
2761
+ setIsTimerStarted(true);
2762
+ }
2763
+ catch (e) {
2764
+ if (e?.status === 429) {
2765
+ captchaDialog.open();
2766
+ }
2767
+ }
2768
+ };
2769
+
2770
+ const InputCode = JSX(({ values, setValues, hasError, errorText }) => {
2675
2771
  const [activeIndex, setActiveIndex] = useState(0);
2676
2772
  const inputRefs = useRef([]);
2677
2773
  useEffect(() => {
@@ -2708,7 +2804,7 @@
2708
2804
  inputRefs.current = [];
2709
2805
  }
2710
2806
  inputRefs.current[index] = ref;
2711
- }, 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] }));
2807
+ }, onFocus: (event) => event.target.select(), onKeyDown: handleKeyDown(index), className: getInputStyle(index, values, hasError) }, index))) }), hasError ? jsx("div", { className: "text-error", children: errorText }) : null] }));
2712
2808
  });
2713
2809
  const getInputStyle = (index, values, hasError = false) => {
2714
2810
  const isInputEmpty = !values[index];
@@ -2719,42 +2815,85 @@
2719
2815
  return (jsx(Button, { type: "button", onClick: onClick, disabled: isDisabled, children: jsx(Text, { font: "font-medium", children: text }) }));
2720
2816
  });
2721
2817
 
2722
- const VerifyPhoneDialog = JSX(({ title, phone, description, __html, code = true, codeLength = 4, textButton = '', onClose, href = '', }) => {
2723
- const { close } = useDialogManager();
2724
- const [values, setValues] = useState(Array(codeLength).fill(''));
2818
+ const useVerifyPhoneDialogSubmit = ({ close, values }) => {
2725
2819
  const [hasError, setHasError] = useState(false);
2820
+ const [errorText, setErrorText] = useState('');
2726
2821
  const [isLoading, setIsLoading] = useState(false);
2727
- const [timeNextReq, setTimeNextReq] = useState(180);
2728
- const isValidCode = useMemo(() => values.every(Boolean), [values]);
2729
- useEffect(() => {
2730
- RETAIL_API.SendCode({
2731
- phoneNumber: phone,
2732
- smsCodesSetName: { key: 'AUTHENTICATION' },
2733
- });
2822
+ const [timeNextReq, setTimeNextReq] = useState(0);
2823
+ const [isTimerStarted, setIsTimerStarted] = useState(false);
2824
+ const [attemps, setAttemps] = useState(0);
2825
+ const resetError = useCallback(() => {
2826
+ setHasError(false);
2827
+ setErrorText('');
2734
2828
  }, []);
2829
+ const isTimeExpired = useMemo(() => timeNextReq === 0 && isTimerStarted, [timeNextReq, isTimerStarted]);
2830
+ const isSubmitButtonDisabled = useMemo(() => attemps > 2 || !values.every(Boolean) || isTimeExpired, [values]);
2735
2831
  const handleSubmit = useCallback(async () => {
2736
2832
  try {
2833
+ setIsTimerStarted(false);
2834
+ setTimeNextReq(0);
2835
+ setAttemps(attemps + 1);
2737
2836
  setIsLoading(true);
2738
2837
  await RETAIL_API.CheckCode({
2739
2838
  smsText: values.join(''),
2740
2839
  smsCodesSetName: { key: 'AUTHENTICATION' },
2741
2840
  });
2742
- globalThis.location.href = href;
2743
- close();
2744
- onClose && onClose();
2841
+ resetError();
2842
+ close && close();
2745
2843
  }
2746
2844
  catch {
2747
2845
  setIsLoading(false);
2846
+ attemps > 1 ? setErrorText('Исчерпан лимит ввода смс-кода') : setErrorText('Неверный код');
2748
2847
  setHasError(true);
2749
2848
  }
2750
- }, [values]);
2751
- 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] }) }));
2849
+ }, [values, attemps]);
2850
+ useEffect(() => {
2851
+ if (isTimeExpired) {
2852
+ setHasError(true);
2853
+ setErrorText('Код просрочен');
2854
+ }
2855
+ else {
2856
+ setHasError(false);
2857
+ }
2858
+ }, [isTimeExpired]);
2859
+ return {
2860
+ handleSubmit,
2861
+ hasError,
2862
+ errorText,
2863
+ isLoading,
2864
+ timeNextReq,
2865
+ isSubmitButtonDisabled,
2866
+ setTimeNextReq,
2867
+ setIsTimerStarted,
2868
+ setAttemps,
2869
+ };
2870
+ };
2871
+
2872
+ const VerifyPhoneDialog = JSX(({ close = noop, onClose = noop, title, description, __html, code = true, codeLength = 4, textButton = '', phoneNumber = '+79999999999', }) => {
2873
+ const [values, setValues] = useState(Array(codeLength).fill(''));
2874
+ const { handleSubmit, hasError, errorText, isLoading, timeNextReq, isSubmitButtonDisabled, setTimeNextReq, setIsTimerStarted, setAttemps, } = useVerifyPhoneDialogSubmit({ values, close });
2875
+ const sendCode = useCallback(() => {
2876
+ handleSendCode({
2877
+ phoneNumber,
2878
+ captchaDialog,
2879
+ setTimeNextReq,
2880
+ setIsTimerStarted,
2881
+ setAttemps,
2882
+ });
2883
+ }, []);
2884
+ const captchaDialog = useCaptchaDialog({ phoneNumber, sendCode }, onClose);
2885
+ useEffect(() => {
2886
+ sendCode();
2887
+ }, []);
2888
+ 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, errorText: errorText, hasError: hasError })) : null, renderText$2(timeNextReq, setTimeNextReq, sendCode), jsx(RichText, { itemSize: "list-s", __html: __html }), renderTextButton(textButton, isSubmitButtonDisabled, handleSubmit), isLoading ? jsx(Loader, { blur: false }) : null] }) }));
2752
2889
  });
2890
+ const renderTextButton = (textButton, isDisabled, handleSubmit) => textButton ? (jsx(SubmitButton, { isDisabled: isDisabled, onClick: handleSubmit, text: textButton })) : null;
2891
+ const renderText$2 = (timeNextReq, setTimeNextReq, sendCode) => 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, { onClick: sendCode, className: "text-primary-main", children: "\u041F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u043D\u043E\u0432\u044B\u0439 \u043A\u043E\u0434" }));
2753
2892
 
2754
2893
  const useVerifyPhoneDialog = (props) => {
2755
2894
  const { open, close } = useDialogManager();
2756
2895
  return {
2757
- open: (options = {}) => open(jsx(VerifyPhoneDialog, { ...props }), options),
2896
+ open: (options = {}) => open(jsx(VerifyPhoneDialog, { onClose: close, ...props }), options),
2758
2897
  close,
2759
2898
  };
2760
2899
  };
@@ -2781,7 +2920,7 @@
2781
2920
  programId,
2782
2921
  });
2783
2922
  await RETAIL_API.UpdateUserTask(getUpdateUserTaskData(participantId, taskId, profileId, formData));
2784
- setResponseStatus('OK');
2923
+ globalThis.location.href = '/credit-lead';
2785
2924
  }
2786
2925
  catch {
2787
2926
  setResponseStatus('Fail');
@@ -2789,7 +2928,7 @@
2789
2928
  };
2790
2929
  // eslint-disable-next-line react-hooks/rules-of-hooks
2791
2930
  const verifyPhoneDialog = useVerifyPhoneDialog({
2792
- onClose: handleSuccessVerify,
2931
+ close: handleSuccessVerify,
2793
2932
  ...verifyPhoneContent(formData?.phone),
2794
2933
  });
2795
2934
  verifyPhoneDialog.open();
@@ -2807,14 +2946,13 @@
2807
2946
  const verifyPhoneContent = (phone) => ({
2808
2947
  title: 'Подтвердите номер телефона',
2809
2948
  description: `Мы отправили код на ${phone}`,
2810
- phone: formatPhone(phone),
2949
+ phoneNumber: formatPhone(phone),
2811
2950
  textButton: 'Оформить',
2812
2951
  __html: `<span>Вводя код, я подтверждаю, что ознакомлен и подписываю:</span>
2813
2952
  <ul><li>соглашение о порядке использования простой электронной подписи,
2814
2953
  </li><li>согласие на обработку персональных данных,
2815
2954
  </li><li>предоставление и подписание прочих согласий Банка,
2816
2955
  </li><li>согласие на запрос в ПФР</li></ul>`,
2817
- href: '/credit-lead',
2818
2956
  });
2819
2957
 
2820
2958
  const useInitApplicationLead = () => {
@@ -4547,7 +4685,7 @@
4547
4685
  return null;
4548
4686
  };
4549
4687
 
4550
- const ICON_SIZE$1 = { width: '24', height: '24' };
4688
+ const ICON_SIZE = { width: '24', height: '24' };
4551
4689
  const PaginationContainer = ({ currentPage, onPageChange, totalPages, }) => {
4552
4690
  const pages = useMemo(() => Array.from({ length: totalPages }).fill({
4553
4691
  currentPage,
@@ -4566,7 +4704,7 @@
4566
4704
  }, [currentPage, totalPages]);
4567
4705
  const handleFirstPage = useCallback(() => onPageChange(1), []);
4568
4706
  const handleLastPage = useCallback(() => onPageChange(totalPages), [totalPages]);
4569
- return (jsxs("div", { className: "flex gap-m items-center", children: [jsx("div", { onClick: handlePrevPage, children: jsx(Icon, { name: "ArrowLeftIcon", iconVersion: "black", imageClassName: getIconStyle(currentPage === 1), ...ICON_SIZE$1 }) }), jsxs("div", { className: "flex @lg:gap-2xs", children: [currentPage > 1 ? (jsx("div", { onClick: handleFirstPage, className: paginationBlockStyle, "aria-label": "\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 1", children: "1" })) : null, currentPage > 3 ? jsx("div", { className: "py-m @lg:px-s", children: "..." }) : null, pages.map(renderPages), currentPage < totalPages - 2 ? jsx("div", { className: "py-m @lg:px-s", children: "..." }) : null, currentPage < totalPages ? (jsx("div", { onClick: handleLastPage, className: paginationBlockStyle, "aria-label": `Страница ${totalPages}`, children: totalPages })) : null] }), jsx("div", { onClick: handleNextPage, children: jsx(Icon, { className: "rotate-180", name: "ArrowLeftIcon", iconVersion: "black", imageClassName: getIconStyle(currentPage === totalPages), ...ICON_SIZE$1 }) })] }));
4707
+ return (jsxs("div", { className: "flex gap-m items-center", children: [jsx("div", { onClick: handlePrevPage, children: jsx(Icon, { name: "ArrowLeftIcon", iconVersion: "black", imageClassName: getIconStyle(currentPage === 1), ...ICON_SIZE }) }), jsxs("div", { className: "flex @lg:gap-2xs", children: [currentPage > 1 ? (jsx("div", { onClick: handleFirstPage, className: paginationBlockStyle, "aria-label": "\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 1", children: "1" })) : null, currentPage > 3 ? jsx("div", { className: "py-m @lg:px-s", children: "..." }) : null, pages.map(renderPages), currentPage < totalPages - 2 ? jsx("div", { className: "py-m @lg:px-s", children: "..." }) : null, currentPage < totalPages ? (jsx("div", { onClick: handleLastPage, className: paginationBlockStyle, "aria-label": `Страница ${totalPages}`, children: totalPages })) : null] }), jsx("div", { onClick: handleNextPage, children: jsx(Icon, { className: "rotate-180", name: "ArrowLeftIcon", iconVersion: "black", imageClassName: getIconStyle(currentPage === totalPages), ...ICON_SIZE }) })] }));
4570
4708
  };
4571
4709
  const getIconStyle = (condition) => condition ? 'opacity-20' : 'cursor-pointer hover:opacity-60';
4572
4710
 
@@ -4942,36 +5080,6 @@
4942
5080
  return (jsx(BlockWrapper, { className: className, defaultPadding: "p-6xl", ...rest, children: jsxs("div", { className: "container max-w-[978px] space-y-m", children: [title ? jsx(Heading, { headingType: "h3", title: title, className: "@xl:text-center" }) : null, regions ? (jsx(SelectControl, { label: "\u0412\u0430\u0448 \u0440\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", isSearch: true, options: regions.map(({ name = '' }) => ({ key: name, text: name })), value: region, onChange: setRegion })) : null, regionHref ? (jsx("div", { className: "text-center", children: jsx(LinkButton, { href: regionHref, target: "_blank", className: style('p-m w-full @xl:w-auto', buttonStyle), data: getAspectsWithInclude(data, region?.key), children: buttonText }) })) : null] }) }));
4943
5081
  });
4944
5082
 
4945
- const ICON_SIZE = { width: '103', height: '21' };
4946
-
4947
- const logoTitleSizeStyle = 'text-s';
4948
-
4949
- const ICON_VERSION_MAP = {
4950
- 'bg-white': 'color',
4951
- transparent: 'white',
4952
- };
4953
- const SVG_COLOR = {
4954
- 'bg-white': 'text-primary-main',
4955
- transparent: 'text-white',
4956
- };
4957
- const renderImage = (bgColor, image, size) => {
4958
- const img = image?.src
4959
- ? image
4960
- : {
4961
- icon: image?.icon || 'LogoIcon',
4962
- iconVersion: ICON_VERSION_MAP[bgColor],
4963
- };
4964
- return (jsx(Img, { image: img, className: SVG_COLOR[bgColor], width: size?.width, height: size?.height }));
4965
- };
4966
-
4967
- const TEXT_COLOR = {
4968
- 'bg-white': 'text-primary-text',
4969
- transparent: 'text-white',
4970
- };
4971
- const Logo = JSX(({ className, href = '/', logo, children, targetBlank, bgColor = 'bg-white', showTitle = true, data, }) => (jsxs("a", { className: style('inline-flex items-center font-sans no-underline', className), href: logo?.href ?? href, target: targetBlank ? '_blank' : '_self', "aria-label": logo?.title ?? 'Россельхозбанк', ...getAspectsAttributes(data), children: [renderImage(bgColor, logo?.image, ICON_SIZE), showTitle
4972
- ? children ?? (jsx("div", { className: "ml-s", children: jsx(Text, { font: "font-medium", color: TEXT_COLOR[bgColor], size: logoTitleSizeStyle, children: logo?.title ?? 'Россельхозбанк' }) }))
4973
- : null] })));
4974
-
4975
5083
  const BUTTON_STYLE = {
4976
5084
  default: 'bg-main-divider text-primary-main rounded hover:text-primary-main',
4977
5085
  transparent: 'backdrop-opacity-30 bg-white/30 hover:text-primary-hover text-white',
@@ -6930,7 +7038,7 @@
6930
7038
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
6931
7039
  });
6932
7040
 
6933
- const packageVersion = "0.14.587";
7041
+ const packageVersion = "0.14.588";
6934
7042
 
6935
7043
  exports.Blocks = Blocks;
6936
7044
  exports.ContentPage = ContentPage;