@acmekit/dashboard 2.13.6 → 2.13.8

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 (64) hide show
  1. package/dist/api-key-management-create-D57V3NN2.mjs +170 -0
  2. package/dist/api-key-management-detail-QURSBB6T.mjs +307 -0
  3. package/dist/api-key-management-edit-GG5V77GY.mjs +106 -0
  4. package/dist/api-key-management-list-PL64LD22.mjs +400 -0
  5. package/dist/app.js +16930 -1004
  6. package/dist/app.mjs +793 -884
  7. package/dist/chunk-22YYMH6M.mjs +382 -0
  8. package/dist/chunk-2U3RK3JG.mjs +474 -0
  9. package/dist/chunk-535OVBXR.mjs +226 -0
  10. package/dist/chunk-6SQCO25J.mjs +65 -0
  11. package/dist/chunk-774WSTCC.mjs +19 -0
  12. package/dist/chunk-7ZHDHEUH.mjs +1837 -0
  13. package/dist/chunk-C76H5USB.mjs +16 -0
  14. package/dist/chunk-DFFLVEZ5.mjs +40 -0
  15. package/dist/chunk-DN3MIYQH.mjs +140 -0
  16. package/dist/chunk-DQCEH3X2.mjs +28 -0
  17. package/dist/chunk-DTY37DDZ.mjs +20 -0
  18. package/dist/chunk-FXYH54JP.mjs +16 -0
  19. package/dist/chunk-G22WWLPG.mjs +44 -0
  20. package/dist/chunk-G2VJOHHV.mjs +32 -0
  21. package/dist/chunk-GBFVWROS.mjs +58 -0
  22. package/dist/chunk-ITNQKZQQ.mjs +142 -0
  23. package/dist/chunk-IUCDCPJU.mjs +0 -0
  24. package/dist/chunk-LKWTBYYC.mjs +35 -0
  25. package/dist/{chunk-4VYJHIB3.mjs → chunk-ND3ODI36.mjs} +0 -72
  26. package/dist/chunk-OAHCJFG3.mjs +17 -0
  27. package/dist/chunk-OHAFITSB.mjs +54 -0
  28. package/dist/chunk-RPAL6FHW.mjs +73 -0
  29. package/dist/{chunk-JSJZMTQG.mjs → chunk-RREPQMYC.mjs} +14 -41
  30. package/dist/chunk-S3REQHPQ.mjs +86 -0
  31. package/dist/chunk-S4DMV3ZT.mjs +35 -0
  32. package/dist/chunk-TCNCAWYD.mjs +9 -0
  33. package/dist/chunk-ULSPL3DR.mjs +126 -0
  34. package/dist/chunk-VBT5YZ4K.mjs +129 -0
  35. package/dist/chunk-WILMJYUB.mjs +35 -0
  36. package/dist/chunk-XIM7X4FB.mjs +83 -0
  37. package/dist/chunk-YB52HEIR.mjs +387 -0
  38. package/dist/chunk-YRWSG3YM.mjs +80 -0
  39. package/dist/{invite-S5USGDOZ.mjs → invite-BAFXQBLJ.mjs} +15 -7
  40. package/dist/{login-BRUR5XXN.mjs → login-YURMNRCS.mjs} +23 -9
  41. package/dist/profile-detail-SJWODS2K.mjs +96 -0
  42. package/dist/profile-edit-HSGF4UXZ.mjs +173 -0
  43. package/dist/{reset-password-UQPRHMB3.mjs → reset-password-RQ5M7HQC.mjs} +8 -4
  44. package/dist/settings-3XWLL5LG.mjs +545 -0
  45. package/dist/store-detail-SQKV5KBD.mjs +109 -0
  46. package/dist/store-edit-WGGIJMYJ.mjs +97 -0
  47. package/dist/store-metadata-CSBUGX6Z.mjs +49 -0
  48. package/dist/translation-list-H5X4DVCC.mjs +587 -0
  49. package/dist/translations-edit-NPAUN2GZ.mjs +5376 -0
  50. package/dist/user-detail-7SUQ35G7.mjs +169 -0
  51. package/dist/user-edit-KUZV37AH.mjs +114 -0
  52. package/dist/user-invite-OREFWWYL.mjs +361 -0
  53. package/dist/user-list-OWUR75OP.mjs +1116 -0
  54. package/dist/user-metadata-QHUX5SHZ.mjs +51 -0
  55. package/dist/workflow-execution-detail-MWNM25TF.mjs +820 -0
  56. package/dist/workflow-execution-list-IGYF44UH.mjs +175 -0
  57. package/package.json +9 -9
  58. package/src/components/layout/settings-layout/settings-layout.tsx +74 -6
  59. package/src/dashboard-app/routes/get-route.map.tsx +225 -0
  60. package/src/routes/login/login.tsx +1 -1
  61. package/dist/chunk-FBTP4AJM.mjs +0 -221
  62. package/dist/chunk-NQEMGMWU.mjs +0 -159
  63. package/dist/chunk-QYOO4QR6.mjs +0 -73
  64. package/dist/login-AIMR26AL.mjs +0 -291
@@ -0,0 +1,169 @@
1
+ import {
2
+ SingleColumnPage
3
+ } from "./chunk-22YYMH6M.mjs";
4
+ import {
5
+ useExtension
6
+ } from "./chunk-C5P5PL3E.mjs";
7
+ import {
8
+ useDeleteUser,
9
+ useUser,
10
+ usersQueryKeys
11
+ } from "./chunk-YRWSG3YM.mjs";
12
+ import {
13
+ SingleColumnPageSkeleton
14
+ } from "./chunk-ITNQKZQQ.mjs";
15
+ import {
16
+ ActionMenu
17
+ } from "./chunk-S3REQHPQ.mjs";
18
+ import "./chunk-OAHCJFG3.mjs";
19
+ import "./chunk-S4DMV3ZT.mjs";
20
+ import {
21
+ queryClient
22
+ } from "./chunk-FXYH54JP.mjs";
23
+ import "./chunk-774WSTCC.mjs";
24
+ import {
25
+ sdk
26
+ } from "./chunk-DTY37DDZ.mjs";
27
+ import "./chunk-QZ7TP4HQ.mjs";
28
+
29
+ // src/routes/users/user-detail/breadcrumb.tsx
30
+ import { jsx } from "react/jsx-runtime";
31
+ var UserDetailBreadcrumb = (props) => {
32
+ const { id } = props.params || {};
33
+ const { user } = useUser(id, void 0, {
34
+ initialData: props.data,
35
+ enabled: Boolean(id)
36
+ });
37
+ if (!user) {
38
+ return null;
39
+ }
40
+ const name = [user.first_name, user.last_name].filter(Boolean).join(" ");
41
+ const display = name || user.email;
42
+ return /* @__PURE__ */ jsx("span", { children: display });
43
+ };
44
+
45
+ // src/routes/users/user-detail/loader.ts
46
+ var userDetailQuery = (id) => ({
47
+ queryKey: usersQueryKeys.detail(id),
48
+ queryFn: async () => sdk.admin.user.retrieve(id)
49
+ });
50
+ var userLoader = async ({ params }) => {
51
+ const id = params.id;
52
+ const query = userDetailQuery(id);
53
+ return queryClient.ensureQueryData(query);
54
+ };
55
+
56
+ // src/routes/users/user-detail/user-detail.tsx
57
+ import { useLoaderData, useParams } from "react-router-dom";
58
+
59
+ // src/routes/users/user-detail/components/user-general-section/user-general-section.tsx
60
+ import { PencilSquare, Trash } from "@acmekit/icons";
61
+ import { Container, Heading, Text, toast, usePrompt } from "@acmekit/ui";
62
+ import { useTranslation } from "react-i18next";
63
+ import { useNavigate } from "react-router-dom";
64
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
65
+ var UserGeneralSection = ({ user }) => {
66
+ const { t } = useTranslation();
67
+ const navigate = useNavigate();
68
+ const prompt = usePrompt();
69
+ const { mutateAsync } = useDeleteUser(user.id);
70
+ const name = [user.first_name, user.last_name].filter(Boolean).join(" ");
71
+ const handleDeleteUser = async () => {
72
+ const res = await prompt({
73
+ title: t("general.areYouSure"),
74
+ description: t("users.deleteUserWarning", {
75
+ name: name ?? user.email
76
+ }),
77
+ verificationText: name ?? user.email,
78
+ verificationInstruction: t("general.typeToConfirm"),
79
+ confirmText: t("actions.delete"),
80
+ cancelText: t("actions.cancel")
81
+ });
82
+ if (!res) {
83
+ return;
84
+ }
85
+ await mutateAsync(void 0, {
86
+ onSuccess: () => {
87
+ toast.success(t("users.deleteUserSuccess", { name: user.email }));
88
+ navigate("..");
89
+ },
90
+ onError: (error) => {
91
+ toast.error(error.message);
92
+ }
93
+ });
94
+ };
95
+ return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0", children: [
96
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
97
+ /* @__PURE__ */ jsx2(Heading, { children: user.email }),
98
+ /* @__PURE__ */ jsx2(
99
+ ActionMenu,
100
+ {
101
+ groups: [
102
+ {
103
+ actions: [
104
+ {
105
+ label: t("actions.edit"),
106
+ to: "edit",
107
+ icon: /* @__PURE__ */ jsx2(PencilSquare, {})
108
+ }
109
+ ]
110
+ },
111
+ {
112
+ actions: [
113
+ {
114
+ label: t("actions.delete"),
115
+ onClick: handleDeleteUser,
116
+ icon: /* @__PURE__ */ jsx2(Trash, {})
117
+ }
118
+ ]
119
+ }
120
+ ]
121
+ }
122
+ )
123
+ ] }),
124
+ /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4", children: [
125
+ /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", weight: "plus", children: t("fields.name") }),
126
+ /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", children: name ?? "-" })
127
+ ] })
128
+ ] });
129
+ };
130
+
131
+ // src/routes/users/user-detail/user-detail.tsx
132
+ import { jsx as jsx3 } from "react/jsx-runtime";
133
+ var UserDetail = () => {
134
+ const initialData = useLoaderData();
135
+ const { id } = useParams();
136
+ const {
137
+ user,
138
+ isPending: isLoading,
139
+ isError,
140
+ error
141
+ } = useUser(id, void 0, {
142
+ initialData
143
+ });
144
+ const { getWidgets } = useExtension();
145
+ if (isLoading || !user) {
146
+ return /* @__PURE__ */ jsx3(SingleColumnPageSkeleton, { sections: 1, showJSON: true, showMetadata: true });
147
+ }
148
+ if (isError) {
149
+ throw error;
150
+ }
151
+ return /* @__PURE__ */ jsx3(
152
+ SingleColumnPage,
153
+ {
154
+ data: user,
155
+ showJSON: true,
156
+ showMetadata: true,
157
+ widgets: {
158
+ after: getWidgets("user.details.after"),
159
+ before: getWidgets("user.details.before")
160
+ },
161
+ children: /* @__PURE__ */ jsx3(UserGeneralSection, { user })
162
+ }
163
+ );
164
+ };
165
+ export {
166
+ UserDetailBreadcrumb as Breadcrumb,
167
+ UserDetail as Component,
168
+ userLoader as loader
169
+ };
@@ -0,0 +1,114 @@
1
+ import "./chunk-IUCDCPJU.mjs";
2
+ import {
3
+ useUpdateUser,
4
+ useUser
5
+ } from "./chunk-YRWSG3YM.mjs";
6
+ import {
7
+ KeyboundForm,
8
+ RouteDrawer,
9
+ useRouteModal
10
+ } from "./chunk-2U3RK3JG.mjs";
11
+ import {
12
+ Form
13
+ } from "./chunk-ND3ODI36.mjs";
14
+ import "./chunk-FXYH54JP.mjs";
15
+ import "./chunk-774WSTCC.mjs";
16
+ import "./chunk-DTY37DDZ.mjs";
17
+ import "./chunk-QZ7TP4HQ.mjs";
18
+
19
+ // src/routes/users/user-edit/user-edit.tsx
20
+ import { Heading } from "@acmekit/ui";
21
+ import { useTranslation as useTranslation2 } from "react-i18next";
22
+ import { useParams } from "react-router-dom";
23
+
24
+ // src/routes/users/user-edit/components/edit-user-form/edit-user-form.tsx
25
+ import { zodResolver } from "@hookform/resolvers/zod";
26
+ import { Button, Input } from "@acmekit/ui";
27
+ import { useForm } from "react-hook-form";
28
+ import { useTranslation } from "react-i18next";
29
+ import * as zod from "zod";
30
+ import { jsx, jsxs } from "react/jsx-runtime";
31
+ var EditUserFormSchema = zod.object({
32
+ first_name: zod.string().optional(),
33
+ last_name: zod.string().optional()
34
+ });
35
+ var EditUserForm = ({ user }) => {
36
+ const { t } = useTranslation();
37
+ const { handleSuccess } = useRouteModal();
38
+ const form = useForm({
39
+ defaultValues: {
40
+ first_name: user.first_name || "",
41
+ last_name: user.last_name || ""
42
+ },
43
+ resolver: zodResolver(EditUserFormSchema)
44
+ });
45
+ const { mutateAsync, isPending } = useUpdateUser(user.id);
46
+ const handleSubmit = form.handleSubmit(async (values) => {
47
+ await mutateAsync(values, {
48
+ onSuccess: () => {
49
+ handleSuccess();
50
+ }
51
+ });
52
+ });
53
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
54
+ KeyboundForm,
55
+ {
56
+ onSubmit: handleSubmit,
57
+ className: "flex flex-1 flex-col overflow-hidden",
58
+ children: [
59
+ /* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex max-w-full flex-1 flex-col gap-y-8 overflow-y-auto", children: [
60
+ /* @__PURE__ */ jsx(
61
+ Form.Field,
62
+ {
63
+ control: form.control,
64
+ name: "first_name",
65
+ render: ({ field }) => {
66
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
67
+ /* @__PURE__ */ jsx(Form.Label, { children: t("fields.firstName") }),
68
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
69
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
70
+ ] });
71
+ }
72
+ }
73
+ ),
74
+ /* @__PURE__ */ jsx(
75
+ Form.Field,
76
+ {
77
+ control: form.control,
78
+ name: "last_name",
79
+ render: ({ field }) => {
80
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
81
+ /* @__PURE__ */ jsx(Form.Label, { children: t("fields.lastName") }),
82
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
83
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
84
+ ] });
85
+ }
86
+ }
87
+ )
88
+ ] }),
89
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
90
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: t("actions.cancel") }) }),
91
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: t("actions.save") })
92
+ ] }) })
93
+ ]
94
+ }
95
+ ) });
96
+ };
97
+
98
+ // src/routes/users/user-edit/user-edit.tsx
99
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
100
+ var UserEdit = () => {
101
+ const { t } = useTranslation2();
102
+ const { id } = useParams();
103
+ const { user, isPending: isLoading, isError, error } = useUser(id);
104
+ if (isError) {
105
+ throw error;
106
+ }
107
+ return /* @__PURE__ */ jsxs2(RouteDrawer, { children: [
108
+ /* @__PURE__ */ jsx2(RouteDrawer.Header, { children: /* @__PURE__ */ jsx2(Heading, { children: t("users.editUser") }) }),
109
+ !isLoading && user && /* @__PURE__ */ jsx2(EditUserForm, { user })
110
+ ] });
111
+ };
112
+ export {
113
+ UserEdit as Component
114
+ };
@@ -0,0 +1,361 @@
1
+ import {
2
+ _DataTable,
3
+ useDataTable
4
+ } from "./chunk-7ZHDHEUH.mjs";
5
+ import {
6
+ isFetchError
7
+ } from "./chunk-TCNCAWYD.mjs";
8
+ import {
9
+ useCreateInvite,
10
+ useDeleteInvite,
11
+ useInvites,
12
+ useResendInvite
13
+ } from "./chunk-XIM7X4FB.mjs";
14
+ import "./chunk-ITNQKZQQ.mjs";
15
+ import {
16
+ KeyboundForm,
17
+ RouteFocusModal
18
+ } from "./chunk-2U3RK3JG.mjs";
19
+ import {
20
+ Form
21
+ } from "./chunk-ND3ODI36.mjs";
22
+ import {
23
+ useQueryParams
24
+ } from "./chunk-C76H5USB.mjs";
25
+ import "./chunk-DFFLVEZ5.mjs";
26
+ import "./chunk-535OVBXR.mjs";
27
+ import {
28
+ ActionMenu
29
+ } from "./chunk-S3REQHPQ.mjs";
30
+ import "./chunk-OAHCJFG3.mjs";
31
+ import "./chunk-S4DMV3ZT.mjs";
32
+ import "./chunk-FXYH54JP.mjs";
33
+ import "./chunk-774WSTCC.mjs";
34
+ import "./chunk-DTY37DDZ.mjs";
35
+ import "./chunk-QZ7TP4HQ.mjs";
36
+
37
+ // src/routes/users/user-invite/components/invite-user-form/invite-user-form.tsx
38
+ import { zodResolver } from "@hookform/resolvers/zod";
39
+ import { ArrowPath, Link, Trash } from "@acmekit/icons";
40
+ import {
41
+ Alert,
42
+ Button,
43
+ Container,
44
+ Heading,
45
+ Input,
46
+ StatusBadge,
47
+ Text,
48
+ Tooltip,
49
+ usePrompt
50
+ } from "@acmekit/ui";
51
+ import { createColumnHelper } from "@tanstack/react-table";
52
+ import copy from "copy-to-clipboard";
53
+ import { format } from "date-fns";
54
+ import { useMemo } from "react";
55
+ import { useForm } from "react-hook-form";
56
+ import { Trans, useTranslation } from "react-i18next";
57
+ import * as zod from "zod";
58
+
59
+ // src/hooks/table/query/use-user-invite-table-query.tsx
60
+ var useUserInviteTableQuery = ({
61
+ prefix,
62
+ pageSize = 20
63
+ }) => {
64
+ const queryObject = useQueryParams(
65
+ ["offset", "q", "order", "created_at", "updated_at"],
66
+ prefix
67
+ );
68
+ const { offset, created_at, updated_at, q, order } = queryObject;
69
+ const searchParams = {
70
+ limit: pageSize,
71
+ offset: offset ? Number(offset) : 0,
72
+ order,
73
+ created_at: created_at ? JSON.parse(created_at) : void 0,
74
+ updated_at: updated_at ? JSON.parse(updated_at) : void 0,
75
+ q
76
+ };
77
+ return {
78
+ searchParams,
79
+ raw: queryObject
80
+ };
81
+ };
82
+
83
+ // src/routes/users/user-invite/components/invite-user-form/invite-user-form.tsx
84
+ import { jsx, jsxs } from "react/jsx-runtime";
85
+ var InviteUserSchema = zod.object({
86
+ email: zod.string().email()
87
+ });
88
+ var PAGE_SIZE = 10;
89
+ var PREFIX = "usr_invite";
90
+ var INVITE_URL = `${window.location.origin}${__BASE__ === "/" ? "" : __BASE__}/invite?token=`;
91
+ var InviteUserForm = () => {
92
+ const { t } = useTranslation();
93
+ const form = useForm({
94
+ defaultValues: {
95
+ email: ""
96
+ },
97
+ resolver: zodResolver(InviteUserSchema)
98
+ });
99
+ const { raw, searchParams } = useUserInviteTableQuery({
100
+ prefix: PREFIX,
101
+ pageSize: PAGE_SIZE
102
+ });
103
+ const {
104
+ invites,
105
+ count,
106
+ isPending: isLoading,
107
+ isError,
108
+ error
109
+ } = useInvites(searchParams);
110
+ const columns = useColumns();
111
+ const { table } = useDataTable({
112
+ data: invites ?? [],
113
+ columns,
114
+ count,
115
+ enablePagination: true,
116
+ getRowId: (row) => row.id,
117
+ pageSize: PAGE_SIZE,
118
+ prefix: PREFIX
119
+ });
120
+ const { mutateAsync, isPending } = useCreateInvite();
121
+ const handleSubmit = form.handleSubmit(async (values) => {
122
+ try {
123
+ await mutateAsync({ email: values.email });
124
+ form.reset();
125
+ } catch (error2) {
126
+ if (isFetchError(error2) && error2.status === 400) {
127
+ form.setError("root", {
128
+ type: "manual",
129
+ message: error2.message
130
+ });
131
+ return;
132
+ }
133
+ }
134
+ });
135
+ if (isError) {
136
+ throw error;
137
+ }
138
+ return /* @__PURE__ */ jsx(RouteFocusModal.Form, { form, children: /* @__PURE__ */ jsxs(
139
+ KeyboundForm,
140
+ {
141
+ onSubmit: handleSubmit,
142
+ className: "flex h-full flex-col overflow-hidden",
143
+ children: [
144
+ /* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
145
+ /* @__PURE__ */ jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8 px-2 py-16", children: [
146
+ /* @__PURE__ */ jsxs("div", { children: [
147
+ /* @__PURE__ */ jsx(Heading, { children: t("users.inviteUser") }),
148
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: t("users.inviteUserHint") })
149
+ ] }),
150
+ form.formState.errors.root && /* @__PURE__ */ jsx(
151
+ Alert,
152
+ {
153
+ variant: "error",
154
+ dismissible: false,
155
+ className: "text-balance",
156
+ children: form.formState.errors.root.message
157
+ }
158
+ ),
159
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
160
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-4", children: /* @__PURE__ */ jsx(
161
+ Form.Field,
162
+ {
163
+ control: form.control,
164
+ name: "email",
165
+ render: ({ field }) => {
166
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
167
+ /* @__PURE__ */ jsx(Form.Label, { children: t("fields.email") }),
168
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
169
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
170
+ ] });
171
+ }
172
+ }
173
+ ) }),
174
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ jsx(
175
+ Button,
176
+ {
177
+ size: "small",
178
+ variant: "secondary",
179
+ type: "submit",
180
+ isLoading: isPending,
181
+ children: t("users.sendInvite")
182
+ }
183
+ ) })
184
+ ] }),
185
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
186
+ /* @__PURE__ */ jsx(Heading, { level: "h2", children: t("users.pendingInvites") }),
187
+ /* @__PURE__ */ jsx(Container, { className: "overflow-hidden p-0", children: /* @__PURE__ */ jsx(
188
+ _DataTable,
189
+ {
190
+ table,
191
+ columns,
192
+ count,
193
+ pageSize: PAGE_SIZE,
194
+ pagination: true,
195
+ search: "autofocus",
196
+ isLoading,
197
+ queryObject: raw,
198
+ prefix: PREFIX,
199
+ orderBy: [
200
+ { key: "email", label: t("fields.email") },
201
+ { key: "created_at", label: t("fields.createdAt") },
202
+ { key: "updated_at", label: t("fields.updatedAt") }
203
+ ]
204
+ }
205
+ ) })
206
+ ] })
207
+ ] }) }) })
208
+ ]
209
+ }
210
+ ) });
211
+ };
212
+ var InviteActions = ({ invite }) => {
213
+ const { mutateAsync: revokeAsync } = useDeleteInvite(invite.id);
214
+ const { mutateAsync: resendAsync } = useResendInvite(invite.id);
215
+ const prompt = usePrompt();
216
+ const { t } = useTranslation();
217
+ const handleDelete = async () => {
218
+ const res = await prompt({
219
+ title: t("general.areYouSure"),
220
+ description: t("users.deleteInviteWarning", {
221
+ email: invite.email
222
+ }),
223
+ cancelText: t("actions.cancel"),
224
+ confirmText: t("actions.delete")
225
+ });
226
+ if (!res) {
227
+ return;
228
+ }
229
+ await revokeAsync();
230
+ };
231
+ const handleResend = async () => {
232
+ await resendAsync();
233
+ };
234
+ const handleCopyInviteLink = () => {
235
+ const inviteUrl = `${INVITE_URL}${invite.token}`;
236
+ copy(inviteUrl);
237
+ };
238
+ return /* @__PURE__ */ jsx(
239
+ ActionMenu,
240
+ {
241
+ groups: [
242
+ {
243
+ actions: [
244
+ {
245
+ icon: /* @__PURE__ */ jsx(ArrowPath, {}),
246
+ label: t("users.resendInvite"),
247
+ onClick: handleResend
248
+ }
249
+ ]
250
+ },
251
+ {
252
+ actions: [
253
+ {
254
+ icon: /* @__PURE__ */ jsx(Link, {}),
255
+ label: t("users.copyInviteLink"),
256
+ onClick: handleCopyInviteLink
257
+ }
258
+ ]
259
+ },
260
+ {
261
+ actions: [
262
+ {
263
+ icon: /* @__PURE__ */ jsx(Trash, {}),
264
+ label: t("actions.delete"),
265
+ onClick: handleDelete
266
+ }
267
+ ]
268
+ }
269
+ ]
270
+ }
271
+ );
272
+ };
273
+ var columnHelper = createColumnHelper();
274
+ var useColumns = () => {
275
+ const { t } = useTranslation();
276
+ return useMemo(
277
+ () => [
278
+ columnHelper.accessor("email", {
279
+ header: t("fields.email"),
280
+ cell: ({ getValue }) => {
281
+ return getValue();
282
+ }
283
+ }),
284
+ columnHelper.accessor("accepted", {
285
+ header: t("fields.status"),
286
+ cell: ({ getValue, row }) => {
287
+ const accepted = getValue();
288
+ const expired = new Date(row.original.expires_at) < /* @__PURE__ */ new Date();
289
+ if (accepted) {
290
+ return /* @__PURE__ */ jsx(
291
+ Tooltip,
292
+ {
293
+ content: t("users.acceptedOnDate", {
294
+ date: format(
295
+ new Date(row.original.updated_at),
296
+ "dd MMM, yyyy"
297
+ )
298
+ }),
299
+ children: /* @__PURE__ */ jsx(StatusBadge, { color: "green", children: t("users.inviteStatus.accepted") })
300
+ }
301
+ );
302
+ }
303
+ if (expired) {
304
+ return /* @__PURE__ */ jsx(
305
+ Tooltip,
306
+ {
307
+ content: t("users.expiredOnDate", {
308
+ date: format(
309
+ new Date(row.original.expires_at),
310
+ "dd MMM, yyyy"
311
+ )
312
+ }),
313
+ children: /* @__PURE__ */ jsx(StatusBadge, { color: "red", children: t("users.inviteStatus.expired") })
314
+ }
315
+ );
316
+ }
317
+ return /* @__PURE__ */ jsx(
318
+ Tooltip,
319
+ {
320
+ content: /* @__PURE__ */ jsx(
321
+ Trans,
322
+ {
323
+ i18nKey: "users.validFromUntil",
324
+ components: [
325
+ /* @__PURE__ */ jsx("span", { className: "font-medium" }, "from"),
326
+ /* @__PURE__ */ jsx("span", { className: "font-medium" }, "untill")
327
+ ],
328
+ values: {
329
+ from: format(
330
+ new Date(row.original.created_at),
331
+ "dd MMM, yyyy"
332
+ ),
333
+ until: format(
334
+ new Date(row.original.expires_at),
335
+ "dd MMM, yyyy"
336
+ )
337
+ }
338
+ }
339
+ ),
340
+ children: /* @__PURE__ */ jsx(StatusBadge, { color: "orange", children: t("users.inviteStatus.pending") })
341
+ }
342
+ );
343
+ }
344
+ }),
345
+ columnHelper.display({
346
+ id: "actions",
347
+ cell: ({ row }) => /* @__PURE__ */ jsx(InviteActions, { invite: row.original })
348
+ })
349
+ ],
350
+ [t]
351
+ );
352
+ };
353
+
354
+ // src/routes/users/user-invite/user-invite.tsx
355
+ import { jsx as jsx2 } from "react/jsx-runtime";
356
+ var UserInvite = () => {
357
+ return /* @__PURE__ */ jsx2(RouteFocusModal, { children: /* @__PURE__ */ jsx2(InviteUserForm, {}) });
358
+ };
359
+ export {
360
+ UserInvite as Component
361
+ };