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

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 (593) hide show
  1. package/bundle/api/RetailAPI/getCardTypes.d.ts +1 -1
  2. package/bundle/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  3. package/bundle/api/RetailAPI/updateUserProfile.d.ts +1 -2
  4. package/bundle/api/RetailAPI/updateUserTask.d.ts +5 -4
  5. package/bundle/blocks.schema.json +1 -1
  6. package/bundle/bundle.umd.js +740 -681
  7. package/bundle/bundle.umd.min.js +1 -1
  8. package/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +13 -7
  9. package/bundle/components/CalculatorCredit/CalculatorCredit.d.ts +2 -3
  10. package/bundle/components/CalculatorCredit/defaultValueAdapter.d.ts +11 -0
  11. package/bundle/components/CreditCardForm/CreditCardFormStatus.d.ts +1 -0
  12. package/bundle/components/CreditCardForm/PendingStatusContent.d.ts +3 -1
  13. package/bundle/components/CreditCardForm/renderInputs.d.ts +2 -1
  14. package/bundle/components/CreditCardForm/renderStep.d.ts +2 -2
  15. package/bundle/components/CreditForm/CreditForm.d.ts +5 -2
  16. package/bundle/components/CreditForm/CreditFormContent.d.ts +4 -5
  17. package/bundle/components/CreditForm/CreditFormStep.d.ts +2 -3
  18. package/bundle/components/CreditForm/ProgramsSourceProps.d.ts +16 -0
  19. package/bundle/components/CreditForm/getCalcData.d.ts +3 -0
  20. package/bundle/components/CreditForm/getZeroStepData.d.ts +1 -1
  21. package/bundle/components/CreditForm/renderInputs.d.ts +2 -1
  22. package/bundle/components/CreditForm/renderStep.d.ts +2 -2
  23. package/bundle/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  24. package/bundle/components/OfficesAtmsMap/filterItems.d.ts +2 -0
  25. package/bundle/ui-kit/FormField/CustomFieldProps.d.ts +1 -0
  26. package/bundle/ui-kit/FormField/Fields/CreditCalcField.d.ts +2 -0
  27. package/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  28. package/bundle/ui-kit/FormField/getField.d.ts +1 -1
  29. package/dist/api/RetailAPI/getCardTypes.d.ts +1 -1
  30. package/dist/api/RetailAPI/getCardTypes.js +4 -5
  31. package/dist/api/RetailAPI/getCardTypes.js.map +1 -1
  32. package/dist/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  33. package/dist/api/RetailAPI/getPaymentSystems.js +3 -4
  34. package/dist/api/RetailAPI/getPaymentSystems.js.map +1 -1
  35. package/dist/api/RetailAPI/updateUserProfile.d.ts +1 -2
  36. package/dist/api/RetailAPI/updateUserProfile.js +1 -1
  37. package/dist/api/RetailAPI/updateUserProfile.js.map +1 -1
  38. package/dist/api/RetailAPI/updateUserTask.d.ts +5 -4
  39. package/dist/api/RetailAPI/updateUserTask.js +1 -1
  40. package/dist/api/RetailAPI/updateUserTask.js.map +1 -1
  41. package/dist/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  42. package/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  43. package/dist/components/ApplicationForm/ApplicationForm.js +1 -1
  44. package/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  45. package/dist/components/ApplicationForm/renderInputs.js +1 -1
  46. package/dist/components/ApplicationForm/renderInputs.js.map +1 -1
  47. package/dist/components/ApplicationLeadForm/GroupedConsents.js +1 -1
  48. package/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  49. package/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +13 -7
  50. package/dist/components/ApplicationLeadForm/getInitialFormState.js +0 -1
  51. package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  52. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +15 -8
  53. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  54. package/dist/components/CalculatorCredit/CalculatorCredit.d.ts +2 -3
  55. package/dist/components/CalculatorCredit/CalculatorCredit.js +5 -3
  56. package/dist/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
  57. package/dist/components/CalculatorCredit/defaultValueAdapter.d.ts +11 -0
  58. package/dist/components/CalculatorCredit/defaultValueAdapter.js +18 -0
  59. package/dist/components/CalculatorCredit/defaultValueAdapter.js.map +1 -0
  60. package/dist/components/CreditCardForm/CreditCardForm.js +4 -4
  61. package/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
  62. package/dist/components/CreditCardForm/CreditCardFormStatus.d.ts +1 -0
  63. package/dist/components/CreditCardForm/CreditCardFormStatus.js +3 -1
  64. package/dist/components/CreditCardForm/CreditCardFormStatus.js.map +1 -1
  65. package/dist/components/CreditCardForm/CreditCardFormStatusTracker.js +14 -12
  66. package/dist/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
  67. package/dist/components/CreditCardForm/CreditCardFormStep.js +2 -14
  68. package/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  69. package/dist/components/CreditCardForm/PendingStatusContent.d.ts +3 -1
  70. package/dist/components/CreditCardForm/PendingStatusContent.js +2 -2
  71. package/dist/components/CreditCardForm/PendingStatusContent.js.map +1 -1
  72. package/dist/components/CreditCardForm/renderInputs.d.ts +2 -1
  73. package/dist/components/CreditCardForm/renderInputs.js +1 -1
  74. package/dist/components/CreditCardForm/renderInputs.js.map +1 -1
  75. package/dist/components/CreditCardForm/renderStep.d.ts +2 -2
  76. package/dist/components/CreditCardForm/renderStep.js +2 -2
  77. package/dist/components/CreditCardForm/renderStep.js.map +1 -1
  78. package/dist/components/CreditForm/CreditForm.d.ts +5 -2
  79. package/dist/components/CreditForm/CreditForm.js +6 -20
  80. package/dist/components/CreditForm/CreditForm.js.map +1 -1
  81. package/dist/components/CreditForm/CreditFormContent.d.ts +4 -5
  82. package/dist/components/CreditForm/CreditFormStatusTracker.js +10 -10
  83. package/dist/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
  84. package/dist/components/CreditForm/CreditFormStep.d.ts +2 -3
  85. package/dist/components/CreditForm/CreditFormStep.js +5 -10
  86. package/dist/components/CreditForm/CreditFormStep.js.map +1 -1
  87. package/dist/components/CreditForm/ProgramsSourceProps.d.ts +16 -0
  88. package/dist/components/CreditForm/ProgramsSourceProps.js +2 -0
  89. package/dist/components/CreditForm/ProgramsSourceProps.js.map +1 -0
  90. package/dist/components/CreditForm/creditFormStepsData.js +9 -1
  91. package/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  92. package/dist/components/CreditForm/formStateMap.js +9 -7
  93. package/dist/components/CreditForm/formStateMap.js.map +1 -1
  94. package/dist/components/CreditForm/getCalcData.d.ts +3 -0
  95. package/dist/components/CreditForm/getCalcData.js +16 -0
  96. package/dist/components/CreditForm/getCalcData.js.map +1 -0
  97. package/dist/components/CreditForm/getCreditFormTaskData.js +3 -2
  98. package/dist/components/CreditForm/getCreditFormTaskData.js.map +1 -1
  99. package/dist/components/CreditForm/getSecondStepData.js +0 -1
  100. package/dist/components/CreditForm/getSecondStepData.js.map +1 -1
  101. package/dist/components/CreditForm/getZeroStepData.d.ts +1 -1
  102. package/dist/components/CreditForm/getZeroStepData.js +3 -8
  103. package/dist/components/CreditForm/getZeroStepData.js.map +1 -1
  104. package/dist/components/CreditForm/renderInputs.d.ts +2 -1
  105. package/dist/components/CreditForm/renderInputs.js +1 -1
  106. package/dist/components/CreditForm/renderInputs.js.map +1 -1
  107. package/dist/components/CreditForm/renderStep.d.ts +2 -2
  108. package/dist/components/CreditForm/renderStep.js +2 -2
  109. package/dist/components/CreditForm/renderStep.js.map +1 -1
  110. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  111. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +1 -6
  112. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  113. package/dist/components/OfficesAtmsMap/filterItems.d.ts +2 -0
  114. package/dist/components/OfficesAtmsMap/filterItems.js +9 -0
  115. package/dist/components/OfficesAtmsMap/filterItems.js.map +1 -0
  116. package/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js +3 -3
  117. package/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -1
  118. package/dist/hooks/useJSONRef/useJSONRef.js +13 -3
  119. package/dist/hooks/useJSONRef/useJSONRef.js.map +1 -1
  120. package/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +14 -9
  121. package/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
  122. package/dist/ui-kit/FormField/CustomFieldProps.d.ts +1 -0
  123. package/dist/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
  124. package/dist/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  125. package/dist/ui-kit/FormField/Fields/CreditCalcField.d.ts +2 -0
  126. package/dist/ui-kit/FormField/Fields/CreditCalcField.js +15 -0
  127. package/dist/ui-kit/FormField/Fields/CreditCalcField.js.map +1 -0
  128. package/dist/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
  129. package/dist/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  130. package/dist/ui-kit/FormField/Fields/RegionField.js +3 -1
  131. package/dist/ui-kit/FormField/Fields/RegionField.js.map +1 -1
  132. package/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  133. package/dist/ui-kit/FormField/SelectField.js +4 -6
  134. package/dist/ui-kit/FormField/SelectField.js.map +1 -1
  135. package/dist/ui-kit/FormField/getField.d.ts +1 -1
  136. package/dist/ui-kit/FormField/getField.js +5 -4
  137. package/dist/ui-kit/FormField/getField.js.map +1 -1
  138. package/dist/ui-kit/FormField/getObjectValidator.js +2 -0
  139. package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  140. package/lib/api/RetailAPI/getCardTypes.d.ts +1 -1
  141. package/lib/api/RetailAPI/getCardTypes.js +5 -6
  142. package/lib/api/RetailAPI/getCardTypes.js.map +1 -1
  143. package/lib/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  144. package/lib/api/RetailAPI/getPaymentSystems.js +4 -5
  145. package/lib/api/RetailAPI/getPaymentSystems.js.map +1 -1
  146. package/lib/api/RetailAPI/updateUserProfile.d.ts +1 -2
  147. package/lib/api/RetailAPI/updateUserProfile.js +2 -2
  148. package/lib/api/RetailAPI/updateUserProfile.js.map +1 -1
  149. package/lib/api/RetailAPI/updateUserTask.d.ts +5 -4
  150. package/lib/api/RetailAPI/updateUserTask.js +2 -2
  151. package/lib/api/RetailAPI/updateUserTask.js.map +1 -1
  152. package/lib/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  153. package/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  154. package/lib/components/ApplicationForm/ApplicationForm.js +1 -1
  155. package/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  156. package/lib/components/ApplicationForm/renderInputs.js +1 -1
  157. package/lib/components/ApplicationForm/renderInputs.js.map +1 -1
  158. package/lib/components/ApplicationLeadForm/GroupedConsents.js +1 -1
  159. package/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  160. package/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +13 -7
  161. package/lib/components/ApplicationLeadForm/getInitialFormState.js +0 -1
  162. package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  163. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +15 -8
  164. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  165. package/lib/components/CalculatorCredit/CalculatorCredit.d.ts +2 -3
  166. package/lib/components/CalculatorCredit/CalculatorCredit.js +5 -3
  167. package/lib/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
  168. package/lib/components/CalculatorCredit/defaultValueAdapter.d.ts +11 -0
  169. package/lib/components/CalculatorCredit/defaultValueAdapter.js +15 -0
  170. package/lib/components/CalculatorCredit/defaultValueAdapter.js.map +1 -0
  171. package/lib/components/CreditCardForm/CreditCardForm.js +4 -4
  172. package/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
  173. package/lib/components/CreditCardForm/CreditCardFormStatus.d.ts +1 -0
  174. package/lib/components/CreditCardForm/CreditCardFormStatus.js +3 -1
  175. package/lib/components/CreditCardForm/CreditCardFormStatus.js.map +1 -1
  176. package/lib/components/CreditCardForm/CreditCardFormStatusTracker.js +14 -12
  177. package/lib/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
  178. package/lib/components/CreditCardForm/CreditCardFormStep.js +2 -14
  179. package/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  180. package/lib/components/CreditCardForm/PendingStatusContent.d.ts +3 -1
  181. package/lib/components/CreditCardForm/PendingStatusContent.js +2 -2
  182. package/lib/components/CreditCardForm/PendingStatusContent.js.map +1 -1
  183. package/lib/components/CreditCardForm/renderInputs.d.ts +2 -1
  184. package/lib/components/CreditCardForm/renderInputs.js +1 -1
  185. package/lib/components/CreditCardForm/renderInputs.js.map +1 -1
  186. package/lib/components/CreditCardForm/renderStep.d.ts +2 -2
  187. package/lib/components/CreditCardForm/renderStep.js +2 -2
  188. package/lib/components/CreditCardForm/renderStep.js.map +1 -1
  189. package/lib/components/CreditForm/CreditForm.d.ts +5 -2
  190. package/lib/components/CreditForm/CreditForm.js +6 -20
  191. package/lib/components/CreditForm/CreditForm.js.map +1 -1
  192. package/lib/components/CreditForm/CreditFormContent.d.ts +4 -5
  193. package/lib/components/CreditForm/CreditFormStatusTracker.js +11 -11
  194. package/lib/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
  195. package/lib/components/CreditForm/CreditFormStep.d.ts +2 -3
  196. package/lib/components/CreditForm/CreditFormStep.js +6 -11
  197. package/lib/components/CreditForm/CreditFormStep.js.map +1 -1
  198. package/lib/components/CreditForm/ProgramsSourceProps.d.ts +16 -0
  199. package/lib/components/CreditForm/ProgramsSourceProps.js +2 -0
  200. package/lib/components/CreditForm/ProgramsSourceProps.js.map +1 -0
  201. package/lib/components/CreditForm/creditFormStepsData.js +9 -1
  202. package/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  203. package/lib/components/CreditForm/formStateMap.js +9 -7
  204. package/lib/components/CreditForm/formStateMap.js.map +1 -1
  205. package/lib/components/CreditForm/getCalcData.d.ts +3 -0
  206. package/lib/components/CreditForm/getCalcData.js +13 -0
  207. package/lib/components/CreditForm/getCalcData.js.map +1 -0
  208. package/lib/components/CreditForm/getCreditFormTaskData.js +3 -2
  209. package/lib/components/CreditForm/getCreditFormTaskData.js.map +1 -1
  210. package/lib/components/CreditForm/getSecondStepData.js +0 -1
  211. package/lib/components/CreditForm/getSecondStepData.js.map +1 -1
  212. package/lib/components/CreditForm/getZeroStepData.d.ts +1 -1
  213. package/lib/components/CreditForm/getZeroStepData.js +3 -8
  214. package/lib/components/CreditForm/getZeroStepData.js.map +1 -1
  215. package/lib/components/CreditForm/renderInputs.d.ts +2 -1
  216. package/lib/components/CreditForm/renderInputs.js +1 -1
  217. package/lib/components/CreditForm/renderInputs.js.map +1 -1
  218. package/lib/components/CreditForm/renderStep.d.ts +2 -2
  219. package/lib/components/CreditForm/renderStep.js +2 -2
  220. package/lib/components/CreditForm/renderStep.js.map +1 -1
  221. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  222. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +0 -4
  223. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  224. package/lib/components/OfficesAtmsMap/filterItems.d.ts +2 -0
  225. package/lib/components/OfficesAtmsMap/filterItems.js +6 -0
  226. package/lib/components/OfficesAtmsMap/filterItems.js.map +1 -0
  227. package/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js +1 -1
  228. package/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -1
  229. package/lib/hooks/useJSONRef/useJSONRef.js +13 -3
  230. package/lib/hooks/useJSONRef/useJSONRef.js.map +1 -1
  231. package/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +14 -9
  232. package/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
  233. package/lib/ui-kit/FormField/CustomFieldProps.d.ts +1 -0
  234. package/lib/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
  235. package/lib/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  236. package/lib/ui-kit/FormField/Fields/CreditCalcField.d.ts +2 -0
  237. package/lib/ui-kit/FormField/Fields/CreditCalcField.js +13 -0
  238. package/lib/ui-kit/FormField/Fields/CreditCalcField.js.map +1 -0
  239. package/lib/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
  240. package/lib/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  241. package/lib/ui-kit/FormField/Fields/RegionField.js +3 -1
  242. package/lib/ui-kit/FormField/Fields/RegionField.js.map +1 -1
  243. package/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  244. package/lib/ui-kit/FormField/SelectField.js +4 -6
  245. package/lib/ui-kit/FormField/SelectField.js.map +1 -1
  246. package/lib/ui-kit/FormField/getField.d.ts +1 -1
  247. package/lib/ui-kit/FormField/getField.js +5 -4
  248. package/lib/ui-kit/FormField/getField.js.map +1 -1
  249. package/lib/ui-kit/FormField/getObjectValidator.js +2 -0
  250. package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  251. package/mobile/bundle/api/RetailAPI/getCardTypes.d.ts +1 -1
  252. package/mobile/bundle/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  253. package/mobile/bundle/api/RetailAPI/updateUserProfile.d.ts +1 -2
  254. package/mobile/bundle/api/RetailAPI/updateUserTask.d.ts +5 -4
  255. package/mobile/bundle/bundle.umd.js +742 -683
  256. package/mobile/bundle/bundle.umd.min.js +1 -1
  257. package/mobile/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +13 -7
  258. package/mobile/bundle/components/CalculatorCredit/CalculatorCredit.d.ts +2 -3
  259. package/mobile/bundle/components/CalculatorCredit/defaultValueAdapter.d.ts +11 -0
  260. package/mobile/bundle/components/CreditCardForm/CreditCardFormStatus.d.ts +1 -0
  261. package/mobile/bundle/components/CreditCardForm/PendingStatusContent.d.ts +3 -1
  262. package/mobile/bundle/components/CreditCardForm/renderInputs.d.ts +2 -1
  263. package/mobile/bundle/components/CreditCardForm/renderStep.d.ts +2 -2
  264. package/mobile/bundle/components/CreditForm/CreditForm.d.ts +5 -2
  265. package/mobile/bundle/components/CreditForm/CreditFormContent.d.ts +4 -5
  266. package/mobile/bundle/components/CreditForm/CreditFormStep.d.ts +2 -3
  267. package/mobile/bundle/components/CreditForm/ProgramsSourceProps.d.ts +16 -0
  268. package/mobile/bundle/components/CreditForm/getCalcData.d.ts +3 -0
  269. package/mobile/bundle/components/CreditForm/getZeroStepData.d.ts +1 -1
  270. package/mobile/bundle/components/CreditForm/renderInputs.d.ts +2 -1
  271. package/mobile/bundle/components/CreditForm/renderStep.d.ts +2 -2
  272. package/mobile/bundle/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  273. package/mobile/bundle/components/OfficesAtmsMap/filterItems.d.ts +2 -0
  274. package/mobile/bundle/ui-kit/FormField/CustomFieldProps.d.ts +1 -0
  275. package/mobile/bundle/ui-kit/FormField/Fields/CreditCalcField.d.ts +2 -0
  276. package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  277. package/mobile/bundle/ui-kit/FormField/getField.d.ts +1 -1
  278. package/mobile/dist/api/RetailAPI/getCardTypes.d.ts +1 -1
  279. package/mobile/dist/api/RetailAPI/getCardTypes.js +4 -5
  280. package/mobile/dist/api/RetailAPI/getCardTypes.js.map +1 -1
  281. package/mobile/dist/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  282. package/mobile/dist/api/RetailAPI/getPaymentSystems.js +3 -4
  283. package/mobile/dist/api/RetailAPI/getPaymentSystems.js.map +1 -1
  284. package/mobile/dist/api/RetailAPI/updateUserProfile.d.ts +1 -2
  285. package/mobile/dist/api/RetailAPI/updateUserProfile.js +1 -1
  286. package/mobile/dist/api/RetailAPI/updateUserProfile.js.map +1 -1
  287. package/mobile/dist/api/RetailAPI/updateUserTask.d.ts +5 -4
  288. package/mobile/dist/api/RetailAPI/updateUserTask.js +1 -1
  289. package/mobile/dist/api/RetailAPI/updateUserTask.js.map +1 -1
  290. package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  291. package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  292. package/mobile/dist/components/ApplicationForm/ApplicationForm.js +1 -1
  293. package/mobile/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  294. package/mobile/dist/components/ApplicationForm/renderInputs.js +1 -1
  295. package/mobile/dist/components/ApplicationForm/renderInputs.js.map +1 -1
  296. package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.js +1 -1
  297. package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  298. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +13 -7
  299. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js +0 -1
  300. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  301. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +15 -8
  302. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  303. package/mobile/dist/components/CalculatorCredit/CalculatorCredit.d.ts +2 -3
  304. package/mobile/dist/components/CalculatorCredit/CalculatorCredit.js +5 -3
  305. package/mobile/dist/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
  306. package/mobile/dist/components/CalculatorCredit/defaultValueAdapter.d.ts +11 -0
  307. package/mobile/dist/components/CalculatorCredit/defaultValueAdapter.js +18 -0
  308. package/mobile/dist/components/CalculatorCredit/defaultValueAdapter.js.map +1 -0
  309. package/mobile/dist/components/CreditCardForm/CreditCardForm.js +4 -4
  310. package/mobile/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
  311. package/mobile/dist/components/CreditCardForm/CreditCardFormStatus.d.ts +1 -0
  312. package/mobile/dist/components/CreditCardForm/CreditCardFormStatus.js +3 -1
  313. package/mobile/dist/components/CreditCardForm/CreditCardFormStatus.js.map +1 -1
  314. package/mobile/dist/components/CreditCardForm/CreditCardFormStatusTracker.js +14 -12
  315. package/mobile/dist/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
  316. package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js +2 -14
  317. package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  318. package/mobile/dist/components/CreditCardForm/PendingStatusContent.d.ts +3 -1
  319. package/mobile/dist/components/CreditCardForm/PendingStatusContent.js +2 -2
  320. package/mobile/dist/components/CreditCardForm/PendingStatusContent.js.map +1 -1
  321. package/mobile/dist/components/CreditCardForm/renderInputs.d.ts +2 -1
  322. package/mobile/dist/components/CreditCardForm/renderInputs.js +1 -1
  323. package/mobile/dist/components/CreditCardForm/renderInputs.js.map +1 -1
  324. package/mobile/dist/components/CreditCardForm/renderStep.d.ts +2 -2
  325. package/mobile/dist/components/CreditCardForm/renderStep.js +2 -2
  326. package/mobile/dist/components/CreditCardForm/renderStep.js.map +1 -1
  327. package/mobile/dist/components/CreditForm/CreditForm.d.ts +5 -2
  328. package/mobile/dist/components/CreditForm/CreditForm.js +6 -20
  329. package/mobile/dist/components/CreditForm/CreditForm.js.map +1 -1
  330. package/mobile/dist/components/CreditForm/CreditFormContent.d.ts +4 -5
  331. package/mobile/dist/components/CreditForm/CreditFormStatusTracker.js +10 -10
  332. package/mobile/dist/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
  333. package/mobile/dist/components/CreditForm/CreditFormStep.d.ts +2 -3
  334. package/mobile/dist/components/CreditForm/CreditFormStep.js +5 -10
  335. package/mobile/dist/components/CreditForm/CreditFormStep.js.map +1 -1
  336. package/mobile/dist/components/CreditForm/ProgramsSourceProps.d.ts +16 -0
  337. package/mobile/dist/components/CreditForm/ProgramsSourceProps.js +2 -0
  338. package/mobile/dist/components/CreditForm/ProgramsSourceProps.js.map +1 -0
  339. package/mobile/dist/components/CreditForm/creditFormStepsData.js +9 -1
  340. package/mobile/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  341. package/mobile/dist/components/CreditForm/formStateMap.js +9 -7
  342. package/mobile/dist/components/CreditForm/formStateMap.js.map +1 -1
  343. package/mobile/dist/components/CreditForm/getCalcData.d.ts +3 -0
  344. package/mobile/dist/components/CreditForm/getCalcData.js +16 -0
  345. package/mobile/dist/components/CreditForm/getCalcData.js.map +1 -0
  346. package/mobile/dist/components/CreditForm/getCreditFormTaskData.js +3 -2
  347. package/mobile/dist/components/CreditForm/getCreditFormTaskData.js.map +1 -1
  348. package/mobile/dist/components/CreditForm/getSecondStepData.js +0 -1
  349. package/mobile/dist/components/CreditForm/getSecondStepData.js.map +1 -1
  350. package/mobile/dist/components/CreditForm/getZeroStepData.d.ts +1 -1
  351. package/mobile/dist/components/CreditForm/getZeroStepData.js +3 -8
  352. package/mobile/dist/components/CreditForm/getZeroStepData.js.map +1 -1
  353. package/mobile/dist/components/CreditForm/renderInputs.d.ts +2 -1
  354. package/mobile/dist/components/CreditForm/renderInputs.js +1 -1
  355. package/mobile/dist/components/CreditForm/renderInputs.js.map +1 -1
  356. package/mobile/dist/components/CreditForm/renderStep.d.ts +2 -2
  357. package/mobile/dist/components/CreditForm/renderStep.js +2 -2
  358. package/mobile/dist/components/CreditForm/renderStep.js.map +1 -1
  359. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  360. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +1 -6
  361. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  362. package/mobile/dist/components/OfficesAtmsMap/filterItems.d.ts +2 -0
  363. package/mobile/dist/components/OfficesAtmsMap/filterItems.js +9 -0
  364. package/mobile/dist/components/OfficesAtmsMap/filterItems.js.map +1 -0
  365. package/mobile/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js +3 -3
  366. package/mobile/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -1
  367. package/mobile/dist/hooks/useJSONRef/useJSONRef.js +13 -3
  368. package/mobile/dist/hooks/useJSONRef/useJSONRef.js.map +1 -1
  369. package/mobile/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +14 -9
  370. package/mobile/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
  371. package/mobile/dist/ui-kit/FormField/CustomFieldProps.d.ts +1 -0
  372. package/mobile/dist/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
  373. package/mobile/dist/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  374. package/mobile/dist/ui-kit/FormField/Fields/CreditCalcField.d.ts +2 -0
  375. package/mobile/dist/ui-kit/FormField/Fields/CreditCalcField.js +15 -0
  376. package/mobile/dist/ui-kit/FormField/Fields/CreditCalcField.js.map +1 -0
  377. package/mobile/dist/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
  378. package/mobile/dist/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  379. package/mobile/dist/ui-kit/FormField/Fields/RegionField.js +3 -1
  380. package/mobile/dist/ui-kit/FormField/Fields/RegionField.js.map +1 -1
  381. package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  382. package/mobile/dist/ui-kit/FormField/SelectField.js +4 -6
  383. package/mobile/dist/ui-kit/FormField/SelectField.js.map +1 -1
  384. package/mobile/dist/ui-kit/FormField/getField.d.ts +1 -1
  385. package/mobile/dist/ui-kit/FormField/getField.js +5 -4
  386. package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
  387. package/mobile/dist/ui-kit/FormField/getObjectValidator.js +2 -0
  388. package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  389. package/mobile/lib/api/RetailAPI/getCardTypes.d.ts +1 -1
  390. package/mobile/lib/api/RetailAPI/getCardTypes.js +5 -6
  391. package/mobile/lib/api/RetailAPI/getCardTypes.js.map +1 -1
  392. package/mobile/lib/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  393. package/mobile/lib/api/RetailAPI/getPaymentSystems.js +4 -5
  394. package/mobile/lib/api/RetailAPI/getPaymentSystems.js.map +1 -1
  395. package/mobile/lib/api/RetailAPI/updateUserProfile.d.ts +1 -2
  396. package/mobile/lib/api/RetailAPI/updateUserProfile.js +2 -2
  397. package/mobile/lib/api/RetailAPI/updateUserProfile.js.map +1 -1
  398. package/mobile/lib/api/RetailAPI/updateUserTask.d.ts +5 -4
  399. package/mobile/lib/api/RetailAPI/updateUserTask.js +2 -2
  400. package/mobile/lib/api/RetailAPI/updateUserTask.js.map +1 -1
  401. package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  402. package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  403. package/mobile/lib/components/ApplicationForm/ApplicationForm.js +1 -1
  404. package/mobile/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  405. package/mobile/lib/components/ApplicationForm/renderInputs.js +1 -1
  406. package/mobile/lib/components/ApplicationForm/renderInputs.js.map +1 -1
  407. package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.js +1 -1
  408. package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  409. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +13 -7
  410. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js +0 -1
  411. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  412. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +15 -8
  413. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  414. package/mobile/lib/components/CalculatorCredit/CalculatorCredit.d.ts +2 -3
  415. package/mobile/lib/components/CalculatorCredit/CalculatorCredit.js +5 -3
  416. package/mobile/lib/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
  417. package/mobile/lib/components/CalculatorCredit/defaultValueAdapter.d.ts +11 -0
  418. package/mobile/lib/components/CalculatorCredit/defaultValueAdapter.js +15 -0
  419. package/mobile/lib/components/CalculatorCredit/defaultValueAdapter.js.map +1 -0
  420. package/mobile/lib/components/CreditCardForm/CreditCardForm.js +4 -4
  421. package/mobile/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
  422. package/mobile/lib/components/CreditCardForm/CreditCardFormStatus.d.ts +1 -0
  423. package/mobile/lib/components/CreditCardForm/CreditCardFormStatus.js +3 -1
  424. package/mobile/lib/components/CreditCardForm/CreditCardFormStatus.js.map +1 -1
  425. package/mobile/lib/components/CreditCardForm/CreditCardFormStatusTracker.js +14 -12
  426. package/mobile/lib/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
  427. package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js +2 -14
  428. package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  429. package/mobile/lib/components/CreditCardForm/PendingStatusContent.d.ts +3 -1
  430. package/mobile/lib/components/CreditCardForm/PendingStatusContent.js +2 -2
  431. package/mobile/lib/components/CreditCardForm/PendingStatusContent.js.map +1 -1
  432. package/mobile/lib/components/CreditCardForm/renderInputs.d.ts +2 -1
  433. package/mobile/lib/components/CreditCardForm/renderInputs.js +1 -1
  434. package/mobile/lib/components/CreditCardForm/renderInputs.js.map +1 -1
  435. package/mobile/lib/components/CreditCardForm/renderStep.d.ts +2 -2
  436. package/mobile/lib/components/CreditCardForm/renderStep.js +2 -2
  437. package/mobile/lib/components/CreditCardForm/renderStep.js.map +1 -1
  438. package/mobile/lib/components/CreditForm/CreditForm.d.ts +5 -2
  439. package/mobile/lib/components/CreditForm/CreditForm.js +6 -20
  440. package/mobile/lib/components/CreditForm/CreditForm.js.map +1 -1
  441. package/mobile/lib/components/CreditForm/CreditFormContent.d.ts +4 -5
  442. package/mobile/lib/components/CreditForm/CreditFormStatusTracker.js +11 -11
  443. package/mobile/lib/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
  444. package/mobile/lib/components/CreditForm/CreditFormStep.d.ts +2 -3
  445. package/mobile/lib/components/CreditForm/CreditFormStep.js +6 -11
  446. package/mobile/lib/components/CreditForm/CreditFormStep.js.map +1 -1
  447. package/mobile/lib/components/CreditForm/ProgramsSourceProps.d.ts +16 -0
  448. package/mobile/lib/components/CreditForm/ProgramsSourceProps.js +2 -0
  449. package/mobile/lib/components/CreditForm/ProgramsSourceProps.js.map +1 -0
  450. package/mobile/lib/components/CreditForm/creditFormStepsData.js +9 -1
  451. package/mobile/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  452. package/mobile/lib/components/CreditForm/formStateMap.js +9 -7
  453. package/mobile/lib/components/CreditForm/formStateMap.js.map +1 -1
  454. package/mobile/lib/components/CreditForm/getCalcData.d.ts +3 -0
  455. package/mobile/lib/components/CreditForm/getCalcData.js +13 -0
  456. package/mobile/lib/components/CreditForm/getCalcData.js.map +1 -0
  457. package/mobile/lib/components/CreditForm/getCreditFormTaskData.js +3 -2
  458. package/mobile/lib/components/CreditForm/getCreditFormTaskData.js.map +1 -1
  459. package/mobile/lib/components/CreditForm/getSecondStepData.js +0 -1
  460. package/mobile/lib/components/CreditForm/getSecondStepData.js.map +1 -1
  461. package/mobile/lib/components/CreditForm/getZeroStepData.d.ts +1 -1
  462. package/mobile/lib/components/CreditForm/getZeroStepData.js +3 -8
  463. package/mobile/lib/components/CreditForm/getZeroStepData.js.map +1 -1
  464. package/mobile/lib/components/CreditForm/renderInputs.d.ts +2 -1
  465. package/mobile/lib/components/CreditForm/renderInputs.js +1 -1
  466. package/mobile/lib/components/CreditForm/renderInputs.js.map +1 -1
  467. package/mobile/lib/components/CreditForm/renderStep.d.ts +2 -2
  468. package/mobile/lib/components/CreditForm/renderStep.js +2 -2
  469. package/mobile/lib/components/CreditForm/renderStep.js.map +1 -1
  470. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  471. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +0 -4
  472. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  473. package/mobile/lib/components/OfficesAtmsMap/filterItems.d.ts +2 -0
  474. package/mobile/lib/components/OfficesAtmsMap/filterItems.js +6 -0
  475. package/mobile/lib/components/OfficesAtmsMap/filterItems.js.map +1 -0
  476. package/mobile/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js +1 -1
  477. package/mobile/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -1
  478. package/mobile/lib/hooks/useJSONRef/useJSONRef.js +13 -3
  479. package/mobile/lib/hooks/useJSONRef/useJSONRef.js.map +1 -1
  480. package/mobile/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +14 -9
  481. package/mobile/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
  482. package/mobile/lib/ui-kit/FormField/CustomFieldProps.d.ts +1 -0
  483. package/mobile/lib/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
  484. package/mobile/lib/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  485. package/mobile/lib/ui-kit/FormField/Fields/CreditCalcField.d.ts +2 -0
  486. package/mobile/lib/ui-kit/FormField/Fields/CreditCalcField.js +13 -0
  487. package/mobile/lib/ui-kit/FormField/Fields/CreditCalcField.js.map +1 -0
  488. package/mobile/lib/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
  489. package/mobile/lib/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  490. package/mobile/lib/ui-kit/FormField/Fields/RegionField.js +3 -1
  491. package/mobile/lib/ui-kit/FormField/Fields/RegionField.js.map +1 -1
  492. package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  493. package/mobile/lib/ui-kit/FormField/SelectField.js +4 -6
  494. package/mobile/lib/ui-kit/FormField/SelectField.js.map +1 -1
  495. package/mobile/lib/ui-kit/FormField/getField.d.ts +1 -1
  496. package/mobile/lib/ui-kit/FormField/getField.js +5 -4
  497. package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
  498. package/mobile/lib/ui-kit/FormField/getObjectValidator.js +2 -0
  499. package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  500. package/mobile/src/api/RetailAPI/getCardTypes.ts +5 -7
  501. package/mobile/src/api/RetailAPI/getPaymentSystems.ts +9 -7
  502. package/mobile/src/api/RetailAPI/updateUserProfile.ts +2 -3
  503. package/mobile/src/api/RetailAPI/updateUserTask.ts +6 -5
  504. package/mobile/src/api/RetailAPI/utils/getUpdateUserProfile.ts +2 -2
  505. package/mobile/src/components/ApplicationForm/ApplicationForm.tsx +1 -1
  506. package/mobile/src/components/ApplicationForm/renderInputs.tsx +2 -2
  507. package/mobile/src/components/ApplicationLeadForm/GroupedConsents.tsx +1 -1
  508. package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +13 -7
  509. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +32 -16
  510. package/mobile/src/components/CalculatorCredit/CalculatorCredit.tsx +7 -5
  511. package/mobile/src/components/CalculatorCredit/defaultValueAdapter.ts +26 -0
  512. package/mobile/src/components/CreditCardForm/CreditCardForm.tsx +4 -8
  513. package/mobile/src/components/CreditCardForm/CreditCardFormStatus.tsx +7 -1
  514. package/mobile/src/components/CreditCardForm/CreditCardFormStatusTracker.tsx +14 -8
  515. package/mobile/src/components/CreditCardForm/CreditCardFormStep.tsx +3 -18
  516. package/mobile/src/components/CreditCardForm/PendingStatusContent.tsx +24 -21
  517. package/mobile/src/components/CreditCardForm/renderInputs.tsx +3 -2
  518. package/mobile/src/components/CreditCardForm/renderStep.tsx +3 -4
  519. package/mobile/src/components/CreditForm/CreditForm.tsx +12 -30
  520. package/mobile/src/components/CreditForm/CreditFormContent.ts +5 -8
  521. package/mobile/src/components/CreditForm/CreditFormStatusTracker.tsx +14 -13
  522. package/mobile/src/components/CreditForm/CreditFormStep.tsx +10 -24
  523. package/mobile/src/components/CreditForm/ProgramsSourceProps.tsx +20 -0
  524. package/mobile/src/components/CreditForm/creditFormStepsData.tsx +9 -1
  525. package/mobile/src/components/CreditForm/formStateMap.tsx +9 -7
  526. package/mobile/src/components/CreditForm/getCalcData.ts +19 -0
  527. package/mobile/src/components/CreditForm/getCreditFormTaskData.ts +3 -2
  528. package/mobile/src/components/CreditForm/getSecondStepData.tsx +0 -1
  529. package/mobile/src/components/CreditForm/getZeroStepData.ts +7 -11
  530. package/mobile/src/components/CreditForm/renderInputs.tsx +3 -2
  531. package/mobile/src/components/CreditForm/renderStep.tsx +3 -3
  532. package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +0 -9
  533. package/mobile/src/components/OfficesAtmsMap/filterItems.tsx +11 -0
  534. package/mobile/src/components/OfficesAtmsMap/useOfficesAtmsMapData.tsx +1 -1
  535. package/mobile/src/hooks/useJSONRef/useJSONRef.ts +21 -4
  536. package/mobile/src/ui-kit/ConsentBkiDialog/useConsentBkiDialog.tsx +14 -10
  537. package/mobile/src/ui-kit/FormField/CustomFieldProps.ts +1 -0
  538. package/mobile/src/ui-kit/FormField/Fields/CardCategoryField.tsx +17 -4
  539. package/mobile/src/ui-kit/FormField/Fields/CreditCalcField.tsx +24 -0
  540. package/mobile/src/ui-kit/FormField/Fields/PaymentSystemField.tsx +8 -4
  541. package/mobile/src/ui-kit/FormField/Fields/RegionField.tsx +4 -1
  542. package/mobile/src/ui-kit/FormField/NameFieldDef.ts +1 -0
  543. package/mobile/src/ui-kit/FormField/SelectField.tsx +4 -6
  544. package/mobile/src/ui-kit/FormField/getField.tsx +5 -4
  545. package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +2 -0
  546. package/package.json +3 -2
  547. package/src/api/RetailAPI/getCardTypes.ts +5 -7
  548. package/src/api/RetailAPI/getPaymentSystems.ts +9 -7
  549. package/src/api/RetailAPI/updateUserProfile.ts +2 -3
  550. package/src/api/RetailAPI/updateUserTask.ts +6 -5
  551. package/src/api/RetailAPI/utils/getUpdateUserProfile.ts +2 -2
  552. package/src/components/ApplicationForm/ApplicationForm.tsx +1 -1
  553. package/src/components/ApplicationForm/renderInputs.tsx +2 -2
  554. package/src/components/ApplicationLeadForm/GroupedConsents.tsx +1 -1
  555. package/src/components/ApplicationLeadForm/getInitialFormState.tsx +13 -7
  556. package/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +32 -16
  557. package/src/components/CalculatorCredit/CalculatorCredit.tsx +7 -5
  558. package/src/components/CalculatorCredit/defaultValueAdapter.ts +26 -0
  559. package/src/components/CreditCardForm/CreditCardForm.tsx +4 -8
  560. package/src/components/CreditCardForm/CreditCardFormStatus.tsx +7 -1
  561. package/src/components/CreditCardForm/CreditCardFormStatusTracker.tsx +14 -8
  562. package/src/components/CreditCardForm/CreditCardFormStep.tsx +3 -18
  563. package/src/components/CreditCardForm/PendingStatusContent.tsx +24 -21
  564. package/src/components/CreditCardForm/renderInputs.tsx +3 -2
  565. package/src/components/CreditCardForm/renderStep.tsx +3 -4
  566. package/src/components/CreditForm/CreditForm.fixture.tsx +6 -1
  567. package/src/components/CreditForm/CreditForm.tsx +12 -30
  568. package/src/components/CreditForm/CreditFormContent.ts +5 -8
  569. package/src/components/CreditForm/CreditFormStatusTracker.tsx +14 -13
  570. package/src/components/CreditForm/CreditFormStep.tsx +10 -24
  571. package/src/components/CreditForm/ProgramsSourceProps.tsx +20 -0
  572. package/src/components/CreditForm/creditFormStepsData.tsx +9 -1
  573. package/src/components/CreditForm/formStateMap.tsx +9 -7
  574. package/src/components/CreditForm/getCalcData.ts +19 -0
  575. package/src/components/CreditForm/getCreditFormTaskData.ts +3 -2
  576. package/src/components/CreditForm/getSecondStepData.tsx +0 -1
  577. package/src/components/CreditForm/getZeroStepData.ts +7 -11
  578. package/src/components/CreditForm/renderInputs.tsx +3 -2
  579. package/src/components/CreditForm/renderStep.tsx +3 -3
  580. package/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +0 -9
  581. package/src/components/OfficesAtmsMap/filterItems.tsx +11 -0
  582. package/src/components/OfficesAtmsMap/useOfficesAtmsMapData.tsx +1 -1
  583. package/src/hooks/useJSONRef/useJSONRef.ts +21 -4
  584. package/src/ui-kit/ConsentBkiDialog/useConsentBkiDialog.tsx +14 -10
  585. package/src/ui-kit/FormField/CustomFieldProps.ts +1 -0
  586. package/src/ui-kit/FormField/Fields/CardCategoryField.tsx +17 -4
  587. package/src/ui-kit/FormField/Fields/CreditCalcField.tsx +24 -0
  588. package/src/ui-kit/FormField/Fields/PaymentSystemField.tsx +8 -4
  589. package/src/ui-kit/FormField/Fields/RegionField.tsx +4 -1
  590. package/src/ui-kit/FormField/NameFieldDef.ts +1 -0
  591. package/src/ui-kit/FormField/SelectField.tsx +4 -6
  592. package/src/ui-kit/FormField/getField.tsx +5 -4
  593. package/src/ui-kit/FormField/getObjectValidator.tsx +2 -0
@@ -966,12 +966,22 @@
966
966
  const refs = collectRef(content);
967
967
  const [refsMap, setRefsMap] = useState({});
968
968
  useEffect(() => {
969
- if (refs.length) {
970
- fetchRefs(refs).then(setRefsMap);
971
- }
969
+ resolveRefs(refs).then(setRefsMap);
972
970
  }, [refs.join()]);
973
971
  return refs.length ? resolveBlockProps(content, { ...fallback, ...refsMap }) : content;
974
972
  };
973
+ const resolveRefs = async (refs, parentRefsMap = {}) => {
974
+ if (refs.length) {
975
+ const refsMap = await fetchRefs(refs);
976
+ const unionRefsMap = { ...parentRefsMap, ...refsMap };
977
+ const additRefs = Object.entries(refsMap).flatMap(([, v]) => collectRef(v));
978
+ if (additRefs.length) {
979
+ return resolveRefs(additRefs, unionRefsMap);
980
+ }
981
+ return unionRefsMap;
982
+ }
983
+ return parentRefsMap;
984
+ };
975
985
 
976
986
  const extractContent = ({ block, options, className, defaultPadding, padding, isTheme, version, children, ...content }) => content;
977
987
 
@@ -1201,9 +1211,6 @@
1201
1211
 
1202
1212
  const getConsentDataProcessing = (inputs) => inputs?.find((_) => _?.name === 'consentDataProcessing');
1203
1213
 
1204
- const OUT_SERVICE_URL = `${API_BASE_URI}/outservice/outserviceregions`;
1205
- const getRegionUrl = (typeForm) => typeForm === 'OUTSERVICE' ? OUT_SERVICE_URL : undefined;
1206
-
1207
1214
  function useBool(defaultValue = false) {
1208
1215
  const [value, setValue] = useState(defaultValue);
1209
1216
  const setTrue = useCallback(() => setValue(true), []);
@@ -1676,6 +1683,8 @@
1676
1683
  confirmationIncome: defaultValidator(),
1677
1684
  deliveryDate: defaultValidator('Укажите дату доставки'),
1678
1685
  addressCourier: addressDaDataValidator(),
1686
+ cardCategory: defaultValidator('Укажите категорию карты'),
1687
+ paymentSystem: defaultValidator('Укажите тип платежной системы'),
1679
1688
  };
1680
1689
  const getObjectValidator = (inputs) => {
1681
1690
  const requiredInputs = getNamesFromInput(inputs.filter((_) => Boolean(_?.required)));
@@ -2428,11 +2437,6 @@
2428
2437
  return { header, body };
2429
2438
  };
2430
2439
 
2431
- const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
2432
-
2433
- const isClient = !isSSR();
2434
- const ClientOnly = JSX(({ children }) => (isClient ? children : null));
2435
-
2436
2440
  const INITIAL_FILTRATION_STATE$1 = {
2437
2441
  workingSaturday: false,
2438
2442
  premiumService: false,
@@ -2477,103 +2481,13 @@
2477
2481
  transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
2478
2482
  };
2479
2483
 
2480
- function useButton() {
2481
- return (props) => ({
2482
- ...props,
2483
- onClick: handlerDecorator(handleClick(props)),
2484
- });
2485
- }
2486
- function handleClick({ disabled, onClick }) {
2487
- return (ev) => {
2488
- !disabled && onClick && onClick(ev);
2489
- };
2490
- }
2491
-
2492
- const buttonStyleMap = {
2493
- primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
2494
- secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
2495
- };
2496
- const secondaryButtonStyleMap = {
2497
- 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'),
2498
- 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'),
2499
- };
2500
- const Button = JSX(({ children, ...props }) => {
2501
- const button = useButton();
2502
- const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
2503
- return (jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
2504
- 'text-white bg-primary-active': active,
2505
- 'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
2506
- 'rounded-md': rounded,
2507
- }, !active && !disabled
2508
- ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
2509
- : '', className), type: type, role: role, onClick: onClick, children: children }));
2510
- });
2511
-
2512
- const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
2513
-
2514
- const renderButtonsGroup = (data, activeButton, onButtonClick) => {
2515
- const allButtonVersion = getVersion(activeButton === 'all');
2516
- const businessButtonVersion = getVersion(activeButton === 'business');
2517
- const handleClick = (e, key, branches) => {
2518
- const filteredBranches = e.currentTarget === e.target && key === 'business' ? filterBranches(branches) : branches;
2519
- onButtonClick(key);
2520
- return filteredBranches;
2521
- };
2522
- const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
2523
- branch.workSchedule.businessScheduleVisibleTag &&
2524
- !branch.workSchedule.businessScheduleDescription);
2525
- 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" })] }));
2526
- };
2527
-
2528
- 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;
2529
-
2530
- const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
2531
- const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
2532
- const visibleFiltersNum = onlyOffice ? 5 : 6;
2533
- const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
2534
- const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
2535
- ? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
2536
- : [filtersCheckbox, []];
2537
- 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 }));
2538
- };
2539
- const renderFoldButton$2 = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
2540
- const labels = ['Больше фильтров', 'Меньше фильтров'];
2541
- const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
2542
- 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() })] }));
2543
- };
2544
- 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" })] }));
2545
-
2546
- 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] }) }));
2547
-
2548
- const defaultEmptyFunction$1 = () => void 0;
2549
- const filtersVisibleStyles = (activeButton) => activeButton === 'all' ? 'block' : 'hidden';
2550
- const OfficesAtmsMapLayout = JSX(({ className, data = [], isLoad, remoteWorkplaces = [], renderCard = defaultEmptyFunction$1, renderRemoteWorkplaceCard = defaultEmptyFunction$1, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, descriptionData, title, }) => {
2551
- const onlyOffice = title?.includes('Офис');
2552
- const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE$1);
2553
- const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
2554
- data,
2555
- remoteWorkplaces,
2556
- filtrationState,
2557
- getBalloon,
2558
- getBalloonRemoteWorkplaces,
2559
- });
2560
- const [activeButton, setActiveButton] = useState('all');
2561
- const filterOptions = {
2562
- filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
2563
- field: { field, reset },
2564
- onlyOffice,
2565
- labels: FILTRATION_LABELS,
2566
- };
2567
- 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)] })] }));
2568
- });
2569
2484
  const filterItems$1 = (data, filtrationState) => {
2570
2485
  const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
2571
2486
  return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
2572
2487
  };
2573
- const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
2574
2488
 
2575
- const defaultEmptyFunction = () => void 0;
2576
- const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction, getBalloonRemoteWorkplaces = defaultEmptyFunction, }) => {
2489
+ const defaultEmptyFunction$1 = () => void 0;
2490
+ const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, }) => {
2577
2491
  const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
2578
2492
  const _filteredItems = filterItems$1(data, filtrationState);
2579
2493
  const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
@@ -2610,6 +2524,11 @@
2610
2524
  return result || [];
2611
2525
  };
2612
2526
 
2527
+ const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
2528
+
2529
+ const isClient = !isSSR();
2530
+ const ClientOnly = JSX(({ children }) => (isClient ? children : null));
2531
+
2613
2532
  const AddressRetailField = JSX(({ field, input }) => {
2614
2533
  const [offices, setOffices] = useState([]);
2615
2534
  const { data } = useLeadFormData('REGION_RF');
@@ -2701,12 +2620,10 @@
2701
2620
  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') })));
2702
2621
 
2703
2622
  const SelectField = UniBlock(({ field, source, label, fieldName, input, placeholder = 'Выберите из списка', isSearch = false, }) => {
2704
- const leadOptions = (source &&
2705
- source?.map((_) => ({
2706
- key: _.key || '',
2707
- text: _.value,
2708
- }))) ||
2709
- [];
2623
+ const leadOptions = source?.map((_) => ({
2624
+ key: _.key || '',
2625
+ text: _.value,
2626
+ })) || [];
2710
2627
  return (jsx(SelectControl, { placeholder: placeholder, label: label, options: leadOptions, isSearch: isSearch, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required) }));
2711
2628
  });
2712
2629
 
@@ -3006,29 +2923,45 @@
3006
2923
 
3007
2924
  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) })));
3008
2925
 
3009
- const FIELD_NAME$9 = 'birthPlace';
3010
- 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) })));
2926
+ const FIELD_NAME$a = 'birthPlace';
2927
+ 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) })));
3011
2928
 
3012
- const getCardTypes = async (paymentSystemType) => {
3013
- const response = await doRequest('/dictionaryFiltered', 'POST', {
2929
+ const getCardTypes = async (paymentSystemTypeCd, creditProgramId) => {
2930
+ const data = await fetchRetailJSON('/dictionaryFiltered', 'POST', {
3014
2931
  type: 'CARD_TYPE',
3015
- presets: { paymentSystemType, creditProgramId: 13 },
2932
+ presets: { paymentSystemTypeCd, creditProgramId },
3016
2933
  });
3017
- const data = await response?.json();
3018
- return data;
2934
+ return Array.isArray(data) ? data : [];
3019
2935
  };
3020
2936
 
2937
+ function useLocalStorage(key) {
2938
+ const [storedValue, setStoredValue] = useState(JSON.parse(globalThis.localStorage?.getItem(key) || 'null'));
2939
+ const setValue = useCallback((value) => {
2940
+ globalThis.localStorage?.setItem(key, JSON.stringify(value));
2941
+ setStoredValue(value);
2942
+ }, [key, globalThis.localStorage]);
2943
+ return [storedValue, setValue];
2944
+ }
2945
+
3021
2946
  const CardCategoryField = JSX(({ field, input }) => {
3022
2947
  const [cardTypes, setCardTypes] = useState([]);
2948
+ const [programId] = useLocalStorage('programId');
2949
+ const { value: selectedCardCategory, onChange: cardCategoryChange } = field('cardCategory');
3023
2950
  const selectedPaymentSystem = field('paymentSystem').value;
3024
2951
  useEffect(() => {
3025
- (async () => {
3026
- const fetchedCardTypes = await getCardTypes(selectedPaymentSystem);
3027
- setCardTypes(fetchedCardTypes);
3028
- })();
2952
+ if (selectedPaymentSystem && programId) {
2953
+ (async () => {
2954
+ const fetchedCardTypes = await getCardTypes(selectedPaymentSystem, programId);
2955
+ setCardTypes(fetchedCardTypes);
2956
+ if (!isValidCardCategory(fetchedCardTypes, selectedCardCategory)) {
2957
+ cardCategoryChange && cardCategoryChange(null);
2958
+ }
2959
+ })();
2960
+ }
3029
2961
  }, [selectedPaymentSystem]);
3030
2962
  return (jsx(SelectField, { field: field, source: cardTypes, label: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F \u043A\u0430\u0440\u0442\u044B", fieldName: "cardCategory", input: input }));
3031
2963
  });
2964
+ const isValidCardCategory = (cardTypes, selectedCardCategory) => cardTypes.some((cardType) => cardType.key === selectedCardCategory?.key);
3032
2965
 
3033
2966
  const ChildrenField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0434\u0435\u0442\u0435\u0439 \u0434\u043E 18 \u043B\u0435\u0442", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('children'), validatorObj.children, input?.required), ...input })));
3034
2967
 
@@ -3074,6 +3007,38 @@
3074
3007
  },
3075
3008
  };
3076
3009
 
3010
+ function useButton() {
3011
+ return (props) => ({
3012
+ ...props,
3013
+ onClick: handlerDecorator(handleClick(props)),
3014
+ });
3015
+ }
3016
+ function handleClick({ disabled, onClick }) {
3017
+ return (ev) => {
3018
+ !disabled && onClick && onClick(ev);
3019
+ };
3020
+ }
3021
+
3022
+ const buttonStyleMap = {
3023
+ primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
3024
+ secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
3025
+ };
3026
+ const secondaryButtonStyleMap = {
3027
+ 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'),
3028
+ 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'),
3029
+ };
3030
+ const Button = JSX(({ children, ...props }) => {
3031
+ const button = useButton();
3032
+ const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
3033
+ return (jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
3034
+ 'text-white bg-primary-active': active,
3035
+ 'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
3036
+ 'rounded-md': rounded,
3037
+ }, !active && !disabled
3038
+ ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
3039
+ : '', className), type: type, role: role, onClick: onClick, children: children }));
3040
+ });
3041
+
3077
3042
  const feedbackById = async (id, convertToPng = false) => {
3078
3043
  const response = await doRequest(`/feedback/file?id=${encodeURIComponent(id)}&convertToPngFlg=${convertToPng}`, 'GET');
3079
3044
  return response ? await response.blob() : new Blob();
@@ -3109,60 +3074,366 @@
3109
3074
 
3110
3075
  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);
3111
3076
 
3112
- const LABEL_TEXT = `Имеет ли юридическое лицо, акционером / участником / членом / пайщиком /
3113
- вкладчиком с долей участия более 20% уставного капитала руководителем,
3114
- которого Вы являетесь, кредит в АО «Россельхозбанк»`;
3115
- const CreditInRshbCdField = JSX(({ field, input }) => {
3116
- const { data: creditInRshbCd } = useLeadFormData('CREDIT_IN_RSHB');
3117
- return (jsx(SelectField, { field: field, source: creditInRshbCd, label: LABEL_TEXT, fieldName: "creditInRshbCd", input: input }));
3118
- });
3119
-
3120
- const orientationStyleMap = {
3121
- horizontal: '@lg:flex-row',
3122
- vertical: '',
3123
- };
3124
- 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)))) })] })));
3077
+ const MONTHS_IN_YEAR$1 = 12;
3078
+ const MONTHLY_INTEREST_RATE = MONTHS_IN_YEAR$1 * 100;
3079
+ const DEFAULT_MIN_MONTHS = 1;
3080
+ const DEFAULT_MAX_MONTHS = 60;
3081
+ const DEFAULT_MONTHS = Math.round((DEFAULT_MAX_MONTHS - DEFAULT_MIN_MONTHS) / 2);
3125
3082
 
3126
- 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)] })));
3083
+ 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] })));
3127
3084
 
3128
- const CURRENCY_TYPES = [{ id: 'rub', text: 'Рубль' }];
3129
- const CurrencyField = JSX(({ field, input }) => {
3130
- const { value, onChange } = field('currency');
3131
- 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) }));
3132
- });
3085
+ const CalculatorStyle = {
3086
+ wrapper: 'flex flex-col justify-between lg:flex-row gap-x-4xl gap-y-7 lg:gap-y-4xl',
3087
+ input: 'flex flex-col lg:max-w-80 lg:w-1/2 gap-2xl',
3088
+ result: 'flex flex-col gap-y-xl min-w-52',
3089
+ };
3133
3090
 
3134
- 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) })));
3091
+ const FormatValue = JSX(({ value, fractionDigits, fixed, prefix, postfix }) => (jsx(Text, { size: "text-h3", children: typeof value === 'number'
3092
+ ? [prefix, toLocalNumberFormat(fractionDigits, { fixed })(value), postfix]
3093
+ .filter(Boolean)
3094
+ .join(' ')
3095
+ : value })));
3135
3096
 
3136
- 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 })));
3097
+ const CalculatorValueStyle = 'flex justify-between @xl:flex-col';
3098
+ 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: "-" })] })));
3137
3099
 
3138
- 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) })));
3100
+ const getDefaultParamsMin = (rateRows) => getDefaultParams([(i, acc) => i < acc, (i, prev) => i?.maxSum > prev?.maxSum], rateRows);
3101
+ const getDefaultParamsMax = (rateRows = [], isNewClient = false) => getDefaultParams([(i, acc) => i > acc, (i, prev) => i?.minSum < prev?.minSum], rateRows?.filter((_) => isNewClient === Boolean(_?.isNewClient)));
3102
+ const getDefaultParams = (comparators, rateRows) => {
3103
+ if (!rateRows?.length) {
3104
+ return undefined;
3105
+ }
3106
+ const rates = rateRows?.reduce((acc, i) => {
3107
+ if (comparators[0](i.rate, acc[0].rate)) {
3108
+ return [i];
3109
+ }
3110
+ else if (i.rate === acc[0].rate) {
3111
+ return [...acc, i];
3112
+ }
3113
+ return acc;
3114
+ }, [rateRows[0]]);
3115
+ if (rates.length > 1) {
3116
+ return rates.reduce((prev, i) => (comparators[1](i, prev) ? i : prev), rates[0]);
3117
+ }
3118
+ return rates[0];
3119
+ };
3139
3120
 
3140
- 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) })));
3121
+ const getMoneyDefaultValue = (defaultParams, defaultMoney = 0) => defaultParams?.sum ? defaultParams.sum : defaultMoney;
3122
+ const getMonthsDefaultValue = (defaultParams, defaultMonth = 0) => defaultParams?.period &&
3123
+ defaultParams.period >= DEFAULT_MIN_MONTHS &&
3124
+ defaultParams.period <= DEFAULT_MAX_MONTHS
3125
+ ? defaultParams.period
3126
+ : defaultMonth;
3141
3127
 
3142
- const FIELD_NAME$8 = 'dulIssueDateField';
3143
- 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) })));
3128
+ const renderFootnote = (text, key) => text ? (jsx(Paragraph, { size: "text-xs", font: "font-light", color: "text-secondary-text", children: text }, String(key))) : null;
3144
3129
 
3145
- const FIELD_NAME$7 = 'dulIssuedBy';
3146
- const DulIssuedByField = JSX(({ field, input }) => {
3147
- const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
3148
- const onDaDataChange = useCallback((item) => {
3149
- changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
3150
- }, []);
3151
- 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 }));
3152
- });
3130
+ const STEP_MONTHS = 1;
3131
+ 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 }));
3132
+ const monthText = (month) => `${month} ${Number(month) % 10 === 1 ? 'месяца' : 'месяцев'}`;
3153
3133
 
3154
- const FIELD_NAME$6 = 'dulNumber';
3155
- 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) })));
3134
+ const orientationStyleMap = {
3135
+ horizontal: '@lg:flex-row',
3136
+ vertical: '',
3137
+ };
3138
+ 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)))) })] })));
3156
3139
 
3157
- const FIELD_NAME$5 = 'dulSerie';
3158
- 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) })));
3140
+ 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 })] }));
3159
3141
 
3160
- const FIELD_NAME$4 = 'dulSubdivisionCode';
3161
- const DulSubdivisionCodeField = JSX(({ field, input }) => {
3162
- const onDaDataChange = useCallback((item) => {
3163
- field?.('dulIssuedBy')?.onChange?.(item?.data?.name);
3164
- }, []);
3165
- 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 }));
3142
+ const renderPaymentType = (props) => renderBinaryRadioButtonGroup({
3143
+ ...props,
3144
+ className: 'sm:flex-col',
3145
+ items: [
3146
+ { id: 'annuity', text: 'Аннуитетный' },
3147
+ { id: 'differential', text: 'Дифференцированный' },
3148
+ ],
3149
+ });
3150
+
3151
+ const DEFAULT_MONEY_STEP = 1000;
3152
+ const renderWantedSumInput = ({ isShowItems = true, step = DEFAULT_MONEY_STEP, postfix = '₽', ...rest }) => (jsx(InputRange, { items: isShowItems
3153
+ ? [
3154
+ `От ${toLocalNumberFormat(1)(rest.min || 0)} ${postfix}`,
3155
+ `До ${toLocalNumberFormat(1)(rest.max || 0)} ${postfix}`,
3156
+ ]
3157
+ : [], step: step, ...rest }));
3158
+
3159
+ const setDefaultParamsCalc = ({ field, defParams, calcParams, map, monthsValue = 'maxMonths', }) => {
3160
+ Object.entries(map).forEach(([key, value]) => {
3161
+ field?.(key)?.onChange?.(defParams?.[value]);
3162
+ });
3163
+ field?.('monthsValue')?.onChange?.(clamp(defParams?.[monthsValue], calcParams.minMonths, calcParams.maxMonths));
3164
+ };
3165
+
3166
+ /**
3167
+ * Формулы расчёта аннуитетных и дифференцированных платежей:
3168
+ * https://finuslugi.ru/potrebitelskie_kredity/stat_annuitetnye_i_differentsirovannye_platezhi
3169
+ */
3170
+ const getMonthlyPayment = (rate, params) => {
3171
+ const { isAnnuity, moneyValue, monthsValue, moneyExtra } = params;
3172
+ if (rate === 0) {
3173
+ return 0;
3174
+ }
3175
+ else if (isAnnuity) {
3176
+ const i = rate / MONTHLY_INTEREST_RATE; // Используется значение ставки в процентах
3177
+ if (moneyExtra) {
3178
+ return (moneyValue + moneyExtra) * (i + i / (Math.pow(1 + i, monthsValue) - 1));
3179
+ }
3180
+ else {
3181
+ return moneyValue * (i + i / (Math.pow(1 + i, monthsValue) - 1));
3182
+ }
3183
+ }
3184
+ else {
3185
+ return Math.round(moneyValue / monthsValue) + moneyValue * (rate / (MONTHS_IN_YEAR$1 * 100)); // Используется значение ставки (rate) в процентах, делённое на сто.
3186
+ }
3187
+ };
3188
+
3189
+ const defaultDiscriminator = (_) => _;
3190
+ const maxBy = (discriminator = defaultDiscriminator) => (list) => list.reduceRight((a, b) => (discriminator(a) > discriminator(b) ? a : b));
3191
+ const max = maxBy();
3192
+
3193
+ const minBy = (discriminator = defaultDiscriminator) => maxBy((_) => -discriminator(_));
3194
+ const min = minBy();
3195
+
3196
+ const getLimitRangeByKeys = ([minKey, maxKey], limitParams, rateRows = []) => limitParams && limitParams[minKey] && limitParams[maxKey]
3197
+ ? {
3198
+ [minKey]: limitParams[minKey],
3199
+ [maxKey]: limitParams[maxKey],
3200
+ }
3201
+ : getRangeByKeys([minKey, maxKey], rateRows);
3202
+ const getRangeByKeys = ([minKey, maxKey], rows = []) => ({
3203
+ [minKey]: rows.length
3204
+ ? min(rows.filter((row) => typeof row[minKey] === 'number').map((row) => row[minKey]))
3205
+ : 0,
3206
+ [maxKey]: rows.length
3207
+ ? max(rows.filter((row) => typeof row[minKey] === 'number').map((row) => row[maxKey]))
3208
+ : 0,
3209
+ });
3210
+ const checkRangeByKeys = (value, [minKey, maxKey], sourceBookRow) => value >= sourceBookRow[minKey] && value <= sourceBookRow[maxKey];
3211
+
3212
+ const DEFAULT_MIN_SUM$2 = 10000;
3213
+ const DEFAULT_MAX_SUM$1 = 5000000;
3214
+ const DEFAULT_CREDIT_CALCULATOR_PARAMS = {
3215
+ minSum: DEFAULT_MIN_SUM$2,
3216
+ maxSum: DEFAULT_MAX_SUM$1,
3217
+ minMonths: DEFAULT_MIN_MONTHS,
3218
+ maxMonths: DEFAULT_MAX_MONTHS,
3219
+ rate: 0,
3220
+ isSalaryClient: false,
3221
+ isPensionClient: false,
3222
+ isStateEmployee: false,
3223
+ isInsurance: true,
3224
+ };
3225
+
3226
+ const checkCreditSourceBookRowCommonParams = (props) => checkRowParam$1({
3227
+ ...props,
3228
+ fieldKey: 'isSalaryClient',
3229
+ viewSettingFieldKey: 'isShowSalaryClient',
3230
+ }) &&
3231
+ checkRowParam$1({
3232
+ ...props,
3233
+ fieldKey: 'isStateEmployee',
3234
+ viewSettingFieldKey: 'isShowStateEmployee',
3235
+ }) &&
3236
+ checkRowParam$1({
3237
+ ...props,
3238
+ fieldKey: 'isPensionClient',
3239
+ viewSettingFieldKey: 'isShowPensionClient',
3240
+ }) &&
3241
+ checkRowParam$1({
3242
+ ...props,
3243
+ fieldKey: 'isInsurance',
3244
+ viewSettingFieldKey: 'isShowInsurance',
3245
+ });
3246
+ const checkRowParam$1 = ({ row, userInputParams, paramsViewSettings, fieldKey, viewSettingFieldKey, }) => {
3247
+ const isExclude = paramsViewSettings ? !paramsViewSettings[viewSettingFieldKey] : false;
3248
+ return isExclude || userInputParams[fieldKey] === row[fieldKey];
3249
+ };
3250
+
3251
+ const getCreditCalculatorLimitParams = ({ limitRows, userInputParams, paramsViewSettings, }) => limitRows?.find((row) => checkCreditSourceBookRowCommonParams({
3252
+ row,
3253
+ userInputParams,
3254
+ paramsViewSettings,
3255
+ }));
3256
+
3257
+ const getCreditCalculatorRateParams = ({ rateRows = [], userInputParams, paramsViewSettings, moneyValue, monthsValue, }) => rateRows?.find((row) => checkCreditSourceBookRowCommonParams({
3258
+ row,
3259
+ userInputParams,
3260
+ paramsViewSettings,
3261
+ }) &&
3262
+ checkRangeByKeys(moneyValue, ['minSum', 'maxSum'], row) &&
3263
+ checkRangeByKeys(monthsValue, ['minMonths', 'maxMonths'], row)) || DEFAULT_CREDIT_CALCULATOR_PARAMS;
3264
+
3265
+ const getCreditCalculatorParams = (userInputParams, calcSource, paramsViewSettings) => {
3266
+ const { moneyValue, monthsValue } = userInputParams;
3267
+ const rateRows = calcSource?.rateRows || [DEFAULT_CREDIT_CALCULATOR_PARAMS];
3268
+ const limitRows = calcSource?.limitRows || [];
3269
+ const creditCalculatorSourceBookLimitParams = getCreditCalculatorLimitParams({
3270
+ limitRows,
3271
+ userInputParams,
3272
+ paramsViewSettings,
3273
+ });
3274
+ const { minSum, maxSum } = getLimitRangeByKeys(['minSum', 'maxSum'], creditCalculatorSourceBookLimitParams, rateRows);
3275
+ const { minMonths, maxMonths } = getLimitRangeByKeys(['minMonths', 'maxMonths'], creditCalculatorSourceBookLimitParams, rateRows);
3276
+ const creditCalculatorRateParams = getCreditCalculatorRateParams({
3277
+ rateRows,
3278
+ userInputParams,
3279
+ paramsViewSettings,
3280
+ moneyValue,
3281
+ monthsValue,
3282
+ });
3283
+ const { rate } = creditCalculatorRateParams;
3284
+ const monthlyPayment = getMonthlyPayment(rate, userInputParams);
3285
+ return {
3286
+ ...creditCalculatorRateParams,
3287
+ ...userInputParams,
3288
+ minSum,
3289
+ maxSum,
3290
+ minMonths,
3291
+ maxMonths,
3292
+ moneyValue,
3293
+ monthsValue,
3294
+ monthlyPayment,
3295
+ };
3296
+ };
3297
+
3298
+ const isDefaultParams = (defaultParams = {}) => Boolean(Object.values(defaultParams).filter((_) => _).length);
3299
+
3300
+ const CREDIT_DEFAULT_SUM = 200000;
3301
+ const MAP$1 = {
3302
+ isSalaryClient: 'isSalaryClient',
3303
+ isStateEmployee: 'isStateEmployee',
3304
+ isPensionClient: 'isPensionClient',
3305
+ isInsurance: 'isInsurance',
3306
+ moneyValue: 'maxSum',
3307
+ };
3308
+ const CalculatorCredit = UniBlock(({ className, title, calcSource, buttons, footnote, paramsViewSettings, defaultParams, onChange, ...rest }) => {
3309
+ const defaultParamsCals = getDefaultParamsMin(calcSource?.rateRows);
3310
+ const [userInputParams, { field, isDirty }] = useForm({
3311
+ moneyValue: getMoneyDefaultValue(defaultParams, CREDIT_DEFAULT_SUM),
3312
+ monthsValue: getMonthsDefaultValue(defaultParams, DEFAULT_MONTHS),
3313
+ isAnnuity: Boolean(defaultParams?.isAnnuity),
3314
+ isInsurance: Boolean(defaultParams?.isEnableInsurance),
3315
+ isSalaryClient: Boolean(defaultParams?.isEnableSalaryClient),
3316
+ isPensionClient: Boolean(defaultParams?.isEnablePensionClient),
3317
+ isStateEmployee: Boolean(defaultParams?.isEnableStateEmployee),
3318
+ });
3319
+ useEffect(() => {
3320
+ isDirty && onChange?.(userInputParams);
3321
+ }, [userInputParams, isDirty]);
3322
+ const calcParams = getCreditCalculatorParams(userInputParams, calcSource, paramsViewSettings);
3323
+ const paymentTypeElement = renderPaymentType({
3324
+ title: 'Тип платежа',
3325
+ orientation: 'vertical',
3326
+ ...field('isAnnuity'),
3327
+ });
3328
+ const { onChange: setMoneyValue } = field('moneyValue');
3329
+ const { onChange: setMonthsValue } = field('monthsValue');
3330
+ useEffect(() => {
3331
+ setMoneyValue &&
3332
+ setMoneyValue(clamp(userInputParams.moneyValue, calcParams.minSum, calcParams.maxSum));
3333
+ }, [calcParams.minSum, calcParams.maxSum]);
3334
+ useEffect(() => {
3335
+ setMonthsValue &&
3336
+ setMonthsValue(clamp(userInputParams.monthsValue, calcParams.minMonths, calcParams.maxMonths));
3337
+ }, [calcParams.minMonths, calcParams.maxMonths]);
3338
+ useEffect(() => {
3339
+ if (!isDefaultParams(defaultParams) && defaultParamsCals) {
3340
+ setDefaultParamsCalc({
3341
+ field,
3342
+ defParams: defaultParamsCals,
3343
+ calcParams,
3344
+ map: MAP$1,
3345
+ monthsValue: 'minMonths',
3346
+ });
3347
+ }
3348
+ }, [calcSource, defaultParams]);
3349
+ return (jsx(CalculatorLayout, { className: className, title: title, ...rest, children: jsxs("section", { className: style(CalculatorStyle.wrapper, className), children: [jsxs("div", { className: CalculatorStyle.input, children: [renderWantedSumInput({
3350
+ title: 'Сумма кредита, ₽',
3351
+ step: 500,
3352
+ min: calcParams.minSum,
3353
+ max: calcParams.maxSum,
3354
+ ...field('moneyValue'),
3355
+ value: calcParams.moneyValue,
3356
+ }), renderMonthsInput({
3357
+ title: 'Срок кредита, месяцев',
3358
+ min: calcParams.minMonths,
3359
+ max: calcParams.maxMonths,
3360
+ ...field('monthsValue'),
3361
+ value: calcParams.monthsValue,
3362
+ }), 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)] })] }) }));
3363
+ });
3364
+ 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] }));
3365
+
3366
+ const PARAMS_MAP = {
3367
+ moneyValue: 'sum',
3368
+ monthsValue: 'period',
3369
+ isInsurance: 'isEnableInsurance',
3370
+ isPensionClient: 'isEnablePensionClient',
3371
+ isStateEmployee: 'isEnableStateEmployee',
3372
+ isSalaryClient: 'isEnableSalaryClient',
3373
+ isAnnuity: 'isAnnuity',
3374
+ };
3375
+ const defaultValueAdapter = (value, isInverse = false) => {
3376
+ const keysMap = isInverse ? swap(PARAMS_MAP) : PARAMS_MAP;
3377
+ return Object.fromEntries(Object.entries(value ?? {}).map(([k, v]) => [keysMap[k], v]));
3378
+ };
3379
+ const swap = (_) => Object.fromEntries(Object.entries(_).map(([k, v]) => [v, k]));
3380
+
3381
+ const FIELD_NAME$9 = 'calculator';
3382
+ const CreditCalcField = JSX(({ field, params }) => {
3383
+ const handleChange = useCallback((_) => {
3384
+ field(FIELD_NAME$9).onChange?.(_);
3385
+ }, []);
3386
+ return (jsx(CalculatorCredit, { ...params?.calcData, defaultParams: defaultValueAdapter(field(FIELD_NAME$9).value), onChange: handleChange }));
3387
+ });
3388
+
3389
+ const LABEL_TEXT = `Имеет ли юридическое лицо, акционером / участником / членом / пайщиком /
3390
+ вкладчиком с долей участия более 20% уставного капитала руководителем,
3391
+ которого Вы являетесь, кредит в АО «Россельхозбанк»`;
3392
+ const CreditInRshbCdField = JSX(({ field, input }) => {
3393
+ const { data: creditInRshbCd } = useLeadFormData('CREDIT_IN_RSHB');
3394
+ return (jsx(SelectField, { field: field, source: creditInRshbCd, label: LABEL_TEXT, fieldName: "creditInRshbCd", input: input }));
3395
+ });
3396
+
3397
+ 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)] })));
3398
+
3399
+ const CURRENCY_TYPES = [{ id: 'rub', text: 'Рубль' }];
3400
+ const CurrencyField = JSX(({ field, input }) => {
3401
+ const { value, onChange } = field('currency');
3402
+ 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) }));
3403
+ });
3404
+
3405
+ 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) })));
3406
+
3407
+ 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 })));
3408
+
3409
+ 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) })));
3410
+
3411
+ 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) })));
3412
+
3413
+ const FIELD_NAME$8 = 'dulIssueDateField';
3414
+ 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) })));
3415
+
3416
+ const FIELD_NAME$7 = 'dulIssuedBy';
3417
+ const DulIssuedByField = JSX(({ field, input }) => {
3418
+ const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
3419
+ const onDaDataChange = useCallback((item) => {
3420
+ changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
3421
+ }, []);
3422
+ 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 }));
3423
+ });
3424
+
3425
+ const FIELD_NAME$6 = 'dulNumber';
3426
+ 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) })));
3427
+
3428
+ const FIELD_NAME$5 = 'dulSerie';
3429
+ 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) })));
3430
+
3431
+ const FIELD_NAME$4 = 'dulSubdivisionCode';
3432
+ const DulSubdivisionCodeField = JSX(({ field, input }) => {
3433
+ const onDaDataChange = useCallback((item) => {
3434
+ field?.('dulIssuedBy')?.onChange?.(item?.data?.name);
3435
+ }, []);
3436
+ 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 }));
3166
3437
  });
3167
3438
 
3168
3439
  const EducationField = JSX(({ field, input }) => {
@@ -3337,11 +3608,10 @@
3337
3608
  return (jsx(InputControl, { ...getValidation(field('partnerComments'), validatorObj.partnerComments, required), placeholder: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u044E\u0449\u0438\u0439 \u0432\u0430\u0441 \u0432\u043E\u043F\u0440\u043E\u0441", isTextarea: true, ...rest }));
3338
3609
  });
3339
3610
 
3340
- const getPaymentSystems = async () => {
3341
- const response = await doRequest('/public-data/creditProgramConditions', 'POST', {
3342
- creditProgramId: 13,
3611
+ const getPaymentSystems = async (creditProgramId) => {
3612
+ const data = await fetchRetailJSON('/public-data/creditProgramConditions', 'POST', {
3613
+ creditProgramId,
3343
3614
  });
3344
- const data = await response?.json();
3345
3615
  return (data?.paymentSystems?.map((paymentSystem) => ({
3346
3616
  id: paymentSystem.type,
3347
3617
  text: paymentSystem.name,
@@ -3350,12 +3620,15 @@
3350
3620
 
3351
3621
  const PaymentSystemField = JSX(({ field, input }) => {
3352
3622
  const { value, onChange } = field('paymentSystem');
3623
+ const [programId] = useLocalStorage('programId');
3353
3624
  const [paymentSystemOptions, setPaymentSystemOptions] = useState([]);
3354
3625
  useEffect(() => {
3355
- (async () => {
3356
- const fetchedPaymentSystems = await getPaymentSystems();
3357
- setPaymentSystemOptions(fetchedPaymentSystems || []);
3358
- })();
3626
+ if (programId) {
3627
+ (async () => {
3628
+ const fetchedPaymentSystems = await getPaymentSystems(programId);
3629
+ setPaymentSystemOptions(fetchedPaymentSystems || []);
3630
+ })();
3631
+ }
3359
3632
  }, []);
3360
3633
  return (jsx(RadioButtonGroupControl, { label: "\u041F\u043B\u0430\u0442\u0435\u0436\u043D\u0430\u044F \u0441\u0438\u0441\u0442\u0435\u043C\u0430", orientation: "horizontal", items: paymentSystemOptions, value: value, onChange: (_) => onChange?.(_), ...getValidation(field('paymentSystem'), validatorObj.paymentSystem, input?.required) }));
3361
3634
  });
@@ -3401,6 +3674,9 @@
3401
3674
  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) })));
3402
3675
  const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
3403
3676
 
3677
+ const OUT_SERVICE_URL = `${API_BASE_URI}/outservice/outserviceregions`;
3678
+ const getRegionUrl = (typeForm) => typeForm === 'OUTSERVICE' ? OUT_SERVICE_URL : undefined;
3679
+
3404
3680
  const REGIONS_URL = `${API_BASE_URI}/regions`;
3405
3681
  const EMPTY_REGIONS = [];
3406
3682
  // TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
@@ -3409,7 +3685,8 @@
3409
3685
  return Array.isArray(data) ? data : EMPTY_REGIONS;
3410
3686
  }
3411
3687
 
3412
- const RegionField = JSX(({ field, input, url }) => {
3688
+ const RegionField = JSX(({ field, input, params }) => {
3689
+ const url = getRegionUrl(params?.typeForm);
3413
3690
  const regions = useRegions(url);
3414
3691
  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) }));
3415
3692
  });
@@ -3521,8 +3798,8 @@
3521
3798
  const PRODUCT_REF = {
3522
3799
  $ref: '/wcms-resources/outservice-productlist.json',
3523
3800
  };
3524
- const getField = (field, typeForm = '') => (input, i) => {
3525
- const isPremium = typeForm === 'ULTRASERVICE' || typeForm === 'PREMIUMSERVICE';
3801
+ const getField = (field, params) => (input, i) => {
3802
+ const isPremium = params?.typeForm === 'ULTRASERVICE' || params?.typeForm === 'PREMIUMSERVICE';
3526
3803
  const InputsMap = {
3527
3804
  surname: jsx(SurnameField, { field: field, input: input }),
3528
3805
  name: jsx(NameField, { field: field, input: input }),
@@ -3572,7 +3849,7 @@
3572
3849
  consentInformFlg: jsx(ConsentField, { field: field, input: input }),
3573
3850
  consentPfrFlg: jsx(ConsentField, { field: field, input: input }),
3574
3851
  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') })),
3575
- region: isPremium ? (jsx(RegionPremiumField, { field: field })) : (jsx(RegionField, { field: field, input: input, url: getRegionUrl(typeForm) })),
3852
+ region: isPremium ? (jsx(RegionPremiumField, { field: field })) : (jsx(RegionField, { field: field, input: input, params: params })),
3576
3853
  education: jsx(EducationField, { field: field, input: input }),
3577
3854
  housing: jsx(HousingField, { field: field, input: input }),
3578
3855
  employment: jsx(EmploymentField, { field: field, input: input }),
@@ -3619,6 +3896,7 @@
3619
3896
  confirmationIncome: jsx(ConfirmationIncomeField, { field: field, input: input }),
3620
3897
  methodObtain: jsx(MethodObtainField, { field: field, input: input }),
3621
3898
  deliveryDate: jsx(DeliveryDateFiels, { field: field, input: input }),
3899
+ calculator: jsx(CreditCalcField, { field: field, params: params }),
3622
3900
  };
3623
3901
  return isRenderField({ input, field }) ? (jsx("div", { children: InputsMap[input?.name || ''] }, String(i))) : null;
3624
3902
  };
@@ -3767,7 +4045,7 @@
3767
4045
  reset();
3768
4046
  }
3769
4047
  }, [responseType]);
3770
- 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] }));
4048
+ 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] }));
3771
4049
  });
3772
4050
  const getFilteredInputs = (inputs, data) => inputs
3773
4051
  .filter((_) => (_?.name === 'secondaryPhone' ? Boolean(data.secondaryPhone) : _))
@@ -3777,15 +4055,6 @@
3777
4055
  return _ === (dataValue?.key ?? dataValue);
3778
4056
  }));
3779
4057
 
3780
- function useLocalStorage(key) {
3781
- const [storedValue, setStoredValue] = useState(JSON.parse(globalThis.localStorage?.getItem(key) || 'null'));
3782
- const setValue = useCallback((value) => {
3783
- globalThis.localStorage?.setItem(key, JSON.stringify(value));
3784
- setStoredValue(value);
3785
- }, [key, globalThis.localStorage]);
3786
- return [storedValue, setValue];
3787
- }
3788
-
3789
4058
  const CONSENT_ALL_DOCS_TEXT = 'Согласие на все документы';
3790
4059
  const CONSENT_REQUIRED = 'Отметьте все обязательные соглашения';
3791
4060
  const GroupedConsents = JSX(({ inputs = [], typeForm = '', field, key }) => {
@@ -3799,20 +4068,19 @@
3799
4068
  const hasValidationErrors = useMemo(() => inputs
3800
4069
  ?.filter((_) => _.required)
3801
4070
  ?.some((_) => Boolean(withValidator(field(_?.name), validatorObj[_?.name]).error)), [inputs]);
3802
- 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 : '')] })) }) }));
4071
+ 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 : '')] })) }) }));
3803
4072
  });
3804
4073
  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" }) })] }));
3805
4074
 
3806
4075
  const renderInputs$2 = ({ field, typeForm = '', inputs }) => {
3807
4076
  const { consentInputs, restInputs } = splitInputs(inputs || []);
3808
- return consentInputs.length > 2 ? (jsxs("div", { children: [restInputs.map(getField(field, typeForm)), jsx(GroupedConsents, { inputs: consentInputs, field: field })] })) : ((inputs || [])?.map(getField(field, typeForm)));
4077
+ return consentInputs.length > 2 ? (jsxs("div", { children: [restInputs.map(getField(field, { typeForm })), jsx(GroupedConsents, { inputs: consentInputs, field: field })] })) : ((inputs || [])?.map(getField(field, { typeForm })));
3809
4078
  };
3810
4079
  const splitInputs = (inputs) => ({
3811
4080
  consentInputs: inputs?.filter((_) => Object.keys(CONSENTS).includes(_.name || '')) || [],
3812
4081
  restInputs: inputs?.filter((_) => !Object.keys(CONSENTS).includes(_.name || '')) || [],
3813
4082
  });
3814
4083
 
3815
- /* eslint-disable max-lines */
3816
4084
  const initialFormState = {
3817
4085
  typeForm: '',
3818
4086
  region: { key: '', text: '' },
@@ -3874,19 +4142,19 @@
3874
4142
 
3875
4143
  const createUserProfile = (body) => fetchRetailJSON('/public-data/createUserProfile', 'POST', body).then((res) => res?.profile?.id || null);
3876
4144
 
3877
- const updateUserProfile = (body) => fetchRetailJSON('/user-data/updateUserProfile', 'PUT', body);
4145
+ const updateUserProfile = (body) => doRequest('/user-data/updateUserProfile', 'PUT', body);
3878
4146
 
3879
- const updateUserTask = (body) => fetchRetailJSON('/user-data/updateUserTask', 'PUT', body);
4147
+ const updateUserTask = (body) => doRequest('/user-data/updateUserTask', 'PUT', body);
3880
4148
 
3881
4149
  const getUpdateUserProfileData = (profileId, formData) => {
3882
- const { name = '', surname = '', middleName = '', birthday = '', phone = '', email = '', processPersonalDataFlg, consentProviderFlg, consentPfrFlg, consentPhotoFlg, consentAssignmentClaimsFlg, consentCollectionFlg, consentInformFlg, } = formData;
4150
+ const { name = '', surname = '', middleName = '', limitedBirthday = '', phone = '', email = '', processPersonalDataFlg, consentProviderFlg, consentPfrFlg, consentPhotoFlg, consentAssignmentClaimsFlg, consentCollectionFlg, consentInformFlg, } = formData;
3883
4151
  return {
3884
4152
  profile: {
3885
4153
  id: profileId,
3886
4154
  name,
3887
4155
  surname,
3888
4156
  midname: middleName,
3889
- birthDate: birthday && formatDate(birthday, true),
4157
+ birthDate: limitedBirthday && formatDate(limitedBirthday, true),
3890
4158
  email,
3891
4159
  phone: formatPhone(phone),
3892
4160
  processPersonalDataFlg: Boolean(processPersonalDataFlg),
@@ -4167,16 +4435,21 @@
4167
4435
  const { open, close } = useDialogManager();
4168
4436
  const verifyPhoneDialog = useVerifyPhoneDialog();
4169
4437
  const handleSuccessVerify = (profileId) => async (smsCode) => {
4170
- if (profileId) {
4171
- await updateUserProfile({
4172
- profile: {
4173
- id: profileId,
4174
- consentBkiFlg: true,
4175
- smsConsentBki: smsCode,
4176
- },
4177
- });
4438
+ try {
4439
+ if (profileId) {
4440
+ await updateUserProfile({
4441
+ profile: {
4442
+ id: profileId,
4443
+ consentBkiFlg: true,
4444
+ smsConsentBki: smsCode,
4445
+ },
4446
+ });
4447
+ }
4448
+ onClose();
4449
+ }
4450
+ catch (ex) {
4451
+ console.log(ex);
4178
4452
  }
4179
- onClose();
4180
4453
  };
4181
4454
  const handleSubmitBkiConstent = (phone, profileId) => async (confirmStatus) => {
4182
4455
  close();
@@ -4332,13 +4605,15 @@
4332
4605
  const [, setTaskId] = useLocalStorage('taskId');
4333
4606
  const [, setProfileId] = useLocalStorage('profileId');
4334
4607
  const [, setParticipantId] = useLocalStorage('participantId');
4608
+ const [, setProgramId] = useLocalStorage('programId');
4335
4609
  const esiaLoginDialog = useEsiaLoginDialog(nextStepLink);
4336
4610
  const consentBkiDialog = useConsentBkiDialog(esiaLoginDialog.open);
4337
4611
  const verifyPhoneDialog = useVerifyPhoneDialog();
4338
- const saveUserData = useCallback((participantId, taskId, profileId) => {
4612
+ const saveUserData = useCallback(({ participantId, taskId, profileId, programId: programNumber }) => {
4339
4613
  setParticipantId(participantId);
4340
4614
  setTaskId(taskId);
4341
4615
  setProfileId(profileId);
4616
+ setProgramId(programNumber);
4342
4617
  }, []);
4343
4618
  // eslint-disable-next-line consistent-return
4344
4619
  const handleSubmit = useCallback(async (formData) => {
@@ -4389,13 +4664,18 @@
4389
4664
  profileId,
4390
4665
  programId,
4391
4666
  });
4392
- await updateUserTask(getLeadFormTaskData({
4393
- participantId,
4394
- taskId,
4395
- profileId,
4396
- formData: transformedForm,
4397
- }));
4398
- saveUserData(participantId, taskId, profileId);
4667
+ try {
4668
+ await updateUserTask(getLeadFormTaskData({
4669
+ participantId,
4670
+ taskId,
4671
+ profileId,
4672
+ formData: transformedForm,
4673
+ }));
4674
+ }
4675
+ catch (ex) {
4676
+ console.log(ex);
4677
+ }
4678
+ saveUserData({ participantId, taskId, profileId, programId });
4399
4679
  saveForm(formData);
4400
4680
  };
4401
4681
  const verifyPhoneContent = (phone, consents) => ({
@@ -4652,13 +4932,6 @@
4652
4932
 
4653
4933
  const areArraysEqual = (as, bs) => as === bs || Boolean(as && bs && as?.length === bs?.length && as.every((_, i) => _ === bs[i]));
4654
4934
 
4655
- const defaultDiscriminator = (_) => _;
4656
- const maxBy = (discriminator = defaultDiscriminator) => (list) => list.reduceRight((a, b) => (discriminator(a) > discriminator(b) ? a : b));
4657
- const max = maxBy();
4658
-
4659
- const minBy = (discriminator = defaultDiscriminator) => maxBy((_) => -discriminator(_));
4660
- const min = minBy();
4661
-
4662
4935
  const getItemWidth = (container) => (itemCount) => container.scrollWidth / itemCount;
4663
4936
  const scrollBy = (container) => (itemCount, delta) => {
4664
4937
  container.scrollBy({ left: delta * getItemWidth(container)(itemCount), behavior: 'smooth' });
@@ -5000,39 +5273,12 @@
5000
5273
  return (jsx(BlockWrapper, { className: style('!bg-transparent', alignStyle, className), defaultPadding: "p-0", ...rest, children: renderButtonsSection(buttons) }));
5001
5274
  });
5002
5275
 
5003
- 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] })));
5004
-
5005
- const CalculatorStyle = {
5006
- wrapper: 'flex flex-col justify-between lg:flex-row gap-x-4xl gap-y-7 lg:gap-y-4xl',
5007
- input: 'flex flex-col lg:max-w-80 lg:w-1/2 gap-2xl',
5008
- result: 'flex flex-col gap-y-xl min-w-52',
5009
- };
5010
-
5011
- const FormatValue = JSX(({ value, fractionDigits, fixed, prefix, postfix }) => (jsx(Text, { size: "text-h3", children: typeof value === 'number'
5012
- ? [prefix, toLocalNumberFormat(fractionDigits, { fixed })(value), postfix]
5013
- .filter(Boolean)
5014
- .join(' ')
5015
- : value })));
5016
-
5017
- const CalculatorValueStyle = 'flex justify-between @xl:flex-col';
5018
- 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: "-" })] })));
5019
-
5020
- const renderFootnote = (text, key) => text ? (jsx(Paragraph, { size: "text-xs", font: "font-light", color: "text-secondary-text", children: text }, String(key))) : null;
5021
-
5022
5276
  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] })] })));
5023
5277
 
5024
5278
  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" }) })] })));
5025
5279
 
5026
5280
  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 }));
5027
5281
 
5028
- const DEFAULT_MONEY_STEP = 1000;
5029
- const renderWantedSumInput = ({ isShowItems = true, step = DEFAULT_MONEY_STEP, postfix = '₽', ...rest }) => (jsx(InputRange, { items: isShowItems
5030
- ? [
5031
- `От ${toLocalNumberFormat(1)(rest.min || 0)} ${postfix}`,
5032
- `До ${toLocalNumberFormat(1)(rest.max || 0)} ${postfix}`,
5033
- ]
5034
- : [], step: step, ...rest }));
5035
-
5036
5282
  const DEFAULT_BONUS_CALCULATOR_PARAMS$1 = {
5037
5283
  minSumTravel: 6000,
5038
5284
  maxSumTravel: 200000,
@@ -5045,13 +5291,13 @@
5045
5291
  travelBonusRate: 0.015,
5046
5292
  restBonusRate: 0.01,
5047
5293
  };
5048
- const MONTHS_IN_YEAR$1 = 12;
5294
+ const MONTHS_IN_YEAR = 12;
5049
5295
  const getBonus = (params, bonusTravelValue, bonusOtherValue) => {
5050
5296
  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;
5051
5297
  const prefBonus = Math.min(Math.round(prefTravelBonusRate * bonusTravelValue) +
5052
5298
  Math.round(prefRestBonusRate * bonusOtherValue), maxBonus);
5053
5299
  const bonus = Math.min(Math.round(travelBonusRate * bonusTravelValue) + Math.round(restBonusRate * bonusOtherValue), maxBonus);
5054
- const yearBonus = prefBonus * prefMonthsNum + bonus * (MONTHS_IN_YEAR$1 - prefMonthsNum);
5300
+ const yearBonus = prefBonus * prefMonthsNum + bonus * (MONTHS_IN_YEAR - prefMonthsNum);
5055
5301
  return [prefBonus, yearBonus];
5056
5302
  };
5057
5303
 
@@ -5107,29 +5353,14 @@
5107
5353
  fractionDigits: 0,
5108
5354
  unit: '',
5109
5355
  color: 'text-primary-text',
5110
- })
5111
- : 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)] })] }) }));
5112
- });
5113
-
5114
- const MONTHS_IN_YEAR = 12;
5115
- const MONTHLY_INTEREST_RATE = MONTHS_IN_YEAR * 100;
5116
- const DEFAULT_MIN_MONTHS = 1;
5117
- const DEFAULT_MAX_MONTHS = 60;
5118
- const DEFAULT_MONTHS = Math.round((DEFAULT_MAX_MONTHS - DEFAULT_MIN_MONTHS) / 2);
5119
-
5120
- const getMoneyDefaultValue = (defaultParams, defaultMoney = 0) => defaultParams?.sum ? defaultParams.sum : defaultMoney;
5121
- const getMonthsDefaultValue = (defaultParams, defaultMonth = 0) => defaultParams?.period &&
5122
- defaultParams.period >= DEFAULT_MIN_MONTHS &&
5123
- defaultParams.period <= DEFAULT_MAX_MONTHS
5124
- ? defaultParams.period
5125
- : defaultMonth;
5356
+ })
5357
+ : 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)] })] }) }));
5358
+ });
5126
5359
 
5127
5360
  const STEP_DAYS = 1;
5128
5361
  const renderDaysInput = (props) => (jsx(InputRange, { items: [`От ${daysText(props.min || 0)}`, `До ${daysText(props.max || 0)}`], step: STEP_DAYS, ...props }));
5129
5362
  const daysText = (days) => `${days} ${Number(days) % 10 === 1 ? 'дня' : 'дней'}`;
5130
5363
 
5131
- 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 })] }));
5132
-
5133
5364
  const renderPayout = (props) => renderBinaryRadioButtonGroup({
5134
5365
  ...props,
5135
5366
  items: [
@@ -5141,22 +5372,6 @@
5141
5372
  const CAPITALIZATION = ' (c капитализацией)';
5142
5373
  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)] }));
5143
5374
 
5144
- const getLimitRangeByKeys = ([minKey, maxKey], limitParams, rateRows = []) => limitParams && limitParams[minKey] && limitParams[maxKey]
5145
- ? {
5146
- [minKey]: limitParams[minKey],
5147
- [maxKey]: limitParams[maxKey],
5148
- }
5149
- : getRangeByKeys([minKey, maxKey], rateRows);
5150
- const getRangeByKeys = ([minKey, maxKey], rows = []) => ({
5151
- [minKey]: rows.length
5152
- ? min(rows.filter((row) => typeof row[minKey] === 'number').map((row) => row[minKey]))
5153
- : 0,
5154
- [maxKey]: rows.length
5155
- ? max(rows.filter((row) => typeof row[minKey] === 'number').map((row) => row[maxKey]))
5156
- : 0,
5157
- });
5158
- const checkRangeByKeys = (value, [minKey, maxKey], sourceBookRow) => value >= sourceBookRow[minKey] && value <= sourceBookRow[maxKey];
5159
-
5160
5375
  const DEPOSIT_RATES_SERVICE_MAP = {
5161
5376
  UL: 'businessdepositrates',
5162
5377
  IP: 'selfemployeddepositrates',
@@ -5166,320 +5381,104 @@
5166
5381
  const { data } = useAsyncData(serviceName ? `${API_BASE_URI}/depositrates/${serviceName}` : null, fetchJSONUnsafe);
5167
5382
  return Array.isArray(data) ? data : [];
5168
5383
  }
5169
-
5170
- const BUSINESS_MIN_DAYS = 1;
5171
- const BUSINESS_MAX_DAYS = 1095;
5172
- const BUSINESS_OPERATING_MIN_DAYS = 90;
5173
- const BUSINESS_OPERATING_MAX_DAYS = 730;
5174
- const DEFAULT_BUSINESS_DEPOSIT_CALCULATOR_PARAMS = {
5175
- minSum: 1000,
5176
- maxSum: 100000001,
5177
- minDays: BUSINESS_MIN_DAYS,
5178
- maxDays: BUSINESS_MAX_DAYS,
5179
- rate: 0,
5180
- isMonthlyInterestPayment: true,
5181
- isReplenished: false,
5182
- isPartialWithdrawal: false,
5183
- depositeName: "Депозит 'Стабильный'",
5184
- };
5185
- const useBusinessDepositParams = (userInputParams, rateParams) => {
5186
- const { daysValue, moneyValue, isPartialWithdrawal, isReplenished, isMonthlyInterestPayment } = userInputParams;
5187
- const isOperatingDeposit = isReplenished || isPartialWithdrawal;
5188
- const isDisabledOperatingDeposit = daysValue < BUSINESS_OPERATING_MIN_DAYS || daysValue > BUSINESS_OPERATING_MAX_DAYS;
5189
- const rateRows = useBusinessDepositRates(rateParams);
5190
- const businessDepositCalculatorSourceBookParams = rateRows?.find((_) => {
5191
- return (isMonthlyInterestPayment === _.isMonthlyInterestPayment &&
5192
- checkIsOperatingDeposit(isOperatingDeposit, _) &&
5193
- checkRangeByKeys(moneyValue, ['minSum', 'maxSum'], _) &&
5194
- checkRangeByKeys(daysValue, ['minDays', 'maxDays'], _));
5195
- }) || DEFAULT_BUSINESS_DEPOSIT_CALCULATOR_PARAMS;
5196
- const { rate } = businessDepositCalculatorSourceBookParams;
5197
- const income = getDepositIncome$1(rate, userInputParams);
5198
- const finalSum = moneyValue + income;
5199
- const sourceBookRows = rateRows || [DEFAULT_BUSINESS_DEPOSIT_CALCULATOR_PARAMS];
5200
- return {
5201
- ...businessDepositCalculatorSourceBookParams,
5202
- ...getRangeByKeys(['minSum', 'maxSum'], sourceBookRows),
5203
- ...getRangeByKeys(['minDays', 'maxDays'], sourceBookRows),
5204
- ...userInputParams,
5205
- isDisabledOperatingDeposit,
5206
- income,
5207
- finalSum,
5208
- };
5209
- };
5210
- const checkIsOperatingDeposit = (isOperatingDeposit, sourceBookRow) => isOperatingDeposit
5211
- ? sourceBookRow.isReplenished && sourceBookRow.isPartialWithdrawal
5212
- : !sourceBookRow.isReplenished && !sourceBookRow.isPartialWithdrawal;
5213
- const getDepositIncome$1 = (rate, userInputParams) => {
5214
- const { isMonthlyInterestPayment, moneyValue, daysValue } = userInputParams;
5215
- /*
5216
- Приблизительный расчёт, не учитывающий разницу в количестве дней в месяцах. Месяц принят за 30 дней, год за 365 дней.
5217
- */
5218
- if (isMonthlyInterestPayment) {
5219
- return Math.round(moneyValue * Math.pow((1200 + rate) / 1200, daysValue / 30) - moneyValue);
5220
- }
5221
- else {
5222
- return Math.round((moneyValue * rate * daysValue) / 365 / 100);
5223
- }
5224
- };
5225
-
5226
- const BUSINESS_DEFAULT_SUM = 100000;
5227
- const BUSINESS_DEFAULT_DAYS = 60;
5228
- const CalculatorBusinessDeposit = UniBlock(({ className = '', title, buttons, footnote, bottomFootnote, isShowDepositeName, defaultParams, rateParams, ...rest }) => {
5229
- const [userInputParams, { field }] = useForm({
5230
- moneyValue: getMoneyDefaultValue(defaultParams, BUSINESS_DEFAULT_SUM),
5231
- daysValue: getMonthsDefaultValue(defaultParams, BUSINESS_DEFAULT_DAYS),
5232
- isReplenished: Boolean(defaultParams?.isReplenished),
5233
- isPartialWithdrawal: Boolean(defaultParams?.isPartialWithdrawal),
5234
- isMonthlyInterestPayment: Boolean(defaultParams?.isMonthlyInterestPayment),
5235
- });
5236
- const calculatorParams = useBusinessDepositParams(userInputParams, rateParams);
5237
- const { income, finalSum, rate, depositeName } = calculatorParams;
5238
- return (jsx(CalculatorLayout, { className: className, title: title, ...rest, children: jsxs("section", { className: style(CalculatorStyle.wrapper, className), children: [jsxs("div", { className: CalculatorStyle.input, children: [renderWantedSumInput({
5239
- title: 'Сумма, ₽',
5240
- min: calculatorParams.minSum,
5241
- max: calculatorParams.maxSum,
5242
- ...field('moneyValue'),
5243
- value: calculatorParams.moneyValue,
5244
- }), renderDaysInput({
5245
- title: 'Срок, дней',
5246
- min: calculatorParams.minDays,
5247
- max: calculatorParams.maxDays,
5248
- ...field('daysValue'),
5249
- value: calculatorParams.daysValue,
5250
- }), jsxs("div", { className: "flex flex-col sm:flex-row gap-y-m gap-x-5xl", children: [renderBusinessDepositParamsForm(calculatorParams, field), renderPayout({
5251
- title: 'Выплата процентов',
5252
- orientation: 'vertical',
5253
- ...field('isMonthlyInterestPayment'),
5254
- className: 'sm:flex-col',
5255
- })] })] }), renderRate({
5256
- rate,
5257
- depositeName,
5258
- isShowDepositeName,
5259
- }), renderDepositResult({
5260
- income,
5261
- finalSum,
5262
- buttons,
5263
- footnotes: [footnote, bottomFootnote],
5264
- })] }) }));
5265
- });
5266
- 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 })] })] }));
5267
-
5268
- const getDefaultParamsMin = (rateRows) => getDefaultParams([(i, acc) => i < acc, (i, prev) => i?.maxSum > prev?.maxSum], rateRows);
5269
- const getDefaultParamsMax = (rateRows = [], isNewClient = false) => getDefaultParams([(i, acc) => i > acc, (i, prev) => i?.minSum < prev?.minSum], rateRows?.filter((_) => isNewClient === Boolean(_?.isNewClient)));
5270
- const getDefaultParams = (comparators, rateRows) => {
5271
- if (!rateRows?.length) {
5272
- return undefined;
5273
- }
5274
- const rates = rateRows?.reduce((acc, i) => {
5275
- if (comparators[0](i.rate, acc[0].rate)) {
5276
- return [i];
5277
- }
5278
- else if (i.rate === acc[0].rate) {
5279
- return [...acc, i];
5280
- }
5281
- return acc;
5282
- }, [rateRows[0]]);
5283
- if (rates.length > 1) {
5284
- return rates.reduce((prev, i) => (comparators[1](i, prev) ? i : prev), rates[0]);
5285
- }
5286
- return rates[0];
5287
- };
5288
-
5289
- const STEP_MONTHS = 1;
5290
- 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 }));
5291
- const monthText = (month) => `${month} ${Number(month) % 10 === 1 ? 'месяца' : 'месяцев'}`;
5292
-
5293
- const renderPaymentType = (props) => renderBinaryRadioButtonGroup({
5294
- ...props,
5295
- className: 'sm:flex-col',
5296
- items: [
5297
- { id: 'annuity', text: 'Аннуитетный' },
5298
- { id: 'differential', text: 'Дифференцированный' },
5299
- ],
5300
- });
5301
-
5302
- const setDefaultParamsCalc = ({ field, defParams, calcParams, map, monthsValue = 'maxMonths', }) => {
5303
- Object.entries(map).forEach(([key, value]) => {
5304
- field?.(key)?.onChange?.(defParams?.[value]);
5305
- });
5306
- field?.('monthsValue')?.onChange?.(clamp(defParams?.[monthsValue], calcParams.minMonths, calcParams.maxMonths));
5307
- };
5308
-
5309
- /**
5310
- * Формулы расчёта аннуитетных и дифференцированных платежей:
5311
- * https://finuslugi.ru/potrebitelskie_kredity/stat_annuitetnye_i_differentsirovannye_platezhi
5312
- */
5313
- const getMonthlyPayment = (rate, params) => {
5314
- const { isAnnuity, moneyValue, monthsValue, moneyExtra } = params;
5315
- if (rate === 0) {
5316
- return 0;
5317
- }
5318
- else if (isAnnuity) {
5319
- const i = rate / MONTHLY_INTEREST_RATE; // Используется значение ставки в процентах
5320
- if (moneyExtra) {
5321
- return (moneyValue + moneyExtra) * (i + i / (Math.pow(1 + i, monthsValue) - 1));
5322
- }
5323
- else {
5324
- return moneyValue * (i + i / (Math.pow(1 + i, monthsValue) - 1));
5325
- }
5326
- }
5327
- else {
5328
- return Math.round(moneyValue / monthsValue) + moneyValue * (rate / (MONTHS_IN_YEAR * 100)); // Используется значение ставки (rate) в процентах, делённое на сто.
5329
- }
5330
- };
5331
-
5332
- const DEFAULT_MIN_SUM$2 = 10000;
5333
- const DEFAULT_MAX_SUM$1 = 5000000;
5334
- const DEFAULT_CREDIT_CALCULATOR_PARAMS = {
5335
- minSum: DEFAULT_MIN_SUM$2,
5336
- maxSum: DEFAULT_MAX_SUM$1,
5337
- minMonths: DEFAULT_MIN_MONTHS,
5338
- maxMonths: DEFAULT_MAX_MONTHS,
5339
- rate: 0,
5340
- isSalaryClient: false,
5341
- isPensionClient: false,
5342
- isStateEmployee: false,
5343
- isInsurance: true,
5344
- };
5345
-
5346
- const checkCreditSourceBookRowCommonParams = (props) => checkRowParam$1({
5347
- ...props,
5348
- fieldKey: 'isSalaryClient',
5349
- viewSettingFieldKey: 'isShowSalaryClient',
5350
- }) &&
5351
- checkRowParam$1({
5352
- ...props,
5353
- fieldKey: 'isStateEmployee',
5354
- viewSettingFieldKey: 'isShowStateEmployee',
5355
- }) &&
5356
- checkRowParam$1({
5357
- ...props,
5358
- fieldKey: 'isPensionClient',
5359
- viewSettingFieldKey: 'isShowPensionClient',
5360
- }) &&
5361
- checkRowParam$1({
5362
- ...props,
5363
- fieldKey: 'isInsurance',
5364
- viewSettingFieldKey: 'isShowInsurance',
5365
- });
5366
- const checkRowParam$1 = ({ row, userInputParams, paramsViewSettings, fieldKey, viewSettingFieldKey, }) => {
5367
- const isExclude = paramsViewSettings ? !paramsViewSettings[viewSettingFieldKey] : false;
5368
- return isExclude || userInputParams[fieldKey] === row[fieldKey];
5369
- };
5370
-
5371
- const getCreditCalculatorLimitParams = ({ limitRows, userInputParams, paramsViewSettings, }) => limitRows?.find((row) => checkCreditSourceBookRowCommonParams({
5372
- row,
5373
- userInputParams,
5374
- paramsViewSettings,
5375
- }));
5376
-
5377
- const getCreditCalculatorRateParams = ({ rateRows = [], userInputParams, paramsViewSettings, moneyValue, monthsValue, }) => rateRows?.find((row) => checkCreditSourceBookRowCommonParams({
5378
- row,
5379
- userInputParams,
5380
- paramsViewSettings,
5381
- }) &&
5382
- checkRangeByKeys(moneyValue, ['minSum', 'maxSum'], row) &&
5383
- checkRangeByKeys(monthsValue, ['minMonths', 'maxMonths'], row)) || DEFAULT_CREDIT_CALCULATOR_PARAMS;
5384
-
5385
- const getCreditCalculatorParams = (userInputParams, calcSource, paramsViewSettings) => {
5386
- const { moneyValue, monthsValue } = userInputParams;
5387
- const rateRows = calcSource?.rateRows || [DEFAULT_CREDIT_CALCULATOR_PARAMS];
5388
- const limitRows = calcSource?.limitRows || [];
5389
- const creditCalculatorSourceBookLimitParams = getCreditCalculatorLimitParams({
5390
- limitRows,
5391
- userInputParams,
5392
- paramsViewSettings,
5393
- });
5394
- const { minSum, maxSum } = getLimitRangeByKeys(['minSum', 'maxSum'], creditCalculatorSourceBookLimitParams, rateRows);
5395
- const { minMonths, maxMonths } = getLimitRangeByKeys(['minMonths', 'maxMonths'], creditCalculatorSourceBookLimitParams, rateRows);
5396
- const creditCalculatorRateParams = getCreditCalculatorRateParams({
5397
- rateRows,
5398
- userInputParams,
5399
- paramsViewSettings,
5400
- moneyValue,
5401
- monthsValue,
5402
- });
5403
- const { rate } = creditCalculatorRateParams;
5404
- const monthlyPayment = getMonthlyPayment(rate, userInputParams);
5384
+
5385
+ const BUSINESS_MIN_DAYS = 1;
5386
+ const BUSINESS_MAX_DAYS = 1095;
5387
+ const BUSINESS_OPERATING_MIN_DAYS = 90;
5388
+ const BUSINESS_OPERATING_MAX_DAYS = 730;
5389
+ const DEFAULT_BUSINESS_DEPOSIT_CALCULATOR_PARAMS = {
5390
+ minSum: 1000,
5391
+ maxSum: 100000001,
5392
+ minDays: BUSINESS_MIN_DAYS,
5393
+ maxDays: BUSINESS_MAX_DAYS,
5394
+ rate: 0,
5395
+ isMonthlyInterestPayment: true,
5396
+ isReplenished: false,
5397
+ isPartialWithdrawal: false,
5398
+ depositeName: "Депозит 'Стабильный'",
5399
+ };
5400
+ const useBusinessDepositParams = (userInputParams, rateParams) => {
5401
+ const { daysValue, moneyValue, isPartialWithdrawal, isReplenished, isMonthlyInterestPayment } = userInputParams;
5402
+ const isOperatingDeposit = isReplenished || isPartialWithdrawal;
5403
+ const isDisabledOperatingDeposit = daysValue < BUSINESS_OPERATING_MIN_DAYS || daysValue > BUSINESS_OPERATING_MAX_DAYS;
5404
+ const rateRows = useBusinessDepositRates(rateParams);
5405
+ const businessDepositCalculatorSourceBookParams = rateRows?.find((_) => {
5406
+ return (isMonthlyInterestPayment === _.isMonthlyInterestPayment &&
5407
+ checkIsOperatingDeposit(isOperatingDeposit, _) &&
5408
+ checkRangeByKeys(moneyValue, ['minSum', 'maxSum'], _) &&
5409
+ checkRangeByKeys(daysValue, ['minDays', 'maxDays'], _));
5410
+ }) || DEFAULT_BUSINESS_DEPOSIT_CALCULATOR_PARAMS;
5411
+ const { rate } = businessDepositCalculatorSourceBookParams;
5412
+ const income = getDepositIncome$1(rate, userInputParams);
5413
+ const finalSum = moneyValue + income;
5414
+ const sourceBookRows = rateRows || [DEFAULT_BUSINESS_DEPOSIT_CALCULATOR_PARAMS];
5405
5415
  return {
5406
- ...creditCalculatorRateParams,
5416
+ ...businessDepositCalculatorSourceBookParams,
5417
+ ...getRangeByKeys(['minSum', 'maxSum'], sourceBookRows),
5418
+ ...getRangeByKeys(['minDays', 'maxDays'], sourceBookRows),
5407
5419
  ...userInputParams,
5408
- minSum,
5409
- maxSum,
5410
- minMonths,
5411
- maxMonths,
5412
- moneyValue,
5413
- monthsValue,
5414
- monthlyPayment,
5420
+ isDisabledOperatingDeposit,
5421
+ income,
5422
+ finalSum,
5415
5423
  };
5416
5424
  };
5417
-
5418
- const isDefaultParams = (defaultParams = {}) => Boolean(Object.values(defaultParams).filter((_) => _).length);
5419
-
5420
- const CREDIT_DEFAULT_SUM = 200000;
5421
- const MAP$1 = {
5422
- isSalaryClient: 'isSalaryClient',
5423
- isStateEmployee: 'isStateEmployee',
5424
- isPensionClient: 'isPensionClient',
5425
- isInsurance: 'isInsurance',
5426
- moneyValue: 'maxSum',
5425
+ const checkIsOperatingDeposit = (isOperatingDeposit, sourceBookRow) => isOperatingDeposit
5426
+ ? sourceBookRow.isReplenished && sourceBookRow.isPartialWithdrawal
5427
+ : !sourceBookRow.isReplenished && !sourceBookRow.isPartialWithdrawal;
5428
+ const getDepositIncome$1 = (rate, userInputParams) => {
5429
+ const { isMonthlyInterestPayment, moneyValue, daysValue } = userInputParams;
5430
+ /*
5431
+ Приблизительный расчёт, не учитывающий разницу в количестве дней в месяцах. Месяц принят за 30 дней, год за 365 дней.
5432
+ */
5433
+ if (isMonthlyInterestPayment) {
5434
+ return Math.round(moneyValue * Math.pow((1200 + rate) / 1200, daysValue / 30) - moneyValue);
5435
+ }
5436
+ else {
5437
+ return Math.round((moneyValue * rate * daysValue) / 365 / 100);
5438
+ }
5427
5439
  };
5428
- const CalculatorCredit = UniBlock(({ className, title, calcSource, buttons, footnote, paramsViewSettings, defaultParams, registerSubmit, ...rest }) => {
5429
- const defaultParamsCals = getDefaultParamsMin(calcSource?.rateRows);
5430
- const [userInputParams, { field, onSubmit }] = useForm({
5431
- moneyValue: getMoneyDefaultValue(defaultParams, CREDIT_DEFAULT_SUM),
5432
- monthsValue: getMonthsDefaultValue(defaultParams, DEFAULT_MONTHS),
5433
- isAnnuity: Boolean(defaultParams?.isAnnuity),
5434
- isInsurance: Boolean(defaultParams?.isEnableInsurance),
5435
- isSalaryClient: Boolean(defaultParams?.isEnableSalaryClient),
5436
- isPensionClient: Boolean(defaultParams?.isEnablePensionClient),
5437
- isStateEmployee: Boolean(defaultParams?.isEnableStateEmployee),
5438
- });
5439
- registerSubmit?.(onSubmit);
5440
- const calcParams = getCreditCalculatorParams(userInputParams, calcSource, paramsViewSettings);
5441
- const paymentTypeElement = renderPaymentType({
5442
- title: 'Тип платежа',
5443
- orientation: 'vertical',
5444
- ...field('isAnnuity'),
5440
+
5441
+ const BUSINESS_DEFAULT_SUM = 100000;
5442
+ const BUSINESS_DEFAULT_DAYS = 60;
5443
+ const CalculatorBusinessDeposit = UniBlock(({ className = '', title, buttons, footnote, bottomFootnote, isShowDepositeName, defaultParams, rateParams, ...rest }) => {
5444
+ const [userInputParams, { field }] = useForm({
5445
+ moneyValue: getMoneyDefaultValue(defaultParams, BUSINESS_DEFAULT_SUM),
5446
+ daysValue: getMonthsDefaultValue(defaultParams, BUSINESS_DEFAULT_DAYS),
5447
+ isReplenished: Boolean(defaultParams?.isReplenished),
5448
+ isPartialWithdrawal: Boolean(defaultParams?.isPartialWithdrawal),
5449
+ isMonthlyInterestPayment: Boolean(defaultParams?.isMonthlyInterestPayment),
5445
5450
  });
5446
- const { onChange: setMoneyValue } = field('moneyValue');
5447
- const { onChange: setMonthsValue } = field('monthsValue');
5448
- useEffect(() => {
5449
- setMoneyValue &&
5450
- setMoneyValue(clamp(userInputParams.moneyValue, calcParams.minSum, calcParams.maxSum));
5451
- }, [calcParams.minSum, calcParams.maxSum]);
5452
- useEffect(() => {
5453
- setMonthsValue &&
5454
- setMonthsValue(clamp(userInputParams.monthsValue, calcParams.minMonths, calcParams.maxMonths));
5455
- }, [calcParams.minMonths, calcParams.maxMonths]);
5456
- useEffect(() => {
5457
- if (!isDefaultParams(defaultParams) && defaultParamsCals) {
5458
- setDefaultParamsCalc({
5459
- field,
5460
- defParams: defaultParamsCals,
5461
- calcParams,
5462
- map: MAP$1,
5463
- monthsValue: 'minMonths',
5464
- });
5465
- }
5466
- }, [calcSource, defaultParams]);
5451
+ const calculatorParams = useBusinessDepositParams(userInputParams, rateParams);
5452
+ const { income, finalSum, rate, depositeName } = calculatorParams;
5467
5453
  return (jsx(CalculatorLayout, { className: className, title: title, ...rest, children: jsxs("section", { className: style(CalculatorStyle.wrapper, className), children: [jsxs("div", { className: CalculatorStyle.input, children: [renderWantedSumInput({
5468
- title: 'Сумма кредита, ₽',
5469
- step: 500,
5470
- min: calcParams.minSum,
5471
- max: calcParams.maxSum,
5454
+ title: 'Сумма, ₽',
5455
+ min: calculatorParams.minSum,
5456
+ max: calculatorParams.maxSum,
5472
5457
  ...field('moneyValue'),
5473
- value: calcParams.moneyValue,
5474
- }), renderMonthsInput({
5475
- title: 'Срок кредита, месяцев',
5476
- min: calcParams.minMonths,
5477
- max: calcParams.maxMonths,
5478
- ...field('monthsValue'),
5479
- value: calcParams.monthsValue,
5480
- }), 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)] })] }) }));
5458
+ value: calculatorParams.moneyValue,
5459
+ }), renderDaysInput({
5460
+ title: 'Срок, дней',
5461
+ min: calculatorParams.minDays,
5462
+ max: calculatorParams.maxDays,
5463
+ ...field('daysValue'),
5464
+ value: calculatorParams.daysValue,
5465
+ }), jsxs("div", { className: "flex flex-col sm:flex-row gap-y-m gap-x-5xl", children: [renderBusinessDepositParamsForm(calculatorParams, field), renderPayout({
5466
+ title: 'Выплата процентов',
5467
+ orientation: 'vertical',
5468
+ ...field('isMonthlyInterestPayment'),
5469
+ className: 'sm:flex-col',
5470
+ })] })] }), renderRate({
5471
+ rate,
5472
+ depositeName,
5473
+ isShowDepositeName,
5474
+ }), renderDepositResult({
5475
+ income,
5476
+ finalSum,
5477
+ buttons,
5478
+ footnotes: [footnote, bottomFootnote],
5479
+ })] }) }));
5481
5480
  });
5482
- 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] }));
5481
+ 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 })] })] }));
5483
5482
 
5484
5483
  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);
5485
5484
 
@@ -6133,10 +6132,10 @@
6133
6132
  }
6134
6133
  }), [options?.parent]);
6135
6134
  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
6136
- ? renderFoldButton$1(options?.parent, data, isVisible)
6135
+ ? renderFoldButton$2(options?.parent, data, isVisible)
6137
6136
  : null })) : (jsx("div", { children: visibleCells }))] }));
6138
6137
  });
6139
- 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: () => {
6138
+ 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: () => {
6140
6139
  if (parent !== undefined) {
6141
6140
  defaultEventBus.fire('fold', { type: 'fold', isUnfolded: !isUnfolded, parent });
6142
6141
  }
@@ -6194,6 +6193,16 @@
6194
6193
 
6195
6194
  const sendSignalToProcess = (body) => doRequest('/user-data/sendSignalToProcess', 'POST', body);
6196
6195
 
6196
+ const useInterval = (handler, period) => {
6197
+ const timer = useRef(null);
6198
+ const clearTimer = useCallback(() => timer.current && clearInterval(timer.current), []);
6199
+ useEffect(() => {
6200
+ timer.current = setInterval(() => handler(clearTimer), period);
6201
+ return clearTimer;
6202
+ }, [handler, period]);
6203
+ return clearTimer;
6204
+ };
6205
+
6197
6206
  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] })] })));
6198
6207
 
6199
6208
  const TimerCircle = JSX(({ interval = 0, intervalExpireAction = () => null, title, __html }) => {
@@ -6210,7 +6219,9 @@
6210
6219
  } }), 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] })] }));
6211
6220
  });
6212
6221
 
6213
- 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: {
6222
+ const CreditCardFormStatus = JSX(({ title, description: dsc, infoCard, sectionInfoTitle, sectionInfo, sectionAdditionalTitle, sectionInfoAdditional, buttonText, interval, intervalExpireAction = () => {
6223
+ return;
6224
+ }, ...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: {
6214
6225
  text: infoCard?.link?.text,
6215
6226
  } })) : null, buttonText ? (jsx(LinkButton, { href: "/natural", text: buttonText, version: "primary", className: "w-full mt-lg" })) : null] })));
6216
6227
  const SectionInfo$1 = ({ title, items, countColumns = false, }) => {
@@ -6224,9 +6235,9 @@
6224
6235
 
6225
6236
  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" })));
6226
6237
 
6227
- const PendingStatusContent$1 = JSX(() => {
6238
+ const PendingStatusContent$1 = JSX(({ handleExpireTimer }) => {
6228
6239
  const [leadForm] = useLocalStorage('leadForm');
6229
- 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: [
6240
+ 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: [
6230
6241
  {
6231
6242
  label: 'Название продукта',
6232
6243
  description: 'Кредитная карта',
@@ -6296,20 +6307,21 @@
6296
6307
  await sendSignalToProcess({ signalType, taskId });
6297
6308
  }
6298
6309
  })();
6299
- const trackStatus = useCallback(async () => {
6300
- const res = await getTaskStatus({ taskId });
6301
- if (res && res?.statusCd !== STATUS_TYPE.process) {
6302
- clearInterval(pullingInterval);
6303
- setStatus(res.statusCd);
6304
- }
6305
- }, []);
6306
- const pullingInterval = setInterval(trackStatus, 30000);
6307
- }, []);
6308
- return renderStatus$1(status);
6310
+ }, [taskId]);
6311
+ const trackStatus = useCallback(async (stopInterval) => {
6312
+ const res = await getTaskStatus({ taskId });
6313
+ if (res && res?.statusCd !== STATUS_TYPE.process) {
6314
+ stopInterval();
6315
+ setStatus(res.statusCd);
6316
+ }
6317
+ }, [taskId]);
6318
+ useInterval(trackStatus, 30000);
6319
+ const handleExpire = () => setStatus(STATUS_TYPE.rework);
6320
+ return renderStatus$1(status, handleExpire);
6309
6321
  });
6310
- const renderStatus$1 = (status) => {
6322
+ const renderStatus$1 = (status, handleExpire) => {
6311
6323
  const statusesMap = {
6312
- IN_PROCESS: jsx(PendingStatusContent$1, {}),
6324
+ IN_PROCESS: jsx(PendingStatusContent$1, { handleExpireTimer: handleExpire }),
6313
6325
  CANCELLED: jsx(FailedStatusContent$1, {}),
6314
6326
  APPROVED: jsx(SuccessStatusContent$1, {}),
6315
6327
  REVISION: jsx(ReworkStatusContent$1, {}),
@@ -6461,12 +6473,12 @@
6461
6473
  : null;
6462
6474
  };
6463
6475
 
6464
- const renderInputs$1 = ({ field, inputs }) => inputs.map(getField(field, ''));
6476
+ const renderInputs$1 = ({ field, inputs, params }) => inputs.map(getField(field, params));
6465
6477
 
6466
- const renderStep$1 = ({ sections, field, step }) => sections?.map(({ inputs: origInputs = [], columns, title }, i) => {
6478
+ const renderStep$1 = ({ sections, field, step, params }) => sections?.map(({ inputs: origInputs = [], columns, title }, i) => {
6467
6479
  const inputs = calculateInputs$1(getValue$3(field))(origInputs, step);
6468
6480
  const filteredInputs = inputs.filter((_) => !checkCondition$1(_, getValue$3(field)));
6469
- return (jsxs("div", { className: style(inputColumnStyles(columns), 'grid gap-x-m'), children: [renderInfo$2(filteredInputs), renderTitle(title), renderInputs$1({ field, inputs })] }, `section-${i}`));
6481
+ return (jsxs("div", { className: style(inputColumnStyles(columns), 'grid gap-x-m'), children: [renderInfo$2(filteredInputs), renderTitle(title), renderInputs$1({ field, inputs, params })] }, `section-${i}`));
6470
6482
  });
6471
6483
  const getValue$3 = (field) => (name) => field(name)?.value;
6472
6484
 
@@ -6686,11 +6698,7 @@
6686
6698
  const CreditCardFormStep = JSX(({ step, sections, onPrevStep, onNextStep, isFormFinished, finishForm }) => {
6687
6699
  const [localStorageData, saveStep] = useLocalStorage('leadForm');
6688
6700
  const initialState = getInitialFormState$1(step, localStorageData);
6689
- const customSubmit = useRef(undefined);
6690
6701
  const inputs = (sections?.flatMap((_) => _?.inputs) || []);
6691
- const registerSubmit = useCallback((submit) => {
6692
- customSubmit.current = submit;
6693
- }, []);
6694
6702
  const { handleSubmit } = useCreditCardFormAPI({
6695
6703
  step,
6696
6704
  inputs,
@@ -6699,16 +6707,9 @@
6699
6707
  finishForm,
6700
6708
  });
6701
6709
  const [, { field, onSubmit }] = useForm(initialState, {
6702
- onSubmit: (formData, ev) => {
6703
- handleSubmit({ ...formData, ...customSubmit.current?.(ev) });
6704
- },
6710
+ onSubmit: handleSubmit,
6705
6711
  });
6706
- return isFormFinished ? (jsx(CreditCardFormStatusTracker, {})) : (jsxs("form", { onSubmit: onSubmit, className: "space-y-m", children: [renderStep$1({
6707
- sections,
6708
- field,
6709
- step,
6710
- registerSubmit,
6711
- }), jsx(StepsNavigationButtons$1, { step: step, onPrevStep: onPrevStep })] }));
6712
+ return isFormFinished ? (jsx(CreditCardFormStatusTracker, {})) : (jsxs("form", { onSubmit: onSubmit, className: "space-y-m", children: [renderStep$1({ sections, field, step }), jsx(StepsNavigationButtons$1, { step: step, onPrevStep: onPrevStep })] }));
6712
6713
  });
6713
6714
 
6714
6715
  /* eslint-disable max-lines */
@@ -7051,8 +7052,8 @@
7051
7052
  ],
7052
7053
  ];
7053
7054
 
7054
- const WIZARD_STEPS$1 = 6;
7055
- const WIZARD_TITLES$1 = [
7055
+ const STEPS$1 = 6;
7056
+ const TITLES = [
7056
7057
  'Параметры карты',
7057
7058
  'Персональные данные',
7058
7059
  'Данные о трудоустройстве',
@@ -7066,7 +7067,7 @@
7066
7067
  const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
7067
7068
  useEffect(updateRefreshToken, []);
7068
7069
  const handleNextStep = useCallback(() => {
7069
- setStep((_) => Math.min(_ + 1, WIZARD_STEPS$1));
7070
+ setStep((_) => Math.min(_ + 1, STEPS$1));
7070
7071
  scrollToTop();
7071
7072
  }, []);
7072
7073
  const handlePrevStep = useCallback(() => {
@@ -7076,7 +7077,7 @@
7076
7077
  }, []);
7077
7078
  const sections = useMemo(() => stepsSectionsMap$1[step], [step]);
7078
7079
  const [isFormFinished, setIsFormFinished] = useState(false);
7079
- 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)) })] }) }));
7080
+ 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)) })] }) }));
7080
7081
  });
7081
7082
 
7082
7083
  const CreditFormProgress = JSX(({ step = 1, totalSteps = 5, stepsTitles = [] }) => {
@@ -7186,16 +7187,15 @@
7186
7187
  await sendSignalToProcess({ signalType, taskId });
7187
7188
  }
7188
7189
  })();
7189
- const trackStatus = () => taskId &&
7190
- getTaskStatus({ taskId }).then((res) => {
7191
- if (res?.statusCd && res.statusCd !== STATUS_TYPE.process) {
7192
- clearInterval(pullingInterval);
7193
- setStatus(res.statusCd);
7194
- }
7195
- });
7196
- const pullingInterval = setInterval(trackStatus, 30000);
7197
- return () => clearInterval(pullingInterval);
7198
- }, []);
7190
+ }, [taskId]);
7191
+ const trackStatus = useCallback(async (stopInterval) => {
7192
+ const res = await getTaskStatus({ taskId });
7193
+ if (res && res?.statusCd !== STATUS_TYPE.process) {
7194
+ stopInterval();
7195
+ setStatus(res.statusCd);
7196
+ }
7197
+ }, [taskId]);
7198
+ useInterval(trackStatus, 30000);
7199
7199
  const handleExpire = () => setStatus(STATUS_TYPE.rework);
7200
7200
  return renderStatus(status, handleExpire);
7201
7201
  });
@@ -7211,13 +7211,15 @@
7211
7211
 
7212
7212
  const formStateMap = [
7213
7213
  {
7214
- moneyValue: 0,
7215
- monthsValue: 0,
7216
- isAnnuity: false,
7217
- isInsurance: false,
7218
- isSalaryClient: false,
7219
- isPensionClient: false,
7220
- isStateEmployee: false,
7214
+ calculator: {
7215
+ moneyValue: 0,
7216
+ monthsValue: 0,
7217
+ isAnnuity: false,
7218
+ isInsurance: false,
7219
+ isSalaryClient: false,
7220
+ isPensionClient: false,
7221
+ isStateEmployee: false,
7222
+ },
7221
7223
  },
7222
7224
  {
7223
7225
  surname: '',
@@ -7343,11 +7345,11 @@
7343
7345
  : null;
7344
7346
  };
7345
7347
 
7346
- const renderInputs = ({ field, inputs }) => inputs.map(getField(field, ''));
7348
+ const renderInputs = ({ field, inputs, params }) => inputs.map(getField(field, params));
7347
7349
 
7348
- const renderStep = ({ sections, field, step }) => sections?.map(({ inputs: origInputs = [], columns, title }, i) => {
7350
+ const renderStep = ({ sections, field, step, params }) => sections?.map(({ inputs: origInputs = [], columns, title }, i) => {
7349
7351
  const inputs = calculateInputs(getValue$1(field))(origInputs, step);
7350
- return (jsxs("div", { className: style(inputColumnStyles(columns), 'grid gap-x-m'), children: [renderInfo$1(inputs), renderTitle(title), renderInputs({ field, inputs })] }, `section-${i}`));
7352
+ return (jsxs("div", { className: style(inputColumnStyles(columns), 'grid gap-x-m'), children: [renderInfo$1(inputs), renderTitle(title), renderInputs({ field, inputs, params })] }, `section-${i}`));
7351
7353
  });
7352
7354
  const getValue$1 = (field) => (name) => field(name)?.value;
7353
7355
 
@@ -7357,6 +7359,19 @@
7357
7359
  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 ? 'Отправить заявку' : 'Далее' })] }));
7358
7360
  });
7359
7361
 
7362
+ const PAYMENT_TYPE_DATA = {
7363
+ annuity: { key: 'ANNUITY', value: 'Аннуитетный' },
7364
+ differential: { key: 'DIFFERENTIAL', value: 'Дифференцированный ' },
7365
+ };
7366
+ const getCalcData = (formData) => {
7367
+ const { moneyValue, monthsValue, isAnnuity } = formData?.calculator ?? {};
7368
+ return {
7369
+ loanAmount: moneyValue,
7370
+ creditPeriod: monthsValue,
7371
+ paymentTypeCd: PAYMENT_TYPE_DATA[isAnnuity ? 'annuity' : 'differential'],
7372
+ };
7373
+ };
7374
+
7360
7375
  const getFifthStepData = (formData) => {
7361
7376
  const { addressRetail } = formData;
7362
7377
  return {
@@ -7419,7 +7434,6 @@
7419
7434
  generalSeniority: experience5Years,
7420
7435
  jobsNumber,
7421
7436
  lastWorkDuration: lastJobExperience,
7422
- payrollCardRshbFlg: true,
7423
7437
  positionCd: positionOrganization,
7424
7438
  participantContacts: getParticipantContacts({
7425
7439
  organizationPhone: organizationPhone && formatPhone(organizationPhone),
@@ -7452,16 +7466,11 @@
7452
7466
  };
7453
7467
  };
7454
7468
 
7455
- const PAYMENT_TYPE_DATA = {
7456
- annuity: { key: 'ANNUITY', value: 'Аннуитетный' },
7457
- differential: { key: 'DIFFERENTIAL', value: 'Дифференцированный ' },
7458
- };
7459
7469
  const getZeroStepData = (formData) => {
7460
- const { moneyValue, monthsValue, isAnnuity } = formData;
7470
+ const { isInsurance, isSalaryClient } = formData?.calculator ?? {};
7461
7471
  return {
7462
- loanAmount: moneyValue,
7463
- creditPeriod: monthsValue,
7464
- paymentTypeCd: PAYMENT_TYPE_DATA[isAnnuity ? 'annuity' : 'differential'],
7472
+ payrollCardRshbFlg: isInsurance,
7473
+ consentInsuranceFlg: isSalaryClient,
7465
7474
  };
7466
7475
  };
7467
7476
 
@@ -7487,7 +7496,7 @@
7487
7496
  ...getCurrentStepData(step, formData),
7488
7497
  },
7489
7498
  ],
7490
- ...getZeroStepData(formData),
7499
+ ...getCalcData(formData),
7491
7500
  ...getFifthStepData(formData),
7492
7501
  esiaAccountTypeCd: {
7493
7502
  key: formData?.esiaAccountTypeCd?.key,
@@ -7498,7 +7507,7 @@
7498
7507
  const getCurrentStepData = (step, formData) => {
7499
7508
  switch (step) {
7500
7509
  case 0:
7501
- return {};
7510
+ return getZeroStepData(formData);
7502
7511
  case 1:
7503
7512
  return getFirstStepData(formData);
7504
7513
  case 2:
@@ -7548,14 +7557,12 @@
7548
7557
  };
7549
7558
  const getValue = (formData) => (name) => formData[name];
7550
7559
 
7551
- const CreditFormStep = JSX(({ step, sections, onPrevStep, onNextStep, renderStep: renderStep$1 = renderStep, isFormFinished, finishForm, }) => {
7560
+ const CreditFormStep = JSX(({ step, sections, onPrevStep, onNextStep, isFormFinished, finishForm, programsSource }) => {
7552
7561
  const [localStorageData, saveStep] = useLocalStorage('leadForm');
7562
+ const [programId] = useLocalStorage('programId');
7563
+ const calcData = programsSource?.[programId ?? '']; // Need normalizator useForm, to be save defaultParams
7553
7564
  const initialState = getInitialFormState(step, localStorageData);
7554
- const customSubmit = useRef(undefined);
7555
7565
  const inputs = (sections?.flatMap((_) => _?.inputs) || []);
7556
- const registerSubmit = useCallback((submit) => {
7557
- customSubmit.current = submit;
7558
- }, []);
7559
7566
  const { handleSubmit } = useCreditFormAPI({
7560
7567
  step,
7561
7568
  inputs,
@@ -7564,18 +7571,24 @@
7564
7571
  finishForm,
7565
7572
  });
7566
7573
  const [, { field, onSubmit }] = useForm(initialState, {
7567
- onSubmit: (formData, ev) => {
7568
- handleSubmit({ ...formData, ...customSubmit.current?.(ev) });
7569
- },
7574
+ onSubmit: handleSubmit,
7570
7575
  });
7571
- return isFormFinished ? (jsx(CreditFormStatusTracker, {})) : (jsxs("form", { onSubmit: onSubmit, className: "space-y-m", children: [renderStep$1({ sections, field, step, registerSubmit }), jsx(StepsNavigationButtons, { step: step, onPrevStep: onPrevStep })] }));
7576
+ return isFormFinished ? (jsx(CreditFormStatusTracker, {})) : (jsxs("form", { onSubmit: onSubmit, className: "space-y-m", children: [renderStep({ sections, field, step, params: { calcData } }), jsx(StepsNavigationButtons, { step: step, onPrevStep: onPrevStep })] }));
7572
7577
  });
7573
7578
 
7574
7579
  /* eslint-disable max-lines */
7575
7580
  /* eslint-disable max-len */
7576
7581
  const stepsSectionsMap = [
7577
7582
  [
7578
- // zero step for calculator
7583
+ {
7584
+ columns: 1,
7585
+ inputs: [
7586
+ {
7587
+ fieldType: 'common',
7588
+ name: 'calculator',
7589
+ },
7590
+ ],
7591
+ },
7579
7592
  ],
7580
7593
  [
7581
7594
  {
@@ -7845,8 +7858,8 @@
7845
7858
  ],
7846
7859
  ];
7847
7860
 
7848
- const WIZARD_STEPS = 5;
7849
- const WIZARD_TITLES = [
7861
+ const STEPS = 5;
7862
+ const STEP_TITLES = [
7850
7863
  '',
7851
7864
  'Персональные данные',
7852
7865
  'Данные о трудоустройстве',
@@ -7854,13 +7867,13 @@
7854
7867
  'Дополнительные сведения',
7855
7868
  'Отделение Банка',
7856
7869
  ];
7857
- const CreditForm = JSX(({ className, ...rest }) => {
7870
+ const CreditForm = UniBlock(({ className, programsSource, ...rest }) => {
7858
7871
  const [step, setStep] = useState(0);
7859
7872
  const formContainerRef = useRef(null);
7860
7873
  const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
7861
7874
  useEffect(updateRefreshToken, []);
7862
7875
  const handleNextStep = useCallback(() => {
7863
- setStep((_) => Math.min(_ + 1, WIZARD_STEPS));
7876
+ setStep((_) => Math.min(_ + 1, STEPS));
7864
7877
  scrollToTop();
7865
7878
  }, []);
7866
7879
  const handlePrevStep = useCallback(() => {
@@ -7871,20 +7884,7 @@
7871
7884
  const sections = useMemo(() => stepsSectionsMap[step], [step]);
7872
7885
  const isStartStep = step === 0;
7873
7886
  const [isFormFinished, setIsFormFinished] = useState(false);
7874
- 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
7875
- ? ({ registerSubmit, field }) => (jsx(CalculatorCredit, { ...{
7876
- defaultParams: {
7877
- sum: field('moneyValue').value,
7878
- period: field('monthsValue').value,
7879
- isAnnuity: field('isAnnuity').value,
7880
- },
7881
- title: 'Калькулятор кредита',
7882
- footnote: 'Расчёт является предварительным. Точные условия будут предоставлены в отделении Банка.',
7883
- calcSource: {
7884
- $ref: '/wcms-resources/credit-calculator-data.json',
7885
- },
7886
- }, registerSubmit: registerSubmit }))
7887
- : undefined }, String(step)) })] }) }));
7887
+ 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)) })] }) }));
7888
7888
  });
7889
7889
 
7890
7890
  const isRateRow = (rateRow) => typeof rateRow?.minMonths === 'number' && typeof rateRow?.maxMonths === 'number';
@@ -8431,7 +8431,7 @@
8431
8431
  return (jsx(BlockWrapper, { className: style('w-full border-0 border-b border-solid border-main-divider last:border-b-0', className), defaultPadding: "p-0", tag: "div", version: "transparent", role: role, ...rest, children: jsx(Foldable, { isFoldButtonOnTop: isFoldButtonOnTop, unfoldedByDefault: isExpanded, renderFoldableSection: ({ isUnfolded }) => (jsx(FoldableSection, { className: style('gap-lg', getFoldableStyles(isMobile)), isUnfolded: isUnfolded, children: renderChildren({
8432
8432
  ...rest,
8433
8433
  extraProps: { className: 'w-full', padding: 'p-0' },
8434
- }) })), renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton({
8434
+ }) })), renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$1({
8435
8435
  foldButtonVersion,
8436
8436
  label,
8437
8437
  labelIcon,
@@ -8443,7 +8443,7 @@
8443
8443
  }, {
8444
8444
  childrenTypes: { exclude: ['RollupItem'] },
8445
8445
  });
8446
- const renderFoldButton = ({ foldButtonVersion, label: defaultLabel, labelIcon, labelIconBgVersion, isUnfolded, onToggle, isMobile = false, }) => {
8446
+ const renderFoldButton$1 = ({ foldButtonVersion, label: defaultLabel, labelIcon, labelIconBgVersion, isUnfolded, onToggle, isMobile = false, }) => {
8447
8447
  const label = defaultLabel || (isUnfolded ? 'Скрыть' : 'Развернуть');
8448
8448
  const icon = getIconName(isUnfolded, isMobile);
8449
8449
  return foldButtonVersion === 'accordion' ? (jsx(AccordionFoldButton, { label: label, labelIcon: labelIcon, labelIconBgVersion: labelIconBgVersion, icon: icon, onToggle: onToggle })) : (jsx(DefaultFoldButton, { label: label, icon: isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', onClick: onToggle }));
@@ -8676,6 +8676,8 @@
8676
8676
  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] })] }) }));
8677
8677
  });
8678
8678
 
8679
+ const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
8680
+
8679
8681
  const getBadgeCount = (blocks = [], filter = {}) => blocks.filter(({ content = {} }) => targetMatchPattern(filter, content)).length;
8680
8682
 
8681
8683
  const scalarCmp = (a, b) => a === b;
@@ -8821,6 +8823,63 @@
8821
8823
  childSchema: (content) => content?.filtrationSchema || {},
8822
8824
  });
8823
8825
 
8826
+ const renderButtonsGroup = (data, activeButton, onButtonClick) => {
8827
+ const allButtonVersion = getVersion(activeButton === 'all');
8828
+ const businessButtonVersion = getVersion(activeButton === 'business');
8829
+ const handleClick = (e, key, branches) => {
8830
+ const filteredBranches = e.currentTarget === e.target && key === 'business' ? filterBranches(branches) : branches;
8831
+ onButtonClick(key);
8832
+ return filteredBranches;
8833
+ };
8834
+ const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
8835
+ branch.workSchedule.businessScheduleVisibleTag &&
8836
+ !branch.workSchedule.businessScheduleDescription);
8837
+ 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" })] }));
8838
+ };
8839
+
8840
+ 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;
8841
+
8842
+ const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
8843
+ const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
8844
+ const visibleFiltersNum = onlyOffice ? 5 : 6;
8845
+ const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
8846
+ const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
8847
+ ? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
8848
+ : [filtersCheckbox, []];
8849
+ 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(reset, onlyOffice) }) })) : null }));
8850
+ };
8851
+ const renderFoldButton = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
8852
+ const labels = ['Больше фильтров', 'Меньше фильтров'];
8853
+ const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
8854
+ 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() })] }));
8855
+ };
8856
+ 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" })] }));
8857
+
8858
+ 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] }) }));
8859
+
8860
+ const defaultEmptyFunction = () => void 0;
8861
+ const filtersVisibleStyles = (activeButton) => activeButton === 'all' ? 'block' : 'hidden';
8862
+ const OfficesAtmsMapLayout = JSX(({ className, data = [], isLoad, remoteWorkplaces = [], renderCard = defaultEmptyFunction, renderRemoteWorkplaceCard = defaultEmptyFunction, getBalloon = defaultEmptyFunction, getBalloonRemoteWorkplaces = defaultEmptyFunction, descriptionData, title, }) => {
8863
+ const onlyOffice = title?.includes('Офис');
8864
+ const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE$1);
8865
+ const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
8866
+ data,
8867
+ remoteWorkplaces,
8868
+ filtrationState,
8869
+ getBalloon,
8870
+ getBalloonRemoteWorkplaces,
8871
+ });
8872
+ const [activeButton, setActiveButton] = useState('all');
8873
+ const filterOptions = {
8874
+ filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
8875
+ field: { field, reset },
8876
+ onlyOffice,
8877
+ labels: FILTRATION_LABELS,
8878
+ };
8879
+ 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)] })] }));
8880
+ });
8881
+ const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
8882
+
8824
8883
  const renderAtmCard = ({ location, address, billAcceptorType, terminalType, billAcceptorEnable, atmCode = '', atmAccess = '', workTime, }, i) => {
8825
8884
  const additionalInfo = [
8826
8885
  {
@@ -9953,7 +10012,7 @@
9953
10012
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
9954
10013
  });
9955
10014
 
9956
- const packageVersion = "0.14.682";
10015
+ const packageVersion = "0.14.684";
9957
10016
 
9958
10017
  exports.Blocks = Blocks;
9959
10018
  exports.ContentPage = ContentPage;