@redneckz/wildless-cms-uni-blocks 0.14.621 → 0.14.623

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 (231) hide show
  1. package/bundle/api/RetailAPI/updateUserProfile.d.ts +1 -1
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +43 -34
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  6. package/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  7. package/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  8. package/bundle/components/CreditForm/CreditFormStep.d.ts +1 -2
  9. package/bundle/components/CreditForm/StepsNavigationButtons.d.ts +0 -1
  10. package/bundle/components/CreditForm/creditFormStepsData.d.ts +2 -178
  11. package/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  12. package/bundle/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
  13. package/dist/api/RetailAPI/updateUserProfile.d.ts +1 -1
  14. package/dist/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  15. package/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  16. package/dist/api/dadataHints/hintsListsOptions.js +1 -0
  17. package/dist/api/dadataHints/hintsListsOptions.js.map +1 -1
  18. package/dist/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  19. package/dist/components/ApplicationForm/getInitialFormState.js +1 -1
  20. package/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
  21. package/dist/components/ApplicationForm/renderInputs.js +2 -2
  22. package/dist/components/ApplicationForm/renderInputs.js.map +1 -1
  23. package/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  24. package/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  25. package/dist/components/ApplicationLeadForm/consents.js +1 -1
  26. package/dist/components/ApplicationLeadForm/consents.js.map +1 -1
  27. package/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  28. package/dist/components/ApplicationLeadForm/getInitialFormState.js +2 -2
  29. package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  30. package/dist/components/ApplicationLeadForm/useInitApplicationLead.js +1 -1
  31. package/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  32. package/dist/components/CreditForm/CreditForm.js +3 -3
  33. package/dist/components/CreditForm/CreditForm.js.map +1 -1
  34. package/dist/components/CreditForm/CreditFormProgress.js +3 -3
  35. package/dist/components/CreditForm/CreditFormProgress.js.map +1 -1
  36. package/dist/components/CreditForm/CreditFormStep.d.ts +1 -2
  37. package/dist/components/CreditForm/CreditFormStep.js +3 -3
  38. package/dist/components/CreditForm/CreditFormStep.js.map +1 -1
  39. package/dist/components/CreditForm/StepsNavigationButtons.d.ts +0 -1
  40. package/dist/components/CreditForm/StepsNavigationButtons.js +2 -1
  41. package/dist/components/CreditForm/StepsNavigationButtons.js.map +1 -1
  42. package/dist/components/CreditForm/creditFormStepsData.d.ts +2 -178
  43. package/dist/components/CreditForm/creditFormStepsData.js +8 -9
  44. package/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  45. package/dist/ui-kit/FormField/Fields/PartInBusinessField.js +9 -1
  46. package/dist/ui-kit/FormField/Fields/PartInBusinessField.js.map +1 -1
  47. package/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  48. package/dist/ui-kit/FormField/getField.js +2 -2
  49. package/dist/ui-kit/FormField/getField.js.map +1 -1
  50. package/dist/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
  51. package/dist/ui-kit/FormField/getObjectValidator.js +2 -2
  52. package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  53. package/lib/api/RetailAPI/updateUserProfile.d.ts +1 -1
  54. package/lib/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  55. package/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  56. package/lib/api/dadataHints/hintsListsOptions.js +1 -0
  57. package/lib/api/dadataHints/hintsListsOptions.js.map +1 -1
  58. package/lib/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  59. package/lib/components/ApplicationForm/getInitialFormState.js +1 -1
  60. package/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
  61. package/lib/components/ApplicationForm/renderInputs.js +2 -2
  62. package/lib/components/ApplicationForm/renderInputs.js.map +1 -1
  63. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.fixture.d.ts +0 -2
  64. package/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  65. package/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  66. package/lib/components/ApplicationLeadForm/consents.js +1 -1
  67. package/lib/components/ApplicationLeadForm/consents.js.map +1 -1
  68. package/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  69. package/lib/components/ApplicationLeadForm/getInitialFormState.js +2 -2
  70. package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  71. package/lib/components/ApplicationLeadForm/useInitApplicationLead.js +1 -1
  72. package/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  73. package/lib/components/CreditForm/CreditForm.js +3 -3
  74. package/lib/components/CreditForm/CreditForm.js.map +1 -1
  75. package/lib/components/CreditForm/CreditFormProgress.js +3 -3
  76. package/lib/components/CreditForm/CreditFormProgress.js.map +1 -1
  77. package/lib/components/CreditForm/CreditFormStep.d.ts +1 -2
  78. package/lib/components/CreditForm/CreditFormStep.js +3 -3
  79. package/lib/components/CreditForm/CreditFormStep.js.map +1 -1
  80. package/lib/components/CreditForm/StepsNavigationButtons.d.ts +0 -1
  81. package/lib/components/CreditForm/StepsNavigationButtons.js +2 -1
  82. package/lib/components/CreditForm/StepsNavigationButtons.js.map +1 -1
  83. package/lib/components/CreditForm/creditFormStepsData.d.ts +2 -178
  84. package/lib/components/CreditForm/creditFormStepsData.js +8 -9
  85. package/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  86. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +1 -1
  87. package/lib/ui-kit/FormField/Fields/PartInBusinessField.js +9 -1
  88. package/lib/ui-kit/FormField/Fields/PartInBusinessField.js.map +1 -1
  89. package/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  90. package/lib/ui-kit/FormField/getField.js +2 -2
  91. package/lib/ui-kit/FormField/getField.js.map +1 -1
  92. package/lib/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
  93. package/lib/ui-kit/FormField/getObjectValidator.js +2 -2
  94. package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  95. package/mobile/bundle/api/RetailAPI/updateUserProfile.d.ts +1 -1
  96. package/mobile/bundle/bundle.umd.js +43 -34
  97. package/mobile/bundle/bundle.umd.min.js +1 -1
  98. package/mobile/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  99. package/mobile/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  100. package/mobile/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  101. package/mobile/bundle/components/CreditForm/CreditFormStep.d.ts +1 -2
  102. package/mobile/bundle/components/CreditForm/StepsNavigationButtons.d.ts +0 -1
  103. package/mobile/bundle/components/CreditForm/creditFormStepsData.d.ts +2 -178
  104. package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  105. package/mobile/bundle/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
  106. package/mobile/dist/api/RetailAPI/updateUserProfile.d.ts +1 -1
  107. package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  108. package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  109. package/mobile/dist/api/dadataHints/hintsListsOptions.js +1 -0
  110. package/mobile/dist/api/dadataHints/hintsListsOptions.js.map +1 -1
  111. package/mobile/dist/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  112. package/mobile/dist/components/ApplicationForm/getInitialFormState.js +1 -1
  113. package/mobile/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
  114. package/mobile/dist/components/ApplicationForm/renderInputs.js +2 -2
  115. package/mobile/dist/components/ApplicationForm/renderInputs.js.map +1 -1
  116. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  117. package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  118. package/mobile/dist/components/ApplicationLeadForm/consents.js +1 -1
  119. package/mobile/dist/components/ApplicationLeadForm/consents.js.map +1 -1
  120. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  121. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js +2 -2
  122. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  123. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js +1 -1
  124. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  125. package/mobile/dist/components/CreditForm/CreditForm.js +3 -3
  126. package/mobile/dist/components/CreditForm/CreditForm.js.map +1 -1
  127. package/mobile/dist/components/CreditForm/CreditFormProgress.js +3 -3
  128. package/mobile/dist/components/CreditForm/CreditFormProgress.js.map +1 -1
  129. package/mobile/dist/components/CreditForm/CreditFormStep.d.ts +1 -2
  130. package/mobile/dist/components/CreditForm/CreditFormStep.js +3 -3
  131. package/mobile/dist/components/CreditForm/CreditFormStep.js.map +1 -1
  132. package/mobile/dist/components/CreditForm/StepsNavigationButtons.d.ts +0 -1
  133. package/mobile/dist/components/CreditForm/StepsNavigationButtons.js +2 -1
  134. package/mobile/dist/components/CreditForm/StepsNavigationButtons.js.map +1 -1
  135. package/mobile/dist/components/CreditForm/creditFormStepsData.d.ts +2 -178
  136. package/mobile/dist/components/CreditForm/creditFormStepsData.js +8 -9
  137. package/mobile/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  138. package/mobile/dist/ui-kit/FormField/Fields/PartInBusinessField.js +9 -1
  139. package/mobile/dist/ui-kit/FormField/Fields/PartInBusinessField.js.map +1 -1
  140. package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  141. package/mobile/dist/ui-kit/FormField/getField.js +2 -2
  142. package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
  143. package/mobile/dist/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
  144. package/mobile/dist/ui-kit/FormField/getObjectValidator.js +2 -2
  145. package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  146. package/mobile/lib/api/RetailAPI/updateUserProfile.d.ts +1 -1
  147. package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  148. package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  149. package/mobile/lib/api/dadataHints/hintsListsOptions.js +1 -0
  150. package/mobile/lib/api/dadataHints/hintsListsOptions.js.map +1 -1
  151. package/mobile/lib/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  152. package/mobile/lib/components/ApplicationForm/getInitialFormState.js +1 -1
  153. package/mobile/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
  154. package/mobile/lib/components/ApplicationForm/renderInputs.js +2 -2
  155. package/mobile/lib/components/ApplicationForm/renderInputs.js.map +1 -1
  156. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  157. package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  158. package/mobile/lib/components/ApplicationLeadForm/consents.js +1 -1
  159. package/mobile/lib/components/ApplicationLeadForm/consents.js.map +1 -1
  160. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  161. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js +2 -2
  162. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  163. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js +1 -1
  164. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  165. package/mobile/lib/components/CreditForm/CreditForm.js +3 -3
  166. package/mobile/lib/components/CreditForm/CreditForm.js.map +1 -1
  167. package/mobile/lib/components/CreditForm/CreditFormProgress.js +3 -3
  168. package/mobile/lib/components/CreditForm/CreditFormProgress.js.map +1 -1
  169. package/mobile/lib/components/CreditForm/CreditFormStep.d.ts +1 -2
  170. package/mobile/lib/components/CreditForm/CreditFormStep.js +3 -3
  171. package/mobile/lib/components/CreditForm/CreditFormStep.js.map +1 -1
  172. package/mobile/lib/components/CreditForm/StepsNavigationButtons.d.ts +0 -1
  173. package/mobile/lib/components/CreditForm/StepsNavigationButtons.js +2 -1
  174. package/mobile/lib/components/CreditForm/StepsNavigationButtons.js.map +1 -1
  175. package/mobile/lib/components/CreditForm/creditFormStepsData.d.ts +2 -178
  176. package/mobile/lib/components/CreditForm/creditFormStepsData.js +8 -9
  177. package/mobile/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  178. package/mobile/lib/ui-kit/FormField/Fields/PartInBusinessField.js +9 -1
  179. package/mobile/lib/ui-kit/FormField/Fields/PartInBusinessField.js.map +1 -1
  180. package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  181. package/mobile/lib/ui-kit/FormField/getField.js +2 -2
  182. package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
  183. package/mobile/lib/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
  184. package/mobile/lib/ui-kit/FormField/getObjectValidator.js +2 -2
  185. package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  186. package/mobile/src/api/RetailAPI/updateUserProfile.ts +1 -1
  187. package/mobile/src/api/RetailAPI/utils/getUpdateUserProfile.ts +2 -2
  188. package/mobile/src/api/dadataHints/hintsListsOptions.ts +1 -0
  189. package/mobile/src/components/ApplicationForm/ApplicationFormContent.ts +1 -1
  190. package/mobile/src/components/ApplicationForm/getInitialFormState.tsx +1 -1
  191. package/mobile/src/components/ApplicationForm/renderInputs.tsx +2 -2
  192. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.example.json +1 -1
  193. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +1 -1
  194. package/mobile/src/components/ApplicationLeadForm/GroupedConsents.tsx +9 -2
  195. package/mobile/src/components/ApplicationLeadForm/consents.ts +1 -1
  196. package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +3 -3
  197. package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +1 -1
  198. package/mobile/src/components/CreditForm/CreditForm.tsx +7 -5
  199. package/mobile/src/components/CreditForm/CreditFormProgress.tsx +5 -5
  200. package/mobile/src/components/CreditForm/CreditFormStep.tsx +4 -5
  201. package/mobile/src/components/CreditForm/StepsNavigationButtons.tsx +3 -2
  202. package/mobile/src/components/CreditForm/creditFormStepsData.tsx +10 -9
  203. package/mobile/src/ui-kit/FormField/Fields/PartInBusinessField.tsx +25 -9
  204. package/mobile/src/ui-kit/FormField/NameFieldDef.ts +1 -1
  205. package/mobile/src/ui-kit/FormField/getField.tsx +2 -2
  206. package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +2 -2
  207. package/package.json +1 -1
  208. package/src/api/RetailAPI/updateUserProfile.ts +1 -1
  209. package/src/api/RetailAPI/utils/getUpdateUserProfile.ts +2 -2
  210. package/src/api/dadataHints/hintsListsOptions.ts +1 -0
  211. package/src/components/ApplicationForm/ApplicationFormContent.ts +1 -1
  212. package/src/components/ApplicationForm/getInitialFormState.tsx +1 -1
  213. package/src/components/ApplicationForm/renderInputs.tsx +2 -2
  214. package/src/components/ApplicationLeadForm/ApplicationLeadForm.example.json +1 -1
  215. package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.mobile.tsx +1 -1
  216. package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.tsx +1 -122
  217. package/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +1 -1
  218. package/src/components/ApplicationLeadForm/GroupedConsents.tsx +9 -2
  219. package/src/components/ApplicationLeadForm/consents.ts +1 -1
  220. package/src/components/ApplicationLeadForm/getInitialFormState.tsx +3 -3
  221. package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +1 -1
  222. package/src/components/CreditForm/CreditForm.tsx +7 -5
  223. package/src/components/CreditForm/CreditFormProgress.tsx +5 -5
  224. package/src/components/CreditForm/CreditFormStep.tsx +4 -5
  225. package/src/components/CreditForm/StepsNavigationButtons.tsx +3 -2
  226. package/src/components/CreditForm/creditFormStepsData.tsx +10 -9
  227. package/src/icons/IconName.ts +6 -360
  228. package/src/ui-kit/FormField/Fields/PartInBusinessField.tsx +25 -9
  229. package/src/ui-kit/FormField/NameFieldDef.ts +1 -1
  230. package/src/ui-kit/FormField/getField.tsx +2 -2
  231. package/src/ui-kit/FormField/getObjectValidator.tsx +2 -2
@@ -28,7 +28,7 @@ export type FieldDefaultDef = Required &
28
28
  TextProps &
29
29
  LabelProps &
30
30
  ConditionFieldProps & {
31
- name: NameFieldDef;
31
+ name?: NameFieldDef;
32
32
  };
33
33
 
34
34
  /**
@@ -18,7 +18,7 @@ const CONSENT_REQUIRED = 'Отметьте все обязательные со
18
18
 
19
19
  export const GroupedConsents = JSX<GroupedConsentsProps>(
20
20
  ({ inputs = [], typeForm = '', field, key }) => {
21
- const isChecked = inputs.every((_) => Boolean(field(_.name).value));
21
+ const isChecked = inputs.every((_) => Boolean(field(_.name as keyof FormState).value));
22
22
 
23
23
  const handleGeneralToggle = (value: boolean) => {
24
24
  for (const item of inputs) {
@@ -31,7 +31,14 @@ export const GroupedConsents = JSX<GroupedConsentsProps>(
31
31
  () =>
32
32
  inputs
33
33
  ?.filter((_) => _.required)
34
- ?.some((_) => Boolean(withValidator(field(_?.name), validatorObj[_?.name]).error)),
34
+ ?.some((_) =>
35
+ Boolean(
36
+ withValidator(
37
+ field(_?.name as keyof FormState),
38
+ validatorObj[_?.name as keyof FormState],
39
+ ).error,
40
+ ),
41
+ ),
35
42
  [inputs],
36
43
  );
37
44
 
@@ -6,7 +6,7 @@ type ConsentData = {
6
6
  };
7
7
 
8
8
  export const CONSENTS: Record<keyof FormConsents, ConsentData> = {
9
- processPersonalDataLeadFlg: {
9
+ processPersonalDataFlg: {
10
10
  text: 'Согласие на обработку персональных данных',
11
11
  docId: 4,
12
12
  },
@@ -10,7 +10,7 @@ import { type Option } from '../../ui-kit/Select/Option';
10
10
  import { type FieldDef } from './ApplicationLeadFormContent';
11
11
 
12
12
  export interface FormConsents {
13
- processPersonalDataLeadFlg?: boolean;
13
+ processPersonalDataFlg?: boolean;
14
14
  consentProviderFlg?: boolean;
15
15
  consentPfrFlg?: boolean;
16
16
  consentInformFlg?: boolean;
@@ -127,7 +127,7 @@ const initialFormState = {
127
127
  posTerminal: false,
128
128
  consentToReceiveMaterials: false,
129
129
  consentDataProcessing: false,
130
- processPersonalDataLeadFlg: false,
130
+ processPersonalDataFlg: false,
131
131
  consentProviderFlg: false,
132
132
  consentOthersFlg: false,
133
133
  consentInformFlg: false,
@@ -150,7 +150,7 @@ export const getInitialFormState = (
150
150
  const formState = Object.fromEntries(
151
151
  inputs.map((_) => [
152
152
  _.name,
153
- (_.fieldType === 'ved' && _?.defaultValue) || initialFormState[_.name],
153
+ (_.fieldType === 'ved' && _?.defaultValue) || initialFormState[_.name || ''],
154
154
  ]),
155
155
  );
156
156
 
@@ -7,7 +7,7 @@ export const useInitApplicationLead = (nextStepLink: string) => {
7
7
  const [isLoading, setIsLoading] = useState(false);
8
8
  const [profileId] = useLocalStorage<string>('profileId');
9
9
  const [, setEsiaData] = useLocalStorage('esiaData');
10
- const params = new URLSearchParams(decodeURIComponent(window.location.search));
10
+ const params = new URLSearchParams(decodeURIComponent(globalThis.location.search));
11
11
  const esiaAuth = params.get('esiaAuth');
12
12
 
13
13
  const updateEsiaProfile = useCallback(async () => {
@@ -3,8 +3,10 @@ import { useCallback, useMemo, useState } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
4
4
  import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
5
5
  import { style } from '../../utils/style';
6
- import { type SectionsProps } from '../ApplicationForm/ApplicationFormContent';
7
- import { type FieldDef } from '../ApplicationLeadForm/ApplicationLeadFormContent';
6
+ import {
7
+ type FieldDef,
8
+ type SectionsProps,
9
+ } from '../ApplicationLeadForm/ApplicationLeadFormContent';
8
10
  import { type CreditFormContent } from './CreditFormContent';
9
11
  import { CreditFormProgress } from './CreditFormProgress';
10
12
  import { CreditFormStep } from './CreditFormStep';
@@ -22,12 +24,13 @@ const STEPS_TITLES = [
22
24
  interface CreditFormProps extends CreditFormContent, UniBlockProps {}
23
25
 
24
26
  export const CreditForm = JSX<CreditFormProps>(({ className, ...rest }) => {
25
- const [step, setStep] = useState(1);
27
+ const [step, setStep] = useState(0);
26
28
  const sections = useMemo(() => stepsSectionsMap[step], [step]);
29
+
27
30
  const inputs = (sections?.flatMap((_: SectionsProps) => _?.inputs) || []) as FieldDef[];
28
31
 
29
32
  const handleNextStep = useCallback(() => {
30
- setStep((_) => Math.min(_ + 1, STEPS_COUNT));
33
+ setStep((_) => Math.min(_ + 1, STEPS_COUNT - 1));
31
34
  }, []);
32
35
 
33
36
  const handlePrevStep = useCallback(() => {
@@ -43,7 +46,6 @@ export const CreditForm = JSX<CreditFormProps>(({ className, ...rest }) => {
43
46
  <CreditFormStep
44
47
  inputs={inputs}
45
48
  key={String(step)}
46
- totalSteps={STEPS_COUNT}
47
49
  step={step}
48
50
  sections={sections}
49
51
  onNextStep={handleNextStep}
@@ -9,16 +9,16 @@ export interface CreditFormProgressProps {
9
9
  }
10
10
 
11
11
  export const CreditFormProgress = JSX<CreditFormProgressProps>(
12
- ({ step = 1, totalSteps = 5, stepsTitles = [] }) => {
13
- const progress = useMemo(() => (step / totalSteps) * 100, [step, totalSteps]);
12
+ ({ step = 0, totalSteps = 5, stepsTitles = [] }) => {
13
+ const progress = useMemo(() => ((step + 1) / totalSteps) * 100, [step, totalSteps]);
14
14
 
15
15
  return (
16
16
  <div className="py-lg px-5xl bg-white col-span-12">
17
17
  <div>
18
18
  <span className="font-bold">
19
- Шаг {step} из {totalSteps}.
20
- </span>{' '}
21
- {stepsTitles[step - 1] || null}
19
+ Шаг {step + 1} из {totalSteps}.
20
+ </span>
21
+ {stepsTitles[step] || null}
22
22
  <ProgressBar step={progress} showPercentage={false} />
23
23
  </div>
24
24
  </div>
@@ -13,12 +13,11 @@ import { StepsNavigationButtons } from './StepsNavigationButtons';
13
13
  import { useCreditFormApi } from './useCreditFormApi';
14
14
 
15
15
  export interface StepProps {
16
- sections: SectionsProps[];
16
+ sections?: SectionsProps[];
17
17
  field: FormFieldRegisterer<FormStateMap[keyof FormStateMap]>;
18
18
  }
19
19
 
20
20
  export interface CreditFormStepProps {
21
- totalSteps: number;
22
21
  step: number;
23
22
  sections: SectionsProps[];
24
23
  inputs: FieldDef[];
@@ -27,7 +26,7 @@ export interface CreditFormStepProps {
27
26
  }
28
27
 
29
28
  export const CreditFormStep = JSX<CreditFormStepProps>(
30
- ({ totalSteps, step, sections, onPrevStep, onNextStep, inputs }) => {
29
+ ({ step, sections, onPrevStep, onNextStep, inputs }) => {
31
30
  const [localStorageData, saveStep] = useLocalStorage<Record<string, any>>('leadForm');
32
31
  const initialState = getInitialFormState(step as keyof FormStateMap, localStorageData);
33
32
 
@@ -42,14 +41,14 @@ export const CreditFormStep = JSX<CreditFormStepProps>(
42
41
  return (
43
42
  <form onSubmit={onSubmit} className="space-y-m">
44
43
  {renderStep({ sections, field })}
45
- <StepsNavigationButtons step={step} totalSteps={totalSteps} onPrevStep={onPrevStep} />
44
+ <StepsNavigationButtons step={step} onPrevStep={onPrevStep} />
46
45
  </form>
47
46
  );
48
47
  },
49
48
  );
50
49
 
51
50
  const renderStep = ({ sections, field }: StepProps) => {
52
- return sections.map((_, i) => (
51
+ return sections?.map((_, i) => (
53
52
  <div key={`section-${i}`} className={style(inputColumnStyles(_.columns), 'grid gap-x-m')}>
54
53
  {renderInfo(_?.inputs)}
55
54
  {renderTitle(_?.title)}
@@ -4,11 +4,12 @@ import { style } from '../../utils/style';
4
4
 
5
5
  export interface StepsNavigationButtonsProps {
6
6
  step: number;
7
- totalSteps: number;
8
7
  onPrevStep?: () => void;
9
8
  }
10
9
 
11
10
  export const StepsNavigationButtons = JSX<StepsNavigationButtonsProps>(({ step, onPrevStep }) => {
11
+ const isFirstStep = step === 0;
12
+
12
13
  return (
13
14
  <div className={'flex justify-between'}>
14
15
  <Button
@@ -16,7 +17,7 @@ export const StepsNavigationButtons = JSX<StepsNavigationButtonsProps>(({ step,
16
17
  className={style('w-full @xl:w-auto')}
17
18
  type="button"
18
19
  version="secondary"
19
- disabled={step === 1}
20
+ disabled={isFirstStep}
20
21
  >
21
22
  Назад
22
23
  </Button>
@@ -1,9 +1,10 @@
1
1
  /* eslint-disable max-lines */
2
2
  /* eslint-disable max-len */
3
3
 
4
- //TODO: DO List
5
- export const stepsSectionsMap = {
6
- 1: [
4
+ import { type SectionsProps } from '../ApplicationLeadForm/ApplicationLeadFormContent';
5
+
6
+ export const stepsSectionsMap: SectionsProps[][] = [
7
+ [
7
8
  {
8
9
  title: 'Персональные данные',
9
10
  columns: 2,
@@ -58,7 +59,7 @@ export const stepsSectionsMap = {
58
59
  ],
59
60
  },
60
61
  ],
61
- 2: [
62
+ [
62
63
  {
63
64
  title: 'Данные о трудоустройстве',
64
65
  inputs: [],
@@ -119,10 +120,10 @@ export const stepsSectionsMap = {
119
120
  inputs: [],
120
121
  },
121
122
  {
122
- inputs: [{ fieldType: 'common', name: 'fullAddress', required: true }],
123
+ inputs: [{ fieldType: 'common', name: 'fullAddress', required: true, dadata: true }],
123
124
  },
124
125
  ],
125
- 3: [
126
+ [
126
127
  {
127
128
  title: 'Семейное положение',
128
129
  },
@@ -166,7 +167,7 @@ export const stepsSectionsMap = {
166
167
  inputs: [{ fieldType: 'common', name: 'armyIdFlg' }],
167
168
  },
168
169
  ],
169
- 4: [
170
+ [
170
171
  {
171
172
  title: 'Дополнительные сведения',
172
173
  columns: 1,
@@ -188,7 +189,7 @@ export const stepsSectionsMap = {
188
189
  inputs: [{ fieldType: 'common', name: 'creditInRshbCd' }],
189
190
  },
190
191
  ],
191
- 5: [
192
+ [
192
193
  {
193
194
  title: 'Отделение Банка',
194
195
  columns: 1,
@@ -217,4 +218,4 @@ export const stepsSectionsMap = {
217
218
  inputs: [{ fieldType: 'common', name: 'bankEmployeeCode' }],
218
219
  },
219
220
  ],
220
- };
221
+ ];
@@ -4,12 +4,28 @@ import { type CustomFieldProps } from '../CustomFieldProps';
4
4
  import { validatorObj } from '../getObjectValidator';
5
5
  import { getValidation } from '../getValidation';
6
6
 
7
- export const PartInBusinessField = JSX<CustomFieldProps>(({ field, input }) => (
8
- <InputControl
9
- label="Доля участия в бизнесе"
10
- placeholder= %"
11
- inputLength={2}
12
- {...getValidation(field('partInBusiness'), validatorObj.partInBusiness, input?.required)}
13
- {...input}
14
- />
15
- ));
7
+ const MAX_PART = 100;
8
+
9
+ export const PartInBusinessField = JSX<CustomFieldProps>(({ field, input }) => {
10
+ const partInBusinessField = {
11
+ ...getValidation(field('partInBusiness'), validatorObj.partInBusiness, input?.required),
12
+ };
13
+
14
+ const handleChange = (value: string) =>
15
+ partInBusinessField?.onChange &&
16
+ partInBusinessField?.onChange(
17
+ String(Number(value) > MAX_PART ? MAX_PART : Number(value) || ''),
18
+ );
19
+
20
+ return (
21
+ <InputControl
22
+ label="Доля участия в бизнесе"
23
+ placeholder="в %"
24
+ inputLength={3}
25
+ type="number"
26
+ {...partInBusinessField}
27
+ {...input}
28
+ onChange={handleChange}
29
+ />
30
+ );
31
+ });
@@ -52,7 +52,7 @@ export type NameFieldDef =
52
52
  | 'consentOthersFlg'
53
53
  | 'consentPfrFlg'
54
54
  | 'consentProviderFlg'
55
- | 'processPersonalDataLeadFlg'
55
+ | 'processPersonalDataFlg'
56
56
  | 'legalForm'
57
57
  | 'organizationName'
58
58
  | 'generalSeniority'
@@ -130,7 +130,7 @@ export const getField =
130
130
  bankEmpolee: <BankEmpoleeField field={field} />,
131
131
  secondaryPhone: <SecondaryPhoneField field={field} />,
132
132
  consentToReceiveMaterials: <ConsentField field={field} input={input} />,
133
- processPersonalDataLeadFlg: <ConsentField field={field} input={input} />,
133
+ processPersonalDataFlg: <ConsentField field={field} input={input} />,
134
134
  consentProviderFlg: <ConsentField field={field} input={input} />,
135
135
  consentOthersFlg: <ConsentField field={field} input={input} />,
136
136
  consentInformFlg: <ConsentField field={field} input={input} />,
@@ -183,6 +183,6 @@ export const getField =
183
183
  };
184
184
 
185
185
  return isRenderField({ input, field }) ? (
186
- <div key={String(i)}>{InputsMap[input?.name]}</div>
186
+ <div key={String(i)}>{InputsMap[input?.name || '']}</div>
187
187
  ) : null;
188
188
  };
@@ -64,7 +64,7 @@ export const validatorObj: Record<string, Validator> = {
64
64
  consentDataProcessing: agreementValidator,
65
65
  annualRevenue: defaultValidator(),
66
66
  consentToReceiveMaterials: agreementValidator,
67
- processPersonalDataLeadFlg: agreementValidator,
67
+ processPersonalDataFlg: agreementValidator,
68
68
  consentProviderFlg: agreementValidator,
69
69
  consentPfrFlg: agreementValidator,
70
70
  consentOthersFlg: agreementValidator,
@@ -96,5 +96,5 @@ export const validatorObj: Record<string, Validator> = {
96
96
  export const getObjectValidator = (inputs: FieldDef[]): Record<string, Validator> => {
97
97
  const requiredInputs = getNamesFromInput(inputs.filter((_: FieldDef) => Boolean(_?.required)));
98
98
 
99
- return Object.fromEntries(requiredInputs.map((_) => [_, validatorObj?.[_]]));
99
+ return Object.fromEntries(requiredInputs.map((_) => [_, validatorObj?.[_ || '']]));
100
100
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.621",
3
+ "version": "0.14.623",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -10,7 +10,7 @@ export type UpdateUserProfileBody = {
10
10
  surname?: string;
11
11
  midname?: string;
12
12
  birthDate?: string;
13
- processPersonalDataLeadFlg?: boolean;
13
+ processPersonalDataFlg?: boolean;
14
14
  consentProviderFlg?: boolean;
15
15
  consentPfrFlg?: boolean;
16
16
  consentPhotoFlg?: boolean;
@@ -14,7 +14,7 @@ export const getUpdateUserProfileData = (
14
14
  birthday = '',
15
15
  phone = '',
16
16
  email = '',
17
- processPersonalDataLeadFlg,
17
+ processPersonalDataFlg,
18
18
  consentProviderFlg,
19
19
  consentPfrFlg,
20
20
  consentPhotoFlg,
@@ -32,7 +32,7 @@ export const getUpdateUserProfileData = (
32
32
  birthDate: birthday && formatDate(birthday, true),
33
33
  email,
34
34
  phone: formatPhone(phone),
35
- processPersonalDataLeadFlg: Boolean(processPersonalDataLeadFlg),
35
+ processPersonalDataFlg: Boolean(processPersonalDataFlg),
36
36
  consentProviderFlg: Boolean(consentProviderFlg),
37
37
  consentPfrFlg: Boolean(consentPfrFlg),
38
38
  consentPhotoFlg: Boolean(consentPhotoFlg),
@@ -62,6 +62,7 @@ export const hintsListsOptions: HintsListOptions = {
62
62
  organizationName: ORGANIZATION_NAME_HINTS_LIST_OPTIONS,
63
63
  inn: ORGANIZATION_INN_HINTS_LIST_OPTIONS,
64
64
  participantAddress: ADDRESS_HINTS_LIST_OPTIONS,
65
+ fullAddress: ADDRESS_HINTS_LIST_OPTIONS,
65
66
  };
66
67
 
67
68
  export type HintOption = {
@@ -29,7 +29,7 @@ export type ConditionFieldProps = {
29
29
  export type FieldDefaultDef = Required &
30
30
  LabelProps &
31
31
  ConditionFieldProps & {
32
- name: NameFieldDef;
32
+ name?: NameFieldDef;
33
33
  dadata?: boolean;
34
34
  };
35
35
 
@@ -60,7 +60,7 @@ export const getInitialFormState = (inputs: FieldDef[], typeForm = ''): FormStat
60
60
  const formState = Object.fromEntries(
61
61
  inputs.map((_) => [
62
62
  _.name,
63
- (_.fieldType === 'ved' && _?.defaultValue) || initialFormState[_.name],
63
+ (_.fieldType === 'ved' && _?.defaultValue) || initialFormState[_.name || ''],
64
64
  ]),
65
65
  );
66
66
 
@@ -20,6 +20,6 @@ export const renderInputs = ({ field, typeForm = '', inputs }: GroupedConsentsPr
20
20
  };
21
21
 
22
22
  const splitInputs = (inputs?: FieldDef[]) => ({
23
- consentInputs: inputs?.filter((_) => Object.keys(CONSENTS).includes(_.name)) || [],
24
- restInputs: inputs?.filter((_) => !Object.keys(CONSENTS).includes(_.name)) || [],
23
+ consentInputs: inputs?.filter((_) => Object.keys(CONSENTS).includes(_.name || '')) || [],
24
+ restInputs: inputs?.filter((_) => !Object.keys(CONSENTS).includes(_.name || '')) || [],
25
25
  });
@@ -47,7 +47,7 @@
47
47
  "inputs": [
48
48
  {
49
49
  "fieldType": "common",
50
- "name": "processPersonalDataLeadFlg",
50
+ "name": "processPersonalDataFlg",
51
51
  "required": true
52
52
  },
53
53
  {
@@ -31,7 +31,7 @@ export default {
31
31
  },
32
32
  {
33
33
  inputs: [
34
- { fieldType: 'common', name: 'processPersonalDataLeadFlg', required: true },
34
+ { fieldType: 'common', name: 'processPersonalDataFlg', required: true },
35
35
  { fieldType: 'common', name: 'consentProviderFlg', required: true },
36
36
  { fieldType: 'common', name: 'consentInformFlg', required: true },
37
37
  { fieldType: 'common', name: 'consentOthersFlg', required: true },
@@ -33,7 +33,7 @@ export default {
33
33
  },
34
34
  {
35
35
  inputs: [
36
- { fieldType: 'common', name: 'processPersonalDataLeadFlg', required: true },
36
+ { fieldType: 'common', name: 'processPersonalDataFlg', required: true },
37
37
  { fieldType: 'common', name: 'consentInformFlg', required: true },
38
38
  { fieldType: 'common', name: 'consentProviderFlg', required: true },
39
39
  { fieldType: 'common', name: 'consentOthersFlg', required: true },
@@ -47,125 +47,4 @@ export default {
47
47
  <DialogManager />
48
48
  </div>
49
49
  ),
50
- step1: (
51
- <div className="container grid grid-cols-12">
52
- <ApplicationLeadForm
53
- className="col-span-12"
54
- title="Заявка на кредит &#171;Кредит на любые цели&#187;"
55
- typeForm="CORRUPTION"
56
- endpoint="lead"
57
- sections={[
58
- { title: 'Персональные данные', inputs: [] },
59
- {
60
- columns: 2,
61
- inputs: [
62
- { fieldType: 'common', name: 'surname', required: true, dadata: true },
63
- { fieldType: 'common', name: 'name', required: true, dadata: true },
64
- { fieldType: 'common', name: 'middleName', dadata: true },
65
- { fieldType: 'common', name: 'sex', required: true },
66
- { fieldType: 'common', name: 'birthday', required: true },
67
- { fieldType: 'common', name: 'birthPlace', required: true },
68
- { fieldType: 'common', name: 'phone', required: true },
69
- { fieldType: 'common', name: 'email', required: true, dadata: true },
70
- ],
71
- },
72
- {
73
- title: 'Паспортные данные',
74
- inputs: [
75
- { fieldType: 'common', name: 'dulSerie', required: true },
76
- { fieldType: 'common', name: 'dulNumber', required: true },
77
- { fieldType: 'common', name: 'dulIssueDateField', required: true },
78
- { fieldType: 'common', name: 'dulSubdivisionCode', required: true, dadata: true },
79
- ],
80
- },
81
- {
82
- inputs: [
83
- { fieldType: 'common', name: 'dulIssuedBy', required: true, dadata: true },
84
- {
85
- fieldType: 'common',
86
- name: 'education',
87
- required: true,
88
- },
89
- ],
90
- },
91
- {
92
- title: 'Адрес регистрации по месту жительства',
93
- inputs: [],
94
- },
95
- {
96
- inputs: [
97
- { fieldType: 'common', name: 'participantDateRegistration', required: true },
98
- { fieldType: 'common', name: 'participantAddress', required: true, dadata: true },
99
- ],
100
- },
101
- ]}
102
- button={button}
103
- />
104
- <PopupManager />
105
- <DialogManager />
106
- </div>
107
- ),
108
- employmentData: (
109
- <div className="container grid grid-cols-12">
110
- <ApplicationLeadForm
111
- className="col-span-12"
112
- title="Заявка на кредит &#171;Кредит на любые цели&#187;"
113
- typeForm="CORRUPTION"
114
- endpoint="lead"
115
- sections={[
116
- {
117
- title: 'Данные о трудоустройстве',
118
- inputs: [],
119
- },
120
- {
121
- inputs: [
122
- { fieldType: 'common', name: 'employment', required: true },
123
- { fieldType: 'common', name: 'organizationName', required: true, dadata: true },
124
- ],
125
- },
126
- {
127
- columns: 2,
128
- inputs: [
129
- { fieldType: 'common', name: 'inn', required: true, dadata: true },
130
- { fieldType: 'common', name: 'legalForm', required: true },
131
- ],
132
- },
133
- {
134
- inputs: [
135
- { fieldType: 'common', name: 'organization', required: true },
136
- { fieldType: 'common', name: 'amountWorkers', required: true },
137
- ],
138
- },
139
- {
140
- columns: 2,
141
- inputs: [
142
- { fieldType: 'common', name: 'employerActivities', required: true },
143
- { fieldType: 'common', name: 'employerOrganization', required: true },
144
- { fieldType: 'common', name: 'generalSeniority', required: true },
145
- { fieldType: 'common', name: 'lastJobExperience', required: true },
146
- { fieldType: 'common', name: 'experience5Years', required: true },
147
- { fieldType: 'common', name: 'jobsNumber', required: true },
148
- ],
149
- },
150
- {
151
- inputs: [
152
- { fieldType: 'common', name: 'phone', label: 'Телефон работодателя', required: true },
153
- { fieldType: 'common', name: 'beginDate', required: true },
154
- { fieldType: 'common', name: 'positionOrganization', required: true },
155
- ],
156
- },
157
- {
158
- title: 'Адрес работодателя',
159
- inputs: [],
160
- },
161
- {
162
- inputs: [{ fieldType: 'common', name: 'fullAddress', required: true }],
163
- },
164
- ]}
165
- button={button}
166
- />
167
- <PopupManager />
168
- <DialogManager />
169
- </div>
170
- ),
171
50
  };
@@ -28,7 +28,7 @@ export type FieldDefaultDef = Required &
28
28
  TextProps &
29
29
  LabelProps &
30
30
  ConditionFieldProps & {
31
- name: NameFieldDef;
31
+ name?: NameFieldDef;
32
32
  };
33
33
 
34
34
  /**
@@ -18,7 +18,7 @@ const CONSENT_REQUIRED = 'Отметьте все обязательные со
18
18
 
19
19
  export const GroupedConsents = JSX<GroupedConsentsProps>(
20
20
  ({ inputs = [], typeForm = '', field, key }) => {
21
- const isChecked = inputs.every((_) => Boolean(field(_.name).value));
21
+ const isChecked = inputs.every((_) => Boolean(field(_.name as keyof FormState).value));
22
22
 
23
23
  const handleGeneralToggle = (value: boolean) => {
24
24
  for (const item of inputs) {
@@ -31,7 +31,14 @@ export const GroupedConsents = JSX<GroupedConsentsProps>(
31
31
  () =>
32
32
  inputs
33
33
  ?.filter((_) => _.required)
34
- ?.some((_) => Boolean(withValidator(field(_?.name), validatorObj[_?.name]).error)),
34
+ ?.some((_) =>
35
+ Boolean(
36
+ withValidator(
37
+ field(_?.name as keyof FormState),
38
+ validatorObj[_?.name as keyof FormState],
39
+ ).error,
40
+ ),
41
+ ),
35
42
  [inputs],
36
43
  );
37
44
 
@@ -6,7 +6,7 @@ type ConsentData = {
6
6
  };
7
7
 
8
8
  export const CONSENTS: Record<keyof FormConsents, ConsentData> = {
9
- processPersonalDataLeadFlg: {
9
+ processPersonalDataFlg: {
10
10
  text: 'Согласие на обработку персональных данных',
11
11
  docId: 4,
12
12
  },
@@ -10,7 +10,7 @@ import { type Option } from '../../ui-kit/Select/Option';
10
10
  import { type FieldDef } from './ApplicationLeadFormContent';
11
11
 
12
12
  export interface FormConsents {
13
- processPersonalDataLeadFlg?: boolean;
13
+ processPersonalDataFlg?: boolean;
14
14
  consentProviderFlg?: boolean;
15
15
  consentPfrFlg?: boolean;
16
16
  consentInformFlg?: boolean;
@@ -127,7 +127,7 @@ const initialFormState = {
127
127
  posTerminal: false,
128
128
  consentToReceiveMaterials: false,
129
129
  consentDataProcessing: false,
130
- processPersonalDataLeadFlg: false,
130
+ processPersonalDataFlg: false,
131
131
  consentProviderFlg: false,
132
132
  consentOthersFlg: false,
133
133
  consentInformFlg: false,
@@ -150,7 +150,7 @@ export const getInitialFormState = (
150
150
  const formState = Object.fromEntries(
151
151
  inputs.map((_) => [
152
152
  _.name,
153
- (_.fieldType === 'ved' && _?.defaultValue) || initialFormState[_.name],
153
+ (_.fieldType === 'ved' && _?.defaultValue) || initialFormState[_.name || ''],
154
154
  ]),
155
155
  );
156
156