@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.
Files changed (175) hide show
  1. package/bundle/bundle.umd.js +62 -33
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/ApplicationLeadForm/LeadFormState.d.ts +1 -1
  4. package/bundle/components/CreditCardForm/useCreditCardFormAPI.d.ts +10 -0
  5. package/bundle/components/CreditForm/useCreditFormAPI.d.ts +10 -0
  6. package/dist/api/RetailAPI/sendCode.js +1 -1
  7. package/dist/api/RetailAPI/sendCode.js.map +1 -1
  8. package/dist/components/ApplicationLeadForm/LeadFormState.d.ts +1 -1
  9. package/dist/components/CreditCardForm/PendingStatusContent.js +2 -2
  10. package/dist/components/CreditCardForm/PendingStatusContent.js.map +1 -1
  11. package/dist/components/CreditCardForm/ReworkStatusContent.js +3 -3
  12. package/dist/components/CreditCardForm/ReworkStatusContent.js.map +1 -1
  13. package/dist/components/CreditCardForm/SuccessStatusContent.js +3 -3
  14. package/dist/components/CreditCardForm/SuccessStatusContent.js.map +1 -1
  15. package/dist/components/CreditCardForm/formStateMap.js +1 -1
  16. package/dist/components/CreditCardForm/formStateMap.js.map +1 -1
  17. package/dist/components/CreditCardForm/useCreditCardFormAPI.d.ts +10 -0
  18. package/dist/components/CreditCardForm/useCreditCardFormAPI.js +14 -3
  19. package/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  20. package/dist/components/CreditForm/PendingStatusContent.js +4 -4
  21. package/dist/components/CreditForm/PendingStatusContent.js.map +1 -1
  22. package/dist/components/CreditForm/ReworkStatusContent.js +3 -3
  23. package/dist/components/CreditForm/ReworkStatusContent.js.map +1 -1
  24. package/dist/components/CreditForm/SuccessStatusContent.js +3 -3
  25. package/dist/components/CreditForm/SuccessStatusContent.js.map +1 -1
  26. package/dist/components/CreditForm/formStateMap.js +1 -1
  27. package/dist/components/CreditForm/formStateMap.js.map +1 -1
  28. package/dist/components/CreditForm/useCreditFormAPI.d.ts +10 -0
  29. package/dist/components/CreditForm/useCreditFormAPI.js +19 -3
  30. package/dist/components/CreditForm/useCreditFormAPI.js.map +1 -1
  31. package/dist/ui-kit/FormField/Fields/SnilsField.js +1 -1
  32. package/dist/ui-kit/FormField/Fields/SnilsField.js.map +1 -1
  33. package/dist/ui-kit/Input/InputSnilsControl.js +1 -1
  34. package/dist/ui-kit/Input/InputSnilsControl.js.map +1 -1
  35. package/dist/ui-kit/SnilsInput/SnilsInput.js +4 -2
  36. package/dist/ui-kit/SnilsInput/SnilsInput.js.map +1 -1
  37. package/dist/utils/normalizeWithMask.js +1 -1
  38. package/dist/utils/normalizeWithMask.js.map +1 -1
  39. package/lib/api/RetailAPI/sendCode.js +1 -1
  40. package/lib/api/RetailAPI/sendCode.js.map +1 -1
  41. package/lib/components/ApplicationLeadForm/LeadFormState.d.ts +1 -1
  42. package/lib/components/CreditCardForm/PendingStatusContent.js +2 -2
  43. package/lib/components/CreditCardForm/PendingStatusContent.js.map +1 -1
  44. package/lib/components/CreditCardForm/ReworkStatusContent.js +3 -3
  45. package/lib/components/CreditCardForm/ReworkStatusContent.js.map +1 -1
  46. package/lib/components/CreditCardForm/SuccessStatusContent.js +3 -3
  47. package/lib/components/CreditCardForm/SuccessStatusContent.js.map +1 -1
  48. package/lib/components/CreditCardForm/formStateMap.js +1 -1
  49. package/lib/components/CreditCardForm/formStateMap.js.map +1 -1
  50. package/lib/components/CreditCardForm/useCreditCardFormAPI.d.ts +10 -0
  51. package/lib/components/CreditCardForm/useCreditCardFormAPI.js +14 -3
  52. package/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  53. package/lib/components/CreditForm/PendingStatusContent.js +4 -4
  54. package/lib/components/CreditForm/PendingStatusContent.js.map +1 -1
  55. package/lib/components/CreditForm/ReworkStatusContent.js +3 -3
  56. package/lib/components/CreditForm/ReworkStatusContent.js.map +1 -1
  57. package/lib/components/CreditForm/SuccessStatusContent.js +3 -3
  58. package/lib/components/CreditForm/SuccessStatusContent.js.map +1 -1
  59. package/lib/components/CreditForm/formStateMap.js +1 -1
  60. package/lib/components/CreditForm/formStateMap.js.map +1 -1
  61. package/lib/components/CreditForm/useCreditFormAPI.d.ts +10 -0
  62. package/lib/components/CreditForm/useCreditFormAPI.js +19 -3
  63. package/lib/components/CreditForm/useCreditFormAPI.js.map +1 -1
  64. package/lib/ui-kit/FormField/Fields/SnilsField.js +1 -1
  65. package/lib/ui-kit/FormField/Fields/SnilsField.js.map +1 -1
  66. package/lib/ui-kit/Input/InputSnilsControl.js +1 -1
  67. package/lib/ui-kit/Input/InputSnilsControl.js.map +1 -1
  68. package/lib/ui-kit/SnilsInput/SnilsInput.js +4 -2
  69. package/lib/ui-kit/SnilsInput/SnilsInput.js.map +1 -1
  70. package/lib/utils/normalizeWithMask.js +1 -1
  71. package/lib/utils/normalizeWithMask.js.map +1 -1
  72. package/mobile/bundle/bundle.umd.js +62 -33
  73. package/mobile/bundle/bundle.umd.min.js +1 -1
  74. package/mobile/bundle/components/ApplicationLeadForm/LeadFormState.d.ts +1 -1
  75. package/mobile/bundle/components/CreditCardForm/useCreditCardFormAPI.d.ts +10 -0
  76. package/mobile/bundle/components/CreditForm/useCreditFormAPI.d.ts +10 -0
  77. package/mobile/dist/api/RetailAPI/sendCode.js +1 -1
  78. package/mobile/dist/api/RetailAPI/sendCode.js.map +1 -1
  79. package/mobile/dist/components/ApplicationLeadForm/LeadFormState.d.ts +1 -1
  80. package/mobile/dist/components/CreditCardForm/PendingStatusContent.js +2 -2
  81. package/mobile/dist/components/CreditCardForm/PendingStatusContent.js.map +1 -1
  82. package/mobile/dist/components/CreditCardForm/ReworkStatusContent.js +3 -3
  83. package/mobile/dist/components/CreditCardForm/ReworkStatusContent.js.map +1 -1
  84. package/mobile/dist/components/CreditCardForm/SuccessStatusContent.js +3 -3
  85. package/mobile/dist/components/CreditCardForm/SuccessStatusContent.js.map +1 -1
  86. package/mobile/dist/components/CreditCardForm/formStateMap.js +1 -1
  87. package/mobile/dist/components/CreditCardForm/formStateMap.js.map +1 -1
  88. package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.d.ts +10 -0
  89. package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js +14 -3
  90. package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  91. package/mobile/dist/components/CreditForm/PendingStatusContent.js +4 -4
  92. package/mobile/dist/components/CreditForm/PendingStatusContent.js.map +1 -1
  93. package/mobile/dist/components/CreditForm/ReworkStatusContent.js +3 -3
  94. package/mobile/dist/components/CreditForm/ReworkStatusContent.js.map +1 -1
  95. package/mobile/dist/components/CreditForm/SuccessStatusContent.js +3 -3
  96. package/mobile/dist/components/CreditForm/SuccessStatusContent.js.map +1 -1
  97. package/mobile/dist/components/CreditForm/formStateMap.js +1 -1
  98. package/mobile/dist/components/CreditForm/formStateMap.js.map +1 -1
  99. package/mobile/dist/components/CreditForm/useCreditFormAPI.d.ts +10 -0
  100. package/mobile/dist/components/CreditForm/useCreditFormAPI.js +19 -3
  101. package/mobile/dist/components/CreditForm/useCreditFormAPI.js.map +1 -1
  102. package/mobile/dist/ui-kit/FormField/Fields/SnilsField.js +1 -1
  103. package/mobile/dist/ui-kit/FormField/Fields/SnilsField.js.map +1 -1
  104. package/mobile/dist/ui-kit/Input/InputSnilsControl.js +1 -1
  105. package/mobile/dist/ui-kit/Input/InputSnilsControl.js.map +1 -1
  106. package/mobile/dist/ui-kit/SnilsInput/SnilsInput.js +4 -2
  107. package/mobile/dist/ui-kit/SnilsInput/SnilsInput.js.map +1 -1
  108. package/mobile/dist/utils/normalizeWithMask.js +1 -1
  109. package/mobile/dist/utils/normalizeWithMask.js.map +1 -1
  110. package/mobile/lib/api/RetailAPI/sendCode.js +1 -1
  111. package/mobile/lib/api/RetailAPI/sendCode.js.map +1 -1
  112. package/mobile/lib/components/ApplicationLeadForm/LeadFormState.d.ts +1 -1
  113. package/mobile/lib/components/CreditCardForm/PendingStatusContent.js +2 -2
  114. package/mobile/lib/components/CreditCardForm/PendingStatusContent.js.map +1 -1
  115. package/mobile/lib/components/CreditCardForm/ReworkStatusContent.js +3 -3
  116. package/mobile/lib/components/CreditCardForm/ReworkStatusContent.js.map +1 -1
  117. package/mobile/lib/components/CreditCardForm/SuccessStatusContent.js +3 -3
  118. package/mobile/lib/components/CreditCardForm/SuccessStatusContent.js.map +1 -1
  119. package/mobile/lib/components/CreditCardForm/formStateMap.js +1 -1
  120. package/mobile/lib/components/CreditCardForm/formStateMap.js.map +1 -1
  121. package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.d.ts +10 -0
  122. package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js +14 -3
  123. package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  124. package/mobile/lib/components/CreditForm/PendingStatusContent.js +4 -4
  125. package/mobile/lib/components/CreditForm/PendingStatusContent.js.map +1 -1
  126. package/mobile/lib/components/CreditForm/ReworkStatusContent.js +3 -3
  127. package/mobile/lib/components/CreditForm/ReworkStatusContent.js.map +1 -1
  128. package/mobile/lib/components/CreditForm/SuccessStatusContent.js +3 -3
  129. package/mobile/lib/components/CreditForm/SuccessStatusContent.js.map +1 -1
  130. package/mobile/lib/components/CreditForm/formStateMap.js +1 -1
  131. package/mobile/lib/components/CreditForm/formStateMap.js.map +1 -1
  132. package/mobile/lib/components/CreditForm/useCreditFormAPI.d.ts +10 -0
  133. package/mobile/lib/components/CreditForm/useCreditFormAPI.js +19 -3
  134. package/mobile/lib/components/CreditForm/useCreditFormAPI.js.map +1 -1
  135. package/mobile/lib/ui-kit/FormField/Fields/SnilsField.js +1 -1
  136. package/mobile/lib/ui-kit/FormField/Fields/SnilsField.js.map +1 -1
  137. package/mobile/lib/ui-kit/Input/InputSnilsControl.js +1 -1
  138. package/mobile/lib/ui-kit/Input/InputSnilsControl.js.map +1 -1
  139. package/mobile/lib/ui-kit/SnilsInput/SnilsInput.js +4 -2
  140. package/mobile/lib/ui-kit/SnilsInput/SnilsInput.js.map +1 -1
  141. package/mobile/lib/utils/normalizeWithMask.js +1 -1
  142. package/mobile/lib/utils/normalizeWithMask.js.map +1 -1
  143. package/mobile/src/api/RetailAPI/sendCode.ts +1 -1
  144. package/mobile/src/components/ApplicationLeadForm/LeadFormState.ts +1 -1
  145. package/mobile/src/components/CreditCardForm/PendingStatusContent.tsx +3 -2
  146. package/mobile/src/components/CreditCardForm/ReworkStatusContent.tsx +4 -3
  147. package/mobile/src/components/CreditCardForm/SuccessStatusContent.tsx +4 -3
  148. package/mobile/src/components/CreditCardForm/formStateMap.tsx +1 -1
  149. package/mobile/src/components/CreditCardForm/useCreditCardFormAPI.tsx +37 -3
  150. package/mobile/src/components/CreditForm/PendingStatusContent.tsx +5 -5
  151. package/mobile/src/components/CreditForm/ReworkStatusContent.tsx +4 -3
  152. package/mobile/src/components/CreditForm/SuccessStatusContent.tsx +4 -3
  153. package/mobile/src/components/CreditForm/formStateMap.tsx +1 -1
  154. package/mobile/src/components/CreditForm/useCreditFormAPI.tsx +42 -3
  155. package/mobile/src/ui-kit/FormField/Fields/SnilsField.tsx +1 -0
  156. package/mobile/src/ui-kit/Input/InputSnilsControl.tsx +1 -0
  157. package/mobile/src/ui-kit/SnilsInput/SnilsInput.tsx +5 -2
  158. package/mobile/src/utils/normalizeWithMask.ts +1 -1
  159. package/package.json +1 -1
  160. package/src/api/RetailAPI/sendCode.ts +1 -1
  161. package/src/components/ApplicationLeadForm/LeadFormState.ts +1 -1
  162. package/src/components/CreditCardForm/PendingStatusContent.tsx +3 -2
  163. package/src/components/CreditCardForm/ReworkStatusContent.tsx +4 -3
  164. package/src/components/CreditCardForm/SuccessStatusContent.tsx +4 -3
  165. package/src/components/CreditCardForm/formStateMap.tsx +1 -1
  166. package/src/components/CreditCardForm/useCreditCardFormAPI.tsx +37 -3
  167. package/src/components/CreditForm/PendingStatusContent.tsx +5 -5
  168. package/src/components/CreditForm/ReworkStatusContent.tsx +4 -3
  169. package/src/components/CreditForm/SuccessStatusContent.tsx +4 -3
  170. package/src/components/CreditForm/formStateMap.tsx +1 -1
  171. package/src/components/CreditForm/useCreditFormAPI.tsx +42 -3
  172. package/src/ui-kit/FormField/Fields/SnilsField.tsx +1 -0
  173. package/src/ui-kit/Input/InputSnilsControl.tsx +1 -0
  174. package/src/ui-kit/SnilsInput/SnilsInput.tsx +5 -2
  175. 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 [leadForm] = useLocalStorage<LeadFormState>('leadForm');
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: `${leadForm?.calculator?.moneyValue?.toLocaleString() ?? '0'} ₽`,
28
+ description: `${statusInfo?.calculator?.moneyValue?.toLocaleString() ?? '0'} ₽`,
29
29
  },
30
30
  {
31
31
  label: 'Срок кредита',
32
- description: `${leadForm?.calculator?.monthsValue ?? '0'} мес`,
32
+ description: `${statusInfo?.calculator?.monthsValue ?? '0'} мес`,
33
33
  },
34
34
  {
35
35
  label: 'Тип платежа',
36
- description: leadForm?.calculator?.isAnnuity ? 'Аннуитетный' : 'Дифференцированный',
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 [leadForm] = useLocalStorage<Record<string, any>>('leadForm');
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: leadForm?.regionRetail?.text,
17
+ description: statusInfo?.regionRetail,
17
18
  },
18
19
  {
19
20
  label: 'Адрес',
20
- description: leadForm?.addressRetail?.text,
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 [leadForm] = useLocalStorage<Record<string, any>>('leadForm');
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: leadForm?.monthsValue + ' мес',
28
+ description: statusInfo?.calculator?.monthsValue + ' мес',
28
29
  },
29
30
  {
30
31
  label: 'Тип платежа',
31
- description: leadForm?.isAnnuity ? 'Аннуитетный' : 'Дифференцированный',
32
+ description: statusInfo?.calculator?.isAnnuity ? 'Аннуитетный' : 'Дифференцированный',
32
33
  },
33
34
  ]}
34
35
  buttonText="Вернуться на главную"
@@ -76,7 +76,7 @@ export const formStateMap: Partial<LeadFormState>[] = [
76
76
  creditInRshbCd: undefined,
77
77
  },
78
78
  {
79
- regionRetail: '',
79
+ regionRetail: { key: '', text: '' },
80
80
  addressRetail: undefined,
81
81
  bankEmployeeCode: undefined,
82
82
  },
@@ -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 = (isFinalStep: boolean, response: Response) => {
75
- if (isFinalStep && response.ok) {
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
  />
@@ -16,6 +16,7 @@ export const InputSnilsControl = JSX<InputProps>(
16
16
  onChange={onChange}
17
17
  onBlur={onBlur}
18
18
  placeholder="___-___-___ __"
19
+ {...rest}
19
20
  />
20
21
  {renderErrorText(error)}
21
22
  </div>
@@ -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) => onChange && onChange(normalizeWithMask(v, '___-___-___ __')),
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 === '' || value?.length === pattern.length) {
3
+ if (valueNumbers === '' || valueNumbers.length === pattern.length) {
4
4
  return value;
5
5
  }
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.704",
3
+ "version": "0.14.706",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -21,4 +21,4 @@ const isErrorResult = (
21
21
  ): res is SendCodeErrorResult =>
22
22
  Boolean(res) &&
23
23
  typeof res !== 'string' &&
24
- Boolean(res?.errorMessage.startsWith(`Too many request for phoneNumber [${phoneNumber}]`));
24
+ Boolean(res?.errorMessage?.startsWith(`Too many request for phoneNumber [${phoneNumber}]`));
@@ -11,7 +11,7 @@ export interface FormConsents {
11
11
  }
12
12
 
13
13
  export type FormStateDeliveryType = {
14
- regionRetail?: string;
14
+ regionRetail?: Option;
15
15
  bankEmployeeCode?: number;
16
16
  methodObtain?: 'office' | 'courier';
17
17
  deliveryDate?: Date | string;
@@ -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 [leadForm] = useLocalStorage<Record<string, any>>('leadForm');
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: leadForm?.cardCategory?.text,
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 [leadForm] = useLocalStorage<Record<string, any>>('leadForm');
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: leadForm?.regionRetail?.text,
17
+ description: statusInfo?.regionRetail,
17
18
  },
18
19
  {
19
20
  label: 'Адрес',
20
- description: leadForm?.addressRetail?.text,
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 [leadForm] = useLocalStorage<Record<string, any>>('leadForm');
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: leadForm?.monthsValue + ' мес',
28
+ description: statusInfo?.calculator?.monthsValue + ' мес',
28
29
  },
29
30
  {
30
31
  label: 'Тип платежа',
31
- description: leadForm?.isAnnuity ? 'Аннуитетный' : 'Дифференцированный',
32
+ description: statusInfo?.calculator?.isAnnuity ? 'Аннуитетный' : 'Дифференцированный',
32
33
  },
33
34
  ]}
34
35
  buttonText="Вернуться на главную"
@@ -75,7 +75,7 @@ export const formStateMap: Partial<LeadFormState>[] = [
75
75
  creditInRshbCd: undefined,
76
76
  },
77
77
  {
78
- regionRetail: '',
78
+ regionRetail: { key: '', text: '' },
79
79
  addressRetail: {
80
80
  key: '',
81
81
  text: '',
@@ -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 = (isFinalStep: boolean, response: Response) => {
75
- if (isFinalStep && response.ok) {
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 [leadForm] = useLocalStorage<LeadFormState>('leadForm');
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: `${leadForm?.calculator?.moneyValue?.toLocaleString() ?? '0'} ₽`,
28
+ description: `${statusInfo?.calculator?.moneyValue?.toLocaleString() ?? '0'} ₽`,
29
29
  },
30
30
  {
31
31
  label: 'Срок кредита',
32
- description: `${leadForm?.calculator?.monthsValue ?? '0'} мес`,
32
+ description: `${statusInfo?.calculator?.monthsValue ?? '0'} мес`,
33
33
  },
34
34
  {
35
35
  label: 'Тип платежа',
36
- description: leadForm?.calculator?.isAnnuity ? 'Аннуитетный' : 'Дифференцированный',
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 [leadForm] = useLocalStorage<Record<string, any>>('leadForm');
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: leadForm?.regionRetail?.text,
17
+ description: statusInfo?.regionRetail,
17
18
  },
18
19
  {
19
20
  label: 'Адрес',
20
- description: leadForm?.addressRetail?.text,
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 [leadForm] = useLocalStorage<Record<string, any>>('leadForm');
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: leadForm?.monthsValue + ' мес',
28
+ description: statusInfo?.calculator?.monthsValue + ' мес',
28
29
  },
29
30
  {
30
31
  label: 'Тип платежа',
31
- description: leadForm?.isAnnuity ? 'Аннуитетный' : 'Дифференцированный',
32
+ description: statusInfo?.calculator?.isAnnuity ? 'Аннуитетный' : 'Дифференцированный',
32
33
  },
33
34
  ]}
34
35
  buttonText="Вернуться на главную"
@@ -76,7 +76,7 @@ export const formStateMap: Partial<LeadFormState>[] = [
76
76
  creditInRshbCd: undefined,
77
77
  },
78
78
  {
79
- regionRetail: '',
79
+ regionRetail: { key: '', text: '' },
80
80
  addressRetail: undefined,
81
81
  bankEmployeeCode: undefined,
82
82
  },
@@ -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 = (isFinalStep: boolean, response: Response) => {
75
- if (isFinalStep && response.ok) {
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
  />
@@ -16,6 +16,7 @@ export const InputSnilsControl = JSX<InputProps>(
16
16
  onChange={onChange}
17
17
  onBlur={onBlur}
18
18
  placeholder="___-___-___ __"
19
+ {...rest}
19
20
  />
20
21
  {renderErrorText(error)}
21
22
  </div>
@@ -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) => onChange && onChange(normalizeWithMask(v, '___-___-___ __')),
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 === '' || value?.length === pattern.length) {
3
+ if (valueNumbers === '' || valueNumbers.length === pattern.length) {
4
4
  return value;
5
5
  }
6
6