@gravity-ui/blog-constructor 5.16.1 → 6.0.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/README.md +5 -5
- package/build/cjs/blocks/Banner/Banner.js +7 -9
- package/build/cjs/blocks/CTA/CTA.js +7 -9
- package/build/cjs/blocks/Feed/Feed.js +5 -12
- package/build/cjs/blocks/Header/Header.js +10 -14
- package/build/cjs/blocks/Media/Media.js +1 -0
- package/build/cjs/blocks/Meta/Meta.js +11 -15
- package/build/cjs/blocks/Suggest/Suggest.js +8 -11
- package/build/cjs/components/FeedHeader/components/Controls/Controls.css +19 -5
- package/build/cjs/components/FeedHeader/components/Controls/Controls.js +22 -27
- package/build/cjs/components/FeedHeader/components/Controls/customRenders.js +1 -1
- package/build/cjs/components/FeedHeader/components/CustomSwitcher/CustomSwitcher.css +1 -1
- package/build/cjs/components/Paginator/Paginator.js +16 -19
- package/build/cjs/components/Paginator/components/NavigationButton.js +1 -1
- package/build/cjs/components/PostCard/PostCard.d.ts +3 -6
- package/build/cjs/components/PostCard/PostCard.js +2 -2
- package/build/cjs/components/PostInfo/PostInfo.d.ts +4 -10
- package/build/cjs/components/PostInfo/PostInfo.js +4 -4
- package/build/cjs/components/PostInfo/SuggestPostInfo.js +4 -1
- package/build/cjs/components/PostInfo/components/ReadingTime.js +1 -1
- package/build/cjs/components/PostInfo/components/Save.d.ts +4 -6
- package/build/cjs/components/PostInfo/components/Save.js +3 -6
- package/build/cjs/components/PostInfo/components/Sharing.d.ts +3 -5
- package/build/cjs/components/PostInfo/components/Sharing.js +4 -10
- package/build/cjs/components/Posts/Posts.js +3 -3
- package/build/cjs/components/PostsEmpty/PostsEmpty.js +2 -2
- package/build/cjs/components/PostsError/PostsError.js +3 -3
- package/build/cjs/components/PromptSignIn/PromptSignIn.js +2 -2
- package/build/cjs/components/Search/Search.js +1 -1
- package/build/cjs/constants.d.ts +2 -1
- package/build/cjs/constants.js +20 -19
- package/build/cjs/constructor/BlogConstructorProvider.js +1 -0
- package/build/cjs/containers/BlogPostPage/BlogPostPage.css +1 -1
- package/build/cjs/contexts/LocaleContext.js +2 -2
- package/build/cjs/counters/metrika.js +0 -3
- package/build/cjs/counters/utils.d.ts +1 -1
- package/build/cjs/counters/utils.js +7 -7
- package/build/cjs/i18n/index.d.ts +1 -3
- package/build/cjs/i18n/index.js +8 -10
- package/build/cjs/index.d.ts +0 -1
- package/build/cjs/index.js +1 -3
- package/build/cjs/models/common.d.ts +1 -1
- package/build/cjs/models/locale.d.ts +1 -4
- package/build/cjs/models/locale.js +1 -6
- package/build/cjs/utils/common.d.ts +15 -3
- package/build/cjs/utils/common.js +20 -19
- package/build/esm/blocks/Banner/Banner.js +8 -10
- package/build/esm/blocks/CTA/CTA.js +8 -10
- package/build/esm/blocks/Feed/Feed.js +8 -15
- package/build/esm/blocks/Header/Header.js +12 -16
- package/build/esm/blocks/Media/Media.js +1 -0
- package/build/esm/blocks/Meta/Meta.js +13 -17
- package/build/esm/blocks/Suggest/Suggest.js +9 -12
- package/build/esm/components/FeedHeader/components/Controls/Controls.css +19 -5
- package/build/esm/components/FeedHeader/components/Controls/Controls.js +25 -30
- package/build/esm/components/FeedHeader/components/Controls/customRenders.js +2 -2
- package/build/esm/components/FeedHeader/components/CustomSwitcher/CustomSwitcher.css +1 -1
- package/build/esm/components/Paginator/Paginator.js +18 -21
- package/build/esm/components/Paginator/components/NavigationButton.js +2 -2
- package/build/esm/components/PostCard/PostCard.d.ts +3 -6
- package/build/esm/components/PostCard/PostCard.js +2 -2
- package/build/esm/components/PostInfo/PostInfo.d.ts +4 -10
- package/build/esm/components/PostInfo/PostInfo.js +4 -4
- package/build/esm/components/PostInfo/SuggestPostInfo.js +4 -1
- package/build/esm/components/PostInfo/components/ReadingTime.js +2 -2
- package/build/esm/components/PostInfo/components/Save.d.ts +4 -6
- package/build/esm/components/PostInfo/components/Save.js +3 -6
- package/build/esm/components/PostInfo/components/Sharing.d.ts +3 -5
- package/build/esm/components/PostInfo/components/Sharing.js +5 -11
- package/build/esm/components/Posts/Posts.js +4 -4
- package/build/esm/components/PostsEmpty/PostsEmpty.js +3 -3
- package/build/esm/components/PostsError/PostsError.js +4 -4
- package/build/esm/components/PromptSignIn/PromptSignIn.js +3 -3
- package/build/esm/components/Search/Search.js +2 -2
- package/build/esm/constants.d.ts +2 -1
- package/build/esm/constants.js +19 -18
- package/build/esm/constructor/BlogConstructorProvider.js +2 -1
- package/build/esm/containers/BlogPostPage/BlogPostPage.css +1 -1
- package/build/esm/contexts/LocaleContext.js +1 -1
- package/build/esm/counters/metrika.js +0 -3
- package/build/esm/counters/utils.d.ts +1 -1
- package/build/esm/counters/utils.js +6 -6
- package/build/esm/i18n/index.d.ts +1 -3
- package/build/esm/i18n/index.js +7 -9
- package/build/esm/index.d.ts +0 -1
- package/build/esm/index.js +0 -1
- package/build/esm/models/common.d.ts +1 -1
- package/build/esm/models/locale.d.ts +1 -4
- package/build/esm/models/locale.js +0 -5
- package/build/esm/utils/common.d.ts +15 -3
- package/build/esm/utils/common.js +18 -17
- package/package.json +15 -14
- package/server/data/contentFilter.d.ts +1 -1
- package/server/data/contentFilter.js +2 -1
- package/server/data/transformPageContent.d.ts +2 -2
- package/server/data/transformPost.d.ts +7 -2
- package/server/data/transformPost.js +1 -1
- package/server/index.d.ts +1 -1
- package/server/models/common.d.ts +1 -1
- package/server/models/locale.d.ts +1 -4
- package/server/models/locale.js +1 -6
- package/styles/storybook/common.scss +8 -0
- package/styles/storybook/index.scss +1 -1
- package/styles/styles.css +115 -0
- package/styles/styles.scss +1 -0
- package/build/cjs/configure.d.ts +0 -5
- package/build/cjs/configure.js +0 -8
- package/build/esm/configure.d.ts +0 -5
- package/build/esm/configure.js +0 -4
package/README.md
CHANGED
|
@@ -60,14 +60,14 @@ import {
|
|
|
60
60
|
} from '@gravity-ui/blog-constructor/server';
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
To make sure the i18n library used in your project runs properly, perform its initialization and set the project's current locale value in `lang`. For example:
|
|
63
|
+
The `blog-constructor` is a `uikit-based` library, and we use an instance of `i18n` from uikit. To set up internationalization, you just need to use the `configure` from uikit:
|
|
66
64
|
|
|
67
65
|
```typescript
|
|
68
|
-
import {configure
|
|
66
|
+
import {configure} from '@gravity-ui/uikit';
|
|
69
67
|
|
|
70
|
-
configure({
|
|
68
|
+
configure({
|
|
69
|
+
lang: 'ru',
|
|
70
|
+
});
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
## Development
|
|
@@ -5,12 +5,17 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
|
7
7
|
const Wrapper_1 = require("../../components/Wrapper/Wrapper");
|
|
8
|
-
const constants_1 = require("../../constants");
|
|
9
8
|
const paddings_1 = require("../../models/paddings");
|
|
10
9
|
const cn_1 = require("../../utils/cn");
|
|
11
10
|
const common_1 = require("../../utils/common");
|
|
11
|
+
const constants_1 = require("../../constants");
|
|
12
|
+
const utils_1 = require("../../counters/utils");
|
|
12
13
|
const b = (0, cn_1.block)('banner');
|
|
13
14
|
const BANNER_CUSTOM_QA_ATTRIBUTES = ['image-container'];
|
|
15
|
+
const buttonGoals = (0, common_1.prepareAnalyticsEvent)({
|
|
16
|
+
name: constants_1.DefaultGoalIds.bannerCommon,
|
|
17
|
+
counter: utils_1.AnalyticsCounter.CrossSite,
|
|
18
|
+
});
|
|
14
19
|
const Banner = (_a) => {
|
|
15
20
|
var _b;
|
|
16
21
|
var { color, imageSize = 's', image, paddingTop, paddingBottom, qa } = _a, content = tslib_1.__rest(_a, ["color", "imageSize", "image", "paddingTop", "paddingBottom", "qa"]);
|
|
@@ -20,16 +25,9 @@ const Banner = (_a) => {
|
|
|
20
25
|
contentStyle.backgroundColor = color;
|
|
21
26
|
}
|
|
22
27
|
const contentData = (0, common_1.updateContentSizes)(content);
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
|
25
|
-
*/
|
|
26
|
-
const metrikaGoal = {
|
|
27
|
-
name: constants_1.BlogMetrikaGoalIds.bannerCommon,
|
|
28
|
-
isCrossSite: true,
|
|
29
|
-
};
|
|
30
28
|
(_b = contentData.buttons) === null || _b === void 0 ? void 0 : _b.forEach((button) => {
|
|
31
29
|
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
32
|
-
button.
|
|
30
|
+
button.analyticsEvents = (0, common_1.getMergedAnalyticsEvents)(buttonGoals, button.analyticsEvents);
|
|
33
31
|
});
|
|
34
32
|
return (react_1.default.createElement(Wrapper_1.Wrapper, { paddings: {
|
|
35
33
|
[paddings_1.PaddingsDirections.top]: paddingTop,
|
|
@@ -5,19 +5,17 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
|
7
7
|
const Wrapper_1 = require("../../components/Wrapper/Wrapper");
|
|
8
|
-
const constants_1 = require("../../constants");
|
|
9
8
|
const paddings_1 = require("../../models/paddings");
|
|
10
9
|
const cn_1 = require("../../utils/cn");
|
|
11
10
|
const common_1 = require("../../utils/common");
|
|
11
|
+
const constants_1 = require("../../constants");
|
|
12
|
+
const utils_1 = require("../../counters/utils");
|
|
12
13
|
const b = (0, cn_1.block)('cta');
|
|
14
|
+
const linkGoals = (0, common_1.prepareAnalyticsEvent)({
|
|
15
|
+
name: constants_1.DefaultGoalIds.cta,
|
|
16
|
+
counter: utils_1.AnalyticsCounter.CrossSite,
|
|
17
|
+
});
|
|
13
18
|
const CTA = ({ items, paddingTop, paddingBottom, qa }) => {
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
|
16
|
-
*/
|
|
17
|
-
const metrikaGoal = {
|
|
18
|
-
name: constants_1.BlogMetrikaGoalIds.cta,
|
|
19
|
-
isCrossSite: true,
|
|
20
|
-
};
|
|
21
19
|
const qaAttributes = (0, common_1.getQaAttributes)(qa, 'card');
|
|
22
20
|
return (react_1.default.createElement(Wrapper_1.Wrapper, { paddings: {
|
|
23
21
|
[paddings_1.PaddingsDirections.top]: paddingTop,
|
|
@@ -27,7 +25,7 @@ const CTA = ({ items, paddingTop, paddingBottom, qa }) => {
|
|
|
27
25
|
const contentData = (0, common_1.updateContentSizes)(content);
|
|
28
26
|
(_a = contentData.links) === null || _a === void 0 ? void 0 : _a.forEach((link) => {
|
|
29
27
|
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
30
|
-
link.
|
|
28
|
+
link.analyticsEvents = (0, common_1.getMergedAnalyticsEvents)(linkGoals, link.analyticsEvents);
|
|
31
29
|
});
|
|
32
30
|
return (react_1.default.createElement("div", { key: index, className: b('card'), "data-qa": qaAttributes.card },
|
|
33
31
|
react_1.default.createElement(page_constructor_1.Content, Object.assign({}, contentData, { qa: qaAttributes.content }))));
|
|
@@ -4,9 +4,6 @@ exports.Feed = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
|
9
|
-
*/
|
|
10
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
11
8
|
const FeedHeader_1 = require("../../components/FeedHeader/FeedHeader");
|
|
12
9
|
const Posts_1 = require("../../components/Posts/Posts");
|
|
@@ -14,10 +11,6 @@ const PostsError_1 = require("../../components/PostsError/PostsError");
|
|
|
14
11
|
const constants_1 = require("../../constants");
|
|
15
12
|
const FeedContext_1 = require("../../contexts/FeedContext");
|
|
16
13
|
const RouterContext_1 = require("../../contexts/RouterContext");
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
|
19
|
-
*/
|
|
20
|
-
const metrika_1 = tslib_1.__importDefault(require("../../counters/metrika"));
|
|
21
14
|
const utils_1 = require("../../counters/utils");
|
|
22
15
|
const common_1 = require("../../models/common");
|
|
23
16
|
const common_2 = require("../../utils/common");
|
|
@@ -31,6 +24,10 @@ const Feed = ({ image }) => {
|
|
|
31
24
|
const { posts, totalCount, tags, services, pinnedPost, getPosts, pageCountForShowSupportButtons, } = (0, react_1.useContext)(FeedContext_1.FeedContext);
|
|
32
25
|
const router = (0, react_1.useContext)(RouterContext_1.RouterContext);
|
|
33
26
|
const handleAnalytics = (0, page_constructor_1.useAnalytics)(common_1.DefaultEventNames.ShowMore);
|
|
27
|
+
const additionalAnalyticsEvent = (0, common_2.prepareAnalyticsEvent)({
|
|
28
|
+
name: constants_1.DefaultGoalIds.showMore,
|
|
29
|
+
counter: utils_1.AnalyticsCounter.CrossSite,
|
|
30
|
+
});
|
|
34
31
|
const [{ errorLoad, errorShowMore, isFetching, isShowMoreVisible, lastLoadedCount, postCountOnPage, postsOnPage, pinnedPostOnPage, currentPage, queryParams, }, dispatch,] = (0, react_1.useReducer)(reducer_1.reducer, {
|
|
35
32
|
errorLoad: false,
|
|
36
33
|
errorShowMore: false,
|
|
@@ -105,11 +102,7 @@ const Feed = ({ image }) => {
|
|
|
105
102
|
});
|
|
106
103
|
};
|
|
107
104
|
const handleShowMore = async () => {
|
|
108
|
-
|
|
109
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
|
110
|
-
*/
|
|
111
|
-
metrika_1.default.reachGoal(utils_1.MetrikaCounter.CrossSite, constants_1.BlogMetrikaGoalIds.showMore);
|
|
112
|
-
handleAnalytics();
|
|
105
|
+
handleAnalytics(additionalAnalyticsEvent);
|
|
113
106
|
const nextPage = currentPage + 1;
|
|
114
107
|
try {
|
|
115
108
|
setIsFetching(true);
|
|
@@ -12,19 +12,15 @@ const PostPageContext_1 = require("../../contexts/PostPageContext");
|
|
|
12
12
|
const paddings_1 = require("../../models/paddings");
|
|
13
13
|
const common_1 = require("../../utils/common");
|
|
14
14
|
const SettingsContext_1 = require("../../contexts/SettingsContext");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
sharing: constants_1.BlogMetrikaGoalIds.shareTop,
|
|
20
|
-
save: constants_1.BlogMetrikaGoalIds.saveTop,
|
|
15
|
+
const utils_1 = require("../../counters/utils");
|
|
16
|
+
const analyticsEventsContainer = {
|
|
17
|
+
sharing: (0, common_1.prepareAnalyticsEvent)({ name: constants_1.DefaultGoalIds.shareTop }),
|
|
18
|
+
save: (0, common_1.prepareAnalyticsEvent)({ name: constants_1.DefaultGoalIds.saveTop }),
|
|
21
19
|
};
|
|
22
|
-
const breadcrumbsGoals =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
];
|
|
20
|
+
const breadcrumbsGoals = (0, common_1.prepareAnalyticsEvent)({
|
|
21
|
+
name: constants_1.DefaultGoalIds.breadcrumbsTop,
|
|
22
|
+
counter: utils_1.AnalyticsCounter.CrossSite,
|
|
23
|
+
});
|
|
28
24
|
const Header = (props) => {
|
|
29
25
|
const { theme, paddingTop, paddingBottom } = props;
|
|
30
26
|
const { post } = (0, react_1.useContext)(PostPageContext_1.PostPageContext);
|
|
@@ -36,12 +32,12 @@ const Header = (props) => {
|
|
|
36
32
|
if (theme === 'dark' && breadcrumbs) {
|
|
37
33
|
breadcrumbs.theme = 'dark';
|
|
38
34
|
}
|
|
39
|
-
breadcrumbs.
|
|
35
|
+
breadcrumbs.analyticsEvents = breadcrumbsGoals;
|
|
40
36
|
return (react_1.default.createElement(Wrapper_1.Wrapper, { paddings: {
|
|
41
37
|
[paddings_1.PaddingsDirections.top]: paddingTop,
|
|
42
38
|
[paddings_1.PaddingsDirections.bottom]: paddingBottom,
|
|
43
39
|
} },
|
|
44
40
|
react_1.default.createElement(page_constructor_1.HeaderBlock, Object.assign({}, props, { title: title, description: description, breadcrumbs: breadcrumbs }),
|
|
45
|
-
react_1.default.createElement(PostInfo_1.PostInfo, { postId: id, date: date, readingTime: readingTime,
|
|
41
|
+
react_1.default.createElement(PostInfo_1.PostInfo, { postId: id, date: date, readingTime: readingTime, analyticsEventsContainer: analyticsEventsContainer, theme: theme, qa: "blog-header-meta-container" }))));
|
|
46
42
|
};
|
|
47
43
|
exports.Header = Header;
|
|
@@ -18,6 +18,7 @@ const Media = (_a) => {
|
|
|
18
18
|
react_1.default.createElement(page_constructor_1.Media, Object.assign({ className: b('content'), videoClassName: b('video'), imageClassName: b('image') }, mediaProps))),
|
|
19
19
|
text && (react_1.default.createElement("div", { className: b('text-content') },
|
|
20
20
|
react_1.default.createElement(page_constructor_1.YFMWrapper, { content: text, modifiers: {
|
|
21
|
+
blog: true,
|
|
21
22
|
blogMedia: true,
|
|
22
23
|
resetPaddings: true,
|
|
23
24
|
} })))));
|
|
@@ -13,20 +13,16 @@ const PostPageContext_1 = require("../../contexts/PostPageContext");
|
|
|
13
13
|
const paddings_1 = require("../../models/paddings");
|
|
14
14
|
const cn_1 = require("../../utils/cn");
|
|
15
15
|
const common_1 = require("../../utils/common");
|
|
16
|
+
const utils_1 = require("../../counters/utils");
|
|
16
17
|
const b = (0, cn_1.block)('meta');
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const metrikaGoals = {
|
|
21
|
-
sharing: constants_1.BlogMetrikaGoalIds.shareBottom,
|
|
22
|
-
save: constants_1.BlogMetrikaGoalIds.saveBottom,
|
|
18
|
+
const analyticsEventsContainer = {
|
|
19
|
+
sharing: (0, common_1.prepareAnalyticsEvent)({ name: constants_1.DefaultGoalIds.shareBottom }),
|
|
20
|
+
save: (0, common_1.prepareAnalyticsEvent)({ name: constants_1.DefaultGoalIds.saveBottom }),
|
|
23
21
|
};
|
|
24
|
-
const breadcrumbsGoals =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
];
|
|
22
|
+
const breadcrumbsGoals = (0, common_1.prepareAnalyticsEvent)({
|
|
23
|
+
name: constants_1.DefaultGoalIds.breadcrumbsBottom,
|
|
24
|
+
counter: utils_1.AnalyticsCounter.CrossSite,
|
|
25
|
+
});
|
|
30
26
|
const Meta = (props) => {
|
|
31
27
|
const { paddingTop = 'l', paddingBottom = 'l', theme = 'light', qa } = props;
|
|
32
28
|
const { post } = (0, react_1.useContext)(PostPageContext_1.PostPageContext);
|
|
@@ -36,16 +32,16 @@ const Meta = (props) => {
|
|
|
36
32
|
const blogPath = getBlogPath(locale.pathPrefix || '');
|
|
37
33
|
const { title, id, date, readingTime, tags } = post;
|
|
38
34
|
const breadcrumbs = (0, common_1.getBreadcrumbs)({ tags, blogPath });
|
|
39
|
-
breadcrumbs.
|
|
35
|
+
breadcrumbs.analyticsEvents = (0, common_1.getMergedAnalyticsEvents)(breadcrumbsGoals);
|
|
40
36
|
return (react_1.default.createElement(Wrapper_1.Wrapper, { paddings: {
|
|
41
37
|
[paddings_1.PaddingsDirections.top]: paddingTop,
|
|
42
38
|
[paddings_1.PaddingsDirections.bottom]: paddingBottom,
|
|
43
39
|
}, qa: qaAttributes.wrapper },
|
|
44
|
-
breadcrumbs && (react_1.default.createElement(page_constructor_1.HeaderBreadcrumbs, { items: breadcrumbs.items, className: b('breadcrumbs'), theme: theme
|
|
40
|
+
breadcrumbs && (react_1.default.createElement(page_constructor_1.HeaderBreadcrumbs, { items: breadcrumbs.items, className: b('breadcrumbs'), theme: theme })),
|
|
45
41
|
title && (react_1.default.createElement(page_constructor_1.YFMWrapper, { content: title, modifiers: {
|
|
46
42
|
blogBreadcrumbs: true,
|
|
47
43
|
resetPaddings: true,
|
|
48
44
|
} })),
|
|
49
|
-
post && (react_1.default.createElement(PostInfo_1.PostInfo, { postId: id, date: date, readingTime: readingTime,
|
|
45
|
+
post && (react_1.default.createElement(PostInfo_1.PostInfo, { postId: id, date: date, readingTime: readingTime, analyticsEventsContainer: analyticsEventsContainer, qa: qaAttributes.postInfo }))));
|
|
50
46
|
};
|
|
51
47
|
exports.Meta = Meta;
|
|
@@ -6,19 +6,16 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
|
6
6
|
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
|
7
7
|
const PostCard_1 = require("../../components/PostCard/PostCard");
|
|
8
8
|
const Wrapper_1 = require("../../components/Wrapper/Wrapper");
|
|
9
|
-
const constants_1 = require("../../constants");
|
|
10
9
|
const PostPageContext_1 = require("../../contexts/PostPageContext");
|
|
11
10
|
const i18n_1 = require("../../i18n");
|
|
12
11
|
const paddings_1 = require("../../models/paddings");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
];
|
|
12
|
+
const common_1 = require("../../utils/common");
|
|
13
|
+
const constants_1 = require("../../constants");
|
|
14
|
+
const utils_1 = require("../../counters/utils");
|
|
15
|
+
const suggestGoals = (0, common_1.prepareAnalyticsEvent)({
|
|
16
|
+
name: constants_1.DefaultGoalIds.suggest,
|
|
17
|
+
counter: utils_1.AnalyticsCounter.CrossSite,
|
|
18
|
+
});
|
|
22
19
|
/**
|
|
23
20
|
* Suggested posts block
|
|
24
21
|
*
|
|
@@ -37,6 +34,6 @@ const Suggest = ({ paddingTop = 'l', paddingBottom = 'l' }) => {
|
|
|
37
34
|
[paddings_1.PaddingsDirections.top]: paddingTop,
|
|
38
35
|
[paddings_1.PaddingsDirections.bottom]: paddingBottom,
|
|
39
36
|
} },
|
|
40
|
-
react_1.default.createElement(page_constructor_1.SliderBlock, { slidesToShow: { xl: 3, lg: 2, sm: 1 }, title: { text: (0, i18n_1.
|
|
37
|
+
react_1.default.createElement(page_constructor_1.SliderBlock, { slidesToShow: { xl: 3, lg: 2, sm: 1 }, title: { text: (0, i18n_1.i18n)(i18n_1.Keyset.TitleSuggest) }, lazyLoad: false }, suggestedPosts.map((post) => (react_1.default.createElement(PostCard_1.PostCard, { key: post.id, analyticsEvents: suggestGoals, post: post }))))));
|
|
41
38
|
};
|
|
42
39
|
exports.Suggest = Suggest;
|
|
@@ -36,10 +36,10 @@ unpredictable css rules order in build */
|
|
|
36
36
|
.bc-feed-controls__popup.bc-feed-controls__popup .g-select-list::-webkit-scrollbar {
|
|
37
37
|
display: none;
|
|
38
38
|
}
|
|
39
|
-
.bc-feed-controls__popup.bc-feed-controls__popup .g-select-list .
|
|
39
|
+
.bc-feed-controls__popup.bc-feed-controls__popup .g-select-list .g-list {
|
|
40
40
|
max-height: calc(500px - var(--g-text-body-3-line-height) - 12px);
|
|
41
41
|
}
|
|
42
|
-
.bc-feed-controls__popup.bc-feed-controls__popup .
|
|
42
|
+
.bc-feed-controls__popup.bc-feed-controls__popup .g-list__item {
|
|
43
43
|
margin: 4px;
|
|
44
44
|
border-radius: 8px;
|
|
45
45
|
}
|
|
@@ -48,12 +48,28 @@ unpredictable css rules order in build */
|
|
|
48
48
|
max-height: inherit;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
.bc-feed-controls__popup_isMobile .bc-feed-controls__popup-filter {
|
|
52
|
+
position: relative;
|
|
53
|
+
border: none;
|
|
54
|
+
}
|
|
55
|
+
.bc-feed-controls__popup_isMobile .bc-feed-controls__popup-filter::before {
|
|
56
|
+
content: "";
|
|
57
|
+
position: absolute;
|
|
58
|
+
left: 50%;
|
|
59
|
+
bottom: 0px;
|
|
60
|
+
border-bottom: 2px solid var(--g-color-line-generic);
|
|
61
|
+
border-bottom-right-radius: 0;
|
|
62
|
+
border-bottom-left-radius: 0;
|
|
63
|
+
width: 100vw;
|
|
64
|
+
height: 2px;
|
|
65
|
+
transform: translateX(-50%);
|
|
66
|
+
}
|
|
51
67
|
.bc-feed-controls__popup-filter {
|
|
52
68
|
font-size: var(--g-text-body-2-font-size);
|
|
53
69
|
line-height: var(--g-text-body-2-line-height);
|
|
54
70
|
padding: 4px 12px;
|
|
55
71
|
border: none;
|
|
56
|
-
border-bottom: 1px solid var(--
|
|
72
|
+
border-bottom: 1px solid var(--g-color-line-generic);
|
|
57
73
|
border-bottom-right-radius: 0;
|
|
58
74
|
border-bottom-left-radius: 0;
|
|
59
75
|
}
|
|
@@ -63,8 +79,6 @@ unpredictable css rules order in build */
|
|
|
63
79
|
.bc-feed-controls__saved-only-button_savedOnly.bc-feed-controls__saved-only-button_savedOnly {
|
|
64
80
|
--g-button-background-color: var(--pc-monochrome-button-background-color);
|
|
65
81
|
--g-button-background-color-hover: var(--pc-monochrome-button-background-color-hover);
|
|
66
|
-
--yc-button-background-color: var(--pc-monochrome-button-background-color);
|
|
67
|
-
--yc-button-background-color-hover: var(--pc-monochrome-button-background-color-hover);
|
|
68
82
|
}
|
|
69
83
|
.bc-feed-controls__saved-only-button_savedOnly.bc-feed-controls__saved-only-button_savedOnly, .bc-feed-controls__saved-only-button_savedOnly.bc-feed-controls__saved-only-button_savedOnly:link, .bc-feed-controls__saved-only-button_savedOnly.bc-feed-controls__saved-only-button_savedOnly:visited, .bc-feed-controls__saved-only-button_savedOnly.bc-feed-controls__saved-only-button_savedOnly:active, .bc-feed-controls__saved-only-button_savedOnly.bc-feed-controls__saved-only-button_savedOnly:focus {
|
|
70
84
|
color: var(--pc-monochrome-button-color);
|
|
@@ -5,19 +5,16 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
|
7
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
|
10
|
-
*/
|
|
11
8
|
const constants_1 = require("../../../../constants");
|
|
12
9
|
const LikesContext_1 = require("../../../../contexts/LikesContext");
|
|
13
10
|
const MobileContext_1 = require("../../../../contexts/MobileContext");
|
|
14
|
-
const metrika_1 = tslib_1.__importDefault(require("../../../../counters/metrika"));
|
|
15
11
|
const utils_1 = require("../../../../counters/utils");
|
|
16
12
|
const i18n_1 = require("../../../../i18n");
|
|
17
13
|
const Save_1 = require("../../../../icons/Save");
|
|
18
14
|
const common_1 = require("../../../../models/common");
|
|
19
15
|
const cn_1 = require("../../../../utils/cn");
|
|
20
16
|
const Search_1 = require("../../../Search/Search");
|
|
17
|
+
const common_2 = require("../../../../utils/common");
|
|
21
18
|
const customRenders_1 = require("./customRenders");
|
|
22
19
|
const b = (0, cn_1.block)('feed-controls');
|
|
23
20
|
const ICON_SIZE = 16;
|
|
@@ -54,13 +51,11 @@ const Controls = ({ handleLoadData, tags = [], services = [], queryParams, }) =>
|
|
|
54
51
|
});
|
|
55
52
|
};
|
|
56
53
|
const handleTagSelect = (selectedTags) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
metrika_1.default.reachGoal(utils_1.MetrikaCounter.CrossSite, constants_1.BlogMetrikaGoalIds.tag, {
|
|
61
|
-
theme: selectedTags[0],
|
|
54
|
+
const event = (0, common_2.prepareAnalyticsEvent)({
|
|
55
|
+
name: constants_1.DefaultGoalIds.tag,
|
|
56
|
+
counter: utils_1.AnalyticsCounter.CrossSite,
|
|
62
57
|
});
|
|
63
|
-
handleAnalyticsTag(
|
|
58
|
+
handleAnalyticsTag(event, {
|
|
64
59
|
theme: selectedTags[0],
|
|
65
60
|
});
|
|
66
61
|
const isEmptyTag = selectedTags.some((tag) => tag === 'empty');
|
|
@@ -73,18 +68,18 @@ const Controls = ({ handleLoadData, tags = [], services = [], queryParams, }) =>
|
|
|
73
68
|
});
|
|
74
69
|
};
|
|
75
70
|
const handleServicesSelect = (selectedServices) => {
|
|
76
|
-
const
|
|
71
|
+
const forAnalyticsServices = services.filter((service) => {
|
|
77
72
|
return selectedServices.includes(service.value);
|
|
78
73
|
});
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
74
|
+
const servicesAsStringForAnalytics = forAnalyticsServices
|
|
75
|
+
.map((service) => service.content)
|
|
76
|
+
.join(',');
|
|
77
|
+
const event = (0, common_2.prepareAnalyticsEvent)({
|
|
78
|
+
name: constants_1.DefaultGoalIds.service,
|
|
79
|
+
counter: utils_1.AnalyticsCounter.CrossSite,
|
|
85
80
|
});
|
|
86
|
-
handleAnalyticsService(
|
|
87
|
-
service:
|
|
81
|
+
handleAnalyticsService(event, {
|
|
82
|
+
service: servicesAsStringForAnalytics,
|
|
88
83
|
});
|
|
89
84
|
const servicesAsString = selectedServices.join(',');
|
|
90
85
|
handleLoadData({
|
|
@@ -92,28 +87,28 @@ const Controls = ({ handleLoadData, tags = [], services = [], queryParams, }) =>
|
|
|
92
87
|
query: { services: servicesAsString, page: DEFAULT_PAGE },
|
|
93
88
|
});
|
|
94
89
|
};
|
|
95
|
-
const tagsItems = (0, react_1.useMemo)(() => [{ value: 'empty', content: (0, i18n_1.
|
|
90
|
+
const tagsItems = (0, react_1.useMemo)(() => [{ value: 'empty', content: (0, i18n_1.i18n)(i18n_1.Keyset.AllTags) }, ...tags], [tags]);
|
|
96
91
|
const servicesItems = (0, react_1.useMemo)(() => (servicesInitial ? [...servicesInitial.split(',')] : []), [servicesInitial]);
|
|
97
92
|
return (react_1.default.createElement("div", { className: b('header') },
|
|
98
|
-
react_1.default.createElement("h1", { className: b('header-item', { title: true }) }, (0, i18n_1.
|
|
93
|
+
react_1.default.createElement("h1", { className: b('header-item', { title: true }) }, (0, i18n_1.i18n)(i18n_1.Keyset.Title)),
|
|
99
94
|
react_1.default.createElement("div", { className: b('header-item', { filters: true }) },
|
|
100
95
|
react_1.default.createElement("div", { className: b('filter-item') },
|
|
101
|
-
react_1.default.createElement(Search_1.Search, { className: b('search'), placeholder: (0, i18n_1.
|
|
96
|
+
react_1.default.createElement(Search_1.Search, { className: b('search'), placeholder: (0, i18n_1.i18n)(i18n_1.Keyset.Search), initialValue: search && typeof search === 'string' ? search : '', onSubmit: handleSearch })),
|
|
102
97
|
react_1.default.createElement("div", { className: b('filter-item') },
|
|
103
|
-
react_1.default.createElement(uikit_1.Select, { className: b('select'), size: "xl", options: tagsItems, defaultValue: [tagInitial], onUpdate: handleTagSelect, placeholder: (0, i18n_1.
|
|
98
|
+
react_1.default.createElement(uikit_1.Select, { className: b('select'), size: "xl", options: tagsItems, defaultValue: [tagInitial], onUpdate: handleTagSelect, placeholder: (0, i18n_1.i18n)(i18n_1.Keyset.AllTags), popupClassName: b('popup', { isMobile }), renderControl: (0, customRenders_1.renderSwitcher)({
|
|
104
99
|
initial: [tagInitial],
|
|
105
100
|
list: tagsItems,
|
|
106
|
-
defaultLabel: (0, i18n_1.
|
|
101
|
+
defaultLabel: (0, i18n_1.i18n)(i18n_1.Keyset.AllTags),
|
|
107
102
|
}), disablePortal: true, virtualizationThreshold: VIRTUALIZATION_THRESHOLD, renderOption: customRenders_1.renderOption })),
|
|
108
103
|
services.length > 0 ? (react_1.default.createElement("div", { className: b('filter-item') },
|
|
109
|
-
react_1.default.createElement(uikit_1.Select, { className: b('select'), size: "xl", multiple: true, filterable: true, hasClear: true, disablePortal: true, options: services, defaultValue: servicesItems, popupClassName: b('popup', { isMobile }), onUpdate: handleServicesSelect, placeholder: (0, i18n_1.
|
|
104
|
+
react_1.default.createElement(uikit_1.Select, { className: b('select'), size: "xl", multiple: true, filterable: true, hasClear: true, disablePortal: true, options: services, defaultValue: servicesItems, popupClassName: b('popup', { isMobile }), onUpdate: handleServicesSelect, placeholder: (0, i18n_1.i18n)(i18n_1.Keyset.AllServices), renderControl: (0, customRenders_1.renderSwitcher)({
|
|
110
105
|
initial: servicesItems,
|
|
111
106
|
list: services,
|
|
112
|
-
defaultLabel: (0, i18n_1.
|
|
107
|
+
defaultLabel: (0, i18n_1.i18n)(i18n_1.Keyset.AllServices),
|
|
113
108
|
}), virtualizationThreshold: VIRTUALIZATION_THRESHOLD, renderOption: customRenders_1.renderOption, renderFilter: customRenders_1.renderFilter }))) : null,
|
|
114
109
|
hasLikes ? (react_1.default.createElement("div", { className: b('filter-item', { 'width-auto': true }) },
|
|
115
110
|
react_1.default.createElement(uikit_1.Button, { view: 'outlined', className: b('saved-only-button', { savedOnly }), size: "xl", onClick: handleSavedOnly },
|
|
116
111
|
react_1.default.createElement(uikit_1.Icon, { data: Save_1.Save, size: ICON_SIZE, className: b('icon', { savedOnly }) }),
|
|
117
|
-
(0, i18n_1.
|
|
112
|
+
(0, i18n_1.i18n)(i18n_1.Keyset.ActionSavedOnly)))) : null)));
|
|
118
113
|
};
|
|
119
114
|
exports.Controls = Controls;
|
|
@@ -13,7 +13,7 @@ const renderSwitcher = ({ initial, list, defaultLabel }) =>
|
|
|
13
13
|
// eslint-disable-next-line react/display-name
|
|
14
14
|
({ onClick, ref, onKeyDown, open, renderClear }) => (react_1.default.createElement(CustomSwitcher_1.CustomSwitcher, { initial: initial, defaultLabel: defaultLabel, list: list, controlRef: ref, onClick: onClick, onKeyDown: onKeyDown, renderClear: renderClear, open: open }));
|
|
15
15
|
exports.renderSwitcher = renderSwitcher;
|
|
16
|
-
const renderFilter = ({ value, onChange, onKeyDown }) => (react_1.default.createElement(uikit_1.TextInput, { controlProps: { size: 1 }, value: value, view: "clear", placeholder: (0, i18n_1.
|
|
16
|
+
const renderFilter = ({ value, onChange, onKeyDown }) => (react_1.default.createElement(uikit_1.TextInput, { controlProps: { size: 1 }, value: value, view: "clear", placeholder: (0, i18n_1.i18n)(i18n_1.Keyset.Search), onUpdate: onChange, onKeyDown: onKeyDown, className: b('popup-filter') }));
|
|
17
17
|
exports.renderFilter = renderFilter;
|
|
18
18
|
const renderOption = (option) => (react_1.default.createElement(CustomSelectOption_1.CustomSelectOption, { data: option }));
|
|
19
19
|
exports.renderOption = renderOption;
|
|
@@ -24,7 +24,7 @@ unpredictable css rules order in build */
|
|
|
24
24
|
.bc-feed-custom-switcher__custom-switcher:focus:not(:focus-visible) {
|
|
25
25
|
outline: 0;
|
|
26
26
|
}
|
|
27
|
-
.bc-feed-custom-switcher__custom-switcher + .
|
|
27
|
+
.bc-feed-custom-switcher__custom-switcher + .g-popup.g-popup_open {
|
|
28
28
|
position: absolute !important;
|
|
29
29
|
inset: auto !important;
|
|
30
30
|
transform: translate3d(0, 4px, 0) !important;
|
|
@@ -5,10 +5,6 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
|
7
7
|
const constants_1 = require("../../constants");
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
|
10
|
-
*/
|
|
11
|
-
const metrika_1 = tslib_1.__importDefault(require("../../counters/metrika"));
|
|
12
8
|
const utils_1 = require("../../counters/utils");
|
|
13
9
|
const common_1 = require("../../models/common");
|
|
14
10
|
const cn_1 = require("../../utils/cn");
|
|
@@ -16,6 +12,7 @@ const NavigationButton_1 = require("./components/NavigationButton");
|
|
|
16
12
|
const PaginatorItem_1 = require("./components/PaginatorItem");
|
|
17
13
|
const types_1 = require("./types");
|
|
18
14
|
const utils_2 = require("./utils");
|
|
15
|
+
const common_2 = require("../../utils/common");
|
|
19
16
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
20
17
|
const b = (0, cn_1.block)('paginator');
|
|
21
18
|
const DEFAULT_PAGE_COUNT_FOR_SHOW_SUPPORT_BUTTONS = 6;
|
|
@@ -39,19 +36,19 @@ const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className, onPage
|
|
|
39
36
|
const handleArrowClick = (type) => {
|
|
40
37
|
let newPage = page;
|
|
41
38
|
if (type === 'prev' && page > 1) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
handleAnalyticsHome();
|
|
39
|
+
const event = (0, common_2.prepareAnalyticsEvent)({
|
|
40
|
+
name: constants_1.DefaultGoalIds.home,
|
|
41
|
+
counter: utils_1.AnalyticsCounter.CrossSite,
|
|
42
|
+
});
|
|
43
|
+
handleAnalyticsHome(event);
|
|
47
44
|
newPage = 1;
|
|
48
45
|
}
|
|
49
46
|
else if (type === 'next' && page < pagesCount) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
const event = (0, common_2.prepareAnalyticsEvent)({
|
|
48
|
+
name: constants_1.DefaultGoalIds.next,
|
|
49
|
+
counter: utils_1.AnalyticsCounter.CrossSite,
|
|
50
|
+
});
|
|
51
|
+
handleAnalyticsNext(event);
|
|
55
52
|
newPage = page + 1;
|
|
56
53
|
}
|
|
57
54
|
if (newPage !== page) {
|
|
@@ -60,11 +57,11 @@ const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className, onPage
|
|
|
60
57
|
};
|
|
61
58
|
const handlePageClick = (index) => {
|
|
62
59
|
if (index !== page && typeof index === 'number') {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
handleAnalyticsPage(
|
|
60
|
+
const event = (0, common_2.prepareAnalyticsEvent)({
|
|
61
|
+
name: constants_1.DefaultGoalIds.page,
|
|
62
|
+
counter: utils_1.AnalyticsCounter.CrossSite,
|
|
63
|
+
});
|
|
64
|
+
handleAnalyticsPage(event, { page: String(index) });
|
|
68
65
|
handlePageChange(index);
|
|
69
66
|
}
|
|
70
67
|
};
|
|
@@ -7,5 +7,5 @@ const i18n_1 = require("../../../i18n");
|
|
|
7
7
|
const cn_1 = require("../../../utils/cn");
|
|
8
8
|
const types_1 = require("../types");
|
|
9
9
|
const b = (0, cn_1.block)('paginator');
|
|
10
|
-
const NavigationButton = ({ arrowType, disabled }) => disabled ? null : (react_1.default.createElement("div", { className: b('icon') }, arrowType === types_1.ArrowType.Prev ? (0, i18n_1.
|
|
10
|
+
const NavigationButton = ({ arrowType, disabled }) => disabled ? null : (react_1.default.createElement("div", { className: b('icon') }, arrowType === types_1.ArrowType.Prev ? (0, i18n_1.i18n)(i18n_1.Keyset.ButtonBegin) : (0, i18n_1.i18n)(i18n_1.Keyset.ButtonFarther)));
|
|
11
11
|
exports.NavigationButton = NavigationButton;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AnalyticsEventsProp } from '@gravity-ui/page-constructor';
|
|
3
3
|
import { PostCardSize, PostCardTitleHeadingLevel, PostData } from '../../models/common';
|
|
4
4
|
type PostCardProps = {
|
|
5
5
|
post: PostData;
|
|
@@ -7,10 +7,7 @@ type PostCardProps = {
|
|
|
7
7
|
showTag?: boolean;
|
|
8
8
|
size?: PostCardSize;
|
|
9
9
|
titleHeadingLevel?: PostCardTitleHeadingLevel;
|
|
10
|
-
|
|
11
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
|
12
|
-
*/
|
|
13
|
-
metrikaGoals?: MetrikaGoal;
|
|
10
|
+
analyticsEvents?: AnalyticsEventsProp;
|
|
14
11
|
};
|
|
15
|
-
export declare const PostCard: ({ post,
|
|
12
|
+
export declare const PostCard: ({ post, fullWidth, size, showTag, titleHeadingLevel, analyticsEvents, }: PostCardProps) => React.JSX.Element;
|
|
16
13
|
export {};
|
|
@@ -11,7 +11,7 @@ const cn_1 = require("../../utils/cn");
|
|
|
11
11
|
const SuggestPostInfo_1 = require("../PostInfo/SuggestPostInfo");
|
|
12
12
|
const useAriaAttributes_1 = require("../../hooks/useAriaAttributes");
|
|
13
13
|
const b = (0, cn_1.block)('post-card');
|
|
14
|
-
const PostCard = ({ post,
|
|
14
|
+
const PostCard = ({ post, fullWidth = false, size = common_1.PostCardSize.SMALL, showTag = false, titleHeadingLevel = common_1.PostCardTitleHeadingLevel.H3, analyticsEvents, }) => {
|
|
15
15
|
var _a;
|
|
16
16
|
const { title: postTitle, htmlTitle, textTitle, blogPostId, id, date, readingTime, hasUserLike, likes, image, description, tags, url, } = post;
|
|
17
17
|
const title = postTitle || textTitle || htmlTitle;
|
|
@@ -37,7 +37,7 @@ const PostCard = ({ post, metrikaGoals, fullWidth = false, size = common_1.PostC
|
|
|
37
37
|
readingTime && readingTimeId,
|
|
38
38
|
],
|
|
39
39
|
});
|
|
40
|
-
return (react_1.default.createElement(page_constructor_1.CardBase, { url: url,
|
|
40
|
+
return (react_1.default.createElement(page_constructor_1.CardBase, { url: url, analyticsEvents: analyticsEvents, className: b('card', { fullWidth }), extraProps: ariaAttributes },
|
|
41
41
|
react_1.default.createElement(page_constructor_1.CardBase.Header, { image: image, className: b('header', { fullWidth }) },
|
|
42
42
|
react_1.default.createElement("div", { className: b('image-container'), "data-qa": "blog-suggest-header" })),
|
|
43
43
|
react_1.default.createElement(page_constructor_1.CardBase.Content, null,
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { AnalyticsEventsProp } from '@gravity-ui/page-constructor';
|
|
2
3
|
import { PostData, QAProps } from '../../models/common';
|
|
3
|
-
export type BlogMetrikaGoals = {
|
|
4
|
-
sharing?: string;
|
|
5
|
-
save?: string;
|
|
6
|
-
};
|
|
7
4
|
type PostInfoProps = QAProps & {
|
|
8
5
|
postId: PostData['id'];
|
|
9
6
|
readingTime: PostData['readingTime'];
|
|
10
7
|
date: PostData['date'];
|
|
11
8
|
theme?: 'light' | 'dark';
|
|
12
|
-
|
|
13
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
|
14
|
-
*/
|
|
15
|
-
metrikaGoals?: BlogMetrikaGoals;
|
|
9
|
+
analyticsEventsContainer?: Record<string, AnalyticsEventsProp>;
|
|
16
10
|
};
|
|
17
11
|
/**
|
|
18
12
|
* Blog post info panel component
|
|
@@ -21,10 +15,10 @@ type PostInfoProps = QAProps & {
|
|
|
21
15
|
* @param readingTime - post reading time
|
|
22
16
|
* @param date - post create date
|
|
23
17
|
* @param theme - theme name
|
|
24
|
-
* @param metrikaGoals - metrika goals name
|
|
25
18
|
* @param qa - test-attr
|
|
19
|
+
* @param analyticsEventsContainer - a map of records with a single or collection of objects detailing analytics events
|
|
26
20
|
*
|
|
27
21
|
* @returns jsx
|
|
28
22
|
*/
|
|
29
|
-
export declare const PostInfo: ({ date, readingTime, postId, theme,
|
|
23
|
+
export declare const PostInfo: ({ date, readingTime, postId, theme, qa, analyticsEventsContainer, }: PostInfoProps) => React.JSX.Element;
|
|
30
24
|
export {};
|
|
@@ -18,18 +18,18 @@ const b = (0, cn_1.block)('post-info');
|
|
|
18
18
|
* @param readingTime - post reading time
|
|
19
19
|
* @param date - post create date
|
|
20
20
|
* @param theme - theme name
|
|
21
|
-
* @param metrikaGoals - metrika goals name
|
|
22
21
|
* @param qa - test-attr
|
|
22
|
+
* @param analyticsEventsContainer - a map of records with a single or collection of objects detailing analytics events
|
|
23
23
|
*
|
|
24
24
|
* @returns jsx
|
|
25
25
|
*/
|
|
26
|
-
const PostInfo = ({ date, readingTime, postId, theme = 'light',
|
|
26
|
+
const PostInfo = ({ date, readingTime, postId, theme = 'light', qa, analyticsEventsContainer, }) => {
|
|
27
27
|
const { likes } = (0, react_1.useContext)(PostPageContext_1.PostPageContext);
|
|
28
28
|
const qaAttributes = (0, common_1.getQaAttributes)(qa, 'date', 'reading-time', 'save');
|
|
29
29
|
return (react_1.default.createElement("div", { className: b('container', { theme }) },
|
|
30
30
|
date && react_1.default.createElement(Date_1.Date, { date: date, qa: qaAttributes.date }),
|
|
31
31
|
readingTime && react_1.default.createElement(ReadingTime_1.ReadingTime, { readingTime: readingTime, qa: qaAttributes.readingTime }),
|
|
32
|
-
react_1.default.createElement(Sharing_1.Sharing, {
|
|
33
|
-
likes && (react_1.default.createElement(Save_1.Save, { postId: postId, title: likes.likesCount, hasUserLike: likes.hasUserLike, handleUserLike: likes.handleUserLike,
|
|
32
|
+
react_1.default.createElement(Sharing_1.Sharing, { theme: theme, analyticsEvents: analyticsEventsContainer === null || analyticsEventsContainer === void 0 ? void 0 : analyticsEventsContainer.sharing }),
|
|
33
|
+
likes && (react_1.default.createElement(Save_1.Save, { postId: postId, title: likes.likesCount, hasUserLike: likes.hasUserLike, handleUserLike: likes.handleUserLike, analyticsEvents: analyticsEventsContainer === null || analyticsEventsContainer === void 0 ? void 0 : analyticsEventsContainer.save, theme: theme, qa: qaAttributes.save }))));
|
|
34
34
|
};
|
|
35
35
|
exports.PostInfo = PostInfo;
|