@gravity-ui/page-constructor 1.14.0-alpha.4 → 1.14.0-alpha.6

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.
Files changed (88) hide show
  1. package/CHANGELOG.md +0 -7
  2. package/build/cjs/blocks/Banner/schema.d.ts +312 -0
  3. package/build/cjs/blocks/Media/schema.d.ts +104 -0
  4. package/build/cjs/components/Button/Button.js +5 -2
  5. package/build/cjs/components/CardBase/CardBase.d.ts +2 -0
  6. package/build/cjs/components/CardBase/CardBase.js +4 -1
  7. package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +4 -1
  8. package/build/cjs/components/Link/Link.js +4 -1
  9. package/build/cjs/components/YandexForm/YandexForm.d.ts +2 -0
  10. package/build/cjs/components/YandexForm/YandexForm.js +13 -2
  11. package/build/cjs/containers/PageConstructor/Provider.d.ts +2 -0
  12. package/build/cjs/containers/PageConstructor/Provider.js +3 -1
  13. package/build/cjs/context/analyticsContext/analyticsContext.d.ts +6 -0
  14. package/build/cjs/context/analyticsContext/analyticsContext.js +6 -0
  15. package/build/cjs/context/analyticsContext/index.d.ts +1 -0
  16. package/build/cjs/{schema/validators/navigation.js → context/analyticsContext/index.js} +1 -1
  17. package/build/cjs/context/metrikaContext/metrikaContext.d.ts +6 -0
  18. package/build/cjs/hooks/useAnalytics.d.ts +2 -0
  19. package/build/cjs/hooks/useAnalytics.js +15 -0
  20. package/build/cjs/hooks/useMetrika.d.ts +6 -0
  21. package/build/cjs/hooks/useMetrika.js +8 -0
  22. package/build/cjs/models/common.d.ts +30 -0
  23. package/build/cjs/models/common.js +3 -0
  24. package/build/cjs/models/constructor-items/common.d.ts +4 -1
  25. package/build/cjs/models/constructor-items/sub-blocks.d.ts +2 -1
  26. package/build/cjs/models/navigation.d.ts +3 -1
  27. package/build/cjs/navigation/components/Header/Header.css +3 -5
  28. package/build/cjs/navigation/components/Logo/Logo.css +6 -5
  29. package/build/cjs/navigation/components/NavigationItem/NavigationItem.css +0 -1
  30. package/build/cjs/schema/index.d.ts +0 -111
  31. package/build/cjs/schema/index.js +1 -2
  32. package/build/cjs/schema/validators/common.d.ts +220 -0
  33. package/build/cjs/schema/validators/common.js +10 -0
  34. package/build/cjs/schema/validators/event.d.ts +50 -0
  35. package/build/cjs/schema/validators/event.js +53 -0
  36. package/build/cjs/schema/validators/index.d.ts +0 -2
  37. package/build/cjs/schema/validators/index.js +0 -2
  38. package/build/cjs/sub-blocks/HubspotForm/index.js +14 -2
  39. package/build/esm/blocks/Banner/schema.d.ts +312 -0
  40. package/build/esm/blocks/Media/schema.d.ts +104 -0
  41. package/build/esm/components/Button/Button.js +5 -2
  42. package/build/esm/components/CardBase/CardBase.d.ts +2 -0
  43. package/build/esm/components/CardBase/CardBase.js +4 -1
  44. package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +4 -1
  45. package/build/esm/components/Link/Link.js +4 -1
  46. package/build/esm/components/YandexForm/YandexForm.d.ts +2 -0
  47. package/build/esm/components/YandexForm/YandexForm.js +13 -2
  48. package/build/esm/containers/PageConstructor/Provider.d.ts +2 -0
  49. package/build/esm/containers/PageConstructor/Provider.js +3 -1
  50. package/build/esm/context/analyticsContext/analyticsContext.d.ts +6 -0
  51. package/build/esm/context/analyticsContext/analyticsContext.js +2 -0
  52. package/build/esm/context/analyticsContext/index.d.ts +1 -0
  53. package/build/esm/context/analyticsContext/index.js +1 -0
  54. package/build/esm/context/metrikaContext/metrikaContext.d.ts +6 -0
  55. package/build/esm/hooks/useAnalytics.d.ts +2 -0
  56. package/build/esm/hooks/useAnalytics.js +11 -0
  57. package/build/esm/hooks/useMetrika.d.ts +6 -0
  58. package/build/esm/hooks/useMetrika.js +8 -0
  59. package/build/esm/models/common.d.ts +30 -0
  60. package/build/esm/models/common.js +3 -0
  61. package/build/esm/models/constructor-items/common.d.ts +4 -1
  62. package/build/esm/models/constructor-items/sub-blocks.d.ts +2 -1
  63. package/build/esm/models/navigation.d.ts +3 -1
  64. package/build/esm/navigation/components/Header/Header.css +3 -5
  65. package/build/esm/navigation/components/Logo/Logo.css +6 -5
  66. package/build/esm/navigation/components/NavigationItem/NavigationItem.css +0 -1
  67. package/build/esm/schema/index.d.ts +0 -111
  68. package/build/esm/schema/index.js +1 -2
  69. package/build/esm/schema/validators/common.d.ts +220 -0
  70. package/build/esm/schema/validators/common.js +10 -0
  71. package/build/esm/schema/validators/event.d.ts +50 -0
  72. package/build/esm/schema/validators/event.js +50 -0
  73. package/build/esm/schema/validators/index.d.ts +0 -2
  74. package/build/esm/schema/validators/index.js +0 -2
  75. package/build/esm/sub-blocks/HubspotForm/index.js +14 -2
  76. package/package.json +1 -1
  77. package/server/models/common.d.ts +30 -0
  78. package/server/models/common.js +3 -0
  79. package/server/models/constructor-items/common.d.ts +4 -1
  80. package/server/models/constructor-items/sub-blocks.d.ts +2 -1
  81. package/server/models/navigation.d.ts +3 -1
  82. package/build/cjs/navigation/schema.d.ts +0 -104
  83. package/build/cjs/navigation/schema.js +0 -78
  84. package/build/cjs/schema/validators/navigation.d.ts +0 -1
  85. package/build/esm/navigation/schema.d.ts +0 -104
  86. package/build/esm/navigation/schema.js +0 -75
  87. package/build/esm/schema/validators/navigation.d.ts +0 -1
  88. package/build/esm/schema/validators/navigation.js +0 -1
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { AnalyticsEvent } from '../../models';
3
+ export interface AnalyticsContextProps {
4
+ sendEvents?: (e: AnalyticsEvent | AnalyticsEvent[]) => void;
5
+ }
6
+ export declare const AnalyticsContext: React.Context<AnalyticsContextProps>;
@@ -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,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("../../navigation/schema"), exports);
4
+ tslib_1.__exportStar(require("./analyticsContext"), exports);
@@ -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,2 @@
1
+ import { AnalyticsEvent } from '../models';
2
+ export declare const useAnalytics: () => (e?: AnalyticsEvent | AnalyticsEvent[]) => void;
@@ -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;
@@ -11,7 +11,7 @@ export interface NavigationItemBase {
11
11
  icon?: ImageProps;
12
12
  url?: string;
13
13
  }
14
- export interface NavigationLinkItem extends Omit<NavigationItemBase, 'url'> {
14
+ export interface NavigationLinkItem extends NavigationItemBase {
15
15
  type: NavigationItemType.Link;
16
16
  url: string;
17
17
  arrow?: boolean;
@@ -19,6 +19,8 @@ export interface NavigationLinkItem extends Omit<NavigationItemBase, 'url'> {
19
19
  }
20
20
  export interface NavigationButtonItem extends ButtonProps {
21
21
  type: NavigationItemType.Button;
22
+ url: string;
23
+ target?: string;
22
24
  }
23
25
  export interface NavigationDropdownItem extends NavigationItemBase {
24
26
  type: NavigationItemType.Dropdown;
@@ -18,27 +18,25 @@ unpredictable css rules order in build */
18
18
  height: var(--header-height);
19
19
  }
20
20
  @media (min-width: 769px) {
21
- .pc-header__mobile-menu-button.pc-header__mobile-menu-button {
21
+ .pc-header__mobile-menu-button {
22
22
  display: none;
23
23
  }
24
24
  }
25
-
26
25
  .pc-header__navigation, .pc-header__left, .pc-header__right {
27
26
  display: flex;
28
27
  align-items: center;
29
28
  }
30
- .pc-header__navigation.pc-header__navigation {
29
+ .pc-header__navigation {
31
30
  position: relative;
32
31
  margin-right: 20px;
33
32
  flex: 1 0 0;
34
33
  justify-content: flex-start;
35
34
  }
36
35
  @media (max-width: 768px) {
37
- .pc-header__navigation.pc-header__navigation {
36
+ .pc-header__navigation {
38
37
  display: none;
39
38
  }
40
39
  }
41
-
42
40
  .pc-header__right {
43
41
  flex: 0;
44
42
  justify-content: flex-end;
@@ -1,4 +1,4 @@
1
- .pc-logo__text {
1
+ .pc-logo {
2
2
  margin: 0;
3
3
  }
4
4
 
@@ -7,6 +7,11 @@ unpredictable css rules order in build */
7
7
  .pc-logo {
8
8
  display: flex;
9
9
  align-items: center;
10
+ font-weight: var(--yc-text-accent-font-weight);
11
+ font-size: var(--yc-text-header-1-font-size);
12
+ line-height: var(--yc-text-header-1-line-height);
13
+ color: var(--pc-text-header-color);
14
+ font-weight: var(--yc-text-accent-font-weight);
10
15
  }
11
16
  .pc-logo__icon {
12
17
  display: flex;
@@ -14,9 +19,5 @@ unpredictable css rules order in build */
14
19
  object-fit: contain;
15
20
  }
16
21
  .pc-logo__text {
17
- font-size: var(--yc-text-header-1-font-size);
18
- line-height: var(--yc-text-header-1-line-height);
19
- color: var(--pc-text-header-color);
20
- font-weight: var(--yc-text-accent-font-weight);
21
22
  white-space: nowrap;
22
23
  }
@@ -4,7 +4,6 @@ unpredictable css rules order in build */
4
4
  position: relative;
5
5
  display: flex;
6
6
  align-items: center;
7
- white-space: nowrap;
8
7
  }
9
8
  .pc-navigation-item_type_link {
10
9
  color: var(--yc-color-text-primary);
@@ -31,117 +31,6 @@ export declare function generateDefaultSchema(config?: SchemaCustomConfig): {
31
31
  additionalProperties: boolean;
32
32
  required: string[];
33
33
  properties: {
34
- logo: {
35
- oneOf: ({
36
- type: string;
37
- additionalProperties: boolean;
38
- required: string[];
39
- properties: {
40
- icon: {
41
- oneOf: ({
42
- type: string;
43
- properties: {
44
- when: {
45
- type: string;
46
- };
47
- };
48
- } | {
49
- type: string;
50
- pattern: string;
51
- })[];
52
- };
53
- text: {
54
- type: string;
55
- contentType: string;
56
- };
57
- url: {
58
- type: string;
59
- };
60
- };
61
- } | {
62
- type: string;
63
- additionalProperties: boolean;
64
- required: import("..").Theme[];
65
- properties: {};
66
- })[];
67
- };
68
- header: {
69
- type: string;
70
- additionalProperties: boolean;
71
- required: string[];
72
- properties: {
73
- leftItems: {
74
- oneOf: {
75
- type: string;
76
- additionalProperties: boolean;
77
- required: string[];
78
- properties: {
79
- type: {
80
- type: string;
81
- enum: string[];
82
- };
83
- items: {
84
- type: string;
85
- items: {
86
- type: string;
87
- properties: {
88
- when: {
89
- type: string;
90
- };
91
- };
92
- };
93
- };
94
- text: {
95
- type: string;
96
- contentType: string;
97
- };
98
- url: {
99
- type: string;
100
- };
101
- icon: {
102
- type: string;
103
- pattern: string;
104
- };
105
- };
106
- }[];
107
- };
108
- rightItems: {
109
- oneOf: {
110
- type: string;
111
- additionalProperties: boolean;
112
- required: string[];
113
- properties: {
114
- type: {
115
- type: string;
116
- enum: string[];
117
- };
118
- items: {
119
- type: string;
120
- items: {
121
- type: string;
122
- properties: {
123
- when: {
124
- type: string;
125
- };
126
- };
127
- };
128
- };
129
- text: {
130
- type: string;
131
- contentType: string;
132
- };
133
- url: {
134
- type: string;
135
- };
136
- icon: {
137
- type: string;
138
- pattern: string;
139
- };
140
- };
141
- }[];
142
- };
143
- };
144
- };
145
34
  blocks: {
146
35
  type: string;
147
36
  items: {
@@ -7,7 +7,6 @@ const blocks_1 = require("./validators/blocks");
7
7
  const sub_blocks_1 = require("./validators/sub-blocks");
8
8
  const common_1 = require("./validators/common");
9
9
  const utils_1 = require("./validators/utils");
10
- const navigation_1 = require("./validators/navigation");
11
10
  const getBlocksCases = (blocks) => {
12
11
  return Object.values(blocks).reduce((acc, block) => (Object.assign(Object.assign({}, acc), block)));
13
12
  };
@@ -89,7 +88,7 @@ function generateDefaultSchema(config) {
89
88
  type: 'object',
90
89
  additionalProperties: false,
91
90
  required: ['blocks'],
92
- properties: Object.assign(Object.assign(Object.assign({}, common_1.AnimatableProps), { logo: (0, common_1.withTheme)(navigation_1.LogoProps), header: navigation_1.NavigationHeaderProps, blocks: {
91
+ properties: Object.assign(Object.assign(Object.assign({}, common_1.AnimatableProps), { blocks: {
93
92
  type: 'array',
94
93
  items: {
95
94
  $ref: '#/definitions/children',