@burdenoff/microfe-headshotmarketing 2026.923.1 → 2026.923.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"AutomationPage.d.ts","sourceRoot":"","sources":["../../../../src/headshotmarketing/pages/automation/AutomationPage.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAkC9D,eAAO,MAAM,cAAc,EAAE,EAmY5B,CAAC"}
1
+ {"version":3,"file":"AutomationPage.d.ts","sourceRoot":"","sources":["../../../../src/headshotmarketing/pages/automation/AutomationPage.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAsC9D,eAAO,MAAM,cAAc,EAAE,EAuY5B,CAAC"}
@@ -1,42 +1,43 @@
1
1
  import { useCreateHeadshotmarketingWorkflowMutation as e } from "../../../generated/wspace-operations.js";
2
2
  import { useHeadshotMarketing as t } from "../../context/HeadshotMarketingContext.js";
3
- import { cn as n, formatDate as ee, formatNumber as r, formatPercentage as i } from "../../utils/helpers.js";
4
- import { PageLayout as a } from "../../components/PageLayout.js";
5
- import { StatCard as o } from "../../components/StatCard.js";
6
- import { DataTable as s } from "../../components/DataTable.js";
7
- import { StatusBadge as c } from "../../components/StatusBadge.js";
8
- import { EmptyState as l } from "../../components/EmptyState.js";
9
- import { QueryStateBoundary as u } from "../../components/QueryStateBoundary.js";
3
+ import { cn as n, formatDate as r, formatNumber as i, formatPercentage as a } from "../../utils/helpers.js";
4
+ import { PageLayout as o } from "../../components/PageLayout.js";
5
+ import { StatCard as s } from "../../components/StatCard.js";
6
+ import { DataTable as c } from "../../components/DataTable.js";
7
+ import { StatusBadge as l } from "../../components/StatusBadge.js";
8
+ import { EmptyState as u } from "../../components/EmptyState.js";
9
+ import { QueryStateBoundary as ee } from "../../components/QueryStateBoundary.js";
10
10
  import { Pagination as d } from "../../components/Pagination.js";
11
11
  import "../../components/index.js";
12
12
  import { useHeadshotmarketingBootstrap as f } from "../../hooks/useHeadshotmarketingBootstrap.js";
13
13
  import { usePagination as p } from "../../hooks/usePagination.js";
14
14
  import "../../hooks/index.js";
15
- import { toAutomationLogModel as m, toWorkflowDefinitionInput as h, toWorkflowModel as g, toWorkflowTemplateModel as _ } from "../../utils/automationMapper.js";
15
+ import { toAutomationLogModel as m, toWorkflowDefinitionInput as te, toWorkflowModel as ne, toWorkflowTemplateModel as h } from "../../utils/automationMapper.js";
16
+ import { estimateTimeSavedMinutes as g, formatTimeSaved as _ } from "../../utils/automationStats.js";
16
17
  import { WorkflowRowControls as v } from "./WorkflowActions.js";
17
18
  import { useEffect as y, useMemo as b, useState as x } from "react";
18
19
  import { CheckCircle2 as S, Clock as C, GitBranch as w, Play as T, Plus as E, Zap as D } from "lucide-react";
19
20
  import { jsx as O, jsxs as k } from "react/jsx-runtime";
20
- import { EmphasisPanel as te, NextSteps as ne, PagePurpose as re } from "@burdenoff/fe-libs/ui";
21
+ import { EmphasisPanel as re, NextSteps as ie, PagePurpose as A } from "@burdenoff/fe-libs/ui";
21
22
  //#region src/headshotmarketing/pages/automation/AutomationPage.tsx
22
- var A = () => {
23
- let { navigate: A, basePath: j } = t(), { data: M, loading: N, error: P, refetch: F } = f(), [I, L] = x("workflows"), [R] = e(), [z, B] = x(null), [V, H] = x(null), U = b(() => M?.headshotmarketingWorkflows.items ?? [], [M?.headshotmarketingWorkflows.items]), W = b(() => {
23
+ var j = () => {
24
+ let { navigate: j, basePath: M } = t(), { data: N, loading: P, error: F, refetch: I } = f(), [L, R] = x("workflows"), [z] = e(), [B, V] = x(null), [H, U] = x(null), W = b(() => N?.headshotmarketingWorkflows.items ?? [], [N?.headshotmarketingWorkflows.items]), G = b(() => {
24
25
  let e = /* @__PURE__ */ new Map();
25
- for (let t of U) e.set(t.id, t);
26
+ for (let t of W) e.set(t.id, t);
26
27
  return e;
27
- }, [U]), G = b(() => U.map((e) => g(e)), [U]), K = b(() => Object.fromEntries(G.map((e) => [e.id, e.name])), [G]), q = b(() => (M?.headshotmarketingWorkflowExecutions.items ?? []).map((e) => m(e, K)), [M?.headshotmarketingWorkflowExecutions.items, K]), J = b(() => G.map((e) => _(e)), [G]), Y = G.filter((e) => e.status === "active").length, ie = G.reduce((e, t) => e + t.enrolledCount, 0), ae = G.filter((e) => e.enrolledCount > 0).length > 0 ? G.reduce((e, t) => e + t.conversionRate, 0) / G.filter((e) => e.enrolledCount > 0).length : 0, X = p({ initialPageSize: 8 }), { page: Z, pageSize: Q, setTotal: $ } = X;
28
+ }, [W]), K = b(() => W.map((e) => ne(e)), [W]), q = b(() => Object.fromEntries(K.map((e) => [e.id, e.name])), [K]), J = b(() => (N?.headshotmarketingWorkflowExecutions.items ?? []).map((e) => m(e, q)), [N?.headshotmarketingWorkflowExecutions.items, q]), Y = b(() => K.map((e) => h(e)), [K]), ae = K.filter((e) => e.status === "active").length, oe = K.reduce((e, t) => e + t.enrolledCount, 0), se = K.filter((e) => e.enrolledCount > 0).length > 0 ? K.reduce((e, t) => e + t.conversionRate, 0) / K.filter((e) => e.enrolledCount > 0).length : 0, ce = J.filter((e) => e.status === "success").length, le = _(g(ce)), X = p({ initialPageSize: 8 }), { page: Z, pageSize: Q, setTotal: $ } = X;
28
29
  y(() => {
29
- $(G.length);
30
- }, [G.length, $]);
31
- let oe = b(() => G.slice((Z - 1) * Q, (Z - 1) * Q + Q), [
32
- G,
30
+ $(K.length);
31
+ }, [K.length, $]);
32
+ let ue = b(() => K.slice((Z - 1) * Q, (Z - 1) * Q + Q), [
33
+ K,
33
34
  Z,
34
35
  Q
35
- ]), se = async (e) => {
36
- let t = W.get(e);
36
+ ]), de = async (e) => {
37
+ let t = G.get(e);
37
38
  if (!t) return;
38
- H(null), B(e);
39
- let n = h({
39
+ U(null), V(e);
40
+ let n = te({
40
41
  name: `${t.name} (Copy)`,
41
42
  description: t.description ?? null,
42
43
  triggerType: t.triggerType,
@@ -46,19 +47,19 @@ var A = () => {
46
47
  tags: t.tags
47
48
  });
48
49
  try {
49
- await R({ variables: { input: n } }), await F(), A(j + "/automation/workflows");
50
+ await z({ variables: { input: n } }), await I(), j(M + "/automation/workflows");
50
51
  } catch (e) {
51
- H(e instanceof Error ? e.message : "Failed to use template.");
52
+ U(e instanceof Error ? e.message : "Failed to use template.");
52
53
  } finally {
53
- B(null);
54
+ V(null);
54
55
  }
55
56
  };
56
- return /* @__PURE__ */ k(a, {
57
+ return /* @__PURE__ */ k(o, {
57
58
  title: "Automation",
58
59
  description: "Automate your marketing workflows",
59
60
  children: [
60
- /* @__PURE__ */ O(re, { children: "Put repetitive marketing on autopilot. Build workflows that react to events — a new lead, a form submission, a date — and automatically send emails, update records or notify your team. Track every run and reuse proven templates so your funnel keeps working while you don't." }),
61
- /* @__PURE__ */ O(ne, {
61
+ /* @__PURE__ */ O(A, { children: "Put repetitive marketing on autopilot. Build workflows that react to events — a new lead, a form submission, a date — and automatically send emails, update records or notify your team. Track every run and reuse proven templates so your funnel keeps working while you don't." }),
62
+ /* @__PURE__ */ O(ie, {
62
63
  storageKey: "headshotmarketing-automation-overview",
63
64
  steps: [
64
65
  {
@@ -66,49 +67,45 @@ var A = () => {
66
67
  label: "Build a workflow",
67
68
  description: "Chain a trigger to a sequence of automated actions.",
68
69
  icon: /* @__PURE__ */ O(E, { className: "h-4 w-4" }),
69
- onClick: () => A(j + "/automation/workflows/builder")
70
+ onClick: () => j(M + "/automation/workflows/builder")
70
71
  },
71
72
  {
72
73
  id: "workflows",
73
74
  label: "Manage workflows",
74
75
  description: "Enable, pause and review your existing automations.",
75
76
  icon: /* @__PURE__ */ O(D, { className: "h-4 w-4" }),
76
- onClick: () => A(j + "/automation/workflows")
77
+ onClick: () => j(M + "/automation/workflows")
77
78
  },
78
79
  {
79
80
  id: "triggers",
80
81
  label: "Explore triggers",
81
82
  description: "See what events can kick off an automation.",
82
83
  icon: /* @__PURE__ */ O(w, { className: "h-4 w-4" }),
83
- onClick: () => A(j + "/automation/triggers")
84
+ onClick: () => j(M + "/automation/triggers")
84
85
  }
85
86
  ]
86
87
  }),
87
- /* @__PURE__ */ O(te, { children: /* @__PURE__ */ k("div", {
88
+ /* @__PURE__ */ O(re, { children: /* @__PURE__ */ k("div", {
88
89
  className: "grid grid-cols-2 md:grid-cols-4 gap-4",
89
90
  children: [
90
- /* @__PURE__ */ O(o, {
91
+ /* @__PURE__ */ O(s, {
91
92
  title: "Active Workflows",
92
- value: Y,
93
- change: 9.1,
93
+ value: ae,
94
94
  icon: /* @__PURE__ */ O(D, { className: "h-4 w-4" })
95
95
  }),
96
- /* @__PURE__ */ O(o, {
96
+ /* @__PURE__ */ O(s, {
97
97
  title: "Total Runs",
98
- value: r(ie),
99
- change: 12.8,
98
+ value: i(oe),
100
99
  icon: /* @__PURE__ */ O(T, { className: "h-4 w-4" })
101
100
  }),
102
- /* @__PURE__ */ O(o, {
101
+ /* @__PURE__ */ O(s, {
103
102
  title: "Success Rate",
104
- value: i(ae),
105
- change: 1.4,
103
+ value: a(se),
106
104
  icon: /* @__PURE__ */ O(S, { className: "h-4 w-4" })
107
105
  }),
108
- /* @__PURE__ */ O(o, {
106
+ /* @__PURE__ */ O(s, {
109
107
  title: "Time Saved",
110
- value: "156h",
111
- change: 22.5,
108
+ value: le,
112
109
  icon: /* @__PURE__ */ O(C, { className: "h-4 w-4" })
113
110
  })
114
111
  ]
@@ -131,34 +128,34 @@ var A = () => {
131
128
  label: "Templates"
132
129
  }
133
130
  ].map((e) => /* @__PURE__ */ O("button", {
134
- onClick: () => L(e.key),
135
- className: n("whitespace-nowrap pb-3 text-sm font-medium transition-colors border-b-2", I === e.key ? "border-primary text-text-primary" : "border-transparent text-text-secondary hover:text-text-primary"),
131
+ onClick: () => R(e.key),
132
+ className: n("whitespace-nowrap pb-3 text-sm font-medium transition-colors border-b-2", L === e.key ? "border-primary text-text-primary" : "border-transparent text-text-secondary hover:text-text-primary"),
136
133
  children: e.label
137
134
  }, e.key))
138
135
  })
139
136
  }),
140
- V && /* @__PURE__ */ O("div", {
137
+ H && /* @__PURE__ */ O("div", {
141
138
  className: "rounded-lg border border-status-error-border/30 bg-status-error-bg/10 px-4 py-3 text-sm text-status-error-text",
142
- children: V
139
+ children: H
143
140
  }),
144
- /* @__PURE__ */ k(u, {
145
- loading: N,
146
- error: P,
147
- onRetry: F,
148
- hasData: !!M,
141
+ /* @__PURE__ */ k(ee, {
142
+ loading: P,
143
+ error: F,
144
+ onRetry: I,
145
+ hasData: !!N,
149
146
  children: [
150
- I === "workflows" && (G.length === 0 ? /* @__PURE__ */ O(l, {
147
+ L === "workflows" && (K.length === 0 ? /* @__PURE__ */ O(u, {
151
148
  illustration: "empty-generic",
152
149
  title: "No workflows yet",
153
150
  description: "Create your first automation to start saving time on repetitive marketing tasks.",
154
151
  action: /* @__PURE__ */ k("button", {
155
- onClick: () => A(j + "/automation/workflows/builder"),
152
+ onClick: () => j(M + "/automation/workflows/builder"),
156
153
  className: "inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90",
157
154
  children: [/* @__PURE__ */ O(E, { className: "h-4 w-4" }), "Build a workflow"]
158
155
  })
159
156
  }) : /* @__PURE__ */ k("div", {
160
157
  className: "space-y-4",
161
- children: [oe.map((e) => /* @__PURE__ */ O("div", {
158
+ children: [ue.map((e) => /* @__PURE__ */ O("div", {
162
159
  className: "rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4 hover:bg-bg-sunken/50 transition-colors",
163
160
  children: /* @__PURE__ */ k("div", {
164
161
  className: "flex items-start justify-between gap-3",
@@ -170,7 +167,7 @@ var A = () => {
170
167
  children: [/* @__PURE__ */ O("h4", {
171
168
  className: "text-sm font-semibold text-text-primary",
172
169
  children: e.name
173
- }), /* @__PURE__ */ O(c, { status: e.status })]
170
+ }), /* @__PURE__ */ O(l, { status: e.status })]
174
171
  }),
175
172
  /* @__PURE__ */ O("p", {
176
173
  className: "text-xs text-text-secondary mt-1",
@@ -181,15 +178,15 @@ var A = () => {
181
178
  children: [
182
179
  /* @__PURE__ */ k("span", { children: ["Trigger: ", e.trigger.description] }),
183
180
  /* @__PURE__ */ k("span", { children: [e.actions.length, " actions"] }),
184
- /* @__PURE__ */ k("span", { children: [r(e.enrolledCount), " enrolled"] }),
185
- /* @__PURE__ */ k("span", { children: [i(e.conversionRate), " conversion"] })
181
+ /* @__PURE__ */ k("span", { children: [i(e.enrolledCount), " enrolled"] }),
182
+ /* @__PURE__ */ k("span", { children: [a(e.conversionRate), " conversion"] })
186
183
  ]
187
184
  })
188
185
  ]
189
186
  }), /* @__PURE__ */ O(v, {
190
187
  workflow: e,
191
- raw: W.get(e.id),
192
- onChanged: () => void F()
188
+ raw: G.get(e.id),
189
+ onChanged: () => void I()
193
190
  })]
194
191
  })
195
192
  }, e.id)), /* @__PURE__ */ O(d, {
@@ -198,14 +195,14 @@ var A = () => {
198
195
  total: X.total,
199
196
  onPageChange: X.setPage,
200
197
  onPageSizeChange: X.setPageSize,
201
- disabled: N,
198
+ disabled: P,
202
199
  hideWhenSinglePage: !0
203
200
  })]
204
201
  })),
205
- I === "logs" && /* @__PURE__ */ O("div", {
202
+ L === "logs" && /* @__PURE__ */ O("div", {
206
203
  className: "overflow-x-auto",
207
- children: /* @__PURE__ */ O(s, {
208
- data: q,
204
+ children: /* @__PURE__ */ O(c, {
205
+ data: J,
209
206
  columns: [
210
207
  {
211
208
  key: "workflowName",
@@ -235,7 +232,7 @@ var A = () => {
235
232
  {
236
233
  key: "status",
237
234
  header: "Status",
238
- render: (e) => /* @__PURE__ */ O(c, { status: e.status })
235
+ render: (e) => /* @__PURE__ */ O(l, { status: e.status })
239
236
  },
240
237
  {
241
238
  key: "message",
@@ -251,7 +248,7 @@ var A = () => {
251
248
  sortable: !0,
252
249
  render: (e) => /* @__PURE__ */ O("span", {
253
250
  className: "text-xs text-text-secondary",
254
- children: ee(e.executedAt, "relative")
251
+ children: r(e.executedAt, "relative")
255
252
  })
256
253
  }
257
254
  ],
@@ -259,13 +256,13 @@ var A = () => {
259
256
  searchPlaceholder: "Search logs..."
260
257
  })
261
258
  }),
262
- I === "templates" && (J.length === 0 ? /* @__PURE__ */ O(l, {
259
+ L === "templates" && (Y.length === 0 ? /* @__PURE__ */ O(u, {
263
260
  illustration: "empty-generic",
264
261
  title: "No templates yet",
265
262
  description: "Templates appear here once you create workflows you can reuse."
266
263
  }) : /* @__PURE__ */ O("div", {
267
264
  className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",
268
- children: J.map((e) => /* @__PURE__ */ k("div", {
265
+ children: Y.map((e) => /* @__PURE__ */ k("div", {
269
266
  className: "rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4 hover:bg-bg-sunken/50 transition-colors",
270
267
  children: [/* @__PURE__ */ k("div", {
271
268
  className: "flex items-start justify-between gap-2",
@@ -293,10 +290,10 @@ var A = () => {
293
290
  ]
294
291
  }), /* @__PURE__ */ O("button", {
295
292
  type: "button",
296
- onClick: () => void se(e.id),
297
- disabled: z === e.id,
293
+ onClick: () => void de(e.id),
294
+ disabled: B === e.id,
298
295
  className: "text-xs font-medium text-primary hover:underline disabled:opacity-50",
299
- children: z === e.id ? "Creating…" : "Use Template"
296
+ children: B === e.id ? "Creating…" : "Use Template"
300
297
  })]
301
298
  })]
302
299
  }, e.id))
@@ -307,6 +304,6 @@ var A = () => {
307
304
  });
308
305
  };
309
306
  //#endregion
310
- export { A as AutomationPage };
307
+ export { j as AutomationPage };
311
308
 
312
309
  //# sourceMappingURL=AutomationPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AutomationPage.js","names":[],"sources":["../../../../src/headshotmarketing/pages/automation/AutomationPage.tsx"],"sourcesContent":["/**\n * Automation Overview Page\n * @module headshotmarketing/pages/automation\n */\n\nimport { useEffect, useMemo, useState, type FC } from \"react\";\nimport { Zap, Play, CheckCircle2, Clock, Plus, GitBranch } from \"lucide-react\";\nimport { useCreateHeadshotmarketingWorkflowMutation } from \"../../../generated/wspace-operations\";\n\nimport {\n PageLayout,\n StatCard,\n DataTable,\n StatusBadge,\n EmptyState,\n Pagination,\n QueryStateBoundary,\n type Column,\n} from \"../../components\";\nimport { EmphasisPanel, PagePurpose, NextSteps } from \"@burdenoff/fe-libs/ui\";\nimport {\n cn,\n formatNumber,\n formatPercentage,\n formatDate,\n} from \"../../utils/helpers\";\nimport {\n toAutomationLogModel,\n toWorkflowDefinitionInput,\n toWorkflowModel,\n toWorkflowTemplateModel,\n} from \"../../utils/automationMapper\";\nimport { useHeadshotMarketing } from \"../../context/HeadshotMarketingContext\";\nimport { useHeadshotmarketingBootstrap, usePagination } from \"../../hooks\";\nimport { WorkflowRowControls, type RawWorkflow } from \"./WorkflowActions\";\nimport type { AutomationLog, Workflow, WorkflowTemplate } from \"../../types\";\n\ntype AutoTab = \"workflows\" | \"logs\" | \"templates\";\n\nexport const AutomationPage: FC = () => {\n const { navigate, basePath } = useHeadshotMarketing();\n const { data, loading, error, refetch } = useHeadshotmarketingBootstrap();\n const [activeTab, setActiveTab] = useState<AutoTab>(\"workflows\");\n\n const [createWorkflow] = useCreateHeadshotmarketingWorkflowMutation();\n const [templateBusyId, setTemplateBusyId] = useState<string | null>(null);\n const [templateError, setTemplateError] = useState<string | null>(null);\n\n const rawWorkflows = useMemo<RawWorkflow[]>(\n () => data?.headshotmarketingWorkflows.items ?? [],\n [data?.headshotmarketingWorkflows.items],\n );\n const rawById = useMemo(() => {\n const map = new Map<string, RawWorkflow>();\n for (const raw of rawWorkflows) map.set(raw.id, raw);\n return map;\n }, [rawWorkflows]);\n\n const workflows = useMemo<Workflow[]>(\n () =>\n rawWorkflows.map((item: Parameters<typeof toWorkflowModel>[0]) =>\n toWorkflowModel(item),\n ),\n [rawWorkflows],\n );\n\n const workflowNameById = useMemo(\n () =>\n Object.fromEntries(\n workflows.map((workflow: Workflow) => [workflow.id, workflow.name]),\n ),\n [workflows],\n );\n\n const automationLogs = useMemo<AutomationLog[]>(() => {\n const items = data?.headshotmarketingWorkflowExecutions.items ?? [];\n return items.map((item: Parameters<typeof toAutomationLogModel>[0]) =>\n toAutomationLogModel(item, workflowNameById),\n );\n }, [data?.headshotmarketingWorkflowExecutions.items, workflowNameById]);\n\n const workflowTemplates = useMemo<WorkflowTemplate[]>(\n () =>\n workflows.map((workflow: Workflow) => toWorkflowTemplateModel(workflow)),\n [workflows],\n );\n\n const activeWorkflows = workflows.filter(\n (w: Workflow) => w.status === \"active\",\n ).length;\n const totalRuns = workflows.reduce(\n (sum: number, w: Workflow) => sum + w.enrolledCount,\n 0,\n );\n const avgSuccess =\n workflows.filter((w: Workflow) => w.enrolledCount > 0).length > 0\n ? workflows.reduce(\n (sum: number, w: Workflow) => sum + w.conversionRate,\n 0,\n ) / workflows.filter((w: Workflow) => w.enrolledCount > 0).length\n : 0;\n\n // Client-side pagination for the workflows tab.\n const pagination = usePagination({ initialPageSize: 8 });\n const { page, pageSize, setTotal } = pagination;\n useEffect(() => {\n setTotal(workflows.length);\n }, [workflows.length, setTotal]);\n const pagedWorkflows = useMemo(\n () =>\n workflows.slice((page - 1) * pageSize, (page - 1) * pageSize + pageSize),\n [workflows, page, pageSize],\n );\n\n const handleUseTemplate = async (templateId: string): Promise<void> => {\n const raw = rawById.get(templateId);\n if (!raw) return;\n setTemplateError(null);\n setTemplateBusyId(templateId);\n const input = toWorkflowDefinitionInput({\n name: `${raw.name} (Copy)`,\n description: raw.description ?? null,\n triggerType: raw.triggerType,\n triggerConfig: raw.triggerConfig ?? undefined,\n steps: raw.steps,\n variables: raw.variables ?? undefined,\n tags: raw.tags,\n });\n try {\n await createWorkflow({ variables: { input } });\n await refetch();\n navigate(basePath + \"/automation/workflows\");\n } catch (err) {\n setTemplateError(\n err instanceof Error ? err.message : \"Failed to use template.\",\n );\n } finally {\n setTemplateBusyId(null);\n }\n };\n\n const tabs: { key: AutoTab; label: string }[] = [\n { key: \"workflows\", label: \"Workflows\" },\n { key: \"logs\", label: \"Logs\" },\n { key: \"templates\", label: \"Templates\" },\n ];\n\n const logColumns: Column<AutomationLog>[] = [\n {\n key: \"workflowName\",\n header: \"Workflow\",\n sortable: true,\n render: (row) => (\n <span className=\"font-medium text-text-primary\">\n {row.workflowName}\n </span>\n ),\n },\n {\n key: \"contactEmail\",\n header: \"Contact\",\n render: (row) => <span className=\"text-sm\">{row.contactEmail}</span>,\n },\n {\n key: \"action\",\n header: \"Action\",\n render: (row) => (\n <span className=\"text-sm text-text-secondary\">{row.action}</span>\n ),\n },\n {\n key: \"status\",\n header: \"Status\",\n render: (row) => <StatusBadge status={row.status} />,\n },\n {\n key: \"message\",\n header: \"Message\",\n render: (row) => (\n <span className=\"text-xs text-text-secondary\">{row.message}</span>\n ),\n },\n {\n key: \"executedAt\",\n header: \"Executed\",\n sortable: true,\n render: (row) => (\n <span className=\"text-xs text-text-secondary\">\n {formatDate(row.executedAt, \"relative\")}\n </span>\n ),\n },\n ];\n\n return (\n <PageLayout\n title=\"Automation\"\n description=\"Automate your marketing workflows\"\n >\n <PagePurpose>\n Put repetitive marketing on autopilot. Build workflows that react to\n events — a new lead, a form submission, a date — and automatically send\n emails, update records or notify your team. Track every run and reuse\n proven templates so your funnel keeps working while you don't.\n </PagePurpose>\n\n <NextSteps\n storageKey=\"headshotmarketing-automation-overview\"\n steps={[\n {\n id: \"build\",\n label: \"Build a workflow\",\n description: \"Chain a trigger to a sequence of automated actions.\",\n icon: <Plus className=\"h-4 w-4\" />,\n onClick: () => navigate(basePath + \"/automation/workflows/builder\"),\n },\n {\n id: \"workflows\",\n label: \"Manage workflows\",\n description: \"Enable, pause and review your existing automations.\",\n icon: <Zap className=\"h-4 w-4\" />,\n onClick: () => navigate(basePath + \"/automation/workflows\"),\n },\n {\n id: \"triggers\",\n label: \"Explore triggers\",\n description: \"See what events can kick off an automation.\",\n icon: <GitBranch className=\"h-4 w-4\" />,\n onClick: () => navigate(basePath + \"/automation/triggers\"),\n },\n ]}\n />\n\n {/* Stats — primary emphasis zone */}\n <EmphasisPanel>\n <div className=\"grid grid-cols-2 md:grid-cols-4 gap-4\">\n <StatCard\n title=\"Active Workflows\"\n value={activeWorkflows}\n change={9.1}\n icon={<Zap className=\"h-4 w-4\" />}\n />\n <StatCard\n title=\"Total Runs\"\n value={formatNumber(totalRuns)}\n change={12.8}\n icon={<Play className=\"h-4 w-4\" />}\n />\n <StatCard\n title=\"Success Rate\"\n value={formatPercentage(avgSuccess)}\n change={1.4}\n icon={<CheckCircle2 className=\"h-4 w-4\" />}\n />\n <StatCard\n title=\"Time Saved\"\n value=\"156h\"\n change={22.5}\n icon={<Clock className=\"h-4 w-4\" />}\n />\n </div>\n </EmphasisPanel>\n\n {/* Tabs */}\n <div className=\"border-b border-border-subtle\">\n <div className=\"flex flex-nowrap gap-6 overflow-x-auto\">\n {tabs.map((tab) => (\n <button\n key={tab.key}\n onClick={() => setActiveTab(tab.key)}\n className={cn(\n \"whitespace-nowrap pb-3 text-sm font-medium transition-colors border-b-2\",\n activeTab === tab.key\n ? \"border-primary text-text-primary\"\n : \"border-transparent text-text-secondary hover:text-text-primary\",\n )}\n >\n {tab.label}\n </button>\n ))}\n </div>\n </div>\n\n {templateError && (\n <div className=\"rounded-lg border border-status-error-border/30 bg-status-error-bg/10 px-4 py-3 text-sm text-status-error-text\">\n {templateError}\n </div>\n )}\n\n <QueryStateBoundary\n loading={loading}\n error={error}\n onRetry={refetch}\n hasData={Boolean(data)}\n >\n {/* Workflows Tab */}\n {activeTab === \"workflows\" &&\n (workflows.length === 0 ? (\n <EmptyState\n illustration=\"empty-generic\"\n title=\"No workflows yet\"\n description=\"Create your first automation to start saving time on repetitive marketing tasks.\"\n action={\n <button\n onClick={() =>\n navigate(basePath + \"/automation/workflows/builder\")\n }\n className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" />\n Build a workflow\n </button>\n }\n />\n ) : (\n <div className=\"space-y-4\">\n {pagedWorkflows.map((workflow: Workflow) => (\n <div\n key={workflow.id}\n className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4 hover:bg-bg-sunken/50 transition-colors\"\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <h4 className=\"text-sm font-semibold text-text-primary\">\n {workflow.name}\n </h4>\n <StatusBadge status={workflow.status} />\n </div>\n <p className=\"text-xs text-text-secondary mt-1\">\n {workflow.description}\n </p>\n <div className=\"flex flex-wrap items-center gap-4 mt-3 text-xs text-text-secondary\">\n <span>Trigger: {workflow.trigger.description}</span>\n <span>{workflow.actions.length} actions</span>\n <span>\n {formatNumber(workflow.enrolledCount)} enrolled\n </span>\n <span>\n {formatPercentage(workflow.conversionRate)} conversion\n </span>\n </div>\n </div>\n <WorkflowRowControls\n workflow={workflow}\n raw={rawById.get(workflow.id)}\n onChanged={() => void refetch()}\n />\n </div>\n </div>\n ))}\n\n <Pagination\n page={pagination.page}\n pageSize={pagination.pageSize}\n total={pagination.total}\n onPageChange={pagination.setPage}\n onPageSizeChange={pagination.setPageSize}\n disabled={loading}\n hideWhenSinglePage\n />\n </div>\n ))}\n\n {/* Logs Tab */}\n {activeTab === \"logs\" && (\n <div className=\"overflow-x-auto\">\n <DataTable\n data={automationLogs}\n columns={logColumns}\n searchable\n searchPlaceholder=\"Search logs...\"\n />\n </div>\n )}\n\n {/* Templates Tab */}\n {activeTab === \"templates\" &&\n (workflowTemplates.length === 0 ? (\n <EmptyState\n illustration=\"empty-generic\"\n title=\"No templates yet\"\n description=\"Templates appear here once you create workflows you can reuse.\"\n />\n ) : (\n <div className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4\">\n {workflowTemplates.map((tmpl: WorkflowTemplate) => (\n <div\n key={tmpl.id}\n className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4 hover:bg-bg-sunken/50 transition-colors\"\n >\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <h4 className=\"text-sm font-semibold text-text-primary\">\n {tmpl.name}\n </h4>\n <p className=\"text-xs text-text-secondary mt-1\">\n {tmpl.description}\n </p>\n </div>\n <span className=\"inline-flex items-center rounded-full bg-bg-sunken px-2 py-0.5 text-[10px] font-medium text-text-secondary whitespace-nowrap\">\n {tmpl.category}\n </span>\n </div>\n <div className=\"flex items-center justify-between mt-3 pt-3 border-t border-border-subtle\">\n <span className=\"text-xs text-text-secondary\">\n Popularity: {tmpl.popularity}%\n </span>\n <button\n type=\"button\"\n onClick={() => void handleUseTemplate(tmpl.id)}\n disabled={templateBusyId === tmpl.id}\n className=\"text-xs font-medium text-primary hover:underline disabled:opacity-50\"\n >\n {templateBusyId === tmpl.id\n ? \"Creating…\"\n : \"Use Template\"}\n </button>\n </div>\n </div>\n ))}\n </div>\n ))}\n </QueryStateBoundary>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuCA,IAAa,UAA2B;CACtC,IAAM,EAAE,aAAU,gBAAa,GAAsB,EAC/C,EAAE,SAAM,YAAS,UAAO,eAAY,GAA+B,EACnE,CAAC,GAAW,KAAgB,EAAkB,YAAY,EAE1D,CAAC,KAAkB,GAA4C,EAC/D,CAAC,GAAgB,KAAqB,EAAwB,KAAK,EACnE,CAAC,GAAe,KAAoB,EAAwB,KAAK,EAEjE,IAAe,QACb,GAAM,2BAA2B,SAAS,EAAE,EAClD,CAAC,GAAM,2BAA2B,MAAM,CACzC,EACK,IAAU,QAAc;EAC5B,IAAM,oBAAM,IAAI,KAA0B;AAC1C,OAAK,IAAM,KAAO,EAAc,GAAI,IAAI,EAAI,IAAI,EAAI;AACpD,SAAO;IACN,CAAC,EAAa,CAAC,EAEZ,IAAY,QAEd,EAAa,KAAK,MAChB,EAAgB,EAAK,CACtB,EACH,CAAC,EAAa,CACf,EAEK,IA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AAI,YAAY,WAAW;UAClC,CAAA;SAEV;QACF;OAkLW,YAAA;OACA,mBAAkB;OAClB,CAAA;MACE,CAAA;KAIP,MAAc,gBACZ,EAAkB,WAAW,IAC5B,kBAAC,GAAD;MACE,cAAa;MACb,OAAM;MACN,aAAY;MACZ,CAAA,GAEF,kBAAC,OAAD;MAAK,WAAU;gBACZ,EAAkB,KAAK,MACtB,kBAAC,OAAD;OAEE,WAAU;iBAFZ,CAIE,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,OAAD;SAAK,WAAU;mBAAf,CACE,kBAAC,MAAD;UAAI,WAAU;oBACX,EAAK;UACH,CAAA,EACL,kBAAC,KAAD;UAAG,WAAU;oBACV,EAAK;UACJ,CAAA,CACA;YACN,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAK;SACD,CAAA,CACH;WACN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,QAAD;SAAM,WAAU;mBAAhB;UAA8C;UAC/B,EAAK;UAAW;UACxB;YACP,kBAAC,UAAD;SACE,MAAK;SACL,eAAe,KAAK,GAAkB,EAAK,GAAG;SAC9C,UAAU,MAAmB,EAAK;SAClC,WAAU;mBAET,MAAmB,EAAK,KACrB,cACA;SACG,CAAA,CACL;UACF;SA/BC,EAAK,GA+BN,CACN;MACE,CAAA;KAES;;GACV"}
1
+ {"version":3,"file":"AutomationPage.js","names":[],"sources":["../../../../src/headshotmarketing/pages/automation/AutomationPage.tsx"],"sourcesContent":["/**\n * Automation Overview Page\n * @module headshotmarketing/pages/automation\n */\n\nimport { useEffect, useMemo, useState, type FC } from \"react\";\nimport { Zap, Play, CheckCircle2, Clock, Plus, GitBranch } from \"lucide-react\";\nimport { useCreateHeadshotmarketingWorkflowMutation } from \"../../../generated/wspace-operations\";\n\nimport {\n PageLayout,\n StatCard,\n DataTable,\n StatusBadge,\n EmptyState,\n Pagination,\n QueryStateBoundary,\n type Column,\n} from \"../../components\";\nimport { EmphasisPanel, PagePurpose, NextSteps } from \"@burdenoff/fe-libs/ui\";\nimport {\n cn,\n formatNumber,\n formatPercentage,\n formatDate,\n} from \"../../utils/helpers\";\nimport {\n toAutomationLogModel,\n toWorkflowDefinitionInput,\n toWorkflowModel,\n toWorkflowTemplateModel,\n} from \"../../utils/automationMapper\";\nimport {\n estimateTimeSavedMinutes,\n formatTimeSaved,\n} from \"../../utils/automationStats\";\nimport { useHeadshotMarketing } from \"../../context/HeadshotMarketingContext\";\nimport { useHeadshotmarketingBootstrap, usePagination } from \"../../hooks\";\nimport { WorkflowRowControls, type RawWorkflow } from \"./WorkflowActions\";\nimport type { AutomationLog, Workflow, WorkflowTemplate } from \"../../types\";\n\ntype AutoTab = \"workflows\" | \"logs\" | \"templates\";\n\nexport const AutomationPage: FC = () => {\n const { navigate, basePath } = useHeadshotMarketing();\n const { data, loading, error, refetch } = useHeadshotmarketingBootstrap();\n const [activeTab, setActiveTab] = useState<AutoTab>(\"workflows\");\n\n const [createWorkflow] = useCreateHeadshotmarketingWorkflowMutation();\n const [templateBusyId, setTemplateBusyId] = useState<string | null>(null);\n const [templateError, setTemplateError] = useState<string | null>(null);\n\n const rawWorkflows = useMemo<RawWorkflow[]>(\n () => data?.headshotmarketingWorkflows.items ?? [],\n [data?.headshotmarketingWorkflows.items],\n );\n const rawById = useMemo(() => {\n const map = new Map<string, RawWorkflow>();\n for (const raw of rawWorkflows) map.set(raw.id, raw);\n return map;\n }, [rawWorkflows]);\n\n const workflows = useMemo<Workflow[]>(\n () =>\n rawWorkflows.map((item: Parameters<typeof toWorkflowModel>[0]) =>\n toWorkflowModel(item),\n ),\n [rawWorkflows],\n );\n\n const workflowNameById = useMemo(\n () =>\n Object.fromEntries(\n workflows.map((workflow: Workflow) => [workflow.id, workflow.name]),\n ),\n [workflows],\n );\n\n const automationLogs = useMemo<AutomationLog[]>(() => {\n const items = data?.headshotmarketingWorkflowExecutions.items ?? [];\n return items.map((item: Parameters<typeof toAutomationLogModel>[0]) =>\n toAutomationLogModel(item, workflowNameById),\n );\n }, [data?.headshotmarketingWorkflowExecutions.items, workflowNameById]);\n\n const workflowTemplates = useMemo<WorkflowTemplate[]>(\n () =>\n workflows.map((workflow: Workflow) => toWorkflowTemplateModel(workflow)),\n [workflows],\n );\n\n const activeWorkflows = workflows.filter(\n (w: Workflow) => w.status === \"active\",\n ).length;\n const totalRuns = workflows.reduce(\n (sum: number, w: Workflow) => sum + w.enrolledCount,\n 0,\n );\n const avgSuccess =\n workflows.filter((w: Workflow) => w.enrolledCount > 0).length > 0\n ? workflows.reduce(\n (sum: number, w: Workflow) => sum + w.conversionRate,\n 0,\n ) / workflows.filter((w: Workflow) => w.enrolledCount > 0).length\n : 0;\n\n // \"Time Saved\" is derived from real run data: count the workflow runs that\n // actually succeeded and estimate the manual effort each one replaced. No\n // successful runs (e.g. an empty workspace) therefore reads \"0h\".\n const successfulRuns = automationLogs.filter(\n (log: AutomationLog) => log.status === \"success\",\n ).length;\n const timeSaved = formatTimeSaved(estimateTimeSavedMinutes(successfulRuns));\n\n // Client-side pagination for the workflows tab.\n const pagination = usePagination({ initialPageSize: 8 });\n const { page, pageSize, setTotal } = pagination;\n useEffect(() => {\n setTotal(workflows.length);\n }, [workflows.length, setTotal]);\n const pagedWorkflows = useMemo(\n () =>\n workflows.slice((page - 1) * pageSize, (page - 1) * pageSize + pageSize),\n [workflows, page, pageSize],\n );\n\n const handleUseTemplate = async (templateId: string): Promise<void> => {\n const raw = rawById.get(templateId);\n if (!raw) return;\n setTemplateError(null);\n setTemplateBusyId(templateId);\n const input = toWorkflowDefinitionInput({\n name: `${raw.name} (Copy)`,\n description: raw.description ?? null,\n triggerType: raw.triggerType,\n triggerConfig: raw.triggerConfig ?? undefined,\n steps: raw.steps,\n variables: raw.variables ?? undefined,\n tags: raw.tags,\n });\n try {\n await createWorkflow({ variables: { input } });\n await refetch();\n navigate(basePath + \"/automation/workflows\");\n } catch (err) {\n setTemplateError(\n err instanceof Error ? err.message : \"Failed to use template.\",\n );\n } finally {\n setTemplateBusyId(null);\n }\n };\n\n const tabs: { key: AutoTab; label: string }[] = [\n { key: \"workflows\", label: \"Workflows\" },\n { key: \"logs\", label: \"Logs\" },\n { key: \"templates\", label: \"Templates\" },\n ];\n\n const logColumns: Column<AutomationLog>[] = [\n {\n key: \"workflowName\",\n header: \"Workflow\",\n sortable: true,\n render: (row) => (\n <span className=\"font-medium text-text-primary\">\n {row.workflowName}\n </span>\n ),\n },\n {\n key: \"contactEmail\",\n header: \"Contact\",\n render: (row) => <span className=\"text-sm\">{row.contactEmail}</span>,\n },\n {\n key: \"action\",\n header: \"Action\",\n render: (row) => (\n <span className=\"text-sm text-text-secondary\">{row.action}</span>\n ),\n },\n {\n key: \"status\",\n header: \"Status\",\n render: (row) => <StatusBadge status={row.status} />,\n },\n {\n key: \"message\",\n header: \"Message\",\n render: (row) => (\n <span className=\"text-xs text-text-secondary\">{row.message}</span>\n ),\n },\n {\n key: \"executedAt\",\n header: \"Executed\",\n sortable: true,\n render: (row) => (\n <span className=\"text-xs text-text-secondary\">\n {formatDate(row.executedAt, \"relative\")}\n </span>\n ),\n },\n ];\n\n return (\n <PageLayout\n title=\"Automation\"\n description=\"Automate your marketing workflows\"\n >\n <PagePurpose>\n Put repetitive marketing on autopilot. Build workflows that react to\n events — a new lead, a form submission, a date — and automatically send\n emails, update records or notify your team. Track every run and reuse\n proven templates so your funnel keeps working while you don't.\n </PagePurpose>\n\n <NextSteps\n storageKey=\"headshotmarketing-automation-overview\"\n steps={[\n {\n id: \"build\",\n label: \"Build a workflow\",\n description: \"Chain a trigger to a sequence of automated actions.\",\n icon: <Plus className=\"h-4 w-4\" />,\n onClick: () => navigate(basePath + \"/automation/workflows/builder\"),\n },\n {\n id: \"workflows\",\n label: \"Manage workflows\",\n description: \"Enable, pause and review your existing automations.\",\n icon: <Zap className=\"h-4 w-4\" />,\n onClick: () => navigate(basePath + \"/automation/workflows\"),\n },\n {\n id: \"triggers\",\n label: \"Explore triggers\",\n description: \"See what events can kick off an automation.\",\n icon: <GitBranch className=\"h-4 w-4\" />,\n onClick: () => navigate(basePath + \"/automation/triggers\"),\n },\n ]}\n />\n\n {/* Stats — primary emphasis zone */}\n <EmphasisPanel>\n <div className=\"grid grid-cols-2 md:grid-cols-4 gap-4\">\n <StatCard\n title=\"Active Workflows\"\n value={activeWorkflows}\n icon={<Zap className=\"h-4 w-4\" />}\n />\n <StatCard\n title=\"Total Runs\"\n value={formatNumber(totalRuns)}\n icon={<Play className=\"h-4 w-4\" />}\n />\n <StatCard\n title=\"Success Rate\"\n value={formatPercentage(avgSuccess)}\n icon={<CheckCircle2 className=\"h-4 w-4\" />}\n />\n <StatCard\n title=\"Time Saved\"\n value={timeSaved}\n icon={<Clock className=\"h-4 w-4\" />}\n />\n </div>\n </EmphasisPanel>\n\n {/* Tabs */}\n <div className=\"border-b border-border-subtle\">\n <div className=\"flex flex-nowrap gap-6 overflow-x-auto\">\n {tabs.map((tab) => (\n <button\n key={tab.key}\n onClick={() => setActiveTab(tab.key)}\n className={cn(\n \"whitespace-nowrap pb-3 text-sm font-medium transition-colors border-b-2\",\n activeTab === tab.key\n ? \"border-primary text-text-primary\"\n : \"border-transparent text-text-secondary hover:text-text-primary\",\n )}\n >\n {tab.label}\n </button>\n ))}\n </div>\n </div>\n\n {templateError && (\n <div className=\"rounded-lg border border-status-error-border/30 bg-status-error-bg/10 px-4 py-3 text-sm text-status-error-text\">\n {templateError}\n </div>\n )}\n\n <QueryStateBoundary\n loading={loading}\n error={error}\n onRetry={refetch}\n hasData={Boolean(data)}\n >\n {/* Workflows Tab */}\n {activeTab === \"workflows\" &&\n (workflows.length === 0 ? (\n <EmptyState\n illustration=\"empty-generic\"\n title=\"No workflows yet\"\n description=\"Create your first automation to start saving time on repetitive marketing tasks.\"\n action={\n <button\n onClick={() =>\n navigate(basePath + \"/automation/workflows/builder\")\n }\n className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" />\n Build a workflow\n </button>\n }\n />\n ) : (\n <div className=\"space-y-4\">\n {pagedWorkflows.map((workflow: Workflow) => (\n <div\n key={workflow.id}\n className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4 hover:bg-bg-sunken/50 transition-colors\"\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <h4 className=\"text-sm font-semibold text-text-primary\">\n {workflow.name}\n </h4>\n <StatusBadge status={workflow.status} />\n </div>\n <p className=\"text-xs text-text-secondary mt-1\">\n {workflow.description}\n </p>\n <div className=\"flex flex-wrap items-center gap-4 mt-3 text-xs text-text-secondary\">\n <span>Trigger: {workflow.trigger.description}</span>\n <span>{workflow.actions.length} actions</span>\n <span>\n {formatNumber(workflow.enrolledCount)} enrolled\n </span>\n <span>\n {formatPercentage(workflow.conversionRate)} conversion\n </span>\n </div>\n </div>\n <WorkflowRowControls\n workflow={workflow}\n raw={rawById.get(workflow.id)}\n onChanged={() => void refetch()}\n />\n </div>\n </div>\n ))}\n\n <Pagination\n page={pagination.page}\n pageSize={pagination.pageSize}\n total={pagination.total}\n onPageChange={pagination.setPage}\n onPageSizeChange={pagination.setPageSize}\n disabled={loading}\n hideWhenSinglePage\n />\n </div>\n ))}\n\n {/* Logs Tab */}\n {activeTab === \"logs\" && (\n <div className=\"overflow-x-auto\">\n <DataTable\n data={automationLogs}\n columns={logColumns}\n searchable\n searchPlaceholder=\"Search logs...\"\n />\n </div>\n )}\n\n {/* Templates Tab */}\n {activeTab === \"templates\" &&\n (workflowTemplates.length === 0 ? (\n <EmptyState\n illustration=\"empty-generic\"\n title=\"No templates yet\"\n description=\"Templates appear here once you create workflows you can reuse.\"\n />\n ) : (\n <div className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4\">\n {workflowTemplates.map((tmpl: WorkflowTemplate) => (\n <div\n key={tmpl.id}\n className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4 hover:bg-bg-sunken/50 transition-colors\"\n >\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <h4 className=\"text-sm font-semibold text-text-primary\">\n {tmpl.name}\n </h4>\n <p className=\"text-xs text-text-secondary mt-1\">\n {tmpl.description}\n </p>\n </div>\n <span className=\"inline-flex items-center rounded-full bg-bg-sunken px-2 py-0.5 text-[10px] font-medium text-text-secondary whitespace-nowrap\">\n {tmpl.category}\n </span>\n </div>\n <div className=\"flex items-center justify-between mt-3 pt-3 border-t border-border-subtle\">\n <span className=\"text-xs text-text-secondary\">\n Popularity: {tmpl.popularity}%\n </span>\n <button\n type=\"button\"\n onClick={() => void handleUseTemplate(tmpl.id)}\n disabled={templateBusyId === tmpl.id}\n className=\"text-xs font-medium text-primary hover:underline disabled:opacity-50\"\n >\n {templateBusyId === tmpl.id\n ? \"Creating…\"\n : \"Use Template\"}\n </button>\n </div>\n </div>\n ))}\n </div>\n ))}\n </QueryStateBoundary>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2CA,IAAa,UAA2B;CACtC,IAAM,EAAE,aAAU,gBAAa,GAAsB,EAC/C,EAAE,SAAM,YAAS,UAAO,eAAY,GAA+B,EACnE,CAAC,GAAW,KAAgB,EAAkB,YAAY,EAE1D,CAAC,KAAkB,GAA4C,EAC/D,CAAC,GAAgB,KAAqB,EAAwB,KAAK,EACnE,CAAC,GAAe,KAAoB,EAAwB,KAAK,EAEjE,IAAe,QACb,GAAM,2BAA2B,SAAS,EAAE,EAClD,CAAC,GAAM,2BAA2B,MAAM,CACzC,EACK,IAAU,QAAc;EAC5B,IAAM,oBAAM,IAAI,KAA0B;AAC1C,OAAK,IAAM,KAAO,EAAc,GAAI,IAAI,EAAI,IAAI,EAAI;AACpD,SAAO;IACN,CAAC,EAAa,CAAC,EAEZ,IAAY,QAEd,EAAa,KAAK,MAChB,GAAgB,EAAK,CACtB,EACH,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QAAQ;SACR,UAAU;SACV,SAAS,MACP,kBAAC,QAAD;UAAM,WAAU;oBACb,EAAW,EAAI,YAAY,WAAW;UAClC,CAAA;SAEV;QACF;OA8KW,YAAA;OACA,mBAAkB;OAClB,CAAA;MACE,CAAA;KAIP,MAAc,gBACZ,EAAkB,WAAW,IAC5B,kBAAC,GAAD;MACE,cAAa;MACb,OAAM;MACN,aAAY;MACZ,CAAA,GAEF,kBAAC,OAAD;MAAK,WAAU;gBACZ,EAAkB,KAAK,MACtB,kBAAC,OAAD;OAEE,WAAU;iBAFZ,CAIE,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,OAAD;SAAK,WAAU;mBAAf,CACE,kBAAC,MAAD;UAAI,WAAU;oBACX,EAAK;UACH,CAAA,EACL,kBAAC,KAAD;UAAG,WAAU;oBACV,EAAK;UACJ,CAAA,CACA;YACN,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAK;SACD,CAAA,CACH;WACN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,QAAD;SAAM,WAAU;mBAAhB;UAA8C;UAC/B,EAAK;UAAW;UACxB;YACP,kBAAC,UAAD;SACE,MAAK;SACL,eAAe,KAAK,GAAkB,EAAK,GAAG;SAC9C,UAAU,MAAmB,EAAK;SAClC,WAAU;mBAET,MAAmB,EAAK,KACrB,cACA;SACG,CAAA,CACL;UACF;SA/BC,EAAK,GA+BN,CACN;MACE,CAAA;KAES;;GACV"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Automation statistics helpers.
3
+ *
4
+ * The Automation overview needs a "Time Saved" metric, but the GraphQL
5
+ * bootstrap payload carries no per-run "time saved" field — workflow runs only
6
+ * expose their own execution status and (machine) duration. Rather than display
7
+ * a fabricated constant, we derive the figure from the number of automated runs
8
+ * that actually succeeded, using a single, clearly-named estimate of the manual
9
+ * effort each successful run replaces. The derivation is intentionally obvious
10
+ * so the number stays honest: zero successful runs → zero time saved.
11
+ *
12
+ * @module headshotmarketing/utils/automationStats
13
+ */
14
+ /**
15
+ * Estimated minutes of manual work avoided by each successful automated run.
16
+ *
17
+ * This is a documented heuristic, not a measured value: a workflow run replaces
18
+ * a task a person would otherwise have done by hand (sending an email, updating
19
+ * a record, notifying a teammate). We assume ~15 minutes of manual effort per
20
+ * run. Adjust this single constant if the product settles on a different basis.
21
+ */
22
+ export declare const ESTIMATED_MANUAL_MINUTES_PER_RUN = 15;
23
+ /**
24
+ * Estimate total minutes saved from the count of automated runs that succeeded.
25
+ *
26
+ * @param successfulRunCount - number of workflow runs with a "success" outcome.
27
+ * @returns estimated minutes of manual effort saved (never negative).
28
+ */
29
+ export declare function estimateTimeSavedMinutes(successfulRunCount: number): number;
30
+ /**
31
+ * Format an estimated minutes-saved figure for display.
32
+ *
33
+ * Shows whole hours once there is at least an hour, otherwise minutes, so an
34
+ * empty workspace honestly reads "0h" alongside the other zeroed stats.
35
+ *
36
+ * @param totalMinutes - estimated minutes saved (as from {@link estimateTimeSavedMinutes}).
37
+ */
38
+ export declare function formatTimeSaved(totalMinutes: number): string;
39
+ //# sourceMappingURL=automationStats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automationStats.d.ts","sourceRoot":"","sources":["../../../src/headshotmarketing/utils/automationStats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAK3E;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAQ5D"}
@@ -0,0 +1,10 @@
1
+ function e(e) {
2
+ return !Number.isFinite(e) || e <= 0 ? 0 : Math.round(e) * 15;
3
+ }
4
+ function t(e) {
5
+ return !Number.isFinite(e) || e <= 0 ? "0h" : e < 60 ? `${Math.round(e)}m` : `${Math.round(e / 60)}h`;
6
+ }
7
+ //#endregion
8
+ export { e as estimateTimeSavedMinutes, t as formatTimeSaved };
9
+
10
+ //# sourceMappingURL=automationStats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automationStats.js","names":[],"sources":["../../../src/headshotmarketing/utils/automationStats.ts"],"sourcesContent":["/**\n * Automation statistics helpers.\n *\n * The Automation overview needs a \"Time Saved\" metric, but the GraphQL\n * bootstrap payload carries no per-run \"time saved\" field — workflow runs only\n * expose their own execution status and (machine) duration. Rather than display\n * a fabricated constant, we derive the figure from the number of automated runs\n * that actually succeeded, using a single, clearly-named estimate of the manual\n * effort each successful run replaces. The derivation is intentionally obvious\n * so the number stays honest: zero successful runs → zero time saved.\n *\n * @module headshotmarketing/utils/automationStats\n */\n\n/**\n * Estimated minutes of manual work avoided by each successful automated run.\n *\n * This is a documented heuristic, not a measured value: a workflow run replaces\n * a task a person would otherwise have done by hand (sending an email, updating\n * a record, notifying a teammate). We assume ~15 minutes of manual effort per\n * run. Adjust this single constant if the product settles on a different basis.\n */\nexport const ESTIMATED_MANUAL_MINUTES_PER_RUN = 15;\n\n/**\n * Estimate total minutes saved from the count of automated runs that succeeded.\n *\n * @param successfulRunCount - number of workflow runs with a \"success\" outcome.\n * @returns estimated minutes of manual effort saved (never negative).\n */\nexport function estimateTimeSavedMinutes(successfulRunCount: number): number {\n if (!Number.isFinite(successfulRunCount) || successfulRunCount <= 0) {\n return 0;\n }\n return Math.round(successfulRunCount) * ESTIMATED_MANUAL_MINUTES_PER_RUN;\n}\n\n/**\n * Format an estimated minutes-saved figure for display.\n *\n * Shows whole hours once there is at least an hour, otherwise minutes, so an\n * empty workspace honestly reads \"0h\" alongside the other zeroed stats.\n *\n * @param totalMinutes - estimated minutes saved (as from {@link estimateTimeSavedMinutes}).\n */\nexport function formatTimeSaved(totalMinutes: number): string {\n if (!Number.isFinite(totalMinutes) || totalMinutes <= 0) {\n return \"0h\";\n }\n if (totalMinutes < 60) {\n return `${Math.round(totalMinutes)}m`;\n }\n return `${Math.round(totalMinutes / 60)}h`;\n}\n"],"mappings":"AA8BA,SAAgB,EAAyB,GAAoC;AAI3E,QAHI,CAAC,OAAO,SAAS,EAAmB,IAAI,KAAsB,IACzD,IAEF,KAAK,MAAM,EAAmB,GAAA;;AAWvC,SAAgB,EAAgB,GAA8B;AAO5D,QANI,CAAC,OAAO,SAAS,EAAa,IAAI,KAAgB,IAC7C,OAEL,IAAe,KACV,GAAG,KAAK,MAAM,EAAa,CAAC,KAE9B,GAAG,KAAK,MAAM,IAAe,GAAG,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-headshotmarketing",
3
- "version": "2026.923.1",
3
+ "version": "2026.923.2",
4
4
  "description": "Burdenoff HeadshotMarketing Microfrontend - All-in-one marketing automation platform",
5
5
  "type": "module",
6
6
  "files": [