@blocklet/discuss-kit 1.0.11 → 1.0.13
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.
- package/README.md +2 -2
- package/lib/cjs/{did-comment-with-session.js → comments-with-session.js} +5 -5
- package/lib/cjs/{did-comment.js → comments.js} +7 -14
- package/lib/cjs/components/error-fallback.js +1 -1
- package/lib/cjs/components/upload-provider.js +17 -0
- package/lib/cjs/index.js +16 -10
- package/lib/cjs/locales/en.js +1 -1
- package/lib/cjs/locales/zh.js +1 -1
- package/lib/es/{did-comment-with-session.js → comments-with-session.js} +4 -4
- package/lib/es/{did-comment.js → comments.js} +6 -14
- package/lib/es/components/error-fallback.js +1 -1
- package/lib/es/components/upload-provider.js +18 -0
- package/lib/es/index.js +8 -6
- package/lib/es/locales/en.js +1 -1
- package/lib/es/locales/zh.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const utils = require("@arcblock/did-connect/lib/utils");
|
|
3
|
-
const
|
|
3
|
+
const Comments = require("./comments");
|
|
4
4
|
const session = require("./session");
|
|
5
5
|
const jsxRuntime = require("react/jsx-runtime");
|
|
6
6
|
const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const Comments__default = /* @__PURE__ */ _interopDefaultLegacy(Comments);
|
|
8
|
+
const CommentsHOC = (WrappedComponent) => {
|
|
9
9
|
const webWalletUrl = utils.getWebWalletUrl();
|
|
10
10
|
return function(props) {
|
|
11
11
|
return /* @__PURE__ */ jsxRuntime.jsx(session.SessionProvider, {
|
|
@@ -21,5 +21,5 @@ const DIDCommentHOC = (WrappedComponent) => {
|
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
const
|
|
25
|
-
module.exports =
|
|
24
|
+
const commentsWithSession = CommentsHOC(Comments__default.default);
|
|
25
|
+
module.exports = commentsWithSession;
|
|
@@ -10,14 +10,13 @@ const Button = require("@arcblock/ux/lib/Button");
|
|
|
10
10
|
const Box = require("@mui/material/Box");
|
|
11
11
|
const CircularProgress = require("@mui/material/CircularProgress");
|
|
12
12
|
const ButtonGroup = require("@mui/material/ButtonGroup");
|
|
13
|
-
const editor = require("@blocklet/editor");
|
|
14
13
|
const context = require("@arcblock/ux/lib/Locale/context");
|
|
15
14
|
const reactErrorBoundary = require("react-error-boundary");
|
|
16
15
|
const discussKitUx = require("@blocklet/discuss-kit-ux");
|
|
17
16
|
const ErrorFallback = require("./components/error-fallback");
|
|
18
17
|
const locales = require("./locales");
|
|
19
18
|
const getWsClient = require("./ws");
|
|
20
|
-
const
|
|
19
|
+
const UploadProvider = require("./components/upload-provider");
|
|
21
20
|
const api = require("./api");
|
|
22
21
|
const jsxRuntime = require("react/jsx-runtime");
|
|
23
22
|
const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
|
|
@@ -31,6 +30,7 @@ const CircularProgress__default = /* @__PURE__ */ _interopDefaultLegacy(Circular
|
|
|
31
30
|
const ButtonGroup__default = /* @__PURE__ */ _interopDefaultLegacy(ButtonGroup);
|
|
32
31
|
const ErrorFallback__default = /* @__PURE__ */ _interopDefaultLegacy(ErrorFallback);
|
|
33
32
|
const getWsClient__default = /* @__PURE__ */ _interopDefaultLegacy(getWsClient);
|
|
33
|
+
const UploadProvider__default = /* @__PURE__ */ _interopDefaultLegacy(UploadProvider);
|
|
34
34
|
const api__default = /* @__PURE__ */ _interopDefaultLegacy(api);
|
|
35
35
|
const getPrefix = () => {
|
|
36
36
|
var _a, _b;
|
|
@@ -125,7 +125,7 @@ const commentAPI = {
|
|
|
125
125
|
return data;
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
|
-
function
|
|
128
|
+
function DiscussKitComments({
|
|
129
129
|
showConnectBtn,
|
|
130
130
|
object,
|
|
131
131
|
onChange
|
|
@@ -280,12 +280,12 @@ function DIDComment({
|
|
|
280
280
|
}), /* @__PURE__ */ jsxRuntime.jsx(discussKitUx.CommentList, {})]
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
|
-
|
|
283
|
+
DiscussKitComments.propTypes = {
|
|
284
284
|
showConnectBtn: PropTypes__default.default.bool,
|
|
285
285
|
object: PropTypes__default.default.object.isRequired,
|
|
286
286
|
onChange: PropTypes__default.default.func
|
|
287
287
|
};
|
|
288
|
-
|
|
288
|
+
DiscussKitComments.defaultProps = {
|
|
289
289
|
showConnectBtn: false,
|
|
290
290
|
onChange: () => {
|
|
291
291
|
}
|
|
@@ -337,19 +337,12 @@ function Wrapper({
|
|
|
337
337
|
translations: locales.translations,
|
|
338
338
|
locale,
|
|
339
339
|
children: /* @__PURE__ */ jsxRuntime.jsx(discussKitUx.InternalThemeProvider, {
|
|
340
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
341
|
-
value: {
|
|
342
|
-
uploader: {
|
|
343
|
-
upload: (file) => uploader.upload(file).then((url) => ({
|
|
344
|
-
url
|
|
345
|
-
}))
|
|
346
|
-
}
|
|
347
|
-
},
|
|
340
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(UploadProvider__default.default, {
|
|
348
341
|
children: /* @__PURE__ */ jsxRuntime.jsx(discussKitUx.CommentsProvider, {
|
|
349
342
|
target: object,
|
|
350
343
|
api: commentAPI,
|
|
351
344
|
flatView,
|
|
352
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
345
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DiscussKitComments, {
|
|
353
346
|
...rest,
|
|
354
347
|
object
|
|
355
348
|
})
|
|
@@ -17,7 +17,7 @@ function ErrorFallback({
|
|
|
17
17
|
severity: "warning",
|
|
18
18
|
children: [/* @__PURE__ */ jsxRuntime.jsx(AlertTitle__default.default, {
|
|
19
19
|
children: "Oops!"
|
|
20
|
-
}), "
|
|
20
|
+
}), "Discuss Kit is not working properly.", errorMessageElement]
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
ErrorFallback.propTypes = {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const editor = require("@blocklet/editor");
|
|
3
|
+
const uploader = require("./uploader");
|
|
4
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
+
function UploadProvider(props) {
|
|
6
|
+
return /* @__PURE__ */ jsxRuntime.jsx(editor.EditorConfigProvider, {
|
|
7
|
+
value: {
|
|
8
|
+
uploader: {
|
|
9
|
+
upload: (file) => uploader.upload(file).then((url) => ({
|
|
10
|
+
url
|
|
11
|
+
}))
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
module.exports = UploadProvider;
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const didComment = require("./did-comment");
|
|
4
|
-
const didCommentWithSession = require("./did-comment-with-session");
|
|
5
3
|
const themeProvider = require("./theme-provider");
|
|
4
|
+
const comments = require("./comments");
|
|
5
|
+
const commentsWithSession = require("./comments-with-session");
|
|
6
|
+
const uploadProvider = require("./components/upload-provider");
|
|
6
7
|
const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
|
|
7
|
-
const didComment__default = /* @__PURE__ */ _interopDefaultLegacy(didComment);
|
|
8
|
-
const didCommentWithSession__default = /* @__PURE__ */ _interopDefaultLegacy(didCommentWithSession);
|
|
9
8
|
const themeProvider__default = /* @__PURE__ */ _interopDefaultLegacy(themeProvider);
|
|
10
|
-
|
|
9
|
+
const comments__default = /* @__PURE__ */ _interopDefaultLegacy(comments);
|
|
10
|
+
const commentsWithSession__default = /* @__PURE__ */ _interopDefaultLegacy(commentsWithSession);
|
|
11
|
+
const uploadProvider__default = /* @__PURE__ */ _interopDefaultLegacy(uploadProvider);
|
|
12
|
+
Object.defineProperty(exports, "ThemeProvider", {
|
|
11
13
|
enumerable: true,
|
|
12
|
-
get: () =>
|
|
14
|
+
get: () => themeProvider__default.default
|
|
13
15
|
});
|
|
14
|
-
Object.defineProperty(exports, "
|
|
16
|
+
Object.defineProperty(exports, "Comments", {
|
|
15
17
|
enumerable: true,
|
|
16
|
-
get: () =>
|
|
18
|
+
get: () => comments__default.default
|
|
17
19
|
});
|
|
18
|
-
Object.defineProperty(exports, "
|
|
20
|
+
Object.defineProperty(exports, "CommentsWithSession", {
|
|
19
21
|
enumerable: true,
|
|
20
|
-
get: () =>
|
|
22
|
+
get: () => commentsWithSession__default.default
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "UploadProvider", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: () => uploadProvider__default.default
|
|
21
27
|
});
|
package/lib/cjs/locales/en.js
CHANGED
|
@@ -5,7 +5,7 @@ const flat__default = /* @__PURE__ */ _interopDefaultLegacy(flat);
|
|
|
5
5
|
const en = flat__default.default({
|
|
6
6
|
comments: "Comments",
|
|
7
7
|
comment: "Comment",
|
|
8
|
-
poweredBy: "- powered by
|
|
8
|
+
poweredBy: "- powered by Discuss Kit",
|
|
9
9
|
connect: "Connect",
|
|
10
10
|
inputPlaceHolder: "Write a comment",
|
|
11
11
|
oldest: "Oldest",
|
package/lib/cjs/locales/zh.js
CHANGED
|
@@ -5,7 +5,7 @@ const flat__default = /* @__PURE__ */ _interopDefaultLegacy(flat);
|
|
|
5
5
|
const zh = flat__default.default({
|
|
6
6
|
comments: "\u6761\u8BC4\u8BBA",
|
|
7
7
|
comment: "\u8BC4\u8BBA",
|
|
8
|
-
poweredBy: "- \u7531
|
|
8
|
+
poweredBy: "- \u7531 Discuss Kit \u63D0\u4F9B\u652F\u6301",
|
|
9
9
|
connect: "\u8FDE\u63A5",
|
|
10
10
|
inputPlaceHolder: "\u5199\u8BC4\u8BBA",
|
|
11
11
|
oldest: "\u6700\u65E7",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getWebWalletUrl } from "@arcblock/did-connect/lib/utils";
|
|
2
|
-
import
|
|
2
|
+
import Comments from "./comments";
|
|
3
3
|
import { SessionProvider } from "./session";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
const
|
|
5
|
+
const CommentsHOC = (WrappedComponent) => {
|
|
6
6
|
const webWalletUrl = getWebWalletUrl();
|
|
7
7
|
return function(props) {
|
|
8
8
|
return /* @__PURE__ */ jsx(SessionProvider, {
|
|
@@ -18,7 +18,7 @@ const DIDCommentHOC = (WrappedComponent) => {
|
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
const
|
|
21
|
+
const commentsWithSession = CommentsHOC(Comments);
|
|
22
22
|
export {
|
|
23
|
-
|
|
23
|
+
commentsWithSession as default
|
|
24
24
|
};
|
|
@@ -9,14 +9,13 @@ import Button from "@arcblock/ux/lib/Button";
|
|
|
9
9
|
import Box from "@mui/material/Box";
|
|
10
10
|
import CircularProgress from "@mui/material/CircularProgress";
|
|
11
11
|
import ButtonGroup from "@mui/material/ButtonGroup";
|
|
12
|
-
import { EditorConfigProvider } from "@blocklet/editor";
|
|
13
12
|
import { useLocaleContext, LocaleProvider } from "@arcblock/ux/lib/Locale/context";
|
|
14
13
|
import { ErrorBoundary } from "react-error-boundary";
|
|
15
14
|
import { useCommentSettings, InternalThemeProvider, CommentsProvider, useCommentsContext, BinaryThumb, CommentInput, CommentList } from "@blocklet/discuss-kit-ux";
|
|
16
15
|
import ErrorFallback from "./components/error-fallback";
|
|
17
16
|
import { translations } from "./locales";
|
|
18
17
|
import getWsClient, { useSubscription } from "./ws";
|
|
19
|
-
import
|
|
18
|
+
import UploadProvider from "./components/upload-provider";
|
|
20
19
|
import api, { fetchRatingStats } from "./api";
|
|
21
20
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
22
21
|
const getPrefix = () => {
|
|
@@ -112,7 +111,7 @@ const commentAPI = {
|
|
|
112
111
|
return data;
|
|
113
112
|
}
|
|
114
113
|
};
|
|
115
|
-
function
|
|
114
|
+
function DiscussKitComments({
|
|
116
115
|
showConnectBtn,
|
|
117
116
|
object,
|
|
118
117
|
onChange
|
|
@@ -267,12 +266,12 @@ function DIDComment({
|
|
|
267
266
|
}), /* @__PURE__ */ jsx(CommentList, {})]
|
|
268
267
|
});
|
|
269
268
|
}
|
|
270
|
-
|
|
269
|
+
DiscussKitComments.propTypes = {
|
|
271
270
|
showConnectBtn: PropTypes.bool,
|
|
272
271
|
object: PropTypes.object.isRequired,
|
|
273
272
|
onChange: PropTypes.func
|
|
274
273
|
};
|
|
275
|
-
|
|
274
|
+
DiscussKitComments.defaultProps = {
|
|
276
275
|
showConnectBtn: false,
|
|
277
276
|
onChange: () => {
|
|
278
277
|
}
|
|
@@ -324,19 +323,12 @@ function Wrapper({
|
|
|
324
323
|
translations,
|
|
325
324
|
locale,
|
|
326
325
|
children: /* @__PURE__ */ jsx(InternalThemeProvider, {
|
|
327
|
-
children: /* @__PURE__ */ jsx(
|
|
328
|
-
value: {
|
|
329
|
-
uploader: {
|
|
330
|
-
upload: (file) => upload(file).then((url) => ({
|
|
331
|
-
url
|
|
332
|
-
}))
|
|
333
|
-
}
|
|
334
|
-
},
|
|
326
|
+
children: /* @__PURE__ */ jsx(UploadProvider, {
|
|
335
327
|
children: /* @__PURE__ */ jsx(CommentsProvider, {
|
|
336
328
|
target: object,
|
|
337
329
|
api: commentAPI,
|
|
338
330
|
flatView,
|
|
339
|
-
children: /* @__PURE__ */ jsx(
|
|
331
|
+
children: /* @__PURE__ */ jsx(DiscussKitComments, {
|
|
340
332
|
...rest,
|
|
341
333
|
object
|
|
342
334
|
})
|
|
@@ -12,7 +12,7 @@ function ErrorFallback({
|
|
|
12
12
|
severity: "warning",
|
|
13
13
|
children: [/* @__PURE__ */ jsx(AlertTitle, {
|
|
14
14
|
children: "Oops!"
|
|
15
|
-
}), "
|
|
15
|
+
}), "Discuss Kit is not working properly.", errorMessageElement]
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
ErrorFallback.propTypes = {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EditorConfigProvider } from "@blocklet/editor";
|
|
2
|
+
import { upload } from "./uploader";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
function UploadProvider(props) {
|
|
5
|
+
return /* @__PURE__ */ jsx(EditorConfigProvider, {
|
|
6
|
+
value: {
|
|
7
|
+
uploader: {
|
|
8
|
+
upload: (file) => upload(file).then((url) => ({
|
|
9
|
+
url
|
|
10
|
+
}))
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
UploadProvider as default
|
|
18
|
+
};
|
package/lib/es/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { default as default2 } from "./
|
|
2
|
-
import { default as default3 } from "./
|
|
3
|
-
import { default as default4 } from "./
|
|
1
|
+
import { default as default2 } from "./theme-provider";
|
|
2
|
+
import { default as default3 } from "./comments";
|
|
3
|
+
import { default as default4 } from "./comments-with-session";
|
|
4
|
+
import { default as default5 } from "./components/upload-provider";
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
default3 as Comments,
|
|
7
|
+
default4 as CommentsWithSession,
|
|
8
|
+
default2 as ThemeProvider,
|
|
9
|
+
default5 as UploadProvider
|
|
8
10
|
};
|
package/lib/es/locales/en.js
CHANGED
package/lib/es/locales/zh.js
CHANGED
|
@@ -2,7 +2,7 @@ import flat from "flat";
|
|
|
2
2
|
const zh = flat({
|
|
3
3
|
comments: "\u6761\u8BC4\u8BBA",
|
|
4
4
|
comment: "\u8BC4\u8BBA",
|
|
5
|
-
poweredBy: "- \u7531
|
|
5
|
+
poweredBy: "- \u7531 Discuss Kit \u63D0\u4F9B\u652F\u6301",
|
|
6
6
|
connect: "\u8FDE\u63A5",
|
|
7
7
|
inputPlaceHolder: "\u5199\u8BC4\u8BBA",
|
|
8
8
|
oldest: "\u6700\u65E7",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "A react component for
|
|
3
|
+
"version": "1.0.13",
|
|
4
|
+
"description": "A react component for Discuss Kit blocklet.",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/es/index.js",
|
|
7
7
|
"typings": "./lib/index.d.ts",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@arcblock/did-connect": "^2.4.57",
|
|
38
38
|
"@arcblock/ux": "^2.4.57",
|
|
39
39
|
"@arcblock/ws": "^1.18.30",
|
|
40
|
-
"@blocklet/discuss-kit-ux": "1.0.
|
|
40
|
+
"@blocklet/discuss-kit-ux": "1.0.13",
|
|
41
41
|
"@blocklet/editor": "^0.0.10",
|
|
42
42
|
"@emotion/react": "^11.10.5",
|
|
43
43
|
"@emotion/styled": "^11.10.5",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"vite-plugin-build": "^0.6.0",
|
|
78
78
|
"vite-plugin-svgr": "^2.2.2"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "c197cdf796a17b66fd6c031ca86d39c6efe7c710"
|
|
81
81
|
}
|