@redneckz/wildless-cms-uni-blocks 0.14.234 → 0.14.235

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 (40) hide show
  1. package/bin/migration-scripts/0.14.169.js +84 -107
  2. package/bin/migration-scripts/0.14.213.js +178 -203
  3. package/bin/migration-scripts/0.14.224.js +1 -1
  4. package/bin/migration-scripts/0.14.234.js +17 -0
  5. package/bundle/blocks.schema.json +1 -1
  6. package/bundle/bundle.umd.js +2 -2
  7. package/bundle/bundle.umd.min.js +1 -1
  8. package/bundle/model/ContentPageMeta.d.ts +2 -1
  9. package/dist/components/ApplicationFormCustom/getObjectValidator.js +1 -1
  10. package/dist/components/ApplicationFormCustom/getObjectValidator.js.map +1 -1
  11. package/dist/model/ContentPageMeta.d.ts +2 -1
  12. package/lib/components/ApplicationFormCustom/getObjectValidator.js +1 -1
  13. package/lib/components/ApplicationFormCustom/getObjectValidator.js.map +1 -1
  14. package/lib/model/ContentPageMeta.d.ts +2 -1
  15. package/mobile/bundle/bundle.umd.js +2 -2
  16. package/mobile/bundle/bundle.umd.min.js +1 -1
  17. package/mobile/bundle/model/ContentPageMeta.d.ts +2 -1
  18. package/mobile/dist/components/ApplicationFormCustom/getObjectValidator.js +1 -1
  19. package/mobile/dist/components/ApplicationFormCustom/getObjectValidator.js.map +1 -1
  20. package/mobile/dist/model/ContentPageMeta.d.ts +2 -1
  21. package/mobile/lib/components/ApplicationFormCustom/getObjectValidator.js +1 -1
  22. package/mobile/lib/components/ApplicationFormCustom/getObjectValidator.js.map +1 -1
  23. package/mobile/lib/model/ContentPageMeta.d.ts +2 -1
  24. package/mobile/src/components/ApplicationFormCustom/ApplicationFormCustom.example.json +1 -1
  25. package/mobile/src/components/ApplicationFormCustom/getObjectValidator.tsx +1 -1
  26. package/mobile/src/model/ContentPageMeta.ts +3 -1
  27. package/package.json +1 -1
  28. package/src/components/ApplicationFormCustom/ApplicationFormCustom.example.json +1 -1
  29. package/src/components/ApplicationFormCustom/ApplicationFormCustom.fixture.tsx +1 -1
  30. package/src/components/ApplicationFormCustom/getObjectValidator.tsx +1 -1
  31. package/src/model/ContentPageMeta.ts +3 -1
  32. package/bin/migration-scripts/0.10.10.js +0 -44
  33. package/bin/migration-scripts/0.10.2.js +0 -31
  34. package/bin/migration-scripts/0.10.3.js +0 -19
  35. package/bin/migration-scripts/0.6.32.js +0 -32
  36. package/bin/migration-scripts/0.8.15.js +0 -32
  37. package/bin/migration-scripts/0.8.17.js +0 -35
  38. package/bin/migration-scripts/0.8.23.js +0 -31
  39. package/bin/migration-scripts/0.8.24.js +0 -30
  40. package/bin/migration-scripts/0.9.8.js +0 -29
@@ -9,118 +9,63 @@ export default traversePageBlocks(
9
9
  );
10
10
 
11
11
  function adjustApplicationFormCorruptionBlock(block) {
12
- const content = block?.content;
13
- if (
14
- !content ||
15
- block.type !== 'ApplicationFormCorruption' ||
16
- block.type !== 'ApplicationFormCorruption' ||
17
- block?.content?.formBlock?.formType !== 'ApplicationFormCorruption'
18
- ) {
19
- return;
12
+ if (isMigrateForm(block, 'ApplicationFormCorruption')) {
13
+ block.type = 'ApplicationFormCustom';
14
+ const formBlock = block.content?.formBlock;
15
+ block.content = {
16
+ title: formBlock?.title,
17
+ typeForm: 'CORRUPTION',
18
+ endpoint: 'lead',
19
+ formColumns: 1,
20
+ inputs: [
21
+ ...userInputs,
22
+ {
23
+ name: 'region',
24
+ required: true,
25
+ },
26
+ {
27
+ name: 'email',
28
+ },
29
+ comment,
30
+ consentDataProcessing,
31
+ ],
32
+ button: formBlock?.button || { text: 'Отправить заявку' },
33
+ link: formBlock?.link || {
34
+ text: 'обработкой персональных данных',
35
+ href: 'https://beta.rshb.ru/natural/privacy-policy',
36
+ },
37
+ };
20
38
  }
21
-
22
- block.type = 'ApplicationFormCustom';
23
- const formBlock = block.content?.formBlock;
24
- block.content = {
25
- title: formBlock?.title,
26
- typeForm: 'CORRUPTION',
27
- endpoint: 'lead',
28
- formColumns: 1,
29
- inputs: [
30
- {
31
- name: 'surname',
32
- required: true,
33
- },
34
- {
35
- name: 'name',
36
- required: true,
37
- },
38
- {
39
- name: 'middleName',
40
- },
41
- {
42
- name: 'phone',
43
- required: true,
44
- },
45
- {
46
- name: 'region',
47
- required: true,
48
- },
49
- {
50
- name: 'email',
51
- },
52
- {
53
- name: 'comment',
54
- required: true,
55
- },
56
- {
57
- name: 'consentDataProcessing',
58
- required: true,
59
- },
60
- ],
61
- button: formBlock?.button || { text: 'Отправить заявку' },
62
- link: formBlock?.link || {
63
- text: 'обработкой персональных данных',
64
- href: 'https://beta.rshb.ru/natural/privacy-policy',
65
- },
66
- };
67
39
  }
68
40
 
69
41
  function adjustApplicationFormAntiFraudBlock(block) {
70
- const content = block?.content;
71
- if (
72
- !content ||
73
- block.type !== 'ApplicationForm' ||
74
- block?.content?.formBlock?.formType !== 'ApplicationFormAntiFraud'
75
- ) {
76
- return;
42
+ if (isMigrateForm(block, 'ApplicationFormAntiFraud')) {
43
+ block.type = 'ApplicationFormCorruption';
44
+ const formBlock = block.content?.formBlock;
45
+ block.content = {
46
+ title: formBlock?.title,
47
+ typeForm: 'ANTIFRAUD',
48
+ endpoint: 'lead',
49
+ formColumns: 1,
50
+ inputs: [
51
+ ...userInputs,
52
+ {
53
+ name: 'birthday',
54
+ required: true,
55
+ },
56
+ {
57
+ name: 'client',
58
+ },
59
+ comment,
60
+ consentDataProcessing,
61
+ ],
62
+ button: formBlock?.button || { text: 'Отправить заявку' },
63
+ link: formBlock?.link || {
64
+ text: 'обработкой персональных данных',
65
+ href: 'https://beta.rshb.ru/natural/privacy-policy',
66
+ },
67
+ };
77
68
  }
78
-
79
- block.type = 'ApplicationFormCorruption';
80
- const formBlock = block.content?.formBlock;
81
- block.content = {
82
- title: formBlock?.title,
83
- typeForm: 'ANTIFRAUD',
84
- endpoint: 'lead',
85
- formColumns: 1,
86
- inputs: [
87
- {
88
- name: 'surname',
89
- required: true,
90
- },
91
- {
92
- name: 'name',
93
- required: true,
94
- },
95
- {
96
- name: 'middleName',
97
- },
98
- {
99
- name: 'phone',
100
- required: true,
101
- },
102
- {
103
- name: 'birthday',
104
- required: true,
105
- },
106
- {
107
- name: 'client',
108
- },
109
- {
110
- name: 'comment',
111
- required: true,
112
- },
113
- {
114
- name: 'consentDataProcessing',
115
- required: true,
116
- },
117
- ],
118
- button: formBlock?.button || { text: 'Отправить заявку' },
119
- link: formBlock?.link || {
120
- text: 'обработкой персональных данных',
121
- href: 'https://beta.rshb.ru/natural/privacy-policy',
122
- },
123
- };
124
69
  }
125
70
 
126
71
  function adjustClearBlock(block) {
@@ -138,3 +83,35 @@ function adjustClearBlock(block) {
138
83
  deleteProp(content, 'isDotted');
139
84
  }
140
85
  }
86
+
87
+ const isMigrateForm = (block, type) =>
88
+ block?.content &&
89
+ block.type === 'ApplicationForm' &&
90
+ block?.content?.formBlock?.formType === type;
91
+
92
+ const userInputs = [
93
+ {
94
+ name: 'surname',
95
+ required: true,
96
+ },
97
+ {
98
+ name: 'name',
99
+ required: true,
100
+ },
101
+ {
102
+ name: 'middleName',
103
+ },
104
+ {
105
+ name: 'phone',
106
+ required: true,
107
+ },
108
+ ];
109
+
110
+ const comment = {
111
+ name: 'comment',
112
+ required: true,
113
+ };
114
+ const consentDataProcessing = {
115
+ name: 'consentDataProcessing',
116
+ required: true,
117
+ };
@@ -11,225 +11,200 @@ export default traversePageBlocks(
11
11
  );
12
12
 
13
13
  function adjustApplicationAcquiring(block) {
14
- const content = block?.content;
15
- if (
16
- !content ||
17
- block.type !== 'ApplicationForm' ||
18
- block?.content?.formBlock?.formType !== 'ApplicationFormAcquiring'
19
- ) {
20
- return;
21
- }
22
-
23
- block.type = 'ApplicationFormCustom';
24
- const formBlock = block.content?.formBlock;
25
- block.content = {
26
- title: formBlock?.title,
27
- typeForm: 'ACQR',
28
- endpoint: 'sendcorporatelead',
29
- sections: [
30
- {
31
- title: 'Вид эквайринга и регион',
32
- columns: 2,
33
- inputs: [
34
- { name: 'acquiringType', required: true },
35
- { name: 'region', required: true },
36
- ],
37
- },
38
- {
39
- title: 'Данные организации',
40
- columns: 2,
41
- inputs: [
42
- { name: 'fullName', required: true },
43
- { name: 'inn', required: true },
44
- { name: 'name', required: true },
45
- { name: 'phone', required: true },
46
- ],
14
+ if (isMigrateForm(block, 'ApplicationFormAcquiring')) {
15
+ block.type = 'ApplicationFormCustom';
16
+ const formBlock = block.content?.formBlock;
17
+ block.content = {
18
+ title: formBlock?.title,
19
+ typeForm: 'ACQR',
20
+ endpoint: 'sendcorporatelead',
21
+ sections: [
22
+ {
23
+ title: 'Вид эквайринга и регион',
24
+ columns: 2,
25
+ inputs: [
26
+ { name: 'acquiringType', required: true },
27
+ { name: 'region', required: true },
28
+ ],
29
+ },
30
+ {
31
+ title: 'Данные организации',
32
+ columns: 2,
33
+ inputs: [
34
+ { name: 'fullName', required: true },
35
+ { name: 'inn', required: true },
36
+ { name: 'name', required: true },
37
+ { name: 'phone', required: true },
38
+ ],
39
+ },
40
+ { inputs: [{ name: 'onlineCheckout' }] },
41
+ { inputs: [{ name: 'posTerminal' }] },
42
+ ],
43
+ button: formBlock?.button || button,
44
+ link: formBlock?.link || {
45
+ text: linkTextShort,
46
+ href: linkHref,
47
47
  },
48
- { inputs: [{ name: 'onlineCheckout' }] },
49
- { inputs: [{ name: 'posTerminal' }] },
50
- ],
51
- button: formBlock?.button || { text: 'Отправить заявку' },
52
- link: formBlock?.link || {
53
- text: 'условиями передачи данных',
54
- href: '/privacy-policy',
55
- },
56
- };
48
+ };
49
+ }
57
50
  }
58
51
 
59
52
  function adjustApplicationUltraPremium(block) {
60
- const content = block?.content;
61
- if (
62
- !content ||
63
- block.type !== 'ApplicationForm' ||
64
- block?.content?.formBlock?.formType !== 'ApplicationFormUltraPremium'
65
- ) {
66
- return;
67
- }
68
-
69
- block.type = 'ApplicationFormCustom';
70
- const formBlock = block.content?.formBlock;
71
- const defaultType = formBlock?.defaultType ?? 'ULTRASERVICE';
72
- deleteProp(formBlock, 'defaultType');
73
- block.content = {
74
- title: formBlock?.title,
75
- typeForm: defaultType,
76
- endpoint: 'lead',
77
- sections: [
78
- {
79
- title: 'Ваши данные',
80
- columns: 2,
81
- inputs: [
82
- { name: 'surname', required: true },
83
- { name: 'name', required: true },
84
- { name: 'middleName' },
85
- { name: 'phone', required: true },
86
- { name: 'email', required: true },
87
- { name: 'serviceType', required: true },
88
- ],
89
- },
90
- {
91
- title: 'Офис банка',
92
- columns: 2,
93
- inputs: [
94
- { name: 'region', required: true },
95
- { name: 'addressBranch', required: true },
96
- ],
53
+ if (isMigrateForm(block, 'ApplicationFormUltraPremium')) {
54
+ block.type = 'ApplicationFormCustom';
55
+ const formBlock = block.content?.formBlock;
56
+ const defaultType = formBlock?.defaultType ?? 'ULTRASERVICE';
57
+ deleteProp(formBlock, 'defaultType');
58
+ block.content = {
59
+ title: formBlock?.title,
60
+ typeForm: defaultType,
61
+ endpoint: 'lead',
62
+ sections: [
63
+ {
64
+ title: 'Ваши данные',
65
+ columns: 2,
66
+ inputs: [
67
+ { name: 'surname', required: true },
68
+ { name: 'name', required: true },
69
+ { name: 'middleName' },
70
+ { name: 'phone', required: true },
71
+ { name: 'email', required: true },
72
+ { name: 'serviceType', required: true },
73
+ ],
74
+ },
75
+ {
76
+ title: 'Офис банка',
77
+ columns: 2,
78
+ inputs: [
79
+ { name: 'region', required: true },
80
+ { name: 'addressBranch', required: true },
81
+ ],
82
+ },
83
+ { inputs: [{ name: 'comment' }] },
84
+ { inputs: [{ name: 'consentDataProcessing', required: true }] },
85
+ ],
86
+ button: formBlock?.button || button,
87
+ link: formBlock?.link || {
88
+ text: linkText,
89
+ href: linkHref,
97
90
  },
98
- { inputs: [{ name: 'comment' }] },
99
- { inputs: [{ name: 'consentDataProcessing', required: true }] },
100
- ],
101
- button: formBlock?.button || { text: 'Отправить заявку' },
102
- link: formBlock?.link || {
103
- text: 'Согласен на обработку персональных данных',
104
- href: '/privacy-policy',
105
- },
106
- };
91
+ };
92
+ }
107
93
  }
108
94
 
109
95
  function adjustApplicationDeposit(block) {
110
- const content = block?.content;
111
- if (
112
- !content ||
113
- block.type !== 'ApplicationForm' ||
114
- block?.content?.formBlock?.formType !== 'ApplicationFormDeposit'
115
- ) {
116
- return;
117
- }
118
-
119
- block.type = 'ApplicationFormCustom';
120
- const formBlock = block.content?.formBlock;
121
- block.content = {
122
- title: formBlock?.title,
123
- typeForm: 'DPST',
124
- endpoint: 'lead',
125
- sections: [
126
- {
127
- title: 'Оставьте заявку и мы ответим на любые вопросы по депозитам',
128
- inputs: [
129
- { name: 'name', required: true },
130
- { name: 'phone', required: true },
131
- { name: 'consentDataProcessing', required: true },
132
- ],
96
+ if (isMigrateForm(block, 'ApplicationFormDeposit')) {
97
+ block.type = 'ApplicationFormCustom';
98
+ const formBlock = block.content?.formBlock;
99
+ block.content = {
100
+ title: formBlock?.title,
101
+ typeForm: 'DPST',
102
+ endpoint: 'lead',
103
+ sections: [
104
+ {
105
+ title: 'Оставьте заявку и мы ответим на любые вопросы по депозитам',
106
+ inputs: [
107
+ { name: 'name', required: true },
108
+ { name: 'phone', required: true },
109
+ { name: 'consentDataProcessing', required: true },
110
+ ],
111
+ },
112
+ ],
113
+ button: formBlock?.button || button,
114
+ link: formBlock?.link || {
115
+ text: linkText,
116
+ href: linkHref,
133
117
  },
134
- ],
135
- button: formBlock?.button || { text: 'Отправить заявку' },
136
- link: formBlock?.link || {
137
- text: 'Согласен на обработку персональных данных',
138
- href: '/privacy-policy',
139
- },
140
- };
118
+ };
119
+ }
141
120
  }
142
121
 
143
122
  function adjustApplicationFormIndividuals(block) {
144
- const content = block?.content;
145
- if (
146
- !content ||
147
- block.type !== 'ApplicationForm' ||
148
- block?.content?.formBlock?.formType !== 'ApplicationFormIndividuals'
149
- ) {
150
- return;
151
- }
152
-
153
- block.type = 'ApplicationFormCustom';
154
- const formBlock = block.content?.formBlock;
155
- const product = block.content?.product;
156
- block.content = {
157
- title: formBlock?.title,
158
- typeForm: 'PRODUCT',
159
- endpoint: 'lead',
160
- sections: [
161
- {
162
- title: 'Заполните форму',
163
- columns: 2,
164
- inputs: [
165
- { name: 'surname', required: true },
166
- { name: 'name', required: true },
167
- { name: 'middleName' },
168
- { name: 'birthday', required: true },
169
- { name: 'phone', required: true },
170
- { name: 'email', required: true },
171
- { name: 'consentDataProcessing', required: true },
172
- ],
123
+ if (isMigrateForm(block, 'ApplicationFormIndividuals')) {
124
+ block.type = 'ApplicationFormCustom';
125
+ const formBlock = block.content?.formBlock;
126
+ const product = block.content?.product;
127
+ block.content = {
128
+ title: formBlock?.title,
129
+ typeForm: 'PRODUCT',
130
+ endpoint: 'lead',
131
+ sections: [
132
+ {
133
+ title: 'Заполните форму',
134
+ columns: 2,
135
+ inputs: [
136
+ { name: 'surname', required: true },
137
+ { name: 'name', required: true },
138
+ { name: 'middleName' },
139
+ { name: 'birthday', required: true },
140
+ { name: 'phone', required: true },
141
+ { name: 'email', required: true },
142
+ { name: 'consentDataProcessing', required: true },
143
+ ],
144
+ },
145
+ ],
146
+ button: formBlock?.button || button,
147
+ link: formBlock?.link || {
148
+ text: linkText,
149
+ href: linkHref,
173
150
  },
174
- ],
175
- button: formBlock?.button || { text: 'Отправить заявку' },
176
- link: formBlock?.link || {
177
- text: 'Согласен на обработку персональных данных',
178
- href: '/privacy-policy',
179
- },
180
- };
181
- if (product) {
182
- block.content.additionalParams = { product: product };
151
+ };
152
+ if (product) {
153
+ block.content.additionalParams = { product: product };
154
+ }
183
155
  }
184
156
  }
185
157
 
186
158
  function adjustApplicationFormCredit(block) {
187
- const content = block?.content;
188
- if (
189
- !content ||
190
- block.type !== 'ApplicationForm' ||
191
- block?.content?.formBlock?.formType !== 'ApplicationFormCredit'
192
- ) {
193
- return;
194
- }
195
-
196
- block.type = 'ApplicationFormCustom';
197
- const formBlock = block.content?.formBlock;
198
- block.content = {
199
- title: formBlock?.title ?? 'Оформите заявку на кредит прямо сейчас',
200
- typeForm: 'CRED',
201
- endpoint: 'sendcorporatelead',
202
- sections: [
203
- {
204
- title: 'Параметры кредита',
205
- columns: 2,
206
- inputs: [{ name: 'amount' }, { name: 'term' }],
159
+ if (isMigrateForm(block, 'ApplicationFormCredit')) {
160
+ block.type = 'ApplicationFormCustom';
161
+ const formBlock = block.content?.formBlock;
162
+ block.content = {
163
+ title: formBlock?.title ?? 'Оформите заявку на кредит прямо сейчас',
164
+ typeForm: 'CRED',
165
+ endpoint: 'sendcorporatelead',
166
+ sections: [
167
+ {
168
+ title: 'Параметры кредита',
169
+ columns: 2,
170
+ inputs: [{ name: 'amount' }, { name: 'term' }],
171
+ },
172
+ {
173
+ title: 'Данные организации',
174
+ columns: 2,
175
+ inputs: [
176
+ { name: 'fullName', required: true, label: 'Наименование организации' },
177
+ { name: 'annualRevenue', required: true },
178
+ { name: 'inn', required: true },
179
+ { name: 'name', required: true, label: 'Контактное лицо' },
180
+ { name: 'phone', required: true },
181
+ { name: 'email', required: true },
182
+ ],
183
+ },
184
+ {
185
+ title: 'Офис банка',
186
+ columns: 2,
187
+ inputs: [
188
+ { name: 'region', required: true },
189
+ { name: 'addressBranch', required: true },
190
+ ],
191
+ },
192
+ ],
193
+ button: formBlock?.button || button,
194
+ link: formBlock?.link || {
195
+ text: linkTextShort,
196
+ href: linkHref,
207
197
  },
208
- {
209
- title: 'Данные организации',
210
- columns: 2,
211
- inputs: [
212
- { name: 'fullName', required: true, label: 'Наименование организации' },
213
- { name: 'annualRevenue', required: true },
214
- { name: 'inn', required: true },
215
- { name: 'name', required: true, label: 'Контактное лицо' },
216
- { name: 'phone', required: true },
217
- { name: 'email', required: true },
218
- ],
219
- },
220
- {
221
- title: 'Офис банка',
222
- columns: 2,
223
- inputs: [
224
- { name: 'region', required: true },
225
- { name: 'addressBranch', required: true },
226
- ],
227
- },
228
- ],
229
- button: formBlock?.button || { text: 'Отправить заявку' },
230
- link: formBlock?.link || {
231
- text: 'условиями передачи данных',
232
- href: '/privacy-policy',
233
- },
234
- };
198
+ };
199
+ }
235
200
  }
201
+
202
+ const linkText = 'Согласен на обработку персональных данных';
203
+ const linkTextShort = 'условиями передачи данных';
204
+ const linkHref = '/privacy-policy';
205
+ const button = { text: 'Отправить заявку' };
206
+
207
+ const isMigrateForm = (block, type) =>
208
+ block?.content &&
209
+ block.type === 'ApplicationForm' &&
210
+ block?.content?.formBlock?.formType === type;
@@ -1,4 +1,4 @@
1
- import { deleteProp, traversePageBlocks } from '../utils.js';
1
+ import { traversePageBlocks } from '../utils.js';
2
2
 
3
3
  export const description = 'v0.14.224';
4
4
 
@@ -0,0 +1,17 @@
1
+ import { traversePageBlocks } from '../utils.js';
2
+
3
+ export const description = 'v0.14.234';
4
+
5
+ export default traversePageBlocks(adjustApplicationSelfCollection);
6
+
7
+ function adjustApplicationSelfCollection(block) {
8
+ const content = block?.content;
9
+ if (
10
+ content &&
11
+ block.type === 'ApplicationFormCustom' &&
12
+ content?.typeForm === 'SELFCOLLECTION' &&
13
+ content?.sections?.[0]?.inputs?.[0]?.name === 'fullName'
14
+ ) {
15
+ content.sections[0].inputs[0].name = 'name';
16
+ }
17
+ }