@burdenoff/microfe-headshotmarketing 2026.801.2 → 2026.827.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/generated/wspace-operations.d.ts +44 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +30 -4
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/headshotmarketing/components/InfluencerModals.d.ts.map +1 -1
- package/dist/headshotmarketing/components/InfluencerModals.js +201 -214
- package/dist/headshotmarketing/components/InfluencerModals.js.map +1 -1
- package/dist/headshotmarketing/components/StatusBadge.d.ts.map +1 -1
- package/dist/headshotmarketing/components/StatusBadge.js +2 -0
- package/dist/headshotmarketing/components/StatusBadge.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdCreativesPage.js +59 -29
- package/dist/headshotmarketing/pages/ads/AdCreativesPage.js.map +1 -1
- package/dist/headshotmarketing/pages/analytics/AnalyticsPage.d.ts.map +1 -1
- package/dist/headshotmarketing/pages/analytics/AnalyticsPage.js +389 -215
- package/dist/headshotmarketing/pages/analytics/AnalyticsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/content/AIExecutionLedger.d.ts +26 -0
- package/dist/headshotmarketing/pages/content/AIExecutionLedger.d.ts.map +1 -0
- package/dist/headshotmarketing/pages/content/AIExecutionLedger.js +215 -0
- package/dist/headshotmarketing/pages/content/AIExecutionLedger.js.map +1 -0
- package/dist/headshotmarketing/pages/content/AIToolsPage.d.ts.map +1 -1
- package/dist/headshotmarketing/pages/content/AIToolsPage.js +396 -379
- package/dist/headshotmarketing/pages/content/AIToolsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/content/AssetLibraryPage.d.ts.map +1 -1
- package/dist/headshotmarketing/pages/content/AssetLibraryPage.js +436 -343
- package/dist/headshotmarketing/pages/content/AssetLibraryPage.js.map +1 -1
- package/dist/headshotmarketing/pages/content/ContentAnalyticsPage.d.ts.map +1 -1
- package/dist/headshotmarketing/pages/content/ContentAnalyticsPage.js +233 -223
- package/dist/headshotmarketing/pages/content/ContentAnalyticsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/content/ContentPage.js +4 -4
- package/dist/headshotmarketing/pages/crm/ContactsPage.d.ts.map +1 -1
- package/dist/headshotmarketing/pages/crm/ContactsPage.js +339 -278
- package/dist/headshotmarketing/pages/crm/ContactsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/CrmPage.d.ts.map +1 -1
- package/dist/headshotmarketing/pages/crm/CrmPage.js +118 -112
- package/dist/headshotmarketing/pages/crm/CrmPage.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/CrmSubNav.d.ts +14 -0
- package/dist/headshotmarketing/pages/crm/CrmSubNav.d.ts.map +1 -0
- package/dist/headshotmarketing/pages/crm/CrmSubNav.js +51 -0
- package/dist/headshotmarketing/pages/crm/CrmSubNav.js.map +1 -0
- package/dist/headshotmarketing/pages/crm/LeadsPage.d.ts.map +1 -1
- package/dist/headshotmarketing/pages/crm/LeadsPage.js +122 -116
- package/dist/headshotmarketing/pages/crm/LeadsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/PipelinePage.d.ts.map +1 -1
- package/dist/headshotmarketing/pages/crm/PipelinePage.js +192 -183
- package/dist/headshotmarketing/pages/crm/PipelinePage.js.map +1 -1
- package/dist/headshotmarketing/pages/influencers/InfluencerDiscoveryPage.d.ts.map +1 -1
- package/dist/headshotmarketing/pages/influencers/InfluencerDiscoveryPage.js +184 -162
- package/dist/headshotmarketing/pages/influencers/InfluencerDiscoveryPage.js.map +1 -1
- package/dist/headshotmarketing/pages/influencers/InfluencersPage.d.ts.map +1 -1
- package/dist/headshotmarketing/pages/influencers/InfluencersPage.js +8 -14
- package/dist/headshotmarketing/pages/influencers/InfluencersPage.js.map +1 -1
- package/dist/headshotmarketing/types/index.d.ts +9 -4
- package/dist/headshotmarketing/types/index.d.ts.map +1 -1
- package/dist/headshotmarketing/utils/contentMapper.js +1 -1
- package/dist/headshotmarketing/utils/contentMapper.js.map +1 -1
- package/dist/headshotmarketing/utils/influencerMapper.d.ts +16 -2
- package/dist/headshotmarketing/utils/influencerMapper.d.ts.map +1 -1
- package/dist/headshotmarketing/utils/influencerMapper.js +56 -40
- package/dist/headshotmarketing/utils/influencerMapper.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LeadsPage.js","names":[],"sources":["../../../../src/headshotmarketing/pages/crm/LeadsPage.tsx"],"sourcesContent":["/**\n * Leads Page\n * @module headshotmarketing/pages/crm\n */\n\nimport { useMemo, useState, type FC } from \"react\";\nimport { Users, Gauge, TrendingUp, Flame, Plus } from \"lucide-react\";\nimport {\n PageLayout,\n StatCard,\n DataTable,\n StatusBadge,\n FilterBar,\n EmptyState,\n ChartCard,\n QueryStateBoundary,\n type Column,\n} from \"../../components\";\nimport { EmphasisPanel, PagePurpose } from \"@burdenoff/fe-libs/ui\";\nimport { cn, formatCurrency, formatDate } from \"../../utils/helpers\";\nimport { toContactModel, toLeadModel } from \"../../utils/crmMapper\";\nimport { HeadshotmarketingLeadStatus } from \"../../../generated/wspace-types\";\nimport type { HeadshotmarketingBootstrapDataQuery } from \"../../../generated/wspace-operations\";\nimport { useHeadshotmarketingBootstrap } from \"../../hooks/useHeadshotmarketingBootstrap\";\nimport { useHeadshotMarketing } from \"../../context/HeadshotMarketingContext\";\nimport type { Contact, Lead } from \"../../types\";\nimport { LeadActionsMenu } from \"./CrmActions\";\nimport { LeadCreateModal } from \"./LeadCreateModal\";\nimport { ConvertLeadButton, type ConvertTarget } from \"./ConvertLeadButton\";\nimport {\n LeadAvatar,\n LeadScoreHistogram,\n LeadSourceCell,\n bucketScores,\n} from \"./LeadsWidgets\";\n\n/** A mapped lead plus the extra display fields sourced from the raw bootstrap row. */\ninterface LeadRow extends Lead {\n estimatedValue: number | null;\n contactAvatar: string;\n}\n\nconst SOURCE_FILTER_OPTIONS: { value: string; label: string }[] = [\n { value: \"all\", label: \"All Sources\" },\n { value: \"website\", label: \"Website\" },\n { value: \"social_media\", label: \"Social media\" },\n { value: \"ad_campaign\", label: \"Ads\" },\n { value: \"email\", label: \"Email\" },\n { value: \"referral\", label: \"Referral\" },\n { value: \"event\", label: \"Event\" },\n { value: \"cold_outreach\", label: \"Cold outreach\" },\n { value: \"other\", label: \"Other\" },\n];\n\nconst selectClass =\n \"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)]\";\n\nexport const LeadsPage: FC = () => {\n const { data, loading, error, refetch } = useHeadshotmarketingBootstrap();\n const { currentUser } = useHeadshotMarketing();\n const [search, setSearch] = useState(\"\");\n const [statusFilter, setStatusFilter] = useState(\"all\");\n const [sourceFilter, setSourceFilter] = useState(\"all\");\n const [newLeadOpen, setNewLeadOpen] = useState(false);\n\n // The pipeline + stage a converted lead lands in: prefer the workspace's\n // default pipeline, else the first one, and that pipeline's lowest-order\n // stage. Null when the workspace has no pipeline yet — the row action then\n // renders disabled instead of firing an invalid conversion.\n const convertTarget = useMemo<ConvertTarget | null>(() => {\n const pipelines: HeadshotmarketingBootstrapDataQuery[\"headshotmarketingPipelines\"][\"items\"] =\n data?.headshotmarketingPipelines.items ?? [];\n if (pipelines.length === 0) return null;\n const pipeline = pipelines.find((p) => p.isDefault) ?? pipelines[0];\n const firstStage = [...pipeline.stages].sort(\n (a, b) => a.order - b.order,\n )[0];\n if (!firstStage) return null;\n return {\n pipelineId: pipeline.id,\n pipelineName: pipeline.name,\n stageId: firstStage.id,\n stageName: firstStage.name,\n };\n }, [data?.headshotmarketingPipelines.items]);\n\n const contactById = useMemo<Record<string, Contact>>(() => {\n const items = data?.headshotmarketingContacts.items ?? [];\n const contacts = items.map((item: Parameters<typeof toContactModel>[0]) =>\n toContactModel(item),\n );\n return Object.fromEntries(\n contacts.map((contact: Contact) => [contact.id, contact]),\n );\n }, [data?.headshotmarketingContacts.items]);\n\n // Raw bootstrap rows retain fields the shared Lead mapper drops\n // (estimatedValue, precise status enum, contactId) — read them here so the\n // page can enrich its view without touching the shared mapper.\n const rawLeads = useMemo<\n (Parameters<typeof toLeadModel>[0] & { estimatedValue?: number | null })[]\n >(\n () => data?.headshotmarketingLeads.items ?? [],\n [data?.headshotmarketingLeads.items],\n );\n\n const rows = useMemo<LeadRow[]>(() => {\n const rawById = new Map(rawLeads.map((l) => [l.id, l] as const));\n const leads = rawLeads.map((item: Parameters<typeof toLeadModel>[0]) =>\n toLeadModel(item, contactById),\n );\n return leads.map((lead) => {\n const raw = rawById.get(lead.id);\n const contact = raw?.contactId ? contactById[raw.contactId] : undefined;\n return {\n ...lead,\n estimatedValue: raw?.estimatedValue ?? null,\n contactAvatar: contact?.avatar ?? \"\",\n };\n });\n }, [rawLeads, contactById]);\n\n // ---- KPIs (computed from the precise raw enum, not the lossy model) --------\n const totalLeads = rawLeads.length;\n const avgScore = useMemo(() => {\n if (totalLeads === 0) return 0;\n const sum = rawLeads.reduce((acc, l) => acc + (l.score ?? 0), 0);\n return Math.round(sum / totalLeads);\n }, [rawLeads, totalLeads]);\n const hotLeads = useMemo(\n () => rawLeads.filter((l) => (l.score ?? 0) >= 80).length,\n [rawLeads],\n );\n const conversionRate = useMemo(() => {\n if (totalLeads === 0) return 0;\n const won = rawLeads.filter(\n (l) =>\n l.status === HeadshotmarketingLeadStatus.Converted ||\n l.status === HeadshotmarketingLeadStatus.Qualified,\n ).length;\n return Math.round((won / totalLeads) * 100);\n }, [rawLeads, totalLeads]);\n const scoreBuckets = useMemo(\n () => bucketScores(rawLeads.map((l) => l.score ?? 0)),\n [rawLeads],\n );\n\n const filtered = rows.filter((l) => {\n const matchesSearch =\n !search ||\n `${l.firstName} ${l.lastName} ${l.email} ${l.company} ${l.title}`\n .toLowerCase()\n .includes(search.toLowerCase());\n const matchesStatus = statusFilter === \"all\" || l.status === statusFilter;\n const matchesSource = sourceFilter === \"all\" || l.source === sourceFilter;\n return matchesSearch && matchesStatus && matchesSource;\n });\n\n const renderOwner = (assignedTo: string) => {\n if (!assignedTo || assignedTo === \"Unassigned\") {\n return <span className=\"text-sm text-text-secondary\">Unassigned</span>;\n }\n if (currentUser && assignedTo === currentUser.id) {\n const name =\n currentUser.name ||\n [currentUser.firstName, currentUser.lastName]\n .filter(Boolean)\n .join(\" \") ||\n currentUser.email;\n return (\n <div className=\"flex items-center gap-2\">\n <LeadAvatar name={name} src={currentUser.avatar} size={28} />\n <span className=\"text-sm font-medium text-text-primary\">You</span>\n </div>\n );\n }\n return (\n <div className=\"flex items-center gap-2\">\n <LeadAvatar size={28} />\n <span className=\"text-sm text-text-secondary\">Assigned</span>\n </div>\n );\n };\n\n const leadColumns: Column<LeadRow>[] = [\n {\n key: \"name\",\n header: \"Lead\",\n sortable: true,\n render: (row) => {\n const fullName = `${row.firstName} ${row.lastName}`.trim() || row.title;\n return (\n <div className=\"flex min-w-[180px] items-center gap-3\">\n <LeadAvatar name={fullName} src={row.contactAvatar || undefined} />\n <div className=\"min-w-0\">\n <p className=\"truncate font-medium text-text-primary\">\n {fullName}\n </p>\n <p className=\"truncate text-xs text-text-secondary\">\n {row.email || row.title}\n </p>\n </div>\n </div>\n );\n },\n },\n {\n key: \"company\",\n header: \"Company\",\n sortable: true,\n render: (row) => (\n <span className=\"text-sm text-text-primary\">{row.company || \"—\"}</span>\n ),\n },\n {\n key: \"source\",\n header: \"Source\",\n sortable: true,\n render: (row) => <LeadSourceCell source={row.source} />,\n },\n {\n key: \"score\",\n header: \"Lead Score\",\n sortable: true,\n render: (row) => (\n <div className=\"flex items-center gap-2\">\n <div className=\"h-2 w-16 overflow-hidden rounded-full bg-bg-sunken\">\n <div\n className={cn(\n \"h-full rounded-full transition-all\",\n row.score >= 80\n ? \"bg-status-success-text\"\n : row.score >= 50\n ? \"bg-status-warning-text\"\n : \"bg-status-error-text\",\n )}\n style={{ width: `${Math.max(0, Math.min(100, row.score))}%` }}\n />\n </div>\n <span className=\"text-xs font-medium tabular-nums text-text-primary\">\n {row.score}\n </span>\n </div>\n ),\n },\n {\n key: \"status\",\n header: \"Status\",\n render: (row) => <StatusBadge status={row.status} />,\n },\n {\n key: \"estimatedValue\",\n header: \"Est. Value\",\n sortable: true,\n className: \"text-right\",\n render: (row) => (\n <span className=\"text-sm font-medium tabular-nums text-text-primary\">\n {row.estimatedValue && row.estimatedValue > 0\n ? formatCurrency(row.estimatedValue)\n : \"—\"}\n </span>\n ),\n },\n {\n key: \"assignedTo\",\n header: \"Owner\",\n render: (row) => renderOwner(row.assignedTo),\n },\n {\n key: \"createdAt\",\n header: \"Created\",\n sortable: true,\n render: (row) => (\n <span className=\"whitespace-nowrap text-sm text-text-secondary\">\n {formatDate(row.createdAt)}\n </span>\n ),\n },\n {\n key: \"actions\",\n header: \"\",\n className: \"w-24 text-right\",\n render: (row) => (\n <div className=\"flex items-center justify-end gap-1\">\n <ConvertLeadButton\n lead={{ id: row.id, title: row.title }}\n target={convertTarget}\n onConverted={refetch}\n />\n <LeadActionsMenu lead={row} onChanged={refetch} />\n </div>\n ),\n },\n ];\n\n return (\n <PageLayout\n title=\"Leads\"\n description=\"Track and manage your leads pipeline\"\n actions={\n <button\n type=\"button\"\n onClick={() => setNewLeadOpen(true)}\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 shadow-pop hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" />\n New Lead\n </button>\n }\n >\n <LeadCreateModal\n open={newLeadOpen}\n onClose={() => setNewLeadOpen(false)}\n contacts={Object.values(contactById)}\n onCreated={refetch}\n />\n\n <PagePurpose>\n Track every prospect from first touch to qualified. See where each lead\n sits — new, contacted, qualified or disqualified — sort by lead score,\n and focus your follow-ups on the people most likely to convert.\n </PagePurpose>\n\n <QueryStateBoundary\n loading={loading}\n error={error}\n onRetry={refetch}\n hasData={Boolean(data)}\n >\n {/* Stats + score distribution — primary emphasis zone */}\n <div className=\"grid grid-cols-1 gap-4 xl:grid-cols-3\">\n <div className=\"xl:col-span-2\">\n <EmphasisPanel>\n <div className=\"grid grid-cols-2 gap-4\">\n <StatCard\n title=\"Total Leads\"\n value={totalLeads}\n icon={<Users className=\"h-5 w-5\" />}\n featured\n />\n <StatCard\n title=\"Avg Lead Score\"\n value={avgScore}\n icon={<Gauge className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Conversion Rate\"\n value={`${conversionRate}%`}\n icon={<TrendingUp className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Hot Leads\"\n value={hotLeads}\n icon={<Flame className=\"h-5 w-5\" />}\n />\n </div>\n </EmphasisPanel>\n </div>\n\n <ChartCard\n title=\"Score distribution\"\n subtitle=\"Leads by score tier\"\n className=\"xl:col-span-1\"\n >\n <LeadScoreHistogram data={scoreBuckets} />\n </ChartCard>\n </div>\n\n {/* Filter */}\n <FilterBar\n searchValue={search}\n onSearchChange={setSearch}\n searchPlaceholder=\"Search leads...\"\n filters={\n <div className=\"flex flex-nowrap items-center gap-2 overflow-x-auto\">\n <select\n value={statusFilter}\n onChange={(e) => setStatusFilter(e.target.value)}\n className={selectClass}\n aria-label=\"Filter by status\"\n >\n <option value=\"all\">All Statuses</option>\n <option value=\"new\">New</option>\n <option value=\"contacted\">Contacted</option>\n <option value=\"qualified\">Qualified</option>\n <option value=\"disqualified\">Disqualified</option>\n </select>\n <select\n value={sourceFilter}\n onChange={(e) => setSourceFilter(e.target.value)}\n className={selectClass}\n aria-label=\"Filter by source\"\n >\n {SOURCE_FILTER_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n </div>\n }\n />\n\n {/* Leads Table */}\n {filtered.length === 0 ? (\n <EmptyState\n illustration={rows.length === 0 ? \"empty-people\" : \"empty-search\"}\n title={\n rows.length === 0 ? \"No leads yet\" : \"No leads match your filters\"\n }\n description={\n rows.length === 0\n ? \"Leads will appear here as they come in from your campaigns and forms.\"\n : \"Try a different search term, status or source.\"\n }\n />\n ) : (\n <DataTable data={filtered} columns={leadColumns} pageSize={10} />\n )}\n </QueryStateBoundary>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAM,IAA4D;CAChE;EAAE,OAAO;EAAO,OAAO;EAAe;CACtC;EAAE,OAAO;EAAW,OAAO;EAAW;CACtC;EAAE,OAAO;EAAgB,OAAO;EAAgB;CAChD;EAAE,OAAO;EAAe,OAAO;EAAO;CACtC;EAAE,OAAO;EAAS,OAAO;EAAS;CAClC;EAAE,OAAO;EAAY,OAAO;EAAY;CACxC;EAAE,OAAO;EAAS,OAAO;EAAS;CAClC;EAAE,OAAO;EAAiB,OAAO;EAAiB;CAClD;EAAE,OAAO;EAAS,OAAO;EAAS;CACnC,EAEK,IACJ,uLAEW,UAAsB;CACjC,IAAM,EAAE,SAAM,YAAS,UAAO,eAAY,GAA+B,EACnE,EAAE,mBAAgB,GAAsB,EACxC,CAAC,GAAQ,KAAa,EAAS,GAAG,EAClC,CAAC,GAAc,KAAmB,EAAS,MAAM,EACjD,CAAC,GAAc,KAAmB,EAAS,MAAM,EACjD,CAAC,GAAa,KAAkB,EAAS,GAAM,EAM/C,IAAgB,QAAoC;EACxD,IAAM,IACJ,GAAM,2BAA2B,SAAS,EAAE;AAC9C,MAAI,EAAU,WAAW,EAAG,QAAO;EACnC,IAAM,IAAW,EAAU,MAAM,MAAM,EAAE,UAAU,IAAI,EAAU,IAC3D,IAAa,CAAC,GAAG,EAAS,OAAO,CAAC,MACrC,GAAG,MAAM,EAAE,QAAQ,EAAE,MACvB,CAAC;AAEF,SADK,IACE;GACL,YAAY,EAAS;GACrB,cAAc,EAAS;GACvB,SAAS,EAAW;GACpB,WAAW,EAAW;GACvB,GANuB;IAOvB,CAAC,GAAM,2BAA2B,MAAM,CAAC,EAEtC,IAAc,QAAuC;EAEzD,IAAM,KADQ,GAAM,0BAA0B,SAAS,EAAE,EAClC,KAAK,MAC1B,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AAK,IAAI,KAAK,EAAI,MAAM,CAAC,CAAC,IAAI;WAC7D,CAAA;UACE,CAAA,EACN,kBAAC,QAAD;UAAM,WAAU;oBACb,EAAI;UACA,CAAA,CACH;;QAET;OACD;QACE,KAAK;QACL,QAAQ;QACR,SAAS,MAAQ,kBAAC,IAAD,EAAa,QAAQ,EAAI,QAAU,CAAA;QACrD;OACD;QACE,KAAK;QACL,QAAQ;QACR,UAAU;QACV,WAAW;QACX,SAAS,MACP,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAI,kBAAkB,EAAI,iBAAiB,IACxC,EAAe,EAAI,eAAe,GAClC;SACC,CAAA;QAEV;OACD;QACE,KAAK;QACL,QAAQ;QACR,SAAS,MAAQ,GAAY,EAAI,WAAW;QAC7C;OACD;QACE,KAAK;QACL,QAAQ;QACR,UAAU;QACV,SAAS,MACP,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAW,EAAI,UAAU;SACrB,CAAA;QAEV;OACD;QACE,KAAK;QACL,QAAQ;QACR,WAAW;QACX,SAAS,MACP,kBAAC,OAAD;SAAK,WAAU;mBAAf,CACE,kBAAC,GAAD;UACE,MAAM;WAAE,IAAI,EAAI;WAAI,OAAO,EAAI;WAAO;UACtC,QAAQ;UACR,aAAa;UACb,CAAA,EACF,kBAAC,GAAD;UAAiB,MAAM;UAAK,WAAW;UAAW,CAAA,CAC9C;;QAET;OACF;MA4HwD,UAAU;MAAM,CAAA;KAEhD;;GACV"}
|
|
1
|
+
{"version":3,"file":"LeadsPage.js","names":[],"sources":["../../../../src/headshotmarketing/pages/crm/LeadsPage.tsx"],"sourcesContent":["/**\n * Leads Page\n * @module headshotmarketing/pages/crm\n */\n\nimport { useMemo, useState, type FC } from \"react\";\nimport { Users, Gauge, TrendingUp, Flame, Plus } from \"lucide-react\";\nimport {\n PageLayout,\n StatCard,\n DataTable,\n StatusBadge,\n FilterBar,\n EmptyState,\n ChartCard,\n QueryStateBoundary,\n type Column,\n} from \"../../components\";\nimport { EmphasisPanel, PagePurpose } from \"@burdenoff/fe-libs/ui\";\nimport { cn, formatCurrency, formatDate } from \"../../utils/helpers\";\nimport { toContactModel, toLeadModel } from \"../../utils/crmMapper\";\nimport { HeadshotmarketingLeadStatus } from \"../../../generated/wspace-types\";\nimport type { HeadshotmarketingBootstrapDataQuery } from \"../../../generated/wspace-operations\";\nimport { useHeadshotmarketingBootstrap } from \"../../hooks/useHeadshotmarketingBootstrap\";\nimport { useHeadshotMarketing } from \"../../context/HeadshotMarketingContext\";\nimport { CrmSubNav } from \"./CrmSubNav\";\nimport type { Contact, Lead } from \"../../types\";\nimport { LeadActionsMenu } from \"./CrmActions\";\nimport { LeadCreateModal } from \"./LeadCreateModal\";\nimport { ConvertLeadButton, type ConvertTarget } from \"./ConvertLeadButton\";\nimport {\n LeadAvatar,\n LeadScoreHistogram,\n LeadSourceCell,\n bucketScores,\n} from \"./LeadsWidgets\";\n\n/** A mapped lead plus the extra display fields sourced from the raw bootstrap row. */\ninterface LeadRow extends Lead {\n estimatedValue: number | null;\n contactAvatar: string;\n}\n\nconst SOURCE_FILTER_OPTIONS: { value: string; label: string }[] = [\n { value: \"all\", label: \"All Sources\" },\n { value: \"website\", label: \"Website\" },\n { value: \"social_media\", label: \"Social media\" },\n { value: \"ad_campaign\", label: \"Ads\" },\n { value: \"email\", label: \"Email\" },\n { value: \"referral\", label: \"Referral\" },\n { value: \"event\", label: \"Event\" },\n { value: \"cold_outreach\", label: \"Cold outreach\" },\n { value: \"other\", label: \"Other\" },\n];\n\nconst selectClass =\n \"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)]\";\n\nexport const LeadsPage: FC = () => {\n const { data, loading, error, refetch } = useHeadshotmarketingBootstrap();\n const { currentUser, navigate, basePath } = useHeadshotMarketing();\n const [search, setSearch] = useState(\"\");\n const [statusFilter, setStatusFilter] = useState(\"all\");\n const [sourceFilter, setSourceFilter] = useState(\"all\");\n const [newLeadOpen, setNewLeadOpen] = useState(false);\n\n // The pipeline + stage a converted lead lands in: prefer the workspace's\n // default pipeline, else the first one, and that pipeline's lowest-order\n // stage. Null when the workspace has no pipeline yet — the row action then\n // renders disabled instead of firing an invalid conversion.\n const convertTarget = useMemo<ConvertTarget | null>(() => {\n const pipelines: HeadshotmarketingBootstrapDataQuery[\"headshotmarketingPipelines\"][\"items\"] =\n data?.headshotmarketingPipelines.items ?? [];\n if (pipelines.length === 0) return null;\n const pipeline = pipelines.find((p) => p.isDefault) ?? pipelines[0];\n const firstStage = [...pipeline.stages].sort(\n (a, b) => a.order - b.order,\n )[0];\n if (!firstStage) return null;\n return {\n pipelineId: pipeline.id,\n pipelineName: pipeline.name,\n stageId: firstStage.id,\n stageName: firstStage.name,\n };\n }, [data?.headshotmarketingPipelines.items]);\n\n const contactById = useMemo<Record<string, Contact>>(() => {\n const items = data?.headshotmarketingContacts.items ?? [];\n const contacts = items.map((item: Parameters<typeof toContactModel>[0]) =>\n toContactModel(item),\n );\n return Object.fromEntries(\n contacts.map((contact: Contact) => [contact.id, contact]),\n );\n }, [data?.headshotmarketingContacts.items]);\n\n // Raw bootstrap rows retain fields the shared Lead mapper drops\n // (estimatedValue, precise status enum, contactId) — read them here so the\n // page can enrich its view without touching the shared mapper.\n const rawLeads = useMemo<\n (Parameters<typeof toLeadModel>[0] & { estimatedValue?: number | null })[]\n >(\n () => data?.headshotmarketingLeads.items ?? [],\n [data?.headshotmarketingLeads.items],\n );\n\n const rows = useMemo<LeadRow[]>(() => {\n const rawById = new Map(rawLeads.map((l) => [l.id, l] as const));\n const leads = rawLeads.map((item: Parameters<typeof toLeadModel>[0]) =>\n toLeadModel(item, contactById),\n );\n return leads.map((lead) => {\n const raw = rawById.get(lead.id);\n const contact = raw?.contactId ? contactById[raw.contactId] : undefined;\n return {\n ...lead,\n estimatedValue: raw?.estimatedValue ?? null,\n contactAvatar: contact?.avatar ?? \"\",\n };\n });\n }, [rawLeads, contactById]);\n\n // ---- KPIs (computed from the precise raw enum, not the lossy model) --------\n const totalLeads = rawLeads.length;\n const avgScore = useMemo(() => {\n if (totalLeads === 0) return 0;\n const sum = rawLeads.reduce((acc, l) => acc + (l.score ?? 0), 0);\n return Math.round(sum / totalLeads);\n }, [rawLeads, totalLeads]);\n const hotLeads = useMemo(\n () => rawLeads.filter((l) => (l.score ?? 0) >= 80).length,\n [rawLeads],\n );\n const conversionRate = useMemo(() => {\n if (totalLeads === 0) return 0;\n const won = rawLeads.filter(\n (l) =>\n l.status === HeadshotmarketingLeadStatus.Converted ||\n l.status === HeadshotmarketingLeadStatus.Qualified,\n ).length;\n return Math.round((won / totalLeads) * 100);\n }, [rawLeads, totalLeads]);\n const scoreBuckets = useMemo(\n () => bucketScores(rawLeads.map((l) => l.score ?? 0)),\n [rawLeads],\n );\n\n const filtered = rows.filter((l) => {\n const matchesSearch =\n !search ||\n `${l.firstName} ${l.lastName} ${l.email} ${l.company} ${l.title}`\n .toLowerCase()\n .includes(search.toLowerCase());\n const matchesStatus = statusFilter === \"all\" || l.status === statusFilter;\n const matchesSource = sourceFilter === \"all\" || l.source === sourceFilter;\n return matchesSearch && matchesStatus && matchesSource;\n });\n\n const renderOwner = (assignedTo: string) => {\n if (!assignedTo || assignedTo === \"Unassigned\") {\n return <span className=\"text-sm text-text-secondary\">Unassigned</span>;\n }\n if (currentUser && assignedTo === currentUser.id) {\n const name =\n currentUser.name ||\n [currentUser.firstName, currentUser.lastName]\n .filter(Boolean)\n .join(\" \") ||\n currentUser.email;\n return (\n <div className=\"flex items-center gap-2\">\n <LeadAvatar name={name} src={currentUser.avatar} size={28} />\n <span className=\"text-sm font-medium text-text-primary\">You</span>\n </div>\n );\n }\n return (\n <div className=\"flex items-center gap-2\">\n <LeadAvatar size={28} />\n <span className=\"text-sm text-text-secondary\">Assigned</span>\n </div>\n );\n };\n\n const leadColumns: Column<LeadRow>[] = [\n {\n key: \"name\",\n header: \"Lead\",\n sortable: true,\n render: (row) => {\n const fullName = `${row.firstName} ${row.lastName}`.trim() || row.title;\n return (\n <div className=\"flex min-w-[180px] items-center gap-3\">\n <LeadAvatar name={fullName} src={row.contactAvatar || undefined} />\n <div className=\"min-w-0\">\n <p className=\"truncate font-medium text-text-primary\">\n {fullName}\n </p>\n <p className=\"truncate text-xs text-text-secondary\">\n {row.email || row.title}\n </p>\n </div>\n </div>\n );\n },\n },\n {\n key: \"company\",\n header: \"Company\",\n sortable: true,\n render: (row) => (\n <span className=\"text-sm text-text-primary\">{row.company || \"—\"}</span>\n ),\n },\n {\n key: \"source\",\n header: \"Source\",\n sortable: true,\n render: (row) => <LeadSourceCell source={row.source} />,\n },\n {\n key: \"score\",\n header: \"Lead Score\",\n sortable: true,\n render: (row) => (\n <div className=\"flex items-center gap-2\">\n <div className=\"h-2 w-16 overflow-hidden rounded-full bg-bg-sunken\">\n <div\n className={cn(\n \"h-full rounded-full transition-all\",\n row.score >= 80\n ? \"bg-status-success-text\"\n : row.score >= 50\n ? \"bg-status-warning-text\"\n : \"bg-status-error-text\",\n )}\n style={{ width: `${Math.max(0, Math.min(100, row.score))}%` }}\n />\n </div>\n <span className=\"text-xs font-medium tabular-nums text-text-primary\">\n {row.score}\n </span>\n </div>\n ),\n },\n {\n key: \"status\",\n header: \"Status\",\n render: (row) => <StatusBadge status={row.status} />,\n },\n {\n key: \"estimatedValue\",\n header: \"Est. Value\",\n sortable: true,\n className: \"text-right\",\n render: (row) => (\n <span className=\"text-sm font-medium tabular-nums text-text-primary\">\n {row.estimatedValue && row.estimatedValue > 0\n ? formatCurrency(row.estimatedValue)\n : \"—\"}\n </span>\n ),\n },\n {\n key: \"assignedTo\",\n header: \"Owner\",\n render: (row) => renderOwner(row.assignedTo),\n },\n {\n key: \"createdAt\",\n header: \"Created\",\n sortable: true,\n render: (row) => (\n <span className=\"whitespace-nowrap text-sm text-text-secondary\">\n {formatDate(row.createdAt)}\n </span>\n ),\n },\n {\n key: \"actions\",\n header: \"\",\n className: \"w-24 text-right\",\n render: (row) => (\n <div className=\"flex items-center justify-end gap-1\">\n <ConvertLeadButton\n lead={{ id: row.id, title: row.title }}\n target={convertTarget}\n onConverted={refetch}\n />\n <LeadActionsMenu lead={row} onChanged={refetch} />\n </div>\n ),\n },\n ];\n\n return (\n <PageLayout\n title=\"Leads\"\n description=\"Track and manage your leads pipeline\"\n actions={\n <button\n type=\"button\"\n onClick={() => setNewLeadOpen(true)}\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 shadow-pop hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" />\n New Lead\n </button>\n }\n >\n <LeadCreateModal\n open={newLeadOpen}\n onClose={() => setNewLeadOpen(false)}\n contacts={Object.values(contactById)}\n onCreated={refetch}\n />\n\n <PagePurpose>\n Track every prospect from first touch to qualified. See where each lead\n sits — new, contacted, qualified or disqualified — sort by lead score,\n and focus your follow-ups on the people most likely to convert.\n </PagePurpose>\n\n <CrmSubNav active=\"leads\" basePath={basePath} navigate={navigate} />\n\n <QueryStateBoundary\n loading={loading}\n error={error}\n onRetry={refetch}\n hasData={Boolean(data)}\n >\n {/* Stats + score distribution — primary emphasis zone */}\n <div className=\"grid grid-cols-1 gap-4 xl:grid-cols-3\">\n <div className=\"xl:col-span-2\">\n <EmphasisPanel>\n <div className=\"grid grid-cols-2 gap-4\">\n <StatCard\n title=\"Total Leads\"\n value={totalLeads}\n icon={<Users className=\"h-5 w-5\" />}\n featured\n />\n <StatCard\n title=\"Avg Lead Score\"\n value={avgScore}\n icon={<Gauge className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Conversion Rate\"\n value={`${conversionRate}%`}\n icon={<TrendingUp className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Hot Leads\"\n value={hotLeads}\n icon={<Flame className=\"h-5 w-5\" />}\n />\n </div>\n </EmphasisPanel>\n </div>\n\n <ChartCard\n title=\"Score distribution\"\n subtitle=\"Leads by score tier\"\n className=\"xl:col-span-1\"\n >\n <LeadScoreHistogram data={scoreBuckets} />\n </ChartCard>\n </div>\n\n {/* Filter */}\n <FilterBar\n searchValue={search}\n onSearchChange={setSearch}\n searchPlaceholder=\"Search leads...\"\n filters={\n <div className=\"flex flex-nowrap items-center gap-2 overflow-x-auto\">\n <select\n value={statusFilter}\n onChange={(e) => setStatusFilter(e.target.value)}\n className={selectClass}\n aria-label=\"Filter by status\"\n >\n <option value=\"all\">All Statuses</option>\n <option value=\"new\">New</option>\n <option value=\"contacted\">Contacted</option>\n <option value=\"qualified\">Qualified</option>\n <option value=\"disqualified\">Disqualified</option>\n </select>\n <select\n value={sourceFilter}\n onChange={(e) => setSourceFilter(e.target.value)}\n className={selectClass}\n aria-label=\"Filter by source\"\n >\n {SOURCE_FILTER_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n </div>\n }\n />\n\n {/* Leads Table */}\n {filtered.length === 0 ? (\n <EmptyState\n illustration={rows.length === 0 ? \"empty-people\" : \"empty-search\"}\n title={\n rows.length === 0 ? \"No leads yet\" : \"No leads match your filters\"\n }\n description={\n rows.length === 0\n ? \"Leads will appear here as they come in from your campaigns and forms.\"\n : \"Try a different search term, status or source.\"\n }\n />\n ) : (\n <DataTable data={filtered} columns={leadColumns} pageSize={10} />\n )}\n </QueryStateBoundary>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2CA,IAAM,IAA4D;CAChE;EAAE,OAAO;EAAO,OAAO;EAAe;CACtC;EAAE,OAAO;EAAW,OAAO;EAAW;CACtC;EAAE,OAAO;EAAgB,OAAO;EAAgB;CAChD;EAAE,OAAO;EAAe,OAAO;EAAO;CACtC;EAAE,OAAO;EAAS,OAAO;EAAS;CAClC;EAAE,OAAO;EAAY,OAAO;EAAY;CACxC;EAAE,OAAO;EAAS,OAAO;EAAS;CAClC;EAAE,OAAO;EAAiB,OAAO;EAAiB;CAClD;EAAE,OA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EV;OACD;QACE,KAAK;QACL,QAAQ;QACR,SAAS,MAAQ,GAAY,EAAI,WAAW;QAC7C;OACD;QACE,KAAK;QACL,QAAQ;QACR,UAAU;QACV,SAAS,MACP,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAW,EAAI,UAAU;SACrB,CAAA;QAEV;OACD;QACE,KAAK;QACL,QAAQ;QACR,WAAW;QACX,SAAS,MACP,kBAAC,OAAD;SAAK,WAAU;mBAAf,CACE,kBAAC,GAAD;UACE,MAAM;WAAE,IAAI,EAAI;WAAI,OAAO,EAAI;WAAO;UACtC,QAAQ;UACR,aAAa;UACb,CAAA,EACF,kBAAC,GAAD;UAAiB,MAAM;UAAK,WAAW;UAAW,CAAA,CAC9C;;QAET;OACF;MA8HwD,UAAU;MAAM,CAAA;KAEhD;;GACV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelinePage.d.ts","sourceRoot":"","sources":["../../../../src/headshotmarketing/pages/crm/PipelinePage.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PipelinePage.d.ts","sourceRoot":"","sources":["../../../../src/headshotmarketing/pages/crm/PipelinePage.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AA0DhC,eAAO,MAAM,YAAY,EAAE,EAqN1B,CAAC"}
|
|
@@ -6,12 +6,13 @@ import { QueryStateBoundary as o } from "../../components/QueryStateBoundary.js"
|
|
|
6
6
|
import "../../components/index.js";
|
|
7
7
|
import { useHeadshotmarketingBootstrap as s } from "../../hooks/useHeadshotmarketingBootstrap.js";
|
|
8
8
|
import { toContactModel as c, toDealModel as l } from "../../utils/crmMapper.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
9
|
+
import { CrmSubNav as u } from "./CrmSubNav.js";
|
|
10
|
+
import { DealActionsMenu as d } from "./CrmActions.js";
|
|
11
|
+
import { Calendar as f, DollarSign as p, Plus as m, User as h } from "lucide-react";
|
|
12
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
13
|
+
import { EmphasisPanel as v, PagePurpose as y } from "@burdenoff/fe-libs/ui";
|
|
13
14
|
//#region src/headshotmarketing/pages/crm/PipelinePage.tsx
|
|
14
|
-
var
|
|
15
|
+
var b = [
|
|
15
16
|
{
|
|
16
17
|
stage: "prospecting",
|
|
17
18
|
label: "Prospecting",
|
|
@@ -48,195 +49,203 @@ var y = [
|
|
|
48
49
|
color: "bg-status-error-text",
|
|
49
50
|
bgColor: "bg-status-error-bg"
|
|
50
51
|
}
|
|
51
|
-
],
|
|
52
|
-
let { navigate:
|
|
53
|
-
return /* @__PURE__ */
|
|
52
|
+
], x = () => {
|
|
53
|
+
let { navigate: x, basePath: S } = e(), { data: C, loading: w, error: T, refetch: E } = s(), D = (C?.headshotmarketingContacts.items ?? []).map((e) => c(e)), O = Object.fromEntries(D.map((e) => [e.id, e])), k = (C?.headshotmarketingDeals.items ?? []).map((e) => l(e, O)), A = k.reduce((e, t) => e + t.value, 0), j = k.filter((e) => !["closed_won", "closed_lost"].includes(e.stage)).reduce((e, t) => e + t.value, 0), M = k.filter((e) => e.stage === "closed_won").reduce((e, t) => e + t.value, 0);
|
|
54
|
+
return /* @__PURE__ */ _(i, {
|
|
54
55
|
title: "Deal Pipeline",
|
|
55
56
|
description: "Visualize and manage your sales pipeline",
|
|
56
|
-
actions: /* @__PURE__ */
|
|
57
|
-
onClick: () =>
|
|
57
|
+
actions: /* @__PURE__ */ _("button", {
|
|
58
|
+
onClick: () => x(S + "/crm/pipeline/new"),
|
|
58
59
|
className: "inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90",
|
|
59
|
-
children: [/* @__PURE__ */
|
|
60
|
+
children: [/* @__PURE__ */ g(m, { className: "h-4 w-4" }), "Add Deal"]
|
|
60
61
|
}),
|
|
61
|
-
children: [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
" ",
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
" ",
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ g(y, { children: "Every deal in flight, grouped by stage. Watch open versus won value update in real time, open a deal's menu to edit or close it, and spot where opportunities are getting stuck so you can move them forward." }),
|
|
64
|
+
/* @__PURE__ */ g(u, {
|
|
65
|
+
active: "pipeline",
|
|
66
|
+
basePath: S,
|
|
67
|
+
navigate: x
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ _(o, {
|
|
70
|
+
loading: w,
|
|
71
|
+
error: T,
|
|
72
|
+
onRetry: E,
|
|
73
|
+
hasData: !!C,
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ g(v, { children: /* @__PURE__ */ _("div", {
|
|
76
|
+
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ _("div", {
|
|
79
|
+
className: "rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4",
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ g("p", {
|
|
82
|
+
className: "text-sm text-text-secondary",
|
|
83
|
+
children: "Total Pipeline"
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ g("p", {
|
|
86
|
+
className: "text-2xl font-bold text-text-primary mt-1",
|
|
87
|
+
children: n(A)
|
|
88
|
+
}),
|
|
89
|
+
/* @__PURE__ */ _("p", {
|
|
90
|
+
className: "text-xs text-text-secondary mt-1",
|
|
91
|
+
children: [k.length, " deals"]
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ _("div", {
|
|
96
|
+
className: "rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4",
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ g("p", {
|
|
99
|
+
className: "text-sm text-text-secondary",
|
|
100
|
+
children: "Open Pipeline"
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ g("p", {
|
|
103
|
+
className: "text-2xl font-bold text-text-primary mt-1",
|
|
104
|
+
children: n(j)
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ _("p", {
|
|
107
|
+
className: "text-xs text-text-secondary mt-1",
|
|
108
|
+
children: [
|
|
109
|
+
k.filter((e) => !["closed_won", "closed_lost"].includes(e.stage)).length,
|
|
110
|
+
" ",
|
|
111
|
+
"deals"
|
|
112
|
+
]
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ _("div", {
|
|
117
|
+
className: "rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4",
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ g("p", {
|
|
120
|
+
className: "text-sm text-text-secondary",
|
|
121
|
+
children: "Won This Period"
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ g("p", {
|
|
124
|
+
className: "text-2xl font-bold text-status-success-text mt-1",
|
|
125
|
+
children: n(M)
|
|
126
|
+
}),
|
|
127
|
+
/* @__PURE__ */ _("p", {
|
|
128
|
+
className: "text-xs text-text-secondary mt-1",
|
|
129
|
+
children: [
|
|
130
|
+
k.filter((e) => e.stage === "closed_won").length,
|
|
131
|
+
" ",
|
|
132
|
+
"deals"
|
|
133
|
+
]
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
})
|
|
137
|
+
]
|
|
138
|
+
}) }),
|
|
139
|
+
k.length === 0 && /* @__PURE__ */ g(a, {
|
|
140
|
+
illustration: "empty-generic",
|
|
141
|
+
title: "No deals yet",
|
|
142
|
+
description: "Add your first deal to start tracking opportunities through your pipeline.",
|
|
143
|
+
action: /* @__PURE__ */ _("button", {
|
|
144
|
+
onClick: () => x(S + "/crm/pipeline/new"),
|
|
145
|
+
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",
|
|
146
|
+
children: [/* @__PURE__ */ g(m, { className: "h-4 w-4" }), "Add Deal"]
|
|
128
147
|
})
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ g("div", {
|
|
150
|
+
className: "overflow-x-auto",
|
|
151
|
+
children: /* @__PURE__ */ g("div", {
|
|
152
|
+
className: "flex gap-4 min-w-[1100px] pb-4",
|
|
153
|
+
children: b.map((e) => {
|
|
154
|
+
let i = k.filter((t) => t.stage === e.stage), a = i.reduce((e, t) => e + t.value, 0);
|
|
155
|
+
return /* @__PURE__ */ g("div", {
|
|
156
|
+
className: "flex-1 min-w-[200px]",
|
|
157
|
+
children: /* @__PURE__ */ _("div", {
|
|
158
|
+
className: "rounded-lg border border-border-seam bg-gloss-card shadow-pop overflow-hidden",
|
|
159
|
+
children: [/* @__PURE__ */ _("div", {
|
|
160
|
+
className: "p-3 border-b border-border-subtle",
|
|
161
|
+
children: [/* @__PURE__ */ _("div", {
|
|
162
|
+
className: "flex items-center gap-2",
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ g("div", { className: t("h-3 w-3 rounded-full", e.color) }),
|
|
165
|
+
/* @__PURE__ */ g("h4", {
|
|
166
|
+
className: "text-sm font-semibold text-text-primary",
|
|
167
|
+
children: e.label
|
|
168
|
+
}),
|
|
169
|
+
/* @__PURE__ */ g("span", {
|
|
170
|
+
className: "ml-auto text-xs text-text-secondary bg-bg-sunken rounded-full px-2 py-0.5",
|
|
171
|
+
children: i.length
|
|
172
|
+
})
|
|
173
|
+
]
|
|
174
|
+
}), /* @__PURE__ */ g("p", {
|
|
175
|
+
className: "text-xs text-text-secondary mt-1",
|
|
176
|
+
children: n(a)
|
|
177
|
+
})]
|
|
178
|
+
}), /* @__PURE__ */ g("div", {
|
|
179
|
+
className: "p-2 space-y-2 min-h-[200px] max-h-[500px] overflow-y-auto",
|
|
180
|
+
children: i.length === 0 ? /* @__PURE__ */ g("div", {
|
|
181
|
+
className: "py-8 text-center text-xs text-text-secondary",
|
|
182
|
+
children: "No deals"
|
|
183
|
+
}) : i.map((e) => /* @__PURE__ */ _("div", {
|
|
184
|
+
className: "rounded-md border border-border-seam bg-gloss-card p-3 transition-shadow hover:shadow-pop",
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ _("div", {
|
|
187
|
+
className: "flex items-start justify-between gap-1",
|
|
188
|
+
children: [/* @__PURE__ */ g("p", {
|
|
189
|
+
className: "text-sm font-medium text-text-primary leading-tight",
|
|
190
|
+
children: e.name
|
|
191
|
+
}), /* @__PURE__ */ g(d, {
|
|
192
|
+
deal: e,
|
|
193
|
+
onChanged: E
|
|
194
|
+
})]
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ _("div", {
|
|
197
|
+
className: "mt-2 space-y-1.5",
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ _("div", {
|
|
200
|
+
className: "flex items-center gap-1.5 text-xs text-text-secondary",
|
|
201
|
+
children: [/* @__PURE__ */ g(p, { className: "h-3 w-3" }), /* @__PURE__ */ g("span", {
|
|
202
|
+
className: "font-semibold text-text-primary",
|
|
203
|
+
children: n(e.value)
|
|
204
|
+
})]
|
|
205
|
+
}),
|
|
206
|
+
/* @__PURE__ */ _("div", {
|
|
207
|
+
className: "flex items-center gap-1.5 text-xs text-text-secondary",
|
|
208
|
+
children: [/* @__PURE__ */ g(h, { className: "h-3 w-3" }), /* @__PURE__ */ g("span", { children: e.contactName })]
|
|
209
|
+
}),
|
|
210
|
+
/* @__PURE__ */ _("div", {
|
|
211
|
+
className: "flex items-center gap-1.5 text-xs text-text-secondary",
|
|
212
|
+
children: [/* @__PURE__ */ g(f, { className: "h-3 w-3" }), /* @__PURE__ */ g("span", { children: r(e.expectedCloseDate) })]
|
|
213
|
+
})
|
|
214
|
+
]
|
|
215
|
+
}),
|
|
216
|
+
e.probability > 0 && e.probability < 100 && /* @__PURE__ */ _("div", {
|
|
217
|
+
className: "mt-2 pt-2 border-t border-border-subtle",
|
|
218
|
+
children: [/* @__PURE__ */ _("div", {
|
|
219
|
+
className: "flex items-center justify-between text-xs",
|
|
220
|
+
children: [/* @__PURE__ */ g("span", {
|
|
221
|
+
className: "text-text-secondary",
|
|
222
|
+
children: "Probability"
|
|
223
|
+
}), /* @__PURE__ */ _("span", {
|
|
224
|
+
className: "font-medium text-text-primary",
|
|
225
|
+
children: [e.probability, "%"]
|
|
196
226
|
})]
|
|
197
|
-
}),
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
className: "flex items-center gap-1.5 text-xs text-text-secondary",
|
|
204
|
-
children: [/* @__PURE__ */ h(d, { className: "h-3 w-3" }), /* @__PURE__ */ h("span", { children: r(e.expectedCloseDate) })]
|
|
205
|
-
})
|
|
206
|
-
]
|
|
207
|
-
}),
|
|
208
|
-
e.probability > 0 && e.probability < 100 && /* @__PURE__ */ g("div", {
|
|
209
|
-
className: "mt-2 pt-2 border-t border-border-subtle",
|
|
210
|
-
children: [/* @__PURE__ */ g("div", {
|
|
211
|
-
className: "flex items-center justify-between text-xs",
|
|
212
|
-
children: [/* @__PURE__ */ h("span", {
|
|
213
|
-
className: "text-text-secondary",
|
|
214
|
-
children: "Probability"
|
|
215
|
-
}), /* @__PURE__ */ g("span", {
|
|
216
|
-
className: "font-medium text-text-primary",
|
|
217
|
-
children: [e.probability, "%"]
|
|
227
|
+
}), /* @__PURE__ */ g("div", {
|
|
228
|
+
className: "w-full h-1.5 rounded-full bg-bg-sunken mt-1 overflow-hidden",
|
|
229
|
+
children: /* @__PURE__ */ g("div", {
|
|
230
|
+
className: "h-full rounded-full bg-action-primary-bg",
|
|
231
|
+
style: { width: `${e.probability}%` }
|
|
232
|
+
})
|
|
218
233
|
})]
|
|
219
|
-
})
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
})
|
|
227
|
-
]
|
|
228
|
-
}, e.id))
|
|
229
|
-
})]
|
|
230
|
-
})
|
|
231
|
-
}, e.stage);
|
|
234
|
+
})
|
|
235
|
+
]
|
|
236
|
+
}, e.id))
|
|
237
|
+
})]
|
|
238
|
+
})
|
|
239
|
+
}, e.stage);
|
|
240
|
+
})
|
|
232
241
|
})
|
|
233
242
|
})
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
243
|
+
]
|
|
244
|
+
})
|
|
245
|
+
]
|
|
237
246
|
});
|
|
238
247
|
};
|
|
239
248
|
//#endregion
|
|
240
|
-
export {
|
|
249
|
+
export { x as PipelinePage };
|
|
241
250
|
|
|
242
251
|
//# sourceMappingURL=PipelinePage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelinePage.js","names":[],"sources":["../../../../src/headshotmarketing/pages/crm/PipelinePage.tsx"],"sourcesContent":["/**\n * Pipeline Page\n * @module headshotmarketing/pages/crm\n */\n\nimport type { FC } from \"react\";\nimport { Plus, DollarSign, Calendar, User } from \"lucide-react\";\nimport { PageLayout, EmptyState, QueryStateBoundary } from \"../../components\";\nimport { EmphasisPanel, PagePurpose } from \"@burdenoff/fe-libs/ui\";\nimport { cn, formatCurrency, formatDate } from \"../../utils/helpers\";\nimport { toContactModel, toDealModel } from \"../../utils/crmMapper\";\nimport { useHeadshotMarketing } from \"../../context/HeadshotMarketingContext\";\nimport { useHeadshotmarketingBootstrap } from \"../../hooks/useHeadshotmarketingBootstrap\";\nimport type { Contact, Deal, DealStage } from \"../../types\";\nimport { DealActionsMenu } from \"./CrmActions\";\n\ninterface PipelineStage {\n stage: DealStage;\n label: string;\n color: string;\n bgColor: string;\n}\n\nconst stages: PipelineStage[] = [\n {\n stage: \"prospecting\",\n label: \"Prospecting\",\n color: \"bg-status-info-text\",\n bgColor: \"bg-status-info-bg\",\n },\n {\n stage: \"qualification\",\n label: \"Qualification\",\n color: \"bg-status-warning-text\",\n bgColor: \"bg-status-warning-bg\",\n },\n {\n stage: \"proposal\",\n label: \"Proposal\",\n color: \"bg-status-warning-text\",\n bgColor: \"bg-status-warning-bg\",\n },\n {\n stage: \"negotiation\",\n label: \"Negotiation\",\n color: \"bg-action-primary-bg\",\n bgColor: \"bg-[var(--color-accent-soft)]\",\n },\n {\n stage: \"closed_won\",\n label: \"Closed Won\",\n color: \"bg-status-success-text\",\n bgColor: \"bg-status-success-bg\",\n },\n {\n stage: \"closed_lost\",\n label: \"Closed Lost\",\n color: \"bg-status-error-text\",\n bgColor: \"bg-status-error-bg\",\n },\n];\n\nexport const PipelinePage: FC = () => {\n const { navigate, basePath } = useHeadshotMarketing();\n const { data, loading, error, refetch } = useHeadshotmarketingBootstrap();\n\n const contacts: Contact[] = (data?.headshotmarketingContacts.items ?? []).map(\n (item: Parameters<typeof toContactModel>[0]) => toContactModel(item),\n );\n const contactById = Object.fromEntries(\n contacts.map((contact: Contact) => [contact.id, contact]),\n );\n const deals: Deal[] = (data?.headshotmarketingDeals.items ?? []).map(\n (item: Parameters<typeof toDealModel>[0]) => toDealModel(item, contactById),\n );\n\n const totalValue = deals.reduce((sum: number, d: Deal) => sum + d.value, 0);\n const openValue = deals\n .filter((d: Deal) => ![\"closed_won\", \"closed_lost\"].includes(d.stage))\n .reduce((sum: number, d: Deal) => sum + d.value, 0);\n const wonValue = deals\n .filter((d: Deal) => d.stage === \"closed_won\")\n .reduce((sum: number, d: Deal) => sum + d.value, 0);\n\n return (\n <PageLayout\n title=\"Deal Pipeline\"\n description=\"Visualize and manage your sales pipeline\"\n actions={\n <button\n onClick={() => navigate(basePath + \"/crm/pipeline/new\")}\n className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" />\n Add Deal\n </button>\n }\n >\n <PagePurpose>\n Every deal in flight, grouped by stage. Watch open versus won value\n update in real time, open a deal's menu to edit or close it, and spot\n where opportunities are getting stuck so you can move them forward.\n </PagePurpose>\n\n <QueryStateBoundary\n loading={loading}\n error={error}\n onRetry={refetch}\n hasData={Boolean(data)}\n >\n {/* Pipeline Value Summary — primary emphasis zone */}\n <EmphasisPanel>\n <div className=\"grid grid-cols-1 md:grid-cols-3 gap-4\">\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4\">\n <p className=\"text-sm text-text-secondary\">Total Pipeline</p>\n <p className=\"text-2xl font-bold text-text-primary mt-1\">\n {formatCurrency(totalValue)}\n </p>\n <p className=\"text-xs text-text-secondary mt-1\">\n {deals.length} deals\n </p>\n </div>\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4\">\n <p className=\"text-sm text-text-secondary\">Open Pipeline</p>\n <p className=\"text-2xl font-bold text-text-primary mt-1\">\n {formatCurrency(openValue)}\n </p>\n <p className=\"text-xs text-text-secondary mt-1\">\n {\n deals.filter(\n (d: Deal) =>\n ![\"closed_won\", \"closed_lost\"].includes(d.stage),\n ).length\n }{\" \"}\n deals\n </p>\n </div>\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4\">\n <p className=\"text-sm text-text-secondary\">Won This Period</p>\n <p className=\"text-2xl font-bold text-status-success-text mt-1\">\n {formatCurrency(wonValue)}\n </p>\n <p className=\"text-xs text-text-secondary mt-1\">\n {deals.filter((d: Deal) => d.stage === \"closed_won\").length}{\" \"}\n deals\n </p>\n </div>\n </div>\n </EmphasisPanel>\n\n {deals.length === 0 && (\n <EmptyState\n illustration=\"empty-generic\"\n title=\"No deals yet\"\n description=\"Add your first deal to start tracking opportunities through your pipeline.\"\n action={\n <button\n onClick={() => navigate(basePath + \"/crm/pipeline/new\")}\n className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" />\n Add Deal\n </button>\n }\n />\n )}\n\n {/* Kanban Board */}\n <div className=\"overflow-x-auto\">\n <div className=\"flex gap-4 min-w-[1100px] pb-4\">\n {stages.map((stageConfig) => {\n const stageDeals = deals.filter(\n (d: Deal) => d.stage === stageConfig.stage,\n );\n const stageValue = stageDeals.reduce(\n (sum: number, d: Deal) => sum + d.value,\n 0,\n );\n\n return (\n <div key={stageConfig.stage} className=\"flex-1 min-w-[200px]\">\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop overflow-hidden\">\n {/* Column Header */}\n <div className=\"p-3 border-b border-border-subtle\">\n <div className=\"flex items-center gap-2\">\n <div\n className={cn(\n \"h-3 w-3 rounded-full\",\n stageConfig.color,\n )}\n />\n <h4 className=\"text-sm font-semibold text-text-primary\">\n {stageConfig.label}\n </h4>\n <span className=\"ml-auto text-xs text-text-secondary bg-bg-sunken rounded-full px-2 py-0.5\">\n {stageDeals.length}\n </span>\n </div>\n <p className=\"text-xs text-text-secondary mt-1\">\n {formatCurrency(stageValue)}\n </p>\n </div>\n\n {/* Deal Cards */}\n <div className=\"p-2 space-y-2 min-h-[200px] max-h-[500px] overflow-y-auto\">\n {stageDeals.length === 0 ? (\n <div className=\"py-8 text-center text-xs text-text-secondary\">\n No deals\n </div>\n ) : (\n stageDeals.map((deal) => (\n <div\n key={deal.id}\n className=\"rounded-md border border-border-seam bg-gloss-card p-3 transition-shadow hover:shadow-pop\"\n >\n <div className=\"flex items-start justify-between gap-1\">\n <p className=\"text-sm font-medium text-text-primary leading-tight\">\n {deal.name}\n </p>\n <DealActionsMenu\n deal={deal}\n onChanged={refetch}\n />\n </div>\n <div className=\"mt-2 space-y-1.5\">\n <div className=\"flex items-center gap-1.5 text-xs text-text-secondary\">\n <DollarSign className=\"h-3 w-3\" />\n <span className=\"font-semibold text-text-primary\">\n {formatCurrency(deal.value)}\n </span>\n </div>\n <div className=\"flex items-center gap-1.5 text-xs text-text-secondary\">\n <User className=\"h-3 w-3\" />\n <span>{deal.contactName}</span>\n </div>\n <div className=\"flex items-center gap-1.5 text-xs text-text-secondary\">\n <Calendar className=\"h-3 w-3\" />\n <span>\n {formatDate(deal.expectedCloseDate)}\n </span>\n </div>\n </div>\n {deal.probability > 0 && deal.probability < 100 && (\n <div className=\"mt-2 pt-2 border-t border-border-subtle\">\n <div className=\"flex items-center justify-between text-xs\">\n <span className=\"text-text-secondary\">\n Probability\n </span>\n <span className=\"font-medium text-text-primary\">\n {deal.probability}%\n </span>\n </div>\n <div className=\"w-full h-1.5 rounded-full bg-bg-sunken mt-1 overflow-hidden\">\n <div\n className=\"h-full rounded-full bg-action-primary-bg\"\n style={{ width: `${deal.probability}%` }}\n />\n </div>\n </div>\n )}\n </div>\n ))\n )}\n </div>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n </QueryStateBoundary>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAuBA,IAAM,IAA0B;CAC9B;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,SAAS;EACV;CACD;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,SAAS;EACV;CACD;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,SAAS;EACV;CACD;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,SAAS;EACV;CACD;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,SAAS;EACV;CACD;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,SAAS;EACV;CACF,EAEY,UAAyB;CACpC,IAAM,EAAE,aAAU,gBAAa,GAAsB,EAC/C,EAAE,SAAM,YAAS,U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EAAK,GAgDN,CACN;UAEA,CAAA,CACF;;QACF,EArFI,EAAY,MAqFhB;QAER;MACE,CAAA;KACF,CAAA;IACa;KACV"}
|
|
1
|
+
{"version":3,"file":"PipelinePage.js","names":[],"sources":["../../../../src/headshotmarketing/pages/crm/PipelinePage.tsx"],"sourcesContent":["/**\n * Pipeline Page\n * @module headshotmarketing/pages/crm\n */\n\nimport type { FC } from \"react\";\nimport { Plus, DollarSign, Calendar, User } from \"lucide-react\";\nimport { PageLayout, EmptyState, QueryStateBoundary } from \"../../components\";\nimport { EmphasisPanel, PagePurpose } from \"@burdenoff/fe-libs/ui\";\nimport { cn, formatCurrency, formatDate } from \"../../utils/helpers\";\nimport { toContactModel, toDealModel } from \"../../utils/crmMapper\";\nimport { useHeadshotMarketing } from \"../../context/HeadshotMarketingContext\";\nimport { CrmSubNav } from \"./CrmSubNav\";\nimport { useHeadshotmarketingBootstrap } from \"../../hooks/useHeadshotmarketingBootstrap\";\nimport type { Contact, Deal, DealStage } from \"../../types\";\nimport { DealActionsMenu } from \"./CrmActions\";\n\ninterface PipelineStage {\n stage: DealStage;\n label: string;\n color: string;\n bgColor: string;\n}\n\nconst stages: PipelineStage[] = [\n {\n stage: \"prospecting\",\n label: \"Prospecting\",\n color: \"bg-status-info-text\",\n bgColor: \"bg-status-info-bg\",\n },\n {\n stage: \"qualification\",\n label: \"Qualification\",\n color: \"bg-status-warning-text\",\n bgColor: \"bg-status-warning-bg\",\n },\n {\n stage: \"proposal\",\n label: \"Proposal\",\n color: \"bg-status-warning-text\",\n bgColor: \"bg-status-warning-bg\",\n },\n {\n stage: \"negotiation\",\n label: \"Negotiation\",\n color: \"bg-action-primary-bg\",\n bgColor: \"bg-[var(--color-accent-soft)]\",\n },\n {\n stage: \"closed_won\",\n label: \"Closed Won\",\n color: \"bg-status-success-text\",\n bgColor: \"bg-status-success-bg\",\n },\n {\n stage: \"closed_lost\",\n label: \"Closed Lost\",\n color: \"bg-status-error-text\",\n bgColor: \"bg-status-error-bg\",\n },\n];\n\nexport const PipelinePage: FC = () => {\n const { navigate, basePath } = useHeadshotMarketing();\n const { data, loading, error, refetch } = useHeadshotmarketingBootstrap();\n\n const contacts: Contact[] = (data?.headshotmarketingContacts.items ?? []).map(\n (item: Parameters<typeof toContactModel>[0]) => toContactModel(item),\n );\n const contactById = Object.fromEntries(\n contacts.map((contact: Contact) => [contact.id, contact]),\n );\n const deals: Deal[] = (data?.headshotmarketingDeals.items ?? []).map(\n (item: Parameters<typeof toDealModel>[0]) => toDealModel(item, contactById),\n );\n\n const totalValue = deals.reduce((sum: number, d: Deal) => sum + d.value, 0);\n const openValue = deals\n .filter((d: Deal) => ![\"closed_won\", \"closed_lost\"].includes(d.stage))\n .reduce((sum: number, d: Deal) => sum + d.value, 0);\n const wonValue = deals\n .filter((d: Deal) => d.stage === \"closed_won\")\n .reduce((sum: number, d: Deal) => sum + d.value, 0);\n\n return (\n <PageLayout\n title=\"Deal Pipeline\"\n description=\"Visualize and manage your sales pipeline\"\n actions={\n <button\n onClick={() => navigate(basePath + \"/crm/pipeline/new\")}\n className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" />\n Add Deal\n </button>\n }\n >\n <PagePurpose>\n Every deal in flight, grouped by stage. Watch open versus won value\n update in real time, open a deal's menu to edit or close it, and spot\n where opportunities are getting stuck so you can move them forward.\n </PagePurpose>\n\n <CrmSubNav active=\"pipeline\" basePath={basePath} navigate={navigate} />\n\n <QueryStateBoundary\n loading={loading}\n error={error}\n onRetry={refetch}\n hasData={Boolean(data)}\n >\n {/* Pipeline Value Summary — primary emphasis zone */}\n <EmphasisPanel>\n <div className=\"grid grid-cols-1 md:grid-cols-3 gap-4\">\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4\">\n <p className=\"text-sm text-text-secondary\">Total Pipeline</p>\n <p className=\"text-2xl font-bold text-text-primary mt-1\">\n {formatCurrency(totalValue)}\n </p>\n <p className=\"text-xs text-text-secondary mt-1\">\n {deals.length} deals\n </p>\n </div>\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4\">\n <p className=\"text-sm text-text-secondary\">Open Pipeline</p>\n <p className=\"text-2xl font-bold text-text-primary mt-1\">\n {formatCurrency(openValue)}\n </p>\n <p className=\"text-xs text-text-secondary mt-1\">\n {\n deals.filter(\n (d: Deal) =>\n ![\"closed_won\", \"closed_lost\"].includes(d.stage),\n ).length\n }{\" \"}\n deals\n </p>\n </div>\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4\">\n <p className=\"text-sm text-text-secondary\">Won This Period</p>\n <p className=\"text-2xl font-bold text-status-success-text mt-1\">\n {formatCurrency(wonValue)}\n </p>\n <p className=\"text-xs text-text-secondary mt-1\">\n {deals.filter((d: Deal) => d.stage === \"closed_won\").length}{\" \"}\n deals\n </p>\n </div>\n </div>\n </EmphasisPanel>\n\n {deals.length === 0 && (\n <EmptyState\n illustration=\"empty-generic\"\n title=\"No deals yet\"\n description=\"Add your first deal to start tracking opportunities through your pipeline.\"\n action={\n <button\n onClick={() => navigate(basePath + \"/crm/pipeline/new\")}\n className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" />\n Add Deal\n </button>\n }\n />\n )}\n\n {/* Kanban Board */}\n <div className=\"overflow-x-auto\">\n <div className=\"flex gap-4 min-w-[1100px] pb-4\">\n {stages.map((stageConfig) => {\n const stageDeals = deals.filter(\n (d: Deal) => d.stage === stageConfig.stage,\n );\n const stageValue = stageDeals.reduce(\n (sum: number, d: Deal) => sum + d.value,\n 0,\n );\n\n return (\n <div key={stageConfig.stage} className=\"flex-1 min-w-[200px]\">\n <div className=\"rounded-lg border border-border-seam bg-gloss-card shadow-pop overflow-hidden\">\n {/* Column Header */}\n <div className=\"p-3 border-b border-border-subtle\">\n <div className=\"flex items-center gap-2\">\n <div\n className={cn(\n \"h-3 w-3 rounded-full\",\n stageConfig.color,\n )}\n />\n <h4 className=\"text-sm font-semibold text-text-primary\">\n {stageConfig.label}\n </h4>\n <span className=\"ml-auto text-xs text-text-secondary bg-bg-sunken rounded-full px-2 py-0.5\">\n {stageDeals.length}\n </span>\n </div>\n <p className=\"text-xs text-text-secondary mt-1\">\n {formatCurrency(stageValue)}\n </p>\n </div>\n\n {/* Deal Cards */}\n <div className=\"p-2 space-y-2 min-h-[200px] max-h-[500px] overflow-y-auto\">\n {stageDeals.length === 0 ? (\n <div className=\"py-8 text-center text-xs text-text-secondary\">\n No deals\n </div>\n ) : (\n stageDeals.map((deal) => (\n <div\n key={deal.id}\n className=\"rounded-md border border-border-seam bg-gloss-card p-3 transition-shadow hover:shadow-pop\"\n >\n <div className=\"flex items-start justify-between gap-1\">\n <p className=\"text-sm font-medium text-text-primary leading-tight\">\n {deal.name}\n </p>\n <DealActionsMenu\n deal={deal}\n onChanged={refetch}\n />\n </div>\n <div className=\"mt-2 space-y-1.5\">\n <div className=\"flex items-center gap-1.5 text-xs text-text-secondary\">\n <DollarSign className=\"h-3 w-3\" />\n <span className=\"font-semibold text-text-primary\">\n {formatCurrency(deal.value)}\n </span>\n </div>\n <div className=\"flex items-center gap-1.5 text-xs text-text-secondary\">\n <User className=\"h-3 w-3\" />\n <span>{deal.contactName}</span>\n </div>\n <div className=\"flex items-center gap-1.5 text-xs text-text-secondary\">\n <Calendar className=\"h-3 w-3\" />\n <span>\n {formatDate(deal.expectedCloseDate)}\n </span>\n </div>\n </div>\n {deal.probability > 0 && deal.probability < 100 && (\n <div className=\"mt-2 pt-2 border-t border-border-subtle\">\n <div className=\"flex items-center justify-between text-xs\">\n <span className=\"text-text-secondary\">\n Probability\n </span>\n <span className=\"font-medium text-text-primary\">\n {deal.probability}%\n </span>\n </div>\n <div className=\"w-full h-1.5 rounded-full bg-bg-sunken mt-1 overflow-hidden\">\n <div\n className=\"h-full rounded-full bg-action-primary-bg\"\n style={{ width: `${deal.probability}%` }}\n />\n </div>\n </div>\n )}\n </div>\n ))\n )}\n </div>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n </QueryStateBoundary>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAwBA,IAAM,IAA0B;CAC9B;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,SAAS;EACV;CACD;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,SAAS;EACV;CACD;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,SAAS;EACV;CACD;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,SAAS;EACV;CACD;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,SAAS;EACV;CACD;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,SAAS;EACV;CACF,EAEY,UAAyB;CACpC,IAAM,EAAE,aAAU,gBAAa,GAAsB,EAC/C,EAAE,SAAM,YAAS,UAAO,eAAY,GAA+B,EAEnE,KAAuB,GAAM,0BAA0B,SAAS,EAAE,EAAE,KACvE,MAA+C,EAAe,EAAK,CACrE,EACK,IAAc,OAAO,YACzB,EAAS,KAAK,MAAqB,CAAC,EAAQ,IAAI,EAAQ,CAAC,CAC1D,EACK,KAAiB,GAAM,uBAAuB,SAAS,EAAE,EAAE,KAC9D,MAA4C,EAAY,GAAM,EAAY,CAC5E,EAEK,IAAa,EAAM,QAAQ,GAAa,MAAY,IAAM,EAAE,OAAO,EAAE,EACrE,IAAY,EACf,QAAQ,MAAY,CAAC,CAAC,cAAc,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,CACrE,QAAQ,GAAa,MAAY,IAAM,EAAE,OAAO,EAAE,EAC/C,IAAW,EACd,QAAQ,MAAY,EAAE,UAAU,aAAa,CAC7C,QAAQ,GAAa,MAAY,IAAM,EAAE,OAAO,EAAE;AAErD,QACE,kBAAC,GAAD;EACE,OAAM;EACN,aAAY;EACZ,SACE,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