@redneckz/wildless-cms-uni-blocks 0.14.985 → 0.14.987
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/bundle.umd.js +57 -32
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/CalculatorCredit/utils.d.ts +12 -0
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +3 -3
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/dist/components/CalculatorCredit/CalculatorCredit.js +4 -14
- package/dist/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
- package/dist/components/CalculatorCredit/utils.d.ts +12 -0
- package/dist/components/CalculatorCredit/utils.js +18 -0
- package/dist/components/CalculatorCredit/utils.js.map +1 -0
- package/dist/retail/api/getClaimChannel.js +4 -2
- package/dist/retail/api/getClaimChannel.js.map +1 -1
- package/dist/retail/components/Fields/CreditCalcField.js +16 -5
- package/dist/retail/components/Fields/CreditCalcField.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +3 -3
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/lib/components/CalculatorCredit/CalculatorCredit.js +4 -14
- package/lib/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
- package/lib/components/CalculatorCredit/utils.d.ts +12 -0
- package/lib/components/CalculatorCredit/utils.js +15 -0
- package/lib/components/CalculatorCredit/utils.js.map +1 -0
- package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +1 -1
- package/lib/retail/api/getClaimChannel.js +4 -2
- package/lib/retail/api/getClaimChannel.js.map +1 -1
- package/lib/retail/components/Fields/CreditCalcField.js +17 -6
- package/lib/retail/components/Fields/CreditCalcField.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +57 -32
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/CalculatorCredit/utils.d.ts +12 -0
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +3 -3
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/dist/components/CalculatorCredit/CalculatorCredit.js +4 -14
- package/mobile/dist/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
- package/mobile/dist/components/CalculatorCredit/utils.d.ts +12 -0
- package/mobile/dist/components/CalculatorCredit/utils.js +18 -0
- package/mobile/dist/components/CalculatorCredit/utils.js.map +1 -0
- package/mobile/dist/retail/api/getClaimChannel.js +4 -2
- package/mobile/dist/retail/api/getClaimChannel.js.map +1 -1
- package/mobile/dist/retail/components/Fields/CreditCalcField.js +16 -5
- package/mobile/dist/retail/components/Fields/CreditCalcField.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +3 -3
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/lib/components/CalculatorCredit/CalculatorCredit.js +4 -14
- package/mobile/lib/components/CalculatorCredit/CalculatorCredit.js.map +1 -1
- package/mobile/lib/components/CalculatorCredit/utils.d.ts +12 -0
- package/mobile/lib/components/CalculatorCredit/utils.js +15 -0
- package/mobile/lib/components/CalculatorCredit/utils.js.map +1 -0
- package/mobile/lib/retail/api/getClaimChannel.js +4 -2
- package/mobile/lib/retail/api/getClaimChannel.js.map +1 -1
- package/mobile/lib/retail/components/Fields/CreditCalcField.js +17 -6
- package/mobile/lib/retail/components/Fields/CreditCalcField.js.map +1 -1
- package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +3 -3
- package/mobile/src/components/CalculatorCredit/CalculatorCredit.tsx +4 -21
- package/mobile/src/components/CalculatorCredit/utils.ts +20 -0
- package/mobile/src/retail/api/getClaimChannel.ts +8 -6
- package/mobile/src/retail/components/Fields/CreditCalcField.tsx +23 -7
- package/package.json +1 -1
- package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +3 -3
- package/src/components/CalculatorCredit/CalculatorCredit.tsx +4 -21
- package/src/components/CalculatorCredit/utils.ts +20 -0
- package/src/retail/api/getClaimChannel.ts +8 -6
- package/src/retail/components/Fields/CreditCalcField.tsx +23 -7
|
@@ -12,13 +12,15 @@ export const getClaimChannel = async (): Promise<string | undefined> => {
|
|
|
12
12
|
const claimChannelCode = await fetchRetailJSON<GetClaimChannelResponse[]>(
|
|
13
13
|
'/claim-channel/',
|
|
14
14
|
'GET',
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
)
|
|
16
|
+
.then((res) => {
|
|
17
|
+
const url = globalThis.location.href;
|
|
18
|
+
const code = res?.find((_) => _ && url.includes(_.key))?.code;
|
|
19
|
+
globalThis.sessionStorage.setItem('claimChannelCode', code ?? '');
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
return code;
|
|
22
|
+
})
|
|
23
|
+
.catch(() => undefined);
|
|
22
24
|
|
|
23
25
|
return claimChannelCode;
|
|
24
26
|
};
|
|
@@ -1,33 +1,49 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
+
import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { CalculatorCredit } from '../../../components/CalculatorCredit/CalculatorCredit';
|
|
4
4
|
import {
|
|
5
5
|
type CreditCalculatorUserInputParams,
|
|
6
6
|
type CreditDefaultParams,
|
|
7
7
|
} from '../../../components/CalculatorCredit/CalculatorCreditContent';
|
|
8
|
+
import { getCalcParams } from '../../../components/CalculatorCredit/utils';
|
|
8
9
|
import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
|
|
10
|
+
import { Loader } from '../../../ui-kit/Loader/Loader';
|
|
9
11
|
|
|
10
12
|
const FIELD_NAME = 'calculator';
|
|
11
13
|
|
|
12
14
|
export const CreditCalcField = JSX<CustomFieldProps>(({ field, params }) => {
|
|
15
|
+
const [defaultParams, setDefaultParams] = useState<CreditDefaultParams>();
|
|
13
16
|
const calcValue = field(FIELD_NAME)?.value;
|
|
14
|
-
const defaultParams = calcValue
|
|
15
|
-
? defaultValueAdapter(field(FIELD_NAME).value as CreditCalculatorUserInputParams)
|
|
16
|
-
: params?.calcData?.defaultParams;
|
|
17
|
-
const defaultCalcSum = params?.calcData?.defaultParams?.sum ?? 0;
|
|
18
17
|
|
|
19
18
|
const handleChange = useCallback((_: CreditCalculatorUserInputParams) => {
|
|
20
19
|
field(FIELD_NAME).onChange?.(_);
|
|
21
20
|
}, []);
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (params?.calcData?.defaultParams) {
|
|
24
|
+
setDefaultParams(
|
|
25
|
+
calcValue
|
|
26
|
+
? defaultValueAdapter(field(FIELD_NAME).value as CreditCalculatorUserInputParams)
|
|
27
|
+
: (params?.calcData?.defaultParams as CreditDefaultParams),
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}, [params?.calcData?.defaultParams]);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (defaultParams) {
|
|
34
|
+
handleChange(getCalcParams(defaultParams));
|
|
35
|
+
}
|
|
36
|
+
}, [defaultParams]);
|
|
37
|
+
|
|
38
|
+
return defaultParams ? (
|
|
24
39
|
<CalculatorCredit
|
|
25
|
-
key={defaultCalcSum}
|
|
26
40
|
{...params?.calcData}
|
|
27
41
|
defaultParams={defaultParams}
|
|
28
42
|
padding="p-0"
|
|
29
43
|
onChange={handleChange}
|
|
30
44
|
/>
|
|
45
|
+
) : (
|
|
46
|
+
<Loader />
|
|
31
47
|
);
|
|
32
48
|
});
|
|
33
49
|
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ import { createDraftTask } from '../../retail/api/createDraftTask';
|
|
|
8
8
|
import { createParticipant } from '../../retail/api/createParticipant';
|
|
9
9
|
import { createUserProfile } from '../../retail/api/createUserProfile';
|
|
10
10
|
import { createUserTaskDebit } from '../../retail/api/createUserTaskDebit';
|
|
11
|
-
|
|
11
|
+
import { getClaimChannel } from '../../retail/api/getClaimChannel';
|
|
12
12
|
import { getLastTaskStatus } from '../../retail/api/getLastTaskStatus';
|
|
13
13
|
import { getTaskById } from '../../retail/api/getTaskById';
|
|
14
14
|
import { saveReferalInfo } from '../../retail/api/saveReferalInfo';
|
|
@@ -242,13 +242,13 @@ const updateUserData = async ({
|
|
|
242
242
|
|
|
243
243
|
try {
|
|
244
244
|
if (productType === 'debitCard') {
|
|
245
|
-
|
|
245
|
+
const claimChannelCode = await getClaimChannel();
|
|
246
246
|
const debitData = await createUserTaskDebit(
|
|
247
247
|
getDebitLeadFormTaskData({
|
|
248
248
|
formData,
|
|
249
249
|
programId,
|
|
250
250
|
marketingInfo,
|
|
251
|
-
|
|
251
|
+
claimChannelCode,
|
|
252
252
|
}),
|
|
253
253
|
);
|
|
254
254
|
|
|
@@ -2,15 +2,10 @@
|
|
|
2
2
|
import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { type JSONRefObject } from '../../data/JSONRefObject';
|
|
4
4
|
import { useForm, type FormFieldRegisterer } from '../../hooks/useForm/useForm';
|
|
5
|
-
import { DEFAULT_MONTHS } from '../../ui-kit/Calculator/calculatorConstants';
|
|
6
5
|
import { CalculatorLayout } from '../../ui-kit/Calculator/CalculatorLayout';
|
|
7
6
|
import { CalculatorStyle } from '../../ui-kit/Calculator/CalculatorStyle';
|
|
8
7
|
import { CalculatorValue } from '../../ui-kit/Calculator/CalculatorValue';
|
|
9
8
|
import { getDefaultParamsMin } from '../../ui-kit/Calculator/getDefaultParams';
|
|
10
|
-
import {
|
|
11
|
-
getMoneyDefaultValue,
|
|
12
|
-
getMonthsDefaultValue,
|
|
13
|
-
} from '../../ui-kit/Calculator/getDefaultValues';
|
|
14
9
|
import { renderFootnote } from '../../ui-kit/Calculator/renderFootnote';
|
|
15
10
|
import { renderMonthsInput } from '../../ui-kit/Calculator/renderMonthsInput';
|
|
16
11
|
import { renderPaymentType } from '../../ui-kit/Calculator/renderPaymentType';
|
|
@@ -32,8 +27,7 @@ import {
|
|
|
32
27
|
} from './CalculatorCreditContent';
|
|
33
28
|
import { getCreditCalculatorParams } from './getCreditCalculatorParams';
|
|
34
29
|
import { isDefaultParams } from './isDefaultParams';
|
|
35
|
-
|
|
36
|
-
const CREDIT_DEFAULT_SUM = 200000;
|
|
30
|
+
import { getCalcParams } from './utils';
|
|
37
31
|
|
|
38
32
|
const MAP = {
|
|
39
33
|
isSalaryClient: 'isSalaryClient',
|
|
@@ -74,20 +68,9 @@ export const CalculatorCredit = UniBlock<CalculatorDepositProps>(
|
|
|
74
68
|
[paramsViewSettings, calcSource],
|
|
75
69
|
);
|
|
76
70
|
|
|
77
|
-
const [userInputParams, { field }] = useForm(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
monthsValue: getMonthsDefaultValue(defaultParams, DEFAULT_MONTHS),
|
|
81
|
-
monthlyPayment: 0,
|
|
82
|
-
rate: 0,
|
|
83
|
-
isAnnuity: Boolean(defaultParams?.isAnnuity),
|
|
84
|
-
isInsurance: Boolean(defaultParams?.isEnableInsurance),
|
|
85
|
-
isSalaryClient: Boolean(defaultParams?.isEnableSalaryClient),
|
|
86
|
-
isPensionClient: Boolean(defaultParams?.isEnablePensionClient),
|
|
87
|
-
isStateEmployee: Boolean(defaultParams?.isEnableStateEmployee),
|
|
88
|
-
},
|
|
89
|
-
{ onChange: handleChange },
|
|
90
|
-
);
|
|
71
|
+
const [userInputParams, { field }] = useForm(getCalcParams(defaultParams), {
|
|
72
|
+
onChange: handleChange,
|
|
73
|
+
});
|
|
91
74
|
|
|
92
75
|
const calcParams = getCreditCalculatorParams(userInputParams, calcSource, paramsViewSettings);
|
|
93
76
|
const paymentTypeElement = renderPaymentType({
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DEFAULT_MONTHS } from '../../ui-kit/Calculator/calculatorConstants';
|
|
2
|
+
import {
|
|
3
|
+
getMoneyDefaultValue,
|
|
4
|
+
getMonthsDefaultValue,
|
|
5
|
+
} from '../../ui-kit/Calculator/getDefaultValues';
|
|
6
|
+
import { type CreditDefaultParams } from './CalculatorCreditContent';
|
|
7
|
+
|
|
8
|
+
const CREDIT_DEFAULT_SUM = 200000;
|
|
9
|
+
|
|
10
|
+
export const getCalcParams = (defaultParams?: CreditDefaultParams) => ({
|
|
11
|
+
moneyValue: getMoneyDefaultValue(defaultParams, CREDIT_DEFAULT_SUM),
|
|
12
|
+
monthsValue: getMonthsDefaultValue(defaultParams, DEFAULT_MONTHS),
|
|
13
|
+
monthlyPayment: 0,
|
|
14
|
+
rate: 0,
|
|
15
|
+
isAnnuity: Boolean(defaultParams?.isAnnuity),
|
|
16
|
+
isInsurance: Boolean(defaultParams?.isEnableInsurance),
|
|
17
|
+
isSalaryClient: Boolean(defaultParams?.isEnableSalaryClient),
|
|
18
|
+
isPensionClient: Boolean(defaultParams?.isEnablePensionClient),
|
|
19
|
+
isStateEmployee: Boolean(defaultParams?.isEnableStateEmployee),
|
|
20
|
+
});
|
|
@@ -12,13 +12,15 @@ export const getClaimChannel = async (): Promise<string | undefined> => {
|
|
|
12
12
|
const claimChannelCode = await fetchRetailJSON<GetClaimChannelResponse[]>(
|
|
13
13
|
'/claim-channel/',
|
|
14
14
|
'GET',
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
)
|
|
16
|
+
.then((res) => {
|
|
17
|
+
const url = globalThis.location.href;
|
|
18
|
+
const code = res?.find((_) => _ && url.includes(_.key))?.code;
|
|
19
|
+
globalThis.sessionStorage.setItem('claimChannelCode', code ?? '');
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
return code;
|
|
22
|
+
})
|
|
23
|
+
.catch(() => undefined);
|
|
22
24
|
|
|
23
25
|
return claimChannelCode;
|
|
24
26
|
};
|
|
@@ -1,33 +1,49 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
+
import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { CalculatorCredit } from '../../../components/CalculatorCredit/CalculatorCredit';
|
|
4
4
|
import {
|
|
5
5
|
type CreditCalculatorUserInputParams,
|
|
6
6
|
type CreditDefaultParams,
|
|
7
7
|
} from '../../../components/CalculatorCredit/CalculatorCreditContent';
|
|
8
|
+
import { getCalcParams } from '../../../components/CalculatorCredit/utils';
|
|
8
9
|
import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
|
|
10
|
+
import { Loader } from '../../../ui-kit/Loader/Loader';
|
|
9
11
|
|
|
10
12
|
const FIELD_NAME = 'calculator';
|
|
11
13
|
|
|
12
14
|
export const CreditCalcField = JSX<CustomFieldProps>(({ field, params }) => {
|
|
15
|
+
const [defaultParams, setDefaultParams] = useState<CreditDefaultParams>();
|
|
13
16
|
const calcValue = field(FIELD_NAME)?.value;
|
|
14
|
-
const defaultParams = calcValue
|
|
15
|
-
? defaultValueAdapter(field(FIELD_NAME).value as CreditCalculatorUserInputParams)
|
|
16
|
-
: params?.calcData?.defaultParams;
|
|
17
|
-
const defaultCalcSum = params?.calcData?.defaultParams?.sum ?? 0;
|
|
18
17
|
|
|
19
18
|
const handleChange = useCallback((_: CreditCalculatorUserInputParams) => {
|
|
20
19
|
field(FIELD_NAME).onChange?.(_);
|
|
21
20
|
}, []);
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (params?.calcData?.defaultParams) {
|
|
24
|
+
setDefaultParams(
|
|
25
|
+
calcValue
|
|
26
|
+
? defaultValueAdapter(field(FIELD_NAME).value as CreditCalculatorUserInputParams)
|
|
27
|
+
: (params?.calcData?.defaultParams as CreditDefaultParams),
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}, [params?.calcData?.defaultParams]);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (defaultParams) {
|
|
34
|
+
handleChange(getCalcParams(defaultParams));
|
|
35
|
+
}
|
|
36
|
+
}, [defaultParams]);
|
|
37
|
+
|
|
38
|
+
return defaultParams ? (
|
|
24
39
|
<CalculatorCredit
|
|
25
|
-
key={defaultCalcSum}
|
|
26
40
|
{...params?.calcData}
|
|
27
41
|
defaultParams={defaultParams}
|
|
28
42
|
padding="p-0"
|
|
29
43
|
onChange={handleChange}
|
|
30
44
|
/>
|
|
45
|
+
) : (
|
|
46
|
+
<Loader />
|
|
31
47
|
);
|
|
32
48
|
});
|
|
33
49
|
|