@blocklet/discuss-kit 2.3.106 → 2.4.0

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.
@@ -1,392 +1,359 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { forwardRef, useContext, useRef, useMemo, useEffect, useState } from "react";
3
- import { styled } from "@arcblock/ux/lib/Theme";
4
- import PropTypes from "prop-types";
5
- import { SessionContext } from "@arcblock/did-connect/lib/Session";
6
- import { Alert, AlertTitle, Box, CircularProgress } from "@mui/material";
7
- import { useLocaleContext, LocaleProvider } from "@arcblock/ux/lib/Locale/context";
8
- import { ErrorBoundary } from "react-error-boundary";
9
- import { useDefaultApiErrorHandler, useCommentsContext, useSubscription, IconButtonGroup, GithubReactionContainer, SegmentedControl, CommentList, getWsClient, UploaderProvider, InternalThemeProvider, ConfirmProvider, DefaultEditorConfigProvider, CommentsProvider, CommentInput } from "@blocklet/discuss-kit-ux";
10
- import { useRequest } from "ahooks";
11
- import ErrorFallback from "./components/error-fallback";
12
- import { translations } from "./locales";
13
- import { discussKitPrefix } from "./lib/utils";
14
- import api, { fetchRatings } from "./api";
15
- import { useTopicInfoSync } from "./hooks/topic-info-sync";
16
- const getCurrentBlockletComponentName = () => {
17
- var _a, _b;
18
- const ensureTrailingSlash = (str) => str.endsWith("/") ? str : `${str}/`;
19
- const matched = (_b = (_a = window.blocklet) == null ? void 0 : _a.componentMountPoints) == null ? void 0 : _b.find(
20
- (x) => {
21
- var _a2;
22
- return ensureTrailingSlash(x.mountPoint) === ensureTrailingSlash((_a2 = window.blocklet) == null ? void 0 : _a2.prefix);
23
- }
24
- );
25
- return matched == null ? void 0 : matched.title;
26
- };
27
- const formatComment = (comment) => {
28
- var _a;
29
- return {
30
- ...comment,
31
- rootId: comment.rootCommentId,
32
- createdAt: comment.createdAt ? new Date(comment.createdAt) : null,
33
- updatedAt: comment.updatedAt ? new Date(comment.updatedAt) : null,
34
- deletedAt: comment.deletedAt ? new Date(comment.deletedAt) : null,
35
- pinnedAt: comment.pinnedAt ? new Date(comment.pinnedAt) : null,
36
- replies: (_a = comment.replies) == null ? void 0 : _a.map(formatComment)
37
- };
38
- };
39
- const commentAPI = {
40
- fetchComments: async (params) => {
41
- const copy = {
42
- ...params,
43
- embed: params.rootId ? "rating" : "replies,rating",
44
- size: params.limit
45
- };
46
- const {
47
- data: { data, nextCursor, total }
48
- } = await api.get("/comments", { params: copy });
49
- return { data: data == null ? void 0 : data.map(formatComment), nextCursor, total };
1
+ import { jsx as r, jsxs as m, Fragment as V } from "react/jsx-runtime";
2
+ import { useRef as J, useMemo as Q, useEffect as X, useContext as Y, useState as Z } from "react";
3
+ import { styled as ee } from "@arcblock/ux/lib/Theme";
4
+ import t from "prop-types";
5
+ import { SessionContext as te } from "@arcblock/did-connect/lib/Session";
6
+ import { Alert as ne, AlertTitle as oe, Box as p, CircularProgress as re } from "@mui/material";
7
+ import { useLocaleContext as F, LocaleProvider as ie } from "@arcblock/ux/lib/Locale/context";
8
+ import { ErrorBoundary as se } from "react-error-boundary";
9
+ import { getWsClient as ae, UploaderProvider as le, InternalThemeProvider as de, ConfirmProvider as ce, DefaultEditorConfigProvider as ue, CommentsProvider as me, useDefaultApiErrorHandler as pe, useCommentsContext as fe, useSubscription as Ce, IconButtonGroup as he, GithubReactionContainer as be, SegmentedControl as ge, CommentList as ye, CommentInput as we } from "@blocklet/discuss-kit-ux";
10
+ import { useRequest as xe } from "ahooks";
11
+ import Ae from "./components/error-fallback.js";
12
+ import { translations as ve } from "./locales/index.js";
13
+ import { discussKitPrefix as Ie } from "./lib/utils.js";
14
+ import s, { fetchRatings as Pe } from "./api.js";
15
+ import { useTopicInfoSync as Te } from "./hooks/topic-info-sync.js";
16
+ const $e = () => {
17
+ const e = (o) => o.endsWith("/") ? o : `${o}/`;
18
+ return window.blocklet?.componentMountPoints?.find(
19
+ (o) => e(o.mountPoint) === e(window.blocklet?.prefix)
20
+ )?.title;
21
+ }, d = (e) => ({
22
+ ...e,
23
+ rootId: e.rootCommentId,
24
+ createdAt: e.createdAt ? new Date(e.createdAt) : null,
25
+ updatedAt: e.updatedAt ? new Date(e.updatedAt) : null,
26
+ deletedAt: e.deletedAt ? new Date(e.deletedAt) : null,
27
+ pinnedAt: e.pinnedAt ? new Date(e.pinnedAt) : null,
28
+ replies: e.replies?.map(d)
29
+ }), Se = {
30
+ fetchComments: async (e) => {
31
+ const n = {
32
+ ...e,
33
+ embed: e.rootId ? "rating" : "replies,rating",
34
+ size: e.limit
35
+ }, {
36
+ data: { data: o, nextCursor: l, total: f }
37
+ } = await s.get("/comments", { params: n });
38
+ return { data: o?.map(d), nextCursor: l, total: f };
50
39
  },
51
- fetchPinnedComments: async (objectId) => {
52
- const { data } = await api.get("/comments/pinned", { params: { objectId } });
53
- return ((data == null ? void 0 : data.data) || []).map(formatComment);
40
+ fetchPinnedComments: async (e) => {
41
+ const { data: n } = await s.get("/comments/pinned", { params: { objectId: e } });
42
+ return (n?.data || []).map(d);
54
43
  },
55
- fetchCommentPosition: async ({ id, ...params }) => {
56
- const { data } = await api.get(`/comments/${id}/position`, { params });
57
- return data;
44
+ fetchCommentPosition: async ({ id: e, ...n }) => {
45
+ const { data: o } = await s.get(`/comments/${e}/position`, { params: n });
46
+ return o;
58
47
  },
59
- deleteComment: async ({ id }) => {
60
- const { data } = await api.delete(`/comments/${id}`);
61
- return data;
48
+ deleteComment: async ({ id: e }) => {
49
+ const { data: n } = await s.delete(`/comments/${e}`);
50
+ return n;
62
51
  },
63
- updateComment: async ({ id, updatedAt }, content) => {
64
- const { data } = await api.put(`/comments/${id}`, { content, updatedAt });
65
- return formatComment(data);
52
+ updateComment: async ({ id: e, updatedAt: n }, o) => {
53
+ const { data: l } = await s.put(`/comments/${e}`, { content: o, updatedAt: n });
54
+ return d(l);
66
55
  },
67
- reply: async ({ id }, content) => {
68
- const { data } = await api.post("/comments/replies", {
69
- content,
70
- parentId: id,
56
+ reply: async ({ id: e }, n) => {
57
+ const { data: o } = await s.post("/comments/replies", {
58
+ content: n,
59
+ parentId: e,
71
60
  link: window.location.href
72
61
  });
73
- return formatComment(data);
62
+ return d(o);
74
63
  },
75
- rate: async (comment, value, ratingType) => {
76
- await api.post(`/topics/${comment.topicId}/comments/${comment.id}/ratings`, { ratingType, value });
64
+ rate: async (e, n, o) => {
65
+ await s.post(`/topics/${e.topicId}/comments/${e.id}/ratings`, { ratingType: o, value: n });
77
66
  },
78
- unrate: async (comment) => {
79
- await api.delete(`/topics/${comment.topicId}/comments/${comment.id}/ratings`);
67
+ unrate: async (e) => {
68
+ await s.delete(`/topics/${e.topicId}/comments/${e.id}/ratings`);
80
69
  },
81
- fetchRatings: async (id) => {
82
- const { data } = await api.get(`/ratings/${id}`);
83
- return data;
70
+ fetchRatings: async (e) => {
71
+ const { data: n } = await s.get(`/ratings/${e}`);
72
+ return n;
84
73
  },
85
- togglePin: async ({ post, value }) => {
86
- if (value) {
87
- await api.put(`/posts/${post.id}/pinned`);
88
- } else {
89
- await api.delete(`/posts/${post.id}/pinned`);
90
- }
74
+ togglePin: async ({ post: e, value: n }) => {
75
+ n ? await s.put(`/posts/${e.id}/pinned`) : await s.delete(`/posts/${e.id}/pinned`);
91
76
  }
92
- };
93
- const useDiscussKitStatus = () => {
94
- const [available, setAvailable] = useState(true);
95
- useRequest(
96
- () => api.get("/status", { muteError: true }).then(() => setAvailable(true)).catch(() => setAvailable(false)),
77
+ }, Re = () => {
78
+ const [e, n] = Z(!0);
79
+ return xe(
80
+ () => s.get("/status", { muteError: !0 }).then(() => n(!0)).catch(() => n(!1)),
97
81
  { cacheKey: "discuss-kit-status", staleTime: -1 }
98
- );
99
- return { available };
82
+ ), { available: e };
100
83
  };
101
- const DiscussKitComments = forwardRef(
102
- ({
103
- displayReaction,
104
- object,
105
- onChange,
106
- onSendComment,
107
- commentInputPosition,
108
- autoFocus,
109
- disabledSend,
110
- initialContent,
111
- sendText,
112
- sendIcon,
113
- showTopbar,
114
- sendComment,
115
- reactionAppend,
116
- skeleton,
117
- placeholder,
118
- onInput,
119
- draftKey,
120
- inputSx,
121
- editorRef,
122
- disableCmdEnter
123
- }, ref) => {
124
- useDefaultApiErrorHandler({
125
- request: api
126
- });
127
- const { available } = useDiscussKitStatus();
128
- const { session } = useContext(SessionContext) || {};
129
- const { state, sort, add, updateCommentState, interactive, findById, renderInnerFooter } = useCommentsContext();
130
- const { total, order, initialized } = state;
131
- const { t } = useLocaleContext();
132
- useTopicInfoSync(object);
133
- const handlers = {
134
- ADD_COMMENT: (data) => {
135
- add(formatComment(data));
136
- onChange == null ? void 0 : onChange();
137
- },
138
- UPDATE_COMMENT: (data) => {
139
- const comment = findById(data.id);
140
- if (comment && comment.content !== data.content) {
141
- updateCommentState(data.id, (current) => {
142
- current.content = data.content;
143
- current.updatedAt = data.updatedAt;
144
- current.synced = Date.now();
145
- return current;
146
- });
147
- }
148
- },
149
- RATING_COMMENT: async ({ commentId }) => {
150
- const rating = await fetchRatings(commentId);
151
- updateCommentState(commentId, (current) => ({
152
- ...current,
153
- rating
154
- }));
84
+ function K({
85
+ ref: e = void 0,
86
+ displayReaction: n = !0,
87
+ object: o,
88
+ onChange: l = () => {
89
+ },
90
+ onSendComment: f = () => {
91
+ },
92
+ commentInputPosition: C = "top",
93
+ autoFocus: w = !1,
94
+ disabledSend: x = void 0,
95
+ initialContent: A = "",
96
+ sendText: v = "",
97
+ sendIcon: I = null,
98
+ showTopbar: P = !0,
99
+ sendComment: h = null,
100
+ reactionAppend: T = null,
101
+ skeleton: $ = null,
102
+ placeholder: S = "",
103
+ onInput: R = () => {
104
+ },
105
+ draftKey: b = "",
106
+ inputSx: g = {},
107
+ editorRef: y = null,
108
+ disableCmdEnter: O = !1
109
+ }) {
110
+ pe({
111
+ request: s
112
+ });
113
+ const { available: B } = Re(), { session: k } = Y(te) || {}, { state: q, sort: L, add: M, updateCommentState: N, interactive: D, findById: U, renderInnerFooter: W } = fe(), { total: E, order: z, initialized: G } = q, { t: c } = F();
114
+ Te(o);
115
+ const _ = {
116
+ ADD_COMMENT: (i) => {
117
+ M(d(i)), l?.();
118
+ },
119
+ UPDATE_COMMENT: (i) => {
120
+ const a = U(i.id);
121
+ a && a.content !== i.content && N(i.id, (u) => (u.content = i.content, u.updatedAt = i.updatedAt, u.synced = Date.now(), u));
122
+ },
123
+ RATING_COMMENT: async ({ commentId: i }) => {
124
+ const a = await Pe(i);
125
+ N(i, (u) => ({
126
+ ...u,
127
+ rating: a
128
+ }));
129
+ }
130
+ };
131
+ if (Ce(
132
+ o.id,
133
+ ({ event: i, data: a }) => {
134
+ _[i]?.(a);
135
+ },
136
+ [o.id, q]
137
+ ), !B)
138
+ return /* @__PURE__ */ m(ne, { severity: "info", children: [
139
+ /* @__PURE__ */ r(oe, { children: c("apiUnavailable.title") }),
140
+ c("apiUnavailable.desc")
141
+ ] });
142
+ if (!G)
143
+ return $ || /* @__PURE__ */ r(
144
+ p,
145
+ {
146
+ sx: {
147
+ width: "100%",
148
+ display: "flex",
149
+ justifyContent: "center"
150
+ },
151
+ children: /* @__PURE__ */ r(re, {})
155
152
  }
156
- };
157
- useSubscription(
158
- object.id,
159
- ({ event, data }) => {
160
- var _a;
161
- (_a = handlers[event]) == null ? void 0 : _a.call(handlers, data);
162
- },
163
- [object.id, state]
164
153
  );
165
- if (!available) {
166
- return /* @__PURE__ */ jsxs(Alert, { severity: "info", children: [
167
- /* @__PURE__ */ jsx(AlertTitle, { children: t("apiUnavailable.title") }),
168
- t("apiUnavailable.desc")
169
- ] });
170
- }
171
- if (!initialized) {
172
- return skeleton || /* @__PURE__ */ jsx(Box, { width: "100%", display: "flex", justifyContent: "center", children: /* @__PURE__ */ jsx(CircularProgress, {}) });
154
+ const H = async (i) => {
155
+ const { data: a } = await (h ? h({ content: i, object: o }) : s.post("/comments", { content: i, object: o }));
156
+ M(d(a)), f?.(a);
157
+ }, j = () => /* @__PURE__ */ r(
158
+ we,
159
+ {
160
+ editorRef: y,
161
+ placeholder: S,
162
+ send: H,
163
+ draftKey: b || `object-${o.id}`,
164
+ autoFocus: w,
165
+ disabledSend: x,
166
+ initialContent: A,
167
+ sendText: v,
168
+ sendIcon: I,
169
+ renderInnerFooter: W,
170
+ onChange: R,
171
+ disableCmdEnter: O
173
172
  }
174
- const handleSendComment = async (content) => {
175
- const { data } = await (sendComment ? sendComment({ content, object }) : api.post("/comments", { content, object }));
176
- add(formatComment(data));
177
- onSendComment == null ? void 0 : onSendComment(data);
178
- };
179
- const renderCommentInput = () => {
180
- return /* @__PURE__ */ jsx(
181
- CommentInput,
173
+ );
174
+ return /* @__PURE__ */ m(Ee, { ref: e, children: [
175
+ /* @__PURE__ */ m(V, { children: [
176
+ /* @__PURE__ */ r(
177
+ p,
182
178
  {
183
- editorRef,
184
- placeholder,
185
- send: handleSendComment,
186
- draftKey: draftKey || `object-${object.id}`,
187
- autoFocus,
188
- disabledSend,
189
- initialContent,
190
- sendText,
191
- sendIcon,
192
- renderInnerFooter,
193
- onChange: onInput,
194
- disableCmdEnter
179
+ sx: {
180
+ display: "flex",
181
+ justifyContent: "space-between",
182
+ alignItems: "end"
183
+ },
184
+ children: n && /* @__PURE__ */ m(he, { sx: { alignItems: "flex-end" }, children: [
185
+ /* @__PURE__ */ r(be, { id: o.id, request: s, interactive: D }),
186
+ T
187
+ ] })
195
188
  }
196
- );
197
- };
198
- return /* @__PURE__ */ jsxs(Container, { ref, children: [
199
- /* @__PURE__ */ jsxs(Fragment, { children: [
200
- /* @__PURE__ */ jsx(Box, { display: "flex", justifyContent: "space-between", alignItems: "end", children: displayReaction && /* @__PURE__ */ jsxs(IconButtonGroup, { sx: { alignItems: "flex-end" }, children: [
201
- /* @__PURE__ */ jsx(GithubReactionContainer, { id: object.id, request: api, interactive }),
202
- reactionAppend
203
- ] }) }),
204
- session.user && interactive && commentInputPosition === "top" && /* @__PURE__ */ jsx(Box, { mt: 2, className: "comment-editor", children: renderCommentInput() })
205
- ] }),
206
- !!total && showTopbar && /* @__PURE__ */ jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", mt: 3, children: [
207
- /* @__PURE__ */ jsxs(Box, { sx: { fontWeight: "medium" }, children: [
208
- total > 0 ? `${total} ${t("comments")}` : t("comment"),
209
- " "
210
- ] }),
211
- /* @__PURE__ */ jsx(
212
- SegmentedControl,
213
- {
214
- value: order,
215
- options: [
216
- { value: "desc", label: t("newest") },
217
- { value: "asc", label: t("oldest") }
218
- ],
219
- onChange: (value) => sort(value)
220
- }
221
- )
222
- ] }),
223
- /* @__PURE__ */ jsx(CommentList, { className: "comment-list" }),
224
- session.user && interactive && commentInputPosition === "bottom" && /* @__PURE__ */ jsx(Box, { sx: { mt: 6, ...inputSx }, children: renderCommentInput() })
225
- ] });
226
- }
227
- );
228
- DiscussKitComments.propTypes = {
229
- displayReaction: PropTypes.bool,
230
- object: PropTypes.object.isRequired,
231
- onChange: PropTypes.func,
232
- onSendComment: PropTypes.func,
233
- disabledSend: PropTypes.bool,
234
- autoFocus: PropTypes.bool,
235
- initialContent: PropTypes.string,
236
- sendText: PropTypes.string,
237
- sendIcon: PropTypes.node,
238
- commentInputPosition: PropTypes.oneOf(["top", "bottom"]),
239
- showTopbar: PropTypes.bool,
240
- sendComment: PropTypes.func,
241
- reactionAppend: PropTypes.any,
242
- skeleton: PropTypes.node,
243
- placeholder: PropTypes.string,
244
- onInput: PropTypes.func,
245
- draftKey: PropTypes.string,
246
- editorRef: PropTypes.object,
247
- inputSx: PropTypes.object,
248
- disableCmdEnter: PropTypes.bool
249
- };
250
- DiscussKitComments.defaultProps = {
251
- displayReaction: true,
252
- onChange: () => {
253
- },
254
- onSendComment: () => {
255
- },
256
- disabledSend: void 0,
257
- autoFocus: false,
258
- initialContent: "",
259
- sendText: "",
260
- sendIcon: null,
261
- commentInputPosition: "top",
262
- showTopbar: true,
263
- sendComment: null,
264
- reactionAppend: null,
265
- skeleton: null,
266
- placeholder: "",
267
- onInput: () => {
268
- },
269
- draftKey: "",
270
- editorRef: null,
271
- inputSx: {},
272
- disableCmdEnter: false
189
+ ),
190
+ k.user && D && C === "top" && /* @__PURE__ */ r(
191
+ p,
192
+ {
193
+ className: "comment-editor",
194
+ sx: {
195
+ mt: 2
196
+ },
197
+ children: j()
198
+ }
199
+ )
200
+ ] }),
201
+ !!E && P && /* @__PURE__ */ m(
202
+ p,
203
+ {
204
+ sx: {
205
+ display: "flex",
206
+ justifyContent: "space-between",
207
+ alignItems: "center",
208
+ mt: 3
209
+ },
210
+ children: [
211
+ /* @__PURE__ */ m(p, { sx: { fontWeight: "medium" }, children: [
212
+ E > 0 ? `${E} ${c("comments")}` : c("comment"),
213
+ " "
214
+ ] }),
215
+ /* @__PURE__ */ r(
216
+ ge,
217
+ {
218
+ value: z,
219
+ options: [
220
+ { value: "desc", label: c("newest") },
221
+ { value: "asc", label: c("oldest") }
222
+ ],
223
+ onChange: (i) => L(i)
224
+ }
225
+ )
226
+ ]
227
+ }
228
+ ),
229
+ /* @__PURE__ */ r(ye, { className: "comment-list" }),
230
+ k.user && D && C === "bottom" && /* @__PURE__ */ r(p, { sx: { mt: 6, ...g }, children: j() })
231
+ ] });
232
+ }
233
+ K.propTypes = {
234
+ ref: t.any,
235
+ displayReaction: t.bool,
236
+ object: t.object.isRequired,
237
+ onChange: t.func,
238
+ onSendComment: t.func,
239
+ disabledSend: t.bool,
240
+ autoFocus: t.bool,
241
+ initialContent: t.string,
242
+ sendText: t.string,
243
+ sendIcon: t.node,
244
+ commentInputPosition: t.oneOf(["top", "bottom"]),
245
+ showTopbar: t.bool,
246
+ sendComment: t.func,
247
+ reactionAppend: t.any,
248
+ skeleton: t.node,
249
+ placeholder: t.string,
250
+ onInput: t.func,
251
+ draftKey: t.string,
252
+ editorRef: t.object,
253
+ inputSx: t.object,
254
+ disableCmdEnter: t.bool
273
255
  };
274
- function Wrapper({
275
- target,
276
- flatView,
277
- autoCollapse,
278
- autoLoadComments,
279
- order,
280
- allowCopyLink,
281
- showProfileCard,
282
- interactive,
283
- renderComments,
284
- renderDonation,
285
- renderActions,
286
- renderEditorPlugins,
287
- enableAutoTranslate,
288
- renderInnerFooter,
289
- ...rest
256
+ function De({
257
+ target: e,
258
+ flatView: n = !1,
259
+ autoCollapse: o = !1,
260
+ autoLoadComments: l = !0,
261
+ order: f = void 0,
262
+ allowCopyLink: C = !1,
263
+ showProfileCard: w = !1,
264
+ interactive: x = !0,
265
+ renderComments: A = null,
266
+ renderDonation: v = null,
267
+ renderActions: I = null,
268
+ renderEditorPlugins: P = null,
269
+ enableAutoTranslate: h = !1,
270
+ renderInnerFooter: T = null,
271
+ ...$
290
272
  }) {
291
- if (!(target == null ? void 0 : target.id)) {
273
+ const S = Object.assign(
274
+ {},
275
+ {
276
+ displayReaction: !0,
277
+ onChange: () => {
278
+ },
279
+ onSendComment: () => {
280
+ },
281
+ disabledSend: void 0,
282
+ sendComment: null,
283
+ reactionAppend: null
284
+ },
285
+ $
286
+ );
287
+ if (!e?.id)
292
288
  throw new Error("target is required.");
293
- }
294
- const { locale = "en" } = useLocaleContext() || {};
295
- const containerRef = useRef();
296
- const object = useMemo(
289
+ const { locale: R = "en" } = F() || {}, b = J(), g = Q(
297
290
  () => ({
298
291
  link: window.location.href,
299
- blockletName: getCurrentBlockletComponentName(),
300
- ...target
292
+ blockletName: $e(),
293
+ ...e
301
294
  }),
302
295
  // eslint-disable-next-line react-hooks/exhaustive-deps
303
- [target]
304
- );
305
- const wsClient = getWsClient(discussKitPrefix);
306
- useEffect(() => {
307
- wsClient.connect();
308
- return () => {
309
- if (wsClient.isConnected()) ;
310
- };
311
- }, []);
312
- return /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent: ErrorFallback, children: /* @__PURE__ */ jsx(LocaleProvider, { translations, locale, children: /* @__PURE__ */ jsx(UploaderProvider, { children: /* @__PURE__ */ jsx(InternalThemeProvider, { children: /* @__PURE__ */ jsx(ConfirmProvider, { children: /* @__PURE__ */ jsx(DefaultEditorConfigProvider, { request: api, children: /* @__PURE__ */ jsx(
313
- CommentsProvider,
296
+ [e]
297
+ ), y = ae(Ie);
298
+ return X(() => (y.connect(), () => {
299
+ y.isConnected();
300
+ }), []), /* @__PURE__ */ r(se, { FallbackComponent: Ae, children: /* @__PURE__ */ r(ie, { translations: ve, locale: R, children: /* @__PURE__ */ r(le, { children: /* @__PURE__ */ r(de, { children: /* @__PURE__ */ r(ce, { children: /* @__PURE__ */ r(ue, { request: s, children: /* @__PURE__ */ r(
301
+ me,
314
302
  {
315
- target: object,
316
- api: commentAPI,
317
- flatView,
318
- order,
319
- autoCollapse,
320
- autoLoadComments,
321
- allowCopyLink,
322
- showProfileCard,
323
- interactive,
324
- containerRef,
325
- renderDonation,
326
- renderActions,
327
- renderEditorPlugins,
328
- enableAutoTranslate,
329
- renderComments,
330
- renderInnerFooter,
331
- children: /* @__PURE__ */ jsx(DiscussKitComments, { ...rest, object, ref: containerRef })
303
+ target: g,
304
+ api: Se,
305
+ flatView: n,
306
+ order: f,
307
+ autoCollapse: o,
308
+ autoLoadComments: l,
309
+ allowCopyLink: C,
310
+ showProfileCard: w,
311
+ interactive: x,
312
+ containerRef: b,
313
+ renderDonation: v,
314
+ renderActions: I,
315
+ renderEditorPlugins: P,
316
+ enableAutoTranslate: h,
317
+ renderComments: A,
318
+ renderInnerFooter: T,
319
+ children: /* @__PURE__ */ r(K, { ...S, object: g, ref: b })
332
320
  }
333
321
  ) }) }) }) }) }) });
334
322
  }
335
- Wrapper.propTypes = {
336
- target: PropTypes.shape({
337
- id: PropTypes.string.isRequired,
338
- title: PropTypes.string,
339
- desc: PropTypes.string,
340
- owner: PropTypes.string
323
+ De.propTypes = {
324
+ target: t.shape({
325
+ id: t.string.isRequired,
326
+ title: t.string,
327
+ desc: t.string,
328
+ owner: t.string
341
329
  }).isRequired,
342
- displayReaction: PropTypes.bool,
343
- onChange: PropTypes.func,
344
- flatView: PropTypes.bool,
345
- autoCollapse: PropTypes.bool,
346
- autoLoadComments: PropTypes.bool,
347
- allowCopyLink: PropTypes.bool,
348
- disabledSend: PropTypes.bool,
349
- showProfileCard: PropTypes.bool,
350
- order: PropTypes.oneOf(["asc", "desc"]),
351
- interactive: PropTypes.bool,
352
- renderComments: PropTypes.func,
353
- renderDonation: PropTypes.any,
354
- renderActions: PropTypes.func,
355
- renderEditorPlugins: PropTypes.func,
356
- enableAutoTranslate: PropTypes.bool,
357
- renderInnerFooter: PropTypes.func,
358
- sendComment: PropTypes.func,
359
- reactionAppend: PropTypes.any
360
- };
361
- Wrapper.defaultProps = {
362
- displayReaction: true,
363
- onChange: () => {
364
- },
365
- flatView: false,
366
- autoCollapse: false,
367
- autoLoadComments: true,
368
- allowCopyLink: false,
369
- disabledSend: void 0,
370
- showProfileCard: false,
371
- order: void 0,
372
- interactive: true,
373
- renderComments: null,
374
- renderDonation: null,
375
- renderActions: null,
376
- renderEditorPlugins: null,
377
- enableAutoTranslate: false,
378
- renderInnerFooter: null,
379
- sendComment: null,
380
- reactionAppend: null
330
+ displayReaction: t.bool,
331
+ onChange: t.func,
332
+ flatView: t.bool,
333
+ autoCollapse: t.bool,
334
+ autoLoadComments: t.bool,
335
+ allowCopyLink: t.bool,
336
+ disabledSend: t.bool,
337
+ showProfileCard: t.bool,
338
+ order: t.oneOf(["asc", "desc"]),
339
+ interactive: t.bool,
340
+ renderComments: t.func,
341
+ renderDonation: t.any,
342
+ renderActions: t.func,
343
+ renderEditorPlugins: t.func,
344
+ enableAutoTranslate: t.bool,
345
+ renderInnerFooter: t.func,
346
+ sendComment: t.func,
347
+ reactionAppend: t.any
381
348
  };
382
- const Container = styled("div")`
349
+ const Ee = ee("div")`
383
350
  width: 100%;
384
351
  margin: 0 auto;
385
352
  box-sizing: border-box;
386
- padding: ${(props) => props.padding ? "20px" : "0"};
387
- border: ${(props) => props.border ? "1px solid rgb(208, 215, 222)" : "none"};
353
+ padding: ${(e) => e.padding ? "20px" : "0"};
354
+ border: ${(e) => e.border ? "1px solid rgb(208, 215, 222)" : "none"};
388
355
  border-radius: 6px;
389
356
  `;
390
357
  export {
391
- Wrapper as default
358
+ De as default
392
359
  };