@burdenoff/microfe-headshotmarketing 2026.1205.1 → 2026.1206.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/global-types.d.ts +3589 -380
- package/dist/generated/wspace-operations.d.ts +101 -3
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +61782 -2332
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/headshotmarketing/components/EntityTagPicker.js +29 -28
- package/dist/headshotmarketing/components/EntityTagPicker.js.map +1 -1
- package/dist/headshotmarketing/components/InfluencerModals.js +264 -263
- package/dist/headshotmarketing/components/InfluencerModals.js.map +1 -1
- package/dist/headshotmarketing/components/QueryStateBoundary.js +31 -22
- package/dist/headshotmarketing/components/QueryStateBoundary.js.map +1 -1
- package/dist/headshotmarketing/components/StatusBadge.js +1 -1
- package/dist/headshotmarketing/components/StatusBadge.js.map +1 -1
- package/dist/headshotmarketing/components/Toast.js +3 -3
- package/dist/headshotmarketing/components/Toast.js.map +1 -1
- package/dist/headshotmarketing/components/TrackedLinksPanel.js +97 -96
- package/dist/headshotmarketing/components/TrackedLinksPanel.js.map +1 -1
- package/dist/headshotmarketing/hooks/useAssetUpload.js +41 -40
- package/dist/headshotmarketing/hooks/useAssetUpload.js.map +1 -1
- package/dist/headshotmarketing/pages/HomePage.js +6 -6
- package/dist/headshotmarketing/pages/HomePage.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdBudgetAiPanel.js +47 -46
- package/dist/headshotmarketing/pages/ads/AdBudgetAiPanel.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdCampaignDetailsPage.js +66 -65
- package/dist/headshotmarketing/pages/ads/AdCampaignDetailsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdCampaignsPage.js +273 -272
- package/dist/headshotmarketing/pages/ads/AdCampaignsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdCreativeTestsSection.js +3 -3
- package/dist/headshotmarketing/pages/ads/AdCreativeTestsSection.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdCreativesPage.js +125 -124
- package/dist/headshotmarketing/pages/ads/AdCreativesPage.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdPlatformConnectionsSection.js +33 -32
- package/dist/headshotmarketing/pages/ads/AdPlatformConnectionsSection.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdPlatformSyncPanel.js +108 -107
- package/dist/headshotmarketing/pages/ads/AdPlatformSyncPanel.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdReachEstimatePanel.js +65 -60
- package/dist/headshotmarketing/pages/ads/AdReachEstimatePanel.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AdsPage.js +4 -4
- package/dist/headshotmarketing/pages/ads/AdsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/AudiencesPage.js +287 -286
- package/dist/headshotmarketing/pages/ads/AudiencesPage.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/CreateAdCampaignPage.js +59 -54
- package/dist/headshotmarketing/pages/ads/CreateAdCampaignPage.js.map +1 -1
- package/dist/headshotmarketing/pages/ads/CreateAudiencePage.js +96 -95
- package/dist/headshotmarketing/pages/ads/CreateAudiencePage.js.map +1 -1
- package/dist/headshotmarketing/pages/ai/AiDecisionCard.js +5 -5
- package/dist/headshotmarketing/pages/ai/AiDecisionCard.js.map +1 -1
- package/dist/headshotmarketing/pages/ai/AiOperationsPage.js +179 -178
- package/dist/headshotmarketing/pages/ai/AiOperationsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/analytics/ReportScheduleDialog.js +156 -151
- package/dist/headshotmarketing/pages/analytics/ReportScheduleDialog.js.map +1 -1
- package/dist/headshotmarketing/pages/analytics/ReportsPage.js +222 -217
- package/dist/headshotmarketing/pages/analytics/ReportsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/analytics/TouchpointLedgerCard.js +59 -58
- package/dist/headshotmarketing/pages/analytics/TouchpointLedgerCard.js.map +1 -1
- package/dist/headshotmarketing/pages/analytics/analyticsWidgets.js +152 -151
- package/dist/headshotmarketing/pages/analytics/analyticsWidgets.js.map +1 -1
- package/dist/headshotmarketing/pages/automation/AutomationPage.js +34 -33
- package/dist/headshotmarketing/pages/automation/AutomationPage.js.map +1 -1
- package/dist/headshotmarketing/pages/automation/TriggersPage.js +6 -6
- package/dist/headshotmarketing/pages/automation/TriggersPage.js.map +1 -1
- package/dist/headshotmarketing/pages/automation/WorkflowActions.js +1 -1
- package/dist/headshotmarketing/pages/automation/WorkflowActions.js.map +1 -1
- package/dist/headshotmarketing/pages/automation/WorkflowBuilderPage.js +235 -234
- package/dist/headshotmarketing/pages/automation/WorkflowBuilderPage.js.map +1 -1
- package/dist/headshotmarketing/pages/automation/WorkflowRunsPanel.js +24 -23
- package/dist/headshotmarketing/pages/automation/WorkflowRunsPanel.js.map +1 -1
- package/dist/headshotmarketing/pages/automation/WorkflowsPage.js +1 -1
- package/dist/headshotmarketing/pages/automation/WorkflowsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/automation/workflowBuilderModel.js +4 -4
- package/dist/headshotmarketing/pages/automation/workflowBuilderModel.js.map +1 -1
- package/dist/headshotmarketing/pages/builder/LandingPageBuilderPage.js +339 -338
- package/dist/headshotmarketing/pages/builder/LandingPageBuilderPage.js.map +1 -1
- package/dist/headshotmarketing/pages/campaigns/CampaignAiPanel.js +95 -94
- package/dist/headshotmarketing/pages/campaigns/CampaignAiPanel.js.map +1 -1
- package/dist/headshotmarketing/pages/campaigns/CampaignDetailsPage.js +82 -81
- package/dist/headshotmarketing/pages/campaigns/CampaignDetailsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/campaigns/CampaignTemplatesPage.js +107 -106
- package/dist/headshotmarketing/pages/campaigns/CampaignTemplatesPage.js.map +1 -1
- package/dist/headshotmarketing/pages/campaigns/CampaignsPage.js +104 -103
- package/dist/headshotmarketing/pages/campaigns/CampaignsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/campaigns/CreateCampaignPage.js +262 -261
- package/dist/headshotmarketing/pages/campaigns/CreateCampaignPage.js.map +1 -1
- package/dist/headshotmarketing/pages/campaigns/CreateTemplateModal.js +68 -67
- package/dist/headshotmarketing/pages/campaigns/CreateTemplateModal.js.map +1 -1
- package/dist/headshotmarketing/pages/content/AIToolsPage.js +204 -203
- package/dist/headshotmarketing/pages/content/AIToolsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/content/AssetLibraryPage.js +177 -176
- package/dist/headshotmarketing/pages/content/AssetLibraryPage.js.map +1 -1
- package/dist/headshotmarketing/pages/content/ContentCreationPage.js +373 -372
- package/dist/headshotmarketing/pages/content/ContentCreationPage.js.map +1 -1
- package/dist/headshotmarketing/pages/content/ContentDetailsPage.js +1 -1
- package/dist/headshotmarketing/pages/content/ContentDetailsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/content/ContentLibraryCard.js +4 -4
- package/dist/headshotmarketing/pages/content/ContentLibraryCard.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/ConvertLeadButton.js +51 -50
- package/dist/headshotmarketing/pages/crm/ConvertLeadButton.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/CreateContactPage.js +100 -99
- package/dist/headshotmarketing/pages/crm/CreateContactPage.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/CreateDealPage.js +134 -133
- package/dist/headshotmarketing/pages/crm/CreateDealPage.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/CreatePipelineModal.js +66 -65
- package/dist/headshotmarketing/pages/crm/CreatePipelineModal.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/CrmActions.js +229 -228
- package/dist/headshotmarketing/pages/crm/CrmActions.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/DealNextActionPanel.js +62 -61
- package/dist/headshotmarketing/pages/crm/DealNextActionPanel.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/LeadAiDecisionPanel.js +126 -125
- package/dist/headshotmarketing/pages/crm/LeadAiDecisionPanel.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/LeadCreateModal.js +93 -92
- package/dist/headshotmarketing/pages/crm/LeadCreateModal.js.map +1 -1
- package/dist/headshotmarketing/pages/crm/PipelinePage.js +5 -5
- package/dist/headshotmarketing/pages/crm/PipelinePage.js.map +1 -1
- package/dist/headshotmarketing/pages/events/CreateEventPage.js +127 -126
- package/dist/headshotmarketing/pages/events/CreateEventPage.js.map +1 -1
- package/dist/headshotmarketing/pages/events/EventDetailsPage.js +76 -75
- package/dist/headshotmarketing/pages/events/EventDetailsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/influencers/InfluencerDiscoveryPage.js +8 -8
- package/dist/headshotmarketing/pages/influencers/InfluencerDiscoveryPage.js.map +1 -1
- package/dist/headshotmarketing/pages/influencers/InfluencersPage.js +4 -4
- package/dist/headshotmarketing/pages/influencers/InfluencersPage.js.map +1 -1
- package/dist/headshotmarketing/pages/influencers/RelationshipsPage.js +4 -4
- package/dist/headshotmarketing/pages/influencers/RelationshipsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/seo/SeoScorePanel.js +1 -1
- package/dist/headshotmarketing/pages/seo/SeoScorePanel.js.map +1 -1
- package/dist/headshotmarketing/pages/seo/SeoToolsPage.js +104 -103
- package/dist/headshotmarketing/pages/seo/SeoToolsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/social-media/AccountsPage.js +102 -101
- package/dist/headshotmarketing/pages/social-media/AccountsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/social-media/CreateAccountPage.js +59 -58
- package/dist/headshotmarketing/pages/social-media/CreateAccountPage.js.map +1 -1
- package/dist/headshotmarketing/pages/social-media/MediaDropZone.js +1 -1
- package/dist/headshotmarketing/pages/social-media/MediaDropZone.js.map +1 -1
- package/dist/headshotmarketing/pages/social-media/PostsPage.js +103 -102
- package/dist/headshotmarketing/pages/social-media/PostsPage.js.map +1 -1
- package/dist/headshotmarketing/pages/social-media/SocialMediaComposePage.js +123 -122
- package/dist/headshotmarketing/pages/social-media/SocialMediaComposePage.js.map +1 -1
- package/dist/headshotmarketing/pages/social-media/SocialMediaPage.js +4 -4
- package/dist/headshotmarketing/pages/social-media/SocialMediaPage.js.map +1 -1
- package/dist/headshotmarketing/utils/index.d.ts +1 -0
- package/dist/headshotmarketing/utils/readableError.d.ts +16 -0
- package/dist/headshotmarketing/utils/readableError.js +12 -0
- package/dist/headshotmarketing/utils/readableError.js.map +1 -0
- package/package.json +5 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentDetailsPage.js","names":["EmptyState","EmptyState$1","seoTone","score","ContentDetailsPage","useHeadshotMarketing","id","useParams","refetchBootstrap","useHeadshotmarketingBootstrap","useHeadshotmarketingContentItemDetailQuery","raw","data","item","toContentItemModel","bodyText","htmlToPlainText","backToLibrary","navigate","basePath","openEditor","PageLayout","QueryStateBoundary","refetch","ArrowLeft","authorName","currentUser","dateInfo","StatusBadge","AIGeneratedBadge","Pencil","ContentItemActionsMenu","PagePurpose","EmphasisPanel","StatCard","formatNumber","Eye","Share2","MousePointerClick","Gauge","contentTypeLabel","Calendar","formatDate","FileText","Clock","cn","tag","EntityTagPicker"],"sources":["../../../../src/headshotmarketing/pages/content/ContentDetailsPage.tsx"],"sourcesContent":["/**\n * Content Details Page\n *\n * Detail view for a single content-library item. The item is loaded by id\n * (`headshotmarketingContentItem`) so every item in a server-paginated library\n * can be opened, not only the ones inside the bootstrap window (BOFF-10245).\n *\n * @module headshotmarketing/pages/content\n */\n\nimport type { FC } from \"react\";\nimport { useParams } from \"react-router\";\nimport {\n ArrowLeft,\n Calendar,\n Eye,\n Share2,\n MousePointerClick,\n Gauge,\n FileText,\n Clock,\n Pencil,\n} from \"lucide-react\";\nimport { useHeadshotmarketingContentItemDetailQuery } from \"../../../generated/wspace-operations\";\nimport {\n PageLayout,\n StatCard,\n StatusBadge,\n EmptyState,\n EntityTagPicker,\n QueryStateBoundary,\n} from \"../../components\";\nimport { EmphasisPanel, PagePurpose } from \"@burdenoff/fe-libs/ui\";\nimport { cn, formatDate, formatNumber } from \"../../utils/helpers\";\nimport { toContentItemModel } from \"../../utils/contentMapper\";\nimport { contentTypeLabel, htmlToPlainText } from \"../../utils/contentLibrary\";\nimport { useHeadshotMarketing } from \"../../context/HeadshotMarketingContext\";\nimport { useHeadshotmarketingBootstrap } from \"../../hooks/useHeadshotmarketingBootstrap\";\nimport { ContentItemActionsMenu } from \"./ContentItemActions\";\nimport { AIGeneratedBadge } from \"./AIGeneratedBadge\";\n\n/** Colour the SEO pill by score band — semantic tokens only. */\nfunction seoTone(score: number): string {\n if (score >= 80)\n return \"bg-status-success-bg text-status-success-text border-status-success-border\";\n if (score >= 50)\n return \"bg-status-warning-bg text-status-warning-text border-status-warning-border\";\n return \"bg-bg-sunken text-text-secondary border-border-subtle\";\n}\n\nexport const ContentDetailsPage: FC = () => {\n const { navigate, basePath, currentUser } = useHeadshotMarketing();\n const { contentId: id } = useParams<{ contentId: string }>();\n const { refetch: refetchBootstrap } = useHeadshotmarketingBootstrap();\n const { data, loading, error, refetch } =\n useHeadshotmarketingContentItemDetailQuery({\n variables: { id: id ?? \"\" },\n skip: !id,\n fetchPolicy: \"cache-and-network\",\n });\n\n // The row keeps `scheduledAt`/`slug`/`type`, which the shared mapper drops.\n const raw = data?.headshotmarketingContentItem ?? null;\n const item = raw ? toContentItemModel(raw) : null;\n const bodyText = raw?.body ? htmlToPlainText(raw.body) : \"\";\n\n const backToLibrary = (): void => navigate(basePath + \"/content\");\n const openEditor = (): void =>\n navigate(basePath + \"/content/\" + (id ?? \"\") + \"/edit\");\n\n if (!item || !raw) {\n return (\n <PageLayout title=\"Content\">\n <QueryStateBoundary\n loading={loading}\n error={error}\n onRetry={() => void refetch()}\n hasData={Boolean(data)}\n >\n <EmptyState\n illustration=\"empty-files\"\n title=\"Content not found\"\n description=\"This content item doesn't exist or has been removed.\"\n action={\n <button\n onClick={backToLibrary}\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 <ArrowLeft className=\"h-4 w-4\" />\n Back to Content\n </button>\n }\n />\n </QueryStateBoundary>\n </PageLayout>\n );\n }\n\n const authorName =\n currentUser && item.author === currentUser.id\n ? currentUser.name ||\n [currentUser.firstName, currentUser.lastName]\n .filter(Boolean)\n .join(\" \")\n .trim() ||\n currentUser.email\n : \"Team member\";\n\n const dateInfo = raw.scheduledAt\n ? { label: \"Scheduled\", value: raw.scheduledAt }\n : item.publishedAt\n ? { label: \"Published\", value: item.publishedAt }\n : { label: \"Created\", value: item.createdAt };\n\n return (\n <PageLayout\n title={item.title}\n description={item.description || undefined}\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n <StatusBadge status={item.status} />\n <AIGeneratedBadge provenance={item.aiProvenance} />\n <button\n type=\"button\"\n onClick={openEditor}\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 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n >\n <Pencil className=\"h-4 w-4\" />\n Edit\n </button>\n <button\n type=\"button\"\n onClick={backToLibrary}\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 <ArrowLeft className=\"h-4 w-4\" />\n Back\n </button>\n <ContentItemActionsMenu\n item={item}\n align=\"right\"\n onEdit={openEditor}\n onPublished={async () => {\n await Promise.all([refetch(), refetchBootstrap()]);\n }}\n onDeleted={async () => {\n await refetchBootstrap();\n backToLibrary();\n }}\n />\n </div>\n }\n >\n <PagePurpose>\n The full record for this content item — its type and status, the metrics\n it has earned, and its body. Use Edit to change the copy, settings or\n status.\n </PagePurpose>\n\n {/* Performance metrics — primary emphasis zone */}\n <EmphasisPanel>\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-4\">\n <StatCard\n title=\"Views\"\n value={formatNumber(item.metrics.views)}\n icon={<Eye className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Shares\"\n value={formatNumber(item.metrics.shares)}\n icon={<Share2 className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Conversions\"\n value={formatNumber(item.metrics.conversions)}\n icon={<MousePointerClick className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Engagement\"\n value={formatNumber(item.metrics.engagement)}\n icon={<Gauge className=\"h-5 w-5\" />}\n />\n </div>\n </EmphasisPanel>\n\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Metadata */}\n <div className=\"rounded-lg border border-border-seam bg-gloss-card p-5 shadow-pop lg:col-span-1\">\n <h4 className=\"mb-3 text-sm font-semibold text-text-primary\">\n Details\n </h4>\n <dl className=\"space-y-3 text-sm\">\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">Type</dt>\n <dd className=\"font-medium text-text-primary\">\n {contentTypeLabel(raw.type)}\n </dd>\n </div>\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">Author</dt>\n <dd className=\"truncate font-medium text-text-primary\">\n {authorName}\n </dd>\n </div>\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"inline-flex items-center gap-1.5 text-text-secondary\">\n <Calendar className=\"h-3.5 w-3.5\" />\n {dateInfo.label}\n </dt>\n <dd className=\"font-medium text-text-primary\">\n {formatDate(dateInfo.value)}\n </dd>\n </div>\n {raw.slug && (\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">Slug</dt>\n <dd className=\"truncate font-medium text-text-primary\">\n {raw.slug}\n </dd>\n </div>\n )}\n {item.wordCount > 0 && (\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"inline-flex items-center gap-1.5 text-text-secondary\">\n <FileText className=\"h-3.5 w-3.5\" />\n Word count\n </dt>\n <dd className=\"font-medium tabular-nums text-text-primary\">\n {formatNumber(item.wordCount)}\n </dd>\n </div>\n )}\n {item.readTime > 0 && (\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"inline-flex items-center gap-1.5 text-text-secondary\">\n <Clock className=\"h-3.5 w-3.5\" />\n Read time\n </dt>\n <dd className=\"font-medium tabular-nums text-text-primary\">\n {item.readTime} min\n </dd>\n </div>\n )}\n {item.seoScore > 0 && (\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">SEO score</dt>\n <dd>\n <span\n className={cn(\n \"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-[11px] font-semibold tabular-nums\",\n seoTone(item.seoScore),\n )}\n >\n <Gauge className=\"h-3 w-3\" />\n {item.seoScore}\n </span>\n </dd>\n </div>\n )}\n </dl>\n\n {item.aiProvenance && (\n <div\n className=\"mt-4 border-t border-border-subtle pt-4\"\n data-testid=\"ai-provenance-details\"\n >\n <p className=\"mb-2 text-xs font-medium text-text-secondary\">\n AI provenance\n </p>\n <dl className=\"space-y-2 text-xs\">\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">Disclosure</dt>\n <dd className=\"text-end font-medium text-text-primary\">\n {item.aiProvenance.disclosure}\n </dd>\n </div>\n {item.aiProvenance.provider && (\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">Model</dt>\n <dd className=\"truncate text-end font-medium text-text-primary\">\n {[item.aiProvenance.provider, item.aiProvenance.model]\n .filter(Boolean)\n .join(\" / \")}\n </dd>\n </div>\n )}\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">Generated</dt>\n <dd className=\"font-medium text-text-primary\">\n {formatDate(item.aiProvenance.generatedAt)}\n </dd>\n </div>\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">Source type</dt>\n <dd className=\"truncate text-end font-mono text-[11px] text-text-primary\">\n {item.aiProvenance.digitalSourceType}\n </dd>\n </div>\n </dl>\n </div>\n )}\n\n {item.tags.length > 0 && (\n <div className=\"mt-4 border-t border-border-subtle pt-4\">\n <p className=\"mb-2 text-xs font-medium text-text-secondary\">\n Content labels\n </p>\n <div className=\"flex flex-wrap gap-1.5\">\n {item.tags.map((tag) => (\n <span\n key={tag}\n className=\"inline-flex items-center rounded-md bg-bg-sunken px-2 py-0.5 text-[11px] font-medium text-text-secondary\"\n >\n {tag}\n </span>\n ))}\n </div>\n </div>\n )}\n\n <div className=\"mt-4 border-t border-border-subtle pt-4\">\n <EntityTagPicker\n entityType=\"HEADSHOTMARKETING_CONTENT_ITEM\"\n entityId={item.id}\n />\n </div>\n </div>\n\n {/* Body */}\n <div className=\"rounded-lg border border-border-seam bg-gloss-card p-5 shadow-pop lg:col-span-2\">\n <h4 className=\"mb-3 text-sm font-semibold text-text-primary\">\n Content\n </h4>\n {bodyText ? (\n <p className=\"whitespace-pre-wrap text-sm leading-relaxed text-text-primary\">\n {bodyText}\n </p>\n ) : (\n <p className=\"py-8 text-center text-sm text-text-secondary\">\n This item has no body content yet.\n </p>\n )}\n </div>\n </div>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0CA,SAASE,EAAQ,GAAuB;CAKtC,OAJIC,KAAS,KACJ,+EACLA,KAAS,KACJ,+EACF;AACT;AAEA,IAAaC,UAA+B;CAC1C,IAAM,EAAE,aAAU,aAAU,mBAAgBC,EAAqB,GAC3D,EAAE,WAAWC,MAAOC,EAAiC,GACrD,EAAE,SAASC,MAAqBC,EAA8B,GAC9D,EAAE,SAAM,YAAS,UAAO,eAC5BC,EAA2C;EACzC,WAAW,EAAE,IAAIJ,KAAM,GAAG;EAC1B,MAAM,CAACA;EACP,aAAa;CACf,CAAC,GAGGK,IAAMC,GAAM,gCAAgC,MAC5CC,IAAOF,IAAMG,EAAmBH,CAAG,IAAI,MACvCI,IAAWJ,GAAK,OAAOK,EAAgBL,EAAI,IAAI,IAAI,IAEnDM,UAA4BC,EAASC,IAAW,UAAU,GAC1DC,UACJF,EAASC,IAAW,eAAeb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,UAAA,CACE,kBAAC,KAAD;QAAG,WAAU;QAA+C,UAAA;OAEzD,CAAA,GACH,kBAAC,OAAD;QAAK,WAAU;QACZ,UAAAA,EAAK,KAAK,KAAK,MACd,kBAAC,QAAD;SAEE,WAAU;SAET,UAAAiC;QACG,GAJCA,CAID,CACP;OACE,CAAA,CACF;;MAGP,kBAAC,OAAD;OAAK,WAAU;OACb,UAAA,kBAACC,GAAD;QACE,YAAW;QACX,UAAUlC,EAAK;OAChB,CAAA;MACE,CAAA;KACF;IAGL,CAAA,GAAA,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,MAAD;MAAI,WAAU;MAA+C,UAAA;KAEzD,CAAA,GACHE,IACC,kBAAC,KAAD;MAAG,WAAU;MACV,UAAAA;KACA,CAAA,IAEH,kBAAC,KAAD;MAAG,WAAU;MAA+C,UAAA;KAEzD,CAAA,CAEF;IACF,CAAA,CAAA;;EACK;;AAEhB"}
|
|
1
|
+
{"version":3,"file":"ContentDetailsPage.js","names":["EmptyState","EmptyState$1","seoTone","score","ContentDetailsPage","useHeadshotMarketing","id","useParams","refetchBootstrap","useHeadshotmarketingBootstrap","useHeadshotmarketingContentItemDetailQuery","raw","data","item","toContentItemModel","bodyText","htmlToPlainText","backToLibrary","navigate","basePath","openEditor","PageLayout","QueryStateBoundary","refetch","ArrowLeft","authorName","currentUser","dateInfo","StatusBadge","AIGeneratedBadge","Pencil","ContentItemActionsMenu","PagePurpose","EmphasisPanel","StatCard","formatNumber","Eye","Share2","MousePointerClick","Gauge","contentTypeLabel","Calendar","formatDate","FileText","Clock","cn","tag","EntityTagPicker"],"sources":["../../../../src/headshotmarketing/pages/content/ContentDetailsPage.tsx"],"sourcesContent":["/**\n * Content Details Page\n *\n * Detail view for a single content-library item. The item is loaded by id\n * (`headshotmarketingContentItem`) so every item in a server-paginated library\n * can be opened, not only the ones inside the bootstrap window (BOFF-10245).\n *\n * @module headshotmarketing/pages/content\n */\n\nimport type { FC } from \"react\";\nimport { useParams } from \"react-router\";\nimport {\n ArrowLeft,\n Calendar,\n Eye,\n Share2,\n MousePointerClick,\n Gauge,\n FileText,\n Clock,\n Pencil,\n} from \"lucide-react\";\nimport { useHeadshotmarketingContentItemDetailQuery } from \"../../../generated/wspace-operations\";\nimport {\n PageLayout,\n StatCard,\n StatusBadge,\n EmptyState,\n EntityTagPicker,\n QueryStateBoundary,\n} from \"../../components\";\nimport { EmphasisPanel, PagePurpose } from \"@burdenoff/fe-libs/ui\";\nimport { cn, formatDate, formatNumber } from \"../../utils/helpers\";\nimport { toContentItemModel } from \"../../utils/contentMapper\";\nimport { contentTypeLabel, htmlToPlainText } from \"../../utils/contentLibrary\";\nimport { useHeadshotMarketing } from \"../../context/HeadshotMarketingContext\";\nimport { useHeadshotmarketingBootstrap } from \"../../hooks/useHeadshotmarketingBootstrap\";\nimport { ContentItemActionsMenu } from \"./ContentItemActions\";\nimport { AIGeneratedBadge } from \"./AIGeneratedBadge\";\n\n/** Colour the SEO pill by score band — semantic tokens only. */\nfunction seoTone(score: number): string {\n if (score >= 80)\n return \"bg-status-success-bg-subtle text-status-success-text border-status-success-border\";\n if (score >= 50)\n return \"bg-status-warning-bg-subtle text-status-warning-text border-status-warning-border\";\n return \"bg-bg-sunken text-text-secondary border-border-subtle\";\n}\n\nexport const ContentDetailsPage: FC = () => {\n const { navigate, basePath, currentUser } = useHeadshotMarketing();\n const { contentId: id } = useParams<{ contentId: string }>();\n const { refetch: refetchBootstrap } = useHeadshotmarketingBootstrap();\n const { data, loading, error, refetch } =\n useHeadshotmarketingContentItemDetailQuery({\n variables: { id: id ?? \"\" },\n skip: !id,\n fetchPolicy: \"cache-and-network\",\n });\n\n // The row keeps `scheduledAt`/`slug`/`type`, which the shared mapper drops.\n const raw = data?.headshotmarketingContentItem ?? null;\n const item = raw ? toContentItemModel(raw) : null;\n const bodyText = raw?.body ? htmlToPlainText(raw.body) : \"\";\n\n const backToLibrary = (): void => navigate(basePath + \"/content\");\n const openEditor = (): void =>\n navigate(basePath + \"/content/\" + (id ?? \"\") + \"/edit\");\n\n if (!item || !raw) {\n return (\n <PageLayout title=\"Content\">\n <QueryStateBoundary\n loading={loading}\n error={error}\n onRetry={() => void refetch()}\n hasData={Boolean(data)}\n >\n <EmptyState\n illustration=\"empty-files\"\n title=\"Content not found\"\n description=\"This content item doesn't exist or has been removed.\"\n action={\n <button\n onClick={backToLibrary}\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 <ArrowLeft className=\"h-4 w-4\" />\n Back to Content\n </button>\n }\n />\n </QueryStateBoundary>\n </PageLayout>\n );\n }\n\n const authorName =\n currentUser && item.author === currentUser.id\n ? currentUser.name ||\n [currentUser.firstName, currentUser.lastName]\n .filter(Boolean)\n .join(\" \")\n .trim() ||\n currentUser.email\n : \"Team member\";\n\n const dateInfo = raw.scheduledAt\n ? { label: \"Scheduled\", value: raw.scheduledAt }\n : item.publishedAt\n ? { label: \"Published\", value: item.publishedAt }\n : { label: \"Created\", value: item.createdAt };\n\n return (\n <PageLayout\n title={item.title}\n description={item.description || undefined}\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n <StatusBadge status={item.status} />\n <AIGeneratedBadge provenance={item.aiProvenance} />\n <button\n type=\"button\"\n onClick={openEditor}\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 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n >\n <Pencil className=\"h-4 w-4\" />\n Edit\n </button>\n <button\n type=\"button\"\n onClick={backToLibrary}\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 <ArrowLeft className=\"h-4 w-4\" />\n Back\n </button>\n <ContentItemActionsMenu\n item={item}\n align=\"right\"\n onEdit={openEditor}\n onPublished={async () => {\n await Promise.all([refetch(), refetchBootstrap()]);\n }}\n onDeleted={async () => {\n await refetchBootstrap();\n backToLibrary();\n }}\n />\n </div>\n }\n >\n <PagePurpose>\n The full record for this content item — its type and status, the metrics\n it has earned, and its body. Use Edit to change the copy, settings or\n status.\n </PagePurpose>\n\n {/* Performance metrics — primary emphasis zone */}\n <EmphasisPanel>\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-4\">\n <StatCard\n title=\"Views\"\n value={formatNumber(item.metrics.views)}\n icon={<Eye className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Shares\"\n value={formatNumber(item.metrics.shares)}\n icon={<Share2 className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Conversions\"\n value={formatNumber(item.metrics.conversions)}\n icon={<MousePointerClick className=\"h-5 w-5\" />}\n />\n <StatCard\n title=\"Engagement\"\n value={formatNumber(item.metrics.engagement)}\n icon={<Gauge className=\"h-5 w-5\" />}\n />\n </div>\n </EmphasisPanel>\n\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Metadata */}\n <div className=\"rounded-lg border border-border-seam bg-gloss-card p-5 shadow-pop lg:col-span-1\">\n <h4 className=\"mb-3 text-sm font-semibold text-text-primary\">\n Details\n </h4>\n <dl className=\"space-y-3 text-sm\">\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">Type</dt>\n <dd className=\"font-medium text-text-primary\">\n {contentTypeLabel(raw.type)}\n </dd>\n </div>\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">Author</dt>\n <dd className=\"truncate font-medium text-text-primary\">\n {authorName}\n </dd>\n </div>\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"inline-flex items-center gap-1.5 text-text-secondary\">\n <Calendar className=\"h-3.5 w-3.5\" />\n {dateInfo.label}\n </dt>\n <dd className=\"font-medium text-text-primary\">\n {formatDate(dateInfo.value)}\n </dd>\n </div>\n {raw.slug && (\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">Slug</dt>\n <dd className=\"truncate font-medium text-text-primary\">\n {raw.slug}\n </dd>\n </div>\n )}\n {item.wordCount > 0 && (\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"inline-flex items-center gap-1.5 text-text-secondary\">\n <FileText className=\"h-3.5 w-3.5\" />\n Word count\n </dt>\n <dd className=\"font-medium tabular-nums text-text-primary\">\n {formatNumber(item.wordCount)}\n </dd>\n </div>\n )}\n {item.readTime > 0 && (\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"inline-flex items-center gap-1.5 text-text-secondary\">\n <Clock className=\"h-3.5 w-3.5\" />\n Read time\n </dt>\n <dd className=\"font-medium tabular-nums text-text-primary\">\n {item.readTime} min\n </dd>\n </div>\n )}\n {item.seoScore > 0 && (\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">SEO score</dt>\n <dd>\n <span\n className={cn(\n \"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-[11px] font-semibold tabular-nums\",\n seoTone(item.seoScore),\n )}\n >\n <Gauge className=\"h-3 w-3\" />\n {item.seoScore}\n </span>\n </dd>\n </div>\n )}\n </dl>\n\n {item.aiProvenance && (\n <div\n className=\"mt-4 border-t border-border-subtle pt-4\"\n data-testid=\"ai-provenance-details\"\n >\n <p className=\"mb-2 text-xs font-medium text-text-secondary\">\n AI provenance\n </p>\n <dl className=\"space-y-2 text-xs\">\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">Disclosure</dt>\n <dd className=\"text-end font-medium text-text-primary\">\n {item.aiProvenance.disclosure}\n </dd>\n </div>\n {item.aiProvenance.provider && (\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">Model</dt>\n <dd className=\"truncate text-end font-medium text-text-primary\">\n {[item.aiProvenance.provider, item.aiProvenance.model]\n .filter(Boolean)\n .join(\" / \")}\n </dd>\n </div>\n )}\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">Generated</dt>\n <dd className=\"font-medium text-text-primary\">\n {formatDate(item.aiProvenance.generatedAt)}\n </dd>\n </div>\n <div className=\"flex items-center justify-between gap-4\">\n <dt className=\"text-text-secondary\">Source type</dt>\n <dd className=\"truncate text-end font-mono text-[11px] text-text-primary\">\n {item.aiProvenance.digitalSourceType}\n </dd>\n </div>\n </dl>\n </div>\n )}\n\n {item.tags.length > 0 && (\n <div className=\"mt-4 border-t border-border-subtle pt-4\">\n <p className=\"mb-2 text-xs font-medium text-text-secondary\">\n Content labels\n </p>\n <div className=\"flex flex-wrap gap-1.5\">\n {item.tags.map((tag) => (\n <span\n key={tag}\n className=\"inline-flex items-center rounded-md bg-bg-sunken px-2 py-0.5 text-[11px] font-medium text-text-secondary\"\n >\n {tag}\n </span>\n ))}\n </div>\n </div>\n )}\n\n <div className=\"mt-4 border-t border-border-subtle pt-4\">\n <EntityTagPicker\n entityType=\"HEADSHOTMARKETING_CONTENT_ITEM\"\n entityId={item.id}\n />\n </div>\n </div>\n\n {/* Body */}\n <div className=\"rounded-lg border border-border-seam bg-gloss-card p-5 shadow-pop lg:col-span-2\">\n <h4 className=\"mb-3 text-sm font-semibold text-text-primary\">\n Content\n </h4>\n {bodyText ? (\n <p className=\"whitespace-pre-wrap text-sm leading-relaxed text-text-primary\">\n {bodyText}\n </p>\n ) : (\n <p className=\"py-8 text-center text-sm text-text-secondary\">\n This item has no body content yet.\n </p>\n )}\n </div>\n </div>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0CA,SAASE,EAAQ,GAAuB;CAKtC,OAJIC,KAAS,KACJ,sFACLA,KAAS,KACJ,sFACF;AACT;AAEA,IAAaC,UAA+B;CAC1C,IAAM,EAAE,aAAU,aAAU,mBAAgBC,EAAqB,GAC3D,EAAE,WAAWC,MAAOC,EAAiC,GACrD,EAAE,SAASC,MAAqBC,EAA8B,GAC9D,EAAE,SAAM,YAAS,U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7B,EAAK,aAAa,WAAW;UACvC,CAAA,CACD;;SACL,kBAAC,OAAD;UAAK,WAAU;UAAf,UAAA,CACE,kBAAC,MAAD;WAAI,WAAU;WAAsB,UAAA;UAAe,CAAA,GACnD,kBAAC,MAAD;WAAI,WAAU;WACX,UAAAA,EAAK,aAAa;UACjB,CAAA,CACD;;QACH;OACD,CAAA,CAAA;;MAGNA,EAAK,KAAK,SAAS,KAClB,kBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,kBAAC,KAAD;QAAG,WAAU;QAA+C,UAAA;OAEzD,CAAA,GACH,kBAAC,OAAD;QAAK,WAAU;QACZ,UAAAA,EAAK,KAAK,KAAK,MACd,kBAAC,QAAD;SAEE,WAAU;SAET,UAAAiC;QACG,GAJCA,CAID,CACP;OACE,CAAA,CACF;;MAGP,kBAAC,OAAD;OAAK,WAAU;OACb,UAAA,kBAACC,GAAD;QACE,YAAW;QACX,UAAUlC,EAAK;OAChB,CAAA;MACE,CAAA;KACF;IAGL,CAAA,GAAA,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,MAAD;MAAI,WAAU;MAA+C,UAAA;KAEzD,CAAA,GACHE,IACC,kBAAC,KAAD;MAAG,WAAU;MACV,UAAAA;KACA,CAAA,IAEH,kBAAC,KAAD;MAAG,WAAU;MAA+C,UAAA;KAEzD,CAAA,CAEF;IACF,CAAA,CAAA;;EACK;;AAEhB"}
|
|
@@ -25,14 +25,14 @@ var v = {
|
|
|
25
25
|
document: s,
|
|
26
26
|
template: c
|
|
27
27
|
}, y = {
|
|
28
|
-
article: "bg-status-info-bg text-status-info-text border-status-info-border",
|
|
28
|
+
article: "bg-status-info-bg-subtle text-status-info-text border-status-info-border",
|
|
29
29
|
image: "bg-[var(--color-accent-soft)] text-action-primary-bg border-border-seam",
|
|
30
|
-
video: "bg-status-warning-bg text-status-warning-text border-status-warning-border",
|
|
30
|
+
video: "bg-status-warning-bg-subtle text-status-warning-text border-status-warning-border",
|
|
31
31
|
document: "bg-bg-sunken text-text-secondary border-border-subtle",
|
|
32
|
-
template: "bg-status-success-bg text-status-success-text border-status-success-border"
|
|
32
|
+
template: "bg-status-success-bg-subtle text-status-success-text border-status-success-border"
|
|
33
33
|
};
|
|
34
34
|
function b(e) {
|
|
35
|
-
return e >= 80 ? "bg-status-success-bg text-status-success-text border-status-success-border" : e >= 50 ? "bg-status-warning-bg text-status-warning-text border-status-warning-border" : "bg-bg-sunken text-text-secondary border-border-subtle";
|
|
35
|
+
return e >= 80 ? "bg-status-success-bg-subtle text-status-success-text border-status-success-border" : e >= 50 ? "bg-status-warning-bg-subtle text-status-warning-text border-status-warning-border" : "bg-bg-sunken text-text-secondary border-border-subtle";
|
|
36
36
|
}
|
|
37
37
|
function x(e, t) {
|
|
38
38
|
return t ? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentLibraryCard.js","names":["ImageIcon","FileIcon","OPENABLE_CLASS","openableProps","onOpen","e","typeIcons","FileText","Image","Video","File","typeBadgeStyles","seoTone","score","resolveDateInfo","scheduledAt","item","resolveAuthorName","currentUser","composed","TagChip","tag","SeoPill","cn","className","Gauge","AuthorAvatar","isSelf","name","avatarUrl","getInitials","User","showLabel","ContentLibraryCard","Icon","tags","date","hasMetaRow","GlassCard","StatusBadge","onDeleted","ContentItemActionsMenu","AIGeneratedBadge","Calendar","formatDate","ContentLibraryRow"],"sources":["../../../../src/headshotmarketing/pages/content/ContentLibraryCard.tsx"],"sourcesContent":["/**\n * ContentLibraryCard / ContentLibraryRow\n *\n * Rich presentational views for a single content item in the Content Library.\n * Both surfaces render from data ALREADY fetched by the page's bootstrap query\n * (type, status, tags, SEO score, scheduled/published dates, author) — no new\n * network calls and no fabricated values (a missing SEO score or date simply\n * isn't rendered).\n *\n * Author resolution: the bootstrap payload carries only the raw `authorId`.\n * When that id matches the signed-in user we resolve it to their real name +\n * avatar (available from the shell context); otherwise we show a neutral\n * avatar rather than printing an opaque id. Full directory resolution needs a\n * dedicated members query (deferred to the backend).\n *\n * @module headshotmarketing/pages/content\n */\n\nimport type { FC, KeyboardEvent } from \"react\";\nimport {\n FileText,\n Image as ImageIcon,\n Video,\n File as FileIcon,\n User,\n Calendar,\n Gauge,\n type LucideIcon,\n} from \"lucide-react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport { cn, formatDate, getInitials } from \"../../utils/helpers\";\nimport { StatusBadge } from \"../../components\";\nimport type { ContentItem, ContentType } from \"../../types\";\nimport { ContentItemActionsMenu } from \"./ContentItemActions\";\nimport { AIGeneratedBadge } from \"./AIGeneratedBadge\";\n\n/** Minimal shape of the signed-in user needed to resolve self-authored items. */\nexport interface ContentCardUser {\n id: string;\n email: string;\n firstName?: string;\n lastName?: string;\n name?: string;\n avatar?: string;\n}\n\nexport interface ContentCardProps {\n item: ContentItem;\n /** Raw `scheduledAt` from the bootstrap row (dropped by the shared mapper). */\n scheduledAt: string | null;\n currentUser?: ContentCardUser | null;\n /** When set, the card/row becomes an accessible button opening the detail. */\n onOpen?: () => void;\n /**\n * When set, an overflow (Delete) menu is rendered on the surface and this is\n * invoked after a successful delete (the page's bootstrap refetch). The menu\n * stops click propagation so it never triggers `onOpen`.\n */\n onDeleted?: () => void | Promise<unknown>;\n /** When set, the overflow menu offers \"Edit\" (opens the editor). */\n onEdit?: () => void;\n}\n\nconst OPENABLE_CLASS =\n \"cursor-pointer transition-shadow hover:shadow-pop focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\";\n\n/**\n * Build the interactive attributes that turn a surface into an accessible\n * activator. Kept inline so the grid card and list row open identically.\n * `className` is merged by the caller so it doesn't clobber the surface's own.\n */\nfunction openableProps(onOpen?: () => void) {\n if (!onOpen) return {};\n return {\n role: \"button\" as const,\n tabIndex: 0,\n onClick: onOpen,\n onKeyDown: (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n onOpen();\n }\n },\n };\n}\n\nconst typeIcons: Record<ContentType, LucideIcon> = {\n article: FileText,\n image: ImageIcon,\n video: Video,\n document: FileIcon,\n template: FileText,\n};\n\n/** Distinct, token-only accent per content type for an at-a-glance read. */\nconst typeBadgeStyles: Record<ContentType, string> = {\n article: \"bg-status-info-bg text-status-info-text border-status-info-border\",\n image:\n \"bg-[var(--color-accent-soft)] text-action-primary-bg border-border-seam\",\n video:\n \"bg-status-warning-bg text-status-warning-text border-status-warning-border\",\n document: \"bg-bg-sunken text-text-secondary border-border-subtle\",\n template:\n \"bg-status-success-bg text-status-success-text border-status-success-border\",\n};\n\n/** Colour the SEO pill by score band — semantic tokens only. */\nfunction seoTone(score: number): string {\n if (score >= 80)\n return \"bg-status-success-bg text-status-success-text border-status-success-border\";\n if (score >= 50)\n return \"bg-status-warning-bg text-status-warning-text border-status-warning-border\";\n return \"bg-bg-sunken text-text-secondary border-border-subtle\";\n}\n\n/** Pick the most relevant date to surface, with an honest label. */\nfunction resolveDateInfo(\n item: ContentItem,\n scheduledAt: string | null,\n): { label: string; value: string } {\n if (scheduledAt) return { label: \"Scheduled\", value: scheduledAt };\n if (item.publishedAt) return { label: \"Published\", value: item.publishedAt };\n return { label: \"Created\", value: item.createdAt };\n}\n\nfunction resolveAuthorName(\n item: ContentItem,\n currentUser?: ContentCardUser | null,\n): string | null {\n if (currentUser && item.author === currentUser.id) {\n const composed = [currentUser.firstName, currentUser.lastName]\n .filter(Boolean)\n .join(\" \")\n .trim();\n return currentUser.name || composed || currentUser.email;\n }\n if (!item.author || item.author === \"Unknown\") return \"Unassigned\";\n return null;\n}\n\nconst TagChip: FC<{ tag: string }> = ({ tag }) => (\n <span className=\"inline-flex items-center rounded-md bg-bg-sunken px-2 py-0.5 text-[11px] font-medium text-text-secondary\">\n {tag}\n </span>\n);\n\nconst SeoPill: FC<{ score: number; className?: string }> = ({\n score,\n className,\n}) => (\n <span\n className={cn(\n \"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-[11px] font-semibold tabular-nums\",\n seoTone(score),\n className,\n )}\n title={`SEO score ${score}`}\n >\n <Gauge className=\"h-3 w-3\" />\n SEO {score}\n </span>\n);\n\nconst AuthorAvatar: FC<{\n item: ContentItem;\n currentUser?: ContentCardUser | null;\n showLabel?: boolean;\n}> = ({ item, currentUser, showLabel = true }) => {\n const isSelf = Boolean(currentUser && item.author === currentUser.id);\n const name = resolveAuthorName(item, currentUser);\n const avatarUrl = isSelf ? currentUser?.avatar : undefined;\n\n return (\n <div\n className=\"flex min-w-0 items-center gap-2\"\n title={name ?? item.author}\n >\n {avatarUrl ? (\n <img\n src={avatarUrl}\n alt={name ?? \"Author\"}\n className=\"h-6 w-6 shrink-0 rounded-full object-cover\"\n />\n ) : name && name !== \"Unassigned\" ? (\n <span className=\"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-[var(--color-accent-soft)] text-[10px] font-semibold text-action-primary-bg\">\n {getInitials(name)}\n </span>\n ) : (\n <span className=\"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-bg-sunken text-text-secondary\">\n <User className=\"h-3.5 w-3.5\" />\n </span>\n )}\n {showLabel && (\n <span className=\"truncate text-xs text-text-secondary\">\n {name ?? \"Team member\"}\n </span>\n )}\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Grid card\n// ---------------------------------------------------------------------------\n\nexport const ContentLibraryCard: FC<ContentCardProps> = ({\n item,\n scheduledAt,\n currentUser,\n onOpen,\n onDeleted,\n onEdit,\n}) => {\n const Icon = typeIcons[item.type] ?? FileText;\n const tags = item.tags ?? [];\n const date = resolveDateInfo(item, scheduledAt);\n const hasMetaRow =\n tags.length > 0 || item.seoScore > 0 || item.aiProvenance !== null;\n\n return (\n <GlassCard\n treatment=\"glass\"\n className={cn(\"p-4\", onOpen && OPENABLE_CLASS)}\n {...openableProps(onOpen)}\n >\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"flex min-w-0 items-center gap-2.5\">\n <span\n className={cn(\n \"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border\",\n typeBadgeStyles[item.type],\n )}\n >\n <Icon className=\"h-4 w-4\" />\n </span>\n <div className=\"min-w-0\">\n <h3 className=\"truncate text-sm font-semibold text-text-primary\">\n {item.title}\n </h3>\n <span className=\"text-[11px] font-medium uppercase tracking-wide text-text-secondary\">\n {item.typeLabel ?? item.type}\n </span>\n </div>\n </div>\n <div className=\"flex shrink-0 items-center gap-1\">\n <StatusBadge status={item.status} />\n {onDeleted && (\n <ContentItemActionsMenu\n item={item}\n onDeleted={onDeleted}\n onEdit={onEdit}\n />\n )}\n </div>\n </div>\n\n {item.description && (\n <p className=\"line-clamp-2 text-xs text-text-secondary\">\n {item.description}\n </p>\n )}\n\n {hasMetaRow && (\n <div className=\"flex flex-wrap items-center gap-1.5\">\n <AIGeneratedBadge provenance={item.aiProvenance} />\n {tags.slice(0, 3).map((tag) => (\n <TagChip key={tag} tag={tag} />\n ))}\n {tags.length > 3 && (\n <span className=\"text-[11px] font-medium text-text-secondary\">\n +{tags.length - 3}\n </span>\n )}\n {item.seoScore > 0 && (\n <SeoPill score={item.seoScore} className=\"ms-auto\" />\n )}\n </div>\n )}\n\n <div className=\"space-y-2 border-t border-border-subtle pt-3\">\n <AuthorAvatar item={item} currentUser={currentUser} />\n <div className=\"flex items-center justify-between text-xs\">\n <span className=\"inline-flex items-center gap-1.5 text-text-secondary\">\n <Calendar className=\"h-3.5 w-3.5\" />\n {date.label}\n </span>\n <span className=\"font-medium text-text-primary\">\n {formatDate(date.value)}\n </span>\n </div>\n </div>\n </div>\n </GlassCard>\n );\n};\n\n// ---------------------------------------------------------------------------\n// List row\n// ---------------------------------------------------------------------------\n\nexport const ContentLibraryRow: FC<ContentCardProps> = ({\n item,\n scheduledAt,\n currentUser,\n onOpen,\n onDeleted,\n onEdit,\n}) => {\n const Icon = typeIcons[item.type] ?? FileText;\n const tags = item.tags ?? [];\n const date = resolveDateInfo(item, scheduledAt);\n\n return (\n <GlassCard\n treatment=\"glass\"\n className={cn(\"p-3.5\", onOpen && OPENABLE_CLASS)}\n {...openableProps(onOpen)}\n >\n <div className=\"flex items-center gap-4\">\n <span\n className={cn(\n \"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg border\",\n typeBadgeStyles[item.type],\n )}\n >\n <Icon className=\"h-5 w-5\" />\n </span>\n\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {item.title}\n </p>\n <StatusBadge status={item.status} className=\"shrink-0\" />\n <AIGeneratedBadge provenance={item.aiProvenance} />\n </div>\n <div className=\"mt-1 flex flex-wrap items-center gap-1.5\">\n <span className=\"text-[11px] font-medium uppercase tracking-wide text-text-secondary\">\n {item.typeLabel ?? item.type}\n </span>\n {tags.slice(0, 4).map((tag) => (\n <TagChip key={tag} tag={tag} />\n ))}\n </div>\n </div>\n\n {item.seoScore > 0 && (\n <SeoPill score={item.seoScore} className=\"hidden sm:inline-flex\" />\n )}\n\n <div className=\"hidden text-end md:block\">\n <p className=\"text-[11px] text-text-secondary\">{date.label}</p>\n <p className=\"text-xs font-medium text-text-primary\">\n {formatDate(date.value)}\n </p>\n </div>\n\n <div className=\"hidden w-32 lg:block\">\n <AuthorAvatar item={item} currentUser={currentUser} />\n </div>\n\n {onDeleted && (\n <ContentItemActionsMenu\n item={item}\n onDeleted={onDeleted}\n onEdit={onEdit}\n />\n )}\n </div>\n </GlassCard>\n );\n};\n"],"mappings":";;;;;;;;;AA+DA,IAAME,IACJ;AAOF,SAASC,EAAc,GAAqB;CAE1C,OADKC,IACE;EACL,MAAM;EACN,UAAU;EACV,SAASA;EACT,YAAY,MAAqC;GAC/C,CAAIC,EAAE,QAAQ,WAAWA,EAAE,QAAQ,SACjCA,EAAE,eAAe,GACjBD,EAAO;EAEX;CACF,IAXoB,CAAC;AAYvB;AAEA,IAAME,IAA6C;CACjD,SAASC;CACT,OAAOP;CACP,OAAOS;CACP,UAAUR;CACV,UAAUM;AACZ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EAAK,KACvB;KAEA,UAAA,kBAACkB,GAAD,EAAM,WAAU,UAAW,CAAA;IACvB,CAAA;IAEN,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA;OACE,kBAAC,KAAD;QAAG,WAAU;QACV,UAAAlB,EAAK;OACL,CAAA;OACH,kBAACuB,GAAD;QAAa,QAAQvB,EAAK;QAAQ,WAAU;OAAY,CAAA;OACxD,kBAAC0B,GAAD,EAAkB,YAAY1B,EAAK,aAAe,CAAA;MAC/C;KACL,CAAA,GAAA,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,kBAAC,QAAD;OAAM,WAAU;OACb,UAAAA,EAAK,aAAaA,EAAK;MACpB,CAAA,GACLmB,EAAK,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,MACrB,kBAACf,GAAD,EAAwB,OAAM,GAAhBC,CAAgB,CAC/B,CACE;KACF,CAAA,CAAA;;IAEJL,EAAK,WAAW,KACf,kBAACM,GAAD;KAAS,OAAON,EAAK;KAAU,WAAU;IAAyB,CAAA;IAGpE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,KAAD;MAAG,WAAU;MAAmC,UAAAoB,EAAK;KAAS,CAAA,GAC9D,kBAAC,KAAD;MAAG,WAAU;MACV,UAAAQ,EAAWR,EAAK,KAAK;KACrB,CAAA,CACA;;IAEL,kBAAC,OAAD;KAAK,WAAU;KACb,UAAA,kBAACV,GAAD;MAAoB;MAAmB;KAAc,CAAA;IAClD,CAAA;IAEJc,KACC,kBAACC,GAAD;KACQ;KACK;KACH;IACT,CAAA;GAEA;;CACI,CAAA;AAEf"}
|
|
1
|
+
{"version":3,"file":"ContentLibraryCard.js","names":["ImageIcon","FileIcon","OPENABLE_CLASS","openableProps","onOpen","e","typeIcons","FileText","Image","Video","File","typeBadgeStyles","seoTone","score","resolveDateInfo","scheduledAt","item","resolveAuthorName","currentUser","composed","TagChip","tag","SeoPill","cn","className","Gauge","AuthorAvatar","isSelf","name","avatarUrl","getInitials","User","showLabel","ContentLibraryCard","Icon","tags","date","hasMetaRow","GlassCard","StatusBadge","onDeleted","ContentItemActionsMenu","AIGeneratedBadge","Calendar","formatDate","ContentLibraryRow"],"sources":["../../../../src/headshotmarketing/pages/content/ContentLibraryCard.tsx"],"sourcesContent":["/**\n * ContentLibraryCard / ContentLibraryRow\n *\n * Rich presentational views for a single content item in the Content Library.\n * Both surfaces render from data ALREADY fetched by the page's bootstrap query\n * (type, status, tags, SEO score, scheduled/published dates, author) — no new\n * network calls and no fabricated values (a missing SEO score or date simply\n * isn't rendered).\n *\n * Author resolution: the bootstrap payload carries only the raw `authorId`.\n * When that id matches the signed-in user we resolve it to their real name +\n * avatar (available from the shell context); otherwise we show a neutral\n * avatar rather than printing an opaque id. Full directory resolution needs a\n * dedicated members query (deferred to the backend).\n *\n * @module headshotmarketing/pages/content\n */\n\nimport type { FC, KeyboardEvent } from \"react\";\nimport {\n FileText,\n Image as ImageIcon,\n Video,\n File as FileIcon,\n User,\n Calendar,\n Gauge,\n type LucideIcon,\n} from \"lucide-react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport { cn, formatDate, getInitials } from \"../../utils/helpers\";\nimport { StatusBadge } from \"../../components\";\nimport type { ContentItem, ContentType } from \"../../types\";\nimport { ContentItemActionsMenu } from \"./ContentItemActions\";\nimport { AIGeneratedBadge } from \"./AIGeneratedBadge\";\n\n/** Minimal shape of the signed-in user needed to resolve self-authored items. */\nexport interface ContentCardUser {\n id: string;\n email: string;\n firstName?: string;\n lastName?: string;\n name?: string;\n avatar?: string;\n}\n\nexport interface ContentCardProps {\n item: ContentItem;\n /** Raw `scheduledAt` from the bootstrap row (dropped by the shared mapper). */\n scheduledAt: string | null;\n currentUser?: ContentCardUser | null;\n /** When set, the card/row becomes an accessible button opening the detail. */\n onOpen?: () => void;\n /**\n * When set, an overflow (Delete) menu is rendered on the surface and this is\n * invoked after a successful delete (the page's bootstrap refetch). The menu\n * stops click propagation so it never triggers `onOpen`.\n */\n onDeleted?: () => void | Promise<unknown>;\n /** When set, the overflow menu offers \"Edit\" (opens the editor). */\n onEdit?: () => void;\n}\n\nconst OPENABLE_CLASS =\n \"cursor-pointer transition-shadow hover:shadow-pop focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\";\n\n/**\n * Build the interactive attributes that turn a surface into an accessible\n * activator. Kept inline so the grid card and list row open identically.\n * `className` is merged by the caller so it doesn't clobber the surface's own.\n */\nfunction openableProps(onOpen?: () => void) {\n if (!onOpen) return {};\n return {\n role: \"button\" as const,\n tabIndex: 0,\n onClick: onOpen,\n onKeyDown: (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n onOpen();\n }\n },\n };\n}\n\nconst typeIcons: Record<ContentType, LucideIcon> = {\n article: FileText,\n image: ImageIcon,\n video: Video,\n document: FileIcon,\n template: FileText,\n};\n\n/** Distinct, token-only accent per content type for an at-a-glance read. */\nconst typeBadgeStyles: Record<ContentType, string> = {\n article:\n \"bg-status-info-bg-subtle text-status-info-text border-status-info-border\",\n image:\n \"bg-[var(--color-accent-soft)] text-action-primary-bg border-border-seam\",\n video:\n \"bg-status-warning-bg-subtle text-status-warning-text border-status-warning-border\",\n document: \"bg-bg-sunken text-text-secondary border-border-subtle\",\n template:\n \"bg-status-success-bg-subtle text-status-success-text border-status-success-border\",\n};\n\n/** Colour the SEO pill by score band — semantic tokens only. */\nfunction seoTone(score: number): string {\n if (score >= 80)\n return \"bg-status-success-bg-subtle text-status-success-text border-status-success-border\";\n if (score >= 50)\n return \"bg-status-warning-bg-subtle text-status-warning-text border-status-warning-border\";\n return \"bg-bg-sunken text-text-secondary border-border-subtle\";\n}\n\n/** Pick the most relevant date to surface, with an honest label. */\nfunction resolveDateInfo(\n item: ContentItem,\n scheduledAt: string | null,\n): { label: string; value: string } {\n if (scheduledAt) return { label: \"Scheduled\", value: scheduledAt };\n if (item.publishedAt) return { label: \"Published\", value: item.publishedAt };\n return { label: \"Created\", value: item.createdAt };\n}\n\nfunction resolveAuthorName(\n item: ContentItem,\n currentUser?: ContentCardUser | null,\n): string | null {\n if (currentUser && item.author === currentUser.id) {\n const composed = [currentUser.firstName, currentUser.lastName]\n .filter(Boolean)\n .join(\" \")\n .trim();\n return currentUser.name || composed || currentUser.email;\n }\n if (!item.author || item.author === \"Unknown\") return \"Unassigned\";\n return null;\n}\n\nconst TagChip: FC<{ tag: string }> = ({ tag }) => (\n <span className=\"inline-flex items-center rounded-md bg-bg-sunken px-2 py-0.5 text-[11px] font-medium text-text-secondary\">\n {tag}\n </span>\n);\n\nconst SeoPill: FC<{ score: number; className?: string }> = ({\n score,\n className,\n}) => (\n <span\n className={cn(\n \"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-[11px] font-semibold tabular-nums\",\n seoTone(score),\n className,\n )}\n title={`SEO score ${score}`}\n >\n <Gauge className=\"h-3 w-3\" />\n SEO {score}\n </span>\n);\n\nconst AuthorAvatar: FC<{\n item: ContentItem;\n currentUser?: ContentCardUser | null;\n showLabel?: boolean;\n}> = ({ item, currentUser, showLabel = true }) => {\n const isSelf = Boolean(currentUser && item.author === currentUser.id);\n const name = resolveAuthorName(item, currentUser);\n const avatarUrl = isSelf ? currentUser?.avatar : undefined;\n\n return (\n <div\n className=\"flex min-w-0 items-center gap-2\"\n title={name ?? item.author}\n >\n {avatarUrl ? (\n <img\n src={avatarUrl}\n alt={name ?? \"Author\"}\n className=\"h-6 w-6 shrink-0 rounded-full object-cover\"\n />\n ) : name && name !== \"Unassigned\" ? (\n <span className=\"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-[var(--color-accent-soft)] text-[10px] font-semibold text-action-primary-bg\">\n {getInitials(name)}\n </span>\n ) : (\n <span className=\"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-bg-sunken text-text-secondary\">\n <User className=\"h-3.5 w-3.5\" />\n </span>\n )}\n {showLabel && (\n <span className=\"truncate text-xs text-text-secondary\">\n {name ?? \"Team member\"}\n </span>\n )}\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Grid card\n// ---------------------------------------------------------------------------\n\nexport const ContentLibraryCard: FC<ContentCardProps> = ({\n item,\n scheduledAt,\n currentUser,\n onOpen,\n onDeleted,\n onEdit,\n}) => {\n const Icon = typeIcons[item.type] ?? FileText;\n const tags = item.tags ?? [];\n const date = resolveDateInfo(item, scheduledAt);\n const hasMetaRow =\n tags.length > 0 || item.seoScore > 0 || item.aiProvenance !== null;\n\n return (\n <GlassCard\n treatment=\"glass\"\n className={cn(\"p-4\", onOpen && OPENABLE_CLASS)}\n {...openableProps(onOpen)}\n >\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"flex min-w-0 items-center gap-2.5\">\n <span\n className={cn(\n \"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border\",\n typeBadgeStyles[item.type],\n )}\n >\n <Icon className=\"h-4 w-4\" />\n </span>\n <div className=\"min-w-0\">\n <h3 className=\"truncate text-sm font-semibold text-text-primary\">\n {item.title}\n </h3>\n <span className=\"text-[11px] font-medium uppercase tracking-wide text-text-secondary\">\n {item.typeLabel ?? item.type}\n </span>\n </div>\n </div>\n <div className=\"flex shrink-0 items-center gap-1\">\n <StatusBadge status={item.status} />\n {onDeleted && (\n <ContentItemActionsMenu\n item={item}\n onDeleted={onDeleted}\n onEdit={onEdit}\n />\n )}\n </div>\n </div>\n\n {item.description && (\n <p className=\"line-clamp-2 text-xs text-text-secondary\">\n {item.description}\n </p>\n )}\n\n {hasMetaRow && (\n <div className=\"flex flex-wrap items-center gap-1.5\">\n <AIGeneratedBadge provenance={item.aiProvenance} />\n {tags.slice(0, 3).map((tag) => (\n <TagChip key={tag} tag={tag} />\n ))}\n {tags.length > 3 && (\n <span className=\"text-[11px] font-medium text-text-secondary\">\n +{tags.length - 3}\n </span>\n )}\n {item.seoScore > 0 && (\n <SeoPill score={item.seoScore} className=\"ms-auto\" />\n )}\n </div>\n )}\n\n <div className=\"space-y-2 border-t border-border-subtle pt-3\">\n <AuthorAvatar item={item} currentUser={currentUser} />\n <div className=\"flex items-center justify-between text-xs\">\n <span className=\"inline-flex items-center gap-1.5 text-text-secondary\">\n <Calendar className=\"h-3.5 w-3.5\" />\n {date.label}\n </span>\n <span className=\"font-medium text-text-primary\">\n {formatDate(date.value)}\n </span>\n </div>\n </div>\n </div>\n </GlassCard>\n );\n};\n\n// ---------------------------------------------------------------------------\n// List row\n// ---------------------------------------------------------------------------\n\nexport const ContentLibraryRow: FC<ContentCardProps> = ({\n item,\n scheduledAt,\n currentUser,\n onOpen,\n onDeleted,\n onEdit,\n}) => {\n const Icon = typeIcons[item.type] ?? FileText;\n const tags = item.tags ?? [];\n const date = resolveDateInfo(item, scheduledAt);\n\n return (\n <GlassCard\n treatment=\"glass\"\n className={cn(\"p-3.5\", onOpen && OPENABLE_CLASS)}\n {...openableProps(onOpen)}\n >\n <div className=\"flex items-center gap-4\">\n <span\n className={cn(\n \"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg border\",\n typeBadgeStyles[item.type],\n )}\n >\n <Icon className=\"h-5 w-5\" />\n </span>\n\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {item.title}\n </p>\n <StatusBadge status={item.status} className=\"shrink-0\" />\n <AIGeneratedBadge provenance={item.aiProvenance} />\n </div>\n <div className=\"mt-1 flex flex-wrap items-center gap-1.5\">\n <span className=\"text-[11px] font-medium uppercase tracking-wide text-text-secondary\">\n {item.typeLabel ?? item.type}\n </span>\n {tags.slice(0, 4).map((tag) => (\n <TagChip key={tag} tag={tag} />\n ))}\n </div>\n </div>\n\n {item.seoScore > 0 && (\n <SeoPill score={item.seoScore} className=\"hidden sm:inline-flex\" />\n )}\n\n <div className=\"hidden text-end md:block\">\n <p className=\"text-[11px] text-text-secondary\">{date.label}</p>\n <p className=\"text-xs font-medium text-text-primary\">\n {formatDate(date.value)}\n </p>\n </div>\n\n <div className=\"hidden w-32 lg:block\">\n <AuthorAvatar item={item} currentUser={currentUser} />\n </div>\n\n {onDeleted && (\n <ContentItemActionsMenu\n item={item}\n onDeleted={onDeleted}\n onEdit={onEdit}\n />\n )}\n </div>\n </GlassCard>\n );\n};\n"],"mappings":";;;;;;;;;AA+DA,IAAME,IACJ;AAOF,SAASC,EAAc,GAAqB;CAE1C,OADKC,IACE;EACL,MAAM;EACN,UAAU;EACV,SAASA;EACT,YAAY,MAAqC;GAC/C,CAAIC,EAAE,QAAQ,WAAWA,EAAE,QAAQ,SACjCA,EAAE,eAAe,GACjBD,EAAO;EAEX;CACF,IAXoB,CAAC;AAYvB;AAEA,IAAME,IAA6C;CACjD,SAASC;CACT,OAAOP;CACP,OAAOS;CACP,UAAUR;CACV,UAAUM;AACZ,GAGMI,IAA+C;CACnD,SACE;CACF,OACE;CACF,OACE;CACF,UAAU;CACV,UACE;AACJ;AAGA,SAASC,EAAQ,GAAuB;CAKtC,OAJIC,KAAS,KACJ,sFACLA,KAAS,KACJ,sFACF;AACT;AAGA,SAASC,EACP,GACA,GACkC;CAGlC,OAFIC,IAAoB;EAAE,OAAO;EAAa,OAAOA;CAAY,IAC7DC,EAAK,cAAoB;EAAE,OAAO;EAAa,OAAOA,EAAK;CAAY,IACpE;EAAE,OAAO;EAAW,OAAOA,EAAK;CAAU;AACnD;AAEA,SAASC,EACP,GACA,GACe;CACf,IAAIC,KAAeF,EAAK,WAAWE,EAAY,IAAI;EACjD,IAAMC,IAAW,CAACD,EAAY,WAAWA,EAAY,QAAQ,CAAC,CAC3D,OAAO,OAAO,CAAC,CACf,KAAK,GAAG,CAAC,CACT,KAAK;EACR,OAAOA,EAAY,QAAQC,KAAYD,EAAY;CACrD;CAEA,OADI,CAACF,EAAK,UAAUA,EAAK,WAAW,YAAkB,eAC/C;AACT;AAEA,IAAMI,KAAgC,EAAE,aACtC,kBAA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CAAA;IAGpE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,KAAD;MAAG,WAAU;MAAmC,UAAAoB,EAAK;KAAS,CAAA,GAC9D,kBAAC,KAAD;MAAG,WAAU;MACV,UAAAQ,EAAWR,EAAK,KAAK;KACrB,CAAA,CACA;;IAEL,kBAAC,OAAD;KAAK,WAAU;KACb,UAAA,kBAACV,GAAD;MAAoB;MAAmB;KAAc,CAAA;IAClD,CAAA;IAEJc,KACC,kBAACC,GAAD;KACQ;KACK;KACH;IACT,CAAA;GAEA;;CACI,CAAA;AAEf"}
|
|
@@ -1,105 +1,106 @@
|
|
|
1
1
|
import "../../components/index.js";
|
|
2
2
|
import { Modal as e } from "../../components/Modal.js";
|
|
3
3
|
import { useConvertHeadshotmarketingLeadMutation as t } from "../../../generated/wspace-operations.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { readableError as n } from "../../utils/readableError.js";
|
|
5
|
+
import { useState as r } from "react";
|
|
6
|
+
import { ArrowRightLeft as i } from "lucide-react";
|
|
7
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
8
|
// src/headshotmarketing/pages/crm/ConvertLeadButton.tsx
|
|
8
|
-
var
|
|
9
|
-
let [
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
if (!
|
|
15
|
-
let e =
|
|
16
|
-
if (!e)
|
|
9
|
+
var c = "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", l = "block text-sm font-medium text-text-primary mb-1", u = ({ lead: u, target: d, onConverted: f }) => {
|
|
10
|
+
let [p, m] = r(!1), [h, g] = r(u.title), [_, v] = r(null), [y, { loading: b }] = t(), x = d === null, S = () => {
|
|
11
|
+
g(u.title), v(null), m(!0);
|
|
12
|
+
}, C = () => {
|
|
13
|
+
b || (v(null), m(!1));
|
|
14
|
+
}, w = async () => {
|
|
15
|
+
if (!d) return;
|
|
16
|
+
let e = h.trim();
|
|
17
|
+
if (!e) v("Deal title is required.");
|
|
17
18
|
else {
|
|
18
|
-
|
|
19
|
+
v(null);
|
|
19
20
|
try {
|
|
20
|
-
await
|
|
21
|
-
leadId:
|
|
22
|
-
pipelineId:
|
|
23
|
-
stageId:
|
|
21
|
+
await y({ variables: {
|
|
22
|
+
leadId: u.id,
|
|
23
|
+
pipelineId: d.pipelineId,
|
|
24
|
+
stageId: d.stageId,
|
|
24
25
|
dealTitle: e
|
|
25
|
-
} }),
|
|
26
|
+
} }), m(!1), f();
|
|
26
27
|
} catch (e) {
|
|
27
|
-
|
|
28
|
+
v(n(e, "Failed to convert lead to deal."));
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("button", {
|
|
32
33
|
type: "button",
|
|
33
|
-
onClick:
|
|
34
|
-
disabled:
|
|
35
|
-
title:
|
|
36
|
-
"aria-label": `Convert ${
|
|
34
|
+
onClick: S,
|
|
35
|
+
disabled: x,
|
|
36
|
+
title: x ? "Create a pipeline first to convert leads into deals" : "Convert to deal",
|
|
37
|
+
"aria-label": `Convert ${u.title} to deal`,
|
|
37
38
|
className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-text-secondary hover:bg-bg-sunken hover:text-action-primary-bg disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-text-secondary",
|
|
38
|
-
children: /* @__PURE__ */
|
|
39
|
+
children: /* @__PURE__ */ o(i, {
|
|
39
40
|
className: "h-4 w-4",
|
|
40
41
|
"aria-hidden": "true"
|
|
41
42
|
})
|
|
42
|
-
}),
|
|
43
|
-
open:
|
|
44
|
-
onClose:
|
|
43
|
+
}), d && /* @__PURE__ */ o(e, {
|
|
44
|
+
open: p,
|
|
45
|
+
onClose: C,
|
|
45
46
|
title: "Convert to deal",
|
|
46
47
|
description: "Move this lead into your sales pipeline as a new deal.",
|
|
47
48
|
size: "sm",
|
|
48
|
-
footer: /* @__PURE__ */
|
|
49
|
+
footer: /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("button", {
|
|
49
50
|
type: "button",
|
|
50
|
-
onClick:
|
|
51
|
+
onClick: C,
|
|
51
52
|
className: "inline-flex items-center gap-2 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
|
|
52
53
|
children: "Cancel"
|
|
53
|
-
}), /* @__PURE__ */
|
|
54
|
+
}), /* @__PURE__ */ s("button", {
|
|
54
55
|
type: "button",
|
|
55
|
-
onClick: () => void
|
|
56
|
-
disabled:
|
|
56
|
+
onClick: () => void w(),
|
|
57
|
+
disabled: b,
|
|
57
58
|
className: "inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-60",
|
|
58
|
-
children: [/* @__PURE__ */
|
|
59
|
+
children: [/* @__PURE__ */ o(i, { className: "h-4 w-4" }), b ? "Converting…" : "Convert"]
|
|
59
60
|
})] }),
|
|
60
|
-
children: /* @__PURE__ */
|
|
61
|
+
children: /* @__PURE__ */ s("div", {
|
|
61
62
|
className: "space-y-4",
|
|
62
63
|
children: [
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
className:
|
|
64
|
+
/* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("label", {
|
|
65
|
+
className: l,
|
|
65
66
|
htmlFor: "convert-deal-title",
|
|
66
67
|
children: "Deal title"
|
|
67
|
-
}), /* @__PURE__ */
|
|
68
|
+
}), /* @__PURE__ */ o("input", {
|
|
68
69
|
id: "convert-deal-title",
|
|
69
|
-
className:
|
|
70
|
-
value:
|
|
71
|
-
onChange: (e) =>
|
|
70
|
+
className: c,
|
|
71
|
+
value: h,
|
|
72
|
+
onChange: (e) => g(e.target.value)
|
|
72
73
|
})] }),
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ o("div", {
|
|
74
75
|
className: "rounded-lg border border-border-subtle bg-bg-sunken px-4 py-3 text-sm",
|
|
75
|
-
children: /* @__PURE__ */
|
|
76
|
+
children: /* @__PURE__ */ s("p", {
|
|
76
77
|
className: "text-text-secondary",
|
|
77
78
|
children: [
|
|
78
79
|
"Lands in",
|
|
79
80
|
" ",
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ o("span", {
|
|
81
82
|
className: "font-medium text-text-primary",
|
|
82
|
-
children:
|
|
83
|
+
children: d.pipelineName
|
|
83
84
|
}),
|
|
84
85
|
" ",
|
|
85
86
|
"at stage",
|
|
86
87
|
" ",
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ o("span", {
|
|
88
89
|
className: "font-medium text-text-primary",
|
|
89
|
-
children:
|
|
90
|
+
children: d.stageName
|
|
90
91
|
}),
|
|
91
92
|
"."
|
|
92
93
|
]
|
|
93
94
|
})
|
|
94
95
|
}),
|
|
95
|
-
|
|
96
|
+
_ && /* @__PURE__ */ o("div", {
|
|
96
97
|
className: "rounded-lg border border-status-error-border/30 bg-status-error-bg/10 px-4 py-3 text-sm text-status-error-text",
|
|
97
|
-
children:
|
|
98
|
+
children: _
|
|
98
99
|
})
|
|
99
100
|
]
|
|
100
101
|
})
|
|
101
102
|
})] });
|
|
102
103
|
};
|
|
103
|
-
export {
|
|
104
|
+
export { u as ConvertLeadButton };
|
|
104
105
|
|
|
105
106
|
//# sourceMappingURL=ConvertLeadButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConvertLeadButton.js","names":["_Fragment","inputClass","labelClass","ConvertLeadButton","open","setOpen","useState","dealTitle","setDealTitle","lead","error","setError","convertLead","converting","useConvertHeadshotmarketingLeadMutation","disabled","target","openConfirm","closeConfirm","handleConvert","title","onConverted","err","Fragment","ArrowRightLeft","Modal"],"sources":["../../../../src/headshotmarketing/pages/crm/ConvertLeadButton.tsx"],"sourcesContent":["/**\n * Convert-to-deal row action\n *\n * Co-located with LeadsPage. Renders a compact \"Convert to deal\" icon button in\n * the leads table row-actions cell. Clicking opens a small confirm dialog that\n * shows the target pipeline + stage (the workspace's default/first pipeline and\n * its first stage, resolved by LeadsPage from the bootstrap) and lets the user\n * confirm/adjust the deal title before calling the real\n * `useConvertHeadshotmarketingLeadMutation`. On success it calls `onConverted()`\n * (the page's bootstrap `refetch`) so the lead moves into the deals pipeline.\n *\n * When the workspace has no pipeline/stage yet, `target` is null and the button\n * renders disabled with an honest explanation rather than a broken action.\n *\n * @module headshotmarketing/pages/crm\n */\n\nimport { useState, type FC } from \"react\";\nimport { ArrowRightLeft } from \"lucide-react\";\nimport { Modal } from \"../../components\";\nimport { useConvertHeadshotmarketingLeadMutation } from \"../../../generated/wspace-operations\";\n\nconst inputClass =\n \"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\";\nconst labelClass = \"block text-sm font-medium text-text-primary mb-1\";\n\n/** The pipeline + stage a converted deal lands in, resolved from the bootstrap. */\nexport interface ConvertTarget {\n pipelineId: string;\n pipelineName: string;\n stageId: string;\n stageName: string;\n}\n\nexport interface ConvertLeadButtonProps {\n lead: { id: string; title: string };\n /** Default/first pipeline + its first stage, or null when none exists yet. */\n target: ConvertTarget | null;\n /** Called after a successful conversion (wire to the page's bootstrap refetch). */\n onConverted: () => void;\n}\n\nexport const ConvertLeadButton: FC<ConvertLeadButtonProps> = ({\n lead,\n target,\n onConverted,\n}) => {\n const [open, setOpen] = useState(false);\n const [dealTitle, setDealTitle] = useState(lead.title);\n const [error, setError] = useState<string | null>(null);\n const [convertLead, { loading: converting }] =\n useConvertHeadshotmarketingLeadMutation();\n\n const disabled = target === null;\n\n const openConfirm = (): void => {\n setDealTitle(lead.title);\n setError(null);\n setOpen(true);\n };\n\n const closeConfirm = (): void => {\n if (converting) return;\n setError(null);\n setOpen(false);\n };\n\n const handleConvert = async (): Promise<void> => {\n if (!target) return;\n const title = dealTitle.trim();\n if (!title) {\n setError(\"Deal title is required.\");\n return;\n }\n setError(null);\n try {\n await convertLead({\n variables: {\n leadId: lead.id,\n pipelineId: target.pipelineId,\n stageId: target.stageId,\n dealTitle: title,\n },\n });\n setOpen(false);\n onConverted();\n } catch (err) {\n setError(
|
|
1
|
+
{"version":3,"file":"ConvertLeadButton.js","names":["_Fragment","inputClass","labelClass","ConvertLeadButton","open","setOpen","useState","dealTitle","setDealTitle","lead","error","setError","convertLead","converting","useConvertHeadshotmarketingLeadMutation","disabled","target","openConfirm","closeConfirm","handleConvert","title","onConverted","err","readableError","Fragment","ArrowRightLeft","Modal"],"sources":["../../../../src/headshotmarketing/pages/crm/ConvertLeadButton.tsx"],"sourcesContent":["/**\n * Convert-to-deal row action\n *\n * Co-located with LeadsPage. Renders a compact \"Convert to deal\" icon button in\n * the leads table row-actions cell. Clicking opens a small confirm dialog that\n * shows the target pipeline + stage (the workspace's default/first pipeline and\n * its first stage, resolved by LeadsPage from the bootstrap) and lets the user\n * confirm/adjust the deal title before calling the real\n * `useConvertHeadshotmarketingLeadMutation`. On success it calls `onConverted()`\n * (the page's bootstrap `refetch`) so the lead moves into the deals pipeline.\n *\n * When the workspace has no pipeline/stage yet, `target` is null and the button\n * renders disabled with an honest explanation rather than a broken action.\n *\n * @module headshotmarketing/pages/crm\n */\n\nimport { useState, type FC } from \"react\";\nimport { ArrowRightLeft } from \"lucide-react\";\nimport { Modal } from \"../../components\";\nimport { useConvertHeadshotmarketingLeadMutation } from \"../../../generated/wspace-operations\";\nimport { readableError } from \"../../utils/readableError\";\n\nconst inputClass =\n \"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\";\nconst labelClass = \"block text-sm font-medium text-text-primary mb-1\";\n\n/** The pipeline + stage a converted deal lands in, resolved from the bootstrap. */\nexport interface ConvertTarget {\n pipelineId: string;\n pipelineName: string;\n stageId: string;\n stageName: string;\n}\n\nexport interface ConvertLeadButtonProps {\n lead: { id: string; title: string };\n /** Default/first pipeline + its first stage, or null when none exists yet. */\n target: ConvertTarget | null;\n /** Called after a successful conversion (wire to the page's bootstrap refetch). */\n onConverted: () => void;\n}\n\nexport const ConvertLeadButton: FC<ConvertLeadButtonProps> = ({\n lead,\n target,\n onConverted,\n}) => {\n const [open, setOpen] = useState(false);\n const [dealTitle, setDealTitle] = useState(lead.title);\n const [error, setError] = useState<string | null>(null);\n const [convertLead, { loading: converting }] =\n useConvertHeadshotmarketingLeadMutation();\n\n const disabled = target === null;\n\n const openConfirm = (): void => {\n setDealTitle(lead.title);\n setError(null);\n setOpen(true);\n };\n\n const closeConfirm = (): void => {\n if (converting) return;\n setError(null);\n setOpen(false);\n };\n\n const handleConvert = async (): Promise<void> => {\n if (!target) return;\n const title = dealTitle.trim();\n if (!title) {\n setError(\"Deal title is required.\");\n return;\n }\n setError(null);\n try {\n await convertLead({\n variables: {\n leadId: lead.id,\n pipelineId: target.pipelineId,\n stageId: target.stageId,\n dealTitle: title,\n },\n });\n setOpen(false);\n onConverted();\n } catch (err) {\n setError(readableError(err, \"Failed to convert lead to deal.\"));\n }\n };\n\n return (\n <>\n <button\n type=\"button\"\n onClick={openConfirm}\n disabled={disabled}\n title={\n disabled\n ? \"Create a pipeline first to convert leads into deals\"\n : \"Convert to deal\"\n }\n aria-label={`Convert ${lead.title} to deal`}\n className=\"inline-flex h-8 w-8 items-center justify-center rounded-md text-text-secondary hover:bg-bg-sunken hover:text-action-primary-bg disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-text-secondary\"\n >\n <ArrowRightLeft className=\"h-4 w-4\" aria-hidden=\"true\" />\n </button>\n\n {target && (\n <Modal\n open={open}\n onClose={closeConfirm}\n title=\"Convert to deal\"\n description=\"Move this lead into your sales pipeline as a new deal.\"\n size=\"sm\"\n footer={\n <>\n <button\n type=\"button\"\n onClick={closeConfirm}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n Cancel\n </button>\n <button\n type=\"button\"\n onClick={() => void handleConvert()}\n disabled={converting}\n className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-60\"\n >\n <ArrowRightLeft className=\"h-4 w-4\" />\n {converting ? \"Converting…\" : \"Convert\"}\n </button>\n </>\n }\n >\n <div className=\"space-y-4\">\n <div>\n <label className={labelClass} htmlFor=\"convert-deal-title\">\n Deal title\n </label>\n <input\n id=\"convert-deal-title\"\n className={inputClass}\n value={dealTitle}\n onChange={(e) => setDealTitle(e.target.value)}\n />\n </div>\n <div className=\"rounded-lg border border-border-subtle bg-bg-sunken px-4 py-3 text-sm\">\n <p className=\"text-text-secondary\">\n Lands in{\" \"}\n <span className=\"font-medium text-text-primary\">\n {target.pipelineName}\n </span>{\" \"}\n at stage{\" \"}\n <span className=\"font-medium text-text-primary\">\n {target.stageName}\n </span>\n .\n </p>\n </div>\n {error && (\n <div className=\"rounded-lg border border-status-error-border/30 bg-status-error-bg/10 px-4 py-3 text-sm text-status-error-text\">\n {error}\n </div>\n )}\n </div>\n </Modal>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;;AAuBA,IAAMC,IACJ,wMACIC,IAAa,oDAkBNC,KAAiD,EAC5D,SACA,WACA,qBACI;CACJ,IAAM,CAACC,GAAMC,KAAWC,EAAS,EAAK,GAChC,CAACC,GAAWC,KAAgBF,EAASG,EAAK,KAAK,GAC/C,CAACC,GAAOC,KAAYL,EAAwB,IAAI,GAChD,CAACM,GAAa,EAAE,SAASC,OAC7BC,EAAwC,GAEpCC,IAAWC,MAAW,MAEtBC,UAA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