@sensinum/strapi-plugin-multi-domain 5.2.0-beta.1 → 5.2.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.
- package/README.md +74 -35
- package/dist/_chunks/About-CrezKPYG.js +38 -0
- package/dist/_chunks/About-DD6q90XE.mjs +442 -0
- package/dist/_chunks/{Settings-De2gPisD.js → Settings-82rkWMJ-.js} +1 -1
- package/dist/_chunks/{Settings-q2-wnMsh.mjs → Settings-DVTWa7UL.mjs} +2 -2
- package/dist/_chunks/{TenantCustomField-B3_kP4Hn.mjs → TenantCustomField-MX6zdr0Y.mjs} +1 -1
- package/dist/_chunks/{TenantCustomField-D-7Si38A.js → TenantCustomField-aaNqlkBO.js} +1 -1
- package/dist/_chunks/{TenantEdit-BkdAbMuN.js → TenantEdit-BA2xZHAl.js} +1 -1
- package/dist/_chunks/{TenantEdit-Cb072LMV.mjs → TenantEdit-QroPNoOH.mjs} +4 -4
- package/dist/_chunks/{TenantList-CL42iP37.js → TenantList-BOEyqzpU.js} +1 -1
- package/dist/_chunks/{TenantList-kV9ECrto.mjs → TenantList-Dw1EqqA7.mjs} +55 -55
- package/dist/_chunks/{en-BPIaGv4M.mjs → en-Cf69p5po.mjs} +6 -2
- package/dist/_chunks/en-hAVH8fH0.js +1 -0
- package/dist/_chunks/index-B6P81dIL.js +1 -0
- package/dist/_chunks/{index-ChL08Dcz.mjs → index-DFrXw6xt.mjs} +5 -5
- package/dist/_chunks/{index-BlQO7jXj.mjs → index-DVqQk-cu.mjs} +2 -2
- package/dist/_chunks/{index-DAX0vpn7.js → index-lkcweU9g.js} +1 -1
- package/dist/_chunks/{useGetMessage-2uaqSNHA.mjs → useGetMessage-BQOJqwKY.mjs} +1 -1
- package/dist/_chunks/useGetMessage-CkNMUbYX.js +1 -0
- package/dist/_chunks/{useSettings-Hd_Y-NfK.js → useSettings-DArWTfyj.js} +1 -1
- package/dist/_chunks/{useSettings-BCXs1q_c.mjs → useSettings-HNeo0XZx.mjs} +1 -1
- package/dist/_chunks/{useTenants-CVYBr-JE.mjs → useTenants-D2d36FHf.mjs} +3 -3
- package/dist/_chunks/{useTenants-DAdjIYEf.js → useTenants-DA6GxylQ.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +3 -2
- package/dist/server/index.mjs +5678 -5394
- package/package.json +1 -1
- package/dist/_chunks/en-D2iOtyKE.js +0 -1
- package/dist/_chunks/index-1D9AeLxE.mjs +0 -445
- package/dist/_chunks/index-C0pkYQjH.js +0 -3
- package/dist/_chunks/index-TelSPPuG.js +0 -1
- package/dist/_chunks/useGetMessage-R3JXzZcF.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("@strapi/design-system"),i=require("react"),r=require("react-router-dom"),o=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("@strapi/design-system"),i=require("react"),r=require("react-router-dom"),o=require("./index-B6P81dIL.js"),u=require("./QueryProvider-DUoM4JhC.js"),a=t=>t&&t.__esModule?t:{default:t},n=a(i),l=n.default.lazy(()=>Promise.resolve().then(()=>require("./TenantList-BOEyqzpU.js"))),c=n.default.lazy(()=>Promise.resolve().then(()=>require("./TenantEdit-BA2xZHAl.js"))),d=()=>{const t=localStorage.getItem("STRAPI_THEME")==="light"?s.lightTheme:s.darkTheme;return e.jsx(s.DesignSystemProvider,{theme:t,children:e.jsx(u.QueryProvider,{children:e.jsxs(r.Routes,{children:[e.jsx(r.Route,{path:"",element:e.jsx(l,{})}),e.jsx(r.Route,{path:"/:id",element:e.jsx(c,{})}),e.jsx(r.Route,{path:"*",element:e.jsx(r.Navigate,{to:`/settings/${o.pluginId}/${o.modelRoute}`,replace:!0})})]})})})};exports.default=d;
|
|
@@ -2,9 +2,9 @@ import { jsx as e, jsxs as m } from "react/jsx-runtime";
|
|
|
2
2
|
import { lightTheme as i, darkTheme as a, DesignSystemProvider as n } from "@strapi/design-system";
|
|
3
3
|
import r from "react";
|
|
4
4
|
import { Routes as s, Route as t, Navigate as l } from "react-router-dom";
|
|
5
|
-
import { p, m as d } from "./index-
|
|
5
|
+
import { p, m as d } from "./index-DFrXw6xt.mjs";
|
|
6
6
|
import { Q as h } from "./QueryProvider-DLzv0qqi.mjs";
|
|
7
|
-
const c = r.lazy(() => import("./TenantList-
|
|
7
|
+
const c = r.lazy(() => import("./TenantList-Dw1EqqA7.mjs")), g = r.lazy(() => import("./TenantEdit-QroPNoOH.mjs")), P = () => {
|
|
8
8
|
const o = localStorage.getItem("STRAPI_THEME") === "light" ? i : a;
|
|
9
9
|
return /* @__PURE__ */ e(n, { theme: o, children: /* @__PURE__ */ e(h, { children: /* @__PURE__ */ m(s, { children: [
|
|
10
10
|
/* @__PURE__ */ e(t, { path: "", element: /* @__PURE__ */ e(c, {}) }),
|
|
@@ -4,7 +4,7 @@ import { unstable_useContentManagerContext as x, useNotification as j } from "@s
|
|
|
4
4
|
import { z as t } from "zod";
|
|
5
5
|
import M from "react";
|
|
6
6
|
import { useMutation as P } from "@tanstack/react-query";
|
|
7
|
-
import { a as T } from "./index-
|
|
7
|
+
import { a as T } from "./index-DVqQk-cu.mjs";
|
|
8
8
|
import { Q as V } from "./QueryProvider-DLzv0qqi.mjs";
|
|
9
9
|
import { capitalize as z } from "remeda";
|
|
10
10
|
const f = t.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("@strapi/design-system"),z=require("@strapi/strapi/admin"),e=require("zod"),F=require("react"),S=require("@tanstack/react-query"),q=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("@strapi/design-system"),z=require("@strapi/strapi/admin"),e=require("zod"),F=require("react"),S=require("@tanstack/react-query"),q=require("./index-lkcweU9g.js"),p=require("./QueryProvider-DUoM4JhC.js"),C=require("remeda"),M=t=>t&&t.__esModule?t:{default:t},_=M(F),g=e.z.object({modified:e.z.boolean(),isSubmitting:e.z.boolean(),disabled:e.z.boolean(),values:e.z.record(e.z.any()),initialValues:e.z.record(e.z.any()),errors:e.z.record(e.z.any()),onChange:e.z.function().args(e.z.object({target:e.z.object({name:e.z.string(),value:e.z.any()})})).returns(e.z.void()),resetForm:e.z.function().returns(e.z.void())}),P=t=>{const r=z.unstable_useContentManagerContext(),{form:o}=r,u=t?g.merge(t):g;return _.default.useMemo(()=>({...r,form:u.passthrough().parse(o)}),[r,o,u])},R=()=>S.useMutation({mutationFn:async t=>q.api.validateCustomField(t)}),T=e.z.object({setSubmitting:e.z.function().args(e.z.boolean()).returns(e.z.void())}),Q=({disabled:t,placeholder:r,required:o,hint:u,value:f,onChange:c,label:b,name:i,rawError:l})=>{const{id:y,model:v,form:d}=P(T),m=R(),{toggleNotification:j}=z.useNotification(),x=async h=>{try{d.setSubmitting(!0);const s=await m.mutateAsync({model:v,field:i,documentId:y,value:h.target.value});c({target:{value:s.value,name:i}})}catch(s){j({type:"danger",message:s instanceof Error?s.message:s.toString()})}finally{d.setSubmitting(!1)}};return n.jsxs(a.Field.Root,{name:i,hint:m.isPending?"Validating...":u,required:o,error:l?.defaultMessage,children:[n.jsx(a.Field.Label,{children:C.capitalize(b)}),n.jsx(a.TextInput,{name:i,value:f,onChange:c,onBlur:x,placeholder:r,disabled:t,error:!!l,"aria-describedby":`${i}-hint`,"aria-required":o}),n.jsx(a.Field.Hint,{}),n.jsx(a.Field.Error,{})]})},V=t=>n.jsx(p.QueryProvider,{children:n.jsx(Q,{...t})});exports.default=V;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("@strapi/design-system"),p=require("@strapi/strapi/admin"),v=require("react"),S=require("react-router-dom"),B=require("remeda"),h=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("@strapi/design-system"),p=require("@strapi/strapi/admin"),v=require("react"),S=require("react-router-dom"),B=require("remeda"),h=require("./index-B6P81dIL.js"),j=require("./useGetMessage-CkNMUbYX.js"),T=require("./useTenants-DA6GxylQ.js"),I=require("@strapi/icons"),M=require("@tanstack/react-query"),w=require("./index-lkcweU9g.js"),D=n=>n&&n.__esModule?n:{default:n},E=D(v),G=({isEditing:n,isSaving:r,onCancel:o})=>{const a=j.useGetMessage();return e.jsx(t.Flex,{justifyContent:"flex-start",gap:2,direction:"column",height:"100%",width:"100%",children:e.jsxs(t.Box,{background:"neutral0",padding:8,shadow:"filterShadow",hasRadius:!0,width:"100%",children:[e.jsx(t.Typography,{variant:"sigma",textTransform:"uppercase",textColor:"neutral600",tag:"h2",marginBottom:4,children:a("domain.edit.actions.entry")}),e.jsxs(t.Flex,{direction:"column",gap:2,children:[e.jsx(T.CheckPermissions,{permissions:n?h.permissions.admin.edit:h.permissions.admin.create,children:e.jsx(t.Button,{type:"submit",loading:r,width:"100%",children:a(n?"domain.edit.actions.update":"domain.edit.actions.create")})}),e.jsx(t.Button,{variant:"secondary",onClick:o,width:"100%",children:a("common.cancel")})]})]})})},N=({isEditing:n,tenantName:r})=>{const o=j.useGetMessage();return e.jsx(p.Layouts.Header,{title:e.jsx(t.Box,{padding:6,children:e.jsxs(t.Flex,{gap:2,direction:"column",alignItems:"flex-start",children:[e.jsx(t.Link,{variant:"tertiary",tag:S.NavLink,startIcon:e.jsx(I.ArrowLeft,{}),to:`/settings/${h.pluginId}/${h.modelRoute}`,children:o("common.back")}),e.jsx(t.Typography,{variant:"alpha",fontWeight:"bold",marginTop:2,children:n?r||o("domain.edit.title.edit",{values:{name:h.modelId}}):o("domain.edit.title.create")})]})}),as:"h2"})},H=({disabled:n=!1,error:r})=>{const o=j.useGetMessage(),a=p.useStrapiApp("CustomMediaInput",i=>i.fields?.media||{});return a?e.jsxs(t.Field.Root,{name:"logo",hint:o("domain.edit.form.logo.hint"),error:r,children:[e.jsx(a,{label:"Logo",name:"logo",disabled:n,attribute:{allowedTypes:["images"],multiple:!1}}),e.jsx(t.Field.Hint,{}),e.jsx(t.Field.Error,{})]}):null},L={all:["roles"],lists:()=>[...L.all,"list"]},P=()=>M.useQuery({queryKey:L.lists(),queryFn:()=>w.api.getRoles(),staleTime:10*60*1e3}),O=({value:n,onChange:r,disabled:o=!1,error:a,onLoadMore:i,onSearch:l})=>{const{data:d=[],isLoading:u}=P(),x=j.useGetMessage(),f=()=>{r({target:{name:"role",value:""}})},F=g=>{r({target:{name:"role",value:g}})},R=v.useCallback(g=>{const k=g.target.value;l&&l(k)},[l]),b=v.useCallback(()=>{i&&!u&&i()},[i,u]);return e.jsxs(t.Field.Root,{name:"role",hint:x("domain.edit.form.role.hint"),error:a,children:[e.jsx(t.Field.Label,{children:x("domain.edit.form.role.label")}),e.jsx(t.Combobox,{loading:u,hasMoreItems:!u,name:"role",disabled:o,value:n,onChange:F,placeholder:x("domain.edit.form.role.placeholder"),onInputChange:R,onLoadMore:b,children:d.map(g=>e.jsx(t.ComboboxOption,{value:g.id.toString(),children:g.name},g.id))}),n&&d.length>0&&e.jsxs(t.Flex,{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,hasRadius:!0,borderColor:"neutral200",background:"neutral0",justifyContent:"space-between",children:[e.jsx(t.Typography,{textColor:"neutral800",fontWeight:"bold",children:d.find(g=>g.id.toString()===n)?.name}),o?null:e.jsx(t.Box,{children:e.jsx(t.IconButton,{onClick:f,label:x("domain.edit.form.role.remove"),variant:"ghost",size:"S",children:e.jsx(I.Cross,{})})})]}),e.jsx(t.Field.Hint,{})]})},q={all:["tokens"],lists:()=>[...q.all,"list"]},$=()=>M.useQuery({queryKey:q.lists(),queryFn:()=>w.api.getTokens(),staleTime:10*60*1e3}),A=({value:n=[],onChange:r,disabled:o=!1,error:a})=>{const{data:i=[]}=$(),l=j.useGetMessage(),d=u=>{const x=u.map(f=>Number(f));r({target:{name:"tokens",value:x}})};return e.jsxs(t.Field.Root,{name:"tokens",hint:l("domain.edit.form.tokens.hint"),error:a,children:[e.jsx(t.Field.Label,{children:l("domain.edit.form.tokens.label")}),e.jsx(t.MultiSelect,{withTags:!0,name:"tokens",disabled:o,value:n.map(u=>u.toString()),onChange:d,placeholder:l("domain.edit.form.tokens.placeholder"),children:i.map(u=>e.jsx(t.MultiSelectOption,{value:u.id.toString(),children:u.name},u.id.toString()))}),e.jsx(t.Field.Hint,{})]})},W=({values:n,onChange:r,disabled:o,errors:a})=>{const i=j.useGetMessage(),l=d=>{r({target:{name:"customFields",value:d}})};return e.jsx(t.Box,{background:"neutral0",padding:8,shadow:"filterShadow",hasRadius:!0,width:"100%",children:e.jsxs(t.Flex,{direction:"column",alignItems:"stretch",gap:6,children:[e.jsxs(t.Flex,{gap:4,wrap:"wrap",children:[e.jsx(t.Box,{flex:"1",minWidth:"300px",children:e.jsxs(t.Field.Root,{name:"name",required:!0,hint:i("domain.edit.form.name.hint"),error:a.name,children:[e.jsx(t.Field.Label,{children:i("domain.edit.form.name.label")}),e.jsx(t.TextInput,{disabled:o,name:"name",value:n.name,onChange:r,placeholder:i("domain.edit.form.name.placeholder"),required:!0}),e.jsx(t.Field.Hint,{}),e.jsx(t.Field.Error,{})]})}),e.jsx(t.Box,{flex:"1",minWidth:"300px",children:e.jsxs(t.Field.Root,{name:"code",required:!0,hint:i("domain.edit.form.code.hint"),error:a.code,children:[e.jsx(t.Field.Label,{children:i("domain.edit.form.code.label")}),e.jsx(t.TextInput,{disabled:o,name:"code",value:n.code,onChange:r,placeholder:i("domain.edit.form.code.placeholder"),required:!0}),e.jsx(t.Field.Hint,{}),e.jsx(t.Field.Error,{})]})})]}),e.jsx(H,{value:n.logo,onChange:r,disabled:o,error:a.logo?.toString()}),e.jsxs(t.Flex,{gap:4,wrap:"wrap",children:[e.jsx(t.Box,{flex:"1",minWidth:"300px",children:e.jsx(O,{value:n.role,onChange:r,disabled:o,error:a.role?.toString()})}),e.jsx(t.Box,{flex:"1",minWidth:"300px",children:e.jsx(A,{value:n.tokens||[],onChange:r,disabled:o,error:a.tokens?.toString()})})]}),e.jsxs(t.Field.Root,{name:"damRootDirectory",hint:i("domain.edit.form.damRootDirectory.hint"),error:a.damRootDirectory,children:[e.jsx(t.Field.Label,{children:i("domain.edit.form.damRootDirectory.label")}),e.jsx(t.TextInput,{disabled:o,name:"damRootDirectory",value:n.damRootDirectory,onChange:r,placeholder:i("domain.edit.form.damRootDirectory.placeholder")}),e.jsx(t.Field.Hint,{}),e.jsx(t.Field.Error,{})]}),e.jsxs(t.Field.Root,{name:"customFields",hint:i("domain.edit.form.customFields.hint"),error:a.customFields,children:[e.jsx(t.Field.Label,{children:i("domain.edit.form.customFields.label")}),e.jsx(t.JSONInput,{name:"customFields",value:n.customFields,onChange:l,minHeight:"200px"}),e.jsx(t.Field.Hint,{})]})]})})},J=({message:n="Loading..."})=>e.jsx(t.Box,{padding:8,textAlign:"center",children:e.jsx(t.Loader,{children:n})}),_=()=>M.useMutation({mutationFn:n=>w.api.validateTenant(n),onError:n=>{console.error("Tenant validation failed:",n)}});class K{constructor(r){this.inner=r,this.name="ValidationError"}name}const V=()=>{const n=S.useNavigate(),{id:r}=S.useParams(),o=r!=="new",a=o?parseInt(r):void 0,{toggleNotification:i}=p.useNotification(),l=j.useGetMessage(),{data:d,isLoading:u}=T.useTenant(a),x=_(),f=T.useCreateTenant(),F=T.useUpdateTenant(),R=E.default.useMemo(()=>({name:d?.name||"",code:d?.code||"",role:d?.role?.id?.toString()||"",tokens:d?.tokens?.map(s=>s.id),damRootDirectory:d?.damRootDirectory||"",customFields:JSON.stringify(d?.customFields||{},null,2),logo:d?.logo||null}),[d]),b=d?.code==="strapi-super-admin",g=async s=>{try{let m={};try{m=JSON.parse(s.customFields||"{}")}catch{i({type:"danger",message:l("domain.edit.notifications.invalidJson")});return}if(o&&a){const c={...s,role:s.role?parseInt(s.role):void 0,tokens:s.tokens||[],customFields:m,logo:s.logo||null};await F.mutateAsync({id:a,data:c}),i({type:"success",message:l("domain.edit.notifications.updated")})}else{const c={...s,role:s.role?parseInt(s.role):void 0,tokens:s.tokens||[],customFields:m,logo:s.logo||null},y=await f.mutateAsync(c);i({type:"success",message:l("domain.edit.notifications.created")}),n(`/settings/${h.pluginId}/${h.modelRoute}/${y.id}`)}}catch(m){i({type:"danger",message:m instanceof Error?m.message:l("domain.edit.notifications.saveError")})}},k=async s=>{const m={};if(s.customFields)try{JSON.parse(s.customFields)}catch{m.customFields=l("domain.edit.validation.invalidJson")}if(s.name||s.code)try{const c={excludeId:a};s.name&&(c.name=s.name),s.code&&(c.code=s.code);const y=await x.mutateAsync(c);y.name&&(m.name=y.name||"Name is not available"),y.code&&(m.code=y.code||"Code is not available")}catch(c){i({type:"danger",message:c instanceof Error?c.message:c?.toString()})}if(!B.isEmpty(m))throw new K(Object.keys(m).map(c=>({path:c,message:m[c]})));return s},C=f.isPending||F.isPending;return u?e.jsx(J,{message:l("domain.edit.loading")}):e.jsxs(e.Fragment,{children:[e.jsx(p.Page.Title,{children:o?l("domain.edit.title.edit",{values:{name:d?.name||h.modelId}}):l("domain.edit.title.create")}),e.jsx(p.Page.Main,{children:e.jsx(p.Form,{onSubmit:g,initialValues:R,validate:k,method:"POST",width:"auto",height:"auto",children:({values:s,onChange:m,errors:c})=>e.jsxs(e.Fragment,{children:[e.jsx(N,{isEditing:o,tenantName:d?.name}),e.jsx(p.Layouts.Content,{children:e.jsxs(t.Grid.Root,{gap:4,children:[e.jsx(t.Grid.Item,{col:9,children:e.jsx(W,{values:s,onChange:m,disabled:b,errors:c})}),e.jsx(t.Grid.Item,{col:3,children:e.jsx(G,{isEditing:o,isSaving:C,onCancel:()=>n(`/settings/${h.pluginId}/${h.modelRoute}`)})})]})})]})})})]})};exports.default=V;
|
|
@@ -4,12 +4,12 @@ import { Layouts as O, useStrapiApp as X, useNotification as Y, Page as N, Form
|
|
|
4
4
|
import _, { useCallback as H } from "react";
|
|
5
5
|
import { NavLink as ee, useNavigate as te, useParams as ne } from "react-router-dom";
|
|
6
6
|
import { isEmpty as oe } from "remeda";
|
|
7
|
-
import { b as q, p as C, m as L, c as P } from "./index-
|
|
8
|
-
import { u as b } from "./useGetMessage-
|
|
9
|
-
import { C as ie, b as ae, c as re, d as de } from "./useTenants-
|
|
7
|
+
import { b as q, p as C, m as L, c as P } from "./index-DFrXw6xt.mjs";
|
|
8
|
+
import { u as b } from "./useGetMessage-BQOJqwKY.mjs";
|
|
9
|
+
import { C as ie, b as ae, c as re, d as de } from "./useTenants-D2d36FHf.mjs";
|
|
10
10
|
import { ArrowLeft as le, Cross as se } from "@strapi/icons";
|
|
11
11
|
import { useQuery as A, useMutation as ce } from "@tanstack/react-query";
|
|
12
|
-
import { a as M } from "./index-
|
|
12
|
+
import { a as M } from "./index-DVqQk-cu.mjs";
|
|
13
13
|
const me = ({
|
|
14
14
|
isEditing: t,
|
|
15
15
|
isSaving: d,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("@strapi/design-system"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("@strapi/design-system"),m=require("@strapi/icons"),a=require("@strapi/strapi/admin"),v=require("react"),q=require("react-router-dom"),x=require("./index-B6P81dIL.js"),p=require("./useTenants-DA6GxylQ.js"),W=require("styled-components"),P=require("./useGetMessage-CkNMUbYX.js"),G=require("./useSettings-DArWTfyj.js"),A=n=>n&&n.__esModule?n:{default:n},H=A(v),O=A(W),Q=({isOpen:n,onClose:i,onConfirm:l,target:r})=>e.jsx(t.Dialog.Root,{open:n,onOpenChange:i,children:e.jsxs(t.Dialog.Content,{children:[e.jsx(t.Dialog.Header,{children:"Confirmation"}),e.jsx(t.Dialog.Body,{icon:e.jsx(m.Trash,{}),children:e.jsx(t.Dialog.Description,{textAlign:"center",children:e.jsxs(t.Flex,{gap:2,direction:"column",children:[e.jsx(m.WarningCircle,{fill:"danger600",width:"24",height:"24"}),"Are you sure you want to delete this ",r,"?",e.jsx("br",{}),"All your modifications will be lost"]})})}),e.jsxs(t.Dialog.Footer,{children:[e.jsx(t.Dialog.Action,{children:e.jsx(t.Button,{fullWidth:!0,onClick:i,variant:"tertiary",size:"S",children:e.jsx(t.Typography,{variant:"omega",children:"Cancel"})})}),e.jsx(t.Dialog.Action,{children:e.jsx(t.Button,{fullWidth:!0,onClick:l,variant:"danger",size:"S",children:e.jsx(t.Typography,{variant:"omega",children:"Confirm"})})})]})]})}),U=({isDisplayed:n,direction:i})=>n?i==="asc"?e.jsx(m.ArrowUp,{}):e.jsx(m.ArrowDown,{}):null,D=({label:n,field:i,sort:l,onSort:r})=>{const[c,h]=l.split(":");return e.jsxs("div",{style:{display:"flex",alignItems:"center",cursor:"pointer"},onClick:()=>r(i)(h==="asc"?"desc":"asc"),children:[e.jsx(t.Typography,{variant:"sigma",textColor:"neutral600",children:n}),e.jsx("span",{style:{marginLeft:4},children:e.jsx(U,{isDisplayed:i===c,direction:h})})]})},J=O.default(t.Tr)(()=>({cursor:"pointer"})),K=({tenant:n,selectedTenants:i,handleSelectTenant:l,onDeleteTenant:r,isDeletePending:c=!1})=>{const h=q.useNavigate(),s=P.useGetMessage(),y=u=>()=>h(`/settings/${x.pluginId}/${x.modelRoute}/${u.id}`);return e.jsxs(J,{onClick:y(n),children:[e.jsx(t.Td,{children:e.jsx(t.Checkbox,{checked:i.includes(n.id),onCheckedChange:u=>l(n.id,u)})}),e.jsx(t.Td,{children:e.jsx(t.Typography,{fontWeight:"semiBold",textColor:"neutral800",children:n.id})}),e.jsx(t.Td,{children:e.jsx(t.Typography,{fontWeight:"semiBold",textColor:"neutral800",children:n.name})}),e.jsx(t.Td,{children:e.jsx(t.Typography,{textColor:"neutral800",children:n.code})}),e.jsx(t.Td,{children:n.role?e.jsx(t.Badge,{textColor:"neutral800",backgroundColor:"neutral100",children:n.role.name}):e.jsx(t.Typography,{textColor:"neutral600",children:"-"})}),e.jsx(t.Td,{children:e.jsxs(t.Flex,{gap:1,children:[e.jsx(p.CheckPermissions,{permissions:x.permissions.admin.edit,children:e.jsx(t.IconButton,{onClick:y(n),label:s("common.edit"),children:e.jsx(m.Pencil,{})})}),e.jsx(p.CheckPermissions,{permissions:x.permissions.admin.delete,children:e.jsx(t.IconButton,{onClick:r(n),label:s("common.delete"),disabled:c,children:e.jsx(m.Trash,{})})})]})})]})},V=()=>{const n=q.useNavigate(),{toggleNotification:i}=a.useNotification(),[l,r]=v.useState([]),[c,h]=v.useState(),s=P.useGetMessage(),y=p.useDeleteTenant(),{data:u,isLoading:w}=G.useSettings(),[{query:j},L]=a.useQueryParams({sort:"name:asc",_q:"",page:1,pageSize:10}),{sort:f,_q:M,page:R,pageSize:_}={...j,sort:j.sort||"name:asc",_q:j._q||"",page:j.page||1,pageSize:j.pageSize||10},{data:k,isLoading:B,error:T}=p.useTenants({sort:f,search:M,page:R,pageSize:_}),g=k?.results||[],C=k?.pagination||{pageCount:1,total:0};H.default.useEffect(()=>{T&&i({type:"danger",message:T instanceof Error?T.message:"An error occurred while fetching tenants"})},[T,i]);const I=o=>{r(o?g.map(d=>d.id):[])},z=(o,d)=>{r(d?b=>[...b,o]:b=>b.filter(N=>N!==o))},S=o=>d=>{L({...j,sort:`${o}:${d}`})},$=o=>async d=>{d.stopPropagation(),h(o)},E=async()=>{if(c)try{await y.mutateAsync(c.id),i({type:"success",message:s("domain.notifications.deleted",{values:{name:c.name}})}),h(void 0),r(o=>o.filter(d=>d!==c.id))}catch{i({type:"danger",message:s("domain.notifications.deleteError")})}},F=()=>{h(void 0)};return B||w?e.jsx(a.Page.Main,{children:e.jsx(a.Layouts.Content,{children:e.jsx(t.Loader,{children:s("domain.list.loading")})})}):e.jsxs(e.Fragment,{children:[e.jsx(a.Page.Title,{children:"Tenants"}),e.jsxs(a.Page.Main,{children:[e.jsx(a.Layouts.Header,{title:s("domain.list.title"),subtitle:s("domain.list.subtitle",{values:{count:g.length}}),as:"h2"}),e.jsx(a.Layouts.Action,{startActions:e.jsx(e.Fragment,{children:e.jsx(a.SearchInput,{label:s("domain.list.search",{defaultMessage:"Search domains"})})}),endActions:e.jsx(p.CheckPermissions,{permissions:x.permissions.admin.create,children:e.jsx(t.Button,{startIcon:e.jsx(m.Plus,{}),onClick:()=>{if(!u?.features?.unlimited&&u?.features?.domains!=null&&u?.features?.domains<=C.total)return i({type:"warning",message:s("domain.list.limitReached",{values:{limit:u?.features.domains||0}})});n(`/settings/${x.pluginId}/${x.modelRoute}/new`)},children:s("common.create")})})}),e.jsx(a.Layouts.Content,{children:g.length===0?e.jsx(t.EmptyStateLayout,{icon:e.jsx(m.Search,{}),content:s("domain.list.emptyState",{defaultMessage:"No domains found matching your search criteria"})}):e.jsxs(e.Fragment,{children:[e.jsxs(t.Table,{colCount:6,rowCount:g.length+1,children:[e.jsx(t.Thead,{children:e.jsxs(t.Tr,{children:[e.jsx(t.Th,{children:e.jsx(t.Checkbox,{checked:l.length===g.length&&g.length>0,indeterminate:l.length>0?l.length<g.length:void 0,onCheckedChange:I})}),e.jsx(t.Th,{children:e.jsx(D,{label:s("domain.list.table.headers.id"),field:"id",sort:f,onSort:S})}),e.jsx(t.Th,{children:e.jsx(D,{label:s("domain.list.table.headers.name"),field:"name",sort:f,onSort:S})}),e.jsx(t.Th,{children:e.jsx(D,{label:s("domain.list.table.headers.code"),field:"code",sort:f,onSort:S})}),e.jsx(t.Th,{children:e.jsx(t.Typography,{variant:"sigma",textColor:"neutral600",children:s("domain.list.table.headers.role")})}),e.jsx(t.Th,{children:e.jsx(t.Typography,{variant:"sigma",textColor:"neutral600",children:s("domain.list.table.headers.actions")})})]})}),e.jsx(t.Tbody,{children:g.map(o=>e.jsx(K,{tenant:o,selectedTenants:l,handleSelectTenant:z,onDeleteTenant:$},o.id))})]}),e.jsx(t.Box,{paddingTop:4,children:e.jsxs(a.Pagination.Root,{pageCount:C.pageCount,total:C.total,children:[e.jsx(a.Pagination.PageSize,{}),e.jsx(a.Pagination.Links,{})]})})]})})]}),e.jsx(Q,{isOpen:!!c,onClose:F,onConfirm:E,target:c?.name||x.modelId})]})};exports.default=V;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as A } from "react/jsx-runtime";
|
|
2
|
-
import { Dialog as
|
|
2
|
+
import { Dialog as u, Flex as q, Button as L, Typography as d, Td as f, Checkbox as I, Badge as ne, IconButton as R, Tr as E, Loader as te, EmptyStateLayout as ie, Table as oe, Thead as ae, Th as C, Tbody as re, Box as le } from "@strapi/design-system";
|
|
3
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
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
5
|
import Ce, { useState as $ } from "react";
|
|
6
6
|
import { useNavigate as N } from "react-router-dom";
|
|
7
|
-
import { b as M, p as _, m as H, c as ye } from "./index-
|
|
8
|
-
import { C as z, u as Se, a as Te } from "./useTenants-
|
|
7
|
+
import { b as M, p as _, m as H, c as ye } from "./index-DFrXw6xt.mjs";
|
|
8
|
+
import { C as z, u as Se, a as Te } from "./useTenants-D2d36FHf.mjs";
|
|
9
9
|
import be from "styled-components";
|
|
10
|
-
import { u as j } from "./useGetMessage-
|
|
11
|
-
import { u as ve } from "./useSettings-
|
|
10
|
+
import { u as j } from "./useGetMessage-BQOJqwKY.mjs";
|
|
11
|
+
import { u as ve } from "./useSettings-HNeo0XZx.mjs";
|
|
12
12
|
const ke = ({
|
|
13
|
-
isOpen:
|
|
13
|
+
isOpen: n,
|
|
14
14
|
onClose: i,
|
|
15
15
|
onConfirm: l,
|
|
16
16
|
target: r
|
|
17
|
-
}) => /* @__PURE__ */ e(
|
|
18
|
-
/* @__PURE__ */ e(
|
|
19
|
-
/* @__PURE__ */ e(
|
|
17
|
+
}) => /* @__PURE__ */ e(u.Root, { open: n, onOpenChange: i, children: /* @__PURE__ */ a(u.Content, { children: [
|
|
18
|
+
/* @__PURE__ */ e(u.Header, { children: "Confirmation" }),
|
|
19
|
+
/* @__PURE__ */ e(u.Body, { icon: /* @__PURE__ */ e(W, {}), children: /* @__PURE__ */ e(u.Description, { textAlign: "center", children: /* @__PURE__ */ a(q, { gap: 2, direction: "column", children: [
|
|
20
20
|
/* @__PURE__ */ e(se, { fill: "danger600", width: "24", height: "24" }),
|
|
21
21
|
"Are you sure you want to delete this ",
|
|
22
22
|
r,
|
|
@@ -24,15 +24,15 @@ const ke = ({
|
|
|
24
24
|
/* @__PURE__ */ e("br", {}),
|
|
25
25
|
"All your modifications will be lost"
|
|
26
26
|
] }) }) }),
|
|
27
|
-
/* @__PURE__ */ a(
|
|
28
|
-
/* @__PURE__ */ e(
|
|
29
|
-
/* @__PURE__ */ e(
|
|
27
|
+
/* @__PURE__ */ a(u.Footer, { children: [
|
|
28
|
+
/* @__PURE__ */ e(u.Action, { children: /* @__PURE__ */ e(L, { fullWidth: !0, onClick: i, variant: "tertiary", size: "S", children: /* @__PURE__ */ e(d, { variant: "omega", children: "Cancel" }) }) }),
|
|
29
|
+
/* @__PURE__ */ e(u.Action, { children: /* @__PURE__ */ e(L, { fullWidth: !0, onClick: l, variant: "danger", size: "S", children: /* @__PURE__ */ e(d, { variant: "omega", children: "Confirm" }) }) })
|
|
30
30
|
] })
|
|
31
31
|
] }) }), xe = ({
|
|
32
|
-
isDisplayed:
|
|
32
|
+
isDisplayed: n,
|
|
33
33
|
direction: i
|
|
34
|
-
}) =>
|
|
35
|
-
label:
|
|
34
|
+
}) => n ? i === "asc" ? /* @__PURE__ */ e(ce, {}) : /* @__PURE__ */ e(de, {}) : null, P = ({
|
|
35
|
+
label: n,
|
|
36
36
|
field: i,
|
|
37
37
|
sort: l,
|
|
38
38
|
onSort: r
|
|
@@ -44,7 +44,7 @@ const ke = ({
|
|
|
44
44
|
style: { display: "flex", alignItems: "center", cursor: "pointer" },
|
|
45
45
|
onClick: () => r(i)(h === "asc" ? "desc" : "asc"),
|
|
46
46
|
children: [
|
|
47
|
-
/* @__PURE__ */ e(d, { variant: "sigma", textColor: "neutral600", children:
|
|
47
|
+
/* @__PURE__ */ e(d, { variant: "sigma", textColor: "neutral600", children: n }),
|
|
48
48
|
/* @__PURE__ */ e("span", { style: { marginLeft: 4 }, children: /* @__PURE__ */ e(xe, { isDisplayed: i === s, direction: h }) })
|
|
49
49
|
]
|
|
50
50
|
}
|
|
@@ -52,39 +52,39 @@ const ke = ({
|
|
|
52
52
|
}, Ae = be(E)(() => ({
|
|
53
53
|
cursor: "pointer"
|
|
54
54
|
})), De = ({
|
|
55
|
-
tenant:
|
|
55
|
+
tenant: n,
|
|
56
56
|
selectedTenants: i,
|
|
57
57
|
handleSelectTenant: l,
|
|
58
58
|
onDeleteTenant: r,
|
|
59
59
|
isDeletePending: s = !1
|
|
60
60
|
}) => {
|
|
61
|
-
const h = N(),
|
|
62
|
-
return /* @__PURE__ */ a(Ae, { onClick: y(
|
|
61
|
+
const h = N(), t = j(), y = (m) => () => h(`/settings/${_}/${H}/${m.id}`);
|
|
62
|
+
return /* @__PURE__ */ a(Ae, { onClick: y(n), children: [
|
|
63
63
|
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
64
64
|
I,
|
|
65
65
|
{
|
|
66
|
-
checked: i.includes(
|
|
67
|
-
onCheckedChange: (
|
|
66
|
+
checked: i.includes(n.id),
|
|
67
|
+
onCheckedChange: (m) => l(n.id, m)
|
|
68
68
|
}
|
|
69
69
|
) }),
|
|
70
|
-
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { fontWeight: "semiBold", textColor: "neutral800", children:
|
|
71
|
-
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { fontWeight: "semiBold", textColor: "neutral800", children:
|
|
72
|
-
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { textColor: "neutral800", children:
|
|
73
|
-
/* @__PURE__ */ e(f, { children:
|
|
70
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { fontWeight: "semiBold", textColor: "neutral800", children: n.id }) }),
|
|
71
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { fontWeight: "semiBold", textColor: "neutral800", children: n.name }) }),
|
|
72
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { textColor: "neutral800", children: n.code }) }),
|
|
73
|
+
/* @__PURE__ */ e(f, { children: n.role ? /* @__PURE__ */ e(ne, { textColor: "neutral800", backgroundColor: "neutral100", children: n.role.name }) : /* @__PURE__ */ e(d, { textColor: "neutral600", children: "-" }) }),
|
|
74
74
|
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ a(q, { gap: 1, children: [
|
|
75
75
|
/* @__PURE__ */ e(z, { permissions: M.admin.edit, children: /* @__PURE__ */ e(
|
|
76
76
|
R,
|
|
77
77
|
{
|
|
78
|
-
onClick: y(
|
|
79
|
-
label:
|
|
78
|
+
onClick: y(n),
|
|
79
|
+
label: t("common.edit"),
|
|
80
80
|
children: /* @__PURE__ */ e(he, {})
|
|
81
81
|
}
|
|
82
82
|
) }),
|
|
83
83
|
/* @__PURE__ */ e(z, { permissions: M.admin.delete, children: /* @__PURE__ */ e(
|
|
84
84
|
R,
|
|
85
85
|
{
|
|
86
|
-
onClick: r(
|
|
87
|
-
label:
|
|
86
|
+
onClick: r(n),
|
|
87
|
+
label: t("common.delete"),
|
|
88
88
|
disabled: s,
|
|
89
89
|
children: /* @__PURE__ */ e(W, {})
|
|
90
90
|
}
|
|
@@ -92,7 +92,7 @@ const ke = ({
|
|
|
92
92
|
] }) })
|
|
93
93
|
] });
|
|
94
94
|
}, We = () => {
|
|
95
|
-
const
|
|
95
|
+
const n = N(), { toggleNotification: i } = ue(), [l, r] = $([]), [s, h] = $(), t = j(), y = Se(), { data: m, isLoading: F } = ve(), [{ query: p }, O] = pe({
|
|
96
96
|
sort: "name:asc",
|
|
97
97
|
_q: "",
|
|
98
98
|
page: 1,
|
|
@@ -103,7 +103,7 @@ const ke = ({
|
|
|
103
103
|
_q: p._q || "",
|
|
104
104
|
page: p.page || 1,
|
|
105
105
|
pageSize: p.pageSize || 10
|
|
106
|
-
}, { data: B, isLoading: J, error: T } = Te({ sort: S, search: Q, page: G, pageSize: U }),
|
|
106
|
+
}, { data: B, isLoading: J, error: T } = Te({ sort: S, search: Q, page: G, pageSize: U }), g = B?.results || [], v = B?.pagination || { pageCount: 1, total: 0 };
|
|
107
107
|
Ce.useEffect(() => {
|
|
108
108
|
T && i({
|
|
109
109
|
type: "danger",
|
|
@@ -111,7 +111,7 @@ const ke = ({
|
|
|
111
111
|
});
|
|
112
112
|
}, [T, i]);
|
|
113
113
|
const K = (o) => {
|
|
114
|
-
r(o ?
|
|
114
|
+
r(o ? g.map((c) => c.id) : []);
|
|
115
115
|
}, V = (o, c) => {
|
|
116
116
|
r(c ? (x) => [...x, o] : (x) => x.filter((ee) => ee !== o));
|
|
117
117
|
}, k = (o) => (c) => {
|
|
@@ -126,28 +126,28 @@ const ke = ({
|
|
|
126
126
|
try {
|
|
127
127
|
await y.mutateAsync(s.id), i({
|
|
128
128
|
type: "success",
|
|
129
|
-
message:
|
|
129
|
+
message: t("domain.notifications.deleted", {
|
|
130
130
|
values: { name: s.name }
|
|
131
131
|
})
|
|
132
132
|
}), h(void 0), r((o) => o.filter((c) => c !== s.id));
|
|
133
133
|
} catch {
|
|
134
134
|
i({
|
|
135
135
|
type: "danger",
|
|
136
|
-
message:
|
|
136
|
+
message: t("domain.notifications.deleteError")
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
}, Z = () => {
|
|
140
140
|
h(void 0);
|
|
141
141
|
};
|
|
142
|
-
return J || F ? /* @__PURE__ */ e(D.Main, { children: /* @__PURE__ */ e(b.Content, { children: /* @__PURE__ */ e(
|
|
142
|
+
return J || F ? /* @__PURE__ */ e(D.Main, { children: /* @__PURE__ */ e(b.Content, { children: /* @__PURE__ */ e(te, { children: t("domain.list.loading") }) }) }) : /* @__PURE__ */ a(A, { children: [
|
|
143
143
|
/* @__PURE__ */ e(D.Title, { children: "Tenants" }),
|
|
144
144
|
/* @__PURE__ */ a(D.Main, { children: [
|
|
145
145
|
/* @__PURE__ */ e(
|
|
146
146
|
b.Header,
|
|
147
147
|
{
|
|
148
|
-
title:
|
|
149
|
-
subtitle:
|
|
150
|
-
values: { count:
|
|
148
|
+
title: t("domain.list.title"),
|
|
149
|
+
subtitle: t("domain.list.subtitle", {
|
|
150
|
+
values: { count: g.length }
|
|
151
151
|
}),
|
|
152
152
|
as: "h2"
|
|
153
153
|
}
|
|
@@ -158,7 +158,7 @@ const ke = ({
|
|
|
158
158
|
startActions: /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(
|
|
159
159
|
fe,
|
|
160
160
|
{
|
|
161
|
-
label:
|
|
161
|
+
label: t("domain.list.search", {
|
|
162
162
|
defaultMessage: "Search domains"
|
|
163
163
|
})
|
|
164
164
|
}
|
|
@@ -168,45 +168,45 @@ const ke = ({
|
|
|
168
168
|
{
|
|
169
169
|
startIcon: /* @__PURE__ */ e(me, {}),
|
|
170
170
|
onClick: () => {
|
|
171
|
-
if (!
|
|
171
|
+
if (!m?.features?.unlimited && m?.features?.domains != null && m?.features?.domains <= v.total)
|
|
172
172
|
return i({
|
|
173
173
|
type: "warning",
|
|
174
|
-
message:
|
|
174
|
+
message: t("domain.list.limitReached", {
|
|
175
175
|
values: {
|
|
176
|
-
limit:
|
|
176
|
+
limit: m?.features.domains || 0
|
|
177
177
|
}
|
|
178
178
|
})
|
|
179
179
|
});
|
|
180
|
-
|
|
180
|
+
n(`/settings/${_}/${H}/new`);
|
|
181
181
|
},
|
|
182
|
-
children:
|
|
182
|
+
children: t("common.create")
|
|
183
183
|
}
|
|
184
184
|
) })
|
|
185
185
|
}
|
|
186
186
|
),
|
|
187
|
-
/* @__PURE__ */ e(b.Content, { children:
|
|
187
|
+
/* @__PURE__ */ e(b.Content, { children: g.length === 0 ? /* @__PURE__ */ e(
|
|
188
188
|
ie,
|
|
189
189
|
{
|
|
190
190
|
icon: /* @__PURE__ */ e(ge, {}),
|
|
191
|
-
content:
|
|
191
|
+
content: t("domain.list.emptyState", {
|
|
192
192
|
defaultMessage: "No domains found matching your search criteria"
|
|
193
193
|
})
|
|
194
194
|
}
|
|
195
195
|
) : /* @__PURE__ */ a(A, { children: [
|
|
196
|
-
/* @__PURE__ */ a(oe, { colCount: 6, rowCount:
|
|
196
|
+
/* @__PURE__ */ a(oe, { colCount: 6, rowCount: g.length + 1, children: [
|
|
197
197
|
/* @__PURE__ */ e(ae, { children: /* @__PURE__ */ a(E, { children: [
|
|
198
198
|
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
|
|
199
199
|
I,
|
|
200
200
|
{
|
|
201
|
-
checked: l.length ===
|
|
202
|
-
indeterminate: l.length > 0 ? l.length <
|
|
201
|
+
checked: l.length === g.length && g.length > 0,
|
|
202
|
+
indeterminate: l.length > 0 ? l.length < g.length : void 0,
|
|
203
203
|
onCheckedChange: K
|
|
204
204
|
}
|
|
205
205
|
) }),
|
|
206
206
|
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
|
|
207
207
|
P,
|
|
208
208
|
{
|
|
209
|
-
label:
|
|
209
|
+
label: t("domain.list.table.headers.id"),
|
|
210
210
|
field: "id",
|
|
211
211
|
sort: S,
|
|
212
212
|
onSort: k
|
|
@@ -215,7 +215,7 @@ const ke = ({
|
|
|
215
215
|
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
|
|
216
216
|
P,
|
|
217
217
|
{
|
|
218
|
-
label:
|
|
218
|
+
label: t("domain.list.table.headers.name"),
|
|
219
219
|
field: "name",
|
|
220
220
|
sort: S,
|
|
221
221
|
onSort: k
|
|
@@ -224,16 +224,16 @@ const ke = ({
|
|
|
224
224
|
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
|
|
225
225
|
P,
|
|
226
226
|
{
|
|
227
|
-
label:
|
|
227
|
+
label: t("domain.list.table.headers.code"),
|
|
228
228
|
field: "code",
|
|
229
229
|
sort: S,
|
|
230
230
|
onSort: k
|
|
231
231
|
}
|
|
232
232
|
) }),
|
|
233
|
-
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(d, { variant: "sigma", textColor: "neutral600", children:
|
|
234
|
-
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(d, { variant: "sigma", textColor: "neutral600", children:
|
|
233
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(d, { variant: "sigma", textColor: "neutral600", children: t("domain.list.table.headers.role") }) }),
|
|
234
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(d, { variant: "sigma", textColor: "neutral600", children: t("domain.list.table.headers.actions") }) })
|
|
235
235
|
] }) }),
|
|
236
|
-
/* @__PURE__ */ e(re, { children:
|
|
236
|
+
/* @__PURE__ */ e(re, { children: g.map((o) => /* @__PURE__ */ e(
|
|
237
237
|
De,
|
|
238
238
|
{
|
|
239
239
|
tenant: o,
|
|
@@ -20,15 +20,19 @@ const e = {
|
|
|
20
20
|
},
|
|
21
21
|
about: {
|
|
22
22
|
title: "About",
|
|
23
|
+
pluginName: "Multi Domain Plugin",
|
|
23
24
|
pluginInfo: {
|
|
24
25
|
title: "Plugin Info",
|
|
25
26
|
name: "Name",
|
|
26
|
-
version: "Version"
|
|
27
|
+
version: "Version",
|
|
28
|
+
openNpm: "Open NPM"
|
|
27
29
|
},
|
|
28
30
|
contact: {
|
|
29
31
|
title: "Contact Us",
|
|
30
32
|
website: "Website",
|
|
31
|
-
email: "Email"
|
|
33
|
+
email: "Email",
|
|
34
|
+
talkToOurExperts: "Talk to our experts",
|
|
35
|
+
sensiumCaption: "Sensinum is a company of the VirtusLab Group"
|
|
32
36
|
},
|
|
33
37
|
licenseDetails: {
|
|
34
38
|
title: "Licence Details",
|
|
@@ -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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const q=require("remeda"),D=require("zod"),o=require("react/jsx-runtime"),M=require("@strapi/strapi/admin"),f=require("react"),w=require("react-cookie"),i=require("@strapi/design-system"),H=require("react-dom/client"),U=require("@strapi/icons"),P=require("@tanstack/react-query"),F=e=>e&&e.__esModule?e:{default:e},z=F(f),Q="@sensinum/strapi-plugin-multi-domain",W="5.2.1",J="https://www.sensinum.com/contact",V="hello@sensinum.com",G={name:"multi-domain"},K={name:Q,version:W,homepage:J,email:V},s=D.z.literal("multi-domain").parse(G.name);q.toSnakeCase(s);const h="domain",T="domain",k=`${h}s`,p="domain",L={read:"read",change:"change",create:"create",delete:"delete"},x=e=>`plugin::${s}.${L[e]}`,j={admin:{access:Object.keys(L).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`,X="strapi-super-admin",I=e=>e?.code===X,Y=e=>{const t=`/admin/content-manager/collection-types/${e}/create`,n=document.querySelector(`a[href*="${t}"]`);n&&(n.style.display="none")},Z=()=>{const[{[p]:e}]=w.useCookies([p]),t=I(e),{slug:n}=M.unstable_useContentManagerContext();return z.default.useEffect(()=>{(t||!e)&&Y(n)},[t,e,n]),null},ee=()=>o.jsx(w.CookiesProvider,{children:o.jsx(Z,{})}),te=({setPlugin:e})=>{const t=f.useRef(e);return f.useEffect(()=>{t.current(s)},[]),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 r=t.length?`${t}.`:"";return typeof e[a]=="object"&&e[a]!==null&&!Array.isArray(e[a])?Object.assign(n,S(e[a],r+a)):n[r+a]=e[a],n},{}),ne=({onClose:e,userData:t})=>{const[{[p]:n},a]=w.useCookies([p]),[r,u]=f.useState(""),[c,m]=f.useState(n||null),d=(t[T]||[]).filter(l=>l.name.toLowerCase().includes(r.toLowerCase())),y=l=>{m(c?.id===l.id?null:l)},_=()=>{c&&(a(p,JSON.stringify(c),{path:"/",maxAge:60*60*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:r,onChange:l=>u(l.target.value),placeholder:"Search domains...",size:"S"})]})}),d.length===0?o.jsx(i.EmptyStateLayout,{icon:o.jsx(U.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"}),o.jsx(i.Th,{children:o.jsx(i.Typography,{variant:"sigma",textColor:"neutral600",children:"Domain name"})})]})}),o.jsx(i.Tbody,{children:d.map(l=>o.jsxs(i.Tr,{children:[o.jsx(i.Td,{width:"60px",children:o.jsx(i.Checkbox,{checked:c?.id===l.id,onCheckedChange:()=>y(l),name:`tenant-${l.id}`})}),o.jsx(i.Td,{width:"40px",children:l.logo?.url&&o.jsx(i.Avatar.Item,{src:l.logo.url,alt:l.name,preview:!1})}),o.jsx(i.Td,{children:o.jsx(i.Typography,{fontWeight:"semiBold",textColor:"neutral800",children:l.name})})]},l.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:_,disabled:!c,children:"Select domain"})]})]})})},oe=new P.QueryClient({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}),ie=(e,t,n,a)=>{const r=H.createRoot(e),u=()=>{document.body.removeAttribute("style"),r.unmount(),setTimeout(()=>{document.body.style.pointerEvents="auto"},0)};return t.remove(),r.render(o.jsx(i.DesignSystemProvider,{theme:a==="light"?i.lightTheme:i.darkTheme,children:o.jsx(P.QueryClientProvider,{client:oe,children:o.jsx(w.CookiesProvider,{children:o.jsx(ne,{onClose:u,userData:n})})})}))},b=(e,t)=>new Promise((n,a)=>{const c=(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(()=>c(m+1),250)};c()}),B=()=>{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},ae=e=>{const t=e.firstChild,n=t?.lastChild?.cloneNode(!0);if(t&&n instanceof HTMLElement){const a=n.firstChild;a&&n.replaceChildren(a);const r=n.querySelector("span");if(r){const u=B();r.innerText=u?`${h.toUpperCase()}: ${u.name}`:`No ${h} selected`}n.style.paddingTop="1rem",t.appendChild(n)}},v=async()=>{try{const e=M.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(c=>c.attributeName===a)&&n.getAttribute(a)==="true"){const c=await b("[data-radix-menu-content]");if(!(c instanceof HTMLElement))return;ae(c);const m=await b('[role="menuitem"]',c),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(),ie(t,c,e,localStorage.getItem("STRAPI_THEME")||"dark")}),m.insertAdjacentElement("afterend",d)}}}).observe(n,{attributes:!0})},N=()=>window.location.pathname==="/admin/auth/login",se=()=>window.location.pathname.startsWith("/admin/plugins/upload"),re=()=>{const e=B(),t=document.querySelector('[data-strapi-header="true"]');if(!e||I(e)){const n=t?.querySelectorAll("button");n&&n.forEach(a=>{a.style.display="none"})}},$=q.funnel(re,{minQuietPeriodMs:250}),O=async()=>{const e=await b('nav ul > li a[href="/admin/plugins/upload"]');e&&e.addEventListener("click",()=>{$.call()}),se()&&$.call()},C=async()=>{if(N()){document.body.removeAttribute(g);return}if(await v()){document.querySelector(`[${g}]`)||(await Promise.all([R(),O()]),document.body.setAttribute(g,"true"));return}document.body.removeAttribute(g)},ce=async()=>{N()||!await v()||(document.body.setAttribute(g,"true"),await Promise.all([R(),O()]))},le={register(e){e.registerPlugin({id:s,initializer:te,isReady:!1,name:s}),e.customFields.register({name:`unique-by-${h}`,pluginId:s,type:"string",intlLabel:{id:`${s}.custom-fields.unique-by-domain.label`,defaultMessage:"Unique by domain"},intlDescription:{id:`${s}.custom-fields.unique-by-tenant.description`,defaultMessage:"Ensures the value is unique within the domain."},components:{Input:()=>Promise.resolve().then(()=>require("./TenantCustomField-aaNqlkBO.js"))}}),e.router.addSettingsLink({id:`${s}.settings`,intlLabel:{id:`${s}.settings.label`,defaultMessage:"Multi-Domain Settings"},links:[{id:`${s}.settings.about`,intlLabel:{id:`${s}.settings.about.label`,defaultMessage:"About"},to:`/settings/${s}/about`,Component:()=>Promise.resolve().then(()=>require("./About-CrezKPYG.js")),permissions:j.admin.access},{id:`${s}.settings.general`,intlLabel:{id:`${s}.settings.general.label`,defaultMessage:"General Settings"},to:`/settings/${s}/${k}`,Component:()=>Promise.resolve().then(()=>require("./Settings-82rkWMJ-.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(s,S(a)),locale:t})):{data:A(s,S({})),locale:t}))},async bootstrap(e){e.getPlugin("content-manager").injectComponent("listView","actions",{name:"display-create-button",Component:ee});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(...r){n.apply(history,r),t!==window.location.pathname&&(t=window.location.pathname,C())},history.replaceState=function(...r){a.apply(history,r),t!==window.location.pathname&&(t=window.location.pathname,C())},await ce()}};exports.modelId=h;exports.modelRoute=k;exports.packageJson=K;exports.permissions=j;exports.plugin=le;exports.pluginId=s;
|
|
@@ -8,7 +8,7 @@ import { Avatar as M, Modal as h, Box as k, Field as L, Searchbar as ee, EmptySt
|
|
|
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.
|
|
11
|
+
const he = "@sensinum/strapi-plugin-multi-domain", pe = "5.2.1", ge = "https://www.sensinum.com/contact", fe = "hello@sensinum.com", ye = {
|
|
12
12
|
name: "multi-domain"
|
|
13
13
|
}, je = {
|
|
14
14
|
name: he,
|
|
@@ -46,7 +46,7 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
|
|
|
46
46
|
t.current(a);
|
|
47
47
|
}, []), null;
|
|
48
48
|
}, B = {
|
|
49
|
-
en: () => import("./en-
|
|
49
|
+
en: () => import("./en-Cf69p5po.mjs")
|
|
50
50
|
}, q = (e, t) => {
|
|
51
51
|
if (!e)
|
|
52
52
|
throw new TypeError("Prefix can't be empty");
|
|
@@ -261,7 +261,7 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
|
|
|
261
261
|
defaultMessage: "Ensures the value is unique within the domain."
|
|
262
262
|
},
|
|
263
263
|
components: {
|
|
264
|
-
Input: () => import("./TenantCustomField-
|
|
264
|
+
Input: () => import("./TenantCustomField-MX6zdr0Y.mjs")
|
|
265
265
|
}
|
|
266
266
|
}), e.router.addSettingsLink({
|
|
267
267
|
id: `${a}.settings`,
|
|
@@ -277,7 +277,7 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
|
|
|
277
277
|
defaultMessage: "About"
|
|
278
278
|
},
|
|
279
279
|
to: `/settings/${a}/about`,
|
|
280
|
-
Component: () => import("./
|
|
280
|
+
Component: () => import("./About-DD6q90XE.mjs"),
|
|
281
281
|
permissions: N.admin.access
|
|
282
282
|
},
|
|
283
283
|
{
|
|
@@ -287,7 +287,7 @@ const g = "domain", E = "domain", be = `${g}s`, p = "domain", H = {
|
|
|
287
287
|
defaultMessage: "General Settings"
|
|
288
288
|
},
|
|
289
289
|
to: `/settings/${a}/${be}`,
|
|
290
|
-
Component: () => import("./Settings-
|
|
290
|
+
Component: () => import("./Settings-DVTWa7UL.mjs"),
|
|
291
291
|
permissions: N.admin.access
|
|
292
292
|
}
|
|
293
293
|
]
|
|
@@ -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-DFrXw6xt.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")
|
|
@@ -134,7 +134,7 @@ class j {
|
|
|
134
134
|
);
|
|
135
135
|
return m.parseAsync(c.data);
|
|
136
136
|
} catch (a) {
|
|
137
|
-
throw a instanceof e.ZodError ? new Error(`Validation error: ${a.errors.map((c) => c.message).join(", ")}`) : new Error("Failed to update
|
|
137
|
+
throw a instanceof e.ZodError ? new Error(`Validation error: ${a.errors.map((c) => c.message).join(", ")}`) : new Error("Failed to update domain");
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
async deleteTenant(n) {
|
|
@@ -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-B6P81dIL.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 domain")}}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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("react-intl"),u=require("./index-B6P81dIL.js"),c=()=>{const{formatMessage:e}=r.useIntl();return(s,{defaultMessage:t,values:n}={})=>e({id:`${u.pluginId}.${s}`,defaultMessage:t},n)};exports.useGetMessage=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("@tanstack/react-query"),t=require("./index-
|
|
1
|
+
"use strict";const e=require("@tanstack/react-query"),t=require("./index-lkcweU9g.js"),s=()=>e.useQuery({queryKey:["multi-domain-settings"],queryFn:()=>t.api.getSettings(),staleTime:2*60*1e3});exports.useSettings=s;
|