@burdenoff/microfe-headshotmarketing 2026.1201.1 → 2026.1202.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.
- package/dist/headshotmarketing/components/ActionMenu.js +1 -1
- package/dist/headshotmarketing/components/ActionMenu.js.map +1 -1
- package/dist/headshotmarketing/components/AssetUploadButton.js +35 -23
- package/dist/headshotmarketing/components/AssetUploadButton.js.map +1 -1
- package/dist/headshotmarketing/components/DataTable.js +33 -33
- package/dist/headshotmarketing/components/DataTable.js.map +1 -1
- package/dist/headshotmarketing/components/EmptyState.d.ts +15 -0
- package/dist/headshotmarketing/components/EmptyState.js +35 -15
- package/dist/headshotmarketing/components/EmptyState.js.map +1 -1
- package/dist/headshotmarketing/components/FilterBar.js +2 -2
- package/dist/headshotmarketing/components/FilterBar.js.map +1 -1
- package/dist/headshotmarketing/components/InfluencerModals.js +96 -95
- package/dist/headshotmarketing/components/InfluencerModals.js.map +1 -1
- package/dist/headshotmarketing/components/Pagination.js +38 -37
- package/dist/headshotmarketing/components/Pagination.js.map +1 -1
- package/dist/headshotmarketing/components/TagChipsInput.js +1 -1
- package/dist/headshotmarketing/components/TagChipsInput.js.map +1 -1
- package/dist/headshotmarketing/components/Toast.js +1 -1
- package/dist/headshotmarketing/components/Toast.js.map +1 -1
- package/dist/headshotmarketing/components/UploadAudienceSelect.d.ts +7 -0
- package/dist/headshotmarketing/components/UploadAudienceSelect.js +40 -0
- package/dist/headshotmarketing/components/UploadAudienceSelect.js.map +1 -0
- package/dist/headshotmarketing/hooks/useAssetUpload.d.ts +2 -19
- package/dist/headshotmarketing/hooks/useAssetUpload.js +38 -32
- package/dist/headshotmarketing/hooks/useAssetUpload.js.map +1 -1
- package/dist/headshotmarketing/pages/HomeMonthlyGoals.js.map +1 -1
- package/dist/headshotmarketing/pages/HomePage.js +10 -10
- package/dist/headshotmarketing/pages/HomePage.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdCampaignDetailsPage.js +203 -203
- package/dist/headshotmarketing/pages/ads/AdCampaignDetailsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdCampaignsPage.js +148 -148
- package/dist/headshotmarketing/pages/ads/AdCampaignsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdCreativeTestsSection.js +74 -73
- package/dist/headshotmarketing/pages/ads/AdCreativeTestsSection.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdCreativesPage.js +427 -412
- package/dist/headshotmarketing/pages/ads/AdCreativesPage.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdPlatformConnectionsSection.js +111 -110
- package/dist/headshotmarketing/pages/ads/AdPlatformConnectionsSection.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdPlatformSyncPanel.js +1 -1
- package/dist/headshotmarketing/pages/ads/AdPlatformSyncPanel.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdsPage.js +6 -6
- package/dist/headshotmarketing/pages/ads/AdsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AudiencesPage.js +49 -49
- package/dist/headshotmarketing/pages/ads/AudiencesPage.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/CreateAdCampaignPage.js +112 -112
- package/dist/headshotmarketing/pages/ads/CreateAdCampaignPage.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/CreateAudiencePage.js +57 -57
- package/dist/headshotmarketing/pages/ads/CreateAudiencePage.js.map +1 -1
- package/dist/headshotmarketing/pages/ai/AiOperationsPage.js +175 -174
- package/dist/headshotmarketing/pages/ai/AiOperationsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/analytics/AdAnalyticsPage.js +1 -1
- package/dist/headshotmarketing/pages/analytics/AdAnalyticsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/analytics/AttributionPage.js +129 -129
- package/dist/headshotmarketing/pages/analytics/AttributionPage.js.map +1 -1
- package/dist/headshotmarketing/pages/analytics/CampaignAnalyticsPage.js +9 -9
- package/dist/headshotmarketing/pages/analytics/CampaignAnalyticsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/analytics/ReportScheduleDialog.js +95 -94
- package/dist/headshotmarketing/pages/analytics/ReportScheduleDialog.js.map +1 -1
- package/dist/headshotmarketing/pages/analytics/ReportsPage.js +4 -4
- package/dist/headshotmarketing/pages/analytics/ReportsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/analytics/TouchpointLedgerCard.js +42 -41
- package/dist/headshotmarketing/pages/analytics/TouchpointLedgerCard.js.map +1 -1
- package/dist/headshotmarketing/pages/analytics/analyticsWidgets.js +132 -131
- package/dist/headshotmarketing/pages/analytics/analyticsWidgets.js.map +1 -1
- package/dist/headshotmarketing/pages/automation/AutomationPage.js +8 -8
- package/dist/headshotmarketing/pages/automation/AutomationPage.js.map +1 -1
- package/dist/headshotmarketing/pages/automation/TriggersPage.js +48 -48
- package/dist/headshotmarketing/pages/automation/TriggersPage.js.map +1 -1
- package/dist/headshotmarketing/pages/automation/WorkflowBuilderPage.js +4 -3
- package/dist/headshotmarketing/pages/automation/WorkflowBuilderPage.js.map +1 -1
- package/dist/headshotmarketing/pages/automation/WorkflowNodeConfigPanel.js +143 -142
- package/dist/headshotmarketing/pages/automation/WorkflowNodeConfigPanel.js.map +1 -1
- package/dist/headshotmarketing/pages/automation/WorkflowRunsPanel.js +79 -78
- package/dist/headshotmarketing/pages/automation/WorkflowRunsPanel.js.map +1 -1
- package/dist/headshotmarketing/pages/automation/WorkflowsPage.js +92 -92
- package/dist/headshotmarketing/pages/automation/WorkflowsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/builder/LandingPageBuilderPage.js +143 -143
- package/dist/headshotmarketing/pages/builder/LandingPageBuilderPage.js.map +1 -1
- package/dist/headshotmarketing/pages/builder/SectionCanvasBlock.js +3 -3
- package/dist/headshotmarketing/pages/builder/SectionCanvasBlock.js.map +1 -1
- package/dist/headshotmarketing/pages/builder/SectionInspector.js +24 -23
- package/dist/headshotmarketing/pages/builder/SectionInspector.js.map +1 -1
- package/dist/headshotmarketing/pages/campaigns/CampaignDetailsPage.js +198 -193
- package/dist/headshotmarketing/pages/campaigns/CampaignDetailsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/campaigns/CampaignTemplatesPage.js +41 -41
- package/dist/headshotmarketing/pages/campaigns/CampaignTemplatesPage.js.map +1 -1
- package/dist/headshotmarketing/pages/campaigns/CampaignsPage.js +234 -229
- package/dist/headshotmarketing/pages/campaigns/CampaignsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/campaigns/CreateCampaignPage.js +199 -187
- package/dist/headshotmarketing/pages/campaigns/CreateCampaignPage.js.map +1 -1
- package/dist/headshotmarketing/pages/campaigns/CreateTemplateModal.js +46 -46
- package/dist/headshotmarketing/pages/campaigns/CreateTemplateModal.js.map +1 -1
- package/dist/headshotmarketing/pages/content/AIExecutionLedger.js +29 -29
- package/dist/headshotmarketing/pages/content/AIExecutionLedger.js.map +1 -1
- package/dist/headshotmarketing/pages/content/AIToolsPage.js +3 -3
- package/dist/headshotmarketing/pages/content/AIToolsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/content/AssetLibraryPage.js +230 -220
- package/dist/headshotmarketing/pages/content/AssetLibraryPage.js.map +1 -1
- package/dist/headshotmarketing/pages/content/ContentCreationPage.js +431 -420
- package/dist/headshotmarketing/pages/content/ContentCreationPage.js.map +1 -1
- package/dist/headshotmarketing/pages/content/ContentDetailsPage.js +7 -7
- package/dist/headshotmarketing/pages/content/ContentDetailsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/content/ContentLibraryCard.js +2 -2
- package/dist/headshotmarketing/pages/content/ContentLibraryCard.js.map +1 -1
- package/dist/headshotmarketing/pages/content/ContentPage.js +88 -88
- package/dist/headshotmarketing/pages/content/ContentPage.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/ContactsPage.js +111 -111
- package/dist/headshotmarketing/pages/crm/ContactsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/CreateContactPage.js +59 -59
- package/dist/headshotmarketing/pages/crm/CreateContactPage.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/CreateDealPage.js +86 -86
- package/dist/headshotmarketing/pages/crm/CreateDealPage.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/CrmActions.js +93 -92
- package/dist/headshotmarketing/pages/crm/CrmActions.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/CrmPage.js +4 -4
- package/dist/headshotmarketing/pages/crm/CrmPage.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/LeadCreateModal.js +63 -62
- package/dist/headshotmarketing/pages/crm/LeadCreateModal.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/LeadsPage.js +68 -68
- package/dist/headshotmarketing/pages/crm/LeadsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/PipelinePage.js +2 -2
- package/dist/headshotmarketing/pages/crm/PipelinePage.js.map +1 -1
- package/dist/headshotmarketing/pages/events/CreateEventPage.js +165 -165
- package/dist/headshotmarketing/pages/events/CreateEventPage.js.map +1 -1
- package/dist/headshotmarketing/pages/events/EventDetailsPage.js +255 -250
- package/dist/headshotmarketing/pages/events/EventDetailsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/events/EventImageUpload.js +8 -2
- package/dist/headshotmarketing/pages/events/EventImageUpload.js.map +1 -1
- package/dist/headshotmarketing/pages/events/EventPagePreview.js +2 -2
- package/dist/headshotmarketing/pages/events/EventPagePreview.js.map +1 -1
- package/dist/headshotmarketing/pages/events/EventsPage.js +70 -70
- package/dist/headshotmarketing/pages/events/EventsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/influencers/InfluencerCampaignsPage.js +7 -7
- package/dist/headshotmarketing/pages/influencers/InfluencerCampaignsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/influencers/InfluencerDiscoveryPage.js +98 -98
- package/dist/headshotmarketing/pages/influencers/InfluencerDiscoveryPage.js.map +1 -1
- package/dist/headshotmarketing/pages/influencers/InfluencersPage.js +1 -1
- package/dist/headshotmarketing/pages/influencers/InfluencersPage.js.map +1 -1
- package/dist/headshotmarketing/pages/influencers/RelationshipsPage.js +145 -140
- package/dist/headshotmarketing/pages/influencers/RelationshipsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/seo/SeoScorePanel.js +1 -1
- package/dist/headshotmarketing/pages/seo/SeoScorePanel.js.map +1 -1
- package/dist/headshotmarketing/pages/seo/SeoToolsPage.js +286 -286
- package/dist/headshotmarketing/pages/seo/SeoToolsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/social-media/AccountsPage.js +171 -166
- package/dist/headshotmarketing/pages/social-media/AccountsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/social-media/ContentCalendarPage.js +1 -1
- package/dist/headshotmarketing/pages/social-media/ContentCalendarPage.js.map +1 -1
- package/dist/headshotmarketing/pages/social-media/CreateAccountPage.js +1 -1
- package/dist/headshotmarketing/pages/social-media/CreateAccountPage.js.map +1 -1
- package/dist/headshotmarketing/pages/social-media/MediaDropZone.js +3 -3
- package/dist/headshotmarketing/pages/social-media/MediaDropZone.js.map +1 -1
- package/dist/headshotmarketing/pages/social-media/PostsPage.js +257 -252
- package/dist/headshotmarketing/pages/social-media/PostsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/social-media/SocialComposerPreview.js +2 -2
- package/dist/headshotmarketing/pages/social-media/SocialComposerPreview.js.map +1 -1
- package/dist/headshotmarketing/pages/social-media/SocialMediaComposePage.js +4 -4
- package/dist/headshotmarketing/pages/social-media/SocialMediaComposePage.js.map +1 -1
- package/dist/headshotmarketing/pages/social-media/SocialMediaPage.js +115 -115
- package/dist/headshotmarketing/pages/social-media/SocialMediaPage.js.map +1 -1
- package/package.json +6 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useCancelHeadshotmarketingAutomationWorkflowRunMutation as e, useHeadshotmarketingAutomationWorkflowRunLogsQuery as t, useHeadshotmarketingAutomationWorkflowRunsQuery as n, useRetryHeadshotmarketingAutomationWorkflowRunMutation as r, useTriggerHeadshotmarketingAutomationWorkflowMutation as i } from "../../../generated/wspace-operations.js";
|
|
2
2
|
import { HeadshotmarketingAutomationSubjectType as a } from "../../../generated/wspace-types.js";
|
|
3
3
|
import "../../components/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { EmptyState as o } from "../../components/EmptyState.js";
|
|
5
|
+
import { StatusBadge as s } from "../../components/StatusBadge.js";
|
|
6
6
|
import { Modal as c } from "../../components/Modal.js";
|
|
7
7
|
import "../../hooks/index.js";
|
|
8
8
|
import { useHeadshotmarketingBootstrap as l } from "../../hooks/useHeadshotmarketingBootstrap.js";
|
|
@@ -12,29 +12,30 @@ import { parseEngineSteps as h } from "./workflowCompiler.js";
|
|
|
12
12
|
import { useMemo as g, useState as _ } from "react";
|
|
13
13
|
import { Ban as v, ChevronRight as y, Play as b, RotateCcw as x } from "lucide-react";
|
|
14
14
|
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
15
|
+
import { ThemedSelect as w } from "@burdenoff/fe-libs/ui";
|
|
15
16
|
// src/headshotmarketing/pages/automation/WorkflowRunsPanel.tsx
|
|
16
|
-
var
|
|
17
|
-
function
|
|
17
|
+
var T = "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", E = "inline-flex min-h-9 items-center gap-1.5 rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50";
|
|
18
|
+
function D(e, t) {
|
|
18
19
|
return e instanceof Error && e.message ? e.message : t;
|
|
19
20
|
}
|
|
20
|
-
var
|
|
21
|
+
var O = ({ run: e, steps: n }) => {
|
|
21
22
|
let { data: r, loading: i, error: a } = t({
|
|
22
23
|
variables: { workflowRunId: e.id },
|
|
23
24
|
fetchPolicy: "network-only"
|
|
24
|
-
}),
|
|
25
|
+
}), o = r?.headshotmarketingAutomationWorkflowRunLogs ?? [];
|
|
25
26
|
return i ? /* @__PURE__ */ S("p", {
|
|
26
27
|
className: "text-xs text-text-secondary",
|
|
27
28
|
children: "Loading step log…"
|
|
28
29
|
}) : a ? /* @__PURE__ */ C("p", {
|
|
29
30
|
className: "text-xs text-status-error-text",
|
|
30
31
|
children: ["Could not load the step log: ", a.message]
|
|
31
|
-
}) :
|
|
32
|
+
}) : o.length === 0 ? /* @__PURE__ */ S("p", {
|
|
32
33
|
className: "text-xs text-text-secondary",
|
|
33
34
|
children: "No steps have run yet."
|
|
34
35
|
}) : /* @__PURE__ */ S("ol", {
|
|
35
36
|
className: "space-y-1.5",
|
|
36
37
|
"aria-label": "Step log",
|
|
37
|
-
children:
|
|
38
|
+
children: o.map((e) => /* @__PURE__ */ C("li", {
|
|
38
39
|
className: "flex flex-wrap items-center gap-2 rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-xs",
|
|
39
40
|
children: [
|
|
40
41
|
/* @__PURE__ */ C("span", {
|
|
@@ -45,13 +46,13 @@ var D = ({ run: e, steps: n }) => {
|
|
|
45
46
|
m(n, e.stepIndex, e.stepType)
|
|
46
47
|
]
|
|
47
48
|
}),
|
|
48
|
-
/* @__PURE__ */ S(
|
|
49
|
+
/* @__PURE__ */ S(s, { status: e.status.toLowerCase() }),
|
|
49
50
|
e.attempt > 1 && /* @__PURE__ */ C("span", {
|
|
50
51
|
className: "text-text-secondary",
|
|
51
52
|
children: ["attempt ", e.attempt]
|
|
52
53
|
}),
|
|
53
54
|
/* @__PURE__ */ S("span", {
|
|
54
|
-
className: "
|
|
55
|
+
className: "ms-auto text-text-secondary",
|
|
55
56
|
children: d(e.executedAt, "relative")
|
|
56
57
|
}),
|
|
57
58
|
e.errorMessage && /* @__PURE__ */ S("span", {
|
|
@@ -61,16 +62,16 @@ var D = ({ run: e, steps: n }) => {
|
|
|
61
62
|
]
|
|
62
63
|
}, e.id))
|
|
63
64
|
});
|
|
64
|
-
},
|
|
65
|
-
let { data:
|
|
65
|
+
}, k = ({ workflow: t, open: m, onClose: k, onChanged: A }) => {
|
|
66
|
+
let { data: j } = l(), { data: M, loading: N, error: P, refetch: F } = n({
|
|
66
67
|
variables: {
|
|
67
68
|
filter: { workflowId: t.id },
|
|
68
69
|
pagination: { limit: 50 }
|
|
69
70
|
},
|
|
70
71
|
skip: !m,
|
|
71
72
|
fetchPolicy: "network-only"
|
|
72
|
-
}), [
|
|
73
|
-
let e =
|
|
73
|
+
}), [I] = r(), [L] = e(), [R, { loading: z }] = i(), [B, V] = _(null), [H, U] = _(null), [W, G] = _(""), [K, q] = _(null), J = g(() => h(t.steps), [t]), Y = M?.headshotmarketingAutomationWorkflowRuns.items ?? [], X = M?.headshotmarketingAutomationWorkflowRuns.total ?? 0, Z = g(() => {
|
|
74
|
+
let e = j?.headshotmarketingLeads.items ?? [], t = j?.headshotmarketingContacts.items ?? [];
|
|
74
75
|
return {
|
|
75
76
|
leads: e.map((e) => ({
|
|
76
77
|
key: `LEAD:${e.id}`,
|
|
@@ -81,69 +82,69 @@ var D = ({ run: e, steps: n }) => {
|
|
|
81
82
|
label: `${e.firstName ?? ""} ${e.lastName ?? ""}`.trim() || e.email || e.id
|
|
82
83
|
}))
|
|
83
84
|
};
|
|
84
|
-
}, [
|
|
85
|
+
}, [j]), Q = g(() => {
|
|
85
86
|
let e = /* @__PURE__ */ new Map();
|
|
86
|
-
for (let t of [...
|
|
87
|
+
for (let t of [...Z.leads, ...Z.contacts]) e.set(t.key, t.label);
|
|
87
88
|
return (t) => e.get(`${t.subjectType}:${t.subjectId}`) ?? `${t.subjectType.toLowerCase()} ${t.subjectId.slice(0, 8)}`;
|
|
88
|
-
}, [
|
|
89
|
-
|
|
89
|
+
}, [Z]), $ = async (e) => {
|
|
90
|
+
q({
|
|
90
91
|
tone: "success",
|
|
91
92
|
text: e
|
|
92
|
-
}), await
|
|
93
|
-
},
|
|
94
|
-
|
|
93
|
+
}), await F(), A();
|
|
94
|
+
}, ee = async (e) => {
|
|
95
|
+
U(e.id), q(null);
|
|
95
96
|
try {
|
|
96
|
-
let t = (await
|
|
97
|
-
await
|
|
97
|
+
let t = (await I({ variables: { id: e.id } })).data?.retryHeadshotmarketingAutomationWorkflowRun.status ?? "";
|
|
98
|
+
await $(`Retried the failed step — run is now ${t.toLowerCase()}.`), V(e.id);
|
|
98
99
|
} catch (e) {
|
|
99
|
-
|
|
100
|
+
q({
|
|
100
101
|
tone: "error",
|
|
101
|
-
text:
|
|
102
|
+
text: D(e, "Retry failed.")
|
|
102
103
|
});
|
|
103
104
|
} finally {
|
|
104
|
-
|
|
105
|
+
U(null);
|
|
105
106
|
}
|
|
106
|
-
},
|
|
107
|
-
|
|
107
|
+
}, te = async (e) => {
|
|
108
|
+
U(e.id), q(null);
|
|
108
109
|
try {
|
|
109
|
-
await
|
|
110
|
+
await L({ variables: { id: e.id } }), await $("Run cancelled.");
|
|
110
111
|
} catch (e) {
|
|
111
|
-
|
|
112
|
+
q({
|
|
112
113
|
tone: "error",
|
|
113
|
-
text:
|
|
114
|
+
text: D(e, "Cancel failed.")
|
|
114
115
|
});
|
|
115
116
|
} finally {
|
|
116
|
-
|
|
117
|
+
U(null);
|
|
117
118
|
}
|
|
118
|
-
},
|
|
119
|
-
let [e, n] =
|
|
120
|
-
if (!e || !n)
|
|
119
|
+
}, ne = async () => {
|
|
120
|
+
let [e, n] = W.split(":");
|
|
121
|
+
if (!e || !n) q({
|
|
121
122
|
tone: "error",
|
|
122
123
|
text: "Choose a lead or contact first."
|
|
123
124
|
});
|
|
124
125
|
else {
|
|
125
|
-
|
|
126
|
+
q(null);
|
|
126
127
|
try {
|
|
127
|
-
let r = (await
|
|
128
|
+
let r = (await R({ variables: {
|
|
128
129
|
workflowId: t.id,
|
|
129
130
|
subjectType: e === "CONTACT" ? a.Contact : a.Lead,
|
|
130
131
|
subjectId: n,
|
|
131
132
|
context: {}
|
|
132
133
|
} })).data?.hmTriggerAutomationWorkflow;
|
|
133
|
-
await
|
|
134
|
+
await $(`Run started — ${r ? r.status.toLowerCase() : "queued"}.`), r && V(r.id);
|
|
134
135
|
} catch (e) {
|
|
135
|
-
|
|
136
|
+
q({
|
|
136
137
|
tone: "error",
|
|
137
|
-
text:
|
|
138
|
+
text: D(e, "Could not start.")
|
|
138
139
|
});
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
142
|
};
|
|
142
143
|
return /* @__PURE__ */ S(c, {
|
|
143
144
|
open: m,
|
|
144
|
-
onClose:
|
|
145
|
+
onClose: k,
|
|
145
146
|
title: `Runs · ${t.name}`,
|
|
146
|
-
description: `${
|
|
147
|
+
description: `${X} run${X === 1 ? "" : "s"} in total. Open a run to see each step it executed.`,
|
|
147
148
|
size: "xl",
|
|
148
149
|
children: /* @__PURE__ */ C("div", {
|
|
149
150
|
className: "space-y-4",
|
|
@@ -156,26 +157,26 @@ var D = ({ run: e, steps: n }) => {
|
|
|
156
157
|
htmlFor: `run-subject-${t.id}`,
|
|
157
158
|
className: "mb-1 block text-xs font-medium text-text-primary",
|
|
158
159
|
children: "Run now for"
|
|
159
|
-
}), /* @__PURE__ */ C(
|
|
160
|
+
}), /* @__PURE__ */ C(w, {
|
|
160
161
|
id: `run-subject-${t.id}`,
|
|
161
|
-
value:
|
|
162
|
-
onChange: (e) =>
|
|
163
|
-
className:
|
|
162
|
+
value: W,
|
|
163
|
+
onChange: (e) => G(e.target.value),
|
|
164
|
+
className: T,
|
|
164
165
|
children: [
|
|
165
166
|
/* @__PURE__ */ S("option", {
|
|
166
167
|
value: "",
|
|
167
168
|
children: "Choose a lead or contact…"
|
|
168
169
|
}),
|
|
169
|
-
|
|
170
|
+
Z.leads.length > 0 && /* @__PURE__ */ S("optgroup", {
|
|
170
171
|
label: "Leads",
|
|
171
|
-
children:
|
|
172
|
+
children: Z.leads.map((e) => /* @__PURE__ */ S("option", {
|
|
172
173
|
value: e.key,
|
|
173
174
|
children: e.label
|
|
174
175
|
}, e.key))
|
|
175
176
|
}),
|
|
176
|
-
|
|
177
|
+
Z.contacts.length > 0 && /* @__PURE__ */ S("optgroup", {
|
|
177
178
|
label: "Contacts",
|
|
178
|
-
children:
|
|
179
|
+
children: Z.contacts.map((e) => /* @__PURE__ */ S("option", {
|
|
179
180
|
value: e.key,
|
|
180
181
|
children: e.label
|
|
181
182
|
}, e.key))
|
|
@@ -184,35 +185,35 @@ var D = ({ run: e, steps: n }) => {
|
|
|
184
185
|
})]
|
|
185
186
|
}), /* @__PURE__ */ C("button", {
|
|
186
187
|
type: "button",
|
|
187
|
-
onClick: () => void
|
|
188
|
-
disabled:
|
|
188
|
+
onClick: () => void ne(),
|
|
189
|
+
disabled: z || !W,
|
|
189
190
|
className: "inline-flex min-h-10 items-center gap-2 rounded-md bg-action-primary-bg px-3.5 py-2 text-sm font-semibold text-action-primary-text hover:bg-action-primary-bgHover disabled:opacity-60",
|
|
190
|
-
children: [/* @__PURE__ */ S(b, { className: "h-4 w-4" }),
|
|
191
|
+
children: [/* @__PURE__ */ S(b, { className: "h-4 w-4" }), z ? "Starting…" : "Run now"]
|
|
191
192
|
})]
|
|
192
193
|
}) : /* @__PURE__ */ S("p", {
|
|
193
194
|
className: "rounded-lg border border-border-subtle bg-bg-sunken px-3 py-2 text-xs text-text-secondary",
|
|
194
195
|
children: "Publish this workflow to run it. Draft and paused workflows never start new runs."
|
|
195
196
|
}),
|
|
196
|
-
|
|
197
|
+
K && /* @__PURE__ */ S("div", {
|
|
197
198
|
role: "status",
|
|
198
|
-
className: u("rounded-lg border px-3 py-2 text-sm",
|
|
199
|
-
children:
|
|
199
|
+
className: u("rounded-lg border px-3 py-2 text-sm", K.tone === "error" ? "border-status-error-border bg-status-error-bg text-status-error-text" : "border-status-success-border bg-status-success-bg text-status-success-text"),
|
|
200
|
+
children: K.text
|
|
200
201
|
}),
|
|
201
|
-
|
|
202
|
+
N && Y.length === 0 ? /* @__PURE__ */ S("p", {
|
|
202
203
|
className: "text-sm text-text-secondary",
|
|
203
204
|
children: "Loading runs…"
|
|
204
|
-
}) :
|
|
205
|
+
}) : P ? /* @__PURE__ */ C("p", {
|
|
205
206
|
className: "text-sm text-status-error-text",
|
|
206
|
-
children: ["Could not load runs: ",
|
|
207
|
-
}) :
|
|
207
|
+
children: ["Could not load runs: ", P.message]
|
|
208
|
+
}) : Y.length === 0 ? /* @__PURE__ */ S(o, {
|
|
208
209
|
illustration: "empty-generic",
|
|
209
210
|
title: "No runs yet",
|
|
210
211
|
description: "Runs appear here when the trigger fires or you run the workflow."
|
|
211
212
|
}) : /* @__PURE__ */ S("ul", {
|
|
212
213
|
className: "space-y-2",
|
|
213
214
|
"aria-label": "Workflow runs",
|
|
214
|
-
children:
|
|
215
|
-
let t =
|
|
215
|
+
children: Y.map((e) => {
|
|
216
|
+
let t = B === e.id;
|
|
216
217
|
return /* @__PURE__ */ C("li", {
|
|
217
218
|
className: "rounded-lg border border-border-seam bg-gloss-card p-3",
|
|
218
219
|
children: [
|
|
@@ -221,16 +222,16 @@ var D = ({ run: e, steps: n }) => {
|
|
|
221
222
|
children: [
|
|
222
223
|
/* @__PURE__ */ C("button", {
|
|
223
224
|
type: "button",
|
|
224
|
-
onClick: () =>
|
|
225
|
+
onClick: () => V(t ? null : e.id),
|
|
225
226
|
"aria-expanded": t,
|
|
226
|
-
className: "flex min-w-0 flex-1 items-center gap-2 text-
|
|
227
|
+
className: "flex min-w-0 flex-1 items-center gap-2 text-start",
|
|
227
228
|
children: [
|
|
228
229
|
/* @__PURE__ */ S(y, { className: u("h-4 w-4 flex-shrink-0 text-text-secondary transition-transform", t && "rotate-90") }),
|
|
229
230
|
/* @__PURE__ */ S("span", {
|
|
230
231
|
className: "truncate text-sm font-medium text-text-primary",
|
|
231
|
-
children:
|
|
232
|
+
children: Q(e)
|
|
232
233
|
}),
|
|
233
|
-
/* @__PURE__ */ S(
|
|
234
|
+
/* @__PURE__ */ S(s, { status: e.status.toLowerCase() }),
|
|
234
235
|
/* @__PURE__ */ S("span", {
|
|
235
236
|
className: "text-xs text-text-secondary",
|
|
236
237
|
children: d(e.startedAt, "relative")
|
|
@@ -247,26 +248,26 @@ var D = ({ run: e, steps: n }) => {
|
|
|
247
248
|
}),
|
|
248
249
|
p(e.status) && /* @__PURE__ */ C("button", {
|
|
249
250
|
type: "button",
|
|
250
|
-
onClick: () => void
|
|
251
|
-
disabled:
|
|
252
|
-
className:
|
|
251
|
+
onClick: () => void ee(e),
|
|
252
|
+
disabled: H === e.id,
|
|
253
|
+
className: E,
|
|
253
254
|
children: [/* @__PURE__ */ S(x, { className: "h-3.5 w-3.5" }), "Retry"]
|
|
254
255
|
}),
|
|
255
256
|
f(e.status) && /* @__PURE__ */ C("button", {
|
|
256
257
|
type: "button",
|
|
257
|
-
onClick: () => void
|
|
258
|
-
disabled:
|
|
259
|
-
className: u(
|
|
258
|
+
onClick: () => void te(e),
|
|
259
|
+
disabled: H === e.id,
|
|
260
|
+
className: u(E, "text-status-error-text"),
|
|
260
261
|
children: [/* @__PURE__ */ S(v, { className: "h-3.5 w-3.5" }), "Cancel"]
|
|
261
262
|
})
|
|
262
263
|
]
|
|
263
264
|
}),
|
|
264
265
|
e.errorMessage && /* @__PURE__ */ S("p", {
|
|
265
|
-
className: "mt-1.5
|
|
266
|
+
className: "mt-1.5 ps-6 text-xs text-status-error-text",
|
|
266
267
|
children: e.errorMessage
|
|
267
268
|
}),
|
|
268
269
|
e.status === "WAITING" && e.nextStepDueAt && /* @__PURE__ */ C("p", {
|
|
269
|
-
className: "mt-1.5
|
|
270
|
+
className: "mt-1.5 ps-6 text-xs text-text-secondary",
|
|
270
271
|
children: [
|
|
271
272
|
"Next step due",
|
|
272
273
|
" ",
|
|
@@ -274,10 +275,10 @@ var D = ({ run: e, steps: n }) => {
|
|
|
274
275
|
]
|
|
275
276
|
}),
|
|
276
277
|
t && /* @__PURE__ */ S("div", {
|
|
277
|
-
className: "mt-3
|
|
278
|
-
children: /* @__PURE__ */ S(
|
|
278
|
+
className: "mt-3 ps-6",
|
|
279
|
+
children: /* @__PURE__ */ S(O, {
|
|
279
280
|
run: e,
|
|
280
|
-
steps:
|
|
281
|
+
steps: J
|
|
281
282
|
})
|
|
282
283
|
})
|
|
283
284
|
]
|
|
@@ -288,6 +289,6 @@ var D = ({ run: e, steps: n }) => {
|
|
|
288
289
|
})
|
|
289
290
|
});
|
|
290
291
|
};
|
|
291
|
-
export {
|
|
292
|
+
export { k as WorkflowRunsPanel };
|
|
292
293
|
|
|
293
294
|
//# sourceMappingURL=WorkflowRunsPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowRunsPanel.js","names":["FIELD","BUTTON","errorText","err","fallback","RunLogs","useHeadshotmarketingAutomationWorkflowRunLogsQuery","run","logs","data","loading","error","log","stepName","steps","StatusBadge","formatDate","WorkflowRunsPanel","bootstrap","useHeadshotmarketingBootstrap","useHeadshotmarketingAutomationWorkflowRunsQuery","workflow","open","retryRun","useRetryHeadshotmarketingAutomationWorkflowRunMutation","cancelRun","useCancelHeadshotmarketingAutomationWorkflowRunMutation","triggerRun","starting","useTriggerHeadshotmarketingAutomationWorkflowMutation","expandedId","setExpandedId","useState","busyRunId","setBusyRunId","subject","setSubject","message","setMessage","useMemo","parseEngineSteps","runs","total","subjects","leadItems","contactItems","l","c","subjectName","map","s","after","refetch","onChanged","handleRetry","status","handleCancel","handleStart","type","id","HeadshotmarketingAutomationSubjectType","Modal","Play","cn","EmptyState","expanded","ChevronRight","isRunRetryable","RotateCcw","isRunCancellable","Ban"],"sources":["../../../../src/headshotmarketing/pages/automation/WorkflowRunsPanel.tsx"],"sourcesContent":["/**\n * Run history for one workflow (BOFF-10192): every run with its status,\n * per-step logs, Retry for failed runs, Cancel for unfinished runs, and a\n * \"Run now\" for active workflows against a chosen lead or contact.\n * @module headshotmarketing/pages/automation\n */\nimport { useMemo, useState, type FC } from \"react\";\nimport { Play, RotateCcw, Ban, ChevronRight } from \"lucide-react\";\nimport {\n useCancelHeadshotmarketingAutomationWorkflowRunMutation,\n useHeadshotmarketingAutomationWorkflowRunLogsQuery,\n useHeadshotmarketingAutomationWorkflowRunsQuery,\n useRetryHeadshotmarketingAutomationWorkflowRunMutation,\n useTriggerHeadshotmarketingAutomationWorkflowMutation,\n type HeadshotmarketingAutomationWorkflowRunLogsQuery,\n type HeadshotmarketingBootstrapDataQuery,\n} from \"../../../generated/wspace-operations\";\nimport { HeadshotmarketingAutomationSubjectType } from \"../../../generated/wspace-types\";\nimport { Modal, StatusBadge, EmptyState } from \"../../components\";\nimport { useHeadshotmarketingBootstrap } from \"../../hooks\";\nimport { cn, formatDate } from \"../../utils/helpers\";\nimport {\n isRunCancellable,\n isRunRetryable,\n stepName,\n} from \"../../utils/automationMapper\";\nimport { parseEngineSteps, type EngineStep } from \"./workflowCompiler\";\nimport type { AutomationRun, AutomationWorkflow } from \"./useAutomationData\";\n\nconst FIELD =\n \"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\";\nconst BUTTON =\n \"inline-flex min-h-9 items-center gap-1.5 rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50\";\n\nfunction errorText(err: unknown, fallback: string): string {\n return err instanceof Error && err.message ? err.message : fallback;\n}\n\nconst RunLogs: FC<{ run: AutomationRun; steps: EngineStep[] }> = ({\n run,\n steps,\n}) => {\n const { data, loading, error } =\n useHeadshotmarketingAutomationWorkflowRunLogsQuery({\n variables: { workflowRunId: run.id },\n fetchPolicy: \"network-only\",\n });\n // Generated hooks resolve their data type loosely, so pin it here.\n const logs: HeadshotmarketingAutomationWorkflowRunLogsQuery[\"headshotmarketingAutomationWorkflowRunLogs\"] =\n data?.headshotmarketingAutomationWorkflowRunLogs ?? [];\n if (loading) {\n return <p className=\"text-xs text-text-secondary\">Loading step log…</p>;\n }\n if (error) {\n return (\n <p className=\"text-xs text-status-error-text\">\n Could not load the step log: {error.message}\n </p>\n );\n }\n if (logs.length === 0) {\n return (\n <p className=\"text-xs text-text-secondary\">No steps have run yet.</p>\n );\n }\n return (\n <ol className=\"space-y-1.5\" aria-label=\"Step log\">\n {logs.map((log) => (\n <li\n key={log.id}\n className=\"flex flex-wrap items-center gap-2 rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-xs\"\n >\n <span className=\"font-medium text-text-primary\">\n {log.stepIndex + 1}. {stepName(steps, log.stepIndex, log.stepType)}\n </span>\n <StatusBadge status={log.status.toLowerCase()} />\n {log.attempt > 1 && (\n <span className=\"text-text-secondary\">attempt {log.attempt}</span>\n )}\n <span className=\"ml-auto text-text-secondary\">\n {formatDate(log.executedAt, \"relative\")}\n </span>\n {log.errorMessage && (\n <span className=\"basis-full text-status-error-text\">\n {log.errorMessage}\n </span>\n )}\n </li>\n ))}\n </ol>\n );\n};\n\ninterface WorkflowRunsPanelProps {\n workflow: AutomationWorkflow;\n open: boolean;\n onClose: () => void;\n /** Called after a run is started, retried or cancelled. */\n onChanged: () => void;\n}\n\nexport const WorkflowRunsPanel: FC<WorkflowRunsPanelProps> = ({\n workflow,\n open,\n onClose,\n onChanged,\n}) => {\n const { data: bootstrap } = useHeadshotmarketingBootstrap();\n const { data, loading, error, refetch } =\n useHeadshotmarketingAutomationWorkflowRunsQuery({\n variables: {\n filter: { workflowId: workflow.id },\n pagination: { limit: 50 },\n },\n skip: !open,\n fetchPolicy: \"network-only\",\n });\n const [retryRun] = useRetryHeadshotmarketingAutomationWorkflowRunMutation();\n const [cancelRun] = useCancelHeadshotmarketingAutomationWorkflowRunMutation();\n const [triggerRun, { loading: starting }] =\n useTriggerHeadshotmarketingAutomationWorkflowMutation();\n const [expandedId, setExpandedId] = useState<string | null>(null);\n const [busyRunId, setBusyRunId] = useState<string | null>(null);\n const [subject, setSubject] = useState(\"\");\n const [message, setMessage] = useState<{\n tone: \"error\" | \"success\";\n text: string;\n } | null>(null);\n\n const steps = useMemo(() => parseEngineSteps(workflow.steps), [workflow]);\n const runs: AutomationRun[] =\n data?.headshotmarketingAutomationWorkflowRuns.items ?? [];\n const total: number =\n data?.headshotmarketingAutomationWorkflowRuns.total ?? 0;\n\n const subjects = useMemo(() => {\n const leadItems: HeadshotmarketingBootstrapDataQuery[\"headshotmarketingLeads\"][\"items\"] =\n bootstrap?.headshotmarketingLeads.items ?? [];\n const contactItems: HeadshotmarketingBootstrapDataQuery[\"headshotmarketingContacts\"][\"items\"] =\n bootstrap?.headshotmarketingContacts.items ?? [];\n const leads = leadItems.map((l) => ({\n key: `LEAD:${l.id}`,\n label: l.title,\n }));\n const contacts = contactItems.map((c) => ({\n key: `CONTACT:${c.id}`,\n label:\n `${c.firstName ?? \"\"} ${c.lastName ?? \"\"}`.trim() || c.email || c.id,\n }));\n return { leads, contacts };\n }, [bootstrap]);\n\n const subjectName = useMemo(() => {\n const map = new Map<string, string>();\n for (const s of [...subjects.leads, ...subjects.contacts])\n map.set(s.key, s.label);\n return (run: AutomationRun): string =>\n map.get(`${run.subjectType}:${run.subjectId}`) ??\n `${run.subjectType.toLowerCase()} ${run.subjectId.slice(0, 8)}`;\n }, [subjects]);\n\n const after = async (text: string): Promise<void> => {\n setMessage({ tone: \"success\", text });\n await refetch();\n onChanged();\n };\n\n const handleRetry = async (run: AutomationRun): Promise<void> => {\n setBusyRunId(run.id);\n setMessage(null);\n try {\n const res = await retryRun({ variables: { id: run.id } });\n const status =\n res.data?.retryHeadshotmarketingAutomationWorkflowRun.status ?? \"\";\n await after(\n `Retried the failed step — run is now ${status.toLowerCase()}.`,\n );\n setExpandedId(run.id);\n } catch (err) {\n setMessage({ tone: \"error\", text: errorText(err, \"Retry failed.\") });\n } finally {\n setBusyRunId(null);\n }\n };\n\n const handleCancel = async (run: AutomationRun): Promise<void> => {\n setBusyRunId(run.id);\n setMessage(null);\n try {\n await cancelRun({ variables: { id: run.id } });\n await after(\"Run cancelled.\");\n } catch (err) {\n setMessage({ tone: \"error\", text: errorText(err, \"Cancel failed.\") });\n } finally {\n setBusyRunId(null);\n }\n };\n\n const handleStart = async (): Promise<void> => {\n const [type, id] = subject.split(\":\");\n if (!type || !id) {\n setMessage({ tone: \"error\", text: \"Choose a lead or contact first.\" });\n return;\n }\n setMessage(null);\n try {\n const res = await triggerRun({\n variables: {\n workflowId: workflow.id,\n subjectType:\n type === \"CONTACT\"\n ? HeadshotmarketingAutomationSubjectType.Contact\n : HeadshotmarketingAutomationSubjectType.Lead,\n subjectId: id,\n context: {},\n },\n });\n const run = res.data?.hmTriggerAutomationWorkflow;\n await after(\n `Run started — ${run ? run.status.toLowerCase() : \"queued\"}.`,\n );\n if (run) setExpandedId(run.id);\n } catch (err) {\n setMessage({ tone: \"error\", text: errorText(err, \"Could not start.\") });\n }\n };\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n title={`Runs · ${workflow.name}`}\n description={`${total} run${total === 1 ? \"\" : \"s\"} in total. Open a run to see each step it executed.`}\n size=\"xl\"\n >\n <div className=\"space-y-4\">\n {workflow.status === \"ACTIVE\" ? (\n <div className=\"flex flex-wrap items-end gap-2 rounded-lg border border-border-subtle bg-bg-sunken p-3\">\n <div className=\"min-w-[220px] flex-1\">\n <label\n htmlFor={`run-subject-${workflow.id}`}\n className=\"mb-1 block text-xs font-medium text-text-primary\"\n >\n Run now for\n </label>\n <select\n id={`run-subject-${workflow.id}`}\n value={subject}\n onChange={(e) => setSubject(e.target.value)}\n className={FIELD}\n >\n <option value=\"\">Choose a lead or contact…</option>\n {subjects.leads.length > 0 && (\n <optgroup label=\"Leads\">\n {subjects.leads.map((s) => (\n <option key={s.key} value={s.key}>\n {s.label}\n </option>\n ))}\n </optgroup>\n )}\n {subjects.contacts.length > 0 && (\n <optgroup label=\"Contacts\">\n {subjects.contacts.map((s) => (\n <option key={s.key} value={s.key}>\n {s.label}\n </option>\n ))}\n </optgroup>\n )}\n </select>\n </div>\n <button\n type=\"button\"\n onClick={() => void handleStart()}\n disabled={starting || !subject}\n className=\"inline-flex min-h-10 items-center gap-2 rounded-md bg-action-primary-bg px-3.5 py-2 text-sm font-semibold text-action-primary-text hover:bg-action-primary-bgHover disabled:opacity-60\"\n >\n <Play className=\"h-4 w-4\" />\n {starting ? \"Starting…\" : \"Run now\"}\n </button>\n </div>\n ) : (\n <p className=\"rounded-lg border border-border-subtle bg-bg-sunken px-3 py-2 text-xs text-text-secondary\">\n Publish this workflow to run it. Draft and paused workflows never\n start new runs.\n </p>\n )}\n\n {message && (\n <div\n role=\"status\"\n className={cn(\n \"rounded-lg border px-3 py-2 text-sm\",\n message.tone === \"error\"\n ? \"border-status-error-border bg-status-error-bg text-status-error-text\"\n : \"border-status-success-border bg-status-success-bg text-status-success-text\",\n )}\n >\n {message.text}\n </div>\n )}\n\n {loading && runs.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">Loading runs…</p>\n ) : error ? (\n <p className=\"text-sm text-status-error-text\">\n Could not load runs: {error.message}\n </p>\n ) : runs.length === 0 ? (\n <EmptyState\n illustration=\"empty-generic\"\n title=\"No runs yet\"\n description=\"Runs appear here when the trigger fires or you run the workflow.\"\n />\n ) : (\n <ul className=\"space-y-2\" aria-label=\"Workflow runs\">\n {runs.map((run) => {\n const expanded = expandedId === run.id;\n return (\n <li\n key={run.id}\n className=\"rounded-lg border border-border-seam bg-gloss-card p-3\"\n >\n <div className=\"flex flex-wrap items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setExpandedId(expanded ? null : run.id)}\n aria-expanded={expanded}\n className=\"flex min-w-0 flex-1 items-center gap-2 text-left\"\n >\n <ChevronRight\n className={cn(\n \"h-4 w-4 flex-shrink-0 text-text-secondary transition-transform\",\n expanded && \"rotate-90\",\n )}\n />\n <span className=\"truncate text-sm font-medium text-text-primary\">\n {subjectName(run)}\n </span>\n <StatusBadge status={run.status.toLowerCase()} />\n <span className=\"text-xs text-text-secondary\">\n {formatDate(run.startedAt, \"relative\")}\n </span>\n {run.retryCount > 0 && (\n <span className=\"text-xs text-text-secondary\">\n · retried {run.retryCount}×\n </span>\n )}\n </button>\n {isRunRetryable(run.status) && (\n <button\n type=\"button\"\n onClick={() => void handleRetry(run)}\n disabled={busyRunId === run.id}\n className={BUTTON}\n >\n <RotateCcw className=\"h-3.5 w-3.5\" />\n Retry\n </button>\n )}\n {isRunCancellable(run.status) && (\n <button\n type=\"button\"\n onClick={() => void handleCancel(run)}\n disabled={busyRunId === run.id}\n className={cn(BUTTON, \"text-status-error-text\")}\n >\n <Ban className=\"h-3.5 w-3.5\" />\n Cancel\n </button>\n )}\n </div>\n {run.errorMessage && (\n <p className=\"mt-1.5 pl-6 text-xs text-status-error-text\">\n {run.errorMessage}\n </p>\n )}\n {run.status === \"WAITING\" && run.nextStepDueAt && (\n <p className=\"mt-1.5 pl-6 text-xs text-text-secondary\">\n Next step due{\" \"}\n {new Date(run.nextStepDueAt).toLocaleString()}\n </p>\n )}\n {expanded && (\n <div className=\"mt-3 pl-6\">\n <RunLogs run={run} steps={steps} />\n </div>\n )}\n </li>\n );\n })}\n </ul>\n )}\n </div>\n </Modal>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;AA6BA,IAAMA,IACJ,wKACIC,IACJ;AAEF,SAASC,EAAU,GAAc,GAA0B;CACzD,OAAOC,aAAe,SAASA,EAAI,UAAUA,EAAI,UAAUC;AAC7D;AAEA,IAAMC,KAA4D,EAChE,QACA,eACI;CACJ,IAAM,EAAE,SAAM,YAAS,aACrBC,EAAmD;EACjD,WAAW,EAAE,eAAeC,EAAI,GAAG;EACnC,aAAa;CACf,CAAC,GAEGC,IACJC,GAAM,8CAA8C,CAAC;CAgBvD,OAfIC,IACK,kBAAC,KAAD;EAAG,WAAU;EAA8B,UAAA;CAAoB,CAAA,IAEpEC,IAEA,kBAAC,KAAD;EAAG,WAAU;EAAb,UAAA,CAA8C,iCACdA,EAAM,OACnC;C,KAGHH,EAAK,WAAW,IAEhB,kBAAC,KAAD;EAAG,WAAU;EAA8B,UAAA;CAAyB,CAAA,IAItE,kBAAC,MAAD;EAAI,WAAU;EAAc,cAAW;EACpC,UAAAA,EAAK,KAAK,MACT,kBAAC,MAAD;GAEE,WAAU;GAFZ,U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AD;SAAG,WAAU;SACV,UAAAA,EAAI;QACJ,CAAA;QAEJA,EAAI,WAAW,aAAaA,EAAI,iBAC/B,kBAAC,KAAD;SAAG,WAAU;SAAb,UAAA;UAAuD;UACvC;UACb,IAAI,KAAKA,EAAI,aAAa,CAAC,CAAC,eAAe;SAC3C;;QAEJ0D,KACC,kBAAC,OAAD;SAAK,WAAU;SACb,UAAA,kBAAC5D,GAAD;UAAc;UAAY;SAAQ,CAAA;QAC/B,CAAA;OAEL;MApEG,GAAAE,EAAI,EAoEP;KAER,CAAC;IACC,CAAA;GAEH;;CACA,CAAA;AAEX"}
|
|
1
|
+
{"version":3,"file":"WorkflowRunsPanel.js","names":["EmptyState","EmptyState$1","FIELD","BUTTON","errorText","err","fallback","RunLogs","useHeadshotmarketingAutomationWorkflowRunLogsQuery","run","logs","data","loading","error","log","stepName","steps","StatusBadge","formatDate","WorkflowRunsPanel","bootstrap","useHeadshotmarketingBootstrap","useHeadshotmarketingAutomationWorkflowRunsQuery","workflow","open","retryRun","useRetryHeadshotmarketingAutomationWorkflowRunMutation","cancelRun","useCancelHeadshotmarketingAutomationWorkflowRunMutation","triggerRun","starting","useTriggerHeadshotmarketingAutomationWorkflowMutation","expandedId","setExpandedId","useState","busyRunId","setBusyRunId","subject","setSubject","message","setMessage","useMemo","parseEngineSteps","runs","total","subjects","leadItems","contactItems","l","c","subjectName","map","s","after","refetch","onChanged","handleRetry","status","handleCancel","handleStart","type","id","HeadshotmarketingAutomationSubjectType","Modal","ThemedSelect","Play","cn","expanded","ChevronRight","isRunRetryable","RotateCcw","isRunCancellable","Ban"],"sources":["../../../../src/headshotmarketing/pages/automation/WorkflowRunsPanel.tsx"],"sourcesContent":["/**\n * Run history for one workflow (BOFF-10192): every run with its status,\n * per-step logs, Retry for failed runs, Cancel for unfinished runs, and a\n * \"Run now\" for active workflows against a chosen lead or contact.\n * @module headshotmarketing/pages/automation\n */\nimport { useMemo, useState, type FC } from \"react\";\nimport { Play, RotateCcw, Ban, ChevronRight } from \"lucide-react\";\nimport {\n useCancelHeadshotmarketingAutomationWorkflowRunMutation,\n useHeadshotmarketingAutomationWorkflowRunLogsQuery,\n useHeadshotmarketingAutomationWorkflowRunsQuery,\n useRetryHeadshotmarketingAutomationWorkflowRunMutation,\n useTriggerHeadshotmarketingAutomationWorkflowMutation,\n type HeadshotmarketingAutomationWorkflowRunLogsQuery,\n type HeadshotmarketingBootstrapDataQuery,\n} from \"../../../generated/wspace-operations\";\nimport { HeadshotmarketingAutomationSubjectType } from \"../../../generated/wspace-types\";\nimport { Modal, StatusBadge, EmptyState } from \"../../components\";\nimport { useHeadshotmarketingBootstrap } from \"../../hooks\";\nimport { cn, formatDate } from \"../../utils/helpers\";\nimport {\n isRunCancellable,\n isRunRetryable,\n stepName,\n} from \"../../utils/automationMapper\";\nimport { parseEngineSteps, type EngineStep } from \"./workflowCompiler\";\nimport type { AutomationRun, AutomationWorkflow } from \"./useAutomationData\";\nimport { ThemedSelect } from \"@burdenoff/fe-libs/ui\";\n\nconst FIELD =\n \"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\";\nconst BUTTON =\n \"inline-flex min-h-9 items-center gap-1.5 rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50\";\n\nfunction errorText(err: unknown, fallback: string): string {\n return err instanceof Error && err.message ? err.message : fallback;\n}\n\nconst RunLogs: FC<{ run: AutomationRun; steps: EngineStep[] }> = ({\n run,\n steps,\n}) => {\n const { data, loading, error } =\n useHeadshotmarketingAutomationWorkflowRunLogsQuery({\n variables: { workflowRunId: run.id },\n fetchPolicy: \"network-only\",\n });\n // Generated hooks resolve their data type loosely, so pin it here.\n const logs: HeadshotmarketingAutomationWorkflowRunLogsQuery[\"headshotmarketingAutomationWorkflowRunLogs\"] =\n data?.headshotmarketingAutomationWorkflowRunLogs ?? [];\n if (loading) {\n return <p className=\"text-xs text-text-secondary\">Loading step log…</p>;\n }\n if (error) {\n return (\n <p className=\"text-xs text-status-error-text\">\n Could not load the step log: {error.message}\n </p>\n );\n }\n if (logs.length === 0) {\n return (\n <p className=\"text-xs text-text-secondary\">No steps have run yet.</p>\n );\n }\n return (\n <ol className=\"space-y-1.5\" aria-label=\"Step log\">\n {logs.map((log) => (\n <li\n key={log.id}\n className=\"flex flex-wrap items-center gap-2 rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-xs\"\n >\n <span className=\"font-medium text-text-primary\">\n {log.stepIndex + 1}. {stepName(steps, log.stepIndex, log.stepType)}\n </span>\n <StatusBadge status={log.status.toLowerCase()} />\n {log.attempt > 1 && (\n <span className=\"text-text-secondary\">attempt {log.attempt}</span>\n )}\n <span className=\"ms-auto text-text-secondary\">\n {formatDate(log.executedAt, \"relative\")}\n </span>\n {log.errorMessage && (\n <span className=\"basis-full text-status-error-text\">\n {log.errorMessage}\n </span>\n )}\n </li>\n ))}\n </ol>\n );\n};\n\ninterface WorkflowRunsPanelProps {\n workflow: AutomationWorkflow;\n open: boolean;\n onClose: () => void;\n /** Called after a run is started, retried or cancelled. */\n onChanged: () => void;\n}\n\nexport const WorkflowRunsPanel: FC<WorkflowRunsPanelProps> = ({\n workflow,\n open,\n onClose,\n onChanged,\n}) => {\n const { data: bootstrap } = useHeadshotmarketingBootstrap();\n const { data, loading, error, refetch } =\n useHeadshotmarketingAutomationWorkflowRunsQuery({\n variables: {\n filter: { workflowId: workflow.id },\n pagination: { limit: 50 },\n },\n skip: !open,\n fetchPolicy: \"network-only\",\n });\n const [retryRun] = useRetryHeadshotmarketingAutomationWorkflowRunMutation();\n const [cancelRun] = useCancelHeadshotmarketingAutomationWorkflowRunMutation();\n const [triggerRun, { loading: starting }] =\n useTriggerHeadshotmarketingAutomationWorkflowMutation();\n const [expandedId, setExpandedId] = useState<string | null>(null);\n const [busyRunId, setBusyRunId] = useState<string | null>(null);\n const [subject, setSubject] = useState(\"\");\n const [message, setMessage] = useState<{\n tone: \"error\" | \"success\";\n text: string;\n } | null>(null);\n\n const steps = useMemo(() => parseEngineSteps(workflow.steps), [workflow]);\n const runs: AutomationRun[] =\n data?.headshotmarketingAutomationWorkflowRuns.items ?? [];\n const total: number =\n data?.headshotmarketingAutomationWorkflowRuns.total ?? 0;\n\n const subjects = useMemo(() => {\n const leadItems: HeadshotmarketingBootstrapDataQuery[\"headshotmarketingLeads\"][\"items\"] =\n bootstrap?.headshotmarketingLeads.items ?? [];\n const contactItems: HeadshotmarketingBootstrapDataQuery[\"headshotmarketingContacts\"][\"items\"] =\n bootstrap?.headshotmarketingContacts.items ?? [];\n const leads = leadItems.map((l) => ({\n key: `LEAD:${l.id}`,\n label: l.title,\n }));\n const contacts = contactItems.map((c) => ({\n key: `CONTACT:${c.id}`,\n label:\n `${c.firstName ?? \"\"} ${c.lastName ?? \"\"}`.trim() || c.email || c.id,\n }));\n return { leads, contacts };\n }, [bootstrap]);\n\n const subjectName = useMemo(() => {\n const map = new Map<string, string>();\n for (const s of [...subjects.leads, ...subjects.contacts])\n map.set(s.key, s.label);\n return (run: AutomationRun): string =>\n map.get(`${run.subjectType}:${run.subjectId}`) ??\n `${run.subjectType.toLowerCase()} ${run.subjectId.slice(0, 8)}`;\n }, [subjects]);\n\n const after = async (text: string): Promise<void> => {\n setMessage({ tone: \"success\", text });\n await refetch();\n onChanged();\n };\n\n const handleRetry = async (run: AutomationRun): Promise<void> => {\n setBusyRunId(run.id);\n setMessage(null);\n try {\n const res = await retryRun({ variables: { id: run.id } });\n const status =\n res.data?.retryHeadshotmarketingAutomationWorkflowRun.status ?? \"\";\n await after(\n `Retried the failed step — run is now ${status.toLowerCase()}.`,\n );\n setExpandedId(run.id);\n } catch (err) {\n setMessage({ tone: \"error\", text: errorText(err, \"Retry failed.\") });\n } finally {\n setBusyRunId(null);\n }\n };\n\n const handleCancel = async (run: AutomationRun): Promise<void> => {\n setBusyRunId(run.id);\n setMessage(null);\n try {\n await cancelRun({ variables: { id: run.id } });\n await after(\"Run cancelled.\");\n } catch (err) {\n setMessage({ tone: \"error\", text: errorText(err, \"Cancel failed.\") });\n } finally {\n setBusyRunId(null);\n }\n };\n\n const handleStart = async (): Promise<void> => {\n const [type, id] = subject.split(\":\");\n if (!type || !id) {\n setMessage({ tone: \"error\", text: \"Choose a lead or contact first.\" });\n return;\n }\n setMessage(null);\n try {\n const res = await triggerRun({\n variables: {\n workflowId: workflow.id,\n subjectType:\n type === \"CONTACT\"\n ? HeadshotmarketingAutomationSubjectType.Contact\n : HeadshotmarketingAutomationSubjectType.Lead,\n subjectId: id,\n context: {},\n },\n });\n const run = res.data?.hmTriggerAutomationWorkflow;\n await after(\n `Run started — ${run ? run.status.toLowerCase() : \"queued\"}.`,\n );\n if (run) setExpandedId(run.id);\n } catch (err) {\n setMessage({ tone: \"error\", text: errorText(err, \"Could not start.\") });\n }\n };\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n title={`Runs · ${workflow.name}`}\n description={`${total} run${total === 1 ? \"\" : \"s\"} in total. Open a run to see each step it executed.`}\n size=\"xl\"\n >\n <div className=\"space-y-4\">\n {workflow.status === \"ACTIVE\" ? (\n <div className=\"flex flex-wrap items-end gap-2 rounded-lg border border-border-subtle bg-bg-sunken p-3\">\n <div className=\"min-w-[220px] flex-1\">\n <label\n htmlFor={`run-subject-${workflow.id}`}\n className=\"mb-1 block text-xs font-medium text-text-primary\"\n >\n Run now for\n </label>\n <ThemedSelect\n id={`run-subject-${workflow.id}`}\n value={subject}\n onChange={(e) => setSubject(e.target.value)}\n className={FIELD}\n >\n <option value=\"\">Choose a lead or contact…</option>\n {subjects.leads.length > 0 && (\n <optgroup label=\"Leads\">\n {subjects.leads.map((s) => (\n <option key={s.key} value={s.key}>\n {s.label}\n </option>\n ))}\n </optgroup>\n )}\n {subjects.contacts.length > 0 && (\n <optgroup label=\"Contacts\">\n {subjects.contacts.map((s) => (\n <option key={s.key} value={s.key}>\n {s.label}\n </option>\n ))}\n </optgroup>\n )}\n </ThemedSelect>\n </div>\n <button\n type=\"button\"\n onClick={() => void handleStart()}\n disabled={starting || !subject}\n className=\"inline-flex min-h-10 items-center gap-2 rounded-md bg-action-primary-bg px-3.5 py-2 text-sm font-semibold text-action-primary-text hover:bg-action-primary-bgHover disabled:opacity-60\"\n >\n <Play className=\"h-4 w-4\" />\n {starting ? \"Starting…\" : \"Run now\"}\n </button>\n </div>\n ) : (\n <p className=\"rounded-lg border border-border-subtle bg-bg-sunken px-3 py-2 text-xs text-text-secondary\">\n Publish this workflow to run it. Draft and paused workflows never\n start new runs.\n </p>\n )}\n\n {message && (\n <div\n role=\"status\"\n className={cn(\n \"rounded-lg border px-3 py-2 text-sm\",\n message.tone === \"error\"\n ? \"border-status-error-border bg-status-error-bg text-status-error-text\"\n : \"border-status-success-border bg-status-success-bg text-status-success-text\",\n )}\n >\n {message.text}\n </div>\n )}\n\n {loading && runs.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">Loading runs…</p>\n ) : error ? (\n <p className=\"text-sm text-status-error-text\">\n Could not load runs: {error.message}\n </p>\n ) : runs.length === 0 ? (\n <EmptyState\n illustration=\"empty-generic\"\n title=\"No runs yet\"\n description=\"Runs appear here when the trigger fires or you run the workflow.\"\n />\n ) : (\n <ul className=\"space-y-2\" aria-label=\"Workflow runs\">\n {runs.map((run) => {\n const expanded = expandedId === run.id;\n return (\n <li\n key={run.id}\n className=\"rounded-lg border border-border-seam bg-gloss-card p-3\"\n >\n <div className=\"flex flex-wrap items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setExpandedId(expanded ? null : run.id)}\n aria-expanded={expanded}\n className=\"flex min-w-0 flex-1 items-center gap-2 text-start\"\n >\n <ChevronRight\n className={cn(\n \"h-4 w-4 flex-shrink-0 text-text-secondary transition-transform\",\n expanded && \"rotate-90\",\n )}\n />\n <span className=\"truncate text-sm font-medium text-text-primary\">\n {subjectName(run)}\n </span>\n <StatusBadge status={run.status.toLowerCase()} />\n <span className=\"text-xs text-text-secondary\">\n {formatDate(run.startedAt, \"relative\")}\n </span>\n {run.retryCount > 0 && (\n <span className=\"text-xs text-text-secondary\">\n · retried {run.retryCount}×\n </span>\n )}\n </button>\n {isRunRetryable(run.status) && (\n <button\n type=\"button\"\n onClick={() => void handleRetry(run)}\n disabled={busyRunId === run.id}\n className={BUTTON}\n >\n <RotateCcw className=\"h-3.5 w-3.5\" />\n Retry\n </button>\n )}\n {isRunCancellable(run.status) && (\n <button\n type=\"button\"\n onClick={() => void handleCancel(run)}\n disabled={busyRunId === run.id}\n className={cn(BUTTON, \"text-status-error-text\")}\n >\n <Ban className=\"h-3.5 w-3.5\" />\n Cancel\n </button>\n )}\n </div>\n {run.errorMessage && (\n <p className=\"mt-1.5 ps-6 text-xs text-status-error-text\">\n {run.errorMessage}\n </p>\n )}\n {run.status === \"WAITING\" && run.nextStepDueAt && (\n <p className=\"mt-1.5 ps-6 text-xs text-text-secondary\">\n Next step due{\" \"}\n {new Date(run.nextStepDueAt).toLocaleString()}\n </p>\n )}\n {expanded && (\n <div className=\"mt-3 ps-6\">\n <RunLogs run={run} steps={steps} />\n </div>\n )}\n </li>\n );\n })}\n </ul>\n )}\n </div>\n </Modal>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AA8BA,IAAME,IACJ,wKACIC,IACJ;AAEF,SAASC,EAAU,GAAc,GAA0B;CACzD,OAAOC,aAAe,SAASA,EAAI,UAAUA,EAAI,UAAUC;AAC7D;AAEA,IAAMC,KAA4D,EAChE,QACA,eACI;CACJ,IAAM,EAAE,SAAM,YAAS,aACrBC,EAAmD;EACjD,WAAW,EAAE,eAAeC,EAAI,GAAG;EACnC,aAAa;CACf,CAAC,GAEGC,IACJC,GAAM,8CAA8C,CAAC;CAgBvD,OAfIC,IACK,kBAAC,KAAD;EAAG,WAAU;EAA8B,UAAA;CAAoB,CAAA,IAEpEC,IAEA,kBAAC,KAAD;EAAG,WAAU;EAAb,UAAA,CAA8C,iCACdA,EAAM,OACnC;C,KAG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