@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,97 @@
|
|
|
1
|
+
import type { Option } from '../../ui-kit/Select/Option';
|
|
2
|
+
import { type Cashback } from '../CashbackCalculatorLayout/CashbackCalculatorLayoutContent';
|
|
3
|
+
|
|
4
|
+
export const ALL_PERCENT_STANDARD_CATEGORIES: Option[] = [
|
|
5
|
+
{
|
|
6
|
+
text: 'Категория 1% «На всё»',
|
|
7
|
+
key: '1-main',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
text: 'Категория 1,5%',
|
|
11
|
+
key: '1.5',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
text: 'Категория 3%',
|
|
15
|
+
key: '3',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
text: 'Категория 5%',
|
|
19
|
+
key: '5',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
text: 'Категория 10%',
|
|
23
|
+
key: '10',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
text: 'Категория 15%',
|
|
27
|
+
key: '15',
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export const ALL_PERCENT_PREMIUM_CATEGORIES: Option[] = [
|
|
32
|
+
{
|
|
33
|
+
text: 'Категория 1,5% «На всё»',
|
|
34
|
+
key: '1.5-main',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
text: 'Категория 1,5%',
|
|
38
|
+
key: '1.5',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
text: 'Категория 3%',
|
|
42
|
+
key: '3',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
text: 'Категория 5%',
|
|
46
|
+
key: '5',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
text: 'Категория 10%',
|
|
50
|
+
key: '10',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
text: 'Категория 15%',
|
|
54
|
+
key: '15',
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
export const MAIN_CASHBACK_KEY = {
|
|
59
|
+
standard: '1-main',
|
|
60
|
+
premium: '1.5-main',
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const DEFAULT_STANDARD_CASHBACK: Cashback[] = [
|
|
64
|
+
{
|
|
65
|
+
id: 0,
|
|
66
|
+
percent: {
|
|
67
|
+
text: 'Категория 1% «На всё»',
|
|
68
|
+
key: '1-main',
|
|
69
|
+
},
|
|
70
|
+
sum: 5000,
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
export const DEFAULT_PREMIUM_CASHBACK: Cashback[] = [
|
|
75
|
+
{
|
|
76
|
+
id: 0,
|
|
77
|
+
percent: {
|
|
78
|
+
text: 'Категория 1,5% «На всё»',
|
|
79
|
+
key: '1.5-main',
|
|
80
|
+
},
|
|
81
|
+
sum: 5000,
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
// export const INCREASED_PERCENTS = ['5', '10', '15'];
|
|
86
|
+
|
|
87
|
+
export const MAX_CATEGORIES = {
|
|
88
|
+
standard: 5,
|
|
89
|
+
premium: 7,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const INFO_BLOCK_HTML = `<p>Полученные баллы можно конвертировать в рубли и компенсировать покупки у партнеров.</p>`;
|
|
93
|
+
|
|
94
|
+
export const MAX_MONTH_CASHBACK: Record<string, number> = {
|
|
95
|
+
standard: 5000,
|
|
96
|
+
premium: 15000,
|
|
97
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ALL_PERCENT_PREMIUM_CATEGORIES,
|
|
3
|
+
ALL_PERCENT_STANDARD_CATEGORIES,
|
|
4
|
+
MAIN_CASHBACK_KEY,
|
|
5
|
+
} from './constants';
|
|
6
|
+
|
|
7
|
+
export const getPercentCategories = (isMainCashbackAdded: boolean, calculatorType: string) => {
|
|
8
|
+
const allPercentCategories =
|
|
9
|
+
calculatorType === 'premium' ? ALL_PERCENT_PREMIUM_CATEGORIES : ALL_PERCENT_STANDARD_CATEGORIES;
|
|
10
|
+
|
|
11
|
+
let updatedCategories = allPercentCategories;
|
|
12
|
+
|
|
13
|
+
if (!isMainCashbackAdded) {
|
|
14
|
+
return allPercentCategories;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (isMainCashbackAdded) {
|
|
18
|
+
updatedCategories = updatedCategories.filter(
|
|
19
|
+
(_) => _.key !== MAIN_CASHBACK_KEY[calculatorType],
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return updatedCategories;
|
|
24
|
+
};
|
|
@@ -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,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
|
>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redneckz/wildless-cms-uni-blocks",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.1071",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ЦК",
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
"path": "lib/common.css"
|
|
206
206
|
},
|
|
207
207
|
{
|
|
208
|
-
"limit": "
|
|
208
|
+
"limit": "130 kB",
|
|
209
209
|
"path": "bundle/bundle.umd.min.js"
|
|
210
210
|
}
|
|
211
211
|
],
|
|
@@ -152,26 +152,11 @@ export const useApplicationLeadApi = ({
|
|
|
152
152
|
try {
|
|
153
153
|
startSending();
|
|
154
154
|
const transformedFormData = transformFormData(formData);
|
|
155
|
-
const participantData = await createParticipant({
|
|
156
|
-
phone: formatPhone(transformedFormData.phone as string),
|
|
157
|
-
email: transformedFormData.email as string,
|
|
158
|
-
});
|
|
159
|
-
|
|
160
155
|
const referalData = leadFormStore.referalData;
|
|
161
156
|
const marketingInfo = sessionStore.marketingInfo;
|
|
162
157
|
|
|
163
|
-
if (!participantData) {
|
|
164
|
-
throw new Error();
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
const { participantId, userId } = participantData;
|
|
168
|
-
|
|
169
|
-
if (!participantId) {
|
|
170
|
-
throw new Error();
|
|
171
|
-
}
|
|
172
158
|
const common: CommonLeadProps = {
|
|
173
159
|
programId,
|
|
174
|
-
userId,
|
|
175
160
|
productType,
|
|
176
161
|
sendAspects,
|
|
177
162
|
verifyPhoneDialog,
|
|
@@ -179,23 +164,17 @@ export const useApplicationLeadApi = ({
|
|
|
179
164
|
};
|
|
180
165
|
|
|
181
166
|
const taskData: TaskDataProps = {
|
|
182
|
-
participantId,
|
|
183
167
|
formData: transformedFormData,
|
|
184
168
|
referalData,
|
|
185
169
|
marketingInfo,
|
|
186
170
|
saveUserData,
|
|
187
171
|
};
|
|
188
172
|
|
|
189
|
-
const sendCurrentTask = createSendCurrentTaskNew({
|
|
190
|
-
common,
|
|
191
|
-
taskData,
|
|
192
|
-
consentBkiDialog,
|
|
193
|
-
});
|
|
194
|
-
|
|
195
173
|
const handleSuccessVerify = createHandleSuccessVerifyNew({
|
|
196
174
|
common,
|
|
175
|
+
taskData,
|
|
197
176
|
draftDialog,
|
|
198
|
-
|
|
177
|
+
consentBkiDialog,
|
|
199
178
|
});
|
|
200
179
|
|
|
201
180
|
const acceptedConsents = getAcceptedConsents(transformedFormData, productType);
|
|
@@ -233,6 +212,11 @@ const createSendCurrentTaskNew =
|
|
|
233
212
|
const { programId, userId, productType, sendAspects, verifyPhoneDialog, handleFailSendForm } =
|
|
234
213
|
common;
|
|
235
214
|
const { participantId, formData, referalData, marketingInfo, saveUserData } = taskData;
|
|
215
|
+
|
|
216
|
+
if (!participantId) {
|
|
217
|
+
throw new Error();
|
|
218
|
+
}
|
|
219
|
+
|
|
236
220
|
const taskId = await updateUserDataNewMicroservice({
|
|
237
221
|
programId,
|
|
238
222
|
participantId,
|
|
@@ -257,17 +241,51 @@ const createSendCurrentTaskNew =
|
|
|
257
241
|
const createHandleSuccessVerifyNew =
|
|
258
242
|
({
|
|
259
243
|
common,
|
|
244
|
+
taskData,
|
|
260
245
|
draftDialog,
|
|
261
|
-
|
|
246
|
+
consentBkiDialog,
|
|
262
247
|
}: {
|
|
263
248
|
common: CommonLeadProps;
|
|
249
|
+
taskData: TaskDataProps;
|
|
264
250
|
draftDialog: any;
|
|
265
|
-
|
|
251
|
+
consentBkiDialog: ReturnType<typeof useConsentBkiDialog>;
|
|
266
252
|
}) =>
|
|
267
253
|
async () => {
|
|
268
|
-
const {
|
|
269
|
-
|
|
254
|
+
const { programId, productType, sendAspects, verifyPhoneDialog, handleFailSendForm } = common;
|
|
255
|
+
const { formData } = taskData;
|
|
256
|
+
|
|
270
257
|
try {
|
|
258
|
+
const participantData = await createParticipant({
|
|
259
|
+
phone: formatPhone(formData.phone as string),
|
|
260
|
+
email: formData.email as string,
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
if (!participantData) {
|
|
264
|
+
throw new Error();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const { participantId, userId } = participantData;
|
|
268
|
+
|
|
269
|
+
if (!participantId) {
|
|
270
|
+
throw new Error();
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const updatedCommon: CommonLeadProps = {
|
|
274
|
+
...common,
|
|
275
|
+
userId,
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
const updatedTaskData: TaskDataProps = {
|
|
279
|
+
...taskData,
|
|
280
|
+
participantId,
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const sendCurrentTask = createSendCurrentTaskNew({
|
|
284
|
+
common: updatedCommon,
|
|
285
|
+
taskData: updatedTaskData,
|
|
286
|
+
consentBkiDialog,
|
|
287
|
+
});
|
|
288
|
+
|
|
271
289
|
const lastTaskId = await getLastTaskStatus({ userId, programId });
|
|
272
290
|
|
|
273
291
|
if (lastTaskId) {
|
|
@@ -283,7 +301,8 @@ const createHandleSuccessVerifyNew =
|
|
|
283
301
|
} else {
|
|
284
302
|
await sendCurrentTask();
|
|
285
303
|
}
|
|
286
|
-
} catch {
|
|
304
|
+
} catch (error) {
|
|
305
|
+
console.error('Error in handleSuccessVerify:', error);
|
|
287
306
|
handleFailSendForm();
|
|
288
307
|
}
|
|
289
308
|
};
|