@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.
Files changed (109) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/build/cjs/blocks/Author/Author.js +3 -3
  3. package/build/cjs/blocks/Banner/Banner.js +4 -7
  4. package/build/cjs/blocks/CTA/CTA.js +3 -6
  5. package/build/cjs/blocks/ColoredText/ColoredText.js +1 -1
  6. package/build/cjs/blocks/Feed/Feed.js +12 -28
  7. package/build/cjs/blocks/Feed/reducer.d.ts +1 -1
  8. package/build/cjs/blocks/Header/Header.js +3 -7
  9. package/build/cjs/blocks/Meta/Meta.js +5 -9
  10. package/build/cjs/blocks/Suggest/Suggest.js +4 -8
  11. package/build/cjs/blocks/YFM/YFM.js +1 -1
  12. package/build/cjs/components/FeedHeader/FeedHeader.d.ts +1 -1
  13. package/build/cjs/components/FeedHeader/FeedHeader.js +1 -1
  14. package/build/cjs/components/FeedHeader/components/Controls/Controls.d.ts +1 -1
  15. package/build/cjs/components/FeedHeader/components/Controls/Controls.js +4 -28
  16. package/build/cjs/components/FeedHeader/components/Controls/customRenders.d.ts +1 -1
  17. package/build/cjs/components/FeedHeader/components/Controls/customRenders.js +1 -1
  18. package/build/cjs/components/Paginator/Paginator.js +2 -26
  19. package/build/cjs/components/Paginator/components/NavigationButton.js +1 -1
  20. package/build/cjs/components/Paginator/components/PaginatorItem.js +1 -1
  21. package/build/cjs/components/PostCard/PostCard.d.ts +0 -4
  22. package/build/cjs/components/PostCard/PostCard.js +1 -1
  23. package/build/cjs/components/PostInfo/PostInfo.d.ts +0 -4
  24. package/build/cjs/components/PostInfo/PostInfo.js +2 -2
  25. package/build/cjs/components/PostInfo/SuggestPostInfo.js +1 -1
  26. package/build/cjs/components/PostInfo/components/Date.js +1 -1
  27. package/build/cjs/components/PostInfo/components/Save.d.ts +0 -4
  28. package/build/cjs/components/PostInfo/components/Save.js +4 -8
  29. package/build/cjs/components/PostInfo/components/Sharing.d.ts +0 -4
  30. package/build/cjs/components/PostInfo/components/Sharing.js +5 -12
  31. package/build/cjs/components/Posts/Posts.js +1 -1
  32. package/build/cjs/components/PostsEmpty/PostsEmpty.js +1 -1
  33. package/build/cjs/components/Search/Search.js +2 -2
  34. package/build/cjs/components/Wrapper/Wrapper.js +1 -1
  35. package/build/cjs/constructor/BlogConstructorProvider.d.ts +1 -3
  36. package/build/cjs/constructor/BlogConstructorProvider.js +4 -6
  37. package/build/cjs/constructor/blocksMap.js +8 -8
  38. package/build/cjs/containers/BlogPage/BlogPage.d.ts +2 -2
  39. package/build/cjs/containers/BlogPage/BlogPage.js +2 -2
  40. package/build/cjs/containers/BlogPostPage/BlogPostPage.d.ts +2 -2
  41. package/build/cjs/containers/BlogPostPage/BlogPostPage.js +2 -2
  42. package/build/cjs/contexts/FeedContext.d.ts +1 -1
  43. package/build/cjs/contexts/theme/ThemeProvider.js +1 -1
  44. package/build/cjs/counters/metrika.d.ts +0 -4
  45. package/build/cjs/counters/metrika.js +0 -4
  46. package/build/cjs/models/blocks.d.ts +1 -1
  47. package/build/cjs/models/common.d.ts +2 -12
  48. package/build/cjs/models/common.js +2 -14
  49. package/build/cjs/utils/common.d.ts +1 -1
  50. package/build/cjs/utils/common.js +1 -1
  51. package/build/esm/blocks/Author/Author.js +5 -5
  52. package/build/esm/blocks/Banner/Banner.js +4 -7
  53. package/build/esm/blocks/CTA/CTA.js +3 -6
  54. package/build/esm/blocks/ColoredText/ColoredText.js +1 -1
  55. package/build/esm/blocks/Feed/Feed.js +8 -24
  56. package/build/esm/blocks/Feed/reducer.d.ts +1 -1
  57. package/build/esm/blocks/Header/Header.js +3 -7
  58. package/build/esm/blocks/Meta/Meta.js +5 -9
  59. package/build/esm/blocks/Suggest/Suggest.js +4 -8
  60. package/build/esm/blocks/YFM/YFM.js +1 -1
  61. package/build/esm/components/FeedHeader/FeedHeader.d.ts +1 -1
  62. package/build/esm/components/FeedHeader/FeedHeader.js +2 -2
  63. package/build/esm/components/FeedHeader/components/Controls/Controls.d.ts +1 -1
  64. package/build/esm/components/FeedHeader/components/Controls/Controls.js +6 -30
  65. package/build/esm/components/FeedHeader/components/Controls/customRenders.d.ts +1 -1
  66. package/build/esm/components/FeedHeader/components/Controls/customRenders.js +2 -2
  67. package/build/esm/components/Paginator/Paginator.js +3 -27
  68. package/build/esm/components/Paginator/components/NavigationButton.js +2 -2
  69. package/build/esm/components/Paginator/components/PaginatorItem.js +1 -1
  70. package/build/esm/components/PostCard/PostCard.d.ts +0 -4
  71. package/build/esm/components/PostCard/PostCard.js +3 -3
  72. package/build/esm/components/PostInfo/PostInfo.d.ts +0 -4
  73. package/build/esm/components/PostInfo/PostInfo.js +2 -2
  74. package/build/esm/components/PostInfo/SuggestPostInfo.js +1 -1
  75. package/build/esm/components/PostInfo/components/Date.js +1 -1
  76. package/build/esm/components/PostInfo/components/ReadingTime.js +1 -1
  77. package/build/esm/components/PostInfo/components/Save.d.ts +0 -4
  78. package/build/esm/components/PostInfo/components/Save.js +2 -6
  79. package/build/esm/components/PostInfo/components/Sharing.d.ts +0 -4
  80. package/build/esm/components/PostInfo/components/Sharing.js +4 -11
  81. package/build/esm/components/Posts/Posts.js +2 -2
  82. package/build/esm/components/PostsEmpty/PostsEmpty.js +1 -1
  83. package/build/esm/components/PostsError/PostsError.js +1 -1
  84. package/build/esm/components/Search/Search.js +3 -3
  85. package/build/esm/components/Wrapper/Wrapper.js +1 -1
  86. package/build/esm/constructor/BlogConstructorProvider.d.ts +1 -3
  87. package/build/esm/constructor/BlogConstructorProvider.js +4 -6
  88. package/build/esm/constructor/blocksMap.js +8 -8
  89. package/build/esm/containers/BlogPage/BlogPage.d.ts +2 -2
  90. package/build/esm/containers/BlogPage/BlogPage.js +2 -2
  91. package/build/esm/containers/BlogPostPage/BlogPostPage.d.ts +2 -2
  92. package/build/esm/containers/BlogPostPage/BlogPostPage.js +2 -2
  93. package/build/esm/contexts/FeedContext.d.ts +1 -1
  94. package/build/esm/contexts/theme/ThemeProvider.js +1 -1
  95. package/build/esm/counters/metrika.d.ts +0 -4
  96. package/build/esm/counters/metrika.js +0 -4
  97. package/build/esm/hooks/useLikes.js +1 -1
  98. package/build/esm/models/blocks.d.ts +1 -1
  99. package/build/esm/models/common.d.ts +2 -12
  100. package/build/esm/models/common.js +1 -13
  101. package/build/esm/utils/common.d.ts +1 -1
  102. package/build/esm/utils/common.js +3 -3
  103. package/package.json +5 -7
  104. package/server/data/contentFilter.js +1 -0
  105. package/server/data/createReadableContent.js +1 -1
  106. package/server/data/transformPost.d.ts +1 -1
  107. package/server/models/blocks.d.ts +1 -1
  108. package/server/models/common.d.ts +2 -12
  109. package/server/models/common.js +2 -14
@@ -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,7 +1,3 @@
1
- /**
2
- * @deprecated Metrika will be deleted after launch of analyticsEvents
3
- * https://st.yandex-team.ru/PAGECTR-7
4
- */
5
1
  const Goal = {
6
2
  SUPPORT_OPEN_FORM: 'SUPPORTOPENFORM',
7
3
  SUPPORT_STEP_1_SUBMIT: 'SUPPORTSTEP1SUBMIT',
@@ -1,4 +1,4 @@
1
- import { useState, useCallback, useEffect } from 'react';
1
+ import { useCallback, useEffect, useState } from 'react';
2
2
  export const useLikes = ({ hasLike, count, toggleLikeCallback, postId }) => {
3
3
  const [hasUserLike, setHasUserLike] = useState(hasLike !== null && hasLike !== void 0 ? hasLike : false);
4
4
  const [likesCount, setLikesCount] = useState(count !== null && count !== void 0 ? count : 0);
@@ -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
- }
@@ -16,16 +16,4 @@ export var BlockType;
16
16
  BlockType["Suggest"] = "blog-suggest-block";
17
17
  BlockType["Meta"] = "blog-meta-block";
18
18
  BlockType["Feed"] = "blog-feed-block";
19
- })(BlockType || (BlockType = {}));
20
- export var DefaultEventNames;
21
- (function (DefaultEventNames) {
22
- DefaultEventNames["ShareButton"] = "share-button-click";
23
- DefaultEventNames["SaveButton"] = "save-button-click";
24
- DefaultEventNames["ShowMore"] = "show-more-button-click";
25
- DefaultEventNames["PaginatorHome"] = "paginator-home-button-click";
26
- DefaultEventNames["PaginatorNext"] = "paginator-next-button-click";
27
- DefaultEventNames["PaginatorPage"] = "paginator-page-button-click";
28
- DefaultEventNames["Tag"] = "selector-tag-click";
29
- DefaultEventNames["Service"] = "selector-service-click";
30
- DefaultEventNames["SaveOnly"] = "save-only-button-click";
31
- })(DefaultEventNames || (DefaultEventNames = {}));
19
+ })(BlockType || (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 { Tag, GetPostsRequest, Query } from '../models/common';
4
+ import { GetPostsRequest, Query, Tag } from '../models/common';
5
5
  export interface QueryParam {
6
6
  name: string;
7
7
  value?: string | number | null;
@@ -10,10 +10,10 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { format, parse } from 'url';
13
- import { memoize, debounce } from 'lodash';
13
+ import { debounce, memoize } from 'lodash';
14
14
  import { isNewMetrikaFormat, } from '@gravity-ui/page-constructor';
15
- import { i18, Keyset } from '../i18n';
16
- import { CONTENT_DEFAULT_COL_SIZES, CONTENT_DEFAULT_SIZE, CONTENT_DEFAULT_THEME, DEFAULT_ROWS_PER_PAGE, DEFAULT_PAGE, } from '../blocks/constants';
15
+ import { CONTENT_DEFAULT_COL_SIZES, CONTENT_DEFAULT_SIZE, CONTENT_DEFAULT_THEME, DEFAULT_PAGE, DEFAULT_ROWS_PER_PAGE, } from '../blocks/constants';
16
+ import { Keyset, i18 } from '../i18n';
17
17
  export function getAbsolutePath(router, url) {
18
18
  if (!router || !router.pathname) {
19
19
  return url !== null && url !== void 0 ? url : '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/blog-constructor",
3
- "version": "2.1.2-alpha.2",
3
+ "version": "2.2.0",
4
4
  "description": "Gravity UI Blog Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -72,8 +72,8 @@
72
72
  "@babel/core": "^7.15.8",
73
73
  "@commitlint/config-conventional": "^17.4.3",
74
74
  "@doc-tools/transform": "^2.9.0",
75
- "@gravity-ui/eslint-config": "^1.0.2",
76
- "@gravity-ui/page-constructor": "^2.6.0",
75
+ "@gravity-ui/eslint-config": "^2.0.0",
76
+ "@gravity-ui/page-constructor": "^2.2.1",
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",
@@ -96,8 +96,9 @@
96
96
  "@types/react-transition-group": "^4.4.4",
97
97
  "@types/sanitize-html": "^2.6.0",
98
98
  "@types/ua-parser-js": "^0.7.36",
99
- "eslint": "^8.0.0",
99
+ "eslint": "^8.34.0",
100
100
  "eslint-plugin-local": "./eslint-plugin-local",
101
+ "eslint-plugin-no-not-accumulator-reassign": "^0.1.0",
101
102
  "eslint-plugin-testing-library": "^5.9.1",
102
103
  "gulp": "^4.0.2",
103
104
  "gulp-dart-sass": "^1.0.2",
@@ -140,8 +141,5 @@
140
141
  "*.{json,yaml,yml,md}": [
141
142
  "prettier --write"
142
143
  ]
143
- },
144
- "publishConfig": {
145
- "tag": "alpha"
146
144
  }
147
145
  }
@@ -21,6 +21,7 @@ const filterItems = ({ items, itemsKey, options }) => {
21
21
  const whenResult = when === true ||
22
22
  when === undefined ||
23
23
  (typeof when === 'string' && (0, evaluation_1.default)(when, options));
24
+ // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
24
25
  delete item.when;
25
26
  if (whenResult) {
26
27
  const property = item[itemsKey];
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createReadableContent = void 0;
4
- const config_1 = require("./config");
5
4
  const common_1 = require("../models/common");
5
+ const config_1 = require("./config");
6
6
  /**
7
7
  * Function for create readable content
8
8
  *
@@ -1,5 +1,5 @@
1
- import { Lang } from '../models/locale';
2
1
  import { PostData } from '../models/common';
2
+ import { Lang } from '../models/locale';
3
3
  /**
4
4
  * Func for transform post data
5
5
  *
@@ -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.DefaultEventNames = exports.BlockType = exports.Theme = void 0;
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 = {}));