@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,170 @@
1
+ import {
2
+ getApiKeyTypeFromPathname
3
+ } from "./chunk-G22WWLPG.mjs";
4
+ import {
5
+ useCreateApiKey
6
+ } from "./chunk-VBT5YZ4K.mjs";
7
+ import "./chunk-IUCDCPJU.mjs";
8
+ import {
9
+ KeyboundForm,
10
+ RouteFocusModal,
11
+ useRouteModal
12
+ } from "./chunk-2U3RK3JG.mjs";
13
+ import {
14
+ Form
15
+ } from "./chunk-ND3ODI36.mjs";
16
+ import "./chunk-FXYH54JP.mjs";
17
+ import "./chunk-774WSTCC.mjs";
18
+ import "./chunk-DTY37DDZ.mjs";
19
+ import "./chunk-QZ7TP4HQ.mjs";
20
+
21
+ // src/routes/api-key-management/api-key-management-create/api-key-management-create.tsx
22
+ import { useLocation } from "react-router-dom";
23
+
24
+ // src/routes/api-key-management/api-key-management-create/components/api-key-create-form/api-key-create-form.tsx
25
+ import { zodResolver } from "@hookform/resolvers/zod";
26
+ import { Button, Heading, Input, Prompt, Text, toast } from "@acmekit/ui";
27
+ import { useForm } from "react-hook-form";
28
+ import { useTranslation } from "react-i18next";
29
+ import * as zod from "zod";
30
+ import { Eye, EyeSlash } from "@acmekit/icons";
31
+ import { Fragment, useState } from "react";
32
+ import { jsx, jsxs } from "react/jsx-runtime";
33
+ var ApiKeyCreateSchema = zod.object({
34
+ title: zod.string().min(1)
35
+ });
36
+ function getRedactedKey(key) {
37
+ if (!key) {
38
+ return "";
39
+ }
40
+ const firstThree = key.slice(0, 4);
41
+ const lastTwo = key.slice(-2);
42
+ return `${firstThree}${"\u2022".repeat(key.length - 6)}${lastTwo}`;
43
+ }
44
+ var ApiKeyCreateForm = ({ keyType }) => {
45
+ const [createdKey, setCreatedKey] = useState(null);
46
+ const [showRedactedKey, setShowRedactedKey] = useState(true);
47
+ const { t } = useTranslation();
48
+ const { handleSuccess } = useRouteModal();
49
+ const form = useForm({
50
+ defaultValues: {
51
+ title: ""
52
+ },
53
+ resolver: zodResolver(ApiKeyCreateSchema)
54
+ });
55
+ const { mutateAsync, isPending } = useCreateApiKey();
56
+ const handleSubmit = form.handleSubmit(async (values) => {
57
+ await mutateAsync(
58
+ // @ts-ignore
59
+ { title: values.title, type: keyType },
60
+ {
61
+ onSuccess: ({ api_key }) => {
62
+ toast.success(t("apiKeyManagement.create.successToast"));
63
+ switch (keyType) {
64
+ case "publishable" /* PUBLISHABLE */:
65
+ handleSuccess(`/settings/publishable-api-keys/${api_key.id}`);
66
+ break;
67
+ case "secret" /* SECRET */:
68
+ setCreatedKey(api_key);
69
+ break;
70
+ }
71
+ },
72
+ onError: (err) => {
73
+ toast.error(err.message);
74
+ }
75
+ }
76
+ );
77
+ });
78
+ const handleCopyToken = () => {
79
+ if (!createdKey) {
80
+ toast.error(t("apiKeyManagement.create.copySecretTokenFailure"));
81
+ }
82
+ navigator.clipboard.writeText(createdKey?.token ?? "");
83
+ toast.success(t("apiKeyManagement.create.copySecretTokenSuccess"));
84
+ };
85
+ const handleGoToSecretKey = () => {
86
+ if (!createdKey) {
87
+ return;
88
+ }
89
+ handleSuccess(`/settings/secret-api-keys/${createdKey.id}`);
90
+ };
91
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
92
+ /* @__PURE__ */ jsx(RouteFocusModal.Form, { form, children: /* @__PURE__ */ jsxs(
93
+ KeyboundForm,
94
+ {
95
+ className: "flex h-full flex-col overflow-hidden",
96
+ onSubmit: handleSubmit,
97
+ children: [
98
+ /* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
99
+ /* @__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: [
100
+ /* @__PURE__ */ jsxs("div", { children: [
101
+ /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: keyType === "publishable" /* PUBLISHABLE */ ? t("apiKeyManagement.create.createPublishableHeader") : t("apiKeyManagement.create.createSecretHeader") }) }),
102
+ /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: keyType === "publishable" /* PUBLISHABLE */ ? t("apiKeyManagement.create.createPublishableHint") : t("apiKeyManagement.create.createSecretHint") }) })
103
+ ] }),
104
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-4", children: /* @__PURE__ */ jsx(
105
+ Form.Field,
106
+ {
107
+ control: form.control,
108
+ name: "title",
109
+ render: ({ field }) => {
110
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
111
+ /* @__PURE__ */ jsx(Form.Label, { children: t("fields.title") }),
112
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
113
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
114
+ ] });
115
+ }
116
+ }
117
+ ) })
118
+ ] }) }) }),
119
+ /* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
120
+ /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: t("actions.cancel") }) }),
121
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: t("actions.save") })
122
+ ] }) })
123
+ ]
124
+ }
125
+ ) }),
126
+ /* @__PURE__ */ jsx(Prompt, { variant: "confirmation", open: !!createdKey, children: /* @__PURE__ */ jsxs(Prompt.Content, { className: "w-fit max-w-[42.5%]", children: [
127
+ /* @__PURE__ */ jsxs(Prompt.Header, { children: [
128
+ /* @__PURE__ */ jsx(Prompt.Title, { children: t("apiKeyManagement.create.secretKeyCreatedHeader") }),
129
+ /* @__PURE__ */ jsx(Prompt.Description, { children: t("apiKeyManagement.create.secretKeyCreatedHint") })
130
+ ] }),
131
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-3 px-6 py-4", children: [
132
+ /* @__PURE__ */ jsxs("div", { className: "shadow-borders-base bg-ui-bg-component grid h-8 grid-cols-[1fr_32px] items-center overflow-hidden rounded-md", children: [
133
+ /* @__PURE__ */ jsx("div", { className: "flex items-center px-2", children: /* @__PURE__ */ jsx(Text, { family: "mono", size: "small", children: showRedactedKey ? getRedactedKey(createdKey?.token) : createdKey?.token }) }),
134
+ /* @__PURE__ */ jsx(
135
+ "button",
136
+ {
137
+ className: "transition-fg hover:bg-ui-bg-base-hover active:bg-ui-bg-base-pressed text-ui-fg-muted active:text-ui-fg-subtle flex size-8 appearance-none items-center justify-center border-l",
138
+ type: "button",
139
+ onClick: () => setShowRedactedKey(!showRedactedKey),
140
+ children: showRedactedKey ? /* @__PURE__ */ jsx(EyeSlash, {}) : /* @__PURE__ */ jsx(Eye, {})
141
+ }
142
+ )
143
+ ] }),
144
+ /* @__PURE__ */ jsx(
145
+ Button,
146
+ {
147
+ size: "small",
148
+ variant: "secondary",
149
+ type: "button",
150
+ className: "w-full",
151
+ onClick: handleCopyToken,
152
+ children: t("apiKeyManagement.actions.copy")
153
+ }
154
+ )
155
+ ] }),
156
+ /* @__PURE__ */ jsx(Prompt.Footer, { className: "border-t py-4", children: /* @__PURE__ */ jsx(Prompt.Action, { onClick: handleGoToSecretKey, children: t("actions.continue") }) })
157
+ ] }) })
158
+ ] });
159
+ };
160
+
161
+ // src/routes/api-key-management/api-key-management-create/api-key-management-create.tsx
162
+ import { jsx as jsx2 } from "react/jsx-runtime";
163
+ var ApiKeyManagementCreate = () => {
164
+ const { pathname } = useLocation();
165
+ const keyType = getApiKeyTypeFromPathname(pathname);
166
+ return /* @__PURE__ */ jsx2(RouteFocusModal, { children: /* @__PURE__ */ jsx2(ApiKeyCreateForm, { keyType }) });
167
+ };
168
+ export {
169
+ ApiKeyManagementCreate as Component
170
+ };
@@ -0,0 +1,307 @@
1
+ import {
2
+ getApiKeyStatusProps,
3
+ getApiKeyTypeProps,
4
+ prettifyRedactedToken
5
+ } from "./chunk-G22WWLPG.mjs";
6
+ import "./chunk-6SQCO25J.mjs";
7
+ import "./chunk-ULSPL3DR.mjs";
8
+ import "./chunk-GBFVWROS.mjs";
9
+ import {
10
+ apiKeysQueryKeys,
11
+ useApiKey,
12
+ useDeleteApiKey,
13
+ useRevokeApiKey
14
+ } from "./chunk-VBT5YZ4K.mjs";
15
+ import "./chunk-LKWTBYYC.mjs";
16
+ import "./chunk-OHAFITSB.mjs";
17
+ import {
18
+ SingleColumnPage
19
+ } from "./chunk-22YYMH6M.mjs";
20
+ import {
21
+ useExtension
22
+ } from "./chunk-C5P5PL3E.mjs";
23
+ import "./chunk-DN3MIYQH.mjs";
24
+ import {
25
+ useUser
26
+ } from "./chunk-YRWSG3YM.mjs";
27
+ import "./chunk-XIM7X4FB.mjs";
28
+ import {
29
+ SingleColumnPageSkeleton,
30
+ Skeleton
31
+ } from "./chunk-ITNQKZQQ.mjs";
32
+ import {
33
+ useDate
34
+ } from "./chunk-DFFLVEZ5.mjs";
35
+ import "./chunk-535OVBXR.mjs";
36
+ import {
37
+ ActionMenu
38
+ } from "./chunk-S3REQHPQ.mjs";
39
+ import "./chunk-OAHCJFG3.mjs";
40
+ import "./chunk-S4DMV3ZT.mjs";
41
+ import {
42
+ queryClient
43
+ } from "./chunk-FXYH54JP.mjs";
44
+ import "./chunk-774WSTCC.mjs";
45
+ import {
46
+ sdk
47
+ } from "./chunk-DTY37DDZ.mjs";
48
+ import "./chunk-QZ7TP4HQ.mjs";
49
+
50
+ // src/routes/api-key-management/api-key-management-detail/api-key-management-detail.tsx
51
+ import { useLoaderData, useParams } from "react-router-dom";
52
+
53
+ // src/routes/api-key-management/api-key-management-detail/components/api-key-general-section/api-key-general-section.tsx
54
+ import { PencilSquare, Trash, XCircle } from "@acmekit/icons";
55
+ import {
56
+ Badge,
57
+ Container,
58
+ Copy,
59
+ Heading,
60
+ StatusBadge,
61
+ Text as Text2,
62
+ toast,
63
+ usePrompt
64
+ } from "@acmekit/ui";
65
+ import { useTranslation } from "react-i18next";
66
+ import { useNavigate } from "react-router-dom";
67
+
68
+ // src/components/common/user-link/user-link.tsx
69
+ import { Avatar, Text } from "@acmekit/ui";
70
+ import { Link } from "react-router-dom";
71
+ import { jsx, jsxs } from "react/jsx-runtime";
72
+ var UserLink = ({
73
+ id,
74
+ first_name,
75
+ last_name,
76
+ email,
77
+ type = "user"
78
+ }) => {
79
+ const name = [first_name, last_name].filter(Boolean).join(" ");
80
+ const fallback = name ? name.slice(0, 1) : email.slice(0, 1);
81
+ const link = type === "user" ? `/settings/users/${id}` : `/customers/${id}`;
82
+ return /* @__PURE__ */ jsxs(
83
+ Link,
84
+ {
85
+ to: link,
86
+ className: "flex items-center gap-x-2 w-fit transition-fg hover:text-ui-fg-subtle outline-none focus-visible:shadow-borders-focus rounded-md",
87
+ children: [
88
+ /* @__PURE__ */ jsx(Avatar, { size: "2xsmall", fallback: fallback.toUpperCase() }),
89
+ /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", weight: "regular", children: name || email })
90
+ ]
91
+ }
92
+ );
93
+ };
94
+
95
+ // src/routes/api-key-management/api-key-management-detail/components/api-key-general-section/api-key-general-section.tsx
96
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
97
+ var ApiKeyGeneralSection = ({ apiKey }) => {
98
+ const { t } = useTranslation();
99
+ const navigate = useNavigate();
100
+ const prompt = usePrompt();
101
+ const { getFullDate } = useDate();
102
+ const { mutateAsync: revokeAsync } = useRevokeApiKey(apiKey.id);
103
+ const { mutateAsync: deleteAsync } = useDeleteApiKey(apiKey.id);
104
+ const handleDelete = async () => {
105
+ const res = await prompt({
106
+ title: t("general.areYouSure"),
107
+ description: t("apiKeyManagement.delete.warning", {
108
+ title: apiKey.title
109
+ }),
110
+ confirmText: t("actions.delete"),
111
+ cancelText: t("actions.cancel")
112
+ });
113
+ if (!res) {
114
+ return;
115
+ }
116
+ await deleteAsync(void 0, {
117
+ onSuccess: () => {
118
+ toast.success(
119
+ t("apiKeyManagement.delete.successToast", {
120
+ title: apiKey.title
121
+ })
122
+ );
123
+ navigate("..", { replace: true });
124
+ },
125
+ onError: (err) => {
126
+ toast.error(err.message);
127
+ }
128
+ });
129
+ };
130
+ const handleRevoke = async () => {
131
+ const res = await prompt({
132
+ title: t("general.areYouSure"),
133
+ description: t("apiKeyManagement.revoke.warning", {
134
+ title: apiKey.title
135
+ }),
136
+ confirmText: t("apiKeyManagement.actions.revoke"),
137
+ cancelText: t("actions.cancel")
138
+ });
139
+ if (!res) {
140
+ return;
141
+ }
142
+ await revokeAsync(void 0, {
143
+ onSuccess: () => {
144
+ toast.success(
145
+ t("apiKeyManagement.revoke.successToast", {
146
+ title: apiKey.title
147
+ })
148
+ );
149
+ },
150
+ onError: (err) => {
151
+ toast.error(err.message);
152
+ }
153
+ });
154
+ };
155
+ const dangerousActions = [
156
+ {
157
+ icon: /* @__PURE__ */ jsx2(Trash, {}),
158
+ label: t("actions.delete"),
159
+ onClick: handleDelete,
160
+ disabled: !apiKey.revoked_at
161
+ }
162
+ ];
163
+ if (!apiKey.revoked_at) {
164
+ dangerousActions.unshift({
165
+ icon: /* @__PURE__ */ jsx2(XCircle, {}),
166
+ label: t("apiKeyManagement.actions.revoke"),
167
+ onClick: handleRevoke,
168
+ disabled: !!apiKey.revoked_at
169
+ });
170
+ }
171
+ const apiKeyStatus = getApiKeyStatusProps(apiKey.revoked_at, t);
172
+ const apiKeyType = getApiKeyTypeProps(apiKey.type, t);
173
+ return /* @__PURE__ */ jsxs2(Container, { className: "divide-y p-0", children: [
174
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between px-6 py-4", children: [
175
+ /* @__PURE__ */ jsx2(Heading, { children: apiKey.title }),
176
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-4", children: [
177
+ /* @__PURE__ */ jsx2("div", { className: "flex items-center gap-x-2", children: /* @__PURE__ */ jsx2(StatusBadge, { color: apiKeyStatus.color, children: apiKeyStatus.label }) }),
178
+ /* @__PURE__ */ jsx2(
179
+ ActionMenu,
180
+ {
181
+ groups: [
182
+ {
183
+ actions: [
184
+ {
185
+ label: t("actions.edit"),
186
+ icon: /* @__PURE__ */ jsx2(PencilSquare, {}),
187
+ to: "edit"
188
+ }
189
+ ]
190
+ },
191
+ {
192
+ actions: dangerousActions
193
+ }
194
+ ]
195
+ }
196
+ )
197
+ ] })
198
+ ] }),
199
+ /* @__PURE__ */ jsxs2("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4", children: [
200
+ /* @__PURE__ */ jsx2(Text2, { size: "small", leading: "compact", weight: "plus", children: t("fields.key") }),
201
+ apiKey.type === "secret" ? /* @__PURE__ */ jsx2(Badge, { size: "2xsmall", className: "inline-block w-fit", children: prettifyRedactedToken(apiKey.redacted) }) : /* @__PURE__ */ jsx2(Copy, { asChild: true, content: apiKey.token, className: "cursor-pointer", children: /* @__PURE__ */ jsx2(Badge, { size: "2xsmall", className: "text-ui-tag-neutral-text", children: prettifyRedactedToken(apiKey.redacted) }) })
202
+ ] }),
203
+ /* @__PURE__ */ jsxs2("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4", children: [
204
+ /* @__PURE__ */ jsx2(Text2, { size: "small", leading: "compact", weight: "plus", children: t("fields.type") }),
205
+ /* @__PURE__ */ jsx2(Text2, { size: "small", leading: "compact", children: apiKeyType.label })
206
+ ] }),
207
+ /* @__PURE__ */ jsxs2("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4", children: [
208
+ /* @__PURE__ */ jsx2(Text2, { size: "small", leading: "compact", weight: "plus", children: t("apiKeyManagement.fields.lastUsedAtLabel") }),
209
+ /* @__PURE__ */ jsx2(Text2, { size: "small", leading: "compact", children: apiKey.last_used_at ? getFullDate({ date: apiKey.last_used_at, includeTime: true }) : "-" })
210
+ ] }),
211
+ /* @__PURE__ */ jsxs2("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4", children: [
212
+ /* @__PURE__ */ jsx2(Text2, { size: "small", leading: "compact", weight: "plus", children: t("apiKeyManagement.fields.createdByLabel") }),
213
+ /* @__PURE__ */ jsx2(ActionBy, { userId: apiKey.created_by })
214
+ ] }),
215
+ apiKey.revoked_at && /* @__PURE__ */ jsxs2(Fragment, { children: [
216
+ /* @__PURE__ */ jsxs2("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4", children: [
217
+ /* @__PURE__ */ jsx2(Text2, { size: "small", leading: "compact", weight: "plus", children: t("apiKeyManagement.fields.revokedAtLabel") }),
218
+ /* @__PURE__ */ jsx2(Text2, { size: "small", leading: "compact", children: getFullDate({ date: apiKey.revoked_at, includeTime: true }) })
219
+ ] }),
220
+ /* @__PURE__ */ jsxs2("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4", children: [
221
+ /* @__PURE__ */ jsx2(Text2, { size: "small", leading: "compact", weight: "plus", children: t("apiKeyManagement.fields.revokedByLabel") }),
222
+ /* @__PURE__ */ jsx2(ActionBy, { userId: apiKey.revoked_by })
223
+ ] })
224
+ ] })
225
+ ] });
226
+ };
227
+ var ActionBy = ({ userId }) => {
228
+ const { user, isLoading, isError, error } = useUser(userId, void 0, {
229
+ enabled: !!userId
230
+ });
231
+ if (!userId) {
232
+ return /* @__PURE__ */ jsx2(Text2, { size: "small", className: "text-ui-fg-subtle", children: "-" });
233
+ }
234
+ if (isError) {
235
+ throw error;
236
+ }
237
+ if (isLoading) {
238
+ return /* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-[20px_1fr]", children: [
239
+ /* @__PURE__ */ jsx2(Skeleton, { className: "h-5 w-5 rounded-full" }),
240
+ /* @__PURE__ */ jsx2(Skeleton, { className: "w-full max-w-[220px]" })
241
+ ] });
242
+ }
243
+ if (!user) {
244
+ return /* @__PURE__ */ jsx2(Text2, { size: "small", className: "text-ui-fg-subtle", children: "-" });
245
+ }
246
+ return /* @__PURE__ */ jsx2(UserLink, { ...user });
247
+ };
248
+
249
+ // src/routes/api-key-management/api-key-management-detail/api-key-management-detail.tsx
250
+ import { jsx as jsx3 } from "react/jsx-runtime";
251
+ var ApiKeyManagementDetail = () => {
252
+ const initialData = useLoaderData();
253
+ const { id } = useParams();
254
+ const { getWidgets } = useExtension();
255
+ const { api_key, isLoading, isError, error } = useApiKey(id, {
256
+ initialData
257
+ });
258
+ if (isLoading || !api_key) {
259
+ return /* @__PURE__ */ jsx3(SingleColumnPageSkeleton, { showJSON: true, sections: 1 });
260
+ }
261
+ if (isError) {
262
+ throw error;
263
+ }
264
+ return /* @__PURE__ */ jsx3(
265
+ SingleColumnPage,
266
+ {
267
+ hasOutlet: true,
268
+ showJSON: true,
269
+ widgets: {
270
+ before: getWidgets("api_key.details.before"),
271
+ after: getWidgets("api_key.details.after")
272
+ },
273
+ data: api_key,
274
+ children: /* @__PURE__ */ jsx3(ApiKeyGeneralSection, { apiKey: api_key })
275
+ }
276
+ );
277
+ };
278
+
279
+ // src/routes/api-key-management/api-key-management-detail/breadcrumb.tsx
280
+ import { jsx as jsx4 } from "react/jsx-runtime";
281
+ var ApiKeyManagementDetailBreadcrumb = (props) => {
282
+ const { id } = props.params || {};
283
+ const { api_key } = useApiKey(id, {
284
+ initialData: props.data,
285
+ enabled: Boolean(id)
286
+ });
287
+ if (!api_key) {
288
+ return null;
289
+ }
290
+ return /* @__PURE__ */ jsx4("span", { children: api_key.title });
291
+ };
292
+
293
+ // src/routes/api-key-management/api-key-management-detail/loader.ts
294
+ var apiKeyDetailQuery = (id) => ({
295
+ queryKey: apiKeysQueryKeys.detail(id),
296
+ queryFn: async () => sdk.admin.apiKey.retrieve(id)
297
+ });
298
+ var apiKeyLoader = async ({ params }) => {
299
+ const id = params.id;
300
+ const query = apiKeyDetailQuery(id);
301
+ return queryClient.ensureQueryData(query);
302
+ };
303
+ export {
304
+ ApiKeyManagementDetailBreadcrumb as Breadcrumb,
305
+ ApiKeyManagementDetail as Component,
306
+ apiKeyLoader as loader
307
+ };
@@ -0,0 +1,106 @@
1
+ import {
2
+ useApiKey,
3
+ useUpdateApiKey
4
+ } from "./chunk-VBT5YZ4K.mjs";
5
+ import "./chunk-IUCDCPJU.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/api-key-management/api-key-management-edit/api-key-management-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/components/utilities/visually-hidden/visually-hidden.tsx
25
+ import { jsx } from "react/jsx-runtime";
26
+ var VisuallyHidden = ({ children }) => {
27
+ return /* @__PURE__ */ jsx("span", { className: "sr-only", children });
28
+ };
29
+
30
+ // src/routes/api-key-management/api-key-management-edit/components/edit-api-key-form/edit-api-key-form.tsx
31
+ import { zodResolver } from "@hookform/resolvers/zod";
32
+ import { Button, Input, toast } from "@acmekit/ui";
33
+ import { useForm } from "react-hook-form";
34
+ import { useTranslation } from "react-i18next";
35
+ import * as zod from "zod";
36
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
37
+ var EditApiKeySchema = zod.object({
38
+ title: zod.string().min(1)
39
+ });
40
+ var EditApiKeyForm = ({ apiKey }) => {
41
+ const { t } = useTranslation();
42
+ const { handleSuccess } = useRouteModal();
43
+ const form = useForm({
44
+ defaultValues: {
45
+ title: apiKey.title
46
+ },
47
+ resolver: zodResolver(EditApiKeySchema)
48
+ });
49
+ const { mutateAsync, isPending } = useUpdateApiKey(apiKey.id);
50
+ const handleSubmit = form.handleSubmit(async (data) => {
51
+ await mutateAsync(data, {
52
+ onSuccess: ({ api_key }) => {
53
+ toast.success(
54
+ t("apiKeyManagement.edit.successToast", {
55
+ title: api_key.title
56
+ })
57
+ );
58
+ handleSuccess();
59
+ },
60
+ onError: (err) => {
61
+ toast.error(err.message);
62
+ }
63
+ });
64
+ });
65
+ return /* @__PURE__ */ jsx2(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { onSubmit: handleSubmit, className: "flex flex-1 flex-col", children: [
66
+ /* @__PURE__ */ jsx2(RouteDrawer.Body, { children: /* @__PURE__ */ jsx2("div", { className: "flex flex-col gap-y-4", children: /* @__PURE__ */ jsx2(
67
+ Form.Field,
68
+ {
69
+ control: form.control,
70
+ name: "title",
71
+ render: ({ field }) => {
72
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
73
+ /* @__PURE__ */ jsx2(Form.Label, { children: t("fields.title") }),
74
+ /* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsx2(Input, { ...field }) }),
75
+ /* @__PURE__ */ jsx2(Form.ErrorMessage, {})
76
+ ] });
77
+ }
78
+ }
79
+ ) }) }),
80
+ /* @__PURE__ */ jsx2(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
81
+ /* @__PURE__ */ jsx2(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx2(Button, { size: "small", variant: "secondary", children: t("actions.cancel") }) }),
82
+ /* @__PURE__ */ jsx2(Button, { size: "small", type: "submit", isLoading: isPending, children: t("actions.save") })
83
+ ] }) })
84
+ ] }) });
85
+ };
86
+
87
+ // src/routes/api-key-management/api-key-management-edit/api-key-management-edit.tsx
88
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
89
+ var ApiKeyManagementEdit = () => {
90
+ const { id } = useParams();
91
+ const { t } = useTranslation2();
92
+ const { api_key, isLoading, isError, error } = useApiKey(id);
93
+ if (isError) {
94
+ throw error;
95
+ }
96
+ return /* @__PURE__ */ jsxs2(RouteDrawer, { children: [
97
+ /* @__PURE__ */ jsxs2(RouteDrawer.Header, { children: [
98
+ /* @__PURE__ */ jsx3(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx3(Heading, { children: t("apiKeyManagement.edit.header") }) }),
99
+ /* @__PURE__ */ jsx3(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx3(VisuallyHidden, { children: t("apiKeyManagement.edit.description") }) })
100
+ ] }),
101
+ !isLoading && !!api_key && /* @__PURE__ */ jsx3(EditApiKeyForm, { apiKey: api_key })
102
+ ] });
103
+ };
104
+ export {
105
+ ApiKeyManagementEdit as Component
106
+ };