@redneckz/wildless-cms-uni-blocks 0.14.724 → 0.14.726

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 (849) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +1810 -1827
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
  5. package/bundle/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
  6. package/bundle/components/ApplicationLeadForm/consents.d.ts +2 -2
  7. package/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  8. package/bundle/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
  9. package/bundle/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
  10. package/bundle/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.d.ts +1 -1
  11. package/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
  12. package/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
  13. package/bundle/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
  14. package/bundle/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
  15. package/bundle/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
  16. package/bundle/components/CreditCardForm/formStateMap.d.ts +1 -1
  17. package/bundle/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
  18. package/bundle/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
  19. package/bundle/components/CreditCardForm/getInitialFormState.d.ts +1 -1
  20. package/bundle/components/CreditCardForm/renderInputs.d.ts +2 -2
  21. package/bundle/components/CreditCardForm/renderStep.d.ts +1 -1
  22. package/bundle/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
  23. package/bundle/components/CreditForm/formStateMap.d.ts +1 -1
  24. package/bundle/components/CreditForm/getCalcData.d.ts +1 -1
  25. package/bundle/components/CreditForm/getInitialFormState.d.ts +1 -1
  26. package/bundle/components/CreditForm/renderInfo.d.ts +1 -1
  27. package/bundle/components/CreditForm/renderInputs.d.ts +2 -2
  28. package/bundle/components/CreditForm/renderStep.d.ts +1 -1
  29. package/bundle/components/CreditForm/useCreditFormAPI.d.ts +2 -2
  30. package/bundle/components/CreditForm/utils.d.ts +1 -1
  31. package/bundle/hooks/useLeadFormData.d.ts +2 -2
  32. package/bundle/hooks/useRetailFormStore.d.ts +10 -10
  33. package/bundle/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
  34. package/bundle/services/retail/adaptors/getCalculatorData.d.ts +1 -1
  35. package/bundle/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
  36. package/bundle/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
  37. package/bundle/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
  38. package/bundle/services/retail/adaptors/getEmploymentData.d.ts +1 -1
  39. package/bundle/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
  40. package/bundle/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
  41. package/bundle/services/retail/external/types.d.ts +10 -0
  42. package/bundle/services/retail/external/utils.d.ts +2 -0
  43. package/bundle/services/retail/inputs.d.ts +75 -0
  44. package/{dist/api/RetailAPI → bundle/services/retail}/model/LeadFormData.d.ts +1 -1
  45. package/bundle/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.d.ts +18 -18
  46. package/bundle/services/retail/model/RetailFormContent.d.ts +63 -0
  47. package/bundle/{components/CreditCardForm → services/retail/utils}/calculateInputs.d.ts +2 -2
  48. package/bundle/services/retail/utils/getOrganizationParams.d.ts +17 -0
  49. package/bundle/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
  50. package/bundle/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
  51. package/bundle/ui-kit/DraftDialog/utils.d.ts +2 -2
  52. package/bundle/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
  53. package/bundle/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
  54. package/bundle/ui-kit/FormField/NameFieldDef.d.ts +6 -1
  55. package/bundle/ui-kit/FormField/SelectField.d.ts +2 -2
  56. package/bundle/ui-kit/FormField/getField.d.ts +2 -1
  57. package/bundle/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
  58. package/bundle/ui-kit/FormField/getObjectValidator.d.ts +1 -1
  59. package/bundle/ui-kit/FormField/getPremium.d.ts +1 -1
  60. package/bundle/ui-kit/FormField/validators.d.ts +3 -2
  61. package/dist/components/ApplicationForm/ApplicationForm.js +1 -3
  62. package/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  63. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +1 -1
  64. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  65. package/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
  66. package/dist/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
  67. package/dist/components/ApplicationLeadForm/GroupedConsents.js +2 -1
  68. package/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  69. package/dist/components/ApplicationLeadForm/consents.d.ts +2 -2
  70. package/dist/components/ApplicationLeadForm/consents.js +0 -3
  71. package/dist/components/ApplicationLeadForm/consents.js.map +1 -1
  72. package/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  73. package/dist/components/ApplicationLeadForm/getInitialFormState.js +0 -2
  74. package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  75. package/dist/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
  76. package/dist/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
  77. package/dist/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
  78. package/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
  79. package/dist/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.d.ts +1 -1
  80. package/{mobile/dist/components/ApplicationForm → dist/components/ApplicationLeadForm}/renderInputs.js +4 -3
  81. package/dist/components/ApplicationLeadForm/renderInputs.js.map +1 -0
  82. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
  83. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -1
  84. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  85. package/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
  86. package/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  87. package/dist/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
  88. package/dist/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
  89. package/dist/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
  90. package/dist/components/CreditCardForm/formStateMap.d.ts +1 -1
  91. package/dist/components/CreditCardForm/formStateMap.js +1 -1
  92. package/dist/components/CreditCardForm/formStateMap.js.map +1 -1
  93. package/dist/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
  94. package/dist/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
  95. package/dist/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
  96. package/dist/components/CreditCardForm/getInitialFormState.d.ts +1 -1
  97. package/dist/components/CreditCardForm/renderInputs.d.ts +2 -2
  98. package/dist/components/CreditCardForm/renderInputs.js +2 -1
  99. package/dist/components/CreditCardForm/renderInputs.js.map +1 -1
  100. package/dist/components/CreditCardForm/renderStep.d.ts +1 -1
  101. package/dist/components/CreditCardForm/renderStep.js +1 -1
  102. package/dist/components/CreditCardForm/renderStep.js.map +1 -1
  103. package/dist/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
  104. package/dist/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
  105. package/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  106. package/dist/components/CreditForm/formStateMap.d.ts +1 -1
  107. package/dist/components/CreditForm/getCalcData.d.ts +1 -1
  108. package/dist/components/CreditForm/getInitialFormState.d.ts +1 -1
  109. package/dist/components/CreditForm/renderInfo.d.ts +1 -1
  110. package/dist/components/CreditForm/renderInfo.js.map +1 -1
  111. package/dist/components/CreditForm/renderInputs.d.ts +2 -2
  112. package/dist/components/CreditForm/renderInputs.js +2 -1
  113. package/dist/components/CreditForm/renderInputs.js.map +1 -1
  114. package/dist/components/CreditForm/renderStep.d.ts +1 -1
  115. package/dist/components/CreditForm/renderStep.js +1 -1
  116. package/dist/components/CreditForm/renderStep.js.map +1 -1
  117. package/dist/components/CreditForm/useCreditFormAPI.d.ts +2 -2
  118. package/dist/components/CreditForm/useCreditFormAPI.js +1 -1
  119. package/dist/components/CreditForm/useCreditFormAPI.js.map +1 -1
  120. package/dist/components/CreditForm/utils.d.ts +1 -1
  121. package/dist/hooks/useCreditFormStore.d.ts +0 -0
  122. package/dist/hooks/useCreditFormStore.js +1 -0
  123. package/dist/hooks/useCreditFormStore.js.map +1 -0
  124. package/dist/hooks/useLeadFormData.d.ts +2 -2
  125. package/dist/hooks/useLeadFormData.js.map +1 -1
  126. package/dist/hooks/useRetailFormStore.d.ts +10 -10
  127. package/dist/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
  128. package/dist/services/retail/adaptors/getCalculatorData.d.ts +1 -1
  129. package/dist/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
  130. package/dist/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
  131. package/dist/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
  132. package/dist/services/retail/adaptors/getEmploymentData.d.ts +1 -1
  133. package/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
  134. package/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
  135. package/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  136. package/dist/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
  137. package/dist/services/retail/external/types.d.ts +10 -0
  138. package/dist/services/retail/external/types.js +2 -0
  139. package/dist/services/retail/external/types.js.map +1 -0
  140. package/dist/services/retail/external/utils.d.ts +2 -0
  141. package/dist/services/retail/external/utils.js +7 -0
  142. package/dist/services/retail/external/utils.js.map +1 -0
  143. package/dist/services/retail/inputs.d.ts +75 -0
  144. package/dist/services/retail/inputs.js +137 -0
  145. package/dist/services/retail/inputs.js.map +1 -0
  146. package/dist/services/retail/model/EOrganizationActivityTypes.js.map +1 -0
  147. package/{bundle/api/RetailAPI → dist/services/retail}/model/LeadFormData.d.ts +1 -1
  148. package/dist/services/retail/model/LeadFormData.js.map +1 -0
  149. package/{lib/components/ApplicationLeadForm → dist/services/retail/model}/LeadFormState.d.ts +18 -18
  150. package/dist/services/retail/model/LeadFormState.js.map +1 -0
  151. package/dist/services/retail/model/RetailFormContent.d.ts +63 -0
  152. package/dist/services/retail/model/RetailFormContent.js +4 -0
  153. package/dist/services/retail/model/RetailFormContent.js.map +1 -0
  154. package/{bundle/components/CreditForm → dist/services/retail/utils}/calculateInputs.d.ts +2 -2
  155. package/dist/services/retail/utils/calculateInputs.js.map +1 -0
  156. package/dist/services/retail/utils/getOrganizationParams.d.ts +17 -0
  157. package/dist/services/retail/utils/getOrganizationParams.js.map +1 -0
  158. package/dist/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
  159. package/dist/{api/RetailAPI → services/retail}/utils/getUpdateUserProfile.js +3 -4
  160. package/dist/services/retail/utils/getUpdateUserProfile.js.map +1 -0
  161. package/dist/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
  162. package/dist/ui-kit/DraftDialog/utils.d.ts +2 -2
  163. package/dist/ui-kit/DraftDialog/utils.js.map +1 -1
  164. package/dist/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
  165. package/dist/ui-kit/FormField/Fields/AddressBranchField.js.map +1 -1
  166. package/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
  167. package/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
  168. package/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
  169. package/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js +10 -0
  170. package/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js.map +1 -0
  171. package/dist/ui-kit/FormField/NameFieldDef.d.ts +6 -1
  172. package/dist/ui-kit/FormField/SelectField.d.ts +2 -2
  173. package/dist/ui-kit/FormField/SelectField.js.map +1 -1
  174. package/dist/ui-kit/FormField/getField.d.ts +2 -1
  175. package/dist/ui-kit/FormField/getField.js +4 -131
  176. package/dist/ui-kit/FormField/getField.js.map +1 -1
  177. package/dist/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
  178. package/dist/ui-kit/FormField/getObjectValidator.d.ts +1 -1
  179. package/dist/ui-kit/FormField/getObjectValidator.js +70 -60
  180. package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  181. package/dist/ui-kit/FormField/getPremium.d.ts +1 -1
  182. package/dist/ui-kit/FormField/updateOrganizationFields.js +1 -1
  183. package/dist/ui-kit/FormField/updateOrganizationFields.js.map +1 -1
  184. package/dist/ui-kit/FormField/validators.d.ts +3 -2
  185. package/dist/ui-kit/FormField/validators.js +5 -3
  186. package/dist/ui-kit/FormField/validators.js.map +1 -1
  187. package/lib/components/ApplicationForm/ApplicationForm.js +1 -3
  188. package/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  189. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +1 -1
  190. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  191. package/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
  192. package/lib/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
  193. package/lib/components/ApplicationLeadForm/GroupedConsents.js +2 -1
  194. package/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  195. package/lib/components/ApplicationLeadForm/consents.d.ts +2 -2
  196. package/lib/components/ApplicationLeadForm/consents.js +0 -3
  197. package/lib/components/ApplicationLeadForm/consents.js.map +1 -1
  198. package/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  199. package/lib/components/ApplicationLeadForm/getInitialFormState.js +0 -2
  200. package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  201. package/lib/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
  202. package/lib/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
  203. package/lib/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
  204. package/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
  205. package/lib/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.d.ts +1 -1
  206. package/lib/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.js +4 -3
  207. package/lib/components/ApplicationLeadForm/renderInputs.js.map +1 -0
  208. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
  209. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -1
  210. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  211. package/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
  212. package/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  213. package/lib/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
  214. package/lib/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
  215. package/lib/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
  216. package/lib/components/CreditCardForm/formStateMap.d.ts +1 -1
  217. package/lib/components/CreditCardForm/formStateMap.js +1 -1
  218. package/lib/components/CreditCardForm/formStateMap.js.map +1 -1
  219. package/lib/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
  220. package/lib/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
  221. package/lib/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
  222. package/lib/components/CreditCardForm/getInitialFormState.d.ts +1 -1
  223. package/lib/components/CreditCardForm/renderInputs.d.ts +2 -2
  224. package/lib/components/CreditCardForm/renderInputs.js +2 -1
  225. package/lib/components/CreditCardForm/renderInputs.js.map +1 -1
  226. package/lib/components/CreditCardForm/renderStep.d.ts +1 -1
  227. package/lib/components/CreditCardForm/renderStep.js +1 -1
  228. package/lib/components/CreditCardForm/renderStep.js.map +1 -1
  229. package/lib/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
  230. package/lib/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
  231. package/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  232. package/lib/components/CreditForm/formStateMap.d.ts +1 -1
  233. package/lib/components/CreditForm/getCalcData.d.ts +1 -1
  234. package/lib/components/CreditForm/getInitialFormState.d.ts +1 -1
  235. package/lib/components/CreditForm/renderInfo.d.ts +1 -1
  236. package/lib/components/CreditForm/renderInfo.js.map +1 -1
  237. package/lib/components/CreditForm/renderInputs.d.ts +2 -2
  238. package/lib/components/CreditForm/renderInputs.js +2 -1
  239. package/lib/components/CreditForm/renderInputs.js.map +1 -1
  240. package/lib/components/CreditForm/renderStep.d.ts +1 -1
  241. package/lib/components/CreditForm/renderStep.js +1 -1
  242. package/lib/components/CreditForm/renderStep.js.map +1 -1
  243. package/lib/components/CreditForm/useCreditFormAPI.d.ts +2 -2
  244. package/lib/components/CreditForm/useCreditFormAPI.js +1 -1
  245. package/lib/components/CreditForm/useCreditFormAPI.js.map +1 -1
  246. package/lib/components/CreditForm/utils.d.ts +1 -1
  247. package/lib/hooks/useCreditFormStore.d.ts +0 -0
  248. package/lib/hooks/useCreditFormStore.js +1 -0
  249. package/lib/hooks/useCreditFormStore.js.map +1 -0
  250. package/lib/hooks/useLeadFormData.d.ts +2 -2
  251. package/lib/hooks/useLeadFormData.js.map +1 -1
  252. package/lib/hooks/useRetailFormStore.d.ts +10 -10
  253. package/lib/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
  254. package/lib/services/retail/adaptors/getCalculatorData.d.ts +1 -1
  255. package/lib/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
  256. package/lib/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
  257. package/lib/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
  258. package/lib/services/retail/adaptors/getEmploymentData.d.ts +1 -1
  259. package/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
  260. package/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
  261. package/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  262. package/lib/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
  263. package/lib/services/retail/external/types.d.ts +10 -0
  264. package/lib/services/retail/external/types.js +2 -0
  265. package/lib/services/retail/external/types.js.map +1 -0
  266. package/lib/services/retail/external/utils.d.ts +2 -0
  267. package/lib/services/retail/external/utils.js +3 -0
  268. package/lib/services/retail/external/utils.js.map +1 -0
  269. package/lib/services/retail/inputs.d.ts +75 -0
  270. package/lib/services/retail/inputs.js +135 -0
  271. package/lib/services/retail/inputs.js.map +1 -0
  272. package/lib/services/retail/model/EOrganizationActivityTypes.js.map +1 -0
  273. package/lib/{api/RetailAPI → services/retail}/model/LeadFormData.d.ts +1 -1
  274. package/lib/services/retail/model/LeadFormData.js.map +1 -0
  275. package/{dist/components/ApplicationLeadForm → lib/services/retail/model}/LeadFormState.d.ts +18 -18
  276. package/lib/services/retail/model/LeadFormState.js.map +1 -0
  277. package/lib/services/retail/model/RetailFormContent.d.ts +63 -0
  278. package/lib/services/retail/model/RetailFormContent.js +4 -0
  279. package/lib/services/retail/model/RetailFormContent.js.map +1 -0
  280. package/{dist/components/CreditCardForm → lib/services/retail/utils}/calculateInputs.d.ts +2 -2
  281. package/lib/services/retail/utils/calculateInputs.js.map +1 -0
  282. package/lib/services/retail/utils/getOrganizationParams.d.ts +17 -0
  283. package/lib/services/retail/utils/getOrganizationParams.js.map +1 -0
  284. package/lib/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
  285. package/{mobile/lib/api/RetailAPI → lib/services/retail}/utils/getUpdateUserProfile.js +1 -2
  286. package/lib/services/retail/utils/getUpdateUserProfile.js.map +1 -0
  287. package/lib/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
  288. package/lib/ui-kit/DraftDialog/utils.d.ts +2 -2
  289. package/lib/ui-kit/DraftDialog/utils.js.map +1 -1
  290. package/lib/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
  291. package/lib/ui-kit/FormField/Fields/AddressBranchField.js.map +1 -1
  292. package/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
  293. package/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
  294. package/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
  295. package/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js +8 -0
  296. package/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js.map +1 -0
  297. package/lib/ui-kit/FormField/NameFieldDef.d.ts +6 -1
  298. package/lib/ui-kit/FormField/SelectField.d.ts +2 -2
  299. package/lib/ui-kit/FormField/SelectField.js.map +1 -1
  300. package/lib/ui-kit/FormField/getField.d.ts +2 -1
  301. package/lib/ui-kit/FormField/getField.js +4 -131
  302. package/lib/ui-kit/FormField/getField.js.map +1 -1
  303. package/lib/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
  304. package/lib/ui-kit/FormField/getObjectValidator.d.ts +1 -1
  305. package/lib/ui-kit/FormField/getObjectValidator.js +70 -60
  306. package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  307. package/lib/ui-kit/FormField/getPremium.d.ts +1 -1
  308. package/lib/ui-kit/FormField/updateOrganizationFields.js +1 -1
  309. package/lib/ui-kit/FormField/updateOrganizationFields.js.map +1 -1
  310. package/lib/ui-kit/FormField/validators.d.ts +3 -2
  311. package/lib/ui-kit/FormField/validators.js +3 -2
  312. package/lib/ui-kit/FormField/validators.js.map +1 -1
  313. package/mobile/bundle/bundle.umd.js +1810 -1827
  314. package/mobile/bundle/bundle.umd.min.js +1 -1
  315. package/mobile/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
  316. package/mobile/bundle/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
  317. package/mobile/bundle/components/ApplicationLeadForm/consents.d.ts +2 -2
  318. package/mobile/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  319. package/mobile/bundle/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
  320. package/mobile/bundle/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
  321. package/mobile/bundle/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.d.ts +1 -1
  322. package/mobile/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
  323. package/mobile/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
  324. package/mobile/bundle/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
  325. package/mobile/bundle/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
  326. package/mobile/bundle/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
  327. package/mobile/bundle/components/CreditCardForm/formStateMap.d.ts +1 -1
  328. package/mobile/bundle/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
  329. package/mobile/bundle/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
  330. package/mobile/bundle/components/CreditCardForm/getInitialFormState.d.ts +1 -1
  331. package/mobile/bundle/components/CreditCardForm/renderInputs.d.ts +2 -2
  332. package/mobile/bundle/components/CreditCardForm/renderStep.d.ts +1 -1
  333. package/mobile/bundle/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
  334. package/mobile/bundle/components/CreditForm/formStateMap.d.ts +1 -1
  335. package/mobile/bundle/components/CreditForm/getCalcData.d.ts +1 -1
  336. package/mobile/bundle/components/CreditForm/getInitialFormState.d.ts +1 -1
  337. package/mobile/bundle/components/CreditForm/renderInfo.d.ts +1 -1
  338. package/mobile/bundle/components/CreditForm/renderInputs.d.ts +2 -2
  339. package/mobile/bundle/components/CreditForm/renderStep.d.ts +1 -1
  340. package/mobile/bundle/components/CreditForm/useCreditFormAPI.d.ts +2 -2
  341. package/mobile/bundle/components/CreditForm/utils.d.ts +1 -1
  342. package/mobile/bundle/hooks/useLeadFormData.d.ts +2 -2
  343. package/mobile/bundle/hooks/useRetailFormStore.d.ts +10 -10
  344. package/mobile/bundle/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
  345. package/mobile/bundle/services/retail/adaptors/getCalculatorData.d.ts +1 -1
  346. package/mobile/bundle/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
  347. package/mobile/bundle/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
  348. package/mobile/bundle/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
  349. package/mobile/bundle/services/retail/adaptors/getEmploymentData.d.ts +1 -1
  350. package/mobile/bundle/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
  351. package/mobile/bundle/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
  352. package/mobile/bundle/services/retail/external/types.d.ts +10 -0
  353. package/mobile/bundle/services/retail/external/utils.d.ts +2 -0
  354. package/mobile/bundle/services/retail/inputs.d.ts +75 -0
  355. package/mobile/bundle/{api/RetailAPI → services/retail}/model/LeadFormData.d.ts +1 -1
  356. package/mobile/bundle/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.d.ts +18 -18
  357. package/mobile/bundle/services/retail/model/RetailFormContent.d.ts +63 -0
  358. package/{dist/components/CreditForm → mobile/bundle/services/retail/utils}/calculateInputs.d.ts +2 -2
  359. package/mobile/bundle/services/retail/utils/getOrganizationParams.d.ts +17 -0
  360. package/mobile/bundle/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
  361. package/mobile/bundle/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
  362. package/mobile/bundle/ui-kit/DraftDialog/utils.d.ts +2 -2
  363. package/mobile/bundle/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
  364. package/mobile/bundle/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
  365. package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +6 -1
  366. package/mobile/bundle/ui-kit/FormField/SelectField.d.ts +2 -2
  367. package/mobile/bundle/ui-kit/FormField/getField.d.ts +2 -1
  368. package/mobile/bundle/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
  369. package/mobile/bundle/ui-kit/FormField/getObjectValidator.d.ts +1 -1
  370. package/mobile/bundle/ui-kit/FormField/getPremium.d.ts +1 -1
  371. package/mobile/bundle/ui-kit/FormField/validators.d.ts +3 -2
  372. package/mobile/dist/components/ApplicationForm/ApplicationForm.js +1 -3
  373. package/mobile/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  374. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +1 -1
  375. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  376. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
  377. package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
  378. package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.js +2 -1
  379. package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  380. package/mobile/dist/components/ApplicationLeadForm/consents.d.ts +2 -2
  381. package/mobile/dist/components/ApplicationLeadForm/consents.js +0 -3
  382. package/mobile/dist/components/ApplicationLeadForm/consents.js.map +1 -1
  383. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  384. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js +0 -2
  385. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  386. package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
  387. package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
  388. package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
  389. package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
  390. package/mobile/dist/components/ApplicationLeadForm/renderInputs.d.ts +2 -0
  391. package/{dist/components/ApplicationForm → mobile/dist/components/ApplicationLeadForm}/renderInputs.js +4 -3
  392. package/mobile/dist/components/ApplicationLeadForm/renderInputs.js.map +1 -0
  393. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
  394. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -1
  395. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  396. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
  397. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  398. package/mobile/dist/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
  399. package/mobile/dist/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
  400. package/mobile/dist/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
  401. package/mobile/dist/components/CreditCardForm/formStateMap.d.ts +1 -1
  402. package/mobile/dist/components/CreditCardForm/formStateMap.js +1 -1
  403. package/mobile/dist/components/CreditCardForm/formStateMap.js.map +1 -1
  404. package/mobile/dist/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
  405. package/mobile/dist/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
  406. package/mobile/dist/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
  407. package/mobile/dist/components/CreditCardForm/getInitialFormState.d.ts +1 -1
  408. package/mobile/dist/components/CreditCardForm/renderInputs.d.ts +2 -2
  409. package/mobile/dist/components/CreditCardForm/renderInputs.js +2 -1
  410. package/mobile/dist/components/CreditCardForm/renderInputs.js.map +1 -1
  411. package/mobile/dist/components/CreditCardForm/renderStep.d.ts +1 -1
  412. package/mobile/dist/components/CreditCardForm/renderStep.js +1 -1
  413. package/mobile/dist/components/CreditCardForm/renderStep.js.map +1 -1
  414. package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
  415. package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
  416. package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  417. package/mobile/dist/components/CreditForm/formStateMap.d.ts +1 -1
  418. package/mobile/dist/components/CreditForm/getCalcData.d.ts +1 -1
  419. package/mobile/dist/components/CreditForm/getInitialFormState.d.ts +1 -1
  420. package/mobile/dist/components/CreditForm/renderInfo.d.ts +1 -1
  421. package/mobile/dist/components/CreditForm/renderInfo.js.map +1 -1
  422. package/mobile/dist/components/CreditForm/renderInputs.d.ts +2 -2
  423. package/mobile/dist/components/CreditForm/renderInputs.js +2 -1
  424. package/mobile/dist/components/CreditForm/renderInputs.js.map +1 -1
  425. package/mobile/dist/components/CreditForm/renderStep.d.ts +1 -1
  426. package/mobile/dist/components/CreditForm/renderStep.js +1 -1
  427. package/mobile/dist/components/CreditForm/renderStep.js.map +1 -1
  428. package/mobile/dist/components/CreditForm/useCreditFormAPI.d.ts +2 -2
  429. package/mobile/dist/components/CreditForm/useCreditFormAPI.js +1 -1
  430. package/mobile/dist/components/CreditForm/useCreditFormAPI.js.map +1 -1
  431. package/mobile/dist/components/CreditForm/utils.d.ts +1 -1
  432. package/mobile/dist/hooks/useCreditFormStore.d.ts +0 -0
  433. package/mobile/dist/hooks/useCreditFormStore.js +1 -0
  434. package/mobile/dist/hooks/useCreditFormStore.js.map +1 -0
  435. package/mobile/dist/hooks/useLeadFormData.d.ts +2 -2
  436. package/mobile/dist/hooks/useLeadFormData.js.map +1 -1
  437. package/mobile/dist/hooks/useRetailFormStore.d.ts +10 -10
  438. package/mobile/dist/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
  439. package/mobile/dist/services/retail/adaptors/getCalculatorData.d.ts +1 -1
  440. package/mobile/dist/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
  441. package/mobile/dist/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
  442. package/mobile/dist/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
  443. package/mobile/dist/services/retail/adaptors/getEmploymentData.d.ts +1 -1
  444. package/mobile/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
  445. package/mobile/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
  446. package/mobile/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  447. package/mobile/dist/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
  448. package/mobile/dist/services/retail/external/types.d.ts +10 -0
  449. package/mobile/dist/services/retail/external/types.js +2 -0
  450. package/mobile/dist/services/retail/external/types.js.map +1 -0
  451. package/mobile/dist/services/retail/external/utils.d.ts +2 -0
  452. package/mobile/dist/services/retail/external/utils.js +7 -0
  453. package/mobile/dist/services/retail/external/utils.js.map +1 -0
  454. package/mobile/dist/services/retail/inputs.d.ts +75 -0
  455. package/mobile/dist/services/retail/inputs.js +137 -0
  456. package/mobile/dist/services/retail/inputs.js.map +1 -0
  457. package/mobile/dist/services/retail/model/EOrganizationActivityTypes.js.map +1 -0
  458. package/mobile/dist/services/retail/model/LeadFormData.d.ts +7 -0
  459. package/mobile/dist/services/retail/model/LeadFormData.js.map +1 -0
  460. package/mobile/dist/services/retail/model/LeadFormState.d.ts +146 -0
  461. package/mobile/dist/services/retail/model/LeadFormState.js.map +1 -0
  462. package/mobile/dist/services/retail/model/RetailFormContent.d.ts +63 -0
  463. package/mobile/dist/services/retail/model/RetailFormContent.js +4 -0
  464. package/mobile/dist/services/retail/model/RetailFormContent.js.map +1 -0
  465. package/mobile/dist/services/retail/utils/calculateInputs.d.ts +5 -0
  466. package/mobile/dist/services/retail/utils/calculateInputs.js.map +1 -0
  467. package/mobile/dist/services/retail/utils/getOrganizationParams.d.ts +17 -0
  468. package/mobile/dist/services/retail/utils/getOrganizationParams.js.map +1 -0
  469. package/mobile/dist/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
  470. package/mobile/dist/{api/RetailAPI → services/retail}/utils/getUpdateUserProfile.js +3 -4
  471. package/mobile/dist/services/retail/utils/getUpdateUserProfile.js.map +1 -0
  472. package/mobile/dist/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
  473. package/mobile/dist/ui-kit/DraftDialog/utils.d.ts +2 -2
  474. package/mobile/dist/ui-kit/DraftDialog/utils.js.map +1 -1
  475. package/mobile/dist/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
  476. package/mobile/dist/ui-kit/FormField/Fields/AddressBranchField.js.map +1 -1
  477. package/mobile/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
  478. package/mobile/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
  479. package/mobile/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
  480. package/mobile/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js +10 -0
  481. package/mobile/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js.map +1 -0
  482. package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +6 -1
  483. package/mobile/dist/ui-kit/FormField/SelectField.d.ts +2 -2
  484. package/mobile/dist/ui-kit/FormField/SelectField.js.map +1 -1
  485. package/mobile/dist/ui-kit/FormField/getField.d.ts +2 -1
  486. package/mobile/dist/ui-kit/FormField/getField.js +4 -131
  487. package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
  488. package/mobile/dist/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
  489. package/mobile/dist/ui-kit/FormField/getObjectValidator.d.ts +1 -1
  490. package/mobile/dist/ui-kit/FormField/getObjectValidator.js +70 -60
  491. package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  492. package/mobile/dist/ui-kit/FormField/getPremium.d.ts +1 -1
  493. package/mobile/dist/ui-kit/FormField/updateOrganizationFields.js +1 -1
  494. package/mobile/dist/ui-kit/FormField/updateOrganizationFields.js.map +1 -1
  495. package/mobile/dist/ui-kit/FormField/validators.d.ts +3 -2
  496. package/mobile/dist/ui-kit/FormField/validators.js +5 -3
  497. package/mobile/dist/ui-kit/FormField/validators.js.map +1 -1
  498. package/mobile/lib/components/ApplicationForm/ApplicationForm.js +1 -3
  499. package/mobile/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  500. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +1 -1
  501. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  502. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
  503. package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
  504. package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.js +2 -1
  505. package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  506. package/mobile/lib/components/ApplicationLeadForm/consents.d.ts +2 -2
  507. package/mobile/lib/components/ApplicationLeadForm/consents.js +0 -3
  508. package/mobile/lib/components/ApplicationLeadForm/consents.js.map +1 -1
  509. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  510. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js +0 -2
  511. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  512. package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
  513. package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
  514. package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
  515. package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
  516. package/mobile/lib/components/ApplicationLeadForm/renderInputs.d.ts +2 -0
  517. package/mobile/lib/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.js +4 -3
  518. package/mobile/lib/components/ApplicationLeadForm/renderInputs.js.map +1 -0
  519. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
  520. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -1
  521. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  522. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
  523. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  524. package/mobile/lib/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
  525. package/mobile/lib/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
  526. package/mobile/lib/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
  527. package/mobile/lib/components/CreditCardForm/formStateMap.d.ts +1 -1
  528. package/mobile/lib/components/CreditCardForm/formStateMap.js +1 -1
  529. package/mobile/lib/components/CreditCardForm/formStateMap.js.map +1 -1
  530. package/mobile/lib/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
  531. package/mobile/lib/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
  532. package/mobile/lib/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
  533. package/mobile/lib/components/CreditCardForm/getInitialFormState.d.ts +1 -1
  534. package/mobile/lib/components/CreditCardForm/renderInputs.d.ts +2 -2
  535. package/mobile/lib/components/CreditCardForm/renderInputs.js +2 -1
  536. package/mobile/lib/components/CreditCardForm/renderInputs.js.map +1 -1
  537. package/mobile/lib/components/CreditCardForm/renderStep.d.ts +1 -1
  538. package/mobile/lib/components/CreditCardForm/renderStep.js +1 -1
  539. package/mobile/lib/components/CreditCardForm/renderStep.js.map +1 -1
  540. package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
  541. package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
  542. package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  543. package/mobile/lib/components/CreditForm/formStateMap.d.ts +1 -1
  544. package/mobile/lib/components/CreditForm/getCalcData.d.ts +1 -1
  545. package/mobile/lib/components/CreditForm/getInitialFormState.d.ts +1 -1
  546. package/mobile/lib/components/CreditForm/renderInfo.d.ts +1 -1
  547. package/mobile/lib/components/CreditForm/renderInfo.js.map +1 -1
  548. package/mobile/lib/components/CreditForm/renderInputs.d.ts +2 -2
  549. package/mobile/lib/components/CreditForm/renderInputs.js +2 -1
  550. package/mobile/lib/components/CreditForm/renderInputs.js.map +1 -1
  551. package/mobile/lib/components/CreditForm/renderStep.d.ts +1 -1
  552. package/mobile/lib/components/CreditForm/renderStep.js +1 -1
  553. package/mobile/lib/components/CreditForm/renderStep.js.map +1 -1
  554. package/mobile/lib/components/CreditForm/useCreditFormAPI.d.ts +2 -2
  555. package/mobile/lib/components/CreditForm/useCreditFormAPI.js +1 -1
  556. package/mobile/lib/components/CreditForm/useCreditFormAPI.js.map +1 -1
  557. package/mobile/lib/components/CreditForm/utils.d.ts +1 -1
  558. package/mobile/lib/hooks/useCreditFormStore.d.ts +0 -0
  559. package/mobile/lib/hooks/useCreditFormStore.js +1 -0
  560. package/mobile/lib/hooks/useCreditFormStore.js.map +1 -0
  561. package/mobile/lib/hooks/useLeadFormData.d.ts +2 -2
  562. package/mobile/lib/hooks/useLeadFormData.js.map +1 -1
  563. package/mobile/lib/hooks/useRetailFormStore.d.ts +10 -10
  564. package/mobile/lib/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
  565. package/mobile/lib/services/retail/adaptors/getCalculatorData.d.ts +1 -1
  566. package/mobile/lib/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
  567. package/mobile/lib/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
  568. package/mobile/lib/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
  569. package/mobile/lib/services/retail/adaptors/getEmploymentData.d.ts +1 -1
  570. package/mobile/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
  571. package/mobile/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
  572. package/mobile/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  573. package/mobile/lib/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
  574. package/mobile/lib/services/retail/external/types.d.ts +10 -0
  575. package/mobile/lib/services/retail/external/types.js +2 -0
  576. package/mobile/lib/services/retail/external/types.js.map +1 -0
  577. package/mobile/lib/services/retail/external/utils.d.ts +2 -0
  578. package/mobile/lib/services/retail/external/utils.js +3 -0
  579. package/mobile/lib/services/retail/external/utils.js.map +1 -0
  580. package/mobile/lib/services/retail/inputs.d.ts +75 -0
  581. package/mobile/lib/services/retail/inputs.js +135 -0
  582. package/mobile/lib/services/retail/inputs.js.map +1 -0
  583. package/mobile/lib/services/retail/model/EOrganizationActivityTypes.js.map +1 -0
  584. package/mobile/lib/services/retail/model/LeadFormData.d.ts +7 -0
  585. package/mobile/lib/services/retail/model/LeadFormData.js.map +1 -0
  586. package/mobile/lib/services/retail/model/LeadFormState.d.ts +146 -0
  587. package/mobile/lib/services/retail/model/LeadFormState.js.map +1 -0
  588. package/mobile/lib/services/retail/model/RetailFormContent.d.ts +63 -0
  589. package/mobile/lib/services/retail/model/RetailFormContent.js +4 -0
  590. package/mobile/lib/services/retail/model/RetailFormContent.js.map +1 -0
  591. package/mobile/lib/services/retail/utils/calculateInputs.d.ts +5 -0
  592. package/mobile/lib/services/retail/utils/calculateInputs.js.map +1 -0
  593. package/mobile/lib/services/retail/utils/getOrganizationParams.d.ts +17 -0
  594. package/mobile/lib/services/retail/utils/getOrganizationParams.js.map +1 -0
  595. package/mobile/lib/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
  596. package/{lib/api/RetailAPI → mobile/lib/services/retail}/utils/getUpdateUserProfile.js +1 -2
  597. package/mobile/lib/services/retail/utils/getUpdateUserProfile.js.map +1 -0
  598. package/mobile/lib/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
  599. package/mobile/lib/ui-kit/DraftDialog/utils.d.ts +2 -2
  600. package/mobile/lib/ui-kit/DraftDialog/utils.js.map +1 -1
  601. package/mobile/lib/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
  602. package/mobile/lib/ui-kit/FormField/Fields/AddressBranchField.js.map +1 -1
  603. package/mobile/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
  604. package/mobile/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
  605. package/mobile/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
  606. package/mobile/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js +8 -0
  607. package/mobile/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js.map +1 -0
  608. package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +6 -1
  609. package/mobile/lib/ui-kit/FormField/SelectField.d.ts +2 -2
  610. package/mobile/lib/ui-kit/FormField/SelectField.js.map +1 -1
  611. package/mobile/lib/ui-kit/FormField/getField.d.ts +2 -1
  612. package/mobile/lib/ui-kit/FormField/getField.js +4 -131
  613. package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
  614. package/mobile/lib/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
  615. package/mobile/lib/ui-kit/FormField/getObjectValidator.d.ts +1 -1
  616. package/mobile/lib/ui-kit/FormField/getObjectValidator.js +70 -60
  617. package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  618. package/mobile/lib/ui-kit/FormField/getPremium.d.ts +1 -1
  619. package/mobile/lib/ui-kit/FormField/updateOrganizationFields.js +1 -1
  620. package/mobile/lib/ui-kit/FormField/updateOrganizationFields.js.map +1 -1
  621. package/mobile/lib/ui-kit/FormField/validators.d.ts +3 -2
  622. package/mobile/lib/ui-kit/FormField/validators.js +3 -2
  623. package/mobile/lib/ui-kit/FormField/validators.js.map +1 -1
  624. package/mobile/src/components/ApplicationForm/ApplicationForm.tsx +8 -10
  625. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +1 -1
  626. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +0 -10
  627. package/mobile/src/components/ApplicationLeadForm/GroupedConsents.tsx +14 -4
  628. package/mobile/src/components/ApplicationLeadForm/consents.ts +2 -5
  629. package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -3
  630. package/mobile/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +1 -1
  631. package/mobile/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +1 -1
  632. package/mobile/src/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.tsx +6 -8
  633. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +2 -2
  634. package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +1 -1
  635. package/mobile/src/components/ApplicationLeadForm/useLeadFormStore.ts +1 -1
  636. package/mobile/src/components/ApplicationLeadForm/useSaveUserData.ts +1 -1
  637. package/mobile/src/components/CreditCardForm/CreditCardFormContent.ts +1 -1
  638. package/mobile/src/components/CreditCardForm/formStateMap.tsx +2 -2
  639. package/mobile/src/components/CreditCardForm/getCreditCardFormTaskData.ts +1 -1
  640. package/mobile/src/components/CreditCardForm/getDeliveryCreditCardData.ts +1 -1
  641. package/mobile/src/components/CreditCardForm/getInitialFormState.tsx +1 -1
  642. package/mobile/src/components/CreditCardForm/renderInputs.tsx +4 -3
  643. package/mobile/src/components/CreditCardForm/renderStep.tsx +6 -2
  644. package/mobile/src/components/CreditCardForm/useCreditCardFormAPI.tsx +2 -2
  645. package/mobile/src/components/CreditForm/CreditFormStep.tsx +1 -1
  646. package/mobile/src/components/CreditForm/formStateMap.tsx +1 -1
  647. package/mobile/src/components/CreditForm/getCalcData.ts +1 -1
  648. package/mobile/src/components/CreditForm/getInitialFormState.tsx +1 -1
  649. package/mobile/src/components/CreditForm/renderInfo.tsx +1 -1
  650. package/mobile/src/components/CreditForm/renderInputs.tsx +4 -3
  651. package/mobile/src/components/CreditForm/renderStep.tsx +2 -2
  652. package/mobile/src/components/CreditForm/useCreditFormAPI.tsx +3 -3
  653. package/mobile/src/components/CreditForm/utils.ts +1 -1
  654. package/mobile/src/hooks/useCreditFormStore.tsx +0 -0
  655. package/mobile/src/hooks/useLeadFormData.ts +4 -4
  656. package/mobile/src/hooks/useRetailFormStore.tsx +5 -5
  657. package/mobile/src/services/retail/adaptors/getAdditionalInfoData.ts +1 -1
  658. package/mobile/src/services/retail/adaptors/getCalculatorData.ts +1 -1
  659. package/mobile/src/services/retail/adaptors/getCardOptionsData.tsx +1 -1
  660. package/mobile/src/services/retail/adaptors/getCreditFormTaskData.ts +1 -1
  661. package/mobile/src/services/retail/adaptors/getDeliveryCreditData.ts +1 -1
  662. package/mobile/src/services/retail/adaptors/getEmploymentData.tsx +1 -1
  663. package/mobile/src/services/retail/adaptors/getFamilyStatusAndIncomeData.ts +2 -2
  664. package/mobile/src/services/retail/adaptors/getPersonalInfoData.tsx +1 -1
  665. package/mobile/src/services/retail/external/types.ts +10 -0
  666. package/mobile/src/services/retail/external/utils.ts +2 -0
  667. package/mobile/src/services/retail/inputs.tsx +140 -0
  668. package/mobile/src/{api/RetailAPI → services/retail}/model/LeadFormData.ts +1 -1
  669. package/mobile/src/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.ts +20 -18
  670. package/mobile/src/services/retail/model/RetailFormContent.ts +101 -0
  671. package/mobile/src/{components/CreditCardForm → services/retail/utils}/calculateInputs.ts +4 -4
  672. package/mobile/src/{api/RetailAPI → services/retail}/utils/getOrganizationParams.ts +6 -6
  673. package/mobile/src/{api/RetailAPI → services/retail}/utils/getUpdateUserProfile.ts +3 -4
  674. package/mobile/src/ui-kit/DraftDialog/parseDraftTask.ts +1 -1
  675. package/mobile/src/ui-kit/DraftDialog/utils.ts +2 -2
  676. package/mobile/src/ui-kit/FormField/CustomFieldProps.ts +2 -2
  677. package/mobile/src/ui-kit/FormField/Fields/AddressBranchField.tsx +1 -1
  678. package/mobile/src/ui-kit/FormField/Fields/DesiredMeetingDateField.tsx +5 -1
  679. package/mobile/src/ui-kit/FormField/Fields/EmailField.tsx +1 -1
  680. package/mobile/src/ui-kit/FormField/Fields/PartnerCommentsField.tsx +1 -1
  681. package/mobile/src/ui-kit/FormField/Fields/consentToReceiveMaterialsField.tsx +14 -0
  682. package/mobile/src/ui-kit/FormField/NameFieldDef.ts +76 -63
  683. package/mobile/src/ui-kit/FormField/SelectField.tsx +3 -3
  684. package/mobile/src/ui-kit/FormField/getField.tsx +11 -135
  685. package/mobile/src/ui-kit/FormField/getNamesFromInput.tsx +1 -1
  686. package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +75 -61
  687. package/mobile/src/ui-kit/FormField/getPremium.tsx +1 -1
  688. package/mobile/src/ui-kit/FormField/updateOrganizationFields.ts +3 -3
  689. package/mobile/src/ui-kit/FormField/validators.ts +8 -4
  690. package/package.json +1 -1
  691. package/src/components/ApplicationForm/ApplicationForm.tsx +8 -10
  692. package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +1 -1
  693. package/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +0 -10
  694. package/src/components/ApplicationLeadForm/GroupedConsents.tsx +14 -4
  695. package/src/components/ApplicationLeadForm/consents.ts +2 -5
  696. package/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -3
  697. package/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +1 -1
  698. package/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +1 -1
  699. package/src/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.tsx +6 -8
  700. package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +2 -2
  701. package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +1 -1
  702. package/src/components/ApplicationLeadForm/useLeadFormStore.ts +1 -1
  703. package/src/components/ApplicationLeadForm/useSaveUserData.ts +1 -1
  704. package/src/components/CreditCardForm/CreditCardFormContent.ts +1 -1
  705. package/src/components/CreditCardForm/formStateMap.tsx +2 -2
  706. package/src/components/CreditCardForm/getCreditCardFormTaskData.ts +1 -1
  707. package/src/components/CreditCardForm/getDeliveryCreditCardData.ts +1 -1
  708. package/src/components/CreditCardForm/getInitialFormState.tsx +1 -1
  709. package/src/components/CreditCardForm/renderInputs.tsx +4 -3
  710. package/src/components/CreditCardForm/renderStep.tsx +6 -2
  711. package/src/components/CreditCardForm/useCreditCardFormAPI.tsx +2 -2
  712. package/src/components/CreditForm/CreditFormStep.tsx +1 -1
  713. package/src/components/CreditForm/formStateMap.tsx +1 -1
  714. package/src/components/CreditForm/getCalcData.ts +1 -1
  715. package/src/components/CreditForm/getInitialFormState.tsx +1 -1
  716. package/src/components/CreditForm/renderInfo.tsx +1 -1
  717. package/src/components/CreditForm/renderInputs.tsx +4 -3
  718. package/src/components/CreditForm/renderStep.tsx +2 -2
  719. package/src/components/CreditForm/useCreditFormAPI.tsx +3 -3
  720. package/src/components/CreditForm/utils.ts +1 -1
  721. package/src/hooks/useCreditFormStore.tsx +0 -0
  722. package/src/hooks/useLeadFormData.ts +4 -4
  723. package/src/hooks/useRetailFormStore.tsx +5 -5
  724. package/src/icons/IconName.ts +4 -4
  725. package/src/services/retail/adaptors/getAdditionalInfoData.ts +1 -1
  726. package/src/services/retail/adaptors/getCalculatorData.ts +1 -1
  727. package/src/services/retail/adaptors/getCardOptionsData.tsx +1 -1
  728. package/src/services/retail/adaptors/getCreditFormTaskData.ts +1 -1
  729. package/src/services/retail/adaptors/getDeliveryCreditData.ts +1 -1
  730. package/src/services/retail/adaptors/getEmploymentData.tsx +1 -1
  731. package/src/services/retail/adaptors/getFamilyStatusAndIncomeData.ts +2 -2
  732. package/src/services/retail/adaptors/getPersonalInfoData.tsx +1 -1
  733. package/src/services/retail/external/types.ts +10 -0
  734. package/src/services/retail/external/utils.ts +2 -0
  735. package/src/services/retail/inputs.tsx +140 -0
  736. package/src/{api/RetailAPI → services/retail}/model/LeadFormData.ts +1 -1
  737. package/src/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.ts +20 -18
  738. package/src/services/retail/model/RetailFormContent.ts +101 -0
  739. package/{mobile/src/components/CreditForm → src/services/retail/utils}/calculateInputs.ts +4 -4
  740. package/src/{api/RetailAPI → services/retail}/utils/getOrganizationParams.ts +6 -6
  741. package/src/{api/RetailAPI → services/retail}/utils/getUpdateUserProfile.ts +3 -4
  742. package/src/ui-kit/DraftDialog/parseDraftTask.ts +1 -1
  743. package/src/ui-kit/DraftDialog/utils.ts +2 -2
  744. package/src/ui-kit/FormField/CustomFieldProps.ts +2 -2
  745. package/src/ui-kit/FormField/Fields/AddressBranchField.tsx +1 -1
  746. package/src/ui-kit/FormField/Fields/DesiredMeetingDateField.tsx +5 -1
  747. package/src/ui-kit/FormField/Fields/EmailField.tsx +1 -1
  748. package/src/ui-kit/FormField/Fields/PartnerCommentsField.tsx +1 -1
  749. package/src/ui-kit/FormField/Fields/consentToReceiveMaterialsField.tsx +14 -0
  750. package/src/ui-kit/FormField/NameFieldDef.ts +76 -63
  751. package/src/ui-kit/FormField/SelectField.tsx +3 -3
  752. package/src/ui-kit/FormField/getField.tsx +11 -135
  753. package/src/ui-kit/FormField/getNamesFromInput.tsx +1 -1
  754. package/src/ui-kit/FormField/getObjectValidator.tsx +75 -61
  755. package/src/ui-kit/FormField/getPremium.tsx +1 -1
  756. package/src/ui-kit/FormField/updateOrganizationFields.ts +3 -3
  757. package/src/ui-kit/FormField/validators.ts +8 -4
  758. package/bundle/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
  759. package/bundle/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
  760. package/dist/api/RetailAPI/model/EOrganizationActivityTypes.js.map +0 -1
  761. package/dist/api/RetailAPI/model/LeadFormData.js.map +0 -1
  762. package/dist/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
  763. package/dist/api/RetailAPI/utils/getOrganizationParams.js.map +0 -1
  764. package/dist/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
  765. package/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +0 -1
  766. package/dist/components/ApplicationForm/renderInputs.js.map +0 -1
  767. package/dist/components/ApplicationLeadForm/LeadFormState.js.map +0 -1
  768. package/dist/components/CreditCardForm/calculateInputs.js.map +0 -1
  769. package/dist/components/CreditForm/calculateInputs.js.map +0 -1
  770. package/lib/api/RetailAPI/model/EOrganizationActivityTypes.js.map +0 -1
  771. package/lib/api/RetailAPI/model/LeadFormData.js.map +0 -1
  772. package/lib/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
  773. package/lib/api/RetailAPI/utils/getOrganizationParams.js.map +0 -1
  774. package/lib/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
  775. package/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +0 -1
  776. package/lib/components/ApplicationForm/renderInputs.js.map +0 -1
  777. package/lib/components/ApplicationLeadForm/LeadFormState.js.map +0 -1
  778. package/lib/components/CreditCardForm/calculateInputs.d.ts +0 -5
  779. package/lib/components/CreditCardForm/calculateInputs.js.map +0 -1
  780. package/lib/components/CreditForm/calculateInputs.d.ts +0 -5
  781. package/lib/components/CreditForm/calculateInputs.js.map +0 -1
  782. package/mobile/bundle/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
  783. package/mobile/bundle/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
  784. package/mobile/bundle/components/CreditCardForm/calculateInputs.d.ts +0 -5
  785. package/mobile/bundle/components/CreditForm/calculateInputs.d.ts +0 -5
  786. package/mobile/dist/api/RetailAPI/model/EOrganizationActivityTypes.js.map +0 -1
  787. package/mobile/dist/api/RetailAPI/model/LeadFormData.d.ts +0 -7
  788. package/mobile/dist/api/RetailAPI/model/LeadFormData.js.map +0 -1
  789. package/mobile/dist/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
  790. package/mobile/dist/api/RetailAPI/utils/getOrganizationParams.js.map +0 -1
  791. package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
  792. package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +0 -1
  793. package/mobile/dist/components/ApplicationForm/renderInputs.d.ts +0 -2
  794. package/mobile/dist/components/ApplicationForm/renderInputs.js.map +0 -1
  795. package/mobile/dist/components/ApplicationLeadForm/LeadFormState.d.ts +0 -146
  796. package/mobile/dist/components/ApplicationLeadForm/LeadFormState.js.map +0 -1
  797. package/mobile/dist/components/CreditCardForm/calculateInputs.d.ts +0 -5
  798. package/mobile/dist/components/CreditCardForm/calculateInputs.js +0 -31
  799. package/mobile/dist/components/CreditCardForm/calculateInputs.js.map +0 -1
  800. package/mobile/dist/components/CreditForm/calculateInputs.d.ts +0 -5
  801. package/mobile/dist/components/CreditForm/calculateInputs.js +0 -31
  802. package/mobile/dist/components/CreditForm/calculateInputs.js.map +0 -1
  803. package/mobile/lib/api/RetailAPI/model/EOrganizationActivityTypes.js.map +0 -1
  804. package/mobile/lib/api/RetailAPI/model/LeadFormData.d.ts +0 -7
  805. package/mobile/lib/api/RetailAPI/model/LeadFormData.js.map +0 -1
  806. package/mobile/lib/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
  807. package/mobile/lib/api/RetailAPI/utils/getOrganizationParams.js.map +0 -1
  808. package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
  809. package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +0 -1
  810. package/mobile/lib/components/ApplicationForm/renderInputs.d.ts +0 -2
  811. package/mobile/lib/components/ApplicationForm/renderInputs.js.map +0 -1
  812. package/mobile/lib/components/ApplicationLeadForm/LeadFormState.d.ts +0 -146
  813. package/mobile/lib/components/ApplicationLeadForm/LeadFormState.js.map +0 -1
  814. package/mobile/lib/components/CreditCardForm/calculateInputs.d.ts +0 -5
  815. package/mobile/lib/components/CreditCardForm/calculateInputs.js +0 -27
  816. package/mobile/lib/components/CreditCardForm/calculateInputs.js.map +0 -1
  817. package/mobile/lib/components/CreditForm/calculateInputs.d.ts +0 -5
  818. package/mobile/lib/components/CreditForm/calculateInputs.js +0 -27
  819. package/mobile/lib/components/CreditForm/calculateInputs.js.map +0 -1
  820. package/src/components/CreditCardForm/calculateInputs.ts +0 -51
  821. package/src/components/CreditForm/calculateInputs.ts +0 -51
  822. /package/bundle/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
  823. /package/dist/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
  824. /package/dist/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.js +0 -0
  825. /package/dist/{api/RetailAPI → services/retail}/model/LeadFormData.js +0 -0
  826. /package/dist/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.js +0 -0
  827. /package/dist/{components/CreditCardForm → services/retail/utils}/calculateInputs.js +0 -0
  828. /package/dist/{api/RetailAPI → services/retail}/utils/getOrganizationParams.js +0 -0
  829. /package/lib/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
  830. /package/lib/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.js +0 -0
  831. /package/lib/{api/RetailAPI → services/retail}/model/LeadFormData.js +0 -0
  832. /package/lib/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.js +0 -0
  833. /package/lib/{components/CreditCardForm → services/retail/utils}/calculateInputs.js +0 -0
  834. /package/lib/{api/RetailAPI → services/retail}/utils/getOrganizationParams.js +0 -0
  835. /package/mobile/bundle/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
  836. /package/mobile/dist/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
  837. /package/mobile/dist/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.js +0 -0
  838. /package/mobile/dist/{api/RetailAPI → services/retail}/model/LeadFormData.js +0 -0
  839. /package/mobile/dist/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.js +0 -0
  840. /package/{dist/components/CreditForm → mobile/dist/services/retail/utils}/calculateInputs.js +0 -0
  841. /package/mobile/dist/{api/RetailAPI → services/retail}/utils/getOrganizationParams.js +0 -0
  842. /package/mobile/lib/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
  843. /package/mobile/lib/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.js +0 -0
  844. /package/mobile/lib/{api/RetailAPI → services/retail}/model/LeadFormData.js +0 -0
  845. /package/mobile/lib/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.js +0 -0
  846. /package/{lib/components/CreditForm → mobile/lib/services/retail/utils}/calculateInputs.js +0 -0
  847. /package/mobile/lib/{api/RetailAPI → services/retail}/utils/getOrganizationParams.js +0 -0
  848. /package/mobile/src/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.ts +0 -0
  849. /package/src/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.ts +0 -0
@@ -1555,8 +1555,6 @@
1555
1555
  const isValidationSuccess = (info) => !info?.length;
1556
1556
  const validator = (predicate) => (message) => (_) => predicate(_) ? [] : [message];
1557
1557
 
1558
- const pattern = (regexp) => validator((_) => typeof _ === 'string' && regexp.test(_));
1559
-
1560
1558
  const required = validator((_) => _ !== null && _ !== undefined && _ !== '');
1561
1559
 
1562
1560
  const ERROR_MESSAGE = 'Некорректно заполненное поле';
@@ -1572,7 +1570,8 @@
1572
1570
  const serieValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length === 4)(errorMsg);
1573
1571
  const numberValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length === 6)(errorMsg);
1574
1572
  const innValidator = (errorMsg) => validator((_) => typeof _ === 'string' && (_.length === 10 || _.length === 12))(errorMsg);
1575
- const phoneValidator = (errorMsg) => pattern(/^(\+7)?[\s-]?\(?[0-9]{3}\)?[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/)(errorMsg);
1573
+ const phoneValidate = (email) => /^(\+7)?[\s-]?\(?[0-9]{3}\)?[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/.test(email);
1574
+ const phoneValidator = (errorMsg) => validator(phoneValidate)(errorMsg);
1576
1575
  const agreementValidator = validator((_) => typeof _ === 'boolean' && _)('Согласие обязательно');
1577
1576
  const snilsValidate = (snils) => {
1578
1577
  const snl = String(snils).replace(/[^0-9]+/g, '');
@@ -1611,74 +1610,62 @@
1611
1610
  };
1612
1611
  const limitedBirthdayValidator = () => validator(limitedBirthdayValidate)(AGE_ERROR_MESSAGE);
1613
1612
 
1614
- const validatorObj = {
1615
- typeForm: defaultValidator(),
1616
- surname: nameValidator('Укажите свою фамилию'),
1617
- name: nameValidator('Укажите своё имя'),
1618
- middleName: nameValidator('Укажите своё отчество'),
1619
- region: defaultSelectValidator(),
1620
- addressBranch: defaultSelectValidator(),
1621
- phone: phoneValidator('Укажите номер телефона'),
1622
- secondaryPhone: phoneValidator('Укажите номер телефона'),
1613
+ const validatorConsentsObj = {
1614
+ processPersonalDataFlg: agreementValidator,
1615
+ consentProviderFlg: agreementValidator,
1616
+ consentInformFlg: agreementValidator,
1617
+ consentPfrFlg: agreementValidator,
1618
+ consentOthersFlg: agreementValidator,
1619
+ };
1620
+ const validatorCreditCardObj = {
1621
+ addressCourier: addressDaDataValidator(),
1622
+ paymentSystem: defaultValidator('Укажите тип платежной системы'),
1623
+ currency: defaultValidator('Укажите валюту'),
1624
+ cardCategory: defaultValidator('Укажите категорию карты'),
1625
+ codeWord: codeWordValidator('Необходимо ввести кодовое слово'),
1626
+ confirmationIncome: defaultSelectValidator(),
1627
+ methodObtain: defaultValidator(),
1628
+ deliveryDate: defaultValidator('Укажите дату доставки'),
1629
+ };
1630
+ const validatorRetailObj = {
1631
+ organization: defaultSelectValidator('Выберите тип организации'),
1632
+ organizationAddress: addressOrganizationValidator(),
1623
1633
  organizationPhone: phoneValidator('Укажите номер телефона'),
1624
- birthday: defaultValidator('Укажите дату рождения'),
1634
+ organizationName: defaultValidator('Укажите наименование организации'),
1635
+ legalForm: defaultValidator('Укажите ОПФ'),
1636
+ generalSeniority: jobNumberValidator('Укажите количество лет стажа'),
1637
+ lastJobExperience: jobNumberValidator('Укажите стаж на последнем месте работы'),
1638
+ experience5Years: jobNumberValidator('Укажите общий стаж за последние 5 лет'),
1639
+ jobsNumber: jobNumberValidator('Укажите количество мест работы за последние 5 лет'),
1640
+ beginDate: defaultValidator('Укажите дату заключения трудового договора'),
1641
+ addressFact: addressDaDataValidator(),
1642
+ addressRegistration: addressDaDataValidator(),
1643
+ addressRetail: defaultSelectValidator('Выберите адрес банка'),
1644
+ addressMatch: defaultValidator(),
1645
+ sex: defaultValidator('Укажите свой пол'),
1625
1646
  limitedBirthday: limitedBirthdayValidator(),
1626
1647
  birthPlace: defaultValidator('Укажите место рождения'),
1627
1648
  education: defaultSelectValidator('Выберите ваше образование'),
1628
1649
  housing: defaultSelectValidator('Выберите тип жилья'),
1629
- employment: defaultSelectValidator('Выберите информацию о трудоустройстве'),
1630
- organization: defaultSelectValidator('Выберите тип организации'),
1631
1650
  amountWorkers: defaultSelectValidator('Выберите информацию о количестве сотрудников'),
1651
+ employment: defaultSelectValidator('Выберите информацию о трудоустройстве'),
1632
1652
  employerActivities: defaultSelectValidator('Выберите вид деятельности организации'),
1633
1653
  employerOrganization: defaultSelectValidator('Выберите вид организации'),
1634
1654
  positionOrganization: defaultSelectValidator('Выберите вашу должность'),
1635
- dulSerie: serieValidator('Укажите серию паспорта'),
1636
- dulNumber: numberValidator('Укажите номер паспорта'),
1637
- dulIssueDateField: defaultValidator('Укажите дату выдачи паспорта'),
1638
- dulSubdivisionCode: numberValidator('Укажите код подразделения'),
1639
- dulIssuedBy: defaultValidator('Укажите организацию, выдавшую паспорт'),
1640
- email: emailValidator('Укажите электронную почту'),
1641
- fullName: defaultValidator(),
1642
- inn: innValidator('Укажите ИНН'),
1643
- legalForm: defaultValidator('Укажите ОПФ'),
1644
- organizationName: defaultValidator('Укажите наименование организации'),
1645
- generalSeniority: jobNumberValidator('Укажите количество лет стажа'),
1646
- lastJobExperience: jobNumberValidator('Укажите стаж на последнем месте работы'),
1647
- experience5Years: jobNumberValidator('Укажите общий стаж за последние 5 лет'),
1648
- jobsNumber: jobNumberValidator('Укажите количество мест работы за последние 5 лет'),
1649
- beginDate: defaultValidator('Укажите дату заключения трудового договора'),
1650
- addressFact: addressDaDataValidator(),
1651
- partnerComments: defaultValidator(),
1652
- collectionCount: defaultValidator(),
1653
- comment: defaultValidator(),
1654
- acquiringType: defaultSelectValidator(),
1655
- feedbackMethod: defaultSelectValidator(),
1656
- serviceType: defaultSelectValidator(),
1657
- serviceDirection: defaultSelectValidator(),
1658
- regionRetail: defaultSelectValidator('Выберите регион'),
1659
- meetingDay: defaultValidator(),
1660
- product: defaultValidator(),
1661
- localities: defaultValidator(),
1662
- consentDataProcessing: agreementValidator,
1663
- annualRevenue: defaultValidator(),
1664
- consentToReceiveMaterials: agreementValidator,
1665
- processPersonalDataFlg: agreementValidator,
1666
- consentProviderFlg: agreementValidator,
1667
- consentPfrFlg: agreementValidator,
1668
- consentOthersFlg: agreementValidator,
1669
- consentInformFlg: agreementValidator,
1670
1655
  familyStatus: defaultSelectValidator('Выберите семейное положение'),
1671
- children: lengthStringValidator(2, 'Укажите количество детей'),
1672
1656
  familyMembers: lengthStringValidator(2, 'Укажите количество членов семьи'),
1657
+ children: lengthStringValidator(2, 'Укажите количество детей'),
1673
1658
  dependents: lengthStringValidator(2, 'Укажите количество иждивенцев'),
1674
1659
  totalIncome: lengthStringValidator(19, 'Укажите среднемесячный доход от основной зарплаты'),
1675
1660
  expenses: lengthStringValidator(10, 'Укажите сумму обязательных выплат'),
1676
1661
  snils: snilsValidator('Некорректный номер СНИЛС'),
1677
1662
  conscription: defaultValidator(),
1678
1663
  armyIdFlg: agreementValidator,
1679
- sex: defaultValidator('Укажите свой пол'),
1680
- addressRegistration: addressDaDataValidator(),
1681
- organizationAddress: addressOrganizationValidator(),
1664
+ dulSerie: serieValidator('Укажите серию паспорта'),
1665
+ dulNumber: numberValidator('Укажите номер паспорта'),
1666
+ dulIssueDateField: defaultValidator('Укажите дату выдачи паспорта'),
1667
+ dulSubdivisionCode: numberValidator('Укажите код подразделения'),
1668
+ dulIssuedBy: defaultValidator('Укажите организацию, выдавшую паспорт'),
1682
1669
  participantDateRegistration: defaultValidator('Укажите дату регистрации'),
1683
1670
  retirementIncome: defaultValidator(),
1684
1671
  otherIncome: defaultValidator(),
@@ -1690,15 +1677,37 @@
1690
1677
  legalEntityName: defaultValidator(),
1691
1678
  bankEmployeeCode: defaultValidator(),
1692
1679
  partInBusiness: defaultValidator(),
1693
- addressRetail: defaultSelectValidator('Выберите адрес банка'),
1694
- addressMatch: defaultValidator(),
1695
- codeWord: codeWordValidator('Необходимо ввести кодовое слово'),
1696
- confirmationIncome: defaultSelectValidator(),
1697
- deliveryDate: defaultValidator('Укажите дату доставки'),
1698
- addressCourier: addressDaDataValidator(),
1699
- cardCategory: defaultValidator('Укажите категорию карты'),
1700
- paymentSystem: defaultValidator('Укажите тип платежной системы'),
1701
- currency: defaultValidator('Укажите валюту'),
1680
+ regionRetail: defaultSelectValidator('Выберите регион'),
1681
+ };
1682
+ const validatorObj = {
1683
+ fullName: defaultValidator(),
1684
+ addressBranch: defaultSelectValidator(),
1685
+ desiredMeetingDate: defaultValidator(),
1686
+ product: defaultValidator(),
1687
+ localities: defaultValidator(),
1688
+ partnerComments: defaultValidator(),
1689
+ collectionCount: defaultValidator(),
1690
+ acquiringType: defaultSelectValidator(),
1691
+ serviceType: defaultSelectValidator(),
1692
+ annualRevenue: defaultValidator(),
1693
+ feedbackMethod: defaultSelectValidator(),
1694
+ serviceDirection: defaultSelectValidator(),
1695
+ secondaryPhone: phoneValidator('Укажите номер телефона'),
1696
+ region: defaultSelectValidator(),
1697
+ surname: nameValidator('Укажите свою фамилию'),
1698
+ name: nameValidator('Укажите своё имя'),
1699
+ middleName: nameValidator('Укажите своё отчество'),
1700
+ birthday: defaultValidator('Укажите дату рождения'),
1701
+ phone: phoneValidator('Укажите номер телефона'),
1702
+ email: emailValidator('Укажите электронную почту'),
1703
+ inn: innValidator('Укажите ИНН'),
1704
+ comment: defaultValidator(),
1705
+ typeForm: defaultValidator(),
1706
+ consentToReceiveMaterials: agreementValidator,
1707
+ consentDataProcessing: agreementValidator,
1708
+ ...validatorConsentsObj,
1709
+ ...validatorRetailObj,
1710
+ ...validatorCreditCardObj,
1702
1711
  };
1703
1712
  const getObjectValidator = (inputs) => {
1704
1713
  const requiredInputs = getNamesFromInput(inputs.filter((_) => Boolean(_?.required)));
@@ -1843,825 +1852,412 @@
1843
1852
  })), ...getValidation(field('addressBranch'), validatorObj.addressBranch, input?.required), isSearch: true }));
1844
1853
  });
1845
1854
 
1846
- const AddressFactField = JSX(({ field, input }) => {
1847
- const fieldName = 'addressFact';
1848
- const fieldValue = field(fieldName).value;
1849
- const { value } = field('addressMatch');
1850
- useEffect(() => {
1851
- if (value) {
1852
- field('addressFact')?.onChange?.(field('addressRegistration').value);
1853
- }
1854
- }, [value, field('addressRegistration').value]);
1855
- const onDaDataChange = useCallback((item) => {
1856
- field?.(fieldName)?.onChange?.({
1857
- apartment: item?.data?.flat,
1858
- city: item?.data?.city,
1859
- district: item?.data?.area_with_type,
1860
- fullAddress: item?.value,
1861
- fiasCode: item?.data?.fias_id,
1862
- house: item?.data?.house,
1863
- locality: item?.data?.settlement_with_type,
1864
- okatoRegionCode: item?.data?.okato,
1865
- postcode: item?.data?.postal_code,
1866
- region: item?.data?.region,
1867
- regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
1868
- street: item?.data?.house,
1869
- qc: item?.data?.qc,
1870
- qcComplete: item?.data?.qc_complete,
1871
- qcHouse: item?.data?.qc_house,
1872
- });
1873
- }, []);
1874
- const onChange = useCallback((val) => {
1875
- field?.(fieldName)?.onChange?.({
1876
- apartment: '',
1877
- city: '',
1878
- district: '',
1879
- fullAddress: val,
1880
- fiasCode: '',
1881
- house: '',
1882
- locality: '',
1883
- okatoRegionCode: '',
1884
- postcode: '',
1885
- region: '',
1886
- regionCode: '',
1887
- street: '',
1888
- qc: '',
1889
- qcComplete: '',
1890
- qcHouse: '',
1891
- });
1892
- }, []);
1893
- return (jsx(InputControl, { label: "\u0410\u0434\u0440\u0435\u0441", disabled: value, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required), value: fieldValue.fullAddress, onChange: onChange, ...input, onDaDataChange: onDaDataChange }));
1894
- });
1895
-
1896
- const ESIA_FIELD_NAME = 'esiaAccountTypeCd';
1897
- const isEsiaAuthorize = (field, name) => Boolean(field(ESIA_FIELD_NAME)?.value?.key) && field(name).value;
1898
-
1899
- const AddressField = JSX(({ field, input }) => {
1900
- const fieldName = input?.name || 'addressRegistration';
1901
- const fieldValue = field(fieldName).value;
1902
- const onDaDataChange = useCallback((item) => {
1903
- field?.(fieldName)?.onChange?.(getAddressFromDaDataItem(item));
1904
- }, []);
1905
- const onChange = useCallback((value) => {
1906
- field?.(fieldName)?.onChange?.({
1907
- apartment: '',
1908
- city: '',
1909
- district: '',
1910
- fullAddress: value,
1911
- fiasCode: '',
1912
- house: '',
1913
- locality: '',
1914
- okatoRegionCode: '',
1915
- postcode: '',
1916
- region: '',
1917
- regionCode: '',
1918
- street: '',
1919
- qc: '',
1920
- qcComplete: '',
1921
- qcHouse: '',
1922
- });
1855
+ const useNormalizedInput = (props, { normalize, format }) => {
1856
+ const { value, onFocus, onBlur, onChange } = props;
1857
+ const [isFocused, setIsFocused] = useState(false);
1858
+ const handleFocus = useCallback((ev) => {
1859
+ setIsFocused(true);
1860
+ onFocus && onFocus(ev);
1923
1861
  }, []);
1924
- return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, fieldName), label: "\u0410\u0434\u0440\u0435\u0441", ...getValidation(field(fieldName), validatorObj[fieldName], input?.required), value: fieldValue.fullAddress, onChange: onChange, ...input, onDaDataChange: onDaDataChange }));
1925
- });
1926
- const getAddressFromDaDataItem = (item) => ({
1927
- apartment: item?.data?.flat,
1928
- city: item?.data?.city,
1929
- district: item?.data?.area_with_type,
1930
- fullAddress: item?.unrestricted_value,
1931
- fiasCode: item?.data?.fias_id,
1932
- house: item?.data?.house,
1933
- locality: item?.data?.settlement_with_type,
1934
- okatoRegionCode: item?.data?.okato,
1935
- postcode: item?.data?.postal_code,
1936
- region: item?.data?.region,
1937
- regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
1938
- street: item?.data?.street,
1939
- qc: item?.data?.qc,
1940
- qcComplete: item?.data?.qc_complete,
1941
- qcHouse: item?.data?.qc_house,
1942
- });
1862
+ const handleBlur = useCallback(() => {
1863
+ setIsFocused(false);
1864
+ onChange && onChange(normalize(value));
1865
+ onBlur && onBlur();
1866
+ }, [onChange, value]);
1867
+ return {
1868
+ value: (isFocused || !format ? value : format(value)),
1869
+ onFocus: handleFocus,
1870
+ onBlur: handleBlur,
1871
+ };
1872
+ };
1943
1873
 
1944
- const SVG = JSX(({ className, viewBox, fill = 'none', width, height, paths, ...commonOptions }) => {
1945
- 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) => {
1946
- const resultOptions = { ...commonOptions, ...options };
1947
- return (jsx("path", { d: d, fill: pathFill || 'currentColor', stroke: resultOptions.stroke, strokeLinecap: resultOptions.strokeLinecap, strokeLinejoin: resultOptions.strokeLinejoin, strokeWidth: resultOptions.strokeWidth, strokeMiterlimit: resultOptions.strokeMiterlimit }, i));
1948
- }) }));
1949
- });
1874
+ const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
1950
1875
 
1951
- const defaultCheckStyle = 'appearance-none w-5 h-5 border-solid flex-none';
1876
+ function parseDecimal(value) {
1877
+ const rawValue = (value || '').replace(/\D/g, '');
1878
+ const unsafeDecimal = parseInt(rawValue, 10);
1879
+ return Number.isNaN(unsafeDecimal) ? 0 : unsafeDecimal;
1880
+ }
1952
1881
 
1953
- const CHECK_PATHS = [
1954
- {
1955
- 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',
1956
- fillRule: 'evenodd',
1957
- clipRule: 'evenodd',
1958
- fill: 'white',
1959
- },
1960
- ];
1961
- const Checkbox = JSX(({ className, value, text, disabled, isRadio, onChange }) => {
1962
- const handleChange = useCallback((e) => {
1963
- if (disabled) {
1964
- return;
1965
- }
1966
- e.preventDefault();
1967
- onChange && onChange(!value);
1968
- }, [onChange, disabled, value]);
1969
- 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" }));
1970
- return (jsx("div", { className: className, children: jsxs("label", { className: style('flex items-center relative group/box', getCursorStyle(disabled)), onClick: handleChange, children: [jsx("div", { className: style(defaultCheckStyle, 'm-0', isRadio ? 'rounded-full border-2' : checkboxStyle(value), !disabled && value ? 'border-primary-main' : 'border-gray', disabled ? 'bg-main-disabled' : 'group-hover/box:border-primary-hover'), role: role(isRadio), "aria-checked": Boolean(value), "aria-disabled": Boolean(disabled), "aria-label": text }), value ? icon : null, renderText$2(text)] }) }));
1971
- });
1972
- const renderText$2 = (text) => text ? (jsx("div", { className: "ml-s", children: jsx(Text, { size: "text-l", font: "font-light", children: text }) })) : null;
1973
- const getCursorStyle = (disabled = false) => (disabled ? 'cursor-not-allowed' : 'cursor-pointer');
1974
- const role = (isRadio = false) => (isRadio ? 'radio' : 'checkbox');
1975
- const checkboxStyle = (value = false) => style('rounded border', { 'bg-primary-main': value });
1976
-
1977
- const CheckboxWithError = JSX(({ className, text, value, key, disabled, error, onChange }) => (jsxs("div", { className: style('shrink-0', className), children: [jsx(Checkbox, { text: text, value: value, disabled: disabled, onChange: onChange }, key), renderErrorText(error)] })));
1882
+ function renderRangeWithTicks({ list = [], min, max, step, value = list[0] || min, disabled, onChange, }) {
1883
+ const rangeValue = list.length ? list.indexOf(value) : value;
1884
+ const rangeValueShift = rangeValue > min ? rangeValue - min : 0;
1885
+ const percentage = (rangeValueShift * 100) / (max - min);
1886
+ const inputStyle = {
1887
+ backgroundSize: `${percentage.toFixed(2)}% 100%`,
1888
+ };
1889
+ return (jsxs("div", { children: [list.length ? (jsx("div", { className: "absolute w-full flex justify-between -bottom-[3px] px-m", children: list.map((_, i) => (jsx("div", { className: style('w-2 h-2 rounded-full', rangeValue <= i || disabled ? 'bg-gray' : 'bg-primary-main') }, String(i)))) })) : null, jsx("div", { className: "absolute inset-x-0 -bottom-1 px-m leading-[18px]", children: jsx("input", { className: "box-border w-full m-0 cursor-pointer slider relative z-10", style: inputStyle, type: "range", min: min, max: max, step: step, value: rangeValue, disabled: disabled, onChange: ((ev) => {
1890
+ const rawValue = parseDecimal(ev.target?.value);
1891
+ const newValue = list.length ? list[rawValue] : rawValue;
1892
+ onChange && onChange(newValue || 0);
1893
+ }) }) })] }));
1894
+ }
1978
1895
 
1979
- const AddressMatchField = JSX(({ field, input }) => {
1980
- return (jsx(CheckboxWithError, { text: "\u0410\u0434\u0440\u0435\u0441 \u0444\u0430\u043A\u0442\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043C\u0435\u0441\u0442\u0430 \u0436\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u0430 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u0435\u0442 \u0441 \u0430\u0434\u0440\u0435\u0441\u043E\u043C \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438", ...getValidation(field('addressMatch'), validatorObj.addressMatch, input?.required) }));
1896
+ const inputDisabledStyle = 'disabled:border-gray disabled:bg-main-divider';
1897
+ const DEFAULT_MIN = 1;
1898
+ const DEFAULT_MAX = 100;
1899
+ const InputRange = JSX((props) => {
1900
+ const { className, title, items = [], list = [], min = list.length ? 0 : DEFAULT_MIN, max = list.length ? list.length - 1 : DEFAULT_MAX, step = 1, value = list[0] || min, disabled = false, onChange, } = props;
1901
+ const normalizedProps = useNormalizedInput(props, {
1902
+ normalize: (_ = 0) => list.length ? closestValue(list)(_) : clamp(_, min, max),
1903
+ format: toLocalNumberFormat(),
1904
+ });
1905
+ const handleChange = useCallback((ev) => {
1906
+ onChange && onChange(parseDecimal(ev.target?.value));
1907
+ }, [onChange]);
1908
+ return (jsxs("div", { className: className, children: [jsxs("label", { className: "block relative", children: [title ? (jsx(Text, { size: "text-m", font: "font-light", color: "text-primary-text", children: title })) : null, jsx("input", { className: style('text-h3 w-full h-14', 'pl-m mt-xs box-border', 'text-primary-text', inputValidStyle, inputDisabledStyle), disabled: disabled, onChange: handleChange, ...normalizedProps }), renderRangeWithTicks({ list, min, max, step, disabled, value, onChange })] }), renderRangeCaption(items)] }));
1981
1909
  });
1910
+ const closestValue = (list) => (_) => list.reduce((prev, curr) => (Math.abs(curr - _) < Math.abs(prev - _) ? curr : prev));
1911
+ const renderRangeCaption = (items) => (jsx("div", { className: "flex justify-between my-xs", children: items.map((item, i) => (jsx(Text, { size: "text-s", font: "font-light", color: "text-secondary-text", children: item }, String(i)))) }));
1982
1912
 
1983
- const Loader = JSX(({ color = 'text-primary-main', position = 'absolute', blur = true, size = 'big' }) => (jsx("div", { className: style('flex justify-center items-center h-full w-full z-50', position, {
1984
- 'backdrop-blur': blur,
1985
- }), children: jsx("div", { className: style('inline-block ', 'animate-spin rounded-full', 'border-solid border-current', 'border-r-transparent', size === 'small' ? 'border-4 h-8 w-8' : 'border-8 h-28 w-28', color), role: "status" }) })));
1986
-
1987
- const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
1988
- const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
1989
- function renderClusterer({ yandexMaps, map, points, isLoad, }) {
1990
- if (isLoad || !points) {
1991
- return;
1992
- }
1993
- map.geoObjects.removeAll();
1994
- if (!points.length) {
1995
- return;
1996
- }
1997
- const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
1998
- const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
1999
- if (points.length && points.every((_) => 'type' in _)) {
2000
- const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
2001
- const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
2002
- const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
2003
- officeClusterer.add(officesGeoObjects);
2004
- remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
2005
- map.geoObjects.add(remoteWorkplaceClusterer);
2006
- map.geoObjects.add(officeClusterer);
2007
- }
2008
- else {
2009
- const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
2010
- officeClusterer.add(geoObjects);
2011
- map.geoObjects.add(officeClusterer);
2012
- }
2013
- map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
2014
- if (map.getZoom() > 10) {
2015
- map.setZoom(10);
2016
- }
2017
- });
2018
- }
2019
- const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
2020
- return new yandexMaps.Clusterer({
2021
- clusterIcons: [
2022
- {
2023
- href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
2024
- size: [78, 84],
2025
- offset: [-35, -50],
2026
- },
2027
- ],
2028
- clusterIconContentLayout,
2029
- clusterHideIconOnBalloonOpen: false,
2030
- geoObjectHideIconOnBalloonOpen: false,
2031
- });
2032
- };
2033
- const defineGeoObjects = (pointArr, type, yandexMaps) => {
2034
- return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
2035
- balloonContentHeader: content?.header,
2036
- balloonContentBody: content?.body,
2037
- balloonContentFooter: content?.footer,
2038
- hintContent: content?.hint,
2039
- }, {
2040
- iconLayout: 'default#image',
2041
- iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
2042
- iconImageSize: [78, 84],
2043
- iconImageOffset: [-35, -50],
2044
- }));
2045
- };
1913
+ const MIN_CREDIT_AMOUNT = 1000;
1914
+ const MAX_CREDIT_AMOUNT = 1000000000;
1915
+ const ITEMS_CREDIT_AMOUNT = ['От 1 000 ', 'До 1 000 000 000 '];
1916
+ const AmountField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0443\u043C\u043C\u0430, \u20BD", items: ITEMS_CREDIT_AMOUNT, min: MIN_CREDIT_AMOUNT, max: MAX_CREDIT_AMOUNT, ...field('amount') })));
2046
1917
 
2047
- const defaultStyle = {
2048
- focus: 'focus:border-primary-text focus:border',
2049
- hover: 'hover:bg-primary-hover',
2050
- active: 'active:bg-primary-active',
2051
- font: 'text-center font-sans',
2052
- };
1918
+ const AnnualRevenueField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0413\u043E\u0434\u043E\u0432\u0430\u044F \u0432\u044B\u0440\u0443\u0447\u043A\u0430, \u20BD", ...getValidation(field('annualRevenue'), validatorObj.annualRevenue, input?.required) })));
2053
1919
 
2054
- const styles$1 = {
2055
- ...defaultStyle,
2056
- border: 'border border-transparent rounded-md',
2057
- position: 'absolute flex items-center justify-center',
2058
- };
2059
- const renderUserGeolocation = (map, yandexMaps, className) => {
2060
- const setUserGeoLocation = () => {
2061
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2062
- // @ts-ignore
2063
- yandexMaps.geolocation
2064
- .get({
2065
- provider: 'yandex',
2066
- autoReverseGeocode: true,
2067
- mapStateAutoApply: true,
2068
- })
2069
- .then(function (result) {
2070
- map.current.geoObjects.add(result.geoObjects);
2071
- });
2072
- };
2073
- return (jsx("div", { className: `select-none cursor-pointer py-m w-12 bg-white ${Object.values(styles$1).join(' ')} ${className}`, onClick: setUserGeoLocation, children: jsx(Icon, { name: "UserGeoLocationIcon", width: "20", height: "16" }) }));
2074
- };
1920
+ const BankEmpoleeField = JSX(({ field }) => (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') })));
2075
1921
 
2076
- const getNS = (_) => globalThis[_];
2077
- const initializeExternalNS = (namespaceName, url) => {
2078
- const script = document.getElementById(url);
2079
- if (script) {
2080
- const ns = getNS(namespaceName);
2081
- if (ns) {
2082
- return Promise.resolve(ns);
2083
- }
2084
- else {
2085
- return new Promise((resolve) => {
2086
- script.addEventListener('load', () => {
2087
- resolve(getNS(namespaceName));
2088
- });
2089
- });
2090
- }
2091
- }
2092
- else {
2093
- return new Promise((resolve, reject) => {
2094
- const newScript = document.createElement('script');
2095
- newScript.src = url;
2096
- newScript.async = true;
2097
- newScript.id = url;
2098
- newScript.addEventListener('load', () => {
2099
- resolve(getNS(namespaceName));
2100
- });
2101
- newScript.addEventListener('error', (error) => {
2102
- reject(error);
2103
- });
2104
- document.head.appendChild(newScript);
2105
- });
2106
- }
2107
- };
2108
- function useExternalNS(namespaceName, url, unmountNS = true) {
2109
- const [externalNS, setExternalNS] = useState(undefined);
1922
+ const useElementSpace = (ref, heightEl) => {
1923
+ const [spaceAbove, setSpaceAbove] = useState(false);
2110
1924
  useEffect(() => {
2111
- let isMounted = true;
2112
- initializeExternalNS(namespaceName, url)
2113
- .then((ns) => {
2114
- if (isMounted) {
2115
- setExternalNS(ns);
2116
- }
2117
- })
2118
- .catch((error) => {
2119
- console.error(`Failed to initialize external namespace: ${error}`);
2120
- });
2121
- return () => {
2122
- isMounted = false;
2123
- if (unmountNS) {
2124
- const script = document.getElementById(url);
2125
- if (script) {
2126
- document.head.removeChild(script);
2127
- }
2128
- setExternalNS(undefined);
1925
+ const handleResize = () => {
1926
+ if (ref?.current) {
1927
+ const { top } = ref.current.getBoundingClientRect();
1928
+ const hasSpaceAbove = top > heightEl;
1929
+ setSpaceAbove(hasSpaceAbove);
2129
1930
  }
2130
1931
  };
2131
- }, [namespaceName, url, unmountNS]);
2132
- return externalNS;
2133
- }
2134
-
2135
- const YMAPS_NAMESPACE = 'ymaps';
2136
- const useYandexMaps = () => {
2137
- const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
2138
- return useExternalNS(YMAPS_NAMESPACE, url, false);
1932
+ handleResize();
1933
+ window.addEventListener('resize', handleResize);
1934
+ return () => window.removeEventListener('resize', handleResize);
1935
+ }, [ref]);
1936
+ return spaceAbove;
2139
1937
  };
2140
1938
 
2141
- const styles = {
2142
- ...defaultStyle,
2143
- border: 'border-b border-b-2 border-gray last:border-0',
2144
- position: 'relative flex items-center justify-center',
1939
+ const DAY_COUNT = 6;
1940
+ const WEEK_COUNT = 7;
1941
+ const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
1942
+ const calendarCells = [];
1943
+ let dayCounter = 1;
1944
+ for (let i = 0; i < DAY_COUNT; i++) {
1945
+ const rowCells = [];
1946
+ for (let j = 0; j < WEEK_COUNT; j++) {
1947
+ if (i === 0 && j < firstDayOfWeek) {
1948
+ rowCells.push(jsx("td", {}, `empty-${j}`));
1949
+ }
1950
+ else if (dayCounter > totalDays) {
1951
+ rowCells.push(jsx("td", {}, `empty-${j}`));
1952
+ }
1953
+ else {
1954
+ const currentDate = new Date(currentYear, currentMonth, dayCounter);
1955
+ const isToday = checkIsToday(currentDate, today);
1956
+ const isDisabled = checkIsDisabled(currentDate, min, max);
1957
+ rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
1958
+ dayCounter++;
1959
+ }
1960
+ }
1961
+ calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
1962
+ }
1963
+ return calendarCells;
2145
1964
  };
2146
- // TODO: Добавить метод определения центральной точки
2147
- const ZoomButton = JSX(({ yandexMaps, direction = 'in' }) => {
2148
- const iconName = direction === 'in' ? 'PlusIcon' : 'MinusIcon';
2149
- const changeZoom = () => {
2150
- const currentZoom = yandexMaps.current.getZoom();
2151
- const newZoom = direction === 'in' ? currentZoom + 1 : currentZoom - 1;
2152
- yandexMaps.current.setZoom(newZoom, { checkZoomRange: true });
2153
- };
2154
- return (jsx("div", { onClick: changeZoom, className: `${Object.values(styles).join(' ')} bg-white select-none cursor-pointer w-12 h-12`, children: jsx(Icon, { name: iconName, width: "20", height: "16" }) }));
2155
- });
2156
-
2157
- const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
2158
- // TODO: Поле для поиска: невыяснено среди каких данных делать поиск (искать в имени офиса, в адресе, метро и т.д.).
2159
- // Сейчас реализован поиск среди тестовых данных
2160
- // TODO: Также выяснить что делать когда ничего не найдено
2161
- // TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
2162
- const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad, selectedAddress }) => {
2163
- const map = useRef(null);
2164
- const parentDiv = useRef(null);
2165
- const yandexMaps = useYandexMaps();
2166
- useEffect(() => {
2167
- if (map.current) {
2168
- renderClusterer({ yandexMaps, map: map.current, points, isLoad });
2169
- }
2170
- else {
2171
- yandexMaps?.ready(() => {
2172
- // Ready function may be called few times, but must be called once
2173
- if (map.current) {
2174
- renderClusterer({ yandexMaps, map: map.current, points, isLoad });
2175
- return;
2176
- }
2177
- map.current = new yandexMaps.Map(parentDiv.current, {
2178
- center: getCenterPoint(points),
2179
- zoom,
2180
- controls: [],
2181
- suppressMapOpenBlock: true,
2182
- });
2183
- renderClusterer({ yandexMaps, map: map.current, points, isLoad });
2184
- });
2185
- }
2186
- // zoom к выбранному отделению банка в рамках задачи по retail
2187
- if (map.current && selectedAddress) {
2188
- yandexMaps?.geocode(selectedAddress).then((res) => {
2189
- const firstGeoObject = res.geoObjects.get(0);
2190
- const coords = firstGeoObject.geometry.getCoordinates();
2191
- map.current.setCenter(coords);
2192
- map.current.setZoom(18);
2193
- });
2194
- }
2195
- }, [yandexMaps, points, zoom, isLoad, selectedAddress]);
2196
- if (!yandexMaps) {
2197
- return null;
2198
- }
2199
- const zIndex = 'z-10';
2200
- return (jsxs("div", { ref: parentDiv, className: style('relative', 'w-full', className), children: [isLoad ? jsx(Loader, {}) : null, jsxs("div", { className: style('absolute right-2 top-52 z-10 w-12 overflow-hidden border border-transparent rounded-md', zIndex), children: [jsx(ZoomButton, { yandexMaps: map }), jsx(ZoomButton, { yandexMaps: map, direction: "out" })] }), renderUserGeolocation(map, yandexMaps, style('right-2 top-80', zIndex))] }));
1965
+ const checkIsToday = (currentDate, today) => today && currentDate.toDateString() === today.toDateString();
1966
+ const checkIsDisabled = (currentDate, min, max) => (min && currentDate.getTime() < min.getTime()) || (max && currentDate.getTime() > max.getTime());
1967
+ const getDayStyles = (isToday = false, isDisabled = false) => style('p-s text-center rounded-md border', {
1968
+ 'border-transparent hover:bg-gray': !isToday,
1969
+ }, isDisabled ? 'text-gray hover:bg-transparent' : 'cursor-pointer');
1970
+
1971
+ const WEEK_DAYS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
1972
+ const Calendar = JSX(({ today, currentMonth, currentYear, min, max, onDateSelect = noop, setValue = noop }) => {
1973
+ const handleDateClick = useCallback((date) => {
1974
+ onDateSelect(date);
1975
+ setValue(false);
1976
+ }, []);
1977
+ const { firstDayOfWeek, totalDays } = useMemo(() => ({
1978
+ firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
1979
+ totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
1980
+ }), [currentYear, currentMonth]);
1981
+ 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({
1982
+ firstDayOfWeek,
1983
+ today,
1984
+ totalDays,
1985
+ currentYear,
1986
+ currentMonth,
1987
+ min,
1988
+ max,
1989
+ onDateClick: handleDateClick,
1990
+ }) })] }));
2201
1991
  });
2202
- const getCenterPoint = (points) => {
2203
- const centerCoords = [
2204
- getArraySumAndAverage(mapByIndex(points, 0)),
2205
- getArraySumAndAverage(mapByIndex(points, 1)),
2206
- ];
2207
- return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
2208
- };
2209
- const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
2210
- const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
2211
1992
 
2212
- const fetchRetailJSON = async (url, method, body) => {
2213
- try {
2214
- const response = await doRequest(url, method, body);
2215
- return response.json();
2216
- }
2217
- catch (err) {
2218
- console.error(err);
2219
- return null;
1993
+ const months = [
1994
+ 'Январь',
1995
+ 'Февраль',
1996
+ 'Март',
1997
+ 'Апрель',
1998
+ 'Май',
1999
+ 'Июнь',
2000
+ 'Июль',
2001
+ 'Август',
2002
+ 'Сентябрь',
2003
+ 'Октябрь',
2004
+ 'Ноябрь',
2005
+ 'Декабрь',
2006
+ ];
2007
+
2008
+ function normalizeWithMask(value, pattern) {
2009
+ const valueNumbers = value.replace(/\D/g, '');
2010
+ if (valueNumbers === '' || valueNumbers.length === pattern.length) {
2011
+ return value;
2220
2012
  }
2221
- };
2222
- async function doRequest(url, method, body) {
2223
- return globalThis?.fetch?.(`${API_BASE_URI}${url}`, {
2224
- method,
2225
- headers: {
2226
- 'Content-Type': 'application/json',
2227
- ...getAuthorizationHeaders(),
2228
- },
2229
- credentials: 'include',
2230
- body: body ? JSON.stringify(body) : null,
2231
- });
2013
+ const patternInArr = [...pattern];
2014
+ const firstPlaceholderIndex = patternInArr.findIndex(isPlaceholder$1);
2015
+ const valueWildcardIndicies = patternInArr.map((_, i) => isWildcard$1(_) ? patternInArr.slice(0, i).filter(isWildcard$1).length : -1);
2016
+ const applyPlaceholder = (_, i) => isDigit$1(_) ? _ : valueNumbers.charAt(valueWildcardIndicies[i]) || _;
2017
+ const resultInArr = patternInArr.map(applyPlaceholder);
2018
+ const resultLength = valueWildcardIndicies.indexOf(valueNumbers.length - 1) + 1;
2019
+ return resultInArr.slice(0, Math.max(firstPlaceholderIndex, resultLength)).join('');
2232
2020
  }
2233
- const getAuthorizationHeaders = () => {
2234
- const token = sessionStorage.getItem('accessToken');
2235
- return token ? { Authorization: `Bearer ${token}` } : null;
2236
- };
2237
-
2238
- const fetchRegionOffices = async (regionKey) => {
2239
- const response = await fetchRetailJSON('/public-data/regionOffices', 'POST', {
2240
- regionRfCd: {
2241
- key: regionKey,
2242
- },
2243
- cashCardFlg: true,
2244
- });
2245
- return (response?.offices?.map((office) => ({
2246
- ...office,
2247
- gpsLatitude: formatCoordinate(office.latitude ?? DEFAULT_CENTER_COORDS[0]),
2248
- gpsLongitude: formatCoordinate(office.longitude ?? DEFAULT_CENTER_COORDS[1]),
2249
- })) || []);
2250
- };
2251
- const formatCoordinate = (coordinate) => Number(coordinate.toString().replace(',', '.'));
2021
+ const isPlaceholder$1 = (_) => _ === '_';
2022
+ const isDigit$1 = (_) => /\d/.test(_);
2023
+ const isWildcard$1 = (_) => isPlaceholder$1(_) || isDigit$1(_);
2252
2024
 
2253
- const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
2254
- const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
2255
- const onToggle = useCallback(() => {
2256
- setIsUnfolded((_) => !_);
2257
- }, []);
2258
- const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
2259
- const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
2260
- return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
2261
- });
2025
+ const START_YEAR = 1940;
2026
+ const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
2262
2027
 
2263
- function useResizeObserver(callback, deps) {
2028
+ const ICON_PROPS$1 = {
2029
+ name: 'CalendarIcon',
2030
+ iconVersion: 'black',
2031
+ width: '24',
2032
+ height: '24',
2033
+ };
2034
+ const DatePickerInput = JSX(({ setSelectedMonth, setSelectedYear, className, value, disabled, onChange, onClick }) => {
2264
2035
  const ref = useRef(null);
2265
- useEffect(() => {
2266
- const element = ref?.current;
2267
- if (!element) {
2268
- return undefined;
2036
+ const [inputValue, setInputValue] = useState(value || '');
2037
+ const handleChange = (ev) => {
2038
+ const val = ev.target?.value;
2039
+ if (typeof val === 'string' && val?.length < 11) {
2040
+ setInputValue(normalizeWithMask(val, '__.__.____'));
2269
2041
  }
2270
- const observer = new ResizeObserver((entries) => {
2271
- callback(element, entries[0]);
2272
- });
2273
- observer.observe(element);
2274
- return () => {
2275
- observer.disconnect();
2276
- };
2277
- }, [callback, ...deps]);
2278
- return ref;
2279
- }
2280
-
2281
- const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
2282
- const containerRef = useRef(null);
2283
- const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
2284
- if (containerRef.current) {
2285
- containerRef.current.style.maxHeight = isUnfolded
2286
- ? `${childrenWrapperEl.scrollHeight}px`
2287
- : '';
2042
+ };
2043
+ const onBlur = () => {
2044
+ if (checkIsValidDate(inputValue)) {
2045
+ const [day, month, year] = inputValue.split('.');
2046
+ onChange?.(new Date(Number(year), Number(month) - 1, Number(day)));
2047
+ setSelectedMonth(Number(month) - 1);
2048
+ setSelectedYear(Number(year));
2288
2049
  }
2289
- }, [isUnfolded]);
2290
- return (jsx("div", { ref: containerRef, className: `transition-max-h duration-300 overflow-hidden ${containerRef.current || !isUnfolded ? 'max-h-0' : ''} `, children: jsx("div", { className: className, ref: childrenWrapperRef, children: children }) }));
2050
+ else {
2051
+ setInputValue(value || '');
2052
+ }
2053
+ };
2054
+ const onInputClick = () => {
2055
+ if (ref.current !== null) {
2056
+ ref.current.focus();
2057
+ }
2058
+ onClick?.();
2059
+ };
2060
+ useEffect(() => {
2061
+ setInputValue(value || '');
2062
+ }, [value]);
2063
+ return (jsxs("div", { onClick: onInputClick, className: style('relative', className), children: [jsx("input", { ref: ref, className: "h-full w-full px-m text-l text-black focus-visible:outline-none", value: inputValue, type: "text", onChange: handleChange, onBlur: onBlur, disabled: disabled }), disabled ? null : jsx(Icon, { className: "mr-s", ...ICON_PROPS$1 })] }));
2291
2064
  });
2292
-
2293
- const CardCell = JSX(({ value, subText, children, isPhone, ...props }) => {
2294
- const textItems = (Array.isArray(value) ? value : value?.split(',') ?? []).filter(Boolean);
2295
- if ([textItems.length, children, subText].every((_) => !_)) {
2296
- return null;
2065
+ const isValidYear = (year) => Number(year) >= START_YEAR && Number(year) <= new Date().getFullYear();
2066
+ const isValidMonth = (month) => Number(month) > 0 && Number(month) < 13;
2067
+ const checkIsValidDate = (date) => {
2068
+ const [day, month, year] = date.split('.');
2069
+ if (isValidYear(year)) {
2070
+ if (isValidMonth(month)) {
2071
+ const currentDate = new Date(Number(year), Number(month) - 1, 1);
2072
+ let maxDateOfMonth = 0;
2073
+ while (currentDate.getMonth() === Number(month) - 1) {
2074
+ currentDate.setDate(currentDate.getDate() + 1);
2075
+ maxDateOfMonth++;
2076
+ }
2077
+ if (Number(day) > 0 && Number(day) <= maxDateOfMonth) {
2078
+ return true;
2079
+ }
2080
+ }
2297
2081
  }
2298
- return renderCardCell({ textItems, subText, children, isPhone, ...props });
2299
- });
2300
- const renderCardCell = ({ label, labelSize = 'text-m', textItems, subColor, subText, className, children, isPhone = false, }) => (jsxs("div", { className: style('flex gap-2xs flex-col h-full max-w-[300px]', className), children: [label ? (jsx(Text, { color: "text-secondary-text", font: "font-light", size: labelSize, children: label })) : null, children || renderTextItems(textItems, isPhone), subText ? (jsx(Text, { color: subColor, size: "text-m", children: subText })) : null] }));
2301
- const renderTextItems = (textItems, isPhone) => textItems.filter(Boolean).map((text, i) => (jsx(Text, { size: "text-l", children: isPhone ? jsx("a", { href: `tel:${cleanPhoneNumber(text)}`, children: text.trim() }) : text.trim() }, String(i))));
2302
- const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
2082
+ return false;
2083
+ };
2303
2084
 
2304
- const CardRow = JSX(({ className, children }) => (jsx("div", { className: style('flex flex-col sm:flex-row sm:border-t sm:border-solid sm:border-main-divider py-xl gap-x-6xl gap-y-xl', className), children: children })));
2085
+ const formStyle = 'flex justify-between items-center h-14 border rounded-md cursor-pointer ' +
2086
+ 'hover:border-black active:border-black focus:border-black';
2087
+ const renderDatePickerForm = ({ handleChangeVisibleCalendar, value, valid, onChange, setSelectedMonth, setSelectedYear, disabled = false, }) => (jsx(DatePickerInput, { onChange: onChange, disabled: disabled, onClick: handleChangeVisibleCalendar, value: value && formatDate(value), setSelectedMonth: setSelectedMonth, setSelectedYear: setSelectedYear, className: style(formStyle, valid ? 'border-gray' : 'border-error') }));
2305
2088
 
2306
- const getScheduleDescription = (workScheduleWeek) => {
2307
- const rows = getDateDescription(workScheduleWeek);
2308
- return jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", value: rows, className: "max-w-none" });
2309
- };
2310
- const buildScheduleText = ({ workTime = '', lunchHour = '', daysOff = '' }, isSaturday = false) => {
2311
- if (!workTime) {
2312
- return '';
2313
- }
2314
- return [
2315
- `${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
2316
- lunchHour ? `перерыв: ${lunchHour}` : '',
2317
- daysOff ? `не работает: ${daysOff}` : '',
2318
- ]
2319
- .filter(Boolean)
2320
- .join('; ');
2089
+ const MONTHS_COUNT = 11;
2090
+ const MONTHS_OPTIONS = months.map((key) => ({ key }));
2091
+ const YEARS_OPTIONS = getYears()
2092
+ .reverse()
2093
+ .map((key) => ({ key: String(key) }));
2094
+ const useDatePickerManager = ({ onShowCalendar, showCalendar, selectedMonth, onMonthSelect, onYearSelect, selectedYear, onChange, value, }) => {
2095
+ const close = useCallback(() => showCalendar && onShowCalendar(false), [showCalendar]);
2096
+ const ref = useOutsideClick(close);
2097
+ const handleChangeVisibleCalendar = useCallback(() => onShowCalendar(!showCalendar), [showCalendar]);
2098
+ const handleNextMonth = useCallback(() => {
2099
+ if (selectedMonth + 1 <= MONTHS_COUNT) {
2100
+ onMonthSelect(selectedMonth + 1);
2101
+ }
2102
+ else {
2103
+ onMonthSelect(0);
2104
+ onYearSelect(selectedYear + 1);
2105
+ }
2106
+ }, [selectedMonth]);
2107
+ const handlePrevMonth = useCallback(() => {
2108
+ if (selectedMonth - 1 >= 0) {
2109
+ onMonthSelect(selectedMonth - 1);
2110
+ }
2111
+ else {
2112
+ onMonthSelect(11);
2113
+ onYearSelect(selectedYear - 1);
2114
+ }
2115
+ }, [selectedMonth]);
2116
+ const handleSelectMonth = useCallback(({ key }) => {
2117
+ onMonthSelect(months.indexOf(key));
2118
+ const maxDateOfMonth = calculateMaxDaysOfMonth(selectedYear, months.indexOf(key));
2119
+ handleChangeMonth({
2120
+ maxDateOfMonth,
2121
+ selectedYear,
2122
+ selectedMonth: months.indexOf(key),
2123
+ value,
2124
+ onChange,
2125
+ });
2126
+ }, [value]);
2127
+ const handleSelectYear = useCallback(({ key }) => {
2128
+ onYearSelect(Number(key));
2129
+ value && onChange?.(new Date(Number(key), selectedMonth, value?.getDate()));
2130
+ }, [value]);
2131
+ return {
2132
+ handleChangeVisibleCalendar,
2133
+ handleNextMonth,
2134
+ handlePrevMonth,
2135
+ handleSelectMonth,
2136
+ handleSelectYear,
2137
+ monthsOptions: MONTHS_OPTIONS,
2138
+ yearsOptions: YEARS_OPTIONS,
2139
+ ref,
2140
+ };
2321
2141
  };
2322
- const getDateDescription = (workScheduleWeek) => {
2323
- const workingWeekday = workScheduleWeek.find((_) => _.key !== 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
2324
- const workingSaturday = workScheduleWeek.find((_) => _.key === 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
2325
- const daysOff = workScheduleWeek
2326
- .filter((_) => !_.status)
2327
- .map((_) => _.short?.toLowerCase())
2328
- .join(', ');
2329
- const rows = [
2330
- buildScheduleText({
2331
- workTime: workingWeekday?.workTime,
2332
- lunchHour: workingWeekday?.lunchHour,
2333
- daysOff: workingSaturday ? '' : daysOff,
2334
- }),
2335
- buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
2336
- ].filter(Boolean);
2337
- return rows;
2142
+ const calculateMaxDaysOfMonth = (selectedYear, selectedMonth) => {
2143
+ const date = new Date(selectedYear, selectedMonth, 1);
2144
+ let maxDateOfMonth = 0;
2145
+ while (date.getMonth() === selectedMonth) {
2146
+ maxDateOfMonth++;
2147
+ date.setDate(date.getDate() + 1);
2148
+ }
2149
+ return maxDateOfMonth;
2150
+ };
2151
+ const handleChangeMonth = ({ maxDateOfMonth, selectedYear, selectedMonth, value, onChange, }) => {
2152
+ value &&
2153
+ onChange?.(new Date(selectedYear, selectedMonth, Math.min(maxDateOfMonth, value.getDate())));
2338
2154
  };
2339
2155
 
2340
- const WEEKDAY_MAP = [
2341
- ['workingMonday', 'Пн', 'Понедельник'],
2342
- ['workingTuesday', 'Вт', 'Вторник'],
2343
- ['workingWednesday', 'Ср', 'Среда'],
2344
- ['workingThursday', 'Чт', 'Четверг'],
2345
- ['workingFriday', 'Пт', 'Пятница'],
2346
- ['workingSaturday', 'Сб', 'Суббота'],
2347
- ['workingSunday', 'Вс', 'Воскресенье'],
2348
- ];
2349
- const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
2350
- key,
2351
- title,
2352
- short,
2353
- status: Boolean(workSchedule?.[key]),
2354
- get workTime() {
2355
- return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
2356
- },
2357
- get lunchHour() {
2358
- return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
2359
- },
2360
- get hasLunch() {
2361
- return /\d+/.test(this.lunchHour ?? '');
2362
- },
2363
- }));
2364
-
2365
- const renderBusinessSchedule = (scheduleDescription) => {
2366
- if (!scheduleDescription) {
2367
- return null;
2368
- }
2369
- const businessSchedule = getBusinessSchedule(scheduleDescription);
2370
- return (jsxs(CardRow, { className: "border-none", children: [jsx(CardCell, { label: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: businessSchedule.map(renderAlternativeDay) }) }), jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", className: "max-w-none", children: jsx(Text, { children: scheduleDescription }) })] }));
2156
+ const ICON_PROPS = {
2157
+ name: 'ArrowUpIcon',
2158
+ iconVersion: 'black',
2159
+ width: '24',
2160
+ height: '24',
2371
2161
  };
2372
- const getBusinessSchedule = (scheduleDescription) => {
2373
- const weekDayMap = WEEKDAY_MAP.map(([, short]) => ({ short, status: true }));
2374
- const splittedScheduleDescription = scheduleDescription.split('/') ?? [];
2375
- const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
2376
- if (!lastPartScheduleDescription?.includes('выходной')) {
2377
- return weekDayMap;
2378
- }
2379
- return weekDayMap.map((_) => ({
2380
- ..._,
2381
- status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
2382
- }));
2162
+ const SELECT_PROPS = {
2163
+ className: 'min-w-32',
2164
+ iconVersion: 'black',
2165
+ isBorder: false,
2383
2166
  };
2384
- const renderAlternativeDay = ({ short, status }, i) => (jsx("div", { className: style('w-9 h-9 rounded-md flex items-center justify-center', status ? 'bg-green-more-light text-green-dark' : 'bg-error/30 text-error'), children: jsx(Text, { size: "text-xs", children: short }) }, String(i)));
2167
+ const DatePicker = JSX(
2168
+ // eslint-disable-next-line max-lines-per-function
2169
+ ({ className = '', label = '', value, valid = true, minDate, maxDate, disabled, onChange }) => {
2170
+ const [showCalendar, { setValue }] = useBool(false);
2171
+ const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
2172
+ const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
2173
+ const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
2174
+ onYearSelect: setSelectedYear,
2175
+ onMonthSelect: setSelectedMonth,
2176
+ onShowCalendar: setValue,
2177
+ selectedYear,
2178
+ selectedMonth,
2179
+ showCalendar,
2180
+ onChange,
2181
+ value,
2182
+ });
2183
+ const spaceAbove = useElementSpace(ref, 370);
2184
+ return (jsxs("div", { className: style('space-y-xs', className), ref: ref, children: [renderLabel(label), jsxs("div", { className: "relative", children: [renderDatePickerForm({
2185
+ handleChangeVisibleCalendar,
2186
+ value,
2187
+ valid,
2188
+ onChange,
2189
+ disabled,
2190
+ setSelectedMonth,
2191
+ setSelectedYear,
2192
+ }), showCalendar && !disabled ? (jsxs("div", { className: style('absolute bg-white z-20 select-none', {
2193
+ 'bottom-full': spaceAbove,
2194
+ }), 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, setValue: setValue })] })) : null] })] }));
2195
+ });
2385
2196
 
2386
- const renderCurrency = ({ currency, buyExchangeRate, saleExchangeRate }, i) => (jsxs("div", { className: "flex gap-lg h-full", children: [currency?.currency ? jsx(CardCell, { label: "\u0412\u0430\u043B\u044E\u0442\u0430", value: currency.currency }) : null, buyExchangeRate ? jsx(CardCell, { label: "\u041A\u0443\u043F\u0438\u0442\u044C", value: String(buyExchangeRate) }) : null, saleExchangeRate ? jsx(CardCell, { label: "\u041F\u0440\u043E\u0434\u0430\u0442\u044C", value: String(saleExchangeRate) }) : null] }, String(i)));
2197
+ const DatePickerControl = JSX(({ className, label, error, errors, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(DatePicker, { label: getRequiredLabel({ label, errors }), valid: Boolean(!error), ...rest }), renderErrorText(error)] })));
2387
2198
 
2388
- const colorStyle = {
2389
- yellow: { border: 'border-yellow-light', text: 'text-yellow' },
2390
- green: { border: 'border-green-more-light', text: 'text-green-dark' },
2391
- gray: { border: 'border-gray', text: 'text-secondary-text' },
2392
- red: { border: 'border-error/30', text: 'text-error' },
2393
- };
2394
- const Badge$1 = JSX(({ className, children, color = 'gray' }) => (jsxs("div", { className: style('sm:p-s sm:border sm:border-green rounded-md flex items-center h-fit', colorStyle[color].border, className), children: [jsx("div", { className: "block pr-m sm:pr-0 sm:hidden", children: jsx(Img, { image: { icon: 'SmallClockIcon' }, width: "24", height: "24" }) }), jsx(Text, { size: "text-m", color: colorStyle[color].text, children: children })] })));
2199
+ const BirthdayField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field('birthday'), validatorObj.birthday, input?.required) })));
2395
2200
 
2396
- const currentWeekDayIdx = new Date().getDay();
2397
- //TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
2398
- const renderCurrentDaySchedule = (workScheduleWeek) => {
2399
- const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
2400
- if (!currentWeekDay) {
2401
- return null;
2402
- }
2403
- const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
2404
- return status ? (jsxs("div", { className: "flex gap-s items-start whitespace-nowrap", children: [workTime ? jsx(Badge$1, { color: "green", children: workTime }) : null, lunchHour && hasLunch ? jsx(Badge$1, { color: "yellow", children: `перерыв: ${lunchHour}` }) : null] })) : (jsx(Badge$1, { color: "red", children: "\u0412\u044B\u0445\u043E\u0434\u043D\u043E\u0439" }));
2405
- };
2201
+ const CollectionCountField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432 \u0438\u043D\u043A\u0430\u0441\u0441\u0430\u0446\u0438\u0438", isInteger: true, ...getValidation(field('collectionCount'), validatorObj.collectionCount, input?.required) })));
2406
2202
 
2407
- const getSubTextLunch = ({ lunchHour, hasLunch = false, status = false }) => {
2408
- if (!status) {
2409
- return 'Не работает';
2410
- }
2411
- return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
2412
- };
2413
- const renderDay = ({ title, status, workTime, lunchHour, hasLunch }, i) => (jsx(CardCell, { label: title, value: status && workTime ? workTime : '', subText: getSubTextLunch({ lunchHour, hasLunch, status }), subColor: !status || hasLunch ? 'text-error' : 'text-green-dark' }, String(i)));
2203
+ const CommentField = JSX(({ field, input }) => (jsx(InputControl, { className: "col-span-2", ...getValidation(field('comment'), validatorObj.comment, input?.required), placeholder: "\u0412\u0430\u0448\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435", isTextarea: true })));
2414
2204
 
2415
- const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
2416
- const labels = ['Подробнее', 'Скрыть'];
2417
- const renderFoldButton$3 = ({ isUnfolded, onToggle }) => (jsxs("button", { className: "w-full py-2xl cursor-pointer text-primary-main flex items-center border-b border-solid border-main-divider", onClick: onToggle, type: "button", children: [jsx("div", { className: "pr-m", children: labels[Number(isUnfolded)] }), jsx(Icon, { className: "text-primary-text", name: ICONS$1[Number(isUnfolded)], width: "16", height: "16" })] }));
2205
+ const SVG = JSX(({ className, viewBox, fill = 'none', width, height, paths, ...commonOptions }) => {
2206
+ 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) => {
2207
+ const resultOptions = { ...commonOptions, ...options };
2208
+ return (jsx("path", { d: d, fill: pathFill || 'currentColor', stroke: resultOptions.stroke, strokeLinecap: resultOptions.strokeLinecap, strokeLinejoin: resultOptions.strokeLinejoin, strokeWidth: resultOptions.strokeWidth, strokeMiterlimit: resultOptions.strokeMiterlimit }, i));
2209
+ }) }));
2210
+ });
2418
2211
 
2419
- const renderWorkSchedule = (workSchedule) => {
2420
- const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2421
- const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
2422
- const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
2423
- if (!workSchedule) {
2424
- return '';
2425
- }
2426
- if (!workSchedule.businessScheduleVisibleTag) {
2427
- return renderMatchingTimeOfWork(timeOfWork);
2428
- }
2429
- if (workSchedule.businessScheduleVisibleTag &&
2430
- workSchedule.businessScheduleDescription === null) {
2431
- return renderIndividualTimeOfWork(timeOfWork);
2432
- }
2433
- return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
2434
- };
2435
- const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
2436
- const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
2437
- const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
2212
+ const defaultCheckStyle = 'appearance-none w-5 h-5 border-solid flex-none';
2438
2213
 
2439
- const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, i) => {
2440
- if (!workSchedule) {
2441
- return null;
2442
- }
2443
- const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2444
- return (jsxs("div", { className: "bg-white col-span-12 p-3xl sm:border-green sm:border", children: [jsxs("div", { className: "sm:flex sm:justify-between", children: [jsxs("div", { children: [jsx(Text, { size: "text-h4", children: name }), address ? (jsxs("div", { className: "flex pb-xl pt-xs gap-2xs", children: [jsx(Icon, { name: "GeolocationIcon", width: "24", height: "24" }), jsx(Text, { size: "text-l", children: address })] })) : null] }), renderCurrentDaySchedule(workScheduleWeek)] }), jsx("div", { className: "hidden sm:block", children: renderCardContent$1({
2445
- phone,
2446
- fax,
2447
- phoneBusiness,
2448
- phoneNatural,
2449
- phoneCallCentre,
2450
- phoneCurrencyControl,
2451
- workSchedule,
2452
- exchangeRate,
2453
- }) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
2454
- return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
2455
- phone,
2456
- fax,
2457
- phoneBusiness,
2458
- phoneNatural,
2459
- phoneCallCentre,
2460
- phoneCurrencyControl,
2461
- workSchedule,
2462
- exchangeRate,
2463
- }) }));
2464
- },
2465
- //** TODO: remove styles with refactoring DefaultFoldButton*/
2466
- renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
2467
- };
2468
- const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
2469
- const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2470
- const labelSchedule = workSchedule?.businessScheduleVisibleTag
2471
- ? 'Для физических лиц'
2472
- : 'Для физических и юридических лиц';
2473
- return (jsxs("div", { children: [jsxs(CardRow, { className: "flex-wrap border-b border-solid border-main-divider", children: [jsx(CardCell, { label: "\u0424\u0430\u043A\u0441", value: fax, isPhone: true }), jsx(CardCell, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D \u0444\u0438\u043B\u0438\u0430\u043B\u0430", value: phone, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0439 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneBusiness, isPhone: true }), jsx(CardCell, { label: "\u041E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneNatural, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043A\u043E\u043D\u0441\u0443\u043B\u044C\u0442\u0430\u0446\u0438\u0439 \u043F\u043E \u0432\u0430\u043B\u044E\u0442\u043D\u043E\u043C\u0443 \u043A\u043E\u043D\u0442\u0440\u043E\u043B\u044E", value: phoneCurrencyControl, isPhone: true }), jsx(CardCell, { label: "\u041A\u043E\u043D\u0442\u0430\u043A\u0442-\u0446\u0435\u043D\u0442\u0440", value: phoneCallCentre, isPhone: true })] }), workSchedule?.isMatchesPattern ? (jsx(CardRow, { children: jsx(CardCell, { label: labelSchedule, labelSize: "text-l", className: "w-full max-w-none", children: jsx("div", { className: "flex flex-wrap gap-xs sm:justify-between pt-xs", children: workScheduleWeek?.map(renderDay) }) }) })) : (jsxs(CardRow, { children: [jsx(CardCell, { label: labelSchedule, labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: workScheduleWeek?.map(renderAlternativeDay) }) }), getScheduleDescription(workScheduleWeek)] })), workSchedule?.businessScheduleVisibleTag
2474
- ? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
2475
- : null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
2476
- };
2477
- const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
2478
- const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
2479
- const header = capitalizedFirstLetter$1(name);
2480
- const body = `${address} ${renderWorkSchedule(workSchedule)}`;
2481
- return { header, body };
2482
- };
2483
-
2484
- const INITIAL_FILTRATION_STATE$1 = {
2485
- workingSaturday: false,
2486
- premiumService: false,
2487
- privateBanking: false,
2488
- remoteWorkplace: false,
2489
- serviceDisabledPeople: false,
2490
- sellingCoins: false,
2491
- buyingCoins: false,
2492
- bullionOperations: false,
2493
- preciousMetalsOperations: false,
2494
- transferringDataToBiometricSystem: false,
2495
- };
2496
- const FILTRATION_LABELS = {
2497
- safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
2498
- workingSaturday: 'Открыты по субботам',
2499
- terminalTypeAtms: 'Банкоматы',
2500
- terminalTypeTerm: 'Терминалы',
2501
- workAllTime: 'Круглосуточно',
2502
- billAcceptorEnable: 'Прием наличных',
2503
- premiumService: 'Премиальное обслуживание',
2504
- privateBanking: 'Услуга Private banking',
2505
- sellingCoins: 'Продажа монет из драгоценных металлов',
2506
- buyingCoins: 'Покупка монет из драгоценных металлов',
2507
- bullionOperations: 'Операции со слитками',
2508
- preciousMetalsOperations: 'Операции с драгоценными металлами',
2509
- transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
2510
- locationDisabledPeople: 'Для маломобильных',
2511
- designDisabledPeople: 'Для слабовидящих',
2512
- remoteWorkplace: 'Удаленное рабочее место',
2513
- serviceDisabledPeople: 'Для маломобильных граждан',
2514
- };
2515
- const FILTRATION_PREDICATES$1 = {
2516
- workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
2517
- premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
2518
- privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
2519
- remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
2520
- serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
2521
- sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
2522
- buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
2523
- bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
2524
- preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
2525
- transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
2526
- };
2527
-
2528
- const filterItems$1 = (data, filtrationState) => {
2529
- const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
2530
- return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
2531
- };
2532
-
2533
- const defaultEmptyFunction$1 = () => void 0;
2534
- const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, }) => {
2535
- const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
2536
- const _filteredItems = filterItems$1(data, filtrationState);
2537
- const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
2538
- const _points = [
2539
- ..._filteredItems.map((_) => ({
2540
- type: 'offices',
2541
- coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
2542
- content: getBalloon(_),
2543
- })),
2544
- ..._filteredRemoteWorkplaces.map((_) => ({
2545
- type: 'workplaces',
2546
- coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
2547
- content: getBalloonRemoteWorkplaces({
2548
- address: _.address,
2549
- workScheduleDescription: _.workScheduleDescription,
2550
- }),
2551
- })),
2552
- ].filter((_) => _.coords && _.coords.length === 2);
2553
- const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
2554
- return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
2555
- }, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
2556
- return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
2557
- };
2558
-
2559
- const useLeadFormData = (typeField) => {
2560
- const { data, error } = useAsyncData(`/api/v1/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
2561
- if (data && 'errorMessage' in data) {
2562
- return { error };
2563
- }
2564
- return { data: data, error };
2565
- };
2566
- const fetchData = async (url) => {
2567
- const result = await fetchJSON(url, { method: 'POST' });
2568
- return result || [];
2569
- };
2570
-
2571
- const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
2572
-
2573
- const isClient = !isSSR();
2574
- const ClientOnly = JSX(({ children }) => (isClient ? children : null));
2575
-
2576
- const AddressRetailField = JSX(({ field, input }) => {
2577
- const [offices, setOffices] = useState([]);
2578
- const { data } = useLeadFormData('REGION_RF');
2579
- const regionValue = field('regionRetail')?.value || {};
2580
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2581
- const fieldBranch = field('addressRetail');
2582
- useEffect(() => {
2583
- (async () => {
2584
- const officesList = await fetchRegionOffices(regionValue?.key ?? '');
2585
- setOffices(officesList);
2586
- })();
2587
- if (regionValue?.key) {
2588
- field?.('addressRetail')?.onChange?.('');
2214
+ const CHECK_PATHS = [
2215
+ {
2216
+ 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',
2217
+ fillRule: 'evenodd',
2218
+ clipRule: 'evenodd',
2219
+ fill: 'white',
2220
+ },
2221
+ ];
2222
+ const Checkbox = JSX(({ className, value, text, disabled, isRadio, onChange }) => {
2223
+ const handleChange = useCallback((e) => {
2224
+ if (disabled) {
2225
+ return;
2589
2226
  }
2590
- }, [regionValue.key]);
2591
- const { points } = useOfficesAtmsMapData({
2592
- data: offices,
2593
- filtrationState: {},
2594
- getBalloon: getOfficePoint,
2595
- });
2596
- const isRegionSelected = Boolean(regionValue?.key);
2597
- return (jsxs("div", { children: [jsx(SelectControl, { label: "\u0410\u0434\u0440\u0435\u0441 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u0435", options: offices.map(({ id, address = '' }) => ({
2598
- key: id?.toString() || '',
2599
- text: address,
2600
- })), ...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required && isRegionSelected), isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: !data, className: "h-full", selectedAddress: fieldBranch?.value?.text }) }) })] }));
2227
+ e.preventDefault();
2228
+ onChange && onChange(!value);
2229
+ }, [onChange, disabled, value]);
2230
+ 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" }));
2231
+ return (jsx("div", { className: className, children: jsxs("label", { className: style('flex items-center relative group/box', getCursorStyle(disabled)), onClick: handleChange, children: [jsx("div", { className: style(defaultCheckStyle, 'm-0', isRadio ? 'rounded-full border-2' : checkboxStyle(value), !disabled && value ? 'border-primary-main' : 'border-gray', disabled ? 'bg-main-disabled' : 'group-hover/box:border-primary-hover'), role: role(isRadio), "aria-checked": Boolean(value), "aria-disabled": Boolean(disabled), "aria-label": text }), value ? icon : null, renderText$2(text)] }) }));
2601
2232
  });
2233
+ const renderText$2 = (text) => text ? (jsx("div", { className: "ml-s", children: jsx(Text, { size: "text-l", font: "font-light", children: text }) })) : null;
2234
+ const getCursorStyle = (disabled = false) => (disabled ? 'cursor-not-allowed' : 'cursor-pointer');
2235
+ const role = (isRadio = false) => (isRadio ? 'radio' : 'checkbox');
2236
+ const checkboxStyle = (value = false) => style('rounded border', { 'bg-primary-main': value });
2602
2237
 
2603
- const useNormalizedInput = (props, { normalize, format }) => {
2604
- const { value, onFocus, onBlur, onChange } = props;
2605
- const [isFocused, setIsFocused] = useState(false);
2606
- const handleFocus = useCallback((ev) => {
2607
- setIsFocused(true);
2608
- onFocus && onFocus(ev);
2609
- }, []);
2610
- const handleBlur = useCallback(() => {
2611
- setIsFocused(false);
2612
- onChange && onChange(normalize(value));
2613
- onBlur && onBlur();
2614
- }, [onChange, value]);
2615
- return {
2616
- value: (isFocused || !format ? value : format(value)),
2617
- onFocus: handleFocus,
2618
- onBlur: handleBlur,
2619
- };
2620
- };
2238
+ const FIELD_NAME$c = 'consentToReceiveMaterials';
2239
+ const ConsentToReceiveMaterialsField = JSX(({ field, input }) => (jsx(Checkbox, { text: "\u0421\u043E\u0433\u043B\u0430\u0441\u0435\u043D \u043D\u0430 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u0435 \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u043E\u043D\u043D\u044B\u0445 \u0438 \u0430\u043D\u0430\u043B\u0438\u0442\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B\u043E\u0432 \u043F\u043E \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0447\u0442\u0435", ...getValidation(field(FIELD_NAME$c), validatorObj[FIELD_NAME$c], input?.required) })));
2621
2240
 
2622
- const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
2241
+ const DesiredMeetingDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0416\u0435\u043B\u0430\u0435\u043C\u0430\u044F \u0434\u0430\u0442\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0438", ...getValidation(field('desiredMeetingDate'), validatorObj.desiredMeetingDate, input?.required) })));
2623
2242
 
2624
- function parseDecimal(value) {
2625
- const rawValue = (value || '').replace(/\D/g, '');
2626
- const unsafeDecimal = parseInt(rawValue, 10);
2627
- return Number.isNaN(unsafeDecimal) ? 0 : unsafeDecimal;
2628
- }
2243
+ const EmailField = JSX(({ field, input }) => {
2244
+ const { required, ...rest } = input;
2245
+ return (jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...getValidation(field('email'), validatorObj.email, required), ...rest }));
2246
+ });
2629
2247
 
2630
- function renderRangeWithTicks({ list = [], min, max, step, value = list[0] || min, disabled, onChange, }) {
2631
- const rangeValue = list.length ? list.indexOf(value) : value;
2632
- const rangeValueShift = rangeValue > min ? rangeValue - min : 0;
2633
- const percentage = (rangeValueShift * 100) / (max - min);
2634
- const inputStyle = {
2635
- backgroundSize: `${percentage.toFixed(2)}% 100%`,
2636
- };
2637
- return (jsxs("div", { children: [list.length ? (jsx("div", { className: "absolute w-full flex justify-between -bottom-[3px] px-m", children: list.map((_, i) => (jsx("div", { className: style('w-2 h-2 rounded-full', rangeValue <= i || disabled ? 'bg-gray' : 'bg-primary-main') }, String(i)))) })) : null, jsx("div", { className: "absolute inset-x-0 -bottom-1 px-m leading-[18px]", children: jsx("input", { className: "box-border w-full m-0 cursor-pointer slider relative z-10", style: inputStyle, type: "range", min: min, max: max, step: step, value: rangeValue, disabled: disabled, onChange: ((ev) => {
2638
- const rawValue = parseDecimal(ev.target?.value);
2639
- const newValue = list.length ? list[rawValue] : rawValue;
2640
- onChange && onChange(newValue || 0);
2641
- }) }) })] }));
2642
- }
2248
+ const SERVICE_TYPES = [{ key: 'ULTRASERVICE', text: 'Ультра' }];
2249
+ const SERVICE_DIRECTIONS = [
2250
+ { key: 'Физическое лицо' },
2251
+ { key: 'Юридическое лицо / ИП' },
2252
+ ];
2253
+ const FEEDBACK_METHOD = [
2254
+ { key: 'phone', text: 'Телефонный звонок' },
2255
+ { key: 'email', text: 'Электронное сообщение' },
2256
+ ];
2643
2257
 
2644
- const inputDisabledStyle = 'disabled:border-gray disabled:bg-main-divider';
2645
- const DEFAULT_MIN = 1;
2646
- const DEFAULT_MAX = 100;
2647
- const InputRange = JSX((props) => {
2648
- const { className, title, items = [], list = [], min = list.length ? 0 : DEFAULT_MIN, max = list.length ? list.length - 1 : DEFAULT_MAX, step = 1, value = list[0] || min, disabled = false, onChange, } = props;
2649
- const normalizedProps = useNormalizedInput(props, {
2650
- normalize: (_ = 0) => list.length ? closestValue(list)(_) : clamp(_, min, max),
2651
- format: toLocalNumberFormat(),
2652
- });
2653
- const handleChange = useCallback((ev) => {
2654
- onChange && onChange(parseDecimal(ev.target?.value));
2655
- }, [onChange]);
2656
- return (jsxs("div", { className: className, children: [jsxs("label", { className: "block relative", children: [title ? (jsx(Text, { size: "text-m", font: "font-light", color: "text-primary-text", children: title })) : null, jsx("input", { className: style('text-h3 w-full h-14', 'pl-m mt-xs box-border', 'text-primary-text', inputValidStyle, inputDisabledStyle), disabled: disabled, onChange: handleChange, ...normalizedProps }), renderRangeWithTicks({ list, min, max, step, disabled, value, onChange })] }), renderRangeCaption(items)] }));
2657
- });
2658
- const closestValue = (list) => (_) => list.reduce((prev, curr) => (Math.abs(curr - _) < Math.abs(prev - _) ? curr : prev));
2659
- const renderRangeCaption = (items) => (jsx("div", { className: "flex justify-between my-xs", children: items.map((item, i) => (jsx(Text, { size: "text-s", font: "font-light", color: "text-secondary-text", children: item }, String(i)))) }));
2258
+ const FeedbackMethodField = JSX(({ field, input }) => (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, ...getValidation(field('feedbackMethod'), validatorObj.feedbackMethod, input?.required) })));
2660
2259
 
2661
- const MIN_CREDIT_AMOUNT = 1000;
2662
- const MAX_CREDIT_AMOUNT = 1000000000;
2663
- const ITEMS_CREDIT_AMOUNT = ['От 1 000 ₽', 'До 1 000 000 000 ₽'];
2664
- const AmountField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0443\u043C\u043C\u0430, \u20BD", items: ITEMS_CREDIT_AMOUNT, min: MIN_CREDIT_AMOUNT, max: MAX_CREDIT_AMOUNT, ...field('amount') })));
2260
+ const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...getValidation(field('fullName'), validatorObj.fullName, input?.required), ...input })));
2665
2261
 
2666
2262
  function copy(source, target) {
2667
2263
  for (const [k, v] of source.entries()) {
@@ -2811,320 +2407,1278 @@
2811
2407
  return useLocalStore();
2812
2408
  };
2813
2409
 
2814
- const SelectField = UniBlock(({ field, source, fieldName, input, placeholder = 'Выберите из списка',
2815
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2816
- options, ...rest }) => {
2817
- const leadOptions = source?.map((_) => ({
2818
- key: _.key || '',
2819
- text: _.value,
2820
- })) || [];
2821
- return (jsx(SelectControl, { placeholder: placeholder, options: leadOptions, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required), ...rest }));
2822
- });
2823
-
2824
- const AmountWorkersField = JSX(({ field, input }) => {
2825
- const { data } = useLeadFormData('EMPLOYEES_NUMBER');
2826
- const store = useRetailFormStore();
2827
- useEffect(() => {
2828
- if (data) {
2829
- store.amountWorkers = data;
2830
- }
2831
- }, [data]);
2832
- return (jsx(SelectField, { field: field, source: store.amountWorkers ?? [], label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0449\u0438\u0445 \u0432 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "amountWorkers", input: input }));
2833
- });
2834
-
2835
- const AnnualRevenueField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0413\u043E\u0434\u043E\u0432\u0430\u044F \u0432\u044B\u0440\u0443\u0447\u043A\u0430, \u20BD", ...getValidation(field('annualRevenue'), validatorObj.annualRevenue, input?.required) })));
2836
-
2837
- const ArmyIdFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u041D\u0430\u043B\u0438\u0447\u0438\u0435 \u0432\u043E\u0435\u043D\u043D\u043E\u0433\u043E \u0431\u0438\u043B\u0435\u0442\u0430", ...getValidation(field('armyIdFlg'), validatorObj.armyIdFlg, input?.required) })));
2838
-
2839
- const BankEmpoleeCodeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044F \u0411\u0430\u043D\u043A\u0430", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0434", isInteger: true, ...getValidation(field('bankEmployeeCode'), validatorObj.bankEmployeeCode, input?.required), ...input })));
2840
-
2841
- const BankEmpoleeField = JSX(({ field }) => (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') })));
2842
-
2843
- const BankruptcyFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u0412 \u043E\u0442\u043D\u043E\u0448\u0435\u043D\u0438\u0438 \u043C\u0435\u043D\u044F \u0432\u0435\u0434\u0451\u0442\u0441\u044F \u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0441\u0442\u0432\u043E \u043F\u043E \u0434\u0435\u043B\u0443 \u043E \u0431\u0430\u043D\u043A\u0440\u043E\u0442\u0441\u0442\u0432\u0435", ...getValidation(field('bankruptcyFlg'), validatorObj.bankruptcyFlg, input?.required) })));
2844
-
2845
- const useElementSpace = (ref, heightEl) => {
2846
- const [spaceAbove, setSpaceAbove] = useState(false);
2847
- useEffect(() => {
2848
- const handleResize = () => {
2849
- if (ref?.current) {
2850
- const { top } = ref.current.getBoundingClientRect();
2851
- const hasSpaceAbove = top > heightEl;
2852
- setSpaceAbove(hasSpaceAbove);
2410
+ const getOrganizationActivityType = (options, okved) => {
2411
+ if (!okved) {
2412
+ return null;
2413
+ }
2414
+ const getOptionByKey = getOptionOp(options);
2415
+ const okvedType = +okved?.split('.')[0];
2416
+ const secondOkvedType = +okved?.split('.')[1];
2417
+ switch (okvedType) {
2418
+ case 1:
2419
+ return getOptionByKey("AGRICULTURE" /* EOrganizationActivityTypes.AGRICULTURE */);
2420
+ case 35:
2421
+ return getOptionByKey("FUEL_AND_ENERGY" /* EOrganizationActivityTypes.FUEL_AND_ENERGY */);
2422
+ case 41:
2423
+ case 42:
2424
+ case 43:
2425
+ return getOptionByKey("CONSTRUCTION" /* EOrganizationActivityTypes.CONSTRUCTION */);
2426
+ case 46:
2427
+ case 47:
2428
+ return getOptionByKey("TRADE" /* EOrganizationActivityTypes.TRADE */);
2429
+ case 55:
2430
+ case 79:
2431
+ return getOptionByKey("TOURISM" /* EOrganizationActivityTypes.TOURISM */);
2432
+ case 62:
2433
+ return getOptionByKey("TECHNOLOGY" /* EOrganizationActivityTypes.TECHNOLOGY */);
2434
+ case 63:
2435
+ return getOptionByKey("CONSULTING_SERVICE" /* EOrganizationActivityTypes.CONSULTING_SERVICE */);
2436
+ case 64:
2437
+ return getOptionByKey("BANK" /* EOrganizationActivityTypes.BANK */);
2438
+ case 65:
2439
+ return getOptionByKey("INSURER" /* EOrganizationActivityTypes.INSURER */);
2440
+ case 66:
2441
+ return getOptionByKey("FINANCIAL_INSTITUTIONS" /* EOrganizationActivityTypes.FINANCIAL_INSTITUTIONS */);
2442
+ case 72:
2443
+ case 74:
2444
+ return getOptionByKey("SCIENCE" /* EOrganizationActivityTypes.SCIENCE */);
2445
+ case 80:
2446
+ return getOptionByKey("SECURITY" /* EOrganizationActivityTypes.SECURITY */);
2447
+ case 84: {
2448
+ if (secondOkvedType < 22) {
2449
+ return getOptionByKey("GOVERNANCE" /* EOrganizationActivityTypes.GOVERNANCE */);
2853
2450
  }
2854
- };
2855
- handleResize();
2856
- window.addEventListener('resize', handleResize);
2857
- return () => window.removeEventListener('resize', handleResize);
2858
- }, [ref]);
2859
- return spaceAbove;
2860
- };
2861
-
2862
- const DAY_COUNT = 6;
2863
- const WEEK_COUNT = 7;
2864
- const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
2865
- const calendarCells = [];
2866
- let dayCounter = 1;
2867
- for (let i = 0; i < DAY_COUNT; i++) {
2868
- const rowCells = [];
2869
- for (let j = 0; j < WEEK_COUNT; j++) {
2870
- if (i === 0 && j < firstDayOfWeek) {
2871
- rowCells.push(jsx("td", {}, `empty-${j}`));
2451
+ if (secondOkvedType === 22) {
2452
+ return getOptionByKey("ARMY" /* EOrganizationActivityTypes.ARMY */);
2872
2453
  }
2873
- else if (dayCounter > totalDays) {
2874
- rowCells.push(jsx("td", {}, `empty-${j}`));
2454
+ return getOptionByKey("OTHER_SECTORS" /* EOrganizationActivityTypes.OTHER_SECTORS */);
2455
+ }
2456
+ case 85:
2457
+ return getOptionByKey("EDUCATION" /* EOrganizationActivityTypes.EDUCATION */);
2458
+ case 86:
2459
+ return getOptionByKey("HEALTHCARE" /* EOrganizationActivityTypes.HEALTHCARE */);
2460
+ case 87:
2461
+ return getOptionByKey("SOCIAL_SPHERE" /* EOrganizationActivityTypes.SOCIAL_SPHERE */);
2462
+ default: {
2463
+ if (okvedType >= 10 && okvedType <= 33) {
2464
+ return getOptionByKey("INDUSTRY" /* EOrganizationActivityTypes.INDUSTRY */);
2875
2465
  }
2876
- else {
2877
- const currentDate = new Date(currentYear, currentMonth, dayCounter);
2878
- const isToday = checkIsToday(currentDate, today);
2879
- const isDisabled = checkIsDisabled(currentDate, min, max);
2880
- rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
2881
- dayCounter++;
2466
+ if (okvedType >= 5 && okvedType <= 9) {
2467
+ return getOptionByKey("FUEL_AND_ENERGY" /* EOrganizationActivityTypes.FUEL_AND_ENERGY */);
2468
+ }
2469
+ if (okvedType >= 49 && okvedType <= 53) {
2470
+ return getOptionByKey("TRANSPORT" /* EOrganizationActivityTypes.TRANSPORT */);
2882
2471
  }
2472
+ return getOptionByKey("OTHER_SECTORS" /* EOrganizationActivityTypes.OTHER_SECTORS */);
2883
2473
  }
2884
- calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
2885
2474
  }
2886
- return calendarCells;
2887
2475
  };
2888
- const checkIsToday = (currentDate, today) => today && currentDate.toDateString() === today.toDateString();
2889
- const checkIsDisabled = (currentDate, min, max) => (min && currentDate.getTime() < min.getTime()) || (max && currentDate.getTime() > max.getTime());
2890
- const getDayStyles = (isToday = false, isDisabled = false) => style('p-s text-center rounded-md border', {
2891
- 'border-transparent hover:bg-gray': !isToday,
2892
- }, isDisabled ? 'text-gray hover:bg-transparent' : 'cursor-pointer');
2476
+ const getEmployeesNumberOption = (options, count) => {
2477
+ if (!count) {
2478
+ return null;
2479
+ }
2480
+ const [option] = [options?.find((_) => count <= Number(_.description))].map((_) => ({
2481
+ key: _?.key ?? '',
2482
+ text: _?.value ?? '',
2483
+ }));
2484
+ return option;
2485
+ };
2486
+ const getOrganizationKind = (options, okopf) => {
2487
+ const getOptionByKey = getOptionOp(options);
2488
+ if ([40001, 40002, 71610].includes(okopf)) {
2489
+ return getOptionByKey('FOREIGN');
2490
+ }
2491
+ return getOptionByKey('RUSSIAN');
2492
+ };
2493
+ const getOrganizationType = (options, okopf, inn) => {
2494
+ const getOptionByKey = getOptionOp(options);
2495
+ if (inn === '7725114488') {
2496
+ return getOptionByKey('RSHB');
2497
+ }
2498
+ if (okopf === 50102) {
2499
+ return getOptionByKey('SOLE_TRADER');
2500
+ }
2501
+ if (okopf >= 75000 && okopf <= 75505 && okopf !== 75500) {
2502
+ return getOptionByKey('BUDGETARY');
2503
+ }
2504
+ return getOptionByKey('COMMERCIAL');
2505
+ };
2506
+ const getOptionOp = (options) => (key) => options
2507
+ .map((_) => ({ key: _.key, text: _.value }))
2508
+ .find((_) => _.key === key) ?? null;
2893
2509
 
2894
- const WEEK_DAYS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
2895
- const Calendar = JSX(({ today, currentMonth, currentYear, min, max, onDateSelect = noop, setValue = noop }) => {
2896
- const handleDateClick = useCallback((date) => {
2897
- onDateSelect(date);
2898
- setValue(false);
2510
+ const ESIA_FIELD_NAME = 'esiaAccountTypeCd';
2511
+ const isEsiaAuthorize = (field, name) => Boolean(field(ESIA_FIELD_NAME)?.value?.key) && field(name).value;
2512
+
2513
+ const AddressField = JSX(({ field, input }) => {
2514
+ const fieldName = input?.name || 'addressRegistration';
2515
+ const fieldValue = field(fieldName).value;
2516
+ const onDaDataChange = useCallback((item) => {
2517
+ field?.(fieldName)?.onChange?.(getAddressFromDaDataItem(item));
2899
2518
  }, []);
2900
- const { firstDayOfWeek, totalDays } = useMemo(() => ({
2901
- firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
2902
- totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
2903
- }), [currentYear, currentMonth]);
2904
- 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({
2905
- firstDayOfWeek,
2906
- today,
2907
- totalDays,
2908
- currentYear,
2909
- currentMonth,
2910
- min,
2911
- max,
2912
- onDateClick: handleDateClick,
2913
- }) })] }));
2519
+ const onChange = useCallback((value) => {
2520
+ field?.(fieldName)?.onChange?.({
2521
+ apartment: '',
2522
+ city: '',
2523
+ district: '',
2524
+ fullAddress: value,
2525
+ fiasCode: '',
2526
+ house: '',
2527
+ locality: '',
2528
+ okatoRegionCode: '',
2529
+ postcode: '',
2530
+ region: '',
2531
+ regionCode: '',
2532
+ street: '',
2533
+ qc: '',
2534
+ qcComplete: '',
2535
+ qcHouse: '',
2536
+ });
2537
+ }, []);
2538
+ return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, fieldName), label: "\u0410\u0434\u0440\u0435\u0441", ...getValidation(field(fieldName), validatorObj[fieldName], input?.required), value: fieldValue.fullAddress, onChange: onChange, ...input, onDaDataChange: onDaDataChange }));
2539
+ });
2540
+ const getAddressFromDaDataItem = (item) => ({
2541
+ apartment: item?.data?.flat,
2542
+ city: item?.data?.city,
2543
+ district: item?.data?.area_with_type,
2544
+ fullAddress: item?.unrestricted_value,
2545
+ fiasCode: item?.data?.fias_id,
2546
+ house: item?.data?.house,
2547
+ locality: item?.data?.settlement_with_type,
2548
+ okatoRegionCode: item?.data?.okato,
2549
+ postcode: item?.data?.postal_code,
2550
+ region: item?.data?.region,
2551
+ regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
2552
+ street: item?.data?.street,
2553
+ qc: item?.data?.qc,
2554
+ qcComplete: item?.data?.qc_complete,
2555
+ qcHouse: item?.data?.qc_house,
2914
2556
  });
2915
2557
 
2916
- const months = [
2917
- 'Январь',
2918
- 'Февраль',
2919
- 'Март',
2920
- 'Апрель',
2921
- 'Май',
2922
- 'Июнь',
2923
- 'Июль',
2924
- 'Август',
2925
- 'Сентябрь',
2926
- 'Октябрь',
2927
- 'Ноябрь',
2928
- 'Декабрь',
2929
- ];
2930
-
2931
- function normalizeWithMask(value, pattern) {
2932
- const valueNumbers = value.replace(/\D/g, '');
2933
- if (valueNumbers === '' || valueNumbers.length === pattern.length) {
2934
- return value;
2558
+ const updateOrganizationFields = (store, field, item) => {
2559
+ const { okved, okopf, inn } = getOrganizationRequisites(item);
2560
+ field?.('legalForm')?.onChange?.(item.data?.opf?.short);
2561
+ field?.('organizationAddress')?.onChange?.(getAddressFromDaDataItem(item.data?.address));
2562
+ const organizationData = {
2563
+ amountWorkers: getEmployeesNumberOption(store?.amountWorkers, item.data?.employee_count),
2564
+ employerActivities: getOrganizationActivityType(store?.employerActivities ?? [], okved),
2565
+ organization: getOrganizationType(store?.organization ?? [], okopf, inn),
2566
+ employerOrganization: getOrganizationKind(store?.employerOrganization ?? [], okopf),
2567
+ };
2568
+ for (const fieldName in organizationData) {
2569
+ organizationData[fieldName] && field?.(fieldName)?.onChange?.(organizationData[fieldName]);
2935
2570
  }
2936
- const patternInArr = [...pattern];
2937
- const firstPlaceholderIndex = patternInArr.findIndex(isPlaceholder$1);
2938
- const valueWildcardIndicies = patternInArr.map((_, i) => isWildcard$1(_) ? patternInArr.slice(0, i).filter(isWildcard$1).length : -1);
2939
- const applyPlaceholder = (_, i) => isDigit$1(_) ? _ : valueNumbers.charAt(valueWildcardIndicies[i]) || _;
2940
- const resultInArr = patternInArr.map(applyPlaceholder);
2941
- const resultLength = valueWildcardIndicies.indexOf(valueNumbers.length - 1) + 1;
2942
- return resultInArr.slice(0, Math.max(firstPlaceholderIndex, resultLength)).join('');
2943
- }
2944
- const isPlaceholder$1 = (_) => _ === '_';
2945
- const isDigit$1 = (_) => /\d/.test(_);
2946
- const isWildcard$1 = (_) => isPlaceholder$1(_) || isDigit$1(_);
2571
+ };
2572
+ const getOrganizationRequisites = (item) => ({
2573
+ inn: item.data?.inn ?? '',
2574
+ okopf: Number(item.data?.opf?.code),
2575
+ okved: item.data?.okved ?? '',
2576
+ });
2947
2577
 
2948
- const START_YEAR = 1940;
2949
- const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
2578
+ const InnField = JSX(({ field, input }) => {
2579
+ const store = useRetailFormStore();
2580
+ const onDaDataChange = useCallback((item) => {
2581
+ field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
2582
+ updateOrganizationFields(store, field, item);
2583
+ }, []);
2584
+ return (jsx(InputControl, { label: "\u0418\u041D\u041D", isInteger: true, maxLength: 12, ...input, ...getValidation(field('inn'), validatorObj.inn, input?.required), onDaDataChange: onDaDataChange }));
2585
+ });
2950
2586
 
2951
- const ICON_PROPS$1 = {
2952
- name: 'CalendarIcon',
2953
- iconVersion: 'black',
2954
- width: '24',
2955
- height: '24',
2587
+ const CheckboxWithError = JSX(({ className, text, value, key, disabled, error, onChange }) => (jsxs("div", { className: style('shrink-0', className), children: [jsx(Checkbox, { text: text, value: value, disabled: disabled, onChange: onChange }, key), renderErrorText(error)] })));
2588
+
2589
+ const IsClientField = JSX(({ field }) => (jsx(CheckboxWithError, { ...field('isClient'), text: '\u042F\u0432\u043B\u044F\u044E\u0441\u044C \u043A\u043B\u0438\u0435\u043D\u0442\u043E\u043C \u0431\u0430\u043D\u043A\u0430 \u0410\u041E "\u0420\u043E\u0441\u0441\u0435\u043B\u044C\u0445\u043E\u0437\u0431\u0430\u043D\u043A"' })));
2590
+
2591
+ const OUT_SERVICE_BASE_URL = `${API_BASE_URI}/outservice`;
2592
+ const EMPTY_REGIONS$1 = [];
2593
+ async function getOutServiceRegions() {
2594
+ const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
2595
+ return data && Array.isArray(data) ? data : EMPTY_REGIONS$1;
2596
+ }
2597
+
2598
+ const LocalitiesField = JSX(({ field, input }) => {
2599
+ const fieldRegion = field('region');
2600
+ const regionKey = fieldRegion?.value?.key;
2601
+ const { data: regions } = useAsyncData('outServiceRegions', getOutServiceRegions);
2602
+ const localities = regions
2603
+ ?.find((_) => _.code === regionKey)
2604
+ ?.localities?.map((_) => ({ key: _, text: _ }));
2605
+ useEffect(() => {
2606
+ if (regionKey !== '') {
2607
+ field?.('localities')?.onChange?.('');
2608
+ }
2609
+ }, [regionKey]);
2610
+ return (jsx(SelectControl, { label: "\u041D\u0430\u0441\u0435\u043B\u0435\u043D\u043D\u044B\u0439 \u043F\u0443\u043D\u043A\u0442", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0433\u043E\u0440\u043E\u0434, \u0433\u0434\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0441\u0435\u0440\u0432\u0438\u0441", options: localities, ...getValidation(field('localities'), validatorObj.localities, input?.required), isSearch: true }));
2611
+ });
2612
+
2613
+ const FIELD_NAME$b = 'middleName';
2614
+ const MiddleNameField = JSX(({ field, input }) => (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)", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$b), ...getValidation(field(FIELD_NAME$b), validatorObj.middleName, input?.required), ...input })));
2615
+
2616
+ const NameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\u043C\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, input.name ?? ''), ...getValidation(field('name'), validatorObj.name, input?.required), ...input })));
2617
+
2618
+ const SlideCheckbox = JSX(({ value = false, text, type = 'checkbox', onChange }) => (jsxs("div", { role: type, "aria-checked": value, className: "flex justify-start items-center w-full cursor-pointer mb-s", onClick: () => onChange && onChange(!value), children: [jsx("div", { className: style('relative flex-shrink-0 duration-300 w-9 h-5 mr-s rounded-2xl', value ? 'bg-primary-main' : 'bg-main-divider'), children: jsx("div", { className: style('absolute opacity-80 duration-500 top-0.5 w-4 h-4 bg-white rounded-full', value ? 'left-1/2' : 'left-[5%]') }) }), text ? (jsx(Text, { size: "text-l", font: "font-light", color: "text-primary-text", children: text })) : null] })));
2619
+
2620
+ const OnlineCheckoutField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 \u043E\u043D\u043B\u0430\u0439\u043D-\u043A\u0430\u0441\u0441\u0443", ...field('onlineCheckout') })) : null);
2621
+
2622
+ const PartnerCommentsField = JSX(({ field, input }) => {
2623
+ const { required, ...rest } = input;
2624
+ return (jsx(InputControl, { ...getValidation(field('partnerComments'), validatorObj.partnerComments, required), placeholder: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u044E\u0449\u0438\u0439 \u0432\u0430\u0441 \u0432\u043E\u043F\u0440\u043E\u0441", isTextarea: true, ...rest }));
2625
+ });
2626
+
2627
+ const isPlaceholder = (_) => _ === '_';
2628
+ const isDigit = (_) => /\d/.test(_);
2629
+ const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
2630
+ const phonePattern = [...'+7 (___) ___-__-__'];
2631
+ const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
2632
+ const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
2633
+ function normalizePhone(phone) {
2634
+ const phoneNumbers = phone.replace(/\D/g, '');
2635
+ const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
2636
+ const result = phonePattern.map(applyPlaceholder);
2637
+ const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
2638
+ return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
2639
+ }
2640
+
2641
+ const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
2642
+ const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
2643
+ const handleBlur = useCallback((v) => {
2644
+ if (v === '+7 (') {
2645
+ onChange && onChange('');
2646
+ }
2647
+ }, []);
2648
+ return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
2649
+ });
2650
+
2651
+ const InputPhoneControl = JSX(({ className, label, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(PhoneInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), placeholder: "+7 (___) ___-__-__", ...rest }), renderErrorText(error)] })));
2652
+
2653
+ const PhoneField = JSX(({ field, input }) => {
2654
+ const fieldName = input?.name || 'phone';
2655
+ return (jsx(InputPhoneControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...getValidation(field(fieldName), validatorObj.phone, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, fieldName), ...input }));
2656
+ });
2657
+
2658
+ const PosTerminalField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 POS-\u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B", ...field('posTerminal') })) : null);
2659
+
2660
+ const ProductField = JSX(({ field, source }) => (jsx(SelectControl, { placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043F\u0440\u043E\u0434\u0443\u043A\u0442", label: "\u041F\u0440\u043E\u0434\u0443\u043A\u0442", options: arrayToOptions(source?.productList), ...withValidator(field('product'), validatorObj.product) })));
2661
+ const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
2662
+
2663
+ const OUT_SERVICE_URL = `${API_BASE_URI}/outservice/outserviceregions`;
2664
+ const getRegionUrl = (typeForm) => typeForm === 'OUTSERVICE' ? OUT_SERVICE_URL : undefined;
2665
+
2666
+ const REGIONS_URL = `${API_BASE_URI}/regions`;
2667
+ const EMPTY_REGIONS = [];
2668
+ // TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
2669
+ function useRegions(url = REGIONS_URL) {
2670
+ const { data } = useAsyncData(url, fetchJSONUnsafe);
2671
+ return Array.isArray(data) ? data : EMPTY_REGIONS;
2672
+ }
2673
+
2674
+ const RegionField = JSX(({ field, input, params }) => {
2675
+ const url = getRegionUrl(params?.typeForm);
2676
+ const regions = useRegions(url);
2677
+ return (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: useMemo(() => regions?.map(({ code = '', name = '' }) => ({ key: code, text: name })), [regions]), ...getValidation(field('region'), validatorObj.region, input?.required) }));
2678
+ });
2679
+
2680
+ const RegionPremiumField = JSX(({ field, input }) => {
2681
+ const branchByRegions = useBranchesByRegions(true);
2682
+ const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
2683
+ key: region,
2684
+ text: region,
2685
+ })), [branchByRegions]);
2686
+ return (jsx(SelectControl, { label: "\u0420\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", options: regions, ...getValidation(field('region'), validatorObj.region, input?.required) }));
2687
+ });
2688
+
2689
+ const SecondaryPhoneField = JSX(({ field }) => {
2690
+ const fieldPhone = field('secondaryPhone');
2691
+ return (jsx(InputPhoneControl, { label: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0439 \u0442\u0435\u043B\u0435\u0444\u043E\u043D", ...(!fieldPhone.value || fieldPhone.value === '+7 ('
2692
+ ? fieldPhone
2693
+ : withValidator(fieldPhone, validatorObj.secondaryPhone)) }));
2694
+ });
2695
+
2696
+ const ServiceDirectionField = JSX(({ field, input }) => (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, ...getValidation(field('serviceDirection'), validatorObj.serviceDirection, input?.required) })));
2697
+
2698
+ const FIELD_NAME$a = 'surname';
2699
+ const SurnameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0430\u043C\u0438\u043B\u0438\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$a), ...getValidation(field('surname'), validatorObj.surname, input?.required), ...input })));
2700
+
2701
+ const MIN_CREDIT_TERM = 1;
2702
+ const MAX_CREDIT_TERM = 180;
2703
+ const ITEMS_CREDIT_TERM = ['От 1 мес', 'До 15 лет'];
2704
+ const TermField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0440\u043E\u043A, \u043C\u0435\u0441\u044F\u0446\u0435\u0432", items: ITEMS_CREDIT_TERM, min: MIN_CREDIT_TERM, max: MAX_CREDIT_TERM, ...field('term') })));
2705
+
2706
+ const UltraPremiumField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0422\u0438\u043F \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", options: SERVICE_TYPES, ...getValidation(field('serviceType'), validatorObj.serviceType, input?.required) })));
2707
+
2708
+ const orientationStyleMap = {
2709
+ horizontal: '@lg:flex-row',
2710
+ vertical: '',
2711
+ };
2712
+ const RadioButtonGroup = JSX(({ label, items, value, className, onChange: onChangeCheckedItem, disabled = false, orientation = 'horizontal', }) => (jsxs("div", { className: "grid gap-xs whitespace-nowrap", children: [label ? (jsx("div", { role: "radiogroup", "aria-label": label, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: label }) })) : null, jsx("div", { className: style('flex flex-col gap-s', orientationStyleMap[orientation], className), role: "radiogroup", "aria-label": "\u0413\u0440\u0443\u043F\u043F\u0430 \u043A\u043D\u043E\u043F\u043E\u043A", children: items?.map(({ id, text }) => (jsx(Checkbox, { isRadio: true, text: text, value: value === id, onChange: () => onChangeCheckedItem && onChangeCheckedItem(id), disabled: disabled }, String(id)))) })] })));
2713
+
2714
+ const VED_TYPES = [
2715
+ { id: 'currencyControl', text: 'Валютный контроль' },
2716
+ { id: 'documentOperations', text: 'Документарные операции' },
2717
+ { id: 'conversionTransactions', text: 'Конверсионные операции' },
2718
+ { id: 'otherIssues', text: 'Иные вопросы ВЭД' },
2719
+ ];
2720
+ const VedField = JSX(({ field }) => {
2721
+ const { value, onChange } = field('vedTypes');
2722
+ useEffect(() => {
2723
+ if (value !== 'currencyControl') {
2724
+ field?.('inn')?.onChange?.('');
2725
+ field?.('region')?.onChange?.('');
2726
+ }
2727
+ }, [value]);
2728
+ return (jsx("div", { className: "py-m gap-m grid @xl:flex @xl:items-center", children: jsx(RadioButtonGroup, { className: "whitespace-normal", orientation: "horizontal", items: VED_TYPES, value: value, onChange: (_) => onChange && onChange(_) }) }));
2729
+ });
2730
+
2731
+ function isRenderField({ input, field, }) {
2732
+ const { condition } = input;
2733
+ const { value } = field(condition?.name || '');
2734
+ return !condition || condition?.values?.find((_) => _ === (value?.key ?? value));
2735
+ }
2736
+
2737
+ const PRODUCT_REF = {
2738
+ $ref: '/wcms-resources/outservice-productlist.json',
2739
+ };
2740
+ const InputsMap = {
2741
+ fullName: (props) => jsx(FullNameField, { ...props }),
2742
+ addressBranch: (props) => jsx(AddressBranchField, { ...props }),
2743
+ desiredMeetingDate: (props) => jsx(DesiredMeetingDateField, { ...props }),
2744
+ product: (props) => jsx(ProductField, { ...props, source: PRODUCT_REF }),
2745
+ localities: (props) => jsx(LocalitiesField, { ...props }),
2746
+ isClient: (props) => jsx(IsClientField, { ...props }),
2747
+ partnerComments: (props) => jsx(PartnerCommentsField, { ...props }),
2748
+ collectionCount: (props) => jsx(CollectionCountField, { ...props }),
2749
+ acquiringType: (props) => jsx(AcquiringField, { ...props }),
2750
+ onlineCheckout: (props) => jsx(OnlineCheckoutField, { ...props }),
2751
+ posTerminal: (props) => jsx(PosTerminalField, { ...props }),
2752
+ serviceType: (props) => jsx(UltraPremiumField, { ...props }),
2753
+ term: (props) => jsx(TermField, { ...props }),
2754
+ amount: (props) => jsx(AmountField, { ...props }),
2755
+ annualRevenue: (props) => jsx(AnnualRevenueField, { ...props }),
2756
+ vedTypes: (props) => jsx(VedField, { ...props }),
2757
+ feedbackMethod: (props) => jsx(FeedbackMethodField, { ...props }),
2758
+ serviceDirection: (props) => jsx(ServiceDirectionField, { ...props }),
2759
+ bankEmpolee: (props) => jsx(BankEmpoleeField, { ...props }),
2760
+ secondaryPhone: (props) => jsx(SecondaryPhoneField, { ...props }),
2761
+ applicationDate: (props) => (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", ...props })),
2762
+ region: (props) => getPremium(props?.params?.typeForm) ? (jsx(RegionPremiumField, { ...props })) : (jsx(RegionField, { ...props })),
2763
+ consentToReceiveMaterials: (props) => (jsx(ConsentToReceiveMaterialsField, { ...props })),
2764
+ surname: (props) => jsx(SurnameField, { ...props }),
2765
+ name: (props) => jsx(NameField, { ...props }),
2766
+ middleName: (props) => jsx(MiddleNameField, { ...props }),
2767
+ birthday: (props) => jsx(BirthdayField, { ...props }),
2768
+ phone: (props) => jsx(PhoneField, { ...props }),
2769
+ email: (props) => jsx(EmailField, { ...props }),
2770
+ inn: (props) => jsx(InnField, { ...props }),
2771
+ comment: (props) => jsx(CommentField, { ...props }),
2772
+ };
2773
+ const getField = (field, params, externalInputs = {}) => (input, i) => {
2774
+ const resultInputsMap = {
2775
+ ...InputsMap,
2776
+ ...externalInputs,
2777
+ };
2778
+ return isRenderField({ input, field }) ? (jsx("div", { children: resultInputsMap[input?.name || '']?.({ field, input, params }) }, String(i))) : null;
2779
+ };
2780
+
2781
+ const inputColumnStyles = (column) => column === 2 ? '@xl:grid-cols-2' : '';
2782
+
2783
+ const renderTitle = (title) => title ? (jsx("div", { className: "@xl:text-center @xl:col-span-2 mb-m", children: jsx(Text, { size: "text-h6", children: title }) })) : null;
2784
+
2785
+ const Loader = JSX(({ color = 'text-primary-main', position = 'absolute', blur = true, size = 'big' }) => (jsx("div", { className: style('flex justify-center items-center h-full w-full z-50', position, {
2786
+ 'backdrop-blur': blur,
2787
+ }), children: jsx("div", { className: style('inline-block ', 'animate-spin rounded-full', 'border-solid border-current', 'border-r-transparent', size === 'small' ? 'border-4 h-8 w-8' : 'border-8 h-28 w-28', color), role: "status" }) })));
2788
+
2789
+ function useButton() {
2790
+ return (props) => ({
2791
+ ...props,
2792
+ onClick: handlerDecorator(handleClick(props)),
2793
+ });
2794
+ }
2795
+ function handleClick({ disabled, onClick }) {
2796
+ return (ev) => {
2797
+ !disabled && onClick && onClick(ev);
2798
+ };
2799
+ }
2800
+
2801
+ const buttonStyleMap = {
2802
+ primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
2803
+ secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
2804
+ };
2805
+ const secondaryButtonStyleMap = {
2806
+ primary: style('group-data-secondary:text-primary-main group-data-secondary:bg-white', 'group-data-secondary:hover:text-white group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
2807
+ secondary: style('group-data-secondary:text-white group-data-secondary:bg-white/20', 'group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
2808
+ };
2809
+ const Button = JSX(({ children, ...props }) => {
2810
+ const button = useButton();
2811
+ const { className, version = 'primary', active, disabled, isLoading, type = 'button', rounded = true, role, onClick, } = button(props);
2812
+ return (jsxs("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs relative', {
2813
+ 'text-white bg-primary-active': active,
2814
+ 'bg-main-gray text-main-disabled cursor-not-allowed': disabled || isLoading,
2815
+ 'rounded-md': rounded,
2816
+ }, !active && !disabled && !isLoading
2817
+ ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
2818
+ : '', className), type: type, role: role, onClick: onClick, children: [isLoading ? jsx(Loader, { blur: true, size: "small" }) : null, children] }));
2819
+ });
2820
+
2821
+ const CloseButton = JSX(({ className, onClose }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-2xs bg-transparent border-none', className), onClick: onClose, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", type: "button", children: jsx(Icon, { name: "CloseIcon", width: "20", height: "20", iconVersion: "gray" }) })));
2822
+
2823
+ const Dialog = JSX(({ className, head, children, onClose, onClick }) => (jsxs("div", { className: style('relative bg-white pt-0 p-lg', className), role: "dialog", onClick: onClick, children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: onClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] })));
2824
+
2825
+ const ResponseTypeDialog = JSX(({ responseType, typeForm, onClose }) => {
2826
+ const responseOK = responseType === 'OK';
2827
+ const statusIcon = responseOK ? 'ResponseOKIcon' : 'ResponseFailIcon';
2828
+ const responseOKDescription = typeForm === 'ANTIFRAUD'
2829
+ ? `Сообщение отправлено. Для уточнения информации с Вами могут связаться работники Банка либо Вы
2830
+ можете самостоятельно позвонить по номеру контакт-центра +78001000100. Будьте внимательны, работники Банка
2831
+ не звонят с использованием мессенджеров.`
2832
+ : 'Совсем скоро мы с вами свяжемся';
2833
+ return (jsx(Dialog, { className: "my-6xl max-w-lg w-full min-h-fit mx-auto", onClose: onClose, children: jsxs("div", { className: "flex flex-col gap-lg items-center rounded-md space-x-m", children: [jsx(Img, { image: { icon: statusIcon, iconVersion: 'normal' }, width: "136", height: "136" }), jsx(Headline, { className: "w-full", title: responseOK ? 'Ваша заявка отправлена' : 'Не удалось отправить заявку', description: responseOK ? responseOKDescription : 'Пожалуйста, повторите позднее', headlineVersion: "XS", isEmbedded: true }), jsx(Button, { type: "button", onClick: onClose, children: "\u0425\u043E\u0440\u043E\u0448\u043E" })] }) }));
2834
+ });
2835
+
2836
+ const objectValidator = (validatorsMap) => (o) => (o &&
2837
+ Object.entries(validatorsMap).flatMap(([key, validator]) => validator(o[key]))) ||
2838
+ [];
2839
+
2840
+ const getPartnerComments = (data) => {
2841
+ const { acquiringType, onlineCheckout = false, posTerminal = false, term, amount, annualRevenue, } = data;
2842
+ if (acquiringType) {
2843
+ return `Вид эквайринга=${acquiringType?.text || ''}${isAcquiringTrade(acquiringType?.key)
2844
+ ? `/Онлайн касса=${onlineCheckout}/POS-терминал=${posTerminal}`
2845
+ : '/Онлайн касса=false/POS-терминал=false'}`;
2846
+ }
2847
+ else {
2848
+ return `Сумма=${amount}/Срок=${term}/Выручка=${annualRevenue}`;
2849
+ }
2850
+ };
2851
+
2852
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2853
+ const getFormatData = (data) => {
2854
+ const { acquiringType, onlineCheckout, posTerminal, amount, term, annualRevenue, serviceType, vedTypes, region, ...usedData } = data;
2855
+ const partnerComments = acquiringType || annualRevenue ? getPartnerComments(data) : null;
2856
+ const formatData = {
2857
+ ...usedData,
2858
+ ...getVedTypes(vedTypes),
2859
+ ...getRegion(region),
2860
+ ...(partnerComments ? { partnerComments } : {}),
2861
+ ...(serviceType ? { typeForm: serviceType } : {}),
2862
+ };
2863
+ return Object.fromEntries(Object.entries(formatData)?.map(([k, v]) => [k, v?.key || v]));
2864
+ };
2865
+ const getRegion = (region) => region?.key || region?.text ? { region: region?.text || region?.key } : {};
2866
+ const getVedTypes = (vedTypes) => vedTypes
2867
+ ? {
2868
+ vedTypes: Object.fromEntries(VED_TYPES.map(({ id }) => [id, id === vedTypes])),
2869
+ }
2870
+ : {};
2871
+
2872
+ const initialFormState$1 = {
2873
+ typeForm: '',
2874
+ region: { key: '', text: '' },
2875
+ addressBranch: { key: '', text: '' },
2876
+ surname: '',
2877
+ name: '',
2878
+ phone: '',
2879
+ secondaryPhone: '',
2880
+ comment: '',
2881
+ product: '',
2882
+ partnerComments: '',
2883
+ annualRevenue: '',
2884
+ term: 12,
2885
+ amount: 100000,
2886
+ acquiringType: ACQUIRING_TYPES[0],
2887
+ serviceType: SERVICE_TYPES[0],
2888
+ feedbackMethod: FEEDBACK_METHOD[0],
2889
+ serviceDirection: SERVICE_DIRECTIONS[0],
2890
+ vedTypes: VED_TYPES[0],
2891
+ birthday: undefined,
2892
+ isClient: false,
2893
+ onlineCheckout: false,
2894
+ posTerminal: false,
2895
+ consentToReceiveMaterials: false,
2896
+ consentDataProcessing: false,
2897
+ addressRetail: { key: '', text: '' },
2898
+ };
2899
+ const getInitialFormState$3 = (inputs, typeForm = '') => {
2900
+ const formState = Object.fromEntries(inputs.map((_) => [
2901
+ _.name,
2902
+ (_.fieldType === 'ved' && _?.defaultValue) || initialFormState$1[_.name || ''],
2903
+ ]));
2904
+ return { ...formState, typeForm: { key: typeForm, text: '' } };
2905
+ };
2906
+
2907
+ const Footnote = JSX(({ text, link }) => (jsxs(Paragraph, { size: "text-l", font: "font-light", color: "text-secondary-text", children: [text ? jsx(Text, { children: text }) : null, link ? (jsx(LinkButton, { href: link.href, ariaLabel: "\u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043D\u043D\u044B\u0445", target: link.target || '', className: "!text-left text-primary-main", children: jsx(Text, { children: link.text }) })) : null] })));
2908
+
2909
+ const renderSubmitButton$1 = (button, className) => (jsx(Button, { className: style('w-full @xl:w-auto', className), type: "submit", children: button?.text ? button.text : 'Отправить заявку' }));
2910
+
2911
+ const agreementText = 'Нажимая кнопку, вы подтверждаете согласие с ';
2912
+ const renderAgreementSubmit = (consentDataProcessing, link, button) => (jsxs("div", { className: "flex col-span-2 gap-xs flex-col w-full items-baseline", children: [consentDataProcessing ? (jsxs("div", { children: [jsxs("div", { className: "flex gap-3 items-center", children: [jsx(Checkbox, { ...consentDataProcessing }), jsx(Footnote, { link: link })] }), renderErrorText(withValidator(consentDataProcessing, agreementValidator).error)] })) : (jsx(Footnote, { text: agreementText, link: link })), renderSubmitButton$1(button)] }));
2913
+
2914
+ const renderContacts = () => (jsxs("div", { className: "space-y-m", children: [jsx(Heading, { headingType: "h6", title: "\u0418\u043B\u0438 \u0441\u0432\u044F\u0436\u0438\u0442\u0435\u0441\u044C \u0441 \u043D\u0430\u043C\u0438 \u0443\u0434\u043E\u0431\u043D\u044B\u043C \u0441\u043F\u043E\u0441\u043E\u0431\u043E\u043C", className: "@xl:text-center" }), jsxs("div", { className: "flex sm:justify-center gap-xl", children: [jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", href: `tel:8 (800) 200-78-70`, "aria-label": "\u0442\u0435\u043B\u0435\u0444\u043E\u043D 8 (800) 200-78-70", children: [jsx(Img, { image: { icon: 'PhoneIcon' }, width: "24", height: "24" }), jsx("span", { children: "8 (800) 200-78-70" })] }), jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", "aria-label": "\u043F\u043E\u0447\u0442\u0430 ved@rshb.ru", href: `mailto:ved@rshb.ru`, children: [jsx(Img, { image: { icon: 'MailIcon' }, width: "24", height: "24" }), jsx("span", { children: "ved@rshb.ru" })] })] })] }));
2915
+
2916
+ const API = LeadServiceAPI();
2917
+ const ApplicationForm = JSX(
2918
+ // eslint-disable-next-line max-lines-per-function
2919
+ ({ className, title, typeForm = '', sections = [], button, link, endpoint, additionalParams, isContacts, data, ...rest }) => {
2920
+ const inputs = (sections?.flatMap((_) => _?.inputs) || []);
2921
+ const initialFormState = getInitialFormState$3(inputs, typeForm);
2922
+ const [responseType, setResponseType] = useState('');
2923
+ const responseTypeDialog = useDialog(ResponseTypeDialog);
2924
+ const handleSubmit = useCallback(async (formData, ev) => {
2925
+ const inputsFiltered = getFilteredInputs(inputs, formData);
2926
+ const feedbackValidator = objectValidator(getObjectValidator(inputsFiltered));
2927
+ if (!isValidationSuccess(feedbackValidator(formData))) {
2928
+ return console.warn('validation fail');
2929
+ }
2930
+ const formatData = getFormatData({ ...formData, ...additionalParams });
2931
+ const status = (await API.send(formatData, endpoint === 'lead')) ? 'OK' : 'Fail';
2932
+ setResponseType(status);
2933
+ if (status) {
2934
+ responseTypeDialog.open({ typeForm, responseType: status });
2935
+ }
2936
+ if (status === 'OK' && data) {
2937
+ const aspects = useAspects();
2938
+ handleAspects({ aspectsAttributes: data, aspects, ev });
2939
+ }
2940
+ return status;
2941
+ }, [typeForm]);
2942
+ const [, { field, onSubmit, reset }] = useForm(initialFormState, { onSubmit: handleSubmit });
2943
+ const fieldName = getConsentDataProcessing(inputs)?.name;
2944
+ useEffect(() => {
2945
+ if (responseType === 'OK') {
2946
+ setResponseType('');
2947
+ reset();
2948
+ }
2949
+ }, [responseType]);
2950
+ return (jsxs(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: [jsxs("form", { onSubmit: onSubmit, children: [sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), (_?.inputs || [])?.map(getField(field, { typeForm }))] }, `section-${i}`))), renderAgreementSubmit(fieldName ? field('consentDataProcessing') : undefined, link, button)] }), isContacts ? renderContacts() : null] }));
2951
+ });
2952
+ const getFilteredInputs = (inputs, data) => inputs.filter((input) => !input?.condition ||
2953
+ input?.condition.values.find((_) => {
2954
+ const dataValue = data?.[input?.condition?.name ?? ''];
2955
+ return _ === (dataValue?.key ?? dataValue);
2956
+ }));
2957
+
2958
+ const applicationFormData = [
2959
+ {
2960
+ columns: 2,
2961
+ inputs: [
2962
+ { fieldType: 'common', name: 'surname', required: true, dadata: true },
2963
+ { fieldType: 'common', name: 'name', required: true, dadata: true },
2964
+ { fieldType: 'common', name: 'middleName', dadata: true },
2965
+ { fieldType: 'common', name: 'limitedBirthday', required: true },
2966
+ { fieldType: 'common', name: 'phone', required: true },
2967
+ { fieldType: 'common', name: 'email', required: true, dadata: true },
2968
+ ],
2969
+ },
2970
+ {
2971
+ inputs: [
2972
+ { fieldType: 'common', name: 'processPersonalDataFlg', required: true },
2973
+ { fieldType: 'common', name: 'consentProviderFlg', required: true },
2974
+ { fieldType: 'common', name: 'consentOthersFlg', required: true },
2975
+ { fieldType: 'common', name: 'consentInformFlg' },
2976
+ { fieldType: 'common', name: 'consentPfrFlg' },
2977
+ ],
2978
+ },
2979
+ ];
2980
+
2981
+ const AddressFactField = JSX(({ field, input }) => {
2982
+ const fieldName = 'addressFact';
2983
+ const fieldValue = field(fieldName).value;
2984
+ const { value } = field('addressMatch');
2985
+ useEffect(() => {
2986
+ if (value) {
2987
+ field('addressFact')?.onChange?.(field('addressRegistration').value);
2988
+ }
2989
+ }, [value, field('addressRegistration').value]);
2990
+ const onDaDataChange = useCallback((item) => {
2991
+ field?.(fieldName)?.onChange?.({
2992
+ apartment: item?.data?.flat,
2993
+ city: item?.data?.city,
2994
+ district: item?.data?.area_with_type,
2995
+ fullAddress: item?.value,
2996
+ fiasCode: item?.data?.fias_id,
2997
+ house: item?.data?.house,
2998
+ locality: item?.data?.settlement_with_type,
2999
+ okatoRegionCode: item?.data?.okato,
3000
+ postcode: item?.data?.postal_code,
3001
+ region: item?.data?.region,
3002
+ regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
3003
+ street: item?.data?.house,
3004
+ qc: item?.data?.qc,
3005
+ qcComplete: item?.data?.qc_complete,
3006
+ qcHouse: item?.data?.qc_house,
3007
+ });
3008
+ }, []);
3009
+ const onChange = useCallback((val) => {
3010
+ field?.(fieldName)?.onChange?.({
3011
+ apartment: '',
3012
+ city: '',
3013
+ district: '',
3014
+ fullAddress: val,
3015
+ fiasCode: '',
3016
+ house: '',
3017
+ locality: '',
3018
+ okatoRegionCode: '',
3019
+ postcode: '',
3020
+ region: '',
3021
+ regionCode: '',
3022
+ street: '',
3023
+ qc: '',
3024
+ qcComplete: '',
3025
+ qcHouse: '',
3026
+ });
3027
+ }, []);
3028
+ return (jsx(InputControl, { label: "\u0410\u0434\u0440\u0435\u0441", disabled: value, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required), value: fieldValue.fullAddress, onChange: onChange, ...input, onDaDataChange: onDaDataChange }));
3029
+ });
3030
+
3031
+ const AddressMatchField = JSX(({ field, input }) => {
3032
+ return (jsx(CheckboxWithError, { text: "\u0410\u0434\u0440\u0435\u0441 \u0444\u0430\u043A\u0442\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043C\u0435\u0441\u0442\u0430 \u0436\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u0430 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u0435\u0442 \u0441 \u0430\u0434\u0440\u0435\u0441\u043E\u043C \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438", ...getValidation(field('addressMatch'), validatorObj.addressMatch, input?.required) }));
3033
+ });
3034
+
3035
+ const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
3036
+ const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
3037
+ function renderClusterer({ yandexMaps, map, points, isLoad, }) {
3038
+ if (isLoad || !points) {
3039
+ return;
3040
+ }
3041
+ map.geoObjects.removeAll();
3042
+ if (!points.length) {
3043
+ return;
3044
+ }
3045
+ const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
3046
+ const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
3047
+ if (points.length && points.every((_) => 'type' in _)) {
3048
+ const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
3049
+ const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
3050
+ const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
3051
+ officeClusterer.add(officesGeoObjects);
3052
+ remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
3053
+ map.geoObjects.add(remoteWorkplaceClusterer);
3054
+ map.geoObjects.add(officeClusterer);
3055
+ }
3056
+ else {
3057
+ const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
3058
+ officeClusterer.add(geoObjects);
3059
+ map.geoObjects.add(officeClusterer);
3060
+ }
3061
+ map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
3062
+ if (map.getZoom() > 10) {
3063
+ map.setZoom(10);
3064
+ }
3065
+ });
3066
+ }
3067
+ const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
3068
+ return new yandexMaps.Clusterer({
3069
+ clusterIcons: [
3070
+ {
3071
+ href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
3072
+ size: [78, 84],
3073
+ offset: [-35, -50],
3074
+ },
3075
+ ],
3076
+ clusterIconContentLayout,
3077
+ clusterHideIconOnBalloonOpen: false,
3078
+ geoObjectHideIconOnBalloonOpen: false,
3079
+ });
3080
+ };
3081
+ const defineGeoObjects = (pointArr, type, yandexMaps) => {
3082
+ return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
3083
+ balloonContentHeader: content?.header,
3084
+ balloonContentBody: content?.body,
3085
+ balloonContentFooter: content?.footer,
3086
+ hintContent: content?.hint,
3087
+ }, {
3088
+ iconLayout: 'default#image',
3089
+ iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
3090
+ iconImageSize: [78, 84],
3091
+ iconImageOffset: [-35, -50],
3092
+ }));
3093
+ };
3094
+
3095
+ const defaultStyle = {
3096
+ focus: 'focus:border-primary-text focus:border',
3097
+ hover: 'hover:bg-primary-hover',
3098
+ active: 'active:bg-primary-active',
3099
+ font: 'text-center font-sans',
3100
+ };
3101
+
3102
+ const styles$1 = {
3103
+ ...defaultStyle,
3104
+ border: 'border border-transparent rounded-md',
3105
+ position: 'absolute flex items-center justify-center',
3106
+ };
3107
+ const renderUserGeolocation = (map, yandexMaps, className) => {
3108
+ const setUserGeoLocation = () => {
3109
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3110
+ // @ts-ignore
3111
+ yandexMaps.geolocation
3112
+ .get({
3113
+ provider: 'yandex',
3114
+ autoReverseGeocode: true,
3115
+ mapStateAutoApply: true,
3116
+ })
3117
+ .then(function (result) {
3118
+ map.current.geoObjects.add(result.geoObjects);
3119
+ });
3120
+ };
3121
+ return (jsx("div", { className: `select-none cursor-pointer py-m w-12 bg-white ${Object.values(styles$1).join(' ')} ${className}`, onClick: setUserGeoLocation, children: jsx(Icon, { name: "UserGeoLocationIcon", width: "20", height: "16" }) }));
3122
+ };
3123
+
3124
+ const getNS = (_) => globalThis[_];
3125
+ const initializeExternalNS = (namespaceName, url) => {
3126
+ const script = document.getElementById(url);
3127
+ if (script) {
3128
+ const ns = getNS(namespaceName);
3129
+ if (ns) {
3130
+ return Promise.resolve(ns);
3131
+ }
3132
+ else {
3133
+ return new Promise((resolve) => {
3134
+ script.addEventListener('load', () => {
3135
+ resolve(getNS(namespaceName));
3136
+ });
3137
+ });
3138
+ }
3139
+ }
3140
+ else {
3141
+ return new Promise((resolve, reject) => {
3142
+ const newScript = document.createElement('script');
3143
+ newScript.src = url;
3144
+ newScript.async = true;
3145
+ newScript.id = url;
3146
+ newScript.addEventListener('load', () => {
3147
+ resolve(getNS(namespaceName));
3148
+ });
3149
+ newScript.addEventListener('error', (error) => {
3150
+ reject(error);
3151
+ });
3152
+ document.head.appendChild(newScript);
3153
+ });
3154
+ }
3155
+ };
3156
+ function useExternalNS(namespaceName, url, unmountNS = true) {
3157
+ const [externalNS, setExternalNS] = useState(undefined);
3158
+ useEffect(() => {
3159
+ let isMounted = true;
3160
+ initializeExternalNS(namespaceName, url)
3161
+ .then((ns) => {
3162
+ if (isMounted) {
3163
+ setExternalNS(ns);
3164
+ }
3165
+ })
3166
+ .catch((error) => {
3167
+ console.error(`Failed to initialize external namespace: ${error}`);
3168
+ });
3169
+ return () => {
3170
+ isMounted = false;
3171
+ if (unmountNS) {
3172
+ const script = document.getElementById(url);
3173
+ if (script) {
3174
+ document.head.removeChild(script);
3175
+ }
3176
+ setExternalNS(undefined);
3177
+ }
3178
+ };
3179
+ }, [namespaceName, url, unmountNS]);
3180
+ return externalNS;
3181
+ }
3182
+
3183
+ const YMAPS_NAMESPACE = 'ymaps';
3184
+ const useYandexMaps = () => {
3185
+ const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
3186
+ return useExternalNS(YMAPS_NAMESPACE, url, false);
3187
+ };
3188
+
3189
+ const styles = {
3190
+ ...defaultStyle,
3191
+ border: 'border-b border-b-2 border-gray last:border-0',
3192
+ position: 'relative flex items-center justify-center',
3193
+ };
3194
+ // TODO: Добавить метод определения центральной точки
3195
+ const ZoomButton = JSX(({ yandexMaps, direction = 'in' }) => {
3196
+ const iconName = direction === 'in' ? 'PlusIcon' : 'MinusIcon';
3197
+ const changeZoom = () => {
3198
+ const currentZoom = yandexMaps.current.getZoom();
3199
+ const newZoom = direction === 'in' ? currentZoom + 1 : currentZoom - 1;
3200
+ yandexMaps.current.setZoom(newZoom, { checkZoomRange: true });
3201
+ };
3202
+ return (jsx("div", { onClick: changeZoom, className: `${Object.values(styles).join(' ')} bg-white select-none cursor-pointer w-12 h-12`, children: jsx(Icon, { name: iconName, width: "20", height: "16" }) }));
3203
+ });
3204
+
3205
+ const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
3206
+ // TODO: Поле для поиска: невыяснено среди каких данных делать поиск (искать в имени офиса, в адресе, метро и т.д.).
3207
+ // Сейчас реализован поиск среди тестовых данных
3208
+ // TODO: Также выяснить что делать когда ничего не найдено
3209
+ // TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
3210
+ const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad, selectedAddress }) => {
3211
+ const map = useRef(null);
3212
+ const parentDiv = useRef(null);
3213
+ const yandexMaps = useYandexMaps();
3214
+ useEffect(() => {
3215
+ if (map.current) {
3216
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad });
3217
+ }
3218
+ else {
3219
+ yandexMaps?.ready(() => {
3220
+ // Ready function may be called few times, but must be called once
3221
+ if (map.current) {
3222
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad });
3223
+ return;
3224
+ }
3225
+ map.current = new yandexMaps.Map(parentDiv.current, {
3226
+ center: getCenterPoint(points),
3227
+ zoom,
3228
+ controls: [],
3229
+ suppressMapOpenBlock: true,
3230
+ });
3231
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad });
3232
+ });
3233
+ }
3234
+ // zoom к выбранному отделению банка в рамках задачи по retail
3235
+ if (map.current && selectedAddress) {
3236
+ yandexMaps?.geocode(selectedAddress).then((res) => {
3237
+ const firstGeoObject = res.geoObjects.get(0);
3238
+ const coords = firstGeoObject.geometry.getCoordinates();
3239
+ map.current.setCenter(coords);
3240
+ map.current.setZoom(18);
3241
+ });
3242
+ }
3243
+ }, [yandexMaps, points, zoom, isLoad, selectedAddress]);
3244
+ if (!yandexMaps) {
3245
+ return null;
3246
+ }
3247
+ const zIndex = 'z-10';
3248
+ return (jsxs("div", { ref: parentDiv, className: style('relative', 'w-full', className), children: [isLoad ? jsx(Loader, {}) : null, jsxs("div", { className: style('absolute right-2 top-52 z-10 w-12 overflow-hidden border border-transparent rounded-md', zIndex), children: [jsx(ZoomButton, { yandexMaps: map }), jsx(ZoomButton, { yandexMaps: map, direction: "out" })] }), renderUserGeolocation(map, yandexMaps, style('right-2 top-80', zIndex))] }));
3249
+ });
3250
+ const getCenterPoint = (points) => {
3251
+ const centerCoords = [
3252
+ getArraySumAndAverage(mapByIndex(points, 0)),
3253
+ getArraySumAndAverage(mapByIndex(points, 1)),
3254
+ ];
3255
+ return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
3256
+ };
3257
+ const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
3258
+ const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
3259
+
3260
+ const fetchRetailJSON = async (url, method, body) => {
3261
+ try {
3262
+ const response = await doRequest(url, method, body);
3263
+ return response.json();
3264
+ }
3265
+ catch (err) {
3266
+ console.error(err);
3267
+ return null;
3268
+ }
3269
+ };
3270
+ async function doRequest(url, method, body) {
3271
+ return globalThis?.fetch?.(`${API_BASE_URI}${url}`, {
3272
+ method,
3273
+ headers: {
3274
+ 'Content-Type': 'application/json',
3275
+ ...getAuthorizationHeaders(),
3276
+ },
3277
+ credentials: 'include',
3278
+ body: body ? JSON.stringify(body) : null,
3279
+ });
3280
+ }
3281
+ const getAuthorizationHeaders = () => {
3282
+ const token = sessionStorage.getItem('accessToken');
3283
+ return token ? { Authorization: `Bearer ${token}` } : null;
3284
+ };
3285
+
3286
+ const fetchRegionOffices = async (regionKey) => {
3287
+ const response = await fetchRetailJSON('/public-data/regionOffices', 'POST', {
3288
+ regionRfCd: {
3289
+ key: regionKey,
3290
+ },
3291
+ cashCardFlg: true,
3292
+ });
3293
+ return (response?.offices?.map((office) => ({
3294
+ ...office,
3295
+ gpsLatitude: formatCoordinate(office.latitude ?? DEFAULT_CENTER_COORDS[0]),
3296
+ gpsLongitude: formatCoordinate(office.longitude ?? DEFAULT_CENTER_COORDS[1]),
3297
+ })) || []);
3298
+ };
3299
+ const formatCoordinate = (coordinate) => Number(coordinate.toString().replace(',', '.'));
3300
+
3301
+ const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
3302
+ const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
3303
+ const onToggle = useCallback(() => {
3304
+ setIsUnfolded((_) => !_);
3305
+ }, []);
3306
+ const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
3307
+ const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
3308
+ return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
3309
+ });
3310
+
3311
+ function useResizeObserver(callback, deps) {
3312
+ const ref = useRef(null);
3313
+ useEffect(() => {
3314
+ const element = ref?.current;
3315
+ if (!element) {
3316
+ return undefined;
3317
+ }
3318
+ const observer = new ResizeObserver((entries) => {
3319
+ callback(element, entries[0]);
3320
+ });
3321
+ observer.observe(element);
3322
+ return () => {
3323
+ observer.disconnect();
3324
+ };
3325
+ }, [callback, ...deps]);
3326
+ return ref;
3327
+ }
3328
+
3329
+ const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
3330
+ const containerRef = useRef(null);
3331
+ const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
3332
+ if (containerRef.current) {
3333
+ containerRef.current.style.maxHeight = isUnfolded
3334
+ ? `${childrenWrapperEl.scrollHeight}px`
3335
+ : '';
3336
+ }
3337
+ }, [isUnfolded]);
3338
+ return (jsx("div", { ref: containerRef, className: `transition-max-h duration-300 overflow-hidden ${containerRef.current || !isUnfolded ? 'max-h-0' : ''} `, children: jsx("div", { className: className, ref: childrenWrapperRef, children: children }) }));
3339
+ });
3340
+
3341
+ const CardCell = JSX(({ value, subText, children, isPhone, ...props }) => {
3342
+ const textItems = (Array.isArray(value) ? value : value?.split(',') ?? []).filter(Boolean);
3343
+ if ([textItems.length, children, subText].every((_) => !_)) {
3344
+ return null;
3345
+ }
3346
+ return renderCardCell({ textItems, subText, children, isPhone, ...props });
3347
+ });
3348
+ const renderCardCell = ({ label, labelSize = 'text-m', textItems, subColor, subText, className, children, isPhone = false, }) => (jsxs("div", { className: style('flex gap-2xs flex-col h-full max-w-[300px]', className), children: [label ? (jsx(Text, { color: "text-secondary-text", font: "font-light", size: labelSize, children: label })) : null, children || renderTextItems(textItems, isPhone), subText ? (jsx(Text, { color: subColor, size: "text-m", children: subText })) : null] }));
3349
+ const renderTextItems = (textItems, isPhone) => textItems.filter(Boolean).map((text, i) => (jsx(Text, { size: "text-l", children: isPhone ? jsx("a", { href: `tel:${cleanPhoneNumber(text)}`, children: text.trim() }) : text.trim() }, String(i))));
3350
+ const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
3351
+
3352
+ const CardRow = JSX(({ className, children }) => (jsx("div", { className: style('flex flex-col sm:flex-row sm:border-t sm:border-solid sm:border-main-divider py-xl gap-x-6xl gap-y-xl', className), children: children })));
3353
+
3354
+ const getScheduleDescription = (workScheduleWeek) => {
3355
+ const rows = getDateDescription(workScheduleWeek);
3356
+ return jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", value: rows, className: "max-w-none" });
3357
+ };
3358
+ const buildScheduleText = ({ workTime = '', lunchHour = '', daysOff = '' }, isSaturday = false) => {
3359
+ if (!workTime) {
3360
+ return '';
3361
+ }
3362
+ return [
3363
+ `${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
3364
+ lunchHour ? `перерыв: ${lunchHour}` : '',
3365
+ daysOff ? `не работает: ${daysOff}` : '',
3366
+ ]
3367
+ .filter(Boolean)
3368
+ .join('; ');
3369
+ };
3370
+ const getDateDescription = (workScheduleWeek) => {
3371
+ const workingWeekday = workScheduleWeek.find((_) => _.key !== 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
3372
+ const workingSaturday = workScheduleWeek.find((_) => _.key === 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
3373
+ const daysOff = workScheduleWeek
3374
+ .filter((_) => !_.status)
3375
+ .map((_) => _.short?.toLowerCase())
3376
+ .join(', ');
3377
+ const rows = [
3378
+ buildScheduleText({
3379
+ workTime: workingWeekday?.workTime,
3380
+ lunchHour: workingWeekday?.lunchHour,
3381
+ daysOff: workingSaturday ? '' : daysOff,
3382
+ }),
3383
+ buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
3384
+ ].filter(Boolean);
3385
+ return rows;
3386
+ };
3387
+
3388
+ const WEEKDAY_MAP = [
3389
+ ['workingMonday', 'Пн', 'Понедельник'],
3390
+ ['workingTuesday', 'Вт', 'Вторник'],
3391
+ ['workingWednesday', 'Ср', 'Среда'],
3392
+ ['workingThursday', 'Чт', 'Четверг'],
3393
+ ['workingFriday', 'Пт', 'Пятница'],
3394
+ ['workingSaturday', 'Сб', 'Суббота'],
3395
+ ['workingSunday', 'Вс', 'Воскресенье'],
3396
+ ];
3397
+ const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
3398
+ key,
3399
+ title,
3400
+ short,
3401
+ status: Boolean(workSchedule?.[key]),
3402
+ get workTime() {
3403
+ return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
3404
+ },
3405
+ get lunchHour() {
3406
+ return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
3407
+ },
3408
+ get hasLunch() {
3409
+ return /\d+/.test(this.lunchHour ?? '');
3410
+ },
3411
+ }));
3412
+
3413
+ const renderBusinessSchedule = (scheduleDescription) => {
3414
+ if (!scheduleDescription) {
3415
+ return null;
3416
+ }
3417
+ const businessSchedule = getBusinessSchedule(scheduleDescription);
3418
+ return (jsxs(CardRow, { className: "border-none", children: [jsx(CardCell, { label: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: businessSchedule.map(renderAlternativeDay) }) }), jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", className: "max-w-none", children: jsx(Text, { children: scheduleDescription }) })] }));
3419
+ };
3420
+ const getBusinessSchedule = (scheduleDescription) => {
3421
+ const weekDayMap = WEEKDAY_MAP.map(([, short]) => ({ short, status: true }));
3422
+ const splittedScheduleDescription = scheduleDescription.split('/') ?? [];
3423
+ const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
3424
+ if (!lastPartScheduleDescription?.includes('выходной')) {
3425
+ return weekDayMap;
3426
+ }
3427
+ return weekDayMap.map((_) => ({
3428
+ ..._,
3429
+ status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
3430
+ }));
3431
+ };
3432
+ const renderAlternativeDay = ({ short, status }, i) => (jsx("div", { className: style('w-9 h-9 rounded-md flex items-center justify-center', status ? 'bg-green-more-light text-green-dark' : 'bg-error/30 text-error'), children: jsx(Text, { size: "text-xs", children: short }) }, String(i)));
3433
+
3434
+ const renderCurrency = ({ currency, buyExchangeRate, saleExchangeRate }, i) => (jsxs("div", { className: "flex gap-lg h-full", children: [currency?.currency ? jsx(CardCell, { label: "\u0412\u0430\u043B\u044E\u0442\u0430", value: currency.currency }) : null, buyExchangeRate ? jsx(CardCell, { label: "\u041A\u0443\u043F\u0438\u0442\u044C", value: String(buyExchangeRate) }) : null, saleExchangeRate ? jsx(CardCell, { label: "\u041F\u0440\u043E\u0434\u0430\u0442\u044C", value: String(saleExchangeRate) }) : null] }, String(i)));
3435
+
3436
+ const colorStyle = {
3437
+ yellow: { border: 'border-yellow-light', text: 'text-yellow' },
3438
+ green: { border: 'border-green-more-light', text: 'text-green-dark' },
3439
+ gray: { border: 'border-gray', text: 'text-secondary-text' },
3440
+ red: { border: 'border-error/30', text: 'text-error' },
3441
+ };
3442
+ const Badge$1 = JSX(({ className, children, color = 'gray' }) => (jsxs("div", { className: style('sm:p-s sm:border sm:border-green rounded-md flex items-center h-fit', colorStyle[color].border, className), children: [jsx("div", { className: "block pr-m sm:pr-0 sm:hidden", children: jsx(Img, { image: { icon: 'SmallClockIcon' }, width: "24", height: "24" }) }), jsx(Text, { size: "text-m", color: colorStyle[color].text, children: children })] })));
3443
+
3444
+ const currentWeekDayIdx = new Date().getDay();
3445
+ //TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
3446
+ const renderCurrentDaySchedule = (workScheduleWeek) => {
3447
+ const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
3448
+ if (!currentWeekDay) {
3449
+ return null;
3450
+ }
3451
+ const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
3452
+ return status ? (jsxs("div", { className: "flex gap-s items-start whitespace-nowrap", children: [workTime ? jsx(Badge$1, { color: "green", children: workTime }) : null, lunchHour && hasLunch ? jsx(Badge$1, { color: "yellow", children: `перерыв: ${lunchHour}` }) : null] })) : (jsx(Badge$1, { color: "red", children: "\u0412\u044B\u0445\u043E\u0434\u043D\u043E\u0439" }));
3453
+ };
3454
+
3455
+ const getSubTextLunch = ({ lunchHour, hasLunch = false, status = false }) => {
3456
+ if (!status) {
3457
+ return 'Не работает';
3458
+ }
3459
+ return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
3460
+ };
3461
+ const renderDay = ({ title, status, workTime, lunchHour, hasLunch }, i) => (jsx(CardCell, { label: title, value: status && workTime ? workTime : '', subText: getSubTextLunch({ lunchHour, hasLunch, status }), subColor: !status || hasLunch ? 'text-error' : 'text-green-dark' }, String(i)));
3462
+
3463
+ const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
3464
+ const labels = ['Подробнее', 'Скрыть'];
3465
+ const renderFoldButton$3 = ({ isUnfolded, onToggle }) => (jsxs("button", { className: "w-full py-2xl cursor-pointer text-primary-main flex items-center border-b border-solid border-main-divider", onClick: onToggle, type: "button", children: [jsx("div", { className: "pr-m", children: labels[Number(isUnfolded)] }), jsx(Icon, { className: "text-primary-text", name: ICONS$1[Number(isUnfolded)], width: "16", height: "16" })] }));
3466
+
3467
+ const renderWorkSchedule = (workSchedule) => {
3468
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
3469
+ const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
3470
+ const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
3471
+ if (!workSchedule) {
3472
+ return '';
3473
+ }
3474
+ if (!workSchedule.businessScheduleVisibleTag) {
3475
+ return renderMatchingTimeOfWork(timeOfWork);
3476
+ }
3477
+ if (workSchedule.businessScheduleVisibleTag &&
3478
+ workSchedule.businessScheduleDescription === null) {
3479
+ return renderIndividualTimeOfWork(timeOfWork);
3480
+ }
3481
+ return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
3482
+ };
3483
+ const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
3484
+ const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
3485
+ const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
3486
+
3487
+ const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, i) => {
3488
+ if (!workSchedule) {
3489
+ return null;
3490
+ }
3491
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
3492
+ return (jsxs("div", { className: "bg-white col-span-12 p-3xl sm:border-green sm:border", children: [jsxs("div", { className: "sm:flex sm:justify-between", children: [jsxs("div", { children: [jsx(Text, { size: "text-h4", children: name }), address ? (jsxs("div", { className: "flex pb-xl pt-xs gap-2xs", children: [jsx(Icon, { name: "GeolocationIcon", width: "24", height: "24" }), jsx(Text, { size: "text-l", children: address })] })) : null] }), renderCurrentDaySchedule(workScheduleWeek)] }), jsx("div", { className: "hidden sm:block", children: renderCardContent$1({
3493
+ phone,
3494
+ fax,
3495
+ phoneBusiness,
3496
+ phoneNatural,
3497
+ phoneCallCentre,
3498
+ phoneCurrencyControl,
3499
+ workSchedule,
3500
+ exchangeRate,
3501
+ }) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
3502
+ return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
3503
+ phone,
3504
+ fax,
3505
+ phoneBusiness,
3506
+ phoneNatural,
3507
+ phoneCallCentre,
3508
+ phoneCurrencyControl,
3509
+ workSchedule,
3510
+ exchangeRate,
3511
+ }) }));
3512
+ },
3513
+ //** TODO: remove styles with refactoring DefaultFoldButton*/
3514
+ renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
3515
+ };
3516
+ const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
3517
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
3518
+ const labelSchedule = workSchedule?.businessScheduleVisibleTag
3519
+ ? 'Для физических лиц'
3520
+ : 'Для физических и юридических лиц';
3521
+ return (jsxs("div", { children: [jsxs(CardRow, { className: "flex-wrap border-b border-solid border-main-divider", children: [jsx(CardCell, { label: "\u0424\u0430\u043A\u0441", value: fax, isPhone: true }), jsx(CardCell, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D \u0444\u0438\u043B\u0438\u0430\u043B\u0430", value: phone, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0439 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneBusiness, isPhone: true }), jsx(CardCell, { label: "\u041E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneNatural, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043A\u043E\u043D\u0441\u0443\u043B\u044C\u0442\u0430\u0446\u0438\u0439 \u043F\u043E \u0432\u0430\u043B\u044E\u0442\u043D\u043E\u043C\u0443 \u043A\u043E\u043D\u0442\u0440\u043E\u043B\u044E", value: phoneCurrencyControl, isPhone: true }), jsx(CardCell, { label: "\u041A\u043E\u043D\u0442\u0430\u043A\u0442-\u0446\u0435\u043D\u0442\u0440", value: phoneCallCentre, isPhone: true })] }), workSchedule?.isMatchesPattern ? (jsx(CardRow, { children: jsx(CardCell, { label: labelSchedule, labelSize: "text-l", className: "w-full max-w-none", children: jsx("div", { className: "flex flex-wrap gap-xs sm:justify-between pt-xs", children: workScheduleWeek?.map(renderDay) }) }) })) : (jsxs(CardRow, { children: [jsx(CardCell, { label: labelSchedule, labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: workScheduleWeek?.map(renderAlternativeDay) }) }), getScheduleDescription(workScheduleWeek)] })), workSchedule?.businessScheduleVisibleTag
3522
+ ? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
3523
+ : null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
3524
+ };
3525
+ const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
3526
+ const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
3527
+ const header = capitalizedFirstLetter$1(name);
3528
+ const body = `${address} ${renderWorkSchedule(workSchedule)}`;
3529
+ return { header, body };
3530
+ };
3531
+
3532
+ const INITIAL_FILTRATION_STATE$1 = {
3533
+ workingSaturday: false,
3534
+ premiumService: false,
3535
+ privateBanking: false,
3536
+ remoteWorkplace: false,
3537
+ serviceDisabledPeople: false,
3538
+ sellingCoins: false,
3539
+ buyingCoins: false,
3540
+ bullionOperations: false,
3541
+ preciousMetalsOperations: false,
3542
+ transferringDataToBiometricSystem: false,
3543
+ };
3544
+ const FILTRATION_LABELS = {
3545
+ safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
3546
+ workingSaturday: 'Открыты по субботам',
3547
+ terminalTypeAtms: 'Банкоматы',
3548
+ terminalTypeTerm: 'Терминалы',
3549
+ workAllTime: 'Круглосуточно',
3550
+ billAcceptorEnable: 'Прием наличных',
3551
+ premiumService: 'Премиальное обслуживание',
3552
+ privateBanking: 'Услуга Private banking',
3553
+ sellingCoins: 'Продажа монет из драгоценных металлов',
3554
+ buyingCoins: 'Покупка монет из драгоценных металлов',
3555
+ bullionOperations: 'Операции со слитками',
3556
+ preciousMetalsOperations: 'Операции с драгоценными металлами',
3557
+ transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
3558
+ locationDisabledPeople: 'Для маломобильных',
3559
+ designDisabledPeople: 'Для слабовидящих',
3560
+ remoteWorkplace: 'Удаленное рабочее место',
3561
+ serviceDisabledPeople: 'Для маломобильных граждан',
2956
3562
  };
2957
- const DatePickerInput = JSX(({ setSelectedMonth, setSelectedYear, className, value, disabled, onChange, onClick }) => {
2958
- const ref = useRef(null);
2959
- const [inputValue, setInputValue] = useState(value || '');
2960
- const handleChange = (ev) => {
2961
- const val = ev.target?.value;
2962
- if (typeof val === 'string' && val?.length < 11) {
2963
- setInputValue(normalizeWithMask(val, '__.__.____'));
2964
- }
2965
- };
2966
- const onBlur = () => {
2967
- if (checkIsValidDate(inputValue)) {
2968
- const [day, month, year] = inputValue.split('.');
2969
- onChange?.(new Date(Number(year), Number(month) - 1, Number(day)));
2970
- setSelectedMonth(Number(month) - 1);
2971
- setSelectedYear(Number(year));
2972
- }
2973
- else {
2974
- setInputValue(value || '');
2975
- }
2976
- };
2977
- const onInputClick = () => {
2978
- if (ref.current !== null) {
2979
- ref.current.focus();
2980
- }
2981
- onClick?.();
2982
- };
2983
- useEffect(() => {
2984
- setInputValue(value || '');
2985
- }, [value]);
2986
- return (jsxs("div", { onClick: onInputClick, className: style('relative', className), children: [jsx("input", { ref: ref, className: "h-full w-full px-m text-l text-black focus-visible:outline-none", value: inputValue, type: "text", onChange: handleChange, onBlur: onBlur, disabled: disabled }), disabled ? null : jsx(Icon, { className: "mr-s", ...ICON_PROPS$1 })] }));
2987
- });
2988
- const isValidYear = (year) => Number(year) >= START_YEAR && Number(year) <= new Date().getFullYear();
2989
- const isValidMonth = (month) => Number(month) > 0 && Number(month) < 13;
2990
- const checkIsValidDate = (date) => {
2991
- const [day, month, year] = date.split('.');
2992
- if (isValidYear(year)) {
2993
- if (isValidMonth(month)) {
2994
- const currentDate = new Date(Number(year), Number(month) - 1, 1);
2995
- let maxDateOfMonth = 0;
2996
- while (currentDate.getMonth() === Number(month) - 1) {
2997
- currentDate.setDate(currentDate.getDate() + 1);
2998
- maxDateOfMonth++;
2999
- }
3000
- if (Number(day) > 0 && Number(day) <= maxDateOfMonth) {
3001
- return true;
3002
- }
3003
- }
3004
- }
3005
- return false;
3563
+ const FILTRATION_PREDICATES$1 = {
3564
+ workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
3565
+ premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
3566
+ privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
3567
+ remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
3568
+ serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
3569
+ sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
3570
+ buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
3571
+ bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
3572
+ preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
3573
+ transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
3006
3574
  };
3007
3575
 
3008
- const formStyle = 'flex justify-between items-center h-14 border rounded-md cursor-pointer ' +
3009
- 'hover:border-black active:border-black focus:border-black';
3010
- const renderDatePickerForm = ({ handleChangeVisibleCalendar, value, valid, onChange, setSelectedMonth, setSelectedYear, disabled = false, }) => (jsx(DatePickerInput, { onChange: onChange, disabled: disabled, onClick: handleChangeVisibleCalendar, value: value && formatDate(value), setSelectedMonth: setSelectedMonth, setSelectedYear: setSelectedYear, className: style(formStyle, valid ? 'border-gray' : 'border-error') }));
3576
+ const filterItems$1 = (data, filtrationState) => {
3577
+ const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
3578
+ return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
3579
+ };
3011
3580
 
3012
- const MONTHS_COUNT = 11;
3013
- const MONTHS_OPTIONS = months.map((key) => ({ key }));
3014
- const YEARS_OPTIONS = getYears()
3015
- .reverse()
3016
- .map((key) => ({ key: String(key) }));
3017
- const useDatePickerManager = ({ onShowCalendar, showCalendar, selectedMonth, onMonthSelect, onYearSelect, selectedYear, onChange, value, }) => {
3018
- const close = useCallback(() => showCalendar && onShowCalendar(false), [showCalendar]);
3019
- const ref = useOutsideClick(close);
3020
- const handleChangeVisibleCalendar = useCallback(() => onShowCalendar(!showCalendar), [showCalendar]);
3021
- const handleNextMonth = useCallback(() => {
3022
- if (selectedMonth + 1 <= MONTHS_COUNT) {
3023
- onMonthSelect(selectedMonth + 1);
3024
- }
3025
- else {
3026
- onMonthSelect(0);
3027
- onYearSelect(selectedYear + 1);
3028
- }
3029
- }, [selectedMonth]);
3030
- const handlePrevMonth = useCallback(() => {
3031
- if (selectedMonth - 1 >= 0) {
3032
- onMonthSelect(selectedMonth - 1);
3033
- }
3034
- else {
3035
- onMonthSelect(11);
3036
- onYearSelect(selectedYear - 1);
3037
- }
3038
- }, [selectedMonth]);
3039
- const handleSelectMonth = useCallback(({ key }) => {
3040
- onMonthSelect(months.indexOf(key));
3041
- const maxDateOfMonth = calculateMaxDaysOfMonth(selectedYear, months.indexOf(key));
3042
- handleChangeMonth({
3043
- maxDateOfMonth,
3044
- selectedYear,
3045
- selectedMonth: months.indexOf(key),
3046
- value,
3047
- onChange,
3048
- });
3049
- }, [value]);
3050
- const handleSelectYear = useCallback(({ key }) => {
3051
- onYearSelect(Number(key));
3052
- value && onChange?.(new Date(Number(key), selectedMonth, value?.getDate()));
3053
- }, [value]);
3054
- return {
3055
- handleChangeVisibleCalendar,
3056
- handleNextMonth,
3057
- handlePrevMonth,
3058
- handleSelectMonth,
3059
- handleSelectYear,
3060
- monthsOptions: MONTHS_OPTIONS,
3061
- yearsOptions: YEARS_OPTIONS,
3062
- ref,
3063
- };
3581
+ const defaultEmptyFunction$1 = () => void 0;
3582
+ const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, }) => {
3583
+ const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
3584
+ const _filteredItems = filterItems$1(data, filtrationState);
3585
+ const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
3586
+ const _points = [
3587
+ ..._filteredItems.map((_) => ({
3588
+ type: 'offices',
3589
+ coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
3590
+ content: getBalloon(_),
3591
+ })),
3592
+ ..._filteredRemoteWorkplaces.map((_) => ({
3593
+ type: 'workplaces',
3594
+ coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
3595
+ content: getBalloonRemoteWorkplaces({
3596
+ address: _.address,
3597
+ workScheduleDescription: _.workScheduleDescription,
3598
+ }),
3599
+ })),
3600
+ ].filter((_) => _.coords && _.coords.length === 2);
3601
+ const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
3602
+ return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
3603
+ }, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
3604
+ return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
3064
3605
  };
3065
- const calculateMaxDaysOfMonth = (selectedYear, selectedMonth) => {
3066
- const date = new Date(selectedYear, selectedMonth, 1);
3067
- let maxDateOfMonth = 0;
3068
- while (date.getMonth() === selectedMonth) {
3069
- maxDateOfMonth++;
3070
- date.setDate(date.getDate() + 1);
3606
+
3607
+ const useLeadFormData = (typeField) => {
3608
+ const { data, error } = useAsyncData(`/api/v1/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
3609
+ if (data && 'errorMessage' in data) {
3610
+ return { error };
3071
3611
  }
3072
- return maxDateOfMonth;
3612
+ return { data: data, error };
3073
3613
  };
3074
- const handleChangeMonth = ({ maxDateOfMonth, selectedYear, selectedMonth, value, onChange, }) => {
3075
- value &&
3076
- onChange?.(new Date(selectedYear, selectedMonth, Math.min(maxDateOfMonth, value.getDate())));
3614
+ const fetchData = async (url) => {
3615
+ const result = await fetchJSON(url, { method: 'POST' });
3616
+ return result || [];
3077
3617
  };
3078
3618
 
3079
- const ICON_PROPS = {
3080
- name: 'ArrowUpIcon',
3081
- iconVersion: 'black',
3082
- width: '24',
3083
- height: '24',
3084
- };
3085
- const SELECT_PROPS = {
3086
- className: 'min-w-32',
3087
- iconVersion: 'black',
3088
- isBorder: false,
3089
- };
3090
- const DatePicker = JSX(
3091
- // eslint-disable-next-line max-lines-per-function
3092
- ({ className = '', label = '', value, valid = true, minDate, maxDate, disabled, onChange }) => {
3093
- const [showCalendar, { setValue }] = useBool(false);
3094
- const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
3095
- const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
3096
- const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
3097
- onYearSelect: setSelectedYear,
3098
- onMonthSelect: setSelectedMonth,
3099
- onShowCalendar: setValue,
3100
- selectedYear,
3101
- selectedMonth,
3102
- showCalendar,
3103
- onChange,
3104
- value,
3619
+ const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
3620
+
3621
+ const isClient = !isSSR();
3622
+ const ClientOnly = JSX(({ children }) => (isClient ? children : null));
3623
+
3624
+ const AddressRetailField = JSX(({ field, input }) => {
3625
+ const [offices, setOffices] = useState([]);
3626
+ const { data } = useLeadFormData('REGION_RF');
3627
+ const regionValue = field('regionRetail')?.value || {};
3628
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3629
+ const fieldBranch = field('addressRetail');
3630
+ useEffect(() => {
3631
+ (async () => {
3632
+ const officesList = await fetchRegionOffices(regionValue?.key ?? '');
3633
+ setOffices(officesList);
3634
+ })();
3635
+ if (regionValue?.key) {
3636
+ field?.('addressRetail')?.onChange?.('');
3637
+ }
3638
+ }, [regionValue.key]);
3639
+ const { points } = useOfficesAtmsMapData({
3640
+ data: offices,
3641
+ filtrationState: {},
3642
+ getBalloon: getOfficePoint,
3105
3643
  });
3106
- const spaceAbove = useElementSpace(ref, 370);
3107
- return (jsxs("div", { className: style('space-y-xs', className), ref: ref, children: [renderLabel(label), jsxs("div", { className: "relative", children: [renderDatePickerForm({
3108
- handleChangeVisibleCalendar,
3109
- value,
3110
- valid,
3111
- onChange,
3112
- disabled,
3113
- setSelectedMonth,
3114
- setSelectedYear,
3115
- }), showCalendar && !disabled ? (jsxs("div", { className: style('absolute bg-white z-20 select-none', {
3116
- 'bottom-full': spaceAbove,
3117
- }), 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, setValue: setValue })] })) : null] })] }));
3644
+ const isRegionSelected = Boolean(regionValue?.key);
3645
+ return (jsxs("div", { children: [jsx(SelectControl, { label: "\u0410\u0434\u0440\u0435\u0441 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u0435", options: offices.map(({ id, address = '' }) => ({
3646
+ key: id?.toString() || '',
3647
+ text: address,
3648
+ })), ...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required && isRegionSelected), isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: !data, className: "h-full", selectedAddress: fieldBranch?.value?.text }) }) })] }));
3649
+ });
3650
+
3651
+ const SelectField = UniBlock(({ field, source, fieldName, input, placeholder = 'Выберите из списка',
3652
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3653
+ options, ...rest }) => {
3654
+ const leadOptions = source?.map((_) => ({
3655
+ key: _.key || '',
3656
+ text: _.value,
3657
+ })) || [];
3658
+ return (jsx(SelectControl, { placeholder: placeholder, options: leadOptions, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required), ...rest }));
3659
+ });
3660
+
3661
+ const AmountWorkersField = JSX(({ field, input }) => {
3662
+ const { data } = useLeadFormData('EMPLOYEES_NUMBER');
3663
+ const store = useRetailFormStore();
3664
+ useEffect(() => {
3665
+ if (data) {
3666
+ store.amountWorkers = data;
3667
+ }
3668
+ }, [data]);
3669
+ return (jsx(SelectField, { field: field, source: store.amountWorkers ?? [], label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0449\u0438\u0445 \u0432 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "amountWorkers", input: input }));
3118
3670
  });
3119
3671
 
3120
- const DatePickerControl = JSX(({ className, label, error, errors, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(DatePicker, { label: getRequiredLabel({ label, errors }), valid: Boolean(!error), ...rest }), renderErrorText(error)] })));
3672
+ const ArmyIdFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u041D\u0430\u043B\u0438\u0447\u0438\u0435 \u0432\u043E\u0435\u043D\u043D\u043E\u0433\u043E \u0431\u0438\u043B\u0435\u0442\u0430", ...getValidation(field('armyIdFlg'), validatorObj.armyIdFlg, input?.required) })));
3121
3673
 
3122
- const BeginDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430 \u0440\u0430\u0431\u043E\u0442\u044B \u043D\u0430 \u0442\u0435\u043A\u0443\u0449\u0435\u043C \u043C\u0435\u0441\u0442\u0435", ...getValidation(field('beginDate'), validatorObj.beginDate, input?.required), ...input })));
3674
+ const BankEmpoleeCodeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044F \u0411\u0430\u043D\u043A\u0430", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0434", isInteger: true, ...getValidation(field('bankEmployeeCode'), validatorObj.bankEmployeeCode, input?.required), ...input })));
3123
3675
 
3124
- const BirthdayField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field('birthday'), validatorObj.birthday, input?.required) })));
3676
+ const BankruptcyFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u0412 \u043E\u0442\u043D\u043E\u0448\u0435\u043D\u0438\u0438 \u043C\u0435\u043D\u044F \u0432\u0435\u0434\u0451\u0442\u0441\u044F \u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0441\u0442\u0432\u043E \u043F\u043E \u0434\u0435\u043B\u0443 \u043E \u0431\u0430\u043D\u043A\u0440\u043E\u0442\u0441\u0442\u0432\u0435", ...getValidation(field('bankruptcyFlg'), validatorObj.bankruptcyFlg, input?.required) })));
3677
+
3678
+ const BeginDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430 \u0440\u0430\u0431\u043E\u0442\u044B \u043D\u0430 \u0442\u0435\u043A\u0443\u0449\u0435\u043C \u043C\u0435\u0441\u0442\u0435", ...getValidation(field('beginDate'), validatorObj.beginDate, input?.required), ...input })));
3125
3679
 
3126
- const FIELD_NAME$b = 'birthPlace';
3127
- const BirthPlaceField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field('birthPlace'), validatorObj.birthPlace, input?.required), ...input, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$b) })));
3680
+ const FIELD_NAME$9 = 'birthPlace';
3681
+ const BirthPlaceField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field('birthPlace'), validatorObj.birthPlace, input?.required), ...input, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$9) })));
3128
3682
 
3129
3683
  const getCardTypes = async (paymentSystemTypeCd, creditProgramId) => {
3130
3684
  const data = await fetchRetailJSON('/dictionaryFiltered', 'POST', {
@@ -3180,10 +3734,6 @@
3180
3734
 
3181
3735
  const CodeWordField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434\u043E\u0432\u043E\u0435 \u0441\u043B\u043E\u0432\u043E", ...getValidation(field('codeWord'), validatorObj.codeWord, input?.required), ...input })));
3182
3736
 
3183
- const CollectionCountField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432 \u0438\u043D\u043A\u0430\u0441\u0441\u0430\u0446\u0438\u0438", isInteger: true, ...getValidation(field('collectionCount'), validatorObj.collectionCount, input?.required) })));
3184
-
3185
- const CommentField = JSX(({ field, input }) => (jsx(InputControl, { className: "col-span-2", ...getValidation(field('comment'), validatorObj.comment, input?.required), placeholder: "\u0412\u0430\u0448\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435", isTextarea: true })));
3186
-
3187
3737
  const ConfirmationIncomeField = JSX(({ field, input }) => {
3188
3738
  const { data: confirmationIncome } = useLeadFormData('INCOME_CERT_UNITED');
3189
3739
  return (jsx(SelectField, { field: field, source: confirmationIncome, label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F \u0434\u043E\u0445\u043E\u0434\u0430", fieldName: "confirmationIncome", input: input }));
@@ -3215,9 +3765,6 @@
3215
3765
  text: 'Согласие на запрос в ПФР',
3216
3766
  docId: 3,
3217
3767
  },
3218
- consentToReceiveMaterials: {
3219
- text: 'Согласен на получение информационных и аналитических материалов по электронной почте',
3220
- },
3221
3768
  };
3222
3769
 
3223
3770
  const feedbackById = async (id, convertToPng = false) => {
@@ -3225,42 +3772,6 @@
3225
3772
  return response ? await response.blob() : new Blob();
3226
3773
  };
3227
3774
 
3228
- function useButton() {
3229
- return (props) => ({
3230
- ...props,
3231
- onClick: handlerDecorator(handleClick(props)),
3232
- });
3233
- }
3234
- function handleClick({ disabled, onClick }) {
3235
- return (ev) => {
3236
- !disabled && onClick && onClick(ev);
3237
- };
3238
- }
3239
-
3240
- const buttonStyleMap = {
3241
- primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
3242
- secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
3243
- };
3244
- const secondaryButtonStyleMap = {
3245
- primary: style('group-data-secondary:text-primary-main group-data-secondary:bg-white', 'group-data-secondary:hover:text-white group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
3246
- secondary: style('group-data-secondary:text-white group-data-secondary:bg-white/20', 'group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
3247
- };
3248
- const Button = JSX(({ children, ...props }) => {
3249
- const button = useButton();
3250
- const { className, version = 'primary', active, disabled, isLoading, type = 'button', rounded = true, role, onClick, } = button(props);
3251
- return (jsxs("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs relative', {
3252
- 'text-white bg-primary-active': active,
3253
- 'bg-main-gray text-main-disabled cursor-not-allowed': disabled || isLoading,
3254
- 'rounded-md': rounded,
3255
- }, !active && !disabled && !isLoading
3256
- ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
3257
- : '', className), type: type, role: role, onClick: onClick, children: [isLoading ? jsx(Loader, { blur: true, size: "small" }) : null, children] }));
3258
- });
3259
-
3260
- const CloseButton = JSX(({ className, onClose }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-2xs bg-transparent border-none', className), onClick: onClose, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", type: "button", children: jsx(Icon, { name: "CloseIcon", width: "20", height: "20", iconVersion: "gray" }) })));
3261
-
3262
- const Dialog = JSX(({ className, head, children, onClose, onClick }) => (jsxs("div", { className: style('relative bg-white pt-0 p-lg', className), role: "dialog", onClick: onClick, children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: onClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] })));
3263
-
3264
3775
  // TODO Перенесено как есть из openDocument. Требует рефакторинга
3265
3776
  const DocumentDialog = JSX(({ src, convertToPng, onClose, onDocumentRead }) => (jsxs(Dialog, { className: "my-6xl max-w-4xl mx-auto px-0 min-h-0 pb-0", onClose: onClose, children: [convertToPng ? (jsx("img", { src: src })) : (jsx("iframe", { src: `${src}#toolbar=0`, className: "w-full h-[80vh]", id: "iframe-dialog" })), jsx(Button, { className: "mx-auto mt-m", type: "button", onClick: () => {
3266
3777
  onDocumentRead?.();
@@ -3343,12 +3854,6 @@
3343
3854
  const renderMonthsInput = ({ min = 0, max = 0, availableMonths, ...rest }) => (jsx(InputRange, { items: [`От ${monthText(min)}`, `До ${monthText(max)}`], step: STEP_MONTHS, ...(availableMonths?.length ? { list: availableMonths } : { min, max }), ...rest }));
3344
3855
  const monthText = (month) => `${month} ${Number(month) % 10 === 1 ? 'месяца' : 'месяцев'}`;
3345
3856
 
3346
- const orientationStyleMap = {
3347
- horizontal: '@lg:flex-row',
3348
- vertical: '',
3349
- };
3350
- const RadioButtonGroup = JSX(({ label, items, value, className, onChange: onChangeCheckedItem, disabled = false, orientation = 'horizontal', }) => (jsxs("div", { className: "grid gap-xs whitespace-nowrap", children: [label ? (jsx("div", { role: "radiogroup", "aria-label": label, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: label }) })) : null, jsx("div", { className: style('flex flex-col gap-s', orientationStyleMap[orientation], className), role: "radiogroup", "aria-label": "\u0413\u0440\u0443\u043F\u043F\u0430 \u043A\u043D\u043E\u043F\u043E\u043A", children: items?.map(({ id, text }) => (jsx(Checkbox, { isRadio: true, text: text, value: value === id, onChange: () => onChangeCheckedItem && onChangeCheckedItem(id), disabled: disabled }, String(id)))) })] })));
3351
-
3352
3857
  const renderBinaryRadioButtonGroup = ({ items, title, mobileTitle = title, orientation = 'horizontal', value, onChange, ...rest }) => (jsxs("div", { className: "grid gap-s whitespace-nowrap", children: [title ? (jsx("div", { className: "hidden @5xl:block", role: "radiogroup", "aria-label": title, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: title }) })) : null, mobileTitle ? (jsx("div", { className: "@5xl:hidden", role: "radiogroup", "aria-label": mobileTitle, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: mobileTitle }) })) : null, jsx(RadioButtonGroup, { orientation: orientation, items: items, value: items[value ? 0 : 1].id, onChange: (_) => onChange && onChange(_ === items[0].id), ...rest })] }));
3353
3858
 
3354
3859
  const renderPaymentType = (props) => renderBinaryRadioButtonGroup({
@@ -3590,12 +4095,12 @@
3590
4095
  };
3591
4096
  const swap = (_) => Object.fromEntries(Object.entries(_).map(([k, v]) => [v, k]));
3592
4097
 
3593
- const FIELD_NAME$a = 'calculator';
4098
+ const FIELD_NAME$8 = 'calculator';
3594
4099
  const CreditCalcField = JSX(({ field, params }) => {
3595
4100
  const handleChange = useCallback((_) => {
3596
- field(FIELD_NAME$a).onChange?.(_);
4101
+ field(FIELD_NAME$8).onChange?.(_);
3597
4102
  }, []);
3598
- return (jsx(CalculatorCredit, { ...params?.calcData, padding: "p-0", defaultParams: defaultValueAdapter(field(FIELD_NAME$a).value), onChange: handleChange }));
4103
+ return (jsx(CalculatorCredit, { ...params?.calcData, padding: "p-0", defaultParams: defaultValueAdapter(field(FIELD_NAME$8).value), onChange: handleChange }));
3599
4104
  });
3600
4105
 
3601
4106
  const LABEL_TEXT = `Имеет ли юридическое лицо, акционером / участником / членом / пайщиком /
@@ -3620,252 +4125,100 @@
3620
4125
 
3621
4126
  const DependentsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0438\u0436\u0434\u0438\u0432\u0435\u043D\u0446\u0435\u0432", placeholder: "\u0417\u0430 \u0438\u0441\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u0434\u0435\u0442\u0435\u0439 \u0434\u043E 18 \u043B\u0435\u0442", isInteger: true, maxLength: 2, ...getValidation(field('dependents'), validatorObj.dependents, input?.required), ...input })));
3622
4127
 
3623
- const DesiredMeetingDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0416\u0435\u043B\u0430\u0435\u043C\u0430\u044F \u0434\u0430\u0442\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0438", ...getValidation(field('desiredMeetingDate'), validatorObj.meetingDay, input?.required) })));
3624
-
3625
4128
  const DisablePeopleFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u042F\u0432\u043B\u044F\u044E\u0441\u044C \u0438\u043D\u0432\u0430\u043B\u0438\u0434\u043E\u043C", ...getValidation(field('disablePeopleFlg'), validatorObj.disablePeopleFlg, input?.required) })));
3626
4129
 
3627
- const FIELD_NAME$9 = 'dulIssueDateField';
3628
- const DulIssueDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438", ...getValidation(field(FIELD_NAME$9), validatorObj.dulIssueDateField, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$9) })));
4130
+ const FIELD_NAME$7 = 'dulIssueDateField';
4131
+ const DulIssueDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438", ...getValidation(field(FIELD_NAME$7), validatorObj.dulIssueDateField, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$7) })));
3629
4132
 
3630
- const FIELD_NAME$8 = 'dulIssuedBy';
4133
+ const FIELD_NAME$6 = 'dulIssuedBy';
3631
4134
  const DulIssuedByField = JSX(({ field, input }) => {
3632
4135
  const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
3633
4136
  const onDaDataChange = useCallback((item) => {
3634
4137
  changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
3635
4138
  }, []);
3636
- return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$8), label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...input, ...getValidation(field(FIELD_NAME$8), validatorObj.dulIssuedBy, input?.required), onDaDataChange: onDaDataChange, daDataQueryPrefix: dulSubdivisionCode }));
4139
+ return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$6), label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...input, ...getValidation(field(FIELD_NAME$6), validatorObj.dulIssuedBy, input?.required), onDaDataChange: onDaDataChange, daDataQueryPrefix: dulSubdivisionCode }));
3637
4140
  });
3638
4141
 
3639
- const FIELD_NAME$7 = 'dulNumber';
3640
- const DulNumberField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$7), label: "\u041D\u043E\u043C\u0435\u0440 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", isInteger: true, maxLength: 6, ...getValidation(field('dulNumber'), validatorObj.dulNumber, input?.required) })));
4142
+ const FIELD_NAME$5 = 'dulNumber';
4143
+ const DulNumberField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$5), label: "\u041D\u043E\u043C\u0435\u0440 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", isInteger: true, maxLength: 6, ...getValidation(field('dulNumber'), validatorObj.dulNumber, input?.required) })));
3641
4144
 
3642
- const FIELD_NAME$6 = 'dulSerie';
3643
- const DulSerieField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$6), label: "\u0421\u0435\u0440\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", isInteger: true, maxLength: 4, ...getValidation(field('dulSerie'), validatorObj.dulSerie, input?.required) })));
4145
+ const FIELD_NAME$4 = 'dulSerie';
4146
+ const DulSerieField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$4), label: "\u0421\u0435\u0440\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", isInteger: true, maxLength: 4, ...getValidation(field('dulSerie'), validatorObj.dulSerie, input?.required) })));
3644
4147
 
3645
- const FIELD_NAME$5 = 'dulSubdivisionCode';
4148
+ const FIELD_NAME$3 = 'dulSubdivisionCode';
3646
4149
  const DulSubdivisionCodeField = JSX(({ field, input }) => {
3647
4150
  const onDaDataChange = useCallback((item) => {
3648
4151
  field?.('dulIssuedBy')?.onChange?.(item?.data?.name);
3649
4152
  }, []);
3650
- return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$5), label: "\u041A\u043E\u0434 \u043F\u043E\u0434\u0440\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u0438\u044F", isInteger: true, maxLength: 6, ...input, ...getValidation(field(FIELD_NAME$5), validatorObj.dulSubdivisionCode, input?.required), onDaDataChange: onDaDataChange }));
4153
+ return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$3), label: "\u041A\u043E\u0434 \u043F\u043E\u0434\u0440\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u0438\u044F", isInteger: true, maxLength: 6, ...input, ...getValidation(field(FIELD_NAME$3), validatorObj.dulSubdivisionCode, input?.required), onDaDataChange: onDaDataChange }));
3651
4154
  });
3652
4155
 
3653
4156
  const EducationField = JSX(({ field, input }) => {
3654
4157
  const { data: education } = useLeadFormData('EDUCATION_LEVEL');
3655
4158
  return (jsx(SelectField, { field: field, source: education, label: "\u041E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435", fieldName: "education", input: input }));
3656
4159
  });
3657
-
3658
- const EmailField = JSX(({ field, input }) => {
3659
- const { required, ...rest } = input;
3660
- return (jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...getValidation(field('email'), validatorObj.email, required), ...rest }));
3661
- });
3662
-
3663
- const EmployerActivitiesField = JSX(({ field, input }) => {
3664
- const { data } = useLeadFormData('ORGANIZATION_ACTIVITY_TYPE');
3665
- const store = useRetailFormStore();
3666
- useEffect(() => {
3667
- if (data) {
3668
- store.employerActivities = data;
3669
- }
3670
- }, [data]);
3671
- return (jsx(SelectField, { field: field, source: store.employerActivities ?? [], label: "\u0412\u0438\u0434 \u0434\u0435\u044F\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438-\u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerActivities", input: input }));
3672
- });
3673
-
3674
- const EmployerOrganizationField = JSX(({ field, input }) => {
3675
- const { data } = useLeadFormData('ORGANIZATION_KIND');
3676
- const store = useRetailFormStore();
3677
- useEffect(() => {
3678
- if (data) {
3679
- store.employerOrganization = data;
3680
- }
3681
- }, [data]);
3682
- return (jsx(SelectField, { field: field, source: store.employerOrganization ?? [], label: "\u0412\u0438\u0434 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerOrganization", input: input }));
3683
- });
3684
-
3685
- const EmploymentField = JSX(({ field, input }) => {
3686
- const { data: employment } = useLeadFormData('EMPLOYMENT_INFO_UNITED');
3687
- return (jsx(SelectField, { field: field, source: employment, label: "\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E \u0442\u0440\u0443\u0434\u043E\u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0435", fieldName: "employment", input: input }));
3688
- });
3689
-
3690
- const ExpensesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0440\u0430\u0441\u0445\u043E\u0434\u044B \u0432 \u043C\u0435\u0441\u044F\u0446", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('expenses'), validatorObj.expenses, input?.required), ...input })));
3691
-
3692
- const FIELD_NAME$4 = 'experience5Years';
3693
- const MAX_YEARS = 5;
3694
- const MIN_YEARS = 0;
3695
- const Experience5YearsField = JSX(({ field, input }) => {
3696
- const onChange = useCallback((value) => field(FIELD_NAME$4)?.onChange?.(String(clamp(Number(value), MIN_YEARS, MAX_YEARS))), []);
3697
- return (jsx(InputControl, { label: "\u0421\u0442\u0430\u0436", placeholder: "\u0417\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", type: "number", ...getValidation(field(FIELD_NAME$4), validatorObj[FIELD_NAME$4], input?.required), ...input, onChange: onChange }));
3698
- });
3699
-
3700
- const FamilyMembersField = JSX(({ field }) => {
3701
- const { value, onChange } = field('familyMembers');
3702
- const familyStatusKey = field('familyStatus')?.value?.key;
3703
- const adultsCount = familyStatusKey === 'MARRIED' ? 2 : 1;
3704
- const childrenCount = Number(field('children')?.value);
3705
- const dependentsCount = Number(field('dependents')?.value);
3706
- const totalCount = adultsCount + childrenCount + dependentsCount;
3707
- useEffect(() => {
3708
- field?.('familyMembers')?.onChange?.(totalCount);
3709
- }, [familyStatusKey, childrenCount, dependentsCount]);
3710
- return (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0447\u043B\u0435\u043D\u043E\u0432 \u0441\u0435\u043C\u044C\u0438", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", disabled: true, value: value, onChange: (_) => onChange?.(_) }));
3711
- });
3712
-
3713
- const FamilyStatusField = JSX(({ field, input }) => {
3714
- const { data: familyStatus } = useLeadFormData('MARITAL_STATUS');
3715
- return (jsx(SelectField, { field: field, source: familyStatus, label: "\u0421\u0435\u043C\u0435\u0439\u043D\u043E\u0435 \u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435", fieldName: "familyStatus", input: input }));
3716
- });
3717
-
3718
- const SERVICE_TYPES = [{ key: 'ULTRASERVICE', text: 'Ультра' }];
3719
- const SERVICE_DIRECTIONS = [
3720
- { key: 'Физическое лицо' },
3721
- { key: 'Юридическое лицо / ИП' },
3722
- ];
3723
- const FEEDBACK_METHOD = [
3724
- { key: 'phone', text: 'Телефонный звонок' },
3725
- { key: 'email', text: 'Электронное сообщение' },
3726
- ];
3727
-
3728
- const FeedbackMethodField = JSX(({ field, input }) => (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, ...getValidation(field('feedbackMethod'), validatorObj.feedbackMethod, input?.required) })));
3729
-
3730
- const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...getValidation(field('fullName'), validatorObj.fullName, input?.required), ...input })));
3731
-
3732
- const GeneralSeniorityField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u0449\u0438\u0439 \u0441\u0442\u0430\u0436", type: "number", maxLength: 2, placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043B\u0435\u0442", ...getValidation(field('generalSeniority'), validatorObj.generalSeniority, input?.required), ...input })));
3733
-
3734
- const HousingField = JSX(({ field, input }) => {
3735
- const { data: housing } = useLeadFormData('HOUSE_TYPE');
3736
- return (jsx(SelectField, { field: field, source: housing, label: "\u0422\u0438\u043F \u0436\u0438\u043B\u044C\u044F", fieldName: "housing", input: input }));
3737
- });
3738
-
3739
- const getOrganizationActivityType = (options, okved) => {
3740
- if (!okved) {
3741
- return null;
3742
- }
3743
- const getOptionByKey = getOptionOp(options);
3744
- const okvedType = +okved?.split('.')[0];
3745
- const secondOkvedType = +okved?.split('.')[1];
3746
- switch (okvedType) {
3747
- case 1:
3748
- return getOptionByKey("AGRICULTURE" /* EOrganizationActivityTypes.AGRICULTURE */);
3749
- case 35:
3750
- return getOptionByKey("FUEL_AND_ENERGY" /* EOrganizationActivityTypes.FUEL_AND_ENERGY */);
3751
- case 41:
3752
- case 42:
3753
- case 43:
3754
- return getOptionByKey("CONSTRUCTION" /* EOrganizationActivityTypes.CONSTRUCTION */);
3755
- case 46:
3756
- case 47:
3757
- return getOptionByKey("TRADE" /* EOrganizationActivityTypes.TRADE */);
3758
- case 55:
3759
- case 79:
3760
- return getOptionByKey("TOURISM" /* EOrganizationActivityTypes.TOURISM */);
3761
- case 62:
3762
- return getOptionByKey("TECHNOLOGY" /* EOrganizationActivityTypes.TECHNOLOGY */);
3763
- case 63:
3764
- return getOptionByKey("CONSULTING_SERVICE" /* EOrganizationActivityTypes.CONSULTING_SERVICE */);
3765
- case 64:
3766
- return getOptionByKey("BANK" /* EOrganizationActivityTypes.BANK */);
3767
- case 65:
3768
- return getOptionByKey("INSURER" /* EOrganizationActivityTypes.INSURER */);
3769
- case 66:
3770
- return getOptionByKey("FINANCIAL_INSTITUTIONS" /* EOrganizationActivityTypes.FINANCIAL_INSTITUTIONS */);
3771
- case 72:
3772
- case 74:
3773
- return getOptionByKey("SCIENCE" /* EOrganizationActivityTypes.SCIENCE */);
3774
- case 80:
3775
- return getOptionByKey("SECURITY" /* EOrganizationActivityTypes.SECURITY */);
3776
- case 84: {
3777
- if (secondOkvedType < 22) {
3778
- return getOptionByKey("GOVERNANCE" /* EOrganizationActivityTypes.GOVERNANCE */);
3779
- }
3780
- if (secondOkvedType === 22) {
3781
- return getOptionByKey("ARMY" /* EOrganizationActivityTypes.ARMY */);
3782
- }
3783
- return getOptionByKey("OTHER_SECTORS" /* EOrganizationActivityTypes.OTHER_SECTORS */);
3784
- }
3785
- case 85:
3786
- return getOptionByKey("EDUCATION" /* EOrganizationActivityTypes.EDUCATION */);
3787
- case 86:
3788
- return getOptionByKey("HEALTHCARE" /* EOrganizationActivityTypes.HEALTHCARE */);
3789
- case 87:
3790
- return getOptionByKey("SOCIAL_SPHERE" /* EOrganizationActivityTypes.SOCIAL_SPHERE */);
3791
- default: {
3792
- if (okvedType >= 10 && okvedType <= 33) {
3793
- return getOptionByKey("INDUSTRY" /* EOrganizationActivityTypes.INDUSTRY */);
3794
- }
3795
- if (okvedType >= 5 && okvedType <= 9) {
3796
- return getOptionByKey("FUEL_AND_ENERGY" /* EOrganizationActivityTypes.FUEL_AND_ENERGY */);
3797
- }
3798
- if (okvedType >= 49 && okvedType <= 53) {
3799
- return getOptionByKey("TRANSPORT" /* EOrganizationActivityTypes.TRANSPORT */);
3800
- }
3801
- return getOptionByKey("OTHER_SECTORS" /* EOrganizationActivityTypes.OTHER_SECTORS */);
3802
- }
3803
- }
3804
- };
3805
- const getEmployeesNumberOption = (options, count) => {
3806
- if (!count) {
3807
- return null;
3808
- }
3809
- const [option] = [options?.find((_) => count <= Number(_.description))].map((_) => ({
3810
- key: _?.key ?? '',
3811
- text: _?.value ?? '',
3812
- }));
3813
- return option;
3814
- };
3815
- const getOrganizationKind = (options, okopf) => {
3816
- const getOptionByKey = getOptionOp(options);
3817
- if ([40001, 40002, 71610].includes(okopf)) {
3818
- return getOptionByKey('FOREIGN');
3819
- }
3820
- return getOptionByKey('RUSSIAN');
3821
- };
3822
- const getOrganizationType = (options, okopf, inn) => {
3823
- const getOptionByKey = getOptionOp(options);
3824
- if (inn === '7725114488') {
3825
- return getOptionByKey('RSHB');
3826
- }
3827
- if (okopf === 50102) {
3828
- return getOptionByKey('SOLE_TRADER');
3829
- }
3830
- if (okopf >= 75000 && okopf <= 75505 && okopf !== 75500) {
3831
- return getOptionByKey('BUDGETARY');
3832
- }
3833
- return getOptionByKey('COMMERCIAL');
3834
- };
3835
- const getOptionOp = (options) => (key) => options
3836
- .map((_) => ({ key: _.key, text: _.value }))
3837
- .find((_) => _.key === key) ?? null;
3838
-
3839
- const updateOrganizationFields = (store, field, item) => {
3840
- const { okved, okopf, inn } = getOrganizationRequisites(item);
3841
- field?.('legalForm')?.onChange?.(item.data?.opf?.short);
3842
- field?.('organizationAddress')?.onChange?.(getAddressFromDaDataItem(item.data?.address));
3843
- const organizationData = {
3844
- amountWorkers: getEmployeesNumberOption(store?.amountWorkers, item.data?.employee_count),
3845
- employerActivities: getOrganizationActivityType(store?.employerActivities ?? [], okved),
3846
- organization: getOrganizationType(store?.organization ?? [], okopf, inn),
3847
- employerOrganization: getOrganizationKind(store?.employerOrganization ?? [], okopf),
3848
- };
3849
- for (const fieldName in organizationData) {
3850
- organizationData[fieldName] && field?.(fieldName)?.onChange?.(organizationData[fieldName]);
3851
- }
3852
- };
3853
- const getOrganizationRequisites = (item) => ({
3854
- inn: item.data?.inn ?? '',
3855
- okopf: Number(item.data?.opf?.code),
3856
- okved: item.data?.okved ?? '',
4160
+
4161
+ const EmployerActivitiesField = JSX(({ field, input }) => {
4162
+ const { data } = useLeadFormData('ORGANIZATION_ACTIVITY_TYPE');
4163
+ const store = useRetailFormStore();
4164
+ useEffect(() => {
4165
+ if (data) {
4166
+ store.employerActivities = data;
4167
+ }
4168
+ }, [data]);
4169
+ return (jsx(SelectField, { field: field, source: store.employerActivities ?? [], label: "\u0412\u0438\u0434 \u0434\u0435\u044F\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438-\u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerActivities", input: input }));
3857
4170
  });
3858
4171
 
3859
- const InnField = JSX(({ field, input }) => {
4172
+ const EmployerOrganizationField = JSX(({ field, input }) => {
4173
+ const { data } = useLeadFormData('ORGANIZATION_KIND');
3860
4174
  const store = useRetailFormStore();
3861
- const onDaDataChange = useCallback((item) => {
3862
- field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
3863
- updateOrganizationFields(store, field, item);
3864
- }, []);
3865
- return (jsx(InputControl, { label: "\u0418\u041D\u041D", isInteger: true, maxLength: 12, ...input, ...getValidation(field('inn'), validatorObj.inn, input?.required), onDaDataChange: onDaDataChange }));
4175
+ useEffect(() => {
4176
+ if (data) {
4177
+ store.employerOrganization = data;
4178
+ }
4179
+ }, [data]);
4180
+ return (jsx(SelectField, { field: field, source: store.employerOrganization ?? [], label: "\u0412\u0438\u0434 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerOrganization", input: input }));
3866
4181
  });
3867
4182
 
3868
- const IsClientField = JSX(({ field }) => (jsx(CheckboxWithError, { ...field('isClient'), text: '\u042F\u0432\u043B\u044F\u044E\u0441\u044C \u043A\u043B\u0438\u0435\u043D\u0442\u043E\u043C \u0431\u0430\u043D\u043A\u0430 \u0410\u041E "\u0420\u043E\u0441\u0441\u0435\u043B\u044C\u0445\u043E\u0437\u0431\u0430\u043D\u043A"' })));
4183
+ const EmploymentField = JSX(({ field, input }) => {
4184
+ const { data: employment } = useLeadFormData('EMPLOYMENT_INFO_UNITED');
4185
+ return (jsx(SelectField, { field: field, source: employment, label: "\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E \u0442\u0440\u0443\u0434\u043E\u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0435", fieldName: "employment", input: input }));
4186
+ });
4187
+
4188
+ const ExpensesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0440\u0430\u0441\u0445\u043E\u0434\u044B \u0432 \u043C\u0435\u0441\u044F\u0446", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('expenses'), validatorObj.expenses, input?.required), ...input })));
4189
+
4190
+ const FIELD_NAME$2 = 'experience5Years';
4191
+ const MAX_YEARS = 5;
4192
+ const MIN_YEARS = 0;
4193
+ const Experience5YearsField = JSX(({ field, input }) => {
4194
+ const onChange = useCallback((value) => field(FIELD_NAME$2)?.onChange?.(String(clamp(Number(value), MIN_YEARS, MAX_YEARS))), []);
4195
+ return (jsx(InputControl, { label: "\u0421\u0442\u0430\u0436", placeholder: "\u0417\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", type: "number", ...getValidation(field(FIELD_NAME$2), validatorObj[FIELD_NAME$2], input?.required), ...input, onChange: onChange }));
4196
+ });
4197
+
4198
+ const FamilyMembersField = JSX(({ field }) => {
4199
+ const { value, onChange } = field('familyMembers');
4200
+ const familyStatusKey = field('familyStatus')?.value?.key;
4201
+ const adultsCount = familyStatusKey === 'MARRIED' ? 2 : 1;
4202
+ const childrenCount = Number(field('children')?.value);
4203
+ const dependentsCount = Number(field('dependents')?.value);
4204
+ const totalCount = adultsCount + childrenCount + dependentsCount;
4205
+ useEffect(() => {
4206
+ field?.('familyMembers')?.onChange?.(totalCount);
4207
+ }, [familyStatusKey, childrenCount, dependentsCount]);
4208
+ return (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0447\u043B\u0435\u043D\u043E\u0432 \u0441\u0435\u043C\u044C\u0438", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", disabled: true, value: value, onChange: (_) => onChange?.(_) }));
4209
+ });
4210
+
4211
+ const FamilyStatusField = JSX(({ field, input }) => {
4212
+ const { data: familyStatus } = useLeadFormData('MARITAL_STATUS');
4213
+ return (jsx(SelectField, { field: field, source: familyStatus, label: "\u0421\u0435\u043C\u0435\u0439\u043D\u043E\u0435 \u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435", fieldName: "familyStatus", input: input }));
4214
+ });
4215
+
4216
+ const GeneralSeniorityField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u0449\u0438\u0439 \u0441\u0442\u0430\u0436", type: "number", maxLength: 2, placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043B\u0435\u0442", ...getValidation(field('generalSeniority'), validatorObj.generalSeniority, input?.required), ...input })));
4217
+
4218
+ const HousingField = JSX(({ field, input }) => {
4219
+ const { data: housing } = useLeadFormData('HOUSE_TYPE');
4220
+ return (jsx(SelectField, { field: field, source: housing, label: "\u0422\u0438\u043F \u0436\u0438\u043B\u044C\u044F", fieldName: "housing", input: input }));
4221
+ });
3869
4222
 
3870
4223
  const JobsNumberField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043C\u0435\u0441\u0442 \u0440\u0430\u0431\u043E\u0442\u044B \u0437\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043C\u0435\u0441\u0442", isInteger: true, maxLength: 2, ...getValidation(field('jobsNumber'), validatorObj.jobsNumber, input?.required), ...input })));
3871
4224
 
@@ -3877,30 +4230,8 @@
3877
4230
 
3878
4231
  const LegalFormField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u041F\u0424", placeholder: "\u041E\u041E\u041E, \u041F\u0410\u041E \u0438 \u0434\u0440.", ...getValidation(field('legalForm'), validatorObj.legalForm, input?.required), ...input })));
3879
4232
 
3880
- const FIELD_NAME$3 = 'limitedBirthday';
3881
- const LimitedBirthdayField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field(FIELD_NAME$3), validatorObj.limitedBirthday, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$3) })));
3882
-
3883
- const OUT_SERVICE_BASE_URL = `${API_BASE_URI}/outservice`;
3884
- const EMPTY_REGIONS$1 = [];
3885
- async function getOutServiceRegions() {
3886
- const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
3887
- return data && Array.isArray(data) ? data : EMPTY_REGIONS$1;
3888
- }
3889
-
3890
- const LocalitiesField = JSX(({ field, input }) => {
3891
- const fieldRegion = field('region');
3892
- const regionKey = fieldRegion?.value?.key;
3893
- const { data: regions } = useAsyncData('outServiceRegions', getOutServiceRegions);
3894
- const localities = regions
3895
- ?.find((_) => _.code === regionKey)
3896
- ?.localities?.map((_) => ({ key: _, text: _ }));
3897
- useEffect(() => {
3898
- if (regionKey !== '') {
3899
- field?.('localities')?.onChange?.('');
3900
- }
3901
- }, [regionKey]);
3902
- return (jsx(SelectControl, { label: "\u041D\u0430\u0441\u0435\u043B\u0435\u043D\u043D\u044B\u0439 \u043F\u0443\u043D\u043A\u0442", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0433\u043E\u0440\u043E\u0434, \u0433\u0434\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0441\u0435\u0440\u0432\u0438\u0441", options: localities, ...getValidation(field('localities'), validatorObj.localities, input?.required), isSearch: true }));
3903
- });
4233
+ const FIELD_NAME$1 = 'limitedBirthday';
4234
+ const LimitedBirthdayField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field(FIELD_NAME$1), validatorObj.limitedBirthday, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$1) })));
3904
4235
 
3905
4236
  const MandatoryPaymentsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0432\u044B\u043F\u043B\u0430\u0442\u044B", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('mandatoryPayments'), validatorObj.mandatoryPayments, input?.required), ...input })));
3906
4237
 
@@ -3910,15 +4241,6 @@
3910
4241
  ];
3911
4242
  const MethodObtainField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { orientation: "horizontal", items: METHODS_OF_OBTAIN, ...getValidation(field('methodObtain'), validatorObj.methodObtain, input?.required) })));
3912
4243
 
3913
- const FIELD_NAME$2 = 'middleName';
3914
- const MiddleNameField = JSX(({ field, input }) => (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)", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$2), ...getValidation(field(FIELD_NAME$2), validatorObj.middleName, input?.required), ...input })));
3915
-
3916
- const NameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\u043C\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, input.name ?? ''), ...getValidation(field('name'), validatorObj.name, input?.required), ...input })));
3917
-
3918
- const SlideCheckbox = JSX(({ value = false, text, type = 'checkbox', onChange }) => (jsxs("div", { role: type, "aria-checked": value, className: "flex justify-start items-center w-full cursor-pointer mb-s", onClick: () => onChange && onChange(!value), children: [jsx("div", { className: style('relative flex-shrink-0 duration-300 w-9 h-5 mr-s rounded-2xl', value ? 'bg-primary-main' : 'bg-main-divider'), children: jsx("div", { className: style('absolute opacity-80 duration-500 top-0.5 w-4 h-4 bg-white rounded-full', value ? 'left-1/2' : 'left-[5%]') }) }), text ? (jsx(Text, { size: "text-l", font: "font-light", color: "text-primary-text", children: text })) : null] })));
3919
-
3920
- const OnlineCheckoutField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 \u043E\u043D\u043B\u0430\u0439\u043D-\u043A\u0430\u0441\u0441\u0443", ...field('onlineCheckout') })) : null);
3921
-
3922
4244
  const OrganizationField = JSX(({ field, input }) => {
3923
4245
  const { data } = useLeadFormData('ORGANIZATION_TYPE');
3924
4246
  const store = useRetailFormStore();
@@ -3945,15 +4267,10 @@
3945
4267
 
3946
4268
  const MAX_PART = 100;
3947
4269
  const MIN_PART = 0;
3948
- const FIELD_NAME$1 = 'partInBusiness';
4270
+ const FIELD_NAME = 'partInBusiness';
3949
4271
  const PartInBusinessField = JSX(({ field, input }) => {
3950
- const onChange = useCallback((value) => field(FIELD_NAME$1)?.onChange?.(String(clamp(Number(value), MIN_PART, MAX_PART))), []);
3951
- return (jsx(InputControl, { label: "\u0414\u043E\u043B\u044F \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0432 \u0431\u0438\u0437\u043D\u0435\u0441\u0435", placeholder: "\u0432 %", isInteger: true, maxLength: 3, ...getValidation(field(FIELD_NAME$1), validatorObj.partInBusiness, input?.required), ...input, onChange: onChange }));
3952
- });
3953
-
3954
- const PartnerCommentsField = JSX(({ field, input }) => {
3955
- const { required, ...rest } = input;
3956
- return (jsx(InputControl, { ...getValidation(field('partnerComments'), validatorObj.partnerComments, required), placeholder: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u044E\u0449\u0438\u0439 \u0432\u0430\u0441 \u0432\u043E\u043F\u0440\u043E\u0441", isTextarea: true, ...rest }));
4272
+ const onChange = useCallback((value) => field(FIELD_NAME)?.onChange?.(String(clamp(Number(value), MIN_PART, MAX_PART))), []);
4273
+ return (jsx(InputControl, { label: "\u0414\u043E\u043B\u044F \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0432 \u0431\u0438\u0437\u043D\u0435\u0441\u0435", placeholder: "\u0432 %", isInteger: true, maxLength: 3, ...getValidation(field(FIELD_NAME), validatorObj.partInBusiness, input?.required), ...input, onChange: onChange }));
3957
4274
  });
3958
4275
 
3959
4276
  const getPaymentSystems = async (creditProgramId) => {
@@ -3984,73 +4301,11 @@
3984
4301
  });
3985
4302
  const formatPaymentSystems = (paymentSystems) => paymentSystems?.map((_) => ({ id: _.key, text: _.text })) ?? [];
3986
4303
 
3987
- const isPlaceholder = (_) => _ === '_';
3988
- const isDigit = (_) => /\d/.test(_);
3989
- const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
3990
- const phonePattern = [...'+7 (___) ___-__-__'];
3991
- const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
3992
- const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
3993
- function normalizePhone(phone) {
3994
- const phoneNumbers = phone.replace(/\D/g, '');
3995
- const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
3996
- const result = phonePattern.map(applyPlaceholder);
3997
- const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
3998
- return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
3999
- }
4000
-
4001
- const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
4002
- const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
4003
- const handleBlur = useCallback((v) => {
4004
- if (v === '+7 (') {
4005
- onChange && onChange('');
4006
- }
4007
- }, []);
4008
- return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
4009
- });
4010
-
4011
- const InputPhoneControl = JSX(({ className, label, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(PhoneInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), placeholder: "+7 (___) ___-__-__", ...rest }), renderErrorText(error)] })));
4012
-
4013
- const PhoneField = JSX(({ field, input }) => {
4014
- const fieldName = input?.name || 'phone';
4015
- return (jsx(InputPhoneControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...getValidation(field(fieldName), validatorObj.phone, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, fieldName), ...input }));
4016
- });
4017
-
4018
4304
  const PositionOrganizationField = JSX(({ field, input }) => {
4019
4305
  const { data: positionOrganization } = useLeadFormData('POSITION');
4020
4306
  return (jsx(SelectField, { field: field, source: positionOrganization, label: "\u0414\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u0432 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "positionOrganization", input: input }));
4021
4307
  });
4022
4308
 
4023
- const PosTerminalField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 POS-\u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B", ...field('posTerminal') })) : null);
4024
-
4025
- const ProductField = JSX(({ field, source }) => (jsx(SelectControl, { placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043F\u0440\u043E\u0434\u0443\u043A\u0442", label: "\u041F\u0440\u043E\u0434\u0443\u043A\u0442", options: arrayToOptions(source?.productList), ...withValidator(field('product'), validatorObj.product) })));
4026
- const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
4027
-
4028
- const OUT_SERVICE_URL = `${API_BASE_URI}/outservice/outserviceregions`;
4029
- const getRegionUrl = (typeForm) => typeForm === 'OUTSERVICE' ? OUT_SERVICE_URL : undefined;
4030
-
4031
- const REGIONS_URL = `${API_BASE_URI}/regions`;
4032
- const EMPTY_REGIONS = [];
4033
- // TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
4034
- function useRegions(url = REGIONS_URL) {
4035
- const { data } = useAsyncData(url, fetchJSONUnsafe);
4036
- return Array.isArray(data) ? data : EMPTY_REGIONS;
4037
- }
4038
-
4039
- const RegionField = JSX(({ field, input, params }) => {
4040
- const url = getRegionUrl(params?.typeForm);
4041
- const regions = useRegions(url);
4042
- return (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: useMemo(() => regions?.map(({ code = '', name = '' }) => ({ key: code, text: name })), [regions]), ...getValidation(field('region'), validatorObj.region, input?.required) }));
4043
- });
4044
-
4045
- const RegionPremiumField = JSX(({ field, input }) => {
4046
- const branchByRegions = useBranchesByRegions(true);
4047
- const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
4048
- key: region,
4049
- text: region,
4050
- })), [branchByRegions]);
4051
- return (jsx(SelectControl, { label: "\u0420\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", options: regions, ...getValidation(field('region'), validatorObj.region, input?.required) }));
4052
- });
4053
-
4054
4309
  const RegionRetailField = JSX(({ field, input }) => {
4055
4310
  const { data: regions } = useLeadFormData('REGION_RF');
4056
4311
  const formatRegions = regions?.map(({ key, value }) => ({ key, text: value }));
@@ -4059,15 +4314,6 @@
4059
4314
 
4060
4315
  const RetirementIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041F\u0435\u043D\u0441\u0438\u043E\u043D\u043D\u044B\u0435 \u0434\u043E\u0445\u043E\u0434\u044B", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('retirementIncome'), validatorObj.retirementIncome, input?.required), ...input })));
4061
4316
 
4062
- const SecondaryPhoneField = JSX(({ field }) => {
4063
- const fieldPhone = field('secondaryPhone');
4064
- return (jsx(InputPhoneControl, { label: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0439 \u0442\u0435\u043B\u0435\u0444\u043E\u043D", ...(!fieldPhone.value || fieldPhone.value === '+7 ('
4065
- ? fieldPhone
4066
- : withValidator(fieldPhone, validatorObj.secondaryPhone)) }));
4067
- });
4068
-
4069
- const ServiceDirectionField = JSX(({ field, input }) => (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, ...getValidation(field('serviceDirection'), validatorObj.serviceDirection, input?.required) })));
4070
-
4071
4317
  const GENDERS = ['male', 'female'];
4072
4318
  const getGenderFromName = async (name) => {
4073
4319
  const res = await fetchRetailJSON('/suggestions/suggest/fio', 'POST', {
@@ -4096,130 +4342,69 @@
4096
4342
  })();
4097
4343
  }
4098
4344
  }, []);
4099
- return (jsx(RadioButtonGroupControl, { label: "\u041F\u043E\u043B", orientation: "horizontal", items: SEX_TYPES, ...getValidation(field('sex'), validatorObj.sex, input?.required) }));
4100
- });
4101
-
4102
- const ShareholderFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u042F \u044F\u0432\u043B\u044F\u044E\u0441\u044C \u0430\u043A\u0446\u0438\u043E\u043D\u0435\u0440\u043E\u043C / \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u043E\u043C / \u0447\u043B\u0435\u043D\u043E\u043C / \u043F\u0430\u0439\u0449\u0438\u043A\u043E\u043C / \u0432\u043A\u043B\u0430\u0434\u0447\u0438\u043A\u043E\u043C \u0441 \u0434\u043E\u043B\u0435\u0439 \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0431\u043E\u043B\u0435\u0435 20% \u0443\u0441\u0442\u0430\u0432\u043D\u043E\u0433\u043E \u043A\u0430\u043F\u0438\u0442\u0430\u043B\u0430 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430", ...getValidation(field('shareholderFlg'), validatorObj.shareholderFlg, input?.required) })));
4103
-
4104
- const SnilsInput = JSX(({ children, onChange, maxLength, ...inputProps }) => {
4105
- const handleChange = useCallback((v) => maxLength
4106
- ? v.length <= maxLength && onChange?.(normalizeWithMask(v, '___-___-___ __'))
4107
- : onChange?.(normalizeWithMask(v, '___-___-___ __')), [onChange]);
4108
- const handleBlur = useCallback((v) => {
4109
- if (v === '___-___-___ __') {
4110
- onChange && onChange('');
4111
- }
4112
- }, []);
4113
- return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
4114
- });
4115
-
4116
- const InputSnilsControl = JSX(({ className, label, value, error, onChange, onBlur, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(SnilsInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur, placeholder: "___-___-___ __", ...rest }), renderErrorText(error)] })));
4117
-
4118
- const SnilsField = JSX(({ field, input }) => (jsx(InputSnilsControl, { label: "\u0421\u041D\u0418\u041B\u0421", maxLength: 14, ...getValidation(field('snils'), validatorObj.snils, input?.required), ...input })));
4119
-
4120
- const FIELD_NAME = 'surname';
4121
- const SurnameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0430\u043C\u0438\u043B\u0438\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME), ...getValidation(field('surname'), validatorObj.surname, input?.required), ...input })));
4122
-
4123
- const MIN_CREDIT_TERM = 1;
4124
- const MAX_CREDIT_TERM = 180;
4125
- const ITEMS_CREDIT_TERM = ['От 1 мес', 'До 15 лет'];
4126
- const TermField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0440\u043E\u043A, \u043C\u0435\u0441\u044F\u0446\u0435\u0432", items: ITEMS_CREDIT_TERM, min: MIN_CREDIT_TERM, max: MAX_CREDIT_TERM, ...field('term') })));
4127
-
4128
- const TotalIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('totalIncome'), validatorObj.totalIncome, input?.required), ...input })));
4129
-
4130
- const UltraPremiumField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0422\u0438\u043F \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", options: SERVICE_TYPES, ...getValidation(field('serviceType'), validatorObj.serviceType, input?.required) })));
4131
-
4132
- const VED_TYPES = [
4133
- { id: 'currencyControl', text: 'Валютный контроль' },
4134
- { id: 'documentOperations', text: 'Документарные операции' },
4135
- { id: 'conversionTransactions', text: 'Конверсионные операции' },
4136
- { id: 'otherIssues', text: 'Иные вопросы ВЭД' },
4137
- ];
4138
- const VedField = JSX(({ field }) => {
4139
- const { value, onChange } = field('vedTypes');
4140
- useEffect(() => {
4141
- if (value !== 'currencyControl') {
4142
- field?.('inn')?.onChange?.('');
4143
- field?.('region')?.onChange?.('');
4144
- }
4145
- }, [value]);
4146
- return (jsx("div", { className: "py-m gap-m grid @xl:flex @xl:items-center", children: jsx(RadioButtonGroup, { className: "whitespace-normal", orientation: "horizontal", items: VED_TYPES, value: value, onChange: (_) => onChange && onChange(_) }) }));
4147
- });
4148
-
4149
- const WagesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('wages'), validatorObj.wages, input?.required), ...input })));
4150
-
4151
- function isRenderField({ input, field, }) {
4152
- const { condition } = input;
4153
- const { value } = field(condition?.name || '');
4154
- return !condition || condition?.values?.find((_) => _ === (value?.key ?? value));
4155
- }
4156
-
4157
- const PRODUCT_REF = {
4158
- $ref: '/wcms-resources/outservice-productlist.json',
4159
- };
4160
- const InputsMap = {
4161
- fullName: (props) => jsx(FullNameField, { ...props }),
4162
- addressBranch: (props) => jsx(AddressBranchField, { ...props }),
4163
- desiredMeetingDate: (props) => jsx(DesiredMeetingDateField, { ...props }),
4164
- product: (props) => jsx(ProductField, { ...props, source: PRODUCT_REF }),
4165
- localities: (props) => jsx(LocalitiesField, { ...props }),
4166
- isClient: (props) => jsx(IsClientField, { ...props }),
4167
- partnerComments: (props) => jsx(PartnerCommentsField, { ...props }),
4168
- collectionCount: (props) => jsx(CollectionCountField, { ...props }),
4169
- acquiringType: (props) => jsx(AcquiringField, { ...props }),
4170
- onlineCheckout: (props) => jsx(OnlineCheckoutField, { ...props }),
4171
- posTerminal: (props) => jsx(PosTerminalField, { ...props }),
4172
- serviceType: (props) => jsx(UltraPremiumField, { ...props }),
4173
- term: (props) => jsx(TermField, { ...props }),
4174
- amount: (props) => jsx(AmountField, { ...props }),
4175
- annualRevenue: (props) => jsx(AnnualRevenueField, { ...props }),
4176
- vedTypes: (props) => jsx(VedField, { ...props }),
4177
- feedbackMethod: (props) => jsx(FeedbackMethodField, { ...props }),
4178
- serviceDirection: (props) => jsx(ServiceDirectionField, { ...props }),
4179
- bankEmpolee: (props) => jsx(BankEmpoleeField, { ...props }),
4180
- secondaryPhone: (props) => jsx(SecondaryPhoneField, { ...props }),
4181
- applicationDate: (props) => (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", ...props })),
4182
- region: (props) => getPremium(props?.params?.typeForm) ? (jsx(RegionPremiumField, { ...props })) : (jsx(RegionField, { ...props })),
4183
- consentToReceiveMaterials: (props) => jsx(ConsentField, { ...props }),
4184
- surname: (props) => jsx(SurnameField, { ...props }),
4185
- name: (props) => jsx(NameField, { ...props }),
4186
- middleName: (props) => jsx(MiddleNameField, { ...props }),
4187
- birthday: (props) => jsx(BirthdayField, { ...props }),
4188
- phone: (props) => jsx(PhoneField, { ...props }),
4189
- email: (props) => jsx(EmailField, { ...props }),
4190
- inn: (props) => jsx(InnField, { ...props }),
4191
- comment: (props) => jsx(CommentField, { ...props }),
4345
+ return (jsx(RadioButtonGroupControl, { label: "\u041F\u043E\u043B", orientation: "horizontal", items: SEX_TYPES, ...getValidation(field('sex'), validatorObj.sex, input?.required) }));
4346
+ });
4347
+
4348
+ const ShareholderFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u042F \u044F\u0432\u043B\u044F\u044E\u0441\u044C \u0430\u043A\u0446\u0438\u043E\u043D\u0435\u0440\u043E\u043C / \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u043E\u043C / \u0447\u043B\u0435\u043D\u043E\u043C / \u043F\u0430\u0439\u0449\u0438\u043A\u043E\u043C / \u0432\u043A\u043B\u0430\u0434\u0447\u0438\u043A\u043E\u043C \u0441 \u0434\u043E\u043B\u0435\u0439 \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0431\u043E\u043B\u0435\u0435 20% \u0443\u0441\u0442\u0430\u0432\u043D\u043E\u0433\u043E \u043A\u0430\u043F\u0438\u0442\u0430\u043B\u0430 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430", ...getValidation(field('shareholderFlg'), validatorObj.shareholderFlg, input?.required) })));
4349
+
4350
+ const SnilsInput = JSX(({ children, onChange, maxLength, ...inputProps }) => {
4351
+ const handleChange = useCallback((v) => maxLength
4352
+ ? v.length <= maxLength && onChange?.(normalizeWithMask(v, '___-___-___ __'))
4353
+ : onChange?.(normalizeWithMask(v, '___-___-___ __')), [onChange]);
4354
+ const handleBlur = useCallback((v) => {
4355
+ if (v === '___-___-___ __') {
4356
+ onChange && onChange('');
4357
+ }
4358
+ }, []);
4359
+ return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
4360
+ });
4361
+
4362
+ const InputSnilsControl = JSX(({ className, label, value, error, onChange, onBlur, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(SnilsInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur, placeholder: "___-___-___ __", ...rest }), renderErrorText(error)] })));
4363
+
4364
+ const SnilsField = JSX(({ field, input }) => (jsx(InputSnilsControl, { label: "\u0421\u041D\u0418\u041B\u0421", maxLength: 14, ...getValidation(field('snils'), validatorObj.snils, input?.required), ...input })));
4365
+
4366
+ const TotalIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('totalIncome'), validatorObj.totalIncome, input?.required), ...input })));
4367
+
4368
+ const WagesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('wages'), validatorObj.wages, input?.required), ...input })));
4369
+
4370
+ const InputsApplicationLeadMap = {
4371
+ limitedBirthday: (props) => jsx(LimitedBirthdayField, { ...props }),
4192
4372
  };
4193
- const InputsRetailMap = {
4373
+ const InputsConsentsMap = {
4194
4374
  processPersonalDataFlg: (props) => jsx(ConsentField, { ...props }),
4195
4375
  consentProviderFlg: (props) => jsx(ConsentField, { ...props }),
4196
4376
  consentOthersFlg: (props) => jsx(ConsentField, { ...props }),
4197
4377
  consentInformFlg: (props) => jsx(ConsentField, { ...props }),
4198
4378
  consentPfrFlg: (props) => jsx(ConsentField, { ...props }),
4379
+ };
4380
+ const InputsRetailMap = {
4381
+ organization: (props) => jsx(OrganizationField, { ...props }),
4382
+ organizationAddress: (props) => jsx(AddressField, { ...props }),
4199
4383
  organizationPhone: (props) => jsx(PhoneField, { ...props }),
4200
- legalForm: (props) => jsx(LegalFormField, { ...props }),
4201
4384
  organizationName: (props) => jsx(OrganizationNameField, { ...props }),
4385
+ legalForm: (props) => jsx(LegalFormField, { ...props }),
4202
4386
  generalSeniority: (props) => jsx(GeneralSeniorityField, { ...props }),
4203
4387
  lastJobExperience: (props) => jsx(LastJobExperienceField, { ...props }),
4204
4388
  experience5Years: (props) => jsx(Experience5YearsField, { ...props }),
4205
4389
  jobsNumber: (props) => jsx(JobsNumberField, { ...props }),
4206
4390
  beginDate: (props) => jsx(BeginDateField, { ...props }),
4207
4391
  addressFact: (props) => jsx(AddressFactField, { ...props }),
4208
- organizationAddress: (props) => jsx(AddressField, { ...props }),
4392
+ addressRegistration: (props) => jsx(AddressField, { ...props }),
4393
+ addressRetail: (props) => jsx(AddressRetailField, { ...props }),
4394
+ addressMatch: (props) => jsx(AddressMatchField, { ...props }),
4209
4395
  sex: (props) => jsx(SexField, { ...props }),
4210
4396
  limitedBirthday: (props) => jsx(LimitedBirthdayField, { ...props }),
4211
4397
  birthPlace: (props) => jsx(BirthPlaceField, { ...props }),
4212
4398
  education: (props) => jsx(EducationField, { ...props }),
4213
4399
  housing: (props) => jsx(HousingField, { ...props }),
4214
- employment: (props) => jsx(EmploymentField, { ...props }),
4215
- organization: (props) => jsx(OrganizationField, { ...props }),
4216
4400
  amountWorkers: (props) => jsx(AmountWorkersField, { ...props }),
4401
+ employment: (props) => jsx(EmploymentField, { ...props }),
4217
4402
  employerActivities: (props) => jsx(EmployerActivitiesField, { ...props }),
4218
4403
  employerOrganization: (props) => jsx(EmployerOrganizationField, { ...props }),
4219
4404
  positionOrganization: (props) => jsx(PositionOrganizationField, { ...props }),
4220
4405
  familyStatus: (props) => jsx(FamilyStatusField, { ...props }),
4221
- children: (props) => jsx(ChildrenField, { ...props }),
4222
4406
  familyMembers: (props) => jsx(FamilyMembersField, { ...props }),
4407
+ children: (props) => jsx(ChildrenField, { ...props }),
4223
4408
  dependents: (props) => jsx(DependentsField, { ...props }),
4224
4409
  totalIncome: (props) => jsx(TotalIncomeField, { ...props }),
4225
4410
  expenses: (props) => jsx(ExpensesField, { ...props }),
@@ -4231,8 +4416,6 @@
4231
4416
  dulIssueDateField: (props) => jsx(DulIssueDateField, { ...props }),
4232
4417
  dulSubdivisionCode: (props) => jsx(DulSubdivisionCodeField, { ...props }),
4233
4418
  dulIssuedBy: (props) => jsx(DulIssuedByField, { ...props }),
4234
- addressRegistration: (props) => jsx(AddressField, { ...props }),
4235
- addressCourier: (props) => jsx(AddressField, { ...props }),
4236
4419
  participantDateRegistration: (props) => (jsx(ParticipantDateRegistrationField, { ...props })),
4237
4420
  retirementIncome: (props) => jsx(RetirementIncomeField, { ...props }),
4238
4421
  otherIncome: (props) => jsx(OtherIncomeField, { ...props }),
@@ -4246,11 +4429,10 @@
4246
4429
  bankEmployeeCode: (props) => jsx(BankEmpoleeCodeField, { ...props }),
4247
4430
  partInBusiness: (props) => jsx(PartInBusinessField, { ...props }),
4248
4431
  regionRetail: (props) => jsx(RegionRetailField, { ...props }),
4249
- addressRetail: (props) => jsx(AddressRetailField, { ...props }),
4250
- addressMatch: (props) => jsx(AddressMatchField, { ...props }),
4251
4432
  calculator: (props) => jsx(CreditCalcField, { ...props }),
4252
4433
  };
4253
4434
  const InputRetailCardMap = {
4435
+ addressCourier: (props) => jsx(AddressField, { ...props }),
4254
4436
  paymentSystem: (props) => jsx(PaymentSystemField, { ...props }),
4255
4437
  currency: (props) => jsx(CurrencyField, { ...props }),
4256
4438
  cardCategory: (props) => jsx(CardCategoryField, { ...props }),
@@ -4259,153 +4441,6 @@
4259
4441
  methodObtain: (props) => jsx(MethodObtainField, { ...props }),
4260
4442
  deliveryDate: (props) => jsx(DeliveryDateFiels, { ...props }),
4261
4443
  };
4262
- const getField = (field, params) => (input, i) => {
4263
- const resultInputsMap = {
4264
- ...InputsMap,
4265
- ...InputsRetailMap,
4266
- ...InputRetailCardMap,
4267
- };
4268
- return isRenderField({ input, field }) ? (jsx("div", { children: resultInputsMap[input?.name || '']?.({ field, input, params }) }, String(i))) : null;
4269
- };
4270
-
4271
- const inputColumnStyles = (column) => column === 2 ? '@xl:grid-cols-2' : '';
4272
-
4273
- const renderTitle = (title) => title ? (jsx("div", { className: "@xl:text-center @xl:col-span-2 mb-m", children: jsx(Text, { size: "text-h6", children: title }) })) : null;
4274
-
4275
- const ResponseTypeDialog = JSX(({ responseType, typeForm, onClose }) => {
4276
- const responseOK = responseType === 'OK';
4277
- const statusIcon = responseOK ? 'ResponseOKIcon' : 'ResponseFailIcon';
4278
- const responseOKDescription = typeForm === 'ANTIFRAUD'
4279
- ? `Сообщение отправлено. Для уточнения информации с Вами могут связаться работники Банка либо Вы
4280
- можете самостоятельно позвонить по номеру контакт-центра +78001000100. Будьте внимательны, работники Банка
4281
- не звонят с использованием мессенджеров.`
4282
- : 'Совсем скоро мы с вами свяжемся';
4283
- return (jsx(Dialog, { className: "my-6xl max-w-lg w-full min-h-fit mx-auto", onClose: onClose, children: jsxs("div", { className: "flex flex-col gap-lg items-center rounded-md space-x-m", children: [jsx(Img, { image: { icon: statusIcon, iconVersion: 'normal' }, width: "136", height: "136" }), jsx(Headline, { className: "w-full", title: responseOK ? 'Ваша заявка отправлена' : 'Не удалось отправить заявку', description: responseOK ? responseOKDescription : 'Пожалуйста, повторите позднее', headlineVersion: "XS", isEmbedded: true }), jsx(Button, { type: "button", onClick: onClose, children: "\u0425\u043E\u0440\u043E\u0448\u043E" })] }) }));
4284
- });
4285
-
4286
- const objectValidator = (validatorsMap) => (o) => (o &&
4287
- Object.entries(validatorsMap).flatMap(([key, validator]) => validator(o[key]))) ||
4288
- [];
4289
-
4290
- const getPartnerComments = (data) => {
4291
- const { acquiringType, onlineCheckout = false, posTerminal = false, term, amount, annualRevenue, } = data;
4292
- if (acquiringType) {
4293
- return `Вид эквайринга=${acquiringType?.text || ''}${isAcquiringTrade(acquiringType?.key)
4294
- ? `/Онлайн касса=${onlineCheckout}/POS-терминал=${posTerminal}`
4295
- : '/Онлайн касса=false/POS-терминал=false'}`;
4296
- }
4297
- else {
4298
- return `Сумма=${amount}/Срок=${term}/Выручка=${annualRevenue}`;
4299
- }
4300
- };
4301
-
4302
- /* eslint-disable @typescript-eslint/no-unused-vars */
4303
- const getFormatData = (data) => {
4304
- const { acquiringType, onlineCheckout, posTerminal, amount, term, annualRevenue, serviceType, vedTypes, region, ...usedData } = data;
4305
- const partnerComments = acquiringType || annualRevenue ? getPartnerComments(data) : null;
4306
- const formatData = {
4307
- ...usedData,
4308
- ...getVedTypes(vedTypes),
4309
- ...getRegion(region),
4310
- ...(partnerComments ? { partnerComments } : {}),
4311
- ...(serviceType ? { typeForm: serviceType } : {}),
4312
- };
4313
- return Object.fromEntries(Object.entries(formatData)?.map(([k, v]) => [k, v?.key || v]));
4314
- };
4315
- const getRegion = (region) => region?.key || region?.text ? { region: region?.text || region?.key } : {};
4316
- const getVedTypes = (vedTypes) => vedTypes
4317
- ? {
4318
- vedTypes: Object.fromEntries(VED_TYPES.map(({ id }) => [id, id === vedTypes])),
4319
- }
4320
- : {};
4321
-
4322
- const initialFormState$1 = {
4323
- typeForm: '',
4324
- region: { key: '', text: '' },
4325
- addressBranch: { key: '', text: '' },
4326
- surname: '',
4327
- name: '',
4328
- phone: '',
4329
- secondaryPhone: '',
4330
- comment: '',
4331
- product: '',
4332
- partnerComments: '',
4333
- annualRevenue: '',
4334
- term: 12,
4335
- amount: 100000,
4336
- acquiringType: ACQUIRING_TYPES[0],
4337
- serviceType: SERVICE_TYPES[0],
4338
- feedbackMethod: FEEDBACK_METHOD[0],
4339
- serviceDirection: SERVICE_DIRECTIONS[0],
4340
- vedTypes: VED_TYPES[0],
4341
- birthday: undefined,
4342
- isClient: false,
4343
- onlineCheckout: false,
4344
- posTerminal: false,
4345
- consentToReceiveMaterials: false,
4346
- consentDataProcessing: false,
4347
- addressRetail: { key: '', text: '' },
4348
- };
4349
- const getInitialFormState$3 = (inputs, typeForm = '') => {
4350
- const formState = Object.fromEntries(inputs.map((_) => [
4351
- _.name,
4352
- (_.fieldType === 'ved' && _?.defaultValue) || initialFormState$1[_.name || ''],
4353
- ]));
4354
- return { ...formState, typeForm: { key: typeForm, text: '' } };
4355
- };
4356
-
4357
- const Footnote = JSX(({ text, link }) => (jsxs(Paragraph, { size: "text-l", font: "font-light", color: "text-secondary-text", children: [text ? jsx(Text, { children: text }) : null, link ? (jsx(LinkButton, { href: link.href, ariaLabel: "\u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043D\u043D\u044B\u0445", target: link.target || '', className: "!text-left text-primary-main", children: jsx(Text, { children: link.text }) })) : null] })));
4358
-
4359
- const renderSubmitButton$1 = (button, className) => (jsx(Button, { className: style('w-full @xl:w-auto', className), type: "submit", children: button?.text ? button.text : 'Отправить заявку' }));
4360
-
4361
- const agreementText = 'Нажимая кнопку, вы подтверждаете согласие с ';
4362
- const renderAgreementSubmit = (consentDataProcessing, link, button) => (jsxs("div", { className: "flex col-span-2 gap-xs flex-col w-full items-baseline", children: [consentDataProcessing ? (jsxs("div", { children: [jsxs("div", { className: "flex gap-3 items-center", children: [jsx(Checkbox, { ...consentDataProcessing }), jsx(Footnote, { link: link })] }), renderErrorText(withValidator(consentDataProcessing, agreementValidator).error)] })) : (jsx(Footnote, { text: agreementText, link: link })), renderSubmitButton$1(button)] }));
4363
-
4364
- const renderContacts = () => (jsxs("div", { className: "space-y-m", children: [jsx(Heading, { headingType: "h6", title: "\u0418\u043B\u0438 \u0441\u0432\u044F\u0436\u0438\u0442\u0435\u0441\u044C \u0441 \u043D\u0430\u043C\u0438 \u0443\u0434\u043E\u0431\u043D\u044B\u043C \u0441\u043F\u043E\u0441\u043E\u0431\u043E\u043C", className: "@xl:text-center" }), jsxs("div", { className: "flex sm:justify-center gap-xl", children: [jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", href: `tel:8 (800) 200-78-70`, "aria-label": "\u0442\u0435\u043B\u0435\u0444\u043E\u043D 8 (800) 200-78-70", children: [jsx(Img, { image: { icon: 'PhoneIcon' }, width: "24", height: "24" }), jsx("span", { children: "8 (800) 200-78-70" })] }), jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", "aria-label": "\u043F\u043E\u0447\u0442\u0430 ved@rshb.ru", href: `mailto:ved@rshb.ru`, children: [jsx(Img, { image: { icon: 'MailIcon' }, width: "24", height: "24" }), jsx("span", { children: "ved@rshb.ru" })] })] })] }));
4365
-
4366
- const API = LeadServiceAPI();
4367
- const ApplicationForm = JSX(
4368
- // eslint-disable-next-line max-lines-per-function
4369
- ({ className, title, typeForm = '', sections = [], button, link, endpoint, additionalParams, isContacts, data, ...rest }) => {
4370
- const inputs = (sections?.flatMap((_) => _?.inputs) || []);
4371
- const initialFormState = getInitialFormState$3(inputs, typeForm);
4372
- const [responseType, setResponseType] = useState('');
4373
- const responseTypeDialog = useDialog(ResponseTypeDialog);
4374
- const handleSubmit = useCallback(async (formData, ev) => {
4375
- const inputsFiltered = getFilteredInputs(inputs, formData);
4376
- const feedbackValidator = objectValidator(getObjectValidator(inputsFiltered));
4377
- if (!isValidationSuccess(feedbackValidator(formData))) {
4378
- return console.warn('validation fail');
4379
- }
4380
- const formatData = getFormatData({ ...formData, ...additionalParams });
4381
- const status = (await API.send(formatData, endpoint === 'lead')) ? 'OK' : 'Fail';
4382
- setResponseType(status);
4383
- if (status) {
4384
- responseTypeDialog.open({ typeForm, responseType: status });
4385
- }
4386
- if (status === 'OK' && data) {
4387
- const aspects = useAspects();
4388
- handleAspects({ aspectsAttributes: data, aspects, ev });
4389
- }
4390
- return status;
4391
- }, [typeForm]);
4392
- const [, { field, onSubmit, reset }] = useForm(initialFormState, { onSubmit: handleSubmit });
4393
- const fieldName = getConsentDataProcessing(inputs)?.name;
4394
- useEffect(() => {
4395
- if (responseType === 'OK') {
4396
- setResponseType('');
4397
- reset();
4398
- }
4399
- }, [responseType]);
4400
- return (jsxs(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: [jsxs("form", { onSubmit: onSubmit, children: [sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), (_?.inputs || [])?.map(getField(field, { typeForm }))] }, `section-${i}`))), renderAgreementSubmit(fieldName ? field('consentDataProcessing') : undefined, link, button)] }), isContacts ? renderContacts() : null] }));
4401
- });
4402
- const getFilteredInputs = (inputs, data) => inputs
4403
- .filter((_) => (_?.name === 'secondaryPhone' ? Boolean(data.secondaryPhone) : _))
4404
- .filter((input) => !input?.condition ||
4405
- input?.condition.values.find((_) => {
4406
- const dataValue = data?.[input?.condition?.name ?? ''];
4407
- return _ === (dataValue?.key ?? dataValue);
4408
- }));
4409
4444
 
4410
4445
  const CONSENT_ALL_DOCS_TEXT = 'Согласие на все документы';
4411
4446
  const CONSENT_REQUIRED = 'Отметьте все обязательные соглашения';
@@ -4420,42 +4455,19 @@
4420
4455
  const hasValidationErrors = useMemo(() => inputs
4421
4456
  ?.filter((_) => _.required)
4422
4457
  ?.some((_) => Boolean(withValidator(field(_?.name), validatorObj[_?.name]).error)), [inputs]);
4423
- return (jsx("div", { className: "w-fit", children: jsx(Foldable, { isFoldButtonOnTop: true, unfoldedByDefault: true, renderFoldableSection: ({ isUnfolded }) => (jsx(FoldableSection, { isUnfolded: isUnfolded, className: "flex flex-col pl-2xl", children: inputs.map(getField(field, { typeForm })) })), renderFoldButton: renderGeneralCheckbox(jsxs("div", { children: [jsx(Checkbox, { value: isChecked, onChange: handleGeneralToggle, text: CONSENT_ALL_DOCS_TEXT }, key), renderErrorText(hasValidationErrors ? CONSENT_REQUIRED : '')] })) }) }));
4458
+ return (jsx("div", { className: "w-fit", children: jsx(Foldable, { isFoldButtonOnTop: true, unfoldedByDefault: true, renderFoldableSection: ({ isUnfolded }) => (jsx(FoldableSection, { isUnfolded: isUnfolded, className: "flex flex-col pl-2xl", children: inputs.map(getField(field, { typeForm }, InputsConsentsMap)) })), renderFoldButton: renderGeneralCheckbox(jsxs("div", { children: [jsx(Checkbox, { value: isChecked, onChange: handleGeneralToggle, text: CONSENT_ALL_DOCS_TEXT }, key), renderErrorText(hasValidationErrors ? CONSENT_REQUIRED : '')] })) }) }));
4424
4459
  });
4425
4460
  const renderGeneralCheckbox = (generalCheckBox) => (foldableData) => (jsxs("div", { className: "flex items-start", children: [generalCheckBox, jsx("button", { onClick: foldableData.onToggle, className: "px-m py-2xs", type: "button", children: jsx(Icon, { className: "text-primary-text", name: foldableData.isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', width: "16", height: "16" }) })] }));
4426
4461
 
4427
4462
  const renderInputs$2 = ({ field, typeForm = '', inputs }) => {
4428
4463
  const { consentInputs, restInputs } = splitInputs(inputs || []);
4429
- return consentInputs.length > 2 ? (jsxs("div", { children: [restInputs.map(getField(field, { typeForm })), jsx(GroupedConsents, { inputs: consentInputs, field: field })] })) : ((inputs || [])?.map(getField(field, { typeForm })));
4464
+ return consentInputs.length > 2 ? (jsxs("div", { children: [restInputs.map(getField(field, { typeForm }, { ...InputsApplicationLeadMap })), jsx(GroupedConsents, { inputs: consentInputs, field: field })] })) : ((inputs || [])?.map(getField(field, { typeForm }, { ...InputsApplicationLeadMap })));
4430
4465
  };
4431
4466
  const splitInputs = (inputs) => ({
4432
4467
  consentInputs: inputs?.filter((_) => Object.keys(CONSENTS).includes(_.name || '')) || [],
4433
4468
  restInputs: inputs?.filter((_) => !Object.keys(CONSENTS).includes(_.name || '')) || [],
4434
4469
  });
4435
4470
 
4436
- const applicationFormData = [
4437
- {
4438
- columns: 2,
4439
- inputs: [
4440
- { fieldType: 'common', name: 'surname', required: true, dadata: true },
4441
- { fieldType: 'common', name: 'name', required: true, dadata: true },
4442
- { fieldType: 'common', name: 'middleName', dadata: true },
4443
- { fieldType: 'common', name: 'limitedBirthday', required: true },
4444
- { fieldType: 'common', name: 'phone', required: true },
4445
- { fieldType: 'common', name: 'email', required: true, dadata: true },
4446
- ],
4447
- },
4448
- {
4449
- inputs: [
4450
- { fieldType: 'common', name: 'processPersonalDataFlg', required: true },
4451
- { fieldType: 'common', name: 'consentProviderFlg', required: true },
4452
- { fieldType: 'common', name: 'consentOthersFlg', required: true },
4453
- { fieldType: 'common', name: 'consentInformFlg' },
4454
- { fieldType: 'common', name: 'consentPfrFlg' },
4455
- ],
4456
- },
4457
- ];
4458
-
4459
4471
  const renderSubmitButton = (button, isSending) => (jsx(Button, { className: style('w-full @xl:w-auto'), type: "submit", isLoading: isSending, children: button?.text ? button.text : 'Отправить заявку' }));
4460
4472
 
4461
4473
  const createDraftTask = async (body) => {
@@ -4844,7 +4856,7 @@
4844
4856
  }, []);
4845
4857
 
4846
4858
  const getFamilyStatusAndIncomeData = (formData) => {
4847
- const { familyStatus, dependents, familyMembers, children, confirmationIncome, wages, mandatoryPayments, additionalIncome, otherIncome, otherPayments, rentalIncome, retirementIncome, snils, armyIdFlg, conscription, } = formData;
4859
+ const { familyStatus, familyMembers, dependents, children, confirmationIncome, wages, mandatoryPayments, additionalIncome, otherIncome, otherPayments, rentalIncome, retirementIncome, snils, armyIdFlg, conscription, } = formData;
4848
4860
  return {
4849
4861
  maritalStatusCd: familyStatus,
4850
4862
  totalDependents: familyMembers,
@@ -5279,12 +5291,10 @@
5279
5291
  feedbackMethod: FEEDBACK_METHOD[0],
5280
5292
  serviceDirection: SERVICE_DIRECTIONS[0],
5281
5293
  vedTypes: VED_TYPES[0],
5282
- birthday: undefined,
5283
5294
  limitedBirthday: undefined,
5284
5295
  isClient: false,
5285
5296
  onlineCheckout: false,
5286
5297
  posTerminal: false,
5287
- consentToReceiveMaterials: false,
5288
5298
  consentDataProcessing: false,
5289
5299
  processPersonalDataFlg: false,
5290
5300
  consentProviderFlg: false,
@@ -6964,32 +6974,32 @@
6964
6974
  return statusesMap[status] || jsx(ReworkStatusContent$1, {});
6965
6975
  };
6966
6976
 
6967
- const calculateInputs$1 = (getValue) => (inputs, step) => inputs
6977
+ const calculateInputs = (getValue) => (inputs, step) => inputs
6968
6978
  .filter((_) => _)
6969
6979
  .map((_) => {
6970
6980
  if ([
6971
- checkIsRetiree$1(step, getValue),
6972
- checkBusinessOwner$1(_, getValue),
6973
- checkConsentPfrFlg$1(_, getValue),
6974
- checkAddressFillFromESIA$1(_, getValue),
6975
- checkAddressFact$1(_, getValue),
6976
- checkCondition$1(_, getValue),
6981
+ checkIsRetiree(step, getValue),
6982
+ checkBusinessOwner(_, getValue),
6983
+ checkConsentPfrFlg(_, getValue),
6984
+ checkAddressFillFromESIA(_, getValue),
6985
+ checkAddressFact(_, getValue),
6986
+ checkCondition(_, getValue),
6977
6987
  ].some(Boolean)) {
6978
6988
  return { ..._, required: false };
6979
6989
  }
6980
6990
  return _;
6981
6991
  });
6982
- const checkIsRetiree$1 = (step, getValue) => step === 2 && getValue('employment')?.key === 'RETIREE';
6983
- const checkBusinessOwner$1 = ({ name }, getValue) => name === 'partInBusiness' && getValue('positionOrganization')?.key !== 'BUSINESS_OWNER';
6984
- const checkAddressFillFromESIA$1 = ({ name, filledByEsia }, getValue) => name?.startsWith('address') && getValue('esiaAccountTypeCd')?.key && filledByEsia;
6985
- const checkAddressFact$1 = ({ name }, getValue) => name === 'addressFact' && getValue('addressMatch');
6986
- const checkCondition$1 = ({ condition }, getValue) => condition?.name &&
6992
+ const checkIsRetiree = (step, getValue) => step === 2 && getValue('employment')?.key === 'RETIREE';
6993
+ const checkBusinessOwner = ({ name }, getValue) => name === 'partInBusiness' && getValue('positionOrganization')?.key !== 'BUSINESS_OWNER';
6994
+ const checkAddressFillFromESIA = ({ name, filledByEsia }, getValue) => name?.startsWith('address') && getValue('esiaAccountTypeCd')?.key && filledByEsia;
6995
+ const checkAddressFact = ({ name }, getValue) => name === 'addressFact' && getValue('addressMatch');
6996
+ const checkCondition = ({ condition }, getValue) => condition?.name &&
6987
6997
  condition?.values?.some((_) => {
6988
6998
  const dataValue = getValue(condition?.name);
6989
6999
  return _ !== (dataValue?.key ?? dataValue);
6990
7000
  });
6991
- const checkConsentPfrFlg$1 = ({ name }, getValue) => name === 'snils' && isSnilsRequired$1(getValue);
6992
- const isSnilsRequired$1 = (getValue) => getValue('confirmationIncome')?.key !== 'PFR_CERTIFICATE';
7001
+ const checkConsentPfrFlg = ({ name }, getValue) => name === 'snils' && isSnilsRequired(getValue);
7002
+ const isSnilsRequired = (getValue) => getValue('confirmationIncome')?.key !== 'PFR_CERTIFICATE';
6993
7003
 
6994
7004
  const renderInfo$2 = (inputs = []) => {
6995
7005
  const infoInputs = inputs.filter((_) => _.fieldType === 'info');
@@ -6998,11 +7008,11 @@
6998
7008
  : null;
6999
7009
  };
7000
7010
 
7001
- const renderInputs$1 = ({ field, inputs, params }) => inputs.map(getField(field, params));
7011
+ const renderInputs$1 = ({ field, inputs, params }) => inputs.map(getField(field, params, { ...InputsRetailMap, ...InputRetailCardMap }));
7002
7012
 
7003
7013
  const renderStep$2 = ({ sections, field, step, params }) => sections?.map(({ inputs: origInputs = [], columns, title }, i) => {
7004
- const inputs = calculateInputs$1(getValue$3(field))(origInputs, step);
7005
- const filteredInputs = inputs.filter((_) => !checkCondition$1(_, getValue$3(field)));
7014
+ const inputs = calculateInputs(getValue$3(field))(origInputs, step);
7015
+ const filteredInputs = inputs.filter((_) => !checkCondition(_, getValue$3(field)));
7006
7016
  return (jsxs("div", { className: style(inputColumnStyles(columns), 'grid gap-x-m'), children: [renderInfo$2(filteredInputs), renderTitle(title), renderInputs$1({ field, inputs, params })] }, `section-${i}`));
7007
7017
  });
7008
7018
  const getValue$3 = (field) => (name) => field(name)?.value;
@@ -7230,8 +7240,8 @@
7230
7240
  },
7231
7241
  {
7232
7242
  familyStatus: { key: '', text: '' },
7233
- dependents: undefined,
7234
7243
  familyMembers: undefined,
7244
+ dependents: undefined,
7235
7245
  confirmationIncome: { key: '', text: '' },
7236
7246
  wages: undefined,
7237
7247
  mandatoryPayments: undefined,
@@ -7295,7 +7305,7 @@
7295
7305
  }
7296
7306
  }, [isFinalStep, initialState]);
7297
7307
  const handleSubmit = useCallback(async (formData) => {
7298
- const feedbackValidator = objectValidator(getObjectValidator(calculateInputs$1(getValue$2(formData))(inputs, step)));
7308
+ const feedbackValidator = objectValidator(getObjectValidator(calculateInputs(getValue$2(formData))(inputs, step)));
7299
7309
  if (!isValidationSuccess(feedbackValidator(formData))) {
7300
7310
  return;
7301
7311
  }
@@ -7894,33 +7904,6 @@
7894
7904
  return statusesMap[status] || jsx(ReworkStatusContent, {});
7895
7905
  };
7896
7906
 
7897
- const calculateInputs = (getValue) => (inputs, step) => inputs
7898
- .filter((_) => _)
7899
- .map((_) => {
7900
- if ([
7901
- checkIsRetiree(step, getValue),
7902
- checkBusinessOwner(_, getValue),
7903
- checkConsentPfrFlg(_, getValue),
7904
- checkAddressFillFromESIA(_, getValue),
7905
- checkAddressFact(_, getValue),
7906
- checkCondition(_, getValue),
7907
- ].some(Boolean)) {
7908
- return { ..._, required: false };
7909
- }
7910
- return _;
7911
- });
7912
- const checkIsRetiree = (step, getValue) => step === 2 && getValue('employment')?.key === 'RETIREE';
7913
- const checkBusinessOwner = ({ name }, getValue) => name === 'partInBusiness' && getValue('positionOrganization')?.key !== 'BUSINESS_OWNER';
7914
- const checkAddressFillFromESIA = ({ name, filledByEsia }, getValue) => name?.startsWith('address') && getValue('esiaAccountTypeCd')?.key && filledByEsia;
7915
- const checkAddressFact = ({ name }, getValue) => name === 'addressFact' && getValue('addressMatch');
7916
- const checkCondition = ({ condition }, getValue) => condition?.name &&
7917
- condition?.values?.some((_) => {
7918
- const dataValue = getValue(condition?.name);
7919
- return _ !== (dataValue?.key ?? dataValue);
7920
- });
7921
- const checkConsentPfrFlg = ({ name }, getValue) => name === 'snils' && isSnilsRequired(getValue);
7922
- const isSnilsRequired = (getValue) => getValue('confirmationIncome')?.key !== 'PFR_CERTIFICATE';
7923
-
7924
7907
  const renderInfo$1 = (inputs = []) => {
7925
7908
  const infoInputs = inputs.filter((_) => _.fieldType === 'info');
7926
7909
  return infoInputs.length
@@ -7928,7 +7911,7 @@
7928
7911
  : null;
7929
7912
  };
7930
7913
 
7931
- const renderInputs = ({ field, inputs, params }) => inputs.map(getField(field, params));
7914
+ const renderInputs = ({ field, inputs, params }) => inputs.map(getField(field, params, { ...InputsRetailMap }));
7932
7915
 
7933
7916
  const renderStep$1 = ({ sections, field, step, params }) => sections?.map(({ inputs: origInputs = [], columns, title }, i) => {
7934
7917
  const inputs = calculateInputs(getValue$1(field))(origInputs, step);
@@ -10495,7 +10478,7 @@
10495
10478
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
10496
10479
  });
10497
10480
 
10498
- const packageVersion = "0.14.723";
10481
+ const packageVersion = "0.14.725";
10499
10482
 
10500
10483
  exports.Blocks = Blocks;
10501
10484
  exports.ContentPage = ContentPage;