@redneckz/wildless-cms-uni-blocks 0.14.683 → 0.14.684

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 (515) hide show
  1. package/bundle/api/RetailAPI/updateUserTask.d.ts +5 -4
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +696 -653
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +13 -7
  6. package/bundle/components/CalculatorCredit/CalculatorCredit.d.ts +2 -3
  7. package/bundle/components/CalculatorCredit/defaultValueAdapter.d.ts +11 -0
  8. package/bundle/components/CreditCardForm/CreditCardFormStatus.d.ts +1 -0
  9. package/bundle/components/CreditCardForm/PendingStatusContent.d.ts +3 -1
  10. package/bundle/components/CreditCardForm/renderInputs.d.ts +2 -1
  11. package/bundle/components/CreditCardForm/renderStep.d.ts +2 -2
  12. package/bundle/components/CreditForm/CreditForm.d.ts +5 -2
  13. package/bundle/components/CreditForm/CreditFormContent.d.ts +4 -5
  14. package/bundle/components/CreditForm/CreditFormStep.d.ts +2 -3
  15. package/bundle/components/CreditForm/ProgramsSourceProps.d.ts +16 -0
  16. package/bundle/components/CreditForm/getCalcData.d.ts +3 -0
  17. package/bundle/components/CreditForm/getZeroStepData.d.ts +1 -1
  18. package/bundle/components/CreditForm/renderInputs.d.ts +2 -1
  19. package/bundle/components/CreditForm/renderStep.d.ts +2 -2
  20. package/bundle/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  21. package/bundle/components/OfficesAtmsMap/filterItems.d.ts +2 -0
  22. package/bundle/ui-kit/FormField/CustomFieldProps.d.ts +1 -0
  23. package/bundle/ui-kit/FormField/Fields/CreditCalcField.d.ts +2 -0
  24. package/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  25. package/bundle/ui-kit/FormField/getField.d.ts +1 -1
  26. package/dist/api/RetailAPI/getCardTypes.js +1 -1
  27. package/dist/api/RetailAPI/getCardTypes.js.map +1 -1
  28. package/dist/api/RetailAPI/updateUserTask.d.ts +5 -4
  29. package/dist/api/RetailAPI/updateUserTask.js +1 -1
  30. package/dist/api/RetailAPI/updateUserTask.js.map +1 -1
  31. package/dist/components/ApplicationForm/ApplicationForm.js +1 -1
  32. package/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  33. package/dist/components/ApplicationForm/renderInputs.js +1 -1
  34. package/dist/components/ApplicationForm/renderInputs.js.map +1 -1
  35. package/dist/components/ApplicationLeadForm/GroupedConsents.js +1 -1
  36. package/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  37. package/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +13 -7
  38. package/dist/components/ApplicationLeadForm/getInitialFormState.js +0 -1
  39. package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  40. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +4 -2
  41. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  42. package/dist/components/CalculatorCredit/CalculatorCredit.d.ts +2 -3
  43. package/dist/components/CalculatorCredit/CalculatorCredit.js +5 -3
  44. package/dist/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
  45. package/dist/components/CalculatorCredit/defaultValueAdapter.d.ts +11 -0
  46. package/dist/components/CalculatorCredit/defaultValueAdapter.js +18 -0
  47. package/dist/components/CalculatorCredit/defaultValueAdapter.js.map +1 -0
  48. package/dist/components/CreditCardForm/CreditCardForm.js +4 -4
  49. package/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
  50. package/dist/components/CreditCardForm/CreditCardFormStatus.d.ts +1 -0
  51. package/dist/components/CreditCardForm/CreditCardFormStatus.js +3 -1
  52. package/dist/components/CreditCardForm/CreditCardFormStatus.js.map +1 -1
  53. package/dist/components/CreditCardForm/CreditCardFormStatusTracker.js +14 -12
  54. package/dist/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
  55. package/dist/components/CreditCardForm/CreditCardFormStep.js +2 -14
  56. package/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  57. package/dist/components/CreditCardForm/PendingStatusContent.d.ts +3 -1
  58. package/dist/components/CreditCardForm/PendingStatusContent.js +2 -2
  59. package/dist/components/CreditCardForm/PendingStatusContent.js.map +1 -1
  60. package/dist/components/CreditCardForm/renderInputs.d.ts +2 -1
  61. package/dist/components/CreditCardForm/renderInputs.js +1 -1
  62. package/dist/components/CreditCardForm/renderInputs.js.map +1 -1
  63. package/dist/components/CreditCardForm/renderStep.d.ts +2 -2
  64. package/dist/components/CreditCardForm/renderStep.js +2 -2
  65. package/dist/components/CreditCardForm/renderStep.js.map +1 -1
  66. package/dist/components/CreditForm/CreditForm.d.ts +5 -2
  67. package/dist/components/CreditForm/CreditForm.js +6 -20
  68. package/dist/components/CreditForm/CreditForm.js.map +1 -1
  69. package/dist/components/CreditForm/CreditFormContent.d.ts +4 -5
  70. package/dist/components/CreditForm/CreditFormStatusTracker.js +10 -10
  71. package/dist/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
  72. package/dist/components/CreditForm/CreditFormStep.d.ts +2 -3
  73. package/dist/components/CreditForm/CreditFormStep.js +5 -10
  74. package/dist/components/CreditForm/CreditFormStep.js.map +1 -1
  75. package/dist/components/CreditForm/ProgramsSourceProps.d.ts +16 -0
  76. package/dist/components/CreditForm/ProgramsSourceProps.js +2 -0
  77. package/dist/components/CreditForm/ProgramsSourceProps.js.map +1 -0
  78. package/dist/components/CreditForm/creditFormStepsData.js +9 -1
  79. package/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  80. package/dist/components/CreditForm/formStateMap.js +9 -7
  81. package/dist/components/CreditForm/formStateMap.js.map +1 -1
  82. package/dist/components/CreditForm/getCalcData.d.ts +3 -0
  83. package/dist/components/CreditForm/getCalcData.js +16 -0
  84. package/dist/components/CreditForm/getCalcData.js.map +1 -0
  85. package/dist/components/CreditForm/getCreditFormTaskData.js +3 -2
  86. package/dist/components/CreditForm/getCreditFormTaskData.js.map +1 -1
  87. package/dist/components/CreditForm/getSecondStepData.js +0 -1
  88. package/dist/components/CreditForm/getSecondStepData.js.map +1 -1
  89. package/dist/components/CreditForm/getZeroStepData.d.ts +1 -1
  90. package/dist/components/CreditForm/getZeroStepData.js +3 -8
  91. package/dist/components/CreditForm/getZeroStepData.js.map +1 -1
  92. package/dist/components/CreditForm/renderInputs.d.ts +2 -1
  93. package/dist/components/CreditForm/renderInputs.js +1 -1
  94. package/dist/components/CreditForm/renderInputs.js.map +1 -1
  95. package/dist/components/CreditForm/renderStep.d.ts +2 -2
  96. package/dist/components/CreditForm/renderStep.js +2 -2
  97. package/dist/components/CreditForm/renderStep.js.map +1 -1
  98. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  99. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +1 -6
  100. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  101. package/dist/components/OfficesAtmsMap/filterItems.d.ts +2 -0
  102. package/dist/components/OfficesAtmsMap/filterItems.js +9 -0
  103. package/dist/components/OfficesAtmsMap/filterItems.js.map +1 -0
  104. package/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js +3 -3
  105. package/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -1
  106. package/dist/hooks/useJSONRef/useJSONRef.js +13 -3
  107. package/dist/hooks/useJSONRef/useJSONRef.js.map +1 -1
  108. package/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +14 -9
  109. package/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
  110. package/dist/ui-kit/FormField/CustomFieldProps.d.ts +1 -0
  111. package/dist/ui-kit/FormField/Fields/CreditCalcField.d.ts +2 -0
  112. package/dist/ui-kit/FormField/Fields/CreditCalcField.js +15 -0
  113. package/dist/ui-kit/FormField/Fields/CreditCalcField.js.map +1 -0
  114. package/dist/ui-kit/FormField/Fields/RegionField.js +3 -1
  115. package/dist/ui-kit/FormField/Fields/RegionField.js.map +1 -1
  116. package/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  117. package/dist/ui-kit/FormField/SelectField.js +4 -6
  118. package/dist/ui-kit/FormField/SelectField.js.map +1 -1
  119. package/dist/ui-kit/FormField/getField.d.ts +1 -1
  120. package/dist/ui-kit/FormField/getField.js +5 -4
  121. package/dist/ui-kit/FormField/getField.js.map +1 -1
  122. package/lib/api/RetailAPI/getCardTypes.js +1 -1
  123. package/lib/api/RetailAPI/getCardTypes.js.map +1 -1
  124. package/lib/api/RetailAPI/updateUserTask.d.ts +5 -4
  125. package/lib/api/RetailAPI/updateUserTask.js +2 -2
  126. package/lib/api/RetailAPI/updateUserTask.js.map +1 -1
  127. package/lib/components/ApplicationForm/ApplicationForm.js +1 -1
  128. package/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  129. package/lib/components/ApplicationForm/renderInputs.js +1 -1
  130. package/lib/components/ApplicationForm/renderInputs.js.map +1 -1
  131. package/lib/components/ApplicationLeadForm/GroupedConsents.js +1 -1
  132. package/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  133. package/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +13 -7
  134. package/lib/components/ApplicationLeadForm/getInitialFormState.js +0 -1
  135. package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  136. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +4 -2
  137. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  138. package/lib/components/CalculatorCredit/CalculatorCredit.d.ts +2 -3
  139. package/lib/components/CalculatorCredit/CalculatorCredit.js +5 -3
  140. package/lib/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
  141. package/lib/components/CalculatorCredit/defaultValueAdapter.d.ts +11 -0
  142. package/lib/components/CalculatorCredit/defaultValueAdapter.js +15 -0
  143. package/lib/components/CalculatorCredit/defaultValueAdapter.js.map +1 -0
  144. package/lib/components/CreditCardForm/CreditCardForm.js +4 -4
  145. package/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
  146. package/lib/components/CreditCardForm/CreditCardFormStatus.d.ts +1 -0
  147. package/lib/components/CreditCardForm/CreditCardFormStatus.js +3 -1
  148. package/lib/components/CreditCardForm/CreditCardFormStatus.js.map +1 -1
  149. package/lib/components/CreditCardForm/CreditCardFormStatusTracker.js +14 -12
  150. package/lib/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
  151. package/lib/components/CreditCardForm/CreditCardFormStep.js +2 -14
  152. package/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  153. package/lib/components/CreditCardForm/PendingStatusContent.d.ts +3 -1
  154. package/lib/components/CreditCardForm/PendingStatusContent.js +2 -2
  155. package/lib/components/CreditCardForm/PendingStatusContent.js.map +1 -1
  156. package/lib/components/CreditCardForm/renderInputs.d.ts +2 -1
  157. package/lib/components/CreditCardForm/renderInputs.js +1 -1
  158. package/lib/components/CreditCardForm/renderInputs.js.map +1 -1
  159. package/lib/components/CreditCardForm/renderStep.d.ts +2 -2
  160. package/lib/components/CreditCardForm/renderStep.js +2 -2
  161. package/lib/components/CreditCardForm/renderStep.js.map +1 -1
  162. package/lib/components/CreditForm/CreditForm.d.ts +5 -2
  163. package/lib/components/CreditForm/CreditForm.js +6 -20
  164. package/lib/components/CreditForm/CreditForm.js.map +1 -1
  165. package/lib/components/CreditForm/CreditFormContent.d.ts +4 -5
  166. package/lib/components/CreditForm/CreditFormStatusTracker.js +11 -11
  167. package/lib/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
  168. package/lib/components/CreditForm/CreditFormStep.d.ts +2 -3
  169. package/lib/components/CreditForm/CreditFormStep.js +6 -11
  170. package/lib/components/CreditForm/CreditFormStep.js.map +1 -1
  171. package/lib/components/CreditForm/ProgramsSourceProps.d.ts +16 -0
  172. package/lib/components/CreditForm/ProgramsSourceProps.js +2 -0
  173. package/lib/components/CreditForm/ProgramsSourceProps.js.map +1 -0
  174. package/lib/components/CreditForm/creditFormStepsData.js +9 -1
  175. package/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  176. package/lib/components/CreditForm/formStateMap.js +9 -7
  177. package/lib/components/CreditForm/formStateMap.js.map +1 -1
  178. package/lib/components/CreditForm/getCalcData.d.ts +3 -0
  179. package/lib/components/CreditForm/getCalcData.js +13 -0
  180. package/lib/components/CreditForm/getCalcData.js.map +1 -0
  181. package/lib/components/CreditForm/getCreditFormTaskData.js +3 -2
  182. package/lib/components/CreditForm/getCreditFormTaskData.js.map +1 -1
  183. package/lib/components/CreditForm/getSecondStepData.js +0 -1
  184. package/lib/components/CreditForm/getSecondStepData.js.map +1 -1
  185. package/lib/components/CreditForm/getZeroStepData.d.ts +1 -1
  186. package/lib/components/CreditForm/getZeroStepData.js +3 -8
  187. package/lib/components/CreditForm/getZeroStepData.js.map +1 -1
  188. package/lib/components/CreditForm/renderInputs.d.ts +2 -1
  189. package/lib/components/CreditForm/renderInputs.js +1 -1
  190. package/lib/components/CreditForm/renderInputs.js.map +1 -1
  191. package/lib/components/CreditForm/renderStep.d.ts +2 -2
  192. package/lib/components/CreditForm/renderStep.js +2 -2
  193. package/lib/components/CreditForm/renderStep.js.map +1 -1
  194. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  195. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +0 -4
  196. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  197. package/lib/components/OfficesAtmsMap/filterItems.d.ts +2 -0
  198. package/lib/components/OfficesAtmsMap/filterItems.js +6 -0
  199. package/lib/components/OfficesAtmsMap/filterItems.js.map +1 -0
  200. package/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js +1 -1
  201. package/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -1
  202. package/lib/hooks/useJSONRef/useJSONRef.js +13 -3
  203. package/lib/hooks/useJSONRef/useJSONRef.js.map +1 -1
  204. package/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +14 -9
  205. package/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
  206. package/lib/ui-kit/FormField/CustomFieldProps.d.ts +1 -0
  207. package/lib/ui-kit/FormField/Fields/CreditCalcField.d.ts +2 -0
  208. package/lib/ui-kit/FormField/Fields/CreditCalcField.js +13 -0
  209. package/lib/ui-kit/FormField/Fields/CreditCalcField.js.map +1 -0
  210. package/lib/ui-kit/FormField/Fields/RegionField.js +3 -1
  211. package/lib/ui-kit/FormField/Fields/RegionField.js.map +1 -1
  212. package/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  213. package/lib/ui-kit/FormField/SelectField.js +4 -6
  214. package/lib/ui-kit/FormField/SelectField.js.map +1 -1
  215. package/lib/ui-kit/FormField/getField.d.ts +1 -1
  216. package/lib/ui-kit/FormField/getField.js +5 -4
  217. package/lib/ui-kit/FormField/getField.js.map +1 -1
  218. package/mobile/bundle/api/RetailAPI/updateUserTask.d.ts +5 -4
  219. package/mobile/bundle/bundle.umd.js +698 -655
  220. package/mobile/bundle/bundle.umd.min.js +1 -1
  221. package/mobile/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +13 -7
  222. package/mobile/bundle/components/CalculatorCredit/CalculatorCredit.d.ts +2 -3
  223. package/mobile/bundle/components/CalculatorCredit/defaultValueAdapter.d.ts +11 -0
  224. package/mobile/bundle/components/CreditCardForm/CreditCardFormStatus.d.ts +1 -0
  225. package/mobile/bundle/components/CreditCardForm/PendingStatusContent.d.ts +3 -1
  226. package/mobile/bundle/components/CreditCardForm/renderInputs.d.ts +2 -1
  227. package/mobile/bundle/components/CreditCardForm/renderStep.d.ts +2 -2
  228. package/mobile/bundle/components/CreditForm/CreditForm.d.ts +5 -2
  229. package/mobile/bundle/components/CreditForm/CreditFormContent.d.ts +4 -5
  230. package/mobile/bundle/components/CreditForm/CreditFormStep.d.ts +2 -3
  231. package/mobile/bundle/components/CreditForm/ProgramsSourceProps.d.ts +16 -0
  232. package/mobile/bundle/components/CreditForm/getCalcData.d.ts +3 -0
  233. package/mobile/bundle/components/CreditForm/getZeroStepData.d.ts +1 -1
  234. package/mobile/bundle/components/CreditForm/renderInputs.d.ts +2 -1
  235. package/mobile/bundle/components/CreditForm/renderStep.d.ts +2 -2
  236. package/mobile/bundle/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  237. package/mobile/bundle/components/OfficesAtmsMap/filterItems.d.ts +2 -0
  238. package/mobile/bundle/ui-kit/FormField/CustomFieldProps.d.ts +1 -0
  239. package/mobile/bundle/ui-kit/FormField/Fields/CreditCalcField.d.ts +2 -0
  240. package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  241. package/mobile/bundle/ui-kit/FormField/getField.d.ts +1 -1
  242. package/mobile/dist/api/RetailAPI/getCardTypes.js +1 -1
  243. package/mobile/dist/api/RetailAPI/getCardTypes.js.map +1 -1
  244. package/mobile/dist/api/RetailAPI/updateUserTask.d.ts +5 -4
  245. package/mobile/dist/api/RetailAPI/updateUserTask.js +1 -1
  246. package/mobile/dist/api/RetailAPI/updateUserTask.js.map +1 -1
  247. package/mobile/dist/components/ApplicationForm/ApplicationForm.js +1 -1
  248. package/mobile/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  249. package/mobile/dist/components/ApplicationForm/renderInputs.js +1 -1
  250. package/mobile/dist/components/ApplicationForm/renderInputs.js.map +1 -1
  251. package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.js +1 -1
  252. package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  253. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +13 -7
  254. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js +0 -1
  255. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  256. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +4 -2
  257. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  258. package/mobile/dist/components/CalculatorCredit/CalculatorCredit.d.ts +2 -3
  259. package/mobile/dist/components/CalculatorCredit/CalculatorCredit.js +5 -3
  260. package/mobile/dist/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
  261. package/mobile/dist/components/CalculatorCredit/defaultValueAdapter.d.ts +11 -0
  262. package/mobile/dist/components/CalculatorCredit/defaultValueAdapter.js +18 -0
  263. package/mobile/dist/components/CalculatorCredit/defaultValueAdapter.js.map +1 -0
  264. package/mobile/dist/components/CreditCardForm/CreditCardForm.js +4 -4
  265. package/mobile/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
  266. package/mobile/dist/components/CreditCardForm/CreditCardFormStatus.d.ts +1 -0
  267. package/mobile/dist/components/CreditCardForm/CreditCardFormStatus.js +3 -1
  268. package/mobile/dist/components/CreditCardForm/CreditCardFormStatus.js.map +1 -1
  269. package/mobile/dist/components/CreditCardForm/CreditCardFormStatusTracker.js +14 -12
  270. package/mobile/dist/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
  271. package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js +2 -14
  272. package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  273. package/mobile/dist/components/CreditCardForm/PendingStatusContent.d.ts +3 -1
  274. package/mobile/dist/components/CreditCardForm/PendingStatusContent.js +2 -2
  275. package/mobile/dist/components/CreditCardForm/PendingStatusContent.js.map +1 -1
  276. package/mobile/dist/components/CreditCardForm/renderInputs.d.ts +2 -1
  277. package/mobile/dist/components/CreditCardForm/renderInputs.js +1 -1
  278. package/mobile/dist/components/CreditCardForm/renderInputs.js.map +1 -1
  279. package/mobile/dist/components/CreditCardForm/renderStep.d.ts +2 -2
  280. package/mobile/dist/components/CreditCardForm/renderStep.js +2 -2
  281. package/mobile/dist/components/CreditCardForm/renderStep.js.map +1 -1
  282. package/mobile/dist/components/CreditForm/CreditForm.d.ts +5 -2
  283. package/mobile/dist/components/CreditForm/CreditForm.js +6 -20
  284. package/mobile/dist/components/CreditForm/CreditForm.js.map +1 -1
  285. package/mobile/dist/components/CreditForm/CreditFormContent.d.ts +4 -5
  286. package/mobile/dist/components/CreditForm/CreditFormStatusTracker.js +10 -10
  287. package/mobile/dist/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
  288. package/mobile/dist/components/CreditForm/CreditFormStep.d.ts +2 -3
  289. package/mobile/dist/components/CreditForm/CreditFormStep.js +5 -10
  290. package/mobile/dist/components/CreditForm/CreditFormStep.js.map +1 -1
  291. package/mobile/dist/components/CreditForm/ProgramsSourceProps.d.ts +16 -0
  292. package/mobile/dist/components/CreditForm/ProgramsSourceProps.js +2 -0
  293. package/mobile/dist/components/CreditForm/ProgramsSourceProps.js.map +1 -0
  294. package/mobile/dist/components/CreditForm/creditFormStepsData.js +9 -1
  295. package/mobile/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  296. package/mobile/dist/components/CreditForm/formStateMap.js +9 -7
  297. package/mobile/dist/components/CreditForm/formStateMap.js.map +1 -1
  298. package/mobile/dist/components/CreditForm/getCalcData.d.ts +3 -0
  299. package/mobile/dist/components/CreditForm/getCalcData.js +16 -0
  300. package/mobile/dist/components/CreditForm/getCalcData.js.map +1 -0
  301. package/mobile/dist/components/CreditForm/getCreditFormTaskData.js +3 -2
  302. package/mobile/dist/components/CreditForm/getCreditFormTaskData.js.map +1 -1
  303. package/mobile/dist/components/CreditForm/getSecondStepData.js +0 -1
  304. package/mobile/dist/components/CreditForm/getSecondStepData.js.map +1 -1
  305. package/mobile/dist/components/CreditForm/getZeroStepData.d.ts +1 -1
  306. package/mobile/dist/components/CreditForm/getZeroStepData.js +3 -8
  307. package/mobile/dist/components/CreditForm/getZeroStepData.js.map +1 -1
  308. package/mobile/dist/components/CreditForm/renderInputs.d.ts +2 -1
  309. package/mobile/dist/components/CreditForm/renderInputs.js +1 -1
  310. package/mobile/dist/components/CreditForm/renderInputs.js.map +1 -1
  311. package/mobile/dist/components/CreditForm/renderStep.d.ts +2 -2
  312. package/mobile/dist/components/CreditForm/renderStep.js +2 -2
  313. package/mobile/dist/components/CreditForm/renderStep.js.map +1 -1
  314. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  315. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +1 -6
  316. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  317. package/mobile/dist/components/OfficesAtmsMap/filterItems.d.ts +2 -0
  318. package/mobile/dist/components/OfficesAtmsMap/filterItems.js +9 -0
  319. package/mobile/dist/components/OfficesAtmsMap/filterItems.js.map +1 -0
  320. package/mobile/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js +3 -3
  321. package/mobile/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -1
  322. package/mobile/dist/hooks/useJSONRef/useJSONRef.js +13 -3
  323. package/mobile/dist/hooks/useJSONRef/useJSONRef.js.map +1 -1
  324. package/mobile/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +14 -9
  325. package/mobile/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
  326. package/mobile/dist/ui-kit/FormField/CustomFieldProps.d.ts +1 -0
  327. package/mobile/dist/ui-kit/FormField/Fields/CreditCalcField.d.ts +2 -0
  328. package/mobile/dist/ui-kit/FormField/Fields/CreditCalcField.js +15 -0
  329. package/mobile/dist/ui-kit/FormField/Fields/CreditCalcField.js.map +1 -0
  330. package/mobile/dist/ui-kit/FormField/Fields/RegionField.js +3 -1
  331. package/mobile/dist/ui-kit/FormField/Fields/RegionField.js.map +1 -1
  332. package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  333. package/mobile/dist/ui-kit/FormField/SelectField.js +4 -6
  334. package/mobile/dist/ui-kit/FormField/SelectField.js.map +1 -1
  335. package/mobile/dist/ui-kit/FormField/getField.d.ts +1 -1
  336. package/mobile/dist/ui-kit/FormField/getField.js +5 -4
  337. package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
  338. package/mobile/lib/api/RetailAPI/getCardTypes.js +1 -1
  339. package/mobile/lib/api/RetailAPI/getCardTypes.js.map +1 -1
  340. package/mobile/lib/api/RetailAPI/updateUserTask.d.ts +5 -4
  341. package/mobile/lib/api/RetailAPI/updateUserTask.js +2 -2
  342. package/mobile/lib/api/RetailAPI/updateUserTask.js.map +1 -1
  343. package/mobile/lib/components/ApplicationForm/ApplicationForm.js +1 -1
  344. package/mobile/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  345. package/mobile/lib/components/ApplicationForm/renderInputs.js +1 -1
  346. package/mobile/lib/components/ApplicationForm/renderInputs.js.map +1 -1
  347. package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.js +1 -1
  348. package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  349. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +13 -7
  350. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js +0 -1
  351. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  352. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +4 -2
  353. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  354. package/mobile/lib/components/CalculatorCredit/CalculatorCredit.d.ts +2 -3
  355. package/mobile/lib/components/CalculatorCredit/CalculatorCredit.js +5 -3
  356. package/mobile/lib/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
  357. package/mobile/lib/components/CalculatorCredit/defaultValueAdapter.d.ts +11 -0
  358. package/mobile/lib/components/CalculatorCredit/defaultValueAdapter.js +15 -0
  359. package/mobile/lib/components/CalculatorCredit/defaultValueAdapter.js.map +1 -0
  360. package/mobile/lib/components/CreditCardForm/CreditCardForm.js +4 -4
  361. package/mobile/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
  362. package/mobile/lib/components/CreditCardForm/CreditCardFormStatus.d.ts +1 -0
  363. package/mobile/lib/components/CreditCardForm/CreditCardFormStatus.js +3 -1
  364. package/mobile/lib/components/CreditCardForm/CreditCardFormStatus.js.map +1 -1
  365. package/mobile/lib/components/CreditCardForm/CreditCardFormStatusTracker.js +14 -12
  366. package/mobile/lib/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
  367. package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js +2 -14
  368. package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  369. package/mobile/lib/components/CreditCardForm/PendingStatusContent.d.ts +3 -1
  370. package/mobile/lib/components/CreditCardForm/PendingStatusContent.js +2 -2
  371. package/mobile/lib/components/CreditCardForm/PendingStatusContent.js.map +1 -1
  372. package/mobile/lib/components/CreditCardForm/renderInputs.d.ts +2 -1
  373. package/mobile/lib/components/CreditCardForm/renderInputs.js +1 -1
  374. package/mobile/lib/components/CreditCardForm/renderInputs.js.map +1 -1
  375. package/mobile/lib/components/CreditCardForm/renderStep.d.ts +2 -2
  376. package/mobile/lib/components/CreditCardForm/renderStep.js +2 -2
  377. package/mobile/lib/components/CreditCardForm/renderStep.js.map +1 -1
  378. package/mobile/lib/components/CreditForm/CreditForm.d.ts +5 -2
  379. package/mobile/lib/components/CreditForm/CreditForm.js +6 -20
  380. package/mobile/lib/components/CreditForm/CreditForm.js.map +1 -1
  381. package/mobile/lib/components/CreditForm/CreditFormContent.d.ts +4 -5
  382. package/mobile/lib/components/CreditForm/CreditFormStatusTracker.js +11 -11
  383. package/mobile/lib/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
  384. package/mobile/lib/components/CreditForm/CreditFormStep.d.ts +2 -3
  385. package/mobile/lib/components/CreditForm/CreditFormStep.js +6 -11
  386. package/mobile/lib/components/CreditForm/CreditFormStep.js.map +1 -1
  387. package/mobile/lib/components/CreditForm/ProgramsSourceProps.d.ts +16 -0
  388. package/mobile/lib/components/CreditForm/ProgramsSourceProps.js +2 -0
  389. package/mobile/lib/components/CreditForm/ProgramsSourceProps.js.map +1 -0
  390. package/mobile/lib/components/CreditForm/creditFormStepsData.js +9 -1
  391. package/mobile/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  392. package/mobile/lib/components/CreditForm/formStateMap.js +9 -7
  393. package/mobile/lib/components/CreditForm/formStateMap.js.map +1 -1
  394. package/mobile/lib/components/CreditForm/getCalcData.d.ts +3 -0
  395. package/mobile/lib/components/CreditForm/getCalcData.js +13 -0
  396. package/mobile/lib/components/CreditForm/getCalcData.js.map +1 -0
  397. package/mobile/lib/components/CreditForm/getCreditFormTaskData.js +3 -2
  398. package/mobile/lib/components/CreditForm/getCreditFormTaskData.js.map +1 -1
  399. package/mobile/lib/components/CreditForm/getSecondStepData.js +0 -1
  400. package/mobile/lib/components/CreditForm/getSecondStepData.js.map +1 -1
  401. package/mobile/lib/components/CreditForm/getZeroStepData.d.ts +1 -1
  402. package/mobile/lib/components/CreditForm/getZeroStepData.js +3 -8
  403. package/mobile/lib/components/CreditForm/getZeroStepData.js.map +1 -1
  404. package/mobile/lib/components/CreditForm/renderInputs.d.ts +2 -1
  405. package/mobile/lib/components/CreditForm/renderInputs.js +1 -1
  406. package/mobile/lib/components/CreditForm/renderInputs.js.map +1 -1
  407. package/mobile/lib/components/CreditForm/renderStep.d.ts +2 -2
  408. package/mobile/lib/components/CreditForm/renderStep.js +2 -2
  409. package/mobile/lib/components/CreditForm/renderStep.js.map +1 -1
  410. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  411. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +0 -4
  412. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  413. package/mobile/lib/components/OfficesAtmsMap/filterItems.d.ts +2 -0
  414. package/mobile/lib/components/OfficesAtmsMap/filterItems.js +6 -0
  415. package/mobile/lib/components/OfficesAtmsMap/filterItems.js.map +1 -0
  416. package/mobile/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js +1 -1
  417. package/mobile/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -1
  418. package/mobile/lib/hooks/useJSONRef/useJSONRef.js +13 -3
  419. package/mobile/lib/hooks/useJSONRef/useJSONRef.js.map +1 -1
  420. package/mobile/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +14 -9
  421. package/mobile/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
  422. package/mobile/lib/ui-kit/FormField/CustomFieldProps.d.ts +1 -0
  423. package/mobile/lib/ui-kit/FormField/Fields/CreditCalcField.d.ts +2 -0
  424. package/mobile/lib/ui-kit/FormField/Fields/CreditCalcField.js +13 -0
  425. package/mobile/lib/ui-kit/FormField/Fields/CreditCalcField.js.map +1 -0
  426. package/mobile/lib/ui-kit/FormField/Fields/RegionField.js +3 -1
  427. package/mobile/lib/ui-kit/FormField/Fields/RegionField.js.map +1 -1
  428. package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  429. package/mobile/lib/ui-kit/FormField/SelectField.js +4 -6
  430. package/mobile/lib/ui-kit/FormField/SelectField.js.map +1 -1
  431. package/mobile/lib/ui-kit/FormField/getField.d.ts +1 -1
  432. package/mobile/lib/ui-kit/FormField/getField.js +5 -4
  433. package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
  434. package/mobile/src/api/RetailAPI/getCardTypes.ts +1 -1
  435. package/mobile/src/api/RetailAPI/updateUserTask.ts +6 -5
  436. package/mobile/src/components/ApplicationForm/ApplicationForm.tsx +1 -1
  437. package/mobile/src/components/ApplicationForm/renderInputs.tsx +2 -2
  438. package/mobile/src/components/ApplicationLeadForm/GroupedConsents.tsx +1 -1
  439. package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +13 -7
  440. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +19 -7
  441. package/mobile/src/components/CalculatorCredit/CalculatorCredit.tsx +7 -5
  442. package/mobile/src/components/CalculatorCredit/defaultValueAdapter.ts +26 -0
  443. package/mobile/src/components/CreditCardForm/CreditCardForm.tsx +4 -8
  444. package/mobile/src/components/CreditCardForm/CreditCardFormStatus.tsx +7 -1
  445. package/mobile/src/components/CreditCardForm/CreditCardFormStatusTracker.tsx +14 -8
  446. package/mobile/src/components/CreditCardForm/CreditCardFormStep.tsx +3 -18
  447. package/mobile/src/components/CreditCardForm/PendingStatusContent.tsx +24 -21
  448. package/mobile/src/components/CreditCardForm/renderInputs.tsx +3 -2
  449. package/mobile/src/components/CreditCardForm/renderStep.tsx +3 -4
  450. package/mobile/src/components/CreditForm/CreditForm.tsx +12 -30
  451. package/mobile/src/components/CreditForm/CreditFormContent.ts +5 -8
  452. package/mobile/src/components/CreditForm/CreditFormStatusTracker.tsx +14 -13
  453. package/mobile/src/components/CreditForm/CreditFormStep.tsx +10 -24
  454. package/mobile/src/components/CreditForm/ProgramsSourceProps.tsx +20 -0
  455. package/mobile/src/components/CreditForm/creditFormStepsData.tsx +9 -1
  456. package/mobile/src/components/CreditForm/formStateMap.tsx +9 -7
  457. package/mobile/src/components/CreditForm/getCalcData.ts +19 -0
  458. package/mobile/src/components/CreditForm/getCreditFormTaskData.ts +3 -2
  459. package/mobile/src/components/CreditForm/getSecondStepData.tsx +0 -1
  460. package/mobile/src/components/CreditForm/getZeroStepData.ts +7 -11
  461. package/mobile/src/components/CreditForm/renderInputs.tsx +3 -2
  462. package/mobile/src/components/CreditForm/renderStep.tsx +3 -3
  463. package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +0 -9
  464. package/mobile/src/components/OfficesAtmsMap/filterItems.tsx +11 -0
  465. package/mobile/src/components/OfficesAtmsMap/useOfficesAtmsMapData.tsx +1 -1
  466. package/mobile/src/hooks/useJSONRef/useJSONRef.ts +21 -4
  467. package/mobile/src/ui-kit/ConsentBkiDialog/useConsentBkiDialog.tsx +14 -10
  468. package/mobile/src/ui-kit/FormField/CustomFieldProps.ts +1 -0
  469. package/mobile/src/ui-kit/FormField/Fields/CreditCalcField.tsx +24 -0
  470. package/mobile/src/ui-kit/FormField/Fields/RegionField.tsx +4 -1
  471. package/mobile/src/ui-kit/FormField/NameFieldDef.ts +1 -0
  472. package/mobile/src/ui-kit/FormField/SelectField.tsx +4 -6
  473. package/mobile/src/ui-kit/FormField/getField.tsx +5 -4
  474. package/package.json +3 -2
  475. package/src/api/RetailAPI/getCardTypes.ts +1 -1
  476. package/src/api/RetailAPI/updateUserTask.ts +6 -5
  477. package/src/components/ApplicationForm/ApplicationForm.tsx +1 -1
  478. package/src/components/ApplicationForm/renderInputs.tsx +2 -2
  479. package/src/components/ApplicationLeadForm/GroupedConsents.tsx +1 -1
  480. package/src/components/ApplicationLeadForm/getInitialFormState.tsx +13 -7
  481. package/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +19 -7
  482. package/src/components/CalculatorCredit/CalculatorCredit.tsx +7 -5
  483. package/src/components/CalculatorCredit/defaultValueAdapter.ts +26 -0
  484. package/src/components/CreditCardForm/CreditCardForm.tsx +4 -8
  485. package/src/components/CreditCardForm/CreditCardFormStatus.tsx +7 -1
  486. package/src/components/CreditCardForm/CreditCardFormStatusTracker.tsx +14 -8
  487. package/src/components/CreditCardForm/CreditCardFormStep.tsx +3 -18
  488. package/src/components/CreditCardForm/PendingStatusContent.tsx +24 -21
  489. package/src/components/CreditCardForm/renderInputs.tsx +3 -2
  490. package/src/components/CreditCardForm/renderStep.tsx +3 -4
  491. package/src/components/CreditForm/CreditForm.fixture.tsx +6 -1
  492. package/src/components/CreditForm/CreditForm.tsx +12 -30
  493. package/src/components/CreditForm/CreditFormContent.ts +5 -8
  494. package/src/components/CreditForm/CreditFormStatusTracker.tsx +14 -13
  495. package/src/components/CreditForm/CreditFormStep.tsx +10 -24
  496. package/src/components/CreditForm/ProgramsSourceProps.tsx +20 -0
  497. package/src/components/CreditForm/creditFormStepsData.tsx +9 -1
  498. package/src/components/CreditForm/formStateMap.tsx +9 -7
  499. package/src/components/CreditForm/getCalcData.ts +19 -0
  500. package/src/components/CreditForm/getCreditFormTaskData.ts +3 -2
  501. package/src/components/CreditForm/getSecondStepData.tsx +0 -1
  502. package/src/components/CreditForm/getZeroStepData.ts +7 -11
  503. package/src/components/CreditForm/renderInputs.tsx +3 -2
  504. package/src/components/CreditForm/renderStep.tsx +3 -3
  505. package/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +0 -9
  506. package/src/components/OfficesAtmsMap/filterItems.tsx +11 -0
  507. package/src/components/OfficesAtmsMap/useOfficesAtmsMapData.tsx +1 -1
  508. package/src/hooks/useJSONRef/useJSONRef.ts +21 -4
  509. package/src/ui-kit/ConsentBkiDialog/useConsentBkiDialog.tsx +14 -10
  510. package/src/ui-kit/FormField/CustomFieldProps.ts +1 -0
  511. package/src/ui-kit/FormField/Fields/CreditCalcField.tsx +24 -0
  512. package/src/ui-kit/FormField/Fields/RegionField.tsx +4 -1
  513. package/src/ui-kit/FormField/NameFieldDef.ts +1 -0
  514. package/src/ui-kit/FormField/SelectField.tsx +4 -6
  515. package/src/ui-kit/FormField/getField.tsx +5 -4
@@ -958,12 +958,22 @@
958
958
  const refs = collectRef(content);
959
959
  const [refsMap, setRefsMap] = useState({});
960
960
  useEffect(() => {
961
- if (refs.length) {
962
- fetchRefs(refs).then(setRefsMap);
963
- }
961
+ resolveRefs(refs).then(setRefsMap);
964
962
  }, [refs.join()]);
965
963
  return refs.length ? resolveBlockProps(content, { ...fallback, ...refsMap }) : content;
966
964
  };
965
+ const resolveRefs = async (refs, parentRefsMap = {}) => {
966
+ if (refs.length) {
967
+ const refsMap = await fetchRefs(refs);
968
+ const unionRefsMap = { ...parentRefsMap, ...refsMap };
969
+ const additRefs = Object.entries(refsMap).flatMap(([, v]) => collectRef(v));
970
+ if (additRefs.length) {
971
+ return resolveRefs(additRefs, unionRefsMap);
972
+ }
973
+ return unionRefsMap;
974
+ }
975
+ return parentRefsMap;
976
+ };
967
977
 
968
978
  const extractContent = ({ block, options, className, defaultPadding, padding, isTheme, version, children, ...content }) => content;
969
979
 
@@ -1193,9 +1203,6 @@
1193
1203
 
1194
1204
  const getConsentDataProcessing = (inputs) => inputs?.find((_) => _?.name === 'consentDataProcessing');
1195
1205
 
1196
- const OUT_SERVICE_URL = `${API_BASE_URI}/outservice/outserviceregions`;
1197
- const getRegionUrl = (typeForm) => typeForm === 'OUTSERVICE' ? OUT_SERVICE_URL : undefined;
1198
-
1199
1206
  function useBool(defaultValue = false) {
1200
1207
  const [value, setValue] = useState(defaultValue);
1201
1208
  const setTrue = useCallback(() => setValue(true), []);
@@ -2420,11 +2427,6 @@
2420
2427
  return { header, body };
2421
2428
  };
2422
2429
 
2423
- const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
2424
-
2425
- const isClient = !isSSR();
2426
- const ClientOnly = JSX(({ children }) => (isClient ? children : null));
2427
-
2428
2430
  const INITIAL_FILTRATION_STATE$1 = {
2429
2431
  workingSaturday: false,
2430
2432
  premiumService: false,
@@ -2469,103 +2471,13 @@
2469
2471
  transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
2470
2472
  };
2471
2473
 
2472
- function useButton() {
2473
- return (props) => ({
2474
- ...props,
2475
- onClick: handlerDecorator(handleClick(props)),
2476
- });
2477
- }
2478
- function handleClick({ disabled, onClick }) {
2479
- return (ev) => {
2480
- !disabled && onClick && onClick(ev);
2481
- };
2482
- }
2483
-
2484
- const buttonStyleMap = {
2485
- primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
2486
- secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
2487
- };
2488
- const secondaryButtonStyleMap = {
2489
- 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'),
2490
- 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'),
2491
- };
2492
- const Button = JSX(({ children, ...props }) => {
2493
- const button = useButton();
2494
- const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
2495
- return (jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
2496
- 'text-white bg-primary-active': active,
2497
- 'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
2498
- 'rounded-md': rounded,
2499
- }, !active && !disabled
2500
- ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
2501
- : '', className), type: type, role: role, onClick: onClick, children: children }));
2502
- });
2503
-
2504
- const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
2505
-
2506
- const renderButtonsGroup = (data, activeButton, onButtonClick) => {
2507
- const allButtonVersion = getVersion(activeButton === 'all');
2508
- const businessButtonVersion = getVersion(activeButton === 'business');
2509
- const handleClick = (e, key, branches) => {
2510
- const filteredBranches = e.currentTarget === e.target && key === 'business' ? filterBranches(branches) : branches;
2511
- onButtonClick(key);
2512
- return filteredBranches;
2513
- };
2514
- const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
2515
- branch.workSchedule.businessScheduleVisibleTag &&
2516
- !branch.workSchedule.businessScheduleDescription);
2517
- return (jsxs("div", { className: "flex gap-lg flex-col sm:flex-row pb-lg", children: [jsx(Button, { "data-id": "all", onClick: (e) => handleClick(e, 'all', data), version: allButtonVersion, children: "\u0414\u043B\u044F \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" }), jsx(Button, { "data-id": "business", onClick: (e) => handleClick(e, 'business', data), version: businessButtonVersion, children: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" })] }));
2518
- };
2519
-
2520
- const renderDescriptionBlock$1 = ({ __html, list, richVersion }) => __html || list?.length ? (jsxs("div", { className: "mb-2xl border-b sm:border border-main-divider sm:rounded-md", children: [__html ? (jsx("div", { className: "mb-2xl", children: jsx(RichText, { __html: __html, richVersion: richVersion }) })) : null, list?.length ? (jsx("div", { className: "flex flex-col sm:flex-row gap-2xl sm:flex-wrap pb-2xl sm:pb-xl", children: list.map((item, i) => (jsxs("div", { className: "flex gap-xs items-center", children: [item?.image ? jsx(Img, { image: item.image }) : null, item?.text ? (jsx(Text, { size: "text-m", font: "font-light", children: item.text })) : null] }, String(i)))) })) : null] })) : null;
2521
-
2522
- const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
2523
- const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
2524
- const visibleFiltersNum = onlyOffice ? 5 : 6;
2525
- const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
2526
- const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
2527
- ? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
2528
- : [filtersCheckbox, []];
2529
- return (jsx("div", { children: filters?.length ? (jsx("div", { children: jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => (jsxs("div", { children: [jsx("div", { className: COMMON_FILTERS_STYLES, children: visibleFilters }), jsx(FoldableSection, { className: COMMON_FILTERS_STYLES, isUnfolded: isUnfolded, children: hiddenFilters })] })), renderFoldButton: renderFoldButton$2(reset, onlyOffice) }) })) : null }));
2530
- };
2531
- const renderFoldButton$2 = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
2532
- const labels = ['Больше фильтров', 'Меньше фильтров'];
2533
- const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
2534
- return (jsxs("div", { className: "flex space-x-lg", children: [onlyOffice ? (jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", appendRight: jsx(Icon, { name: icons[Number(isUnfolded)], width: "16", height: "16" }), text: labels[Number(isUnfolded)], onClick: onToggle })) : null, jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", onClick: reset, children: renderBtnInner() })] }));
2535
- };
2536
- const renderBtnInner = () => (jsxs("div", { className: "flex items-center", children: ["\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440", jsx(Icon, { name: "CloseIcon", width: "16", height: "16", className: "ml-2xs" })] }));
2537
-
2538
- const renderHeading = (title, lengthItems) => (jsx("div", { className: "flex flex-col sm:flex-row gap-xs mb-2xl", children: jsxs(Heading, { headingType: "h3", children: [jsx("span", { suppressHydrationWarning: true, children: title }), lengthItems ? (jsx(Text, { size: "text-h2", color: "text-secondary-text", children: jsx("span", { suppressHydrationWarning: true, children: ` (${lengthItems})` }) })) : null] }) }));
2539
-
2540
- const defaultEmptyFunction$1 = () => void 0;
2541
- const filtersVisibleStyles = (activeButton) => activeButton === 'all' ? 'block' : 'hidden';
2542
- const OfficesAtmsMapLayout = JSX(({ className, data = [], isLoad, remoteWorkplaces = [], renderCard = defaultEmptyFunction$1, renderRemoteWorkplaceCard = defaultEmptyFunction$1, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, descriptionData, title, }) => {
2543
- const onlyOffice = title?.includes('Офис');
2544
- const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE$1);
2545
- const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
2546
- data,
2547
- remoteWorkplaces,
2548
- filtrationState,
2549
- getBalloon,
2550
- getBalloonRemoteWorkplaces,
2551
- });
2552
- const [activeButton, setActiveButton] = useState('all');
2553
- const filterOptions = {
2554
- filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
2555
- field: { field, reset },
2556
- onlyOffice,
2557
- labels: FILTRATION_LABELS,
2558
- };
2559
- return (jsxs("div", { className: style('space-y-1', className), children: [jsxs("div", { className: "bg-white", children: [jsxs("div", { className: "p-3xl pb-0", children: [renderHeading(title, lengthItems), descriptionData ? renderDescriptionBlock$1(descriptionData) : null, onlyOffice && renderButtonsGroup(data, activeButton, setActiveButton), jsx("div", { className: style('pb-3xl', filtersVisibleStyles(activeButton)), children: renderFiltrationForm(filterOptions) })] }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: isLoad, className: "h-full" }) }) })] }), jsxs(ClientOnly, { children: [filteredItems.map(renderCard), filteredRemoteWorkplaces.map(renderRemoteWorkplaceCard)] })] }));
2560
- });
2561
2474
  const filterItems$1 = (data, filtrationState) => {
2562
2475
  const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
2563
2476
  return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
2564
2477
  };
2565
- const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
2566
2478
 
2567
- const defaultEmptyFunction = () => void 0;
2568
- const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction, getBalloonRemoteWorkplaces = defaultEmptyFunction, }) => {
2479
+ const defaultEmptyFunction$1 = () => void 0;
2480
+ const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, }) => {
2569
2481
  const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
2570
2482
  const _filteredItems = filterItems$1(data, filtrationState);
2571
2483
  const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
@@ -2602,6 +2514,11 @@
2602
2514
  return result || [];
2603
2515
  };
2604
2516
 
2517
+ const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
2518
+
2519
+ const isClient = !isSSR();
2520
+ const ClientOnly = JSX(({ children }) => (isClient ? children : null));
2521
+
2605
2522
  const AddressRetailField = JSX(({ field, input }) => {
2606
2523
  const [offices, setOffices] = useState([]);
2607
2524
  const { data } = useLeadFormData('REGION_RF');
@@ -2693,12 +2610,10 @@
2693
2610
  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') })));
2694
2611
 
2695
2612
  const SelectField = UniBlock(({ field, source, label, fieldName, input, placeholder = 'Выберите из списка', isSearch = false, }) => {
2696
- const leadOptions = (source &&
2697
- source?.map((_) => ({
2698
- key: _.key || '',
2699
- text: _.value,
2700
- }))) ||
2701
- [];
2613
+ const leadOptions = source?.map((_) => ({
2614
+ key: _.key || '',
2615
+ text: _.value,
2616
+ })) || [];
2702
2617
  return (jsx(SelectControl, { placeholder: placeholder, label: label, options: leadOptions, isSearch: isSearch, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required) }));
2703
2618
  });
2704
2619
 
@@ -2998,8 +2913,8 @@
2998
2913
 
2999
2914
  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) })));
3000
2915
 
3001
- const FIELD_NAME$9 = 'birthPlace';
3002
- 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) })));
2916
+ const FIELD_NAME$a = 'birthPlace';
2917
+ 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$a) })));
3003
2918
 
3004
2919
  const getCardTypes = async (paymentSystemType) => {
3005
2920
  const response = await doRequest('/dictionaryFiltered', 'POST', {
@@ -3007,7 +2922,7 @@
3007
2922
  presets: { paymentSystemType, creditProgramId: 13 },
3008
2923
  });
3009
2924
  const data = await response?.json();
3010
- return data;
2925
+ return Array.isArray(data) ? data : [];
3011
2926
  };
3012
2927
 
3013
2928
  const CardCategoryField = JSX(({ field, input }) => {
@@ -3066,6 +2981,38 @@
3066
2981
  },
3067
2982
  };
3068
2983
 
2984
+ function useButton() {
2985
+ return (props) => ({
2986
+ ...props,
2987
+ onClick: handlerDecorator(handleClick(props)),
2988
+ });
2989
+ }
2990
+ function handleClick({ disabled, onClick }) {
2991
+ return (ev) => {
2992
+ !disabled && onClick && onClick(ev);
2993
+ };
2994
+ }
2995
+
2996
+ const buttonStyleMap = {
2997
+ primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
2998
+ secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
2999
+ };
3000
+ const secondaryButtonStyleMap = {
3001
+ 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'),
3002
+ 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'),
3003
+ };
3004
+ const Button = JSX(({ children, ...props }) => {
3005
+ const button = useButton();
3006
+ const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
3007
+ return (jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
3008
+ 'text-white bg-primary-active': active,
3009
+ 'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
3010
+ 'rounded-md': rounded,
3011
+ }, !active && !disabled
3012
+ ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
3013
+ : '', className), type: type, role: role, onClick: onClick, children: children }));
3014
+ });
3015
+
3069
3016
  const feedbackById = async (id, convertToPng = false) => {
3070
3017
  const response = await doRequest(`/feedback/file?id=${encodeURIComponent(id)}&convertToPngFlg=${convertToPng}`, 'GET');
3071
3018
  return response ? await response.blob() : new Blob();
@@ -3101,69 +3048,375 @@
3101
3048
 
3102
3049
  const ConsentField = JSX(({ field, input }) => input && input.name ? (jsx(CheckboxWithDoc, { text: CONSENTS[input.name]?.text, docId: CONSENTS[input.name]?.docId, ...getValidation(field(input.name), validatorObj[input.name], input?.required) })) : null);
3103
3050
 
3104
- const LABEL_TEXT = `Имеет ли юридическое лицо, акционером / участником / членом / пайщиком /
3105
- вкладчиком с долей участия более 20% уставного капитала руководителем,
3106
- которого Вы являетесь, кредит в АО «Россельхозбанк»`;
3107
- const CreditInRshbCdField = JSX(({ field, input }) => {
3108
- const { data: creditInRshbCd } = useLeadFormData('CREDIT_IN_RSHB');
3109
- return (jsx(SelectField, { field: field, source: creditInRshbCd, label: LABEL_TEXT, fieldName: "creditInRshbCd", input: input }));
3110
- });
3111
-
3112
- const orientationStyleMap = {
3113
- horizontal: '@lg:flex-row',
3114
- vertical: '',
3115
- };
3116
- 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)))) })] })));
3051
+ const MONTHS_IN_YEAR$1 = 12;
3052
+ const MONTHLY_INTEREST_RATE = MONTHS_IN_YEAR$1 * 100;
3053
+ const DEFAULT_MIN_MONTHS = 1;
3054
+ const DEFAULT_MAX_MONTHS = 60;
3055
+ const DEFAULT_MONTHS = Math.round((DEFAULT_MAX_MONTHS - DEFAULT_MIN_MONTHS) / 2);
3117
3056
 
3118
- const RadioButtonGroupControl = JSX(({ className, label, onChange, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(RadioButtonGroup, { label: getRequiredLabel({ label, errors: rest?.errors }), onChange: (_) => onChange && onChange(_), ...rest }), renderErrorText(error)] })));
3057
+ const CalculatorLayout = JSX(({ className, title, children, ...rest }) => (jsxs(BlockWrapper, { className: style('space-y-xl', className), defaultPadding: "p-4xl", ...rest, children: [title ? jsx(Heading, { className: "text-center", title: title }) : null, children] })));
3119
3058
 
3120
- const CURRENCY_TYPES = [{ id: 'rub', text: 'Рубль' }];
3121
- const CurrencyField = JSX(({ field, input }) => {
3122
- const { value, onChange } = field('currency');
3123
- return (jsx(RadioButtonGroupControl, { label: "\u0412\u0430\u043B\u044E\u0442\u0430", orientation: "horizontal", items: CURRENCY_TYPES, value: value, onChange: (_) => onChange?.(_), ...getValidation(field('currency'), validatorObj.currency, input?.required) }));
3124
- });
3059
+ const CalculatorStyle = {
3060
+ wrapper: 'flex flex-col justify-between lg:flex-row gap-x-4xl gap-y-7 lg:gap-y-4xl',
3061
+ input: 'flex flex-col lg:max-w-80 lg:w-1/2 gap-2xl',
3062
+ result: 'flex flex-col gap-y-xl min-w-52',
3063
+ };
3125
3064
 
3126
- const DeliveryDateFiels = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0438", ...getValidation(field('deliveryDate'), validatorObj.deliveryDate, input?.required) })));
3065
+ const FormatValue = JSX(({ value, fractionDigits, fixed, prefix, postfix }) => (jsx(Text, { size: "text-h3", children: typeof value === 'number'
3066
+ ? [prefix, toLocalNumberFormat(fractionDigits, { fixed })(value), postfix]
3067
+ .filter(Boolean)
3068
+ .join(' ')
3069
+ : value })));
3127
3070
 
3128
- 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 })));
3071
+ const CalculatorValueStyle = 'flex justify-between @xl:flex-col';
3072
+ const CalculatorValue = JSX(({ className, title, value, color = 'text-secondary-text', ...rest }) => (jsxs("div", { className: style(CalculatorValueStyle, className), children: [title ? (jsx(Text, { size: "text-l", font: "font-light", color: color, children: title })) : null, value ? jsx(FormatValue, { value: value, ...rest }) : jsx(Text, { size: "text-h3", children: "-" })] })));
3129
3073
 
3130
- 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) })));
3074
+ const getDefaultParamsMin = (rateRows) => getDefaultParams([(i, acc) => i < acc, (i, prev) => i?.maxSum > prev?.maxSum], rateRows);
3075
+ const getDefaultParamsMax = (rateRows = [], isNewClient = false) => getDefaultParams([(i, acc) => i > acc, (i, prev) => i?.minSum < prev?.minSum], rateRows?.filter((_) => isNewClient === Boolean(_?.isNewClient)));
3076
+ const getDefaultParams = (comparators, rateRows) => {
3077
+ if (!rateRows?.length) {
3078
+ return undefined;
3079
+ }
3080
+ const rates = rateRows?.reduce((acc, i) => {
3081
+ if (comparators[0](i.rate, acc[0].rate)) {
3082
+ return [i];
3083
+ }
3084
+ else if (i.rate === acc[0].rate) {
3085
+ return [...acc, i];
3086
+ }
3087
+ return acc;
3088
+ }, [rateRows[0]]);
3089
+ if (rates.length > 1) {
3090
+ return rates.reduce((prev, i) => (comparators[1](i, prev) ? i : prev), rates[0]);
3091
+ }
3092
+ return rates[0];
3093
+ };
3131
3094
 
3132
- 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) })));
3095
+ const getMoneyDefaultValue = (defaultParams, defaultMoney = 0) => defaultParams?.sum ? defaultParams.sum : defaultMoney;
3096
+ const getMonthsDefaultValue = (defaultParams, defaultMonth = 0) => defaultParams?.period &&
3097
+ defaultParams.period >= DEFAULT_MIN_MONTHS &&
3098
+ defaultParams.period <= DEFAULT_MAX_MONTHS
3099
+ ? defaultParams.period
3100
+ : defaultMonth;
3133
3101
 
3134
- const FIELD_NAME$8 = 'dulIssueDateField';
3135
- const DulIssueDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438", ...getValidation(field(FIELD_NAME$8), validatorObj.dulIssueDateField, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$8) })));
3102
+ const renderFootnote = (text, key) => text ? (jsx(Paragraph, { size: "text-xs", font: "font-light", color: "text-secondary-text", children: text }, String(key))) : null;
3136
3103
 
3137
- const FIELD_NAME$7 = 'dulIssuedBy';
3138
- const DulIssuedByField = JSX(({ field, input }) => {
3139
- const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
3140
- const onDaDataChange = useCallback((item) => {
3141
- changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
3142
- }, []);
3143
- return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$7), label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...input, ...getValidation(field(FIELD_NAME$7), validatorObj.dulIssuedBy, input?.required), onDaDataChange: onDaDataChange, daDataQueryPrefix: dulSubdivisionCode }));
3144
- });
3104
+ const STEP_MONTHS = 1;
3105
+ 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 }));
3106
+ const monthText = (month) => `${month} ${Number(month) % 10 === 1 ? 'месяца' : 'месяцев'}`;
3145
3107
 
3146
- const FIELD_NAME$6 = 'dulNumber';
3147
- const DulNumberField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$6), 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) })));
3108
+ const orientationStyleMap = {
3109
+ horizontal: '@lg:flex-row',
3110
+ vertical: '',
3111
+ };
3112
+ 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)))) })] })));
3148
3113
 
3149
- const FIELD_NAME$5 = 'dulSerie';
3150
- const DulSerieField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$5), 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) })));
3114
+ 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 })] }));
3151
3115
 
3152
- const FIELD_NAME$4 = 'dulSubdivisionCode';
3153
- const DulSubdivisionCodeField = JSX(({ field, input }) => {
3154
- const onDaDataChange = useCallback((item) => {
3155
- field?.('dulIssuedBy')?.onChange?.(item?.data?.name);
3156
- }, []);
3157
- return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$4), 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$4), validatorObj.dulSubdivisionCode, input?.required), onDaDataChange: onDaDataChange }));
3116
+ const renderPaymentType = (props) => renderBinaryRadioButtonGroup({
3117
+ ...props,
3118
+ className: 'sm:flex-col',
3119
+ items: [
3120
+ { id: 'annuity', text: 'Аннуитетный' },
3121
+ { id: 'differential', text: 'Дифференцированный' },
3122
+ ],
3158
3123
  });
3159
3124
 
3160
- const EducationField = JSX(({ field, input }) => {
3161
- const { data: education } = useLeadFormData('EDUCATION_LEVEL');
3162
- return (jsx(SelectField, { field: field, source: education, label: "\u041E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435", fieldName: "education", input: input }));
3163
- });
3125
+ const DEFAULT_MONEY_STEP = 1000;
3126
+ const renderWantedSumInput = ({ isShowItems = true, step = DEFAULT_MONEY_STEP, postfix = '', ...rest }) => (jsx(InputRange, { items: isShowItems
3127
+ ? [
3128
+ `От ${toLocalNumberFormat(1)(rest.min || 0)} ${postfix}`,
3129
+ `До ${toLocalNumberFormat(1)(rest.max || 0)} ${postfix}`,
3130
+ ]
3131
+ : [], step: step, ...rest }));
3164
3132
 
3165
- const EmailField = JSX(({ field, input }) => {
3166
- const { required, ...rest } = input;
3133
+ const setDefaultParamsCalc = ({ field, defParams, calcParams, map, monthsValue = 'maxMonths', }) => {
3134
+ Object.entries(map).forEach(([key, value]) => {
3135
+ field?.(key)?.onChange?.(defParams?.[value]);
3136
+ });
3137
+ field?.('monthsValue')?.onChange?.(clamp(defParams?.[monthsValue], calcParams.minMonths, calcParams.maxMonths));
3138
+ };
3139
+
3140
+ /**
3141
+ * Формулы расчёта аннуитетных и дифференцированных платежей:
3142
+ * https://finuslugi.ru/potrebitelskie_kredity/stat_annuitetnye_i_differentsirovannye_platezhi
3143
+ */
3144
+ const getMonthlyPayment = (rate, params) => {
3145
+ const { isAnnuity, moneyValue, monthsValue, moneyExtra } = params;
3146
+ if (rate === 0) {
3147
+ return 0;
3148
+ }
3149
+ else if (isAnnuity) {
3150
+ const i = rate / MONTHLY_INTEREST_RATE; // Используется значение ставки в процентах
3151
+ if (moneyExtra) {
3152
+ return (moneyValue + moneyExtra) * (i + i / (Math.pow(1 + i, monthsValue) - 1));
3153
+ }
3154
+ else {
3155
+ return moneyValue * (i + i / (Math.pow(1 + i, monthsValue) - 1));
3156
+ }
3157
+ }
3158
+ else {
3159
+ return Math.round(moneyValue / monthsValue) + moneyValue * (rate / (MONTHS_IN_YEAR$1 * 100)); // Используется значение ставки (rate) в процентах, делённое на сто.
3160
+ }
3161
+ };
3162
+
3163
+ const defaultDiscriminator = (_) => _;
3164
+ const maxBy = (discriminator = defaultDiscriminator) => (list) => list.reduceRight((a, b) => (discriminator(a) > discriminator(b) ? a : b));
3165
+ const max = maxBy();
3166
+
3167
+ const minBy = (discriminator = defaultDiscriminator) => maxBy((_) => -discriminator(_));
3168
+ const min = minBy();
3169
+
3170
+ const getLimitRangeByKeys = ([minKey, maxKey], limitParams, rateRows = []) => limitParams && limitParams[minKey] && limitParams[maxKey]
3171
+ ? {
3172
+ [minKey]: limitParams[minKey],
3173
+ [maxKey]: limitParams[maxKey],
3174
+ }
3175
+ : getRangeByKeys([minKey, maxKey], rateRows);
3176
+ const getRangeByKeys = ([minKey, maxKey], rows = []) => ({
3177
+ [minKey]: rows.length
3178
+ ? min(rows.filter((row) => typeof row[minKey] === 'number').map((row) => row[minKey]))
3179
+ : 0,
3180
+ [maxKey]: rows.length
3181
+ ? max(rows.filter((row) => typeof row[minKey] === 'number').map((row) => row[maxKey]))
3182
+ : 0,
3183
+ });
3184
+ const checkRangeByKeys = (value, [minKey, maxKey], sourceBookRow) => value >= sourceBookRow[minKey] && value <= sourceBookRow[maxKey];
3185
+
3186
+ const DEFAULT_MIN_SUM$2 = 10000;
3187
+ const DEFAULT_MAX_SUM$1 = 5000000;
3188
+ const DEFAULT_CREDIT_CALCULATOR_PARAMS = {
3189
+ minSum: DEFAULT_MIN_SUM$2,
3190
+ maxSum: DEFAULT_MAX_SUM$1,
3191
+ minMonths: DEFAULT_MIN_MONTHS,
3192
+ maxMonths: DEFAULT_MAX_MONTHS,
3193
+ rate: 0,
3194
+ isSalaryClient: false,
3195
+ isPensionClient: false,
3196
+ isStateEmployee: false,
3197
+ isInsurance: true,
3198
+ };
3199
+
3200
+ const checkCreditSourceBookRowCommonParams = (props) => checkRowParam$1({
3201
+ ...props,
3202
+ fieldKey: 'isSalaryClient',
3203
+ viewSettingFieldKey: 'isShowSalaryClient',
3204
+ }) &&
3205
+ checkRowParam$1({
3206
+ ...props,
3207
+ fieldKey: 'isStateEmployee',
3208
+ viewSettingFieldKey: 'isShowStateEmployee',
3209
+ }) &&
3210
+ checkRowParam$1({
3211
+ ...props,
3212
+ fieldKey: 'isPensionClient',
3213
+ viewSettingFieldKey: 'isShowPensionClient',
3214
+ }) &&
3215
+ checkRowParam$1({
3216
+ ...props,
3217
+ fieldKey: 'isInsurance',
3218
+ viewSettingFieldKey: 'isShowInsurance',
3219
+ });
3220
+ const checkRowParam$1 = ({ row, userInputParams, paramsViewSettings, fieldKey, viewSettingFieldKey, }) => {
3221
+ const isExclude = paramsViewSettings ? !paramsViewSettings[viewSettingFieldKey] : false;
3222
+ return isExclude || userInputParams[fieldKey] === row[fieldKey];
3223
+ };
3224
+
3225
+ const getCreditCalculatorLimitParams = ({ limitRows, userInputParams, paramsViewSettings, }) => limitRows?.find((row) => checkCreditSourceBookRowCommonParams({
3226
+ row,
3227
+ userInputParams,
3228
+ paramsViewSettings,
3229
+ }));
3230
+
3231
+ const getCreditCalculatorRateParams = ({ rateRows = [], userInputParams, paramsViewSettings, moneyValue, monthsValue, }) => rateRows?.find((row) => checkCreditSourceBookRowCommonParams({
3232
+ row,
3233
+ userInputParams,
3234
+ paramsViewSettings,
3235
+ }) &&
3236
+ checkRangeByKeys(moneyValue, ['minSum', 'maxSum'], row) &&
3237
+ checkRangeByKeys(monthsValue, ['minMonths', 'maxMonths'], row)) || DEFAULT_CREDIT_CALCULATOR_PARAMS;
3238
+
3239
+ const getCreditCalculatorParams = (userInputParams, calcSource, paramsViewSettings) => {
3240
+ const { moneyValue, monthsValue } = userInputParams;
3241
+ const rateRows = calcSource?.rateRows || [DEFAULT_CREDIT_CALCULATOR_PARAMS];
3242
+ const limitRows = calcSource?.limitRows || [];
3243
+ const creditCalculatorSourceBookLimitParams = getCreditCalculatorLimitParams({
3244
+ limitRows,
3245
+ userInputParams,
3246
+ paramsViewSettings,
3247
+ });
3248
+ const { minSum, maxSum } = getLimitRangeByKeys(['minSum', 'maxSum'], creditCalculatorSourceBookLimitParams, rateRows);
3249
+ const { minMonths, maxMonths } = getLimitRangeByKeys(['minMonths', 'maxMonths'], creditCalculatorSourceBookLimitParams, rateRows);
3250
+ const creditCalculatorRateParams = getCreditCalculatorRateParams({
3251
+ rateRows,
3252
+ userInputParams,
3253
+ paramsViewSettings,
3254
+ moneyValue,
3255
+ monthsValue,
3256
+ });
3257
+ const { rate } = creditCalculatorRateParams;
3258
+ const monthlyPayment = getMonthlyPayment(rate, userInputParams);
3259
+ return {
3260
+ ...creditCalculatorRateParams,
3261
+ ...userInputParams,
3262
+ minSum,
3263
+ maxSum,
3264
+ minMonths,
3265
+ maxMonths,
3266
+ moneyValue,
3267
+ monthsValue,
3268
+ monthlyPayment,
3269
+ };
3270
+ };
3271
+
3272
+ const isDefaultParams = (defaultParams = {}) => Boolean(Object.values(defaultParams).filter((_) => _).length);
3273
+
3274
+ const CREDIT_DEFAULT_SUM = 200000;
3275
+ const MAP$1 = {
3276
+ isSalaryClient: 'isSalaryClient',
3277
+ isStateEmployee: 'isStateEmployee',
3278
+ isPensionClient: 'isPensionClient',
3279
+ isInsurance: 'isInsurance',
3280
+ moneyValue: 'maxSum',
3281
+ };
3282
+ const CalculatorCredit = UniBlock(({ className, title, calcSource, buttons, footnote, paramsViewSettings, defaultParams, onChange, ...rest }) => {
3283
+ const defaultParamsCals = getDefaultParamsMin(calcSource?.rateRows);
3284
+ const [userInputParams, { field, isDirty }] = useForm({
3285
+ moneyValue: getMoneyDefaultValue(defaultParams, CREDIT_DEFAULT_SUM),
3286
+ monthsValue: getMonthsDefaultValue(defaultParams, DEFAULT_MONTHS),
3287
+ isAnnuity: Boolean(defaultParams?.isAnnuity),
3288
+ isInsurance: Boolean(defaultParams?.isEnableInsurance),
3289
+ isSalaryClient: Boolean(defaultParams?.isEnableSalaryClient),
3290
+ isPensionClient: Boolean(defaultParams?.isEnablePensionClient),
3291
+ isStateEmployee: Boolean(defaultParams?.isEnableStateEmployee),
3292
+ });
3293
+ useEffect(() => {
3294
+ isDirty && onChange?.(userInputParams);
3295
+ }, [userInputParams, isDirty]);
3296
+ const calcParams = getCreditCalculatorParams(userInputParams, calcSource, paramsViewSettings);
3297
+ const paymentTypeElement = renderPaymentType({
3298
+ title: 'Тип платежа',
3299
+ orientation: 'vertical',
3300
+ ...field('isAnnuity'),
3301
+ });
3302
+ const { onChange: setMoneyValue } = field('moneyValue');
3303
+ const { onChange: setMonthsValue } = field('monthsValue');
3304
+ useEffect(() => {
3305
+ setMoneyValue &&
3306
+ setMoneyValue(clamp(userInputParams.moneyValue, calcParams.minSum, calcParams.maxSum));
3307
+ }, [calcParams.minSum, calcParams.maxSum]);
3308
+ useEffect(() => {
3309
+ setMonthsValue &&
3310
+ setMonthsValue(clamp(userInputParams.monthsValue, calcParams.minMonths, calcParams.maxMonths));
3311
+ }, [calcParams.minMonths, calcParams.maxMonths]);
3312
+ useEffect(() => {
3313
+ if (!isDefaultParams(defaultParams) && defaultParamsCals) {
3314
+ setDefaultParamsCalc({
3315
+ field,
3316
+ defParams: defaultParamsCals,
3317
+ calcParams,
3318
+ map: MAP$1,
3319
+ monthsValue: 'minMonths',
3320
+ });
3321
+ }
3322
+ }, [calcSource, defaultParams]);
3323
+ return (jsx(CalculatorLayout, { className: className, title: title, ...rest, children: jsxs("section", { className: style(CalculatorStyle.wrapper, className), children: [jsxs("div", { className: CalculatorStyle.input, children: [renderWantedSumInput({
3324
+ title: 'Сумма кредита, ₽',
3325
+ step: 500,
3326
+ min: calcParams.minSum,
3327
+ max: calcParams.maxSum,
3328
+ ...field('moneyValue'),
3329
+ value: calcParams.moneyValue,
3330
+ }), renderMonthsInput({
3331
+ title: 'Срок кредита, месяцев',
3332
+ min: calcParams.minMonths,
3333
+ max: calcParams.maxMonths,
3334
+ ...field('monthsValue'),
3335
+ value: calcParams.monthsValue,
3336
+ }), renderCreditParamsForm$1({ ...calcParams, ...paramsViewSettings }, field), jsx("div", { className: "sm:hidden", children: paymentTypeElement })] }), jsxs("div", { className: style(CalculatorStyle.result, '@4xl:w-1/2'), children: [jsx(CalculatorValue, { title: "\u041F\u043E\u043B\u043D\u0430\u044F \u0441\u0442\u043E\u0438\u043C\u043E\u0441\u0442\u044C \u043A\u0440\u0435\u0434\u0438\u0442\u0430", value: calcSource?.totalLoanCost }), jsx(CalculatorValue, { title: "\u0421\u0442\u0430\u0432\u043A\u0430", value: calcParams?.rate, fractionDigits: 2, postfix: "%" }), jsx(CalculatorValue, { title: "\u0415\u0436\u0435\u043C\u0435\u0441\u044F\u0447\u043D\u044B\u0439 \u043F\u043B\u0430\u0442\u0451\u0436", value: calcParams.monthlyPayment, postfix: "\u20BD" }), jsx("div", { className: "hidden sm:block mb-lg", children: paymentTypeElement }), renderButtonsSection(buttons, { isVertical: true }), renderFootnote(footnote)] })] }) }));
3337
+ });
3338
+ const renderCreditParamsForm$1 = (params, field) => (jsxs("div", { className: "flex flex-col gap-y-2xl", children: [params.isShowSalaryClient ? (jsx(Checkbox, { text: `Получаю зарплату на счёт\nв Россельхозбанке`, ...field('isSalaryClient'), value: params.isSalaryClient, className: "whitespace-pre-line sm:whitespace-normal" })) : null, params.isShowStateEmployee ? (jsx(Checkbox, { text: "\u0420\u0430\u0431\u043E\u0442\u0430\u044E \u0432 \u0431\u044E\u0434\u0436\u0435\u0442\u043D\u043E\u0439 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", ...field('isStateEmployee'), value: params.isStateEmployee })) : null, params.isShowPensionClient ? (jsx(Checkbox, { text: "\u041F\u043E\u043B\u0443\u0447\u0430\u044E \u043F\u0435\u043D\u0441\u0438\u044E \u043D\u0430 \u043A\u0430\u0440\u0442\u0443 \u0420\u043E\u0441\u0441\u0435\u043B\u044C\u0445\u043E\u0437\u0431\u0430\u043D\u043A\u0430", ...field('isPensionClient'), value: params.isPensionClient })) : null, params.isShowInsurance ? (jsx(Checkbox, { text: "\u041A\u043E\u043C\u043F\u043B\u0435\u043A\u0441\u043D\u0430\u044F \u0441\u0442\u0440\u0430\u0445\u043E\u0432\u0430\u044F \u0437\u0430\u0449\u0438\u0442\u0430", ...field('isInsurance'), value: params.isInsurance })) : null] }));
3339
+
3340
+ const PARAMS_MAP = {
3341
+ moneyValue: 'sum',
3342
+ monthsValue: 'period',
3343
+ isInsurance: 'isEnableInsurance',
3344
+ isPensionClient: 'isEnablePensionClient',
3345
+ isStateEmployee: 'isEnableStateEmployee',
3346
+ isSalaryClient: 'isEnableSalaryClient',
3347
+ isAnnuity: 'isAnnuity',
3348
+ };
3349
+ const defaultValueAdapter = (value, isInverse = false) => {
3350
+ const keysMap = isInverse ? swap(PARAMS_MAP) : PARAMS_MAP;
3351
+ return Object.fromEntries(Object.entries(value ?? {}).map(([k, v]) => [keysMap[k], v]));
3352
+ };
3353
+ const swap = (_) => Object.fromEntries(Object.entries(_).map(([k, v]) => [v, k]));
3354
+
3355
+ const FIELD_NAME$9 = 'calculator';
3356
+ const CreditCalcField = JSX(({ field, params }) => {
3357
+ const handleChange = useCallback((_) => {
3358
+ field(FIELD_NAME$9).onChange?.(_);
3359
+ }, []);
3360
+ return (jsx(CalculatorCredit, { ...params?.calcData, defaultParams: defaultValueAdapter(field(FIELD_NAME$9).value), onChange: handleChange }));
3361
+ });
3362
+
3363
+ const LABEL_TEXT = `Имеет ли юридическое лицо, акционером / участником / членом / пайщиком /
3364
+ вкладчиком с долей участия более 20% уставного капитала руководителем,
3365
+ которого Вы являетесь, кредит в АО «Россельхозбанк»`;
3366
+ const CreditInRshbCdField = JSX(({ field, input }) => {
3367
+ const { data: creditInRshbCd } = useLeadFormData('CREDIT_IN_RSHB');
3368
+ return (jsx(SelectField, { field: field, source: creditInRshbCd, label: LABEL_TEXT, fieldName: "creditInRshbCd", input: input }));
3369
+ });
3370
+
3371
+ const RadioButtonGroupControl = JSX(({ className, label, onChange, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(RadioButtonGroup, { label: getRequiredLabel({ label, errors: rest?.errors }), onChange: (_) => onChange && onChange(_), ...rest }), renderErrorText(error)] })));
3372
+
3373
+ const CURRENCY_TYPES = [{ id: 'rub', text: 'Рубль' }];
3374
+ const CurrencyField = JSX(({ field, input }) => {
3375
+ const { value, onChange } = field('currency');
3376
+ return (jsx(RadioButtonGroupControl, { label: "\u0412\u0430\u043B\u044E\u0442\u0430", orientation: "horizontal", items: CURRENCY_TYPES, value: value, onChange: (_) => onChange?.(_), ...getValidation(field('currency'), validatorObj.currency, input?.required) }));
3377
+ });
3378
+
3379
+ const DeliveryDateFiels = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0438", ...getValidation(field('deliveryDate'), validatorObj.deliveryDate, input?.required) })));
3380
+
3381
+ 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 })));
3382
+
3383
+ 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) })));
3384
+
3385
+ 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) })));
3386
+
3387
+ const FIELD_NAME$8 = 'dulIssueDateField';
3388
+ const DulIssueDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438", ...getValidation(field(FIELD_NAME$8), validatorObj.dulIssueDateField, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$8) })));
3389
+
3390
+ const FIELD_NAME$7 = 'dulIssuedBy';
3391
+ const DulIssuedByField = JSX(({ field, input }) => {
3392
+ const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
3393
+ const onDaDataChange = useCallback((item) => {
3394
+ changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
3395
+ }, []);
3396
+ return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$7), label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...input, ...getValidation(field(FIELD_NAME$7), validatorObj.dulIssuedBy, input?.required), onDaDataChange: onDaDataChange, daDataQueryPrefix: dulSubdivisionCode }));
3397
+ });
3398
+
3399
+ const FIELD_NAME$6 = 'dulNumber';
3400
+ const DulNumberField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$6), 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) })));
3401
+
3402
+ const FIELD_NAME$5 = 'dulSerie';
3403
+ const DulSerieField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$5), 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) })));
3404
+
3405
+ const FIELD_NAME$4 = 'dulSubdivisionCode';
3406
+ const DulSubdivisionCodeField = JSX(({ field, input }) => {
3407
+ const onDaDataChange = useCallback((item) => {
3408
+ field?.('dulIssuedBy')?.onChange?.(item?.data?.name);
3409
+ }, []);
3410
+ return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$4), 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$4), validatorObj.dulSubdivisionCode, input?.required), onDaDataChange: onDaDataChange }));
3411
+ });
3412
+
3413
+ const EducationField = JSX(({ field, input }) => {
3414
+ const { data: education } = useLeadFormData('EDUCATION_LEVEL');
3415
+ return (jsx(SelectField, { field: field, source: education, label: "\u041E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435", fieldName: "education", input: input }));
3416
+ });
3417
+
3418
+ const EmailField = JSX(({ field, input }) => {
3419
+ const { required, ...rest } = input;
3167
3420
  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 }));
3168
3421
  });
3169
3422
 
@@ -3393,6 +3646,9 @@
3393
3646
  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) })));
3394
3647
  const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
3395
3648
 
3649
+ const OUT_SERVICE_URL = `${API_BASE_URI}/outservice/outserviceregions`;
3650
+ const getRegionUrl = (typeForm) => typeForm === 'OUTSERVICE' ? OUT_SERVICE_URL : undefined;
3651
+
3396
3652
  const REGIONS_URL = `${API_BASE_URI}/regions`;
3397
3653
  const EMPTY_REGIONS = [];
3398
3654
  // TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
@@ -3401,7 +3657,8 @@
3401
3657
  return Array.isArray(data) ? data : EMPTY_REGIONS;
3402
3658
  }
3403
3659
 
3404
- const RegionField = JSX(({ field, input, url }) => {
3660
+ const RegionField = JSX(({ field, input, params }) => {
3661
+ const url = getRegionUrl(params?.typeForm);
3405
3662
  const regions = useRegions(url);
3406
3663
  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) }));
3407
3664
  });
@@ -3513,8 +3770,8 @@
3513
3770
  const PRODUCT_REF = {
3514
3771
  $ref: '/wcms-resources/outservice-productlist.json',
3515
3772
  };
3516
- const getField = (field, typeForm = '') => (input, i) => {
3517
- const isPremium = typeForm === 'ULTRASERVICE' || typeForm === 'PREMIUMSERVICE';
3773
+ const getField = (field, params) => (input, i) => {
3774
+ const isPremium = params?.typeForm === 'ULTRASERVICE' || params?.typeForm === 'PREMIUMSERVICE';
3518
3775
  const InputsMap = {
3519
3776
  surname: jsx(SurnameField, { field: field, input: input }),
3520
3777
  name: jsx(NameField, { field: field, input: input }),
@@ -3564,7 +3821,7 @@
3564
3821
  consentInformFlg: jsx(ConsentField, { field: field, input: input }),
3565
3822
  consentPfrFlg: jsx(ConsentField, { field: field, input: input }),
3566
3823
  applicationDate: (jsx(InputControl, { label: "\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u044F \u0432 \u0411\u0430\u043D\u043A", ...field('applicationDate') })),
3567
- region: isPremium ? (jsx(RegionPremiumField, { field: field })) : (jsx(RegionField, { field: field, input: input, url: getRegionUrl(typeForm) })),
3824
+ region: isPremium ? (jsx(RegionPremiumField, { field: field })) : (jsx(RegionField, { field: field, input: input, params: params })),
3568
3825
  education: jsx(EducationField, { field: field, input: input }),
3569
3826
  housing: jsx(HousingField, { field: field, input: input }),
3570
3827
  employment: jsx(EmploymentField, { field: field, input: input }),
@@ -3611,6 +3868,7 @@
3611
3868
  confirmationIncome: jsx(ConfirmationIncomeField, { field: field, input: input }),
3612
3869
  methodObtain: jsx(MethodObtainField, { field: field, input: input }),
3613
3870
  deliveryDate: jsx(DeliveryDateFiels, { field: field, input: input }),
3871
+ calculator: jsx(CreditCalcField, { field: field, params: params }),
3614
3872
  };
3615
3873
  return isRenderField({ input, field }) ? (jsx("div", { children: InputsMap[input?.name || ''] }, String(i))) : null;
3616
3874
  };
@@ -3759,7 +4017,7 @@
3759
4017
  reset();
3760
4018
  }
3761
4019
  }, [responseType]);
3762
- 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] }));
4020
+ 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] }));
3763
4021
  });
3764
4022
  const getFilteredInputs = (inputs, data) => inputs
3765
4023
  .filter((_) => (_?.name === 'secondaryPhone' ? Boolean(data.secondaryPhone) : _))
@@ -3791,20 +4049,19 @@
3791
4049
  const hasValidationErrors = useMemo(() => inputs
3792
4050
  ?.filter((_) => _.required)
3793
4051
  ?.some((_) => Boolean(withValidator(field(_?.name), validatorObj[_?.name]).error)), [inputs]);
3794
- 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 : '')] })) }) }));
4052
+ 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 : '')] })) }) }));
3795
4053
  });
3796
4054
  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" }) })] }));
3797
4055
 
3798
4056
  const renderInputs$2 = ({ field, typeForm = '', inputs }) => {
3799
4057
  const { consentInputs, restInputs } = splitInputs(inputs || []);
3800
- return consentInputs.length > 2 ? (jsxs("div", { children: [restInputs.map(getField(field, typeForm)), jsx(GroupedConsents, { inputs: consentInputs, field: field })] })) : ((inputs || [])?.map(getField(field, typeForm)));
4058
+ return consentInputs.length > 2 ? (jsxs("div", { children: [restInputs.map(getField(field, { typeForm })), jsx(GroupedConsents, { inputs: consentInputs, field: field })] })) : ((inputs || [])?.map(getField(field, { typeForm })));
3801
4059
  };
3802
4060
  const splitInputs = (inputs) => ({
3803
4061
  consentInputs: inputs?.filter((_) => Object.keys(CONSENTS).includes(_.name || '')) || [],
3804
4062
  restInputs: inputs?.filter((_) => !Object.keys(CONSENTS).includes(_.name || '')) || [],
3805
4063
  });
3806
4064
 
3807
- /* eslint-disable max-lines */
3808
4065
  const initialFormState = {
3809
4066
  typeForm: '',
3810
4067
  region: { key: '', text: '' },
@@ -3868,7 +4125,7 @@
3868
4125
 
3869
4126
  const updateUserProfile = (body) => fetchRetailJSON('/user-data/updateUserProfile', 'PUT', body);
3870
4127
 
3871
- const updateUserTask = (body) => fetchRetailJSON('/user-data/updateUserTask', 'PUT', body);
4128
+ const updateUserTask = (body) => doRequest('/user-data/updateUserTask', 'PUT', body);
3872
4129
 
3873
4130
  const getUpdateUserProfileData = (profileId, formData) => {
3874
4131
  const { name = '', surname = '', middleName = '', birthday = '', phone = '', email = '', processPersonalDataFlg, consentProviderFlg, consentPfrFlg, consentPhotoFlg, consentAssignmentClaimsFlg, consentCollectionFlg, consentInformFlg, } = formData;
@@ -4159,16 +4416,21 @@
4159
4416
  const { open, close } = useDialogManager();
4160
4417
  const verifyPhoneDialog = useVerifyPhoneDialog();
4161
4418
  const handleSuccessVerify = (profileId) => async (smsCode) => {
4162
- if (profileId) {
4163
- await updateUserProfile({
4164
- profile: {
4165
- id: profileId,
4166
- consentBkiFlg: true,
4167
- smsConsentBki: smsCode,
4168
- },
4169
- });
4419
+ try {
4420
+ if (profileId) {
4421
+ await updateUserProfile({
4422
+ profile: {
4423
+ id: profileId,
4424
+ consentBkiFlg: true,
4425
+ smsConsentBki: smsCode,
4426
+ },
4427
+ });
4428
+ }
4429
+ onClose();
4430
+ }
4431
+ catch (ex) {
4432
+ console.log(ex);
4170
4433
  }
4171
- onClose();
4172
4434
  };
4173
4435
  const handleSubmitBkiConstent = (phone, profileId) => async (confirmStatus) => {
4174
4436
  close();
@@ -4324,13 +4586,15 @@
4324
4586
  const [, setTaskId] = useLocalStorage('taskId');
4325
4587
  const [, setProfileId] = useLocalStorage('profileId');
4326
4588
  const [, setParticipantId] = useLocalStorage('participantId');
4589
+ const [, setProgramId] = useLocalStorage('programId');
4327
4590
  const esiaLoginDialog = useEsiaLoginDialog(nextStepLink);
4328
4591
  const consentBkiDialog = useConsentBkiDialog(esiaLoginDialog.open);
4329
4592
  const verifyPhoneDialog = useVerifyPhoneDialog();
4330
- const saveUserData = useCallback((participantId, taskId, profileId) => {
4593
+ const saveUserData = useCallback(({ participantId, taskId, profileId, programId: programNumber }) => {
4331
4594
  setParticipantId(participantId);
4332
4595
  setTaskId(taskId);
4333
4596
  setProfileId(profileId);
4597
+ setProgramId(programNumber);
4334
4598
  }, []);
4335
4599
  // eslint-disable-next-line consistent-return
4336
4600
  const handleSubmit = useCallback(async (formData) => {
@@ -4387,7 +4651,7 @@
4387
4651
  profileId,
4388
4652
  formData: transformedForm,
4389
4653
  }));
4390
- saveUserData(participantId, taskId, profileId);
4654
+ saveUserData({ participantId, taskId, profileId, programId });
4391
4655
  saveForm(formData);
4392
4656
  };
4393
4657
  const verifyPhoneContent = (phone, consents) => ({
@@ -4644,13 +4908,6 @@
4644
4908
 
4645
4909
  const areArraysEqual = (as, bs) => as === bs || Boolean(as && bs && as?.length === bs?.length && as.every((_, i) => _ === bs[i]));
4646
4910
 
4647
- const defaultDiscriminator = (_) => _;
4648
- const maxBy = (discriminator = defaultDiscriminator) => (list) => list.reduceRight((a, b) => (discriminator(a) > discriminator(b) ? a : b));
4649
- const max = maxBy();
4650
-
4651
- const minBy = (discriminator = defaultDiscriminator) => maxBy((_) => -discriminator(_));
4652
- const min = minBy();
4653
-
4654
4911
  const getItemWidth = (container) => (itemCount) => container.scrollWidth / itemCount;
4655
4912
  const scrollBy = (container) => (itemCount, delta) => {
4656
4913
  container.scrollBy({ left: delta * getItemWidth(container)(itemCount), behavior: 'smooth' });
@@ -5004,39 +5261,12 @@
5004
5261
  return (jsx(BlockWrapper, { className: style('!bg-transparent', alignStyle, className), defaultPadding: "p-0", ...rest, children: renderButtonsSection(buttons) }));
5005
5262
  });
5006
5263
 
5007
- const CalculatorLayout = JSX(({ className, title, children, ...rest }) => (jsxs(BlockWrapper, { className: style('space-y-xl', className), defaultPadding: "p-4xl", ...rest, children: [title ? jsx(Heading, { className: "text-center", title: title }) : null, children] })));
5008
-
5009
- const CalculatorStyle = {
5010
- wrapper: 'flex flex-col justify-between lg:flex-row gap-x-4xl gap-y-7 lg:gap-y-4xl',
5011
- input: 'flex flex-col lg:max-w-80 lg:w-1/2 gap-2xl',
5012
- result: 'flex flex-col gap-y-xl min-w-52',
5013
- };
5014
-
5015
- const FormatValue = JSX(({ value, fractionDigits, fixed, prefix, postfix }) => (jsx(Text, { size: "text-h3", children: typeof value === 'number'
5016
- ? [prefix, toLocalNumberFormat(fractionDigits, { fixed })(value), postfix]
5017
- .filter(Boolean)
5018
- .join(' ')
5019
- : value })));
5020
-
5021
- const CalculatorValueStyle = 'flex justify-between @xl:flex-col';
5022
- const CalculatorValue = JSX(({ className, title, value, color = 'text-secondary-text', ...rest }) => (jsxs("div", { className: style(CalculatorValueStyle, className), children: [title ? (jsx(Text, { size: "text-l", font: "font-light", color: color, children: title })) : null, value ? jsx(FormatValue, { value: value, ...rest }) : jsx(Text, { size: "text-h3", children: "-" })] })));
5023
-
5024
- const renderFootnote = (text, key) => text ? (jsx(Paragraph, { size: "text-xs", font: "font-light", color: "text-secondary-text", children: text }, String(key))) : null;
5025
-
5026
5264
  const Rate = JSX(({ rate = 0, title = 'Ставка', unit, fractionDigits = 2, depositeName, isShowDepositeName, color = 'text-secondary-text', }) => (jsxs("div", { children: [jsx(Text, { size: "text-l", font: "font-light", color: color, children: title }), jsxs("div", { className: "relative", children: [jsxs("div", { className: "flex @xl:justify-center gradient-color-text", children: [jsx("span", { className: "font-mohave text-title-huge -mt-m tracking-[-15px]", children: toLocalNumberFormat(fractionDigits, { fixed: true })(rate) }), unit ? jsx("span", { className: "text-7xl mt-5", children: unit }) : null] }), depositeName && isShowDepositeName ? (jsx("div", { className: "absolute bottom-2 w-full text-left whitespace-nowrap", children: depositeName })) : null] })] })));
5027
5265
 
5028
5266
  const UnknownRate = JSX(({ title = 'Ставка' }) => (jsxs("div", { className: "space-y-s min-w-96", children: [jsx(Text, { size: "text-l", font: "font-light", color: "text-secondary-text", children: title }), jsx(Icon, { className: "w-10 h-auto lg:w-40", name: "PercentIcon" }), jsx("div", { className: "w-64", children: jsx(Paragraph, { size: "text-xl", font: "font-light", color: "text-primary-text", children: "\u041F\u0440\u043E\u0446\u0435\u043D\u0442\u043D\u0430\u044F \u0441\u0442\u0430\u0432\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430, \u0432\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B" }) })] })));
5029
5267
 
5030
5268
  const renderRate = ({ title = 'Ставка', rate = 0, unit = '%', fractionDigits = 2, color = 'text-secondary-text', children, ...rest }) => rate ? (jsxs("div", { className: "flex flex-col", children: [jsx("div", { className: "hidden lg:block min-w-96", children: jsx(Rate, { title: title, rate: rate, unit: unit, fractionDigits: fractionDigits, color: color, ...rest }) }), jsx(CalculatorValue, { className: "lg:hidden", title: title, value: rate, postfix: unit, fractionDigits: fractionDigits, fixed: true, color: color, ...rest }), children] })) : (jsx(UnknownRate, { title: title, ...rest }));
5031
5269
 
5032
- const DEFAULT_MONEY_STEP = 1000;
5033
- const renderWantedSumInput = ({ isShowItems = true, step = DEFAULT_MONEY_STEP, postfix = '₽', ...rest }) => (jsx(InputRange, { items: isShowItems
5034
- ? [
5035
- `От ${toLocalNumberFormat(1)(rest.min || 0)} ${postfix}`,
5036
- `До ${toLocalNumberFormat(1)(rest.max || 0)} ${postfix}`,
5037
- ]
5038
- : [], step: step, ...rest }));
5039
-
5040
5270
  const DEFAULT_BONUS_CALCULATOR_PARAMS$1 = {
5041
5271
  minSumTravel: 6000,
5042
5272
  maxSumTravel: 200000,
@@ -5049,13 +5279,13 @@
5049
5279
  travelBonusRate: 0.015,
5050
5280
  restBonusRate: 0.01,
5051
5281
  };
5052
- const MONTHS_IN_YEAR$1 = 12;
5282
+ const MONTHS_IN_YEAR = 12;
5053
5283
  const getBonus = (params, bonusTravelValue, bonusOtherValue) => {
5054
5284
  const { maxBonus = 5000, prefMonthsNum = DEFAULT_BONUS_CALCULATOR_PARAMS$1.prefMonthsNum, prefTravelBonusRate = DEFAULT_BONUS_CALCULATOR_PARAMS$1.prefTravelBonusRate, prefRestBonusRate = 0.01, travelBonusRate = 0.015, restBonusRate = 0.01, } = params;
5055
5285
  const prefBonus = Math.min(Math.round(prefTravelBonusRate * bonusTravelValue) +
5056
5286
  Math.round(prefRestBonusRate * bonusOtherValue), maxBonus);
5057
5287
  const bonus = Math.min(Math.round(travelBonusRate * bonusTravelValue) + Math.round(restBonusRate * bonusOtherValue), maxBonus);
5058
- const yearBonus = prefBonus * prefMonthsNum + bonus * (MONTHS_IN_YEAR$1 - prefMonthsNum);
5288
+ const yearBonus = prefBonus * prefMonthsNum + bonus * (MONTHS_IN_YEAR - prefMonthsNum);
5059
5289
  return [prefBonus, yearBonus];
5060
5290
  };
5061
5291
 
@@ -5111,29 +5341,14 @@
5111
5341
  fractionDigits: 0,
5112
5342
  unit: '',
5113
5343
  color: 'text-primary-text',
5114
- })
5115
- : null }), jsxs("div", { className: CalculatorStyle.result, children: [yearBonus >= 0 ? (jsx(CalculatorValue, { title: "\u0411\u0430\u043B\u043B\u043E\u0432 \u0437\u0430 \u0433\u043E\u0434", value: yearBonus, color: "text-primary-text" })) : null, renderButtonsSection(buttons, { isVertical: true }), renderFootnote(footnote)] })] }) }));
5116
- });
5117
-
5118
- const MONTHS_IN_YEAR = 12;
5119
- const MONTHLY_INTEREST_RATE = MONTHS_IN_YEAR * 100;
5120
- const DEFAULT_MIN_MONTHS = 1;
5121
- const DEFAULT_MAX_MONTHS = 60;
5122
- const DEFAULT_MONTHS = Math.round((DEFAULT_MAX_MONTHS - DEFAULT_MIN_MONTHS) / 2);
5123
-
5124
- const getMoneyDefaultValue = (defaultParams, defaultMoney = 0) => defaultParams?.sum ? defaultParams.sum : defaultMoney;
5125
- const getMonthsDefaultValue = (defaultParams, defaultMonth = 0) => defaultParams?.period &&
5126
- defaultParams.period >= DEFAULT_MIN_MONTHS &&
5127
- defaultParams.period <= DEFAULT_MAX_MONTHS
5128
- ? defaultParams.period
5129
- : defaultMonth;
5344
+ })
5345
+ : null }), jsxs("div", { className: CalculatorStyle.result, children: [yearBonus >= 0 ? (jsx(CalculatorValue, { title: "\u0411\u0430\u043B\u043B\u043E\u0432 \u0437\u0430 \u0433\u043E\u0434", value: yearBonus, color: "text-primary-text" })) : null, renderButtonsSection(buttons, { isVertical: true }), renderFootnote(footnote)] })] }) }));
5346
+ });
5130
5347
 
5131
5348
  const STEP_DAYS = 1;
5132
5349
  const renderDaysInput = (props) => (jsx(InputRange, { items: [`От ${daysText(props.min || 0)}`, `До ${daysText(props.max || 0)}`], step: STEP_DAYS, ...props }));
5133
5350
  const daysText = (days) => `${days} ${Number(days) % 10 === 1 ? 'дня' : 'дней'}`;
5134
5351
 
5135
- 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 })] }));
5136
-
5137
5352
  const renderPayout = (props) => renderBinaryRadioButtonGroup({
5138
5353
  ...props,
5139
5354
  items: [
@@ -5145,22 +5360,6 @@
5145
5360
  const CAPITALIZATION = ' (c капитализацией)';
5146
5361
  const renderDepositResult = ({ income, finalSum, postfix = '₽', buttons = [], footnotes = [], isCapitalization = false, }) => (jsxs("div", { className: CalculatorStyle.result, children: [jsx(CalculatorValue, { title: `Доход в конце срока${isCapitalization ? CAPITALIZATION : ''}`, value: income, postfix: postfix, prefix: "+" }), jsx(CalculatorValue, { title: `Сумма в конце срока${isCapitalization ? CAPITALIZATION : ''}`, value: finalSum, postfix: postfix }), renderButtonsSection(buttons, { isVertical: true }), footnotes?.map(renderFootnote)] }));
5147
5362
 
5148
- const getLimitRangeByKeys = ([minKey, maxKey], limitParams, rateRows = []) => limitParams && limitParams[minKey] && limitParams[maxKey]
5149
- ? {
5150
- [minKey]: limitParams[minKey],
5151
- [maxKey]: limitParams[maxKey],
5152
- }
5153
- : getRangeByKeys([minKey, maxKey], rateRows);
5154
- const getRangeByKeys = ([minKey, maxKey], rows = []) => ({
5155
- [minKey]: rows.length
5156
- ? min(rows.filter((row) => typeof row[minKey] === 'number').map((row) => row[minKey]))
5157
- : 0,
5158
- [maxKey]: rows.length
5159
- ? max(rows.filter((row) => typeof row[minKey] === 'number').map((row) => row[maxKey]))
5160
- : 0,
5161
- });
5162
- const checkRangeByKeys = (value, [minKey, maxKey], sourceBookRow) => value >= sourceBookRow[minKey] && value <= sourceBookRow[maxKey];
5163
-
5164
5363
  const DEPOSIT_RATES_SERVICE_MAP = {
5165
5364
  UL: 'businessdepositrates',
5166
5365
  IP: 'selfemployeddepositrates',
@@ -5170,320 +5369,104 @@
5170
5369
  const { data } = useAsyncData(serviceName ? `${API_BASE_URI}/depositrates/${serviceName}` : null, fetchJSONUnsafe);
5171
5370
  return Array.isArray(data) ? data : [];
5172
5371
  }
5173
-
5174
- const BUSINESS_MIN_DAYS = 1;
5175
- const BUSINESS_MAX_DAYS = 1095;
5176
- const BUSINESS_OPERATING_MIN_DAYS = 90;
5177
- const BUSINESS_OPERATING_MAX_DAYS = 730;
5178
- const DEFAULT_BUSINESS_DEPOSIT_CALCULATOR_PARAMS = {
5179
- minSum: 1000,
5180
- maxSum: 100000001,
5181
- minDays: BUSINESS_MIN_DAYS,
5182
- maxDays: BUSINESS_MAX_DAYS,
5183
- rate: 0,
5184
- isMonthlyInterestPayment: true,
5185
- isReplenished: false,
5186
- isPartialWithdrawal: false,
5187
- depositeName: "Депозит 'Стабильный'",
5188
- };
5189
- const useBusinessDepositParams = (userInputParams, rateParams) => {
5190
- const { daysValue, moneyValue, isPartialWithdrawal, isReplenished, isMonthlyInterestPayment } = userInputParams;
5191
- const isOperatingDeposit = isReplenished || isPartialWithdrawal;
5192
- const isDisabledOperatingDeposit = daysValue < BUSINESS_OPERATING_MIN_DAYS || daysValue > BUSINESS_OPERATING_MAX_DAYS;
5193
- const rateRows = useBusinessDepositRates(rateParams);
5194
- const businessDepositCalculatorSourceBookParams = rateRows?.find((_) => {
5195
- return (isMonthlyInterestPayment === _.isMonthlyInterestPayment &&
5196
- checkIsOperatingDeposit(isOperatingDeposit, _) &&
5197
- checkRangeByKeys(moneyValue, ['minSum', 'maxSum'], _) &&
5198
- checkRangeByKeys(daysValue, ['minDays', 'maxDays'], _));
5199
- }) || DEFAULT_BUSINESS_DEPOSIT_CALCULATOR_PARAMS;
5200
- const { rate } = businessDepositCalculatorSourceBookParams;
5201
- const income = getDepositIncome$1(rate, userInputParams);
5202
- const finalSum = moneyValue + income;
5203
- const sourceBookRows = rateRows || [DEFAULT_BUSINESS_DEPOSIT_CALCULATOR_PARAMS];
5204
- return {
5205
- ...businessDepositCalculatorSourceBookParams,
5206
- ...getRangeByKeys(['minSum', 'maxSum'], sourceBookRows),
5207
- ...getRangeByKeys(['minDays', 'maxDays'], sourceBookRows),
5208
- ...userInputParams,
5209
- isDisabledOperatingDeposit,
5210
- income,
5211
- finalSum,
5212
- };
5213
- };
5214
- const checkIsOperatingDeposit = (isOperatingDeposit, sourceBookRow) => isOperatingDeposit
5215
- ? sourceBookRow.isReplenished && sourceBookRow.isPartialWithdrawal
5216
- : !sourceBookRow.isReplenished && !sourceBookRow.isPartialWithdrawal;
5217
- const getDepositIncome$1 = (rate, userInputParams) => {
5218
- const { isMonthlyInterestPayment, moneyValue, daysValue } = userInputParams;
5219
- /*
5220
- Приблизительный расчёт, не учитывающий разницу в количестве дней в месяцах. Месяц принят за 30 дней, год за 365 дней.
5221
- */
5222
- if (isMonthlyInterestPayment) {
5223
- return Math.round(moneyValue * Math.pow((1200 + rate) / 1200, daysValue / 30) - moneyValue);
5224
- }
5225
- else {
5226
- return Math.round((moneyValue * rate * daysValue) / 365 / 100);
5227
- }
5228
- };
5229
-
5230
- const BUSINESS_DEFAULT_SUM = 100000;
5231
- const BUSINESS_DEFAULT_DAYS = 60;
5232
- const CalculatorBusinessDeposit = UniBlock(({ className = '', title, buttons, footnote, bottomFootnote, isShowDepositeName, defaultParams, rateParams, ...rest }) => {
5233
- const [userInputParams, { field }] = useForm({
5234
- moneyValue: getMoneyDefaultValue(defaultParams, BUSINESS_DEFAULT_SUM),
5235
- daysValue: getMonthsDefaultValue(defaultParams, BUSINESS_DEFAULT_DAYS),
5236
- isReplenished: Boolean(defaultParams?.isReplenished),
5237
- isPartialWithdrawal: Boolean(defaultParams?.isPartialWithdrawal),
5238
- isMonthlyInterestPayment: Boolean(defaultParams?.isMonthlyInterestPayment),
5239
- });
5240
- const calculatorParams = useBusinessDepositParams(userInputParams, rateParams);
5241
- const { income, finalSum, rate, depositeName } = calculatorParams;
5242
- return (jsx(CalculatorLayout, { className: className, title: title, ...rest, children: jsxs("section", { className: style(CalculatorStyle.wrapper, className), children: [jsxs("div", { className: CalculatorStyle.input, children: [renderWantedSumInput({
5243
- title: 'Сумма, ₽',
5244
- min: calculatorParams.minSum,
5245
- max: calculatorParams.maxSum,
5246
- ...field('moneyValue'),
5247
- value: calculatorParams.moneyValue,
5248
- }), renderDaysInput({
5249
- title: 'Срок, дней',
5250
- min: calculatorParams.minDays,
5251
- max: calculatorParams.maxDays,
5252
- ...field('daysValue'),
5253
- value: calculatorParams.daysValue,
5254
- }), jsxs("div", { className: "flex flex-col sm:flex-row gap-y-m gap-x-5xl", children: [renderBusinessDepositParamsForm(calculatorParams, field), renderPayout({
5255
- title: 'Выплата процентов',
5256
- orientation: 'vertical',
5257
- ...field('isMonthlyInterestPayment'),
5258
- className: 'sm:flex-col',
5259
- })] })] }), renderRate({
5260
- rate,
5261
- depositeName,
5262
- isShowDepositeName,
5263
- }), renderDepositResult({
5264
- income,
5265
- finalSum,
5266
- buttons,
5267
- footnotes: [footnote, bottomFootnote],
5268
- })] }) }));
5269
- });
5270
- const renderBusinessDepositParamsForm = (calculatorParams, field) => (jsxs("div", { className: "space-y-s", children: [jsx(Text, { color: "text-secondary-text", font: "font-light", children: "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B" }), jsxs("div", { className: "flex flex-col gap-y-lg sm:gap-y-s", children: [jsx(Checkbox, { text: "\u041F\u043E\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u0435", disabled: calculatorParams.isDisabledOperatingDeposit, ...field('isReplenished'), value: calculatorParams.isReplenished }), jsx(Checkbox, { disabled: calculatorParams.isDisabledOperatingDeposit, text: "\u0427\u0430\u0441\u0442\u0438\u0447\u043D\u043E\u0435 \u0441\u043D\u044F\u0442\u0438\u0435", ...field('isPartialWithdrawal'), value: calculatorParams.isPartialWithdrawal })] })] }));
5271
-
5272
- const getDefaultParamsMin = (rateRows) => getDefaultParams([(i, acc) => i < acc, (i, prev) => i?.maxSum > prev?.maxSum], rateRows);
5273
- const getDefaultParamsMax = (rateRows = [], isNewClient = false) => getDefaultParams([(i, acc) => i > acc, (i, prev) => i?.minSum < prev?.minSum], rateRows?.filter((_) => isNewClient === Boolean(_?.isNewClient)));
5274
- const getDefaultParams = (comparators, rateRows) => {
5275
- if (!rateRows?.length) {
5276
- return undefined;
5277
- }
5278
- const rates = rateRows?.reduce((acc, i) => {
5279
- if (comparators[0](i.rate, acc[0].rate)) {
5280
- return [i];
5281
- }
5282
- else if (i.rate === acc[0].rate) {
5283
- return [...acc, i];
5284
- }
5285
- return acc;
5286
- }, [rateRows[0]]);
5287
- if (rates.length > 1) {
5288
- return rates.reduce((prev, i) => (comparators[1](i, prev) ? i : prev), rates[0]);
5289
- }
5290
- return rates[0];
5291
- };
5292
-
5293
- const STEP_MONTHS = 1;
5294
- 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 }));
5295
- const monthText = (month) => `${month} ${Number(month) % 10 === 1 ? 'месяца' : 'месяцев'}`;
5296
-
5297
- const renderPaymentType = (props) => renderBinaryRadioButtonGroup({
5298
- ...props,
5299
- className: 'sm:flex-col',
5300
- items: [
5301
- { id: 'annuity', text: 'Аннуитетный' },
5302
- { id: 'differential', text: 'Дифференцированный' },
5303
- ],
5304
- });
5305
-
5306
- const setDefaultParamsCalc = ({ field, defParams, calcParams, map, monthsValue = 'maxMonths', }) => {
5307
- Object.entries(map).forEach(([key, value]) => {
5308
- field?.(key)?.onChange?.(defParams?.[value]);
5309
- });
5310
- field?.('monthsValue')?.onChange?.(clamp(defParams?.[monthsValue], calcParams.minMonths, calcParams.maxMonths));
5311
- };
5312
-
5313
- /**
5314
- * Формулы расчёта аннуитетных и дифференцированных платежей:
5315
- * https://finuslugi.ru/potrebitelskie_kredity/stat_annuitetnye_i_differentsirovannye_platezhi
5316
- */
5317
- const getMonthlyPayment = (rate, params) => {
5318
- const { isAnnuity, moneyValue, monthsValue, moneyExtra } = params;
5319
- if (rate === 0) {
5320
- return 0;
5321
- }
5322
- else if (isAnnuity) {
5323
- const i = rate / MONTHLY_INTEREST_RATE; // Используется значение ставки в процентах
5324
- if (moneyExtra) {
5325
- return (moneyValue + moneyExtra) * (i + i / (Math.pow(1 + i, monthsValue) - 1));
5326
- }
5327
- else {
5328
- return moneyValue * (i + i / (Math.pow(1 + i, monthsValue) - 1));
5329
- }
5330
- }
5331
- else {
5332
- return Math.round(moneyValue / monthsValue) + moneyValue * (rate / (MONTHS_IN_YEAR * 100)); // Используется значение ставки (rate) в процентах, делённое на сто.
5333
- }
5334
- };
5335
-
5336
- const DEFAULT_MIN_SUM$2 = 10000;
5337
- const DEFAULT_MAX_SUM$1 = 5000000;
5338
- const DEFAULT_CREDIT_CALCULATOR_PARAMS = {
5339
- minSum: DEFAULT_MIN_SUM$2,
5340
- maxSum: DEFAULT_MAX_SUM$1,
5341
- minMonths: DEFAULT_MIN_MONTHS,
5342
- maxMonths: DEFAULT_MAX_MONTHS,
5343
- rate: 0,
5344
- isSalaryClient: false,
5345
- isPensionClient: false,
5346
- isStateEmployee: false,
5347
- isInsurance: true,
5348
- };
5349
-
5350
- const checkCreditSourceBookRowCommonParams = (props) => checkRowParam$1({
5351
- ...props,
5352
- fieldKey: 'isSalaryClient',
5353
- viewSettingFieldKey: 'isShowSalaryClient',
5354
- }) &&
5355
- checkRowParam$1({
5356
- ...props,
5357
- fieldKey: 'isStateEmployee',
5358
- viewSettingFieldKey: 'isShowStateEmployee',
5359
- }) &&
5360
- checkRowParam$1({
5361
- ...props,
5362
- fieldKey: 'isPensionClient',
5363
- viewSettingFieldKey: 'isShowPensionClient',
5364
- }) &&
5365
- checkRowParam$1({
5366
- ...props,
5367
- fieldKey: 'isInsurance',
5368
- viewSettingFieldKey: 'isShowInsurance',
5369
- });
5370
- const checkRowParam$1 = ({ row, userInputParams, paramsViewSettings, fieldKey, viewSettingFieldKey, }) => {
5371
- const isExclude = paramsViewSettings ? !paramsViewSettings[viewSettingFieldKey] : false;
5372
- return isExclude || userInputParams[fieldKey] === row[fieldKey];
5373
- };
5374
-
5375
- const getCreditCalculatorLimitParams = ({ limitRows, userInputParams, paramsViewSettings, }) => limitRows?.find((row) => checkCreditSourceBookRowCommonParams({
5376
- row,
5377
- userInputParams,
5378
- paramsViewSettings,
5379
- }));
5380
-
5381
- const getCreditCalculatorRateParams = ({ rateRows = [], userInputParams, paramsViewSettings, moneyValue, monthsValue, }) => rateRows?.find((row) => checkCreditSourceBookRowCommonParams({
5382
- row,
5383
- userInputParams,
5384
- paramsViewSettings,
5385
- }) &&
5386
- checkRangeByKeys(moneyValue, ['minSum', 'maxSum'], row) &&
5387
- checkRangeByKeys(monthsValue, ['minMonths', 'maxMonths'], row)) || DEFAULT_CREDIT_CALCULATOR_PARAMS;
5388
-
5389
- const getCreditCalculatorParams = (userInputParams, calcSource, paramsViewSettings) => {
5390
- const { moneyValue, monthsValue } = userInputParams;
5391
- const rateRows = calcSource?.rateRows || [DEFAULT_CREDIT_CALCULATOR_PARAMS];
5392
- const limitRows = calcSource?.limitRows || [];
5393
- const creditCalculatorSourceBookLimitParams = getCreditCalculatorLimitParams({
5394
- limitRows,
5395
- userInputParams,
5396
- paramsViewSettings,
5397
- });
5398
- const { minSum, maxSum } = getLimitRangeByKeys(['minSum', 'maxSum'], creditCalculatorSourceBookLimitParams, rateRows);
5399
- const { minMonths, maxMonths } = getLimitRangeByKeys(['minMonths', 'maxMonths'], creditCalculatorSourceBookLimitParams, rateRows);
5400
- const creditCalculatorRateParams = getCreditCalculatorRateParams({
5401
- rateRows,
5402
- userInputParams,
5403
- paramsViewSettings,
5404
- moneyValue,
5405
- monthsValue,
5406
- });
5407
- const { rate } = creditCalculatorRateParams;
5408
- const monthlyPayment = getMonthlyPayment(rate, userInputParams);
5372
+
5373
+ const BUSINESS_MIN_DAYS = 1;
5374
+ const BUSINESS_MAX_DAYS = 1095;
5375
+ const BUSINESS_OPERATING_MIN_DAYS = 90;
5376
+ const BUSINESS_OPERATING_MAX_DAYS = 730;
5377
+ const DEFAULT_BUSINESS_DEPOSIT_CALCULATOR_PARAMS = {
5378
+ minSum: 1000,
5379
+ maxSum: 100000001,
5380
+ minDays: BUSINESS_MIN_DAYS,
5381
+ maxDays: BUSINESS_MAX_DAYS,
5382
+ rate: 0,
5383
+ isMonthlyInterestPayment: true,
5384
+ isReplenished: false,
5385
+ isPartialWithdrawal: false,
5386
+ depositeName: "Депозит 'Стабильный'",
5387
+ };
5388
+ const useBusinessDepositParams = (userInputParams, rateParams) => {
5389
+ const { daysValue, moneyValue, isPartialWithdrawal, isReplenished, isMonthlyInterestPayment } = userInputParams;
5390
+ const isOperatingDeposit = isReplenished || isPartialWithdrawal;
5391
+ const isDisabledOperatingDeposit = daysValue < BUSINESS_OPERATING_MIN_DAYS || daysValue > BUSINESS_OPERATING_MAX_DAYS;
5392
+ const rateRows = useBusinessDepositRates(rateParams);
5393
+ const businessDepositCalculatorSourceBookParams = rateRows?.find((_) => {
5394
+ return (isMonthlyInterestPayment === _.isMonthlyInterestPayment &&
5395
+ checkIsOperatingDeposit(isOperatingDeposit, _) &&
5396
+ checkRangeByKeys(moneyValue, ['minSum', 'maxSum'], _) &&
5397
+ checkRangeByKeys(daysValue, ['minDays', 'maxDays'], _));
5398
+ }) || DEFAULT_BUSINESS_DEPOSIT_CALCULATOR_PARAMS;
5399
+ const { rate } = businessDepositCalculatorSourceBookParams;
5400
+ const income = getDepositIncome$1(rate, userInputParams);
5401
+ const finalSum = moneyValue + income;
5402
+ const sourceBookRows = rateRows || [DEFAULT_BUSINESS_DEPOSIT_CALCULATOR_PARAMS];
5409
5403
  return {
5410
- ...creditCalculatorRateParams,
5404
+ ...businessDepositCalculatorSourceBookParams,
5405
+ ...getRangeByKeys(['minSum', 'maxSum'], sourceBookRows),
5406
+ ...getRangeByKeys(['minDays', 'maxDays'], sourceBookRows),
5411
5407
  ...userInputParams,
5412
- minSum,
5413
- maxSum,
5414
- minMonths,
5415
- maxMonths,
5416
- moneyValue,
5417
- monthsValue,
5418
- monthlyPayment,
5408
+ isDisabledOperatingDeposit,
5409
+ income,
5410
+ finalSum,
5419
5411
  };
5420
5412
  };
5421
-
5422
- const isDefaultParams = (defaultParams = {}) => Boolean(Object.values(defaultParams).filter((_) => _).length);
5423
-
5424
- const CREDIT_DEFAULT_SUM = 200000;
5425
- const MAP$1 = {
5426
- isSalaryClient: 'isSalaryClient',
5427
- isStateEmployee: 'isStateEmployee',
5428
- isPensionClient: 'isPensionClient',
5429
- isInsurance: 'isInsurance',
5430
- moneyValue: 'maxSum',
5413
+ const checkIsOperatingDeposit = (isOperatingDeposit, sourceBookRow) => isOperatingDeposit
5414
+ ? sourceBookRow.isReplenished && sourceBookRow.isPartialWithdrawal
5415
+ : !sourceBookRow.isReplenished && !sourceBookRow.isPartialWithdrawal;
5416
+ const getDepositIncome$1 = (rate, userInputParams) => {
5417
+ const { isMonthlyInterestPayment, moneyValue, daysValue } = userInputParams;
5418
+ /*
5419
+ Приблизительный расчёт, не учитывающий разницу в количестве дней в месяцах. Месяц принят за 30 дней, год за 365 дней.
5420
+ */
5421
+ if (isMonthlyInterestPayment) {
5422
+ return Math.round(moneyValue * Math.pow((1200 + rate) / 1200, daysValue / 30) - moneyValue);
5423
+ }
5424
+ else {
5425
+ return Math.round((moneyValue * rate * daysValue) / 365 / 100);
5426
+ }
5431
5427
  };
5432
- const CalculatorCredit = UniBlock(({ className, title, calcSource, buttons, footnote, paramsViewSettings, defaultParams, registerSubmit, ...rest }) => {
5433
- const defaultParamsCals = getDefaultParamsMin(calcSource?.rateRows);
5434
- const [userInputParams, { field, onSubmit }] = useForm({
5435
- moneyValue: getMoneyDefaultValue(defaultParams, CREDIT_DEFAULT_SUM),
5436
- monthsValue: getMonthsDefaultValue(defaultParams, DEFAULT_MONTHS),
5437
- isAnnuity: Boolean(defaultParams?.isAnnuity),
5438
- isInsurance: Boolean(defaultParams?.isEnableInsurance),
5439
- isSalaryClient: Boolean(defaultParams?.isEnableSalaryClient),
5440
- isPensionClient: Boolean(defaultParams?.isEnablePensionClient),
5441
- isStateEmployee: Boolean(defaultParams?.isEnableStateEmployee),
5442
- });
5443
- registerSubmit?.(onSubmit);
5444
- const calcParams = getCreditCalculatorParams(userInputParams, calcSource, paramsViewSettings);
5445
- const paymentTypeElement = renderPaymentType({
5446
- title: 'Тип платежа',
5447
- orientation: 'vertical',
5448
- ...field('isAnnuity'),
5428
+
5429
+ const BUSINESS_DEFAULT_SUM = 100000;
5430
+ const BUSINESS_DEFAULT_DAYS = 60;
5431
+ const CalculatorBusinessDeposit = UniBlock(({ className = '', title, buttons, footnote, bottomFootnote, isShowDepositeName, defaultParams, rateParams, ...rest }) => {
5432
+ const [userInputParams, { field }] = useForm({
5433
+ moneyValue: getMoneyDefaultValue(defaultParams, BUSINESS_DEFAULT_SUM),
5434
+ daysValue: getMonthsDefaultValue(defaultParams, BUSINESS_DEFAULT_DAYS),
5435
+ isReplenished: Boolean(defaultParams?.isReplenished),
5436
+ isPartialWithdrawal: Boolean(defaultParams?.isPartialWithdrawal),
5437
+ isMonthlyInterestPayment: Boolean(defaultParams?.isMonthlyInterestPayment),
5449
5438
  });
5450
- const { onChange: setMoneyValue } = field('moneyValue');
5451
- const { onChange: setMonthsValue } = field('monthsValue');
5452
- useEffect(() => {
5453
- setMoneyValue &&
5454
- setMoneyValue(clamp(userInputParams.moneyValue, calcParams.minSum, calcParams.maxSum));
5455
- }, [calcParams.minSum, calcParams.maxSum]);
5456
- useEffect(() => {
5457
- setMonthsValue &&
5458
- setMonthsValue(clamp(userInputParams.monthsValue, calcParams.minMonths, calcParams.maxMonths));
5459
- }, [calcParams.minMonths, calcParams.maxMonths]);
5460
- useEffect(() => {
5461
- if (!isDefaultParams(defaultParams) && defaultParamsCals) {
5462
- setDefaultParamsCalc({
5463
- field,
5464
- defParams: defaultParamsCals,
5465
- calcParams,
5466
- map: MAP$1,
5467
- monthsValue: 'minMonths',
5468
- });
5469
- }
5470
- }, [calcSource, defaultParams]);
5439
+ const calculatorParams = useBusinessDepositParams(userInputParams, rateParams);
5440
+ const { income, finalSum, rate, depositeName } = calculatorParams;
5471
5441
  return (jsx(CalculatorLayout, { className: className, title: title, ...rest, children: jsxs("section", { className: style(CalculatorStyle.wrapper, className), children: [jsxs("div", { className: CalculatorStyle.input, children: [renderWantedSumInput({
5472
- title: 'Сумма кредита, ₽',
5473
- step: 500,
5474
- min: calcParams.minSum,
5475
- max: calcParams.maxSum,
5442
+ title: 'Сумма, ₽',
5443
+ min: calculatorParams.minSum,
5444
+ max: calculatorParams.maxSum,
5476
5445
  ...field('moneyValue'),
5477
- value: calcParams.moneyValue,
5478
- }), renderMonthsInput({
5479
- title: 'Срок кредита, месяцев',
5480
- min: calcParams.minMonths,
5481
- max: calcParams.maxMonths,
5482
- ...field('monthsValue'),
5483
- value: calcParams.monthsValue,
5484
- }), renderCreditParamsForm$1({ ...calcParams, ...paramsViewSettings }, field), jsx("div", { className: "sm:hidden", children: paymentTypeElement })] }), jsxs("div", { className: style(CalculatorStyle.result, '@4xl:w-1/2'), children: [jsx(CalculatorValue, { title: "\u041F\u043E\u043B\u043D\u0430\u044F \u0441\u0442\u043E\u0438\u043C\u043E\u0441\u0442\u044C \u043A\u0440\u0435\u0434\u0438\u0442\u0430", value: calcSource?.totalLoanCost }), jsx(CalculatorValue, { title: "\u0421\u0442\u0430\u0432\u043A\u0430", value: calcParams?.rate, fractionDigits: 2, postfix: "%" }), jsx(CalculatorValue, { title: "\u0415\u0436\u0435\u043C\u0435\u0441\u044F\u0447\u043D\u044B\u0439 \u043F\u043B\u0430\u0442\u0451\u0436", value: calcParams.monthlyPayment, postfix: "\u20BD" }), jsx("div", { className: "hidden sm:block mb-lg", children: paymentTypeElement }), renderButtonsSection(buttons, { isVertical: true }), renderFootnote(footnote)] })] }) }));
5446
+ value: calculatorParams.moneyValue,
5447
+ }), renderDaysInput({
5448
+ title: 'Срок, дней',
5449
+ min: calculatorParams.minDays,
5450
+ max: calculatorParams.maxDays,
5451
+ ...field('daysValue'),
5452
+ value: calculatorParams.daysValue,
5453
+ }), jsxs("div", { className: "flex flex-col sm:flex-row gap-y-m gap-x-5xl", children: [renderBusinessDepositParamsForm(calculatorParams, field), renderPayout({
5454
+ title: 'Выплата процентов',
5455
+ orientation: 'vertical',
5456
+ ...field('isMonthlyInterestPayment'),
5457
+ className: 'sm:flex-col',
5458
+ })] })] }), renderRate({
5459
+ rate,
5460
+ depositeName,
5461
+ isShowDepositeName,
5462
+ }), renderDepositResult({
5463
+ income,
5464
+ finalSum,
5465
+ buttons,
5466
+ footnotes: [footnote, bottomFootnote],
5467
+ })] }) }));
5485
5468
  });
5486
- const renderCreditParamsForm$1 = (params, field) => (jsxs("div", { className: "flex flex-col gap-y-2xl", children: [params.isShowSalaryClient ? (jsx(Checkbox, { text: `Получаю зарплату на счёт\nв Россельхозбанке`, ...field('isSalaryClient'), value: params.isSalaryClient, className: "whitespace-pre-line sm:whitespace-normal" })) : null, params.isShowStateEmployee ? (jsx(Checkbox, { text: "\u0420\u0430\u0431\u043E\u0442\u0430\u044E \u0432 \u0431\u044E\u0434\u0436\u0435\u0442\u043D\u043E\u0439 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", ...field('isStateEmployee'), value: params.isStateEmployee })) : null, params.isShowPensionClient ? (jsx(Checkbox, { text: "\u041F\u043E\u043B\u0443\u0447\u0430\u044E \u043F\u0435\u043D\u0441\u0438\u044E \u043D\u0430 \u043A\u0430\u0440\u0442\u0443 \u0420\u043E\u0441\u0441\u0435\u043B\u044C\u0445\u043E\u0437\u0431\u0430\u043D\u043A\u0430", ...field('isPensionClient'), value: params.isPensionClient })) : null, params.isShowInsurance ? (jsx(Checkbox, { text: "\u041A\u043E\u043C\u043F\u043B\u0435\u043A\u0441\u043D\u0430\u044F \u0441\u0442\u0440\u0430\u0445\u043E\u0432\u0430\u044F \u0437\u0430\u0449\u0438\u0442\u0430", ...field('isInsurance'), value: params.isInsurance })) : null] }));
5469
+ const renderBusinessDepositParamsForm = (calculatorParams, field) => (jsxs("div", { className: "space-y-s", children: [jsx(Text, { color: "text-secondary-text", font: "font-light", children: "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B" }), jsxs("div", { className: "flex flex-col gap-y-lg sm:gap-y-s", children: [jsx(Checkbox, { text: "\u041F\u043E\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u0435", disabled: calculatorParams.isDisabledOperatingDeposit, ...field('isReplenished'), value: calculatorParams.isReplenished }), jsx(Checkbox, { disabled: calculatorParams.isDisabledOperatingDeposit, text: "\u0427\u0430\u0441\u0442\u0438\u0447\u043D\u043E\u0435 \u0441\u043D\u044F\u0442\u0438\u0435", ...field('isPartialWithdrawal'), value: calculatorParams.isPartialWithdrawal })] })] }));
5487
5470
 
5488
5471
  const arrayByRange = (start, stop, step = 1) => Array.from({ length: Math.abs(stop - start) / step + 1 }, (value, index) => stop >= start ? start + index * step : start - index * step);
5489
5472
 
@@ -6137,10 +6120,10 @@
6137
6120
  }
6138
6121
  }), [options?.parent]);
6139
6122
  return (jsxs(BlockWrapper, { className: style('flex flex-col', className), defaultPadding: "p-2xl", ...rest, children: [isIcon(icon) ? (jsx("div", { className: "self-center", children: jsx(Img, { image: icon }) })) : null, title ? (jsx(Heading, { className: style('pt-xs', align), headingType: "h5", title: title })) : null, button?.text ? jsx(LinkButton, { className: "w-full mt-m mb-lg", ...button }) : null, hiddenCells.length ? (jsx(Foldable, { renderFoldableSection: () => (jsxs("div", { children: [visibleCells, jsx(FoldableSection, { isUnfolded: isVisible, children: hiddenCells })] })), renderFoldButton: cardCells.length >= visibleCellsCount
6140
- ? renderFoldButton$1(options?.parent, data, isVisible)
6123
+ ? renderFoldButton$2(options?.parent, data, isVisible)
6141
6124
  : null })) : (jsx("div", { children: visibleCells }))] }));
6142
6125
  });
6143
- const renderFoldButton$1 = (parent, data, isUnfolded = false) => () => (jsxs("button", { className: "w-full cursor-pointer text-primary-main pt-lg flex justify-between items-center", onClick: () => {
6126
+ const renderFoldButton$2 = (parent, data, isUnfolded = false) => () => (jsxs("button", { className: "w-full cursor-pointer text-primary-main pt-lg flex justify-between items-center", onClick: () => {
6144
6127
  if (parent !== undefined) {
6145
6128
  defaultEventBus.fire('fold', { type: 'fold', isUnfolded: !isUnfolded, parent });
6146
6129
  }
@@ -6202,6 +6185,16 @@
6202
6185
 
6203
6186
  const sendSignalToProcess = (body) => doRequest('/user-data/sendSignalToProcess', 'POST', body);
6204
6187
 
6188
+ const useInterval = (handler, period) => {
6189
+ const timer = useRef(null);
6190
+ const clearTimer = useCallback(() => timer.current && clearInterval(timer.current), []);
6191
+ useEffect(() => {
6192
+ timer.current = setInterval(() => handler(clearTimer), period);
6193
+ return clearTimer;
6194
+ }, [handler, period]);
6195
+ return clearTimer;
6196
+ };
6197
+
6205
6198
  const InfoCard = JSX(({ __html, icon = 'InfoCircleIcon', iconVersion = 'black', link }) => (jsxs("div", { className: "flex flex-row items-center w-full min-h-14 bg-main-gray rounded-lg gap-m p-m", children: [jsx("div", { className: "rounded-full bg-white p-xs", children: jsx(Icon, { name: icon, width: "24", height: "24", iconVersion: iconVersion }) }), jsxs("div", { className: "", children: [jsx(RichText, { __html: __html }), link?.text ? jsx(LinkButton, { className: "text-primary-main", children: link.text }) : null] })] })));
6206
6199
 
6207
6200
  const TimerCircle = JSX(({ interval = 0, intervalExpireAction = () => null, title, __html }) => {
@@ -6218,7 +6211,9 @@
6218
6211
  } }), jsx("div", { className: "z-10 flex items-center justify-center px-4 py-2 rounded-full w-20 h-20 bg-white text-primary-text text-m", children: jsx(Timer, { interval: interval, time: time, setTime: setTimeWithHandleExpire }) })] }), __html ? jsx(RichText, { __html: __html }) : null] })] }));
6219
6212
  });
6220
6213
 
6221
- const CreditCardFormStatus = JSX(({ title, description: dsc, infoCard, sectionInfoTitle, sectionInfo, sectionAdditionalTitle, sectionInfoAdditional, buttonText, interval, ...props }) => (jsxs(BlockWrapper, { ...props, children: [jsxs("div", { className: "flex flex-col md:flex-row items-center", children: [jsx(Headline, { headlineVersion: "M", title: title, description: dsc, align: "text-left", padding: "p-xl", className: "w-full" }), interval ? jsx(TimerCircle, { interval: interval }) : null] }), jsx(SectionInfo$1, { title: sectionInfoTitle, items: sectionInfo }), jsx(SectionInfo$1, { title: sectionAdditionalTitle, items: sectionInfoAdditional, countColumns: true }), infoCard?.__html ? (jsx(InfoCard, { __html: infoCard?.__html, icon: infoCard?.icon, link: {
6214
+ const CreditCardFormStatus = JSX(({ title, description: dsc, infoCard, sectionInfoTitle, sectionInfo, sectionAdditionalTitle, sectionInfoAdditional, buttonText, interval, intervalExpireAction = () => {
6215
+ return;
6216
+ }, ...props }) => (jsxs(BlockWrapper, { ...props, children: [jsxs("div", { className: "flex flex-col md:flex-row items-center", children: [jsx(Headline, { headlineVersion: "M", title: title, description: dsc, align: "text-left", padding: "p-xl", className: "w-full" }), interval ? (jsx(TimerCircle, { interval: interval, intervalExpireAction: intervalExpireAction })) : null] }), jsx(SectionInfo$1, { title: sectionInfoTitle, items: sectionInfo }), jsx(SectionInfo$1, { title: sectionAdditionalTitle, items: sectionInfoAdditional, countColumns: true }), infoCard?.__html ? (jsx(InfoCard, { __html: infoCard?.__html, icon: infoCard?.icon, link: {
6222
6217
  text: infoCard?.link?.text,
6223
6218
  } })) : null, buttonText ? (jsx(LinkButton, { href: "/natural", text: buttonText, version: "primary", className: "w-full mt-lg" })) : null] })));
6224
6219
  const SectionInfo$1 = ({ title, items, countColumns = false, }) => {
@@ -6232,9 +6227,9 @@
6232
6227
 
6233
6228
  const FailedStatusContent$1 = JSX(() => (jsx(CreditCardFormStatus, { title: "\u0411\u043B\u0430\u0433\u043E\u0434\u0430\u0440\u0438\u043C \u0412\u0430\u0441 \u0437\u0430 \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u0435", description: "\u0412 \u043D\u0430\u0441\u0442\u043E\u044F\u0449\u0438\u0439 \u043C\u043E\u043C\u0435\u043D\u0442 \u0411\u0430\u043D\u043A \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u043E\u0434\u043E\u0431\u0440\u0438\u0442\u044C \u0412\u0430\u0448\u0443 \u0437\u0430\u044F\u0432\u043A\u0443 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u043F\u043E\u0434\u0430\u0442\u044C \u0437\u0430\u044F\u0432\u043A\u0443 \u043F\u043E\u0437\u0436\u0435. \u0421\u043F\u0430\u0441\u0438\u0431\u043E \u0437\u0430 \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0435 \u0432 \u0410\u041E \u00AB\u0420\u043E\u0441\u0441\u0435\u043B\u044C\u0445\u043E\u0437\u0431\u0430\u043D\u043A\u00BB.", buttonText: "\u0412\u0435\u0440\u043D\u0443\u0442\u044C\u0441\u044F \u043D\u0430 \u0433\u043B\u0430\u0432\u043D\u0443\u044E" })));
6234
6229
 
6235
- const PendingStatusContent$1 = JSX(() => {
6230
+ const PendingStatusContent$1 = JSX(({ handleExpireTimer }) => {
6236
6231
  const [leadForm] = useLocalStorage('leadForm');
6237
- return (jsx(CreditCardFormStatus, { interval: 300, title: "\u0417\u0430\u044F\u0432\u043A\u0430 \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0430", description: "\u041D\u0435 \u0437\u0430\u043A\u0440\u044B\u0432\u0430\u0439\u0442\u0435 \u043E\u043A\u043D\u043E, \u0441\u043A\u043E\u0440\u043E \u0441\u043E\u043E\u0431\u0449\u0438\u043C \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442", sectionInfoTitle: "\u0417\u0430\u044F\u0432\u043B\u0435\u043D\u043D\u044B\u0435 \u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043F\u043E \u043A\u0440\u0435\u0434\u0438\u0442\u0443", sectionInfo: [
6232
+ return (jsx(CreditCardFormStatus, { interval: 300, intervalExpireAction: handleExpireTimer, title: "\u0417\u0430\u044F\u0432\u043A\u0430 \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0430", description: "\u041D\u0435 \u0437\u0430\u043A\u0440\u044B\u0432\u0430\u0439\u0442\u0435 \u043E\u043A\u043D\u043E, \u0441\u043A\u043E\u0440\u043E \u0441\u043E\u043E\u0431\u0449\u0438\u043C \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442", sectionInfoTitle: "\u0417\u0430\u044F\u0432\u043B\u0435\u043D\u043D\u044B\u0435 \u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043F\u043E \u043A\u0440\u0435\u0434\u0438\u0442\u0443", sectionInfo: [
6238
6233
  {
6239
6234
  label: 'Название продукта',
6240
6235
  description: 'Кредитная карта',
@@ -6304,20 +6299,21 @@
6304
6299
  await sendSignalToProcess({ signalType, taskId });
6305
6300
  }
6306
6301
  })();
6307
- const trackStatus = useCallback(async () => {
6308
- const res = await getTaskStatus({ taskId });
6309
- if (res && res?.statusCd !== STATUS_TYPE.process) {
6310
- clearInterval(pullingInterval);
6311
- setStatus(res.statusCd);
6312
- }
6313
- }, []);
6314
- const pullingInterval = setInterval(trackStatus, 30000);
6315
- }, []);
6316
- return renderStatus$1(status);
6302
+ }, [taskId]);
6303
+ const trackStatus = useCallback(async (stopInterval) => {
6304
+ const res = await getTaskStatus({ taskId });
6305
+ if (res && res?.statusCd !== STATUS_TYPE.process) {
6306
+ stopInterval();
6307
+ setStatus(res.statusCd);
6308
+ }
6309
+ }, [taskId]);
6310
+ useInterval(trackStatus, 30000);
6311
+ const handleExpire = () => setStatus(STATUS_TYPE.rework);
6312
+ return renderStatus$1(status, handleExpire);
6317
6313
  });
6318
- const renderStatus$1 = (status) => {
6314
+ const renderStatus$1 = (status, handleExpire) => {
6319
6315
  const statusesMap = {
6320
- IN_PROCESS: jsx(PendingStatusContent$1, {}),
6316
+ IN_PROCESS: jsx(PendingStatusContent$1, { handleExpireTimer: handleExpire }),
6321
6317
  CANCELLED: jsx(FailedStatusContent$1, {}),
6322
6318
  APPROVED: jsx(SuccessStatusContent$1, {}),
6323
6319
  REVISION: jsx(ReworkStatusContent$1, {}),
@@ -6469,12 +6465,12 @@
6469
6465
  : null;
6470
6466
  };
6471
6467
 
6472
- const renderInputs$1 = ({ field, inputs }) => inputs.map(getField(field, ''));
6468
+ const renderInputs$1 = ({ field, inputs, params }) => inputs.map(getField(field, params));
6473
6469
 
6474
- const renderStep$2 = ({ sections, field, step }) => sections?.map(({ inputs: origInputs = [], columns, title }, i) => {
6470
+ const renderStep$2 = ({ sections, field, step, params }) => sections?.map(({ inputs: origInputs = [], columns, title }, i) => {
6475
6471
  const inputs = calculateInputs$1(getValue$3(field))(origInputs, step);
6476
6472
  const filteredInputs = inputs.filter((_) => !checkCondition$1(_, getValue$3(field)));
6477
- return (jsxs("div", { className: style(inputColumnStyles(columns), 'grid gap-x-m'), children: [renderInfo$2(filteredInputs), renderTitle(title), renderInputs$1({ field, inputs })] }, `section-${i}`));
6473
+ return (jsxs("div", { className: style(inputColumnStyles(columns), 'grid gap-x-m'), children: [renderInfo$2(filteredInputs), renderTitle(title), renderInputs$1({ field, inputs, params })] }, `section-${i}`));
6478
6474
  });
6479
6475
  const getValue$3 = (field) => (name) => field(name)?.value;
6480
6476
 
@@ -6694,11 +6690,7 @@
6694
6690
  const CreditCardFormStep = JSX(({ step, sections, onPrevStep, onNextStep, isFormFinished, finishForm }) => {
6695
6691
  const [localStorageData, saveStep] = useLocalStorage('leadForm');
6696
6692
  const initialState = getInitialFormState$1(step, localStorageData);
6697
- const customSubmit = useRef(undefined);
6698
6693
  const inputs = (sections?.flatMap((_) => _?.inputs) || []);
6699
- const registerSubmit = useCallback((submit) => {
6700
- customSubmit.current = submit;
6701
- }, []);
6702
6694
  const { handleSubmit } = useCreditCardFormAPI({
6703
6695
  step,
6704
6696
  inputs,
@@ -6707,16 +6699,9 @@
6707
6699
  finishForm,
6708
6700
  });
6709
6701
  const [, { field, onSubmit }] = useForm(initialState, {
6710
- onSubmit: (formData, ev) => {
6711
- handleSubmit({ ...formData, ...customSubmit.current?.(ev) });
6712
- },
6702
+ onSubmit: handleSubmit,
6713
6703
  });
6714
- return isFormFinished ? (jsx(CreditCardFormStatusTracker, {})) : (jsxs("form", { onSubmit: onSubmit, className: "space-y-m", children: [renderStep$2({
6715
- sections,
6716
- field,
6717
- step,
6718
- registerSubmit,
6719
- }), jsx(StepsNavigationButtons$1, { step: step, onPrevStep: onPrevStep })] }));
6704
+ return isFormFinished ? (jsx(CreditCardFormStatusTracker, {})) : (jsxs("form", { onSubmit: onSubmit, className: "space-y-m", children: [renderStep$2({ sections, field, step }), jsx(StepsNavigationButtons$1, { step: step, onPrevStep: onPrevStep })] }));
6720
6705
  });
6721
6706
 
6722
6707
  /* eslint-disable max-lines */
@@ -7059,8 +7044,8 @@
7059
7044
  ],
7060
7045
  ];
7061
7046
 
7062
- const WIZARD_STEPS$1 = 6;
7063
- const WIZARD_TITLES$1 = [
7047
+ const STEPS$1 = 6;
7048
+ const TITLES = [
7064
7049
  'Параметры карты',
7065
7050
  'Персональные данные',
7066
7051
  'Данные о трудоустройстве',
@@ -7074,7 +7059,7 @@
7074
7059
  const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
7075
7060
  useEffect(updateRefreshToken, []);
7076
7061
  const handleNextStep = useCallback(() => {
7077
- setStep((_) => Math.min(_ + 1, WIZARD_STEPS$1));
7062
+ setStep((_) => Math.min(_ + 1, STEPS$1));
7078
7063
  scrollToTop();
7079
7064
  }, []);
7080
7065
  const handlePrevStep = useCallback(() => {
@@ -7084,7 +7069,7 @@
7084
7069
  }, []);
7085
7070
  const sections = useMemo(() => stepsSectionsMap$1[step], [step]);
7086
7071
  const [isFormFinished, setIsFormFinished] = useState(false);
7087
- return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { ref: formContainerRef, className: "container grid grid-cols-12", children: [isFormFinished ? null : (jsx(CreditCardFormProgress, { stepsTitles: WIZARD_TITLES$1, step: step, totalSteps: WIZARD_STEPS$1 })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditCardFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished }, String(step)) })] }) }));
7072
+ return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { ref: formContainerRef, className: "container grid grid-cols-12", children: [isFormFinished ? null : (jsx(CreditCardFormProgress, { stepsTitles: TITLES, step: step, totalSteps: STEPS$1 })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditCardFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished }, String(step)) })] }) }));
7088
7073
  });
7089
7074
 
7090
7075
  const CreditFormProgress = JSX(({ step = 1, totalSteps = 5, stepsTitles = [] }) => {
@@ -7194,16 +7179,15 @@
7194
7179
  await sendSignalToProcess({ signalType, taskId });
7195
7180
  }
7196
7181
  })();
7197
- const trackStatus = () => taskId &&
7198
- getTaskStatus({ taskId }).then((res) => {
7199
- if (res?.statusCd && res.statusCd !== STATUS_TYPE.process) {
7200
- clearInterval(pullingInterval);
7201
- setStatus(res.statusCd);
7202
- }
7203
- });
7204
- const pullingInterval = setInterval(trackStatus, 30000);
7205
- return () => clearInterval(pullingInterval);
7206
- }, []);
7182
+ }, [taskId]);
7183
+ const trackStatus = useCallback(async (stopInterval) => {
7184
+ const res = await getTaskStatus({ taskId });
7185
+ if (res && res?.statusCd !== STATUS_TYPE.process) {
7186
+ stopInterval();
7187
+ setStatus(res.statusCd);
7188
+ }
7189
+ }, [taskId]);
7190
+ useInterval(trackStatus, 30000);
7207
7191
  const handleExpire = () => setStatus(STATUS_TYPE.rework);
7208
7192
  return renderStatus(status, handleExpire);
7209
7193
  });
@@ -7219,13 +7203,15 @@
7219
7203
 
7220
7204
  const formStateMap = [
7221
7205
  {
7222
- moneyValue: 0,
7223
- monthsValue: 0,
7224
- isAnnuity: false,
7225
- isInsurance: false,
7226
- isSalaryClient: false,
7227
- isPensionClient: false,
7228
- isStateEmployee: false,
7206
+ calculator: {
7207
+ moneyValue: 0,
7208
+ monthsValue: 0,
7209
+ isAnnuity: false,
7210
+ isInsurance: false,
7211
+ isSalaryClient: false,
7212
+ isPensionClient: false,
7213
+ isStateEmployee: false,
7214
+ },
7229
7215
  },
7230
7216
  {
7231
7217
  surname: '',
@@ -7351,11 +7337,11 @@
7351
7337
  : null;
7352
7338
  };
7353
7339
 
7354
- const renderInputs = ({ field, inputs }) => inputs.map(getField(field, ''));
7340
+ const renderInputs = ({ field, inputs, params }) => inputs.map(getField(field, params));
7355
7341
 
7356
- const renderStep$1 = ({ sections, field, step }) => sections?.map(({ inputs: origInputs = [], columns, title }, i) => {
7342
+ const renderStep$1 = ({ sections, field, step, params }) => sections?.map(({ inputs: origInputs = [], columns, title }, i) => {
7357
7343
  const inputs = calculateInputs(getValue$1(field))(origInputs, step);
7358
- return (jsxs("div", { className: style(inputColumnStyles(columns), 'grid gap-x-m'), children: [renderInfo$1(inputs), renderTitle(title), renderInputs({ field, inputs })] }, `section-${i}`));
7344
+ return (jsxs("div", { className: style(inputColumnStyles(columns), 'grid gap-x-m'), children: [renderInfo$1(inputs), renderTitle(title), renderInputs({ field, inputs, params })] }, `section-${i}`));
7359
7345
  });
7360
7346
  const getValue$1 = (field) => (name) => field(name)?.value;
7361
7347
 
@@ -7365,6 +7351,19 @@
7365
7351
  return (jsxs("div", { className: 'flex justify-between gap-m', children: [jsx(Button, { onClick: onPrevStep, type: "button", version: "secondary", disabled: isFirstStep, children: "\u041D\u0430\u0437\u0430\u0434" }), jsx(Button, { type: "submit", children: isFinalStep ? 'Отправить заявку' : 'Далее' })] }));
7366
7352
  });
7367
7353
 
7354
+ const PAYMENT_TYPE_DATA = {
7355
+ annuity: { key: 'ANNUITY', value: 'Аннуитетный' },
7356
+ differential: { key: 'DIFFERENTIAL', value: 'Дифференцированный ' },
7357
+ };
7358
+ const getCalcData = (formData) => {
7359
+ const { moneyValue, monthsValue, isAnnuity } = formData?.calculator ?? {};
7360
+ return {
7361
+ loanAmount: moneyValue,
7362
+ creditPeriod: monthsValue,
7363
+ paymentTypeCd: PAYMENT_TYPE_DATA[isAnnuity ? 'annuity' : 'differential'],
7364
+ };
7365
+ };
7366
+
7368
7367
  const getFifthStepData = (formData) => {
7369
7368
  const { addressRetail } = formData;
7370
7369
  return {
@@ -7427,7 +7426,6 @@
7427
7426
  generalSeniority: experience5Years,
7428
7427
  jobsNumber,
7429
7428
  lastWorkDuration: lastJobExperience,
7430
- payrollCardRshbFlg: true,
7431
7429
  positionCd: positionOrganization,
7432
7430
  participantContacts: getParticipantContacts({
7433
7431
  organizationPhone: organizationPhone && formatPhone(organizationPhone),
@@ -7460,16 +7458,11 @@
7460
7458
  };
7461
7459
  };
7462
7460
 
7463
- const PAYMENT_TYPE_DATA = {
7464
- annuity: { key: 'ANNUITY', value: 'Аннуитетный' },
7465
- differential: { key: 'DIFFERENTIAL', value: 'Дифференцированный ' },
7466
- };
7467
7461
  const getZeroStepData = (formData) => {
7468
- const { moneyValue, monthsValue, isAnnuity } = formData;
7462
+ const { isInsurance, isSalaryClient } = formData?.calculator ?? {};
7469
7463
  return {
7470
- loanAmount: moneyValue,
7471
- creditPeriod: monthsValue,
7472
- paymentTypeCd: PAYMENT_TYPE_DATA[isAnnuity ? 'annuity' : 'differential'],
7464
+ payrollCardRshbFlg: isInsurance,
7465
+ consentInsuranceFlg: isSalaryClient,
7473
7466
  };
7474
7467
  };
7475
7468
 
@@ -7495,7 +7488,7 @@
7495
7488
  ...getCurrentStepData(step, formData),
7496
7489
  },
7497
7490
  ],
7498
- ...getZeroStepData(formData),
7491
+ ...getCalcData(formData),
7499
7492
  ...getFifthStepData(formData),
7500
7493
  esiaAccountTypeCd: {
7501
7494
  key: formData?.esiaAccountTypeCd?.key,
@@ -7506,7 +7499,7 @@
7506
7499
  const getCurrentStepData = (step, formData) => {
7507
7500
  switch (step) {
7508
7501
  case 0:
7509
- return {};
7502
+ return getZeroStepData(formData);
7510
7503
  case 1:
7511
7504
  return getFirstStepData(formData);
7512
7505
  case 2:
@@ -7556,14 +7549,12 @@
7556
7549
  };
7557
7550
  const getValue = (formData) => (name) => formData[name];
7558
7551
 
7559
- const CreditFormStep = JSX(({ step, sections, onPrevStep, onNextStep, renderStep = renderStep$1, isFormFinished, finishForm, }) => {
7552
+ const CreditFormStep = JSX(({ step, sections, onPrevStep, onNextStep, isFormFinished, finishForm, programsSource }) => {
7560
7553
  const [localStorageData, saveStep] = useLocalStorage('leadForm');
7554
+ const [programId] = useLocalStorage('programId');
7555
+ const calcData = programsSource?.[programId ?? '']; // Need normalizator useForm, to be save defaultParams
7561
7556
  const initialState = getInitialFormState(step, localStorageData);
7562
- const customSubmit = useRef(undefined);
7563
7557
  const inputs = (sections?.flatMap((_) => _?.inputs) || []);
7564
- const registerSubmit = useCallback((submit) => {
7565
- customSubmit.current = submit;
7566
- }, []);
7567
7558
  const { handleSubmit } = useCreditFormAPI({
7568
7559
  step,
7569
7560
  inputs,
@@ -7572,18 +7563,24 @@
7572
7563
  finishForm,
7573
7564
  });
7574
7565
  const [, { field, onSubmit }] = useForm(initialState, {
7575
- onSubmit: (formData, ev) => {
7576
- handleSubmit({ ...formData, ...customSubmit.current?.(ev) });
7577
- },
7566
+ onSubmit: handleSubmit,
7578
7567
  });
7579
- return isFormFinished ? (jsx(CreditFormStatusTracker, {})) : (jsxs("form", { onSubmit: onSubmit, className: "space-y-m", children: [renderStep({ sections, field, step, registerSubmit }), jsx(StepsNavigationButtons, { step: step, onPrevStep: onPrevStep })] }));
7568
+ return isFormFinished ? (jsx(CreditFormStatusTracker, {})) : (jsxs("form", { onSubmit: onSubmit, className: "space-y-m", children: [renderStep$1({ sections, field, step, params: { calcData } }), jsx(StepsNavigationButtons, { step: step, onPrevStep: onPrevStep })] }));
7580
7569
  });
7581
7570
 
7582
7571
  /* eslint-disable max-lines */
7583
7572
  /* eslint-disable max-len */
7584
7573
  const stepsSectionsMap = [
7585
7574
  [
7586
- // zero step for calculator
7575
+ {
7576
+ columns: 1,
7577
+ inputs: [
7578
+ {
7579
+ fieldType: 'common',
7580
+ name: 'calculator',
7581
+ },
7582
+ ],
7583
+ },
7587
7584
  ],
7588
7585
  [
7589
7586
  {
@@ -7853,8 +7850,8 @@
7853
7850
  ],
7854
7851
  ];
7855
7852
 
7856
- const WIZARD_STEPS = 5;
7857
- const WIZARD_TITLES = [
7853
+ const STEPS = 5;
7854
+ const STEP_TITLES = [
7858
7855
  '',
7859
7856
  'Персональные данные',
7860
7857
  'Данные о трудоустройстве',
@@ -7862,13 +7859,13 @@
7862
7859
  'Дополнительные сведения',
7863
7860
  'Отделение Банка',
7864
7861
  ];
7865
- const CreditForm = JSX(({ className, ...rest }) => {
7862
+ const CreditForm = UniBlock(({ className, programsSource, ...rest }) => {
7866
7863
  const [step, setStep] = useState(0);
7867
7864
  const formContainerRef = useRef(null);
7868
7865
  const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
7869
7866
  useEffect(updateRefreshToken, []);
7870
7867
  const handleNextStep = useCallback(() => {
7871
- setStep((_) => Math.min(_ + 1, WIZARD_STEPS));
7868
+ setStep((_) => Math.min(_ + 1, STEPS));
7872
7869
  scrollToTop();
7873
7870
  }, []);
7874
7871
  const handlePrevStep = useCallback(() => {
@@ -7879,20 +7876,7 @@
7879
7876
  const sections = useMemo(() => stepsSectionsMap[step], [step]);
7880
7877
  const isStartStep = step === 0;
7881
7878
  const [isFormFinished, setIsFormFinished] = useState(false);
7882
- return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { ref: formContainerRef, className: "container grid grid-cols-12", children: [isStartStep || isFormFinished ? null : (jsx(CreditFormProgress, { stepsTitles: WIZARD_TITLES, step: step, totalSteps: WIZARD_STEPS })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished, renderStep: isStartStep
7883
- ? ({ registerSubmit, field }) => (jsx(CalculatorCredit, { ...{
7884
- defaultParams: {
7885
- sum: field('moneyValue').value,
7886
- period: field('monthsValue').value,
7887
- isAnnuity: field('isAnnuity').value,
7888
- },
7889
- title: 'Калькулятор кредита',
7890
- footnote: 'Расчёт является предварительным. Точные условия будут предоставлены в отделении Банка.',
7891
- calcSource: {
7892
- $ref: '/wcms-resources/credit-calculator-data.json',
7893
- },
7894
- }, registerSubmit: registerSubmit }))
7895
- : undefined }, String(step)) })] }) }));
7879
+ return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { ref: formContainerRef, className: "container grid grid-cols-12", children: [isStartStep || isFormFinished ? null : (jsx(CreditFormProgress, { stepsTitles: STEP_TITLES, step: step, totalSteps: STEPS })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished, programsSource: programsSource }, String(step)) })] }) }));
7896
7880
  });
7897
7881
 
7898
7882
  const isRateRow = (rateRow) => typeof rateRow?.minMonths === 'number' && typeof rateRow?.maxMonths === 'number';
@@ -9264,6 +9248,8 @@
9264
9248
  return (jsx(BlockWrapper, { className: style('min-h-80', className), padding: "p-0", version: version, ...rest, children: jsxs(BaseTile, { className: "h-full", padding: padding, defaultPadding: "p-6xl", title: jsx(Heading, { headingType: headingType, title: title, className: style('whitespace-pre-wrap', align) }), rightImage: img, buttons: renderButtonsSection(buttons, { className: 'flex-wrap' }), children: [description ? (jsx(Text, { size: "text-xl", "font-weight": "font-light", children: description })) : null, jsxs("div", { className: style('gap-m', 'flex flex-1 flex-col', 'flex-col items-start @xl:flex-row @xl:items-center'), children: [__html ? jsx(RichText, { __html: __html, itemSize: "list-m" }) : null, jsx(Text, { size: "text-m", "font-weight": "font-light", color: "text-secondary-text", children: additionalDescription }), qr?.src ? (jsx("div", { className: style('flex justify-center bg-white rounded-md @xl:-order-1', containerStyle), children: jsx(Img, { className: "w-fit", image: qr }) })) : null, image?.src ? jsx(Img, { className: "lg:hidden", image: image }) : null] })] }) }));
9265
9249
  });
9266
9250
 
9251
+ const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
9252
+
9267
9253
  const getBadgeCount = (blocks = [], filter = {}) => blocks.filter(({ content = {} }) => targetMatchPattern(filter, content)).length;
9268
9254
 
9269
9255
  const scalarCmp = (a, b) => a === b;
@@ -9409,6 +9395,63 @@
9409
9395
  childSchema: (content) => content?.filtrationSchema || {},
9410
9396
  });
9411
9397
 
9398
+ const renderButtonsGroup = (data, activeButton, onButtonClick) => {
9399
+ const allButtonVersion = getVersion(activeButton === 'all');
9400
+ const businessButtonVersion = getVersion(activeButton === 'business');
9401
+ const handleClick = (e, key, branches) => {
9402
+ const filteredBranches = e.currentTarget === e.target && key === 'business' ? filterBranches(branches) : branches;
9403
+ onButtonClick(key);
9404
+ return filteredBranches;
9405
+ };
9406
+ const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
9407
+ branch.workSchedule.businessScheduleVisibleTag &&
9408
+ !branch.workSchedule.businessScheduleDescription);
9409
+ return (jsxs("div", { className: "flex gap-lg flex-col sm:flex-row pb-lg", children: [jsx(Button, { "data-id": "all", onClick: (e) => handleClick(e, 'all', data), version: allButtonVersion, children: "\u0414\u043B\u044F \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" }), jsx(Button, { "data-id": "business", onClick: (e) => handleClick(e, 'business', data), version: businessButtonVersion, children: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" })] }));
9410
+ };
9411
+
9412
+ const renderDescriptionBlock$1 = ({ __html, list, richVersion }) => __html || list?.length ? (jsxs("div", { className: "mb-2xl border-b sm:border border-main-divider sm:rounded-md", children: [__html ? (jsx("div", { className: "mb-2xl", children: jsx(RichText, { __html: __html, richVersion: richVersion }) })) : null, list?.length ? (jsx("div", { className: "flex flex-col sm:flex-row gap-2xl sm:flex-wrap pb-2xl sm:pb-xl", children: list.map((item, i) => (jsxs("div", { className: "flex gap-xs items-center", children: [item?.image ? jsx(Img, { image: item.image }) : null, item?.text ? (jsx(Text, { size: "text-m", font: "font-light", children: item.text })) : null] }, String(i)))) })) : null] })) : null;
9413
+
9414
+ const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
9415
+ const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
9416
+ const visibleFiltersNum = onlyOffice ? 5 : 6;
9417
+ const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
9418
+ const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
9419
+ ? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
9420
+ : [filtersCheckbox, []];
9421
+ return (jsx("div", { children: filters?.length ? (jsx("div", { children: jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => (jsxs("div", { children: [jsx("div", { className: COMMON_FILTERS_STYLES, children: visibleFilters }), jsx(FoldableSection, { className: COMMON_FILTERS_STYLES, isUnfolded: isUnfolded, children: hiddenFilters })] })), renderFoldButton: renderFoldButton$1(reset, onlyOffice) }) })) : null }));
9422
+ };
9423
+ const renderFoldButton$1 = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
9424
+ const labels = ['Больше фильтров', 'Меньше фильтров'];
9425
+ const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
9426
+ return (jsxs("div", { className: "flex space-x-lg", children: [onlyOffice ? (jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", appendRight: jsx(Icon, { name: icons[Number(isUnfolded)], width: "16", height: "16" }), text: labels[Number(isUnfolded)], onClick: onToggle })) : null, jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", onClick: reset, children: renderBtnInner() })] }));
9427
+ };
9428
+ const renderBtnInner = () => (jsxs("div", { className: "flex items-center", children: ["\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440", jsx(Icon, { name: "CloseIcon", width: "16", height: "16", className: "ml-2xs" })] }));
9429
+
9430
+ const renderHeading = (title, lengthItems) => (jsx("div", { className: "flex flex-col sm:flex-row gap-xs mb-2xl", children: jsxs(Heading, { headingType: "h3", children: [jsx("span", { suppressHydrationWarning: true, children: title }), lengthItems ? (jsx(Text, { size: "text-h2", color: "text-secondary-text", children: jsx("span", { suppressHydrationWarning: true, children: ` (${lengthItems})` }) })) : null] }) }));
9431
+
9432
+ const defaultEmptyFunction = () => void 0;
9433
+ const filtersVisibleStyles = (activeButton) => activeButton === 'all' ? 'block' : 'hidden';
9434
+ const OfficesAtmsMapLayout = JSX(({ className, data = [], isLoad, remoteWorkplaces = [], renderCard = defaultEmptyFunction, renderRemoteWorkplaceCard = defaultEmptyFunction, getBalloon = defaultEmptyFunction, getBalloonRemoteWorkplaces = defaultEmptyFunction, descriptionData, title, }) => {
9435
+ const onlyOffice = title?.includes('Офис');
9436
+ const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE$1);
9437
+ const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
9438
+ data,
9439
+ remoteWorkplaces,
9440
+ filtrationState,
9441
+ getBalloon,
9442
+ getBalloonRemoteWorkplaces,
9443
+ });
9444
+ const [activeButton, setActiveButton] = useState('all');
9445
+ const filterOptions = {
9446
+ filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
9447
+ field: { field, reset },
9448
+ onlyOffice,
9449
+ labels: FILTRATION_LABELS,
9450
+ };
9451
+ return (jsxs("div", { className: style('space-y-1', className), children: [jsxs("div", { className: "bg-white", children: [jsxs("div", { className: "p-3xl pb-0", children: [renderHeading(title, lengthItems), descriptionData ? renderDescriptionBlock$1(descriptionData) : null, onlyOffice && renderButtonsGroup(data, activeButton, setActiveButton), jsx("div", { className: style('pb-3xl', filtersVisibleStyles(activeButton)), children: renderFiltrationForm(filterOptions) })] }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: isLoad, className: "h-full" }) }) })] }), jsxs(ClientOnly, { children: [filteredItems.map(renderCard), filteredRemoteWorkplaces.map(renderRemoteWorkplaceCard)] })] }));
9452
+ });
9453
+ const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
9454
+
9412
9455
  const renderAtmCard = ({ location, address, billAcceptorType, terminalType, billAcceptorEnable, atmCode = '', atmAccess = '', workTime, }, i) => {
9413
9456
  const additionalInfo = [
9414
9457
  {
@@ -10326,7 +10369,7 @@
10326
10369
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
10327
10370
  });
10328
10371
 
10329
- const packageVersion = "0.14.682";
10372
+ const packageVersion = "0.14.683";
10330
10373
 
10331
10374
  exports.Blocks = Blocks;
10332
10375
  exports.ContentPage = ContentPage;