@acmekit/dashboard 2.13.7 → 2.13.9

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 (83) hide show
  1. package/dist/api-key-management-create-VWUERPPB.mjs +170 -0
  2. package/dist/api-key-management-detail-V4ENQHYY.mjs +306 -0
  3. package/dist/api-key-management-edit-R44OHS7B.mjs +106 -0
  4. package/dist/api-key-management-list-K2XPKF5E.mjs +400 -0
  5. package/dist/app.js +16765 -1370
  6. package/dist/app.mjs +786 -1030
  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-774WSTCC.mjs +19 -0
  11. package/dist/chunk-C76H5USB.mjs +16 -0
  12. package/dist/chunk-DFFLVEZ5.mjs +40 -0
  13. package/dist/chunk-DN3MIYQH.mjs +140 -0
  14. package/dist/chunk-DQCEH3X2.mjs +28 -0
  15. package/dist/chunk-DTY37DDZ.mjs +20 -0
  16. package/dist/chunk-EFRMWHRX.mjs +84 -0
  17. package/dist/chunk-FXYH54JP.mjs +16 -0
  18. package/dist/chunk-G22WWLPG.mjs +44 -0
  19. package/dist/chunk-G2VJOHHV.mjs +32 -0
  20. package/dist/chunk-GBFVWROS.mjs +58 -0
  21. package/dist/chunk-ITNQKZQQ.mjs +142 -0
  22. package/dist/chunk-IUCDCPJU.mjs +0 -0
  23. package/dist/chunk-LKWTBYYC.mjs +35 -0
  24. package/dist/{chunk-4VYJHIB3.mjs → chunk-ND3ODI36.mjs} +0 -72
  25. package/dist/chunk-OAHCJFG3.mjs +17 -0
  26. package/dist/chunk-RPAL6FHW.mjs +73 -0
  27. package/dist/{chunk-JSJZMTQG.mjs → chunk-RREPQMYC.mjs} +14 -41
  28. package/dist/chunk-S3REQHPQ.mjs +86 -0
  29. package/dist/chunk-S4DMV3ZT.mjs +35 -0
  30. package/dist/chunk-ST2YB7JN.mjs +74 -0
  31. package/dist/chunk-TCNCAWYD.mjs +9 -0
  32. package/dist/chunk-ULSPL3DR.mjs +126 -0
  33. package/dist/chunk-WILMJYUB.mjs +35 -0
  34. package/dist/chunk-XIM7X4FB.mjs +83 -0
  35. package/dist/chunk-YLPAZ2DP.mjs +1837 -0
  36. package/dist/chunk-YRWSG3YM.mjs +80 -0
  37. package/dist/{invite-S5USGDOZ.mjs → invite-XGPZZBUP.mjs} +15 -7
  38. package/dist/{login-AIMR26AL.mjs → login-GNP3QIPI.mjs} +25 -12
  39. package/dist/profile-detail-YX27F7N6.mjs +96 -0
  40. package/dist/profile-edit-2VRDU75O.mjs +173 -0
  41. package/dist/{reset-password-UQPRHMB3.mjs → reset-password-TWRNZO6Z.mjs} +7 -3
  42. package/dist/settings-3XWLL5LG.mjs +545 -0
  43. package/dist/translation-list-CCEQJNED.mjs +581 -0
  44. package/dist/translations-edit-E57GVUFV.mjs +5376 -0
  45. package/dist/user-detail-KUSRRVNX.mjs +169 -0
  46. package/dist/user-edit-HTN3ZGCL.mjs +114 -0
  47. package/dist/user-invite-E3FAAU3V.mjs +361 -0
  48. package/dist/user-list-KNJ5S3IM.mjs +1116 -0
  49. package/dist/user-metadata-5GQK75DT.mjs +425 -0
  50. package/dist/workflow-execution-detail-LZXCRVNC.mjs +819 -0
  51. package/dist/workflow-execution-list-HQ3V6TML.mjs +175 -0
  52. package/package.json +9 -9
  53. package/src/components/layout/settings-layout/settings-layout.tsx +8 -2
  54. package/src/dashboard-app/routes/get-route.map.tsx +1 -14
  55. package/src/hooks/api/api-keys.tsx +0 -49
  56. package/src/hooks/api/index.ts +0 -1
  57. package/src/providers/keybind-provider/hooks.tsx +0 -145
  58. package/src/routes/translations/translation-list/translation-list.tsx +10 -21
  59. package/src/routes/translations/translations-edit/translations-edit.tsx +14 -11
  60. package/src/vite-env.d.ts +3 -1
  61. package/dist/chunk-FBTP4AJM.mjs +0 -221
  62. package/dist/chunk-QYOO4QR6.mjs +0 -73
  63. package/src/components/data-table/helpers/sales-channels/index.ts +0 -4
  64. package/src/components/data-table/helpers/sales-channels/use-sales-channel-table-columns.tsx +0 -61
  65. package/src/components/data-table/helpers/sales-channels/use-sales-channel-table-empty-state.tsx +0 -22
  66. package/src/components/data-table/helpers/sales-channels/use-sales-channel-table-filters.tsx +0 -33
  67. package/src/components/data-table/helpers/sales-channels/use-sales-channel-table-query.tsx +0 -30
  68. package/src/routes/api-key-management/api-key-management-detail/components/api-key-sales-channel-section/api-key-sales-channel-section.tsx +0 -206
  69. package/src/routes/api-key-management/api-key-management-detail/components/api-key-sales-channel-section/index.ts +0 -1
  70. package/src/routes/store/common/hooks/use-currencies-table-columns.tsx +0 -29
  71. package/src/routes/store/common/hooks/use-currencies-table-query.tsx +0 -21
  72. package/src/routes/store/common/hooks/use-locales-table-columns.tsx +0 -29
  73. package/src/routes/store/common/hooks/use-locales-table-query.tsx +0 -21
  74. package/src/routes/store/store-detail/components/store-general-section/index.ts +0 -1
  75. package/src/routes/store/store-detail/components/store-general-section/store-general-section.tsx +0 -48
  76. package/src/routes/store/store-detail/index.ts +0 -2
  77. package/src/routes/store/store-detail/loader.ts +0 -18
  78. package/src/routes/store/store-detail/store-detail.tsx +0 -42
  79. package/src/routes/store/store-edit/components/edit-store-form/edit-store-form.tsx +0 -83
  80. package/src/routes/store/store-edit/index.ts +0 -1
  81. package/src/routes/store/store-edit/store-edit.tsx +0 -25
  82. package/src/routes/store/store-metadata/index.ts +0 -1
  83. package/src/routes/store/store-metadata/store-metadata.tsx +0 -24
@@ -0,0 +1,819 @@
1
+ import {
2
+ STEP_ERROR_STATES,
3
+ STEP_INACTIVE_STATES,
4
+ STEP_IN_PROGRESS_STATES,
5
+ STEP_OK_STATES,
6
+ STEP_SKIPPED_STATES,
7
+ getTransactionState,
8
+ getTransactionStateColor
9
+ } from "./chunk-RPAL6FHW.mjs";
10
+ import {
11
+ JsonViewSection,
12
+ SingleColumnPage
13
+ } from "./chunk-22YYMH6M.mjs";
14
+ import {
15
+ useExtension
16
+ } from "./chunk-C5P5PL3E.mjs";
17
+ import "./chunk-ST2YB7JN.mjs";
18
+ import "./chunk-GBFVWROS.mjs";
19
+ import "./chunk-EFRMWHRX.mjs";
20
+ import {
21
+ useWorkflowExecution,
22
+ workflowExecutionsQueryKeys
23
+ } from "./chunk-LKWTBYYC.mjs";
24
+ import "./chunk-ULSPL3DR.mjs";
25
+ import "./chunk-DN3MIYQH.mjs";
26
+ import "./chunk-XIM7X4FB.mjs";
27
+ import {
28
+ SingleColumnPageSkeleton
29
+ } from "./chunk-ITNQKZQQ.mjs";
30
+ import {
31
+ useDocumentDirection
32
+ } from "./chunk-S4DMV3ZT.mjs";
33
+ import "./chunk-YRWSG3YM.mjs";
34
+ import {
35
+ queryClient
36
+ } from "./chunk-FXYH54JP.mjs";
37
+ import "./chunk-774WSTCC.mjs";
38
+ import {
39
+ sdk
40
+ } from "./chunk-DTY37DDZ.mjs";
41
+ import "./chunk-QZ7TP4HQ.mjs";
42
+
43
+ // src/routes/workflow-executions/workflow-execution-detail/breadcrumb.tsx
44
+ import { jsx } from "react/jsx-runtime";
45
+ var WorkflowExecutionDetailBreadcrumb = (props) => {
46
+ const { id } = props.params || {};
47
+ const { workflow_execution } = useWorkflowExecution(id, {
48
+ initialData: props.data,
49
+ enabled: Boolean(id)
50
+ });
51
+ if (!workflow_execution) {
52
+ return null;
53
+ }
54
+ const cleanId = workflow_execution.id.replace("wf_exec_", "");
55
+ return /* @__PURE__ */ jsx("span", { children: cleanId });
56
+ };
57
+
58
+ // src/routes/workflow-executions/workflow-execution-detail/loader.ts
59
+ var executionDetailQuery = (id) => ({
60
+ queryKey: workflowExecutionsQueryKeys.detail(id),
61
+ queryFn: async () => sdk.admin.workflowExecution.retrieve(id)
62
+ });
63
+ var workflowExecutionLoader = async ({
64
+ params
65
+ }) => {
66
+ const id = params.id;
67
+ const query = executionDetailQuery(id);
68
+ return queryClient.ensureQueryData(query);
69
+ };
70
+
71
+ // src/routes/workflow-executions/workflow-execution-detail/workflow-detail.tsx
72
+ import { useParams } from "react-router-dom";
73
+
74
+ // src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-general-section/workflow-execution-general-section.tsx
75
+ import {
76
+ Badge,
77
+ Container,
78
+ Copy,
79
+ Heading,
80
+ StatusBadge,
81
+ Text,
82
+ clx
83
+ } from "@acmekit/ui";
84
+ import { useTranslation } from "react-i18next";
85
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
86
+ var WorkflowExecutionGeneralSection = ({
87
+ execution
88
+ }) => {
89
+ const { t } = useTranslation();
90
+ const cleanId = execution.id.replace("wf_exec_", "");
91
+ const translatedState = getTransactionState(
92
+ t,
93
+ execution.state
94
+ );
95
+ const stateColor = getTransactionStateColor(
96
+ execution.state
97
+ );
98
+ return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0", children: [
99
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
100
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-0.5", children: [
101
+ /* @__PURE__ */ jsx2(Heading, { children: cleanId }),
102
+ /* @__PURE__ */ jsx2(Copy, { content: cleanId, className: "text-ui-fg-muted" })
103
+ ] }),
104
+ /* @__PURE__ */ jsx2(StatusBadge, { color: stateColor, children: translatedState })
105
+ ] }),
106
+ /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle grid grid-cols-2 px-6 py-4", children: [
107
+ /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", weight: "plus", children: t("workflowExecutions.workflowIdLabel") }),
108
+ /* @__PURE__ */ jsx2(Badge, { size: "2xsmall", className: "w-fit", children: execution.workflow_id })
109
+ ] }),
110
+ /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle grid grid-cols-2 px-6 py-4", children: [
111
+ /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", weight: "plus", children: t("workflowExecutions.transactionIdLabel") }),
112
+ /* @__PURE__ */ jsx2(Badge, { size: "2xsmall", className: "w-fit", children: execution.transaction_id })
113
+ ] }),
114
+ /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle grid grid-cols-2 px-6 py-4", children: [
115
+ /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", weight: "plus", children: t("workflowExecutions.progressLabel") }),
116
+ /* @__PURE__ */ jsx2(Progress, { steps: execution.execution?.steps })
117
+ ] })
118
+ ] });
119
+ };
120
+ var ROOT_PREFIX = "_root";
121
+ var Progress = ({
122
+ steps
123
+ }) => {
124
+ const { t } = useTranslation();
125
+ if (!steps) {
126
+ return /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: t("workflowExecutions.stepsCompletedLabel", {
127
+ completed: 0,
128
+ total: 0
129
+ }) });
130
+ }
131
+ const actionableSteps = Object.values(steps).filter(
132
+ (step) => step.id !== ROOT_PREFIX
133
+ );
134
+ const completedSteps = actionableSteps.filter(
135
+ (step) => step.invoke.state === "done" /* DONE */
136
+ );
137
+ return /* @__PURE__ */ jsxs("div", { className: "flex w-fit items-center gap-x-2", children: [
138
+ /* @__PURE__ */ jsx2("div", { className: "flex items-center gap-x-[3px]", children: actionableSteps.map((step) => /* @__PURE__ */ jsx2(
139
+ "div",
140
+ {
141
+ className: clx(
142
+ "bg-ui-bg-switch-off shadow-details-switch-background h-3 w-1.5 rounded-full",
143
+ {
144
+ "bg-ui-fg-muted": step.invoke.state === "done" /* DONE */
145
+ }
146
+ )
147
+ },
148
+ step.id
149
+ )) }),
150
+ /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: t("workflowExecutions.stepsCompletedLabel", {
151
+ completed: completedSteps.length,
152
+ count: actionableSteps.length
153
+ }) })
154
+ ] });
155
+ };
156
+
157
+ // src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-history-section/workflow-execution-history-section.tsx
158
+ import { Spinner, TriangleDownMini } from "@acmekit/icons";
159
+ import {
160
+ clx as clx2,
161
+ CodeBlock,
162
+ Container as Container2,
163
+ Heading as Heading2,
164
+ IconButton,
165
+ Text as Text2
166
+ } from "@acmekit/ui";
167
+ import { format } from "date-fns";
168
+ import { Collapsible as RadixCollapsible } from "radix-ui";
169
+ import { useEffect, useRef, useState } from "react";
170
+ import { useTranslation as useTranslation2 } from "react-i18next";
171
+ import { useLocation } from "react-router-dom";
172
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
173
+ var WorkflowExecutionHistorySection = ({
174
+ execution
175
+ }) => {
176
+ const { t } = useTranslation2();
177
+ const map = Object.values(execution.execution?.steps || {});
178
+ const steps = map.filter((step) => step.id !== "_root");
179
+ const unreachableStepId = steps.find(
180
+ (step) => step.invoke.status === "permanent_failure" /* PERMANENT_FAILURE */
181
+ )?.id;
182
+ const unreachableSteps = unreachableStepId ? steps.filter(
183
+ (step) => step.id !== unreachableStepId && step.id.includes(unreachableStepId)
184
+ ).map((step) => step.id) : [];
185
+ return /* @__PURE__ */ jsxs2(Container2, { className: "divide-y p-0", children: [
186
+ /* @__PURE__ */ jsx3("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx3(Heading2, { level: "h2", children: t("workflowExecutions.history.sectionTitle") }) }),
187
+ /* @__PURE__ */ jsx3("div", { className: "flex flex-col gap-y-0.5 px-6 py-4", children: steps.map((step, index) => {
188
+ const stepId = step.id.split(".").pop();
189
+ if (!stepId) {
190
+ return null;
191
+ }
192
+ const context = execution.context?.data.invoke[stepId];
193
+ const error = execution.context?.errors.find(
194
+ (e) => e.action === stepId
195
+ );
196
+ return /* @__PURE__ */ jsx3(
197
+ Event,
198
+ {
199
+ step,
200
+ stepInvokeContext: context,
201
+ stepError: error,
202
+ isLast: index === steps.length - 1,
203
+ isUnreachable: unreachableSteps.includes(step.id)
204
+ },
205
+ step.id
206
+ );
207
+ }) })
208
+ ] });
209
+ };
210
+ var Event = ({
211
+ step,
212
+ stepInvokeContext,
213
+ stepError,
214
+ isLast,
215
+ isUnreachable
216
+ }) => {
217
+ const [open, setOpen] = useState(false);
218
+ const ref = useRef(null);
219
+ const { hash } = useLocation();
220
+ const { t } = useTranslation2();
221
+ const stepId = step.id.split(".").pop();
222
+ useEffect(() => {
223
+ if (hash === `#${stepId}`) {
224
+ setOpen(true);
225
+ }
226
+ }, [hash, stepId]);
227
+ const identifier = step.id.split(".").pop();
228
+ return /* @__PURE__ */ jsxs2(
229
+ "div",
230
+ {
231
+ className: "grid grid-cols-[20px_1fr] items-start gap-x-2 px-2",
232
+ id: stepId,
233
+ children: [
234
+ /* @__PURE__ */ jsxs2("div", { className: "grid h-full grid-rows-[20px_1fr] items-center justify-center gap-y-0.5", children: [
235
+ /* @__PURE__ */ jsx3("div", { className: "flex size-5 items-center justify-center", children: /* @__PURE__ */ jsx3("div", { className: "bg-ui-bg-base shadow-borders-base flex size-2.5 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx3(
236
+ "div",
237
+ {
238
+ className: clx2("size-1.5 rounded-full", {
239
+ "bg-ui-tag-neutral-bg": STEP_SKIPPED_STATES.includes(
240
+ step.invoke.state
241
+ ),
242
+ "bg-ui-tag-green-icon": STEP_OK_STATES.includes(
243
+ step.invoke.state
244
+ ),
245
+ "bg-ui-tag-orange-icon": STEP_IN_PROGRESS_STATES.includes(
246
+ step.invoke.state
247
+ ),
248
+ "bg-ui-tag-red-icon": STEP_ERROR_STATES.includes(
249
+ step.invoke.state
250
+ ),
251
+ "bg-ui-tag-neutral-icon": STEP_INACTIVE_STATES.includes(
252
+ step.invoke.state
253
+ )
254
+ })
255
+ }
256
+ ) }) }),
257
+ /* @__PURE__ */ jsx3("div", { className: "flex h-full flex-col items-center", children: /* @__PURE__ */ jsx3(
258
+ "div",
259
+ {
260
+ "aria-hidden": true,
261
+ role: "presentation",
262
+ className: clx2({
263
+ "bg-ui-border-base h-full min-h-[14px] w-px": !isLast
264
+ })
265
+ }
266
+ ) })
267
+ ] }),
268
+ /* @__PURE__ */ jsxs2(RadixCollapsible.Root, { open, onOpenChange: setOpen, children: [
269
+ /* @__PURE__ */ jsx3(RadixCollapsible.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs2("div", { className: "group flex cursor-pointer items-start justify-between outline-none", children: [
270
+ /* @__PURE__ */ jsx3(Text2, { size: "small", leading: "compact", weight: "plus", children: identifier }),
271
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-2", children: [
272
+ /* @__PURE__ */ jsx3(
273
+ StepState,
274
+ {
275
+ state: step.invoke.state,
276
+ startedAt: step.startedAt,
277
+ isUnreachable
278
+ }
279
+ ),
280
+ /* @__PURE__ */ jsx3(IconButton, { size: "2xsmall", variant: "transparent", children: /* @__PURE__ */ jsx3(TriangleDownMini, { className: "text-ui-fg-muted transition-transform group-data-[state=open]:rotate-180" }) })
281
+ ] })
282
+ ] }) }),
283
+ /* @__PURE__ */ jsx3(RadixCollapsible.Content, { ref, children: /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-y-2 pb-4 pt-2", children: [
284
+ /* @__PURE__ */ jsxs2("div", { className: "text-ui-fg-subtle flex flex-col gap-y-2", children: [
285
+ /* @__PURE__ */ jsx3(Text2, { size: "small", leading: "compact", children: t("workflowExecutions.history.definitionLabel") }),
286
+ /* @__PURE__ */ jsx3(
287
+ CodeBlock,
288
+ {
289
+ snippets: [
290
+ {
291
+ code: JSON.stringify(step.definition, null, 2),
292
+ label: t("workflowExecutions.history.definitionLabel"),
293
+ language: "json",
294
+ hideLineNumbers: true
295
+ }
296
+ ],
297
+ children: /* @__PURE__ */ jsx3(CodeBlock.Body, {})
298
+ }
299
+ )
300
+ ] }),
301
+ stepInvokeContext && /* @__PURE__ */ jsxs2("div", { className: "text-ui-fg-subtle flex flex-col gap-y-2", children: [
302
+ /* @__PURE__ */ jsx3(Text2, { size: "small", leading: "compact", children: t("workflowExecutions.history.outputLabel") }),
303
+ /* @__PURE__ */ jsx3(
304
+ CodeBlock,
305
+ {
306
+ snippets: [
307
+ {
308
+ code: JSON.stringify(
309
+ // TODO: Apply resolve value: packages/core/workflows-sdk/src/utils/composer/helpers/resolve-value.ts
310
+ stepInvokeContext?.output?.output ?? {},
311
+ null,
312
+ 2
313
+ ),
314
+ label: t("workflowExecutions.history.outputLabel"),
315
+ language: "json",
316
+ hideLineNumbers: true
317
+ }
318
+ ],
319
+ children: /* @__PURE__ */ jsx3(CodeBlock.Body, {})
320
+ }
321
+ )
322
+ ] }),
323
+ !!stepInvokeContext?.output?.compensateInput && step.compensate.state === "reverted" /* REVERTED */ && /* @__PURE__ */ jsxs2("div", { className: "text-ui-fg-subtle flex flex-col gap-y-2", children: [
324
+ /* @__PURE__ */ jsx3(Text2, { size: "small", leading: "compact", children: t("workflowExecutions.history.compensateInputLabel") }),
325
+ /* @__PURE__ */ jsx3(
326
+ CodeBlock,
327
+ {
328
+ snippets: [
329
+ {
330
+ // TODO: Apply resolve value: packages/core/workflows-sdk/src/utils/composer/helpers/resolve-value.ts
331
+ code: JSON.stringify(
332
+ stepInvokeContext?.output?.compensateInput ?? {},
333
+ null,
334
+ 2
335
+ ),
336
+ label: t(
337
+ "workflowExecutions.history.compensateInputLabel"
338
+ ),
339
+ language: "json",
340
+ hideLineNumbers: true
341
+ }
342
+ ],
343
+ children: /* @__PURE__ */ jsx3(CodeBlock.Body, {})
344
+ }
345
+ )
346
+ ] }),
347
+ stepError && /* @__PURE__ */ jsxs2("div", { className: "text-ui-fg-subtle flex flex-col gap-y-2", children: [
348
+ /* @__PURE__ */ jsx3(Text2, { size: "small", leading: "compact", children: t("workflowExecutions.history.errorLabel") }),
349
+ /* @__PURE__ */ jsx3(
350
+ CodeBlock,
351
+ {
352
+ snippets: [
353
+ {
354
+ code: JSON.stringify(
355
+ {
356
+ error: stepError.error,
357
+ handlerType: stepError.handlerType
358
+ },
359
+ null,
360
+ 2
361
+ ),
362
+ label: t("workflowExecutions.history.errorLabel"),
363
+ language: "json",
364
+ hideLineNumbers: true
365
+ }
366
+ ],
367
+ children: /* @__PURE__ */ jsx3(CodeBlock.Body, {})
368
+ }
369
+ )
370
+ ] })
371
+ ] }) })
372
+ ] })
373
+ ]
374
+ }
375
+ );
376
+ };
377
+ var StepState = ({
378
+ state,
379
+ startedAt,
380
+ isUnreachable
381
+ }) => {
382
+ const { t } = useTranslation2();
383
+ const isFailed = state === "failed" /* FAILED */;
384
+ const isRunning = state === "invoking" /* INVOKING */;
385
+ const isSkipped = state === "skipped" /* SKIPPED */;
386
+ const isSkippedFailure = state === "skipped_failure" /* SKIPPED_FAILURE */;
387
+ if (isUnreachable) {
388
+ return null;
389
+ }
390
+ if (isRunning) {
391
+ return /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-1", children: [
392
+ /* @__PURE__ */ jsx3(Text2, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: t("workflowExecutions.history.runningState") }),
393
+ /* @__PURE__ */ jsx3(Spinner, { className: "text-ui-fg-interactive animate-spin" })
394
+ ] });
395
+ }
396
+ let stateText;
397
+ if (isSkipped) {
398
+ stateText = t("workflowExecutions.history.skippedState");
399
+ } else if (isSkippedFailure) {
400
+ stateText = t("workflowExecutions.history.skippedFailureState");
401
+ } else if (isFailed) {
402
+ stateText = t("workflowExecutions.history.failedState");
403
+ }
404
+ if (stateText !== null) {
405
+ return /* @__PURE__ */ jsx3(Text2, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: stateText });
406
+ }
407
+ if (startedAt) {
408
+ return /* @__PURE__ */ jsx3(Text2, { size: "small", leading: "compact", className: "text-ui-fg-muted", children: format(startedAt, "dd MMM yyyy HH:mm:ss") });
409
+ }
410
+ };
411
+
412
+ // src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-payload-section/workflow-execution-payload-section.tsx
413
+ import { jsx as jsx4 } from "react/jsx-runtime";
414
+ var WorkflowExecutionPayloadSection = ({
415
+ execution
416
+ }) => {
417
+ let payload = execution.context?.data?.payload;
418
+ if (!payload) {
419
+ return null;
420
+ }
421
+ if (typeof payload !== "object") {
422
+ payload = { input: payload };
423
+ }
424
+ return /* @__PURE__ */ jsx4(JsonViewSection, { data: payload });
425
+ };
426
+
427
+ // src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-timeline-section/workflow-execution-timeline-section.tsx
428
+ import { ArrowPathMini, MinusMini, PlusMini } from "@acmekit/icons";
429
+ import { Container as Container3, DropdownMenu, Heading as Heading3, Text as Text3, clx as clx3 } from "@acmekit/ui";
430
+ import {
431
+ motion,
432
+ useAnimationControls,
433
+ useDragControls,
434
+ useMotionValue
435
+ } from "motion/react";
436
+ import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
437
+ import { useTranslation as useTranslation3 } from "react-i18next";
438
+ import { Link } from "react-router-dom";
439
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
440
+ var WorkflowExecutionTimelineSection = ({
441
+ execution
442
+ }) => {
443
+ const { t } = useTranslation3();
444
+ return /* @__PURE__ */ jsxs3(Container3, { className: "overflow-hidden px-0 pb-8 pt-0", children: [
445
+ /* @__PURE__ */ jsx5("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx5(Heading3, { level: "h2", children: t("general.timeline") }) }),
446
+ /* @__PURE__ */ jsx5("div", { className: "w-full overflow-hidden border-y", children: /* @__PURE__ */ jsx5(Canvas, { execution }) })
447
+ ] });
448
+ };
449
+ var createNodeClusters = (steps) => {
450
+ const actionableSteps = Object.values(steps).filter(
451
+ (step) => step.id !== "_root"
452
+ );
453
+ const clusters = {};
454
+ actionableSteps.forEach((step) => {
455
+ if (!clusters[step.depth]) {
456
+ clusters[step.depth] = [];
457
+ }
458
+ clusters[step.depth].push(step);
459
+ });
460
+ return clusters;
461
+ };
462
+ var getNextCluster = (clusters, depth) => {
463
+ const nextDepth = depth + 1;
464
+ return clusters[nextDepth];
465
+ };
466
+ var defaultState = {
467
+ x: -860,
468
+ y: -1020,
469
+ scale: 1
470
+ };
471
+ var MAX_ZOOM = 1.5;
472
+ var MIN_ZOOM = 0.5;
473
+ var ZOOM_STEP = 0.25;
474
+ var Canvas = ({
475
+ execution
476
+ }) => {
477
+ const [zoom, setZoom] = useState2(1);
478
+ const [isDragging, setIsDragging] = useState2(false);
479
+ const direction = useDocumentDirection();
480
+ const scale = useMotionValue(defaultState.scale);
481
+ const x = useMotionValue(defaultState.x);
482
+ const y = useMotionValue(defaultState.y);
483
+ const controls = useAnimationControls();
484
+ const dragControls = useDragControls();
485
+ const dragConstraints = useRef2(null);
486
+ const canZoomIn = zoom < MAX_ZOOM;
487
+ const canZoomOut = zoom > MIN_ZOOM;
488
+ useEffect2(() => {
489
+ const unsubscribe = scale.on("change", (latest) => {
490
+ setZoom(latest);
491
+ });
492
+ return () => {
493
+ unsubscribe();
494
+ };
495
+ }, [scale]);
496
+ const clusters = createNodeClusters(execution.execution?.steps || {});
497
+ function scaleXandY(prevScale, newScale, x2, y2) {
498
+ const scaleRatio = newScale / prevScale;
499
+ return {
500
+ x: x2 * scaleRatio,
501
+ y: y2 * scaleRatio
502
+ };
503
+ }
504
+ const changeZoom = (newScale) => {
505
+ const { x: newX, y: newY } = scaleXandY(zoom, newScale, x.get(), y.get());
506
+ setZoom(newScale);
507
+ controls.set({ scale: newScale, x: newX, y: newY });
508
+ };
509
+ const zoomIn = () => {
510
+ const curr = scale.get();
511
+ if (curr < 1.5) {
512
+ const newScale = curr + ZOOM_STEP;
513
+ changeZoom(newScale);
514
+ }
515
+ };
516
+ const zoomOut = () => {
517
+ const curr = scale.get();
518
+ if (curr > 0.5) {
519
+ const newScale = curr - ZOOM_STEP;
520
+ changeZoom(newScale);
521
+ }
522
+ };
523
+ const resetCanvas = () => {
524
+ controls.start(defaultState);
525
+ };
526
+ return /* @__PURE__ */ jsx5("div", { className: "h-[400px] w-full", children: /* @__PURE__ */ jsxs3("div", { ref: dragConstraints, className: "relative size-full", children: [
527
+ /* @__PURE__ */ jsx5("div", { className: "relative size-full overflow-hidden object-contain", children: /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsx5(
528
+ motion.div,
529
+ {
530
+ onMouseDown: () => setIsDragging(true),
531
+ onMouseUp: () => setIsDragging(false),
532
+ drag: true,
533
+ dragConstraints,
534
+ dragElastic: 0,
535
+ dragMomentum: false,
536
+ dragControls,
537
+ initial: false,
538
+ animate: controls,
539
+ transition: { duration: 0.25 },
540
+ style: {
541
+ x,
542
+ y,
543
+ scale
544
+ },
545
+ className: clx3(
546
+ "bg-ui-bg-subtle relative size-[500rem] origin-top-left items-start justify-start overflow-hidden",
547
+ "bg-[radial-gradient(var(--border-base)_1.5px,transparent_0)] bg-[length:20px_20px] bg-repeat",
548
+ {
549
+ "cursor-grab": !isDragging,
550
+ "cursor-grabbing": isDragging
551
+ }
552
+ ),
553
+ children: /* @__PURE__ */ jsx5("main", { className: "size-full", children: /* @__PURE__ */ jsx5("div", { className: "absolute left-[1100px] top-[1100px] flex select-none items-start", children: Object.entries(clusters).map(([depth, cluster]) => {
554
+ const next = getNextCluster(clusters, Number(depth));
555
+ return /* @__PURE__ */ jsxs3("div", { className: "flex items-start", children: [
556
+ /* @__PURE__ */ jsx5("div", { className: "flex flex-col justify-center gap-y-2", children: cluster.map((step) => /* @__PURE__ */ jsx5(Node, { step }, step.id)) }),
557
+ /* @__PURE__ */ jsx5(Line, { next })
558
+ ] }, depth);
559
+ }) }) })
560
+ }
561
+ ) }) }),
562
+ /* @__PURE__ */ jsxs3("div", { className: "bg-ui-bg-base shadow-borders-base text-ui-fg-subtle absolute bottom-4 left-6 flex h-7 items-center overflow-hidden rounded-md", children: [
563
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center", children: [
564
+ /* @__PURE__ */ jsx5(
565
+ "button",
566
+ {
567
+ onClick: zoomIn,
568
+ type: "button",
569
+ disabled: !canZoomIn,
570
+ "aria-label": "Zoom in",
571
+ className: "disabled:text-ui-fg-disabled transition-fg hover:bg-ui-bg-base-hover active:bg-ui-bg-base-pressed focus-visible:bg-ui-bg-base-pressed border-r p-1 outline-none",
572
+ children: /* @__PURE__ */ jsx5(PlusMini, {})
573
+ }
574
+ ),
575
+ /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsxs3(DropdownMenu, { dir: direction, children: [
576
+ /* @__PURE__ */ jsx5(DropdownMenu.Trigger, { className: "disabled:text-ui-fg-disabled transition-fg hover:bg-ui-bg-base-hover active:bg-ui-bg-base-pressed focus-visible:bg-ui-bg-base-pressed flex w-[50px] items-center justify-center border-r p-1 outline-none", children: /* @__PURE__ */ jsxs3(
577
+ Text3,
578
+ {
579
+ as: "span",
580
+ size: "xsmall",
581
+ leading: "compact",
582
+ className: "select-none tabular-nums",
583
+ children: [
584
+ Math.round(zoom * 100),
585
+ "%"
586
+ ]
587
+ }
588
+ ) }),
589
+ /* @__PURE__ */ jsx5(DropdownMenu.Content, { children: [50, 75, 100, 125, 150].map((value) => /* @__PURE__ */ jsxs3(
590
+ DropdownMenu.Item,
591
+ {
592
+ onClick: () => changeZoom(value / 100),
593
+ children: [
594
+ value,
595
+ "%"
596
+ ]
597
+ },
598
+ value
599
+ )) })
600
+ ] }) }),
601
+ /* @__PURE__ */ jsx5(
602
+ "button",
603
+ {
604
+ onClick: zoomOut,
605
+ type: "button",
606
+ disabled: !canZoomOut,
607
+ "aria-label": "Zoom out",
608
+ className: "disabled:text-ui-fg-disabled transition-fg hover:bg-ui-bg-base-hover active:bg-ui-bg-base-pressed focus-visible:bg-ui-bg-base-pressed border-r p-1 outline-none",
609
+ children: /* @__PURE__ */ jsx5(MinusMini, {})
610
+ }
611
+ )
612
+ ] }),
613
+ /* @__PURE__ */ jsx5(
614
+ "button",
615
+ {
616
+ onClick: resetCanvas,
617
+ type: "button",
618
+ "aria-label": "Reset canvas",
619
+ className: "disabled:text-ui-fg-disabled transition-fg hover:bg-ui-bg-base-hover active:bg-ui-bg-base-pressed focus-visible:bg-ui-bg-base-pressed p-1 outline-none",
620
+ children: /* @__PURE__ */ jsx5(ArrowPathMini, {})
621
+ }
622
+ )
623
+ ] })
624
+ ] }) });
625
+ };
626
+ var HorizontalArrow = () => {
627
+ return /* @__PURE__ */ jsx5(
628
+ "svg",
629
+ {
630
+ width: "42",
631
+ height: "12",
632
+ viewBox: "0 0 42 12",
633
+ fill: "none",
634
+ xmlns: "http://www.w3.org/2000/svg",
635
+ children: /* @__PURE__ */ jsx5(
636
+ "path",
637
+ {
638
+ d: "M41.5303 6.53033C41.8232 6.23744 41.8232 5.76256 41.5303 5.46967L36.7574 0.696699C36.4645 0.403806 35.9896 0.403806 35.6967 0.696699C35.4038 0.989593 35.4038 1.46447 35.6967 1.75736L39.9393 6L35.6967 10.2426C35.4038 10.5355 35.4038 11.0104 35.6967 11.3033C35.9896 11.5962 36.4645 11.5962 36.7574 11.3033L41.5303 6.53033ZM0.999996 5.25C0.585785 5.25 0.249996 5.58579 0.249996 6C0.249996 6.41421 0.585785 6.75 0.999996 6.75V5.25ZM41 5.25L0.999996 5.25V6.75L41 6.75V5.25Z",
639
+ fill: "var(--border-strong)"
640
+ }
641
+ )
642
+ }
643
+ );
644
+ };
645
+ var MiddleArrow = () => {
646
+ return /* @__PURE__ */ jsx5(
647
+ "svg",
648
+ {
649
+ width: "22",
650
+ height: "38",
651
+ viewBox: "0 0 22 38",
652
+ fill: "none",
653
+ xmlns: "http://www.w3.org/2000/svg",
654
+ className: "-mt-[6px]",
655
+ children: /* @__PURE__ */ jsx5(
656
+ "path",
657
+ {
658
+ d: "M0.999878 32H0.249878V32.75H0.999878V32ZM21.5284 32.5303C21.8213 32.2374 21.8213 31.7626 21.5284 31.4697L16.7554 26.6967C16.4625 26.4038 15.9876 26.4038 15.6947 26.6967C15.4019 26.9896 15.4019 27.4645 15.6947 27.7574L19.9374 32L15.6947 36.2426C15.4019 36.5355 15.4019 37.0104 15.6947 37.3033C15.9876 37.5962 16.4625 37.5962 16.7554 37.3033L21.5284 32.5303ZM0.249878 0L0.249878 32H1.74988L1.74988 0H0.249878ZM0.999878 32.75L20.998 32.75V31.25L0.999878 31.25V32.75Z",
659
+ fill: "var(--border-strong)"
660
+ }
661
+ )
662
+ }
663
+ );
664
+ };
665
+ var EndArrow = () => {
666
+ return /* @__PURE__ */ jsx5(
667
+ "svg",
668
+ {
669
+ width: "22",
670
+ height: "38",
671
+ viewBox: "0 0 22 38",
672
+ fill: "none",
673
+ xmlns: "http://www.w3.org/2000/svg",
674
+ className: "-mt-[6px]",
675
+ children: /* @__PURE__ */ jsx5(
676
+ "path",
677
+ {
678
+ d: "M21.5284 32.5303C21.8213 32.2374 21.8213 31.7626 21.5284 31.4697L16.7554 26.6967C16.4625 26.4038 15.9876 26.4038 15.6947 26.6967C15.4019 26.9896 15.4019 27.4645 15.6947 27.7574L19.9374 32L15.6947 36.2426C15.4019 36.5355 15.4019 37.0104 15.6947 37.3033C15.9876 37.5962 16.4625 37.5962 16.7554 37.3033L21.5284 32.5303ZM0.249878 0L0.249878 28H1.74988L1.74988 0H0.249878ZM4.99988 32.75L20.998 32.75V31.25L4.99988 31.25V32.75ZM0.249878 28C0.249878 30.6234 2.37653 32.75 4.99988 32.75V31.25C3.20495 31.25 1.74988 29.7949 1.74988 28H0.249878Z",
679
+ fill: "var(--border-strong)"
680
+ }
681
+ )
682
+ }
683
+ );
684
+ };
685
+ var Arrow = ({ depth }) => {
686
+ if (depth === 1) {
687
+ return /* @__PURE__ */ jsx5(HorizontalArrow, {});
688
+ }
689
+ if (depth === 2) {
690
+ return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-end", children: [
691
+ /* @__PURE__ */ jsx5(HorizontalArrow, {}),
692
+ /* @__PURE__ */ jsx5(EndArrow, {})
693
+ ] });
694
+ }
695
+ const inbetween = Array.from({ length: depth - 2 }).map((_, index) => /* @__PURE__ */ jsx5(MiddleArrow, {}, index));
696
+ return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-end", children: [
697
+ /* @__PURE__ */ jsx5(HorizontalArrow, {}),
698
+ inbetween,
699
+ /* @__PURE__ */ jsx5(EndArrow, {})
700
+ ] });
701
+ };
702
+ var Line = ({ next }) => {
703
+ if (!next) {
704
+ return null;
705
+ }
706
+ return /* @__PURE__ */ jsx5("div", { className: "-ml-[5px] -mr-[7px] w-[60px] pr-[7px]", children: /* @__PURE__ */ jsxs3("div", { className: "flex min-h-[24px] w-full items-start", children: [
707
+ /* @__PURE__ */ jsx5("div", { className: "flex h-6 w-2.5 items-center justify-center", children: /* @__PURE__ */ jsx5("div", { className: "bg-ui-button-neutral shadow-borders-base size-2.5 shrink-0 rounded-full" }) }),
708
+ /* @__PURE__ */ jsx5("div", { className: "pt-1.5", children: /* @__PURE__ */ jsx5(Arrow, { depth: next.length }) })
709
+ ] }) });
710
+ };
711
+ var Node = ({ step }) => {
712
+ if (step.id === "_root") {
713
+ return null;
714
+ }
715
+ const stepId = step.id.split(".").pop();
716
+ const handleScrollTo = () => {
717
+ if (!stepId) {
718
+ return;
719
+ }
720
+ const historyItem = document.getElementById(stepId);
721
+ if (!historyItem) {
722
+ return;
723
+ }
724
+ setTimeout(() => {
725
+ historyItem.scrollIntoView({
726
+ behavior: "smooth",
727
+ block: "end"
728
+ });
729
+ }, 100);
730
+ };
731
+ return /* @__PURE__ */ jsx5(
732
+ Link,
733
+ {
734
+ to: `#${stepId}`,
735
+ onClick: handleScrollTo,
736
+ className: "focus-visible:shadow-borders-focus transition-fg rounded-md outline-none",
737
+ children: /* @__PURE__ */ jsxs3(
738
+ "div",
739
+ {
740
+ className: "bg-ui-bg-base shadow-borders-base flex min-w-[120px] items-center gap-x-0.5 rounded-md p-0.5",
741
+ "data-step-id": step.id,
742
+ children: [
743
+ /* @__PURE__ */ jsx5("div", { className: "flex size-5 items-center justify-center", children: /* @__PURE__ */ jsx5(
744
+ "div",
745
+ {
746
+ className: clx3(
747
+ "size-2 rounded-sm shadow-[inset_0_0_0_1px_rgba(0,0,0,0.12)]",
748
+ {
749
+ "bg-ui-tag-neutral-bg": STEP_SKIPPED_STATES.includes(
750
+ step.invoke.state
751
+ ),
752
+ "bg-ui-tag-green-icon": STEP_OK_STATES.includes(
753
+ step.invoke.state
754
+ ),
755
+ "bg-ui-tag-orange-icon": STEP_IN_PROGRESS_STATES.includes(
756
+ step.invoke.state
757
+ ),
758
+ "bg-ui-tag-red-icon": STEP_ERROR_STATES.includes(
759
+ step.invoke.state
760
+ ),
761
+ "bg-ui-tag-neutral-icon": STEP_INACTIVE_STATES.includes(
762
+ step.invoke.state
763
+ )
764
+ }
765
+ )
766
+ }
767
+ ) }),
768
+ /* @__PURE__ */ jsx5(
769
+ Text3,
770
+ {
771
+ size: "xsmall",
772
+ leading: "compact",
773
+ weight: "plus",
774
+ className: "select-none",
775
+ children: stepId
776
+ }
777
+ )
778
+ ]
779
+ }
780
+ )
781
+ }
782
+ );
783
+ };
784
+
785
+ // src/routes/workflow-executions/workflow-execution-detail/workflow-detail.tsx
786
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
787
+ var ExecutionDetail = () => {
788
+ const { id } = useParams();
789
+ const { workflow_execution, isLoading, isError, error } = useWorkflowExecution(id);
790
+ const { getWidgets } = useExtension();
791
+ if (isLoading || !workflow_execution) {
792
+ return /* @__PURE__ */ jsx6(SingleColumnPageSkeleton, { sections: 4, showJSON: true });
793
+ }
794
+ if (isError) {
795
+ throw error;
796
+ }
797
+ return /* @__PURE__ */ jsxs4(
798
+ SingleColumnPage,
799
+ {
800
+ widgets: {
801
+ after: getWidgets("workflow.details.after"),
802
+ before: getWidgets("workflow.details.before")
803
+ },
804
+ data: workflow_execution,
805
+ showJSON: true,
806
+ children: [
807
+ /* @__PURE__ */ jsx6(WorkflowExecutionGeneralSection, { execution: workflow_execution }),
808
+ /* @__PURE__ */ jsx6(WorkflowExecutionTimelineSection, { execution: workflow_execution }),
809
+ /* @__PURE__ */ jsx6(WorkflowExecutionPayloadSection, { execution: workflow_execution }),
810
+ /* @__PURE__ */ jsx6(WorkflowExecutionHistorySection, { execution: workflow_execution })
811
+ ]
812
+ }
813
+ );
814
+ };
815
+ export {
816
+ WorkflowExecutionDetailBreadcrumb as Breadcrumb,
817
+ ExecutionDetail as Component,
818
+ workflowExecutionLoader as loader
819
+ };