@gravity-ui/page-constructor 2.23.0-alpha.0 → 2.23.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/build/cjs/blocks/Header/Header.css +7 -6
  3. package/build/cjs/blocks/Header/schema.d.ts +234 -0
  4. package/build/cjs/blocks/HeaderSlider/schema.d.ts +78 -0
  5. package/build/cjs/blocks/Media/schema.d.ts +156 -0
  6. package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +78 -0
  7. package/build/cjs/blocks/Security/schema.d.ts +78 -0
  8. package/build/cjs/blocks/Tabs/schema.d.ts +78 -0
  9. package/build/cjs/components/Media/Media.js +1 -1
  10. package/build/cjs/components/VideoBlock/VideoBlock.d.ts +2 -1
  11. package/build/cjs/components/VideoBlock/VideoBlock.js +6 -2
  12. package/build/cjs/models/common.d.ts +2 -1
  13. package/build/cjs/models/common.js +1 -0
  14. package/build/cjs/models/navigation.d.ts +0 -1
  15. package/build/cjs/navigation/components/Header/Header.css +0 -2
  16. package/build/cjs/navigation/components/Header/Header.js +2 -16
  17. package/build/cjs/schema/validators/common.d.ts +78 -0
  18. package/build/cjs/schema/validators/common.js +3 -0
  19. package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +78 -0
  20. package/build/cjs/sub-blocks/MediaCard/schema.d.ts +82 -0
  21. package/build/cjs/sub-blocks/MediaCard/schema.js +1 -1
  22. package/build/esm/blocks/Header/Header.css +7 -6
  23. package/build/esm/blocks/Header/schema.d.ts +234 -0
  24. package/build/esm/blocks/HeaderSlider/schema.d.ts +78 -0
  25. package/build/esm/blocks/Media/schema.d.ts +156 -0
  26. package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +78 -0
  27. package/build/esm/blocks/Security/schema.d.ts +78 -0
  28. package/build/esm/blocks/Tabs/schema.d.ts +78 -0
  29. package/build/esm/components/Media/Media.js +1 -1
  30. package/build/esm/components/VideoBlock/VideoBlock.d.ts +2 -1
  31. package/build/esm/components/VideoBlock/VideoBlock.js +6 -2
  32. package/build/esm/models/common.d.ts +2 -1
  33. package/build/esm/models/common.js +1 -0
  34. package/build/esm/models/navigation.d.ts +0 -1
  35. package/build/esm/navigation/components/Header/Header.css +0 -2
  36. package/build/esm/navigation/components/Header/Header.js +3 -17
  37. package/build/esm/schema/validators/common.d.ts +78 -0
  38. package/build/esm/schema/validators/common.js +3 -0
  39. package/build/esm/sub-blocks/LayoutItem/schema.d.ts +78 -0
  40. package/build/esm/sub-blocks/MediaCard/schema.d.ts +82 -0
  41. package/build/esm/sub-blocks/MediaCard/schema.js +2 -2
  42. package/package.json +1 -1
  43. package/server/models/common.d.ts +2 -1
  44. package/server/models/common.js +1 -0
  45. package/server/models/navigation.d.ts +0 -1
@@ -153,6 +153,84 @@ export declare const SecurityBlock: {
153
153
  fullscreen: {
154
154
  type: string;
155
155
  };
156
+ analyticsEvents: {
157
+ anyOf: ({
158
+ type: string;
159
+ additionalProperties: {
160
+ type: string;
161
+ };
162
+ required: string[];
163
+ properties: {
164
+ name: {
165
+ type: string;
166
+ };
167
+ type: {
168
+ type: string;
169
+ };
170
+ counters: {
171
+ type: string;
172
+ additionalProperties: boolean;
173
+ required: never[];
174
+ properties: {
175
+ include: {
176
+ type: string;
177
+ items: {
178
+ type: string;
179
+ };
180
+ };
181
+ exclude: {
182
+ type: string;
183
+ items: {
184
+ type: string;
185
+ };
186
+ };
187
+ };
188
+ };
189
+ context: {
190
+ type: string;
191
+ };
192
+ };
193
+ } | {
194
+ type: string;
195
+ items: {
196
+ type: string;
197
+ additionalProperties: {
198
+ type: string;
199
+ };
200
+ required: string[];
201
+ properties: {
202
+ name: {
203
+ type: string;
204
+ };
205
+ type: {
206
+ type: string;
207
+ };
208
+ counters: {
209
+ type: string;
210
+ additionalProperties: boolean;
211
+ required: never[];
212
+ properties: {
213
+ include: {
214
+ type: string;
215
+ items: {
216
+ type: string;
217
+ };
218
+ };
219
+ exclude: {
220
+ type: string;
221
+ items: {
222
+ type: string;
223
+ };
224
+ };
225
+ };
226
+ };
227
+ context: {
228
+ type: string;
229
+ };
230
+ };
231
+ };
232
+ })[];
233
+ };
156
234
  };
157
235
  };
158
236
  points: {
@@ -148,6 +148,84 @@ export declare const tabsItem: {
148
148
  fullscreen: {
149
149
  type: string;
150
150
  };
151
+ analyticsEvents: {
152
+ anyOf: ({
153
+ type: string;
154
+ additionalProperties: {
155
+ type: string;
156
+ };
157
+ required: string[];
158
+ properties: {
159
+ name: {
160
+ type: string;
161
+ };
162
+ type: {
163
+ type: string;
164
+ };
165
+ counters: {
166
+ type: string;
167
+ additionalProperties: boolean;
168
+ required: never[];
169
+ properties: {
170
+ include: {
171
+ type: string;
172
+ items: {
173
+ type: string;
174
+ };
175
+ };
176
+ exclude: {
177
+ type: string;
178
+ items: {
179
+ type: string;
180
+ };
181
+ };
182
+ };
183
+ };
184
+ context: {
185
+ type: string;
186
+ };
187
+ };
188
+ } | {
189
+ type: string;
190
+ items: {
191
+ type: string;
192
+ additionalProperties: {
193
+ type: string;
194
+ };
195
+ required: string[];
196
+ properties: {
197
+ name: {
198
+ type: string;
199
+ };
200
+ type: {
201
+ type: string;
202
+ };
203
+ counters: {
204
+ type: string;
205
+ additionalProperties: boolean;
206
+ required: never[];
207
+ properties: {
208
+ include: {
209
+ type: string;
210
+ items: {
211
+ type: string;
212
+ };
213
+ };
214
+ exclude: {
215
+ type: string;
216
+ items: {
217
+ type: string;
218
+ };
219
+ };
220
+ };
221
+ };
222
+ context: {
223
+ type: string;
224
+ };
225
+ };
226
+ };
227
+ })[];
228
+ };
151
229
  };
152
230
  } | {
153
231
  type: string;
@@ -44,7 +44,7 @@ const Media = (props) => {
44
44
  }
45
45
  }
46
46
  if (youtube) {
47
- result = (react_1.default.createElement(VideoBlock_1.default, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: getFullscreen({ fullScreen, fullscreen }) }));
47
+ result = (react_1.default.createElement(VideoBlock_1.default, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: getFullscreen({ fullScreen, fullscreen }), analyticsEvents: analyticsEvents }));
48
48
  }
49
49
  if (dataLens) {
50
50
  result = react_1.default.createElement(DataLens_1.default, { dataLens: dataLens });
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
+ import { AnalyticsEventsBase } from '../../models/common';
2
3
  export declare const AUTOPLAY_ATTRIBUTES: {
3
4
  autoplay: number;
4
5
  mute: number;
5
6
  };
6
7
  export declare function getHeight(width: number): number;
7
- export interface VideoBlockProps {
8
+ export interface VideoBlockProps extends AnalyticsEventsBase {
8
9
  id?: string;
9
10
  stream?: string;
10
11
  record?: string;
@@ -6,7 +6,9 @@ const react_1 = tslib_1.__importStar(require("react"));
6
6
  const uikit_1 = require("@gravity-ui/uikit");
7
7
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
8
8
  const uuid_1 = require("uuid");
9
+ const useAnalytics_1 = require("../../hooks/useAnalytics");
9
10
  const icons_1 = require("../../icons");
11
+ const common_1 = require("../../models/common");
10
12
  const utils_1 = require("../../utils");
11
13
  const Image_1 = tslib_1.__importDefault(require("../Image/Image"));
12
14
  const i18n_1 = tslib_1.__importDefault(require("./i18n"));
@@ -39,7 +41,8 @@ function getHeight(width) {
39
41
  }
40
42
  exports.getHeight = getHeight;
41
43
  const VideoBlock = (props) => {
42
- const { stream, record, attributes, className, id, previewImg, playButton, height, fullScreen, fullscreen, } = props;
44
+ const { stream, record, attributes, className, id, previewImg, playButton, height, fullScreen, fullscreen, analyticsEvents, } = props;
45
+ const handleAnalytics = (0, useAnalytics_1.useAnalytics)(common_1.DefaultEventNames.VideoPreview);
43
46
  const src = getVideoSrc(stream, record);
44
47
  const ref = (0, react_1.useRef)(null);
45
48
  const iframeRef = (0, react_1.useRef)();
@@ -48,11 +51,12 @@ const VideoBlock = (props) => {
48
51
  const [currentHeight, setCurrentHeight] = (0, react_1.useState)(height || undefined);
49
52
  const fullId = id || (0, uuid_1.v4)();
50
53
  const onPreviewClick = (0, react_1.useCallback)(() => {
54
+ handleAnalytics(analyticsEvents);
51
55
  if (iframeRef.current) {
52
56
  iframeRef.current.src = `${src}?${(0, utils_1.getPageSearchParams)(Object.assign(Object.assign({}, exports.AUTOPLAY_ATTRIBUTES), (attributes || {})))}`;
53
57
  }
54
58
  setTimeout(() => setHidePreview(true), AUTOPLAY_DELAY);
55
- }, [src, attributes]);
59
+ }, [handleAnalytics, analyticsEvents, src, attributes]);
56
60
  (0, react_1.useEffect)(() => {
57
61
  const updateSize = lodash_1.default.debounce(() => {
58
62
  setCurrentHeight(ref.current ? Math.round(getHeight(ref.current.offsetWidth)) : undefined);
@@ -79,7 +79,8 @@ export declare enum DefaultEventNames {
79
79
  HubspotFormSubmit = "hubspot-form-submit",
80
80
  QuoteButton = "quote-button-click",
81
81
  BackLink = "back-link-click",
82
- Breadcrumb = "breadcrumb-click"
82
+ Breadcrumb = "breadcrumb-click",
83
+ VideoPreview = "video-preview-click"
83
84
  }
84
85
  export type AnalyticsCounters = {
85
86
  include?: string[];
@@ -48,4 +48,5 @@ var DefaultEventNames;
48
48
  DefaultEventNames["QuoteButton"] = "quote-button-click";
49
49
  DefaultEventNames["BackLink"] = "back-link-click";
50
50
  DefaultEventNames["Breadcrumb"] = "breadcrumb-click";
51
+ DefaultEventNames["VideoPreview"] = "video-preview-click";
51
52
  })(DefaultEventNames = exports.DefaultEventNames || (exports.DefaultEventNames = {}));
@@ -63,7 +63,6 @@ export interface HeaderData {
63
63
  leftItems: NavigationItemModel[];
64
64
  rightItems?: NavigationItemModel[];
65
65
  iconSize?: number;
66
- withBorder?: boolean;
67
66
  }
68
67
  export interface FooterColumn {
69
68
  title: string;
@@ -9,8 +9,6 @@ unpredictable css rules order in build */
9
9
  align-items: center;
10
10
  height: var(--header-height);
11
11
  background-color: var(--yc-color-base-background);
12
- }
13
- .pc-header_with-border {
14
12
  box-shadow: inset 0 -1px 0 var(--yc-color-line-generic);
15
13
  }
16
14
  .pc-header__wrapper {
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Header = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
7
6
  const Control_1 = tslib_1.__importDefault(require("../../../components/Control/Control"));
8
7
  const OutsideClick_1 = tslib_1.__importDefault(require("../../../components/OutsideClick/OutsideClick"));
9
8
  const grid_1 = require("../../../grid");
@@ -28,10 +27,9 @@ const MobileMenuButton = ({ isSidebarOpened, onSidebarOpenedChange, }) => {
28
27
  };
29
28
  const iconSizeKey = 'iconSize';
30
29
  const Header = ({ data, logo }) => {
31
- const { leftItems, rightItems, iconSize = 20, withBorder = false } = data;
30
+ const { leftItems, rightItems, iconSize = 20 } = data;
32
31
  const [isSidebarOpened, setIsSidebarOpened] = (0, react_1.useState)(false);
33
32
  const [activeItemId, setactiveItemId] = (0, react_1.useState)(undefined);
34
- const [withHeaderBorder, setWithHeaderBorder] = (0, react_1.useState)(withBorder);
35
33
  const getNavigationItemWithIconSize = (0, react_1.useCallback)((item) => {
36
34
  if (!(iconSizeKey in item)) {
37
35
  return Object.assign(Object.assign({}, item), { iconSize });
@@ -52,19 +50,7 @@ const Header = ({ data, logo }) => {
52
50
  const hideSidebar = (0, react_1.useCallback)(() => {
53
51
  setIsSidebarOpened(false);
54
52
  }, []);
55
- (0, react_1.useEffect)(() => {
56
- const handleScroll = () => {
57
- if (window.scrollY > 0 && !withBorder) {
58
- setWithHeaderBorder(true);
59
- }
60
- else if (window.scrollY === 0 && !withBorder) {
61
- setWithHeaderBorder(false);
62
- }
63
- };
64
- window.addEventListener('scroll', lodash_1.default.debounce(handleScroll, 5), { passive: true });
65
- return () => window.removeEventListener('scroll', lodash_1.default.debounce(handleScroll, 5));
66
- });
67
- return (react_1.default.createElement(grid_1.Grid, { className: b({ 'with-border': withHeaderBorder }) },
53
+ return (react_1.default.createElement(grid_1.Grid, { className: b() },
68
54
  react_1.default.createElement(grid_1.Row, null,
69
55
  react_1.default.createElement(grid_1.Col, null,
70
56
  react_1.default.createElement("header", { className: b('wrapper') },
@@ -1120,6 +1120,84 @@ export declare const MediaProps: {
1120
1120
  fullscreen: {
1121
1121
  type: string;
1122
1122
  };
1123
+ analyticsEvents: {
1124
+ anyOf: ({
1125
+ type: string;
1126
+ additionalProperties: {
1127
+ type: string;
1128
+ };
1129
+ required: string[];
1130
+ properties: {
1131
+ name: {
1132
+ type: string;
1133
+ };
1134
+ type: {
1135
+ type: string;
1136
+ };
1137
+ counters: {
1138
+ type: string;
1139
+ additionalProperties: boolean;
1140
+ required: never[];
1141
+ properties: {
1142
+ include: {
1143
+ type: string;
1144
+ items: {
1145
+ type: string;
1146
+ };
1147
+ };
1148
+ exclude: {
1149
+ type: string;
1150
+ items: {
1151
+ type: string;
1152
+ };
1153
+ };
1154
+ };
1155
+ };
1156
+ context: {
1157
+ type: string;
1158
+ };
1159
+ };
1160
+ } | {
1161
+ type: string;
1162
+ items: {
1163
+ type: string;
1164
+ additionalProperties: {
1165
+ type: string;
1166
+ };
1167
+ required: string[];
1168
+ properties: {
1169
+ name: {
1170
+ type: string;
1171
+ };
1172
+ type: {
1173
+ type: string;
1174
+ };
1175
+ counters: {
1176
+ type: string;
1177
+ additionalProperties: boolean;
1178
+ required: never[];
1179
+ properties: {
1180
+ include: {
1181
+ type: string;
1182
+ items: {
1183
+ type: string;
1184
+ };
1185
+ };
1186
+ exclude: {
1187
+ type: string;
1188
+ items: {
1189
+ type: string;
1190
+ };
1191
+ };
1192
+ };
1193
+ };
1194
+ context: {
1195
+ type: string;
1196
+ };
1197
+ };
1198
+ };
1199
+ })[];
1200
+ };
1123
1201
  };
1124
1202
  export declare const YMapMarkerLabel: {
1125
1203
  type: string;
@@ -463,6 +463,9 @@ exports.MediaProps = {
463
463
  fullscreen: {
464
464
  type: 'boolean',
465
465
  },
466
+ analyticsEvents: {
467
+ anyOf: [event_1.AnalyticsEventSchema, { type: 'array', items: event_1.AnalyticsEventSchema }],
468
+ },
466
469
  };
467
470
  exports.YMapMarkerLabel = {
468
471
  type: 'object',
@@ -138,6 +138,84 @@ export declare const LayoutItem: {
138
138
  fullscreen: {
139
139
  type: string;
140
140
  };
141
+ analyticsEvents: {
142
+ anyOf: ({
143
+ type: string;
144
+ additionalProperties: {
145
+ type: string;
146
+ };
147
+ required: string[];
148
+ properties: {
149
+ name: {
150
+ type: string;
151
+ };
152
+ type: {
153
+ type: string;
154
+ };
155
+ counters: {
156
+ type: string;
157
+ additionalProperties: boolean;
158
+ required: never[];
159
+ properties: {
160
+ include: {
161
+ type: string;
162
+ items: {
163
+ type: string;
164
+ };
165
+ };
166
+ exclude: {
167
+ type: string;
168
+ items: {
169
+ type: string;
170
+ };
171
+ };
172
+ };
173
+ };
174
+ context: {
175
+ type: string;
176
+ };
177
+ };
178
+ } | {
179
+ type: string;
180
+ items: {
181
+ type: string;
182
+ additionalProperties: {
183
+ type: string;
184
+ };
185
+ required: string[];
186
+ properties: {
187
+ name: {
188
+ type: string;
189
+ };
190
+ type: {
191
+ type: string;
192
+ };
193
+ counters: {
194
+ type: string;
195
+ additionalProperties: boolean;
196
+ required: never[];
197
+ properties: {
198
+ include: {
199
+ type: string;
200
+ items: {
201
+ type: string;
202
+ };
203
+ };
204
+ exclude: {
205
+ type: string;
206
+ items: {
207
+ type: string;
208
+ };
209
+ };
210
+ };
211
+ };
212
+ context: {
213
+ type: string;
214
+ };
215
+ };
216
+ };
217
+ })[];
218
+ };
141
219
  };
142
220
  content: Partial<{
143
221
  title: {
@@ -140,6 +140,88 @@ export declare const MediaCardBlock: {
140
140
  fullscreen: {
141
141
  type: string;
142
142
  };
143
+ analyticsEvents: {
144
+ anyOf: ({
145
+ type: string;
146
+ additionalProperties: {
147
+ type: string;
148
+ };
149
+ required: string[];
150
+ properties: {
151
+ name: {
152
+ type: string;
153
+ };
154
+ type: {
155
+ type: string;
156
+ };
157
+ counters: {
158
+ type: string;
159
+ additionalProperties: boolean;
160
+ required: never[];
161
+ properties: {
162
+ include: {
163
+ type: string;
164
+ items: {
165
+ type: string;
166
+ };
167
+ };
168
+ exclude: {
169
+ type: string;
170
+ items: {
171
+ type: string;
172
+ };
173
+ };
174
+ };
175
+ };
176
+ context: {
177
+ type: string;
178
+ };
179
+ };
180
+ } | {
181
+ type: string;
182
+ items: {
183
+ type: string;
184
+ additionalProperties: {
185
+ type: string;
186
+ };
187
+ required: string[];
188
+ properties: {
189
+ name: {
190
+ type: string;
191
+ };
192
+ type: {
193
+ type: string;
194
+ };
195
+ counters: {
196
+ type: string;
197
+ additionalProperties: boolean;
198
+ required: never[];
199
+ properties: {
200
+ include: {
201
+ type: string;
202
+ items: {
203
+ type: string;
204
+ };
205
+ };
206
+ exclude: {
207
+ type: string;
208
+ items: {
209
+ type: string;
210
+ };
211
+ };
212
+ };
213
+ };
214
+ context: {
215
+ type: string;
216
+ };
217
+ };
218
+ };
219
+ })[];
220
+ };
221
+ border: {
222
+ type: string;
223
+ enum: string[];
224
+ };
143
225
  type: {};
144
226
  when: {};
145
227
  };
@@ -6,6 +6,6 @@ exports.MediaCardBlock = {
6
6
  'media-card': {
7
7
  additionalProperties: false,
8
8
  required: [],
9
- properties: Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), common_1.MediaProps), common_1.AnimatableProps),
9
+ properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), common_1.CardBase), common_1.MediaProps), common_1.AnimatableProps),
10
10
  },
11
11
  };
@@ -6,6 +6,7 @@
6
6
  unpredictable css rules order in build */
7
7
  .pc-header-block {
8
8
  position: relative;
9
+ margin: 16px 0;
9
10
  }
10
11
  .pc-header-block_full-width {
11
12
  --pc-border-radius: 0;
@@ -29,16 +30,16 @@ unpredictable css rules order in build */
29
30
  margin: 16px 0;
30
31
  }
31
32
  .pc-header-block__content_vertical-offset_s {
32
- padding: 64px 0;
33
+ padding: 48px 0;
33
34
  }
34
35
  .pc-header-block__content_vertical-offset_m {
35
- padding: 96px 0;
36
+ padding: calc(96px - 16px) 0;
36
37
  }
37
38
  .pc-header-block__content_vertical-offset_l {
38
- padding: 128px 0;
39
+ padding: calc(128px - 16px) 0;
39
40
  }
40
41
  .pc-header-block__content_vertical-offset_xl {
41
- padding: 160px 0;
42
+ padding: calc(160px - 16px) 0;
42
43
  }
43
44
  .pc-header-block__content_offset_large {
44
45
  padding: calc(128px - 16px) 0 16px;
@@ -94,10 +95,10 @@ unpredictable css rules order in build */
94
95
  .pc-header-block__media {
95
96
  position: absolute;
96
97
  display: none;
97
- top: 16px;
98
+ top: 0;
98
99
  right: 0;
99
100
  width: 50%;
100
- height: calc(100% - 2 * 16px);
101
+ height: 100%;
101
102
  overflow: hidden;
102
103
  object-fit: cover;
103
104
  border-radius: var(--pc-border-radius);