strapi-plugin-comments 3.2.3-beta.1 → 3.2.3

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.
Files changed (36) hide show
  1. package/dist/_chunks/en-D55DewfG.js +1 -0
  2. package/dist/_chunks/{en-Y06L5Ws_.mjs → en-D_SOYUc-.mjs} +1 -0
  3. package/dist/_chunks/fr-BJBWOa1O.js +1 -0
  4. package/dist/_chunks/{fr-Cv2agoba.mjs → fr-D-buWSlG.mjs} +3 -2
  5. package/dist/_chunks/{index-BXQcm9IU.mjs → index-B0yEw22H.mjs} +6055 -6049
  6. package/dist/_chunks/{index-CWULkNp0.mjs → index-Bi2NGQAJ.mjs} +2069 -2087
  7. package/dist/_chunks/index-BuR0AJ4i.mjs +417 -0
  8. package/dist/_chunks/{index-D_8HT5__.js → index-Cw0IIXkV.js} +18 -18
  9. package/dist/_chunks/{index-BFK8nlhm.mjs → index-DKj3j1po.mjs} +9 -8
  10. package/dist/_chunks/index-DQDKR2VV.js +1 -0
  11. package/dist/_chunks/{index-BqopobY7.js → index-EP5RzAx9.js} +2 -2
  12. package/dist/_chunks/index-k6CsdDOQ.js +5 -0
  13. package/dist/admin/index.js +1 -1
  14. package/dist/admin/index.mjs +1 -1
  15. package/dist/admin/src/api/client.d.ts +7 -7
  16. package/dist/admin/src/api/schemas.d.ts +35 -35
  17. package/dist/admin/src/contexts/UserContext.d.ts +4 -4
  18. package/dist/admin/src/hooks/useAPI.d.ts +11 -11
  19. package/dist/admin/src/hooks/useCommentMutations.d.ts +4 -4
  20. package/dist/admin/src/hooks/useUserContext.d.ts +4 -4
  21. package/dist/admin/src/pages/Settings/hooks/useSettingsAPI.d.ts +3 -3
  22. package/dist/admin/src/translations/en.d.ts +1 -0
  23. package/dist/admin/src/translations/fr.d.ts +1 -0
  24. package/dist/server/index.js +52 -52
  25. package/dist/server/index.mjs +2437 -2449
  26. package/dist/server/src/controllers/admin.controller.d.ts +1 -1
  27. package/dist/server/src/controllers/index.d.ts +1 -1
  28. package/dist/server/src/index.d.ts +673 -8967
  29. package/dist/server/src/services/admin/admin.service.d.ts +9 -144
  30. package/dist/server/src/services/index.d.ts +672 -8966
  31. package/package.json +3 -3
  32. package/dist/_chunks/en-nurIIakL.js +0 -1
  33. package/dist/_chunks/fr-JAoXWyAN.js +0 -1
  34. package/dist/_chunks/index-BIcDaXS9.js +0 -5
  35. package/dist/_chunks/index-C4g76XDn.js +0 -1
  36. package/dist/_chunks/index-CzeSZ5qw.mjs +0 -340
@@ -0,0 +1,417 @@
1
+ import { jsx as e, Fragment as O, jsxs as i } from "react/jsx-runtime";
2
+ import { Button as F, Flex as I, Typography as h, Badge as oe, Box as m, Grid as s, Field as n, MultiSelect as q, MultiSelectOption as A, Accordion as y, Switch as re, Toggle as B, Alert as se } from "@strapi/design-system";
3
+ import { Check as le, Play as ae, ArrowClockwise as W } from "@strapi/icons";
4
+ import { useNotification as ce, Page as j, Layouts as N, Form as de } from "@strapi/strapi/admin";
5
+ import { useMutation as T, useQuery as v, useQueryClient as ge } from "@tanstack/react-query";
6
+ import { u as U, f as he, a as pe, g as t, l as D, e as me } from "./index-Bi2NGQAJ.mjs";
7
+ import { useMemo as ue, useRef as be, useState as fe, useCallback as Q } from "react";
8
+ import ye from "styled-components";
9
+ import { v as Se } from "./index-DKj3j1po.mjs";
10
+ const P = ({
11
+ children: c,
12
+ condition: a
13
+ }) => a ? /* @__PURE__ */ e(O, { children: c }) : null, we = (c = {}) => {
14
+ const a = U(), S = T({
15
+ mutationFn: a.settings.update,
16
+ onSuccess: c.updateSettingsMutationSuccess,
17
+ onError: c.updateSettingsMutationError
18
+ }), p = T({
19
+ mutationFn: a.settings.restore,
20
+ onSuccess: c.restoreSettingsMutationSuccess,
21
+ onError: c.restoreSettingsMutationError
22
+ }), w = T({
23
+ mutationFn: a.settings.restart,
24
+ onSuccess: c.restartStrapiMutationSuccess,
25
+ onError: c.restartStrapiMutationError
26
+ }), u = v({
27
+ queryKey: a.config.getKey(),
28
+ queryFn: a.config.query
29
+ }), b = v({
30
+ queryKey: a.contentTypeBuilder.all.getKey(),
31
+ queryFn: a.contentTypeBuilder.all.query
32
+ }), f = v({
33
+ queryKey: a.roles.getKey(),
34
+ queryFn: a.roles.query
35
+ });
36
+ return ue(() => ({
37
+ config: u,
38
+ collectionTypes: b,
39
+ roles: f,
40
+ restoreSettingsMutation: p,
41
+ updateSettingsMutation: S,
42
+ restartStrapiMutation: w
43
+ }), [
44
+ u,
45
+ f,
46
+ b,
47
+ p,
48
+ S,
49
+ w
50
+ ]);
51
+ }, Ce = Se, R = {
52
+ background: "neutral0",
53
+ hasRadius: !0,
54
+ shadow: "filterShadow",
55
+ padding: 6,
56
+ width: "100%"
57
+ }, Ie = ye(se)(() => ({
58
+ "[role]": {
59
+ flexDirection: "column"
60
+ }
61
+ })), Re = () => {
62
+ const c = be(null), { toggleNotification: a } = ce(), [S, p] = fe(!1), { isLoadingForPermissions: w, canSettingsChange: u } = pe(), b = ge(), f = U(), {
63
+ config: d,
64
+ collectionTypes: M,
65
+ roles: L,
66
+ restoreSettingsMutation: V,
67
+ updateSettingsMutation: k,
68
+ restartStrapiMutation: G
69
+ } = we({
70
+ restoreSettingsMutationSuccess: () => {
71
+ b.invalidateQueries({
72
+ queryKey: f.config.getKey(),
73
+ exact: !1
74
+ }), p(!0), a({
75
+ message: t("page.settings.actions.restore.success"),
76
+ type: "success"
77
+ });
78
+ },
79
+ restartStrapiMutationSuccess: () => {
80
+ p(!1);
81
+ },
82
+ updateSettingsMutationSuccess: () => {
83
+ b.invalidateQueries({
84
+ queryKey: f.config.getKey(),
85
+ exact: !1
86
+ }), p(!0);
87
+ }
88
+ }), z = Q(() => {
89
+ c.current?.requestSubmit();
90
+ }, []), J = Q(
91
+ (r) => {
92
+ k.mutate({
93
+ ...r,
94
+ blockedAuthorProps: r.blockedAuthorProps.split(",").map((l) => l.trim())
95
+ });
96
+ },
97
+ [k]
98
+ );
99
+ if (d.status !== "success" || M.status !== "success" || L.status !== "success" || w)
100
+ return t("page.settings.loading");
101
+ const x = M.data.filter((r) => r.uid.includes("api::")), X = d.data.enabledCollections.filter(
102
+ (r) => x.some((l) => l.uid === r)
103
+ ), Y = D.isNil(d.data.badWords) ? !0 : d.data?.badWords, Z = !!d.data.gql?.auth, _ = d.data.moderatorRoles.filter(
104
+ (r) => L.data.filter((l) => l.code === r)
105
+ ), $ = d.data.client?.url, ee = d.data.client?.contactEmail, te = d.data.blockedAuthorProps ?? [], ne = () => p(!1);
106
+ return /* @__PURE__ */ i(O, { children: [
107
+ /* @__PURE__ */ e(j.Title, { children: "Comments - settings" }),
108
+ /* @__PURE__ */ i(j.Main, { children: [
109
+ /* @__PURE__ */ e(
110
+ N.Header,
111
+ {
112
+ title: t("page.settings.header.title"),
113
+ subtitle: /* @__PURE__ */ i(I, { direction: "row", gap: 3, alignItems: "center", justifyContent: "space-between", children: [
114
+ /* @__PURE__ */ e(h, { variant: "epsilon", textColor: "neutral600", tag: "p", children: t("page.settings.header.description") }),
115
+ /* @__PURE__ */ e(oe, { color: "neutral", minWidth: "fit-content", children: /* @__PURE__ */ i("span", { style: { textTransform: "none" }, children: [
116
+ "v",
117
+ Ce
118
+ ] }) })
119
+ ] }),
120
+ primaryAction: /* @__PURE__ */ e(P, { condition: u, children: /* @__PURE__ */ e(F, { type: "submit", startIcon: /* @__PURE__ */ e(le, {}), onClick: z, children: t("page.settings.actions.submit") }) })
121
+ }
122
+ ),
123
+ /* @__PURE__ */ i(N.Content, { children: [
124
+ S && /* @__PURE__ */ e(m, { marginBottom: 4, children: /* @__PURE__ */ e(
125
+ Ie,
126
+ {
127
+ closeLabel: t("page.settings.actions.restart.alert.close"),
128
+ title: t("page.settings.actions.restart.alert.title"),
129
+ onClose: ne,
130
+ action: /* @__PURE__ */ e(m, { children: /* @__PURE__ */ e(F, { onClick: G.mutate, startIcon: /* @__PURE__ */ e(ae, {}), children: t("page.settings.actions.restart") }) }),
131
+ children: /* @__PURE__ */ e(m, { marginTop: 4, children: t("page.settings.actions.restart.alert.description") })
132
+ }
133
+ ) }),
134
+ /* @__PURE__ */ e(
135
+ de,
136
+ {
137
+ method: "POST",
138
+ width: "auto",
139
+ height: "auto",
140
+ ref: c,
141
+ onSubmit: J,
142
+ initialValues: {
143
+ enabledCollections: X,
144
+ moderatorRoles: _,
145
+ badWords: Y,
146
+ clientEmail: ee,
147
+ clientUrl: $,
148
+ gqlAuthEnabled: Z,
149
+ approvalFlow: d.data.approvalFlow,
150
+ entryLabel: d.data.entryLabel,
151
+ blockedAuthorProps: te.join(", ")
152
+ },
153
+ children: ({ values: r, onChange: l }) => /* @__PURE__ */ i(I, { gap: 4, direction: "column", children: [
154
+ /* @__PURE__ */ i(m, { ...R, children: [
155
+ /* @__PURE__ */ e(h, { variant: "delta", as: "h2", children: t("page.settings.section.general") }),
156
+ /* @__PURE__ */ i(s.Root, { gap: 4, marginTop: 4, width: "100%", children: [
157
+ /* @__PURE__ */ e(s.Item, { xs: 12, children: /* @__PURE__ */ i(
158
+ n.Root,
159
+ {
160
+ width: "100%",
161
+ hint: t("page.settings.form.enabledCollections.hint"),
162
+ children: [
163
+ /* @__PURE__ */ e(n.Label, { htmlFor: "enabledCollections", children: t("page.settings.form.enabledCollections.label") }),
164
+ /* @__PURE__ */ e(
165
+ q,
166
+ {
167
+ withTags: !0,
168
+ name: "enabledCollections",
169
+ value: r.enabledCollections,
170
+ onChange: (o) => {
171
+ l("enabledCollections", o);
172
+ },
173
+ children: x.map((o) => /* @__PURE__ */ e(A, { value: o.uid, children: o.schema.displayName }, o.uid))
174
+ }
175
+ ),
176
+ /* @__PURE__ */ e(n.Hint, {})
177
+ ]
178
+ }
179
+ ) }),
180
+ r.enabledCollections.length > 0 && /* @__PURE__ */ e(s.Item, { children: /* @__PURE__ */ i(s.Root, { gap: 4, width: "100%", children: [
181
+ /* @__PURE__ */ e(s.Item, { children: /* @__PURE__ */ e(h, { children: t("page.settings.form.contentTypesSettings.label") }) }),
182
+ /* @__PURE__ */ e(s.Item, { children: /* @__PURE__ */ e(y.Root, { style: { width: "100%" }, children: D.orderBy(r.enabledCollections).map((o) => {
183
+ const E = x.find((C) => C.uid === o);
184
+ if (E) {
185
+ const {
186
+ schema: { displayName: C, attributes: H }
187
+ } = E, K = Object.keys(H).filter(
188
+ (g) => H[g].type === "string"
189
+ );
190
+ return /* @__PURE__ */ i(y.Item, { value: o, children: [
191
+ /* @__PURE__ */ e(y.Header, { children: /* @__PURE__ */ e(y.Trigger, { children: /* @__PURE__ */ e(h, { variant: "epsilon", as: "h3", children: C }) }) }),
192
+ /* @__PURE__ */ e(y.Content, { children: /* @__PURE__ */ i(s.Root, { padding: 6, gap: 4, children: [
193
+ /* @__PURE__ */ e(s.Item, { children: /* @__PURE__ */ i(
194
+ n.Root,
195
+ {
196
+ width: "100%",
197
+ hint: t({
198
+ id: "page.settings.form.approvalFlow.hint",
199
+ props: { name: C }
200
+ }),
201
+ children: [
202
+ /* @__PURE__ */ e(n.Label, { children: t(
203
+ "page.settings.form.approvalFlow.label"
204
+ ) }),
205
+ /* @__PURE__ */ e(
206
+ re,
207
+ {
208
+ visibleLabels: !0,
209
+ onLabel: t("components.toogle.enabled"),
210
+ offLabel: t("components.toogle.disabled"),
211
+ checked: r.approvalFlow.includes(o),
212
+ onCheckedChange: (g) => {
213
+ l(
214
+ "approvalFlow",
215
+ g ? [...r.approvalFlow, o] : r.approvalFlow.filter(
216
+ (ie) => ie !== o
217
+ )
218
+ );
219
+ }
220
+ }
221
+ ),
222
+ /* @__PURE__ */ e(n.Hint, {})
223
+ ]
224
+ }
225
+ ) }),
226
+ /* @__PURE__ */ e(P, { condition: K.length > 0, children: /* @__PURE__ */ e(s.Item, { children: /* @__PURE__ */ i(
227
+ n.Root,
228
+ {
229
+ width: "100%",
230
+ hint: t(
231
+ "page.settings.form.entryLabel.hint"
232
+ ),
233
+ children: [
234
+ /* @__PURE__ */ e(n.Label, { children: t(
235
+ "page.settings.form.entryLabel.label"
236
+ ) }),
237
+ /* @__PURE__ */ e(
238
+ q,
239
+ {
240
+ withTags: !0,
241
+ placeholder: t(
242
+ "page.settings.form.entryLabel.placeholder"
243
+ ),
244
+ name: "enabledCollections",
245
+ value: r.entryLabel[o] ?? [],
246
+ onChange: (g) => {
247
+ l("entryLabel", {
248
+ ...r.entryLabel,
249
+ [o]: g
250
+ });
251
+ },
252
+ children: K.map((g) => /* @__PURE__ */ e(A, { value: g, children: g }, g))
253
+ }
254
+ ),
255
+ /* @__PURE__ */ e(n.Hint, {})
256
+ ]
257
+ }
258
+ ) }) })
259
+ ] }) })
260
+ ] }, o);
261
+ }
262
+ return null;
263
+ }) }) })
264
+ ] }) })
265
+ ] })
266
+ ] }),
267
+ /* @__PURE__ */ i(m, { ...R, children: [
268
+ /* @__PURE__ */ e(h, { variant: "delta", as: "h2", children: t("page.settings.section.additional") }),
269
+ /* @__PURE__ */ i(s.Root, { gap: 4, marginTop: 4, width: "100%", children: [
270
+ /* @__PURE__ */ e(s.Item, { col: 4, xs: 12, alignItems: "start", children: /* @__PURE__ */ i(
271
+ n.Root,
272
+ {
273
+ width: "100%",
274
+ hint: t("page.settings.form.enabledCollections.hint"),
275
+ children: [
276
+ /* @__PURE__ */ e(n.Label, { htmlFor: "enabledCollections", children: t("page.settings.form.enabledCollections.label") }),
277
+ /* @__PURE__ */ e(
278
+ B,
279
+ {
280
+ name: "badWords",
281
+ checked: r.badWords,
282
+ onChange: l,
283
+ onLabel: t("components.toogle.enabled"),
284
+ offLabel: t("components.toogle.disabled"),
285
+ width: "100%"
286
+ }
287
+ ),
288
+ /* @__PURE__ */ e(n.Hint, {})
289
+ ]
290
+ }
291
+ ) }),
292
+ /* @__PURE__ */ e(s.Item, { col: 4, xs: 12, alignItems: "start", children: /* @__PURE__ */ i(
293
+ n.Root,
294
+ {
295
+ width: "100%",
296
+ hint: t("page.settings.form.author.blockedProps.hint"),
297
+ children: [
298
+ /* @__PURE__ */ e(n.Label, { htmlFor: "enabledCollections", children: t("page.settings.form.author.blockedProps.label") }),
299
+ /* @__PURE__ */ e(
300
+ n.Input,
301
+ {
302
+ name: "blockedAuthorProps",
303
+ value: r.blockedAuthorProps,
304
+ onChange: l
305
+ }
306
+ ),
307
+ /* @__PURE__ */ e(n.Hint, {})
308
+ ]
309
+ }
310
+ ) }),
311
+ /* @__PURE__ */ e(s.Item, { col: 4, xs: 12, alignItems: "start", children: /* @__PURE__ */ i(n.Root, { width: "100%", hint: t("page.settings.form.gqlAuth.hint"), children: [
312
+ /* @__PURE__ */ e(n.Label, { children: t("page.settings.form.gqlAuth.label") }),
313
+ /* @__PURE__ */ e(
314
+ B,
315
+ {
316
+ name: "gqlAuthEnabled",
317
+ checked: r.gqlAuthEnabled,
318
+ onChange: l,
319
+ onLabel: t("components.toogle.enabled"),
320
+ offLabel: t("components.toogle.disabled"),
321
+ width: "100%"
322
+ }
323
+ ),
324
+ /* @__PURE__ */ e(n.Hint, {})
325
+ ] }) })
326
+ ] })
327
+ ] }),
328
+ /* @__PURE__ */ i(m, { ...R, children: [
329
+ /* @__PURE__ */ e(h, { variant: "delta", as: "h2", children: t("page.settings.section.client") }),
330
+ /* @__PURE__ */ i(s.Root, { gap: 4, marginTop: 4, width: "100%", children: [
331
+ /* @__PURE__ */ e(s.Item, { col: 4, xs: 12, alignItems: "start", children: /* @__PURE__ */ i(
332
+ n.Root,
333
+ {
334
+ width: "100%",
335
+ hint: t("page.settings.form.client.url.hint"),
336
+ children: [
337
+ /* @__PURE__ */ e(n.Label, { children: t("page.settings.form.client.url.label") }),
338
+ /* @__PURE__ */ e(n.Input, { name: "clientUrl", onChange: l }),
339
+ /* @__PURE__ */ e(n.Hint, {})
340
+ ]
341
+ }
342
+ ) }),
343
+ /* @__PURE__ */ e(s.Item, { col: 4, xs: 12, alignItems: "start", children: /* @__PURE__ */ i(
344
+ n.Root,
345
+ {
346
+ width: "100%",
347
+ hint: t("page.settings.form.client.email.hint"),
348
+ children: [
349
+ /* @__PURE__ */ e(n.Label, { children: t("page.settings.form.client.email.label") }),
350
+ /* @__PURE__ */ e(n.Input, { name: "clientEmail", onChange: l }),
351
+ /* @__PURE__ */ e(n.Hint, {})
352
+ ]
353
+ }
354
+ ) }),
355
+ /* @__PURE__ */ e(s.Item, { col: 4, xs: 12, alignItems: "start", children: /* @__PURE__ */ i(
356
+ n.Root,
357
+ {
358
+ width: "100%",
359
+ hint: t("page.settings.form.moderatorRoles.hint"),
360
+ children: [
361
+ /* @__PURE__ */ e(n.Label, { children: t("page.settings.form.moderatorRoles.label") }),
362
+ /* @__PURE__ */ e(
363
+ q,
364
+ {
365
+ withTags: !0,
366
+ placeholder: t("page.settings.form.moderatorRoles.placeholder"),
367
+ name: "enabledCollections",
368
+ value: r.moderatorRoles,
369
+ onChange: (o) => {
370
+ l("moderatorRoles", o);
371
+ },
372
+ children: L.data.map((o) => /* @__PURE__ */ e(A, { value: o.code, children: o.name }, o.code))
373
+ }
374
+ ),
375
+ /* @__PURE__ */ e(n.Hint, {})
376
+ ]
377
+ }
378
+ ) })
379
+ ] })
380
+ ] }),
381
+ /* @__PURE__ */ e(P, { condition: u, children: /* @__PURE__ */ e(m, { ...R, children: /* @__PURE__ */ i(I, { gap: 4, direction: "column", alignItems: "flex-start", children: [
382
+ /* @__PURE__ */ i(I, { gap: 2, direction: "column", alignItems: "flex-start", children: [
383
+ /* @__PURE__ */ e(h, { variant: "delta", as: "h2", children: t("page.settings.section.restore") }),
384
+ /* @__PURE__ */ e(h, { variant: "pi", as: "h4", children: t("page.settings.section.restore.subtitle") })
385
+ ] }),
386
+ /* @__PURE__ */ e(
387
+ me,
388
+ {
389
+ Trigger: ({ onClick: o }) => /* @__PURE__ */ e(
390
+ F,
391
+ {
392
+ variant: "danger-light",
393
+ startIcon: /* @__PURE__ */ e(W, {}),
394
+ onClick: o,
395
+ children: t("page.settings.actions.restore")
396
+ }
397
+ ),
398
+ onConfirm: V.mutate,
399
+ title: t("page.settings.actions.restore.confirmation.header"),
400
+ labelConfirm: t(
401
+ "page.settings.actions.restore.confirmation.button.confirm"
402
+ ),
403
+ iconConfirm: /* @__PURE__ */ e(W, {}),
404
+ children: t("page.settings.actions.restore.confirmation.description")
405
+ }
406
+ )
407
+ ] }) }) })
408
+ ] })
409
+ }
410
+ )
411
+ ] })
412
+ ] })
413
+ ] });
414
+ }, ke = () => /* @__PURE__ */ e(he, { children: /* @__PURE__ */ e(Re, {}) });
415
+ export {
416
+ ke as default
417
+ };