@gravity-ui/page-constructor 1.15.0-alpha.22 → 1.15.0-alpha.24

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 (178) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/README.md +3 -35
  3. package/build/cjs/blocks/Share/Share.js +1 -7
  4. package/build/cjs/blocks/Slider/Arrow/Arrow.js +2 -2
  5. package/build/cjs/blocks/Slider/Slider.css +0 -4
  6. package/build/cjs/components/BackLink/BackLink.js +2 -9
  7. package/build/cjs/components/Button/Button.d.ts +0 -1
  8. package/build/cjs/components/Button/Button.js +1 -9
  9. package/build/cjs/components/CardBase/CardBase.js +1 -8
  10. package/build/cjs/components/Foldable/Foldable.css +4 -1
  11. package/build/cjs/components/Foldable/Foldable.js +7 -10
  12. package/build/cjs/components/FullscreenImage/FullscreenImage.js +8 -6
  13. package/build/cjs/components/FullscreenMedia/FullScreenMedia.css +70 -0
  14. package/build/cjs/components/FullscreenMedia/FullScreenMedia.d.ts +9 -0
  15. package/build/cjs/components/FullscreenMedia/FullScreenMedia.js +40 -0
  16. package/build/cjs/components/HeightCalculator/HeightCalculator.d.ts +4 -0
  17. package/build/cjs/components/HeightCalculator/HeightCalculator.js +4 -0
  18. package/build/cjs/components/Link/Link.js +1 -8
  19. package/build/cjs/components/Media/Media.js +3 -2
  20. package/build/cjs/components/MetaInfo/MetaInfo.css +13 -0
  21. package/build/cjs/components/MetaInfo/MetaInfo.d.ts +6 -0
  22. package/build/cjs/components/MetaInfo/MetaInfo.js +8 -0
  23. package/build/cjs/components/MetaInfo/schema.d.ts +8 -0
  24. package/build/cjs/components/MetaInfo/schema.js +10 -0
  25. package/build/cjs/components/ReactPlayer/ReactPlayer.js +2 -8
  26. package/build/cjs/components/VideoBlock/VideoBlock.d.ts +1 -0
  27. package/build/cjs/components/VideoBlock/VideoBlock.js +6 -10
  28. package/build/cjs/components/YandexForm/YandexForm.js +1 -7
  29. package/build/cjs/components/index.d.ts +2 -0
  30. package/build/cjs/components/index.js +5 -1
  31. package/build/cjs/constructor-items.d.ts +4 -0
  32. package/build/cjs/constructor-items.js +4 -0
  33. package/build/cjs/containers/PageConstructor/PageConstructor.css +1 -0
  34. package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +6 -4
  35. package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +1 -2
  36. package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +2 -4
  37. package/build/cjs/context/blockIdContext/blockIdContext.d.ts +3 -0
  38. package/build/cjs/context/{blockPositionContext/blockPositionContext.js → blockIdContext/blockIdContext.js} +2 -2
  39. package/build/cjs/context/blockIdContext/index.d.ts +1 -0
  40. package/build/cjs/context/{blockPositionContext → blockIdContext}/index.js +1 -1
  41. package/build/cjs/hooks/index.d.ts +1 -0
  42. package/build/cjs/hooks/index.js +1 -0
  43. package/build/cjs/hooks/useAnalyticsEvent.d.ts +7 -0
  44. package/build/cjs/hooks/useAnalyticsEvent.js +16 -0
  45. package/build/cjs/hooks/useHeightCalculator.d.ts +6 -0
  46. package/build/cjs/hooks/useHeightCalculator.js +27 -0
  47. package/build/cjs/models/common.d.ts +11 -0
  48. package/build/cjs/models/common.js +13 -1
  49. package/build/cjs/models/constructor-items/common.d.ts +1 -19
  50. package/build/cjs/models/constructor-items/sub-blocks.d.ts +15 -0
  51. package/build/cjs/models/constructor-items/sub-blocks.js +4 -0
  52. package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +4 -5
  53. package/build/cjs/schema/index.js +1 -0
  54. package/build/cjs/schema/validators/sub-blocks.d.ts +1 -0
  55. package/build/cjs/schema/validators/sub-blocks.js +1 -0
  56. package/build/cjs/sub-blocks/BannerCard/BannerCard.js +2 -1
  57. package/build/cjs/sub-blocks/HubspotForm/HubspotForm.css +14 -9
  58. package/build/cjs/sub-blocks/HubspotForm/HubspotFormContainer.d.ts +1 -1
  59. package/build/cjs/sub-blocks/HubspotForm/HubspotFormContainer.js +26 -8
  60. package/build/cjs/sub-blocks/HubspotForm/index.js +5 -9
  61. package/build/cjs/sub-blocks/LayoutItem/LayoutItem.css +16 -0
  62. package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +3 -0
  63. package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +21 -0
  64. package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +218 -0
  65. package/build/cjs/sub-blocks/LayoutItem/schema.js +18 -0
  66. package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +28 -0
  67. package/build/cjs/sub-blocks/LayoutItem/utils.js +12 -0
  68. package/build/cjs/sub-blocks/Quote/Quote.js +1 -8
  69. package/build/cjs/sub-blocks/index.d.ts +1 -0
  70. package/build/cjs/sub-blocks/index.js +3 -1
  71. package/build/cjs/text-transform/blocks.js +17 -0
  72. package/build/cjs/utils/analytics.d.ts +2 -0
  73. package/build/cjs/utils/analytics.js +17 -0
  74. package/build/cjs/utils/blocks.d.ts +0 -7
  75. package/build/cjs/utils/blocks.js +1 -5
  76. package/build/cjs/utils/hubspot.d.ts +2 -1
  77. package/build/cjs/utils/hubspot.js +5 -1
  78. package/build/cjs/utils/index.d.ts +1 -0
  79. package/build/cjs/utils/index.js +1 -0
  80. package/build/esm/blocks/Share/Share.js +4 -10
  81. package/build/esm/blocks/Slider/Arrow/Arrow.js +2 -2
  82. package/build/esm/blocks/Slider/Slider.css +0 -4
  83. package/build/esm/components/BackLink/BackLink.js +4 -11
  84. package/build/esm/components/Button/Button.d.ts +0 -1
  85. package/build/esm/components/Button/Button.js +4 -12
  86. package/build/esm/components/CardBase/CardBase.js +4 -11
  87. package/build/esm/components/Foldable/Foldable.css +4 -1
  88. package/build/esm/components/Foldable/Foldable.js +8 -11
  89. package/build/esm/components/FullscreenImage/FullscreenImage.js +9 -7
  90. package/build/esm/components/FullscreenMedia/FullScreenMedia.css +70 -0
  91. package/build/esm/components/FullscreenMedia/FullScreenMedia.d.ts +10 -0
  92. package/build/esm/components/FullscreenMedia/FullScreenMedia.js +38 -0
  93. package/build/esm/components/HeightCalculator/HeightCalculator.d.ts +4 -0
  94. package/build/esm/components/HeightCalculator/HeightCalculator.js +4 -0
  95. package/build/esm/components/Link/Link.js +4 -11
  96. package/build/esm/components/Media/Media.js +3 -2
  97. package/build/esm/components/MetaInfo/MetaInfo.css +13 -0
  98. package/build/esm/components/MetaInfo/MetaInfo.d.ts +7 -0
  99. package/build/esm/components/MetaInfo/MetaInfo.js +6 -0
  100. package/build/esm/components/MetaInfo/schema.d.ts +8 -0
  101. package/build/esm/components/MetaInfo/schema.js +8 -0
  102. package/build/esm/components/ReactPlayer/ReactPlayer.js +3 -9
  103. package/build/esm/components/VideoBlock/VideoBlock.d.ts +1 -0
  104. package/build/esm/components/VideoBlock/VideoBlock.js +6 -10
  105. package/build/esm/components/YandexForm/YandexForm.js +4 -10
  106. package/build/esm/components/index.d.ts +2 -0
  107. package/build/esm/components/index.js +2 -0
  108. package/build/esm/constructor-items.d.ts +4 -0
  109. package/build/esm/constructor-items.js +5 -1
  110. package/build/esm/containers/PageConstructor/PageConstructor.css +1 -0
  111. package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +7 -5
  112. package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +1 -2
  113. package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +2 -4
  114. package/build/esm/context/blockIdContext/blockIdContext.d.ts +3 -0
  115. package/build/esm/context/blockIdContext/blockIdContext.js +2 -0
  116. package/build/esm/context/blockIdContext/index.d.ts +1 -0
  117. package/build/esm/context/blockIdContext/index.js +1 -0
  118. package/build/esm/hooks/index.d.ts +1 -0
  119. package/build/esm/hooks/index.js +1 -0
  120. package/build/esm/hooks/useAnalyticsEvent.d.ts +7 -0
  121. package/build/esm/hooks/useAnalyticsEvent.js +12 -0
  122. package/build/esm/hooks/useHeightCalculator.d.ts +6 -0
  123. package/build/esm/hooks/useHeightCalculator.js +24 -0
  124. package/build/esm/models/common.d.ts +11 -0
  125. package/build/esm/models/common.js +12 -0
  126. package/build/esm/models/constructor-items/common.d.ts +1 -19
  127. package/build/esm/models/constructor-items/sub-blocks.d.ts +15 -0
  128. package/build/esm/models/constructor-items/sub-blocks.js +4 -0
  129. package/build/esm/navigation/components/NavigationItem/NavigationItem.js +4 -5
  130. package/build/esm/schema/index.js +1 -0
  131. package/build/esm/schema/validators/sub-blocks.d.ts +1 -0
  132. package/build/esm/schema/validators/sub-blocks.js +1 -0
  133. package/build/esm/sub-blocks/BannerCard/BannerCard.js +3 -2
  134. package/build/esm/sub-blocks/HubspotForm/HubspotForm.css +14 -9
  135. package/build/esm/sub-blocks/HubspotForm/HubspotFormContainer.d.ts +1 -1
  136. package/build/esm/sub-blocks/HubspotForm/HubspotFormContainer.js +26 -8
  137. package/build/esm/sub-blocks/HubspotForm/index.js +7 -11
  138. package/build/esm/sub-blocks/LayoutItem/LayoutItem.css +16 -0
  139. package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +4 -0
  140. package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +20 -0
  141. package/build/esm/sub-blocks/LayoutItem/schema.d.ts +218 -0
  142. package/build/esm/sub-blocks/LayoutItem/schema.js +14 -0
  143. package/build/esm/sub-blocks/LayoutItem/utils.d.ts +28 -0
  144. package/build/esm/sub-blocks/LayoutItem/utils.js +6 -0
  145. package/build/esm/sub-blocks/Quote/Quote.js +4 -11
  146. package/build/esm/sub-blocks/index.d.ts +1 -0
  147. package/build/esm/sub-blocks/index.js +1 -0
  148. package/build/esm/text-transform/blocks.js +17 -0
  149. package/build/esm/utils/analytics.d.ts +2 -0
  150. package/build/esm/utils/analytics.js +13 -0
  151. package/build/esm/utils/blocks.d.ts +0 -7
  152. package/build/esm/utils/blocks.js +0 -3
  153. package/build/esm/utils/hubspot.d.ts +2 -1
  154. package/build/esm/utils/hubspot.js +5 -1
  155. package/build/esm/utils/index.d.ts +1 -0
  156. package/build/esm/utils/index.js +1 -0
  157. package/package.json +5 -2
  158. package/server/models/common.d.ts +11 -0
  159. package/server/models/common.js +13 -1
  160. package/server/models/constructor-items/common.d.ts +1 -19
  161. package/server/models/constructor-items/sub-blocks.d.ts +15 -0
  162. package/server/models/constructor-items/sub-blocks.js +4 -0
  163. package/server/text-transform/blocks.js +17 -0
  164. package/server/utils/analytics.d.ts +2 -0
  165. package/server/utils/analytics.js +17 -0
  166. package/server/utils/blocks.d.ts +0 -7
  167. package/server/utils/blocks.js +1 -5
  168. package/server/utils/hubspot.d.ts +2 -1
  169. package/server/utils/hubspot.js +5 -1
  170. package/server/utils/index.d.ts +1 -0
  171. package/server/utils/index.js +1 -0
  172. package/styles/root.scss +1 -0
  173. package/build/cjs/context/blockPositionContext/blockPositionContext.d.ts +0 -3
  174. package/build/cjs/context/blockPositionContext/index.d.ts +0 -1
  175. package/build/esm/context/blockPositionContext/blockPositionContext.d.ts +0 -3
  176. package/build/esm/context/blockPositionContext/blockPositionContext.js +0 -2
  177. package/build/esm/context/blockPositionContext/index.d.ts +0 -1
  178. package/build/esm/context/blockPositionContext/index.js +0 -1
@@ -0,0 +1,218 @@
1
+ export declare const LayoutItem: {
2
+ type: string;
3
+ additionalProperties: boolean;
4
+ required: string[];
5
+ properties: {
6
+ media: {
7
+ color: {
8
+ type: string;
9
+ };
10
+ image: {
11
+ anyOf: ({
12
+ oneOf: ({
13
+ type: string;
14
+ properties: {
15
+ when: {
16
+ type: string;
17
+ };
18
+ };
19
+ } | {
20
+ type: string;
21
+ pattern: string;
22
+ })[];
23
+ } | {
24
+ type: string;
25
+ items: {
26
+ oneOf: ({
27
+ type: string;
28
+ properties: {
29
+ when: {
30
+ type: string;
31
+ };
32
+ };
33
+ } | {
34
+ type: string;
35
+ pattern: string;
36
+ })[];
37
+ };
38
+ })[];
39
+ };
40
+ video: {
41
+ type: string;
42
+ additionalProperties: boolean;
43
+ required: string[];
44
+ properties: {
45
+ src: {
46
+ type: string;
47
+ items: {
48
+ type: string;
49
+ };
50
+ };
51
+ loop: {
52
+ anyOf: ({
53
+ type: string;
54
+ additionalProperties: boolean;
55
+ required: string[];
56
+ properties: {
57
+ start: {
58
+ type: string;
59
+ };
60
+ end: {
61
+ type: string;
62
+ };
63
+ };
64
+ } | {
65
+ type: string;
66
+ })[];
67
+ };
68
+ type: {
69
+ type: string;
70
+ enum: string[];
71
+ };
72
+ muted: {
73
+ type: string;
74
+ };
75
+ playing: {
76
+ type: string;
77
+ };
78
+ elapsedTime: {
79
+ type: string;
80
+ };
81
+ playIcon: {
82
+ type: string;
83
+ additionalProperties: boolean;
84
+ properties: {
85
+ type: {
86
+ type: string;
87
+ enum: string[];
88
+ };
89
+ theme: {
90
+ type: string;
91
+ enum: string[];
92
+ };
93
+ text: {
94
+ type: string;
95
+ contentType: string;
96
+ };
97
+ };
98
+ };
99
+ controls: {
100
+ type: string;
101
+ enum: string[];
102
+ };
103
+ };
104
+ };
105
+ youtube: {
106
+ type: string;
107
+ };
108
+ parallax: {
109
+ type: string;
110
+ };
111
+ height: {
112
+ type: string;
113
+ };
114
+ previewImg: {
115
+ type: string;
116
+ };
117
+ dataLens: {
118
+ oneOf: ({
119
+ type: string;
120
+ additionalProperties: boolean;
121
+ required: string[];
122
+ properties: {
123
+ id: {
124
+ type: string;
125
+ };
126
+ theme: {
127
+ type: string;
128
+ enum: string[];
129
+ };
130
+ };
131
+ } | {
132
+ type: string;
133
+ })[];
134
+ };
135
+ };
136
+ content: Partial<{
137
+ title: {
138
+ oneOf: ({
139
+ type: string;
140
+ additionalProperties: boolean;
141
+ required: string[];
142
+ properties: {
143
+ text: {
144
+ type: string;
145
+ contentType: string;
146
+ };
147
+ textSize: {
148
+ type: string;
149
+ enum: string[];
150
+ };
151
+ url: {
152
+ type: string;
153
+ };
154
+ resetMargin: {
155
+ type: string;
156
+ };
157
+ };
158
+ } | {
159
+ type: string;
160
+ contentType: string;
161
+ })[];
162
+ };
163
+ text: {
164
+ type: string;
165
+ contentType: string;
166
+ };
167
+ additionalInfo: {
168
+ type: string;
169
+ contentType: string;
170
+ };
171
+ size: {
172
+ type: string;
173
+ enum: string[];
174
+ };
175
+ links: {
176
+ type: string;
177
+ items: {
178
+ type: string;
179
+ properties: {
180
+ when: {
181
+ type: string;
182
+ };
183
+ };
184
+ };
185
+ };
186
+ buttons: {
187
+ type: string;
188
+ items: {
189
+ type: string;
190
+ properties: {
191
+ when: {
192
+ type: string;
193
+ };
194
+ };
195
+ };
196
+ };
197
+ theme: {
198
+ type: string;
199
+ enum: string[];
200
+ };
201
+ }>;
202
+ metaInfo: {
203
+ type: string;
204
+ items: {
205
+ type: string;
206
+ contentType: string;
207
+ };
208
+ };
209
+ border: {
210
+ type: string;
211
+ };
212
+ fullScreen: {
213
+ type: string;
214
+ };
215
+ type: {};
216
+ when: {};
217
+ };
218
+ };
@@ -0,0 +1,14 @@
1
+ import { omit } from 'lodash';
2
+ import { BaseProps, MediaProps } from '../../schema/validators/common';
3
+ import { ContentBase } from '../../sub-blocks/Content/schema';
4
+ import metaInfo from '../../components/MetaInfo/schema';
5
+ export const LayoutItem = {
6
+ type: 'object',
7
+ additionalProperties: false,
8
+ required: ['content', 'media'],
9
+ properties: Object.assign(Object.assign({}, BaseProps), { media: MediaProps, content: omit(ContentBase, ['colSize', 'size', 'centered']), metaInfo: metaInfo, border: {
10
+ type: 'boolean',
11
+ }, fullScreen: {
12
+ type: 'boolean',
13
+ } }),
14
+ };
@@ -0,0 +1,28 @@
1
+ import { LayoutItemProps, LinkTheme, MediaProps } from '../../models';
2
+ export declare const getLayoutItemLinks: (links: LayoutItemProps['content']['links']) => {
3
+ url: string;
4
+ text?: string | undefined;
5
+ textSize?: import("../../models").TextSize | undefined;
6
+ theme: LinkTheme;
7
+ colorTheme?: import("../../models").TextTheme | undefined;
8
+ arrow?: boolean | undefined;
9
+ target?: string | undefined;
10
+ metrikaGoals?: import("../../models").MetrikaGoal | undefined;
11
+ pixelEvents?: import("../../models").ButtonPixel | undefined;
12
+ analyticsEvents?: {
13
+ name: string;
14
+ type?: string | undefined;
15
+ counters?: import("../../models").AnalyticsCounters | undefined;
16
+ context?: string | undefined;
17
+ target?: string | undefined;
18
+ } | {
19
+ name: string;
20
+ type?: string | undefined;
21
+ counters?: import("../../models").AnalyticsCounters | undefined;
22
+ context?: string | undefined;
23
+ target?: string | undefined;
24
+ }[] | undefined;
25
+ className?: string | undefined;
26
+ }[] | undefined;
27
+ export declare const hasFullScreen: ({ dataLens, image }: MediaProps) => boolean;
28
+ export declare const showFullScreenIcon: ({ youtube }: MediaProps) => boolean;
@@ -0,0 +1,6 @@
1
+ export const getLayoutItemLinks = (links) => links === null || links === void 0 ? void 0 : links.map((link) => (Object.assign({ theme: 'normal' }, link)));
2
+ export const hasFullScreen = ({ dataLens, image }) => {
3
+ // datalens and slider media card don't support fullScreen mode
4
+ return !(dataLens || Array.isArray(image));
5
+ };
6
+ export const showFullScreenIcon = ({ youtube }) => !youtube;
@@ -1,26 +1,19 @@
1
- import React, { useCallback, useContext, useMemo } from 'react';
1
+ import React, { useCallback, useContext } from 'react';
2
2
  import { Button } from '@gravity-ui/uikit';
3
3
  import { block, getThemedValue } from '../../utils';
4
- import { AuthorType, PredefinedEventTypes } from '../../models';
4
+ import { AuthorType, DefaultEventNames } from '../../models';
5
5
  import { Author, Image, HTML } from '../../components';
6
6
  import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
7
- import { BlockPositionContext } from '../../context/blockPositionContext';
8
7
  import { getMediaImage } from '../../components/Media/Image/utils';
9
- import { useAnalytics } from '../../hooks';
8
+ import { useAnalytics, useAnalyticsEvent } from '../../hooks';
10
9
  import './Quote.css';
11
10
  const b = block('quote');
12
11
  const Quote = (props) => {
13
12
  const { theme: textTheme = 'light', color, image, border = 'shadow', text, logo, author, url, buttonText, } = props;
14
13
  const { themeValue: theme } = useContext(ThemeValueContext);
15
- const context = useContext(BlockPositionContext);
16
14
  const imageThemed = getThemedValue(image, theme);
17
15
  const imageData = getMediaImage(imageThemed);
18
- const defaultEvent = useMemo(() => ({
19
- name: 'quote-button-click',
20
- type: PredefinedEventTypes.Default,
21
- context,
22
- target: url,
23
- }), [context, url]);
16
+ const defaultEvent = useAnalyticsEvent(DefaultEventNames.QuoteButton, url);
24
17
  const handleAnalytics = useAnalytics(defaultEvent);
25
18
  const handleButtonClick = useCallback(() => handleAnalytics(), [handleAnalytics]);
26
19
  const renderFooter = Boolean(author || url) && (React.createElement("div", { className: b('author-wrapper') },
@@ -7,6 +7,7 @@ export { default as MediaCard } from './MediaCard/MediaCard';
7
7
  export { default as BannerCard } from './BannerCard/BannerCard';
8
8
  export { default as TutorialCard } from './TutorialCard/TutorialCard';
9
9
  export { default as CardWithImage } from './CardWithImage/CardWithImage';
10
+ export { default as LayoutItem } from './LayoutItem/LayoutItem';
10
11
  export { default as BackgroundCard } from './BackgroundCard/BackgroundCard';
11
12
  export { default as BasicCard } from './BasicCard/BasicCard';
12
13
  export { default as Content } from './Content/Content';
@@ -7,6 +7,7 @@ export { default as MediaCard } from './MediaCard/MediaCard';
7
7
  export { default as BannerCard } from './BannerCard/BannerCard';
8
8
  export { default as TutorialCard } from './TutorialCard/TutorialCard';
9
9
  export { default as CardWithImage } from './CardWithImage/CardWithImage';
10
+ export { default as LayoutItem } from './LayoutItem/LayoutItem';
10
11
  export { default as BackgroundCard } from './BackgroundCard/BackgroundCard';
11
12
  export { default as BasicCard } from './BasicCard/BasicCard';
12
13
  export { default as Content } from './Content/Content';
@@ -138,6 +138,23 @@ const config = {
138
138
  transformer: typografTransformer,
139
139
  },
140
140
  ],
141
+ [SubBlockType.LayoutItem]: [
142
+ {
143
+ fields: ['content'],
144
+ parser: parseContentLayout,
145
+ transformer: yfmTransformer,
146
+ },
147
+ {
148
+ fields: ['content'],
149
+ parser: parseContentLayoutTitle,
150
+ transformer: typografTransformer,
151
+ },
152
+ {
153
+ fields: ['metaInfo'],
154
+ parser: createItemsParser([]),
155
+ transformer: typografTransformer,
156
+ },
157
+ ],
141
158
  [SubBlockType.Quote]: {
142
159
  fields: ['text'],
143
160
  transformer: typografTransformer,
@@ -0,0 +1,2 @@
1
+ import { AnalyticsCounters } from '../models';
2
+ export declare const isCounterAllowed: (counter: string, counters?: AnalyticsCounters) => boolean;
@@ -0,0 +1,13 @@
1
+ export const isCounterAllowed = (counter, counters) => {
2
+ var _a, _b;
3
+ if (!counters) {
4
+ return true;
5
+ }
6
+ if ((_a = counters.exclude) === null || _a === void 0 ? void 0 : _a.includes(counter)) {
7
+ return false;
8
+ }
9
+ else if ((_b = counters.include) === null || _b === void 0 ? void 0 : _b.includes(counter)) {
10
+ return true;
11
+ }
12
+ return false;
13
+ };
@@ -2,16 +2,9 @@ import { ConstructorBlock } from '../models/constructor';
2
2
  import { TextSize, CustomConfig, PCShareSocialNetwork } from '../models';
3
3
  export declare function getHeaderTag(size: TextSize): "h1" | "h4" | "h2";
4
4
  export declare function getBlockKey(block: ConstructorBlock, index: number): string;
5
- type GetBlockContextArgs = {
6
- block: ConstructorBlock;
7
- index: number;
8
- parentContext?: string;
9
- };
10
- export declare function getBlockContext({ parentContext, block, index }: GetBlockContextArgs): string;
11
5
  export declare const getCustomBlockTypes: ({ blocks, headers }?: CustomConfig) => string[];
12
6
  export declare const getCustomItems: ({ blocks, headers, subBlocks }?: CustomConfig) => {
13
7
  [x: string]: any;
14
8
  };
15
9
  export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => string[];
16
10
  export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
17
- export {};
@@ -13,9 +13,6 @@ export function getHeaderTag(size) {
13
13
  export function getBlockKey(block, index) {
14
14
  return `${block.type}-${index}`;
15
15
  }
16
- export function getBlockContext({ parentContext = '', block, index }) {
17
- return `${parentContext}${parentContext ? '_' : ''}${block.type}-${index}`;
18
- }
19
16
  export const getCustomBlockTypes = ({ blocks = {}, headers = {} } = {}) => [
20
17
  ...Object.keys(blocks),
21
18
  ...Object.keys(headers),
@@ -1,4 +1,4 @@
1
- export type HubspotEventName = 'onBeforeFormInit' | 'onFormReady' | 'onFormSubmit' | 'onFormSubmitted' | `_${string}`;
1
+ export type HubspotEventName = 'onBeforeFormInit' | 'onFormReady' | 'onFormSubmit' | 'onFormSubmitted' | 'onFormError' | `_${string}`;
2
2
  export interface HubspotEventData {
3
3
  type: HubspotEventName | string;
4
4
  eventName: HubspotEventName;
@@ -11,6 +11,7 @@ export interface HubspotEventHandlers {
11
11
  onBeforeSubmit?: (arg: HubspotEventData) => void;
12
12
  onSubmit?: (arg: HubspotEventData) => void;
13
13
  onLoad?: (arg: HubspotEventData) => void;
14
+ onSubmitError?: (arg: HubspotEventData) => void;
14
15
  }
15
16
  export declare function loopBackHabspotEvents(formId: string): ({ data, source, origin }: MessageEvent) => void;
16
17
  export declare function handleHubspotEvents(handlers: HubspotEventHandlers, formId: string): ({ data }: MessageEvent) => void;
@@ -20,7 +20,7 @@ export function loopBackHabspotEvents(formId) {
20
20
  }
21
21
  export function handleHubspotEvents(handlers, formId) {
22
22
  return ({ data }) => {
23
- var _a, _b, _c, _d;
23
+ var _a, _b, _c, _d, _e;
24
24
  if (!isHubspotEventData(data)) {
25
25
  return;
26
26
  }
@@ -44,6 +44,10 @@ export function handleHubspotEvents(handlers, formId) {
44
44
  (_d = handlers.onSubmit) === null || _d === void 0 ? void 0 : _d.call(handlers, data);
45
45
  break;
46
46
  }
47
+ case 'onFormError': {
48
+ (_e = handlers.onSubmitError) === null || _e === void 0 ? void 0 : _e.call(handlers, data);
49
+ break;
50
+ }
47
51
  default:
48
52
  break;
49
53
  }
@@ -1,3 +1,4 @@
1
+ export * from './analytics';
1
2
  export * from './blocks';
2
3
  export * from './scroll';
3
4
  export * from './url';
@@ -1,3 +1,4 @@
1
+ export * from './analytics';
1
2
  export * from './blocks';
2
3
  export * from './scroll';
3
4
  export * from './url';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "1.15.0-alpha.22",
3
+ "version": "1.15.0-alpha.24",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -56,7 +56,8 @@
56
56
  "react-waypoint": "^10.1.0",
57
57
  "sanitize-html": "^2.6.1",
58
58
  "snakecase-keys": "^5.1.0",
59
- "typograf": "^6.14.0"
59
+ "typograf": "^6.14.0",
60
+ "uuid": "^9.0.0"
60
61
  },
61
62
  "peerDependencies": {
62
63
  "react": "^16.0.0 || ^17.0.0",
@@ -87,6 +88,8 @@
87
88
  "@types/react-slick": "^0.23.7",
88
89
  "@types/react-transition-group": "^4.4.4",
89
90
  "@types/sanitize-html": "^2.6.0",
91
+ "@types/uuid": "^9.0.0",
92
+ "es5-ext": "0.10.53",
90
93
  "eslint": "^7.32.0",
91
94
  "eslint-plugin-local": "./eslint-plugin-local",
92
95
  "eslint-plugin-testing-library": "^5.9.1",
@@ -69,6 +69,17 @@ export declare enum PredefinedEventTypes {
69
69
  Play = "play",
70
70
  Stop = "stop"
71
71
  }
72
+ export declare enum DefaultEventNames {
73
+ ShareButton = "share-button-click",
74
+ Button = "button-click",
75
+ CardBase = "card-base-click",
76
+ Link = "link-click",
77
+ ReactPlayerControls = "react-player-controls-click",
78
+ YandexFormSubmit = "yandex-form-submit",
79
+ HubspotFormSubmit = "hubspot-form-submit",
80
+ QuoteButton = "quote-button-click",
81
+ BackLink = "back-link-click"
82
+ }
72
83
  export type AnalyticsCounters = {
73
84
  include?: string[];
74
85
  exclude?: string[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PredefinedEventTypes = exports.PixelEventType = exports.Theme = void 0;
3
+ exports.DefaultEventNames = exports.PredefinedEventTypes = exports.PixelEventType = exports.Theme = void 0;
4
4
  var Theme;
5
5
  (function (Theme) {
6
6
  Theme["Light"] = "light";
@@ -36,3 +36,15 @@ var PredefinedEventTypes;
36
36
  PredefinedEventTypes["Play"] = "play";
37
37
  PredefinedEventTypes["Stop"] = "stop";
38
38
  })(PredefinedEventTypes = exports.PredefinedEventTypes || (exports.PredefinedEventTypes = {}));
39
+ var DefaultEventNames;
40
+ (function (DefaultEventNames) {
41
+ DefaultEventNames["ShareButton"] = "share-button-click";
42
+ DefaultEventNames["Button"] = "button-click";
43
+ DefaultEventNames["CardBase"] = "card-base-click";
44
+ DefaultEventNames["Link"] = "link-click";
45
+ DefaultEventNames["ReactPlayerControls"] = "react-player-controls-click";
46
+ DefaultEventNames["YandexFormSubmit"] = "yandex-form-submit";
47
+ DefaultEventNames["HubspotFormSubmit"] = "hubspot-form-submit";
48
+ DefaultEventNames["QuoteButton"] = "quote-button-click";
49
+ DefaultEventNames["BackLink"] = "back-link-click";
50
+ })(DefaultEventNames = exports.DefaultEventNames || (exports.DefaultEventNames = {}));
@@ -121,7 +121,6 @@ export interface LinkProps extends AnalyticsEventsBase, Stylable {
121
121
  target?: string;
122
122
  metrikaGoals?: MetrikaGoal;
123
123
  pixelEvents?: ButtonPixel;
124
- context?: string;
125
124
  }
126
125
  export interface FileLinkProps extends ClassNameProps {
127
126
  href: string;
@@ -141,7 +140,6 @@ export interface ButtonProps extends AnalyticsEventsBase {
141
140
  metrikaGoals?: MetrikaGoal;
142
141
  pixelEvents?: ButtonPixel;
143
142
  target?: string;
144
- context?: string;
145
143
  }
146
144
  export interface ButtonImageProps {
147
145
  url: string;
@@ -174,6 +172,7 @@ export interface MediaComponentVideoProps extends AnalyticsEventsBase {
174
172
  export interface MediaComponentYoutubeProps {
175
173
  youtube: string;
176
174
  previewImg?: string;
175
+ fullScreen?: boolean;
177
176
  }
178
177
  export interface MediaComponentImageProps {
179
178
  image: ImageProps | ImageProps[] | ImageDeviceProps;
@@ -245,27 +244,10 @@ export interface TitleBaseProps {
245
244
  custom?: string | ReactNode;
246
245
  onClick?: () => void;
247
246
  }
248
- export interface CardData {
249
- header?: CardHeader;
250
- text?: string;
251
- title?: string;
252
- link?: LinkProps;
253
- footer?: string;
254
- url?: string;
255
- service?: {
256
- slug: string;
257
- name: string;
258
- };
259
- links?: LinkProps[];
260
- }
261
247
  export type CardBorder = 'shadow' | 'line' | 'none';
262
248
  export interface CardBaseProps {
263
249
  border?: CardBorder;
264
250
  }
265
- export interface CardHeader {
266
- title?: string;
267
- image?: ImageProps;
268
- }
269
251
  export interface PriceDescriptionProps {
270
252
  title: string;
271
253
  detailedTitle?: string;
@@ -19,7 +19,11 @@ export declare enum SubBlockType {
19
19
  * @deprecated Will be moved to params use BasicCard instead
20
20
  */
21
21
  TutorialCard = "tutoral-card",
22
+ /**
23
+ * @deprecated Use LayoutItem
24
+ */
22
25
  CardWithImage = "card-with-image",
26
+ LayoutItem = "layout-item",
23
27
  BackgroundCard = "background-card",
24
28
  BasicCard = "basic-card",
25
29
  Content = "content",
@@ -61,6 +65,7 @@ export interface HubspotFormProps extends HubspotEventHandlers, AnalyticsEventsB
61
65
  onLoad?: (arg: HubspotEventData) => void;
62
66
  pixelEvents?: string | string[] | PixelEvent | PixelEvent[] | ButtonPixel;
63
67
  hubspotEvents?: string[];
68
+ createDOMElement?: boolean;
64
69
  }
65
70
  export interface PartnerProps extends CardBaseProps {
66
71
  text: string;
@@ -125,6 +130,13 @@ export interface CardWithImageProps extends ClassNameProps, Pick<ContentBlockPro
125
130
  fullScreen?: boolean;
126
131
  links?: CardWithImageLinkProps[];
127
132
  }
133
+ export interface LayoutItemProps extends ClassNameProps {
134
+ content: Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size'>;
135
+ media: MediaProps;
136
+ metaInfo?: string[];
137
+ border?: boolean;
138
+ fullScreen?: boolean;
139
+ }
128
140
  export type DividerModel = {
129
141
  type: SubBlockType.Divider;
130
142
  } & DividerProps;
@@ -137,6 +149,9 @@ export type NewsCardModel = {
137
149
  export type CardWithImageModel = {
138
150
  type: SubBlockType.CardWithImage;
139
151
  } & CardWithImageProps;
152
+ export type LayoutItemModel = {
153
+ type: SubBlockType.CardWithImage;
154
+ } & LayoutItemProps;
140
155
  export type TutorialCardModel = {
141
156
  type: SubBlockType.TutorialCard;
142
157
  } & TutorialCardProps;
@@ -17,7 +17,11 @@ var SubBlockType;
17
17
  * @deprecated Will be moved to params use BasicCard instead
18
18
  */
19
19
  SubBlockType["TutorialCard"] = "tutoral-card";
20
+ /**
21
+ * @deprecated Use LayoutItem
22
+ */
20
23
  SubBlockType["CardWithImage"] = "card-with-image";
24
+ SubBlockType["LayoutItem"] = "layout-item";
21
25
  SubBlockType["BackgroundCard"] = "background-card";
22
26
  SubBlockType["BasicCard"] = "basic-card";
23
27
  SubBlockType["Content"] = "content";
@@ -157,6 +157,23 @@ const config = {
157
157
  transformer: typografTransformer,
158
158
  },
159
159
  ],
160
+ [models_1.SubBlockType.LayoutItem]: [
161
+ {
162
+ fields: ['content'],
163
+ parser: parseContentLayout,
164
+ transformer: yfmTransformer,
165
+ },
166
+ {
167
+ fields: ['content'],
168
+ parser: parseContentLayoutTitle,
169
+ transformer: typografTransformer,
170
+ },
171
+ {
172
+ fields: ['metaInfo'],
173
+ parser: (0, exports.createItemsParser)([]),
174
+ transformer: typografTransformer,
175
+ },
176
+ ],
160
177
  [models_1.SubBlockType.Quote]: {
161
178
  fields: ['text'],
162
179
  transformer: typografTransformer,
@@ -0,0 +1,2 @@
1
+ import { AnalyticsCounters } from '../models';
2
+ export declare const isCounterAllowed: (counter: string, counters?: AnalyticsCounters) => boolean;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isCounterAllowed = void 0;
4
+ const isCounterAllowed = (counter, counters) => {
5
+ var _a, _b;
6
+ if (!counters) {
7
+ return true;
8
+ }
9
+ if ((_a = counters.exclude) === null || _a === void 0 ? void 0 : _a.includes(counter)) {
10
+ return false;
11
+ }
12
+ else if ((_b = counters.include) === null || _b === void 0 ? void 0 : _b.includes(counter)) {
13
+ return true;
14
+ }
15
+ return false;
16
+ };
17
+ exports.isCounterAllowed = isCounterAllowed;