@blocklet/discuss-kit 1.0.12 → 1.0.14
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} +4 -4
- package/lib/cjs/components/error-fallback.js +1 -1
- package/lib/cjs/components/upload-provider.js +9 -7
- package/lib/cjs/index.js +10 -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} +4 -4
- package/lib/es/components/error-fallback.js +1 -1
- package/lib/es/components/upload-provider.js +9 -7
- package/lib/es/index.js +6 -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;
|
|
@@ -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
|
}
|
|
@@ -342,7 +342,7 @@ function Wrapper({
|
|
|
342
342
|
target: object,
|
|
343
343
|
api: commentAPI,
|
|
344
344
|
flatView,
|
|
345
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
345
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DiscussKitComments, {
|
|
346
346
|
...rest,
|
|
347
347
|
object
|
|
348
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 = {
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
const react = require("react");
|
|
2
3
|
const editor = require("@blocklet/editor");
|
|
3
4
|
const uploader = require("./uploader");
|
|
4
5
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
6
|
function UploadProvider(props) {
|
|
7
|
+
const config = react.useMemo(() => ({
|
|
8
|
+
uploader: {
|
|
9
|
+
upload: (file) => uploader.upload(file).then((url) => ({
|
|
10
|
+
url
|
|
11
|
+
}))
|
|
12
|
+
}
|
|
13
|
+
}), []);
|
|
6
14
|
return /* @__PURE__ */ jsxRuntime.jsx(editor.EditorConfigProvider, {
|
|
7
|
-
value:
|
|
8
|
-
uploader: {
|
|
9
|
-
upload: (file) => uploader.upload(file).then((url) => ({
|
|
10
|
-
url
|
|
11
|
-
}))
|
|
12
|
-
}
|
|
13
|
-
},
|
|
15
|
+
value: config,
|
|
14
16
|
...props
|
|
15
17
|
});
|
|
16
18
|
}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
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
6
|
const uploadProvider = require("./components/upload-provider");
|
|
7
7
|
const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
|
|
8
|
-
const didComment__default = /* @__PURE__ */ _interopDefaultLegacy(didComment);
|
|
9
|
-
const didCommentWithSession__default = /* @__PURE__ */ _interopDefaultLegacy(didCommentWithSession);
|
|
10
8
|
const themeProvider__default = /* @__PURE__ */ _interopDefaultLegacy(themeProvider);
|
|
9
|
+
const comments__default = /* @__PURE__ */ _interopDefaultLegacy(comments);
|
|
10
|
+
const commentsWithSession__default = /* @__PURE__ */ _interopDefaultLegacy(commentsWithSession);
|
|
11
11
|
const uploadProvider__default = /* @__PURE__ */ _interopDefaultLegacy(uploadProvider);
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "ThemeProvider", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: () =>
|
|
14
|
+
get: () => themeProvider__default.default
|
|
15
15
|
});
|
|
16
|
-
Object.defineProperty(exports, "
|
|
16
|
+
Object.defineProperty(exports, "Comments", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: () =>
|
|
18
|
+
get: () => comments__default.default
|
|
19
19
|
});
|
|
20
|
-
Object.defineProperty(exports, "
|
|
20
|
+
Object.defineProperty(exports, "CommentsWithSession", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: () =>
|
|
22
|
+
get: () => commentsWithSession__default.default
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "UploadProvider", {
|
|
25
25
|
enumerable: true,
|
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
|
};
|
|
@@ -111,7 +111,7 @@ const commentAPI = {
|
|
|
111
111
|
return data;
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
function
|
|
114
|
+
function DiscussKitComments({
|
|
115
115
|
showConnectBtn,
|
|
116
116
|
object,
|
|
117
117
|
onChange
|
|
@@ -266,12 +266,12 @@ function DIDComment({
|
|
|
266
266
|
}), /* @__PURE__ */ jsx(CommentList, {})]
|
|
267
267
|
});
|
|
268
268
|
}
|
|
269
|
-
|
|
269
|
+
DiscussKitComments.propTypes = {
|
|
270
270
|
showConnectBtn: PropTypes.bool,
|
|
271
271
|
object: PropTypes.object.isRequired,
|
|
272
272
|
onChange: PropTypes.func
|
|
273
273
|
};
|
|
274
|
-
|
|
274
|
+
DiscussKitComments.defaultProps = {
|
|
275
275
|
showConnectBtn: false,
|
|
276
276
|
onChange: () => {
|
|
277
277
|
}
|
|
@@ -328,7 +328,7 @@ function Wrapper({
|
|
|
328
328
|
target: object,
|
|
329
329
|
api: commentAPI,
|
|
330
330
|
flatView,
|
|
331
|
-
children: /* @__PURE__ */ jsx(
|
|
331
|
+
children: /* @__PURE__ */ jsx(DiscussKitComments, {
|
|
332
332
|
...rest,
|
|
333
333
|
object
|
|
334
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 = {
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
1
2
|
import { EditorConfigProvider } from "@blocklet/editor";
|
|
2
3
|
import { upload } from "./uploader";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
function UploadProvider(props) {
|
|
6
|
+
const config = useMemo(() => ({
|
|
7
|
+
uploader: {
|
|
8
|
+
upload: (file) => upload(file).then((url) => ({
|
|
9
|
+
url
|
|
10
|
+
}))
|
|
11
|
+
}
|
|
12
|
+
}), []);
|
|
5
13
|
return /* @__PURE__ */ jsx(EditorConfigProvider, {
|
|
6
|
-
value:
|
|
7
|
-
uploader: {
|
|
8
|
-
upload: (file) => upload(file).then((url) => ({
|
|
9
|
-
url
|
|
10
|
-
}))
|
|
11
|
-
}
|
|
12
|
-
},
|
|
14
|
+
value: config,
|
|
13
15
|
...props
|
|
14
16
|
});
|
|
15
17
|
}
|
package/lib/es/index.js
CHANGED
|
@@ -1,10 +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
4
|
import { default as default5 } from "./components/upload-provider";
|
|
5
5
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
default3 as Comments,
|
|
7
|
+
default4 as CommentsWithSession,
|
|
8
|
+
default2 as ThemeProvider,
|
|
9
9
|
default5 as UploadProvider
|
|
10
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.14",
|
|
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.14",
|
|
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": "2e344280e1268a0b26500ff576cb6916447a0699"
|
|
81
81
|
}
|