@sensinum/strapi-plugin-multi-domain 5.1.5 → 5.2.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/dist/_chunks/About-DNyaGrYn.mjs +435 -0
- package/dist/_chunks/About-DaPMT-kj.js +38 -0
- package/dist/_chunks/Settings-B823hBAu.mjs +23 -0
- package/dist/_chunks/Settings-B_1YuoN9.js +1 -0
- package/dist/_chunks/{TenantCustomField-CtCNZEgB.mjs → TenantCustomField-B9Ntpj-S.mjs} +1 -1
- package/dist/_chunks/{TenantCustomField-BYDxTP5y.js → TenantCustomField-CHUfO3Xh.js} +1 -1
- package/dist/_chunks/TenantEdit-BFvwBQFd.mjs +494 -0
- package/dist/_chunks/TenantEdit-Bkw_eaGW.js +1 -0
- package/dist/_chunks/TenantList-C9nnIaGg.js +1 -0
- package/dist/_chunks/TenantList-DRfWswjS.mjs +266 -0
- package/dist/_chunks/{en-BIUQvQi4.mjs → en-Cf69p5po.mjs} +43 -0
- package/dist/_chunks/en-hAVH8fH0.js +1 -0
- package/dist/_chunks/{index-DkEjJa1n.mjs → index-2nR8Jd1x.mjs} +32 -32
- package/dist/_chunks/{index-D9I-QR8y.js → index-Cvs1ZCFy.js} +1 -1
- package/dist/_chunks/index-DEoxiYwP.mjs +331 -0
- package/dist/_chunks/index-DuSOcmV4.js +1 -0
- package/dist/_chunks/useGetMessage-B1Xnqz3k.js +1 -0
- package/dist/_chunks/useGetMessage-K3OG9Tv0.mjs +15 -0
- package/dist/_chunks/useSettings-BCMuYsbx.js +1 -0
- package/dist/_chunks/useSettings-QOof9ZTx.mjs +11 -0
- package/dist/_chunks/{useTenants-CE8J0EOu.mjs → useTenants-CT-L6xX1.mjs} +38 -45
- package/dist/_chunks/useTenants-_putKXAO.js +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/server/index.js +4 -4
- package/dist/server/index.mjs +5467 -5332
- package/package.json +3 -1
- package/dist/_chunks/Settings-BPM919an.mjs +0 -23
- package/dist/_chunks/Settings-CT4xmD8_.js +0 -1
- package/dist/_chunks/TenantEdit-BdSUNboL.mjs +0 -494
- package/dist/_chunks/TenantEdit-C4LHKCAr.js +0 -1
- package/dist/_chunks/TenantList-Cl9445sU.js +0 -1
- package/dist/_chunks/TenantList-DWA0Z3-T.mjs +0 -272
- package/dist/_chunks/en-Dj_hyppO.js +0 -1
- package/dist/_chunks/index-Ck1YIRr4.js +0 -1
- package/dist/_chunks/index-Ds2z-yoa.mjs +0 -315
- package/dist/_chunks/useTenants-XMURO_eU.js +0 -1
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { jsx as e, jsxs as a, Fragment as A } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as g, Flex as q, Button as L, Typography as d, Td as f, Checkbox as I, Badge as te, IconButton as R, Tr as E, Loader as ne, EmptyStateLayout as ie, Table as oe, Thead as ae, Th as C, Tbody as re, Box as le } from "@strapi/design-system";
|
|
3
|
+
import { WarningCircle as se, Trash as W, ArrowUp as ce, ArrowDown as de, Pencil as he, Plus as me, Search as ge } from "@strapi/icons";
|
|
4
|
+
import { useNotification as ue, useQueryParams as pe, Page as D, Layouts as b, SearchInput as fe, Pagination as w } from "@strapi/strapi/admin";
|
|
5
|
+
import Ce, { useState as $ } from "react";
|
|
6
|
+
import { useNavigate as N } from "react-router-dom";
|
|
7
|
+
import { b as M, p as _, m as H, c as ye } from "./index-DEoxiYwP.mjs";
|
|
8
|
+
import { C as z, u as Se, a as Te } from "./useTenants-CT-L6xX1.mjs";
|
|
9
|
+
import be from "styled-components";
|
|
10
|
+
import { u as j } from "./useGetMessage-K3OG9Tv0.mjs";
|
|
11
|
+
import { u as ve } from "./useSettings-QOof9ZTx.mjs";
|
|
12
|
+
const ke = ({
|
|
13
|
+
isOpen: t,
|
|
14
|
+
onClose: i,
|
|
15
|
+
onConfirm: l,
|
|
16
|
+
target: r
|
|
17
|
+
}) => /* @__PURE__ */ e(g.Root, { open: t, onOpenChange: i, children: /* @__PURE__ */ a(g.Content, { children: [
|
|
18
|
+
/* @__PURE__ */ e(g.Header, { children: "Confirmation" }),
|
|
19
|
+
/* @__PURE__ */ e(g.Body, { icon: /* @__PURE__ */ e(W, {}), children: /* @__PURE__ */ e(g.Description, { textAlign: "center", children: /* @__PURE__ */ a(q, { gap: 2, direction: "column", children: [
|
|
20
|
+
/* @__PURE__ */ e(se, { fill: "danger600", width: "24", height: "24" }),
|
|
21
|
+
"Are you sure you want to delete this ",
|
|
22
|
+
r,
|
|
23
|
+
"?",
|
|
24
|
+
/* @__PURE__ */ e("br", {}),
|
|
25
|
+
"All your modifications will be lost"
|
|
26
|
+
] }) }) }),
|
|
27
|
+
/* @__PURE__ */ a(g.Footer, { children: [
|
|
28
|
+
/* @__PURE__ */ e(g.Action, { children: /* @__PURE__ */ e(L, { fullWidth: !0, onClick: i, variant: "tertiary", size: "S", children: /* @__PURE__ */ e(d, { variant: "omega", children: "Cancel" }) }) }),
|
|
29
|
+
/* @__PURE__ */ e(g.Action, { children: /* @__PURE__ */ e(L, { fullWidth: !0, onClick: l, variant: "danger", size: "S", children: /* @__PURE__ */ e(d, { variant: "omega", children: "Confirm" }) }) })
|
|
30
|
+
] })
|
|
31
|
+
] }) }), xe = ({
|
|
32
|
+
isDisplayed: t,
|
|
33
|
+
direction: i
|
|
34
|
+
}) => t ? i === "asc" ? /* @__PURE__ */ e(ce, {}) : /* @__PURE__ */ e(de, {}) : null, P = ({
|
|
35
|
+
label: t,
|
|
36
|
+
field: i,
|
|
37
|
+
sort: l,
|
|
38
|
+
onSort: r
|
|
39
|
+
}) => {
|
|
40
|
+
const [s, h] = l.split(":");
|
|
41
|
+
return /* @__PURE__ */ a(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
style: { display: "flex", alignItems: "center", cursor: "pointer" },
|
|
45
|
+
onClick: () => r(i)(h === "asc" ? "desc" : "asc"),
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ e(d, { variant: "sigma", textColor: "neutral600", children: t }),
|
|
48
|
+
/* @__PURE__ */ e("span", { style: { marginLeft: 4 }, children: /* @__PURE__ */ e(xe, { isDisplayed: i === s, direction: h }) })
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}, Ae = be(E)(() => ({
|
|
53
|
+
cursor: "pointer"
|
|
54
|
+
})), De = ({
|
|
55
|
+
tenant: t,
|
|
56
|
+
selectedTenants: i,
|
|
57
|
+
handleSelectTenant: l,
|
|
58
|
+
onDeleteTenant: r,
|
|
59
|
+
isDeletePending: s = !1
|
|
60
|
+
}) => {
|
|
61
|
+
const h = N(), n = j(), y = (u) => () => h(`/settings/${_}/${H}/${u.id}`);
|
|
62
|
+
return /* @__PURE__ */ a(Ae, { onClick: y(t), children: [
|
|
63
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
64
|
+
I,
|
|
65
|
+
{
|
|
66
|
+
checked: i.includes(t.id),
|
|
67
|
+
onCheckedChange: (u) => l(t.id, u)
|
|
68
|
+
}
|
|
69
|
+
) }),
|
|
70
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { fontWeight: "semiBold", textColor: "neutral800", children: t.id }) }),
|
|
71
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { fontWeight: "semiBold", textColor: "neutral800", children: t.name }) }),
|
|
72
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { textColor: "neutral800", children: t.code }) }),
|
|
73
|
+
/* @__PURE__ */ e(f, { children: t.role ? /* @__PURE__ */ e(te, { textColor: "neutral800", backgroundColor: "neutral100", children: t.role.name }) : /* @__PURE__ */ e(d, { textColor: "neutral600", children: "-" }) }),
|
|
74
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ a(q, { gap: 1, children: [
|
|
75
|
+
/* @__PURE__ */ e(z, { permissions: M.admin.edit, children: /* @__PURE__ */ e(
|
|
76
|
+
R,
|
|
77
|
+
{
|
|
78
|
+
onClick: y(t),
|
|
79
|
+
label: n("common.edit"),
|
|
80
|
+
children: /* @__PURE__ */ e(he, {})
|
|
81
|
+
}
|
|
82
|
+
) }),
|
|
83
|
+
/* @__PURE__ */ e(z, { permissions: M.admin.delete, children: /* @__PURE__ */ e(
|
|
84
|
+
R,
|
|
85
|
+
{
|
|
86
|
+
onClick: r(t),
|
|
87
|
+
label: n("common.delete"),
|
|
88
|
+
disabled: s,
|
|
89
|
+
children: /* @__PURE__ */ e(W, {})
|
|
90
|
+
}
|
|
91
|
+
) })
|
|
92
|
+
] }) })
|
|
93
|
+
] });
|
|
94
|
+
}, We = () => {
|
|
95
|
+
const t = N(), { toggleNotification: i } = ue(), [l, r] = $([]), [s, h] = $(), n = j(), y = Se(), { data: u, isLoading: F } = ve(), [{ query: p }, O] = pe({
|
|
96
|
+
sort: "name:asc",
|
|
97
|
+
_q: "",
|
|
98
|
+
page: 1,
|
|
99
|
+
pageSize: 10
|
|
100
|
+
}), { sort: S, _q: Q, page: G, pageSize: U } = {
|
|
101
|
+
...p,
|
|
102
|
+
sort: p.sort || "name:asc",
|
|
103
|
+
_q: p._q || "",
|
|
104
|
+
page: p.page || 1,
|
|
105
|
+
pageSize: p.pageSize || 10
|
|
106
|
+
}, { data: B, isLoading: J, error: T } = Te({ sort: S, search: Q, page: G, pageSize: U }), m = B?.results || [], v = B?.pagination || { pageCount: 1, total: 0 };
|
|
107
|
+
Ce.useEffect(() => {
|
|
108
|
+
T && i({
|
|
109
|
+
type: "danger",
|
|
110
|
+
message: T instanceof Error ? T.message : "An error occurred while fetching tenants"
|
|
111
|
+
});
|
|
112
|
+
}, [T, i]);
|
|
113
|
+
const K = (o) => {
|
|
114
|
+
r(o ? m.map((c) => c.id) : []);
|
|
115
|
+
}, V = (o, c) => {
|
|
116
|
+
r(c ? (x) => [...x, o] : (x) => x.filter((ee) => ee !== o));
|
|
117
|
+
}, k = (o) => (c) => {
|
|
118
|
+
O({
|
|
119
|
+
...p,
|
|
120
|
+
sort: `${o}:${c}`
|
|
121
|
+
});
|
|
122
|
+
}, X = (o) => async (c) => {
|
|
123
|
+
c.stopPropagation(), h(o);
|
|
124
|
+
}, Y = async () => {
|
|
125
|
+
if (s)
|
|
126
|
+
try {
|
|
127
|
+
await y.mutateAsync(s.id), i({
|
|
128
|
+
type: "success",
|
|
129
|
+
message: n("domain.notifications.deleted", {
|
|
130
|
+
values: { name: s.name }
|
|
131
|
+
})
|
|
132
|
+
}), h(void 0), r((o) => o.filter((c) => c !== s.id));
|
|
133
|
+
} catch {
|
|
134
|
+
i({
|
|
135
|
+
type: "danger",
|
|
136
|
+
message: n("domain.notifications.deleteError")
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}, Z = () => {
|
|
140
|
+
h(void 0);
|
|
141
|
+
};
|
|
142
|
+
return J || F ? /* @__PURE__ */ e(D.Main, { children: /* @__PURE__ */ e(b.Content, { children: /* @__PURE__ */ e(ne, { children: n("domain.list.loading") }) }) }) : /* @__PURE__ */ a(A, { children: [
|
|
143
|
+
/* @__PURE__ */ e(D.Title, { children: "Tenants" }),
|
|
144
|
+
/* @__PURE__ */ a(D.Main, { children: [
|
|
145
|
+
/* @__PURE__ */ e(
|
|
146
|
+
b.Header,
|
|
147
|
+
{
|
|
148
|
+
title: n("domain.list.title"),
|
|
149
|
+
subtitle: n("domain.list.subtitle", {
|
|
150
|
+
values: { count: m.length }
|
|
151
|
+
}),
|
|
152
|
+
as: "h2"
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
/* @__PURE__ */ e(
|
|
156
|
+
b.Action,
|
|
157
|
+
{
|
|
158
|
+
startActions: /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(
|
|
159
|
+
fe,
|
|
160
|
+
{
|
|
161
|
+
label: n("domain.list.search", {
|
|
162
|
+
defaultMessage: "Search domains"
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
) }),
|
|
166
|
+
endActions: /* @__PURE__ */ e(z, { permissions: M.admin.create, children: /* @__PURE__ */ e(
|
|
167
|
+
L,
|
|
168
|
+
{
|
|
169
|
+
startIcon: /* @__PURE__ */ e(me, {}),
|
|
170
|
+
onClick: () => {
|
|
171
|
+
if (!u || u.features.domains <= v.total)
|
|
172
|
+
return i({
|
|
173
|
+
type: "warning",
|
|
174
|
+
message: n("domain.list.limitReached", {
|
|
175
|
+
values: {
|
|
176
|
+
limit: u?.features.domains || 0
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
t(`/settings/${_}/${H}/new`);
|
|
181
|
+
},
|
|
182
|
+
children: n("common.create")
|
|
183
|
+
}
|
|
184
|
+
) })
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
/* @__PURE__ */ e(b.Content, { children: m.length === 0 ? /* @__PURE__ */ e(
|
|
188
|
+
ie,
|
|
189
|
+
{
|
|
190
|
+
icon: /* @__PURE__ */ e(ge, {}),
|
|
191
|
+
content: n("domain.list.emptyState", {
|
|
192
|
+
defaultMessage: "No domains found matching your search criteria"
|
|
193
|
+
})
|
|
194
|
+
}
|
|
195
|
+
) : /* @__PURE__ */ a(A, { children: [
|
|
196
|
+
/* @__PURE__ */ a(oe, { colCount: 6, rowCount: m.length + 1, children: [
|
|
197
|
+
/* @__PURE__ */ e(ae, { children: /* @__PURE__ */ a(E, { children: [
|
|
198
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
|
|
199
|
+
I,
|
|
200
|
+
{
|
|
201
|
+
checked: l.length === m.length && m.length > 0,
|
|
202
|
+
indeterminate: l.length > 0 ? l.length < m.length : void 0,
|
|
203
|
+
onCheckedChange: K
|
|
204
|
+
}
|
|
205
|
+
) }),
|
|
206
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
|
|
207
|
+
P,
|
|
208
|
+
{
|
|
209
|
+
label: n("domain.list.table.headers.id"),
|
|
210
|
+
field: "id",
|
|
211
|
+
sort: S,
|
|
212
|
+
onSort: k
|
|
213
|
+
}
|
|
214
|
+
) }),
|
|
215
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
|
|
216
|
+
P,
|
|
217
|
+
{
|
|
218
|
+
label: n("domain.list.table.headers.name"),
|
|
219
|
+
field: "name",
|
|
220
|
+
sort: S,
|
|
221
|
+
onSort: k
|
|
222
|
+
}
|
|
223
|
+
) }),
|
|
224
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
|
|
225
|
+
P,
|
|
226
|
+
{
|
|
227
|
+
label: n("domain.list.table.headers.code"),
|
|
228
|
+
field: "code",
|
|
229
|
+
sort: S,
|
|
230
|
+
onSort: k
|
|
231
|
+
}
|
|
232
|
+
) }),
|
|
233
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(d, { variant: "sigma", textColor: "neutral600", children: n("domain.list.table.headers.role") }) }),
|
|
234
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(d, { variant: "sigma", textColor: "neutral600", children: n("domain.list.table.headers.actions") }) })
|
|
235
|
+
] }) }),
|
|
236
|
+
/* @__PURE__ */ e(re, { children: m.map((o) => /* @__PURE__ */ e(
|
|
237
|
+
De,
|
|
238
|
+
{
|
|
239
|
+
tenant: o,
|
|
240
|
+
selectedTenants: l,
|
|
241
|
+
handleSelectTenant: V,
|
|
242
|
+
onDeleteTenant: X
|
|
243
|
+
},
|
|
244
|
+
o.id
|
|
245
|
+
)) })
|
|
246
|
+
] }),
|
|
247
|
+
/* @__PURE__ */ e(le, { paddingTop: 4, children: /* @__PURE__ */ a(w.Root, { pageCount: v.pageCount, total: v.total, children: [
|
|
248
|
+
/* @__PURE__ */ e(w.PageSize, {}),
|
|
249
|
+
/* @__PURE__ */ e(w.Links, {})
|
|
250
|
+
] }) })
|
|
251
|
+
] }) })
|
|
252
|
+
] }),
|
|
253
|
+
/* @__PURE__ */ e(
|
|
254
|
+
ke,
|
|
255
|
+
{
|
|
256
|
+
isOpen: !!s,
|
|
257
|
+
onClose: Z,
|
|
258
|
+
onConfirm: Y,
|
|
259
|
+
target: s?.name || ye
|
|
260
|
+
}
|
|
261
|
+
)
|
|
262
|
+
] });
|
|
263
|
+
};
|
|
264
|
+
export {
|
|
265
|
+
We as default
|
|
266
|
+
};
|
|
@@ -9,6 +9,49 @@ const e = {
|
|
|
9
9
|
update: "Update",
|
|
10
10
|
save: "Save"
|
|
11
11
|
},
|
|
12
|
+
settings: {
|
|
13
|
+
label: "Multi-Domain Settings",
|
|
14
|
+
general: {
|
|
15
|
+
label: "General Settings"
|
|
16
|
+
},
|
|
17
|
+
about: {
|
|
18
|
+
label: "About"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
about: {
|
|
22
|
+
title: "About",
|
|
23
|
+
pluginName: "Multi Domain Plugin",
|
|
24
|
+
pluginInfo: {
|
|
25
|
+
title: "Plugin Info",
|
|
26
|
+
name: "Name",
|
|
27
|
+
version: "Version",
|
|
28
|
+
openNpm: "Open NPM"
|
|
29
|
+
},
|
|
30
|
+
contact: {
|
|
31
|
+
title: "Contact Us",
|
|
32
|
+
website: "Website",
|
|
33
|
+
email: "Email",
|
|
34
|
+
talkToOurExperts: "Talk to our experts",
|
|
35
|
+
sensiumCaption: "Sensinum is a company of the VirtusLab Group"
|
|
36
|
+
},
|
|
37
|
+
licenseDetails: {
|
|
38
|
+
title: "Licence Details",
|
|
39
|
+
planName: "Plan Name",
|
|
40
|
+
validUntil: "Valid Until",
|
|
41
|
+
limits: {
|
|
42
|
+
seats: "Seats",
|
|
43
|
+
domains: "Domains"
|
|
44
|
+
},
|
|
45
|
+
features: {
|
|
46
|
+
title: "Features",
|
|
47
|
+
schemas: "Schemas",
|
|
48
|
+
decorators: "Decorators",
|
|
49
|
+
extensions: "Extensions",
|
|
50
|
+
enabled: "enabled",
|
|
51
|
+
disabled: "disabled"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
12
55
|
domain: {
|
|
13
56
|
list: {
|
|
14
57
|
title: "Domain",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={common:{cancel:"Cancel",edit:"Edit",delete:"Delete",loading:"Loading...",create:"Create new entry",back:"Back",update:"Update",save:"Save"},settings:{label:"Multi-Domain Settings",general:{label:"General Settings"},about:{label:"About"}},about:{title:"About",pluginName:"Multi Domain Plugin",pluginInfo:{title:"Plugin Info",name:"Name",version:"Version",openNpm:"Open NPM"},contact:{title:"Contact Us",website:"Website",email:"Email",talkToOurExperts:"Talk to our experts",sensiumCaption:"Sensinum is a company of the VirtusLab Group"},licenseDetails:{title:"Licence Details",planName:"Plan Name",validUntil:"Valid Until",limits:{seats:"Seats",domains:"Domains"},features:{title:"Features",schemas:"Schemas",decorators:"Decorators",extensions:"Extensions",enabled:"enabled",disabled:"disabled"}}},domain:{list:{title:"Domain",subtitle:"{count} entries found",search:"Search domains",create:"Create new entry",emptyState:"No domains found matching your search criteria",limitReached:"You have reached the maximum number of domains allowed ({limit}). Please upgrade your plan to add more.",table:{headers:{id:"ID",name:"NAME",code:"CODE",role:"ROLE",actions:"Actions"}},loading:"Loading domains..."},edit:{title:{create:"Create Domain",edit:"Edit {name}"},loading:"Loading domain...",notifications:{invalidJson:"Invalid JSON in custom fields",updated:"Domain updated successfully",created:"Domain created successfully",saveError:"Failed to save domain"},validation:{invalidJson:"Invalid JSON format in custom fields"},form:{name:{label:"Name",placeholder:"Enter domain name",hint:"A unique name for this domain"},code:{label:"Code",placeholder:"Enter domain code",hint:"A unique identifier for this domain"},role:{label:"Role",placeholder:"Select a role for this domain",hint:"Assign a role to control domain permissions",remove:"Remove role"},tokens:{label:"API Tokens",placeholder:"Select API tokens for this domain",hint:"Optionally associate multiple API tokens with this domain",add:"Add token",remove:"Remove token"},damRootDirectory:{label:"DAM Root Directory",placeholder:"Enter DAM root directory path",hint:"Root directory path for Digital Asset Management"},customFields:{label:"Custom Fields",hint:"Additional data stored as JSON for this domain"},logo:{label:"Logo",hint:"Upload a logo image for this domain",upload:"Upload Logo",change:"Change Logo",remove:"Remove",noImage:"No image selected"}},actions:{entry:"Entry",create:"Create Domain",update:"Update Domain"}},notifications:{deleted:"Domain deleted successfully",deleteError:"Failed to delete domain",updated:"Domain updated successfully",created:"Domain created successfully"}}};exports.default=e;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getFetchClient as g } from "@strapi/strapi/admin";
|
|
2
2
|
import t, { z as e } from "zod";
|
|
3
|
-
import { p as o, m as s } from "./index-
|
|
3
|
+
import { p as o, m as s } from "./index-DEoxiYwP.mjs";
|
|
4
4
|
e.object({
|
|
5
5
|
name: e.string().min(1, "Name is required").max(255, "Name must be less than 255 characters"),
|
|
6
6
|
code: e.string().min(1, "Code is required").max(100, "Code must be less than 100 characters").regex(/^[a-z0-9-]+$/, "Code must contain only lowercase letters, numbers, and hyphens")
|
|
@@ -11,12 +11,12 @@ e.object({
|
|
|
11
11
|
field: e.enum(["name", "code"]).optional()
|
|
12
12
|
});
|
|
13
13
|
const i = t.union([t.string(), t.number()]).transform((p) => {
|
|
14
|
-
const
|
|
15
|
-
if (isNaN(
|
|
14
|
+
const n = parseInt(p.toString(), 10);
|
|
15
|
+
if (isNaN(n) || n <= 0)
|
|
16
16
|
throw new t.ZodError([
|
|
17
17
|
{ message: "ID must be a positive integer", code: "custom", path: ["id"] }
|
|
18
18
|
]);
|
|
19
|
-
return
|
|
19
|
+
return n;
|
|
20
20
|
}), b = e.object({
|
|
21
21
|
id: i,
|
|
22
22
|
documentId: e.string().min(1, "Document ID is required"),
|
|
@@ -94,42 +94,42 @@ const f = u.extend({
|
|
|
94
94
|
});
|
|
95
95
|
class j {
|
|
96
96
|
fetchClient = g();
|
|
97
|
-
async validateTenant(
|
|
97
|
+
async validateTenant(n) {
|
|
98
98
|
try {
|
|
99
|
-
const
|
|
100
|
-
return console.log("response.data",
|
|
101
|
-
} catch (
|
|
102
|
-
throw
|
|
99
|
+
const r = await this.fetchClient.post(`/${o}/validate`, n);
|
|
100
|
+
return console.log("response.data", r.data), r.data;
|
|
101
|
+
} catch (r) {
|
|
102
|
+
throw r instanceof e.ZodError ? new Error(`Validation error: ${r.errors.map((a) => a.message).join(", ")}`) : r;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
async getTenants(
|
|
105
|
+
async getTenants(n) {
|
|
106
106
|
try {
|
|
107
|
-
const
|
|
108
|
-
return S.parse(
|
|
107
|
+
const r = await this.fetchClient.get(`/${o}/${s}`, { params: n });
|
|
108
|
+
return S.parse(r.data);
|
|
109
109
|
} catch {
|
|
110
110
|
throw new Error("Failed to fetch tenants");
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
async getTenant(
|
|
113
|
+
async getTenant(n) {
|
|
114
114
|
try {
|
|
115
|
-
const
|
|
116
|
-
return m.parseAsync(
|
|
115
|
+
const r = await this.fetchClient.get(`/${o}/${s}/${n}`);
|
|
116
|
+
return m.parseAsync(r.data);
|
|
117
117
|
} catch {
|
|
118
118
|
throw new Error("Failed to fetch tenant");
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
async createTenant(
|
|
121
|
+
async createTenant(n) {
|
|
122
122
|
try {
|
|
123
|
-
const
|
|
123
|
+
const r = f.parse(n), a = await this.fetchClient.post(`/${o}/${s}`, r);
|
|
124
124
|
return m.parseAsync(a.data);
|
|
125
|
-
} catch (
|
|
126
|
-
throw console.log("error",
|
|
125
|
+
} catch (r) {
|
|
126
|
+
throw console.log("error", r), r instanceof e.ZodError ? new Error(`Validation error: ${r.errors.map((a) => a.message).join(", ")}`) : r;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
async updateTenant(
|
|
129
|
+
async updateTenant(n, r) {
|
|
130
130
|
try {
|
|
131
|
-
const a = $.parse(
|
|
132
|
-
`/${o}/${s}/${
|
|
131
|
+
const a = $.parse(r), c = await this.fetchClient.put(
|
|
132
|
+
`/${o}/${s}/${n}`,
|
|
133
133
|
a
|
|
134
134
|
);
|
|
135
135
|
return m.parseAsync(c.data);
|
|
@@ -137,37 +137,37 @@ class j {
|
|
|
137
137
|
throw a instanceof e.ZodError ? new Error(`Validation error: ${a.errors.map((c) => c.message).join(", ")}`) : new Error("Failed to update tenant");
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
async deleteTenant(
|
|
140
|
+
async deleteTenant(n) {
|
|
141
141
|
try {
|
|
142
|
-
await this.fetchClient.del(`/${o}/${s}/${
|
|
142
|
+
await this.fetchClient.del(`/${o}/${s}/${n}`);
|
|
143
143
|
} catch {
|
|
144
144
|
throw new Error("Failed to delete tenant");
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
async getRoles() {
|
|
148
148
|
try {
|
|
149
|
-
const
|
|
150
|
-
return e.array(l).parse(
|
|
149
|
+
const n = await this.fetchClient.get("/admin/roles");
|
|
150
|
+
return e.array(l).parse(n.data.data);
|
|
151
151
|
} catch {
|
|
152
152
|
throw new Error("Failed to fetch roles");
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
async getTokens() {
|
|
156
156
|
try {
|
|
157
|
-
const
|
|
158
|
-
return e.array(h).parse(
|
|
157
|
+
const n = await this.fetchClient.get("/admin/api-tokens");
|
|
158
|
+
return e.array(h).parse(n.data.data);
|
|
159
159
|
} catch {
|
|
160
160
|
throw new Error("Failed to fetch roles");
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
async validateCustomField({
|
|
164
|
-
model:
|
|
165
|
-
documentId:
|
|
164
|
+
model: n,
|
|
165
|
+
documentId: r,
|
|
166
166
|
field: a,
|
|
167
167
|
value: c
|
|
168
168
|
}) {
|
|
169
|
-
return (await this.fetchClient.post(`/${o}/${s}/${
|
|
170
|
-
documentId:
|
|
169
|
+
return (await this.fetchClient.post(`/${o}/${s}/${n}/validate`, {
|
|
170
|
+
documentId: r,
|
|
171
171
|
field: a,
|
|
172
172
|
value: c
|
|
173
173
|
})).data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const h=require("@strapi/strapi/admin"),e=require("zod"),r=require("./index-
|
|
1
|
+
"use strict";const h=require("@strapi/strapi/admin"),e=require("zod"),r=require("./index-DuSOcmV4.js"),g=s=>s&&s.__esModule?s:{default:s},t=g(e);e.z.object({name:e.z.string().min(1,"Name is required").max(255,"Name must be less than 255 characters"),code:e.z.string().min(1,"Code is required").max(100,"Code must be less than 100 characters").regex(/^[a-z0-9-]+$/,"Code must contain only lowercase letters, numbers, and hyphens")});e.z.object({isValid:e.z.boolean(),message:e.z.string().optional(),field:e.z.enum(["name","code"]).optional()});const i=t.default.union([t.default.string(),t.default.number()]).transform(s=>{const n=parseInt(s.toString(),10);if(isNaN(n)||n<=0)throw new t.default.ZodError([{message:"ID must be a positive integer",code:"custom",path:["id"]}]);return n}),f=e.z.object({id:i,documentId:e.z.string().min(1,"Document ID is required"),action:e.z.string().min(1,"Action is required"),actionParameters:e.z.record(e.z.any()).optional(),subject:e.z.string().min(1,"Subject is required").nullable().optional(),properties:e.z.record(e.z.any()).optional(),conditions:e.z.array(e.z.record(e.z.any())).optional()});e.z.object({sort:e.z.string().optional(),search:e.z.string().optional(),page:e.z.coerce.number().int().positive().optional(),pageSize:e.z.coerce.number().int().positive().optional()});const z=e.z.object({name:e.z.string().min(1,"Name is required"),code:e.z.string().min(1,"Code is required"),description:e.z.string().optional()}),c=z.merge(e.z.object({id:i,documentId:e.z.string().min(1,"Document ID is required")}));c.merge(e.z.object({permissions:f.array()}));const m=e.z.object({id:i,name:e.z.string().min(1,"Name is required")}),b=t.default.object({id:t.default.number(),name:t.default.string(),url:t.default.string(),width:t.default.number(),height:t.default.number(),ext:t.default.string(),size:t.default.number()}).passthrough(),p=t.default.object({name:t.default.string().min(1,"Name is required"),code:t.default.string().min(1,"Code is required"),customFields:t.default.record(t.default.any()).optional().nullable(),damRootDirectory:t.default.string().optional().nullable(),logo:b.optional().nullable()}),d=p.extend({id:i,documentId:t.default.string()});d.extend({role:c.optional().nullable()});const y=p.extend({role:i.optional().nullable(),tokens:t.default.array(i).optional().nullable()}),w=d.omit({id:!0,documentId:!0}).extend({role:i.optional().nullable(),tokens:t.default.array(i).optional().nullable()}),$=t.default.object({page:t.default.number(),pageCount:t.default.number(),pageSize:t.default.number(),total:t.default.number()}),I=e.z.object({results:e.z.array(d),pagination:$}),u=d.extend({role:c.optional().nullable(),tokens:e.z.array(m).optional().nullable()});class C{fetchClient=h.getFetchClient();async validateTenant(n){try{const a=await this.fetchClient.post(`/${r.pluginId}/validate`,n);return console.log("response.data",a.data),a.data}catch(a){throw a instanceof e.z.ZodError?new Error(`Validation error: ${a.errors.map(o=>o.message).join(", ")}`):a}}async getTenants(n){try{const a=await this.fetchClient.get(`/${r.pluginId}/${r.modelRoute}`,{params:n});return I.parse(a.data)}catch{throw new Error("Failed to fetch tenants")}}async getTenant(n){try{const a=await this.fetchClient.get(`/${r.pluginId}/${r.modelRoute}/${n}`);return u.parseAsync(a.data)}catch{throw new Error("Failed to fetch tenant")}}async createTenant(n){try{const a=y.parse(n),o=await this.fetchClient.post(`/${r.pluginId}/${r.modelRoute}`,a);return u.parseAsync(o.data)}catch(a){throw console.log("error",a),a instanceof e.z.ZodError?new Error(`Validation error: ${a.errors.map(o=>o.message).join(", ")}`):a}}async updateTenant(n,a){try{const o=w.parse(a),l=await this.fetchClient.put(`/${r.pluginId}/${r.modelRoute}/${n}`,o);return u.parseAsync(l.data)}catch(o){throw o instanceof e.z.ZodError?new Error(`Validation error: ${o.errors.map(l=>l.message).join(", ")}`):new Error("Failed to update tenant")}}async deleteTenant(n){try{await this.fetchClient.del(`/${r.pluginId}/${r.modelRoute}/${n}`)}catch{throw new Error("Failed to delete tenant")}}async getRoles(){try{const n=await this.fetchClient.get("/admin/roles");return e.z.array(c).parse(n.data.data)}catch{throw new Error("Failed to fetch roles")}}async getTokens(){try{const n=await this.fetchClient.get("/admin/api-tokens");return e.z.array(m).parse(n.data.data)}catch{throw new Error("Failed to fetch roles")}}async validateCustomField({model:n,documentId:a,field:o,value:l}){return(await this.fetchClient.post(`/${r.pluginId}/${r.modelRoute}/${n}/validate`,{documentId:a,field:o,value:l})).data}async getSettings(){return(await this.fetchClient.get(`/${r.pluginId}/license`)).data}}const S=new C;exports.api=S;
|