@gravity-ui/page-constructor 1.12.0 → 1.13.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/blocks/Banner/schema.d.ts +141 -0
- package/build/cjs/blocks/CardLayout/schema.d.ts +22 -24
- package/build/cjs/blocks/CardLayout/schema.js +1 -6
- package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +16 -17
- package/build/cjs/blocks/ExtendedFeatures/schema.js +1 -6
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +0 -25
- package/build/cjs/blocks/LinkTable/schema.d.ts +29 -21
- package/build/cjs/blocks/LinkTable/schema.js +1 -1
- package/build/cjs/blocks/Media/schema.d.ts +47 -0
- package/build/cjs/blocks/Media/schema.js +1 -1
- package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +14 -15
- package/build/cjs/blocks/PromoFeaturesBlock/schema.js +1 -6
- package/build/cjs/blocks/Slider/schema.d.ts +28 -49
- package/build/cjs/blocks/Slider/schema.js +1 -6
- package/build/cjs/blocks/Tabs/schema.d.ts +29 -25
- package/build/cjs/blocks/Tabs/schema.js +1 -4
- package/build/cjs/components/BlockHeader/BlockHeader.css +8 -19
- package/build/cjs/components/BlockHeader/BlockHeader.js +4 -3
- package/build/cjs/components/Button/Button.js +3 -3
- package/build/cjs/components/CardBase/CardBase.d.ts +2 -1
- package/build/cjs/components/CardBase/CardBase.js +2 -2
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +2 -2
- package/build/cjs/components/Link/Link.js +2 -2
- package/build/cjs/context/metrikaContext/metrikaContext.d.ts +2 -1
- package/build/cjs/hooks/useMetrika.d.ts +3 -2
- package/build/cjs/hooks/useMetrika.js +10 -2
- package/build/cjs/models/common.d.ts +4 -1
- package/build/cjs/models/constructor-items/common.d.ts +21 -0
- package/build/cjs/schema/validators/common.d.ts +125 -0
- package/build/cjs/schema/validators/common.js +12 -1
- package/build/cjs/schema/validators/ga-events.d.ts +47 -0
- package/build/cjs/schema/validators/ga-events.js +50 -0
- package/build/cjs/sub-blocks/CardWithImage/schema.js +1 -1
- package/build/cjs/text-transform/blocks.js +44 -54
- package/build/esm/blocks/Banner/schema.d.ts +141 -0
- package/build/esm/blocks/CardLayout/schema.d.ts +22 -24
- package/build/esm/blocks/CardLayout/schema.js +2 -7
- package/build/esm/blocks/ExtendedFeatures/schema.d.ts +16 -17
- package/build/esm/blocks/ExtendedFeatures/schema.js +2 -7
- package/build/esm/blocks/HeaderSlider/schema.d.ts +0 -25
- package/build/esm/blocks/LinkTable/schema.d.ts +29 -21
- package/build/esm/blocks/LinkTable/schema.js +2 -2
- package/build/esm/blocks/Media/schema.d.ts +47 -0
- package/build/esm/blocks/Media/schema.js +1 -1
- package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +14 -15
- package/build/esm/blocks/PromoFeaturesBlock/schema.js +2 -7
- package/build/esm/blocks/Slider/schema.d.ts +28 -49
- package/build/esm/blocks/Slider/schema.js +2 -7
- package/build/esm/blocks/Tabs/schema.d.ts +29 -25
- package/build/esm/blocks/Tabs/schema.js +2 -5
- package/build/esm/components/BlockHeader/BlockHeader.css +8 -19
- package/build/esm/components/BlockHeader/BlockHeader.js +5 -4
- package/build/esm/components/Button/Button.js +3 -3
- package/build/esm/components/CardBase/CardBase.d.ts +2 -1
- package/build/esm/components/CardBase/CardBase.js +2 -2
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +2 -2
- package/build/esm/components/Link/Link.js +2 -2
- package/build/esm/context/metrikaContext/metrikaContext.d.ts +2 -1
- package/build/esm/hooks/useMetrika.d.ts +3 -2
- package/build/esm/hooks/useMetrika.js +10 -2
- package/build/esm/models/common.d.ts +4 -1
- package/build/esm/models/constructor-items/common.d.ts +21 -0
- package/build/esm/schema/validators/common.d.ts +125 -0
- package/build/esm/schema/validators/common.js +11 -0
- package/build/esm/schema/validators/ga-events.d.ts +47 -0
- package/build/esm/schema/validators/ga-events.js +47 -0
- package/build/esm/sub-blocks/CardWithImage/schema.js +1 -1
- package/build/esm/text-transform/blocks.js +44 -54
- package/package.json +1 -1
- package/server/models/common.d.ts +4 -1
- package/server/models/constructor-items/common.d.ts +21 -0
- package/server/text-transform/blocks.js +44 -54
|
@@ -499,6 +499,53 @@ export declare const ButtonProps: {
|
|
|
499
499
|
};
|
|
500
500
|
};
|
|
501
501
|
};
|
|
502
|
+
gaEvents: {
|
|
503
|
+
type: string;
|
|
504
|
+
items: {
|
|
505
|
+
type: string;
|
|
506
|
+
required: string[];
|
|
507
|
+
additionalProperties: boolean;
|
|
508
|
+
properties: {
|
|
509
|
+
eventName: {
|
|
510
|
+
type: string;
|
|
511
|
+
};
|
|
512
|
+
eventCategory: {
|
|
513
|
+
type: string;
|
|
514
|
+
};
|
|
515
|
+
eventLabel: {
|
|
516
|
+
type: string;
|
|
517
|
+
};
|
|
518
|
+
value: {
|
|
519
|
+
type: string;
|
|
520
|
+
};
|
|
521
|
+
groups: {
|
|
522
|
+
oneOf: ({
|
|
523
|
+
type: string;
|
|
524
|
+
items?: undefined;
|
|
525
|
+
} | {
|
|
526
|
+
type: string;
|
|
527
|
+
items: {
|
|
528
|
+
type: string;
|
|
529
|
+
};
|
|
530
|
+
})[];
|
|
531
|
+
};
|
|
532
|
+
sendTo: {
|
|
533
|
+
oneOf: ({
|
|
534
|
+
type: string;
|
|
535
|
+
items?: undefined;
|
|
536
|
+
} | {
|
|
537
|
+
type: string;
|
|
538
|
+
items: {
|
|
539
|
+
type: string;
|
|
540
|
+
};
|
|
541
|
+
})[];
|
|
542
|
+
};
|
|
543
|
+
eventTimeout: {
|
|
544
|
+
type: string;
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
};
|
|
548
|
+
};
|
|
502
549
|
target: {
|
|
503
550
|
type: string;
|
|
504
551
|
enum: string[];
|
|
@@ -714,6 +761,53 @@ export declare const ButtonBlock: {
|
|
|
714
761
|
};
|
|
715
762
|
};
|
|
716
763
|
};
|
|
764
|
+
gaEvents: {
|
|
765
|
+
type: string;
|
|
766
|
+
items: {
|
|
767
|
+
type: string;
|
|
768
|
+
required: string[];
|
|
769
|
+
additionalProperties: boolean;
|
|
770
|
+
properties: {
|
|
771
|
+
eventName: {
|
|
772
|
+
type: string;
|
|
773
|
+
};
|
|
774
|
+
eventCategory: {
|
|
775
|
+
type: string;
|
|
776
|
+
};
|
|
777
|
+
eventLabel: {
|
|
778
|
+
type: string;
|
|
779
|
+
};
|
|
780
|
+
value: {
|
|
781
|
+
type: string;
|
|
782
|
+
};
|
|
783
|
+
groups: {
|
|
784
|
+
oneOf: ({
|
|
785
|
+
type: string;
|
|
786
|
+
items?: undefined;
|
|
787
|
+
} | {
|
|
788
|
+
type: string;
|
|
789
|
+
items: {
|
|
790
|
+
type: string;
|
|
791
|
+
};
|
|
792
|
+
})[];
|
|
793
|
+
};
|
|
794
|
+
sendTo: {
|
|
795
|
+
oneOf: ({
|
|
796
|
+
type: string;
|
|
797
|
+
items?: undefined;
|
|
798
|
+
} | {
|
|
799
|
+
type: string;
|
|
800
|
+
items: {
|
|
801
|
+
type: string;
|
|
802
|
+
};
|
|
803
|
+
})[];
|
|
804
|
+
};
|
|
805
|
+
eventTimeout: {
|
|
806
|
+
type: string;
|
|
807
|
+
};
|
|
808
|
+
};
|
|
809
|
+
};
|
|
810
|
+
};
|
|
717
811
|
target: {
|
|
718
812
|
type: string;
|
|
719
813
|
enum: string[];
|
|
@@ -869,3 +963,34 @@ export declare const CardBase: {
|
|
|
869
963
|
enum: string[];
|
|
870
964
|
};
|
|
871
965
|
};
|
|
966
|
+
export declare const BlockHeaderProps: {
|
|
967
|
+
title: {
|
|
968
|
+
oneOf: ({
|
|
969
|
+
type: string;
|
|
970
|
+
additionalProperties: boolean;
|
|
971
|
+
required: string[];
|
|
972
|
+
properties: {
|
|
973
|
+
text: {
|
|
974
|
+
type: string;
|
|
975
|
+
contentType: string;
|
|
976
|
+
};
|
|
977
|
+
textSize: {
|
|
978
|
+
type: string;
|
|
979
|
+
enum: string[];
|
|
980
|
+
};
|
|
981
|
+
url: {
|
|
982
|
+
type: string;
|
|
983
|
+
};
|
|
984
|
+
resetMargin: {
|
|
985
|
+
type: string;
|
|
986
|
+
};
|
|
987
|
+
};
|
|
988
|
+
} | {
|
|
989
|
+
type: string;
|
|
990
|
+
})[];
|
|
991
|
+
};
|
|
992
|
+
description: {
|
|
993
|
+
type: string;
|
|
994
|
+
contentType: string;
|
|
995
|
+
};
|
|
996
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { gaEvents } from './ga-events';
|
|
1
2
|
import { pixelEvents } from './pixel';
|
|
2
3
|
import { Theme } from '../../models';
|
|
3
4
|
import { ImageProps, urlPattern } from '../../components/Image/schema';
|
|
@@ -329,6 +330,7 @@ export const ButtonProps = {
|
|
|
329
330
|
],
|
|
330
331
|
},
|
|
331
332
|
pixelEvents,
|
|
333
|
+
gaEvents,
|
|
332
334
|
target: {
|
|
333
335
|
type: 'string',
|
|
334
336
|
enum: ['_self', '_blank', '_parent', '_top'],
|
|
@@ -444,3 +446,12 @@ export const CardBase = {
|
|
|
444
446
|
enum: ['border', 'shadow', 'none'],
|
|
445
447
|
},
|
|
446
448
|
};
|
|
449
|
+
export const BlockHeaderProps = {
|
|
450
|
+
title: {
|
|
451
|
+
oneOf: [{ type: 'string' }, TitleProps],
|
|
452
|
+
},
|
|
453
|
+
description: {
|
|
454
|
+
type: 'string',
|
|
455
|
+
contentType: 'yfm',
|
|
456
|
+
},
|
|
457
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const gaEvents: {
|
|
2
|
+
type: string;
|
|
3
|
+
items: {
|
|
4
|
+
type: string;
|
|
5
|
+
required: string[];
|
|
6
|
+
additionalProperties: boolean;
|
|
7
|
+
properties: {
|
|
8
|
+
eventName: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
eventCategory: {
|
|
12
|
+
type: string;
|
|
13
|
+
};
|
|
14
|
+
eventLabel: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
value: {
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
groups: {
|
|
21
|
+
oneOf: ({
|
|
22
|
+
type: string;
|
|
23
|
+
items?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
type: string;
|
|
26
|
+
items: {
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
})[];
|
|
30
|
+
};
|
|
31
|
+
sendTo: {
|
|
32
|
+
oneOf: ({
|
|
33
|
+
type: string;
|
|
34
|
+
items?: undefined;
|
|
35
|
+
} | {
|
|
36
|
+
type: string;
|
|
37
|
+
items: {
|
|
38
|
+
type: string;
|
|
39
|
+
};
|
|
40
|
+
})[];
|
|
41
|
+
};
|
|
42
|
+
eventTimeout: {
|
|
43
|
+
type: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export const gaEvents = {
|
|
2
|
+
type: 'array',
|
|
3
|
+
items: {
|
|
4
|
+
type: 'object',
|
|
5
|
+
required: ['eventName'],
|
|
6
|
+
additionalProperties: false,
|
|
7
|
+
properties: {
|
|
8
|
+
eventName: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
},
|
|
11
|
+
eventCategory: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
},
|
|
14
|
+
eventLabel: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
},
|
|
17
|
+
value: {
|
|
18
|
+
type: 'number',
|
|
19
|
+
},
|
|
20
|
+
groups: {
|
|
21
|
+
oneOf: [
|
|
22
|
+
{ type: 'string' },
|
|
23
|
+
{
|
|
24
|
+
type: 'array',
|
|
25
|
+
items: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
sendTo: {
|
|
32
|
+
oneOf: [
|
|
33
|
+
{ type: 'string' },
|
|
34
|
+
{
|
|
35
|
+
type: 'array',
|
|
36
|
+
items: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
eventTimeout: {
|
|
43
|
+
type: 'number',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { omit } from 'lodash';
|
|
2
2
|
import { BaseProps, textSize } from '../../schema/validators/common';
|
|
3
3
|
import { filteredArray } from '../../schema/validators/utils';
|
|
4
|
-
import { ContentBase } from '
|
|
4
|
+
import { ContentBase } from '../../sub-blocks/Content/schema';
|
|
5
5
|
const CardWithImageContentProps = omit(ContentBase, ['links', 'size', 'text', 'theme']);
|
|
6
6
|
const CardWithImageLinks = {
|
|
7
7
|
type: 'object',
|
|
@@ -35,13 +35,6 @@ function parsePromoFeatures(transformer, items) {
|
|
|
35
35
|
return (Object.assign({ text: transformer(text) }, rest));
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
function parseSlider(transformer, block) {
|
|
39
|
-
const { title, description } = block;
|
|
40
|
-
block.title = Object.assign(Object.assign({}, title), { text: transformer(title ? title.text : '') });
|
|
41
|
-
if (description) {
|
|
42
|
-
block.description = transformer(description);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
38
|
const parseTitle = (transformer, title) => typeof title === 'object' && 'text' in title
|
|
46
39
|
? Object.assign(Object.assign({}, title), { text: transformer(title.text) }) : title && transformer(title);
|
|
47
40
|
const parseItemsTitle = (transformer, items) => items.map((_a) => {
|
|
@@ -95,6 +88,17 @@ export function yfmTransformer(lang, content) {
|
|
|
95
88
|
export function typografTransformer(lang, content) {
|
|
96
89
|
return typografToHTML(content, lang);
|
|
97
90
|
}
|
|
91
|
+
const blockHeaderTransfomer = [
|
|
92
|
+
{
|
|
93
|
+
fields: ['title'],
|
|
94
|
+
transformer: typografTransformer,
|
|
95
|
+
parser: parseTitle,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
fields: ['description'],
|
|
99
|
+
transformer: yfmTransformer,
|
|
100
|
+
},
|
|
101
|
+
];
|
|
98
102
|
const config = {
|
|
99
103
|
[SubBlockType.Partner]: {
|
|
100
104
|
fields: ['text'],
|
|
@@ -139,35 +143,35 @@ const config = {
|
|
|
139
143
|
transformer: typografTransformer,
|
|
140
144
|
},
|
|
141
145
|
[BlockType.ExtendedFeaturesBlock]: [
|
|
146
|
+
...blockHeaderTransfomer,
|
|
142
147
|
{
|
|
143
|
-
fields: ['
|
|
148
|
+
fields: ['items'],
|
|
144
149
|
transformer: typografTransformer,
|
|
145
|
-
parser:
|
|
150
|
+
parser: createItemsParser(['title']),
|
|
146
151
|
},
|
|
147
152
|
{
|
|
148
|
-
fields: ['
|
|
153
|
+
fields: ['items'],
|
|
149
154
|
transformer: yfmTransformer,
|
|
155
|
+
parser: createItemsParser(['text', 'additionalInfo']),
|
|
150
156
|
},
|
|
157
|
+
],
|
|
158
|
+
[BlockType.PromoFeaturesBlock]: [
|
|
151
159
|
{
|
|
152
|
-
fields: ['
|
|
160
|
+
fields: ['title'],
|
|
153
161
|
transformer: typografTransformer,
|
|
154
|
-
parser:
|
|
162
|
+
parser: parseTitle,
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
fields: ['description'],
|
|
166
|
+
transformer: yfmTransformer,
|
|
155
167
|
},
|
|
156
168
|
{
|
|
157
169
|
fields: ['items'],
|
|
158
170
|
transformer: yfmTransformer,
|
|
159
|
-
parser:
|
|
171
|
+
parser: parsePromoFeatures,
|
|
160
172
|
},
|
|
161
173
|
],
|
|
162
|
-
[BlockType.
|
|
163
|
-
fields: ['items'],
|
|
164
|
-
transformer: yfmTransformer,
|
|
165
|
-
parser: parsePromoFeatures,
|
|
166
|
-
},
|
|
167
|
-
[BlockType.SliderBlock]: {
|
|
168
|
-
transformer: typografTransformer,
|
|
169
|
-
parser: parseSlider,
|
|
170
|
-
},
|
|
174
|
+
[BlockType.SliderBlock]: blockHeaderTransfomer,
|
|
171
175
|
[BlockType.QuestionsBlock]: [
|
|
172
176
|
{
|
|
173
177
|
fields: ['title'],
|
|
@@ -204,21 +208,14 @@ const config = {
|
|
|
204
208
|
},
|
|
205
209
|
],
|
|
206
210
|
[BlockType.MediaBlock]: [
|
|
211
|
+
...blockHeaderTransfomer,
|
|
207
212
|
{
|
|
208
|
-
fields: ['title'],
|
|
209
|
-
transformer: typografTransformer,
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
fields: ['description', 'title', 'additionalInfo'],
|
|
213
|
+
fields: ['title', 'additionalInfo'],
|
|
213
214
|
transformer: yfmTransformer,
|
|
214
215
|
},
|
|
215
216
|
],
|
|
216
217
|
[BlockType.TabsBlock]: [
|
|
217
|
-
|
|
218
|
-
fields: ['title'],
|
|
219
|
-
transformer: typografTransformer,
|
|
220
|
-
parser: parseTitle,
|
|
221
|
-
},
|
|
218
|
+
...blockHeaderTransfomer,
|
|
222
219
|
{
|
|
223
220
|
fields: ['items'],
|
|
224
221
|
transformer: yfmTransformer,
|
|
@@ -250,6 +247,11 @@ const config = {
|
|
|
250
247
|
},
|
|
251
248
|
],
|
|
252
249
|
[BlockType.SimpleBlock]: [
|
|
250
|
+
{
|
|
251
|
+
fields: ['title'],
|
|
252
|
+
transformer: typografTransformer,
|
|
253
|
+
parser: parseTitle,
|
|
254
|
+
},
|
|
253
255
|
{
|
|
254
256
|
fields: ['description'],
|
|
255
257
|
transformer: yfmTransformer,
|
|
@@ -301,28 +303,7 @@ const config = {
|
|
|
301
303
|
parser: parseTitle,
|
|
302
304
|
},
|
|
303
305
|
],
|
|
304
|
-
[BlockType.
|
|
305
|
-
{
|
|
306
|
-
fields: ['description'],
|
|
307
|
-
transformer: yfmTransformer,
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
fields: ['title'],
|
|
311
|
-
transformer: typografTransformer,
|
|
312
|
-
parser: parseTitle,
|
|
313
|
-
},
|
|
314
|
-
],
|
|
315
|
-
[BlockType.PromoFeaturesBlock]: [
|
|
316
|
-
{
|
|
317
|
-
fields: ['description'],
|
|
318
|
-
transformer: typografTransformer,
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
fields: ['title'],
|
|
322
|
-
transformer: typografTransformer,
|
|
323
|
-
parser: parseTitle,
|
|
324
|
-
},
|
|
325
|
-
],
|
|
306
|
+
[BlockType.PromoFeaturesBlock]: blockHeaderTransfomer,
|
|
326
307
|
[BlockType.InfoBlock]: [
|
|
327
308
|
{
|
|
328
309
|
fields: ['rightContent', 'leftContent'],
|
|
@@ -341,6 +322,15 @@ const config = {
|
|
|
341
322
|
transformer: typografTransformer,
|
|
342
323
|
},
|
|
343
324
|
],
|
|
325
|
+
[BlockType.CardLayoutBlock]: blockHeaderTransfomer,
|
|
326
|
+
[BlockType.IconsBlock]: [
|
|
327
|
+
{
|
|
328
|
+
fields: ['title'],
|
|
329
|
+
transformer: typografTransformer,
|
|
330
|
+
parser: parseTitle,
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
[BlockType.LinkTableBlock]: blockHeaderTransfomer,
|
|
344
334
|
};
|
|
345
335
|
function addRandomOrder(block) {
|
|
346
336
|
if (block) {
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { MetrikaGoal } from './';
|
|
2
|
+
import { GAEventParams, MetrikaGoal } from './';
|
|
3
3
|
export interface Refable<T> {
|
|
4
4
|
ref?: React.Ref<T>;
|
|
5
5
|
}
|
|
@@ -45,6 +45,9 @@ export interface Metrika {
|
|
|
45
45
|
reachGoal: (counterName: string, ...args: any) => void;
|
|
46
46
|
reachGoals: (goals: MetrikaGoal, counterName?: string) => void;
|
|
47
47
|
}
|
|
48
|
+
export interface GaInline {
|
|
49
|
+
event: (eventName: string, params?: GAEventParams) => void;
|
|
50
|
+
}
|
|
48
51
|
export interface ClassNameProps {
|
|
49
52
|
className?: string;
|
|
50
53
|
}
|
|
@@ -121,6 +121,7 @@ export interface LinkProps extends Stylable {
|
|
|
121
121
|
target?: string;
|
|
122
122
|
metrikaGoals?: MetrikaGoal;
|
|
123
123
|
pixelEvents?: ButtonPixel;
|
|
124
|
+
gaEvents?: GAEvents;
|
|
124
125
|
}
|
|
125
126
|
export interface FileLinkProps extends ClassNameProps {
|
|
126
127
|
href: string;
|
|
@@ -139,6 +140,7 @@ export interface ButtonProps {
|
|
|
139
140
|
img?: ButtonImageProps | string;
|
|
140
141
|
metrikaGoals?: MetrikaGoal;
|
|
141
142
|
pixelEvents?: ButtonPixel;
|
|
143
|
+
gaEvents?: GAEvents;
|
|
142
144
|
target?: string;
|
|
143
145
|
}
|
|
144
146
|
export interface ButtonImageProps {
|
|
@@ -222,6 +224,7 @@ export interface HeaderBreadCrumbsProps extends ClassNameProps {
|
|
|
222
224
|
theme?: TextTheme;
|
|
223
225
|
metrikaGoals?: MetrikaGoal;
|
|
224
226
|
pixelEvents?: ButtonPixel;
|
|
227
|
+
gaEvents?: GAEvents;
|
|
225
228
|
}
|
|
226
229
|
export interface PreviewContentItemProps {
|
|
227
230
|
title: string;
|
|
@@ -337,4 +340,22 @@ export interface BlockHeaderProps {
|
|
|
337
340
|
title?: TitleProps | string;
|
|
338
341
|
description?: string;
|
|
339
342
|
}
|
|
343
|
+
export declare type GaParameterValue = string | number | boolean;
|
|
344
|
+
declare type GACommandConfig<T> = T & {
|
|
345
|
+
[key: string]: GaParameterValue;
|
|
346
|
+
};
|
|
347
|
+
declare type GACommonParams = {
|
|
348
|
+
groups?: string | string[];
|
|
349
|
+
sendTo?: string | string[];
|
|
350
|
+
eventTimeout?: number;
|
|
351
|
+
};
|
|
352
|
+
export declare type GAEventParams = GACommandConfig<GACommonParams & {
|
|
353
|
+
eventCategory?: string;
|
|
354
|
+
eventLabel?: string;
|
|
355
|
+
value?: number;
|
|
356
|
+
}>;
|
|
357
|
+
export type GAEvent = GAEventParams & {
|
|
358
|
+
eventName: string;
|
|
359
|
+
};
|
|
360
|
+
export type GAEvents = GAEvent | GAEvent[];
|
|
340
361
|
export {};
|
|
@@ -52,13 +52,6 @@ function parsePromoFeatures(transformer, items) {
|
|
|
52
52
|
return (Object.assign({ text: transformer(text) }, rest));
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
function parseSlider(transformer, block) {
|
|
56
|
-
const { title, description } = block;
|
|
57
|
-
block.title = Object.assign(Object.assign({}, title), { text: transformer(title ? title.text : '') });
|
|
58
|
-
if (description) {
|
|
59
|
-
block.description = transformer(description);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
55
|
const parseTitle = (transformer, title) => typeof title === 'object' && 'text' in title
|
|
63
56
|
? Object.assign(Object.assign({}, title), { text: transformer(title.text) }) : title && transformer(title);
|
|
64
57
|
const parseItemsTitle = (transformer, items) => items.map((_a) => {
|
|
@@ -114,6 +107,17 @@ function typografTransformer(lang, content) {
|
|
|
114
107
|
return (0, utils_1.typografToHTML)(content, lang);
|
|
115
108
|
}
|
|
116
109
|
exports.typografTransformer = typografTransformer;
|
|
110
|
+
const blockHeaderTransfomer = [
|
|
111
|
+
{
|
|
112
|
+
fields: ['title'],
|
|
113
|
+
transformer: typografTransformer,
|
|
114
|
+
parser: parseTitle,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
fields: ['description'],
|
|
118
|
+
transformer: yfmTransformer,
|
|
119
|
+
},
|
|
120
|
+
];
|
|
117
121
|
const config = {
|
|
118
122
|
[models_1.SubBlockType.Partner]: {
|
|
119
123
|
fields: ['text'],
|
|
@@ -158,35 +162,35 @@ const config = {
|
|
|
158
162
|
transformer: typografTransformer,
|
|
159
163
|
},
|
|
160
164
|
[models_1.BlockType.ExtendedFeaturesBlock]: [
|
|
165
|
+
...blockHeaderTransfomer,
|
|
161
166
|
{
|
|
162
|
-
fields: ['
|
|
167
|
+
fields: ['items'],
|
|
163
168
|
transformer: typografTransformer,
|
|
164
|
-
parser:
|
|
169
|
+
parser: (0, exports.createItemsParser)(['title']),
|
|
165
170
|
},
|
|
166
171
|
{
|
|
167
|
-
fields: ['
|
|
172
|
+
fields: ['items'],
|
|
168
173
|
transformer: yfmTransformer,
|
|
174
|
+
parser: (0, exports.createItemsParser)(['text', 'additionalInfo']),
|
|
169
175
|
},
|
|
176
|
+
],
|
|
177
|
+
[models_1.BlockType.PromoFeaturesBlock]: [
|
|
170
178
|
{
|
|
171
|
-
fields: ['
|
|
179
|
+
fields: ['title'],
|
|
172
180
|
transformer: typografTransformer,
|
|
173
|
-
parser:
|
|
181
|
+
parser: parseTitle,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
fields: ['description'],
|
|
185
|
+
transformer: yfmTransformer,
|
|
174
186
|
},
|
|
175
187
|
{
|
|
176
188
|
fields: ['items'],
|
|
177
189
|
transformer: yfmTransformer,
|
|
178
|
-
parser:
|
|
190
|
+
parser: parsePromoFeatures,
|
|
179
191
|
},
|
|
180
192
|
],
|
|
181
|
-
[models_1.BlockType.
|
|
182
|
-
fields: ['items'],
|
|
183
|
-
transformer: yfmTransformer,
|
|
184
|
-
parser: parsePromoFeatures,
|
|
185
|
-
},
|
|
186
|
-
[models_1.BlockType.SliderBlock]: {
|
|
187
|
-
transformer: typografTransformer,
|
|
188
|
-
parser: parseSlider,
|
|
189
|
-
},
|
|
193
|
+
[models_1.BlockType.SliderBlock]: blockHeaderTransfomer,
|
|
190
194
|
[models_1.BlockType.QuestionsBlock]: [
|
|
191
195
|
{
|
|
192
196
|
fields: ['title'],
|
|
@@ -223,21 +227,14 @@ const config = {
|
|
|
223
227
|
},
|
|
224
228
|
],
|
|
225
229
|
[models_1.BlockType.MediaBlock]: [
|
|
230
|
+
...blockHeaderTransfomer,
|
|
226
231
|
{
|
|
227
|
-
fields: ['title'],
|
|
228
|
-
transformer: typografTransformer,
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
fields: ['description', 'title', 'additionalInfo'],
|
|
232
|
+
fields: ['title', 'additionalInfo'],
|
|
232
233
|
transformer: yfmTransformer,
|
|
233
234
|
},
|
|
234
235
|
],
|
|
235
236
|
[models_1.BlockType.TabsBlock]: [
|
|
236
|
-
|
|
237
|
-
fields: ['title'],
|
|
238
|
-
transformer: typografTransformer,
|
|
239
|
-
parser: parseTitle,
|
|
240
|
-
},
|
|
237
|
+
...blockHeaderTransfomer,
|
|
241
238
|
{
|
|
242
239
|
fields: ['items'],
|
|
243
240
|
transformer: yfmTransformer,
|
|
@@ -269,6 +266,11 @@ const config = {
|
|
|
269
266
|
},
|
|
270
267
|
],
|
|
271
268
|
[models_1.BlockType.SimpleBlock]: [
|
|
269
|
+
{
|
|
270
|
+
fields: ['title'],
|
|
271
|
+
transformer: typografTransformer,
|
|
272
|
+
parser: parseTitle,
|
|
273
|
+
},
|
|
272
274
|
{
|
|
273
275
|
fields: ['description'],
|
|
274
276
|
transformer: yfmTransformer,
|
|
@@ -320,28 +322,7 @@ const config = {
|
|
|
320
322
|
parser: parseTitle,
|
|
321
323
|
},
|
|
322
324
|
],
|
|
323
|
-
[models_1.BlockType.
|
|
324
|
-
{
|
|
325
|
-
fields: ['description'],
|
|
326
|
-
transformer: yfmTransformer,
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
fields: ['title'],
|
|
330
|
-
transformer: typografTransformer,
|
|
331
|
-
parser: parseTitle,
|
|
332
|
-
},
|
|
333
|
-
],
|
|
334
|
-
[models_1.BlockType.PromoFeaturesBlock]: [
|
|
335
|
-
{
|
|
336
|
-
fields: ['description'],
|
|
337
|
-
transformer: typografTransformer,
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
fields: ['title'],
|
|
341
|
-
transformer: typografTransformer,
|
|
342
|
-
parser: parseTitle,
|
|
343
|
-
},
|
|
344
|
-
],
|
|
325
|
+
[models_1.BlockType.PromoFeaturesBlock]: blockHeaderTransfomer,
|
|
345
326
|
[models_1.BlockType.InfoBlock]: [
|
|
346
327
|
{
|
|
347
328
|
fields: ['rightContent', 'leftContent'],
|
|
@@ -360,6 +341,15 @@ const config = {
|
|
|
360
341
|
transformer: typografTransformer,
|
|
361
342
|
},
|
|
362
343
|
],
|
|
344
|
+
[models_1.BlockType.CardLayoutBlock]: blockHeaderTransfomer,
|
|
345
|
+
[models_1.BlockType.IconsBlock]: [
|
|
346
|
+
{
|
|
347
|
+
fields: ['title'],
|
|
348
|
+
transformer: typografTransformer,
|
|
349
|
+
parser: parseTitle,
|
|
350
|
+
},
|
|
351
|
+
],
|
|
352
|
+
[models_1.BlockType.LinkTableBlock]: blockHeaderTransfomer,
|
|
363
353
|
};
|
|
364
354
|
function addRandomOrder(block) {
|
|
365
355
|
if (block) {
|