@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,5 @@
1
+ import { RoleRead } from '../../api';
2
+ export interface RoleHeaderProps {
3
+ role: RoleRead;
4
+ }
5
+ export declare function RoleHeader({ role }: RoleHeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { RoleRead } from '../../api';
2
+ export interface RoleOverviewCardProps {
3
+ role: RoleRead;
4
+ }
5
+ export declare const RoleOverviewCard: import('react').ComponentType<RoleOverviewCardProps>;
@@ -0,0 +1,5 @@
1
+ export * from './CreateRoleCard';
2
+ export * from './DeleteRoleCard';
3
+ export * from './ManageRoleCard';
4
+ export * from './RoleHeader';
5
+ export * from './RoleOverviewCard';
@@ -0,0 +1,9 @@
1
+ export declare const minUserNameLength = 3;
2
+ export declare const maxUserNameLength = 256;
3
+ export declare const minPasswordLength = 6;
4
+ export declare const maxEmailLength = 256;
5
+ export declare const minRoleNameLength = 3;
6
+ export declare const maxRoleNameLength = 256;
7
+ export declare const roleNamePattern: RegExp;
8
+ export declare const maxRoleDescriptionLength = 256;
9
+ export declare const allowedUsernameChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+";
@@ -0,0 +1,74 @@
1
+ import { useContext as b, createContext as L, forwardRef as C, createElement as i } from "react";
2
+ const h = (...e) => e.filter((t, o, r) => !!t && t.trim() !== "" && r.indexOf(t) === o).join(" ").trim();
3
+ const W = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
4
+ const S = (e) => e.replace(
5
+ /^([A-Z])|[\s-_]+(\w)/g,
6
+ (t, o, r) => r ? r.toUpperCase() : o.toLowerCase()
7
+ );
8
+ const d = (e) => {
9
+ const t = S(e);
10
+ return t.charAt(0).toUpperCase() + t.slice(1);
11
+ };
12
+ var c = {
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ width: 24,
15
+ height: 24,
16
+ viewBox: "0 0 24 24",
17
+ fill: "none",
18
+ stroke: "currentColor",
19
+ strokeWidth: 2,
20
+ strokeLinecap: "round",
21
+ strokeLinejoin: "round"
22
+ };
23
+ const v = (e) => {
24
+ for (const t in e)
25
+ if (t.startsWith("aria-") || t === "role" || t === "title")
26
+ return !0;
27
+ return !1;
28
+ }, y = L({}), $ = () => b(y), j = C(
29
+ ({ color: e, size: t, strokeWidth: o, absoluteStrokeWidth: r, className: a = "", children: s, iconNode: p, ...l }, m) => {
30
+ const {
31
+ size: n = 24,
32
+ strokeWidth: u = 2,
33
+ absoluteStrokeWidth: x = !1,
34
+ color: w = "currentColor",
35
+ className: f = ""
36
+ } = $() ?? {}, k = r ?? x ? Number(o ?? u) * 24 / Number(t ?? n) : o ?? u;
37
+ return i(
38
+ "svg",
39
+ {
40
+ ref: m,
41
+ ...c,
42
+ width: t ?? n ?? c.width,
43
+ height: t ?? n ?? c.height,
44
+ stroke: e ?? w,
45
+ strokeWidth: k,
46
+ className: h("lucide", f, a),
47
+ ...!s && !v(l) && { "aria-hidden": "true" },
48
+ ...l
49
+ },
50
+ [
51
+ ...p.map(([g, A]) => i(g, A)),
52
+ ...Array.isArray(s) ? s : [s]
53
+ ]
54
+ );
55
+ }
56
+ );
57
+ const I = (e, t) => {
58
+ const o = C(
59
+ ({ className: r, ...a }, s) => i(j, {
60
+ ref: s,
61
+ iconNode: t,
62
+ className: h(
63
+ `lucide-${W(d(e))}`,
64
+ `lucide-${e}`,
65
+ r
66
+ ),
67
+ ...a
68
+ })
69
+ );
70
+ return o.displayName = d(e), o;
71
+ };
72
+ export {
73
+ I as c
74
+ };
@@ -0,0 +1,10 @@
1
+ import { AccountRead } from './api';
2
+ export interface ManageAccountExtensionParams {
3
+ account: AccountRead;
4
+ }
5
+ declare module '@tiny-server/core' {
6
+ interface ExtensionParamsMap {
7
+ 'manage-account-tab': ManageAccountExtensionParams;
8
+ 'manage-account-tab-panel': ManageAccountExtensionParams;
9
+ }
10
+ }
@@ -0,0 +1,22 @@
1
+ import { AccountRead } from '../api';
2
+ export interface AccountFormProps {
3
+ /**
4
+ * An existing account to edit. If undefined, the form is in create mode.
5
+ */
6
+ account?: AccountRead;
7
+ /**
8
+ * Whether the user name field should be hidden.
9
+ * @default false
10
+ */
11
+ hideIdField?: boolean;
12
+ /**
13
+ * Whether the ID field should be hidden.
14
+ * @default false
15
+ */
16
+ hideUserNameField?: boolean;
17
+ /**
18
+ * Called after a successful create or update mutation.
19
+ */
20
+ onSuccess?(account: AccountRead): void;
21
+ }
22
+ export declare function AccountForm({ account, hideIdField, hideUserNameField, onSuccess }: AccountFormProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ export interface AccountRolesFormProps {
2
+ /**
3
+ * The ID of the account whose roles are being managed.
4
+ */
5
+ accountId: string;
6
+ /**
7
+ * Called after successful role update.
8
+ */
9
+ onSuccess?(roles: Array<string>): void;
10
+ }
11
+ export declare function AccountRolesForm({ accountId, onSuccess }: AccountRolesFormProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ export interface ChangePasswordFormProps {
2
+ /**
3
+ * The ID of the account whose password should be changed.
4
+ */
5
+ accountId: string;
6
+ /**
7
+ * If true, requires entering the current password before setting a new one.
8
+ */
9
+ showCurrentPassword: boolean;
10
+ /**
11
+ * Called after a successful password update.
12
+ */
13
+ onSuccess?(): void;
14
+ }
15
+ export declare function ChangePasswordForm({ accountId, showCurrentPassword, onSuccess }: ChangePasswordFormProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { AccountRead } from '../api';
2
+ export interface DeleteAccountFormProps {
3
+ account: AccountRead;
4
+ onSuccess?(): void;
5
+ }
6
+ export declare function DeleteAccountForm({ account, onSuccess }: DeleteAccountFormProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { RoleRead } from '../api';
2
+ export interface DeleteRoleFormProps {
3
+ role: RoleRead;
4
+ onSuccess?(): void;
5
+ }
6
+ export declare function DeleteRoleForm({ role, onSuccess }: DeleteRoleFormProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function LoginForm(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function RegisterForm(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { RoleRead } from '../api';
2
+ export interface RoleFormProps {
3
+ /**
4
+ * A {@link RoleRead} object to be edited.
5
+ * Use `undefined` to create new roles.
6
+ */
7
+ role?: RoleRead;
8
+ /**
9
+ * Called when the form has been successfully submitted.
10
+ */
11
+ onSuccess?(role: RoleRead): void;
12
+ }
13
+ export declare function RoleForm({ role, onSuccess }: RoleFormProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ export * from './AccountForm';
2
+ export * from './AccountRolesForm';
3
+ export * from './ChangePasswordForm';
4
+ export * from './DeleteAccountForm';
5
+ export * from './DeleteRoleForm';
6
+ export * from './LoginForm';
7
+ export * from './RegisterForm';
8
+ export * from './RoleForm';
@@ -0,0 +1,5 @@
1
+ import { defineLocales as r } from "@tiny-server/core";
2
+ const i = (e, o) => r(`@tiny-server/identity/${e}`, o);
3
+ export {
4
+ i as d
5
+ };
@@ -0,0 +1,3 @@
1
+ export * from './api';
2
+ export * from './declarations';
3
+ export * from './module';
package/dist/index.js ADDED
@@ -0,0 +1,267 @@
1
+ import { appFetch as o, readSessionStateQuery as l, createModule as d, requireAnonymous as m, requireSession as c } from "@tiny-server/core";
2
+ import { lazy as r } from "react";
3
+ import { queryOptions as s, mutationOptions as i } from "@tanstack/react-query";
4
+ function p(e) {
5
+ return o({ url: "/api/v1/accounts", params: e });
6
+ }
7
+ function y(e) {
8
+ return o({ url: `/api/v1/accounts/${e}` });
9
+ }
10
+ function _(e) {
11
+ return o({ url: "/api/v1/accounts", method: "POST", body: e });
12
+ }
13
+ function f(e, t) {
14
+ return o({ url: `/api/v1/accounts/${e}`, method: "PUT", body: t });
15
+ }
16
+ function v(e) {
17
+ return o({ url: `/api/v1/accounts/${e}`, method: "DELETE" });
18
+ }
19
+ function q(e) {
20
+ return o({ url: `/api/v1/accounts/${e}/roles` });
21
+ }
22
+ function h(e, t) {
23
+ return o({ url: `/api/v1/accounts/${e}/roles`, method: "PUT", body: t });
24
+ }
25
+ function K(e, t) {
26
+ return o({ url: `/api/v1/accounts/${e}/password`, method: "PUT", body: t });
27
+ }
28
+ function C(e) {
29
+ return s({
30
+ queryKey: ["accounts", e],
31
+ queryFn: () => p(e)
32
+ });
33
+ }
34
+ function $(e) {
35
+ return s({
36
+ queryKey: ["accounts", e],
37
+ queryFn: () => y(e)
38
+ });
39
+ }
40
+ function b(e) {
41
+ return s({
42
+ queryKey: ["accounts", e, "roles"],
43
+ queryFn: () => q(e)
44
+ });
45
+ }
46
+ function E() {
47
+ return i({
48
+ mutationFn: (e) => _(e),
49
+ onSuccess(e, t, a, n) {
50
+ n.client.invalidateQueries({ queryKey: ["accounts"] });
51
+ }
52
+ });
53
+ }
54
+ function O(e) {
55
+ return i({
56
+ mutationFn: (t) => f(e, t),
57
+ onSuccess(t, a, n, u) {
58
+ u.client.invalidateQueries({ queryKey: ["accounts", e] }), u.client.invalidateQueries({ queryKey: ["accounts"] });
59
+ }
60
+ });
61
+ }
62
+ function U() {
63
+ return i({
64
+ mutationFn: (e) => v(e),
65
+ onSuccess(e, t, a, n) {
66
+ n.client.invalidateQueries({ queryKey: ["accounts"] });
67
+ }
68
+ });
69
+ }
70
+ function D(e) {
71
+ return i({
72
+ mutationFn: (t) => h(e, t),
73
+ onSuccess(t, a, n, u) {
74
+ u.client.invalidateQueries({ queryKey: ["accounts", e, "roles"] });
75
+ }
76
+ });
77
+ }
78
+ function I(e) {
79
+ return i({
80
+ mutationFn: (t) => K(e, t),
81
+ onSuccess(t, a, n, u) {
82
+ u.client.invalidateQueries({ queryKey: ["accounts", e] }), u.client.invalidateQueries({ queryKey: ["accounts"] });
83
+ }
84
+ });
85
+ }
86
+ function Q(e) {
87
+ return o({ url: "/api/v1/auth/login", method: "POST", body: e });
88
+ }
89
+ function g() {
90
+ return o({ url: "/api/v1/auth/logout", method: "POST" });
91
+ }
92
+ function L() {
93
+ return i({
94
+ mutationFn: (e) => Q(e),
95
+ onSuccess(e, t, a, n) {
96
+ n.client.invalidateQueries({ queryKey: ["session"] });
97
+ }
98
+ });
99
+ }
100
+ function z() {
101
+ return i({
102
+ mutationFn: () => g(),
103
+ onSuccess(e, t, a, n) {
104
+ n.client.removeQueries({
105
+ predicate: (u) => u.queryKey[0] !== l().queryKey[0]
106
+ }), n.client.setQueryData(l().queryKey, {
107
+ hasSession: !1,
108
+ session: void 0
109
+ }), location.reload();
110
+ }
111
+ });
112
+ }
113
+ function S(e) {
114
+ return o({ url: "/api/v1/roles", params: e });
115
+ }
116
+ function A(e) {
117
+ return o({ url: `/api/v1/roles/${e}` });
118
+ }
119
+ function F(e) {
120
+ return o({ url: "/api/v1/roles", method: "POST", body: e });
121
+ }
122
+ function w(e, t) {
123
+ return o({ url: `/api/v1/roles/${e}`, method: "PUT", body: t });
124
+ }
125
+ function R(e) {
126
+ return o({ url: `/api/v1/roles/${e}`, method: "DELETE" });
127
+ }
128
+ function j(e) {
129
+ return s({
130
+ queryKey: ["roles", e],
131
+ queryFn: () => S(e)
132
+ });
133
+ }
134
+ function k(e) {
135
+ return s({
136
+ queryKey: ["roles", e],
137
+ queryFn: () => A(e)
138
+ });
139
+ }
140
+ function B() {
141
+ return i({
142
+ mutationFn: (e) => F(e),
143
+ onSuccess(e, t, a, n) {
144
+ n.client.invalidateQueries({ queryKey: ["roles"] });
145
+ }
146
+ });
147
+ }
148
+ function G(e) {
149
+ return i({
150
+ mutationFn: (t) => w(e, t),
151
+ onSuccess(t, a, n, u) {
152
+ u.client.invalidateQueries({ queryKey: ["roles", e] }), u.client.invalidateQueries({ queryKey: ["roles"] });
153
+ }
154
+ });
155
+ }
156
+ function H() {
157
+ return i({
158
+ mutationFn: (e) => R(e),
159
+ onSuccess(e, t, a, n) {
160
+ n.client.invalidateQueries({ queryKey: ["roles"] });
161
+ }
162
+ });
163
+ }
164
+ function J() {
165
+ return d({
166
+ routes: [
167
+ {
168
+ middleware: [m()],
169
+ children: [
170
+ {
171
+ path: "/auth/login",
172
+ Component: r(() => import("./login-DP7FSO-S.js"))
173
+ },
174
+ {
175
+ path: "/auth/register",
176
+ Component: r(() => import("./register-C4hB44_D.js"))
177
+ }
178
+ ]
179
+ },
180
+ {
181
+ middleware: [c({ permissions: ["read.account.own"] })],
182
+ path: "/settings/account",
183
+ Component: r(() => import("./settings.account-DITieOTt.js"))
184
+ },
185
+ {
186
+ middleware: [c({ permissions: ["read.account.all"] })],
187
+ path: "/manage/accounts",
188
+ Component: r(() => import("./manage.accounts-D8nzi0BV.js"))
189
+ },
190
+ {
191
+ middleware: [c({ permissions: ["read.account.all"] })],
192
+ path: "/manage/accounts/:id",
193
+ Component: r(() => import("./manage.accounts._id-CTAIEe0D.js"))
194
+ },
195
+ {
196
+ middleware: [c({ permissions: ["write.account.all"] })],
197
+ path: "/manage/accounts/create",
198
+ Component: r(() => import("./manage.accounts.create-CJHdTi4B.js"))
199
+ },
200
+ {
201
+ middleware: [c({ permissions: ["read.role.all"] })],
202
+ path: "/manage/roles",
203
+ Component: r(() => import("./manage.roles-B_WYX8EH.js"))
204
+ },
205
+ {
206
+ middleware: [c({ permissions: ["read.role.all"] })],
207
+ path: "/manage/roles/:id",
208
+ Component: r(() => import("./manage.roles._id-CRO5xYLO.js"))
209
+ },
210
+ {
211
+ middleware: [c({ permissions: ["write.role.all"] })],
212
+ path: "/manage/roles/create",
213
+ Component: r(() => import("./manage.roles.create-DDNPLNCK.js"))
214
+ }
215
+ ],
216
+ menuItems: [
217
+ {
218
+ id: "identity-account-settings",
219
+ menu: "settings",
220
+ component: r(() => import("./AccountSettingsMenuItem-BKBN0OZp.js"))
221
+ },
222
+ {
223
+ id: "identity-manage-accounts",
224
+ menu: "default",
225
+ component: r(() => import("./ManageAccountsMenuItem-BgTTH5S8.js"))
226
+ },
227
+ {
228
+ id: "identity-manage-roles",
229
+ menu: "default",
230
+ component: r(() => import("./ManageRolesMenuItem-DxMd-3i9.js"))
231
+ }
232
+ ]
233
+ });
234
+ }
235
+ export {
236
+ _ as createAccount,
237
+ E as createAccountMutation,
238
+ J as createIdentityModule,
239
+ F as createRole,
240
+ B as createRoleMutation,
241
+ v as deleteAccount,
242
+ U as deleteAccountMutation,
243
+ R as deleteRole,
244
+ H as deleteRoleMutation,
245
+ Q as login,
246
+ L as loginMutation,
247
+ g as logout,
248
+ z as logoutMutation,
249
+ y as readAccount,
250
+ $ as readAccountQuery,
251
+ q as readAccountRoles,
252
+ b as readAccountRolesQuery,
253
+ p as readAccounts,
254
+ C as readAccountsQuery,
255
+ A as readRole,
256
+ k as readRoleQuery,
257
+ S as readRoles,
258
+ j as readRolesQuery,
259
+ f as updateAccount,
260
+ O as updateAccountMutation,
261
+ K as updateAccountPassword,
262
+ I as updateAccountPasswordMutation,
263
+ h as updateAccountRoles,
264
+ D as updateAccountRolesMutation,
265
+ w as updateRole,
266
+ G as updateRoleMutation
267
+ };
@@ -0,0 +1,9 @@
1
+ import { c } from "./createLucideIcon-DJ4QdTU4.js";
2
+ const e = [
3
+ ["path", { d: "m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4", key: "g0fldk" }],
4
+ ["path", { d: "m21 2-9.6 9.6", key: "1j0ho8" }],
5
+ ["circle", { cx: "7.5", cy: "15.5", r: "5.5", key: "yqb3hr" }]
6
+ ], a = c("key", e);
7
+ export {
8
+ a as K
9
+ };
@@ -0,0 +1,108 @@
1
+ import { jsx as r, jsxs as d, Fragment as f } from "react/jsx-runtime";
2
+ import { useForm as w } from "@mantine/form";
3
+ import { useSuspenseQuery as b, useMutation as y } from "@tanstack/react-query";
4
+ import { TextInput as N, PasswordInput as L, Button as F, Divider as x, Text as S, Anchor as M } from "@mantine/core";
5
+ import { f as I, I as P, c as v } from "./IdentityErrorDetails-CJDjlYx0.js";
6
+ import { useNavigate as R, useSearchParams as Y, Link as k } from "react-router";
7
+ import { Form as a } from "@tiny-server/design";
8
+ import { readStatusQuery as C } from "@tiny-server/core";
9
+ import { loginMutation as E } from "./index.js";
10
+ import { d as T } from "./i18n-ZQHvKu9t.js";
11
+ const q = T("LoginForm", {
12
+ en: {
13
+ title: "Login",
14
+ errorMessage: "Logging in failed.",
15
+ loginFailed: "You could not be logged in. Please verify that you are using the correct e-mail address and password and then try again.",
16
+ accountCreated: {
17
+ title: "Account Created",
18
+ content: "Your account has been created. You can now login."
19
+ },
20
+ userName: {
21
+ label: "Your username",
22
+ placeholder: "Username",
23
+ description: "The user name that you used when creating your account."
24
+ },
25
+ password: {
26
+ label: "Your password",
27
+ placeholder: "Your password",
28
+ description: "The password of your account."
29
+ },
30
+ login: "Login",
31
+ registerLinkMsg: "Don't have an account yet?",
32
+ register: "Register"
33
+ }
34
+ });
35
+ function A() {
36
+ const e = q(), {
37
+ data: {
38
+ data: { selfRegistrationEnabled: c }
39
+ }
40
+ } = b(C()), { mutate: m, isPending: s, error: n } = y(E()), u = I(), p = R(), [l] = Y(), i = l.get("userName") ?? "", g = l.get("fromRegistration") === "true", t = w({
41
+ initialValues: {
42
+ userName: i,
43
+ password: "",
44
+ stayLoggedIn: !0
45
+ },
46
+ validate: {
47
+ userName: (o) => u(o),
48
+ password: (o) => u(o)
49
+ }
50
+ }), h = async (o) => {
51
+ m(o, {
52
+ onSuccess() {
53
+ p("/");
54
+ },
55
+ onError() {
56
+ t.reset(), t.setFieldError("userName", !0), t.setFieldError("password", !0);
57
+ }
58
+ });
59
+ };
60
+ return /* @__PURE__ */ r(a, { size: "xs", onSubmit: t.onSubmit(h), children: /* @__PURE__ */ d(a.Section, { children: [
61
+ /* @__PURE__ */ r("h2", { children: e("title") }),
62
+ g && !n && /* @__PURE__ */ r(a.Alert, { kind: "success", title: e("accountCreated.title"), children: e("accountCreated.content") }),
63
+ n && /* @__PURE__ */ r(a.Alert, { kind: "error", title: e("errorMessage"), children: /* @__PURE__ */ r(P, { error: n, defaultMessage: e("loginFailed") }) }),
64
+ /* @__PURE__ */ r(
65
+ N,
66
+ {
67
+ id: "userName",
68
+ type: "text",
69
+ label: e("userName.label"),
70
+ placeholder: e("userName.placeholder"),
71
+ description: e("userName.description"),
72
+ disabled: s,
73
+ maxLength: v,
74
+ autoFocus: !i,
75
+ required: !0,
76
+ ...t.getInputProps("userName")
77
+ }
78
+ ),
79
+ /* @__PURE__ */ r(
80
+ L,
81
+ {
82
+ id: "password",
83
+ label: e("password.label"),
84
+ placeholder: e("password.placeholder"),
85
+ description: e("password.description"),
86
+ disabled: s,
87
+ autoFocus: !!i,
88
+ required: !0,
89
+ ...t.getInputProps("password")
90
+ }
91
+ ),
92
+ /* @__PURE__ */ r(F, { type: "submit", loading: s, disabled: s, children: e("login") }),
93
+ c && /* @__PURE__ */ d(f, { children: [
94
+ /* @__PURE__ */ r(x, {}),
95
+ /* @__PURE__ */ d(S, { style: { alignSelf: "center" }, children: [
96
+ e("registerLinkMsg"),
97
+ " ",
98
+ /* @__PURE__ */ r(M, { component: k, to: "/auth/register", fw: 600, children: e("register") })
99
+ ] })
100
+ ] })
101
+ ] }) });
102
+ }
103
+ function K() {
104
+ return /* @__PURE__ */ r(A, {});
105
+ }
106
+ export {
107
+ K as default
108
+ };
@@ -0,0 +1,60 @@
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
+ import { withPermissions as y, WithPermissions as d, useApp as A, usePagination as P } from "@tiny-server/core";
3
+ import { Stack as u, Badge as b, Pagination as L, Button as x, ActionIcon as v } from "@mantine/core";
4
+ import { useQuery as z, useSuspenseQuery as C } from "@tanstack/react-query";
5
+ import { Link as c } from "react-router";
6
+ import { readAccountRolesQuery as S, readAccountsQuery as k } from "./index.js";
7
+ import { A as w } from "./AccountHeader-B4SMzQeC.js";
8
+ import { SectionCard as s, LabeledInfo as l, BadgeGroup as Q } from "@tiny-server/design";
9
+ import { c as R } from "./createLucideIcon-DJ4QdTU4.js";
10
+ import { K as B } from "./key-CmPc9vYA.js";
11
+ import { d as p } from "./i18n-ZQHvKu9t.js";
12
+ import { P as m } from "./plus-Bhxt0T43.js";
13
+ const I = [
14
+ ["path", { d: "m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7", key: "132q7q" }],
15
+ ["rect", { x: "2", y: "4", width: "20", height: "16", rx: "2", key: "izxlao" }]
16
+ ], M = R("mail", I), j = p("AccountCard", {
17
+ en: {
18
+ emailLabel: "E-mail address",
19
+ rolesLabel: "Roles"
20
+ }
21
+ }), q = y(
22
+ { permissions: ["read.account.all"] },
23
+ ({ account: o }) => {
24
+ const a = j(), { data: t } = z(S(o.id));
25
+ return /* @__PURE__ */ i(s, { children: [
26
+ /* @__PURE__ */ e(w, { account: o }),
27
+ /* @__PURE__ */ e(s.Section, { children: /* @__PURE__ */ i(u, { gap: "sm", children: [
28
+ /* @__PURE__ */ e(l, { variant: "inline", icon: /* @__PURE__ */ e(M, { size: "1em" }), label: a("emailLabel"), children: o.email }),
29
+ /* @__PURE__ */ e(d, { permissions: ["read.account.roles.all"], children: /* @__PURE__ */ e(l, { variant: "inline", icon: /* @__PURE__ */ e(B, { size: "1em" }), label: a("rolesLabel"), children: /* @__PURE__ */ e(Q, { max: 5, children: t?.data.map((n) => /* @__PURE__ */ e(b, { variant: "light", color: "gray", children: n }, n)) }) }) })
30
+ ] }) })
31
+ ] });
32
+ }
33
+ ), F = p("ManageAccountsPage", {
34
+ en: {
35
+ title: "Accounts",
36
+ create: "Create account"
37
+ }
38
+ });
39
+ function U() {
40
+ const o = F(), { Page: a } = A().components, { page: t, pageSize: n, setPage: h } = P(), {
41
+ data: { data: g, totalPages: f }
42
+ } = C(k({ page: t, pageSize: n }));
43
+ return /* @__PURE__ */ e(
44
+ a,
45
+ {
46
+ header: o("title"),
47
+ actions: /* @__PURE__ */ i(d, { permissions: ["write.account.all"], children: [
48
+ /* @__PURE__ */ e(x, { visibleFrom: "md", component: c, to: "/manage/accounts/create", leftSection: /* @__PURE__ */ e(m, { size: "1em" }), children: o("create") }),
49
+ /* @__PURE__ */ e(v, { hiddenFrom: "md", component: c, to: "/manage/accounts/create", "aria-label": o("create"), children: /* @__PURE__ */ e(m, { size: "1em" }) })
50
+ ] }),
51
+ children: /* @__PURE__ */ i(u, { children: [
52
+ g.map((r) => /* @__PURE__ */ e(c, { to: `/manage/accounts/${r.id}`, style: { textDecoration: "none" }, children: /* @__PURE__ */ e(q, { account: r }) }, r.id)),
53
+ /* @__PURE__ */ e(L, { value: t, total: f, onChange: h })
54
+ ] })
55
+ }
56
+ );
57
+ }
58
+ export {
59
+ U as default
60
+ };