@gravity-ui/blog-constructor 2.1.0-alpha.2 → 2.1.2-alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +15 -0
- 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 +25 -2
- package/build/cjs/components/Paginator/Paginator.css +3 -0
- package/build/cjs/components/Paginator/Paginator.js +24 -0
- package/build/cjs/components/Paginator/components/PaginatorItem.js +31 -4
- 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/constructor/BlogConstructorProvider.d.ts +1 -1
- package/build/cjs/constructor/BlogConstructorProvider.js +2 -2
- package/build/cjs/counters/metrika.d.ts +4 -0
- package/build/cjs/counters/metrika.js +4 -0
- package/build/cjs/models/common.d.ts +7 -1
- package/build/cjs/models/common.js +6 -0
- package/build/cjs/utils/common.d.ts +1 -0
- package/build/cjs/utils/common.js +6 -1
- 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 +25 -2
- package/build/esm/components/Paginator/Paginator.css +3 -0
- package/build/esm/components/Paginator/Paginator.js +24 -0
- package/build/esm/components/Paginator/components/PaginatorItem.js +9 -2
- 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/constructor/BlogConstructorProvider.d.ts +1 -1
- package/build/esm/constructor/BlogConstructorProvider.js +1 -1
- package/build/esm/counters/metrika.d.ts +4 -0
- package/build/esm/counters/metrika.js +4 -0
- package/build/esm/models/common.d.ts +7 -1
- package/build/esm/models/common.js +6 -0
- package/build/esm/utils/common.d.ts +1 -0
- package/build/esm/utils/common.js +4 -0
- package/package.json +2 -2
- package/server/models/common.d.ts +7 -1
- package/server/models/common.js +6 -0
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [2.0.2](https://github.com/gravity-ui/blog-constructor/compare/v2.0.1...v2.0.2) (2023-04-05)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* covering pagination buttons into 'a' tag ([#23](https://github.com/gravity-ui/blog-constructor/issues/23)) ([e603f2e](https://github.com/gravity-ui/blog-constructor/commit/e603f2e2b0f86d492132174a1c8172786e7a09a1))
|
9
|
+
|
10
|
+
## [2.0.1](https://github.com/gravity-ui/blog-constructor/compare/v2.0.0...v2.0.1) (2023-04-04)
|
11
|
+
|
12
|
+
|
13
|
+
### Bug Fixes
|
14
|
+
|
15
|
+
* throw virtualization threshold prop in Select ([#26](https://github.com/gravity-ui/blog-constructor/issues/26)) ([ccb0f19](https://github.com/gravity-ui/blog-constructor/commit/ccb0f19a904e54fd43ca66195da9e94925d0a26f))
|
16
|
+
* throw virtualization threshold prop in Select ([#26](https://github.com/gravity-ui/blog-constructor/issues/26)) ([0aa5aed](https://github.com/gravity-ui/blog-constructor/commit/0aa5aeda9a0afd99ae8590c6b666c033a12b7fba))
|
17
|
+
|
3
18
|
## [2.0.0](https://github.com/gravity-ui/blog-constructor/compare/v1.1.2...v2.0.0) (2023-04-03)
|
4
19
|
|
5
20
|
|
@@ -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,21 +28,30 @@ 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;
|
50
|
+
const VIRTUALIZATION_THRESHOLD = 1000;
|
44
51
|
const Controls = ({ setIsFetching, tags = [], services = [], handleChangeQuery, queryParams, }) => {
|
45
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);
|
46
55
|
const { savedOnly: savedOnlyInitial, search: searchInitial, tags: tagInitial, services: servicesInitial, } = queryParams || {};
|
47
56
|
const [savedOnly, setSavedOnly] = (0, react_1.useState)(savedOnlyInitial === 'true');
|
48
57
|
const [search, setSearch] = (0, react_1.useState)(searchInitial);
|
@@ -57,9 +66,16 @@ const Controls = ({ setIsFetching, tags = [], services = [], handleChangeQuery,
|
|
57
66
|
setIsFetching(true);
|
58
67
|
};
|
59
68
|
const handleTagSelect = (selectedTags) => {
|
69
|
+
/**
|
70
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
71
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
72
|
+
*/
|
60
73
|
metrika_js_1.default.reachGoal(utils_1.MetrikaCounter.CrossSite, constants_1.BlogMetrikaGoalIds.tag, {
|
61
74
|
theme: selectedTags[0],
|
62
75
|
});
|
76
|
+
handleAnalyticsTag(null, {
|
77
|
+
theme: selectedTags[0],
|
78
|
+
});
|
63
79
|
const isEmptyTag = selectedTags.some((tag) => tag === 'empty');
|
64
80
|
handleChangeQuery({
|
65
81
|
tags: isEmptyTag ? '' : selectedTags[0],
|
@@ -72,9 +88,16 @@ const Controls = ({ setIsFetching, tags = [], services = [], handleChangeQuery,
|
|
72
88
|
return selectedServices.includes(service.value);
|
73
89
|
});
|
74
90
|
const metrikaAsString = forMetrikaServices.map((service) => service.content).join(',');
|
91
|
+
/**
|
92
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
93
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
94
|
+
*/
|
75
95
|
metrika_js_1.default.reachGoal(utils_1.MetrikaCounter.CrossSite, constants_1.BlogMetrikaGoalIds.service, {
|
76
96
|
service: metrikaAsString,
|
77
97
|
});
|
98
|
+
handleAnalyticsService(null, {
|
99
|
+
service: metrikaAsString,
|
100
|
+
});
|
78
101
|
const servicesAsString = selectedServices.join(',');
|
79
102
|
handleChangeQuery({ services: servicesAsString, page: DEFAULT_PAGE });
|
80
103
|
setIsFetching(true);
|
@@ -91,13 +114,13 @@ const Controls = ({ setIsFetching, tags = [], services = [], handleChangeQuery,
|
|
91
114
|
initial: [tagInitial],
|
92
115
|
list: tagsItems,
|
93
116
|
defaultLabel: (0, i18n_1.i18)(i18n_1.Keyset.AllTags),
|
94
|
-
}), disablePortal: true, renderOption: customRenders_1.renderOption })),
|
117
|
+
}), disablePortal: true, virtualizationThreshold: VIRTUALIZATION_THRESHOLD, renderOption: customRenders_1.renderOption })),
|
95
118
|
services.length > 0 ? (react_1.default.createElement("div", { className: b('filter-item') },
|
96
119
|
react_1.default.createElement(uikit_1.Select, { className: b('select'), size: "xl", multiple: true, filterable: true, disablePortal: true, options: services, defaultValue: servicesItems, popupClassName: b('popup'), onUpdate: handleServicesSelect, placeholder: (0, i18n_1.i18)(i18n_1.Keyset.AllServices), renderControl: (0, customRenders_1.renderSwitcher)({
|
97
120
|
initial: servicesItems,
|
98
121
|
list: services,
|
99
122
|
defaultLabel: (0, i18n_1.i18)(i18n_1.Keyset.AllServices),
|
100
|
-
}), renderOption: customRenders_1.renderOption, renderFilter: customRenders_1.renderFilter }))) : null,
|
123
|
+
}), virtualizationThreshold: VIRTUALIZATION_THRESHOLD, renderOption: customRenders_1.renderOption, renderFilter: customRenders_1.renderFilter }))) : null,
|
101
124
|
hasLikes ? (react_1.default.createElement("div", { className: b('filter-item', { 'width-auto': true }) },
|
102
125
|
react_1.default.createElement(uikit_1.Button, { view: 'outlined', className: b('saved-only-button', { savedOnly }), size: "xl", onClick: handleSavedOnly },
|
103
126
|
react_1.default.createElement(uikit_1.Icon, { data: Save_1.Save, size: ICON_SIZE, className: b('icon', { savedOnly }) }),
|
@@ -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();
|
80
104
|
handlePageChange(index);
|
81
105
|
}
|
82
106
|
};
|
@@ -1,15 +1,42 @@
|
|
1
1
|
"use strict";
|
2
|
-
var
|
3
|
-
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
4
24
|
};
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
26
|
exports.PaginatorItem = void 0;
|
7
|
-
const react_1 =
|
27
|
+
const react_1 = __importStar(require("react"));
|
8
28
|
const uikit_1 = require("@gravity-ui/uikit");
|
29
|
+
const LocaleContext_1 = require("../../../contexts/LocaleContext");
|
30
|
+
const common_1 = require("../../../utils/common");
|
9
31
|
const cn_1 = require("../../../utils/cn");
|
10
32
|
const b = (0, cn_1.block)('paginator');
|
11
33
|
const PaginatorItem = ({ dataKey, mods, content, onClick, loading = false, }) => {
|
34
|
+
const { locale } = (0, react_1.useContext)(LocaleContext_1.LocaleContext);
|
35
|
+
const urlPath = (0, common_1.getBlogPath)((locale === null || locale === void 0 ? void 0 : locale.pathPrefix) || '');
|
12
36
|
const itemKey = Number(dataKey) > 0 ? Number(dataKey) : dataKey;
|
13
|
-
|
37
|
+
const navTag = itemKey > 0 ? `${mods.type || 'page'}=${itemKey}` : itemKey;
|
38
|
+
const navigationLink = `${urlPath || ''}?${navTag}`;
|
39
|
+
return (react_1.default.createElement("a", { href: navigationLink, className: b('link', mods), onClick: (event) => event.preventDefault() },
|
40
|
+
react_1.default.createElement(uikit_1.Button, { view: "flat", size: "xl", className: b('item', mods), onClick: () => onClick === null || onClick === void 0 ? void 0 : onClick(itemKey), loading: loading && Boolean(mods.active) }, content)));
|
14
41
|
};
|
15
42
|
exports.PaginatorItem = PaginatorItem;
|
@@ -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>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { AnalyticsContextProps } from '@gravity-ui/page-constructor
|
2
|
+
import { AnalyticsContextProps } from '@gravity-ui/page-constructor';
|
3
3
|
import { RouterContextProps } from '../contexts/RouterContext';
|
4
4
|
import { UserContextProps } from '../contexts/UserContext';
|
5
5
|
import { DeviceContextProps } from '../contexts/DeviceContext';
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
26
|
exports.BlogConstructorProvider = void 0;
|
27
27
|
const react_1 = __importStar(require("react"));
|
28
|
-
const
|
28
|
+
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
29
29
|
const MobileContext_1 = require("../contexts/MobileContext");
|
30
30
|
const LocaleContext_1 = require("../contexts/LocaleContext");
|
31
31
|
const RouterContext_1 = require("../contexts/RouterContext");
|
@@ -41,7 +41,7 @@ const BlogConstructorProvider = ({ isMobile, locale = {}, router = {}, theme = c
|
|
41
41
|
react_1.default.createElement(MobileContext_1.MobileContext.Provider, { value: Boolean(isMobile), key: "is-mobile-context" }),
|
42
42
|
react_1.default.createElement(UserContext_1.UserContext.Provider, { value: user, key: "user-context" }),
|
43
43
|
react_1.default.createElement(DeviceContext_1.DeviceContext.Provider, { value: device, key: "device-context" }),
|
44
|
-
react_1.default.createElement(
|
44
|
+
react_1.default.createElement(page_constructor_1.AnalyticsContext.Provider, { value: analytics, key: "analytics-context" }),
|
45
45
|
].reduceRight((prev, provider) => react_1.default.cloneElement(provider, {}, prev), children);
|
46
46
|
return react_1.default.createElement(react_1.Fragment, null, context);
|
47
47
|
};
|
@@ -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,11 @@ 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"
|
155
161
|
}
|
@@ -24,4 +24,10 @@ 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";
|
27
33
|
})(DefaultEventNames = exports.DefaultEventNames || (exports.DefaultEventNames = {}));
|
@@ -34,6 +34,7 @@ type GetBreadcrumbsProps = {
|
|
34
34
|
tags?: Tag[];
|
35
35
|
pathPrefix?: string;
|
36
36
|
};
|
37
|
+
export declare const getBlogPath: (pathPrefix: string) => string;
|
37
38
|
export declare const getBreadcrumbs: ({ tags, pathPrefix }: GetBreadcrumbsProps) => HeaderBreadCrumbsProps;
|
38
39
|
export declare const isMetrikaExist: (goal: NewMetrikaGoal, existGoals: NewMetrikaGoal[]) => boolean;
|
39
40
|
export declare const getBlogElementMetrika: (blogCustomGoal: NewMetrikaGoal, existingGoals?: MetrikaGoal) => string | string[] | NewMetrikaGoal[];
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
11
11
|
return t;
|
12
12
|
};
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
14
|
-
exports.scrollOnPageChange = exports.getFeedQueryParams = exports.getBlogElementMetrika = exports.isMetrikaExist = exports.getBreadcrumbs = exports.updateContentSizes = exports.getTagFilterUrl = exports.postLikeStatus = exports.getTags = exports.scrollToHash = exports.getPageSearchParams = exports.getAbsolutePath = void 0;
|
14
|
+
exports.scrollOnPageChange = exports.getFeedQueryParams = exports.getBlogElementMetrika = exports.isMetrikaExist = exports.getBreadcrumbs = exports.getBlogPath = exports.updateContentSizes = exports.getTagFilterUrl = exports.postLikeStatus = exports.getTags = exports.scrollToHash = exports.getPageSearchParams = exports.getAbsolutePath = void 0;
|
15
15
|
const url_1 = require("url");
|
16
16
|
const lodash_1 = require("lodash");
|
17
17
|
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
@@ -65,6 +65,11 @@ const updateContentSizes = (_a) => {
|
|
65
65
|
return (Object.assign(Object.assign({}, contentData), { size: size || constants_1.CONTENT_DEFAULT_SIZE, colSizes: colSizes || constants_1.CONTENT_DEFAULT_COL_SIZES, theme: theme || constants_1.CONTENT_DEFAULT_THEME }));
|
66
66
|
};
|
67
67
|
exports.updateContentSizes = updateContentSizes;
|
68
|
+
const getBlogPath = (pathPrefix) => {
|
69
|
+
const prefix = pathPrefix ? `/${pathPrefix}/` : '/';
|
70
|
+
return `${prefix}blog`;
|
71
|
+
};
|
72
|
+
exports.getBlogPath = getBlogPath;
|
68
73
|
const getBreadcrumbs = ({ tags, pathPrefix }) => {
|
69
74
|
const prefix = pathPrefix ? `/${pathPrefix}/` : '/';
|
70
75
|
const breadcrumbs = {
|
@@ -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,20 +1,29 @@
|
|
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;
|
15
21
|
const DEFAULT_PAGE = 1;
|
22
|
+
const VIRTUALIZATION_THRESHOLD = 1000;
|
16
23
|
export const Controls = ({ setIsFetching, tags = [], services = [], handleChangeQuery, queryParams, }) => {
|
17
24
|
const { hasLikes } = useContext(LikesContext);
|
25
|
+
const handleAnalyticsTag = useAnalytics(DefaultEventNames.Tag);
|
26
|
+
const handleAnalyticsService = useAnalytics(DefaultEventNames.Service);
|
18
27
|
const { savedOnly: savedOnlyInitial, search: searchInitial, tags: tagInitial, services: servicesInitial, } = queryParams || {};
|
19
28
|
const [savedOnly, setSavedOnly] = useState(savedOnlyInitial === 'true');
|
20
29
|
const [search, setSearch] = useState(searchInitial);
|
@@ -29,9 +38,16 @@ export const Controls = ({ setIsFetching, tags = [], services = [], handleChange
|
|
29
38
|
setIsFetching(true);
|
30
39
|
};
|
31
40
|
const handleTagSelect = (selectedTags) => {
|
41
|
+
/**
|
42
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
43
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
44
|
+
*/
|
32
45
|
metrika.reachGoal(MetrikaCounter.CrossSite, BlogMetrikaGoalIds.tag, {
|
33
46
|
theme: selectedTags[0],
|
34
47
|
});
|
48
|
+
handleAnalyticsTag(null, {
|
49
|
+
theme: selectedTags[0],
|
50
|
+
});
|
35
51
|
const isEmptyTag = selectedTags.some((tag) => tag === 'empty');
|
36
52
|
handleChangeQuery({
|
37
53
|
tags: isEmptyTag ? '' : selectedTags[0],
|
@@ -44,9 +60,16 @@ export const Controls = ({ setIsFetching, tags = [], services = [], handleChange
|
|
44
60
|
return selectedServices.includes(service.value);
|
45
61
|
});
|
46
62
|
const metrikaAsString = forMetrikaServices.map((service) => service.content).join(',');
|
63
|
+
/**
|
64
|
+
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
65
|
+
* https://st.yandex-team.ru/PAGECTR-7
|
66
|
+
*/
|
47
67
|
metrika.reachGoal(MetrikaCounter.CrossSite, BlogMetrikaGoalIds.service, {
|
48
68
|
service: metrikaAsString,
|
49
69
|
});
|
70
|
+
handleAnalyticsService(null, {
|
71
|
+
service: metrikaAsString,
|
72
|
+
});
|
50
73
|
const servicesAsString = selectedServices.join(',');
|
51
74
|
handleChangeQuery({ services: servicesAsString, page: DEFAULT_PAGE });
|
52
75
|
setIsFetching(true);
|
@@ -63,13 +86,13 @@ export const Controls = ({ setIsFetching, tags = [], services = [], handleChange
|
|
63
86
|
initial: [tagInitial],
|
64
87
|
list: tagsItems,
|
65
88
|
defaultLabel: i18(Keyset.AllTags),
|
66
|
-
}), disablePortal: true, renderOption: renderOption })),
|
89
|
+
}), disablePortal: true, virtualizationThreshold: VIRTUALIZATION_THRESHOLD, renderOption: renderOption })),
|
67
90
|
services.length > 0 ? (React.createElement("div", { className: b('filter-item') },
|
68
91
|
React.createElement(Select, { className: b('select'), size: "xl", multiple: true, filterable: true, disablePortal: true, options: services, defaultValue: servicesItems, popupClassName: b('popup'), onUpdate: handleServicesSelect, placeholder: i18(Keyset.AllServices), renderControl: renderSwitcher({
|
69
92
|
initial: servicesItems,
|
70
93
|
list: services,
|
71
94
|
defaultLabel: i18(Keyset.AllServices),
|
72
|
-
}), renderOption: renderOption, renderFilter: renderFilter }))) : null,
|
95
|
+
}), virtualizationThreshold: VIRTUALIZATION_THRESHOLD, renderOption: renderOption, renderFilter: renderFilter }))) : null,
|
73
96
|
hasLikes ? (React.createElement("div", { className: b('filter-item', { 'width-auto': true }) },
|
74
97
|
React.createElement(Button, { view: 'outlined', className: b('saved-only-button', { savedOnly }), size: "xl", onClick: handleSavedOnly },
|
75
98
|
React.createElement(Icon, { data: Save, size: ICON_SIZE, className: b('icon', { savedOnly }) }),
|
@@ -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();
|
52
76
|
handlePageChange(index);
|
53
77
|
}
|
54
78
|
};
|
@@ -1,9 +1,16 @@
|
|
1
|
-
import React from 'react';
|
1
|
+
import React, { useContext } from 'react';
|
2
2
|
import { Button } from '@gravity-ui/uikit';
|
3
|
+
import { LocaleContext } from '../../../contexts/LocaleContext';
|
4
|
+
import { getBlogPath } from '../../../utils/common';
|
3
5
|
import { block } from '../../../utils/cn';
|
4
6
|
import '../Paginator.css';
|
5
7
|
const b = block('paginator');
|
6
8
|
export const PaginatorItem = ({ dataKey, mods, content, onClick, loading = false, }) => {
|
9
|
+
const { locale } = useContext(LocaleContext);
|
10
|
+
const urlPath = getBlogPath((locale === null || locale === void 0 ? void 0 : locale.pathPrefix) || '');
|
7
11
|
const itemKey = Number(dataKey) > 0 ? Number(dataKey) : dataKey;
|
8
|
-
|
12
|
+
const navTag = itemKey > 0 ? `${mods.type || 'page'}=${itemKey}` : itemKey;
|
13
|
+
const navigationLink = `${urlPath || ''}?${navTag}`;
|
14
|
+
return (React.createElement("a", { href: navigationLink, className: b('link', mods), onClick: (event) => event.preventDefault() },
|
15
|
+
React.createElement(Button, { view: "flat", size: "xl", className: b('item', mods), onClick: () => onClick === null || onClick === void 0 ? void 0 : onClick(itemKey), loading: loading && Boolean(mods.active) }, content)));
|
9
16
|
};
|
@@ -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>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { AnalyticsContextProps } from '@gravity-ui/page-constructor
|
2
|
+
import { AnalyticsContextProps } from '@gravity-ui/page-constructor';
|
3
3
|
import { RouterContextProps } from '../contexts/RouterContext';
|
4
4
|
import { UserContextProps } from '../contexts/UserContext';
|
5
5
|
import { DeviceContextProps } from '../contexts/DeviceContext';
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { Fragment } from 'react';
|
2
|
-
import { AnalyticsContext
|
2
|
+
import { AnalyticsContext } from '@gravity-ui/page-constructor';
|
3
3
|
import { MobileContext } from '../contexts/MobileContext';
|
4
4
|
import { LocaleContext } from '../contexts/LocaleContext';
|
5
5
|
import { RouterContext } from '../contexts/RouterContext';
|
@@ -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,11 @@ 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"
|
155
161
|
}
|
@@ -21,4 +21,10 @@ 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";
|
24
30
|
})(DefaultEventNames || (DefaultEventNames = {}));
|
@@ -34,6 +34,7 @@ type GetBreadcrumbsProps = {
|
|
34
34
|
tags?: Tag[];
|
35
35
|
pathPrefix?: string;
|
36
36
|
};
|
37
|
+
export declare const getBlogPath: (pathPrefix: string) => string;
|
37
38
|
export declare const getBreadcrumbs: ({ tags, pathPrefix }: GetBreadcrumbsProps) => HeaderBreadCrumbsProps;
|
38
39
|
export declare const isMetrikaExist: (goal: NewMetrikaGoal, existGoals: NewMetrikaGoal[]) => boolean;
|
39
40
|
export declare const getBlogElementMetrika: (blogCustomGoal: NewMetrikaGoal, existingGoals?: MetrikaGoal) => string | string[] | NewMetrikaGoal[];
|
@@ -57,6 +57,10 @@ export const updateContentSizes = (_a) => {
|
|
57
57
|
var { size, colSizes, theme } = _a, contentData = __rest(_a, ["size", "colSizes", "theme"]);
|
58
58
|
return (Object.assign(Object.assign({}, contentData), { size: size || CONTENT_DEFAULT_SIZE, colSizes: colSizes || CONTENT_DEFAULT_COL_SIZES, theme: theme || CONTENT_DEFAULT_THEME }));
|
59
59
|
};
|
60
|
+
export const getBlogPath = (pathPrefix) => {
|
61
|
+
const prefix = pathPrefix ? `/${pathPrefix}/` : '/';
|
62
|
+
return `${prefix}blog`;
|
63
|
+
};
|
60
64
|
export const getBreadcrumbs = ({ tags, pathPrefix }) => {
|
61
65
|
const prefix = pathPrefix ? `/${pathPrefix}/` : '/';
|
62
66
|
const breadcrumbs = {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gravity-ui/blog-constructor",
|
3
|
-
"version": "2.1.
|
3
|
+
"version": "2.1.2-alpha.1",
|
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,11 @@ 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"
|
155
161
|
}
|
package/server/models/common.js
CHANGED
@@ -24,4 +24,10 @@ 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";
|
27
33
|
})(DefaultEventNames = exports.DefaultEventNames || (exports.DefaultEventNames = {}));
|