@burdenoff/microfe-subscriberbot 2026.1029.1 → 2026.1030.1
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.
- package/dist/subscriberbot/SubscriberBotRoutes.d.ts.map +1 -1
- package/dist/subscriberbot/SubscriberBotRoutes.js +2 -2
- package/dist/subscriberbot/SubscriberBotRoutes.js.map +1 -1
- package/dist/subscriberbot/hooks/index.d.ts +2 -0
- package/dist/subscriberbot/hooks/index.d.ts.map +1 -1
- package/dist/subscriberbot/hooks/index.js +1 -0
- package/dist/subscriberbot/hooks/useRouteSelection.d.ts +15 -0
- package/dist/subscriberbot/hooks/useRouteSelection.d.ts.map +1 -0
- package/dist/subscriberbot/hooks/useRouteSelection.js +18 -0
- package/dist/subscriberbot/hooks/useRouteSelection.js.map +1 -0
- package/dist/subscriberbot/pages/InboxPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/InboxPage.js +211 -210
- package/dist/subscriberbot/pages/InboxPage.js.map +1 -1
- package/dist/subscriberbot/pages/WorkflowsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/WorkflowsPage.js +166 -165
- package/dist/subscriberbot/pages/WorkflowsPage.js.map +1 -1
- package/dist/subscriberbot/utils/pageContext.d.ts +43 -11
- package/dist/subscriberbot/utils/pageContext.d.ts.map +1 -1
- package/dist/subscriberbot/utils/pageContext.js +42 -37
- package/dist/subscriberbot/utils/pageContext.js.map +1 -1
- package/package.json +4 -2
|
@@ -8,12 +8,13 @@ import { useTr as o } from "../hooks/useTr.js";
|
|
|
8
8
|
import { ErrorView as s, LoadingView as c } from "../components/StateViews.js";
|
|
9
9
|
import "../components/index.js";
|
|
10
10
|
import { useActivateWorkflow as l, useCreateWorkflow as u, useWorkflows as d } from "../hooks/useSubscriberBotApi.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
11
|
+
import { useRouteSelection as f } from "../hooks/useRouteSelection.js";
|
|
12
|
+
import { useState as p } from "react";
|
|
13
|
+
import { ArrowRight as m, CheckCircle2 as h, Clock as g, Play as _, Plus as v, Sparkles as y, Workflow as b, X as x, Zap as S } from "lucide-react";
|
|
14
|
+
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
15
|
+
import { GlassCard as E, PagePurpose as D } from "@burdenoff/fe-libs/ui";
|
|
15
16
|
//#region src/subscriberbot/pages/WorkflowsPage.tsx
|
|
16
|
-
var
|
|
17
|
+
var O = [
|
|
17
18
|
{
|
|
18
19
|
value: "",
|
|
19
20
|
labelKey: "workflows.filters.allStatuses",
|
|
@@ -39,30 +40,30 @@ var D = [
|
|
|
39
40
|
labelKey: "workflows.filters.archived",
|
|
40
41
|
fallback: "Archived"
|
|
41
42
|
}
|
|
42
|
-
],
|
|
43
|
-
function
|
|
44
|
-
return /* @__PURE__ */
|
|
43
|
+
], k = "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", A = "mb-1 block text-xs font-medium text-text-secondary";
|
|
44
|
+
function j({ icon: e, kicker: t, title: n, sub: r, accent: i }) {
|
|
45
|
+
return /* @__PURE__ */ T("div", {
|
|
45
46
|
className: "w-48 shrink-0 overflow-hidden rounded-xl border border-border-subtle bg-bg-surface shadow-sm",
|
|
46
|
-
children: [/* @__PURE__ */
|
|
47
|
+
children: [/* @__PURE__ */ w("div", {
|
|
47
48
|
className: `h-1 w-full ${i === "done" ? "bg-status-success-text" : i === "run" ? "bg-status-warning-text" : "bg-[var(--color-accent-indigo)]"}`,
|
|
48
49
|
"aria-hidden": !0
|
|
49
|
-
}), /* @__PURE__ */
|
|
50
|
+
}), /* @__PURE__ */ T("div", {
|
|
50
51
|
className: "p-3",
|
|
51
52
|
children: [
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */ w("span", {
|
|
53
54
|
className: "flex size-8 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-text-primary",
|
|
54
55
|
children: e
|
|
55
56
|
}),
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ w("p", {
|
|
57
58
|
className: "mt-2 text-[10px] font-medium uppercase tracking-wide text-text-secondary",
|
|
58
59
|
children: t
|
|
59
60
|
}),
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ w("p", {
|
|
61
62
|
className: "truncate text-sm font-semibold text-text-primary",
|
|
62
63
|
title: n,
|
|
63
64
|
children: n
|
|
64
65
|
}),
|
|
65
|
-
r && /* @__PURE__ */
|
|
66
|
+
r && /* @__PURE__ */ w("p", {
|
|
66
67
|
className: "mt-0.5 truncate text-xs text-text-secondary",
|
|
67
68
|
children: r
|
|
68
69
|
})
|
|
@@ -70,36 +71,36 @@ function A({ icon: e, kicker: t, title: n, sub: r, accent: i }) {
|
|
|
70
71
|
})]
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
-
let s = o(), c = /* @__PURE__ */
|
|
74
|
+
function M({ workflow: e, onClose: t, onActivate: i, activating: a }) {
|
|
75
|
+
let s = o(), c = /* @__PURE__ */ T("div", {
|
|
75
76
|
className: "flex shrink-0 items-center px-1 text-text-secondary",
|
|
76
77
|
"aria-hidden": !0,
|
|
77
|
-
children: [/* @__PURE__ */
|
|
78
|
+
children: [/* @__PURE__ */ w("span", { className: "h-px w-4 bg-border-seam sm:w-6" }), /* @__PURE__ */ w(m, { className: "h-4 w-4" })]
|
|
78
79
|
}), l = e.status.charAt(0) + e.status.slice(1).toLowerCase();
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
+
return /* @__PURE__ */ T(E, {
|
|
80
81
|
treatment: "glass",
|
|
81
82
|
glow: !0,
|
|
82
83
|
className: "mt-6 p-5",
|
|
83
84
|
children: [
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ T("div", {
|
|
85
86
|
className: "flex flex-wrap items-start justify-between gap-3",
|
|
86
|
-
children: [/* @__PURE__ */
|
|
87
|
+
children: [/* @__PURE__ */ T("div", {
|
|
87
88
|
className: "min-w-0",
|
|
88
|
-
children: [/* @__PURE__ */
|
|
89
|
+
children: [/* @__PURE__ */ T("div", {
|
|
89
90
|
className: "flex flex-wrap items-center gap-2",
|
|
90
|
-
children: [/* @__PURE__ */
|
|
91
|
+
children: [/* @__PURE__ */ w("p", {
|
|
91
92
|
className: "text-base font-semibold text-text-primary",
|
|
92
93
|
children: e.name
|
|
93
|
-
}), /* @__PURE__ */
|
|
94
|
-
}), /* @__PURE__ */
|
|
94
|
+
}), /* @__PURE__ */ w(r, { status: e.status })]
|
|
95
|
+
}), /* @__PURE__ */ T("p", {
|
|
95
96
|
className: "mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-text-secondary",
|
|
96
|
-
children: [/* @__PURE__ */
|
|
97
|
+
children: [/* @__PURE__ */ w("span", {
|
|
97
98
|
className: "tabular-nums",
|
|
98
99
|
children: s("workflows.flow.ran", "Ran {{count}}×", { count: e.runCount })
|
|
99
|
-
}), e.lastRunAt && /* @__PURE__ */
|
|
100
|
+
}), e.lastRunAt && /* @__PURE__ */ T("span", {
|
|
100
101
|
className: "inline-flex items-center gap-1",
|
|
101
102
|
children: [
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ w(g, {
|
|
103
104
|
className: "h-3 w-3",
|
|
104
105
|
"aria-hidden": !0
|
|
105
106
|
}),
|
|
@@ -108,58 +109,58 @@ function j({ workflow: e, onClose: t, onActivate: i, activating: a }) {
|
|
|
108
109
|
]
|
|
109
110
|
})]
|
|
110
111
|
})]
|
|
111
|
-
}), /* @__PURE__ */
|
|
112
|
+
}), /* @__PURE__ */ w("button", {
|
|
112
113
|
type: "button",
|
|
113
114
|
onClick: t,
|
|
114
115
|
"aria-label": s("workflows.flow.closeAriaLabel", "Close flow"),
|
|
115
116
|
className: "rounded-lg border border-border-subtle p-1.5 text-text-secondary hover:bg-bg-sunken hover:text-text-primary",
|
|
116
|
-
children: /* @__PURE__ */
|
|
117
|
+
children: /* @__PURE__ */ w(x, { className: "h-4 w-4" })
|
|
117
118
|
})]
|
|
118
119
|
}),
|
|
119
|
-
e.description && /* @__PURE__ */
|
|
120
|
+
e.description && /* @__PURE__ */ w("p", {
|
|
120
121
|
className: "mt-2 max-w-3xl text-sm text-text-secondary",
|
|
121
122
|
children: e.description
|
|
122
123
|
}),
|
|
123
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ w("div", {
|
|
124
125
|
className: "mt-4 overflow-x-auto pb-2",
|
|
125
|
-
children: /* @__PURE__ */
|
|
126
|
+
children: /* @__PURE__ */ T("div", {
|
|
126
127
|
className: "flex min-w-max items-stretch",
|
|
127
128
|
children: [
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ w(j, {
|
|
129
130
|
accent: "trigger",
|
|
130
131
|
kicker: s("workflows.flow.trigger", "When"),
|
|
131
|
-
icon: /* @__PURE__ */
|
|
132
|
+
icon: /* @__PURE__ */ w(S, { className: "h-4 w-4" }),
|
|
132
133
|
title: e.triggerEvent,
|
|
133
134
|
sub: s("workflows.flow.triggerEvent", "Trigger event")
|
|
134
135
|
}),
|
|
135
136
|
c,
|
|
136
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ w(j, {
|
|
137
138
|
accent: "run",
|
|
138
139
|
kicker: s("workflows.flow.run", "Run"),
|
|
139
|
-
icon: /* @__PURE__ */
|
|
140
|
+
icon: /* @__PURE__ */ w(y, { className: "h-4 w-4" }),
|
|
140
141
|
title: e.name,
|
|
141
142
|
sub: s("workflows.flow.automation", "Automation")
|
|
142
143
|
}),
|
|
143
144
|
c,
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ w(j, {
|
|
145
146
|
accent: "done",
|
|
146
147
|
kicker: s("workflows.flow.then", "Then"),
|
|
147
|
-
icon: /* @__PURE__ */
|
|
148
|
+
icon: /* @__PURE__ */ w(h, { className: "h-4 w-4" }),
|
|
148
149
|
title: e.status === "ACTIVE" ? s("workflows.flow.live", "Live") : s("workflows.flow.awaitingActivation", "Awaiting activation"),
|
|
149
150
|
sub: s("workflows.flow.status", "Status: {{status}}", { status: l })
|
|
150
151
|
})
|
|
151
152
|
]
|
|
152
153
|
})
|
|
153
154
|
}),
|
|
154
|
-
e.status !== "ACTIVE" && /* @__PURE__ */
|
|
155
|
+
e.status !== "ACTIVE" && /* @__PURE__ */ w("div", {
|
|
155
156
|
className: "mt-3 flex justify-end",
|
|
156
|
-
children: /* @__PURE__ */
|
|
157
|
+
children: /* @__PURE__ */ T("button", {
|
|
157
158
|
type: "button",
|
|
158
159
|
disabled: a,
|
|
159
160
|
onClick: i,
|
|
160
161
|
className: "inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50",
|
|
161
162
|
children: [
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ w(_, { className: "h-4 w-4" }),
|
|
163
164
|
" ",
|
|
164
165
|
a ? s("common.activating", "Activating…") : s("workflows.flow.activate", "Activate workflow")
|
|
165
166
|
]
|
|
@@ -168,153 +169,153 @@ function j({ workflow: e, onClose: t, onActivate: i, activating: a }) {
|
|
|
168
169
|
]
|
|
169
170
|
});
|
|
170
171
|
}
|
|
171
|
-
function
|
|
172
|
-
let [
|
|
173
|
-
|
|
174
|
-
},
|
|
175
|
-
|
|
172
|
+
function N() {
|
|
173
|
+
let [m, h] = p(""), [g, y] = p(!1), [x, j] = f("workflows"), N = o(), { data: P, isLoading: F, isError: I, refetch: L } = d(m || void 0), R = u(), z = l(), [B, V] = p(""), [H, U] = p(""), [W, G] = p(""), [K, q] = p(null), J = P ?? [], Y = J.find((e) => e.id === x) ?? null, X = J.filter((e) => e.status === "ACTIVE").length, Z = J.reduce((e, t) => e + (t.runCount || 0), 0), Q = () => {
|
|
174
|
+
V(""), U(""), G(""), q(null);
|
|
175
|
+
}, $ = () => {
|
|
176
|
+
y(!1), Q();
|
|
176
177
|
};
|
|
177
|
-
return /* @__PURE__ */
|
|
178
|
-
title:
|
|
179
|
-
description:
|
|
180
|
-
actions: /* @__PURE__ */
|
|
178
|
+
return /* @__PURE__ */ T(e, {
|
|
179
|
+
title: N("workflows.title", "Workflows"),
|
|
180
|
+
description: N("workflows.description", "Event-driven automation across your portfolio"),
|
|
181
|
+
actions: /* @__PURE__ */ T("button", {
|
|
181
182
|
type: "button",
|
|
182
|
-
onClick: () =>
|
|
183
|
+
onClick: () => y(!0),
|
|
183
184
|
className: "inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90",
|
|
184
185
|
children: [
|
|
185
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ w(v, { className: "h-4 w-4" }),
|
|
186
187
|
" ",
|
|
187
|
-
|
|
188
|
+
N("workflows.newWorkflow", "New workflow")
|
|
188
189
|
]
|
|
189
190
|
}),
|
|
190
191
|
children: [
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */ w(D, {
|
|
192
193
|
className: "mb-4",
|
|
193
|
-
children:
|
|
194
|
+
children: N("workflows.purpose", "Workflows react to domain events — a new invoice, a detected renewal, a cancelled relationship — and run multi-step automations. Draft a workflow, then activate it when you're ready.")
|
|
194
195
|
}),
|
|
195
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ w("div", {
|
|
196
197
|
className: "flex flex-wrap items-center gap-3",
|
|
197
|
-
children: /* @__PURE__ */
|
|
198
|
-
"aria-label":
|
|
199
|
-
value:
|
|
200
|
-
onChange: (e) =>
|
|
198
|
+
children: /* @__PURE__ */ w("select", {
|
|
199
|
+
"aria-label": N("common.filter", "Filter"),
|
|
200
|
+
value: m,
|
|
201
|
+
onChange: (e) => h(e.target.value),
|
|
201
202
|
className: "rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-xs text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
|
|
202
|
-
children:
|
|
203
|
+
children: O.map((e) => /* @__PURE__ */ w("option", {
|
|
203
204
|
value: e.value,
|
|
204
|
-
children:
|
|
205
|
+
children: N(e.labelKey, e.fallback)
|
|
205
206
|
}, e.value))
|
|
206
207
|
})
|
|
207
208
|
}),
|
|
208
|
-
|
|
209
|
-
message:
|
|
210
|
-
onRetry: () => void
|
|
211
|
-
}) :
|
|
209
|
+
F ? /* @__PURE__ */ w(c, { label: N("workflows.loading", "Loading workflows…") }) : I ? /* @__PURE__ */ w(s, {
|
|
210
|
+
message: N("workflows.error", "Could not load workflows."),
|
|
211
|
+
onRetry: () => void L()
|
|
212
|
+
}) : J.length === 0 ? /* @__PURE__ */ w("div", {
|
|
212
213
|
className: "mt-6",
|
|
213
|
-
children: /* @__PURE__ */
|
|
214
|
+
children: /* @__PURE__ */ w(i, {
|
|
214
215
|
illustration: "empty-data",
|
|
215
|
-
icon: /* @__PURE__ */
|
|
216
|
-
title:
|
|
217
|
-
description:
|
|
218
|
-
action: /* @__PURE__ */
|
|
216
|
+
icon: /* @__PURE__ */ w(b, { className: "h-12 w-12" }),
|
|
217
|
+
title: N("workflows.empty.title", "No workflows yet"),
|
|
218
|
+
description: N("workflows.empty.description", "Create your first event-driven workflow to automate your recurring portfolio."),
|
|
219
|
+
action: /* @__PURE__ */ w("button", {
|
|
219
220
|
type: "button",
|
|
220
|
-
onClick: () =>
|
|
221
|
+
onClick: () => y(!0),
|
|
221
222
|
className: "rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90",
|
|
222
|
-
children:
|
|
223
|
+
children: N("workflows.newWorkflow", "New workflow")
|
|
223
224
|
})
|
|
224
225
|
})
|
|
225
|
-
}) : /* @__PURE__ */
|
|
226
|
-
/* @__PURE__ */
|
|
226
|
+
}) : /* @__PURE__ */ T(C, { children: [
|
|
227
|
+
/* @__PURE__ */ T("div", {
|
|
227
228
|
className: "mt-6 grid grid-cols-1 gap-4 sm:grid-cols-3",
|
|
228
229
|
children: [
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
-
icon: /* @__PURE__ */
|
|
231
|
-
value:
|
|
232
|
-
label:
|
|
230
|
+
/* @__PURE__ */ w(t, {
|
|
231
|
+
icon: /* @__PURE__ */ w(b, { className: "h-5 w-5" }),
|
|
232
|
+
value: J.length,
|
|
233
|
+
label: N("workflows.metrics.workflows", "Workflows")
|
|
233
234
|
}),
|
|
234
|
-
/* @__PURE__ */
|
|
235
|
-
icon: /* @__PURE__ */
|
|
236
|
-
value: Y,
|
|
237
|
-
label: M("workflows.metrics.active", "Active")
|
|
238
|
-
}),
|
|
239
|
-
/* @__PURE__ */ C(t, {
|
|
240
|
-
icon: /* @__PURE__ */ C(g, { className: "h-5 w-5" }),
|
|
235
|
+
/* @__PURE__ */ w(t, {
|
|
236
|
+
icon: /* @__PURE__ */ w(S, { className: "h-5 w-5" }),
|
|
241
237
|
value: X,
|
|
242
|
-
label:
|
|
238
|
+
label: N("workflows.metrics.active", "Active")
|
|
239
|
+
}),
|
|
240
|
+
/* @__PURE__ */ w(t, {
|
|
241
|
+
icon: /* @__PURE__ */ w(_, { className: "h-5 w-5" }),
|
|
242
|
+
value: Z,
|
|
243
|
+
label: N("workflows.metrics.totalRuns", "Total runs")
|
|
243
244
|
})
|
|
244
245
|
]
|
|
245
246
|
}),
|
|
246
|
-
|
|
247
|
-
workflow:
|
|
248
|
-
onClose: () =>
|
|
249
|
-
onActivate: () =>
|
|
250
|
-
activating:
|
|
247
|
+
Y && /* @__PURE__ */ w(M, {
|
|
248
|
+
workflow: Y,
|
|
249
|
+
onClose: () => j(null),
|
|
250
|
+
onActivate: () => z.mutate(Y.id),
|
|
251
|
+
activating: z.isPending
|
|
251
252
|
}),
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ w("div", {
|
|
253
254
|
className: "mt-6 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",
|
|
254
|
-
children:
|
|
255
|
-
let t = e.id ===
|
|
256
|
-
return /* @__PURE__ */
|
|
255
|
+
children: J.map((e) => {
|
|
256
|
+
let t = e.id === x;
|
|
257
|
+
return /* @__PURE__ */ T(E, {
|
|
257
258
|
treatment: "metric",
|
|
258
259
|
glow: t || e.status === "ACTIVE",
|
|
259
260
|
role: "button",
|
|
260
261
|
tabIndex: 0,
|
|
261
262
|
"aria-pressed": t,
|
|
262
|
-
"aria-label":
|
|
263
|
-
onClick: () =>
|
|
263
|
+
"aria-label": N("workflows.card.viewAriaLabel", "View flow for {{name}}", { name: e.name }),
|
|
264
|
+
onClick: () => j(t ? null : e.id),
|
|
264
265
|
onKeyDown: (n) => {
|
|
265
|
-
(n.key === "Enter" || n.key === " ") && (n.preventDefault(),
|
|
266
|
+
(n.key === "Enter" || n.key === " ") && (n.preventDefault(), j(t ? null : e.id));
|
|
266
267
|
},
|
|
267
268
|
className: "flex cursor-pointer flex-col p-5 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
268
269
|
children: [
|
|
269
|
-
/* @__PURE__ */
|
|
270
|
+
/* @__PURE__ */ T("div", {
|
|
270
271
|
className: "flex items-start justify-between gap-2",
|
|
271
|
-
children: [/* @__PURE__ */
|
|
272
|
+
children: [/* @__PURE__ */ w("span", {
|
|
272
273
|
className: "flex size-10 items-center justify-center rounded-xl bg-[var(--color-accent-soft)] text-text-primary",
|
|
273
|
-
children: /* @__PURE__ */
|
|
274
|
-
}), /* @__PURE__ */
|
|
274
|
+
children: /* @__PURE__ */ w(b, { className: "h-5 w-5" })
|
|
275
|
+
}), /* @__PURE__ */ w(r, { status: e.status })]
|
|
275
276
|
}),
|
|
276
|
-
/* @__PURE__ */
|
|
277
|
+
/* @__PURE__ */ w("p", {
|
|
277
278
|
className: "mt-3 truncate text-sm font-semibold text-text-primary",
|
|
278
279
|
children: e.name
|
|
279
280
|
}),
|
|
280
|
-
/* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ T("p", {
|
|
281
282
|
className: "flex items-center gap-1 truncate text-xs text-text-secondary",
|
|
282
283
|
children: [
|
|
283
|
-
/* @__PURE__ */
|
|
284
|
+
/* @__PURE__ */ w(S, {
|
|
284
285
|
className: "h-3 w-3 shrink-0",
|
|
285
286
|
"aria-hidden": !0
|
|
286
287
|
}),
|
|
287
288
|
" ",
|
|
288
|
-
|
|
289
|
+
N("workflows.card.onTrigger", "on {{trigger}}", { trigger: e.triggerEvent })
|
|
289
290
|
]
|
|
290
291
|
}),
|
|
291
|
-
e.description && /* @__PURE__ */
|
|
292
|
+
e.description && /* @__PURE__ */ w("p", {
|
|
292
293
|
className: "mt-2 line-clamp-2 min-h-[2rem] text-xs text-text-secondary",
|
|
293
294
|
children: e.description
|
|
294
295
|
}),
|
|
295
|
-
/* @__PURE__ */
|
|
296
|
+
/* @__PURE__ */ T("p", {
|
|
296
297
|
className: "mt-3 flex items-center gap-1.5 text-xs text-text-secondary tabular-nums",
|
|
297
298
|
children: [
|
|
298
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ w(_, {
|
|
299
300
|
className: "h-3.5 w-3.5",
|
|
300
301
|
"aria-hidden": !0
|
|
301
302
|
}),
|
|
302
303
|
" ",
|
|
303
|
-
|
|
304
|
-
e.lastRunAt ? ` · ${
|
|
304
|
+
N("workflows.flow.ran", "Ran {{count}}×", { count: e.runCount }),
|
|
305
|
+
e.lastRunAt ? ` · ${N("workflows.flow.lastRun", "last {{when}}", { when: n(e.lastRunAt) })}` : ""
|
|
305
306
|
]
|
|
306
307
|
}),
|
|
307
|
-
e.status !== "ACTIVE" && /* @__PURE__ */
|
|
308
|
+
e.status !== "ACTIVE" && /* @__PURE__ */ T("button", {
|
|
308
309
|
type: "button",
|
|
309
|
-
disabled:
|
|
310
|
+
disabled: z.isPending,
|
|
310
311
|
onClick: (t) => {
|
|
311
|
-
t.stopPropagation(),
|
|
312
|
+
t.stopPropagation(), z.mutate(e.id);
|
|
312
313
|
},
|
|
313
314
|
className: "mt-4 inline-flex items-center justify-center gap-1.5 rounded-lg border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50",
|
|
314
315
|
children: [
|
|
315
|
-
/* @__PURE__ */
|
|
316
|
+
/* @__PURE__ */ w(_, { className: "h-3.5 w-3.5" }),
|
|
316
317
|
" ",
|
|
317
|
-
|
|
318
|
+
N("common.activate", "Activate")
|
|
318
319
|
]
|
|
319
320
|
})
|
|
320
321
|
]
|
|
@@ -322,97 +323,97 @@ function M() {
|
|
|
322
323
|
})
|
|
323
324
|
})
|
|
324
325
|
] }),
|
|
325
|
-
|
|
326
|
-
title:
|
|
327
|
-
onClose:
|
|
328
|
-
children: /* @__PURE__ */
|
|
326
|
+
g && /* @__PURE__ */ w(a, {
|
|
327
|
+
title: N("workflows.newWorkflow", "New workflow"),
|
|
328
|
+
onClose: $,
|
|
329
|
+
children: /* @__PURE__ */ T("form", {
|
|
329
330
|
onSubmit: (e) => {
|
|
330
|
-
if (e.preventDefault(),
|
|
331
|
-
|
|
331
|
+
if (e.preventDefault(), q(null), !B.trim() || !H.trim()) {
|
|
332
|
+
q(N("workflows.form.nameRequired", "Name and trigger event are required."));
|
|
332
333
|
return;
|
|
333
334
|
}
|
|
334
335
|
let t = {
|
|
335
|
-
name:
|
|
336
|
-
triggerEvent:
|
|
337
|
-
...
|
|
336
|
+
name: B.trim(),
|
|
337
|
+
triggerEvent: H.trim(),
|
|
338
|
+
...W.trim() ? { description: W.trim() } : {}
|
|
338
339
|
};
|
|
339
|
-
|
|
340
|
+
R.mutate(t, {
|
|
340
341
|
onSuccess: () => {
|
|
341
|
-
|
|
342
|
+
Q(), y(!1);
|
|
342
343
|
},
|
|
343
|
-
onError: (e) =>
|
|
344
|
+
onError: (e) => q(e instanceof Error ? e.message : N("common.error", "An error occurred"))
|
|
344
345
|
});
|
|
345
346
|
},
|
|
346
347
|
className: "space-y-4",
|
|
347
348
|
children: [
|
|
348
|
-
|
|
349
|
+
K && /* @__PURE__ */ w("div", {
|
|
349
350
|
className: "rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text",
|
|
350
|
-
children:
|
|
351
|
+
children: K
|
|
351
352
|
}),
|
|
352
|
-
/* @__PURE__ */
|
|
353
|
+
/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ T("label", {
|
|
353
354
|
htmlFor: "wf-name",
|
|
354
|
-
className:
|
|
355
|
+
className: A,
|
|
355
356
|
children: [
|
|
356
|
-
|
|
357
|
+
N("workflows.form.nameLabel", "Name"),
|
|
357
358
|
" ",
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
+
/* @__PURE__ */ w("span", {
|
|
359
360
|
className: "text-status-error-text",
|
|
360
361
|
children: "*"
|
|
361
362
|
})
|
|
362
363
|
]
|
|
363
|
-
}), /* @__PURE__ */
|
|
364
|
+
}), /* @__PURE__ */ w("input", {
|
|
364
365
|
id: "wf-name",
|
|
365
366
|
type: "text",
|
|
366
|
-
value:
|
|
367
|
-
onChange: (e) =>
|
|
368
|
-
placeholder:
|
|
369
|
-
className:
|
|
367
|
+
value: B,
|
|
368
|
+
onChange: (e) => V(e.target.value),
|
|
369
|
+
placeholder: N("workflows.form.namePlaceholder", "e.g. Invoice → notify finance"),
|
|
370
|
+
className: k,
|
|
370
371
|
required: !0
|
|
371
372
|
})] }),
|
|
372
|
-
/* @__PURE__ */
|
|
373
|
+
/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ T("label", {
|
|
373
374
|
htmlFor: "wf-trigger",
|
|
374
|
-
className:
|
|
375
|
+
className: A,
|
|
375
376
|
children: [
|
|
376
|
-
|
|
377
|
+
N("workflows.form.triggerLabel", "Trigger event"),
|
|
377
378
|
" ",
|
|
378
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ w("span", {
|
|
379
380
|
className: "text-status-error-text",
|
|
380
381
|
children: "*"
|
|
381
382
|
})
|
|
382
383
|
]
|
|
383
|
-
}), /* @__PURE__ */
|
|
384
|
+
}), /* @__PURE__ */ w("input", {
|
|
384
385
|
id: "wf-trigger",
|
|
385
386
|
type: "text",
|
|
386
|
-
value:
|
|
387
|
-
onChange: (e) =>
|
|
388
|
-
placeholder:
|
|
389
|
-
className:
|
|
387
|
+
value: H,
|
|
388
|
+
onChange: (e) => U(e.target.value),
|
|
389
|
+
placeholder: N("workflows.form.triggerPlaceholder", "e.g. InvoiceReceived, RenewalDetected"),
|
|
390
|
+
className: k,
|
|
390
391
|
required: !0
|
|
391
392
|
})] }),
|
|
392
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("label", {
|
|
393
394
|
htmlFor: "wf-desc",
|
|
394
|
-
className:
|
|
395
|
-
children:
|
|
396
|
-
}), /* @__PURE__ */
|
|
395
|
+
className: A,
|
|
396
|
+
children: N("workflows.form.descriptionLabel", "Description")
|
|
397
|
+
}), /* @__PURE__ */ w("textarea", {
|
|
397
398
|
id: "wf-desc",
|
|
398
|
-
value:
|
|
399
|
-
onChange: (e) =>
|
|
399
|
+
value: W,
|
|
400
|
+
onChange: (e) => G(e.target.value),
|
|
400
401
|
rows: 3,
|
|
401
|
-
placeholder:
|
|
402
|
-
className:
|
|
402
|
+
placeholder: N("workflows.form.descriptionPlaceholder", "What should this workflow do when the event fires?"),
|
|
403
|
+
className: k
|
|
403
404
|
})] }),
|
|
404
|
-
/* @__PURE__ */
|
|
405
|
+
/* @__PURE__ */ T("div", {
|
|
405
406
|
className: "flex justify-end gap-3",
|
|
406
|
-
children: [/* @__PURE__ */
|
|
407
|
+
children: [/* @__PURE__ */ w("button", {
|
|
407
408
|
type: "button",
|
|
408
|
-
onClick:
|
|
409
|
+
onClick: $,
|
|
409
410
|
className: "rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
|
|
410
|
-
children:
|
|
411
|
-
}), /* @__PURE__ */
|
|
411
|
+
children: N("common.cancel", "Cancel")
|
|
412
|
+
}), /* @__PURE__ */ w("button", {
|
|
412
413
|
type: "submit",
|
|
413
|
-
disabled:
|
|
414
|
+
disabled: R.isPending,
|
|
414
415
|
className: "rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50",
|
|
415
|
-
children:
|
|
416
|
+
children: R.isPending ? N("workflows.creating", "Creating…") : N("workflows.createWorkflow", "Create workflow")
|
|
416
417
|
})]
|
|
417
418
|
})
|
|
418
419
|
]
|
|
@@ -422,6 +423,6 @@ function M() {
|
|
|
422
423
|
});
|
|
423
424
|
}
|
|
424
425
|
//#endregion
|
|
425
|
-
export {
|
|
426
|
+
export { N as WorkflowsPage };
|
|
426
427
|
|
|
427
428
|
//# sourceMappingURL=WorkflowsPage.js.map
|