@gravity-ui/page-constructor 2.22.2 → 2.23.0-alpha.1

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 (33) hide show
  1. package/build/cjs/blocks/Header/schema.d.ts +234 -0
  2. package/build/cjs/blocks/HeaderSlider/schema.d.ts +78 -0
  3. package/build/cjs/blocks/Media/schema.d.ts +156 -0
  4. package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +78 -0
  5. package/build/cjs/blocks/Security/schema.d.ts +78 -0
  6. package/build/cjs/blocks/Tabs/schema.d.ts +78 -0
  7. package/build/cjs/components/Media/Media.js +1 -1
  8. package/build/cjs/components/VideoBlock/VideoBlock.d.ts +2 -1
  9. package/build/cjs/components/VideoBlock/VideoBlock.js +6 -2
  10. package/build/cjs/models/common.d.ts +2 -1
  11. package/build/cjs/models/common.js +1 -0
  12. package/build/cjs/schema/validators/common.d.ts +78 -0
  13. package/build/cjs/schema/validators/common.js +3 -0
  14. package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +78 -0
  15. package/build/cjs/sub-blocks/MediaCard/schema.d.ts +78 -0
  16. package/build/esm/blocks/Header/schema.d.ts +234 -0
  17. package/build/esm/blocks/HeaderSlider/schema.d.ts +78 -0
  18. package/build/esm/blocks/Media/schema.d.ts +156 -0
  19. package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +78 -0
  20. package/build/esm/blocks/Security/schema.d.ts +78 -0
  21. package/build/esm/blocks/Tabs/schema.d.ts +78 -0
  22. package/build/esm/components/Media/Media.js +1 -1
  23. package/build/esm/components/VideoBlock/VideoBlock.d.ts +2 -1
  24. package/build/esm/components/VideoBlock/VideoBlock.js +6 -2
  25. package/build/esm/models/common.d.ts +2 -1
  26. package/build/esm/models/common.js +1 -0
  27. package/build/esm/schema/validators/common.d.ts +78 -0
  28. package/build/esm/schema/validators/common.js +3 -0
  29. package/build/esm/sub-blocks/LayoutItem/schema.d.ts +78 -0
  30. package/build/esm/sub-blocks/MediaCard/schema.d.ts +78 -0
  31. package/package.json +4 -1
  32. package/server/models/common.d.ts +2 -1
  33. package/server/models/common.js +1 -0
@@ -148,6 +148,84 @@ export declare const tabsItem: {
148
148
  fullscreen: {
149
149
  type: string;
150
150
  };
151
+ analyticsEvents: {
152
+ anyOf: ({
153
+ type: string;
154
+ additionalProperties: {
155
+ type: string;
156
+ };
157
+ required: string[];
158
+ properties: {
159
+ name: {
160
+ type: string;
161
+ };
162
+ type: {
163
+ type: string;
164
+ };
165
+ counters: {
166
+ type: string;
167
+ additionalProperties: boolean;
168
+ required: never[];
169
+ properties: {
170
+ include: {
171
+ type: string;
172
+ items: {
173
+ type: string;
174
+ };
175
+ };
176
+ exclude: {
177
+ type: string;
178
+ items: {
179
+ type: string;
180
+ };
181
+ };
182
+ };
183
+ };
184
+ context: {
185
+ type: string;
186
+ };
187
+ };
188
+ } | {
189
+ type: string;
190
+ items: {
191
+ type: string;
192
+ additionalProperties: {
193
+ type: string;
194
+ };
195
+ required: string[];
196
+ properties: {
197
+ name: {
198
+ type: string;
199
+ };
200
+ type: {
201
+ type: string;
202
+ };
203
+ counters: {
204
+ type: string;
205
+ additionalProperties: boolean;
206
+ required: never[];
207
+ properties: {
208
+ include: {
209
+ type: string;
210
+ items: {
211
+ type: string;
212
+ };
213
+ };
214
+ exclude: {
215
+ type: string;
216
+ items: {
217
+ type: string;
218
+ };
219
+ };
220
+ };
221
+ };
222
+ context: {
223
+ type: string;
224
+ };
225
+ };
226
+ };
227
+ })[];
228
+ };
151
229
  };
152
230
  } | {
153
231
  type: string;
@@ -44,7 +44,7 @@ const Media = (props) => {
44
44
  }
45
45
  }
46
46
  if (youtube) {
47
- result = (react_1.default.createElement(VideoBlock_1.default, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: getFullscreen({ fullScreen, fullscreen }) }));
47
+ result = (react_1.default.createElement(VideoBlock_1.default, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: getFullscreen({ fullScreen, fullscreen }), analyticsEvents: analyticsEvents }));
48
48
  }
49
49
  if (dataLens) {
50
50
  result = react_1.default.createElement(DataLens_1.default, { dataLens: dataLens });
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
+ import { AnalyticsEventsBase } from '../../models/common';
2
3
  export declare const AUTOPLAY_ATTRIBUTES: {
3
4
  autoplay: number;
4
5
  mute: number;
5
6
  };
6
7
  export declare function getHeight(width: number): number;
7
- export interface VideoBlockProps {
8
+ export interface VideoBlockProps extends AnalyticsEventsBase {
8
9
  id?: string;
9
10
  stream?: string;
10
11
  record?: string;
@@ -6,7 +6,9 @@ const react_1 = tslib_1.__importStar(require("react"));
6
6
  const uikit_1 = require("@gravity-ui/uikit");
7
7
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
8
8
  const uuid_1 = require("uuid");
9
+ const useAnalytics_1 = require("../../hooks/useAnalytics");
9
10
  const icons_1 = require("../../icons");
11
+ const common_1 = require("../../models/common");
10
12
  const utils_1 = require("../../utils");
11
13
  const Image_1 = tslib_1.__importDefault(require("../Image/Image"));
12
14
  const i18n_1 = tslib_1.__importDefault(require("./i18n"));
@@ -39,7 +41,8 @@ function getHeight(width) {
39
41
  }
40
42
  exports.getHeight = getHeight;
41
43
  const VideoBlock = (props) => {
42
- const { stream, record, attributes, className, id, previewImg, playButton, height, fullScreen, fullscreen, } = props;
44
+ const { stream, record, attributes, className, id, previewImg, playButton, height, fullScreen, fullscreen, analyticsEvents, } = props;
45
+ const handleAnalytics = (0, useAnalytics_1.useAnalytics)(common_1.DefaultEventNames.VideoPreview);
43
46
  const src = getVideoSrc(stream, record);
44
47
  const ref = (0, react_1.useRef)(null);
45
48
  const iframeRef = (0, react_1.useRef)();
@@ -48,11 +51,12 @@ const VideoBlock = (props) => {
48
51
  const [currentHeight, setCurrentHeight] = (0, react_1.useState)(height || undefined);
49
52
  const fullId = id || (0, uuid_1.v4)();
50
53
  const onPreviewClick = (0, react_1.useCallback)(() => {
54
+ handleAnalytics(analyticsEvents);
51
55
  if (iframeRef.current) {
52
56
  iframeRef.current.src = `${src}?${(0, utils_1.getPageSearchParams)(Object.assign(Object.assign({}, exports.AUTOPLAY_ATTRIBUTES), (attributes || {})))}`;
53
57
  }
54
58
  setTimeout(() => setHidePreview(true), AUTOPLAY_DELAY);
55
- }, [src, attributes]);
59
+ }, [handleAnalytics, analyticsEvents, src, attributes]);
56
60
  (0, react_1.useEffect)(() => {
57
61
  const updateSize = lodash_1.default.debounce(() => {
58
62
  setCurrentHeight(ref.current ? Math.round(getHeight(ref.current.offsetWidth)) : undefined);
@@ -79,7 +79,8 @@ export declare enum DefaultEventNames {
79
79
  HubspotFormSubmit = "hubspot-form-submit",
80
80
  QuoteButton = "quote-button-click",
81
81
  BackLink = "back-link-click",
82
- Breadcrumb = "breadcrumb-click"
82
+ Breadcrumb = "breadcrumb-click",
83
+ VideoPreview = "video-preview-click"
83
84
  }
84
85
  export type AnalyticsCounters = {
85
86
  include?: string[];
@@ -48,4 +48,5 @@ var DefaultEventNames;
48
48
  DefaultEventNames["QuoteButton"] = "quote-button-click";
49
49
  DefaultEventNames["BackLink"] = "back-link-click";
50
50
  DefaultEventNames["Breadcrumb"] = "breadcrumb-click";
51
+ DefaultEventNames["VideoPreview"] = "video-preview-click";
51
52
  })(DefaultEventNames = exports.DefaultEventNames || (exports.DefaultEventNames = {}));
@@ -1120,6 +1120,84 @@ export declare const MediaProps: {
1120
1120
  fullscreen: {
1121
1121
  type: string;
1122
1122
  };
1123
+ analyticsEvents: {
1124
+ anyOf: ({
1125
+ type: string;
1126
+ additionalProperties: {
1127
+ type: string;
1128
+ };
1129
+ required: string[];
1130
+ properties: {
1131
+ name: {
1132
+ type: string;
1133
+ };
1134
+ type: {
1135
+ type: string;
1136
+ };
1137
+ counters: {
1138
+ type: string;
1139
+ additionalProperties: boolean;
1140
+ required: never[];
1141
+ properties: {
1142
+ include: {
1143
+ type: string;
1144
+ items: {
1145
+ type: string;
1146
+ };
1147
+ };
1148
+ exclude: {
1149
+ type: string;
1150
+ items: {
1151
+ type: string;
1152
+ };
1153
+ };
1154
+ };
1155
+ };
1156
+ context: {
1157
+ type: string;
1158
+ };
1159
+ };
1160
+ } | {
1161
+ type: string;
1162
+ items: {
1163
+ type: string;
1164
+ additionalProperties: {
1165
+ type: string;
1166
+ };
1167
+ required: string[];
1168
+ properties: {
1169
+ name: {
1170
+ type: string;
1171
+ };
1172
+ type: {
1173
+ type: string;
1174
+ };
1175
+ counters: {
1176
+ type: string;
1177
+ additionalProperties: boolean;
1178
+ required: never[];
1179
+ properties: {
1180
+ include: {
1181
+ type: string;
1182
+ items: {
1183
+ type: string;
1184
+ };
1185
+ };
1186
+ exclude: {
1187
+ type: string;
1188
+ items: {
1189
+ type: string;
1190
+ };
1191
+ };
1192
+ };
1193
+ };
1194
+ context: {
1195
+ type: string;
1196
+ };
1197
+ };
1198
+ };
1199
+ })[];
1200
+ };
1123
1201
  };
1124
1202
  export declare const YMapMarkerLabel: {
1125
1203
  type: string;
@@ -463,6 +463,9 @@ exports.MediaProps = {
463
463
  fullscreen: {
464
464
  type: 'boolean',
465
465
  },
466
+ analyticsEvents: {
467
+ anyOf: [event_1.AnalyticsEventSchema, { type: 'array', items: event_1.AnalyticsEventSchema }],
468
+ },
466
469
  };
467
470
  exports.YMapMarkerLabel = {
468
471
  type: 'object',
@@ -138,6 +138,84 @@ export declare const LayoutItem: {
138
138
  fullscreen: {
139
139
  type: string;
140
140
  };
141
+ analyticsEvents: {
142
+ anyOf: ({
143
+ type: string;
144
+ additionalProperties: {
145
+ type: string;
146
+ };
147
+ required: string[];
148
+ properties: {
149
+ name: {
150
+ type: string;
151
+ };
152
+ type: {
153
+ type: string;
154
+ };
155
+ counters: {
156
+ type: string;
157
+ additionalProperties: boolean;
158
+ required: never[];
159
+ properties: {
160
+ include: {
161
+ type: string;
162
+ items: {
163
+ type: string;
164
+ };
165
+ };
166
+ exclude: {
167
+ type: string;
168
+ items: {
169
+ type: string;
170
+ };
171
+ };
172
+ };
173
+ };
174
+ context: {
175
+ type: string;
176
+ };
177
+ };
178
+ } | {
179
+ type: string;
180
+ items: {
181
+ type: string;
182
+ additionalProperties: {
183
+ type: string;
184
+ };
185
+ required: string[];
186
+ properties: {
187
+ name: {
188
+ type: string;
189
+ };
190
+ type: {
191
+ type: string;
192
+ };
193
+ counters: {
194
+ type: string;
195
+ additionalProperties: boolean;
196
+ required: never[];
197
+ properties: {
198
+ include: {
199
+ type: string;
200
+ items: {
201
+ type: string;
202
+ };
203
+ };
204
+ exclude: {
205
+ type: string;
206
+ items: {
207
+ type: string;
208
+ };
209
+ };
210
+ };
211
+ };
212
+ context: {
213
+ type: string;
214
+ };
215
+ };
216
+ };
217
+ })[];
218
+ };
141
219
  };
142
220
  content: Partial<{
143
221
  title: {
@@ -140,6 +140,84 @@ export declare const MediaCardBlock: {
140
140
  fullscreen: {
141
141
  type: string;
142
142
  };
143
+ analyticsEvents: {
144
+ anyOf: ({
145
+ type: string;
146
+ additionalProperties: {
147
+ type: string;
148
+ };
149
+ required: string[];
150
+ properties: {
151
+ name: {
152
+ type: string;
153
+ };
154
+ type: {
155
+ type: string;
156
+ };
157
+ counters: {
158
+ type: string;
159
+ additionalProperties: boolean;
160
+ required: never[];
161
+ properties: {
162
+ include: {
163
+ type: string;
164
+ items: {
165
+ type: string;
166
+ };
167
+ };
168
+ exclude: {
169
+ type: string;
170
+ items: {
171
+ type: string;
172
+ };
173
+ };
174
+ };
175
+ };
176
+ context: {
177
+ type: string;
178
+ };
179
+ };
180
+ } | {
181
+ type: string;
182
+ items: {
183
+ type: string;
184
+ additionalProperties: {
185
+ type: string;
186
+ };
187
+ required: string[];
188
+ properties: {
189
+ name: {
190
+ type: string;
191
+ };
192
+ type: {
193
+ type: string;
194
+ };
195
+ counters: {
196
+ type: string;
197
+ additionalProperties: boolean;
198
+ required: never[];
199
+ properties: {
200
+ include: {
201
+ type: string;
202
+ items: {
203
+ type: string;
204
+ };
205
+ };
206
+ exclude: {
207
+ type: string;
208
+ items: {
209
+ type: string;
210
+ };
211
+ };
212
+ };
213
+ };
214
+ context: {
215
+ type: string;
216
+ };
217
+ };
218
+ };
219
+ })[];
220
+ };
143
221
  border: {
144
222
  type: string;
145
223
  enum: string[];
@@ -143,6 +143,84 @@ export declare const HeaderBackgroundProps: {
143
143
  fullscreen: {
144
144
  type: string;
145
145
  };
146
+ analyticsEvents: {
147
+ anyOf: ({
148
+ type: string;
149
+ additionalProperties: {
150
+ type: string;
151
+ };
152
+ required: string[];
153
+ properties: {
154
+ name: {
155
+ type: string;
156
+ };
157
+ type: {
158
+ type: string;
159
+ };
160
+ counters: {
161
+ type: string;
162
+ additionalProperties: boolean;
163
+ required: never[];
164
+ properties: {
165
+ include: {
166
+ type: string;
167
+ items: {
168
+ type: string;
169
+ };
170
+ };
171
+ exclude: {
172
+ type: string;
173
+ items: {
174
+ type: string;
175
+ };
176
+ };
177
+ };
178
+ };
179
+ context: {
180
+ type: string;
181
+ };
182
+ };
183
+ } | {
184
+ type: string;
185
+ items: {
186
+ type: string;
187
+ additionalProperties: {
188
+ type: string;
189
+ };
190
+ required: string[];
191
+ properties: {
192
+ name: {
193
+ type: string;
194
+ };
195
+ type: {
196
+ type: string;
197
+ };
198
+ counters: {
199
+ type: string;
200
+ additionalProperties: boolean;
201
+ required: never[];
202
+ properties: {
203
+ include: {
204
+ type: string;
205
+ items: {
206
+ type: string;
207
+ };
208
+ };
209
+ exclude: {
210
+ type: string;
211
+ items: {
212
+ type: string;
213
+ };
214
+ };
215
+ };
216
+ };
217
+ context: {
218
+ type: string;
219
+ };
220
+ };
221
+ };
222
+ })[];
223
+ };
146
224
  };
147
225
  };
148
226
  export declare const HeaderProperties: {
@@ -436,6 +514,84 @@ export declare const HeaderProperties: {
436
514
  fullscreen: {
437
515
  type: string;
438
516
  };
517
+ analyticsEvents: {
518
+ anyOf: ({
519
+ type: string;
520
+ additionalProperties: {
521
+ type: string;
522
+ };
523
+ required: string[];
524
+ properties: {
525
+ name: {
526
+ type: string;
527
+ };
528
+ type: {
529
+ type: string;
530
+ };
531
+ counters: {
532
+ type: string;
533
+ additionalProperties: boolean;
534
+ required: never[];
535
+ properties: {
536
+ include: {
537
+ type: string;
538
+ items: {
539
+ type: string;
540
+ };
541
+ };
542
+ exclude: {
543
+ type: string;
544
+ items: {
545
+ type: string;
546
+ };
547
+ };
548
+ };
549
+ };
550
+ context: {
551
+ type: string;
552
+ };
553
+ };
554
+ } | {
555
+ type: string;
556
+ items: {
557
+ type: string;
558
+ additionalProperties: {
559
+ type: string;
560
+ };
561
+ required: string[];
562
+ properties: {
563
+ name: {
564
+ type: string;
565
+ };
566
+ type: {
567
+ type: string;
568
+ };
569
+ counters: {
570
+ type: string;
571
+ additionalProperties: boolean;
572
+ required: never[];
573
+ properties: {
574
+ include: {
575
+ type: string;
576
+ items: {
577
+ type: string;
578
+ };
579
+ };
580
+ exclude: {
581
+ type: string;
582
+ items: {
583
+ type: string;
584
+ };
585
+ };
586
+ };
587
+ };
588
+ context: {
589
+ type: string;
590
+ };
591
+ };
592
+ };
593
+ })[];
594
+ };
439
595
  };
440
596
  } | {
441
597
  type: string;
@@ -775,6 +931,84 @@ export declare const HeaderBlock: {
775
931
  fullscreen: {
776
932
  type: string;
777
933
  };
934
+ analyticsEvents: {
935
+ anyOf: ({
936
+ type: string;
937
+ additionalProperties: {
938
+ type: string;
939
+ };
940
+ required: string[];
941
+ properties: {
942
+ name: {
943
+ type: string;
944
+ };
945
+ type: {
946
+ type: string;
947
+ };
948
+ counters: {
949
+ type: string;
950
+ additionalProperties: boolean;
951
+ required: never[];
952
+ properties: {
953
+ include: {
954
+ type: string;
955
+ items: {
956
+ type: string;
957
+ };
958
+ };
959
+ exclude: {
960
+ type: string;
961
+ items: {
962
+ type: string;
963
+ };
964
+ };
965
+ };
966
+ };
967
+ context: {
968
+ type: string;
969
+ };
970
+ };
971
+ } | {
972
+ type: string;
973
+ items: {
974
+ type: string;
975
+ additionalProperties: {
976
+ type: string;
977
+ };
978
+ required: string[];
979
+ properties: {
980
+ name: {
981
+ type: string;
982
+ };
983
+ type: {
984
+ type: string;
985
+ };
986
+ counters: {
987
+ type: string;
988
+ additionalProperties: boolean;
989
+ required: never[];
990
+ properties: {
991
+ include: {
992
+ type: string;
993
+ items: {
994
+ type: string;
995
+ };
996
+ };
997
+ exclude: {
998
+ type: string;
999
+ items: {
1000
+ type: string;
1001
+ };
1002
+ };
1003
+ };
1004
+ };
1005
+ context: {
1006
+ type: string;
1007
+ };
1008
+ };
1009
+ };
1010
+ })[];
1011
+ };
778
1012
  };
779
1013
  } | {
780
1014
  type: string;