@sensinum/strapi-plugin-xecp 5.0.0 → 5.0.2
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 +3 -3
- package/dist/admin/{App-CpfEDpzY.mjs → App-COKB0PXI.mjs} +722 -691
- package/dist/admin/App-CxQAwCC4.js +30 -0
- package/dist/admin/{de-bbLKG0Z0.js → de-B5M8juGn.js} +1 -1
- package/dist/admin/{de-C25k5cq2.mjs → de-Bc7t3sCO.mjs} +4 -0
- package/dist/admin/{en-B08MBp2G.mjs → en-16Qqparh.mjs} +4 -0
- package/dist/admin/{en-CN9XhSjy.js → en-DXWBDgkB.js} +1 -1
- package/dist/admin/{fr-C0XfkZIq.mjs → fr-CMzm8jIl.mjs} +4 -0
- package/dist/admin/{fr-CrIyMsIk.js → fr-CPWgcURq.js} +1 -1
- package/dist/admin/{index-CerJW5f6.js → index-BNa83Wfu.js} +1 -1
- package/dist/admin/{index-pRp3V-Jg.mjs → index-Bgk0cBQK.mjs} +5 -5
- package/dist/admin/{index-C273gErB.mjs → index-BnS-25UL.mjs} +228 -217
- package/dist/admin/index-C0CxNaV6.js +1 -0
- package/dist/admin/{index-BBbEUakb.mjs → index-DQgqKBmR.mjs} +1 -1
- package/dist/admin/{index-CYCygSmH.js → index-ogQgaRcB.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/{pl-DFGTrhGA.js → pl-Blw4wk9g.js} +1 -1
- package/dist/admin/{pl-CPolzlPI.mjs → pl-CuTaHdsS.mjs} +4 -0
- package/dist/server/index.js +10 -8
- package/dist/server/index.mjs +7790 -6587
- package/package.json +2 -1
- package/dist/admin/App-DNMEZr-V.js +0 -30
- package/dist/admin/index-BgeTCjkL.js +0 -1
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
import { jsx as t, Fragment as $, jsxs as u } from "react/jsx-runtime";
|
|
2
|
-
import { useFetchClient as
|
|
3
|
-
import { U, g as a, P as
|
|
4
|
-
import { S as
|
|
2
|
+
import { useFetchClient as P, useForm as re, useNotification as se, Layouts as x, useRBAC as oe, Page as U, Form as ae } from "@strapi/strapi/admin";
|
|
3
|
+
import { U as D, g as a, P as G } from "./index-Bgk0cBQK.mjs";
|
|
4
|
+
import { S as K, P as le, Q as de } from "./queryKeys-rUHP1d6p.mjs";
|
|
5
5
|
import { useEffect as ce, useRef as pe, useMemo as ue } from "react";
|
|
6
|
-
import { useIntl as
|
|
7
|
-
import
|
|
8
|
-
import { useQuery as
|
|
9
|
-
import { Box as
|
|
6
|
+
import { useIntl as b } from "react-intl";
|
|
7
|
+
import me, { z as m } from "zod";
|
|
8
|
+
import { useQuery as _, queryOptions as ge, useQueryClient as he, useMutation as H } from "@tanstack/react-query";
|
|
9
|
+
import { Box as E, Field as h, SingleSelect as ye, SingleSelectOption as Te, Typography as C, Table as fe, Thead as be, Tr as O, Th as L, Tbody as Ce, Td as q, MultiSelect as Ee, MultiSelectOption as ve, Flex as W, Tooltip as Se, Grid as A, NumberInput as Ae, TextInput as j, Button as z, Loader as we } from "@strapi/design-system";
|
|
10
10
|
import { Information as Re, Check as X } from "@strapi/icons";
|
|
11
|
-
import { isEqual as
|
|
11
|
+
import { isEqual as Pe } from "lodash";
|
|
12
12
|
import { T as Q, A as Z } from "./TruncatedTypography-Df3hMZdB.mjs";
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
targetEnvApiKey:
|
|
16
|
-
targetEnvApiUrl:
|
|
17
|
-
comparisonDepth:
|
|
18
|
-
contentTypes:
|
|
13
|
+
const De = 3, w = m.enum(["Related", "Promotable"]);
|
|
14
|
+
m.object({
|
|
15
|
+
targetEnvApiKey: m.string().optional(),
|
|
16
|
+
targetEnvApiUrl: m.url().optional(),
|
|
17
|
+
comparisonDepth: m.number().positive().optional(),
|
|
18
|
+
contentTypes: m.array(m.object({ uid: m.string(), key: m.string(), kind: w })).optional()
|
|
19
19
|
});
|
|
20
20
|
const Fe = () => {
|
|
21
|
-
const { get: e } =
|
|
22
|
-
return
|
|
23
|
-
queryKey: [
|
|
21
|
+
const { get: e } = P();
|
|
22
|
+
return _({
|
|
23
|
+
queryKey: [K],
|
|
24
24
|
queryFn: async () => {
|
|
25
|
-
const { data: n } = await e(`/${
|
|
25
|
+
const { data: n } = await e(`/${D}/settings`);
|
|
26
26
|
return n;
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
-
},
|
|
30
|
-
|
|
29
|
+
}, Ue = [
|
|
30
|
+
K,
|
|
31
31
|
"content-type-options"
|
|
32
|
-
],
|
|
33
|
-
const { get: e } =
|
|
34
|
-
return
|
|
35
|
-
queryKey:
|
|
32
|
+
], Ke = () => {
|
|
33
|
+
const { get: e } = P();
|
|
34
|
+
return _({
|
|
35
|
+
queryKey: Ue,
|
|
36
36
|
queryFn: async () => {
|
|
37
37
|
const { data: n } = await e(
|
|
38
|
-
`/${
|
|
38
|
+
`/${D}/settings/content-type-options`
|
|
39
39
|
);
|
|
40
40
|
return n;
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
}, ke = (e) => [
|
|
43
|
+
}, ke = (e) => [K, "related-content-types", e], Ie = (e, n) => ge({
|
|
44
44
|
queryKey: ke(n),
|
|
45
45
|
queryFn: async () => {
|
|
46
46
|
const { data: r } = await e(
|
|
47
|
-
`/${
|
|
47
|
+
`/${D}/settings/related-content-types`,
|
|
48
48
|
{
|
|
49
49
|
params: {
|
|
50
50
|
allowed: n.join(",")
|
|
@@ -53,40 +53,40 @@ const Fe = () => {
|
|
|
53
53
|
);
|
|
54
54
|
return r;
|
|
55
55
|
}
|
|
56
|
-
}),
|
|
57
|
-
const { get: n } =
|
|
58
|
-
return
|
|
59
|
-
...
|
|
56
|
+
}), M = (e) => {
|
|
57
|
+
const { get: n } = P();
|
|
58
|
+
return _({
|
|
59
|
+
...Ie(n, e),
|
|
60
60
|
enabled: e.length > 0
|
|
61
61
|
});
|
|
62
62
|
}, Le = () => {
|
|
63
|
-
const { put: e } =
|
|
64
|
-
return
|
|
65
|
-
mutationFn: async (r) => e(`/${
|
|
63
|
+
const { put: e } = P(), n = he();
|
|
64
|
+
return H({
|
|
65
|
+
mutationFn: async (r) => e(`/${D}/settings`, r),
|
|
66
66
|
onSuccess: async () => {
|
|
67
67
|
await Promise.all([
|
|
68
|
-
n.invalidateQueries({ queryKey: [
|
|
68
|
+
n.invalidateQueries({ queryKey: [K] }),
|
|
69
69
|
n.invalidateQueries({ queryKey: [le] })
|
|
70
70
|
]);
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
-
},
|
|
73
|
+
}, qe = (e, n) => Object.entries(n).reduce((r, [o, i]) => Pe(i, e[o]) ? r : {
|
|
74
74
|
...r,
|
|
75
|
-
[
|
|
76
|
-
}, {}), J =
|
|
77
|
-
allowedContentTypes:
|
|
78
|
-
contentTypeSettings:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
key:
|
|
75
|
+
[o]: i
|
|
76
|
+
}, {}), J = m.object({
|
|
77
|
+
allowedContentTypes: m.array(m.string()).min(1, { message: "settings.form.error.minimalArrayLength" }),
|
|
78
|
+
contentTypeSettings: m.record(
|
|
79
|
+
m.string(),
|
|
80
|
+
m.object({
|
|
81
|
+
key: m.string({ message: "settings.form.error.required" }).min(1, { message: "settings.form.error.required" }).optional()
|
|
82
82
|
}).optional()
|
|
83
83
|
),
|
|
84
|
-
targetEnvApiKey:
|
|
85
|
-
targetEnvApiUrl:
|
|
86
|
-
comparisonDepth:
|
|
87
|
-
}),
|
|
88
|
-
relatedContentTypes:
|
|
89
|
-
}),
|
|
84
|
+
targetEnvApiKey: m.string({ message: "settings.form.error.required" }).min(1, { message: "settings.form.error.required" }),
|
|
85
|
+
targetEnvApiUrl: m.url({ message: "settings.form.error.validURL" }),
|
|
86
|
+
comparisonDepth: m.number({ message: "settings.form.error.required" }).positive({ message: "settings.form.error.positive" })
|
|
87
|
+
}), Ve = J.extend({
|
|
88
|
+
relatedContentTypes: m.string().array()
|
|
89
|
+
}), _e = Ve.refine(
|
|
90
90
|
(e) => [
|
|
91
91
|
...e.allowedContentTypes,
|
|
92
92
|
...e.relatedContentTypes
|
|
@@ -100,54 +100,54 @@ const Fe = () => {
|
|
|
100
100
|
return J.pick({ contentTypeSettings: !0 }).safeParse(e.value).success;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
),
|
|
103
|
+
), Me = (e, n) => {
|
|
104
104
|
const r = [...e.allowedContentTypes, ...n];
|
|
105
105
|
return {
|
|
106
106
|
...e,
|
|
107
107
|
contentTypeSettings: Object.fromEntries(
|
|
108
|
-
r.map((
|
|
109
|
-
|
|
110
|
-
e.contentTypeSettings[
|
|
108
|
+
r.map((o) => [
|
|
109
|
+
o,
|
|
110
|
+
e.contentTypeSettings[o]
|
|
111
111
|
])
|
|
112
112
|
)
|
|
113
113
|
};
|
|
114
|
-
}, ee = (e) => e.replace(".", ":"),
|
|
115
|
-
const
|
|
116
|
-
...
|
|
114
|
+
}, ee = (e) => e.replace(".", ":"), V = (e) => e.replace(/:(?!.*:)/, "."), Ne = (e, n) => {
|
|
115
|
+
const o = {
|
|
116
|
+
...Me(n, e),
|
|
117
117
|
relatedContentTypes: e
|
|
118
|
-
}, i =
|
|
118
|
+
}, i = _e.parse(o);
|
|
119
119
|
return {
|
|
120
120
|
contentTypes: [
|
|
121
121
|
...i.allowedContentTypes,
|
|
122
122
|
...i.relatedContentTypes
|
|
123
|
-
].map((
|
|
124
|
-
uid:
|
|
125
|
-
key: i.contentTypeSettings[
|
|
126
|
-
kind: i.allowedContentTypes.includes(
|
|
123
|
+
].map((l) => ({
|
|
124
|
+
uid: V(l),
|
|
125
|
+
key: i.contentTypeSettings[l]?.key,
|
|
126
|
+
kind: i.allowedContentTypes.includes(l) ? w.enum.Promotable : w.enum.Related
|
|
127
127
|
})),
|
|
128
128
|
targetEnvApiKey: i.targetEnvApiKey,
|
|
129
129
|
targetEnvApiUrl: i.targetEnvApiUrl,
|
|
130
130
|
comparisonDepth: i.comparisonDepth
|
|
131
131
|
};
|
|
132
|
-
},
|
|
132
|
+
}, xe = {
|
|
133
133
|
background: "neutral0",
|
|
134
134
|
hasRadius: !0,
|
|
135
135
|
shadow: "filterShadow",
|
|
136
136
|
padding: 6,
|
|
137
137
|
width: "100%"
|
|
138
|
-
},
|
|
139
|
-
const { formatMessage:
|
|
140
|
-
([c,
|
|
138
|
+
}, N = ({ children: e, marginTop: n }) => /* @__PURE__ */ t(E, { ...xe, marginTop: n, children: e }), Oe = ({ onChange: e, attributes: n, value: r, name: o, error: i, disabled: d = !1 }) => {
|
|
139
|
+
const { formatMessage: l } = b(), g = Object.entries(n).filter(
|
|
140
|
+
([c, s]) => s.type === "uid" || s.unique === !0
|
|
141
141
|
);
|
|
142
142
|
return ce(() => {
|
|
143
|
-
!r &&
|
|
144
|
-
}, []), /* @__PURE__ */ t($, { children:
|
|
145
|
-
/* @__PURE__ */ t(ye, { name:
|
|
143
|
+
!r && g.length > 0 && e("");
|
|
144
|
+
}, []), /* @__PURE__ */ t($, { children: g.length > 0 ? /* @__PURE__ */ u(h.Root, { error: i && l({ id: a(i) }), children: [
|
|
145
|
+
/* @__PURE__ */ t(ye, { name: o, value: r, onChange: e, required: !0, disabled: d, children: g.map(([c, s]) => /* @__PURE__ */ t(Te, { value: c, children: c }, c)) }),
|
|
146
146
|
/* @__PURE__ */ t(h.Error, {})
|
|
147
147
|
] }) : /* @__PURE__ */ t(
|
|
148
148
|
h.Root,
|
|
149
149
|
{
|
|
150
|
-
error:
|
|
150
|
+
error: l({ id: a("settings.table.uniqueKeyRequiredWarning") }),
|
|
151
151
|
children: /* @__PURE__ */ t(h.Error, {})
|
|
152
152
|
}
|
|
153
153
|
) });
|
|
@@ -155,24 +155,24 @@ const Fe = () => {
|
|
|
155
155
|
label: e,
|
|
156
156
|
contentTypes: n,
|
|
157
157
|
setFormValue: r,
|
|
158
|
-
errors:
|
|
158
|
+
errors: o,
|
|
159
159
|
contentTypeSettings: i,
|
|
160
160
|
shouldShowRequiredBy: d,
|
|
161
|
-
isReadOnly:
|
|
161
|
+
isReadOnly: l
|
|
162
162
|
}) => {
|
|
163
|
-
const { formatMessage:
|
|
164
|
-
return /* @__PURE__ */ u(
|
|
165
|
-
/* @__PURE__ */ t(
|
|
163
|
+
const { formatMessage: g } = b();
|
|
164
|
+
return /* @__PURE__ */ u(E, { marginTop: 4, width: "100%", paddingTop: 4, children: [
|
|
165
|
+
/* @__PURE__ */ t(E, { marginBottom: 1, children: /* @__PURE__ */ t(C, { variant: "pi", textColor: "neutral800", fontWeight: "bold", children: e }) }),
|
|
166
166
|
/* @__PURE__ */ u(fe, { width: "100%", rowCount: n.length, colCount: d ? 3 : 2, children: [
|
|
167
|
-
/* @__PURE__ */ t(
|
|
168
|
-
/* @__PURE__ */ t(L, { children: /* @__PURE__ */ t(C, { variant: "sigma", children:
|
|
169
|
-
d && /* @__PURE__ */ t(L, { children: /* @__PURE__ */ t(C, { variant: "sigma", children:
|
|
170
|
-
/* @__PURE__ */ t(L, { children: /* @__PURE__ */ t(C, { variant: "sigma", children:
|
|
167
|
+
/* @__PURE__ */ t(be, { children: /* @__PURE__ */ u(O, { children: [
|
|
168
|
+
/* @__PURE__ */ t(L, { children: /* @__PURE__ */ t(C, { variant: "sigma", children: g({ id: a("settings.table.contentType") }) }) }),
|
|
169
|
+
d && /* @__PURE__ */ t(L, { children: /* @__PURE__ */ t(C, { variant: "sigma", children: g({ id: a("settings.table.requiredBy") }) }) }),
|
|
170
|
+
/* @__PURE__ */ t(L, { children: /* @__PURE__ */ t(C, { variant: "sigma", children: g({ id: a("settings.table.uniqueKey") }) }) })
|
|
171
171
|
] }) }),
|
|
172
|
-
/* @__PURE__ */ t(
|
|
173
|
-
const
|
|
174
|
-
return /* @__PURE__ */ u(
|
|
175
|
-
/* @__PURE__ */ t(
|
|
172
|
+
/* @__PURE__ */ t(Ce, { children: n.map((c) => {
|
|
173
|
+
const s = `contentTypeSettings.${c.uid}.key`;
|
|
174
|
+
return /* @__PURE__ */ u(O, { children: [
|
|
175
|
+
/* @__PURE__ */ t(q, { width: d ? "25%" : "50%", children: /* @__PURE__ */ t(
|
|
176
176
|
Q,
|
|
177
177
|
{
|
|
178
178
|
maxCharacters: 55,
|
|
@@ -180,7 +180,7 @@ const Fe = () => {
|
|
|
180
180
|
textColor: "neutral800"
|
|
181
181
|
}
|
|
182
182
|
) }),
|
|
183
|
-
d && /* @__PURE__ */ t(
|
|
183
|
+
d && /* @__PURE__ */ t(q, { width: "25%", children: /* @__PURE__ */ t(
|
|
184
184
|
Q,
|
|
185
185
|
{
|
|
186
186
|
maxCharacters: 55,
|
|
@@ -188,17 +188,17 @@ const Fe = () => {
|
|
|
188
188
|
textColor: "neutral800"
|
|
189
189
|
}
|
|
190
190
|
) }),
|
|
191
|
-
/* @__PURE__ */ t(
|
|
192
|
-
|
|
191
|
+
/* @__PURE__ */ t(q, { width: "50%", children: /* @__PURE__ */ t(
|
|
192
|
+
Oe,
|
|
193
193
|
{
|
|
194
|
-
onChange: (
|
|
195
|
-
r(
|
|
194
|
+
onChange: (p) => {
|
|
195
|
+
r(s, p);
|
|
196
196
|
},
|
|
197
197
|
value: i[c.uid]?.key,
|
|
198
198
|
attributes: c.schema.attributes,
|
|
199
|
-
name:
|
|
200
|
-
error: s
|
|
201
|
-
disabled:
|
|
199
|
+
name: s,
|
|
200
|
+
error: o[s],
|
|
201
|
+
disabled: l
|
|
202
202
|
}
|
|
203
203
|
) })
|
|
204
204
|
] }, c.uid);
|
|
@@ -209,34 +209,34 @@ const Fe = () => {
|
|
|
209
209
|
allowedContentTypes: e,
|
|
210
210
|
contentTypeSettings: n,
|
|
211
211
|
setFormValue: r,
|
|
212
|
-
promotableContentTypes:
|
|
212
|
+
promotableContentTypes: o,
|
|
213
213
|
errors: i,
|
|
214
214
|
isReadOnly: d
|
|
215
215
|
}) => {
|
|
216
|
-
const { formatMessage:
|
|
217
|
-
(
|
|
218
|
-
), { data: c, isLoading:
|
|
219
|
-
return
|
|
220
|
-
/* @__PURE__ */ t(C, { variant: "delta", children:
|
|
221
|
-
/* @__PURE__ */ t(
|
|
216
|
+
const { formatMessage: l } = b(), g = e.map(
|
|
217
|
+
(p) => o?.find((y) => y.uid === p)
|
|
218
|
+
), { data: c, isLoading: s } = M(e);
|
|
219
|
+
return s ? null : /* @__PURE__ */ u(N, { children: [
|
|
220
|
+
/* @__PURE__ */ t(C, { variant: "delta", children: l({ id: a("settings.allowedContentTypes") }) }),
|
|
221
|
+
/* @__PURE__ */ t(E, { marginTop: 4, width: "100%", children: /* @__PURE__ */ u(
|
|
222
222
|
h.Root,
|
|
223
223
|
{
|
|
224
224
|
width: "100%",
|
|
225
|
-
error: i.allowedContentTypes &&
|
|
225
|
+
error: i.allowedContentTypes && l({ id: a(i.allowedContentTypes) }),
|
|
226
226
|
children: [
|
|
227
|
-
/* @__PURE__ */ t(h.Label, { children:
|
|
227
|
+
/* @__PURE__ */ t(h.Label, { children: l({ id: a("settings.allowedContentTypes.label") }) }),
|
|
228
228
|
/* @__PURE__ */ t(
|
|
229
|
-
|
|
229
|
+
Ee,
|
|
230
230
|
{
|
|
231
231
|
withTags: !0,
|
|
232
232
|
name: "allowedContentTypes",
|
|
233
233
|
value: e,
|
|
234
|
-
onChange: (
|
|
235
|
-
r("allowedContentTypes",
|
|
234
|
+
onChange: (p) => {
|
|
235
|
+
r("allowedContentTypes", p);
|
|
236
236
|
},
|
|
237
237
|
hasError: !!i.allowedContentTypes,
|
|
238
238
|
disabled: d,
|
|
239
|
-
children:
|
|
239
|
+
children: o?.map((p) => /* @__PURE__ */ t(ve, { value: p.uid, children: p.schema.displayName }, p.uid))
|
|
240
240
|
}
|
|
241
241
|
),
|
|
242
242
|
/* @__PURE__ */ t(h.Error, {})
|
|
@@ -246,10 +246,10 @@ const Fe = () => {
|
|
|
246
246
|
e?.length > 0 && /* @__PURE__ */ t(
|
|
247
247
|
B,
|
|
248
248
|
{
|
|
249
|
-
label:
|
|
249
|
+
label: l({
|
|
250
250
|
id: a("settings.table.keyForEligibleContentTypes")
|
|
251
251
|
}),
|
|
252
|
-
contentTypes:
|
|
252
|
+
contentTypes: g,
|
|
253
253
|
setFormValue: r,
|
|
254
254
|
errors: i,
|
|
255
255
|
contentTypeSettings: n,
|
|
@@ -259,7 +259,7 @@ const Fe = () => {
|
|
|
259
259
|
(c?.length ?? 0) > 0 && /* @__PURE__ */ t(
|
|
260
260
|
B,
|
|
261
261
|
{
|
|
262
|
-
label:
|
|
262
|
+
label: l({
|
|
263
263
|
id: a("settings.table.keyForRelatedContentTypes")
|
|
264
264
|
}),
|
|
265
265
|
contentTypes: c ?? [],
|
|
@@ -272,8 +272,8 @@ const Fe = () => {
|
|
|
272
272
|
)
|
|
273
273
|
] });
|
|
274
274
|
}, Qe = () => {
|
|
275
|
-
const { formatMessage: e } =
|
|
276
|
-
return /* @__PURE__ */ t(
|
|
275
|
+
const { formatMessage: e } = b();
|
|
276
|
+
return /* @__PURE__ */ t(E, { marginTop: 4, children: /* @__PURE__ */ t(
|
|
277
277
|
Z,
|
|
278
278
|
{
|
|
279
279
|
title: e({ id: a("settings.alert.comparisonDepthHigh.title") }),
|
|
@@ -283,10 +283,10 @@ const Fe = () => {
|
|
|
283
283
|
})
|
|
284
284
|
}
|
|
285
285
|
) });
|
|
286
|
-
}, Be = ({ comparisonDepth: e, setFormValue: n, errors: r, isReadOnly:
|
|
287
|
-
const { formatMessage: i } =
|
|
288
|
-
return /* @__PURE__ */ u(
|
|
289
|
-
/* @__PURE__ */ u(
|
|
286
|
+
}, Be = ({ comparisonDepth: e, setFormValue: n, errors: r, isReadOnly: o }) => {
|
|
287
|
+
const { formatMessage: i } = b();
|
|
288
|
+
return /* @__PURE__ */ u(N, { marginTop: 4, children: [
|
|
289
|
+
/* @__PURE__ */ u(W, { marginBottom: 4, gap: 1, children: [
|
|
290
290
|
/* @__PURE__ */ t(C, { variant: "delta", children: i({ id: a("settings.comparisonDepth") }) }),
|
|
291
291
|
/* @__PURE__ */ t(Se, { label: i({ id: a("settings.comparisonDepth.tooltip") }), children: /* @__PURE__ */ t(Re, {}) })
|
|
292
292
|
] }),
|
|
@@ -303,7 +303,7 @@ const Fe = () => {
|
|
|
303
303
|
value: e,
|
|
304
304
|
onValueChange: (d) => n("comparisonDepth", d),
|
|
305
305
|
name: "comparisonDepth",
|
|
306
|
-
disabled:
|
|
306
|
+
disabled: o
|
|
307
307
|
}
|
|
308
308
|
),
|
|
309
309
|
/* @__PURE__ */ t(h.Error, {})
|
|
@@ -313,17 +313,17 @@ const Fe = () => {
|
|
|
313
313
|
e > 5 && /* @__PURE__ */ t(Qe, {})
|
|
314
314
|
] });
|
|
315
315
|
}, Ye = ({ staleValueMessages: e }) => {
|
|
316
|
-
const { formatMessage: n } =
|
|
317
|
-
return /* @__PURE__ */ t(
|
|
316
|
+
const { formatMessage: n } = b();
|
|
317
|
+
return /* @__PURE__ */ t(E, { marginBottom: 4, children: /* @__PURE__ */ u(
|
|
318
318
|
Z,
|
|
319
319
|
{
|
|
320
320
|
title: n({ id: a("settings.alert.staleValuesRemoved.title") }),
|
|
321
321
|
variant: "danger",
|
|
322
322
|
children: [
|
|
323
323
|
n({ id: a("settings.alert.staleValuesRemoved.description") }),
|
|
324
|
-
e.map((r,
|
|
324
|
+
e.map((r, o) => /* @__PURE__ */ u("span", { children: [
|
|
325
325
|
/* @__PURE__ */ t("br", {}),
|
|
326
|
-
|
|
326
|
+
o + 1,
|
|
327
327
|
".",
|
|
328
328
|
" ",
|
|
329
329
|
n(
|
|
@@ -332,46 +332,56 @@ const Fe = () => {
|
|
|
332
332
|
},
|
|
333
333
|
r.variables
|
|
334
334
|
)
|
|
335
|
-
] },
|
|
335
|
+
] }, o))
|
|
336
336
|
]
|
|
337
337
|
}
|
|
338
338
|
) });
|
|
339
339
|
}, $e = () => {
|
|
340
|
-
const { post: e } =
|
|
341
|
-
return
|
|
340
|
+
const { post: e } = P();
|
|
341
|
+
return H({
|
|
342
342
|
mutationFn: async (n) => {
|
|
343
343
|
const { data: r } = await e(
|
|
344
|
-
`/${
|
|
344
|
+
`/${D}/settings/testConnection`,
|
|
345
345
|
n
|
|
346
346
|
);
|
|
347
347
|
return r;
|
|
348
348
|
}
|
|
349
349
|
});
|
|
350
|
-
},
|
|
351
|
-
|
|
352
|
-
|
|
350
|
+
}, Ge = "settings.form.error.badApiUrl", He = {
|
|
351
|
+
badApiKey: "settings.form.error.badApiKey",
|
|
352
|
+
badPermissions: "settings.form.error.badKeyPermissions"
|
|
353
353
|
}, We = ({
|
|
354
354
|
targetEnvApiKey: e,
|
|
355
355
|
targetEnvApiUrl: n,
|
|
356
356
|
setFormValue: r,
|
|
357
|
-
errors:
|
|
357
|
+
errors: o,
|
|
358
358
|
isReadOnly: i
|
|
359
359
|
}) => {
|
|
360
|
-
const { formatMessage: d } =
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
360
|
+
const { formatMessage: d } = b(), l = $e(), { setErrors: g } = re("TargetEnvConfigurationSection", (y) => y), c = async () => {
|
|
361
|
+
const y = (f) => {
|
|
362
|
+
g({
|
|
363
|
+
...o,
|
|
364
|
+
targetEnvApiUrl: f.outcome === "badUrl" ? Ge : void 0,
|
|
365
|
+
targetEnvApiKey: He[f.outcome]
|
|
366
|
+
});
|
|
367
|
+
};
|
|
368
|
+
try {
|
|
369
|
+
const f = await l.mutateAsync({
|
|
370
|
+
targetEnvApiKey: e,
|
|
371
|
+
targetEnvApiUrl: n
|
|
372
|
+
});
|
|
373
|
+
y(f);
|
|
374
|
+
} catch {
|
|
375
|
+
y({ outcome: "unexpected" });
|
|
376
|
+
}
|
|
377
|
+
}, s = l.isSuccess && l.data?.outcome === "reachable", p = l.isError || l.data?.outcome === "unexpected";
|
|
378
|
+
return /* @__PURE__ */ u(N, { marginTop: 4, children: [
|
|
379
|
+
/* @__PURE__ */ t(E, { marginBottom: 4, children: /* @__PURE__ */ t(C, { variant: "delta", children: d({ id: a("settings.targetEnvConfiguration") }) }) }),
|
|
370
380
|
/* @__PURE__ */ u(A.Root, { gap: 4, children: [
|
|
371
381
|
/* @__PURE__ */ t(A.Item, { col: 6, alignItems: "start", children: /* @__PURE__ */ u(
|
|
372
382
|
h.Root,
|
|
373
383
|
{
|
|
374
|
-
error:
|
|
384
|
+
error: o.targetEnvApiUrl && d({ id: a(o.targetEnvApiUrl) }),
|
|
375
385
|
width: "100%",
|
|
376
386
|
children: [
|
|
377
387
|
/* @__PURE__ */ t(h.Label, { children: d({ id: a("settings.targetEnvApiUrl.label") }) }),
|
|
@@ -391,7 +401,7 @@ const Fe = () => {
|
|
|
391
401
|
/* @__PURE__ */ t(A.Item, { col: 6, alignItems: "start", children: /* @__PURE__ */ u(
|
|
392
402
|
h.Root,
|
|
393
403
|
{
|
|
394
|
-
error:
|
|
404
|
+
error: o.targetEnvApiKey && d({ id: a(o.targetEnvApiKey) }),
|
|
395
405
|
width: "100%",
|
|
396
406
|
children: [
|
|
397
407
|
/* @__PURE__ */ t(h.Label, { children: d({ id: a("settings.targetEnvApiKey.label") }) }),
|
|
@@ -409,79 +419,80 @@ const Fe = () => {
|
|
|
409
419
|
}
|
|
410
420
|
) }),
|
|
411
421
|
/* @__PURE__ */ u(A.Item, { col: 6, children: [
|
|
412
|
-
i ? null : /* @__PURE__ */ t(z, { onClick: c, disabled:
|
|
413
|
-
/* @__PURE__ */ u(
|
|
414
|
-
|
|
415
|
-
|
|
422
|
+
i ? null : /* @__PURE__ */ t(z, { onClick: c, disabled: l.isPending, children: d({ id: a("settings.form.testConnection") }) }),
|
|
423
|
+
/* @__PURE__ */ u(W, { marginLeft: 1, alignItems: "center", gap: 2, children: [
|
|
424
|
+
l.isPending && /* @__PURE__ */ t(we, { small: !0 }),
|
|
425
|
+
s && /* @__PURE__ */ t(X, { color: "#5cb176" }),
|
|
426
|
+
p && /* @__PURE__ */ t(C, { variant: "pi", textColor: "danger600", children: d({ id: a("settings.form.error.connectionFailed") }) })
|
|
416
427
|
] })
|
|
417
428
|
] })
|
|
418
429
|
] })
|
|
419
430
|
] });
|
|
420
|
-
},
|
|
431
|
+
}, ze = ({
|
|
421
432
|
values: e,
|
|
422
433
|
onChange: n,
|
|
423
434
|
errors: r,
|
|
424
|
-
setErrors:
|
|
435
|
+
setErrors: o,
|
|
425
436
|
modified: i,
|
|
426
437
|
settings: d,
|
|
427
|
-
promotableContentTypes:
|
|
428
|
-
staleValuesMessages:
|
|
438
|
+
promotableContentTypes: l,
|
|
439
|
+
staleValuesMessages: g,
|
|
429
440
|
isReadOnly: c
|
|
430
441
|
}) => {
|
|
431
|
-
const { formatMessage:
|
|
442
|
+
const { formatMessage: s } = b(), { toggleNotification: p } = se(), y = Le(), { data: f = [], isFetching: F } = M(e.allowedContentTypes), k = async () => {
|
|
432
443
|
try {
|
|
433
|
-
const
|
|
434
|
-
await
|
|
444
|
+
const v = f.map((S) => S.uid), R = Ne(v, e), T = qe(d, R);
|
|
445
|
+
await y.mutateAsync(T, {
|
|
435
446
|
onSuccess: () => {
|
|
436
|
-
|
|
447
|
+
o({}), p({
|
|
437
448
|
type: "success",
|
|
438
|
-
message:
|
|
449
|
+
message: s({ id: a("settings.form.savedSuccessfully") })
|
|
439
450
|
});
|
|
440
451
|
}
|
|
441
452
|
});
|
|
442
|
-
} catch (
|
|
443
|
-
if (
|
|
444
|
-
const R =
|
|
445
|
-
|
|
453
|
+
} catch (v) {
|
|
454
|
+
if (v instanceof me.ZodError) {
|
|
455
|
+
const R = v.issues.reduce((T, S) => (T[S.path.join(".")] = S.message, T), {});
|
|
456
|
+
o(R), p({
|
|
446
457
|
type: "warning",
|
|
447
|
-
message:
|
|
458
|
+
message: s({ id: a("settings.form.error.validationMessage") })
|
|
448
459
|
});
|
|
449
460
|
} else
|
|
450
|
-
|
|
461
|
+
p({
|
|
451
462
|
type: "warning",
|
|
452
|
-
message:
|
|
463
|
+
message: s({ id: a("settings.form.error.other") })
|
|
453
464
|
});
|
|
454
465
|
}
|
|
455
|
-
},
|
|
466
|
+
}, I = c || !i && g.length === 0 || F || y.isPending;
|
|
456
467
|
return /* @__PURE__ */ u($, { children: [
|
|
457
468
|
/* @__PURE__ */ t(
|
|
458
|
-
|
|
469
|
+
x.Header,
|
|
459
470
|
{
|
|
460
|
-
title:
|
|
461
|
-
subtitle:
|
|
471
|
+
title: s({ id: a("settings.title") }),
|
|
472
|
+
subtitle: s({ id: a("settings.subtitle") }),
|
|
462
473
|
primaryAction: c ? null : /* @__PURE__ */ t(
|
|
463
474
|
z,
|
|
464
475
|
{
|
|
465
476
|
type: "submit",
|
|
466
477
|
startIcon: /* @__PURE__ */ t(X, {}),
|
|
467
478
|
onClick: k,
|
|
468
|
-
disabled:
|
|
469
|
-
children:
|
|
479
|
+
disabled: I,
|
|
480
|
+
children: s({
|
|
470
481
|
id: a("settings.form.submit")
|
|
471
482
|
})
|
|
472
483
|
}
|
|
473
484
|
)
|
|
474
485
|
}
|
|
475
486
|
),
|
|
476
|
-
/* @__PURE__ */ u(
|
|
477
|
-
|
|
487
|
+
/* @__PURE__ */ u(x.Content, { children: [
|
|
488
|
+
g.length > 0 && /* @__PURE__ */ t(Ye, { staleValueMessages: g }),
|
|
478
489
|
/* @__PURE__ */ t(
|
|
479
490
|
je,
|
|
480
491
|
{
|
|
481
492
|
allowedContentTypes: e.allowedContentTypes,
|
|
482
493
|
contentTypeSettings: e.contentTypeSettings,
|
|
483
494
|
setFormValue: n,
|
|
484
|
-
promotableContentTypes:
|
|
495
|
+
promotableContentTypes: l,
|
|
485
496
|
errors: r,
|
|
486
497
|
isReadOnly: c
|
|
487
498
|
}
|
|
@@ -508,80 +519,80 @@ const Fe = () => {
|
|
|
508
519
|
] })
|
|
509
520
|
] });
|
|
510
521
|
}, Y = (e) => {
|
|
511
|
-
const n = e.contentTypes ?? [], r = n.filter((i) => i.kind === w.enum.Promotable).map((i) => i.uid),
|
|
522
|
+
const n = e.contentTypes ?? [], r = n.filter((i) => i.kind === w.enum.Promotable).map((i) => i.uid), o = Object.fromEntries(
|
|
512
523
|
n.map((i) => [i.uid, { key: i.key }])
|
|
513
524
|
);
|
|
514
525
|
return {
|
|
515
526
|
allowedContentTypes: r,
|
|
516
|
-
contentTypeSettings:
|
|
527
|
+
contentTypeSettings: o,
|
|
517
528
|
targetEnvApiKey: e?.targetEnvApiKey ?? "",
|
|
518
529
|
targetEnvApiUrl: e?.targetEnvApiUrl ?? "",
|
|
519
|
-
comparisonDepth: e?.comparisonDepth ??
|
|
530
|
+
comparisonDepth: e?.comparisonDepth ?? De
|
|
520
531
|
};
|
|
521
|
-
},
|
|
532
|
+
}, Xe = (e, n, r) => {
|
|
522
533
|
if (!e.contentTypes)
|
|
523
534
|
return [Y(e), []];
|
|
524
|
-
const
|
|
525
|
-
...
|
|
526
|
-
uid: ee(
|
|
527
|
-
})), d = n.map((
|
|
528
|
-
(
|
|
529
|
-
const
|
|
530
|
-
return
|
|
535
|
+
const o = [], i = e.contentTypes.map((s) => ({
|
|
536
|
+
...s,
|
|
537
|
+
uid: ee(s.uid)
|
|
538
|
+
})), d = n.map((s) => s.uid), g = i.filter(
|
|
539
|
+
(s) => {
|
|
540
|
+
const p = !d.includes(s.uid);
|
|
541
|
+
return p && o.push({
|
|
531
542
|
message: "settings.alert.staleValuesRemoved.contentTypeDeleted",
|
|
532
|
-
variables: { uid:
|
|
533
|
-
}), !
|
|
543
|
+
variables: { uid: V(s.uid) }
|
|
544
|
+
}), !p;
|
|
534
545
|
}
|
|
535
|
-
).filter((
|
|
536
|
-
const
|
|
537
|
-
return
|
|
546
|
+
).filter((s) => {
|
|
547
|
+
const p = !r.includes(s.uid) && s.kind === w.enum.Related;
|
|
548
|
+
return p && o.push({
|
|
538
549
|
message: "settings.alert.staleValuesRemoved.relationDeleted",
|
|
539
|
-
variables: { uid:
|
|
540
|
-
}), !
|
|
541
|
-
}).map((
|
|
542
|
-
const
|
|
543
|
-
(F) => F.uid ===
|
|
544
|
-
),
|
|
545
|
-
return
|
|
550
|
+
variables: { uid: V(s.uid) }
|
|
551
|
+
}), !p;
|
|
552
|
+
}).map((s) => {
|
|
553
|
+
const p = n.find(
|
|
554
|
+
(F) => F.uid === s.uid
|
|
555
|
+
), y = p?.schema.attributes[s.key], f = y?.type === "uid" || y?.unique === !0;
|
|
556
|
+
return f || o.push({
|
|
546
557
|
message: "settings.alert.staleValuesRemoved.keyDeleted",
|
|
547
558
|
variables: {
|
|
548
|
-
key:
|
|
549
|
-
schemaDisplayName:
|
|
559
|
+
key: s.key,
|
|
560
|
+
schemaDisplayName: p?.schema.displayName
|
|
550
561
|
}
|
|
551
562
|
}), {
|
|
552
|
-
...
|
|
553
|
-
key:
|
|
563
|
+
...s,
|
|
564
|
+
key: f ? s.key : void 0
|
|
554
565
|
};
|
|
555
566
|
});
|
|
556
567
|
return [Y({
|
|
557
568
|
...e,
|
|
558
|
-
contentTypes:
|
|
559
|
-
}),
|
|
560
|
-
},
|
|
561
|
-
const { formatMessage: e } =
|
|
569
|
+
contentTypes: g
|
|
570
|
+
}), o];
|
|
571
|
+
}, Ze = () => {
|
|
572
|
+
const { formatMessage: e } = b(), n = pe(null), {
|
|
562
573
|
isLoading: r,
|
|
563
|
-
allowedActions: { canUpdate:
|
|
564
|
-
} = oe([...
|
|
565
|
-
() => (i?.contentTypes ?? []).filter((
|
|
574
|
+
allowedActions: { canUpdate: o }
|
|
575
|
+
} = oe([...G.settingsUpdate]), { data: i, isLoading: d } = Fe(), { data: l, isLoading: g } = Ke(), c = ue(
|
|
576
|
+
() => (i?.contentTypes ?? []).filter((T) => T.kind === w.enum.Promotable).map((T) => ee(T.uid)),
|
|
566
577
|
[i?.contentTypes]
|
|
567
578
|
), {
|
|
568
|
-
data:
|
|
569
|
-
isLoading:
|
|
570
|
-
isFetched:
|
|
571
|
-
} =
|
|
572
|
-
if (r || d ||
|
|
573
|
-
return /* @__PURE__ */ t(
|
|
574
|
-
const { promotableContentTypes: k, relationLookupContentTypes:
|
|
579
|
+
data: s = [],
|
|
580
|
+
isLoading: p,
|
|
581
|
+
isFetched: y
|
|
582
|
+
} = M(c), f = c.length === 0 || y;
|
|
583
|
+
if (r || d || g || p || !f || !i || !l)
|
|
584
|
+
return /* @__PURE__ */ t(U.Loading, {});
|
|
585
|
+
const { promotableContentTypes: k, relationLookupContentTypes: I } = l, [v, R] = Xe(
|
|
575
586
|
i,
|
|
576
|
-
|
|
577
|
-
|
|
587
|
+
I,
|
|
588
|
+
s.map((T) => T.uid)
|
|
578
589
|
);
|
|
579
|
-
return /* @__PURE__ */ u(
|
|
580
|
-
/* @__PURE__ */ t(
|
|
581
|
-
/* @__PURE__ */ t(ae, { width: "100%", height: "100%", ref: n, method: "PUT", initialValues:
|
|
582
|
-
|
|
590
|
+
return /* @__PURE__ */ u(U.Main, { children: [
|
|
591
|
+
/* @__PURE__ */ t(U.Title, { children: e({ id: a("settings.metadata.title") }) }),
|
|
592
|
+
/* @__PURE__ */ t(ae, { width: "100%", height: "100%", ref: n, method: "PUT", initialValues: v, children: ({ values: T, onChange: S, errors: te, setErrors: ne, modified: ie }) => /* @__PURE__ */ t(
|
|
593
|
+
ze,
|
|
583
594
|
{
|
|
584
|
-
values:
|
|
595
|
+
values: T,
|
|
585
596
|
onChange: S,
|
|
586
597
|
errors: te,
|
|
587
598
|
setErrors: ne,
|
|
@@ -589,11 +600,11 @@ const Fe = () => {
|
|
|
589
600
|
settings: i,
|
|
590
601
|
promotableContentTypes: k,
|
|
591
602
|
staleValuesMessages: R,
|
|
592
|
-
isReadOnly: !
|
|
603
|
+
isReadOnly: !o
|
|
593
604
|
}
|
|
594
605
|
) })
|
|
595
606
|
] });
|
|
596
|
-
},
|
|
607
|
+
}, pt = () => /* @__PURE__ */ t(U.Protect, { permissions: [...G.settingsRead], children: /* @__PURE__ */ t(de, { children: /* @__PURE__ */ t(Ze, {}) }) });
|
|
597
608
|
export {
|
|
598
|
-
|
|
609
|
+
pt as default
|
|
599
610
|
};
|