@gravity-ui/page-constructor 4.3.0 → 4.3.12-alpha.3

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 (270) hide show
  1. package/README.md +4 -0
  2. package/build/cjs/blocks/CardLayout/CardLayout.d.ts +2 -2
  3. package/build/cjs/blocks/CardLayout/CardLayout.js +1 -1
  4. package/build/cjs/blocks/ContentLayout/schema.d.ts +38 -0
  5. package/build/cjs/blocks/Header/Header.css +0 -6
  6. package/build/cjs/blocks/Icons/Icons.js +7 -1
  7. package/build/cjs/blocks/Icons/schema.d.ts +162 -0
  8. package/build/cjs/blocks/Icons/schema.js +11 -0
  9. package/build/cjs/blocks/Slider/Arrow/Arrow.js +2 -1
  10. package/build/cjs/blocks/Slider/Slider.css +4 -1
  11. package/build/cjs/blocks/Slider/Slider.js +32 -6
  12. package/build/cjs/blocks/Slider/i18n/en.json +4 -0
  13. package/build/cjs/blocks/Slider/i18n/index.d.ts +2 -0
  14. package/build/cjs/blocks/Slider/i18n/index.js +8 -0
  15. package/build/cjs/blocks/Slider/i18n/ru.json +4 -0
  16. package/build/cjs/components/BackgroundImage/BackgroundImage.d.ts +1 -0
  17. package/build/cjs/components/BackgroundImage/BackgroundImage.js +5 -2
  18. package/build/cjs/components/BackgroundMedia/BackgroundMedia.d.ts +1 -1
  19. package/build/cjs/components/BackgroundMedia/BackgroundMedia.js +4 -3
  20. package/build/cjs/components/ButtonTabs/ButtonTabs.js +6 -1
  21. package/build/cjs/components/CardBase/CardBase.css +4 -4
  22. package/build/cjs/components/HTML/HTML.d.ts +5 -1
  23. package/build/cjs/components/HTML/HTML.js +3 -1
  24. package/build/cjs/components/Image/Image.js +7 -5
  25. package/build/cjs/components/Image/schema.d.ts +19 -0
  26. package/build/cjs/components/Image/schema.js +12 -1
  27. package/build/cjs/components/Link/Link.d.ts +2 -1
  28. package/build/cjs/components/Link/Link.js +4 -2
  29. package/build/cjs/components/Media/Image/Image.d.ts +3 -2
  30. package/build/cjs/components/Media/Image/Image.js +8 -5
  31. package/build/cjs/components/Media/Media.d.ts +2 -2
  32. package/build/cjs/components/Media/Media.js +9 -6
  33. package/build/cjs/components/Media/Video/Video.d.ts +2 -2
  34. package/build/cjs/components/Media/Video/Video.js +15 -6
  35. package/build/cjs/components/MetaInfo/MetaInfo.css +0 -2
  36. package/build/cjs/components/MetaInfo/MetaInfo.js +2 -1
  37. package/build/cjs/components/ReactPlayer/CustomBarControls.css +46 -14
  38. package/build/cjs/components/ReactPlayer/CustomBarControls.d.ts +4 -1
  39. package/build/cjs/components/ReactPlayer/CustomBarControls.js +33 -9
  40. package/build/cjs/components/ReactPlayer/ReactPlayer.css +12 -0
  41. package/build/cjs/components/ReactPlayer/ReactPlayer.js +49 -25
  42. package/build/cjs/components/ReactPlayer/i18n/en.json +4 -1
  43. package/build/cjs/components/ReactPlayer/i18n/ru.json +4 -1
  44. package/build/cjs/components/Table/Table.js +11 -5
  45. package/build/cjs/components/VideoBlock/VideoBlock.js +7 -6
  46. package/build/cjs/components/YFMWrapper/YFMWrapper.d.ts +4 -3
  47. package/build/cjs/components/YFMWrapper/YFMWrapper.js +3 -3
  48. package/build/cjs/constructor-items.d.ts +10 -3
  49. package/build/cjs/constructor-items.js +11 -1
  50. package/build/cjs/containers/Loadable/Loadable.js +2 -2
  51. package/build/cjs/containers/PageConstructor/PageConstructor.css +4 -0
  52. package/build/cjs/containers/PageConstructor/PageConstructor.d.ts +2 -1
  53. package/build/cjs/containers/PageConstructor/PageConstructor.js +10 -6
  54. package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.css +38 -0
  55. package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +3 -2
  56. package/build/cjs/context/innerContext/InnerContext.d.ts +3 -1
  57. package/build/cjs/context/innerContext/InnerContext.js +2 -0
  58. package/build/cjs/editor/components/AddBlock/AddBlock.css +1 -1
  59. package/build/cjs/editor/components/EditBlock/EditBlock.css +1 -0
  60. package/build/cjs/editor/components/Layout/Layout.css +2 -1
  61. package/build/cjs/editor/containers/Form/Form.css +14 -35
  62. package/build/cjs/editor/store/index.js +1 -1
  63. package/build/cjs/editor/styles/root.css +2 -1
  64. package/build/cjs/editor/utils/index.d.ts +1 -0
  65. package/build/cjs/grid/Col/Col.d.ts +2 -4
  66. package/build/cjs/icons/Mute.d.ts +2 -0
  67. package/build/cjs/icons/Mute.js +12 -0
  68. package/build/cjs/icons/MuteSmall.d.ts +2 -0
  69. package/build/cjs/icons/MuteSmall.js +15 -0
  70. package/build/cjs/icons/Unmute.d.ts +2 -0
  71. package/build/cjs/icons/Unmute.js +12 -0
  72. package/build/cjs/icons/UnmuteSmall.d.ts +2 -0
  73. package/build/cjs/icons/UnmuteSmall.js +17 -0
  74. package/build/cjs/icons/VideoControlPause.d.ts +2 -0
  75. package/build/cjs/icons/VideoControlPause.js +16 -0
  76. package/build/cjs/icons/VideoControlPlay.d.ts +2 -0
  77. package/build/cjs/icons/VideoControlPlay.js +12 -0
  78. package/build/cjs/models/constructor-items/blocks.d.ts +12 -5
  79. package/build/cjs/models/constructor-items/common.d.ts +16 -34
  80. package/build/cjs/models/constructor-items/common.js +6 -1
  81. package/build/cjs/models/constructor-items/sub-blocks.d.ts +4 -4
  82. package/build/cjs/models/constructor.d.ts +7 -1
  83. package/build/cjs/models/navigation.d.ts +1 -0
  84. package/build/cjs/models/navigation.js +2 -1
  85. package/build/cjs/navigation/components/MobileMenuButton/MobileMenuButton.js +1 -0
  86. package/build/cjs/navigation/components/NavigationItem/NavigationItem.css +1 -1
  87. package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +4 -16
  88. package/build/cjs/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js +1 -1
  89. package/build/cjs/navigation/components/NavigationItem/index.d.ts +6 -0
  90. package/build/cjs/navigation/components/NavigationItem/index.js +14 -0
  91. package/build/cjs/navigation/components/NavigationListItem/NavigationListItem.js +1 -1
  92. package/build/cjs/navigation/components/NavigationPopup/NavigationPopup.js +1 -1
  93. package/build/cjs/navigation/components/SocialIcon/SocialIcon.js +2 -1
  94. package/build/cjs/schema/constants.d.ts +181 -78
  95. package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +2 -3
  96. package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +100 -0
  97. package/build/cjs/sub-blocks/BackgroundCard/schema.js +10 -0
  98. package/build/cjs/sub-blocks/Content/Content.d.ts +3 -1
  99. package/build/cjs/sub-blocks/Content/Content.js +7 -5
  100. package/build/cjs/sub-blocks/Content/ContentList/ContentList.d.ts +2 -1
  101. package/build/cjs/sub-blocks/Content/ContentList/ContentList.js +7 -5
  102. package/build/cjs/sub-blocks/HubspotForm/HubspotForm.css +2 -2
  103. package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
  104. package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +3 -3
  105. package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +81 -0
  106. package/build/cjs/sub-blocks/LayoutItem/schema.js +10 -0
  107. package/build/cjs/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
  108. package/build/cjs/sub-blocks/MediaCard/MediaCard.js +2 -2
  109. package/build/cjs/sub-blocks/MediaCard/schema.d.ts +81 -78
  110. package/build/cjs/sub-blocks/MediaCard/schema.js +11 -1
  111. package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.d.ts +2 -2
  112. package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +2 -2
  113. package/build/cjs/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.js +7 -4
  114. package/build/cjs/sub-blocks/PriceDetailed/schema.js +11 -1
  115. package/build/cjs/sub-blocks/Quote/Quote.css +0 -3
  116. package/build/cjs/text-transform/common.d.ts +7 -2
  117. package/build/cjs/text-transform/common.js +8 -2
  118. package/build/cjs/text-transform/config.js +1 -1
  119. package/build/cjs/text-transform/transformers.d.ts +2 -0
  120. package/build/cjs/text-transform/transformers.js +11 -8
  121. package/build/cjs/utils/blocks.d.ts +3 -6
  122. package/build/cjs/utils/blocks.js +25 -16
  123. package/build/cjs/utils/cn.d.ts +3 -3
  124. package/build/cjs/utils/cn.js +4 -7
  125. package/build/esm/blocks/CardLayout/CardLayout.d.ts +2 -2
  126. package/build/esm/blocks/CardLayout/CardLayout.js +1 -1
  127. package/build/esm/blocks/ContentLayout/schema.d.ts +38 -0
  128. package/build/esm/blocks/Header/Header.css +0 -6
  129. package/build/esm/blocks/Icons/Icons.js +8 -2
  130. package/build/esm/blocks/Icons/schema.d.ts +162 -0
  131. package/build/esm/blocks/Icons/schema.js +11 -0
  132. package/build/esm/blocks/Slider/Arrow/Arrow.js +2 -1
  133. package/build/esm/blocks/Slider/Slider.css +4 -1
  134. package/build/esm/blocks/Slider/Slider.js +33 -7
  135. package/build/esm/blocks/Slider/i18n/en.json +4 -0
  136. package/build/esm/blocks/Slider/i18n/index.d.ts +2 -0
  137. package/build/esm/blocks/Slider/i18n/index.js +5 -0
  138. package/build/esm/blocks/Slider/i18n/ru.json +4 -0
  139. package/build/esm/components/BackgroundImage/BackgroundImage.d.ts +1 -0
  140. package/build/esm/components/BackgroundImage/BackgroundImage.js +5 -3
  141. package/build/esm/components/BackgroundMedia/BackgroundMedia.d.ts +1 -1
  142. package/build/esm/components/BackgroundMedia/BackgroundMedia.js +5 -4
  143. package/build/esm/components/ButtonTabs/ButtonTabs.js +6 -1
  144. package/build/esm/components/CardBase/CardBase.css +4 -4
  145. package/build/esm/components/HTML/HTML.d.ts +5 -1
  146. package/build/esm/components/HTML/HTML.js +3 -1
  147. package/build/esm/components/Image/Image.js +7 -5
  148. package/build/esm/components/Image/schema.d.ts +19 -0
  149. package/build/esm/components/Image/schema.js +12 -1
  150. package/build/esm/components/Link/Link.d.ts +2 -1
  151. package/build/esm/components/Link/Link.js +4 -2
  152. package/build/esm/components/Media/Image/Image.d.ts +3 -2
  153. package/build/esm/components/Media/Image/Image.js +8 -6
  154. package/build/esm/components/Media/Media.d.ts +2 -2
  155. package/build/esm/components/Media/Media.js +10 -7
  156. package/build/esm/components/Media/Video/Video.d.ts +2 -2
  157. package/build/esm/components/Media/Video/Video.js +16 -7
  158. package/build/esm/components/MetaInfo/MetaInfo.css +0 -2
  159. package/build/esm/components/MetaInfo/MetaInfo.js +2 -1
  160. package/build/esm/components/ReactPlayer/CustomBarControls.css +46 -14
  161. package/build/esm/components/ReactPlayer/CustomBarControls.d.ts +4 -1
  162. package/build/esm/components/ReactPlayer/CustomBarControls.js +34 -10
  163. package/build/esm/components/ReactPlayer/ReactPlayer.css +12 -0
  164. package/build/esm/components/ReactPlayer/ReactPlayer.js +52 -28
  165. package/build/esm/components/ReactPlayer/i18n/en.json +4 -1
  166. package/build/esm/components/ReactPlayer/i18n/ru.json +4 -1
  167. package/build/esm/components/Table/Table.js +11 -5
  168. package/build/esm/components/VideoBlock/VideoBlock.js +7 -6
  169. package/build/esm/components/YFMWrapper/YFMWrapper.d.ts +4 -3
  170. package/build/esm/components/YFMWrapper/YFMWrapper.js +3 -3
  171. package/build/esm/constructor-items.d.ts +10 -3
  172. package/build/esm/constructor-items.js +10 -1
  173. package/build/esm/containers/Loadable/Loadable.js +1 -1
  174. package/build/esm/containers/PageConstructor/PageConstructor.css +4 -0
  175. package/build/esm/containers/PageConstructor/PageConstructor.d.ts +2 -1
  176. package/build/esm/containers/PageConstructor/PageConstructor.js +12 -8
  177. package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.css +38 -0
  178. package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts +1 -0
  179. package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +4 -2
  180. package/build/esm/context/innerContext/InnerContext.d.ts +3 -1
  181. package/build/esm/context/innerContext/InnerContext.js +2 -0
  182. package/build/esm/editor/components/AddBlock/AddBlock.css +1 -1
  183. package/build/esm/editor/components/EditBlock/EditBlock.css +1 -0
  184. package/build/esm/editor/components/Layout/Layout.css +2 -1
  185. package/build/esm/editor/containers/Form/Form.css +14 -35
  186. package/build/esm/editor/store/index.js +2 -2
  187. package/build/esm/editor/styles/root.css +2 -1
  188. package/build/esm/editor/utils/index.d.ts +1 -0
  189. package/build/esm/grid/Col/Col.d.ts +2 -4
  190. package/build/esm/icons/Mute.d.ts +2 -0
  191. package/build/esm/icons/Mute.js +7 -0
  192. package/build/esm/icons/MuteSmall.d.ts +2 -0
  193. package/build/esm/icons/MuteSmall.js +10 -0
  194. package/build/esm/icons/Unmute.d.ts +2 -0
  195. package/build/esm/icons/Unmute.js +7 -0
  196. package/build/esm/icons/UnmuteSmall.d.ts +2 -0
  197. package/build/esm/icons/UnmuteSmall.js +12 -0
  198. package/build/esm/icons/VideoControlPause.d.ts +2 -0
  199. package/build/esm/icons/VideoControlPause.js +11 -0
  200. package/build/esm/icons/VideoControlPlay.d.ts +2 -0
  201. package/build/esm/icons/VideoControlPlay.js +7 -0
  202. package/build/esm/models/constructor-items/blocks.d.ts +12 -5
  203. package/build/esm/models/constructor-items/common.d.ts +16 -34
  204. package/build/esm/models/constructor-items/common.js +5 -0
  205. package/build/esm/models/constructor-items/sub-blocks.d.ts +4 -4
  206. package/build/esm/models/constructor.d.ts +7 -1
  207. package/build/esm/models/navigation.d.ts +1 -0
  208. package/build/esm/models/navigation.js +1 -0
  209. package/build/esm/navigation/components/MobileMenuButton/MobileMenuButton.js +1 -0
  210. package/build/esm/navigation/components/NavigationItem/NavigationItem.css +1 -1
  211. package/build/esm/navigation/components/NavigationItem/NavigationItem.js +5 -17
  212. package/build/esm/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js +1 -1
  213. package/build/esm/navigation/components/NavigationItem/index.d.ts +6 -0
  214. package/build/esm/navigation/components/NavigationItem/index.js +6 -0
  215. package/build/esm/navigation/components/NavigationListItem/NavigationListItem.js +1 -1
  216. package/build/esm/navigation/components/NavigationPopup/NavigationPopup.js +1 -1
  217. package/build/esm/navigation/components/SocialIcon/SocialIcon.js +2 -1
  218. package/build/esm/schema/constants.d.ts +181 -78
  219. package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +2 -3
  220. package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +100 -0
  221. package/build/esm/sub-blocks/BackgroundCard/schema.js +10 -0
  222. package/build/esm/sub-blocks/Content/Content.d.ts +3 -1
  223. package/build/esm/sub-blocks/Content/Content.js +7 -5
  224. package/build/esm/sub-blocks/Content/ContentList/ContentList.d.ts +2 -1
  225. package/build/esm/sub-blocks/Content/ContentList/ContentList.js +7 -5
  226. package/build/esm/sub-blocks/HubspotForm/HubspotForm.css +2 -2
  227. package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
  228. package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +3 -3
  229. package/build/esm/sub-blocks/LayoutItem/schema.d.ts +81 -0
  230. package/build/esm/sub-blocks/LayoutItem/schema.js +10 -0
  231. package/build/esm/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
  232. package/build/esm/sub-blocks/MediaCard/MediaCard.js +2 -2
  233. package/build/esm/sub-blocks/MediaCard/schema.d.ts +81 -78
  234. package/build/esm/sub-blocks/MediaCard/schema.js +11 -1
  235. package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.d.ts +2 -2
  236. package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +2 -2
  237. package/build/esm/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.js +8 -4
  238. package/build/esm/sub-blocks/PriceDetailed/schema.js +11 -1
  239. package/build/esm/sub-blocks/Quote/Quote.css +0 -3
  240. package/build/esm/text-transform/common.d.ts +7 -2
  241. package/build/esm/text-transform/common.js +7 -2
  242. package/build/esm/text-transform/config.js +1 -1
  243. package/build/esm/text-transform/transformers.d.ts +2 -0
  244. package/build/esm/text-transform/transformers.js +11 -8
  245. package/build/esm/utils/blocks.d.ts +3 -6
  246. package/build/esm/utils/blocks.js +21 -11
  247. package/build/esm/utils/cn.d.ts +3 -3
  248. package/build/esm/utils/cn.js +3 -4
  249. package/package.json +6 -6
  250. package/server/models/constructor-items/blocks.d.ts +12 -5
  251. package/server/models/constructor-items/common.d.ts +16 -34
  252. package/server/models/constructor-items/common.js +6 -1
  253. package/server/models/constructor-items/sub-blocks.d.ts +4 -4
  254. package/server/models/constructor.d.ts +7 -1
  255. package/server/models/navigation.d.ts +1 -0
  256. package/server/models/navigation.js +2 -1
  257. package/server/text-transform/common.d.ts +7 -2
  258. package/server/text-transform/common.js +10 -2
  259. package/server/text-transform/config.js +1 -1
  260. package/server/text-transform/transformers.d.ts +2 -0
  261. package/server/text-transform/transformers.js +11 -8
  262. package/server/utils/blocks.d.ts +3 -6
  263. package/server/utils/blocks.js +25 -16
  264. package/server/utils/cn.d.ts +3 -3
  265. package/server/utils/cn.js +4 -9
  266. package/styles/mixins.scss +4 -1
  267. package/styles/storybook/common.scss +2 -0
  268. package/styles/styles.css +4 -0
  269. package/styles/yfm.scss +7 -0
  270. package/widget/index.js +1 -1
@@ -318,6 +318,87 @@ export declare const LayoutItem: {
318
318
  fullscreen: {
319
319
  type: string;
320
320
  };
321
+ analyticsEvents: {
322
+ oneOf: ({
323
+ optionName: string;
324
+ type: string;
325
+ additionalProperties: {
326
+ type: string;
327
+ };
328
+ required: string[];
329
+ properties: {
330
+ name: {
331
+ type: string;
332
+ };
333
+ type: {
334
+ type: string;
335
+ };
336
+ counters: {
337
+ type: string;
338
+ additionalProperties: boolean;
339
+ required: never[];
340
+ properties: {
341
+ include: {
342
+ type: string;
343
+ items: {
344
+ type: string;
345
+ };
346
+ };
347
+ exclude: {
348
+ type: string;
349
+ items: {
350
+ type: string;
351
+ };
352
+ };
353
+ };
354
+ };
355
+ context: {
356
+ type: string;
357
+ };
358
+ };
359
+ items?: undefined;
360
+ } | {
361
+ type: string;
362
+ items: {
363
+ type: string;
364
+ additionalProperties: {
365
+ type: string;
366
+ };
367
+ required: string[];
368
+ properties: {
369
+ name: {
370
+ type: string;
371
+ };
372
+ type: {
373
+ type: string;
374
+ };
375
+ counters: {
376
+ type: string;
377
+ additionalProperties: boolean;
378
+ required: never[];
379
+ properties: {
380
+ include: {
381
+ type: string;
382
+ items: {
383
+ type: string;
384
+ };
385
+ };
386
+ exclude: {
387
+ type: string;
388
+ items: {
389
+ type: string;
390
+ };
391
+ };
392
+ };
393
+ };
394
+ context: {
395
+ type: string;
396
+ };
397
+ };
398
+ };
399
+ optionName: string;
400
+ })[];
401
+ };
321
402
  type: {};
322
403
  when: {
323
404
  type: string;
@@ -1,6 +1,7 @@
1
1
  import { omit } from 'lodash';
2
2
  import metaInfo from '../../components/MetaInfo/schema';
3
3
  import { BaseProps, MediaProps } from '../../schema/validators/common';
4
+ import { AnalyticsEventSchema } from '../../schema/validators/event';
4
5
  import { ContentBase } from '../../sub-blocks/Content/schema';
5
6
  export const LayoutItem = {
6
7
  type: 'object',
@@ -10,5 +11,14 @@ export const LayoutItem = {
10
11
  type: 'boolean',
11
12
  }, fullscreen: {
12
13
  type: 'boolean',
14
+ }, analyticsEvents: {
15
+ oneOf: [
16
+ Object.assign(Object.assign({}, AnalyticsEventSchema), { optionName: 'single' }),
17
+ {
18
+ type: 'array',
19
+ items: AnalyticsEventSchema,
20
+ optionName: 'list',
21
+ },
22
+ ],
13
23
  } }),
14
24
  };
@@ -1,4 +1,4 @@
1
1
  import { MediaCardProps } from '../../models';
2
2
  import './MediaCard.css';
3
- declare const MediaCard: ({ border, ...mediaProps }: MediaCardProps) => JSX.Element;
3
+ declare const MediaCard: ({ border, analyticsEvents, ...mediaProps }: MediaCardProps) => JSX.Element;
4
4
  export default MediaCard;
@@ -5,8 +5,8 @@ import { block } from '../../utils';
5
5
  import './MediaCard.css';
6
6
  const b = block('MediaCard');
7
7
  const MediaCard = (_a) => {
8
- var { border } = _a, mediaProps = __rest(_a, ["border"]);
9
- return (React.createElement(CardBase, { className: b(), bodyClassName: b('body'), border: border },
8
+ var { border, analyticsEvents } = _a, mediaProps = __rest(_a, ["border", "analyticsEvents"]);
9
+ return (React.createElement(CardBase, { className: b(), bodyClassName: b('body'), border: border, analyticsEvents: analyticsEvents },
10
10
  React.createElement(CardBase.Content, null,
11
11
  React.createElement(Media, Object.assign({}, mediaProps)))));
12
12
  };
@@ -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': {
@@ -31,9 +31,6 @@ unpredictable css rules order in build */
31
31
  .pc-quote_border_line {
32
32
  border: 1px solid var(--g-color-line-generic);
33
33
  }
34
- .pc-quote_border_line, .pc-quote_border_none {
35
- cursor: default;
36
- }
37
34
  @media (min-width: 577px) {
38
35
  .slick-slide:not(.slick-active) .pc-quote {
39
36
  box-shadow: none;
@@ -1,13 +1,18 @@
1
+ import { MarkdownItPluginCb } from '@doc-tools/transform/lib/plugins/typings';
1
2
  import { Lang } from '../utils/configure';
2
3
  export type ComplexItem = {
3
4
  [key: string]: string;
4
5
  };
5
6
  export type Item = string | null | ComplexItem;
6
7
  export type Transformer = (text: string) => string;
7
- export type TransformerRaw = (lang: Lang, content: string) => string;
8
+ export type TransformerRaw = (lang: Lang, content: string, options: {
9
+ plugins: MarkdownItPluginCb[];
10
+ }) => string;
8
11
  export type Parser<T = any> = (transformer: Transformer, block: T) => T;
9
12
  export declare const createItemsParser: (fields: string[]) => (transformer: Transformer, items: Item[]) => (string | {
10
13
  [x: string]: string;
11
14
  } | null)[];
12
- export declare function yfmTransformer(lang: Lang, content: string): string;
15
+ export declare function yfmTransformer(lang: Lang, content: string, options?: {
16
+ plugins?: MarkdownItPluginCb[];
17
+ }): string;
13
18
  export declare function typografTransformer(lang: Lang, content: string): string;
@@ -1,3 +1,4 @@
1
+ import defaultPlugins from '@doc-tools/transform/lib/plugins';
1
2
  import { fullTransform, typografToHTML } from './utils';
2
3
  export const createItemsParser = (fields) => (transformer, items) => items.map((item) => {
3
4
  if (!item) {
@@ -16,8 +17,12 @@ export const createItemsParser = (fields) => (transformer, items) => items.map((
16
17
  }, {}));
17
18
  }
18
19
  });
19
- export function yfmTransformer(lang, content) {
20
- const { html } = fullTransform(content, { lang });
20
+ export function yfmTransformer(lang, content, options = {}) {
21
+ const { plugins = [] } = options;
22
+ const { html } = fullTransform(content, {
23
+ lang,
24
+ plugins: [...defaultPlugins, ...plugins],
25
+ });
21
26
  return html;
22
27
  }
23
28
  export function typografTransformer(lang, content) {
@@ -122,7 +122,7 @@ export const config = {
122
122
  {
123
123
  fields: ['metaInfo'],
124
124
  parser: createItemsParser([]),
125
- transformer: typografTransformer,
125
+ transformer: yfmTransformer,
126
126
  },
127
127
  ],
128
128
  [SubBlockType.Quote]: {
@@ -1,3 +1,4 @@
1
+ import { MarkdownItPluginCb } from '@doc-tools/transform/lib/plugins/typings';
1
2
  import { ConstructorBlock } from '../models/constructor';
2
3
  import { Lang } from '../utils/configure';
3
4
  export type ContentVariables = Record<string, string>;
@@ -9,6 +10,7 @@ export type ContentTransformerProps = {
9
10
  lang: Lang;
10
11
  customConfig?: {};
11
12
  vars?: ContentVariables;
13
+ plugins?: MarkdownItPluginCb[];
12
14
  };
13
15
  };
14
16
  export declare const contentTransformer: ({ content, options }: ContentTransformerProps) => {
@@ -1,14 +1,13 @@
1
- /* eslint-disable no-param-reassign */
2
- /* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
3
1
  import _ from 'lodash';
4
2
  import { config } from './config';
5
3
  import { filterContent } from './filter';
6
- function transformBlocks(blocks, lang, customConfig = {}) {
4
+ function transformBlocks(blocks, lang, customConfig = {}, options = {}) {
7
5
  const fullConfig = Object.assign(Object.assign({}, config), customConfig);
6
+ const { plugins = [] } = options;
8
7
  const clonedBlocks = _.cloneDeep(blocks);
9
- return clonedBlocks.map((block) => transformBlock(lang, fullConfig, block));
8
+ return clonedBlocks.map((block) => transformBlock(lang, fullConfig, block, plugins));
10
9
  }
11
- function transformBlock(lang, blocksConfig, block) {
10
+ function transformBlock(lang, blocksConfig, block, plugins) {
12
11
  const blockConfig = blocksConfig[block.type];
13
12
  if (block) {
14
13
  if ('randomOrder' in block && block.randomOrder && 'children' in block && block.children) {
@@ -19,7 +18,9 @@ function transformBlock(lang, blocksConfig, block) {
19
18
  const configs = Array.isArray(blockConfig) ? blockConfig : [blockConfig];
20
19
  configs.forEach((transformConfig) => {
21
20
  const { fields, transformer: transformerRaw, parser } = transformConfig;
22
- const transformer = transformerRaw.bind(null, lang);
21
+ const transformer = (content) =>
22
+ // eslint-disable-next-line no-useless-call
23
+ transformerRaw.call(null, lang, content, { plugins });
23
24
  if (fields) {
24
25
  fields.forEach((field) => {
25
26
  if (block[field]) {
@@ -43,9 +44,11 @@ function transformBlock(lang, blocksConfig, block) {
43
44
  return block;
44
45
  }
45
46
  export const contentTransformer = ({ content, options }) => {
46
- const { lang, customConfig = {}, vars } = options;
47
+ const { lang, customConfig = {}, vars, plugins = [] } = options;
47
48
  const { blocks = [] } = (vars ? filterContent(content, vars) : content);
48
- const transformedBlocks = transformBlocks(blocks, lang, customConfig);
49
+ const transformedBlocks = transformBlocks(blocks, lang, customConfig, {
50
+ plugins,
51
+ });
49
52
  return {
50
53
  blocks: transformedBlocks,
51
54
  };
@@ -2,12 +2,9 @@ import { ConstructorBlock, CustomConfig, PCShareSocialNetwork, TextSize } from '
2
2
  export declare function getHeaderTag(size: TextSize): "h1" | "h2" | "h3" | "h4";
3
3
  export declare function hasBlockTag(content: string): boolean;
4
4
  export declare function getBlockKey(block: ConstructorBlock, index: number): string;
5
- export declare const getCustomBlockTypes: ({ blocks, headers }?: CustomConfig) => string[];
6
- export declare const getCustomItems: ({ blocks, headers, subBlocks }?: CustomConfig) => {
7
- [x: string]: any;
8
- };
9
- export declare const getCustomSubBlockTypes: (customBlocks?: CustomConfig) => string[];
10
- export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => string[];
5
+ export declare const getCustomItems: (types: (keyof CustomConfig)[], customBlocks?: CustomConfig) => {};
6
+ export declare const getCustomTypes: (types: (keyof CustomConfig)[], customBlocks?: CustomConfig) => string[];
11
7
  export declare const getOrderedBlocks: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock[];
12
8
  export declare const getHeaderBlock: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock | undefined;
13
9
  export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
10
+ export declare const getQaAttrubutes: (qa?: string, ...customKeys: (string | Array<string>)[]) => Record<string, string>;
@@ -1,3 +1,4 @@
1
+ import { camelCase, flatten } from 'lodash';
1
2
  import { PCShareSocialNetwork } from '../models';
2
3
  const BLOCK_ELEMENTS = [
3
4
  'div',
@@ -36,6 +37,7 @@ const BLOCK_ELEMENTS = [
36
37
  'td',
37
38
  ];
38
39
  const BLOCK_ELEMENTS_REGEX = `<(${BLOCK_ELEMENTS.join('|')})[^>]*>`;
40
+ const QA_ATTRIBUTES_KEYS = ['container', 'content', 'wrapper', 'image', 'button', 'animate'];
39
41
  export function getHeaderTag(size) {
40
42
  switch (size) {
41
43
  case 'l':
@@ -56,18 +58,15 @@ export function hasBlockTag(content) {
56
58
  export function getBlockKey(block, index) {
57
59
  return `${block.type}-${index}`;
58
60
  }
59
- export const getCustomBlockTypes = ({ blocks = {}, headers = {} } = {}) => [
60
- ...Object.keys(blocks),
61
- ...Object.keys(headers),
62
- ];
63
- export const getCustomItems = ({ blocks = {}, headers = {}, subBlocks = {} } = {}) => (Object.assign(Object.assign(Object.assign({}, blocks), headers), subBlocks));
64
- export const getCustomSubBlockTypes = (customBlocks = {}) => {
65
- const { subBlocks = {} } = customBlocks;
66
- return Object.keys(subBlocks);
61
+ export const getCustomItems = (types, customBlocks = {}) => {
62
+ return types.reduce((result, type) => {
63
+ return Object.assign(result, customBlocks[type] || {});
64
+ }, {});
67
65
  };
68
- export const getCustomHeaderTypes = (customBlocks = {}) => {
69
- const { headers = {} } = customBlocks;
70
- return Object.keys(headers);
66
+ export const getCustomTypes = (types, customBlocks = {}) => {
67
+ return types.reduce((result, type) => {
68
+ return result.concat(Object.keys(customBlocks[type] || {}));
69
+ }, []);
71
70
  };
72
71
  const getShareUrlWithParams = (url, params = {}) => {
73
72
  const result = new URL(url);
@@ -112,3 +111,14 @@ export const getShareLink = (url, type, title, text) => {
112
111
  return undefined;
113
112
  }
114
113
  };
114
+ export const getQaAttrubutes = (qa, ...customKeys) => {
115
+ const attributes = {};
116
+ if (qa) {
117
+ const keys = QA_ATTRIBUTES_KEYS.concat(flatten(customKeys));
118
+ keys.forEach((key) => {
119
+ attributes[camelCase(key)] = `${qa}-${key}`;
120
+ });
121
+ attributes.default = qa;
122
+ }
123
+ return attributes;
124
+ };
@@ -1,4 +1,4 @@
1
- import blockOrigin from 'bem-cn-lite';
2
1
  export declare const NAMESPACE = "pc-";
3
- export type CnBlock = ReturnType<typeof blockOrigin>;
4
- export declare function block(name: string): CnBlock;
2
+ export declare const cn: import("@bem-react/classname").ClassNameInitilizer;
3
+ export declare const block: import("@bem-react/classname").ClassNameInitilizer;
4
+ export type CnBlock = ReturnType<typeof cn>;
@@ -1,5 +1,4 @@
1
- import blockOrigin from 'bem-cn-lite';
1
+ import { withNaming } from '@bem-react/classname';
2
2
  export const NAMESPACE = 'pc-';
3
- export function block(name) {
4
- return blockOrigin(`${NAMESPACE}${name}`);
5
- }
3
+ export const cn = withNaming({ e: '__', m: '_' });
4
+ export const block = withNaming({ n: NAMESPACE, e: '__', m: '_' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "4.3.0",
3
+ "version": "4.3.12-alpha.3",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -80,11 +80,11 @@
80
80
  "test:watch": "jest --watchAll"
81
81
  },
82
82
  "dependencies": {
83
- "@gravity-ui/components": "^2.0.0",
84
- "@gravity-ui/dynamic-forms": "^2.0.0",
83
+ "@bem-react/classname": "^1.6.0",
84
+ "@gravity-ui/components": "^2.4.0",
85
+ "@gravity-ui/dynamic-forms": "^2.3.0",
85
86
  "@gravity-ui/i18n": "^1.0.0",
86
87
  "ajv": "^8.12.0",
87
- "bem-cn-lite": "^4.0.0",
88
88
  "final-form": "^4.20.9",
89
89
  "github-buttons": "2.23.0",
90
90
  "lodash": "^4.17.21",
@@ -99,6 +99,7 @@
99
99
  "sanitize-html": "2.6.1",
100
100
  "snakecase-keys": "^5.1.0",
101
101
  "typograf": "^6.14.0",
102
+ "utility-types": "^3.10.0",
102
103
  "uuid": "^9.0.0"
103
104
  },
104
105
  "peerDependencies": {
@@ -119,7 +120,7 @@
119
120
  "@gravity-ui/prettier-config": "^1.0.1",
120
121
  "@gravity-ui/stylelint-config": "^1.0.0",
121
122
  "@gravity-ui/tsconfig": "^1.0.0",
122
- "@gravity-ui/uikit": "^5.4.1",
123
+ "@gravity-ui/uikit": "^5.9.1",
123
124
  "@storybook/addon-actions": "^7.1.0",
124
125
  "@storybook/addon-essentials": "^7.1.0",
125
126
  "@storybook/addon-knobs": "^7.0.2",
@@ -146,7 +147,6 @@
146
147
  "css-loader": "^5.2.7",
147
148
  "es5-ext": "0.10.53",
148
149
  "eslint": "^8.34.0",
149
- "eslint-plugin-local": "./eslint-plugin-local",
150
150
  "eslint-plugin-no-not-accumulator-reassign": "^0.1.0",
151
151
  "eslint-plugin-react": "^7.33.0",
152
152
  "eslint-plugin-testing-library": "^5.9.1",