@redneckz/wildless-cms-uni-blocks 0.3.57 → 0.3.58

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 (446) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +341 -82
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/cosmos-static/icons/SafeIcon.svg +1 -1
  5. package/dist/components/Blocks.d.ts +1 -1
  6. package/dist/components/Blocks.js +2 -2
  7. package/dist/components/Blocks.js.map +1 -1
  8. package/dist/components/Calculator/BonusCalculatorForm.d.ts +5 -0
  9. package/dist/components/Calculator/BonusCalculatorForm.js +40 -0
  10. package/dist/components/Calculator/BonusCalculatorForm.js.map +1 -0
  11. package/dist/components/Calculator/Calculator.d.ts +5 -0
  12. package/dist/components/Calculator/Calculator.js +46 -0
  13. package/dist/components/Calculator/Calculator.js.map +1 -0
  14. package/dist/components/Calculator/CalculatorContent.d.ts +110 -0
  15. package/dist/components/{ProductGalleryGreen/ProductGalleryGreenContent.js → Calculator/CalculatorContent.js} +1 -1
  16. package/dist/components/Calculator/CalculatorContent.js.map +1 -0
  17. package/dist/components/Calculator/CalculatorValueBlock.d.ts +8 -0
  18. package/dist/components/Calculator/CalculatorValueBlock.js +9 -0
  19. package/dist/components/Calculator/CalculatorValueBlock.js.map +1 -0
  20. package/dist/components/Calculator/CreditCalculatorForm.d.ts +5 -0
  21. package/dist/components/Calculator/CreditCalculatorForm.js +51 -0
  22. package/dist/components/Calculator/CreditCalculatorForm.js.map +1 -0
  23. package/dist/components/Calculator/DepositCalculatorForm.d.ts +5 -0
  24. package/dist/components/Calculator/DepositCalculatorForm.js +41 -0
  25. package/dist/components/Calculator/DepositCalculatorForm.js.map +1 -0
  26. package/dist/components/Calculator/EmbeddableCalcBlocks.d.ts +11 -0
  27. package/dist/components/Calculator/EmbeddableCalcBlocks.js +13 -0
  28. package/dist/components/Calculator/EmbeddableCalcBlocks.js.map +1 -0
  29. package/dist/components/Calculator/MortgageCalculatorForm.d.ts +5 -0
  30. package/dist/components/Calculator/MortgageCalculatorForm.js +49 -0
  31. package/dist/components/Calculator/MortgageCalculatorForm.js.map +1 -0
  32. package/dist/components/Calculator/constants.d.ts +7 -0
  33. package/dist/components/Calculator/constants.js +10 -0
  34. package/dist/components/Calculator/constants.js.map +1 -0
  35. package/dist/components/Calculator/getCalculatorParams.d.ts +7 -0
  36. package/dist/components/Calculator/getCalculatorParams.js +11 -0
  37. package/dist/components/Calculator/getCalculatorParams.js.map +1 -0
  38. package/dist/components/Calculator/getCreditRate.d.ts +7 -0
  39. package/dist/components/Calculator/getCreditRate.js +13 -0
  40. package/dist/components/Calculator/getCreditRate.js.map +1 -0
  41. package/dist/components/Calculator/getDefaultMonths.d.ts +2 -0
  42. package/dist/components/Calculator/getDefaultMonths.js +8 -0
  43. package/dist/components/Calculator/getDefaultMonths.js.map +1 -0
  44. package/dist/components/Calculator/getDefaultSum.d.ts +2 -0
  45. package/dist/components/Calculator/getDefaultSum.js +8 -0
  46. package/dist/components/Calculator/getDefaultSum.js.map +1 -0
  47. package/dist/components/Calculator/getMonthlyPayment.d.ts +11 -0
  48. package/dist/components/Calculator/getMonthlyPayment.js +19 -0
  49. package/dist/components/Calculator/getMonthlyPayment.js.map +1 -0
  50. package/dist/components/Calculator/renderButtonSection.d.ts +1 -0
  51. package/dist/components/Calculator/renderButtonSection.js +9 -0
  52. package/dist/components/Calculator/renderButtonSection.js.map +1 -0
  53. package/dist/components/Calculator/renderCalculatorList.d.ts +10 -0
  54. package/dist/components/Calculator/renderCalculatorList.js +17 -0
  55. package/dist/components/Calculator/renderCalculatorList.js.map +1 -0
  56. package/dist/components/Calculator/renderInitialFeeInput.d.ts +10 -0
  57. package/dist/components/Calculator/renderInitialFeeInput.js +18 -0
  58. package/dist/components/Calculator/renderInitialFeeInput.js.map +1 -0
  59. package/dist/components/Calculator/renderMonthsInput.d.ts +11 -0
  60. package/dist/components/Calculator/renderMonthsInput.js +15 -0
  61. package/dist/components/Calculator/renderMonthsInput.js.map +1 -0
  62. package/dist/components/Calculator/renderProposal.d.ts +1 -0
  63. package/dist/components/Calculator/renderProposal.js +10 -0
  64. package/dist/components/Calculator/renderProposal.js.map +1 -0
  65. package/dist/components/Calculator/renderProposalMortgage.d.ts +7 -0
  66. package/dist/components/Calculator/renderProposalMortgage.js +9 -0
  67. package/dist/components/Calculator/renderProposalMortgage.js.map +1 -0
  68. package/dist/components/Calculator/renderRate.d.ts +8 -0
  69. package/dist/components/Calculator/renderRate.js +9 -0
  70. package/dist/components/Calculator/renderRate.js.map +1 -0
  71. package/dist/components/Calculator/renderRealEstateValue.d.ts +10 -0
  72. package/dist/components/Calculator/renderRealEstateValue.js +15 -0
  73. package/dist/components/Calculator/renderRealEstateValue.js.map +1 -0
  74. package/dist/components/Calculator/renderWantedSumInput.d.ts +13 -0
  75. package/dist/components/Calculator/renderWantedSumInput.js +19 -0
  76. package/dist/components/Calculator/renderWantedSumInput.js.map +1 -0
  77. package/dist/components/ContentPage/ContentPage.d.ts +1 -1
  78. package/dist/components/ProductGallery/ProductGallery.js +37 -8
  79. package/dist/components/ProductGallery/ProductGallery.js.map +1 -1
  80. package/dist/components/ProductGallery/ProductGalleryContent.d.ts +3 -6
  81. package/dist/types.d.ts +1 -0
  82. package/dist/ui-kit/BlocksList/renderBlocksList.d.ts +0 -1
  83. package/dist/ui-kit/BlocksList/renderBlocksList.js +2 -3
  84. package/dist/ui-kit/BlocksList/renderBlocksList.js.map +1 -1
  85. package/dist/ui-kit/Checkbox/Checkbox.js +1 -1
  86. package/dist/ui-kit/Checkbox/Checkbox.js.map +1 -1
  87. package/dist/ui-kit/InputRange/InputRange.js +2 -2
  88. package/dist/ui-kit/InputRange/InputRange.js.map +1 -1
  89. package/dist/ui-kit/InputRange/InputRangeProps.d.ts +2 -1
  90. package/dist/ui-kit/Tabs/TabsProps.d.ts +2 -1
  91. package/lib/common.css +1 -1
  92. package/lib/components/Blocks.d.ts +1 -1
  93. package/lib/components/Blocks.js +2 -2
  94. package/lib/components/Blocks.js.map +1 -1
  95. package/lib/components/Calculator/BonusCalculatorForm.d.ts +5 -0
  96. package/lib/components/Calculator/BonusCalculatorForm.js +38 -0
  97. package/lib/components/Calculator/BonusCalculatorForm.js.map +1 -0
  98. package/lib/components/Calculator/Calculator.d.ts +5 -0
  99. package/lib/components/{ProductGalleryGreen/ProductGalleryGreen.fixture.d.ts → Calculator/Calculator.fixture.d.ts} +1 -1
  100. package/lib/components/Calculator/Calculator.js +44 -0
  101. package/lib/components/Calculator/Calculator.js.map +1 -0
  102. package/lib/components/Calculator/CalculatorContent.d.ts +110 -0
  103. package/lib/components/Calculator/CalculatorContent.js +2 -0
  104. package/lib/components/Calculator/CalculatorContent.js.map +1 -0
  105. package/lib/components/Calculator/CalculatorValueBlock.d.ts +8 -0
  106. package/lib/components/Calculator/CalculatorValueBlock.js +7 -0
  107. package/lib/components/Calculator/CalculatorValueBlock.js.map +1 -0
  108. package/lib/components/Calculator/CreditCalculatorForm.d.ts +5 -0
  109. package/lib/components/Calculator/CreditCalculatorForm.js +49 -0
  110. package/lib/components/Calculator/CreditCalculatorForm.js.map +1 -0
  111. package/lib/components/Calculator/DepositCalculatorForm.d.ts +5 -0
  112. package/lib/components/Calculator/DepositCalculatorForm.js +39 -0
  113. package/lib/components/Calculator/DepositCalculatorForm.js.map +1 -0
  114. package/lib/components/Calculator/EmbeddableCalcBlocks.d.ts +11 -0
  115. package/lib/components/Calculator/EmbeddableCalcBlocks.js +11 -0
  116. package/lib/components/Calculator/EmbeddableCalcBlocks.js.map +1 -0
  117. package/lib/components/Calculator/MortgageCalculatorForm.d.ts +5 -0
  118. package/lib/components/Calculator/MortgageCalculatorForm.js +47 -0
  119. package/lib/components/Calculator/MortgageCalculatorForm.js.map +1 -0
  120. package/lib/components/Calculator/constants.d.ts +7 -0
  121. package/lib/components/Calculator/constants.js +8 -0
  122. package/lib/components/Calculator/constants.js.map +1 -0
  123. package/lib/components/Calculator/getCalculatorParams.d.ts +7 -0
  124. package/lib/components/Calculator/getCalculatorParams.js +8 -0
  125. package/lib/components/Calculator/getCalculatorParams.js.map +1 -0
  126. package/lib/components/Calculator/getCreditRate.d.ts +7 -0
  127. package/lib/components/Calculator/getCreditRate.js +10 -0
  128. package/lib/components/Calculator/getCreditRate.js.map +1 -0
  129. package/lib/components/Calculator/getDefaultMonths.d.ts +2 -0
  130. package/lib/components/Calculator/getDefaultMonths.js +5 -0
  131. package/lib/components/Calculator/getDefaultMonths.js.map +1 -0
  132. package/lib/components/Calculator/getDefaultSum.d.ts +2 -0
  133. package/lib/components/Calculator/getDefaultSum.js +5 -0
  134. package/lib/components/Calculator/getDefaultSum.js.map +1 -0
  135. package/lib/components/Calculator/getMonthlyPayment.d.ts +11 -0
  136. package/lib/components/Calculator/getMonthlyPayment.js +16 -0
  137. package/lib/components/Calculator/getMonthlyPayment.js.map +1 -0
  138. package/lib/components/Calculator/renderButtonSection.d.ts +1 -0
  139. package/lib/components/Calculator/renderButtonSection.js +6 -0
  140. package/lib/components/Calculator/renderButtonSection.js.map +1 -0
  141. package/lib/components/Calculator/renderCalculatorList.d.ts +10 -0
  142. package/lib/components/Calculator/renderCalculatorList.js +14 -0
  143. package/lib/components/Calculator/renderCalculatorList.js.map +1 -0
  144. package/lib/components/Calculator/renderInitialFeeInput.d.ts +10 -0
  145. package/lib/components/Calculator/renderInitialFeeInput.js +15 -0
  146. package/lib/components/Calculator/renderInitialFeeInput.js.map +1 -0
  147. package/lib/components/Calculator/renderMonthsInput.d.ts +11 -0
  148. package/lib/components/Calculator/renderMonthsInput.js +12 -0
  149. package/lib/components/Calculator/renderMonthsInput.js.map +1 -0
  150. package/lib/components/Calculator/renderProposal.d.ts +1 -0
  151. package/lib/components/Calculator/renderProposal.js +7 -0
  152. package/lib/components/Calculator/renderProposal.js.map +1 -0
  153. package/lib/components/Calculator/renderProposalMortgage.d.ts +7 -0
  154. package/lib/components/Calculator/renderProposalMortgage.js +6 -0
  155. package/lib/components/Calculator/renderProposalMortgage.js.map +1 -0
  156. package/lib/components/Calculator/renderRate.d.ts +8 -0
  157. package/lib/components/Calculator/renderRate.js +6 -0
  158. package/lib/components/Calculator/renderRate.js.map +1 -0
  159. package/lib/components/Calculator/renderRealEstateValue.d.ts +10 -0
  160. package/lib/components/Calculator/renderRealEstateValue.js +12 -0
  161. package/lib/components/Calculator/renderRealEstateValue.js.map +1 -0
  162. package/lib/components/Calculator/renderWantedSumInput.d.ts +13 -0
  163. package/lib/components/Calculator/renderWantedSumInput.js +16 -0
  164. package/lib/components/Calculator/renderWantedSumInput.js.map +1 -0
  165. package/lib/components/ContentPage/ContentPage.d.ts +1 -1
  166. package/lib/components/ProductGallery/ProductGallery.fixture.d.ts +1 -0
  167. package/lib/components/ProductGallery/ProductGallery.js +37 -8
  168. package/lib/components/ProductGallery/ProductGallery.js.map +1 -1
  169. package/lib/components/ProductGallery/ProductGalleryContent.d.ts +3 -6
  170. package/lib/types.d.ts +1 -0
  171. package/lib/ui-kit/BlocksList/renderBlocksList.d.ts +0 -1
  172. package/lib/ui-kit/BlocksList/renderBlocksList.js +1 -1
  173. package/lib/ui-kit/BlocksList/renderBlocksList.js.map +1 -1
  174. package/lib/ui-kit/Checkbox/Checkbox.js +1 -1
  175. package/lib/ui-kit/Checkbox/Checkbox.js.map +1 -1
  176. package/lib/ui-kit/InputRange/InputRange.js +2 -2
  177. package/lib/ui-kit/InputRange/InputRange.js.map +1 -1
  178. package/lib/ui-kit/InputRange/InputRangeProps.d.ts +2 -1
  179. package/lib/ui-kit/Tabs/TabsProps.d.ts +2 -1
  180. package/mobile/dist/components/Calculator/BonusCalculatorForm.d.ts +5 -0
  181. package/mobile/dist/components/Calculator/BonusCalculatorForm.js +40 -0
  182. package/mobile/dist/components/Calculator/BonusCalculatorForm.js.map +1 -0
  183. package/mobile/dist/components/Calculator/Calculator.d.ts +5 -0
  184. package/mobile/dist/components/Calculator/Calculator.js +46 -0
  185. package/mobile/dist/components/Calculator/Calculator.js.map +1 -0
  186. package/mobile/dist/components/Calculator/CalculatorContent.d.ts +110 -0
  187. package/mobile/dist/components/{ProductGalleryGreen/ProductGalleryGreenContent.js → Calculator/CalculatorContent.js} +1 -1
  188. package/mobile/dist/components/Calculator/CalculatorContent.js.map +1 -0
  189. package/mobile/dist/components/Calculator/CalculatorValueBlock.d.ts +8 -0
  190. package/mobile/dist/components/Calculator/CalculatorValueBlock.js +9 -0
  191. package/mobile/dist/components/Calculator/CalculatorValueBlock.js.map +1 -0
  192. package/mobile/dist/components/Calculator/CreditCalculatorForm.d.ts +5 -0
  193. package/mobile/dist/components/Calculator/CreditCalculatorForm.js +51 -0
  194. package/mobile/dist/components/Calculator/CreditCalculatorForm.js.map +1 -0
  195. package/mobile/dist/components/Calculator/DepositCalculatorForm.d.ts +5 -0
  196. package/mobile/dist/components/Calculator/DepositCalculatorForm.js +41 -0
  197. package/mobile/dist/components/Calculator/DepositCalculatorForm.js.map +1 -0
  198. package/mobile/dist/components/Calculator/EmbeddableCalcBlocks.d.ts +11 -0
  199. package/mobile/dist/components/Calculator/EmbeddableCalcBlocks.js +13 -0
  200. package/mobile/dist/components/Calculator/EmbeddableCalcBlocks.js.map +1 -0
  201. package/mobile/dist/components/Calculator/MortgageCalculatorForm.d.ts +5 -0
  202. package/mobile/dist/components/Calculator/MortgageCalculatorForm.js +49 -0
  203. package/mobile/dist/components/Calculator/MortgageCalculatorForm.js.map +1 -0
  204. package/mobile/dist/components/Calculator/constants.d.ts +7 -0
  205. package/mobile/dist/components/Calculator/constants.js +10 -0
  206. package/mobile/dist/components/Calculator/constants.js.map +1 -0
  207. package/mobile/dist/components/Calculator/getCalculatorParams.d.ts +7 -0
  208. package/mobile/dist/components/Calculator/getCalculatorParams.js +11 -0
  209. package/mobile/dist/components/Calculator/getCalculatorParams.js.map +1 -0
  210. package/mobile/dist/components/Calculator/getCreditRate.d.ts +7 -0
  211. package/mobile/dist/components/Calculator/getCreditRate.js +13 -0
  212. package/mobile/dist/components/Calculator/getCreditRate.js.map +1 -0
  213. package/mobile/dist/components/Calculator/getDefaultMonths.d.ts +2 -0
  214. package/mobile/dist/components/Calculator/getDefaultMonths.js +8 -0
  215. package/mobile/dist/components/Calculator/getDefaultMonths.js.map +1 -0
  216. package/mobile/dist/components/Calculator/getDefaultSum.d.ts +2 -0
  217. package/mobile/dist/components/Calculator/getDefaultSum.js +8 -0
  218. package/mobile/dist/components/Calculator/getDefaultSum.js.map +1 -0
  219. package/mobile/dist/components/Calculator/getMonthlyPayment.d.ts +11 -0
  220. package/mobile/dist/components/Calculator/getMonthlyPayment.js +19 -0
  221. package/mobile/dist/components/Calculator/getMonthlyPayment.js.map +1 -0
  222. package/mobile/dist/components/Calculator/renderButtonSection.d.ts +1 -0
  223. package/mobile/dist/components/Calculator/renderButtonSection.js +9 -0
  224. package/mobile/dist/components/Calculator/renderButtonSection.js.map +1 -0
  225. package/mobile/dist/components/Calculator/renderCalculatorList.d.ts +10 -0
  226. package/mobile/dist/components/Calculator/renderCalculatorList.js +17 -0
  227. package/mobile/dist/components/Calculator/renderCalculatorList.js.map +1 -0
  228. package/mobile/dist/components/Calculator/renderInitialFeeInput.d.ts +10 -0
  229. package/mobile/dist/components/Calculator/renderInitialFeeInput.js +18 -0
  230. package/mobile/dist/components/Calculator/renderInitialFeeInput.js.map +1 -0
  231. package/mobile/dist/components/Calculator/renderMonthsInput.d.ts +11 -0
  232. package/mobile/dist/components/Calculator/renderMonthsInput.js +15 -0
  233. package/mobile/dist/components/Calculator/renderMonthsInput.js.map +1 -0
  234. package/mobile/dist/components/Calculator/renderProposal.d.ts +1 -0
  235. package/mobile/dist/components/Calculator/renderProposal.js +10 -0
  236. package/mobile/dist/components/Calculator/renderProposal.js.map +1 -0
  237. package/mobile/dist/components/Calculator/renderProposalMortgage.d.ts +7 -0
  238. package/mobile/dist/components/Calculator/renderProposalMortgage.js +9 -0
  239. package/mobile/dist/components/Calculator/renderProposalMortgage.js.map +1 -0
  240. package/mobile/dist/components/Calculator/renderRate.d.ts +8 -0
  241. package/mobile/dist/components/Calculator/renderRate.js +9 -0
  242. package/mobile/dist/components/Calculator/renderRate.js.map +1 -0
  243. package/mobile/dist/components/Calculator/renderRealEstateValue.d.ts +10 -0
  244. package/mobile/dist/components/Calculator/renderRealEstateValue.js +15 -0
  245. package/mobile/dist/components/Calculator/renderRealEstateValue.js.map +1 -0
  246. package/mobile/dist/components/Calculator/renderWantedSumInput.d.ts +13 -0
  247. package/mobile/dist/components/Calculator/renderWantedSumInput.js +19 -0
  248. package/mobile/dist/components/Calculator/renderWantedSumInput.js.map +1 -0
  249. package/mobile/dist/components/ContentPage/ContentPage.d.ts +1 -1
  250. package/mobile/dist/components/ProductGallery/ProductGalleryContent.d.ts +3 -6
  251. package/mobile/dist/types.d.ts +1 -0
  252. package/mobile/dist/ui-kit/BlocksList/renderBlocksList.d.ts +0 -1
  253. package/mobile/dist/ui-kit/BlocksList/renderBlocksList.js +2 -3
  254. package/mobile/dist/ui-kit/BlocksList/renderBlocksList.js.map +1 -1
  255. package/mobile/dist/ui-kit/Checkbox/Checkbox.js +1 -1
  256. package/mobile/dist/ui-kit/Checkbox/Checkbox.js.map +1 -1
  257. package/mobile/dist/ui-kit/InputRange/InputRange.js +2 -2
  258. package/mobile/dist/ui-kit/InputRange/InputRange.js.map +1 -1
  259. package/mobile/dist/ui-kit/InputRange/InputRangeProps.d.ts +2 -1
  260. package/mobile/dist/ui-kit/Tabs/TabsProps.d.ts +2 -1
  261. package/mobile/lib/components/Calculator/BonusCalculatorForm.d.ts +5 -0
  262. package/mobile/lib/components/Calculator/BonusCalculatorForm.js +38 -0
  263. package/mobile/lib/components/Calculator/BonusCalculatorForm.js.map +1 -0
  264. package/mobile/lib/components/Calculator/Calculator.d.ts +5 -0
  265. package/mobile/lib/components/Calculator/Calculator.js +44 -0
  266. package/mobile/lib/components/Calculator/Calculator.js.map +1 -0
  267. package/mobile/lib/components/Calculator/CalculatorContent.d.ts +110 -0
  268. package/mobile/lib/components/Calculator/CalculatorContent.js +2 -0
  269. package/mobile/lib/components/Calculator/CalculatorContent.js.map +1 -0
  270. package/mobile/lib/components/Calculator/CalculatorValueBlock.d.ts +8 -0
  271. package/mobile/lib/components/Calculator/CalculatorValueBlock.js +7 -0
  272. package/mobile/lib/components/Calculator/CalculatorValueBlock.js.map +1 -0
  273. package/mobile/lib/components/Calculator/CreditCalculatorForm.d.ts +5 -0
  274. package/mobile/lib/components/Calculator/CreditCalculatorForm.js +49 -0
  275. package/mobile/lib/components/Calculator/CreditCalculatorForm.js.map +1 -0
  276. package/mobile/lib/components/Calculator/DepositCalculatorForm.d.ts +5 -0
  277. package/mobile/lib/components/Calculator/DepositCalculatorForm.js +39 -0
  278. package/mobile/lib/components/Calculator/DepositCalculatorForm.js.map +1 -0
  279. package/mobile/lib/components/Calculator/EmbeddableCalcBlocks.d.ts +11 -0
  280. package/mobile/lib/components/Calculator/EmbeddableCalcBlocks.js +11 -0
  281. package/mobile/lib/components/Calculator/EmbeddableCalcBlocks.js.map +1 -0
  282. package/mobile/lib/components/Calculator/MortgageCalculatorForm.d.ts +5 -0
  283. package/mobile/lib/components/Calculator/MortgageCalculatorForm.js +47 -0
  284. package/mobile/lib/components/Calculator/MortgageCalculatorForm.js.map +1 -0
  285. package/mobile/lib/components/Calculator/constants.d.ts +7 -0
  286. package/mobile/lib/components/Calculator/constants.js +8 -0
  287. package/mobile/lib/components/Calculator/constants.js.map +1 -0
  288. package/mobile/lib/components/Calculator/getCalculatorParams.d.ts +7 -0
  289. package/mobile/lib/components/Calculator/getCalculatorParams.js +8 -0
  290. package/mobile/lib/components/Calculator/getCalculatorParams.js.map +1 -0
  291. package/mobile/lib/components/Calculator/getCreditRate.d.ts +7 -0
  292. package/mobile/lib/components/Calculator/getCreditRate.js +10 -0
  293. package/mobile/lib/components/Calculator/getCreditRate.js.map +1 -0
  294. package/mobile/lib/components/Calculator/getDefaultMonths.d.ts +2 -0
  295. package/mobile/lib/components/Calculator/getDefaultMonths.js +5 -0
  296. package/mobile/lib/components/Calculator/getDefaultMonths.js.map +1 -0
  297. package/mobile/lib/components/Calculator/getDefaultSum.d.ts +2 -0
  298. package/mobile/lib/components/Calculator/getDefaultSum.js +5 -0
  299. package/mobile/lib/components/Calculator/getDefaultSum.js.map +1 -0
  300. package/mobile/lib/components/Calculator/getMonthlyPayment.d.ts +11 -0
  301. package/mobile/lib/components/Calculator/getMonthlyPayment.js +16 -0
  302. package/mobile/lib/components/Calculator/getMonthlyPayment.js.map +1 -0
  303. package/mobile/lib/components/Calculator/renderButtonSection.d.ts +1 -0
  304. package/mobile/lib/components/Calculator/renderButtonSection.js +6 -0
  305. package/mobile/lib/components/Calculator/renderButtonSection.js.map +1 -0
  306. package/mobile/lib/components/Calculator/renderCalculatorList.d.ts +10 -0
  307. package/mobile/lib/components/Calculator/renderCalculatorList.js +14 -0
  308. package/mobile/lib/components/Calculator/renderCalculatorList.js.map +1 -0
  309. package/mobile/lib/components/Calculator/renderInitialFeeInput.d.ts +10 -0
  310. package/mobile/lib/components/Calculator/renderInitialFeeInput.js +15 -0
  311. package/mobile/lib/components/Calculator/renderInitialFeeInput.js.map +1 -0
  312. package/mobile/lib/components/Calculator/renderMonthsInput.d.ts +11 -0
  313. package/mobile/lib/components/Calculator/renderMonthsInput.js +12 -0
  314. package/mobile/lib/components/Calculator/renderMonthsInput.js.map +1 -0
  315. package/mobile/lib/components/Calculator/renderProposal.d.ts +1 -0
  316. package/mobile/lib/components/Calculator/renderProposal.js +7 -0
  317. package/mobile/lib/components/Calculator/renderProposal.js.map +1 -0
  318. package/mobile/lib/components/Calculator/renderProposalMortgage.d.ts +7 -0
  319. package/mobile/lib/components/Calculator/renderProposalMortgage.js +6 -0
  320. package/mobile/lib/components/Calculator/renderProposalMortgage.js.map +1 -0
  321. package/mobile/lib/components/Calculator/renderRate.d.ts +8 -0
  322. package/mobile/lib/components/Calculator/renderRate.js +6 -0
  323. package/mobile/lib/components/Calculator/renderRate.js.map +1 -0
  324. package/mobile/lib/components/Calculator/renderRealEstateValue.d.ts +10 -0
  325. package/mobile/lib/components/Calculator/renderRealEstateValue.js +12 -0
  326. package/mobile/lib/components/Calculator/renderRealEstateValue.js.map +1 -0
  327. package/mobile/lib/components/Calculator/renderWantedSumInput.d.ts +13 -0
  328. package/mobile/lib/components/Calculator/renderWantedSumInput.js +16 -0
  329. package/mobile/lib/components/Calculator/renderWantedSumInput.js.map +1 -0
  330. package/mobile/lib/components/ContentPage/ContentPage.d.ts +1 -1
  331. package/mobile/lib/components/ProductGallery/ProductGalleryContent.d.ts +3 -6
  332. package/mobile/lib/types.d.ts +1 -0
  333. package/mobile/lib/ui-kit/BlocksList/renderBlocksList.d.ts +0 -1
  334. package/mobile/lib/ui-kit/BlocksList/renderBlocksList.js +1 -1
  335. package/mobile/lib/ui-kit/BlocksList/renderBlocksList.js.map +1 -1
  336. package/mobile/lib/ui-kit/Checkbox/Checkbox.js +1 -1
  337. package/mobile/lib/ui-kit/Checkbox/Checkbox.js.map +1 -1
  338. package/mobile/lib/ui-kit/InputRange/InputRange.js +2 -2
  339. package/mobile/lib/ui-kit/InputRange/InputRange.js.map +1 -1
  340. package/mobile/lib/ui-kit/InputRange/InputRangeProps.d.ts +2 -1
  341. package/mobile/lib/ui-kit/Tabs/TabsProps.d.ts +2 -1
  342. package/mobile/src/common.css +7 -0
  343. package/mobile/src/components/Calculator/BonusCalculatorForm.tsx +71 -0
  344. package/mobile/src/components/Calculator/Calculator.tsx +141 -0
  345. package/mobile/src/components/Calculator/CalculatorContent.ts +134 -0
  346. package/mobile/src/components/Calculator/CalculatorValueBlock.tsx +25 -0
  347. package/mobile/src/components/Calculator/CreditCalculatorForm.tsx +99 -0
  348. package/mobile/src/components/Calculator/DepositCalculatorForm.tsx +69 -0
  349. package/mobile/src/components/Calculator/EmbeddableCalcBlocks.tsx +17 -0
  350. package/mobile/src/components/Calculator/MortgageCalculatorForm.tsx +88 -0
  351. package/mobile/src/components/Calculator/constants.ts +8 -0
  352. package/mobile/src/components/Calculator/getCalculatorParams.ts +16 -0
  353. package/mobile/src/components/Calculator/getCreditRate.ts +18 -0
  354. package/mobile/src/components/Calculator/getDefaultMonths.ts +7 -0
  355. package/mobile/src/components/Calculator/getDefaultSum.ts +7 -0
  356. package/mobile/src/components/Calculator/getMonthlyPayment.ts +32 -0
  357. package/mobile/src/components/Calculator/renderButtonSection.tsx +7 -0
  358. package/mobile/src/components/Calculator/renderCalculatorList.tsx +43 -0
  359. package/mobile/src/components/Calculator/renderInitialFeeInput.tsx +37 -0
  360. package/mobile/src/components/Calculator/renderMonthsInput.tsx +34 -0
  361. package/mobile/src/components/Calculator/renderProposal.tsx +14 -0
  362. package/mobile/src/components/Calculator/renderProposalMortgage.tsx +17 -0
  363. package/mobile/src/components/Calculator/renderRate.tsx +23 -0
  364. package/mobile/src/components/Calculator/renderRealEstateValue.tsx +33 -0
  365. package/mobile/src/components/Calculator/renderWantedSumInput.tsx +49 -0
  366. package/mobile/src/components/ContentPage/ContentPage.page.json +9 -8
  367. package/mobile/src/components/ContentPage/ContentPage.tsx +2 -2
  368. package/mobile/src/components/ProductGallery/ProductGallery.example.json +8 -10
  369. package/mobile/src/components/ProductGallery/ProductGalleryContent.ts +3 -6
  370. package/mobile/src/icons/SafeIcon.svg +7 -1
  371. package/mobile/src/types.ts +2 -0
  372. package/mobile/src/ui-kit/BlocksList/renderBlocksList.tsx +1 -1
  373. package/mobile/src/ui-kit/Checkbox/Checkbox.tsx +1 -3
  374. package/mobile/src/ui-kit/InputRange/InputRange.tsx +7 -9
  375. package/mobile/src/ui-kit/InputRange/InputRangeProps.ts +3 -1
  376. package/mobile/src/ui-kit/Tabs/TabsProps.ts +2 -1
  377. package/package.json +1 -1
  378. package/src/common.css +7 -0
  379. package/src/components/Blocks.ts +2 -2
  380. package/src/components/Calculator/BonusCalculatorForm.tsx +71 -0
  381. package/src/components/Calculator/Calculator.fixture.tsx +131 -0
  382. package/src/components/Calculator/Calculator.tsx +141 -0
  383. package/src/components/Calculator/CalculatorContent.ts +134 -0
  384. package/src/components/Calculator/CalculatorValueBlock.tsx +25 -0
  385. package/src/components/Calculator/CreditCalculatorForm.tsx +99 -0
  386. package/src/components/Calculator/DepositCalculatorForm.tsx +69 -0
  387. package/src/components/Calculator/EmbeddableCalcBlocks.tsx +17 -0
  388. package/src/components/Calculator/MortgageCalculatorForm.tsx +88 -0
  389. package/src/components/Calculator/constants.ts +8 -0
  390. package/src/components/Calculator/getCalculatorParams.ts +16 -0
  391. package/src/components/Calculator/getCreditRate.ts +18 -0
  392. package/src/components/Calculator/getDefaultMonths.ts +7 -0
  393. package/src/components/Calculator/getDefaultSum.ts +7 -0
  394. package/src/components/Calculator/getMonthlyPayment.ts +32 -0
  395. package/src/components/Calculator/renderButtonSection.tsx +7 -0
  396. package/src/components/Calculator/renderCalculatorList.tsx +43 -0
  397. package/src/components/Calculator/renderInitialFeeInput.tsx +37 -0
  398. package/src/components/Calculator/renderMonthsInput.tsx +34 -0
  399. package/src/components/Calculator/renderProposal.tsx +14 -0
  400. package/src/components/Calculator/renderProposalMortgage.tsx +17 -0
  401. package/src/components/Calculator/renderRate.tsx +23 -0
  402. package/src/components/Calculator/renderRealEstateValue.tsx +33 -0
  403. package/src/components/Calculator/renderWantedSumInput.tsx +49 -0
  404. package/src/components/ContentPage/ContentPage.page.json +9 -8
  405. package/src/components/ContentPage/ContentPage.tsx +2 -2
  406. package/src/components/ProductBlock/ProductBlock.fixture.mobile.tsx +1 -1
  407. package/src/components/ProductGallery/ProductGallery.example.json +8 -10
  408. package/src/components/ProductGallery/ProductGallery.fixture.tsx +146 -104
  409. package/src/components/ProductGallery/ProductGallery.tsx +73 -24
  410. package/src/components/ProductGallery/ProductGalleryContent.ts +3 -6
  411. package/src/icons/SafeIcon.svg +7 -1
  412. package/src/types.ts +2 -0
  413. package/src/ui-kit/BlocksList/renderBlocksList.tsx +1 -1
  414. package/src/ui-kit/Checkbox/Checkbox.tsx +1 -3
  415. package/src/ui-kit/InputRange/InputRange.tsx +7 -9
  416. package/src/ui-kit/InputRange/InputRangeProps.ts +3 -1
  417. package/src/ui-kit/Tabs/TabsProps.ts +2 -1
  418. package/dist/components/ProductGalleryGreen/ProductGalleryGreen.d.ts +0 -5
  419. package/dist/components/ProductGalleryGreen/ProductGalleryGreen.js +0 -53
  420. package/dist/components/ProductGalleryGreen/ProductGalleryGreen.js.map +0 -1
  421. package/dist/components/ProductGalleryGreen/ProductGalleryGreenContent.d.ts +0 -32
  422. package/dist/components/ProductGalleryGreen/ProductGalleryGreenContent.js.map +0 -1
  423. package/lib/components/ProductGalleryGreen/ProductGalleryGreen.d.ts +0 -5
  424. package/lib/components/ProductGalleryGreen/ProductGalleryGreen.js +0 -51
  425. package/lib/components/ProductGalleryGreen/ProductGalleryGreen.js.map +0 -1
  426. package/lib/components/ProductGalleryGreen/ProductGalleryGreenContent.d.ts +0 -32
  427. package/lib/components/ProductGalleryGreen/ProductGalleryGreenContent.js +0 -2
  428. package/lib/components/ProductGalleryGreen/ProductGalleryGreenContent.js.map +0 -1
  429. package/mobile/dist/components/ProductGalleryGreen/ProductGalleryGreen.d.ts +0 -5
  430. package/mobile/dist/components/ProductGalleryGreen/ProductGalleryGreen.js +0 -53
  431. package/mobile/dist/components/ProductGalleryGreen/ProductGalleryGreen.js.map +0 -1
  432. package/mobile/dist/components/ProductGalleryGreen/ProductGalleryGreenContent.d.ts +0 -32
  433. package/mobile/dist/components/ProductGalleryGreen/ProductGalleryGreenContent.js.map +0 -1
  434. package/mobile/lib/components/ProductGalleryGreen/ProductGalleryGreen.d.ts +0 -5
  435. package/mobile/lib/components/ProductGalleryGreen/ProductGalleryGreen.js +0 -51
  436. package/mobile/lib/components/ProductGalleryGreen/ProductGalleryGreen.js.map +0 -1
  437. package/mobile/lib/components/ProductGalleryGreen/ProductGalleryGreenContent.d.ts +0 -32
  438. package/mobile/lib/components/ProductGalleryGreen/ProductGalleryGreenContent.js +0 -2
  439. package/mobile/lib/components/ProductGalleryGreen/ProductGalleryGreenContent.js.map +0 -1
  440. package/mobile/src/components/ProductGalleryGreen/ProductGalleryGreen.example.json +0 -23
  441. package/mobile/src/components/ProductGalleryGreen/ProductGalleryGreen.tsx +0 -120
  442. package/mobile/src/components/ProductGalleryGreen/ProductGalleryGreenContent.ts +0 -34
  443. package/src/components/ProductGalleryGreen/ProductGalleryGreen.example.json +0 -23
  444. package/src/components/ProductGalleryGreen/ProductGalleryGreen.fixture.tsx +0 -186
  445. package/src/components/ProductGalleryGreen/ProductGalleryGreen.tsx +0 -120
  446. package/src/components/ProductGalleryGreen/ProductGalleryGreenContent.ts +0 -34
@@ -0,0 +1,134 @@
1
+ import { Picture } from '../../model/Picture';
2
+ import type { ButtonWithIconProps } from '../../ui-kit/Button/ButtonProps';
3
+
4
+ export interface CommonCalculatorProps {
5
+ buttons?: ButtonWithIconProps[];
6
+ }
7
+
8
+ export interface CreditCalculatorParams {
9
+ isSalary?: boolean;
10
+ isInsurance?: boolean;
11
+ isAnnuity?: boolean;
12
+ minSum?: number;
13
+ maxSum?: number;
14
+ minMonths?: number;
15
+ maxMonths?: number;
16
+ rateWithInsurance?: number;
17
+ rateWithoutInsurance?: number;
18
+ }
19
+
20
+ export interface MortgageCalculatorParams {
21
+ isAnnuity?: boolean;
22
+ minInitialContribution?: number;
23
+ minSum?: number;
24
+ maxSum?: number;
25
+ minMonths?: number;
26
+ maxMonths?: number;
27
+ rateWithInsurance?: number;
28
+ rateWithoutInsurance?: number;
29
+ }
30
+
31
+ export interface DepositCalculatorParams {
32
+ minSum?: number;
33
+ maxSum?: number;
34
+ minMonths?: number;
35
+ maxMonths?: number;
36
+ rate?: number;
37
+ }
38
+
39
+ export interface BonusCalculatorParams {
40
+ bonus?: number;
41
+ minSumTrip?: number;
42
+ maxSumTrip?: number;
43
+ minSumOther?: number;
44
+ maxSumOther?: number;
45
+ }
46
+
47
+ export interface CalculatorParams {
48
+ isAnnuity?: boolean;
49
+ minSum?: number;
50
+ maxSum?: number;
51
+ minMonths?: number;
52
+ maxMonths?: number;
53
+ rateWithInsurance?: number;
54
+ rateWithoutInsurance?: number;
55
+ }
56
+
57
+ /**
58
+ * @title Заголовок
59
+ * @default {"calcType": "CreditCalculatorForm"}
60
+ */
61
+ export type CreditCalculatorParamsDef = CreditCalculatorParams &
62
+ CommonCalculatorProps & {
63
+ calcType: 'CreditCalculatorForm';
64
+ };
65
+
66
+ /**
67
+ * @title Заголовок
68
+ * @default {"calcType": "MortgageCalculatorForm"}
69
+ */
70
+ export type MortgageCalculatorParamsDef = MortgageCalculatorParams &
71
+ CommonCalculatorProps & {
72
+ calcType: 'MortgageCalculatorForm';
73
+ };
74
+
75
+ /**
76
+ * @title Заголовок
77
+ * @default {"calcType": "DepositCalculatorForm"}
78
+ */
79
+ export type DepositCalculatorParamsDef = DepositCalculatorParams &
80
+ CommonCalculatorProps & {
81
+ calcType: 'DepositCalculatorForm';
82
+ };
83
+
84
+ /**
85
+ * @title Заголовок
86
+ * @default {"calcType": "BonusCalculatorForm"}
87
+ */
88
+ export type BonusCalculatorParamsDef = BonusCalculatorParams &
89
+ CommonCalculatorProps & {
90
+ calcType: 'BonusCalculatorForm';
91
+ };
92
+
93
+ /**
94
+ * @title Выберите калькулятор
95
+ */
96
+ export type EmptyOption = null;
97
+
98
+ /**
99
+ * @title Калькулятор
100
+ */
101
+ export type CalculatorBlockDef =
102
+ | EmptyOption
103
+ | CreditCalculatorParamsDef
104
+ | MortgageCalculatorParamsDef
105
+ | DepositCalculatorParamsDef
106
+ | BonusCalculatorParamsDef;
107
+
108
+ /**
109
+ * @title Кнопка навигации
110
+ */
111
+ export interface CalculatorNav {
112
+ /** @title Заголовок */
113
+ title?: string;
114
+ /** @title Описание */
115
+ description?: string;
116
+ icon?: Picture;
117
+ }
118
+
119
+ /**
120
+ * @title Вкладка
121
+ */
122
+ export interface CalculatorTab {
123
+ nav?: CalculatorNav;
124
+ /** @title Настройки калькулятора */
125
+ calculatorBlock?: CalculatorBlockDef;
126
+ }
127
+
128
+ /**
129
+ * @title Калькулятор
130
+ */
131
+ export interface CalculatorContent {
132
+ /** @title Вкладки */
133
+ calcTabs?: CalculatorTab[];
134
+ }
@@ -0,0 +1,25 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { addSpacesBetweenNumbers } from '../../utils/addSpacesBetweenNumbers';
3
+
4
+ export interface CalculatorValueBlockProps {
5
+ title?: string;
6
+ value?: number;
7
+ postfix?: string;
8
+ prefix?: string;
9
+ className?: string;
10
+ }
11
+
12
+ export const CalculatorValueBlock = JSX<CalculatorValueBlockProps>(
13
+ ({ title, value, postfix = '', prefix, className = '' }) => {
14
+ return (
15
+ <div className={`mb-5 ${className}`}>
16
+ {title ? <div className="text-base font-light">{title}</div> : null}
17
+ {value ? (
18
+ <div className="text-title font-normal">
19
+ {prefix} {addSpacesBetweenNumbers(Math.round(value))} {postfix}
20
+ </div>
21
+ ) : null}
22
+ </div>
23
+ );
24
+ },
25
+ );
@@ -0,0 +1,99 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { useCreditCalculatorData } from '../../hooks/useCreditCalculatorData';
3
+ import type { UniBlockProps } from '../../types';
4
+ import { Checkbox } from '../../ui-kit/Checkbox/Checkbox';
5
+ import { CalculatorValueBlock } from './CalculatorValueBlock';
6
+ import { DEFAULT_MAX_MONTHS, DEFAULT_MIN_MONTHS } from './constants';
7
+ import { renderWantedSumInput } from './renderWantedSumInput';
8
+ import { getCreditRate } from './getCreditRate';
9
+ import { getCalculatorParams } from './getCalculatorParams';
10
+ import { getDefaultSum } from './getDefaultSum';
11
+ import { getDefaultMonths } from './getDefaultMonths';
12
+ import { getMonthlyPayment } from './getMonthlyPayment';
13
+ import { renderMonthsInput } from './renderMonthsInput';
14
+ import { renderButtonSection } from './renderButtonSection';
15
+ import { renderRate } from './renderRate';
16
+ import { CommonCalculatorProps, CreditCalculatorParams } from './CalculatorContent';
17
+
18
+ const DEFAULT_PAYMENT_TYPE = 'annuity';
19
+
20
+ export interface CreditCalculatorProp
21
+ extends CreditCalculatorParams,
22
+ CommonCalculatorProps,
23
+ UniBlockProps {}
24
+
25
+ export const CreditCalculatorForm = JSX<CreditCalculatorProp>(
26
+ ({ context, className = '', buttons }) => {
27
+ const [moneyValue, setMoneyValue] = context.useState<number | undefined>(undefined);
28
+ const [monthsValue, setMonthsValue] = context.useState<number | undefined>(undefined);
29
+ const [isAnnuity, toggleIsAnnuity] = context.useState(false);
30
+ const [isBudgetary, toggleIsBudgetary] = context.useState(false);
31
+ const [isInsurance, toggleIsInsurance] = context.useState(false);
32
+ const tableRows = useCreditCalculatorData(context.useAsyncData, 'directoryName').rows;
33
+ const calculatorParams = getCalculatorParams({ tableRows, isAnnuity: isAnnuity });
34
+
35
+ const defaultSum = getDefaultSum(calculatorParams);
36
+ const defaultMonths = getDefaultMonths(calculatorParams);
37
+
38
+ const minMonths = calculatorParams?.minMonths || DEFAULT_MIN_MONTHS;
39
+ const maxMonths = calculatorParams?.maxMonths || DEFAULT_MAX_MONTHS;
40
+
41
+ const rate = getCreditRate({ calculatorParams, isInsurance: isInsurance });
42
+
43
+ const monthlyPayment = getMonthlyPayment({
44
+ calculatorParams,
45
+ paymentType: DEFAULT_PAYMENT_TYPE,
46
+ rate,
47
+ sum: moneyValue || defaultSum,
48
+ months: monthsValue || defaultMonths,
49
+ });
50
+
51
+ const title = 'Сумма кредита, ₽';
52
+
53
+ return (
54
+ <section className={className}>
55
+ <div className="w-[468px]">
56
+ {renderWantedSumInput({ title, calculatorParams, moneyValue, defaultSum, setMoneyValue })}
57
+ {renderMonthsInput({
58
+ title: 'Сумма кредита, ₽',
59
+ minMonths,
60
+ maxMonths,
61
+ monthsValue,
62
+ defaultMonths,
63
+ setMonthsValue,
64
+ })}
65
+ <div className="pt-7">
66
+ <Checkbox
67
+ text="Получаю зарплату на счёт в Россельхозбанке"
68
+ checked={isAnnuity}
69
+ onChange={toggleIsAnnuity}
70
+ />
71
+ <Checkbox
72
+ className="mt-3"
73
+ text="Работаю в бюджетной организации"
74
+ checked={isBudgetary}
75
+ onChange={toggleIsBudgetary}
76
+ />
77
+ <Checkbox
78
+ className="mt-3"
79
+ text="Комплексная страховая защита"
80
+ checked={isInsurance}
81
+ onChange={toggleIsInsurance}
82
+ />
83
+ </div>
84
+ </div>
85
+ <div>
86
+ {rate
87
+ ? renderRate({ rate: rate, title: 'Ставка', sup: '%', className: 'tracking-[-25px]' })
88
+ : null}
89
+ </div>
90
+ <div className="w-[351px]">
91
+ {monthlyPayment ? (
92
+ <CalculatorValueBlock title="Ежемесячный платеж" value={monthlyPayment} postfix="₽" />
93
+ ) : null}
94
+ {renderButtonSection(context, buttons)}
95
+ </div>
96
+ </section>
97
+ );
98
+ },
99
+ );
@@ -0,0 +1,69 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { useCreditCalculatorData } from '../../hooks/useCreditCalculatorData';
3
+ import type { UniBlockProps } from '../../types';
4
+ import { CalculatorValueBlock } from './CalculatorValueBlock';
5
+ import { DEFAULT_MAX_MONTHS, DEFAULT_MIN_MONTHS } from './constants';
6
+ import { renderWantedSumInput } from './renderWantedSumInput';
7
+ import { getCalculatorParams } from './getCalculatorParams';
8
+ import { getDefaultSum } from './getDefaultSum';
9
+ import { getDefaultMonths } from './getDefaultMonths';
10
+ import { renderMonthsInput } from './renderMonthsInput';
11
+ import { renderButtonSection } from './renderButtonSection';
12
+ import { renderRate } from './renderRate';
13
+ import { CommonCalculatorProps, DepositCalculatorParams } from './CalculatorContent';
14
+
15
+ export interface DepositCalculatorProp
16
+ extends DepositCalculatorParams,
17
+ CommonCalculatorProps,
18
+ UniBlockProps {}
19
+
20
+ export const DepositCalculatorForm = JSX<DepositCalculatorProp>(
21
+ ({ context, className = '', buttons, rate, minSum, maxSum, minMonths, maxMonths }) => {
22
+ const [moneyValue, setMoneyValue] = context.useState<number | undefined>(undefined);
23
+ const [monthsValue, setMonthsValue] = context.useState<number | undefined>(undefined);
24
+ const tableRows = useCreditCalculatorData(context.useAsyncData, 'directoryName').rows;
25
+ const calculatorParams = getCalculatorParams({ tableRows, isAnnuity: false });
26
+
27
+ const defaultSum = getDefaultSum(calculatorParams);
28
+ const defaultMonths = getDefaultMonths(calculatorParams);
29
+
30
+ const income = 948841;
31
+ const finallySum = 1218841;
32
+
33
+ return (
34
+ <section className={className}>
35
+ <div className="w-[468px]">
36
+ {renderWantedSumInput({
37
+ title: 'Сумма вклада, ₽',
38
+ calculatorParams: { minSum, maxSum },
39
+ moneyValue,
40
+ defaultSum,
41
+ setMoneyValue,
42
+ })}
43
+ {renderMonthsInput({
44
+ title: 'Срок вклада, месяцев',
45
+ minMonths: minMonths || DEFAULT_MIN_MONTHS,
46
+ maxMonths: maxMonths || DEFAULT_MAX_MONTHS,
47
+ monthsValue,
48
+ defaultMonths,
49
+ setMonthsValue,
50
+ })}
51
+ </div>
52
+ <div>
53
+ {rate
54
+ ? renderRate({ rate: rate, title: 'Ставка', sup: '%', className: 'tracking-[-25px]' })
55
+ : null}
56
+ </div>
57
+ <div className="w-[351px]">
58
+ {income ? (
59
+ <CalculatorValueBlock title="Доход по вкладу" value={income} postfix="₽" prefix="+" />
60
+ ) : null}
61
+ {finallySum ? (
62
+ <CalculatorValueBlock title="Сумма в конце срока" value={finallySum} postfix="₽" />
63
+ ) : null}
64
+ {renderButtonSection(context, buttons)}
65
+ </div>
66
+ </section>
67
+ );
68
+ },
69
+ );
@@ -0,0 +1,17 @@
1
+ import { CreditCalculatorForm, CreditCalculatorProp } from './CreditCalculatorForm';
2
+ import { MortgageCalculatorForm, MortgageCalculatorProp } from './MortgageCalculatorForm';
3
+ import { DepositCalculatorForm, DepositCalculatorProp } from './DepositCalculatorForm';
4
+ import { BonusCalculatorForm, BonusCalculatorProp } from './BonusCalculatorForm';
5
+
6
+ export type EmbeddableCalcProps =
7
+ | CreditCalculatorProp
8
+ | MortgageCalculatorProp
9
+ | DepositCalculatorProp
10
+ | BonusCalculatorProp;
11
+
12
+ export const EmbeddableCalcBlocks = {
13
+ CreditCalculatorForm,
14
+ MortgageCalculatorForm,
15
+ DepositCalculatorForm,
16
+ BonusCalculatorForm,
17
+ };
@@ -0,0 +1,88 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { useCreditCalculatorData } from '../../hooks/useCreditCalculatorData';
3
+ import type { UniBlockProps } from '../../types';
4
+ import { Checkbox } from '../../ui-kit/Checkbox/Checkbox';
5
+ import { DEFAULT_MAX_MONTHS, DEFAULT_MIN_MONTHS } from './constants';
6
+ import { renderRealEstateValue } from './renderRealEstateValue';
7
+ import { renderInitialFeeInput } from './renderInitialFeeInput';
8
+ import { getCreditRate } from './getCreditRate';
9
+ import { getCalculatorParams } from './getCalculatorParams';
10
+ import { getDefaultSum } from './getDefaultSum';
11
+ import { getDefaultMonths } from './getDefaultMonths';
12
+ import { renderMonthsInput } from './renderMonthsInput';
13
+ import { renderButtonSection } from './renderButtonSection';
14
+ import { renderProposalMortgage } from './renderProposalMortgage';
15
+ import { renderRate } from './renderRate';
16
+ import { CommonCalculatorProps, MortgageCalculatorParams } from './CalculatorContent';
17
+ import { CalculatorValueBlock } from './CalculatorValueBlock';
18
+
19
+ export interface MortgageCalculatorProp
20
+ extends MortgageCalculatorParams,
21
+ CommonCalculatorProps,
22
+ UniBlockProps {}
23
+
24
+ export const MortgageCalculatorForm = JSX<MortgageCalculatorProp>(
25
+ ({ context, className = '', buttons }) => {
26
+ const [moneyValue, setMoneyValue] = context.useState<number | undefined>(undefined);
27
+ const [monthsValue, setMonthsValue] = context.useState<number | undefined>(undefined);
28
+ const [isInsurance, toggleIsInsurance] = context.useState(false);
29
+ const [isFullInsurance, toggleIsFullInsurance] = context.useState(false);
30
+
31
+ const tableRows = useCreditCalculatorData(context.useAsyncData, 'directoryName').rows;
32
+ const calculatorParams = getCalculatorParams({ tableRows, isAnnuity: isInsurance });
33
+
34
+ const defaultSum = getDefaultSum(calculatorParams);
35
+ const defaultMonths = getDefaultMonths(calculatorParams);
36
+
37
+ const minMonths = calculatorParams?.minMonths || DEFAULT_MIN_MONTHS;
38
+ const maxMonths = calculatorParams?.maxMonths || DEFAULT_MAX_MONTHS;
39
+
40
+ const rate = getCreditRate({ calculatorParams, isInsurance: isInsurance });
41
+
42
+ const monthlyPayment = 777777; // TODO: hardcode
43
+ const proposalMortgageValue = { credit: 3892000, period: 15, taxRefund: 650000 }; // TODO: hardcode
44
+
45
+ return (
46
+ <section className={className}>
47
+ <div className="w-[468px]">
48
+ {renderRealEstateValue({ calculatorParams, moneyValue, defaultSum, setMoneyValue })}
49
+ {renderInitialFeeInput({
50
+ calculatorParams,
51
+ moneyValue,
52
+ defaultSum,
53
+ setMoneyValue,
54
+ })}
55
+ {renderMonthsInput({
56
+ title: 'Срок ипотеки, месяцев',
57
+ minMonths,
58
+ maxMonths,
59
+ monthsValue,
60
+ defaultMonths,
61
+ setMonthsValue,
62
+ })}
63
+ <div className="mt-7">
64
+ <Checkbox text="Страхование жизни" checked={isInsurance} onChange={toggleIsInsurance} />
65
+ <Checkbox
66
+ className="mt-4"
67
+ text="Страхование жизни, злоровья и временной утраты трудоспособности"
68
+ checked={isFullInsurance}
69
+ onChange={toggleIsFullInsurance}
70
+ />
71
+ </div>
72
+ </div>
73
+ <div>
74
+ <div>
75
+ {rate
76
+ ? renderRate({ rate: rate, title: 'Ставка', sup: '%', className: 'tracking-[-25px]' })
77
+ : null}
78
+ </div>
79
+ <CalculatorValueBlock title="Ежемесячный платеж" value={monthlyPayment} postfix="₽" />
80
+ </div>
81
+ <div>
82
+ <div className="w-[351px]">{renderProposalMortgage(proposalMortgageValue)}</div>
83
+ {renderButtonSection(context, buttons)}
84
+ </div>
85
+ </section>
86
+ );
87
+ },
88
+ );
@@ -0,0 +1,8 @@
1
+ export const DEFAULT_MIN_SUM = 30000;
2
+ export const DEFAULT_MAX_SUM = 3000000;
3
+ export const DEFAULT_SUM = (DEFAULT_MAX_SUM - DEFAULT_MIN_SUM) / 2;
4
+ export const DEFAULT_MIN_MONTHS = 1;
5
+ export const DEFAULT_MAX_MONTHS = 84;
6
+ export const DEFAULT_MONTHS = Math.round((DEFAULT_MAX_MONTHS - DEFAULT_MIN_MONTHS) / 2);
7
+
8
+ export const MONTHS_IN_YEAR = 12;
@@ -0,0 +1,16 @@
1
+ import type { CalculatorParams } from './CalculatorContent';
2
+
3
+ interface GetCalculatorParamsParams {
4
+ tableRows?: CalculatorParams[];
5
+ isAnnuity?: boolean;
6
+ }
7
+
8
+ export const getCalculatorParams = (params: GetCalculatorParamsParams) => {
9
+ const { tableRows, isAnnuity = false } = params;
10
+
11
+ if (!tableRows) return {};
12
+
13
+ const calculatorParams = tableRows.find((row) => row.isAnnuity === isAnnuity);
14
+
15
+ return calculatorParams || {};
16
+ };
@@ -0,0 +1,18 @@
1
+ import type { CalculatorParams } from './CalculatorContent';
2
+
3
+ const DEFAULT_RATE = 10.2;
4
+
5
+ interface GetCreditRateParams {
6
+ calculatorParams?: CalculatorParams;
7
+ isInsurance: boolean;
8
+ }
9
+
10
+ export const getCreditRate = (params: GetCreditRateParams) => {
11
+ const { calculatorParams, isInsurance } = params;
12
+
13
+ if (!calculatorParams) return DEFAULT_RATE;
14
+
15
+ return isInsurance
16
+ ? calculatorParams?.rateWithInsurance || DEFAULT_RATE
17
+ : calculatorParams?.rateWithoutInsurance || DEFAULT_RATE;
18
+ };
@@ -0,0 +1,7 @@
1
+ import { DEFAULT_MONTHS } from './constants';
2
+ import type { CalculatorParams } from './CalculatorContent';
3
+
4
+ export const getDefaultMonths = (calculatorParams: CalculatorParams) =>
5
+ calculatorParams.maxMonths && calculatorParams.minMonths
6
+ ? Math.round((calculatorParams.maxMonths - calculatorParams.minMonths) / 2)
7
+ : DEFAULT_MONTHS;
@@ -0,0 +1,7 @@
1
+ import { DEFAULT_SUM } from './constants';
2
+ import type { CalculatorParams } from './CalculatorContent';
3
+
4
+ export const getDefaultSum = (calculatorParams: CalculatorParams) =>
5
+ calculatorParams.maxSum && calculatorParams.minSum
6
+ ? (calculatorParams.maxSum - calculatorParams.minSum) / 2
7
+ : DEFAULT_SUM;
@@ -0,0 +1,32 @@
1
+ import { clamp } from '../../utils/clamp';
2
+ import { DEFAULT_MAX_SUM, DEFAULT_MIN_SUM, MONTHS_IN_YEAR } from './constants';
3
+ import type { CalculatorParams } from './CalculatorContent';
4
+
5
+ type PaymentType = 'annuity' | 'differentiated';
6
+
7
+ interface GetMonthlyPaymentParams {
8
+ calculatorParams?: CalculatorParams;
9
+ paymentType: PaymentType;
10
+ rate: number;
11
+ sum: number;
12
+ months: number;
13
+ }
14
+
15
+ export const getMonthlyPayment = (params: GetMonthlyPaymentParams) => {
16
+ const { calculatorParams, paymentType, rate, sum, months } = params;
17
+
18
+ if (!calculatorParams) return 0;
19
+
20
+ const finalSum = clamp(
21
+ sum,
22
+ calculatorParams.minSum || DEFAULT_MIN_SUM,
23
+ calculatorParams.maxSum || DEFAULT_MAX_SUM,
24
+ );
25
+
26
+ if (paymentType === 'annuity') {
27
+ const annuityCoef = Number(rate) / (MONTHS_IN_YEAR * 100);
28
+ return finalSum * (annuityCoef + annuityCoef / (Math.pow(1 + annuityCoef, months) - 1));
29
+ } else {
30
+ return finalSum / months + finalSum * (Number(rate) / 12);
31
+ }
32
+ };
@@ -0,0 +1,7 @@
1
+ import { ButtonSection } from '../../ui-kit/Button/ButtonSection';
2
+
3
+ export function renderButtonSection(context, buttons) {
4
+ return buttons?.length ? (
5
+ <ButtonSection context={context} buttons={buttons} className="flex flex-col mt-7 gap-2" />
6
+ ) : null;
7
+ }
@@ -0,0 +1,43 @@
1
+ import type { JSXBlock } from '../../components/ContentPage/ContentPage';
2
+ import type { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
3
+ import type { CalculatorBlockDef } from './CalculatorContent';
4
+ import { EmbeddableCalcBlocks, EmbeddableCalcProps } from './EmbeddableCalcBlocks';
5
+
6
+ type EmbeddableCalcBlocks = {
7
+ blockCalcTabs?: CalculatorBlockDef[];
8
+ context: ContentPageContext;
9
+ className?: string;
10
+ };
11
+
12
+ export const renderCalculatorList = ({
13
+ blockCalcTabs,
14
+ context,
15
+ className,
16
+ }: EmbeddableCalcBlocks) => {
17
+ return blockCalcTabs?.length ? blockCalcTabs.map(renderBlock({ context, className })) : null;
18
+ };
19
+
20
+ const renderBlock =
21
+ ({ context, className }: any) =>
22
+ (blockCalcTabs: CalculatorBlockDef, i: number) => {
23
+ const type = blockCalcTabs?.calcType;
24
+ if (!type || !(type in EmbeddableCalcBlocks)) {
25
+ return null;
26
+ }
27
+ const EmbeddedBlock: JSXBlock<EmbeddableCalcProps> = EmbeddableCalcBlocks[type];
28
+ return (
29
+ <section
30
+ key={`${String(i)}`}
31
+ className={`box-border relative flex grow-0 shrink-0 basis-full ${className}`}
32
+ role="listitem"
33
+ >
34
+ <div className={`box-border p-9 w-full`}>
35
+ <EmbeddedBlock
36
+ context={context}
37
+ {...blockCalcTabs}
38
+ className="!p-0 flex justify-between"
39
+ />
40
+ </div>
41
+ </section>
42
+ );
43
+ };
@@ -0,0 +1,37 @@
1
+ import { InputRange } from '../../ui-kit/InputRange/InputRange';
2
+ import type { InputRangeProps } from '../../ui-kit/InputRange/InputRangeProps';
3
+ import { addSpacesBetweenNumbers } from '../../utils/addSpacesBetweenNumbers';
4
+ import { DEFAULT_MAX_SUM, DEFAULT_MIN_SUM } from './constants';
5
+ import type { CalculatorParams } from './CalculatorContent';
6
+
7
+ const STEP_MONEY = 1000;
8
+
9
+ interface RenderWantedSumInputProps {
10
+ calculatorParams: CalculatorParams;
11
+ moneyValue: number | undefined;
12
+ defaultSum: number;
13
+ setMoneyValue: InputRangeProps['onChange'];
14
+ }
15
+
16
+ export function renderInitialFeeInput(props: RenderWantedSumInputProps) {
17
+ const { calculatorParams, moneyValue, defaultSum, setMoneyValue } = props;
18
+
19
+ const minSum = calculatorParams?.minSum || DEFAULT_MIN_SUM;
20
+ const maxSum = calculatorParams?.maxSum || DEFAULT_MAX_SUM;
21
+
22
+ return (
23
+ <InputRange
24
+ className="mt-6"
25
+ title="Первоначальный взнос, ₽ "
26
+ items={[
27
+ `От ${addSpacesBetweenNumbers(minSum)} рублей`,
28
+ `До ${addSpacesBetweenNumbers(maxSum)} рублей`,
29
+ ]}
30
+ min={minSum}
31
+ max={maxSum}
32
+ step={STEP_MONEY}
33
+ value={moneyValue || defaultSum}
34
+ onChange={setMoneyValue}
35
+ />
36
+ );
37
+ }
@@ -0,0 +1,34 @@
1
+ import { InputRange } from '../../ui-kit/InputRange/InputRange';
2
+ import type { InputRangeProps } from '../../ui-kit/InputRange/InputRangeProps';
3
+
4
+ const STEP_MONTHS = 1;
5
+
6
+ interface RenderMonthsInputProps {
7
+ title: string;
8
+ minMonths: number;
9
+ maxMonths: number;
10
+ monthsValue: number | undefined;
11
+ defaultMonths: number;
12
+ setMonthsValue: InputRangeProps['onChange'];
13
+ }
14
+
15
+ export function renderMonthsInput(props: RenderMonthsInputProps) {
16
+ const { title, minMonths, maxMonths, monthsValue, defaultMonths, setMonthsValue } = props;
17
+ const monthText = (month) => {
18
+ const text = Number(month) % 10 === 1 ? 'месяца' : 'месяцев';
19
+ return `${month} ${text}`;
20
+ };
21
+
22
+ return (
23
+ <InputRange
24
+ className="mt-6"
25
+ title={title}
26
+ items={[`От ${monthText(minMonths)}`, `До ${monthText(maxMonths)}`]}
27
+ min={minMonths}
28
+ max={maxMonths}
29
+ step={STEP_MONTHS}
30
+ value={monthsValue || defaultMonths}
31
+ onChange={setMonthsValue}
32
+ />
33
+ );
34
+ }
@@ -0,0 +1,14 @@
1
+ import { addSpacesBetweenNumbers } from '../../utils/addSpacesBetweenNumbers';
2
+ import { Button } from '../../ui-kit/Button/Button';
3
+
4
+ export function renderProposal(monthlyPayment: number) {
5
+ return (
6
+ <div className="box-border ">
7
+ <div className="text-base font-light">Ежемесячный платёж</div>
8
+ <div className="text-title mb-3 font-normal">
9
+ {addSpacesBetweenNumbers(Math.round(monthlyPayment))} ₽
10
+ </div>
11
+ <Button className="mt-[50px] w-full" text="Отправить заявку" version="primary" href="#" />
12
+ </div>
13
+ );
14
+ }