@burdenoff/microfe-subscriberbot 2026.706.1 → 2026.706.3

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