@gravity-ui/page-constructor 4.10.0 → 4.11.0

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 (48) hide show
  1. package/build/cjs/blocks/ContentLayout/schema.d.ts +38 -0
  2. package/build/cjs/components/Image/schema.d.ts +19 -0
  3. package/build/cjs/components/Image/schema.js +12 -1
  4. package/build/cjs/constructor-items.d.ts +2 -2
  5. package/build/cjs/models/constructor-items/common.d.ts +1 -1
  6. package/build/cjs/models/constructor-items/sub-blocks.d.ts +4 -4
  7. package/build/cjs/schema/constants.d.ts +181 -78
  8. package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +2 -2
  9. package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +100 -0
  10. package/build/cjs/sub-blocks/BackgroundCard/schema.js +10 -0
  11. package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
  12. package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +3 -3
  13. package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +81 -0
  14. package/build/cjs/sub-blocks/LayoutItem/schema.js +10 -0
  15. package/build/cjs/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
  16. package/build/cjs/sub-blocks/MediaCard/MediaCard.js +2 -2
  17. package/build/cjs/sub-blocks/MediaCard/schema.d.ts +81 -78
  18. package/build/cjs/sub-blocks/MediaCard/schema.js +11 -1
  19. package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.d.ts +2 -2
  20. package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +2 -2
  21. package/build/cjs/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.js +7 -4
  22. package/build/cjs/sub-blocks/PriceDetailed/schema.js +11 -1
  23. package/build/esm/blocks/ContentLayout/schema.d.ts +38 -0
  24. package/build/esm/components/Image/schema.d.ts +19 -0
  25. package/build/esm/components/Image/schema.js +12 -1
  26. package/build/esm/constructor-items.d.ts +2 -2
  27. package/build/esm/models/constructor-items/common.d.ts +1 -1
  28. package/build/esm/models/constructor-items/sub-blocks.d.ts +4 -4
  29. package/build/esm/schema/constants.d.ts +181 -78
  30. package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +2 -2
  31. package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +100 -0
  32. package/build/esm/sub-blocks/BackgroundCard/schema.js +10 -0
  33. package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
  34. package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +3 -3
  35. package/build/esm/sub-blocks/LayoutItem/schema.d.ts +81 -0
  36. package/build/esm/sub-blocks/LayoutItem/schema.js +10 -0
  37. package/build/esm/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
  38. package/build/esm/sub-blocks/MediaCard/MediaCard.js +2 -2
  39. package/build/esm/sub-blocks/MediaCard/schema.d.ts +81 -78
  40. package/build/esm/sub-blocks/MediaCard/schema.js +11 -1
  41. package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.d.ts +2 -2
  42. package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +2 -2
  43. package/build/esm/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.js +8 -4
  44. package/build/esm/sub-blocks/PriceDetailed/schema.js +11 -1
  45. package/package.json +1 -1
  46. package/server/models/constructor-items/common.d.ts +1 -1
  47. package/server/models/constructor-items/sub-blocks.d.ts +4 -4
  48. package/widget/index.js +1 -1
@@ -3,6 +3,87 @@ export declare const MediaCardBlock: {
3
3
  additionalProperties: boolean;
4
4
  required: never[];
5
5
  properties: {
6
+ analyticsEvents: {
7
+ oneOf: ({
8
+ optionName: string;
9
+ type: string;
10
+ additionalProperties: {
11
+ type: string;
12
+ };
13
+ required: string[];
14
+ properties: {
15
+ name: {
16
+ type: string;
17
+ };
18
+ type: {
19
+ type: string;
20
+ };
21
+ counters: {
22
+ type: string;
23
+ additionalProperties: boolean;
24
+ required: never[];
25
+ properties: {
26
+ include: {
27
+ type: string;
28
+ items: {
29
+ type: string;
30
+ };
31
+ };
32
+ exclude: {
33
+ type: string;
34
+ items: {
35
+ type: string;
36
+ };
37
+ };
38
+ };
39
+ };
40
+ context: {
41
+ type: string;
42
+ };
43
+ };
44
+ items?: undefined;
45
+ } | {
46
+ type: string;
47
+ items: {
48
+ type: string;
49
+ additionalProperties: {
50
+ type: string;
51
+ };
52
+ required: string[];
53
+ properties: {
54
+ name: {
55
+ type: string;
56
+ };
57
+ type: {
58
+ type: string;
59
+ };
60
+ counters: {
61
+ type: string;
62
+ additionalProperties: boolean;
63
+ required: never[];
64
+ properties: {
65
+ include: {
66
+ type: string;
67
+ items: {
68
+ type: string;
69
+ };
70
+ };
71
+ exclude: {
72
+ type: string;
73
+ items: {
74
+ type: string;
75
+ };
76
+ };
77
+ };
78
+ };
79
+ context: {
80
+ type: string;
81
+ };
82
+ };
83
+ };
84
+ optionName: string;
85
+ })[];
86
+ };
6
87
  animated: {
7
88
  type: string;
8
89
  };
@@ -147,84 +228,6 @@ export declare const MediaCardBlock: {
147
228
  fullscreen: {
148
229
  type: string;
149
230
  };
150
- analyticsEvents: {
151
- anyOf: ({
152
- type: string;
153
- additionalProperties: {
154
- type: string;
155
- };
156
- required: string[];
157
- properties: {
158
- name: {
159
- type: string;
160
- };
161
- type: {
162
- type: string;
163
- };
164
- counters: {
165
- type: string;
166
- additionalProperties: boolean;
167
- required: never[];
168
- properties: {
169
- include: {
170
- type: string;
171
- items: {
172
- type: string;
173
- };
174
- };
175
- exclude: {
176
- type: string;
177
- items: {
178
- type: string;
179
- };
180
- };
181
- };
182
- };
183
- context: {
184
- type: string;
185
- };
186
- };
187
- } | {
188
- type: string;
189
- items: {
190
- type: string;
191
- additionalProperties: {
192
- type: string;
193
- };
194
- required: string[];
195
- properties: {
196
- name: {
197
- type: string;
198
- };
199
- type: {
200
- type: string;
201
- };
202
- counters: {
203
- type: string;
204
- additionalProperties: boolean;
205
- required: never[];
206
- properties: {
207
- include: {
208
- type: string;
209
- items: {
210
- type: string;
211
- };
212
- };
213
- exclude: {
214
- type: string;
215
- items: {
216
- type: string;
217
- };
218
- };
219
- };
220
- };
221
- context: {
222
- type: string;
223
- };
224
- };
225
- };
226
- })[];
227
- };
228
231
  border: {
229
232
  type: string;
230
233
  enum: string[];
@@ -1,8 +1,18 @@
1
1
  import { AnimatableProps, BaseProps, CardBase, MediaProps } from '../../schema/validators/common';
2
+ import { AnalyticsEventSchema } from '../../schema/validators/event';
2
3
  export const MediaCardBlock = {
3
4
  'media-card': {
4
5
  additionalProperties: false,
5
6
  required: [],
6
- properties: Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), MediaProps), AnimatableProps),
7
+ properties: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), MediaProps), AnimatableProps), { analyticsEvents: {
8
+ oneOf: [
9
+ Object.assign(Object.assign({}, AnalyticsEventSchema), { optionName: 'single' }),
10
+ {
11
+ type: 'array',
12
+ items: AnalyticsEventSchema,
13
+ optionName: 'list',
14
+ },
15
+ ],
16
+ } }),
7
17
  },
8
18
  };
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { CardBorder, PriceDescriptionProps, PriceDetailsListProps, PriceDetailsSettingsProps, PriceItemProps } from '../../../models';
2
+ import { AnalyticsEventsBase, CardBorder, PriceDescriptionProps, PriceDetailsListProps, PriceDetailsSettingsProps, PriceItemProps } from '../../../models';
3
3
  import './CombinedPriceDetailed.css';
4
- interface CombinedPriceDetailedProps {
4
+ interface CombinedPriceDetailedProps extends AnalyticsEventsBase {
5
5
  items: PriceItemProps[];
6
6
  numberGroupItems: number;
7
7
  useMixedView?: boolean;
@@ -12,7 +12,7 @@ const CombinedPricesGroupSize = {
12
12
  [GridColumnSize.Lg]: 3,
13
13
  };
14
14
  const CombinedPriceDetailed = (props) => {
15
- const { items, numberGroupItems, border, useMixedView, getDescriptionComponent, getDetailsComponent, } = props;
15
+ const { items, numberGroupItems, border, useMixedView, getDescriptionComponent, getDetailsComponent, analyticsEvents, } = props;
16
16
  const [groupItemsSize, setGroupItemsSize] = useState(numberGroupItems);
17
17
  const updateGroupItemsSize = useCallback((windowWidth) => {
18
18
  if (windowWidth >= BREAKPOINTS.lg) {
@@ -49,7 +49,7 @@ const CombinedPriceDetailed = (props) => {
49
49
  React.createElement("div", { className: b('description', { delimiter: useMixedView }) }, detailsComponents)));
50
50
  };
51
51
  const chunkedItems = _.chunk(items, groupItemsSize);
52
- return (React.createElement(CardBase, { className: b(), border: border },
52
+ return (React.createElement(CardBase, { className: b(), border: border, analyticsEvents: analyticsEvents },
53
53
  React.createElement(CardBase.Content, null,
54
54
  React.createElement(Grid, null, chunkedItems.map((chunk, id) => {
55
55
  return (React.createElement(Row, { key: id, className: b('row') }, getPrice(chunk)));
@@ -1,3 +1,4 @@
1
+ import { __rest } from "tslib";
1
2
  import React, { Fragment } from 'react';
2
3
  import { CardBase } from '../../../components';
3
4
  import { block } from '../../../utils';
@@ -5,9 +6,12 @@ import './SeparatePriceDetailed.css';
5
6
  const b = block('separate-price-detailed-block');
6
7
  const SeparatePriceDetailed = (props) => {
7
8
  const { items, border, getDescriptionComponent, getDetailsComponent } = props;
8
- return (React.createElement(Fragment, null, items.map((item, id) => (React.createElement(CardBase, { key: id, className: b(), border: border },
9
- React.createElement(CardBase.Content, null,
10
- getDescriptionComponent(item),
11
- getDetailsComponent(item.items)))))));
9
+ return (React.createElement(Fragment, null, items.map((_a, id) => {
10
+ var { analyticsEvents } = _a, item = __rest(_a, ["analyticsEvents"]);
11
+ return (React.createElement(CardBase, { key: id, className: b(), border: border, analyticsEvents: analyticsEvents },
12
+ React.createElement(CardBase.Content, null,
13
+ getDescriptionComponent(item),
14
+ getDetailsComponent(item.items))));
15
+ })));
12
16
  };
13
17
  export default SeparatePriceDetailed;
@@ -1,4 +1,5 @@
1
1
  import { AnimatableProps, BaseProps, textSize } from '../../schema/validators/common';
2
+ import { AnalyticsEventSchema } from '../../schema/validators/event';
2
3
  import { filteredArray } from '../../schema/validators/utils';
3
4
  const PriceDetailedDetailsType = ['marked-list', 'settings'];
4
5
  const PriceDetailedDescriptionColor = ['cornflower', 'black'];
@@ -134,7 +135,16 @@ const PriceItem = {
134
135
  type: 'object',
135
136
  additionalProperties: false,
136
137
  required: ['title', 'description'],
137
- properties: Object.assign(Object.assign({}, PriceDetailsProps), PriceDescriptionProps),
138
+ properties: Object.assign(Object.assign(Object.assign({}, PriceDetailsProps), PriceDescriptionProps), { analyticsEvents: {
139
+ oneOf: [
140
+ Object.assign(Object.assign({}, AnalyticsEventSchema), { optionName: 'single' }),
141
+ {
142
+ type: 'array',
143
+ items: AnalyticsEventSchema,
144
+ optionName: 'list',
145
+ },
146
+ ],
147
+ } }),
138
148
  };
139
149
  export const PriceDetailedBlock = {
140
150
  'price-detailed': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "4.10.0",
3
+ "version": "4.11.0",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -287,7 +287,7 @@ export interface PriceDetailsListProps {
287
287
  export interface PriceDetailsProps {
288
288
  items?: PriceDetailsSettingsProps[] | PriceDetailsListProps[];
289
289
  }
290
- export interface PriceItemProps extends PriceDetailsProps, PriceDescriptionProps {
290
+ export interface PriceItemProps extends PriceDetailsProps, PriceDescriptionProps, AnalyticsEventsBase {
291
291
  }
292
292
  export interface PriceFoldableDetailsProps {
293
293
  title: string;
@@ -71,13 +71,13 @@ export interface QuoteProps extends Themable, CardBaseProps {
71
71
  buttonText?: string;
72
72
  theme?: TextTheme;
73
73
  }
74
- export interface BackgroundCardProps extends CardBaseProps, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
74
+ export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
75
75
  url?: string;
76
76
  background?: ThemeSupporting<ImageObjectProps>;
77
77
  paddingBottom?: 's' | 'm' | 'l' | 'xl';
78
78
  backgroundColor?: string;
79
79
  }
80
- export interface BasicCardProps extends CardBaseProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {
80
+ export interface BasicCardProps extends CardBaseProps, AnalyticsEventsBase, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {
81
81
  url: string;
82
82
  icon?: ImageProps;
83
83
  target?: string;
@@ -92,9 +92,9 @@ export interface BannerCardProps {
92
92
  theme?: TextTheme;
93
93
  button: Pick<ButtonProps, 'text' | 'url' | 'target'>;
94
94
  }
95
- export interface MediaCardProps extends MediaProps, CardBaseProps {
95
+ export interface MediaCardProps extends MediaProps, AnalyticsEventsBase, CardBaseProps {
96
96
  }
97
- export interface LayoutItemProps extends ClassNameProps {
97
+ export interface LayoutItemProps extends ClassNameProps, AnalyticsEventsBase {
98
98
  content: Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size'>;
99
99
  media: MediaProps;
100
100
  metaInfo?: string[];