@gravity-ui/page-constructor 1.13.0-alpha.0 → 1.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.
- 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/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/package.json +2 -6
- package/server/models/common.d.ts +1 -4
- package/server/models/constructor-items/common.d.ts +1 -21
- 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
|
@@ -499,53 +499,6 @@ export declare const ButtonProps: {
|
|
|
499
499
|
};
|
|
500
500
|
};
|
|
501
501
|
};
|
|
502
|
-
gaEvents: {
|
|
503
|
-
type: string;
|
|
504
|
-
items: {
|
|
505
|
-
type: string;
|
|
506
|
-
required: string[];
|
|
507
|
-
additionalProperties: boolean;
|
|
508
|
-
properties: {
|
|
509
|
-
eventName: {
|
|
510
|
-
type: string;
|
|
511
|
-
};
|
|
512
|
-
eventCategory: {
|
|
513
|
-
type: string;
|
|
514
|
-
};
|
|
515
|
-
eventLabel: {
|
|
516
|
-
type: string;
|
|
517
|
-
};
|
|
518
|
-
value: {
|
|
519
|
-
type: string;
|
|
520
|
-
};
|
|
521
|
-
groups: {
|
|
522
|
-
oneOf: ({
|
|
523
|
-
type: string;
|
|
524
|
-
items?: undefined;
|
|
525
|
-
} | {
|
|
526
|
-
type: string;
|
|
527
|
-
items: {
|
|
528
|
-
type: string;
|
|
529
|
-
};
|
|
530
|
-
})[];
|
|
531
|
-
};
|
|
532
|
-
sendTo: {
|
|
533
|
-
oneOf: ({
|
|
534
|
-
type: string;
|
|
535
|
-
items?: undefined;
|
|
536
|
-
} | {
|
|
537
|
-
type: string;
|
|
538
|
-
items: {
|
|
539
|
-
type: string;
|
|
540
|
-
};
|
|
541
|
-
})[];
|
|
542
|
-
};
|
|
543
|
-
eventTimeout: {
|
|
544
|
-
type: string;
|
|
545
|
-
};
|
|
546
|
-
};
|
|
547
|
-
};
|
|
548
|
-
};
|
|
549
502
|
target: {
|
|
550
503
|
type: string;
|
|
551
504
|
enum: string[];
|
|
@@ -761,53 +714,6 @@ export declare const ButtonBlock: {
|
|
|
761
714
|
};
|
|
762
715
|
};
|
|
763
716
|
};
|
|
764
|
-
gaEvents: {
|
|
765
|
-
type: string;
|
|
766
|
-
items: {
|
|
767
|
-
type: string;
|
|
768
|
-
required: string[];
|
|
769
|
-
additionalProperties: boolean;
|
|
770
|
-
properties: {
|
|
771
|
-
eventName: {
|
|
772
|
-
type: string;
|
|
773
|
-
};
|
|
774
|
-
eventCategory: {
|
|
775
|
-
type: string;
|
|
776
|
-
};
|
|
777
|
-
eventLabel: {
|
|
778
|
-
type: string;
|
|
779
|
-
};
|
|
780
|
-
value: {
|
|
781
|
-
type: string;
|
|
782
|
-
};
|
|
783
|
-
groups: {
|
|
784
|
-
oneOf: ({
|
|
785
|
-
type: string;
|
|
786
|
-
items?: undefined;
|
|
787
|
-
} | {
|
|
788
|
-
type: string;
|
|
789
|
-
items: {
|
|
790
|
-
type: string;
|
|
791
|
-
};
|
|
792
|
-
})[];
|
|
793
|
-
};
|
|
794
|
-
sendTo: {
|
|
795
|
-
oneOf: ({
|
|
796
|
-
type: string;
|
|
797
|
-
items?: undefined;
|
|
798
|
-
} | {
|
|
799
|
-
type: string;
|
|
800
|
-
items: {
|
|
801
|
-
type: string;
|
|
802
|
-
};
|
|
803
|
-
})[];
|
|
804
|
-
};
|
|
805
|
-
eventTimeout: {
|
|
806
|
-
type: string;
|
|
807
|
-
};
|
|
808
|
-
};
|
|
809
|
-
};
|
|
810
|
-
};
|
|
811
717
|
target: {
|
|
812
718
|
type: string;
|
|
813
719
|
enum: string[];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BlockHeaderProps = exports.CardBase = exports.MediaProps = exports.ButtonBlock = exports.TitleProps = exports.BlockBaseProps = exports.AnchorProps = exports.withTheme = exports.MenuProps = exports.ButtonProps = exports.authorItem = exports.FileLinkProps = exports.LinkProps = exports.BackgroundProps = exports.DataLensProps = exports.DataLensObjectProps = exports.JustifyProps = exports.ThemeProps = exports.VideoProps = exports.PlayIconProps = exports.LoopProps = exports.ChildrenCardsProps = exports.ChildrenProps = exports.AnimatableProps = exports.sliderSizesObject = exports.containerSizesObject = exports.BaseProps = exports.contentThemes = exports.sizeNumber = exports.dividerEnum = exports.fileLinkTypes = exports.videoControlsTypes = exports.playIconThemes = exports.playIconTypes = exports.videoTypes = exports.contentTextWidth = exports.contentSizes = exports.sliderSizesArray = exports.containerSizesArray = exports.textSize = exports.mediaDirection = void 0;
|
|
4
|
-
const ga_events_1 = require("./ga-events");
|
|
5
4
|
const pixel_1 = require("./pixel");
|
|
6
5
|
const models_1 = require("../../models");
|
|
7
6
|
const schema_1 = require("../../components/Image/schema");
|
|
@@ -333,7 +332,6 @@ exports.ButtonProps = {
|
|
|
333
332
|
],
|
|
334
333
|
},
|
|
335
334
|
pixelEvents: pixel_1.pixelEvents,
|
|
336
|
-
gaEvents: ga_events_1.gaEvents,
|
|
337
335
|
target: {
|
|
338
336
|
type: 'string',
|
|
339
337
|
enum: ['_self', '_blank', '_parent', '_top'],
|
|
@@ -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,12 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Settings } from 'react-slick';
|
|
2
2
|
import { Refable, SliderProps as SliderParams, ClassNameProps, WithChildren } from '../../models';
|
|
3
3
|
import './slick.css';
|
|
4
4
|
import './Slider.css';
|
|
5
|
-
export interface SlickSliderFull extends SlickSlider {
|
|
6
|
-
innerSlider?: {
|
|
7
|
-
list: HTMLElement;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
5
|
export interface SliderProps extends Omit<SliderParams, 'children'>, Refable<HTMLDivElement>, ClassNameProps, Pick<Settings, 'lazyLoad'> {
|
|
11
6
|
type?: string;
|
|
12
7
|
anchorId?: string;
|
|
@@ -5,10 +5,10 @@ import { block } from '../../utils';
|
|
|
5
5
|
import './Author.css';
|
|
6
6
|
const b = block('author');
|
|
7
7
|
const Author = (props) => {
|
|
8
|
-
const { author, className, authorContainerClassName, type = AuthorType.Column } = props;
|
|
8
|
+
const { author, className, authorContainerClassName, type = AuthorType.Column, dataQa } = props;
|
|
9
9
|
const { firstName, secondName, description, avatar } = author;
|
|
10
10
|
const name = secondName ? `${firstName} ${secondName}` : firstName;
|
|
11
|
-
return (React.createElement("div", { className: b({ type }, className) },
|
|
11
|
+
return (React.createElement("div", { className: b({ type }, className), "data-qa": dataQa },
|
|
12
12
|
avatar && (React.createElement("div", { className: b('avatar', authorContainerClassName) }, typeof avatar === 'string' ? React.createElement(Image, { src: avatar }) : avatar)),
|
|
13
13
|
React.createElement("div", { className: b('label') },
|
|
14
14
|
React.createElement("div", { className: b('name') }, name),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { AuthorType } from '../../../models';
|
|
4
|
+
import Author from '../Author';
|
|
5
|
+
const testId = 'author';
|
|
6
|
+
const author = {
|
|
7
|
+
firstName: 'John',
|
|
8
|
+
secondName: 'Doe',
|
|
9
|
+
description: 'Web designer',
|
|
10
|
+
avatar: 'https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/img-gray.png',
|
|
11
|
+
};
|
|
12
|
+
describe('Author', () => {
|
|
13
|
+
test('Render author by default', async () => {
|
|
14
|
+
render(React.createElement(Author, { author: author, dataQa: testId }));
|
|
15
|
+
const object = screen.getByTestId(testId);
|
|
16
|
+
expect(object).toBeInTheDocument();
|
|
17
|
+
});
|
|
18
|
+
test('Has full name', async () => {
|
|
19
|
+
const name = `${author.firstName} ${author.secondName}`;
|
|
20
|
+
render(React.createElement(Author, { author: author, dataQa: testId }));
|
|
21
|
+
const object = screen.getByText(name);
|
|
22
|
+
expect(object).toBeInTheDocument();
|
|
23
|
+
});
|
|
24
|
+
test('Has first name only', async () => {
|
|
25
|
+
const name = author.firstName;
|
|
26
|
+
render(React.createElement(Author, { author: Object.assign(Object.assign({}, author), { secondName: '' }), dataQa: testId }));
|
|
27
|
+
const object = screen.getByText(name);
|
|
28
|
+
expect(object).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
test('Has avatar', async () => {
|
|
31
|
+
render(React.createElement(Author, { author: author, dataQa: testId }));
|
|
32
|
+
const avatar = screen.getByRole('img');
|
|
33
|
+
expect(avatar).toBeInTheDocument();
|
|
34
|
+
expect(avatar).toHaveAttribute('src', author.avatar);
|
|
35
|
+
});
|
|
36
|
+
test('Has description', async () => {
|
|
37
|
+
render(React.createElement(Author, { author: author, dataQa: testId }));
|
|
38
|
+
const object = screen.getByText(author.description);
|
|
39
|
+
expect(object).toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
test.each(new Array(AuthorType.Column, AuthorType.Line))('Render with given "%s" type', (type) => {
|
|
42
|
+
render(React.createElement(Author, { author: author, dataQa: testId, type: type }));
|
|
43
|
+
const object = screen.getByTestId(testId);
|
|
44
|
+
expect(object).toHaveClass(`pc-author_type_${type}`);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -11,14 +11,14 @@ const b = block('button-block');
|
|
|
11
11
|
const Button = (props) => {
|
|
12
12
|
const handleMetrika = useMetrika();
|
|
13
13
|
const { lang, tld } = useContext(LocaleContext);
|
|
14
|
-
const { className, metrikaGoals, pixelEvents,
|
|
14
|
+
const { className, metrikaGoals, pixelEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text } = props, rest = __rest(props, ["className", "metrikaGoals", "pixelEvents", "size", "theme", "url", "img", "onClick", "text"]);
|
|
15
15
|
const defaultImgPosition = 'left';
|
|
16
16
|
const onClick = useCallback(() => {
|
|
17
|
-
handleMetrika({ metrikaGoals, pixelEvents
|
|
17
|
+
handleMetrika({ metrikaGoals, pixelEvents });
|
|
18
18
|
if (onClickOrigin) {
|
|
19
19
|
onClickOrigin();
|
|
20
20
|
}
|
|
21
|
-
}, [handleMetrika, metrikaGoals, pixelEvents,
|
|
21
|
+
}, [handleMetrika, metrikaGoals, pixelEvents, onClickOrigin]);
|
|
22
22
|
const buttonImg = img instanceof Object
|
|
23
23
|
? { url: img.url, position: img.position || defaultImgPosition, alt: img.alt }
|
|
24
24
|
: { 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
|
import './CardBase.css';
|
|
4
4
|
export interface CardBaseProps extends CardBaseParams {
|
|
5
5
|
className?: string;
|
|
@@ -10,7 +10,6 @@ export interface CardBaseProps extends CardBaseParams {
|
|
|
10
10
|
target?: HTMLAttributeAnchorTarget;
|
|
11
11
|
metrikaGoals?: MetrikaGoal;
|
|
12
12
|
pixelEvents?: ButtonPixel;
|
|
13
|
-
gaEvents?: GAEvents;
|
|
14
13
|
}
|
|
15
14
|
export interface CardHeaderBaseProps {
|
|
16
15
|
className?: string;
|
|
@@ -9,7 +9,7 @@ const Header = () => null;
|
|
|
9
9
|
const Content = () => null;
|
|
10
10
|
const Footer = () => null;
|
|
11
11
|
export const Layout = (props) => {
|
|
12
|
-
const { className, bodyClassName, metrikaGoals, pixelEvents,
|
|
12
|
+
const { className, bodyClassName, metrikaGoals, pixelEvents, contentClassName, children, url, target, border = 'shadow', } = props;
|
|
13
13
|
const handleMetrika = useMetrika();
|
|
14
14
|
let header, content, footer, image, headerClass, footerClass;
|
|
15
15
|
function handleChild(child) {
|
|
@@ -42,7 +42,7 @@ export const Layout = (props) => {
|
|
|
42
42
|
footer && React.createElement("div", { className: b('footer', footerClass) }, footer))));
|
|
43
43
|
const fullClassName = b({ border }, className);
|
|
44
44
|
const onClick = () => {
|
|
45
|
-
handleMetrika({ metrikaGoals, pixelEvents
|
|
45
|
+
handleMetrika({ metrikaGoals, pixelEvents });
|
|
46
46
|
};
|
|
47
47
|
return url ? (React.createElement(RouterLink, { href: url },
|
|
48
48
|
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));
|
|
@@ -4,10 +4,10 @@ import { useMetrika } from '../../hooks/useMetrika';
|
|
|
4
4
|
import './HeaderBreadcrumbs.css';
|
|
5
5
|
const b = block('header-breadcrumbs');
|
|
6
6
|
export default function HeaderBreadcrumbs(props) {
|
|
7
|
-
const { items, metrikaGoals, pixelEvents,
|
|
7
|
+
const { items, metrikaGoals, pixelEvents, theme = 'light', className } = props;
|
|
8
8
|
const handleMetrika = useMetrika();
|
|
9
9
|
const onClick = () => {
|
|
10
|
-
handleMetrika({ metrikaGoals, pixelEvents
|
|
10
|
+
handleMetrika({ metrikaGoals, pixelEvents });
|
|
11
11
|
};
|
|
12
12
|
return (React.createElement("div", { className: b({ theme }, className) }, items.map((item) => (React.createElement("div", { className: b('item'), key: item.url },
|
|
13
13
|
React.createElement("a", { href: item.url, className: b('text'), onClick: onClick }, item.text))))));
|
|
@@ -23,14 +23,14 @@ function getArrowSize(size) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
const LinkBlock = (props) => {
|
|
26
|
-
const { text, url, arrow, metrikaGoals, pixelEvents,
|
|
26
|
+
const { text, url, arrow, metrikaGoals, pixelEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, } = props;
|
|
27
27
|
const handleMetrika = useMetrika();
|
|
28
28
|
const { hostname } = useContext(LocationContext);
|
|
29
29
|
const { tld } = useContext(LocaleContext);
|
|
30
30
|
const href = setUrlTld(props.url, tld);
|
|
31
31
|
const defaultTextSize = theme === 'back' ? 'l' : 'm';
|
|
32
32
|
const onClick = () => {
|
|
33
|
-
handleMetrika({ metrikaGoals, pixelEvents
|
|
33
|
+
handleMetrika({ metrikaGoals, pixelEvents });
|
|
34
34
|
};
|
|
35
35
|
const getLinkByType = () => {
|
|
36
36
|
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,4 +1,3 @@
|
|
|
1
|
-
import { __rest } from "tslib";
|
|
2
1
|
import { useContext } from 'react';
|
|
3
2
|
import { MetrikaContext } from '../context/metrikaContext';
|
|
4
3
|
import { PixelEventType } from '../models';
|
|
@@ -10,8 +9,8 @@ function isButtonPixel(pixelEvents) {
|
|
|
10
9
|
return false;
|
|
11
10
|
}
|
|
12
11
|
export const useMetrika = () => {
|
|
13
|
-
const { metrika, pixel
|
|
14
|
-
return ({ metrikaGoals, pixelEvents
|
|
12
|
+
const { metrika, pixel } = useContext(MetrikaContext);
|
|
13
|
+
return ({ metrikaGoals, pixelEvents }) => {
|
|
15
14
|
if (metrika && metrikaGoals) {
|
|
16
15
|
if (isNewMetrikaFormat(metrikaGoals)) {
|
|
17
16
|
metrikaGoals.forEach(({ name, isCrossSite }) => metrika.reachGoal(isCrossSite ? 'cross-site' : 'main', name));
|
|
@@ -34,12 +33,5 @@ export const useMetrika = () => {
|
|
|
34
33
|
pixel.track(pixelEvents);
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
|
-
if (gaInline && gaEvents) {
|
|
38
|
-
const gaEventsArray = Array.isArray(gaEvents) ? gaEvents : [gaEvents];
|
|
39
|
-
gaEventsArray.forEach((_a) => {
|
|
40
|
-
var { eventName } = _a, rest = __rest(_a, ["eventName"]);
|
|
41
|
-
gaInline.event(eventName, rest);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
36
|
};
|
|
45
37
|
};
|
|
@@ -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
|
}
|