@gravity-ui/blog-constructor 5.16.1 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +5 -5
  2. package/build/cjs/blocks/Banner/Banner.js +7 -9
  3. package/build/cjs/blocks/CTA/CTA.js +7 -9
  4. package/build/cjs/blocks/Feed/Feed.js +5 -12
  5. package/build/cjs/blocks/Header/Header.js +10 -14
  6. package/build/cjs/blocks/Media/Media.js +1 -0
  7. package/build/cjs/blocks/Meta/Meta.js +11 -15
  8. package/build/cjs/blocks/Suggest/Suggest.js +8 -11
  9. package/build/cjs/components/FeedHeader/components/Controls/Controls.css +19 -5
  10. package/build/cjs/components/FeedHeader/components/Controls/Controls.d.ts +1 -2
  11. package/build/cjs/components/FeedHeader/components/Controls/Controls.js +22 -27
  12. package/build/cjs/components/FeedHeader/components/Controls/customRenders.js +1 -1
  13. package/build/cjs/components/FeedHeader/components/CustomSwitcher/CustomSwitcher.css +1 -1
  14. package/build/cjs/components/Paginator/Paginator.js +16 -19
  15. package/build/cjs/components/Paginator/components/NavigationButton.js +1 -1
  16. package/build/cjs/components/PostCard/PostCard.d.ts +3 -6
  17. package/build/cjs/components/PostCard/PostCard.js +2 -2
  18. package/build/cjs/components/PostInfo/PostInfo.d.ts +4 -10
  19. package/build/cjs/components/PostInfo/PostInfo.js +4 -4
  20. package/build/cjs/components/PostInfo/SuggestPostInfo.js +4 -1
  21. package/build/cjs/components/PostInfo/components/ReadingTime.js +1 -1
  22. package/build/cjs/components/PostInfo/components/Save.d.ts +4 -6
  23. package/build/cjs/components/PostInfo/components/Save.js +3 -6
  24. package/build/cjs/components/PostInfo/components/Sharing.d.ts +3 -5
  25. package/build/cjs/components/PostInfo/components/Sharing.js +4 -10
  26. package/build/cjs/components/Posts/Posts.js +3 -3
  27. package/build/cjs/components/PostsEmpty/PostsEmpty.js +2 -2
  28. package/build/cjs/components/PostsError/PostsError.js +3 -3
  29. package/build/cjs/components/PromptSignIn/PromptSignIn.js +2 -2
  30. package/build/cjs/components/Search/Search.js +1 -1
  31. package/build/cjs/constants.d.ts +2 -1
  32. package/build/cjs/constants.js +20 -19
  33. package/build/cjs/constructor/BlogConstructorProvider.js +1 -0
  34. package/build/cjs/containers/BlogPage/BlogPage.d.ts +1 -2
  35. package/build/cjs/containers/BlogPostPage/BlogPostPage.css +1 -1
  36. package/build/cjs/contexts/FeedContext.d.ts +1 -2
  37. package/build/cjs/contexts/LocaleContext.js +2 -2
  38. package/build/cjs/counters/metrika.js +0 -3
  39. package/build/cjs/counters/utils.d.ts +1 -1
  40. package/build/cjs/counters/utils.js +7 -7
  41. package/build/cjs/i18n/index.d.ts +1 -3
  42. package/build/cjs/i18n/index.js +8 -10
  43. package/build/cjs/index.d.ts +0 -1
  44. package/build/cjs/index.js +1 -3
  45. package/build/cjs/models/common.d.ts +1 -4
  46. package/build/cjs/models/locale.d.ts +1 -4
  47. package/build/cjs/models/locale.js +1 -6
  48. package/build/cjs/utils/common.d.ts +15 -3
  49. package/build/cjs/utils/common.js +20 -19
  50. package/build/esm/blocks/Banner/Banner.js +8 -10
  51. package/build/esm/blocks/CTA/CTA.js +8 -10
  52. package/build/esm/blocks/Feed/Feed.js +8 -15
  53. package/build/esm/blocks/Header/Header.js +12 -16
  54. package/build/esm/blocks/Media/Media.js +1 -0
  55. package/build/esm/blocks/Meta/Meta.js +13 -17
  56. package/build/esm/blocks/Suggest/Suggest.js +9 -12
  57. package/build/esm/components/FeedHeader/components/Controls/Controls.css +19 -5
  58. package/build/esm/components/FeedHeader/components/Controls/Controls.d.ts +1 -2
  59. package/build/esm/components/FeedHeader/components/Controls/Controls.js +25 -30
  60. package/build/esm/components/FeedHeader/components/Controls/customRenders.js +2 -2
  61. package/build/esm/components/FeedHeader/components/CustomSwitcher/CustomSwitcher.css +1 -1
  62. package/build/esm/components/Paginator/Paginator.js +18 -21
  63. package/build/esm/components/Paginator/components/NavigationButton.js +2 -2
  64. package/build/esm/components/PostCard/PostCard.d.ts +3 -6
  65. package/build/esm/components/PostCard/PostCard.js +2 -2
  66. package/build/esm/components/PostInfo/PostInfo.d.ts +4 -10
  67. package/build/esm/components/PostInfo/PostInfo.js +4 -4
  68. package/build/esm/components/PostInfo/SuggestPostInfo.js +4 -1
  69. package/build/esm/components/PostInfo/components/ReadingTime.js +2 -2
  70. package/build/esm/components/PostInfo/components/Save.d.ts +4 -6
  71. package/build/esm/components/PostInfo/components/Save.js +3 -6
  72. package/build/esm/components/PostInfo/components/Sharing.d.ts +3 -5
  73. package/build/esm/components/PostInfo/components/Sharing.js +5 -11
  74. package/build/esm/components/Posts/Posts.js +4 -4
  75. package/build/esm/components/PostsEmpty/PostsEmpty.js +3 -3
  76. package/build/esm/components/PostsError/PostsError.js +4 -4
  77. package/build/esm/components/PromptSignIn/PromptSignIn.js +3 -3
  78. package/build/esm/components/Search/Search.js +2 -2
  79. package/build/esm/constants.d.ts +2 -1
  80. package/build/esm/constants.js +19 -18
  81. package/build/esm/constructor/BlogConstructorProvider.js +2 -1
  82. package/build/esm/containers/BlogPage/BlogPage.d.ts +1 -2
  83. package/build/esm/containers/BlogPostPage/BlogPostPage.css +1 -1
  84. package/build/esm/contexts/FeedContext.d.ts +1 -2
  85. package/build/esm/contexts/LocaleContext.js +1 -1
  86. package/build/esm/counters/metrika.js +0 -3
  87. package/build/esm/counters/utils.d.ts +1 -1
  88. package/build/esm/counters/utils.js +6 -6
  89. package/build/esm/i18n/index.d.ts +1 -3
  90. package/build/esm/i18n/index.js +7 -9
  91. package/build/esm/index.d.ts +0 -1
  92. package/build/esm/index.js +0 -1
  93. package/build/esm/models/common.d.ts +1 -4
  94. package/build/esm/models/locale.d.ts +1 -4
  95. package/build/esm/models/locale.js +0 -5
  96. package/build/esm/utils/common.d.ts +15 -3
  97. package/build/esm/utils/common.js +18 -17
  98. package/package.json +15 -14
  99. package/server/data/contentFilter.d.ts +1 -1
  100. package/server/data/contentFilter.js +2 -1
  101. package/server/data/transformPageContent.d.ts +2 -2
  102. package/server/data/transformPost.d.ts +7 -2
  103. package/server/data/transformPost.js +1 -1
  104. package/server/index.d.ts +1 -1
  105. package/server/models/common.d.ts +1 -4
  106. package/server/models/locale.d.ts +1 -4
  107. package/server/models/locale.js +1 -6
  108. package/styles/storybook/common.scss +8 -0
  109. package/styles/storybook/index.scss +1 -1
  110. package/styles/styles.css +115 -0
  111. package/styles/styles.scss +1 -0
  112. package/build/cjs/configure.d.ts +0 -5
  113. package/build/cjs/configure.js +0 -8
  114. package/build/esm/configure.d.ts +0 -5
  115. package/build/esm/configure.js +0 -4
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { MetrikaGoal } from '@gravity-ui/page-constructor';
2
+ import { AnalyticsEventsProp } from '@gravity-ui/page-constructor';
3
3
  import { PostCardSize, PostCardTitleHeadingLevel, PostData } from '../../models/common';
4
4
  import './PostCard.css';
5
5
  type PostCardProps = {
@@ -8,10 +8,7 @@ type PostCardProps = {
8
8
  showTag?: boolean;
9
9
  size?: PostCardSize;
10
10
  titleHeadingLevel?: PostCardTitleHeadingLevel;
11
- /**
12
- * @deprecated Metrika will be deleted after launch of analyticsEvents
13
- */
14
- metrikaGoals?: MetrikaGoal;
11
+ analyticsEvents?: AnalyticsEventsProp;
15
12
  };
16
- export declare const PostCard: ({ post, metrikaGoals, fullWidth, size, showTag, titleHeadingLevel, }: PostCardProps) => React.JSX.Element;
13
+ export declare const PostCard: ({ post, fullWidth, size, showTag, titleHeadingLevel, analyticsEvents, }: PostCardProps) => React.JSX.Element;
17
14
  export {};
@@ -8,7 +8,7 @@ import { SuggestPostInfo } from '../PostInfo/SuggestPostInfo';
8
8
  import { useAriaAttributes } from '../../hooks/useAriaAttributes';
9
9
  import './PostCard.css';
10
10
  const b = block('post-card');
11
- export const PostCard = ({ post, metrikaGoals, fullWidth = false, size = PostCardSize.SMALL, showTag = false, titleHeadingLevel = PostCardTitleHeadingLevel.H3, }) => {
11
+ export const PostCard = ({ post, fullWidth = false, size = PostCardSize.SMALL, showTag = false, titleHeadingLevel = PostCardTitleHeadingLevel.H3, analyticsEvents, }) => {
12
12
  var _a;
13
13
  const { title: postTitle, htmlTitle, textTitle, blogPostId, id, date, readingTime, hasUserLike, likes, image, description, tags, url, } = post;
14
14
  const title = postTitle || textTitle || htmlTitle;
@@ -34,7 +34,7 @@ export const PostCard = ({ post, metrikaGoals, fullWidth = false, size = PostCar
34
34
  readingTime && readingTimeId,
35
35
  ],
36
36
  });
37
- return (React.createElement(CardBase, { url: url, metrikaGoals: metrikaGoals, className: b('card', { fullWidth }), extraProps: ariaAttributes },
37
+ return (React.createElement(CardBase, { url: url, analyticsEvents: analyticsEvents, className: b('card', { fullWidth }), extraProps: ariaAttributes },
38
38
  React.createElement(CardBase.Header, { image: image, className: b('header', { fullWidth }) },
39
39
  React.createElement("div", { className: b('image-container'), "data-qa": "blog-suggest-header" })),
40
40
  React.createElement(CardBase.Content, null,
@@ -1,19 +1,13 @@
1
1
  import React from 'react';
2
+ import { AnalyticsEventsProp } from '@gravity-ui/page-constructor';
2
3
  import { PostData, QAProps } from '../../models/common';
3
4
  import './PostInfo.css';
4
- export type BlogMetrikaGoals = {
5
- sharing?: string;
6
- save?: string;
7
- };
8
5
  type PostInfoProps = QAProps & {
9
6
  postId: PostData['id'];
10
7
  readingTime: PostData['readingTime'];
11
8
  date: PostData['date'];
12
9
  theme?: 'light' | 'dark';
13
- /**
14
- * @deprecated Metrika will be deleted after launch of analyticsEvents
15
- */
16
- metrikaGoals?: BlogMetrikaGoals;
10
+ analyticsEventsContainer?: Record<string, AnalyticsEventsProp>;
17
11
  };
18
12
  /**
19
13
  * Blog post info panel component
@@ -22,10 +16,10 @@ type PostInfoProps = QAProps & {
22
16
  * @param readingTime - post reading time
23
17
  * @param date - post create date
24
18
  * @param theme - theme name
25
- * @param metrikaGoals - metrika goals name
26
19
  * @param qa - test-attr
20
+ * @param analyticsEventsContainer - a map of records with a single or collection of objects detailing analytics events
27
21
  *
28
22
  * @returns jsx
29
23
  */
30
- export declare const PostInfo: ({ date, readingTime, postId, theme, metrikaGoals, qa, }: PostInfoProps) => React.JSX.Element;
24
+ export declare const PostInfo: ({ date, readingTime, postId, theme, qa, analyticsEventsContainer, }: PostInfoProps) => React.JSX.Element;
31
25
  export {};
@@ -15,17 +15,17 @@ const b = block('post-info');
15
15
  * @param readingTime - post reading time
16
16
  * @param date - post create date
17
17
  * @param theme - theme name
18
- * @param metrikaGoals - metrika goals name
19
18
  * @param qa - test-attr
19
+ * @param analyticsEventsContainer - a map of records with a single or collection of objects detailing analytics events
20
20
  *
21
21
  * @returns jsx
22
22
  */
23
- export const PostInfo = ({ date, readingTime, postId, theme = 'light', metrikaGoals, qa, }) => {
23
+ export const PostInfo = ({ date, readingTime, postId, theme = 'light', qa, analyticsEventsContainer, }) => {
24
24
  const { likes } = useContext(PostPageContext);
25
25
  const qaAttributes = getQaAttributes(qa, 'date', 'reading-time', 'save');
26
26
  return (React.createElement("div", { className: b('container', { theme }) },
27
27
  date && React.createElement(Date, { date: date, qa: qaAttributes.date }),
28
28
  readingTime && React.createElement(ReadingTime, { readingTime: readingTime, qa: qaAttributes.readingTime }),
29
- React.createElement(Sharing, { metrikaGoal: metrikaGoals === null || metrikaGoals === void 0 ? void 0 : metrikaGoals.sharing, theme: theme }),
30
- likes && (React.createElement(Save, { postId: postId, title: likes.likesCount, hasUserLike: likes.hasUserLike, handleUserLike: likes.handleUserLike, metrikaGoal: metrikaGoals === null || metrikaGoals === void 0 ? void 0 : metrikaGoals.save, theme: theme, qa: qaAttributes.save }))));
29
+ React.createElement(Sharing, { theme: theme, analyticsEvents: analyticsEventsContainer === null || analyticsEventsContainer === void 0 ? void 0 : analyticsEventsContainer.sharing }),
30
+ likes && (React.createElement(Save, { postId: postId, title: likes.likesCount, hasUserLike: likes.hasUserLike, handleUserLike: likes.handleUserLike, analyticsEvents: analyticsEventsContainer === null || analyticsEventsContainer === void 0 ? void 0 : analyticsEventsContainer.save, theme: theme, qa: qaAttributes.save }))));
31
31
  };
@@ -5,8 +5,11 @@ import { block } from '../../utils/cn';
5
5
  import { Date } from './components/Date';
6
6
  import { ReadingTime } from './components/ReadingTime';
7
7
  import { Save } from './components/Save';
8
+ import { prepareAnalyticsEvent } from '../../utils/common';
9
+ import { DefaultGoalIds } from '../../constants';
8
10
  import './PostInfo.css';
9
11
  const b = block('post-info');
12
+ const saveEvents = prepareAnalyticsEvent({ name: DefaultGoalIds.saveSuggest });
10
13
  /**
11
14
  * Suggest blog card info component
12
15
  *
@@ -34,5 +37,5 @@ export const SuggestPostInfo = ({ postId, date, readingTime, likes, size = PostC
34
37
  React.createElement("div", { className: b('suggest-container') },
35
38
  date && React.createElement(Date, { date: date, size: size, id: dateId }),
36
39
  readingTime && (React.createElement(ReadingTime, { readingTime: readingTime, size: size, id: readingTimeId }))),
37
- likes && postId && (React.createElement(Save, { postId: postId, title: likesCount, hasUserLike: hasUserLike, handleUserLike: handleLike, size: size, qa: qa }))));
40
+ likes && postId && (React.createElement(Save, { postId: postId, title: likesCount, analyticsEvents: saveEvents, hasUserLike: hasUserLike, handleUserLike: handleLike, size: size, qa: qa }))));
38
41
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Icon } from '@gravity-ui/uikit';
3
- import { Keyset, i18 } from '../../../i18n';
3
+ import { Keyset, i18n } from '../../../i18n';
4
4
  import { Time } from '../../../icons/Time';
5
5
  import { block } from '../../../utils/cn';
6
6
  import '../PostInfo.css';
@@ -9,4 +9,4 @@ const ICON_SIZE = 16;
9
9
  export const ReadingTime = ({ readingTime, size = 's', id, qa }) => (React.createElement("div", { className: b('item', { size }), id: id, "data-qa": qa },
10
10
  React.createElement("span", { className: b('icon') },
11
11
  React.createElement(Icon, { data: Time, size: ICON_SIZE, className: b('icon-color') })),
12
- i18(Keyset.ContextReadingTime, { count: readingTime })));
12
+ i18n(Keyset.ContextReadingTime, { count: readingTime })));
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { AnalyticsEventsProp } from '@gravity-ui/page-constructor';
2
3
  import { QAProps } from '../../../models/common';
3
4
  import '../PostInfo.css';
4
5
  type SaveProps = QAProps & {
@@ -7,11 +8,8 @@ type SaveProps = QAProps & {
7
8
  hasUserLike: boolean;
8
9
  handleUserLike: () => void;
9
10
  theme?: 'light' | 'dark';
10
- /**
11
- * @deprecated Metrika will be deleted after launch of analyticsEvents
12
- */
13
- metrikaGoal?: string;
14
11
  size?: 's' | 'm';
12
+ analyticsEvents?: AnalyticsEventsProp;
15
13
  };
16
14
  /**
17
15
  * Components for 'save' blog UI-component
@@ -19,11 +17,11 @@ type SaveProps = QAProps & {
19
17
  * @param title - post title
20
18
  * @param postId - post id
21
19
  * @param hasUserLike - flag what blog has like from current user
22
- * @param metrikaGoal - metrika goal name
23
20
  * @param qa - test-attr
24
21
  * @param size - text size
22
+ * @param analyticsEvents - a single or collection of objects detailing analytics events
25
23
  *
26
24
  * @returns jsx
27
25
  */
28
- export declare const Save: ({ title, postId, hasUserLike, handleUserLike, metrikaGoal, size, theme, qa, }: SaveProps) => React.JSX.Element;
26
+ export declare const Save: ({ title, postId, hasUserLike, handleUserLike, size, theme, qa, analyticsEvents, }: SaveProps) => React.JSX.Element;
29
27
  export {};
@@ -2,8 +2,6 @@ import React, { useContext } from 'react';
2
2
  import { useAnalytics } from '@gravity-ui/page-constructor';
3
3
  import { Icon } from '@gravity-ui/uikit';
4
4
  import { LikesContext } from '../../../contexts/LikesContext';
5
- import metrika from '../../../counters/metrika';
6
- import { MetrikaCounter } from '../../../counters/utils';
7
5
  import { Save as SaveIcon } from '../../../icons/Save';
8
6
  import { SaveFilled } from '../../../icons/SaveFilled';
9
7
  import { DefaultEventNames } from '../../../models/common';
@@ -18,13 +16,13 @@ const b = block('post-info');
18
16
  * @param title - post title
19
17
  * @param postId - post id
20
18
  * @param hasUserLike - flag what blog has like from current user
21
- * @param metrikaGoal - metrika goal name
22
19
  * @param qa - test-attr
23
20
  * @param size - text size
21
+ * @param analyticsEvents - a single or collection of objects detailing analytics events
24
22
  *
25
23
  * @returns jsx
26
24
  */
27
- export const Save = ({ title, postId, hasUserLike, handleUserLike, metrikaGoal, size, theme, qa, }) => {
25
+ export const Save = ({ title, postId, hasUserLike, handleUserLike, size, theme, qa, analyticsEvents, }) => {
28
26
  const { toggleLike, isSignedInUser, requireSignIn } = useContext(LikesContext);
29
27
  const handleAnalytics = useAnalytics(DefaultEventNames.SaveButton);
30
28
  const isLikeable = Boolean(toggleLike);
@@ -43,8 +41,7 @@ export const Save = ({ title, postId, hasUserLike, handleUserLike, metrikaGoal,
43
41
  }
44
42
  postLikeStatus(postId, Boolean(hasUserLike));
45
43
  handleUserLike();
46
- metrika.reachGoal(MetrikaCounter.CrossSite, metrikaGoal);
47
- handleAnalytics();
44
+ handleAnalytics(analyticsEvents);
48
45
  }, "data-qa": qa },
49
46
  React.createElement("div", { className: b('content', { cursor: isLikeable, theme }) },
50
47
  React.createElement("span", { className: b('icon') },
@@ -1,11 +1,9 @@
1
1
  import React from 'react';
2
+ import { AnalyticsEventsProp } from '@gravity-ui/page-constructor';
2
3
  import '../PostInfo.css';
3
4
  type SharingProps = {
4
5
  theme?: 'light' | 'dark';
5
- /**
6
- * @deprecated Metrika will be deleted after launch of analyticsEvents
7
- */
8
- metrikaGoal?: string;
6
+ analyticsEvents?: AnalyticsEventsProp;
9
7
  };
10
- export declare const Sharing: ({ theme, metrikaGoal }: SharingProps) => React.JSX.Element;
8
+ export declare const Sharing: ({ theme, analyticsEvents }: SharingProps) => React.JSX.Element;
11
9
  export {};
@@ -4,28 +4,22 @@ import { useAnalytics } from '@gravity-ui/page-constructor';
4
4
  import { MobileContext } from '../../../contexts/MobileContext';
5
5
  import { PostPageContext } from '../../../contexts/PostPageContext';
6
6
  import { RouterContext } from '../../../contexts/RouterContext';
7
- import metrika from '../../../counters/metrika';
8
- import { MetrikaCounter } from '../../../counters/utils';
9
- import { Keyset, i18 } from '../../../i18n';
7
+ import { Keyset, i18n } from '../../../i18n';
10
8
  import { ShareArrowUp } from '../../../icons/ShareArrowUp';
11
9
  import { DefaultEventNames } from '../../../models/common';
12
10
  import { block } from '../../../utils/cn';
13
11
  import { getAbsolutePath } from '../../../utils/common';
14
12
  import '../PostInfo.css';
15
13
  const b = block('post-info');
16
- export const Sharing = ({ theme, metrikaGoal }) => {
14
+ export const Sharing = ({ theme, analyticsEvents }) => {
17
15
  const router = useContext(RouterContext);
18
16
  const isMobile = useContext(MobileContext);
19
17
  const { shareOptions } = useContext(PostPageContext);
20
18
  const handleAnalyticsGlobal = useAnalytics(DefaultEventNames.ShareButton);
21
- const handleMetrika = useCallback(() => {
22
- metrika.reachGoal(MetrikaCounter.CrossSite, metrikaGoal);
23
- }, [metrikaGoal]);
24
19
  const handleAnalytics = useCallback(() => {
25
- handleAnalyticsGlobal();
26
- handleMetrika();
27
- }, [handleAnalyticsGlobal, handleMetrika]);
20
+ handleAnalyticsGlobal(analyticsEvents);
21
+ }, [analyticsEvents, handleAnalyticsGlobal]);
28
22
  return (React.createElement("div", { className: b('item') },
29
23
  React.createElement("div", { className: b('icon') },
30
- React.createElement(SharePopover, { url: getAbsolutePath(router), className: b('share'), iconClass: b('share-icon'), switcherClassName: b('switcher', { theme }), tooltipClassName: b('popup'), useWebShareApi: isMobile, direction: ShareLayoutDirection.Column, buttonTitle: i18(Keyset.ActionShare), customIcon: ShareArrowUp, placement: "bottom", openByHover: false, shareOptions: shareOptions, onClick: handleAnalytics }))));
24
+ React.createElement(SharePopover, { url: getAbsolutePath(router), className: b('share'), iconClass: b('share-icon'), switcherClassName: b('switcher', { theme }), tooltipClassName: b('popup'), useWebShareApi: isMobile, direction: ShareLayoutDirection.Column, buttonTitle: i18n(Keyset.ActionShare), customIcon: ShareArrowUp, placement: "bottom", openByHover: false, shareOptions: shareOptions, onClick: handleAnalytics }))));
31
25
  };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { CardLayoutBlock } from '@gravity-ui/page-constructor';
3
3
  import { Button } from '@gravity-ui/uikit';
4
- import { Keyset, i18 } from '../../i18n';
4
+ import { Keyset, i18n } from '../../i18n';
5
5
  import { PostCardSize, PostCardTitleHeadingLevel } from '../../models/common';
6
6
  import { block } from '../../utils/cn';
7
7
  import { Paginator } from '../Paginator/Paginator';
@@ -22,9 +22,9 @@ export const Posts = ({ containerId, pinnedPostOnPage, currentPage, postsOnPage,
22
22
  ? PostCardTitleHeadingLevel.H3
23
23
  : PostCardTitleHeadingLevel.H2 }))))) : (React.createElement(PostsEmpty, null))),
24
24
  React.createElement("div", { className: b('pagination') },
25
- Boolean(isShowMoreVisible && (postsOnPage === null || postsOnPage === void 0 ? void 0 : postsOnPage.length)) && (React.createElement(Button, { view: "outlined", size: "xl", className: b('more-button'), onClick: handleShowMore }, i18(Keyset.ActionLoadMore))),
25
+ Boolean(isShowMoreVisible && (postsOnPage === null || postsOnPage === void 0 ? void 0 : postsOnPage.length)) && (React.createElement(Button, { view: "outlined", size: "xl", className: b('more-button'), onClick: handleShowMore }, i18n(Keyset.ActionLoadMore))),
26
26
  errorShowMore && (React.createElement("div", { className: b('error-show-more') },
27
- React.createElement("div", null, i18(Keyset.ErrorTitle)),
28
- React.createElement("div", null, i18(Keyset.PostLoadError)))),
27
+ React.createElement("div", null, i18n(Keyset.ErrorTitle)),
28
+ React.createElement("div", null, i18n(Keyset.PostLoadError)))),
29
29
  Boolean(currentPage && postCountOnPage) && (React.createElement("div", { className: b('paginator') },
30
30
  React.createElement(Paginator, { onPageChange: handlePageChange, page: currentPage, totalItems: postCountOnPage, itemsPerPage: perPageInQuery, maxPages: Infinity, pageCountForShowSupportButtons: pageCountForShowSupportButtons, queryParams: queryParams }))))));
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { Keyset, i18 } from '../../i18n';
2
+ import { Keyset, i18n } from '../../i18n';
3
3
  import { block } from '../../utils/cn';
4
4
  import './PostsEmpty.css';
5
5
  const b = block('posts-empty');
6
6
  export const PostsEmpty = () => (React.createElement("div", { className: b('container') },
7
- React.createElement("div", { className: b('title') }, i18(Keyset.TitleEmptyContainer)),
8
- React.createElement("div", { className: b('subtitle') }, i18(Keyset.ContextEmptyContainer))));
7
+ React.createElement("div", { className: b('title') }, i18n(Keyset.TitleEmptyContainer)),
8
+ React.createElement("div", { className: b('subtitle') }, i18n(Keyset.ContextEmptyContainer))));
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
  import { Button } from '@gravity-ui/uikit';
3
- import { Keyset, i18 } from '../../i18n';
3
+ import { Keyset, i18n } from '../../i18n';
4
4
  import { block } from '../../utils/cn';
5
5
  import './PostError.css';
6
6
  const b = block('posts-error');
7
7
  export const PostsError = ({ onButtonClick }) => {
8
8
  const handleClick = () => (onButtonClick ? onButtonClick() : window.location.reload());
9
9
  return (React.createElement("div", { className: b('container') },
10
- React.createElement("div", { className: b('title') }, i18(Keyset.ErrorTitle)),
11
- React.createElement("div", { className: b('subtitle') }, i18(Keyset.PostLoadError)),
10
+ React.createElement("div", { className: b('title') }, i18n(Keyset.ErrorTitle)),
11
+ React.createElement("div", { className: b('subtitle') }, i18n(Keyset.PostLoadError)),
12
12
  React.createElement("div", { className: b('button') },
13
- React.createElement(Button, { size: "xl", view: "outlined", onClick: handleClick }, i18(Keyset.ActionTryAgain)))));
13
+ React.createElement(Button, { size: "xl", view: "outlined", onClick: handleClick }, i18n(Keyset.ActionTryAgain)))));
14
14
  };
@@ -1,15 +1,15 @@
1
1
  import { __rest } from "tslib";
2
2
  import React from 'react';
3
- import { Keyset, i18 } from '../../i18n';
3
+ import { Keyset, i18n } from '../../i18n';
4
4
  import { Prompt } from '../Prompt/Prompt';
5
5
  /**
6
6
  * Authentication Popup that appears when user action requires login
7
7
  * @returns {JSX|null}
8
8
  */
9
9
  export const PromptSignIn = (_a) => {
10
- var { text = i18(Keyset.PromptSignInOnLike), onClickSignIn = () => alert(i18(Keyset.SignIn)), actions = [
10
+ var { text = i18n(Keyset.PromptSignInOnLike), onClickSignIn = () => alert(i18n(Keyset.SignIn)), actions = [
11
11
  {
12
- children: i18(Keyset.SignIn),
12
+ children: i18n(Keyset.SignIn),
13
13
  onClick: onClickSignIn,
14
14
  size: 'l',
15
15
  },
@@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
2
2
  import { Icon, TextInput } from '@gravity-ui/uikit';
3
3
  import lodashDebounce from 'lodash/debounce';
4
4
  import { useIsIPhone } from '../../hooks/useIsIPhone';
5
- import { Keyset, i18 } from '../../i18n';
5
+ import { Keyset, i18n } from '../../i18n';
6
6
  import { Close } from '../../icons/Close';
7
7
  import { SearchIcon } from '../../icons/SearchIcon';
8
8
  import { block } from '../../utils/cn';
@@ -17,7 +17,7 @@ const AUTOFOCUS_TIMEOUT = 0;
17
17
  *
18
18
  * @returns {JSX|null}
19
19
  */
20
- export const Search = ({ className, initialValue, onSubmit, debounce = 300, placeholder = i18(Keyset.Search), size = 'm', autoFocus = false, value: externalValue, }) => {
20
+ export const Search = ({ className, initialValue, onSubmit, debounce = 300, placeholder = i18n(Keyset.Search), size = 'm', autoFocus = false, value: externalValue, }) => {
21
21
  const handleChange = lodashDebounce(onSubmit, debounce);
22
22
  const [value, setValue] = useState(initialValue);
23
23
  const inputRef = useRef(null);
@@ -9,13 +9,14 @@ export declare const BREAKPOINTS: {
9
9
  export declare const DEFAULT_THEME = "light";
10
10
  export declare const UIKIT_ROOT_CLASS = "g-root";
11
11
  export declare const UIKIT_THEME_LIGHT_CLASS: string;
12
- export declare enum BlogMetrikaGoalIds {
12
+ export declare enum DefaultGoalIds {
13
13
  shareTop = "SITE_BLOG_SHARE-TOP_CLICK",
14
14
  shareBottom = "SITE_BLOG_SHARE-BOTTOM_CLICK",
15
15
  breadcrumbsTop = "SITE_BLOG_BREADCRUMBS-TOP_CLICK",
16
16
  breadcrumbsBottom = "SITE_BLOG_BREADCRUMBS-BOTTOM_CLICK",
17
17
  saveTop = "SITE_BLOG_SAVE-TOP_CLICK",
18
18
  saveBottom = "SITE_BLOG_SAVE-BOTTOM_CLICK",
19
+ saveSuggest = "SITE_BLOG_SAVE-SUGGEST_CLICK",
19
20
  suggest = "SITE_BLOG_INTERESTING-CARD_CLICK",
20
21
  bannerCommon = "SITE_BLOG_TEXT-BANNER_CLICK",
21
22
  cta = "SITE_BLOG_CTA_CLICK",
@@ -9,24 +9,25 @@ export const BREAKPOINTS = {
9
9
  export const DEFAULT_THEME = 'light';
10
10
  export const UIKIT_ROOT_CLASS = 'g-root';
11
11
  export const UIKIT_THEME_LIGHT_CLASS = `${UIKIT_ROOT_CLASS}_theme_${DEFAULT_THEME}`;
12
- export var BlogMetrikaGoalIds;
13
- (function (BlogMetrikaGoalIds) {
14
- BlogMetrikaGoalIds["shareTop"] = "SITE_BLOG_SHARE-TOP_CLICK";
15
- BlogMetrikaGoalIds["shareBottom"] = "SITE_BLOG_SHARE-BOTTOM_CLICK";
16
- BlogMetrikaGoalIds["breadcrumbsTop"] = "SITE_BLOG_BREADCRUMBS-TOP_CLICK";
17
- BlogMetrikaGoalIds["breadcrumbsBottom"] = "SITE_BLOG_BREADCRUMBS-BOTTOM_CLICK";
18
- BlogMetrikaGoalIds["saveTop"] = "SITE_BLOG_SAVE-TOP_CLICK";
19
- BlogMetrikaGoalIds["saveBottom"] = "SITE_BLOG_SAVE-BOTTOM_CLICK";
20
- BlogMetrikaGoalIds["suggest"] = "SITE_BLOG_INTERESTING-CARD_CLICK";
21
- BlogMetrikaGoalIds["bannerCommon"] = "SITE_BLOG_TEXT-BANNER_CLICK";
22
- BlogMetrikaGoalIds["cta"] = "SITE_BLOG_CTA_CLICK";
23
- BlogMetrikaGoalIds["tag"] = "SITE_BLOG_THEME-SELECTOR_CLCK";
24
- BlogMetrikaGoalIds["service"] = "SITE_BLOG_SERVICE-SELECTOR_CLCK";
25
- BlogMetrikaGoalIds["showMore"] = "SITE_BLOG-PAGINATION_SHOW-MORE_CLCK";
26
- BlogMetrikaGoalIds["next"] = "SITE_BLOG-PAGINATION_NEXT_CLCK";
27
- BlogMetrikaGoalIds["home"] = "SITE_BLOG-PAGINATION_HOME_CLCK";
28
- BlogMetrikaGoalIds["page"] = "SITE_BLOG-PAGINATION_PAGE-NMBR_CLCK";
29
- })(BlogMetrikaGoalIds || (BlogMetrikaGoalIds = {}));
12
+ export var DefaultGoalIds;
13
+ (function (DefaultGoalIds) {
14
+ DefaultGoalIds["shareTop"] = "SITE_BLOG_SHARE-TOP_CLICK";
15
+ DefaultGoalIds["shareBottom"] = "SITE_BLOG_SHARE-BOTTOM_CLICK";
16
+ DefaultGoalIds["breadcrumbsTop"] = "SITE_BLOG_BREADCRUMBS-TOP_CLICK";
17
+ DefaultGoalIds["breadcrumbsBottom"] = "SITE_BLOG_BREADCRUMBS-BOTTOM_CLICK";
18
+ DefaultGoalIds["saveTop"] = "SITE_BLOG_SAVE-TOP_CLICK";
19
+ DefaultGoalIds["saveBottom"] = "SITE_BLOG_SAVE-BOTTOM_CLICK";
20
+ DefaultGoalIds["saveSuggest"] = "SITE_BLOG_SAVE-SUGGEST_CLICK";
21
+ DefaultGoalIds["suggest"] = "SITE_BLOG_INTERESTING-CARD_CLICK";
22
+ DefaultGoalIds["bannerCommon"] = "SITE_BLOG_TEXT-BANNER_CLICK";
23
+ DefaultGoalIds["cta"] = "SITE_BLOG_CTA_CLICK";
24
+ DefaultGoalIds["tag"] = "SITE_BLOG_THEME-SELECTOR_CLCK";
25
+ DefaultGoalIds["service"] = "SITE_BLOG_SERVICE-SELECTOR_CLCK";
26
+ DefaultGoalIds["showMore"] = "SITE_BLOG-PAGINATION_SHOW-MORE_CLCK";
27
+ DefaultGoalIds["next"] = "SITE_BLOG-PAGINATION_NEXT_CLCK";
28
+ DefaultGoalIds["home"] = "SITE_BLOG-PAGINATION_HOME_CLCK";
29
+ DefaultGoalIds["page"] = "SITE_BLOG-PAGINATION_PAGE-NMBR_CLCK";
30
+ })(DefaultGoalIds || (DefaultGoalIds = {}));
30
31
  export const DEFAULT_PADDINGS = {
31
32
  [PaddingsDirections.bottom]: 'l',
32
33
  [PaddingsDirections.top]: 'xs',
@@ -1,5 +1,5 @@
1
1
  import React, { Fragment } from 'react';
2
- import { AnalyticsContext } from '@gravity-ui/page-constructor';
2
+ import { AnalyticsContext, ThemeContext, } from '@gravity-ui/page-constructor';
3
3
  import { DEFAULT_THEME } from '../constants';
4
4
  import { DeviceContext } from '../contexts/DeviceContext';
5
5
  import { LocaleContext } from '../contexts/LocaleContext';
@@ -10,6 +10,7 @@ import { ThemeValueContext } from '../contexts/theme/ThemeValueContext';
10
10
  export const BlogConstructorProvider = ({ isMobile, locale = {}, router = {}, theme = DEFAULT_THEME, device = {}, analytics = {}, settings = {}, children, }) => {
11
11
  const context = [
12
12
  React.createElement(ThemeValueContext.Provider, { value: { themeValue: theme }, key: "theme-context" }),
13
+ React.createElement(ThemeContext.Provider, { value: { theme: theme }, key: "pc-theme" }),
13
14
  React.createElement(LocaleContext.Provider, { value: { locale }, key: "locale-context" }),
14
15
  React.createElement(RouterContext.Provider, { value: router, key: "router-context" }),
15
16
  React.createElement(MobileContext.Provider, { value: Boolean(isMobile), key: "is-mobile-context" }),
@@ -1,6 +1,6 @@
1
1
  import React, { SyntheticEvent } from 'react';
2
2
  import { CustomConfig, NavigationData, PageConstructorProviderProps, PageContent } from '@gravity-ui/page-constructor';
3
- import { GetPostsType, MetaProps, PostsProps, Service, SetQueryType, Tag, ToggleLikeCallbackType } from '../../models/common';
3
+ import { GetPostsType, MetaProps, PostsProps, Service, Tag, ToggleLikeCallbackType } from '../../models/common';
4
4
  import './BlogPage.css';
5
5
  export type BlogPageProps = {
6
6
  content: PageContent;
@@ -12,7 +12,6 @@ export type BlogPageProps = {
12
12
  hasLikes?: boolean;
13
13
  toggleLike?: ToggleLikeCallbackType;
14
14
  metaData?: MetaProps;
15
- setQuery?: SetQueryType;
16
15
  settings?: PageConstructorProviderProps;
17
16
  custom?: CustomConfig;
18
17
  pageCountForShowSupportButtons?: number;
@@ -1,5 +1,5 @@
1
1
  @charset "UTF-8";
2
- @import '~@doc-tools/transform/dist/css/yfm.css';
2
+ @import '~@diplodoc/transform/dist/css/yfm.css';
3
3
  :root {
4
4
  --header-height: 64px;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { GetPostsType, PostData, Service, SetQueryType, Tag } from '../models/common';
2
+ import { GetPostsType, PostData, Service, Tag } from '../models/common';
3
3
  export interface FeedContextProps {
4
4
  posts?: PostData[];
5
5
  pinnedPost?: PostData;
@@ -7,7 +7,6 @@ export interface FeedContextProps {
7
7
  tags?: Tag[];
8
8
  services?: Service[];
9
9
  getPosts?: GetPostsType;
10
- setQuery?: SetQueryType;
11
10
  pageCountForShowSupportButtons?: number;
12
11
  }
13
12
  export declare const FeedContext: React.Context<FeedContextProps>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Lang } from '../models/locale';
2
+ import { Lang } from '@gravity-ui/uikit';
3
3
  export const LocaleContext = React.createContext({
4
4
  locale: {
5
5
  code: 'en-En',
@@ -1,6 +1,3 @@
1
- /**
2
- * @deprecated Metrika will be deleted after launch of analyticsEvents
3
- */
4
1
  const Goal = {
5
2
  SUPPORT_OPEN_FORM: 'SUPPORTOPENFORM',
6
3
  SUPPORT_STEP_1_SUBMIT: 'SUPPORTSTEP1SUBMIT',
@@ -1,4 +1,4 @@
1
- export declare enum MetrikaCounter {
1
+ export declare enum AnalyticsCounter {
2
2
  Main = "main",
3
3
  CrossSite = "cross-site",
4
4
  Scale = "scale"
@@ -1,6 +1,6 @@
1
- export var MetrikaCounter;
2
- (function (MetrikaCounter) {
3
- MetrikaCounter["Main"] = "main";
4
- MetrikaCounter["CrossSite"] = "cross-site";
5
- MetrikaCounter["Scale"] = "scale";
6
- })(MetrikaCounter || (MetrikaCounter = {}));
1
+ export var AnalyticsCounter;
2
+ (function (AnalyticsCounter) {
3
+ AnalyticsCounter["Main"] = "main";
4
+ AnalyticsCounter["CrossSite"] = "cross-site";
5
+ AnalyticsCounter["Scale"] = "scale";
6
+ })(AnalyticsCounter || (AnalyticsCounter = {}));
@@ -1,5 +1,3 @@
1
- import { I18N } from '@gravity-ui/i18n';
2
- export declare const i18n: I18N;
3
1
  export declare enum Keyset {
4
2
  Title = "title",
5
3
  TitleBreadcrumbs = "title_breadcrumbs",
@@ -21,4 +19,4 @@ export declare enum Keyset {
21
19
  PromptSignInOnLike = "prompt_sign_in_on_like",
22
20
  SignIn = "Sign In"
23
21
  }
24
- export declare const i18: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
22
+ export declare const i18n: (key: Keyset, params?: import("@gravity-ui/i18n").Params | undefined) => string;
@@ -1,7 +1,5 @@
1
- import { I18N } from '@gravity-ui/i18n';
2
- import { Lang } from '../models/locale';
3
- const KEYSET_NAME = 'blog';
4
- export const i18n = new I18N();
1
+ import { addComponentKeysets } from '@gravity-ui/uikit/i18n';
2
+ const NAMESPACE = 'blog';
5
3
  export var Keyset;
6
4
  (function (Keyset) {
7
5
  Keyset["Title"] = "title";
@@ -24,7 +22,7 @@ export var Keyset;
24
22
  Keyset["PromptSignInOnLike"] = "prompt_sign_in_on_like";
25
23
  Keyset["SignIn"] = "Sign In";
26
24
  })(Keyset || (Keyset = {}));
27
- i18n.registerKeyset(Lang.En, KEYSET_NAME, {
25
+ const en = {
28
26
  [Keyset.Title]: 'Blog',
29
27
  [Keyset.TitleBreadcrumbs]: 'Blog',
30
28
  [Keyset.TitleSuggest]: 'See also',
@@ -48,8 +46,8 @@ i18n.registerKeyset(Lang.En, KEYSET_NAME, {
48
46
  '{{count}} mins to read',
49
47
  ],
50
48
  [Keyset.SignIn]: 'Sign In',
51
- });
52
- i18n.registerKeyset(Lang.Ru, KEYSET_NAME, {
49
+ };
50
+ const ru = {
53
51
  [Keyset.Title]: 'Блог',
54
52
  [Keyset.TitleBreadcrumbs]: 'Блог',
55
53
  [Keyset.TitleSuggest]: 'Читать также',
@@ -73,5 +71,5 @@ i18n.registerKeyset(Lang.Ru, KEYSET_NAME, {
73
71
  '{{count}} минут чтения',
74
72
  ],
75
73
  [Keyset.SignIn]: 'Войти',
76
- });
77
- export const i18 = i18n.keyset(KEYSET_NAME);
74
+ };
75
+ export const i18n = addComponentKeysets({ en, ru }, NAMESPACE);
@@ -1,4 +1,3 @@
1
- export { configure } from './configure';
2
1
  export { BlogConstructorProvider } from './constructor/BlogConstructorProvider';
3
2
  export { BlogPostPage } from './containers/BlogPostPage/BlogPostPage';
4
3
  export { BlogPage } from './containers/BlogPage/BlogPage';
@@ -1,4 +1,3 @@
1
- export { configure } from './configure';
2
1
  export { BlogConstructorProvider } from './constructor/BlogConstructorProvider';
3
2
  export { BlogPostPage } from './containers/BlogPostPage/BlogPostPage';
4
3
  export { BlogPage } from './containers/BlogPage/BlogPage';
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { MarkdownItPluginCb } from '@doc-tools/transform/lib/plugins/typings';
2
+ import { MarkdownItPluginCb } from '@diplodoc/transform/lib/plugins/typings';
3
3
  import { HeaderBlockProps as PageConstructorHeaderBlockProps } from '@gravity-ui/page-constructor';
4
4
  import { IBrowser, IDevice } from 'ua-parser-js';
5
5
  import { Locale } from '../models/locale';
@@ -149,9 +149,6 @@ export type GetPostsRequest = {
149
149
  };
150
150
  export type GetPostsType = (query: GetPostsRequest) => Promise<PostsProps>;
151
151
  export type HandleChangeQueryParams = (params: Query) => void;
152
- export type SetQueryType = (params: Query, options?: {
153
- [y: string]: boolean;
154
- }) => Promise<void> | void;
155
152
  export declare enum DefaultEventNames {
156
153
  ShareButton = "share-button-click",
157
154
  SaveButton = "save-button-click",
@@ -1,7 +1,4 @@
1
- export declare enum Lang {
2
- Ru = "ru",
3
- En = "en"
4
- }
1
+ import { Lang } from '@gravity-ui/uikit';
5
2
  export declare enum Currency {
6
3
  RUB = "RUB",
7
4
  USD = "USD",
@@ -1,8 +1,3 @@
1
- export var Lang;
2
- (function (Lang) {
3
- Lang["Ru"] = "ru";
4
- Lang["En"] = "en";
5
- })(Lang || (Lang = {}));
6
1
  export var Currency;
7
2
  (function (Currency) {
8
3
  Currency["RUB"] = "RUB";