@gravity-ui/blog-constructor 4.1.2 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/build/cjs/blocks/Author/schema.d.ts +3 -1
  3. package/build/cjs/blocks/Banner/schema.d.ts +3 -1
  4. package/build/cjs/blocks/CTA/schema.d.ts +3 -1
  5. package/build/cjs/blocks/ColoredText/schema.d.ts +3 -1
  6. package/build/cjs/blocks/Feed/schema.d.ts +3 -1
  7. package/build/cjs/blocks/Header/schema.d.ts +3 -1
  8. package/build/cjs/blocks/Layout/schema.d.ts +3 -1
  9. package/build/cjs/blocks/Media/schema.d.ts +3 -1
  10. package/build/cjs/blocks/Meta/schema.d.ts +3 -1
  11. package/build/cjs/blocks/Suggest/schema.d.ts +3 -1
  12. package/build/cjs/blocks/YFM/schema.d.ts +3 -1
  13. package/build/cjs/containers/BlogPage/BlogPage.js +14 -15
  14. package/build/cjs/containers/BlogPostPage/BlogPostPage.d.ts +3 -1
  15. package/build/cjs/containers/BlogPostPage/BlogPostPage.js +48 -7
  16. package/build/cjs/schema/index.d.ts +33 -11
  17. package/build/esm/blocks/Author/schema.d.ts +3 -1
  18. package/build/esm/blocks/Banner/schema.d.ts +3 -1
  19. package/build/esm/blocks/CTA/schema.d.ts +3 -1
  20. package/build/esm/blocks/ColoredText/schema.d.ts +3 -1
  21. package/build/esm/blocks/Feed/schema.d.ts +3 -1
  22. package/build/esm/blocks/Header/schema.d.ts +3 -1
  23. package/build/esm/blocks/Layout/schema.d.ts +3 -1
  24. package/build/esm/blocks/Media/schema.d.ts +3 -1
  25. package/build/esm/blocks/Meta/schema.d.ts +3 -1
  26. package/build/esm/blocks/Suggest/schema.d.ts +3 -1
  27. package/build/esm/blocks/YFM/schema.d.ts +3 -1
  28. package/build/esm/containers/BlogPage/BlogPage.js +15 -16
  29. package/build/esm/containers/BlogPostPage/BlogPostPage.d.ts +3 -1
  30. package/build/esm/containers/BlogPostPage/BlogPostPage.js +25 -7
  31. package/build/esm/schema/index.d.ts +33 -11
  32. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.2.1](https://github.com/gravity-ui/blog-constructor/compare/v4.2.0...v4.2.1) (2023-07-07)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * prompt-sign-in-on-like for blog post pages ([#75](https://github.com/gravity-ui/blog-constructor/issues/75)) ([1862306](https://github.com/gravity-ui/blog-constructor/commit/186230610d13e4c31bfd4bbbb52128b23e81bf39))
9
+
10
+ ## [4.2.0](https://github.com/gravity-ui/blog-constructor/compare/v4.1.2...v4.2.0) (2023-06-28)
11
+
12
+
13
+ ### Features
14
+
15
+ * update page constructor version ([#73](https://github.com/gravity-ui/blog-constructor/issues/73)) ([2d46b27](https://github.com/gravity-ui/blog-constructor/commit/2d46b27c1e2550ebaa9da4c2eb7a873cdda66ca6))
16
+
3
17
  ## [4.1.2](https://github.com/gravity-ui/blog-constructor/compare/v4.1.1...v4.1.2) (2023-06-23)
4
18
 
5
19
 
@@ -47,7 +47,9 @@ export declare const Author: {
47
47
  type: string;
48
48
  };
49
49
  type: {};
50
- when: {};
50
+ when: {
51
+ type: string;
52
+ };
51
53
  };
52
54
  };
53
55
  };
@@ -122,7 +122,9 @@ export declare const Banner: {
122
122
  type: string;
123
123
  };
124
124
  type: {};
125
- when: {};
125
+ when: {
126
+ type: string;
127
+ };
126
128
  };
127
129
  };
128
130
  };
@@ -122,7 +122,9 @@ export declare const CTA: {
122
122
  type: string;
123
123
  };
124
124
  type: {};
125
- when: {};
125
+ when: {
126
+ type: string;
127
+ };
126
128
  };
127
129
  };
128
130
  };
@@ -139,7 +139,9 @@ export declare const ColoredText: {
139
139
  type: string;
140
140
  };
141
141
  type: {};
142
- when: {};
142
+ when: {
143
+ type: string;
144
+ };
143
145
  };
144
146
  };
145
147
  };
@@ -60,7 +60,9 @@ export declare const Feed: {
60
60
  type: string;
61
61
  };
62
62
  type: {};
63
- when: {};
63
+ when: {
64
+ type: string;
65
+ };
64
66
  };
65
67
  };
66
68
  };
@@ -474,7 +474,9 @@ export declare const Header: {
474
474
  type: string;
475
475
  };
476
476
  type: {};
477
- when: {};
477
+ when: {
478
+ type: string;
479
+ };
478
480
  };
479
481
  };
480
482
  };
@@ -54,7 +54,9 @@ export declare const Layout: {
54
54
  type: string;
55
55
  };
56
56
  type: {};
57
- when: {};
57
+ when: {
58
+ type: string;
59
+ };
58
60
  };
59
61
  };
60
62
  };
@@ -266,7 +266,9 @@ export declare const Media: {
266
266
  type: string;
267
267
  };
268
268
  type: {};
269
- when: {};
269
+ when: {
270
+ type: string;
271
+ };
270
272
  };
271
273
  };
272
274
  };
@@ -43,7 +43,9 @@ export declare const Meta: {
43
43
  type: string;
44
44
  };
45
45
  type: {};
46
- when: {};
46
+ when: {
47
+ type: string;
48
+ };
47
49
  };
48
50
  };
49
51
  };
@@ -43,7 +43,9 @@ export declare const Suggest: {
43
43
  type: string;
44
44
  };
45
45
  type: {};
46
- when: {};
46
+ when: {
47
+ type: string;
48
+ };
47
49
  };
48
50
  };
49
51
  };
@@ -48,7 +48,9 @@ export declare const YFM: {
48
48
  type: string;
49
49
  };
50
50
  type: {};
51
- when: {};
51
+ when: {
52
+ type: string;
53
+ };
52
54
  };
53
55
  };
54
56
  };
@@ -48,21 +48,20 @@ const FeedContext_1 = require("../../contexts/FeedContext");
48
48
  const LikesContext_1 = require("../../contexts/LikesContext");
49
49
  const BlogPage = ({ content, posts, tags, services, getPosts, metaData, hasLikes = false, toggleLike, navigation, settings, pageCountForShowSupportButtons, isSignedInUser = false, onClickSignIn, }) => {
50
50
  const _a = (0, usePromptSignInProps_1.usePromptSignInProps)(onClickSignIn), { requireSignIn } = _a, promptSignInProps = __rest(_a, ["requireSignIn"]);
51
- const likes = (0, react_1.useMemo)(() => ({ toggleLike, hasLikes, isSignedInUser, requireSignIn }), [toggleLike, hasLikes, isSignedInUser, requireSignIn]);
52
- return (react_1.default.createElement(react_1.Fragment, null,
53
- react_1.default.createElement(LikesContext_1.LikesContext.Provider, { value: likes },
54
- react_1.default.createElement(FeedContext_1.FeedContext.Provider, { value: {
55
- posts: posts.posts,
56
- pinnedPost: posts.pinnedPost,
57
- totalCount: posts.count,
58
- tags,
59
- services: services !== null && services !== void 0 ? services : [],
60
- getPosts,
61
- pageCountForShowSupportButtons,
62
- } },
63
- react_1.default.createElement(page_constructor_1.PageConstructorProvider, Object.assign({}, settings),
64
- metaData ? react_1.default.createElement(MetaWrapper_1.MetaWrapper, Object.assign({}, metaData)) : null,
65
- react_1.default.createElement(page_constructor_1.PageConstructor, { content: content, custom: blocksMap_1.default, navigation: navigation })))),
51
+ const likesContextData = (0, react_1.useMemo)(() => ({ toggleLike, hasLikes, isSignedInUser, requireSignIn }), [toggleLike, hasLikes, isSignedInUser, requireSignIn]);
52
+ return (react_1.default.createElement(LikesContext_1.LikesContext.Provider, { value: likesContextData },
53
+ react_1.default.createElement(FeedContext_1.FeedContext.Provider, { value: {
54
+ posts: posts.posts,
55
+ pinnedPost: posts.pinnedPost,
56
+ totalCount: posts.count,
57
+ tags,
58
+ services: services !== null && services !== void 0 ? services : [],
59
+ getPosts,
60
+ pageCountForShowSupportButtons,
61
+ } },
62
+ react_1.default.createElement(page_constructor_1.PageConstructorProvider, Object.assign({}, settings),
63
+ metaData ? react_1.default.createElement(MetaWrapper_1.MetaWrapper, Object.assign({}, metaData)) : null,
64
+ react_1.default.createElement(page_constructor_1.PageConstructor, { content: content, custom: blocksMap_1.default, navigation: navigation }))),
66
65
  react_1.default.createElement(PromptSignIn_1.PromptSignIn, Object.assign({}, promptSignInProps))));
67
66
  };
68
67
  exports.BlogPage = BlogPage;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { SyntheticEvent } from 'react';
2
2
  import { NavigationData, PageConstructorProviderProps, PageContent } from '@gravity-ui/page-constructor';
3
3
  import { ShareOptions } from '@gravity-ui/uikit';
4
4
  import { MetaProps, PostData, ToggleLikeCallbackType } from '../../models/common';
@@ -15,5 +15,7 @@ export interface BlogPostPageProps {
15
15
  settings?: PageConstructorProviderProps;
16
16
  navigation?: NavigationData;
17
17
  shareOptions?: ShareOptions[];
18
+ isSignedInUser?: boolean;
19
+ onClickSignIn?: React.EventHandler<SyntheticEvent>;
18
20
  }
19
21
  export declare const BlogPostPage: React.FC<BlogPostPageProps>;
@@ -1,27 +1,67 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __rest = (this && this.__rest) || function (s, e) {
26
+ var t = {};
27
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
+ t[p] = s[p];
29
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
+ t[p[i]] = s[p[i]];
33
+ }
34
+ return t;
35
+ };
2
36
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
38
  };
5
39
  Object.defineProperty(exports, "__esModule", { value: true });
6
40
  exports.BlogPostPage = void 0;
7
- const react_1 = __importDefault(require("react"));
41
+ const react_1 = __importStar(require("react"));
8
42
  const page_constructor_1 = require("@gravity-ui/page-constructor");
9
43
  const MetaWrapper_1 = require("../../components/MetaWrapper/MetaWrapper");
44
+ const PromptSignIn_1 = require("../../components/PromptSignIn/PromptSignIn");
45
+ const usePromptSignInProps_1 = require("../../components/PromptSignIn/hooks/usePromptSignInProps");
10
46
  const blocksMap_1 = __importDefault(require("../../constructor/blocksMap"));
11
47
  const LikesContext_1 = require("../../contexts/LikesContext");
12
48
  const PostPageContext_1 = require("../../contexts/PostPageContext");
13
49
  const useLikes_1 = require("../../hooks/useLikes");
14
- const BlogPostPage = ({ metaData, suggestedPosts, likes, content, post, settings, navigation, shareOptions, }) => {
50
+ const BlogPostPage = ({ metaData, suggestedPosts, likes, content, post, settings, navigation, shareOptions, isSignedInUser = false, onClickSignIn, }) => {
15
51
  const { hasUserLike, likesCount, handleLike } = (0, useLikes_1.useLikes)({
16
52
  hasLike: likes === null || likes === void 0 ? void 0 : likes.hasUserLike,
17
53
  count: likes === null || likes === void 0 ? void 0 : likes.likesCount,
18
54
  toggleLikeCallback: likes === null || likes === void 0 ? void 0 : likes.toggleLike,
19
55
  postId: post === null || post === void 0 ? void 0 : post.blogPostId,
20
56
  });
21
- return (react_1.default.createElement(LikesContext_1.LikesContext.Provider, { value: {
22
- toggleLike: likes === null || likes === void 0 ? void 0 : likes.toggleLike,
23
- hasLikes: Boolean(likes),
24
- } },
57
+ const _a = (0, usePromptSignInProps_1.usePromptSignInProps)(onClickSignIn), { requireSignIn } = _a, promptSignInProps = __rest(_a, ["requireSignIn"]);
58
+ const likesContextData = (0, react_1.useMemo)(() => ({
59
+ toggleLike: likes === null || likes === void 0 ? void 0 : likes.toggleLike,
60
+ hasLikes: Boolean(likes),
61
+ isSignedInUser,
62
+ requireSignIn,
63
+ }), [likes, isSignedInUser, requireSignIn]);
64
+ return (react_1.default.createElement(LikesContext_1.LikesContext.Provider, { value: likesContextData },
25
65
  react_1.default.createElement(PostPageContext_1.PostPageContext.Provider, { value: {
26
66
  post,
27
67
  suggestedPosts,
@@ -36,6 +76,7 @@ const BlogPostPage = ({ metaData, suggestedPosts, likes, content, post, settings
36
76
  } },
37
77
  react_1.default.createElement(page_constructor_1.PageConstructorProvider, Object.assign({}, settings),
38
78
  metaData ? react_1.default.createElement(MetaWrapper_1.MetaWrapper, Object.assign({}, metaData)) : null,
39
- react_1.default.createElement(page_constructor_1.PageConstructor, { content: content, custom: blocksMap_1.default, navigation: navigation })))));
79
+ react_1.default.createElement(page_constructor_1.PageConstructor, { content: content, custom: blocksMap_1.default, navigation: navigation }))),
80
+ react_1.default.createElement(PromptSignIn_1.PromptSignIn, Object.assign({}, promptSignInProps))));
40
81
  };
41
82
  exports.BlogPostPage = BlogPostPage;
@@ -482,7 +482,9 @@ export declare const schemasForCustom: {
482
482
  type: string;
483
483
  };
484
484
  type: {};
485
- when: {};
485
+ when: {
486
+ type: string;
487
+ };
486
488
  };
487
489
  };
488
490
  };
@@ -537,7 +539,9 @@ export declare const schemasForCustom: {
537
539
  type: string;
538
540
  };
539
541
  type: {};
540
- when: {};
542
+ when: {
543
+ type: string;
544
+ };
541
545
  };
542
546
  };
543
547
  };
@@ -665,7 +669,9 @@ export declare const schemasForCustom: {
665
669
  type: string;
666
670
  };
667
671
  type: {};
668
- when: {};
672
+ when: {
673
+ type: string;
674
+ };
669
675
  };
670
676
  };
671
677
  };
@@ -810,7 +816,9 @@ export declare const schemasForCustom: {
810
816
  type: string;
811
817
  };
812
818
  type: {};
813
- when: {};
819
+ when: {
820
+ type: string;
821
+ };
814
822
  };
815
823
  };
816
824
  };
@@ -938,7 +946,9 @@ export declare const schemasForCustom: {
938
946
  type: string;
939
947
  };
940
948
  type: {};
941
- when: {};
949
+ when: {
950
+ type: string;
951
+ };
942
952
  };
943
953
  };
944
954
  };
@@ -1004,7 +1014,9 @@ export declare const schemasForCustom: {
1004
1014
  type: string;
1005
1015
  };
1006
1016
  type: {};
1007
- when: {};
1017
+ when: {
1018
+ type: string;
1019
+ };
1008
1020
  };
1009
1021
  };
1010
1022
  };
@@ -1064,7 +1076,9 @@ export declare const schemasForCustom: {
1064
1076
  type: string;
1065
1077
  };
1066
1078
  type: {};
1067
- when: {};
1079
+ when: {
1080
+ type: string;
1081
+ };
1068
1082
  };
1069
1083
  };
1070
1084
  };
@@ -1336,7 +1350,9 @@ export declare const schemasForCustom: {
1336
1350
  type: string;
1337
1351
  };
1338
1352
  type: {};
1339
- when: {};
1353
+ when: {
1354
+ type: string;
1355
+ };
1340
1356
  };
1341
1357
  };
1342
1358
  };
@@ -1385,7 +1401,9 @@ export declare const schemasForCustom: {
1385
1401
  type: string;
1386
1402
  };
1387
1403
  type: {};
1388
- when: {};
1404
+ when: {
1405
+ type: string;
1406
+ };
1389
1407
  };
1390
1408
  };
1391
1409
  };
@@ -1434,7 +1452,9 @@ export declare const schemasForCustom: {
1434
1452
  type: string;
1435
1453
  };
1436
1454
  type: {};
1437
- when: {};
1455
+ when: {
1456
+ type: string;
1457
+ };
1438
1458
  };
1439
1459
  };
1440
1460
  };
@@ -1488,7 +1508,9 @@ export declare const schemasForCustom: {
1488
1508
  type: string;
1489
1509
  };
1490
1510
  type: {};
1491
- when: {};
1511
+ when: {
1512
+ type: string;
1513
+ };
1492
1514
  };
1493
1515
  };
1494
1516
  };
@@ -47,7 +47,9 @@ export declare const Author: {
47
47
  type: string;
48
48
  };
49
49
  type: {};
50
- when: {};
50
+ when: {
51
+ type: string;
52
+ };
51
53
  };
52
54
  };
53
55
  };
@@ -122,7 +122,9 @@ export declare const Banner: {
122
122
  type: string;
123
123
  };
124
124
  type: {};
125
- when: {};
125
+ when: {
126
+ type: string;
127
+ };
126
128
  };
127
129
  };
128
130
  };
@@ -122,7 +122,9 @@ export declare const CTA: {
122
122
  type: string;
123
123
  };
124
124
  type: {};
125
- when: {};
125
+ when: {
126
+ type: string;
127
+ };
126
128
  };
127
129
  };
128
130
  };
@@ -139,7 +139,9 @@ export declare const ColoredText: {
139
139
  type: string;
140
140
  };
141
141
  type: {};
142
- when: {};
142
+ when: {
143
+ type: string;
144
+ };
143
145
  };
144
146
  };
145
147
  };
@@ -60,7 +60,9 @@ export declare const Feed: {
60
60
  type: string;
61
61
  };
62
62
  type: {};
63
- when: {};
63
+ when: {
64
+ type: string;
65
+ };
64
66
  };
65
67
  };
66
68
  };
@@ -474,7 +474,9 @@ export declare const Header: {
474
474
  type: string;
475
475
  };
476
476
  type: {};
477
- when: {};
477
+ when: {
478
+ type: string;
479
+ };
478
480
  };
479
481
  };
480
482
  };
@@ -54,7 +54,9 @@ export declare const Layout: {
54
54
  type: string;
55
55
  };
56
56
  type: {};
57
- when: {};
57
+ when: {
58
+ type: string;
59
+ };
58
60
  };
59
61
  };
60
62
  };
@@ -266,7 +266,9 @@ export declare const Media: {
266
266
  type: string;
267
267
  };
268
268
  type: {};
269
- when: {};
269
+ when: {
270
+ type: string;
271
+ };
270
272
  };
271
273
  };
272
274
  };
@@ -43,7 +43,9 @@ export declare const Meta: {
43
43
  type: string;
44
44
  };
45
45
  type: {};
46
- when: {};
46
+ when: {
47
+ type: string;
48
+ };
47
49
  };
48
50
  };
49
51
  };
@@ -43,7 +43,9 @@ export declare const Suggest: {
43
43
  type: string;
44
44
  };
45
45
  type: {};
46
- when: {};
46
+ when: {
47
+ type: string;
48
+ };
47
49
  };
48
50
  };
49
51
  };
@@ -48,7 +48,9 @@ export declare const YFM: {
48
48
  type: string;
49
49
  };
50
50
  type: {};
51
- when: {};
51
+ when: {
52
+ type: string;
53
+ };
52
54
  };
53
55
  };
54
56
  };
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import React, { Fragment, useMemo } from 'react';
12
+ import React, { useMemo } from 'react';
13
13
  import { PageConstructor, PageConstructorProvider, } from '@gravity-ui/page-constructor';
14
14
  import { MetaWrapper } from '../../components/MetaWrapper/MetaWrapper';
15
15
  import { PromptSignIn } from '../../components/PromptSignIn/PromptSignIn';
@@ -20,20 +20,19 @@ import { LikesContext } from '../../contexts/LikesContext';
20
20
  import './BlogPage.css';
21
21
  export const BlogPage = ({ content, posts, tags, services, getPosts, metaData, hasLikes = false, toggleLike, navigation, settings, pageCountForShowSupportButtons, isSignedInUser = false, onClickSignIn, }) => {
22
22
  const _a = usePromptSignInProps(onClickSignIn), { requireSignIn } = _a, promptSignInProps = __rest(_a, ["requireSignIn"]);
23
- const likes = useMemo(() => ({ toggleLike, hasLikes, isSignedInUser, requireSignIn }), [toggleLike, hasLikes, isSignedInUser, requireSignIn]);
24
- return (React.createElement(Fragment, null,
25
- React.createElement(LikesContext.Provider, { value: likes },
26
- React.createElement(FeedContext.Provider, { value: {
27
- posts: posts.posts,
28
- pinnedPost: posts.pinnedPost,
29
- totalCount: posts.count,
30
- tags,
31
- services: services !== null && services !== void 0 ? services : [],
32
- getPosts,
33
- pageCountForShowSupportButtons,
34
- } },
35
- React.createElement(PageConstructorProvider, Object.assign({}, settings),
36
- metaData ? React.createElement(MetaWrapper, Object.assign({}, metaData)) : null,
37
- React.createElement(PageConstructor, { content: content, custom: componentMap, navigation: navigation })))),
23
+ const likesContextData = useMemo(() => ({ toggleLike, hasLikes, isSignedInUser, requireSignIn }), [toggleLike, hasLikes, isSignedInUser, requireSignIn]);
24
+ return (React.createElement(LikesContext.Provider, { value: likesContextData },
25
+ React.createElement(FeedContext.Provider, { value: {
26
+ posts: posts.posts,
27
+ pinnedPost: posts.pinnedPost,
28
+ totalCount: posts.count,
29
+ tags,
30
+ services: services !== null && services !== void 0 ? services : [],
31
+ getPosts,
32
+ pageCountForShowSupportButtons,
33
+ } },
34
+ React.createElement(PageConstructorProvider, Object.assign({}, settings),
35
+ metaData ? React.createElement(MetaWrapper, Object.assign({}, metaData)) : null,
36
+ React.createElement(PageConstructor, { content: content, custom: componentMap, navigation: navigation }))),
38
37
  React.createElement(PromptSignIn, Object.assign({}, promptSignInProps))));
39
38
  };
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { SyntheticEvent } from 'react';
2
2
  import { NavigationData, PageConstructorProviderProps, PageContent } from '@gravity-ui/page-constructor';
3
3
  import { ShareOptions } from '@gravity-ui/uikit';
4
4
  import { MetaProps, PostData, ToggleLikeCallbackType } from '../../models/common';
@@ -16,5 +16,7 @@ export interface BlogPostPageProps {
16
16
  settings?: PageConstructorProviderProps;
17
17
  navigation?: NavigationData;
18
18
  shareOptions?: ShareOptions[];
19
+ isSignedInUser?: boolean;
20
+ onClickSignIn?: React.EventHandler<SyntheticEvent>;
19
21
  }
20
22
  export declare const BlogPostPage: React.FC<BlogPostPageProps>;
@@ -1,22 +1,39 @@
1
- import React from 'react';
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import React, { useMemo } from 'react';
2
13
  import { PageConstructor, PageConstructorProvider, } from '@gravity-ui/page-constructor';
3
14
  import { MetaWrapper } from '../../components/MetaWrapper/MetaWrapper';
15
+ import { PromptSignIn } from '../../components/PromptSignIn/PromptSignIn';
16
+ import { usePromptSignInProps } from '../../components/PromptSignIn/hooks/usePromptSignInProps';
4
17
  import componentMap from '../../constructor/blocksMap';
5
18
  import { LikesContext } from '../../contexts/LikesContext';
6
19
  import { PostPageContext } from '../../contexts/PostPageContext';
7
20
  import { useLikes } from '../../hooks/useLikes';
8
21
  import './BlogPostPage.css';
9
- export const BlogPostPage = ({ metaData, suggestedPosts, likes, content, post, settings, navigation, shareOptions, }) => {
22
+ export const BlogPostPage = ({ metaData, suggestedPosts, likes, content, post, settings, navigation, shareOptions, isSignedInUser = false, onClickSignIn, }) => {
10
23
  const { hasUserLike, likesCount, handleLike } = useLikes({
11
24
  hasLike: likes === null || likes === void 0 ? void 0 : likes.hasUserLike,
12
25
  count: likes === null || likes === void 0 ? void 0 : likes.likesCount,
13
26
  toggleLikeCallback: likes === null || likes === void 0 ? void 0 : likes.toggleLike,
14
27
  postId: post === null || post === void 0 ? void 0 : post.blogPostId,
15
28
  });
16
- return (React.createElement(LikesContext.Provider, { value: {
17
- toggleLike: likes === null || likes === void 0 ? void 0 : likes.toggleLike,
18
- hasLikes: Boolean(likes),
19
- } },
29
+ const _a = usePromptSignInProps(onClickSignIn), { requireSignIn } = _a, promptSignInProps = __rest(_a, ["requireSignIn"]);
30
+ const likesContextData = useMemo(() => ({
31
+ toggleLike: likes === null || likes === void 0 ? void 0 : likes.toggleLike,
32
+ hasLikes: Boolean(likes),
33
+ isSignedInUser,
34
+ requireSignIn,
35
+ }), [likes, isSignedInUser, requireSignIn]);
36
+ return (React.createElement(LikesContext.Provider, { value: likesContextData },
20
37
  React.createElement(PostPageContext.Provider, { value: {
21
38
  post,
22
39
  suggestedPosts,
@@ -31,5 +48,6 @@ export const BlogPostPage = ({ metaData, suggestedPosts, likes, content, post, s
31
48
  } },
32
49
  React.createElement(PageConstructorProvider, Object.assign({}, settings),
33
50
  metaData ? React.createElement(MetaWrapper, Object.assign({}, metaData)) : null,
34
- React.createElement(PageConstructor, { content: content, custom: componentMap, navigation: navigation })))));
51
+ React.createElement(PageConstructor, { content: content, custom: componentMap, navigation: navigation }))),
52
+ React.createElement(PromptSignIn, Object.assign({}, promptSignInProps))));
35
53
  };
@@ -482,7 +482,9 @@ export declare const schemasForCustom: {
482
482
  type: string;
483
483
  };
484
484
  type: {};
485
- when: {};
485
+ when: {
486
+ type: string;
487
+ };
486
488
  };
487
489
  };
488
490
  };
@@ -537,7 +539,9 @@ export declare const schemasForCustom: {
537
539
  type: string;
538
540
  };
539
541
  type: {};
540
- when: {};
542
+ when: {
543
+ type: string;
544
+ };
541
545
  };
542
546
  };
543
547
  };
@@ -665,7 +669,9 @@ export declare const schemasForCustom: {
665
669
  type: string;
666
670
  };
667
671
  type: {};
668
- when: {};
672
+ when: {
673
+ type: string;
674
+ };
669
675
  };
670
676
  };
671
677
  };
@@ -810,7 +816,9 @@ export declare const schemasForCustom: {
810
816
  type: string;
811
817
  };
812
818
  type: {};
813
- when: {};
819
+ when: {
820
+ type: string;
821
+ };
814
822
  };
815
823
  };
816
824
  };
@@ -938,7 +946,9 @@ export declare const schemasForCustom: {
938
946
  type: string;
939
947
  };
940
948
  type: {};
941
- when: {};
949
+ when: {
950
+ type: string;
951
+ };
942
952
  };
943
953
  };
944
954
  };
@@ -1004,7 +1014,9 @@ export declare const schemasForCustom: {
1004
1014
  type: string;
1005
1015
  };
1006
1016
  type: {};
1007
- when: {};
1017
+ when: {
1018
+ type: string;
1019
+ };
1008
1020
  };
1009
1021
  };
1010
1022
  };
@@ -1064,7 +1076,9 @@ export declare const schemasForCustom: {
1064
1076
  type: string;
1065
1077
  };
1066
1078
  type: {};
1067
- when: {};
1079
+ when: {
1080
+ type: string;
1081
+ };
1068
1082
  };
1069
1083
  };
1070
1084
  };
@@ -1336,7 +1350,9 @@ export declare const schemasForCustom: {
1336
1350
  type: string;
1337
1351
  };
1338
1352
  type: {};
1339
- when: {};
1353
+ when: {
1354
+ type: string;
1355
+ };
1340
1356
  };
1341
1357
  };
1342
1358
  };
@@ -1385,7 +1401,9 @@ export declare const schemasForCustom: {
1385
1401
  type: string;
1386
1402
  };
1387
1403
  type: {};
1388
- when: {};
1404
+ when: {
1405
+ type: string;
1406
+ };
1389
1407
  };
1390
1408
  };
1391
1409
  };
@@ -1434,7 +1452,9 @@ export declare const schemasForCustom: {
1434
1452
  type: string;
1435
1453
  };
1436
1454
  type: {};
1437
- when: {};
1455
+ when: {
1456
+ type: string;
1457
+ };
1438
1458
  };
1439
1459
  };
1440
1460
  };
@@ -1488,7 +1508,9 @@ export declare const schemasForCustom: {
1488
1508
  type: string;
1489
1509
  };
1490
1510
  type: {};
1491
- when: {};
1511
+ when: {
1512
+ type: string;
1513
+ };
1492
1514
  };
1493
1515
  };
1494
1516
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/blog-constructor",
3
- "version": "4.1.2",
3
+ "version": "4.2.1",
4
4
  "description": "Gravity UI Blog Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -73,7 +73,7 @@
73
73
  "@commitlint/config-conventional": "^17.4.3",
74
74
  "@doc-tools/transform": "^2.9.0",
75
75
  "@gravity-ui/eslint-config": "^2.0.0",
76
- "@gravity-ui/page-constructor": "^3.8.1",
76
+ "@gravity-ui/page-constructor": "^3.9.2",
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",