@gravity-ui/page-constructor 1.15.0-alpha.0 → 1.15.0-alpha.10

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 (179) hide show
  1. package/README.md +110 -5
  2. package/build/cjs/blocks/Banner/Banner.js +3 -2
  3. package/build/cjs/blocks/Banner/schema.d.ts +33 -24
  4. package/build/cjs/blocks/Banner/schema.js +3 -1
  5. package/build/cjs/blocks/CardLayout/schema.d.ts +6 -0
  6. package/build/cjs/blocks/ContentLayout/ContentLayout.js +3 -2
  7. package/build/cjs/blocks/ContentLayout/schema.d.ts +3 -0
  8. package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.d.ts +1 -1
  9. package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.js +3 -2
  10. package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +3 -0
  11. package/build/cjs/blocks/Header/Header.js +6 -5
  12. package/build/cjs/blocks/Header/schema.d.ts +3 -0
  13. package/build/cjs/blocks/HeaderSlider/schema.d.ts +3 -0
  14. package/build/cjs/blocks/Icons/schema.d.ts +6 -0
  15. package/build/cjs/blocks/Info/Info.js +4 -3
  16. package/build/cjs/blocks/Info/schema.d.ts +3 -0
  17. package/build/cjs/blocks/Info/schema.js +2 -0
  18. package/build/cjs/blocks/LinkTable/schema.d.ts +3 -0
  19. package/build/cjs/blocks/Media/Media.js +3 -2
  20. package/build/cjs/blocks/Media/MediaContent.js +3 -2
  21. package/build/cjs/blocks/Media/schema.d.ts +11 -8
  22. package/build/cjs/blocks/Preview/MediaContent/MediaContent.d.ts +2 -1
  23. package/build/cjs/blocks/Preview/MediaContent/MediaContent.js +3 -2
  24. package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.d.ts +1 -0
  25. package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.js +3 -2
  26. package/build/cjs/blocks/Preview/Preview.js +3 -2
  27. package/build/cjs/blocks/Preview/schema.d.ts +3 -0
  28. package/build/cjs/blocks/Preview/schema.js +3 -1
  29. package/build/cjs/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +3 -2
  30. package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
  31. package/build/cjs/blocks/Questions/Questions.js +3 -2
  32. package/build/cjs/blocks/Questions/schema.d.ts +3 -0
  33. package/build/cjs/blocks/Security/Security.js +3 -2
  34. package/build/cjs/blocks/Security/schema.d.ts +3 -0
  35. package/build/cjs/blocks/Security/schema.js +3 -1
  36. package/build/cjs/blocks/Share/Share.d.ts +1 -1
  37. package/build/cjs/blocks/Share/Share.js +10 -2
  38. package/build/cjs/blocks/Simple/schema.d.ts +3 -0
  39. package/build/cjs/blocks/Slider/schema.d.ts +3 -0
  40. package/build/cjs/blocks/Table/schema.d.ts +3 -0
  41. package/build/cjs/blocks/Tabs/Tabs.d.ts +1 -1
  42. package/build/cjs/blocks/Tabs/Tabs.js +5 -4
  43. package/build/cjs/blocks/Tabs/schema.d.ts +3 -0
  44. package/build/cjs/components/BackLink/BackLink.d.ts +1 -0
  45. package/build/cjs/components/BackLink/BackLink.js +11 -2
  46. package/build/cjs/components/BackgroundMedia/BackgroundMedia.js +2 -1
  47. package/build/cjs/components/Button/Button.d.ts +1 -0
  48. package/build/cjs/components/Button/Button.js +8 -2
  49. package/build/cjs/components/ButtonTabs/ButtonTabs.d.ts +1 -0
  50. package/build/cjs/components/ButtonTabs/ButtonTabs.js +11 -2
  51. package/build/cjs/components/CardBase/CardBase.d.ts +3 -2
  52. package/build/cjs/components/CardBase/CardBase.js +8 -2
  53. package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +8 -2
  54. package/build/cjs/components/Link/Link.js +9 -3
  55. package/build/cjs/components/Media/Media.js +4 -2
  56. package/build/cjs/components/Media/Video/Video.js +5 -3
  57. package/build/cjs/components/ReactPlayer/ReactPlayer.js +14 -26
  58. package/build/cjs/components/YandexForm/YandexForm.d.ts +3 -2
  59. package/build/cjs/components/YandexForm/YandexForm.js +9 -3
  60. package/build/cjs/constructor-items.d.ts +5 -5
  61. package/build/cjs/context/analyticsContext/analyticsContext.d.ts +3 -2
  62. package/build/cjs/hooks/useAnalytics.d.ts +2 -2
  63. package/build/cjs/hooks/useAnalytics.js +9 -4
  64. package/build/cjs/models/common.d.ts +7 -9
  65. package/build/cjs/models/common.js +7 -1
  66. package/build/cjs/models/constructor-items/blocks.d.ts +11 -0
  67. package/build/cjs/models/constructor-items/common.d.ts +11 -6
  68. package/build/cjs/models/constructor-items/sub-blocks.d.ts +6 -3
  69. package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +3 -2
  70. package/build/cjs/schema/validators/common.d.ts +19 -16
  71. package/build/cjs/schema/validators/common.js +3 -1
  72. package/build/cjs/schema/validators/event.d.ts +4 -58
  73. package/build/cjs/schema/validators/event.js +3 -55
  74. package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +3 -2
  75. package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +3 -0
  76. package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -0
  77. package/build/cjs/sub-blocks/BannerCard/BannerCard.js +3 -2
  78. package/build/cjs/sub-blocks/BasicCard/BasicCard.js +3 -2
  79. package/build/cjs/sub-blocks/CardWithImage/CardWithImage.d.ts +1 -1
  80. package/build/cjs/sub-blocks/CardWithImage/CardWithImage.js +3 -2
  81. package/build/cjs/sub-blocks/Content/Content.js +4 -3
  82. package/build/cjs/sub-blocks/HubspotForm/index.js +7 -2
  83. package/build/cjs/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
  84. package/build/cjs/sub-blocks/MediaCard/MediaCard.js +3 -2
  85. package/build/cjs/sub-blocks/Quote/Quote.js +9 -2
  86. package/build/cjs/sub-blocks/Quote/schema.d.ts +3 -0
  87. package/build/cjs/sub-blocks/Quote/schema.js +3 -1
  88. package/build/esm/blocks/Banner/Banner.js +3 -2
  89. package/build/esm/blocks/Banner/schema.d.ts +33 -24
  90. package/build/esm/blocks/Banner/schema.js +3 -1
  91. package/build/esm/blocks/CardLayout/schema.d.ts +6 -0
  92. package/build/esm/blocks/ContentLayout/ContentLayout.js +3 -2
  93. package/build/esm/blocks/ContentLayout/schema.d.ts +3 -0
  94. package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.d.ts +1 -1
  95. package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.js +3 -2
  96. package/build/esm/blocks/ExtendedFeatures/schema.d.ts +3 -0
  97. package/build/esm/blocks/Header/Header.js +6 -5
  98. package/build/esm/blocks/Header/schema.d.ts +3 -0
  99. package/build/esm/blocks/HeaderSlider/schema.d.ts +3 -0
  100. package/build/esm/blocks/Icons/schema.d.ts +6 -0
  101. package/build/esm/blocks/Info/Info.js +4 -3
  102. package/build/esm/blocks/Info/schema.d.ts +3 -0
  103. package/build/esm/blocks/Info/schema.js +2 -0
  104. package/build/esm/blocks/LinkTable/schema.d.ts +3 -0
  105. package/build/esm/blocks/Media/Media.js +3 -2
  106. package/build/esm/blocks/Media/MediaContent.js +3 -2
  107. package/build/esm/blocks/Media/schema.d.ts +11 -8
  108. package/build/esm/blocks/Preview/MediaContent/MediaContent.d.ts +2 -1
  109. package/build/esm/blocks/Preview/MediaContent/MediaContent.js +3 -2
  110. package/build/esm/blocks/Preview/MediaContent/PreviewMedia.d.ts +1 -0
  111. package/build/esm/blocks/Preview/MediaContent/PreviewMedia.js +3 -2
  112. package/build/esm/blocks/Preview/Preview.js +3 -2
  113. package/build/esm/blocks/Preview/schema.d.ts +3 -0
  114. package/build/esm/blocks/Preview/schema.js +3 -1
  115. package/build/esm/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +3 -2
  116. package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
  117. package/build/esm/blocks/Questions/Questions.js +3 -2
  118. package/build/esm/blocks/Questions/schema.d.ts +3 -0
  119. package/build/esm/blocks/Security/Security.js +3 -2
  120. package/build/esm/blocks/Security/schema.d.ts +3 -0
  121. package/build/esm/blocks/Security/schema.js +3 -1
  122. package/build/esm/blocks/Share/Share.d.ts +1 -1
  123. package/build/esm/blocks/Share/Share.js +11 -3
  124. package/build/esm/blocks/Simple/schema.d.ts +3 -0
  125. package/build/esm/blocks/Slider/schema.d.ts +3 -0
  126. package/build/esm/blocks/Table/schema.d.ts +3 -0
  127. package/build/esm/blocks/Tabs/Tabs.d.ts +1 -1
  128. package/build/esm/blocks/Tabs/Tabs.js +5 -4
  129. package/build/esm/blocks/Tabs/schema.d.ts +3 -0
  130. package/build/esm/components/BackLink/BackLink.d.ts +1 -0
  131. package/build/esm/components/BackLink/BackLink.js +11 -2
  132. package/build/esm/components/BackgroundMedia/BackgroundMedia.js +2 -1
  133. package/build/esm/components/Button/Button.d.ts +1 -0
  134. package/build/esm/components/Button/Button.js +8 -2
  135. package/build/esm/components/ButtonTabs/ButtonTabs.d.ts +1 -0
  136. package/build/esm/components/ButtonTabs/ButtonTabs.js +11 -2
  137. package/build/esm/components/CardBase/CardBase.d.ts +3 -2
  138. package/build/esm/components/CardBase/CardBase.js +8 -2
  139. package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +8 -2
  140. package/build/esm/components/Link/Link.js +9 -3
  141. package/build/esm/components/Media/Media.js +4 -2
  142. package/build/esm/components/Media/Video/Video.js +5 -3
  143. package/build/esm/components/ReactPlayer/ReactPlayer.js +15 -27
  144. package/build/esm/components/YandexForm/YandexForm.d.ts +3 -2
  145. package/build/esm/components/YandexForm/YandexForm.js +9 -3
  146. package/build/esm/constructor-items.d.ts +5 -5
  147. package/build/esm/context/analyticsContext/analyticsContext.d.ts +3 -2
  148. package/build/esm/hooks/useAnalytics.d.ts +2 -2
  149. package/build/esm/hooks/useAnalytics.js +9 -4
  150. package/build/esm/models/common.d.ts +7 -9
  151. package/build/esm/models/common.js +6 -0
  152. package/build/esm/models/constructor-items/blocks.d.ts +11 -0
  153. package/build/esm/models/constructor-items/common.d.ts +11 -6
  154. package/build/esm/models/constructor-items/sub-blocks.d.ts +6 -3
  155. package/build/esm/navigation/components/NavigationItem/NavigationItem.js +3 -2
  156. package/build/esm/schema/validators/common.d.ts +19 -16
  157. package/build/esm/schema/validators/common.js +4 -2
  158. package/build/esm/schema/validators/event.d.ts +4 -58
  159. package/build/esm/schema/validators/event.js +2 -54
  160. package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +3 -2
  161. package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +3 -0
  162. package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -0
  163. package/build/esm/sub-blocks/BannerCard/BannerCard.js +3 -2
  164. package/build/esm/sub-blocks/BasicCard/BasicCard.js +3 -2
  165. package/build/esm/sub-blocks/CardWithImage/CardWithImage.d.ts +1 -1
  166. package/build/esm/sub-blocks/CardWithImage/CardWithImage.js +3 -2
  167. package/build/esm/sub-blocks/Content/Content.js +4 -3
  168. package/build/esm/sub-blocks/HubspotForm/index.js +7 -2
  169. package/build/esm/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
  170. package/build/esm/sub-blocks/MediaCard/MediaCard.js +3 -2
  171. package/build/esm/sub-blocks/Quote/Quote.js +11 -4
  172. package/build/esm/sub-blocks/Quote/schema.d.ts +3 -0
  173. package/build/esm/sub-blocks/Quote/schema.js +3 -1
  174. package/package.json +1 -1
  175. package/server/models/common.d.ts +7 -9
  176. package/server/models/common.js +7 -1
  177. package/server/models/constructor-items/blocks.d.ts +11 -0
  178. package/server/models/constructor-items/common.d.ts +11 -6
  179. package/server/models/constructor-items/sub-blocks.d.ts +6 -3
package/README.md CHANGED
@@ -43,7 +43,8 @@ interface PageConstructorProviderProps {
43
43
  isMobile?: boolean; //A flag indicating that the code is executed in mobile mode.
44
44
  locale?: LocaleContextProps; //Info about the language and domain (used when generating and formatting links).
45
45
  location?: Location; //API of the browser or router history, the page URL.
46
- metrika?: Metrika; //Functions for sending analytics
46
+ analytics?: AnalyticsContextProps; // function to handle analytics event
47
+
47
48
  ssrConfig?: SSR; //A flag indicating that the code is run on the server size.
48
49
  theme?: 'light' | 'dark'; //Theme to render the page with.
49
50
  }
@@ -81,10 +82,17 @@ interface SSR {
81
82
  isServer?: boolean;
82
83
  }
83
84
 
84
- interface Metrika {
85
- metrika?: any;
86
- pixel?: any;
87
- }
85
+ type AnalyticsCounters = {
86
+ include?: string[];
87
+ exclude?: string[];
88
+ };
89
+
90
+ type AnalyticsEvent<T = {}> = T & {
91
+ name: string;
92
+ type?: string;
93
+ counters?: AnalyticsCounters;
94
+ blockName?: string;
95
+ };
88
96
 
89
97
  interface NavigationData {
90
98
  logo: NavigationLogo;
@@ -211,6 +219,103 @@ import {configure, Lang} from '@gravity-ui/page-constructor';
211
219
  configure({lang: Lang.En});
212
220
  ```
213
221
 
222
+ ### Analytics
223
+
224
+ #### Init
225
+
226
+ To start using any analytics, pass a handler to the constructor. The handler must be created on a project side. The handler will receive the `default` and `custom` event objects. The passed handler will be fired on a button, link, navigation, and control clicks. As one handler is used for all events treatment, pay attention to how to treat different events while creating the handler. There are predefined fields that serve to help you to build complex logic.
227
+
228
+ Pass `sendDefaultEvent: true` to constructor to fire automatically configured events.
229
+
230
+ ```ts
231
+ function sendEvents(events: MyEventType []) {
232
+ ...
233
+ }
234
+
235
+ <PageConstructorProvider
236
+ ...
237
+
238
+ analytics={{sendEvents, sendDefaultEvent: true}}
239
+
240
+ ...
241
+ />
242
+ ```
243
+
244
+ An event object has only one required field - `name`. It also has predefined fields, which serve to help manage complex logic. For example, `counter.include` can help to send event in a particular counter if several analytics systems are used in a project.
245
+
246
+ ```ts
247
+ type AnalyticsCounters = {
248
+ include?: string[];
249
+ exclude?: string[];
250
+ };
251
+
252
+ type AnalyticsEvent<T = {}> = T & {
253
+ name: string;
254
+ type?: string;
255
+ counters?: AnalyticsCounters;
256
+ blockName?: string;
257
+ };
258
+ ```
259
+
260
+ It is possible to configure an event type needed for a project.
261
+
262
+ ```ts
263
+ type MyEventType = AnalyticsEvent<{
264
+ anyParameterName?: string; // only a 'string' type is supported
265
+ }>;
266
+ ```
267
+
268
+ #### Counter selector
269
+
270
+ It is possible to configure an event to which an analytics system to sent.
271
+
272
+ ```ts
273
+ type AnalyticsCounters = {
274
+ include?: string[];
275
+ exclude?: string[];
276
+ };
277
+ ```
278
+
279
+ #### blockName parameter
280
+
281
+ Pass `blockName` value to define place on a project where an event is fired.
282
+
283
+ Use selector below or create logic that serves project needs.
284
+
285
+ ```ts
286
+ // utils.ts
287
+ const isCounterAllowed = (counter: Counter, counters?: AnalyticsCounters) => {
288
+ if (!counters) {
289
+ return true;
290
+ }
291
+
292
+ if (counters.exclude?.includes(counter)) {
293
+ return false;
294
+ } else if (counters.include?.includes(counter)) {
295
+ return true;
296
+ }
297
+
298
+ return false;
299
+ };
300
+
301
+ // analyticsHandler.ts
302
+ if (isCounterAllowed(counterName, counters)) {
303
+ analyticsCounter.reachGoal(counterName, name, parameters);
304
+ }
305
+ ```
306
+
307
+ #### Reserved event types
308
+
309
+ Several predefined event types are used to mark automatically configured events. Use the types to filter default events, for example.
310
+
311
+ ```ts
312
+ enum PredefinedEventTypes {
313
+ Default = 'default-event', // default events which fire on every button click
314
+ Play = 'play', // React player event
315
+ Stop = 'stop', // React player event
316
+ }
317
+ ```
318
+
214
319
  ## Development
215
320
 
216
321
  ```bash
@@ -4,13 +4,14 @@ exports.BannerBlock = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const utils_1 = require("../../utils");
7
+ const models_1 = require("../../models");
7
8
  const AnimateBlock_1 = tslib_1.__importDefault(require("../../components/AnimateBlock/AnimateBlock"));
8
9
  const sub_blocks_1 = require("../../sub-blocks");
9
10
  const b = (0, utils_1.block)('banner-block');
10
11
  const BannerBlock = (props) => {
11
- const { animated } = props, bannerProps = tslib_1.__rest(props, ["animated"]);
12
+ const { animated, blockName = models_1.BlockType.BannerBlock } = props, bannerProps = tslib_1.__rest(props, ["animated", "blockName"]);
12
13
  return (react_1.default.createElement(AnimateBlock_1.default, { className: b(), animate: animated },
13
- react_1.default.createElement(sub_blocks_1.BannerCard, Object.assign({}, bannerProps))));
14
+ react_1.default.createElement(sub_blocks_1.BannerCard, Object.assign({}, bannerProps, { blockName: blockName }))));
14
15
  };
15
16
  exports.BannerBlock = BannerBlock;
16
17
  exports.default = exports.BannerBlock;
@@ -176,10 +176,7 @@ export declare const BannerCardProps: {
176
176
  analyticsEvents: {
177
177
  anyOf: ({
178
178
  type: string;
179
- propertyNames: {
180
- type: string;
181
- };
182
- additionalProperty: {
179
+ additionalProperties: {
183
180
  type: string;
184
181
  };
185
182
  required: string[];
@@ -209,15 +206,15 @@ export declare const BannerCardProps: {
209
206
  };
210
207
  };
211
208
  };
209
+ blockName: {
210
+ type: string;
211
+ };
212
212
  };
213
213
  } | {
214
214
  type: string;
215
215
  items: {
216
216
  type: string;
217
- propertyNames: {
218
- type: string;
219
- };
220
- additionalProperty: {
217
+ additionalProperties: {
221
218
  type: string;
222
219
  };
223
220
  required: string[];
@@ -247,6 +244,9 @@ export declare const BannerCardProps: {
247
244
  };
248
245
  };
249
246
  };
247
+ blockName: {
248
+ type: string;
249
+ };
250
250
  };
251
251
  };
252
252
  })[];
@@ -270,6 +270,9 @@ export declare const BannerCardProps: {
270
270
  required: string[];
271
271
  };
272
272
  };
273
+ blockName: {
274
+ type: string;
275
+ };
273
276
  animated: {
274
277
  type: string;
275
278
  };
@@ -456,10 +459,7 @@ export declare const BannerBlock: {
456
459
  analyticsEvents: {
457
460
  anyOf: ({
458
461
  type: string;
459
- propertyNames: {
460
- type: string;
461
- };
462
- additionalProperty: {
462
+ additionalProperties: {
463
463
  type: string;
464
464
  };
465
465
  required: string[];
@@ -489,15 +489,15 @@ export declare const BannerBlock: {
489
489
  };
490
490
  };
491
491
  };
492
+ blockName: {
493
+ type: string;
494
+ };
492
495
  };
493
496
  } | {
494
497
  type: string;
495
498
  items: {
496
499
  type: string;
497
- propertyNames: {
498
- type: string;
499
- };
500
- additionalProperty: {
500
+ additionalProperties: {
501
501
  type: string;
502
502
  };
503
503
  required: string[];
@@ -527,6 +527,9 @@ export declare const BannerBlock: {
527
527
  };
528
528
  };
529
529
  };
530
+ blockName: {
531
+ type: string;
532
+ };
530
533
  };
531
534
  };
532
535
  })[];
@@ -550,6 +553,9 @@ export declare const BannerBlock: {
550
553
  required: string[];
551
554
  };
552
555
  };
556
+ blockName: {
557
+ type: string;
558
+ };
553
559
  animated: {
554
560
  type: string;
555
561
  };
@@ -737,10 +743,7 @@ export declare const BannerCard: {
737
743
  analyticsEvents: {
738
744
  anyOf: ({
739
745
  type: string;
740
- propertyNames: {
741
- type: string;
742
- };
743
- additionalProperty: {
746
+ additionalProperties: {
744
747
  type: string;
745
748
  };
746
749
  required: string[];
@@ -770,15 +773,15 @@ export declare const BannerCard: {
770
773
  };
771
774
  };
772
775
  };
776
+ blockName: {
777
+ type: string;
778
+ };
773
779
  };
774
780
  } | {
775
781
  type: string;
776
782
  items: {
777
783
  type: string;
778
- propertyNames: {
779
- type: string;
780
- };
781
- additionalProperty: {
784
+ additionalProperties: {
782
785
  type: string;
783
786
  };
784
787
  required: string[];
@@ -808,6 +811,9 @@ export declare const BannerCard: {
808
811
  };
809
812
  };
810
813
  };
814
+ blockName: {
815
+ type: string;
816
+ };
811
817
  };
812
818
  };
813
819
  })[];
@@ -831,6 +837,9 @@ export declare const BannerCard: {
831
837
  required: string[];
832
838
  };
833
839
  };
840
+ blockName: {
841
+ type: string;
842
+ };
834
843
  animated: {
835
844
  type: string;
836
845
  };
@@ -20,7 +20,9 @@ exports.BannerCardProps = {
20
20
  }), theme: common_1.ThemeProps, width: {
21
21
  type: 'string',
22
22
  enum: ['s', 'm', 'l'],
23
- }, button: common_1.ButtonBlock }),
23
+ }, button: common_1.ButtonBlock, blockName: {
24
+ type: 'string',
25
+ } }),
24
26
  };
25
27
  exports.BannerBlock = {
26
28
  'banner-block': exports.BannerCardProps,
@@ -66,6 +66,9 @@ export declare const CardLayoutProps: {
66
66
  resetPaddings: {
67
67
  type: string;
68
68
  };
69
+ blockName: {
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
+ blockName: {
146
+ type: string;
147
+ };
142
148
  type: {};
143
149
  when: {};
144
150
  };
@@ -4,6 +4,7 @@ exports.ContentLayoutBlock = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
6
  const utils_1 = require("../../utils");
7
+ const models_1 = require("../../models");
7
8
  const sub_blocks_1 = require("../../sub-blocks");
8
9
  const components_1 = require("../../components");
9
10
  const grid_1 = require("../../grid");
@@ -31,11 +32,11 @@ function getTextWidth(size) {
31
32
  }
32
33
  const ContentLayoutBlock = (props) => {
33
34
  const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
34
- const { textContent, fileContent, properties: cardLayoutProperties = { size: 'l' } } = props;
35
+ const { textContent, fileContent, properties: cardLayoutProperties = { size: 'l' }, blockName = models_1.BlockType.ContentLayoutBlock, } = props;
35
36
  const { size = 'l', background, centered, theme = 'default', textWidth = 'm', } = cardLayoutProperties;
36
37
  const colSizes = (0, react_1.useMemo)(() => getTextWidth(textWidth), [textWidth]);
37
38
  return (react_1.default.createElement("div", { className: b({ size, background: Boolean(background) }) },
38
- react_1.default.createElement(sub_blocks_1.Content, Object.assign({ className: b('content') }, textContent, { size: size, centered: centered, colSizes: colSizes, theme: theme })),
39
+ react_1.default.createElement(sub_blocks_1.Content, Object.assign({ className: b('content') }, textContent, { size: size, centered: centered, colSizes: colSizes, theme: theme, blockName: blockName })),
39
40
  fileContent && (react_1.default.createElement(grid_1.Col, { className: b('files', { size, centered }), reset: true, sizes: colSizes }, fileContent.map((file) => (react_1.default.createElement(components_1.FileLink, Object.assign({ className: b('file') }, file, { key: file.href, type: "horizontal", textSize: getFileTextSize(size), theme: theme })))))),
40
41
  background && (react_1.default.createElement("div", { className: b('background') },
41
42
  react_1.default.createElement(components_1.BackgroundImage, Object.assign({ className: b('background-item') }, background, { hide: isMobile }))))));
@@ -144,6 +144,9 @@ export declare const ContentLayoutBlock: {
144
144
  resetPaddings: {
145
145
  type: string;
146
146
  };
147
+ blockName: {
148
+ type: string;
149
+ };
147
150
  type: {};
148
151
  when: {};
149
152
  };
@@ -1,3 +1,3 @@
1
1
  import { ExtendedFeaturesProps } from '../../models';
2
- export declare const ExtendedFeaturesBlock: ({ title, description, items, colSizes, animated, }: ExtendedFeaturesProps) => JSX.Element;
2
+ export declare const ExtendedFeaturesBlock: ({ title, description, items, colSizes, animated, blockName, }: ExtendedFeaturesProps) => JSX.Element;
3
3
  export default ExtendedFeaturesBlock;
@@ -4,6 +4,7 @@ exports.ExtendedFeaturesBlock = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
6
  const utils_1 = require("../../utils");
7
+ const models_1 = require("../../models");
7
8
  const grid_1 = require("../../grid");
8
9
  const components_1 = require("../../components/");
9
10
  const sub_blocks_1 = require("../../sub-blocks");
@@ -16,7 +17,7 @@ const DEFAULT_SIZES = {
16
17
  sm: 6,
17
18
  md: 4,
18
19
  };
19
- const ExtendedFeaturesBlock = ({ title, description, items, colSizes = DEFAULT_SIZES, animated, }) => {
20
+ const ExtendedFeaturesBlock = ({ title, description, items, colSizes = DEFAULT_SIZES, animated, blockName = models_1.BlockType.ExtendedFeaturesBlock, }) => {
20
21
  const { themeValue: theme } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
21
22
  return (react_1.default.createElement(components_1.AnimateBlock, { className: b(), animate: animated },
22
23
  react_1.default.createElement(components_1.BlockHeader, { title: title, description: description, className: b('header') }),
@@ -34,7 +35,7 @@ const ExtendedFeaturesBlock = ({ title, description, items, colSizes = DEFAULT_S
34
35
  itemTitle && (react_1.default.createElement("h5", { className: b('item-title') },
35
36
  react_1.default.createElement(components_1.HTML, null, itemTitle),
36
37
  label && (react_1.default.createElement("div", { className: b('item-label') }, label)))),
37
- react_1.default.createElement(sub_blocks_1.Content, { text: text, links: itemLinks, size: "s", colSizes: { all: 12, md: 12 }, buttons: buttons, additionalInfo: additionalInfo }))));
38
+ react_1.default.createElement(sub_blocks_1.Content, { text: text, links: itemLinks, size: "s", colSizes: { all: 12, md: 12 }, buttons: buttons, additionalInfo: additionalInfo, blockName: blockName }))));
38
39
  })))));
39
40
  };
40
41
  exports.ExtendedFeaturesBlock = ExtendedFeaturesBlock;
@@ -124,6 +124,9 @@ export declare const ExtendedFeaturesBlock: {
124
124
  resetPaddings: {
125
125
  type: string;
126
126
  };
127
+ blockName: {
128
+ type: string;
129
+ };
127
130
  type: {};
128
131
  when: {};
129
132
  };
@@ -4,6 +4,7 @@ exports.HeaderBlock = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
6
  const utils_1 = require("../../utils");
7
+ const models_1 = require("../../models");
7
8
  const components_1 = require("../../components");
8
9
  const grid_1 = require("../../grid");
9
10
  const utils_2 = require("./utils");
@@ -13,15 +14,15 @@ const HeaderBreadcrumbs_1 = tslib_1.__importDefault(require("../../components/He
13
14
  const ThemeValueContext_1 = require("../../context/theme/ThemeValueContext");
14
15
  const utils_3 = require("../../components/Media/Image/utils");
15
16
  const b = (0, utils_1.block)('header-block');
16
- const Background = ({ background, isMobile }) => {
17
+ const Background = ({ background, isMobile, blockName }) => {
17
18
  const { url, image, fullWidthMedia, video, color } = background;
18
19
  const imageObject = url ? (0, utils_3.getMediaImage)(url) : image;
19
20
  const renderMedia = !isMobile || (typeof image === 'object' && 'mobile' in image);
20
- return (react_1.default.createElement("div", { className: b('background', { media: true, 'full-width-media': fullWidthMedia }), style: { backgroundColor: color } }, renderMedia && (react_1.default.createElement(components_1.Media, Object.assign({}, background, { className: b('background-media'), imageClassName: b('image'), videoClassName: b('video'), isBackground: true, parallax: false, video: isMobile ? undefined : video, image: imageObject })))));
21
+ return (react_1.default.createElement("div", { className: b('background', { media: true, 'full-width-media': fullWidthMedia }), style: { backgroundColor: color } }, renderMedia && (react_1.default.createElement(components_1.Media, Object.assign({}, background, { className: b('background-media'), imageClassName: b('image'), videoClassName: b('video'), isBackground: true, parallax: false, video: isMobile ? undefined : video, image: imageObject, blockName: blockName })))));
21
22
  };
22
23
  const FullWidthBackground = ({ background }) => (react_1.default.createElement("div", { className: b('background', { ['full-width']: true }), style: { backgroundColor: background === null || background === void 0 ? void 0 : background.color } }));
23
24
  const HeaderBlock = (props) => {
24
- const { title, overtitle, description, buttons, image, video, width = 'm', imageSize, offset = 'default', background, theme: textTheme = 'light', verticalOffset = 'm', className, breadcrumbs, status, children, } = props;
25
+ const { title, overtitle, description, buttons, image, video, width = 'm', imageSize, offset = 'default', background, theme: textTheme = 'light', verticalOffset = 'm', className, breadcrumbs, status, children, blockName = models_1.BlockType.HeaderBlock, } = props;
25
26
  const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
26
27
  const { themeValue: theme } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
27
28
  const hasRightSideImage = Boolean(image || video);
@@ -60,9 +61,9 @@ const HeaderBlock = (props) => {
60
61
  react_1.default.createElement(YFMWrapper_1.default, { content: description, modifiers: { constructor: true } }))),
61
62
  buttons && (react_1.default.createElement("div", { className: b('buttons'), "data-qa": "header-buttons" }, buttons &&
62
63
  buttons.map((button, index) => (react_1.default.createElement(components_1.RouterLink, { href: button.url, key: index },
63
- react_1.default.createElement(components_1.Button, Object.assign({ key: index, className: b('button'), size: "xl" }, button))))))),
64
+ react_1.default.createElement(components_1.Button, Object.assign({ key: index, className: b('button'), size: "xl" }, button, { blockName: models_1.BlockType.HeaderBlock }))))))),
64
65
  children))),
65
- hasRightSideImage && (react_1.default.createElement(components_1.Media, { className: b('media', { [curImageSize]: true }), videoClassName: b('video'), imageClassName: b('image'), video: videoThemed, image: imageThemed })))))));
66
+ hasRightSideImage && (react_1.default.createElement(components_1.Media, { className: b('media', { [curImageSize]: true }), videoClassName: b('video'), imageClassName: b('image'), video: videoThemed, image: imageThemed, blockName: blockName })))))));
66
67
  };
67
68
  exports.HeaderBlock = HeaderBlock;
68
69
  exports.default = exports.HeaderBlock;
@@ -821,6 +821,9 @@ export declare const HeaderBlock: {
821
821
  resetPaddings: {
822
822
  type: string;
823
823
  };
824
+ blockName: {
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
+ blockName: {
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
+ blockName: {
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
+ blockName: {
122
+ type: string;
123
+ };
118
124
  type: {};
119
125
  when: {};
120
126
  };
@@ -4,13 +4,14 @@ exports.InfoBlock = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
6
  const utils_1 = require("../../utils");
7
+ const models_1 = require("../../models");
7
8
  const grid_1 = require("../../grid");
8
9
  const ThemeValueContext_1 = require("../../context/theme/ThemeValueContext");
9
10
  const Content_1 = tslib_1.__importDefault(require("../../sub-blocks/Content/Content"));
10
11
  const b = (0, utils_1.block)('info-block');
11
12
  const sizes = { md: 6, all: 12 };
12
13
  const InfoBlock = (props) => {
13
- const { backgroundColor, theme: blockTheme = 'dark', buttons = [], title, sectionsTitle, links = [], rightContent = {}, leftContent = {}, } = props;
14
+ const { backgroundColor, theme: blockTheme = 'dark', buttons = [], title, sectionsTitle, links = [], rightContent = {}, leftContent = {}, blockName = models_1.BlockType.InfoBlock, } = props;
14
15
  const { themeValue: theme } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
15
16
  const contentTheme = blockTheme === 'dark' ? 'dark' : 'default';
16
17
  const rightLinks = [
@@ -28,9 +29,9 @@ const InfoBlock = (props) => {
28
29
  react_1.default.createElement(grid_1.Grid, null,
29
30
  react_1.default.createElement(grid_1.Row, null,
30
31
  react_1.default.createElement(grid_1.Col, { sizes: sizes, className: b('left') },
31
- react_1.default.createElement(Content_1.default, Object.assign({ title: title || (leftContent === null || leftContent === void 0 ? void 0 : leftContent.title), text: leftContent === null || leftContent === void 0 ? void 0 : leftContent.text, links: leftContent === null || leftContent === void 0 ? void 0 : leftContent.links, buttons: leftButtons, additionalInfo: leftContent === null || leftContent === void 0 ? void 0 : leftContent.additionalInfo }, commonProps))),
32
+ react_1.default.createElement(Content_1.default, Object.assign({ title: title || (leftContent === null || leftContent === void 0 ? void 0 : leftContent.title), text: leftContent === null || leftContent === void 0 ? void 0 : leftContent.text, links: leftContent === null || leftContent === void 0 ? void 0 : leftContent.links, buttons: leftButtons, additionalInfo: leftContent === null || leftContent === void 0 ? void 0 : leftContent.additionalInfo }, commonProps, { blockName: blockName }))),
32
33
  react_1.default.createElement(grid_1.Col, { sizes: sizes, className: b('right') },
33
- react_1.default.createElement(Content_1.default, Object.assign({ title: sectionsTitle || (rightContent === null || rightContent === void 0 ? void 0 : rightContent.title), text: rightContent === null || rightContent === void 0 ? void 0 : rightContent.text, links: rightLinks, buttons: rightContent === null || rightContent === void 0 ? void 0 : rightContent.buttons, additionalInfo: rightContent === null || rightContent === void 0 ? void 0 : rightContent.additionalInfo }, commonProps))))))));
34
+ react_1.default.createElement(Content_1.default, Object.assign({ title: sectionsTitle || (rightContent === null || rightContent === void 0 ? void 0 : rightContent.title), text: rightContent === null || rightContent === void 0 ? void 0 : rightContent.text, links: rightLinks, buttons: rightContent === null || rightContent === void 0 ? void 0 : rightContent.buttons, additionalInfo: rightContent === null || rightContent === void 0 ? void 0 : rightContent.additionalInfo }, commonProps, { blockName: blockName }))))))));
34
35
  };
35
36
  exports.InfoBlock = InfoBlock;
36
37
  exports.default = exports.InfoBlock;
@@ -21,6 +21,9 @@ export declare const InfoBlock: {
21
21
  type: string;
22
22
  contentType: string;
23
23
  };
24
+ blockName: {
25
+ type: string;
26
+ };
24
27
  buttons: {
25
28
  type: string;
26
29
  items: {
@@ -22,6 +22,8 @@ exports.InfoBlock = {
22
22
  }), sectionsTitle: {
23
23
  type: 'string',
24
24
  contentType: 'text',
25
+ }, blockName: {
26
+ type: 'string',
25
27
  }, buttons: (0, utils_1.filteredArray)(common_1.ButtonBlock), theme: common_1.ThemeProps, links: (0, utils_1.filteredArray)(common_1.LinkProps), leftContent: ContentProps, rightContent: ContentProps }),
26
28
  },
27
29
  };
@@ -67,6 +67,9 @@ export declare const LinkTableBlock: {
67
67
  resetPaddings: {
68
68
  type: string;
69
69
  };
70
+ blockName: {
71
+ type: string;
72
+ };
70
73
  type: {};
71
74
  when: {};
72
75
  };
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
6
  const utils_1 = require("../../utils");
7
7
  const grid_1 = require("../../grid");
8
+ const models_1 = require("../../models");
8
9
  const Media_1 = tslib_1.__importDefault(require("../../components/Media/Media"));
9
10
  const AnimateBlock_1 = tslib_1.__importDefault(require("../../components/AnimateBlock/AnimateBlock"));
10
11
  const BlockHeader_1 = tslib_1.__importDefault(require("../../components/BlockHeader/BlockHeader"));
@@ -12,7 +13,7 @@ const MediaContent_1 = tslib_1.__importDefault(require("./MediaContent"));
12
13
  const ThemeValueContext_1 = require("../../context/theme/ThemeValueContext");
13
14
  const b = (0, utils_1.block)('media-block');
14
15
  const MediaBlock = (props) => {
15
- const { media, largeMedia, direction = 'content-media', mobileDirection = 'content-media', animated, mediaOnly, disableShadow = false } = props, mediaContentProps = tslib_1.__rest(props, ["media", "largeMedia", "direction", "mobileDirection", "animated", "mediaOnly", "disableShadow"]);
16
+ const { media, largeMedia, direction = 'content-media', mobileDirection = 'content-media', animated, mediaOnly, disableShadow = false, blockName = models_1.BlockType.MediaBlock } = props, mediaContentProps = tslib_1.__rest(props, ["media", "largeMedia", "direction", "mobileDirection", "animated", "mediaOnly", "disableShadow", "blockName"]);
16
17
  const { title, description } = mediaContentProps;
17
18
  const [play, setPlay] = (0, react_1.useState)(false);
18
19
  const { themeValue: theme } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
@@ -36,7 +37,7 @@ const MediaBlock = (props) => {
36
37
  react_1.default.createElement(grid_1.Col, { className: b('content'), sizes: contentSizes }, mediaContent),
37
38
  react_1.default.createElement(grid_1.Col, { sizes: mediaSizes },
38
39
  react_1.default.createElement("div", { className: b('card', { shadow: !disableShadow }) },
39
- react_1.default.createElement(Media_1.default, Object.assign({}, mediaThemed, { playVideo: play }))))))));
40
+ react_1.default.createElement(Media_1.default, Object.assign({}, mediaThemed, { playVideo: play, blockName: blockName }))))))));
40
41
  };
41
42
  exports.MediaBlock = MediaBlock;
42
43
  exports.default = exports.MediaBlock;
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importDefault(require("react"));
5
5
  const utils_1 = require("../../utils");
6
+ const models_1 = require("../../models");
6
7
  const sub_blocks_1 = require("../../sub-blocks");
7
8
  const b = (0, utils_1.block)('media-content');
8
9
  const MediaContent = (props) => {
9
- const { title, description, button, links, buttons = [], additionalInfo, size = 'l' } = props;
10
+ const { title, description, button, links, buttons = [], additionalInfo, size = 'l', blockName = models_1.BlockType.MediaBlock, } = props;
10
11
  const allButtons = button ? [Object.assign(Object.assign({}, button), { size: 'xl' }), ...buttons] : buttons;
11
12
  return (react_1.default.createElement("div", { className: b() },
12
- react_1.default.createElement(sub_blocks_1.Content, { title: title, text: description, links: links, theme: "default", buttons: allButtons, additionalInfo: additionalInfo, size: size, colSizes: { all: 12, md: 12 } })));
13
+ react_1.default.createElement(sub_blocks_1.Content, { title: title, text: description, links: links, theme: "default", buttons: allButtons, additionalInfo: additionalInfo, size: size, colSizes: { all: 12, md: 12 }, blockName: blockName })));
13
14
  };
14
15
  exports.default = MediaContent;