@gravity-ui/page-constructor 1.13.0 → 1.14.0-alpha.1
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/build/cjs/blocks/Banner/schema.d.ts +321 -0
- package/build/cjs/blocks/Media/schema.d.ts +107 -0
- package/build/cjs/components/Button/Button.js +5 -2
- package/build/cjs/components/CardBase/CardBase.d.ts +2 -0
- package/build/cjs/components/CardBase/CardBase.js +4 -1
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +4 -1
- package/build/cjs/components/Link/Link.js +4 -1
- package/build/cjs/components/YandexForm/YandexForm.d.ts +2 -0
- package/build/cjs/components/YandexForm/YandexForm.js +13 -2
- package/build/cjs/containers/PageConstructor/Provider.d.ts +2 -0
- package/build/cjs/containers/PageConstructor/Provider.js +3 -1
- package/build/cjs/context/analyticsContext/analyticsContext.d.ts +6 -0
- package/build/cjs/context/analyticsContext/analyticsContext.js +6 -0
- package/build/cjs/context/analyticsContext/index.d.ts +1 -0
- package/build/cjs/context/analyticsContext/index.js +4 -0
- package/build/cjs/context/metrikaContext/metrikaContext.d.ts +6 -0
- package/build/cjs/hooks/useAnalytics.d.ts +2 -0
- package/build/cjs/hooks/useAnalytics.js +15 -0
- package/build/cjs/hooks/useMetrika.d.ts +6 -0
- package/build/cjs/hooks/useMetrika.js +8 -0
- package/build/cjs/models/common.d.ts +30 -0
- package/build/cjs/models/common.js +3 -0
- package/build/cjs/models/constructor-items/common.d.ts +4 -1
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +2 -1
- package/build/cjs/schema/validators/common.d.ts +226 -0
- package/build/cjs/schema/validators/common.js +10 -0
- package/build/cjs/schema/validators/event.d.ts +50 -0
- package/build/cjs/schema/validators/event.js +53 -0
- package/build/cjs/sub-blocks/HubspotForm/index.js +14 -2
- package/build/esm/blocks/Banner/schema.d.ts +321 -0
- package/build/esm/blocks/Media/schema.d.ts +107 -0
- package/build/esm/components/Button/Button.js +5 -2
- package/build/esm/components/CardBase/CardBase.d.ts +2 -0
- package/build/esm/components/CardBase/CardBase.js +4 -1
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +4 -1
- package/build/esm/components/Link/Link.js +4 -1
- package/build/esm/components/YandexForm/YandexForm.d.ts +2 -0
- package/build/esm/components/YandexForm/YandexForm.js +13 -2
- package/build/esm/containers/PageConstructor/Provider.d.ts +2 -0
- package/build/esm/containers/PageConstructor/Provider.js +3 -1
- package/build/esm/context/analyticsContext/analyticsContext.d.ts +6 -0
- package/build/esm/context/analyticsContext/analyticsContext.js +2 -0
- package/build/esm/context/analyticsContext/index.d.ts +1 -0
- package/build/esm/context/analyticsContext/index.js +1 -0
- package/build/esm/context/metrikaContext/metrikaContext.d.ts +6 -0
- package/build/esm/hooks/useAnalytics.d.ts +2 -0
- package/build/esm/hooks/useAnalytics.js +11 -0
- package/build/esm/hooks/useMetrika.d.ts +6 -0
- package/build/esm/hooks/useMetrika.js +8 -0
- package/build/esm/models/common.d.ts +30 -0
- package/build/esm/models/common.js +3 -0
- package/build/esm/models/constructor-items/common.d.ts +4 -1
- package/build/esm/models/constructor-items/sub-blocks.d.ts +2 -1
- package/build/esm/schema/validators/common.d.ts +226 -0
- package/build/esm/schema/validators/common.js +10 -0
- package/build/esm/schema/validators/event.d.ts +50 -0
- package/build/esm/schema/validators/event.js +50 -0
- package/build/esm/sub-blocks/HubspotForm/index.js +14 -2
- package/package.json +4 -1
- package/server/models/common.d.ts +30 -0
- package/server/models/common.js +3 -0
- package/server/models/constructor-items/common.d.ts +4 -1
- package/server/models/constructor-items/sub-blocks.d.ts +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './analyticsContext';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './analyticsContext';
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Metrika, Pixel } from '../../models';
|
|
3
3
|
export interface MetrikaContextProps {
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Metrika will be deleted
|
|
6
|
+
*/
|
|
4
7
|
metrika?: Metrika;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Metrika will be deleted
|
|
10
|
+
*/
|
|
5
11
|
pixel?: Pixel;
|
|
6
12
|
}
|
|
7
13
|
export declare const MetrikaContext: React.Context<MetrikaContextProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { AnalyticsContext } from '../context/analyticsContext';
|
|
3
|
+
export const useAnalytics = () => {
|
|
4
|
+
const { sendEvents } = useContext(AnalyticsContext);
|
|
5
|
+
return (e) => {
|
|
6
|
+
if (!e) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
sendEvents === null || sendEvents === void 0 ? void 0 : sendEvents(e);
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { ButtonPixel, MetrikaGoal, PixelEvent } from '../models';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Metrika will be deleted
|
|
4
|
+
*/
|
|
2
5
|
type UseMetrikaProps = {
|
|
3
6
|
metrikaGoals?: MetrikaGoal;
|
|
4
7
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[] | ButtonPixel;
|
|
5
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated useMetrika will be deleted
|
|
11
|
+
*/
|
|
6
12
|
export declare const useMetrika: () => ({ metrikaGoals, pixelEvents }: UseMetrikaProps) => void;
|
|
7
13
|
export {};
|
|
@@ -2,12 +2,20 @@ import { useContext } from 'react';
|
|
|
2
2
|
import { MetrikaContext } from '../context/metrikaContext';
|
|
3
3
|
import { PixelEventType } from '../models';
|
|
4
4
|
import { isNewMetrikaFormat } from '../models/guards';
|
|
5
|
+
// eslint-disable-next-line valid-jsdoc
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Metrika will be deleted, which uses this logic
|
|
8
|
+
*/
|
|
5
9
|
function isButtonPixel(pixelEvents) {
|
|
6
10
|
if (Array.isArray(pixelEvents) && pixelEvents.length && 'name' in pixelEvents) {
|
|
7
11
|
return true;
|
|
8
12
|
}
|
|
9
13
|
return false;
|
|
10
14
|
}
|
|
15
|
+
// eslint-disable-next-line valid-jsdoc
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated useMetrika will be deleted
|
|
18
|
+
*/
|
|
11
19
|
export const useMetrika = () => {
|
|
12
20
|
const { metrika, pixel } = useContext(MetrikaContext);
|
|
13
21
|
return ({ metrikaGoals, pixelEvents }) => {
|
|
@@ -7,12 +7,21 @@ export declare enum Theme {
|
|
|
7
7
|
Light = "light",
|
|
8
8
|
Dark = "dark"
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Pixel will be deleted
|
|
12
|
+
*/
|
|
10
13
|
type PixelCommand = 'track' | 'trackCustom';
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Pixel will be deleted
|
|
16
|
+
*/
|
|
11
17
|
export interface PixelEvent {
|
|
12
18
|
command: PixelCommand;
|
|
13
19
|
event: PixelEventType | string;
|
|
14
20
|
data?: Object;
|
|
15
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Pixel will be deleted from package
|
|
24
|
+
*/
|
|
16
25
|
export declare enum PixelEventType {
|
|
17
26
|
AddPaymentInfo = "AddPaymentInfo",
|
|
18
27
|
AddToCart = "AddToCart",
|
|
@@ -36,11 +45,17 @@ export declare enum PixelEventType {
|
|
|
36
45
|
export type Modifiers = {
|
|
37
46
|
[name: string]: string | boolean | undefined;
|
|
38
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated Pixel will be deleted
|
|
50
|
+
*/
|
|
39
51
|
export interface Pixel<TEvent = string> {
|
|
40
52
|
trackStandard: (event: TEvent, data?: Object) => void;
|
|
41
53
|
trackCustom: (event: string, data?: Object) => void;
|
|
42
54
|
track: (trackEvents: string | string[] | PixelEvent[] | PixelEvent) => void;
|
|
43
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Metrika will be deleted
|
|
58
|
+
*/
|
|
44
59
|
export interface Metrika {
|
|
45
60
|
reachGoal: (counterName: string, ...args: any) => void;
|
|
46
61
|
reachGoals: (goals: MetrikaGoal, counterName?: string) => void;
|
|
@@ -49,4 +64,19 @@ export interface ClassNameProps {
|
|
|
49
64
|
className?: string;
|
|
50
65
|
}
|
|
51
66
|
export type Timeout = ReturnType<typeof setTimeout> | undefined;
|
|
67
|
+
export type AnalyticsParameter = {
|
|
68
|
+
key: string;
|
|
69
|
+
value: string;
|
|
70
|
+
};
|
|
71
|
+
export type AnalyticsEvent = {
|
|
72
|
+
name: string;
|
|
73
|
+
type?: string;
|
|
74
|
+
counters?: {
|
|
75
|
+
include?: string[];
|
|
76
|
+
exclude?: string[];
|
|
77
|
+
};
|
|
78
|
+
category?: string;
|
|
79
|
+
label?: string;
|
|
80
|
+
params?: AnalyticsParameter[];
|
|
81
|
+
};
|
|
52
82
|
export {};
|
|
@@ -3,6 +3,9 @@ export var Theme;
|
|
|
3
3
|
Theme["Light"] = "light";
|
|
4
4
|
Theme["Dark"] = "dark";
|
|
5
5
|
})(Theme || (Theme = {}));
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Pixel will be deleted from package
|
|
8
|
+
*/
|
|
6
9
|
export var PixelEventType;
|
|
7
10
|
(function (PixelEventType) {
|
|
8
11
|
PixelEventType["AddPaymentInfo"] = "AddPaymentInfo";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { ButtonSize, ButtonView } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils/theme';
|
|
4
|
-
import { ClassNameProps, PixelEventType } from '../common';
|
|
4
|
+
import { AnalyticsEvent, ClassNameProps, PixelEventType } from '../common';
|
|
5
5
|
export declare enum AuthorType {
|
|
6
6
|
Column = "column",
|
|
7
7
|
Line = "line"
|
|
@@ -121,6 +121,7 @@ export interface LinkProps extends Stylable {
|
|
|
121
121
|
target?: string;
|
|
122
122
|
metrikaGoals?: MetrikaGoal;
|
|
123
123
|
pixelEvents?: ButtonPixel;
|
|
124
|
+
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
124
125
|
}
|
|
125
126
|
export interface FileLinkProps extends ClassNameProps {
|
|
126
127
|
href: string;
|
|
@@ -139,6 +140,7 @@ export interface ButtonProps {
|
|
|
139
140
|
img?: ButtonImageProps | string;
|
|
140
141
|
metrikaGoals?: MetrikaGoal;
|
|
141
142
|
pixelEvents?: ButtonPixel;
|
|
143
|
+
analyticsEvents?: AnalyticsEvent[];
|
|
142
144
|
target?: string;
|
|
143
145
|
}
|
|
144
146
|
export interface ButtonImageProps {
|
|
@@ -222,6 +224,7 @@ export interface HeaderBreadCrumbsProps extends ClassNameProps {
|
|
|
222
224
|
theme?: TextTheme;
|
|
223
225
|
metrikaGoals?: MetrikaGoal;
|
|
224
226
|
pixelEvents?: ButtonPixel;
|
|
227
|
+
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
225
228
|
}
|
|
226
229
|
export interface PreviewContentItemProps {
|
|
227
230
|
title: string;
|
|
@@ -3,7 +3,7 @@ import { ThemeSupporting } from '../../utils';
|
|
|
3
3
|
import { HubspotEventData, HubspotEventHandlers } from '../../utils/hubspot';
|
|
4
4
|
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageObjectProps, ImageProps, LinkProps, MediaProps, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
|
|
5
5
|
import { ContentBlockProps } from './blocks';
|
|
6
|
-
import { PixelEvent } from '../common';
|
|
6
|
+
import { AnalyticsEvent, PixelEvent } from '../common';
|
|
7
7
|
export declare enum SubBlockType {
|
|
8
8
|
Divider = "divider",
|
|
9
9
|
Quote = "quote",
|
|
@@ -61,6 +61,7 @@ export interface HubspotFormProps extends HubspotEventHandlers {
|
|
|
61
61
|
onLoad?: (arg: HubspotEventData) => void;
|
|
62
62
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[] | ButtonPixel;
|
|
63
63
|
hubspotEvents?: string[];
|
|
64
|
+
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
64
65
|
}
|
|
65
66
|
export interface PartnerProps extends CardBaseProps {
|
|
66
67
|
text: string;
|
|
@@ -414,6 +414,9 @@ export declare const ButtonProps: {
|
|
|
414
414
|
};
|
|
415
415
|
})[];
|
|
416
416
|
};
|
|
417
|
+
/**
|
|
418
|
+
* @deprecated Metrika will be deleted
|
|
419
|
+
*/
|
|
417
420
|
metrikaGoals: {
|
|
418
421
|
anyOf: ({
|
|
419
422
|
type: string;
|
|
@@ -443,6 +446,9 @@ export declare const ButtonProps: {
|
|
|
443
446
|
};
|
|
444
447
|
})[];
|
|
445
448
|
};
|
|
449
|
+
/**
|
|
450
|
+
* @deprecated Pixel will be deleted
|
|
451
|
+
*/
|
|
446
452
|
pixelEvents: {
|
|
447
453
|
type: string;
|
|
448
454
|
items: {
|
|
@@ -499,6 +505,113 @@ export declare const ButtonProps: {
|
|
|
499
505
|
};
|
|
500
506
|
};
|
|
501
507
|
};
|
|
508
|
+
events: {
|
|
509
|
+
anyOf: ({
|
|
510
|
+
type: {
|
|
511
|
+
type: string;
|
|
512
|
+
additionalProperties: boolean;
|
|
513
|
+
required: string[];
|
|
514
|
+
properties: {
|
|
515
|
+
name: {
|
|
516
|
+
type: string;
|
|
517
|
+
};
|
|
518
|
+
type: {
|
|
519
|
+
type: string;
|
|
520
|
+
};
|
|
521
|
+
counters: {
|
|
522
|
+
type: string;
|
|
523
|
+
additionalProperties: boolean;
|
|
524
|
+
required: never[];
|
|
525
|
+
properties: {
|
|
526
|
+
include: {
|
|
527
|
+
type: string;
|
|
528
|
+
items: string;
|
|
529
|
+
};
|
|
530
|
+
exclude: {
|
|
531
|
+
type: string;
|
|
532
|
+
items: string;
|
|
533
|
+
};
|
|
534
|
+
};
|
|
535
|
+
};
|
|
536
|
+
category: {
|
|
537
|
+
type: string;
|
|
538
|
+
};
|
|
539
|
+
label: {
|
|
540
|
+
type: string;
|
|
541
|
+
};
|
|
542
|
+
params: {
|
|
543
|
+
type: string;
|
|
544
|
+
items: {
|
|
545
|
+
type: string;
|
|
546
|
+
additionalProperties: boolean;
|
|
547
|
+
required: string[];
|
|
548
|
+
properties: {
|
|
549
|
+
key: {
|
|
550
|
+
type: string;
|
|
551
|
+
};
|
|
552
|
+
value: {
|
|
553
|
+
type: string;
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
};
|
|
557
|
+
};
|
|
558
|
+
};
|
|
559
|
+
};
|
|
560
|
+
items?: undefined;
|
|
561
|
+
} | {
|
|
562
|
+
type: string;
|
|
563
|
+
items: {
|
|
564
|
+
type: string;
|
|
565
|
+
additionalProperties: boolean;
|
|
566
|
+
required: string[];
|
|
567
|
+
properties: {
|
|
568
|
+
name: {
|
|
569
|
+
type: string;
|
|
570
|
+
};
|
|
571
|
+
type: {
|
|
572
|
+
type: string;
|
|
573
|
+
};
|
|
574
|
+
counters: {
|
|
575
|
+
type: string;
|
|
576
|
+
additionalProperties: boolean;
|
|
577
|
+
required: never[];
|
|
578
|
+
properties: {
|
|
579
|
+
include: {
|
|
580
|
+
type: string;
|
|
581
|
+
items: string;
|
|
582
|
+
};
|
|
583
|
+
exclude: {
|
|
584
|
+
type: string;
|
|
585
|
+
items: string;
|
|
586
|
+
};
|
|
587
|
+
};
|
|
588
|
+
};
|
|
589
|
+
category: {
|
|
590
|
+
type: string;
|
|
591
|
+
};
|
|
592
|
+
label: {
|
|
593
|
+
type: string;
|
|
594
|
+
};
|
|
595
|
+
params: {
|
|
596
|
+
type: string;
|
|
597
|
+
items: {
|
|
598
|
+
type: string;
|
|
599
|
+
additionalProperties: boolean;
|
|
600
|
+
required: string[];
|
|
601
|
+
properties: {
|
|
602
|
+
key: {
|
|
603
|
+
type: string;
|
|
604
|
+
};
|
|
605
|
+
value: {
|
|
606
|
+
type: string;
|
|
607
|
+
};
|
|
608
|
+
};
|
|
609
|
+
};
|
|
610
|
+
};
|
|
611
|
+
};
|
|
612
|
+
};
|
|
613
|
+
})[];
|
|
614
|
+
};
|
|
502
615
|
target: {
|
|
503
616
|
type: string;
|
|
504
617
|
enum: string[];
|
|
@@ -629,6 +742,9 @@ export declare const ButtonBlock: {
|
|
|
629
742
|
};
|
|
630
743
|
})[];
|
|
631
744
|
};
|
|
745
|
+
/**
|
|
746
|
+
* @deprecated Metrika will be deleted
|
|
747
|
+
*/
|
|
632
748
|
metrikaGoals: {
|
|
633
749
|
anyOf: ({
|
|
634
750
|
type: string;
|
|
@@ -658,6 +774,9 @@ export declare const ButtonBlock: {
|
|
|
658
774
|
};
|
|
659
775
|
})[];
|
|
660
776
|
};
|
|
777
|
+
/**
|
|
778
|
+
* @deprecated Pixel will be deleted
|
|
779
|
+
*/
|
|
661
780
|
pixelEvents: {
|
|
662
781
|
type: string;
|
|
663
782
|
items: {
|
|
@@ -714,6 +833,113 @@ export declare const ButtonBlock: {
|
|
|
714
833
|
};
|
|
715
834
|
};
|
|
716
835
|
};
|
|
836
|
+
events: {
|
|
837
|
+
anyOf: ({
|
|
838
|
+
type: {
|
|
839
|
+
type: string;
|
|
840
|
+
additionalProperties: boolean;
|
|
841
|
+
required: string[];
|
|
842
|
+
properties: {
|
|
843
|
+
name: {
|
|
844
|
+
type: string;
|
|
845
|
+
};
|
|
846
|
+
type: {
|
|
847
|
+
type: string;
|
|
848
|
+
};
|
|
849
|
+
counters: {
|
|
850
|
+
type: string;
|
|
851
|
+
additionalProperties: boolean;
|
|
852
|
+
required: never[];
|
|
853
|
+
properties: {
|
|
854
|
+
include: {
|
|
855
|
+
type: string;
|
|
856
|
+
items: string;
|
|
857
|
+
};
|
|
858
|
+
exclude: {
|
|
859
|
+
type: string;
|
|
860
|
+
items: string;
|
|
861
|
+
};
|
|
862
|
+
};
|
|
863
|
+
};
|
|
864
|
+
category: {
|
|
865
|
+
type: string;
|
|
866
|
+
};
|
|
867
|
+
label: {
|
|
868
|
+
type: string;
|
|
869
|
+
};
|
|
870
|
+
params: {
|
|
871
|
+
type: string;
|
|
872
|
+
items: {
|
|
873
|
+
type: string;
|
|
874
|
+
additionalProperties: boolean;
|
|
875
|
+
required: string[];
|
|
876
|
+
properties: {
|
|
877
|
+
key: {
|
|
878
|
+
type: string;
|
|
879
|
+
};
|
|
880
|
+
value: {
|
|
881
|
+
type: string;
|
|
882
|
+
};
|
|
883
|
+
};
|
|
884
|
+
};
|
|
885
|
+
};
|
|
886
|
+
};
|
|
887
|
+
};
|
|
888
|
+
items?: undefined;
|
|
889
|
+
} | {
|
|
890
|
+
type: string;
|
|
891
|
+
items: {
|
|
892
|
+
type: string;
|
|
893
|
+
additionalProperties: boolean;
|
|
894
|
+
required: string[];
|
|
895
|
+
properties: {
|
|
896
|
+
name: {
|
|
897
|
+
type: string;
|
|
898
|
+
};
|
|
899
|
+
type: {
|
|
900
|
+
type: string;
|
|
901
|
+
};
|
|
902
|
+
counters: {
|
|
903
|
+
type: string;
|
|
904
|
+
additionalProperties: boolean;
|
|
905
|
+
required: never[];
|
|
906
|
+
properties: {
|
|
907
|
+
include: {
|
|
908
|
+
type: string;
|
|
909
|
+
items: string;
|
|
910
|
+
};
|
|
911
|
+
exclude: {
|
|
912
|
+
type: string;
|
|
913
|
+
items: string;
|
|
914
|
+
};
|
|
915
|
+
};
|
|
916
|
+
};
|
|
917
|
+
category: {
|
|
918
|
+
type: string;
|
|
919
|
+
};
|
|
920
|
+
label: {
|
|
921
|
+
type: string;
|
|
922
|
+
};
|
|
923
|
+
params: {
|
|
924
|
+
type: string;
|
|
925
|
+
items: {
|
|
926
|
+
type: string;
|
|
927
|
+
additionalProperties: boolean;
|
|
928
|
+
required: string[];
|
|
929
|
+
properties: {
|
|
930
|
+
key: {
|
|
931
|
+
type: string;
|
|
932
|
+
};
|
|
933
|
+
value: {
|
|
934
|
+
type: string;
|
|
935
|
+
};
|
|
936
|
+
};
|
|
937
|
+
};
|
|
938
|
+
};
|
|
939
|
+
};
|
|
940
|
+
};
|
|
941
|
+
})[];
|
|
942
|
+
};
|
|
717
943
|
target: {
|
|
718
944
|
type: string;
|
|
719
945
|
enum: string[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { pixelEvents } from './pixel';
|
|
2
2
|
import { Theme } from '../../models';
|
|
3
3
|
import { ImageProps, urlPattern } from '../../components/Image/schema';
|
|
4
|
+
import { AnalyticsEventSchema } from './event';
|
|
4
5
|
export const mediaDirection = ['media-content', 'content-media'];
|
|
5
6
|
export const textSize = ['s', 'm', 'l'];
|
|
6
7
|
export const containerSizesArray = ['sm', 'md', 'lg', 'xl', 'all'];
|
|
@@ -306,6 +307,9 @@ export const ButtonProps = {
|
|
|
306
307
|
},
|
|
307
308
|
],
|
|
308
309
|
},
|
|
310
|
+
/**
|
|
311
|
+
* @deprecated Metrika will be deleted
|
|
312
|
+
*/
|
|
309
313
|
metrikaGoals: {
|
|
310
314
|
anyOf: [
|
|
311
315
|
{ type: 'string' },
|
|
@@ -328,7 +332,13 @@ export const ButtonProps = {
|
|
|
328
332
|
},
|
|
329
333
|
],
|
|
330
334
|
},
|
|
335
|
+
/**
|
|
336
|
+
* @deprecated Pixel will be deleted
|
|
337
|
+
*/
|
|
331
338
|
pixelEvents,
|
|
339
|
+
events: {
|
|
340
|
+
anyOf: [{ type: AnalyticsEventSchema }, { type: 'array', items: AnalyticsEventSchema }],
|
|
341
|
+
},
|
|
332
342
|
target: {
|
|
333
343
|
type: 'string',
|
|
334
344
|
enum: ['_self', '_blank', '_parent', '_top'],
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare const AnalyticsEventSchema: {
|
|
2
|
+
type: string;
|
|
3
|
+
additionalProperties: boolean;
|
|
4
|
+
required: string[];
|
|
5
|
+
properties: {
|
|
6
|
+
name: {
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
9
|
+
type: {
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
counters: {
|
|
13
|
+
type: string;
|
|
14
|
+
additionalProperties: boolean;
|
|
15
|
+
required: never[];
|
|
16
|
+
properties: {
|
|
17
|
+
include: {
|
|
18
|
+
type: string;
|
|
19
|
+
items: string;
|
|
20
|
+
};
|
|
21
|
+
exclude: {
|
|
22
|
+
type: string;
|
|
23
|
+
items: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
category: {
|
|
28
|
+
type: string;
|
|
29
|
+
};
|
|
30
|
+
label: {
|
|
31
|
+
type: string;
|
|
32
|
+
};
|
|
33
|
+
params: {
|
|
34
|
+
type: string;
|
|
35
|
+
items: {
|
|
36
|
+
type: string;
|
|
37
|
+
additionalProperties: boolean;
|
|
38
|
+
required: string[];
|
|
39
|
+
properties: {
|
|
40
|
+
key: {
|
|
41
|
+
type: string;
|
|
42
|
+
};
|
|
43
|
+
value: {
|
|
44
|
+
type: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export const AnalyticsEventSchema = {
|
|
2
|
+
type: 'object',
|
|
3
|
+
additionalProperties: false,
|
|
4
|
+
required: ['name'],
|
|
5
|
+
properties: {
|
|
6
|
+
name: {
|
|
7
|
+
type: 'string',
|
|
8
|
+
},
|
|
9
|
+
type: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
},
|
|
12
|
+
counters: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
additionalProperties: false,
|
|
15
|
+
required: [],
|
|
16
|
+
properties: {
|
|
17
|
+
include: {
|
|
18
|
+
type: 'array',
|
|
19
|
+
items: 'string',
|
|
20
|
+
},
|
|
21
|
+
exclude: {
|
|
22
|
+
type: 'array',
|
|
23
|
+
items: 'string',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
category: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
},
|
|
30
|
+
label: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
},
|
|
33
|
+
params: {
|
|
34
|
+
type: 'array',
|
|
35
|
+
items: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
additionalProperties: false,
|
|
38
|
+
required: ['key', 'value'],
|
|
39
|
+
properties: {
|
|
40
|
+
key: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
},
|
|
43
|
+
value: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -5,13 +5,15 @@ import { MobileContext } from '../../context/mobileContext';
|
|
|
5
5
|
import { useMetrika } from '../../hooks/useMetrika';
|
|
6
6
|
import { useHandleHubspotEvents } from '../../hooks';
|
|
7
7
|
import HubspotFormContainer from './HubspotFormContainer';
|
|
8
|
+
import { useAnalytics } from '../../hooks/useAnalytics';
|
|
8
9
|
import './HubspotForm.css';
|
|
9
10
|
const b = block('hubspot-form');
|
|
10
11
|
const HubspotForm = (props) => {
|
|
11
12
|
const { className, theme: themeProp, isMobile: isMobileProp, formId, formInstanceId, portalId, region, formClassName, pixelEvents,
|
|
12
13
|
// hubspotEvents, // TODO: decide how to handle them
|
|
13
|
-
onBeforeSubmit, onSubmit, onBeforeLoad, onLoad, } = props;
|
|
14
|
+
analyticsEvents, onBeforeSubmit, onSubmit, onBeforeLoad, onLoad, } = props;
|
|
14
15
|
const handleMetrika = useMetrika();
|
|
16
|
+
const handleAnalytics = useAnalytics();
|
|
15
17
|
const { themeValue } = useContext(ThemeValueContext);
|
|
16
18
|
const isMobileValue = useContext(MobileContext);
|
|
17
19
|
const theme = themeProp !== null && themeProp !== void 0 ? themeProp : themeValue;
|
|
@@ -22,9 +24,19 @@ const HubspotForm = (props) => {
|
|
|
22
24
|
onLoad,
|
|
23
25
|
onSubmit: (e) => {
|
|
24
26
|
handleMetrika === null || handleMetrika === void 0 ? void 0 : handleMetrika({ pixelEvents });
|
|
27
|
+
handleAnalytics(analyticsEvents);
|
|
25
28
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(e);
|
|
26
29
|
},
|
|
27
|
-
}), [
|
|
30
|
+
}), [
|
|
31
|
+
onBeforeLoad,
|
|
32
|
+
onBeforeSubmit,
|
|
33
|
+
onLoad,
|
|
34
|
+
handleMetrika,
|
|
35
|
+
pixelEvents,
|
|
36
|
+
handleAnalytics,
|
|
37
|
+
analyticsEvents,
|
|
38
|
+
onSubmit,
|
|
39
|
+
]);
|
|
28
40
|
useHandleHubspotEvents(handlers, formId);
|
|
29
41
|
return (React.createElement(HubspotFormContainer, { key: [formClassName, formId, formInstanceId, portalId, region].join(), className: b({ theme, mobile }, className), formClassName: formClassName, formId: formId, portalId: portalId, formInstanceId: formInstanceId, region: region }));
|
|
30
42
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0-alpha.1",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -132,5 +132,8 @@
|
|
|
132
132
|
"*.{json,yaml,yml,md}": [
|
|
133
133
|
"prettier --write"
|
|
134
134
|
]
|
|
135
|
+
},
|
|
136
|
+
"publishConfig": {
|
|
137
|
+
"tag": "alpha"
|
|
135
138
|
}
|
|
136
139
|
}
|