@sensinum/strapi-plugin-multi-domain 5.2.2 → 5.3.1

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.
Files changed (63) hide show
  1. package/dist/{_chunks/About-BMKe8Nmq.js → admin/About-Cqb0Poxw.js} +2 -2
  2. package/dist/{_chunks/About-BwHHM2-e.mjs → admin/About-DaHQ_Yhm.mjs} +5 -5
  3. package/dist/admin/QueryProvider-CCX1cgmZ.js +1 -0
  4. package/dist/{_chunks/QueryProvider-DLzv0qqi.mjs → admin/QueryProvider-oO97LaUB.mjs} +2 -2
  5. package/dist/{_chunks/Settings-dlu3XY5j.js → admin/Settings-CDBzsWbm.js} +1 -1
  6. package/dist/{_chunks/Settings-v1cjVAKt.mjs → admin/Settings-CyMoV2x8.mjs} +3 -3
  7. package/dist/{_chunks/TenantCustomField-cjk2h9Sy.js → admin/TenantCustomField-BVJXtOh1.js} +1 -1
  8. package/dist/{_chunks/TenantCustomField-Cc17Wct3.mjs → admin/TenantCustomField-ZM7ZfiGu.mjs} +24 -24
  9. package/dist/admin/TenantEdit-DBJoQv4w.mjs +490 -0
  10. package/dist/admin/TenantEdit-GAMHwYkP.js +1 -0
  11. package/dist/{_chunks/TenantList-CONeayj-.mjs → admin/TenantList-C6xsvthy.mjs} +43 -45
  12. package/dist/admin/TenantList-D8hgcBHM.js +1 -0
  13. package/dist/admin/index-BwgjJmHR.js +1 -0
  14. package/dist/{_chunks/index-D6ydxf5B.mjs → admin/index-CQxsvheX.mjs} +80 -80
  15. package/dist/admin/index-CwsztY3K.mjs +187 -0
  16. package/dist/admin/index-eSOlzCRc.js +1 -0
  17. package/dist/admin/index.js +1 -1
  18. package/dist/admin/index.mjs +1 -1
  19. package/dist/{_chunks/useGetMessage-B8BN0qvw.mjs → admin/useGetMessage-Ck4TSmSw.mjs} +1 -1
  20. package/dist/admin/useGetMessage-gI6hxpcF.js +1 -0
  21. package/dist/admin/useSettings-CkTWZxdH.js +1 -0
  22. package/dist/{_chunks/useSettings-CimYpZ4J.mjs → admin/useSettings-DY1d6P_T.mjs} +2 -2
  23. package/dist/admin/useTenants-Ck1OOTGx.js +1 -0
  24. package/dist/{_chunks/useTenants-DezjZnH2.mjs → admin/useTenants-sy0FweCJ.mjs} +4 -4
  25. package/dist/server/index.js +3 -6
  26. package/dist/server/index.mjs +3308 -7154
  27. package/package.json +20 -21
  28. package/dist/_chunks/QueryProvider-DUoM4JhC.js +0 -1
  29. package/dist/_chunks/TenantEdit-BTFMfW4k.js +0 -1
  30. package/dist/_chunks/TenantEdit-CVAR1Ief.mjs +0 -494
  31. package/dist/_chunks/TenantList-D2kRXKow.js +0 -1
  32. package/dist/_chunks/index-Bmegt3iZ.js +0 -1
  33. package/dist/_chunks/index-BoaWY6pN.js +0 -1
  34. package/dist/_chunks/index-DMvlWHGg.mjs +0 -182
  35. package/dist/_chunks/useGetMessage-Qu_lnA6t.js +0 -1
  36. package/dist/_chunks/useSettings-Bvg8rV47.js +0 -1
  37. package/dist/_chunks/useTenants-BWUvXqt6.js +0 -1
  38. package/dist/shared/config.d.ts +0 -7
  39. package/dist/shared/config.d.ts.map +0 -1
  40. package/dist/shared/permissions.d.ts +0 -35
  41. package/dist/shared/permissions.d.ts.map +0 -1
  42. package/dist/shared/pluginIds.d.ts +0 -9
  43. package/dist/shared/pluginIds.d.ts.map +0 -1
  44. package/dist/shared/schemas/admin.d.ts +0 -26
  45. package/dist/shared/schemas/admin.d.ts.map +0 -1
  46. package/dist/shared/schemas/index.d.ts +0 -8
  47. package/dist/shared/schemas/index.d.ts.map +0 -1
  48. package/dist/shared/schemas/permision.schema.d.ts +0 -28
  49. package/dist/shared/schemas/permision.schema.d.ts.map +0 -1
  50. package/dist/shared/schemas/query-params.schema.d.ts +0 -19
  51. package/dist/shared/schemas/query-params.schema.d.ts.map +0 -1
  52. package/dist/shared/schemas/role.schema.d.ts +0 -101
  53. package/dist/shared/schemas/role.schema.d.ts.map +0 -1
  54. package/dist/shared/schemas/tenant.schema.d.ts +0 -428
  55. package/dist/shared/schemas/tenant.schema.d.ts.map +0 -1
  56. package/dist/shared/schemas/token.schema.d.ts +0 -13
  57. package/dist/shared/schemas/token.schema.d.ts.map +0 -1
  58. package/dist/shared/schemas/uniq-validation.schema.d.ts +0 -18
  59. package/dist/shared/schemas/uniq-validation.schema.d.ts.map +0 -1
  60. package/dist/shared/schemas/utils.d.ts +0 -3
  61. package/dist/shared/schemas/utils.d.ts.map +0 -1
  62. /package/dist/{_chunks → admin}/en-Cf69p5po.mjs +0 -0
  63. /package/dist/{_chunks → admin}/en-hAVH8fH0.js +0 -0
@@ -4,25 +4,23 @@ import { jsx as o, jsxs as m } from "react/jsx-runtime";
4
4
  import { unstable_useContentManagerContext as G, getFetchClient as K } from "@strapi/strapi/admin";
5
5
  import X, { useRef as Y, useEffect as Z, useState as x } from "react";
6
6
  import { CookiesProvider as R, useCookies as D } from "react-cookie";
7
- import { Avatar as M, Modal as h, Box as k, Field as L, Searchbar as ee, EmptyStateLayout as te, Table as ne, Thead as oe, Tr as P, Th as C, Typography as S, Tbody as ie, Td as T, Checkbox as ae, Button as I, DesignSystemProvider as re, lightTheme as se, darkTheme as ce } from "@strapi/design-system";
7
+ import { Avatar as k, Modal as h, Box as L, Field as M, Searchbar as ee, EmptyStateLayout as te, Table as ne, Thead as oe, Tr as P, Th as C, Typography as S, Tbody as ae, Td as T, Checkbox as ie, Button as I, DesignSystemProvider as re, lightTheme as se, darkTheme as ce } from "@strapi/design-system";
8
8
  import { createRoot as le } from "react-dom/client";
9
9
  import { Search as de } from "@strapi/icons";
10
10
  import { QueryClient as ue, QueryClientProvider as me } from "@tanstack/react-query";
11
- const he = "@sensinum/strapi-plugin-multi-domain", pe = "5.2.2", ge = "https://www.sensinum.com/contact", fe = "hello@sensinum.com", ye = {
12
- name: "multi-domain"
13
- }, je = {
11
+ const he = "@sensinum/strapi-plugin-multi-domain", pe = "5.3.1", ge = "https://www.sensinum.com/contact", fe = "hello@sensinum.com", ye = { name: "multi-domain" }, je = {
14
12
  name: he,
15
13
  version: pe,
16
14
  homepage: ge,
17
15
  email: fe
18
- }, a = J.literal("multi-domain").parse(ye.name);
19
- W(a);
16
+ }, i = J.literal("multi-domain").parse(ye.name);
17
+ W(i);
20
18
  const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
21
19
  read: "read",
22
20
  change: "change",
23
21
  create: "create",
24
22
  delete: "delete"
25
- }, b = (e) => `plugin::${a}.${H[e]}`, N = {
23
+ }, b = (e) => `plugin::${i}.${H[e]}`, N = {
26
24
  admin: {
27
25
  access: Object.keys(H).map((e) => ({
28
26
  action: b(e),
@@ -43,7 +41,7 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
43
41
  }, Te = () => /* @__PURE__ */ o(R, { children: /* @__PURE__ */ o(Se, {}) }), ve = ({ setPlugin: e }) => {
44
42
  const t = Y(e);
45
43
  return Z(() => {
46
- t.current(a);
44
+ t.current(i);
47
45
  }, []), null;
48
46
  }, B = {
49
47
  en: () => import("./en-Cf69p5po.mjs")
@@ -51,39 +49,41 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
51
49
  if (!e)
52
50
  throw new TypeError("Prefix can't be empty");
53
51
  return Object.keys(t).reduce(
54
- (n, i) => (n[`${e}.${i}`] = t[i], n),
52
+ (n, a) => (n[`${e}.${a}`] = t[a], n),
55
53
  {}
56
54
  );
57
- }, A = (e, t = "") => Object.keys(e).reduce((n, i) => {
55
+ }, A = (e, t = "") => Object.keys(e).reduce((n, a) => {
58
56
  const r = t.length ? `${t}.` : "";
59
- return typeof e[i] == "object" && e[i] !== null && !Array.isArray(e[i]) ? Object.assign(n, A(e[i], r + i)) : n[r + i] = e[i], n;
57
+ return typeof e[a] == "object" && e[a] !== null && !Array.isArray(e[a]) ? Object.assign(n, A(e[a], r + a)) : n[r + a] = e[a], n;
60
58
  }, {}), Ee = ({ onClose: e, userData: t }) => {
61
- const [{ [p]: n }, i] = D([p]), [r, d] = x(""), [s, u] = x(n || null), l = (t[E] || []).filter(
62
- (c) => c.name.toLowerCase().includes(r.toLowerCase())
63
- ), y = (c) => {
64
- u(s?.id === c.id ? null : c);
59
+ const [{ [p]: n }, a] = D([p]), [r, d] = x(""), [c, u] = x(n || null), l = (t[E] || []).filter(
60
+ (s) => s.name.toLowerCase().includes(r.toLowerCase())
61
+ ), y = (s) => {
62
+ u(c?.id === s.id ? null : s);
65
63
  }, Q = () => {
66
- s && (i(p, JSON.stringify(s), {
64
+ c && (a(p, JSON.stringify(c), {
67
65
  path: "/",
68
- maxAge: 60 * 60 * 24 * 30,
66
+ maxAge: 3600 * 24 * 30,
69
67
  // 30 days
70
68
  domain: window.location.hostname
71
69
  }), window.location.reload());
72
70
  };
73
- return console.log("Avatar", M), /* @__PURE__ */ o(h.Root, { defaultOpen: !0, onOpenChange: e, children: /* @__PURE__ */ m(h.Content, { children: [
71
+ return console.log("Avatar", k), /* @__PURE__ */ o(h.Root, { defaultOpen: !0, onOpenChange: e, children: /* @__PURE__ */ m(h.Content, { children: [
74
72
  /* @__PURE__ */ o(h.Header, { children: /* @__PURE__ */ o(h.Title, { children: "Select Domain" }) }),
75
73
  /* @__PURE__ */ m(h.Body, { children: [
76
- /* @__PURE__ */ o(k, { paddingBottom: 4, children: /* @__PURE__ */ m(L.Root, { name: "tenant-search", children: [
77
- /* @__PURE__ */ o(L.Label, { children: "Search domains" }),
74
+ /* @__PURE__ */ o(L, { paddingBottom: 4, children: /* @__PURE__ */ m(M.Root, { name: "tenant-search", children: [
75
+ /* @__PURE__ */ o(M.Label, { children: "Search domains" }),
78
76
  /* @__PURE__ */ o(
79
77
  ee,
80
78
  {
81
79
  name: "tenant-search",
82
80
  onClear: () => d(""),
83
81
  value: r,
84
- onChange: (c) => d(c.target.value),
82
+ onChange: (s) => d(s.target.value),
85
83
  placeholder: "Search domains...",
86
- size: "S"
84
+ size: "S",
85
+ clearLabel: "Clear search",
86
+ children: "Search domains"
87
87
  }
88
88
  )
89
89
  ] }) }),
@@ -93,29 +93,29 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
93
93
  icon: /* @__PURE__ */ o(de, {}),
94
94
  content: "No domains found matching your search criteria"
95
95
  }
96
- ) : /* @__PURE__ */ o(k, { maxHeight: "400px", overflow: "auto", children: /* @__PURE__ */ m(ne, { colCount: 2, rowCount: l.length + 1, children: [
96
+ ) : /* @__PURE__ */ o(L, { maxHeight: "400px", overflow: "auto", children: /* @__PURE__ */ m(ne, { colCount: 2, rowCount: l.length + 1, children: [
97
97
  /* @__PURE__ */ o(oe, { children: /* @__PURE__ */ m(P, { children: [
98
98
  /* @__PURE__ */ o(C, { width: "60px", children: /* @__PURE__ */ o(S, { variant: "sigma", textColor: "neutral600", children: "Select" }) }),
99
- /* @__PURE__ */ o(C, { width: "40px" }),
99
+ /* @__PURE__ */ o(C, { width: "40px", children: null }),
100
100
  /* @__PURE__ */ o(C, { children: /* @__PURE__ */ o(S, { variant: "sigma", textColor: "neutral600", children: "Domain name" }) })
101
101
  ] }) }),
102
- /* @__PURE__ */ o(ie, { children: l.map((c) => /* @__PURE__ */ m(P, { children: [
102
+ /* @__PURE__ */ o(ae, { children: l.map((s) => /* @__PURE__ */ m(P, { children: [
103
103
  /* @__PURE__ */ o(T, { width: "60px", children: /* @__PURE__ */ o(
104
- ae,
104
+ ie,
105
105
  {
106
- checked: s?.id === c.id,
107
- onCheckedChange: () => y(c),
108
- name: `tenant-${c.id}`
106
+ checked: c?.id === s.id,
107
+ onCheckedChange: () => y(s),
108
+ name: `tenant-${s.id}`
109
109
  }
110
110
  ) }),
111
- /* @__PURE__ */ o(T, { width: "40px", children: c.logo?.url && /* @__PURE__ */ o(M.Item, { src: c.logo.url, alt: c.name, preview: !1 }) }),
112
- /* @__PURE__ */ o(T, { children: /* @__PURE__ */ o(S, { fontWeight: "semiBold", textColor: "neutral800", children: c.name }) })
113
- ] }, c.id)) })
111
+ /* @__PURE__ */ o(T, { width: "40px", children: s.logo?.url && /* @__PURE__ */ o(k.Item, { src: s.logo.url, alt: s.name, preview: !1, fallback: s.name[0] }) }),
112
+ /* @__PURE__ */ o(T, { children: /* @__PURE__ */ o(S, { fontWeight: "semiBold", textColor: "neutral800", children: s.name }) })
113
+ ] }, s.id)) })
114
114
  ] }) })
115
115
  ] }),
116
116
  /* @__PURE__ */ m(h.Footer, { children: [
117
117
  /* @__PURE__ */ o(h.Close, { children: /* @__PURE__ */ o(I, { onClick: e, variant: "tertiary", children: "Cancel" }) }),
118
- /* @__PURE__ */ o(I, { onClick: Q, disabled: !s, children: "Select domain" })
118
+ /* @__PURE__ */ o(I, { onClick: Q, disabled: !c, children: "Select domain" })
119
119
  ] })
120
120
  ] }) });
121
121
  }, Ae = new ue({
@@ -125,19 +125,19 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
125
125
  refetchOnWindowFocus: !1
126
126
  }
127
127
  }
128
- }), $e = (e, t, n, i) => {
128
+ }), $e = (e, t, n, a) => {
129
129
  const r = le(e), d = () => {
130
130
  document.body.removeAttribute("style"), r.unmount(), setTimeout(() => {
131
131
  document.body.style.pointerEvents = "auto";
132
132
  }, 0);
133
133
  };
134
134
  return t.remove(), r.render(
135
- /* @__PURE__ */ o(re, { theme: i === "light" ? se : ce, children: /* @__PURE__ */ o(me, { client: Ae, children: /* @__PURE__ */ o(R, { children: /* @__PURE__ */ o(Ee, { onClose: d, userData: n }) }) }) })
135
+ /* @__PURE__ */ o(re, { theme: a === "light" ? se : ce, children: /* @__PURE__ */ o(me, { client: Ae, children: /* @__PURE__ */ o(R, { children: /* @__PURE__ */ o(Ee, { onClose: d, userData: n }) }) }) })
136
136
  );
137
- }, w = (e, t) => new Promise((n, i) => {
138
- const s = (u = 0) => {
137
+ }, w = (e, t) => new Promise((n, a) => {
138
+ const c = (u = 0) => {
139
139
  if (u > 50) {
140
- i(new Error("Button not found after 50 attempts"));
140
+ a(new Error("Button not found after 50 attempts"));
141
141
  return;
142
142
  }
143
143
  const l = (t || document).querySelector(e);
@@ -145,9 +145,9 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
145
145
  n(l);
146
146
  return;
147
147
  }
148
- setTimeout(() => s(u + 1), 250);
148
+ setTimeout(() => c(u + 1), 250);
149
149
  };
150
- s();
150
+ c();
151
151
  }), j = () => {
152
152
  try {
153
153
  const t = document.cookie.split(";").find((n) => n.trim().startsWith(`${p}=`));
@@ -155,8 +155,8 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
155
155
  const n = t.split("=").at(1);
156
156
  if (!n)
157
157
  return null;
158
- const i = decodeURIComponent(n);
159
- return JSON.parse(i);
158
+ const a = decodeURIComponent(n);
159
+ return JSON.parse(a);
160
160
  }
161
161
  } catch (e) {
162
162
  console.error("Error parsing tenant cookie:", e);
@@ -165,8 +165,8 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
165
165
  }, xe = (e) => {
166
166
  const t = e.firstChild, n = t?.lastChild?.cloneNode(!0);
167
167
  if (t && n instanceof HTMLElement) {
168
- const i = n.firstChild;
169
- i && n.replaceChildren(i);
168
+ const a = n.firstChild;
169
+ a && n.replaceChildren(a);
170
170
  const r = n.querySelector("span");
171
171
  if (r) {
172
172
  const d = j();
@@ -186,14 +186,14 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
186
186
  }, F = async () => {
187
187
  const e = await $(), t = document.createElement("div");
188
188
  document.body.appendChild(t);
189
- const n = await w('nav button[aria-haspopup="menu"]'), i = "aria-expanded";
189
+ const n = await w('nav button[aria-haspopup="menu"]'), a = "aria-expanded";
190
190
  new MutationObserver(async (d) => {
191
- if (d.some((s) => s.attributeName === i) && n.getAttribute(i) === "true") {
192
- const s = await w("[data-radix-menu-content]");
193
- if (!(s instanceof HTMLElement))
191
+ if (d.some((c) => c.attributeName === a) && n.getAttribute(a) === "true") {
192
+ const c = await w("[data-radix-menu-content]");
193
+ if (!(c instanceof HTMLElement))
194
194
  return;
195
- xe(s);
196
- const u = await w('[role="menuitem"]', s), l = u.cloneNode(!0);
195
+ xe(c);
196
+ const u = await w('[role="menuitem"]', c), l = u.cloneNode(!0);
197
197
  if (e?.[E] && e?.[E].length > 1) {
198
198
  if (!(l instanceof HTMLElement))
199
199
  return;
@@ -204,7 +204,7 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
204
204
  }), l.addEventListener("click", (y) => {
205
205
  y.preventDefault(), y.stopPropagation(), $e(
206
206
  t,
207
- s,
207
+ c,
208
208
  e,
209
209
  localStorage.getItem("STRAPI_THEME") || "dark"
210
210
  );
@@ -214,21 +214,21 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
214
214
  }).observe(n, {
215
215
  attributes: !0
216
216
  });
217
- }, _ = () => window.location.pathname === "/admin/auth/login", Me = () => window.location.pathname.startsWith("/admin/plugins/upload"), ke = () => {
217
+ }, _ = () => window.location.pathname === "/admin/auth/login", ke = () => window.location.pathname.startsWith("/admin/plugins/upload"), Le = () => {
218
218
  const e = j(), t = document.querySelector('[data-strapi-header="true"]');
219
219
  if (!e || U(e)) {
220
220
  const n = t?.querySelectorAll("button");
221
- n && n.forEach((i) => {
222
- i.style.display = "none";
221
+ n && n.forEach((a) => {
222
+ a.style.display = "none";
223
223
  });
224
224
  }
225
- }, O = V(ke, {
225
+ }, O = V(Le, {
226
226
  minQuietPeriodMs: 250
227
227
  }), z = async () => {
228
228
  const e = await w('nav ul > li a[href="/admin/plugins/upload"]');
229
229
  e && e.addEventListener("click", () => {
230
230
  O.call();
231
- }), Me() && O.call();
231
+ }), ke() && O.call();
232
232
  }, v = async () => {
233
233
  if (_()) {
234
234
  document.body.removeAttribute(f);
@@ -239,55 +239,55 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
239
239
  return;
240
240
  }
241
241
  document.body.removeAttribute(f);
242
- }, Le = async () => {
242
+ }, Me = async () => {
243
243
  _() || !await $() || (document.body.setAttribute(f, "true"), await Promise.all([F(), z()]));
244
244
  }, Fe = {
245
245
  register(e) {
246
246
  e.registerPlugin({
247
- id: a,
247
+ id: i,
248
248
  initializer: ve,
249
249
  isReady: !1,
250
- name: a
250
+ name: i
251
251
  }), e.customFields.register({
252
252
  name: `unique-by-${g}`,
253
- pluginId: a,
253
+ pluginId: i,
254
254
  type: "string",
255
255
  intlLabel: {
256
- id: `${a}.custom-fields.unique-by-domain.label`,
256
+ id: `${i}.custom-fields.unique-by-domain.label`,
257
257
  defaultMessage: "Unique by domain"
258
258
  },
259
259
  intlDescription: {
260
- id: `${a}.custom-fields.unique-by-tenant.description`,
260
+ id: `${i}.custom-fields.unique-by-tenant.description`,
261
261
  defaultMessage: "Ensures the value is unique within the domain."
262
262
  },
263
263
  components: {
264
- Input: () => import("./TenantCustomField-Cc17Wct3.mjs")
264
+ Input: () => import("./TenantCustomField-ZM7ZfiGu.mjs")
265
265
  }
266
266
  }), e.router.addSettingsLink({
267
- id: `${a}.settings`,
267
+ id: `${i}.settings`,
268
268
  intlLabel: {
269
- id: `${a}.settings.label`,
269
+ id: `${i}.settings.label`,
270
270
  defaultMessage: "Multi-Domain Settings"
271
271
  },
272
272
  links: [
273
273
  {
274
- id: `${a}.settings.about`,
274
+ id: `${i}.settings.about`,
275
275
  intlLabel: {
276
- id: `${a}.settings.about.label`,
276
+ id: `${i}.settings.about.label`,
277
277
  defaultMessage: "About"
278
278
  },
279
- to: `/settings/${a}/about`,
280
- Component: () => import("./About-BwHHM2-e.mjs"),
279
+ to: `/settings/${i}/about`,
280
+ Component: () => import("./About-DaHQ_Yhm.mjs"),
281
281
  permissions: N.admin.access
282
282
  },
283
283
  {
284
- id: `${a}.settings.general`,
284
+ id: `${i}.settings.general`,
285
285
  intlLabel: {
286
- id: `${a}.settings.general.label`,
286
+ id: `${i}.settings.general.label`,
287
287
  defaultMessage: "General Settings"
288
288
  },
289
- to: `/settings/${a}/${be}`,
290
- Component: () => import("./Settings-v1cjVAKt.mjs"),
289
+ to: `/settings/${i}/${be}`,
290
+ Component: () => import("./Settings-CyMoV2x8.mjs"),
291
291
  permissions: N.admin.access
292
292
  }
293
293
  ]
@@ -295,11 +295,11 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
295
295
  },
296
296
  async registerTrads({ locales: e }) {
297
297
  return Promise.all(
298
- e.map(async (t) => t in B ? B[t]().then(({ default: i }) => ({
299
- data: q(a, A(i)),
298
+ e.map(async (t) => t in B ? B[t]().then(({ default: a }) => ({
299
+ data: q(i, A(a)),
300
300
  locale: t
301
301
  })) : {
302
- data: q(a, A({})),
302
+ data: q(i, A({})),
303
303
  locale: t
304
304
  })
305
305
  );
@@ -313,12 +313,12 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
313
313
  window.addEventListener("popstate", async () => {
314
314
  t !== window.location.pathname && (t = window.location.pathname, await v());
315
315
  });
316
- const n = history.pushState, i = history.replaceState;
316
+ const n = history.pushState, a = history.replaceState;
317
317
  history.pushState = function(...r) {
318
318
  n.apply(history, r), t !== window.location.pathname && (t = window.location.pathname, v());
319
319
  }, history.replaceState = function(...r) {
320
- i.apply(history, r), t !== window.location.pathname && (t = window.location.pathname, v());
321
- }, await Le();
320
+ a.apply(history, r), t !== window.location.pathname && (t = window.location.pathname, v());
321
+ }, await Me();
322
322
  }
323
323
  };
324
324
  export {
@@ -327,5 +327,5 @@ export {
327
327
  g as c,
328
328
  Fe as d,
329
329
  be as m,
330
- a as p
330
+ i as p
331
331
  };
@@ -0,0 +1,187 @@
1
+ var b = Object.defineProperty;
2
+ var y = (o, t, n) => t in o ? b(o, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[t] = n;
3
+ var h = (o, t, n) => y(o, typeof t != "symbol" ? t + "" : t, n);
4
+ import { getFetchClient as w } from "@strapi/strapi/admin";
5
+ import r, { z as e } from "zod";
6
+ import { p as i, m as c } from "./index-CQxsvheX.mjs";
7
+ e.object({
8
+ name: e.string().min(1, "Name is required").max(255, "Name must be less than 255 characters"),
9
+ 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")
10
+ });
11
+ e.object({
12
+ isValid: e.boolean(),
13
+ message: e.string().optional(),
14
+ field: e.enum(["name", "code"]).optional()
15
+ });
16
+ const s = r.union([r.string(), r.number()]).transform((o) => {
17
+ const t = parseInt(o.toString(), 10);
18
+ if (isNaN(t) || t <= 0)
19
+ throw new r.ZodError([
20
+ { message: "ID must be a positive integer", code: "custom", path: ["id"] }
21
+ ]);
22
+ return t;
23
+ }), f = e.object({
24
+ id: s,
25
+ documentId: e.string().min(1, "Document ID is required"),
26
+ action: e.string().min(1, "Action is required"),
27
+ actionParameters: e.record(e.any()).optional(),
28
+ subject: e.string().min(1, "Subject is required").nullable().optional(),
29
+ properties: e.record(e.any()).optional(),
30
+ conditions: e.array(e.record(e.any())).optional()
31
+ });
32
+ e.object({
33
+ sort: e.string().optional(),
34
+ search: e.string().optional(),
35
+ page: e.coerce.number().int().positive().optional(),
36
+ pageSize: e.coerce.number().int().positive().optional()
37
+ });
38
+ const $ = e.object({
39
+ name: e.string().min(1, "Name is required"),
40
+ code: e.string().min(1, "Code is required"),
41
+ description: e.string().optional()
42
+ }), d = $.merge(
43
+ e.object({
44
+ id: s,
45
+ documentId: e.string().min(1, "Document ID is required")
46
+ })
47
+ );
48
+ d.merge(
49
+ e.object({
50
+ permissions: f.array()
51
+ })
52
+ );
53
+ const u = e.object({
54
+ id: s,
55
+ name: e.string().min(1, "Name is required")
56
+ }), C = r.object({
57
+ id: r.number(),
58
+ name: r.string(),
59
+ url: r.string(),
60
+ width: r.number(),
61
+ height: r.number(),
62
+ ext: r.string(),
63
+ size: r.number()
64
+ }).passthrough(), g = r.object({
65
+ name: r.string().min(1, "Name is required"),
66
+ code: r.string().min(1, "Code is required"),
67
+ customFields: r.record(r.any()).optional().nullable(),
68
+ damRootDirectory: r.string().optional().nullable(),
69
+ logo: C.optional().nullable()
70
+ }), m = g.extend({
71
+ id: s,
72
+ documentId: r.string()
73
+ });
74
+ m.extend({
75
+ role: d.optional().nullable()
76
+ });
77
+ const S = g.extend({
78
+ role: s.optional().nullable(),
79
+ tokens: r.array(s).optional().nullable()
80
+ }), j = m.omit({
81
+ id: !0,
82
+ documentId: !0
83
+ }).extend({
84
+ role: s.optional().nullable(),
85
+ tokens: r.array(s).optional().nullable()
86
+ }), E = r.object({
87
+ page: r.number(),
88
+ pageCount: r.number(),
89
+ pageSize: r.number(),
90
+ total: r.number()
91
+ }), I = e.object({
92
+ results: e.array(m),
93
+ pagination: E
94
+ }), p = m.extend({
95
+ role: d.optional().nullable(),
96
+ tokens: e.array(u).optional().nullable()
97
+ });
98
+ class q {
99
+ constructor() {
100
+ h(this, "fetchClient", w());
101
+ }
102
+ async validateTenant(t) {
103
+ try {
104
+ const n = await this.fetchClient.post(`/${i}/validate`, t);
105
+ return console.log("response.data", n.data), n.data;
106
+ } catch (n) {
107
+ throw n instanceof e.ZodError ? new Error(`Validation error: ${n.errors.map((a) => a.message).join(", ")}`) : n;
108
+ }
109
+ }
110
+ async getTenants(t) {
111
+ try {
112
+ const n = await this.fetchClient.get(`/${i}/${c}`, { params: t });
113
+ return I.parse(n.data);
114
+ } catch {
115
+ throw new Error("Failed to fetch tenants");
116
+ }
117
+ }
118
+ async getTenant(t) {
119
+ try {
120
+ const n = await this.fetchClient.get(`/${i}/${c}/${t}`);
121
+ return p.parseAsync(n.data);
122
+ } catch {
123
+ throw new Error("Failed to fetch tenant");
124
+ }
125
+ }
126
+ async createTenant(t) {
127
+ try {
128
+ const n = S.parse(t), a = await this.fetchClient.post(`/${i}/${c}`, n);
129
+ return p.parseAsync(a.data);
130
+ } catch (n) {
131
+ throw console.log("error", n), n instanceof e.ZodError ? new Error(`Validation error: ${n.errors.map((a) => a.message).join(", ")}`) : n;
132
+ }
133
+ }
134
+ async updateTenant(t, n) {
135
+ try {
136
+ const a = j.parse(n), l = await this.fetchClient.put(
137
+ `/${i}/${c}/${t}`,
138
+ a
139
+ );
140
+ return p.parseAsync(l.data);
141
+ } catch (a) {
142
+ throw a instanceof e.ZodError ? new Error(`Validation error: ${a.errors.map((l) => l.message).join(", ")}`) : new Error("Failed to update domain");
143
+ }
144
+ }
145
+ async deleteTenant(t) {
146
+ try {
147
+ await this.fetchClient.del(`/${i}/${c}/${t}`);
148
+ } catch {
149
+ throw new Error("Failed to delete tenant");
150
+ }
151
+ }
152
+ async getRoles() {
153
+ try {
154
+ const t = await this.fetchClient.get("/admin/roles");
155
+ return e.array(d).parse(t.data.data);
156
+ } catch {
157
+ throw new Error("Failed to fetch roles");
158
+ }
159
+ }
160
+ async getTokens() {
161
+ try {
162
+ const t = await this.fetchClient.get("/admin/api-tokens");
163
+ return e.array(u).parse(t.data.data);
164
+ } catch {
165
+ throw new Error("Failed to fetch roles");
166
+ }
167
+ }
168
+ async validateCustomField({
169
+ model: t,
170
+ documentId: n,
171
+ field: a,
172
+ value: l
173
+ }) {
174
+ return (await this.fetchClient.post(`/${i}/${c}/${t}/validate`, {
175
+ documentId: n,
176
+ field: a,
177
+ value: l
178
+ })).data;
179
+ }
180
+ async getSettings() {
181
+ return (await this.fetchClient.get(`/${i}/license`)).data;
182
+ }
183
+ }
184
+ const R = new q();
185
+ export {
186
+ R as a
187
+ };
@@ -0,0 +1 @@
1
+ "use strict";var g=Object.defineProperty;var f=(o,t,n)=>t in o?g(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n;var m=(o,t,n)=>f(o,typeof t!="symbol"?t+"":t,n);const z=require("@strapi/strapi/admin"),e=require("zod"),r=require("./index-BwgjJmHR.js"),b=o=>o&&o.__esModule?o:{default:o},a=b(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 s=a.default.union([a.default.string(),a.default.number()]).transform(o=>{const t=parseInt(o.toString(),10);if(isNaN(t)||t<=0)throw new a.default.ZodError([{message:"ID must be a positive integer",code:"custom",path:["id"]}]);return t}),y=e.z.object({id:s,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 w=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=w.merge(e.z.object({id:s,documentId:e.z.string().min(1,"Document ID is required")}));c.merge(e.z.object({permissions:y.array()}));const p=e.z.object({id:s,name:e.z.string().min(1,"Name is required")}),$=a.default.object({id:a.default.number(),name:a.default.string(),url:a.default.string(),width:a.default.number(),height:a.default.number(),ext:a.default.string(),size:a.default.number()}).passthrough(),h=a.default.object({name:a.default.string().min(1,"Name is required"),code:a.default.string().min(1,"Code is required"),customFields:a.default.record(a.default.any()).optional().nullable(),damRootDirectory:a.default.string().optional().nullable(),logo:$.optional().nullable()}),d=h.extend({id:s,documentId:a.default.string()});d.extend({role:c.optional().nullable()});const I=h.extend({role:s.optional().nullable(),tokens:a.default.array(s).optional().nullable()}),C=d.omit({id:!0,documentId:!0}).extend({role:s.optional().nullable(),tokens:a.default.array(s).optional().nullable()}),S=a.default.object({page:a.default.number(),pageCount:a.default.number(),pageSize:a.default.number(),total:a.default.number()}),j=e.z.object({results:e.z.array(d),pagination:S}),u=d.extend({role:c.optional().nullable(),tokens:e.z.array(p).optional().nullable()});class q{constructor(){m(this,"fetchClient",z.getFetchClient())}async validateTenant(t){try{const n=await this.fetchClient.post(`/${r.pluginId}/validate`,t);return console.log("response.data",n.data),n.data}catch(n){throw n instanceof e.z.ZodError?new Error(`Validation error: ${n.errors.map(i=>i.message).join(", ")}`):n}}async getTenants(t){try{const n=await this.fetchClient.get(`/${r.pluginId}/${r.modelRoute}`,{params:t});return j.parse(n.data)}catch{throw new Error("Failed to fetch tenants")}}async getTenant(t){try{const n=await this.fetchClient.get(`/${r.pluginId}/${r.modelRoute}/${t}`);return u.parseAsync(n.data)}catch{throw new Error("Failed to fetch tenant")}}async createTenant(t){try{const n=I.parse(t),i=await this.fetchClient.post(`/${r.pluginId}/${r.modelRoute}`,n);return u.parseAsync(i.data)}catch(n){throw console.log("error",n),n instanceof e.z.ZodError?new Error(`Validation error: ${n.errors.map(i=>i.message).join(", ")}`):n}}async updateTenant(t,n){try{const i=C.parse(n),l=await this.fetchClient.put(`/${r.pluginId}/${r.modelRoute}/${t}`,i);return u.parseAsync(l.data)}catch(i){throw i instanceof e.z.ZodError?new Error(`Validation error: ${i.errors.map(l=>l.message).join(", ")}`):new Error("Failed to update domain")}}async deleteTenant(t){try{await this.fetchClient.del(`/${r.pluginId}/${r.modelRoute}/${t}`)}catch{throw new Error("Failed to delete tenant")}}async getRoles(){try{const t=await this.fetchClient.get("/admin/roles");return e.z.array(c).parse(t.data.data)}catch{throw new Error("Failed to fetch roles")}}async getTokens(){try{const t=await this.fetchClient.get("/admin/api-tokens");return e.z.array(p).parse(t.data.data)}catch{throw new Error("Failed to fetch roles")}}async validateCustomField({model:t,documentId:n,field:i,value:l}){return(await this.fetchClient.post(`/${r.pluginId}/${r.modelRoute}/${t}/validate`,{documentId:n,field:i,value:l})).data}async getSettings(){return(await this.fetchClient.get(`/${r.pluginId}/license`)).data}}const E=new q;exports.api=E;
@@ -1 +1 @@
1
- "use strict";const e=require("../_chunks/index-Bmegt3iZ.js");module.exports=e.plugin;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-BwgjJmHR.js");exports.default=e.plugin;
@@ -1,4 +1,4 @@
1
- import { d as e } from "../_chunks/index-D6ydxf5B.mjs";
1
+ import { d as e } from "./index-CQxsvheX.mjs";
2
2
  export {
3
3
  e as default
4
4
  };
@@ -1,5 +1,5 @@
1
1
  import { useIntl as r } from "react-intl";
2
- import { p as a } from "./index-D6ydxf5B.mjs";
2
+ import { p as a } from "./index-CQxsvheX.mjs";
3
3
  const p = () => {
4
4
  const { formatMessage: s } = r();
5
5
  return (e, { defaultMessage: t, values: o } = {}) => s(
@@ -0,0 +1 @@
1
+ "use strict";const r=require("react-intl"),u=require("./index-BwgjJmHR.js"),c=()=>{const{formatMessage:e}=r.useIntl();return(s,{defaultMessage:t,values:n}={})=>e({id:`${u.pluginId}.${s}`,defaultMessage:t},n)};exports.useGetMessage=c;
@@ -0,0 +1 @@
1
+ "use strict";const e=require("@tanstack/react-query"),t=require("./index-eSOlzCRc.js"),s=()=>e.useQuery({queryKey:["multi-domain-settings"],queryFn:()=>t.api.getSettings(),staleTime:120*1e3});exports.useSettings=s;
@@ -1,9 +1,9 @@
1
1
  import { useQuery as e } from "@tanstack/react-query";
2
- import { a as t } from "./index-DMvlWHGg.mjs";
2
+ import { a as t } from "./index-CwsztY3K.mjs";
3
3
  const i = () => e({
4
4
  queryKey: ["multi-domain-settings"],
5
5
  queryFn: () => t.getSettings(),
6
- staleTime: 2 * 60 * 1e3
6
+ staleTime: 120 * 1e3
7
7
  // 2 minutes
8
8
  });
9
9
  export {
@@ -0,0 +1 @@
1
+ "use strict";const i=require("react/jsx-runtime"),d=require("@strapi/strapi/admin"),s=require("@tanstack/react-query"),u=require("./index-eSOlzCRc.js"),m=require("./index-BwgjJmHR.js"),q=()=>{const e=d.useFetchClient();return s.useQuery({queryKey:["permissions"],queryFn:async()=>{const{data:t}=await e.get("/admin/users/me/permissions");return t.data},staleTime:1e3*60*5,refetchOnWindowFocus:!1,retry:!1})},T=({permissions:e,children:t,NotAllowed:r=()=>null})=>{const{isLoading:o,data:l}=q();if(o)return null;const c=a=>e?l?.some(y=>y.action===a):!0;return e&&!e.every(a=>c(a.action))?i.jsx(r,{}):t?i.jsx(i.Fragment,{children:t}):null},n={all:[m.modelRoute],lists:()=>[...n.all,"list"],list:e=>[...n.lists(),{filters:e}],details:()=>[...n.all,"detail"],detail:e=>[...n.details(),e]},F=e=>s.useQuery({queryKey:[...n.lists(),JSON.stringify(e||{})],queryFn:()=>u.api.getTenants(e),staleTime:120*1e3}),Q=e=>s.useQuery({queryKey:n.detail(e),queryFn:()=>u.api.getTenant(e),enabled:!!e,staleTime:120*1e3}),C=()=>{const e=s.useQueryClient();return s.useMutation({mutationFn:t=>u.api.createTenant(t),onSuccess:async()=>{await e.invalidateQueries({queryKey:n.lists()})},onError:t=>{console.error("Failed to create tenant:",t)}})},f=()=>{const e=s.useQueryClient();return s.useMutation({mutationFn:({id:t,data:r})=>u.api.updateTenant(t,r),onSuccess:t=>{e.setQueryData(n.detail(t.id),t),e.invalidateQueries({queryKey:n.lists()})},onError:t=>{console.error("Failed to update domain:",t)}})},K=()=>{const e=s.useQueryClient();return s.useMutation({mutationFn:t=>u.api.deleteTenant(t),onSuccess:(t,r)=>{e.removeQueries({queryKey:n.detail(r)}),e.invalidateQueries({queryKey:n.lists()})},onError:t=>{console.error("Failed to delete tenant:",t)}})};exports.CheckPermissions=T;exports.useCreateTenant=C;exports.useDeleteTenant=K;exports.useTenant=Q;exports.useTenants=F;exports.useUpdateTenant=f;
@@ -1,8 +1,8 @@
1
1
  import { jsx as l, Fragment as f } from "react/jsx-runtime";
2
2
  import { useFetchClient as q } from "@strapi/strapi/admin";
3
3
  import { useQuery as i, useQueryClient as o, useMutation as u } from "@tanstack/react-query";
4
- import { a as s } from "./index-DMvlWHGg.mjs";
5
- import { m as F } from "./index-D6ydxf5B.mjs";
4
+ import { a as s } from "./index-CwsztY3K.mjs";
5
+ import { m as F } from "./index-CQxsvheX.mjs";
6
6
  const T = () => {
7
7
  const e = q();
8
8
  return i({
@@ -34,13 +34,13 @@ const T = () => {
34
34
  }, S = (e) => i({
35
35
  queryKey: [...n.lists(), JSON.stringify(e || {})],
36
36
  queryFn: () => s.getTenants(e),
37
- staleTime: 2 * 60 * 1e3
37
+ staleTime: 120 * 1e3
38
38
  // 2 minutes
39
39
  }), h = (e) => i({
40
40
  queryKey: n.detail(e),
41
41
  queryFn: () => s.getTenant(e),
42
42
  enabled: !!e,
43
- staleTime: 2 * 60 * 1e3
43
+ staleTime: 120 * 1e3
44
44
  // 2 minutes
45
45
  }), w = () => {
46
46
  const e = o();