@sonordev/agency-site-kit 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (365) hide show
  1. package/README.md +302 -0
  2. package/bin/setup.mjs +79 -0
  3. package/dist/{chunk-RXBK2EOE.js → chunk-4IES23GV.js} +3 -3
  4. package/dist/{chunk-RXBK2EOE.js.map → chunk-4IES23GV.js.map} +1 -1
  5. package/dist/chunk-4N7ENJ7L.cjs +108 -0
  6. package/dist/chunk-4N7ENJ7L.cjs.map +1 -0
  7. package/dist/{chunk-WNR4KNG4.cjs → chunk-5MEZU3OG.cjs} +4 -4
  8. package/dist/{chunk-WNR4KNG4.cjs.map → chunk-5MEZU3OG.cjs.map} +1 -1
  9. package/dist/chunk-7ZHRMWJU.cjs +306 -0
  10. package/dist/chunk-7ZHRMWJU.cjs.map +1 -0
  11. package/dist/chunk-CVT7I5BQ.js +71 -0
  12. package/dist/chunk-CVT7I5BQ.js.map +1 -0
  13. package/dist/chunk-HQGAX2LI.cjs +8 -0
  14. package/dist/chunk-HQGAX2LI.cjs.map +1 -0
  15. package/dist/chunk-KXLROAO5.js +291 -0
  16. package/dist/chunk-KXLROAO5.js.map +1 -0
  17. package/dist/chunk-L4EOQVRJ.js +6 -0
  18. package/dist/chunk-L4EOQVRJ.js.map +1 -0
  19. package/dist/chunk-L7E3UHQC.cjs +535 -0
  20. package/dist/chunk-L7E3UHQC.cjs.map +1 -0
  21. package/dist/chunk-NI4FVCLS.cjs +32 -0
  22. package/dist/chunk-NI4FVCLS.cjs.map +1 -0
  23. package/dist/chunk-NIZJLONK.js +106 -0
  24. package/dist/chunk-NIZJLONK.js.map +1 -0
  25. package/dist/chunk-QDXZ27R7.js +33 -0
  26. package/dist/chunk-QDXZ27R7.js.map +1 -0
  27. package/dist/{chunk-TVFXN6W6.js → chunk-QL6KVIFR.js} +8 -4
  28. package/dist/chunk-QL6KVIFR.js.map +1 -0
  29. package/dist/chunk-UNTOEWQL.js +504 -0
  30. package/dist/chunk-UNTOEWQL.js.map +1 -0
  31. package/dist/chunk-XJ434N7I.js +30 -0
  32. package/dist/chunk-XJ434N7I.js.map +1 -0
  33. package/dist/chunk-XLK77USA.js +45 -0
  34. package/dist/chunk-XLK77USA.js.map +1 -0
  35. package/dist/{chunk-EE75WRCM.cjs → chunk-XOWSXZYW.cjs} +8 -4
  36. package/dist/chunk-XOWSXZYW.cjs.map +1 -0
  37. package/dist/chunk-ZINKVJQU.js +67 -0
  38. package/dist/chunk-ZINKVJQU.js.map +1 -0
  39. package/dist/index.cjs +29 -30
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.d.cts +17 -9
  42. package/dist/index.d.ts +17 -9
  43. package/dist/index.js +7 -8
  44. package/dist/index.js.map +1 -1
  45. package/dist/layout/index.cjs +3 -3
  46. package/dist/layout/index.d.cts +1 -1
  47. package/dist/layout/index.d.ts +1 -1
  48. package/dist/layout/index.js +2 -2
  49. package/dist/portfolio/client.cjs +342 -12
  50. package/dist/portfolio/client.cjs.map +1 -1
  51. package/dist/portfolio/client.d.cts +11 -88
  52. package/dist/portfolio/client.d.ts +11 -88
  53. package/dist/portfolio/client.js +150 -4
  54. package/dist/portfolio/client.js.map +1 -1
  55. package/dist/portfolio/components/PortfolioAnalytics.cjs +87 -0
  56. package/dist/portfolio/components/PortfolioAnalytics.cjs.map +1 -0
  57. package/dist/portfolio/components/PortfolioAnalytics.d.cts +5 -0
  58. package/dist/portfolio/components/PortfolioAnalytics.d.ts +5 -0
  59. package/dist/portfolio/components/PortfolioAnalytics.js +9 -0
  60. package/dist/portfolio/components/PortfolioAnalytics.js.map +1 -0
  61. package/dist/portfolio/components/PortfolioErrorFallback.cjs +65 -0
  62. package/dist/portfolio/components/PortfolioErrorFallback.cjs.map +1 -0
  63. package/dist/portfolio/components/PortfolioErrorFallback.d.cts +22 -0
  64. package/dist/portfolio/components/PortfolioErrorFallback.d.ts +22 -0
  65. package/dist/portfolio/components/PortfolioErrorFallback.js +9 -0
  66. package/dist/portfolio/components/PortfolioErrorFallback.js.map +1 -0
  67. package/dist/portfolio/components/PortfolioLeadCTA.cjs +91 -0
  68. package/dist/portfolio/components/PortfolioLeadCTA.cjs.map +1 -0
  69. package/dist/portfolio/components/PortfolioLeadCTA.d.cts +34 -0
  70. package/dist/portfolio/components/PortfolioLeadCTA.d.ts +34 -0
  71. package/dist/portfolio/components/PortfolioLeadCTA.js +9 -0
  72. package/dist/portfolio/components/PortfolioLeadCTA.js.map +1 -0
  73. package/dist/portfolio/index.cjs +19 -19
  74. package/dist/portfolio/index.d.cts +133 -7
  75. package/dist/portfolio/index.d.ts +133 -7
  76. package/dist/portfolio/index.js +6 -6
  77. package/dist/portfolio/primitives/AnimatedCounter.cjs +88 -0
  78. package/dist/portfolio/primitives/AnimatedCounter.cjs.map +1 -0
  79. package/dist/portfolio/primitives/AnimatedCounter.d.cts +22 -0
  80. package/dist/portfolio/primitives/AnimatedCounter.d.ts +22 -0
  81. package/dist/portfolio/primitives/AnimatedCounter.js +68 -0
  82. package/dist/portfolio/primitives/AnimatedCounter.js.map +1 -0
  83. package/dist/portfolio/primitives/AnnotatedImage.cjs +320 -0
  84. package/dist/portfolio/primitives/AnnotatedImage.cjs.map +1 -0
  85. package/dist/portfolio/primitives/AnnotatedImage.d.cts +18 -0
  86. package/dist/portfolio/primitives/AnnotatedImage.d.ts +18 -0
  87. package/dist/portfolio/primitives/AnnotatedImage.js +264 -0
  88. package/dist/portfolio/primitives/AnnotatedImage.js.map +1 -0
  89. package/dist/portfolio/primitives/BeforeAfterSlider.cjs +348 -0
  90. package/dist/portfolio/primitives/BeforeAfterSlider.cjs.map +1 -0
  91. package/dist/portfolio/primitives/BeforeAfterSlider.d.cts +13 -0
  92. package/dist/portfolio/primitives/BeforeAfterSlider.d.ts +13 -0
  93. package/dist/portfolio/primitives/BeforeAfterSlider.js +292 -0
  94. package/dist/portfolio/primitives/BeforeAfterSlider.js.map +1 -0
  95. package/dist/portfolio/primitives/DeviceTrifolio.cjs +298 -0
  96. package/dist/portfolio/primitives/DeviceTrifolio.cjs.map +1 -0
  97. package/dist/portfolio/primitives/DeviceTrifolio.d.cts +14 -0
  98. package/dist/portfolio/primitives/DeviceTrifolio.d.ts +14 -0
  99. package/dist/portfolio/primitives/DeviceTrifolio.js +242 -0
  100. package/dist/portfolio/primitives/DeviceTrifolio.js.map +1 -0
  101. package/dist/portfolio/primitives/FrequencyBarSkeleton.cjs +88 -0
  102. package/dist/portfolio/primitives/FrequencyBarSkeleton.cjs.map +1 -0
  103. package/dist/portfolio/primitives/FrequencyBarSkeleton.d.cts +10 -0
  104. package/dist/portfolio/primitives/FrequencyBarSkeleton.d.ts +10 -0
  105. package/dist/portfolio/primitives/FrequencyBarSkeleton.js +68 -0
  106. package/dist/portfolio/primitives/FrequencyBarSkeleton.js.map +1 -0
  107. package/dist/portfolio/primitives/GlassCard.cjs +45 -0
  108. package/dist/portfolio/primitives/GlassCard.cjs.map +1 -0
  109. package/dist/portfolio/primitives/GlassCard.d.cts +11 -0
  110. package/dist/portfolio/primitives/GlassCard.d.ts +11 -0
  111. package/dist/portfolio/primitives/GlassCard.js +43 -0
  112. package/dist/portfolio/primitives/GlassCard.js.map +1 -0
  113. package/dist/portfolio/primitives/MetricBadge.cjs +74 -0
  114. package/dist/portfolio/primitives/MetricBadge.cjs.map +1 -0
  115. package/dist/portfolio/primitives/MetricBadge.d.cts +9 -0
  116. package/dist/portfolio/primitives/MetricBadge.d.ts +9 -0
  117. package/dist/portfolio/primitives/MetricBadge.js +54 -0
  118. package/dist/portfolio/primitives/MetricBadge.js.map +1 -0
  119. package/dist/portfolio/primitives/SVGChart.cjs +316 -0
  120. package/dist/portfolio/primitives/SVGChart.cjs.map +1 -0
  121. package/dist/portfolio/primitives/SVGChart.d.cts +18 -0
  122. package/dist/portfolio/primitives/SVGChart.d.ts +18 -0
  123. package/dist/portfolio/primitives/SVGChart.js +296 -0
  124. package/dist/portfolio/primitives/SVGChart.js.map +1 -0
  125. package/dist/portfolio/primitives/ScrollReveal.cjs +97 -0
  126. package/dist/portfolio/primitives/ScrollReveal.cjs.map +1 -0
  127. package/dist/portfolio/primitives/ScrollReveal.d.cts +27 -0
  128. package/dist/portfolio/primitives/ScrollReveal.d.ts +27 -0
  129. package/dist/portfolio/primitives/ScrollReveal.js +77 -0
  130. package/dist/portfolio/primitives/ScrollReveal.js.map +1 -0
  131. package/dist/portfolio/primitives/SplitHeadline.cjs +107 -0
  132. package/dist/portfolio/primitives/SplitHeadline.cjs.map +1 -0
  133. package/dist/portfolio/primitives/SplitHeadline.d.cts +24 -0
  134. package/dist/portfolio/primitives/SplitHeadline.d.ts +24 -0
  135. package/dist/portfolio/primitives/SplitHeadline.js +87 -0
  136. package/dist/portfolio/primitives/SplitHeadline.js.map +1 -0
  137. package/dist/portfolio/sections/BeforeAfterSection.cjs +271 -0
  138. package/dist/portfolio/sections/BeforeAfterSection.cjs.map +1 -0
  139. package/dist/portfolio/sections/BeforeAfterSection.d.cts +9 -0
  140. package/dist/portfolio/sections/BeforeAfterSection.d.ts +9 -0
  141. package/dist/{BeforeAfterSection-6BHFLY4Y.js → portfolio/sections/BeforeAfterSection.js} +66 -27
  142. package/dist/portfolio/sections/BeforeAfterSection.js.map +1 -0
  143. package/dist/portfolio/sections/CTASection.cjs +123 -0
  144. package/dist/portfolio/sections/CTASection.cjs.map +1 -0
  145. package/dist/portfolio/sections/CTASection.d.cts +9 -0
  146. package/dist/portfolio/sections/CTASection.d.ts +9 -0
  147. package/dist/portfolio/sections/CTASection.js +93 -0
  148. package/dist/portfolio/sections/CTASection.js.map +1 -0
  149. package/dist/{ChallengesSection-IZ3DHECS.cjs → portfolio/sections/ChallengesSection.cjs} +12 -6
  150. package/dist/portfolio/sections/ChallengesSection.cjs.map +1 -0
  151. package/dist/portfolio/sections/ChallengesSection.d.cts +9 -0
  152. package/dist/portfolio/sections/ChallengesSection.d.ts +9 -0
  153. package/dist/{ChallengesSection-GEQGVSJN.js → portfolio/sections/ChallengesSection.js} +5 -4
  154. package/dist/portfolio/sections/ChallengesSection.js.map +1 -0
  155. package/dist/portfolio/sections/ConversionFunnelSection.cjs +263 -0
  156. package/dist/portfolio/sections/ConversionFunnelSection.cjs.map +1 -0
  157. package/dist/portfolio/sections/ConversionFunnelSection.d.cts +9 -0
  158. package/dist/portfolio/sections/ConversionFunnelSection.d.ts +9 -0
  159. package/dist/{ConversionFunnelSection-D3GE4NKE.js → portfolio/sections/ConversionFunnelSection.js} +60 -56
  160. package/dist/portfolio/sections/ConversionFunnelSection.js.map +1 -0
  161. package/dist/{DesignSystemSection-KXIQXITF.cjs → portfolio/sections/DesignSystemSection.cjs} +13 -7
  162. package/dist/portfolio/sections/DesignSystemSection.cjs.map +1 -0
  163. package/dist/portfolio/sections/DesignSystemSection.d.cts +32 -0
  164. package/dist/portfolio/sections/DesignSystemSection.d.ts +32 -0
  165. package/dist/{DesignSystemSection-2R5BRBGO.js → portfolio/sections/DesignSystemSection.js} +5 -4
  166. package/dist/portfolio/sections/DesignSystemSection.js.map +1 -0
  167. package/dist/{DetailsSection-TTUZAPZZ.cjs → portfolio/sections/DetailsSection.cjs} +12 -6
  168. package/dist/portfolio/sections/DetailsSection.cjs.map +1 -0
  169. package/dist/portfolio/sections/DetailsSection.d.cts +9 -0
  170. package/dist/portfolio/sections/DetailsSection.d.ts +9 -0
  171. package/dist/{DetailsSection-A6PZQUQL.js → portfolio/sections/DetailsSection.js} +5 -4
  172. package/dist/portfolio/sections/DetailsSection.js.map +1 -0
  173. package/dist/portfolio/sections/FeatureSpotlightSection.cjs +267 -0
  174. package/dist/portfolio/sections/FeatureSpotlightSection.cjs.map +1 -0
  175. package/dist/portfolio/sections/FeatureSpotlightSection.d.cts +9 -0
  176. package/dist/portfolio/sections/FeatureSpotlightSection.d.ts +9 -0
  177. package/dist/{FeatureSpotlightSection-B7P3JGNL.js → portfolio/sections/FeatureSpotlightSection.js} +39 -33
  178. package/dist/portfolio/sections/FeatureSpotlightSection.js.map +1 -0
  179. package/dist/portfolio/sections/GallerySection.cjs +321 -0
  180. package/dist/portfolio/sections/GallerySection.cjs.map +1 -0
  181. package/dist/portfolio/sections/GallerySection.d.cts +9 -0
  182. package/dist/portfolio/sections/GallerySection.d.ts +9 -0
  183. package/dist/{GallerySection-VMKORC47.js → portfolio/sections/GallerySection.js} +65 -18
  184. package/dist/portfolio/sections/GallerySection.js.map +1 -0
  185. package/dist/portfolio/sections/HeroSection.cjs +180 -0
  186. package/dist/portfolio/sections/HeroSection.cjs.map +1 -0
  187. package/dist/portfolio/sections/HeroSection.d.cts +15 -0
  188. package/dist/portfolio/sections/HeroSection.d.ts +15 -0
  189. package/dist/portfolio/sections/HeroSection.js +171 -0
  190. package/dist/portfolio/sections/HeroSection.js.map +1 -0
  191. package/dist/{MetricsTimelineSection-4L6DUHJ5.cjs → portfolio/sections/MetricsTimelineSection.cjs} +102 -61
  192. package/dist/portfolio/sections/MetricsTimelineSection.cjs.map +1 -0
  193. package/dist/portfolio/sections/MetricsTimelineSection.d.cts +9 -0
  194. package/dist/portfolio/sections/MetricsTimelineSection.d.ts +9 -0
  195. package/dist/{MetricsTimelineSection-6BT5GNFV.js → portfolio/sections/MetricsTimelineSection.js} +45 -29
  196. package/dist/portfolio/sections/MetricsTimelineSection.js.map +1 -0
  197. package/dist/{PerformanceSection-24TVVFZA.cjs → portfolio/sections/PerformanceSection.cjs} +136 -93
  198. package/dist/portfolio/sections/PerformanceSection.cjs.map +1 -0
  199. package/dist/portfolio/sections/PerformanceSection.d.cts +22 -0
  200. package/dist/portfolio/sections/PerformanceSection.d.ts +22 -0
  201. package/dist/{PerformanceSection-MGCEIXDX.js → portfolio/sections/PerformanceSection.js} +58 -40
  202. package/dist/portfolio/sections/PerformanceSection.js.map +1 -0
  203. package/dist/{ResultsSection-XLGMMQKY.cjs → portfolio/sections/ResultsSection.cjs} +22 -10
  204. package/dist/portfolio/sections/ResultsSection.cjs.map +1 -0
  205. package/dist/portfolio/sections/ResultsSection.d.cts +13 -0
  206. package/dist/portfolio/sections/ResultsSection.d.ts +13 -0
  207. package/dist/{ResultsSection-DFUJ5U6M.js → portfolio/sections/ResultsSection.js} +13 -7
  208. package/dist/portfolio/sections/ResultsSection.js.map +1 -0
  209. package/dist/portfolio/sections/ServicesSection.cjs +129 -0
  210. package/dist/portfolio/sections/ServicesSection.cjs.map +1 -0
  211. package/dist/portfolio/sections/ServicesSection.d.cts +9 -0
  212. package/dist/portfolio/sections/ServicesSection.d.ts +9 -0
  213. package/dist/portfolio/sections/ServicesSection.js +122 -0
  214. package/dist/portfolio/sections/ServicesSection.js.map +1 -0
  215. package/dist/{SiteArchitectureSection-J7BPBERH.cjs → portfolio/sections/SiteArchitectureSection.cjs} +116 -92
  216. package/dist/portfolio/sections/SiteArchitectureSection.cjs.map +1 -0
  217. package/dist/portfolio/sections/SiteArchitectureSection.d.cts +21 -0
  218. package/dist/portfolio/sections/SiteArchitectureSection.d.ts +21 -0
  219. package/dist/{SiteArchitectureSection-TE22OAWV.js → portfolio/sections/SiteArchitectureSection.js} +46 -47
  220. package/dist/portfolio/sections/SiteArchitectureSection.js.map +1 -0
  221. package/dist/{SpeedComparisonSection-EZKFQVGW.cjs → portfolio/sections/SpeedComparisonSection.cjs} +12 -6
  222. package/dist/portfolio/sections/SpeedComparisonSection.cjs.map +1 -0
  223. package/dist/portfolio/sections/SpeedComparisonSection.d.cts +20 -0
  224. package/dist/portfolio/sections/SpeedComparisonSection.d.ts +20 -0
  225. package/dist/{SpeedComparisonSection-Y3K7OFZQ.js → portfolio/sections/SpeedComparisonSection.js} +5 -4
  226. package/dist/portfolio/sections/SpeedComparisonSection.js.map +1 -0
  227. package/dist/portfolio/sections/StrategySection.cjs +233 -0
  228. package/dist/portfolio/sections/StrategySection.cjs.map +1 -0
  229. package/dist/portfolio/sections/StrategySection.d.cts +9 -0
  230. package/dist/portfolio/sections/StrategySection.d.ts +9 -0
  231. package/dist/{StrategySection-DI5RSCJU.js → portfolio/sections/StrategySection.js} +60 -26
  232. package/dist/portfolio/sections/StrategySection.js.map +1 -0
  233. package/dist/portfolio/sections/TeamSection.cjs +162 -0
  234. package/dist/portfolio/sections/TeamSection.cjs.map +1 -0
  235. package/dist/portfolio/sections/TeamSection.d.cts +9 -0
  236. package/dist/portfolio/sections/TeamSection.d.ts +9 -0
  237. package/dist/portfolio/sections/TeamSection.js +106 -0
  238. package/dist/portfolio/sections/TeamSection.js.map +1 -0
  239. package/dist/portfolio/sections/TechStackSection.cjs +106 -0
  240. package/dist/portfolio/sections/TechStackSection.cjs.map +1 -0
  241. package/dist/portfolio/sections/TechStackSection.d.cts +9 -0
  242. package/dist/portfolio/sections/TechStackSection.d.ts +9 -0
  243. package/dist/portfolio/sections/TechStackSection.js +99 -0
  244. package/dist/portfolio/sections/TechStackSection.js.map +1 -0
  245. package/dist/{TestimonialSection-XPTFUQIN.cjs → portfolio/sections/TestimonialSection.cjs} +47 -28
  246. package/dist/portfolio/sections/TestimonialSection.cjs.map +1 -0
  247. package/dist/portfolio/sections/TestimonialSection.d.cts +9 -0
  248. package/dist/portfolio/sections/TestimonialSection.d.ts +9 -0
  249. package/dist/{TestimonialSection-6RGSMXQB.js → portfolio/sections/TestimonialSection.js} +40 -27
  250. package/dist/portfolio/sections/TestimonialSection.js.map +1 -0
  251. package/dist/portfolio/sections/VideoSection.cjs +181 -0
  252. package/dist/portfolio/sections/VideoSection.cjs.map +1 -0
  253. package/dist/portfolio/sections/VideoSection.d.cts +9 -0
  254. package/dist/portfolio/sections/VideoSection.d.ts +9 -0
  255. package/dist/{VideoSection-4A2HC6K6.js → portfolio/sections/VideoSection.js} +21 -13
  256. package/dist/portfolio/sections/VideoSection.js.map +1 -0
  257. package/dist/portfolio/server.cjs +56 -139
  258. package/dist/portfolio/server.cjs.map +1 -1
  259. package/dist/portfolio/server.d.cts +157 -7
  260. package/dist/portfolio/server.d.ts +157 -7
  261. package/dist/portfolio/server.js +3 -137
  262. package/dist/portfolio/server.js.map +1 -1
  263. package/dist/preview.cjs +56 -0
  264. package/dist/preview.cjs.map +1 -0
  265. package/dist/preview.d.cts +31 -0
  266. package/dist/preview.d.ts +31 -0
  267. package/dist/preview.js +54 -0
  268. package/dist/preview.js.map +1 -0
  269. package/dist/{types-DL4t_Cfa.d.ts → types-0tVPy4pU.d.cts} +7 -1
  270. package/dist/{types-DL4t_Cfa.d.cts → types-0tVPy4pU.d.ts} +7 -1
  271. package/dist/types-D0nb6KAx.d.cts +299 -0
  272. package/dist/types-D0nb6KAx.d.ts +299 -0
  273. package/package.json +38 -14
  274. package/templates/api-portfolio-preview.ts +6 -0
  275. package/templates/api-revalidate.ts +5 -0
  276. package/templates/work-category-page.tsx +40 -0
  277. package/templates/work-error.tsx +3 -0
  278. package/templates/work-loading.tsx +1 -0
  279. package/templates/work-page.tsx +37 -0
  280. package/templates/work-slug-loading.tsx +1 -0
  281. package/templates/work-slug-page.tsx +41 -0
  282. package/dist/BeforeAfterSection-6BHFLY4Y.js.map +0 -1
  283. package/dist/BeforeAfterSection-JTORBR3A.cjs +0 -181
  284. package/dist/BeforeAfterSection-JTORBR3A.cjs.map +0 -1
  285. package/dist/CTASection-4JKLXEUF.cjs +0 -111
  286. package/dist/CTASection-4JKLXEUF.cjs.map +0 -1
  287. package/dist/CTASection-BJA72XIL.js +0 -106
  288. package/dist/CTASection-BJA72XIL.js.map +0 -1
  289. package/dist/ChallengesSection-GEQGVSJN.js.map +0 -1
  290. package/dist/ChallengesSection-IZ3DHECS.cjs.map +0 -1
  291. package/dist/ConversionFunnelSection-AUUSJ5HQ.cjs +0 -209
  292. package/dist/ConversionFunnelSection-AUUSJ5HQ.cjs.map +0 -1
  293. package/dist/ConversionFunnelSection-D3GE4NKE.js.map +0 -1
  294. package/dist/DesignSystemSection-2R5BRBGO.js.map +0 -1
  295. package/dist/DesignSystemSection-KXIQXITF.cjs.map +0 -1
  296. package/dist/DetailsSection-A6PZQUQL.js.map +0 -1
  297. package/dist/DetailsSection-TTUZAPZZ.cjs.map +0 -1
  298. package/dist/FeatureSpotlightSection-B7P3JGNL.js.map +0 -1
  299. package/dist/FeatureSpotlightSection-WRHXS7TU.cjs +0 -210
  300. package/dist/FeatureSpotlightSection-WRHXS7TU.cjs.map +0 -1
  301. package/dist/GallerySection-VMKORC47.js.map +0 -1
  302. package/dist/GallerySection-WJ4PQDBI.cjs +0 -219
  303. package/dist/GallerySection-WJ4PQDBI.cjs.map +0 -1
  304. package/dist/MetricsTimelineSection-4L6DUHJ5.cjs.map +0 -1
  305. package/dist/MetricsTimelineSection-6BT5GNFV.js.map +0 -1
  306. package/dist/PerformanceSection-24TVVFZA.cjs.map +0 -1
  307. package/dist/PerformanceSection-MGCEIXDX.js.map +0 -1
  308. package/dist/ResultsSection-DFUJ5U6M.js.map +0 -1
  309. package/dist/ResultsSection-XLGMMQKY.cjs.map +0 -1
  310. package/dist/ServicesSection-D5V3Q4GR.js +0 -118
  311. package/dist/ServicesSection-D5V3Q4GR.js.map +0 -1
  312. package/dist/ServicesSection-WJMGK2MF.cjs +0 -120
  313. package/dist/ServicesSection-WJMGK2MF.cjs.map +0 -1
  314. package/dist/SiteArchitectureSection-J7BPBERH.cjs.map +0 -1
  315. package/dist/SiteArchitectureSection-TE22OAWV.js.map +0 -1
  316. package/dist/SpeedComparisonSection-EZKFQVGW.cjs.map +0 -1
  317. package/dist/SpeedComparisonSection-Y3K7OFZQ.js.map +0 -1
  318. package/dist/StrategySection-CJ7Y6OFQ.cjs +0 -174
  319. package/dist/StrategySection-CJ7Y6OFQ.cjs.map +0 -1
  320. package/dist/StrategySection-DI5RSCJU.js.map +0 -1
  321. package/dist/TeamSection-DZVSNZE6.cjs +0 -112
  322. package/dist/TeamSection-DZVSNZE6.cjs.map +0 -1
  323. package/dist/TeamSection-HGKFW6PQ.js +0 -107
  324. package/dist/TeamSection-HGKFW6PQ.js.map +0 -1
  325. package/dist/TechStackSection-2AQ7RGY3.js +0 -93
  326. package/dist/TechStackSection-2AQ7RGY3.js.map +0 -1
  327. package/dist/TechStackSection-VTNNZR5V.cjs +0 -95
  328. package/dist/TechStackSection-VTNNZR5V.cjs.map +0 -1
  329. package/dist/TestimonialSection-6RGSMXQB.js.map +0 -1
  330. package/dist/TestimonialSection-XPTFUQIN.cjs.map +0 -1
  331. package/dist/VideoSection-4A2HC6K6.js.map +0 -1
  332. package/dist/VideoSection-G3DFS7UH.cjs +0 -118
  333. package/dist/VideoSection-G3DFS7UH.cjs.map +0 -1
  334. package/dist/chunk-2UNKXWQM.js +0 -630
  335. package/dist/chunk-2UNKXWQM.js.map +0 -1
  336. package/dist/chunk-2Y4O3LWM.js +0 -53
  337. package/dist/chunk-2Y4O3LWM.js.map +0 -1
  338. package/dist/chunk-7CFFAKDM.js +0 -74
  339. package/dist/chunk-7CFFAKDM.js.map +0 -1
  340. package/dist/chunk-APG2QSMB.js +0 -131
  341. package/dist/chunk-APG2QSMB.js.map +0 -1
  342. package/dist/chunk-EE75WRCM.cjs.map +0 -1
  343. package/dist/chunk-FDFVLYAM.cjs +0 -637
  344. package/dist/chunk-FDFVLYAM.cjs.map +0 -1
  345. package/dist/chunk-IKBK7HYX.cjs +0 -79
  346. package/dist/chunk-IKBK7HYX.cjs.map +0 -1
  347. package/dist/chunk-KEOHORIH.cjs +0 -79
  348. package/dist/chunk-KEOHORIH.cjs.map +0 -1
  349. package/dist/chunk-OA5ZM4OA.cjs +0 -139
  350. package/dist/chunk-OA5ZM4OA.cjs.map +0 -1
  351. package/dist/chunk-TVFXN6W6.js.map +0 -1
  352. package/dist/chunk-XCKXHK44.js +0 -15
  353. package/dist/chunk-XCKXHK44.js.map +0 -1
  354. package/dist/chunk-XONXEFJY.cjs +0 -58
  355. package/dist/chunk-XONXEFJY.cjs.map +0 -1
  356. package/dist/chunk-XQNJED46.cjs +0 -19
  357. package/dist/chunk-XQNJED46.cjs.map +0 -1
  358. package/dist/chunk-YB4B3OMC.js +0 -74
  359. package/dist/chunk-YB4B3OMC.js.map +0 -1
  360. package/dist/portfolio/sections.cjs +0 -20
  361. package/dist/portfolio/sections.cjs.map +0 -1
  362. package/dist/portfolio/sections.d.cts +0 -42
  363. package/dist/portfolio/sections.d.ts +0 -42
  364. package/dist/portfolio/sections.js +0 -4
  365. package/dist/portfolio/sections.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { B as BrandConfig, P as PortfolioItemFull, a as PortfolioListResponse } from '../types-DL4t_Cfa.js';
1
+ import { P as PortfolioItemFull, a as PortfolioSection, M as MetricsDelta, B as BrandConfig, b as PortfolioListResponse } from '../types-0tVPy4pU.js';
2
2
  export { P as PORTFOLIO_CACHE_TAG } from '../cache-CE_ujDK4.js';
3
3
 
4
4
  /**
@@ -11,9 +11,48 @@ export { P as PORTFOLIO_CACHE_TAG } from '../cache-CE_ujDK4.js';
11
11
  * This file is server-only — no 'use client' directive.
12
12
  */
13
13
 
14
+ /**
15
+ * Error contract (single source of truth for portfolio content fetching):
16
+ *
17
+ * - "Not found" is a DATA answer: the API returns 200 with `found: false`,
18
+ * and `getPortfolioItem` returns null. Consumers map null → notFound().
19
+ * - Infrastructure failure (network error, 5xx, rate-limit exhaustion,
20
+ * missing SONOR_API_KEY) THROWS PortfolioApiError. It must never be
21
+ * conflated with "not found": treating an outage as a 404 turns indexed
22
+ * /work URLs into real 404s during ISR regeneration (the GSC 404-flood
23
+ * class of incident). A thrown error makes Next.js keep serving the last
24
+ * good page during background revalidation, and fails builds loudly
25
+ * instead of silently generating an empty portfolio.
26
+ *
27
+ * The one exception is getPortfolioBrandConfig, which degrades to default
28
+ * branding on failure — cosmetic fallback is safe; content fallback is not.
29
+ */
30
+ declare class PortfolioApiError extends Error {
31
+ readonly path: string;
32
+ constructor(path: string, message?: string);
33
+ }
34
+ /**
35
+ * A 200 response whose body violates the expected shape. Thrown before any
36
+ * mapping so drift between the API and this package surfaces as a loud,
37
+ * named error instead of `undefined` text on live pages.
38
+ */
39
+ declare class PortfolioContractError extends PortfolioApiError {
40
+ readonly field: string;
41
+ constructor(path: string, field: string, detail: string);
42
+ }
43
+ /**
44
+ * Minimal runtime shape check for the single-item response. Deliberately
45
+ * lenient about unknown extra fields (the API may grow) and strict about
46
+ * the fields this package renders from.
47
+ */
48
+ declare function assertPortfolioItemShape(item: unknown, path: string): asserts item is PortfolioItemApiResponse['item'];
14
49
  /**
15
50
  * Fetches published portfolio items from the public API.
16
51
  * Cached via Next.js ISR (revalidate: 3600).
52
+ *
53
+ * An empty portfolio is `{ items: [] }` from a healthy API. Infrastructure
54
+ * failure throws PortfolioApiError (see the error contract above) — it never
55
+ * silently renders an empty portfolio or an empty sitemap.
17
56
  */
18
57
  declare function getPortfolioItems(options?: {
19
58
  category?: string;
@@ -21,29 +60,65 @@ declare function getPortfolioItems(options?: {
21
60
  limit?: number;
22
61
  offset?: number;
23
62
  }): Promise<PortfolioListResponse>;
63
+ /** Shape returned by the single-item API endpoint. */
64
+ interface PortfolioItemApiResponse {
65
+ found: boolean;
66
+ item: {
67
+ id: string;
68
+ slug: string;
69
+ title: string;
70
+ subtitle: string;
71
+ category: string;
72
+ services: string[];
73
+ description: string;
74
+ hero_image: string;
75
+ hero_image_alt: string;
76
+ live_url: string | null;
77
+ project_id: string | null;
78
+ kpis: PortfolioItemFull['kpis'];
79
+ details: PortfolioItemFull['details'];
80
+ seo: PortfolioItemFull['seo'];
81
+ featured: boolean;
82
+ order?: number;
83
+ published_at: string | null;
84
+ hero_screenshots: PortfolioItemFull['hero_screenshots'];
85
+ baseline_metrics: PortfolioItemFull['baseline_metrics'];
86
+ current_metrics: PortfolioItemFull['current_metrics'];
87
+ metrics_last_refreshed_at: string | null;
88
+ sections: PortfolioSection[];
89
+ metricsDelta: MetricsDelta[];
90
+ sectionsOrdered?: boolean;
91
+ };
92
+ }
24
93
  /**
25
94
  * Fetches a single portfolio item by slug, including full Sanity sections
26
95
  * and live metrics delta. This is the main data function for portfolio detail pages.
27
96
  *
28
- * Returns null when the item is not found or the API call fails.
97
+ * Returns null ONLY when the item genuinely does not exist (API answered
98
+ * `found: false`) — safe to map to notFound(). Infrastructure failures throw
99
+ * PortfolioApiError instead, so an API outage during ISR regeneration keeps
100
+ * serving the last good page rather than minting a real 404.
29
101
  */
30
102
  declare function getPortfolioItem(slug: string): Promise<PortfolioItemFull | null>;
31
103
  /**
32
104
  * Fetches available portfolio categories.
33
- * Returns an empty array on failure.
105
+ * Infrastructure failure throws PortfolioApiError (see error contract).
34
106
  */
35
107
  declare function getPortfolioCategories(): Promise<string[]>;
36
108
  /**
37
109
  * Fetches brand configuration for the agency (colors, fonts, logo).
38
- * Returns sensible defaults when the API call fails.
110
+ * Returns sensible defaults when the API call fails — the ONE deliberate
111
+ * exception to the throw-on-failure contract: brand config is cosmetic, and
112
+ * an API blip must not take down the whole layout that wraps every page.
39
113
  */
40
114
  declare function getPortfolioBrandConfig(): Promise<BrandConfig>;
41
115
  /**
42
116
  * Generates Next.js Metadata for a portfolio item page.
43
117
  * For use in generateMetadata() in the App Router.
44
118
  *
45
- * Returns an empty object when the item cannot be found, which is safe
46
- * to spread into the metadata return value.
119
+ * Returns an empty object when the item does not exist (safe to spread into
120
+ * the metadata return value); infrastructure failures throw so a build never
121
+ * silently ships pages with missing metadata.
47
122
  */
48
123
  declare function generatePortfolioMetadata(slug: string): Promise<{
49
124
  title?: string;
@@ -61,9 +136,84 @@ declare function generatePortfolioMetadata(slug: string): Promise<{
61
136
  * For use in generateStaticParams() in the App Router.
62
137
  *
63
138
  * Fetches all published portfolio items and returns their slugs.
139
+ * Infrastructure failure throws, failing the build loudly instead of
140
+ * silently building a site with zero portfolio pages.
64
141
  */
65
142
  declare function generatePortfolioStaticParams(): Promise<Array<{
66
143
  slug: string;
67
144
  }>>;
145
+ /**
146
+ * URL slug for a category display value ("Web Development" → "web-development").
147
+ * Single source of truth for category URLs — PortfolioIndex resolves slugs
148
+ * back to the original values by matching against getPortfolioCategories().
149
+ */
150
+ declare function slugifyCategory(category: string): string;
151
+ /**
152
+ * Static params for the category filter routes.
153
+ * For use in app/work/category/[category]/page.tsx:
154
+ *
155
+ * ```ts
156
+ * export async function generateStaticParams() {
157
+ * return generatePortfolioCategoryStaticParams();
158
+ * }
159
+ * ```
160
+ */
161
+ declare function generatePortfolioCategoryStaticParams(): Promise<Array<{
162
+ category: string;
163
+ }>>;
164
+ /**
165
+ * Metadata for index + category + paginated portfolio routes: a stable
166
+ * title/canonical so filtered and paginated variants don't compete in
167
+ * search. Spread into generateMetadata()'s return value.
168
+ */
169
+ declare function generatePortfolioIndexMetadata(options: {
170
+ /** Site origin (e.g. "https://youragency.com"). */
171
+ baseUrl: string;
172
+ /** Route prefix. Defaults to "/work". */
173
+ basePath?: string;
174
+ /** Active category SLUG (from the route param), if any. */
175
+ category?: string | null;
176
+ /** 1-based page number. */
177
+ page?: number;
178
+ /** Title base, e.g. "Our Work". Category/page qualifiers are appended. */
179
+ titleBase?: string;
180
+ }): Promise<{
181
+ title: string;
182
+ alternates: {
183
+ canonical: string;
184
+ };
185
+ }>;
186
+ /** One entry in the shape Next.js expects from app/sitemap.(js|ts). */
187
+ interface PortfolioSitemapEntry {
188
+ url: string;
189
+ lastModified?: string;
190
+ changeFrequency?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
191
+ priority?: number;
192
+ }
193
+ /**
194
+ * Builds sitemap entries for every published portfolio item, in the shape
195
+ * Next.js `app/sitemap.(js|ts)` expects — spread the result into the array
196
+ * you return:
197
+ *
198
+ * ```ts
199
+ * const portfolio = await generatePortfolioSitemapEntries({
200
+ * baseUrl: 'https://youragency.com',
201
+ * });
202
+ * return [...staticEntries, ...portfolio];
203
+ * ```
204
+ *
205
+ * `lastModified` prefers the metrics refresh timestamp (case studies change
206
+ * when their live metrics update) and falls back to the publish date.
207
+ * Infrastructure failure throws — a sitemap silently missing every case
208
+ * study is how portfolio URLs fall out of the index.
209
+ */
210
+ declare function generatePortfolioSitemapEntries(options: {
211
+ /** Site origin, no trailing slash needed (e.g. "https://youragency.com"). */
212
+ baseUrl: string;
213
+ /** Route prefix for case studies. Defaults to "/work". */
214
+ basePath?: string;
215
+ changeFrequency?: PortfolioSitemapEntry['changeFrequency'];
216
+ priority?: number;
217
+ }): Promise<PortfolioSitemapEntry[]>;
68
218
 
69
- export { generatePortfolioMetadata, generatePortfolioStaticParams, getPortfolioBrandConfig, getPortfolioCategories, getPortfolioItem, getPortfolioItems };
219
+ export { PortfolioApiError, PortfolioContractError, type PortfolioSitemapEntry, assertPortfolioItemShape, generatePortfolioCategoryStaticParams, generatePortfolioIndexMetadata, generatePortfolioMetadata, generatePortfolioSitemapEntries, generatePortfolioStaticParams, getPortfolioBrandConfig, getPortfolioCategories, getPortfolioItem, getPortfolioItems, slugifyCategory };
@@ -1,140 +1,6 @@
1
- import { apiFetch } from '../chunk-TVFXN6W6.js';
2
- import { PORTFOLIO_CACHE_TAG } from '../chunk-N7TVKUYQ.js';
1
+ export { PortfolioApiError, PortfolioContractError, assertPortfolioItemShape, generatePortfolioCategoryStaticParams, generatePortfolioIndexMetadata, generatePortfolioMetadata, generatePortfolioSitemapEntries, generatePortfolioStaticParams, getPortfolioBrandConfig, getPortfolioCategories, getPortfolioItem, getPortfolioItems, slugifyCategory } from '../chunk-KXLROAO5.js';
3
2
  export { PORTFOLIO_CACHE_TAG } from '../chunk-N7TVKUYQ.js';
4
-
5
- // src/portfolio/server.ts
6
- var LOG_PREFIX = "[@sonordev/agency-site-kit/portfolio]";
7
- function portfolioGet(path) {
8
- return apiFetch(path, { method: "GET", tags: [PORTFOLIO_CACHE_TAG] });
9
- }
10
- function buildQuery(params) {
11
- const entries = Object.entries(params).filter(
12
- (entry) => entry[1] != null
13
- );
14
- if (entries.length === 0) return "";
15
- const qs = new URLSearchParams(
16
- entries.map(([k, v]) => [k, String(v)])
17
- ).toString();
18
- return `?${qs}`;
19
- }
20
- async function getPortfolioItems(options) {
21
- const fallback = { items: [], total: 0, limit: 0, offset: 0 };
22
- const query = buildQuery({
23
- category: options?.category,
24
- featured: options?.featured,
25
- limit: options?.limit,
26
- offset: options?.offset
27
- });
28
- const data = await portfolioGet(
29
- `/api/public/portfolio/items${query}`
30
- );
31
- if (!data) {
32
- console.warn(`${LOG_PREFIX} Failed to fetch portfolio items.`);
33
- return fallback;
34
- }
35
- return data;
36
- }
37
- async function getPortfolioItem(slug) {
38
- if (!slug) {
39
- console.warn(`${LOG_PREFIX} getPortfolioItem called with empty slug.`);
40
- return null;
41
- }
42
- const data = await portfolioGet(
43
- `/api/public/portfolio/items/${encodeURIComponent(slug)}`
44
- );
45
- if (!data || !data.found || !data.item) {
46
- console.warn(`${LOG_PREFIX} Portfolio item not found for slug: "${slug}".`);
47
- return null;
48
- }
49
- const { item } = data;
50
- return {
51
- id: item.id,
52
- slug: item.slug,
53
- title: item.title,
54
- subtitle: item.subtitle,
55
- category: item.category,
56
- services: item.services,
57
- description: item.description,
58
- hero_image: item.hero_image,
59
- hero_image_alt: item.hero_image_alt,
60
- live_url: item.live_url,
61
- project_id: item.project_id ?? null,
62
- kpis: item.kpis,
63
- details: item.details,
64
- seo: item.seo,
65
- featured: item.featured,
66
- order: item.order,
67
- published_at: item.published_at,
68
- hero_screenshots: item.hero_screenshots,
69
- baseline_metrics: item.baseline_metrics,
70
- current_metrics: item.current_metrics,
71
- metrics_last_refreshed_at: item.metrics_last_refreshed_at,
72
- sections: item.sections ?? [],
73
- metricsDelta: item.metricsDelta ?? []
74
- };
75
- }
76
- async function getPortfolioCategories() {
77
- const data = await portfolioGet("/api/public/portfolio/categories");
78
- if (!data) {
79
- console.warn(`${LOG_PREFIX} Failed to fetch portfolio categories.`);
80
- return [];
81
- }
82
- return data;
83
- }
84
- async function getPortfolioBrandConfig() {
85
- const fallback = {
86
- primary: "#6366f1",
87
- secondary: "#8b5cf6",
88
- background: "#0a0a0f",
89
- backgroundElevated: "#12121a",
90
- surface: "#1a1a2e",
91
- surfaceHover: "#22223a",
92
- surfaceBorder: "#2a2a3e",
93
- textPrimary: "#f0f0f5",
94
- textSecondary: "#a0a0b5",
95
- textTertiary: "#6b6b80",
96
- fontHeading: "Inter, system-ui, sans-serif",
97
- fontBody: "Inter, system-ui, sans-serif"
98
- };
99
- const data = await portfolioGet(
100
- "/api/public/portfolio/config"
101
- );
102
- if (!data || !data.brand) {
103
- console.warn(`${LOG_PREFIX} Failed to fetch brand config, using defaults.`);
104
- return fallback;
105
- }
106
- return data.brand;
107
- }
108
- async function generatePortfolioMetadata(slug) {
109
- const item = await getPortfolioItem(slug);
110
- if (!item) {
111
- return {};
112
- }
113
- const seo = item.seo;
114
- const title = seo?.metaTitle || item.title;
115
- const description = seo?.metaDescription || item.description;
116
- const keywords = seo?.keywords ?? [];
117
- const ogImages = [];
118
- if (item.hero_image) {
119
- ogImages.push(item.hero_image);
120
- }
121
- return {
122
- title,
123
- description,
124
- keywords: keywords.length > 0 ? keywords : void 0,
125
- openGraph: {
126
- title,
127
- description,
128
- images: ogImages.length > 0 ? ogImages : void 0,
129
- type: "article"
130
- }
131
- };
132
- }
133
- async function generatePortfolioStaticParams() {
134
- const data = await getPortfolioItems({ limit: 500, offset: 0 });
135
- return data.items.map((item) => ({ slug: item.slug }));
136
- }
137
-
138
- export { generatePortfolioMetadata, generatePortfolioStaticParams, getPortfolioBrandConfig, getPortfolioCategories, getPortfolioItem, getPortfolioItems };
3
+ import '../chunk-L4EOQVRJ.js';
4
+ import '../chunk-QL6KVIFR.js';
139
5
  //# sourceMappingURL=server.js.map
140
6
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/portfolio/server.ts"],"names":[],"mappings":";;;;;AAsBA,IAAM,UAAA,GAAa,uCAAA;AAUnB,SAAS,aAAgB,IAAA,EAAiC;AACxD,EAAA,OAAO,QAAA,CAAY,MAAM,EAAE,MAAA,EAAQ,OAAO,IAAA,EAAM,CAAC,mBAAmB,CAAA,EAAG,CAAA;AACzE;AASA,SAAS,WAAW,MAAA,EAA8E;AAChG,EAAA,MAAM,OAAA,GAAU,MAAA,CAAO,OAAA,CAAQ,MAAM,CAAA,CA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,GAAQ,GAAA,EAAK,SAAA,IAAa,IAAA,CAAK,KAAA;AACrC,EAAA,MAAM,WAAA,GAAc,GAAA,EAAK,eAAA,IAAmB,IAAA,CAAK,WAAA;AACjD,EAAA,MAAM,QAAA,GAAW,GAAA,EAAK,QAAA,IAAY,EAAC;AAGnC,EAAA,MAAM,WAAqB,EAAC;AAC5B,EAAA,IAAI,KAAK,UAAA,EAAY;AACnB,IAAA,QAAA,CAAS,IAAA,CAAK,KAAK,UAAU,CAAA;AAAA,EAC/B;AAEA,EAAA,OAAO;AAAA,IACL,KAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA,EAAU,QAAA,CAAS,MAAA,GAAS,CAAA,GAAI,QAAA,GAAW,MAAA;AAAA,IAC3C,SAAA,EAAW;AAAA,MACT,KAAA;AAAA,MACA,WAAA;AAAA,MACA,MAAA,EAAQ,QAAA,CAAS,MAAA,GAAS,CAAA,GAAI,QAAA,GAAW,MAAA;AAAA,MACzC,IAAA,EAAM;AAAA;AACR,GACF;AACF;AAYA,eAAsB,6BAAA,GAAkE;AAEtF,EAAA,MAAM,IAAA,GAAO,MAAM,iBAAA,CAAkB,EAAE,OAAO,GAAA,EAAK,MAAA,EAAQ,GAAG,CAAA;AAE9D,EAAA,OAAO,IAAA,CAAK,MAAM,GAAA,CAAI,CAAC,UAAU,EAAE,IAAA,EAAM,IAAA,CAAK,IAAA,EAAK,CAAE,CAAA;AACvD","file":"server.js","sourcesContent":["/**\n * @sonordev/agency-site-kit — Portfolio server-side data fetching\n *\n * RSC (React Server Component) data layer for portfolio pages.\n * All functions are async and designed for use in Next.js App Router\n * server components, generateMetadata(), and generateStaticParams().\n *\n * This file is server-only — no 'use client' directive.\n */\n\nimport { apiFetch } from '../shared/api';\nimport { PORTFOLIO_CACHE_TAG } from '../shared/cache';\nimport type {\n BrandConfig,\n MetricsDelta,\n PortfolioConfigResponse,\n PortfolioItemFull,\n PortfolioListResponse,\n PortfolioSeoData,\n PortfolioSection,\n} from '../types';\n\nconst LOG_PREFIX = '[@sonordev/agency-site-kit/portfolio]';\n\n// Re-export so consumers and route handlers can reference the same tag.\nexport { PORTFOLIO_CACHE_TAG } from '../shared/cache';\n\n/**\n * GET against the public portfolio API with the shared portfolio cache tag,\n * so the Portal's revalidation webhook can invalidate every portfolio fetch\n * (list, detail, categories, config, sitemap data) via one revalidateTag.\n */\nfunction portfolioGet<T>(path: string): Promise<T | null> {\n return apiFetch<T>(path, { method: 'GET', tags: [PORTFOLIO_CACHE_TAG] });\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Builds a query string from an object, omitting undefined/null values.\n */\nfunction buildQuery(params: Record<string, string | number | boolean | undefined | null>): string {\n const entries = Object.entries(params).filter(\n (entry): entry is [string, string | number | boolean] => entry[1] != null,\n );\n if (entries.length === 0) return '';\n const qs = new URLSearchParams(\n entries.map(([k, v]) => [k, String(v)]),\n ).toString();\n return `?${qs}`;\n}\n\n// ---------------------------------------------------------------------------\n// Public API — List items\n// ---------------------------------------------------------------------------\n\n/**\n * Fetches published portfolio items from the public API.\n * Cached via Next.js ISR (revalidate: 3600).\n */\nexport async function getPortfolioItems(options?: {\n category?: string;\n featured?: boolean;\n limit?: number;\n offset?: number;\n}): Promise<PortfolioListResponse> {\n const fallback: PortfolioListResponse = { items: [], total: 0, limit: 0, offset: 0 };\n\n const query = buildQuery({\n category: options?.category,\n featured: options?.featured,\n limit: options?.limit,\n offset: options?.offset,\n });\n\n const data = await portfolioGet<PortfolioListResponse>(\n `/api/public/portfolio/items${query}`,\n );\n\n if (!data) {\n console.warn(`${LOG_PREFIX} Failed to fetch portfolio items.`);\n return fallback;\n }\n\n return data;\n}\n\n// ---------------------------------------------------------------------------\n// Public API — Single item\n// ---------------------------------------------------------------------------\n\n/** Shape returned by the single-item API endpoint. */\ninterface PortfolioItemApiResponse {\n found: boolean;\n item: {\n id: string;\n slug: string;\n title: string;\n subtitle: string;\n category: string;\n services: string[];\n description: string;\n hero_image: string;\n hero_image_alt: string;\n live_url: string | null;\n project_id: string | null;\n kpis: PortfolioItemFull['kpis'];\n details: PortfolioItemFull['details'];\n seo: PortfolioItemFull['seo'];\n featured: boolean;\n order?: number;\n published_at: string | null;\n hero_screenshots: PortfolioItemFull['hero_screenshots'];\n baseline_metrics: PortfolioItemFull['baseline_metrics'];\n current_metrics: PortfolioItemFull['current_metrics'];\n metrics_last_refreshed_at: string | null;\n sections: PortfolioSection[];\n metricsDelta: MetricsDelta[];\n };\n}\n\n/**\n * Fetches a single portfolio item by slug, including full Sanity sections\n * and live metrics delta. This is the main data function for portfolio detail pages.\n *\n * Returns null when the item is not found or the API call fails.\n */\nexport async function getPortfolioItem(slug: string): Promise<PortfolioItemFull | null> {\n if (!slug) {\n console.warn(`${LOG_PREFIX} getPortfolioItem called with empty slug.`);\n return null;\n }\n\n const data = await portfolioGet<PortfolioItemApiResponse>(\n `/api/public/portfolio/items/${encodeURIComponent(slug)}`,\n );\n\n if (!data || !data.found || !data.item) {\n console.warn(`${LOG_PREFIX} Portfolio item not found for slug: \"${slug}\".`);\n return null;\n }\n\n // Map the API response to the PortfolioItemFull type\n const { item } = data;\n return {\n id: item.id,\n slug: item.slug,\n title: item.title,\n subtitle: item.subtitle,\n category: item.category,\n services: item.services,\n description: item.description,\n hero_image: item.hero_image,\n hero_image_alt: item.hero_image_alt,\n live_url: item.live_url,\n project_id: item.project_id ?? null,\n kpis: item.kpis,\n details: item.details,\n seo: item.seo,\n featured: item.featured,\n order: item.order,\n published_at: item.published_at,\n hero_screenshots: item.hero_screenshots,\n baseline_metrics: item.baseline_metrics,\n current_metrics: item.current_metrics,\n metrics_last_refreshed_at: item.metrics_last_refreshed_at,\n sections: item.sections ?? [],\n metricsDelta: item.metricsDelta ?? [],\n };\n}\n\n// ---------------------------------------------------------------------------\n// Public API — Categories\n// ---------------------------------------------------------------------------\n\n/**\n * Fetches available portfolio categories.\n * Returns an empty array on failure.\n */\nexport async function getPortfolioCategories(): Promise<string[]> {\n const data = await portfolioGet<string[]>('/api/public/portfolio/categories');\n\n if (!data) {\n console.warn(`${LOG_PREFIX} Failed to fetch portfolio categories.`);\n return [];\n }\n\n return data;\n}\n\n// ---------------------------------------------------------------------------\n// Public API — Brand config\n// ---------------------------------------------------------------------------\n\n/**\n * Fetches brand configuration for the agency (colors, fonts, logo).\n * Returns sensible defaults when the API call fails.\n */\nexport async function getPortfolioBrandConfig(): Promise<BrandConfig> {\n const fallback: BrandConfig = {\n primary: '#6366f1',\n secondary: '#8b5cf6',\n background: '#0a0a0f',\n backgroundElevated: '#12121a',\n surface: '#1a1a2e',\n surfaceHover: '#22223a',\n surfaceBorder: '#2a2a3e',\n textPrimary: '#f0f0f5',\n textSecondary: '#a0a0b5',\n textTertiary: '#6b6b80',\n fontHeading: 'Inter, system-ui, sans-serif',\n fontBody: 'Inter, system-ui, sans-serif',\n };\n\n const data = await portfolioGet<PortfolioConfigResponse>(\n '/api/public/portfolio/config',\n );\n\n if (!data || !data.brand) {\n console.warn(`${LOG_PREFIX} Failed to fetch brand config, using defaults.`);\n return fallback;\n }\n\n return data.brand;\n}\n\n// ---------------------------------------------------------------------------\n// Next.js Metadata helper\n// ---------------------------------------------------------------------------\n\n/**\n * Generates Next.js Metadata for a portfolio item page.\n * For use in generateMetadata() in the App Router.\n *\n * Returns an empty object when the item cannot be found, which is safe\n * to spread into the metadata return value.\n */\nexport async function generatePortfolioMetadata(slug: string): Promise<{\n title?: string;\n description?: string;\n keywords?: string[];\n openGraph?: {\n title?: string;\n description?: string;\n images?: string[];\n type?: string;\n };\n}> {\n const item = await getPortfolioItem(slug);\n\n if (!item) {\n return {};\n }\n\n // Prefer dedicated SEO data if available, fall back to item fields\n const seo: PortfolioSeoData | null = item.seo;\n const title = seo?.metaTitle || item.title;\n const description = seo?.metaDescription || item.description;\n const keywords = seo?.keywords ?? [];\n\n // Collect OG images: prefer SEO og image, then hero image\n const ogImages: string[] = [];\n if (item.hero_image) {\n ogImages.push(item.hero_image);\n }\n\n return {\n title,\n description,\n keywords: keywords.length > 0 ? keywords : undefined,\n openGraph: {\n title,\n description,\n images: ogImages.length > 0 ? ogImages : undefined,\n type: 'article',\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// Next.js Static Params helper\n// ---------------------------------------------------------------------------\n\n/**\n * Generates static params for portfolio pages.\n * For use in generateStaticParams() in the App Router.\n *\n * Fetches all published portfolio items and returns their slugs.\n */\nexport async function generatePortfolioStaticParams(): Promise<Array<{ slug: string }>> {\n // Fetch a large batch to cover all published items\n const data = await getPortfolioItems({ limit: 500, offset: 0 });\n\n return data.items.map((item) => ({ slug: item.slug }));\n}\n"]}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"server.js"}
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ var chunkHQGAX2LI_cjs = require('./chunk-HQGAX2LI.cjs');
4
+ var chunkXOWSXZYW_cjs = require('./chunk-XOWSXZYW.cjs');
5
+ var headers = require('next/headers');
6
+ var server = require('next/server');
7
+
8
+ function createPortfolioPreviewHandler(options = {}) {
9
+ const basePath = options.basePath ?? "/work";
10
+ return {
11
+ async GET(request) {
12
+ const url = new URL(request.url);
13
+ const slug = url.searchParams.get("slug") ?? "";
14
+ const token = url.searchParams.get("token") ?? "";
15
+ const exit = url.searchParams.get("exit");
16
+ const dm = await headers.draftMode();
17
+ if (exit) {
18
+ dm.disable();
19
+ const jar2 = await headers.cookies();
20
+ jar2.delete(chunkHQGAX2LI_cjs.PORTFOLIO_PREVIEW_COOKIE);
21
+ return server.NextResponse.redirect(new URL(basePath, url.origin));
22
+ }
23
+ if (!slug || !token) {
24
+ return server.NextResponse.json(
25
+ { error: "Missing slug or token" },
26
+ { status: 400 }
27
+ );
28
+ }
29
+ const data = await chunkXOWSXZYW_cjs.apiFetch(
30
+ `/api/public/portfolio/items/${encodeURIComponent(slug)}?preview=${encodeURIComponent(token)}`,
31
+ { method: "GET", revalidate: 0 }
32
+ );
33
+ if (!data?.found) {
34
+ return server.NextResponse.json(
35
+ { error: "Invalid or expired preview token" },
36
+ { status: 401 }
37
+ );
38
+ }
39
+ dm.enable();
40
+ const jar = await headers.cookies();
41
+ jar.set(chunkHQGAX2LI_cjs.PORTFOLIO_PREVIEW_COOKIE, token, {
42
+ httpOnly: true,
43
+ sameSite: "lax",
44
+ secure: url.protocol === "https:",
45
+ maxAge: 60 * 60,
46
+ // matches the token TTL
47
+ path: "/"
48
+ });
49
+ return server.NextResponse.redirect(new URL(`${basePath}/${slug}`, url.origin));
50
+ }
51
+ };
52
+ }
53
+
54
+ exports.createPortfolioPreviewHandler = createPortfolioPreviewHandler;
55
+ //# sourceMappingURL=preview.cjs.map
56
+ //# sourceMappingURL=preview.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/preview.ts"],"names":["draftMode","jar","cookies","PORTFOLIO_PREVIEW_COOKIE","NextResponse","apiFetch"],"mappings":";;;;;;;AAiCO,SAAS,6BAAA,CACd,OAAA,GAA0C,EAAC,EACO;AAClD,EAAA,MAAM,QAAA,GAAW,QAAQ,QAAA,IAAY,OAAA;AAErC,EAAA,OAAO;AAAA,IACL,MAAM,IAAI,OAAA,EAAqC;AAC7C,MAAA,MAAM,GAAA,GAAM,IAAI,GAAA,CAAI,OAAA,CAAQ,GAAG,CAAA;AAC/B,MAAA,MAAM,IAAA,GAAO,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,MAAM,CAAA,IAAK,EAAA;AAC7C,MAAA,MAAM,KAAA,GAAQ,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,OAAO,CAAA,IAAK,EAAA;AAC/C,MAAA,MAAM,IAAA,GAAO,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,MAAM,CAAA;AAExC,MAAA,MAAM,EAAA,GAAK,MAAMA,iBAAA,EAAU;AAE3B,MAAA,IAAI,IAAA,EAAM;AACR,QAAA,EAAA,CAAG,OAAA,EAAQ;AACX,QAAA,MAAMC,IAAAA,GAAM,MAAMC,eAAA,EAAQ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E;AAAA,GACF;AACF","file":"preview.cjs","sourcesContent":["/**\n * @sonordev/agency-site-kit/preview — draft preview route factory\n *\n * Lets the Sonor dashboard's Preview button open an UNPUBLISHED case study\n * on the live agency site. Mount it as a route handler:\n *\n * ```ts\n * // app/api/portfolio-preview/route.ts\n * import { createPortfolioPreviewHandler } from '@sonordev/agency-site-kit/preview';\n * export const { GET } = createPortfolioPreviewHandler();\n * ```\n *\n * Flow: the dashboard requests a short-lived token from the Sonor API\n * (hash-stored, ~1h TTL) and opens\n * `{site}/api/portfolio-preview?slug=…&token=…`. This handler validates the\n * token against the public API (a draft that resolves with the token IS the\n * validation), enables Next draft mode, stores the token in an httpOnly\n * cookie, and redirects to the case study. `getPortfolioItem` sees draft\n * mode + cookie and fetches with `?preview=` and no caching.\n *\n * `?exit=1` disables draft mode and clears the cookie.\n */\n\nimport { draftMode, cookies } from 'next/headers';\nimport { NextResponse } from 'next/server';\nimport { apiFetch } from './shared/api';\nimport { PORTFOLIO_PREVIEW_COOKIE } from './shared/preview';\n\nexport interface PortfolioPreviewHandlerOptions {\n /** Route prefix for case studies. Defaults to \"/work\". */\n basePath?: string;\n}\n\nexport function createPortfolioPreviewHandler(\n options: PortfolioPreviewHandlerOptions = {},\n): { GET: (request: Request) => Promise<Response> } {\n const basePath = options.basePath ?? '/work';\n\n return {\n async GET(request: Request): Promise<Response> {\n const url = new URL(request.url);\n const slug = url.searchParams.get('slug') ?? '';\n const token = url.searchParams.get('token') ?? '';\n const exit = url.searchParams.get('exit');\n\n const dm = await draftMode();\n\n if (exit) {\n dm.disable();\n const jar = await cookies();\n jar.delete(PORTFOLIO_PREVIEW_COOKIE);\n return NextResponse.redirect(new URL(basePath, url.origin));\n }\n\n if (!slug || !token) {\n return NextResponse.json(\n { error: 'Missing slug or token' },\n { status: 400 },\n );\n }\n\n // Validation = the draft resolves with this token. Uncached on purpose.\n const data = await apiFetch<{ found: boolean }>(\n `/api/public/portfolio/items/${encodeURIComponent(slug)}?preview=${encodeURIComponent(token)}`,\n { method: 'GET', revalidate: 0 },\n );\n\n if (!data?.found) {\n return NextResponse.json(\n { error: 'Invalid or expired preview token' },\n { status: 401 },\n );\n }\n\n dm.enable();\n const jar = await cookies();\n jar.set(PORTFOLIO_PREVIEW_COOKIE, token, {\n httpOnly: true,\n sameSite: 'lax',\n secure: url.protocol === 'https:',\n maxAge: 60 * 60, // matches the token TTL\n path: '/',\n });\n\n return NextResponse.redirect(new URL(`${basePath}/${slug}`, url.origin));\n },\n };\n}\n"]}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @sonordev/agency-site-kit/preview — draft preview route factory
3
+ *
4
+ * Lets the Sonor dashboard's Preview button open an UNPUBLISHED case study
5
+ * on the live agency site. Mount it as a route handler:
6
+ *
7
+ * ```ts
8
+ * // app/api/portfolio-preview/route.ts
9
+ * import { createPortfolioPreviewHandler } from '@sonordev/agency-site-kit/preview';
10
+ * export const { GET } = createPortfolioPreviewHandler();
11
+ * ```
12
+ *
13
+ * Flow: the dashboard requests a short-lived token from the Sonor API
14
+ * (hash-stored, ~1h TTL) and opens
15
+ * `{site}/api/portfolio-preview?slug=…&token=…`. This handler validates the
16
+ * token against the public API (a draft that resolves with the token IS the
17
+ * validation), enables Next draft mode, stores the token in an httpOnly
18
+ * cookie, and redirects to the case study. `getPortfolioItem` sees draft
19
+ * mode + cookie and fetches with `?preview=` and no caching.
20
+ *
21
+ * `?exit=1` disables draft mode and clears the cookie.
22
+ */
23
+ interface PortfolioPreviewHandlerOptions {
24
+ /** Route prefix for case studies. Defaults to "/work". */
25
+ basePath?: string;
26
+ }
27
+ declare function createPortfolioPreviewHandler(options?: PortfolioPreviewHandlerOptions): {
28
+ GET: (request: Request) => Promise<Response>;
29
+ };
30
+
31
+ export { type PortfolioPreviewHandlerOptions, createPortfolioPreviewHandler };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @sonordev/agency-site-kit/preview — draft preview route factory
3
+ *
4
+ * Lets the Sonor dashboard's Preview button open an UNPUBLISHED case study
5
+ * on the live agency site. Mount it as a route handler:
6
+ *
7
+ * ```ts
8
+ * // app/api/portfolio-preview/route.ts
9
+ * import { createPortfolioPreviewHandler } from '@sonordev/agency-site-kit/preview';
10
+ * export const { GET } = createPortfolioPreviewHandler();
11
+ * ```
12
+ *
13
+ * Flow: the dashboard requests a short-lived token from the Sonor API
14
+ * (hash-stored, ~1h TTL) and opens
15
+ * `{site}/api/portfolio-preview?slug=…&token=…`. This handler validates the
16
+ * token against the public API (a draft that resolves with the token IS the
17
+ * validation), enables Next draft mode, stores the token in an httpOnly
18
+ * cookie, and redirects to the case study. `getPortfolioItem` sees draft
19
+ * mode + cookie and fetches with `?preview=` and no caching.
20
+ *
21
+ * `?exit=1` disables draft mode and clears the cookie.
22
+ */
23
+ interface PortfolioPreviewHandlerOptions {
24
+ /** Route prefix for case studies. Defaults to "/work". */
25
+ basePath?: string;
26
+ }
27
+ declare function createPortfolioPreviewHandler(options?: PortfolioPreviewHandlerOptions): {
28
+ GET: (request: Request) => Promise<Response>;
29
+ };
30
+
31
+ export { type PortfolioPreviewHandlerOptions, createPortfolioPreviewHandler };
@@ -0,0 +1,54 @@
1
+ import { PORTFOLIO_PREVIEW_COOKIE } from './chunk-L4EOQVRJ.js';
2
+ import { apiFetch } from './chunk-QL6KVIFR.js';
3
+ import { draftMode, cookies } from 'next/headers';
4
+ import { NextResponse } from 'next/server';
5
+
6
+ function createPortfolioPreviewHandler(options = {}) {
7
+ const basePath = options.basePath ?? "/work";
8
+ return {
9
+ async GET(request) {
10
+ const url = new URL(request.url);
11
+ const slug = url.searchParams.get("slug") ?? "";
12
+ const token = url.searchParams.get("token") ?? "";
13
+ const exit = url.searchParams.get("exit");
14
+ const dm = await draftMode();
15
+ if (exit) {
16
+ dm.disable();
17
+ const jar2 = await cookies();
18
+ jar2.delete(PORTFOLIO_PREVIEW_COOKIE);
19
+ return NextResponse.redirect(new URL(basePath, url.origin));
20
+ }
21
+ if (!slug || !token) {
22
+ return NextResponse.json(
23
+ { error: "Missing slug or token" },
24
+ { status: 400 }
25
+ );
26
+ }
27
+ const data = await apiFetch(
28
+ `/api/public/portfolio/items/${encodeURIComponent(slug)}?preview=${encodeURIComponent(token)}`,
29
+ { method: "GET", revalidate: 0 }
30
+ );
31
+ if (!data?.found) {
32
+ return NextResponse.json(
33
+ { error: "Invalid or expired preview token" },
34
+ { status: 401 }
35
+ );
36
+ }
37
+ dm.enable();
38
+ const jar = await cookies();
39
+ jar.set(PORTFOLIO_PREVIEW_COOKIE, token, {
40
+ httpOnly: true,
41
+ sameSite: "lax",
42
+ secure: url.protocol === "https:",
43
+ maxAge: 60 * 60,
44
+ // matches the token TTL
45
+ path: "/"
46
+ });
47
+ return NextResponse.redirect(new URL(`${basePath}/${slug}`, url.origin));
48
+ }
49
+ };
50
+ }
51
+
52
+ export { createPortfolioPreviewHandler };
53
+ //# sourceMappingURL=preview.js.map
54
+ //# sourceMappingURL=preview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/preview.ts"],"names":["jar"],"mappings":";;;;;AAiCO,SAAS,6BAAA,CACd,OAAA,GAA0C,EAAC,EACO;AAClD,EAAA,MAAM,QAAA,GAAW,QAAQ,QAAA,IAAY,OAAA;AAErC,EAAA,OAAO;AAAA,IACL,MAAM,IAAI,OAAA,EAAqC;AAC7C,MAAA,MAAM,GAAA,GAAM,IAAI,GAAA,CAAI,OAAA,CAAQ,GAAG,CAAA;AAC/B,MAAA,MAAM,IAAA,GAAO,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,MAAM,CAAA,IAAK,EAAA;AAC7C,MAAA,MAAM,KAAA,GAAQ,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,OAAO,CAAA,IAAK,EAAA;AAC/C,MAAA,MAAM,IAAA,GAAO,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,MAAM,CAAA;AAExC,MAAA,MAAM,EAAA,GAAK,MAAM,SAAA,EAAU;AAE3B,MAAA,IAAI,IAAA,EAAM;AACR,QA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AI,CAAA,CAAA,EAAI,GAAA,CAAI,MAAM,CAAC,CAAA;AAAA,IACzE;AAAA,GACF;AACF","file":"preview.js","sourcesContent":["/**\n * @sonordev/agency-site-kit/preview — draft preview route factory\n *\n * Lets the Sonor dashboard's Preview button open an UNPUBLISHED case study\n * on the live agency site. Mount it as a route handler:\n *\n * ```ts\n * // app/api/portfolio-preview/route.ts\n * import { createPortfolioPreviewHandler } from '@sonordev/agency-site-kit/preview';\n * export const { GET } = createPortfolioPreviewHandler();\n * ```\n *\n * Flow: the dashboard requests a short-lived token from the Sonor API\n * (hash-stored, ~1h TTL) and opens\n * `{site}/api/portfolio-preview?slug=…&token=…`. This handler validates the\n * token against the public API (a draft that resolves with the token IS the\n * validation), enables Next draft mode, stores the token in an httpOnly\n * cookie, and redirects to the case study. `getPortfolioItem` sees draft\n * mode + cookie and fetches with `?preview=` and no caching.\n *\n * `?exit=1` disables draft mode and clears the cookie.\n */\n\nimport { draftMode, cookies } from 'next/headers';\nimport { NextResponse } from 'next/server';\nimport { apiFetch } from './shared/api';\nimport { PORTFOLIO_PREVIEW_COOKIE } from './shared/preview';\n\nexport interface PortfolioPreviewHandlerOptions {\n /** Route prefix for case studies. Defaults to \"/work\". */\n basePath?: string;\n}\n\nexport function createPortfolioPreviewHandler(\n options: PortfolioPreviewHandlerOptions = {},\n): { GET: (request: Request) => Promise<Response> } {\n const basePath = options.basePath ?? '/work';\n\n return {\n async GET(request: Request): Promise<Response> {\n const url = new URL(request.url);\n const slug = url.searchParams.get('slug') ?? '';\n const token = url.searchParams.get('token') ?? '';\n const exit = url.searchParams.get('exit');\n\n const dm = await draftMode();\n\n if (exit) {\n dm.disable();\n const jar = await cookies();\n jar.delete(PORTFOLIO_PREVIEW_COOKIE);\n return NextResponse.redirect(new URL(basePath, url.origin));\n }\n\n if (!slug || !token) {\n return NextResponse.json(\n { error: 'Missing slug or token' },\n { status: 400 },\n );\n }\n\n // Validation = the draft resolves with this token. Uncached on purpose.\n const data = await apiFetch<{ found: boolean }>(\n `/api/public/portfolio/items/${encodeURIComponent(slug)}?preview=${encodeURIComponent(token)}`,\n { method: 'GET', revalidate: 0 },\n );\n\n if (!data?.found) {\n return NextResponse.json(\n { error: 'Invalid or expired preview token' },\n { status: 401 },\n );\n }\n\n dm.enable();\n const jar = await cookies();\n jar.set(PORTFOLIO_PREVIEW_COOKIE, token, {\n httpOnly: true,\n sameSite: 'lax',\n secure: url.protocol === 'https:',\n maxAge: 60 * 60, // matches the token TTL\n path: '/',\n });\n\n return NextResponse.redirect(new URL(`${basePath}/${slug}`, url.origin));\n },\n };\n}\n"]}
@@ -332,6 +332,12 @@ interface PortfolioItem {
332
332
  interface PortfolioItemFull extends PortfolioItem {
333
333
  sections: PortfolioSection[];
334
334
  metricsDelta: MetricsDelta[];
335
+ /**
336
+ * True once the agency deliberately reordered sections in the dashboard.
337
+ * PortfolioPage respects the sections array order when set (hero pinned
338
+ * first); otherwise it applies the canonical order.
339
+ */
340
+ sectionsOrdered?: boolean;
335
341
  }
336
342
  interface PortfolioListResponse {
337
343
  items: PortfolioItem[];
@@ -345,4 +351,4 @@ interface PortfolioConfigResponse {
345
351
  orgSlug: string;
346
352
  }
347
353
 
348
- export { type PortfolioSection as A, type BrandConfig as B, type PortfolioSeoData as C, type PortfolioServiceItem as D, type PortfolioServicesData as E, type PortfolioStrategyData as F, type PortfolioStrategyPhase as G, type PortfolioTeamData as H, type PortfolioTeamMember as I, type PortfolioTechItem as J, type PortfolioTechStackData as K, type PortfolioTestimonialData as L, type MetricSource as M, type PortfolioVideoData as N, type PortfolioItemFull as P, type SanityImageRef as S, type PortfolioListResponse as a, type PortfolioSectionType as b, type PortfolioSectionDataMap as c, type PortfolioSectionData as d, type MetricsDelta as e, type MetricsSnapshot as f, PORTFOLIO_SECTION_TYPES as g, type PortfolioAnnotation as h, type PortfolioBeforeAfterData as i, type PortfolioCTAData as j, type PortfolioChallengeItem as k, type PortfolioChallengesData as l, type PortfolioConfigResponse as m, type PortfolioConversionFunnelData as n, type PortfolioDetailsData as o, type PortfolioFeatureSpotlightData as p, type PortfolioFunnelStage as q, type PortfolioGalleryData as r, type PortfolioGalleryImage as s, type PortfolioHeroData as t, type PortfolioItem as u, type PortfolioKPI as v, type PortfolioMetricsDataPoint as w, type PortfolioMetricsTimelineData as x, type PortfolioResultItem as y, type PortfolioResultsData as z };
354
+ export { type PortfolioResultItem as A, type BrandConfig as B, type PortfolioSectionData as C, type PortfolioSectionDataMap as D, type PortfolioSectionType as E, type PortfolioSeoData as F, type PortfolioServiceItem as G, type PortfolioStrategyData as H, type PortfolioStrategyPhase as I, type PortfolioTeamData as J, type PortfolioTeamMember as K, type PortfolioTechItem as L, type MetricsDelta as M, type PortfolioVideoData as N, type PortfolioItemFull as P, type SanityImageRef as S, type PortfolioSection as a, type PortfolioListResponse as b, type PortfolioChallengesData as c, type PortfolioDetailsData as d, type PortfolioHeroData as e, type PortfolioResultsData as f, type PortfolioServicesData as g, type PortfolioTechStackData as h, type PortfolioTestimonialData as i, type MetricSource as j, type MetricsSnapshot as k, PORTFOLIO_SECTION_TYPES as l, type PortfolioAnnotation as m, type PortfolioBeforeAfterData as n, type PortfolioCTAData as o, type PortfolioChallengeItem as p, type PortfolioConfigResponse as q, type PortfolioConversionFunnelData as r, type PortfolioFeatureSpotlightData as s, type PortfolioFunnelStage as t, type PortfolioGalleryData as u, type PortfolioGalleryImage as v, type PortfolioItem as w, type PortfolioKPI as x, type PortfolioMetricsDataPoint as y, type PortfolioMetricsTimelineData as z };
@@ -332,6 +332,12 @@ interface PortfolioItem {
332
332
  interface PortfolioItemFull extends PortfolioItem {
333
333
  sections: PortfolioSection[];
334
334
  metricsDelta: MetricsDelta[];
335
+ /**
336
+ * True once the agency deliberately reordered sections in the dashboard.
337
+ * PortfolioPage respects the sections array order when set (hero pinned
338
+ * first); otherwise it applies the canonical order.
339
+ */
340
+ sectionsOrdered?: boolean;
335
341
  }
336
342
  interface PortfolioListResponse {
337
343
  items: PortfolioItem[];
@@ -345,4 +351,4 @@ interface PortfolioConfigResponse {
345
351
  orgSlug: string;
346
352
  }
347
353
 
348
- export { type PortfolioSection as A, type BrandConfig as B, type PortfolioSeoData as C, type PortfolioServiceItem as D, type PortfolioServicesData as E, type PortfolioStrategyData as F, type PortfolioStrategyPhase as G, type PortfolioTeamData as H, type PortfolioTeamMember as I, type PortfolioTechItem as J, type PortfolioTechStackData as K, type PortfolioTestimonialData as L, type MetricSource as M, type PortfolioVideoData as N, type PortfolioItemFull as P, type SanityImageRef as S, type PortfolioListResponse as a, type PortfolioSectionType as b, type PortfolioSectionDataMap as c, type PortfolioSectionData as d, type MetricsDelta as e, type MetricsSnapshot as f, PORTFOLIO_SECTION_TYPES as g, type PortfolioAnnotation as h, type PortfolioBeforeAfterData as i, type PortfolioCTAData as j, type PortfolioChallengeItem as k, type PortfolioChallengesData as l, type PortfolioConfigResponse as m, type PortfolioConversionFunnelData as n, type PortfolioDetailsData as o, type PortfolioFeatureSpotlightData as p, type PortfolioFunnelStage as q, type PortfolioGalleryData as r, type PortfolioGalleryImage as s, type PortfolioHeroData as t, type PortfolioItem as u, type PortfolioKPI as v, type PortfolioMetricsDataPoint as w, type PortfolioMetricsTimelineData as x, type PortfolioResultItem as y, type PortfolioResultsData as z };
354
+ export { type PortfolioResultItem as A, type BrandConfig as B, type PortfolioSectionData as C, type PortfolioSectionDataMap as D, type PortfolioSectionType as E, type PortfolioSeoData as F, type PortfolioServiceItem as G, type PortfolioStrategyData as H, type PortfolioStrategyPhase as I, type PortfolioTeamData as J, type PortfolioTeamMember as K, type PortfolioTechItem as L, type MetricsDelta as M, type PortfolioVideoData as N, type PortfolioItemFull as P, type SanityImageRef as S, type PortfolioSection as a, type PortfolioListResponse as b, type PortfolioChallengesData as c, type PortfolioDetailsData as d, type PortfolioHeroData as e, type PortfolioResultsData as f, type PortfolioServicesData as g, type PortfolioTechStackData as h, type PortfolioTestimonialData as i, type MetricSource as j, type MetricsSnapshot as k, PORTFOLIO_SECTION_TYPES as l, type PortfolioAnnotation as m, type PortfolioBeforeAfterData as n, type PortfolioCTAData as o, type PortfolioChallengeItem as p, type PortfolioConfigResponse as q, type PortfolioConversionFunnelData as r, type PortfolioFeatureSpotlightData as s, type PortfolioFunnelStage as t, type PortfolioGalleryData as u, type PortfolioGalleryImage as v, type PortfolioItem as w, type PortfolioKPI as x, type PortfolioMetricsDataPoint as y, type PortfolioMetricsTimelineData as z };