@burdenoff/microfe-headshotmarketing 2026.704.5 → 2026.704.6

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 (24) hide show
  1. package/dist/generated/wspace-operations.js +197 -100
  2. package/dist/generated/wspace-operations.js.map +1 -1
  3. package/dist/generated/wspace-types.js.map +1 -1
  4. package/dist/headshotmarketing/pages/ads/AdReachEstimatePanel.js +147 -0
  5. package/dist/headshotmarketing/pages/ads/AdReachEstimatePanel.js.map +1 -0
  6. package/dist/headshotmarketing/pages/ads/CreateAdCampaignPage.js +246 -235
  7. package/dist/headshotmarketing/pages/ads/CreateAdCampaignPage.js.map +1 -1
  8. package/dist/headshotmarketing/pages/campaigns/CampaignTemplatesPage.js +123 -233
  9. package/dist/headshotmarketing/pages/campaigns/CampaignTemplatesPage.js.map +1 -1
  10. package/dist/headshotmarketing/pages/campaigns/TemplateCard.js +81 -0
  11. package/dist/headshotmarketing/pages/campaigns/TemplateCard.js.map +1 -0
  12. package/dist/headshotmarketing/pages/crm/ConvertLeadButton.js +107 -0
  13. package/dist/headshotmarketing/pages/crm/ConvertLeadButton.js.map +1 -0
  14. package/dist/headshotmarketing/pages/crm/LeadCreateModal.js +232 -0
  15. package/dist/headshotmarketing/pages/crm/LeadCreateModal.js.map +1 -0
  16. package/dist/headshotmarketing/pages/crm/LeadsPage.js +267 -233
  17. package/dist/headshotmarketing/pages/crm/LeadsPage.js.map +1 -1
  18. package/dist/headshotmarketing/utils/adsMapper.js +2 -2
  19. package/dist/headshotmarketing/utils/adsMapper.js.map +1 -1
  20. package/dist/headshotmarketing/utils/campaignMapper.js +1 -22
  21. package/dist/headshotmarketing/utils/campaignMapper.js.map +1 -1
  22. package/dist/headshotmarketing/utils/crmMapper.js +2 -2
  23. package/dist/headshotmarketing/utils/crmMapper.js.map +1 -1
  24. package/package.json +1 -1
@@ -0,0 +1,107 @@
1
+ import { useConvertHeadshotmarketingLeadMutation as e } from "../../../generated/wspace-operations.js";
2
+ import { Modal as t } from "../../components/Modal.js";
3
+ import "../../components/index.js";
4
+ import { useState as n } from "react";
5
+ import { ArrowRightLeft as r } from "lucide-react";
6
+ import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
7
+ //#region src/headshotmarketing/pages/crm/ConvertLeadButton.tsx
8
+ var s = "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", c = "block text-sm font-medium text-text-primary mb-1", l = ({ lead: l, target: u, onConverted: d }) => {
9
+ let [f, p] = n(!1), [m, h] = n(l.title), [g, _] = n(null), [v, { loading: y }] = e(), b = u === null, x = () => {
10
+ h(l.title), _(null), p(!0);
11
+ }, S = () => {
12
+ y || (_(null), p(!1));
13
+ }, C = async () => {
14
+ if (!u) return;
15
+ let e = m.trim();
16
+ if (!e) {
17
+ _("Deal title is required.");
18
+ return;
19
+ }
20
+ _(null);
21
+ try {
22
+ await v({ variables: {
23
+ leadId: l.id,
24
+ pipelineId: u.pipelineId,
25
+ stageId: u.stageId,
26
+ dealTitle: e
27
+ } }), p(!1), d();
28
+ } catch (e) {
29
+ _(e instanceof Error ? e.message : "Failed to convert lead to deal.");
30
+ }
31
+ };
32
+ return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("button", {
33
+ type: "button",
34
+ onClick: x,
35
+ disabled: b,
36
+ title: b ? "Create a pipeline first to convert leads into deals" : "Convert to deal",
37
+ "aria-label": `Convert ${l.title} to deal`,
38
+ className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-text-secondary hover:bg-bg-sunken hover:text-action-primary-bg disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-text-secondary",
39
+ children: /* @__PURE__ */ a(r, {
40
+ className: "h-4 w-4",
41
+ "aria-hidden": "true"
42
+ })
43
+ }), u && /* @__PURE__ */ a(t, {
44
+ open: f,
45
+ onClose: S,
46
+ title: "Convert to deal",
47
+ description: "Move this lead into your sales pipeline as a new deal.",
48
+ size: "sm",
49
+ footer: /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("button", {
50
+ type: "button",
51
+ onClick: S,
52
+ className: "inline-flex items-center gap-2 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
53
+ children: "Cancel"
54
+ }), /* @__PURE__ */ o("button", {
55
+ type: "button",
56
+ onClick: () => void C(),
57
+ disabled: y,
58
+ className: "inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-60",
59
+ children: [/* @__PURE__ */ a(r, { className: "h-4 w-4" }), y ? "Converting…" : "Convert"]
60
+ })] }),
61
+ children: /* @__PURE__ */ o("div", {
62
+ className: "space-y-4",
63
+ children: [
64
+ /* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("label", {
65
+ className: c,
66
+ htmlFor: "convert-deal-title",
67
+ children: "Deal title"
68
+ }), /* @__PURE__ */ a("input", {
69
+ id: "convert-deal-title",
70
+ className: s,
71
+ value: m,
72
+ onChange: (e) => h(e.target.value)
73
+ })] }),
74
+ /* @__PURE__ */ a("div", {
75
+ className: "rounded-lg border border-border-subtle bg-bg-sunken px-4 py-3 text-sm",
76
+ children: /* @__PURE__ */ o("p", {
77
+ className: "text-text-secondary",
78
+ children: [
79
+ "Lands in",
80
+ " ",
81
+ /* @__PURE__ */ a("span", {
82
+ className: "font-medium text-text-primary",
83
+ children: u.pipelineName
84
+ }),
85
+ " ",
86
+ "at stage",
87
+ " ",
88
+ /* @__PURE__ */ a("span", {
89
+ className: "font-medium text-text-primary",
90
+ children: u.stageName
91
+ }),
92
+ "."
93
+ ]
94
+ })
95
+ }),
96
+ g && /* @__PURE__ */ a("div", {
97
+ className: "rounded-lg border border-status-error-border/30 bg-status-error-bg/10 px-4 py-3 text-sm text-status-error-text",
98
+ children: g
99
+ })
100
+ ]
101
+ })
102
+ })] });
103
+ };
104
+ //#endregion
105
+ export { l as ConvertLeadButton };
106
+
107
+ //# sourceMappingURL=ConvertLeadButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConvertLeadButton.js","names":[],"sources":["../../../../src/headshotmarketing/pages/crm/ConvertLeadButton.tsx"],"sourcesContent":["/**\n * Convert-to-deal row action\n *\n * Co-located with LeadsPage. Renders a compact \"Convert to deal\" icon button in\n * the leads table row-actions cell. Clicking opens a small confirm dialog that\n * shows the target pipeline + stage (the workspace's default/first pipeline and\n * its first stage, resolved by LeadsPage from the bootstrap) and lets the user\n * confirm/adjust the deal title before calling the real\n * `useConvertHeadshotmarketingLeadMutation`. On success it calls `onConverted()`\n * (the page's bootstrap `refetch`) so the lead moves into the deals pipeline.\n *\n * When the workspace has no pipeline/stage yet, `target` is null and the button\n * renders disabled with an honest explanation rather than a broken action.\n *\n * @module headshotmarketing/pages/crm\n */\n\nimport { useState, type FC } from \"react\";\nimport { ArrowRightLeft } from \"lucide-react\";\nimport { Modal } from \"../../components\";\nimport { useConvertHeadshotmarketingLeadMutation } from \"../../../generated/wspace-operations\";\n\nconst inputClass =\n \"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\";\nconst labelClass = \"block text-sm font-medium text-text-primary mb-1\";\n\n/** The pipeline + stage a converted deal lands in, resolved from the bootstrap. */\nexport interface ConvertTarget {\n pipelineId: string;\n pipelineName: string;\n stageId: string;\n stageName: string;\n}\n\nexport interface ConvertLeadButtonProps {\n lead: { id: string; title: string };\n /** Default/first pipeline + its first stage, or null when none exists yet. */\n target: ConvertTarget | null;\n /** Called after a successful conversion (wire to the page's bootstrap refetch). */\n onConverted: () => void;\n}\n\nexport const ConvertLeadButton: FC<ConvertLeadButtonProps> = ({\n lead,\n target,\n onConverted,\n}) => {\n const [open, setOpen] = useState(false);\n const [dealTitle, setDealTitle] = useState(lead.title);\n const [error, setError] = useState<string | null>(null);\n const [convertLead, { loading: converting }] =\n useConvertHeadshotmarketingLeadMutation();\n\n const disabled = target === null;\n\n const openConfirm = (): void => {\n setDealTitle(lead.title);\n setError(null);\n setOpen(true);\n };\n\n const closeConfirm = (): void => {\n if (converting) return;\n setError(null);\n setOpen(false);\n };\n\n const handleConvert = async (): Promise<void> => {\n if (!target) return;\n const title = dealTitle.trim();\n if (!title) {\n setError(\"Deal title is required.\");\n return;\n }\n setError(null);\n try {\n await convertLead({\n variables: {\n leadId: lead.id,\n pipelineId: target.pipelineId,\n stageId: target.stageId,\n dealTitle: title,\n },\n });\n setOpen(false);\n onConverted();\n } catch (err) {\n setError(\n err instanceof Error ? err.message : \"Failed to convert lead to deal.\",\n );\n }\n };\n\n return (\n <>\n <button\n type=\"button\"\n onClick={openConfirm}\n disabled={disabled}\n title={\n disabled\n ? \"Create a pipeline first to convert leads into deals\"\n : \"Convert to deal\"\n }\n aria-label={`Convert ${lead.title} to deal`}\n className=\"inline-flex h-8 w-8 items-center justify-center rounded-md text-text-secondary hover:bg-bg-sunken hover:text-action-primary-bg disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-text-secondary\"\n >\n <ArrowRightLeft className=\"h-4 w-4\" aria-hidden=\"true\" />\n </button>\n\n {target && (\n <Modal\n open={open}\n onClose={closeConfirm}\n title=\"Convert to deal\"\n description=\"Move this lead into your sales pipeline as a new deal.\"\n size=\"sm\"\n footer={\n <>\n <button\n type=\"button\"\n onClick={closeConfirm}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n Cancel\n </button>\n <button\n type=\"button\"\n onClick={() => void handleConvert()}\n disabled={converting}\n className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-60\"\n >\n <ArrowRightLeft className=\"h-4 w-4\" />\n {converting ? \"Converting…\" : \"Convert\"}\n </button>\n </>\n }\n >\n <div className=\"space-y-4\">\n <div>\n <label className={labelClass} htmlFor=\"convert-deal-title\">\n Deal title\n </label>\n <input\n id=\"convert-deal-title\"\n className={inputClass}\n value={dealTitle}\n onChange={(e) => setDealTitle(e.target.value)}\n />\n </div>\n <div className=\"rounded-lg border border-border-subtle bg-bg-sunken px-4 py-3 text-sm\">\n <p className=\"text-text-secondary\">\n Lands in{\" \"}\n <span className=\"font-medium text-text-primary\">\n {target.pipelineName}\n </span>{\" \"}\n at stage{\" \"}\n <span className=\"font-medium text-text-primary\">\n {target.stageName}\n </span>\n .\n </p>\n </div>\n {error && (\n <div className=\"rounded-lg border border-status-error-border/30 bg-status-error-bg/10 px-4 py-3 text-sm text-status-error-text\">\n {error}\n </div>\n )}\n </div>\n </Modal>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;AAsBA,IAAM,IACJ,wMACI,IAAa,oDAkBN,KAAiD,EAC5D,SACA,WACA,qBACI;CACJ,IAAM,CAAC,GAAM,KAAW,EAAS,GAAM,EACjC,CAAC,GAAW,KAAgB,EAAS,EAAK,MAAM,EAChD,CAAC,GAAO,KAAY,EAAwB,KAAK,EACjD,CAAC,GAAa,EAAE,SAAS,OAC7B,GAAyC,EAErC,IAAW,MAAW,MAEtB,UAA0B;AAG9B,EAFA,EAAa,EAAK,MAAM,EACxB,EAAS,KAAK,EACd,EAAQ,GAAK;IAGT,UAA2B;AAC3B,QACJ,EAAS,KAAK,EACd,EAAQ,GAAM;IAGV,IAAgB,YAA2B;AAC/C,MAAI,CAAC,EAAQ;EACb,IAAM,IAAQ,EAAU,MAAM;AAC9B,MAAI,CAAC,GAAO;AACV,KAAS,0BAA0B;AACnC;;AAEF,IAAS,KAAK;AACd,MAAI;AAUF,GATA,MAAM,EAAY,EAChB,WAAW;IACT,QAAQ,EAAK;IACb,YAAY,EAAO;IACnB,SAAS,EAAO;IAChB,WAAW;IACZ,EACF,CA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
+ import { useCreateHeadshotmarketingLeadMutation as e } from "../../../generated/wspace-operations.js";
2
+ import { HeadshotmarketingLeadSource as t, HeadshotmarketingLeadStatus as n } from "../../../generated/wspace-types.js";
3
+ import { Modal as r } from "../../components/Modal.js";
4
+ import "../../components/index.js";
5
+ import { useState as i } from "react";
6
+ import { Plus as a } from "lucide-react";
7
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
8
+ //#region src/headshotmarketing/pages/crm/LeadCreateModal.tsx
9
+ var l = "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", u = "block text-sm font-medium text-text-primary mb-1", d = [
10
+ {
11
+ value: t.Website,
12
+ label: "Website"
13
+ },
14
+ {
15
+ value: t.SocialMedia,
16
+ label: "Social media"
17
+ },
18
+ {
19
+ value: t.AdCampaign,
20
+ label: "Ad campaign"
21
+ },
22
+ {
23
+ value: t.Email,
24
+ label: "Email"
25
+ },
26
+ {
27
+ value: t.Referral,
28
+ label: "Referral"
29
+ },
30
+ {
31
+ value: t.Event,
32
+ label: "Event"
33
+ },
34
+ {
35
+ value: t.ColdOutreach,
36
+ label: "Cold outreach"
37
+ },
38
+ {
39
+ value: t.Other,
40
+ label: "Other"
41
+ }
42
+ ], f = [
43
+ {
44
+ value: n.New,
45
+ label: "New"
46
+ },
47
+ {
48
+ value: n.Contacted,
49
+ label: "Contacted"
50
+ },
51
+ {
52
+ value: n.Qualified,
53
+ label: "Qualified"
54
+ },
55
+ {
56
+ value: n.Unqualified,
57
+ label: "Unqualified"
58
+ },
59
+ {
60
+ value: n.Converted,
61
+ label: "Converted"
62
+ },
63
+ {
64
+ value: n.Lost,
65
+ label: "Lost"
66
+ }
67
+ ], p = {
68
+ title: "",
69
+ contactId: "",
70
+ source: t.Website,
71
+ estimatedValue: "",
72
+ status: n.New
73
+ }, m = ({ open: t, onClose: n, contacts: m, onCreated: h }) => {
74
+ let [g, _] = i(p), [v, y] = i(null), [b, { loading: x }] = e(), S = () => {
75
+ x || (y(null), n());
76
+ }, C = async () => {
77
+ if (!g.title.trim()) {
78
+ y("Lead title is required.");
79
+ return;
80
+ }
81
+ let e = null;
82
+ if (g.estimatedValue.trim()) {
83
+ let t = Number(g.estimatedValue);
84
+ if (!Number.isFinite(t) || t < 0) {
85
+ y("Estimated value must be a non-negative number.");
86
+ return;
87
+ }
88
+ e = t;
89
+ }
90
+ y(null);
91
+ try {
92
+ await b({ variables: { input: {
93
+ title: g.title.trim(),
94
+ contactId: g.contactId || null,
95
+ source: g.source,
96
+ status: g.status,
97
+ estimatedValue: e
98
+ } } }), _(p), h(), n();
99
+ } catch (e) {
100
+ y(e instanceof Error ? e.message : "Failed to create lead.");
101
+ }
102
+ }, w = (e) => {
103
+ let t = `${e.firstName} ${e.lastName}`.trim() || "Contact";
104
+ return e.company ? `${t} · ${e.company}` : t;
105
+ };
106
+ return /* @__PURE__ */ s(r, {
107
+ open: t,
108
+ onClose: S,
109
+ title: "New lead",
110
+ description: "Capture a prospect and route it into your pipeline.",
111
+ size: "lg",
112
+ footer: /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("button", {
113
+ type: "button",
114
+ onClick: S,
115
+ className: "inline-flex items-center gap-2 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
116
+ children: "Cancel"
117
+ }), /* @__PURE__ */ c("button", {
118
+ type: "button",
119
+ onClick: () => void C(),
120
+ disabled: x,
121
+ className: "inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-60",
122
+ children: [/* @__PURE__ */ s(a, { className: "h-4 w-4" }), x ? "Creating…" : "Create lead"]
123
+ })] }),
124
+ children: /* @__PURE__ */ c("div", {
125
+ className: "space-y-4",
126
+ children: [
127
+ /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("label", {
128
+ className: u,
129
+ htmlFor: "new-lead-title",
130
+ children: "Title"
131
+ }), /* @__PURE__ */ s("input", {
132
+ id: "new-lead-title",
133
+ className: l,
134
+ placeholder: "e.g. Website enquiry — corporate headshots",
135
+ value: g.title,
136
+ onChange: (e) => _((t) => ({
137
+ ...t,
138
+ title: e.target.value
139
+ }))
140
+ })] }),
141
+ /* @__PURE__ */ c("div", { children: [
142
+ /* @__PURE__ */ s("label", {
143
+ className: u,
144
+ htmlFor: "new-lead-contact",
145
+ children: "Linked contact"
146
+ }),
147
+ /* @__PURE__ */ c("select", {
148
+ id: "new-lead-contact",
149
+ className: l,
150
+ value: g.contactId,
151
+ onChange: (e) => _((t) => ({
152
+ ...t,
153
+ contactId: e.target.value
154
+ })),
155
+ children: [/* @__PURE__ */ s("option", {
156
+ value: "",
157
+ children: "No linked contact"
158
+ }), m.map((e) => /* @__PURE__ */ s("option", {
159
+ value: e.id,
160
+ children: w(e)
161
+ }, e.id))]
162
+ }),
163
+ m.length === 0 && /* @__PURE__ */ s("p", {
164
+ className: "mt-1 text-xs text-text-secondary",
165
+ children: "No contacts yet — you can link one later from the contact record."
166
+ })
167
+ ] }),
168
+ /* @__PURE__ */ c("div", {
169
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
170
+ children: [/* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("label", {
171
+ className: u,
172
+ htmlFor: "new-lead-source",
173
+ children: "Source"
174
+ }), /* @__PURE__ */ s("select", {
175
+ id: "new-lead-source",
176
+ className: l,
177
+ value: g.source,
178
+ onChange: (e) => _((t) => ({
179
+ ...t,
180
+ source: e.target.value
181
+ })),
182
+ children: d.map((e) => /* @__PURE__ */ s("option", {
183
+ value: e.value,
184
+ children: e.label
185
+ }, e.value))
186
+ })] }), /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("label", {
187
+ className: u,
188
+ htmlFor: "new-lead-status",
189
+ children: "Status"
190
+ }), /* @__PURE__ */ s("select", {
191
+ id: "new-lead-status",
192
+ className: l,
193
+ value: g.status,
194
+ onChange: (e) => _((t) => ({
195
+ ...t,
196
+ status: e.target.value
197
+ })),
198
+ children: f.map((e) => /* @__PURE__ */ s("option", {
199
+ value: e.value,
200
+ children: e.label
201
+ }, e.value))
202
+ })] })]
203
+ }),
204
+ /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("label", {
205
+ className: u,
206
+ htmlFor: "new-lead-value",
207
+ children: "Estimated value ($)"
208
+ }), /* @__PURE__ */ s("input", {
209
+ id: "new-lead-value",
210
+ type: "number",
211
+ min: "0",
212
+ step: "1",
213
+ className: l,
214
+ placeholder: "Optional",
215
+ value: g.estimatedValue,
216
+ onChange: (e) => _((t) => ({
217
+ ...t,
218
+ estimatedValue: e.target.value
219
+ }))
220
+ })] }),
221
+ v && /* @__PURE__ */ s("div", {
222
+ className: "rounded-lg border border-status-error-border/30 bg-status-error-bg/10 px-4 py-3 text-sm text-status-error-text",
223
+ children: v
224
+ })
225
+ ]
226
+ })
227
+ });
228
+ };
229
+ //#endregion
230
+ export { m as LeadCreateModal };
231
+
232
+ //# sourceMappingURL=LeadCreateModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LeadCreateModal.js","names":[],"sources":["../../../../src/headshotmarketing/pages/crm/LeadCreateModal.tsx"],"sourcesContent":["/**\n * New-lead creation modal\n *\n * Co-located with LeadsPage. Opens from the page header \"New Lead\" button and\n * captures the minimum a lead needs — a title, an optional link to an existing\n * bootstrap contact, a source, an estimated value and a status — then writes it\n * through the real `useCreateHeadshotmarketingLeadMutation`. On success it calls\n * `onCreated()` (the page's bootstrap `refetch`) so the new row appears, then\n * closes. All fields map straight to `CreateHeadshotmarketingLeadInput`; nothing\n * is mocked.\n *\n * @module headshotmarketing/pages/crm\n */\n\nimport { useState, type FC } from \"react\";\nimport { Plus } from \"lucide-react\";\nimport { Modal } from \"../../components\";\nimport {\n HeadshotmarketingLeadSource,\n HeadshotmarketingLeadStatus,\n} from \"../../../generated/wspace-types\";\nimport { useCreateHeadshotmarketingLeadMutation } from \"../../../generated/wspace-operations\";\nimport type { Contact } from \"../../types\";\n\nconst inputClass =\n \"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\";\nconst labelClass = \"block text-sm font-medium text-text-primary mb-1\";\n\nconst LEAD_SOURCE_OPTIONS: {\n value: HeadshotmarketingLeadSource;\n label: string;\n}[] = [\n { value: HeadshotmarketingLeadSource.Website, label: \"Website\" },\n { value: HeadshotmarketingLeadSource.SocialMedia, label: \"Social media\" },\n { value: HeadshotmarketingLeadSource.AdCampaign, label: \"Ad campaign\" },\n { value: HeadshotmarketingLeadSource.Email, label: \"Email\" },\n { value: HeadshotmarketingLeadSource.Referral, label: \"Referral\" },\n { value: HeadshotmarketingLeadSource.Event, label: \"Event\" },\n { value: HeadshotmarketingLeadSource.ColdOutreach, label: \"Cold outreach\" },\n { value: HeadshotmarketingLeadSource.Other, label: \"Other\" },\n];\n\nconst LEAD_STATUS_OPTIONS: {\n value: HeadshotmarketingLeadStatus;\n label: string;\n}[] = [\n { value: HeadshotmarketingLeadStatus.New, label: \"New\" },\n { value: HeadshotmarketingLeadStatus.Contacted, label: \"Contacted\" },\n { value: HeadshotmarketingLeadStatus.Qualified, label: \"Qualified\" },\n { value: HeadshotmarketingLeadStatus.Unqualified, label: \"Unqualified\" },\n { value: HeadshotmarketingLeadStatus.Converted, label: \"Converted\" },\n { value: HeadshotmarketingLeadStatus.Lost, label: \"Lost\" },\n];\n\nconst EMPTY_FORM = {\n title: \"\",\n contactId: \"\",\n source: HeadshotmarketingLeadSource.Website,\n estimatedValue: \"\",\n status: HeadshotmarketingLeadStatus.New,\n};\n\nexport interface LeadCreateModalProps {\n open: boolean;\n onClose: () => void;\n /** Existing bootstrap contacts the new lead can be linked to. */\n contacts: Contact[];\n /** Called after a successful create (wire to the page's bootstrap refetch). */\n onCreated: () => void;\n}\n\nexport const LeadCreateModal: FC<LeadCreateModalProps> = ({\n open,\n onClose,\n contacts,\n onCreated,\n}) => {\n const [form, setForm] = useState(EMPTY_FORM);\n const [error, setError] = useState<string | null>(null);\n const [createLead, { loading: saving }] =\n useCreateHeadshotmarketingLeadMutation();\n\n const handleClose = (): void => {\n if (saving) return;\n setError(null);\n onClose();\n };\n\n const handleSave = async (): Promise<void> => {\n if (!form.title.trim()) {\n setError(\"Lead title is required.\");\n return;\n }\n let estimatedValue: number | null = null;\n if (form.estimatedValue.trim()) {\n const parsed = Number(form.estimatedValue);\n if (!Number.isFinite(parsed) || parsed < 0) {\n setError(\"Estimated value must be a non-negative number.\");\n return;\n }\n estimatedValue = parsed;\n }\n setError(null);\n try {\n await createLead({\n variables: {\n input: {\n title: form.title.trim(),\n contactId: form.contactId || null,\n source: form.source,\n status: form.status,\n estimatedValue,\n },\n },\n });\n setForm(EMPTY_FORM);\n onCreated();\n onClose();\n } catch (err) {\n setError(err instanceof Error ? err.message : \"Failed to create lead.\");\n }\n };\n\n const contactLabel = (contact: Contact): string => {\n const name = `${contact.firstName} ${contact.lastName}`.trim() || \"Contact\";\n return contact.company ? `${name} · ${contact.company}` : name;\n };\n\n return (\n <Modal\n open={open}\n onClose={handleClose}\n title=\"New lead\"\n description=\"Capture a prospect and route it into your pipeline.\"\n size=\"lg\"\n footer={\n <>\n <button\n type=\"button\"\n onClick={handleClose}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n Cancel\n </button>\n <button\n type=\"button\"\n onClick={() => void handleSave()}\n disabled={saving}\n className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-60\"\n >\n <Plus className=\"h-4 w-4\" />\n {saving ? \"Creating…\" : \"Create lead\"}\n </button>\n </>\n }\n >\n <div className=\"space-y-4\">\n <div>\n <label className={labelClass} htmlFor=\"new-lead-title\">\n Title\n </label>\n <input\n id=\"new-lead-title\"\n className={inputClass}\n placeholder=\"e.g. Website enquiry — corporate headshots\"\n value={form.title}\n onChange={(e) => setForm((p) => ({ ...p, title: e.target.value }))}\n />\n </div>\n\n <div>\n <label className={labelClass} htmlFor=\"new-lead-contact\">\n Linked contact\n </label>\n <select\n id=\"new-lead-contact\"\n className={inputClass}\n value={form.contactId}\n onChange={(e) =>\n setForm((p) => ({ ...p, contactId: e.target.value }))\n }\n >\n <option value=\"\">No linked contact</option>\n {contacts.map((contact) => (\n <option key={contact.id} value={contact.id}>\n {contactLabel(contact)}\n </option>\n ))}\n </select>\n {contacts.length === 0 && (\n <p className=\"mt-1 text-xs text-text-secondary\">\n No contacts yet — you can link one later from the contact record.\n </p>\n )}\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label className={labelClass} htmlFor=\"new-lead-source\">\n Source\n </label>\n <select\n id=\"new-lead-source\"\n className={inputClass}\n value={form.source}\n onChange={(e) =>\n setForm((p) => ({\n ...p,\n source: e.target.value as HeadshotmarketingLeadSource,\n }))\n }\n >\n {LEAD_SOURCE_OPTIONS.map((o) => (\n <option key={o.value} value={o.value}>\n {o.label}\n </option>\n ))}\n </select>\n </div>\n <div>\n <label className={labelClass} htmlFor=\"new-lead-status\">\n Status\n </label>\n <select\n id=\"new-lead-status\"\n className={inputClass}\n value={form.status}\n onChange={(e) =>\n setForm((p) => ({\n ...p,\n status: e.target.value as HeadshotmarketingLeadStatus,\n }))\n }\n >\n {LEAD_STATUS_OPTIONS.map((o) => (\n <option key={o.value} value={o.value}>\n {o.label}\n </option>\n ))}\n </select>\n </div>\n </div>\n\n <div>\n <label className={labelClass} htmlFor=\"new-lead-value\">\n Estimated value ($)\n </label>\n <input\n id=\"new-lead-value\"\n type=\"number\"\n min=\"0\"\n step=\"1\"\n className={inputClass}\n placeholder=\"Optional\"\n value={form.estimatedValue}\n onChange={(e) =>\n setForm((p) => ({ ...p, estimatedValue: e.target.value }))\n }\n />\n </div>\n\n {error && (\n <div className=\"rounded-lg border border-status-error-border/30 bg-status-error-bg/10 px-4 py-3 text-sm text-status-error-text\">\n {error}\n </div>\n )}\n </div>\n </Modal>\n );\n};\n"],"mappings":";;;;;;;;AAwBA,IAAM,IACJ,wMACI,IAAa,oDAEb,IAGA;CACJ;EAAE,OAAO,EAA4B;EAAS,OAAO;EAAW;CAChE;EAAE,OAAO,EAA4B;EAAa,OAAO;EAAgB;CACzE;EAAE,OAAO,EAA4B;EAAY,OAAO;EAAe;CACvE;EAAE,OAAO,EAA4B;EAAO,OAAO;EAAS;CAC5D;EAAE,OAAO,EAA4B;EAAU,OAAO;EAAY;CAClE;EAAE,OAAO,EAA4B;EAAO,OAAO;EAAS;CAC5D;EAAE,OAAO,EAA4B;EAAc,OAAO;EAAiB;CAC3E;EAAE,OAAO,EAA4B;EAAO,OAAO;EAAS;CAC7D,EAEK,IAGA;CACJ;EAAE,OAAO,EAA4B;EAAK,OAAO;EAAO;CACxD;EAAE,OAAO,EAA4B;EAAW,OAAO;EAAa;CACpE;EAAE,OAAO,EAA4B;EAAW,OAAO;EAAa;CACpE;EAAE,OAAO,EAA4B;EAAa,OAAO;EAAe;CACxE;EAAE,OAAO,EAA4B;EAAW,OAAO;EAAa;CACpE;EAAE,OAAO,EAA4B;EAAM,OAAO;EAAQ;CAC3D,EAEK,IAAa;CACjB,OAAO;CACP,WAAW;CACX,QAAQ,EAA4B;CACpC,gBAAgB;CAChB,QAAQ,EAA4B;CACrC,EAWY,KAA6C,EACxD,SACA,YACA,aACA,mBACI;CACJ,IAAM,CAAC,GAAM,KAAW,EAAS,EAAW,EACtC,CAAC,GAAO,KAAY,EAAwB,KAAK,EACjD,CAAC,GAAY,EAAE,SAAS,OAC5B,GAAwC,EAEpC,UAA0B;AAC1B,QACJ,EAAS,KAAK,EACd,GAAS;IAGL,IAAa,YAA2B;AAC5C,MAAI,CAAC,EAAK,MAAM,MAAM,EAAE;AACtB,KAAS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