@gravity-ui/page-constructor 1.14.0-alpha.8 → 1.15.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/build/cjs/blocks/Banner/schema.d.ts +36 -138
- package/build/cjs/blocks/Media/schema.d.ts +12 -46
- package/build/cjs/components/Button/Button.js +3 -3
- package/build/cjs/components/CardBase/CardBase.d.ts +2 -2
- package/build/cjs/components/CardBase/CardBase.js +3 -3
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +3 -3
- package/build/cjs/components/Link/Link.js +3 -3
- package/build/cjs/components/Media/Media.js +3 -2
- package/build/cjs/components/Media/Video/Video.js +4 -3
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +27 -3
- package/build/cjs/components/YandexForm/YandexForm.d.ts +2 -2
- package/build/cjs/components/YandexForm/YandexForm.js +3 -3
- package/build/cjs/context/analyticsContext/analyticsContext.d.ts +2 -2
- package/build/cjs/hooks/index.d.ts +1 -0
- package/build/cjs/hooks/index.js +1 -0
- package/build/cjs/hooks/useAnalytics.d.ts +2 -2
- package/build/cjs/hooks/useAnalytics.js +4 -1
- package/build/cjs/models/common.d.ts +11 -5
- package/build/cjs/models/constructor-items/common.d.ts +6 -4
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +2 -2
- package/build/cjs/models/navigation.d.ts +1 -3
- package/build/cjs/navigation/components/Header/Header.css +5 -3
- package/build/cjs/navigation/components/Logo/Logo.css +5 -6
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.css +1 -0
- package/build/cjs/navigation/schema.d.ts +60 -0
- package/build/cjs/navigation/schema.js +80 -0
- package/build/cjs/schema/index.d.ts +67 -0
- package/build/cjs/schema/index.js +2 -1
- package/build/cjs/schema/validators/common.d.ts +24 -92
- package/build/cjs/schema/validators/common.js +1 -1
- package/build/cjs/schema/validators/event.d.ts +37 -0
- package/build/cjs/schema/validators/event.js +34 -1
- package/build/cjs/schema/validators/index.d.ts +2 -0
- package/build/cjs/schema/validators/index.js +2 -0
- package/build/cjs/schema/validators/navigation.d.ts +1 -0
- package/build/cjs/schema/validators/navigation.js +4 -0
- package/build/cjs/sub-blocks/HubspotForm/index.js +2 -3
- package/build/cjs/text-transform/blocks.js +1 -10
- package/build/esm/blocks/Banner/schema.d.ts +36 -138
- package/build/esm/blocks/Media/schema.d.ts +12 -46
- package/build/esm/components/Button/Button.js +2 -2
- package/build/esm/components/CardBase/CardBase.d.ts +2 -2
- package/build/esm/components/CardBase/CardBase.js +2 -2
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +2 -2
- package/build/esm/components/Link/Link.js +2 -2
- package/build/esm/components/Media/Media.js +3 -2
- package/build/esm/components/Media/Video/Video.js +4 -3
- package/build/esm/components/ReactPlayer/ReactPlayer.js +27 -3
- package/build/esm/components/YandexForm/YandexForm.d.ts +2 -2
- package/build/esm/components/YandexForm/YandexForm.js +2 -2
- package/build/esm/context/analyticsContext/analyticsContext.d.ts +2 -2
- package/build/esm/hooks/index.d.ts +1 -0
- package/build/esm/hooks/index.js +1 -0
- package/build/esm/hooks/useAnalytics.d.ts +2 -2
- package/build/esm/hooks/useAnalytics.js +4 -1
- package/build/esm/models/common.d.ts +11 -5
- package/build/esm/models/constructor-items/common.d.ts +6 -4
- package/build/esm/models/constructor-items/sub-blocks.d.ts +2 -2
- package/build/esm/models/navigation.d.ts +1 -3
- package/build/esm/navigation/components/Header/Header.css +5 -3
- package/build/esm/navigation/components/Logo/Logo.css +5 -6
- package/build/esm/navigation/components/NavigationItem/NavigationItem.css +1 -0
- package/build/esm/navigation/schema.d.ts +60 -0
- package/build/esm/navigation/schema.js +77 -0
- package/build/esm/schema/index.d.ts +67 -0
- package/build/esm/schema/index.js +2 -1
- package/build/esm/schema/validators/common.d.ts +24 -92
- package/build/esm/schema/validators/common.js +2 -2
- package/build/esm/schema/validators/event.d.ts +37 -0
- package/build/esm/schema/validators/event.js +33 -0
- package/build/esm/schema/validators/index.d.ts +2 -0
- package/build/esm/schema/validators/index.js +2 -0
- package/build/esm/schema/validators/navigation.d.ts +1 -0
- package/build/esm/schema/validators/navigation.js +1 -0
- package/build/esm/sub-blocks/HubspotForm/index.js +2 -3
- package/build/esm/text-transform/blocks.js +1 -10
- package/package.json +1 -1
- package/server/models/common.d.ts +11 -5
- package/server/models/constructor-items/common.d.ts +6 -4
- package/server/models/constructor-items/sub-blocks.d.ts +2 -2
- package/server/models/navigation.d.ts +1 -3
- package/server/text-transform/blocks.js +1 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.14.0](https://github.com/gravity-ui/page-constructor/compare/v1.13.2...v1.14.0) (2023-01-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **Navigation:** add schema validation ([#120](https://github.com/gravity-ui/page-constructor/issues/120)) ([a6c8dec](https://github.com/gravity-ui/page-constructor/commit/a6c8decf04f402113a5a31d2635721ffcc1b233c))
|
|
9
|
+
|
|
10
|
+
## [1.13.2](https://github.com/gravity-ui/page-constructor/compare/v1.13.1...v1.13.2) (2023-01-20)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **PromoFeaturesBlock:** transform items ([#118](https://github.com/gravity-ui/page-constructor/issues/118)) ([4c1cc7a](https://github.com/gravity-ui/page-constructor/commit/4c1cc7a38f2d789ce1c723b9695b7c1ed3e3cdf8))
|
|
16
|
+
|
|
17
|
+
## [1.13.1](https://github.com/gravity-ui/page-constructor/compare/v1.13.0...v1.13.1) (2023-01-19)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **Navigation:** logo and button specifity styles ([#116](https://github.com/gravity-ui/page-constructor/issues/116)) ([dbe0c39](https://github.com/gravity-ui/page-constructor/commit/dbe0c39aa88aac8a3e84c079d7de400e9a9b3d2f))
|
|
23
|
+
|
|
3
24
|
## [1.13.0](https://github.com/gravity-ui/page-constructor/compare/v1.12.1...v1.13.0) (2023-01-18)
|
|
4
25
|
|
|
5
26
|
|
|
@@ -176,7 +176,12 @@ export declare const BannerCardProps: {
|
|
|
176
176
|
analyticsEvents: {
|
|
177
177
|
anyOf: ({
|
|
178
178
|
type: string;
|
|
179
|
-
|
|
179
|
+
propertyNames: {
|
|
180
|
+
type: string;
|
|
181
|
+
};
|
|
182
|
+
additionalProperty: {
|
|
183
|
+
type: string;
|
|
184
|
+
};
|
|
180
185
|
required: string[];
|
|
181
186
|
properties: {
|
|
182
187
|
name: {
|
|
@@ -204,34 +209,17 @@ export declare const BannerCardProps: {
|
|
|
204
209
|
};
|
|
205
210
|
};
|
|
206
211
|
};
|
|
207
|
-
category: {
|
|
208
|
-
type: string;
|
|
209
|
-
};
|
|
210
|
-
label: {
|
|
211
|
-
type: string;
|
|
212
|
-
};
|
|
213
|
-
params: {
|
|
214
|
-
type: string;
|
|
215
|
-
items: {
|
|
216
|
-
type: string;
|
|
217
|
-
additionalProperties: boolean;
|
|
218
|
-
required: string[];
|
|
219
|
-
properties: {
|
|
220
|
-
key: {
|
|
221
|
-
type: string;
|
|
222
|
-
};
|
|
223
|
-
value: {
|
|
224
|
-
type: string;
|
|
225
|
-
};
|
|
226
|
-
};
|
|
227
|
-
};
|
|
228
|
-
};
|
|
229
212
|
};
|
|
230
213
|
} | {
|
|
231
214
|
type: string;
|
|
232
215
|
items: {
|
|
233
216
|
type: string;
|
|
234
|
-
|
|
217
|
+
propertyNames: {
|
|
218
|
+
type: string;
|
|
219
|
+
};
|
|
220
|
+
additionalProperty: {
|
|
221
|
+
type: string;
|
|
222
|
+
};
|
|
235
223
|
required: string[];
|
|
236
224
|
properties: {
|
|
237
225
|
name: {
|
|
@@ -259,28 +247,6 @@ export declare const BannerCardProps: {
|
|
|
259
247
|
};
|
|
260
248
|
};
|
|
261
249
|
};
|
|
262
|
-
category: {
|
|
263
|
-
type: string;
|
|
264
|
-
};
|
|
265
|
-
label: {
|
|
266
|
-
type: string;
|
|
267
|
-
};
|
|
268
|
-
params: {
|
|
269
|
-
type: string;
|
|
270
|
-
items: {
|
|
271
|
-
type: string;
|
|
272
|
-
additionalProperties: boolean;
|
|
273
|
-
required: string[];
|
|
274
|
-
properties: {
|
|
275
|
-
key: {
|
|
276
|
-
type: string;
|
|
277
|
-
};
|
|
278
|
-
value: {
|
|
279
|
-
type: string;
|
|
280
|
-
};
|
|
281
|
-
};
|
|
282
|
-
};
|
|
283
|
-
};
|
|
284
250
|
};
|
|
285
251
|
};
|
|
286
252
|
})[];
|
|
@@ -490,7 +456,12 @@ export declare const BannerBlock: {
|
|
|
490
456
|
analyticsEvents: {
|
|
491
457
|
anyOf: ({
|
|
492
458
|
type: string;
|
|
493
|
-
|
|
459
|
+
propertyNames: {
|
|
460
|
+
type: string;
|
|
461
|
+
};
|
|
462
|
+
additionalProperty: {
|
|
463
|
+
type: string;
|
|
464
|
+
};
|
|
494
465
|
required: string[];
|
|
495
466
|
properties: {
|
|
496
467
|
name: {
|
|
@@ -518,34 +489,17 @@ export declare const BannerBlock: {
|
|
|
518
489
|
};
|
|
519
490
|
};
|
|
520
491
|
};
|
|
521
|
-
category: {
|
|
522
|
-
type: string;
|
|
523
|
-
};
|
|
524
|
-
label: {
|
|
525
|
-
type: string;
|
|
526
|
-
};
|
|
527
|
-
params: {
|
|
528
|
-
type: string;
|
|
529
|
-
items: {
|
|
530
|
-
type: string;
|
|
531
|
-
additionalProperties: boolean;
|
|
532
|
-
required: string[];
|
|
533
|
-
properties: {
|
|
534
|
-
key: {
|
|
535
|
-
type: string;
|
|
536
|
-
};
|
|
537
|
-
value: {
|
|
538
|
-
type: string;
|
|
539
|
-
};
|
|
540
|
-
};
|
|
541
|
-
};
|
|
542
|
-
};
|
|
543
492
|
};
|
|
544
493
|
} | {
|
|
545
494
|
type: string;
|
|
546
495
|
items: {
|
|
547
496
|
type: string;
|
|
548
|
-
|
|
497
|
+
propertyNames: {
|
|
498
|
+
type: string;
|
|
499
|
+
};
|
|
500
|
+
additionalProperty: {
|
|
501
|
+
type: string;
|
|
502
|
+
};
|
|
549
503
|
required: string[];
|
|
550
504
|
properties: {
|
|
551
505
|
name: {
|
|
@@ -573,28 +527,6 @@ export declare const BannerBlock: {
|
|
|
573
527
|
};
|
|
574
528
|
};
|
|
575
529
|
};
|
|
576
|
-
category: {
|
|
577
|
-
type: string;
|
|
578
|
-
};
|
|
579
|
-
label: {
|
|
580
|
-
type: string;
|
|
581
|
-
};
|
|
582
|
-
params: {
|
|
583
|
-
type: string;
|
|
584
|
-
items: {
|
|
585
|
-
type: string;
|
|
586
|
-
additionalProperties: boolean;
|
|
587
|
-
required: string[];
|
|
588
|
-
properties: {
|
|
589
|
-
key: {
|
|
590
|
-
type: string;
|
|
591
|
-
};
|
|
592
|
-
value: {
|
|
593
|
-
type: string;
|
|
594
|
-
};
|
|
595
|
-
};
|
|
596
|
-
};
|
|
597
|
-
};
|
|
598
530
|
};
|
|
599
531
|
};
|
|
600
532
|
})[];
|
|
@@ -805,7 +737,12 @@ export declare const BannerCard: {
|
|
|
805
737
|
analyticsEvents: {
|
|
806
738
|
anyOf: ({
|
|
807
739
|
type: string;
|
|
808
|
-
|
|
740
|
+
propertyNames: {
|
|
741
|
+
type: string;
|
|
742
|
+
};
|
|
743
|
+
additionalProperty: {
|
|
744
|
+
type: string;
|
|
745
|
+
};
|
|
809
746
|
required: string[];
|
|
810
747
|
properties: {
|
|
811
748
|
name: {
|
|
@@ -833,34 +770,17 @@ export declare const BannerCard: {
|
|
|
833
770
|
};
|
|
834
771
|
};
|
|
835
772
|
};
|
|
836
|
-
category: {
|
|
837
|
-
type: string;
|
|
838
|
-
};
|
|
839
|
-
label: {
|
|
840
|
-
type: string;
|
|
841
|
-
};
|
|
842
|
-
params: {
|
|
843
|
-
type: string;
|
|
844
|
-
items: {
|
|
845
|
-
type: string;
|
|
846
|
-
additionalProperties: boolean;
|
|
847
|
-
required: string[];
|
|
848
|
-
properties: {
|
|
849
|
-
key: {
|
|
850
|
-
type: string;
|
|
851
|
-
};
|
|
852
|
-
value: {
|
|
853
|
-
type: string;
|
|
854
|
-
};
|
|
855
|
-
};
|
|
856
|
-
};
|
|
857
|
-
};
|
|
858
773
|
};
|
|
859
774
|
} | {
|
|
860
775
|
type: string;
|
|
861
776
|
items: {
|
|
862
777
|
type: string;
|
|
863
|
-
|
|
778
|
+
propertyNames: {
|
|
779
|
+
type: string;
|
|
780
|
+
};
|
|
781
|
+
additionalProperty: {
|
|
782
|
+
type: string;
|
|
783
|
+
};
|
|
864
784
|
required: string[];
|
|
865
785
|
properties: {
|
|
866
786
|
name: {
|
|
@@ -888,28 +808,6 @@ export declare const BannerCard: {
|
|
|
888
808
|
};
|
|
889
809
|
};
|
|
890
810
|
};
|
|
891
|
-
category: {
|
|
892
|
-
type: string;
|
|
893
|
-
};
|
|
894
|
-
label: {
|
|
895
|
-
type: string;
|
|
896
|
-
};
|
|
897
|
-
params: {
|
|
898
|
-
type: string;
|
|
899
|
-
items: {
|
|
900
|
-
type: string;
|
|
901
|
-
additionalProperties: boolean;
|
|
902
|
-
required: string[];
|
|
903
|
-
properties: {
|
|
904
|
-
key: {
|
|
905
|
-
type: string;
|
|
906
|
-
};
|
|
907
|
-
value: {
|
|
908
|
-
type: string;
|
|
909
|
-
};
|
|
910
|
-
};
|
|
911
|
-
};
|
|
912
|
-
};
|
|
913
811
|
};
|
|
914
812
|
};
|
|
915
813
|
})[];
|
|
@@ -429,7 +429,12 @@ export declare const MediaBlock: {
|
|
|
429
429
|
analyticsEvents: {
|
|
430
430
|
anyOf: ({
|
|
431
431
|
type: string;
|
|
432
|
-
|
|
432
|
+
propertyNames: {
|
|
433
|
+
type: string;
|
|
434
|
+
};
|
|
435
|
+
additionalProperty: {
|
|
436
|
+
type: string;
|
|
437
|
+
};
|
|
433
438
|
required: string[];
|
|
434
439
|
properties: {
|
|
435
440
|
name: {
|
|
@@ -457,34 +462,17 @@ export declare const MediaBlock: {
|
|
|
457
462
|
};
|
|
458
463
|
};
|
|
459
464
|
};
|
|
460
|
-
category: {
|
|
461
|
-
type: string;
|
|
462
|
-
};
|
|
463
|
-
label: {
|
|
464
|
-
type: string;
|
|
465
|
-
};
|
|
466
|
-
params: {
|
|
467
|
-
type: string;
|
|
468
|
-
items: {
|
|
469
|
-
type: string;
|
|
470
|
-
additionalProperties: boolean;
|
|
471
|
-
required: string[];
|
|
472
|
-
properties: {
|
|
473
|
-
key: {
|
|
474
|
-
type: string;
|
|
475
|
-
};
|
|
476
|
-
value: {
|
|
477
|
-
type: string;
|
|
478
|
-
};
|
|
479
|
-
};
|
|
480
|
-
};
|
|
481
|
-
};
|
|
482
465
|
};
|
|
483
466
|
} | {
|
|
484
467
|
type: string;
|
|
485
468
|
items: {
|
|
486
469
|
type: string;
|
|
487
|
-
|
|
470
|
+
propertyNames: {
|
|
471
|
+
type: string;
|
|
472
|
+
};
|
|
473
|
+
additionalProperty: {
|
|
474
|
+
type: string;
|
|
475
|
+
};
|
|
488
476
|
required: string[];
|
|
489
477
|
properties: {
|
|
490
478
|
name: {
|
|
@@ -512,28 +500,6 @@ export declare const MediaBlock: {
|
|
|
512
500
|
};
|
|
513
501
|
};
|
|
514
502
|
};
|
|
515
|
-
category: {
|
|
516
|
-
type: string;
|
|
517
|
-
};
|
|
518
|
-
label: {
|
|
519
|
-
type: string;
|
|
520
|
-
};
|
|
521
|
-
params: {
|
|
522
|
-
type: string;
|
|
523
|
-
items: {
|
|
524
|
-
type: string;
|
|
525
|
-
additionalProperties: boolean;
|
|
526
|
-
required: string[];
|
|
527
|
-
properties: {
|
|
528
|
-
key: {
|
|
529
|
-
type: string;
|
|
530
|
-
};
|
|
531
|
-
value: {
|
|
532
|
-
type: string;
|
|
533
|
-
};
|
|
534
|
-
};
|
|
535
|
-
};
|
|
536
|
-
};
|
|
537
503
|
};
|
|
538
504
|
};
|
|
539
505
|
})[];
|
|
@@ -7,18 +7,18 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const utils_2 = require("./utils");
|
|
8
8
|
const localeContext_1 = require("../../context/localeContext/localeContext");
|
|
9
9
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
10
|
-
const
|
|
10
|
+
const hooks_1 = require("../../hooks");
|
|
11
11
|
const icons_1 = require("../../icons");
|
|
12
12
|
const b = (0, utils_1.block)('button-block');
|
|
13
13
|
const Button = (props) => {
|
|
14
14
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
15
|
-
const handleAnalytics = (0,
|
|
15
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)();
|
|
16
16
|
const { lang, tld } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
17
17
|
const { className, metrikaGoals, pixelEvents, analyticsEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text } = props, rest = tslib_1.__rest(props, ["className", "metrikaGoals", "pixelEvents", "analyticsEvents", "size", "theme", "url", "img", "onClick", "text"]);
|
|
18
18
|
const defaultImgPosition = 'left';
|
|
19
19
|
const onClick = (0, react_1.useCallback)(() => {
|
|
20
20
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
21
|
-
handleAnalytics(analyticsEvents);
|
|
21
|
+
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
22
22
|
if (onClickOrigin) {
|
|
23
23
|
onClickOrigin();
|
|
24
24
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactElement, HTMLAttributeAnchorTarget } from 'react';
|
|
2
2
|
import { ButtonPixel, CardBaseProps as CardBaseParams, ImageProps, MetrikaGoal, WithChildren } from '../../models';
|
|
3
|
-
import {
|
|
3
|
+
import { AnalyticsEventV2 } from '../../models/common';
|
|
4
4
|
export interface CardBaseProps extends CardBaseParams {
|
|
5
5
|
className?: string;
|
|
6
6
|
bodyClassName?: string;
|
|
@@ -10,7 +10,7 @@ export interface CardBaseProps extends CardBaseParams {
|
|
|
10
10
|
target?: HTMLAttributeAnchorTarget;
|
|
11
11
|
metrikaGoals?: MetrikaGoal;
|
|
12
12
|
pixelEvents?: ButtonPixel;
|
|
13
|
-
analyticsEvents?:
|
|
13
|
+
analyticsEvents?: AnalyticsEventV2 | AnalyticsEventV2[];
|
|
14
14
|
}
|
|
15
15
|
export interface CardHeaderBaseProps {
|
|
16
16
|
className?: string;
|
|
@@ -7,7 +7,7 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const BackgroundImage_1 = tslib_1.__importDefault(require("../BackgroundImage/BackgroundImage"));
|
|
8
8
|
const RouterLink_1 = tslib_1.__importDefault(require("../RouterLink/RouterLink"));
|
|
9
9
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
10
|
-
const
|
|
10
|
+
const hooks_1 = require("../../hooks");
|
|
11
11
|
const b = (0, utils_1.block)('card-base-block');
|
|
12
12
|
const Header = () => null;
|
|
13
13
|
const Content = () => null;
|
|
@@ -15,7 +15,7 @@ const Footer = () => null;
|
|
|
15
15
|
const Layout = (props) => {
|
|
16
16
|
const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', } = props;
|
|
17
17
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
18
|
-
const handleAnalytics = (0,
|
|
18
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)();
|
|
19
19
|
let header, content, footer, image, headerClass, footerClass;
|
|
20
20
|
function handleChild(child) {
|
|
21
21
|
switch (child.type) {
|
|
@@ -48,7 +48,7 @@ const Layout = (props) => {
|
|
|
48
48
|
const fullClassName = b({ border }, className);
|
|
49
49
|
const onClick = () => {
|
|
50
50
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
51
|
-
handleAnalytics(analyticsEvents);
|
|
51
|
+
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
52
52
|
};
|
|
53
53
|
return url ? (react_1.default.createElement(RouterLink_1.default, { href: url },
|
|
54
54
|
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));
|
|
@@ -4,15 +4,15 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
6
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
7
|
-
const
|
|
7
|
+
const hooks_1 = require("../../hooks");
|
|
8
8
|
const b = (0, utils_1.block)('header-breadcrumbs');
|
|
9
9
|
function HeaderBreadcrumbs(props) {
|
|
10
10
|
const { items, metrikaGoals, pixelEvents, analyticsEvents, theme = 'light', className } = props;
|
|
11
11
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
12
|
-
const handleAnalytics = (0,
|
|
12
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)();
|
|
13
13
|
const onClick = () => {
|
|
14
14
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
15
|
-
handleAnalytics(analyticsEvents);
|
|
15
|
+
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
16
16
|
};
|
|
17
17
|
return (react_1.default.createElement("div", { className: b({ theme }, className) }, items.map((item) => (react_1.default.createElement("div", { className: b('item'), key: item.url },
|
|
18
18
|
react_1.default.createElement("a", { href: item.url, className: b('text'), onClick: onClick }, item.text))))));
|
|
@@ -10,7 +10,7 @@ const BackLink_1 = tslib_1.__importDefault(require("../BackLink/BackLink"));
|
|
|
10
10
|
const localeContext_1 = require("../../context/localeContext/localeContext");
|
|
11
11
|
const locationContext_1 = require("../../context/locationContext/locationContext");
|
|
12
12
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
13
|
-
const
|
|
13
|
+
const hooks_1 = require("../../hooks");
|
|
14
14
|
const b = (0, utils_1.block)('link-block');
|
|
15
15
|
const WORD_JOINER_SYM = '\u200b';
|
|
16
16
|
function getArrowSize(size) {
|
|
@@ -28,14 +28,14 @@ function getArrowSize(size) {
|
|
|
28
28
|
const LinkBlock = (props) => {
|
|
29
29
|
const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, } = props;
|
|
30
30
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
31
|
-
const handleAnalytics = (0,
|
|
31
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)();
|
|
32
32
|
const { hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
33
33
|
const { tld } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
34
34
|
const href = (0, utils_1.setUrlTld)(props.url, tld);
|
|
35
35
|
const defaultTextSize = theme === 'back' ? 'l' : 'm';
|
|
36
36
|
const onClick = () => {
|
|
37
37
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
38
|
-
handleAnalytics(analyticsEvents);
|
|
38
|
+
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
39
39
|
};
|
|
40
40
|
const getLinkByType = () => {
|
|
41
41
|
switch (theme) {
|
|
@@ -10,7 +10,7 @@ const Video_1 = tslib_1.__importDefault(require("./Video/Video"));
|
|
|
10
10
|
const VideoBlock_1 = tslib_1.__importDefault(require("../VideoBlock/VideoBlock"));
|
|
11
11
|
const b = (0, utils_1.block)('Media');
|
|
12
12
|
const Media = (props) => {
|
|
13
|
-
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, } = props;
|
|
13
|
+
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, analyticsEvents, } = props;
|
|
14
14
|
const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, } = props;
|
|
15
15
|
const [hasVideoFallback, setHasVideoFallback] = (0, react_1.useState)(false);
|
|
16
16
|
const content = (0, react_1.useMemo)(() => {
|
|
@@ -19,7 +19,7 @@ const Media = (props) => {
|
|
|
19
19
|
result.push(react_1.default.createElement(Image_1.default, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback }));
|
|
20
20
|
}
|
|
21
21
|
if (video) {
|
|
22
|
-
result.push(react_1.default.createElement(Video_1.default, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika, playVideo: playVideo, previewImg: previewImg, playButton: playButton, customBarControlsClassName: customBarControlsClassName, hasVideoFallback: hasVideoFallback, setHasVideoFallback: setHasVideoFallback }));
|
|
22
|
+
result.push(react_1.default.createElement(Video_1.default, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika, analyticsEvents: analyticsEvents, playVideo: playVideo, previewImg: previewImg, playButton: playButton, customBarControlsClassName: customBarControlsClassName, hasVideoFallback: hasVideoFallback, setHasVideoFallback: setHasVideoFallback }));
|
|
23
23
|
}
|
|
24
24
|
if (youtube) {
|
|
25
25
|
result = (react_1.default.createElement(VideoBlock_1.default, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height }));
|
|
@@ -40,6 +40,7 @@ const Media = (props) => {
|
|
|
40
40
|
hasVideoFallback,
|
|
41
41
|
videoClassName,
|
|
42
42
|
metrika,
|
|
43
|
+
analyticsEvents,
|
|
43
44
|
playVideo,
|
|
44
45
|
previewImg,
|
|
45
46
|
playButton,
|
|
@@ -8,7 +8,7 @@ const utils_1 = require("./utils");
|
|
|
8
8
|
const utils_2 = require("../../../utils");
|
|
9
9
|
const b = (0, utils_2.block)('media-component-video');
|
|
10
10
|
const Video = (props) => {
|
|
11
|
-
const { video, height, metrika, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, } = props;
|
|
11
|
+
const { video, height, metrika, analyticsEvents, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, } = props;
|
|
12
12
|
const ref = (0, react_1.useRef)(null);
|
|
13
13
|
(0, react_1.useEffect)(() => {
|
|
14
14
|
if (ref && ref.current) {
|
|
@@ -31,16 +31,17 @@ const Video = (props) => {
|
|
|
31
31
|
}, [playVideo, video, setHasVideoFallback]);
|
|
32
32
|
const reactPlayerBlock = (0, react_1.useMemo)(() => {
|
|
33
33
|
const { src, loop, controls, muted, autoplay = true, elapsedTime, playButton } = video;
|
|
34
|
-
return (react_1.default.createElement(ReactPlayer_1.default, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika, height: height }));
|
|
34
|
+
return (react_1.default.createElement(ReactPlayer_1.default, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika, analyticsEvents: analyticsEvents, height: height }));
|
|
35
35
|
}, [
|
|
36
36
|
video,
|
|
37
|
-
height,
|
|
38
37
|
videoClassName,
|
|
39
38
|
previewImg,
|
|
40
39
|
playVideo,
|
|
41
40
|
commonPlayButton,
|
|
42
41
|
customBarControlsClassName,
|
|
43
42
|
metrika,
|
|
43
|
+
analyticsEvents,
|
|
44
|
+
height,
|
|
44
45
|
]);
|
|
45
46
|
const defaultVideoBlock = (0, react_1.useMemo)(() => {
|
|
46
47
|
return video.src.length && !hasVideoFallback ? (react_1.default.createElement("div", { className: b('wrap', videoClassName), style: { height } },
|
|
@@ -13,13 +13,14 @@ const videoContext_1 = require("../../context/videoContext");
|
|
|
13
13
|
const metrikaContext_1 = require("../../context/metrikaContext");
|
|
14
14
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
15
15
|
const icons_1 = require("../../icons");
|
|
16
|
+
const hooks_1 = require("../../hooks");
|
|
16
17
|
const b = (0, utils_1.block)('ReactPlayer');
|
|
17
18
|
const FPS = 60;
|
|
18
19
|
// eslint-disable-next-line react/display-name
|
|
19
20
|
exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
20
21
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
21
22
|
const { metrika } = (0, react_1.useContext)(metrikaContext_1.MetrikaContext);
|
|
22
|
-
const { src, previewImgUrl, loop = false, controls = models_1.MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, height, } = props;
|
|
23
|
+
const { src, previewImgUrl, loop = false, controls = models_1.MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, analyticsEvents, height, } = props;
|
|
23
24
|
const { type = models_1.PlayButtonType.Default, theme = models_1.PlayButtonThemes.Blue, text, className: buttonClassName, } = playButton || {};
|
|
24
25
|
const autoPlay = Boolean(!isMobile && !previewImgUrl && props.autoplay);
|
|
25
26
|
const mute = initiallyMuted || autoPlay;
|
|
@@ -34,6 +35,7 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
34
35
|
const [started, setStarted] = (0, react_1.useState)(autoPlay);
|
|
35
36
|
const [paused, setPaused] = (0, react_1.useState)(false);
|
|
36
37
|
const [ended, setEnded] = (0, react_1.useState)(false);
|
|
38
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)();
|
|
37
39
|
(0, react_1.useImperativeHandle)(originRef, () => ({
|
|
38
40
|
pause: () => setIsPlaying(false),
|
|
39
41
|
}));
|
|
@@ -82,6 +84,8 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
82
84
|
window.removeEventListener('resize', updateSize);
|
|
83
85
|
};
|
|
84
86
|
}, []);
|
|
87
|
+
const playEvents = (0, react_1.useMemo)(() => analyticsEvents === null || analyticsEvents === void 0 ? void 0 : analyticsEvents.filter((e) => e.type === 'play'), [analyticsEvents]);
|
|
88
|
+
const stopEvents = (0, react_1.useMemo)(() => analyticsEvents === null || analyticsEvents === void 0 ? void 0 : analyticsEvents.filter((e) => e.type === 'stop'), [analyticsEvents]);
|
|
85
89
|
const playIcon = (0, react_1.useMemo)(() => {
|
|
86
90
|
let playButtonContent;
|
|
87
91
|
switch (type) {
|
|
@@ -107,12 +111,27 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
107
111
|
metrika.reachGoals(goal, counterName);
|
|
108
112
|
}
|
|
109
113
|
}
|
|
114
|
+
if (handleAnalytics && analyticsEvents) {
|
|
115
|
+
const events = isMuted ? playEvents : stopEvents;
|
|
116
|
+
if (events) {
|
|
117
|
+
handleAnalytics(events);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
110
120
|
if (isMuted) {
|
|
111
121
|
setProps({ playingVideoRef: ref.current });
|
|
112
122
|
}
|
|
113
123
|
// In order to the progress bar to update (equals 0) before displaying
|
|
114
124
|
setTimeout(() => setMuted(!isMuted), 0);
|
|
115
|
-
}, [
|
|
125
|
+
}, [
|
|
126
|
+
playerRef,
|
|
127
|
+
metrika,
|
|
128
|
+
videoMetrika,
|
|
129
|
+
handleAnalytics,
|
|
130
|
+
analyticsEvents,
|
|
131
|
+
playEvents,
|
|
132
|
+
stopEvents,
|
|
133
|
+
setProps,
|
|
134
|
+
]);
|
|
116
135
|
const handleClick = (0, react_1.useCallback)(() => changeMute(muted), [changeMute, muted]);
|
|
117
136
|
const handleClickPreview = (0, react_1.useCallback)(() => {
|
|
118
137
|
setIsPlaying(true);
|
|
@@ -123,7 +142,12 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
123
142
|
metrika.reachGoals(play, counterName);
|
|
124
143
|
}
|
|
125
144
|
}
|
|
126
|
-
|
|
145
|
+
if (handleAnalytics && analyticsEvents) {
|
|
146
|
+
if (playEvents) {
|
|
147
|
+
handleAnalytics(playEvents);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}, [onClickPreview, metrika, videoMetrika, handleAnalytics, analyticsEvents, playEvents]);
|
|
127
151
|
const onPause = (0, react_1.useCallback)(() => {
|
|
128
152
|
// For support correct state for youtube
|
|
129
153
|
setIsPlaying(false);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PixelEvent } from '../../models';
|
|
2
|
-
import {
|
|
2
|
+
import { AnalyticsEventV2 } from '../../models/common';
|
|
3
3
|
export declare const YANDEX_FORM_ORIGIN = "https://forms.yandex.ru";
|
|
4
4
|
export interface YandexFormProps {
|
|
5
5
|
id: number | string;
|
|
@@ -15,7 +15,7 @@ export interface YandexFormProps {
|
|
|
15
15
|
onLoad?: () => void;
|
|
16
16
|
metrikaGoals?: string | string[];
|
|
17
17
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[];
|
|
18
|
-
analyticsEvents?:
|
|
18
|
+
analyticsEvents?: AnalyticsEventV2 | AnalyticsEventV2[];
|
|
19
19
|
}
|
|
20
20
|
declare const YandexForm: (props: YandexFormProps) => JSX.Element;
|
|
21
21
|
export default YandexForm;
|
|
@@ -8,7 +8,7 @@ const localeContext_1 = require("../../context/localeContext");
|
|
|
8
8
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
10
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
11
|
-
const
|
|
11
|
+
const hooks_1 = require("../..//hooks");
|
|
12
12
|
exports.YANDEX_FORM_ORIGIN = 'https://forms.yandex.ru';
|
|
13
13
|
const CONTAINER_ID = 'pc-yandex-form-container';
|
|
14
14
|
const b = (0, utils_1.block)('yandex-form');
|
|
@@ -18,7 +18,7 @@ const YandexForm = (props) => {
|
|
|
18
18
|
const iframeRef = (0, react_1.useRef)();
|
|
19
19
|
const yaFormOrigin = customFormOrigin || exports.YANDEX_FORM_ORIGIN;
|
|
20
20
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
21
|
-
const handleAnalytics = (0,
|
|
21
|
+
const handleAnalytics = (0, hooks_1.useAnalytics)();
|
|
22
22
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
23
23
|
const locale = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
24
24
|
const updateFormIframe = (0, react_1.useCallback)((container) => {
|
|
@@ -59,7 +59,7 @@ const YandexForm = (props) => {
|
|
|
59
59
|
window.scrollBy(0, top - headerHeight);
|
|
60
60
|
}
|
|
61
61
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
62
|
-
handleAnalytics(analyticsEvents);
|
|
62
|
+
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
63
63
|
if (onSubmit) {
|
|
64
64
|
onSubmit();
|
|
65
65
|
}
|