@gravity-ui/page-constructor 1.19.0 → 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 +14 -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 +129 -34
  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 +309 -43
  55. package/build/cjs/schema/validators/common.js +39 -18
  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 +129 -34
  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 +309 -43
  117. package/build/esm/schema/validators/common.js +39 -18
  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
@@ -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);
@@ -173,6 +173,84 @@ export declare const BannerCardProps: {
173
173
  };
174
174
  };
175
175
  };
176
+ analyticsEvents: {
177
+ anyOf: ({
178
+ type: string;
179
+ additionalProperties: {
180
+ type: string;
181
+ };
182
+ required: string[];
183
+ properties: {
184
+ name: {
185
+ type: string;
186
+ };
187
+ type: {
188
+ type: string;
189
+ };
190
+ counters: {
191
+ type: string;
192
+ additionalProperties: boolean;
193
+ required: never[];
194
+ properties: {
195
+ include: {
196
+ type: string;
197
+ items: {
198
+ type: string;
199
+ };
200
+ };
201
+ exclude: {
202
+ type: string;
203
+ items: {
204
+ type: string;
205
+ };
206
+ };
207
+ };
208
+ };
209
+ context: {
210
+ type: string;
211
+ };
212
+ };
213
+ } | {
214
+ type: string;
215
+ items: {
216
+ type: string;
217
+ additionalProperties: {
218
+ type: string;
219
+ };
220
+ required: string[];
221
+ properties: {
222
+ name: {
223
+ type: string;
224
+ };
225
+ type: {
226
+ type: string;
227
+ };
228
+ counters: {
229
+ type: string;
230
+ additionalProperties: boolean;
231
+ required: never[];
232
+ properties: {
233
+ include: {
234
+ type: string;
235
+ items: {
236
+ type: string;
237
+ };
238
+ };
239
+ exclude: {
240
+ type: string;
241
+ items: {
242
+ type: string;
243
+ };
244
+ };
245
+ };
246
+ };
247
+ context: {
248
+ type: string;
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
+ additionalProperties: {
460
+ type: string;
461
+ };
462
+ required: string[];
463
+ properties: {
464
+ name: {
465
+ type: string;
466
+ };
467
+ type: {
468
+ type: string;
469
+ };
470
+ counters: {
471
+ type: string;
472
+ additionalProperties: boolean;
473
+ required: never[];
474
+ properties: {
475
+ include: {
476
+ type: string;
477
+ items: {
478
+ type: string;
479
+ };
480
+ };
481
+ exclude: {
482
+ type: string;
483
+ items: {
484
+ type: string;
485
+ };
486
+ };
487
+ };
488
+ };
489
+ context: {
490
+ type: string;
491
+ };
492
+ };
493
+ } | {
494
+ type: string;
495
+ items: {
496
+ type: string;
497
+ additionalProperties: {
498
+ type: string;
499
+ };
500
+ required: string[];
501
+ properties: {
502
+ name: {
503
+ type: string;
504
+ };
505
+ type: {
506
+ type: string;
507
+ };
508
+ counters: {
509
+ type: string;
510
+ additionalProperties: boolean;
511
+ required: never[];
512
+ properties: {
513
+ include: {
514
+ type: string;
515
+ items: {
516
+ type: string;
517
+ };
518
+ };
519
+ exclude: {
520
+ type: string;
521
+ items: {
522
+ type: string;
523
+ };
524
+ };
525
+ };
526
+ };
527
+ context: {
528
+ type: string;
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
+ additionalProperties: {
741
+ type: string;
742
+ };
743
+ required: string[];
744
+ properties: {
745
+ name: {
746
+ type: string;
747
+ };
748
+ type: {
749
+ type: string;
750
+ };
751
+ counters: {
752
+ type: string;
753
+ additionalProperties: boolean;
754
+ required: never[];
755
+ properties: {
756
+ include: {
757
+ type: string;
758
+ items: {
759
+ type: string;
760
+ };
761
+ };
762
+ exclude: {
763
+ type: string;
764
+ items: {
765
+ type: string;
766
+ };
767
+ };
768
+ };
769
+ };
770
+ context: {
771
+ type: string;
772
+ };
773
+ };
774
+ } | {
775
+ type: string;
776
+ items: {
777
+ type: string;
778
+ additionalProperties: {
779
+ type: string;
780
+ };
781
+ required: string[];
782
+ properties: {
783
+ name: {
784
+ type: string;
785
+ };
786
+ type: {
787
+ type: string;
788
+ };
789
+ counters: {
790
+ type: string;
791
+ additionalProperties: boolean;
792
+ required: never[];
793
+ properties: {
794
+ include: {
795
+ type: string;
796
+ items: {
797
+ type: string;
798
+ };
799
+ };
800
+ exclude: {
801
+ type: string;
802
+ items: {
803
+ type: string;
804
+ };
805
+ };
806
+ };
807
+ };
808
+ context: {
809
+ type: string;
810
+ };
811
+ };
812
+ };
813
+ })[];
814
+ };
581
815
  target: {
582
816
  type: string;
583
817
  enum: string[];
@@ -66,6 +66,9 @@ export declare const CardLayoutProps: {
66
66
  resetPaddings: {
67
67
  type: string;
68
68
  };
69
+ context: {
70
+ type: string;
71
+ };
69
72
  type: {};
70
73
  when: {};
71
74
  };
@@ -139,6 +142,9 @@ export declare const CardLayoutBlock: {
139
142
  resetPaddings: {
140
143
  type: string;
141
144
  };
145
+ context: {
146
+ type: string;
147
+ };
142
148
  type: {};
143
149
  when: {};
144
150
  };
@@ -144,6 +144,9 @@ export declare const ContentLayoutBlock: {
144
144
  resetPaddings: {
145
145
  type: string;
146
146
  };
147
+ context: {
148
+ type: string;
149
+ };
147
150
  type: {};
148
151
  when: {};
149
152
  };
@@ -41,6 +41,84 @@ export declare const ExtendedFeaturesItem: {
41
41
  type: string;
42
42
  enum: string[];
43
43
  };
44
+ analyticsEvents: {
45
+ anyOf: ({
46
+ type: string;
47
+ additionalProperties: {
48
+ type: string;
49
+ };
50
+ required: string[];
51
+ properties: {
52
+ name: {
53
+ type: string;
54
+ };
55
+ type: {
56
+ type: string;
57
+ };
58
+ counters: {
59
+ type: string;
60
+ additionalProperties: boolean;
61
+ required: never[];
62
+ properties: {
63
+ include: {
64
+ type: string;
65
+ items: {
66
+ type: string;
67
+ };
68
+ };
69
+ exclude: {
70
+ type: string;
71
+ items: {
72
+ type: string;
73
+ };
74
+ };
75
+ };
76
+ };
77
+ context: {
78
+ type: string;
79
+ };
80
+ };
81
+ } | {
82
+ type: string;
83
+ items: {
84
+ type: string;
85
+ additionalProperties: {
86
+ type: string;
87
+ };
88
+ required: string[];
89
+ properties: {
90
+ name: {
91
+ type: string;
92
+ };
93
+ type: {
94
+ type: string;
95
+ };
96
+ counters: {
97
+ type: string;
98
+ additionalProperties: boolean;
99
+ required: never[];
100
+ properties: {
101
+ include: {
102
+ type: string;
103
+ items: {
104
+ type: string;
105
+ };
106
+ };
107
+ exclude: {
108
+ type: string;
109
+ items: {
110
+ type: string;
111
+ };
112
+ };
113
+ };
114
+ };
115
+ context: {
116
+ type: string;
117
+ };
118
+ };
119
+ };
120
+ })[];
121
+ };
44
122
  type: {};
45
123
  when: {};
46
124
  };
@@ -124,6 +202,9 @@ export declare const ExtendedFeaturesBlock: {
124
202
  resetPaddings: {
125
203
  type: string;
126
204
  };
205
+ context: {
206
+ type: string;
207
+ };
127
208
  type: {};
128
209
  when: {};
129
210
  };
@@ -821,6 +821,9 @@ export declare const HeaderBlock: {
821
821
  resetPaddings: {
822
822
  type: string;
823
823
  };
824
+ context: {
825
+ type: string;
826
+ };
824
827
  type: {};
825
828
  when: {};
826
829
  };
@@ -433,6 +433,9 @@ export declare const HeaderSliderBlock: {
433
433
  resetPaddings: {
434
434
  type: string;
435
435
  };
436
+ context: {
437
+ type: string;
438
+ };
436
439
  type: {};
437
440
  when: {};
438
441
  };
@@ -54,6 +54,9 @@ export declare const IconsProps: {
54
54
  resetPaddings: {
55
55
  type: string;
56
56
  };
57
+ context: {
58
+ type: string;
59
+ };
57
60
  type: {};
58
61
  when: {};
59
62
  };
@@ -115,6 +118,9 @@ export declare const IconsBlock: {
115
118
  resetPaddings: {
116
119
  type: string;
117
120
  };
121
+ context: {
122
+ type: string;
123
+ };
118
124
  type: {};
119
125
  when: {};
120
126
  };
@@ -67,6 +67,9 @@ export declare const LinkTableBlock: {
67
67
  resetPaddings: {
68
68
  type: string;
69
69
  };
70
+ context: {
71
+ type: string;
72
+ };
70
73
  type: {};
71
74
  when: {};
72
75
  };