@burdenoff/microfe-headshotmarketing 2026.1201.1 → 2026.1202.1
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/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/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 +369 -369
- 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 +134 -134
- 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/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 +2 -2
- 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 +2 -2
|
@@ -6,8 +6,9 @@ import { useCreateHeadshotmarketingLeadMutation as o } from "../../../generated/
|
|
|
6
6
|
import { useState as s } from "react";
|
|
7
7
|
import { Plus as c } from "lucide-react";
|
|
8
8
|
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
|
+
import { ThemedSelect as f } from "@burdenoff/fe-libs/ui";
|
|
9
10
|
// src/headshotmarketing/pages/crm/LeadCreateModal.tsx
|
|
10
|
-
var
|
|
11
|
+
var p = "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)]", m = "block text-sm font-medium text-text-primary mb-1", h = [
|
|
11
12
|
{
|
|
12
13
|
value: i.Website,
|
|
13
14
|
label: "Website"
|
|
@@ -40,7 +41,7 @@ var f = "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 t
|
|
|
40
41
|
value: i.Other,
|
|
41
42
|
label: "Other"
|
|
42
43
|
}
|
|
43
|
-
],
|
|
44
|
+
], g = [
|
|
44
45
|
{
|
|
45
46
|
value: a.New,
|
|
46
47
|
label: "New"
|
|
@@ -65,109 +66,109 @@ var f = "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 t
|
|
|
65
66
|
value: a.Lost,
|
|
66
67
|
label: "Lost"
|
|
67
68
|
}
|
|
68
|
-
],
|
|
69
|
+
], _ = {
|
|
69
70
|
title: "",
|
|
70
71
|
contactId: "",
|
|
71
72
|
source: i.Website,
|
|
72
73
|
estimatedValue: "",
|
|
73
74
|
status: a.New,
|
|
74
75
|
clickId: ""
|
|
75
|
-
},
|
|
76
|
-
let [
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
if (!
|
|
80
|
-
|
|
76
|
+
}, v = ({ open: i, onClose: a, contacts: v, onCreated: y }) => {
|
|
77
|
+
let [b, x] = s(_), [S, C] = s(null), [w, { loading: T }] = o(), E = () => {
|
|
78
|
+
T || (C(null), a());
|
|
79
|
+
}, D = async () => {
|
|
80
|
+
if (!b.title.trim()) {
|
|
81
|
+
C("Lead title is required.");
|
|
81
82
|
return;
|
|
82
83
|
}
|
|
83
84
|
let e = null;
|
|
84
|
-
if (
|
|
85
|
-
let t = Number(
|
|
85
|
+
if (b.estimatedValue.trim()) {
|
|
86
|
+
let t = Number(b.estimatedValue);
|
|
86
87
|
if (!Number.isFinite(t) || t < 0) {
|
|
87
|
-
|
|
88
|
+
C("Estimated value must be a non-negative number.");
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
91
|
e = t;
|
|
91
92
|
}
|
|
92
93
|
let r = null;
|
|
93
|
-
if (
|
|
94
|
+
if (b.clickId.trim() && (r = n(b.clickId), !r)) C(`Tracked click id must be the ${t} value or a URL that contains it.`);
|
|
94
95
|
else {
|
|
95
|
-
|
|
96
|
+
C(null);
|
|
96
97
|
try {
|
|
97
|
-
await
|
|
98
|
-
title:
|
|
99
|
-
contactId:
|
|
100
|
-
source:
|
|
101
|
-
status:
|
|
98
|
+
await w({ variables: { input: {
|
|
99
|
+
title: b.title.trim(),
|
|
100
|
+
contactId: b.contactId || null,
|
|
101
|
+
source: b.source,
|
|
102
|
+
status: b.status,
|
|
102
103
|
estimatedValue: e,
|
|
103
104
|
attributionClickId: r
|
|
104
|
-
} } }),
|
|
105
|
+
} } }), x(_), y(), a();
|
|
105
106
|
} catch (e) {
|
|
106
|
-
|
|
107
|
+
C(e instanceof Error ? e.message : "Failed to create lead.");
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
|
-
},
|
|
110
|
+
}, O = (e) => {
|
|
110
111
|
let t = `${e.firstName} ${e.lastName}`.trim() || "Contact";
|
|
111
112
|
return e.company ? `${t} · ${e.company}` : t;
|
|
112
113
|
};
|
|
113
114
|
return /* @__PURE__ */ u(r, {
|
|
114
115
|
open: i,
|
|
115
|
-
onClose:
|
|
116
|
+
onClose: E,
|
|
116
117
|
title: "New lead",
|
|
117
118
|
description: "Capture a prospect and route it into your pipeline.",
|
|
118
119
|
size: "lg",
|
|
119
120
|
footer: /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("button", {
|
|
120
121
|
type: "button",
|
|
121
|
-
onClick:
|
|
122
|
+
onClick: E,
|
|
122
123
|
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",
|
|
123
124
|
children: "Cancel"
|
|
124
125
|
}), /* @__PURE__ */ d("button", {
|
|
125
126
|
type: "button",
|
|
126
|
-
onClick: () => void
|
|
127
|
-
disabled:
|
|
127
|
+
onClick: () => void D(),
|
|
128
|
+
disabled: T,
|
|
128
129
|
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",
|
|
129
|
-
children: [/* @__PURE__ */ u(c, { className: "h-4 w-4" }),
|
|
130
|
+
children: [/* @__PURE__ */ u(c, { className: "h-4 w-4" }), T ? "Creating…" : "Create lead"]
|
|
130
131
|
})] }),
|
|
131
132
|
children: /* @__PURE__ */ d("div", {
|
|
132
133
|
className: "space-y-4",
|
|
133
134
|
children: [
|
|
134
135
|
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
135
|
-
className:
|
|
136
|
+
className: m,
|
|
136
137
|
htmlFor: "new-lead-title",
|
|
137
138
|
children: "Title"
|
|
138
139
|
}), /* @__PURE__ */ u("input", {
|
|
139
140
|
id: "new-lead-title",
|
|
140
|
-
className:
|
|
141
|
+
className: p,
|
|
141
142
|
placeholder: "e.g. Website enquiry — corporate headshots",
|
|
142
|
-
value:
|
|
143
|
-
onChange: (e) =>
|
|
143
|
+
value: b.title,
|
|
144
|
+
onChange: (e) => x((t) => ({
|
|
144
145
|
...t,
|
|
145
146
|
title: e.target.value
|
|
146
147
|
}))
|
|
147
148
|
})] }),
|
|
148
149
|
/* @__PURE__ */ d("div", { children: [
|
|
149
150
|
/* @__PURE__ */ u("label", {
|
|
150
|
-
className:
|
|
151
|
+
className: m,
|
|
151
152
|
htmlFor: "new-lead-contact",
|
|
152
153
|
children: "Linked contact"
|
|
153
154
|
}),
|
|
154
|
-
/* @__PURE__ */ d(
|
|
155
|
+
/* @__PURE__ */ d(f, {
|
|
155
156
|
id: "new-lead-contact",
|
|
156
|
-
className:
|
|
157
|
-
value:
|
|
158
|
-
onChange: (e) =>
|
|
157
|
+
className: p,
|
|
158
|
+
value: b.contactId,
|
|
159
|
+
onChange: (e) => x((t) => ({
|
|
159
160
|
...t,
|
|
160
161
|
contactId: e.target.value
|
|
161
162
|
})),
|
|
162
163
|
children: [/* @__PURE__ */ u("option", {
|
|
163
164
|
value: "",
|
|
164
165
|
children: "No linked contact"
|
|
165
|
-
}),
|
|
166
|
+
}), v.map((e) => /* @__PURE__ */ u("option", {
|
|
166
167
|
value: e.id,
|
|
167
|
-
children:
|
|
168
|
+
children: O(e)
|
|
168
169
|
}, e.id))]
|
|
169
170
|
}),
|
|
170
|
-
|
|
171
|
+
v.length === 0 && /* @__PURE__ */ u("p", {
|
|
171
172
|
className: "mt-1 text-xs text-text-secondary",
|
|
172
173
|
children: "No contacts yet — you can link one later from the contact record."
|
|
173
174
|
})
|
|
@@ -175,41 +176,41 @@ var f = "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 t
|
|
|
175
176
|
/* @__PURE__ */ d("div", {
|
|
176
177
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
|
|
177
178
|
children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
178
|
-
className:
|
|
179
|
+
className: m,
|
|
179
180
|
htmlFor: "new-lead-source",
|
|
180
181
|
children: "Source"
|
|
181
|
-
}), /* @__PURE__ */ u(
|
|
182
|
+
}), /* @__PURE__ */ u(f, {
|
|
182
183
|
id: "new-lead-source",
|
|
183
|
-
className:
|
|
184
|
-
value:
|
|
185
|
-
onChange: (e) =>
|
|
184
|
+
className: p,
|
|
185
|
+
value: b.source,
|
|
186
|
+
onChange: (e) => x((t) => ({
|
|
186
187
|
...t,
|
|
187
188
|
source: e.target.value
|
|
188
189
|
})),
|
|
189
|
-
children:
|
|
190
|
+
children: h.map((e) => /* @__PURE__ */ u("option", {
|
|
190
191
|
value: e.value,
|
|
191
192
|
children: e.label
|
|
192
193
|
}, e.value))
|
|
193
194
|
})] }), /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
194
|
-
className:
|
|
195
|
+
className: m,
|
|
195
196
|
htmlFor: "new-lead-status",
|
|
196
197
|
children: "Status"
|
|
197
|
-
}), /* @__PURE__ */ u(
|
|
198
|
+
}), /* @__PURE__ */ u(f, {
|
|
198
199
|
id: "new-lead-status",
|
|
199
|
-
className:
|
|
200
|
-
value:
|
|
201
|
-
onChange: (e) =>
|
|
200
|
+
className: p,
|
|
201
|
+
value: b.status,
|
|
202
|
+
onChange: (e) => x((t) => ({
|
|
202
203
|
...t,
|
|
203
204
|
status: e.target.value
|
|
204
205
|
})),
|
|
205
|
-
children:
|
|
206
|
+
children: g.map((e) => /* @__PURE__ */ u("option", {
|
|
206
207
|
value: e.value,
|
|
207
208
|
children: e.label
|
|
208
209
|
}, e.value))
|
|
209
210
|
})] })]
|
|
210
211
|
}),
|
|
211
212
|
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
212
|
-
className:
|
|
213
|
+
className: m,
|
|
213
214
|
htmlFor: "new-lead-value",
|
|
214
215
|
children: "Estimated value ($)"
|
|
215
216
|
}), /* @__PURE__ */ u("input", {
|
|
@@ -217,26 +218,26 @@ var f = "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 t
|
|
|
217
218
|
type: "number",
|
|
218
219
|
min: "0",
|
|
219
220
|
step: "1",
|
|
220
|
-
className:
|
|
221
|
+
className: p,
|
|
221
222
|
placeholder: "Optional",
|
|
222
|
-
value:
|
|
223
|
-
onChange: (e) =>
|
|
223
|
+
value: b.estimatedValue,
|
|
224
|
+
onChange: (e) => x((t) => ({
|
|
224
225
|
...t,
|
|
225
226
|
estimatedValue: e.target.value
|
|
226
227
|
}))
|
|
227
228
|
})] }),
|
|
228
229
|
/* @__PURE__ */ d("div", { children: [
|
|
229
230
|
/* @__PURE__ */ u("label", {
|
|
230
|
-
className:
|
|
231
|
+
className: m,
|
|
231
232
|
htmlFor: "new-lead-click-id",
|
|
232
233
|
children: "Tracked click id (optional)"
|
|
233
234
|
}),
|
|
234
235
|
/* @__PURE__ */ u("input", {
|
|
235
236
|
id: "new-lead-click-id",
|
|
236
|
-
className:
|
|
237
|
+
className: p,
|
|
237
238
|
placeholder: `${t} value or the landing page URL`,
|
|
238
|
-
value:
|
|
239
|
-
onChange: (e) =>
|
|
239
|
+
value: b.clickId,
|
|
240
|
+
onChange: (e) => x((t) => ({
|
|
240
241
|
...t,
|
|
241
242
|
clickId: e.target.value
|
|
242
243
|
}))
|
|
@@ -291,14 +292,14 @@ var f = "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 t
|
|
|
291
292
|
]
|
|
292
293
|
})
|
|
293
294
|
] }),
|
|
294
|
-
|
|
295
|
+
S && /* @__PURE__ */ u("div", {
|
|
295
296
|
className: "rounded-lg border border-status-error-border/30 bg-status-error-bg/10 px-4 py-3 text-sm text-status-error-text",
|
|
296
|
-
children:
|
|
297
|
+
children: S
|
|
297
298
|
})
|
|
298
299
|
]
|
|
299
300
|
})
|
|
300
301
|
});
|
|
301
302
|
};
|
|
302
|
-
export {
|
|
303
|
+
export { v as LeadCreateModal };
|
|
303
304
|
|
|
304
305
|
//# sourceMappingURL=LeadCreateModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LeadCreateModal.js","names":["_Fragment","inputClass","labelClass","LEAD_SOURCE_OPTIONS","HeadshotmarketingLeadSource","LEAD_STATUS_OPTIONS","HeadshotmarketingLeadStatus","EMPTY_FORM","LeadCreateModal","form","setForm","useState","error","setError","createLead","saving","useCreateHeadshotmarketingLeadMutation","handleClose","onClose","handleSave","estimatedValue","parsed","attributionClickId","extractTrackedClickId","TRACKED_CLICK_ID_PARAM","onCreated","err","contactLabel","name","contact","Modal","Fragment","Plus","p","contacts","o","LEAD_CAPTURE_SNIPPET"],"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. The optional tracked click id (BOFF-10496) accepts the `hm_cid`\n * value or the landing-page URL that carries it and is sent as\n * `attributionClickId`, so the click that produced the lead is attributed.\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 LEAD_CAPTURE_SNIPPET,\n TRACKED_CLICK_ID_PARAM,\n extractTrackedClickId,\n} from \"../../utils/trackedLinks\";\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 clickId: \"\",\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 let attributionClickId: string | null = null;\n if (form.clickId.trim()) {\n attributionClickId = extractTrackedClickId(form.clickId);\n if (!attributionClickId) {\n setError(\n `Tracked click id must be the ${TRACKED_CLICK_ID_PARAM} value or a URL that contains it.`,\n );\n return;\n }\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 attributionClickId,\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 <div>\n <label className={labelClass} htmlFor=\"new-lead-click-id\">\n Tracked click id (optional)\n </label>\n <input\n id=\"new-lead-click-id\"\n className={inputClass}\n placeholder={`${TRACKED_CLICK_ID_PARAM} value or the landing page URL`}\n value={form.clickId}\n onChange={(e) =>\n setForm((p) => ({ ...p, clickId: e.target.value }))\n }\n />\n <p className=\"mt-1 text-xs text-text-secondary\">\n Tracked social and ad links add{\" \"}\n <code className=\"font-mono\">{TRACKED_CLICK_ID_PARAM}</code> to the\n landing page URL. Paste it here (or the whole URL) to attribute the\n click to this lead.\n </p>\n <details className=\"mt-2 rounded-md border border-border-subtle bg-bg-sunken/40 px-3 py-2\">\n <summary className=\"cursor-pointer text-xs font-medium text-text-primary\">\n Capture it automatically from your lead form\n </summary>\n <p className=\"mt-2 text-xs text-text-secondary\">\n On the landing page, read{\" \"}\n <code className=\"font-mono\">{TRACKED_CLICK_ID_PARAM}</code> from\n the URL and pass it as{\" \"}\n <code className=\"font-mono\">attributionClickId</code> to{\" \"}\n <code className=\"font-mono\">createHeadshotmarketingLead</code>.\n Unknown, expired or already-used ids are ignored.\n </p>\n <pre className=\"mt-2 overflow-x-auto rounded bg-bg-surface p-2 font-mono text-[11px] text-text-primary\">\n {LEAD_CAPTURE_SNIPPET}\n </pre>\n </details>\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":";;;;;;;;;AA+BA,IAAMC,IACJ,wMACIC,IAAa,oDAEbC,IAGA;CACJ;EAAE,OAAOC,EAA4B;EAAS,OAAO;CAAU;CAC/D;EAAE,OAAOA,EAA4B;EAAa,OAAO;CAAe;CACxE;EAAE,OAAOA,EAA4B;EAAY,OAAO;CAAc;CACtE;EAAE,OAAOA,EAA4B;EAAO,OAAO;CAAQ;CAC3D;EAAE,OAAOA,EAA4B;EAAU,OAAO;CAAW;CACjE;EAAE,OAAOA,EAA4B;EAAO,OAAO;CAAQ;CAC3D;EAAE,OAAOA,EAA4B;EAAc,OAAO;CAAgB;CAC1E;EAAE,OAAOA,EAA4B;EAAO,OAAO;CAAQ;AAC7D,GAEMC,IAGA;CACJ;EAAE,OAAOC,EAA4B;EAAK,OAAO;CAAM;CACvD;EAAE,OAAOA,EAA4B;EAAW,OAAO;CAAY;CACnE;EAAE,OAAOA,EAA4B;EAAW,OAAO;CAAY;CACnE;EAAE,OAAOA,EAA4B;EAAa,OAAO;CAAc;CACvE;EAAE,OAAOA,EAA4B;EAAW,OAAO;CAAY;CACnE;EAAE,OAAOA,EAA4B;EAAM,OAAO;CAAO;AAC3D,GAEMC,IAAa;CACjB,OAAO;CACP,WAAW;CACX,QAAQH,EAA4B;CACpC,gBAAgB;CAChB,QAAQE,EAA4B;CACpC,SAAS;AACX,GAWaE,KAA6C,EACxD,SACA,YACA,aACA,mBACI;CACJ,IAAM,CAACC,GAAMC,KAAWC,EAASJ,CAAU,GACrC,CAACK,GAAOC,KAAYF,EAAwB,IAAI,GAChD,CAACG,GAAY,EAAE,SAASC,OAC5BC,EAAuC,GAEnCC,UAA0B;EAC9B,AAAIF,MACJF,EAAS,IAAI,GACbK,EAAQ;CACV,GAEMC,IAAa,YAA2B;EAC5C,IAAI,CAACV,EAAK,MAAM,KAAK,GAAG;GACtB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A;OACE,kBAAC,WAAD;QAAS,WAAU;QAAuD,UAAA;OAEjE,CAAA;OACT,kBAAC,KAAD;QAAG,WAAU;QAAb,UAAA;SAAgD;SACpB;SAC1B,kBAAC,QAAD;UAAM,WAAU;UAAa,UAAAA;SAA6B,CAAA;SAAC;SACpC;SACvB,kBAAC,QAAD;UAAM,WAAU;UAAY,UAAA;SAAwB,CAAA;SAAC;SAAI;SACzD,kBAAC,QAAD;UAAM,WAAU;UAAY,UAAA;SAAiC,CAAA;SAAC;QAE7D;;OACH,kBAAC,OAAD;QAAK,WAAU;QACZ,UAAAY;OACE,CAAA;MACE;;IACN,EAAA,CAAA;IAEJxB,KACC,kBAAC,OAAD;KAAK,WAAU;KACZ,UAAAA;IACE,CAAA;GAEJ;;CACA,CAAA;AAEX"}
|
|
1
|
+
{"version":3,"file":"LeadCreateModal.js","names":["_Fragment","inputClass","labelClass","LEAD_SOURCE_OPTIONS","HeadshotmarketingLeadSource","LEAD_STATUS_OPTIONS","HeadshotmarketingLeadStatus","EMPTY_FORM","LeadCreateModal","form","setForm","useState","error","setError","createLead","saving","useCreateHeadshotmarketingLeadMutation","handleClose","onClose","handleSave","estimatedValue","parsed","attributionClickId","extractTrackedClickId","TRACKED_CLICK_ID_PARAM","onCreated","err","contactLabel","name","contact","Modal","Fragment","Plus","p","ThemedSelect","contacts","o","LEAD_CAPTURE_SNIPPET"],"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. The optional tracked click id (BOFF-10496) accepts the `hm_cid`\n * value or the landing-page URL that carries it and is sent as\n * `attributionClickId`, so the click that produced the lead is attributed.\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 LEAD_CAPTURE_SNIPPET,\n TRACKED_CLICK_ID_PARAM,\n extractTrackedClickId,\n} from \"../../utils/trackedLinks\";\nimport {\n HeadshotmarketingLeadSource,\n HeadshotmarketingLeadStatus,\n} from \"../../../generated/wspace-types\";\nimport { useCreateHeadshotmarketingLeadMutation } from \"../../../generated/wspace-operations\";\nimport type { Contact } from \"../../types\";\nimport { ThemedSelect } from \"@burdenoff/fe-libs/ui\";\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 clickId: \"\",\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 let attributionClickId: string | null = null;\n if (form.clickId.trim()) {\n attributionClickId = extractTrackedClickId(form.clickId);\n if (!attributionClickId) {\n setError(\n `Tracked click id must be the ${TRACKED_CLICK_ID_PARAM} value or a URL that contains it.`,\n );\n return;\n }\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 attributionClickId,\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 <ThemedSelect\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 </ThemedSelect>\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 <ThemedSelect\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 </ThemedSelect>\n </div>\n <div>\n <label className={labelClass} htmlFor=\"new-lead-status\">\n Status\n </label>\n <ThemedSelect\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 </ThemedSelect>\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 <div>\n <label className={labelClass} htmlFor=\"new-lead-click-id\">\n Tracked click id (optional)\n </label>\n <input\n id=\"new-lead-click-id\"\n className={inputClass}\n placeholder={`${TRACKED_CLICK_ID_PARAM} value or the landing page URL`}\n value={form.clickId}\n onChange={(e) =>\n setForm((p) => ({ ...p, clickId: e.target.value }))\n }\n />\n <p className=\"mt-1 text-xs text-text-secondary\">\n Tracked social and ad links add{\" \"}\n <code className=\"font-mono\">{TRACKED_CLICK_ID_PARAM}</code> to the\n landing page URL. Paste it here (or the whole URL) to attribute the\n click to this lead.\n </p>\n <details className=\"mt-2 rounded-md border border-border-subtle bg-bg-sunken/40 px-3 py-2\">\n <summary className=\"cursor-pointer text-xs font-medium text-text-primary\">\n Capture it automatically from your lead form\n </summary>\n <p className=\"mt-2 text-xs text-text-secondary\">\n On the landing page, read{\" \"}\n <code className=\"font-mono\">{TRACKED_CLICK_ID_PARAM}</code> from\n the URL and pass it as{\" \"}\n <code className=\"font-mono\">attributionClickId</code> to{\" \"}\n <code className=\"font-mono\">createHeadshotmarketingLead</code>.\n Unknown, expired or already-used ids are ignored.\n </p>\n <pre className=\"mt-2 overflow-x-auto rounded bg-bg-surface p-2 font-mono text-[11px] text-text-primary\">\n {LEAD_CAPTURE_SNIPPET}\n </pre>\n </details>\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":";;;;;;;;;;AAgCA,IAAMC,IACJ,wMACIC,IAAa,oDAEbC,IAGA;CACJ;EAAE,OAAOC,EAA4B;EAAS,OAAO;CAAU;CAC/D;EAAE,OAAOA,EAA4B;EAAa,OAAO;CAAe;CACxE;EAAE,OAAOA,EAA4B;EAAY,OAAO;CAAc;CACtE;EAAE,OAAOA,EAA4B;EAAO,OAAO;CAAQ;CAC3D;EAAE,OAAOA,EAA4B;EAAU,OAAO;CAAW;CACjE;EAAE,OAAOA,EAA4B;EAAO,OAAO;CAAQ;CAC3D;EAAE,OAAOA,EAA4B;EAAc,OAAO;CAAgB;CAC1E;EAAE,OAAOA,EAA4B;EAAO,OAAO;CAAQ;AAC7D,GAEMC,IAGA;CACJ;EAAE,OAAOC,EAA4B;EAAK,OAAO;CAAM;CACvD;EAAE,OAAOA,EAA4B;EAAW,OAAO;CAAY;CACnE;EAAE,OAAOA,EAA4B;EAAW,OAAO;CAAY;CACnE;EAAE,OAAOA,EAA4B;EAAa,OAAO;CAAc;CACvE;EAAE,OAAOA,EAA4B;EAAW,OAAO;CAAY;CACnE;EAAE,OAAOA,EAA4B;EAAM,OAAO;CAAO;AAC3D,GAEMC,IAAa;CACjB,OAAO;CACP,WAAW;CACX,QAAQH,EAA4B;CACpC,gBAAgB;CAChB,QAAQE,EAA4B;CACpC,SAAS;AACX,GAWaE,KAA6C,EACxD,SACA,YACA,aACA,mBACI;CACJ,IAAM,CAACC,GAAMC,KAAWC,EAASJ,CAAU,GACrC,CAACK,GAAOC,KAAYF,EA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OAAO;MAAM,EAAE;KAErD,CAAA;KACD,kBAAC,KAAD;MAAG,WAAU;MAAb,UAAA;OAAgD;OACd;OAChC,kBAAC,QAAD;QAAM,WAAU;QAAa,UAAAT;OAA6B,CAAA;OAAC;MAG1D;;KACH,kBAAC,WAAD;MAAS,WAAU;MAAnB,UAAA;OACE,kBAAC,WAAD;QAAS,WAAU;QAAuD,UAAA;OAEjE,CAAA;OACT,kBAAC,KAAD;QAAG,WAAU;QAAb,UAAA;SAAgD;SACpB;SAC1B,kBAAC,QAAD;UAAM,WAAU;UAAa,UAAAA;SAA6B,CAAA;SAAC;SACpC;SACvB,kBAAC,QAAD;UAAM,WAAU;UAAY,UAAA;SAAwB,CAAA;SAAC;SAAI;SACzD,kBAAC,QAAD;UAAM,WAAU;UAAY,UAAA;SAAiC,CAAA;SAAC;QAE7D;;OACH,kBAAC,OAAD;QAAK,WAAU;QACZ,UAAAa;OACE,CAAA;MACE;;IACN,EAAA,CAAA;IAEJzB,KACC,kBAAC,OAAD;KAAK,WAAU;KACZ,UAAAA;IACE,CAAA;GAEJ;;CACA,CAAA;AAEX"}
|
|
@@ -3,20 +3,20 @@ import { cn as e, formatCurrency as t, formatDate as n } from "../../utils/helpe
|
|
|
3
3
|
import { toContactModel as r, toLeadModel as ee } from "../../utils/crmMapper.js";
|
|
4
4
|
import { PageLayout as i } from "../../components/PageLayout.js";
|
|
5
5
|
import { StatCard as a } from "../../components/StatCard.js";
|
|
6
|
+
import { EmptyState as te } from "../../components/EmptyState.js";
|
|
6
7
|
import { DataTable as o } from "../../components/DataTable.js";
|
|
7
8
|
import { StatusBadge as s } from "../../components/StatusBadge.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { useRefreshCrmSelection as te } from "../../hooks/useRefreshCrmSelection.js";
|
|
9
|
+
import { ChartCard as c } from "../../components/ChartCard.js";
|
|
10
|
+
import { FilterBar as l } from "../../components/FilterBar.js";
|
|
11
|
+
import { QueryStateBoundary as u } from "../../components/QueryStateBoundary.js";
|
|
12
|
+
import { HeadshotmarketingLeadStatus as d } from "../../../generated/wspace-types.js";
|
|
13
|
+
import { useHeadshotmarketingBootstrap as f } from "../../hooks/useHeadshotmarketingBootstrap.js";
|
|
14
|
+
import { useHeadshotMarketing as p } from "../../context/HeadshotMarketingContext.js";
|
|
15
|
+
import { CrmSubNav as m } from "./CrmSubNav.js";
|
|
16
|
+
import { LeadActionsMenu as h } from "./CrmActions.js";
|
|
17
|
+
import { LeadCreateModal as g } from "./LeadCreateModal.js";
|
|
18
|
+
import { useRecordSelection as _ } from "../../hooks/useRecordSelection.js";
|
|
19
|
+
import { useRefreshCrmSelection as v } from "../../hooks/useRefreshCrmSelection.js";
|
|
20
20
|
import { CrmRecordSelection as ne } from "../../components/CrmRecordSelection.js";
|
|
21
21
|
import { ConvertLeadButton as re } from "./ConvertLeadButton.js";
|
|
22
22
|
import { LeadAvatar as y, LeadScoreHistogram as ie, LeadSourceCell as ae, bucketScores as oe } from "./LeadsWidgets.js";
|
|
@@ -24,9 +24,9 @@ import { LeadBatchScoringModal as se, LeadScoreDecisionModal as ce } from "./Lea
|
|
|
24
24
|
import { useMemo as b, useState as x } from "react";
|
|
25
25
|
import { Flame as S, Gauge as C, Plus as w, Sparkles as T, TrendingUp as E, Users as D } from "lucide-react";
|
|
26
26
|
import { jsx as O, jsxs as k } from "react/jsx-runtime";
|
|
27
|
-
import { EmphasisPanel as A, PagePurpose as j } from "@burdenoff/fe-libs/ui";
|
|
27
|
+
import { EmphasisPanel as A, PagePurpose as j, ThemedSelect as M } from "@burdenoff/fe-libs/ui";
|
|
28
28
|
// src/headshotmarketing/pages/crm/LeadsPage.tsx
|
|
29
|
-
var
|
|
29
|
+
var N = [
|
|
30
30
|
{
|
|
31
31
|
value: "all",
|
|
32
32
|
label: "All Sources"
|
|
@@ -63,9 +63,9 @@ var M = [
|
|
|
63
63
|
value: "other",
|
|
64
64
|
label: "Other"
|
|
65
65
|
}
|
|
66
|
-
],
|
|
67
|
-
let { selectRecord:
|
|
68
|
-
let e =
|
|
66
|
+
], P = "min-h-[44px] rounded-md border border-border-seam bg-gloss-card shadow-pop px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", F = () => {
|
|
67
|
+
let { selectRecord: F } = _(), { data: I, loading: L, error: R } = f(), z = v("lead"), { currentUser: B, navigate: le, basePath: V } = p(), [H, U] = x(""), [W, ue] = x("all"), [G, de] = x("all"), [fe, K] = x(!1), [pe, q] = x(null), [me, J] = x(!1), he = b(() => {
|
|
68
|
+
let e = I?.headshotmarketingPipelines.items ?? [];
|
|
69
69
|
if (e.length === 0) return null;
|
|
70
70
|
let t = e.find((e) => e.isDefault) ?? e[0], n = [...t.stages].sort((e, t) => e.order - t.order)[0];
|
|
71
71
|
return n ? {
|
|
@@ -74,10 +74,10 @@ var M = [
|
|
|
74
74
|
stageId: n.id,
|
|
75
75
|
stageName: n.name
|
|
76
76
|
} : null;
|
|
77
|
-
}, [
|
|
78
|
-
let e = (
|
|
77
|
+
}, [I?.headshotmarketingPipelines.items]), Y = b(() => {
|
|
78
|
+
let e = (I?.headshotmarketingContacts.items ?? []).map((e) => r(e));
|
|
79
79
|
return Object.fromEntries(e.map((e) => [e.id, e]));
|
|
80
|
-
}, [
|
|
80
|
+
}, [I?.headshotmarketingContacts.items]), X = b(() => I?.headshotmarketingLeads.items ?? [], [I?.headshotmarketingLeads.items]), Z = b(() => {
|
|
81
81
|
let e = new Map(X.map((e) => [e.id, e]));
|
|
82
82
|
return X.map((e) => ee(e, Y)).map((t) => {
|
|
83
83
|
let n = e.get(t.id), r = n?.contactId ? Y[n.contactId] : void 0;
|
|
@@ -87,29 +87,29 @@ var M = [
|
|
|
87
87
|
contactAvatar: r?.avatar ?? ""
|
|
88
88
|
};
|
|
89
89
|
});
|
|
90
|
-
}, [X, Y]), Q = X.length,
|
|
90
|
+
}, [X, Y]), Q = X.length, ge = b(() => {
|
|
91
91
|
if (Q === 0) return 0;
|
|
92
92
|
let e = X.reduce((e, t) => e + (t.score ?? 0), 0);
|
|
93
93
|
return Math.round(e / Q);
|
|
94
|
-
}, [X, Q]),
|
|
94
|
+
}, [X, Q]), _e = b(() => X.filter((e) => (e.score ?? 0) >= 80).length, [X]), ve = b(() => {
|
|
95
95
|
if (Q === 0) return 0;
|
|
96
|
-
let e = X.filter((e) => e.status ===
|
|
96
|
+
let e = X.filter((e) => e.status === d.Converted || e.status === d.Qualified).length;
|
|
97
97
|
return Math.round(e / Q * 100);
|
|
98
|
-
}, [X, Q]),
|
|
99
|
-
let t = !
|
|
98
|
+
}, [X, Q]), ye = b(() => oe(X.map((e) => e.score ?? 0)), [X]), $ = Z.filter((e) => {
|
|
99
|
+
let t = !H || `${e.firstName} ${e.lastName} ${e.email} ${e.company} ${e.title}`.toLowerCase().includes(H.toLowerCase()), n = W === "all" || e.status === W, r = G === "all" || e.source === G;
|
|
100
100
|
return t && n && r;
|
|
101
|
-
}),
|
|
101
|
+
}), be = (e) => {
|
|
102
102
|
if (!e || e === "Unassigned") return /* @__PURE__ */ O("span", {
|
|
103
103
|
className: "text-sm text-text-secondary",
|
|
104
104
|
children: "Unassigned"
|
|
105
105
|
});
|
|
106
|
-
if (
|
|
107
|
-
let e =
|
|
106
|
+
if (B && e === B.id) {
|
|
107
|
+
let e = B.name || [B.firstName, B.lastName].filter(Boolean).join(" ") || B.email;
|
|
108
108
|
return /* @__PURE__ */ k("div", {
|
|
109
109
|
className: "flex items-center gap-2",
|
|
110
110
|
children: [/* @__PURE__ */ O(y, {
|
|
111
111
|
name: e,
|
|
112
|
-
src:
|
|
112
|
+
src: B.avatar,
|
|
113
113
|
size: 28
|
|
114
114
|
}), /* @__PURE__ */ O("span", {
|
|
115
115
|
className: "text-sm font-medium text-text-primary",
|
|
@@ -143,35 +143,35 @@ var M = [
|
|
|
143
143
|
})]
|
|
144
144
|
}),
|
|
145
145
|
children: [
|
|
146
|
-
/* @__PURE__ */ O(
|
|
147
|
-
open:
|
|
146
|
+
/* @__PURE__ */ O(g, {
|
|
147
|
+
open: fe,
|
|
148
148
|
onClose: () => K(!1),
|
|
149
149
|
contacts: Object.values(Y),
|
|
150
|
-
onCreated:
|
|
150
|
+
onCreated: z
|
|
151
151
|
}),
|
|
152
152
|
/* @__PURE__ */ O(ce, {
|
|
153
|
-
lead:
|
|
153
|
+
lead: pe,
|
|
154
154
|
onClose: () => q(null),
|
|
155
|
-
onApplied:
|
|
155
|
+
onApplied: z
|
|
156
156
|
}),
|
|
157
157
|
/* @__PURE__ */ O(se, {
|
|
158
|
-
open:
|
|
158
|
+
open: me,
|
|
159
159
|
totalAvailable: Q,
|
|
160
160
|
onClose: () => J(!1),
|
|
161
|
-
onCompleted:
|
|
161
|
+
onCompleted: z
|
|
162
162
|
}),
|
|
163
163
|
/* @__PURE__ */ O(j, { children: "Track every prospect from first touch to qualified. See where each lead sits — new, contacted, qualified or disqualified — sort by lead score, and focus your follow-ups on the people most likely to convert." }),
|
|
164
|
-
/* @__PURE__ */ O(
|
|
164
|
+
/* @__PURE__ */ O(m, {
|
|
165
165
|
active: "leads",
|
|
166
|
-
basePath:
|
|
166
|
+
basePath: V,
|
|
167
167
|
navigate: le
|
|
168
168
|
}),
|
|
169
169
|
/* @__PURE__ */ O(ne, { kind: "lead" }),
|
|
170
|
-
/* @__PURE__ */ k(
|
|
171
|
-
loading:
|
|
172
|
-
error:
|
|
173
|
-
onRetry:
|
|
174
|
-
hasData: !!
|
|
170
|
+
/* @__PURE__ */ k(u, {
|
|
171
|
+
loading: L,
|
|
172
|
+
error: R,
|
|
173
|
+
onRetry: z,
|
|
174
|
+
hasData: !!I,
|
|
175
175
|
children: [
|
|
176
176
|
/* @__PURE__ */ k("div", {
|
|
177
177
|
className: "grid grid-cols-1 gap-4 xl:grid-cols-3",
|
|
@@ -188,38 +188,38 @@ var M = [
|
|
|
188
188
|
}),
|
|
189
189
|
/* @__PURE__ */ O(a, {
|
|
190
190
|
title: "Avg Lead Score",
|
|
191
|
-
value:
|
|
191
|
+
value: ge,
|
|
192
192
|
icon: /* @__PURE__ */ O(C, { className: "h-5 w-5" })
|
|
193
193
|
}),
|
|
194
194
|
/* @__PURE__ */ O(a, {
|
|
195
195
|
title: "Conversion Rate",
|
|
196
|
-
value: `${
|
|
196
|
+
value: `${ve}%`,
|
|
197
197
|
icon: /* @__PURE__ */ O(E, { className: "h-5 w-5" })
|
|
198
198
|
}),
|
|
199
199
|
/* @__PURE__ */ O(a, {
|
|
200
200
|
title: "Hot Leads",
|
|
201
|
-
value:
|
|
201
|
+
value: _e,
|
|
202
202
|
icon: /* @__PURE__ */ O(S, { className: "h-5 w-5" })
|
|
203
203
|
})
|
|
204
204
|
]
|
|
205
205
|
}) })
|
|
206
|
-
}), /* @__PURE__ */ O(
|
|
206
|
+
}), /* @__PURE__ */ O(c, {
|
|
207
207
|
title: "Score distribution",
|
|
208
208
|
subtitle: "Leads by score tier",
|
|
209
209
|
className: "xl:col-span-1",
|
|
210
|
-
children: /* @__PURE__ */ O(ie, { data:
|
|
210
|
+
children: /* @__PURE__ */ O(ie, { data: ye })
|
|
211
211
|
})]
|
|
212
212
|
}),
|
|
213
|
-
/* @__PURE__ */ O(
|
|
214
|
-
searchValue:
|
|
215
|
-
onSearchChange:
|
|
213
|
+
/* @__PURE__ */ O(l, {
|
|
214
|
+
searchValue: H,
|
|
215
|
+
onSearchChange: U,
|
|
216
216
|
searchPlaceholder: "Search leads...",
|
|
217
217
|
filters: /* @__PURE__ */ k("div", {
|
|
218
218
|
className: "flex flex-nowrap items-center gap-2 overflow-x-auto",
|
|
219
|
-
children: [/* @__PURE__ */ k(
|
|
220
|
-
value:
|
|
221
|
-
onChange: (e) =>
|
|
222
|
-
className:
|
|
219
|
+
children: [/* @__PURE__ */ k(M, {
|
|
220
|
+
value: W,
|
|
221
|
+
onChange: (e) => ue(e.target.value),
|
|
222
|
+
className: P,
|
|
223
223
|
"aria-label": "Filter by status",
|
|
224
224
|
children: [
|
|
225
225
|
/* @__PURE__ */ O("option", {
|
|
@@ -243,19 +243,19 @@ var M = [
|
|
|
243
243
|
children: "Disqualified"
|
|
244
244
|
})
|
|
245
245
|
]
|
|
246
|
-
}), /* @__PURE__ */ O(
|
|
246
|
+
}), /* @__PURE__ */ O(M, {
|
|
247
247
|
value: G,
|
|
248
|
-
onChange: (e) =>
|
|
249
|
-
className:
|
|
248
|
+
onChange: (e) => de(e.target.value),
|
|
249
|
+
className: P,
|
|
250
250
|
"aria-label": "Filter by source",
|
|
251
|
-
children:
|
|
251
|
+
children: N.map((e) => /* @__PURE__ */ O("option", {
|
|
252
252
|
value: e.value,
|
|
253
253
|
children: e.label
|
|
254
254
|
}, e.value))
|
|
255
255
|
})]
|
|
256
256
|
})
|
|
257
257
|
}),
|
|
258
|
-
$.length === 0 ? /* @__PURE__ */ O(
|
|
258
|
+
$.length === 0 ? /* @__PURE__ */ O(te, {
|
|
259
259
|
illustration: Z.length === 0 ? "empty-people" : "empty-search",
|
|
260
260
|
title: Z.length === 0 ? "No leads yet" : "No leads match your filters",
|
|
261
261
|
description: Z.length === 0 ? "Leads will appear here as they come in from your campaigns and forms." : "Try a different search term, status or source."
|
|
@@ -277,8 +277,8 @@ var M = [
|
|
|
277
277
|
className: "min-w-0",
|
|
278
278
|
children: [/* @__PURE__ */ O("button", {
|
|
279
279
|
type: "button",
|
|
280
|
-
onClick: () =>
|
|
281
|
-
className: "truncate font-medium text-text-primary hover:underline text-
|
|
280
|
+
onClick: () => F(e.id),
|
|
281
|
+
className: "truncate font-medium text-text-primary hover:underline text-start",
|
|
282
282
|
children: t
|
|
283
283
|
}), /* @__PURE__ */ O("p", {
|
|
284
284
|
className: "truncate text-xs text-text-secondary",
|
|
@@ -339,7 +339,7 @@ var M = [
|
|
|
339
339
|
{
|
|
340
340
|
key: "assignedTo",
|
|
341
341
|
header: "Owner",
|
|
342
|
-
render: (e) =>
|
|
342
|
+
render: (e) => be(e.assignedTo)
|
|
343
343
|
},
|
|
344
344
|
{
|
|
345
345
|
key: "createdAt",
|
|
@@ -375,12 +375,12 @@ var M = [
|
|
|
375
375
|
id: e.id,
|
|
376
376
|
title: e.title
|
|
377
377
|
},
|
|
378
|
-
target:
|
|
379
|
-
onConverted:
|
|
378
|
+
target: he,
|
|
379
|
+
onConverted: z
|
|
380
380
|
}),
|
|
381
|
-
/* @__PURE__ */ O(
|
|
381
|
+
/* @__PURE__ */ O(h, {
|
|
382
382
|
lead: e,
|
|
383
|
-
onChanged:
|
|
383
|
+
onChanged: z
|
|
384
384
|
})
|
|
385
385
|
]
|
|
386
386
|
});
|
|
@@ -394,6 +394,6 @@ var M = [
|
|
|
394
394
|
]
|
|
395
395
|
});
|
|
396
396
|
};
|
|
397
|
-
export {
|
|
397
|
+
export { F as LeadsPage };
|
|
398
398
|
|
|
399
399
|
//# sourceMappingURL=LeadsPage.js.map
|