@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.
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +442 -297
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/CashbackCalculator/CashbackCalculator.d.ts +7 -2
- package/bundle/components/CashbackCalculator/CashbackCalculatorResult.d.ts +2 -1
- package/bundle/components/CashbackCalculator/CashbackCategory.d.ts +6 -2
- package/bundle/components/CashbackCalculator/constants.d.ts +16 -0
- package/bundle/components/CashbackCalculator/getPercentCategories.d.ts +1 -0
- package/bundle/components/CashbackCalculator/renderButtons.d.ts +9 -0
- package/bundle/components/CashbackCalculator/useCashbackCalculator.d.ts +4 -2
- package/bundle/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +6 -0
- package/bundle/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +38 -0
- package/bundle/components/GalleryLayout/utils.d.ts +1 -0
- package/bundle/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
- package/bundle/ui-kit/RichText/RichTextProps.d.ts +2 -0
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +34 -22
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/dist/components/Blocks.js +4 -2
- package/dist/components/Blocks.js.map +1 -1
- package/dist/components/CashbackCalculator/CashbackCalculator.d.ts +7 -2
- package/dist/components/CashbackCalculator/CashbackCalculator.js +25 -14
- package/dist/components/CashbackCalculator/CashbackCalculator.js.map +1 -1
- package/dist/components/CashbackCalculator/CashbackCalculatorContent.d.ts +0 -25
- package/dist/components/CashbackCalculator/CashbackCalculatorContent.js +0 -1
- package/dist/components/CashbackCalculator/CashbackCalculatorResult.d.ts +2 -1
- package/dist/components/CashbackCalculator/CashbackCalculatorResult.js +9 -11
- package/dist/components/CashbackCalculator/CashbackCalculatorResult.js.map +1 -1
- package/dist/components/CashbackCalculator/CashbackCategory.d.ts +6 -2
- package/dist/components/CashbackCalculator/CashbackCategory.js +33 -54
- package/dist/components/CashbackCalculator/CashbackCategory.js.map +1 -1
- package/dist/components/CashbackCalculator/constants.d.ts +16 -0
- package/dist/components/CashbackCalculator/constants.js +89 -0
- package/dist/components/CashbackCalculator/constants.js.map +1 -0
- package/dist/components/CashbackCalculator/getPercentCategories.d.ts +1 -0
- package/dist/components/CashbackCalculator/getPercentCategories.js +16 -0
- package/dist/components/CashbackCalculator/getPercentCategories.js.map +1 -0
- package/dist/components/CashbackCalculator/renderButtons.d.ts +9 -0
- package/dist/components/CashbackCalculator/renderButtons.js +10 -0
- package/dist/components/CashbackCalculator/renderButtons.js.map +1 -0
- package/dist/components/CashbackCalculator/useCashbackCalculator.d.ts +4 -2
- package/dist/components/CashbackCalculator/useCashbackCalculator.js +17 -15
- package/dist/components/CashbackCalculator/useCashbackCalculator.js.map +1 -1
- package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +6 -0
- package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js +56 -0
- package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js.map +1 -0
- package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +38 -0
- package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js +2 -0
- package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js.map +1 -0
- package/dist/components/GalleryLayout/utils.d.ts +1 -0
- package/dist/retail/api/createParticipant.js +1 -1
- package/dist/retail/api/createParticipant.js.map +1 -1
- package/dist/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
- package/dist/ui-kit/RichText/RichText.js +2 -2
- package/dist/ui-kit/RichText/RichText.js.map +1 -1
- package/dist/ui-kit/RichText/RichTextProps.d.ts +2 -0
- package/lib/common.css +1 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +34 -22
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/lib/components/Blocks.js +4 -2
- package/lib/components/Blocks.js.map +1 -1
- package/lib/components/CashbackCalculator/CashbackCalculator.d.ts +7 -2
- package/lib/components/CashbackCalculator/CashbackCalculator.js +25 -14
- package/lib/components/CashbackCalculator/CashbackCalculator.js.map +1 -1
- package/lib/components/CashbackCalculator/CashbackCalculatorContent.d.ts +0 -25
- package/lib/components/CashbackCalculator/CashbackCalculatorContent.js +0 -1
- package/lib/components/CashbackCalculator/CashbackCalculatorResult.d.ts +2 -1
- package/lib/components/CashbackCalculator/CashbackCalculatorResult.js +9 -11
- package/lib/components/CashbackCalculator/CashbackCalculatorResult.js.map +1 -1
- package/lib/components/CashbackCalculator/CashbackCategory.d.ts +6 -2
- package/lib/components/CashbackCalculator/CashbackCategory.js +33 -54
- package/lib/components/CashbackCalculator/CashbackCategory.js.map +1 -1
- package/lib/components/CashbackCalculator/constants.d.ts +16 -0
- package/lib/components/CashbackCalculator/constants.js +87 -0
- package/lib/components/CashbackCalculator/constants.js.map +1 -0
- package/lib/components/CashbackCalculator/getPercentCategories.d.ts +1 -0
- package/lib/components/CashbackCalculator/getPercentCategories.js +13 -0
- package/lib/components/CashbackCalculator/getPercentCategories.js.map +1 -0
- package/lib/components/CashbackCalculator/renderButtons.d.ts +9 -0
- package/lib/components/CashbackCalculator/renderButtons.js +7 -0
- package/lib/components/CashbackCalculator/renderButtons.js.map +1 -0
- package/lib/components/CashbackCalculator/useCashbackCalculator.d.ts +4 -2
- package/lib/components/CashbackCalculator/useCashbackCalculator.js +18 -16
- package/lib/components/CashbackCalculator/useCashbackCalculator.js.map +1 -1
- package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +6 -0
- package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.fixture.d.ts +5 -0
- package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js +54 -0
- package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js.map +1 -0
- package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +38 -0
- package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js +2 -0
- package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js.map +1 -0
- package/lib/components/GalleryLayout/utils.d.ts +1 -0
- package/lib/retail/api/createParticipant.js +1 -1
- package/lib/retail/api/createParticipant.js.map +1 -1
- package/lib/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
- package/lib/ui-kit/RichText/RichText.js +2 -2
- package/lib/ui-kit/RichText/RichText.js.map +1 -1
- package/lib/ui-kit/RichText/RichTextProps.d.ts +2 -0
- package/mobile/bundle/bundle.umd.js +188 -90
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/CashbackCalculator/CashbackCalculator.d.ts +7 -2
- package/mobile/bundle/components/CashbackCalculator/CashbackCalculatorResult.d.ts +2 -1
- package/mobile/bundle/components/CashbackCalculator/CashbackCategory.d.ts +6 -2
- package/mobile/bundle/components/CashbackCalculator/constants.d.ts +16 -0
- package/mobile/bundle/components/CashbackCalculator/getPercentCategories.d.ts +1 -0
- package/mobile/bundle/components/CashbackCalculator/renderButtons.d.ts +9 -0
- package/mobile/bundle/components/CashbackCalculator/useCashbackCalculator.d.ts +4 -2
- package/mobile/bundle/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +6 -0
- package/mobile/bundle/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +38 -0
- package/mobile/bundle/components/GalleryLayout/utils.d.ts +1 -0
- package/mobile/bundle/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
- package/mobile/bundle/ui-kit/RichText/RichTextProps.d.ts +2 -0
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +34 -22
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/dist/components/CashbackCalculator/CashbackCalculator.d.ts +7 -2
- package/mobile/dist/components/CashbackCalculator/CashbackCalculator.js +25 -14
- package/mobile/dist/components/CashbackCalculator/CashbackCalculator.js.map +1 -1
- package/mobile/dist/components/CashbackCalculator/CashbackCalculatorContent.d.ts +0 -25
- package/mobile/dist/components/CashbackCalculator/CashbackCalculatorContent.js +0 -1
- package/mobile/dist/components/CashbackCalculator/CashbackCalculatorResult.d.ts +2 -1
- package/mobile/dist/components/CashbackCalculator/CashbackCalculatorResult.js +9 -11
- package/mobile/dist/components/CashbackCalculator/CashbackCalculatorResult.js.map +1 -1
- package/mobile/dist/components/CashbackCalculator/CashbackCategory.d.ts +6 -2
- package/mobile/dist/components/CashbackCalculator/CashbackCategory.js +33 -54
- package/mobile/dist/components/CashbackCalculator/CashbackCategory.js.map +1 -1
- package/mobile/dist/components/CashbackCalculator/constants.d.ts +16 -0
- package/mobile/dist/components/CashbackCalculator/constants.js +89 -0
- package/mobile/dist/components/CashbackCalculator/constants.js.map +1 -0
- package/mobile/dist/components/CashbackCalculator/getPercentCategories.d.ts +1 -0
- package/mobile/dist/components/CashbackCalculator/getPercentCategories.js +16 -0
- package/mobile/dist/components/CashbackCalculator/getPercentCategories.js.map +1 -0
- package/mobile/dist/components/CashbackCalculator/renderButtons.d.ts +9 -0
- package/mobile/dist/components/CashbackCalculator/renderButtons.js +10 -0
- package/mobile/dist/components/CashbackCalculator/renderButtons.js.map +1 -0
- package/mobile/dist/components/CashbackCalculator/useCashbackCalculator.d.ts +4 -2
- package/mobile/dist/components/CashbackCalculator/useCashbackCalculator.js +17 -15
- package/mobile/dist/components/CashbackCalculator/useCashbackCalculator.js.map +1 -1
- package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +6 -0
- package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js +56 -0
- package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js.map +1 -0
- package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +38 -0
- package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js +2 -0
- package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js.map +1 -0
- package/mobile/dist/components/GalleryLayout/utils.d.ts +1 -0
- package/mobile/dist/retail/api/createParticipant.js +1 -1
- package/mobile/dist/retail/api/createParticipant.js.map +1 -1
- package/mobile/dist/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
- package/mobile/dist/ui-kit/RichText/RichText.js +2 -2
- package/mobile/dist/ui-kit/RichText/RichText.js.map +1 -1
- package/mobile/dist/ui-kit/RichText/RichTextProps.d.ts +2 -0
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +34 -22
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/lib/components/CashbackCalculator/CashbackCalculator.d.ts +7 -2
- package/mobile/lib/components/CashbackCalculator/CashbackCalculator.js +25 -14
- package/mobile/lib/components/CashbackCalculator/CashbackCalculator.js.map +1 -1
- package/mobile/lib/components/CashbackCalculator/CashbackCalculatorContent.d.ts +0 -25
- package/mobile/lib/components/CashbackCalculator/CashbackCalculatorContent.js +0 -1
- package/mobile/lib/components/CashbackCalculator/CashbackCalculatorResult.d.ts +2 -1
- package/mobile/lib/components/CashbackCalculator/CashbackCalculatorResult.js +9 -11
- package/mobile/lib/components/CashbackCalculator/CashbackCalculatorResult.js.map +1 -1
- package/mobile/lib/components/CashbackCalculator/CashbackCategory.d.ts +6 -2
- package/mobile/lib/components/CashbackCalculator/CashbackCategory.js +33 -54
- package/mobile/lib/components/CashbackCalculator/CashbackCategory.js.map +1 -1
- package/mobile/lib/components/CashbackCalculator/constants.d.ts +16 -0
- package/mobile/lib/components/CashbackCalculator/constants.js +87 -0
- package/mobile/lib/components/CashbackCalculator/constants.js.map +1 -0
- package/mobile/lib/components/CashbackCalculator/getPercentCategories.d.ts +1 -0
- package/mobile/lib/components/CashbackCalculator/getPercentCategories.js +13 -0
- package/mobile/lib/components/CashbackCalculator/getPercentCategories.js.map +1 -0
- package/mobile/lib/components/CashbackCalculator/renderButtons.d.ts +9 -0
- package/mobile/lib/components/CashbackCalculator/renderButtons.js +7 -0
- package/mobile/lib/components/CashbackCalculator/renderButtons.js.map +1 -0
- package/mobile/lib/components/CashbackCalculator/useCashbackCalculator.d.ts +4 -2
- package/mobile/lib/components/CashbackCalculator/useCashbackCalculator.js +18 -16
- package/mobile/lib/components/CashbackCalculator/useCashbackCalculator.js.map +1 -1
- package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +6 -0
- package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js +54 -0
- package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js.map +1 -0
- package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +38 -0
- package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js +2 -0
- package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js.map +1 -0
- package/mobile/lib/components/GalleryLayout/utils.d.ts +1 -0
- package/mobile/lib/retail/api/createParticipant.js +1 -1
- package/mobile/lib/retail/api/createParticipant.js.map +1 -1
- package/mobile/lib/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
- package/mobile/lib/ui-kit/RichText/RichText.js +2 -2
- package/mobile/lib/ui-kit/RichText/RichText.js.map +1 -1
- package/mobile/lib/ui-kit/RichText/RichTextProps.d.ts +2 -0
- package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +47 -28
- package/mobile/src/components/CashbackCalculator/CashbackCalculator.tsx +73 -69
- package/mobile/src/components/CashbackCalculator/CashbackCalculatorContent.ts +0 -28
- package/mobile/src/components/CashbackCalculator/CashbackCalculatorResult.tsx +23 -23
- package/mobile/src/components/CashbackCalculator/CashbackCategory.tsx +69 -71
- package/mobile/src/components/CashbackCalculator/constants.ts +97 -0
- package/mobile/src/components/CashbackCalculator/getPercentCategories.ts +24 -0
- package/mobile/src/components/CashbackCalculator/renderButtons.tsx +38 -0
- package/mobile/src/components/CashbackCalculator/useCashbackCalculator.ts +26 -17
- package/mobile/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.example.json +47 -0
- package/mobile/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.tsx +116 -0
- package/{src/components/CashbackCalculator/CashbackCalculator.ui.json → mobile/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.ui.json} +6 -0
- package/mobile/src/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.ts +49 -0
- package/mobile/src/retail/api/createParticipant.ts +1 -1
- package/mobile/src/retail/model/ApplicationLeadFormTypes.ts +1 -1
- package/mobile/src/ui-kit/RichText/RichText.tsx +9 -1
- package/mobile/src/ui-kit/RichText/RichTextProps.ts +2 -0
- package/package.json +2 -2
- package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +47 -28
- package/src/components/Blocks.ts +4 -2
- package/src/components/CashbackCalculator/CashbackCalculator.tsx +73 -69
- package/src/components/CashbackCalculator/CashbackCalculatorContent.ts +0 -28
- package/src/components/CashbackCalculator/CashbackCalculatorResult.tsx +23 -23
- package/src/components/CashbackCalculator/CashbackCategory.tsx +69 -71
- package/src/components/CashbackCalculator/constants.ts +97 -0
- package/src/components/CashbackCalculator/getPercentCategories.ts +24 -0
- package/src/components/CashbackCalculator/renderButtons.tsx +38 -0
- package/src/components/CashbackCalculator/useCashbackCalculator.ts +26 -17
- package/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.example.json +47 -0
- package/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.fixture.tsx +61 -0
- package/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.tsx +116 -0
- package/{mobile/src/components/CashbackCalculator/CashbackCalculator.ui.json → src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.ui.json} +6 -0
- package/src/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.ts +49 -0
- package/src/retail/api/createParticipant.ts +1 -1
- package/src/retail/model/ApplicationLeadFormTypes.ts +1 -1
- package/src/ui-kit/RichText/RichText.tsx +9 -1
- package/src/ui-kit/RichText/RichTextProps.ts +2 -0
- package/bundle/components/CashbackCalculator/CashbackCalculatorContent.d.ts +0 -25
- package/mobile/bundle/components/CashbackCalculator/CashbackCalculatorContent.d.ts +0 -25
- package/mobile/src/components/CashbackCalculator/CashbackCalculator.example.json +0 -1
- package/src/components/CashbackCalculator/CashbackCalculator.example.json +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Button } from '../../ui-kit/Button/Button';
|
|
2
|
+
import { MAX_CATEGORIES } from './constants';
|
|
3
|
+
|
|
4
|
+
type RenderButtonsProps = {
|
|
5
|
+
cashbacksLength: number;
|
|
6
|
+
onAddNewCashback: () => void;
|
|
7
|
+
onResetCashback: () => void;
|
|
8
|
+
calculatorType?: string;
|
|
9
|
+
maxCategories?: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const renderButtons = ({
|
|
13
|
+
cashbacksLength,
|
|
14
|
+
onAddNewCashback,
|
|
15
|
+
onResetCashback,
|
|
16
|
+
calculatorType = 'standard',
|
|
17
|
+
maxCategories = MAX_CATEGORIES[calculatorType],
|
|
18
|
+
}: RenderButtonsProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<div className="w-full flex flex-col gap-lg">
|
|
21
|
+
{cashbacksLength < maxCategories ? (
|
|
22
|
+
<Button
|
|
23
|
+
className="self-start text-primary-main"
|
|
24
|
+
embedded
|
|
25
|
+
version="secondary"
|
|
26
|
+
onClick={onAddNewCashback}
|
|
27
|
+
>
|
|
28
|
+
{cashbacksLength ? 'Добавить ещё категорию' : 'Добавить категорию'}
|
|
29
|
+
</Button>
|
|
30
|
+
) : null}
|
|
31
|
+
{cashbacksLength > 2 ? (
|
|
32
|
+
<Button className="self-start" version="secondary" onClick={onResetCashback}>
|
|
33
|
+
Сбросить все категории
|
|
34
|
+
</Button>
|
|
35
|
+
) : null}
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
1
|
+
import { useMemo, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
2
|
import { useLeadFormData } from '../../retail/hooks/useLeadFormData';
|
|
3
3
|
import { type DictionaryItem } from '../../retail/model/LeadFormData';
|
|
4
4
|
import { type Option } from '../../ui-kit/Select/Option';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
type Cashback,
|
|
7
|
+
type CashbackCalculatorType,
|
|
8
|
+
} from '../CashbackCalculatorLayout/CashbackCalculatorLayoutContent';
|
|
9
|
+
import { type SelectedCategory } from './CashbackCalculator';
|
|
10
|
+
import { DEFAULT_PREMIUM_CASHBACK, DEFAULT_STANDARD_CASHBACK } from './constants';
|
|
6
11
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
text: 'Категория 1% "На всё"',
|
|
12
|
-
key: '1',
|
|
13
|
-
},
|
|
14
|
-
sum: 5000,
|
|
15
|
-
},
|
|
16
|
-
];
|
|
12
|
+
const CashbackType = {
|
|
13
|
+
standard: DEFAULT_STANDARD_CASHBACK,
|
|
14
|
+
premium: DEFAULT_PREMIUM_CASHBACK,
|
|
15
|
+
};
|
|
17
16
|
|
|
18
|
-
export const useCashbackCalculator = () => {
|
|
17
|
+
export const useCashbackCalculator = (calculatorType: CashbackCalculatorType) => {
|
|
19
18
|
const { data } = useLeadFormData('CASHBACK_CATEGORY');
|
|
20
|
-
const [cashbacks, setCashbacks] = useState<Cashback[]>(
|
|
19
|
+
const [cashbacks, setCashbacks] = useState<Cashback[]>(CashbackType[calculatorType]);
|
|
20
|
+
|
|
21
|
+
const [selectedCategories, setSelectedCategories] = useState<SelectedCategory[]>([]);
|
|
21
22
|
|
|
22
23
|
const categories: Option[] =
|
|
23
24
|
data?.map((_: DictionaryItem) => ({
|
|
@@ -25,11 +26,18 @@ export const useCashbackCalculator = () => {
|
|
|
25
26
|
text: _.value,
|
|
26
27
|
})) || [];
|
|
27
28
|
|
|
29
|
+
const filteredCategories = useMemo(() => {
|
|
30
|
+
const categoriesToRemove: Option[] = selectedCategories.map((obj) => obj.category);
|
|
31
|
+
const keysToRemove = new Set(categoriesToRemove.map((item) => item.key));
|
|
32
|
+
|
|
33
|
+
return categories.filter((item) => !keysToRemove.has(item.key));
|
|
34
|
+
}, [selectedCategories, categories]);
|
|
35
|
+
|
|
28
36
|
const onAddNewCashback = () =>
|
|
29
37
|
setCashbacks((_) => [
|
|
30
38
|
..._,
|
|
31
39
|
{
|
|
32
|
-
id: _[_.length - 1]
|
|
40
|
+
id: _ && _.length > 0 ? _[_.length - 1]?.id + 1 : 1,
|
|
33
41
|
percent: {
|
|
34
42
|
text: 'Категория 1,5%',
|
|
35
43
|
key: '1.5',
|
|
@@ -51,14 +59,15 @@ export const useCashbackCalculator = () => {
|
|
|
51
59
|
|
|
52
60
|
const onDeleteCashback = (id: number) => setCashbacks((prev) => prev.filter((_) => _.id !== id));
|
|
53
61
|
|
|
54
|
-
const onResetCashback = () => setCashbacks(
|
|
62
|
+
const onResetCashback = () => setCashbacks(CashbackType[calculatorType]);
|
|
55
63
|
|
|
56
64
|
return {
|
|
57
65
|
cashbacks,
|
|
58
|
-
categories,
|
|
66
|
+
categories: filteredCategories,
|
|
59
67
|
onAddNewCashback,
|
|
60
68
|
onChangeCashback,
|
|
61
69
|
onDeleteCashback,
|
|
62
70
|
onResetCashback,
|
|
71
|
+
onChangeCategory: setSelectedCategories,
|
|
63
72
|
};
|
|
64
73
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"content": {
|
|
3
|
+
"title": "Калькулятор расчёта баллов",
|
|
4
|
+
"description": "<p>Можно выбрать до 5 категорий для уровня программы лояльности «Стандарт», </br> до 7 категорий для уровня программы лояльности «Престиж»</p>",
|
|
5
|
+
"subtitle": "Выберите уровень программы лояльности",
|
|
6
|
+
"premiumCalculatorParams": {
|
|
7
|
+
"maxInputRange": 300000,
|
|
8
|
+
"maxCategories": 7,
|
|
9
|
+
"maxMonthCashback": 15000
|
|
10
|
+
},
|
|
11
|
+
"standardCalculatorParams": {
|
|
12
|
+
"maxInputRange": 300000,
|
|
13
|
+
"maxCategories": 5,
|
|
14
|
+
"maxMonthCashback": 5000
|
|
15
|
+
},
|
|
16
|
+
"deleteImage": {
|
|
17
|
+
"src": "IconDelete.svg",
|
|
18
|
+
"format": "webp",
|
|
19
|
+
"alt": "Иконка кнопки удаления блока кэшбека"
|
|
20
|
+
},
|
|
21
|
+
"infoImage": {
|
|
22
|
+
"src": "IconExchange.svg",
|
|
23
|
+
"format": "webp",
|
|
24
|
+
"alt": "Иконка информационного блока"
|
|
25
|
+
},
|
|
26
|
+
"image": {
|
|
27
|
+
"src": "money-1.png",
|
|
28
|
+
"format": "webp",
|
|
29
|
+
"alt": "Калькулятор кэшбека",
|
|
30
|
+
"size": {
|
|
31
|
+
"width": 540,
|
|
32
|
+
"height": 366
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"button": {
|
|
36
|
+
"href": "/natural/debetcards/svoya-plus",
|
|
37
|
+
"text": "Оформить карту",
|
|
38
|
+
"target": "_self"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"blocks": [
|
|
42
|
+
{
|
|
43
|
+
"content": {},
|
|
44
|
+
"type": "CashbackCalculator"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type Picture } from '../../model/Picture';
|
|
2
|
+
import '../../setup-fixture';
|
|
3
|
+
import { PopupManager } from '../../ui-kit/PopupManager/PopupManager';
|
|
4
|
+
|
|
5
|
+
import type { BlockRendererOptions } from '../../BlockRenderer/BlockRendererOptions';
|
|
6
|
+
import { Blocks } from '../Blocks';
|
|
7
|
+
import { CashbackCalculatorLayout } from './CashbackCalculatorLayout';
|
|
8
|
+
|
|
9
|
+
const image: Picture = {
|
|
10
|
+
src: 'money-1.png',
|
|
11
|
+
format: 'webp',
|
|
12
|
+
alt: 'Потребительский кредит наличными',
|
|
13
|
+
size: {
|
|
14
|
+
width: 540,
|
|
15
|
+
height: 366,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const deleteImage: Picture = {
|
|
20
|
+
src: 'IconDelete.svg',
|
|
21
|
+
format: 'webp',
|
|
22
|
+
alt: 'Иконка кнопки удаления блока кэшбека',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const infoImage: Picture = {
|
|
26
|
+
src: 'IconExchange.svg',
|
|
27
|
+
format: 'webp',
|
|
28
|
+
alt: 'Иконка информационного блока',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const options: BlockRendererOptions = {
|
|
32
|
+
blocksRegistry: Blocks,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
default: (
|
|
37
|
+
<div className="container grid grid-cols-12">
|
|
38
|
+
<CashbackCalculatorLayout
|
|
39
|
+
title="Калькулятор расчёта баллов"
|
|
40
|
+
description="<p>Можно выбрать до 5 категорий для уровня программы лояльности «Стандарт», </br> до 7 категорий для уровня программы лояльности «Престиж»</p>"
|
|
41
|
+
subtitle="Выберите уровень программы лояльности"
|
|
42
|
+
image={image}
|
|
43
|
+
deleteImage={deleteImage}
|
|
44
|
+
infoImage={infoImage}
|
|
45
|
+
className="col-span-12"
|
|
46
|
+
options={options}
|
|
47
|
+
premiumCalculatorParams={{
|
|
48
|
+
maxInputRange: 300000,
|
|
49
|
+
maxCategories: 7,
|
|
50
|
+
maxMonthCashback: 15000,
|
|
51
|
+
}}
|
|
52
|
+
standardCalculatorParams={{
|
|
53
|
+
maxInputRange: 300000,
|
|
54
|
+
maxCategories: 5,
|
|
55
|
+
maxMonthCashback: 5000,
|
|
56
|
+
}}
|
|
57
|
+
/>
|
|
58
|
+
<PopupManager />
|
|
59
|
+
</div>
|
|
60
|
+
),
|
|
61
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import type { Picture } from '../../model/Picture';
|
|
3
|
+
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
4
|
+
import { Paragraph } from '../../ui-kit/Paragraph/Paragraph';
|
|
5
|
+
import { RichText } from '../../ui-kit/RichText/RichText';
|
|
6
|
+
import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
|
|
7
|
+
import { style } from '../../utils/style';
|
|
8
|
+
import { Headline } from '../Headline/Headline';
|
|
9
|
+
import { TabsLayout } from '../TabsLayout/TabsLayout';
|
|
10
|
+
import type { Tab } from '../TabsLayout/TabsLayoutContent';
|
|
11
|
+
import {
|
|
12
|
+
type CalculatorParams,
|
|
13
|
+
type CashbackCalculatorLayoutContent,
|
|
14
|
+
type CashbackCalculatorType,
|
|
15
|
+
} from './CashbackCalculatorLayoutContent';
|
|
16
|
+
|
|
17
|
+
const CALCULATOR_TABS: Tab[] = [
|
|
18
|
+
{
|
|
19
|
+
type: 'group',
|
|
20
|
+
description: 'с остатками на счетах до 2 999 999,99 руб*',
|
|
21
|
+
text: 'Стандарт',
|
|
22
|
+
tabName: 'standard',
|
|
23
|
+
selected: true,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'group',
|
|
27
|
+
description: 'с остатками на счетах от 3 000 000,00 руб*',
|
|
28
|
+
text: 'Престиж',
|
|
29
|
+
tabName: 'premium',
|
|
30
|
+
selected: false,
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const defaultInfoImage: Picture = {
|
|
35
|
+
src: 'IconExchange.svg',
|
|
36
|
+
format: 'webp',
|
|
37
|
+
alt: 'Иконка информационного блока',
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
interface CashbackCalculatorProps extends CashbackCalculatorLayoutContent, UniBlockProps {}
|
|
41
|
+
|
|
42
|
+
export const CashbackCalculatorLayout = JSX<CashbackCalculatorProps>(
|
|
43
|
+
({
|
|
44
|
+
premiumCalculatorParams = {},
|
|
45
|
+
standardCalculatorParams = {},
|
|
46
|
+
image,
|
|
47
|
+
deleteImage,
|
|
48
|
+
infoImage = defaultInfoImage,
|
|
49
|
+
button,
|
|
50
|
+
className = '',
|
|
51
|
+
options,
|
|
52
|
+
title,
|
|
53
|
+
description,
|
|
54
|
+
subtitle,
|
|
55
|
+
...rest
|
|
56
|
+
}) => {
|
|
57
|
+
const calculatorProps = {
|
|
58
|
+
button,
|
|
59
|
+
deleteImage,
|
|
60
|
+
infoImage,
|
|
61
|
+
image,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const CalculatorStandardBlock = createCalculatorBlock(
|
|
65
|
+
'standard',
|
|
66
|
+
calculatorProps,
|
|
67
|
+
standardCalculatorParams,
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const CalculatorPremiumBlock = createCalculatorBlock(
|
|
71
|
+
'premium',
|
|
72
|
+
calculatorProps,
|
|
73
|
+
premiumCalculatorParams,
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const slots = {
|
|
77
|
+
standard: [CalculatorStandardBlock],
|
|
78
|
+
premium: [CalculatorPremiumBlock],
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<BlockWrapper
|
|
83
|
+
className={style('flex flex-col justify-center items-center gap-lg', className)}
|
|
84
|
+
defaultPadding={style('p-6xl')}
|
|
85
|
+
{...rest}
|
|
86
|
+
>
|
|
87
|
+
<Headline title={title} headlineVersion="XL" isEmbedded={true} />
|
|
88
|
+
<RichText __html={description} className="text-center" />
|
|
89
|
+
<Paragraph>{subtitle}</Paragraph>
|
|
90
|
+
<div className="container grid grid-cols-12">
|
|
91
|
+
<TabsLayout
|
|
92
|
+
className="col-span-12"
|
|
93
|
+
tabsType="animated"
|
|
94
|
+
tabs={CALCULATOR_TABS}
|
|
95
|
+
block={{ slots }}
|
|
96
|
+
options={options}
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
</BlockWrapper>
|
|
100
|
+
);
|
|
101
|
+
},
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const createCalculatorBlock = (
|
|
105
|
+
calculatorType: CashbackCalculatorType,
|
|
106
|
+
calculatorProps: CashbackCalculatorLayoutContent,
|
|
107
|
+
calculatorParams: CalculatorParams,
|
|
108
|
+
) => ({
|
|
109
|
+
type: 'CashbackCalculator',
|
|
110
|
+
content: {
|
|
111
|
+
calculatorType: calculatorType,
|
|
112
|
+
...calculatorProps,
|
|
113
|
+
...calculatorParams,
|
|
114
|
+
},
|
|
115
|
+
style: ['col-span-12'],
|
|
116
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type DescriptionProps,
|
|
3
|
+
type SubtitleProps,
|
|
4
|
+
type TitleProps,
|
|
5
|
+
} from '../../model/HeadlineType';
|
|
6
|
+
import { type Picture } from '../../model/Picture';
|
|
7
|
+
import { type LinkButtonContent } from '../../ui-kit/LinkButton/LinkButtonContent';
|
|
8
|
+
import { type Option } from '../../ui-kit/Select/Option';
|
|
9
|
+
import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
|
|
10
|
+
|
|
11
|
+
export type Cashback = {
|
|
12
|
+
id: number;
|
|
13
|
+
percent: Option;
|
|
14
|
+
sum: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type CalculatorParams = {
|
|
18
|
+
/** @title Максимальное значение поля «Сумма покупок в категории» */
|
|
19
|
+
maxInputRange?: number;
|
|
20
|
+
/** @title Максимальное количество выбранных категорий */
|
|
21
|
+
maxCategories?: number;
|
|
22
|
+
/** @title Максимальное количество баллов в месяц */
|
|
23
|
+
maxMonthCashback?: number;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @title Блок калькулятора кэшбека
|
|
28
|
+
*/
|
|
29
|
+
export type CashbackCalculatorLayoutContent = UniBlockContent &
|
|
30
|
+
TitleProps &
|
|
31
|
+
DescriptionProps &
|
|
32
|
+
SubtitleProps & {
|
|
33
|
+
/** @title Параметры калькулятора стандарт */
|
|
34
|
+
standardCalculatorParams?: CalculatorParams;
|
|
35
|
+
/** @title Параметры калькулятора престиж */
|
|
36
|
+
premiumCalculatorParams?: CalculatorParams;
|
|
37
|
+
/** @title Кнопка */
|
|
38
|
+
button?: LinkButtonContent;
|
|
39
|
+
/** @title Изображение */
|
|
40
|
+
image?: Picture;
|
|
41
|
+
/** @title Иконка кнопки удаления категории */
|
|
42
|
+
deleteImage?: Picture;
|
|
43
|
+
/** @title Иконка информационного блока */
|
|
44
|
+
infoImage?: Picture;
|
|
45
|
+
/** @hidden */
|
|
46
|
+
calculatorType?: CashbackCalculatorType;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type CashbackCalculatorType = 'standard' | 'premium';
|
|
@@ -12,7 +12,7 @@ interface CreateParticipantResponseType {
|
|
|
12
12
|
|
|
13
13
|
export const createParticipant = (body: CreateParticipantType) =>
|
|
14
14
|
fetchRetailJSON<CreateParticipantResponseType>(
|
|
15
|
-
'/
|
|
15
|
+
'/internal/entities/createParticipant',
|
|
16
16
|
'POST',
|
|
17
17
|
body,
|
|
18
18
|
).then((res) => res || null);
|
|
@@ -3,7 +3,14 @@ import { style } from '../../utils/style';
|
|
|
3
3
|
import { type RichTextProps } from './RichTextProps';
|
|
4
4
|
|
|
5
5
|
export const RichText = JSX<RichTextProps>(
|
|
6
|
-
({
|
|
6
|
+
({
|
|
7
|
+
__html = '',
|
|
8
|
+
richVersion = '',
|
|
9
|
+
itemSize = 'list-m',
|
|
10
|
+
className,
|
|
11
|
+
isDotted = true,
|
|
12
|
+
children,
|
|
13
|
+
}) => {
|
|
7
14
|
const dotStyle = isDotted ? '' : 'without-dots';
|
|
8
15
|
|
|
9
16
|
return __html || children ? (
|
|
@@ -15,6 +22,7 @@ export const RichText = JSX<RichTextProps>(
|
|
|
15
22
|
itemSize,
|
|
16
23
|
'md-container group-data-secondary:text-white group-data-gray:text-secondary-text',
|
|
17
24
|
dotStyle,
|
|
25
|
+
className,
|
|
18
26
|
)}
|
|
19
27
|
dangerouslySetInnerHTML={__html ? { __html } : undefined}
|
|
20
28
|
>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type TitleProps } from '../../model/HeadlineType';
|
|
2
|
-
import { type Picture } from '../../model/Picture';
|
|
3
|
-
import { type LinkButtonContent } from '../../ui-kit/LinkButton/LinkButtonContent';
|
|
4
|
-
import { type Option } from '../../ui-kit/Select/Option';
|
|
5
|
-
import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
|
|
6
|
-
export declare type Cashback = {
|
|
7
|
-
id: number;
|
|
8
|
-
percent: Option;
|
|
9
|
-
sum: number;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* @title Блок калькулятора кэшбека
|
|
13
|
-
*/
|
|
14
|
-
export declare type CashbackCalculatorContent = UniBlockContent & TitleProps & {
|
|
15
|
-
/** @title Кнопка */
|
|
16
|
-
button?: LinkButtonContent;
|
|
17
|
-
/** @title Максимальное значение поля 'Сумма покупок в категории' */
|
|
18
|
-
maxInputRange?: number;
|
|
19
|
-
/** @title Изображение */
|
|
20
|
-
image?: Picture;
|
|
21
|
-
/** @title Иконка кнопки удаления категории */
|
|
22
|
-
deleteImage?: Picture;
|
|
23
|
-
/** @title Иконка информационного блока */
|
|
24
|
-
infoImage?: Picture;
|
|
25
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type TitleProps } from '../../model/HeadlineType';
|
|
2
|
-
import { type Picture } from '../../model/Picture';
|
|
3
|
-
import { type LinkButtonContent } from '../../ui-kit/LinkButton/LinkButtonContent';
|
|
4
|
-
import { type Option } from '../../ui-kit/Select/Option';
|
|
5
|
-
import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
|
|
6
|
-
export declare type Cashback = {
|
|
7
|
-
id: number;
|
|
8
|
-
percent: Option;
|
|
9
|
-
sum: number;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* @title Блок калькулятора кэшбека
|
|
13
|
-
*/
|
|
14
|
-
export declare type CashbackCalculatorContent = UniBlockContent & TitleProps & {
|
|
15
|
-
/** @title Кнопка */
|
|
16
|
-
button?: LinkButtonContent;
|
|
17
|
-
/** @title Максимальное значение поля 'Сумма покупок в категории' */
|
|
18
|
-
maxInputRange?: number;
|
|
19
|
-
/** @title Изображение */
|
|
20
|
-
image?: Picture;
|
|
21
|
-
/** @title Иконка кнопки удаления категории */
|
|
22
|
-
deleteImage?: Picture;
|
|
23
|
-
/** @title Иконка информационного блока */
|
|
24
|
-
infoImage?: Picture;
|
|
25
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|