@redneckz/wildless-cms-uni-blocks 0.14.704 → 0.14.706
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 +62 -33
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationLeadForm/LeadFormState.d.ts +1 -1
- package/bundle/components/CreditCardForm/useCreditCardFormAPI.d.ts +10 -0
- package/bundle/components/CreditForm/useCreditFormAPI.d.ts +10 -0
- package/dist/api/RetailAPI/sendCode.js +1 -1
- package/dist/api/RetailAPI/sendCode.js.map +1 -1
- package/dist/components/ApplicationLeadForm/LeadFormState.d.ts +1 -1
- package/dist/components/CreditCardForm/PendingStatusContent.js +2 -2
- package/dist/components/CreditCardForm/PendingStatusContent.js.map +1 -1
- package/dist/components/CreditCardForm/ReworkStatusContent.js +3 -3
- package/dist/components/CreditCardForm/ReworkStatusContent.js.map +1 -1
- package/dist/components/CreditCardForm/SuccessStatusContent.js +3 -3
- package/dist/components/CreditCardForm/SuccessStatusContent.js.map +1 -1
- package/dist/components/CreditCardForm/formStateMap.js +1 -1
- package/dist/components/CreditCardForm/formStateMap.js.map +1 -1
- package/dist/components/CreditCardForm/useCreditCardFormAPI.d.ts +10 -0
- package/dist/components/CreditCardForm/useCreditCardFormAPI.js +14 -3
- package/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/dist/components/CreditForm/PendingStatusContent.js +4 -4
- package/dist/components/CreditForm/PendingStatusContent.js.map +1 -1
- package/dist/components/CreditForm/ReworkStatusContent.js +3 -3
- package/dist/components/CreditForm/ReworkStatusContent.js.map +1 -1
- package/dist/components/CreditForm/SuccessStatusContent.js +3 -3
- package/dist/components/CreditForm/SuccessStatusContent.js.map +1 -1
- package/dist/components/CreditForm/formStateMap.js +1 -1
- package/dist/components/CreditForm/formStateMap.js.map +1 -1
- package/dist/components/CreditForm/useCreditFormAPI.d.ts +10 -0
- package/dist/components/CreditForm/useCreditFormAPI.js +19 -3
- package/dist/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/SnilsField.js +1 -1
- package/dist/ui-kit/FormField/Fields/SnilsField.js.map +1 -1
- package/dist/ui-kit/Input/InputSnilsControl.js +1 -1
- package/dist/ui-kit/Input/InputSnilsControl.js.map +1 -1
- package/dist/ui-kit/SnilsInput/SnilsInput.js +4 -2
- package/dist/ui-kit/SnilsInput/SnilsInput.js.map +1 -1
- package/dist/utils/normalizeWithMask.js +1 -1
- package/dist/utils/normalizeWithMask.js.map +1 -1
- package/lib/api/RetailAPI/sendCode.js +1 -1
- package/lib/api/RetailAPI/sendCode.js.map +1 -1
- package/lib/components/ApplicationLeadForm/LeadFormState.d.ts +1 -1
- package/lib/components/CreditCardForm/PendingStatusContent.js +2 -2
- package/lib/components/CreditCardForm/PendingStatusContent.js.map +1 -1
- package/lib/components/CreditCardForm/ReworkStatusContent.js +3 -3
- package/lib/components/CreditCardForm/ReworkStatusContent.js.map +1 -1
- package/lib/components/CreditCardForm/SuccessStatusContent.js +3 -3
- package/lib/components/CreditCardForm/SuccessStatusContent.js.map +1 -1
- package/lib/components/CreditCardForm/formStateMap.js +1 -1
- package/lib/components/CreditCardForm/formStateMap.js.map +1 -1
- package/lib/components/CreditCardForm/useCreditCardFormAPI.d.ts +10 -0
- package/lib/components/CreditCardForm/useCreditCardFormAPI.js +14 -3
- package/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/lib/components/CreditForm/PendingStatusContent.js +4 -4
- package/lib/components/CreditForm/PendingStatusContent.js.map +1 -1
- package/lib/components/CreditForm/ReworkStatusContent.js +3 -3
- package/lib/components/CreditForm/ReworkStatusContent.js.map +1 -1
- package/lib/components/CreditForm/SuccessStatusContent.js +3 -3
- package/lib/components/CreditForm/SuccessStatusContent.js.map +1 -1
- package/lib/components/CreditForm/formStateMap.js +1 -1
- package/lib/components/CreditForm/formStateMap.js.map +1 -1
- package/lib/components/CreditForm/useCreditFormAPI.d.ts +10 -0
- package/lib/components/CreditForm/useCreditFormAPI.js +19 -3
- package/lib/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/SnilsField.js +1 -1
- package/lib/ui-kit/FormField/Fields/SnilsField.js.map +1 -1
- package/lib/ui-kit/Input/InputSnilsControl.js +1 -1
- package/lib/ui-kit/Input/InputSnilsControl.js.map +1 -1
- package/lib/ui-kit/SnilsInput/SnilsInput.js +4 -2
- package/lib/ui-kit/SnilsInput/SnilsInput.js.map +1 -1
- package/lib/utils/normalizeWithMask.js +1 -1
- package/lib/utils/normalizeWithMask.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +62 -33
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/LeadFormState.d.ts +1 -1
- package/mobile/bundle/components/CreditCardForm/useCreditCardFormAPI.d.ts +10 -0
- package/mobile/bundle/components/CreditForm/useCreditFormAPI.d.ts +10 -0
- package/mobile/dist/api/RetailAPI/sendCode.js +1 -1
- package/mobile/dist/api/RetailAPI/sendCode.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/LeadFormState.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/PendingStatusContent.js +2 -2
- package/mobile/dist/components/CreditCardForm/PendingStatusContent.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/ReworkStatusContent.js +3 -3
- package/mobile/dist/components/CreditCardForm/ReworkStatusContent.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/SuccessStatusContent.js +3 -3
- package/mobile/dist/components/CreditCardForm/SuccessStatusContent.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/formStateMap.js +1 -1
- package/mobile/dist/components/CreditCardForm/formStateMap.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.d.ts +10 -0
- package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js +14 -3
- package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/mobile/dist/components/CreditForm/PendingStatusContent.js +4 -4
- package/mobile/dist/components/CreditForm/PendingStatusContent.js.map +1 -1
- package/mobile/dist/components/CreditForm/ReworkStatusContent.js +3 -3
- package/mobile/dist/components/CreditForm/ReworkStatusContent.js.map +1 -1
- package/mobile/dist/components/CreditForm/SuccessStatusContent.js +3 -3
- package/mobile/dist/components/CreditForm/SuccessStatusContent.js.map +1 -1
- package/mobile/dist/components/CreditForm/formStateMap.js +1 -1
- package/mobile/dist/components/CreditForm/formStateMap.js.map +1 -1
- package/mobile/dist/components/CreditForm/useCreditFormAPI.d.ts +10 -0
- package/mobile/dist/components/CreditForm/useCreditFormAPI.js +19 -3
- package/mobile/dist/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/SnilsField.js +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/SnilsField.js.map +1 -1
- package/mobile/dist/ui-kit/Input/InputSnilsControl.js +1 -1
- package/mobile/dist/ui-kit/Input/InputSnilsControl.js.map +1 -1
- package/mobile/dist/ui-kit/SnilsInput/SnilsInput.js +4 -2
- package/mobile/dist/ui-kit/SnilsInput/SnilsInput.js.map +1 -1
- package/mobile/dist/utils/normalizeWithMask.js +1 -1
- package/mobile/dist/utils/normalizeWithMask.js.map +1 -1
- package/mobile/lib/api/RetailAPI/sendCode.js +1 -1
- package/mobile/lib/api/RetailAPI/sendCode.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/LeadFormState.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/PendingStatusContent.js +2 -2
- package/mobile/lib/components/CreditCardForm/PendingStatusContent.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/ReworkStatusContent.js +3 -3
- package/mobile/lib/components/CreditCardForm/ReworkStatusContent.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/SuccessStatusContent.js +3 -3
- package/mobile/lib/components/CreditCardForm/SuccessStatusContent.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/formStateMap.js +1 -1
- package/mobile/lib/components/CreditCardForm/formStateMap.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.d.ts +10 -0
- package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js +14 -3
- package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/mobile/lib/components/CreditForm/PendingStatusContent.js +4 -4
- package/mobile/lib/components/CreditForm/PendingStatusContent.js.map +1 -1
- package/mobile/lib/components/CreditForm/ReworkStatusContent.js +3 -3
- package/mobile/lib/components/CreditForm/ReworkStatusContent.js.map +1 -1
- package/mobile/lib/components/CreditForm/SuccessStatusContent.js +3 -3
- package/mobile/lib/components/CreditForm/SuccessStatusContent.js.map +1 -1
- package/mobile/lib/components/CreditForm/formStateMap.js +1 -1
- package/mobile/lib/components/CreditForm/formStateMap.js.map +1 -1
- package/mobile/lib/components/CreditForm/useCreditFormAPI.d.ts +10 -0
- package/mobile/lib/components/CreditForm/useCreditFormAPI.js +19 -3
- package/mobile/lib/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/SnilsField.js +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/SnilsField.js.map +1 -1
- package/mobile/lib/ui-kit/Input/InputSnilsControl.js +1 -1
- package/mobile/lib/ui-kit/Input/InputSnilsControl.js.map +1 -1
- package/mobile/lib/ui-kit/SnilsInput/SnilsInput.js +4 -2
- package/mobile/lib/ui-kit/SnilsInput/SnilsInput.js.map +1 -1
- package/mobile/lib/utils/normalizeWithMask.js +1 -1
- package/mobile/lib/utils/normalizeWithMask.js.map +1 -1
- package/mobile/src/api/RetailAPI/sendCode.ts +1 -1
- package/mobile/src/components/ApplicationLeadForm/LeadFormState.ts +1 -1
- package/mobile/src/components/CreditCardForm/PendingStatusContent.tsx +3 -2
- package/mobile/src/components/CreditCardForm/ReworkStatusContent.tsx +4 -3
- package/mobile/src/components/CreditCardForm/SuccessStatusContent.tsx +4 -3
- package/mobile/src/components/CreditCardForm/formStateMap.tsx +1 -1
- package/mobile/src/components/CreditCardForm/useCreditCardFormAPI.tsx +37 -3
- package/mobile/src/components/CreditForm/PendingStatusContent.tsx +5 -5
- package/mobile/src/components/CreditForm/ReworkStatusContent.tsx +4 -3
- package/mobile/src/components/CreditForm/SuccessStatusContent.tsx +4 -3
- package/mobile/src/components/CreditForm/formStateMap.tsx +1 -1
- package/mobile/src/components/CreditForm/useCreditFormAPI.tsx +42 -3
- package/mobile/src/ui-kit/FormField/Fields/SnilsField.tsx +1 -0
- package/mobile/src/ui-kit/Input/InputSnilsControl.tsx +1 -0
- package/mobile/src/ui-kit/SnilsInput/SnilsInput.tsx +5 -2
- package/mobile/src/utils/normalizeWithMask.ts +1 -1
- package/package.json +1 -1
- package/src/api/RetailAPI/sendCode.ts +1 -1
- package/src/components/ApplicationLeadForm/LeadFormState.ts +1 -1
- package/src/components/CreditCardForm/PendingStatusContent.tsx +3 -2
- package/src/components/CreditCardForm/ReworkStatusContent.tsx +4 -3
- package/src/components/CreditCardForm/SuccessStatusContent.tsx +4 -3
- package/src/components/CreditCardForm/formStateMap.tsx +1 -1
- package/src/components/CreditCardForm/useCreditCardFormAPI.tsx +37 -3
- package/src/components/CreditForm/PendingStatusContent.tsx +5 -5
- package/src/components/CreditForm/ReworkStatusContent.tsx +4 -3
- package/src/components/CreditForm/SuccessStatusContent.tsx +4 -3
- package/src/components/CreditForm/formStateMap.tsx +1 -1
- package/src/components/CreditForm/useCreditFormAPI.tsx +42 -3
- package/src/ui-kit/FormField/Fields/SnilsField.tsx +1 -0
- package/src/ui-kit/Input/InputSnilsControl.tsx +1 -0
- package/src/ui-kit/SnilsInput/SnilsInput.tsx +5 -2
- package/src/utils/normalizeWithMask.ts +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
|
3
|
-
import { type LeadFormState } from '../ApplicationLeadForm/LeadFormState';
|
|
4
3
|
import { CreditFormStatus } from './CreditFormStatus';
|
|
4
|
+
import { type StatusInfoState } from './useCreditFormAPI';
|
|
5
5
|
|
|
6
6
|
export const PendingStatusContent = JSX(
|
|
7
7
|
({ handleExpireTimer }: { handleExpireTimer: () => void }) => {
|
|
8
|
-
const [
|
|
8
|
+
const [statusInfo] = useLocalStorage<StatusInfoState>('statusInfo');
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
11
|
<CreditFormStatus
|
|
@@ -25,15 +25,15 @@ export const PendingStatusContent = JSX(
|
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
label: 'Сумма',
|
|
28
|
-
description: `${
|
|
28
|
+
description: `${statusInfo?.calculator?.moneyValue?.toLocaleString() ?? '0'} ₽`,
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
label: 'Срок кредита',
|
|
32
|
-
description: `${
|
|
32
|
+
description: `${statusInfo?.calculator?.monthsValue ?? '0'} мес`,
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
label: 'Тип платежа',
|
|
36
|
-
description:
|
|
36
|
+
description: statusInfo?.calculator?.isAnnuity ? 'Аннуитетный' : 'Дифференцированный',
|
|
37
37
|
},
|
|
38
38
|
]}
|
|
39
39
|
/>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
|
3
3
|
import { CreditFormStatus } from './CreditFormStatus';
|
|
4
|
+
import { type StatusInfoState } from './useCreditFormAPI';
|
|
4
5
|
|
|
5
6
|
export const ReworkStatusContent = JSX(() => {
|
|
6
|
-
const [
|
|
7
|
+
const [statusInfo] = useLocalStorage<StatusInfoState>('statusInfo');
|
|
7
8
|
|
|
8
9
|
return (
|
|
9
10
|
<CreditFormStatus
|
|
@@ -13,11 +14,11 @@ export const ReworkStatusContent = JSX(() => {
|
|
|
13
14
|
sectionInfoAdditional={[
|
|
14
15
|
{
|
|
15
16
|
label: 'Регион',
|
|
16
|
-
description:
|
|
17
|
+
description: statusInfo?.regionRetail,
|
|
17
18
|
},
|
|
18
19
|
{
|
|
19
20
|
label: 'Адрес',
|
|
20
|
-
description:
|
|
21
|
+
description: statusInfo?.addressRetail,
|
|
21
22
|
},
|
|
22
23
|
]}
|
|
23
24
|
sectionInfo={[
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
|
3
3
|
import { CreditFormStatus } from './CreditFormStatus';
|
|
4
|
+
import { type StatusInfoState } from './useCreditFormAPI';
|
|
4
5
|
|
|
5
6
|
export const SuccessStatusContent = JSX(() => {
|
|
6
|
-
const [
|
|
7
|
+
const [statusInfo] = useLocalStorage<StatusInfoState>('statusInfo');
|
|
7
8
|
|
|
8
9
|
return (
|
|
9
10
|
<CreditFormStatus
|
|
@@ -24,11 +25,11 @@ export const SuccessStatusContent = JSX(() => {
|
|
|
24
25
|
},
|
|
25
26
|
{
|
|
26
27
|
label: 'Срок кредита',
|
|
27
|
-
description:
|
|
28
|
+
description: statusInfo?.calculator?.monthsValue + ' мес',
|
|
28
29
|
},
|
|
29
30
|
{
|
|
30
31
|
label: 'Тип платежа',
|
|
31
|
-
description:
|
|
32
|
+
description: statusInfo?.calculator?.isAnnuity ? 'Аннуитетный' : 'Дифференцированный',
|
|
32
33
|
},
|
|
33
34
|
]}
|
|
34
35
|
buttonText="Вернуться на главную"
|
|
@@ -17,6 +17,17 @@ type CreditFormApiProps = {
|
|
|
17
17
|
finishForm?: (bool: boolean) => void;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
export type StatusInfoState = {
|
|
21
|
+
regionRetail?: string;
|
|
22
|
+
addressRetail?: string;
|
|
23
|
+
cardCategory?: string;
|
|
24
|
+
calculator?: {
|
|
25
|
+
monthsValue?: number;
|
|
26
|
+
moneyValue?: number;
|
|
27
|
+
isAnnuity?: boolean;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
20
31
|
export const useCreditFormAPI = ({
|
|
21
32
|
step,
|
|
22
33
|
inputs,
|
|
@@ -28,6 +39,8 @@ export const useCreditFormAPI = ({
|
|
|
28
39
|
const [taskId] = useLocalStorage<number>('taskId');
|
|
29
40
|
const [profileId] = useLocalStorage<number>('profileId');
|
|
30
41
|
const [participantId] = useLocalStorage<number>('participantId');
|
|
42
|
+
const [, setStatusInfo] = useLocalStorage('statusInfo');
|
|
43
|
+
const [leadForm] = useLocalStorage<LeadFormState>('leadForm');
|
|
31
44
|
|
|
32
45
|
const handleSubmit = useCallback(async (formData: LeadFormState) => {
|
|
33
46
|
const feedbackValidator = objectValidator(
|
|
@@ -51,7 +64,7 @@ export const useCreditFormAPI = ({
|
|
|
51
64
|
formData: formData as any,
|
|
52
65
|
}),
|
|
53
66
|
);
|
|
54
|
-
resetForm(isFinalStep, response);
|
|
67
|
+
resetForm({ isFinalStep, response, leadForm, setStatusInfo });
|
|
55
68
|
}
|
|
56
69
|
} catch (ex) {
|
|
57
70
|
return 'Fail';
|
|
@@ -71,8 +84,34 @@ export const useCreditFormAPI = ({
|
|
|
71
84
|
};
|
|
72
85
|
};
|
|
73
86
|
|
|
74
|
-
const resetForm = (
|
|
75
|
-
|
|
87
|
+
const resetForm = ({
|
|
88
|
+
isFinalStep,
|
|
89
|
+
response,
|
|
90
|
+
leadForm,
|
|
91
|
+
setStatusInfo,
|
|
92
|
+
}: {
|
|
93
|
+
isFinalStep: boolean;
|
|
94
|
+
response: Response;
|
|
95
|
+
leadForm: LeadFormState | null;
|
|
96
|
+
setStatusInfo: (statusInfo: StatusInfoState) => void;
|
|
97
|
+
}) => {
|
|
98
|
+
if (isFinalStep && response.ok && leadForm !== null) {
|
|
99
|
+
const regionRetail = leadForm?.regionRetail?.text;
|
|
100
|
+
const addressRetail = leadForm?.addressRetail?.text;
|
|
101
|
+
const cardCategory = leadForm?.cardCategory?.text;
|
|
102
|
+
const calculator = {
|
|
103
|
+
monthsValue: leadForm?.calculator?.monthsValue,
|
|
104
|
+
moneyValue: leadForm?.calculator?.moneyValue,
|
|
105
|
+
isAnnuity: leadForm?.calculator?.isAnnuity,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
setStatusInfo({
|
|
109
|
+
regionRetail,
|
|
110
|
+
addressRetail,
|
|
111
|
+
cardCategory,
|
|
112
|
+
calculator,
|
|
113
|
+
});
|
|
114
|
+
|
|
76
115
|
globalThis.localStorage.removeItem('leadForm');
|
|
77
116
|
}
|
|
78
117
|
};
|
|
@@ -7,6 +7,7 @@ import { getValidation } from '../getValidation';
|
|
|
7
7
|
export const SnilsField = JSX<CustomFieldProps>(({ field, input }) => (
|
|
8
8
|
<InputSnilsControl
|
|
9
9
|
label="СНИЛС"
|
|
10
|
+
maxLength={14}
|
|
10
11
|
{...getValidation(field('snils'), validatorObj.snils, input?.required)}
|
|
11
12
|
{...input}
|
|
12
13
|
/>
|
|
@@ -4,9 +4,12 @@ import { normalizeWithMask } from '../../utils/normalizeWithMask';
|
|
|
4
4
|
import { Input } from '../Input/Input';
|
|
5
5
|
import { type InputProps } from '../Input/InputProps';
|
|
6
6
|
|
|
7
|
-
export const SnilsInput = JSX<InputProps>(({ children, onChange, ...inputProps }) => {
|
|
7
|
+
export const SnilsInput = JSX<InputProps>(({ children, onChange, maxLength, ...inputProps }) => {
|
|
8
8
|
const handleChange = useCallback(
|
|
9
|
-
(v: string) =>
|
|
9
|
+
(v: string) =>
|
|
10
|
+
maxLength
|
|
11
|
+
? v.length <= maxLength && onChange?.(normalizeWithMask(v, '___-___-___ __'))
|
|
12
|
+
: onChange?.(normalizeWithMask(v, '___-___-___ __')),
|
|
10
13
|
[onChange],
|
|
11
14
|
);
|
|
12
15
|
const handleBlur = useCallback((v: string) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export function normalizeWithMask(value: string, pattern: string): string {
|
|
2
2
|
const valueNumbers = value.replace(/\D/g, '');
|
|
3
|
-
if (valueNumbers === '' ||
|
|
3
|
+
if (valueNumbers === '' || valueNumbers.length === pattern.length) {
|
|
4
4
|
return value;
|
|
5
5
|
}
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -21,4 +21,4 @@ const isErrorResult = (
|
|
|
21
21
|
): res is SendCodeErrorResult =>
|
|
22
22
|
Boolean(res) &&
|
|
23
23
|
typeof res !== 'string' &&
|
|
24
|
-
Boolean(res?.errorMessage
|
|
24
|
+
Boolean(res?.errorMessage?.startsWith(`Too many request for phoneNumber [${phoneNumber}]`));
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
|
3
3
|
import { CreditCardFormStatus } from './CreditCardFormStatus';
|
|
4
|
+
import { type StatusInfoState } from './useCreditCardFormAPI';
|
|
4
5
|
|
|
5
6
|
export const PendingStatusContent = JSX(
|
|
6
7
|
({ handleExpireTimer }: { handleExpireTimer: () => void }) => {
|
|
7
|
-
const [
|
|
8
|
+
const [statusInfo] = useLocalStorage<StatusInfoState>('statusInfo');
|
|
8
9
|
|
|
9
10
|
return (
|
|
10
11
|
<CreditCardFormStatus
|
|
@@ -20,7 +21,7 @@ export const PendingStatusContent = JSX(
|
|
|
20
21
|
},
|
|
21
22
|
{
|
|
22
23
|
label: 'Категория',
|
|
23
|
-
description:
|
|
24
|
+
description: statusInfo?.cardCategory,
|
|
24
25
|
},
|
|
25
26
|
]}
|
|
26
27
|
/>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
|
3
3
|
import { CreditCardFormStatus } from './CreditCardFormStatus';
|
|
4
|
+
import { type StatusInfoState } from './useCreditCardFormAPI';
|
|
4
5
|
|
|
5
6
|
export const ReworkStatusContent = JSX(() => {
|
|
6
|
-
const [
|
|
7
|
+
const [statusInfo] = useLocalStorage<StatusInfoState>('statusInfo');
|
|
7
8
|
|
|
8
9
|
return (
|
|
9
10
|
<CreditCardFormStatus
|
|
@@ -13,11 +14,11 @@ export const ReworkStatusContent = JSX(() => {
|
|
|
13
14
|
sectionInfoAdditional={[
|
|
14
15
|
{
|
|
15
16
|
label: 'Регион',
|
|
16
|
-
description:
|
|
17
|
+
description: statusInfo?.regionRetail,
|
|
17
18
|
},
|
|
18
19
|
{
|
|
19
20
|
label: 'Адрес',
|
|
20
|
-
description:
|
|
21
|
+
description: statusInfo?.addressRetail,
|
|
21
22
|
},
|
|
22
23
|
]}
|
|
23
24
|
sectionInfo={[
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
|
3
3
|
import { CreditCardFormStatus } from './CreditCardFormStatus';
|
|
4
|
+
import { type StatusInfoState } from './useCreditCardFormAPI';
|
|
4
5
|
|
|
5
6
|
export const SuccessStatusContent = JSX(() => {
|
|
6
|
-
const [
|
|
7
|
+
const [statusInfo] = useLocalStorage<StatusInfoState>('statusInfo');
|
|
7
8
|
|
|
8
9
|
return (
|
|
9
10
|
<CreditCardFormStatus
|
|
@@ -24,11 +25,11 @@ export const SuccessStatusContent = JSX(() => {
|
|
|
24
25
|
},
|
|
25
26
|
{
|
|
26
27
|
label: 'Срок кредита',
|
|
27
|
-
description:
|
|
28
|
+
description: statusInfo?.calculator?.monthsValue + ' мес',
|
|
28
29
|
},
|
|
29
30
|
{
|
|
30
31
|
label: 'Тип платежа',
|
|
31
|
-
description:
|
|
32
|
+
description: statusInfo?.calculator?.isAnnuity ? 'Аннуитетный' : 'Дифференцированный',
|
|
32
33
|
},
|
|
33
34
|
]}
|
|
34
35
|
buttonText="Вернуться на главную"
|
|
@@ -17,6 +17,17 @@ type CreditCardFormApiProps = {
|
|
|
17
17
|
finishForm?: (bool: boolean) => void;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
export type StatusInfoState = {
|
|
21
|
+
regionRetail?: string;
|
|
22
|
+
addressRetail?: string;
|
|
23
|
+
cardCategory?: string;
|
|
24
|
+
calculator?: {
|
|
25
|
+
monthsValue?: number;
|
|
26
|
+
moneyValue?: number;
|
|
27
|
+
isAnnuity?: boolean;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
20
31
|
export const useCreditCardFormAPI = ({
|
|
21
32
|
step,
|
|
22
33
|
inputs,
|
|
@@ -28,6 +39,8 @@ export const useCreditCardFormAPI = ({
|
|
|
28
39
|
const [taskId] = useLocalStorage<number>('taskId');
|
|
29
40
|
const [profileId] = useLocalStorage<number>('profileId');
|
|
30
41
|
const [participantId] = useLocalStorage<number>('participantId');
|
|
42
|
+
const [, setStatusInfo] = useLocalStorage('statusInfo');
|
|
43
|
+
const [leadForm] = useLocalStorage<LeadFormState>('leadForm');
|
|
31
44
|
|
|
32
45
|
const handleSubmit = useCallback(async (formData: LeadFormState) => {
|
|
33
46
|
const feedbackValidator = objectValidator(
|
|
@@ -51,7 +64,7 @@ export const useCreditCardFormAPI = ({
|
|
|
51
64
|
formData: formData as any,
|
|
52
65
|
}),
|
|
53
66
|
);
|
|
54
|
-
resetForm(isFinalStep, response);
|
|
67
|
+
resetForm({ isFinalStep, response, leadForm, setStatusInfo });
|
|
55
68
|
}
|
|
56
69
|
} catch (ex) {
|
|
57
70
|
return 'Fail';
|
|
@@ -71,8 +84,29 @@ export const useCreditCardFormAPI = ({
|
|
|
71
84
|
};
|
|
72
85
|
};
|
|
73
86
|
|
|
74
|
-
const resetForm = (
|
|
75
|
-
|
|
87
|
+
const resetForm = ({
|
|
88
|
+
isFinalStep,
|
|
89
|
+
response,
|
|
90
|
+
leadForm,
|
|
91
|
+
setStatusInfo,
|
|
92
|
+
}: {
|
|
93
|
+
isFinalStep: boolean;
|
|
94
|
+
response: Response;
|
|
95
|
+
leadForm: LeadFormState | null;
|
|
96
|
+
setStatusInfo: (statusInfo: StatusInfoState) => void;
|
|
97
|
+
}) => {
|
|
98
|
+
if (isFinalStep && response.ok && leadForm) {
|
|
99
|
+
const regionRetail = leadForm?.regionRetail?.text;
|
|
100
|
+
const addressRetail = leadForm?.addressRetail?.text;
|
|
101
|
+
const cardCategory = leadForm?.cardCategory?.text;
|
|
102
|
+
const calculator = {
|
|
103
|
+
monthsValue: leadForm?.calculator?.monthsValue,
|
|
104
|
+
moneyValue: leadForm?.calculator?.moneyValue,
|
|
105
|
+
isAnnuity: leadForm?.calculator?.isAnnuity,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
setStatusInfo({ regionRetail, addressRetail, cardCategory, calculator });
|
|
109
|
+
|
|
76
110
|
globalThis.localStorage.removeItem('leadForm');
|
|
77
111
|
}
|
|
78
112
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
|
3
|
-
import { type LeadFormState } from '../ApplicationLeadForm/LeadFormState';
|
|
4
3
|
import { CreditFormStatus } from './CreditFormStatus';
|
|
4
|
+
import { type StatusInfoState } from './useCreditFormAPI';
|
|
5
5
|
|
|
6
6
|
export const PendingStatusContent = JSX(
|
|
7
7
|
({ handleExpireTimer }: { handleExpireTimer: () => void }) => {
|
|
8
|
-
const [
|
|
8
|
+
const [statusInfo] = useLocalStorage<StatusInfoState>('statusInfo');
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
11
|
<CreditFormStatus
|
|
@@ -25,15 +25,15 @@ export const PendingStatusContent = JSX(
|
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
label: 'Сумма',
|
|
28
|
-
description: `${
|
|
28
|
+
description: `${statusInfo?.calculator?.moneyValue?.toLocaleString() ?? '0'} ₽`,
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
label: 'Срок кредита',
|
|
32
|
-
description: `${
|
|
32
|
+
description: `${statusInfo?.calculator?.monthsValue ?? '0'} мес`,
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
label: 'Тип платежа',
|
|
36
|
-
description:
|
|
36
|
+
description: statusInfo?.calculator?.isAnnuity ? 'Аннуитетный' : 'Дифференцированный',
|
|
37
37
|
},
|
|
38
38
|
]}
|
|
39
39
|
/>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
|
3
3
|
import { CreditFormStatus } from './CreditFormStatus';
|
|
4
|
+
import { type StatusInfoState } from './useCreditFormAPI';
|
|
4
5
|
|
|
5
6
|
export const ReworkStatusContent = JSX(() => {
|
|
6
|
-
const [
|
|
7
|
+
const [statusInfo] = useLocalStorage<StatusInfoState>('statusInfo');
|
|
7
8
|
|
|
8
9
|
return (
|
|
9
10
|
<CreditFormStatus
|
|
@@ -13,11 +14,11 @@ export const ReworkStatusContent = JSX(() => {
|
|
|
13
14
|
sectionInfoAdditional={[
|
|
14
15
|
{
|
|
15
16
|
label: 'Регион',
|
|
16
|
-
description:
|
|
17
|
+
description: statusInfo?.regionRetail,
|
|
17
18
|
},
|
|
18
19
|
{
|
|
19
20
|
label: 'Адрес',
|
|
20
|
-
description:
|
|
21
|
+
description: statusInfo?.addressRetail,
|
|
21
22
|
},
|
|
22
23
|
]}
|
|
23
24
|
sectionInfo={[
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
|
3
3
|
import { CreditFormStatus } from './CreditFormStatus';
|
|
4
|
+
import { type StatusInfoState } from './useCreditFormAPI';
|
|
4
5
|
|
|
5
6
|
export const SuccessStatusContent = JSX(() => {
|
|
6
|
-
const [
|
|
7
|
+
const [statusInfo] = useLocalStorage<StatusInfoState>('statusInfo');
|
|
7
8
|
|
|
8
9
|
return (
|
|
9
10
|
<CreditFormStatus
|
|
@@ -24,11 +25,11 @@ export const SuccessStatusContent = JSX(() => {
|
|
|
24
25
|
},
|
|
25
26
|
{
|
|
26
27
|
label: 'Срок кредита',
|
|
27
|
-
description:
|
|
28
|
+
description: statusInfo?.calculator?.monthsValue + ' мес',
|
|
28
29
|
},
|
|
29
30
|
{
|
|
30
31
|
label: 'Тип платежа',
|
|
31
|
-
description:
|
|
32
|
+
description: statusInfo?.calculator?.isAnnuity ? 'Аннуитетный' : 'Дифференцированный',
|
|
32
33
|
},
|
|
33
34
|
]}
|
|
34
35
|
buttonText="Вернуться на главную"
|
|
@@ -17,6 +17,17 @@ type CreditFormApiProps = {
|
|
|
17
17
|
finishForm?: (bool: boolean) => void;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
export type StatusInfoState = {
|
|
21
|
+
regionRetail?: string;
|
|
22
|
+
addressRetail?: string;
|
|
23
|
+
cardCategory?: string;
|
|
24
|
+
calculator?: {
|
|
25
|
+
monthsValue?: number;
|
|
26
|
+
moneyValue?: number;
|
|
27
|
+
isAnnuity?: boolean;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
20
31
|
export const useCreditFormAPI = ({
|
|
21
32
|
step,
|
|
22
33
|
inputs,
|
|
@@ -28,6 +39,8 @@ export const useCreditFormAPI = ({
|
|
|
28
39
|
const [taskId] = useLocalStorage<number>('taskId');
|
|
29
40
|
const [profileId] = useLocalStorage<number>('profileId');
|
|
30
41
|
const [participantId] = useLocalStorage<number>('participantId');
|
|
42
|
+
const [, setStatusInfo] = useLocalStorage('statusInfo');
|
|
43
|
+
const [leadForm] = useLocalStorage<LeadFormState>('leadForm');
|
|
31
44
|
|
|
32
45
|
const handleSubmit = useCallback(async (formData: LeadFormState) => {
|
|
33
46
|
const feedbackValidator = objectValidator(
|
|
@@ -51,7 +64,7 @@ export const useCreditFormAPI = ({
|
|
|
51
64
|
formData: formData as any,
|
|
52
65
|
}),
|
|
53
66
|
);
|
|
54
|
-
resetForm(isFinalStep, response);
|
|
67
|
+
resetForm({ isFinalStep, response, leadForm, setStatusInfo });
|
|
55
68
|
}
|
|
56
69
|
} catch (ex) {
|
|
57
70
|
return 'Fail';
|
|
@@ -71,8 +84,34 @@ export const useCreditFormAPI = ({
|
|
|
71
84
|
};
|
|
72
85
|
};
|
|
73
86
|
|
|
74
|
-
const resetForm = (
|
|
75
|
-
|
|
87
|
+
const resetForm = ({
|
|
88
|
+
isFinalStep,
|
|
89
|
+
response,
|
|
90
|
+
leadForm,
|
|
91
|
+
setStatusInfo,
|
|
92
|
+
}: {
|
|
93
|
+
isFinalStep: boolean;
|
|
94
|
+
response: Response;
|
|
95
|
+
leadForm: LeadFormState | null;
|
|
96
|
+
setStatusInfo: (statusInfo: StatusInfoState) => void;
|
|
97
|
+
}) => {
|
|
98
|
+
if (isFinalStep && response.ok && leadForm !== null) {
|
|
99
|
+
const regionRetail = leadForm?.regionRetail?.text;
|
|
100
|
+
const addressRetail = leadForm?.addressRetail?.text;
|
|
101
|
+
const cardCategory = leadForm?.cardCategory?.text;
|
|
102
|
+
const calculator = {
|
|
103
|
+
monthsValue: leadForm?.calculator?.monthsValue,
|
|
104
|
+
moneyValue: leadForm?.calculator?.moneyValue,
|
|
105
|
+
isAnnuity: leadForm?.calculator?.isAnnuity,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
setStatusInfo({
|
|
109
|
+
regionRetail,
|
|
110
|
+
addressRetail,
|
|
111
|
+
cardCategory,
|
|
112
|
+
calculator,
|
|
113
|
+
});
|
|
114
|
+
|
|
76
115
|
globalThis.localStorage.removeItem('leadForm');
|
|
77
116
|
}
|
|
78
117
|
};
|
|
@@ -7,6 +7,7 @@ import { getValidation } from '../getValidation';
|
|
|
7
7
|
export const SnilsField = JSX<CustomFieldProps>(({ field, input }) => (
|
|
8
8
|
<InputSnilsControl
|
|
9
9
|
label="СНИЛС"
|
|
10
|
+
maxLength={14}
|
|
10
11
|
{...getValidation(field('snils'), validatorObj.snils, input?.required)}
|
|
11
12
|
{...input}
|
|
12
13
|
/>
|
|
@@ -4,9 +4,12 @@ import { normalizeWithMask } from '../../utils/normalizeWithMask';
|
|
|
4
4
|
import { Input } from '../Input/Input';
|
|
5
5
|
import { type InputProps } from '../Input/InputProps';
|
|
6
6
|
|
|
7
|
-
export const SnilsInput = JSX<InputProps>(({ children, onChange, ...inputProps }) => {
|
|
7
|
+
export const SnilsInput = JSX<InputProps>(({ children, onChange, maxLength, ...inputProps }) => {
|
|
8
8
|
const handleChange = useCallback(
|
|
9
|
-
(v: string) =>
|
|
9
|
+
(v: string) =>
|
|
10
|
+
maxLength
|
|
11
|
+
? v.length <= maxLength && onChange?.(normalizeWithMask(v, '___-___-___ __'))
|
|
12
|
+
: onChange?.(normalizeWithMask(v, '___-___-___ __')),
|
|
10
13
|
[onChange],
|
|
11
14
|
);
|
|
12
15
|
const handleBlur = useCallback((v: string) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export function normalizeWithMask(value: string, pattern: string): string {
|
|
2
2
|
const valueNumbers = value.replace(/\D/g, '');
|
|
3
|
-
if (valueNumbers === '' ||
|
|
3
|
+
if (valueNumbers === '' || valueNumbers.length === pattern.length) {
|
|
4
4
|
return value;
|
|
5
5
|
}
|
|
6
6
|
|