@gravity-ui/blog-constructor 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +7 -0
- package/build/cjs/blocks/Feed/Feed.js +47 -37
- package/build/cjs/blocks/Feed/reducer.d.ts +0 -5
- package/build/cjs/blocks/Feed/reducer.js +1 -4
- package/build/cjs/blocks/YFM/YFM.js +1 -1
- package/build/cjs/components/FeedHeader/FeedHeader.js +2 -2
- package/build/cjs/components/FeedHeader/components/Controls/Controls.d.ts +2 -3
- package/build/cjs/components/FeedHeader/components/Controls/Controls.js +24 -16
- package/build/cjs/components/Paginator/Paginator.d.ts +1 -1
- package/build/cjs/components/Paginator/Paginator.js +2 -2
- package/build/cjs/components/Paginator/types.d.ts +0 -1
- package/build/cjs/components/Posts/Posts.css +25 -0
- package/build/cjs/components/Posts/Posts.d.ts +0 -1
- package/build/cjs/components/Posts/Posts.js +5 -4
- package/build/cjs/components/Search/Search.js +1 -1
- package/build/cjs/models/common.d.ts +5 -1
- package/build/cjs/utils/common.js +1 -1
- package/build/esm/blocks/Feed/Feed.js +47 -37
- package/build/esm/blocks/Feed/reducer.d.ts +0 -5
- package/build/esm/blocks/Feed/reducer.js +1 -4
- package/build/esm/blocks/YFM/YFM.js +1 -1
- package/build/esm/components/FeedHeader/FeedHeader.js +2 -2
- package/build/esm/components/FeedHeader/components/Controls/Controls.d.ts +2 -3
- package/build/esm/components/FeedHeader/components/Controls/Controls.js +25 -17
- package/build/esm/components/Paginator/Paginator.d.ts +1 -1
- package/build/esm/components/Paginator/Paginator.js +2 -2
- package/build/esm/components/Paginator/types.d.ts +0 -1
- package/build/esm/components/Posts/Posts.css +25 -0
- package/build/esm/components/Posts/Posts.d.ts +0 -1
- package/build/esm/components/Posts/Posts.js +5 -4
- package/build/esm/components/Search/Search.js +1 -1
- package/build/esm/models/common.d.ts +5 -1
- package/build/esm/utils/common.js +1 -1
- package/package.json +1 -1
- package/server/data/sanitizeMeta.d.ts +2 -0
- package/server/data/sanitizeMeta.js +2 -0
- package/server/data/transformPageContent.js +1 -1
- package/server/models/common.d.ts +5 -1
- package/build/cjs/blocks/YFM/__tests__/YFM.test.d.ts +0 -1
- package/build/cjs/blocks/YFM/__tests__/YFM.test.js +0 -16
- package/build/cjs/counters/metrika.d.ts +0 -62
- package/build/cjs/counters/metrika.js +0 -173
- package/build/esm/blocks/YFM/__tests__/YFM.test.d.ts +0 -1
- package/build/esm/blocks/YFM/__tests__/YFM.test.js +0 -11
- package/build/esm/counters/metrika.d.ts +0 -62
- package/build/esm/counters/metrika.js +0 -169
@@ -6,7 +6,6 @@ export declare enum ActionTypes {
|
|
6
6
|
SetPosts = "setPosts",
|
7
7
|
SetShowMore = "setShowMore",
|
8
8
|
SetIsFetching = "setIsFetching",
|
9
|
-
SetIsShowMoreFetching = "setIsShowMoreFetching",
|
10
9
|
PageChange = "pageChange",
|
11
10
|
QueryParamsChange = "queryParamsChange"
|
12
11
|
}
|
@@ -15,7 +14,6 @@ export type State = {
|
|
15
14
|
errorLoad: boolean;
|
16
15
|
errorShowMore: boolean;
|
17
16
|
isFetching: boolean;
|
18
|
-
isShowMoreFetching: boolean;
|
19
17
|
isShowMoreVisible: boolean;
|
20
18
|
lastLoadedCount: number;
|
21
19
|
pinnedPostOnPage?: PostData;
|
@@ -29,9 +27,6 @@ type Action = {
|
|
29
27
|
} | {
|
30
28
|
type: ActionTypes.SetIsFetching;
|
31
29
|
payload: boolean;
|
32
|
-
} | {
|
33
|
-
type: ActionTypes.SetIsShowMoreFetching;
|
34
|
-
payload: boolean;
|
35
30
|
} | {
|
36
31
|
type: ActionTypes.SetPosts;
|
37
32
|
payload: {
|
@@ -6,7 +6,6 @@ export var ActionTypes;
|
|
6
6
|
ActionTypes["SetPosts"] = "setPosts";
|
7
7
|
ActionTypes["SetShowMore"] = "setShowMore";
|
8
8
|
ActionTypes["SetIsFetching"] = "setIsFetching";
|
9
|
-
ActionTypes["SetIsShowMoreFetching"] = "setIsShowMoreFetching";
|
10
9
|
ActionTypes["PageChange"] = "pageChange";
|
11
10
|
ActionTypes["QueryParamsChange"] = "queryParamsChange";
|
12
11
|
})(ActionTypes || (ActionTypes = {}));
|
@@ -17,11 +16,9 @@ export const reducer = (state, { type, payload }) => {
|
|
17
16
|
case ActionTypes.SetPosts:
|
18
17
|
return Object.assign(Object.assign({}, state), { lastLoadedCount: payload.count, postCountOnPage: payload.count, pinnedPostOnPage: payload.pinnedPost, postsOnPage: payload.posts, currentPage: payload.page });
|
19
18
|
case ActionTypes.SetShowMore:
|
20
|
-
return Object.assign(Object.assign({}, state), { lastLoadedCount: payload.lastLoadedCount, postCountOnPage: payload.count, currentPage: payload.currentPage, postsOnPage: payload.posts, errorShowMore: false
|
19
|
+
return Object.assign(Object.assign({}, state), { lastLoadedCount: payload.lastLoadedCount, postCountOnPage: payload.count, currentPage: payload.currentPage, postsOnPage: payload.posts, errorShowMore: false });
|
21
20
|
case ActionTypes.SetIsFetching:
|
22
21
|
return Object.assign(Object.assign({}, state), { isFetching: payload });
|
23
|
-
case ActionTypes.SetIsShowMoreFetching:
|
24
|
-
return Object.assign(Object.assign({}, state), { isShowMoreFetching: payload });
|
25
22
|
case ActionTypes.PageChange:
|
26
23
|
return Object.assign(Object.assign({}, state), { currentPage: payload, isFetching: true });
|
27
24
|
case ActionTypes.SetErrorLoad:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import block from 'bem-cn-lite';
|
3
2
|
import { YFMWrapper } from '@gravity-ui/page-constructor';
|
3
|
+
import block from 'bem-cn-lite';
|
4
4
|
import { Wrapper } from '../../components/Wrapper/Wrapper';
|
5
5
|
import { PaddingsDirections } from '../../models/paddings';
|
6
6
|
const b = block('yfm');
|
@@ -4,7 +4,7 @@ import { block } from '../../utils/cn';
|
|
4
4
|
import { Controls } from './components/Controls/Controls';
|
5
5
|
import './FeedHeader.css';
|
6
6
|
const b = block('feed-header');
|
7
|
-
export const FeedHeader = ({ tags, services,
|
7
|
+
export const FeedHeader = ({ tags, services, handleLoadData, offset = 'default', background, theme = 'default', verticalOffset = 'l', className, queryParams, }) => {
|
8
8
|
const backgroundThemed = background && getThemedValue(background, theme);
|
9
9
|
return (React.createElement("header", { className: b('header', { ['has-background']: Boolean(background) }, className) },
|
10
10
|
(backgroundThemed === null || backgroundThemed === void 0 ? void 0 : backgroundThemed.color) ? (React.createElement(FullWidthBackground, { style: { backgroundColor: backgroundThemed === null || backgroundThemed === void 0 ? void 0 : backgroundThemed.color }, theme: "rounded" })) : null,
|
@@ -14,5 +14,5 @@ export const FeedHeader = ({ tags, services, setIsFetching, offset = 'default',
|
|
14
14
|
? ''
|
15
15
|
: backgroundThemed === null || backgroundThemed === void 0 ? void 0 : backgroundThemed.color,
|
16
16
|
}, disableCompress: backgroundThemed === null || backgroundThemed === void 0 ? void 0 : backgroundThemed.disableCompress })) : null,
|
17
|
-
React.createElement(Controls, { tags: tags, services: services,
|
17
|
+
React.createElement(Controls, { tags: tags, services: services, handleLoadData: handleLoadData, queryParams: queryParams }))));
|
18
18
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { ReactNode } from 'react';
|
2
|
-
import {
|
2
|
+
import { FetchArgs, Query, SetQueryType } from '../../../../models/common';
|
3
3
|
import './Controls.css';
|
4
4
|
export type SelectItem = {
|
5
5
|
content: string;
|
@@ -7,10 +7,9 @@ export type SelectItem = {
|
|
7
7
|
icon?: ReactNode;
|
8
8
|
};
|
9
9
|
export type ControlsProps = {
|
10
|
-
|
10
|
+
handleLoadData: (props: FetchArgs) => void;
|
11
11
|
tags?: SelectItem[];
|
12
12
|
services?: SelectItem[];
|
13
|
-
handleChangeQuery: HandleChangeQueryParams;
|
14
13
|
queryParams: Query;
|
15
14
|
setQuery?: SetQueryType;
|
16
15
|
};
|
@@ -10,7 +10,7 @@ import metrika from '../../../../counters/metrika.js';
|
|
10
10
|
import { MetrikaCounter } from '../../../../counters/utils';
|
11
11
|
import { Keyset, i18 } from '../../../../i18n';
|
12
12
|
import { Save } from '../../../../icons/Save';
|
13
|
-
import { DefaultEventNames
|
13
|
+
import { DefaultEventNames } from '../../../../models/common';
|
14
14
|
import { block } from '../../../../utils/cn';
|
15
15
|
import { Search } from '../../../Search/Search';
|
16
16
|
import { renderFilter, renderOption, renderSwitcher } from './customRenders';
|
@@ -19,7 +19,7 @@ const b = block('feed-controls');
|
|
19
19
|
const ICON_SIZE = 16;
|
20
20
|
const DEFAULT_PAGE = 1;
|
21
21
|
const VIRTUALIZATION_THRESHOLD = 1000;
|
22
|
-
export const Controls = ({
|
22
|
+
export const Controls = ({ handleLoadData, tags = [], services = [], queryParams, }) => {
|
23
23
|
const { hasLikes } = useContext(LikesContext);
|
24
24
|
const handleAnalyticsTag = useAnalytics(DefaultEventNames.Tag);
|
25
25
|
const handleAnalyticsService = useAnalytics(DefaultEventNames.Service);
|
@@ -28,21 +28,25 @@ export const Controls = ({ setIsFetching, tags = [], services = [], handleChange
|
|
28
28
|
const [savedOnly, setSavedOnly] = useState(savedOnlyInitial === 'true');
|
29
29
|
const [search, setSearch] = useState(searchInitial);
|
30
30
|
const handleSavedOnly = () => {
|
31
|
-
handleChangeQuery({
|
32
|
-
savedOnly: savedOnly ? '' : 'true',
|
33
|
-
search: '',
|
34
|
-
tags: '',
|
35
|
-
page: DEFAULT_PAGE,
|
36
|
-
services: '',
|
37
|
-
});
|
38
31
|
handleAnalyticsSaveOnly();
|
39
32
|
setSavedOnly(!savedOnly);
|
40
|
-
|
33
|
+
handleLoadData({
|
34
|
+
page: DEFAULT_PAGE,
|
35
|
+
query: {
|
36
|
+
savedOnly: savedOnly ? '' : 'true',
|
37
|
+
search: '',
|
38
|
+
tags: '',
|
39
|
+
page: DEFAULT_PAGE,
|
40
|
+
services: '',
|
41
|
+
},
|
42
|
+
});
|
41
43
|
};
|
42
44
|
const handleSearch = (searchValue) => {
|
43
|
-
handleChangeQuery({ search: searchValue, page: DEFAULT_PAGE });
|
44
45
|
setSearch(searchValue);
|
45
|
-
|
46
|
+
handleLoadData({
|
47
|
+
page: DEFAULT_PAGE,
|
48
|
+
query: { search: searchValue, page: DEFAULT_PAGE },
|
49
|
+
});
|
46
50
|
};
|
47
51
|
const handleTagSelect = (selectedTags) => {
|
48
52
|
/**
|
@@ -55,11 +59,13 @@ export const Controls = ({ setIsFetching, tags = [], services = [], handleChange
|
|
55
59
|
theme: selectedTags[0],
|
56
60
|
});
|
57
61
|
const isEmptyTag = selectedTags.some((tag) => tag === 'empty');
|
58
|
-
|
59
|
-
tags: isEmptyTag ? '' : selectedTags[0],
|
62
|
+
handleLoadData({
|
60
63
|
page: DEFAULT_PAGE,
|
64
|
+
query: {
|
65
|
+
tags: isEmptyTag ? '' : selectedTags[0],
|
66
|
+
page: DEFAULT_PAGE,
|
67
|
+
},
|
61
68
|
});
|
62
|
-
setIsFetching(true);
|
63
69
|
};
|
64
70
|
const handleServicesSelect = (selectedServices) => {
|
65
71
|
const forMetrikaServices = services.filter((service) => {
|
@@ -76,8 +82,10 @@ export const Controls = ({ setIsFetching, tags = [], services = [], handleChange
|
|
76
82
|
service: metrikaAsString,
|
77
83
|
});
|
78
84
|
const servicesAsString = selectedServices.join(',');
|
79
|
-
|
80
|
-
|
85
|
+
handleLoadData({
|
86
|
+
page: DEFAULT_PAGE,
|
87
|
+
query: { services: servicesAsString, page: DEFAULT_PAGE },
|
88
|
+
});
|
81
89
|
};
|
82
90
|
const tagsItems = useMemo(() => [{ value: 'empty', content: i18(Keyset.AllTags) }, ...tags], [tags]);
|
83
91
|
const servicesItems = useMemo(() => (servicesInitial ? [...servicesInitial.split(',')] : []), [servicesInitial]);
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { PaginatorProps } from './types';
|
2
2
|
import './Paginator.css';
|
3
|
-
export declare const Paginator: ({ itemsPerPage, totalItems, maxPages, page, className,
|
3
|
+
export declare const Paginator: ({ itemsPerPage, totalItems, maxPages, page, className, onPageChange, pageCountForShowSupportButtons, }: PaginatorProps) => JSX.Element | null;
|
@@ -26,7 +26,7 @@ import { getPageConfigs, getPagesCount } from './utils';
|
|
26
26
|
import './Paginator.css';
|
27
27
|
const b = block('paginator');
|
28
28
|
const DEFAULT_PAGE_COUNT_FOR_SHOW_SUPPORT_BUTTONS = 6;
|
29
|
-
export const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className,
|
29
|
+
export const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className, onPageChange, pageCountForShowSupportButtons = DEFAULT_PAGE_COUNT_FOR_SHOW_SUPPORT_BUTTONS, }) => {
|
30
30
|
const [pagesCount, setPagesCount] = useState(getPagesCount({ itemsPerPage, totalItems, maxPages }));
|
31
31
|
useEffect(() => {
|
32
32
|
const count = getPagesCount({ itemsPerPage, totalItems, maxPages });
|
@@ -95,7 +95,7 @@ export const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className,
|
|
95
95
|
}
|
96
96
|
const renderPaginatorItem = (item) => {
|
97
97
|
const { key } = item, rest = __rest(item, ["key"]);
|
98
|
-
return React.createElement(PaginatorItem, Object.assign({ key: `page_${key}` }, rest
|
98
|
+
return React.createElement(PaginatorItem, Object.assign({ key: `page_${key}` }, rest));
|
99
99
|
};
|
100
100
|
return (React.createElement("div", { className: b('pagination') },
|
101
101
|
page > 1 && (React.createElement("div", { className: b('pagination-block') },
|
@@ -1,9 +1,15 @@
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
2
2
|
unpredictable css rules order in build */
|
3
|
+
.bc-posts {
|
4
|
+
position: relative;
|
5
|
+
}
|
3
6
|
.bc-posts__cards-container, .bc-posts__pinned-container {
|
4
7
|
padding-top: 24px;
|
5
8
|
scroll-margin: 48px;
|
6
9
|
}
|
10
|
+
.bc-posts__cards-container_isLoading {
|
11
|
+
opacity: 0.7;
|
12
|
+
}
|
7
13
|
.bc-posts__pagination {
|
8
14
|
display: flex;
|
9
15
|
flex-direction: column;
|
@@ -25,4 +31,23 @@ unpredictable css rules order in build */
|
|
25
31
|
}
|
26
32
|
.bc-posts__paginator {
|
27
33
|
padding-top: 12px;
|
34
|
+
}
|
35
|
+
.bc-posts__loaderContainer {
|
36
|
+
z-index: 6;
|
37
|
+
position: absolute;
|
38
|
+
top: 0;
|
39
|
+
left: 0;
|
40
|
+
width: 70%;
|
41
|
+
height: 100%;
|
42
|
+
background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0));
|
43
|
+
animation: shimmer 2s infinite linear;
|
44
|
+
}
|
45
|
+
|
46
|
+
@keyframes shimmer {
|
47
|
+
from {
|
48
|
+
transform: translateX(-200%);
|
49
|
+
}
|
50
|
+
to {
|
51
|
+
transform: translateX(300%);
|
52
|
+
}
|
28
53
|
}
|
@@ -9,7 +9,6 @@ type PostCardProps = {
|
|
9
9
|
postCountOnPage: number;
|
10
10
|
perPageInQuery: number;
|
11
11
|
isFetching: boolean;
|
12
|
-
isShowMoreFetching: boolean;
|
13
12
|
handleShowMore: (value?: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => Promise<void> | void;
|
14
13
|
handlePageChange: (value: number) => Promise<void> | void;
|
15
14
|
postsOnPage?: PostData[];
|
@@ -8,8 +8,9 @@ import { PostCard } from '../PostCard/PostCard';
|
|
8
8
|
import { PostsEmpty } from '../PostsEmpty/PostsEmpty';
|
9
9
|
import './Posts.css';
|
10
10
|
const b = block('posts');
|
11
|
-
export const Posts = ({ containerId, pinnedPostOnPage, currentPage, postsOnPage, isShowMoreVisible, errorShowMore, postCountOnPage, perPageInQuery, isFetching,
|
12
|
-
React.createElement("div", {
|
11
|
+
export const Posts = ({ containerId, pinnedPostOnPage, currentPage, postsOnPage, isShowMoreVisible, errorShowMore, postCountOnPage, perPageInQuery, isFetching, handleShowMore, handlePageChange, pageCountForShowSupportButtons, }) => (React.createElement("div", { className: b() },
|
12
|
+
isFetching && React.createElement("div", { className: b('loaderContainer') }),
|
13
|
+
React.createElement("div", { id: containerId, className: b('cards-container', { isLoading: isFetching }) },
|
13
14
|
pinnedPostOnPage && currentPage === 1 && (React.createElement("div", { className: b('pinned-container') },
|
14
15
|
React.createElement(PostCard, { post: pinnedPostOnPage, size: "m", fullWidth: true, showTag: true }))),
|
15
16
|
(postsOnPage === null || postsOnPage === void 0 ? void 0 : postsOnPage.length) ? (React.createElement(CardLayoutBlock, { title: '', colSizes: {
|
@@ -18,9 +19,9 @@ export const Posts = ({ containerId, pinnedPostOnPage, currentPage, postsOnPage,
|
|
18
19
|
md: 6,
|
19
20
|
} }, postsOnPage === null || postsOnPage === void 0 ? void 0 : postsOnPage.map((post) => (React.createElement(PostCard, { key: post.id, post: post, showTag: true }))))) : (React.createElement(PostsEmpty, null))),
|
20
21
|
React.createElement("div", { className: b('pagination') },
|
21
|
-
Boolean(isShowMoreVisible && (postsOnPage === null || postsOnPage === void 0 ? void 0 : postsOnPage.length)) && (React.createElement(Button, { view: "outlined", size: "xl", className: b('more-button'), onClick: handleShowMore
|
22
|
+
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))),
|
22
23
|
errorShowMore && (React.createElement("div", { className: b('error-show-more') },
|
23
24
|
React.createElement("div", null, i18(Keyset.ErrorTitle)),
|
24
25
|
React.createElement("div", null, i18(Keyset.PostLoadError)))),
|
25
26
|
Boolean(currentPage && postCountOnPage) && (React.createElement("div", { className: b('paginator') },
|
26
|
-
React.createElement(Paginator, { onPageChange: handlePageChange, page: currentPage, totalItems: postCountOnPage, itemsPerPage: perPageInQuery,
|
27
|
+
React.createElement(Paginator, { onPageChange: handlePageChange, page: currentPage, totalItems: postCountOnPage, itemsPerPage: perPageInQuery, maxPages: Infinity, pageCountForShowSupportButtons: pageCountForShowSupportButtons }))))));
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
2
|
-
import { debounce as lodashDebounce } from 'lodash';
|
3
2
|
import { TextInput } from '@gravity-ui/uikit';
|
3
|
+
import { debounce as lodashDebounce } from 'lodash';
|
4
4
|
import { useIsIPhone } from '../../hooks/useIsIPhone';
|
5
5
|
import { Keyset, i18 } from '../../i18n';
|
6
6
|
import { Close } from '../../icons/Close';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ReactNode } from 'react';
|
2
|
-
import { IBrowser, IDevice } from 'ua-parser-js';
|
3
2
|
import { HeaderBlockProps as PageConstructorHeaderBlockProps } from '@gravity-ui/page-constructor';
|
3
|
+
import { IBrowser, IDevice } from 'ua-parser-js';
|
4
4
|
import { Locale } from '../models/locale';
|
5
5
|
export declare enum Theme {
|
6
6
|
Light = "light",
|
@@ -161,3 +161,7 @@ export declare enum DefaultEventNames {
|
|
161
161
|
Service = "selector-service-click",
|
162
162
|
SaveOnly = "save-only-button-click"
|
163
163
|
}
|
164
|
+
export type FetchArgs = {
|
165
|
+
page?: number;
|
166
|
+
query: Query;
|
167
|
+
};
|
@@ -10,8 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
10
10
|
return t;
|
11
11
|
};
|
12
12
|
import { format, parse } from 'url';
|
13
|
-
import { debounce, memoize } from 'lodash';
|
14
13
|
import { isNewMetrikaFormat, } from '@gravity-ui/page-constructor';
|
14
|
+
import { debounce, memoize } from 'lodash';
|
15
15
|
import { CONTENT_DEFAULT_COL_SIZES, CONTENT_DEFAULT_SIZE, CONTENT_DEFAULT_THEME, DEFAULT_PAGE, DEFAULT_ROWS_PER_PAGE, } from '../blocks/constants';
|
16
16
|
import { Keyset, i18 } from '../i18n';
|
17
17
|
export function getAbsolutePath(router, url) {
|
package/package.json
CHANGED
@@ -4,6 +4,8 @@ exports.sanitizeMeta = void 0;
|
|
4
4
|
const server_1 = require("@gravity-ui/page-constructor/server");
|
5
5
|
/**
|
6
6
|
* Function for sanitized meta-data fields
|
7
|
+
* @param metaData PostMetaProps
|
8
|
+
* @returns metaData
|
7
9
|
*/
|
8
10
|
const sanitizeMeta = (metaData) => {
|
9
11
|
const { title, description, date, image, canonicalUrl, organization } = metaData;
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.transformPageContent = void 0;
|
7
|
-
const js_yaml_1 = __importDefault(require("js-yaml"));
|
8
7
|
const server_1 = require("@gravity-ui/page-constructor/server");
|
8
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
9
9
|
const config_1 = require("./config");
|
10
10
|
const contentFilter_1 = require("./contentFilter");
|
11
11
|
const transformBlocks = ({ blocks, lang, typographyConfig }) => (0, server_1.transformBlocks)(blocks, lang, Object.assign(Object.assign({}, typographyConfig), (0, config_1.getExtendTypographyConfig)()));
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ReactNode } from 'react';
|
2
|
-
import { IBrowser, IDevice } from 'ua-parser-js';
|
3
2
|
import { HeaderBlockProps as PageConstructorHeaderBlockProps } from '@gravity-ui/page-constructor';
|
3
|
+
import { IBrowser, IDevice } from 'ua-parser-js';
|
4
4
|
import { Locale } from '../models/locale';
|
5
5
|
export declare enum Theme {
|
6
6
|
Light = "light",
|
@@ -161,3 +161,7 @@ export declare enum DefaultEventNames {
|
|
161
161
|
Service = "selector-service-click",
|
162
162
|
SaveOnly = "save-only-button-click"
|
163
163
|
}
|
164
|
+
export type FetchArgs = {
|
165
|
+
page?: number;
|
166
|
+
query: Query;
|
167
|
+
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const react_1 = __importDefault(require("react"));
|
7
|
-
const react_2 = require("@testing-library/react");
|
8
|
-
const YFM_1 = require("../YFM");
|
9
|
-
const text = 'YFM block';
|
10
|
-
describe('YFM', () => {
|
11
|
-
test('Has id', async () => {
|
12
|
-
(0, react_2.render)(react_1.default.createElement(YFM_1.YFM, { text: text }));
|
13
|
-
const yfm = react_2.screen.getByText(text);
|
14
|
-
expect(yfm).toHaveClass('yfm');
|
15
|
-
});
|
16
|
-
});
|
@@ -1,62 +0,0 @@
|
|
1
|
-
export function initCounters(configs: any): void;
|
2
|
-
declare namespace _default {
|
3
|
-
export { hit };
|
4
|
-
export { params };
|
5
|
-
export { reachGoal };
|
6
|
-
export { reachGoals };
|
7
|
-
export { Goal };
|
8
|
-
export { getServicePrefix };
|
9
|
-
export { getMarketPlacePrefix };
|
10
|
-
export { goalGoToConsole };
|
11
|
-
export { goalGoToForm };
|
12
|
-
export { goalGoToDocs };
|
13
|
-
export { goalFormSubmit };
|
14
|
-
export { goalEventFormSubmit };
|
15
|
-
export { goalEventVideoAction };
|
16
|
-
export { goalCaseFormSubmit };
|
17
|
-
export { goalSwitchLang };
|
18
|
-
}
|
19
|
-
export default _default;
|
20
|
-
declare function hit(...args: any[]): void;
|
21
|
-
declare function params(...args: any[]): void;
|
22
|
-
declare function reachGoal(counterName: any, ...args: any[]): void;
|
23
|
-
declare function reachGoals(goals: any, counterName?: string): void;
|
24
|
-
/**
|
25
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
26
|
-
*/
|
27
|
-
declare const Goal: {
|
28
|
-
SUPPORT_OPEN_FORM: string;
|
29
|
-
SUPPORT_STEP_1_SUBMIT: string;
|
30
|
-
SUPPORT_STEP_2_SUBMIT: string;
|
31
|
-
SUPPORT_STEP_3_SUBMIT: string;
|
32
|
-
SUPPORT_THANKYOU_SUBMIT: string;
|
33
|
-
MP_OPEN_FORM: string;
|
34
|
-
EDIT_ON_GITHUB: string;
|
35
|
-
MAIN_GO_TO_VAR: string;
|
36
|
-
MAIN_GO_TO_ISV: string;
|
37
|
-
MAIN_ALL_PARTNERS: string;
|
38
|
-
FIND_GO_TO_VAR: string;
|
39
|
-
ISV_GO_TO_MP: string;
|
40
|
-
FOOTER_SUBSCRIBE: string;
|
41
|
-
FOOTER_MNG_SUBSCRIPTIONS: string;
|
42
|
-
MOBILE_STORE_IOS: string;
|
43
|
-
MOBILE_STORE_ANDROID: string;
|
44
|
-
REGION_POPUP_SHOW: string;
|
45
|
-
REGION_POPUP_YES: string;
|
46
|
-
REGION_POPUP_NO: string;
|
47
|
-
REGION_POPUP_CLOSE: string;
|
48
|
-
SCALE_REGISTRATION: string;
|
49
|
-
DLGOTOPRODUCT_MPSITE: string;
|
50
|
-
MPK8S_CLCK: string;
|
51
|
-
'SITE_CALCULATOR_SHARE-RESULT_CLICK': string;
|
52
|
-
};
|
53
|
-
declare function getServicePrefix(id: any): "CMPT" | "IAM" | "VPC" | "STRG" | "SK" | "CH" | "MONGO" | "POSTGR" | "MR" | "MMSQL" | "MK" | "TRSL" | "INSTGR" | "LB" | "MQ" | "DL" | "MNTRG" | "DP" | "KMS" | "YDB" | "INTRCNCT" | undefined;
|
54
|
-
declare function getMarketPlacePrefix(id: any): string;
|
55
|
-
declare function goalGoToConsole(prefix: any): any;
|
56
|
-
declare function goalGoToForm(prefix: any): any;
|
57
|
-
declare function goalGoToDocs(prefix: any): any;
|
58
|
-
declare function goalFormSubmit(prefix: any): any;
|
59
|
-
declare function goalEventFormSubmit(id: any): string;
|
60
|
-
declare function goalEventVideoAction(id: any, action: any): string;
|
61
|
-
declare function goalCaseFormSubmit(id: any): string;
|
62
|
-
declare function goalSwitchLang(place: any): string;
|
@@ -1,173 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.initCounters = void 0;
|
4
|
-
/**
|
5
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
6
|
-
*/
|
7
|
-
const Goal = {
|
8
|
-
SUPPORT_OPEN_FORM: 'SUPPORTOPENFORM',
|
9
|
-
SUPPORT_STEP_1_SUBMIT: 'SUPPORTSTEP1SUBMIT',
|
10
|
-
SUPPORT_STEP_2_SUBMIT: 'SUPPORTSTEP2SUBMIT',
|
11
|
-
SUPPORT_STEP_3_SUBMIT: 'SUPPORTSTEP3SUBMIT',
|
12
|
-
SUPPORT_THANKYOU_SUBMIT: 'SUPPORTTHANKYOUSUBMIT',
|
13
|
-
MP_OPEN_FORM: 'MPOPENFORM',
|
14
|
-
EDIT_ON_GITHUB: 'EDITONGITHUB',
|
15
|
-
MAIN_GO_TO_VAR: 'MAINGOTOVAR',
|
16
|
-
MAIN_GO_TO_ISV: 'MAINGOTOISV',
|
17
|
-
MAIN_ALL_PARTNERS: 'MAINALLPARTNERS',
|
18
|
-
FIND_GO_TO_VAR: 'FINDGOTOVAR',
|
19
|
-
ISV_GO_TO_MP: 'ISVGOTOMP',
|
20
|
-
FOOTER_SUBSCRIBE: 'FOOTERSUBSCRIBE',
|
21
|
-
FOOTER_MNG_SUBSCRIPTIONS: 'FOOTERMNGSUBSCRIPTIONS',
|
22
|
-
MOBILE_STORE_IOS: '154_Mobile_App_Store_Badge',
|
23
|
-
MOBILE_STORE_ANDROID: '155_Mobile_Google_Play_Badge',
|
24
|
-
REGION_POPUP_SHOW: 'REGIONPOPUP',
|
25
|
-
REGION_POPUP_YES: 'REGIONPOPUPYES',
|
26
|
-
REGION_POPUP_NO: 'REGIONPOPUPNO',
|
27
|
-
REGION_POPUP_CLOSE: 'REGIONPOPUPCLOSE',
|
28
|
-
SCALE_REGISTRATION: 'Scale_registration',
|
29
|
-
DLGOTOPRODUCT_MPSITE: 'DLGOTOPRODUCT_MPSITE',
|
30
|
-
MPK8S_CLCK: 'MPK8S_CLCK',
|
31
|
-
'SITE_CALCULATOR_SHARE-RESULT_CLICK': 'SITE_CALCULATOR_SHARE-RESULT_CLICK',
|
32
|
-
};
|
33
|
-
const HIT_COUNTERS = ['main', 'cross-site', 'scale'];
|
34
|
-
const counterIds = {};
|
35
|
-
function getCounter(name) {
|
36
|
-
const counterId = counterIds[name];
|
37
|
-
return window['yaCounter' + counterId];
|
38
|
-
}
|
39
|
-
function initCounters(configs) {
|
40
|
-
configs.forEach((config) => {
|
41
|
-
counterIds[config.name] = config.id;
|
42
|
-
});
|
43
|
-
}
|
44
|
-
exports.initCounters = initCounters;
|
45
|
-
function hit(...args) {
|
46
|
-
HIT_COUNTERS.forEach((counterName) => {
|
47
|
-
const counter = getCounter(counterName);
|
48
|
-
if (!counter) {
|
49
|
-
return;
|
50
|
-
}
|
51
|
-
counter.hit(...args);
|
52
|
-
});
|
53
|
-
}
|
54
|
-
function params(...args) {
|
55
|
-
const counter = getCounter('main');
|
56
|
-
if (!counter) {
|
57
|
-
return;
|
58
|
-
}
|
59
|
-
counter.params(...args);
|
60
|
-
}
|
61
|
-
function reachGoal(counterName, ...args) {
|
62
|
-
const counter = getCounter(counterName);
|
63
|
-
if (!counter) {
|
64
|
-
return;
|
65
|
-
}
|
66
|
-
counter.reachGoal(...args);
|
67
|
-
}
|
68
|
-
function reachGoals(goals, counterName = 'main') {
|
69
|
-
if (!goals) {
|
70
|
-
return;
|
71
|
-
}
|
72
|
-
const goalsArray = Array.isArray(goals) ? goals : [goals];
|
73
|
-
goalsArray.forEach((goal) => {
|
74
|
-
if (typeof goal === 'object') {
|
75
|
-
reachGoal(counterName, goal.name, goal.params);
|
76
|
-
}
|
77
|
-
else {
|
78
|
-
reachGoal(counterName, goal);
|
79
|
-
}
|
80
|
-
});
|
81
|
-
}
|
82
|
-
// eslint-disable-next-line complexity
|
83
|
-
function getServicePrefix(id) {
|
84
|
-
switch (id) {
|
85
|
-
case 'compute':
|
86
|
-
return 'CMPT';
|
87
|
-
case 'iam':
|
88
|
-
return 'IAM';
|
89
|
-
case 'vpc':
|
90
|
-
return 'VPC';
|
91
|
-
case 'storage':
|
92
|
-
return 'STRG';
|
93
|
-
case 'speechkit':
|
94
|
-
return 'SK';
|
95
|
-
case 'managed-clickhouse':
|
96
|
-
return 'CH';
|
97
|
-
case 'managed-mongodb':
|
98
|
-
return 'MONGO';
|
99
|
-
case 'managed-postgresql':
|
100
|
-
return 'POSTGR';
|
101
|
-
case 'managed-redis':
|
102
|
-
return 'MR';
|
103
|
-
case 'managed-mysql':
|
104
|
-
return 'MMSQL';
|
105
|
-
case 'managed-kubernetes':
|
106
|
-
return 'MK';
|
107
|
-
case 'translate':
|
108
|
-
return 'TRSL';
|
109
|
-
case 'instance-groups':
|
110
|
-
return 'INSTGR';
|
111
|
-
case 'load-balancer':
|
112
|
-
return 'LB';
|
113
|
-
case 'message-queue':
|
114
|
-
return 'MQ';
|
115
|
-
case 'datalens':
|
116
|
-
return 'DL';
|
117
|
-
case 'monitoring':
|
118
|
-
return 'MNTRG';
|
119
|
-
case 'data-proc':
|
120
|
-
return 'DP';
|
121
|
-
case 'kms':
|
122
|
-
return 'KMS';
|
123
|
-
case 'ydb':
|
124
|
-
return 'YDB';
|
125
|
-
case 'interconnect':
|
126
|
-
return 'INTRCNCT';
|
127
|
-
}
|
128
|
-
return undefined;
|
129
|
-
}
|
130
|
-
function getMarketPlacePrefix(id) {
|
131
|
-
return `product_${id}_`;
|
132
|
-
}
|
133
|
-
function goalGoToConsole(prefix) {
|
134
|
-
return prefix && `${prefix}GOTOCONSOLE`;
|
135
|
-
}
|
136
|
-
function goalGoToForm(prefix) {
|
137
|
-
return prefix && `${prefix}GOTOFORM`;
|
138
|
-
}
|
139
|
-
function goalGoToDocs(prefix) {
|
140
|
-
return prefix && `${prefix}GOTODOCS`;
|
141
|
-
}
|
142
|
-
function goalFormSubmit(prefix) {
|
143
|
-
return prefix && `${prefix}FORMSUBMIT`;
|
144
|
-
}
|
145
|
-
function goalEventFormSubmit(id) {
|
146
|
-
return `event${id || 's'}_form_submit`;
|
147
|
-
}
|
148
|
-
function goalEventVideoAction(id, action) {
|
149
|
-
return `event${id}_video_${action}`;
|
150
|
-
}
|
151
|
-
function goalCaseFormSubmit(id) {
|
152
|
-
return `case${id ? `_${id}` : 's'}_form_submit`;
|
153
|
-
}
|
154
|
-
function goalSwitchLang(place) {
|
155
|
-
return `SWITCH_LANG_${place}`;
|
156
|
-
}
|
157
|
-
exports.default = {
|
158
|
-
hit,
|
159
|
-
params,
|
160
|
-
reachGoal,
|
161
|
-
reachGoals,
|
162
|
-
Goal,
|
163
|
-
getServicePrefix,
|
164
|
-
getMarketPlacePrefix,
|
165
|
-
goalGoToConsole,
|
166
|
-
goalGoToForm,
|
167
|
-
goalGoToDocs,
|
168
|
-
goalFormSubmit,
|
169
|
-
goalEventFormSubmit,
|
170
|
-
goalEventVideoAction,
|
171
|
-
goalCaseFormSubmit,
|
172
|
-
goalSwitchLang,
|
173
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { render, screen } from '@testing-library/react';
|
3
|
-
import { YFM } from '../YFM';
|
4
|
-
const text = 'YFM block';
|
5
|
-
describe('YFM', () => {
|
6
|
-
test('Has id', async () => {
|
7
|
-
render(React.createElement(YFM, { text: text }));
|
8
|
-
const yfm = screen.getByText(text);
|
9
|
-
expect(yfm).toHaveClass('yfm');
|
10
|
-
});
|
11
|
-
});
|