@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
@@ -1,291 +0,0 @@
1
- import {
2
- useCloudAuthEnabled,
3
- useCreateCloudAuthUser
4
- } from "./chunk-FBTP4AJM.mjs";
5
- import {
6
- useExtension
7
- } from "./chunk-C5P5PL3E.mjs";
8
- import {
9
- isFetchError
10
- } from "./chunk-QYOO4QR6.mjs";
11
- import {
12
- AvatarBox
13
- } from "./chunk-JSJZMTQG.mjs";
14
- import {
15
- Form,
16
- sdk,
17
- useSignInWithEmailPass
18
- } from "./chunk-4VYJHIB3.mjs";
19
- import "./chunk-QZ7TP4HQ.mjs";
20
-
21
- // src/routes/login/login.tsx
22
- import { zodResolver } from "@hookform/resolvers/zod";
23
- import { Alert, Button as Button2, Heading, Hint, Input, Text } from "@acmekit/ui";
24
- import { useForm } from "react-hook-form";
25
- import { Trans, useTranslation as useTranslation2 } from "react-i18next";
26
- import { Link, useLocation, useNavigate as useNavigate2 } from "react-router-dom";
27
- import * as z from "zod";
28
-
29
- // src/routes/login/components/cloud-auth-login.tsx
30
- import { Spinner } from "@acmekit/icons";
31
- import { Button, toast } from "@acmekit/ui";
32
- import { useCallback, useEffect, useRef, useState } from "react";
33
- import { useTranslation } from "react-i18next";
34
- import { decodeToken } from "react-jwt";
35
- import { useNavigate, useSearchParams } from "react-router-dom";
36
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
37
- var CLOUD_AUTH_PROVIDER = "cloud";
38
- var CloudAuthLogin = () => {
39
- const { t } = useTranslation();
40
- const [searchParams] = useSearchParams();
41
- const { data: cloudAuth } = useCloudAuthEnabled();
42
- const isAutoLogin = searchParams.get("auth_provider") === CLOUD_AUTH_PROVIDER && searchParams.get("auto") === "true";
43
- const isCallback = searchParams.get("auth_provider") === CLOUD_AUTH_PROVIDER && (searchParams.has("code") || searchParams.has("error"));
44
- const { handleLogin, isLoginPending } = useHandleLogin(isAutoLogin);
45
- const { handleCallback, isCallbackPending } = useAuthCallback(searchParams);
46
- const actionInitiated = useRef(false);
47
- useEffect(() => {
48
- if (actionInitiated.current) {
49
- return;
50
- }
51
- if (isAutoLogin) {
52
- actionInitiated.current = true;
53
- handleLogin();
54
- } else if (isCallback) {
55
- actionInitiated.current = true;
56
- handleCallback();
57
- }
58
- }, [isAutoLogin, isCallback, handleLogin, handleCallback]);
59
- if (isAutoLogin || isCallback) {
60
- return /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-subtle fixed inset-0 z-50 flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, { className: "text-ui-fg-subtle animate-spin" }) });
61
- }
62
- if (!cloudAuth?.enabled) {
63
- return null;
64
- }
65
- return /* @__PURE__ */ jsxs(Fragment, { children: [
66
- /* @__PURE__ */ jsx("hr", { className: "bg-ui-border-base my-4" }),
67
- /* @__PURE__ */ jsx(
68
- Button,
69
- {
70
- variant: "secondary",
71
- onClick: handleLogin,
72
- className: "w-full",
73
- disabled: isLoginPending || isCallbackPending,
74
- isLoading: isLoginPending || isCallbackPending,
75
- children: t("auth.login.cloud")
76
- }
77
- )
78
- ] });
79
- };
80
- var useHandleLogin = (isAutoLogin) => {
81
- const { t } = useTranslation();
82
- const navigate = useNavigate();
83
- const [isPending, setIsPending] = useState(false);
84
- const handleLogin = useCallback(async () => {
85
- setIsPending(true);
86
- try {
87
- const result = await sdk.auth.login("user", CLOUD_AUTH_PROVIDER, {
88
- // setting callback_url in case the admin is on a different domain, or the backend URL is set to just "/" which won't work for the callback
89
- callback_url: `${window.location.origin}${window.location.pathname}?auth_provider=${CLOUD_AUTH_PROVIDER}`
90
- });
91
- if (typeof result === "object" && result.location) {
92
- window.location.href = result.location;
93
- return;
94
- }
95
- throw new Error("Unexpected login response");
96
- } catch {
97
- toast.error(t("auth.login.authenticationFailed"));
98
- if (isAutoLogin) {
99
- navigate("/login");
100
- }
101
- }
102
- setIsPending(false);
103
- }, [t, navigate, isAutoLogin]);
104
- return { handleLogin, isLoginPending: isPending };
105
- };
106
- var useAuthCallback = (searchParams) => {
107
- const { t } = useTranslation();
108
- const navigate = useNavigate();
109
- const { mutateAsync: createCloudAuthUser } = useCreateCloudAuthUser();
110
- const [isPending, setIsPending] = useState(false);
111
- const handleCallback = useCallback(async () => {
112
- setIsPending(true);
113
- try {
114
- let token;
115
- try {
116
- const query = Object.fromEntries(searchParams);
117
- delete query.auth_provider;
118
- token = await sdk.auth.callback("user", CLOUD_AUTH_PROVIDER, query);
119
- } catch (error) {
120
- throw new Error("Authentication callback failed");
121
- }
122
- const decodedToken = decodeToken(token);
123
- if (!decodedToken?.actor_id) {
124
- await createCloudAuthUser();
125
- const refreshedToken = await sdk.auth.refresh({
126
- Authorization: `Bearer ${token}`
127
- // passing it manually in case the auth type is session
128
- });
129
- if (!refreshedToken) {
130
- throw new Error("Failed to refresh token after user creation");
131
- }
132
- }
133
- navigate("/");
134
- } catch (error) {
135
- toast.error(t("auth.login.authenticationFailed"));
136
- navigate("/login");
137
- }
138
- setIsPending(false);
139
- }, [searchParams, t, createCloudAuthUser, navigate]);
140
- return { handleCallback, isCallbackPending: isPending };
141
- };
142
-
143
- // src/routes/login/login.tsx
144
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
145
- var LoginSchema = z.object({
146
- email: z.string().email(),
147
- password: z.string()
148
- });
149
- var Login = () => {
150
- const { t } = useTranslation2();
151
- const location = useLocation();
152
- const navigate = useNavigate2();
153
- const { getWidgets } = useExtension();
154
- const from = location.state?.from?.pathname || "/orders";
155
- const form = useForm({
156
- resolver: zodResolver(LoginSchema),
157
- defaultValues: {
158
- email: "",
159
- password: ""
160
- }
161
- });
162
- const { mutateAsync, isPending } = useSignInWithEmailPass();
163
- const handleSubmit = form.handleSubmit(async ({ email, password }) => {
164
- await mutateAsync(
165
- {
166
- email,
167
- password
168
- },
169
- {
170
- onError: (error) => {
171
- if (isFetchError(error)) {
172
- if (error.status === 401) {
173
- form.setError("email", {
174
- type: "manual",
175
- message: error.message
176
- });
177
- return;
178
- }
179
- }
180
- form.setError("root.serverError", {
181
- type: "manual",
182
- message: error.message
183
- });
184
- },
185
- onSuccess: () => {
186
- navigate(from, { replace: true });
187
- }
188
- }
189
- );
190
- });
191
- const serverError = form.formState.errors?.root?.serverError?.message;
192
- const validationError = form.formState.errors.email?.message || form.formState.errors.password?.message;
193
- return /* @__PURE__ */ jsx2("div", { className: "bg-ui-bg-subtle flex min-h-dvh w-dvw items-center justify-center", children: /* @__PURE__ */ jsxs2("div", { className: "m-4 flex w-full max-w-[280px] flex-col items-center", children: [
194
- /* @__PURE__ */ jsx2(AvatarBox, {}),
195
- /* @__PURE__ */ jsxs2("div", { className: "mb-4 flex flex-col items-center", children: [
196
- /* @__PURE__ */ jsx2(Heading, { children: t("login.title") }),
197
- /* @__PURE__ */ jsx2(Text, { size: "small", className: "text-ui-fg-subtle text-center", children: t("login.hint") })
198
- ] }),
199
- /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-col gap-y-3", children: [
200
- getWidgets("login.before").map((Component, i) => {
201
- return /* @__PURE__ */ jsx2(Component, {}, i);
202
- }),
203
- /* @__PURE__ */ jsx2(Form, { ...form, children: /* @__PURE__ */ jsxs2(
204
- "form",
205
- {
206
- onSubmit: handleSubmit,
207
- className: "flex w-full flex-col gap-y-6",
208
- children: [
209
- /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-y-1", children: [
210
- /* @__PURE__ */ jsx2(
211
- Form.Field,
212
- {
213
- control: form.control,
214
- name: "email",
215
- render: ({ field }) => {
216
- return /* @__PURE__ */ jsx2(Form.Item, { children: /* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsx2(
217
- Input,
218
- {
219
- autoComplete: "email",
220
- ...field,
221
- className: "bg-ui-bg-field-component",
222
- placeholder: t("fields.email")
223
- }
224
- ) }) });
225
- }
226
- }
227
- ),
228
- /* @__PURE__ */ jsx2(
229
- Form.Field,
230
- {
231
- control: form.control,
232
- name: "password",
233
- render: ({ field }) => {
234
- return /* @__PURE__ */ jsxs2(Form.Item, { children: [
235
- /* @__PURE__ */ jsx2(Form.Label, {}),
236
- /* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsx2(
237
- Input,
238
- {
239
- type: "password",
240
- autoComplete: "current-password",
241
- ...field,
242
- className: "bg-ui-bg-field-component",
243
- placeholder: t("fields.password")
244
- }
245
- ) })
246
- ] });
247
- }
248
- }
249
- )
250
- ] }),
251
- validationError && /* @__PURE__ */ jsx2("div", { className: "text-center", children: /* @__PURE__ */ jsx2(Hint, { className: "inline-flex", variant: "error", children: validationError }) }),
252
- serverError && /* @__PURE__ */ jsx2(
253
- Alert,
254
- {
255
- className: "bg-ui-bg-base items-center p-2",
256
- dismissible: true,
257
- variant: "error",
258
- children: serverError
259
- }
260
- ),
261
- /* @__PURE__ */ jsx2(Button2, { className: "w-full", type: "submit", isLoading: isPending, children: t("actions.continueWithEmail") })
262
- ]
263
- }
264
- ) }),
265
- [...getWidgets("login.after"), CloudAuthLogin].map(
266
- (Component, i) => {
267
- return /* @__PURE__ */ jsx2(Component, {}, i);
268
- }
269
- )
270
- ] }),
271
- /* @__PURE__ */ jsx2("span", { className: "text-ui-fg-muted txt-small my-6", children: /* @__PURE__ */ jsx2(
272
- Trans,
273
- {
274
- i18nKey: "login.forgotPassword",
275
- components: [
276
- /* @__PURE__ */ jsx2(
277
- Link,
278
- {
279
- to: "/reset-password",
280
- className: "text-ui-fg-interactive transition-fg hover:text-ui-fg-interactive-hover focus-visible:text-ui-fg-interactive-hover font-medium outline-none"
281
- },
282
- "reset-password-link"
283
- )
284
- ]
285
- }
286
- ) })
287
- ] }) });
288
- };
289
- export {
290
- Login as Component
291
- };