@redneckz/wildless-cms-uni-blocks 0.14.134 → 0.14.136

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 (222) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +329 -236
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/ApplicationForm/ApplicationFormAntiFraud.d.ts +12 -0
  5. package/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +8 -1
  6. package/bundle/components/ApplicationForm/ApplicationFormFeedback.d.ts +8 -12
  7. package/bundle/components/ApplicationForm/ApplicationFormIndividuals.d.ts +2 -2
  8. package/bundle/components/ApplicationForm/EmbeddableForms.d.ts +1 -0
  9. package/bundle/components/ApplicationForm/InputControl.d.ts +2 -9
  10. package/bundle/components/ApplicationForm/PhoneInputControl.d.ts +2 -2
  11. package/bundle/components/ApplicationForm/handleSubmit.d.ts +16 -0
  12. package/bundle/components/ApplicationForm/renderTextarea.d.ts +9 -1
  13. package/bundle/components/ApplicationForm/renderUserData.d.ts +8 -1
  14. package/bundle/ui-kit/Input/InputProps.d.ts +2 -1
  15. package/dist/components/ApplicationForm/ApplicationForm.js +1 -1
  16. package/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  17. package/dist/components/ApplicationForm/ApplicationFormAntiFraud.d.ts +12 -0
  18. package/dist/components/ApplicationForm/ApplicationFormAntiFraud.js +49 -0
  19. package/dist/components/ApplicationForm/ApplicationFormAntiFraud.js.map +1 -0
  20. package/dist/components/ApplicationForm/ApplicationFormContent.d.ts +8 -1
  21. package/dist/components/ApplicationForm/ApplicationFormFeedback.d.ts +8 -12
  22. package/dist/components/ApplicationForm/ApplicationFormFeedback.js +21 -34
  23. package/dist/components/ApplicationForm/ApplicationFormFeedback.js.map +1 -1
  24. package/dist/components/ApplicationForm/ApplicationFormIndividuals.d.ts +2 -2
  25. package/dist/components/ApplicationForm/ApplicationFormIndividuals.js +9 -9
  26. package/dist/components/ApplicationForm/ApplicationFormIndividuals.js.map +1 -1
  27. package/dist/components/ApplicationForm/ApplicationFormWed.js +5 -1
  28. package/dist/components/ApplicationForm/ApplicationFormWed.js.map +1 -1
  29. package/dist/components/ApplicationForm/EmbeddableForms.d.ts +1 -0
  30. package/dist/components/ApplicationForm/EmbeddableForms.js +2 -0
  31. package/dist/components/ApplicationForm/EmbeddableForms.js.map +1 -1
  32. package/dist/components/ApplicationForm/InputControl.d.ts +2 -9
  33. package/dist/components/ApplicationForm/InputControl.js +1 -1
  34. package/dist/components/ApplicationForm/InputControl.js.map +1 -1
  35. package/dist/components/ApplicationForm/PhoneInputControl.d.ts +2 -2
  36. package/dist/components/ApplicationForm/PhoneInputControl.js.map +1 -1
  37. package/dist/components/ApplicationForm/feedbackTypes.js +1 -1
  38. package/dist/components/ApplicationForm/handleSubmit.d.ts +16 -0
  39. package/dist/components/ApplicationForm/handleSubmit.js +71 -0
  40. package/dist/components/ApplicationForm/handleSubmit.js.map +1 -0
  41. package/dist/components/ApplicationForm/renderAgreementWithSubmit.js +1 -1
  42. package/dist/components/ApplicationForm/renderAgreementWithSubmit.js.map +1 -1
  43. package/dist/components/ApplicationForm/renderIndividualsFields.js +1 -1
  44. package/dist/components/ApplicationForm/renderIndividualsFields.js.map +1 -1
  45. package/dist/components/ApplicationForm/renderTextarea.d.ts +9 -1
  46. package/dist/components/ApplicationForm/renderTextarea.js +2 -1
  47. package/dist/components/ApplicationForm/renderTextarea.js.map +1 -1
  48. package/dist/components/ApplicationForm/renderUserData.d.ts +8 -1
  49. package/dist/components/ApplicationForm/renderUserData.js +1 -1
  50. package/dist/components/ApplicationForm/renderUserData.js.map +1 -1
  51. package/dist/ui-kit/Input/Input.js +8 -5
  52. package/dist/ui-kit/Input/Input.js.map +1 -1
  53. package/dist/ui-kit/Input/InputProps.d.ts +2 -1
  54. package/lib/common.css +1 -1
  55. package/lib/components/ApplicationForm/ApplicationForm.fixture.d.ts +1 -0
  56. package/lib/components/ApplicationForm/ApplicationForm.js +1 -1
  57. package/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  58. package/lib/components/ApplicationForm/ApplicationFormAntiFraud.d.ts +12 -0
  59. package/lib/components/ApplicationForm/ApplicationFormAntiFraud.js +47 -0
  60. package/lib/components/ApplicationForm/ApplicationFormAntiFraud.js.map +1 -0
  61. package/lib/components/ApplicationForm/ApplicationFormContent.d.ts +8 -1
  62. package/lib/components/ApplicationForm/ApplicationFormFeedback.d.ts +8 -12
  63. package/lib/components/ApplicationForm/ApplicationFormFeedback.js +22 -35
  64. package/lib/components/ApplicationForm/ApplicationFormFeedback.js.map +1 -1
  65. package/lib/components/ApplicationForm/ApplicationFormIndividuals.d.ts +2 -2
  66. package/lib/components/ApplicationForm/ApplicationFormIndividuals.js +9 -9
  67. package/lib/components/ApplicationForm/ApplicationFormIndividuals.js.map +1 -1
  68. package/lib/components/ApplicationForm/ApplicationFormWed.js +5 -1
  69. package/lib/components/ApplicationForm/ApplicationFormWed.js.map +1 -1
  70. package/lib/components/ApplicationForm/EmbeddableForms.d.ts +1 -0
  71. package/lib/components/ApplicationForm/EmbeddableForms.js +2 -0
  72. package/lib/components/ApplicationForm/EmbeddableForms.js.map +1 -1
  73. package/lib/components/ApplicationForm/InputControl.d.ts +2 -9
  74. package/lib/components/ApplicationForm/InputControl.js +1 -1
  75. package/lib/components/ApplicationForm/InputControl.js.map +1 -1
  76. package/lib/components/ApplicationForm/PhoneInputControl.d.ts +2 -2
  77. package/lib/components/ApplicationForm/PhoneInputControl.js.map +1 -1
  78. package/lib/components/ApplicationForm/feedbackTypes.js +1 -1
  79. package/lib/components/ApplicationForm/handleSubmit.d.ts +16 -0
  80. package/lib/components/ApplicationForm/handleSubmit.js +66 -0
  81. package/lib/components/ApplicationForm/handleSubmit.js.map +1 -0
  82. package/lib/components/ApplicationForm/renderAgreementWithSubmit.js +1 -1
  83. package/lib/components/ApplicationForm/renderAgreementWithSubmit.js.map +1 -1
  84. package/lib/components/ApplicationForm/renderIndividualsFields.js +1 -1
  85. package/lib/components/ApplicationForm/renderIndividualsFields.js.map +1 -1
  86. package/lib/components/ApplicationForm/renderTextarea.d.ts +9 -1
  87. package/lib/components/ApplicationForm/renderTextarea.js +2 -1
  88. package/lib/components/ApplicationForm/renderTextarea.js.map +1 -1
  89. package/lib/components/ApplicationForm/renderUserData.d.ts +8 -1
  90. package/lib/components/ApplicationForm/renderUserData.js +1 -1
  91. package/lib/components/ApplicationForm/renderUserData.js.map +1 -1
  92. package/lib/ui-kit/Input/Input.js +8 -5
  93. package/lib/ui-kit/Input/Input.js.map +1 -1
  94. package/lib/ui-kit/Input/InputProps.d.ts +2 -1
  95. package/mobile/bundle/bundle.umd.js +329 -236
  96. package/mobile/bundle/bundle.umd.min.js +1 -1
  97. package/mobile/bundle/components/ApplicationForm/ApplicationFormAntiFraud.d.ts +12 -0
  98. package/mobile/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +8 -1
  99. package/mobile/bundle/components/ApplicationForm/ApplicationFormFeedback.d.ts +8 -12
  100. package/mobile/bundle/components/ApplicationForm/ApplicationFormIndividuals.d.ts +2 -2
  101. package/mobile/bundle/components/ApplicationForm/EmbeddableForms.d.ts +1 -0
  102. package/mobile/bundle/components/ApplicationForm/InputControl.d.ts +2 -9
  103. package/mobile/bundle/components/ApplicationForm/PhoneInputControl.d.ts +2 -2
  104. package/mobile/bundle/components/ApplicationForm/handleSubmit.d.ts +16 -0
  105. package/mobile/bundle/components/ApplicationForm/renderTextarea.d.ts +9 -1
  106. package/mobile/bundle/components/ApplicationForm/renderUserData.d.ts +8 -1
  107. package/mobile/bundle/ui-kit/Input/InputProps.d.ts +2 -1
  108. package/mobile/dist/components/ApplicationForm/ApplicationForm.js +1 -1
  109. package/mobile/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  110. package/mobile/dist/components/ApplicationForm/ApplicationFormAntiFraud.d.ts +12 -0
  111. package/mobile/dist/components/ApplicationForm/ApplicationFormAntiFraud.js +49 -0
  112. package/mobile/dist/components/ApplicationForm/ApplicationFormAntiFraud.js.map +1 -0
  113. package/mobile/dist/components/ApplicationForm/ApplicationFormContent.d.ts +8 -1
  114. package/mobile/dist/components/ApplicationForm/ApplicationFormFeedback.d.ts +8 -12
  115. package/mobile/dist/components/ApplicationForm/ApplicationFormFeedback.js +21 -34
  116. package/mobile/dist/components/ApplicationForm/ApplicationFormFeedback.js.map +1 -1
  117. package/mobile/dist/components/ApplicationForm/ApplicationFormIndividuals.d.ts +2 -2
  118. package/mobile/dist/components/ApplicationForm/ApplicationFormIndividuals.js +9 -9
  119. package/mobile/dist/components/ApplicationForm/ApplicationFormIndividuals.js.map +1 -1
  120. package/mobile/dist/components/ApplicationForm/ApplicationFormWed.js +5 -1
  121. package/mobile/dist/components/ApplicationForm/ApplicationFormWed.js.map +1 -1
  122. package/mobile/dist/components/ApplicationForm/EmbeddableForms.d.ts +1 -0
  123. package/mobile/dist/components/ApplicationForm/EmbeddableForms.js +2 -0
  124. package/mobile/dist/components/ApplicationForm/EmbeddableForms.js.map +1 -1
  125. package/mobile/dist/components/ApplicationForm/InputControl.d.ts +2 -9
  126. package/mobile/dist/components/ApplicationForm/InputControl.js +1 -1
  127. package/mobile/dist/components/ApplicationForm/InputControl.js.map +1 -1
  128. package/mobile/dist/components/ApplicationForm/PhoneInputControl.d.ts +2 -2
  129. package/mobile/dist/components/ApplicationForm/PhoneInputControl.js.map +1 -1
  130. package/mobile/dist/components/ApplicationForm/feedbackTypes.js +1 -1
  131. package/mobile/dist/components/ApplicationForm/handleSubmit.d.ts +16 -0
  132. package/mobile/dist/components/ApplicationForm/handleSubmit.js +71 -0
  133. package/mobile/dist/components/ApplicationForm/handleSubmit.js.map +1 -0
  134. package/mobile/dist/components/ApplicationForm/renderAgreementWithSubmit.js +1 -1
  135. package/mobile/dist/components/ApplicationForm/renderAgreementWithSubmit.js.map +1 -1
  136. package/mobile/dist/components/ApplicationForm/renderIndividualsFields.js +1 -1
  137. package/mobile/dist/components/ApplicationForm/renderIndividualsFields.js.map +1 -1
  138. package/mobile/dist/components/ApplicationForm/renderTextarea.d.ts +9 -1
  139. package/mobile/dist/components/ApplicationForm/renderTextarea.js +2 -1
  140. package/mobile/dist/components/ApplicationForm/renderTextarea.js.map +1 -1
  141. package/mobile/dist/components/ApplicationForm/renderUserData.d.ts +8 -1
  142. package/mobile/dist/components/ApplicationForm/renderUserData.js +1 -1
  143. package/mobile/dist/components/ApplicationForm/renderUserData.js.map +1 -1
  144. package/mobile/dist/ui-kit/Input/Input.js +8 -5
  145. package/mobile/dist/ui-kit/Input/Input.js.map +1 -1
  146. package/mobile/dist/ui-kit/Input/InputProps.d.ts +2 -1
  147. package/mobile/lib/common.css +1 -1
  148. package/mobile/lib/components/ApplicationForm/ApplicationForm.js +1 -1
  149. package/mobile/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  150. package/mobile/lib/components/ApplicationForm/ApplicationFormAntiFraud.d.ts +12 -0
  151. package/mobile/lib/components/ApplicationForm/ApplicationFormAntiFraud.js +47 -0
  152. package/mobile/lib/components/ApplicationForm/ApplicationFormAntiFraud.js.map +1 -0
  153. package/mobile/lib/components/ApplicationForm/ApplicationFormContent.d.ts +8 -1
  154. package/mobile/lib/components/ApplicationForm/ApplicationFormFeedback.d.ts +8 -12
  155. package/mobile/lib/components/ApplicationForm/ApplicationFormFeedback.js +22 -35
  156. package/mobile/lib/components/ApplicationForm/ApplicationFormFeedback.js.map +1 -1
  157. package/mobile/lib/components/ApplicationForm/ApplicationFormIndividuals.d.ts +2 -2
  158. package/mobile/lib/components/ApplicationForm/ApplicationFormIndividuals.js +9 -9
  159. package/mobile/lib/components/ApplicationForm/ApplicationFormIndividuals.js.map +1 -1
  160. package/mobile/lib/components/ApplicationForm/ApplicationFormWed.js +5 -1
  161. package/mobile/lib/components/ApplicationForm/ApplicationFormWed.js.map +1 -1
  162. package/mobile/lib/components/ApplicationForm/EmbeddableForms.d.ts +1 -0
  163. package/mobile/lib/components/ApplicationForm/EmbeddableForms.js +2 -0
  164. package/mobile/lib/components/ApplicationForm/EmbeddableForms.js.map +1 -1
  165. package/mobile/lib/components/ApplicationForm/InputControl.d.ts +2 -9
  166. package/mobile/lib/components/ApplicationForm/InputControl.js +1 -1
  167. package/mobile/lib/components/ApplicationForm/InputControl.js.map +1 -1
  168. package/mobile/lib/components/ApplicationForm/PhoneInputControl.d.ts +2 -2
  169. package/mobile/lib/components/ApplicationForm/PhoneInputControl.js.map +1 -1
  170. package/mobile/lib/components/ApplicationForm/feedbackTypes.js +1 -1
  171. package/mobile/lib/components/ApplicationForm/handleSubmit.d.ts +16 -0
  172. package/mobile/lib/components/ApplicationForm/handleSubmit.js +66 -0
  173. package/mobile/lib/components/ApplicationForm/handleSubmit.js.map +1 -0
  174. package/mobile/lib/components/ApplicationForm/renderAgreementWithSubmit.js +1 -1
  175. package/mobile/lib/components/ApplicationForm/renderAgreementWithSubmit.js.map +1 -1
  176. package/mobile/lib/components/ApplicationForm/renderIndividualsFields.js +1 -1
  177. package/mobile/lib/components/ApplicationForm/renderIndividualsFields.js.map +1 -1
  178. package/mobile/lib/components/ApplicationForm/renderTextarea.d.ts +9 -1
  179. package/mobile/lib/components/ApplicationForm/renderTextarea.js +2 -1
  180. package/mobile/lib/components/ApplicationForm/renderTextarea.js.map +1 -1
  181. package/mobile/lib/components/ApplicationForm/renderUserData.d.ts +8 -1
  182. package/mobile/lib/components/ApplicationForm/renderUserData.js +1 -1
  183. package/mobile/lib/components/ApplicationForm/renderUserData.js.map +1 -1
  184. package/mobile/lib/ui-kit/Input/Input.js +8 -5
  185. package/mobile/lib/ui-kit/Input/Input.js.map +1 -1
  186. package/mobile/lib/ui-kit/Input/InputProps.d.ts +2 -1
  187. package/mobile/src/components/ApplicationForm/ApplicationForm.tsx +6 -9
  188. package/mobile/src/components/ApplicationForm/ApplicationFormAntiFraud.tsx +86 -0
  189. package/mobile/src/components/ApplicationForm/ApplicationFormContent.ts +11 -1
  190. package/mobile/src/components/ApplicationForm/ApplicationFormFeedback.tsx +62 -85
  191. package/mobile/src/components/ApplicationForm/ApplicationFormIndividuals.tsx +13 -12
  192. package/mobile/src/components/ApplicationForm/ApplicationFormWed.tsx +5 -4
  193. package/mobile/src/components/ApplicationForm/EmbeddableForms.tsx +2 -0
  194. package/mobile/src/components/ApplicationForm/InputControl.tsx +5 -11
  195. package/mobile/src/components/ApplicationForm/PhoneInputControl.tsx +2 -2
  196. package/mobile/src/components/ApplicationForm/feedbackTypes.ts +1 -1
  197. package/mobile/src/components/ApplicationForm/handleSubmit.tsx +87 -0
  198. package/mobile/src/components/ApplicationForm/renderAgreementWithSubmit.tsx +1 -1
  199. package/mobile/src/components/ApplicationForm/renderIndividualsFields.tsx +2 -2
  200. package/mobile/src/components/ApplicationForm/renderTextarea.tsx +35 -23
  201. package/mobile/src/components/ApplicationForm/renderUserData.tsx +15 -5
  202. package/mobile/src/ui-kit/Input/Input.tsx +45 -31
  203. package/mobile/src/ui-kit/Input/InputProps.ts +2 -1
  204. package/package.json +2 -2
  205. package/src/components/ApplicationForm/ApplicationForm.fixture.tsx +14 -0
  206. package/src/components/ApplicationForm/ApplicationForm.tsx +6 -9
  207. package/src/components/ApplicationForm/ApplicationFormAntiFraud.tsx +86 -0
  208. package/src/components/ApplicationForm/ApplicationFormContent.ts +11 -1
  209. package/src/components/ApplicationForm/ApplicationFormFeedback.tsx +62 -85
  210. package/src/components/ApplicationForm/ApplicationFormIndividuals.tsx +13 -12
  211. package/src/components/ApplicationForm/ApplicationFormWed.tsx +5 -4
  212. package/src/components/ApplicationForm/EmbeddableForms.tsx +2 -0
  213. package/src/components/ApplicationForm/InputControl.tsx +5 -11
  214. package/src/components/ApplicationForm/PhoneInputControl.tsx +2 -2
  215. package/src/components/ApplicationForm/feedbackTypes.ts +1 -1
  216. package/src/components/ApplicationForm/handleSubmit.tsx +87 -0
  217. package/src/components/ApplicationForm/renderAgreementWithSubmit.tsx +1 -1
  218. package/src/components/ApplicationForm/renderIndividualsFields.tsx +2 -2
  219. package/src/components/ApplicationForm/renderTextarea.tsx +35 -23
  220. package/src/components/ApplicationForm/renderUserData.tsx +15 -5
  221. package/src/ui-kit/Input/Input.tsx +45 -31
  222. package/src/ui-kit/Input/InputProps.ts +2 -1
@@ -981,7 +981,7 @@
981
981
  const ApplicationFieldsetLayout = JSX(({ title, firstChildren, secondChildren }) => (jsxs("fieldset", { className: "grid @xl:flex @xl:justify-between gap-lg border-b border-b-main-divider @xl:border-none", children: [title ? (jsx("legend", { className: "w-full", children: jsx(Heading, { title: title, headingType: "h6", className: "@xl:text-center" }) })) : null, firstChildren, secondChildren] })));
982
982
  const formChildrenStyle = '@xl:w-1/2 space-y-s';
983
983
 
984
- const Input = JSX(({ key, className = '', inputClassName = '', id, name, type = 'text', label, placeholder, value = '', valid = true, children, onChange, onFocus, onBlur, pattern, autoFocus = false, }) => {
984
+ const Input = JSX(({ key, className = '', id, name, type = 'text', label, placeholder, value = '', valid = true, children, onChange, onFocus, onBlur, pattern, autoFocus = false, isTextarea = false, }) => {
985
985
  const inputRef = useRef(null);
986
986
  const handleChange = useCallback((e) => {
987
987
  onChange && onChange(e.target?.value || '');
@@ -991,16 +991,19 @@
991
991
  inputRef.current?.focus();
992
992
  }
993
993
  }, [autoFocus, inputRef]);
994
+ const defaultStyle = 'w-full border rounded-md text-primary-text outline-none p-m';
994
995
  const paddingStyle = children ? 'pr-3xl' : '';
995
- const validStyle = valid
996
- ? 'border-gray hover:border-primary-hover active:border-primary-text focus:border-primary-text'
997
- : 'border-error';
998
- return (jsxs("div", { className: style('relative', className), children: [jsxs("label", { children: [label ? (jsx("div", { className: "mb-xs", children: jsx(Text, { size: "text-m", font: "font-light", children: label }) })) : null, jsx("input", { ref: inputRef, className: style('w-full h-14 border rounded-md text-primary-text outline-none p-m', paddingStyle, validStyle, inputClassName), id: id, name: name || id, placeholder: placeholder, type: type, value: value, onInput: handleChange, onFocus: onFocus, onBlur: onBlur, pattern: pattern }, key)] }), children] }));
996
+ const validStyle = getValidStyle(valid);
997
+ return (jsxs("div", { className: style('relative', className), children: [jsxs("label", { children: [label ? renderLabel$1(label) : null, isTextarea ? (jsx("textarea", { className: style('block resize-y min-h-24', defaultStyle, validStyle), id: style('textarea', id), name: name || id, placeholder: placeholder, value: value, onInput: handleChange, onFocus: onFocus, onBlur: onBlur }, key)) : (jsx("input", { type: type, className: style('h-14', defaultStyle, paddingStyle, validStyle), ref: inputRef, id: id, name: name || id, placeholder: placeholder, value: value, onInput: handleChange, onFocus: onFocus, onBlur: onBlur, pattern: pattern }, key))] }), children] }));
999
998
  });
999
+ const renderLabel$1 = (label) => (jsx("div", { className: "mb-xs", children: jsx(Text, { size: "text-m", font: "font-light", children: label }) }));
1000
+ const getValidStyle = (valid) => valid
1001
+ ? 'border-gray hover:border-primary-hover active:border-primary-text focus:border-primary-text'
1002
+ : 'border-error';
1000
1003
 
1001
1004
  const renderErrorText = (error) => (jsx("div", { className: "h-4", children: error ? (jsx(Text, { size: "text-xs", font: "font-light", color: "text-error", children: error })) : null }));
1002
1005
 
1003
- const InputControl = JSX(({ className, label, value = '', error, onChange, onBlur }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(Input, { type: "text", "aria-label": label, label: label, valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur }), renderErrorText(error)] })));
1006
+ const InputControl = JSX(({ className, label, value = '', placeholder, error, onChange, onBlur, isTextarea }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(Input, { type: "text", "aria-label": label, label: label, valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur, isTextarea: isTextarea, placeholder: placeholder }), renderErrorText(error)] })));
1004
1007
 
1005
1008
  const isPlaceholder = (_) => _ === '_';
1006
1009
  const isDigit = (_) => /\d/.test(_);
@@ -1196,7 +1199,7 @@
1196
1199
 
1197
1200
  const renderSubmitButton = (button, className) => (jsx(Button, { className: style('w-full @xl:w-auto', className), type: "submit", children: button?.text ? button.text : 'Отправить заявку' }));
1198
1201
 
1199
- const initialFormState$6 = {
1202
+ const initialFormState$7 = {
1200
1203
  acquiringType: { key: 'Торговый эквайринг' },
1201
1204
  fullName: '',
1202
1205
  inn: '',
@@ -1228,11 +1231,231 @@
1228
1231
  phone: phone.replace(/[^+\d]/g, ''),
1229
1232
  });
1230
1233
  }, [onSubmit]);
1231
- const [, { field, ...formProps }] = useForm(initialFormState$6, handleSubmit);
1234
+ const [, { field, ...formProps }] = useForm(initialFormState$7, handleSubmit);
1232
1235
  const regions = useGetRegions();
1233
1236
  return (jsxs("form", { className: formStyle$1, onSubmit: formProps.onSubmit, children: [renderAcquiringRegion({ regions, field, title: 'Вид эквайринга и регион' }), renderAcquiringDataOrganization(field, 'Данные организации'), renderSlideCheckboxes(field), renderSubmitButton(button), jsx(Footnote, { link: link })] }));
1234
1237
  });
1235
1238
 
1239
+ const SVG = JSX(({ className, viewBox, fill = 'none', width, height, paths, ...commonOptions }) => {
1240
+ return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: className, viewBox: viewBox, fill: fill, width: width, height: height, children: paths.map(({ d, fill: pathFill, ...options }, i) => {
1241
+ const resultOptions = { ...commonOptions, ...options };
1242
+ return (jsx("path", { d: d, fill: pathFill || 'currentColor', stroke: resultOptions.stroke, strokeLinecap: resultOptions.strokeLinecap, strokeLinejoin: resultOptions.strokeLinejoin, strokeWidth: resultOptions.strokeWidth, strokeMiterlimit: resultOptions.strokeMiterlimit }, i));
1243
+ }) }));
1244
+ });
1245
+
1246
+ const CHECK_PATHS = [
1247
+ {
1248
+ d: 'M10.207.793a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414 0l-2.5-2.5a1 1 0 0 1 1.414-1.414L3.5 6.086 8.793.793a1 1 0 0 1 1.414 0Z',
1249
+ fillRule: 'evenodd',
1250
+ clipRule: 'evenodd',
1251
+ fill: 'white',
1252
+ },
1253
+ ];
1254
+ const Checkbox = JSX(({ className, value, text, disabled, isRadio, onChange }) => {
1255
+ const handleChange = useCallback((e) => {
1256
+ if (disabled) {
1257
+ return;
1258
+ }
1259
+ e.preventDefault();
1260
+ onChange && onChange(!value);
1261
+ }, [onChange, disabled, value]);
1262
+ 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" }));
1263
+ return (jsx("div", { className: className, children: jsxs("label", { className: "flex items-center relative cursor-pointer group/box", onClick: handleChange, children: [jsx("div", { className: style('appearance-none w-5 h-5 border-solid cursor-pointer m-0', isRadio ? 'rounded-full border-2' : checkboxStyle(value), value ? 'border-primary-main' : 'border-gray', disabled ? 'bg-main-disabled' : 'group-hover/box:border-primary-hover'), role: "checkbox", "aria-checked": Boolean(value), "aria-disabled": Boolean(disabled) }), value ? icon : null, text ? (jsx("div", { className: "ml-s", children: jsx(Text, { size: "text-l", font: "font-light", children: text }) })) : null] }) }));
1264
+ });
1265
+ const checkboxStyle = (value) => style('rounded border', value ? 'bg-primary-main' : '');
1266
+
1267
+ const renderAgreementWithSubmit = (consentDataProcessing, link, button) => (jsxs("div", { className: "flex flex-col lg:flex-row w-full justify-between items-baseline", children: [jsxs("div", { children: [jsxs("div", { className: "flex gap-3", children: [jsx(Checkbox, { ...consentDataProcessing }), jsx(Footnote, { text: "\u0421\u043E\u0433\u043B\u0430\u0441\u0435\u043D \u0441 ", link: link })] }), renderErrorText(withValidator(consentDataProcessing, consentDataProcessingValidator).error)] }), renderSubmitButton(button)] }));
1268
+
1269
+ const formatDate = (date, toTimeStamp = false) => {
1270
+ if (typeof date === 'string') {
1271
+ return date.split('-').reverse().join('.');
1272
+ }
1273
+ else {
1274
+ const day = String(date.getDate()).padStart(2, '0');
1275
+ const month = String(date.getMonth() + 1).padStart(2, '0');
1276
+ const year = toTimeStamp ? String(date.getFullYear()) : String(date.getFullYear()).slice(-2);
1277
+ return toTimeStamp ? `${year}-${month}-${day}` : `${day}.${month}.${year}`;
1278
+ }
1279
+ };
1280
+
1281
+ const noop = () => {
1282
+ // Do nothing
1283
+ };
1284
+
1285
+ const DAY_COUNT = 6;
1286
+ const WEEK_COUNT = 7;
1287
+ const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
1288
+ const calendarCells = [];
1289
+ let dayCounter = 1;
1290
+ for (let i = 0; i < DAY_COUNT; i++) {
1291
+ const rowCells = [];
1292
+ for (let j = 0; j < WEEK_COUNT; j++) {
1293
+ if (i === 0 && j < firstDayOfWeek) {
1294
+ rowCells.push(jsx("td", {}, `empty-${j}`));
1295
+ }
1296
+ else if (dayCounter > totalDays) {
1297
+ rowCells.push(jsx("td", {}, `empty-${j}`));
1298
+ }
1299
+ else {
1300
+ const currentDate = new Date(currentYear, currentMonth, dayCounter);
1301
+ const isToday = checkIsToday(currentDate, today);
1302
+ const isDisabled = checkIsDisabled(currentDate, min, max);
1303
+ rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
1304
+ dayCounter++;
1305
+ }
1306
+ }
1307
+ calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
1308
+ }
1309
+ return calendarCells;
1310
+ };
1311
+ const checkIsToday = (currentDate, today) => today && currentDate.toDateString() === today.toDateString();
1312
+ const checkIsDisabled = (currentDate, min, max) => (min && currentDate.getTime() < min.getTime()) || (max && currentDate.getTime() > max.getTime());
1313
+ const getDayStyles = (isToday, isDisabled) => style('p-s text-center rounded-md border', isToday ? '' : 'border-transparent hover:bg-gray', isDisabled ? 'text-gray hover:bg-transparent' : 'cursor-pointer');
1314
+
1315
+ const WEEK_DAYS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
1316
+ const Calendar = JSX(({ today, currentMonth, currentYear, min, max, onDateSelect = noop }) => {
1317
+ const handleDateClick = useCallback((date) => onDateSelect(date), []);
1318
+ const { firstDayOfWeek, totalDays } = useMemo(() => ({
1319
+ firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
1320
+ totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
1321
+ }), [currentYear, currentMonth]);
1322
+ return (jsxs("table", { className: "mx-auto", children: [jsx("thead", { className: "text-gray font-light", children: jsx("tr", { children: WEEK_DAYS.map((day, index) => (jsx("th", { className: "p-s", children: day }, String(index)))) }) }), jsx("tbody", { children: renderCalendarCells({
1323
+ firstDayOfWeek,
1324
+ today,
1325
+ totalDays,
1326
+ currentYear,
1327
+ currentMonth,
1328
+ min,
1329
+ max,
1330
+ onDateClick: handleDateClick,
1331
+ }) })] }));
1332
+ });
1333
+
1334
+ const months = [
1335
+ 'Январь',
1336
+ 'Февраль',
1337
+ 'Март',
1338
+ 'Апрель',
1339
+ 'Май',
1340
+ 'Июнь',
1341
+ 'Июль',
1342
+ 'Август',
1343
+ 'Сентябрь',
1344
+ 'Октябрь',
1345
+ 'Ноябрь',
1346
+ 'Декабрь',
1347
+ ];
1348
+
1349
+ const START_YEAR = 1940;
1350
+ const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
1351
+
1352
+ const MONTHS_COUNT = 11;
1353
+ const MONTHS_OPTIONS = months.map((key) => ({ key }));
1354
+ const YEARS_OPTIONS = getYears()
1355
+ .reverse()
1356
+ .map((key) => ({ key: String(key) }));
1357
+ const useDatePickerManager = ({ onShowCalendar, showCalendar, selectedMonth, onMonthSelect, onYearSelect, selectedYear, }) => {
1358
+ const close = useCallback(() => showCalendar && onShowCalendar(false), [showCalendar]);
1359
+ const ref = useOutsideClick(close);
1360
+ const handleChangeVisibleCalendar = useCallback(() => onShowCalendar(!showCalendar), [showCalendar]);
1361
+ const handleNextMonth = useCallback(() => {
1362
+ if (selectedMonth + 1 <= MONTHS_COUNT) {
1363
+ onMonthSelect(selectedMonth + 1);
1364
+ }
1365
+ else {
1366
+ onMonthSelect(0);
1367
+ onYearSelect(selectedYear + 1);
1368
+ }
1369
+ }, [selectedMonth]);
1370
+ const handlePrevMonth = useCallback(() => {
1371
+ if (selectedMonth - 1 >= 0) {
1372
+ onMonthSelect(selectedMonth - 1);
1373
+ }
1374
+ else {
1375
+ onMonthSelect(11);
1376
+ onYearSelect(selectedYear - 1);
1377
+ }
1378
+ }, [selectedMonth]);
1379
+ const handleSelectMonth = useCallback(({ key }) => onMonthSelect(months.indexOf(key)), []);
1380
+ const handleSelectYear = useCallback(({ key }) => onYearSelect(Number(key)), []);
1381
+ return {
1382
+ handleChangeVisibleCalendar,
1383
+ handleNextMonth,
1384
+ handlePrevMonth,
1385
+ handleSelectMonth,
1386
+ handleSelectYear,
1387
+ monthsOptions: MONTHS_OPTIONS,
1388
+ yearsOptions: YEARS_OPTIONS,
1389
+ ref,
1390
+ };
1391
+ };
1392
+
1393
+ const ICON_PROPS = {
1394
+ name: 'ArrowUpIcon',
1395
+ iconVersion: 'black',
1396
+ width: '24',
1397
+ height: '24',
1398
+ };
1399
+ const SELECT_PROPS = {
1400
+ className: 'min-w-32',
1401
+ iconVersion: 'black',
1402
+ isBorder: false,
1403
+ };
1404
+ const formStyle = 'flex justify-between items-center h-14 px-m py-s border rounded-md cursor-pointer ' +
1405
+ 'hover:border-black active:border-black focus:border-black';
1406
+ const DatePicker = JSX(({ className = '', label = '', value, valid = true, minDate, maxDate, onChange }) => {
1407
+ const [showCalendar, { setValue }] = useBool(false);
1408
+ const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
1409
+ const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
1410
+ const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
1411
+ onYearSelect: setSelectedYear,
1412
+ onMonthSelect: setSelectedMonth,
1413
+ onShowCalendar: setValue,
1414
+ selectedYear,
1415
+ selectedMonth,
1416
+ showCalendar,
1417
+ });
1418
+ return (jsxs("div", { className: style(className, 'relative'), ref: ref, children: [jsx(Text, { size: "text-m", "font-weight": "font-light", children: label }), renderDatePickerForm(handleChangeVisibleCalendar, value, valid), showCalendar ? (jsxs("div", { className: "absolute bg-white z-20 select-none", children: [jsxs("div", { className: "flex gap-s", children: [jsx("div", { className: "my-auto", onClick: handlePrevMonth, children: jsx(Icon, { ...ICON_PROPS, className: "-rotate-90 cursor-pointer" }) }), jsx(Select, { onChange: handleSelectMonth, value: { key: months[selectedMonth] }, options: monthsOptions, ...SELECT_PROPS }), jsx(Select, { onChange: handleSelectYear, value: { key: String(selectedYear) }, options: yearsOptions, ...SELECT_PROPS }), jsx("div", { className: "my-auto", onClick: handleNextMonth, children: jsx(Icon, { ...ICON_PROPS, className: "rotate-90 cursor-pointer" }) })] }), jsx(Calendar, { today: value, currentMonth: selectedMonth, currentYear: selectedYear, onDateSelect: onChange, min: minDate, max: maxDate })] })) : null] }));
1419
+ });
1420
+ const renderDatePickerForm = (handleChangeVisibleCalendar, value, valid) => (jsxs("div", { onClick: handleChangeVisibleCalendar, className: style(formStyle, valid ? 'border-gray' : 'border-error'), children: [jsx(Paragraph, { children: value && formatDate(value) }), jsx(Icon, { ...ICON_PROPS, name: "CalendarIcon" })] }));
1421
+
1422
+ const DatePickerControl = JSX(({ className, label, value = undefined, error, onChange }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [label ? (jsx("div", { className: "mb-xs", children: jsx(Text, { size: "text-m", font: "font-light", children: label }) })) : null, jsx(DatePicker, { value: value, onChange: onChange, valid: Boolean(!error) }), renderErrorText(error)] })));
1423
+
1424
+ const renderUserData = (field) => (jsxs("div", { children: [jsx(InputControl, { label: "\u0424\u0430\u043C\u0438\u043B\u0438\u044F*", ...withValidator(field('surname'), nameValidator) }), jsx(InputControl, { label: "\u0418\u043C\u044F*", ...withValidator(field('name'), nameValidator) }), jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E (\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E, \u043F\u0440\u0438 \u043D\u0430\u043B\u0438\u0447\u0438\u0438)", ...field('middleName') }), jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F*", ...withValidator(field('birthday'), defaultValidator) })] }));
1425
+
1426
+ const initialFormState$6 = {
1427
+ typeForm: { key: 'ANTIFRAUD', text: 'Предупреждение о мошенничестве' },
1428
+ surname: '',
1429
+ name: '',
1430
+ middleName: '',
1431
+ phone: '',
1432
+ birthday: undefined,
1433
+ isClient: false,
1434
+ comment: '',
1435
+ consentDataProcessing: false,
1436
+ };
1437
+ const feedbackValidator = objectValidator({
1438
+ typeForm: defaultValidator,
1439
+ surname: defaultValidator,
1440
+ name: nameValidator,
1441
+ birthday: defaultValidator,
1442
+ phone: phoneValidator,
1443
+ consentDataProcessing: consentDataProcessingValidator,
1444
+ });
1445
+ const ApplicationFormAntiFraud = JSX(({ button, link, onSubmit }) => {
1446
+ const handleSubmit = useCallback((formState) => {
1447
+ const { typeForm, phone, ...usedFields } = formState;
1448
+ const submitData = {
1449
+ ...usedFields,
1450
+ typeForm: typeForm.key,
1451
+ phone: phone.replace(/[^+\d]/g, ''),
1452
+ };
1453
+ isValidationSuccess(feedbackValidator(formState)) && onSubmit(submitData);
1454
+ }, [onSubmit]);
1455
+ const [, { field, ...formProps }] = useForm(initialFormState$6, handleSubmit);
1456
+ return (jsx("form", { className: formStyle$1, onSubmit: formProps.onSubmit, children: jsx(ApplicationFieldsetLayout, { firstChildren: jsxs("div", { className: "w-full max-w-xl space-y-s m-auto", children: [renderUserData(field), jsx(PhoneInputControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D*", ...withValidator(field('phone'), phoneValidator) }), renderAgreementWithSubmit(field('consentDataProcessing'), link, button)] }) }) }));
1457
+ });
1458
+
1236
1459
  const renderBusinessCardDataOrganization = (field) => (jsx(ApplicationFieldsetLayout, { firstChildren: jsxs("div", { className: formChildrenStyle, children: [jsx(InputControl, { label: "\u041A\u043E\u043D\u0442\u0430\u043A\u0442\u043D\u043E\u0435 \u043B\u0438\u0446\u043E", ...withValidator(field('name'), nameValidator) }), jsx(InputControl, { label: "\u0418\u041D\u041D", ...withValidator(field('inn'), innValidator) })] }), secondChildren: jsxs("div", { className: formChildrenStyle, children: [jsx(PhoneInputControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...withValidator(field('phone'), phoneValidator) }), jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...withValidator(field('mail'), defaultValidator) })] }) }));
1237
1460
 
1238
1461
  const renderRegion$1 = ({ regions, field }) => (jsx(SelectControl, { className: "w-full", label: "\u0424\u0438\u043B\u0438\u0430\u043B", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B", isSearch: true, options: regions.map(({ code = '', name = '' }) => ({ key: code, text: name })), ...withValidator(field('region'), defaultValidator) }));
@@ -1424,7 +1647,7 @@
1424
1647
  },
1425
1648
  {
1426
1649
  text: 'Качество обслуживания',
1427
- key: 'FEEDBACK_QC',
1650
+ key: 'FEEDBACK_QS',
1428
1651
  },
1429
1652
  ];
1430
1653
  const FEEDBACK_METHOD = [
@@ -1436,195 +1659,68 @@
1436
1659
  { key: 'Юридическое лицо / ИП' },
1437
1660
  ];
1438
1661
 
1439
- const SVG = JSX(({ className, viewBox, fill = 'none', width, height, paths, ...commonOptions }) => {
1440
- return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: className, viewBox: viewBox, fill: fill, width: width, height: height, children: paths.map(({ d, fill: pathFill, ...options }, i) => {
1441
- const resultOptions = { ...commonOptions, ...options };
1442
- return (jsx("path", { d: d, fill: pathFill || 'currentColor', stroke: resultOptions.stroke, strokeLinecap: resultOptions.strokeLinecap, strokeLinejoin: resultOptions.strokeLinejoin, strokeWidth: resultOptions.strokeWidth, strokeMiterlimit: resultOptions.strokeMiterlimit }, i));
1443
- }) }));
1444
- });
1445
-
1446
- const CHECK_PATHS = [
1447
- {
1448
- d: 'M10.207.793a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414 0l-2.5-2.5a1 1 0 0 1 1.414-1.414L3.5 6.086 8.793.793a1 1 0 0 1 1.414 0Z',
1449
- fillRule: 'evenodd',
1450
- clipRule: 'evenodd',
1451
- fill: 'white',
1452
- },
1453
- ];
1454
- const Checkbox = JSX(({ className, value, text, disabled, isRadio, onChange }) => {
1455
- const handleChange = useCallback((e) => {
1456
- if (disabled) {
1457
- return;
1458
- }
1459
- e.preventDefault();
1460
- onChange && onChange(!value);
1461
- }, [onChange, disabled, value]);
1462
- 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" }));
1463
- return (jsx("div", { className: className, children: jsxs("label", { className: "flex items-center relative cursor-pointer group/box", onClick: handleChange, children: [jsx("div", { className: style('appearance-none w-5 h-5 border-solid cursor-pointer m-0', isRadio ? 'rounded-full border-2' : checkboxStyle(value), value ? 'border-primary-main' : 'border-gray', disabled ? 'bg-main-disabled' : 'group-hover/box:border-primary-hover'), role: "checkbox", "aria-checked": Boolean(value), "aria-disabled": Boolean(disabled) }), value ? icon : null, text ? (jsx("div", { className: "ml-s", children: jsx(Text, { size: "text-l", font: "font-light", children: text }) })) : null] }) }));
1464
- });
1465
- const checkboxStyle = (value) => style('rounded border', value ? 'bg-primary-main' : '');
1466
-
1467
- const renderAgreementWithSubmit = (consentDataProcessing, link, button) => (jsxs("div", { className: "flex w-full justify-between items-baseline", children: [jsxs("div", { children: [jsxs("div", { className: "flex gap-3", children: [jsx(Checkbox, { ...consentDataProcessing }), jsx(Footnote, { text: "\u0421\u043E\u0433\u043B\u0430\u0441\u0435\u043D \u0441 ", link: link })] }), renderErrorText(withValidator(consentDataProcessing, consentDataProcessingValidator).error)] }), renderSubmitButton(button)] }));
1468
-
1469
- const activeTextareaStyles = 'hover:border-primary-hover active:focus:border-primary-text focus:border-primary-text';
1470
- const renderTextarea = (textField, text, placeholder = '') => (jsxs("label", { className: "space-y-xs", htmlFor: "textarea", children: [text ? (jsx("div", { children: jsx(Text, { size: "text-m", font: "font-light", children: text }) })) : null, jsx("textarea", { id: "textarea", placeholder: placeholder, className: style('block w-full resize-y min-h-24 p-m outline-none border rounded-md border-gray', activeTextareaStyles), value: textField.value, onInput: ((e) => textField.onChange && textField.onChange(e.target?.value || '')) })] }));
1471
-
1472
- const formatDate = (date, toTimeStamp = false) => {
1473
- if (typeof date === 'string') {
1474
- return date.split('-').reverse().join('.');
1475
- }
1476
- else {
1477
- const day = String(date.getDate()).padStart(2, '0');
1478
- const month = String(date.getMonth() + 1).padStart(2, '0');
1479
- const year = toTimeStamp ? String(date.getFullYear()) : String(date.getFullYear()).slice(-2);
1480
- return toTimeStamp ? `${year}-${month}-${day}` : `${day}.${month}.${year}`;
1481
- }
1482
- };
1483
-
1484
- const noop = () => {
1485
- // Do nothing
1486
- };
1487
-
1488
- const DAY_COUNT = 6;
1489
- const WEEK_COUNT = 7;
1490
- const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
1491
- const calendarCells = [];
1492
- let dayCounter = 1;
1493
- for (let i = 0; i < DAY_COUNT; i++) {
1494
- const rowCells = [];
1495
- for (let j = 0; j < WEEK_COUNT; j++) {
1496
- if (i === 0 && j < firstDayOfWeek) {
1497
- rowCells.push(jsx("td", {}, `empty-${j}`));
1498
- }
1499
- else if (dayCounter > totalDays) {
1500
- rowCells.push(jsx("td", {}, `empty-${j}`));
1501
- }
1502
- else {
1503
- const currentDate = new Date(currentYear, currentMonth, dayCounter);
1504
- const isToday = checkIsToday(currentDate, today);
1505
- const isDisabled = checkIsDisabled(currentDate, min, max);
1506
- rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
1507
- dayCounter++;
1508
- }
1509
- }
1510
- calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
1511
- }
1512
- return calendarCells;
1662
+ const feedbackValidatorDefaultObject = {
1663
+ typeForm: defaultValidator,
1664
+ region: defaultValidator,
1665
+ surname: defaultValidator,
1666
+ name: nameValidator,
1667
+ feedbackMethod: defaultValidator,
1668
+ phone: phoneValidator,
1669
+ email: defaultValidator,
1670
+ comment: defaultValidator,
1671
+ consentDataProcessing: consentDataProcessingValidator,
1513
1672
  };
1514
- const checkIsToday = (currentDate, today) => today && currentDate.toDateString() === today.toDateString();
1515
- const checkIsDisabled = (currentDate, min, max) => (min && currentDate.getTime() < min.getTime()) || (max && currentDate.getTime() > max.getTime());
1516
- const getDayStyles = (isToday, isDisabled) => style('p-s text-center rounded-md border', isToday ? '' : 'border-transparent hover:bg-gray', isDisabled ? 'text-gray hover:bg-transparent' : 'cursor-pointer');
1517
-
1518
- const WEEK_DAYS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
1519
- const Calendar = JSX(({ today, currentMonth, currentYear, min, max, onDateSelect = noop }) => {
1520
- const handleDateClick = useCallback((date) => onDateSelect(date), []);
1521
- const { firstDayOfWeek, totalDays } = useMemo(() => ({
1522
- firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
1523
- totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
1524
- }), [currentYear, currentMonth]);
1525
- return (jsxs("table", { className: "mx-auto", children: [jsx("thead", { className: "text-gray font-light", children: jsx("tr", { children: WEEK_DAYS.map((day, index) => (jsx("th", { className: "p-s", children: day }, String(index)))) }) }), jsx("tbody", { children: renderCalendarCells({
1526
- firstDayOfWeek,
1527
- today,
1528
- totalDays,
1529
- currentYear,
1530
- currentMonth,
1531
- min,
1532
- max,
1533
- onDateClick: handleDateClick,
1534
- }) })] }));
1535
- });
1536
-
1537
- const months = [
1538
- 'Январь',
1539
- 'Февраль',
1540
- 'Март',
1541
- 'Апрель',
1542
- 'Май',
1543
- 'Июнь',
1544
- 'Июль',
1545
- 'Август',
1546
- 'Сентябрь',
1547
- 'Октябрь',
1548
- 'Ноябрь',
1549
- 'Декабрь',
1550
- ];
1551
-
1552
- const START_YEAR = 1940;
1553
- const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
1554
-
1555
- const MONTHS_COUNT = 11;
1556
- const MONTHS_OPTIONS = months.map((key) => ({ key }));
1557
- const YEARS_OPTIONS = getYears()
1558
- .reverse()
1559
- .map((key) => ({ key: String(key) }));
1560
- const useDatePickerManager = ({ onShowCalendar, showCalendar, selectedMonth, onMonthSelect, onYearSelect, selectedYear, }) => {
1561
- const close = useCallback(() => showCalendar && onShowCalendar(false), [showCalendar]);
1562
- const ref = useOutsideClick(close);
1563
- const handleChangeVisibleCalendar = useCallback(() => onShowCalendar(!showCalendar), [showCalendar]);
1564
- const handleNextMonth = useCallback(() => {
1565
- if (selectedMonth + 1 <= MONTHS_COUNT) {
1566
- onMonthSelect(selectedMonth + 1);
1567
- }
1568
- else {
1569
- onMonthSelect(0);
1570
- onYearSelect(selectedYear + 1);
1571
- }
1572
- }, [selectedMonth]);
1573
- const handlePrevMonth = useCallback(() => {
1574
- if (selectedMonth - 1 >= 0) {
1575
- onMonthSelect(selectedMonth - 1);
1576
- }
1577
- else {
1578
- onMonthSelect(11);
1579
- onYearSelect(selectedYear - 1);
1580
- }
1581
- }, [selectedMonth]);
1582
- const handleSelectMonth = useCallback(({ key }) => onMonthSelect(months.indexOf(key)), []);
1583
- const handleSelectYear = useCallback(({ key }) => onYearSelect(Number(key)), []);
1584
- return {
1585
- handleChangeVisibleCalendar,
1586
- handleNextMonth,
1587
- handlePrevMonth,
1588
- handleSelectMonth,
1589
- handleSelectYear,
1590
- monthsOptions: MONTHS_OPTIONS,
1591
- yearsOptions: YEARS_OPTIONS,
1592
- ref,
1673
+ const handleSubmitIndividual = (formState, onSubmit) => {
1674
+ const feedbackValidator = objectValidator({
1675
+ ...feedbackValidatorDefaultObject,
1676
+ addressBranch: defaultValidator,
1677
+ });
1678
+ const { region, phone, secondaryPhone } = formState;
1679
+ const submitData = {
1680
+ ...formState,
1681
+ typeForm: formState.typeForm.key,
1682
+ addressBranch: formState.addressBranch?.text || '',
1683
+ feedbackMethod: formState.feedbackMethod.text,
1684
+ regionBranch: region?.text,
1685
+ phoneNumber: phone.replace(/[^+\d]/g, ''),
1686
+ secondaryPhoneNumber: secondaryPhone,
1593
1687
  };
1688
+ isValidationSuccess(feedbackValidator(formState)) && onSubmit(submitData);
1594
1689
  };
1595
-
1596
- const ICON_PROPS = {
1597
- name: 'ArrowUpIcon',
1598
- iconVersion: 'black',
1599
- width: '24',
1600
- height: '24',
1601
- };
1602
- const SELECT_PROPS = {
1603
- className: 'min-w-32',
1604
- iconVersion: 'black',
1605
- isBorder: false,
1690
+ const handleSubmitLegal = (formState, onSubmit) => {
1691
+ const feedbackValidator = objectValidator({
1692
+ ...feedbackValidatorDefaultObject,
1693
+ addressBranch: defaultValidator,
1694
+ inn: innValidator,
1695
+ });
1696
+ const { secondaryPhone, email } = formState;
1697
+ const submitData = {
1698
+ ...formState,
1699
+ typeForm: formState.typeForm.key,
1700
+ region: formState.region?.text,
1701
+ addressBranch: formState.addressBranch?.text || '',
1702
+ feedbackMethod: formState.feedbackMethod.text,
1703
+ phone: formState.phone.replace(/[^+\d]/g, ''),
1704
+ secondaryPhoneNumber: secondaryPhone,
1705
+ mail: email,
1706
+ };
1707
+ isValidationSuccess(feedbackValidator(formState)) && onSubmit(submitData, true);
1606
1708
  };
1607
- const formStyle = 'flex justify-between items-center h-14 px-m py-s border rounded-md cursor-pointer ' +
1608
- 'hover:border-black active:border-black focus:border-black';
1609
- const DatePicker = JSX(({ className = '', label = '', value, valid = true, minDate, maxDate, onChange }) => {
1610
- const [showCalendar, { setValue }] = useBool(false);
1611
- const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
1612
- const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
1613
- const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
1614
- onYearSelect: setSelectedYear,
1615
- onMonthSelect: setSelectedMonth,
1616
- onShowCalendar: setValue,
1617
- selectedYear,
1618
- selectedMonth,
1619
- showCalendar,
1709
+ const handleSubmitQuestion = (formState, onSubmit) => {
1710
+ const feedbackValidator = objectValidator({
1711
+ ...feedbackValidatorDefaultObject,
1712
+ birthday: defaultValidator,
1620
1713
  });
1621
- return (jsxs("div", { className: style(className, 'relative'), ref: ref, children: [jsx(Text, { size: "text-m", "font-weight": "font-light", children: label }), renderDatePickerForm(handleChangeVisibleCalendar, value, valid), showCalendar ? (jsxs("div", { className: "absolute bg-white z-20 select-none", children: [jsxs("div", { className: "flex gap-s", children: [jsx("div", { className: "my-auto", onClick: handlePrevMonth, children: jsx(Icon, { ...ICON_PROPS, className: "-rotate-90 cursor-pointer" }) }), jsx(Select, { onChange: handleSelectMonth, value: { key: months[selectedMonth] }, options: monthsOptions, ...SELECT_PROPS }), jsx(Select, { onChange: handleSelectYear, value: { key: String(selectedYear) }, options: yearsOptions, ...SELECT_PROPS }), jsx("div", { className: "my-auto", onClick: handleNextMonth, children: jsx(Icon, { ...ICON_PROPS, className: "rotate-90 cursor-pointer" }) })] }), jsx(Calendar, { today: value, currentMonth: selectedMonth, currentYear: selectedYear, onDateSelect: onChange, min: minDate, max: maxDate })] })) : null] }));
1622
- });
1623
- const renderDatePickerForm = (handleChangeVisibleCalendar, value, valid) => (jsxs("div", { onClick: handleChangeVisibleCalendar, className: style(formStyle, valid ? 'border-gray' : 'border-error'), children: [jsx(Paragraph, { children: value && formatDate(value) }), jsx(Icon, { ...ICON_PROPS, name: "CalendarIcon" })] }));
1624
-
1625
- const DatePickerControl = JSX(({ className, label, value = undefined, error, onChange }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [label ? (jsx("div", { className: "mb-xs", children: jsx(Text, { size: "text-m", font: "font-light", children: label }) })) : null, jsx(DatePicker, { value: value, onChange: onChange, valid: Boolean(!error) }), renderErrorText(error)] })));
1626
-
1627
- const renderUserData = (field) => (jsxs("div", { children: [jsx(InputControl, { label: "\u0424\u0430\u043C\u0438\u043B\u0438\u044F*", ...withValidator(field('surname'), nameValidator) }), jsx(InputControl, { label: "\u0418\u043C\u044F*", ...withValidator(field('name'), nameValidator) }), jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E (\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E, \u043F\u0440\u0438 \u043D\u0430\u043B\u0438\u0447\u0438\u0438)", ...withValidator(field('middleName'), nameValidator) }), jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F*", ...withValidator(field('date'), defaultValidator) })] }));
1714
+ const { region, phone } = formState;
1715
+ const submitData = {
1716
+ ...formState,
1717
+ typeForm: formState.typeForm.key,
1718
+ feedbackMethod: formState.feedbackMethod.text,
1719
+ regionBranch: region?.text,
1720
+ phoneNumber: phone.replace(/[^+\d]/g, ''),
1721
+ };
1722
+ isValidationSuccess(feedbackValidator(formState)) && onSubmit(submitData);
1723
+ };
1628
1724
 
1629
1725
  const initialFormState$2 = {
1630
1726
  typeForm: { key: 'FEEDBACK', text: 'Задать вопрос по продуктам и услугам' },
@@ -1632,48 +1728,37 @@
1632
1728
  surname: '',
1633
1729
  name: '',
1634
1730
  middleName: '',
1635
- date: undefined,
1731
+ birthday: undefined,
1636
1732
  feedbackMethod: { key: 'Телефонный звонок' },
1637
1733
  phone: '',
1638
- phoneAdditional: '',
1639
- mail: '',
1640
- text: '',
1734
+ email: '',
1641
1735
  comment: '',
1642
1736
  consentDataProcessing: false,
1643
1737
  };
1644
- const feedbackValidator = objectValidator({
1645
- typeForm: defaultValidator,
1646
- region: defaultValidator,
1647
- department: defaultValidator,
1648
- name: nameValidator,
1649
- date: defaultValidator,
1650
- feedbackMethod: defaultValidator,
1651
- phone: phoneValidator,
1652
- mail: defaultValidator,
1653
- consentDataProcessing: consentDataProcessingValidator,
1654
- inn: innValidator,
1655
- });
1656
1738
  const ApplicationFormFeedback = JSX(({ button, link, onSubmit }) => {
1657
- const handleSubmit = useCallback((formState) => {
1658
- const submitData = {
1659
- ...formState,
1660
- typeForm: formState.typeForm.key,
1661
- region: formState.region?.text || '',
1662
- department: formState.department?.text || '',
1663
- phone: formState.phone.replace(/[^+\d]/g, ''),
1664
- };
1665
- isValidationSuccess(feedbackValidator(formState)) && onSubmit(submitData);
1739
+ const handleSubmit = useCallback((feedbackFormState) => {
1740
+ const isLegal = getLegalEntity(feedbackFormState.typeForm.key, feedbackFormState.serviceDirection?.key);
1741
+ if (isLegal) {
1742
+ handleSubmitLegal(feedbackFormState, onSubmit);
1743
+ }
1744
+ else if (feedbackFormState.typeForm.key === 'FEEDBACK') {
1745
+ handleSubmitQuestion(feedbackFormState, onSubmit);
1746
+ }
1747
+ else {
1748
+ handleSubmitIndividual(feedbackFormState, onSubmit);
1749
+ }
1666
1750
  }, [onSubmit]);
1667
1751
  const [formState, { field, ...formProps }] = useForm(initialFormState$2, handleSubmit);
1668
- const regions = useGetRegions();
1669
- const branches = useBranches(formState.region?.key).filter((branch) => branch?.address);
1670
- const isQualityService = field('typeForm').value?.key === 'FEEDBACK_QC';
1671
- const isLegalEntity = isQualityService && field('serviceDirection').value?.key === 'Юридическое лицо / ИП';
1672
- return (jsx("form", { className: formStyle$1, onSubmit: formProps.onSubmit, children: jsx(ApplicationFieldsetLayout, { firstChildren: jsxs("div", { className: "w-full max-w-xl space-y-s m-auto", children: [jsx(SelectControl, { label: "\u0422\u0435\u043C\u0430*", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u0435\u043C\u0443", options: FEEDBACK_TYPES, ...withValidator(field('typeForm'), defaultValidator) }), isQualityService ? (jsx(SelectControl, { label: "\u041D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F*", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435", options: SERVICE_DIRECTIONS, ...withValidator(field('serviceDirection'), defaultValidator) })) : null, jsx(SelectControl, { label: "\u0424\u0438\u043B\u0438\u0430\u043B \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F*", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B", isSearch: true, options: regions.map(({ code = '', name = '' }) => ({ key: code, text: name })), ...withValidator(field('region'), defaultValidator) }), jsx(SelectControl, { label: "\u0410\u0434\u0440\u0435\u0441", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0430\u0434\u0440\u0435\u0441", options: branches.map(({ branchCode = '', address = '' }) => ({
1752
+ const branch = useGetRegions();
1753
+ const regions = useBranches(formState?.region?.key).filter((region) => region?.address);
1754
+ const isQualityService = field('typeForm').value?.key === 'FEEDBACK_QS';
1755
+ const isLegalEntity = getLegalEntity(field('typeForm').value?.key, field('serviceDirection').value?.key);
1756
+ return (jsx("form", { className: formStyle$1, onSubmit: formProps.onSubmit, children: jsx(ApplicationFieldsetLayout, { firstChildren: jsxs("div", { className: "w-full max-w-xl space-y-s m-auto", children: [jsx(SelectControl, { label: "\u0422\u0435\u043C\u0430*", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u0435\u043C\u0443", options: FEEDBACK_TYPES, ...withValidator(field('typeForm'), defaultValidator) }), isQualityService ? (jsx(SelectControl, { label: "\u041D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F*", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435", options: SERVICE_DIRECTIONS, ...withValidator(field('serviceDirection'), defaultValidator) })) : null, jsx(SelectControl, { label: "\u0424\u0438\u043B\u0438\u0430\u043B \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F*", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B", isSearch: true, options: branch.map(({ code = '', name = '' }) => ({ key: code, text: name })), ...withValidator(field('region'), defaultValidator) }), isQualityService ? (jsx(SelectControl, { label: "\u0410\u0434\u0440\u0435\u0441*", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0430\u0434\u0440\u0435\u0441", options: regions.map(({ branchCode = '', address = '' }) => ({
1673
1757
  key: branchCode,
1674
1758
  text: address,
1675
- })), ...withValidator(field('department'), defaultValidator) }), renderUserData(field), isLegalEntity ? (jsxs("div", { children: [jsx(InputControl, { label: "\u0418\u041D\u041D", ...withValidator(field('inn'), innValidator) }), jsx(InputControl, { label: "\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", ...withValidator(field('fullName'), defaultValidator) })] })) : null, jsx(SelectControl, { label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043E\u0442\u0432\u0435\u0442\u0430*", options: FEEDBACK_METHOD.map(({ key: key = '' }) => ({ key, text: key })), ...withValidator(field('feedbackMethod'), defaultValidator) }), jsx(PhoneInputControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D*", ...withValidator(field('phone'), phoneValidator) }), isQualityService ? (jsxs("div", { children: [jsx(PhoneInputControl, { label: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0439 \u0442\u0435\u043B\u0435\u0444\u043E\u043D", ...withValidator(field('phoneAdditional'), phoneValidator) }), jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...withValidator(field('mail'), defaultValidator) }), jsx(InputControl, { label: "\u0424\u0418\u041E \u0438\u043B\u0438 \u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u0432\u0448\u0435\u0433\u043E \u0412\u0430\u0441 \u0441\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A\u0430 \u0411\u0430\u043D\u043A\u0430", ...withValidator(field('bankEmpolee'), defaultValidator) }), jsx(InputControl, { label: "\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u044F \u0432 \u0411\u0430\u043D\u043A", ...withValidator(field('applicationDate'), defaultValidator) })] })) : (jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...withValidator(field('mail'), defaultValidator) })), renderTextarea(field('text'), 'Ваше сообщение*'), renderAgreementWithSubmit(field('consentDataProcessing'), link, button)] }) }) }));
1759
+ })), ...withValidator(field('addressBranch'), defaultValidator) })) : null, renderUserData(field), isLegalEntity ? (jsxs("div", { children: [jsx(InputControl, { label: "\u0418\u041D\u041D*", ...withValidator(field('inn'), innValidator) }), jsx(InputControl, { label: "\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", ...field('fullName') })] })) : null, jsx(SelectControl, { label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043E\u0442\u0432\u0435\u0442\u0430*", options: FEEDBACK_METHOD, ...withValidator(field('feedbackMethod'), defaultValidator) }), jsx(PhoneInputControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D*", ...withValidator(field('phone'), phoneValidator) }), isQualityService ? (jsxs("div", { children: [jsx(InputControl, { label: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0439 \u0442\u0435\u043B\u0435\u0444\u043E\u043D", ...field('secondaryPhone') }), jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430*", ...withValidator(field('email'), defaultValidator) }), jsx(InputControl, { label: "\u0424\u0418\u041E \u0438\u043B\u0438 \u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u0432\u0448\u0435\u0433\u043E \u0412\u0430\u0441 \u0441\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A\u0430 \u0411\u0430\u043D\u043A\u0430", ...field('bankEmpolee') }), jsx(InputControl, { label: "\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u044F \u0432 \u0411\u0430\u043D\u043A", ...field('applicationDate') })] })) : (jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430*", ...withValidator(field('email'), defaultValidator) })), jsx(InputControl, { ...withValidator(field('comment'), defaultValidator), placeholder: "\u0412\u0430\u0448\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435*", isTextarea: true }), renderAgreementWithSubmit(field('consentDataProcessing'), link, button)] }) }) }));
1676
1760
  });
1761
+ const getLegalEntity = (typeFormKey = '', serviceDirectionKey = '') => typeFormKey === 'FEEDBACK_QS' && serviceDirectionKey === 'Юридическое лицо / ИП';
1677
1762
 
1678
1763
  const ApplicationFormGrantSupport = JSX((props) => {
1679
1764
  const { button, sourceBookDir } = props;
@@ -1692,8 +1777,8 @@
1692
1777
  name: '',
1693
1778
  middleName: '',
1694
1779
  phone: '',
1695
- mail: '',
1696
- date: undefined,
1780
+ email: '',
1781
+ birthday: undefined,
1697
1782
  consentDataProcessing: true,
1698
1783
  };
1699
1784
  const individualsValidator = objectValidator({
@@ -1701,28 +1786,28 @@
1701
1786
  name: nameValidator,
1702
1787
  middleName: nameValidator,
1703
1788
  phone: phoneValidator,
1704
- mail: defaultValidator,
1705
- date: defaultValidator,
1789
+ email: defaultValidator,
1790
+ birthday: defaultValidator,
1706
1791
  });
1707
1792
  const ApplicationFormIndividuals = JSX((props) => {
1708
1793
  const { button, link, product, onSubmit } = props;
1709
1794
  const handleSubmit = useCallback((formState) => {
1710
- const { surname, name, middleName, phone, mail, date, consentDataProcessing } = formState;
1795
+ const { surname, name, middleName, phone, email, birthday, consentDataProcessing } = formState;
1711
1796
  isValidationSuccess(individualsValidator(formState)) &&
1712
1797
  onSubmit({
1713
1798
  typeForm: 'dpst',
1714
1799
  surname,
1715
1800
  name,
1716
1801
  middleName,
1717
- mail,
1802
+ email,
1718
1803
  consentDataProcessing,
1719
- phone: phone.replace(/[^+\d]/g, ''),
1720
- date: date?.toISOString().slice(0, 10) || '',
1804
+ phoneNumber: phone.replace(/[^+\d]/g, ''),
1805
+ birthday: birthday?.toISOString().slice(0, 10) || '',
1721
1806
  product: product || '',
1722
1807
  }, true);
1723
1808
  }, [onSubmit]);
1724
1809
  const [, { field, ...formProps }] = useForm(initialFormState$1, handleSubmit);
1725
- return (jsxs("form", { className: formStyle$1, onSubmit: formProps.onSubmit, children: [jsx(ApplicationFieldsetLayout, { firstChildren: jsxs("div", { className: formChildrenStyle, children: [jsx(InputControl, { label: "\u0424\u0430\u043C\u0438\u043B\u0438\u044F", ...withValidator(field('surname'), nameValidator) }), jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E", ...withValidator(field('middleName'), nameValidator) }), jsx(PhoneInputControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...withValidator(field('phone'), phoneValidator) })] }), secondChildren: jsxs("div", { className: formChildrenStyle, children: [jsx(InputControl, { label: "\u0418\u043C\u044F", ...withValidator(field('name'), nameValidator) }), jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F*", ...withValidator(field('date'), defaultValidator) }), jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...withValidator(field('mail'), defaultValidator) })] }) }), renderAgreementWithSubmit(field('consentDataProcessing'), link, button)] }));
1810
+ return (jsxs("form", { className: formStyle$1, onSubmit: formProps.onSubmit, children: [jsx(ApplicationFieldsetLayout, { firstChildren: jsxs("div", { className: formChildrenStyle, children: [jsx(InputControl, { label: "\u0424\u0430\u043C\u0438\u043B\u0438\u044F", ...withValidator(field('surname'), nameValidator) }), jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E", ...withValidator(field('middleName'), nameValidator) }), jsx(PhoneInputControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...withValidator(field('phone'), phoneValidator) })] }), secondChildren: jsxs("div", { className: formChildrenStyle, children: [jsx(InputControl, { label: "\u0418\u043C\u044F", ...withValidator(field('name'), nameValidator) }), jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F*", ...withValidator(field('birthday'), defaultValidator) }), jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...withValidator(field('email'), defaultValidator) })] }) }), renderAgreementWithSubmit(field('consentDataProcessing'), link, button)] }));
1726
1811
  });
1727
1812
 
1728
1813
  const renderContacts = () => (jsxs("div", { className: "flex 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": "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": "ved@rshb.ru", href: `mailto:ved@rshb.ru`, children: [jsx(Img, { image: { icon: 'MailIcon' }, width: "24", height: "24" }), jsx("span", { children: "ved@rshb.ru" })] })] }));
@@ -1734,6 +1819,9 @@
1734
1819
  return (jsx(ApplicationFieldsetLayout, { firstChildren: jsxs("div", { className: "gap-xl grid @xl:flex @xl:items-center", children: [jsx(Radio, { name: "vedTypes", text: "\u0412\u0430\u043B\u044E\u0442\u043D\u044B\u0439 \u043A\u043E\u043D\u0442\u0440\u043E\u043B\u044C", value: "currencyControl", checked: value === 'currencyControl', onChange: (_) => onChange && onChange(_) }), jsx(Radio, { name: "vedTypes", text: "\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0440\u043D\u044B\u0435 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438", value: "documentOperations", checked: value === 'documentOperations', onChange: (_) => onChange && onChange(_) }), jsx(Radio, { name: "vedTypes", text: "\u041A\u043E\u043D\u0432\u0435\u0440\u0441\u0438\u043E\u043D\u043D\u044B\u0435 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438", value: "conversionTransactions", checked: value === 'conversionTransactions', onChange: (_) => onChange && onChange(_) }), jsx(Radio, { name: "vedTypes", text: "\u0418\u043D\u044B\u0435 \u0432\u043E\u043F\u0440\u043E\u0441\u044B \u0412\u042D\u0414", value: "otherIssues", checked: value === 'otherIssues', onChange: (_) => onChange && onChange(_) })] }) }));
1735
1820
  };
1736
1821
 
1822
+ const activeTextareaStyles = 'hover:border-primary-hover active:focus:border-primary-text focus:border-primary-text';
1823
+ const renderTextarea = ({ textField, text, placeholder = '', error }) => (jsxs("div", { children: [jsxs("label", { className: "space-y-xs", htmlFor: "textarea", children: [text ? (jsx("div", { children: jsx(Text, { size: "text-m", font: "font-light", children: text }) })) : null, jsx("textarea", { id: "textarea", placeholder: placeholder, className: style('block w-full resize-y min-h-24 p-m outline-none border rounded-md border-gray', activeTextareaStyles), value: textField.value, onInput: ((e) => textField.onChange && textField.onChange(e.target?.value || '')) })] }), renderErrorText(error)] }));
1824
+
1737
1825
  const renderWedDataOrganization = ({ field, regions }) => {
1738
1826
  const isCurrencyControl = field('vedTypes').value === 'currencyControl';
1739
1827
  return (jsxs("div", { className: "space-y-s", children: [isCurrencyControl ? (jsx(SelectControl, { label: "\u0424\u0438\u043B\u0438\u0430\u043B", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B", isSearch: true, options: regions.map(({ code = '', name = '' }) => ({ key: code, text: name })), ...withValidator(field('region'), defaultValidator) })) : null, jsxs("div", { className: "grid @xl:grid-cols-2 @xl:gap-x-lg gap-s", children: [isCurrencyControl ? (jsx(InputControl, { label: "\u0418\u041D\u041D", ...withValidator(field('inn'), innValidator) })) : null, jsx(InputControl, { label: "\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", ...withValidator(field('fullName'), defaultValidator) }), jsx(InputControl, { label: "\u0424\u0418\u041E", ...withValidator(field('name'), nameValidator) }), jsx(PhoneInputControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...withValidator(field('phone'), phoneValidator) }), !isCurrencyControl ? (jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...withValidator(field('mail'), defaultValidator) })) : null] })] }));
@@ -1788,7 +1876,11 @@
1788
1876
  const [, { field, ...formProps }] = useForm(initialFormState, handleSubmit);
1789
1877
  const regions = useGetRegions();
1790
1878
  const textField = field('text');
1791
- return (jsxs("form", { className: "container space-y-lg", onSubmit: formProps.onSubmit, children: [renderQuestionsInterested(field), jsx(Heading, { headingType: "h6", title: "\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", className: "@xl:text-center" }), renderWedDataOrganization({ field, regions }), renderTextarea(textField, 'Обращение', 'Укажите интересующий вас вопрос, место ведения бизнеса и удобное время для телефонного звонка'), renderSubmitButton(button), jsx(Footnote, { link: link }), 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" }), renderContacts()] }));
1879
+ return (jsxs("form", { className: "container space-y-lg", onSubmit: formProps.onSubmit, children: [renderQuestionsInterested(field), jsx(Heading, { headingType: "h6", title: "\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", className: "@xl:text-center" }), renderWedDataOrganization({ field, regions }), renderTextarea({
1880
+ textField,
1881
+ text: 'Обращение',
1882
+ placeholder: 'Укажите интересующий вас вопрос, место ведения бизнеса и удобное время для телефонного звонка',
1883
+ }), renderSubmitButton(button), jsx(Footnote, { link: link }), 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" }), renderContacts()] }));
1792
1884
  });
1793
1885
 
1794
1886
  const EmbeddableForms = {
@@ -1800,6 +1892,7 @@
1800
1892
  ApplicationFormGrantSupport,
1801
1893
  ApplicationFormIndividuals,
1802
1894
  ApplicationFormFeedback,
1895
+ ApplicationFormAntiFraud,
1803
1896
  };
1804
1897
 
1805
1898
  const ResponseNotification = JSX(({ responseType }) => {
@@ -1813,7 +1906,7 @@
1813
1906
  const ApplicationForm = JSX((props) => {
1814
1907
  const { className, formBlock, ...rest } = props;
1815
1908
  const [responseType, setResponseType] = useState('');
1816
- const handleSubmit = useCallback(async (data, isIndividualType) => {
1909
+ const handleSubmit = useCallback(async (data, isIndividualType = false) => {
1817
1910
  const status = (await API.send(data, isIndividualType)) ? 'OK' : 'Fail';
1818
1911
  setResponseType(status);
1819
1912
  return status;
@@ -5889,7 +5982,7 @@
5889
5982
  return (jsx("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: jsx(LikeControl, { className: "rounded-tl-3xl sticky bottom-0 pointer-events-auto" }) }));
5890
5983
  }
5891
5984
 
5892
- const packageVersion = "0.14.133";
5985
+ const packageVersion = "0.14.135";
5893
5986
 
5894
5987
  exports.Blocks = Blocks;
5895
5988
  exports.ContentPage = ContentPage;