@redneckz/wildless-cms-uni-blocks 0.14.53 → 0.14.55

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 (85) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +31 -22
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/Calculator/CalculatorContent.d.ts +38 -0
  5. package/bundle/components/Calculator/CreditCalculatorForm.d.ts +0 -1
  6. package/bundle/components/Calculator/getDefaultValues.d.ts +4 -0
  7. package/bundle/components/ProductBlock/ProductBlockContent.d.ts +1 -1
  8. package/dist/components/Calculator/BusinessDepositCalculatorForm.js +7 -6
  9. package/dist/components/Calculator/BusinessDepositCalculatorForm.js.map +1 -1
  10. package/dist/components/Calculator/CalculatorContent.d.ts +38 -0
  11. package/dist/components/Calculator/CreditCalculatorForm.d.ts +0 -1
  12. package/dist/components/Calculator/CreditCalculatorForm.js +9 -8
  13. package/dist/components/Calculator/CreditCalculatorForm.js.map +1 -1
  14. package/dist/components/Calculator/DepositCalculatorForm.js +6 -5
  15. package/dist/components/Calculator/DepositCalculatorForm.js.map +1 -1
  16. package/dist/components/Calculator/getDefaultValues.d.ts +4 -0
  17. package/dist/components/Calculator/getDefaultValues.js +20 -0
  18. package/dist/components/Calculator/getDefaultValues.js.map +1 -0
  19. package/dist/components/ProductBlock/ProductBlockContent.d.ts +1 -1
  20. package/dist/ui-kit/BaseProductTile/BaseProductTile.js +2 -2
  21. package/dist/ui-kit/BaseProductTile/BaseProductTile.js.map +1 -1
  22. package/lib/components/Calculator/BusinessDepositCalculatorForm.js +7 -6
  23. package/lib/components/Calculator/BusinessDepositCalculatorForm.js.map +1 -1
  24. package/lib/components/Calculator/CalculatorContent.d.ts +38 -0
  25. package/lib/components/Calculator/CreditCalculatorForm.d.ts +0 -1
  26. package/lib/components/Calculator/CreditCalculatorForm.js +9 -8
  27. package/lib/components/Calculator/CreditCalculatorForm.js.map +1 -1
  28. package/lib/components/Calculator/DepositCalculatorForm.js +6 -5
  29. package/lib/components/Calculator/DepositCalculatorForm.js.map +1 -1
  30. package/lib/components/Calculator/getDefaultValues.d.ts +4 -0
  31. package/lib/components/Calculator/getDefaultValues.js +15 -0
  32. package/lib/components/Calculator/getDefaultValues.js.map +1 -0
  33. package/lib/components/ProductBlock/ProductBlockContent.d.ts +1 -1
  34. package/lib/ui-kit/BaseProductTile/BaseProductTile.js +2 -2
  35. package/lib/ui-kit/BaseProductTile/BaseProductTile.js.map +1 -1
  36. package/mobile/bundle/bundle.umd.js +31 -22
  37. package/mobile/bundle/bundle.umd.min.js +1 -1
  38. package/mobile/bundle/components/Calculator/CalculatorContent.d.ts +38 -0
  39. package/mobile/bundle/components/Calculator/CreditCalculatorForm.d.ts +0 -1
  40. package/mobile/bundle/components/Calculator/getDefaultValues.d.ts +4 -0
  41. package/mobile/bundle/components/ProductBlock/ProductBlockContent.d.ts +1 -1
  42. package/mobile/dist/components/Calculator/BusinessDepositCalculatorForm.js +7 -6
  43. package/mobile/dist/components/Calculator/BusinessDepositCalculatorForm.js.map +1 -1
  44. package/mobile/dist/components/Calculator/CalculatorContent.d.ts +38 -0
  45. package/mobile/dist/components/Calculator/CreditCalculatorForm.d.ts +0 -1
  46. package/mobile/dist/components/Calculator/CreditCalculatorForm.js +9 -8
  47. package/mobile/dist/components/Calculator/CreditCalculatorForm.js.map +1 -1
  48. package/mobile/dist/components/Calculator/DepositCalculatorForm.js +6 -5
  49. package/mobile/dist/components/Calculator/DepositCalculatorForm.js.map +1 -1
  50. package/mobile/dist/components/Calculator/getDefaultValues.d.ts +4 -0
  51. package/mobile/dist/components/Calculator/getDefaultValues.js +20 -0
  52. package/mobile/dist/components/Calculator/getDefaultValues.js.map +1 -0
  53. package/mobile/dist/components/ProductBlock/ProductBlockContent.d.ts +1 -1
  54. package/mobile/dist/ui-kit/BaseProductTile/BaseProductTile.js +2 -2
  55. package/mobile/dist/ui-kit/BaseProductTile/BaseProductTile.js.map +1 -1
  56. package/mobile/lib/components/Calculator/BusinessDepositCalculatorForm.js +7 -6
  57. package/mobile/lib/components/Calculator/BusinessDepositCalculatorForm.js.map +1 -1
  58. package/mobile/lib/components/Calculator/CalculatorContent.d.ts +38 -0
  59. package/mobile/lib/components/Calculator/CreditCalculatorForm.d.ts +0 -1
  60. package/mobile/lib/components/Calculator/CreditCalculatorForm.js +9 -8
  61. package/mobile/lib/components/Calculator/CreditCalculatorForm.js.map +1 -1
  62. package/mobile/lib/components/Calculator/DepositCalculatorForm.js +6 -5
  63. package/mobile/lib/components/Calculator/DepositCalculatorForm.js.map +1 -1
  64. package/mobile/lib/components/Calculator/getDefaultValues.d.ts +4 -0
  65. package/mobile/lib/components/Calculator/getDefaultValues.js +15 -0
  66. package/mobile/lib/components/Calculator/getDefaultValues.js.map +1 -0
  67. package/mobile/lib/components/ProductBlock/ProductBlockContent.d.ts +1 -1
  68. package/mobile/lib/ui-kit/BaseProductTile/BaseProductTile.js +2 -2
  69. package/mobile/lib/ui-kit/BaseProductTile/BaseProductTile.js.map +1 -1
  70. package/mobile/src/components/Calculator/BusinessDepositCalculatorForm.tsx +15 -6
  71. package/mobile/src/components/Calculator/CalculatorContent.ts +42 -0
  72. package/mobile/src/components/Calculator/CreditCalculatorForm.tsx +9 -9
  73. package/mobile/src/components/Calculator/DepositCalculatorForm.tsx +6 -5
  74. package/mobile/src/components/Calculator/getDefaultValues.ts +28 -0
  75. package/mobile/src/components/ProductBlock/ProductBlockContent.ts +1 -1
  76. package/mobile/src/ui-kit/BaseProductTile/BaseProductTile.tsx +2 -0
  77. package/package.json +1 -1
  78. package/src/components/Calculator/BusinessDepositCalculatorForm.tsx +15 -6
  79. package/src/components/Calculator/Calculator.fixture.tsx +4 -0
  80. package/src/components/Calculator/CalculatorContent.ts +42 -0
  81. package/src/components/Calculator/CreditCalculatorForm.tsx +9 -9
  82. package/src/components/Calculator/DepositCalculatorForm.tsx +6 -5
  83. package/src/components/Calculator/getDefaultValues.ts +28 -0
  84. package/src/components/ProductBlock/ProductBlockContent.ts +1 -1
  85. package/src/ui-kit/BaseProductTile/BaseProductTile.tsx +2 -0
@@ -1910,6 +1910,15 @@
1910
1910
  : null, jsxs("div", { className: "flex flex-col gap-y-4xl @xl:w-96", children: [yearBonus >= 0 ? jsx(CalculatorValueBlock, { title: "\u0411\u0430\u043B\u043B\u043E\u0432 \u0437\u0430 \u0433\u043E\u0434", value: yearBonus }) : null, renderButtonsSection(buttons, { isVertical: true }), renderFootnote(footnote)] })] }));
1911
1911
  });
1912
1912
 
1913
+ const getMoneyDefaultValue = (defaultParams, defaultMoney = 0) => defaultParams?.sum && defaultParams.sum >= DEFAULT_MIN_SUM$1 && defaultParams.sum <= DEFAULT_MAX_SUM$1
1914
+ ? defaultParams.sum
1915
+ : defaultMoney;
1916
+ const getMonthsDefaultValue = (defaultParams, defaultMonth = 0) => defaultParams?.period &&
1917
+ defaultParams.period >= DEFAULT_MIN_MONTHS &&
1918
+ defaultParams.period <= DEFAULT_MAX_MONTHS
1919
+ ? defaultParams.period
1920
+ : defaultMonth;
1921
+
1913
1922
  const STEP_DAYS = 1;
1914
1923
  const renderDaysInput = (props) => (jsx(InputRange, { items: [`От ${daysText(props.min || 0)}`, `До ${daysText(props.max || 0)}`], step: STEP_DAYS, ...props }));
1915
1924
  const daysText = (days) => `${days} ${Number(days) % 10 === 1 ? 'дня' : 'дней'}`;
@@ -2019,13 +2028,13 @@
2019
2028
  }
2020
2029
  };
2021
2030
 
2022
- const BusinessDepositCalculatorForm = JSX(({ className = '', rateParams, buttons, footnote, bottomFootnote, isShowDepositeName }) => {
2031
+ const BusinessDepositCalculatorForm = JSX(({ className = '', rateParams, buttons, footnote, bottomFootnote, isShowDepositeName, defaultParams, }) => {
2023
2032
  const [userInputParams, { field }] = useForm({
2024
- moneyValue: BUSINESS_DEFAULT_SUM,
2025
- daysValue: BUSINESS_DEFAULT_DAYS,
2026
- isReplenished: false,
2027
- isPartialWithdrawal: false,
2028
- isMonthlyInterestPayment: false,
2033
+ moneyValue: getMoneyDefaultValue(defaultParams, BUSINESS_DEFAULT_SUM),
2034
+ daysValue: getMonthsDefaultValue(defaultParams, BUSINESS_DEFAULT_DAYS),
2035
+ isReplenished: Boolean(defaultParams?.isReplenished),
2036
+ isPartialWithdrawal: Boolean(defaultParams?.isPartialWithdrawal),
2037
+ isMonthlyInterestPayment: Boolean(defaultParams?.isMonthlyInterestPayment),
2029
2038
  });
2030
2039
  const calculatorParams = useBusinessDepositCalculatorParams(userInputParams, rateParams?.rateType && rateParams.sourceBookDir);
2031
2040
  const { income, finalSum, rate, isUnavailableByTerm, depositeName } = calculatorParams;
@@ -2165,15 +2174,15 @@
2165
2174
  }), [userInputParams, data]);
2166
2175
  };
2167
2176
 
2168
- const CreditCalculatorForm = JSX(({ className, sourceBookDir, buttons, footnote, paramsViewSettings }) => {
2177
+ const CreditCalculatorForm = JSX(({ className, sourceBookDir, buttons, footnote, paramsViewSettings, defaultParams }) => {
2169
2178
  const [userInputParams, { field }] = useForm({
2170
- isAnnuity: true,
2171
- isInsurance: true,
2172
- isSalaryClient: false,
2173
- isPensionClient: false,
2174
- isStateEmployee: false,
2175
- moneyValue: CREDIT_DEFAULT_SUM,
2176
- monthsValue: DEFAULT_MONTHS,
2179
+ moneyValue: getMoneyDefaultValue(defaultParams, CREDIT_DEFAULT_SUM),
2180
+ monthsValue: getMonthsDefaultValue(defaultParams, DEFAULT_MONTHS),
2181
+ isAnnuity: Boolean(defaultParams?.isAnnuity),
2182
+ isInsurance: Boolean(defaultParams?.isEnableInsurance),
2183
+ isSalaryClient: Boolean(defaultParams?.isEnableSalaryClient),
2184
+ isPensionClient: Boolean(defaultParams?.isEnablePensionClient),
2185
+ isStateEmployee: Boolean(defaultParams?.isEnableStateEmployee),
2177
2186
  });
2178
2187
  const calculatorParams = useCreditCalculatorParams(userInputParams, sourceBookDir, paramsViewSettings);
2179
2188
  const paymentTypeElement = renderPaymentType({
@@ -2263,12 +2272,12 @@
2263
2272
  const checkRowByParam = ({ row, userInputParams, paramKey, isExclude }) => isExclude || userInputParams[paramKey] === row[paramKey];
2264
2273
  const getMiddleMonth = (minMonths, maxMonths) => minMonths + Math.round((maxMonths - minMonths) / 2);
2265
2274
 
2266
- const DepositCalculatorForm = JSX(({ className, sourceBookDir, buttons, footnote, paramsViewSettings }) => {
2275
+ const DepositCalculatorForm = JSX(({ className, sourceBookDir, buttons, footnote, paramsViewSettings, defaultParams }) => {
2267
2276
  const [userInputParams, { field }] = useForm({
2268
- moneyValue: DEPOSIT_DEFAULT_SUM,
2269
- monthsValue: 0,
2270
- isMonthlyInterestPayment: false,
2271
- isRemoteRegistration: false,
2277
+ moneyValue: getMoneyDefaultValue(defaultParams, DEPOSIT_DEFAULT_SUM),
2278
+ monthsValue: getMonthsDefaultValue(defaultParams, 0),
2279
+ isMonthlyInterestPayment: Boolean(defaultParams?.isMonthlyInterestPayment),
2280
+ isRemoteRegistration: Boolean(defaultParams?.isRemoteRegistration),
2272
2281
  });
2273
2282
  const calculatorParams = useDepositCalculatorParams(userInputParams, sourceBookDir, paramsViewSettings);
2274
2283
  const { defaultMonth, rate, income, finalSum } = calculatorParams;
@@ -2974,11 +2983,11 @@
2974
2983
  const Tags = JSX(({ className, tags }) => tags?.length ? (jsx("div", { className: style('flex flex-wrap gap-xs', className), role: "list", children: tags.map(renderTag) })) : null);
2975
2984
  const renderTag = (tag, key) => (jsx("div", { className: "p-xs border-solid border rounded-md border-gray", role: "listitem", children: jsx(Text, { size: "text-m", font: "font-light", children: tag }) }, String(key)));
2976
2985
 
2977
- const BaseProductTile = JSX(({ className, padding, defaultPadding, title, description, headlineVersion = 'L', align = 'text-left', benefitsVersion, isTabularBenefits, benefits, __html, isFullWidthTitle, items, isDotted = true, priceList = [], listItemSize, tags = [], buttons, image, imageOptions: { imageAlign = 'center', directionRight = true, isImageAlwaysOnRight, isImageSecondary = false, } = {}, backwardButton, children, }) => {
2986
+ const BaseProductTile = JSX(({ className, padding, defaultPadding, title, description, headlineVersion = 'L', align = 'text-left', benefitsVersion, isTabularBenefits, benefits, __html, isFullWidthTitle, items, isDotted = true, priceList = [], listItemSize, tags = [], buttons, image, imageOptions: { imageAlign = 'center', directionRight = true, isImageAlwaysOnRight, isImageSecondary = false, } = {}, backwardButton, children, ...rest }) => {
2978
2987
  const img = image?.src ? jsx(Img, { image: image }) : null;
2979
2988
  const headline = renderHeadline({ title, description, headlineVersion, align });
2980
2989
  const filteredBenefits = benefits?.filter((_) => _?.type === 'rte' || 'label' in _ || 'description' in _);
2981
- return (jsx(BaseTile, { className: className, padding: padding, defaultPadding: defaultPadding, ...(isFullWidthTitle ? { title: headline } : { insetTitle: headline }), ...leftOrRightImage(img, directionRight), isImageSecondary: isImageSecondary, imageAlign: imageAlign, isImageAlwaysOnRight: isImageAlwaysOnRight, buttons: renderButtonsSection(buttons), backwardButton: backwardButton, children: jsxs("div", { className: "flex flex-col sm:gap-xl gap-4xl", children: [filteredBenefits?.length ? (jsx(BenefitsList, { benefitsVersion: benefitsVersion, isTabularBenefits: isTabularBenefits, benefits: filteredBenefits })) : null, __html ? jsx(RichText, { __html: __html }) : null, items?.length ? (jsx(List, { items: items, isDotted: isDotted, listItemSize: listItemSize })) : null, children, priceList?.length ? jsx(PriceList, { priceList: priceList }) : null, renderTags(tags)] }) }));
2990
+ return (jsx(BaseTile, { className: className, padding: padding, defaultPadding: defaultPadding, ...(isFullWidthTitle ? { title: headline } : { insetTitle: headline }), ...leftOrRightImage(img, directionRight), isImageSecondary: isImageSecondary, imageAlign: imageAlign, isImageAlwaysOnRight: isImageAlwaysOnRight, buttons: renderButtonsSection(buttons), backwardButton: backwardButton, ...rest, children: jsxs("div", { className: "flex flex-col sm:gap-xl gap-4xl", children: [filteredBenefits?.length ? (jsx(BenefitsList, { benefitsVersion: benefitsVersion, isTabularBenefits: isTabularBenefits, benefits: filteredBenefits })) : null, __html ? jsx(RichText, { __html: __html }) : null, items?.length ? (jsx(List, { items: items, isDotted: isDotted, listItemSize: listItemSize })) : null, children, priceList?.length ? jsx(PriceList, { priceList: priceList }) : null, renderTags(tags)] }) }));
2982
2991
  });
2983
2992
  const leftOrRightImage = (img, directionRight) => directionRight ? { rightImage: img } : { leftImage: img };
2984
2993
  const renderTags = (tags) => (tags?.length ? jsx(Tags, { tags: tags }) : null);
@@ -5798,7 +5807,7 @@
5798
5807
  return (jsx("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: jsx(LikeControl, { className: "rounded-tl-3xl sticky bottom-0 pointer-events-auto" }) }));
5799
5808
  }
5800
5809
 
5801
- const packageVersion = "0.14.52";
5810
+ const packageVersion = "0.14.54";
5802
5811
 
5803
5812
  exports.Blocks = Blocks;
5804
5813
  exports.ContentPage = ContentPage;