@gravity-ui/blog-constructor 2.1.2-alpha.0 → 2.1.2-alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- package/build/cjs/blocks/Banner/Banner.js +4 -0
- package/build/cjs/blocks/CTA/CTA.js +4 -0
- package/build/cjs/blocks/Feed/Feed.js +16 -0
- package/build/cjs/blocks/Header/Header.js +4 -0
- package/build/cjs/blocks/Meta/Meta.js +4 -0
- package/build/cjs/blocks/Suggest/Suggest.js +4 -0
- package/build/cjs/components/FeedHeader/components/Controls/Controls.js +24 -0
- package/build/cjs/components/Paginator/Paginator.js +24 -0
- package/build/cjs/components/PostCard/PostCard.d.ts +4 -0
- package/build/cjs/components/PostInfo/PostInfo.d.ts +4 -0
- package/build/cjs/components/PostInfo/components/Save.d.ts +4 -0
- package/build/cjs/components/PostInfo/components/Sharing.d.ts +4 -0
- package/build/cjs/counters/metrika.d.ts +4 -0
- package/build/cjs/counters/metrika.js +4 -0
- package/build/cjs/models/common.d.ts +8 -1
- package/build/cjs/models/common.js +7 -0
- package/build/esm/blocks/Banner/Banner.js +4 -0
- package/build/esm/blocks/CTA/CTA.js +4 -0
- package/build/esm/blocks/Feed/Feed.js +16 -0
- package/build/esm/blocks/Header/Header.js +4 -0
- package/build/esm/blocks/Meta/Meta.js +4 -0
- package/build/esm/blocks/Suggest/Suggest.js +4 -0
- package/build/esm/components/FeedHeader/components/Controls/Controls.js +24 -0
- package/build/esm/components/Paginator/Paginator.js +24 -0
- package/build/esm/components/PostCard/PostCard.d.ts +4 -0
- package/build/esm/components/PostInfo/PostInfo.d.ts +4 -0
- package/build/esm/components/PostInfo/components/Save.d.ts +4 -0
- package/build/esm/components/PostInfo/components/Sharing.d.ts +4 -0
- package/build/esm/counters/metrika.d.ts +4 -0
- package/build/esm/counters/metrika.js +4 -0
- package/build/esm/models/common.d.ts +8 -1
- package/build/esm/models/common.js +7 -0
- package/package.json +2 -2
- package/server/models/common.d.ts +8 -1
- package/server/models/common.js +7 -0
@@ -31,6 +31,10 @@ const Banner = (_a) => {
|
|
31
31
|
contentStyle.backgroundColor = color;
|
32
32
|
}
|
33
33
|
const contentData = (0, common_1.updateContentSizes)(content);
|
34
|
+
/**
|
35
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
36
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
37
|
+
*/
|
34
38
|
const metrikaGoal = {
|
35
39
|
name: constants_1.BlogMetrikaGoalIds.bannerCommon,
|
36
40
|
isCrossSite: true,
|
@@ -21,6 +21,10 @@ const CTA = ({ items, paddingTop, paddingBottom }) => {
|
|
21
21
|
else if (count > MAX_COLUMN_COUNT) {
|
22
22
|
count = MAX_COLUMN_COUNT;
|
23
23
|
}
|
24
|
+
/**
|
25
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
26
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
27
|
+
*/
|
24
28
|
const metrikaGoal = {
|
25
29
|
name: constants_1.BlogMetrikaGoalIds.cta,
|
26
30
|
isCrossSite: true,
|
@@ -29,17 +29,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.Feed = void 0;
|
30
30
|
const react_1 = __importStar(require("react"));
|
31
31
|
const uikit_1 = require("@gravity-ui/uikit");
|
32
|
+
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
32
33
|
const FeedContext_1 = require("../../contexts/FeedContext");
|
33
34
|
const RouterContext_1 = require("../../contexts/RouterContext");
|
34
35
|
const LocaleContext_1 = require("../../contexts/LocaleContext");
|
35
36
|
const constants_1 = require("../constants");
|
37
|
+
/**
|
38
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
39
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
40
|
+
*/
|
36
41
|
const constants_2 = require("../../constants");
|
37
42
|
const common_1 = require("../../utils/common");
|
38
43
|
const FeedHeader_1 = require("../../components/FeedHeader/FeedHeader");
|
39
44
|
const PostsError_1 = require("../../components/PostsError/PostsError");
|
40
45
|
const Posts_1 = require("../../components/Posts/Posts");
|
46
|
+
/**
|
47
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
48
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
49
|
+
*/
|
41
50
|
const metrika_js_1 = __importDefault(require("../../counters/metrika.js"));
|
42
51
|
const utils_1 = require("../../counters/utils");
|
52
|
+
const common_2 = require("../../models/common");
|
43
53
|
const reducer_1 = require("./reducer");
|
44
54
|
const CONTAINER_ID = 'blog-cards';
|
45
55
|
const PAGE_QUERY = 'page';
|
@@ -49,6 +59,7 @@ const Feed = ({ image }) => {
|
|
49
59
|
const { posts, totalCount, tags, services, pinnedPost, getPosts, pageCountForShowSupportButtons, } = (0, react_1.useContext)(FeedContext_1.FeedContext);
|
50
60
|
const router = (0, react_1.useContext)(RouterContext_1.RouterContext);
|
51
61
|
const { locale } = (0, react_1.useContext)(LocaleContext_1.LocaleContext);
|
62
|
+
const handleAnalytics = (0, page_constructor_1.useAnalytics)(common_2.DefaultEventNames.ShowMore);
|
52
63
|
const [{ errorLoad, errorShowMore, isFetching, isShowMoreFetching, isShowMoreVisible, lastLoadedCount, postCountOnPage, postsOnPage, pinnedPostOnPage, currentPage, queryParams, }, dispatch,] = (0, react_1.useReducer)(reducer_1.reducer, {
|
53
64
|
errorLoad: false,
|
54
65
|
errorShowMore: false,
|
@@ -112,7 +123,12 @@ const Feed = ({ image }) => {
|
|
112
123
|
}, [fetchData]);
|
113
124
|
const handleShowMore = async () => {
|
114
125
|
dispatch({ type: reducer_1.ActionTypes.SetIsShowMoreFetching, payload: true });
|
126
|
+
/**
|
127
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
128
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
129
|
+
*/
|
115
130
|
metrika_js_1.default.reachGoal(utils_1.MetrikaCounter.CrossSite, constants_2.BlogMetrikaGoalIds.showMore);
|
131
|
+
handleAnalytics();
|
116
132
|
try {
|
117
133
|
const fetchedData = await fetchData(currentPage + 1);
|
118
134
|
handleChangeQueryParams({
|
@@ -33,6 +33,10 @@ const Wrapper_1 = require("../../components/Wrapper/Wrapper");
|
|
33
33
|
const paddings_1 = require("../../models/paddings");
|
34
34
|
const common_1 = require("../../utils/common");
|
35
35
|
const constants_1 = require("../../constants");
|
36
|
+
/**
|
37
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
38
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
39
|
+
*/
|
36
40
|
const metrikaGoals = {
|
37
41
|
sharing: constants_1.BlogMetrikaGoalIds.shareTop,
|
38
42
|
save: constants_1.BlogMetrikaGoalIds.saveTop,
|
@@ -35,6 +35,10 @@ const common_1 = require("../../utils/common");
|
|
35
35
|
const constants_1 = require("../../constants");
|
36
36
|
const cn_1 = require("../../utils/cn");
|
37
37
|
const b = (0, cn_1.block)('meta');
|
38
|
+
/**
|
39
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
40
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
41
|
+
*/
|
38
42
|
const metrikaGoals = {
|
39
43
|
sharing: constants_1.BlogMetrikaGoalIds.shareBottom,
|
40
44
|
save: constants_1.BlogMetrikaGoalIds.saveBottom,
|
@@ -32,6 +32,10 @@ const PostCard_1 = require("../../components/PostCard/PostCard");
|
|
32
32
|
const paddings_1 = require("../../models/paddings");
|
33
33
|
const PostPageContext_1 = require("../../contexts/PostPageContext");
|
34
34
|
const constants_1 = require("../../constants");
|
35
|
+
/**
|
36
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
37
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
38
|
+
*/
|
35
39
|
const metrikaGoals = [
|
36
40
|
{
|
37
41
|
name: constants_1.BlogMetrikaGoalIds.suggest,
|
@@ -28,27 +28,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
29
|
exports.Controls = void 0;
|
30
30
|
const react_1 = __importStar(require("react"));
|
31
|
+
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
31
32
|
const uikit_1 = require("@gravity-ui/uikit");
|
32
33
|
const Search_1 = require("../../../Search/Search");
|
33
34
|
const customRenders_1 = require("./customRenders");
|
34
35
|
const LikesContext_1 = require("../../../../contexts/LikesContext");
|
36
|
+
/**
|
37
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
38
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
39
|
+
*/
|
35
40
|
const constants_1 = require("../../../../constants");
|
36
41
|
const metrika_js_1 = __importDefault(require("../../../../counters/metrika.js"));
|
37
42
|
const utils_1 = require("../../../../counters/utils");
|
38
43
|
const Save_1 = require("../../../../icons/Save");
|
39
44
|
const i18n_1 = require("../../../../i18n");
|
40
45
|
const cn_1 = require("../../../../utils/cn");
|
46
|
+
const common_1 = require("../../../../models/common");
|
41
47
|
const b = (0, cn_1.block)('feed-controls');
|
42
48
|
const ICON_SIZE = 16;
|
43
49
|
const DEFAULT_PAGE = 1;
|
44
50
|
const VIRTUALIZATION_THRESHOLD = 1000;
|
45
51
|
const Controls = ({ setIsFetching, tags = [], services = [], handleChangeQuery, queryParams, }) => {
|
46
52
|
const { hasLikes } = (0, react_1.useContext)(LikesContext_1.LikesContext);
|
53
|
+
const handleAnalyticsTag = (0, page_constructor_1.useAnalytics)(common_1.DefaultEventNames.Tag);
|
54
|
+
const handleAnalyticsService = (0, page_constructor_1.useAnalytics)(common_1.DefaultEventNames.Service);
|
55
|
+
const handleAnalyticsSaveOnly = (0, page_constructor_1.useAnalytics)(common_1.DefaultEventNames.SaveOnly);
|
47
56
|
const { savedOnly: savedOnlyInitial, search: searchInitial, tags: tagInitial, services: servicesInitial, } = queryParams || {};
|
48
57
|
const [savedOnly, setSavedOnly] = (0, react_1.useState)(savedOnlyInitial === 'true');
|
49
58
|
const [search, setSearch] = (0, react_1.useState)(searchInitial);
|
50
59
|
const handleSavedOnly = () => {
|
51
60
|
handleChangeQuery({ savedOnly: savedOnly ? '' : 'true' });
|
61
|
+
handleAnalyticsSaveOnly();
|
52
62
|
setSavedOnly(!savedOnly);
|
53
63
|
setIsFetching(true);
|
54
64
|
};
|
@@ -58,9 +68,16 @@ const Controls = ({ setIsFetching, tags = [], services = [], handleChangeQuery,
|
|
58
68
|
setIsFetching(true);
|
59
69
|
};
|
60
70
|
const handleTagSelect = (selectedTags) => {
|
71
|
+
/**
|
72
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
73
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
74
|
+
*/
|
61
75
|
metrika_js_1.default.reachGoal(utils_1.MetrikaCounter.CrossSite, constants_1.BlogMetrikaGoalIds.tag, {
|
62
76
|
theme: selectedTags[0],
|
63
77
|
});
|
78
|
+
handleAnalyticsTag(null, {
|
79
|
+
theme: selectedTags[0],
|
80
|
+
});
|
64
81
|
const isEmptyTag = selectedTags.some((tag) => tag === 'empty');
|
65
82
|
handleChangeQuery({
|
66
83
|
tags: isEmptyTag ? '' : selectedTags[0],
|
@@ -73,9 +90,16 @@ const Controls = ({ setIsFetching, tags = [], services = [], handleChangeQuery,
|
|
73
90
|
return selectedServices.includes(service.value);
|
74
91
|
});
|
75
92
|
const metrikaAsString = forMetrikaServices.map((service) => service.content).join(',');
|
93
|
+
/**
|
94
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
95
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
96
|
+
*/
|
76
97
|
metrika_js_1.default.reachGoal(utils_1.MetrikaCounter.CrossSite, constants_1.BlogMetrikaGoalIds.service, {
|
77
98
|
service: metrikaAsString,
|
78
99
|
});
|
100
|
+
handleAnalyticsService(null, {
|
101
|
+
service: metrikaAsString,
|
102
|
+
});
|
79
103
|
const servicesAsString = selectedServices.join(',');
|
80
104
|
handleChangeQuery({ services: servicesAsString, page: DEFAULT_PAGE });
|
81
105
|
setIsFetching(true);
|
@@ -39,7 +39,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
40
40
|
exports.Paginator = void 0;
|
41
41
|
const react_1 = __importStar(require("react"));
|
42
|
+
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
42
43
|
const constants_1 = require("../../constants");
|
44
|
+
/**
|
45
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
46
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
47
|
+
*/
|
43
48
|
const metrika_js_1 = __importDefault(require("../../counters/metrika.js"));
|
44
49
|
const utils_1 = require("../../counters/utils");
|
45
50
|
const utils_2 = require("./utils");
|
@@ -47,6 +52,7 @@ const types_1 = require("./types");
|
|
47
52
|
const cn_1 = require("../../utils/cn");
|
48
53
|
const NavigationButton_1 = require("./components/NavigationButton");
|
49
54
|
const PaginatorItem_1 = require("./components/PaginatorItem");
|
55
|
+
const common_1 = require("../../models/common");
|
50
56
|
const b = (0, cn_1.block)('paginator');
|
51
57
|
const DEFAULT_PAGE_COUNT_FOR_SHOW_SUPPORT_BUTTONS = 6;
|
52
58
|
const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className, loading, onPageChange, pageCountForShowSupportButtons = DEFAULT_PAGE_COUNT_FOR_SHOW_SUPPORT_BUTTONS, }) => {
|
@@ -57,16 +63,29 @@ const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className, loadin
|
|
57
63
|
}, [itemsPerPage, totalItems, maxPages]);
|
58
64
|
const handlePageChange = (pageIndex) => onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(pageIndex);
|
59
65
|
const isShowSupportButtons = (0, react_1.useMemo)(() => pagesCount > pageCountForShowSupportButtons, [pageCountForShowSupportButtons, pagesCount]);
|
66
|
+
const handleAnalyticsHome = (0, page_constructor_1.useAnalytics)(common_1.DefaultEventNames.PaginatorHome);
|
67
|
+
const handleAnalyticsNext = (0, page_constructor_1.useAnalytics)(common_1.DefaultEventNames.PaginatorNext);
|
68
|
+
const handleAnalyticsPage = (0, page_constructor_1.useAnalytics)(common_1.DefaultEventNames.PaginatorPage);
|
60
69
|
if (pagesCount <= 1) {
|
61
70
|
return null;
|
62
71
|
}
|
63
72
|
const handleArrowClick = (type) => {
|
64
73
|
let newPage = page;
|
65
74
|
if (type === 'prev' && page > 1) {
|
75
|
+
/**
|
76
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
77
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
78
|
+
*/
|
66
79
|
metrika_js_1.default.reachGoal(utils_1.MetrikaCounter.CrossSite, constants_1.BlogMetrikaGoalIds.home);
|
80
|
+
handleAnalyticsHome();
|
67
81
|
newPage = 1;
|
68
82
|
}
|
69
83
|
else if (type === 'next' && page < pagesCount) {
|
84
|
+
/**
|
85
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
86
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
87
|
+
*/
|
88
|
+
handleAnalyticsNext();
|
70
89
|
metrika_js_1.default.reachGoal(utils_1.MetrikaCounter.CrossSite, constants_1.BlogMetrikaGoalIds.next);
|
71
90
|
newPage = page + 1;
|
72
91
|
}
|
@@ -76,7 +95,12 @@ const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className, loadin
|
|
76
95
|
};
|
77
96
|
const handlePageClick = (index) => {
|
78
97
|
if (index !== page && typeof index === 'number') {
|
98
|
+
/**
|
99
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
100
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
101
|
+
*/
|
79
102
|
metrika_js_1.default.reachGoal(utils_1.MetrikaCounter.CrossSite, constants_1.BlogMetrikaGoalIds.page, { page: index });
|
103
|
+
handleAnalyticsPage(null, { page: String(index) });
|
80
104
|
handlePageChange(index);
|
81
105
|
}
|
82
106
|
};
|
@@ -6,6 +6,10 @@ type PostCardProps = {
|
|
6
6
|
fullWidth?: boolean;
|
7
7
|
showTag?: boolean;
|
8
8
|
size?: 's' | 'm';
|
9
|
+
/**
|
10
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
11
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
12
|
+
*/
|
9
13
|
metrikaGoals?: MetrikaGoal;
|
10
14
|
};
|
11
15
|
export declare const PostCard: React.FC<PostCardProps>;
|
@@ -9,6 +9,10 @@ type PostInfoProps = {
|
|
9
9
|
readingTime: PostData['readingTime'];
|
10
10
|
date: PostData['date'];
|
11
11
|
theme?: 'light' | 'dark';
|
12
|
+
/**
|
13
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
14
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
15
|
+
*/
|
12
16
|
metrikaGoals?: BlogMetrikaGoals;
|
13
17
|
dataQa?: string;
|
14
18
|
};
|
@@ -5,6 +5,10 @@ type SaveProps = {
|
|
5
5
|
hasUserLike: boolean;
|
6
6
|
handleUserLike: () => void;
|
7
7
|
theme?: 'light' | 'dark';
|
8
|
+
/**
|
9
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
10
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
11
|
+
*/
|
8
12
|
metrikaGoal?: string;
|
9
13
|
dataQa?: string;
|
10
14
|
size?: 's' | 'm';
|
@@ -1,6 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
type SharingProps = {
|
3
3
|
theme?: 'light' | 'dark';
|
4
|
+
/**
|
5
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
6
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
7
|
+
*/
|
4
8
|
metrikaGoal?: string;
|
5
9
|
};
|
6
10
|
export declare const Sharing: React.FC<SharingProps>;
|
@@ -21,6 +21,10 @@ declare function hit(...args: any[]): void;
|
|
21
21
|
declare function params(...args: any[]): void;
|
22
22
|
declare function reachGoal(counterName: any, ...args: any[]): void;
|
23
23
|
declare function reachGoals(goals: any, counterName?: string): void;
|
24
|
+
/**
|
25
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
26
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
27
|
+
*/
|
24
28
|
declare const Goal: {
|
25
29
|
SUPPORT_OPEN_FORM: string;
|
26
30
|
SUPPORT_STEP_1_SUBMIT: string;
|
@@ -1,6 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.initCounters = void 0;
|
4
|
+
/**
|
5
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
6
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
7
|
+
*/
|
4
8
|
const Goal = {
|
5
9
|
SUPPORT_OPEN_FORM: 'SUPPORTOPENFORM',
|
6
10
|
SUPPORT_STEP_1_SUBMIT: 'SUPPORTSTEP1SUBMIT',
|
@@ -151,5 +151,12 @@ export type SetQueryType = (params: Query, options?: {
|
|
151
151
|
}) => Promise<void> | void;
|
152
152
|
export declare enum DefaultEventNames {
|
153
153
|
ShareButton = "share-button-click",
|
154
|
-
SaveButton = "save-button-click"
|
154
|
+
SaveButton = "save-button-click",
|
155
|
+
ShowMore = "show-more-button-click",
|
156
|
+
PaginatorHome = "paginator-home-button-click",
|
157
|
+
PaginatorNext = "paginator-next-button-click",
|
158
|
+
PaginatorPage = "paginator-page-button-click",
|
159
|
+
Tag = "selector-tag-click",
|
160
|
+
Service = "selector-service-click",
|
161
|
+
SaveOnly = "save-only-button-click"
|
155
162
|
}
|
@@ -24,4 +24,11 @@ var DefaultEventNames;
|
|
24
24
|
(function (DefaultEventNames) {
|
25
25
|
DefaultEventNames["ShareButton"] = "share-button-click";
|
26
26
|
DefaultEventNames["SaveButton"] = "save-button-click";
|
27
|
+
DefaultEventNames["ShowMore"] = "show-more-button-click";
|
28
|
+
DefaultEventNames["PaginatorHome"] = "paginator-home-button-click";
|
29
|
+
DefaultEventNames["PaginatorNext"] = "paginator-next-button-click";
|
30
|
+
DefaultEventNames["PaginatorPage"] = "paginator-page-button-click";
|
31
|
+
DefaultEventNames["Tag"] = "selector-tag-click";
|
32
|
+
DefaultEventNames["Service"] = "selector-service-click";
|
33
|
+
DefaultEventNames["SaveOnly"] = "save-only-button-click";
|
27
34
|
})(DefaultEventNames = exports.DefaultEventNames || (exports.DefaultEventNames = {}));
|
@@ -26,6 +26,10 @@ export const Banner = (_a) => {
|
|
26
26
|
contentStyle.backgroundColor = color;
|
27
27
|
}
|
28
28
|
const contentData = updateContentSizes(content);
|
29
|
+
/**
|
30
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
31
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
32
|
+
*/
|
29
33
|
const metrikaGoal = {
|
30
34
|
name: BlogMetrikaGoalIds.bannerCommon,
|
31
35
|
isCrossSite: true,
|
@@ -16,6 +16,10 @@ export const CTA = ({ items, paddingTop, paddingBottom }) => {
|
|
16
16
|
else if (count > MAX_COLUMN_COUNT) {
|
17
17
|
count = MAX_COLUMN_COUNT;
|
18
18
|
}
|
19
|
+
/**
|
20
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
21
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
22
|
+
*/
|
19
23
|
const metrikaGoal = {
|
20
24
|
name: BlogMetrikaGoalIds.cta,
|
21
25
|
isCrossSite: true,
|
@@ -1,16 +1,26 @@
|
|
1
1
|
import React, { useEffect, useCallback, useReducer, useMemo, useContext } from 'react';
|
2
2
|
import { Icon } from '@gravity-ui/uikit';
|
3
|
+
import { useAnalytics } from '@gravity-ui/page-constructor';
|
3
4
|
import { FeedContext } from '../../contexts/FeedContext';
|
4
5
|
import { RouterContext } from '../../contexts/RouterContext';
|
5
6
|
import { LocaleContext } from '../../contexts/LocaleContext';
|
6
7
|
import { DEFAULT_PAGE, DEFAULT_ROWS_PER_PAGE } from '../constants';
|
8
|
+
/**
|
9
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
10
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
11
|
+
*/
|
7
12
|
import { BlogMetrikaGoalIds } from '../../constants';
|
8
13
|
import { getFeedQueryParams, scrollOnPageChange } from '../../utils/common';
|
9
14
|
import { FeedHeader } from '../../components/FeedHeader/FeedHeader';
|
10
15
|
import { PostsError } from '../../components/PostsError/PostsError';
|
11
16
|
import { Posts } from '../../components/Posts/Posts';
|
17
|
+
/**
|
18
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
19
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
20
|
+
*/
|
12
21
|
import metrika from '../../counters/metrika.js';
|
13
22
|
import { MetrikaCounter } from '../../counters/utils';
|
23
|
+
import { DefaultEventNames } from '../../models/common';
|
14
24
|
import { ActionTypes, reducer } from './reducer';
|
15
25
|
const CONTAINER_ID = 'blog-cards';
|
16
26
|
const PAGE_QUERY = 'page';
|
@@ -20,6 +30,7 @@ export const Feed = ({ image }) => {
|
|
20
30
|
const { posts, totalCount, tags, services, pinnedPost, getPosts, pageCountForShowSupportButtons, } = useContext(FeedContext);
|
21
31
|
const router = useContext(RouterContext);
|
22
32
|
const { locale } = useContext(LocaleContext);
|
33
|
+
const handleAnalytics = useAnalytics(DefaultEventNames.ShowMore);
|
23
34
|
const [{ errorLoad, errorShowMore, isFetching, isShowMoreFetching, isShowMoreVisible, lastLoadedCount, postCountOnPage, postsOnPage, pinnedPostOnPage, currentPage, queryParams, }, dispatch,] = useReducer(reducer, {
|
24
35
|
errorLoad: false,
|
25
36
|
errorShowMore: false,
|
@@ -83,7 +94,12 @@ export const Feed = ({ image }) => {
|
|
83
94
|
}, [fetchData]);
|
84
95
|
const handleShowMore = async () => {
|
85
96
|
dispatch({ type: ActionTypes.SetIsShowMoreFetching, payload: true });
|
97
|
+
/**
|
98
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
99
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
100
|
+
*/
|
86
101
|
metrika.reachGoal(MetrikaCounter.CrossSite, BlogMetrikaGoalIds.showMore);
|
102
|
+
handleAnalytics();
|
87
103
|
try {
|
88
104
|
const fetchedData = await fetchData(currentPage + 1);
|
89
105
|
handleChangeQueryParams({
|
@@ -7,6 +7,10 @@ import { Wrapper } from '../../components/Wrapper/Wrapper';
|
|
7
7
|
import { PaddingsDirections } from '../../models/paddings';
|
8
8
|
import { getBreadcrumbs } from '../../utils/common';
|
9
9
|
import { BlogMetrikaGoalIds } from '../../constants';
|
10
|
+
/**
|
11
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
12
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
13
|
+
*/
|
10
14
|
const metrikaGoals = {
|
11
15
|
sharing: BlogMetrikaGoalIds.shareTop,
|
12
16
|
save: BlogMetrikaGoalIds.saveTop,
|
@@ -10,6 +10,10 @@ import { BlogMetrikaGoalIds } from '../../constants';
|
|
10
10
|
import { block } from '../../utils/cn';
|
11
11
|
import './Meta.css';
|
12
12
|
const b = block('meta');
|
13
|
+
/**
|
14
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
15
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
16
|
+
*/
|
13
17
|
const metrikaGoals = {
|
14
18
|
sharing: BlogMetrikaGoalIds.shareBottom,
|
15
19
|
save: BlogMetrikaGoalIds.saveBottom,
|
@@ -6,6 +6,10 @@ import { PostCard } from '../../components/PostCard/PostCard';
|
|
6
6
|
import { PaddingsDirections } from '../../models/paddings';
|
7
7
|
import { PostPageContext } from '../../contexts/PostPageContext';
|
8
8
|
import { BlogMetrikaGoalIds } from '../../constants';
|
9
|
+
/**
|
10
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
11
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
12
|
+
*/
|
9
13
|
const metrikaGoals = [
|
10
14
|
{
|
11
15
|
name: BlogMetrikaGoalIds.suggest,
|
@@ -1,14 +1,20 @@
|
|
1
1
|
import React, { useState, useContext, useMemo } from 'react';
|
2
|
+
import { useAnalytics } from '@gravity-ui/page-constructor';
|
2
3
|
import { Icon, Button, Select } from '@gravity-ui/uikit';
|
3
4
|
import { Search } from '../../../Search/Search';
|
4
5
|
import { renderSwitcher, renderFilter, renderOption } from './customRenders';
|
5
6
|
import { LikesContext } from '../../../../contexts/LikesContext';
|
7
|
+
/**
|
8
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
9
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
10
|
+
*/
|
6
11
|
import { BlogMetrikaGoalIds } from '../../../../constants';
|
7
12
|
import metrika from '../../../../counters/metrika.js';
|
8
13
|
import { MetrikaCounter } from '../../../../counters/utils';
|
9
14
|
import { Save } from '../../../../icons/Save';
|
10
15
|
import { i18, Keyset } from '../../../../i18n';
|
11
16
|
import { block } from '../../../../utils/cn';
|
17
|
+
import { DefaultEventNames, } from '../../../../models/common';
|
12
18
|
import './Controls.css';
|
13
19
|
const b = block('feed-controls');
|
14
20
|
const ICON_SIZE = 16;
|
@@ -16,11 +22,15 @@ const DEFAULT_PAGE = 1;
|
|
16
22
|
const VIRTUALIZATION_THRESHOLD = 1000;
|
17
23
|
export const Controls = ({ setIsFetching, tags = [], services = [], handleChangeQuery, queryParams, }) => {
|
18
24
|
const { hasLikes } = useContext(LikesContext);
|
25
|
+
const handleAnalyticsTag = useAnalytics(DefaultEventNames.Tag);
|
26
|
+
const handleAnalyticsService = useAnalytics(DefaultEventNames.Service);
|
27
|
+
const handleAnalyticsSaveOnly = useAnalytics(DefaultEventNames.SaveOnly);
|
19
28
|
const { savedOnly: savedOnlyInitial, search: searchInitial, tags: tagInitial, services: servicesInitial, } = queryParams || {};
|
20
29
|
const [savedOnly, setSavedOnly] = useState(savedOnlyInitial === 'true');
|
21
30
|
const [search, setSearch] = useState(searchInitial);
|
22
31
|
const handleSavedOnly = () => {
|
23
32
|
handleChangeQuery({ savedOnly: savedOnly ? '' : 'true' });
|
33
|
+
handleAnalyticsSaveOnly();
|
24
34
|
setSavedOnly(!savedOnly);
|
25
35
|
setIsFetching(true);
|
26
36
|
};
|
@@ -30,9 +40,16 @@ export const Controls = ({ setIsFetching, tags = [], services = [], handleChange
|
|
30
40
|
setIsFetching(true);
|
31
41
|
};
|
32
42
|
const handleTagSelect = (selectedTags) => {
|
43
|
+
/**
|
44
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
45
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
46
|
+
*/
|
33
47
|
metrika.reachGoal(MetrikaCounter.CrossSite, BlogMetrikaGoalIds.tag, {
|
34
48
|
theme: selectedTags[0],
|
35
49
|
});
|
50
|
+
handleAnalyticsTag(null, {
|
51
|
+
theme: selectedTags[0],
|
52
|
+
});
|
36
53
|
const isEmptyTag = selectedTags.some((tag) => tag === 'empty');
|
37
54
|
handleChangeQuery({
|
38
55
|
tags: isEmptyTag ? '' : selectedTags[0],
|
@@ -45,9 +62,16 @@ export const Controls = ({ setIsFetching, tags = [], services = [], handleChange
|
|
45
62
|
return selectedServices.includes(service.value);
|
46
63
|
});
|
47
64
|
const metrikaAsString = forMetrikaServices.map((service) => service.content).join(',');
|
65
|
+
/**
|
66
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
67
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
68
|
+
*/
|
48
69
|
metrika.reachGoal(MetrikaCounter.CrossSite, BlogMetrikaGoalIds.service, {
|
49
70
|
service: metrikaAsString,
|
50
71
|
});
|
72
|
+
handleAnalyticsService(null, {
|
73
|
+
service: metrikaAsString,
|
74
|
+
});
|
51
75
|
const servicesAsString = selectedServices.join(',');
|
52
76
|
handleChangeQuery({ services: servicesAsString, page: DEFAULT_PAGE });
|
53
77
|
setIsFetching(true);
|
@@ -10,7 +10,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
10
10
|
return t;
|
11
11
|
};
|
12
12
|
import React, { useEffect, useState, useMemo } from 'react';
|
13
|
+
import { useAnalytics } from '@gravity-ui/page-constructor';
|
13
14
|
import { BlogMetrikaGoalIds } from '../../constants';
|
15
|
+
/**
|
16
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
17
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
18
|
+
*/
|
14
19
|
import metrika from '../../counters/metrika.js';
|
15
20
|
import { MetrikaCounter } from '../../counters/utils';
|
16
21
|
import { getPageConfigs, getPagesCount } from './utils';
|
@@ -18,6 +23,7 @@ import { ArrowType } from './types';
|
|
18
23
|
import { block } from '../../utils/cn';
|
19
24
|
import { NavigationButton } from './components/NavigationButton';
|
20
25
|
import { PaginatorItem } from './components/PaginatorItem';
|
26
|
+
import { DefaultEventNames } from '../../models/common';
|
21
27
|
import './Paginator.css';
|
22
28
|
const b = block('paginator');
|
23
29
|
const DEFAULT_PAGE_COUNT_FOR_SHOW_SUPPORT_BUTTONS = 6;
|
@@ -29,16 +35,29 @@ export const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className,
|
|
29
35
|
}, [itemsPerPage, totalItems, maxPages]);
|
30
36
|
const handlePageChange = (pageIndex) => onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(pageIndex);
|
31
37
|
const isShowSupportButtons = useMemo(() => pagesCount > pageCountForShowSupportButtons, [pageCountForShowSupportButtons, pagesCount]);
|
38
|
+
const handleAnalyticsHome = useAnalytics(DefaultEventNames.PaginatorHome);
|
39
|
+
const handleAnalyticsNext = useAnalytics(DefaultEventNames.PaginatorNext);
|
40
|
+
const handleAnalyticsPage = useAnalytics(DefaultEventNames.PaginatorPage);
|
32
41
|
if (pagesCount <= 1) {
|
33
42
|
return null;
|
34
43
|
}
|
35
44
|
const handleArrowClick = (type) => {
|
36
45
|
let newPage = page;
|
37
46
|
if (type === 'prev' && page > 1) {
|
47
|
+
/**
|
48
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
49
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
50
|
+
*/
|
38
51
|
metrika.reachGoal(MetrikaCounter.CrossSite, BlogMetrikaGoalIds.home);
|
52
|
+
handleAnalyticsHome();
|
39
53
|
newPage = 1;
|
40
54
|
}
|
41
55
|
else if (type === 'next' && page < pagesCount) {
|
56
|
+
/**
|
57
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
58
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
59
|
+
*/
|
60
|
+
handleAnalyticsNext();
|
42
61
|
metrika.reachGoal(MetrikaCounter.CrossSite, BlogMetrikaGoalIds.next);
|
43
62
|
newPage = page + 1;
|
44
63
|
}
|
@@ -48,7 +67,12 @@ export const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className,
|
|
48
67
|
};
|
49
68
|
const handlePageClick = (index) => {
|
50
69
|
if (index !== page && typeof index === 'number') {
|
70
|
+
/**
|
71
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
72
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
73
|
+
*/
|
51
74
|
metrika.reachGoal(MetrikaCounter.CrossSite, BlogMetrikaGoalIds.page, { page: index });
|
75
|
+
handleAnalyticsPage(null, { page: String(index) });
|
52
76
|
handlePageChange(index);
|
53
77
|
}
|
54
78
|
};
|
@@ -7,6 +7,10 @@ type PostCardProps = {
|
|
7
7
|
fullWidth?: boolean;
|
8
8
|
showTag?: boolean;
|
9
9
|
size?: 's' | 'm';
|
10
|
+
/**
|
11
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
12
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
13
|
+
*/
|
10
14
|
metrikaGoals?: MetrikaGoal;
|
11
15
|
};
|
12
16
|
export declare const PostCard: React.FC<PostCardProps>;
|
@@ -10,6 +10,10 @@ type PostInfoProps = {
|
|
10
10
|
readingTime: PostData['readingTime'];
|
11
11
|
date: PostData['date'];
|
12
12
|
theme?: 'light' | 'dark';
|
13
|
+
/**
|
14
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
15
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
16
|
+
*/
|
13
17
|
metrikaGoals?: BlogMetrikaGoals;
|
14
18
|
dataQa?: string;
|
15
19
|
};
|
@@ -6,6 +6,10 @@ type SaveProps = {
|
|
6
6
|
hasUserLike: boolean;
|
7
7
|
handleUserLike: () => void;
|
8
8
|
theme?: 'light' | 'dark';
|
9
|
+
/**
|
10
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
11
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
12
|
+
*/
|
9
13
|
metrikaGoal?: string;
|
10
14
|
dataQa?: string;
|
11
15
|
size?: 's' | 'm';
|
@@ -2,6 +2,10 @@ import React from 'react';
|
|
2
2
|
import '../PostInfo.css';
|
3
3
|
type SharingProps = {
|
4
4
|
theme?: 'light' | 'dark';
|
5
|
+
/**
|
6
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
7
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
8
|
+
*/
|
5
9
|
metrikaGoal?: string;
|
6
10
|
};
|
7
11
|
export declare const Sharing: React.FC<SharingProps>;
|
@@ -21,6 +21,10 @@ declare function hit(...args: any[]): void;
|
|
21
21
|
declare function params(...args: any[]): void;
|
22
22
|
declare function reachGoal(counterName: any, ...args: any[]): void;
|
23
23
|
declare function reachGoals(goals: any, counterName?: string): void;
|
24
|
+
/**
|
25
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
26
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
27
|
+
*/
|
24
28
|
declare const Goal: {
|
25
29
|
SUPPORT_OPEN_FORM: string;
|
26
30
|
SUPPORT_STEP_1_SUBMIT: string;
|
@@ -151,5 +151,12 @@ export type SetQueryType = (params: Query, options?: {
|
|
151
151
|
}) => Promise<void> | void;
|
152
152
|
export declare enum DefaultEventNames {
|
153
153
|
ShareButton = "share-button-click",
|
154
|
-
SaveButton = "save-button-click"
|
154
|
+
SaveButton = "save-button-click",
|
155
|
+
ShowMore = "show-more-button-click",
|
156
|
+
PaginatorHome = "paginator-home-button-click",
|
157
|
+
PaginatorNext = "paginator-next-button-click",
|
158
|
+
PaginatorPage = "paginator-page-button-click",
|
159
|
+
Tag = "selector-tag-click",
|
160
|
+
Service = "selector-service-click",
|
161
|
+
SaveOnly = "save-only-button-click"
|
155
162
|
}
|
@@ -21,4 +21,11 @@ export var DefaultEventNames;
|
|
21
21
|
(function (DefaultEventNames) {
|
22
22
|
DefaultEventNames["ShareButton"] = "share-button-click";
|
23
23
|
DefaultEventNames["SaveButton"] = "save-button-click";
|
24
|
+
DefaultEventNames["ShowMore"] = "show-more-button-click";
|
25
|
+
DefaultEventNames["PaginatorHome"] = "paginator-home-button-click";
|
26
|
+
DefaultEventNames["PaginatorNext"] = "paginator-next-button-click";
|
27
|
+
DefaultEventNames["PaginatorPage"] = "paginator-page-button-click";
|
28
|
+
DefaultEventNames["Tag"] = "selector-tag-click";
|
29
|
+
DefaultEventNames["Service"] = "selector-service-click";
|
30
|
+
DefaultEventNames["SaveOnly"] = "save-only-button-click";
|
24
31
|
})(DefaultEventNames || (DefaultEventNames = {}));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gravity-ui/blog-constructor",
|
3
|
-
"version": "2.1.2-alpha.
|
3
|
+
"version": "2.1.2-alpha.2",
|
4
4
|
"description": "Gravity UI Blog Constructor",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": {
|
@@ -73,7 +73,7 @@
|
|
73
73
|
"@commitlint/config-conventional": "^17.4.3",
|
74
74
|
"@doc-tools/transform": "^2.9.0",
|
75
75
|
"@gravity-ui/eslint-config": "^1.0.2",
|
76
|
-
"@gravity-ui/page-constructor": "^2.
|
76
|
+
"@gravity-ui/page-constructor": "^2.6.0",
|
77
77
|
"@gravity-ui/prettier-config": "^1.0.1",
|
78
78
|
"@gravity-ui/stylelint-config": "^1.0.0",
|
79
79
|
"@gravity-ui/tsconfig": "^1.0.0",
|
@@ -151,5 +151,12 @@ export type SetQueryType = (params: Query, options?: {
|
|
151
151
|
}) => Promise<void> | void;
|
152
152
|
export declare enum DefaultEventNames {
|
153
153
|
ShareButton = "share-button-click",
|
154
|
-
SaveButton = "save-button-click"
|
154
|
+
SaveButton = "save-button-click",
|
155
|
+
ShowMore = "show-more-button-click",
|
156
|
+
PaginatorHome = "paginator-home-button-click",
|
157
|
+
PaginatorNext = "paginator-next-button-click",
|
158
|
+
PaginatorPage = "paginator-page-button-click",
|
159
|
+
Tag = "selector-tag-click",
|
160
|
+
Service = "selector-service-click",
|
161
|
+
SaveOnly = "save-only-button-click"
|
155
162
|
}
|
package/server/models/common.js
CHANGED
@@ -24,4 +24,11 @@ var DefaultEventNames;
|
|
24
24
|
(function (DefaultEventNames) {
|
25
25
|
DefaultEventNames["ShareButton"] = "share-button-click";
|
26
26
|
DefaultEventNames["SaveButton"] = "save-button-click";
|
27
|
+
DefaultEventNames["ShowMore"] = "show-more-button-click";
|
28
|
+
DefaultEventNames["PaginatorHome"] = "paginator-home-button-click";
|
29
|
+
DefaultEventNames["PaginatorNext"] = "paginator-next-button-click";
|
30
|
+
DefaultEventNames["PaginatorPage"] = "paginator-page-button-click";
|
31
|
+
DefaultEventNames["Tag"] = "selector-tag-click";
|
32
|
+
DefaultEventNames["Service"] = "selector-service-click";
|
33
|
+
DefaultEventNames["SaveOnly"] = "save-only-button-click";
|
27
34
|
})(DefaultEventNames = exports.DefaultEventNames || (exports.DefaultEventNames = {}));
|