@sensinum/strapi-plugin-xecp 5.1.0 → 5.3.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.
- package/README.md +14 -3
- package/dist/admin/App-BbgV5mHU.mjs +2809 -0
- package/dist/admin/App-OXf6qXjU.js +74 -0
- package/dist/admin/TruncatedTypography-B8iYkeNP.js +12 -0
- package/dist/admin/{TruncatedTypography-BIh1V9g2.mjs → TruncatedTypography-BA_MhPw6.mjs} +4 -4
- package/dist/admin/de-9eabZie2.mjs +288 -0
- package/dist/admin/de-BN51VcbT.js +1 -0
- package/dist/admin/en-DI1XKd0e.js +1 -0
- package/dist/admin/en-tFIwzuCy.mjs +288 -0
- package/dist/admin/fr-BRWFIMrf.mjs +288 -0
- package/dist/admin/fr-lAhQzMjM.js +1 -0
- package/dist/admin/index-BU_gTHIE.mjs +110 -0
- package/dist/admin/index-C5CJ1Sy4.js +1 -0
- package/dist/admin/index-CT94KSzm.mjs +656 -0
- package/dist/admin/index-CmLDGvPV.js +1 -0
- package/dist/admin/{index-Dr164lAs.mjs → index-SQ5frWDn.mjs} +96 -90
- package/dist/admin/{index-CzhrALSL.js → index-ghS-FZ_7.js} +8 -8
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +3 -2
- package/dist/admin/pl-CSVwN6jF.js +1 -0
- package/dist/admin/pl-DLMBD4Lc.mjs +288 -0
- package/dist/admin/{queryKeys-rUHP1d6p.mjs → queryKeys-LazhiKSv.mjs} +5 -4
- package/dist/admin/queryKeys-Y6_AOyGq.js +1 -0
- package/dist/server/index.js +7 -7
- package/dist/server/index.mjs +8776 -8080
- package/package.json +48 -22
- package/dist/admin/App-DnN-IvA2.mjs +0 -1947
- package/dist/admin/App-fzbS9IJs.js +0 -30
- package/dist/admin/TruncatedTypography-IG2-4h8c.js +0 -12
- package/dist/admin/de-CXusi8Qg.mjs +0 -203
- package/dist/admin/de-DB2gq7qr.js +0 -1
- package/dist/admin/en-BuzP59R9.js +0 -1
- package/dist/admin/en-Dw6HZo7C.mjs +0 -203
- package/dist/admin/fr-CyBDGDh1.mjs +0 -203
- package/dist/admin/fr-ISZXcmX2.js +0 -1
- package/dist/admin/index-BPA-rtqa.js +0 -1
- package/dist/admin/index-CUUBtl-O.mjs +0 -113
- package/dist/admin/index-DDj2bCYO.mjs +0 -653
- package/dist/admin/index-DGBlS60G.js +0 -1
- package/dist/admin/pl-Ds5SR76s.js +0 -1
- package/dist/admin/pl-mwGoOpdR.mjs +0 -203
- package/dist/admin/queryKeys-B_GC_f73.js +0 -1
|
@@ -1,653 +0,0 @@
|
|
|
1
|
-
import { jsx as t, Fragment as W, jsxs as m } from "react/jsx-runtime";
|
|
2
|
-
import { useFetchClient as K, useForm as se, useNotification as oe, Layouts as O, useRBAC as ae, Page as I, Form as le } from "@strapi/strapi/admin";
|
|
3
|
-
import { U, g as a, P as G } from "./index-CUUBtl-O.mjs";
|
|
4
|
-
import { S as L, P as de, Q as ce } from "./queryKeys-rUHP1d6p.mjs";
|
|
5
|
-
import { useEffect as pe, useRef as ue, useMemo as me } from "react";
|
|
6
|
-
import { useIntl as C } from "react-intl";
|
|
7
|
-
import ge, { z as g } from "zod";
|
|
8
|
-
import { useQuery as M, queryOptions as he, useQueryClient as ye, useMutation as H } from "@tanstack/react-query";
|
|
9
|
-
import { Box as v, Field as f, SingleSelect as fe, SingleSelectOption as Te, Typography as b, Table as be, Thead as Ce, Tr as j, Th as q, Tbody as ve, Td as V, MultiSelect as Ee, MultiSelectOption as Se, Flex as z, Tooltip as Ae, Grid as R, NumberInput as we, TextInput as Q, Button as X, Loader as Re } from "@strapi/design-system";
|
|
10
|
-
import { Information as Fe, Check as Z } from "@strapi/icons";
|
|
11
|
-
import { T as B, A as J, b as Pe } from "./TruncatedTypography-BIh1V9g2.mjs";
|
|
12
|
-
import { isEqual as De } from "lodash";
|
|
13
|
-
const Ke = 3, F = g.enum(["Related", "Promotable"]);
|
|
14
|
-
g.object({
|
|
15
|
-
targetEnvApiKey: g.string().optional(),
|
|
16
|
-
targetEnvApiUrl: g.url().optional(),
|
|
17
|
-
comparisonDepth: g.number().positive().optional(),
|
|
18
|
-
contentTypes: g.array(g.object({ uid: g.string(), key: g.string(), kind: F })).optional()
|
|
19
|
-
});
|
|
20
|
-
const Ue = () => {
|
|
21
|
-
const { get: e } = K();
|
|
22
|
-
return M({
|
|
23
|
-
queryKey: [L],
|
|
24
|
-
queryFn: async () => {
|
|
25
|
-
const { data: n } = await e(`/${U}/settings`);
|
|
26
|
-
return n;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}, ke = [
|
|
30
|
-
L,
|
|
31
|
-
"content-type-options"
|
|
32
|
-
], Ie = () => {
|
|
33
|
-
const { get: e } = K();
|
|
34
|
-
return M({
|
|
35
|
-
queryKey: ke,
|
|
36
|
-
queryFn: async () => {
|
|
37
|
-
const { data: n } = await e(
|
|
38
|
-
`/${U}/settings/content-type-options`
|
|
39
|
-
);
|
|
40
|
-
return n;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}, Le = (e) => [L, "related-content-types", e], qe = (e, n) => he({
|
|
44
|
-
queryKey: Le(n),
|
|
45
|
-
queryFn: async () => {
|
|
46
|
-
const { data: r } = await e(
|
|
47
|
-
`/${U}/settings/related-content-types`,
|
|
48
|
-
{
|
|
49
|
-
params: {
|
|
50
|
-
allowed: n.join(",")
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
return r;
|
|
55
|
-
}
|
|
56
|
-
}), N = (e) => {
|
|
57
|
-
const { get: n } = K();
|
|
58
|
-
return M({
|
|
59
|
-
...qe(n, e),
|
|
60
|
-
enabled: e.length > 0
|
|
61
|
-
});
|
|
62
|
-
}, Ve = () => {
|
|
63
|
-
const { put: e } = K(), n = ye();
|
|
64
|
-
return H({
|
|
65
|
-
mutationFn: async (r) => e(`/${U}/settings`, r),
|
|
66
|
-
onSuccess: async () => {
|
|
67
|
-
await Promise.all([
|
|
68
|
-
n.invalidateQueries({ queryKey: [L] }),
|
|
69
|
-
n.invalidateQueries({ queryKey: [de] })
|
|
70
|
-
]);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}, _e = (e, n) => Object.entries(n).reduce((r, [o, i]) => De(i, e[o]) ? r : {
|
|
74
|
-
...r,
|
|
75
|
-
[o]: i
|
|
76
|
-
}, {}), ee = g.object({
|
|
77
|
-
allowedContentTypes: g.array(g.string()).min(1, { message: "settings.form.error.minimalArrayLength" }),
|
|
78
|
-
contentTypeSettings: g.record(
|
|
79
|
-
g.string(),
|
|
80
|
-
g.object({
|
|
81
|
-
key: g.string({ message: "settings.form.error.required" }).min(1, { message: "settings.form.error.required" }).optional()
|
|
82
|
-
}).optional()
|
|
83
|
-
),
|
|
84
|
-
targetEnvApiKey: g.string({ message: "settings.form.error.required" }).min(1, { message: "settings.form.error.required" }),
|
|
85
|
-
targetEnvApiUrl: g.url({ message: "settings.form.error.validURL" }),
|
|
86
|
-
comparisonDepth: g.number({ message: "settings.form.error.required" }).positive({ message: "settings.form.error.positive" })
|
|
87
|
-
}), Me = ee.extend({
|
|
88
|
-
relatedContentTypes: g.string().array()
|
|
89
|
-
}), Ne = Me.refine(
|
|
90
|
-
(e) => [
|
|
91
|
-
...e.allowedContentTypes,
|
|
92
|
-
...e.relatedContentTypes
|
|
93
|
-
].every(
|
|
94
|
-
(r) => !!e.contentTypeSettings[r]?.key
|
|
95
|
-
),
|
|
96
|
-
{
|
|
97
|
-
path: ["allowedContentTypes"],
|
|
98
|
-
message: "settings.form.error.uniqueKeyRequired",
|
|
99
|
-
when(e) {
|
|
100
|
-
return ee.pick({ contentTypeSettings: !0 }).safeParse(e.value).success;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
), xe = (e, n) => {
|
|
104
|
-
const r = [...e.allowedContentTypes, ...n];
|
|
105
|
-
return {
|
|
106
|
-
...e,
|
|
107
|
-
contentTypeSettings: Object.fromEntries(
|
|
108
|
-
r.map((o) => [
|
|
109
|
-
o,
|
|
110
|
-
e.contentTypeSettings[o]
|
|
111
|
-
])
|
|
112
|
-
)
|
|
113
|
-
};
|
|
114
|
-
}, te = (e) => e.replace(".", ":"), _ = (e) => e.replace(/:(?!.*:)/, "."), Oe = (e, n) => {
|
|
115
|
-
const o = {
|
|
116
|
-
...xe(n, e),
|
|
117
|
-
relatedContentTypes: e
|
|
118
|
-
}, i = Ne.parse(o);
|
|
119
|
-
return {
|
|
120
|
-
contentTypes: [
|
|
121
|
-
...i.allowedContentTypes,
|
|
122
|
-
...i.relatedContentTypes
|
|
123
|
-
].map((c) => ({
|
|
124
|
-
uid: _(c),
|
|
125
|
-
key: i.contentTypeSettings[c]?.key,
|
|
126
|
-
kind: i.allowedContentTypes.includes(c) ? F.enum.Promotable : F.enum.Related
|
|
127
|
-
})),
|
|
128
|
-
targetEnvApiKey: i.targetEnvApiKey,
|
|
129
|
-
targetEnvApiUrl: i.targetEnvApiUrl,
|
|
130
|
-
comparisonDepth: i.comparisonDepth
|
|
131
|
-
};
|
|
132
|
-
}, je = {
|
|
133
|
-
background: "neutral0",
|
|
134
|
-
hasRadius: !0,
|
|
135
|
-
shadow: "filterShadow",
|
|
136
|
-
padding: 6,
|
|
137
|
-
width: "100%"
|
|
138
|
-
}, x = ({ children: e, marginTop: n }) => /* @__PURE__ */ t(v, { ...je, marginTop: n, children: e }), Qe = ({
|
|
139
|
-
onChange: e,
|
|
140
|
-
attributes: n,
|
|
141
|
-
value: r,
|
|
142
|
-
name: o,
|
|
143
|
-
error: i,
|
|
144
|
-
disabled: d = !1,
|
|
145
|
-
environmentSpecificFields: c = []
|
|
146
|
-
}) => {
|
|
147
|
-
const { formatMessage: h } = C(), p = Object.entries(n).filter(
|
|
148
|
-
([u, s]) => (s.type === "uid" || s.unique === !0) && !c.includes(u)
|
|
149
|
-
);
|
|
150
|
-
return pe(() => {
|
|
151
|
-
!r && p.length > 0 && e("");
|
|
152
|
-
}, []), /* @__PURE__ */ t(W, { children: p.length > 0 ? /* @__PURE__ */ m(f.Root, { error: i && h({ id: a(i) }), children: [
|
|
153
|
-
/* @__PURE__ */ t(
|
|
154
|
-
fe,
|
|
155
|
-
{
|
|
156
|
-
name: o,
|
|
157
|
-
value: r,
|
|
158
|
-
onChange: e,
|
|
159
|
-
required: !0,
|
|
160
|
-
disabled: d,
|
|
161
|
-
children: p.map(([u, s]) => /* @__PURE__ */ t(Te, { value: u, children: u }, u))
|
|
162
|
-
}
|
|
163
|
-
),
|
|
164
|
-
/* @__PURE__ */ t(f.Error, {})
|
|
165
|
-
] }) : /* @__PURE__ */ t(
|
|
166
|
-
f.Root,
|
|
167
|
-
{
|
|
168
|
-
error: h({ id: a("settings.table.uniqueKeyRequiredWarning") }),
|
|
169
|
-
children: /* @__PURE__ */ t(f.Error, {})
|
|
170
|
-
}
|
|
171
|
-
) });
|
|
172
|
-
}, Y = ({
|
|
173
|
-
label: e,
|
|
174
|
-
contentTypes: n,
|
|
175
|
-
setFormValue: r,
|
|
176
|
-
errors: o,
|
|
177
|
-
contentTypeSettings: i,
|
|
178
|
-
shouldShowRequiredBy: d,
|
|
179
|
-
isReadOnly: c,
|
|
180
|
-
environmentSpecificFields: h = {}
|
|
181
|
-
}) => {
|
|
182
|
-
const { formatMessage: p } = C();
|
|
183
|
-
return /* @__PURE__ */ m(v, { marginTop: 4, width: "100%", paddingTop: 4, children: [
|
|
184
|
-
/* @__PURE__ */ t(v, { marginBottom: 1, children: /* @__PURE__ */ t(b, { variant: "pi", textColor: "neutral800", fontWeight: "bold", children: e }) }),
|
|
185
|
-
/* @__PURE__ */ m(be, { width: "100%", rowCount: n.length, colCount: d ? 3 : 2, children: [
|
|
186
|
-
/* @__PURE__ */ t(Ce, { children: /* @__PURE__ */ m(j, { children: [
|
|
187
|
-
/* @__PURE__ */ t(q, { children: /* @__PURE__ */ t(b, { variant: "sigma", children: p({ id: a("settings.table.contentType") }) }) }),
|
|
188
|
-
d && /* @__PURE__ */ t(q, { children: /* @__PURE__ */ t(b, { variant: "sigma", children: p({ id: a("settings.table.requiredBy") }) }) }),
|
|
189
|
-
/* @__PURE__ */ t(q, { children: /* @__PURE__ */ t(b, { variant: "sigma", children: p({ id: a("settings.table.uniqueKey") }) }) })
|
|
190
|
-
] }) }),
|
|
191
|
-
/* @__PURE__ */ t(ve, { children: n.map((u) => {
|
|
192
|
-
const s = `contentTypeSettings.${u.uid}.key`, l = h[u.uid] ?? [];
|
|
193
|
-
return /* @__PURE__ */ m(j, { children: [
|
|
194
|
-
/* @__PURE__ */ t(V, { width: d ? "25%" : "50%", children: /* @__PURE__ */ t(
|
|
195
|
-
B,
|
|
196
|
-
{
|
|
197
|
-
maxCharacters: 55,
|
|
198
|
-
text: u.schema.displayName,
|
|
199
|
-
textColor: "neutral800"
|
|
200
|
-
}
|
|
201
|
-
) }),
|
|
202
|
-
d && /* @__PURE__ */ t(V, { width: "25%", children: /* @__PURE__ */ t(
|
|
203
|
-
B,
|
|
204
|
-
{
|
|
205
|
-
maxCharacters: 55,
|
|
206
|
-
text: u.requiredBy,
|
|
207
|
-
textColor: "neutral800"
|
|
208
|
-
}
|
|
209
|
-
) }),
|
|
210
|
-
/* @__PURE__ */ m(V, { width: "50%", children: [
|
|
211
|
-
/* @__PURE__ */ t(
|
|
212
|
-
Qe,
|
|
213
|
-
{
|
|
214
|
-
onChange: (y) => {
|
|
215
|
-
r(s, y);
|
|
216
|
-
},
|
|
217
|
-
value: i[u.uid]?.key,
|
|
218
|
-
attributes: u.schema.attributes,
|
|
219
|
-
name: s,
|
|
220
|
-
error: o[s],
|
|
221
|
-
disabled: c,
|
|
222
|
-
environmentSpecificFields: l.filter(
|
|
223
|
-
(y) => !y.includes(".")
|
|
224
|
-
)
|
|
225
|
-
}
|
|
226
|
-
),
|
|
227
|
-
l.length > 0 && /* @__PURE__ */ t(v, { marginTop: 1, children: /* @__PURE__ */ t(
|
|
228
|
-
b,
|
|
229
|
-
{
|
|
230
|
-
variant: "pi",
|
|
231
|
-
textColor: "neutral600",
|
|
232
|
-
style: { whiteSpace: "normal", overflowWrap: "anywhere" },
|
|
233
|
-
children: p(
|
|
234
|
-
{ id: a("settings.table.environmentSpecificFields") },
|
|
235
|
-
{ fields: l.join(", ") }
|
|
236
|
-
)
|
|
237
|
-
}
|
|
238
|
-
) })
|
|
239
|
-
] })
|
|
240
|
-
] }, u.uid);
|
|
241
|
-
}) })
|
|
242
|
-
] })
|
|
243
|
-
] });
|
|
244
|
-
}, Be = ({
|
|
245
|
-
allowedContentTypes: e,
|
|
246
|
-
contentTypeSettings: n,
|
|
247
|
-
setFormValue: r,
|
|
248
|
-
promotableContentTypes: o,
|
|
249
|
-
errors: i,
|
|
250
|
-
isReadOnly: d,
|
|
251
|
-
environmentSpecificFields: c
|
|
252
|
-
}) => {
|
|
253
|
-
const { formatMessage: h } = C(), p = e.map(
|
|
254
|
-
(l) => o?.find((y) => y.uid === l)
|
|
255
|
-
), { data: u, isLoading: s } = N(e);
|
|
256
|
-
return s ? null : /* @__PURE__ */ m(x, { children: [
|
|
257
|
-
/* @__PURE__ */ t(b, { variant: "delta", children: h({ id: a("settings.allowedContentTypes") }) }),
|
|
258
|
-
/* @__PURE__ */ t(v, { marginTop: 4, width: "100%", children: /* @__PURE__ */ m(
|
|
259
|
-
f.Root,
|
|
260
|
-
{
|
|
261
|
-
width: "100%",
|
|
262
|
-
error: i.allowedContentTypes && h({ id: a(i.allowedContentTypes) }),
|
|
263
|
-
children: [
|
|
264
|
-
/* @__PURE__ */ t(f.Label, { children: h({ id: a("settings.allowedContentTypes.label") }) }),
|
|
265
|
-
/* @__PURE__ */ t(
|
|
266
|
-
Ee,
|
|
267
|
-
{
|
|
268
|
-
withTags: !0,
|
|
269
|
-
name: "allowedContentTypes",
|
|
270
|
-
value: e,
|
|
271
|
-
onChange: (l) => {
|
|
272
|
-
r("allowedContentTypes", l);
|
|
273
|
-
},
|
|
274
|
-
hasError: !!i.allowedContentTypes,
|
|
275
|
-
disabled: d,
|
|
276
|
-
children: o?.map((l) => /* @__PURE__ */ t(Se, { value: l.uid, children: l.schema.displayName }, l.uid))
|
|
277
|
-
}
|
|
278
|
-
),
|
|
279
|
-
/* @__PURE__ */ t(f.Error, {})
|
|
280
|
-
]
|
|
281
|
-
}
|
|
282
|
-
) }),
|
|
283
|
-
e?.length > 0 && /* @__PURE__ */ t(
|
|
284
|
-
Y,
|
|
285
|
-
{
|
|
286
|
-
label: h({
|
|
287
|
-
id: a("settings.table.keyForEligibleContentTypes")
|
|
288
|
-
}),
|
|
289
|
-
contentTypes: p,
|
|
290
|
-
setFormValue: r,
|
|
291
|
-
errors: i,
|
|
292
|
-
contentTypeSettings: n,
|
|
293
|
-
isReadOnly: d,
|
|
294
|
-
environmentSpecificFields: c
|
|
295
|
-
}
|
|
296
|
-
),
|
|
297
|
-
(u?.length ?? 0) > 0 && /* @__PURE__ */ t(
|
|
298
|
-
Y,
|
|
299
|
-
{
|
|
300
|
-
label: h({
|
|
301
|
-
id: a("settings.table.keyForRelatedContentTypes")
|
|
302
|
-
}),
|
|
303
|
-
contentTypes: u ?? [],
|
|
304
|
-
setFormValue: r,
|
|
305
|
-
errors: i,
|
|
306
|
-
contentTypeSettings: n,
|
|
307
|
-
shouldShowRequiredBy: !0,
|
|
308
|
-
isReadOnly: d,
|
|
309
|
-
environmentSpecificFields: c
|
|
310
|
-
}
|
|
311
|
-
)
|
|
312
|
-
] });
|
|
313
|
-
}, Ye = () => {
|
|
314
|
-
const { formatMessage: e } = C();
|
|
315
|
-
return /* @__PURE__ */ t(v, { marginTop: 4, children: /* @__PURE__ */ t(
|
|
316
|
-
J,
|
|
317
|
-
{
|
|
318
|
-
title: e({ id: a("settings.alert.comparisonDepthHigh.title") }),
|
|
319
|
-
variant: "warning",
|
|
320
|
-
description: e({
|
|
321
|
-
id: a("settings.alert.comparisonDepthHigh.description")
|
|
322
|
-
})
|
|
323
|
-
}
|
|
324
|
-
) });
|
|
325
|
-
}, $e = ({ comparisonDepth: e, setFormValue: n, errors: r, isReadOnly: o }) => {
|
|
326
|
-
const { formatMessage: i } = C();
|
|
327
|
-
return /* @__PURE__ */ m(x, { marginTop: 4, children: [
|
|
328
|
-
/* @__PURE__ */ m(z, { marginBottom: 4, gap: 1, children: [
|
|
329
|
-
/* @__PURE__ */ t(b, { variant: "delta", children: i({ id: a("settings.comparisonDepth") }) }),
|
|
330
|
-
/* @__PURE__ */ t(Ae, { label: i({ id: a("settings.comparisonDepth.tooltip") }), children: /* @__PURE__ */ t(Fe, {}) })
|
|
331
|
-
] }),
|
|
332
|
-
/* @__PURE__ */ t(R.Root, { gap: 4, children: /* @__PURE__ */ t(R.Item, { col: 6, alignItems: "start", children: /* @__PURE__ */ m(
|
|
333
|
-
f.Root,
|
|
334
|
-
{
|
|
335
|
-
error: r.comparisonDepth && i({ id: a(r.comparisonDepth) }),
|
|
336
|
-
width: "100%",
|
|
337
|
-
children: [
|
|
338
|
-
/* @__PURE__ */ t(f.Label, { children: i({ id: a("settings.comparisonDepth.label") }) }),
|
|
339
|
-
/* @__PURE__ */ t(
|
|
340
|
-
we,
|
|
341
|
-
{
|
|
342
|
-
value: e,
|
|
343
|
-
onValueChange: (d) => n("comparisonDepth", d),
|
|
344
|
-
name: "comparisonDepth",
|
|
345
|
-
disabled: o
|
|
346
|
-
}
|
|
347
|
-
),
|
|
348
|
-
/* @__PURE__ */ t(f.Error, {})
|
|
349
|
-
]
|
|
350
|
-
}
|
|
351
|
-
) }) }),
|
|
352
|
-
e > 5 && /* @__PURE__ */ t(Ye, {})
|
|
353
|
-
] });
|
|
354
|
-
}, We = ({ staleValueMessages: e }) => {
|
|
355
|
-
const { formatMessage: n } = C();
|
|
356
|
-
return /* @__PURE__ */ t(v, { marginBottom: 4, children: /* @__PURE__ */ m(
|
|
357
|
-
J,
|
|
358
|
-
{
|
|
359
|
-
title: n({ id: a("settings.alert.staleValuesRemoved.title") }),
|
|
360
|
-
variant: "danger",
|
|
361
|
-
children: [
|
|
362
|
-
n({ id: a("settings.alert.staleValuesRemoved.description") }),
|
|
363
|
-
e.map((r, o) => /* @__PURE__ */ m("span", { children: [
|
|
364
|
-
/* @__PURE__ */ t("br", {}),
|
|
365
|
-
o + 1,
|
|
366
|
-
".",
|
|
367
|
-
" ",
|
|
368
|
-
n(
|
|
369
|
-
{
|
|
370
|
-
id: a(r.message)
|
|
371
|
-
},
|
|
372
|
-
r.variables
|
|
373
|
-
)
|
|
374
|
-
] }, o))
|
|
375
|
-
]
|
|
376
|
-
}
|
|
377
|
-
) });
|
|
378
|
-
}, Ge = () => {
|
|
379
|
-
const { post: e } = K();
|
|
380
|
-
return H({
|
|
381
|
-
mutationFn: async (n) => {
|
|
382
|
-
const { data: r } = await e(
|
|
383
|
-
`/${U}/settings/testConnection`,
|
|
384
|
-
n
|
|
385
|
-
);
|
|
386
|
-
return r;
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
}, He = "settings.form.error.badApiUrl", ze = {
|
|
390
|
-
badApiKey: "settings.form.error.badApiKey",
|
|
391
|
-
badPermissions: "settings.form.error.badKeyPermissions"
|
|
392
|
-
}, Xe = ({
|
|
393
|
-
targetEnvApiKey: e,
|
|
394
|
-
targetEnvApiUrl: n,
|
|
395
|
-
setFormValue: r,
|
|
396
|
-
errors: o,
|
|
397
|
-
isReadOnly: i
|
|
398
|
-
}) => {
|
|
399
|
-
const { formatMessage: d } = C(), c = Ge(), { setErrors: h } = se("TargetEnvConfigurationSection", (l) => l), p = async () => {
|
|
400
|
-
const l = (y) => {
|
|
401
|
-
h({
|
|
402
|
-
...o,
|
|
403
|
-
targetEnvApiUrl: y.outcome === "badUrl" ? He : void 0,
|
|
404
|
-
targetEnvApiKey: ze[y.outcome]
|
|
405
|
-
});
|
|
406
|
-
};
|
|
407
|
-
try {
|
|
408
|
-
const y = await c.mutateAsync({
|
|
409
|
-
targetEnvApiKey: e,
|
|
410
|
-
targetEnvApiUrl: n
|
|
411
|
-
});
|
|
412
|
-
l(y);
|
|
413
|
-
} catch {
|
|
414
|
-
l({ outcome: "unexpected" });
|
|
415
|
-
}
|
|
416
|
-
}, u = c.isSuccess && c.data?.outcome === "reachable", s = c.isError || c.data?.outcome === "unexpected";
|
|
417
|
-
return /* @__PURE__ */ m(x, { marginTop: 4, children: [
|
|
418
|
-
/* @__PURE__ */ t(v, { marginBottom: 4, children: /* @__PURE__ */ t(b, { variant: "delta", children: d({ id: a("settings.targetEnvConfiguration") }) }) }),
|
|
419
|
-
/* @__PURE__ */ m(R.Root, { gap: 4, children: [
|
|
420
|
-
/* @__PURE__ */ t(R.Item, { col: 6, alignItems: "start", children: /* @__PURE__ */ m(
|
|
421
|
-
f.Root,
|
|
422
|
-
{
|
|
423
|
-
error: o.targetEnvApiUrl && d({ id: a(o.targetEnvApiUrl) }),
|
|
424
|
-
width: "100%",
|
|
425
|
-
children: [
|
|
426
|
-
/* @__PURE__ */ t(f.Label, { children: d({ id: a("settings.targetEnvApiUrl.label") }) }),
|
|
427
|
-
/* @__PURE__ */ t(
|
|
428
|
-
Q,
|
|
429
|
-
{
|
|
430
|
-
name: "targetEnvApiUrl",
|
|
431
|
-
value: n,
|
|
432
|
-
onChange: r,
|
|
433
|
-
disabled: i
|
|
434
|
-
}
|
|
435
|
-
),
|
|
436
|
-
/* @__PURE__ */ t(f.Error, {})
|
|
437
|
-
]
|
|
438
|
-
}
|
|
439
|
-
) }),
|
|
440
|
-
/* @__PURE__ */ t(R.Item, { col: 6, alignItems: "start", children: /* @__PURE__ */ m(
|
|
441
|
-
f.Root,
|
|
442
|
-
{
|
|
443
|
-
error: o.targetEnvApiKey && d({ id: a(o.targetEnvApiKey) }),
|
|
444
|
-
width: "100%",
|
|
445
|
-
children: [
|
|
446
|
-
/* @__PURE__ */ t(f.Label, { children: d({ id: a("settings.targetEnvApiKey.label") }) }),
|
|
447
|
-
/* @__PURE__ */ t(
|
|
448
|
-
Q,
|
|
449
|
-
{
|
|
450
|
-
name: "targetEnvApiKey",
|
|
451
|
-
value: e,
|
|
452
|
-
onChange: r,
|
|
453
|
-
disabled: i
|
|
454
|
-
}
|
|
455
|
-
),
|
|
456
|
-
/* @__PURE__ */ t(f.Error, {})
|
|
457
|
-
]
|
|
458
|
-
}
|
|
459
|
-
) }),
|
|
460
|
-
/* @__PURE__ */ m(R.Item, { col: 6, children: [
|
|
461
|
-
i ? null : /* @__PURE__ */ t(X, { onClick: p, disabled: c.isPending, children: d({ id: a("settings.form.testConnection") }) }),
|
|
462
|
-
/* @__PURE__ */ m(z, { marginLeft: 1, alignItems: "center", gap: 2, children: [
|
|
463
|
-
c.isPending && /* @__PURE__ */ t(Re, { small: !0 }),
|
|
464
|
-
u && /* @__PURE__ */ t(Z, { color: "#5cb176" }),
|
|
465
|
-
s && /* @__PURE__ */ t(b, { variant: "pi", textColor: "danger600", children: d({ id: a("settings.form.error.connectionFailed") }) })
|
|
466
|
-
] })
|
|
467
|
-
] })
|
|
468
|
-
] })
|
|
469
|
-
] });
|
|
470
|
-
}, Ze = ({
|
|
471
|
-
values: e,
|
|
472
|
-
onChange: n,
|
|
473
|
-
errors: r,
|
|
474
|
-
setErrors: o,
|
|
475
|
-
modified: i,
|
|
476
|
-
settings: d,
|
|
477
|
-
promotableContentTypes: c,
|
|
478
|
-
staleValuesMessages: h,
|
|
479
|
-
isReadOnly: p,
|
|
480
|
-
environmentSpecificFields: u
|
|
481
|
-
}) => {
|
|
482
|
-
const { formatMessage: s } = C(), { toggleNotification: l } = oe(), y = Ve(), { data: S = [], isFetching: A } = N(e.allowedContentTypes), P = async () => {
|
|
483
|
-
try {
|
|
484
|
-
const E = S.map((w) => w.uid), D = Oe(E, e), T = _e(d, D);
|
|
485
|
-
await y.mutateAsync(T, {
|
|
486
|
-
onSuccess: () => {
|
|
487
|
-
o({}), l({
|
|
488
|
-
type: "success",
|
|
489
|
-
message: s({ id: a("settings.form.savedSuccessfully") })
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
});
|
|
493
|
-
} catch (E) {
|
|
494
|
-
if (E instanceof ge.ZodError) {
|
|
495
|
-
const D = E.issues.reduce((T, w) => (T[w.path.join(".")] = w.message, T), {});
|
|
496
|
-
o(D), l({
|
|
497
|
-
type: "warning",
|
|
498
|
-
message: s({ id: a("settings.form.error.validationMessage") })
|
|
499
|
-
});
|
|
500
|
-
} else
|
|
501
|
-
l({
|
|
502
|
-
type: "warning",
|
|
503
|
-
message: Pe(E, s) ?? s({ id: a("settings.form.error.other") })
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
}, k = p || !i && h.length === 0 || A || y.isPending;
|
|
507
|
-
return /* @__PURE__ */ m(W, { children: [
|
|
508
|
-
/* @__PURE__ */ t(
|
|
509
|
-
O.Header,
|
|
510
|
-
{
|
|
511
|
-
title: s({ id: a("settings.title") }),
|
|
512
|
-
subtitle: s({ id: a("settings.subtitle") }),
|
|
513
|
-
primaryAction: p ? null : /* @__PURE__ */ t(
|
|
514
|
-
X,
|
|
515
|
-
{
|
|
516
|
-
type: "submit",
|
|
517
|
-
startIcon: /* @__PURE__ */ t(Z, {}),
|
|
518
|
-
onClick: P,
|
|
519
|
-
disabled: k,
|
|
520
|
-
children: s({
|
|
521
|
-
id: a("settings.form.submit")
|
|
522
|
-
})
|
|
523
|
-
}
|
|
524
|
-
)
|
|
525
|
-
}
|
|
526
|
-
),
|
|
527
|
-
/* @__PURE__ */ m(O.Content, { children: [
|
|
528
|
-
h.length > 0 && /* @__PURE__ */ t(We, { staleValueMessages: h }),
|
|
529
|
-
/* @__PURE__ */ t(
|
|
530
|
-
Be,
|
|
531
|
-
{
|
|
532
|
-
allowedContentTypes: e.allowedContentTypes,
|
|
533
|
-
contentTypeSettings: e.contentTypeSettings,
|
|
534
|
-
setFormValue: n,
|
|
535
|
-
promotableContentTypes: c,
|
|
536
|
-
errors: r,
|
|
537
|
-
isReadOnly: p,
|
|
538
|
-
environmentSpecificFields: u
|
|
539
|
-
}
|
|
540
|
-
),
|
|
541
|
-
/* @__PURE__ */ t(
|
|
542
|
-
$e,
|
|
543
|
-
{
|
|
544
|
-
setFormValue: n,
|
|
545
|
-
errors: r,
|
|
546
|
-
comparisonDepth: e.comparisonDepth,
|
|
547
|
-
isReadOnly: p
|
|
548
|
-
}
|
|
549
|
-
),
|
|
550
|
-
/* @__PURE__ */ t(
|
|
551
|
-
Xe,
|
|
552
|
-
{
|
|
553
|
-
targetEnvApiKey: e.targetEnvApiKey,
|
|
554
|
-
targetEnvApiUrl: e.targetEnvApiUrl,
|
|
555
|
-
setFormValue: n,
|
|
556
|
-
errors: r,
|
|
557
|
-
isReadOnly: p
|
|
558
|
-
}
|
|
559
|
-
)
|
|
560
|
-
] })
|
|
561
|
-
] });
|
|
562
|
-
}, $ = (e) => {
|
|
563
|
-
const n = e.contentTypes ?? [], r = n.filter((i) => i.kind === F.enum.Promotable).map((i) => i.uid), o = Object.fromEntries(
|
|
564
|
-
n.map((i) => [i.uid, { key: i.key }])
|
|
565
|
-
);
|
|
566
|
-
return {
|
|
567
|
-
allowedContentTypes: r,
|
|
568
|
-
contentTypeSettings: o,
|
|
569
|
-
targetEnvApiKey: e?.targetEnvApiKey ?? "",
|
|
570
|
-
targetEnvApiUrl: e?.targetEnvApiUrl ?? "",
|
|
571
|
-
comparisonDepth: e?.comparisonDepth ?? Ke
|
|
572
|
-
};
|
|
573
|
-
}, Je = (e, n, r, o = {}) => {
|
|
574
|
-
if (!e.contentTypes)
|
|
575
|
-
return [$(e), []];
|
|
576
|
-
const i = [], d = e.contentTypes.map((s) => ({
|
|
577
|
-
...s,
|
|
578
|
-
uid: te(s.uid)
|
|
579
|
-
})), c = n.map((s) => s.uid), p = d.filter(
|
|
580
|
-
(s) => {
|
|
581
|
-
const l = !c.includes(s.uid);
|
|
582
|
-
return l && i.push({
|
|
583
|
-
message: "settings.alert.staleValuesRemoved.contentTypeDeleted",
|
|
584
|
-
variables: { uid: _(s.uid) }
|
|
585
|
-
}), !l;
|
|
586
|
-
}
|
|
587
|
-
).filter((s) => {
|
|
588
|
-
const l = !r.includes(s.uid) && s.kind === F.enum.Related;
|
|
589
|
-
return l && i.push({
|
|
590
|
-
message: "settings.alert.staleValuesRemoved.relationDeleted",
|
|
591
|
-
variables: { uid: _(s.uid) }
|
|
592
|
-
}), !l;
|
|
593
|
-
}).map((s) => {
|
|
594
|
-
const l = n.find(
|
|
595
|
-
(P) => P.uid === s.uid
|
|
596
|
-
), y = l?.schema.attributes[s.key], S = y?.type === "uid" || y?.unique === !0, A = (o[s.uid] ?? []).includes(s.key);
|
|
597
|
-
return (!S || A) && i.push({
|
|
598
|
-
message: S ? "settings.alert.staleValuesRemoved.keyEnvironmentSpecific" : "settings.alert.staleValuesRemoved.keyDeleted",
|
|
599
|
-
variables: {
|
|
600
|
-
key: s.key,
|
|
601
|
-
schemaDisplayName: l?.schema.displayName
|
|
602
|
-
}
|
|
603
|
-
}), {
|
|
604
|
-
...s,
|
|
605
|
-
key: S && !A ? s.key : void 0
|
|
606
|
-
};
|
|
607
|
-
});
|
|
608
|
-
return [$({
|
|
609
|
-
...e,
|
|
610
|
-
contentTypes: p
|
|
611
|
-
}), i];
|
|
612
|
-
}, et = () => {
|
|
613
|
-
const { formatMessage: e } = C(), n = ue(null), {
|
|
614
|
-
isLoading: r,
|
|
615
|
-
allowedActions: { canUpdate: o }
|
|
616
|
-
} = ae([...G.settingsUpdate]), { data: i, isLoading: d } = Ue(), { data: c, isLoading: h } = Ie(), p = me(
|
|
617
|
-
() => (i?.contentTypes ?? []).filter((T) => T.kind === F.enum.Promotable).map((T) => te(T.uid)),
|
|
618
|
-
[i?.contentTypes]
|
|
619
|
-
), {
|
|
620
|
-
data: u = [],
|
|
621
|
-
isLoading: s,
|
|
622
|
-
isFetched: l
|
|
623
|
-
} = N(p), y = p.length === 0 || l;
|
|
624
|
-
if (r || d || h || s || !y || !i || !c)
|
|
625
|
-
return /* @__PURE__ */ t(I.Loading, {});
|
|
626
|
-
const { promotableContentTypes: A, relationLookupContentTypes: P, environmentSpecificFields: k } = c, [E, D] = Je(
|
|
627
|
-
i,
|
|
628
|
-
P,
|
|
629
|
-
u.map((T) => T.uid),
|
|
630
|
-
k
|
|
631
|
-
);
|
|
632
|
-
return /* @__PURE__ */ m(I.Main, { children: [
|
|
633
|
-
/* @__PURE__ */ t(I.Title, { children: e({ id: a("settings.metadata.title") }) }),
|
|
634
|
-
/* @__PURE__ */ t(le, { width: "100%", height: "100%", ref: n, method: "PUT", initialValues: E, children: ({ values: T, onChange: w, errors: ne, setErrors: ie, modified: re }) => /* @__PURE__ */ t(
|
|
635
|
-
Ze,
|
|
636
|
-
{
|
|
637
|
-
values: T,
|
|
638
|
-
onChange: w,
|
|
639
|
-
errors: ne,
|
|
640
|
-
setErrors: ie,
|
|
641
|
-
modified: re,
|
|
642
|
-
settings: i,
|
|
643
|
-
promotableContentTypes: A,
|
|
644
|
-
staleValuesMessages: D,
|
|
645
|
-
isReadOnly: !o,
|
|
646
|
-
environmentSpecificFields: k
|
|
647
|
-
}
|
|
648
|
-
) })
|
|
649
|
-
] });
|
|
650
|
-
}, mt = () => /* @__PURE__ */ t(I.Protect, { permissions: [...G.settingsRead], children: /* @__PURE__ */ t(ce, { children: /* @__PURE__ */ t(et, {}) }) });
|
|
651
|
-
export {
|
|
652
|
-
mt as default
|
|
653
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const p=require("zod"),c=require("react"),g=require("react/jsx-runtime"),f=require("@strapi/icons"),P=e=>e&&e.__esModule?e:{default:e},b=P(p),R=(e,t,s)=>{const o=e[t];return o?typeof o=="function"?o():Promise.resolve(o):new Promise((M,d)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(d.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==s?". Note that variables only represent file names one level deep.":""))))})},v="@sensinum/strapi-plugin-xecp",q="5.1.0",I="https://www.sensinum.com/contact",h="hello@sensinum.com",_={name:"content-promotion"},m={name:v,version:q,homepage:I,email:h,strapi:_},n=b.default.literal("content-promotion").parse(m.strapi.name),a="xecp",i={settings:{read:"settings.read",update:"settings.update"},promotion:{read:"promotion.read",execute:"promotion.execute"}},x=e=>`plugin::${n}.${e}`,r=e=>({action:x(e),subject:null}),u={settingsRead:[r(i.settings.read)],settingsUpdate:[r(i.settings.update)],promotionRead:[r(i.promotion.read)],promotionExecute:[r(i.promotion.execute)]},y=({setPlugin:e})=>{const t=c.useRef(e);return c.useEffect(()=>{t.current(n)},[]),null},$=()=>g.jsx(f.Files,{style:{width:24}}),l=e=>`${n}.${e}`,j=e=>Object.keys(e).reduce((t,s)=>(t[`${n}.${s}`]=e[s],t),{}),L={register(e){e.addMenuLink({to:`plugins/${a}`,icon:$,intlLabel:{id:`${n}.plugin.name`,defaultMessage:n},Component:()=>Promise.resolve().then(()=>require("./App-fzbS9IJs.js")),permissions:[...u.promotionRead]}),e.addSettingsLink({id:n,intlLabel:{id:l("settings.section.sectionName"),defaultMessage:"Content Promotion Plugin"}},[{intlLabel:{id:l("settings.section.about"),defaultMessage:"About"},id:"about",to:`${a}/about`,Component:()=>Promise.resolve().then(()=>require("./index-CzhrALSL.js")),permissions:[...u.settingsRead]},{intlLabel:{id:l("settings.section.configuration"),defaultMessage:"Configuration"},id:"configuration",to:`${a}/configuration`,Component:()=>Promise.resolve().then(()=>require("./index-BPA-rtqa.js")),permissions:[...u.settingsRead]}]),e.registerPlugin({id:n,initializer:y,isReady:!1,name:n})},async registerTrads({locales:e}){return Promise.all(e.map(async t=>{try{const{default:s}=await R(Object.assign({"./translations/de.json":()=>Promise.resolve().then(()=>require("./de-DB2gq7qr.js")),"./translations/en.json":()=>Promise.resolve().then(()=>require("./en-BuzP59R9.js")),"./translations/fr.json":()=>Promise.resolve().then(()=>require("./fr-ISZXcmX2.js")),"./translations/pl.json":()=>Promise.resolve().then(()=>require("./pl-Ds5SR76s.js"))}),`./translations/${t}.json`,3);return{data:j(s),locale:t}}catch{return{data:{},locale:t}}}))}};exports.PERMISSIONS=u;exports.PLUGIN_ID=n;exports.URL_PREFIX=a;exports.getTranslation=l;exports.index=L;exports.packageJson=m;
|