@burdenoff/microfe-headshotmarketing 2026.704.3 → 2026.704.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/dist/generated/wspace-operations.js +118 -111
  2. package/dist/generated/wspace-operations.js.map +1 -1
  3. package/dist/generated/wspace-types.js +27 -19
  4. package/dist/generated/wspace-types.js.map +1 -1
  5. package/dist/headshotmarketing/components/Toast.js +56 -2
  6. package/dist/headshotmarketing/components/Toast.js.map +1 -0
  7. package/dist/headshotmarketing/context/HeadshotmarketingBootstrapContext.js +1 -1
  8. package/dist/headshotmarketing/context/HeadshotmarketingBootstrapContext.js.map +1 -1
  9. package/dist/headshotmarketing/pages/HomeFunnel.js +54 -0
  10. package/dist/headshotmarketing/pages/HomeFunnel.js.map +1 -0
  11. package/dist/headshotmarketing/pages/HomePage.js +423 -259
  12. package/dist/headshotmarketing/pages/HomePage.js.map +1 -1
  13. package/dist/headshotmarketing/pages/HomeStatCard.js +79 -0
  14. package/dist/headshotmarketing/pages/HomeStatCard.js.map +1 -0
  15. package/dist/headshotmarketing/pages/ads/AdPlatformChips.js +93 -0
  16. package/dist/headshotmarketing/pages/ads/AdPlatformChips.js.map +1 -0
  17. package/dist/headshotmarketing/pages/ads/CreateAdCampaignPage.js +452 -390
  18. package/dist/headshotmarketing/pages/ads/CreateAdCampaignPage.js.map +1 -1
  19. package/dist/headshotmarketing/pages/analytics/ReportsPage.js +405 -115
  20. package/dist/headshotmarketing/pages/analytics/ReportsPage.js.map +1 -1
  21. package/dist/headshotmarketing/pages/automation/WorkflowBuilderPage.js +566 -346
  22. package/dist/headshotmarketing/pages/automation/WorkflowBuilderPage.js.map +1 -1
  23. package/dist/headshotmarketing/pages/automation/WorkflowCanvasNode.js +107 -0
  24. package/dist/headshotmarketing/pages/automation/WorkflowCanvasNode.js.map +1 -0
  25. package/dist/headshotmarketing/pages/automation/WorkflowNodeConfigPanel.js +213 -0
  26. package/dist/headshotmarketing/pages/automation/WorkflowNodeConfigPanel.js.map +1 -0
  27. package/dist/headshotmarketing/pages/automation/workflowBuilderModel.js +150 -0
  28. package/dist/headshotmarketing/pages/automation/workflowBuilderModel.js.map +1 -0
  29. package/dist/headshotmarketing/pages/builder/LandingPageBuilderPage.js +380 -371
  30. package/dist/headshotmarketing/pages/builder/LandingPageBuilderPage.js.map +1 -1
  31. package/dist/headshotmarketing/pages/builder/SectionCanvasBlock.js +92 -0
  32. package/dist/headshotmarketing/pages/builder/SectionCanvasBlock.js.map +1 -0
  33. package/dist/headshotmarketing/pages/builder/SectionContent.js +346 -0
  34. package/dist/headshotmarketing/pages/builder/SectionContent.js.map +1 -0
  35. package/dist/headshotmarketing/pages/builder/SectionInspector.js +358 -0
  36. package/dist/headshotmarketing/pages/builder/SectionInspector.js.map +1 -0
  37. package/dist/headshotmarketing/pages/builder/builderCatalog.js +274 -0
  38. package/dist/headshotmarketing/pages/builder/builderCatalog.js.map +1 -0
  39. package/dist/headshotmarketing/pages/content/AIToolsPage.js +479 -193
  40. package/dist/headshotmarketing/pages/content/AIToolsPage.js.map +1 -1
  41. package/dist/headshotmarketing/pages/content/AssetLibraryPage.js +492 -197
  42. package/dist/headshotmarketing/pages/content/AssetLibraryPage.js.map +1 -1
  43. package/dist/headshotmarketing/pages/content/AssetThumbnail.js +37 -0
  44. package/dist/headshotmarketing/pages/content/AssetThumbnail.js.map +1 -0
  45. package/dist/headshotmarketing/pages/content/ContentCreationPage.js +672 -219
  46. package/dist/headshotmarketing/pages/content/ContentCreationPage.js.map +1 -1
  47. package/dist/headshotmarketing/pages/content/ContentLibraryCard.js +200 -0
  48. package/dist/headshotmarketing/pages/content/ContentLibraryCard.js.map +1 -0
  49. package/dist/headshotmarketing/pages/content/ContentPage.js +224 -204
  50. package/dist/headshotmarketing/pages/content/ContentPage.js.map +1 -1
  51. package/dist/headshotmarketing/pages/content/ContentSubNav.js +51 -0
  52. package/dist/headshotmarketing/pages/content/ContentSubNav.js.map +1 -0
  53. package/dist/headshotmarketing/pages/crm/LeadsPage.js +250 -131
  54. package/dist/headshotmarketing/pages/crm/LeadsPage.js.map +1 -1
  55. package/dist/headshotmarketing/pages/crm/LeadsWidgets.js +179 -0
  56. package/dist/headshotmarketing/pages/crm/LeadsWidgets.js.map +1 -0
  57. package/dist/headshotmarketing/pages/events/CreateEventPage.js +631 -379
  58. package/dist/headshotmarketing/pages/events/CreateEventPage.js.map +1 -1
  59. package/dist/headshotmarketing/pages/events/EventImageUpload.js +123 -0
  60. package/dist/headshotmarketing/pages/events/EventImageUpload.js.map +1 -0
  61. package/dist/headshotmarketing/pages/events/EventPagePreview.js +99 -0
  62. package/dist/headshotmarketing/pages/events/EventPagePreview.js.map +1 -0
  63. package/dist/headshotmarketing/pages/events/EventsPage.js +267 -228
  64. package/dist/headshotmarketing/pages/events/EventsPage.js.map +1 -1
  65. package/dist/headshotmarketing/pages/seo/SeoScoreGauge.js +50 -0
  66. package/dist/headshotmarketing/pages/seo/SeoScoreGauge.js.map +1 -0
  67. package/dist/headshotmarketing/pages/seo/SeoScorePanel.js +147 -0
  68. package/dist/headshotmarketing/pages/seo/SeoScorePanel.js.map +1 -0
  69. package/dist/headshotmarketing/pages/seo/SeoToolsPage.js +562 -419
  70. package/dist/headshotmarketing/pages/seo/SeoToolsPage.js.map +1 -1
  71. package/dist/headshotmarketing/pages/social-media/MediaDropZone.js +108 -0
  72. package/dist/headshotmarketing/pages/social-media/MediaDropZone.js.map +1 -0
  73. package/dist/headshotmarketing/pages/social-media/SocialComposerPreview.js +100 -0
  74. package/dist/headshotmarketing/pages/social-media/SocialComposerPreview.js.map +1 -0
  75. package/dist/headshotmarketing/pages/social-media/SocialMediaComposePage.js +315 -250
  76. package/dist/headshotmarketing/pages/social-media/SocialMediaComposePage.js.map +1 -1
  77. package/dist/headshotmarketing/pages/social-media/socialComposerMeta.js +60 -0
  78. package/dist/headshotmarketing/pages/social-media/socialComposerMeta.js.map +1 -0
  79. package/dist/headshotmarketing/utils/automationMapper.js +1 -1
  80. package/dist/headshotmarketing/utils/automationMapper.js.map +1 -1
  81. package/dist/headshotmarketing/utils/contentMapper.js +4 -24
  82. package/dist/headshotmarketing/utils/contentMapper.js.map +1 -1
  83. package/dist/headshotmarketing/utils/eventsMapper.js +9 -9
  84. package/dist/headshotmarketing/utils/eventsMapper.js.map +1 -1
  85. package/dist/headshotmarketing/utils/helpers.js +7 -4
  86. package/dist/headshotmarketing/utils/helpers.js.map +1 -1
  87. package/dist/headshotmarketing/utils/influencerMapper.js +1 -1
  88. package/dist/headshotmarketing/utils/influencerMapper.js.map +1 -1
  89. package/dist/node_modules/lodash/_arrayEach.js +14 -0
  90. package/dist/node_modules/lodash/_arrayEach.js.map +1 -0
  91. package/dist/node_modules/lodash/_assignValue.js +17 -0
  92. package/dist/node_modules/lodash/_assignValue.js.map +1 -0
  93. package/dist/node_modules/lodash/_baseAssign.js +16 -0
  94. package/dist/node_modules/lodash/_baseAssign.js.map +1 -0
  95. package/dist/node_modules/lodash/_baseAssignIn.js +16 -0
  96. package/dist/node_modules/lodash/_baseAssignIn.js.map +1 -0
  97. package/dist/node_modules/lodash/_baseClone.js +64 -0
  98. package/dist/node_modules/lodash/_baseClone.js.map +1 -0
  99. package/dist/node_modules/lodash/_baseCreate.js +21 -0
  100. package/dist/node_modules/lodash/_baseCreate.js.map +1 -0
  101. package/dist/node_modules/lodash/_baseIsMap.js +16 -0
  102. package/dist/node_modules/lodash/_baseIsMap.js.map +1 -0
  103. package/dist/node_modules/lodash/_baseIsSet.js +16 -0
  104. package/dist/node_modules/lodash/_baseIsSet.js.map +1 -0
  105. package/dist/node_modules/lodash/_baseKeysIn.js +20 -0
  106. package/dist/node_modules/lodash/_baseKeysIn.js.map +1 -0
  107. package/dist/node_modules/lodash/_baseUnset.js +26 -0
  108. package/dist/node_modules/lodash/_baseUnset.js.map +1 -0
  109. package/dist/node_modules/lodash/_cloneArrayBuffer.js +16 -0
  110. package/dist/node_modules/lodash/_cloneArrayBuffer.js.map +1 -0
  111. package/dist/node_modules/lodash/_cloneBuffer.js +17 -0
  112. package/dist/node_modules/lodash/_cloneBuffer.js.map +1 -0
  113. package/dist/node_modules/lodash/_cloneDataView.js +16 -0
  114. package/dist/node_modules/lodash/_cloneDataView.js.map +1 -0
  115. package/dist/node_modules/lodash/_cloneRegExp.js +15 -0
  116. package/dist/node_modules/lodash/_cloneRegExp.js.map +1 -0
  117. package/dist/node_modules/lodash/_cloneSymbol.js +15 -0
  118. package/dist/node_modules/lodash/_cloneSymbol.js.map +1 -0
  119. package/dist/node_modules/lodash/_cloneTypedArray.js +16 -0
  120. package/dist/node_modules/lodash/_cloneTypedArray.js.map +1 -0
  121. package/dist/node_modules/lodash/_copyArray.js +15 -0
  122. package/dist/node_modules/lodash/_copyArray.js.map +1 -0
  123. package/dist/node_modules/lodash/_copyObject.js +22 -0
  124. package/dist/node_modules/lodash/_copyObject.js.map +1 -0
  125. package/dist/node_modules/lodash/_copySymbols.js +16 -0
  126. package/dist/node_modules/lodash/_copySymbols.js.map +1 -0
  127. package/dist/node_modules/lodash/_copySymbolsIn.js +16 -0
  128. package/dist/node_modules/lodash/_copySymbolsIn.js.map +1 -0
  129. package/dist/node_modules/lodash/_customOmitClone.js +15 -0
  130. package/dist/node_modules/lodash/_customOmitClone.js.map +1 -0
  131. package/dist/node_modules/lodash/_flatRest.js +17 -0
  132. package/dist/node_modules/lodash/_flatRest.js.map +1 -0
  133. package/dist/node_modules/lodash/_getAllKeysIn.js +17 -0
  134. package/dist/node_modules/lodash/_getAllKeysIn.js.map +1 -0
  135. package/dist/node_modules/lodash/_getSymbolsIn.js +18 -0
  136. package/dist/node_modules/lodash/_getSymbolsIn.js.map +1 -0
  137. package/dist/node_modules/lodash/_initCloneArray.js +15 -0
  138. package/dist/node_modules/lodash/_initCloneArray.js.map +1 -0
  139. package/dist/node_modules/lodash/_initCloneByTag.js +40 -0
  140. package/dist/node_modules/lodash/_initCloneByTag.js.map +1 -0
  141. package/dist/node_modules/lodash/_initCloneObject.js +17 -0
  142. package/dist/node_modules/lodash/_initCloneObject.js.map +1 -0
  143. package/dist/node_modules/lodash/_nativeKeysIn.js +15 -0
  144. package/dist/node_modules/lodash/_nativeKeysIn.js.map +1 -0
  145. package/dist/node_modules/lodash/_parent.js +16 -0
  146. package/dist/node_modules/lodash/_parent.js.map +1 -0
  147. package/dist/node_modules/lodash/flatten.js +15 -0
  148. package/dist/node_modules/lodash/flatten.js.map +1 -0
  149. package/dist/node_modules/lodash/isMap.js +14 -0
  150. package/dist/node_modules/lodash/isMap.js.map +1 -0
  151. package/dist/node_modules/lodash/isSet.js +14 -0
  152. package/dist/node_modules/lodash/isSet.js.map +1 -0
  153. package/dist/node_modules/lodash/keysIn.js +17 -0
  154. package/dist/node_modules/lodash/keysIn.js.map +1 -0
  155. package/dist/node_modules/lodash/omit.js +28 -0
  156. package/dist/node_modules/lodash/omit.js.map +1 -0
  157. package/dist/node_modules/recharts/es6/chart/FunnelChart.js +15 -0
  158. package/dist/node_modules/recharts/es6/chart/FunnelChart.js.map +1 -0
  159. package/dist/node_modules/recharts/es6/numberAxis/Funnel.js +370 -0
  160. package/dist/node_modules/recharts/es6/numberAxis/Funnel.js.map +1 -0
  161. package/dist/node_modules/recharts/es6/util/ActiveShapeUtils.js +1 -1
  162. package/dist/node_modules/recharts/es6/util/FunnelUtils.js +81 -0
  163. package/dist/node_modules/recharts/es6/util/FunnelUtils.js.map +1 -0
  164. package/package.json +1 -1
@@ -1,400 +1,620 @@
1
- import { HeadshotmarketingBootstrapDataDocument as e, useCreateHeadshotmarketingWorkflowMutation as t } from "../../../generated/wspace-operations.js";
1
+ import { HeadshotmarketingBootstrapDataDocument as e, useCreateHeadshotmarketingWorkflowMutation as t, useTriggerHeadshotmarketingWorkflowMutation as n } from "../../../generated/wspace-operations.js";
2
2
  import "../../context/HeadshotmarketingBootstrapContext.js";
3
- import { useHeadshotMarketing as n } from "../../context/HeadshotMarketingContext.js";
4
- import { cn as r } from "../../utils/helpers.js";
5
- import { HeadshotmarketingWorkflowStatus as i, HeadshotmarketingWorkflowTriggerType as a } from "../../../generated/wspace-types.js";
6
- import { PageLayout as o } from "../../components/PageLayout.js";
3
+ import { useHeadshotMarketing as r } from "../../context/HeadshotMarketingContext.js";
4
+ import { cn as i, formatDate as a } from "../../utils/helpers.js";
5
+ import { HeadshotmarketingWorkflowStatus as o, HeadshotmarketingWorkflowTriggerType as s } from "../../../generated/wspace-types.js";
6
+ import { PageLayout as ee } from "../../components/PageLayout.js";
7
+ import { ToastContainer as te } from "../../components/Toast.js";
7
8
  import "../../components/index.js";
8
- import { useState as s } from "react";
9
- import { ArrowDown as c, ArrowLeft as l, Bell as u, Clock as d, GitBranch as f, Mail as p, Play as m, Plus as h, Save as g, Settings as _, Tag as v, Trash2 as y, Zap as b } from "lucide-react";
10
- import { jsx as x, jsxs as S } from "react/jsx-runtime";
11
- import { EmphasisPanel as C, PagePurpose as w } from "@burdenoff/fe-libs/ui";
9
+ import { ACTION_TYPES as ne, CHIP_TONE as c, TRIGGER_TYPES as re, actionMeta as l, inPort as u, isConditionNode as ie, outPort as d, serializeGraph as ae, triggerLabel as f } from "./workflowBuilderModel.js";
10
+ import { WorkflowCanvasNode as oe } from "./WorkflowCanvasNode.js";
11
+ import { WorkflowConfigEmpty as se, WorkflowNodeConfigPanel as ce } from "./WorkflowNodeConfigPanel.js";
12
+ import { useCallback as p, useEffect as le, useMemo as m, useRef as h, useState as g } from "react";
13
+ import { ArrowLeft as ue, FlaskConical as de, Maximize2 as fe, Minus as pe, Move as me, Play as he, Plus as _, Save as ge, Zap as _e } from "lucide-react";
14
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
15
+ import { PagePurpose as ve } from "@burdenoff/fe-libs/ui";
12
16
  //#region src/headshotmarketing/pages/automation/WorkflowBuilderPage.tsx
13
- var T = [
14
- {
15
- type: "form_submit",
16
- label: "Form Submission",
17
- icon: "📝"
18
- },
19
- {
20
- type: "event",
21
- label: "Event Triggered",
22
- icon: "⚡"
23
- },
24
- {
25
- type: "schedule",
26
- label: "Schedule",
27
- icon: "📅"
28
- },
29
- {
30
- type: "tag_added",
31
- label: "Tag Added",
32
- icon: "🏷️"
33
- },
34
- {
35
- type: "webhook",
36
- label: "Webhook",
37
- icon: "🔗"
38
- },
39
- {
40
- type: "score_change",
41
- label: "Score Change",
42
- icon: "📊"
17
+ var ye = 1600, be = 1200, b = .5, x = 1.4, S = .82, C = {
18
+ x: 12,
19
+ y: 12
20
+ };
21
+ function w() {
22
+ return {
23
+ nodes: [
24
+ {
25
+ id: "trigger-1",
26
+ kind: "trigger",
27
+ actionType: "form_submit",
28
+ label: "Trigger",
29
+ x: 200,
30
+ y: 24,
31
+ config: {
32
+ source: "form_submit",
33
+ description: "When a form is submitted"
34
+ }
35
+ },
36
+ {
37
+ id: "node-email-1",
38
+ kind: "action",
39
+ actionType: "send_email",
40
+ label: "Send Email",
41
+ x: 200,
42
+ y: 150,
43
+ config: { emailTemplate: "Welcome Email" }
44
+ },
45
+ {
46
+ id: "node-cond-1",
47
+ kind: "action",
48
+ actionType: "condition",
49
+ label: "Condition",
50
+ x: 200,
51
+ y: 276,
52
+ config: { conditionRule: "Opened email" }
53
+ },
54
+ {
55
+ id: "node-wait-1",
56
+ kind: "action",
57
+ actionType: "wait",
58
+ label: "Wait / Delay",
59
+ x: 36,
60
+ y: 426,
61
+ config: {
62
+ waitDuration: 2,
63
+ waitUnit: "Days"
64
+ }
65
+ },
66
+ {
67
+ id: "node-sms-1",
68
+ kind: "action",
69
+ actionType: "send_sms",
70
+ label: "Send SMS",
71
+ x: 372,
72
+ y: 426,
73
+ config: {}
74
+ },
75
+ {
76
+ id: "node-email-2",
77
+ kind: "action",
78
+ actionType: "send_email",
79
+ label: "Send Email",
80
+ x: 36,
81
+ y: 560,
82
+ config: { emailTemplate: "Case Study" }
83
+ }
84
+ ],
85
+ edges: [
86
+ {
87
+ id: "e1",
88
+ source: "trigger-1",
89
+ target: "node-email-1",
90
+ branch: null
91
+ },
92
+ {
93
+ id: "e2",
94
+ source: "node-email-1",
95
+ target: "node-cond-1",
96
+ branch: null
97
+ },
98
+ {
99
+ id: "e3",
100
+ source: "node-cond-1",
101
+ target: "node-wait-1",
102
+ branch: "yes"
103
+ },
104
+ {
105
+ id: "e4",
106
+ source: "node-cond-1",
107
+ target: "node-sms-1",
108
+ branch: "no"
109
+ },
110
+ {
111
+ id: "e5",
112
+ source: "node-wait-1",
113
+ target: "node-email-2",
114
+ branch: null
115
+ }
116
+ ]
117
+ };
118
+ }
119
+ function xe(e) {
120
+ switch (e) {
121
+ case "send_email": return { emailTemplate: "Welcome Email" };
122
+ case "wait": return {
123
+ waitDuration: 3,
124
+ waitUnit: "Days"
125
+ };
126
+ case "condition": return { conditionRule: "" };
127
+ default: return {};
43
128
  }
44
- ], E = [
45
- {
46
- type: "send_email",
47
- label: "Send Email",
48
- icon: p,
49
- color: "text-status-info-text"
50
- },
51
- {
52
- type: "wait",
53
- label: "Wait / Delay",
54
- icon: d,
55
- color: "text-status-warning-text"
56
- },
57
- {
58
- type: "condition",
59
- label: "Condition",
60
- icon: f,
61
- color: "text-action-primary-bg"
62
- },
63
- {
64
- type: "notify",
65
- label: "Send Notification",
66
- icon: u,
67
- color: "text-status-success-text"
68
- },
69
- {
70
- type: "add_tag",
71
- label: "Add Tag",
72
- icon: v,
73
- color: "text-status-warning-text"
74
- },
75
- {
76
- type: "update_score",
77
- label: "Update Score",
78
- icon: b,
79
- color: "text-status-error-text"
129
+ }
130
+ function Se(e) {
131
+ let t = e.config;
132
+ if (e.kind === "trigger") return f(e.actionType);
133
+ if (t.description) return t.description;
134
+ switch (e.actionType) {
135
+ case "send_email": return t.emailTemplate ? `Template: ${t.emailTemplate}` : "Send an email";
136
+ case "send_sms": return t.message ? t.message : "Send an SMS";
137
+ case "wait": return t.waitDuration ? `Wait ${t.waitDuration} ${(t.waitUnit ?? "days").toLowerCase()}` : "Add a delay";
138
+ case "condition": return t.conditionRule ? `${t.conditionRule}?` : "Set a condition";
139
+ case "notify": return t.message ? t.message : "Notify your team";
140
+ case "webhook": return t.webhookUrl ? t.webhookUrl : "Call a webhook";
141
+ case "add_tag": return t.tag ? `Tag: ${t.tag}` : "Add a tag";
142
+ case "update_score": return t.points == null ? "Update lead score" : `${t.points} points`;
143
+ default: return l(e.actionType)?.label ?? "";
80
144
  }
81
- ], D = () => {
82
- let { navigate: u, basePath: f } = n(), [v, { loading: D, error: O }] = t(), [k, A] = s("New Workflow"), [j, M] = s("form_submit"), [N, P] = s(null), [F, I] = s(null), [L, R] = s([
83
- {
84
- id: "trigger-1",
85
- type: "trigger",
86
- actionType: "form_submit",
87
- label: "Form Submission",
88
- description: "When signup form is submitted",
89
- icon: b,
90
- color: "text-primary"
91
- },
92
- {
93
- id: "action-1",
94
- type: "action",
95
- actionType: "send_email",
96
- label: "Send Email",
97
- description: "Send welcome email",
98
- icon: p,
99
- color: "text-status-info-text"
100
- },
101
- {
102
- id: "action-2",
103
- type: "action",
104
- actionType: "wait",
105
- label: "Wait / Delay",
106
- description: "Wait 3 days",
107
- icon: d,
108
- color: "text-status-warning-text"
109
- },
110
- {
111
- id: "action-3",
112
- type: "action",
113
- actionType: "send_email",
114
- label: "Send Email",
115
- description: "Send onboarding tips",
116
- icon: p,
117
- color: "text-status-info-text"
118
- }
119
- ]), z = (e) => {
120
- let t = E.find((t) => t.type === e);
145
+ }
146
+ function T(e) {
147
+ return e === "yes" ? "var(--color-status-success-text)" : e === "no" ? "var(--color-status-error-text)" : "var(--color-action-primary-bg)";
148
+ }
149
+ function Ce(e) {
150
+ return e === "yes" ? "wf-arrow-yes" : e === "no" ? "wf-arrow-no" : "wf-arrow-accent";
151
+ }
152
+ function E(e) {
153
+ let t = e.toUpperCase();
154
+ return t === "COMPLETED" ? "success" : t === "FAILED" || t === "TIMED_OUT" || t === "CANCELLED" ? "error" : t === "RUNNING" ? "info" : "warning";
155
+ }
156
+ var D = () => {
157
+ let { navigate: f, basePath: D } = r(), [O, { loading: k }] = t(), [we] = n(), [A, Te] = g("New Workflow"), [j, M] = g(() => w().nodes), [N, P] = g(() => w().edges), [F, I] = g("node-email-1"), [L, R] = g(null), [Ee, De] = g(null), [z, Oe] = g(null), [B, V] = g(!1), [ke, H] = g([]), [U, W] = g(S), [G, Ae] = g(C), K = h(null), je = h(null), q = m(() => {
158
+ let e = /* @__PURE__ */ new Map();
159
+ for (let t of j) e.set(t.id, t);
160
+ return e;
161
+ }, [j]), J = F ? q.get(F) ?? null : null, Me = m(() => j.find((e) => e.kind === "trigger") ?? null, [j]), Y = Me?.actionType ?? "form_submit", X = p((e) => {
162
+ H((t) => t.filter((t) => t.id !== e));
163
+ }, []), Z = p((e) => {
164
+ let t = `toast-${Date.now()}-${Math.round(performance.now())}`;
165
+ H((n) => [...n, {
166
+ ...e,
167
+ id: t
168
+ }]), window.setTimeout(() => X(t), 5e3);
169
+ }, [X]), Ne = p((e, t, n) => {
170
+ M((r) => r.map((r) => r.id === e ? {
171
+ ...r,
172
+ x: t,
173
+ y: n
174
+ } : r));
175
+ }, []), Pe = p((e, t) => {
176
+ M((n) => n.map((n) => n.id === e ? {
177
+ ...n,
178
+ label: t
179
+ } : n));
180
+ }, []), Fe = p((e, t) => {
181
+ M((n) => n.map((n) => n.id === e ? {
182
+ ...n,
183
+ config: {
184
+ ...n.config,
185
+ ...t
186
+ }
187
+ } : n));
188
+ }, []), Ie = p((e) => {
189
+ M((t) => t.map((t) => t.kind === "trigger" ? {
190
+ ...t,
191
+ actionType: e,
192
+ config: {
193
+ ...t.config,
194
+ source: e
195
+ }
196
+ } : t));
197
+ }, []), Le = p((e) => {
198
+ let t = q.get(e);
199
+ !t || t.kind === "trigger" || (M((t) => t.filter((t) => t.id !== e)), P((t) => t.filter((t) => t.source !== e && t.target !== e)), I((t) => t === e ? null : t));
200
+ }, [q]), Re = p((e) => {
201
+ let t = l(e);
121
202
  if (!t) return;
122
- let n = {
123
- id: `action-${Date.now()}`,
124
- type: "action",
203
+ let n = J ?? j[j.length - 1] ?? null, r = null, i = 0;
204
+ if (n && ie(n)) {
205
+ let e = N.filter((e) => e.source === n.id), t = e.some((e) => e.branch === "yes"), a = e.some((e) => e.branch === "no");
206
+ t ? a || (r = "no", i = 164) : (r = "yes", i = -164);
207
+ }
208
+ let a = `node-${Date.now()}`, o = n ? n.x : 200, s = n ? n.y + 78 + 72 : 24, ee = {
209
+ id: a,
210
+ kind: "action",
125
211
  actionType: e,
126
212
  label: t.label,
127
- description: `Configure ${t.label.toLowerCase()}`,
128
- icon: t.icon,
129
- color: t.color
213
+ x: o + i,
214
+ y: s,
215
+ config: xe(e)
130
216
  };
131
- R((e) => [...e, n]), P(n.id);
132
- }, B = (e) => {
133
- R((t) => t.filter((t) => t.id !== e)), N === e && P(null);
134
- }, V = (e) => {
217
+ M((e) => [...e, ee]), n && P((e) => [...e, {
218
+ id: `edge-${Date.now()}`,
219
+ source: n.id,
220
+ target: a,
221
+ branch: r
222
+ }]), I(a);
223
+ }, [
224
+ J,
225
+ j,
226
+ N
227
+ ]);
228
+ le(() => {
229
+ F && typeof window < "u" && window.innerWidth < 1280 && je.current?.scrollIntoView({
230
+ behavior: "smooth",
231
+ block: "nearest"
232
+ });
233
+ }, [F]);
234
+ let Q = (e) => W((t) => Math.min(x, Math.max(b, Math.round((t + e) * 100) / 100))), ze = () => {
235
+ W(S), Ae(C);
236
+ }, Be = (e) => {
237
+ K.current = {
238
+ startX: e.clientX,
239
+ startY: e.clientY,
240
+ originX: G.x,
241
+ originY: G.y,
242
+ moved: !1
243
+ }, e.currentTarget.setPointerCapture(e.pointerId);
244
+ }, Ve = (e) => {
245
+ let t = K.current;
246
+ if (!t) return;
247
+ let n = e.clientX - t.startX, r = e.clientY - t.startY;
248
+ !t.moved && Math.hypot(n, r) < 3 || (t.moved = !0, Ae({
249
+ x: t.originX + n,
250
+ y: t.originY + r
251
+ }));
252
+ }, He = (e) => {
253
+ let t = K.current;
254
+ K.current = null, e.currentTarget.releasePointerCapture?.(e.pointerId), t && !t.moved && I(null);
255
+ }, Ue = () => A.trim() ? j.length === 0 ? (R("Add at least one workflow step."), !1) : (R(null), !0) : (R("Workflow name is required."), !1), We = (e) => {
135
256
  switch (e) {
136
- case "schedule": return a.Schedule;
137
- case "webhook": return a.Webhook;
257
+ case "schedule": return s.Schedule;
258
+ case "webhook": return s.Webhook;
138
259
  case "event":
139
260
  case "score_change":
140
261
  case "tag_added":
141
- case "form_submit": return a.Event;
142
- default: return a.Manual;
143
- }
144
- }, H = () => ({ nodes: L.map((e, t) => ({
145
- id: e.id,
146
- kind: e.type,
147
- actionType: e.actionType,
148
- label: e.label,
149
- description: e.description,
150
- order: t
151
- })) }), U = async (t) => {
152
- if (!k.trim()) {
153
- I("Workflow name is required.");
154
- return;
262
+ case "form_submit": return s.Event;
263
+ default: return s.Manual;
155
264
  }
156
- if (L.length === 0) {
157
- I("Add at least one workflow step.");
158
- return;
265
+ }, Ge = (e) => ({
266
+ name: A.trim(),
267
+ description: Me?.config.description ?? null,
268
+ triggerType: We(Y),
269
+ triggerConfig: { source: Y },
270
+ steps: ae(j, N),
271
+ status: e === "active" ? o.Active : o.Draft,
272
+ isEnabled: e === "active",
273
+ metadata: {
274
+ builder: !0,
275
+ version: 2
159
276
  }
160
- I(null);
161
- let n = {
162
- name: k.trim(),
163
- description: null,
164
- triggerType: V(j),
165
- triggerConfig: { source: j },
166
- steps: H(),
167
- status: t === "active" ? i.Active : i.Draft,
168
- isEnabled: t === "active",
169
- metadata: { builder: !0 }
170
- };
171
- try {
172
- await v({
173
- variables: { input: n },
277
+ }), Ke = async (t) => {
278
+ if (Ue()) try {
279
+ await O({
280
+ variables: { input: Ge(t) },
174
281
  refetchQueries: [{
175
282
  query: e,
176
- variables: { limit: 200 }
283
+ variables: { limit: 50 }
177
284
  }],
178
285
  awaitRefetchQueries: !0
179
- }), u(f + "/automation/workflows");
286
+ }), f(D + "/automation/workflows");
180
287
  } catch (e) {
181
- I(e instanceof Error ? e.message : "Failed to save workflow.");
288
+ let t = e instanceof Error ? e.message : "Failed to save workflow.";
289
+ R(t), Z({
290
+ title: "Save failed",
291
+ description: t,
292
+ variant: "error"
293
+ });
294
+ }
295
+ }, qe = async () => {
296
+ if (Ue()) {
297
+ V(!0);
298
+ try {
299
+ let e = Ee;
300
+ if (e || (e = (await O({ variables: { input: Ge("draft") } })).data?.createHeadshotmarketingWorkflow.id ?? null, De(e)), !e) throw Error("Could not create a workflow to test.");
301
+ let t = (await we({ variables: { input: {
302
+ workflowId: e,
303
+ inputData: {
304
+ source: Y,
305
+ test: !0
306
+ }
307
+ } } })).data?.triggerHeadshotmarketingWorkflow;
308
+ t && (Oe({
309
+ id: t.id,
310
+ status: t.status,
311
+ startedAt: t.startedAt ?? t.createdAt
312
+ }), Z({
313
+ title: "Test run started",
314
+ description: `Execution ${t.id.slice(0, 8)} — ${t.status.toLowerCase()}`,
315
+ variant: "success"
316
+ }));
317
+ } catch (e) {
318
+ let t = e instanceof Error ? e.message : "Failed to run test.";
319
+ R(t), Z({
320
+ title: "Test failed",
321
+ description: t,
322
+ variant: "error"
323
+ });
324
+ } finally {
325
+ V(!1);
326
+ }
182
327
  }
183
- }, W = F ?? O?.message ?? null;
184
- return /* @__PURE__ */ S(o, {
328
+ }, Je = Math.round(U * 100), $ = k || B;
329
+ return /* @__PURE__ */ y(ee, {
185
330
  title: "Workflow Builder",
186
- actions: /* @__PURE__ */ S("div", {
331
+ actions: /* @__PURE__ */ y("div", {
187
332
  className: "flex flex-wrap items-center gap-2",
188
333
  children: [
189
- /* @__PURE__ */ S("button", {
190
- onClick: () => u(f + "/automation/workflows"),
191
- className: "inline-flex items-center gap-2 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
192
- children: [/* @__PURE__ */ x(l, { className: "h-4 w-4" }), "Back"]
334
+ /* @__PURE__ */ y("button", {
335
+ onClick: () => f(D + "/automation/workflows"),
336
+ className: "inline-flex min-h-10 items-center gap-2 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken",
337
+ children: [/* @__PURE__ */ v(ue, { className: "h-4 w-4" }), "Back"]
193
338
  }),
194
- /* @__PURE__ */ S("button", {
195
- onClick: () => {
196
- U("draft");
197
- },
198
- disabled: D,
199
- className: "inline-flex items-center gap-2 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-60",
200
- children: [/* @__PURE__ */ x(g, { className: "h-4 w-4" }), D ? "Saving..." : "Save"]
339
+ /* @__PURE__ */ y("button", {
340
+ onClick: () => void qe(),
341
+ disabled: $,
342
+ className: "inline-flex min-h-10 items-center gap-2 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-60",
343
+ children: [/* @__PURE__ */ v(he, { className: "h-4 w-4" }), B ? "Testing…" : "Test"]
201
344
  }),
202
- /* @__PURE__ */ S("button", {
203
- onClick: () => {
204
- U("active");
205
- },
206
- disabled: D,
207
- className: "inline-flex items-center gap-2 rounded-md bg-status-success-text px-3 py-2 text-sm font-medium text-white hover:bg-status-success-text disabled:opacity-60",
208
- children: [/* @__PURE__ */ x(m, { className: "h-4 w-4" }), D ? "Activating..." : "Activate"]
345
+ /* @__PURE__ */ y("button", {
346
+ onClick: () => void Ke("draft"),
347
+ disabled: $,
348
+ className: "inline-flex min-h-10 items-center gap-2 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-60",
349
+ children: [/* @__PURE__ */ v(ge, { className: "h-4 w-4" }), k && !B ? "Saving…" : "Save"]
350
+ }),
351
+ /* @__PURE__ */ y("button", {
352
+ onClick: () => void Ke("active"),
353
+ disabled: $,
354
+ 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 transition-colors hover:bg-action-primary-bgHover disabled:opacity-60",
355
+ children: [/* @__PURE__ */ v(_e, { className: "h-4 w-4" }), "Activate"]
209
356
  })
210
357
  ]
211
358
  }),
212
359
  children: [
213
- /* @__PURE__ */ x(w, { children: "Design an automation visually: pick the trigger that starts it, then add the steps it should run — send an email, wait, add a tag, update a record. Save it as a draft while you iterate, or activate it to put it to work." }),
214
- W && /* @__PURE__ */ x("div", {
360
+ /* @__PURE__ */ v(ve, { children: "Design an automation visually. Pick the trigger that starts it, drag in the steps it should run — send an email or SMS, wait, branch on a condition — and connect them on the canvas. Test a dry run, save a draft while you iterate, or activate it to put it to work." }),
361
+ L && /* @__PURE__ */ v("div", {
215
362
  className: "rounded-lg border border-status-error-border/30 bg-status-error-bg/10 px-4 py-3 text-sm text-status-error-text",
216
- children: W
363
+ children: L
364
+ }),
365
+ z && /* @__PURE__ */ y("div", {
366
+ className: "flex flex-wrap items-center gap-3 rounded-card border border-border-seam bg-gloss-card shadow-pop px-4 py-3",
367
+ children: [
368
+ /* @__PURE__ */ v("span", {
369
+ className: i("flex h-9 w-9 items-center justify-center rounded-lg ring-1 ring-inset", c[E(z.status)]),
370
+ children: /* @__PURE__ */ v(de, { className: "h-4 w-4" })
371
+ }),
372
+ /* @__PURE__ */ y("div", {
373
+ className: "min-w-0 flex-1",
374
+ children: [/* @__PURE__ */ v("p", {
375
+ className: "text-sm font-semibold text-text-primary",
376
+ children: "Last test run"
377
+ }), /* @__PURE__ */ y("p", {
378
+ className: "truncate text-xs text-text-secondary",
379
+ children: [
380
+ "Execution ",
381
+ z.id.slice(0, 8),
382
+ z.startedAt ? ` · started ${a(z.startedAt, "relative")}` : ""
383
+ ]
384
+ })]
385
+ }),
386
+ /* @__PURE__ */ v("span", {
387
+ className: i("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium capitalize ring-1 ring-inset", c[E(z.status)]),
388
+ children: z.status.toLowerCase().replace(/_/g, " ")
389
+ })
390
+ ]
217
391
  }),
218
- /* @__PURE__ */ x("div", {
219
- className: "rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4",
220
- children: /* @__PURE__ */ x("input", {
392
+ /* @__PURE__ */ y("div", {
393
+ className: "rounded-card border border-border-seam bg-gloss-card shadow-pop p-4",
394
+ children: [/* @__PURE__ */ v("label", {
395
+ className: "mb-1 block text-xs font-medium text-text-secondary",
396
+ children: "Workflow name"
397
+ }), /* @__PURE__ */ v("input", {
221
398
  type: "text",
222
- value: k,
223
- onChange: (e) => A(e.target.value),
224
- className: "text-lg font-semibold text-text-primary bg-transparent border-none outline-none w-full placeholder:text-text-secondary",
399
+ value: A,
400
+ onChange: (e) => Te(e.target.value),
401
+ className: "w-full border-none bg-transparent text-lg font-semibold text-text-primary outline-none placeholder:text-text-secondary",
225
402
  placeholder: "Workflow name"
226
- })
403
+ })]
227
404
  }),
228
- /* @__PURE__ */ S("div", {
229
- className: "grid grid-cols-1 lg:grid-cols-4 gap-6",
405
+ /* @__PURE__ */ y("div", {
406
+ className: "grid grid-cols-1 gap-6 xl:grid-cols-[200px_minmax(0,1fr)_272px]",
230
407
  children: [
231
- /* @__PURE__ */ S("div", {
232
- className: "lg:col-span-1 space-y-4",
233
- children: [/* @__PURE__ */ S("div", {
234
- className: "rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4",
235
- children: [/* @__PURE__ */ x("h4", {
236
- className: "text-sm font-semibold text-text-primary mb-3",
237
- children: "Triggers"
238
- }), /* @__PURE__ */ x("div", {
239
- className: "space-y-2",
240
- children: T.map((e) => /* @__PURE__ */ S("button", {
241
- onClick: () => M(e.type),
242
- className: r("flex items-center gap-2 w-full rounded-md border px-3 py-2 text-sm text-left transition-colors", j === e.type ? "border-primary bg-action-primary-bg/5 text-text-primary" : "border-border-subtle hover:bg-bg-sunken"),
243
- children: [/* @__PURE__ */ x("span", { children: e.icon }), /* @__PURE__ */ x("span", {
244
- className: "text-text-primary",
408
+ /* @__PURE__ */ y("div", {
409
+ className: "space-y-4",
410
+ children: [/* @__PURE__ */ y("div", {
411
+ className: "rounded-card border border-border-seam bg-gloss-card shadow-pop p-4",
412
+ children: [/* @__PURE__ */ v("h4", {
413
+ className: "mb-3 text-sm font-semibold text-text-primary",
414
+ children: "Trigger"
415
+ }), /* @__PURE__ */ v("div", {
416
+ className: "space-y-1.5",
417
+ children: re.map((e) => /* @__PURE__ */ y("button", {
418
+ onClick: () => Ie(e.type),
419
+ className: i("flex min-h-10 w-full items-center gap-2 rounded-md border px-3 py-2 text-left text-sm transition-colors", Y === e.type ? "border-[color-mix(in_oklab,var(--color-action-primary-bg)_40%,transparent)] bg-[var(--color-accent-soft)] text-text-primary" : "border-border-subtle text-text-primary hover:bg-bg-sunken"),
420
+ children: [/* @__PURE__ */ v("span", {
421
+ "aria-hidden": !0,
422
+ children: e.icon
423
+ }), /* @__PURE__ */ v("span", {
424
+ className: "truncate",
245
425
  children: e.label
246
426
  })]
247
427
  }, e.type))
248
428
  })]
249
- }), /* @__PURE__ */ S("div", {
250
- className: "rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4",
251
- children: [/* @__PURE__ */ x("h4", {
252
- className: "text-sm font-semibold text-text-primary mb-3",
253
- children: "Actions"
254
- }), /* @__PURE__ */ x("div", {
255
- className: "space-y-2",
256
- children: E.map((e) => {
257
- let t = e.icon;
258
- return /* @__PURE__ */ S("button", {
259
- onClick: () => z(e.type),
260
- className: "flex items-center gap-2 w-full rounded-md border border-border-subtle px-3 py-2 text-sm text-left hover:bg-bg-sunken transition-colors",
261
- children: [/* @__PURE__ */ x(t, { className: r("h-4 w-4", e.color) }), /* @__PURE__ */ x("span", {
262
- className: "text-text-primary",
263
- children: e.label
264
- })]
265
- }, e.type);
266
- })
267
- })]
268
- })]
269
- }),
270
- /* @__PURE__ */ x("div", {
271
- className: "lg:col-span-2",
272
- children: /* @__PURE__ */ S(C, {
273
- className: "flex flex-col items-center space-y-0 p-4",
429
+ }), /* @__PURE__ */ y("div", {
430
+ className: "rounded-card border border-border-seam bg-gloss-card shadow-pop p-4",
274
431
  children: [
275
- L.map((e, t) => {
276
- let n = e.icon;
277
- return /* @__PURE__ */ S("div", {
278
- className: "w-full max-w-md",
279
- children: [t > 0 && /* @__PURE__ */ x("div", {
280
- className: "flex justify-center py-2",
281
- children: /* @__PURE__ */ x(c, { className: "h-5 w-5 text-text-secondary" })
282
- }), /* @__PURE__ */ x("div", {
283
- onClick: () => P(e.id),
284
- className: r("rounded-lg border-2 bg-bg-surface p-4 cursor-pointer transition-all", N === e.id ? "border-primary shadow-sm" : "border-border-subtle hover:border-muted-foreground"),
285
- children: /* @__PURE__ */ S("div", {
286
- className: "flex items-center justify-between",
287
- children: [/* @__PURE__ */ S("div", {
288
- className: "flex items-center gap-3",
289
- children: [/* @__PURE__ */ x("div", {
290
- className: r("p-2 rounded-md bg-bg-sunken"),
291
- children: /* @__PURE__ */ x(n, { className: r("h-4 w-4", e.color) })
292
- }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
293
- className: "text-sm font-medium text-text-primary",
294
- children: e.label
295
- }), /* @__PURE__ */ x("p", {
296
- className: "text-xs text-text-secondary",
297
- children: e.description
298
- })] })]
299
- }), e.type === "action" && /* @__PURE__ */ x("button", {
300
- onClick: (t) => {
301
- t.stopPropagation(), B(e.id);
302
- },
303
- className: "p-1 rounded-md hover:bg-bg-sunken text-text-secondary hover:text-status-error-text",
304
- children: /* @__PURE__ */ x(y, { className: "h-4 w-4" })
305
- })]
306
- })
307
- })]
308
- }, e.id);
432
+ /* @__PURE__ */ v("h4", {
433
+ className: "mb-3 text-sm font-semibold text-text-primary",
434
+ children: "Actions"
309
435
  }),
310
- /* @__PURE__ */ x("div", {
311
- className: "flex justify-center py-2",
312
- children: /* @__PURE__ */ x(c, { className: "h-5 w-5 text-text-secondary" })
436
+ /* @__PURE__ */ v("p", {
437
+ className: "mb-3 text-[11px] text-text-secondary",
438
+ children: "Adds after the selected node."
313
439
  }),
314
- /* @__PURE__ */ S("button", {
315
- onClick: () => z("send_email"),
316
- className: "w-full max-w-md rounded-lg border-2 border-dashed border-border-subtle bg-bg-surface p-4 text-sm text-text-secondary hover:border-primary hover:text-primary transition-colors flex items-center justify-center gap-2",
317
- children: [/* @__PURE__ */ x(h, { className: "h-4 w-4" }), "Add Step"]
440
+ /* @__PURE__ */ v("div", {
441
+ className: "space-y-1.5",
442
+ children: ne.map((e) => {
443
+ let t = e.icon;
444
+ return /* @__PURE__ */ y("button", {
445
+ onClick: () => Re(e.type),
446
+ className: "flex min-h-10 w-full items-center gap-2.5 rounded-md border border-border-subtle px-2.5 py-2 text-left text-sm text-text-primary transition-colors hover:border-border-strong hover:bg-bg-sunken",
447
+ children: [
448
+ /* @__PURE__ */ v("span", {
449
+ className: i("flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-md ring-1 ring-inset", c[e.tone]),
450
+ children: /* @__PURE__ */ v(t, { className: "h-3.5 w-3.5" })
451
+ }),
452
+ /* @__PURE__ */ v("span", {
453
+ className: "truncate",
454
+ children: e.label
455
+ }),
456
+ /* @__PURE__ */ v(_, { className: "ml-auto h-3.5 w-3.5 flex-shrink-0 text-text-secondary" })
457
+ ]
458
+ }, e.type);
459
+ })
318
460
  })
319
461
  ]
320
- })
462
+ })]
321
463
  }),
322
- /* @__PURE__ */ x("div", {
323
- className: "lg:col-span-1",
324
- children: N ? /* @__PURE__ */ S("div", {
325
- className: "rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4 sticky top-4",
326
- children: [/* @__PURE__ */ S("div", {
327
- className: "flex items-center gap-2 mb-4",
328
- children: [/* @__PURE__ */ x(_, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ x("h4", {
329
- className: "text-sm font-semibold text-text-primary",
330
- children: "Step Configuration"
331
- })]
332
- }), (() => {
333
- let e = L.find((e) => e.id === N);
334
- return e ? /* @__PURE__ */ S("div", {
335
- className: "space-y-4",
464
+ /* @__PURE__ */ y("div", {
465
+ className: "overflow-hidden rounded-card border border-border-seam bg-gloss-card shadow-pop",
466
+ children: [/* @__PURE__ */ y("div", {
467
+ className: "flex items-center justify-between gap-3 border-b border-border-subtle px-4 py-3",
468
+ children: [/* @__PURE__ */ y("div", {
469
+ className: "min-w-0",
470
+ children: [/* @__PURE__ */ v("h3", {
471
+ className: "text-sm font-semibold uppercase tracking-wide text-text-primary",
472
+ children: "Workflow Canvas"
473
+ }), /* @__PURE__ */ y("p", {
474
+ className: "text-xs text-text-secondary",
336
475
  children: [
337
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
338
- className: "block text-xs font-medium text-text-primary mb-1",
339
- children: "Step Type"
340
- }), /* @__PURE__ */ x("p", {
341
- className: "text-sm text-text-secondary capitalize",
342
- children: e.actionType.replace(/_/g, " ")
343
- })] }),
344
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
345
- className: "block text-xs font-medium text-text-primary mb-1",
346
- children: "Description"
347
- }), /* @__PURE__ */ x("input", {
348
- type: "text",
349
- defaultValue: e.description,
350
- className: "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)]"
351
- })] }),
352
- e.actionType === "send_email" && /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
353
- className: "block text-xs font-medium text-text-primary mb-1",
354
- children: "Email Template"
355
- }), /* @__PURE__ */ S("select", {
356
- className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
357
- children: [
358
- /* @__PURE__ */ x("option", { children: "Welcome Email" }),
359
- /* @__PURE__ */ x("option", { children: "Onboarding Tips" }),
360
- /* @__PURE__ */ x("option", { children: "Follow-up" }),
361
- /* @__PURE__ */ x("option", { children: "Newsletter" })
362
- ]
363
- })] }),
364
- e.actionType === "wait" && /* @__PURE__ */ S("div", {
365
- className: "grid grid-cols-2 gap-2",
366
- children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
367
- className: "block text-xs font-medium text-text-primary mb-1",
368
- children: "Duration"
369
- }), /* @__PURE__ */ x("input", {
370
- type: "number",
371
- defaultValue: 3,
372
- className: "w-full rounded-md border border-border-seam bg-gloss-card shadow-pop px-3 py-2 text-sm text-text-primary"
373
- })] }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
374
- className: "block text-xs font-medium text-text-primary mb-1",
375
- children: "Unit"
376
- }), /* @__PURE__ */ S("select", {
377
- className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
378
- children: [
379
- /* @__PURE__ */ x("option", { children: "Hours" }),
380
- /* @__PURE__ */ x("option", { children: "Days" }),
381
- /* @__PURE__ */ x("option", { children: "Weeks" })
382
- ]
383
- })] })]
384
- })
476
+ j.length,
477
+ " nodes · ",
478
+ N.length,
479
+ " connections"
385
480
  ]
386
- }) : null;
387
- })()]
388
- }) : /* @__PURE__ */ S("div", {
389
- className: "rounded-lg border border-dashed border-border-subtle bg-bg-surface p-6 text-center",
390
- children: [/* @__PURE__ */ x(_, { className: "h-8 w-8 text-text-secondary mx-auto mb-2" }), /* @__PURE__ */ x("p", {
391
- className: "text-sm text-text-secondary",
392
- children: "Select a step to configure"
481
+ })]
482
+ }), /* @__PURE__ */ y("div", {
483
+ className: "hidden items-center gap-1.5 text-xs text-text-secondary sm:flex",
484
+ children: [/* @__PURE__ */ v(me, { className: "h-3.5 w-3.5" }), "Drag nodes · drag canvas to pan"]
393
485
  })]
394
- })
486
+ }), /* @__PURE__ */ y("div", {
487
+ onPointerDown: Be,
488
+ onPointerMove: Ve,
489
+ onPointerUp: He,
490
+ onPointerCancel: He,
491
+ className: "relative h-[520px] w-full cursor-grab overflow-hidden bg-bg-sunken active:cursor-grabbing sm:h-[580px]",
492
+ style: {
493
+ touchAction: "none",
494
+ backgroundImage: "radial-gradient(var(--color-border-subtle) 1px, transparent 1px)",
495
+ backgroundSize: `${20 * U}px ${20 * U}px`,
496
+ backgroundPosition: `${G.x}px ${G.y}px`
497
+ },
498
+ children: [/* @__PURE__ */ y("div", {
499
+ className: "absolute right-3 top-3 z-20 flex items-center gap-0.5 rounded-lg border border-border-seam bg-gloss-card p-1 shadow-pop",
500
+ children: [
501
+ /* @__PURE__ */ v("button", {
502
+ type: "button",
503
+ onClick: () => Q(-.1),
504
+ disabled: U <= b,
505
+ "aria-label": "Zoom out",
506
+ className: "flex h-8 w-8 items-center justify-center rounded-md text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary disabled:opacity-40",
507
+ children: /* @__PURE__ */ v(pe, { className: "h-4 w-4" })
508
+ }),
509
+ /* @__PURE__ */ y("span", {
510
+ className: "min-w-11 text-center text-xs font-medium tabular-nums text-text-secondary",
511
+ children: [Je, "%"]
512
+ }),
513
+ /* @__PURE__ */ v("button", {
514
+ type: "button",
515
+ onClick: () => Q(.1),
516
+ disabled: U >= x,
517
+ "aria-label": "Zoom in",
518
+ className: "flex h-8 w-8 items-center justify-center rounded-md text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary disabled:opacity-40",
519
+ children: /* @__PURE__ */ v(_, { className: "h-4 w-4" })
520
+ }),
521
+ /* @__PURE__ */ v("span", {
522
+ className: "mx-0.5 h-5 w-px bg-border-subtle",
523
+ "aria-hidden": !0
524
+ }),
525
+ /* @__PURE__ */ v("button", {
526
+ type: "button",
527
+ onClick: ze,
528
+ "aria-label": "Reset view",
529
+ className: "flex h-8 w-8 items-center justify-center rounded-md text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary",
530
+ children: /* @__PURE__ */ v(fe, { className: "h-4 w-4" })
531
+ })
532
+ ]
533
+ }), /* @__PURE__ */ y("div", {
534
+ className: "absolute left-0 top-0 origin-top-left",
535
+ style: { transform: `translate(${G.x}px, ${G.y}px) scale(${U})` },
536
+ children: [
537
+ /* @__PURE__ */ y("svg", {
538
+ width: ye,
539
+ height: be,
540
+ className: "pointer-events-none absolute left-0 top-0 overflow-visible",
541
+ children: [/* @__PURE__ */ v("defs", { children: [
542
+ "accent",
543
+ "yes",
544
+ "no"
545
+ ].map((e) => {
546
+ let t = e === "yes" ? "yes" : e === "no" ? "no" : null;
547
+ return /* @__PURE__ */ v("marker", {
548
+ id: `wf-arrow-${e}`,
549
+ viewBox: "0 0 10 10",
550
+ refX: "8",
551
+ refY: "5",
552
+ markerWidth: "7",
553
+ markerHeight: "7",
554
+ orient: "auto-start-reverse",
555
+ children: /* @__PURE__ */ v("path", {
556
+ d: "M0,0 L10,5 L0,10 z",
557
+ style: { fill: T(t) }
558
+ })
559
+ }, e);
560
+ }) }), N.map((e) => {
561
+ let t = q.get(e.source), n = q.get(e.target);
562
+ if (!t || !n) return null;
563
+ let r = d(t, e.branch), i = u(n), a = (r.y + i.y) / 2;
564
+ return /* @__PURE__ */ v("path", {
565
+ d: `M ${r.x} ${r.y} C ${r.x} ${a} ${i.x} ${a} ${i.x} ${i.y}`,
566
+ fill: "none",
567
+ strokeWidth: 2,
568
+ strokeLinecap: "round",
569
+ style: { stroke: T(e.branch) },
570
+ markerEnd: `url(#${Ce(e.branch)})`
571
+ }, e.id);
572
+ })]
573
+ }),
574
+ N.filter((e) => e.branch).map((e) => {
575
+ let t = q.get(e.source), n = q.get(e.target);
576
+ if (!t || !n) return null;
577
+ let r = d(t, e.branch), a = u(n);
578
+ return /* @__PURE__ */ v("span", {
579
+ style: {
580
+ left: (r.x + a.x) / 2,
581
+ top: (r.y + a.y) / 2
582
+ },
583
+ className: i("pointer-events-none absolute -translate-x-1/2 -translate-y-1/2 rounded-md px-1.5 py-0.5 text-[10px] font-semibold uppercase ring-1 ring-inset", e.branch === "yes" ? c.success : c.error),
584
+ children: e.branch
585
+ }, `label-${e.id}`);
586
+ }),
587
+ j.map((e) => /* @__PURE__ */ v(oe, {
588
+ node: e,
589
+ selected: F === e.id,
590
+ scale: U,
591
+ subtitle: Se(e),
592
+ onSelect: I,
593
+ onConfigure: I,
594
+ onDelete: Le,
595
+ onPositionChange: Ne
596
+ }, e.id))
597
+ ]
598
+ })]
599
+ })]
600
+ }),
601
+ /* @__PURE__ */ v("div", {
602
+ ref: je,
603
+ className: "xl:sticky xl:top-4 xl:self-start",
604
+ children: J ? /* @__PURE__ */ v(ce, {
605
+ node: J,
606
+ onLabelChange: (e) => Pe(J.id, e),
607
+ onConfigChange: (e) => Fe(J.id, e),
608
+ onTriggerChange: Ie,
609
+ onClose: () => I(null)
610
+ }) : /* @__PURE__ */ v(se, {})
395
611
  })
396
612
  ]
397
- })
613
+ }),
614
+ /* @__PURE__ */ v(te, { toasts: ke.map((e) => ({
615
+ ...e,
616
+ onDismiss: X
617
+ })) })
398
618
  ]
399
619
  });
400
620
  };