@redneckz/wildless-cms-uni-blocks 0.14.1069 → 0.14.1071

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 (229) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +442 -297
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/CashbackCalculator/CashbackCalculator.d.ts +7 -2
  5. package/bundle/components/CashbackCalculator/CashbackCalculatorResult.d.ts +2 -1
  6. package/bundle/components/CashbackCalculator/CashbackCategory.d.ts +6 -2
  7. package/bundle/components/CashbackCalculator/constants.d.ts +16 -0
  8. package/bundle/components/CashbackCalculator/getPercentCategories.d.ts +1 -0
  9. package/bundle/components/CashbackCalculator/renderButtons.d.ts +9 -0
  10. package/bundle/components/CashbackCalculator/useCashbackCalculator.d.ts +4 -2
  11. package/bundle/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +6 -0
  12. package/bundle/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +38 -0
  13. package/bundle/components/GalleryLayout/utils.d.ts +1 -0
  14. package/bundle/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
  15. package/bundle/ui-kit/RichText/RichTextProps.d.ts +2 -0
  16. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +34 -22
  17. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  18. package/dist/components/Blocks.js +4 -2
  19. package/dist/components/Blocks.js.map +1 -1
  20. package/dist/components/CashbackCalculator/CashbackCalculator.d.ts +7 -2
  21. package/dist/components/CashbackCalculator/CashbackCalculator.js +25 -14
  22. package/dist/components/CashbackCalculator/CashbackCalculator.js.map +1 -1
  23. package/dist/components/CashbackCalculator/CashbackCalculatorContent.d.ts +0 -25
  24. package/dist/components/CashbackCalculator/CashbackCalculatorContent.js +0 -1
  25. package/dist/components/CashbackCalculator/CashbackCalculatorResult.d.ts +2 -1
  26. package/dist/components/CashbackCalculator/CashbackCalculatorResult.js +9 -11
  27. package/dist/components/CashbackCalculator/CashbackCalculatorResult.js.map +1 -1
  28. package/dist/components/CashbackCalculator/CashbackCategory.d.ts +6 -2
  29. package/dist/components/CashbackCalculator/CashbackCategory.js +33 -54
  30. package/dist/components/CashbackCalculator/CashbackCategory.js.map +1 -1
  31. package/dist/components/CashbackCalculator/constants.d.ts +16 -0
  32. package/dist/components/CashbackCalculator/constants.js +89 -0
  33. package/dist/components/CashbackCalculator/constants.js.map +1 -0
  34. package/dist/components/CashbackCalculator/getPercentCategories.d.ts +1 -0
  35. package/dist/components/CashbackCalculator/getPercentCategories.js +16 -0
  36. package/dist/components/CashbackCalculator/getPercentCategories.js.map +1 -0
  37. package/dist/components/CashbackCalculator/renderButtons.d.ts +9 -0
  38. package/dist/components/CashbackCalculator/renderButtons.js +10 -0
  39. package/dist/components/CashbackCalculator/renderButtons.js.map +1 -0
  40. package/dist/components/CashbackCalculator/useCashbackCalculator.d.ts +4 -2
  41. package/dist/components/CashbackCalculator/useCashbackCalculator.js +17 -15
  42. package/dist/components/CashbackCalculator/useCashbackCalculator.js.map +1 -1
  43. package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +6 -0
  44. package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js +56 -0
  45. package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js.map +1 -0
  46. package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +38 -0
  47. package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js +2 -0
  48. package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js.map +1 -0
  49. package/dist/components/GalleryLayout/utils.d.ts +1 -0
  50. package/dist/retail/api/createParticipant.js +1 -1
  51. package/dist/retail/api/createParticipant.js.map +1 -1
  52. package/dist/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
  53. package/dist/ui-kit/RichText/RichText.js +2 -2
  54. package/dist/ui-kit/RichText/RichText.js.map +1 -1
  55. package/dist/ui-kit/RichText/RichTextProps.d.ts +2 -0
  56. package/lib/common.css +1 -1
  57. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +34 -22
  58. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  59. package/lib/components/Blocks.js +4 -2
  60. package/lib/components/Blocks.js.map +1 -1
  61. package/lib/components/CashbackCalculator/CashbackCalculator.d.ts +7 -2
  62. package/lib/components/CashbackCalculator/CashbackCalculator.js +25 -14
  63. package/lib/components/CashbackCalculator/CashbackCalculator.js.map +1 -1
  64. package/lib/components/CashbackCalculator/CashbackCalculatorContent.d.ts +0 -25
  65. package/lib/components/CashbackCalculator/CashbackCalculatorContent.js +0 -1
  66. package/lib/components/CashbackCalculator/CashbackCalculatorResult.d.ts +2 -1
  67. package/lib/components/CashbackCalculator/CashbackCalculatorResult.js +9 -11
  68. package/lib/components/CashbackCalculator/CashbackCalculatorResult.js.map +1 -1
  69. package/lib/components/CashbackCalculator/CashbackCategory.d.ts +6 -2
  70. package/lib/components/CashbackCalculator/CashbackCategory.js +33 -54
  71. package/lib/components/CashbackCalculator/CashbackCategory.js.map +1 -1
  72. package/lib/components/CashbackCalculator/constants.d.ts +16 -0
  73. package/lib/components/CashbackCalculator/constants.js +87 -0
  74. package/lib/components/CashbackCalculator/constants.js.map +1 -0
  75. package/lib/components/CashbackCalculator/getPercentCategories.d.ts +1 -0
  76. package/lib/components/CashbackCalculator/getPercentCategories.js +13 -0
  77. package/lib/components/CashbackCalculator/getPercentCategories.js.map +1 -0
  78. package/lib/components/CashbackCalculator/renderButtons.d.ts +9 -0
  79. package/lib/components/CashbackCalculator/renderButtons.js +7 -0
  80. package/lib/components/CashbackCalculator/renderButtons.js.map +1 -0
  81. package/lib/components/CashbackCalculator/useCashbackCalculator.d.ts +4 -2
  82. package/lib/components/CashbackCalculator/useCashbackCalculator.js +18 -16
  83. package/lib/components/CashbackCalculator/useCashbackCalculator.js.map +1 -1
  84. package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +6 -0
  85. package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.fixture.d.ts +5 -0
  86. package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js +54 -0
  87. package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js.map +1 -0
  88. package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +38 -0
  89. package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js +2 -0
  90. package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js.map +1 -0
  91. package/lib/components/GalleryLayout/utils.d.ts +1 -0
  92. package/lib/retail/api/createParticipant.js +1 -1
  93. package/lib/retail/api/createParticipant.js.map +1 -1
  94. package/lib/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
  95. package/lib/ui-kit/RichText/RichText.js +2 -2
  96. package/lib/ui-kit/RichText/RichText.js.map +1 -1
  97. package/lib/ui-kit/RichText/RichTextProps.d.ts +2 -0
  98. package/mobile/bundle/bundle.umd.js +188 -90
  99. package/mobile/bundle/bundle.umd.min.js +1 -1
  100. package/mobile/bundle/components/CashbackCalculator/CashbackCalculator.d.ts +7 -2
  101. package/mobile/bundle/components/CashbackCalculator/CashbackCalculatorResult.d.ts +2 -1
  102. package/mobile/bundle/components/CashbackCalculator/CashbackCategory.d.ts +6 -2
  103. package/mobile/bundle/components/CashbackCalculator/constants.d.ts +16 -0
  104. package/mobile/bundle/components/CashbackCalculator/getPercentCategories.d.ts +1 -0
  105. package/mobile/bundle/components/CashbackCalculator/renderButtons.d.ts +9 -0
  106. package/mobile/bundle/components/CashbackCalculator/useCashbackCalculator.d.ts +4 -2
  107. package/mobile/bundle/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +6 -0
  108. package/mobile/bundle/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +38 -0
  109. package/mobile/bundle/components/GalleryLayout/utils.d.ts +1 -0
  110. package/mobile/bundle/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
  111. package/mobile/bundle/ui-kit/RichText/RichTextProps.d.ts +2 -0
  112. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +34 -22
  113. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  114. package/mobile/dist/components/CashbackCalculator/CashbackCalculator.d.ts +7 -2
  115. package/mobile/dist/components/CashbackCalculator/CashbackCalculator.js +25 -14
  116. package/mobile/dist/components/CashbackCalculator/CashbackCalculator.js.map +1 -1
  117. package/mobile/dist/components/CashbackCalculator/CashbackCalculatorContent.d.ts +0 -25
  118. package/mobile/dist/components/CashbackCalculator/CashbackCalculatorContent.js +0 -1
  119. package/mobile/dist/components/CashbackCalculator/CashbackCalculatorResult.d.ts +2 -1
  120. package/mobile/dist/components/CashbackCalculator/CashbackCalculatorResult.js +9 -11
  121. package/mobile/dist/components/CashbackCalculator/CashbackCalculatorResult.js.map +1 -1
  122. package/mobile/dist/components/CashbackCalculator/CashbackCategory.d.ts +6 -2
  123. package/mobile/dist/components/CashbackCalculator/CashbackCategory.js +33 -54
  124. package/mobile/dist/components/CashbackCalculator/CashbackCategory.js.map +1 -1
  125. package/mobile/dist/components/CashbackCalculator/constants.d.ts +16 -0
  126. package/mobile/dist/components/CashbackCalculator/constants.js +89 -0
  127. package/mobile/dist/components/CashbackCalculator/constants.js.map +1 -0
  128. package/mobile/dist/components/CashbackCalculator/getPercentCategories.d.ts +1 -0
  129. package/mobile/dist/components/CashbackCalculator/getPercentCategories.js +16 -0
  130. package/mobile/dist/components/CashbackCalculator/getPercentCategories.js.map +1 -0
  131. package/mobile/dist/components/CashbackCalculator/renderButtons.d.ts +9 -0
  132. package/mobile/dist/components/CashbackCalculator/renderButtons.js +10 -0
  133. package/mobile/dist/components/CashbackCalculator/renderButtons.js.map +1 -0
  134. package/mobile/dist/components/CashbackCalculator/useCashbackCalculator.d.ts +4 -2
  135. package/mobile/dist/components/CashbackCalculator/useCashbackCalculator.js +17 -15
  136. package/mobile/dist/components/CashbackCalculator/useCashbackCalculator.js.map +1 -1
  137. package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +6 -0
  138. package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js +56 -0
  139. package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js.map +1 -0
  140. package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +38 -0
  141. package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js +2 -0
  142. package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js.map +1 -0
  143. package/mobile/dist/components/GalleryLayout/utils.d.ts +1 -0
  144. package/mobile/dist/retail/api/createParticipant.js +1 -1
  145. package/mobile/dist/retail/api/createParticipant.js.map +1 -1
  146. package/mobile/dist/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
  147. package/mobile/dist/ui-kit/RichText/RichText.js +2 -2
  148. package/mobile/dist/ui-kit/RichText/RichText.js.map +1 -1
  149. package/mobile/dist/ui-kit/RichText/RichTextProps.d.ts +2 -0
  150. package/mobile/lib/common.css +1 -1
  151. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +34 -22
  152. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  153. package/mobile/lib/components/CashbackCalculator/CashbackCalculator.d.ts +7 -2
  154. package/mobile/lib/components/CashbackCalculator/CashbackCalculator.js +25 -14
  155. package/mobile/lib/components/CashbackCalculator/CashbackCalculator.js.map +1 -1
  156. package/mobile/lib/components/CashbackCalculator/CashbackCalculatorContent.d.ts +0 -25
  157. package/mobile/lib/components/CashbackCalculator/CashbackCalculatorContent.js +0 -1
  158. package/mobile/lib/components/CashbackCalculator/CashbackCalculatorResult.d.ts +2 -1
  159. package/mobile/lib/components/CashbackCalculator/CashbackCalculatorResult.js +9 -11
  160. package/mobile/lib/components/CashbackCalculator/CashbackCalculatorResult.js.map +1 -1
  161. package/mobile/lib/components/CashbackCalculator/CashbackCategory.d.ts +6 -2
  162. package/mobile/lib/components/CashbackCalculator/CashbackCategory.js +33 -54
  163. package/mobile/lib/components/CashbackCalculator/CashbackCategory.js.map +1 -1
  164. package/mobile/lib/components/CashbackCalculator/constants.d.ts +16 -0
  165. package/mobile/lib/components/CashbackCalculator/constants.js +87 -0
  166. package/mobile/lib/components/CashbackCalculator/constants.js.map +1 -0
  167. package/mobile/lib/components/CashbackCalculator/getPercentCategories.d.ts +1 -0
  168. package/mobile/lib/components/CashbackCalculator/getPercentCategories.js +13 -0
  169. package/mobile/lib/components/CashbackCalculator/getPercentCategories.js.map +1 -0
  170. package/mobile/lib/components/CashbackCalculator/renderButtons.d.ts +9 -0
  171. package/mobile/lib/components/CashbackCalculator/renderButtons.js +7 -0
  172. package/mobile/lib/components/CashbackCalculator/renderButtons.js.map +1 -0
  173. package/mobile/lib/components/CashbackCalculator/useCashbackCalculator.d.ts +4 -2
  174. package/mobile/lib/components/CashbackCalculator/useCashbackCalculator.js +18 -16
  175. package/mobile/lib/components/CashbackCalculator/useCashbackCalculator.js.map +1 -1
  176. package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +6 -0
  177. package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js +54 -0
  178. package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js.map +1 -0
  179. package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +38 -0
  180. package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js +2 -0
  181. package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js.map +1 -0
  182. package/mobile/lib/components/GalleryLayout/utils.d.ts +1 -0
  183. package/mobile/lib/retail/api/createParticipant.js +1 -1
  184. package/mobile/lib/retail/api/createParticipant.js.map +1 -1
  185. package/mobile/lib/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
  186. package/mobile/lib/ui-kit/RichText/RichText.js +2 -2
  187. package/mobile/lib/ui-kit/RichText/RichText.js.map +1 -1
  188. package/mobile/lib/ui-kit/RichText/RichTextProps.d.ts +2 -0
  189. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +47 -28
  190. package/mobile/src/components/CashbackCalculator/CashbackCalculator.tsx +73 -69
  191. package/mobile/src/components/CashbackCalculator/CashbackCalculatorContent.ts +0 -28
  192. package/mobile/src/components/CashbackCalculator/CashbackCalculatorResult.tsx +23 -23
  193. package/mobile/src/components/CashbackCalculator/CashbackCategory.tsx +69 -71
  194. package/mobile/src/components/CashbackCalculator/constants.ts +97 -0
  195. package/mobile/src/components/CashbackCalculator/getPercentCategories.ts +24 -0
  196. package/mobile/src/components/CashbackCalculator/renderButtons.tsx +38 -0
  197. package/mobile/src/components/CashbackCalculator/useCashbackCalculator.ts +26 -17
  198. package/mobile/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.example.json +47 -0
  199. package/mobile/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.tsx +116 -0
  200. package/{src/components/CashbackCalculator/CashbackCalculator.ui.json → mobile/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.ui.json} +6 -0
  201. package/mobile/src/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.ts +49 -0
  202. package/mobile/src/retail/api/createParticipant.ts +1 -1
  203. package/mobile/src/retail/model/ApplicationLeadFormTypes.ts +1 -1
  204. package/mobile/src/ui-kit/RichText/RichText.tsx +9 -1
  205. package/mobile/src/ui-kit/RichText/RichTextProps.ts +2 -0
  206. package/package.json +2 -2
  207. package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +47 -28
  208. package/src/components/Blocks.ts +4 -2
  209. package/src/components/CashbackCalculator/CashbackCalculator.tsx +73 -69
  210. package/src/components/CashbackCalculator/CashbackCalculatorContent.ts +0 -28
  211. package/src/components/CashbackCalculator/CashbackCalculatorResult.tsx +23 -23
  212. package/src/components/CashbackCalculator/CashbackCategory.tsx +69 -71
  213. package/src/components/CashbackCalculator/constants.ts +97 -0
  214. package/src/components/CashbackCalculator/getPercentCategories.ts +24 -0
  215. package/src/components/CashbackCalculator/renderButtons.tsx +38 -0
  216. package/src/components/CashbackCalculator/useCashbackCalculator.ts +26 -17
  217. package/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.example.json +47 -0
  218. package/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.fixture.tsx +61 -0
  219. package/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.tsx +116 -0
  220. package/{mobile/src/components/CashbackCalculator/CashbackCalculator.ui.json → src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.ui.json} +6 -0
  221. package/src/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.ts +49 -0
  222. package/src/retail/api/createParticipant.ts +1 -1
  223. package/src/retail/model/ApplicationLeadFormTypes.ts +1 -1
  224. package/src/ui-kit/RichText/RichText.tsx +9 -1
  225. package/src/ui-kit/RichText/RichTextProps.ts +2 -0
  226. package/bundle/components/CashbackCalculator/CashbackCalculatorContent.d.ts +0 -25
  227. package/mobile/bundle/components/CashbackCalculator/CashbackCalculatorContent.d.ts +0 -25
  228. package/mobile/src/components/CashbackCalculator/CashbackCalculator.example.json +0 -1
  229. package/src/components/CashbackCalculator/CashbackCalculator.example.json +0 -1
@@ -823,11 +823,11 @@
823
823
  ? 'bg-secondary-light text-primary-main'
824
824
  : 'bg-primary-main text-black group-data-secondary:bg-white/30 group-data-secondary:text-black'), children: jsx(Img, { className: "w-6 h-6", image: { ...icon, iconVersion: icon.iconVersion || benefitsVersion } }) })) : null;
825
825
 
826
- const RichText = JSX(({ __html = '', richVersion = '', itemSize = 'list-m', isDotted = true, children }) => {
826
+ const RichText = JSX(({ __html = '', richVersion = '', itemSize = 'list-m', className, isDotted = true, children, }) => {
827
827
  const dotStyle = isDotted ? '' : 'without-dots';
828
828
  return __html || children ? (
829
829
  /* Attribute [data-component] need for correct render in wcms editor. Do not remove. */
830
- jsx("div", { "data-component": "rich-text-container", children: jsx("div", { className: style(richVersion, itemSize, 'md-container group-data-secondary:text-white group-data-gray:text-secondary-text', dotStyle), dangerouslySetInnerHTML: __html ? { __html } : undefined, children: children }) })) : null;
830
+ jsx("div", { "data-component": "rich-text-container", children: jsx("div", { className: style(richVersion, itemSize, 'md-container group-data-secondary:text-white group-data-gray:text-secondary-text', dotStyle, className), dangerouslySetInnerHTML: __html ? { __html } : undefined, children: children }) })) : null;
831
831
  });
832
832
 
833
833
  const renderBenefitDescription = (description, i) => description ? (jsx(Paragraph, { font: "font-light", size: "text-m", color: "text-secondary-text group-data-secondary:text-white", children: description }, `description-${i}`)) : null;
@@ -6897,7 +6897,7 @@
6897
6897
  return res || {};
6898
6898
  };
6899
6899
 
6900
- const createParticipant = (body) => fetchRetailJSON('/external/public-data/createParticipant', 'POST', body).then((res) => res || null);
6900
+ const createParticipant = (body) => fetchRetailJSON('/internal/entities/createParticipant', 'POST', body).then((res) => res || null);
6901
6901
 
6902
6902
  const createUserProfile = (body) => fetchRetailJSON('/public-data/createUserProfile', 'POST', body).then((res) => res?.profile?.id || null);
6903
6903
 
@@ -6966,7 +6966,7 @@
6966
6966
  'bg-white': 'text-primary-main',
6967
6967
  transparent: 'text-white',
6968
6968
  };
6969
- const renderImage = (bgColor, image, size) => {
6969
+ const renderImage$1 = (bgColor, image, size) => {
6970
6970
  const img = image?.src
6971
6971
  ? image
6972
6972
  : {
@@ -6980,7 +6980,7 @@
6980
6980
  'bg-white': 'text-primary-text',
6981
6981
  transparent: 'text-white',
6982
6982
  };
6983
- const Logo = JSX(({ className, href = '/', logo, children, targetBlank, bgColor = 'bg-white', showTitle = true, data, size = ICON_SIZE, }) => (jsxs("a", { className: style('inline-flex items-center font-sans no-underline', className), href: logo?.href ?? href, target: targetBlank ? '_blank' : '_self', "aria-label": logo?.title ?? 'Россельхозбанк', ...getAspectsAttributes(data), children: [renderImage(bgColor, logo?.image, size), showTitle
6983
+ const Logo = JSX(({ className, href = '/', logo, children, targetBlank, bgColor = 'bg-white', showTitle = true, data, size = ICON_SIZE, }) => (jsxs("a", { className: style('inline-flex items-center font-sans no-underline', className), href: logo?.href ?? href, target: targetBlank ? '_blank' : '_self', "aria-label": logo?.title ?? 'Россельхозбанк', ...getAspectsAttributes(data), children: [renderImage$1(bgColor, logo?.image, size), showTitle
6984
6984
  ? children ?? (jsx("div", { className: "ml-s", children: jsx(Text, { font: "font-medium", color: TEXT_COLOR[bgColor], size: logoTitleSizeStyle, children: logo?.title ?? 'Россельхозбанк' }) }))
6985
6985
  : null] })));
6986
6986
 
@@ -7837,43 +7837,26 @@
7837
7837
  try {
7838
7838
  startSending();
7839
7839
  const transformedFormData = transformFormData(formData);
7840
- const participantData = await createParticipant({
7841
- phone: formatPhone(transformedFormData.phone),
7842
- email: transformedFormData.email,
7843
- });
7844
7840
  const referalData = leadFormStore.referalData;
7845
7841
  const marketingInfo = sessionStore.marketingInfo;
7846
- if (!participantData) {
7847
- throw new Error();
7848
- }
7849
- const { participantId, userId } = participantData;
7850
- if (!participantId) {
7851
- throw new Error();
7852
- }
7853
7842
  const common = {
7854
7843
  programId,
7855
- userId,
7856
7844
  productType,
7857
7845
  sendAspects,
7858
7846
  verifyPhoneDialog,
7859
7847
  handleFailSendForm,
7860
7848
  };
7861
7849
  const taskData = {
7862
- participantId,
7863
7850
  formData: transformedFormData,
7864
7851
  referalData,
7865
7852
  marketingInfo,
7866
7853
  saveUserData,
7867
7854
  };
7868
- const sendCurrentTask = createSendCurrentTaskNew({
7869
- common,
7870
- taskData,
7871
- consentBkiDialog,
7872
- });
7873
7855
  const handleSuccessVerify = createHandleSuccessVerifyNew({
7874
7856
  common,
7857
+ taskData,
7875
7858
  draftDialog,
7876
- sendCurrentTask,
7859
+ consentBkiDialog,
7877
7860
  });
7878
7861
  const acceptedConsents = getAcceptedConsents(transformedFormData, productType);
7879
7862
  verifyPhoneDialog.open({
@@ -7898,6 +7881,9 @@
7898
7881
  const createSendCurrentTaskNew = ({ common, taskData, consentBkiDialog, }) => async () => {
7899
7882
  const { programId, userId, productType, sendAspects, verifyPhoneDialog, handleFailSendForm } = common;
7900
7883
  const { participantId, formData, referalData, marketingInfo, saveUserData } = taskData;
7884
+ if (!participantId) {
7885
+ throw new Error();
7886
+ }
7901
7887
  const taskId = await updateUserDataNewMicroservice({
7902
7888
  programId,
7903
7889
  participantId,
@@ -7917,9 +7903,34 @@
7917
7903
  onFail: handleFailSendForm,
7918
7904
  });
7919
7905
  };
7920
- const createHandleSuccessVerifyNew = ({ common, draftDialog, sendCurrentTask, }) => async () => {
7921
- const { verifyPhoneDialog, sendAspects, handleFailSendForm, userId, programId, productType } = common;
7906
+ const createHandleSuccessVerifyNew = ({ common, taskData, draftDialog, consentBkiDialog, }) => async () => {
7907
+ const { programId, productType, sendAspects, verifyPhoneDialog, handleFailSendForm } = common;
7908
+ const { formData } = taskData;
7922
7909
  try {
7910
+ const participantData = await createParticipant({
7911
+ phone: formatPhone(formData.phone),
7912
+ email: formData.email,
7913
+ });
7914
+ if (!participantData) {
7915
+ throw new Error();
7916
+ }
7917
+ const { participantId, userId } = participantData;
7918
+ if (!participantId) {
7919
+ throw new Error();
7920
+ }
7921
+ const updatedCommon = {
7922
+ ...common,
7923
+ userId,
7924
+ };
7925
+ const updatedTaskData = {
7926
+ ...taskData,
7927
+ participantId,
7928
+ };
7929
+ const sendCurrentTask = createSendCurrentTaskNew({
7930
+ common: updatedCommon,
7931
+ taskData: updatedTaskData,
7932
+ consentBkiDialog,
7933
+ });
7923
7934
  const lastTaskId = await getLastTaskStatus({ userId, programId });
7924
7935
  if (lastTaskId) {
7925
7936
  const task = await getTaskById({ taskId: lastTaskId });
@@ -7936,7 +7947,8 @@
7936
7947
  await sendCurrentTask();
7937
7948
  }
7938
7949
  }
7939
- catch {
7950
+ catch (error) {
7951
+ console.error('Error in handleSuccessVerify:', error);
7940
7952
  handleFailSendForm();
7941
7953
  }
7942
7954
  };
@@ -10248,27 +10260,30 @@
10248
10260
  return (jsxs(BlockWrapper, { className: style('flex flex-col', className), defaultPadding: "p-2xl", ...rest, children: [jsx(Img, { className: "self-center", image: icon }), 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 ? (jsxs(Foldable, { children: [jsxs("div", { children: [visibleCells, jsx(FoldableSection, { isUnfolded: isVisible, children: hiddenCells })] }), cardCells.length >= visibleCellsCount ? (jsx(DefaultFoldButton, { className: "mt-m", label: isVisible ? 'Скрыть' : 'Подробнее о тарифе', isUnfolded: isVisible, embedded: true, data: data, onClick: handleFold })) : null] })) : (jsx("div", { children: visibleCells }))] }));
10249
10261
  });
10250
10262
 
10251
- const MAX_MONTH_CASHBACK = 5000;
10252
- const MAX_YEAR_CASHBACK = 60000;
10253
10263
  const ResultText = JSX(({ text, value }) => (jsxs("div", { className: "space-y-xs w-full", children: [jsx(Text, { size: "text-m", color: "text-primary-text", font: "font-light", children: text }), jsx("div", { className: "w-full text-2xl bg-main-gray px-4 py-3 rounded-md", children: toLocalNumberFormat()(value) })] })));
10254
- const CashbackCalculatorResult = JSX(({ cashbacks }) => {
10255
- const { mounth, year } = getResult(cashbacks);
10256
- return (jsxs("div", { className: "w-full flex flex-col gap-lg", children: [jsx(Heading, { className: "text-left", headingType: "h5", as: "h2", title: "\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u0440\u0430\u0441\u0447\u0435\u0442\u0430" }), jsx(RichText, { __html: '\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438 \u043F\u043E\u043A\u0443\u043F\u043E\u043A \u0434\u043B\u044F \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0431\u0430\u043B\u043B\u043E\u0432 \u043F\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435.<br />\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u0435\u0435 \u043F\u043E \u0443\u0441\u043B\u043E\u0432\u0438\u044F\u043C \u0438 \u043D\u0430\u0447\u0438\u0441\u043B\u0435\u043D\u0438\u044F\u043C \u043C\u043E\u0436\u043D\u043E \u0443\u0437\u043D\u0430\u0442\u044C \u0432\u043E \u0432\u043A\u043B\u0430\u0434\u043A\u0435 <a href="#docs">\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u044B</a>' }), jsxs("div", { className: "flex flex-col @xs:flex-row gap-lg", children: [jsx(ResultText, { text: "\u0411\u0430\u043B\u043B\u043E\u0432 \u0432 \u043C\u0435\u0441\u044F\u0446", value: mounth }), jsx(ResultText, { text: "\u0411\u0430\u043B\u043B\u043E\u0432 \u0432 \u0433\u043E\u0434", value: year })] })] }));
10264
+ const CashbackCalculatorResult = JSX(({ cashbacks, maxMonthCashback }) => {
10265
+ const { month, year } = getResult(cashbacks, maxMonthCashback);
10266
+ return (jsxs("div", { className: "w-full flex flex-col gap-lg", children: [jsx(Heading, { className: "text-left", headingType: "h5", as: "h2", title: "\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u0440\u0430\u0441\u0447\u0435\u0442\u0430" }), jsxs("div", { className: "flex flex-col @xs:flex-row gap-lg", children: [jsx(ResultText, { text: "\u0411\u0430\u043B\u043B\u043E\u0432 \u0432 \u043C\u0435\u0441\u044F\u0446", value: month }), jsx(ResultText, { text: "\u0411\u0430\u043B\u043B\u043E\u0432 \u0432 \u0433\u043E\u0434", value: year })] })] }));
10257
10267
  });
10258
- const getResult = (cashbacks) => {
10268
+ const getResult = (cashbacks, maxMonthCashback) => {
10259
10269
  return cashbacks.reduce((acc, val) => {
10260
- const mounthSum = (Number(val.percent.key) / 100) * val.sum;
10270
+ const mounthSum = (formatKey(val.percent.key) / 100) * val.sum;
10261
10271
  return {
10262
- mounth: Math.min(acc.mounth + mounthSum, MAX_MONTH_CASHBACK),
10263
- year: Math.min(acc.year + mounthSum * 12, MAX_YEAR_CASHBACK),
10272
+ month: Math.min(acc.month + mounthSum, maxMonthCashback),
10273
+ year: Math.min(acc.year + mounthSum * 12, maxMonthCashback * 12),
10264
10274
  };
10265
10275
  }, {
10266
- mounth: 0,
10276
+ month: 0,
10267
10277
  year: 0,
10268
10278
  });
10269
10279
  };
10280
+ const formatKey = (key) => Number(key.replace('-main', ''));
10270
10281
 
10271
- const AllPercentCategories = [
10282
+ const ALL_PERCENT_STANDARD_CATEGORIES = [
10283
+ {
10284
+ text: 'Категория 1% «На всё»',
10285
+ key: '1-main',
10286
+ },
10272
10287
  {
10273
10288
  text: 'Категория 1,5%',
10274
10289
  key: '1.5',
@@ -10290,7 +10305,11 @@
10290
10305
  key: '15',
10291
10306
  },
10292
10307
  ];
10293
- const PercentCategoriesWithoutIncreased = [
10308
+ const ALL_PERCENT_PREMIUM_CATEGORIES = [
10309
+ {
10310
+ text: 'Категория 1,5% «На всё»',
10311
+ key: '1.5-main',
10312
+ },
10294
10313
  {
10295
10314
  text: 'Категория 1,5%',
10296
10315
  key: '1.5',
@@ -10299,58 +10318,128 @@
10299
10318
  text: 'Категория 3%',
10300
10319
  key: '3',
10301
10320
  },
10321
+ {
10322
+ text: 'Категория 5%',
10323
+ key: '5',
10324
+ },
10325
+ {
10326
+ text: 'Категория 10%',
10327
+ key: '10',
10328
+ },
10329
+ {
10330
+ text: 'Категория 15%',
10331
+ key: '15',
10332
+ },
10302
10333
  ];
10303
- const CashbackCategory = JSX(({ categories, cashback, showIncreasedPercents, maxInputRange, deleteImage, onDelete, onChange, }) => {
10304
- const [currentCategory, setCurrentCategory] = useState(getRandomElement(categories));
10305
- const isMainCashback = cashback.id === 0;
10306
- const onChangePercent = (value) => {
10307
- onChange({
10308
- ...cashback,
10309
- percent: value,
10310
- });
10311
- };
10312
- const onChangeSum = (value) => {
10313
- onChange({
10314
- ...cashback,
10315
- sum: value,
10316
- });
10317
- };
10318
- return (jsxs("div", { className: "w-full space-y-m", children: [jsxs("div", { className: "space-y-xs", children: [jsx(Text, { size: "text-m", color: "text-primary-text", font: "font-light", children: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E" }), jsxs("div", { className: "flex gap-m", children: [jsx(Select, { className: "w-full", isManualInput: isMainCashback, placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E", options: getPercentCategories(isMainCashback, showIncreasedPercents), value: cashback.percent, onChange: onChangePercent }), !isMainCashback ? (jsx(Button, { version: "secondary", onClick: () => onDelete(cashback.id), shape: "round", className: "px-4 rounded-md", children: jsx(Img, { image: deleteImage }) })) : null] })] }), categories?.length && !isMainCashback ? (jsx(Select, { label: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E \u043F\u043E\u043A\u0443\u043F\u043E\u043A", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E \u043F\u043E\u043A\u0443\u043F\u043E\u043A", options: categories, value: currentCategory, onChange: setCurrentCategory })) : null, jsx(InputRange, { step: 500, title: "\u0421\u0443\u043C\u043C\u0430 \u043F\u043E\u043A\u0443\u043F\u043E\u043A \u0432 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438", min: 0, max: maxInputRange, value: cashback.sum, onChange: onChangeSum })] }));
10319
- });
10320
- const getRandomElement = (arr) => arr?.[new Date().getTime().toString().slice(-1)];
10321
- const getPercentCategories = (isMainCashback, showIncreasedPercents) => {
10322
- if (isMainCashback) {
10323
- return [];
10324
- }
10325
- else if (showIncreasedPercents) {
10326
- return AllPercentCategories;
10327
- }
10328
- else {
10329
- return PercentCategoriesWithoutIncreased;
10330
- }
10334
+ const MAIN_CASHBACK_KEY = {
10335
+ standard: '1-main',
10336
+ premium: '1.5-main',
10331
10337
  };
10332
-
10333
- const DEFAULT_CASHBACK = [
10338
+ const DEFAULT_STANDARD_CASHBACK = [
10339
+ {
10340
+ id: 0,
10341
+ percent: {
10342
+ text: 'Категория 1% «На всё»',
10343
+ key: '1-main',
10344
+ },
10345
+ sum: 5000,
10346
+ },
10347
+ ];
10348
+ const DEFAULT_PREMIUM_CASHBACK = [
10334
10349
  {
10335
10350
  id: 0,
10336
10351
  percent: {
10337
- text: 'Категория 1% "На всё"',
10338
- key: '1',
10352
+ text: 'Категория 1,5% «На всё»',
10353
+ key: '1.5-main',
10339
10354
  },
10340
10355
  sum: 5000,
10341
10356
  },
10342
10357
  ];
10343
- const useCashbackCalculator = () => {
10358
+ // export const INCREASED_PERCENTS = ['5', '10', '15'];
10359
+ const MAX_CATEGORIES = {
10360
+ standard: 5,
10361
+ premium: 7,
10362
+ };
10363
+ const INFO_BLOCK_HTML = `<p>Полученные баллы можно конвертировать в рубли и компенсировать покупки у партнеров.</p>`;
10364
+ const MAX_MONTH_CASHBACK = {
10365
+ standard: 5000,
10366
+ premium: 15000,
10367
+ };
10368
+
10369
+ const getPercentCategories = (isMainCashbackAdded, calculatorType) => {
10370
+ const allPercentCategories = calculatorType === 'premium' ? ALL_PERCENT_PREMIUM_CATEGORIES : ALL_PERCENT_STANDARD_CATEGORIES;
10371
+ let updatedCategories = allPercentCategories;
10372
+ if (!isMainCashbackAdded) {
10373
+ return allPercentCategories;
10374
+ }
10375
+ if (isMainCashbackAdded) {
10376
+ updatedCategories = updatedCategories.filter((_) => _.key !== MAIN_CASHBACK_KEY[calculatorType]);
10377
+ }
10378
+ return updatedCategories;
10379
+ };
10380
+
10381
+ const defaultDeleteImage = {
10382
+ src: 'IconDelete.svg',
10383
+ format: 'webp',
10384
+ alt: 'Иконка кнопки удаления блока кэшбека',
10385
+ };
10386
+ const CashbackCategory = JSX(({ categories, cashback, maxInputRange, deleteImage = defaultDeleteImage, isMainCashbackAdded = false, calculatorType = 'standard', onDelete, onChange, isShowDisclaimer = false, onChangeCategory = noop, }) => {
10387
+ const [currentCategory, setCurrentCategory] = useState(getRandomElement(categories));
10388
+ const isMainCashback = cashback.percent.key === MAIN_CASHBACK_KEY[calculatorType];
10389
+ const onChangePercent = createChangeHandler(cashback, 'percent', onChange);
10390
+ const onChangeSum = createChangeHandler(cashback, 'sum', onChange);
10391
+ const onChangeCashbackCategory = (value) => {
10392
+ setCurrentCategory(value);
10393
+ onChangeCategory((prev) => updateSelectedCategories(prev, cashback, value));
10394
+ };
10395
+ return (jsxs("div", { className: "w-full space-y-m", children: [jsxs("div", { className: "space-y-xs", children: [jsx(Paragraph, { size: "text-m", color: "text-primary-text", font: "font-light", children: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E" }), isShowDisclaimer ? (jsx(Text, { size: "text-s", color: "text-primary-text", font: "font-light", className: "italic", children: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438 \u043F\u043E\u043A\u0443\u043F\u043E\u043A \u0434\u043B\u044F \u0440\u0430\u0441\u0447\u0451\u0442\u0430 \u0431\u0430\u043B\u043B\u043E\u0432 \u043F\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435" })) : null, jsxs("div", { className: "flex gap-m", children: [jsx(Select, { className: "w-full", isManualInput: isMainCashback, placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E", options: getPercentCategories(isMainCashbackAdded, calculatorType), value: cashback.percent, onChange: onChangePercent }), jsx(Button, { version: "secondary", onClick: () => onDelete(cashback.id), shape: "round", className: "px-4 rounded-md", children: jsx(Img, { image: deleteImage }) })] })] }), categories?.length && !isMainCashback ? (jsx(Select, { label: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E \u043F\u043E\u043A\u0443\u043F\u043E\u043A", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E \u043F\u043E\u043A\u0443\u043F\u043E\u043A", options: categories, value: currentCategory, onChange: onChangeCashbackCategory })) : null, jsx(InputRange, { step: 500, title: "\u0421\u0443\u043C\u043C\u0430 \u043F\u043E\u043A\u0443\u043F\u043E\u043A \u0432 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438", min: 0, max: maxInputRange, value: cashback.sum, onChange: onChangeSum })] }));
10396
+ });
10397
+ const getRandomElement = (arr) => arr?.[new Date().getTime().toString().slice(-1)];
10398
+ const createChangeHandler = (obj, field, onChange) => (value) => {
10399
+ onChange({
10400
+ ...obj,
10401
+ [field]: value,
10402
+ });
10403
+ };
10404
+ const updateSelectedCategories = (prev, cashback, value) => {
10405
+ const newItem = { id: cashback.id, category: value };
10406
+ if (prev.length === 0) {
10407
+ return [newItem];
10408
+ }
10409
+ const index = prev.findIndex((item) => item.id === cashback.id);
10410
+ if (index !== -1) {
10411
+ const updated = [...prev];
10412
+ updated[index] = newItem;
10413
+ return updated;
10414
+ }
10415
+ return [...prev, newItem];
10416
+ };
10417
+
10418
+ const renderButtons = ({ cashbacksLength, onAddNewCashback, onResetCashback, calculatorType = 'standard', maxCategories = MAX_CATEGORIES[calculatorType], }) => {
10419
+ return (jsxs("div", { className: "w-full flex flex-col gap-lg", children: [cashbacksLength < maxCategories ? (jsx(Button, { className: "self-start text-primary-main", embedded: true, version: "secondary", onClick: onAddNewCashback, children: cashbacksLength ? 'Добавить ещё категорию' : 'Добавить категорию' })) : null, cashbacksLength > 2 ? (jsx(Button, { className: "self-start", version: "secondary", onClick: onResetCashback, children: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0432\u0441\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438" })) : null] }));
10420
+ };
10421
+
10422
+ const CashbackType = {
10423
+ standard: DEFAULT_STANDARD_CASHBACK,
10424
+ premium: DEFAULT_PREMIUM_CASHBACK,
10425
+ };
10426
+ const useCashbackCalculator = (calculatorType) => {
10344
10427
  const { data } = useLeadFormData('CASHBACK_CATEGORY');
10345
- const [cashbacks, setCashbacks] = useState(DEFAULT_CASHBACK);
10428
+ const [cashbacks, setCashbacks] = useState(CashbackType[calculatorType]);
10429
+ const [selectedCategories, setSelectedCategories] = useState([]);
10346
10430
  const categories = data?.map((_) => ({
10347
10431
  key: _.key || '',
10348
10432
  text: _.value,
10349
10433
  })) || [];
10434
+ const filteredCategories = useMemo(() => {
10435
+ const categoriesToRemove = selectedCategories.map((obj) => obj.category);
10436
+ const keysToRemove = new Set(categoriesToRemove.map((item) => item.key));
10437
+ return categories.filter((item) => !keysToRemove.has(item.key));
10438
+ }, [selectedCategories, categories]);
10350
10439
  const onAddNewCashback = () => setCashbacks((_) => [
10351
10440
  ..._,
10352
10441
  {
10353
- id: _[_.length - 1].id + 1,
10442
+ id: _ && _.length > 0 ? _[_.length - 1]?.id + 1 : 1,
10354
10443
  percent: {
10355
10444
  text: 'Категория 1,5%',
10356
10445
  key: '1.5',
@@ -10365,14 +10454,15 @@
10365
10454
  return _;
10366
10455
  }));
10367
10456
  const onDeleteCashback = (id) => setCashbacks((prev) => prev.filter((_) => _.id !== id));
10368
- const onResetCashback = () => setCashbacks(DEFAULT_CASHBACK);
10457
+ const onResetCashback = () => setCashbacks(CashbackType[calculatorType]);
10369
10458
  return {
10370
10459
  cashbacks,
10371
- categories,
10460
+ categories: filteredCategories,
10372
10461
  onAddNewCashback,
10373
10462
  onChangeCashback,
10374
10463
  onDeleteCashback,
10375
10464
  onResetCashback,
10465
+ onChangeCategory: setSelectedCategories,
10376
10466
  };
10377
10467
  };
10378
10468
 
@@ -10381,19 +10471,280 @@
10381
10471
  text: 'Оформить карту',
10382
10472
  target: '_self',
10383
10473
  };
10384
- const INCREASED_PERCENTS = ['5', '10', '15'];
10385
- const MAX_CATEGORIES = 5;
10386
- const INFO_BLOCK_HTML = `<p>Полученные баллы можно конвертировать в рубли и компенсировать покупки у партнеров. Подробнее в <a href='#docs'>документах</a></p>`;
10387
- const CashbackCalculator = JSX(({ maxInputRange = 300000, image, deleteImage, infoImage, className = '', button = defaultButton, ...rest }) => {
10388
- const { cashbacks, categories, onAddNewCashback, onChangeCashback, onDeleteCashback, onResetCashback, } = useCashbackCalculator();
10389
- const img = image?.src ? (jsx(Img, { image: image, className: "hidden w-full @xl:block", imageClassName: "justify-self-center" })) : null;
10390
- return (jsxs(BlockWrapper, { className: style('flex flex-col justify-center items-center gap-lg', className), defaultPadding: style('p-6xl'), ...rest, children: [jsx(Headline, { title: "\u041A\u0430\u043B\u044C\u043A\u0443\u043B\u044F\u0442\u043E\u0440 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0431\u0430\u043B\u043B\u043E\u0432", description: "\u041C\u043E\u0436\u043D\u043E \u0432\u044B\u0431\u0440\u0430\u0442\u044C \u043D\u0435 \u0431\u043E\u043B\u0435\u0435 5 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0439, \u043E\u0434\u043D\u0430 \u0438\u0437 \u043D\u0438\u0445 \u0438\u0437 \u043F\u043E\u0432\u044B\u0448\u0435\u043D\u043D\u043E\u0439 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438", headlineVersion: "XL", isEmbedded: true }), jsxs("div", { className: "flex flex-row items-start gap-lg", children: [jsxs("div", { className: "w-full flex flex-col justify-center items-center gap-lg", children: [cashbacks.map((_) => (jsx(CashbackCategory, { categories: categories, cashback: _, showIncreasedPercents: showIncreasedPercents(_, cashbacks), maxInputRange: maxInputRange, deleteImage: deleteImage, onDelete: onDeleteCashback, onChange: onChangeCashback }, String(_.id)))), renderButtons(cashbacks.length, onAddNewCashback, onResetCashback), jsx(CashbackCalculatorResult, { cashbacks: cashbacks }), jsx(InfoCard, { __html: INFO_BLOCK_HTML, image: infoImage }), jsx(LinkButton, { className: "w-full @lg:w-auto self-start", href: button.href, text: button.text, target: button.target, version: "primary" })] }), img] })] }));
10474
+ const CashbackCalculator = JSX(
10475
+ // eslint-disable-next-line max-lines-per-function
10476
+ ({ maxInputRange = 300000, maxCategories, calculatorType = 'standard', maxMonthCashback = MAX_MONTH_CASHBACK[calculatorType], button = defaultButton, className = '', ...rest }) => {
10477
+ const { cashbacks, categories, onAddNewCashback, onChangeCashback, onDeleteCashback, onResetCashback, onChangeCategory, } = useCashbackCalculator(calculatorType);
10478
+ const { deleteImage, infoImage, image } = rest;
10479
+ const [isMainCashbackAdded, setIsMainCashbackAdded] = useState(false);
10480
+ useEffect(() => {
10481
+ setIsMainCashbackAdded(Boolean(cashbacks.find((item) => item.percent.key === MAIN_CASHBACK_KEY[calculatorType])));
10482
+ }, [cashbacks]);
10483
+ return (jsx(BlockWrapper, { className: style('flex flex-col justify-center items-center gap-lg', className), defaultPadding: style('p-0'), ...rest, children: jsxs("div", { className: "flex flex-row items-start gap-lg mt-5", children: [jsxs("div", { className: "w-full flex flex-col justify-center items-center gap-lg", children: [cashbacks.length
10484
+ ? cashbacks.map((_, index) => (jsx(CashbackCategory, { categories: categories, cashback: _, maxInputRange: maxInputRange, deleteImage: deleteImage, onDelete: onDeleteCashback, onChange: onChangeCashback, isMainCashbackAdded: isMainCashbackAdded, calculatorType: calculatorType, isShowDisclaimer: index === 0, onChangeCategory: onChangeCategory }, String(_.id))))
10485
+ : renderNoCategoryText(), renderButtons({
10486
+ cashbacksLength: cashbacks.length,
10487
+ onAddNewCashback: onAddNewCashback,
10488
+ onResetCashback: onResetCashback,
10489
+ calculatorType: calculatorType,
10490
+ maxCategories,
10491
+ }), jsx(CashbackCalculatorResult, { cashbacks: cashbacks, maxMonthCashback: maxMonthCashback }), jsx(InfoCard, { __html: INFO_BLOCK_HTML, image: infoImage }), jsx(RichText, { __html: '* \u041F\u043E\u0434\u0440\u043E\u0431\u043D\u0435\u0435 \u043F\u043E \u0443\u0441\u043B\u043E\u0432\u0438\u044F\u043C \u0438 \u043D\u0430\u0447\u0438\u0441\u043B\u0435\u043D\u0438\u044F\u043C \u043C\u043E\u0436\u043D\u043E \u0443\u0437\u043D\u0430\u0442\u044C \u0432\u043E \u0432\u043A\u043B\u0430\u0434\u043A\u0435 <a href="#docs">\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u044B</a>' }), jsx(LinkButton, { className: "w-full @lg:w-auto self-start", href: button.href, text: button.text, target: button.target, version: "primary" })] }), renderImage(image)] }) }));
10492
+ });
10493
+ const renderNoCategoryText = () => (jsx(Text, { align: "text-left", className: "w-full", children: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F \u043D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D\u0430" }));
10494
+ const renderImage = (image = {}) => image?.src ? (jsx(Img, { image: image, className: "hidden w-full @xl:block", imageClassName: "justify-self-center" })) : null;
10495
+
10496
+ const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
10497
+
10498
+ const badgeBgStyleMap = {
10499
+ primary: 'bg-white/30',
10500
+ secondary: 'bg-main-divider',
10501
+ };
10502
+ const badgeTextColorStyleMap = {
10503
+ primary: { desktop: 'text-white', mobile: 'text-primary-text' },
10504
+ secondary: { desktop: 'text-secondary-text', mobile: 'text-secondary-text' },
10505
+ };
10506
+ const Badge = JSX(({ count, version = 'secondary' }) => {
10507
+ const isMobileMode = useMobileMode();
10508
+ const badgeBgStyle = isMobileMode ? 'bg-main-divider' : badgeBgStyleMap[version];
10509
+ const textStyle = badgeTextColorStyleMap[version][isMobileMode ? 'mobile' : 'desktop'];
10510
+ return (jsx("div", { className: style('w-6 h-6 rounded-full flex items-center justify-center', badgeBgStyle), role: "status", "aria-label": `Количество ${count} доступных программ и сервисов`, children: jsx(Text, { size: "text-xs", color: textStyle, children: count }) }));
10511
+ });
10512
+
10513
+ const getButtonClassNames = (isActive) => ({
10514
+ btn: `w-96 ${isActive ? 'p-m border-none bg-primary-main text-white' : 'p-s ease-in duration-300 bg-white'}`,
10515
+ text: isActive ? 'mb-xs text-xl' : 'mb-2xs text-l text-primary-text',
10516
+ desc: `font-light ${isActive ? 'text-l text-white' : 'text-m text-secondary-text'}`,
10517
+ icon: isActive ? '' : 'text-primary-main',
10518
+ iconVersion: (isActive ? 'white' : 'normal'),
10519
+ oldText: 'text-m text-center',
10520
+ oldDesc: 'text-m-light',
10521
+ });
10522
+ const renderTabItemInner = ({ text, description, icon, isActive, type, }) => {
10523
+ const buttonClassNames = getButtonClassNames(isActive);
10524
+ return (jsxs("div", { className: style('cursor-pointer text-left border-b-0 flex gap-2xs'), "aria-label": text, "aria-labelledby": `${text}-label`, children: [icon ? (jsx(Img, { className: style('h-6 w-6 min-w-6 min-h-6', buttonClassNames.icon), image: {
10525
+ ...icon,
10526
+ iconVersion: icon?.iconVersion ?? buttonClassNames.iconVersion,
10527
+ }, width: "24", height: "24", alt: text })) : null, jsxs("div", { className: "border-0", children: [jsx("div", { className: type === 'animated' ? buttonClassNames.text : buttonClassNames.oldText, children: text }), jsx("div", { className: type === 'animated' ? buttonClassNames.desc : buttonClassNames.oldDesc, children: description })] })] }));
10528
+ };
10529
+
10530
+ const tabPaddingStyleMap = {
10531
+ default: 'px-xs',
10532
+ underlined: 'px-m',
10533
+ animated: 'px-m border border-gray cursor-pointer text-left border-b-0 mt-auto flex gap-2xs',
10534
+ };
10535
+ const tabTextStyle = 'text-secondary-text hover:text-primary-main';
10536
+ const activeTabTextStyleMap = {
10537
+ default: 'text-white',
10538
+ underlined: 'text-primary-main border-b-2',
10539
+ animated: 'text-white sm:text-white',
10540
+ };
10541
+ const tabBgStyleMap = {
10542
+ default: 'bg-white',
10543
+ underlined: 'bg-white',
10544
+ animated: 'p-1 ease-in duration-300 bg-white text-primary-text h-[70px] w-96',
10545
+ };
10546
+ const activeTabBgStyleMap = {
10547
+ default: 'bg-primary-main',
10548
+ underlined: 'bg-white',
10549
+ animated: 'p-2 border-none bg-primary-main text-white h-20 w-96',
10550
+ };
10551
+ const TabItemInner = JSX(({ tag = 'div', item = {}, isActive = false, type = 'default', onClick }) => {
10552
+ const Tag = tag;
10553
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
10554
+ const { text, description, icon, count, tabName, ...link } = item;
10555
+ return (jsx(Tag, { className: style('h-12', 'block flex-1', 'cursor-pointer', 'rounded-none', tabPaddingStyleMap[type], isActive ? activeTabBgStyleMap[type] : tabBgStyleMap[type]), "aria-label": "\u0421\u043F\u0438\u0441\u043E\u043A \u0442\u0430\u0431\u043E\u0432", onClick: onClick, ...link, children: jsxs("div", { className: style('h-full', 'flex justify-center items-center', 'text-center whitespace-nowrap', isActive ? activeTabTextStyleMap[type] : tabTextStyle), role: "tab", "aria-label": `Таб ${text}`, children: [renderTabItemInner({
10556
+ text,
10557
+ description,
10558
+ icon,
10559
+ isActive,
10560
+ type,
10561
+ }), Number.isInteger(count) ? (jsx("div", { className: "ml-xs", role: "status", "aria-label": `Количество программ и сервисов ${count}`, children: jsx(Badge, { count: count, version: getVersion(isActive, type) }) })) : null] }) }));
10562
+ });
10563
+
10564
+ const TabItem = JSX((props) => props?.item?.href ? jsx(LinkTabItem, { ...props }) : jsx(ButtonTabItem, { ...props }));
10565
+ const LinkTabItem = JSX((props) => {
10566
+ const link = useLink();
10567
+ const handleClick = useCallback(() => {
10568
+ props.onClick && props.onClick(props.item || {});
10569
+ }, [props.onClick, props.item]);
10570
+ const { onClick, ...item } = link({ ...props.item, onClick: handleClick });
10571
+ return jsx(TabItemInner, { ...props, tag: "a", item: item, onClick: onClick });
10572
+ });
10573
+ // TODO: Update handlerDecorator (support buttons?)
10574
+ const ButtonTabItem = JSX(({ item = {}, onClick, ...rest }) => {
10575
+ const handleClick = useCallback((e) => {
10576
+ e.target.scrollIntoView({ block: 'nearest' });
10577
+ onClick?.(item);
10578
+ }, [onClick, item]);
10579
+ return jsx(TabItemInner, { item: item, onClick: handleClick, ...rest });
10391
10580
  });
10392
- const renderButtons = (cashbacksLength, onAddNewCashback, onResetCashback) => {
10393
- return (jsxs("div", { className: "w-full flex flex-col gap-lg", children: [cashbacksLength < MAX_CATEGORIES ? (jsx(Button, { className: "self-start text-primary-main", embedded: true, version: "secondary", onClick: onAddNewCashback, children: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0435\u0449\u0435" })) : null, cashbacksLength > 2 ? (jsx(Button, { className: "self-start", version: "secondary", onClick: onResetCashback, children: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0432\u0441\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438" })) : null] }));
10581
+
10582
+ const renderTab = (activeTab, onClick, type) => (tab, i) => (jsx(TabItem, { isActive: tab === activeTab, onClick: onClick, type: type, item: tab }, String(i)));
10583
+
10584
+ const scrollButtonStyle = 'hidden sm:flex absolute z-40';
10585
+ const scrollStyle = {
10586
+ default: {
10587
+ item: 'flex-1',
10588
+ gap: 0,
10589
+ buttonTop: 'top-0',
10590
+ },
10591
+ animated: {
10592
+ item: 'flex',
10593
+ gap: 8,
10594
+ buttonTop: 'top-5',
10595
+ },
10596
+ underlined: {
10597
+ item: '',
10598
+ gap: 0,
10599
+ buttonTop: 'top-0',
10600
+ },
10394
10601
  };
10395
- const showIncreasedPercents = (currentCashback, cashback) => INCREASED_PERCENTS.includes(currentCashback.percent.key) ||
10396
- !cashback.some((_) => INCREASED_PERCENTS.includes(_.percent.key));
10602
+ const ScrollableTabsControl = JSX(({ className, items = [], activeItem, onChange, tabsType = 'default' }) => {
10603
+ const [containerRef, scroll] = useSwipeListScroll({
10604
+ itemCount: items?.length || 0,
10605
+ });
10606
+ useEffect(() => scrollToSelected(containerRef.current, items, activeItem), []);
10607
+ return (jsxs("div", { className: style('relative overflow-x-auto no-scrollbar', className), children: [jsx(SwipeListContainer, { containerRef: containerRef, snapAlign: "snap-start", onVisibleIndicesChange: scroll.handleVisibleIndicesChange, itemClassName: scrollStyle[tabsType].item, gap: scrollStyle[tabsType].gap, children: items.map(renderTab(activeItem, onChange, tabsType)) }), scroll.canScrollLeft ? (jsx(ArrowLeftButton, { wcmsIgnore: true, className: style('left-6', scrollButtonStyle, scrollStyle[tabsType].buttonTop), onClick: scroll.scrollLeft })) : null, scroll.canScrollRight ? (jsx(ArrowRightButton, { wcmsIgnore: true, className: style('right-6', scrollButtonStyle, scrollStyle[tabsType].buttonTop), onClick: scroll.scrollRight })) : null] }));
10608
+ });
10609
+ const scrollToSelected = (container, items, activeItem) => {
10610
+ const selectedIndex = items.findIndex((_) => _ === activeItem);
10611
+ if (container && selectedIndex > 0) {
10612
+ container.scrollTo({
10613
+ left: container?.children[selectedIndex]?.offsetLeft,
10614
+ behavior: 'smooth',
10615
+ });
10616
+ }
10617
+ };
10618
+
10619
+ const tabsStyle = {
10620
+ default: {
10621
+ wrapper: '',
10622
+ component: '',
10623
+ },
10624
+ animated: {
10625
+ wrapper: 'border-b-8 border-primary-main bg-white',
10626
+ component: 'm-auto',
10627
+ },
10628
+ underlined: {
10629
+ wrapper: 'flex',
10630
+ component: 'm-auto',
10631
+ },
10632
+ };
10633
+ const renderTabsLayout = ({ className = '', tabsType = 'animated', ...props }) => tabsType ? (jsx("div", { className: style(tabsStyle[tabsType].wrapper, className), children: jsx(ScrollableTabsControl, { className: tabsStyle[tabsType].component, tabsType: tabsType, ...props }) })) : null;
10634
+
10635
+ const STICKY_STYLE = 'sticky top-1 z-20';
10636
+ const TabsLayout = UniBlock(
10637
+ // eslint-disable-next-line max-lines-per-function
10638
+ ({ className = '', tabs = [], block, tabsType, showCounter = false, isSticky = false, ...rest }) => {
10639
+ const id = getId(block || {});
10640
+ const router = useRouter();
10641
+ const isFrame = isIFrame();
10642
+ const isEveryLink = tabs.every((_) => _?.type === 'link');
10643
+ const query = new URLSearchParams(decodeURIComponent(globalThis?.location?.search || ''));
10644
+ const tabId = getTabId(id);
10645
+ const tabsCounted = showCounter
10646
+ ? tabs.map((_) => ({
10647
+ ..._,
10648
+ count: _?.type === 'group' ? block?.slots?.[_?.tabName ?? '']?.length ?? 0 : 0,
10649
+ }))
10650
+ : tabs;
10651
+ const defaultSelectedTabIndex = tabsCounted.findIndex((_) => Boolean(_?.selected));
10652
+ const defaultQueryTabIndex = tabsCounted.findIndex((_, i) => _.type === 'group' && (_?.tabName ?? String(i)) === tabId);
10653
+ const defaultTabIndex = tabId ? defaultQueryTabIndex : defaultSelectedTabIndex;
10654
+ const [activeTabIndex, setActiveTabIndex] = useState(getDefaultIndex(defaultTabIndex));
10655
+ const activeItem = tabsCounted[activeTabIndex];
10656
+ const slotName = getSlotName(tabsCounted[activeTabIndex], activeTabIndex);
10657
+ const updateUrlSearchTabParam = (_, i) => {
10658
+ if (_.text) {
10659
+ query.set(id, _?.tabName ?? String(i));
10660
+ }
10661
+ else {
10662
+ query.delete(id);
10663
+ }
10664
+ router.replace(`${router.pathname}?${query}`, { scroll: false });
10665
+ };
10666
+ const handleChange = useCallback((_) => {
10667
+ const index = tabsCounted.indexOf(_);
10668
+ const tab = tabsCounted[index];
10669
+ setActiveTabIndex(index);
10670
+ if (tab.type === 'group') {
10671
+ updateUrlSearchTabParam(_, index);
10672
+ }
10673
+ }, [tabsCounted]);
10674
+ return (jsxs(BlockWrapper, { className: style({ [STICKY_STYLE]: [isSticky, isEveryLink, !isFrame].every(Boolean) }, className), defaultPadding: "p-0", block: block, ...rest, children: [renderTabsLayout({
10675
+ className: style({
10676
+ 'pb-1': [block?.slots, tabsType === 'default'].every(Boolean),
10677
+ [STICKY_STYLE]: [isSticky, !isEveryLink, !isFrame].every(Boolean),
10678
+ }),
10679
+ items: getItems(tabs, tabsCounted),
10680
+ activeItem,
10681
+ tabsType,
10682
+ onChange: handleChange,
10683
+ }), jsx("div", { className: "space-y-px @5xl:space-y-0 @5xl:grid @5xl:grid-cols-12 @5xl:gap-2xs", children: Object.entries(block?.slots ?? {}).map(([key, value]) => renderBlocksList(value, {
10684
+ ...rest?.options,
10685
+ slotName,
10686
+ parent: block,
10687
+ extraProps: { className: key === slotName ? '' : 'hidden' },
10688
+ })) })] }));
10689
+ }, {
10690
+ slots: ({ tabs }) => tabs?.map(getSlotName)?.filter(Boolean) || [],
10691
+ });
10692
+ const getDefaultIndex = (index) => (index && index !== -1 ? index : 0);
10693
+ const getId = ({ __id, anchor }) => anchor ?? __id ?? 'tabs';
10694
+ const getItems = (tabs, tabsCounted) => (tabsCounted?.length ? tabsCounted : tabs);
10695
+ const getSlotName = (tab, index) => tab?.type === 'group' ? tab?.tabName || `Слот №${index + 1}` : '';
10696
+ const getTabId = (id) => decodeURIComponent(globalThis?.location?.search
10697
+ .replace('?', '')
10698
+ .replace('+', ' ')
10699
+ .split('&')
10700
+ .find((_) => _.split('=').find((param) => param === id))
10701
+ ?.split('=')?.[1] ?? '');
10702
+
10703
+ const CALCULATOR_TABS = [
10704
+ {
10705
+ type: 'group',
10706
+ description: 'с остатками на счетах до 2 999 999,99 руб*',
10707
+ text: 'Стандарт',
10708
+ tabName: 'standard',
10709
+ selected: true,
10710
+ },
10711
+ {
10712
+ type: 'group',
10713
+ description: 'с остатками на счетах от 3 000 000,00 руб*',
10714
+ text: 'Престиж',
10715
+ tabName: 'premium',
10716
+ selected: false,
10717
+ },
10718
+ ];
10719
+ const defaultInfoImage = {
10720
+ src: 'IconExchange.svg',
10721
+ format: 'webp',
10722
+ alt: 'Иконка информационного блока',
10723
+ };
10724
+ const CashbackCalculatorLayout = JSX(({ premiumCalculatorParams = {}, standardCalculatorParams = {}, image, deleteImage, infoImage = defaultInfoImage, button, className = '', options, title, description, subtitle, ...rest }) => {
10725
+ const calculatorProps = {
10726
+ button,
10727
+ deleteImage,
10728
+ infoImage,
10729
+ image,
10730
+ };
10731
+ const CalculatorStandardBlock = createCalculatorBlock('standard', calculatorProps, standardCalculatorParams);
10732
+ const CalculatorPremiumBlock = createCalculatorBlock('premium', calculatorProps, premiumCalculatorParams);
10733
+ const slots = {
10734
+ standard: [CalculatorStandardBlock],
10735
+ premium: [CalculatorPremiumBlock],
10736
+ };
10737
+ return (jsxs(BlockWrapper, { className: style('flex flex-col justify-center items-center gap-lg', className), defaultPadding: style('p-6xl'), ...rest, children: [jsx(Headline, { title: title, headlineVersion: "XL", isEmbedded: true }), jsx(RichText, { __html: description, className: "text-center" }), jsx(Paragraph, { children: subtitle }), jsx("div", { className: "container grid grid-cols-12", children: jsx(TabsLayout, { className: "col-span-12", tabsType: "animated", tabs: CALCULATOR_TABS, block: { slots }, options: options }) })] }));
10738
+ });
10739
+ const createCalculatorBlock = (calculatorType, calculatorProps, calculatorParams) => ({
10740
+ type: 'CashbackCalculator',
10741
+ content: {
10742
+ calculatorType: calculatorType,
10743
+ ...calculatorProps,
10744
+ ...calculatorParams,
10745
+ },
10746
+ style: ['col-span-12'],
10747
+ });
10397
10748
 
10398
10749
  const ContactsBlock = JSX(({ className, contacts, info, version = 'secondary', ...rest }) => (jsxs(BlockWrapper, { className: style('flex', className), defaultPadding: "p-6xl", version: version, ...rest, children: [info?.length ? renderBlocks(info) : null, contacts?.length ? renderBlocks(contacts) : null] })));
10399
10750
  const renderBlocks = (info) => (jsx("div", { className: "flex gap-5xl grow basis-0", children: info.map((column, i) => renderBlocksColumn({ column, i })) }));
@@ -13991,8 +14342,6 @@
13991
14342
  return (jsx("div", { children: filters.length > 0 ? (jsxs("div", { className: "space-y-s", children: [jsx(Text, { children: text }), jsx("div", { className: COMMON_FILTERS_STYLES, children: filters })] })) : null }));
13992
14343
  };
13993
14344
 
13994
- const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
13995
-
13996
14345
  const renderButtonsGroup = (data, activeButton, onButtonClick) => {
13997
14346
  const allButtonVersion = getVersion(activeButton === 'all');
13998
14347
  const businessButtonVersion = getVersion(activeButton === 'business');
@@ -14402,211 +14751,6 @@
14402
14751
 
14403
14752
  const StickyBottomMenu = JSX(() => (jsx("div", { className: "hidden", role: "none" })));
14404
14753
 
14405
- const badgeBgStyleMap = {
14406
- primary: 'bg-white/30',
14407
- secondary: 'bg-main-divider',
14408
- };
14409
- const badgeTextColorStyleMap = {
14410
- primary: { desktop: 'text-white', mobile: 'text-primary-text' },
14411
- secondary: { desktop: 'text-secondary-text', mobile: 'text-secondary-text' },
14412
- };
14413
- const Badge = JSX(({ count, version = 'secondary' }) => {
14414
- const isMobileMode = useMobileMode();
14415
- const badgeBgStyle = isMobileMode ? 'bg-main-divider' : badgeBgStyleMap[version];
14416
- const textStyle = badgeTextColorStyleMap[version][isMobileMode ? 'mobile' : 'desktop'];
14417
- return (jsx("div", { className: style('w-6 h-6 rounded-full flex items-center justify-center', badgeBgStyle), role: "status", "aria-label": `Количество ${count} доступных программ и сервисов`, children: jsx(Text, { size: "text-xs", color: textStyle, children: count }) }));
14418
- });
14419
-
14420
- const getButtonClassNames = (isActive) => ({
14421
- btn: `w-96 ${isActive ? 'p-m border-none bg-primary-main text-white' : 'p-s ease-in duration-300 bg-white'}`,
14422
- text: isActive ? 'mb-xs text-xl' : 'mb-2xs text-l text-primary-text',
14423
- desc: `font-light ${isActive ? 'text-l text-white' : 'text-m text-secondary-text'}`,
14424
- icon: isActive ? '' : 'text-primary-main',
14425
- iconVersion: (isActive ? 'white' : 'normal'),
14426
- oldText: 'text-m text-center',
14427
- oldDesc: 'text-m-light',
14428
- });
14429
- const renderTabItemInner = ({ text, description, icon, isActive, type, }) => {
14430
- const buttonClassNames = getButtonClassNames(isActive);
14431
- return (jsxs("div", { className: style('cursor-pointer text-left border-b-0 flex gap-2xs'), "aria-label": text, "aria-labelledby": `${text}-label`, children: [icon ? (jsx(Img, { className: style('h-6 w-6 min-w-6 min-h-6', buttonClassNames.icon), image: {
14432
- ...icon,
14433
- iconVersion: icon?.iconVersion ?? buttonClassNames.iconVersion,
14434
- }, width: "24", height: "24", alt: text })) : null, jsxs("div", { className: "border-0", children: [jsx("div", { className: type === 'animated' ? buttonClassNames.text : buttonClassNames.oldText, children: text }), jsx("div", { className: type === 'animated' ? buttonClassNames.desc : buttonClassNames.oldDesc, children: description })] })] }));
14435
- };
14436
-
14437
- const tabPaddingStyleMap = {
14438
- default: 'px-xs',
14439
- underlined: 'px-m',
14440
- animated: 'px-m border border-gray cursor-pointer text-left border-b-0 mt-auto flex gap-2xs',
14441
- };
14442
- const tabTextStyle = 'text-secondary-text hover:text-primary-main';
14443
- const activeTabTextStyleMap = {
14444
- default: 'text-white',
14445
- underlined: 'text-primary-main border-b-2',
14446
- animated: 'text-white sm:text-white',
14447
- };
14448
- const tabBgStyleMap = {
14449
- default: 'bg-white',
14450
- underlined: 'bg-white',
14451
- animated: 'p-1 ease-in duration-300 bg-white text-primary-text h-[70px] w-96',
14452
- };
14453
- const activeTabBgStyleMap = {
14454
- default: 'bg-primary-main',
14455
- underlined: 'bg-white',
14456
- animated: 'p-2 border-none bg-primary-main text-white h-20 w-96',
14457
- };
14458
- const TabItemInner = JSX(({ tag = 'div', item = {}, isActive = false, type = 'default', onClick }) => {
14459
- const Tag = tag;
14460
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
14461
- const { text, description, icon, count, tabName, ...link } = item;
14462
- return (jsx(Tag, { className: style('h-12', 'block flex-1', 'cursor-pointer', 'rounded-none', tabPaddingStyleMap[type], isActive ? activeTabBgStyleMap[type] : tabBgStyleMap[type]), "aria-label": "\u0421\u043F\u0438\u0441\u043E\u043A \u0442\u0430\u0431\u043E\u0432", onClick: onClick, ...link, children: jsxs("div", { className: style('h-full', 'flex justify-center items-center', 'text-center whitespace-nowrap', isActive ? activeTabTextStyleMap[type] : tabTextStyle), role: "tab", "aria-label": `Таб ${text}`, children: [renderTabItemInner({
14463
- text,
14464
- description,
14465
- icon,
14466
- isActive,
14467
- type,
14468
- }), Number.isInteger(count) ? (jsx("div", { className: "ml-xs", role: "status", "aria-label": `Количество программ и сервисов ${count}`, children: jsx(Badge, { count: count, version: getVersion(isActive, type) }) })) : null] }) }));
14469
- });
14470
-
14471
- const TabItem = JSX((props) => props?.item?.href ? jsx(LinkTabItem, { ...props }) : jsx(ButtonTabItem, { ...props }));
14472
- const LinkTabItem = JSX((props) => {
14473
- const link = useLink();
14474
- const handleClick = useCallback(() => {
14475
- props.onClick && props.onClick(props.item || {});
14476
- }, [props.onClick, props.item]);
14477
- const { onClick, ...item } = link({ ...props.item, onClick: handleClick });
14478
- return jsx(TabItemInner, { ...props, tag: "a", item: item, onClick: onClick });
14479
- });
14480
- // TODO: Update handlerDecorator (support buttons?)
14481
- const ButtonTabItem = JSX(({ item = {}, onClick, ...rest }) => {
14482
- const handleClick = useCallback((e) => {
14483
- e.target.scrollIntoView({ block: 'nearest' });
14484
- onClick?.(item);
14485
- }, [onClick, item]);
14486
- return jsx(TabItemInner, { item: item, onClick: handleClick, ...rest });
14487
- });
14488
-
14489
- const renderTab = (activeTab, onClick, type) => (tab, i) => (jsx(TabItem, { isActive: tab === activeTab, onClick: onClick, type: type, item: tab }, String(i)));
14490
-
14491
- const scrollButtonStyle = 'hidden sm:flex absolute z-40';
14492
- const scrollStyle = {
14493
- default: {
14494
- item: 'flex-1',
14495
- gap: 0,
14496
- buttonTop: 'top-0',
14497
- },
14498
- animated: {
14499
- item: 'flex',
14500
- gap: 8,
14501
- buttonTop: 'top-5',
14502
- },
14503
- underlined: {
14504
- item: '',
14505
- gap: 0,
14506
- buttonTop: 'top-0',
14507
- },
14508
- };
14509
- const ScrollableTabsControl = JSX(({ className, items = [], activeItem, onChange, tabsType = 'default' }) => {
14510
- const [containerRef, scroll] = useSwipeListScroll({
14511
- itemCount: items?.length || 0,
14512
- });
14513
- useEffect(() => scrollToSelected(containerRef.current, items, activeItem), []);
14514
- return (jsxs("div", { className: style('relative overflow-x-auto no-scrollbar', className), children: [jsx(SwipeListContainer, { containerRef: containerRef, snapAlign: "snap-start", onVisibleIndicesChange: scroll.handleVisibleIndicesChange, itemClassName: scrollStyle[tabsType].item, gap: scrollStyle[tabsType].gap, children: items.map(renderTab(activeItem, onChange, tabsType)) }), scroll.canScrollLeft ? (jsx(ArrowLeftButton, { wcmsIgnore: true, className: style('left-6', scrollButtonStyle, scrollStyle[tabsType].buttonTop), onClick: scroll.scrollLeft })) : null, scroll.canScrollRight ? (jsx(ArrowRightButton, { wcmsIgnore: true, className: style('right-6', scrollButtonStyle, scrollStyle[tabsType].buttonTop), onClick: scroll.scrollRight })) : null] }));
14515
- });
14516
- const scrollToSelected = (container, items, activeItem) => {
14517
- const selectedIndex = items.findIndex((_) => _ === activeItem);
14518
- if (container && selectedIndex > 0) {
14519
- container.scrollTo({
14520
- left: container?.children[selectedIndex]?.offsetLeft,
14521
- behavior: 'smooth',
14522
- });
14523
- }
14524
- };
14525
-
14526
- const tabsStyle = {
14527
- default: {
14528
- wrapper: '',
14529
- component: '',
14530
- },
14531
- animated: {
14532
- wrapper: 'border-b-8 border-primary-main bg-white',
14533
- component: 'm-auto',
14534
- },
14535
- underlined: {
14536
- wrapper: 'flex',
14537
- component: 'm-auto',
14538
- },
14539
- };
14540
- const renderTabsLayout = ({ className = '', tabsType = 'animated', ...props }) => tabsType ? (jsx("div", { className: style(tabsStyle[tabsType].wrapper, className), children: jsx(ScrollableTabsControl, { className: tabsStyle[tabsType].component, tabsType: tabsType, ...props }) })) : null;
14541
-
14542
- const STICKY_STYLE = 'sticky top-1 z-20';
14543
- const TabsLayout = UniBlock(
14544
- // eslint-disable-next-line max-lines-per-function
14545
- ({ className = '', tabs = [], block, tabsType, showCounter = false, isSticky = false, ...rest }) => {
14546
- const id = getId(block || {});
14547
- const router = useRouter();
14548
- const isFrame = isIFrame();
14549
- const isEveryLink = tabs.every((_) => _?.type === 'link');
14550
- const query = new URLSearchParams(decodeURIComponent(globalThis?.location?.search || ''));
14551
- const tabId = getTabId(id);
14552
- const tabsCounted = showCounter
14553
- ? tabs.map((_) => ({
14554
- ..._,
14555
- count: _?.type === 'group' ? block?.slots?.[_?.tabName ?? '']?.length ?? 0 : 0,
14556
- }))
14557
- : tabs;
14558
- const defaultSelectedTabIndex = tabsCounted.findIndex((_) => Boolean(_?.selected));
14559
- const defaultQueryTabIndex = tabsCounted.findIndex((_, i) => _.type === 'group' && (_?.tabName ?? String(i)) === tabId);
14560
- const defaultTabIndex = tabId ? defaultQueryTabIndex : defaultSelectedTabIndex;
14561
- const [activeTabIndex, setActiveTabIndex] = useState(getDefaultIndex(defaultTabIndex));
14562
- const activeItem = tabsCounted[activeTabIndex];
14563
- const slotName = getSlotName(tabsCounted[activeTabIndex], activeTabIndex);
14564
- const updateUrlSearchTabParam = (_, i) => {
14565
- if (_.text) {
14566
- query.set(id, _?.tabName ?? String(i));
14567
- }
14568
- else {
14569
- query.delete(id);
14570
- }
14571
- router.replace(`${router.pathname}?${query}`, { scroll: false });
14572
- };
14573
- const handleChange = useCallback((_) => {
14574
- const index = tabsCounted.indexOf(_);
14575
- const tab = tabsCounted[index];
14576
- setActiveTabIndex(index);
14577
- if (tab.type === 'group') {
14578
- updateUrlSearchTabParam(_, index);
14579
- }
14580
- }, [tabsCounted]);
14581
- return (jsxs(BlockWrapper, { className: style({ [STICKY_STYLE]: [isSticky, isEveryLink, !isFrame].every(Boolean) }, className), defaultPadding: "p-0", block: block, ...rest, children: [renderTabsLayout({
14582
- className: style({
14583
- 'pb-1': [block?.slots, tabsType === 'default'].every(Boolean),
14584
- [STICKY_STYLE]: [isSticky, !isEveryLink, !isFrame].every(Boolean),
14585
- }),
14586
- items: getItems(tabs, tabsCounted),
14587
- activeItem,
14588
- tabsType,
14589
- onChange: handleChange,
14590
- }), jsx("div", { className: "space-y-px @5xl:space-y-0 @5xl:grid @5xl:grid-cols-12 @5xl:gap-2xs", children: Object.entries(block?.slots ?? {}).map(([key, value]) => renderBlocksList(value, {
14591
- ...rest?.options,
14592
- slotName,
14593
- parent: block,
14594
- extraProps: { className: key === slotName ? '' : 'hidden' },
14595
- })) })] }));
14596
- }, {
14597
- slots: ({ tabs }) => tabs?.map(getSlotName)?.filter(Boolean) || [],
14598
- });
14599
- const getDefaultIndex = (index) => (index && index !== -1 ? index : 0);
14600
- const getId = ({ __id, anchor }) => anchor ?? __id ?? 'tabs';
14601
- const getItems = (tabs, tabsCounted) => (tabsCounted?.length ? tabsCounted : tabs);
14602
- const getSlotName = (tab, index) => tab?.type === 'group' ? tab?.tabName || `Слот №${index + 1}` : '';
14603
- const getTabId = (id) => decodeURIComponent(globalThis?.location?.search
14604
- .replace('?', '')
14605
- .replace('+', ' ')
14606
- .split('&')
14607
- .find((_) => _.split('=').find((param) => param === id))
14608
- ?.split('=')?.[1] ?? '');
14609
-
14610
14754
  const FIRST_CELL_STYLES = 'w-80 flex-shrink-0 sticky left-0 bg-white';
14611
14755
  const renderHeader = ({ title, icon }) => (jsxs("div", { className: style('flex gap-m items-center', FIRST_CELL_STYLES), role: "cell", children: [icon ? (jsx(Img, { className: "hidden lg:block max-w-6 shrink-0", image: icon, width: "24", height: "24" })) : null, title ? (jsx(Text, { size: "text-m", font: "font-light", color: "text-primary-text", children: title })) : null] }));
14612
14756
 
@@ -14727,20 +14871,21 @@
14727
14871
  RollupItem,
14728
14872
  StepsBlock,
14729
14873
  StickyBottomMenu,
14874
+ TextBlock,
14730
14875
  TabsLayout,
14731
14876
  TariffsTable,
14732
- TextBlock,
14733
14877
  VerticalLayout,
14734
14878
  Video,
14735
14879
  ApplicationLeadForm,
14736
14880
  CreditCardForm,
14737
14881
  CreditForm,
14738
14882
  DebitForm,
14739
- CashbackCalculator,
14740
14883
  CalculatorRko,
14741
14884
  RkoTariffCardsTable,
14742
14885
  RatesTable,
14743
14886
  ReferalForm,
14887
+ CashbackCalculator,
14888
+ CashbackCalculatorLayout,
14744
14889
  };
14745
14890
 
14746
14891
  const applyAspects = (aspects) => (ev) => {
@@ -14885,7 +15030,7 @@
14885
15030
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
14886
15031
  });
14887
15032
 
14888
- const packageVersion = "0.14.1068";
15033
+ const packageVersion = "0.14.1070";
14889
15034
 
14890
15035
  exports.Blocks = Blocks;
14891
15036
  exports.ContentPage = ContentPage;