@tiny-server/identity 0.0.0-pre202605241751

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/AccountForm-B2UrGPa4.js +165 -0
  2. package/dist/AccountHeader-B4SMzQeC.js +31 -0
  3. package/dist/AccountSettingsMenuItem-BKBN0OZp.js +29 -0
  4. package/dist/CreatedUpdatedBadges-C4dgPWIl.js +42 -0
  5. package/dist/DeleteAccountForm-yrL29VdV.js +200 -0
  6. package/dist/IdentityErrorDetails-CJDjlYx0.js +142 -0
  7. package/dist/ManageAccountsMenuItem-BgTTH5S8.js +29 -0
  8. package/dist/ManageRolesMenuItem-DxMd-3i9.js +29 -0
  9. package/dist/RoleForm-DYxKoGmW.js +202 -0
  10. package/dist/RoleHeader-CoZg-xCl.js +67 -0
  11. package/dist/api/accounts.d.ts +112 -0
  12. package/dist/api/index.d.ts +5 -0
  13. package/dist/api/login.d.ts +26 -0
  14. package/dist/api/permissions.d.ts +13 -0
  15. package/dist/api/roles.d.ts +100 -0
  16. package/dist/api/status.d.ts +6 -0
  17. package/dist/components/CreatedUpdatedBadges.d.ts +10 -0
  18. package/dist/components/IdentityErrorDetails.d.ts +5 -0
  19. package/dist/components/account/AccountHeader.d.ts +5 -0
  20. package/dist/components/account/AccountOverviewCard.d.ts +8 -0
  21. package/dist/components/account/ChangePasswordCard.d.ts +4 -0
  22. package/dist/components/account/CreateAccountCard.d.ts +1 -0
  23. package/dist/components/account/DeleteAccountCard.d.ts +6 -0
  24. package/dist/components/account/ManageAccountCard.d.ts +15 -0
  25. package/dist/components/account/ManageAccountRolesCard.d.ts +5 -0
  26. package/dist/components/account/index.d.ts +7 -0
  27. package/dist/components/index.d.ts +5 -0
  28. package/dist/components/role/CreateRoleCard.d.ts +1 -0
  29. package/dist/components/role/DeleteRoleCard.d.ts +6 -0
  30. package/dist/components/role/ManageRoleCard.d.ts +6 -0
  31. package/dist/components/role/PermissionInput.d.ts +17 -0
  32. package/dist/components/role/RoleHeader.d.ts +5 -0
  33. package/dist/components/role/RoleOverviewCard.d.ts +5 -0
  34. package/dist/components/role/index.d.ts +5 -0
  35. package/dist/constants.d.ts +9 -0
  36. package/dist/createLucideIcon-DJ4QdTU4.js +74 -0
  37. package/dist/declarations.d.ts +10 -0
  38. package/dist/forms/AccountForm.d.ts +22 -0
  39. package/dist/forms/AccountRolesForm.d.ts +11 -0
  40. package/dist/forms/ChangePasswordForm.d.ts +15 -0
  41. package/dist/forms/DeleteAccountForm.d.ts +6 -0
  42. package/dist/forms/DeleteRoleForm.d.ts +6 -0
  43. package/dist/forms/LoginForm.d.ts +1 -0
  44. package/dist/forms/RegisterForm.d.ts +1 -0
  45. package/dist/forms/RoleForm.d.ts +13 -0
  46. package/dist/forms/index.d.ts +8 -0
  47. package/dist/i18n-ZQHvKu9t.js +5 -0
  48. package/dist/index.d.ts +3 -0
  49. package/dist/index.js +267 -0
  50. package/dist/key-CmPc9vYA.js +9 -0
  51. package/dist/login-DP7FSO-S.js +108 -0
  52. package/dist/manage.accounts-D8nzi0BV.js +60 -0
  53. package/dist/manage.accounts._id-CTAIEe0D.js +131 -0
  54. package/dist/manage.accounts.create-CJHdTi4B.js +29 -0
  55. package/dist/manage.roles-B_WYX8EH.js +68 -0
  56. package/dist/manage.roles._id-CRO5xYLO.js +108 -0
  57. package/dist/manage.roles.create-DDNPLNCK.js +29 -0
  58. package/dist/menu/AccountSettingsMenuItem.d.ts +3 -0
  59. package/dist/menu/ManageAccountsMenuItem.d.ts +3 -0
  60. package/dist/menu/ManageRolesMenuItem.d.ts +3 -0
  61. package/dist/module.d.ts +6 -0
  62. package/dist/plus-Bhxt0T43.js +8 -0
  63. package/dist/register-C4hB44_D.js +155 -0
  64. package/dist/routes/login.d.ts +1 -0
  65. package/dist/routes/manage.accounts.$id.d.ts +1 -0
  66. package/dist/routes/manage.accounts.create.d.ts +1 -0
  67. package/dist/routes/manage.accounts.d.ts +1 -0
  68. package/dist/routes/manage.roles.$id.d.ts +1 -0
  69. package/dist/routes/manage.roles.create.d.ts +1 -0
  70. package/dist/routes/manage.roles.d.ts +1 -0
  71. package/dist/routes/register.d.ts +1 -0
  72. package/dist/routes/settings.account.d.ts +1 -0
  73. package/dist/settings.account-DITieOTt.js +25 -0
  74. package/dist/triangle-alert-TOt7wYJV.js +21 -0
  75. package/dist/useCreateUpdateForm-DnWbYIo0.js +18 -0
  76. package/dist/user-BmPfMiSO.js +8 -0
  77. package/dist/utils/i18n.d.ts +2 -0
  78. package/dist/utils/index.d.ts +3 -0
  79. package/dist/utils/useCreateUpdateForm.d.ts +15 -0
  80. package/dist/utils/useValidators.d.ts +7 -0
  81. package/package.json +54 -0
@@ -0,0 +1,131 @@
1
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
+ import { withPermissions as Q, usePermissions as w, usePagination as E, useSession as I, useApp as N, Extension as y } from "@tiny-server/core";
3
+ import { useMutation as z, useSuspenseQuery as R, useQuery as L } from "@tanstack/react-query";
4
+ import { useNavigate as j, useParams as B, useSearchParams as O } from "react-router";
5
+ import { Checkbox as $, Stack as M, Skeleton as G, Text as H, Pagination as U, Button as V, Tabs as b, Scroller as _ } from "@mantine/core";
6
+ import { useMemo as q } from "react";
7
+ import { updateAccountRolesMutation as J, readAccountRolesQuery as K, readRolesQuery as W, readAccountQuery as X } from "./index.js";
8
+ import { SectionCard as S, Form as P, CheckboxCard as D } from "@tiny-server/design";
9
+ import { useForm as Y } from "@mantine/form";
10
+ import { I as Z } from "./IdentityErrorDetails-CJDjlYx0.js";
11
+ import { d as C } from "./i18n-ZQHvKu9t.js";
12
+ import { M as ee, C as ae, D as te } from "./DeleteAccountForm-yrL29VdV.js";
13
+ const ne = C("ManageAccountRolesCard", {
14
+ en: {
15
+ title: "Roles"
16
+ }
17
+ }), oe = Q(
18
+ { permissions: ["read.account.roles.all"] },
19
+ ({ account: t }) => {
20
+ const s = ne();
21
+ return /* @__PURE__ */ c(S, { children: [
22
+ /* @__PURE__ */ e(S.Header, { title: s("title") }),
23
+ /* @__PURE__ */ e(S.Section, { children: /* @__PURE__ */ e(re, { accountId: t.id }) })
24
+ ] });
25
+ }
26
+ ), se = C("AccountRolesForm", {
27
+ en: {
28
+ roles: {
29
+ label: "Assigned roles",
30
+ description: "The roles assigned to this account."
31
+ },
32
+ roleDescriptionFallback: "No description.",
33
+ submit: "Save changes",
34
+ error: "Updating roles failed."
35
+ }
36
+ });
37
+ function re({ accountId: t, onSuccess: s }) {
38
+ const n = se(), l = w(), { mutate: d, isPending: r, error: a } = z(J(t)), i = !l.includes("write.account.roles.all"), u = r, { page: g, pageSize: h, setPage: k } = E({
39
+ pageParamName: "rolePage",
40
+ pageSizeParamName: "rolePageSize",
41
+ defaultPage: 1,
42
+ defaultPageSize: 5
43
+ }), { data: v } = R(K(t)), { data: m, isLoading: T } = L({
44
+ ...W({ page: g, pageSize: h, sortBy: "Name", sortDirection: "Ascending" }),
45
+ throwOnError: !0
46
+ }), p = Y({
47
+ initialValues: {
48
+ roles: v?.data || []
49
+ }
50
+ }), F = (o) => {
51
+ d(o.roles, {
52
+ onSuccess(f) {
53
+ p.resetDirty(), s?.(f.data);
54
+ }
55
+ });
56
+ };
57
+ return /* @__PURE__ */ c(P, { onSubmit: p.onSubmit(F), children: [
58
+ /* @__PURE__ */ c(P.Section, { children: [
59
+ a && /* @__PURE__ */ e(P.Alert, { kind: "error", title: n("error"), children: /* @__PURE__ */ e(Z, { error: a }) }),
60
+ /* @__PURE__ */ e(
61
+ $.Group,
62
+ {
63
+ ...p.getInputProps("roles"),
64
+ label: n("roles.label"),
65
+ description: n("roles.description"),
66
+ children: /* @__PURE__ */ c(M, { pt: "xs", gap: "xs", children: [
67
+ T && Array(h).fill(null).map((o, f) => /* @__PURE__ */ e(G, { visible: !0, children: /* @__PURE__ */ e(D, { label: "", description: "" }) }, f)),
68
+ !!m?.data.length && m.data.map((o) => /* @__PURE__ */ e(
69
+ D,
70
+ {
71
+ id: o.id,
72
+ value: o.name,
73
+ label: o.name,
74
+ description: /* @__PURE__ */ e(H, { component: "span", style: { whiteSpace: "pre-line" }, lineClamp: 3, inherit: !0, children: o.description || n("roleDescriptionFallback") }),
75
+ disabled: i || u
76
+ },
77
+ o.id
78
+ )),
79
+ m && m.totalPages > 1 && /* @__PURE__ */ e(
80
+ U,
81
+ {
82
+ total: m.totalPages,
83
+ value: g,
84
+ disabled: T || u,
85
+ onChange: k
86
+ }
87
+ )
88
+ ] })
89
+ },
90
+ p.key("roles")
91
+ )
92
+ ] }),
93
+ !i && /* @__PURE__ */ e(P.Footer, { children: /* @__PURE__ */ e(V, { type: "submit", loading: r, disabled: r || !p.isDirty(), children: n("submit") }) })
94
+ ] });
95
+ }
96
+ const x = "t", A = "account", ie = C("ManageAccountRoute", {
97
+ en: {
98
+ title: "Account Details",
99
+ delete: "Delete account",
100
+ accountTab: "Account"
101
+ }
102
+ });
103
+ function Ce() {
104
+ const t = ie(), { userId: s } = I(), n = j(), l = N(), { Page: d } = l.components, { id: r = "" } = B(), {
105
+ data: { data: a }
106
+ } = R(X(r)), { currentTab: i, tabExtensionParams: u, handleTabChange: g } = ce(a), h = () => {
107
+ s !== a.id && n("/manage/accounts");
108
+ };
109
+ return /* @__PURE__ */ e(d, { header: t("title"), children: /* @__PURE__ */ c(b, { variant: "pills", radius: "xl", value: i, onChange: g, children: [
110
+ /* @__PURE__ */ e(b.List, { pb: "md", children: /* @__PURE__ */ c(_, { children: [
111
+ /* @__PURE__ */ e(b.Tab, { value: A, children: t("accountTab") }),
112
+ /* @__PURE__ */ e(y, { name: "manage-account-tab", params: u })
113
+ ] }) }),
114
+ /* @__PURE__ */ c(b.Panel, { component: M, value: A, children: [
115
+ /* @__PURE__ */ e(ee, { account: a }),
116
+ /* @__PURE__ */ e(ae, { accountId: r }),
117
+ /* @__PURE__ */ e(oe, { account: a }),
118
+ /* @__PURE__ */ e(te, { account: a, onSuccess: h })
119
+ ] }),
120
+ /* @__PURE__ */ e(y, { name: "manage-account-tab-panel", params: u })
121
+ ] }) });
122
+ }
123
+ function ce(t) {
124
+ const [s, n] = O(), l = s.get(x) || A, d = q(() => ({ account: t }), [t]);
125
+ return { currentTab: l, tabExtensionParams: d, handleTabChange: (a) => {
126
+ a && n((i) => (i.set(x, a), i));
127
+ } };
128
+ }
129
+ export {
130
+ Ce as default
131
+ };
@@ -0,0 +1,29 @@
1
+ import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
+ import { withPermissions as r, useApp as a } from "@tiny-server/core";
3
+ import { SectionCard as s } from "@tiny-server/design";
4
+ import { useNavigate as u } from "react-router";
5
+ import { A as l } from "./AccountForm-B2UrGPa4.js";
6
+ import { d as c } from "./i18n-ZQHvKu9t.js";
7
+ const m = c("CreateAccountCard", {
8
+ en: {
9
+ title: "Account Details",
10
+ subTitle: "Accounts represent user identities used to access this application."
11
+ }
12
+ }), p = r({ permissions: ["write.account.all"] }, () => {
13
+ const e = m(), o = u();
14
+ return /* @__PURE__ */ i(s, { children: [
15
+ /* @__PURE__ */ t(s.Header, { title: e("title"), subTitle: e("subTitle") }),
16
+ /* @__PURE__ */ t(s.Section, { children: /* @__PURE__ */ t(l, { onSuccess: (n) => o(`/manage/accounts/${n.id}`) }) })
17
+ ] });
18
+ }), d = c("CreateAccountRoute", {
19
+ en: {
20
+ title: "Create Account"
21
+ }
22
+ });
23
+ function b() {
24
+ const e = d(), o = a(), { Page: n } = o.components;
25
+ return /* @__PURE__ */ t(n, { header: e("title"), children: /* @__PURE__ */ t(p, {}) });
26
+ }
27
+ export {
28
+ b as default
29
+ };
@@ -0,0 +1,68 @@
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import { withPermissions as v, useApp as y, usePagination as P, WithPermissions as b } from "@tiny-server/core";
3
+ import { Stack as d, Text as k, Badge as x, Pagination as z, Button as C, ActionIcon as L } from "@mantine/core";
4
+ import { useSuspenseQuery as R } from "@tanstack/react-query";
5
+ import { Link as r } from "react-router";
6
+ import { readRolesQuery as S } from "./index.js";
7
+ import { SectionCard as c, LabeledInfo as l, BadgeGroup as M } from "@tiny-server/design";
8
+ import { R as w } from "./RoleHeader-CoZg-xCl.js";
9
+ import { c as I } from "./createLucideIcon-DJ4QdTU4.js";
10
+ import { K as T } from "./key-CmPc9vYA.js";
11
+ import { d as p } from "./i18n-ZQHvKu9t.js";
12
+ import { P as m } from "./plus-Bhxt0T43.js";
13
+ const B = [
14
+ ["path", { d: "M15 12h-5", key: "r7krc0" }],
15
+ ["path", { d: "M15 8h-5", key: "1khuty" }],
16
+ ["path", { d: "M19 17V5a2 2 0 0 0-2-2H4", key: "zz82l3" }],
17
+ [
18
+ "path",
19
+ {
20
+ d: "M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",
21
+ key: "1ph1d7"
22
+ }
23
+ ]
24
+ ], H = I("scroll-text", B), j = p("RoleOverviewCard", {
25
+ en: {
26
+ descriptionLabel: "Description",
27
+ permissionsLabel: "Permissions"
28
+ }
29
+ }), A = v(
30
+ { permissions: ["read.role.all"] },
31
+ ({ role: o }) => {
32
+ const i = j();
33
+ return /* @__PURE__ */ t(c, { children: [
34
+ /* @__PURE__ */ e(w, { role: o }),
35
+ /* @__PURE__ */ e(c.Section, { children: /* @__PURE__ */ t(d, { gap: "sm", children: [
36
+ /* @__PURE__ */ e(l, { variant: "inline", icon: /* @__PURE__ */ e(H, { size: "1em" }), label: i("descriptionLabel"), children: o.description && /* @__PURE__ */ e(k, { size: "sm", lineClamp: 3, style: { whiteSpace: "pre-line" }, children: o.description }) }),
37
+ /* @__PURE__ */ e(l, { variant: "inline", icon: /* @__PURE__ */ e(T, { size: "1em" }), label: i("permissionsLabel"), children: o.permissions.length && /* @__PURE__ */ e(M, { max: 5, children: o.permissions.map((n) => /* @__PURE__ */ e(x, { variant: "light", color: "gray", children: n }, n)) }) })
38
+ ] }) })
39
+ ] });
40
+ }
41
+ ), D = p("ManageRolesPage", {
42
+ en: {
43
+ title: "Roles",
44
+ create: "Create role"
45
+ }
46
+ });
47
+ function E() {
48
+ const o = D(), i = y(), { Page: n } = i.components, { page: s, pageSize: h, setPage: g } = P(), {
49
+ data: { data: u, totalPages: f }
50
+ } = R(S({ page: s, pageSize: h }));
51
+ return /* @__PURE__ */ e(
52
+ n,
53
+ {
54
+ header: o("title"),
55
+ actions: /* @__PURE__ */ t(b, { permissions: ["write.role.all"], children: [
56
+ /* @__PURE__ */ e(C, { component: r, visibleFrom: "md", leftSection: /* @__PURE__ */ e(m, { size: "1em" }), to: "/manage/roles/create", children: o("create") }),
57
+ /* @__PURE__ */ e(L, { component: r, hiddenFrom: "md", "aria-label": o("create"), to: "/manage/roles/create", children: /* @__PURE__ */ e(m, { size: "1em" }) })
58
+ ] }),
59
+ children: /* @__PURE__ */ t(d, { children: [
60
+ u.map((a) => /* @__PURE__ */ e(r, { to: `/manage/roles/${encodeURIComponent(a.name)}`, style: { textDecoration: "none" }, children: /* @__PURE__ */ e(A, { role: a }) }, a.id)),
61
+ /* @__PURE__ */ e(z, { value: s, total: f, onChange: g })
62
+ ] })
63
+ }
64
+ );
65
+ }
66
+ export {
67
+ E as default
68
+ };
@@ -0,0 +1,108 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import { withPermissions as u, useApp as f } from "@tiny-server/core";
3
+ import { useMutation as R, useSuspenseQuery as g } from "@tanstack/react-query";
4
+ import { useNavigate as b, useParams as D } from "react-router";
5
+ import { Alert as S, TextInput as y, Button as N, Stack as T } from "@mantine/core";
6
+ import { deleteRoleMutation as v, readRoleQuery as P } from "./index.js";
7
+ import { SectionCard as n, Form as m } from "@tiny-server/design";
8
+ import { R as F } from "./RoleHeader-CoZg-xCl.js";
9
+ import { R as w } from "./RoleForm-DYxKoGmW.js";
10
+ import { useForm as A } from "@mantine/form";
11
+ import { I as C } from "./IdentityErrorDetails-CJDjlYx0.js";
12
+ import { a as M, T as x } from "./triangle-alert-TOt7wYJV.js";
13
+ import { d as c } from "./i18n-ZQHvKu9t.js";
14
+ const I = c("DeleteRoleCard", {
15
+ en: {
16
+ title: "Delete Role"
17
+ }
18
+ }), j = u(
19
+ { permissions: ["write.role.all"] },
20
+ ({ role: o, onSuccess: r }) => {
21
+ const t = I();
22
+ return o.isSystemRole ? null : /* @__PURE__ */ a(n, { children: [
23
+ /* @__PURE__ */ e(n.Header, { title: t("title") }),
24
+ /* @__PURE__ */ e(n.Section, { children: /* @__PURE__ */ e(E, { role: o, onSuccess: r }) })
25
+ ] });
26
+ }
27
+ ), k = u({ permissions: ["read.role.all"] }, ({ role: o }) => /* @__PURE__ */ a(n, { children: [
28
+ /* @__PURE__ */ e(F, { role: o }),
29
+ /* @__PURE__ */ e(n.Section, { children: /* @__PURE__ */ e(w, { role: o }) })
30
+ ] })), z = c("DeleteRoleForm", {
31
+ en: {
32
+ alert: {
33
+ title: "Danger Zone",
34
+ description: "Deleting a role is irreversible. All permissions and user associations will be permanently removed. Users previously assigned to the role may no longer be able to use the system properly. Please proceed with caution."
35
+ },
36
+ roleName: {
37
+ label: "Role name",
38
+ description: "Enter the role's name to proceed with deletion.",
39
+ placeholder: "Role name",
40
+ mismatch: "The name must match the role's name."
41
+ },
42
+ submit: "Permanently delete role",
43
+ error: "Role deletion failed."
44
+ }
45
+ });
46
+ function E({ role: o, onSuccess: r }) {
47
+ const t = z(), { mutate: d, isPending: s, error: l } = R(v()), i = A({
48
+ initialValues: {
49
+ roleName: ""
50
+ },
51
+ validate: {
52
+ roleName: (h) => h === o.name ? null : t("roleName.mismatch")
53
+ }
54
+ }), p = () => {
55
+ d(o.name, {
56
+ onSuccess() {
57
+ r?.();
58
+ }
59
+ });
60
+ };
61
+ return /* @__PURE__ */ a(m, { onSubmit: i.onSubmit(p), children: [
62
+ /* @__PURE__ */ a(m.Section, { children: [
63
+ l ? /* @__PURE__ */ e(m.Alert, { kind: "error", title: t("error"), children: /* @__PURE__ */ e(C, { error: l }) }) : /* @__PURE__ */ e(S, { variant: "light", color: "red", icon: /* @__PURE__ */ e(M, { size: "1em" }), title: t("alert.title"), children: t("alert.description") }),
64
+ /* @__PURE__ */ e(
65
+ y,
66
+ {
67
+ id: "roleName",
68
+ label: t("roleName.label"),
69
+ description: t("roleName.description"),
70
+ placeholder: t("roleName.placeholder"),
71
+ required: !0,
72
+ ...i.getInputProps("roleName")
73
+ }
74
+ )
75
+ ] }),
76
+ /* @__PURE__ */ e(m.Footer, { children: /* @__PURE__ */ e(
77
+ N,
78
+ {
79
+ type: "submit",
80
+ color: "red",
81
+ leftSection: /* @__PURE__ */ e(x, { size: "1em" }),
82
+ loading: s,
83
+ disabled: !i.isValid() || s,
84
+ children: t("submit")
85
+ }
86
+ ) })
87
+ ] });
88
+ }
89
+ const H = c("ManageRoleRoute", {
90
+ en: {
91
+ title: "Role Details",
92
+ delete: "Delete role"
93
+ }
94
+ });
95
+ function X() {
96
+ const o = H(), r = f(), { Page: t } = r.components, d = b(), { id: s = "" } = D(), {
97
+ data: { data: l }
98
+ } = g(P(s)), i = () => {
99
+ d("/manage/roles");
100
+ };
101
+ return /* @__PURE__ */ e(t, { header: o("title"), children: /* @__PURE__ */ a(T, { children: [
102
+ /* @__PURE__ */ e(k, { role: l }),
103
+ /* @__PURE__ */ e(j, { role: l, onSuccess: i })
104
+ ] }) });
105
+ }
106
+ export {
107
+ X as default
108
+ };
@@ -0,0 +1,29 @@
1
+ import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
+ import { withPermissions as a, useApp as l } from "@tiny-server/core";
3
+ import { SectionCard as r } from "@tiny-server/design";
4
+ import { useNavigate as c } from "react-router";
5
+ import { R as m } from "./RoleForm-DYxKoGmW.js";
6
+ import { d as i } from "./i18n-ZQHvKu9t.js";
7
+ const u = i("CreateRoleCard", {
8
+ en: {
9
+ title: "Role Details",
10
+ subTitle: "Roles aggregate permissions assigned to individual accounts."
11
+ }
12
+ }), d = a({ permissions: ["write.role.all"] }, () => {
13
+ const t = u(), o = c();
14
+ return /* @__PURE__ */ n(r, { children: [
15
+ /* @__PURE__ */ e(r.Header, { title: t("title"), subTitle: t("subTitle") }),
16
+ /* @__PURE__ */ e(r.Section, { children: /* @__PURE__ */ e(m, { onSuccess: (s) => o(`/manage/roles/${s.name}`) }) })
17
+ ] });
18
+ }), p = i("CreateRoleRoute", {
19
+ en: {
20
+ title: "Create Role"
21
+ }
22
+ });
23
+ function b() {
24
+ const t = p(), o = l(), { Page: s } = o.components;
25
+ return /* @__PURE__ */ e(s, { header: t("title"), children: /* @__PURE__ */ e(d, {}) });
26
+ }
27
+ export {
28
+ b as default
29
+ };
@@ -0,0 +1,3 @@
1
+ import { MenuItemComponentProps } from '@tiny-server/core';
2
+ export declare const AccountSettingsMenuItem: import('react').ComponentType<MenuItemComponentProps<"settings">>;
3
+ export default AccountSettingsMenuItem;
@@ -0,0 +1,3 @@
1
+ import { MenuItemComponentProps } from '@tiny-server/core';
2
+ export declare const ManageAccountsMenuItem: import('react').ComponentType<MenuItemComponentProps<"default">>;
3
+ export default ManageAccountsMenuItem;
@@ -0,0 +1,3 @@
1
+ import { MenuItemComponentProps } from '@tiny-server/core';
2
+ export declare const ManageRolesMenuItem: import('react').ComponentType<MenuItemComponentProps<"default">>;
3
+ export default ManageRolesMenuItem;
@@ -0,0 +1,6 @@
1
+ declare module '@tiny-server/core' {
2
+ interface MenuParamsMap {
3
+ settings: {};
4
+ }
5
+ }
6
+ export declare function createIdentityModule(): import('@tiny-server/core').Module;
@@ -0,0 +1,8 @@
1
+ import { c as e } from "./createLucideIcon-DJ4QdTU4.js";
2
+ const o = [
3
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
4
+ ["path", { d: "M12 5v14", key: "s699le" }]
5
+ ], c = e("plus", o);
6
+ export {
7
+ c as P
8
+ };
@@ -0,0 +1,155 @@
1
+ import { jsxs as s, Fragment as x, jsx as r } from "react/jsx-runtime";
2
+ import { Divider as S, Text as C, Anchor as R, Alert as L, TextInput as m, PasswordInput as u, Button as P } from "@mantine/core";
3
+ import { useForm as I } from "@mantine/form";
4
+ import { useSuspenseQuery as M, useMutation as V } from "@tanstack/react-query";
5
+ import { useNavigate as k, Link as A } from "react-router";
6
+ import { readStatusQuery as F } from "@tiny-server/core";
7
+ import { i as D, e as Y, d as E, u as T, I as U, c as v, m as q } from "./IdentityErrorDetails-CJDjlYx0.js";
8
+ import { Form as t } from "@tiny-server/design";
9
+ import { createAccountMutation as z } from "./index.js";
10
+ import { c as j } from "./createLucideIcon-DJ4QdTU4.js";
11
+ import { d as Q } from "./i18n-ZQHvKu9t.js";
12
+ const _ = [
13
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
14
+ ["path", { d: "M12 16v-4", key: "1dtifu" }],
15
+ ["path", { d: "M12 8h.01", key: "e9boi3" }]
16
+ ], B = j("info", _), $ = Q("RegisterForm", {
17
+ en: {
18
+ title: "Register a New Account",
19
+ selfRegistrationDisabled: {
20
+ title: "Self-Registration Disabled",
21
+ content: "Self-registration is disabled. Please contact an administrator to get an account."
22
+ },
23
+ errorMessage: "Account creation failed.",
24
+ userName: {
25
+ label: "Your username",
26
+ placeholder: "Username",
27
+ description: "The user name to be used for logging in."
28
+ },
29
+ password: {
30
+ label: "Your password",
31
+ placeholder: "Your password",
32
+ description: "The password that you want to use for logging in."
33
+ },
34
+ passwordConfirmation: {
35
+ label: "Repeat your password",
36
+ placeholder: "Your password",
37
+ description: "Repeat the password to ensure that you typed it correctly."
38
+ },
39
+ email: {
40
+ label: "Your e-mail address",
41
+ placeholder: "mail@example.com",
42
+ description: "Your e-mail address. Used for communication purposes."
43
+ },
44
+ register: "Register",
45
+ login: "Login",
46
+ loginLinkMsg: "Already have an account?"
47
+ }
48
+ });
49
+ function G() {
50
+ const e = $(), p = k(), {
51
+ data: {
52
+ data: { selfRegistrationEnabled: g }
53
+ }
54
+ } = M(F()), { mutate: f, error: l, isPending: i } = V(z()), h = D(), b = Y(), w = E(), y = T(), a = I({
55
+ initialValues: {
56
+ userName: "",
57
+ email: "",
58
+ password: "",
59
+ passwordConfirmation: ""
60
+ },
61
+ validate: {
62
+ userName: (o) => h(o),
63
+ password: (o) => b(o),
64
+ passwordConfirmation: (o, { password: n }) => w(o, n),
65
+ email: (o) => y(o)
66
+ }
67
+ }), d = (o) => {
68
+ const n = {
69
+ userName: o.userName.trim(),
70
+ email: o.email?.trim() || null,
71
+ password: o.password
72
+ };
73
+ f(n, {
74
+ onSuccess({ data: N }) {
75
+ p(`/auth/login?userName=${N.userName}&fromRegistration=true`);
76
+ }
77
+ });
78
+ }, c = /* @__PURE__ */ s(x, { children: [
79
+ /* @__PURE__ */ r(S, {}),
80
+ /* @__PURE__ */ s(C, { style: { alignSelf: "center" }, children: [
81
+ e("loginLinkMsg"),
82
+ " ",
83
+ /* @__PURE__ */ r(R, { component: A, to: "/auth/login", fw: 600, children: e("login") })
84
+ ] })
85
+ ] });
86
+ return g ? /* @__PURE__ */ r(t, { size: "xs", onSubmit: a.onSubmit(d), children: /* @__PURE__ */ s(t.Section, { children: [
87
+ /* @__PURE__ */ r("h2", { children: e("title") }),
88
+ l && /* @__PURE__ */ r(t.Alert, { kind: "error", title: e("errorMessage"), children: /* @__PURE__ */ r(U, { error: l }) }),
89
+ /* @__PURE__ */ r(
90
+ m,
91
+ {
92
+ id: "userName",
93
+ type: "text",
94
+ label: e("userName.label"),
95
+ placeholder: e("userName.placeholder"),
96
+ description: e("userName.description"),
97
+ disabled: i,
98
+ maxLength: v,
99
+ required: !0,
100
+ autoFocus: !0,
101
+ ...a.getInputProps("userName")
102
+ }
103
+ ),
104
+ /* @__PURE__ */ r(
105
+ u,
106
+ {
107
+ id: "password",
108
+ label: e("password.label"),
109
+ placeholder: e("password.placeholder"),
110
+ description: e("password.description"),
111
+ disabled: i,
112
+ required: !0,
113
+ ...a.getInputProps("password")
114
+ }
115
+ ),
116
+ /* @__PURE__ */ r(
117
+ u,
118
+ {
119
+ id: "passwordConfirmation",
120
+ label: e("passwordConfirmation.label"),
121
+ placeholder: e("passwordConfirmation.placeholder"),
122
+ description: e("passwordConfirmation.description"),
123
+ disabled: i,
124
+ required: !0,
125
+ ...a.getInputProps("passwordConfirmation")
126
+ }
127
+ ),
128
+ /* @__PURE__ */ r(
129
+ m,
130
+ {
131
+ id: "email",
132
+ type: "email",
133
+ label: e("email.label"),
134
+ placeholder: e("email.placeholder"),
135
+ description: e("email.description"),
136
+ disabled: i,
137
+ maxLength: q,
138
+ autoFocus: !0,
139
+ ...a.getInputProps("email")
140
+ }
141
+ ),
142
+ /* @__PURE__ */ r(P, { type: "submit", loading: i, disabled: i, children: e("register") }),
143
+ c
144
+ ] }) }) : /* @__PURE__ */ r(t, { size: "xs", onSubmit: a.onSubmit(d), children: /* @__PURE__ */ s(t.Section, { children: [
145
+ /* @__PURE__ */ r("h2", { children: e("title") }),
146
+ /* @__PURE__ */ r(L, { icon: /* @__PURE__ */ r(B, { size: "1em" }), title: e("selfRegistrationDisabled.title"), color: "blue", children: e("selfRegistrationDisabled.content") }),
147
+ c
148
+ ] }) });
149
+ }
150
+ function ae() {
151
+ return /* @__PURE__ */ r(G, {});
152
+ }
153
+ export {
154
+ ae as default
155
+ };
@@ -0,0 +1 @@
1
+ export default function Component(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Component(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Component(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Component(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Component(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Component(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Component(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Component(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Component(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { jsx as t, jsxs as s } from "react/jsx-runtime";
2
+ import { useApp as c, useSession as a } from "@tiny-server/core";
3
+ import { useSuspenseQuery as u } from "@tanstack/react-query";
4
+ import { Stack as d } from "@mantine/core";
5
+ import { readAccountQuery as i } from "./index.js";
6
+ import { M as m, C as p, D as f } from "./DeleteAccountForm-yrL29VdV.js";
7
+ import { d as l } from "./i18n-ZQHvKu9t.js";
8
+ const A = l("AccountSettingsRoute", {
9
+ en: {
10
+ title: "Account Settings"
11
+ }
12
+ });
13
+ function j() {
14
+ const n = A(), { Page: r } = c().components, { userId: e } = a(), {
15
+ data: { data: o }
16
+ } = u(i(e));
17
+ return /* @__PURE__ */ t(r, { header: n("title"), children: /* @__PURE__ */ s(d, { children: [
18
+ /* @__PURE__ */ t(m, { account: o, hideIdField: !0 }),
19
+ /* @__PURE__ */ t(p, { accountId: e }),
20
+ /* @__PURE__ */ t(f, { account: o })
21
+ ] }) });
22
+ }
23
+ export {
24
+ j as default
25
+ };
@@ -0,0 +1,21 @@
1
+ import { c as a } from "./createLucideIcon-DJ4QdTU4.js";
2
+ const e = [
3
+ ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
4
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
5
+ ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
6
+ ], h = a("trash", e);
7
+ const t = [
8
+ [
9
+ "path",
10
+ {
11
+ d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
12
+ key: "wmoenq"
13
+ }
14
+ ],
15
+ ["path", { d: "M12 9v4", key: "juzpu7" }],
16
+ ["path", { d: "M12 17h.01", key: "p32p05" }]
17
+ ], c = a("triangle-alert", t);
18
+ export {
19
+ h as T,
20
+ c as a
21
+ };
@@ -0,0 +1,18 @@
1
+ import { useForm as o } from "@mantine/form";
2
+ function l(a, i, t, r) {
3
+ const e = {}, s = a ? t(a) : i();
4
+ return {
5
+ ...o({
6
+ ...e,
7
+ ...s,
8
+ initialValues: {
9
+ ...e.initialValues,
10
+ ...s.initialValues
11
+ }
12
+ }),
13
+ kind: a ? "update" : "create"
14
+ };
15
+ }
16
+ export {
17
+ l as u
18
+ };
@@ -0,0 +1,8 @@
1
+ import { c } from "./createLucideIcon-DJ4QdTU4.js";
2
+ const e = [
3
+ ["path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2", key: "975kel" }],
4
+ ["circle", { cx: "12", cy: "7", r: "4", key: "17ys0d" }]
5
+ ], r = c("user", e);
6
+ export {
7
+ r as U
8
+ };