@redneckz/wildless-cms-uni-blocks 0.14.229 → 0.14.231
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.
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +44 -33
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/Calculator/BusinessDepositCalculatorForm.d.ts +0 -3
- package/bundle/components/Calculator/CalculatorContent.d.ts +27 -1
- package/bundle/components/Calculator/constants.d.ts +1 -1
- package/bundle/components/Calculator/{getBusinessDepositCalculatorParams.d.ts → useBusinessDepositCalculatorParams.d.ts} +2 -4
- package/bundle/components/Calculator/useBusinessDepositRates.d.ts +4 -0
- package/dist/components/Calculator/BusinessDepositCalculatorForm.d.ts +0 -3
- package/dist/components/Calculator/BusinessDepositCalculatorForm.js +3 -3
- package/dist/components/Calculator/BusinessDepositCalculatorForm.js.map +1 -1
- package/dist/components/Calculator/CalculatorContent.d.ts +27 -1
- package/dist/components/Calculator/constants.d.ts +1 -1
- package/dist/components/Calculator/{getBusinessDepositCalculatorParams.d.ts → useBusinessDepositCalculatorParams.d.ts} +2 -4
- package/dist/components/Calculator/{getBusinessDepositCalculatorParams.js → useBusinessDepositCalculatorParams.js} +8 -6
- package/dist/components/Calculator/useBusinessDepositCalculatorParams.js.map +1 -0
- package/dist/components/Calculator/useBusinessDepositRates.d.ts +4 -0
- package/dist/components/Calculator/useBusinessDepositRates.js +15 -0
- package/dist/components/Calculator/useBusinessDepositRates.js.map +1 -0
- package/lib/components/Calculator/BusinessDepositCalculatorForm.d.ts +0 -3
- package/lib/components/Calculator/BusinessDepositCalculatorForm.js +3 -3
- package/lib/components/Calculator/BusinessDepositCalculatorForm.js.map +1 -1
- package/lib/components/Calculator/CalculatorContent.d.ts +27 -1
- package/lib/components/Calculator/constants.d.ts +1 -1
- package/lib/components/Calculator/{getBusinessDepositCalculatorParams.d.ts → useBusinessDepositCalculatorParams.d.ts} +2 -4
- package/lib/components/Calculator/{getBusinessDepositCalculatorParams.js → useBusinessDepositCalculatorParams.js} +6 -4
- package/lib/components/Calculator/useBusinessDepositCalculatorParams.js.map +1 -0
- package/lib/components/Calculator/useBusinessDepositRates.d.ts +4 -0
- package/lib/components/Calculator/useBusinessDepositRates.js +12 -0
- package/lib/components/Calculator/useBusinessDepositRates.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +44 -33
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/Calculator/BusinessDepositCalculatorForm.d.ts +0 -3
- package/mobile/bundle/components/Calculator/CalculatorContent.d.ts +27 -1
- package/mobile/bundle/components/Calculator/constants.d.ts +1 -1
- package/mobile/bundle/components/Calculator/{getBusinessDepositCalculatorParams.d.ts → useBusinessDepositCalculatorParams.d.ts} +2 -4
- package/mobile/bundle/components/Calculator/useBusinessDepositRates.d.ts +4 -0
- package/mobile/dist/components/Calculator/BusinessDepositCalculatorForm.d.ts +0 -3
- package/mobile/dist/components/Calculator/BusinessDepositCalculatorForm.js +3 -3
- package/mobile/dist/components/Calculator/BusinessDepositCalculatorForm.js.map +1 -1
- package/mobile/dist/components/Calculator/CalculatorContent.d.ts +27 -1
- package/mobile/dist/components/Calculator/constants.d.ts +1 -1
- package/mobile/dist/components/Calculator/useBusinessDepositCalculatorParams.d.ts +25 -0
- package/mobile/dist/components/Calculator/{getBusinessDepositCalculatorParams.js → useBusinessDepositCalculatorParams.js} +8 -6
- package/mobile/dist/components/Calculator/useBusinessDepositCalculatorParams.js.map +1 -0
- package/mobile/dist/components/Calculator/useBusinessDepositRates.d.ts +4 -0
- package/mobile/dist/components/Calculator/useBusinessDepositRates.js +15 -0
- package/mobile/dist/components/Calculator/useBusinessDepositRates.js.map +1 -0
- package/mobile/lib/components/Calculator/BusinessDepositCalculatorForm.d.ts +0 -3
- package/mobile/lib/components/Calculator/BusinessDepositCalculatorForm.js +3 -3
- package/mobile/lib/components/Calculator/BusinessDepositCalculatorForm.js.map +1 -1
- package/mobile/lib/components/Calculator/CalculatorContent.d.ts +27 -1
- package/mobile/lib/components/Calculator/constants.d.ts +1 -1
- package/mobile/lib/components/Calculator/useBusinessDepositCalculatorParams.d.ts +25 -0
- package/mobile/lib/components/Calculator/{getBusinessDepositCalculatorParams.js → useBusinessDepositCalculatorParams.js} +6 -4
- package/mobile/lib/components/Calculator/useBusinessDepositCalculatorParams.js.map +1 -0
- package/mobile/lib/components/Calculator/useBusinessDepositRates.d.ts +4 -0
- package/mobile/lib/components/Calculator/useBusinessDepositRates.js +12 -0
- package/mobile/lib/components/Calculator/useBusinessDepositRates.js.map +1 -0
- package/mobile/src/components/Calculator/BusinessDepositCalculatorForm.tsx +7 -10
- package/mobile/src/components/Calculator/CalculatorContent.ts +31 -1
- package/mobile/src/components/Calculator/constants.ts +1 -1
- package/mobile/src/components/Calculator/{getBusinessDepositCalculatorParams.ts → useBusinessDepositCalculatorParams.ts} +8 -9
- package/mobile/src/components/Calculator/useBusinessDepositRates.ts +22 -0
- package/mobile/src/components/TabsLayout/TabsLayout.ui.json +1 -1
- package/package.json +1 -1
- package/src/components/Calculator/BusinessDepositCalculatorForm.tsx +7 -10
- package/src/components/Calculator/Calculator.fixture.tsx +2 -2
- package/src/components/Calculator/CalculatorContent.ts +31 -1
- package/src/components/Calculator/constants.ts +1 -1
- package/src/components/Calculator/{getBusinessDepositCalculatorParams.ts → useBusinessDepositCalculatorParams.ts} +8 -9
- package/src/components/Calculator/useBusinessDepositRates.ts +22 -0
- package/src/components/TabsLayout/TabsLayout.ui.json +1 -1
- package/dist/components/Calculator/getBusinessDepositCalculatorParams.js.map +0 -1
- package/lib/components/Calculator/getBusinessDepositCalculatorParams.js.map +0 -1
- package/mobile/dist/components/Calculator/getBusinessDepositCalculatorParams.d.ts +0 -27
- package/mobile/dist/components/Calculator/getBusinessDepositCalculatorParams.js.map +0 -1
- package/mobile/lib/components/Calculator/getBusinessDepositCalculatorParams.d.ts +0 -27
- package/mobile/lib/components/Calculator/getBusinessDepositCalculatorParams.js.map +0 -1
package/bundle/bundle.umd.js
CHANGED
|
@@ -2095,6 +2095,33 @@
|
|
|
2095
2095
|
|
|
2096
2096
|
const CalculatorFormLayout = JSX(({ className, inputChildren, rateChildren, resultChildren }) => (jsxs("section", { className: style('flex flex-col justify-between @5xl:flex-row gap-m', className), children: [jsx("div", { className: "flex flex-col gap-y-m sm:max-w-md gap-2xl", children: inputChildren }), jsx("div", { className: "border-b border-main-divider md:hidden" }), rateChildren, jsx("div", { className: "flex flex-col gap-2xl sm:w-96 max-w-full", children: resultChildren })] })));
|
|
2097
2097
|
|
|
2098
|
+
const getMoneyDefaultValue = (defaultParams, defaultMoney = 0) => defaultParams?.sum ? defaultParams.sum : defaultMoney;
|
|
2099
|
+
const getMonthsDefaultValue = (defaultParams, defaultMonth = 0) => defaultParams?.period &&
|
|
2100
|
+
defaultParams.period >= DEFAULT_MIN_MONTHS &&
|
|
2101
|
+
defaultParams.period <= DEFAULT_MAX_MONTHS
|
|
2102
|
+
? defaultParams.period
|
|
2103
|
+
: defaultMonth;
|
|
2104
|
+
|
|
2105
|
+
const STEP_DAYS = 1;
|
|
2106
|
+
const renderDaysInput = (props) => (jsx(InputRange, { items: [`От ${daysText(props.min || 0)}`, `До ${daysText(props.max || 0)}`], step: STEP_DAYS, ...props }));
|
|
2107
|
+
const daysText = (days) => `${days} ${Number(days) % 10 === 1 ? 'дня' : 'дней'}`;
|
|
2108
|
+
|
|
2109
|
+
const orientationStyleMap = {
|
|
2110
|
+
horizontal: 'gap-5xl',
|
|
2111
|
+
vertical: 'flex-col gap-s',
|
|
2112
|
+
};
|
|
2113
|
+
const RadioButtonGroup = JSX(({ items, checkedItem, className, onChange: onChangeCheckedItem, orientation = 'horizontal', }) => (jsx("div", { className: style(`flex ${orientationStyleMap[orientation]}`, className), role: "radiogroup", children: items?.map(({ id, text }) => (jsx(Checkbox, { isRadio: true, text: text, value: checkedItem === id, onChange: () => onChangeCheckedItem && onChangeCheckedItem(id) }, String(id)))) })));
|
|
2114
|
+
|
|
2115
|
+
const renderBinaryRadioButtonGroup = ({ items, title, mobileTitle = title, orientation = 'horizontal', value, radioGroupClassName, onChange, }) => (jsxs("div", { className: "space-y-s", children: [title ? (jsx("div", { className: "hidden @5xl:block", children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: title }) })) : null, mobileTitle ? (jsx("div", { className: "@5xl:hidden", children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: mobileTitle }) })) : null, jsx(RadioButtonGroup, { orientation: orientation, items: items, checkedItem: items[value ? 0 : 1].id, className: style('flex-col sm:flex-row', radioGroupClassName), onChange: (_) => onChange && onChange(_ === items[0].id) })] }));
|
|
2116
|
+
|
|
2117
|
+
const renderInterestPayment = (props) => renderBinaryRadioButtonGroup({
|
|
2118
|
+
...props,
|
|
2119
|
+
items: [
|
|
2120
|
+
{ id: 'everyMonth', text: 'Ежемесячно' },
|
|
2121
|
+
{ id: 'atEndTerm', text: 'В конце срока' },
|
|
2122
|
+
],
|
|
2123
|
+
});
|
|
2124
|
+
|
|
2098
2125
|
const defaultDiscriminator = (_) => _;
|
|
2099
2126
|
const maxBy = (discriminator = defaultDiscriminator) => (list) => list.reduceRight((a, b) => (discriminator(a) > discriminator(b) ? a : b));
|
|
2100
2127
|
const max = maxBy();
|
|
@@ -2118,10 +2145,21 @@
|
|
|
2118
2145
|
});
|
|
2119
2146
|
const checkRangeByKeys = (value, [minKey, maxKey], sourceBookRow) => value >= sourceBookRow[minKey] && value <= sourceBookRow[maxKey];
|
|
2120
2147
|
|
|
2121
|
-
const
|
|
2148
|
+
const DEPOSIT_RATES_SERVICE_MAP = {
|
|
2149
|
+
UL: 'businessdepositrates',
|
|
2150
|
+
IP: 'selfemployeddepositrates',
|
|
2151
|
+
};
|
|
2152
|
+
function useBusinessDepositRates(rateParams) {
|
|
2153
|
+
const serviceName = rateParams?.rateType ? DEPOSIT_RATES_SERVICE_MAP[rateParams?.rateType] : '';
|
|
2154
|
+
const { data } = useAsyncData(serviceName ? `/api/v1/depositrates/${serviceName}` : null, fetchJSONUnsafe);
|
|
2155
|
+
return Array.isArray(data) ? data : [];
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
const useBusinessDepositCalculatorParams = (userInputParams, rateParams) => {
|
|
2122
2159
|
const { daysValue, moneyValue, isPartialWithdrawal, isReplenished, isMonthlyInterestPayment } = userInputParams;
|
|
2123
2160
|
const isOperatingDeposit = isReplenished || isPartialWithdrawal;
|
|
2124
2161
|
const isDisabledOperatingDeposit = daysValue < BUSINESS_OPERATING_MIN_DAYS || daysValue > BUSINESS_OPERATING_MAX_DAYS;
|
|
2162
|
+
const rateRows = useBusinessDepositRates(rateParams);
|
|
2125
2163
|
if (daysValue <= BUSINESS_RATE_MIN_DAYS) {
|
|
2126
2164
|
return {
|
|
2127
2165
|
...DEFAULT_BUSINESS_DEPOSIT_CALCULATOR_PARAMS,
|
|
@@ -2130,7 +2168,7 @@
|
|
|
2130
2168
|
isUnavailableByTerm: true,
|
|
2131
2169
|
};
|
|
2132
2170
|
}
|
|
2133
|
-
const businessDepositCalculatorSourceBookParams =
|
|
2171
|
+
const businessDepositCalculatorSourceBookParams = rateRows?.find((_) => {
|
|
2134
2172
|
return (isMonthlyInterestPayment === _.isMonthlyInterestPayment &&
|
|
2135
2173
|
checkIsOperatingDeposit(isOperatingDeposit, _) &&
|
|
2136
2174
|
checkRangeByKeys(moneyValue, ['minSum', 'maxSum'], _) &&
|
|
@@ -2139,7 +2177,7 @@
|
|
|
2139
2177
|
const { rate } = businessDepositCalculatorSourceBookParams;
|
|
2140
2178
|
const income = getDepositIncome$1(rate, userInputParams);
|
|
2141
2179
|
const finalSum = moneyValue + income;
|
|
2142
|
-
const sourceBookRows =
|
|
2180
|
+
const sourceBookRows = rateRows || [DEFAULT_BUSINESS_DEPOSIT_CALCULATOR_PARAMS];
|
|
2143
2181
|
return {
|
|
2144
2182
|
...businessDepositCalculatorSourceBookParams,
|
|
2145
2183
|
...getRangeByKeys(['minSum', 'maxSum'], sourceBookRows),
|
|
@@ -2166,34 +2204,7 @@
|
|
|
2166
2204
|
}
|
|
2167
2205
|
};
|
|
2168
2206
|
|
|
2169
|
-
const
|
|
2170
|
-
const getMonthsDefaultValue = (defaultParams, defaultMonth = 0) => defaultParams?.period &&
|
|
2171
|
-
defaultParams.period >= DEFAULT_MIN_MONTHS &&
|
|
2172
|
-
defaultParams.period <= DEFAULT_MAX_MONTHS
|
|
2173
|
-
? defaultParams.period
|
|
2174
|
-
: defaultMonth;
|
|
2175
|
-
|
|
2176
|
-
const STEP_DAYS = 1;
|
|
2177
|
-
const renderDaysInput = (props) => (jsx(InputRange, { items: [`От ${daysText(props.min || 0)}`, `До ${daysText(props.max || 0)}`], step: STEP_DAYS, ...props }));
|
|
2178
|
-
const daysText = (days) => `${days} ${Number(days) % 10 === 1 ? 'дня' : 'дней'}`;
|
|
2179
|
-
|
|
2180
|
-
const orientationStyleMap = {
|
|
2181
|
-
horizontal: 'gap-5xl',
|
|
2182
|
-
vertical: 'flex-col gap-s',
|
|
2183
|
-
};
|
|
2184
|
-
const RadioButtonGroup = JSX(({ items, checkedItem, className, onChange: onChangeCheckedItem, orientation = 'horizontal', }) => (jsx("div", { className: style(`flex ${orientationStyleMap[orientation]}`, className), role: "radiogroup", children: items?.map(({ id, text }) => (jsx(Checkbox, { isRadio: true, text: text, value: checkedItem === id, onChange: () => onChangeCheckedItem && onChangeCheckedItem(id) }, String(id)))) })));
|
|
2185
|
-
|
|
2186
|
-
const renderBinaryRadioButtonGroup = ({ items, title, mobileTitle = title, orientation = 'horizontal', value, radioGroupClassName, onChange, }) => (jsxs("div", { className: "space-y-s", children: [title ? (jsx("div", { className: "hidden @5xl:block", children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: title }) })) : null, mobileTitle ? (jsx("div", { className: "@5xl:hidden", children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: mobileTitle }) })) : null, jsx(RadioButtonGroup, { orientation: orientation, items: items, checkedItem: items[value ? 0 : 1].id, className: style('flex-col sm:flex-row', radioGroupClassName), onChange: (_) => onChange && onChange(_ === items[0].id) })] }));
|
|
2187
|
-
|
|
2188
|
-
const renderInterestPayment = (props) => renderBinaryRadioButtonGroup({
|
|
2189
|
-
...props,
|
|
2190
|
-
items: [
|
|
2191
|
-
{ id: 'everyMonth', text: 'Ежемесячно' },
|
|
2192
|
-
{ id: 'atEndTerm', text: 'В конце срока' },
|
|
2193
|
-
],
|
|
2194
|
-
});
|
|
2195
|
-
|
|
2196
|
-
const BusinessDepositCalculatorForm = JSX(({ className = '', buttons, footnote, bottomFootnote, isShowDepositeName, defaultParams, calcSource, }) => {
|
|
2207
|
+
const BusinessDepositCalculatorForm = JSX(({ className = '', buttons, footnote, bottomFootnote, isShowDepositeName, defaultParams, rateParams, }) => {
|
|
2197
2208
|
const [userInputParams, { field }] = useForm({
|
|
2198
2209
|
moneyValue: getMoneyDefaultValue(defaultParams, BUSINESS_DEFAULT_SUM),
|
|
2199
2210
|
daysValue: getMonthsDefaultValue(defaultParams, BUSINESS_DEFAULT_DAYS),
|
|
@@ -2201,7 +2212,7 @@
|
|
|
2201
2212
|
isPartialWithdrawal: Boolean(defaultParams?.isPartialWithdrawal),
|
|
2202
2213
|
isMonthlyInterestPayment: Boolean(defaultParams?.isMonthlyInterestPayment),
|
|
2203
2214
|
});
|
|
2204
|
-
const calculatorParams =
|
|
2215
|
+
const calculatorParams = useBusinessDepositCalculatorParams(userInputParams, rateParams);
|
|
2205
2216
|
const { income, finalSum, rate, isUnavailableByTerm, depositeName } = calculatorParams;
|
|
2206
2217
|
return (jsx(CalculatorFormLayout, { className: className, inputChildren: jsxs("div", { children: [renderWantedSumInput({
|
|
2207
2218
|
title: 'Сумма, ₽',
|
|
@@ -5994,7 +6005,7 @@
|
|
|
5994
6005
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
5995
6006
|
});
|
|
5996
6007
|
|
|
5997
|
-
const packageVersion = "0.14.
|
|
6008
|
+
const packageVersion = "0.14.230";
|
|
5998
6009
|
|
|
5999
6010
|
exports.Blocks = Blocks;
|
|
6000
6011
|
exports.ContentPage = ContentPage;
|