@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.
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +31 -22
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/Calculator/CalculatorContent.d.ts +38 -0
- package/bundle/components/Calculator/CreditCalculatorForm.d.ts +0 -1
- package/bundle/components/Calculator/getDefaultValues.d.ts +4 -0
- package/bundle/components/ProductBlock/ProductBlockContent.d.ts +1 -1
- package/dist/components/Calculator/BusinessDepositCalculatorForm.js +7 -6
- package/dist/components/Calculator/BusinessDepositCalculatorForm.js.map +1 -1
- package/dist/components/Calculator/CalculatorContent.d.ts +38 -0
- package/dist/components/Calculator/CreditCalculatorForm.d.ts +0 -1
- package/dist/components/Calculator/CreditCalculatorForm.js +9 -8
- package/dist/components/Calculator/CreditCalculatorForm.js.map +1 -1
- package/dist/components/Calculator/DepositCalculatorForm.js +6 -5
- package/dist/components/Calculator/DepositCalculatorForm.js.map +1 -1
- package/dist/components/Calculator/getDefaultValues.d.ts +4 -0
- package/dist/components/Calculator/getDefaultValues.js +20 -0
- package/dist/components/Calculator/getDefaultValues.js.map +1 -0
- package/dist/components/ProductBlock/ProductBlockContent.d.ts +1 -1
- package/dist/ui-kit/BaseProductTile/BaseProductTile.js +2 -2
- package/dist/ui-kit/BaseProductTile/BaseProductTile.js.map +1 -1
- package/lib/components/Calculator/BusinessDepositCalculatorForm.js +7 -6
- package/lib/components/Calculator/BusinessDepositCalculatorForm.js.map +1 -1
- package/lib/components/Calculator/CalculatorContent.d.ts +38 -0
- package/lib/components/Calculator/CreditCalculatorForm.d.ts +0 -1
- package/lib/components/Calculator/CreditCalculatorForm.js +9 -8
- package/lib/components/Calculator/CreditCalculatorForm.js.map +1 -1
- package/lib/components/Calculator/DepositCalculatorForm.js +6 -5
- package/lib/components/Calculator/DepositCalculatorForm.js.map +1 -1
- package/lib/components/Calculator/getDefaultValues.d.ts +4 -0
- package/lib/components/Calculator/getDefaultValues.js +15 -0
- package/lib/components/Calculator/getDefaultValues.js.map +1 -0
- package/lib/components/ProductBlock/ProductBlockContent.d.ts +1 -1
- package/lib/ui-kit/BaseProductTile/BaseProductTile.js +2 -2
- package/lib/ui-kit/BaseProductTile/BaseProductTile.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +31 -22
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/Calculator/CalculatorContent.d.ts +38 -0
- package/mobile/bundle/components/Calculator/CreditCalculatorForm.d.ts +0 -1
- package/mobile/bundle/components/Calculator/getDefaultValues.d.ts +4 -0
- package/mobile/bundle/components/ProductBlock/ProductBlockContent.d.ts +1 -1
- package/mobile/dist/components/Calculator/BusinessDepositCalculatorForm.js +7 -6
- package/mobile/dist/components/Calculator/BusinessDepositCalculatorForm.js.map +1 -1
- package/mobile/dist/components/Calculator/CalculatorContent.d.ts +38 -0
- package/mobile/dist/components/Calculator/CreditCalculatorForm.d.ts +0 -1
- package/mobile/dist/components/Calculator/CreditCalculatorForm.js +9 -8
- package/mobile/dist/components/Calculator/CreditCalculatorForm.js.map +1 -1
- package/mobile/dist/components/Calculator/DepositCalculatorForm.js +6 -5
- package/mobile/dist/components/Calculator/DepositCalculatorForm.js.map +1 -1
- package/mobile/dist/components/Calculator/getDefaultValues.d.ts +4 -0
- package/mobile/dist/components/Calculator/getDefaultValues.js +20 -0
- package/mobile/dist/components/Calculator/getDefaultValues.js.map +1 -0
- package/mobile/dist/components/ProductBlock/ProductBlockContent.d.ts +1 -1
- package/mobile/dist/ui-kit/BaseProductTile/BaseProductTile.js +2 -2
- package/mobile/dist/ui-kit/BaseProductTile/BaseProductTile.js.map +1 -1
- package/mobile/lib/components/Calculator/BusinessDepositCalculatorForm.js +7 -6
- package/mobile/lib/components/Calculator/BusinessDepositCalculatorForm.js.map +1 -1
- package/mobile/lib/components/Calculator/CalculatorContent.d.ts +38 -0
- package/mobile/lib/components/Calculator/CreditCalculatorForm.d.ts +0 -1
- package/mobile/lib/components/Calculator/CreditCalculatorForm.js +9 -8
- package/mobile/lib/components/Calculator/CreditCalculatorForm.js.map +1 -1
- package/mobile/lib/components/Calculator/DepositCalculatorForm.js +6 -5
- package/mobile/lib/components/Calculator/DepositCalculatorForm.js.map +1 -1
- package/mobile/lib/components/Calculator/getDefaultValues.d.ts +4 -0
- package/mobile/lib/components/Calculator/getDefaultValues.js +15 -0
- package/mobile/lib/components/Calculator/getDefaultValues.js.map +1 -0
- package/mobile/lib/components/ProductBlock/ProductBlockContent.d.ts +1 -1
- package/mobile/lib/ui-kit/BaseProductTile/BaseProductTile.js +2 -2
- package/mobile/lib/ui-kit/BaseProductTile/BaseProductTile.js.map +1 -1
- package/mobile/src/components/Calculator/BusinessDepositCalculatorForm.tsx +15 -6
- package/mobile/src/components/Calculator/CalculatorContent.ts +42 -0
- package/mobile/src/components/Calculator/CreditCalculatorForm.tsx +9 -9
- package/mobile/src/components/Calculator/DepositCalculatorForm.tsx +6 -5
- package/mobile/src/components/Calculator/getDefaultValues.ts +28 -0
- package/mobile/src/components/ProductBlock/ProductBlockContent.ts +1 -1
- package/mobile/src/ui-kit/BaseProductTile/BaseProductTile.tsx +2 -0
- package/package.json +1 -1
- package/src/components/Calculator/BusinessDepositCalculatorForm.tsx +15 -6
- package/src/components/Calculator/Calculator.fixture.tsx +4 -0
- package/src/components/Calculator/CalculatorContent.ts +42 -0
- package/src/components/Calculator/CreditCalculatorForm.tsx +9 -9
- package/src/components/Calculator/DepositCalculatorForm.tsx +6 -5
- package/src/components/Calculator/getDefaultValues.ts +28 -0
- package/src/components/ProductBlock/ProductBlockContent.ts +1 -1
- package/src/ui-kit/BaseProductTile/BaseProductTile.tsx +2 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BUSINESS_MAX_DAYS, BUSINESS_MIN_DAYS, DEFAULT_MAX_MONTHS, DEFAULT_MAX_SUM, DEFAULT_MIN_MONTHS, DEFAULT_MIN_SUM, } from './constants.js';
|
|
2
|
+
export const getMoneyDefaultValue = (defaultParams, defaultMoney = 0) => defaultParams?.sum && defaultParams.sum >= DEFAULT_MIN_SUM && defaultParams.sum <= DEFAULT_MAX_SUM
|
|
3
|
+
? defaultParams.sum
|
|
4
|
+
: defaultMoney;
|
|
5
|
+
export const getMonthsDefaultValue = (defaultParams, defaultMonth = 0) => defaultParams?.period &&
|
|
6
|
+
defaultParams.period >= DEFAULT_MIN_MONTHS &&
|
|
7
|
+
defaultParams.period <= DEFAULT_MAX_MONTHS
|
|
8
|
+
? defaultParams.period
|
|
9
|
+
: defaultMonth;
|
|
10
|
+
export const getDaysDefaultValue = (defaultParams, defaultDays = 0) => defaultParams?.period &&
|
|
11
|
+
defaultParams.period >= BUSINESS_MIN_DAYS &&
|
|
12
|
+
defaultParams.period <= BUSINESS_MAX_DAYS
|
|
13
|
+
? defaultParams.period
|
|
14
|
+
: defaultDays;
|
|
15
|
+
//# sourceMappingURL=getDefaultValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDefaultValues.js","sourceRoot":"","sources":["../../../src/components/Calculator/getDefaultValues.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,aAAmC,EAAE,YAAY,GAAG,CAAC,EAAE,EAAE,CAC5F,aAAa,EAAE,GAAG,IAAI,aAAa,CAAC,GAAG,IAAI,eAAe,IAAI,aAAa,CAAC,GAAG,IAAI,eAAe;IAChG,CAAC,CAAC,aAAa,CAAC,GAAG;IACnB,CAAC,CAAC,YAAY,CAAC;AAEnB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,aAAmC,EAAE,YAAY,GAAG,CAAC,EAAE,EAAE,CAC7F,aAAa,EAAE,MAAM;IACrB,aAAa,CAAC,MAAM,IAAI,kBAAkB;IAC1C,aAAa,CAAC,MAAM,IAAI,kBAAkB;IACxC,CAAC,CAAC,aAAa,CAAC,MAAM;IACtB,CAAC,CAAC,YAAY,CAAC;AAEnB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,aAAmC,EAAE,WAAW,GAAG,CAAC,EAAE,EAAE,CAC1F,aAAa,EAAE,MAAM;IACrB,aAAa,CAAC,MAAM,IAAI,iBAAiB;IACzC,aAAa,CAAC,MAAM,IAAI,iBAAiB;IACvC,CAAC,CAAC,aAAa,CAAC,MAAM;IACtB,CAAC,CAAC,WAAW,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { type BaseProductTileContent } from '../../ui-kit/BaseProductTile/BasePr
|
|
|
4
4
|
* @title Продуктовый блок
|
|
5
5
|
*/
|
|
6
6
|
export declare type ProductBlockContent = UniBlockContent & BaseProductTileContent & {
|
|
7
|
-
/** @title Отображать кнопку возврата
|
|
7
|
+
/** @title Отображать кнопку возврата */
|
|
8
8
|
backwardButton?: boolean;
|
|
9
9
|
/** @title Показывать рамку вокруг блока */
|
|
10
10
|
showBorder?: boolean;
|
|
@@ -9,11 +9,11 @@ import { List } from '../List/List.js';
|
|
|
9
9
|
import { PriceList } from '../PriceList/PriceList.js';
|
|
10
10
|
import { RichText } from '../RichText/RichText.js';
|
|
11
11
|
import { Tags } from '../Tags/Tags.js';
|
|
12
|
-
export 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, }) => {
|
|
12
|
+
export 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 }) => {
|
|
13
13
|
const img = image?.src ? _jsx(Img, { image: image }) : null;
|
|
14
14
|
const headline = renderHeadline({ title, description, headlineVersion, align });
|
|
15
15
|
const filteredBenefits = benefits?.filter((_) => _?.type === 'rte' || 'label' in _ || 'description' in _);
|
|
16
|
-
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)] }) }));
|
|
16
|
+
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)] }) }));
|
|
17
17
|
});
|
|
18
18
|
export const leftOrRightImage = (img, directionRight) => directionRight ? { rightImage: img } : { leftImage: img };
|
|
19
19
|
const renderTags = (tags) => (tags?.length ? _jsx(Tags, { tags: tags }) : null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseProductTile.js","sourceRoot":"","sources":["../../../src/ui-kit/BaseProductTile/BaseProductTile.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAI9D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAQpC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAChC,CAAC,EACC,SAAS,EACT,OAAO,EACP,cAAc,EACd,KAAK,EACL,WAAW,EACX,eAAe,GAAG,GAAG,EACrB,KAAK,GAAG,WAAW,EACnB,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,KAAK,EACL,QAAQ,GAAG,IAAI,EACf,SAAS,GAAG,EAAE,EACd,YAAY,EACZ,IAAI,GAAG,EAAE,EACT,OAAO,EACP,KAAK,EACL,YAAY,EAAE,EACZ,UAAU,GAAG,QAAQ,EACrB,cAAc,GAAG,IAAI,EACrB,oBAAoB,EACpB,gBAAgB,GAAG,KAAK,GACzB,GAAG,EAAE,EACN,cAAc,EACd,QAAQ,
|
|
1
|
+
{"version":3,"file":"BaseProductTile.js","sourceRoot":"","sources":["../../../src/ui-kit/BaseProductTile/BaseProductTile.tsx"],"names":[],"mappings":"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"}
|
|
@@ -7,6 +7,7 @@ import { style } from '../../utils/style';
|
|
|
7
7
|
import { type BusinessDepositCalculatorProps } from './CalculatorContent';
|
|
8
8
|
import { CalculatorValueBlock } from './CalculatorValueBlock';
|
|
9
9
|
import { BUSINESS_DEFAULT_DAYS, BUSINESS_DEFAULT_SUM } from './constants';
|
|
10
|
+
import { getMoneyDefaultValue, getMonthsDefaultValue } from './getDefaultValues';
|
|
10
11
|
import { renderDaysInput } from './renderDaysInput';
|
|
11
12
|
import { renderFootnote } from './renderFootnote';
|
|
12
13
|
import { renderInterestPayment } from './renderInterestPayment';
|
|
@@ -23,13 +24,21 @@ export interface BusinessDepositCalculatorProp extends BusinessDepositCalculator
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export const BusinessDepositCalculatorForm = JSX<BusinessDepositCalculatorProp>(
|
|
26
|
-
({
|
|
27
|
+
({
|
|
28
|
+
className = '',
|
|
29
|
+
rateParams,
|
|
30
|
+
buttons,
|
|
31
|
+
footnote,
|
|
32
|
+
bottomFootnote,
|
|
33
|
+
isShowDepositeName,
|
|
34
|
+
defaultParams,
|
|
35
|
+
}) => {
|
|
27
36
|
const [userInputParams, { field }] = useForm({
|
|
28
|
-
moneyValue: BUSINESS_DEFAULT_SUM,
|
|
29
|
-
daysValue: BUSINESS_DEFAULT_DAYS,
|
|
30
|
-
isReplenished:
|
|
31
|
-
isPartialWithdrawal:
|
|
32
|
-
isMonthlyInterestPayment:
|
|
37
|
+
moneyValue: getMoneyDefaultValue(defaultParams, BUSINESS_DEFAULT_SUM),
|
|
38
|
+
daysValue: getMonthsDefaultValue(defaultParams, BUSINESS_DEFAULT_DAYS),
|
|
39
|
+
isReplenished: Boolean(defaultParams?.isReplenished),
|
|
40
|
+
isPartialWithdrawal: Boolean(defaultParams?.isPartialWithdrawal),
|
|
41
|
+
isMonthlyInterestPayment: Boolean(defaultParams?.isMonthlyInterestPayment),
|
|
33
42
|
});
|
|
34
43
|
|
|
35
44
|
const calculatorParams = useBusinessDepositCalculatorParams(
|
|
@@ -43,6 +43,13 @@ export type CommonCalculatorProps = Footnote &
|
|
|
43
43
|
sourceBookDir?: string;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
export interface CommonDefaultParams {
|
|
47
|
+
/** @title Сумма по умолчанию */
|
|
48
|
+
sum?: number;
|
|
49
|
+
/** @title Период по умолчанию */
|
|
50
|
+
period?: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
46
53
|
export interface CreditCalculatorParamsViewSettings {
|
|
47
54
|
/** @title Получаю зарплату на счёт в Россельхозбанке */
|
|
48
55
|
isShowSalaryClient?: boolean;
|
|
@@ -74,14 +81,47 @@ export interface DepositCalculatorParamsViewSettings {
|
|
|
74
81
|
isShowRemoteRegistration?: boolean;
|
|
75
82
|
}
|
|
76
83
|
|
|
84
|
+
export interface CreditDefaultParams extends CommonDefaultParams {
|
|
85
|
+
/** @title Получаю зарплату на счёт в Россельхозбанке */
|
|
86
|
+
isEnableSalaryClient?: boolean;
|
|
87
|
+
/** @title Работаю в бюджетной организации */
|
|
88
|
+
isEnableStateEmployee?: boolean;
|
|
89
|
+
/** @title Получаю пенсию на карту Россельхозбанка */
|
|
90
|
+
isEnablePensionClient?: boolean;
|
|
91
|
+
/** @title Комплексная страховая защита */
|
|
92
|
+
isEnableInsurance?: boolean;
|
|
93
|
+
/** @title Аннуитетный платеж */
|
|
94
|
+
isAnnuity?: boolean;
|
|
95
|
+
}
|
|
96
|
+
|
|
77
97
|
export interface CreditCalculatorProps extends CommonCalculatorProps {
|
|
78
98
|
/** @title Настройка отображения чекбоксов */
|
|
79
99
|
paramsViewSettings?: CreditCalculatorParamsViewSettings;
|
|
100
|
+
/** @title Параметры по умолчанию */
|
|
101
|
+
defaultParams?: CreditDefaultParams;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface DepositDefaultParams extends CommonDefaultParams {
|
|
105
|
+
/** @title Выплата процентов */
|
|
106
|
+
isMonthlyInterestPayment?: boolean;
|
|
107
|
+
/** @title Оформление */
|
|
108
|
+
isRemoteRegistration?: boolean;
|
|
80
109
|
}
|
|
81
110
|
|
|
82
111
|
export interface DepositCalculatorProps extends CommonCalculatorProps {
|
|
83
112
|
/** @title Настройка отображения радио */
|
|
84
113
|
paramsViewSettings?: DepositCalculatorParamsViewSettings;
|
|
114
|
+
/** @title Параметры по умолчанию */
|
|
115
|
+
defaultParams?: DepositDefaultParams;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface BusinessDepositDefaultParams extends CommonDefaultParams {
|
|
119
|
+
/** @title Пополнение */
|
|
120
|
+
isReplenished?: boolean;
|
|
121
|
+
/** @title Частичное снятие */
|
|
122
|
+
isPartialWithdrawal?: boolean;
|
|
123
|
+
/** @title Выплата процентов */
|
|
124
|
+
isMonthlyInterestPayment?: boolean;
|
|
85
125
|
}
|
|
86
126
|
|
|
87
127
|
export interface BusinessDepositCalculatorProps extends Footnote, ButtonsSectionContent {
|
|
@@ -91,6 +131,8 @@ export interface BusinessDepositCalculatorProps extends Footnote, ButtonsSection
|
|
|
91
131
|
bottomFootnote?: string;
|
|
92
132
|
/** @title Показывать название депозита */
|
|
93
133
|
isShowDepositeName?: boolean;
|
|
134
|
+
/** @title Параметры по умолчанию */
|
|
135
|
+
defaultParams?: BusinessDepositDefaultParams;
|
|
94
136
|
}
|
|
95
137
|
|
|
96
138
|
export interface RefinancingCalculatorProps extends CommonCalculatorProps {
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from './CalculatorContent';
|
|
11
11
|
import { CalculatorValueBlock } from './CalculatorValueBlock';
|
|
12
12
|
import { CREDIT_DEFAULT_SUM, DEFAULT_MONTHS } from './constants';
|
|
13
|
+
import { getMoneyDefaultValue, getMonthsDefaultValue } from './getDefaultValues';
|
|
13
14
|
import { renderFootnote } from './renderFootnote';
|
|
14
15
|
import { renderMonthsInput } from './renderMonthsInput';
|
|
15
16
|
import { renderPaymentType } from './renderPaymentType';
|
|
@@ -22,19 +23,18 @@ import {
|
|
|
22
23
|
|
|
23
24
|
export interface CreditCalculatorProp extends CreditCalculatorProps {
|
|
24
25
|
className?: string;
|
|
25
|
-
isMobile?: boolean;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export const CreditCalculatorForm = JSX<CreditCalculatorProp>(
|
|
29
|
-
({ className, sourceBookDir, buttons, footnote, paramsViewSettings }) => {
|
|
29
|
+
({ className, sourceBookDir, buttons, footnote, paramsViewSettings, defaultParams }) => {
|
|
30
30
|
const [userInputParams, { field }] = useForm({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
moneyValue: getMoneyDefaultValue(defaultParams, CREDIT_DEFAULT_SUM),
|
|
32
|
+
monthsValue: getMonthsDefaultValue(defaultParams, DEFAULT_MONTHS),
|
|
33
|
+
isAnnuity: Boolean(defaultParams?.isAnnuity),
|
|
34
|
+
isInsurance: Boolean(defaultParams?.isEnableInsurance),
|
|
35
|
+
isSalaryClient: Boolean(defaultParams?.isEnableSalaryClient),
|
|
36
|
+
isPensionClient: Boolean(defaultParams?.isEnablePensionClient),
|
|
37
|
+
isStateEmployee: Boolean(defaultParams?.isEnableStateEmployee),
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
const calculatorParams = useCreditCalculatorParams(
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from './CalculatorContent';
|
|
10
10
|
import { CalculatorValueBlock } from './CalculatorValueBlock';
|
|
11
11
|
import { DEPOSIT_DEFAULT_SUM } from './constants';
|
|
12
|
+
import { getMoneyDefaultValue, getMonthsDefaultValue } from './getDefaultValues';
|
|
12
13
|
import { renderFootnote } from './renderFootnote';
|
|
13
14
|
import { renderInterestPayment } from './renderInterestPayment';
|
|
14
15
|
import { renderMonthsInput } from './renderMonthsInput';
|
|
@@ -25,12 +26,12 @@ export interface DepositCalculatorProp extends DepositCalculatorProps {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export const DepositCalculatorForm = JSX<DepositCalculatorProp>(
|
|
28
|
-
({ className, sourceBookDir, buttons, footnote, paramsViewSettings }) => {
|
|
29
|
+
({ className, sourceBookDir, buttons, footnote, paramsViewSettings, defaultParams }) => {
|
|
29
30
|
const [userInputParams, { field }] = useForm({
|
|
30
|
-
moneyValue: DEPOSIT_DEFAULT_SUM,
|
|
31
|
-
monthsValue: 0,
|
|
32
|
-
isMonthlyInterestPayment:
|
|
33
|
-
isRemoteRegistration:
|
|
31
|
+
moneyValue: getMoneyDefaultValue(defaultParams, DEPOSIT_DEFAULT_SUM),
|
|
32
|
+
monthsValue: getMonthsDefaultValue(defaultParams, 0),
|
|
33
|
+
isMonthlyInterestPayment: Boolean(defaultParams?.isMonthlyInterestPayment),
|
|
34
|
+
isRemoteRegistration: Boolean(defaultParams?.isRemoteRegistration),
|
|
34
35
|
});
|
|
35
36
|
|
|
36
37
|
const calculatorParams = useDepositCalculatorParams(
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CommonDefaultParams } from './CalculatorContent';
|
|
2
|
+
import {
|
|
3
|
+
BUSINESS_MAX_DAYS,
|
|
4
|
+
BUSINESS_MIN_DAYS,
|
|
5
|
+
DEFAULT_MAX_MONTHS,
|
|
6
|
+
DEFAULT_MAX_SUM,
|
|
7
|
+
DEFAULT_MIN_MONTHS,
|
|
8
|
+
DEFAULT_MIN_SUM,
|
|
9
|
+
} from './constants';
|
|
10
|
+
|
|
11
|
+
export const getMoneyDefaultValue = (defaultParams?: CommonDefaultParams, defaultMoney = 0) =>
|
|
12
|
+
defaultParams?.sum && defaultParams.sum >= DEFAULT_MIN_SUM && defaultParams.sum <= DEFAULT_MAX_SUM
|
|
13
|
+
? defaultParams.sum
|
|
14
|
+
: defaultMoney;
|
|
15
|
+
|
|
16
|
+
export const getMonthsDefaultValue = (defaultParams?: CommonDefaultParams, defaultMonth = 0) =>
|
|
17
|
+
defaultParams?.period &&
|
|
18
|
+
defaultParams.period >= DEFAULT_MIN_MONTHS &&
|
|
19
|
+
defaultParams.period <= DEFAULT_MAX_MONTHS
|
|
20
|
+
? defaultParams.period
|
|
21
|
+
: defaultMonth;
|
|
22
|
+
|
|
23
|
+
export const getDaysDefaultValue = (defaultParams?: CommonDefaultParams, defaultDays = 0) =>
|
|
24
|
+
defaultParams?.period &&
|
|
25
|
+
defaultParams.period >= BUSINESS_MIN_DAYS &&
|
|
26
|
+
defaultParams.period <= BUSINESS_MAX_DAYS
|
|
27
|
+
? defaultParams.period
|
|
28
|
+
: defaultDays;
|
|
@@ -6,7 +6,7 @@ import { type BaseProductTileContent } from '../../ui-kit/BaseProductTile/BasePr
|
|
|
6
6
|
*/
|
|
7
7
|
export type ProductBlockContent = UniBlockContent &
|
|
8
8
|
BaseProductTileContent & {
|
|
9
|
-
/** @title Отображать кнопку возврата
|
|
9
|
+
/** @title Отображать кнопку возврата */
|
|
10
10
|
backwardButton?: boolean;
|
|
11
11
|
/** @title Показывать рамку вокруг блока */
|
|
12
12
|
showBorder?: boolean;
|
|
@@ -47,6 +47,7 @@ export const BaseProductTile = JSX<BaseProductTileProps>(
|
|
|
47
47
|
} = {},
|
|
48
48
|
backwardButton,
|
|
49
49
|
children,
|
|
50
|
+
...rest
|
|
50
51
|
}) => {
|
|
51
52
|
const img = image?.src ? <Img image={image} /> : null;
|
|
52
53
|
const headline = renderHeadline({ title, description, headlineVersion, align });
|
|
@@ -66,6 +67,7 @@ export const BaseProductTile = JSX<BaseProductTileProps>(
|
|
|
66
67
|
isImageAlwaysOnRight={isImageAlwaysOnRight}
|
|
67
68
|
buttons={renderButtonsSection(buttons)}
|
|
68
69
|
backwardButton={backwardButton}
|
|
70
|
+
{...rest}
|
|
69
71
|
>
|
|
70
72
|
<div className="flex flex-col sm:gap-xl gap-4xl">
|
|
71
73
|
{filteredBenefits?.length ? (
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ import { style } from '../../utils/style';
|
|
|
7
7
|
import { type BusinessDepositCalculatorProps } from './CalculatorContent';
|
|
8
8
|
import { CalculatorValueBlock } from './CalculatorValueBlock';
|
|
9
9
|
import { BUSINESS_DEFAULT_DAYS, BUSINESS_DEFAULT_SUM } from './constants';
|
|
10
|
+
import { getMoneyDefaultValue, getMonthsDefaultValue } from './getDefaultValues';
|
|
10
11
|
import { renderDaysInput } from './renderDaysInput';
|
|
11
12
|
import { renderFootnote } from './renderFootnote';
|
|
12
13
|
import { renderInterestPayment } from './renderInterestPayment';
|
|
@@ -23,13 +24,21 @@ export interface BusinessDepositCalculatorProp extends BusinessDepositCalculator
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export const BusinessDepositCalculatorForm = JSX<BusinessDepositCalculatorProp>(
|
|
26
|
-
({
|
|
27
|
+
({
|
|
28
|
+
className = '',
|
|
29
|
+
rateParams,
|
|
30
|
+
buttons,
|
|
31
|
+
footnote,
|
|
32
|
+
bottomFootnote,
|
|
33
|
+
isShowDepositeName,
|
|
34
|
+
defaultParams,
|
|
35
|
+
}) => {
|
|
27
36
|
const [userInputParams, { field }] = useForm({
|
|
28
|
-
moneyValue: BUSINESS_DEFAULT_SUM,
|
|
29
|
-
daysValue: BUSINESS_DEFAULT_DAYS,
|
|
30
|
-
isReplenished:
|
|
31
|
-
isPartialWithdrawal:
|
|
32
|
-
isMonthlyInterestPayment:
|
|
37
|
+
moneyValue: getMoneyDefaultValue(defaultParams, BUSINESS_DEFAULT_SUM),
|
|
38
|
+
daysValue: getMonthsDefaultValue(defaultParams, BUSINESS_DEFAULT_DAYS),
|
|
39
|
+
isReplenished: Boolean(defaultParams?.isReplenished),
|
|
40
|
+
isPartialWithdrawal: Boolean(defaultParams?.isPartialWithdrawal),
|
|
41
|
+
isMonthlyInterestPayment: Boolean(defaultParams?.isMonthlyInterestPayment),
|
|
33
42
|
});
|
|
34
43
|
|
|
35
44
|
const calculatorParams = useBusinessDepositCalculatorParams(
|
|
@@ -33,6 +33,10 @@ const bottomFootnote =
|
|
|
33
33
|
|
|
34
34
|
const CREDIT_CALCULATOR_BLOCK: CreditCalculatorParamsDef = {
|
|
35
35
|
calcType: 'CreditCalculatorForm',
|
|
36
|
+
defaultParams: {
|
|
37
|
+
sum: 100000,
|
|
38
|
+
period: 16,
|
|
39
|
+
},
|
|
36
40
|
paramsViewSettings: {
|
|
37
41
|
isShowSalaryClient: true,
|
|
38
42
|
isShowStateEmployee: true,
|
|
@@ -43,6 +43,13 @@ export type CommonCalculatorProps = Footnote &
|
|
|
43
43
|
sourceBookDir?: string;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
export interface CommonDefaultParams {
|
|
47
|
+
/** @title Сумма по умолчанию */
|
|
48
|
+
sum?: number;
|
|
49
|
+
/** @title Период по умолчанию */
|
|
50
|
+
period?: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
46
53
|
export interface CreditCalculatorParamsViewSettings {
|
|
47
54
|
/** @title Получаю зарплату на счёт в Россельхозбанке */
|
|
48
55
|
isShowSalaryClient?: boolean;
|
|
@@ -74,14 +81,47 @@ export interface DepositCalculatorParamsViewSettings {
|
|
|
74
81
|
isShowRemoteRegistration?: boolean;
|
|
75
82
|
}
|
|
76
83
|
|
|
84
|
+
export interface CreditDefaultParams extends CommonDefaultParams {
|
|
85
|
+
/** @title Получаю зарплату на счёт в Россельхозбанке */
|
|
86
|
+
isEnableSalaryClient?: boolean;
|
|
87
|
+
/** @title Работаю в бюджетной организации */
|
|
88
|
+
isEnableStateEmployee?: boolean;
|
|
89
|
+
/** @title Получаю пенсию на карту Россельхозбанка */
|
|
90
|
+
isEnablePensionClient?: boolean;
|
|
91
|
+
/** @title Комплексная страховая защита */
|
|
92
|
+
isEnableInsurance?: boolean;
|
|
93
|
+
/** @title Аннуитетный платеж */
|
|
94
|
+
isAnnuity?: boolean;
|
|
95
|
+
}
|
|
96
|
+
|
|
77
97
|
export interface CreditCalculatorProps extends CommonCalculatorProps {
|
|
78
98
|
/** @title Настройка отображения чекбоксов */
|
|
79
99
|
paramsViewSettings?: CreditCalculatorParamsViewSettings;
|
|
100
|
+
/** @title Параметры по умолчанию */
|
|
101
|
+
defaultParams?: CreditDefaultParams;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface DepositDefaultParams extends CommonDefaultParams {
|
|
105
|
+
/** @title Выплата процентов */
|
|
106
|
+
isMonthlyInterestPayment?: boolean;
|
|
107
|
+
/** @title Оформление */
|
|
108
|
+
isRemoteRegistration?: boolean;
|
|
80
109
|
}
|
|
81
110
|
|
|
82
111
|
export interface DepositCalculatorProps extends CommonCalculatorProps {
|
|
83
112
|
/** @title Настройка отображения радио */
|
|
84
113
|
paramsViewSettings?: DepositCalculatorParamsViewSettings;
|
|
114
|
+
/** @title Параметры по умолчанию */
|
|
115
|
+
defaultParams?: DepositDefaultParams;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface BusinessDepositDefaultParams extends CommonDefaultParams {
|
|
119
|
+
/** @title Пополнение */
|
|
120
|
+
isReplenished?: boolean;
|
|
121
|
+
/** @title Частичное снятие */
|
|
122
|
+
isPartialWithdrawal?: boolean;
|
|
123
|
+
/** @title Выплата процентов */
|
|
124
|
+
isMonthlyInterestPayment?: boolean;
|
|
85
125
|
}
|
|
86
126
|
|
|
87
127
|
export interface BusinessDepositCalculatorProps extends Footnote, ButtonsSectionContent {
|
|
@@ -91,6 +131,8 @@ export interface BusinessDepositCalculatorProps extends Footnote, ButtonsSection
|
|
|
91
131
|
bottomFootnote?: string;
|
|
92
132
|
/** @title Показывать название депозита */
|
|
93
133
|
isShowDepositeName?: boolean;
|
|
134
|
+
/** @title Параметры по умолчанию */
|
|
135
|
+
defaultParams?: BusinessDepositDefaultParams;
|
|
94
136
|
}
|
|
95
137
|
|
|
96
138
|
export interface RefinancingCalculatorProps extends CommonCalculatorProps {
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from './CalculatorContent';
|
|
11
11
|
import { CalculatorValueBlock } from './CalculatorValueBlock';
|
|
12
12
|
import { CREDIT_DEFAULT_SUM, DEFAULT_MONTHS } from './constants';
|
|
13
|
+
import { getMoneyDefaultValue, getMonthsDefaultValue } from './getDefaultValues';
|
|
13
14
|
import { renderFootnote } from './renderFootnote';
|
|
14
15
|
import { renderMonthsInput } from './renderMonthsInput';
|
|
15
16
|
import { renderPaymentType } from './renderPaymentType';
|
|
@@ -22,19 +23,18 @@ import {
|
|
|
22
23
|
|
|
23
24
|
export interface CreditCalculatorProp extends CreditCalculatorProps {
|
|
24
25
|
className?: string;
|
|
25
|
-
isMobile?: boolean;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export const CreditCalculatorForm = JSX<CreditCalculatorProp>(
|
|
29
|
-
({ className, sourceBookDir, buttons, footnote, paramsViewSettings }) => {
|
|
29
|
+
({ className, sourceBookDir, buttons, footnote, paramsViewSettings, defaultParams }) => {
|
|
30
30
|
const [userInputParams, { field }] = useForm({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
moneyValue: getMoneyDefaultValue(defaultParams, CREDIT_DEFAULT_SUM),
|
|
32
|
+
monthsValue: getMonthsDefaultValue(defaultParams, DEFAULT_MONTHS),
|
|
33
|
+
isAnnuity: Boolean(defaultParams?.isAnnuity),
|
|
34
|
+
isInsurance: Boolean(defaultParams?.isEnableInsurance),
|
|
35
|
+
isSalaryClient: Boolean(defaultParams?.isEnableSalaryClient),
|
|
36
|
+
isPensionClient: Boolean(defaultParams?.isEnablePensionClient),
|
|
37
|
+
isStateEmployee: Boolean(defaultParams?.isEnableStateEmployee),
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
const calculatorParams = useCreditCalculatorParams(
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from './CalculatorContent';
|
|
10
10
|
import { CalculatorValueBlock } from './CalculatorValueBlock';
|
|
11
11
|
import { DEPOSIT_DEFAULT_SUM } from './constants';
|
|
12
|
+
import { getMoneyDefaultValue, getMonthsDefaultValue } from './getDefaultValues';
|
|
12
13
|
import { renderFootnote } from './renderFootnote';
|
|
13
14
|
import { renderInterestPayment } from './renderInterestPayment';
|
|
14
15
|
import { renderMonthsInput } from './renderMonthsInput';
|
|
@@ -25,12 +26,12 @@ export interface DepositCalculatorProp extends DepositCalculatorProps {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export const DepositCalculatorForm = JSX<DepositCalculatorProp>(
|
|
28
|
-
({ className, sourceBookDir, buttons, footnote, paramsViewSettings }) => {
|
|
29
|
+
({ className, sourceBookDir, buttons, footnote, paramsViewSettings, defaultParams }) => {
|
|
29
30
|
const [userInputParams, { field }] = useForm({
|
|
30
|
-
moneyValue: DEPOSIT_DEFAULT_SUM,
|
|
31
|
-
monthsValue: 0,
|
|
32
|
-
isMonthlyInterestPayment:
|
|
33
|
-
isRemoteRegistration:
|
|
31
|
+
moneyValue: getMoneyDefaultValue(defaultParams, DEPOSIT_DEFAULT_SUM),
|
|
32
|
+
monthsValue: getMonthsDefaultValue(defaultParams, 0),
|
|
33
|
+
isMonthlyInterestPayment: Boolean(defaultParams?.isMonthlyInterestPayment),
|
|
34
|
+
isRemoteRegistration: Boolean(defaultParams?.isRemoteRegistration),
|
|
34
35
|
});
|
|
35
36
|
|
|
36
37
|
const calculatorParams = useDepositCalculatorParams(
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CommonDefaultParams } from './CalculatorContent';
|
|
2
|
+
import {
|
|
3
|
+
BUSINESS_MAX_DAYS,
|
|
4
|
+
BUSINESS_MIN_DAYS,
|
|
5
|
+
DEFAULT_MAX_MONTHS,
|
|
6
|
+
DEFAULT_MAX_SUM,
|
|
7
|
+
DEFAULT_MIN_MONTHS,
|
|
8
|
+
DEFAULT_MIN_SUM,
|
|
9
|
+
} from './constants';
|
|
10
|
+
|
|
11
|
+
export const getMoneyDefaultValue = (defaultParams?: CommonDefaultParams, defaultMoney = 0) =>
|
|
12
|
+
defaultParams?.sum && defaultParams.sum >= DEFAULT_MIN_SUM && defaultParams.sum <= DEFAULT_MAX_SUM
|
|
13
|
+
? defaultParams.sum
|
|
14
|
+
: defaultMoney;
|
|
15
|
+
|
|
16
|
+
export const getMonthsDefaultValue = (defaultParams?: CommonDefaultParams, defaultMonth = 0) =>
|
|
17
|
+
defaultParams?.period &&
|
|
18
|
+
defaultParams.period >= DEFAULT_MIN_MONTHS &&
|
|
19
|
+
defaultParams.period <= DEFAULT_MAX_MONTHS
|
|
20
|
+
? defaultParams.period
|
|
21
|
+
: defaultMonth;
|
|
22
|
+
|
|
23
|
+
export const getDaysDefaultValue = (defaultParams?: CommonDefaultParams, defaultDays = 0) =>
|
|
24
|
+
defaultParams?.period &&
|
|
25
|
+
defaultParams.period >= BUSINESS_MIN_DAYS &&
|
|
26
|
+
defaultParams.period <= BUSINESS_MAX_DAYS
|
|
27
|
+
? defaultParams.period
|
|
28
|
+
: defaultDays;
|
|
@@ -6,7 +6,7 @@ import { type BaseProductTileContent } from '../../ui-kit/BaseProductTile/BasePr
|
|
|
6
6
|
*/
|
|
7
7
|
export type ProductBlockContent = UniBlockContent &
|
|
8
8
|
BaseProductTileContent & {
|
|
9
|
-
/** @title Отображать кнопку возврата
|
|
9
|
+
/** @title Отображать кнопку возврата */
|
|
10
10
|
backwardButton?: boolean;
|
|
11
11
|
/** @title Показывать рамку вокруг блока */
|
|
12
12
|
showBorder?: boolean;
|
|
@@ -47,6 +47,7 @@ export const BaseProductTile = JSX<BaseProductTileProps>(
|
|
|
47
47
|
} = {},
|
|
48
48
|
backwardButton,
|
|
49
49
|
children,
|
|
50
|
+
...rest
|
|
50
51
|
}) => {
|
|
51
52
|
const img = image?.src ? <Img image={image} /> : null;
|
|
52
53
|
const headline = renderHeadline({ title, description, headlineVersion, align });
|
|
@@ -66,6 +67,7 @@ export const BaseProductTile = JSX<BaseProductTileProps>(
|
|
|
66
67
|
isImageAlwaysOnRight={isImageAlwaysOnRight}
|
|
67
68
|
buttons={renderButtonsSection(buttons)}
|
|
68
69
|
backwardButton={backwardButton}
|
|
70
|
+
{...rest}
|
|
69
71
|
>
|
|
70
72
|
<div className="flex flex-col sm:gap-xl gap-4xl">
|
|
71
73
|
{filteredBenefits?.length ? (
|