@gravity-ui/blog-constructor 2.1.2-alpha.2 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +14 -0
- package/build/cjs/blocks/Author/Author.js +3 -3
- package/build/cjs/blocks/Banner/Banner.js +4 -7
- package/build/cjs/blocks/CTA/CTA.js +3 -6
- package/build/cjs/blocks/ColoredText/ColoredText.js +1 -1
- package/build/cjs/blocks/Feed/Feed.js +12 -28
- package/build/cjs/blocks/Feed/reducer.d.ts +1 -1
- package/build/cjs/blocks/Header/Header.js +3 -7
- package/build/cjs/blocks/Meta/Meta.js +5 -9
- package/build/cjs/blocks/Suggest/Suggest.js +4 -8
- package/build/cjs/blocks/YFM/YFM.js +1 -1
- package/build/cjs/components/FeedHeader/FeedHeader.d.ts +1 -1
- package/build/cjs/components/FeedHeader/FeedHeader.js +1 -1
- package/build/cjs/components/FeedHeader/components/Controls/Controls.d.ts +1 -1
- package/build/cjs/components/FeedHeader/components/Controls/Controls.js +4 -28
- package/build/cjs/components/FeedHeader/components/Controls/customRenders.d.ts +1 -1
- package/build/cjs/components/FeedHeader/components/Controls/customRenders.js +1 -1
- package/build/cjs/components/Paginator/Paginator.js +2 -26
- package/build/cjs/components/Paginator/components/NavigationButton.js +1 -1
- package/build/cjs/components/Paginator/components/PaginatorItem.js +1 -1
- package/build/cjs/components/PostCard/PostCard.d.ts +0 -4
- package/build/cjs/components/PostCard/PostCard.js +1 -1
- package/build/cjs/components/PostInfo/PostInfo.d.ts +0 -4
- package/build/cjs/components/PostInfo/PostInfo.js +2 -2
- package/build/cjs/components/PostInfo/SuggestPostInfo.js +1 -1
- package/build/cjs/components/PostInfo/components/Date.js +1 -1
- package/build/cjs/components/PostInfo/components/Save.d.ts +0 -4
- package/build/cjs/components/PostInfo/components/Save.js +4 -8
- package/build/cjs/components/PostInfo/components/Sharing.d.ts +0 -4
- package/build/cjs/components/PostInfo/components/Sharing.js +5 -12
- package/build/cjs/components/Posts/Posts.js +1 -1
- package/build/cjs/components/PostsEmpty/PostsEmpty.js +1 -1
- package/build/cjs/components/Search/Search.js +2 -2
- package/build/cjs/components/Wrapper/Wrapper.js +1 -1
- package/build/cjs/constructor/BlogConstructorProvider.d.ts +1 -3
- package/build/cjs/constructor/BlogConstructorProvider.js +4 -6
- package/build/cjs/constructor/blocksMap.js +8 -8
- package/build/cjs/containers/BlogPage/BlogPage.d.ts +2 -2
- package/build/cjs/containers/BlogPage/BlogPage.js +2 -2
- package/build/cjs/containers/BlogPostPage/BlogPostPage.d.ts +2 -2
- package/build/cjs/containers/BlogPostPage/BlogPostPage.js +2 -2
- package/build/cjs/contexts/FeedContext.d.ts +1 -1
- package/build/cjs/contexts/theme/ThemeProvider.js +1 -1
- package/build/cjs/counters/metrika.d.ts +0 -4
- package/build/cjs/counters/metrika.js +0 -4
- package/build/cjs/models/blocks.d.ts +1 -1
- package/build/cjs/models/common.d.ts +2 -12
- package/build/cjs/models/common.js +2 -14
- package/build/cjs/utils/common.d.ts +1 -1
- package/build/cjs/utils/common.js +1 -1
- package/build/esm/blocks/Author/Author.js +5 -5
- package/build/esm/blocks/Banner/Banner.js +4 -7
- package/build/esm/blocks/CTA/CTA.js +3 -6
- package/build/esm/blocks/ColoredText/ColoredText.js +1 -1
- package/build/esm/blocks/Feed/Feed.js +8 -24
- package/build/esm/blocks/Feed/reducer.d.ts +1 -1
- package/build/esm/blocks/Header/Header.js +3 -7
- package/build/esm/blocks/Meta/Meta.js +5 -9
- package/build/esm/blocks/Suggest/Suggest.js +4 -8
- package/build/esm/blocks/YFM/YFM.js +1 -1
- package/build/esm/components/FeedHeader/FeedHeader.d.ts +1 -1
- package/build/esm/components/FeedHeader/FeedHeader.js +2 -2
- package/build/esm/components/FeedHeader/components/Controls/Controls.d.ts +1 -1
- package/build/esm/components/FeedHeader/components/Controls/Controls.js +6 -30
- package/build/esm/components/FeedHeader/components/Controls/customRenders.d.ts +1 -1
- package/build/esm/components/FeedHeader/components/Controls/customRenders.js +2 -2
- package/build/esm/components/Paginator/Paginator.js +3 -27
- package/build/esm/components/Paginator/components/NavigationButton.js +2 -2
- package/build/esm/components/Paginator/components/PaginatorItem.js +1 -1
- package/build/esm/components/PostCard/PostCard.d.ts +0 -4
- package/build/esm/components/PostCard/PostCard.js +3 -3
- package/build/esm/components/PostInfo/PostInfo.d.ts +0 -4
- package/build/esm/components/PostInfo/PostInfo.js +2 -2
- package/build/esm/components/PostInfo/SuggestPostInfo.js +1 -1
- package/build/esm/components/PostInfo/components/Date.js +1 -1
- package/build/esm/components/PostInfo/components/ReadingTime.js +1 -1
- package/build/esm/components/PostInfo/components/Save.d.ts +0 -4
- package/build/esm/components/PostInfo/components/Save.js +2 -6
- package/build/esm/components/PostInfo/components/Sharing.d.ts +0 -4
- package/build/esm/components/PostInfo/components/Sharing.js +4 -11
- package/build/esm/components/Posts/Posts.js +2 -2
- package/build/esm/components/PostsEmpty/PostsEmpty.js +1 -1
- package/build/esm/components/PostsError/PostsError.js +1 -1
- package/build/esm/components/Search/Search.js +3 -3
- package/build/esm/components/Wrapper/Wrapper.js +1 -1
- package/build/esm/constructor/BlogConstructorProvider.d.ts +1 -3
- package/build/esm/constructor/BlogConstructorProvider.js +4 -6
- package/build/esm/constructor/blocksMap.js +8 -8
- package/build/esm/containers/BlogPage/BlogPage.d.ts +2 -2
- package/build/esm/containers/BlogPage/BlogPage.js +2 -2
- package/build/esm/containers/BlogPostPage/BlogPostPage.d.ts +2 -2
- package/build/esm/containers/BlogPostPage/BlogPostPage.js +2 -2
- package/build/esm/contexts/FeedContext.d.ts +1 -1
- package/build/esm/contexts/theme/ThemeProvider.js +1 -1
- package/build/esm/counters/metrika.d.ts +0 -4
- package/build/esm/counters/metrika.js +0 -4
- package/build/esm/hooks/useLikes.js +1 -1
- package/build/esm/models/blocks.d.ts +1 -1
- package/build/esm/models/common.d.ts +2 -12
- package/build/esm/models/common.js +1 -13
- package/build/esm/utils/common.d.ts +1 -1
- package/build/esm/utils/common.js +3 -3
- package/package.json +5 -7
- package/server/data/contentFilter.js +1 -0
- package/server/data/createReadableContent.js +1 -1
- package/server/data/transformPost.d.ts +1 -1
- package/server/models/blocks.d.ts +1 -1
- package/server/models/common.d.ts +2 -12
- package/server/models/common.js +2 -14
@@ -27,18 +27,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
27
|
};
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
29
|
exports.Save = void 0;
|
30
|
-
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
31
|
-
const uikit_1 = require("@gravity-ui/uikit");
|
32
30
|
const react_1 = __importStar(require("react"));
|
31
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
33
32
|
const UserContext_1 = require("../../../contexts/UserContext");
|
34
33
|
const metrika_js_1 = __importDefault(require("../../../counters/metrika.js"));
|
35
34
|
const utils_1 = require("../../../counters/utils");
|
36
|
-
// @ts-ignore
|
37
35
|
const Save_1 = require("../../../icons/Save");
|
38
36
|
const SaveFilled_1 = require("../../../icons/SaveFilled");
|
39
|
-
const common_1 = require("../../../models/common");
|
40
37
|
const cn_1 = require("../../../utils/cn");
|
41
|
-
const
|
38
|
+
const common_1 = require("../../../utils/common");
|
39
|
+
// @ts-ignore
|
42
40
|
const ICON_SIZE = 16;
|
43
41
|
const b = (0, cn_1.block)('post-info');
|
44
42
|
/**
|
@@ -55,7 +53,6 @@ const b = (0, cn_1.block)('post-info');
|
|
55
53
|
*/
|
56
54
|
const Save = ({ title, postId, hasUserLike, handleUserLike, metrikaGoal, size, theme, dataQa, }) => {
|
57
55
|
const { uid } = (0, react_1.useContext)(UserContext_1.UserContext);
|
58
|
-
const handleAnalytics = (0, page_constructor_1.useAnalytics)(common_1.DefaultEventNames.SaveButton);
|
59
56
|
return (react_1.default.createElement("div", { className: b('item', { size }), onClick: (event) => {
|
60
57
|
// both preventDefault and stopImmediatePropagation required to work properly
|
61
58
|
// https://stackoverflow.com/questions/24415631/reactjs-syntheticevent-stoppropagation-only-works-with-react-events
|
@@ -64,10 +61,9 @@ const Save = ({ title, postId, hasUserLike, handleUserLike, metrikaGoal, size, t
|
|
64
61
|
if (!uid) {
|
65
62
|
return;
|
66
63
|
}
|
67
|
-
(0,
|
64
|
+
(0, common_1.postLikeStatus)(postId, Boolean(hasUserLike));
|
68
65
|
handleUserLike();
|
69
66
|
metrika_js_1.default.reachGoal(utils_1.MetrikaCounter.CrossSite, metrikaGoal);
|
70
|
-
handleAnalytics();
|
71
67
|
}, "data-qa": `${dataQa ? dataQa + '-' : ''}save` },
|
72
68
|
react_1.default.createElement("div", { className: b('content', { cursor: Boolean(uid), theme }) },
|
73
69
|
react_1.default.createElement("span", { className: b('icon') },
|
@@ -1,10 +1,6 @@
|
|
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
|
-
*/
|
8
4
|
metrikaGoal?: string;
|
9
5
|
};
|
10
6
|
export declare const Sharing: React.FC<SharingProps>;
|
@@ -27,9 +27,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
27
|
};
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
29
|
exports.Sharing = void 0;
|
30
|
-
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
31
|
-
const uikit_1 = require("@gravity-ui/uikit");
|
32
30
|
const react_1 = __importStar(require("react"));
|
31
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
33
32
|
const MobileContext_1 = require("../../../contexts/MobileContext");
|
34
33
|
const PostPageContext_1 = require("../../../contexts/PostPageContext");
|
35
34
|
const RouterContext_1 = require("../../../contexts/RouterContext");
|
@@ -37,25 +36,19 @@ const metrika_js_1 = __importDefault(require("../../../counters/metrika.js"));
|
|
37
36
|
const utils_1 = require("../../../counters/utils");
|
38
37
|
const i18n_1 = require("../../../i18n");
|
39
38
|
const ShareArrowUp_1 = require("../../../icons/ShareArrowUp");
|
40
|
-
const common_1 = require("../../../models/common");
|
41
39
|
const cn_1 = require("../../../utils/cn");
|
42
|
-
const
|
40
|
+
const common_1 = require("../../../utils/common");
|
43
41
|
// @ts-ignore
|
44
42
|
const b = (0, cn_1.block)('post-info');
|
45
43
|
const Sharing = ({ theme, metrikaGoal }) => {
|
46
44
|
const router = (0, react_1.useContext)(RouterContext_1.RouterContext);
|
47
45
|
const isMobile = (0, react_1.useContext)(MobileContext_1.MobileContext);
|
48
46
|
const { shareOptions } = (0, react_1.useContext)(PostPageContext_1.PostPageContext);
|
49
|
-
const
|
50
|
-
const handleMetrika = (0, react_1.useCallback)(() => {
|
47
|
+
const handleMetrika = () => {
|
51
48
|
metrika_js_1.default.reachGoal(utils_1.MetrikaCounter.CrossSite, metrikaGoal);
|
52
|
-
}
|
53
|
-
const handleAnalytics = (0, react_1.useCallback)(() => {
|
54
|
-
handleAnalyticsGlobal();
|
55
|
-
handleMetrika();
|
56
|
-
}, [handleAnalyticsGlobal, handleMetrika]);
|
49
|
+
};
|
57
50
|
return (react_1.default.createElement("div", { className: b('item') },
|
58
51
|
react_1.default.createElement("span", { className: b('icon') },
|
59
|
-
react_1.default.createElement(uikit_1.SharePopover, { url: (0,
|
52
|
+
react_1.default.createElement(uikit_1.SharePopover, { url: (0, common_1.getAbsolutePath)(router), className: b('share'), iconClass: b('share-icon'), switcherClassName: b('switcher', { theme }), tooltipClassName: b('popup'), useWebShareApi: isMobile, direction: 'column', buttonTitle: (0, i18n_1.i18)(i18n_1.Keyset.ActionShare), customIcon: ShareArrowUp_1.ShareArrowUp, placement: "bottom", openByHover: false, shareOptions: shareOptions, handleMetrika: handleMetrika }))));
|
60
53
|
};
|
61
54
|
exports.Sharing = Sharing;
|
@@ -8,10 +8,10 @@ const react_1 = __importDefault(require("react"));
|
|
8
8
|
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
9
9
|
const uikit_1 = require("@gravity-ui/uikit");
|
10
10
|
const i18n_1 = require("../../i18n");
|
11
|
+
const cn_1 = require("../../utils/cn");
|
11
12
|
const Paginator_1 = require("../Paginator/Paginator");
|
12
13
|
const PostCard_1 = require("../PostCard/PostCard");
|
13
14
|
const PostsEmpty_1 = require("../PostsEmpty/PostsEmpty");
|
14
|
-
const cn_1 = require("../../utils/cn");
|
15
15
|
const b = (0, cn_1.block)('posts');
|
16
16
|
const Posts = ({ containerId, pinnedPostOnPage, currentPage, postsOnPage, isShowMoreVisible, errorShowMore, postCountOnPage, perPageInQuery, isFetching, isShowMoreFetching, handleShowMore, handlePageChange, pageCountForShowSupportButtons, }) => (react_1.default.createElement("div", { className: b() },
|
17
17
|
react_1.default.createElement("div", { id: containerId, className: b('cards-container') },
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.PostsEmpty = void 0;
|
7
7
|
const react_1 = __importDefault(require("react"));
|
8
|
-
const cn_1 = require("../../utils/cn");
|
9
8
|
const i18n_1 = require("../../i18n");
|
9
|
+
const cn_1 = require("../../utils/cn");
|
10
10
|
const b = (0, cn_1.block)('posts-empty');
|
11
11
|
const PostsEmpty = () => (react_1.default.createElement("div", { className: b('container') },
|
12
12
|
react_1.default.createElement("div", { className: b('title') }, (0, i18n_1.i18)(i18n_1.Keyset.TitleEmptyContainer)),
|
@@ -27,12 +27,12 @@ exports.Search = void 0;
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
28
28
|
const lodash_1 = require("lodash");
|
29
29
|
const uikit_1 = require("@gravity-ui/uikit");
|
30
|
-
const ButtonWithIcon_1 = require("../ButtonWithIcon/ButtonWithIcon");
|
31
30
|
const useIsIPhone_1 = require("../../hooks/useIsIPhone");
|
31
|
+
const i18n_1 = require("../../i18n");
|
32
32
|
const Close_1 = require("../../icons/Close");
|
33
33
|
const SearchIcon_1 = require("../../icons/SearchIcon");
|
34
|
-
const i18n_1 = require("../../i18n");
|
35
34
|
const cn_1 = require("../../utils/cn");
|
35
|
+
const ButtonWithIcon_1 = require("../ButtonWithIcon/ButtonWithIcon");
|
36
36
|
const b = (0, cn_1.block)('search');
|
37
37
|
const SEARCH_ICON_SIZE = 16;
|
38
38
|
const CLOSE_ICON_SIZE = 12;
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.Wrapper = void 0;
|
7
7
|
const react_1 = __importDefault(require("react"));
|
8
|
-
const cn_1 = require("../../utils/cn");
|
9
8
|
const constants_1 = require("../../constants");
|
9
|
+
const cn_1 = require("../../utils/cn");
|
10
10
|
const b = (0, cn_1.block)('wrapper');
|
11
11
|
const Wrapper = ({ children, paddings = constants_1.DEFAULT_PADDINGS, className, dataQa, }) => (react_1.default.createElement("section", { className: b({
|
12
12
|
['padding-top']: (paddings === null || paddings === void 0 ? void 0 : paddings.top) || 'xs',
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import { DeviceContextProps } from '../contexts/DeviceContext';
|
3
3
|
import { RouterContextProps } from '../contexts/RouterContext';
|
4
4
|
import { UserContextProps } from '../contexts/UserContext';
|
5
|
-
import { DeviceContextProps } from '../contexts/DeviceContext';
|
6
5
|
import { ThemeValueType } from '../contexts/theme/ThemeValueContext';
|
7
6
|
import { Locale } from '../models/locale';
|
8
7
|
export interface BlogConstructorProviderProps {
|
@@ -12,7 +11,6 @@ export interface BlogConstructorProviderProps {
|
|
12
11
|
theme?: ThemeValueType;
|
13
12
|
user?: UserContextProps;
|
14
13
|
device?: DeviceContextProps;
|
15
|
-
analytics?: AnalyticsContextProps;
|
16
14
|
children?: React.ReactNode;
|
17
15
|
}
|
18
16
|
export declare const BlogConstructorProvider: React.FC<BlogConstructorProviderProps>;
|
@@ -25,15 +25,14 @@ 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
|
29
|
-
const
|
28
|
+
const constants_1 = require("../constants");
|
29
|
+
const DeviceContext_1 = require("../contexts/DeviceContext");
|
30
30
|
const LocaleContext_1 = require("../contexts/LocaleContext");
|
31
|
+
const MobileContext_1 = require("../contexts/MobileContext");
|
31
32
|
const RouterContext_1 = require("../contexts/RouterContext");
|
32
33
|
const UserContext_1 = require("../contexts/UserContext");
|
33
|
-
const DeviceContext_1 = require("../contexts/DeviceContext");
|
34
34
|
const ThemeValueContext_1 = require("../contexts/theme/ThemeValueContext");
|
35
|
-
const constants_1 =
|
36
|
-
const BlogConstructorProvider = ({ isMobile, locale = {}, router = {}, theme = constants_1.DEFAULT_THEME, user = {}, device = {}, analytics = {}, children, }) => {
|
35
|
+
const BlogConstructorProvider = ({ isMobile, locale = {}, router = {}, theme = constants_1.DEFAULT_THEME, user = {}, device = {}, children, }) => {
|
37
36
|
const context = [
|
38
37
|
react_1.default.createElement(ThemeValueContext_1.ThemeValueContext.Provider, { value: { themeValue: theme }, key: "theme-context" }),
|
39
38
|
react_1.default.createElement(LocaleContext_1.LocaleContext.Provider, { value: { locale }, key: "locale-context" }),
|
@@ -41,7 +40,6 @@ const BlogConstructorProvider = ({ isMobile, locale = {}, router = {}, theme = c
|
|
41
40
|
react_1.default.createElement(MobileContext_1.MobileContext.Provider, { value: Boolean(isMobile), key: "is-mobile-context" }),
|
42
41
|
react_1.default.createElement(UserContext_1.UserContext.Provider, { value: user, key: "user-context" }),
|
43
42
|
react_1.default.createElement(DeviceContext_1.DeviceContext.Provider, { value: device, key: "device-context" }),
|
44
|
-
react_1.default.createElement(page_constructor_1.AnalyticsContext.Provider, { value: analytics, key: "analytics-context" }),
|
45
43
|
].reduceRight((prev, provider) => react_1.default.cloneElement(provider, {}, prev), children);
|
46
44
|
return react_1.default.createElement(react_1.Fragment, null, context);
|
47
45
|
};
|
@@ -1,17 +1,17 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const
|
3
|
+
const Author_1 = require("../blocks/Author/Author");
|
4
|
+
const Banner_1 = require("../blocks/Banner/Banner");
|
5
|
+
const CTA_1 = require("../blocks/CTA/CTA");
|
6
|
+
const ColoredText_1 = require("../blocks/ColoredText/ColoredText");
|
7
|
+
const Feed_1 = require("../blocks/Feed/Feed");
|
4
8
|
const Header_1 = require("../blocks/Header/Header");
|
5
|
-
const YFM_1 = require("../blocks/YFM/YFM");
|
6
9
|
const Layout_1 = require("../blocks/Layout/Layout");
|
7
10
|
const Media_1 = require("../blocks/Media/Media");
|
8
|
-
const CTA_1 = require("../blocks/CTA/CTA");
|
9
|
-
const ColoredText_1 = require("../blocks/ColoredText/ColoredText");
|
10
|
-
const Author_1 = require("../blocks/Author/Author");
|
11
|
-
const Suggest_1 = require("../blocks/Suggest/Suggest");
|
12
|
-
const Banner_1 = require("../blocks/Banner/Banner");
|
13
11
|
const Meta_1 = require("../blocks/Meta/Meta");
|
14
|
-
const
|
12
|
+
const Suggest_1 = require("../blocks/Suggest/Suggest");
|
13
|
+
const YFM_1 = require("../blocks/YFM/YFM");
|
14
|
+
const common_1 = require("../models/common");
|
15
15
|
const blocks = {
|
16
16
|
[common_1.BlockType.YFM]: YFM_1.YFM,
|
17
17
|
[common_1.BlockType.Layout]: Layout_1.Layout,
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import { NavigationData, PageConstructorProviderProps, PageContent } from '@gravity-ui/page-constructor';
|
2
|
+
import { GetPostsType, MetaProps, PostsProps, Service, SetQueryType, Tag, ToggleLikeCallbackType } from '../../models/common';
|
3
3
|
export type BlogPageProps = {
|
4
4
|
content: PageContent;
|
5
5
|
posts: PostsProps;
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.BlogPage = void 0;
|
7
7
|
const react_1 = __importDefault(require("react"));
|
8
8
|
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
9
|
-
const FeedContext_1 = require("../../contexts/FeedContext");
|
10
|
-
const LikesContext_1 = require("../../contexts/LikesContext");
|
11
9
|
const MetaWrapper_1 = require("../../components/MetaWrapper/MetaWrapper");
|
12
10
|
const blocksMap_1 = __importDefault(require("../../constructor/blocksMap"));
|
11
|
+
const FeedContext_1 = require("../../contexts/FeedContext");
|
12
|
+
const LikesContext_1 = require("../../contexts/LikesContext");
|
13
13
|
const BlogPage = ({ content, posts, tags, services, getPosts, metaData, toggleLike, navigation, settings, pageCountForShowSupportButtons, }) => (react_1.default.createElement("main", null,
|
14
14
|
react_1.default.createElement(LikesContext_1.LikesContext.Provider, { value: {
|
15
15
|
toggleLike: toggleLike,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import { NavigationData, PageConstructorProviderProps, PageContent } from '@gravity-ui/page-constructor';
|
3
3
|
import { ShareOptions } from '@gravity-ui/uikit';
|
4
|
-
import { PostData, ToggleLikeCallbackType
|
4
|
+
import { MetaProps, PostData, ToggleLikeCallbackType } from '../../models/common';
|
5
5
|
export interface BlogPostPageProps {
|
6
6
|
suggestedPosts: PostData[];
|
7
7
|
metaData?: MetaProps;
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.BlogPostPage = void 0;
|
7
7
|
const react_1 = __importDefault(require("react"));
|
8
8
|
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
9
|
+
const MetaWrapper_1 = require("../../components/MetaWrapper/MetaWrapper");
|
9
10
|
const blocksMap_1 = __importDefault(require("../../constructor/blocksMap"));
|
10
|
-
const PostPageContext_1 = require("../../contexts/PostPageContext");
|
11
11
|
const LikesContext_1 = require("../../contexts/LikesContext");
|
12
|
+
const PostPageContext_1 = require("../../contexts/PostPageContext");
|
12
13
|
const useLikes_1 = require("../../hooks/useLikes");
|
13
|
-
const MetaWrapper_1 = require("../../components/MetaWrapper/MetaWrapper");
|
14
14
|
const BlogPostPage = ({ metaData, suggestedPosts, likes, content, post, settings, navigation, shareOptions, }) => {
|
15
15
|
const { hasUserLike, likesCount, handleLike } = (0, useLikes_1.useLikes)({
|
16
16
|
hasLike: likes === null || likes === void 0 ? void 0 : likes.hasUserLike,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { PostData,
|
2
|
+
import { GetPostsType, PostData, Service, SetQueryType, Tag } from '../models/common';
|
3
3
|
export interface FeedContextProps {
|
4
4
|
posts?: PostData[];
|
5
5
|
pinnedPost?: PostData;
|
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.ThemeProvider = void 0;
|
7
7
|
const react_1 = __importDefault(require("react"));
|
8
|
+
const constants_1 = require("../../constants");
|
8
9
|
const ThemeContext_1 = require("./ThemeContext");
|
9
10
|
const ThemeValueContext_1 = require("./ThemeValueContext");
|
10
|
-
const constants_1 = require("../../constants");
|
11
11
|
class ThemeProvider extends react_1.default.Component {
|
12
12
|
constructor() {
|
13
13
|
super(...arguments);
|
@@ -21,10 +21,6 @@ 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
|
-
*/
|
28
24
|
declare const Goal: {
|
29
25
|
SUPPORT_OPEN_FORM: string;
|
30
26
|
SUPPORT_STEP_1_SUBMIT: string;
|
@@ -1,10 +1,6 @@
|
|
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
|
-
*/
|
8
4
|
const Goal = {
|
9
5
|
SUPPORT_OPEN_FORM: 'SUPPORTOPENFORM',
|
10
6
|
SUPPORT_STEP_1_SUBMIT: 'SUPPORTSTEP1SUBMIT',
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { ReactElement } from 'react';
|
2
2
|
import { ContentBlockProps, HeaderBlockProps, MediaProps as PCMediaProps, TextTheme } from '@gravity-ui/page-constructor';
|
3
|
+
import { BlockType, ClassNameProps, PostData } from './common';
|
3
4
|
import { PaddingsYFMProps } from './paddings';
|
4
|
-
import { ClassNameProps, PostData, BlockType } from './common';
|
5
5
|
export type AuthorProps = ClassNameProps & {
|
6
6
|
authorId: number;
|
7
7
|
image: string;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { IDevice, IBrowser } from 'ua-parser-js';
|
2
1
|
import { ReactNode } from 'react';
|
2
|
+
import { IBrowser, IDevice } from 'ua-parser-js';
|
3
3
|
import { HeaderBlockProps as PageConstructorHeaderBlockProps } from '@gravity-ui/page-constructor';
|
4
4
|
import { Locale } from '../models/locale';
|
5
5
|
export declare enum Theme {
|
@@ -18,6 +18,7 @@ export type Author = {
|
|
18
18
|
secondName: string | null;
|
19
19
|
description: string | null;
|
20
20
|
fullDescription: string | null;
|
21
|
+
shortDescription: string | null;
|
21
22
|
} & {
|
22
23
|
[x: string]: string | null;
|
23
24
|
};
|
@@ -149,14 +150,3 @@ export type HandleChangeQueryParams = (params: Query) => void;
|
|
149
150
|
export type SetQueryType = (params: Query, options?: {
|
150
151
|
[y: string]: boolean;
|
151
152
|
}) => Promise<void> | void;
|
152
|
-
export declare enum DefaultEventNames {
|
153
|
-
ShareButton = "share-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"
|
162
|
-
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.BlockType = exports.Theme = void 0;
|
4
4
|
var Theme;
|
5
5
|
(function (Theme) {
|
6
6
|
Theme["Light"] = "light";
|
@@ -19,16 +19,4 @@ var BlockType;
|
|
19
19
|
BlockType["Suggest"] = "blog-suggest-block";
|
20
20
|
BlockType["Meta"] = "blog-meta-block";
|
21
21
|
BlockType["Feed"] = "blog-feed-block";
|
22
|
-
})(BlockType = exports.BlockType || (exports.BlockType = {}));
|
23
|
-
var DefaultEventNames;
|
24
|
-
(function (DefaultEventNames) {
|
25
|
-
DefaultEventNames["ShareButton"] = "share-button-click";
|
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";
|
34
|
-
})(DefaultEventNames = exports.DefaultEventNames || (exports.DefaultEventNames = {}));
|
22
|
+
})(BlockType = exports.BlockType || (exports.BlockType = {}));
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/// <reference types="lodash" />
|
2
2
|
import { ContentBlockProps, HeaderBreadCrumbsProps, MetrikaGoal, NewMetrikaGoal } from '@gravity-ui/page-constructor';
|
3
3
|
import { RouterContextProps } from '../contexts/RouterContext';
|
4
|
-
import {
|
4
|
+
import { GetPostsRequest, Query, Tag } from '../models/common';
|
5
5
|
export interface QueryParam {
|
6
6
|
name: string;
|
7
7
|
value?: string | number | null;
|
@@ -15,8 +15,8 @@ exports.scrollOnPageChange = exports.getFeedQueryParams = exports.getBlogElement
|
|
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");
|
18
|
-
const i18n_1 = require("../i18n");
|
19
18
|
const constants_1 = require("../blocks/constants");
|
19
|
+
const i18n_1 = require("../i18n");
|
20
20
|
function getAbsolutePath(router, url) {
|
21
21
|
if (!router || !router.pathname) {
|
22
22
|
return url !== null && url !== void 0 ? url : '';
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import React, {
|
2
|
-
import { Author as PCAuthor
|
3
|
-
import { PostPageContext } from '../../contexts/PostPageContext';
|
1
|
+
import React, { useContext, useMemo } from 'react';
|
2
|
+
import { AuthorType, Author as PCAuthor } from '@gravity-ui/page-constructor';
|
4
3
|
import { Wrapper } from '../../components/Wrapper/Wrapper';
|
4
|
+
import { PostPageContext } from '../../contexts/PostPageContext';
|
5
5
|
import { PaddingsDirections } from '../../models/paddings';
|
6
6
|
import { block } from '../../utils/cn';
|
7
7
|
import './Author.css';
|
@@ -18,10 +18,10 @@ export const Author = (props) => {
|
|
18
18
|
return {
|
19
19
|
firstName: (author === null || author === void 0 ? void 0 : author.firstName) || '',
|
20
20
|
secondName: (author === null || author === void 0 ? void 0 : author.secondName) || '',
|
21
|
-
description: (author === null || author === void 0 ? void 0 : author.
|
21
|
+
description: (author === null || author === void 0 ? void 0 : author.shortDescription) || '',
|
22
22
|
avatar: authorAvatar,
|
23
23
|
};
|
24
|
-
}, [author === null || author === void 0 ? void 0 : author.avatar, author === null || author === void 0 ? void 0 : author.firstName, author === null || author === void 0 ? void 0 : author.
|
24
|
+
}, [author === null || author === void 0 ? void 0 : author.avatar, author === null || author === void 0 ? void 0 : author.firstName, author === null || author === void 0 ? void 0 : author.shortDescription, author === null || author === void 0 ? void 0 : author.secondName, image]);
|
25
25
|
if (!(authorItem === null || authorItem === void 0 ? void 0 : authorItem.firstName) || !(authorItem === null || authorItem === void 0 ? void 0 : authorItem.secondName)) {
|
26
26
|
return null;
|
27
27
|
}
|
@@ -12,10 +12,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
12
12
|
import React from 'react';
|
13
13
|
import { Content, Image } from '@gravity-ui/page-constructor';
|
14
14
|
import { Wrapper } from '../../components/Wrapper/Wrapper';
|
15
|
-
import { getBlogElementMetrika, updateContentSizes } from '../../utils/common';
|
16
|
-
import { block } from '../../utils/cn';
|
17
|
-
import { PaddingsDirections } from '../../models/paddings';
|
18
15
|
import { BlogMetrikaGoalIds } from '../../constants';
|
16
|
+
import { PaddingsDirections } from '../../models/paddings';
|
17
|
+
import { block } from '../../utils/cn';
|
18
|
+
import { getBlogElementMetrika, updateContentSizes } from '../../utils/common';
|
19
19
|
import './Banner.css';
|
20
20
|
const b = block('banner');
|
21
21
|
export const Banner = (_a) => {
|
@@ -26,15 +26,12 @@ 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
|
-
*/
|
33
29
|
const metrikaGoal = {
|
34
30
|
name: BlogMetrikaGoalIds.bannerCommon,
|
35
31
|
isCrossSite: true,
|
36
32
|
};
|
37
33
|
(_b = contentData.buttons) === null || _b === void 0 ? void 0 : _b.forEach((button) => {
|
34
|
+
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
38
35
|
button.metrikaGoals = getBlogElementMetrika(metrikaGoal, button.metrikaGoals);
|
39
36
|
});
|
40
37
|
return (React.createElement(Wrapper, { paddings: {
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { Content } from '@gravity-ui/page-constructor';
|
3
3
|
import { Wrapper } from '../../components/Wrapper/Wrapper';
|
4
|
-
import { getBlogElementMetrika, updateContentSizes } from '../../utils/common';
|
5
|
-
import { PaddingsDirections } from '../../models/paddings';
|
6
4
|
import { BlogMetrikaGoalIds } from '../../constants';
|
5
|
+
import { PaddingsDirections } from '../../models/paddings';
|
7
6
|
import { block } from '../../utils/cn';
|
7
|
+
import { getBlogElementMetrika, updateContentSizes } from '../../utils/common';
|
8
8
|
import './CTA.css';
|
9
9
|
const b = block('cta');
|
10
10
|
const MAX_COLUMN_COUNT = 4, MIN_COLUMN_COUNT = 2, DEFAULT_COLUMN_COUNT = 3;
|
@@ -16,10 +16,6 @@ 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
|
-
*/
|
23
19
|
const metrikaGoal = {
|
24
20
|
name: BlogMetrikaGoalIds.cta,
|
25
21
|
isCrossSite: true,
|
@@ -31,6 +27,7 @@ export const CTA = ({ items, paddingTop, paddingBottom }) => {
|
|
31
27
|
var _a;
|
32
28
|
const contentData = updateContentSizes(content);
|
33
29
|
(_a = contentData.links) === null || _a === void 0 ? void 0 : _a.forEach((link) => {
|
30
|
+
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
34
31
|
link.metrikaGoals = getBlogElementMetrika(metrikaGoal, link.metrikaGoals);
|
35
32
|
});
|
36
33
|
return (React.createElement("div", { key: index, className: b('button', {
|
@@ -13,8 +13,8 @@ import React from 'react';
|
|
13
13
|
import { BackgroundImage, Content } from '@gravity-ui/page-constructor';
|
14
14
|
import { Wrapper } from '../../components/Wrapper/Wrapper';
|
15
15
|
import { PaddingsDirections } from '../../models/paddings';
|
16
|
-
import { updateContentSizes } from '../../utils/common';
|
17
16
|
import { block } from '../../utils/cn';
|
17
|
+
import { updateContentSizes } from '../../utils/common';
|
18
18
|
import './ColoredText.css';
|
19
19
|
const b = block('colored-text');
|
20
20
|
export const ColoredText = (_a) => {
|
@@ -1,26 +1,16 @@
|
|
1
|
-
import React, {
|
1
|
+
import React, { useCallback, useContext, useEffect, useMemo, useReducer } from 'react';
|
2
2
|
import { Icon } from '@gravity-ui/uikit';
|
3
|
-
import { useAnalytics } from '@gravity-ui/page-constructor';
|
4
|
-
import { FeedContext } from '../../contexts/FeedContext';
|
5
|
-
import { RouterContext } from '../../contexts/RouterContext';
|
6
|
-
import { LocaleContext } from '../../contexts/LocaleContext';
|
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
|
-
*/
|
12
|
-
import { BlogMetrikaGoalIds } from '../../constants';
|
13
|
-
import { getFeedQueryParams, scrollOnPageChange } from '../../utils/common';
|
14
3
|
import { FeedHeader } from '../../components/FeedHeader/FeedHeader';
|
15
|
-
import { PostsError } from '../../components/PostsError/PostsError';
|
16
4
|
import { Posts } from '../../components/Posts/Posts';
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
5
|
+
import { PostsError } from '../../components/PostsError/PostsError';
|
6
|
+
import { BlogMetrikaGoalIds } from '../../constants';
|
7
|
+
import { FeedContext } from '../../contexts/FeedContext';
|
8
|
+
import { LocaleContext } from '../../contexts/LocaleContext';
|
9
|
+
import { RouterContext } from '../../contexts/RouterContext';
|
21
10
|
import metrika from '../../counters/metrika.js';
|
22
11
|
import { MetrikaCounter } from '../../counters/utils';
|
23
|
-
import {
|
12
|
+
import { getFeedQueryParams, scrollOnPageChange } from '../../utils/common';
|
13
|
+
import { DEFAULT_PAGE, DEFAULT_ROWS_PER_PAGE } from '../constants';
|
24
14
|
import { ActionTypes, reducer } from './reducer';
|
25
15
|
const CONTAINER_ID = 'blog-cards';
|
26
16
|
const PAGE_QUERY = 'page';
|
@@ -30,7 +20,6 @@ export const Feed = ({ image }) => {
|
|
30
20
|
const { posts, totalCount, tags, services, pinnedPost, getPosts, pageCountForShowSupportButtons, } = useContext(FeedContext);
|
31
21
|
const router = useContext(RouterContext);
|
32
22
|
const { locale } = useContext(LocaleContext);
|
33
|
-
const handleAnalytics = useAnalytics(DefaultEventNames.ShowMore);
|
34
23
|
const [{ errorLoad, errorShowMore, isFetching, isShowMoreFetching, isShowMoreVisible, lastLoadedCount, postCountOnPage, postsOnPage, pinnedPostOnPage, currentPage, queryParams, }, dispatch,] = useReducer(reducer, {
|
35
24
|
errorLoad: false,
|
36
25
|
errorShowMore: false,
|
@@ -94,12 +83,7 @@ export const Feed = ({ image }) => {
|
|
94
83
|
}, [fetchData]);
|
95
84
|
const handleShowMore = async () => {
|
96
85
|
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
|
-
*/
|
101
86
|
metrika.reachGoal(MetrikaCounter.CrossSite, BlogMetrikaGoalIds.showMore);
|
102
|
-
handleAnalytics();
|
103
87
|
try {
|
104
88
|
const fetchedData = await fetchData(currentPage + 1);
|
105
89
|
handleChangeQueryParams({
|
@@ -1,16 +1,12 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { HeaderBlock } from '@gravity-ui/page-constructor';
|
3
|
-
import { PostPageContext } from '../../contexts/PostPageContext';
|
4
|
-
import { LocaleContext } from '../../contexts/LocaleContext';
|
5
3
|
import { PostInfo } from '../../components/PostInfo/PostInfo';
|
6
4
|
import { Wrapper } from '../../components/Wrapper/Wrapper';
|
5
|
+
import { BlogMetrikaGoalIds } from '../../constants';
|
6
|
+
import { LocaleContext } from '../../contexts/LocaleContext';
|
7
|
+
import { PostPageContext } from '../../contexts/PostPageContext';
|
7
8
|
import { PaddingsDirections } from '../../models/paddings';
|
8
9
|
import { getBreadcrumbs } from '../../utils/common';
|
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
|
-
*/
|
14
10
|
const metrikaGoals = {
|
15
11
|
sharing: BlogMetrikaGoalIds.shareTop,
|
16
12
|
save: BlogMetrikaGoalIds.saveTop,
|
@@ -1,19 +1,15 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { HeaderBreadcrumbs, YFMWrapper } from '@gravity-ui/page-constructor';
|
3
|
-
import { PostPageContext } from '../../contexts/PostPageContext';
|
4
|
-
import { LocaleContext } from '../../contexts/LocaleContext';
|
5
|
-
import { Wrapper } from '../../components/Wrapper/Wrapper';
|
6
3
|
import { PostInfo } from '../../components/PostInfo/PostInfo';
|
7
|
-
import {
|
8
|
-
import { getBreadcrumbs } from '../../utils/common';
|
4
|
+
import { Wrapper } from '../../components/Wrapper/Wrapper';
|
9
5
|
import { BlogMetrikaGoalIds } from '../../constants';
|
6
|
+
import { LocaleContext } from '../../contexts/LocaleContext';
|
7
|
+
import { PostPageContext } from '../../contexts/PostPageContext';
|
8
|
+
import { PaddingsDirections } from '../../models/paddings';
|
10
9
|
import { block } from '../../utils/cn';
|
10
|
+
import { getBreadcrumbs } from '../../utils/common';
|
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
|
-
*/
|
17
13
|
const metrikaGoals = {
|
18
14
|
sharing: BlogMetrikaGoalIds.shareBottom,
|
19
15
|
save: BlogMetrikaGoalIds.saveBottom,
|