@gravity-ui/page-constructor 4.15.1-alpha.0 → 4.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/build/cjs/blocks/HeaderSlider/schema.js +2 -2
  2. package/build/cjs/blocks/Info/schema.js +2 -2
  3. package/build/cjs/blocks/Media/schema.js +3 -2
  4. package/build/cjs/blocks/Questions/schema.js +2 -2
  5. package/build/cjs/blocks/Slider/Slider.js +6 -4
  6. package/build/cjs/blocks/Slider/utils.js +2 -2
  7. package/build/cjs/blocks/Tabs/schema.js +2 -2
  8. package/build/cjs/components/BalancedMasonry/BalancedMasonry.js +6 -4
  9. package/build/cjs/components/CardBase/CardBase.d.ts +1 -0
  10. package/build/cjs/components/CardBase/CardBase.js +7 -6
  11. package/build/cjs/components/FullWidthBackground/FullWidthBackground.js +2 -2
  12. package/build/cjs/components/Image/Image.d.ts +5 -0
  13. package/build/cjs/components/Image/Image.js +7 -8
  14. package/build/cjs/components/Map/GoogleMap.js +2 -2
  15. package/build/cjs/components/Map/YMap/YandexMap.js +2 -2
  16. package/build/cjs/components/Media/Image/Image.js +2 -2
  17. package/build/cjs/components/OverflowScroller/OverflowScroller.js +2 -2
  18. package/build/cjs/components/ReactPlayer/ReactPlayer.js +2 -2
  19. package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +2 -2
  20. package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +2 -2
  21. package/build/cjs/editor/components/BlockForm/BlockForm.js +4 -3
  22. package/build/cjs/editor/components/PagePropsForm/PagePropsForm.js +2 -2
  23. package/build/cjs/editor/dynamic-forms-custom/components/OneOfCustom/OneOfCustom.js +2 -2
  24. package/build/cjs/editor/dynamic-forms-custom/config.js +2 -2
  25. package/build/cjs/editor/dynamic-forms-custom/hooks/useOneOf.js +5 -4
  26. package/build/cjs/editor/store/utils.js +2 -2
  27. package/build/cjs/editor/utils/index.js +2 -2
  28. package/build/cjs/hooks/useFocus.js +2 -2
  29. package/build/cjs/hooks/useHeightCalculator.js +2 -2
  30. package/build/cjs/hooks/useWindowBreakpoint.js +2 -2
  31. package/build/cjs/navigation/components/Navigation/Navigation.js +2 -2
  32. package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +2 -2
  33. package/build/cjs/navigation/schema.js +3 -2
  34. package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -2
  35. package/build/cjs/sub-blocks/BasicCard/schema.js +2 -2
  36. package/build/cjs/sub-blocks/LayoutItem/schema.js +2 -2
  37. package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +4 -4
  38. package/build/cjs/text-transform/config.js +2 -0
  39. package/build/cjs/text-transform/transformers.js +4 -3
  40. package/build/cjs/text-transform/utils.d.ts +0 -2
  41. package/build/cjs/text-transform/utils.js +26 -7
  42. package/build/cjs/utils/blocks.js +5 -3
  43. package/build/esm/blocks/HeaderSlider/schema.js +2 -2
  44. package/build/esm/blocks/Info/schema.js +2 -2
  45. package/build/esm/blocks/Media/schema.js +1 -1
  46. package/build/esm/blocks/Questions/schema.js +2 -2
  47. package/build/esm/blocks/Slider/Slider.js +6 -4
  48. package/build/esm/blocks/Slider/utils.js +2 -2
  49. package/build/esm/blocks/Tabs/schema.js +2 -2
  50. package/build/esm/components/BalancedMasonry/BalancedMasonry.js +6 -4
  51. package/build/esm/components/CardBase/CardBase.d.ts +1 -0
  52. package/build/esm/components/CardBase/CardBase.js +8 -7
  53. package/build/esm/components/FullWidthBackground/FullWidthBackground.js +2 -2
  54. package/build/esm/components/Image/Image.d.ts +5 -0
  55. package/build/esm/components/Image/Image.js +7 -8
  56. package/build/esm/components/Map/GoogleMap.js +2 -2
  57. package/build/esm/components/Map/YMap/YandexMap.js +2 -2
  58. package/build/esm/components/Media/Image/Image.js +2 -2
  59. package/build/esm/components/OverflowScroller/OverflowScroller.js +2 -2
  60. package/build/esm/components/ReactPlayer/ReactPlayer.js +2 -2
  61. package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +2 -2
  62. package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +2 -2
  63. package/build/esm/editor/components/BlockForm/BlockForm.js +4 -3
  64. package/build/esm/editor/components/PagePropsForm/PagePropsForm.js +2 -2
  65. package/build/esm/editor/dynamic-forms-custom/components/OneOfCustom/OneOfCustom.js +2 -2
  66. package/build/esm/editor/dynamic-forms-custom/config.js +2 -2
  67. package/build/esm/editor/dynamic-forms-custom/hooks/useOneOf.js +5 -4
  68. package/build/esm/editor/store/utils.js +2 -2
  69. package/build/esm/editor/utils/index.js +2 -2
  70. package/build/esm/hooks/useFocus.js +2 -2
  71. package/build/esm/hooks/useHeightCalculator.js +2 -2
  72. package/build/esm/hooks/useWindowBreakpoint.js +2 -2
  73. package/build/esm/navigation/components/Navigation/Navigation.js +2 -2
  74. package/build/esm/navigation/components/NavigationItem/NavigationItem.js +1 -1
  75. package/build/esm/navigation/schema.js +1 -1
  76. package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -2
  77. package/build/esm/sub-blocks/BasicCard/schema.js +2 -2
  78. package/build/esm/sub-blocks/LayoutItem/schema.js +1 -1
  79. package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +4 -4
  80. package/build/esm/text-transform/config.js +2 -0
  81. package/build/esm/text-transform/transformers.js +4 -3
  82. package/build/esm/text-transform/utils.d.ts +0 -2
  83. package/build/esm/text-transform/utils.js +25 -5
  84. package/build/esm/utils/blocks.js +2 -1
  85. package/package.json +1 -1
  86. package/server/text-transform/config.js +2 -0
  87. package/server/text-transform/transformers.js +4 -3
  88. package/server/text-transform/utils.d.ts +0 -2
  89. package/server/text-transform/utils.js +26 -7
  90. package/server/utils/blocks.js +7 -3
  91. package/widget/index.js +1 -1
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = require("react");
5
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
5
+ const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
6
6
  const constants_1 = require("../constants");
7
7
  function calculate(windowWidth) {
8
8
  const breakpointsSorted = Object.values(constants_1.BREAKPOINTS).sort((b1, b2) => b1 - b2);
@@ -21,7 +21,7 @@ function useWindowBreakpoint() {
21
21
  const [breakpoint, setBreakpoint] = (0, react_1.useState)(constants_1.BREAKPOINTS.sm);
22
22
  (0, react_1.useEffect)(() => {
23
23
  setBreakpoint(calculate(window.innerWidth));
24
- const detect = lodash_1.default.debounce(() => {
24
+ const detect = (0, debounce_1.default)(() => {
25
25
  setBreakpoint(calculate(window.innerWidth));
26
26
  }, 100);
27
27
  detect();
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Navigation = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
6
+ const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
7
7
  const OutsideClick_1 = tslib_1.__importDefault(require("../../../components/OutsideClick/OutsideClick"));
8
8
  const grid_1 = require("../../../grid");
9
9
  const utils_1 = require("../../../utils");
@@ -29,7 +29,7 @@ const Navigation = ({ data, logo }) => {
29
29
  setShowBorder(window.scrollY > 0);
30
30
  }
31
31
  };
32
- const scrollHandler = lodash_1.default.debounce(showBorderOnScroll, 20);
32
+ const scrollHandler = (0, debounce_1.default)(showBorderOnScroll, 20);
33
33
  window.addEventListener('scroll', scrollHandler, { passive: true });
34
34
  return () => window.removeEventListener('scroll', scrollHandler);
35
35
  });
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
- const lodash_1 = require("lodash");
5
+ const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
6
6
  const blockIdContext_1 = require("../../../context/blockIdContext");
7
7
  const innerContext_1 = require("../../../context/innerContext");
8
8
  const models_1 = require("../../../models");
@@ -17,7 +17,7 @@ const NavigationItem = (_a) => {
17
17
  const componentProps = (0, react_1.useMemo)(() => {
18
18
  const componentProperties = Object.assign(Object.assign({}, data), props);
19
19
  if (type !== models_1.NavigationItemType.Dropdown) {
20
- return (0, lodash_1.omit)(componentProperties, 'hidePopup', 'isActive');
20
+ return (0, omit_1.default)(componentProperties, 'hidePopup', 'isActive');
21
21
  }
22
22
  return componentProperties;
23
23
  }, [data, props, type]);
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NavigationHeaderProps = exports.LogoProps = void 0;
4
- const lodash_1 = require("lodash");
4
+ const tslib_1 = require("tslib");
5
+ const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
5
6
  const schema_1 = require("../components/Image/schema");
6
7
  const common_1 = require("../schema/validators/common");
7
8
  const utils_1 = require("../schema/validators/utils");
@@ -40,7 +41,7 @@ const NavigationItemBaseProps = {
40
41
  type: 'number',
41
42
  },
42
43
  };
43
- const NavigationItemBaseLinkProps = (0, lodash_1.omit)(NavigationItemBaseProps, ['url']);
44
+ const NavigationItemBaseLinkProps = (0, omit_1.default)(NavigationItemBaseProps, ['url']);
44
45
  const NavigationLinkItemProps = {
45
46
  type: 'object',
46
47
  additionalProperties: false,
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BackgroundCard = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
5
+ const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
6
6
  const schema_1 = require("../../components/Image/schema");
7
7
  const common_1 = require("../../schema/validators/common");
8
8
  const event_1 = require("../../schema/validators/event");
9
9
  const schema_2 = require("../Content/schema");
10
- const BackgroundCardContentProps = lodash_1.default.omit(schema_2.ContentBase, ['size']);
10
+ const BackgroundCardContentProps = (0, omit_1.default)(schema_2.ContentBase, ['size']);
11
11
  exports.BackgroundCard = {
12
12
  'background-card': {
13
13
  additionalProperties: false,
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BasicCard = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
5
+ const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
6
6
  const schema_1 = require("../../components/Image/schema");
7
7
  const common_1 = require("../../schema/validators/common");
8
8
  const schema_2 = require("../Content/schema");
9
- const BasicCardContentProps = lodash_1.default.omit(schema_2.ContentBase, ['size', 'theme']);
9
+ const BasicCardContentProps = (0, omit_1.default)(schema_2.ContentBase, ['size', 'theme']);
10
10
  exports.BasicCard = {
11
11
  'basic-card': {
12
12
  additionalProperties: false,
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LayoutItem = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const lodash_1 = require("lodash");
5
+ const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
6
6
  const schema_1 = tslib_1.__importDefault(require("../../components/MetaInfo/schema"));
7
7
  const common_1 = require("../../schema/validators/common");
8
8
  const event_1 = require("../../schema/validators/event");
@@ -11,7 +11,7 @@ exports.LayoutItem = {
11
11
  type: 'object',
12
12
  additionalProperties: false,
13
13
  required: ['content', 'media'],
14
- properties: Object.assign(Object.assign({}, common_1.BaseProps), { media: common_1.MediaProps, content: (0, lodash_1.omit)(schema_2.ContentBase, ['colSize', 'size', 'centered']), metaInfo: schema_1.default, border: {
14
+ properties: Object.assign(Object.assign({}, common_1.BaseProps), { media: common_1.MediaProps, content: (0, omit_1.default)(schema_2.ContentBase, ['colSize', 'size', 'centered']), metaInfo: schema_1.default, border: {
15
15
  type: 'boolean',
16
16
  }, fullscreen: {
17
17
  type: 'boolean',
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
5
+ const chunk_1 = tslib_1.__importDefault(require("lodash/chunk"));
6
6
  const components_1 = require("../../../components");
7
7
  const constants_1 = require("../../../constants");
8
8
  const grid_1 = require("../../../grid");
@@ -50,11 +50,11 @@ const CombinedPriceDetailed = (props) => {
50
50
  react_1.default.createElement("div", null, descriptionComponents),
51
51
  react_1.default.createElement("div", { className: b('description', { delimiter: useMixedView }) }, detailsComponents)));
52
52
  };
53
- const chunkedItems = lodash_1.default.chunk(items, groupItemsSize);
53
+ const chunkedItems = (0, chunk_1.default)(items, groupItemsSize);
54
54
  return (react_1.default.createElement(components_1.CardBase, { className: b(), border: border, analyticsEvents: analyticsEvents },
55
55
  react_1.default.createElement(components_1.CardBase.Content, null,
56
- react_1.default.createElement(grid_1.Grid, null, chunkedItems.map((chunk, id) => {
57
- return (react_1.default.createElement(grid_1.Row, { key: id, className: b('row') }, getPrice(chunk)));
56
+ react_1.default.createElement(grid_1.Grid, null, chunkedItems.map((item, id) => {
57
+ return (react_1.default.createElement(grid_1.Row, { key: id, className: b('row') }, getPrice(item)));
58
58
  })))));
59
59
  };
60
60
  exports.default = CombinedPriceDetailed;
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
+ /* eslint-disable no-param-reassign */
3
+ /* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
2
4
  Object.defineProperty(exports, "__esModule", { value: true });
3
5
  exports.config = exports.blockHeaderTransformer = void 0;
4
6
  const tslib_1 = require("tslib");
@@ -2,20 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.contentTransformer = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
5
+ const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
6
+ const shuffle_1 = tslib_1.__importDefault(require("lodash/shuffle"));
6
7
  const config_1 = require("./config");
7
8
  const filter_1 = require("./filter");
8
9
  function transformBlocks(blocks, lang, customConfig = {}, options = {}) {
9
10
  const fullConfig = Object.assign(Object.assign({}, config_1.config), customConfig);
10
11
  const { plugins = [] } = options;
11
- const clonedBlocks = lodash_1.default.cloneDeep(blocks);
12
+ const clonedBlocks = (0, cloneDeep_1.default)(blocks);
12
13
  return clonedBlocks.map((block) => transformBlock(lang, fullConfig, block, plugins));
13
14
  }
14
15
  function transformBlock(lang, blocksConfig, block, plugins) {
15
16
  const blockConfig = blocksConfig[block.type];
16
17
  if (block) {
17
18
  if ('randomOrder' in block && block.randomOrder && 'children' in block && block.children) {
18
- block.children = lodash_1.default.shuffle(block.children);
19
+ block.children = (0, shuffle_1.default)(block.children);
19
20
  }
20
21
  }
21
22
  if (blockConfig) {
@@ -1,7 +1,6 @@
1
1
  import { Options, Output } from '@doc-tools/transform';
2
2
  import sanitize from 'sanitize-html';
3
3
  import { Lang } from '../utils/configure';
4
- import AddRuleOptions = typograf.AddRuleOptions;
5
4
  export declare enum TransformType {
6
5
  Text = "text",
7
6
  Html = "html"
@@ -15,7 +14,6 @@ export declare const typografConfig: {
15
14
  disabled: string[];
16
15
  };
17
16
  export declare const sanitizeStripOptions: sanitize.IOptions;
18
- export declare function addTypografRules(options: AddRuleOptions[]): void;
19
17
  export declare function typograf(text: string, lang?: Lang): string;
20
18
  export declare function sanitizeHtml(html: string, options?: sanitize.IOptions): string;
21
19
  export declare function typografToHTML(text: string, lang: Lang, allowedTags?: string[]): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.typografEntity = exports.fullTransform = exports.transformMarkdown = exports.typografToText = exports.typografToHTML = exports.sanitizeHtml = exports.typograf = exports.addTypografRules = exports.sanitizeStripOptions = exports.typografConfig = exports.DEFAULT_ALLOWED_TAGS = exports.TransformType = void 0;
3
+ exports.typografEntity = exports.fullTransform = exports.transformMarkdown = exports.typografToText = exports.typografToHTML = exports.sanitizeHtml = exports.typograf = exports.sanitizeStripOptions = exports.typografConfig = exports.DEFAULT_ALLOWED_TAGS = exports.TransformType = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const transform_1 = tslib_1.__importDefault(require("@doc-tools/transform"));
6
6
  const sanitize_html_1 = tslib_1.__importDefault(require("sanitize-html"));
@@ -37,12 +37,31 @@ exports.sanitizeStripOptions = {
37
37
  allowedTags: [],
38
38
  allowedAttributes: {},
39
39
  };
40
- function addTypografRules(options) {
41
- options.forEach((option) => {
42
- typograf_1.default.addRule(option);
43
- });
44
- }
45
- exports.addTypografRules = addTypografRules;
40
+ typograf_1.default.addRule({
41
+ name: 'common/html/sup',
42
+ queue: 'end',
43
+ /* TODO mange with it: in typograf types AddRuleOptions.handler takes only one param: text.
44
+ But in cloud-www was used this notation with 3 params */
45
+ //@ts-ignore
46
+ handler: function (text, settings, context) {
47
+ const { prefs: { htmlEntity: { type = '' } = {} } = {} } = context;
48
+ let symbols;
49
+ switch (type) {
50
+ case 'digit':
51
+ symbols = '®|©|™';
52
+ break;
53
+ case 'name':
54
+ symbols = '®|©|™';
55
+ break;
56
+ default:
57
+ symbols = '®|©|™';
58
+ break;
59
+ }
60
+ const symbolsRegex = new RegExp(`(?<!<sup>\\s*)(${symbols})|(${symbols})(?!\\s*<\\/sup>)`, 'gi');
61
+ return text.replace(symbolsRegex, '<sup>$1</sup>');
62
+ },
63
+ htmlAttrs: false,
64
+ });
46
65
  function enableRules(tp) {
47
66
  const { disabled, enabled } = exports.typografConfig;
48
67
  enabled.forEach((rule) => tp.enableRule(rule));
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getQaAttrubutes = exports.getShareLink = exports.getHeaderBlock = exports.getOrderedBlocks = exports.getCustomTypes = exports.getCustomItems = exports.getBlockKey = exports.hasBlockTag = exports.getHeaderTag = void 0;
4
- const lodash_1 = require("lodash");
4
+ const tslib_1 = require("tslib");
5
+ const camelCase_1 = tslib_1.__importDefault(require("lodash/camelCase"));
6
+ const flatten_1 = tslib_1.__importDefault(require("lodash/flatten"));
5
7
  const models_1 = require("../models");
6
8
  const BLOCK_ELEMENTS = [
7
9
  'div',
@@ -125,9 +127,9 @@ exports.getShareLink = getShareLink;
125
127
  const getQaAttrubutes = (qa, ...customKeys) => {
126
128
  const attributes = {};
127
129
  if (qa) {
128
- const keys = QA_ATTRIBUTES_KEYS.concat((0, lodash_1.flatten)(customKeys));
130
+ const keys = QA_ATTRIBUTES_KEYS.concat((0, flatten_1.default)(customKeys));
129
131
  keys.forEach((key) => {
130
- attributes[(0, lodash_1.camelCase)(key)] = `${qa}-${key}`;
132
+ attributes[(0, camelCase_1.default)(key)] = `${qa}-${key}`;
131
133
  });
132
134
  attributes.default = qa;
133
135
  }
@@ -1,11 +1,11 @@
1
- import _ from 'lodash';
1
+ import omit from 'lodash/omit';
2
2
  import { HeaderProperties, SliderProps } from '../../schema/validators/blocks';
3
3
  import { BlockBaseProps } from '../../schema/validators/common';
4
4
  export const HeaderSliderBlock = {
5
5
  'header-slider-block': {
6
6
  additionalProperties: false,
7
7
  required: ['items'],
8
- properties: Object.assign(Object.assign(Object.assign({}, BlockBaseProps), _.omit(SliderProps, ['loadable', 'children'])), { items: {
8
+ properties: Object.assign(Object.assign(Object.assign({}, BlockBaseProps), omit(SliderProps, ['loadable', 'children'])), { items: {
9
9
  type: 'array',
10
10
  items: {
11
11
  type: 'object',
@@ -1,10 +1,10 @@
1
- import _ from 'lodash';
1
+ import omit from 'lodash/omit';
2
2
  import { BaseProps, ButtonBlock, LinkProps, ThemeProps, withTheme, } from '../../schema/validators/common';
3
3
  import { filteredArray } from '../../schema/validators/utils';
4
4
  import { ContentBase } from '../../sub-blocks/Content/schema';
5
5
  const ContentProps = {
6
6
  additionalProperties: false,
7
- properties: _.omit(ContentBase, ['size', 'colSizes', 'theme']),
7
+ properties: omit(ContentBase, ['size', 'colSizes', 'theme']),
8
8
  };
9
9
  export const InfoBlock = {
10
10
  'info-block': {
@@ -1,4 +1,4 @@
1
- import { omit } from 'lodash';
1
+ import omit from 'lodash/omit';
2
2
  import { AnimatableProps, BlockBaseProps, ButtonBlock, MediaProps, mediaDirection, withTheme, } from '../../schema/validators/common';
3
3
  import { ContentBase } from '../../sub-blocks/Content/schema';
4
4
  export const Media = {
@@ -1,8 +1,8 @@
1
- import _ from 'lodash';
1
+ import omit from 'lodash/omit';
2
2
  import { BlockBaseProps, LinkProps } from '../../schema/validators/common';
3
3
  import { filteredArray } from '../../schema/validators/utils';
4
4
  import { ContentBase } from '../../sub-blocks/Content/schema';
5
- const QuestionsBlockContentProps = _.omit(ContentBase, ['size', 'theme']);
5
+ const QuestionsBlockContentProps = omit(ContentBase, ['size', 'theme']);
6
6
  export const QuestionsBlock = {
7
7
  'questions-block': {
8
8
  additionalProperties: false,
@@ -1,5 +1,7 @@
1
1
  import React, { Fragment, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
2
- import _ from 'lodash';
2
+ import debounce from 'lodash/debounce';
3
+ import get from 'lodash/get';
4
+ import noop from 'lodash/noop';
3
5
  import SlickSlider from 'react-slick';
4
6
  import Anchor from '../../components/Anchor/Anchor';
5
7
  import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
@@ -40,11 +42,11 @@ export const SliderBlock = (props) => {
40
42
  const autoplayTimeId = useRef();
41
43
  const { hasFocus, unsetFocus } = useFocus((_a = slider === null || slider === void 0 ? void 0 : slider.innerSlider) === null || _a === void 0 ? void 0 : _a.list);
42
44
  // eslint-disable-next-line react-hooks/exhaustive-deps
43
- const onResize = useCallback(_.debounce(() => {
45
+ const onResize = useCallback(debounce(() => {
44
46
  if (!slider) {
45
47
  return;
46
48
  }
47
- const newBreakpoint = _.get(slider, 'state.breakpoint') || BREAKPOINTS.xl;
49
+ const newBreakpoint = get(slider, 'state.breakpoint') || BREAKPOINTS.xl;
48
50
  if (newBreakpoint !== breakpoint) {
49
51
  setBreakpoint(newBreakpoint);
50
52
  setCurrentIndex(0);
@@ -193,7 +195,7 @@ export const SliderBlock = (props) => {
193
195
  prevArrow: React.createElement(Arrow, { type: "left", handleClick: handleArrowClick, size: arrowSize }),
194
196
  lazyLoad,
195
197
  };
196
- return (React.createElement(OutsideClick, { onOutsideClick: isMobile ? unsetFocus : _.noop },
198
+ return (React.createElement(OutsideClick, { onOutsideClick: isMobile ? unsetFocus : noop },
197
199
  React.createElement(SlickSlider, Object.assign({}, settings), disclosedChildren),
198
200
  React.createElement("div", { className: b('footer') },
199
201
  renderDisclaimer(),
@@ -1,4 +1,4 @@
1
- import _ from 'lodash';
1
+ import pickBy from 'lodash/pickBy';
2
2
  import { BREAKPOINTS } from '../../constants';
3
3
  import { SliderBreakpointNames } from './models';
4
4
  export const DEFAULT_SLIDE_BREAKPOINTS = {
@@ -16,7 +16,7 @@ export function getSlidesToShowWithDefaults({ contentLength, breakpoints, mobile
16
16
  else {
17
17
  result = breakpoints || DEFAULT_SLIDE_BREAKPOINTS;
18
18
  }
19
- return Object.assign(Object.assign(Object.assign({}, DEFAULT_SLIDE_BREAKPOINTS), _.pickBy(result, (value) => !isNaN(value))), { sm: !mobileFullscreen && contentLength > 1 ? DEFAULT_SLIDE_BREAKPOINTS.sm : 1 });
19
+ return Object.assign(Object.assign(Object.assign({}, DEFAULT_SLIDE_BREAKPOINTS), pickBy(result, (value) => !isNaN(value))), { sm: !mobileFullscreen && contentLength > 1 ? DEFAULT_SLIDE_BREAKPOINTS.sm : 1 });
20
20
  }
21
21
  export function getSliderResponsiveParams(breakpoints) {
22
22
  return Object.entries(breakpoints).map(([breakpointName, slidesToShow]) => ({
@@ -1,9 +1,9 @@
1
- import _ from 'lodash';
1
+ import omit from 'lodash/omit';
2
2
  import { ImageProps } from '../../components/Image/schema';
3
3
  import { BlockBaseProps, BlockHeaderProps, LinkProps, MediaProps, containerSizesArray, contentSizes, mediaDirection, sizeNumber, withTheme, } from '../../schema/validators/common';
4
4
  import { filteredArray } from '../../schema/validators/utils';
5
5
  import { ContentBase } from '../../sub-blocks/Content/schema';
6
- const TabsItemContentProps = _.omit(ContentBase, ['size', 'colSizes', 'centered', 'theme']);
6
+ const TabsItemContentProps = omit(ContentBase, ['size', 'colSizes', 'centered', 'theme']);
7
7
  export const tabsItem = {
8
8
  type: 'object',
9
9
  additionalProperties: false,
@@ -1,5 +1,7 @@
1
1
  import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
2
- import _ from 'lodash';
2
+ import debounce from 'lodash/debounce';
3
+ import first from 'lodash/first';
4
+ import minBy from 'lodash/minBy';
3
5
  import { SSRContext } from '../../context/ssrContext';
4
6
  import { block, getQaAttrubutes } from '../../utils';
5
7
  import './BalancedMasonry.css';
@@ -13,7 +15,7 @@ const BalancedMasonry = (props) => {
13
15
  return Number(secondBreakpoint) - Number(firstBreakpoint);
14
16
  });
15
17
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
16
- let [, result] = _.first(breakpoints);
18
+ let [, result] = first(breakpoints);
17
19
  if (isServer) {
18
20
  return result;
19
21
  }
@@ -29,7 +31,7 @@ const BalancedMasonry = (props) => {
29
31
  const [columns, setColumns] = useState([]);
30
32
  const containerRef = useRef(null);
31
33
  // eslint-disable-next-line react-hooks/exhaustive-deps
32
- const balanceColumns = useCallback(_.debounce(() => {
34
+ const balanceColumns = useCallback(debounce(() => {
33
35
  if (!containerRef.current) {
34
36
  return;
35
37
  }
@@ -44,7 +46,7 @@ const BalancedMasonry = (props) => {
44
46
  if (!node) {
45
47
  continue;
46
48
  }
47
- const minColumn = _.minBy(columnsMeta, 'height') || { id: 0, height: 0 };
49
+ const minColumn = minBy(columnsMeta, 'height') || { id: 0, height: 0 };
48
50
  const { id: columnId } = minColumn;
49
51
  localColumns[columnId].push(children[i]);
50
52
  minColumn.height += node.offsetHeight;
@@ -11,6 +11,7 @@ export interface CardBaseProps extends AnalyticsEventsBase, CardBaseParams {
11
11
  target?: HTMLAttributeAnchorTarget;
12
12
  metrikaGoals?: MetrikaGoal;
13
13
  pixelEvents?: ButtonPixel;
14
+ qa?: string;
14
15
  }
15
16
  export interface CardHeaderBaseProps {
16
17
  className?: string;
@@ -2,7 +2,7 @@ import React, { Children, Fragment } from 'react';
2
2
  import { useAnalytics } from '../../hooks';
3
3
  import { useMetrika } from '../../hooks/useMetrika';
4
4
  import { DefaultEventNames } from '../../models/common';
5
- import { block } from '../../utils';
5
+ import { block, getQaAttrubutes } from '../../utils';
6
6
  import BackgroundImage from '../BackgroundImage/BackgroundImage';
7
7
  import RouterLink from '../RouterLink/RouterLink';
8
8
  import './CardBase.css';
@@ -11,10 +11,11 @@ const Header = () => null;
11
11
  const Content = () => null;
12
12
  const Footer = () => null;
13
13
  export const Layout = (props) => {
14
- const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', } = props;
14
+ const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', qa, } = props;
15
15
  const handleMetrika = useMetrika();
16
16
  const handleAnalytics = useAnalytics(DefaultEventNames.CardBase, url);
17
17
  let header, content, footer, image, headerClass, footerClass;
18
+ const qaAttributes = getQaAttrubutes(qa, 'header', 'footer', 'body', 'content');
18
19
  function handleChild(child) {
19
20
  switch (child.type) {
20
21
  case Header:
@@ -38,18 +39,18 @@ export const Layout = (props) => {
38
39
  Children.forEach(children, handleChild);
39
40
  }
40
41
  const cardContent = (React.createElement(Fragment, null,
41
- (header || image) && (React.createElement(BackgroundImage, Object.assign({ className: b('header', headerClass) }, (typeof image === 'string' ? { src: image } : image)),
42
+ (header || image) && (React.createElement(BackgroundImage, Object.assign({ className: b('header', headerClass) }, (typeof image === 'string' ? { src: image } : image), { qa: qaAttributes.header }),
42
43
  React.createElement("div", { className: b('header-content') }, header))),
43
- React.createElement("div", { className: b('body', bodyClassName) },
44
- React.createElement("div", { className: b('content', contentClassName) }, content),
45
- footer && React.createElement("div", { className: b('footer', footerClass) }, footer))));
44
+ React.createElement("div", { className: b('body', bodyClassName), "data-qa": qaAttributes.body },
45
+ React.createElement("div", { className: b('content', contentClassName), "data-qa": qaAttributes.content }, content),
46
+ footer && (React.createElement("div", { className: b('footer', footerClass), "data-qa": qaAttributes.footer }, footer)))));
46
47
  const fullClassName = b({ border }, className);
47
48
  const onClick = () => {
48
49
  handleMetrika({ metrikaGoals, pixelEvents });
49
50
  handleAnalytics(analyticsEvents);
50
51
  };
51
52
  return url ? (React.createElement(RouterLink, { href: url },
52
- React.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick }, cardContent))) : (React.createElement("div", { className: fullClassName }, cardContent));
53
+ React.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick, "data-qa": qa }, cardContent))) : (React.createElement("div", { className: fullClassName, "data-qa": qa }, cardContent));
53
54
  };
54
55
  Layout.Header = Header;
55
56
  Layout.Content = Content;
@@ -1,5 +1,5 @@
1
1
  import React, { Component, createRef } from 'react';
2
- import _ from 'lodash';
2
+ import debounce from 'lodash/debounce';
3
3
  import { BREAKPOINTS } from '../../constants';
4
4
  import { block } from '../../utils';
5
5
  import './FullWidthBackground.css';
@@ -11,7 +11,7 @@ export default class FullWidthBackground extends Component {
11
11
  constructor() {
12
12
  super(...arguments);
13
13
  this.ref = createRef();
14
- this.setBg = _.debounce(() => {
14
+ this.setBg = debounce(() => {
15
15
  var _a, _b;
16
16
  if (this.ref && this.ref.current) {
17
17
  const bg = this.ref.current;
@@ -6,5 +6,10 @@ export interface ImageProps extends Partial<ImageObjectProps>, Partial<ImageDevi
6
6
  onClick?: MouseEventHandler;
7
7
  containerClassName?: string;
8
8
  }
9
+ export interface DeviceSpecificFragmentProps extends QAProps {
10
+ disableWebp: boolean;
11
+ src: string;
12
+ breakpoint: number;
13
+ }
9
14
  declare const Image: (props: ImageProps) => JSX.Element | null;
10
15
  export default Image;
@@ -8,6 +8,9 @@ import i18n from './i18n';
8
8
  const checkWebP = (src) => {
9
9
  return src.endsWith('.webp') ? src : src + '.webp';
10
10
  };
11
+ const DeviceSpecificFragment = ({ disableWebp, src, breakpoint, qa, }) => (React.createElement(Fragment, null,
12
+ !disableWebp && (React.createElement("source", { srcSet: checkWebP(src), type: "image/webp", media: `(max-width: ${breakpoint}px)`, "data-qa": `${qa}-compressed` })),
13
+ React.createElement("source", { srcSet: src, media: `(max-width: ${breakpoint}px)`, "data-qa": qa })));
11
14
  const Image = (props) => {
12
15
  const projectSettings = useContext(ProjectSettingsContext);
13
16
  const { src: imageSrc, alt = i18n('img-alt'), disableCompress, tablet, desktop, mobile, style, className, onClick, containerClassName, qa, } = props;
@@ -16,19 +19,15 @@ const Image = (props) => {
16
19
  if (!src) {
17
20
  return null;
18
21
  }
19
- const qaAttributes = getQaAttrubutes(qa, 'mobile-webp-source', 'mobile-source', 'tablet-webp-source', 'tablet-source', 'display-source');
22
+ const qaAttributes = getQaAttrubutes(qa, 'mobile-webp-source', 'mobile-source', 'tablet-webp-source', 'tablet-source', 'desktop-source-compressed');
20
23
  const disableWebp = projectSettings.disableCompress ||
21
24
  disableCompress ||
22
25
  !isCompressible(src) ||
23
26
  imgLoadingError;
24
27
  return (React.createElement("picture", { className: containerClassName, "data-qa": qa },
25
- mobile && (React.createElement(Fragment, null,
26
- !disableWebp && (React.createElement("source", { srcSet: checkWebP(mobile), type: "image/webp", media: `(max-width: ${BREAKPOINTS.sm}px)`, "data-qa": qaAttributes.mobileWebpSource })),
27
- React.createElement("source", { srcSet: mobile, media: `(max-width: ${BREAKPOINTS.sm}px)`, "data-qa": qaAttributes.mobileSource }))),
28
- tablet && (React.createElement(Fragment, null,
29
- !disableWebp && (React.createElement("source", { srcSet: checkWebP(tablet), type: "image/webp", media: `(max-width: ${BREAKPOINTS.md}px)`, "data-qa": qaAttributes.tabletWebpSource })),
30
- React.createElement("source", { srcSet: tablet, media: `(max-width: ${BREAKPOINTS.md}px)`, "data-qa": qaAttributes.tabletSource }))),
31
- src && !disableWebp && (React.createElement("source", { srcSet: checkWebP(src), type: "image/webp", "data-qa": qaAttributes.displaySource })),
28
+ mobile && (React.createElement(DeviceSpecificFragment, { src: mobile, disableWebp: disableWebp, breakpoint: BREAKPOINTS.sm, qa: qaAttributes.mobileSource })),
29
+ tablet && (React.createElement(DeviceSpecificFragment, { src: tablet, disableWebp: disableWebp, breakpoint: BREAKPOINTS.md, qa: qaAttributes.tabletSource })),
30
+ src && !disableWebp && (React.createElement("source", { srcSet: checkWebP(src), type: "image/webp", "data-qa": qaAttributes.desktopSourceCompressed })),
32
31
  React.createElement(ImageBase, { className: className, alt: alt, src: src, style: style, onClick: onClick, onError: () => setImgLoadingError(true) })));
33
32
  };
34
33
  export default Image;
@@ -1,5 +1,5 @@
1
1
  import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
2
- import _ from 'lodash';
2
+ import debounce from 'lodash/debounce';
3
3
  import { LocaleContext } from '../../context/localeContext/localeContext';
4
4
  import { MapsContext } from '../../context/mapsContext/mapsContext';
5
5
  import { MobileContext } from '../../context/mobileContext';
@@ -20,7 +20,7 @@ const GoogleMap = (props) => {
20
20
  const ref = useRef(null);
21
21
  const src = useMemo(() => getScriptSrc({ apiKey, scriptSrc, address, lang, zoom }), [apiKey, scriptSrc, address, lang, zoom]);
22
22
  useEffect(() => {
23
- const updateSize = _.debounce(() => {
23
+ const updateSize = debounce(() => {
24
24
  if (ref.current) {
25
25
  setHeight(Math.round(getMapHeight(ref.current.offsetWidth, isMobile)));
26
26
  }
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
2
2
  import { Spin } from '@gravity-ui/uikit';
3
- import _ from 'lodash';
3
+ import debounce from 'lodash/debounce';
4
4
  import { LocaleContext } from '../../../context/localeContext/localeContext';
5
5
  import { MapsContext } from '../../../context/mapsContext/mapsContext';
6
6
  import { MobileContext } from '../../../context/mobileContext';
@@ -47,7 +47,7 @@ const YandexMap = (props) => {
47
47
  })();
48
48
  }, [apiKey, lang, scriptSrc, containerId, zoom, nonce, attemptsIndex, setLoading]);
49
49
  useEffect(() => {
50
- const updateSize = _.debounce(() => {
50
+ const updateSize = debounce(() => {
51
51
  if (ref.current) {
52
52
  setHeight(Math.round(getMapHeight(ref.current.offsetWidth, isMobile)));
53
53
  }
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import _ from 'lodash';
2
+ import debounce from 'lodash/debounce';
3
3
  import { animated, config, useSpring } from 'react-spring';
4
4
  import SliderBlock from '../../../blocks/Slider/Slider';
5
5
  import { SliderType } from '../../../models';
@@ -23,7 +23,7 @@ const Image = (props) => {
23
23
  useEffect(() => {
24
24
  if (parallax) {
25
25
  const handleScroll = () => setScrollY(window.scrollY);
26
- const debouncedHandler = _.debounce(handleScroll, 5);
26
+ const debouncedHandler = debounce(handleScroll, 5);
27
27
  window.addEventListener('scroll', debouncedHandler, { passive: true });
28
28
  return () => window.removeEventListener('scroll', debouncedHandler);
29
29
  }
@@ -1,5 +1,5 @@
1
1
  import React, { createRef } from 'react';
2
- import _ from 'lodash';
2
+ import debounce from 'lodash/debounce';
3
3
  import { ToggleArrow } from '..';
4
4
  import { block } from '../../utils';
5
5
  import './OverflowScroller.css';
@@ -17,7 +17,7 @@ export default class OverflowScroller extends React.Component {
17
17
  this.containerRef = createRef();
18
18
  this.wrapperRef = createRef();
19
19
  // eslint-disable-next-line @typescript-eslint/member-ordering, react/sort-comp
20
- this.checkOverflow = _.debounce(() => {
20
+ this.checkOverflow = debounce(() => {
21
21
  if (this.containerRef &&
22
22
  this.containerRef.current &&
23
23
  this.wrapperRef &&
@@ -1,6 +1,6 @@
1
1
  import React, { Fragment, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState, } from 'react';
2
2
  import { Icon } from '@gravity-ui/uikit';
3
- import _ from 'lodash';
3
+ import debounce from 'lodash/debounce';
4
4
  import ReactPlayer from 'react-player';
5
5
  import { MetrikaContext } from '../../context/metrikaContext';
6
6
  import { MobileContext } from '../../context/mobileContext';
@@ -75,7 +75,7 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
75
75
  }
76
76
  }, [elapsedTime, playerRef, started]);
77
77
  useEffect(() => {
78
- const updateSize = _.debounce(() => {
78
+ const updateSize = debounce(() => {
79
79
  if (ref.current) {
80
80
  // We need to get parent's width does not equal 0
81
81
  const parentElement = getParentElement(ref.current);