@gravity-ui/page-constructor 1.19.1 → 1.20.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 (135) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +79 -6
  3. package/build/cjs/blocks/Banner/schema.d.ts +234 -0
  4. package/build/cjs/blocks/CardLayout/schema.d.ts +6 -0
  5. package/build/cjs/blocks/ContentLayout/schema.d.ts +3 -0
  6. package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +81 -0
  7. package/build/cjs/blocks/Header/schema.d.ts +3 -0
  8. package/build/cjs/blocks/HeaderSlider/schema.d.ts +3 -0
  9. package/build/cjs/blocks/Icons/schema.d.ts +6 -0
  10. package/build/cjs/blocks/LinkTable/schema.d.ts +3 -0
  11. package/build/cjs/blocks/Map/schema.d.ts +81 -0
  12. package/build/cjs/blocks/Media/schema.d.ts +162 -0
  13. package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
  14. package/build/cjs/blocks/Questions/schema.d.ts +3 -0
  15. package/build/cjs/blocks/Share/Share.js +5 -1
  16. package/build/cjs/blocks/Simple/schema.d.ts +3 -0
  17. package/build/cjs/blocks/Slider/schema.d.ts +3 -0
  18. package/build/cjs/blocks/Table/schema.d.ts +3 -0
  19. package/build/cjs/blocks/Tabs/schema.d.ts +81 -0
  20. package/build/cjs/components/BackLink/BackLink.js +5 -1
  21. package/build/cjs/components/Button/Button.js +6 -2
  22. package/build/cjs/components/CardBase/CardBase.d.ts +2 -1
  23. package/build/cjs/components/CardBase/CardBase.js +5 -1
  24. package/build/cjs/components/Link/Link.js +5 -1
  25. package/build/cjs/components/Media/Media.js +3 -2
  26. package/build/cjs/components/Media/Video/Video.js +3 -2
  27. package/build/cjs/components/ReactPlayer/ReactPlayer.js +16 -3
  28. package/build/cjs/components/YandexForm/YandexForm.d.ts +2 -1
  29. package/build/cjs/components/YandexForm/YandexForm.js +14 -2
  30. package/build/cjs/containers/PageConstructor/Provider.d.ts +2 -0
  31. package/build/cjs/containers/PageConstructor/Provider.js +3 -1
  32. package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +7 -4
  33. package/build/cjs/context/analyticsContext/analyticsContext.d.ts +7 -0
  34. package/build/cjs/context/analyticsContext/analyticsContext.js +6 -0
  35. package/build/cjs/context/analyticsContext/index.d.ts +1 -0
  36. package/build/cjs/context/analyticsContext/index.js +4 -0
  37. package/build/cjs/context/blockIdContext/blockIdContext.d.ts +3 -0
  38. package/build/cjs/context/blockIdContext/blockIdContext.js +6 -0
  39. package/build/cjs/context/blockIdContext/index.d.ts +1 -0
  40. package/build/cjs/context/blockIdContext/index.js +4 -0
  41. package/build/cjs/context/metrikaContext/metrikaContext.d.ts +6 -0
  42. package/build/cjs/hooks/index.d.ts +1 -0
  43. package/build/cjs/hooks/index.js +1 -0
  44. package/build/cjs/hooks/useAnalytics.d.ts +2 -0
  45. package/build/cjs/hooks/useAnalytics.js +35 -0
  46. package/build/cjs/hooks/useMetrika.d.ts +6 -0
  47. package/build/cjs/hooks/useMetrika.js +8 -0
  48. package/build/cjs/models/common.d.ts +45 -0
  49. package/build/cjs/models/common.js +22 -1
  50. package/build/cjs/models/constructor-items/common.d.ts +5 -5
  51. package/build/cjs/models/constructor-items/sub-blocks.d.ts +2 -2
  52. package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +5 -1
  53. package/build/cjs/navigation/components/NavigationItem/components/NavigationButton/NavigationButton.js +4 -2
  54. package/build/cjs/schema/validators/common.d.ts +249 -0
  55. package/build/cjs/schema/validators/common.js +14 -0
  56. package/build/cjs/schema/validators/event.d.ts +37 -0
  57. package/build/cjs/schema/validators/event.js +38 -0
  58. package/build/cjs/sub-blocks/HubspotForm/index.js +15 -2
  59. package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +13 -0
  60. package/build/cjs/sub-blocks/Quote/Quote.js +4 -1
  61. package/build/cjs/utils/analytics.d.ts +2 -0
  62. package/build/cjs/utils/analytics.js +17 -0
  63. package/build/cjs/utils/index.d.ts +1 -0
  64. package/build/cjs/utils/index.js +1 -0
  65. package/build/esm/blocks/Banner/schema.d.ts +234 -0
  66. package/build/esm/blocks/CardLayout/schema.d.ts +6 -0
  67. package/build/esm/blocks/ContentLayout/schema.d.ts +3 -0
  68. package/build/esm/blocks/ExtendedFeatures/schema.d.ts +81 -0
  69. package/build/esm/blocks/Header/schema.d.ts +3 -0
  70. package/build/esm/blocks/HeaderSlider/schema.d.ts +3 -0
  71. package/build/esm/blocks/Icons/schema.d.ts +6 -0
  72. package/build/esm/blocks/LinkTable/schema.d.ts +3 -0
  73. package/build/esm/blocks/Map/schema.d.ts +81 -0
  74. package/build/esm/blocks/Media/schema.d.ts +162 -0
  75. package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
  76. package/build/esm/blocks/Questions/schema.d.ts +3 -0
  77. package/build/esm/blocks/Share/Share.js +6 -2
  78. package/build/esm/blocks/Simple/schema.d.ts +3 -0
  79. package/build/esm/blocks/Slider/schema.d.ts +3 -0
  80. package/build/esm/blocks/Table/schema.d.ts +3 -0
  81. package/build/esm/blocks/Tabs/schema.d.ts +81 -0
  82. package/build/esm/components/BackLink/BackLink.js +5 -1
  83. package/build/esm/components/Button/Button.js +6 -2
  84. package/build/esm/components/CardBase/CardBase.d.ts +2 -1
  85. package/build/esm/components/CardBase/CardBase.js +5 -1
  86. package/build/esm/components/Link/Link.js +5 -1
  87. package/build/esm/components/Media/Media.js +3 -2
  88. package/build/esm/components/Media/Video/Video.js +3 -2
  89. package/build/esm/components/ReactPlayer/ReactPlayer.js +17 -4
  90. package/build/esm/components/YandexForm/YandexForm.d.ts +2 -1
  91. package/build/esm/components/YandexForm/YandexForm.js +14 -2
  92. package/build/esm/containers/PageConstructor/Provider.d.ts +2 -0
  93. package/build/esm/containers/PageConstructor/Provider.js +3 -1
  94. package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +7 -4
  95. package/build/esm/context/analyticsContext/analyticsContext.d.ts +7 -0
  96. package/build/esm/context/analyticsContext/analyticsContext.js +2 -0
  97. package/build/esm/context/analyticsContext/index.d.ts +1 -0
  98. package/build/esm/context/analyticsContext/index.js +1 -0
  99. package/build/esm/context/blockIdContext/blockIdContext.d.ts +3 -0
  100. package/build/esm/context/blockIdContext/blockIdContext.js +2 -0
  101. package/build/esm/context/blockIdContext/index.d.ts +1 -0
  102. package/build/esm/context/blockIdContext/index.js +1 -0
  103. package/build/esm/context/metrikaContext/metrikaContext.d.ts +6 -0
  104. package/build/esm/hooks/index.d.ts +1 -0
  105. package/build/esm/hooks/index.js +1 -0
  106. package/build/esm/hooks/useAnalytics.d.ts +2 -0
  107. package/build/esm/hooks/useAnalytics.js +31 -0
  108. package/build/esm/hooks/useMetrika.d.ts +6 -0
  109. package/build/esm/hooks/useMetrika.js +8 -0
  110. package/build/esm/models/common.d.ts +45 -0
  111. package/build/esm/models/common.js +21 -0
  112. package/build/esm/models/constructor-items/common.d.ts +5 -5
  113. package/build/esm/models/constructor-items/sub-blocks.d.ts +2 -2
  114. package/build/esm/navigation/components/NavigationItem/NavigationItem.js +5 -1
  115. package/build/esm/navigation/components/NavigationItem/components/NavigationButton/NavigationButton.js +4 -2
  116. package/build/esm/schema/validators/common.d.ts +249 -0
  117. package/build/esm/schema/validators/common.js +14 -0
  118. package/build/esm/schema/validators/event.d.ts +37 -0
  119. package/build/esm/schema/validators/event.js +35 -0
  120. package/build/esm/sub-blocks/HubspotForm/index.js +16 -3
  121. package/build/esm/sub-blocks/LayoutItem/utils.d.ts +13 -0
  122. package/build/esm/sub-blocks/Quote/Quote.js +6 -3
  123. package/build/esm/utils/analytics.d.ts +2 -0
  124. package/build/esm/utils/analytics.js +13 -0
  125. package/build/esm/utils/index.d.ts +1 -0
  126. package/build/esm/utils/index.js +1 -0
  127. package/package.json +1 -1
  128. package/server/models/common.d.ts +45 -0
  129. package/server/models/common.js +22 -1
  130. package/server/models/constructor-items/common.d.ts +5 -5
  131. package/server/models/constructor-items/sub-blocks.d.ts +2 -2
  132. package/server/utils/analytics.d.ts +2 -0
  133. package/server/utils/analytics.js +17 -0
  134. package/server/utils/index.d.ts +1 -0
  135. package/server/utils/index.js +1 -0
@@ -318,6 +318,84 @@ export declare const LinkProps: {
318
318
  type: string;
319
319
  enum: string[];
320
320
  };
321
+ analyticsEvents: {
322
+ anyOf: ({
323
+ type: string;
324
+ additionalProperties: {
325
+ type: string;
326
+ };
327
+ required: string[];
328
+ properties: {
329
+ name: {
330
+ type: string;
331
+ };
332
+ type: {
333
+ type: string;
334
+ };
335
+ counters: {
336
+ type: string;
337
+ additionalProperties: boolean;
338
+ required: never[];
339
+ properties: {
340
+ include: {
341
+ type: string;
342
+ items: {
343
+ type: string;
344
+ };
345
+ };
346
+ exclude: {
347
+ type: string;
348
+ items: {
349
+ type: string;
350
+ };
351
+ };
352
+ };
353
+ };
354
+ context: {
355
+ type: string;
356
+ };
357
+ };
358
+ } | {
359
+ type: string;
360
+ items: {
361
+ type: string;
362
+ additionalProperties: {
363
+ type: string;
364
+ };
365
+ required: string[];
366
+ properties: {
367
+ name: {
368
+ type: string;
369
+ };
370
+ type: {
371
+ type: string;
372
+ };
373
+ counters: {
374
+ type: string;
375
+ additionalProperties: boolean;
376
+ required: never[];
377
+ properties: {
378
+ include: {
379
+ type: string;
380
+ items: {
381
+ type: string;
382
+ };
383
+ };
384
+ exclude: {
385
+ type: string;
386
+ items: {
387
+ type: string;
388
+ };
389
+ };
390
+ };
391
+ };
392
+ context: {
393
+ type: string;
394
+ };
395
+ };
396
+ };
397
+ })[];
398
+ };
321
399
  type: {};
322
400
  when: {};
323
401
  };
@@ -414,6 +492,9 @@ export declare const ButtonProps: {
414
492
  };
415
493
  })[];
416
494
  };
495
+ /**
496
+ * @deprecated Metrika will be deleted
497
+ */
417
498
  metrikaGoals: {
418
499
  anyOf: ({
419
500
  type: string;
@@ -443,6 +524,9 @@ export declare const ButtonProps: {
443
524
  };
444
525
  })[];
445
526
  };
527
+ /**
528
+ * @deprecated Pixel will be deleted
529
+ */
446
530
  pixelEvents: {
447
531
  type: string;
448
532
  items: {
@@ -499,6 +583,84 @@ export declare const ButtonProps: {
499
583
  };
500
584
  };
501
585
  };
586
+ analyticsEvents: {
587
+ anyOf: ({
588
+ type: string;
589
+ additionalProperties: {
590
+ type: string;
591
+ };
592
+ required: string[];
593
+ properties: {
594
+ name: {
595
+ type: string;
596
+ };
597
+ type: {
598
+ type: string;
599
+ };
600
+ counters: {
601
+ type: string;
602
+ additionalProperties: boolean;
603
+ required: never[];
604
+ properties: {
605
+ include: {
606
+ type: string;
607
+ items: {
608
+ type: string;
609
+ };
610
+ };
611
+ exclude: {
612
+ type: string;
613
+ items: {
614
+ type: string;
615
+ };
616
+ };
617
+ };
618
+ };
619
+ context: {
620
+ type: string;
621
+ };
622
+ };
623
+ } | {
624
+ type: string;
625
+ items: {
626
+ type: string;
627
+ additionalProperties: {
628
+ type: string;
629
+ };
630
+ required: string[];
631
+ properties: {
632
+ name: {
633
+ type: string;
634
+ };
635
+ type: {
636
+ type: string;
637
+ };
638
+ counters: {
639
+ type: string;
640
+ additionalProperties: boolean;
641
+ required: never[];
642
+ properties: {
643
+ include: {
644
+ type: string;
645
+ items: {
646
+ type: string;
647
+ };
648
+ };
649
+ exclude: {
650
+ type: string;
651
+ items: {
652
+ type: string;
653
+ };
654
+ };
655
+ };
656
+ };
657
+ context: {
658
+ type: string;
659
+ };
660
+ };
661
+ };
662
+ })[];
663
+ };
502
664
  target: {
503
665
  type: string;
504
666
  enum: string[];
@@ -558,6 +720,9 @@ export declare const BlockBaseProps: {
558
720
  resetPaddings: {
559
721
  type: string;
560
722
  };
723
+ context: {
724
+ type: string;
725
+ };
561
726
  type: {};
562
727
  when: {};
563
728
  };
@@ -629,6 +794,9 @@ export declare const ButtonBlock: {
629
794
  };
630
795
  })[];
631
796
  };
797
+ /**
798
+ * @deprecated Metrika will be deleted
799
+ */
632
800
  metrikaGoals: {
633
801
  anyOf: ({
634
802
  type: string;
@@ -658,6 +826,9 @@ export declare const ButtonBlock: {
658
826
  };
659
827
  })[];
660
828
  };
829
+ /**
830
+ * @deprecated Pixel will be deleted
831
+ */
661
832
  pixelEvents: {
662
833
  type: string;
663
834
  items: {
@@ -714,6 +885,84 @@ export declare const ButtonBlock: {
714
885
  };
715
886
  };
716
887
  };
888
+ analyticsEvents: {
889
+ anyOf: ({
890
+ type: string;
891
+ additionalProperties: {
892
+ type: string;
893
+ };
894
+ required: string[];
895
+ properties: {
896
+ name: {
897
+ type: string;
898
+ };
899
+ type: {
900
+ type: string;
901
+ };
902
+ counters: {
903
+ type: string;
904
+ additionalProperties: boolean;
905
+ required: never[];
906
+ properties: {
907
+ include: {
908
+ type: string;
909
+ items: {
910
+ type: string;
911
+ };
912
+ };
913
+ exclude: {
914
+ type: string;
915
+ items: {
916
+ type: string;
917
+ };
918
+ };
919
+ };
920
+ };
921
+ context: {
922
+ type: string;
923
+ };
924
+ };
925
+ } | {
926
+ type: string;
927
+ items: {
928
+ type: string;
929
+ additionalProperties: {
930
+ type: string;
931
+ };
932
+ required: string[];
933
+ properties: {
934
+ name: {
935
+ type: string;
936
+ };
937
+ type: {
938
+ type: string;
939
+ };
940
+ counters: {
941
+ type: string;
942
+ additionalProperties: boolean;
943
+ required: never[];
944
+ properties: {
945
+ include: {
946
+ type: string;
947
+ items: {
948
+ type: string;
949
+ };
950
+ };
951
+ exclude: {
952
+ type: string;
953
+ items: {
954
+ type: string;
955
+ };
956
+ };
957
+ };
958
+ };
959
+ context: {
960
+ type: string;
961
+ };
962
+ };
963
+ };
964
+ })[];
965
+ };
717
966
  target: {
718
967
  type: string;
719
968
  enum: string[];
@@ -4,6 +4,7 @@ exports.BlockHeaderProps = exports.CardBase = exports.MapProps = exports.YMapMar
4
4
  const pixel_1 = require("./pixel");
5
5
  const models_1 = require("../../models");
6
6
  const schema_1 = require("../../components/Image/schema");
7
+ const event_1 = require("./event");
7
8
  exports.mediaDirection = ['media-content', 'content-media'];
8
9
  exports.textSize = ['s', 'm', 'l'];
9
10
  exports.containerSizesArray = ['sm', 'md', 'lg', 'xl', 'all'];
@@ -177,6 +178,8 @@ exports.LinkProps = {
177
178
  }, target: {
178
179
  type: 'string',
179
180
  enum: ['_blank', '_parent', '_top', '_self'],
181
+ }, analyticsEvents: {
182
+ anyOf: [event_1.AnalyticsEventSchema, { type: 'array', items: event_1.AnalyticsEventSchema }],
180
183
  } }),
181
184
  };
182
185
  exports.FileLinkProps = {
@@ -309,6 +312,9 @@ exports.ButtonProps = {
309
312
  },
310
313
  ],
311
314
  },
315
+ /**
316
+ * @deprecated Metrika will be deleted
317
+ */
312
318
  metrikaGoals: {
313
319
  anyOf: [
314
320
  { type: 'string' },
@@ -331,7 +337,13 @@ exports.ButtonProps = {
331
337
  },
332
338
  ],
333
339
  },
340
+ /**
341
+ * @deprecated Pixel will be deleted
342
+ */
334
343
  pixelEvents: pixel_1.pixelEvents,
344
+ analyticsEvents: {
345
+ anyOf: [event_1.AnalyticsEventSchema, { type: 'array', items: event_1.AnalyticsEventSchema }],
346
+ },
335
347
  target: {
336
348
  type: 'string',
337
349
  enum: ['_self', '_blank', '_parent', '_top'],
@@ -380,6 +392,8 @@ exports.BlockBaseProps = Object.assign(Object.assign({}, exports.BaseProps), { a
380
392
  enum: exports.containerSizesArray,
381
393
  }, resetPaddings: {
382
394
  type: 'boolean',
395
+ }, context: {
396
+ type: 'string',
383
397
  } });
384
398
  exports.TitleProps = {
385
399
  type: 'object',
@@ -0,0 +1,37 @@
1
+ export declare const AnalyticsEventSchema: {
2
+ type: string;
3
+ additionalProperties: {
4
+ type: string;
5
+ };
6
+ required: string[];
7
+ properties: {
8
+ name: {
9
+ type: string;
10
+ };
11
+ type: {
12
+ type: string;
13
+ };
14
+ counters: {
15
+ type: string;
16
+ additionalProperties: boolean;
17
+ required: never[];
18
+ properties: {
19
+ include: {
20
+ type: string;
21
+ items: {
22
+ type: string;
23
+ };
24
+ };
25
+ exclude: {
26
+ type: string;
27
+ items: {
28
+ type: string;
29
+ };
30
+ };
31
+ };
32
+ };
33
+ context: {
34
+ type: string;
35
+ };
36
+ };
37
+ };
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AnalyticsEventSchema = void 0;
4
+ exports.AnalyticsEventSchema = {
5
+ type: 'object',
6
+ additionalProperties: { type: 'string' },
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
+ context: {
35
+ type: 'string',
36
+ },
37
+ },
38
+ };
@@ -6,14 +6,16 @@ const utils_1 = require("../../utils");
6
6
  const ThemeValueContext_1 = require("../../context/theme/ThemeValueContext");
7
7
  const mobileContext_1 = require("../../context/mobileContext");
8
8
  const useMetrika_1 = require("../../hooks/useMetrika");
9
+ const models_1 = require("../../models");
9
10
  const hooks_1 = require("../../hooks");
10
11
  const HubspotFormContainer_1 = tslib_1.__importDefault(require("./HubspotFormContainer"));
11
12
  const b = (0, utils_1.block)('hubspot-form');
12
13
  const HubspotForm = (props) => {
13
14
  const { className, theme: themeProp, isMobile: isMobileProp, formId, formInstanceId, portalId, region, formClassName, pixelEvents,
14
15
  // hubspotEvents, // TODO: decide how to handle them
15
- onBeforeSubmit, onSubmit, onBeforeLoad, onLoad, createDOMElement, onSubmitError, } = props;
16
+ analyticsEvents, onBeforeSubmit, onSubmit, onBeforeLoad, onLoad, createDOMElement, onSubmitError, } = props;
16
17
  const handleMetrika = (0, useMetrika_1.useMetrika)();
18
+ const handleAnalytics = (0, hooks_1.useAnalytics)(models_1.DefaultEventNames.HubspotFormSubmit);
17
19
  const { themeValue } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
18
20
  const isMobileValue = (0, react_1.useContext)(mobileContext_1.MobileContext);
19
21
  const theme = themeProp !== null && themeProp !== void 0 ? themeProp : themeValue;
@@ -25,9 +27,20 @@ const HubspotForm = (props) => {
25
27
  onSubmitError,
26
28
  onSubmit: (e) => {
27
29
  handleMetrika === null || handleMetrika === void 0 ? void 0 : handleMetrika({ pixelEvents });
30
+ handleAnalytics(analyticsEvents);
28
31
  onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(e);
29
32
  },
30
- }), [onBeforeLoad, onBeforeSubmit, onLoad, handleMetrika, pixelEvents, onSubmit, onSubmitError]);
33
+ }), [
34
+ onBeforeLoad,
35
+ onBeforeSubmit,
36
+ onLoad,
37
+ handleMetrika,
38
+ pixelEvents,
39
+ handleAnalytics,
40
+ analyticsEvents,
41
+ onSubmit,
42
+ onSubmitError,
43
+ ]);
31
44
  (0, hooks_1.useHandleHubspotEvents)(handlers, formId);
32
45
  return (react_1.default.createElement(HubspotFormContainer_1.default, { createDOMElement: createDOMElement, key: [formClassName, formId, formInstanceId, portalId, region].join(), className: b({ theme, mobile }, className), formClassName: formClassName, formId: formId, portalId: portalId, formInstanceId: formInstanceId, region: region }));
33
46
  };
@@ -9,6 +9,19 @@ export declare const getLayoutItemLinks: (links: LayoutItemProps['content']['lin
9
9
  target?: string | undefined;
10
10
  metrikaGoals?: import("../../models").MetrikaGoal | undefined;
11
11
  pixelEvents?: import("../../models").ButtonPixel | undefined;
12
+ analyticsEvents?: {
13
+ name: string;
14
+ type?: string | undefined;
15
+ counters?: import("../../models").AnalyticsCounters | undefined;
16
+ context?: string | undefined;
17
+ target?: string | undefined;
18
+ } | {
19
+ name: string;
20
+ type?: string | undefined;
21
+ counters?: import("../../models").AnalyticsCounters | undefined;
22
+ context?: string | undefined;
23
+ target?: string | undefined;
24
+ }[] | undefined;
12
25
  className?: string | undefined;
13
26
  }[] | undefined;
14
27
  export declare const hasFullScreen: ({ dataLens, image }: MediaProps) => boolean;
@@ -8,15 +8,18 @@ const models_1 = require("../../models");
8
8
  const components_1 = require("../../components");
9
9
  const ThemeValueContext_1 = require("../../context/theme/ThemeValueContext");
10
10
  const utils_2 = require("../../components/Media/Image/utils");
11
+ const hooks_1 = require("../../hooks");
11
12
  const b = (0, utils_1.block)('quote');
12
13
  const Quote = (props) => {
13
14
  const { theme: textTheme = 'light', color, image, border = 'shadow', text, logo, author, url, buttonText, } = props;
14
15
  const { themeValue: theme } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
15
16
  const imageThemed = (0, utils_1.getThemedValue)(image, theme);
16
17
  const imageData = (0, utils_2.getMediaImage)(imageThemed);
18
+ const handleAnalytics = (0, hooks_1.useAnalytics)(models_1.DefaultEventNames.QuoteButton, url);
19
+ const handleButtonClick = (0, react_1.useCallback)(() => handleAnalytics(), [handleAnalytics]);
17
20
  const renderFooter = Boolean(author || url) && (react_1.default.createElement("div", { className: b('author-wrapper') },
18
21
  author && (react_1.default.createElement(components_1.Author, { className: b('author', { theme: textTheme }), author: author, type: models_1.AuthorType.Line })),
19
- url && buttonText && (react_1.default.createElement(uikit_1.Button, { view: "outlined", size: "xl", href: url, className: b('link-button', { theme: textTheme }) }, buttonText))));
22
+ url && buttonText && (react_1.default.createElement(uikit_1.Button, { view: "outlined", size: "xl", href: url, className: b('link-button', { theme: textTheme }), onClick: handleButtonClick }, buttonText))));
20
23
  return (react_1.default.createElement("div", { className: b({ theme: textTheme, border }), style: color ? { backgroundColor: color } : {} },
21
24
  react_1.default.createElement("div", { key: text, className: b('content-wrapper') },
22
25
  react_1.default.createElement("div", null,
@@ -0,0 +1,2 @@
1
+ import { AnalyticsCounters } from '../models';
2
+ export declare const isCounterAllowed: (counter: string, counters?: AnalyticsCounters) => boolean;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isCounterAllowed = void 0;
4
+ const isCounterAllowed = (counter, counters) => {
5
+ var _a, _b;
6
+ if (!counters) {
7
+ return true;
8
+ }
9
+ if ((_a = counters.exclude) === null || _a === void 0 ? void 0 : _a.includes(counter)) {
10
+ return false;
11
+ }
12
+ else if ((_b = counters.include) === null || _b === void 0 ? void 0 : _b.includes(counter)) {
13
+ return true;
14
+ }
15
+ return false;
16
+ };
17
+ exports.isCounterAllowed = isCounterAllowed;
@@ -1,4 +1,5 @@
1
1
  export * from './common';
2
+ export * from './analytics';
2
3
  export * from './blocks';
3
4
  export * from './scroll';
4
5
  export * from './url';
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isHubspotEventData = exports.configure = exports.Lang = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  tslib_1.__exportStar(require("./common"), exports);
6
+ tslib_1.__exportStar(require("./analytics"), exports);
6
7
  tslib_1.__exportStar(require("./blocks"), exports);
7
8
  tslib_1.__exportStar(require("./scroll"), exports);
8
9
  tslib_1.__exportStar(require("./url"), exports);