@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,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnalyticsContext = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
exports.AnalyticsContext = react_1.default.createContext({});
|
|
@@ -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,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAnalytics = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const analyticsContext_1 = require("../context/analyticsContext");
|
|
6
|
+
const useAnalytics = () => {
|
|
7
|
+
const { sendEvents } = (0, react_1.useContext)(analyticsContext_1.AnalyticsContext);
|
|
8
|
+
return (e) => {
|
|
9
|
+
if (!e) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
sendEvents === null || sendEvents === void 0 ? void 0 : sendEvents(e);
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
exports.useAnalytics = useAnalytics;
|
|
@@ -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 {};
|
|
@@ -5,12 +5,20 @@ const react_1 = require("react");
|
|
|
5
5
|
const metrikaContext_1 = require("../context/metrikaContext");
|
|
6
6
|
const models_1 = require("../models");
|
|
7
7
|
const guards_1 = require("../models/guards");
|
|
8
|
+
// eslint-disable-next-line valid-jsdoc
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Metrika will be deleted, which uses this logic
|
|
11
|
+
*/
|
|
8
12
|
function isButtonPixel(pixelEvents) {
|
|
9
13
|
if (Array.isArray(pixelEvents) && pixelEvents.length && 'name' in pixelEvents) {
|
|
10
14
|
return true;
|
|
11
15
|
}
|
|
12
16
|
return false;
|
|
13
17
|
}
|
|
18
|
+
// eslint-disable-next-line valid-jsdoc
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated useMetrika will be deleted
|
|
21
|
+
*/
|
|
14
22
|
const useMetrika = () => {
|
|
15
23
|
const { metrika, pixel } = (0, react_1.useContext)(metrikaContext_1.MetrikaContext);
|
|
16
24
|
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 {};
|
|
@@ -6,6 +6,9 @@ var Theme;
|
|
|
6
6
|
Theme["Light"] = "light";
|
|
7
7
|
Theme["Dark"] = "dark";
|
|
8
8
|
})(Theme = exports.Theme || (exports.Theme = {}));
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Pixel will be deleted from package
|
|
11
|
+
*/
|
|
9
12
|
var PixelEventType;
|
|
10
13
|
(function (PixelEventType) {
|
|
11
14
|
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[];
|
|
@@ -4,6 +4,7 @@ exports.BlockHeaderProps = exports.CardBase = exports.MediaProps = exports.Butto
|
|
|
4
4
|
const pixel_1 = require("./pixel");
|
|
5
5
|
const models_1 = require("../../models");
|
|
6
6
|
const schema_1 = require("../../components/Image/schema");
|
|
7
|
+
const event_1 = require("./event");
|
|
7
8
|
exports.mediaDirection = ['media-content', 'content-media'];
|
|
8
9
|
exports.textSize = ['s', 'm', 'l'];
|
|
9
10
|
exports.containerSizesArray = ['sm', 'md', 'lg', 'xl', 'all'];
|
|
@@ -309,6 +310,9 @@ exports.ButtonProps = {
|
|
|
309
310
|
},
|
|
310
311
|
],
|
|
311
312
|
},
|
|
313
|
+
/**
|
|
314
|
+
* @deprecated Metrika will be deleted
|
|
315
|
+
*/
|
|
312
316
|
metrikaGoals: {
|
|
313
317
|
anyOf: [
|
|
314
318
|
{ type: 'string' },
|
|
@@ -331,7 +335,13 @@ exports.ButtonProps = {
|
|
|
331
335
|
},
|
|
332
336
|
],
|
|
333
337
|
},
|
|
338
|
+
/**
|
|
339
|
+
* @deprecated Pixel will be deleted
|
|
340
|
+
*/
|
|
334
341
|
pixelEvents: pixel_1.pixelEvents,
|
|
342
|
+
events: {
|
|
343
|
+
anyOf: [{ type: event_1.AnalyticsEventSchema }, { type: 'array', items: event_1.AnalyticsEventSchema }],
|
|
344
|
+
},
|
|
335
345
|
target: {
|
|
336
346
|
type: 'string',
|
|
337
347
|
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,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnalyticsEventSchema = void 0;
|
|
4
|
+
exports.AnalyticsEventSchema = {
|
|
5
|
+
type: 'object',
|
|
6
|
+
additionalProperties: false,
|
|
7
|
+
required: ['name'],
|
|
8
|
+
properties: {
|
|
9
|
+
name: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
},
|
|
12
|
+
type: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
},
|
|
15
|
+
counters: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
additionalProperties: false,
|
|
18
|
+
required: [],
|
|
19
|
+
properties: {
|
|
20
|
+
include: {
|
|
21
|
+
type: 'array',
|
|
22
|
+
items: 'string',
|
|
23
|
+
},
|
|
24
|
+
exclude: {
|
|
25
|
+
type: 'array',
|
|
26
|
+
items: 'string',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
category: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
},
|
|
33
|
+
label: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
},
|
|
36
|
+
params: {
|
|
37
|
+
type: 'array',
|
|
38
|
+
items: {
|
|
39
|
+
type: 'object',
|
|
40
|
+
additionalProperties: false,
|
|
41
|
+
required: ['key', 'value'],
|
|
42
|
+
properties: {
|
|
43
|
+
key: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
},
|
|
46
|
+
value: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -8,12 +8,14 @@ const mobileContext_1 = require("../../context/mobileContext");
|
|
|
8
8
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
9
9
|
const hooks_1 = require("../../hooks");
|
|
10
10
|
const HubspotFormContainer_1 = tslib_1.__importDefault(require("./HubspotFormContainer"));
|
|
11
|
+
const useAnalytics_1 = require("../../hooks/useAnalytics");
|
|
11
12
|
const b = (0, utils_1.block)('hubspot-form');
|
|
12
13
|
const HubspotForm = (props) => {
|
|
13
14
|
const { className, theme: themeProp, isMobile: isMobileProp, formId, formInstanceId, portalId, region, formClassName, pixelEvents,
|
|
14
15
|
// hubspotEvents, // TODO: decide how to handle them
|
|
15
|
-
onBeforeSubmit, onSubmit, onBeforeLoad, onLoad, } = props;
|
|
16
|
+
analyticsEvents, onBeforeSubmit, onSubmit, onBeforeLoad, onLoad, } = props;
|
|
16
17
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
18
|
+
const handleAnalytics = (0, useAnalytics_1.useAnalytics)();
|
|
17
19
|
const { themeValue } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
|
|
18
20
|
const isMobileValue = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
19
21
|
const theme = themeProp !== null && themeProp !== void 0 ? themeProp : themeValue;
|
|
@@ -24,9 +26,19 @@ const HubspotForm = (props) => {
|
|
|
24
26
|
onLoad,
|
|
25
27
|
onSubmit: (e) => {
|
|
26
28
|
handleMetrika === null || handleMetrika === void 0 ? void 0 : handleMetrika({ pixelEvents });
|
|
29
|
+
handleAnalytics(analyticsEvents);
|
|
27
30
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(e);
|
|
28
31
|
},
|
|
29
|
-
}), [
|
|
32
|
+
}), [
|
|
33
|
+
onBeforeLoad,
|
|
34
|
+
onBeforeSubmit,
|
|
35
|
+
onLoad,
|
|
36
|
+
handleMetrika,
|
|
37
|
+
pixelEvents,
|
|
38
|
+
handleAnalytics,
|
|
39
|
+
analyticsEvents,
|
|
40
|
+
onSubmit,
|
|
41
|
+
]);
|
|
30
42
|
(0, hooks_1.useHandleHubspotEvents)(handlers, formId);
|
|
31
43
|
return (react_1.default.createElement(HubspotFormContainer_1.default, { key: [formClassName, formId, formInstanceId, portalId, region].join(), className: b({ theme, mobile }, className), formClassName: formClassName, formId: formId, portalId: portalId, formInstanceId: formInstanceId, region: region }));
|
|
32
44
|
};
|