cauthy-auth 0.28.1 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -0
- package/dist/{cauthy-CTVg4kvo.d.mts → cauthy-BXgsZ-Um.d.mts} +19 -1
- package/dist/{cauthy-BAwAJChs.d.ts → cauthy-CHENs452.d.ts} +19 -1
- package/dist/cli.js +155 -54
- package/dist/client.d.mts +47 -7
- package/dist/client.d.ts +47 -7
- package/dist/client.js +23 -1
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +23 -1
- package/dist/client.mjs.map +1 -1
- package/dist/express.d.mts +2 -2
- package/dist/express.d.ts +2 -2
- package/dist/fastify.d.mts +2 -2
- package/dist/fastify.d.ts +2 -2
- package/dist/hono.d.mts +2 -2
- package/dist/hono.d.ts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +325 -129
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +323 -129
- package/dist/index.mjs.map +1 -1
- package/dist/next.d.mts +2 -2
- package/dist/next.d.ts +2 -2
- package/dist/react.d.mts +214 -18
- package/dist/react.d.ts +214 -18
- package/dist/react.js +129 -32
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +129 -32
- package/dist/react.mjs.map +1 -1
- package/dist/svelte.d.mts +2 -2
- package/dist/svelte.d.ts +2 -2
- package/dist/svelte.js +37 -2
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +37 -2
- package/dist/svelte.mjs.map +1 -1
- package/dist/{system-CVBW_AV8.d.mts → system-0mHrdAgO.d.mts} +307 -109
- package/dist/{system-Bn8uckvQ.d.ts → system-BIYbS7h2.d.ts} +307 -109
- package/dist/vue.d.mts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +37 -2
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +37 -2
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -283,6 +283,12 @@ function checkOrganization(value, required = false) {
|
|
|
283
283
|
if (v.length > MAX_ORGANIZATION) return { field: "organization", code: "too_long", message: `Use at most ${MAX_ORGANIZATION} characters.` };
|
|
284
284
|
return null;
|
|
285
285
|
}
|
|
286
|
+
function checkOrganizationName(value) {
|
|
287
|
+
const v = typeof value === "string" ? value.trim() : "";
|
|
288
|
+
if (v === "") return { field: "name", code: "required", message: "Enter the organization's name." };
|
|
289
|
+
if (v.length > MAX_ORGANIZATION) return { field: "name", code: "too_long", message: `Use at most ${MAX_ORGANIZATION} characters.` };
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
286
292
|
function checkCode(value) {
|
|
287
293
|
const v = typeof value === "string" ? value.trim() : "";
|
|
288
294
|
if (v === "") return { field: "code", code: "required", message: "Enter the code." };
|
|
@@ -535,7 +541,23 @@ function createAuthClient(options = {}) {
|
|
|
535
541
|
add: (id, f) => post("/me/organizations/members/add", { organizationId: id, email: f.email, role: f.role, name: f.name ?? "", locale: f.locale ?? "" }, checkEmail(f.email)),
|
|
536
542
|
setRole: (id, userId, role) => post("/me/organizations/members/role", { organizationId: id, userId, role }, null),
|
|
537
543
|
remove: (id, userId) => post("/me/organizations/members/remove", { organizationId: id, userId }, null),
|
|
538
|
-
inviteAgain: (id, userId, f = {}) => post("/me/organizations/members/invite", { organizationId: id, userId, locale: f.locale ?? "" }, null)
|
|
544
|
+
inviteAgain: (id, userId, f = {}) => post("/me/organizations/members/invite", { organizationId: id, userId, locale: f.locale ?? "" }, null),
|
|
545
|
+
rename: (id, name) => post("/me/organizations/rename", { organizationId: id, name }, checkOrganizationName(name)),
|
|
546
|
+
archive: (id) => post("/me/organizations/archive", { organizationId: id }, null),
|
|
547
|
+
delete: (id) => post("/me/organizations/delete", { organizationId: id }, null),
|
|
548
|
+
async check(q) {
|
|
549
|
+
const organizationId = typeof q.organization === "string" ? q.organization : q.organization?.id ?? "";
|
|
550
|
+
const r = await post("/me/organizations/check", {
|
|
551
|
+
organizationId,
|
|
552
|
+
resource: q.resource,
|
|
553
|
+
action: q.action,
|
|
554
|
+
...q.attributes !== void 0 ? { attributes: q.attributes } : {},
|
|
555
|
+
...q.resourceId !== void 0 ? { resourceId: q.resourceId } : {},
|
|
556
|
+
...q.ownerId !== void 0 ? { ownerId: q.ownerId } : {}
|
|
557
|
+
}, null);
|
|
558
|
+
if (!r.ok) return { allowed: false, reason: r.error.message, error: r.error };
|
|
559
|
+
return { allowed: r.allowed === true, reason: String(r.reason ?? ""), ...r.rule ? { rule: r.rule } : {} };
|
|
560
|
+
}
|
|
539
561
|
},
|
|
540
562
|
account: {
|
|
541
563
|
async get() {
|
|
@@ -631,7 +653,9 @@ function can(organization, resource, action) {
|
|
|
631
653
|
if ((organization.denied ?? []).some((d) => matches(d, resource, action))) return false;
|
|
632
654
|
return organization.permissions.some((p) => matches(p, resource, action));
|
|
633
655
|
}
|
|
634
|
-
function definePolicy(
|
|
656
|
+
function definePolicy(given) {
|
|
657
|
+
const roles = Array.isArray(given) ? given : given.roles;
|
|
658
|
+
const resources = Array.isArray(given) ? [] : given.catalog ?? [];
|
|
635
659
|
const entry = (p) => `${p.resource}:${p.action}`;
|
|
636
660
|
const byName = new Map(roles.map((r) => [r.role, r]));
|
|
637
661
|
const split = (permission) => {
|
|
@@ -646,6 +670,12 @@ function definePolicy(roles) {
|
|
|
646
670
|
...r.inherits ? { inherits: [...r.inherits] } : {},
|
|
647
671
|
...r.permissions ? { permissions: r.permissions.map((p) => ({ ...p })) } : {}
|
|
648
672
|
})),
|
|
673
|
+
catalog: resources.map((c) => ({
|
|
674
|
+
resource: c.resource,
|
|
675
|
+
...c.description !== void 0 ? { description: c.description } : {},
|
|
676
|
+
actions: [...c.actions],
|
|
677
|
+
...c.attributes ? { attributes: { ...c.attributes } } : {}
|
|
678
|
+
})),
|
|
649
679
|
roleNames: roles.map((r) => r.role),
|
|
650
680
|
permissions: [...new Set(roles.flatMap((r) => (r.permissions ?? []).map(entry)))],
|
|
651
681
|
can(organization, permission) {
|
|
@@ -667,6 +697,11 @@ function definePolicy(roles) {
|
|
|
667
697
|
};
|
|
668
698
|
walk(role);
|
|
669
699
|
return [...out];
|
|
700
|
+
},
|
|
701
|
+
// The types did the work; this only hands the question on, as a method of
|
|
702
|
+
// the asker so it keeps its `this`.
|
|
703
|
+
check(asker, ...args) {
|
|
704
|
+
return asker.check(...args);
|
|
670
705
|
}
|
|
671
706
|
};
|
|
672
707
|
}
|
|
@@ -785,11 +820,22 @@ var TEXTS = {
|
|
|
785
820
|
memberLeaveConfirm: "Leave {org}? You will need an invitation to come back.",
|
|
786
821
|
memberInviteAgain: "Send the invitation again",
|
|
787
822
|
memberInvitationSent: "The invitation is on its way.",
|
|
823
|
+
organization: "Organization",
|
|
824
|
+
organizationRename: "Rename",
|
|
825
|
+
organizationRenamed: "The organization is now called {name}.",
|
|
826
|
+
organizationArchive: "Archive",
|
|
827
|
+
organizationArchiveConfirm: "Archive {org}? Its members will no longer reach it, and only the workspace can restore it.",
|
|
828
|
+
organizationArchived: "{org} was archived.",
|
|
829
|
+
organizationDelete: "Delete organization",
|
|
830
|
+
organizationDeleteConfirm: "Delete {org} for good? Its members lose it and this cannot be undone.",
|
|
831
|
+
organizationDeleted: "{org} was deleted.",
|
|
788
832
|
yes: "Yes",
|
|
789
833
|
cancel: "Cancel",
|
|
790
834
|
errors: {
|
|
791
835
|
not_allowed: "Your role in this organization does not allow that.",
|
|
792
836
|
last_manager: "Somebody else must manage the members first: give that role to another member.",
|
|
837
|
+
last_owner: "An organization keeps at least one owner: make another member owner first.",
|
|
838
|
+
organization_not_found: "That organization no longer exists.",
|
|
793
839
|
already_member: "That person already belongs to the organization. Change their role instead.",
|
|
794
840
|
unknown_role: "Choose one of the roles offered.",
|
|
795
841
|
user_not_active: "That account is disabled.",
|
|
@@ -941,11 +987,22 @@ var TEXTS = {
|
|
|
941
987
|
memberLeaveConfirm: "\xBFSalir de {org}? Necesitar\xE1s una invitaci\xF3n para volver.",
|
|
942
988
|
memberInviteAgain: "Enviar la invitaci\xF3n de nuevo",
|
|
943
989
|
memberInvitationSent: "La invitaci\xF3n va en camino.",
|
|
990
|
+
organization: "Organizaci\xF3n",
|
|
991
|
+
organizationRename: "Cambiar nombre",
|
|
992
|
+
organizationRenamed: "La organizaci\xF3n ahora se llama {name}.",
|
|
993
|
+
organizationArchive: "Archivar",
|
|
994
|
+
organizationArchiveConfirm: "\xBFArchivar {org}? Sus miembros ya no podr\xE1n entrar y solo el espacio de trabajo puede restaurarla.",
|
|
995
|
+
organizationArchived: "{org} qued\xF3 archivada.",
|
|
996
|
+
organizationDelete: "Eliminar organizaci\xF3n",
|
|
997
|
+
organizationDeleteConfirm: "\xBFEliminar {org} para siempre? Sus miembros la pierden y no se puede deshacer.",
|
|
998
|
+
organizationDeleted: "{org} qued\xF3 eliminada.",
|
|
944
999
|
yes: "S\xED",
|
|
945
1000
|
cancel: "Cancelar",
|
|
946
1001
|
errors: {
|
|
947
1002
|
not_allowed: "Tu rol en esta organizaci\xF3n no permite eso.",
|
|
948
1003
|
last_manager: "Primero alguien m\xE1s debe administrar los miembros: dale ese rol a otro miembro.",
|
|
1004
|
+
last_owner: "Una organizaci\xF3n conserva al menos un propietario: primero haz propietario a otro miembro.",
|
|
1005
|
+
organization_not_found: "Esa organizaci\xF3n ya no existe.",
|
|
949
1006
|
already_member: "Esa persona ya pertenece a la organizaci\xF3n. Cambia su rol.",
|
|
950
1007
|
unknown_role: "Escoge uno de los roles ofrecidos.",
|
|
951
1008
|
user_not_active: "Esa cuenta est\xE1 desactivada.",
|
|
@@ -1622,32 +1679,52 @@ function Account(props) {
|
|
|
1622
1679
|
] })
|
|
1623
1680
|
] });
|
|
1624
1681
|
}
|
|
1682
|
+
var OWNER = "owner";
|
|
1683
|
+
function memberActions(seat, m) {
|
|
1684
|
+
const reachable = m.role !== OWNER || seat.role === OWNER;
|
|
1685
|
+
return {
|
|
1686
|
+
changeRole: seat.can.manageMembers && reachable,
|
|
1687
|
+
// Leaving is anybody's; removing somebody else is cauthy:members:remove.
|
|
1688
|
+
remove: m.you || seat.can.removeMembers && reachable,
|
|
1689
|
+
inviteAgain: seat.can.manageMembers && m.invited
|
|
1690
|
+
};
|
|
1691
|
+
}
|
|
1692
|
+
function rolesToGive(seat, roles) {
|
|
1693
|
+
return seat.role === OWNER ? roles : roles.filter((c) => c.role !== OWNER);
|
|
1694
|
+
}
|
|
1625
1695
|
function OrganizationMembers(props) {
|
|
1626
1696
|
const auth = useAuth();
|
|
1627
1697
|
const { root } = useForm(props);
|
|
1628
1698
|
const { f, done, setDone, run } = useSection(props);
|
|
1629
|
-
const problem = f.error && f.error.field !== "email" ? f.error : null;
|
|
1699
|
+
const problem = f.error && f.error.field !== "email" && f.error.field !== "name" ? f.error : null;
|
|
1630
1700
|
const [seat, setSeat] = useState(void 0);
|
|
1631
1701
|
const [members, setMembers] = useState(null);
|
|
1632
1702
|
const [roles, setRoles] = useState([]);
|
|
1633
1703
|
const [email, setEmail] = useState("");
|
|
1634
1704
|
const [role, setRole] = useState("");
|
|
1705
|
+
const [name, setName] = useState("");
|
|
1635
1706
|
const [asking, setAsking] = useState(null);
|
|
1707
|
+
const [gone, setGone] = useState(null);
|
|
1636
1708
|
const id = props.organizationId;
|
|
1637
1709
|
const when = props.formatDate ?? ((iso) => new Date(iso).toLocaleDateString());
|
|
1638
1710
|
const load = async () => {
|
|
1639
1711
|
const [list, people, choices] = await Promise.all([auth.organizations.list(), auth.organizations.members(id), auth.organizations.roles(id)]);
|
|
1640
|
-
|
|
1712
|
+
const mine = list.find((o) => o.id === id) ?? null;
|
|
1713
|
+
setSeat(mine);
|
|
1714
|
+
if (mine) setName(mine.name);
|
|
1641
1715
|
setMembers(people);
|
|
1642
1716
|
setRoles(choices ?? []);
|
|
1643
|
-
|
|
1717
|
+
const offered = mine ? rolesToGive(mine, choices ?? []) : [];
|
|
1718
|
+
if (offered.length > 0 && !offered.some((c) => c.role === role)) setRole(offered[0].role);
|
|
1644
1719
|
};
|
|
1645
1720
|
useEffect(() => {
|
|
1646
1721
|
void load();
|
|
1647
1722
|
}, [id]);
|
|
1723
|
+
if (gone !== null) return /* @__PURE__ */ jsx("div", { className: f.cx("account"), ...root, children: /* @__PURE__ */ jsx("p", { role: "status", className: f.cx("notice"), children: gone }) });
|
|
1648
1724
|
if (seat === void 0) return /* @__PURE__ */ jsx("div", { className: f.cx("account"), ...root, "aria-busy": "true" });
|
|
1649
1725
|
if (seat === null) return /* @__PURE__ */ jsx("div", { className: f.cx("account"), ...root, children: /* @__PURE__ */ jsx("p", { className: f.cx("notice"), children: f.t.organizationMissing }) });
|
|
1650
1726
|
const manage = seat.can.manageMembers;
|
|
1727
|
+
const giveable = rolesToGive(seat, roles);
|
|
1651
1728
|
const label = (r) => roles.find((c) => c.role === r)?.name || r;
|
|
1652
1729
|
const add = async (e) => {
|
|
1653
1730
|
e.preventDefault();
|
|
@@ -1672,6 +1749,25 @@ function OrganizationMembers(props) {
|
|
|
1672
1749
|
const r = await run(() => auth.organizations.inviteAgain(id, m.userId, { locale: props.locale }));
|
|
1673
1750
|
if (r.ok) setDone(f.t.memberInvitationSent);
|
|
1674
1751
|
};
|
|
1752
|
+
const rename = async (e) => {
|
|
1753
|
+
e.preventDefault();
|
|
1754
|
+
const r = await run(() => auth.organizations.rename(id, name));
|
|
1755
|
+
if (!r.ok) return;
|
|
1756
|
+
setSeat(r.organization);
|
|
1757
|
+
setName(r.organization.name);
|
|
1758
|
+
setDone(f.t.organizationRenamed.replace("{name}", r.organization.name));
|
|
1759
|
+
};
|
|
1760
|
+
const close = async (how) => {
|
|
1761
|
+
setAsking(null);
|
|
1762
|
+
const r = await run(() => how === "archive" ? auth.organizations.archive(id) : auth.organizations.delete(id));
|
|
1763
|
+
if (r.ok) setGone((how === "archive" ? f.t.organizationArchived : f.t.organizationDeleted).replace("{org}", seat.name));
|
|
1764
|
+
};
|
|
1765
|
+
const confirming = (text2, label2, yes) => /* @__PURE__ */ jsxs("span", { role: "group", "aria-label": label2, children: [
|
|
1766
|
+
/* @__PURE__ */ jsx("span", { children: text2 }),
|
|
1767
|
+
" ",
|
|
1768
|
+
/* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: yes, children: f.t.yes }),
|
|
1769
|
+
/* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => setAsking(null), children: f.t.cancel })
|
|
1770
|
+
] });
|
|
1675
1771
|
return /* @__PURE__ */ jsxs("div", { className: f.cx("account"), ...root, children: [
|
|
1676
1772
|
/* @__PURE__ */ jsxs("section", { className: f.cx("section"), children: [
|
|
1677
1773
|
/* @__PURE__ */ jsxs("h2", { className: f.cx("heading"), children: [
|
|
@@ -1682,23 +1778,14 @@ function OrganizationMembers(props) {
|
|
|
1682
1778
|
problem && /* @__PURE__ */ jsx("p", { role: "alert", className: f.cx("error"), children: f.say(problem) }),
|
|
1683
1779
|
members === null ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1684
1780
|
/* @__PURE__ */ jsx("p", { className: f.cx("notice"), children: f.t.membersHidden }),
|
|
1685
|
-
auth.session && (asking === auth.session.user.id ?
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
{
|
|
1691
|
-
type: "button",
|
|
1692
|
-
disabled: f.busy,
|
|
1693
|
-
className: f.cx("providerButton"),
|
|
1694
|
-
onClick: () => void remove({ userId: auth.session.user.id, you: true }),
|
|
1695
|
-
children: f.t.yes
|
|
1696
|
-
}
|
|
1697
|
-
),
|
|
1698
|
-
/* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => setAsking(null), children: f.t.cancel })
|
|
1699
|
-
] }) : /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => setAsking(auth.session.user.id), children: f.t.memberLeave }))
|
|
1781
|
+
auth.session && (asking === auth.session.user.id ? confirming(
|
|
1782
|
+
f.t.memberLeaveConfirm.replace("{org}", seat.name),
|
|
1783
|
+
f.t.memberLeave,
|
|
1784
|
+
() => void remove({ userId: auth.session.user.id, you: true })
|
|
1785
|
+
) : /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => setAsking(auth.session.user.id), children: f.t.memberLeave }))
|
|
1700
1786
|
] }) : /* @__PURE__ */ jsx("ul", { className: f.cx("sessions"), children: members.map((m) => {
|
|
1701
1787
|
const who = m.name || m.email;
|
|
1788
|
+
const may = memberActions(seat, m);
|
|
1702
1789
|
return /* @__PURE__ */ jsxs("li", { className: f.cx("session"), children: [
|
|
1703
1790
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
1704
1791
|
who,
|
|
@@ -1710,7 +1797,7 @@ function OrganizationMembers(props) {
|
|
|
1710
1797
|
when(m.since)
|
|
1711
1798
|
] }),
|
|
1712
1799
|
" ",
|
|
1713
|
-
|
|
1800
|
+
may.changeRole && giveable.length > 0 ? /* @__PURE__ */ jsx(
|
|
1714
1801
|
"select",
|
|
1715
1802
|
{
|
|
1716
1803
|
"aria-label": `${f.t.memberRole}: ${who}`,
|
|
@@ -1718,31 +1805,41 @@ function OrganizationMembers(props) {
|
|
|
1718
1805
|
value: m.role,
|
|
1719
1806
|
disabled: f.busy,
|
|
1720
1807
|
onChange: (e) => void change(m, e.target.value),
|
|
1721
|
-
children: roles.map((c) => /* @__PURE__ */ jsx("option", { value: c.role, children: c.name || c.role }, c.role))
|
|
1808
|
+
children: (giveable.some((c) => c.role === m.role) ? giveable : [...roles.filter((c) => c.role === m.role), ...giveable]).map((c) => /* @__PURE__ */ jsx("option", { value: c.role, children: c.name || c.role }, c.role))
|
|
1722
1809
|
}
|
|
1723
1810
|
) : /* @__PURE__ */ jsx("span", { children: label(m.role) }),
|
|
1724
1811
|
" ",
|
|
1725
|
-
asking === m.userId ?
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
(manage || m.you) && /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => setAsking(m.userId), children: m.you ? f.t.memberLeave : f.t.memberRemove })
|
|
1812
|
+
asking === m.userId ? confirming(
|
|
1813
|
+
m.you ? f.t.memberLeaveConfirm.replace("{org}", seat.name) : f.t.memberRemoveConfirm.replace("{who}", who),
|
|
1814
|
+
m.you ? f.t.memberLeave : f.t.memberRemove,
|
|
1815
|
+
() => void remove(m)
|
|
1816
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1817
|
+
may.inviteAgain && /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => void inviteAgain(m), children: f.t.memberInviteAgain }),
|
|
1818
|
+
may.remove && /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => setAsking(m.userId), children: m.you ? f.t.memberLeave : f.t.memberRemove })
|
|
1733
1819
|
] })
|
|
1734
1820
|
] }, m.userId);
|
|
1735
1821
|
}) }),
|
|
1736
1822
|
done && /* @__PURE__ */ jsx("p", { role: "status", className: f.cx("notice"), children: done })
|
|
1737
1823
|
] }),
|
|
1738
|
-
manage &&
|
|
1824
|
+
manage && giveable.length > 0 && /* @__PURE__ */ jsxs("form", { className: f.cx("section"), onSubmit: add, noValidate: true, children: [
|
|
1739
1825
|
/* @__PURE__ */ jsx("h2", { className: f.cx("heading"), children: f.t.memberAdd }),
|
|
1740
1826
|
/* @__PURE__ */ jsx(Field, { f, name: "email", type: "email", label: f.t.email, value: email, autoComplete: "off", required: true, onChange: setEmail }),
|
|
1741
1827
|
/* @__PURE__ */ jsxs("label", { className: f.cx("field"), children: [
|
|
1742
1828
|
/* @__PURE__ */ jsx("span", { className: f.cx("label"), children: f.t.memberRole }),
|
|
1743
|
-
/* @__PURE__ */ jsx("select", { name: "role", className: f.cx("input"), value: role, onChange: (e) => setRole(e.target.value), children:
|
|
1829
|
+
/* @__PURE__ */ jsx("select", { name: "role", className: f.cx("input"), value: role, onChange: (e) => setRole(e.target.value), children: giveable.map((c) => /* @__PURE__ */ jsx("option", { value: c.role, children: c.name || c.role }, c.role)) })
|
|
1744
1830
|
] }),
|
|
1745
1831
|
/* @__PURE__ */ jsx(f.Button, { type: "submit", disabled: f.busy, className: f.cx("button"), children: f.t.memberAdd })
|
|
1832
|
+
] }),
|
|
1833
|
+
(seat.can.update || seat.can.archive || seat.can.delete) && /* @__PURE__ */ jsxs("section", { className: f.cx("section"), children: [
|
|
1834
|
+
/* @__PURE__ */ jsx("h2", { className: f.cx("heading"), children: f.t.organization }),
|
|
1835
|
+
seat.can.update && /* @__PURE__ */ jsxs("form", { onSubmit: rename, noValidate: true, children: [
|
|
1836
|
+
/* @__PURE__ */ jsx(Field, { f, name: "name", type: "text", label: f.t.name, value: name, autoComplete: "organization", required: true, onChange: setName }),
|
|
1837
|
+
/* @__PURE__ */ jsx(f.Button, { type: "submit", disabled: f.busy, className: f.cx("button"), children: f.t.organizationRename })
|
|
1838
|
+
] }),
|
|
1839
|
+
asking === "archive" ? confirming(f.t.organizationArchiveConfirm.replace("{org}", seat.name), f.t.organizationArchive, () => void close("archive")) : asking === "delete" ? confirming(f.t.organizationDeleteConfirm.replace("{org}", seat.name), f.t.organizationDelete, () => void close("delete")) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1840
|
+
seat.can.archive && /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => setAsking("archive"), children: f.t.organizationArchive }),
|
|
1841
|
+
seat.can.delete && /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => setAsking("delete"), children: f.t.organizationDelete })
|
|
1842
|
+
] })
|
|
1746
1843
|
] })
|
|
1747
1844
|
] });
|
|
1748
1845
|
}
|