@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
@@ -300,6 +300,84 @@ export declare const HeaderSliderBlock: {
300
300
  fullscreen: {
301
301
  type: string;
302
302
  };
303
+ analyticsEvents: {
304
+ anyOf: ({
305
+ type: string;
306
+ additionalProperties: {
307
+ type: string;
308
+ };
309
+ required: string[];
310
+ properties: {
311
+ name: {
312
+ type: string;
313
+ };
314
+ type: {
315
+ type: string;
316
+ };
317
+ counters: {
318
+ type: string;
319
+ additionalProperties: boolean;
320
+ required: never[];
321
+ properties: {
322
+ include: {
323
+ type: string;
324
+ items: {
325
+ type: string;
326
+ };
327
+ };
328
+ exclude: {
329
+ type: string;
330
+ items: {
331
+ type: string;
332
+ };
333
+ };
334
+ };
335
+ };
336
+ context: {
337
+ type: string;
338
+ };
339
+ };
340
+ } | {
341
+ type: string;
342
+ items: {
343
+ type: string;
344
+ additionalProperties: {
345
+ type: string;
346
+ };
347
+ required: string[];
348
+ properties: {
349
+ name: {
350
+ type: string;
351
+ };
352
+ type: {
353
+ type: string;
354
+ };
355
+ counters: {
356
+ type: string;
357
+ additionalProperties: boolean;
358
+ required: never[];
359
+ properties: {
360
+ include: {
361
+ type: string;
362
+ items: {
363
+ type: string;
364
+ };
365
+ };
366
+ exclude: {
367
+ type: string;
368
+ items: {
369
+ type: string;
370
+ };
371
+ };
372
+ };
373
+ };
374
+ context: {
375
+ type: string;
376
+ };
377
+ };
378
+ };
379
+ })[];
380
+ };
303
381
  };
304
382
  } | {
305
383
  type: string;
@@ -137,6 +137,84 @@ export declare const Media: {
137
137
  fullscreen: {
138
138
  type: string;
139
139
  };
140
+ analyticsEvents: {
141
+ anyOf: ({
142
+ type: string;
143
+ additionalProperties: {
144
+ type: string;
145
+ };
146
+ required: string[];
147
+ properties: {
148
+ name: {
149
+ type: string;
150
+ };
151
+ type: {
152
+ type: string;
153
+ };
154
+ counters: {
155
+ type: string;
156
+ additionalProperties: boolean;
157
+ required: never[];
158
+ properties: {
159
+ include: {
160
+ type: string;
161
+ items: {
162
+ type: string;
163
+ };
164
+ };
165
+ exclude: {
166
+ type: string;
167
+ items: {
168
+ type: string;
169
+ };
170
+ };
171
+ };
172
+ };
173
+ context: {
174
+ type: string;
175
+ };
176
+ };
177
+ } | {
178
+ type: string;
179
+ items: {
180
+ type: string;
181
+ additionalProperties: {
182
+ type: string;
183
+ };
184
+ required: string[];
185
+ properties: {
186
+ name: {
187
+ type: string;
188
+ };
189
+ type: {
190
+ type: string;
191
+ };
192
+ counters: {
193
+ type: string;
194
+ additionalProperties: boolean;
195
+ required: never[];
196
+ properties: {
197
+ include: {
198
+ type: string;
199
+ items: {
200
+ type: string;
201
+ };
202
+ };
203
+ exclude: {
204
+ type: string;
205
+ items: {
206
+ type: string;
207
+ };
208
+ };
209
+ };
210
+ };
211
+ context: {
212
+ type: string;
213
+ };
214
+ };
215
+ };
216
+ })[];
217
+ };
140
218
  };
141
219
  };
142
220
  export declare const MediaBlockBaseProps: {
@@ -620,6 +698,84 @@ export declare const MediaBlock: {
620
698
  fullscreen: {
621
699
  type: string;
622
700
  };
701
+ analyticsEvents: {
702
+ anyOf: ({
703
+ type: string;
704
+ additionalProperties: {
705
+ type: string;
706
+ };
707
+ required: string[];
708
+ properties: {
709
+ name: {
710
+ type: string;
711
+ };
712
+ type: {
713
+ type: string;
714
+ };
715
+ counters: {
716
+ type: string;
717
+ additionalProperties: boolean;
718
+ required: never[];
719
+ properties: {
720
+ include: {
721
+ type: string;
722
+ items: {
723
+ type: string;
724
+ };
725
+ };
726
+ exclude: {
727
+ type: string;
728
+ items: {
729
+ type: string;
730
+ };
731
+ };
732
+ };
733
+ };
734
+ context: {
735
+ type: string;
736
+ };
737
+ };
738
+ } | {
739
+ type: string;
740
+ items: {
741
+ type: string;
742
+ additionalProperties: {
743
+ type: string;
744
+ };
745
+ required: string[];
746
+ properties: {
747
+ name: {
748
+ type: string;
749
+ };
750
+ type: {
751
+ type: string;
752
+ };
753
+ counters: {
754
+ type: string;
755
+ additionalProperties: boolean;
756
+ required: never[];
757
+ properties: {
758
+ include: {
759
+ type: string;
760
+ items: {
761
+ type: string;
762
+ };
763
+ };
764
+ exclude: {
765
+ type: string;
766
+ items: {
767
+ type: string;
768
+ };
769
+ };
770
+ };
771
+ };
772
+ context: {
773
+ type: string;
774
+ };
775
+ };
776
+ };
777
+ })[];
778
+ };
623
779
  };
624
780
  };
625
781
  description: {
@@ -152,6 +152,84 @@ export declare const PromoFeaturesItem: {
152
152
  fullscreen: {
153
153
  type: string;
154
154
  };
155
+ analyticsEvents: {
156
+ anyOf: ({
157
+ type: string;
158
+ additionalProperties: {
159
+ type: string;
160
+ };
161
+ required: string[];
162
+ properties: {
163
+ name: {
164
+ type: string;
165
+ };
166
+ type: {
167
+ type: string;
168
+ };
169
+ counters: {
170
+ type: string;
171
+ additionalProperties: boolean;
172
+ required: never[];
173
+ properties: {
174
+ include: {
175
+ type: string;
176
+ items: {
177
+ type: string;
178
+ };
179
+ };
180
+ exclude: {
181
+ type: string;
182
+ items: {
183
+ type: string;
184
+ };
185
+ };
186
+ };
187
+ };
188
+ context: {
189
+ type: string;
190
+ };
191
+ };
192
+ } | {
193
+ type: string;
194
+ items: {
195
+ type: string;
196
+ additionalProperties: {
197
+ type: string;
198
+ };
199
+ required: string[];
200
+ properties: {
201
+ name: {
202
+ type: string;
203
+ };
204
+ type: {
205
+ type: string;
206
+ };
207
+ counters: {
208
+ type: string;
209
+ additionalProperties: boolean;
210
+ required: never[];
211
+ properties: {
212
+ include: {
213
+ type: string;
214
+ items: {
215
+ type: string;
216
+ };
217
+ };
218
+ exclude: {
219
+ type: string;
220
+ items: {
221
+ type: string;
222
+ };
223
+ };
224
+ };
225
+ };
226
+ context: {
227
+ type: string;
228
+ };
229
+ };
230
+ };
231
+ })[];
232
+ };
155
233
  };
156
234
  };
157
235
  };
@@ -153,6 +153,84 @@ export declare const SecurityBlock: {
153
153
  fullscreen: {
154
154
  type: string;
155
155
  };
156
+ analyticsEvents: {
157
+ anyOf: ({
158
+ type: string;
159
+ additionalProperties: {
160
+ type: string;
161
+ };
162
+ required: string[];
163
+ properties: {
164
+ name: {
165
+ type: string;
166
+ };
167
+ type: {
168
+ type: string;
169
+ };
170
+ counters: {
171
+ type: string;
172
+ additionalProperties: boolean;
173
+ required: never[];
174
+ properties: {
175
+ include: {
176
+ type: string;
177
+ items: {
178
+ type: string;
179
+ };
180
+ };
181
+ exclude: {
182
+ type: string;
183
+ items: {
184
+ type: string;
185
+ };
186
+ };
187
+ };
188
+ };
189
+ context: {
190
+ type: string;
191
+ };
192
+ };
193
+ } | {
194
+ type: string;
195
+ items: {
196
+ type: string;
197
+ additionalProperties: {
198
+ type: string;
199
+ };
200
+ required: string[];
201
+ properties: {
202
+ name: {
203
+ type: string;
204
+ };
205
+ type: {
206
+ type: string;
207
+ };
208
+ counters: {
209
+ type: string;
210
+ additionalProperties: boolean;
211
+ required: never[];
212
+ properties: {
213
+ include: {
214
+ type: string;
215
+ items: {
216
+ type: string;
217
+ };
218
+ };
219
+ exclude: {
220
+ type: string;
221
+ items: {
222
+ type: string;
223
+ };
224
+ };
225
+ };
226
+ };
227
+ context: {
228
+ type: string;
229
+ };
230
+ };
231
+ };
232
+ })[];
233
+ };
156
234
  };
157
235
  };
158
236
  points: {
@@ -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;
@@ -41,7 +41,7 @@ export const Media = (props) => {
41
41
  }
42
42
  }
43
43
  if (youtube) {
44
- result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: getFullscreen({ fullScreen, fullscreen }) }));
44
+ result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: getFullscreen({ fullScreen, fullscreen }), analyticsEvents: analyticsEvents }));
45
45
  }
46
46
  if (dataLens) {
47
47
  result = React.createElement(DataLens, { dataLens: dataLens });
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
+ import { AnalyticsEventsBase } from '../../models/common';
2
3
  import './VideoBlock.css';
3
4
  export declare const AUTOPLAY_ATTRIBUTES: {
4
5
  autoplay: number;
5
6
  mute: number;
6
7
  };
7
8
  export declare function getHeight(width: number): number;
8
- export interface VideoBlockProps {
9
+ export interface VideoBlockProps extends AnalyticsEventsBase {
9
10
  id?: string;
10
11
  stream?: string;
11
12
  record?: string;
@@ -2,7 +2,9 @@ import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { Icon } from '@gravity-ui/uikit';
3
3
  import _ from 'lodash';
4
4
  import { v4 as uuidv4 } from 'uuid';
5
+ import { useAnalytics } from '../../hooks/useAnalytics';
5
6
  import { PlayVideo } from '../../icons';
7
+ import { DefaultEventNames } from '../../models/common';
6
8
  import { block, getPageSearchParams } from '../../utils';
7
9
  import Image from '../Image/Image';
8
10
  import i18n from './i18n';
@@ -35,7 +37,8 @@ export function getHeight(width) {
35
37
  return (width / 16) * 9;
36
38
  }
37
39
  const VideoBlock = (props) => {
38
- const { stream, record, attributes, className, id, previewImg, playButton, height, fullScreen, fullscreen, } = props;
40
+ const { stream, record, attributes, className, id, previewImg, playButton, height, fullScreen, fullscreen, analyticsEvents, } = props;
41
+ const handleAnalytics = useAnalytics(DefaultEventNames.VideoPreview);
39
42
  const src = getVideoSrc(stream, record);
40
43
  const ref = useRef(null);
41
44
  const iframeRef = useRef();
@@ -44,11 +47,12 @@ const VideoBlock = (props) => {
44
47
  const [currentHeight, setCurrentHeight] = useState(height || undefined);
45
48
  const fullId = id || uuidv4();
46
49
  const onPreviewClick = useCallback(() => {
50
+ handleAnalytics(analyticsEvents);
47
51
  if (iframeRef.current) {
48
52
  iframeRef.current.src = `${src}?${getPageSearchParams(Object.assign(Object.assign({}, AUTOPLAY_ATTRIBUTES), (attributes || {})))}`;
49
53
  }
50
54
  setTimeout(() => setHidePreview(true), AUTOPLAY_DELAY);
51
- }, [src, attributes]);
55
+ }, [handleAnalytics, analyticsEvents, src, attributes]);
52
56
  useEffect(() => {
53
57
  const updateSize = _.debounce(() => {
54
58
  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[];
@@ -45,4 +45,5 @@ export var DefaultEventNames;
45
45
  DefaultEventNames["QuoteButton"] = "quote-button-click";
46
46
  DefaultEventNames["BackLink"] = "back-link-click";
47
47
  DefaultEventNames["Breadcrumb"] = "breadcrumb-click";
48
+ DefaultEventNames["VideoPreview"] = "video-preview-click";
48
49
  })(DefaultEventNames || (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;