@gravity-ui/page-constructor 4.12.0 → 4.13.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 (45) hide show
  1. package/build/cjs/components/BackgroundImage/BackgroundImage.d.ts +1 -0
  2. package/build/cjs/components/BackgroundImage/BackgroundImage.js +5 -2
  3. package/build/cjs/components/BackgroundMedia/BackgroundMedia.d.ts +1 -1
  4. package/build/cjs/components/BackgroundMedia/BackgroundMedia.js +4 -3
  5. package/build/cjs/components/Image/Image.js +7 -5
  6. package/build/cjs/components/Media/Image/Image.d.ts +3 -2
  7. package/build/cjs/components/Media/Image/Image.js +8 -5
  8. package/build/cjs/components/Media/Media.d.ts +2 -2
  9. package/build/cjs/components/Media/Media.js +9 -6
  10. package/build/cjs/components/Media/Video/Video.d.ts +2 -2
  11. package/build/cjs/components/Media/Video/Video.js +13 -4
  12. package/build/cjs/models/constructor-items/common.d.ts +1 -1
  13. package/build/cjs/text-transform/common.d.ts +7 -2
  14. package/build/cjs/text-transform/common.js +8 -2
  15. package/build/cjs/text-transform/transformers.d.ts +2 -0
  16. package/build/cjs/text-transform/transformers.js +11 -8
  17. package/build/cjs/utils/blocks.d.ts +1 -1
  18. package/build/cjs/utils/blocks.js +4 -3
  19. package/build/esm/components/BackgroundImage/BackgroundImage.d.ts +1 -0
  20. package/build/esm/components/BackgroundImage/BackgroundImage.js +5 -3
  21. package/build/esm/components/BackgroundMedia/BackgroundMedia.d.ts +1 -1
  22. package/build/esm/components/BackgroundMedia/BackgroundMedia.js +5 -4
  23. package/build/esm/components/Image/Image.js +7 -5
  24. package/build/esm/components/Media/Image/Image.d.ts +3 -2
  25. package/build/esm/components/Media/Image/Image.js +8 -6
  26. package/build/esm/components/Media/Media.d.ts +2 -2
  27. package/build/esm/components/Media/Media.js +10 -7
  28. package/build/esm/components/Media/Video/Video.d.ts +2 -2
  29. package/build/esm/components/Media/Video/Video.js +14 -5
  30. package/build/esm/models/constructor-items/common.d.ts +1 -1
  31. package/build/esm/text-transform/common.d.ts +7 -2
  32. package/build/esm/text-transform/common.js +7 -2
  33. package/build/esm/text-transform/transformers.d.ts +2 -0
  34. package/build/esm/text-transform/transformers.js +11 -8
  35. package/build/esm/utils/blocks.d.ts +1 -1
  36. package/build/esm/utils/blocks.js +5 -4
  37. package/package.json +1 -1
  38. package/server/models/constructor-items/common.d.ts +1 -1
  39. package/server/text-transform/common.d.ts +7 -2
  40. package/server/text-transform/common.js +10 -2
  41. package/server/text-transform/transformers.d.ts +2 -0
  42. package/server/text-transform/transformers.js +11 -8
  43. package/server/utils/blocks.d.ts +1 -1
  44. package/server/utils/blocks.js +4 -3
  45. package/widget/index.js +1 -1
@@ -1,5 +1,5 @@
1
1
  import React, { useMemo, useState } from 'react';
2
- import { block } from '../../utils';
2
+ import { block, getQaAttrubutes } from '../../utils';
3
3
  import YoutubeBlock from '../VideoBlock/VideoBlock';
4
4
  import DataLens from './DataLens/DataLens';
5
5
  import FullscreenVideo from './FullscreenVideo/FullscreenVideo';
@@ -8,12 +8,13 @@ import Video from './Video/Video';
8
8
  import './Media.css';
9
9
  const b = block('Media');
10
10
  export const Media = (props) => {
11
- const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullscreen, analyticsEvents, className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, } = props;
11
+ const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullscreen, analyticsEvents, className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, qa, } = props;
12
12
  const [hasVideoFallback, setHasVideoFallback] = useState(false);
13
+ const qaAttributes = getQaAttrubutes(qa, 'video');
13
14
  const content = useMemo(() => {
14
15
  let result = [];
15
16
  if (image) {
16
- result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: fullscreen }));
17
+ result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: fullscreen, qa: qaAttributes.image }));
17
18
  }
18
19
  if (video) {
19
20
  const videoProps = {
@@ -31,10 +32,10 @@ export const Media = (props) => {
31
32
  setHasVideoFallback,
32
33
  };
33
34
  if (fullscreen) {
34
- result.push(React.createElement(FullscreenVideo, Object.assign({}, videoProps)));
35
+ result.push(React.createElement(FullscreenVideo, Object.assign({}, videoProps, { qa: qaAttributes.video })));
35
36
  }
36
37
  else {
37
- result.push(React.createElement(Video, Object.assign({}, videoProps)));
38
+ result.push(React.createElement(Video, Object.assign({}, videoProps, { qa: qaAttributes.video })));
38
39
  }
39
40
  }
40
41
  if (youtube) {
@@ -54,6 +55,9 @@ export const Media = (props) => {
54
55
  imageClassName,
55
56
  isBackground,
56
57
  hasVideoFallback,
58
+ fullscreen,
59
+ qaAttributes.image,
60
+ qaAttributes.video,
57
61
  videoClassName,
58
62
  metrika,
59
63
  analyticsEvents,
@@ -62,8 +66,7 @@ export const Media = (props) => {
62
66
  playButton,
63
67
  customBarControlsClassName,
64
68
  youtubeClassName,
65
- fullscreen,
66
69
  ]);
67
- return (React.createElement("div", { className: b(null, className), style: { backgroundColor: color } }, content));
70
+ return (React.createElement("div", { className: b(null, className), style: { backgroundColor: color }, "data-qa": qa }, content));
68
71
  };
69
72
  export default Media;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { MediaComponentVideoProps, PlayButtonProps } from '../../../models';
2
+ import { MediaComponentVideoProps, PlayButtonProps, QAProps } from '../../../models';
3
3
  import './Video.css';
4
4
  export interface VideoAdditionProps {
5
5
  playButton?: PlayButtonProps;
@@ -11,6 +11,6 @@ interface InnerVideoProps {
11
11
  setHasVideoFallback: React.Dispatch<boolean>;
12
12
  hasVideoFallback: boolean;
13
13
  }
14
- export type VideoAllProps = VideoAdditionProps & MediaComponentVideoProps & InnerVideoProps;
14
+ export type VideoAllProps = VideoAdditionProps & MediaComponentVideoProps & InnerVideoProps & QAProps;
15
15
  declare const Video: (props: VideoAllProps) => JSX.Element | null;
16
16
  export default Video;
@@ -1,12 +1,13 @@
1
1
  import React, { useEffect, useMemo, useRef } from 'react';
2
2
  import { MediaVideoType } from '../../../models';
3
- import { block } from '../../../utils';
3
+ import { block, getQaAttrubutes } from '../../../utils';
4
4
  import ReactPlayerBlock from '../../ReactPlayer/ReactPlayer';
5
5
  import { getVideoTypesWithPriority } from './utils';
6
6
  import './Video.css';
7
7
  const b = block('media-component-video');
8
8
  const Video = (props) => {
9
- const { video, height, metrika, analyticsEvents, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, } = props;
9
+ const { video, height, metrika, analyticsEvents, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, qa, } = props;
10
+ const qaAttributes = getQaAttrubutes(qa, 'source');
10
11
  const ref = useRef(null);
11
12
  useEffect(() => {
12
13
  if (ref && ref.current) {
@@ -42,12 +43,20 @@ const Video = (props) => {
42
43
  analyticsEvents,
43
44
  ]);
44
45
  const defaultVideoBlock = useMemo(() => {
45
- return video.src.length && !hasVideoFallback ? (React.createElement("div", { className: b('wrap', videoClassName), style: { height } },
46
+ return video.src.length && !hasVideoFallback ? (React.createElement("div", { className: b('wrap', videoClassName), style: { height }, "data-qa": qaAttributes.default },
46
47
  React.createElement("video", { disablePictureInPicture: true, playsInline: true,
47
48
  // @ts-ignore
48
49
  // eslint-disable-next-line react/no-unknown-property
49
- pip: "false", className: b('item'), ref: ref, preload: "metadata", muted: true, "aria-label": video.ariaLabel }, getVideoTypesWithPriority(video.src).map(({ src, type }, index) => (React.createElement("source", { key: index, src: src, type: type })))))) : null;
50
- }, [video, videoClassName, hasVideoFallback, height]);
50
+ pip: "false", className: b('item'), ref: ref, preload: "metadata", muted: true, "aria-label": video.ariaLabel }, getVideoTypesWithPriority(video.src).map(({ src, type }, index) => (React.createElement("source", { key: index, src: src, type: type, "data-qa": qaAttributes.source })))))) : null;
51
+ }, [
52
+ video.src,
53
+ video.ariaLabel,
54
+ hasVideoFallback,
55
+ videoClassName,
56
+ height,
57
+ qaAttributes.default,
58
+ qaAttributes.source,
59
+ ]);
51
60
  switch (video.type) {
52
61
  case MediaVideoType.Player:
53
62
  return reactPlayerBlock;
@@ -186,7 +186,7 @@ export interface MediaComponentDataLensProps {
186
186
  export interface MediaProps extends Animatable, Partial<MediaComponentDataLensProps>, Partial<MediaComponentYoutubeProps>, Partial<MediaComponentImageProps>, Partial<MediaComponentVideoProps> {
187
187
  color?: string;
188
188
  }
189
- export interface BackgroundMediaProps extends MediaProps, Animatable {
189
+ export interface BackgroundMediaProps extends MediaProps, Animatable, QAProps {
190
190
  fullWidthMedia?: boolean;
191
191
  className?: string;
192
192
  mediaClassName?: string;
@@ -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) {
@@ -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
  };
@@ -7,4 +7,4 @@ export declare const getCustomTypes: (types: (keyof CustomConfig)[], customBlock
7
7
  export declare const getOrderedBlocks: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock[];
8
8
  export declare const getHeaderBlock: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock | undefined;
9
9
  export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
10
- export declare const getQaAttrubutes: (qa?: string, customKeys?: Array<string>) => Record<string, string>;
10
+ export declare const getQaAttrubutes: (qa?: string, ...customKeys: (string | Array<string>)[]) => Record<string, string>;
@@ -1,4 +1,4 @@
1
- import { camelCase } from 'lodash';
1
+ import { camelCase, flatten } from 'lodash';
2
2
  import { PCShareSocialNetwork } from '../models';
3
3
  const BLOCK_ELEMENTS = [
4
4
  'div',
@@ -37,7 +37,7 @@ const BLOCK_ELEMENTS = [
37
37
  'td',
38
38
  ];
39
39
  const BLOCK_ELEMENTS_REGEX = `<(${BLOCK_ELEMENTS.join('|')})[^>]*>`;
40
- const QA_ATTRIBUTES_KEYS = ['container', 'content', 'wrapper', 'image', 'button'];
40
+ const QA_ATTRIBUTES_KEYS = ['container', 'content', 'wrapper', 'image', 'button', 'animate'];
41
41
  export function getHeaderTag(size) {
42
42
  switch (size) {
43
43
  case 'l':
@@ -111,13 +111,14 @@ export const getShareLink = (url, type, title, text) => {
111
111
  return undefined;
112
112
  }
113
113
  };
114
- export const getQaAttrubutes = (qa, customKeys = []) => {
114
+ export const getQaAttrubutes = (qa, ...customKeys) => {
115
115
  const attributes = {};
116
116
  if (qa) {
117
- const keys = QA_ATTRIBUTES_KEYS.concat(customKeys);
117
+ const keys = QA_ATTRIBUTES_KEYS.concat(flatten(customKeys));
118
118
  keys.forEach((key) => {
119
119
  attributes[camelCase(key)] = `${qa}-${key}`;
120
120
  });
121
+ attributes.default = qa;
121
122
  }
122
123
  return attributes;
123
124
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "4.12.0",
3
+ "version": "4.13.0",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -186,7 +186,7 @@ export interface MediaComponentDataLensProps {
186
186
  export interface MediaProps extends Animatable, Partial<MediaComponentDataLensProps>, Partial<MediaComponentYoutubeProps>, Partial<MediaComponentImageProps>, Partial<MediaComponentVideoProps> {
187
187
  color?: string;
188
188
  }
189
- export interface BackgroundMediaProps extends MediaProps, Animatable {
189
+ export interface BackgroundMediaProps extends MediaProps, Animatable, QAProps {
190
190
  fullWidthMedia?: boolean;
191
191
  className?: string;
192
192
  mediaClassName?: string;
@@ -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,6 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.typografTransformer = exports.yfmTransformer = exports.createItemsParser = void 0;
7
+ const plugins_1 = __importDefault(require("@doc-tools/transform/lib/plugins"));
4
8
  const utils_1 = require("./utils");
5
9
  const createItemsParser = (fields) => (transformer, items) => items.map((item) => {
6
10
  if (!item) {
@@ -20,8 +24,12 @@ const createItemsParser = (fields) => (transformer, items) => items.map((item) =
20
24
  }
21
25
  });
22
26
  exports.createItemsParser = createItemsParser;
23
- function yfmTransformer(lang, content) {
24
- const { html } = (0, utils_1.fullTransform)(content, { lang });
27
+ function yfmTransformer(lang, content, options = {}) {
28
+ const { plugins = [] } = options;
29
+ const { html } = (0, utils_1.fullTransform)(content, {
30
+ lang,
31
+ plugins: [...plugins_1.default, ...plugins],
32
+ });
25
33
  return html;
26
34
  }
27
35
  exports.yfmTransformer = yfmTransformer;
@@ -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) => {
@@ -4,17 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.contentTransformer = void 0;
7
- /* eslint-disable no-param-reassign */
8
- /* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
9
7
  const lodash_1 = __importDefault(require("lodash"));
10
8
  const config_1 = require("./config");
11
9
  const filter_1 = require("./filter");
12
- function transformBlocks(blocks, lang, customConfig = {}) {
10
+ function transformBlocks(blocks, lang, customConfig = {}, options = {}) {
13
11
  const fullConfig = Object.assign(Object.assign({}, config_1.config), customConfig);
12
+ const { plugins = [] } = options;
14
13
  const clonedBlocks = lodash_1.default.cloneDeep(blocks);
15
- return clonedBlocks.map((block) => transformBlock(lang, fullConfig, block));
14
+ return clonedBlocks.map((block) => transformBlock(lang, fullConfig, block, plugins));
16
15
  }
17
- function transformBlock(lang, blocksConfig, block) {
16
+ function transformBlock(lang, blocksConfig, block, plugins) {
18
17
  const blockConfig = blocksConfig[block.type];
19
18
  if (block) {
20
19
  if ('randomOrder' in block && block.randomOrder && 'children' in block && block.children) {
@@ -25,7 +24,9 @@ function transformBlock(lang, blocksConfig, block) {
25
24
  const configs = Array.isArray(blockConfig) ? blockConfig : [blockConfig];
26
25
  configs.forEach((transformConfig) => {
27
26
  const { fields, transformer: transformerRaw, parser } = transformConfig;
28
- const transformer = transformerRaw.bind(null, lang);
27
+ const transformer = (content) =>
28
+ // eslint-disable-next-line no-useless-call
29
+ transformerRaw.call(null, lang, content, { plugins });
29
30
  if (fields) {
30
31
  fields.forEach((field) => {
31
32
  if (block[field]) {
@@ -49,9 +50,11 @@ function transformBlock(lang, blocksConfig, block) {
49
50
  return block;
50
51
  }
51
52
  const contentTransformer = ({ content, options }) => {
52
- const { lang, customConfig = {}, vars } = options;
53
+ const { lang, customConfig = {}, vars, plugins = [] } = options;
53
54
  const { blocks = [] } = (vars ? (0, filter_1.filterContent)(content, vars) : content);
54
- const transformedBlocks = transformBlocks(blocks, lang, customConfig);
55
+ const transformedBlocks = transformBlocks(blocks, lang, customConfig, {
56
+ plugins,
57
+ });
55
58
  return {
56
59
  blocks: transformedBlocks,
57
60
  };
@@ -7,4 +7,4 @@ export declare const getCustomTypes: (types: (keyof CustomConfig)[], customBlock
7
7
  export declare const getOrderedBlocks: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock[];
8
8
  export declare const getHeaderBlock: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock | undefined;
9
9
  export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
10
- export declare const getQaAttrubutes: (qa?: string, customKeys?: Array<string>) => Record<string, string>;
10
+ export declare const getQaAttrubutes: (qa?: string, ...customKeys: (string | Array<string>)[]) => Record<string, string>;
@@ -40,7 +40,7 @@ const BLOCK_ELEMENTS = [
40
40
  'td',
41
41
  ];
42
42
  const BLOCK_ELEMENTS_REGEX = `<(${BLOCK_ELEMENTS.join('|')})[^>]*>`;
43
- const QA_ATTRIBUTES_KEYS = ['container', 'content', 'wrapper', 'image', 'button'];
43
+ const QA_ATTRIBUTES_KEYS = ['container', 'content', 'wrapper', 'image', 'button', 'animate'];
44
44
  function getHeaderTag(size) {
45
45
  switch (size) {
46
46
  case 'l':
@@ -122,13 +122,14 @@ const getShareLink = (url, type, title, text) => {
122
122
  }
123
123
  };
124
124
  exports.getShareLink = getShareLink;
125
- const getQaAttrubutes = (qa, customKeys = []) => {
125
+ const getQaAttrubutes = (qa, ...customKeys) => {
126
126
  const attributes = {};
127
127
  if (qa) {
128
- const keys = QA_ATTRIBUTES_KEYS.concat(customKeys);
128
+ const keys = QA_ATTRIBUTES_KEYS.concat((0, lodash_1.flatten)(customKeys));
129
129
  keys.forEach((key) => {
130
130
  attributes[(0, lodash_1.camelCase)(key)] = `${qa}-${key}`;
131
131
  });
132
+ attributes.default = qa;
132
133
  }
133
134
  return attributes;
134
135
  };