@sonordev/agency-site-kit 0.4.0 → 0.4.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/chunk-7D4H36UF.js +13 -0
- package/dist/chunk-7D4H36UF.js.map +1 -0
- package/dist/{chunk-XLK77USA.js → chunk-K2BGTDSN.js} +2 -2
- package/dist/{chunk-XLK77USA.js.map → chunk-K2BGTDSN.js.map} +1 -1
- package/dist/{chunk-UNTOEWQL.js → chunk-NLGUPJZA.js} +9 -6
- package/dist/chunk-NLGUPJZA.js.map +1 -0
- package/dist/{chunk-L7E3UHQC.cjs → chunk-QGSW43TM.cjs} +9 -6
- package/dist/chunk-QGSW43TM.cjs.map +1 -0
- package/dist/{chunk-NIZJLONK.js → chunk-RWQ675N6.js} +72 -13
- package/dist/chunk-RWQ675N6.js.map +1 -0
- package/dist/{chunk-4N7ENJ7L.cjs → chunk-UXUU7FVT.cjs} +75 -12
- package/dist/chunk-UXUU7FVT.cjs.map +1 -0
- package/dist/chunk-ZBPF7TLZ.cjs +16 -0
- package/dist/chunk-ZBPF7TLZ.cjs.map +1 -0
- package/dist/index.cjs +34 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/portfolio/client.cjs +40 -6
- package/dist/portfolio/client.cjs.map +1 -1
- package/dist/portfolio/client.d.cts +20 -1
- package/dist/portfolio/client.d.ts +20 -1
- package/dist/portfolio/client.js +37 -5
- package/dist/portfolio/client.js.map +1 -1
- package/dist/portfolio/components/PortfolioErrorFallback.cjs +1 -1
- package/dist/portfolio/components/PortfolioErrorFallback.cjs.map +1 -1
- package/dist/portfolio/components/PortfolioErrorFallback.js +1 -1
- package/dist/portfolio/index.cjs +34 -9
- package/dist/portfolio/index.d.cts +82 -5
- package/dist/portfolio/index.d.ts +82 -5
- package/dist/portfolio/index.js +3 -2
- package/dist/portfolio/sections/ChallengesSection.cjs +1 -1
- package/dist/portfolio/sections/ChallengesSection.cjs.map +1 -1
- package/dist/portfolio/sections/ChallengesSection.js +1 -1
- package/dist/portfolio/sections/ChallengesSection.js.map +1 -1
- package/dist/portfolio/sections/HeroSection.cjs +3 -3
- package/dist/portfolio/sections/HeroSection.cjs.map +1 -1
- package/dist/portfolio/sections/HeroSection.js +3 -3
- package/dist/portfolio/sections/HeroSection.js.map +1 -1
- package/dist/portfolio/sections/PerformanceSection.cjs +1 -64
- package/dist/portfolio/sections/PerformanceSection.cjs.map +1 -1
- package/dist/portfolio/sections/PerformanceSection.js +1 -64
- package/dist/portfolio/sections/PerformanceSection.js.map +1 -1
- package/dist/portfolio/sections/ResultsSection.cjs +3 -2
- package/dist/portfolio/sections/ResultsSection.cjs.map +1 -1
- package/dist/portfolio/sections/ResultsSection.d.cts +1 -1
- package/dist/portfolio/sections/ResultsSection.d.ts +1 -1
- package/dist/portfolio/sections/ResultsSection.js +2 -1
- package/dist/portfolio/sections/ResultsSection.js.map +1 -1
- package/dist/portfolio/sections/SiteArchitectureSection.cjs +1 -1
- package/dist/portfolio/sections/SiteArchitectureSection.cjs.map +1 -1
- package/dist/portfolio/sections/SiteArchitectureSection.js +1 -1
- package/dist/portfolio/sections/SiteArchitectureSection.js.map +1 -1
- package/dist/portfolio/sections/SpeedComparisonSection.cjs +1 -1
- package/dist/portfolio/sections/SpeedComparisonSection.cjs.map +1 -1
- package/dist/portfolio/sections/SpeedComparisonSection.js +1 -1
- package/dist/portfolio/sections/SpeedComparisonSection.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-4N7ENJ7L.cjs.map +0 -1
- package/dist/chunk-L7E3UHQC.cjs.map +0 -1
- package/dist/chunk-NIZJLONK.js.map +0 -1
- package/dist/chunk-UNTOEWQL.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/portfolio/client.ts","../../src/portfolio/components/PortfolioGrid.tsx","../../src/portfolio/components/PortfolioCard.tsx","../../src/portfolio/components/PortfolioErrorFallback.tsx","../../src/portfolio/components/PortfolioLeadCTA.tsx","../../src/portfolio/components/PortfolioAnalytics.tsx"],"sourcesContent":["'use client';\n\n/**\n * @sonordev/agency-site-kit/portfolio/client — Client-only portfolio components\n *\n * Components in this barrel require browser APIs (DOM, events, animations).\n * The 'use client' directive marks the client boundary; the build also stamps\n * every compiled file in the client bundle with the directive.\n *\n * Individual section components live at\n * `@sonordev/agency-site-kit/portfolio/sections/<Name>` and animation\n * primitives at `@sonordev/agency-site-kit/portfolio/primitives/<Name>` —\n * import those subpaths directly to compose custom layouts.\n */\n\nimport type { PortfolioItem, PortfolioItemFull, PortfolioSection } from '../types';\n\n// Grid/Card are shared (directive-less) components; importing them through\n// this 'use client' barrel yields the client copy for client-side callers.\n// Server code renders them via PortfolioIndex / the /portfolio barrel.\nexport { default as PortfolioGrid } from './components/PortfolioGrid';\nexport { default as PortfolioCard } from './components/PortfolioCard';\n\n// Error boundary UI for portfolio routes (error.tsx must be a client file)\nexport { default as PortfolioErrorFallback } from './components/PortfolioErrorFallback';\nexport type { PortfolioErrorFallbackProps } from './components/PortfolioErrorFallback';\n\n// Lead capture CTA — Sonor managed form with case-study attribution\nexport { default as PortfolioLeadCTA } from './components/PortfolioLeadCTA';\nexport type { PortfolioLeadCTAProps } from './components/PortfolioLeadCTA';\n\n// Engagement-tracking island (PortfolioPage mounts this automatically;\n// exported for custom layouts)\nexport { default as PortfolioAnalytics } from './components/PortfolioAnalytics';\n\n// Re-export types for convenience\nexport type {\n PortfolioItem,\n PortfolioItemFull,\n PortfolioSection,\n};\n","// Shared component — no directive on purpose: hook-free, so it renders\n// server-side (zero JS) from PortfolioIndex and stays usable from client\n// code via the /portfolio/client barrel.\nimport React from 'react';\nimport type { PortfolioItem } from '../../types';\nimport ScrollReveal from '@sonordev/agency-site-kit/portfolio/primitives/ScrollReveal';\nimport PortfolioCard from './PortfolioCard';\n\ninterface PortfolioGridProps {\n items: PortfolioItem[];\n className?: string;\n /** Base path for portfolio detail links (default: '/work') */\n basePath?: string;\n}\n\nexport default function PortfolioGrid({ items, className = '', basePath = '/work' }: PortfolioGridProps) {\n return (\n <ScrollReveal stagger={0.1}>\n <div\n className={`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 ${className}`}\n style={{\n gap: 'var(--sk-grid-gap, 24px)',\n }}\n >\n {items.map((item) => (\n <PortfolioCard key={item.id} item={item} basePath={basePath} />\n ))}\n </div>\n </ScrollReveal>\n );\n}\n","// Shared component — no directive on purpose: hook-free, so it renders\n// server-side (zero JS) from PortfolioIndex and stays usable from client\n// code via the /portfolio/client barrel.\nimport React from 'react';\nimport Image from 'next/image';\nimport Link from 'next/link';\nimport type { PortfolioItem } from '../../types';\nimport GlassCard from '@sonordev/agency-site-kit/portfolio/primitives/GlassCard';\n\ninterface PortfolioCardProps {\n item: PortfolioItem;\n className?: string;\n /** Base path for portfolio detail links (default: '/work') */\n basePath?: string;\n}\n\nexport default function PortfolioCard({ item, className = '', basePath = '/work' }: PortfolioCardProps) {\n // Use hero_screenshots desktop → hero_image → trifolio screenshot convention\n const thumbnailSrc =\n item.hero_screenshots?.desktop ||\n item.hero_image ||\n (item.project_id ? `/portfolio-previews/${item.slug}.png` : undefined);\n const kpis = Array.isArray(item.kpis) ? item.kpis : [];\n const services = Array.isArray(item.services) ? item.services : [];\n const kpiPreview = kpis.slice(0, 3);\n const servicePreview = services.slice(0, 3);\n\n return (\n <Link href={`${basePath}/${item.slug}`} className={`block group ${className}`}>\n <GlassCard padding=\"sm\" hover>\n <div className=\"flex flex-col gap-4\">\n {/* Thumbnail */}\n {thumbnailSrc && (\n <div\n className=\"relative w-full overflow-hidden rounded-xl\"\n style={{ aspectRatio: '16/10' }}\n >\n <Image\n src={thumbnailSrc}\n alt={item.hero_image_alt || item.title}\n fill\n sizes=\"(max-width: 768px) 100vw, (max-width: 1024px) 50vw, 33vw\"\n className=\"object-cover object-top transition-transform duration-500 group-hover:scale-105\"\n />\n {/* Category badge */}\n <span\n className=\"absolute top-3 left-3 px-3 py-1 rounded-full text-[11px] uppercase tracking-wider font-semibold\"\n style={{\n background: 'color-mix(in srgb, var(--sk-primary, #6366f1) 80%, transparent)',\n color: '#ffffff',\n backdropFilter: 'blur(8px)',\n }}\n >\n {item.category?.replace(/[-_]/g, ' ').replace(/\\b\\w/g, (c: string) => c.toUpperCase())}\n </span>\n </div>\n )}\n\n {/* Text content */}\n <div className=\"flex flex-col gap-2 px-2 pb-2\">\n <h3\n className=\"text-lg font-semibold line-clamp-1\"\n style={{ color: 'var(--sk-text-primary, #ffffff)' }}\n >\n {item.title}\n </h3>\n\n {item.subtitle && (\n <p\n className=\"text-sm line-clamp-2\"\n style={{ color: 'var(--sk-text-tertiary, #71717a)' }}\n >\n {item.subtitle}\n </p>\n )}\n\n {/* KPI preview */}\n {kpiPreview.length > 0 && (\n <div className=\"flex items-center gap-4 mt-1\">\n {kpiPreview.map((kpi, i) => (\n <div key={i} className=\"flex flex-col\">\n <span\n className=\"text-base font-bold\"\n style={{ color: 'var(--sk-primary, #6366f1)' }}\n >\n {kpi.prefix || ''}\n {kpi.value.toLocaleString()}\n {kpi.suffix}\n </span>\n <span\n className=\"text-[10px] uppercase tracking-wider font-medium\"\n style={{ color: 'var(--sk-text-tertiary, #71717a)' }}\n >\n {kpi.label}\n </span>\n </div>\n ))}\n </div>\n )}\n\n {/* Services tags */}\n {servicePreview.length > 0 && (\n <div className=\"flex flex-wrap gap-1.5 mt-2\">\n {servicePreview.map((service) => (\n <span\n key={service}\n className=\"px-2.5 py-0.5 rounded-full text-[11px] font-medium\"\n style={{\n background: 'var(--sk-surface, rgba(255,255,255,0.05))',\n color: 'var(--sk-text-secondary, #a1a1aa)',\n border: '1px solid var(--sk-border, rgba(255,255,255,0.1))',\n }}\n >\n {service}\n </span>\n ))}\n {services.length > 3 && (\n <span\n className=\"px-2.5 py-0.5 rounded-full text-[11px] font-medium\"\n style={{\n background: 'var(--sk-surface, rgba(255,255,255,0.05))',\n color: 'var(--sk-text-tertiary, #71717a)',\n }}\n >\n +{item.services.length - 3}\n </span>\n )}\n </div>\n )}\n </div>\n </div>\n </GlassCard>\n </Link>\n );\n}\n","'use client';\n\n/**\n * Error boundary UI for portfolio routes — pairs with the PortfolioApiError\n * contract (infrastructure failures throw; Next renders the route's\n * error.tsx). Drop into `error.tsx`:\n *\n * ```tsx\n * 'use client';\n * export { PortfolioErrorFallback as default } from '@sonordev/agency-site-kit/portfolio/client';\n * ```\n */\n\nimport React from 'react';\n\nexport interface PortfolioErrorFallbackProps {\n error: Error & { digest?: string };\n reset: () => void;\n}\n\nexport default function PortfolioErrorFallback({ error, reset }: PortfolioErrorFallbackProps) {\n return (\n <section className=\"w-full py-24\">\n <div\n className=\"max-w-xl mx-auto px-8 py-12 rounded-2xl text-center flex flex-col items-center gap-4\"\n style={{\n background: 'var(--sk-surface, rgba(255,255,255,0.05))',\n border: '1px solid var(--sk-border, rgba(255,255,255,0.1))',\n }}\n >\n <h2\n className=\"text-xl font-semibold\"\n style={{ color: 'var(--sk-text-primary, #ffffff)' }}\n >\n Our work is taking a moment to load\n </h2>\n <p className=\"text-sm\" style={{ color: 'var(--sk-text-secondary, #a1a1aa)' }}>\n The portfolio couldn't be fetched just now. It's us, not you — try again in a\n few seconds.\n </p>\n {error?.digest && (\n <p className=\"text-xs\" style={{ color: 'var(--sk-text-tertiary, #71717a)' }}>\n Reference: {error.digest}\n </p>\n )}\n <button\n onClick={reset}\n className=\"mt-2 px-6 py-2.5 rounded-xl text-sm font-semibold transition-opacity hover:opacity-90\"\n style={{ background: 'var(--sk-primary, #6366f1)', color: '#ffffff' }}\n >\n Try again\n </button>\n </div>\n </section>\n );\n}\n","'use client';\n\n/**\n * PortfolioLeadCTA — turn a case study into a lead source.\n *\n * Renders a Sonor managed form (site-kit ManagedForm — never hand-rolled\n * markup) inside a CTA shell. Attribution comes free on two rails:\n *\n * 1. The submission's metadata.pageUrl (sent automatically by site-kit)\n * lands in the CRM's page_url/source_url columns — that IS the case\n * study URL.\n * 2. onSuccess fires a `portfolio_lead` conversion with the case-study\n * slug via the standalone dispatch, so Signal/analytics can report\n * \"leads per case study\" without parsing URLs.\n *\n * If the managed form defines a hidden `portfolio_slug` field, define it in\n * the dashboard and it will arrive pre-filled too (fields JSONB).\n */\n\nimport React from 'react';\nimport { ManagedForm } from '@sonordev/site-kit/forms';\nimport { trackConversion } from '@sonordev/site-kit/client';\n\nexport interface PortfolioLeadCTAProps {\n /** Managed form key from the Sonor dashboard (e.g. \"portfolio-inquiry\"). */\n formId: string;\n /** The case study this CTA sits on — used for lead attribution. */\n item: { slug: string; title: string };\n heading?: string;\n description?: string;\n className?: string;\n}\n\nexport default function PortfolioLeadCTA({\n formId,\n item,\n heading = 'Want results like these?',\n description = \"Tell us about your project and we'll show you what's possible.\",\n className = '',\n}: PortfolioLeadCTAProps) {\n return (\n <section\n className={`w-full py-20 md:py-28 ${className}`}\n style={{ background: 'var(--sk-bg, #0a0a0a)' }}\n data-portfolio-section=\"portfolioLeadForm\"\n >\n <div className=\"max-w-2xl mx-auto px-6\">\n <div\n className=\"rounded-2xl p-8 md:p-12\"\n style={{\n background: 'var(--sk-surface, rgba(255,255,255,0.05))',\n backdropFilter: 'blur(16px)',\n border: '1px solid var(--sk-border, rgba(255,255,255,0.1))',\n }}\n >\n <h2\n className=\"text-2xl md:text-3xl font-bold mb-3\"\n style={{\n color: 'var(--sk-text-primary, #ffffff)',\n fontFamily: 'var(--sk-font-heading, inherit)',\n }}\n >\n {heading}\n </h2>\n <p\n className=\"text-base mb-8\"\n style={{ color: 'var(--sk-text-secondary, #a1a1aa)' }}\n >\n {description}\n </p>\n\n <ManagedForm\n formId={formId}\n onSuccess={() => {\n trackConversion({\n type: 'portfolio_lead',\n metadata: { case_study: item.slug, case_study_title: item.title },\n });\n }}\n />\n </div>\n </div>\n </section>\n );\n}\n","'use client';\n\n/**\n * PortfolioAnalytics — childless engagement-tracking island.\n *\n * Mounted by PortfolioPage as a SIBLING of the content (never a wrapper —\n * house perf doctrine), deferred to idle so it stays out of the hydration\n * path. Observes the server-rendered `data-portfolio-section` markers and\n * emits events through site-kit's standalone dispatch (which queues until\n * the site's AnalyticsProvider mounts and no-ops if it never does):\n *\n * portfolio_section_view once per section type per page view\n * portfolio_live_site_click clicks on [data-portfolio-action=\"live-site\"]\n * portfolio_cta_click clicks on [data-portfolio-action=\"cta\"]\n *\n * This is the raw material for \"your QCR case study converts best\" insights.\n */\n\nimport { useEffect } from 'react';\nimport { trackEvent } from '@sonordev/site-kit/client';\n\nexport default function PortfolioAnalytics({ slug }: { slug: string }) {\n useEffect(() => {\n let cleanup = () => {};\n\n const setup = () => {\n const seen = new Set<string>();\n const io = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n if (!entry.isIntersecting) continue;\n const type = (entry.target as HTMLElement).dataset.portfolioSection;\n if (!type || seen.has(type)) continue;\n seen.add(type);\n trackEvent({\n name: 'portfolio_section_view',\n category: 'portfolio',\n label: type,\n properties: { case_study: slug, section: type },\n });\n }\n },\n { threshold: 0.4 },\n );\n document\n .querySelectorAll<HTMLElement>('[data-portfolio-section]')\n .forEach((el) => io.observe(el));\n\n const onClick = (event: MouseEvent) => {\n const link = (event.target as HTMLElement).closest<HTMLAnchorElement>(\n 'a[data-portfolio-action]',\n );\n if (!link) return;\n const action = link.dataset.portfolioAction;\n trackEvent({\n name: action === 'live-site' ? 'portfolio_live_site_click' : 'portfolio_cta_click',\n category: 'portfolio',\n label: slug,\n properties: { case_study: slug, href: link.href },\n });\n };\n document.addEventListener('click', onClick, { passive: true });\n\n cleanup = () => {\n io.disconnect();\n document.removeEventListener('click', onClick);\n };\n };\n\n // Idle-defer: engagement tracking must never compete with hydration.\n let idleId: number | ReturnType<typeof setTimeout>;\n if ('requestIdleCallback' in window) {\n idleId = window.requestIdleCallback(setup, { timeout: 3000 });\n } else {\n idleId = setTimeout(setup, 1500);\n }\n\n return () => {\n if ('requestIdleCallback' in window) window.cancelIdleC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D,gBAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,EAAG;AAC7B,iBAAK,IAAI,IAAI;AACb,2CAAW;AAAA,cACT,MAAM;AAAA,cACN,UAAU;AAAA,cACV,OAAO;AAAA,cACP,YAAY,EAAE,YAAY,MAAM,SAAS,KAAK;AAAA,YAChD,CAAC;AAAA,UACH;AAAA,QACF;AAAA,QACA,EAAE,WAAW,IAAI;AAAA,MACnB;AACA,eACG,iBAA8B,0BAA0B,EACxD,QAAQ,CAAC,OAAO,GAAG,QAAQ,EAAE,CAAC;AAEjC,YAAM,UAAU,CAAC,UAAsB;AACrC,cAAM,OAAQ,MAAM,OAAuB;AAAA,UACzC;AAAA,QACF;AACA,YAAI,CAAC,KAAM;AACX,cAAM,SAAS,KAAK,QAAQ;AAC5B,uCAAW;AAAA,UACT,MAAM,WAAW,cAAc,8BAA8B;AAAA,UAC7D,UAAU;AAAA,UACV,OAAO;AAAA,UACP,YAAY,EAAE,YAAY,MAAM,MAAM,KAAK,KAAK;AAAA,QAClD,CAAC;AAAA,MACH;AACA,eAAS,iBAAiB,SAAS,SAAS,EAAE,SAAS,KAAK,CAAC;AAE7D,gBAAU,MAAM;AACd,WAAG,WAAW;AACd,iBAAS,oBAAoB,SAAS,OAAO;AAAA,MAC/C;AAAA,IACF;AAGA,QAAI;AACJ,QAAI,yBAAyB,QAAQ;AACnC,eAAS,OAAO,oBAAoB,OAAO,EAAE,SAAS,IAAK,CAAC;AAAA,IAC9D,OAAO;AACL,eAAS,WAAW,OAAO,IAAI;AAAA,IACjC;AAEA,WAAO,MAAM;AACX,UAAI,yBAAyB,OAAQ,QAAO,mBAAmB,MAAgB;AAAA,UAC1E,cAAa,MAAuC;AACzD,cAAQ;AAAA,IACV;AAAA,EACF,GAAG,CAAC,IAAI,CAAC;AAET,SAAO;AACT;","names":["Link","GlassCard","Image","import_jsx_runtime","ScrollReveal","import_jsx_runtime","import_jsx_runtime","import_client"]}
|
|
1
|
+
{"version":3,"sources":["../../src/portfolio/client.ts","../../src/portfolio/components/PortfolioGrid.tsx","../../src/portfolio/components/PortfolioCard.tsx","../../src/portfolio/curate-proof.ts","../../src/portfolio/format.ts","../../src/portfolio/components/PortfolioErrorFallback.tsx","../../src/portfolio/components/PortfolioLeadCTA.tsx","../../src/portfolio/components/PortfolioAnalytics.tsx"],"sourcesContent":["'use client';\n\n/**\n * @sonordev/agency-site-kit/portfolio/client — Client-only portfolio components\n *\n * Components in this barrel require browser APIs (DOM, events, animations).\n * The 'use client' directive marks the client boundary; the build also stamps\n * every compiled file in the client bundle with the directive.\n *\n * Individual section components live at\n * `@sonordev/agency-site-kit/portfolio/sections/<Name>` and animation\n * primitives at `@sonordev/agency-site-kit/portfolio/primitives/<Name>` —\n * import those subpaths directly to compose custom layouts.\n */\n\nimport type { PortfolioItem, PortfolioItemFull, PortfolioSection } from '../types';\n\n// Grid/Card are shared (directive-less) components; importing them through\n// this 'use client' barrel yields the client copy for client-side callers.\n// Server code renders them via PortfolioIndex / the /portfolio barrel.\nexport { default as PortfolioGrid } from './components/PortfolioGrid';\nexport { default as PortfolioCard } from './components/PortfolioCard';\n\n// Pure label formatters — client-side copy of the same source module the\n// server barrel exports (e.g. app-side category filter chips).\nexport { formatCategoryLabel, formatServiceTag } from './format';\n\n// Error boundary UI for portfolio routes (error.tsx must be a client file)\nexport { default as PortfolioErrorFallback } from './components/PortfolioErrorFallback';\nexport type { PortfolioErrorFallbackProps } from './components/PortfolioErrorFallback';\n\n// Lead capture CTA — Sonor managed form with case-study attribution\nexport { default as PortfolioLeadCTA } from './components/PortfolioLeadCTA';\nexport type { PortfolioLeadCTAProps } from './components/PortfolioLeadCTA';\n\n// Engagement-tracking island (PortfolioPage mounts this automatically;\n// exported for custom layouts)\nexport { default as PortfolioAnalytics } from './components/PortfolioAnalytics';\n\n// Re-export types for convenience\nexport type {\n PortfolioItem,\n PortfolioItemFull,\n PortfolioSection,\n};\n","// Shared component — no directive on purpose: hook-free, so it renders\n// server-side (zero JS) from PortfolioIndex and stays usable from client\n// code via the /portfolio/client barrel.\nimport React from 'react';\nimport type { PortfolioItem } from '../../types';\nimport ScrollReveal from '@sonordev/agency-site-kit/portfolio/primitives/ScrollReveal';\nimport PortfolioCard from './PortfolioCard';\n\ninterface PortfolioGridProps {\n items: PortfolioItem[];\n className?: string;\n /** Base path for portfolio detail links (default: '/work') */\n basePath?: string;\n}\n\nexport default function PortfolioGrid({ items, className = '', basePath = '/work' }: PortfolioGridProps) {\n return (\n <ScrollReveal stagger={0.1}>\n <div\n className={`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 ${className}`}\n style={{\n gap: 'var(--sk-grid-gap, 24px)',\n }}\n >\n {items.map((item) => (\n <PortfolioCard key={item.id} item={item} basePath={basePath} />\n ))}\n </div>\n </ScrollReveal>\n );\n}\n","// Shared component — no directive on purpose: hook-free, so it renders\n// server-side (zero JS) from PortfolioIndex and stays usable from client\n// code via the /portfolio/client barrel.\nimport React from 'react';\nimport Image from 'next/image';\nimport Link from 'next/link';\nimport type { PortfolioItem } from '../../types';\nimport GlassCard from '@sonordev/agency-site-kit/portfolio/primitives/GlassCard';\nimport { curateHeroKpis } from '../curate-proof';\nimport { formatCategoryLabel, formatServiceTag } from '../format';\n\ninterface PortfolioCardProps {\n item: PortfolioItem;\n className?: string;\n /** Base path for portfolio detail links (default: '/work') */\n basePath?: string;\n}\n\nexport default function PortfolioCard({ item, className = '', basePath = '/work' }: PortfolioCardProps) {\n // Use hero_screenshots desktop → hero_image → trifolio screenshot convention\n const thumbnailSrc =\n item.hero_screenshots?.desktop ||\n item.hero_image ||\n (item.project_id ? `/portfolio-previews/${item.slug}.png` : undefined);\n const kpis = Array.isArray(item.kpis) ? item.kpis : [];\n const services = Array.isArray(item.services) ? item.services : [];\n // Collapse per-category Lighthouse KPIs so a card never reads\n // \"100/100 · 100/100 · 100/100\" — business outcomes lead the preview.\n const kpiPreview = curateHeroKpis(kpis).slice(0, 3);\n const servicePreview = services.slice(0, 3);\n\n return (\n <Link href={`${basePath}/${item.slug}`} className={`block group ${className}`}>\n <GlassCard padding=\"sm\" hover>\n <div className=\"flex flex-col gap-4\">\n {/* Thumbnail */}\n {thumbnailSrc && (\n <div\n className=\"relative w-full overflow-hidden rounded-xl\"\n style={{ aspectRatio: '16/10' }}\n >\n <Image\n src={thumbnailSrc}\n alt={item.hero_image_alt || item.title}\n fill\n sizes=\"(max-width: 768px) 100vw, (max-width: 1024px) 50vw, 33vw\"\n className=\"object-cover object-top transition-transform duration-500 group-hover:scale-105\"\n />\n {/* Category badge */}\n <span\n className=\"absolute top-3 left-3 px-3 py-1 rounded-full text-[11px] uppercase tracking-wider font-semibold\"\n style={{\n background: 'color-mix(in srgb, var(--sk-primary, #6366f1) 80%, transparent)',\n color: '#ffffff',\n backdropFilter: 'blur(8px)',\n }}\n >\n {formatCategoryLabel(item.category)}\n </span>\n </div>\n )}\n\n {/* Text content */}\n <div className=\"flex flex-col gap-2 px-2 pb-2\">\n <h3\n className=\"text-lg font-semibold line-clamp-1\"\n style={{ color: 'var(--sk-text-primary, #ffffff)' }}\n >\n {item.title}\n </h3>\n\n {item.subtitle && (\n <p\n className=\"text-sm line-clamp-2\"\n style={{ color: 'var(--sk-text-tertiary, #71717a)' }}\n >\n {item.subtitle}\n </p>\n )}\n\n {/* KPI preview */}\n {kpiPreview.length > 0 && (\n <div className=\"flex items-center gap-4 mt-1\">\n {kpiPreview.map((kpi, i) => (\n <div key={i} className=\"flex flex-col\">\n <span\n className=\"text-base font-bold\"\n style={{ color: 'var(--sk-primary, #6366f1)' }}\n >\n {kpi.prefix || ''}\n {kpi.value.toLocaleString()}\n {kpi.suffix}\n </span>\n <span\n className=\"text-[10px] uppercase tracking-wider font-medium\"\n style={{ color: 'var(--sk-text-tertiary, #71717a)' }}\n >\n {kpi.label}\n </span>\n </div>\n ))}\n </div>\n )}\n\n {/* Services tags */}\n {servicePreview.length > 0 && (\n <div className=\"flex flex-wrap gap-1.5 mt-2\">\n {servicePreview.map((service) => (\n <span\n key={service}\n className=\"px-2.5 py-0.5 rounded-full text-[11px] font-medium\"\n style={{\n background: 'var(--sk-surface, rgba(255,255,255,0.05))',\n color: 'var(--sk-text-secondary, #a1a1aa)',\n border: '1px solid var(--sk-border, rgba(255,255,255,0.1))',\n }}\n >\n {formatServiceTag(service)}\n </span>\n ))}\n {services.length > 3 && (\n <span\n className=\"px-2.5 py-0.5 rounded-full text-[11px] font-medium\"\n style={{\n background: 'var(--sk-surface, rgba(255,255,255,0.05))',\n color: 'var(--sk-text-tertiary, #71717a)',\n }}\n >\n +{item.services.length - 3}\n </span>\n )}\n </div>\n )}\n </div>\n </div>\n </GlassCard>\n </Link>\n );\n}\n","/**\n * curate-proof — single source of truth for which proof points a public case\n * study is allowed to display, and in what shape.\n *\n * Two classes of problem this guards against (both shipped to production on\n * upforge.io before this existed):\n *\n * 1. Repetition: generated items arrive with four \"100/100 Lighthouse X\"\n * KPIs in the hero, the same four restated as Results cards, AND a full\n * Performance section with score gauges. One differentiator repeated\n * twelve times per page stops differentiating. The Performance section is\n * the one home for the Lighthouse breakdown; hero/results/cards collapse\n * to at most one summary tile.\n *\n * 2. Self-harming live metrics: MetricsDelta rows are computed from raw\n * analytics baselines with no editorial judgment — a bounce rate of\n * \"100 → 99.69\" rendered as a green win. Marketing surfaces only show a\n * delta when it's a genuinely flattering, meaningful story.\n *\n * Used by PortfolioPage (hero KPIs + results items), PortfolioCard (KPI\n * preview), and MetricsProvenance (delta gate). Change display policy here,\n * nowhere else.\n */\n\nimport type {\n MetricsDelta,\n PortfolioHeroData,\n PortfolioItemFull,\n PortfolioKPI,\n PortfolioResultItem,\n PortfolioResultsData,\n} from '../types';\n\nconst LIGHTHOUSE_RE = /lighthouse/i;\n\n/** True when a KPI tile is a per-category Lighthouse score. */\nexport function isLighthouseKpi(kpi: PortfolioKPI): boolean {\n return LIGHTHOUSE_RE.test(kpi.label);\n}\n\n/**\n * True when a Results card merely restates a Lighthouse category score\n * (e.g. \"Perfect performance score … measured Lighthouse score of 100/100\").\n * Business outcomes (\"Complete 14-page rebuild\", \"682% session growth\")\n * never match: the title must be about a score AND the card must reference\n * Lighthouse or carry a x/100 metric.\n */\nexport function isLighthouseRestatement(item: PortfolioResultItem): boolean {\n if (!/score/i.test(item.title)) return false;\n if (LIGHTHOUSE_RE.test(`${item.title} ${item.description}`)) return true;\n return item.metric?.suffix === '/100';\n}\n\n/**\n * Collapse per-category Lighthouse KPIs to at most one summary tile, business\n * outcomes first. When every category is present at 100 the summary says so;\n * otherwise the Performance category (the one buyers know) represents the set.\n */\nexport function curateHeroKpis(kpis: PortfolioKPI[]): PortfolioKPI[] {\n const business = kpis.filter((k) => !isLighthouseKpi(k));\n const lighthouse = kpis.filter(isLighthouseKpi);\n if (lighthouse.length <= 1) return kpis;\n\n const allPerfect = lighthouse.length >= 4 && lighthouse.every((k) => k.value === 100);\n const summary: PortfolioKPI = allPerfect\n ? {\n ...lighthouse[0],\n label: 'Lighthouse, all 4 categories',\n description: 'Perfect scores across performance, SEO, accessibility, and best practices.',\n }\n : (lighthouse.find((k) => /performance/i.test(k.label)) ?? lighthouse[0]);\n\n return [...business, summary];\n}\n\n/**\n * Drop Results cards that restate Lighthouse scores when the case study also\n * renders a Performance section (the score breakdown's single home).\n */\nexport function curateResultItems(\n items: PortfolioResultItem[],\n hasPerformanceSection: boolean,\n): PortfolioResultItem[] {\n if (!hasPerformanceSection) return items;\n const curated = items.filter((item) => !isLighthouseRestatement(item));\n // Never curate a Results section into emptiness — if every card was a\n // Lighthouse restatement, keep the strongest single card instead.\n return curated.length > 0 ? curated : items.slice(0, 1);\n}\n\n/**\n * Editorial gate for live metric deltas (\"Verified from live analytics\").\n * `direction` comes from the platform with 'up' meaning IMPROVED (lower-is-\n * better metrics are inverted server-side). A public case study only shows a\n * delta when it's a win worth telling:\n * - improved ('up'), never a regression or flat noise\n * - moved by a double-digit relative margin (small drift isn't a story)\n * - bounce-rate-style metrics must also be respectable in absolute terms —\n * \"100 → 99.69\" is technically an improvement and still self-harm\n */\nexport function gateMetricsDeltas(deltas: MetricsDelta[] | undefined | null): MetricsDelta[] {\n if (!deltas?.length) return [];\n return deltas.filter((d) => {\n if (d.direction !== 'up') return false;\n if (Math.abs(d.deltaPercent) < 10) return false;\n if (/bounce/i.test(d.metric) && d.current > 70) return false;\n return true;\n });\n}\n\n/**\n * Apply the full display policy to a portfolio item before rendering.\n * Pure — returns a new item; the fetched payload is never mutated.\n */\nexport function curatePortfolioProof(item: PortfolioItemFull): PortfolioItemFull {\n const hasPerformanceSection = item.sections.some(\n (s) => s.sectionType === 'portfolioPerformance',\n );\n\n return {\n ...item,\n sections: item.sections.map((section) => {\n if (section.sectionType === 'portfolioHero') {\n const data = section.data as PortfolioHeroData;\n return { ...section, data: { ...data, kpis: curateHeroKpis(data.kpis ?? []) } };\n }\n if (section.sectionType === 'portfolioResults') {\n const data = section.data as PortfolioResultsData;\n return {\n ...section,\n data: { ...data, items: curateResultItems(data.items ?? [], hasPerformanceSection) },\n };\n }\n return section;\n }),\n };\n}\n","/**\n * Presentation formatters shared by portfolio components and consuming apps.\n */\n\n/**\n * Human label for a category slug. Single source of truth — HeroSection,\n * PortfolioCard, and app-side filter chips all render categories through\n * this. Underscores become spaces; hyphens are PRESERVED so compound slugs\n * keep their canonical form (\"e-commerce\" → \"E-Commerce\", never \"E Commerce\"),\n * and every word start (including after a hyphen) is capitalized.\n */\nexport function formatCategoryLabel(slug: string | undefined | null): string {\n if (!slug) return '';\n return slug.replace(/_/g, ' ').replace(/\\b\\w/g, (c: string) => c.toUpperCase());\n}\n\n/**\n * Normalize a service tag's casing for display: the first character of each\n * word is uppercased, the rest left alone (so \"Next.js development\" becomes\n * \"Next.js Development\" and \"Technical SEO implementation\" keeps \"SEO\").\n * Fixes per-item casing drift in stored tags without touching the data.\n */\nexport function formatServiceTag(tag: string | undefined | null): string {\n if (!tag) return '';\n return tag.replace(/(^|[\\s/])([a-z])/g, (_m, sep: string, ch: string) => sep + ch.toUpperCase());\n}\n","'use client';\n\n/**\n * Error boundary UI for portfolio routes — pairs with the PortfolioApiError\n * contract (infrastructure failures throw; Next renders the route's\n * error.tsx). Drop into `error.tsx`:\n *\n * ```tsx\n * 'use client';\n * export { PortfolioErrorFallback as default } from '@sonordev/agency-site-kit/portfolio/client';\n * ```\n */\n\nimport React from 'react';\n\nexport interface PortfolioErrorFallbackProps {\n error: Error & { digest?: string };\n reset: () => void;\n}\n\nexport default function PortfolioErrorFallback({ error, reset }: PortfolioErrorFallbackProps) {\n return (\n <section className=\"w-full py-24\">\n <div\n className=\"max-w-xl mx-auto px-8 py-12 rounded-2xl text-center flex flex-col items-center gap-4\"\n style={{\n background: 'var(--sk-surface, rgba(255,255,255,0.05))',\n border: '1px solid var(--sk-border, rgba(255,255,255,0.1))',\n }}\n >\n <h2\n className=\"text-xl font-semibold\"\n style={{ color: 'var(--sk-text-primary, #ffffff)' }}\n >\n Our work is taking a moment to load\n </h2>\n <p className=\"text-sm\" style={{ color: 'var(--sk-text-secondary, #a1a1aa)' }}>\n The portfolio couldn't be fetched just now. It's us, not you. Try again in a\n few seconds.\n </p>\n {error?.digest && (\n <p className=\"text-xs\" style={{ color: 'var(--sk-text-tertiary, #71717a)' }}>\n Reference: {error.digest}\n </p>\n )}\n <button\n onClick={reset}\n className=\"mt-2 px-6 py-2.5 rounded-xl text-sm font-semibold transition-opacity hover:opacity-90\"\n style={{ background: 'var(--sk-primary, #6366f1)', color: '#ffffff' }}\n >\n Try again\n </button>\n </div>\n </section>\n );\n}\n","'use client';\n\n/**\n * PortfolioLeadCTA — turn a case study into a lead source.\n *\n * Renders a Sonor managed form (site-kit ManagedForm — never hand-rolled\n * markup) inside a CTA shell. Attribution comes free on two rails:\n *\n * 1. The submission's metadata.pageUrl (sent automatically by site-kit)\n * lands in the CRM's page_url/source_url columns — that IS the case\n * study URL.\n * 2. onSuccess fires a `portfolio_lead` conversion with the case-study\n * slug via the standalone dispatch, so Signal/analytics can report\n * \"leads per case study\" without parsing URLs.\n *\n * If the managed form defines a hidden `portfolio_slug` field, define it in\n * the dashboard and it will arrive pre-filled too (fields JSONB).\n */\n\nimport React from 'react';\nimport { ManagedForm } from '@sonordev/site-kit/forms';\nimport { trackConversion } from '@sonordev/site-kit/client';\n\nexport interface PortfolioLeadCTAProps {\n /** Managed form key from the Sonor dashboard (e.g. \"portfolio-inquiry\"). */\n formId: string;\n /** The case study this CTA sits on — used for lead attribution. */\n item: { slug: string; title: string };\n heading?: string;\n description?: string;\n className?: string;\n}\n\nexport default function PortfolioLeadCTA({\n formId,\n item,\n heading = 'Want results like these?',\n description = \"Tell us about your project and we'll show you what's possible.\",\n className = '',\n}: PortfolioLeadCTAProps) {\n return (\n <section\n className={`w-full py-20 md:py-28 ${className}`}\n style={{ background: 'var(--sk-bg, #0a0a0a)' }}\n data-portfolio-section=\"portfolioLeadForm\"\n >\n <div className=\"max-w-2xl mx-auto px-6\">\n <div\n className=\"rounded-2xl p-8 md:p-12\"\n style={{\n background: 'var(--sk-surface, rgba(255,255,255,0.05))',\n backdropFilter: 'blur(16px)',\n border: '1px solid var(--sk-border, rgba(255,255,255,0.1))',\n }}\n >\n <h2\n className=\"text-2xl md:text-3xl font-bold mb-3\"\n style={{\n color: 'var(--sk-text-primary, #ffffff)',\n fontFamily: 'var(--sk-font-heading, inherit)',\n }}\n >\n {heading}\n </h2>\n <p\n className=\"text-base mb-8\"\n style={{ color: 'var(--sk-text-secondary, #a1a1aa)' }}\n >\n {description}\n </p>\n\n <ManagedForm\n formId={formId}\n onSuccess={() => {\n trackConversion({\n type: 'portfolio_lead',\n metadata: { case_study: item.slug, case_study_title: item.title },\n });\n }}\n />\n </div>\n </div>\n </section>\n );\n}\n","'use client';\n\n/**\n * PortfolioAnalytics — childless engagement-tracking island.\n *\n * Mounted by PortfolioPage as a SIBLING of the content (never a wrapper —\n * house perf doctrine), deferred to idle so it stays out of the hydration\n * path. Observes the server-rendered `data-portfolio-section` markers and\n * emits events through site-kit's standalone dispatch (which queues until\n * the site's AnalyticsProvider mounts and no-ops if it never does):\n *\n * portfolio_section_view once per section type per page view\n * portfolio_live_site_click clicks on [data-portfolio-action=\"live-site\"]\n * portfolio_cta_click clicks on [data-portfolio-action=\"cta\"]\n *\n * This is the raw material for \"your QCR case study converts best\" insights.\n */\n\nimport { useEffect } from 'react';\nimport { trackEvent } from '@sonordev/site-kit/client';\n\nexport default function PortfolioAnalytics({ slug }: { slug: string }) {\n useEffect(() => {\n let cleanup = () => {};\n\n const setup = () => {\n const seen = new Set<string>();\n const io = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n if (!entry.isIntersecting) continue;\n const type = (entry.target as HTMLElement).dataset.portfolioSection;\n if (!type || seen.has(type)) continue;\n seen.add(type);\n trackEvent({\n name: 'portfolio_section_view',\n category: 'portfolio',\n label: type,\n properties: { case_study: slug, section: type },\n });\n }\n },\n { threshold: 0.4 },\n );\n document\n .querySelectorAll<HTMLElement>('[data-portfolio-section]')\n .forEach((el) => io.observe(el));\n\n const onClick = (event: MouseEvent) => {\n const link = (event.target as HTMLElement).closest<HTMLAnchorElement>(\n 'a[data-portfolio-action]',\n );\n if (!link) return;\n const action = link.dataset.portfolioAction;\n trackEvent({\n name: action === 'live-site' ? 'portfolio_live_site_click' : 'portfolio_cta_click',\n category: 'portfolio',\n label: slug,\n properties: { case_study: slug, href: link.href },\n });\n };\n document.addEventListener('click', onClick, { passive: true });\n\n cleanup = () => {\n io.disconnect();\n document.removeEventListener('click', onClick);\n };\n };\n\n // Idle-defer: engagement tracking must never compete with hydration.\n let idleId: number | ReturnType<typeof setTimeout>;\n if ('requestIdleCallback' in window) {\n idleId = window.requestIdleCallback(setup, { timeout: 3000 });\n } else {\n idleId = setTimeout(setup, 1500);\n }\n\n return () => {\n if ('requestIdleCallback' in window) window.cancelIdleCallback(idleId as number);\n else clearTimeout(idleId as ReturnType<typeof setTimeout>);\n cleanup();\n };\n }, [slug]);\n\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A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AW,cAAc,8BAA8B;AAAA,UAC7D,UAAU;AAAA,UACV,OAAO;AAAA,UACP,YAAY,EAAE,YAAY,MAAM,MAAM,KAAK,KAAK;AAAA,QAClD,CAAC;AAAA,MACH;AACA,eAAS,iBAAiB,SAAS,SAAS,EAAE,SAAS,KAAK,CAAC;AAE7D,gBAAU,MAAM;AACd,WAAG,WAAW;AACd,iBAAS,oBAAoB,SAAS,OAAO;AAAA,MAC/C;AAAA,IACF;AAGA,QAAI;AACJ,QAAI,yBAAyB,QAAQ;AACnC,eAAS,OAAO,oBAAoB,OAAO,EAAE,SAAS,IAAK,CAAC;AAAA,IAC9D,OAAO;AACL,eAAS,WAAW,OAAO,IAAI;AAAA,IACjC;AAEA,WAAO,MAAM;AACX,UAAI,yBAAyB,OAAQ,QAAO,mBAAmB,MAAgB;AAAA,UAC1E,cAAa,MAAuC;AACzD,cAAQ;AAAA,IACV;AAAA,EACF,GAAG,CAAC,IAAI,CAAC;AAET,SAAO;AACT;","names":["Link","GlassCard","Image","import_jsx_runtime","ScrollReveal","import_jsx_runtime","import_jsx_runtime","import_client"]}
|
|
@@ -21,4 +21,23 @@ interface PortfolioCardProps {
|
|
|
21
21
|
}
|
|
22
22
|
declare function PortfolioCard({ item, className, basePath }: PortfolioCardProps): React.JSX.Element;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Presentation formatters shared by portfolio components and consuming apps.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Human label for a category slug. Single source of truth — HeroSection,
|
|
29
|
+
* PortfolioCard, and app-side filter chips all render categories through
|
|
30
|
+
* this. Underscores become spaces; hyphens are PRESERVED so compound slugs
|
|
31
|
+
* keep their canonical form ("e-commerce" → "E-Commerce", never "E Commerce"),
|
|
32
|
+
* and every word start (including after a hyphen) is capitalized.
|
|
33
|
+
*/
|
|
34
|
+
declare function formatCategoryLabel(slug: string | undefined | null): string;
|
|
35
|
+
/**
|
|
36
|
+
* Normalize a service tag's casing for display: the first character of each
|
|
37
|
+
* word is uppercased, the rest left alone (so "Next.js development" becomes
|
|
38
|
+
* "Next.js Development" and "Technical SEO implementation" keeps "SEO").
|
|
39
|
+
* Fixes per-item casing drift in stored tags without touching the data.
|
|
40
|
+
*/
|
|
41
|
+
declare function formatServiceTag(tag: string | undefined | null): string;
|
|
42
|
+
|
|
43
|
+
export { PortfolioCard, PortfolioGrid, PortfolioItem, formatCategoryLabel, formatServiceTag };
|
|
@@ -21,4 +21,23 @@ interface PortfolioCardProps {
|
|
|
21
21
|
}
|
|
22
22
|
declare function PortfolioCard({ item, className, basePath }: PortfolioCardProps): React.JSX.Element;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Presentation formatters shared by portfolio components and consuming apps.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Human label for a category slug. Single source of truth — HeroSection,
|
|
29
|
+
* PortfolioCard, and app-side filter chips all render categories through
|
|
30
|
+
* this. Underscores become spaces; hyphens are PRESERVED so compound slugs
|
|
31
|
+
* keep their canonical form ("e-commerce" → "E-Commerce", never "E Commerce"),
|
|
32
|
+
* and every word start (including after a hyphen) is capitalized.
|
|
33
|
+
*/
|
|
34
|
+
declare function formatCategoryLabel(slug: string | undefined | null): string;
|
|
35
|
+
/**
|
|
36
|
+
* Normalize a service tag's casing for display: the first character of each
|
|
37
|
+
* word is uppercased, the rest left alone (so "Next.js development" becomes
|
|
38
|
+
* "Next.js Development" and "Technical SEO implementation" keeps "SEO").
|
|
39
|
+
* Fixes per-item casing drift in stored tags without touching the data.
|
|
40
|
+
*/
|
|
41
|
+
declare function formatServiceTag(tag: string | undefined | null): string;
|
|
42
|
+
|
|
43
|
+
export { PortfolioCard, PortfolioGrid, PortfolioItem, formatCategoryLabel, formatServiceTag };
|
package/dist/portfolio/client.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "../chunk-ZINKVJQU.js";
|
|
6
6
|
import {
|
|
7
7
|
PortfolioErrorFallback
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-K2BGTDSN.js";
|
|
9
9
|
import {
|
|
10
10
|
PortfolioLeadCTA
|
|
11
11
|
} from "../chunk-CVT7I5BQ.js";
|
|
@@ -17,12 +17,42 @@ import ScrollReveal from "@sonordev/agency-site-kit/portfolio/primitives/ScrollR
|
|
|
17
17
|
import Image from "next/image";
|
|
18
18
|
import Link from "next/link";
|
|
19
19
|
import GlassCard from "@sonordev/agency-site-kit/portfolio/primitives/GlassCard";
|
|
20
|
+
|
|
21
|
+
// src/portfolio/curate-proof.ts
|
|
22
|
+
var LIGHTHOUSE_RE = /lighthouse/i;
|
|
23
|
+
function isLighthouseKpi(kpi) {
|
|
24
|
+
return LIGHTHOUSE_RE.test(kpi.label);
|
|
25
|
+
}
|
|
26
|
+
function curateHeroKpis(kpis) {
|
|
27
|
+
const business = kpis.filter((k) => !isLighthouseKpi(k));
|
|
28
|
+
const lighthouse = kpis.filter(isLighthouseKpi);
|
|
29
|
+
if (lighthouse.length <= 1) return kpis;
|
|
30
|
+
const allPerfect = lighthouse.length >= 4 && lighthouse.every((k) => k.value === 100);
|
|
31
|
+
const summary = allPerfect ? {
|
|
32
|
+
...lighthouse[0],
|
|
33
|
+
label: "Lighthouse, all 4 categories",
|
|
34
|
+
description: "Perfect scores across performance, SEO, accessibility, and best practices."
|
|
35
|
+
} : lighthouse.find((k) => /performance/i.test(k.label)) ?? lighthouse[0];
|
|
36
|
+
return [...business, summary];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/portfolio/format.ts
|
|
40
|
+
function formatCategoryLabel(slug) {
|
|
41
|
+
if (!slug) return "";
|
|
42
|
+
return slug.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
43
|
+
}
|
|
44
|
+
function formatServiceTag(tag) {
|
|
45
|
+
if (!tag) return "";
|
|
46
|
+
return tag.replace(/(^|[\s/])([a-z])/g, (_m, sep, ch) => sep + ch.toUpperCase());
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/portfolio/components/PortfolioCard.tsx
|
|
20
50
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
51
|
function PortfolioCard({ item, className = "", basePath = "/work" }) {
|
|
22
52
|
const thumbnailSrc = item.hero_screenshots?.desktop || item.hero_image || (item.project_id ? `/portfolio-previews/${item.slug}.png` : void 0);
|
|
23
53
|
const kpis = Array.isArray(item.kpis) ? item.kpis : [];
|
|
24
54
|
const services = Array.isArray(item.services) ? item.services : [];
|
|
25
|
-
const kpiPreview = kpis.slice(0, 3);
|
|
55
|
+
const kpiPreview = curateHeroKpis(kpis).slice(0, 3);
|
|
26
56
|
const servicePreview = services.slice(0, 3);
|
|
27
57
|
return /* @__PURE__ */ jsx(Link, { href: `${basePath}/${item.slug}`, className: `block group ${className}`, children: /* @__PURE__ */ jsx(GlassCard, { padding: "sm", hover: true, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
28
58
|
thumbnailSrc && /* @__PURE__ */ jsxs(
|
|
@@ -50,7 +80,7 @@ function PortfolioCard({ item, className = "", basePath = "/work" }) {
|
|
|
50
80
|
color: "#ffffff",
|
|
51
81
|
backdropFilter: "blur(8px)"
|
|
52
82
|
},
|
|
53
|
-
children: item.category
|
|
83
|
+
children: formatCategoryLabel(item.category)
|
|
54
84
|
}
|
|
55
85
|
)
|
|
56
86
|
]
|
|
@@ -105,7 +135,7 @@ function PortfolioCard({ item, className = "", basePath = "/work" }) {
|
|
|
105
135
|
color: "var(--sk-text-secondary, #a1a1aa)",
|
|
106
136
|
border: "1px solid var(--sk-border, rgba(255,255,255,0.1))"
|
|
107
137
|
},
|
|
108
|
-
children: service
|
|
138
|
+
children: formatServiceTag(service)
|
|
109
139
|
},
|
|
110
140
|
service
|
|
111
141
|
)),
|
|
@@ -147,6 +177,8 @@ export {
|
|
|
147
177
|
PortfolioCard,
|
|
148
178
|
PortfolioErrorFallback,
|
|
149
179
|
PortfolioGrid,
|
|
150
|
-
PortfolioLeadCTA
|
|
180
|
+
PortfolioLeadCTA,
|
|
181
|
+
formatCategoryLabel,
|
|
182
|
+
formatServiceTag
|
|
151
183
|
};
|
|
152
184
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/portfolio/components/PortfolioGrid.tsx","../../src/portfolio/components/PortfolioCard.tsx"],"sourcesContent":["// Shared component — no directive on purpose: hook-free, so it renders\n// server-side (zero JS) from PortfolioIndex and stays usable from client\n// code via the /portfolio/client barrel.\nimport React from 'react';\nimport type { PortfolioItem } from '../../types';\nimport ScrollReveal from '@sonordev/agency-site-kit/portfolio/primitives/ScrollReveal';\nimport PortfolioCard from './PortfolioCard';\n\ninterface PortfolioGridProps {\n items: PortfolioItem[];\n className?: string;\n /** Base path for portfolio detail links (default: '/work') */\n basePath?: string;\n}\n\nexport default function PortfolioGrid({ items, className = '', basePath = '/work' }: PortfolioGridProps) {\n return (\n <ScrollReveal stagger={0.1}>\n <div\n className={`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 ${className}`}\n style={{\n gap: 'var(--sk-grid-gap, 24px)',\n }}\n >\n {items.map((item) => (\n <PortfolioCard key={item.id} item={item} basePath={basePath} />\n ))}\n </div>\n </ScrollReveal>\n );\n}\n","// Shared component — no directive on purpose: hook-free, so it renders\n// server-side (zero JS) from PortfolioIndex and stays usable from client\n// code via the /portfolio/client barrel.\nimport React from 'react';\nimport Image from 'next/image';\nimport Link from 'next/link';\nimport type { PortfolioItem } from '../../types';\nimport GlassCard from '@sonordev/agency-site-kit/portfolio/primitives/GlassCard';\n\ninterface PortfolioCardProps {\n item: PortfolioItem;\n className?: string;\n /** Base path for portfolio detail links (default: '/work') */\n basePath?: string;\n}\n\nexport default function PortfolioCard({ item, className = '', basePath = '/work' }: PortfolioCardProps) {\n // Use hero_screenshots desktop → hero_image → trifolio screenshot convention\n const thumbnailSrc =\n item.hero_screenshots?.desktop ||\n item.hero_image ||\n (item.project_id ? `/portfolio-previews/${item.slug}.png` : undefined);\n const kpis = Array.isArray(item.kpis) ? item.kpis : [];\n const services = Array.isArray(item.services) ? item.services : [];\n const kpiPreview = kpis.slice(0, 3);\n const servicePreview = services.slice(0, 3);\n\n return (\n <Link href={`${basePath}/${item.slug}`} className={`block group ${className}`}>\n <GlassCard padding=\"sm\" hover>\n <div className=\"flex flex-col gap-4\">\n {/* Thumbnail */}\n {thumbnailSrc && (\n <div\n className=\"relative w-full overflow-hidden rounded-xl\"\n style={{ aspectRatio: '16/10' }}\n >\n <Image\n src={thumbnailSrc}\n alt={item.hero_image_alt || item.title}\n fill\n sizes=\"(max-width: 768px) 100vw, (max-width: 1024px) 50vw, 33vw\"\n className=\"object-cover object-top transition-transform duration-500 group-hover:scale-105\"\n />\n {/* Category badge */}\n <span\n className=\"absolute top-3 left-3 px-3 py-1 rounded-full text-[11px] uppercase tracking-wider font-semibold\"\n style={{\n background: 'color-mix(in srgb, var(--sk-primary, #6366f1) 80%, transparent)',\n color: '#ffffff',\n backdropFilter: 'blur(8px)',\n }}\n >\n {item.category?.replace(/[-_]/g, ' ').replace(/\\b\\w/g, (c: string) => c.toUpperCase())}\n </span>\n </div>\n )}\n\n {/* Text content */}\n <div className=\"flex flex-col gap-2 px-2 pb-2\">\n <h3\n className=\"text-lg font-semibold line-clamp-1\"\n style={{ color: 'var(--sk-text-primary, #ffffff)' }}\n >\n {item.title}\n </h3>\n\n {item.subtitle && (\n <p\n className=\"text-sm line-clamp-2\"\n style={{ color: 'var(--sk-text-tertiary, #71717a)' }}\n >\n {item.subtitle}\n </p>\n )}\n\n {/* KPI preview */}\n {kpiPreview.length > 0 && (\n <div className=\"flex items-center gap-4 mt-1\">\n {kpiPreview.map((kpi, i) => (\n <div key={i} className=\"flex flex-col\">\n <span\n className=\"text-base font-bold\"\n style={{ color: 'var(--sk-primary, #6366f1)' }}\n >\n {kpi.prefix || ''}\n {kpi.value.toLocaleString()}\n {kpi.suffix}\n </span>\n <span\n className=\"text-[10px] uppercase tracking-wider font-medium\"\n style={{ color: 'var(--sk-text-tertiary, #71717a)' }}\n >\n {kpi.label}\n </span>\n </div>\n ))}\n </div>\n )}\n\n {/* Services tags */}\n {servicePreview.length > 0 && (\n <div className=\"flex flex-wrap gap-1.5 mt-2\">\n {servicePreview.map((service) => (\n <span\n key={service}\n className=\"px-2.5 py-0.5 rounded-full text-[11px] font-medium\"\n style={{\n background: 'var(--sk-surface, rgba(255,255,255,0.05))',\n color: 'var(--sk-text-secondary, #a1a1aa)',\n border: '1px solid var(--sk-border, rgba(255,255,255,0.1))',\n }}\n >\n {service}\n </span>\n ))}\n {services.length > 3 && (\n <span\n className=\"px-2.5 py-0.5 rounded-full text-[11px] font-medium\"\n style={{\n background: 'var(--sk-surface, rgba(255,255,255,0.05))',\n color: 'var(--sk-text-tertiary, #71717a)',\n }}\n >\n +{item.services.length - 3}\n </span>\n )}\n </div>\n )}\n </div>\n </div>\n </GlassCard>\n </Link>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAKA,OAAO,kBAAkB;;;ACDzB,OAAO,WAAW;AAClB,OAAO,UAAU;AAEjB,OAAO,eAAe;AA0BV,SAIE,KAJF;AAjBG,SAAR,cAA+B,EAAE,MAAM,YAAY,IAAI,WAAW,QAAQ,GAAuB;AAEtG,QAAM,eACJ,KAAK,kBAAkB,WACvB,KAAK,eACJ,KAAK,aAAa,uBAAuB,KAAK,IAAI,SAAS;AAC9D,QAAM,OAAO,MAAM,QAAQ,KAAK,IAAI,IAAI,KAAK,OAAO,CAAC;AACrD,QAAM,WAAW,MAAM,QAAQ,KAAK,QAAQ,IAAI,KAAK,WAAW,CAAC;AACjE,QAAM,aAAa,KAAK,MAAM,GAAG,CAAC;AAClC,QAAM,iBAAiB,SAAS,MAAM,GAAG,CAAC;AAE1C,SACE,oBAAC,QAAK,MAAM,GAAG,QAAQ,IAAI,KAAK,IAAI,IAAI,WAAW,eAAe,SAAS,IACzE,8BAAC,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AAAA,YAElD,cAAI;AAAA;AAAA,QACP;AAAA,WAdQ,CAeV,CACD,GACH;AAAA,MAID,eAAe,SAAS,KACvB,qBAAC,SAAI,WAAU,+BACZ;AAAA,uBAAe,IAAI,CAAC,YACnB;AAAA,UAAC;AAAA;AAAA,YAEC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,YAAY;AAAA,cACZ,OAAO;AAAA,cACP,QAAQ;AAAA,YACV;AAAA,YAEC;AAAA;AAAA,UARI;AAAA,QASP,CACD;AAAA,QACA,SAAS,SAAS,KACjB;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,YAAY;AAAA,cACZ,OAAO;AAAA,YACT;AAAA,YACD;AAAA;AAAA,cACG,KAAK,SAAS,SAAS;AAAA;AAAA;AAAA,QAC3B;AAAA,SAEJ;AAAA,OAEJ;AAAA,KACF,GACF,GACF;AAEJ;;;AD7GU,gBAAAA,YAAA;AAVK,SAAR,cAA+B,EAAE,OAAO,YAAY,IAAI,WAAW,QAAQ,GAAuB;AACvG,SACE,gBAAAA,KAAC,gBAAa,SAAS,KACrB,0BAAAA;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,kDAAkD,SAAS;AAAA,MACtE,OAAO;AAAA,QACL,KAAK;AAAA,MACP;AAAA,MAEC,gBAAM,IAAI,CAAC,SACV,gBAAAA,KAAC,iBAA4B,MAAY,YAArB,KAAK,EAAoC,CAC9D;AAAA;AAAA,EACH,GACF;AAEJ;","names":["jsx"]}
|
|
1
|
+
{"version":3,"sources":["../../src/portfolio/components/PortfolioGrid.tsx","../../src/portfolio/components/PortfolioCard.tsx","../../src/portfolio/curate-proof.ts","../../src/portfolio/format.ts"],"sourcesContent":["// Shared component — no directive on purpose: hook-free, so it renders\n// server-side (zero JS) from PortfolioIndex and stays usable from client\n// code via the /portfolio/client barrel.\nimport React from 'react';\nimport type { PortfolioItem } from '../../types';\nimport ScrollReveal from '@sonordev/agency-site-kit/portfolio/primitives/ScrollReveal';\nimport PortfolioCard from './PortfolioCard';\n\ninterface PortfolioGridProps {\n items: PortfolioItem[];\n className?: string;\n /** Base path for portfolio detail links (default: '/work') */\n basePath?: string;\n}\n\nexport default function PortfolioGrid({ items, className = '', basePath = '/work' }: PortfolioGridProps) {\n return (\n <ScrollReveal stagger={0.1}>\n <div\n className={`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 ${className}`}\n style={{\n gap: 'var(--sk-grid-gap, 24px)',\n }}\n >\n {items.map((item) => (\n <PortfolioCard key={item.id} item={item} basePath={basePath} />\n ))}\n </div>\n </ScrollReveal>\n );\n}\n","// Shared component — no directive on purpose: hook-free, so it renders\n// server-side (zero JS) from PortfolioIndex and stays usable from client\n// code via the /portfolio/client barrel.\nimport React from 'react';\nimport Image from 'next/image';\nimport Link from 'next/link';\nimport type { PortfolioItem } from '../../types';\nimport GlassCard from '@sonordev/agency-site-kit/portfolio/primitives/GlassCard';\nimport { curateHeroKpis } from '../curate-proof';\nimport { formatCategoryLabel, formatServiceTag } from '../format';\n\ninterface PortfolioCardProps {\n item: PortfolioItem;\n className?: string;\n /** Base path for portfolio detail links (default: '/work') */\n basePath?: string;\n}\n\nexport default function PortfolioCard({ item, className = '', basePath = '/work' }: PortfolioCardProps) {\n // Use hero_screenshots desktop → hero_image → trifolio screenshot convention\n const thumbnailSrc =\n item.hero_screenshots?.desktop ||\n item.hero_image ||\n (item.project_id ? `/portfolio-previews/${item.slug}.png` : undefined);\n const kpis = Array.isArray(item.kpis) ? item.kpis : [];\n const services = Array.isArray(item.services) ? item.services : [];\n // Collapse per-category Lighthouse KPIs so a card never reads\n // \"100/100 · 100/100 · 100/100\" — business outcomes lead the preview.\n const kpiPreview = curateHeroKpis(kpis).slice(0, 3);\n const servicePreview = services.slice(0, 3);\n\n return (\n <Link href={`${basePath}/${item.slug}`} className={`block group ${className}`}>\n <GlassCard padding=\"sm\" hover>\n <div className=\"flex flex-col gap-4\">\n {/* Thumbnail */}\n {thumbnailSrc && (\n <div\n className=\"relative w-full overflow-hidden rounded-xl\"\n style={{ aspectRatio: '16/10' }}\n >\n <Image\n src={thumbnailSrc}\n alt={item.hero_image_alt || item.title}\n fill\n sizes=\"(max-width: 768px) 100vw, (max-width: 1024px) 50vw, 33vw\"\n className=\"object-cover object-top transition-transform duration-500 group-hover:scale-105\"\n />\n {/* Category badge */}\n <span\n className=\"absolute top-3 left-3 px-3 py-1 rounded-full text-[11px] uppercase tracking-wider font-semibold\"\n style={{\n background: 'color-mix(in srgb, var(--sk-primary, #6366f1) 80%, transparent)',\n color: '#ffffff',\n backdropFilter: 'blur(8px)',\n }}\n >\n {formatCategoryLabel(item.category)}\n </span>\n </div>\n )}\n\n {/* Text content */}\n <div className=\"flex flex-col gap-2 px-2 pb-2\">\n <h3\n className=\"text-lg font-semibold line-clamp-1\"\n style={{ color: 'var(--sk-text-primary, #ffffff)' }}\n >\n {item.title}\n </h3>\n\n {item.subtitle && (\n <p\n className=\"text-sm line-clamp-2\"\n style={{ color: 'var(--sk-text-tertiary, #71717a)' }}\n >\n {item.subtitle}\n </p>\n )}\n\n {/* KPI preview */}\n {kpiPreview.length > 0 && (\n <div className=\"flex items-center gap-4 mt-1\">\n {kpiPreview.map((kpi, i) => (\n <div key={i} className=\"flex flex-col\">\n <span\n className=\"text-base font-bold\"\n style={{ color: 'var(--sk-primary, #6366f1)' }}\n >\n {kpi.prefix || ''}\n {kpi.value.toLocaleString()}\n {kpi.suffix}\n </span>\n <span\n className=\"text-[10px] uppercase tracking-wider font-medium\"\n style={{ color: 'var(--sk-text-tertiary, #71717a)' }}\n >\n {kpi.label}\n </span>\n </div>\n ))}\n </div>\n )}\n\n {/* Services tags */}\n {servicePreview.length > 0 && (\n <div className=\"flex flex-wrap gap-1.5 mt-2\">\n {servicePreview.map((service) => (\n <span\n key={service}\n className=\"px-2.5 py-0.5 rounded-full text-[11px] font-medium\"\n style={{\n background: 'var(--sk-surface, rgba(255,255,255,0.05))',\n color: 'var(--sk-text-secondary, #a1a1aa)',\n border: '1px solid var(--sk-border, rgba(255,255,255,0.1))',\n }}\n >\n {formatServiceTag(service)}\n </span>\n ))}\n {services.length > 3 && (\n <span\n className=\"px-2.5 py-0.5 rounded-full text-[11px] font-medium\"\n style={{\n background: 'var(--sk-surface, rgba(255,255,255,0.05))',\n color: 'var(--sk-text-tertiary, #71717a)',\n }}\n >\n +{item.services.length - 3}\n </span>\n )}\n </div>\n )}\n </div>\n </div>\n </GlassCard>\n </Link>\n );\n}\n","/**\n * curate-proof — single source of truth for which proof points a public case\n * study is allowed to display, and in what shape.\n *\n * Two classes of problem this guards against (both shipped to production on\n * upforge.io before this existed):\n *\n * 1. Repetition: generated items arrive with four \"100/100 Lighthouse X\"\n * KPIs in the hero, the same four restated as Results cards, AND a full\n * Performance section with score gauges. One differentiator repeated\n * twelve times per page stops differentiating. The Performance section is\n * the one home for the Lighthouse breakdown; hero/results/cards collapse\n * to at most one summary tile.\n *\n * 2. Self-harming live metrics: MetricsDelta rows are computed from raw\n * analytics baselines with no editorial judgment — a bounce rate of\n * \"100 → 99.69\" rendered as a green win. Marketing surfaces only show a\n * delta when it's a genuinely flattering, meaningful story.\n *\n * Used by PortfolioPage (hero KPIs + results items), PortfolioCard (KPI\n * preview), and MetricsProvenance (delta gate). Change display policy here,\n * nowhere else.\n */\n\nimport type {\n MetricsDelta,\n PortfolioHeroData,\n PortfolioItemFull,\n PortfolioKPI,\n PortfolioResultItem,\n PortfolioResultsData,\n} from '../types';\n\nconst LIGHTHOUSE_RE = /lighthouse/i;\n\n/** True when a KPI tile is a per-category Lighthouse score. */\nexport function isLighthouseKpi(kpi: PortfolioKPI): boolean {\n return LIGHTHOUSE_RE.test(kpi.label);\n}\n\n/**\n * True when a Results card merely restates a Lighthouse category score\n * (e.g. \"Perfect performance score … measured Lighthouse score of 100/100\").\n * Business outcomes (\"Complete 14-page rebuild\", \"682% session growth\")\n * never match: the title must be about a score AND the card must reference\n * Lighthouse or carry a x/100 metric.\n */\nexport function isLighthouseRestatement(item: PortfolioResultItem): boolean {\n if (!/score/i.test(item.title)) return false;\n if (LIGHTHOUSE_RE.test(`${item.title} ${item.description}`)) return true;\n return item.metric?.suffix === '/100';\n}\n\n/**\n * Collapse per-category Lighthouse KPIs to at most one summary tile, business\n * outcomes first. When every category is present at 100 the summary says so;\n * otherwise the Performance category (the one buyers know) represents the set.\n */\nexport function curateHeroKpis(kpis: PortfolioKPI[]): PortfolioKPI[] {\n const business = kpis.filter((k) => !isLighthouseKpi(k));\n const lighthouse = kpis.filter(isLighthouseKpi);\n if (lighthouse.length <= 1) return kpis;\n\n const allPerfect = lighthouse.length >= 4 && lighthouse.every((k) => k.value === 100);\n const summary: PortfolioKPI = allPerfect\n ? {\n ...lighthouse[0],\n label: 'Lighthouse, all 4 categories',\n description: 'Perfect scores across performance, SEO, accessibility, and best practices.',\n }\n : (lighthouse.find((k) => /performance/i.test(k.label)) ?? lighthouse[0]);\n\n return [...business, summary];\n}\n\n/**\n * Drop Results cards that restate Lighthouse scores when the case study also\n * renders a Performance section (the score breakdown's single home).\n */\nexport function curateResultItems(\n items: PortfolioResultItem[],\n hasPerformanceSection: boolean,\n): PortfolioResultItem[] {\n if (!hasPerformanceSection) return items;\n const curated = items.filter((item) => !isLighthouseRestatement(item));\n // Never curate a Results section into emptiness — if every card was a\n // Lighthouse restatement, keep the strongest single card instead.\n return curated.length > 0 ? curated : items.slice(0, 1);\n}\n\n/**\n * Editorial gate for live metric deltas (\"Verified from live analytics\").\n * `direction` comes from the platform with 'up' meaning IMPROVED (lower-is-\n * better metrics are inverted server-side). A public case study only shows a\n * delta when it's a win worth telling:\n * - improved ('up'), never a regression or flat noise\n * - moved by a double-digit relative margin (small drift isn't a story)\n * - bounce-rate-style metrics must also be respectable in absolute terms —\n * \"100 → 99.69\" is technically an improvement and still self-harm\n */\nexport function gateMetricsDeltas(deltas: MetricsDelta[] | undefined | null): MetricsDelta[] {\n if (!deltas?.length) return [];\n return deltas.filter((d) => {\n if (d.direction !== 'up') return false;\n if (Math.abs(d.deltaPercent) < 10) return false;\n if (/bounce/i.test(d.metric) && d.current > 70) return false;\n return true;\n });\n}\n\n/**\n * Apply the full display policy to a portfolio item before rendering.\n * Pure — returns a new item; the fetched payload is never mutated.\n */\nexport function curatePortfolioProof(item: PortfolioItemFull): PortfolioItemFull {\n const hasPerformanceSection = item.sections.some(\n (s) => s.sectionType === 'portfolioPerformance',\n );\n\n return {\n ...item,\n sections: item.sections.map((section) => {\n if (section.sectionType === 'portfolioHero') {\n const data = section.data as PortfolioHeroData;\n return { ...section, data: { ...data, kpis: curateHeroKpis(data.kpis ?? []) } };\n }\n if (section.sectionType === 'portfolioResults') {\n const data = section.data as PortfolioResultsData;\n return {\n ...section,\n data: { ...data, items: curateResultItems(data.items ?? [], hasPerformanceSection) },\n };\n }\n return section;\n }),\n };\n}\n","/**\n * Presentation formatters shared by portfolio components and consuming apps.\n */\n\n/**\n * Human label for a category slug. Single source of truth — HeroSection,\n * PortfolioCard, and app-side filter chips all render categories through\n * this. Underscores become spaces; hyphens are PRESERVED so compound slugs\n * keep their canonical form (\"e-commerce\" → \"E-Commerce\", never \"E Commerce\"),\n * and every word start (including after a hyphen) is capitalized.\n */\nexport function formatCategoryLabel(slug: string | undefined | null): string {\n if (!slug) return '';\n return slug.replace(/_/g, ' ').replace(/\\b\\w/g, (c: string) => c.toUpperCase());\n}\n\n/**\n * Normalize a service tag's casing for display: the first character of each\n * word is uppercased, the rest left alone (so \"Next.js development\" becomes\n * \"Next.js Development\" and \"Technical SEO implementation\" keeps \"SEO\").\n * Fixes per-item casing drift in stored tags without touching the data.\n */\nexport function formatServiceTag(tag: string | undefined | null): string {\n if (!tag) return '';\n return tag.replace(/(^|[\\s/])([a-z])/g, (_m, sep: string, ch: string) => sep + ch.toUpperCase());\n}\n"],"mappings":";;;;;;;;;;;;;AAKA,OAAO,kBAAkB;;;ACDzB,OAAO,WAAW;AAClB,OAAO,UAAU;AAEjB,OAAO,eAAe;;;AC0BtB,IAAM,gBA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,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO,EAAE,OAAO,mCAAmC;AAAA,YAElD,cAAI;AAAA;AAAA,QACP;AAAA,WAdQ,CAeV,CACD,GACH;AAAA,MAID,eAAe,SAAS,KACvB,qBAAC,SAAI,WAAU,+BACZ;AAAA,uBAAe,IAAI,CAAC,YACnB;AAAA,UAAC;AAAA;AAAA,YAEC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,YAAY;AAAA,cACZ,OAAO;AAAA,cACP,QAAQ;AAAA,YACV;AAAA,YAEC,2BAAiB,OAAO;AAAA;AAAA,UARpB;AAAA,QASP,CACD;AAAA,QACA,SAAS,SAAS,KACjB;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,YAAY;AAAA,cACZ,OAAO;AAAA,YACT;AAAA,YACD;AAAA;AAAA,cACG,KAAK,SAAS,SAAS;AAAA;AAAA;AAAA,QAC3B;AAAA,SAEJ;AAAA,OAEJ;AAAA,KACF,GACF,GACF;AAEJ;;;ADjHU,gBAAAA,YAAA;AAVK,SAAR,cAA+B,EAAE,OAAO,YAAY,IAAI,WAAW,QAAQ,GAAuB;AACvG,SACE,gBAAAA,KAAC,gBAAa,SAAS,KACrB,0BAAAA;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,kDAAkD,SAAS;AAAA,MACtE,OAAO;AAAA,QACL,KAAK;AAAA,MACP;AAAA,MAEC,gBAAM,IAAI,CAAC,SACV,gBAAAA,KAAC,iBAA4B,MAAY,YAArB,KAAK,EAAoC,CAC9D;AAAA;AAAA,EACH,GACF;AAEJ;","names":["jsx"]}
|
|
@@ -44,7 +44,7 @@ function PortfolioErrorFallback({ error, reset }) {
|
|
|
44
44
|
children: "Our work is taking a moment to load"
|
|
45
45
|
}
|
|
46
46
|
),
|
|
47
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm", style: { color: "var(--sk-text-secondary, #a1a1aa)" }, children: "The portfolio couldn't be fetched just now. It's us, not you
|
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm", style: { color: "var(--sk-text-secondary, #a1a1aa)" }, children: "The portfolio couldn't be fetched just now. It's us, not you. Try again in a few seconds." }),
|
|
48
48
|
error?.digest && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "text-xs", style: { color: "var(--sk-text-tertiary, #71717a)" }, children: [
|
|
49
49
|
"Reference: ",
|
|
50
50
|
error.digest
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/portfolio/components/PortfolioErrorFallback.tsx"],"sourcesContent":["'use client';\n\n/**\n * Error boundary UI for portfolio routes — pairs with the PortfolioApiError\n * contract (infrastructure failures throw; Next renders the route's\n * error.tsx). Drop into `error.tsx`:\n *\n * ```tsx\n * 'use client';\n * export { PortfolioErrorFallback as default } from '@sonordev/agency-site-kit/portfolio/client';\n * ```\n */\n\nimport React from 'react';\n\nexport interface PortfolioErrorFallbackProps {\n error: Error & { digest?: string };\n reset: () => void;\n}\n\nexport default function PortfolioErrorFallback({ error, reset }: PortfolioErrorFallbackProps) {\n return (\n <section className=\"w-full py-24\">\n <div\n className=\"max-w-xl mx-auto px-8 py-12 rounded-2xl text-center flex flex-col items-center gap-4\"\n style={{\n background: 'var(--sk-surface, rgba(255,255,255,0.05))',\n border: '1px solid var(--sk-border, rgba(255,255,255,0.1))',\n }}\n >\n <h2\n className=\"text-xl font-semibold\"\n style={{ color: 'var(--sk-text-primary, #ffffff)' }}\n >\n Our work is taking a moment to load\n </h2>\n <p className=\"text-sm\" style={{ color: 'var(--sk-text-secondary, #a1a1aa)' }}>\n The portfolio couldn't be fetched just now. It's us, not you
|
|
1
|
+
{"version":3,"sources":["../../../src/portfolio/components/PortfolioErrorFallback.tsx"],"sourcesContent":["'use client';\n\n/**\n * Error boundary UI for portfolio routes — pairs with the PortfolioApiError\n * contract (infrastructure failures throw; Next renders the route's\n * error.tsx). Drop into `error.tsx`:\n *\n * ```tsx\n * 'use client';\n * export { PortfolioErrorFallback as default } from '@sonordev/agency-site-kit/portfolio/client';\n * ```\n */\n\nimport React from 'react';\n\nexport interface PortfolioErrorFallbackProps {\n error: Error & { digest?: string };\n reset: () => void;\n}\n\nexport default function PortfolioErrorFallback({ error, reset }: PortfolioErrorFallbackProps) {\n return (\n <section className=\"w-full py-24\">\n <div\n className=\"max-w-xl mx-auto px-8 py-12 rounded-2xl text-center flex flex-col items-center gap-4\"\n style={{\n background: 'var(--sk-surface, rgba(255,255,255,0.05))',\n border: '1px solid var(--sk-border, rgba(255,255,255,0.1))',\n }}\n >\n <h2\n className=\"text-xl font-semibold\"\n style={{ color: 'var(--sk-text-primary, #ffffff)' }}\n >\n Our work is taking a moment to load\n </h2>\n <p className=\"text-sm\" style={{ color: 'var(--sk-text-secondary, #a1a1aa)' }}>\n The portfolio couldn't be fetched just now. It's us, not you. Try again in a\n few seconds.\n </p>\n {error?.digest && (\n <p className=\"text-xs\" style={{ color: 'var(--sk-text-tertiary, #71717a)' }}>\n Reference: {error.digest}\n </p>\n )}\n <button\n onClick={reset}\n className=\"mt-2 px-6 py-2.5 rounded-xl text-sm font-semibold transition-opacity hover:opacity-90\"\n style={{ background: 'var(--sk-primary, #6366f1)', color: '#ffffff' }}\n >\n Try again\n </button>\n </div>\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BQ;AAVO,SAAR,uBAAwC,EAAE,OAAO,MAAM,GAAgC;AAC5F,SACE,4CAAC,aAAQ,WAAU,gBACjB;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO,EAAE,OAAO,kCAAkC;AAAA,YACnD;AAAA;AAAA,QAED;AAAA,QACA,4CAAC,OAAE,WAAU,WAAU,OAAO,EAAE,OAAO,oCAAoC,GAAG,uGAG9E;AAAA,QACC,OAAO,UACN,6CAAC,OAAE,WAAU,WAAU,OAAO,EAAE,OAAO,mCAAmC,GAAG;AAAA;AAAA,UAC/D,MAAM;AAAA,WACpB;AAAA,QAEF;AAAA,UAAC;AAAA;AAAA,YACC,SAAS;AAAA,YACT,WAAU;AAAA,YACV,OAAO,EAAE,YAAY,8BAA8B,OAAO,UAAU;AAAA,YACrE;AAAA;AAAA,QAED;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
|
package/dist/portfolio/index.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkQGSW43TM_cjs = require('../chunk-QGSW43TM.cjs');
|
|
4
|
+
var chunkZBPF7TLZ_cjs = require('../chunk-ZBPF7TLZ.cjs');
|
|
5
|
+
var chunkUXUU7FVT_cjs = require('../chunk-UXUU7FVT.cjs');
|
|
5
6
|
require('../chunk-7ZHRMWJU.cjs');
|
|
6
7
|
require('../chunk-FCKDJ4MJ.cjs');
|
|
7
8
|
require('../chunk-HQGAX2LI.cjs');
|
|
@@ -11,31 +12,55 @@ require('../chunk-XOWSXZYW.cjs');
|
|
|
11
12
|
|
|
12
13
|
Object.defineProperty(exports, "PORTFOLIO_SECTION_TYPES", {
|
|
13
14
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkQGSW43TM_cjs.PORTFOLIO_SECTION_TYPES; }
|
|
15
16
|
});
|
|
16
17
|
Object.defineProperty(exports, "PortfolioIndex", {
|
|
17
18
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkQGSW43TM_cjs.PortfolioIndex; }
|
|
19
20
|
});
|
|
20
21
|
Object.defineProperty(exports, "PortfolioIndexSkeleton", {
|
|
21
22
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkQGSW43TM_cjs.PortfolioIndexSkeleton; }
|
|
23
24
|
});
|
|
24
25
|
Object.defineProperty(exports, "PortfolioPage", {
|
|
25
26
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkQGSW43TM_cjs.PortfolioPage; }
|
|
27
28
|
});
|
|
28
29
|
Object.defineProperty(exports, "PortfolioPageSkeleton", {
|
|
29
30
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkQGSW43TM_cjs.PortfolioPageSkeleton; }
|
|
31
32
|
});
|
|
32
33
|
Object.defineProperty(exports, "PortfolioSchema", {
|
|
33
34
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkQGSW43TM_cjs.PortfolioSchema; }
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "formatCategoryLabel", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return chunkZBPF7TLZ_cjs.formatCategoryLabel; }
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports, "formatServiceTag", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () { return chunkZBPF7TLZ_cjs.formatServiceTag; }
|
|
35
44
|
});
|
|
36
45
|
Object.defineProperty(exports, "MetricsProvenance", {
|
|
37
46
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkUXUU7FVT_cjs.MetricsProvenance; }
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "curateHeroKpis", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () { return chunkUXUU7FVT_cjs.curateHeroKpis; }
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(exports, "curatePortfolioProof", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () { return chunkUXUU7FVT_cjs.curatePortfolioProof; }
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(exports, "curateResultItems", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function () { return chunkUXUU7FVT_cjs.curateResultItems; }
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, "gateMetricsDeltas", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () { return chunkUXUU7FVT_cjs.gateMetricsDeltas; }
|
|
39
64
|
});
|
|
40
65
|
//# sourceMappingURL=index.cjs.map
|
|
41
66
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { P as PortfolioItemFull, M as MetricsDelta } from '../types-0tVPy4pU.cjs';
|
|
3
|
-
export { j as MetricSource, k as MetricsSnapshot, l as PORTFOLIO_SECTION_TYPES, n as PortfolioBeforeAfterData, o as PortfolioCTAData, c as PortfolioChallengesData, r as PortfolioConversionFunnelData, d as PortfolioDetailsData, s as PortfolioFeatureSpotlightData, u as PortfolioGalleryData, e as PortfolioHeroData, w as PortfolioItem,
|
|
2
|
+
import { P as PortfolioItemFull, M as MetricsDelta, x as PortfolioKPI, A as PortfolioResultItem } from '../types-0tVPy4pU.cjs';
|
|
3
|
+
export { j as MetricSource, k as MetricsSnapshot, l as PORTFOLIO_SECTION_TYPES, n as PortfolioBeforeAfterData, o as PortfolioCTAData, c as PortfolioChallengesData, r as PortfolioConversionFunnelData, d as PortfolioDetailsData, s as PortfolioFeatureSpotlightData, u as PortfolioGalleryData, e as PortfolioHeroData, w as PortfolioItem, b as PortfolioListResponse, z as PortfolioMetricsTimelineData, f as PortfolioResultsData, a as PortfolioSection, C as PortfolioSectionData, D as PortfolioSectionDataMap, E as PortfolioSectionType, F as PortfolioSeoData, g as PortfolioServicesData, H as PortfolioStrategyData, J as PortfolioTeamData, h as PortfolioTechStackData, i as PortfolioTestimonialData, N as PortfolioVideoData } from '../types-0tVPy4pU.cjs';
|
|
4
4
|
export * from '@sonordev/agency-site-kit/portfolio/client';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -29,7 +29,7 @@ export * from '@sonordev/agency-site-kit/portfolio/client';
|
|
|
29
29
|
interface PortfolioPageProps {
|
|
30
30
|
item: PortfolioItemFull;
|
|
31
31
|
}
|
|
32
|
-
declare function PortfolioPage({ item }: PortfolioPageProps): React.JSX.Element;
|
|
32
|
+
declare function PortfolioPage({ item: rawItem }: PortfolioPageProps): React.JSX.Element;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* PortfolioSchema — JSON-LD structured data for a case study page.
|
|
@@ -109,7 +109,13 @@ declare function PortfolioIndex({ basePath, category, page, pageSize, heading, e
|
|
|
109
109
|
*
|
|
110
110
|
* `direction` semantics come from the API: 'up' ALWAYS means "improved"
|
|
111
111
|
* (lower-is-better metrics like Avg Position/LCP are inverted server-side
|
|
112
|
-
* in metrics-baseline.service), so up renders
|
|
112
|
+
* in metrics-baseline.service), so 'up' renders green. The ARROW glyph
|
|
113
|
+
* follows the raw numbers instead — an improved bounce rate shows a green ▼,
|
|
114
|
+
* never a green ▲ next to a value that visibly went down.
|
|
115
|
+
*
|
|
116
|
+
* Deltas pass through gateMetricsDeltas (curate-proof.ts) before display:
|
|
117
|
+
* raw platform deltas carry no editorial judgment, and this strip only
|
|
118
|
+
* exists to flatter — see that module for the policy.
|
|
113
119
|
*/
|
|
114
120
|
|
|
115
121
|
interface MetricsProvenanceProps {
|
|
@@ -119,6 +125,77 @@ interface MetricsProvenanceProps {
|
|
|
119
125
|
}
|
|
120
126
|
declare function MetricsProvenance({ deltas, refreshedAt }: MetricsProvenanceProps): React.JSX.Element | null;
|
|
121
127
|
|
|
128
|
+
/**
|
|
129
|
+
* curate-proof — single source of truth for which proof points a public case
|
|
130
|
+
* study is allowed to display, and in what shape.
|
|
131
|
+
*
|
|
132
|
+
* Two classes of problem this guards against (both shipped to production on
|
|
133
|
+
* upforge.io before this existed):
|
|
134
|
+
*
|
|
135
|
+
* 1. Repetition: generated items arrive with four "100/100 Lighthouse X"
|
|
136
|
+
* KPIs in the hero, the same four restated as Results cards, AND a full
|
|
137
|
+
* Performance section with score gauges. One differentiator repeated
|
|
138
|
+
* twelve times per page stops differentiating. The Performance section is
|
|
139
|
+
* the one home for the Lighthouse breakdown; hero/results/cards collapse
|
|
140
|
+
* to at most one summary tile.
|
|
141
|
+
*
|
|
142
|
+
* 2. Self-harming live metrics: MetricsDelta rows are computed from raw
|
|
143
|
+
* analytics baselines with no editorial judgment — a bounce rate of
|
|
144
|
+
* "100 → 99.69" rendered as a green win. Marketing surfaces only show a
|
|
145
|
+
* delta when it's a genuinely flattering, meaningful story.
|
|
146
|
+
*
|
|
147
|
+
* Used by PortfolioPage (hero KPIs + results items), PortfolioCard (KPI
|
|
148
|
+
* preview), and MetricsProvenance (delta gate). Change display policy here,
|
|
149
|
+
* nowhere else.
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Collapse per-category Lighthouse KPIs to at most one summary tile, business
|
|
154
|
+
* outcomes first. When every category is present at 100 the summary says so;
|
|
155
|
+
* otherwise the Performance category (the one buyers know) represents the set.
|
|
156
|
+
*/
|
|
157
|
+
declare function curateHeroKpis(kpis: PortfolioKPI[]): PortfolioKPI[];
|
|
158
|
+
/**
|
|
159
|
+
* Drop Results cards that restate Lighthouse scores when the case study also
|
|
160
|
+
* renders a Performance section (the score breakdown's single home).
|
|
161
|
+
*/
|
|
162
|
+
declare function curateResultItems(items: PortfolioResultItem[], hasPerformanceSection: boolean): PortfolioResultItem[];
|
|
163
|
+
/**
|
|
164
|
+
* Editorial gate for live metric deltas ("Verified from live analytics").
|
|
165
|
+
* `direction` comes from the platform with 'up' meaning IMPROVED (lower-is-
|
|
166
|
+
* better metrics are inverted server-side). A public case study only shows a
|
|
167
|
+
* delta when it's a win worth telling:
|
|
168
|
+
* - improved ('up'), never a regression or flat noise
|
|
169
|
+
* - moved by a double-digit relative margin (small drift isn't a story)
|
|
170
|
+
* - bounce-rate-style metrics must also be respectable in absolute terms —
|
|
171
|
+
* "100 → 99.69" is technically an improvement and still self-harm
|
|
172
|
+
*/
|
|
173
|
+
declare function gateMetricsDeltas(deltas: MetricsDelta[] | undefined | null): MetricsDelta[];
|
|
174
|
+
/**
|
|
175
|
+
* Apply the full display policy to a portfolio item before rendering.
|
|
176
|
+
* Pure — returns a new item; the fetched payload is never mutated.
|
|
177
|
+
*/
|
|
178
|
+
declare function curatePortfolioProof(item: PortfolioItemFull): PortfolioItemFull;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Presentation formatters shared by portfolio components and consuming apps.
|
|
182
|
+
*/
|
|
183
|
+
/**
|
|
184
|
+
* Human label for a category slug. Single source of truth — HeroSection,
|
|
185
|
+
* PortfolioCard, and app-side filter chips all render categories through
|
|
186
|
+
* this. Underscores become spaces; hyphens are PRESERVED so compound slugs
|
|
187
|
+
* keep their canonical form ("e-commerce" → "E-Commerce", never "E Commerce"),
|
|
188
|
+
* and every word start (including after a hyphen) is capitalized.
|
|
189
|
+
*/
|
|
190
|
+
declare function formatCategoryLabel(slug: string | undefined | null): string;
|
|
191
|
+
/**
|
|
192
|
+
* Normalize a service tag's casing for display: the first character of each
|
|
193
|
+
* word is uppercased, the rest left alone (so "Next.js development" becomes
|
|
194
|
+
* "Next.js Development" and "Technical SEO implementation" keeps "SEO").
|
|
195
|
+
* Fixes per-item casing drift in stored tags without touching the data.
|
|
196
|
+
*/
|
|
197
|
+
declare function formatServiceTag(tag: string | undefined | null): string;
|
|
198
|
+
|
|
122
199
|
/**
|
|
123
200
|
* Loading skeletons for portfolio routes — pure CSS pulse, server-safe,
|
|
124
201
|
* zero JS. Drop into `loading.tsx`:
|
|
@@ -135,4 +212,4 @@ declare function PortfolioIndexSkeleton({ cards }: {
|
|
|
135
212
|
/** Hero-shaped placeholder for /work/[slug] case study pages. */
|
|
136
213
|
declare function PortfolioPageSkeleton(): React.JSX.Element;
|
|
137
214
|
|
|
138
|
-
export { MetricsDelta, MetricsProvenance, PortfolioIndex, type PortfolioIndexProps, PortfolioIndexSkeleton, PortfolioItemFull, PortfolioPage, PortfolioPageSkeleton, PortfolioSchema };
|
|
215
|
+
export { MetricsDelta, MetricsProvenance, PortfolioIndex, type PortfolioIndexProps, PortfolioIndexSkeleton, PortfolioItemFull, PortfolioKPI, PortfolioPage, PortfolioPageSkeleton, PortfolioSchema, curateHeroKpis, curatePortfolioProof, curateResultItems, formatCategoryLabel, formatServiceTag, gateMetricsDeltas };
|