@redneckz/wildless-cms-uni-blocks 0.14.725 → 0.14.727

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