strapi-plugin-comments 3.0.6 → 3.0.7

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 (49) hide show
  1. package/README.md +1 -1
  2. package/dist/_chunks/en-CgUbWvmQ.js +1 -0
  3. package/dist/_chunks/{en-DZljqkLz.mjs → en-DCsHR-ue.mjs} +2 -2
  4. package/dist/_chunks/fr-BXfxIXq1.js +1 -0
  5. package/dist/_chunks/{fr-oAh2cU0E.mjs → fr-DC9DGoT1.mjs} +2 -2
  6. package/dist/_chunks/index-Bpnqk6JP.js +1 -0
  7. package/dist/_chunks/index-CF4vndXw.mjs +38389 -0
  8. package/dist/_chunks/index-CFIjHfkZ.js +2153 -0
  9. package/dist/_chunks/index-CHDv123w.js +44 -0
  10. package/dist/_chunks/index-CwHmRIcs.mjs +339 -0
  11. package/dist/_chunks/{index-yhf78avJ.mjs → index-DGKkpdmq.mjs} +15352 -25164
  12. package/dist/_chunks/index-YPqaQ-iX.js +600 -0
  13. package/dist/_chunks/index-pLgOJz-6.mjs +5718 -0
  14. package/dist/_chunks/pl-Bl4yP3sZ.js +1 -0
  15. package/dist/_chunks/{pl-BUVUFx9r.mjs → pl-DZiVsGIg.mjs} +2 -2
  16. package/dist/_chunks/{pt-BR-Bchhsf7B.mjs → pt-BR-CW4ugNZj.mjs} +2 -2
  17. package/dist/_chunks/pt-BR-D9T5g0JT.js +1 -0
  18. package/dist/_chunks/{ru-BQ54P0xr.mjs → ru-CfKjYq3M.mjs} +2 -2
  19. package/dist/_chunks/ru-DIZ4pV4l.js +1 -0
  20. package/dist/_chunks/{tr-CkGcBRUv.mjs → tr-BQR2hK7S.mjs} +2 -2
  21. package/dist/_chunks/tr-Dl2hdLCx.js +1 -0
  22. package/dist/_chunks/zh-Hans-BZhnqfei.js +1 -0
  23. package/dist/_chunks/{zh-Hans-Buh0iPWA.mjs → zh-Hans-lNqOn5JS.mjs} +2 -2
  24. package/dist/admin/index.js +1 -4
  25. package/dist/admin/index.mjs +2 -2
  26. package/dist/server/index.js +92 -14968
  27. package/dist/server/index.mjs +8927 -11840
  28. package/dist/server/src/controllers/index.d.ts +105 -0
  29. package/dist/server/src/index.d.ts +420 -0
  30. package/dist/server/src/services/admin/admin.service.d.ts +105 -0
  31. package/dist/server/src/services/client.service.d.ts +105 -0
  32. package/dist/server/src/services/index.d.ts +315 -0
  33. package/dist/server/src/validators/api/controllers/client.controller.validator.d.ts +105 -0
  34. package/dist/style.css +1 -84
  35. package/package.json +9 -9
  36. package/dist/_chunks/en-D1Rj1A_i.js +0 -195
  37. package/dist/_chunks/fr-DbxNAr65.js +0 -146
  38. package/dist/_chunks/index-BMAhFLKR.js +0 -375
  39. package/dist/_chunks/index-CK1XCSqz.mjs +0 -373
  40. package/dist/_chunks/index-DCKroyap.js +0 -51702
  41. package/dist/_chunks/index-DHhRVslt.js +0 -51324
  42. package/dist/_chunks/index-DUWJDJLu.mjs +0 -51309
  43. package/dist/_chunks/index-PCqyAKE7.mjs +0 -8487
  44. package/dist/_chunks/index-_4jTpBrc.js +0 -8503
  45. package/dist/_chunks/pl-CuTgrHph.js +0 -195
  46. package/dist/_chunks/pt-BR-2Z9CtgSm.js +0 -145
  47. package/dist/_chunks/ru-gtnRlbuP.js +0 -195
  48. package/dist/_chunks/tr-Ucl3IKMX.js +0 -193
  49. package/dist/_chunks/zh-Hans-Dhk3gIYb.js +0 -195
@@ -0,0 +1,339 @@
1
+ import { jsx as e, Fragment as U, jsxs as i } from "react/jsx-runtime";
2
+ import { e as I, f as re, B as p, a1 as ae, F as q, T as m, Z as a, m as n, a2 as x, a3 as T, a4 as f, a5 as se, a6 as N, a7 as Q, a8 as le } from "./index-CF4vndXw.mjs";
3
+ import { useTracking as ce, useNotification as de, Page as W, Layouts as j, Form as ge } from "@strapi/strapi/admin";
4
+ import { useMutation as A, useQuery as M, useQueryClient as he, QueryClient as pe } from "@tanstack/react-query";
5
+ import { u as $, f as me, a as ue, g as t, l as D, e as be } from "./index-pLgOJz-6.mjs";
6
+ import { useMemo as fe, useRef as ye, useState as Se, useCallback as O } from "react";
7
+ import we from "styled-components";
8
+ const P = ({
9
+ children: d,
10
+ condition: l
11
+ }) => l ? /* @__PURE__ */ e(U, { children: d }) : null, Re = (d = {}) => {
12
+ const l = $(), y = A({
13
+ mutationFn: l.settings.update,
14
+ onSuccess: d.updateSettingsMutationSuccess,
15
+ onError: d.updateSettingsMutationError
16
+ }), S = A({
17
+ mutationFn: l.settings.restore,
18
+ onSuccess: d.restoreSettingsMutationSuccess,
19
+ onError: d.restoreSettingsMutationError
20
+ }), h = A({
21
+ mutationFn: l.settings.restart,
22
+ onSuccess: d.restartStrapiMutationSuccess,
23
+ onError: d.restartStrapiMutationError
24
+ }), w = M({
25
+ queryKey: l.config.getKey(),
26
+ queryFn: l.config.query
27
+ }), u = M({
28
+ queryKey: l.contentTypeBuilder.all.getKey(),
29
+ queryFn: l.contentTypeBuilder.all.query
30
+ }), b = M({
31
+ queryKey: l.roles.getKey(),
32
+ queryFn: l.roles.query
33
+ });
34
+ return fe(() => ({
35
+ config: w,
36
+ collectionTypes: u,
37
+ roles: b,
38
+ restoreSettingsMutation: S,
39
+ updateSettingsMutation: y,
40
+ restartStrapiMutation: h
41
+ }), [
42
+ w,
43
+ b,
44
+ u,
45
+ S,
46
+ y,
47
+ h
48
+ ]);
49
+ }, C = {
50
+ background: "neutral0",
51
+ hasRadius: !0,
52
+ shadow: "filterShadow",
53
+ padding: 6,
54
+ width: "100%"
55
+ }, Ce = we(le)(() => ({
56
+ "[role]": {
57
+ flexDirection: "column"
58
+ }
59
+ })), Le = () => {
60
+ const { trackUsage: d } = ce(), l = ye(null), { toggleNotification: y } = de(), [S, h] = Se(!1), { isLoadingForPermissions: w, canSettingsChange: u } = ue(), b = he(), v = $(), {
61
+ config: c,
62
+ collectionTypes: k,
63
+ roles: L,
64
+ restoreSettingsMutation: G,
65
+ updateSettingsMutation: E,
66
+ restartStrapiMutation: V
67
+ } = Re({
68
+ restoreSettingsMutationSuccess: () => {
69
+ b.invalidateQueries({
70
+ queryKey: v.config.getKey(),
71
+ exact: !1
72
+ }), h(!0), y({
73
+ message: t("page.settings.actions.restore.success"),
74
+ type: "success"
75
+ });
76
+ },
77
+ restartStrapiMutationSuccess: () => {
78
+ h(!1);
79
+ },
80
+ updateSettingsMutationSuccess: () => {
81
+ b.invalidateQueries({
82
+ queryKey: v.config.getKey(),
83
+ exact: !1
84
+ }), h(!0);
85
+ }
86
+ }), Z = O(() => {
87
+ l.current?.requestSubmit();
88
+ }, []), z = O((r) => {
89
+ E.mutate({
90
+ ...r,
91
+ blockedAuthorProps: r.blockedAuthorProps.split(",").map((s) => s.trim())
92
+ });
93
+ }, [E]);
94
+ if (c.status !== "success" || k.status !== "success" || L.status !== "success" || w)
95
+ return t("page.settings.loading");
96
+ const F = k.data.filter((r) => r.uid.includes("api::")), J = c.data.enabledCollections.filter((r) => F.some((s) => s.uid === r)), X = D.isNil(c.data.badWords) ? !0 : c.data?.badWords, Y = !!c.data.gql?.auth, _ = c.data.moderatorRoles.filter((r) => L.data.filter((s) => s.code === r)), ee = c.data.client?.url, te = c.data.client?.contactEmail, ne = c.data.blockedAuthorProps ?? [], ie = () => h(!1);
97
+ return /* @__PURE__ */ i(U, { children: [
98
+ /* @__PURE__ */ e(W.Title, { children: "Comments - settings" }),
99
+ /* @__PURE__ */ i(W.Main, { children: [
100
+ /* @__PURE__ */ e(
101
+ j.Header,
102
+ {
103
+ title: t("page.settings.header.title"),
104
+ subtitle: t("page.settings.header.description"),
105
+ as: "h2",
106
+ primaryAction: /* @__PURE__ */ e(P, { condition: u, children: /* @__PURE__ */ e(I, { type: "submit", startIcon: /* @__PURE__ */ e(re, {}), onClick: Z, children: t("page.settings.actions.submit") }) })
107
+ }
108
+ ),
109
+ /* @__PURE__ */ i(j.Content, { children: [
110
+ S && /* @__PURE__ */ e(p, { marginBottom: 4, children: /* @__PURE__ */ e(
111
+ Ce,
112
+ {
113
+ closeLabel: t("page.settings.actions.restart.alert.cancel"),
114
+ title: t("page.settings.actions.restart.alert.title"),
115
+ onClose: ie,
116
+ action: /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(I, { onClick: V.mutate, startIcon: /* @__PURE__ */ e(ae, {}), children: t("page.settings.actions.restart") }) }),
117
+ children: /* @__PURE__ */ e(p, { marginTop: 4, children: t("page.settings.actions.restart.alert.description") })
118
+ }
119
+ ) }),
120
+ /* @__PURE__ */ e(
121
+ ge,
122
+ {
123
+ method: "POST",
124
+ ref: l,
125
+ onSubmit: z,
126
+ initialValues: {
127
+ enabledCollections: J,
128
+ moderatorRoles: _,
129
+ badWords: X,
130
+ clientEmail: te,
131
+ clientUrl: ee,
132
+ gqlAuthEnabled: Y,
133
+ approvalFlow: c.data.approvalFlow,
134
+ entryLabel: c.data.entryLabel,
135
+ blockedAuthorProps: ne.join(", ")
136
+ },
137
+ children: ({ values: r, onChange: s }) => /* @__PURE__ */ i(q, { gap: 4, direction: "column", children: [
138
+ /* @__PURE__ */ i(p, { ...C, children: [
139
+ /* @__PURE__ */ e(m, { variant: "delta", as: "h2", children: t("page.settings.section.general") }),
140
+ /* @__PURE__ */ i(a.Root, { gap: 4, marginTop: 4, width: "100%", children: [
141
+ /* @__PURE__ */ e(a.Item, { xs: 12, children: /* @__PURE__ */ i(n.Root, { width: "100%", hint: t("page.settings.form.enabledCollections.hint"), children: [
142
+ /* @__PURE__ */ e(n.Label, { htmlFor: "enabledCollections", children: t("page.settings.form.enabledCollections.label") }),
143
+ /* @__PURE__ */ e(
144
+ x,
145
+ {
146
+ withTags: !0,
147
+ name: "enabledCollections",
148
+ value: r.enabledCollections,
149
+ onChange: (o) => {
150
+ s("enabledCollections", o);
151
+ },
152
+ children: F.map((o) => /* @__PURE__ */ e(T, { value: o.uid, children: o.schema.displayName }, o.uid))
153
+ }
154
+ ),
155
+ /* @__PURE__ */ e(n.Hint, {})
156
+ ] }) }),
157
+ r.enabledCollections.length > 0 && /* @__PURE__ */ e(a.Item, { children: /* @__PURE__ */ i(a.Root, { gap: 4, width: "100%", children: [
158
+ /* @__PURE__ */ e(a.Item, { children: /* @__PURE__ */ e(m, { children: t("page.settings.form.contentTypesSettings.label") }) }),
159
+ /* @__PURE__ */ e(a.Item, { children: /* @__PURE__ */ e(f.Root, { style: { width: "100%" }, children: D.orderBy(r.enabledCollections).map((o) => {
160
+ const H = F.find((R) => R.uid === o);
161
+ if (H) {
162
+ const { schema: { displayName: R, attributes: K } } = H, B = Object.keys(K).filter((g) => K[g].type === "string");
163
+ return /* @__PURE__ */ i(f.Item, { value: o, children: [
164
+ /* @__PURE__ */ e(f.Header, { children: /* @__PURE__ */ e(f.Trigger, { children: /* @__PURE__ */ e(m, { variant: "epsilon", as: "h3", children: R }) }) }),
165
+ /* @__PURE__ */ e(f.Content, { children: /* @__PURE__ */ i(a.Root, { padding: 6, gap: 4, children: [
166
+ /* @__PURE__ */ e(a.Item, { children: /* @__PURE__ */ i(
167
+ n.Root,
168
+ {
169
+ width: "100%",
170
+ hint: t({
171
+ id: "page.settings.form.approvalFlow.hint",
172
+ props: { name: R }
173
+ }),
174
+ children: [
175
+ /* @__PURE__ */ e(n.Label, { children: t("page.settings.form.approvalFlow.label") }),
176
+ /* @__PURE__ */ e(
177
+ se,
178
+ {
179
+ visibleLabels: !0,
180
+ onLabel: t("components.toogle.enabled"),
181
+ offLabel: t("components.toogle.disabled"),
182
+ checked: r.approvalFlow.includes(o),
183
+ onCheckedChange: (g) => {
184
+ s("approvalFlow", g ? [...r.approvalFlow, o] : r.approvalFlow.filter((oe) => oe !== o));
185
+ }
186
+ }
187
+ ),
188
+ /* @__PURE__ */ e(n.Hint, {})
189
+ ]
190
+ }
191
+ ) }),
192
+ /* @__PURE__ */ e(P, { condition: B.length > 0, children: /* @__PURE__ */ e(a.Item, { children: /* @__PURE__ */ i(
193
+ n.Root,
194
+ {
195
+ width: "100%",
196
+ hint: t("page.settings.form.entryLabel.hint"),
197
+ children: [
198
+ /* @__PURE__ */ e(n.Label, { children: t("page.settings.form.entryLabel.label") }),
199
+ /* @__PURE__ */ e(
200
+ x,
201
+ {
202
+ withTags: !0,
203
+ placeholder: t("page.settings.form.entryLabel.placeholder"),
204
+ name: "enabledCollections",
205
+ value: r.entryLabel[o] ?? [],
206
+ onChange: (g) => {
207
+ s("entryLabel", { ...r.entryLabel, [o]: g });
208
+ },
209
+ children: B.map((g) => /* @__PURE__ */ e(T, { value: g, children: g }, g))
210
+ }
211
+ ),
212
+ /* @__PURE__ */ e(n.Hint, {})
213
+ ]
214
+ }
215
+ ) }) })
216
+ ] }) })
217
+ ] }, o);
218
+ }
219
+ return null;
220
+ }) }) })
221
+ ] }) })
222
+ ] })
223
+ ] }),
224
+ /* @__PURE__ */ i(p, { ...C, children: [
225
+ /* @__PURE__ */ e(m, { variant: "delta", as: "h2", children: t("page.settings.section.additional") }),
226
+ /* @__PURE__ */ i(a.Root, { gap: 4, marginTop: 4, width: "100%", children: [
227
+ /* @__PURE__ */ e(a.Item, { xs: 4, children: /* @__PURE__ */ i(n.Root, { width: "100%", hint: t("page.settings.form.enabledCollections.hint"), children: [
228
+ /* @__PURE__ */ e(n.Label, { htmlFor: "enabledCollections", children: t("page.settings.form.enabledCollections.label") }),
229
+ /* @__PURE__ */ e(
230
+ N,
231
+ {
232
+ name: "badWords",
233
+ checked: r.badWords,
234
+ onChange: s,
235
+ onLabel: t("components.toogle.enabled"),
236
+ offLabel: t("components.toogle.disabled"),
237
+ width: "100%"
238
+ }
239
+ ),
240
+ /* @__PURE__ */ e(n.Hint, {})
241
+ ] }) }),
242
+ /* @__PURE__ */ e(a.Item, { xs: 4, children: /* @__PURE__ */ i(n.Root, { width: "100%", hint: t("page.settings.form.author.blockedProps.hint"), children: [
243
+ /* @__PURE__ */ e(n.Label, { htmlFor: "enabledCollections", children: t("page.settings.form.author.blockedProps.label") }),
244
+ /* @__PURE__ */ e(n.Input, { name: "blockedProps", onChange: s }),
245
+ /* @__PURE__ */ e(n.Hint, {})
246
+ ] }) }),
247
+ /* @__PURE__ */ e(a.Item, { xs: 4, children: /* @__PURE__ */ i(n.Root, { width: "100%", hint: t("page.settings.form.gqlAuth.hint"), children: [
248
+ /* @__PURE__ */ e(n.Label, { children: t("page.settings.form.gqlAuth.label") }),
249
+ /* @__PURE__ */ e(
250
+ N,
251
+ {
252
+ name: "gqlAuthEnabled",
253
+ checked: r.gqlAuthEnabled,
254
+ onChange: s,
255
+ onLabel: t("components.toogle.enabled"),
256
+ offLabel: t("components.toogle.disabled"),
257
+ width: "100%"
258
+ }
259
+ ),
260
+ /* @__PURE__ */ e(n.Hint, {})
261
+ ] }) })
262
+ ] })
263
+ ] }),
264
+ /* @__PURE__ */ i(p, { ...C, children: [
265
+ /* @__PURE__ */ e(m, { variant: "delta", as: "h2", children: t("page.settings.section.client") }),
266
+ /* @__PURE__ */ i(a.Root, { gap: 4, marginTop: 4, width: "100%", children: [
267
+ /* @__PURE__ */ e(a.Item, { xs: 4, children: /* @__PURE__ */ i(n.Root, { width: "100%", hint: t("page.settings.form.client.url.hint"), children: [
268
+ /* @__PURE__ */ e(n.Label, { children: t("page.settings.form.client.url.label") }),
269
+ /* @__PURE__ */ e(n.Input, { name: "clientUrl", onChange: s }),
270
+ /* @__PURE__ */ e(n.Hint, {})
271
+ ] }) }),
272
+ /* @__PURE__ */ e(a.Item, { xs: 4, children: /* @__PURE__ */ i(n.Root, { width: "100%", hint: t("page.settings.form.client.email.hint"), children: [
273
+ /* @__PURE__ */ e(n.Label, { children: t("page.settings.form.client.email.label") }),
274
+ /* @__PURE__ */ e(n.Input, { name: "clientEmail", onChange: s }),
275
+ /* @__PURE__ */ e(n.Hint, {})
276
+ ] }) }),
277
+ /* @__PURE__ */ e(a.Item, { xs: 4, children: /* @__PURE__ */ i(
278
+ n.Root,
279
+ {
280
+ width: "100%",
281
+ hint: t("page.settings.form.moderatorRoles.hint"),
282
+ children: [
283
+ /* @__PURE__ */ e(n.Label, { children: t("page.settings.form.moderatorRoles.label") }),
284
+ /* @__PURE__ */ e(
285
+ x,
286
+ {
287
+ withTags: !0,
288
+ placeholder: t("page.settings.form.moderatorRoles.placeholder"),
289
+ name: "enabledCollections",
290
+ value: r.moderatorRoles,
291
+ onChange: (o) => {
292
+ s("moderatorRoles", o);
293
+ },
294
+ children: L.data.map((o) => /* @__PURE__ */ e(T, { value: o.code, children: o.name }, o.code))
295
+ }
296
+ ),
297
+ /* @__PURE__ */ e(n.Hint, {})
298
+ ]
299
+ }
300
+ ) })
301
+ ] })
302
+ ] }),
303
+ /* @__PURE__ */ e(P, { condition: u, children: /* @__PURE__ */ e(p, { ...C, children: /* @__PURE__ */ i(q, { gap: 4, direction: "column", alignItems: "flex-start", children: [
304
+ /* @__PURE__ */ i(q, { gap: 2, direction: "column", alignItems: "flex-start", children: [
305
+ /* @__PURE__ */ e(m, { variant: "delta", as: "h2", children: t("page.settings.section.restore") }),
306
+ /* @__PURE__ */ e(m, { variant: "pi", as: "h4", children: t("page.settings.section.restore.subtitle") })
307
+ ] }),
308
+ /* @__PURE__ */ e(
309
+ be,
310
+ {
311
+ Trigger: ({ onClick: o }) => /* @__PURE__ */ e(
312
+ I,
313
+ {
314
+ variant: "danger-light",
315
+ startIcon: /* @__PURE__ */ e(Q, {}),
316
+ onClick: o,
317
+ children: t("page.settings.actions.restore")
318
+ }
319
+ ),
320
+ onConfirm: G.mutate,
321
+ title: t("page.settings.actions.restore.confirmation.header"),
322
+ labelConfirm: t("page.settings.actions.restore.confirmation.button.confirm"),
323
+ iconConfirm: /* @__PURE__ */ e(Q, {}),
324
+ children: t("page.settings.actions.restore.confirmation.description")
325
+ }
326
+ )
327
+ ] }) }) })
328
+ ] })
329
+ }
330
+ )
331
+ ] })
332
+ ] })
333
+ ] });
334
+ };
335
+ new pe();
336
+ const Pe = () => /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(Le, {}) });
337
+ export {
338
+ Pe as default
339
+ };