@gravity-ui/page-constructor 1.14.0 → 1.15.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.
Files changed (73) hide show
  1. package/build/cjs/blocks/Banner/schema.d.ts +234 -0
  2. package/build/cjs/blocks/Media/schema.d.ts +78 -0
  3. package/build/cjs/components/Button/Button.js +5 -2
  4. package/build/cjs/components/CardBase/CardBase.d.ts +2 -0
  5. package/build/cjs/components/CardBase/CardBase.js +4 -1
  6. package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +4 -1
  7. package/build/cjs/components/Link/Link.js +4 -1
  8. package/build/cjs/components/Media/Media.js +3 -2
  9. package/build/cjs/components/Media/Video/Video.js +4 -3
  10. package/build/cjs/components/ReactPlayer/ReactPlayer.js +27 -3
  11. package/build/cjs/components/YandexForm/YandexForm.d.ts +2 -0
  12. package/build/cjs/components/YandexForm/YandexForm.js +13 -2
  13. package/build/cjs/containers/PageConstructor/Provider.d.ts +2 -0
  14. package/build/cjs/containers/PageConstructor/Provider.js +3 -1
  15. package/build/cjs/context/analyticsContext/analyticsContext.d.ts +6 -0
  16. package/build/cjs/context/analyticsContext/analyticsContext.js +6 -0
  17. package/build/cjs/context/analyticsContext/index.d.ts +1 -0
  18. package/build/cjs/context/analyticsContext/index.js +4 -0
  19. package/build/cjs/context/metrikaContext/metrikaContext.d.ts +6 -0
  20. package/build/cjs/hooks/index.d.ts +1 -0
  21. package/build/cjs/hooks/index.js +1 -0
  22. package/build/cjs/hooks/useAnalytics.d.ts +2 -0
  23. package/build/cjs/hooks/useAnalytics.js +18 -0
  24. package/build/cjs/hooks/useMetrika.d.ts +6 -0
  25. package/build/cjs/hooks/useMetrika.js +8 -0
  26. package/build/cjs/models/common.d.ts +36 -0
  27. package/build/cjs/models/common.js +3 -0
  28. package/build/cjs/models/constructor-items/common.d.ts +6 -1
  29. package/build/cjs/models/constructor-items/sub-blocks.d.ts +2 -1
  30. package/build/cjs/schema/validators/common.d.ts +168 -0
  31. package/build/cjs/schema/validators/common.js +10 -0
  32. package/build/cjs/schema/validators/event.d.ts +91 -0
  33. package/build/cjs/schema/validators/event.js +90 -0
  34. package/build/cjs/sub-blocks/HubspotForm/index.js +13 -2
  35. package/build/esm/blocks/Banner/schema.d.ts +234 -0
  36. package/build/esm/blocks/Media/schema.d.ts +78 -0
  37. package/build/esm/components/Button/Button.js +5 -2
  38. package/build/esm/components/CardBase/CardBase.d.ts +2 -0
  39. package/build/esm/components/CardBase/CardBase.js +4 -1
  40. package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +4 -1
  41. package/build/esm/components/Link/Link.js +4 -1
  42. package/build/esm/components/Media/Media.js +3 -2
  43. package/build/esm/components/Media/Video/Video.js +4 -3
  44. package/build/esm/components/ReactPlayer/ReactPlayer.js +27 -3
  45. package/build/esm/components/YandexForm/YandexForm.d.ts +2 -0
  46. package/build/esm/components/YandexForm/YandexForm.js +13 -2
  47. package/build/esm/containers/PageConstructor/Provider.d.ts +2 -0
  48. package/build/esm/containers/PageConstructor/Provider.js +3 -1
  49. package/build/esm/context/analyticsContext/analyticsContext.d.ts +6 -0
  50. package/build/esm/context/analyticsContext/analyticsContext.js +2 -0
  51. package/build/esm/context/analyticsContext/index.d.ts +1 -0
  52. package/build/esm/context/analyticsContext/index.js +1 -0
  53. package/build/esm/context/metrikaContext/metrikaContext.d.ts +6 -0
  54. package/build/esm/hooks/index.d.ts +1 -0
  55. package/build/esm/hooks/index.js +1 -0
  56. package/build/esm/hooks/useAnalytics.d.ts +2 -0
  57. package/build/esm/hooks/useAnalytics.js +14 -0
  58. package/build/esm/hooks/useMetrika.d.ts +6 -0
  59. package/build/esm/hooks/useMetrika.js +8 -0
  60. package/build/esm/models/common.d.ts +36 -0
  61. package/build/esm/models/common.js +3 -0
  62. package/build/esm/models/constructor-items/common.d.ts +6 -1
  63. package/build/esm/models/constructor-items/sub-blocks.d.ts +2 -1
  64. package/build/esm/schema/validators/common.d.ts +168 -0
  65. package/build/esm/schema/validators/common.js +10 -0
  66. package/build/esm/schema/validators/event.d.ts +91 -0
  67. package/build/esm/schema/validators/event.js +87 -0
  68. package/build/esm/sub-blocks/HubspotForm/index.js +14 -3
  69. package/package.json +4 -1
  70. package/server/models/common.d.ts +36 -0
  71. package/server/models/common.js +3 -0
  72. package/server/models/constructor-items/common.d.ts +6 -1
  73. package/server/models/constructor-items/sub-blocks.d.ts +2 -1
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AnalyticsEventV2Schema = exports.AnalyticsEventSchema = void 0;
4
+ exports.AnalyticsEventSchema = {
5
+ type: 'object',
6
+ additionalProperties: false,
7
+ required: ['name'],
8
+ properties: {
9
+ name: {
10
+ type: 'string',
11
+ },
12
+ type: {
13
+ type: 'string',
14
+ },
15
+ counters: {
16
+ type: 'object',
17
+ additionalProperties: false,
18
+ required: [],
19
+ properties: {
20
+ include: {
21
+ type: 'array',
22
+ items: {
23
+ type: 'string',
24
+ },
25
+ },
26
+ exclude: {
27
+ type: 'array',
28
+ items: {
29
+ type: 'string',
30
+ },
31
+ },
32
+ },
33
+ },
34
+ category: {
35
+ type: 'string',
36
+ },
37
+ label: {
38
+ type: 'string',
39
+ },
40
+ params: {
41
+ type: 'array',
42
+ items: {
43
+ type: 'object',
44
+ additionalProperties: false,
45
+ required: ['key', 'value'],
46
+ properties: {
47
+ key: {
48
+ type: 'string',
49
+ },
50
+ value: {
51
+ type: 'string',
52
+ },
53
+ },
54
+ },
55
+ },
56
+ },
57
+ };
58
+ exports.AnalyticsEventV2Schema = {
59
+ type: 'object',
60
+ propertyNames: { type: 'string' },
61
+ additionalProperty: { type: 'number' },
62
+ required: ['name'],
63
+ properties: {
64
+ name: {
65
+ type: 'string',
66
+ },
67
+ type: {
68
+ type: 'string',
69
+ },
70
+ counters: {
71
+ type: 'object',
72
+ additionalProperties: false,
73
+ required: [],
74
+ properties: {
75
+ include: {
76
+ type: 'array',
77
+ items: {
78
+ type: 'string',
79
+ },
80
+ },
81
+ exclude: {
82
+ type: 'array',
83
+ items: {
84
+ type: 'string',
85
+ },
86
+ },
87
+ },
88
+ },
89
+ },
90
+ };
@@ -12,8 +12,9 @@ const b = (0, utils_1.block)('hubspot-form');
12
12
  const HubspotForm = (props) => {
13
13
  const { className, theme: themeProp, isMobile: isMobileProp, formId, formInstanceId, portalId, region, formClassName, pixelEvents,
14
14
  // hubspotEvents, // TODO: decide how to handle them
15
- onBeforeSubmit, onSubmit, onBeforeLoad, onLoad, } = props;
15
+ analyticsEvents, onBeforeSubmit, onSubmit, onBeforeLoad, onLoad, } = props;
16
16
  const handleMetrika = (0, useMetrika_1.useMetrika)();
17
+ const handleAnalytics = (0, hooks_1.useAnalytics)();
17
18
  const { themeValue } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
18
19
  const isMobileValue = (0, react_1.useContext)(mobileContext_1.MobileContext);
19
20
  const theme = themeProp !== null && themeProp !== void 0 ? themeProp : themeValue;
@@ -24,9 +25,19 @@ const HubspotForm = (props) => {
24
25
  onLoad,
25
26
  onSubmit: (e) => {
26
27
  handleMetrika === null || handleMetrika === void 0 ? void 0 : handleMetrika({ pixelEvents });
28
+ handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
27
29
  onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(e);
28
30
  },
29
- }), [onBeforeLoad, onBeforeSubmit, onLoad, handleMetrika, pixelEvents, onSubmit]);
31
+ }), [
32
+ onBeforeLoad,
33
+ onBeforeSubmit,
34
+ onLoad,
35
+ handleMetrika,
36
+ pixelEvents,
37
+ handleAnalytics,
38
+ analyticsEvents,
39
+ onSubmit,
40
+ ]);
30
41
  (0, hooks_1.useHandleHubspotEvents)(handlers, formId);
31
42
  return (react_1.default.createElement(HubspotFormContainer_1.default, { key: [formClassName, formId, formInstanceId, portalId, region].join(), className: b({ theme, mobile }, className), formClassName: formClassName, formId: formId, portalId: portalId, formInstanceId: formInstanceId, region: region }));
32
43
  };
@@ -173,6 +173,84 @@ export declare const BannerCardProps: {
173
173
  };
174
174
  };
175
175
  };
176
+ analyticsEvents: {
177
+ anyOf: ({
178
+ type: string;
179
+ propertyNames: {
180
+ type: string;
181
+ };
182
+ additionalProperty: {
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
+ };
213
+ } | {
214
+ type: string;
215
+ items: {
216
+ type: string;
217
+ propertyNames: {
218
+ type: string;
219
+ };
220
+ additionalProperty: {
221
+ type: string;
222
+ };
223
+ required: string[];
224
+ properties: {
225
+ name: {
226
+ type: string;
227
+ };
228
+ type: {
229
+ type: string;
230
+ };
231
+ counters: {
232
+ type: string;
233
+ additionalProperties: boolean;
234
+ required: never[];
235
+ properties: {
236
+ include: {
237
+ type: string;
238
+ items: {
239
+ type: string;
240
+ };
241
+ };
242
+ exclude: {
243
+ type: string;
244
+ items: {
245
+ type: string;
246
+ };
247
+ };
248
+ };
249
+ };
250
+ };
251
+ };
252
+ })[];
253
+ };
176
254
  target: {
177
255
  type: string;
178
256
  enum: string[];
@@ -375,6 +453,84 @@ export declare const BannerBlock: {
375
453
  };
376
454
  };
377
455
  };
456
+ analyticsEvents: {
457
+ anyOf: ({
458
+ type: string;
459
+ propertyNames: {
460
+ type: string;
461
+ };
462
+ additionalProperty: {
463
+ type: string;
464
+ };
465
+ required: string[];
466
+ properties: {
467
+ name: {
468
+ type: string;
469
+ };
470
+ type: {
471
+ type: string;
472
+ };
473
+ counters: {
474
+ type: string;
475
+ additionalProperties: boolean;
476
+ required: never[];
477
+ properties: {
478
+ include: {
479
+ type: string;
480
+ items: {
481
+ type: string;
482
+ };
483
+ };
484
+ exclude: {
485
+ type: string;
486
+ items: {
487
+ type: string;
488
+ };
489
+ };
490
+ };
491
+ };
492
+ };
493
+ } | {
494
+ type: string;
495
+ items: {
496
+ type: string;
497
+ propertyNames: {
498
+ type: string;
499
+ };
500
+ additionalProperty: {
501
+ type: string;
502
+ };
503
+ required: string[];
504
+ properties: {
505
+ name: {
506
+ type: string;
507
+ };
508
+ type: {
509
+ type: string;
510
+ };
511
+ counters: {
512
+ type: string;
513
+ additionalProperties: boolean;
514
+ required: never[];
515
+ properties: {
516
+ include: {
517
+ type: string;
518
+ items: {
519
+ type: string;
520
+ };
521
+ };
522
+ exclude: {
523
+ type: string;
524
+ items: {
525
+ type: string;
526
+ };
527
+ };
528
+ };
529
+ };
530
+ };
531
+ };
532
+ })[];
533
+ };
378
534
  target: {
379
535
  type: string;
380
536
  enum: string[];
@@ -578,6 +734,84 @@ export declare const BannerCard: {
578
734
  };
579
735
  };
580
736
  };
737
+ analyticsEvents: {
738
+ anyOf: ({
739
+ type: string;
740
+ propertyNames: {
741
+ type: string;
742
+ };
743
+ additionalProperty: {
744
+ type: string;
745
+ };
746
+ required: string[];
747
+ properties: {
748
+ name: {
749
+ type: string;
750
+ };
751
+ type: {
752
+ type: string;
753
+ };
754
+ counters: {
755
+ type: string;
756
+ additionalProperties: boolean;
757
+ required: never[];
758
+ properties: {
759
+ include: {
760
+ type: string;
761
+ items: {
762
+ type: string;
763
+ };
764
+ };
765
+ exclude: {
766
+ type: string;
767
+ items: {
768
+ type: string;
769
+ };
770
+ };
771
+ };
772
+ };
773
+ };
774
+ } | {
775
+ type: string;
776
+ items: {
777
+ type: string;
778
+ propertyNames: {
779
+ type: string;
780
+ };
781
+ additionalProperty: {
782
+ type: string;
783
+ };
784
+ required: string[];
785
+ properties: {
786
+ name: {
787
+ type: string;
788
+ };
789
+ type: {
790
+ type: string;
791
+ };
792
+ counters: {
793
+ type: string;
794
+ additionalProperties: boolean;
795
+ required: never[];
796
+ properties: {
797
+ include: {
798
+ type: string;
799
+ items: {
800
+ type: string;
801
+ };
802
+ };
803
+ exclude: {
804
+ type: string;
805
+ items: {
806
+ type: string;
807
+ };
808
+ };
809
+ };
810
+ };
811
+ };
812
+ };
813
+ })[];
814
+ };
581
815
  target: {
582
816
  type: string;
583
817
  enum: string[];
@@ -426,6 +426,84 @@ export declare const MediaBlock: {
426
426
  };
427
427
  };
428
428
  };
429
+ analyticsEvents: {
430
+ anyOf: ({
431
+ type: string;
432
+ propertyNames: {
433
+ type: string;
434
+ };
435
+ additionalProperty: {
436
+ type: string;
437
+ };
438
+ required: string[];
439
+ properties: {
440
+ name: {
441
+ type: string;
442
+ };
443
+ type: {
444
+ type: string;
445
+ };
446
+ counters: {
447
+ type: string;
448
+ additionalProperties: boolean;
449
+ required: never[];
450
+ properties: {
451
+ include: {
452
+ type: string;
453
+ items: {
454
+ type: string;
455
+ };
456
+ };
457
+ exclude: {
458
+ type: string;
459
+ items: {
460
+ type: string;
461
+ };
462
+ };
463
+ };
464
+ };
465
+ };
466
+ } | {
467
+ type: string;
468
+ items: {
469
+ type: string;
470
+ propertyNames: {
471
+ type: string;
472
+ };
473
+ additionalProperty: {
474
+ type: string;
475
+ };
476
+ required: string[];
477
+ properties: {
478
+ name: {
479
+ type: string;
480
+ };
481
+ type: {
482
+ type: string;
483
+ };
484
+ counters: {
485
+ type: string;
486
+ additionalProperties: boolean;
487
+ required: never[];
488
+ properties: {
489
+ include: {
490
+ type: string;
491
+ items: {
492
+ type: string;
493
+ };
494
+ };
495
+ exclude: {
496
+ type: string;
497
+ items: {
498
+ type: string;
499
+ };
500
+ };
501
+ };
502
+ };
503
+ };
504
+ };
505
+ })[];
506
+ };
429
507
  target: {
430
508
  type: string;
431
509
  enum: string[];
@@ -5,20 +5,23 @@ import { block, setUrlTld } from '../../utils';
5
5
  import { toCommonSize, toCommonView } from './utils';
6
6
  import { LocaleContext } from '../../context/localeContext/localeContext';
7
7
  import { useMetrika } from '../../hooks/useMetrika';
8
+ import { useAnalytics } from '../../hooks';
8
9
  import { Github } from '../../icons';
9
10
  import './Button.css';
10
11
  const b = block('button-block');
11
12
  const Button = (props) => {
12
13
  const handleMetrika = useMetrika();
14
+ const handleAnalytics = useAnalytics();
13
15
  const { lang, tld } = useContext(LocaleContext);
14
- const { className, metrikaGoals, pixelEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text } = props, rest = __rest(props, ["className", "metrikaGoals", "pixelEvents", "size", "theme", "url", "img", "onClick", "text"]);
16
+ const { className, metrikaGoals, pixelEvents, analyticsEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text } = props, rest = __rest(props, ["className", "metrikaGoals", "pixelEvents", "analyticsEvents", "size", "theme", "url", "img", "onClick", "text"]);
15
17
  const defaultImgPosition = 'left';
16
18
  const onClick = useCallback(() => {
17
19
  handleMetrika({ metrikaGoals, pixelEvents });
20
+ handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
18
21
  if (onClickOrigin) {
19
22
  onClickOrigin();
20
23
  }
21
- }, [handleMetrika, metrikaGoals, pixelEvents, onClickOrigin]);
24
+ }, [handleMetrika, metrikaGoals, pixelEvents, handleAnalytics, analyticsEvents, onClickOrigin]);
22
25
  const buttonImg = img instanceof Object
23
26
  ? { url: img.url, position: img.position || defaultImgPosition, alt: img.alt }
24
27
  : { url: img, position: defaultImgPosition };
@@ -1,5 +1,6 @@
1
1
  import React, { ReactElement, HTMLAttributeAnchorTarget } from 'react';
2
2
  import { ButtonPixel, CardBaseProps as CardBaseParams, ImageProps, MetrikaGoal, WithChildren } from '../../models';
3
+ import { AnalyticsEventV2 } from '../../models/common';
3
4
  import './CardBase.css';
4
5
  export interface CardBaseProps extends CardBaseParams {
5
6
  className?: string;
@@ -10,6 +11,7 @@ export interface CardBaseProps extends CardBaseParams {
10
11
  target?: HTMLAttributeAnchorTarget;
11
12
  metrikaGoals?: MetrikaGoal;
12
13
  pixelEvents?: ButtonPixel;
14
+ analyticsEvents?: AnalyticsEventV2 | AnalyticsEventV2[];
13
15
  }
14
16
  export interface CardHeaderBaseProps {
15
17
  className?: string;
@@ -3,14 +3,16 @@ import { block } from '../../utils';
3
3
  import BackgroundImage from '../BackgroundImage/BackgroundImage';
4
4
  import RouterLink from '../RouterLink/RouterLink';
5
5
  import { useMetrika } from '../../hooks/useMetrika';
6
+ import { useAnalytics } from '../../hooks';
6
7
  import './CardBase.css';
7
8
  const b = block('card-base-block');
8
9
  const Header = () => null;
9
10
  const Content = () => null;
10
11
  const Footer = () => null;
11
12
  export const Layout = (props) => {
12
- const { className, bodyClassName, metrikaGoals, pixelEvents, contentClassName, children, url, target, border = 'shadow', } = props;
13
+ const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', } = props;
13
14
  const handleMetrika = useMetrika();
15
+ const handleAnalytics = useAnalytics();
14
16
  let header, content, footer, image, headerClass, footerClass;
15
17
  function handleChild(child) {
16
18
  switch (child.type) {
@@ -43,6 +45,7 @@ export const Layout = (props) => {
43
45
  const fullClassName = b({ border }, className);
44
46
  const onClick = () => {
45
47
  handleMetrika({ metrikaGoals, pixelEvents });
48
+ handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
46
49
  };
47
50
  return url ? (React.createElement(RouterLink, { href: url },
48
51
  React.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick }, cardContent))) : (React.createElement("div", { className: fullClassName }, cardContent));
@@ -1,13 +1,16 @@
1
1
  import React from 'react';
2
2
  import { block } from '../../utils';
3
3
  import { useMetrika } from '../../hooks/useMetrika';
4
+ import { useAnalytics } from '../../hooks';
4
5
  import './HeaderBreadcrumbs.css';
5
6
  const b = block('header-breadcrumbs');
6
7
  export default function HeaderBreadcrumbs(props) {
7
- const { items, metrikaGoals, pixelEvents, theme = 'light', className } = props;
8
+ const { items, metrikaGoals, pixelEvents, analyticsEvents, theme = 'light', className } = props;
8
9
  const handleMetrika = useMetrika();
10
+ const handleAnalytics = useAnalytics();
9
11
  const onClick = () => {
10
12
  handleMetrika({ metrikaGoals, pixelEvents });
13
+ handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
11
14
  };
12
15
  return (React.createElement("div", { className: b({ theme }, className) }, items.map((item) => (React.createElement("div", { className: b('item'), key: item.url },
13
16
  React.createElement("a", { href: item.url, className: b('text'), onClick: onClick }, item.text))))));
@@ -7,6 +7,7 @@ import BackLink from '../BackLink/BackLink';
7
7
  import { LocaleContext } from '../../context/localeContext/localeContext';
8
8
  import { LocationContext } from '../../context/locationContext/locationContext';
9
9
  import { useMetrika } from '../../hooks/useMetrika';
10
+ import { useAnalytics } from '../../hooks';
10
11
  import './Link.css';
11
12
  const b = block('link-block');
12
13
  const WORD_JOINER_SYM = '\u200b';
@@ -23,14 +24,16 @@ function getArrowSize(size) {
23
24
  }
24
25
  }
25
26
  const LinkBlock = (props) => {
26
- const { text, url, arrow, metrikaGoals, pixelEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, } = props;
27
+ const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, } = props;
27
28
  const handleMetrika = useMetrika();
29
+ const handleAnalytics = useAnalytics();
28
30
  const { hostname } = useContext(LocationContext);
29
31
  const { tld } = useContext(LocaleContext);
30
32
  const href = setUrlTld(props.url, tld);
31
33
  const defaultTextSize = theme === 'back' ? 'l' : 'm';
32
34
  const onClick = () => {
33
35
  handleMetrika({ metrikaGoals, pixelEvents });
36
+ handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
34
37
  };
35
38
  const getLinkByType = () => {
36
39
  switch (theme) {
@@ -7,7 +7,7 @@ import YoutubeBlock from '../VideoBlock/VideoBlock';
7
7
  import './Media.css';
8
8
  const b = block('Media');
9
9
  export const Media = (props) => {
10
- const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, } = props;
10
+ const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, analyticsEvents, } = props;
11
11
  const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, } = props;
12
12
  const [hasVideoFallback, setHasVideoFallback] = useState(false);
13
13
  const content = useMemo(() => {
@@ -16,7 +16,7 @@ export const Media = (props) => {
16
16
  result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback }));
17
17
  }
18
18
  if (video) {
19
- result.push(React.createElement(Video, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika, playVideo: playVideo, previewImg: previewImg, playButton: playButton, customBarControlsClassName: customBarControlsClassName, hasVideoFallback: hasVideoFallback, setHasVideoFallback: setHasVideoFallback }));
19
+ result.push(React.createElement(Video, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika, analyticsEvents: analyticsEvents, playVideo: playVideo, previewImg: previewImg, playButton: playButton, customBarControlsClassName: customBarControlsClassName, hasVideoFallback: hasVideoFallback, setHasVideoFallback: setHasVideoFallback }));
20
20
  }
21
21
  if (youtube) {
22
22
  result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height }));
@@ -37,6 +37,7 @@ export const Media = (props) => {
37
37
  hasVideoFallback,
38
38
  videoClassName,
39
39
  metrika,
40
+ analyticsEvents,
40
41
  playVideo,
41
42
  previewImg,
42
43
  playButton,
@@ -6,7 +6,7 @@ import { block } from '../../../utils';
6
6
  import './Video.css';
7
7
  const b = block('media-component-video');
8
8
  const Video = (props) => {
9
- const { video, height, metrika, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, } = props;
9
+ const { video, height, metrika, analyticsEvents, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, } = props;
10
10
  const ref = useRef(null);
11
11
  useEffect(() => {
12
12
  if (ref && ref.current) {
@@ -29,16 +29,17 @@ const Video = (props) => {
29
29
  }, [playVideo, video, setHasVideoFallback]);
30
30
  const reactPlayerBlock = useMemo(() => {
31
31
  const { src, loop, controls, muted, autoplay = true, elapsedTime, playButton } = video;
32
- return (React.createElement(ReactPlayerBlock, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika, height: height }));
32
+ return (React.createElement(ReactPlayerBlock, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika, analyticsEvents: analyticsEvents, height: height }));
33
33
  }, [
34
34
  video,
35
- height,
36
35
  videoClassName,
37
36
  previewImg,
38
37
  playVideo,
39
38
  commonPlayButton,
40
39
  customBarControlsClassName,
41
40
  metrika,
41
+ analyticsEvents,
42
+ height,
42
43
  ]);
43
44
  const defaultVideoBlock = useMemo(() => {
44
45
  return video.src.length && !hasVideoFallback ? (React.createElement("div", { className: b('wrap', videoClassName), style: { height } },