@gravity-ui/page-constructor 1.15.0-alpha.1 → 1.15.0-alpha.11
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.
- package/README.md +110 -5
- package/build/cjs/blocks/Banner/Banner.js +3 -2
- package/build/cjs/blocks/Banner/schema.d.ts +27 -0
- package/build/cjs/blocks/Banner/schema.js +3 -1
- package/build/cjs/blocks/CardLayout/schema.d.ts +6 -0
- package/build/cjs/blocks/ContentLayout/ContentLayout.js +3 -2
- package/build/cjs/blocks/ContentLayout/schema.d.ts +3 -0
- package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.d.ts +1 -1
- package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.js +3 -2
- package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +3 -0
- package/build/cjs/blocks/Header/Header.js +6 -5
- package/build/cjs/blocks/Header/schema.d.ts +159 -0
- package/build/cjs/blocks/Header/schema.js +4 -0
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +81 -0
- package/build/cjs/blocks/Icons/schema.d.ts +6 -0
- package/build/cjs/blocks/Info/Info.js +4 -3
- package/build/cjs/blocks/Info/schema.d.ts +3 -0
- package/build/cjs/blocks/Info/schema.js +2 -0
- package/build/cjs/blocks/LinkTable/schema.d.ts +3 -0
- package/build/cjs/blocks/Media/Media.js +3 -2
- package/build/cjs/blocks/Media/MediaContent.js +3 -2
- package/build/cjs/blocks/Media/schema.d.ts +9 -0
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.d.ts +2 -1
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.js +3 -2
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.d.ts +1 -0
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.js +3 -2
- package/build/cjs/blocks/Preview/Preview.js +3 -2
- package/build/cjs/blocks/Preview/schema.d.ts +3 -0
- package/build/cjs/blocks/Preview/schema.js +3 -1
- package/build/cjs/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +3 -2
- package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/cjs/blocks/Questions/Questions.js +3 -2
- package/build/cjs/blocks/Questions/schema.d.ts +3 -0
- package/build/cjs/blocks/Security/Security.js +3 -2
- package/build/cjs/blocks/Security/schema.d.ts +3 -0
- package/build/cjs/blocks/Security/schema.js +3 -1
- package/build/cjs/blocks/Share/Share.d.ts +1 -1
- package/build/cjs/blocks/Share/Share.js +11 -2
- package/build/cjs/blocks/Simple/schema.d.ts +3 -0
- package/build/cjs/blocks/Slider/schema.d.ts +3 -0
- package/build/cjs/blocks/Table/schema.d.ts +3 -0
- package/build/cjs/blocks/Tabs/Tabs.d.ts +1 -1
- package/build/cjs/blocks/Tabs/Tabs.js +5 -4
- package/build/cjs/blocks/Tabs/schema.d.ts +3 -0
- package/build/cjs/components/BackLink/BackLink.d.ts +1 -0
- package/build/cjs/components/BackLink/BackLink.js +12 -2
- package/build/cjs/components/BackgroundMedia/BackgroundMedia.js +2 -1
- package/build/cjs/components/Button/Button.d.ts +1 -0
- package/build/cjs/components/Button/Button.js +11 -3
- package/build/cjs/components/ButtonTabs/ButtonTabs.d.ts +1 -0
- package/build/cjs/components/ButtonTabs/ButtonTabs.js +12 -2
- package/build/cjs/components/CardBase/CardBase.d.ts +3 -2
- package/build/cjs/components/CardBase/CardBase.js +11 -3
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.css +0 -30
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +4 -11
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.css +30 -0
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.d.ts +12 -0
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.js +27 -0
- package/build/cjs/components/Link/Link.js +12 -4
- package/build/cjs/components/Media/Media.js +4 -2
- package/build/cjs/components/Media/Video/Video.js +5 -3
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +21 -26
- package/build/cjs/components/YandexForm/YandexForm.d.ts +3 -2
- package/build/cjs/components/YandexForm/YandexForm.js +11 -4
- package/build/cjs/constructor-items.d.ts +5 -5
- package/build/cjs/context/analyticsContext/analyticsContext.d.ts +3 -2
- package/build/cjs/hooks/useAnalytics.d.ts +2 -2
- package/build/cjs/hooks/useAnalytics.js +13 -7
- package/build/cjs/models/common.d.ts +8 -13
- package/build/cjs/models/common.js +7 -1
- package/build/cjs/models/constructor-items/blocks.d.ts +11 -0
- package/build/cjs/models/constructor-items/common.d.ts +11 -6
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +6 -3
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +3 -2
- package/build/cjs/schema/validators/common.d.ts +15 -0
- package/build/cjs/schema/validators/common.js +3 -1
- package/build/cjs/schema/validators/event.d.ts +3 -54
- package/build/cjs/schema/validators/event.js +3 -54
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +3 -2
- package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +3 -0
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -0
- package/build/cjs/sub-blocks/BannerCard/BannerCard.js +3 -2
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +3 -2
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.d.ts +1 -1
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.js +3 -2
- package/build/cjs/sub-blocks/Content/Content.js +4 -3
- package/build/cjs/sub-blocks/HubspotForm/index.js +9 -3
- package/build/cjs/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/cjs/sub-blocks/MediaCard/MediaCard.js +3 -2
- package/build/cjs/sub-blocks/Quote/Quote.js +11 -2
- package/build/cjs/sub-blocks/Quote/schema.d.ts +3 -0
- package/build/cjs/sub-blocks/Quote/schema.js +3 -1
- package/build/esm/blocks/Banner/Banner.js +3 -2
- package/build/esm/blocks/Banner/schema.d.ts +27 -0
- package/build/esm/blocks/Banner/schema.js +3 -1
- package/build/esm/blocks/CardLayout/schema.d.ts +6 -0
- package/build/esm/blocks/ContentLayout/ContentLayout.js +3 -2
- package/build/esm/blocks/ContentLayout/schema.d.ts +3 -0
- package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.d.ts +1 -1
- package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.js +3 -2
- package/build/esm/blocks/ExtendedFeatures/schema.d.ts +3 -0
- package/build/esm/blocks/Header/Header.js +6 -5
- package/build/esm/blocks/Header/schema.d.ts +159 -0
- package/build/esm/blocks/Header/schema.js +4 -0
- package/build/esm/blocks/HeaderSlider/schema.d.ts +81 -0
- package/build/esm/blocks/Icons/schema.d.ts +6 -0
- package/build/esm/blocks/Info/Info.js +4 -3
- package/build/esm/blocks/Info/schema.d.ts +3 -0
- package/build/esm/blocks/Info/schema.js +2 -0
- package/build/esm/blocks/LinkTable/schema.d.ts +3 -0
- package/build/esm/blocks/Media/Media.js +3 -2
- package/build/esm/blocks/Media/MediaContent.js +3 -2
- package/build/esm/blocks/Media/schema.d.ts +9 -0
- package/build/esm/blocks/Preview/MediaContent/MediaContent.d.ts +2 -1
- package/build/esm/blocks/Preview/MediaContent/MediaContent.js +3 -2
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.d.ts +1 -0
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.js +3 -2
- package/build/esm/blocks/Preview/Preview.js +3 -2
- package/build/esm/blocks/Preview/schema.d.ts +3 -0
- package/build/esm/blocks/Preview/schema.js +3 -1
- package/build/esm/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +3 -2
- package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/esm/blocks/Questions/Questions.js +3 -2
- package/build/esm/blocks/Questions/schema.d.ts +3 -0
- package/build/esm/blocks/Security/Security.js +3 -2
- package/build/esm/blocks/Security/schema.d.ts +3 -0
- package/build/esm/blocks/Security/schema.js +3 -1
- package/build/esm/blocks/Share/Share.d.ts +1 -1
- package/build/esm/blocks/Share/Share.js +12 -3
- package/build/esm/blocks/Simple/schema.d.ts +3 -0
- package/build/esm/blocks/Slider/schema.d.ts +3 -0
- package/build/esm/blocks/Table/schema.d.ts +3 -0
- package/build/esm/blocks/Tabs/Tabs.d.ts +1 -1
- package/build/esm/blocks/Tabs/Tabs.js +5 -4
- package/build/esm/blocks/Tabs/schema.d.ts +3 -0
- package/build/esm/components/BackLink/BackLink.d.ts +1 -0
- package/build/esm/components/BackLink/BackLink.js +12 -2
- package/build/esm/components/BackgroundMedia/BackgroundMedia.js +2 -1
- package/build/esm/components/Button/Button.d.ts +1 -0
- package/build/esm/components/Button/Button.js +12 -4
- package/build/esm/components/ButtonTabs/ButtonTabs.d.ts +1 -0
- package/build/esm/components/ButtonTabs/ButtonTabs.js +12 -2
- package/build/esm/components/CardBase/CardBase.d.ts +3 -2
- package/build/esm/components/CardBase/CardBase.js +12 -4
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.css +0 -30
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +4 -11
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.css +30 -0
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.d.ts +13 -0
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.js +24 -0
- package/build/esm/components/Link/Link.js +13 -5
- package/build/esm/components/Media/Media.js +4 -2
- package/build/esm/components/Media/Video/Video.js +5 -3
- package/build/esm/components/ReactPlayer/ReactPlayer.js +22 -27
- package/build/esm/components/YandexForm/YandexForm.d.ts +3 -2
- package/build/esm/components/YandexForm/YandexForm.js +12 -5
- package/build/esm/constructor-items.d.ts +5 -5
- package/build/esm/context/analyticsContext/analyticsContext.d.ts +3 -2
- package/build/esm/hooks/useAnalytics.d.ts +2 -2
- package/build/esm/hooks/useAnalytics.js +13 -7
- package/build/esm/models/common.d.ts +8 -13
- package/build/esm/models/common.js +6 -0
- package/build/esm/models/constructor-items/blocks.d.ts +11 -0
- package/build/esm/models/constructor-items/common.d.ts +11 -6
- package/build/esm/models/constructor-items/sub-blocks.d.ts +6 -3
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +3 -2
- package/build/esm/schema/validators/common.d.ts +15 -0
- package/build/esm/schema/validators/common.js +4 -2
- package/build/esm/schema/validators/event.d.ts +3 -54
- package/build/esm/schema/validators/event.js +2 -53
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +3 -2
- package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +3 -0
- package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -0
- package/build/esm/sub-blocks/BannerCard/BannerCard.js +3 -2
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +3 -2
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.d.ts +1 -1
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.js +3 -2
- package/build/esm/sub-blocks/Content/Content.js +4 -3
- package/build/esm/sub-blocks/HubspotForm/index.js +9 -3
- package/build/esm/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/esm/sub-blocks/MediaCard/MediaCard.js +3 -2
- package/build/esm/sub-blocks/Quote/Quote.js +13 -4
- package/build/esm/sub-blocks/Quote/schema.d.ts +3 -0
- package/build/esm/sub-blocks/Quote/schema.js +3 -1
- package/package.json +1 -1
- package/server/models/common.d.ts +8 -13
- package/server/models/common.js +7 -1
- package/server/models/constructor-items/blocks.d.ts +11 -0
- package/server/models/constructor-items/common.d.ts +11 -6
- 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
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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 `autoEvents: 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, autoEvents: 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;
|
|
@@ -206,6 +206,9 @@ export declare const BannerCardProps: {
|
|
|
206
206
|
};
|
|
207
207
|
};
|
|
208
208
|
};
|
|
209
|
+
blockName: {
|
|
210
|
+
type: string;
|
|
211
|
+
};
|
|
209
212
|
};
|
|
210
213
|
} | {
|
|
211
214
|
type: string;
|
|
@@ -241,6 +244,9 @@ export declare const BannerCardProps: {
|
|
|
241
244
|
};
|
|
242
245
|
};
|
|
243
246
|
};
|
|
247
|
+
blockName: {
|
|
248
|
+
type: string;
|
|
249
|
+
};
|
|
244
250
|
};
|
|
245
251
|
};
|
|
246
252
|
})[];
|
|
@@ -264,6 +270,9 @@ export declare const BannerCardProps: {
|
|
|
264
270
|
required: string[];
|
|
265
271
|
};
|
|
266
272
|
};
|
|
273
|
+
blockName: {
|
|
274
|
+
type: string;
|
|
275
|
+
};
|
|
267
276
|
animated: {
|
|
268
277
|
type: string;
|
|
269
278
|
};
|
|
@@ -480,6 +489,9 @@ export declare const BannerBlock: {
|
|
|
480
489
|
};
|
|
481
490
|
};
|
|
482
491
|
};
|
|
492
|
+
blockName: {
|
|
493
|
+
type: string;
|
|
494
|
+
};
|
|
483
495
|
};
|
|
484
496
|
} | {
|
|
485
497
|
type: string;
|
|
@@ -515,6 +527,9 @@ export declare const BannerBlock: {
|
|
|
515
527
|
};
|
|
516
528
|
};
|
|
517
529
|
};
|
|
530
|
+
blockName: {
|
|
531
|
+
type: string;
|
|
532
|
+
};
|
|
518
533
|
};
|
|
519
534
|
};
|
|
520
535
|
})[];
|
|
@@ -538,6 +553,9 @@ export declare const BannerBlock: {
|
|
|
538
553
|
required: string[];
|
|
539
554
|
};
|
|
540
555
|
};
|
|
556
|
+
blockName: {
|
|
557
|
+
type: string;
|
|
558
|
+
};
|
|
541
559
|
animated: {
|
|
542
560
|
type: string;
|
|
543
561
|
};
|
|
@@ -755,6 +773,9 @@ export declare const BannerCard: {
|
|
|
755
773
|
};
|
|
756
774
|
};
|
|
757
775
|
};
|
|
776
|
+
blockName: {
|
|
777
|
+
type: string;
|
|
778
|
+
};
|
|
758
779
|
};
|
|
759
780
|
} | {
|
|
760
781
|
type: string;
|
|
@@ -790,6 +811,9 @@ export declare const BannerCard: {
|
|
|
790
811
|
};
|
|
791
812
|
};
|
|
792
813
|
};
|
|
814
|
+
blockName: {
|
|
815
|
+
type: string;
|
|
816
|
+
};
|
|
793
817
|
};
|
|
794
818
|
};
|
|
795
819
|
})[];
|
|
@@ -813,6 +837,9 @@ export declare const BannerCard: {
|
|
|
813
837
|
required: string[];
|
|
814
838
|
};
|
|
815
839
|
};
|
|
840
|
+
blockName: {
|
|
841
|
+
type: string;
|
|
842
|
+
};
|
|
816
843
|
animated: {
|
|
817
844
|
type: string;
|
|
818
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 }))))));
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -274,6 +274,84 @@ export declare const HeaderProperties: {
|
|
|
274
274
|
type: string;
|
|
275
275
|
contentType: string;
|
|
276
276
|
};
|
|
277
|
+
analyticsEvents: {
|
|
278
|
+
anyOf: ({
|
|
279
|
+
type: string;
|
|
280
|
+
additionalProperties: {
|
|
281
|
+
type: string;
|
|
282
|
+
};
|
|
283
|
+
required: string[];
|
|
284
|
+
properties: {
|
|
285
|
+
name: {
|
|
286
|
+
type: string;
|
|
287
|
+
};
|
|
288
|
+
type: {
|
|
289
|
+
type: string;
|
|
290
|
+
};
|
|
291
|
+
counters: {
|
|
292
|
+
type: string;
|
|
293
|
+
additionalProperties: boolean;
|
|
294
|
+
required: never[];
|
|
295
|
+
properties: {
|
|
296
|
+
include: {
|
|
297
|
+
type: string;
|
|
298
|
+
items: {
|
|
299
|
+
type: string;
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
exclude: {
|
|
303
|
+
type: string;
|
|
304
|
+
items: {
|
|
305
|
+
type: string;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
blockName: {
|
|
311
|
+
type: string;
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
} | {
|
|
315
|
+
type: string;
|
|
316
|
+
items: {
|
|
317
|
+
type: string;
|
|
318
|
+
additionalProperties: {
|
|
319
|
+
type: string;
|
|
320
|
+
};
|
|
321
|
+
required: string[];
|
|
322
|
+
properties: {
|
|
323
|
+
name: {
|
|
324
|
+
type: string;
|
|
325
|
+
};
|
|
326
|
+
type: {
|
|
327
|
+
type: string;
|
|
328
|
+
};
|
|
329
|
+
counters: {
|
|
330
|
+
type: string;
|
|
331
|
+
additionalProperties: boolean;
|
|
332
|
+
required: never[];
|
|
333
|
+
properties: {
|
|
334
|
+
include: {
|
|
335
|
+
type: string;
|
|
336
|
+
items: {
|
|
337
|
+
type: string;
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
exclude: {
|
|
341
|
+
type: string;
|
|
342
|
+
items: {
|
|
343
|
+
type: string;
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
blockName: {
|
|
349
|
+
type: string;
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
})[];
|
|
354
|
+
};
|
|
277
355
|
};
|
|
278
356
|
};
|
|
279
357
|
imageSize: {
|
|
@@ -607,6 +685,84 @@ export declare const HeaderBlock: {
|
|
|
607
685
|
type: string;
|
|
608
686
|
contentType: string;
|
|
609
687
|
};
|
|
688
|
+
analyticsEvents: {
|
|
689
|
+
anyOf: ({
|
|
690
|
+
type: string;
|
|
691
|
+
additionalProperties: {
|
|
692
|
+
type: string;
|
|
693
|
+
};
|
|
694
|
+
required: string[];
|
|
695
|
+
properties: {
|
|
696
|
+
name: {
|
|
697
|
+
type: string;
|
|
698
|
+
};
|
|
699
|
+
type: {
|
|
700
|
+
type: string;
|
|
701
|
+
};
|
|
702
|
+
counters: {
|
|
703
|
+
type: string;
|
|
704
|
+
additionalProperties: boolean;
|
|
705
|
+
required: never[];
|
|
706
|
+
properties: {
|
|
707
|
+
include: {
|
|
708
|
+
type: string;
|
|
709
|
+
items: {
|
|
710
|
+
type: string;
|
|
711
|
+
};
|
|
712
|
+
};
|
|
713
|
+
exclude: {
|
|
714
|
+
type: string;
|
|
715
|
+
items: {
|
|
716
|
+
type: string;
|
|
717
|
+
};
|
|
718
|
+
};
|
|
719
|
+
};
|
|
720
|
+
};
|
|
721
|
+
blockName: {
|
|
722
|
+
type: string;
|
|
723
|
+
};
|
|
724
|
+
};
|
|
725
|
+
} | {
|
|
726
|
+
type: string;
|
|
727
|
+
items: {
|
|
728
|
+
type: string;
|
|
729
|
+
additionalProperties: {
|
|
730
|
+
type: string;
|
|
731
|
+
};
|
|
732
|
+
required: string[];
|
|
733
|
+
properties: {
|
|
734
|
+
name: {
|
|
735
|
+
type: string;
|
|
736
|
+
};
|
|
737
|
+
type: {
|
|
738
|
+
type: string;
|
|
739
|
+
};
|
|
740
|
+
counters: {
|
|
741
|
+
type: string;
|
|
742
|
+
additionalProperties: boolean;
|
|
743
|
+
required: never[];
|
|
744
|
+
properties: {
|
|
745
|
+
include: {
|
|
746
|
+
type: string;
|
|
747
|
+
items: {
|
|
748
|
+
type: string;
|
|
749
|
+
};
|
|
750
|
+
};
|
|
751
|
+
exclude: {
|
|
752
|
+
type: string;
|
|
753
|
+
items: {
|
|
754
|
+
type: string;
|
|
755
|
+
};
|
|
756
|
+
};
|
|
757
|
+
};
|
|
758
|
+
};
|
|
759
|
+
blockName: {
|
|
760
|
+
type: string;
|
|
761
|
+
};
|
|
762
|
+
};
|
|
763
|
+
};
|
|
764
|
+
})[];
|
|
765
|
+
};
|
|
610
766
|
};
|
|
611
767
|
};
|
|
612
768
|
imageSize: {
|
|
@@ -821,6 +977,9 @@ export declare const HeaderBlock: {
|
|
|
821
977
|
resetPaddings: {
|
|
822
978
|
type: string;
|
|
823
979
|
};
|
|
980
|
+
blockName: {
|
|
981
|
+
type: string;
|
|
982
|
+
};
|
|
824
983
|
type: {};
|
|
825
984
|
when: {};
|
|
826
985
|
};
|
|
@@ -4,6 +4,7 @@ exports.HeaderBlock = exports.HeaderProperties = exports.HeaderBackgroundProps =
|
|
|
4
4
|
const common_1 = require("../../schema/validators/common");
|
|
5
5
|
const utils_1 = require("../../schema/validators/utils");
|
|
6
6
|
const schema_1 = require("../../components/Image/schema");
|
|
7
|
+
const event_1 = require("src/schema/validators/event");
|
|
7
8
|
exports.HeaderBackgroundProps = {
|
|
8
9
|
type: 'object',
|
|
9
10
|
additionalProperties: false,
|
|
@@ -45,6 +46,9 @@ exports.HeaderProperties = {
|
|
|
45
46
|
type: 'string',
|
|
46
47
|
contentType: 'text',
|
|
47
48
|
},
|
|
49
|
+
analyticsEvents: {
|
|
50
|
+
anyOf: [event_1.AnalyticsEventSchema, { type: 'array', items: event_1.AnalyticsEventSchema }],
|
|
51
|
+
},
|
|
48
52
|
},
|
|
49
53
|
},
|
|
50
54
|
imageSize: {
|