@gravity-ui/page-constructor 1.13.0-alpha.0 → 1.13.1-alpha.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.
- package/CHANGELOG.md +21 -1
- package/build/cjs/blocks/Banner/schema.d.ts +0 -141
- package/build/cjs/blocks/Media/schema.d.ts +0 -47
- package/build/cjs/blocks/Slider/Slider.d.ts +1 -6
- package/build/cjs/components/Author/Author.js +2 -2
- package/build/cjs/components/Author/__tests__/Author.test.d.ts +1 -0
- package/build/cjs/components/Author/__tests__/Author.test.js +49 -0
- package/build/cjs/components/Button/Button.js +3 -3
- package/build/cjs/components/CardBase/CardBase.d.ts +1 -2
- package/build/cjs/components/CardBase/CardBase.js +2 -2
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +2 -2
- package/build/cjs/components/Link/Link.js +2 -2
- package/build/cjs/context/metrikaContext/metrikaContext.d.ts +1 -2
- package/build/cjs/grid/Grid/Grid.css +16 -16
- package/build/cjs/hooks/useMetrika.d.ts +2 -3
- package/build/cjs/hooks/useMetrika.js +2 -10
- package/build/cjs/models/common.d.ts +1 -4
- package/build/cjs/models/constructor-items/common.d.ts +1 -21
- package/build/cjs/schema/validators/common.d.ts +0 -94
- package/build/cjs/schema/validators/common.js +0 -2
- package/build/cjs/text-transform/blocks.js +1 -10
- package/build/esm/blocks/Banner/schema.d.ts +0 -141
- package/build/esm/blocks/Media/schema.d.ts +0 -47
- package/build/esm/blocks/Slider/Slider.d.ts +1 -6
- package/build/esm/components/Author/Author.js +2 -2
- package/build/esm/components/Author/__tests__/Author.test.d.ts +1 -0
- package/build/esm/components/Author/__tests__/Author.test.js +46 -0
- package/build/esm/components/Button/Button.js +3 -3
- package/build/esm/components/CardBase/CardBase.d.ts +1 -2
- package/build/esm/components/CardBase/CardBase.js +2 -2
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +2 -2
- package/build/esm/components/Link/Link.js +2 -2
- package/build/esm/context/metrikaContext/metrikaContext.d.ts +1 -2
- package/build/esm/grid/Grid/Grid.css +16 -16
- package/build/esm/hooks/useMetrika.d.ts +2 -3
- package/build/esm/hooks/useMetrika.js +2 -10
- package/build/esm/models/common.d.ts +1 -4
- package/build/esm/models/constructor-items/common.d.ts +1 -21
- package/build/esm/schema/validators/common.d.ts +0 -94
- package/build/esm/schema/validators/common.js +0 -2
- package/build/esm/text-transform/blocks.js +1 -10
- package/package.json +2 -3
- package/server/models/common.d.ts +1 -4
- package/server/models/constructor-items/common.d.ts +1 -21
- package/server/text-transform/blocks.js +1 -10
- package/build/cjs/schema/validators/ga-events.d.ts +0 -47
- package/build/cjs/schema/validators/ga-events.js +0 -50
- package/build/esm/schema/validators/ga-events.d.ts +0 -47
- package/build/esm/schema/validators/ga-events.js +0 -47
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.13.0](https://github.com/gravity-ui/page-constructor/compare/v1.12.1...v1.13.0) (2023-01-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* remove matchMedia artefact ([#114](https://github.com/gravity-ui/page-constructor/issues/114)) ([8ff3117](https://github.com/gravity-ui/page-constructor/commit/8ff3117261f9681f0dbb452c3c722ee80845da80))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* delete unused dependency ([#112](https://github.com/gravity-ui/page-constructor/issues/112)) ([300085c](https://github.com/gravity-ui/page-constructor/commit/300085c456877ef617f4225a603fcc3d52393848))
|
|
14
|
+
|
|
15
|
+
## [1.12.1](https://github.com/gravity-ui/page-constructor/compare/v1.12.0...v1.12.1) (2023-01-11)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **BlockHeader:** add yfm to description, change styles ([#105](https://github.com/gravity-ui/page-constructor/issues/105)) ([f77fc5e](https://github.com/gravity-ui/page-constructor/commit/f77fc5e82f7aaf33dda8f56a9f17a87d61cc5cdd))
|
|
21
|
+
* contentBase import ([#109](https://github.com/gravity-ui/page-constructor/issues/109)) ([2136f7b](https://github.com/gravity-ui/page-constructor/commit/2136f7bbe340c6035c655ff5139ae69ee1b50d3e))
|
|
22
|
+
|
|
3
23
|
## [1.12.0](https://github.com/gravity-ui/page-constructor/compare/v1.11.1...v1.12.0) (2023-01-10)
|
|
4
24
|
|
|
5
25
|
|
|
@@ -534,7 +554,7 @@ In the `Content`, if the `text` block has no `title`, the `margin-top` property
|
|
|
534
554
|
### Breaking changes
|
|
535
555
|
|
|
536
556
|
- `PageConstructorProvider` is now a separate component. For the `PageConstructor` to run properly, wrap it in this provider.
|
|
537
|
-
For details, see the [readme](https://github.
|
|
557
|
+
For details, see the [readme](https://github.com/gravity-ui/page-constructor#getting-started) file.
|
|
538
558
|
|
|
539
559
|
- Deleted the `system` theme (the `light` theme is used instead by default).
|
|
540
560
|
|
|
@@ -173,53 +173,6 @@ export declare const BannerCardProps: {
|
|
|
173
173
|
};
|
|
174
174
|
};
|
|
175
175
|
};
|
|
176
|
-
gaEvents: {
|
|
177
|
-
type: string;
|
|
178
|
-
items: {
|
|
179
|
-
type: string;
|
|
180
|
-
required: string[];
|
|
181
|
-
additionalProperties: boolean;
|
|
182
|
-
properties: {
|
|
183
|
-
eventName: {
|
|
184
|
-
type: string;
|
|
185
|
-
};
|
|
186
|
-
eventCategory: {
|
|
187
|
-
type: string;
|
|
188
|
-
};
|
|
189
|
-
eventLabel: {
|
|
190
|
-
type: string;
|
|
191
|
-
};
|
|
192
|
-
value: {
|
|
193
|
-
type: string;
|
|
194
|
-
};
|
|
195
|
-
groups: {
|
|
196
|
-
oneOf: ({
|
|
197
|
-
type: string;
|
|
198
|
-
items?: undefined;
|
|
199
|
-
} | {
|
|
200
|
-
type: string;
|
|
201
|
-
items: {
|
|
202
|
-
type: string;
|
|
203
|
-
};
|
|
204
|
-
})[];
|
|
205
|
-
};
|
|
206
|
-
sendTo: {
|
|
207
|
-
oneOf: ({
|
|
208
|
-
type: string;
|
|
209
|
-
items?: undefined;
|
|
210
|
-
} | {
|
|
211
|
-
type: string;
|
|
212
|
-
items: {
|
|
213
|
-
type: string;
|
|
214
|
-
};
|
|
215
|
-
})[];
|
|
216
|
-
};
|
|
217
|
-
eventTimeout: {
|
|
218
|
-
type: string;
|
|
219
|
-
};
|
|
220
|
-
};
|
|
221
|
-
};
|
|
222
|
-
};
|
|
223
176
|
target: {
|
|
224
177
|
type: string;
|
|
225
178
|
enum: string[];
|
|
@@ -422,53 +375,6 @@ export declare const BannerBlock: {
|
|
|
422
375
|
};
|
|
423
376
|
};
|
|
424
377
|
};
|
|
425
|
-
gaEvents: {
|
|
426
|
-
type: string;
|
|
427
|
-
items: {
|
|
428
|
-
type: string;
|
|
429
|
-
required: string[];
|
|
430
|
-
additionalProperties: boolean;
|
|
431
|
-
properties: {
|
|
432
|
-
eventName: {
|
|
433
|
-
type: string;
|
|
434
|
-
};
|
|
435
|
-
eventCategory: {
|
|
436
|
-
type: string;
|
|
437
|
-
};
|
|
438
|
-
eventLabel: {
|
|
439
|
-
type: string;
|
|
440
|
-
};
|
|
441
|
-
value: {
|
|
442
|
-
type: string;
|
|
443
|
-
};
|
|
444
|
-
groups: {
|
|
445
|
-
oneOf: ({
|
|
446
|
-
type: string;
|
|
447
|
-
items?: undefined;
|
|
448
|
-
} | {
|
|
449
|
-
type: string;
|
|
450
|
-
items: {
|
|
451
|
-
type: string;
|
|
452
|
-
};
|
|
453
|
-
})[];
|
|
454
|
-
};
|
|
455
|
-
sendTo: {
|
|
456
|
-
oneOf: ({
|
|
457
|
-
type: string;
|
|
458
|
-
items?: undefined;
|
|
459
|
-
} | {
|
|
460
|
-
type: string;
|
|
461
|
-
items: {
|
|
462
|
-
type: string;
|
|
463
|
-
};
|
|
464
|
-
})[];
|
|
465
|
-
};
|
|
466
|
-
eventTimeout: {
|
|
467
|
-
type: string;
|
|
468
|
-
};
|
|
469
|
-
};
|
|
470
|
-
};
|
|
471
|
-
};
|
|
472
378
|
target: {
|
|
473
379
|
type: string;
|
|
474
380
|
enum: string[];
|
|
@@ -672,53 +578,6 @@ export declare const BannerCard: {
|
|
|
672
578
|
};
|
|
673
579
|
};
|
|
674
580
|
};
|
|
675
|
-
gaEvents: {
|
|
676
|
-
type: string;
|
|
677
|
-
items: {
|
|
678
|
-
type: string;
|
|
679
|
-
required: string[];
|
|
680
|
-
additionalProperties: boolean;
|
|
681
|
-
properties: {
|
|
682
|
-
eventName: {
|
|
683
|
-
type: string;
|
|
684
|
-
};
|
|
685
|
-
eventCategory: {
|
|
686
|
-
type: string;
|
|
687
|
-
};
|
|
688
|
-
eventLabel: {
|
|
689
|
-
type: string;
|
|
690
|
-
};
|
|
691
|
-
value: {
|
|
692
|
-
type: string;
|
|
693
|
-
};
|
|
694
|
-
groups: {
|
|
695
|
-
oneOf: ({
|
|
696
|
-
type: string;
|
|
697
|
-
items?: undefined;
|
|
698
|
-
} | {
|
|
699
|
-
type: string;
|
|
700
|
-
items: {
|
|
701
|
-
type: string;
|
|
702
|
-
};
|
|
703
|
-
})[];
|
|
704
|
-
};
|
|
705
|
-
sendTo: {
|
|
706
|
-
oneOf: ({
|
|
707
|
-
type: string;
|
|
708
|
-
items?: undefined;
|
|
709
|
-
} | {
|
|
710
|
-
type: string;
|
|
711
|
-
items: {
|
|
712
|
-
type: string;
|
|
713
|
-
};
|
|
714
|
-
})[];
|
|
715
|
-
};
|
|
716
|
-
eventTimeout: {
|
|
717
|
-
type: string;
|
|
718
|
-
};
|
|
719
|
-
};
|
|
720
|
-
};
|
|
721
|
-
};
|
|
722
581
|
target: {
|
|
723
582
|
type: string;
|
|
724
583
|
enum: string[];
|
|
@@ -426,53 +426,6 @@ export declare const MediaBlock: {
|
|
|
426
426
|
};
|
|
427
427
|
};
|
|
428
428
|
};
|
|
429
|
-
gaEvents: {
|
|
430
|
-
type: string;
|
|
431
|
-
items: {
|
|
432
|
-
type: string;
|
|
433
|
-
required: string[];
|
|
434
|
-
additionalProperties: boolean;
|
|
435
|
-
properties: {
|
|
436
|
-
eventName: {
|
|
437
|
-
type: string;
|
|
438
|
-
};
|
|
439
|
-
eventCategory: {
|
|
440
|
-
type: string;
|
|
441
|
-
};
|
|
442
|
-
eventLabel: {
|
|
443
|
-
type: string;
|
|
444
|
-
};
|
|
445
|
-
value: {
|
|
446
|
-
type: string;
|
|
447
|
-
};
|
|
448
|
-
groups: {
|
|
449
|
-
oneOf: ({
|
|
450
|
-
type: string;
|
|
451
|
-
items?: undefined;
|
|
452
|
-
} | {
|
|
453
|
-
type: string;
|
|
454
|
-
items: {
|
|
455
|
-
type: string;
|
|
456
|
-
};
|
|
457
|
-
})[];
|
|
458
|
-
};
|
|
459
|
-
sendTo: {
|
|
460
|
-
oneOf: ({
|
|
461
|
-
type: string;
|
|
462
|
-
items?: undefined;
|
|
463
|
-
} | {
|
|
464
|
-
type: string;
|
|
465
|
-
items: {
|
|
466
|
-
type: string;
|
|
467
|
-
};
|
|
468
|
-
})[];
|
|
469
|
-
};
|
|
470
|
-
eventTimeout: {
|
|
471
|
-
type: string;
|
|
472
|
-
};
|
|
473
|
-
};
|
|
474
|
-
};
|
|
475
|
-
};
|
|
476
429
|
target: {
|
|
477
430
|
type: string;
|
|
478
431
|
enum: string[];
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Settings } from 'react-slick';
|
|
2
2
|
import { Refable, SliderProps as SliderParams, ClassNameProps, WithChildren } from '../../models';
|
|
3
|
-
export interface SlickSliderFull extends SlickSlider {
|
|
4
|
-
innerSlider?: {
|
|
5
|
-
list: HTMLElement;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
3
|
export interface SliderProps extends Omit<SliderParams, 'children'>, Refable<HTMLDivElement>, ClassNameProps, Pick<Settings, 'lazyLoad'> {
|
|
9
4
|
type?: string;
|
|
10
5
|
anchorId?: string;
|
|
@@ -7,10 +7,10 @@ const models_1 = require("../../models");
|
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
8
|
const b = (0, utils_1.block)('author');
|
|
9
9
|
const Author = (props) => {
|
|
10
|
-
const { author, className, authorContainerClassName, type = models_1.AuthorType.Column } = props;
|
|
10
|
+
const { author, className, authorContainerClassName, type = models_1.AuthorType.Column, dataQa } = props;
|
|
11
11
|
const { firstName, secondName, description, avatar } = author;
|
|
12
12
|
const name = secondName ? `${firstName} ${secondName}` : firstName;
|
|
13
|
-
return (react_1.default.createElement("div", { className: b({ type }, className) },
|
|
13
|
+
return (react_1.default.createElement("div", { className: b({ type }, className), "data-qa": dataQa },
|
|
14
14
|
avatar && (react_1.default.createElement("div", { className: b('avatar', authorContainerClassName) }, typeof avatar === 'string' ? react_1.default.createElement(index_1.Image, { src: avatar }) : avatar)),
|
|
15
15
|
react_1.default.createElement("div", { className: b('label') },
|
|
16
16
|
react_1.default.createElement("div", { className: b('name') }, name),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const react_2 = require("@testing-library/react");
|
|
6
|
+
const models_1 = require("../../../models");
|
|
7
|
+
const Author_1 = tslib_1.__importDefault(require("../Author"));
|
|
8
|
+
const testId = 'author';
|
|
9
|
+
const author = {
|
|
10
|
+
firstName: 'John',
|
|
11
|
+
secondName: 'Doe',
|
|
12
|
+
description: 'Web designer',
|
|
13
|
+
avatar: 'https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/img-gray.png',
|
|
14
|
+
};
|
|
15
|
+
describe('Author', () => {
|
|
16
|
+
test('Render author by default', async () => {
|
|
17
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
|
|
18
|
+
const object = react_2.screen.getByTestId(testId);
|
|
19
|
+
expect(object).toBeInTheDocument();
|
|
20
|
+
});
|
|
21
|
+
test('Has full name', async () => {
|
|
22
|
+
const name = `${author.firstName} ${author.secondName}`;
|
|
23
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
|
|
24
|
+
const object = react_2.screen.getByText(name);
|
|
25
|
+
expect(object).toBeInTheDocument();
|
|
26
|
+
});
|
|
27
|
+
test('Has first name only', async () => {
|
|
28
|
+
const name = author.firstName;
|
|
29
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: Object.assign(Object.assign({}, author), { secondName: '' }), dataQa: testId }));
|
|
30
|
+
const object = react_2.screen.getByText(name);
|
|
31
|
+
expect(object).toBeInTheDocument();
|
|
32
|
+
});
|
|
33
|
+
test('Has avatar', async () => {
|
|
34
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
|
|
35
|
+
const avatar = react_2.screen.getByRole('img');
|
|
36
|
+
expect(avatar).toBeInTheDocument();
|
|
37
|
+
expect(avatar).toHaveAttribute('src', author.avatar);
|
|
38
|
+
});
|
|
39
|
+
test('Has description', async () => {
|
|
40
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
|
|
41
|
+
const object = react_2.screen.getByText(author.description);
|
|
42
|
+
expect(object).toBeInTheDocument();
|
|
43
|
+
});
|
|
44
|
+
test.each(new Array(models_1.AuthorType.Column, models_1.AuthorType.Line))('Render with given "%s" type', (type) => {
|
|
45
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId, type: type }));
|
|
46
|
+
const object = react_2.screen.getByTestId(testId);
|
|
47
|
+
expect(object).toHaveClass(`pc-author_type_${type}`);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -12,14 +12,14 @@ const b = (0, utils_1.block)('button-block');
|
|
|
12
12
|
const Button = (props) => {
|
|
13
13
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
14
14
|
const { lang, tld } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
15
|
-
const { className, metrikaGoals, pixelEvents,
|
|
15
|
+
const { className, metrikaGoals, pixelEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text } = props, rest = tslib_1.__rest(props, ["className", "metrikaGoals", "pixelEvents", "size", "theme", "url", "img", "onClick", "text"]);
|
|
16
16
|
const defaultImgPosition = 'left';
|
|
17
17
|
const onClick = (0, react_1.useCallback)(() => {
|
|
18
|
-
handleMetrika({ metrikaGoals, pixelEvents
|
|
18
|
+
handleMetrika({ metrikaGoals, pixelEvents });
|
|
19
19
|
if (onClickOrigin) {
|
|
20
20
|
onClickOrigin();
|
|
21
21
|
}
|
|
22
|
-
}, [handleMetrika, metrikaGoals, pixelEvents,
|
|
22
|
+
}, [handleMetrika, metrikaGoals, pixelEvents, onClickOrigin]);
|
|
23
23
|
const buttonImg = img instanceof Object
|
|
24
24
|
? { url: img.url, position: img.position || defaultImgPosition, alt: img.alt }
|
|
25
25
|
: { url: img, position: defaultImgPosition };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactElement, HTMLAttributeAnchorTarget } from 'react';
|
|
2
|
-
import { ButtonPixel, CardBaseProps as CardBaseParams,
|
|
2
|
+
import { ButtonPixel, CardBaseProps as CardBaseParams, ImageProps, MetrikaGoal, WithChildren } from '../../models';
|
|
3
3
|
export interface CardBaseProps extends CardBaseParams {
|
|
4
4
|
className?: string;
|
|
5
5
|
bodyClassName?: string;
|
|
@@ -9,7 +9,6 @@ export interface CardBaseProps extends CardBaseParams {
|
|
|
9
9
|
target?: HTMLAttributeAnchorTarget;
|
|
10
10
|
metrikaGoals?: MetrikaGoal;
|
|
11
11
|
pixelEvents?: ButtonPixel;
|
|
12
|
-
gaEvents?: GAEvents;
|
|
13
12
|
}
|
|
14
13
|
export interface CardHeaderBaseProps {
|
|
15
14
|
className?: string;
|
|
@@ -12,7 +12,7 @@ const Header = () => null;
|
|
|
12
12
|
const Content = () => null;
|
|
13
13
|
const Footer = () => null;
|
|
14
14
|
const Layout = (props) => {
|
|
15
|
-
const { className, bodyClassName, metrikaGoals, pixelEvents,
|
|
15
|
+
const { className, bodyClassName, metrikaGoals, pixelEvents, contentClassName, children, url, target, border = 'shadow', } = props;
|
|
16
16
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
17
17
|
let header, content, footer, image, headerClass, footerClass;
|
|
18
18
|
function handleChild(child) {
|
|
@@ -45,7 +45,7 @@ const Layout = (props) => {
|
|
|
45
45
|
footer && react_1.default.createElement("div", { className: b('footer', footerClass) }, footer))));
|
|
46
46
|
const fullClassName = b({ border }, className);
|
|
47
47
|
const onClick = () => {
|
|
48
|
-
handleMetrika({ metrikaGoals, pixelEvents
|
|
48
|
+
handleMetrika({ metrikaGoals, pixelEvents });
|
|
49
49
|
};
|
|
50
50
|
return url ? (react_1.default.createElement(RouterLink_1.default, { href: url },
|
|
51
51
|
react_1.default.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick }, cardContent))) : (react_1.default.createElement("div", { className: fullClassName }, cardContent));
|
|
@@ -6,10 +6,10 @@ const utils_1 = require("../../utils");
|
|
|
6
6
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
7
7
|
const b = (0, utils_1.block)('header-breadcrumbs');
|
|
8
8
|
function HeaderBreadcrumbs(props) {
|
|
9
|
-
const { items, metrikaGoals, pixelEvents,
|
|
9
|
+
const { items, metrikaGoals, pixelEvents, theme = 'light', className } = props;
|
|
10
10
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
11
11
|
const onClick = () => {
|
|
12
|
-
handleMetrika({ metrikaGoals, pixelEvents
|
|
12
|
+
handleMetrika({ metrikaGoals, pixelEvents });
|
|
13
13
|
};
|
|
14
14
|
return (react_1.default.createElement("div", { className: b({ theme }, className) }, items.map((item) => (react_1.default.createElement("div", { className: b('item'), key: item.url },
|
|
15
15
|
react_1.default.createElement("a", { href: item.url, className: b('text'), onClick: onClick }, item.text))))));
|
|
@@ -25,14 +25,14 @@ function getArrowSize(size) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
const LinkBlock = (props) => {
|
|
28
|
-
const { text, url, arrow, metrikaGoals, pixelEvents,
|
|
28
|
+
const { text, url, arrow, metrikaGoals, pixelEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, } = props;
|
|
29
29
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
30
30
|
const { hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
31
31
|
const { tld } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
32
32
|
const href = (0, utils_1.setUrlTld)(props.url, tld);
|
|
33
33
|
const defaultTextSize = theme === 'back' ? 'l' : 'm';
|
|
34
34
|
const onClick = () => {
|
|
35
|
-
handleMetrika({ metrikaGoals, pixelEvents
|
|
35
|
+
handleMetrika({ metrikaGoals, pixelEvents });
|
|
36
36
|
};
|
|
37
37
|
const getLinkByType = () => {
|
|
38
38
|
switch (theme) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Metrika, Pixel } from '../../models';
|
|
3
3
|
export interface MetrikaContextProps {
|
|
4
4
|
metrika?: Metrika;
|
|
5
5
|
pixel?: Pixel;
|
|
6
|
-
gaInline?: GaInline;
|
|
7
6
|
}
|
|
8
7
|
export declare const MetrikaContext: React.Context<MetrikaContextProps>;
|
|
@@ -21,64 +21,64 @@
|
|
|
21
21
|
}
|
|
22
22
|
@media only screen and (max-width: 577px) {
|
|
23
23
|
.pc-Grid .container,
|
|
24
|
-
.pc-Grid .container-fluid {
|
|
24
|
+
.pc-Grid .container-fluid {
|
|
25
25
|
padding: 0 16px;
|
|
26
26
|
}
|
|
27
27
|
.pc-Grid .col,
|
|
28
|
-
.pc-Grid .col-sm-auto,
|
|
29
|
-
.pc-Grid .col-auto {
|
|
28
|
+
.pc-Grid .col-sm-auto,
|
|
29
|
+
.pc-Grid .col-auto {
|
|
30
30
|
padding: 0 8px;
|
|
31
31
|
}
|
|
32
32
|
.pc-Grid .col-sm-0,
|
|
33
|
-
.pc-Grid .col-0 {
|
|
33
|
+
.pc-Grid .col-0 {
|
|
34
34
|
padding: 0 8px;
|
|
35
35
|
}
|
|
36
36
|
.pc-Grid .col-sm-1,
|
|
37
|
-
.pc-Grid .col-1 {
|
|
37
|
+
.pc-Grid .col-1 {
|
|
38
38
|
padding: 0 8px;
|
|
39
39
|
}
|
|
40
40
|
.pc-Grid .col-sm-2,
|
|
41
|
-
.pc-Grid .col-2 {
|
|
41
|
+
.pc-Grid .col-2 {
|
|
42
42
|
padding: 0 8px;
|
|
43
43
|
}
|
|
44
44
|
.pc-Grid .col-sm-3,
|
|
45
|
-
.pc-Grid .col-3 {
|
|
45
|
+
.pc-Grid .col-3 {
|
|
46
46
|
padding: 0 8px;
|
|
47
47
|
}
|
|
48
48
|
.pc-Grid .col-sm-4,
|
|
49
|
-
.pc-Grid .col-4 {
|
|
49
|
+
.pc-Grid .col-4 {
|
|
50
50
|
padding: 0 8px;
|
|
51
51
|
}
|
|
52
52
|
.pc-Grid .col-sm-5,
|
|
53
|
-
.pc-Grid .col-5 {
|
|
53
|
+
.pc-Grid .col-5 {
|
|
54
54
|
padding: 0 8px;
|
|
55
55
|
}
|
|
56
56
|
.pc-Grid .col-sm-6,
|
|
57
|
-
.pc-Grid .col-6 {
|
|
57
|
+
.pc-Grid .col-6 {
|
|
58
58
|
padding: 0 8px;
|
|
59
59
|
}
|
|
60
60
|
.pc-Grid .col-sm-7,
|
|
61
|
-
.pc-Grid .col-7 {
|
|
61
|
+
.pc-Grid .col-7 {
|
|
62
62
|
padding: 0 8px;
|
|
63
63
|
}
|
|
64
64
|
.pc-Grid .col-sm-8,
|
|
65
|
-
.pc-Grid .col-8 {
|
|
65
|
+
.pc-Grid .col-8 {
|
|
66
66
|
padding: 0 8px;
|
|
67
67
|
}
|
|
68
68
|
.pc-Grid .col-sm-9,
|
|
69
|
-
.pc-Grid .col-9 {
|
|
69
|
+
.pc-Grid .col-9 {
|
|
70
70
|
padding: 0 8px;
|
|
71
71
|
}
|
|
72
72
|
.pc-Grid .col-sm-10,
|
|
73
|
-
.pc-Grid .col-10 {
|
|
73
|
+
.pc-Grid .col-10 {
|
|
74
74
|
padding: 0 8px;
|
|
75
75
|
}
|
|
76
76
|
.pc-Grid .col-sm-11,
|
|
77
|
-
.pc-Grid .col-11 {
|
|
77
|
+
.pc-Grid .col-11 {
|
|
78
78
|
padding: 0 8px;
|
|
79
79
|
}
|
|
80
80
|
.pc-Grid .col-sm-12,
|
|
81
|
-
.pc-Grid .col-12 {
|
|
81
|
+
.pc-Grid .col-12 {
|
|
82
82
|
padding: 0 8px;
|
|
83
83
|
}
|
|
84
84
|
.pc-Grid .row .row {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ButtonPixel, MetrikaGoal, PixelEvent
|
|
1
|
+
import { ButtonPixel, MetrikaGoal, PixelEvent } from '../models';
|
|
2
2
|
type UseMetrikaProps = {
|
|
3
3
|
metrikaGoals?: MetrikaGoal;
|
|
4
4
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[] | ButtonPixel;
|
|
5
|
-
gaEvents?: GAEvents;
|
|
6
5
|
};
|
|
7
|
-
export declare const useMetrika: () => ({ metrikaGoals, pixelEvents
|
|
6
|
+
export declare const useMetrika: () => ({ metrikaGoals, pixelEvents }: UseMetrikaProps) => void;
|
|
8
7
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMetrika = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const react_1 = require("react");
|
|
6
5
|
const metrikaContext_1 = require("../context/metrikaContext");
|
|
7
6
|
const models_1 = require("../models");
|
|
@@ -13,8 +12,8 @@ function isButtonPixel(pixelEvents) {
|
|
|
13
12
|
return false;
|
|
14
13
|
}
|
|
15
14
|
const useMetrika = () => {
|
|
16
|
-
const { metrika, pixel
|
|
17
|
-
return ({ metrikaGoals, pixelEvents
|
|
15
|
+
const { metrika, pixel } = (0, react_1.useContext)(metrikaContext_1.MetrikaContext);
|
|
16
|
+
return ({ metrikaGoals, pixelEvents }) => {
|
|
18
17
|
if (metrika && metrikaGoals) {
|
|
19
18
|
if ((0, guards_1.isNewMetrikaFormat)(metrikaGoals)) {
|
|
20
19
|
metrikaGoals.forEach(({ name, isCrossSite }) => metrika.reachGoal(isCrossSite ? 'cross-site' : 'main', name));
|
|
@@ -37,13 +36,6 @@ const useMetrika = () => {
|
|
|
37
36
|
pixel.track(pixelEvents);
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
|
-
if (gaInline && gaEvents) {
|
|
41
|
-
const gaEventsArray = Array.isArray(gaEvents) ? gaEvents : [gaEvents];
|
|
42
|
-
gaEventsArray.forEach((_a) => {
|
|
43
|
-
var { eventName } = _a, rest = tslib_1.__rest(_a, ["eventName"]);
|
|
44
|
-
gaInline.event(eventName, rest);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
39
|
};
|
|
48
40
|
};
|
|
49
41
|
exports.useMetrika = useMetrika;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { MetrikaGoal } from './';
|
|
3
3
|
export interface Refable<T> {
|
|
4
4
|
ref?: React.Ref<T>;
|
|
5
5
|
}
|
|
@@ -45,9 +45,6 @@ export interface Metrika {
|
|
|
45
45
|
reachGoal: (counterName: string, ...args: any) => void;
|
|
46
46
|
reachGoals: (goals: MetrikaGoal, counterName?: string) => void;
|
|
47
47
|
}
|
|
48
|
-
export interface GaInline {
|
|
49
|
-
event: (eventName: string, params?: GAEventParams) => void;
|
|
50
|
-
}
|
|
51
48
|
export interface ClassNameProps {
|
|
52
49
|
className?: string;
|
|
53
50
|
}
|
|
@@ -121,7 +121,6 @@ export interface LinkProps extends Stylable {
|
|
|
121
121
|
target?: string;
|
|
122
122
|
metrikaGoals?: MetrikaGoal;
|
|
123
123
|
pixelEvents?: ButtonPixel;
|
|
124
|
-
gaEvents?: GAEvents;
|
|
125
124
|
}
|
|
126
125
|
export interface FileLinkProps extends ClassNameProps {
|
|
127
126
|
href: string;
|
|
@@ -140,7 +139,6 @@ export interface ButtonProps {
|
|
|
140
139
|
img?: ButtonImageProps | string;
|
|
141
140
|
metrikaGoals?: MetrikaGoal;
|
|
142
141
|
pixelEvents?: ButtonPixel;
|
|
143
|
-
gaEvents?: GAEvents;
|
|
144
142
|
target?: string;
|
|
145
143
|
}
|
|
146
144
|
export interface ButtonImageProps {
|
|
@@ -224,7 +222,6 @@ export interface HeaderBreadCrumbsProps extends ClassNameProps {
|
|
|
224
222
|
theme?: TextTheme;
|
|
225
223
|
metrikaGoals?: MetrikaGoal;
|
|
226
224
|
pixelEvents?: ButtonPixel;
|
|
227
|
-
gaEvents?: GAEvents;
|
|
228
225
|
}
|
|
229
226
|
export interface PreviewContentItemProps {
|
|
230
227
|
title: string;
|
|
@@ -335,27 +332,10 @@ export interface AuthorProps {
|
|
|
335
332
|
className?: string;
|
|
336
333
|
authorContainerClassName?: string;
|
|
337
334
|
type?: AuthorType;
|
|
335
|
+
dataQa?: string;
|
|
338
336
|
}
|
|
339
337
|
export interface BlockHeaderProps {
|
|
340
338
|
title?: TitleProps | string;
|
|
341
339
|
description?: string;
|
|
342
340
|
}
|
|
343
|
-
export declare type GaParameterValue = string | number | boolean;
|
|
344
|
-
declare type GACommandConfig<T> = T & {
|
|
345
|
-
[key: string]: GaParameterValue;
|
|
346
|
-
};
|
|
347
|
-
declare type GACommonParams = {
|
|
348
|
-
groups?: string | string[];
|
|
349
|
-
sendTo?: string | string[];
|
|
350
|
-
eventTimeout?: number;
|
|
351
|
-
};
|
|
352
|
-
export declare type GAEventParams = GACommandConfig<GACommonParams & {
|
|
353
|
-
eventCategory?: string;
|
|
354
|
-
eventLabel?: string;
|
|
355
|
-
value?: number;
|
|
356
|
-
}>;
|
|
357
|
-
export type GAEvent = GAEventParams & {
|
|
358
|
-
eventName: string;
|
|
359
|
-
};
|
|
360
|
-
export type GAEvents = GAEvent | GAEvent[];
|
|
361
341
|
export {};
|