strapi-plugin-comments 3.0.7-beta.1 → 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.
@@ -1,50 +1,50 @@
1
- import { jsx as e, Fragment as O, jsxs as i } from "react/jsx-runtime";
2
- import { a1 as oe, e as I, f as re, B as p, a2 as ae, F as q, T as m, Z as a, m as n, a3 as x, a4 as T, a5 as y, a6 as se, a7 as B, a8 as N } from "./index-D9B514y5.mjs";
3
- import { useTracking as le, useNotification as ce, Page as Q, Layouts as W, Form as de } from "@strapi/strapi/admin";
4
- import { useMutation as A, useQuery as M, useQueryClient as ge, QueryClient as he } from "@tanstack/react-query";
5
- import { u as $, f as pe, a as me, g as t, l as j, e as ue } from "./index-BpDl_L4E.mjs";
6
- import { useMemo as be, useRef as fe, useState as ye, useCallback as D } from "react";
7
- import Se from "styled-components";
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
8
  const P = ({
9
- children: c,
9
+ children: d,
10
10
  condition: l
11
- }) => l ? /* @__PURE__ */ e(O, { children: c }) : null, we = (c = {}) => {
12
- const l = $(), S = A({
11
+ }) => l ? /* @__PURE__ */ e(U, { children: d }) : null, Re = (d = {}) => {
12
+ const l = $(), y = A({
13
13
  mutationFn: l.settings.update,
14
- onSuccess: c.updateSettingsMutationSuccess,
15
- onError: c.updateSettingsMutationError
16
- }), h = A({
14
+ onSuccess: d.updateSettingsMutationSuccess,
15
+ onError: d.updateSettingsMutationError
16
+ }), S = A({
17
17
  mutationFn: l.settings.restore,
18
- onSuccess: c.restoreSettingsMutationSuccess,
19
- onError: c.restoreSettingsMutationError
20
- }), w = A({
18
+ onSuccess: d.restoreSettingsMutationSuccess,
19
+ onError: d.restoreSettingsMutationError
20
+ }), h = A({
21
21
  mutationFn: l.settings.restart,
22
- onSuccess: c.restartStrapiMutationSuccess,
23
- onError: c.restartStrapiMutationError
24
- }), u = M({
22
+ onSuccess: d.restartStrapiMutationSuccess,
23
+ onError: d.restartStrapiMutationError
24
+ }), w = M({
25
25
  queryKey: l.config.getKey(),
26
26
  queryFn: l.config.query
27
- }), b = M({
27
+ }), u = M({
28
28
  queryKey: l.contentTypeBuilder.all.getKey(),
29
29
  queryFn: l.contentTypeBuilder.all.query
30
- }), f = M({
30
+ }), b = M({
31
31
  queryKey: l.roles.getKey(),
32
32
  queryFn: l.roles.query
33
33
  });
34
- return be(() => ({
35
- config: u,
36
- collectionTypes: b,
37
- roles: f,
38
- restoreSettingsMutation: h,
39
- updateSettingsMutation: S,
40
- restartStrapiMutation: w
34
+ return fe(() => ({
35
+ config: w,
36
+ collectionTypes: u,
37
+ roles: b,
38
+ restoreSettingsMutation: S,
39
+ updateSettingsMutation: y,
40
+ restartStrapiMutation: h
41
41
  }), [
42
- u,
43
- f,
42
+ w,
44
43
  b,
45
- h,
44
+ u,
46
45
  S,
47
- w
46
+ y,
47
+ h
48
48
  ]);
49
49
  }, C = {
50
50
  background: "neutral0",
@@ -52,25 +52,24 @@ const P = ({
52
52
  shadow: "filterShadow",
53
53
  padding: 6,
54
54
  width: "100%"
55
- }, Re = Se(oe)(() => ({
55
+ }, Ce = we(le)(() => ({
56
56
  "[role]": {
57
57
  flexDirection: "column"
58
58
  }
59
- })), Ce = () => {
60
- le();
61
- const c = fe(null), { toggleNotification: l } = ce(), [S, h] = ye(!1), { isLoadingForPermissions: w, canSettingsChange: u } = me(), b = ge(), f = $(), {
62
- config: d,
63
- collectionTypes: v,
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,
64
63
  roles: L,
65
- restoreSettingsMutation: U,
66
- updateSettingsMutation: k,
67
- restartStrapiMutation: G
68
- } = we({
64
+ restoreSettingsMutation: G,
65
+ updateSettingsMutation: E,
66
+ restartStrapiMutation: V
67
+ } = Re({
69
68
  restoreSettingsMutationSuccess: () => {
70
69
  b.invalidateQueries({
71
- queryKey: f.config.getKey(),
70
+ queryKey: v.config.getKey(),
72
71
  exact: !1
73
- }), h(!0), l({
72
+ }), h(!0), y({
74
73
  message: t("page.settings.actions.restore.success"),
75
74
  type: "success"
76
75
  });
@@ -80,60 +79,60 @@ const P = ({
80
79
  },
81
80
  updateSettingsMutationSuccess: () => {
82
81
  b.invalidateQueries({
83
- queryKey: f.config.getKey(),
82
+ queryKey: v.config.getKey(),
84
83
  exact: !1
85
84
  }), h(!0);
86
85
  }
87
- }), V = D(() => {
88
- c.current?.requestSubmit();
89
- }, []), Z = D((r) => {
90
- k.mutate({
86
+ }), Z = O(() => {
87
+ l.current?.requestSubmit();
88
+ }, []), z = O((r) => {
89
+ E.mutate({
91
90
  ...r,
92
91
  blockedAuthorProps: r.blockedAuthorProps.split(",").map((s) => s.trim())
93
92
  });
94
- }, [k]);
95
- if (d.status !== "success" || v.status !== "success" || L.status !== "success" || w)
93
+ }, [E]);
94
+ if (c.status !== "success" || k.status !== "success" || L.status !== "success" || w)
96
95
  return t("page.settings.loading");
97
- const F = v.data.filter((r) => r.uid.includes("api::")), z = d.data.enabledCollections.filter((r) => F.some((s) => s.uid === r)), J = j.isNil(d.data.badWords) ? !0 : d.data?.badWords, X = !!d.data.gql?.auth, Y = d.data.moderatorRoles.filter((r) => L.data.filter((s) => s.code === r)), _ = d.data.client?.url, ee = d.data.client?.contactEmail, te = d.data.blockedAuthorProps ?? [], ne = () => h(!1);
98
- return /* @__PURE__ */ i(O, { children: [
99
- /* @__PURE__ */ e(Q.Title, { children: "Comments - settings" }),
100
- /* @__PURE__ */ i(Q.Main, { children: [
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: [
101
100
  /* @__PURE__ */ e(
102
- W.Header,
101
+ j.Header,
103
102
  {
104
103
  title: t("page.settings.header.title"),
105
104
  subtitle: t("page.settings.header.description"),
106
105
  as: "h2",
107
- primaryAction: /* @__PURE__ */ e(P, { condition: u, children: /* @__PURE__ */ e(I, { type: "submit", startIcon: /* @__PURE__ */ e(re, {}), onClick: V, children: t("page.settings.actions.submit") }) })
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") }) })
108
107
  }
109
108
  ),
110
- /* @__PURE__ */ i(W.Content, { children: [
109
+ /* @__PURE__ */ i(j.Content, { children: [
111
110
  S && /* @__PURE__ */ e(p, { marginBottom: 4, children: /* @__PURE__ */ e(
112
- Re,
111
+ Ce,
113
112
  {
114
113
  closeLabel: t("page.settings.actions.restart.alert.cancel"),
115
114
  title: t("page.settings.actions.restart.alert.title"),
116
- onClose: ne,
117
- action: /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(I, { onClick: G.mutate, startIcon: /* @__PURE__ */ e(ae, {}), children: t("page.settings.actions.restart") }) }),
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") }) }),
118
117
  children: /* @__PURE__ */ e(p, { marginTop: 4, children: t("page.settings.actions.restart.alert.description") })
119
118
  }
120
119
  ) }),
121
120
  /* @__PURE__ */ e(
122
- de,
121
+ ge,
123
122
  {
124
123
  method: "POST",
125
- ref: c,
126
- onSubmit: Z,
124
+ ref: l,
125
+ onSubmit: z,
127
126
  initialValues: {
128
- enabledCollections: z,
129
- moderatorRoles: Y,
130
- badWords: J,
131
- clientEmail: ee,
132
- clientUrl: _,
133
- gqlAuthEnabled: X,
134
- approvalFlow: d.data.approvalFlow,
135
- entryLabel: d.data.entryLabel,
136
- blockedAuthorProps: te.join(", ")
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(", ")
137
136
  },
138
137
  children: ({ values: r, onChange: s }) => /* @__PURE__ */ i(q, { gap: 4, direction: "column", children: [
139
138
  /* @__PURE__ */ i(p, { ...C, children: [
@@ -157,13 +156,13 @@ const P = ({
157
156
  ] }) }),
158
157
  r.enabledCollections.length > 0 && /* @__PURE__ */ e(a.Item, { children: /* @__PURE__ */ i(a.Root, { gap: 4, width: "100%", children: [
159
158
  /* @__PURE__ */ e(a.Item, { children: /* @__PURE__ */ e(m, { children: t("page.settings.form.contentTypesSettings.label") }) }),
160
- /* @__PURE__ */ e(a.Item, { children: /* @__PURE__ */ e(y.Root, { style: { width: "100%" }, children: j.orderBy(r.enabledCollections).map((o) => {
161
- const E = F.find((R) => R.uid === o);
162
- if (E) {
163
- const { schema: { displayName: R, attributes: H } } = E, K = Object.keys(H).filter((g) => H[g].type === "string");
164
- return /* @__PURE__ */ i(y.Item, { value: o, children: [
165
- /* @__PURE__ */ e(y.Header, { children: /* @__PURE__ */ e(y.Trigger, { children: /* @__PURE__ */ e(m, { variant: "epsilon", as: "h3", children: R }) }) }),
166
- /* @__PURE__ */ e(y.Content, { children: /* @__PURE__ */ i(a.Root, { padding: 6, gap: 4, children: [
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: [
167
166
  /* @__PURE__ */ e(a.Item, { children: /* @__PURE__ */ i(
168
167
  n.Root,
169
168
  {
@@ -182,7 +181,7 @@ const P = ({
182
181
  offLabel: t("components.toogle.disabled"),
183
182
  checked: r.approvalFlow.includes(o),
184
183
  onCheckedChange: (g) => {
185
- s("approvalFlow", g ? [...r.approvalFlow, o] : r.approvalFlow.filter((ie) => ie !== o));
184
+ s("approvalFlow", g ? [...r.approvalFlow, o] : r.approvalFlow.filter((oe) => oe !== o));
186
185
  }
187
186
  }
188
187
  ),
@@ -190,7 +189,7 @@ const P = ({
190
189
  ]
191
190
  }
192
191
  ) }),
193
- /* @__PURE__ */ e(P, { condition: K.length > 0, children: /* @__PURE__ */ e(a.Item, { children: /* @__PURE__ */ i(
192
+ /* @__PURE__ */ e(P, { condition: B.length > 0, children: /* @__PURE__ */ e(a.Item, { children: /* @__PURE__ */ i(
194
193
  n.Root,
195
194
  {
196
195
  width: "100%",
@@ -207,7 +206,7 @@ const P = ({
207
206
  onChange: (g) => {
208
207
  s("entryLabel", { ...r.entryLabel, [o]: g });
209
208
  },
210
- children: K.map((g) => /* @__PURE__ */ e(T, { value: g, children: g }, g))
209
+ children: B.map((g) => /* @__PURE__ */ e(T, { value: g, children: g }, g))
211
210
  }
212
211
  ),
213
212
  /* @__PURE__ */ e(n.Hint, {})
@@ -228,7 +227,7 @@ const P = ({
228
227
  /* @__PURE__ */ e(a.Item, { xs: 4, children: /* @__PURE__ */ i(n.Root, { width: "100%", hint: t("page.settings.form.enabledCollections.hint"), children: [
229
228
  /* @__PURE__ */ e(n.Label, { htmlFor: "enabledCollections", children: t("page.settings.form.enabledCollections.label") }),
230
229
  /* @__PURE__ */ e(
231
- B,
230
+ N,
232
231
  {
233
232
  name: "badWords",
234
233
  checked: r.badWords,
@@ -248,7 +247,7 @@ const P = ({
248
247
  /* @__PURE__ */ e(a.Item, { xs: 4, children: /* @__PURE__ */ i(n.Root, { width: "100%", hint: t("page.settings.form.gqlAuth.hint"), children: [
249
248
  /* @__PURE__ */ e(n.Label, { children: t("page.settings.form.gqlAuth.label") }),
250
249
  /* @__PURE__ */ e(
251
- B,
250
+ N,
252
251
  {
253
252
  name: "gqlAuthEnabled",
254
253
  checked: r.gqlAuthEnabled,
@@ -307,21 +306,21 @@ const P = ({
307
306
  /* @__PURE__ */ e(m, { variant: "pi", as: "h4", children: t("page.settings.section.restore.subtitle") })
308
307
  ] }),
309
308
  /* @__PURE__ */ e(
310
- ue,
309
+ be,
311
310
  {
312
311
  Trigger: ({ onClick: o }) => /* @__PURE__ */ e(
313
312
  I,
314
313
  {
315
314
  variant: "danger-light",
316
- startIcon: /* @__PURE__ */ e(N, {}),
315
+ startIcon: /* @__PURE__ */ e(Q, {}),
317
316
  onClick: o,
318
317
  children: t("page.settings.actions.restore")
319
318
  }
320
319
  ),
321
- onConfirm: U.mutate,
320
+ onConfirm: G.mutate,
322
321
  title: t("page.settings.actions.restore.confirmation.header"),
323
322
  labelConfirm: t("page.settings.actions.restore.confirmation.button.confirm"),
324
- iconConfirm: /* @__PURE__ */ e(N, {}),
323
+ iconConfirm: /* @__PURE__ */ e(Q, {}),
325
324
  children: t("page.settings.actions.restore.confirmation.description")
326
325
  }
327
326
  )
@@ -333,8 +332,8 @@ const P = ({
333
332
  ] })
334
333
  ] });
335
334
  };
336
- new he();
337
- const Me = () => /* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(Ce, {}) });
335
+ new pe();
336
+ const Pe = () => /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(Le, {}) });
338
337
  export {
339
- Me as default
338
+ Pe as default
340
339
  };