@gravity-ui/page-constructor 1.15.0-alpha.10 → 1.15.0-alpha.12
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 +2 -2
- package/build/cjs/blocks/Header/schema.d.ts +156 -0
- package/build/cjs/blocks/Header/schema.js +4 -0
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +78 -0
- package/build/cjs/blocks/Share/Share.js +4 -3
- package/build/cjs/components/BackLink/BackLink.js +2 -1
- package/build/cjs/components/Button/Button.js +5 -3
- package/build/cjs/components/ButtonTabs/ButtonTabs.js +4 -3
- package/build/cjs/components/CardBase/CardBase.js +5 -3
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.css +0 -30
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +3 -16
- 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 +5 -3
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +13 -6
- package/build/cjs/components/YandexForm/YandexForm.js +4 -3
- package/build/cjs/context/analyticsContext/analyticsContext.d.ts +1 -1
- package/build/cjs/hooks/useAnalytics.d.ts +1 -1
- package/build/cjs/hooks/useAnalytics.js +6 -5
- package/build/cjs/models/common.d.ts +1 -4
- package/build/cjs/models/constructor-items/common.d.ts +4 -4
- package/build/cjs/sub-blocks/HubspotForm/index.js +4 -3
- package/build/cjs/sub-blocks/Quote/Quote.js +5 -3
- package/build/esm/blocks/Header/schema.d.ts +156 -0
- package/build/esm/blocks/Header/schema.js +4 -0
- package/build/esm/blocks/HeaderSlider/schema.d.ts +78 -0
- package/build/esm/blocks/Share/Share.js +5 -4
- package/build/esm/components/BackLink/BackLink.js +2 -1
- package/build/esm/components/Button/Button.js +6 -4
- package/build/esm/components/ButtonTabs/ButtonTabs.js +4 -3
- package/build/esm/components/CardBase/CardBase.js +6 -4
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.css +0 -30
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +3 -16
- 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 +6 -4
- package/build/esm/components/ReactPlayer/ReactPlayer.js +13 -6
- package/build/esm/components/YandexForm/YandexForm.js +5 -4
- package/build/esm/context/analyticsContext/analyticsContext.d.ts +1 -1
- package/build/esm/hooks/useAnalytics.d.ts +1 -1
- package/build/esm/hooks/useAnalytics.js +6 -5
- package/build/esm/models/common.d.ts +1 -4
- package/build/esm/models/constructor-items/common.d.ts +4 -4
- package/build/esm/sub-blocks/HubspotForm/index.js +4 -3
- package/build/esm/sub-blocks/Quote/Quote.js +6 -4
- package/package.json +1 -1
- package/server/models/common.d.ts +1 -4
- package/server/models/constructor-items/common.d.ts +4 -4
package/README.md
CHANGED
|
@@ -225,7 +225,7 @@ configure({lang: Lang.En});
|
|
|
225
225
|
|
|
226
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
227
|
|
|
228
|
-
Pass `
|
|
228
|
+
Pass `autoEvents: true` to constructor to fire automatically configured events.
|
|
229
229
|
|
|
230
230
|
```ts
|
|
231
231
|
function sendEvents(events: MyEventType []) {
|
|
@@ -235,7 +235,7 @@ function sendEvents(events: MyEventType []) {
|
|
|
235
235
|
<PageConstructorProvider
|
|
236
236
|
...
|
|
237
237
|
|
|
238
|
-
analytics={{sendEvents,
|
|
238
|
+
analytics={{sendEvents, autoEvents: true}}
|
|
239
239
|
|
|
240
240
|
...
|
|
241
241
|
/>
|
|
@@ -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: {
|
|
@@ -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("../../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: {
|
|
@@ -144,6 +144,84 @@ export declare const HeaderSliderBlock: {
|
|
|
144
144
|
type: string;
|
|
145
145
|
contentType: string;
|
|
146
146
|
};
|
|
147
|
+
analyticsEvents: {
|
|
148
|
+
anyOf: ({
|
|
149
|
+
type: string;
|
|
150
|
+
additionalProperties: {
|
|
151
|
+
type: string;
|
|
152
|
+
};
|
|
153
|
+
required: string[];
|
|
154
|
+
properties: {
|
|
155
|
+
name: {
|
|
156
|
+
type: string;
|
|
157
|
+
};
|
|
158
|
+
type: {
|
|
159
|
+
type: string;
|
|
160
|
+
};
|
|
161
|
+
counters: {
|
|
162
|
+
type: string;
|
|
163
|
+
additionalProperties: boolean;
|
|
164
|
+
required: never[];
|
|
165
|
+
properties: {
|
|
166
|
+
include: {
|
|
167
|
+
type: string;
|
|
168
|
+
items: {
|
|
169
|
+
type: string;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
exclude: {
|
|
173
|
+
type: string;
|
|
174
|
+
items: {
|
|
175
|
+
type: string;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
blockName: {
|
|
181
|
+
type: string;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
} | {
|
|
185
|
+
type: string;
|
|
186
|
+
items: {
|
|
187
|
+
type: string;
|
|
188
|
+
additionalProperties: {
|
|
189
|
+
type: string;
|
|
190
|
+
};
|
|
191
|
+
required: string[];
|
|
192
|
+
properties: {
|
|
193
|
+
name: {
|
|
194
|
+
type: string;
|
|
195
|
+
};
|
|
196
|
+
type: {
|
|
197
|
+
type: string;
|
|
198
|
+
};
|
|
199
|
+
counters: {
|
|
200
|
+
type: string;
|
|
201
|
+
additionalProperties: boolean;
|
|
202
|
+
required: never[];
|
|
203
|
+
properties: {
|
|
204
|
+
include: {
|
|
205
|
+
type: string;
|
|
206
|
+
items: {
|
|
207
|
+
type: string;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
exclude: {
|
|
211
|
+
type: string;
|
|
212
|
+
items: {
|
|
213
|
+
type: string;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
blockName: {
|
|
219
|
+
type: string;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
})[];
|
|
224
|
+
};
|
|
147
225
|
};
|
|
148
226
|
};
|
|
149
227
|
imageSize: {
|
|
@@ -23,12 +23,13 @@ const icons = {
|
|
|
23
23
|
const b = (0, utils_1.block)('share-block');
|
|
24
24
|
const Share = ({ items, title, blockName = models_1.BlockType.ShareBlock }) => {
|
|
25
25
|
const { pathname, hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
26
|
-
const
|
|
26
|
+
const defaultEvent = (0, react_1.useMemo)(() => ({
|
|
27
27
|
name: 'share-button-click',
|
|
28
28
|
type: models_1.PredefinedEventTypes.Default,
|
|
29
29
|
blockName: blockName,
|
|
30
|
-
});
|
|
31
|
-
const
|
|
30
|
+
}), [blockName]);
|
|
31
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(defaultEvent);
|
|
32
|
+
const handleButtonClick = (0, react_1.useCallback)(() => handleAnalytics(), [handleAnalytics]);
|
|
32
33
|
return (react_1.default.createElement("div", { className: b() },
|
|
33
34
|
react_1.default.createElement("h5", { className: b('title') }, title || (0, i18n_1.default)('constructor-share')),
|
|
34
35
|
react_1.default.createElement("div", { className: b('items') }, items.map((type) => {
|
|
@@ -15,9 +15,10 @@ function BackLink(props) {
|
|
|
15
15
|
name: 'back-link-click',
|
|
16
16
|
type: models_1.PredefinedEventTypes.Default,
|
|
17
17
|
blockName: blockName,
|
|
18
|
+
target: url,
|
|
18
19
|
});
|
|
19
20
|
const backActionHandler = (0, react_1.useCallback)(async () => {
|
|
20
|
-
handleAnalytics
|
|
21
|
+
handleAnalytics();
|
|
21
22
|
if (!history) {
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
@@ -17,14 +17,16 @@ const Button = (props) => {
|
|
|
17
17
|
const { lang, tld } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
18
18
|
const { className, metrikaGoals, pixelEvents, analyticsEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text, blockName = COMPONENT_NAME } = props, rest = tslib_1.__rest(props, ["className", "metrikaGoals", "pixelEvents", "analyticsEvents", "size", "theme", "url", "img", "onClick", "text", "blockName"]);
|
|
19
19
|
const defaultImgPosition = 'left';
|
|
20
|
-
const
|
|
20
|
+
const defaultEvent = (0, react_1.useMemo)(() => ({
|
|
21
21
|
name: 'button-click',
|
|
22
22
|
type: models_1.PredefinedEventTypes.Default,
|
|
23
23
|
blockName: blockName,
|
|
24
|
-
|
|
24
|
+
target: url,
|
|
25
|
+
}), [blockName, url]);
|
|
26
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(defaultEvent);
|
|
25
27
|
const onClick = (0, react_1.useCallback)(() => {
|
|
26
28
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
27
|
-
handleAnalytics
|
|
29
|
+
handleAnalytics(analyticsEvents);
|
|
28
30
|
if (onClickOrigin) {
|
|
29
31
|
onClickOrigin();
|
|
30
32
|
}
|
|
@@ -10,11 +10,12 @@ const b = (0, utils_1.block)('button-tabs');
|
|
|
10
10
|
const COMPONENT_NAME = 'button-tabs';
|
|
11
11
|
const ButtonTabs = (props) => {
|
|
12
12
|
const { className, items, activeTab, onSelectTab, blockName = COMPONENT_NAME } = props;
|
|
13
|
-
const
|
|
13
|
+
const defaultEvent = (0, react_1.useMemo)(() => ({
|
|
14
14
|
name: 'button-tabs-click',
|
|
15
15
|
type: models_1.PredefinedEventTypes.Default,
|
|
16
16
|
blockName: blockName,
|
|
17
|
-
});
|
|
17
|
+
}), [blockName]);
|
|
18
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(defaultEvent);
|
|
18
19
|
const activeTabId = (0, react_1.useMemo)(() => {
|
|
19
20
|
if (activeTab) {
|
|
20
21
|
return activeTab;
|
|
@@ -22,7 +23,7 @@ const ButtonTabs = (props) => {
|
|
|
22
23
|
return items[0].id;
|
|
23
24
|
}, [activeTab, items]);
|
|
24
25
|
const handleClick = (0, react_1.useCallback)((tabId) => {
|
|
25
|
-
handleAnalytics
|
|
26
|
+
handleAnalytics();
|
|
26
27
|
if (onSelectTab) {
|
|
27
28
|
onSelectTab(tabId);
|
|
28
29
|
}
|
|
@@ -17,11 +17,13 @@ const Footer = () => null;
|
|
|
17
17
|
const Layout = (props) => {
|
|
18
18
|
const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', blockName = COMPONENT_NAME, } = props;
|
|
19
19
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
20
|
-
const
|
|
20
|
+
const defaultEvent = (0, react_1.useMemo)(() => ({
|
|
21
21
|
name: 'card-base-click',
|
|
22
22
|
type: common_1.PredefinedEventTypes.Default,
|
|
23
23
|
blockName: blockName,
|
|
24
|
-
|
|
24
|
+
target: url,
|
|
25
|
+
}), [blockName, url]);
|
|
26
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(defaultEvent);
|
|
25
27
|
let header, content, footer, image, headerClass, footerClass;
|
|
26
28
|
function handleChild(child) {
|
|
27
29
|
switch (child.type) {
|
|
@@ -54,7 +56,7 @@ const Layout = (props) => {
|
|
|
54
56
|
const fullClassName = b({ border }, className);
|
|
55
57
|
const onClick = () => {
|
|
56
58
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
57
|
-
handleAnalytics
|
|
59
|
+
handleAnalytics(analyticsEvents);
|
|
58
60
|
};
|
|
59
61
|
return url ? (react_1.default.createElement(RouterLink_1.default, { href: url },
|
|
60
62
|
react_1.default.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick }, cardContent))) : (react_1.default.createElement("div", { className: fullClassName }, cardContent));
|
|
@@ -1,36 +1,6 @@
|
|
|
1
|
-
@charset "UTF-8";
|
|
2
|
-
/* use this for style redefinitions to awoid problems with
|
|
3
|
-
unpredictable css rules order in build */
|
|
4
1
|
.pc-header-breadcrumbs {
|
|
5
2
|
z-index: 11;
|
|
6
3
|
}
|
|
7
|
-
.pc-header-breadcrumbs__item {
|
|
8
|
-
display: inline-block;
|
|
9
|
-
}
|
|
10
|
-
.pc-header-breadcrumbs__text {
|
|
11
|
-
font-size: var(--yc-text-body-2-font-size);
|
|
12
|
-
line-height: var(--yc-text-body-2-line-height);
|
|
13
|
-
outline: none;
|
|
14
|
-
color: var(--yc-color-text-link);
|
|
15
|
-
text-decoration: none;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
color: var(--yc-color-text-secondary);
|
|
18
|
-
}
|
|
19
|
-
.utilityfocus .pc-header-breadcrumbs__text:focus {
|
|
20
|
-
outline: 2px solid #ffdb4d;
|
|
21
|
-
}
|
|
22
|
-
.pc-header-breadcrumbs__text:hover, .pc-header-breadcrumbs__text:active {
|
|
23
|
-
--pc-text-header-color: var(--yc-color-text-link-hover);
|
|
24
|
-
color: var(--yc-color-text-link-hover);
|
|
25
|
-
}
|
|
26
|
-
.pc-header-breadcrumbs__text:after {
|
|
27
|
-
content: " / ";
|
|
28
|
-
margin: 0 8px 0 6px;
|
|
29
|
-
color: var(--yc-color-text-secondary);
|
|
30
|
-
}
|
|
31
|
-
.pc-header-breadcrumbs__text:hover {
|
|
32
|
-
color: var(--yc-color-text-primary);
|
|
33
|
-
}
|
|
34
4
|
.pc-header-breadcrumbs_theme_dark .pc-header-breadcrumbs__text {
|
|
35
5
|
color: var(--yc-color-text-light-secondary);
|
|
36
6
|
}
|
|
@@ -3,24 +3,11 @@ 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
|
|
7
|
-
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
8
|
-
const hooks_1 = require("../../hooks");
|
|
6
|
+
const HeaderBreadcrumbsItem_1 = tslib_1.__importDefault(require("./HeaderBreadcrumbsItem"));
|
|
9
7
|
const b = (0, utils_1.block)('header-breadcrumbs');
|
|
10
8
|
const COMPONENT_NAME = 'header-breadcrumbs';
|
|
11
9
|
function HeaderBreadcrumbs(props) {
|
|
12
|
-
const { items, metrikaGoals, pixelEvents,
|
|
13
|
-
|
|
14
|
-
const handleAnalytics = (0, hooks_1.useAnalytics)({
|
|
15
|
-
name: 'header-breadcrumbs-click',
|
|
16
|
-
type: models_1.PredefinedEventTypes.Default,
|
|
17
|
-
blockName: blockName,
|
|
18
|
-
});
|
|
19
|
-
const onClick = () => {
|
|
20
|
-
handleMetrika({ metrikaGoals, pixelEvents });
|
|
21
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
22
|
-
};
|
|
23
|
-
return (react_1.default.createElement("div", { className: b({ theme }, className) }, items.map((item) => (react_1.default.createElement("div", { className: b('item'), key: item.url },
|
|
24
|
-
react_1.default.createElement("a", { href: item.url, className: b('text'), onClick: onClick }, item.text))))));
|
|
10
|
+
const { items, metrikaGoals, pixelEvents, theme = 'light', blockName = COMPONENT_NAME, className, } = props;
|
|
11
|
+
return (react_1.default.createElement("div", { className: b({ theme }, className) }, items.map((item) => (react_1.default.createElement(HeaderBreadcrumbsItem_1.default, { key: item.url, url: item.url, text: item.text, metrikaGoals: metrikaGoals, pixelEvents: pixelEvents, analyticsEvents: item.analyticsEvents, blockName: blockName })))));
|
|
25
12
|
}
|
|
26
13
|
exports.default = HeaderBreadcrumbs;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/* use this for style redefinitions to awoid problems with
|
|
3
|
+
unpredictable css rules order in build */
|
|
4
|
+
.pc-header-breadcrumbs-item__item {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
}
|
|
7
|
+
.pc-header-breadcrumbs-item__text {
|
|
8
|
+
font-size: var(--yc-text-body-2-font-size);
|
|
9
|
+
line-height: var(--yc-text-body-2-line-height);
|
|
10
|
+
outline: none;
|
|
11
|
+
color: var(--yc-color-text-link);
|
|
12
|
+
text-decoration: none;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
color: var(--yc-color-text-secondary);
|
|
15
|
+
}
|
|
16
|
+
.utilityfocus .pc-header-breadcrumbs-item__text:focus {
|
|
17
|
+
outline: 2px solid #ffdb4d;
|
|
18
|
+
}
|
|
19
|
+
.pc-header-breadcrumbs-item__text:hover, .pc-header-breadcrumbs-item__text:active {
|
|
20
|
+
--pc-text-header-color: var(--yc-color-text-link-hover);
|
|
21
|
+
color: var(--yc-color-text-link-hover);
|
|
22
|
+
}
|
|
23
|
+
.pc-header-breadcrumbs-item__text:after {
|
|
24
|
+
content: " / ";
|
|
25
|
+
margin: 0 8px 0 6px;
|
|
26
|
+
color: var(--yc-color-text-secondary);
|
|
27
|
+
}
|
|
28
|
+
.pc-header-breadcrumbs-item__text:hover {
|
|
29
|
+
color: var(--yc-color-text-primary);
|
|
30
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AnalyticsEvent, ButtonPixel, MetrikaGoal } from '../../models';
|
|
3
|
+
type HeaderBreadcrumbsItemProps = {
|
|
4
|
+
url: string;
|
|
5
|
+
text: ReactNode;
|
|
6
|
+
metrikaGoals?: MetrikaGoal;
|
|
7
|
+
pixelEvents?: ButtonPixel;
|
|
8
|
+
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
9
|
+
blockName?: string;
|
|
10
|
+
};
|
|
11
|
+
export default function HeaderBreadcrumbsItem({ url, text, metrikaGoals, pixelEvents, analyticsEvents, blockName, }: HeaderBreadcrumbsItemProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
const models_1 = require("../../models");
|
|
7
|
+
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const b = (0, utils_1.block)('header-breadcrumbs-item');
|
|
10
|
+
const COMPONENT_NAME = 'header-breadcrumbs-item';
|
|
11
|
+
function HeaderBreadcrumbsItem({ url, text, metrikaGoals, pixelEvents, analyticsEvents, blockName = COMPONENT_NAME, }) {
|
|
12
|
+
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
13
|
+
const defaultEvent = (0, react_1.useMemo)(() => ({
|
|
14
|
+
name: 'header-breadcrumbs-click',
|
|
15
|
+
type: models_1.PredefinedEventTypes.Default,
|
|
16
|
+
blockName: blockName,
|
|
17
|
+
target: url,
|
|
18
|
+
}), [blockName, url]);
|
|
19
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(defaultEvent);
|
|
20
|
+
const onClick = () => {
|
|
21
|
+
handleMetrika({ metrikaGoals, pixelEvents });
|
|
22
|
+
handleAnalytics(analyticsEvents);
|
|
23
|
+
};
|
|
24
|
+
return (react_1.default.createElement("div", { className: b('item'), key: url },
|
|
25
|
+
react_1.default.createElement("a", { href: url, className: b('text'), onClick: onClick }, text)));
|
|
26
|
+
}
|
|
27
|
+
exports.default = HeaderBreadcrumbsItem;
|
|
@@ -30,18 +30,20 @@ function getArrowSize(size) {
|
|
|
30
30
|
const LinkBlock = (props) => {
|
|
31
31
|
const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, blockName = COMPONENT_NAME, } = props;
|
|
32
32
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
33
|
-
const
|
|
33
|
+
const defaultEvent = (0, react_1.useMemo)(() => ({
|
|
34
34
|
name: 'link-click',
|
|
35
35
|
type: models_1.PredefinedEventTypes.Default,
|
|
36
36
|
blockName: blockName,
|
|
37
|
-
|
|
37
|
+
target: url,
|
|
38
|
+
}), [blockName, url]);
|
|
39
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(defaultEvent);
|
|
38
40
|
const { hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
39
41
|
const { tld } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
40
42
|
const href = (0, utils_1.setUrlTld)(props.url, tld);
|
|
41
43
|
const defaultTextSize = theme === 'back' ? 'l' : 'm';
|
|
42
44
|
const onClick = () => {
|
|
43
45
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
44
|
-
handleAnalytics
|
|
46
|
+
handleAnalytics(analyticsEvents);
|
|
45
47
|
};
|
|
46
48
|
const getLinkByType = () => {
|
|
47
49
|
switch (theme) {
|
|
@@ -36,11 +36,18 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
36
36
|
const [started, setStarted] = (0, react_1.useState)(autoPlay);
|
|
37
37
|
const [paused, setPaused] = (0, react_1.useState)(false);
|
|
38
38
|
const [ended, setEnded] = (0, react_1.useState)(false);
|
|
39
|
-
const
|
|
39
|
+
const eventsArray = (0, react_1.useMemo)(() => {
|
|
40
|
+
if (analyticsEvents) {
|
|
41
|
+
return Array.isArray(analyticsEvents) ? analyticsEvents : [analyticsEvents];
|
|
42
|
+
}
|
|
43
|
+
return [];
|
|
44
|
+
}, [analyticsEvents]);
|
|
45
|
+
const defaultEvent = (0, react_1.useMemo)(() => ({
|
|
40
46
|
name: 'react-player-controls-click',
|
|
41
47
|
type: models_1.PredefinedEventTypes.Default,
|
|
42
48
|
blockName: blockName,
|
|
43
|
-
});
|
|
49
|
+
}), [blockName]);
|
|
50
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(defaultEvent);
|
|
44
51
|
(0, react_1.useImperativeHandle)(originRef, () => ({
|
|
45
52
|
pause: () => setIsPlaying(false),
|
|
46
53
|
}));
|
|
@@ -89,8 +96,8 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
89
96
|
window.removeEventListener('resize', updateSize);
|
|
90
97
|
};
|
|
91
98
|
}, []);
|
|
92
|
-
const playEvents = (0, react_1.useMemo)(() =>
|
|
93
|
-
const stopEvents = (0, react_1.useMemo)(() =>
|
|
99
|
+
const playEvents = (0, react_1.useMemo)(() => eventsArray === null || eventsArray === void 0 ? void 0 : eventsArray.filter((e) => e.type === models_1.PredefinedEventTypes.Play), [eventsArray]);
|
|
100
|
+
const stopEvents = (0, react_1.useMemo)(() => eventsArray === null || eventsArray === void 0 ? void 0 : eventsArray.filter((e) => e.type === models_1.PredefinedEventTypes.Stop), [eventsArray]);
|
|
94
101
|
const playIcon = (0, react_1.useMemo)(() => {
|
|
95
102
|
let playButtonContent;
|
|
96
103
|
switch (type) {
|
|
@@ -117,7 +124,7 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
117
124
|
}
|
|
118
125
|
}
|
|
119
126
|
const events = isMuted ? playEvents : stopEvents;
|
|
120
|
-
handleAnalytics
|
|
127
|
+
handleAnalytics(events);
|
|
121
128
|
if (isMuted) {
|
|
122
129
|
setProps({ playingVideoRef: ref.current });
|
|
123
130
|
}
|
|
@@ -134,7 +141,7 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
134
141
|
metrika.reachGoals(play, counterName);
|
|
135
142
|
}
|
|
136
143
|
}
|
|
137
|
-
handleAnalytics
|
|
144
|
+
handleAnalytics(playEvents);
|
|
138
145
|
}, [onClickPreview, metrika, videoMetrika, handleAnalytics, playEvents]);
|
|
139
146
|
const onPause = (0, react_1.useCallback)(() => {
|
|
140
147
|
// For support correct state for youtube
|
|
@@ -20,11 +20,12 @@ const YandexForm = (props) => {
|
|
|
20
20
|
const iframeRef = (0, react_1.useRef)();
|
|
21
21
|
const yaFormOrigin = customFormOrigin || exports.YANDEX_FORM_ORIGIN;
|
|
22
22
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
23
|
-
const
|
|
23
|
+
const defaultEvent = (0, react_1.useMemo)(() => ({
|
|
24
24
|
name: 'yndex-form-submit',
|
|
25
25
|
type: common_1.PredefinedEventTypes.Default,
|
|
26
26
|
blockName: blockName,
|
|
27
|
-
});
|
|
27
|
+
}), [blockName]);
|
|
28
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)(defaultEvent);
|
|
28
29
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
29
30
|
const locale = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
30
31
|
const updateFormIframe = (0, react_1.useCallback)((container) => {
|
|
@@ -65,7 +66,7 @@ const YandexForm = (props) => {
|
|
|
65
66
|
window.scrollBy(0, top - headerHeight);
|
|
66
67
|
}
|
|
67
68
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
68
|
-
handleAnalytics
|
|
69
|
+
handleAnalytics(analyticsEvents);
|
|
69
70
|
if (onSubmit) {
|
|
70
71
|
onSubmit();
|
|
71
72
|
}
|
|
@@ -2,6 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { AnalyticsEvent } from '../../models';
|
|
3
3
|
export interface AnalyticsContextProps {
|
|
4
4
|
sendEvents?: (events: AnalyticsEvent[]) => void;
|
|
5
|
-
|
|
5
|
+
autoEvents?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare const AnalyticsContext: React.Context<AnalyticsContextProps>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AnalyticsEvent } from '../models';
|
|
2
|
-
export declare const useAnalytics: (defaultEvent?: AnalyticsEvent) => ((e?: AnalyticsEvent | AnalyticsEvent[]) => void)
|
|
2
|
+
export declare const useAnalytics: (defaultEvent?: AnalyticsEvent) => ((e?: AnalyticsEvent | AnalyticsEvent[]) => void) & import("lodash").MemoizedFunction;
|