@burdenoff/microfe-headshotmarketing 2026.923.2 → 2026.924.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/generated/wspace-operations.d.ts +186 -0
  2. package/dist/generated/wspace-operations.d.ts.map +1 -1
  3. package/dist/generated/wspace-operations.js +296 -187
  4. package/dist/generated/wspace-operations.js.map +1 -1
  5. package/dist/generated/wspace-types.js +9 -7
  6. package/dist/generated/wspace-types.js.map +1 -1
  7. package/dist/headshotmarketing/HeadshotMarketingRoutes.d.ts +2 -0
  8. package/dist/headshotmarketing/HeadshotMarketingRoutes.d.ts.map +1 -1
  9. package/dist/headshotmarketing/HeadshotMarketingRoutes.js +52 -44
  10. package/dist/headshotmarketing/HeadshotMarketingRoutes.js.map +1 -1
  11. package/dist/headshotmarketing/components/InfluencerModals.d.ts +6 -0
  12. package/dist/headshotmarketing/components/InfluencerModals.d.ts.map +1 -1
  13. package/dist/headshotmarketing/components/InfluencerModals.js +431 -249
  14. package/dist/headshotmarketing/components/InfluencerModals.js.map +1 -1
  15. package/dist/headshotmarketing/components/index.d.ts +1 -1
  16. package/dist/headshotmarketing/components/index.d.ts.map +1 -1
  17. package/dist/headshotmarketing/index.js +1 -1
  18. package/dist/headshotmarketing/pages/CustomizeDashboardModal.d.ts +12 -0
  19. package/dist/headshotmarketing/pages/CustomizeDashboardModal.d.ts.map +1 -0
  20. package/dist/headshotmarketing/pages/CustomizeDashboardModal.js +62 -0
  21. package/dist/headshotmarketing/pages/CustomizeDashboardModal.js.map +1 -0
  22. package/dist/headshotmarketing/pages/HomePage.d.ts.map +1 -1
  23. package/dist/headshotmarketing/pages/HomePage.js +221 -200
  24. package/dist/headshotmarketing/pages/HomePage.js.map +1 -1
  25. package/dist/headshotmarketing/pages/ads/AdCampaignDetailsPage.d.ts +4 -0
  26. package/dist/headshotmarketing/pages/ads/AdCampaignDetailsPage.d.ts.map +1 -0
  27. package/dist/headshotmarketing/pages/ads/AdCampaignDetailsPage.js +500 -0
  28. package/dist/headshotmarketing/pages/ads/AdCampaignDetailsPage.js.map +1 -0
  29. package/dist/headshotmarketing/pages/ads/AdCampaignsPage.d.ts.map +1 -1
  30. package/dist/headshotmarketing/pages/ads/AdCampaignsPage.js +171 -163
  31. package/dist/headshotmarketing/pages/ads/AdCampaignsPage.js.map +1 -1
  32. package/dist/headshotmarketing/pages/ads/createAudienceForm.d.ts.map +1 -1
  33. package/dist/headshotmarketing/pages/ads/createAudienceForm.js.map +1 -1
  34. package/dist/headshotmarketing/pages/analytics/SocialAnalyticsPage.d.ts.map +1 -1
  35. package/dist/headshotmarketing/pages/analytics/SocialAnalyticsPage.js.map +1 -1
  36. package/dist/headshotmarketing/pages/campaigns/CampaignDetailsPage.d.ts.map +1 -1
  37. package/dist/headshotmarketing/pages/campaigns/CampaignDetailsPage.js +1 -1
  38. package/dist/headshotmarketing/pages/campaigns/CampaignDetailsPage.js.map +1 -1
  39. package/dist/headshotmarketing/pages/campaigns/CampaignTemplatesPage.d.ts.map +1 -1
  40. package/dist/headshotmarketing/pages/campaigns/CampaignTemplatesPage.js +107 -89
  41. package/dist/headshotmarketing/pages/campaigns/CampaignTemplatesPage.js.map +1 -1
  42. package/dist/headshotmarketing/pages/campaigns/CreateTemplateModal.d.ts +10 -0
  43. package/dist/headshotmarketing/pages/campaigns/CreateTemplateModal.d.ts.map +1 -0
  44. package/dist/headshotmarketing/pages/campaigns/CreateTemplateModal.js +174 -0
  45. package/dist/headshotmarketing/pages/campaigns/CreateTemplateModal.js.map +1 -0
  46. package/dist/headshotmarketing/pages/content/ContentDetailsPage.d.ts +4 -0
  47. package/dist/headshotmarketing/pages/content/ContentDetailsPage.d.ts.map +1 -0
  48. package/dist/headshotmarketing/pages/content/ContentDetailsPage.js +206 -0
  49. package/dist/headshotmarketing/pages/content/ContentDetailsPage.js.map +1 -0
  50. package/dist/headshotmarketing/pages/content/ContentLibraryCard.d.ts +2 -0
  51. package/dist/headshotmarketing/pages/content/ContentLibraryCard.d.ts.map +1 -1
  52. package/dist/headshotmarketing/pages/content/ContentLibraryCard.js +47 -34
  53. package/dist/headshotmarketing/pages/content/ContentLibraryCard.js.map +1 -1
  54. package/dist/headshotmarketing/pages/content/ContentPage.d.ts.map +1 -1
  55. package/dist/headshotmarketing/pages/content/ContentPage.js +4 -2
  56. package/dist/headshotmarketing/pages/content/ContentPage.js.map +1 -1
  57. package/dist/headshotmarketing/pages/crm/CreateDealPage.d.ts.map +1 -1
  58. package/dist/headshotmarketing/pages/crm/CreateDealPage.js +233 -195
  59. package/dist/headshotmarketing/pages/crm/CreateDealPage.js.map +1 -1
  60. package/dist/headshotmarketing/pages/crm/CreatePipelineModal.d.ts +10 -0
  61. package/dist/headshotmarketing/pages/crm/CreatePipelineModal.d.ts.map +1 -0
  62. package/dist/headshotmarketing/pages/crm/CreatePipelineModal.js +157 -0
  63. package/dist/headshotmarketing/pages/crm/CreatePipelineModal.js.map +1 -0
  64. package/dist/headshotmarketing/pages/crm/PipelinePage.d.ts.map +1 -1
  65. package/dist/headshotmarketing/pages/crm/PipelinePage.js +87 -76
  66. package/dist/headshotmarketing/pages/crm/PipelinePage.js.map +1 -1
  67. package/dist/headshotmarketing/pages/crm/createPipelineForm.d.ts +34 -0
  68. package/dist/headshotmarketing/pages/crm/createPipelineForm.d.ts.map +1 -0
  69. package/dist/headshotmarketing/pages/crm/createPipelineForm.js +49 -0
  70. package/dist/headshotmarketing/pages/crm/createPipelineForm.js.map +1 -0
  71. package/dist/headshotmarketing/pages/influencers/InfluencerDiscoveryPage.d.ts.map +1 -1
  72. package/dist/headshotmarketing/pages/influencers/InfluencerDiscoveryPage.js +150 -135
  73. package/dist/headshotmarketing/pages/influencers/InfluencerDiscoveryPage.js.map +1 -1
  74. package/dist/headshotmarketing/pages/influencers/createInfluencerForm.d.ts +53 -0
  75. package/dist/headshotmarketing/pages/influencers/createInfluencerForm.d.ts.map +1 -0
  76. package/dist/headshotmarketing/pages/influencers/createInfluencerForm.js +107 -0
  77. package/dist/headshotmarketing/pages/influencers/createInfluencerForm.js.map +1 -0
  78. package/dist/headshotmarketing/pages/social-media/createSocialAccountForm.d.ts.map +1 -1
  79. package/dist/headshotmarketing/pages/social-media/createSocialAccountForm.js.map +1 -1
  80. package/dist/headshotmarketing/store/headshotMarketingStore.d.ts +5 -5
  81. package/dist/headshotmarketing/store/headshotMarketingStore.d.ts.map +1 -1
  82. package/dist/headshotmarketing/store/headshotMarketingStore.js +28 -13
  83. package/dist/headshotmarketing/store/headshotMarketingStore.js.map +1 -1
  84. package/dist/headshotmarketing/types/index.d.ts.map +1 -1
  85. package/dist/headshotmarketing/utils/dashboardWidgets.d.ts +46 -0
  86. package/dist/headshotmarketing/utils/dashboardWidgets.d.ts.map +1 -0
  87. package/dist/headshotmarketing/utils/dashboardWidgets.js +54 -0
  88. package/dist/headshotmarketing/utils/dashboardWidgets.js.map +1 -0
  89. package/dist/index.js +3 -3
  90. package/dist/types/assistant.d.ts.map +1 -1
  91. package/package.json +1 -1
@@ -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 { 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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aAEJ;cAhDC,EAAK,GAgDN,CACN;WAEA,CAAA,CACF;;SACF,EArFI,EAAY,MAqFhB;SAER;OACE,CAAA;MACF,CAAA;KACa;;GACV"}
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 { useState, type FC } from \"react\";\nimport { Plus, DollarSign, Calendar, User, GitBranch } 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 { CreatePipelineModal } from \"./CreatePipelineModal\";\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 const [showCreatePipeline, setShowCreatePipeline] = useState(false);\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 <>\n <button\n onClick={() => setShowCreatePipeline(true)}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-seam bg-gloss-card shadow-pop px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n <GitBranch className=\"h-4 w-4\" />\n New pipeline\n </button>\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 >\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\n <CreatePipelineModal\n open={showCreatePipeline}\n onClose={() => setShowCreatePipeline(false)}\n onCreated={() => refetch()}\n />\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,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,EACnE,CAAC,GAAoB,KAAyB,EAAS,GAAM,EAE7D,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,EA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CACF;;aAEJ;cAhDC,EAAK,GAgDN,CACN;WAEA,CAAA,CACF;;SACF,EArFI,EAAY,MAqFhB;SAER;OACE,CAAA;MACF,CAAA;KACa;;GAErB,kBAAC,GAAD;IACE,MAAM;IACN,eAAe,EAAsB,GAAM;IAC3C,iBAAiB,GAAS;IAC1B,CAAA;GACS"}
@@ -0,0 +1,34 @@
1
+ import { CreateHeadshotmarketingPipelineInput, CreateHeadshotmarketingPipelineStageInput } from '../../../generated/wspace-types';
2
+
3
+ /** Sensible default stages from the CRM spec — editable in the form. */
4
+ export declare const DEFAULT_PIPELINE_STAGES: readonly string[];
5
+ export interface PipelineForm {
6
+ name: string;
7
+ description: string;
8
+ /** Ordered stage names; blanks are dropped when the input is built. */
9
+ stages: string[];
10
+ }
11
+ export declare const EMPTY_PIPELINE_FORM: PipelineForm;
12
+ /** Trimmed, non-empty stage names in their original order. */
13
+ export declare function cleanStageNames(stages: string[]): string[];
14
+ /**
15
+ * A linear win-probability ramp across the stages: the first stage sits at 0%
16
+ * and the last at 100%, so a freshly-created pipeline carries sensible per-stage
17
+ * defaults without the user having to set each one.
18
+ */
19
+ export declare function stageProbability(index: number, stageCount: number): number;
20
+ export type BuildResult<T> = {
21
+ ok: true;
22
+ value: T;
23
+ } | {
24
+ ok: false;
25
+ error: string;
26
+ };
27
+ /** Validate the pipeline name and build the create-pipeline input. */
28
+ export declare function buildPipelineInput(form: PipelineForm): BuildResult<CreateHeadshotmarketingPipelineInput>;
29
+ /**
30
+ * Build the ordered stage inputs for a created pipeline. Pure so the ordering
31
+ * and probability ramp can be asserted without a network round-trip.
32
+ */
33
+ export declare function buildStageInputs(pipelineId: string, stages: string[]): CreateHeadshotmarketingPipelineStageInput[];
34
+ //# sourceMappingURL=createPipelineForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPipelineForm.d.ts","sourceRoot":"","sources":["../../../../src/headshotmarketing/pages/crm/createPipelineForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,oCAAoC,EACpC,yCAAyC,EAC1C,MAAM,iCAAiC,CAAC;AAEzC,wEAAwE;AACxE,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAOpD,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,eAAO,MAAM,mBAAmB,EAAE,YAIjC,CAAC;AAEF,8DAA8D;AAC9D,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAG1E;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,IACrB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GACtB;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjC,sEAAsE;AACtE,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,YAAY,GACjB,WAAW,CAAC,oCAAoC,CAAC,CAgBnD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EAAE,GACf,yCAAyC,EAAE,CAS7C"}
@@ -0,0 +1,49 @@
1
+ var e = {
2
+ name: "",
3
+ description: "",
4
+ stages: [...[
5
+ "Lead In",
6
+ "Qualified",
7
+ "Proposal",
8
+ "Negotiation",
9
+ "Won",
10
+ "Lost"
11
+ ]]
12
+ };
13
+ function t(e) {
14
+ return e.map((e) => e.trim()).filter(Boolean);
15
+ }
16
+ function n(e, t) {
17
+ return t <= 1 ? 0 : Math.round(e / (t - 1) * 100);
18
+ }
19
+ function r(e) {
20
+ let n = e.name.trim();
21
+ return n ? t(e.stages).length === 0 ? {
22
+ ok: !1,
23
+ error: "Add at least one stage."
24
+ } : {
25
+ ok: !0,
26
+ value: {
27
+ name: n,
28
+ description: e.description.trim() || null,
29
+ isActive: !0
30
+ }
31
+ } : {
32
+ ok: !1,
33
+ error: "Pipeline name is required."
34
+ };
35
+ }
36
+ function i(e, r) {
37
+ let i = t(r);
38
+ return i.map((t, r) => ({
39
+ pipelineId: e,
40
+ name: t,
41
+ order: r,
42
+ defaultProbability: n(r, i.length),
43
+ isActive: !0
44
+ }));
45
+ }
46
+ //#endregion
47
+ export { e as EMPTY_PIPELINE_FORM, r as buildPipelineInput, i as buildStageInputs };
48
+
49
+ //# sourceMappingURL=createPipelineForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPipelineForm.js","names":[],"sources":["../../../../src/headshotmarketing/pages/crm/createPipelineForm.ts"],"sourcesContent":["/**\n * Pure form model + validation for the \"New pipeline\" flow.\n *\n * Kept free of React/DOM so the pipeline + stage input shapes and validation\n * can be unit-tested in isolation. A pipeline is created first, then each stage\n * is created against the returned pipeline id (the backend exposes pipeline and\n * stage creation as separate mutations), so this module builds both shapes.\n *\n * @module headshotmarketing/pages/crm\n */\n\nimport type {\n CreateHeadshotmarketingPipelineInput,\n CreateHeadshotmarketingPipelineStageInput,\n} from \"../../../generated/wspace-types\";\n\n/** Sensible default stages from the CRM spec — editable in the form. */\nexport const DEFAULT_PIPELINE_STAGES: readonly string[] = [\n \"Lead In\",\n \"Qualified\",\n \"Proposal\",\n \"Negotiation\",\n \"Won\",\n \"Lost\",\n];\n\nexport interface PipelineForm {\n name: string;\n description: string;\n /** Ordered stage names; blanks are dropped when the input is built. */\n stages: string[];\n}\n\nexport const EMPTY_PIPELINE_FORM: PipelineForm = {\n name: \"\",\n description: \"\",\n stages: [...DEFAULT_PIPELINE_STAGES],\n};\n\n/** Trimmed, non-empty stage names in their original order. */\nexport function cleanStageNames(stages: string[]): string[] {\n return stages.map((s) => s.trim()).filter(Boolean);\n}\n\n/**\n * A linear win-probability ramp across the stages: the first stage sits at 0%\n * and the last at 100%, so a freshly-created pipeline carries sensible per-stage\n * defaults without the user having to set each one.\n */\nexport function stageProbability(index: number, stageCount: number): number {\n if (stageCount <= 1) return 0;\n return Math.round((index / (stageCount - 1)) * 100);\n}\n\nexport type BuildResult<T> =\n | { ok: true; value: T }\n | { ok: false; error: string };\n\n/** Validate the pipeline name and build the create-pipeline input. */\nexport function buildPipelineInput(\n form: PipelineForm,\n): BuildResult<CreateHeadshotmarketingPipelineInput> {\n const name = form.name.trim();\n if (!name) {\n return { ok: false, error: \"Pipeline name is required.\" };\n }\n if (cleanStageNames(form.stages).length === 0) {\n return { ok: false, error: \"Add at least one stage.\" };\n }\n return {\n ok: true,\n value: {\n name,\n description: form.description.trim() || null,\n isActive: true,\n },\n };\n}\n\n/**\n * Build the ordered stage inputs for a created pipeline. Pure so the ordering\n * and probability ramp can be asserted without a network round-trip.\n */\nexport function buildStageInputs(\n pipelineId: string,\n stages: string[],\n): CreateHeadshotmarketingPipelineStageInput[] {\n const names = cleanStageNames(stages);\n return names.map((name, index) => ({\n pipelineId,\n name,\n order: index,\n defaultProbability: stageProbability(index, names.length),\n isActive: true,\n }));\n}\n"],"mappings":"AAiCA,IAAa,IAAoC;CAC/C,MAAM;CACN,aAAa;CACb,QAAQ,CAAC,GAnB+C;EACxD;EACA;EACA;EACA;EACA;EACA;EACD,CAYqC;CACrC;AAGD,SAAgB,EAAgB,GAA4B;AAC1D,QAAO,EAAO,KAAK,MAAM,EAAE,MAAM,CAAC,CAAC,OAAO,QAAQ;;AAQpD,SAAgB,EAAiB,GAAe,GAA4B;AAE1E,QADI,KAAc,IAAU,IACrB,KAAK,MAAO,KAAS,IAAa,KAAM,IAAI;;AAQrD,SAAgB,EACd,GACmD;CACnD,IAAM,IAAO,EAAK,KAAK,MAAM;AAO7B,QANK,IAGD,EAAgB,EAAK,OAAO,CAAC,WAAW,IACnC;EAAE,IAAI;EAAO,OAAO;EAA2B,GAEjD;EACL,IAAI;EACJ,OAAO;GACL;GACA,aAAa,EAAK,YAAY,MAAM,IAAI;GACxC,UAAU;GACX;EACF,GAZQ;EAAE,IAAI;EAAO,OAAO;EAA8B;;AAmB7D,SAAgB,EACd,GACA,GAC6C;CAC7C,IAAM,IAAQ,EAAgB,EAAO;AACrC,QAAO,EAAM,KAAK,GAAM,OAAW;EACjC;EACA;EACA,OAAO;EACP,oBAAoB,EAAiB,GAAO,EAAM,OAAO;EACzD,UAAU;EACX,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"InfluencerDiscoveryPage.d.ts","sourceRoot":"","sources":["../../../../src/headshotmarketing/pages/influencers/InfluencerDiscoveryPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAmC9D,eAAO,MAAM,uBAAuB,EAAE,EAiZrC,CAAC"}
1
+ {"version":3,"file":"InfluencerDiscoveryPage.d.ts","sourceRoot":"","sources":["../../../../src/headshotmarketing/pages/influencers/InfluencerDiscoveryPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAoC9D,eAAO,MAAM,uBAAuB,EAAE,EA4arC,CAAC"}