strapi-plugin-comments 3.0.7 → 3.0.9
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 +21 -3
- package/dist/_chunks/{en-DCsHR-ue.mjs → en-BtJqEJGe.mjs} +2 -0
- package/dist/_chunks/en-CNvRvaLL.js +1 -0
- package/dist/_chunks/fr-BIrOYxvf.js +1 -0
- package/dist/_chunks/{fr-DC9DGoT1.mjs → fr-Dx7zbWW0.mjs} +2 -0
- package/dist/_chunks/index-B8Jogmi4.mjs +2026 -0
- package/dist/_chunks/index-BNZz69rC.js +2175 -0
- package/dist/_chunks/{index-DGKkpdmq.mjs → index-BbHOeszY.mjs} +6261 -6181
- package/dist/_chunks/index-Bfn0RC18.js +18 -0
- package/dist/_chunks/{index-CF4vndXw.mjs → index-Bi2NddA5.mjs} +14045 -14195
- package/dist/_chunks/{index-CwHmRIcs.mjs → index-D56DrIq3.mjs} +70 -68
- package/dist/_chunks/index-DiQHdq_2.js +1 -0
- package/dist/_chunks/{index-YPqaQ-iX.js → index-gJOowHIB.js} +30 -30
- package/dist/_chunks/pl-DoXe0BV9.js +1 -0
- package/dist/_chunks/{pl-DZiVsGIg.mjs → pl-_wkGtdQj.mjs} +2 -0
- package/dist/_chunks/{pt-BR-CW4ugNZj.mjs → pt-BR-Bx1qSZ0Z.mjs} +2 -0
- package/dist/_chunks/pt-BR-CLvbSGaH.js +1 -0
- package/dist/_chunks/{ru-CfKjYq3M.mjs → ru-BuUj7OWH.mjs} +2 -0
- package/dist/_chunks/ru-eLIDfsd3.js +1 -0
- package/dist/_chunks/tr-BX-_IBUR.js +1 -0
- package/dist/_chunks/{tr-BQR2hK7S.mjs → tr-CloK8CbW.mjs} +2 -0
- package/dist/_chunks/zh-Hans-DusBjCtd.js +1 -0
- package/dist/_chunks/{zh-Hans-lNqOn5JS.mjs → zh-Hans-Isi-yCnI.mjs} +2 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/api/schemas.d.ts +5 -5
- package/dist/admin/src/components/CommentStatusFilters/index.d.ts +6 -0
- package/dist/admin/src/hooks/useCommentsAll.d.ts +2 -2
- package/dist/admin/src/translations/en.d.ts +2 -0
- package/dist/admin/src/translations/fr.d.ts +2 -0
- package/dist/admin/src/translations/pl.d.ts +2 -0
- package/dist/admin/src/translations/pt-BR.d.ts +2 -0
- package/dist/admin/src/translations/ru.d.ts +2 -0
- package/dist/admin/src/translations/tr.d.ts +2 -0
- package/dist/admin/src/translations/zh-Hans.d.ts +2 -0
- package/dist/server/index.js +28 -28
- package/dist/server/index.mjs +1591 -1560
- package/dist/server/src/@types/controllers.d.ts +1 -0
- package/dist/server/src/controllers/index.d.ts +66 -0
- package/dist/server/src/graphql/getResolversConfig.d.ts +4 -4
- package/dist/server/src/index.d.ts +572 -1
- package/dist/server/src/services/admin/admin.service.d.ts +68 -1
- package/dist/server/src/services/admin/utils.d.ts +1 -8
- package/dist/server/src/services/client.service.d.ts +67 -0
- package/dist/server/src/services/common.service.d.ts +1 -0
- package/dist/server/src/services/index.d.ts +506 -1
- package/dist/server/src/validators/api/controllers/admin.controller.validator.d.ts +1503 -1
- package/dist/server/src/validators/api/controllers/client.controller.validator.d.ts +66 -0
- package/dist/server/src/validators/utils.d.ts +1235 -1
- package/package.json +10 -10
- package/dist/_chunks/en-CgUbWvmQ.js +0 -1
- package/dist/_chunks/fr-BXfxIXq1.js +0 -1
- package/dist/_chunks/index-Bpnqk6JP.js +0 -1
- package/dist/_chunks/index-CFIjHfkZ.js +0 -2153
- package/dist/_chunks/index-CHDv123w.js +0 -44
- package/dist/_chunks/index-pLgOJz-6.mjs +0 -5718
- package/dist/_chunks/pl-Bl4yP3sZ.js +0 -1
- package/dist/_chunks/pt-BR-D9T5g0JT.js +0 -1
- package/dist/_chunks/ru-DIZ4pV4l.js +0 -1
- package/dist/_chunks/tr-Dl2hdLCx.js +0 -1
- package/dist/_chunks/zh-Hans-BZhnqfei.js +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsx as e, Fragment as
|
|
2
|
-
import { e as
|
|
3
|
-
import { useTracking as ce, useNotification as de, Page as W, Layouts as
|
|
1
|
+
import { jsx as e, Fragment as O, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { l as j, e as L, f as ae, B as p, a3 as re, F as q, T as m, $ as r, o as n, a4 as T, a5 as x, a6 as f, a7 as se, a8 as N, a9 as Q, aa as le } from "./index-Bi2NddA5.mjs";
|
|
3
|
+
import { useTracking as ce, useNotification as de, Page as W, Layouts as D, Form as ge } from "@strapi/strapi/admin";
|
|
4
4
|
import { useMutation as A, useQuery as M, useQueryClient as he, QueryClient as pe } from "@tanstack/react-query";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import we from "
|
|
5
|
+
import { useMemo as me, useRef as ue, useState as be, useCallback as $ } from "react";
|
|
6
|
+
import fe from "styled-components";
|
|
7
|
+
import { u as U, e as ye, a as Se, g as t, d as we } from "./index-B8Jogmi4.mjs";
|
|
8
8
|
const P = ({
|
|
9
9
|
children: d,
|
|
10
10
|
condition: l
|
|
11
|
-
}) => l ? /* @__PURE__ */ e(
|
|
12
|
-
const l =
|
|
11
|
+
}) => l ? /* @__PURE__ */ e(O, { children: d }) : null, Re = (d = {}) => {
|
|
12
|
+
const l = U(), y = A({
|
|
13
13
|
mutationFn: l.settings.update,
|
|
14
14
|
onSuccess: d.updateSettingsMutationSuccess,
|
|
15
15
|
onError: d.updateSettingsMutationError
|
|
@@ -31,7 +31,7 @@ const P = ({
|
|
|
31
31
|
queryKey: l.roles.getKey(),
|
|
32
32
|
queryFn: l.roles.query
|
|
33
33
|
});
|
|
34
|
-
return
|
|
34
|
+
return me(() => ({
|
|
35
35
|
config: w,
|
|
36
36
|
collectionTypes: u,
|
|
37
37
|
roles: b,
|
|
@@ -46,21 +46,21 @@ const P = ({
|
|
|
46
46
|
y,
|
|
47
47
|
h
|
|
48
48
|
]);
|
|
49
|
-
},
|
|
49
|
+
}, I = {
|
|
50
50
|
background: "neutral0",
|
|
51
51
|
hasRadius: !0,
|
|
52
52
|
shadow: "filterShadow",
|
|
53
53
|
padding: 6,
|
|
54
54
|
width: "100%"
|
|
55
|
-
},
|
|
55
|
+
}, Ie = fe(le)(() => ({
|
|
56
56
|
"[role]": {
|
|
57
57
|
flexDirection: "column"
|
|
58
58
|
}
|
|
59
|
-
})),
|
|
60
|
-
const { trackUsage: d } = ce(), l =
|
|
59
|
+
})), Ce = () => {
|
|
60
|
+
const { trackUsage: d } = ce(), l = ue(null), { toggleNotification: y } = de(), [S, h] = be(!1), { isLoadingForPermissions: w, canSettingsChange: u } = Se(), b = he(), v = U(), {
|
|
61
61
|
config: c,
|
|
62
62
|
collectionTypes: k,
|
|
63
|
-
roles:
|
|
63
|
+
roles: C,
|
|
64
64
|
restoreSettingsMutation: G,
|
|
65
65
|
updateSettingsMutation: E,
|
|
66
66
|
restartStrapiMutation: V
|
|
@@ -83,37 +83,37 @@ const P = ({
|
|
|
83
83
|
exact: !1
|
|
84
84
|
}), h(!0);
|
|
85
85
|
}
|
|
86
|
-
}),
|
|
86
|
+
}), z = $(() => {
|
|
87
87
|
l.current?.requestSubmit();
|
|
88
|
-
}, []),
|
|
88
|
+
}, []), J = $((a) => {
|
|
89
89
|
E.mutate({
|
|
90
|
-
...
|
|
91
|
-
blockedAuthorProps:
|
|
90
|
+
...a,
|
|
91
|
+
blockedAuthorProps: a.blockedAuthorProps.split(",").map((s) => s.trim())
|
|
92
92
|
});
|
|
93
93
|
}, [E]);
|
|
94
|
-
if (c.status !== "success" || k.status !== "success" ||
|
|
94
|
+
if (c.status !== "success" || k.status !== "success" || C.status !== "success" || w)
|
|
95
95
|
return t("page.settings.loading");
|
|
96
|
-
const F = k.data.filter((
|
|
97
|
-
return /* @__PURE__ */ i(
|
|
96
|
+
const F = k.data.filter((a) => a.uid.includes("api::")), X = c.data.enabledCollections.filter((a) => F.some((s) => s.uid === a)), Y = j.isNil(c.data.badWords) ? !0 : c.data?.badWords, Z = !!c.data.gql?.auth, _ = c.data.moderatorRoles.filter((a) => C.data.filter((s) => s.code === a)), ee = c.data.client?.url, te = c.data.client?.contactEmail, ne = c.data.blockedAuthorProps ?? [], ie = () => h(!1);
|
|
97
|
+
return /* @__PURE__ */ i(O, { children: [
|
|
98
98
|
/* @__PURE__ */ e(W.Title, { children: "Comments - settings" }),
|
|
99
99
|
/* @__PURE__ */ i(W.Main, { children: [
|
|
100
100
|
/* @__PURE__ */ e(
|
|
101
|
-
|
|
101
|
+
D.Header,
|
|
102
102
|
{
|
|
103
103
|
title: t("page.settings.header.title"),
|
|
104
104
|
subtitle: t("page.settings.header.description"),
|
|
105
105
|
as: "h2",
|
|
106
|
-
primaryAction: /* @__PURE__ */ e(P, { condition: u, children: /* @__PURE__ */ e(
|
|
106
|
+
primaryAction: /* @__PURE__ */ e(P, { condition: u, children: /* @__PURE__ */ e(L, { type: "submit", startIcon: /* @__PURE__ */ e(ae, {}), onClick: z, children: t("page.settings.actions.submit") }) })
|
|
107
107
|
}
|
|
108
108
|
),
|
|
109
|
-
/* @__PURE__ */ i(
|
|
109
|
+
/* @__PURE__ */ i(D.Content, { children: [
|
|
110
110
|
S && /* @__PURE__ */ e(p, { marginBottom: 4, children: /* @__PURE__ */ e(
|
|
111
|
-
|
|
111
|
+
Ie,
|
|
112
112
|
{
|
|
113
113
|
closeLabel: t("page.settings.actions.restart.alert.cancel"),
|
|
114
114
|
title: t("page.settings.actions.restart.alert.title"),
|
|
115
115
|
onClose: ie,
|
|
116
|
-
action: /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(
|
|
116
|
+
action: /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(L, { onClick: V.mutate, startIcon: /* @__PURE__ */ e(re, {}), children: t("page.settings.actions.restart") }) }),
|
|
117
117
|
children: /* @__PURE__ */ e(p, { marginTop: 4, children: t("page.settings.actions.restart.alert.description") })
|
|
118
118
|
}
|
|
119
119
|
) }),
|
|
@@ -121,49 +121,51 @@ const P = ({
|
|
|
121
121
|
ge,
|
|
122
122
|
{
|
|
123
123
|
method: "POST",
|
|
124
|
+
width: "auto",
|
|
125
|
+
height: "auto",
|
|
124
126
|
ref: l,
|
|
125
|
-
onSubmit:
|
|
127
|
+
onSubmit: J,
|
|
126
128
|
initialValues: {
|
|
127
|
-
enabledCollections:
|
|
129
|
+
enabledCollections: X,
|
|
128
130
|
moderatorRoles: _,
|
|
129
|
-
badWords:
|
|
131
|
+
badWords: Y,
|
|
130
132
|
clientEmail: te,
|
|
131
133
|
clientUrl: ee,
|
|
132
|
-
gqlAuthEnabled:
|
|
134
|
+
gqlAuthEnabled: Z,
|
|
133
135
|
approvalFlow: c.data.approvalFlow,
|
|
134
136
|
entryLabel: c.data.entryLabel,
|
|
135
137
|
blockedAuthorProps: ne.join(", ")
|
|
136
138
|
},
|
|
137
|
-
children: ({ values:
|
|
138
|
-
/* @__PURE__ */ i(p, { ...
|
|
139
|
+
children: ({ values: a, onChange: s }) => /* @__PURE__ */ i(q, { gap: 4, direction: "column", children: [
|
|
140
|
+
/* @__PURE__ */ i(p, { ...I, children: [
|
|
139
141
|
/* @__PURE__ */ e(m, { variant: "delta", as: "h2", children: t("page.settings.section.general") }),
|
|
140
|
-
/* @__PURE__ */ i(
|
|
141
|
-
/* @__PURE__ */ e(
|
|
142
|
+
/* @__PURE__ */ i(r.Root, { gap: 4, marginTop: 4, width: "100%", children: [
|
|
143
|
+
/* @__PURE__ */ e(r.Item, { xs: 12, children: /* @__PURE__ */ i(n.Root, { width: "100%", hint: t("page.settings.form.enabledCollections.hint"), children: [
|
|
142
144
|
/* @__PURE__ */ e(n.Label, { htmlFor: "enabledCollections", children: t("page.settings.form.enabledCollections.label") }),
|
|
143
145
|
/* @__PURE__ */ e(
|
|
144
|
-
|
|
146
|
+
T,
|
|
145
147
|
{
|
|
146
148
|
withTags: !0,
|
|
147
149
|
name: "enabledCollections",
|
|
148
|
-
value:
|
|
150
|
+
value: a.enabledCollections,
|
|
149
151
|
onChange: (o) => {
|
|
150
152
|
s("enabledCollections", o);
|
|
151
153
|
},
|
|
152
|
-
children: F.map((o) => /* @__PURE__ */ e(
|
|
154
|
+
children: F.map((o) => /* @__PURE__ */ e(x, { value: o.uid, children: o.schema.displayName }, o.uid))
|
|
153
155
|
}
|
|
154
156
|
),
|
|
155
157
|
/* @__PURE__ */ e(n.Hint, {})
|
|
156
158
|
] }) }),
|
|
157
|
-
|
|
158
|
-
/* @__PURE__ */ e(
|
|
159
|
-
/* @__PURE__ */ e(
|
|
159
|
+
a.enabledCollections.length > 0 && /* @__PURE__ */ e(r.Item, { children: /* @__PURE__ */ i(r.Root, { gap: 4, width: "100%", children: [
|
|
160
|
+
/* @__PURE__ */ e(r.Item, { children: /* @__PURE__ */ e(m, { children: t("page.settings.form.contentTypesSettings.label") }) }),
|
|
161
|
+
/* @__PURE__ */ e(r.Item, { children: /* @__PURE__ */ e(f.Root, { style: { width: "100%" }, children: j.orderBy(a.enabledCollections).map((o) => {
|
|
160
162
|
const H = F.find((R) => R.uid === o);
|
|
161
163
|
if (H) {
|
|
162
164
|
const { schema: { displayName: R, attributes: K } } = H, B = Object.keys(K).filter((g) => K[g].type === "string");
|
|
163
165
|
return /* @__PURE__ */ i(f.Item, { value: o, children: [
|
|
164
166
|
/* @__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(
|
|
166
|
-
/* @__PURE__ */ e(
|
|
167
|
+
/* @__PURE__ */ e(f.Content, { children: /* @__PURE__ */ i(r.Root, { padding: 6, gap: 4, children: [
|
|
168
|
+
/* @__PURE__ */ e(r.Item, { children: /* @__PURE__ */ i(
|
|
167
169
|
n.Root,
|
|
168
170
|
{
|
|
169
171
|
width: "100%",
|
|
@@ -179,9 +181,9 @@ const P = ({
|
|
|
179
181
|
visibleLabels: !0,
|
|
180
182
|
onLabel: t("components.toogle.enabled"),
|
|
181
183
|
offLabel: t("components.toogle.disabled"),
|
|
182
|
-
checked:
|
|
184
|
+
checked: a.approvalFlow.includes(o),
|
|
183
185
|
onCheckedChange: (g) => {
|
|
184
|
-
s("approvalFlow", g ? [...
|
|
186
|
+
s("approvalFlow", g ? [...a.approvalFlow, o] : a.approvalFlow.filter((oe) => oe !== o));
|
|
185
187
|
}
|
|
186
188
|
}
|
|
187
189
|
),
|
|
@@ -189,7 +191,7 @@ const P = ({
|
|
|
189
191
|
]
|
|
190
192
|
}
|
|
191
193
|
) }),
|
|
192
|
-
/* @__PURE__ */ e(P, { condition: B.length > 0, children: /* @__PURE__ */ e(
|
|
194
|
+
/* @__PURE__ */ e(P, { condition: B.length > 0, children: /* @__PURE__ */ e(r.Item, { children: /* @__PURE__ */ i(
|
|
193
195
|
n.Root,
|
|
194
196
|
{
|
|
195
197
|
width: "100%",
|
|
@@ -197,16 +199,16 @@ const P = ({
|
|
|
197
199
|
children: [
|
|
198
200
|
/* @__PURE__ */ e(n.Label, { children: t("page.settings.form.entryLabel.label") }),
|
|
199
201
|
/* @__PURE__ */ e(
|
|
200
|
-
|
|
202
|
+
T,
|
|
201
203
|
{
|
|
202
204
|
withTags: !0,
|
|
203
205
|
placeholder: t("page.settings.form.entryLabel.placeholder"),
|
|
204
206
|
name: "enabledCollections",
|
|
205
|
-
value:
|
|
207
|
+
value: a.entryLabel[o] ?? [],
|
|
206
208
|
onChange: (g) => {
|
|
207
|
-
s("entryLabel", { ...
|
|
209
|
+
s("entryLabel", { ...a.entryLabel, [o]: g });
|
|
208
210
|
},
|
|
209
|
-
children: B.map((g) => /* @__PURE__ */ e(
|
|
211
|
+
children: B.map((g) => /* @__PURE__ */ e(x, { value: g, children: g }, g))
|
|
210
212
|
}
|
|
211
213
|
),
|
|
212
214
|
/* @__PURE__ */ e(n.Hint, {})
|
|
@@ -221,16 +223,16 @@ const P = ({
|
|
|
221
223
|
] }) })
|
|
222
224
|
] })
|
|
223
225
|
] }),
|
|
224
|
-
/* @__PURE__ */ i(p, { ...
|
|
226
|
+
/* @__PURE__ */ i(p, { ...I, children: [
|
|
225
227
|
/* @__PURE__ */ e(m, { variant: "delta", as: "h2", children: t("page.settings.section.additional") }),
|
|
226
|
-
/* @__PURE__ */ i(
|
|
227
|
-
/* @__PURE__ */ e(
|
|
228
|
+
/* @__PURE__ */ i(r.Root, { gap: 4, marginTop: 4, width: "100%", children: [
|
|
229
|
+
/* @__PURE__ */ e(r.Item, { xs: 4, alignItems: "start", children: /* @__PURE__ */ i(n.Root, { width: "100%", hint: t("page.settings.form.enabledCollections.hint"), children: [
|
|
228
230
|
/* @__PURE__ */ e(n.Label, { htmlFor: "enabledCollections", children: t("page.settings.form.enabledCollections.label") }),
|
|
229
231
|
/* @__PURE__ */ e(
|
|
230
232
|
N,
|
|
231
233
|
{
|
|
232
234
|
name: "badWords",
|
|
233
|
-
checked:
|
|
235
|
+
checked: a.badWords,
|
|
234
236
|
onChange: s,
|
|
235
237
|
onLabel: t("components.toogle.enabled"),
|
|
236
238
|
offLabel: t("components.toogle.disabled"),
|
|
@@ -239,18 +241,18 @@ const P = ({
|
|
|
239
241
|
),
|
|
240
242
|
/* @__PURE__ */ e(n.Hint, {})
|
|
241
243
|
] }) }),
|
|
242
|
-
/* @__PURE__ */ e(
|
|
244
|
+
/* @__PURE__ */ e(r.Item, { xs: 4, alignItems: "start", children: /* @__PURE__ */ i(n.Root, { width: "100%", hint: t("page.settings.form.author.blockedProps.hint"), children: [
|
|
243
245
|
/* @__PURE__ */ e(n.Label, { htmlFor: "enabledCollections", children: t("page.settings.form.author.blockedProps.label") }),
|
|
244
246
|
/* @__PURE__ */ e(n.Input, { name: "blockedProps", onChange: s }),
|
|
245
247
|
/* @__PURE__ */ e(n.Hint, {})
|
|
246
248
|
] }) }),
|
|
247
|
-
/* @__PURE__ */ e(
|
|
249
|
+
/* @__PURE__ */ e(r.Item, { xs: 4, alignItems: "start", children: /* @__PURE__ */ i(n.Root, { width: "100%", hint: t("page.settings.form.gqlAuth.hint"), children: [
|
|
248
250
|
/* @__PURE__ */ e(n.Label, { children: t("page.settings.form.gqlAuth.label") }),
|
|
249
251
|
/* @__PURE__ */ e(
|
|
250
252
|
N,
|
|
251
253
|
{
|
|
252
254
|
name: "gqlAuthEnabled",
|
|
253
|
-
checked:
|
|
255
|
+
checked: a.gqlAuthEnabled,
|
|
254
256
|
onChange: s,
|
|
255
257
|
onLabel: t("components.toogle.enabled"),
|
|
256
258
|
offLabel: t("components.toogle.disabled"),
|
|
@@ -261,20 +263,20 @@ const P = ({
|
|
|
261
263
|
] }) })
|
|
262
264
|
] })
|
|
263
265
|
] }),
|
|
264
|
-
/* @__PURE__ */ i(p, { ...
|
|
266
|
+
/* @__PURE__ */ i(p, { ...I, children: [
|
|
265
267
|
/* @__PURE__ */ e(m, { variant: "delta", as: "h2", children: t("page.settings.section.client") }),
|
|
266
|
-
/* @__PURE__ */ i(
|
|
267
|
-
/* @__PURE__ */ e(
|
|
268
|
+
/* @__PURE__ */ i(r.Root, { gap: 4, marginTop: 4, width: "100%", children: [
|
|
269
|
+
/* @__PURE__ */ e(r.Item, { xs: 4, alignItems: "start", children: /* @__PURE__ */ i(n.Root, { width: "100%", hint: t("page.settings.form.client.url.hint"), children: [
|
|
268
270
|
/* @__PURE__ */ e(n.Label, { children: t("page.settings.form.client.url.label") }),
|
|
269
271
|
/* @__PURE__ */ e(n.Input, { name: "clientUrl", onChange: s }),
|
|
270
272
|
/* @__PURE__ */ e(n.Hint, {})
|
|
271
273
|
] }) }),
|
|
272
|
-
/* @__PURE__ */ e(
|
|
274
|
+
/* @__PURE__ */ e(r.Item, { xs: 4, alignItems: "start", children: /* @__PURE__ */ i(n.Root, { width: "100%", hint: t("page.settings.form.client.email.hint"), children: [
|
|
273
275
|
/* @__PURE__ */ e(n.Label, { children: t("page.settings.form.client.email.label") }),
|
|
274
276
|
/* @__PURE__ */ e(n.Input, { name: "clientEmail", onChange: s }),
|
|
275
277
|
/* @__PURE__ */ e(n.Hint, {})
|
|
276
278
|
] }) }),
|
|
277
|
-
/* @__PURE__ */ e(
|
|
279
|
+
/* @__PURE__ */ e(r.Item, { xs: 4, alignItems: "start", children: /* @__PURE__ */ i(
|
|
278
280
|
n.Root,
|
|
279
281
|
{
|
|
280
282
|
width: "100%",
|
|
@@ -282,16 +284,16 @@ const P = ({
|
|
|
282
284
|
children: [
|
|
283
285
|
/* @__PURE__ */ e(n.Label, { children: t("page.settings.form.moderatorRoles.label") }),
|
|
284
286
|
/* @__PURE__ */ e(
|
|
285
|
-
|
|
287
|
+
T,
|
|
286
288
|
{
|
|
287
289
|
withTags: !0,
|
|
288
290
|
placeholder: t("page.settings.form.moderatorRoles.placeholder"),
|
|
289
291
|
name: "enabledCollections",
|
|
290
|
-
value:
|
|
292
|
+
value: a.moderatorRoles,
|
|
291
293
|
onChange: (o) => {
|
|
292
294
|
s("moderatorRoles", o);
|
|
293
295
|
},
|
|
294
|
-
children:
|
|
296
|
+
children: C.data.map((o) => /* @__PURE__ */ e(x, { value: o.code, children: o.name }, o.code))
|
|
295
297
|
}
|
|
296
298
|
),
|
|
297
299
|
/* @__PURE__ */ e(n.Hint, {})
|
|
@@ -300,16 +302,16 @@ const P = ({
|
|
|
300
302
|
) })
|
|
301
303
|
] })
|
|
302
304
|
] }),
|
|
303
|
-
/* @__PURE__ */ e(P, { condition: u, children: /* @__PURE__ */ e(p, { ...
|
|
305
|
+
/* @__PURE__ */ e(P, { condition: u, children: /* @__PURE__ */ e(p, { ...I, children: /* @__PURE__ */ i(q, { gap: 4, direction: "column", alignItems: "flex-start", children: [
|
|
304
306
|
/* @__PURE__ */ i(q, { gap: 2, direction: "column", alignItems: "flex-start", children: [
|
|
305
307
|
/* @__PURE__ */ e(m, { variant: "delta", as: "h2", children: t("page.settings.section.restore") }),
|
|
306
308
|
/* @__PURE__ */ e(m, { variant: "pi", as: "h4", children: t("page.settings.section.restore.subtitle") })
|
|
307
309
|
] }),
|
|
308
310
|
/* @__PURE__ */ e(
|
|
309
|
-
|
|
311
|
+
we,
|
|
310
312
|
{
|
|
311
313
|
Trigger: ({ onClick: o }) => /* @__PURE__ */ e(
|
|
312
|
-
|
|
314
|
+
L,
|
|
313
315
|
{
|
|
314
316
|
variant: "danger-light",
|
|
315
317
|
startIcon: /* @__PURE__ */ e(Q, {}),
|
|
@@ -333,7 +335,7 @@ const P = ({
|
|
|
333
335
|
] });
|
|
334
336
|
};
|
|
335
337
|
new pe();
|
|
336
|
-
const Pe = () => /* @__PURE__ */ e(
|
|
338
|
+
const Pe = () => /* @__PURE__ */ e(ye, { children: /* @__PURE__ */ e(Ce, {}) });
|
|
337
339
|
export {
|
|
338
340
|
Pe as default
|
|
339
341
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-BNZz69rC.js"),h=require("@strapi/strapi/admin"),c=require("@tanstack/react-query"),m=require("react"),D=require("styled-components"),s=require("./index-Bfn0RC18.js"),N=r=>r&&r.__esModule?r:{default:r},W=N(D),S=({children:r,condition:a})=>a?e.jsx(e.Fragment,{children:r}):null,_=(r={})=>{const a=s.useAPI(),x=c.useMutation({mutationFn:a.settings.update,onSuccess:r.updateSettingsMutationSuccess,onError:r.updateSettingsMutationError}),j=c.useMutation({mutationFn:a.settings.restore,onSuccess:r.restoreSettingsMutationSuccess,onError:r.restoreSettingsMutationError}),g=c.useMutation({mutationFn:a.settings.restart,onSuccess:r.restartStrapiMutationSuccess,onError:r.restartStrapiMutationError}),b=c.useQuery({queryKey:a.config.getKey(),queryFn:a.config.query}),u=c.useQuery({queryKey:a.contentTypeBuilder.all.getKey(),queryFn:a.contentTypeBuilder.all.query}),p=c.useQuery({queryKey:a.roles.getKey(),queryFn:a.roles.query});return m.useMemo(()=>({config:b,collectionTypes:u,roles:p,restoreSettingsMutation:j,updateSettingsMutation:x,restartStrapiMutation:g}),[b,p,u,j,x,g])},y={background:"neutral0",hasRadius:!0,shadow:"filterShadow",padding:6,width:"100%"},U=W.default(t.Alert)(()=>({"[role]":{flexDirection:"column"}})),V=()=>{const{trackUsage:r}=h.useTracking(),a=m.useRef(null),{toggleNotification:x}=h.useNotification(),[j,g]=m.useState(!1),{isLoadingForPermissions:b,canSettingsChange:u}=s.usePermissions(),p=c.useQueryClient(),w=s.useAPI(),{config:l,collectionTypes:R,roles:M,restoreSettingsMutation:T,updateSettingsMutation:I,restartStrapiMutation:A}=_({restoreSettingsMutationSuccess:()=>{p.invalidateQueries({queryKey:w.config.getKey(),exact:!1}),g(!0),x({message:s.getMessage("page.settings.actions.restore.success"),type:"success"})},restartStrapiMutationSuccess:()=>{g(!1)},updateSettingsMutationSuccess:()=>{p.invalidateQueries({queryKey:w.config.getKey(),exact:!1}),g(!0)}}),P=m.useCallback(()=>{a.current?.requestSubmit()},[]),G=m.useCallback(n=>{I.mutate({...n,blockedAuthorProps:n.blockedAuthorProps.split(",").map(o=>o.trim())})},[I]);if(l.status!=="success"||R.status!=="success"||M.status!=="success"||b)return s.getMessage("page.settings.loading");const F=R.data.filter(n=>n.uid.includes("api::")),v=l.data.enabledCollections.filter(n=>F.some(o=>o.uid===n)),k=t.lodashExports.isNil(l.data.badWords)?!0:l.data?.badWords,B=!!l.data.gql?.auth,E=l.data.moderatorRoles.filter(n=>M.data.filter(o=>o.code===n)),H=l.data.client?.url,K=l.data.client?.contactEmail,Q=l.data.blockedAuthorProps??[],O=()=>g(!1);return e.jsxs(e.Fragment,{children:[e.jsx(h.Page.Title,{children:"Comments - settings"}),e.jsxs(h.Page.Main,{children:[e.jsx(h.Layouts.Header,{title:s.getMessage("page.settings.header.title"),subtitle:s.getMessage("page.settings.header.description"),as:"h2",primaryAction:e.jsx(S,{condition:u,children:e.jsx(t.Button,{type:"submit",startIcon:e.jsx(t.ForwardRef$4F,{}),onClick:P,children:s.getMessage("page.settings.actions.submit")})})}),e.jsxs(h.Layouts.Content,{children:[j&&e.jsx(t.Box,{marginBottom:4,children:e.jsx(U,{closeLabel:s.getMessage("page.settings.actions.restart.alert.cancel"),title:s.getMessage("page.settings.actions.restart.alert.title"),onClose:O,action:e.jsx(t.Box,{children:e.jsx(t.Button,{onClick:A.mutate,startIcon:e.jsx(t.ForwardRef$1j,{}),children:s.getMessage("page.settings.actions.restart")})}),children:e.jsx(t.Box,{marginTop:4,children:s.getMessage("page.settings.actions.restart.alert.description")})})}),e.jsx(h.Form,{method:"POST",width:"auto",height:"auto",ref:a,onSubmit:G,initialValues:{enabledCollections:v,moderatorRoles:E,badWords:k,clientEmail:K,clientUrl:H,gqlAuthEnabled:B,approvalFlow:l.data.approvalFlow,entryLabel:l.data.entryLabel,blockedAuthorProps:Q.join(", ")},children:({values:n,onChange:o})=>e.jsxs(t.Flex,{gap:4,direction:"column",children:[e.jsxs(t.Box,{...y,children:[e.jsx(t.Typography,{variant:"delta",as:"h2",children:s.getMessage("page.settings.section.general")}),e.jsxs(t.Grid.Root,{gap:4,marginTop:4,width:"100%",children:[e.jsx(t.Grid.Item,{xs:12,children:e.jsxs(t.Field.Root,{width:"100%",hint:s.getMessage("page.settings.form.enabledCollections.hint"),children:[e.jsx(t.Field.Label,{htmlFor:"enabledCollections",children:s.getMessage("page.settings.form.enabledCollections.label")}),e.jsx(t.MultiSelect,{withTags:!0,name:"enabledCollections",value:n.enabledCollections,onChange:i=>{o("enabledCollections",i)},children:F.map(i=>e.jsx(t.MultiSelectOption,{value:i.uid,children:i.schema.displayName},i.uid))}),e.jsx(t.Field.Hint,{})]})}),n.enabledCollections.length>0&&e.jsx(t.Grid.Item,{children:e.jsxs(t.Grid.Root,{gap:4,width:"100%",children:[e.jsx(t.Grid.Item,{children:e.jsx(t.Typography,{children:s.getMessage("page.settings.form.contentTypesSettings.label")})}),e.jsx(t.Grid.Item,{children:e.jsx(t.Accordion.Root,{style:{width:"100%"},children:t.lodashExports.orderBy(n.enabledCollections).map(i=>{const C=F.find(f=>f.uid===i);if(C){const{schema:{displayName:f,attributes:q}}=C,L=Object.keys(q).filter(d=>q[d].type==="string");return e.jsxs(t.Accordion.Item,{value:i,children:[e.jsx(t.Accordion.Header,{children:e.jsx(t.Accordion.Trigger,{children:e.jsx(t.Typography,{variant:"epsilon",as:"h3",children:f})})}),e.jsx(t.Accordion.Content,{children:e.jsxs(t.Grid.Root,{padding:6,gap:4,children:[e.jsx(t.Grid.Item,{children:e.jsxs(t.Field.Root,{width:"100%",hint:s.getMessage({id:"page.settings.form.approvalFlow.hint",props:{name:f}}),children:[e.jsx(t.Field.Label,{children:s.getMessage("page.settings.form.approvalFlow.label")}),e.jsx(t.SwitchImpl,{visibleLabels:!0,onLabel:s.getMessage("components.toogle.enabled"),offLabel:s.getMessage("components.toogle.disabled"),checked:n.approvalFlow.includes(i),onCheckedChange:d=>{o("approvalFlow",d?[...n.approvalFlow,i]:n.approvalFlow.filter($=>$!==i))}}),e.jsx(t.Field.Hint,{})]})}),e.jsx(S,{condition:L.length>0,children:e.jsx(t.Grid.Item,{children:e.jsxs(t.Field.Root,{width:"100%",hint:s.getMessage("page.settings.form.entryLabel.hint"),children:[e.jsx(t.Field.Label,{children:s.getMessage("page.settings.form.entryLabel.label")}),e.jsx(t.MultiSelect,{withTags:!0,placeholder:s.getMessage("page.settings.form.entryLabel.placeholder"),name:"enabledCollections",value:n.entryLabel[i]??[],onChange:d=>{o("entryLabel",{...n.entryLabel,[i]:d})},children:L.map(d=>e.jsx(t.MultiSelectOption,{value:d,children:d},d))}),e.jsx(t.Field.Hint,{})]})})})]})})]},i)}return null})})})]})})]})]}),e.jsxs(t.Box,{...y,children:[e.jsx(t.Typography,{variant:"delta",as:"h2",children:s.getMessage("page.settings.section.additional")}),e.jsxs(t.Grid.Root,{gap:4,marginTop:4,width:"100%",children:[e.jsx(t.Grid.Item,{xs:4,alignItems:"start",children:e.jsxs(t.Field.Root,{width:"100%",hint:s.getMessage("page.settings.form.enabledCollections.hint"),children:[e.jsx(t.Field.Label,{htmlFor:"enabledCollections",children:s.getMessage("page.settings.form.enabledCollections.label")}),e.jsx(t.Toggle,{name:"badWords",checked:n.badWords,onChange:o,onLabel:s.getMessage("components.toogle.enabled"),offLabel:s.getMessage("components.toogle.disabled"),width:"100%"}),e.jsx(t.Field.Hint,{})]})}),e.jsx(t.Grid.Item,{xs:4,alignItems:"start",children:e.jsxs(t.Field.Root,{width:"100%",hint:s.getMessage("page.settings.form.author.blockedProps.hint"),children:[e.jsx(t.Field.Label,{htmlFor:"enabledCollections",children:s.getMessage("page.settings.form.author.blockedProps.label")}),e.jsx(t.Field.Input,{name:"blockedProps",onChange:o}),e.jsx(t.Field.Hint,{})]})}),e.jsx(t.Grid.Item,{xs:4,alignItems:"start",children:e.jsxs(t.Field.Root,{width:"100%",hint:s.getMessage("page.settings.form.gqlAuth.hint"),children:[e.jsx(t.Field.Label,{children:s.getMessage("page.settings.form.gqlAuth.label")}),e.jsx(t.Toggle,{name:"gqlAuthEnabled",checked:n.gqlAuthEnabled,onChange:o,onLabel:s.getMessage("components.toogle.enabled"),offLabel:s.getMessage("components.toogle.disabled"),width:"100%"}),e.jsx(t.Field.Hint,{})]})})]})]}),e.jsxs(t.Box,{...y,children:[e.jsx(t.Typography,{variant:"delta",as:"h2",children:s.getMessage("page.settings.section.client")}),e.jsxs(t.Grid.Root,{gap:4,marginTop:4,width:"100%",children:[e.jsx(t.Grid.Item,{xs:4,alignItems:"start",children:e.jsxs(t.Field.Root,{width:"100%",hint:s.getMessage("page.settings.form.client.url.hint"),children:[e.jsx(t.Field.Label,{children:s.getMessage("page.settings.form.client.url.label")}),e.jsx(t.Field.Input,{name:"clientUrl",onChange:o}),e.jsx(t.Field.Hint,{})]})}),e.jsx(t.Grid.Item,{xs:4,alignItems:"start",children:e.jsxs(t.Field.Root,{width:"100%",hint:s.getMessage("page.settings.form.client.email.hint"),children:[e.jsx(t.Field.Label,{children:s.getMessage("page.settings.form.client.email.label")}),e.jsx(t.Field.Input,{name:"clientEmail",onChange:o}),e.jsx(t.Field.Hint,{})]})}),e.jsx(t.Grid.Item,{xs:4,alignItems:"start",children:e.jsxs(t.Field.Root,{width:"100%",hint:s.getMessage("page.settings.form.moderatorRoles.hint"),children:[e.jsx(t.Field.Label,{children:s.getMessage("page.settings.form.moderatorRoles.label")}),e.jsx(t.MultiSelect,{withTags:!0,placeholder:s.getMessage("page.settings.form.moderatorRoles.placeholder"),name:"enabledCollections",value:n.moderatorRoles,onChange:i=>{o("moderatorRoles",i)},children:M.data.map(i=>e.jsx(t.MultiSelectOption,{value:i.code,children:i.name},i.code))}),e.jsx(t.Field.Hint,{})]})})]})]}),e.jsx(S,{condition:u,children:e.jsx(t.Box,{...y,children:e.jsxs(t.Flex,{gap:4,direction:"column",alignItems:"flex-start",children:[e.jsxs(t.Flex,{gap:2,direction:"column",alignItems:"flex-start",children:[e.jsx(t.Typography,{variant:"delta",as:"h2",children:s.getMessage("page.settings.section.restore")}),e.jsx(t.Typography,{variant:"pi",as:"h4",children:s.getMessage("page.settings.section.restore.subtitle")})]}),e.jsx(s.ConfirmationDialog,{Trigger:({onClick:i})=>e.jsx(t.Button,{variant:"danger-light",startIcon:e.jsx(t.ForwardRef$5n,{}),onClick:i,children:s.getMessage("page.settings.actions.restore")}),onConfirm:T.mutate,title:s.getMessage("page.settings.actions.restore.confirmation.header"),labelConfirm:s.getMessage("page.settings.actions.restore.confirmation.button.confirm"),iconConfirm:e.jsx(t.ForwardRef$5n,{}),children:s.getMessage("page.settings.actions.restore.confirmation.description")})]})})})]})})]})]})]})};new c.QueryClient;const z=()=>e.jsx(s.CommonProviders,{children:e.jsx(V,{})});exports.default=z;
|