@redneckz/wildless-cms-uni-blocks 0.14.952 → 0.14.953

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 (113) hide show
  1. package/bundle/bundle.umd.js +170 -58
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/retail/utils/calculateInputs.d.ts +1 -1
  4. package/bundle/retail/utils/renderStep.d.ts +1 -2
  5. package/bundle/retail/validator/getRetailFormValidator.d.ts +1 -2
  6. package/dist/components/CreditCardForm/CreditCardFormStep.js +1 -2
  7. package/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  8. package/dist/components/CreditCardForm/creditCardFormStepsData.js +84 -13
  9. package/dist/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
  10. package/dist/components/CreditForm/CreditFormStep.js +1 -2
  11. package/dist/components/CreditForm/CreditFormStep.js.map +1 -1
  12. package/dist/components/CreditForm/creditFormStepsData.js +52 -8
  13. package/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  14. package/dist/components/DebitForm/DebitFormStep.js +1 -2
  15. package/dist/components/DebitForm/DebitFormStep.js.map +1 -1
  16. package/dist/retail/adaptors/getEmploymentData.js +25 -21
  17. package/dist/retail/adaptors/getEmploymentData.js.map +1 -1
  18. package/dist/retail/utils/calculateInputs.d.ts +1 -1
  19. package/dist/retail/utils/calculateInputs.js +2 -6
  20. package/dist/retail/utils/calculateInputs.js.map +1 -1
  21. package/dist/retail/utils/renderStep.d.ts +1 -2
  22. package/dist/retail/utils/renderStep.js +2 -2
  23. package/dist/retail/utils/renderStep.js.map +1 -1
  24. package/dist/retail/validator/getRetailFormValidator.d.ts +1 -2
  25. package/dist/retail/validator/getRetailFormValidator.js +1 -1
  26. package/dist/retail/validator/getRetailFormValidator.js.map +1 -1
  27. package/lib/components/CreditCardForm/CreditCardFormStep.js +1 -2
  28. package/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  29. package/lib/components/CreditCardForm/creditCardFormStepsData.js +84 -13
  30. package/lib/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
  31. package/lib/components/CreditForm/CreditFormStep.js +1 -2
  32. package/lib/components/CreditForm/CreditFormStep.js.map +1 -1
  33. package/lib/components/CreditForm/creditFormStepsData.js +52 -8
  34. package/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  35. package/lib/components/DebitForm/DebitFormStep.js +1 -2
  36. package/lib/components/DebitForm/DebitFormStep.js.map +1 -1
  37. package/lib/retail/adaptors/getEmploymentData.js +25 -21
  38. package/lib/retail/adaptors/getEmploymentData.js.map +1 -1
  39. package/lib/retail/utils/calculateInputs.d.ts +1 -1
  40. package/lib/retail/utils/calculateInputs.js +2 -6
  41. package/lib/retail/utils/calculateInputs.js.map +1 -1
  42. package/lib/retail/utils/renderStep.d.ts +1 -2
  43. package/lib/retail/utils/renderStep.js +2 -2
  44. package/lib/retail/utils/renderStep.js.map +1 -1
  45. package/lib/retail/validator/getRetailFormValidator.d.ts +1 -2
  46. package/lib/retail/validator/getRetailFormValidator.js +1 -1
  47. package/lib/retail/validator/getRetailFormValidator.js.map +1 -1
  48. package/mobile/bundle/bundle.umd.js +170 -58
  49. package/mobile/bundle/bundle.umd.min.js +1 -1
  50. package/mobile/bundle/retail/utils/calculateInputs.d.ts +1 -1
  51. package/mobile/bundle/retail/utils/renderStep.d.ts +1 -2
  52. package/mobile/bundle/retail/validator/getRetailFormValidator.d.ts +1 -2
  53. package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js +1 -2
  54. package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  55. package/mobile/dist/components/CreditCardForm/creditCardFormStepsData.js +84 -13
  56. package/mobile/dist/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
  57. package/mobile/dist/components/CreditForm/CreditFormStep.js +1 -2
  58. package/mobile/dist/components/CreditForm/CreditFormStep.js.map +1 -1
  59. package/mobile/dist/components/CreditForm/creditFormStepsData.js +52 -8
  60. package/mobile/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  61. package/mobile/dist/components/DebitForm/DebitFormStep.js +1 -2
  62. package/mobile/dist/components/DebitForm/DebitFormStep.js.map +1 -1
  63. package/mobile/dist/retail/adaptors/getEmploymentData.js +25 -21
  64. package/mobile/dist/retail/adaptors/getEmploymentData.js.map +1 -1
  65. package/mobile/dist/retail/utils/calculateInputs.d.ts +1 -1
  66. package/mobile/dist/retail/utils/calculateInputs.js +2 -6
  67. package/mobile/dist/retail/utils/calculateInputs.js.map +1 -1
  68. package/mobile/dist/retail/utils/renderStep.d.ts +1 -2
  69. package/mobile/dist/retail/utils/renderStep.js +2 -2
  70. package/mobile/dist/retail/utils/renderStep.js.map +1 -1
  71. package/mobile/dist/retail/validator/getRetailFormValidator.d.ts +1 -2
  72. package/mobile/dist/retail/validator/getRetailFormValidator.js +1 -1
  73. package/mobile/dist/retail/validator/getRetailFormValidator.js.map +1 -1
  74. package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js +1 -2
  75. package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  76. package/mobile/lib/components/CreditCardForm/creditCardFormStepsData.js +84 -13
  77. package/mobile/lib/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
  78. package/mobile/lib/components/CreditForm/CreditFormStep.js +1 -2
  79. package/mobile/lib/components/CreditForm/CreditFormStep.js.map +1 -1
  80. package/mobile/lib/components/CreditForm/creditFormStepsData.js +52 -8
  81. package/mobile/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  82. package/mobile/lib/components/DebitForm/DebitFormStep.js +1 -2
  83. package/mobile/lib/components/DebitForm/DebitFormStep.js.map +1 -1
  84. package/mobile/lib/retail/adaptors/getEmploymentData.js +25 -21
  85. package/mobile/lib/retail/adaptors/getEmploymentData.js.map +1 -1
  86. package/mobile/lib/retail/utils/calculateInputs.d.ts +1 -1
  87. package/mobile/lib/retail/utils/calculateInputs.js +2 -6
  88. package/mobile/lib/retail/utils/calculateInputs.js.map +1 -1
  89. package/mobile/lib/retail/utils/renderStep.d.ts +1 -2
  90. package/mobile/lib/retail/utils/renderStep.js +2 -2
  91. package/mobile/lib/retail/utils/renderStep.js.map +1 -1
  92. package/mobile/lib/retail/validator/getRetailFormValidator.d.ts +1 -2
  93. package/mobile/lib/retail/validator/getRetailFormValidator.js +1 -1
  94. package/mobile/lib/retail/validator/getRetailFormValidator.js.map +1 -1
  95. package/mobile/src/components/CreditCardForm/CreditCardFormStep.tsx +1 -2
  96. package/mobile/src/components/CreditCardForm/creditCardFormStepsData.tsx +84 -13
  97. package/mobile/src/components/CreditForm/CreditFormStep.tsx +1 -2
  98. package/mobile/src/components/CreditForm/creditFormStepsData.tsx +52 -8
  99. package/mobile/src/components/DebitForm/DebitFormStep.tsx +1 -2
  100. package/mobile/src/retail/adaptors/getEmploymentData.tsx +25 -21
  101. package/mobile/src/retail/utils/calculateInputs.ts +2 -10
  102. package/mobile/src/retail/utils/renderStep.tsx +1 -3
  103. package/mobile/src/retail/validator/getRetailFormValidator.ts +1 -3
  104. package/package.json +1 -1
  105. package/src/components/CreditCardForm/CreditCardFormStep.tsx +1 -2
  106. package/src/components/CreditCardForm/creditCardFormStepsData.tsx +84 -13
  107. package/src/components/CreditForm/CreditFormStep.tsx +1 -2
  108. package/src/components/CreditForm/creditFormStepsData.tsx +52 -8
  109. package/src/components/DebitForm/DebitFormStep.tsx +1 -2
  110. package/src/retail/adaptors/getEmploymentData.tsx +25 -21
  111. package/src/retail/utils/calculateInputs.ts +2 -10
  112. package/src/retail/utils/renderStep.tsx +1 -3
  113. package/src/retail/validator/getRetailFormValidator.ts +1 -3
@@ -40,6 +40,7 @@ const EMPLOYMENT_CONTENT: SectionsRetailProps[] = [
40
40
  label:
41
41
  'Клиент на момент оформления заявки на кредит должен быть: официально трудоустроен более 6 месяцев, ' +
42
42
  'если Клиент получает з/п на счет РСХБ, то трудоустроен более 3 месяцев, не должен находиться в декретном отпуске',
43
+ condition: { name: 'employment', values: ['WORK', 'WORK_RETIREE'] },
43
44
  },
44
45
  ],
45
46
  },
@@ -49,34 +50,69 @@ const EMPLOYMENT_CONTENT: SectionsRetailProps[] = [
49
50
  {
50
51
  columns: 2,
51
52
  inputs: [
52
- { name: 'organizationName', required: true, dadata: true, filledByEsia: true },
53
- { name: 'inn', required: true, dadata: true, filledByEsia: true },
53
+ {
54
+ name: 'organizationName',
55
+ required: true,
56
+ dadata: true,
57
+ filledByEsia: true,
58
+ condition: { name: 'employment', values: ['WORK', 'WORK_RETIREE'] },
59
+ },
60
+ {
61
+ name: 'inn',
62
+ required: true,
63
+ dadata: true,
64
+ filledByEsia: true,
65
+ condition: { name: 'employment', values: ['WORK', 'WORK_RETIREE'] },
66
+ },
54
67
  ],
55
68
  },
56
69
  {
57
70
  columns: 2,
58
71
  inputs: [
59
- { name: 'amountWorkers', required: true },
72
+ {
73
+ name: 'amountWorkers',
74
+ required: true,
75
+ condition: { name: 'employment', values: ['WORK', 'WORK_RETIREE'] },
76
+ },
60
77
  {
61
78
  name: 'organizationPhone',
62
79
  label: 'Телефон работодателя',
63
80
  required: true,
81
+ condition: { name: 'employment', values: ['WORK', 'WORK_RETIREE'] },
64
82
  },
65
83
  ],
66
84
  },
67
85
  {
68
86
  columns: 2,
69
87
  inputs: [
70
- { name: 'jobsNumber', required: true, filledByEsia: true },
71
- { name: 'beginDate', required: true, filledByEsia: true },
88
+ {
89
+ name: 'jobsNumber',
90
+ required: true,
91
+ filledByEsia: true,
92
+ condition: { name: 'employment', values: ['WORK', 'WORK_RETIREE'] },
93
+ },
94
+ {
95
+ name: 'beginDate',
96
+ required: true,
97
+ filledByEsia: true,
98
+ condition: { name: 'employment', values: ['WORK', 'WORK_RETIREE'] },
99
+ },
72
100
  ],
73
101
  },
74
102
  {
75
103
  title: 'Адрес работодателя',
76
104
  inputs: [],
105
+ condition: { name: 'employment', values: ['WORK', 'WORK_RETIREE'] },
77
106
  },
78
107
  {
79
- inputs: [{ name: 'organizationAddress', required: true, dadata: true }],
108
+ inputs: [
109
+ {
110
+ name: 'organizationAddress',
111
+ required: true,
112
+ dadata: true,
113
+ condition: { name: 'employment', values: ['WORK', 'WORK_RETIREE'] },
114
+ },
115
+ ],
80
116
  },
81
117
  ];
82
118
  const FAMILY_STATUS_AND_INCOME_CONTENT: SectionsRetailProps[] = [
@@ -112,12 +148,20 @@ const FAMILY_STATUS_AND_INCOME_CONTENT: SectionsRetailProps[] = [
112
148
  {
113
149
  name: 'infoCard',
114
150
  label: 'Сумма основного и дополнительных доходов после вычета налога',
151
+ condition: { name: 'employment', values: ['WORK', 'WORK_RETIREE'] },
115
152
  },
116
153
  ],
117
154
  },
118
155
  {
119
156
  columns: 1,
120
- inputs: [{ name: 'wages', required: true, filledByEsia: true }],
157
+ inputs: [
158
+ {
159
+ name: 'wages',
160
+ required: true,
161
+ filledByEsia: true,
162
+ condition: { name: 'employment', values: ['WORK', 'WORK_RETIREE'] },
163
+ },
164
+ ],
121
165
  },
122
166
  {
123
167
  columns: 1,
@@ -125,7 +169,7 @@ const FAMILY_STATUS_AND_INCOME_CONTENT: SectionsRetailProps[] = [
125
169
  {
126
170
  name: 'retirementIncome',
127
171
  required: true,
128
- condition: { name: 'employment', values: ['RETIREE'] },
172
+ condition: { name: 'employment', values: ['RETIREE', 'WORK_RETIREE'] },
129
173
  },
130
174
  ],
131
175
  },
@@ -32,7 +32,6 @@ export const DebitFormStep = JSX<DebitFormStepProps>(
32
32
  getRetailFormValidator({
33
33
  formState,
34
34
  inputs,
35
- step,
36
35
  productType: PRODUCT_TYPE,
37
36
  }),
38
37
  [inputs],
@@ -51,7 +50,7 @@ export const DebitFormStep = JSX<DebitFormStepProps>(
51
50
 
52
51
  return (
53
52
  <form onSubmit={handleSubmit} className="space-y-m">
54
- {renderStep({ sections, field, step })}
53
+ {renderStep({ sections, field })}
55
54
  <StepsNavigationButtons step={step} isSending={isSending} onPrevStep={onPrevStep} />
56
55
  </form>
57
56
  );
@@ -25,25 +25,29 @@ export const getEmploymentData = (formData: LeadFormState): Partial<Participant>
25
25
  partInBusiness,
26
26
  } = formData;
27
27
 
28
- return {
29
- employmentContractDate: formatDate(beginDate || '', true),
30
- employmentTypeCd: employment,
31
- organizationName,
32
- organizationInn: inn,
33
- organizationActivityTypeCd: employerActivities?.key ? employerActivities : undefined,
34
- organizationTypeCd: organization,
35
- organizationKindCd: employerOrganization,
36
- employeesNumberCd: amountWorkers,
37
- opf: legalForm,
38
- seniority: generalSeniority,
39
- generalSeniority: experience5Years,
40
- jobsNumber,
41
- lastWorkDuration: lastJobExperience,
42
- positionCd: positionOrganization?.key ? positionOrganization : undefined,
43
- participantContacts: getParticipantContacts({
44
- organizationPhone: organizationPhone && formatPhone(organizationPhone),
45
- }),
46
- participantAddresses: getParticipantAddresses({ organizationAddress }),
47
- ownershipShare: positionOrganization?.key === 'BUSINESS_OWNER' ? partInBusiness : undefined,
48
- };
28
+ return employment?.key === 'RETIREE'
29
+ ? {
30
+ employmentTypeCd: employment,
31
+ }
32
+ : {
33
+ employmentContractDate: formatDate(beginDate || '', true),
34
+ employmentTypeCd: employment,
35
+ organizationName,
36
+ organizationInn: inn,
37
+ organizationActivityTypeCd: employerActivities?.key ? employerActivities : undefined,
38
+ organizationTypeCd: organization,
39
+ organizationKindCd: employerOrganization,
40
+ employeesNumberCd: amountWorkers,
41
+ opf: legalForm,
42
+ seniority: generalSeniority,
43
+ generalSeniority: experience5Years,
44
+ jobsNumber,
45
+ lastWorkDuration: lastJobExperience,
46
+ positionCd: positionOrganization?.key ? positionOrganization : undefined,
47
+ participantContacts: getParticipantContacts({
48
+ organizationPhone: organizationPhone && formatPhone(organizationPhone),
49
+ }),
50
+ participantAddresses: getParticipantAddresses({ organizationAddress }),
51
+ ownershipShare: positionOrganization?.key === 'BUSINESS_OWNER' ? partInBusiness : undefined,
52
+ };
49
53
  };
@@ -4,14 +4,12 @@ import { type FieldRetailDef } from '../model/RetailFormContent';
4
4
 
5
5
  export type GetValue = <K extends keyof LeadFormState>(name: K) => LeadFormState[K];
6
6
 
7
- export const calculateInputs = (getValue: GetValue) => (inputs: FieldRetailDef[], step: number) =>
7
+ export const calculateInputs = (getValue: GetValue) => (inputs: FieldRetailDef[]) =>
8
8
  inputs
9
9
  .filter((_) => _)
10
10
  .map((_) => {
11
11
  if (
12
12
  [
13
- checkIsRetiree(step, getValue),
14
- checkIsUnemployedRetiree(_, getValue),
15
13
  checkBusinessOwner(_, getValue),
16
14
  checkConsentPfrFlg(_, getValue),
17
15
  checkAddressFillFromESIA(_, getValue),
@@ -25,12 +23,6 @@ export const calculateInputs = (getValue: GetValue) => (inputs: FieldRetailDef[]
25
23
  return _;
26
24
  });
27
25
 
28
- const checkIsRetiree = (step: number, getValue: GetValue) =>
29
- step === 2 && getValue('employment')?.key === 'RETIREE';
30
-
31
- const checkIsUnemployedRetiree = ({ name }: FieldRetailDef, getValue: GetValue) =>
32
- name === 'wages' && getValue('employment')?.key === 'RETIREE' && !getValue('inn');
33
-
34
26
  const checkBusinessOwner = ({ name }: FieldRetailDef, getValue: GetValue) =>
35
27
  name === 'partInBusiness' && getValue('positionOrganization')?.key !== 'BUSINESS_OWNER';
36
28
 
@@ -42,7 +34,7 @@ const checkAddressFact = ({ name }: FieldRetailDef, getValue: GetValue) =>
42
34
 
43
35
  export const checkCondition = ({ condition }: FieldRetailDef, getValue: GetValue) =>
44
36
  condition?.name &&
45
- condition?.values?.some((_) => {
37
+ condition?.values?.every((_) => {
46
38
  const dataValue = getValue(condition?.name);
47
39
 
48
40
  return _ !== ((dataValue as Option)?.key ?? dataValue);
@@ -10,18 +10,16 @@ import { renderInputs } from './renderInputs';
10
10
  export interface StepProps<SectionsProps extends SectionsRetailProps> {
11
11
  sections?: SectionsProps[];
12
12
  field: FormFieldRegisterer<LeadFormState>;
13
- step: number;
14
13
  params?: Record<string, any>;
15
14
  }
16
15
 
17
16
  export const renderStep = <SectionsProps extends SectionsRetailProps>({
18
17
  sections,
19
18
  field,
20
- step,
21
19
  params,
22
20
  }: StepProps<SectionsProps>) =>
23
21
  sections?.map(({ inputs: origInputs = [], columns, title, condition }, i) => {
24
- const inputs = calculateInputs(getValue(field))(origInputs, step);
22
+ const inputs = calculateInputs(getValue(field))(origInputs);
25
23
  const cleanElements = [
26
24
  !checkCondition({ condition }, getValue(field)) ? renderTitle(title) : null,
27
25
  ...renderInputs({ field, inputs, params }),
@@ -17,17 +17,15 @@ import {
17
17
  type getRetailFormValidatorProps = {
18
18
  formState: LeadFormState;
19
19
  inputs: FieldRetailDef[];
20
- step: number;
21
20
  productType: ProductType;
22
21
  };
23
22
 
24
23
  export const getRetailFormValidator = ({
25
24
  formState,
26
25
  inputs,
27
- step,
28
26
  productType,
29
27
  }: getRetailFormValidatorProps) =>
30
- getFormValidator(calculateInputs((_) => formState[_])(inputs, step), {
28
+ getFormValidator(calculateInputs((_) => formState[_])(inputs), {
31
29
  ...validatorObj,
32
30
  limitedBirthday: getLimitedBirthdayValidation(productType),
33
31
  dulIssueDate: passportValidator(formState.limitedBirthday as Date),