@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
@@ -989,7 +989,7 @@
989
989
  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] })));
990
990
  const formChildrenStyle = '@xl:w-1/2 space-y-s';
991
991
 
992
- const Input = JSX(({ key, className = '', inputClassName = '', id, name, type = 'text', label, placeholder, value = '', valid = true, children, onChange, onFocus, onBlur, pattern, autoFocus = false, }) => {
992
+ const Input = JSX(({ key, className = '', id, name, type = 'text', label, placeholder, value = '', valid = true, children, onChange, onFocus, onBlur, pattern, autoFocus = false, isTextarea = false, }) => {
993
993
  const inputRef = useRef(null);
994
994
  const handleChange = useCallback((e) => {
995
995
  onChange && onChange(e.target?.value || '');
@@ -999,16 +999,19 @@
999
999
  inputRef.current?.focus();
1000
1000
  }
1001
1001
  }, [autoFocus, inputRef]);
1002
+ const defaultStyle = 'w-full border rounded-md text-primary-text outline-none p-m';
1002
1003
  const paddingStyle = children ? 'pr-3xl' : '';
1003
- const validStyle = valid
1004
- ? 'border-gray hover:border-primary-hover active:border-primary-text focus:border-primary-text'
1005
- : 'border-error';
1006
- 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] }));
1004
+ const validStyle = getValidStyle(valid);
1005
+ 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] }));
1007
1006
  });
1007
+ const renderLabel$1 = (label) => (jsx("div", { className: "mb-xs", children: jsx(Text, { size: "text-m", font: "font-light", children: label }) }));
1008
+ const getValidStyle = (valid) => valid
1009
+ ? 'border-gray hover:border-primary-hover active:border-primary-text focus:border-primary-text'
1010
+ : 'border-error';
1008
1011
 
1009
1012
  const renderErrorText = (error) => (jsx("div", { className: "h-4", children: error ? (jsx(Text, { size: "text-xs", font: "font-light", color: "text-error", children: error })) : null }));
1010
1013
 
1011
- 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)] })));
1014
+ 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)] })));
1012
1015
 
1013
1016
  const isPlaceholder = (_) => _ === '_';
1014
1017
  const isDigit = (_) => /\d/.test(_);
@@ -1204,7 +1207,7 @@
1204
1207
 
1205
1208
  const renderSubmitButton = (button, className) => (jsx(Button, { className: style('w-full @xl:w-auto', className), type: "submit", children: button?.text ? button.text : 'Отправить заявку' }));
1206
1209
 
1207
- const initialFormState$6 = {
1210
+ const initialFormState$7 = {
1208
1211
  acquiringType: { key: 'Торговый эквайринг' },
1209
1212
  fullName: '',
1210
1213
  inn: '',
@@ -1236,11 +1239,231 @@
1236
1239
  phone: phone.replace(/[^+\d]/g, ''),
1237
1240
  });
1238
1241
  }, [onSubmit]);
1239
- const [, { field, ...formProps }] = useForm(initialFormState$6, handleSubmit);
1242
+ const [, { field, ...formProps }] = useForm(initialFormState$7, handleSubmit);
1240
1243
  const regions = useGetRegions();
1241
1244
  return (jsxs("form", { className: formStyle$1, onSubmit: formProps.onSubmit, children: [renderAcquiringRegion({ regions, field, title: 'Вид эквайринга и регион' }), renderAcquiringDataOrganization(field, 'Данные организации'), renderSlideCheckboxes(field), renderSubmitButton(button), jsx(Footnote, { link: link })] }));
1242
1245
  });
1243
1246
 
1247
+ const SVG = JSX(({ className, viewBox, fill = 'none', width, height, paths, ...commonOptions }) => {
1248
+ 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) => {
1249
+ const resultOptions = { ...commonOptions, ...options };
1250
+ return (jsx("path", { d: d, fill: pathFill || 'currentColor', stroke: resultOptions.stroke, strokeLinecap: resultOptions.strokeLinecap, strokeLinejoin: resultOptions.strokeLinejoin, strokeWidth: resultOptions.strokeWidth, strokeMiterlimit: resultOptions.strokeMiterlimit }, i));
1251
+ }) }));
1252
+ });
1253
+
1254
+ const CHECK_PATHS = [
1255
+ {
1256
+ 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',
1257
+ fillRule: 'evenodd',
1258
+ clipRule: 'evenodd',
1259
+ fill: 'white',
1260
+ },
1261
+ ];
1262
+ const Checkbox = JSX(({ className, value, text, disabled, isRadio, onChange }) => {
1263
+ const handleChange = useCallback((e) => {
1264
+ if (disabled) {
1265
+ return;
1266
+ }
1267
+ e.preventDefault();
1268
+ onChange && onChange(!value);
1269
+ }, [onChange, disabled, value]);
1270
+ 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" }));
1271
+ 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] }) }));
1272
+ });
1273
+ const checkboxStyle = (value) => style('rounded border', value ? 'bg-primary-main' : '');
1274
+
1275
+ 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)] }));
1276
+
1277
+ const formatDate = (date, toTimeStamp = false) => {
1278
+ if (typeof date === 'string') {
1279
+ return date.split('-').reverse().join('.');
1280
+ }
1281
+ else {
1282
+ const day = String(date.getDate()).padStart(2, '0');
1283
+ const month = String(date.getMonth() + 1).padStart(2, '0');
1284
+ const year = toTimeStamp ? String(date.getFullYear()) : String(date.getFullYear()).slice(-2);
1285
+ return toTimeStamp ? `${year}-${month}-${day}` : `${day}.${month}.${year}`;
1286
+ }
1287
+ };
1288
+
1289
+ const noop = () => {
1290
+ // Do nothing
1291
+ };
1292
+
1293
+ const DAY_COUNT = 6;
1294
+ const WEEK_COUNT = 7;
1295
+ const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
1296
+ const calendarCells = [];
1297
+ let dayCounter = 1;
1298
+ for (let i = 0; i < DAY_COUNT; i++) {
1299
+ const rowCells = [];
1300
+ for (let j = 0; j < WEEK_COUNT; j++) {
1301
+ if (i === 0 && j < firstDayOfWeek) {
1302
+ rowCells.push(jsx("td", {}, `empty-${j}`));
1303
+ }
1304
+ else if (dayCounter > totalDays) {
1305
+ rowCells.push(jsx("td", {}, `empty-${j}`));
1306
+ }
1307
+ else {
1308
+ const currentDate = new Date(currentYear, currentMonth, dayCounter);
1309
+ const isToday = checkIsToday(currentDate, today);
1310
+ const isDisabled = checkIsDisabled(currentDate, min, max);
1311
+ rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
1312
+ dayCounter++;
1313
+ }
1314
+ }
1315
+ calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
1316
+ }
1317
+ return calendarCells;
1318
+ };
1319
+ const checkIsToday = (currentDate, today) => today && currentDate.toDateString() === today.toDateString();
1320
+ const checkIsDisabled = (currentDate, min, max) => (min && currentDate.getTime() < min.getTime()) || (max && currentDate.getTime() > max.getTime());
1321
+ 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');
1322
+
1323
+ const WEEK_DAYS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
1324
+ const Calendar = JSX(({ today, currentMonth, currentYear, min, max, onDateSelect = noop }) => {
1325
+ const handleDateClick = useCallback((date) => onDateSelect(date), []);
1326
+ const { firstDayOfWeek, totalDays } = useMemo(() => ({
1327
+ firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
1328
+ totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
1329
+ }), [currentYear, currentMonth]);
1330
+ 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({
1331
+ firstDayOfWeek,
1332
+ today,
1333
+ totalDays,
1334
+ currentYear,
1335
+ currentMonth,
1336
+ min,
1337
+ max,
1338
+ onDateClick: handleDateClick,
1339
+ }) })] }));
1340
+ });
1341
+
1342
+ const months = [
1343
+ 'Январь',
1344
+ 'Февраль',
1345
+ 'Март',
1346
+ 'Апрель',
1347
+ 'Май',
1348
+ 'Июнь',
1349
+ 'Июль',
1350
+ 'Август',
1351
+ 'Сентябрь',
1352
+ 'Октябрь',
1353
+ 'Ноябрь',
1354
+ 'Декабрь',
1355
+ ];
1356
+
1357
+ const START_YEAR = 1940;
1358
+ const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
1359
+
1360
+ const MONTHS_COUNT = 11;
1361
+ const MONTHS_OPTIONS = months.map((key) => ({ key }));
1362
+ const YEARS_OPTIONS = getYears()
1363
+ .reverse()
1364
+ .map((key) => ({ key: String(key) }));
1365
+ const useDatePickerManager = ({ onShowCalendar, showCalendar, selectedMonth, onMonthSelect, onYearSelect, selectedYear, }) => {
1366
+ const close = useCallback(() => showCalendar && onShowCalendar(false), [showCalendar]);
1367
+ const ref = useOutsideClick(close);
1368
+ const handleChangeVisibleCalendar = useCallback(() => onShowCalendar(!showCalendar), [showCalendar]);
1369
+ const handleNextMonth = useCallback(() => {
1370
+ if (selectedMonth + 1 <= MONTHS_COUNT) {
1371
+ onMonthSelect(selectedMonth + 1);
1372
+ }
1373
+ else {
1374
+ onMonthSelect(0);
1375
+ onYearSelect(selectedYear + 1);
1376
+ }
1377
+ }, [selectedMonth]);
1378
+ const handlePrevMonth = useCallback(() => {
1379
+ if (selectedMonth - 1 >= 0) {
1380
+ onMonthSelect(selectedMonth - 1);
1381
+ }
1382
+ else {
1383
+ onMonthSelect(11);
1384
+ onYearSelect(selectedYear - 1);
1385
+ }
1386
+ }, [selectedMonth]);
1387
+ const handleSelectMonth = useCallback(({ key }) => onMonthSelect(months.indexOf(key)), []);
1388
+ const handleSelectYear = useCallback(({ key }) => onYearSelect(Number(key)), []);
1389
+ return {
1390
+ handleChangeVisibleCalendar,
1391
+ handleNextMonth,
1392
+ handlePrevMonth,
1393
+ handleSelectMonth,
1394
+ handleSelectYear,
1395
+ monthsOptions: MONTHS_OPTIONS,
1396
+ yearsOptions: YEARS_OPTIONS,
1397
+ ref,
1398
+ };
1399
+ };
1400
+
1401
+ const ICON_PROPS = {
1402
+ name: 'ArrowUpIcon',
1403
+ iconVersion: 'black',
1404
+ width: '24',
1405
+ height: '24',
1406
+ };
1407
+ const SELECT_PROPS = {
1408
+ className: 'min-w-32',
1409
+ iconVersion: 'black',
1410
+ isBorder: false,
1411
+ };
1412
+ const formStyle = 'flex justify-between items-center h-14 px-m py-s border rounded-md cursor-pointer ' +
1413
+ 'hover:border-black active:border-black focus:border-black';
1414
+ const DatePicker = JSX(({ className = '', label = '', value, valid = true, minDate, maxDate, onChange }) => {
1415
+ const [showCalendar, { setValue }] = useBool(false);
1416
+ const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
1417
+ const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
1418
+ const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
1419
+ onYearSelect: setSelectedYear,
1420
+ onMonthSelect: setSelectedMonth,
1421
+ onShowCalendar: setValue,
1422
+ selectedYear,
1423
+ selectedMonth,
1424
+ showCalendar,
1425
+ });
1426
+ 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] }));
1427
+ });
1428
+ 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" })] }));
1429
+
1430
+ 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)] })));
1431
+
1432
+ 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) })] }));
1433
+
1434
+ const initialFormState$6 = {
1435
+ typeForm: { key: 'ANTIFRAUD', text: 'Предупреждение о мошенничестве' },
1436
+ surname: '',
1437
+ name: '',
1438
+ middleName: '',
1439
+ phone: '',
1440
+ birthday: undefined,
1441
+ isClient: false,
1442
+ comment: '',
1443
+ consentDataProcessing: false,
1444
+ };
1445
+ const feedbackValidator = objectValidator({
1446
+ typeForm: defaultValidator,
1447
+ surname: defaultValidator,
1448
+ name: nameValidator,
1449
+ birthday: defaultValidator,
1450
+ phone: phoneValidator,
1451
+ consentDataProcessing: consentDataProcessingValidator,
1452
+ });
1453
+ const ApplicationFormAntiFraud = JSX(({ button, link, onSubmit }) => {
1454
+ const handleSubmit = useCallback((formState) => {
1455
+ const { typeForm, phone, ...usedFields } = formState;
1456
+ const submitData = {
1457
+ ...usedFields,
1458
+ typeForm: typeForm.key,
1459
+ phone: phone.replace(/[^+\d]/g, ''),
1460
+ };
1461
+ isValidationSuccess(feedbackValidator(formState)) && onSubmit(submitData);
1462
+ }, [onSubmit]);
1463
+ const [, { field, ...formProps }] = useForm(initialFormState$6, handleSubmit);
1464
+ 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)] }) }) }));
1465
+ });
1466
+
1244
1467
  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) })] }) }));
1245
1468
 
1246
1469
  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) }));
@@ -1432,7 +1655,7 @@
1432
1655
  },
1433
1656
  {
1434
1657
  text: 'Качество обслуживания',
1435
- key: 'FEEDBACK_QC',
1658
+ key: 'FEEDBACK_QS',
1436
1659
  },
1437
1660
  ];
1438
1661
  const FEEDBACK_METHOD = [
@@ -1444,195 +1667,68 @@
1444
1667
  { key: 'Юридическое лицо / ИП' },
1445
1668
  ];
1446
1669
 
1447
- const SVG = JSX(({ className, viewBox, fill = 'none', width, height, paths, ...commonOptions }) => {
1448
- 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) => {
1449
- const resultOptions = { ...commonOptions, ...options };
1450
- return (jsx("path", { d: d, fill: pathFill || 'currentColor', stroke: resultOptions.stroke, strokeLinecap: resultOptions.strokeLinecap, strokeLinejoin: resultOptions.strokeLinejoin, strokeWidth: resultOptions.strokeWidth, strokeMiterlimit: resultOptions.strokeMiterlimit }, i));
1451
- }) }));
1452
- });
1453
-
1454
- const CHECK_PATHS = [
1455
- {
1456
- 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',
1457
- fillRule: 'evenodd',
1458
- clipRule: 'evenodd',
1459
- fill: 'white',
1460
- },
1461
- ];
1462
- const Checkbox = JSX(({ className, value, text, disabled, isRadio, onChange }) => {
1463
- const handleChange = useCallback((e) => {
1464
- if (disabled) {
1465
- return;
1466
- }
1467
- e.preventDefault();
1468
- onChange && onChange(!value);
1469
- }, [onChange, disabled, value]);
1470
- 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" }));
1471
- 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] }) }));
1472
- });
1473
- const checkboxStyle = (value) => style('rounded border', value ? 'bg-primary-main' : '');
1474
-
1475
- 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)] }));
1476
-
1477
- const activeTextareaStyles = 'hover:border-primary-hover active:focus:border-primary-text focus:border-primary-text';
1478
- 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 || '')) })] }));
1479
-
1480
- const formatDate = (date, toTimeStamp = false) => {
1481
- if (typeof date === 'string') {
1482
- return date.split('-').reverse().join('.');
1483
- }
1484
- else {
1485
- const day = String(date.getDate()).padStart(2, '0');
1486
- const month = String(date.getMonth() + 1).padStart(2, '0');
1487
- const year = toTimeStamp ? String(date.getFullYear()) : String(date.getFullYear()).slice(-2);
1488
- return toTimeStamp ? `${year}-${month}-${day}` : `${day}.${month}.${year}`;
1489
- }
1490
- };
1491
-
1492
- const noop = () => {
1493
- // Do nothing
1494
- };
1495
-
1496
- const DAY_COUNT = 6;
1497
- const WEEK_COUNT = 7;
1498
- const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
1499
- const calendarCells = [];
1500
- let dayCounter = 1;
1501
- for (let i = 0; i < DAY_COUNT; i++) {
1502
- const rowCells = [];
1503
- for (let j = 0; j < WEEK_COUNT; j++) {
1504
- if (i === 0 && j < firstDayOfWeek) {
1505
- rowCells.push(jsx("td", {}, `empty-${j}`));
1506
- }
1507
- else if (dayCounter > totalDays) {
1508
- rowCells.push(jsx("td", {}, `empty-${j}`));
1509
- }
1510
- else {
1511
- const currentDate = new Date(currentYear, currentMonth, dayCounter);
1512
- const isToday = checkIsToday(currentDate, today);
1513
- const isDisabled = checkIsDisabled(currentDate, min, max);
1514
- rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
1515
- dayCounter++;
1516
- }
1517
- }
1518
- calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
1519
- }
1520
- return calendarCells;
1670
+ const feedbackValidatorDefaultObject = {
1671
+ typeForm: defaultValidator,
1672
+ region: defaultValidator,
1673
+ surname: defaultValidator,
1674
+ name: nameValidator,
1675
+ feedbackMethod: defaultValidator,
1676
+ phone: phoneValidator,
1677
+ email: defaultValidator,
1678
+ comment: defaultValidator,
1679
+ consentDataProcessing: consentDataProcessingValidator,
1521
1680
  };
1522
- const checkIsToday = (currentDate, today) => today && currentDate.toDateString() === today.toDateString();
1523
- const checkIsDisabled = (currentDate, min, max) => (min && currentDate.getTime() < min.getTime()) || (max && currentDate.getTime() > max.getTime());
1524
- 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');
1525
-
1526
- const WEEK_DAYS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
1527
- const Calendar = JSX(({ today, currentMonth, currentYear, min, max, onDateSelect = noop }) => {
1528
- const handleDateClick = useCallback((date) => onDateSelect(date), []);
1529
- const { firstDayOfWeek, totalDays } = useMemo(() => ({
1530
- firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
1531
- totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
1532
- }), [currentYear, currentMonth]);
1533
- 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({
1534
- firstDayOfWeek,
1535
- today,
1536
- totalDays,
1537
- currentYear,
1538
- currentMonth,
1539
- min,
1540
- max,
1541
- onDateClick: handleDateClick,
1542
- }) })] }));
1543
- });
1544
-
1545
- const months = [
1546
- 'Январь',
1547
- 'Февраль',
1548
- 'Март',
1549
- 'Апрель',
1550
- 'Май',
1551
- 'Июнь',
1552
- 'Июль',
1553
- 'Август',
1554
- 'Сентябрь',
1555
- 'Октябрь',
1556
- 'Ноябрь',
1557
- 'Декабрь',
1558
- ];
1559
-
1560
- const START_YEAR = 1940;
1561
- const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
1562
-
1563
- const MONTHS_COUNT = 11;
1564
- const MONTHS_OPTIONS = months.map((key) => ({ key }));
1565
- const YEARS_OPTIONS = getYears()
1566
- .reverse()
1567
- .map((key) => ({ key: String(key) }));
1568
- const useDatePickerManager = ({ onShowCalendar, showCalendar, selectedMonth, onMonthSelect, onYearSelect, selectedYear, }) => {
1569
- const close = useCallback(() => showCalendar && onShowCalendar(false), [showCalendar]);
1570
- const ref = useOutsideClick(close);
1571
- const handleChangeVisibleCalendar = useCallback(() => onShowCalendar(!showCalendar), [showCalendar]);
1572
- const handleNextMonth = useCallback(() => {
1573
- if (selectedMonth + 1 <= MONTHS_COUNT) {
1574
- onMonthSelect(selectedMonth + 1);
1575
- }
1576
- else {
1577
- onMonthSelect(0);
1578
- onYearSelect(selectedYear + 1);
1579
- }
1580
- }, [selectedMonth]);
1581
- const handlePrevMonth = useCallback(() => {
1582
- if (selectedMonth - 1 >= 0) {
1583
- onMonthSelect(selectedMonth - 1);
1584
- }
1585
- else {
1586
- onMonthSelect(11);
1587
- onYearSelect(selectedYear - 1);
1588
- }
1589
- }, [selectedMonth]);
1590
- const handleSelectMonth = useCallback(({ key }) => onMonthSelect(months.indexOf(key)), []);
1591
- const handleSelectYear = useCallback(({ key }) => onYearSelect(Number(key)), []);
1592
- return {
1593
- handleChangeVisibleCalendar,
1594
- handleNextMonth,
1595
- handlePrevMonth,
1596
- handleSelectMonth,
1597
- handleSelectYear,
1598
- monthsOptions: MONTHS_OPTIONS,
1599
- yearsOptions: YEARS_OPTIONS,
1600
- ref,
1681
+ const handleSubmitIndividual = (formState, onSubmit) => {
1682
+ const feedbackValidator = objectValidator({
1683
+ ...feedbackValidatorDefaultObject,
1684
+ addressBranch: defaultValidator,
1685
+ });
1686
+ const { region, phone, secondaryPhone } = formState;
1687
+ const submitData = {
1688
+ ...formState,
1689
+ typeForm: formState.typeForm.key,
1690
+ addressBranch: formState.addressBranch?.text || '',
1691
+ feedbackMethod: formState.feedbackMethod.text,
1692
+ regionBranch: region?.text,
1693
+ phoneNumber: phone.replace(/[^+\d]/g, ''),
1694
+ secondaryPhoneNumber: secondaryPhone,
1601
1695
  };
1696
+ isValidationSuccess(feedbackValidator(formState)) && onSubmit(submitData);
1602
1697
  };
1603
-
1604
- const ICON_PROPS = {
1605
- name: 'ArrowUpIcon',
1606
- iconVersion: 'black',
1607
- width: '24',
1608
- height: '24',
1609
- };
1610
- const SELECT_PROPS = {
1611
- className: 'min-w-32',
1612
- iconVersion: 'black',
1613
- isBorder: false,
1698
+ const handleSubmitLegal = (formState, onSubmit) => {
1699
+ const feedbackValidator = objectValidator({
1700
+ ...feedbackValidatorDefaultObject,
1701
+ addressBranch: defaultValidator,
1702
+ inn: innValidator,
1703
+ });
1704
+ const { secondaryPhone, email } = formState;
1705
+ const submitData = {
1706
+ ...formState,
1707
+ typeForm: formState.typeForm.key,
1708
+ region: formState.region?.text,
1709
+ addressBranch: formState.addressBranch?.text || '',
1710
+ feedbackMethod: formState.feedbackMethod.text,
1711
+ phone: formState.phone.replace(/[^+\d]/g, ''),
1712
+ secondaryPhoneNumber: secondaryPhone,
1713
+ mail: email,
1714
+ };
1715
+ isValidationSuccess(feedbackValidator(formState)) && onSubmit(submitData, true);
1614
1716
  };
1615
- const formStyle = 'flex justify-between items-center h-14 px-m py-s border rounded-md cursor-pointer ' +
1616
- 'hover:border-black active:border-black focus:border-black';
1617
- const DatePicker = JSX(({ className = '', label = '', value, valid = true, minDate, maxDate, onChange }) => {
1618
- const [showCalendar, { setValue }] = useBool(false);
1619
- const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
1620
- const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
1621
- const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
1622
- onYearSelect: setSelectedYear,
1623
- onMonthSelect: setSelectedMonth,
1624
- onShowCalendar: setValue,
1625
- selectedYear,
1626
- selectedMonth,
1627
- showCalendar,
1717
+ const handleSubmitQuestion = (formState, onSubmit) => {
1718
+ const feedbackValidator = objectValidator({
1719
+ ...feedbackValidatorDefaultObject,
1720
+ birthday: defaultValidator,
1628
1721
  });
1629
- 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] }));
1630
- });
1631
- 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" })] }));
1632
-
1633
- 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)] })));
1634
-
1635
- 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) })] }));
1722
+ const { region, phone } = formState;
1723
+ const submitData = {
1724
+ ...formState,
1725
+ typeForm: formState.typeForm.key,
1726
+ feedbackMethod: formState.feedbackMethod.text,
1727
+ regionBranch: region?.text,
1728
+ phoneNumber: phone.replace(/[^+\d]/g, ''),
1729
+ };
1730
+ isValidationSuccess(feedbackValidator(formState)) && onSubmit(submitData);
1731
+ };
1636
1732
 
1637
1733
  const initialFormState$2 = {
1638
1734
  typeForm: { key: 'FEEDBACK', text: 'Задать вопрос по продуктам и услугам' },
@@ -1640,48 +1736,37 @@
1640
1736
  surname: '',
1641
1737
  name: '',
1642
1738
  middleName: '',
1643
- date: undefined,
1739
+ birthday: undefined,
1644
1740
  feedbackMethod: { key: 'Телефонный звонок' },
1645
1741
  phone: '',
1646
- phoneAdditional: '',
1647
- mail: '',
1648
- text: '',
1742
+ email: '',
1649
1743
  comment: '',
1650
1744
  consentDataProcessing: false,
1651
1745
  };
1652
- const feedbackValidator = objectValidator({
1653
- typeForm: defaultValidator,
1654
- region: defaultValidator,
1655
- department: defaultValidator,
1656
- name: nameValidator,
1657
- date: defaultValidator,
1658
- feedbackMethod: defaultValidator,
1659
- phone: phoneValidator,
1660
- mail: defaultValidator,
1661
- consentDataProcessing: consentDataProcessingValidator,
1662
- inn: innValidator,
1663
- });
1664
1746
  const ApplicationFormFeedback = JSX(({ button, link, onSubmit }) => {
1665
- const handleSubmit = useCallback((formState) => {
1666
- const submitData = {
1667
- ...formState,
1668
- typeForm: formState.typeForm.key,
1669
- region: formState.region?.text || '',
1670
- department: formState.department?.text || '',
1671
- phone: formState.phone.replace(/[^+\d]/g, ''),
1672
- };
1673
- isValidationSuccess(feedbackValidator(formState)) && onSubmit(submitData);
1747
+ const handleSubmit = useCallback((feedbackFormState) => {
1748
+ const isLegal = getLegalEntity(feedbackFormState.typeForm.key, feedbackFormState.serviceDirection?.key);
1749
+ if (isLegal) {
1750
+ handleSubmitLegal(feedbackFormState, onSubmit);
1751
+ }
1752
+ else if (feedbackFormState.typeForm.key === 'FEEDBACK') {
1753
+ handleSubmitQuestion(feedbackFormState, onSubmit);
1754
+ }
1755
+ else {
1756
+ handleSubmitIndividual(feedbackFormState, onSubmit);
1757
+ }
1674
1758
  }, [onSubmit]);
1675
1759
  const [formState, { field, ...formProps }] = useForm(initialFormState$2, handleSubmit);
1676
- const regions = useGetRegions();
1677
- const branches = useBranches(formState.region?.key).filter((branch) => branch?.address);
1678
- const isQualityService = field('typeForm').value?.key === 'FEEDBACK_QC';
1679
- const isLegalEntity = isQualityService && field('serviceDirection').value?.key === 'Юридическое лицо / ИП';
1680
- 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 = '' }) => ({
1760
+ const branch = useGetRegions();
1761
+ const regions = useBranches(formState?.region?.key).filter((region) => region?.address);
1762
+ const isQualityService = field('typeForm').value?.key === 'FEEDBACK_QS';
1763
+ const isLegalEntity = getLegalEntity(field('typeForm').value?.key, field('serviceDirection').value?.key);
1764
+ 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 = '' }) => ({
1681
1765
  key: branchCode,
1682
1766
  text: address,
1683
- })), ...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)] }) }) }));
1767
+ })), ...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)] }) }) }));
1684
1768
  });
1769
+ const getLegalEntity = (typeFormKey = '', serviceDirectionKey = '') => typeFormKey === 'FEEDBACK_QS' && serviceDirectionKey === 'Юридическое лицо / ИП';
1685
1770
 
1686
1771
  const ApplicationFormGrantSupport = JSX((props) => {
1687
1772
  const { button, sourceBookDir } = props;
@@ -1700,8 +1785,8 @@
1700
1785
  name: '',
1701
1786
  middleName: '',
1702
1787
  phone: '',
1703
- mail: '',
1704
- date: undefined,
1788
+ email: '',
1789
+ birthday: undefined,
1705
1790
  consentDataProcessing: true,
1706
1791
  };
1707
1792
  const individualsValidator = objectValidator({
@@ -1709,28 +1794,28 @@
1709
1794
  name: nameValidator,
1710
1795
  middleName: nameValidator,
1711
1796
  phone: phoneValidator,
1712
- mail: defaultValidator,
1713
- date: defaultValidator,
1797
+ email: defaultValidator,
1798
+ birthday: defaultValidator,
1714
1799
  });
1715
1800
  const ApplicationFormIndividuals = JSX((props) => {
1716
1801
  const { button, link, product, onSubmit } = props;
1717
1802
  const handleSubmit = useCallback((formState) => {
1718
- const { surname, name, middleName, phone, mail, date, consentDataProcessing } = formState;
1803
+ const { surname, name, middleName, phone, email, birthday, consentDataProcessing } = formState;
1719
1804
  isValidationSuccess(individualsValidator(formState)) &&
1720
1805
  onSubmit({
1721
1806
  typeForm: 'dpst',
1722
1807
  surname,
1723
1808
  name,
1724
1809
  middleName,
1725
- mail,
1810
+ email,
1726
1811
  consentDataProcessing,
1727
- phone: phone.replace(/[^+\d]/g, ''),
1728
- date: date?.toISOString().slice(0, 10) || '',
1812
+ phoneNumber: phone.replace(/[^+\d]/g, ''),
1813
+ birthday: birthday?.toISOString().slice(0, 10) || '',
1729
1814
  product: product || '',
1730
1815
  }, true);
1731
1816
  }, [onSubmit]);
1732
1817
  const [, { field, ...formProps }] = useForm(initialFormState$1, handleSubmit);
1733
- 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)] }));
1818
+ 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)] }));
1734
1819
  });
1735
1820
 
1736
1821
  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" })] })] }));
@@ -1742,6 +1827,9 @@
1742
1827
  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(_) })] }) }));
1743
1828
  };
1744
1829
 
1830
+ const activeTextareaStyles = 'hover:border-primary-hover active:focus:border-primary-text focus:border-primary-text';
1831
+ 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)] }));
1832
+
1745
1833
  const renderWedDataOrganization = ({ field, regions }) => {
1746
1834
  const isCurrencyControl = field('vedTypes').value === 'currencyControl';
1747
1835
  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] })] }));
@@ -1796,7 +1884,11 @@
1796
1884
  const [, { field, ...formProps }] = useForm(initialFormState, handleSubmit);
1797
1885
  const regions = useGetRegions();
1798
1886
  const textField = field('text');
1799
- 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()] }));
1887
+ 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({
1888
+ textField,
1889
+ text: 'Обращение',
1890
+ placeholder: 'Укажите интересующий вас вопрос, место ведения бизнеса и удобное время для телефонного звонка',
1891
+ }), 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()] }));
1800
1892
  });
1801
1893
 
1802
1894
  const EmbeddableForms = {
@@ -1808,6 +1900,7 @@
1808
1900
  ApplicationFormGrantSupport,
1809
1901
  ApplicationFormIndividuals,
1810
1902
  ApplicationFormFeedback,
1903
+ ApplicationFormAntiFraud,
1811
1904
  };
1812
1905
 
1813
1906
  const ResponseNotification = JSX(({ responseType }) => {
@@ -1821,7 +1914,7 @@
1821
1914
  const ApplicationForm = JSX((props) => {
1822
1915
  const { className, formBlock, ...rest } = props;
1823
1916
  const [responseType, setResponseType] = useState('');
1824
- const handleSubmit = useCallback(async (data, isIndividualType) => {
1917
+ const handleSubmit = useCallback(async (data, isIndividualType = false) => {
1825
1918
  const status = (await API.send(data, isIndividualType)) ? 'OK' : 'Fail';
1826
1919
  setResponseType(status);
1827
1920
  return status;
@@ -5511,7 +5604,7 @@
5511
5604
 
5512
5605
  const joinList = (sep) => (list) => list.reduce((acc, el, i) => (acc.length ? acc.concat({ ...sep, key: `sep-${i}` }, el) : [el]), []);
5513
5606
 
5514
- const packageVersion = "0.14.133";
5607
+ const packageVersion = "0.14.135";
5515
5608
 
5516
5609
  exports.Blocks = Blocks;
5517
5610
  exports.ContentPage = ContentPage;