@gravity-ui/page-constructor 3.0.0 → 3.1.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 (63) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +15 -0
  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/Slider/Slider.js +1 -1
  8. package/build/cjs/blocks/Tabs/schema.d.ts +78 -0
  9. package/build/cjs/components/BlockBase/BlockBase.js +2 -2
  10. package/build/cjs/components/Media/Media.js +1 -1
  11. package/build/cjs/components/VideoBlock/VideoBlock.d.ts +2 -1
  12. package/build/cjs/components/VideoBlock/VideoBlock.js +6 -2
  13. package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts +2 -2
  14. package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +2 -2
  15. package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +5 -3
  16. package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +1 -1
  17. package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +4 -2
  18. package/build/cjs/customization/BlockDecoration.d.ts +1 -1
  19. package/build/cjs/customization/BlockDecoration.js +4 -8
  20. package/build/cjs/models/common.d.ts +2 -1
  21. package/build/cjs/models/common.js +1 -0
  22. package/build/cjs/models/constructor-items/blocks.d.ts +1 -0
  23. package/build/cjs/models/customization.d.ts +1 -1
  24. package/build/cjs/schema/validators/common.d.ts +78 -0
  25. package/build/cjs/schema/validators/common.js +3 -0
  26. package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +78 -0
  27. package/build/cjs/sub-blocks/MediaCard/schema.d.ts +78 -0
  28. package/build/cjs/utils/blocks.d.ts +0 -1
  29. package/build/cjs/utils/blocks.js +1 -3
  30. package/build/esm/blocks/Header/schema.d.ts +234 -0
  31. package/build/esm/blocks/HeaderSlider/schema.d.ts +78 -0
  32. package/build/esm/blocks/Media/schema.d.ts +156 -0
  33. package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +78 -0
  34. package/build/esm/blocks/Slider/Slider.js +2 -2
  35. package/build/esm/blocks/Tabs/schema.d.ts +78 -0
  36. package/build/esm/components/BlockBase/BlockBase.js +2 -2
  37. package/build/esm/components/Media/Media.js +1 -1
  38. package/build/esm/components/VideoBlock/VideoBlock.d.ts +2 -1
  39. package/build/esm/components/VideoBlock/VideoBlock.js +6 -2
  40. package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts +2 -2
  41. package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +2 -2
  42. package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +5 -3
  43. package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +1 -1
  44. package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +4 -2
  45. package/build/esm/customization/BlockDecoration.d.ts +1 -1
  46. package/build/esm/customization/BlockDecoration.js +4 -8
  47. package/build/esm/models/common.d.ts +2 -1
  48. package/build/esm/models/common.js +1 -0
  49. package/build/esm/models/constructor-items/blocks.d.ts +1 -0
  50. package/build/esm/models/customization.d.ts +1 -1
  51. package/build/esm/schema/validators/common.d.ts +78 -0
  52. package/build/esm/schema/validators/common.js +3 -0
  53. package/build/esm/sub-blocks/LayoutItem/schema.d.ts +78 -0
  54. package/build/esm/sub-blocks/MediaCard/schema.d.ts +78 -0
  55. package/build/esm/utils/blocks.d.ts +0 -1
  56. package/build/esm/utils/blocks.js +0 -1
  57. package/package.json +1 -1
  58. package/server/models/common.d.ts +2 -1
  59. package/server/models/common.js +1 -0
  60. package/server/models/constructor-items/blocks.d.ts +1 -0
  61. package/server/models/customization.d.ts +1 -1
  62. package/server/utils/blocks.d.ts +0 -1
  63. package/server/utils/blocks.js +1 -3
@@ -145,6 +145,84 @@ export declare const tabsItem: {
145
145
  fullscreen: {
146
146
  type: string;
147
147
  };
148
+ analyticsEvents: {
149
+ anyOf: ({
150
+ type: string;
151
+ additionalProperties: {
152
+ type: string;
153
+ };
154
+ required: string[];
155
+ properties: {
156
+ name: {
157
+ type: string;
158
+ };
159
+ type: {
160
+ type: string;
161
+ };
162
+ counters: {
163
+ type: string;
164
+ additionalProperties: boolean;
165
+ required: never[];
166
+ properties: {
167
+ include: {
168
+ type: string;
169
+ items: {
170
+ type: string;
171
+ };
172
+ };
173
+ exclude: {
174
+ type: string;
175
+ items: {
176
+ type: string;
177
+ };
178
+ };
179
+ };
180
+ };
181
+ context: {
182
+ type: string;
183
+ };
184
+ };
185
+ } | {
186
+ type: string;
187
+ items: {
188
+ type: string;
189
+ additionalProperties: {
190
+ type: string;
191
+ };
192
+ required: string[];
193
+ properties: {
194
+ name: {
195
+ type: string;
196
+ };
197
+ type: {
198
+ type: string;
199
+ };
200
+ counters: {
201
+ type: string;
202
+ additionalProperties: boolean;
203
+ required: never[];
204
+ properties: {
205
+ include: {
206
+ type: string;
207
+ items: {
208
+ type: string;
209
+ };
210
+ };
211
+ exclude: {
212
+ type: string;
213
+ items: {
214
+ type: string;
215
+ };
216
+ };
217
+ };
218
+ };
219
+ context: {
220
+ type: string;
221
+ };
222
+ };
223
+ };
224
+ })[];
225
+ };
148
226
  };
149
227
  } | {
150
228
  type: string;
@@ -6,9 +6,9 @@ import Anchor from '../Anchor/Anchor';
6
6
  import './BlockBase.css';
7
7
  const b = block('block-base');
8
8
  const BlockBase = (props) => {
9
- const { anchor, visible, children, className, resetPaddings, qa } = props;
9
+ const { anchor, visible, children, className, resetPaddings, qa, index = 0 } = props;
10
10
  return (React.createElement(Col, { className: b({ ['reset-paddings']: resetPaddings }, className), visible: visible, reset: true, dataQa: qa },
11
- React.createElement(BlockDecoration, null,
11
+ React.createElement(BlockDecoration, { id: index },
12
12
  anchor && React.createElement(Anchor, { id: anchor.url, className: b('anchor') }),
13
13
  children)));
14
14
  };
@@ -39,7 +39,7 @@ export const Media = (props) => {
39
39
  }
40
40
  }
41
41
  if (youtube) {
42
- result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: fullscreen }));
42
+ result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: fullscreen, analyticsEvents: analyticsEvents }));
43
43
  }
44
44
  if (dataLens) {
45
45
  result = React.createElement(DataLens, { dataLens: dataLens });
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
+ import { AnalyticsEventsBase } from '../../models/common';
2
3
  import './VideoBlock.css';
3
4
  export declare const AUTOPLAY_ATTRIBUTES: {
4
5
  autoplay: number;
5
6
  mute: number;
6
7
  };
7
8
  export declare function getHeight(width: number): number;
8
- export interface VideoBlockProps {
9
+ export interface VideoBlockProps extends AnalyticsEventsBase {
9
10
  id?: string;
10
11
  stream?: string;
11
12
  record?: string;
@@ -2,7 +2,9 @@ import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { Icon } from '@gravity-ui/uikit';
3
3
  import _ from 'lodash';
4
4
  import { v4 as uuidv4 } from 'uuid';
5
+ import { useAnalytics } from '../../hooks/useAnalytics';
5
6
  import { PlayVideo } from '../../icons';
7
+ import { DefaultEventNames } from '../../models/common';
6
8
  import { block, getPageSearchParams } from '../../utils';
7
9
  import Image from '../Image/Image';
8
10
  import i18n from './i18n';
@@ -35,7 +37,8 @@ export function getHeight(width) {
35
37
  return (width / 16) * 9;
36
38
  }
37
39
  const VideoBlock = (props) => {
38
- const { stream, record, attributes, className, id, previewImg, playButton, height, fullscreen } = props;
40
+ const { stream, record, attributes, className, id, previewImg, playButton, height, fullscreen, analyticsEvents, } = props;
41
+ const handleAnalytics = useAnalytics(DefaultEventNames.VideoPreview);
39
42
  const src = getVideoSrc(stream, record);
40
43
  const ref = useRef(null);
41
44
  const iframeRef = useRef();
@@ -44,11 +47,12 @@ const VideoBlock = (props) => {
44
47
  const [currentHeight, setCurrentHeight] = useState(height || undefined);
45
48
  const fullId = id || uuidv4();
46
49
  const onPreviewClick = useCallback(() => {
50
+ handleAnalytics(analyticsEvents);
47
51
  if (iframeRef.current) {
48
52
  iframeRef.current.src = `${src}?${getPageSearchParams(Object.assign(Object.assign({}, AUTOPLAY_ATTRIBUTES), (attributes || {})))}`;
49
53
  }
50
54
  setTimeout(() => setHidePreview(true), AUTOPLAY_DELAY);
51
- }, [src, attributes]);
55
+ }, [handleAnalytics, analyticsEvents, src, attributes]);
52
56
  useEffect(() => {
53
57
  const updateSize = _.debounce(() => {
54
58
  setCurrentHeight(ref.current ? Math.round(getHeight(ref.current.offsetWidth)) : undefined);
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { Block, WithChildren } from '../../../../models';
3
- interface ConstructorBlockProps {
2
+ import { Block, BlockBaseProps, WithChildren } from '../../../../models';
3
+ interface ConstructorBlockProps extends Pick<BlockBaseProps, 'index'> {
4
4
  data: Block;
5
5
  }
6
6
  export declare const ConstructorBlock: React.FC<WithChildren<ConstructorBlockProps>>;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import BlockBase from '../../../../components/BlockBase/BlockBase';
3
3
  import { block } from '../../../../utils';
4
4
  const b = block('constructor-block');
5
- export const ConstructorBlock = ({ data, children, }) => {
5
+ export const ConstructorBlock = ({ index = 0, data, children, }) => {
6
6
  const { anchor, visible, type } = data;
7
- return (React.createElement(BlockBase, { className: b({ type }), anchor: anchor, visible: visible, resetPaddings: data.resetPaddings }, children));
7
+ return (React.createElement(BlockBase, { index: index, className: b({ type }), anchor: anchor, visible: visible, resetPaddings: data.resetPaddings }, children));
8
8
  };
@@ -1,6 +1,5 @@
1
1
  import React, { Fragment, useContext } from 'react';
2
2
  import _ from 'lodash';
3
- import { BlockIdContext } from '../../../../context/blockIdContext';
4
3
  import { InnerContext } from '../../../../context/innerContext';
5
4
  import { getBlockKey } from '../../../../utils';
6
5
  import { ConstructorBlock } from '../ConstructorBlock/ConstructorBlock';
@@ -31,9 +30,12 @@ export const ConstructorBlocks = ({ items }) => {
31
30
  if ('children' in item && item.children) {
32
31
  children = item.children.map(renderer.bind(null, blockId));
33
32
  }
34
- itemElement = (React.createElement(ConstructorItem, { data: item, blockKey: blockId }, children));
33
+ itemElement = (React.createElement(ConstructorItem, { data: item, key: blockId, blockKey: blockId }, children));
35
34
  }
36
- return (React.createElement(BlockIdContext.Provider, { value: blockId, key: blockId }, blockTypes.includes(item.type) ? (React.createElement(ConstructorBlock, { data: item }, itemElement)) : (itemElement)));
35
+ return blockTypes.includes(item.type) ? (
36
+ //TODO: replace ConstructorBlock (and delete it) with BlockBase when all
37
+ // components relying on constructor inner structure like Slider or blog-constructor will be refactored
38
+ React.createElement(ConstructorBlock, { data: item, key: blockId, index: index }, itemElement)) : (itemElement);
37
39
  };
38
40
  return React.createElement(Fragment, null, items.map(renderer.bind(null, '')));
39
41
  };
@@ -3,5 +3,5 @@ export interface ConstructorItemProps {
3
3
  data: ConstructorItemType;
4
4
  blockKey: string;
5
5
  }
6
- export declare const ConstructorItem: ({ data, children }: WithChildren<ConstructorItemProps>) => JSX.Element;
6
+ export declare const ConstructorItem: ({ data, blockKey, children }: WithChildren<ConstructorItemProps>) => JSX.Element;
7
7
  export declare const ConstructorHeader: ({ data, blockKey, }: Pick<ConstructorItemProps, 'data' | 'blockKey'>) => JSX.Element;
@@ -1,12 +1,14 @@
1
1
  import { __rest } from "tslib";
2
2
  import React, { useContext } from 'react';
3
+ import { BlockIdContext } from '../../../../context/blockIdContext';
3
4
  import { InnerContext } from '../../../../context/innerContext';
4
5
  import { BlockDecoration } from '../../../../customization/BlockDecoration';
5
- export const ConstructorItem = ({ data, children }) => {
6
+ export const ConstructorItem = ({ data, blockKey, children }) => {
6
7
  const { itemMap } = useContext(InnerContext);
7
8
  const { type } = data, rest = __rest(data, ["type"]);
8
9
  const Component = itemMap[type];
9
- return React.createElement(Component, Object.assign({}, rest), children);
10
+ return (React.createElement(BlockIdContext.Provider, { value: blockKey },
11
+ React.createElement(Component, Object.assign({}, rest), children)));
10
12
  };
11
13
  export const ConstructorHeader = ({ data, blockKey, }) => (React.createElement(BlockDecoration, { id: data.type },
12
14
  React.createElement(ConstructorItem, { data: data, key: data.type, blockKey: blockKey })));
@@ -1,3 +1,3 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { BlockDecorationProps } from '../models';
3
- export declare const BlockDecoration: (props: PropsWithChildren<BlockDecorationProps>) => JSX.Element;
3
+ export declare const BlockDecoration: ({ id, children: blockChildren, }: PropsWithChildren<BlockDecorationProps>) => JSX.Element;
@@ -1,17 +1,13 @@
1
1
  import React, { Fragment, useContext } from 'react';
2
- import { BlockIdContext } from '../context/blockIdContext';
3
2
  import { InnerContext } from '../context/innerContext';
4
- import { getBlockIndexFromId } from '../utils';
5
- export const BlockDecoration = (props) => {
3
+ export const BlockDecoration = ({ id, children: blockChildren, }) => {
6
4
  var _a, _b;
7
- const blockContenxtId = getBlockIndexFromId(useContext(BlockIdContext));
8
5
  const { headerBlockTypes } = useContext(InnerContext);
9
- const blockId = props.id || blockContenxtId;
10
- const isHeader = Boolean(props.id && headerBlockTypes.includes(props.id));
11
- const block = React.createElement(Fragment, null, props.children);
6
+ const isHeader = Boolean(typeof id === 'string' && headerBlockTypes.includes(id));
7
+ const block = React.createElement(Fragment, null, blockChildren);
12
8
  const blockDecorators = (_b = (_a = useContext(InnerContext).customization) === null || _a === void 0 ? void 0 : _a.decorators) === null || _b === void 0 ? void 0 : _b.block;
13
9
  if (!blockDecorators) {
14
10
  return block;
15
11
  }
16
- return blockDecorators.reduce((children, decorator) => (React.createElement(Fragment, null, decorator({ children, id: blockId, isHeader }))), block);
12
+ return blockDecorators.reduce((children, decorator) => React.createElement(Fragment, null, decorator({ children, id, isHeader })), block);
17
13
  };
@@ -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[];
@@ -45,4 +45,5 @@ export var DefaultEventNames;
45
45
  DefaultEventNames["QuoteButton"] = "quote-button-click";
46
46
  DefaultEventNames["BackLink"] = "back-link-click";
47
47
  DefaultEventNames["Breadcrumb"] = "breadcrumb-click";
48
+ DefaultEventNames["VideoPreview"] = "video-preview-click";
48
49
  })(DefaultEventNames || (DefaultEventNames = {}));
@@ -30,6 +30,7 @@ export interface Childable {
30
30
  children?: SubBlock[];
31
31
  }
32
32
  export interface BlockBaseProps {
33
+ index?: number;
33
34
  anchor?: AnchorProps;
34
35
  visible?: GridColumnSize;
35
36
  resetPaddings?: boolean;
@@ -1,6 +1,6 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  export interface BlockDecorationProps extends PropsWithChildren {
3
- id?: string;
3
+ id: string | number;
4
4
  }
5
5
  export interface BlockDecoratorProps extends PropsWithChildren {
6
6
  id: string | number;
@@ -1117,6 +1117,84 @@ export declare const MediaProps: {
1117
1117
  fullscreen: {
1118
1118
  type: string;
1119
1119
  };
1120
+ analyticsEvents: {
1121
+ anyOf: ({
1122
+ type: string;
1123
+ additionalProperties: {
1124
+ type: string;
1125
+ };
1126
+ required: string[];
1127
+ properties: {
1128
+ name: {
1129
+ type: string;
1130
+ };
1131
+ type: {
1132
+ type: string;
1133
+ };
1134
+ counters: {
1135
+ type: string;
1136
+ additionalProperties: boolean;
1137
+ required: never[];
1138
+ properties: {
1139
+ include: {
1140
+ type: string;
1141
+ items: {
1142
+ type: string;
1143
+ };
1144
+ };
1145
+ exclude: {
1146
+ type: string;
1147
+ items: {
1148
+ type: string;
1149
+ };
1150
+ };
1151
+ };
1152
+ };
1153
+ context: {
1154
+ type: string;
1155
+ };
1156
+ };
1157
+ } | {
1158
+ type: string;
1159
+ items: {
1160
+ type: string;
1161
+ additionalProperties: {
1162
+ type: string;
1163
+ };
1164
+ required: string[];
1165
+ properties: {
1166
+ name: {
1167
+ type: string;
1168
+ };
1169
+ type: {
1170
+ type: string;
1171
+ };
1172
+ counters: {
1173
+ type: string;
1174
+ additionalProperties: boolean;
1175
+ required: never[];
1176
+ properties: {
1177
+ include: {
1178
+ type: string;
1179
+ items: {
1180
+ type: string;
1181
+ };
1182
+ };
1183
+ exclude: {
1184
+ type: string;
1185
+ items: {
1186
+ type: string;
1187
+ };
1188
+ };
1189
+ };
1190
+ };
1191
+ context: {
1192
+ type: string;
1193
+ };
1194
+ };
1195
+ };
1196
+ })[];
1197
+ };
1120
1198
  };
1121
1199
  export declare const YMapMarkerLabel: {
1122
1200
  type: string;
@@ -456,6 +456,9 @@ export const MediaProps = {
456
456
  fullscreen: {
457
457
  type: 'boolean',
458
458
  },
459
+ analyticsEvents: {
460
+ anyOf: [AnalyticsEventSchema, { type: 'array', items: AnalyticsEventSchema }],
461
+ },
459
462
  };
460
463
  export const YMapMarkerLabel = {
461
464
  type: 'object',
@@ -135,6 +135,84 @@ export declare const LayoutItem: {
135
135
  fullscreen: {
136
136
  type: string;
137
137
  };
138
+ analyticsEvents: {
139
+ anyOf: ({
140
+ type: string;
141
+ additionalProperties: {
142
+ type: string;
143
+ };
144
+ required: string[];
145
+ properties: {
146
+ name: {
147
+ type: string;
148
+ };
149
+ type: {
150
+ type: string;
151
+ };
152
+ counters: {
153
+ type: string;
154
+ additionalProperties: boolean;
155
+ required: never[];
156
+ properties: {
157
+ include: {
158
+ type: string;
159
+ items: {
160
+ type: string;
161
+ };
162
+ };
163
+ exclude: {
164
+ type: string;
165
+ items: {
166
+ type: string;
167
+ };
168
+ };
169
+ };
170
+ };
171
+ context: {
172
+ type: string;
173
+ };
174
+ };
175
+ } | {
176
+ type: string;
177
+ items: {
178
+ type: string;
179
+ additionalProperties: {
180
+ type: string;
181
+ };
182
+ required: string[];
183
+ properties: {
184
+ name: {
185
+ type: string;
186
+ };
187
+ type: {
188
+ type: string;
189
+ };
190
+ counters: {
191
+ type: string;
192
+ additionalProperties: boolean;
193
+ required: never[];
194
+ properties: {
195
+ include: {
196
+ type: string;
197
+ items: {
198
+ type: string;
199
+ };
200
+ };
201
+ exclude: {
202
+ type: string;
203
+ items: {
204
+ type: string;
205
+ };
206
+ };
207
+ };
208
+ };
209
+ context: {
210
+ type: string;
211
+ };
212
+ };
213
+ };
214
+ })[];
215
+ };
138
216
  };
139
217
  content: Partial<{
140
218
  title: {
@@ -137,6 +137,84 @@ export declare const MediaCardBlock: {
137
137
  fullscreen: {
138
138
  type: string;
139
139
  };
140
+ analyticsEvents: {
141
+ anyOf: ({
142
+ type: string;
143
+ additionalProperties: {
144
+ type: string;
145
+ };
146
+ required: string[];
147
+ properties: {
148
+ name: {
149
+ type: string;
150
+ };
151
+ type: {
152
+ type: string;
153
+ };
154
+ counters: {
155
+ type: string;
156
+ additionalProperties: boolean;
157
+ required: never[];
158
+ properties: {
159
+ include: {
160
+ type: string;
161
+ items: {
162
+ type: string;
163
+ };
164
+ };
165
+ exclude: {
166
+ type: string;
167
+ items: {
168
+ type: string;
169
+ };
170
+ };
171
+ };
172
+ };
173
+ context: {
174
+ type: string;
175
+ };
176
+ };
177
+ } | {
178
+ type: string;
179
+ items: {
180
+ type: string;
181
+ additionalProperties: {
182
+ type: string;
183
+ };
184
+ required: string[];
185
+ properties: {
186
+ name: {
187
+ type: string;
188
+ };
189
+ type: {
190
+ type: string;
191
+ };
192
+ counters: {
193
+ type: string;
194
+ additionalProperties: boolean;
195
+ required: never[];
196
+ properties: {
197
+ include: {
198
+ type: string;
199
+ items: {
200
+ type: string;
201
+ };
202
+ };
203
+ exclude: {
204
+ type: string;
205
+ items: {
206
+ type: string;
207
+ };
208
+ };
209
+ };
210
+ };
211
+ context: {
212
+ type: string;
213
+ };
214
+ };
215
+ };
216
+ })[];
217
+ };
140
218
  border: {
141
219
  type: string;
142
220
  enum: string[];
@@ -11,4 +11,3 @@ export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => stri
11
11
  export declare const getOrderedBlocks: (blocks: Block[], headerBlockTypes?: string[]) => Block[];
12
12
  export declare const getHeaderBlock: (blocks: Block[], headerBlockTypes?: string[]) => Block | undefined;
13
13
  export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
14
- export declare const getBlockIndexFromId: (blockId?: string) => number;
@@ -71,4 +71,3 @@ export const getShareLink = (url, type, title, text) => {
71
71
  return undefined;
72
72
  }
73
73
  };
74
- export const getBlockIndexFromId = (blockId) => { var _a; return Number((_a = blockId === null || blockId === void 0 ? void 0 : blockId.split('-')) === null || _a === void 0 ? void 0 : _a.slice(-1).pop()); };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -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 = {}));
@@ -30,6 +30,7 @@ export interface Childable {
30
30
  children?: SubBlock[];
31
31
  }
32
32
  export interface BlockBaseProps {
33
+ index?: number;
33
34
  anchor?: AnchorProps;
34
35
  visible?: GridColumnSize;
35
36
  resetPaddings?: boolean;
@@ -1,6 +1,6 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  export interface BlockDecorationProps extends PropsWithChildren {
3
- id?: string;
3
+ id: string | number;
4
4
  }
5
5
  export interface BlockDecoratorProps extends PropsWithChildren {
6
6
  id: string | number;
@@ -11,4 +11,3 @@ export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => stri
11
11
  export declare const getOrderedBlocks: (blocks: Block[], headerBlockTypes?: string[]) => Block[];
12
12
  export declare const getHeaderBlock: (blocks: Block[], headerBlockTypes?: string[]) => Block | undefined;
13
13
  export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
14
- export declare const getBlockIndexFromId: (blockId?: string) => number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBlockIndexFromId = exports.getShareLink = exports.getHeaderBlock = exports.getOrderedBlocks = exports.getCustomHeaderTypes = exports.getCustomSubBlockTypes = exports.getCustomItems = exports.getCustomBlockTypes = exports.getBlockKey = exports.getHeaderTag = void 0;
3
+ exports.getShareLink = exports.getHeaderBlock = exports.getOrderedBlocks = exports.getCustomHeaderTypes = exports.getCustomSubBlockTypes = exports.getCustomItems = exports.getCustomBlockTypes = exports.getBlockKey = exports.getHeaderTag = void 0;
4
4
  const models_1 = require("../models");
5
5
  function getHeaderTag(size) {
6
6
  switch (size) {
@@ -83,5 +83,3 @@ const getShareLink = (url, type, title, text) => {
83
83
  }
84
84
  };
85
85
  exports.getShareLink = getShareLink;
86
- const getBlockIndexFromId = (blockId) => { var _a; return Number((_a = blockId === null || blockId === void 0 ? void 0 : blockId.split('-')) === null || _a === void 0 ? void 0 : _a.slice(-1).pop()); };
87
- exports.getBlockIndexFromId = getBlockIndexFromId;