@sensinum/strapi-plugin-multi-domain 5.2.2 → 5.3.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.
Files changed (63) hide show
  1. package/dist/{_chunks/About-BwHHM2-e.mjs → admin/About-DfCon-RP.mjs} +5 -5
  2. package/dist/{_chunks/About-BMKe8Nmq.js → admin/About-DfcPwQ3q.js} +2 -2
  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-v1cjVAKt.mjs → admin/Settings-Dj3h2ayB.mjs} +3 -3
  6. package/dist/{_chunks/Settings-dlu3XY5j.js → admin/Settings-tt-Wetcr.js} +1 -1
  7. package/dist/{_chunks/TenantCustomField-cjk2h9Sy.js → admin/TenantCustomField-Bf6uUoKE.js} +1 -1
  8. package/dist/{_chunks/TenantCustomField-Cc17Wct3.mjs → admin/TenantCustomField-CS8x0CkO.mjs} +24 -24
  9. package/dist/admin/TenantEdit-BT3-tB_B.js +1 -0
  10. package/dist/admin/TenantEdit-BY_7PPAr.mjs +490 -0
  11. package/dist/admin/TenantList-DrfJNPpi.js +1 -0
  12. package/dist/{_chunks/TenantList-CONeayj-.mjs → admin/TenantList-dIxGcZPl.mjs} +43 -45
  13. package/dist/{_chunks/index-D6ydxf5B.mjs → admin/index-7tHbI_K_.mjs} +55 -54
  14. package/dist/admin/index-Cci_046h.js +1 -0
  15. package/dist/admin/index-Doprxev-.mjs +187 -0
  16. package/dist/admin/index-oNXgzV7S.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-CTdHvgbI.mjs} +1 -1
  20. package/dist/admin/useGetMessage-DS88gOrN.js +1 -0
  21. package/dist/admin/useSettings-C7vR1hfw.js +1 -0
  22. package/dist/{_chunks/useSettings-CimYpZ4J.mjs → admin/useSettings-bLTyn7Pl.mjs} +2 -2
  23. package/dist/{_chunks/useTenants-DezjZnH2.mjs → admin/useTenants-Da8khjOe.mjs} +4 -4
  24. package/dist/admin/useTenants-vVkOIEvT.js +1 -0
  25. package/dist/server/index.js +4 -6
  26. package/dist/server/index.mjs +3396 -7192
  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
@@ -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-7tHbI_K_.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";const $=require("remeda"),D=require("zod"),o=require("react/jsx-runtime"),f=require("react"),w=require("react-cookie"),_=require("react-router-dom"),H=require("@strapi/strapi/admin"),i=require("@strapi/design-system"),U=require("react-dom/client"),F=require("@strapi/icons"),M=require("@tanstack/react-query"),z=e=>e&&e.__esModule?e:{default:e},Q=z(f),W="@sensinum/strapi-plugin-multi-domain",J="5.3.2",V="https://www.sensinum.com/contact",G="hello@sensinum.com",K={name:"multi-domain"},X={name:W,version:J,homepage:V,email:G},r=D.z.literal("multi-domain").parse(K.name);$.toSnakeCase(r);const h="domain",T="domain",P=`${h}s`,p="domain",k={read:"read",change:"change",create:"create",delete:"delete"},x=e=>`plugin::${r}.${k[e]}`,j={admin:{access:Object.keys(k).map(e=>({action:x(e),subject:null})),create:[{action:x("create"),subject:null}],edit:[{action:x("change"),subject:null}],delete:[{action:x("delete"),subject:null}]}},g=`data-${h}-initialized`,Y="strapi-super-admin",L=e=>e?.code===Y,Z=e=>{const t=`/admin/content-manager/collection-types/${e}/create`,n=document.querySelector(`a[href*="${t}"]`);n&&(n.style.display="none")},ee=()=>{const[{[p]:e}]=w.useCookies([p]),t=L(e),{slug:n}=_.useParams();return Q.default.useEffect(()=>{n&&(t||!e)&&Z(n)},[t,e,n]),null},te=()=>o.jsx(w.CookiesProvider,{children:o.jsx(ee,{})}),ne=({setPlugin:e})=>{const t=f.useRef(e);return f.useEffect(()=>{t.current(r)},[]),null},E={en:()=>Promise.resolve().then(()=>require("./en-hAVH8fH0.js"))},A=(e,t)=>{if(!e)throw new TypeError("Prefix can't be empty");return Object.keys(t).reduce((n,a)=>(n[`${e}.${a}`]=t[a],n),{})},S=(e,t="")=>Object.keys(e).reduce((n,a)=>{const s=t.length?`${t}.`:"";return typeof e[a]=="object"&&e[a]!==null&&!Array.isArray(e[a])?Object.assign(n,S(e[a],s+a)):n[s+a]=e[a],n},{}),oe=({onClose:e,userData:t})=>{const[{[p]:n},a]=w.useCookies([p]),[s,u]=f.useState(""),[l,m]=f.useState(n||null),d=(t[T]||[]).filter(c=>c.name.toLowerCase().includes(s.toLowerCase())),y=c=>{m(l?.id===c.id?null:c)},O=()=>{l&&(a(p,JSON.stringify(l),{path:"/",maxAge:3600*24*30,domain:window.location.hostname}),window.location.reload())};return console.log("Avatar",i.Avatar),o.jsx(i.Modal.Root,{defaultOpen:!0,onOpenChange:e,children:o.jsxs(i.Modal.Content,{children:[o.jsx(i.Modal.Header,{children:o.jsx(i.Modal.Title,{children:"Select Domain"})}),o.jsxs(i.Modal.Body,{children:[o.jsx(i.Box,{paddingBottom:4,children:o.jsxs(i.Field.Root,{name:"tenant-search",children:[o.jsx(i.Field.Label,{children:"Search domains"}),o.jsx(i.Searchbar,{name:"tenant-search",onClear:()=>u(""),value:s,onChange:c=>u(c.target.value),placeholder:"Search domains...",size:"S",clearLabel:"Clear search",children:"Search domains"})]})}),d.length===0?o.jsx(i.EmptyStateLayout,{icon:o.jsx(F.Search,{}),content:"No domains found matching your search criteria"}):o.jsx(i.Box,{maxHeight:"400px",overflow:"auto",children:o.jsxs(i.Table,{colCount:2,rowCount:d.length+1,children:[o.jsx(i.Thead,{children:o.jsxs(i.Tr,{children:[o.jsx(i.Th,{width:"60px",children:o.jsx(i.Typography,{variant:"sigma",textColor:"neutral600",children:"Select"})}),o.jsx(i.Th,{width:"40px",children:null}),o.jsx(i.Th,{children:o.jsx(i.Typography,{variant:"sigma",textColor:"neutral600",children:"Domain name"})})]})}),o.jsx(i.Tbody,{children:d.map(c=>o.jsxs(i.Tr,{children:[o.jsx(i.Td,{width:"60px",children:o.jsx(i.Checkbox,{checked:l?.id===c.id,onCheckedChange:()=>y(c),name:`tenant-${c.id}`})}),o.jsx(i.Td,{width:"40px",children:c.logo?.url&&o.jsx(i.Avatar.Item,{src:c.logo.url,alt:c.name,preview:!1,fallback:c.name[0]})}),o.jsx(i.Td,{children:o.jsx(i.Typography,{fontWeight:"semiBold",textColor:"neutral800",children:c.name})})]},c.id))})]})})]}),o.jsxs(i.Modal.Footer,{children:[o.jsx(i.Modal.Close,{children:o.jsx(i.Button,{onClick:e,variant:"tertiary",children:"Cancel"})}),o.jsx(i.Button,{onClick:O,disabled:!l,children:"Select domain"})]})]})})},ie=new M.QueryClient({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}),ae=(e,t,n,a)=>{const s=U.createRoot(e),u=()=>{document.body.removeAttribute("style"),s.unmount(),setTimeout(()=>{document.body.style.pointerEvents="auto"},0)};return t.remove(),s.render(o.jsx(i.DesignSystemProvider,{theme:a==="light"?i.lightTheme:i.darkTheme,children:o.jsx(M.QueryClientProvider,{client:ie,children:o.jsx(w.CookiesProvider,{children:o.jsx(oe,{onClose:u,userData:n})})})}))},b=(e,t)=>new Promise((n,a)=>{const l=(m=0)=>{if(m>50){a(new Error("Button not found after 50 attempts"));return}const d=(t||document).querySelector(e);if(d){n(d);return}setTimeout(()=>l(m+1),250)};l()}),I=()=>{try{const t=document.cookie.split(";").find(n=>n.trim().startsWith(`${p}=`));if(t){const n=t.split("=").at(1);if(!n)return null;const a=decodeURIComponent(n);return JSON.parse(a)}}catch(e){console.error("Error parsing tenant cookie:",e)}return null},re=e=>{const t=e.firstChild,n=t?.lastChild?.cloneNode(!0);if(t&&n instanceof HTMLElement){const a=n.firstChild;a&&n.replaceChildren(a);const s=n.querySelector("span");if(s){const u=I();s.innerText=u?`${h.toUpperCase()}: ${u.name}`:`No ${h} selected`}n.style.paddingTop="1rem",t.appendChild(n)}},v=async()=>{try{const e=H.getFetchClient(),{data:{data:t}}=await e.get("/admin/users/me");return t}catch{return null}},R=async()=>{const e=await v(),t=document.createElement("div");document.body.appendChild(t);const n=await b('nav button[aria-haspopup="menu"]'),a="aria-expanded";new MutationObserver(async u=>{if(u.some(l=>l.attributeName===a)&&n.getAttribute(a)==="true"){const l=await b("[data-radix-menu-content]");if(!(l instanceof HTMLElement))return;re(l);const m=await b('[role="menuitem"]',l),d=m.cloneNode(!0);if(e?.[T]&&e?.[T].length>1){if(!(d instanceof HTMLElement))return;d.querySelector("span").innerText=`Select ${h}`,d.addEventListener("mouseenter",function(){this.setAttribute("data-highlighted","true")}),d.addEventListener("mouseleave",function(){this.removeAttribute("data-highlighted")}),d.addEventListener("click",y=>{y.preventDefault(),y.stopPropagation(),ae(t,l,e,localStorage.getItem("STRAPI_THEME")||"dark")}),m.insertAdjacentElement("afterend",d)}}}).observe(n,{attributes:!0})},B=()=>window.location.pathname==="/admin/auth/login",se=()=>window.location.pathname.startsWith("/admin/plugins/upload"),ce=()=>{const e=I(),t=document.querySelector('[data-strapi-header="true"]');if(!e||L(e)){const n=t?.querySelectorAll("button");n&&n.forEach(a=>{a.style.display="none"})}},q=$.funnel(ce,{minQuietPeriodMs:250}),N=async()=>{const e=await b('nav ul > li a[href="/admin/plugins/upload"]');e&&e.addEventListener("click",()=>{q.call()}),se()&&q.call()},C=async()=>{if(B()){document.body.removeAttribute(g);return}if(await v()){document.querySelector(`[${g}]`)||(await Promise.all([R(),N()]),document.body.setAttribute(g,"true"));return}document.body.removeAttribute(g)},le=async()=>{B()||!await v()||(document.body.setAttribute(g,"true"),await Promise.all([R(),N()]))},de={register(e){e.registerPlugin({id:r,initializer:ne,isReady:!1,name:r}),e.customFields.register({name:`unique-by-${h}`,pluginId:r,type:"string",intlLabel:{id:`${r}.custom-fields.unique-by-domain.label`,defaultMessage:"Unique by domain"},intlDescription:{id:`${r}.custom-fields.unique-by-tenant.description`,defaultMessage:"Ensures the value is unique within the domain."},components:{Input:()=>Promise.resolve().then(()=>require("./TenantCustomField-Bf6uUoKE.js"))}}),e.router.addSettingsLink({id:`${r}.settings`,intlLabel:{id:`${r}.settings.label`,defaultMessage:"Multi-Domain Settings"},links:[{id:`${r}.settings.about`,intlLabel:{id:`${r}.settings.about.label`,defaultMessage:"About"},to:`/settings/${r}/about`,Component:()=>Promise.resolve().then(()=>require("./About-DfcPwQ3q.js")),permissions:j.admin.access},{id:`${r}.settings.general`,intlLabel:{id:`${r}.settings.general.label`,defaultMessage:"General Settings"},to:`/settings/${r}/${P}`,Component:()=>Promise.resolve().then(()=>require("./Settings-tt-Wetcr.js")),permissions:j.admin.access}]})},async registerTrads({locales:e}){return Promise.all(e.map(async t=>t in E?E[t]().then(({default:a})=>({data:A(r,S(a)),locale:t})):{data:A(r,S({})),locale:t}))},async bootstrap(e){e.getPlugin("content-manager").injectComponent("listView","actions",{name:"display-create-button",Component:te});let t=window.location.pathname;window.addEventListener("popstate",async()=>{t!==window.location.pathname&&(t=window.location.pathname,await C())});const n=history.pushState,a=history.replaceState;history.pushState=function(...s){n.apply(history,s),t!==window.location.pathname&&(t=window.location.pathname,C())},history.replaceState=function(...s){a.apply(history,s),t!==window.location.pathname&&(t=window.location.pathname,C())},await le()}};exports.modelId=h;exports.modelRoute=P;exports.packageJson=X;exports.permissions=j;exports.plugin=de;exports.pluginId=r;
@@ -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-oNXgzV7S.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-7tHbI_K_.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-7tHbI_K_.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-oNXgzV7S.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-Cci_046h.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-Doprxev-.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 {
@@ -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-Doprxev-.mjs";
5
+ import { m as F } from "./index-7tHbI_K_.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();
@@ -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-Cci_046h.js"),m=require("./index-oNXgzV7S.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;