@sensinum/strapi-plugin-multi-domain 5.2.1 → 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.
- package/dist/{_chunks/About-CrezKPYG.js → admin/About-Cqb0Poxw.js} +2 -2
- package/dist/{_chunks/About-DD6q90XE.mjs → admin/About-DaHQ_Yhm.mjs} +5 -5
- package/dist/admin/QueryProvider-CCX1cgmZ.js +1 -0
- package/dist/{_chunks/QueryProvider-DLzv0qqi.mjs → admin/QueryProvider-oO97LaUB.mjs} +2 -2
- package/dist/{_chunks/Settings-82rkWMJ-.js → admin/Settings-CDBzsWbm.js} +1 -1
- package/dist/{_chunks/Settings-DVTWa7UL.mjs → admin/Settings-CyMoV2x8.mjs} +3 -3
- package/dist/{_chunks/TenantCustomField-aaNqlkBO.js → admin/TenantCustomField-BVJXtOh1.js} +1 -1
- package/dist/{_chunks/TenantCustomField-MX6zdr0Y.mjs → admin/TenantCustomField-ZM7ZfiGu.mjs} +24 -24
- package/dist/admin/TenantEdit-DBJoQv4w.mjs +490 -0
- package/dist/admin/TenantEdit-GAMHwYkP.js +1 -0
- package/dist/{_chunks/TenantList-Dw1EqqA7.mjs → admin/TenantList-C6xsvthy.mjs} +43 -45
- package/dist/admin/TenantList-D8hgcBHM.js +1 -0
- package/dist/admin/index-BwgjJmHR.js +1 -0
- package/dist/{_chunks/index-DFrXw6xt.mjs → admin/index-CQxsvheX.mjs} +80 -80
- package/dist/admin/index-CwsztY3K.mjs +187 -0
- package/dist/admin/index-eSOlzCRc.js +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/{_chunks/useGetMessage-BQOJqwKY.mjs → admin/useGetMessage-Ck4TSmSw.mjs} +1 -1
- package/dist/admin/useGetMessage-gI6hxpcF.js +1 -0
- package/dist/admin/useSettings-CkTWZxdH.js +1 -0
- package/dist/{_chunks/useSettings-HNeo0XZx.mjs → admin/useSettings-DY1d6P_T.mjs} +2 -2
- package/dist/admin/useTenants-Ck1OOTGx.js +1 -0
- package/dist/{_chunks/useTenants-D2d36FHf.mjs → admin/useTenants-sy0FweCJ.mjs} +4 -4
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +3317 -6503
- package/package.json +20 -21
- package/dist/_chunks/QueryProvider-DUoM4JhC.js +0 -1
- package/dist/_chunks/TenantEdit-BA2xZHAl.js +0 -1
- package/dist/_chunks/TenantEdit-QroPNoOH.mjs +0 -494
- package/dist/_chunks/TenantList-BOEyqzpU.js +0 -1
- package/dist/_chunks/index-B6P81dIL.js +0 -1
- package/dist/_chunks/index-DVqQk-cu.mjs +0 -182
- package/dist/_chunks/index-lkcweU9g.js +0 -1
- package/dist/_chunks/useGetMessage-CkNMUbYX.js +0 -1
- package/dist/_chunks/useSettings-DArWTfyj.js +0 -1
- package/dist/_chunks/useTenants-DA6GxylQ.js +0 -1
- package/dist/shared/config.d.ts +0 -7
- package/dist/shared/config.d.ts.map +0 -1
- package/dist/shared/permissions.d.ts +0 -35
- package/dist/shared/permissions.d.ts.map +0 -1
- package/dist/shared/pluginIds.d.ts +0 -9
- package/dist/shared/pluginIds.d.ts.map +0 -1
- package/dist/shared/schemas/admin.d.ts +0 -26
- package/dist/shared/schemas/admin.d.ts.map +0 -1
- package/dist/shared/schemas/index.d.ts +0 -8
- package/dist/shared/schemas/index.d.ts.map +0 -1
- package/dist/shared/schemas/permision.schema.d.ts +0 -28
- package/dist/shared/schemas/permision.schema.d.ts.map +0 -1
- package/dist/shared/schemas/query-params.schema.d.ts +0 -19
- package/dist/shared/schemas/query-params.schema.d.ts.map +0 -1
- package/dist/shared/schemas/role.schema.d.ts +0 -101
- package/dist/shared/schemas/role.schema.d.ts.map +0 -1
- package/dist/shared/schemas/tenant.schema.d.ts +0 -428
- package/dist/shared/schemas/tenant.schema.d.ts.map +0 -1
- package/dist/shared/schemas/token.schema.d.ts +0 -13
- package/dist/shared/schemas/token.schema.d.ts.map +0 -1
- package/dist/shared/schemas/uniq-validation.schema.d.ts +0 -18
- package/dist/shared/schemas/uniq-validation.schema.d.ts.map +0 -1
- package/dist/shared/schemas/utils.d.ts +0 -3
- package/dist/shared/schemas/utils.d.ts.map +0 -1
- /package/dist/{_chunks → admin}/en-Cf69p5po.mjs +0 -0
- /package/dist/{_chunks → admin}/en-hAVH8fH0.js +0 -0
|
@@ -3,10 +3,10 @@ import { Page as l, Layouts as a } from "@strapi/admin/strapi-admin";
|
|
|
3
3
|
import { Typography as A, Flex as n, Divider as g, Box as D, ProgressBar as h, Link as X } from "@strapi/design-system";
|
|
4
4
|
import { useMemo as j } from "react";
|
|
5
5
|
import H from "styled-components";
|
|
6
|
-
import { p as P, a as z } from "./index-
|
|
7
|
-
import { u as C } from "./useGetMessage-
|
|
8
|
-
import { u as m } from "./useSettings-
|
|
9
|
-
import { Q as x } from "./QueryProvider-
|
|
6
|
+
import { p as P, a as z } from "./index-CQxsvheX.mjs";
|
|
7
|
+
import { u as C } from "./useGetMessage-Ck4TSmSw.mjs";
|
|
8
|
+
import { u as m } from "./useSettings-DY1d6P_T.mjs";
|
|
9
|
+
import { Q as x } from "./QueryProvider-oO97LaUB.mjs";
|
|
10
10
|
const R = () => /* @__PURE__ */ d("svg", { width: "19", height: "15", viewBox: "0 0 19 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ d(
|
|
11
11
|
"path",
|
|
12
12
|
{
|
|
@@ -293,7 +293,7 @@ const R = () => /* @__PURE__ */ d("svg", { width: "19", height: "15", viewBox: "
|
|
|
293
293
|
return /* @__PURE__ */ c(L, { children: [
|
|
294
294
|
/* @__PURE__ */ d(l.Title, { children: `${r} ${P}` }),
|
|
295
295
|
/* @__PURE__ */ c(l.Main, { children: [
|
|
296
|
-
/* @__PURE__ */ d(a.Header, { title: r
|
|
296
|
+
/* @__PURE__ */ d(a.Header, { title: r }),
|
|
297
297
|
/* @__PURE__ */ d(a.Content, { children: /* @__PURE__ */ c(
|
|
298
298
|
n,
|
|
299
299
|
{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),e=require("@tanstack/react-query"),i=new e.QueryClient({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1,staleTime:300*1e3,gcTime:600*1e3},mutations:{retry:!1}}}),s=({children:r})=>t.jsx(e.QueryClientProvider,{client:i,children:r});exports.QueryProvider=s;
|
|
@@ -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-BwgjJmHR.js"),u=require("./QueryProvider-CCX1cgmZ.js"),a=t=>t&&t.__esModule?t:{default:t},n=a(i),l=n.default.lazy(()=>Promise.resolve().then(()=>require("./TenantList-D8hgcBHM.js"))),c=n.default.lazy(()=>Promise.resolve().then(()=>require("./TenantEdit-GAMHwYkP.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-
|
|
6
|
-
import { Q as h } from "./QueryProvider-
|
|
7
|
-
const c = r.lazy(() => import("./TenantList-
|
|
5
|
+
import { p, m as d } from "./index-CQxsvheX.mjs";
|
|
6
|
+
import { Q as h } from "./QueryProvider-oO97LaUB.mjs";
|
|
7
|
+
const c = r.lazy(() => import("./TenantList-C6xsvthy.mjs")), g = r.lazy(() => import("./TenantEdit-DBJoQv4w.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, {}) }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("@strapi/design-system"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("@strapi/design-system"),f=require("@strapi/strapi/admin"),e=require("zod"),F=require("react"),S=require("@tanstack/react-query"),q=require("./index-eSOlzCRc.js"),p=require("./QueryProvider-CCX1cgmZ.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=f.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:z,onChange:c,label:b,name:i,rawError:l})=>{const{id:y,model:v,form:d}=P(T),m=R(),{toggleNotification:j}=f.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:z,onChange:c,onBlur:x,placeholder:r,disabled:t,hasError:!!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;
|
package/dist/{_chunks/TenantCustomField-MX6zdr0Y.mjs → admin/TenantCustomField-ZM7ZfiGu.mjs}
RENAMED
|
@@ -4,8 +4,8 @@ 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-
|
|
8
|
-
import { Q as V } from "./QueryProvider-
|
|
7
|
+
import { a as T } from "./index-CwsztY3K.mjs";
|
|
8
|
+
import { Q as V } from "./QueryProvider-oO97LaUB.mjs";
|
|
9
9
|
import { capitalize as z } from "remeda";
|
|
10
10
|
const f = t.object({
|
|
11
11
|
modified: t.boolean(),
|
|
@@ -25,35 +25,35 @@ const f = t.object({
|
|
|
25
25
|
}),
|
|
26
26
|
[r, n, s]
|
|
27
27
|
);
|
|
28
|
-
},
|
|
28
|
+
}, E = () => P({
|
|
29
29
|
mutationFn: async (e) => T.validateCustomField(e)
|
|
30
|
-
}),
|
|
30
|
+
}), I = t.object({
|
|
31
31
|
setSubmitting: t.function().args(t.boolean()).returns(t.void())
|
|
32
|
-
}),
|
|
32
|
+
}), N = ({
|
|
33
33
|
disabled: e,
|
|
34
34
|
placeholder: r,
|
|
35
35
|
required: n,
|
|
36
36
|
hint: s,
|
|
37
37
|
value: g,
|
|
38
|
-
onChange:
|
|
38
|
+
onChange: l,
|
|
39
39
|
label: b,
|
|
40
|
-
name:
|
|
41
|
-
rawError:
|
|
40
|
+
name: a,
|
|
41
|
+
rawError: c
|
|
42
42
|
}) => {
|
|
43
|
-
const { id: p, model:
|
|
43
|
+
const { id: p, model: h, form: m } = B(I), d = E(), { toggleNotification: v } = j(), y = async (C) => {
|
|
44
44
|
try {
|
|
45
45
|
m.setSubmitting(!0);
|
|
46
|
-
const
|
|
47
|
-
model:
|
|
48
|
-
field:
|
|
46
|
+
const i = await d.mutateAsync({
|
|
47
|
+
model: h,
|
|
48
|
+
field: a,
|
|
49
49
|
documentId: p,
|
|
50
50
|
value: C.target.value
|
|
51
51
|
});
|
|
52
|
-
|
|
53
|
-
} catch (
|
|
54
|
-
|
|
52
|
+
l({ target: { value: i.value, name: a } });
|
|
53
|
+
} catch (i) {
|
|
54
|
+
v({
|
|
55
55
|
type: "danger",
|
|
56
|
-
message:
|
|
56
|
+
message: i instanceof Error ? i.message : i.toString()
|
|
57
57
|
});
|
|
58
58
|
} finally {
|
|
59
59
|
m.setSubmitting(!1);
|
|
@@ -62,23 +62,23 @@ const f = t.object({
|
|
|
62
62
|
return /* @__PURE__ */ F(
|
|
63
63
|
u.Root,
|
|
64
64
|
{
|
|
65
|
-
name:
|
|
65
|
+
name: a,
|
|
66
66
|
hint: d.isPending ? "Validating..." : s,
|
|
67
67
|
required: n,
|
|
68
|
-
error:
|
|
68
|
+
error: c?.defaultMessage,
|
|
69
69
|
children: [
|
|
70
70
|
/* @__PURE__ */ o(u.Label, { children: z(b) }),
|
|
71
71
|
/* @__PURE__ */ o(
|
|
72
72
|
S,
|
|
73
73
|
{
|
|
74
|
-
name:
|
|
74
|
+
name: a,
|
|
75
75
|
value: g,
|
|
76
|
-
onChange:
|
|
77
|
-
onBlur:
|
|
76
|
+
onChange: l,
|
|
77
|
+
onBlur: y,
|
|
78
78
|
placeholder: r,
|
|
79
79
|
disabled: e,
|
|
80
|
-
|
|
81
|
-
"aria-describedby": `${
|
|
80
|
+
hasError: !!c,
|
|
81
|
+
"aria-describedby": `${a}-hint`,
|
|
82
82
|
"aria-required": n
|
|
83
83
|
}
|
|
84
84
|
),
|
|
@@ -87,7 +87,7 @@ const f = t.object({
|
|
|
87
87
|
]
|
|
88
88
|
}
|
|
89
89
|
);
|
|
90
|
-
}, w = (e) => /* @__PURE__ */ o(V, { children: /* @__PURE__ */ o(
|
|
90
|
+
}, w = (e) => /* @__PURE__ */ o(V, { children: /* @__PURE__ */ o(N, { ...e }) });
|
|
91
91
|
export {
|
|
92
92
|
w as default
|
|
93
93
|
};
|
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
var K = Object.defineProperty;
|
|
2
|
+
var V = (t, n, o) => n in t ? K(t, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[n] = o;
|
|
3
|
+
var E = (t, n, o) => V(t, typeof n != "symbol" ? n + "" : n, o);
|
|
4
|
+
import { jsx as e, jsxs as m, Fragment as D } from "react/jsx-runtime";
|
|
5
|
+
import { Flex as R, Box as f, Typography as O, Button as N, Link as G, Field as d, Combobox as z, ComboboxOption as Q, IconButton as U, MultiSelect as X, MultiSelectOption as Y, TextInput as x, JSONInput as Z, Loader as _, Grid as C } from "@strapi/design-system";
|
|
6
|
+
import { Layouts as P, useStrapiApp as ee, useNotification as te, Page as H, Form as ne } from "@strapi/strapi/admin";
|
|
7
|
+
import oe, { useCallback as q } from "react";
|
|
8
|
+
import { NavLink as ie, useNavigate as ae, useParams as re } from "react-router-dom";
|
|
9
|
+
import { isEmpty as de } from "remeda";
|
|
10
|
+
import { b as A, c as $, p as L, m as M } from "./index-CQxsvheX.mjs";
|
|
11
|
+
import { u as y } from "./useGetMessage-Ck4TSmSw.mjs";
|
|
12
|
+
import { C as se, b as le, c as ce, d as me } from "./useTenants-sy0FweCJ.mjs";
|
|
13
|
+
import { ArrowLeft as ue, Cross as ge } from "@strapi/icons";
|
|
14
|
+
import { useQuery as j, useMutation as he } from "@tanstack/react-query";
|
|
15
|
+
import { a as I } from "./index-CwsztY3K.mjs";
|
|
16
|
+
const pe = ({
|
|
17
|
+
isEditing: t,
|
|
18
|
+
isSaving: n,
|
|
19
|
+
onCancel: o
|
|
20
|
+
}) => {
|
|
21
|
+
const i = y();
|
|
22
|
+
return /* @__PURE__ */ e(R, { justifyContent: "flex-start", gap: 2, direction: "column", height: "100%", width: "100%", children: /* @__PURE__ */ m(f, { background: "neutral0", padding: 8, shadow: "filterShadow", hasRadius: !0, width: "100%", children: [
|
|
23
|
+
/* @__PURE__ */ e(
|
|
24
|
+
O,
|
|
25
|
+
{
|
|
26
|
+
variant: "sigma",
|
|
27
|
+
textTransform: "uppercase",
|
|
28
|
+
textColor: "neutral600",
|
|
29
|
+
tag: "h2",
|
|
30
|
+
marginBottom: 4,
|
|
31
|
+
children: i("domain.edit.actions.entry")
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ m(R, { direction: "column", gap: 2, children: [
|
|
35
|
+
/* @__PURE__ */ e(
|
|
36
|
+
se,
|
|
37
|
+
{
|
|
38
|
+
permissions: t ? A.admin.edit : A.admin.create,
|
|
39
|
+
children: /* @__PURE__ */ e(N, { type: "submit", loading: n, width: "100%", children: i(t ? "domain.edit.actions.update" : "domain.edit.actions.create") })
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ e(N, { variant: "secondary", onClick: o, width: "100%", children: i("common.cancel") })
|
|
43
|
+
] })
|
|
44
|
+
] }) });
|
|
45
|
+
}, fe = ({ isEditing: t, tenantName: n }) => {
|
|
46
|
+
const o = y(), i = t ? n || o("domain.edit.title.edit", {
|
|
47
|
+
values: { name: $ }
|
|
48
|
+
}) : o("domain.edit.title.create");
|
|
49
|
+
return /* @__PURE__ */ e(
|
|
50
|
+
P.Header,
|
|
51
|
+
{
|
|
52
|
+
title: typeof i == "string" ? i : String(i),
|
|
53
|
+
navigationAction: /* @__PURE__ */ e(G, { tag: ie, startIcon: /* @__PURE__ */ e(ue, {}), to: `/settings/${L}/${M}`, children: o("common.back") })
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}, ye = ({ disabled: t = !1, error: n }) => {
|
|
57
|
+
const o = y(), i = ee(
|
|
58
|
+
"CustomMediaInput",
|
|
59
|
+
(a) => a.fields?.media || {}
|
|
60
|
+
);
|
|
61
|
+
return i ? /* @__PURE__ */ m(
|
|
62
|
+
d.Root,
|
|
63
|
+
{
|
|
64
|
+
name: "logo",
|
|
65
|
+
hint: o("domain.edit.form.logo.hint"),
|
|
66
|
+
error: n,
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ e(
|
|
69
|
+
i,
|
|
70
|
+
{
|
|
71
|
+
label: "Logo",
|
|
72
|
+
name: "logo",
|
|
73
|
+
disabled: t,
|
|
74
|
+
attribute: {
|
|
75
|
+
allowedTypes: ["images"],
|
|
76
|
+
multiple: !1
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ e(d.Hint, {}),
|
|
81
|
+
/* @__PURE__ */ e(d.Error, {})
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
) : null;
|
|
85
|
+
}, J = {
|
|
86
|
+
all: ["roles"],
|
|
87
|
+
lists: () => [...J.all, "list"]
|
|
88
|
+
}, be = () => j({
|
|
89
|
+
queryKey: J.lists(),
|
|
90
|
+
queryFn: () => I.getRoles(),
|
|
91
|
+
staleTime: 600 * 1e3
|
|
92
|
+
// 10 minutes - roles don't change often
|
|
93
|
+
}), Te = ({
|
|
94
|
+
value: t,
|
|
95
|
+
onChange: n,
|
|
96
|
+
disabled: o = !1,
|
|
97
|
+
error: i,
|
|
98
|
+
onLoadMore: a,
|
|
99
|
+
onSearch: l
|
|
100
|
+
}) => {
|
|
101
|
+
const { data: s = [], isLoading: g } = be(), p = y(), b = () => {
|
|
102
|
+
n({ target: { name: "role", value: "" } });
|
|
103
|
+
}, k = (h) => {
|
|
104
|
+
n({ target: { name: "role", value: h } });
|
|
105
|
+
}, S = q(
|
|
106
|
+
(h) => {
|
|
107
|
+
const F = h.target.value;
|
|
108
|
+
l && l(F);
|
|
109
|
+
},
|
|
110
|
+
[l]
|
|
111
|
+
), w = q(() => {
|
|
112
|
+
a && !g && a();
|
|
113
|
+
}, [a, g]);
|
|
114
|
+
return /* @__PURE__ */ m(
|
|
115
|
+
d.Root,
|
|
116
|
+
{
|
|
117
|
+
name: "role",
|
|
118
|
+
hint: p("domain.edit.form.role.hint"),
|
|
119
|
+
error: i,
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ e(d.Label, { children: p("domain.edit.form.role.label") }),
|
|
122
|
+
/* @__PURE__ */ e(
|
|
123
|
+
z,
|
|
124
|
+
{
|
|
125
|
+
loading: g,
|
|
126
|
+
hasMoreItems: !g,
|
|
127
|
+
name: "role",
|
|
128
|
+
disabled: o,
|
|
129
|
+
value: t,
|
|
130
|
+
onChange: k,
|
|
131
|
+
placeholder: p("domain.edit.form.role.placeholder"),
|
|
132
|
+
onInputChange: S,
|
|
133
|
+
onLoadMore: w,
|
|
134
|
+
children: s.map((h) => /* @__PURE__ */ e(Q, { value: h.id.toString(), children: h.name }, h.id))
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
t && s.length > 0 && /* @__PURE__ */ m(
|
|
138
|
+
R,
|
|
139
|
+
{
|
|
140
|
+
paddingTop: 2,
|
|
141
|
+
paddingBottom: 2,
|
|
142
|
+
paddingLeft: 4,
|
|
143
|
+
paddingRight: 4,
|
|
144
|
+
hasRadius: !0,
|
|
145
|
+
borderColor: "neutral200",
|
|
146
|
+
background: "neutral0",
|
|
147
|
+
justifyContent: "space-between",
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ e(O, { textColor: "neutral800", fontWeight: "bold", children: s.find((h) => h.id.toString() === t)?.name }),
|
|
150
|
+
o ? null : /* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
151
|
+
U,
|
|
152
|
+
{
|
|
153
|
+
onClick: b,
|
|
154
|
+
label: p("domain.edit.form.role.remove"),
|
|
155
|
+
variant: "ghost",
|
|
156
|
+
size: "S",
|
|
157
|
+
children: /* @__PURE__ */ e(ge, {})
|
|
158
|
+
}
|
|
159
|
+
) })
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
/* @__PURE__ */ e(d.Hint, {})
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
}, W = {
|
|
168
|
+
all: ["tokens"],
|
|
169
|
+
lists: () => [...W.all, "list"]
|
|
170
|
+
}, Re = () => j({
|
|
171
|
+
queryKey: W.lists(),
|
|
172
|
+
queryFn: () => I.getTokens(),
|
|
173
|
+
staleTime: 600 * 1e3
|
|
174
|
+
}), ke = ({
|
|
175
|
+
value: t = [],
|
|
176
|
+
onChange: n,
|
|
177
|
+
disabled: o = !1,
|
|
178
|
+
error: i
|
|
179
|
+
}) => {
|
|
180
|
+
const { data: a = [] } = Re(), l = y(), s = (g) => {
|
|
181
|
+
const p = g.map((b) => Number(b));
|
|
182
|
+
n({ target: { name: "tokens", value: p } });
|
|
183
|
+
};
|
|
184
|
+
return /* @__PURE__ */ m(
|
|
185
|
+
d.Root,
|
|
186
|
+
{
|
|
187
|
+
name: "tokens",
|
|
188
|
+
hint: l("domain.edit.form.tokens.hint"),
|
|
189
|
+
error: i,
|
|
190
|
+
children: [
|
|
191
|
+
/* @__PURE__ */ e(d.Label, { children: l("domain.edit.form.tokens.label") }),
|
|
192
|
+
/* @__PURE__ */ e(
|
|
193
|
+
X,
|
|
194
|
+
{
|
|
195
|
+
withTags: !0,
|
|
196
|
+
name: "tokens",
|
|
197
|
+
disabled: o,
|
|
198
|
+
value: t.map((g) => g.toString()),
|
|
199
|
+
onChange: s,
|
|
200
|
+
placeholder: l("domain.edit.form.tokens.placeholder"),
|
|
201
|
+
children: a.map((g) => /* @__PURE__ */ e(Y, { value: g.id.toString(), children: g.name }, g.id.toString()))
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
/* @__PURE__ */ e(d.Hint, {})
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
}, v = (t) => {
|
|
209
|
+
if (typeof t == "string") return t;
|
|
210
|
+
if (t && typeof t == "object" && "defaultMessage" in t) {
|
|
211
|
+
const n = t.defaultMessage;
|
|
212
|
+
return typeof n == "string" ? n : void 0;
|
|
213
|
+
}
|
|
214
|
+
}, ve = ({
|
|
215
|
+
values: t,
|
|
216
|
+
onChange: n,
|
|
217
|
+
disabled: o,
|
|
218
|
+
errors: i
|
|
219
|
+
}) => {
|
|
220
|
+
const a = y(), l = (s) => {
|
|
221
|
+
n({ target: { name: "customFields", value: s } });
|
|
222
|
+
};
|
|
223
|
+
return /* @__PURE__ */ e(f, { background: "neutral0", padding: 8, shadow: "filterShadow", hasRadius: !0, width: "100%", children: /* @__PURE__ */ m(R, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
224
|
+
/* @__PURE__ */ m(R, { gap: 4, wrap: "wrap", children: [
|
|
225
|
+
/* @__PURE__ */ e(f, { flex: "1", minWidth: "300px", children: /* @__PURE__ */ m(
|
|
226
|
+
d.Root,
|
|
227
|
+
{
|
|
228
|
+
name: "name",
|
|
229
|
+
required: !0,
|
|
230
|
+
hint: a("domain.edit.form.name.hint"),
|
|
231
|
+
error: v(i.name),
|
|
232
|
+
children: [
|
|
233
|
+
/* @__PURE__ */ e(d.Label, { children: a("domain.edit.form.name.label") }),
|
|
234
|
+
/* @__PURE__ */ e(
|
|
235
|
+
x,
|
|
236
|
+
{
|
|
237
|
+
disabled: o,
|
|
238
|
+
name: "name",
|
|
239
|
+
value: t.name,
|
|
240
|
+
onChange: n,
|
|
241
|
+
placeholder: a("domain.edit.form.name.placeholder"),
|
|
242
|
+
required: !0
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
/* @__PURE__ */ e(d.Hint, {}),
|
|
246
|
+
/* @__PURE__ */ e(d.Error, {})
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
) }),
|
|
250
|
+
/* @__PURE__ */ e(f, { flex: "1", minWidth: "300px", children: /* @__PURE__ */ m(
|
|
251
|
+
d.Root,
|
|
252
|
+
{
|
|
253
|
+
name: "code",
|
|
254
|
+
required: !0,
|
|
255
|
+
hint: a("domain.edit.form.code.hint"),
|
|
256
|
+
error: v(i.code),
|
|
257
|
+
children: [
|
|
258
|
+
/* @__PURE__ */ e(d.Label, { children: a("domain.edit.form.code.label") }),
|
|
259
|
+
/* @__PURE__ */ e(
|
|
260
|
+
x,
|
|
261
|
+
{
|
|
262
|
+
disabled: o,
|
|
263
|
+
name: "code",
|
|
264
|
+
value: t.code,
|
|
265
|
+
onChange: n,
|
|
266
|
+
placeholder: a("domain.edit.form.code.placeholder"),
|
|
267
|
+
required: !0
|
|
268
|
+
}
|
|
269
|
+
),
|
|
270
|
+
/* @__PURE__ */ e(d.Hint, {}),
|
|
271
|
+
/* @__PURE__ */ e(d.Error, {})
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
) })
|
|
275
|
+
] }),
|
|
276
|
+
/* @__PURE__ */ e(
|
|
277
|
+
ye,
|
|
278
|
+
{
|
|
279
|
+
value: t.logo,
|
|
280
|
+
onChange: n,
|
|
281
|
+
disabled: o,
|
|
282
|
+
error: i.logo?.toString()
|
|
283
|
+
}
|
|
284
|
+
),
|
|
285
|
+
/* @__PURE__ */ m(R, { gap: 4, wrap: "wrap", children: [
|
|
286
|
+
/* @__PURE__ */ e(f, { flex: "1", minWidth: "300px", children: /* @__PURE__ */ e(
|
|
287
|
+
Te,
|
|
288
|
+
{
|
|
289
|
+
value: t.role,
|
|
290
|
+
onChange: n,
|
|
291
|
+
disabled: o,
|
|
292
|
+
error: i.role?.toString()
|
|
293
|
+
}
|
|
294
|
+
) }),
|
|
295
|
+
/* @__PURE__ */ e(f, { flex: "1", minWidth: "300px", children: /* @__PURE__ */ e(
|
|
296
|
+
ke,
|
|
297
|
+
{
|
|
298
|
+
value: t.tokens || [],
|
|
299
|
+
onChange: n,
|
|
300
|
+
disabled: o,
|
|
301
|
+
error: i.tokens?.toString()
|
|
302
|
+
}
|
|
303
|
+
) })
|
|
304
|
+
] }),
|
|
305
|
+
/* @__PURE__ */ m(
|
|
306
|
+
d.Root,
|
|
307
|
+
{
|
|
308
|
+
name: "damRootDirectory",
|
|
309
|
+
hint: a("domain.edit.form.damRootDirectory.hint"),
|
|
310
|
+
error: v(i.damRootDirectory),
|
|
311
|
+
children: [
|
|
312
|
+
/* @__PURE__ */ e(d.Label, { children: a("domain.edit.form.damRootDirectory.label") }),
|
|
313
|
+
/* @__PURE__ */ e(
|
|
314
|
+
x,
|
|
315
|
+
{
|
|
316
|
+
disabled: o,
|
|
317
|
+
name: "damRootDirectory",
|
|
318
|
+
value: t.damRootDirectory,
|
|
319
|
+
onChange: n,
|
|
320
|
+
placeholder: a("domain.edit.form.damRootDirectory.placeholder")
|
|
321
|
+
}
|
|
322
|
+
),
|
|
323
|
+
/* @__PURE__ */ e(d.Hint, {}),
|
|
324
|
+
/* @__PURE__ */ e(d.Error, {})
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
),
|
|
328
|
+
/* @__PURE__ */ m(
|
|
329
|
+
d.Root,
|
|
330
|
+
{
|
|
331
|
+
name: "customFields",
|
|
332
|
+
hint: a("domain.edit.form.customFields.hint"),
|
|
333
|
+
error: v(i.customFields),
|
|
334
|
+
children: [
|
|
335
|
+
/* @__PURE__ */ e(d.Label, { children: a("domain.edit.form.customFields.label") }),
|
|
336
|
+
/* @__PURE__ */ e(
|
|
337
|
+
Z,
|
|
338
|
+
{
|
|
339
|
+
value: t.customFields,
|
|
340
|
+
onChange: l,
|
|
341
|
+
minHeight: "200px"
|
|
342
|
+
}
|
|
343
|
+
),
|
|
344
|
+
/* @__PURE__ */ e(d.Hint, {})
|
|
345
|
+
]
|
|
346
|
+
}
|
|
347
|
+
)
|
|
348
|
+
] }) });
|
|
349
|
+
}, Se = ({
|
|
350
|
+
message: t = "Loading..."
|
|
351
|
+
}) => /* @__PURE__ */ e(f, { padding: 8, textAlign: "center", children: /* @__PURE__ */ e(_, { children: t }) }), we = () => he({
|
|
352
|
+
mutationFn: (t) => I.validateTenant(t),
|
|
353
|
+
onError: (t) => {
|
|
354
|
+
console.error("Tenant validation failed:", t);
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
class Fe {
|
|
358
|
+
constructor(n) {
|
|
359
|
+
E(this, "name");
|
|
360
|
+
this.inner = n, this.name = "ValidationError";
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
const $e = () => {
|
|
364
|
+
const t = ae(), { id: n } = re(), o = n !== "new", i = o ? parseInt(n) : void 0, { toggleNotification: a } = te(), l = y(), { data: s, isLoading: g } = le(i), p = we(), b = ce(), k = me(), S = oe.useMemo(
|
|
365
|
+
() => ({
|
|
366
|
+
name: s?.name || "",
|
|
367
|
+
code: s?.code || "",
|
|
368
|
+
role: s?.role?.id?.toString() || "",
|
|
369
|
+
tokens: s?.tokens?.map((r) => r.id),
|
|
370
|
+
damRootDirectory: s?.damRootDirectory || "",
|
|
371
|
+
customFields: JSON.stringify(s?.customFields || {}, null, 2),
|
|
372
|
+
logo: s?.logo || null
|
|
373
|
+
}),
|
|
374
|
+
[s]
|
|
375
|
+
), w = s?.code === "strapi-super-admin", h = async (r) => {
|
|
376
|
+
try {
|
|
377
|
+
let u = {};
|
|
378
|
+
try {
|
|
379
|
+
u = JSON.parse(r.customFields || "{}");
|
|
380
|
+
} catch {
|
|
381
|
+
a({
|
|
382
|
+
type: "danger",
|
|
383
|
+
message: l("domain.edit.notifications.invalidJson")
|
|
384
|
+
});
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
if (o && i) {
|
|
388
|
+
const c = {
|
|
389
|
+
...r,
|
|
390
|
+
role: r.role ? parseInt(r.role) : void 0,
|
|
391
|
+
tokens: r.tokens || [],
|
|
392
|
+
customFields: u,
|
|
393
|
+
logo: r.logo || null
|
|
394
|
+
};
|
|
395
|
+
await k.mutateAsync({ id: i, data: c }), a({
|
|
396
|
+
type: "success",
|
|
397
|
+
message: l("domain.edit.notifications.updated")
|
|
398
|
+
});
|
|
399
|
+
} else {
|
|
400
|
+
const c = {
|
|
401
|
+
...r,
|
|
402
|
+
role: r.role ? parseInt(r.role) : void 0,
|
|
403
|
+
tokens: r.tokens || [],
|
|
404
|
+
customFields: u,
|
|
405
|
+
logo: r.logo || null
|
|
406
|
+
}, T = await b.mutateAsync(c);
|
|
407
|
+
a({
|
|
408
|
+
type: "success",
|
|
409
|
+
message: l("domain.edit.notifications.created")
|
|
410
|
+
}), t(`/settings/${L}/${M}/${T.id}`);
|
|
411
|
+
}
|
|
412
|
+
} catch (u) {
|
|
413
|
+
a({
|
|
414
|
+
type: "danger",
|
|
415
|
+
message: u instanceof Error ? u.message : l("domain.edit.notifications.saveError")
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
}, F = async (r) => {
|
|
419
|
+
const u = {};
|
|
420
|
+
if (r.customFields)
|
|
421
|
+
try {
|
|
422
|
+
JSON.parse(r.customFields);
|
|
423
|
+
} catch {
|
|
424
|
+
u.customFields = l("domain.edit.validation.invalidJson");
|
|
425
|
+
}
|
|
426
|
+
if (r.name || r.code)
|
|
427
|
+
try {
|
|
428
|
+
const c = {
|
|
429
|
+
excludeId: i
|
|
430
|
+
};
|
|
431
|
+
r.name && (c.name = r.name), r.code && (c.code = r.code);
|
|
432
|
+
const T = await p.mutateAsync(c);
|
|
433
|
+
T.name && (u.name = T.name || "Name is not available"), T.code && (u.code = T.code || "Code is not available");
|
|
434
|
+
} catch (c) {
|
|
435
|
+
a({
|
|
436
|
+
type: "danger",
|
|
437
|
+
message: c instanceof Error ? c.message : c?.toString()
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
if (!de(u))
|
|
441
|
+
throw new Fe(
|
|
442
|
+
Object.keys(u).map((c) => ({
|
|
443
|
+
path: c,
|
|
444
|
+
message: u[c]
|
|
445
|
+
}))
|
|
446
|
+
);
|
|
447
|
+
return r;
|
|
448
|
+
}, B = b.isPending || k.isPending;
|
|
449
|
+
return g ? /* @__PURE__ */ e(Se, { message: l("domain.edit.loading") }) : /* @__PURE__ */ m(D, { children: [
|
|
450
|
+
/* @__PURE__ */ e(H.Title, { children: o ? l("domain.edit.title.edit", {
|
|
451
|
+
values: { name: s?.name || $ }
|
|
452
|
+
}) : l("domain.edit.title.create") }),
|
|
453
|
+
/* @__PURE__ */ e(H.Main, { children: /* @__PURE__ */ e(
|
|
454
|
+
ne,
|
|
455
|
+
{
|
|
456
|
+
onSubmit: h,
|
|
457
|
+
initialValues: S,
|
|
458
|
+
validate: F,
|
|
459
|
+
method: "POST",
|
|
460
|
+
width: "auto",
|
|
461
|
+
height: "auto",
|
|
462
|
+
children: ({ values: r, onChange: u, errors: c }) => /* @__PURE__ */ m(D, { children: [
|
|
463
|
+
/* @__PURE__ */ e(fe, { isEditing: o, tenantName: s?.name }),
|
|
464
|
+
/* @__PURE__ */ e(P.Content, { children: /* @__PURE__ */ m(C.Root, { gap: 4, children: [
|
|
465
|
+
/* @__PURE__ */ e(C.Item, { col: 9, children: /* @__PURE__ */ e(
|
|
466
|
+
ve,
|
|
467
|
+
{
|
|
468
|
+
values: r,
|
|
469
|
+
onChange: u,
|
|
470
|
+
disabled: w,
|
|
471
|
+
errors: c
|
|
472
|
+
}
|
|
473
|
+
) }),
|
|
474
|
+
/* @__PURE__ */ e(C.Item, { col: 3, children: /* @__PURE__ */ e(
|
|
475
|
+
pe,
|
|
476
|
+
{
|
|
477
|
+
isEditing: o,
|
|
478
|
+
isSaving: B,
|
|
479
|
+
onCancel: () => t(`/settings/${L}/${M}`)
|
|
480
|
+
}
|
|
481
|
+
) })
|
|
482
|
+
] }) })
|
|
483
|
+
] })
|
|
484
|
+
}
|
|
485
|
+
) })
|
|
486
|
+
] });
|
|
487
|
+
};
|
|
488
|
+
export {
|
|
489
|
+
$e as default
|
|
490
|
+
};
|