@dsaplatform/content-sdk 1.0.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.
@@ -0,0 +1,369 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React from 'react';
3
+
4
+ /**
5
+ * SDK Configuration for DSA Content Engine
6
+ */
7
+ interface DsaContentConfig {
8
+ /** Content Engine API URL (e.g., "https://content.example.com") */
9
+ apiUrl: string;
10
+ /** Site's public API key for authentication */
11
+ apiKey: string;
12
+ /** Cache strategy for Next.js ISR */
13
+ cacheStrategy?: 'no-cache' | 'force-cache' | 'revalidate';
14
+ /** Revalidation interval in seconds (for ISR) */
15
+ revalidateSeconds?: number;
16
+ }
17
+ /**
18
+ * Full article response from Content Engine
19
+ */
20
+ interface Article {
21
+ id: string;
22
+ title: string;
23
+ slug: string;
24
+ excerpt: string | null;
25
+ content_html: string;
26
+ content_json: any | null;
27
+ h1: string | null;
28
+ meta_title: string | null;
29
+ meta_description: string | null;
30
+ canonical_url?: string | null;
31
+ target_keyword: string | null;
32
+ secondary_keywords: string[];
33
+ headings: ArticleHeading[];
34
+ faq: FaqItem[];
35
+ internal_links: InternalLink[];
36
+ schema_json: any | null;
37
+ featured_image_url: string | null;
38
+ featured_image_alt: string | null;
39
+ publish_status: string;
40
+ published_at: string | null;
41
+ updated_at?: string | null;
42
+ word_count: number | null;
43
+ reading_time_minutes: number | null;
44
+ seo_score: number | null;
45
+ pillar_name?: string;
46
+ cluster_name?: string;
47
+ content_type?: string;
48
+ }
49
+ /**
50
+ * Abbreviated article for lists
51
+ */
52
+ interface ArticleListItem {
53
+ id: string;
54
+ title: string;
55
+ slug: string;
56
+ excerpt: string | null;
57
+ featured_image_url: string | null;
58
+ featured_image_alt: string | null;
59
+ published_at: string | null;
60
+ pillar_name?: string;
61
+ cluster_name?: string;
62
+ content_type?: string;
63
+ reading_time_minutes: number | null;
64
+ }
65
+ /**
66
+ * Article heading (from H1-H6 tags)
67
+ */
68
+ interface ArticleHeading {
69
+ level: number;
70
+ text: string;
71
+ id: string;
72
+ }
73
+ /**
74
+ * FAQ item
75
+ */
76
+ interface FaqItem {
77
+ question: string;
78
+ answer: string;
79
+ }
80
+ /**
81
+ * Internal link reference
82
+ */
83
+ interface InternalLink {
84
+ slug: string;
85
+ anchor_text: string;
86
+ }
87
+ /**
88
+ * Category with clusters
89
+ */
90
+ interface Category {
91
+ id: string;
92
+ name: string;
93
+ description: string | null;
94
+ article_count: number;
95
+ clusters: ClusterInfo[];
96
+ }
97
+ /**
98
+ * Cluster information
99
+ */
100
+ interface ClusterInfo {
101
+ id: string;
102
+ name: string;
103
+ description: string | null;
104
+ article_count: number;
105
+ }
106
+ /**
107
+ * Paginated response
108
+ */
109
+ interface PaginatedResponse<T> {
110
+ items: T[];
111
+ total: number;
112
+ page: number;
113
+ per_page: number;
114
+ total_pages: number;
115
+ }
116
+ /**
117
+ * Filters for article list queries
118
+ */
119
+ interface ArticleFilters {
120
+ page?: number;
121
+ per_page?: number;
122
+ pillar?: string;
123
+ cluster?: string;
124
+ content_type?: string;
125
+ search?: string;
126
+ }
127
+ /**
128
+ * Sitemap entry
129
+ */
130
+ interface SitemapEntry {
131
+ slug: string;
132
+ title: string;
133
+ published_at: string;
134
+ updated_at: string;
135
+ }
136
+ /**
137
+ * Hook state for async data fetching
138
+ */
139
+ interface UseArticlesState {
140
+ articles: ArticleListItem[];
141
+ loading: boolean;
142
+ error: Error | null;
143
+ pagination: {
144
+ page: number;
145
+ per_page: number;
146
+ total: number;
147
+ total_pages: number;
148
+ };
149
+ }
150
+ /**
151
+ * Hook state for single article
152
+ */
153
+ interface UseArticleState {
154
+ article: Article | null;
155
+ loading: boolean;
156
+ error: Error | null;
157
+ }
158
+ /**
159
+ * Hook state for article list (related articles, etc.)
160
+ */
161
+ interface UseArticleListState {
162
+ articles: ArticleListItem[];
163
+ loading: boolean;
164
+ error: Error | null;
165
+ }
166
+ /**
167
+ * Hook state for categories
168
+ */
169
+ interface UseCategoriesState {
170
+ categories: Category[];
171
+ loading: boolean;
172
+ error: Error | null;
173
+ }
174
+
175
+ /**
176
+ * ContentClient — HTTP client for DSA Content Engine Public API.
177
+ * Works in both Node.js (SSR) and browser environments.
178
+ */
179
+ declare class ContentClient {
180
+ private apiUrl;
181
+ private apiKey;
182
+ private cacheStrategy;
183
+ private revalidateSeconds?;
184
+ constructor(config: DsaContentConfig);
185
+ private request;
186
+ /** Get paginated list of published articles */
187
+ getArticles(filters?: ArticleFilters): Promise<PaginatedResponse<ArticleListItem>>;
188
+ /** Get a single article by slug */
189
+ getArticleBySlug(slug: string): Promise<Article>;
190
+ /** Get related articles for a given slug */
191
+ getRelatedArticles(slug: string, limit?: number): Promise<ArticleListItem[]>;
192
+ /** Get all categories (pillars + clusters) with article counts */
193
+ getCategories(): Promise<Category[]>;
194
+ /** Get sitemap data for all published articles */
195
+ getSitemap(): Promise<SitemapEntry[]>;
196
+ }
197
+
198
+ interface DsaContentProviderProps {
199
+ config: DsaContentConfig;
200
+ children: React.ReactNode;
201
+ }
202
+ /**
203
+ * Wrap your app (or a subtree) with DsaContentProvider to enable
204
+ * the useDsaContent() hook and all data-fetching hooks.
205
+ *
206
+ * ```tsx
207
+ * <DsaContentProvider config={{ apiUrl: "...", apiKey: "..." }}>
208
+ * <App />
209
+ * </DsaContentProvider>
210
+ * ```
211
+ */
212
+ declare function DsaContentProvider({ config, children }: DsaContentProviderProps): react_jsx_runtime.JSX.Element;
213
+ /**
214
+ * Access the ContentClient instance from context.
215
+ * Must be called inside a DsaContentProvider.
216
+ */
217
+ declare function useDsaContent(): ContentClient;
218
+
219
+ /**
220
+ * Fetch a paginated list of published articles.
221
+ *
222
+ * ```tsx
223
+ * const { articles, loading, error, pagination } = useArticles({ page: 1, per_page: 10 });
224
+ * ```
225
+ */
226
+ declare function useArticles(filters?: ArticleFilters): UseArticlesState & {
227
+ refetch: () => void;
228
+ };
229
+ /**
230
+ * Fetch a single article by slug.
231
+ *
232
+ * ```tsx
233
+ * const { article, loading, error } = useArticle("my-article-slug");
234
+ * ```
235
+ */
236
+ declare function useArticle(slug: string | undefined): UseArticleState & {
237
+ refetch: () => void;
238
+ };
239
+ /**
240
+ * Fetch related articles for a given slug.
241
+ *
242
+ * ```tsx
243
+ * const { articles, loading } = useRelatedArticles("my-article-slug", 4);
244
+ * ```
245
+ */
246
+ declare function useRelatedArticles(slug: string | undefined, limit?: number): UseArticleListState & {
247
+ refetch: () => void;
248
+ };
249
+ /**
250
+ * Fetch all categories (pillars + clusters).
251
+ *
252
+ * ```tsx
253
+ * const { categories, loading } = useCategories();
254
+ * ```
255
+ */
256
+ declare function useCategories(): UseCategoriesState & {
257
+ refetch: () => void;
258
+ };
259
+
260
+ interface ArticleFeedProps {
261
+ articles: ArticleListItem[];
262
+ layout?: 'grid' | 'list';
263
+ columns?: 1 | 2 | 3;
264
+ showExcerpt?: boolean;
265
+ showImage?: boolean;
266
+ showMeta?: boolean;
267
+ onArticleClick?: (slug: string) => void;
268
+ className?: string;
269
+ renderArticle?: (article: ArticleListItem) => React.ReactNode;
270
+ }
271
+ /**
272
+ * Renders a grid or list of article cards.
273
+ *
274
+ * ```tsx
275
+ * <ArticleFeed articles={articles} layout="grid" columns={3} onArticleClick={(slug) => router.push(`/blog/${slug}`)} />
276
+ * ```
277
+ */
278
+ declare function ArticleFeed({ articles, layout, columns, showExcerpt, showImage, showMeta, onArticleClick, className, renderArticle, }: ArticleFeedProps): react_jsx_runtime.JSX.Element;
279
+
280
+ interface ArticlePageProps {
281
+ article: Article;
282
+ showFaq?: boolean;
283
+ showTableOfContents?: boolean;
284
+ showMeta?: boolean;
285
+ showRelated?: boolean;
286
+ relatedArticles?: ArticleListItem[];
287
+ onRelatedClick?: (slug: string) => void;
288
+ className?: string;
289
+ components?: {
290
+ H1?: React.ComponentType<{
291
+ children: React.ReactNode;
292
+ }>;
293
+ Toc?: React.ComponentType<{
294
+ headings: Article['headings'];
295
+ }>;
296
+ Faq?: React.ComponentType<{
297
+ items: FaqItem[];
298
+ }>;
299
+ };
300
+ }
301
+ /**
302
+ * Renders a full article page with optional TOC, FAQ, and related articles.
303
+ *
304
+ * ```tsx
305
+ * <ArticlePage article={article} showTableOfContents showFaq />
306
+ * ```
307
+ */
308
+ declare function ArticlePage({ article, showFaq, showTableOfContents, showMeta, showRelated, relatedArticles, onRelatedClick, className, components, }: ArticlePageProps): react_jsx_runtime.JSX.Element;
309
+
310
+ interface FaqBlockProps {
311
+ items: FaqItem[];
312
+ collapsible?: boolean;
313
+ defaultOpen?: boolean;
314
+ className?: string;
315
+ title?: string;
316
+ }
317
+ /**
318
+ * FAQ block with optional collapse behavior and Schema.org FAQPage markup.
319
+ *
320
+ * ```tsx
321
+ * <FaqBlock items={article.faq} collapsible />
322
+ * ```
323
+ */
324
+ declare function FaqBlock({ items, collapsible, defaultOpen, className, title, }: FaqBlockProps): react_jsx_runtime.JSX.Element | null;
325
+
326
+ interface RelatedArticlesProps {
327
+ articles: ArticleListItem[];
328
+ title?: string;
329
+ limit?: number;
330
+ onArticleClick?: (slug: string) => void;
331
+ className?: string;
332
+ }
333
+ /**
334
+ * Related articles widget.
335
+ *
336
+ * ```tsx
337
+ * <RelatedArticles articles={related} onArticleClick={(slug) => router.push(`/blog/${slug}`)} />
338
+ * ```
339
+ */
340
+ declare function RelatedArticles({ articles, title, limit, onArticleClick, className, }: RelatedArticlesProps): react_jsx_runtime.JSX.Element | null;
341
+
342
+ /**
343
+ * Generate Next.js App Router Metadata object from an Article.
344
+ * Use in page.tsx generateMetadata():
345
+ *
346
+ * ```ts
347
+ * import { generateArticleMetadata } from "@dsa/content-sdk/server";
348
+ *
349
+ * export async function generateMetadata({ params }) {
350
+ * const article = await fetchArticleBySlug(config, params.slug);
351
+ * return generateArticleMetadata(article, "https://example.com");
352
+ * }
353
+ * ```
354
+ */
355
+ declare function generateArticleMetadata(article: Article, siteUrl?: string): Record<string, any>;
356
+ /**
357
+ * Renders JSON-LD structured data for an article.
358
+ * Include this component in your article page layout for SEO.
359
+ *
360
+ * ```tsx
361
+ * <SeoMetaBridge article={article} siteUrl="https://example.com" />
362
+ * ```
363
+ */
364
+ declare function SeoMetaBridge({ article, siteUrl, }: {
365
+ article: Article;
366
+ siteUrl?: string;
367
+ }): react_jsx_runtime.JSX.Element;
368
+
369
+ export { type Article, ArticleFeed, type ArticleFeedProps, type ArticleFilters, type ArticleHeading, type ArticleListItem, ArticlePage, type ArticlePageProps, type Category, type ClusterInfo, ContentClient, type DsaContentConfig, DsaContentProvider, type DsaContentProviderProps, FaqBlock, type FaqBlockProps, type FaqItem, type InternalLink, type PaginatedResponse, RelatedArticles, type RelatedArticlesProps, SeoMetaBridge, type SitemapEntry, type UseArticleListState, type UseArticleState, type UseArticlesState, type UseCategoriesState, generateArticleMetadata, useArticle, useArticles, useCategories, useDsaContent, useRelatedArticles };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ "use strict";var W=Object.create;var R=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var J=(e,t)=>{for(var r in t)R(e,r,{get:t[r],enumerable:!0})},q=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of K(t))!G.call(e,a)&&a!==r&&R(e,a,{get:()=>t[a],enumerable:!(i=O(t,a))||i.enumerable});return e};var Q=(e,t,r)=>(r=e!=null?W(j(e)):{},q(t||!e||!e.__esModule?R(r,"default",{value:e,enumerable:!0}):r,e)),X=e=>q(R({},"__esModule",{value:!0}),e);var ee={};J(ee,{ArticleFeed:()=>w,ArticlePage:()=>k,ContentClient:()=>C,DsaContentProvider:()=>T,FaqBlock:()=>x,RelatedArticles:()=>P,SeoMetaBridge:()=>I,generateArticleMetadata:()=>F,useArticle:()=>U,useArticles:()=>E,useCategories:()=>B,useDsaContent:()=>b,useRelatedArticles:()=>z});module.exports=X(ee);var C=class{constructor(t){this.apiUrl=t.apiUrl.replace(/\/+$/,""),this.apiKey=t.apiKey,this.cacheStrategy=t.cacheStrategy==="revalidate"?"default":t.cacheStrategy==="force-cache"?"force-cache":"no-cache",this.revalidateSeconds=t.revalidateSeconds}async request(t,r){let i=new URL(`${this.apiUrl}${t}`);r&&Object.entries(r).forEach(([n,p])=>{p!=null&&p!==""&&i.searchParams.set(n,String(p))}),i.searchParams.set("site_key",this.apiKey);let a={method:"GET",headers:{"X-API-Key":this.apiKey},cache:this.cacheStrategy};this.revalidateSeconds&&this.cacheStrategy!=="no-cache"&&(a.next={revalidate:this.revalidateSeconds});let o=await fetch(i.toString(),a);if(!o.ok){let n=await o.text().catch(()=>"");throw new Error(`DSA Content API error ${o.status}: ${n||o.statusText}`)}return o.json()}async getArticles(t){return this.request("/api/public/articles",{page:t?.page,per_page:t?.per_page,pillar:t?.pillar,cluster:t?.cluster,content_type:t?.content_type,search:t?.search})}async getArticleBySlug(t){return this.request(`/api/public/articles/${encodeURIComponent(t)}`)}async getRelatedArticles(t,r=3){return this.request(`/api/public/articles/${encodeURIComponent(t)}/related`,{limit:r})}async getCategories(){return this.request("/api/public/categories")}async getSitemap(){return this.request("/api/public/sitemap")}};var _=require("react");var D=require("react/jsx-runtime"),L=(0,_.createContext)(null);function T({config:e,children:t}){let r=(0,_.useMemo)(()=>new C(e),[e.apiUrl,e.apiKey]);return(0,D.jsx)(L.Provider,{value:r,children:t})}function b(){let e=(0,_.useContext)(L);if(!e)throw new Error("useDsaContent() must be used inside <DsaContentProvider>");return e}var l=require("react");function E(e){let t=b(),[r,i]=(0,l.useState)({articles:[],loading:!0,error:null,pagination:{page:1,per_page:10,total:0,total_pages:0}}),a=(0,l.useCallback)(()=>{i(o=>({...o,loading:!0,error:null})),t.getArticles(e).then(o=>i({articles:o.items,loading:!1,error:null,pagination:{page:o.page,per_page:o.per_page,total:o.total,total_pages:o.total_pages}})).catch(o=>i(n=>({...n,loading:!1,error:o instanceof Error?o:new Error(String(o))})))},[t,e?.page,e?.per_page,e?.pillar,e?.cluster,e?.content_type,e?.search]);return(0,l.useEffect)(()=>{a()},[a]),{...r,refetch:a}}function U(e){let t=b(),[r,i]=(0,l.useState)({article:null,loading:!0,error:null}),a=(0,l.useCallback)(()=>{if(!e){i({article:null,loading:!1,error:null});return}i(o=>({...o,loading:!0,error:null})),t.getArticleBySlug(e).then(o=>i({article:o,loading:!1,error:null})).catch(o=>i({article:null,loading:!1,error:o instanceof Error?o:new Error(String(o))}))},[t,e]);return(0,l.useEffect)(()=>{a()},[a]),{...r,refetch:a}}function z(e,t=3){let r=b(),[i,a]=(0,l.useState)({articles:[],loading:!0,error:null}),o=(0,l.useCallback)(()=>{if(!e){a({articles:[],loading:!1,error:null});return}a(n=>({...n,loading:!0,error:null})),r.getRelatedArticles(e,t).then(n=>a({articles:n,loading:!1,error:null})).catch(n=>a({articles:[],loading:!1,error:n instanceof Error?n:new Error(String(n))}))},[r,e,t]);return(0,l.useEffect)(()=>{o()},[o]),{...i,refetch:o}}function B(){let e=b(),[t,r]=(0,l.useState)({categories:[],loading:!0,error:null}),i=(0,l.useCallback)(()=>{r(a=>({...a,loading:!0,error:null})),e.getCategories().then(a=>r({categories:a,loading:!1,error:null})).catch(a=>r({categories:[],loading:!1,error:a instanceof Error?a:new Error(String(a))}))},[e]);return(0,l.useEffect)(()=>{i()},[i]),{...t,refetch:i}}var v=Q(require("react")),c=require("react/jsx-runtime"),g={grid:{display:"grid",gap:"1.5rem"},card:{border:"1px solid #e5e7eb",borderRadius:"0.75rem",overflow:"hidden",background:"#fff",cursor:"pointer",transition:"box-shadow 0.2s"},cardHover:{boxShadow:"0 4px 12px rgba(0,0,0,0.08)"},image:{width:"100%",height:"200px",objectFit:"cover",display:"block"},body:{padding:"1.25rem"},title:{margin:"0 0 0.5rem",fontSize:"1.125rem",fontWeight:600,lineHeight:1.3,color:"#111827"},excerpt:{margin:"0 0 0.75rem",fontSize:"0.875rem",color:"#6b7280",lineHeight:1.5},meta:{display:"flex",gap:"0.75rem",fontSize:"0.75rem",color:"#9ca3af",flexWrap:"wrap"},badge:{display:"inline-block",padding:"0.125rem 0.5rem",borderRadius:"9999px",background:"#f3f4f6",fontSize:"0.75rem",color:"#4b5563"},listCard:{display:"flex",border:"1px solid #e5e7eb",borderRadius:"0.75rem",overflow:"hidden",background:"#fff",cursor:"pointer",transition:"box-shadow 0.2s"},listImage:{width:"240px",minHeight:"160px",objectFit:"cover",flexShrink:0},listBody:{padding:"1.25rem",flex:1}};function V({article:e,layout:t,showExcerpt:r,showImage:i,showMeta:a,onClick:o}){let n=t==="grid",[p,f]=v.default.useState(!1);return(0,c.jsxs)("article",{style:{...n?g.card:g.listCard,...p?g.cardHover:{}},onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),onClick:o,role:"link",tabIndex:0,onKeyDown:A=>A.key==="Enter"&&o?.(),children:[i&&e.featured_image_url&&(0,c.jsx)("img",{src:e.featured_image_url,alt:e.featured_image_alt||e.title,style:n?g.image:g.listImage,loading:"lazy"}),(0,c.jsxs)("div",{style:n?g.body:g.listBody,children:[(0,c.jsx)("h3",{style:g.title,children:e.title}),r&&e.excerpt&&(0,c.jsx)("p",{style:g.excerpt,children:e.excerpt}),a&&(0,c.jsxs)("div",{style:g.meta,children:[e.pillar_name&&(0,c.jsx)("span",{style:g.badge,children:e.pillar_name}),e.content_type&&(0,c.jsx)("span",{style:g.badge,children:e.content_type.replace(/_/g," ")}),e.reading_time_minutes&&(0,c.jsxs)("span",{children:[e.reading_time_minutes," min read"]}),e.published_at&&(0,c.jsx)("span",{children:new Date(e.published_at).toLocaleDateString()})]})]})]})}function w({articles:e,layout:t="grid",columns:r=3,showExcerpt:i=!0,showImage:a=!0,showMeta:o=!0,onArticleClick:n,className:p,renderArticle:f}){let A=t==="grid"?`repeat(${r}, 1fr)`:"1fr";return(0,c.jsx)("div",{className:p,style:{...g.grid,gridTemplateColumns:A},children:e.map(S=>f?(0,c.jsx)(v.default.Fragment,{children:f(S)},S.id):(0,c.jsx)(V,{article:S,layout:t,showExcerpt:i,showImage:a,showMeta:o,onClick:()=>n?.(S.slug)},S.id))})}var H=require("react"),d=require("react/jsx-runtime"),y={wrapper:{marginTop:"1rem"},title:{fontSize:"1.5rem",fontWeight:700,color:"#111827",margin:"0 0 1rem"},item:{borderBottom:"1px solid #e5e7eb",padding:"0.75rem 0"},question:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",background:"none",border:"none",width:"100%",textAlign:"left",padding:"0.5rem 0",fontSize:"1rem",fontWeight:600,color:"#1f2937",fontFamily:"inherit"},questionStatic:{fontSize:"1rem",fontWeight:600,color:"#1f2937",margin:"0 0 0.5rem"},chevron:{flexShrink:0,marginLeft:"1rem",transition:"transform 0.2s",fontSize:"1.25rem",color:"#9ca3af"},answer:{fontSize:"0.9375rem",color:"#4b5563",lineHeight:1.6,paddingTop:"0.5rem"}};function Y({item:e,collapsible:t,defaultOpen:r}){let[i,a]=(0,H.useState)(r);return t?(0,d.jsxs)("div",{style:y.item,children:[(0,d.jsxs)("button",{style:y.question,onClick:()=>a(!i),"aria-expanded":i,children:[(0,d.jsx)("span",{children:e.question}),(0,d.jsx)("span",{style:{...y.chevron,transform:i?"rotate(180deg)":"rotate(0deg)"},children:"\u25BC"})]}),i&&(0,d.jsx)("div",{style:y.answer,children:e.answer})]}):(0,d.jsxs)("div",{style:y.item,children:[(0,d.jsx)("p",{style:y.questionStatic,children:e.question}),(0,d.jsx)("div",{style:y.answer,children:e.answer})]})}function x({items:e,collapsible:t=!0,defaultOpen:r=!1,className:i,title:a="Frequently Asked Questions"}){if(!e||e.length===0)return null;let o={"@context":"https://schema.org","@type":"FAQPage",mainEntity:e.map(n=>({"@type":"Question",name:n.question,acceptedAnswer:{"@type":"Answer",text:n.answer}}))};return(0,d.jsxs)("section",{className:i,style:y.wrapper,children:[(0,d.jsx)("h2",{style:y.title,children:a}),e.map((n,p)=>(0,d.jsx)(Y,{item:n,collapsible:t,defaultOpen:r},p)),(0,d.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(o)}})]})}var u=require("react/jsx-runtime"),h={wrapper:{marginTop:"1rem"},title:{fontSize:"1.25rem",fontWeight:700,color:"#111827",margin:"0 0 1rem"},grid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(250px, 1fr))",gap:"1rem"},card:{border:"1px solid #e5e7eb",borderRadius:"0.5rem",overflow:"hidden",cursor:"pointer",transition:"box-shadow 0.2s",background:"#fff"},image:{width:"100%",height:"140px",objectFit:"cover",display:"block"},body:{padding:"1rem"},cardTitle:{fontSize:"0.9375rem",fontWeight:600,color:"#111827",margin:0,lineHeight:1.3},excerpt:{fontSize:"0.8125rem",color:"#6b7280",marginTop:"0.5rem",lineHeight:1.4}};function P({articles:e,title:t="Related Articles",limit:r=3,onArticleClick:i,className:a}){let o=e.slice(0,r);return o.length===0?null:(0,u.jsxs)("section",{className:a,style:h.wrapper,children:[(0,u.jsx)("h3",{style:h.title,children:t}),(0,u.jsx)("div",{style:h.grid,children:o.map(n=>(0,u.jsxs)("div",{style:h.card,onClick:()=>i?.(n.slug),role:"link",tabIndex:0,onKeyDown:p=>p.key==="Enter"&&i?.(n.slug),children:[n.featured_image_url&&(0,u.jsx)("img",{src:n.featured_image_url,alt:n.featured_image_alt||n.title,style:h.image,loading:"lazy"}),(0,u.jsxs)("div",{style:h.body,children:[(0,u.jsx)("h4",{style:h.cardTitle,children:n.title}),n.excerpt&&(0,u.jsx)("p",{style:h.excerpt,children:n.excerpt})]})]},n.id))})]})}var s=require("react/jsx-runtime"),m={wrapper:{maxWidth:"48rem",margin:"0 auto",fontFamily:"system-ui, -apple-system, sans-serif"},meta:{display:"flex",gap:"1rem",flexWrap:"wrap",fontSize:"0.875rem",color:"#6b7280",marginBottom:"1.5rem"},badge:{display:"inline-block",padding:"0.125rem 0.5rem",borderRadius:"9999px",background:"#eff6ff",color:"#2563eb",fontSize:"0.75rem"},h1:{fontSize:"2.25rem",fontWeight:700,lineHeight:1.2,color:"#111827",margin:"0 0 1rem"},image:{width:"100%",borderRadius:"0.75rem",marginBottom:"2rem"},toc:{background:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:"0.75rem",padding:"1.25rem",marginBottom:"2rem"},tocTitle:{fontSize:"0.875rem",fontWeight:600,color:"#374151",margin:"0 0 0.75rem",textTransform:"uppercase",letterSpacing:"0.05em"},tocList:{listStyle:"none",padding:0,margin:0},tocItem:{padding:"0.25rem 0"},tocLink:{color:"#4b5563",textDecoration:"none",fontSize:"0.875rem"},content:{lineHeight:1.75,color:"#374151",fontSize:"1.0625rem"},divider:{border:"none",borderTop:"1px solid #e5e7eb",margin:"2.5rem 0"}};function Z({headings:e}){return!e||e.length===0?null:(0,s.jsxs)("nav",{style:m.toc,children:[(0,s.jsx)("p",{style:m.tocTitle,children:"Table of Contents"}),(0,s.jsx)("ul",{style:m.tocList,children:e.map((t,r)=>(0,s.jsx)("li",{style:{...m.tocItem,paddingLeft:`${(t.level-2)*1}rem`},children:(0,s.jsx)("a",{href:`#${t.id}`,style:m.tocLink,children:t.text})},r))})]})}function k({article:e,showFaq:t=!0,showTableOfContents:r=!0,showMeta:i=!0,showRelated:a=!1,relatedArticles:o,onRelatedClick:n,className:p,components:f}){let A=f?.H1||(({children:N})=>(0,s.jsx)("h1",{style:m.h1,children:N})),S=f?.Toc||Z,$=f?.Faq||x;return(0,s.jsxs)("article",{className:p,style:m.wrapper,children:[i&&(0,s.jsxs)("div",{style:m.meta,children:[e.pillar_name&&(0,s.jsx)("span",{style:m.badge,children:e.pillar_name}),e.content_type&&(0,s.jsx)("span",{style:{...m.badge,background:"#f0fdf4",color:"#16a34a"},children:e.content_type.replace(/_/g," ")}),e.reading_time_minutes&&(0,s.jsxs)("span",{children:[e.reading_time_minutes," min read"]}),e.published_at&&(0,s.jsx)("span",{children:new Date(e.published_at).toLocaleDateString()})]}),(0,s.jsx)(A,{children:e.h1||e.title}),e.featured_image_url&&(0,s.jsx)("img",{src:e.featured_image_url,alt:e.featured_image_alt||e.title,style:m.image}),r&&e.headings?.length>0&&(0,s.jsx)(S,{headings:e.headings}),(0,s.jsx)("div",{style:m.content,dangerouslySetInnerHTML:{__html:e.content_html}}),t&&e.faq?.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("hr",{style:m.divider}),(0,s.jsx)($,{items:e.faq})]}),e.schema_json&&(0,s.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e.schema_json)}}),a&&o&&o.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("hr",{style:m.divider}),(0,s.jsx)(P,{articles:o,onArticleClick:n})]})]})}var M=require("react/jsx-runtime");function F(e,t){let r=t?`${t.replace(/\/+$/,"")}/blog/${e.slug}`:void 0;return{title:e.meta_title||e.title,description:e.meta_description||e.excerpt||"",openGraph:{title:e.meta_title||e.title,description:e.meta_description||e.excerpt||"",type:"article",publishedTime:e.published_at||void 0,modifiedTime:e.updated_at||void 0,...r?{url:r}:{},...e.featured_image_url?{images:[{url:e.featured_image_url,alt:e.featured_image_alt||e.title}]}:{}},twitter:{card:"summary_large_image",title:e.meta_title||e.title,description:e.meta_description||e.excerpt||"",...e.featured_image_url?{images:[e.featured_image_url]}:{}},...e.canonical_url?{alternates:{canonical:e.canonical_url}}:r?{alternates:{canonical:r}}:{}}}function I({article:e,siteUrl:t}){let r=e.schema_json||{"@context":"https://schema.org","@type":"Article",headline:e.meta_title||e.title,description:e.meta_description||e.excerpt||"",datePublished:e.published_at||void 0,dateModified:e.updated_at||e.published_at||void 0,...e.featured_image_url?{image:e.featured_image_url}:{},...t?{url:`${t.replace(/\/+$/,"")}/blog/${e.slug}`}:{},...e.target_keyword?{keywords:[e.target_keyword,...e.secondary_keywords||[]].join(", ")}:{}};return(0,M.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(r)}})}0&&(module.exports={ArticleFeed,ArticlePage,ContentClient,DsaContentProvider,FaqBlock,RelatedArticles,SeoMetaBridge,generateArticleMetadata,useArticle,useArticles,useCategories,useDsaContent,useRelatedArticles});
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/client.ts","../src/provider.tsx","../src/hooks.ts","../src/components/ArticleFeed.tsx","../src/components/FaqBlock.tsx","../src/components/RelatedArticles.tsx","../src/components/ArticlePage.tsx","../src/components/SeoMetaBridge.tsx"],"sourcesContent":["// Types\nexport type {\n DsaContentConfig,\n Article,\n ArticleListItem,\n ArticleHeading,\n FaqItem,\n InternalLink,\n Category,\n ClusterInfo,\n PaginatedResponse,\n ArticleFilters,\n SitemapEntry,\n UseArticlesState,\n UseArticleState,\n UseArticleListState,\n UseCategoriesState,\n} from './types';\n\n// Client\nexport { ContentClient } from './client';\n\n// Provider + context hook\nexport { DsaContentProvider, useDsaContent } from './provider';\nexport type { DsaContentProviderProps } from './provider';\n\n// Data-fetching hooks\nexport { useArticles, useArticle, useRelatedArticles, useCategories } from './hooks';\n\n// UI Components\nexport {\n ArticleFeed,\n ArticlePage,\n FaqBlock,\n RelatedArticles,\n SeoMetaBridge,\n generateArticleMetadata,\n} from './components';\n\nexport type {\n ArticleFeedProps,\n ArticlePageProps,\n FaqBlockProps,\n RelatedArticlesProps,\n} from './components';\n","import type {\n DsaContentConfig,\n Article,\n ArticleListItem,\n ArticleFilters,\n PaginatedResponse,\n Category,\n SitemapEntry,\n} from './types';\n\n/**\n * ContentClient — HTTP client for DSA Content Engine Public API.\n * Works in both Node.js (SSR) and browser environments.\n */\nexport class ContentClient {\n private apiUrl: string;\n private apiKey: string;\n private cacheStrategy: RequestCache;\n private revalidateSeconds?: number;\n\n constructor(config: DsaContentConfig) {\n this.apiUrl = config.apiUrl.replace(/\\/+$/, '');\n this.apiKey = config.apiKey;\n this.cacheStrategy =\n config.cacheStrategy === 'revalidate'\n ? 'default'\n : config.cacheStrategy === 'force-cache'\n ? 'force-cache'\n : 'no-cache';\n this.revalidateSeconds = config.revalidateSeconds;\n }\n\n private async request<T>(path: string, params?: Record<string, string | number | undefined>): Promise<T> {\n const url = new URL(`${this.apiUrl}${path}`);\n if (params) {\n Object.entries(params).forEach(([k, v]) => {\n if (v !== undefined && v !== null && v !== '') {\n url.searchParams.set(k, String(v));\n }\n });\n }\n url.searchParams.set('site_key', this.apiKey);\n\n const fetchOptions: RequestInit & { next?: { revalidate?: number } } = {\n method: 'GET',\n headers: { 'X-API-Key': this.apiKey },\n cache: this.cacheStrategy,\n };\n\n // Next.js ISR revalidation\n if (this.revalidateSeconds && this.cacheStrategy !== 'no-cache') {\n fetchOptions.next = { revalidate: this.revalidateSeconds };\n }\n\n const res = await fetch(url.toString(), fetchOptions);\n\n if (!res.ok) {\n const text = await res.text().catch(() => '');\n throw new Error(`DSA Content API error ${res.status}: ${text || res.statusText}`);\n }\n\n return res.json() as Promise<T>;\n }\n\n /** Get paginated list of published articles */\n async getArticles(filters?: ArticleFilters): Promise<PaginatedResponse<ArticleListItem>> {\n return this.request<PaginatedResponse<ArticleListItem>>('/api/public/articles', {\n page: filters?.page,\n per_page: filters?.per_page,\n pillar: filters?.pillar,\n cluster: filters?.cluster,\n content_type: filters?.content_type,\n search: filters?.search,\n });\n }\n\n /** Get a single article by slug */\n async getArticleBySlug(slug: string): Promise<Article> {\n return this.request<Article>(`/api/public/articles/${encodeURIComponent(slug)}`);\n }\n\n /** Get related articles for a given slug */\n async getRelatedArticles(slug: string, limit = 3): Promise<ArticleListItem[]> {\n return this.request<ArticleListItem[]>(\n `/api/public/articles/${encodeURIComponent(slug)}/related`,\n { limit },\n );\n }\n\n /** Get all categories (pillars + clusters) with article counts */\n async getCategories(): Promise<Category[]> {\n return this.request<Category[]>('/api/public/categories');\n }\n\n /** Get sitemap data for all published articles */\n async getSitemap(): Promise<SitemapEntry[]> {\n return this.request<SitemapEntry[]>('/api/public/sitemap');\n }\n}\n","'use client';\n\nimport React, { createContext, useContext, useMemo } from 'react';\nimport { ContentClient } from './client';\nimport type { DsaContentConfig } from './types';\n\nconst ContentContext = createContext<ContentClient | null>(null);\n\nexport interface DsaContentProviderProps {\n config: DsaContentConfig;\n children: React.ReactNode;\n}\n\n/**\n * Wrap your app (or a subtree) with DsaContentProvider to enable\n * the useDsaContent() hook and all data-fetching hooks.\n *\n * ```tsx\n * <DsaContentProvider config={{ apiUrl: \"...\", apiKey: \"...\" }}>\n * <App />\n * </DsaContentProvider>\n * ```\n */\nexport function DsaContentProvider({ config, children }: DsaContentProviderProps) {\n const client = useMemo(() => new ContentClient(config), [config.apiUrl, config.apiKey]);\n return <ContentContext.Provider value={client}>{children}</ContentContext.Provider>;\n}\n\n/**\n * Access the ContentClient instance from context.\n * Must be called inside a DsaContentProvider.\n */\nexport function useDsaContent(): ContentClient {\n const client = useContext(ContentContext);\n if (!client) {\n throw new Error('useDsaContent() must be used inside <DsaContentProvider>');\n }\n return client;\n}\n","'use client';\n\nimport { useState, useEffect, useCallback } from 'react';\nimport { useDsaContent } from './provider';\nimport type {\n ArticleFilters,\n UseArticlesState,\n UseArticleState,\n UseArticleListState,\n UseCategoriesState,\n} from './types';\n\n/**\n * Fetch a paginated list of published articles.\n *\n * ```tsx\n * const { articles, loading, error, pagination } = useArticles({ page: 1, per_page: 10 });\n * ```\n */\nexport function useArticles(filters?: ArticleFilters): UseArticlesState & { refetch: () => void } {\n const client = useDsaContent();\n const [state, setState] = useState<UseArticlesState>({\n articles: [],\n loading: true,\n error: null,\n pagination: { page: 1, per_page: 10, total: 0, total_pages: 0 },\n });\n\n const fetch = useCallback(() => {\n setState((s) => ({ ...s, loading: true, error: null }));\n client\n .getArticles(filters)\n .then((res) =>\n setState({\n articles: res.items,\n loading: false,\n error: null,\n pagination: {\n page: res.page,\n per_page: res.per_page,\n total: res.total,\n total_pages: res.total_pages,\n },\n }),\n )\n .catch((err) =>\n setState((s) => ({ ...s, loading: false, error: err instanceof Error ? err : new Error(String(err)) })),\n );\n }, [client, filters?.page, filters?.per_page, filters?.pillar, filters?.cluster, filters?.content_type, filters?.search]);\n\n useEffect(() => { fetch(); }, [fetch]);\n\n return { ...state, refetch: fetch };\n}\n\n/**\n * Fetch a single article by slug.\n *\n * ```tsx\n * const { article, loading, error } = useArticle(\"my-article-slug\");\n * ```\n */\nexport function useArticle(slug: string | undefined): UseArticleState & { refetch: () => void } {\n const client = useDsaContent();\n const [state, setState] = useState<UseArticleState>({ article: null, loading: true, error: null });\n\n const fetch = useCallback(() => {\n if (!slug) {\n setState({ article: null, loading: false, error: null });\n return;\n }\n setState((s) => ({ ...s, loading: true, error: null }));\n client\n .getArticleBySlug(slug)\n .then((article) => setState({ article, loading: false, error: null }))\n .catch((err) =>\n setState({ article: null, loading: false, error: err instanceof Error ? err : new Error(String(err)) }),\n );\n }, [client, slug]);\n\n useEffect(() => { fetch(); }, [fetch]);\n\n return { ...state, refetch: fetch };\n}\n\n/**\n * Fetch related articles for a given slug.\n *\n * ```tsx\n * const { articles, loading } = useRelatedArticles(\"my-article-slug\", 4);\n * ```\n */\nexport function useRelatedArticles(slug: string | undefined, limit = 3): UseArticleListState & { refetch: () => void } {\n const client = useDsaContent();\n const [state, setState] = useState<UseArticleListState>({ articles: [], loading: true, error: null });\n\n const fetch = useCallback(() => {\n if (!slug) {\n setState({ articles: [], loading: false, error: null });\n return;\n }\n setState((s) => ({ ...s, loading: true, error: null }));\n client\n .getRelatedArticles(slug, limit)\n .then((articles) => setState({ articles, loading: false, error: null }))\n .catch((err) =>\n setState({ articles: [], loading: false, error: err instanceof Error ? err : new Error(String(err)) }),\n );\n }, [client, slug, limit]);\n\n useEffect(() => { fetch(); }, [fetch]);\n\n return { ...state, refetch: fetch };\n}\n\n/**\n * Fetch all categories (pillars + clusters).\n *\n * ```tsx\n * const { categories, loading } = useCategories();\n * ```\n */\nexport function useCategories(): UseCategoriesState & { refetch: () => void } {\n const client = useDsaContent();\n const [state, setState] = useState<UseCategoriesState>({ categories: [], loading: true, error: null });\n\n const fetch = useCallback(() => {\n setState((s) => ({ ...s, loading: true, error: null }));\n client\n .getCategories()\n .then((categories) => setState({ categories, loading: false, error: null }))\n .catch((err) =>\n setState({ categories: [], loading: false, error: err instanceof Error ? err : new Error(String(err)) }),\n );\n }, [client]);\n\n useEffect(() => { fetch(); }, [fetch]);\n\n return { ...state, refetch: fetch };\n}\n","'use client';\n\nimport React from 'react';\nimport type { ArticleListItem } from '../types';\n\nexport interface ArticleFeedProps {\n articles: ArticleListItem[];\n layout?: 'grid' | 'list';\n columns?: 1 | 2 | 3;\n showExcerpt?: boolean;\n showImage?: boolean;\n showMeta?: boolean;\n onArticleClick?: (slug: string) => void;\n className?: string;\n renderArticle?: (article: ArticleListItem) => React.ReactNode;\n}\n\nconst baseStyles = {\n grid: { display: 'grid', gap: '1.5rem' } as React.CSSProperties,\n card: {\n border: '1px solid #e5e7eb',\n borderRadius: '0.75rem',\n overflow: 'hidden',\n background: '#fff',\n cursor: 'pointer',\n transition: 'box-shadow 0.2s',\n } as React.CSSProperties,\n cardHover: { boxShadow: '0 4px 12px rgba(0,0,0,0.08)' },\n image: { width: '100%', height: '200px', objectFit: 'cover' as const, display: 'block' },\n body: { padding: '1.25rem' } as React.CSSProperties,\n title: { margin: '0 0 0.5rem', fontSize: '1.125rem', fontWeight: 600, lineHeight: 1.3, color: '#111827' } as React.CSSProperties,\n excerpt: { margin: '0 0 0.75rem', fontSize: '0.875rem', color: '#6b7280', lineHeight: 1.5 } as React.CSSProperties,\n meta: { display: 'flex', gap: '0.75rem', fontSize: '0.75rem', color: '#9ca3af', flexWrap: 'wrap' as const } as React.CSSProperties,\n badge: {\n display: 'inline-block',\n padding: '0.125rem 0.5rem',\n borderRadius: '9999px',\n background: '#f3f4f6',\n fontSize: '0.75rem',\n color: '#4b5563',\n } as React.CSSProperties,\n listCard: {\n display: 'flex',\n border: '1px solid #e5e7eb',\n borderRadius: '0.75rem',\n overflow: 'hidden',\n background: '#fff',\n cursor: 'pointer',\n transition: 'box-shadow 0.2s',\n } as React.CSSProperties,\n listImage: { width: '240px', minHeight: '160px', objectFit: 'cover' as const, flexShrink: 0 },\n listBody: { padding: '1.25rem', flex: 1 } as React.CSSProperties,\n};\n\nfunction DefaultCard({\n article,\n layout,\n showExcerpt,\n showImage,\n showMeta,\n onClick,\n}: {\n article: ArticleListItem;\n layout: 'grid' | 'list';\n showExcerpt: boolean;\n showImage: boolean;\n showMeta: boolean;\n onClick?: () => void;\n}) {\n const isGrid = layout === 'grid';\n const [hovered, setHovered] = React.useState(false);\n\n return (\n <article\n style={{\n ...(isGrid ? baseStyles.card : baseStyles.listCard),\n ...(hovered ? baseStyles.cardHover : {}),\n }}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n onClick={onClick}\n role=\"link\"\n tabIndex={0}\n onKeyDown={(e) => e.key === 'Enter' && onClick?.()}\n >\n {showImage && article.featured_image_url && (\n <img\n src={article.featured_image_url}\n alt={article.featured_image_alt || article.title}\n style={isGrid ? baseStyles.image : baseStyles.listImage}\n loading=\"lazy\"\n />\n )}\n <div style={isGrid ? baseStyles.body : baseStyles.listBody}>\n <h3 style={baseStyles.title}>{article.title}</h3>\n {showExcerpt && article.excerpt && (\n <p style={baseStyles.excerpt}>{article.excerpt}</p>\n )}\n {showMeta && (\n <div style={baseStyles.meta}>\n {article.pillar_name && <span style={baseStyles.badge}>{article.pillar_name}</span>}\n {article.content_type && (\n <span style={baseStyles.badge}>{article.content_type.replace(/_/g, ' ')}</span>\n )}\n {article.reading_time_minutes && (\n <span>{article.reading_time_minutes} min read</span>\n )}\n {article.published_at && (\n <span>{new Date(article.published_at).toLocaleDateString()}</span>\n )}\n </div>\n )}\n </div>\n </article>\n );\n}\n\n/**\n * Renders a grid or list of article cards.\n *\n * ```tsx\n * <ArticleFeed articles={articles} layout=\"grid\" columns={3} onArticleClick={(slug) => router.push(`/blog/${slug}`)} />\n * ```\n */\nexport function ArticleFeed({\n articles,\n layout = 'grid',\n columns = 3,\n showExcerpt = true,\n showImage = true,\n showMeta = true,\n onArticleClick,\n className,\n renderArticle,\n}: ArticleFeedProps) {\n const gridTemplateColumns =\n layout === 'grid' ? `repeat(${columns}, 1fr)` : '1fr';\n\n return (\n <div\n className={className}\n style={{ ...baseStyles.grid, gridTemplateColumns }}\n >\n {articles.map((article) =>\n renderArticle ? (\n <React.Fragment key={article.id}>{renderArticle(article)}</React.Fragment>\n ) : (\n <DefaultCard\n key={article.id}\n article={article}\n layout={layout}\n showExcerpt={showExcerpt}\n showImage={showImage}\n showMeta={showMeta}\n onClick={() => onArticleClick?.(article.slug)}\n />\n ),\n )}\n </div>\n );\n}\n","'use client';\n\nimport React, { useState } from 'react';\nimport type { FaqItem } from '../types';\n\nexport interface FaqBlockProps {\n items: FaqItem[];\n collapsible?: boolean;\n defaultOpen?: boolean;\n className?: string;\n title?: string;\n}\n\nconst styles = {\n wrapper: { marginTop: '1rem' } as React.CSSProperties,\n title: { fontSize: '1.5rem', fontWeight: 700, color: '#111827', margin: '0 0 1rem' } as React.CSSProperties,\n item: { borderBottom: '1px solid #e5e7eb', padding: '0.75rem 0' } as React.CSSProperties,\n question: {\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center',\n cursor: 'pointer',\n background: 'none',\n border: 'none',\n width: '100%',\n textAlign: 'left' as const,\n padding: '0.5rem 0',\n fontSize: '1rem',\n fontWeight: 600,\n color: '#1f2937',\n fontFamily: 'inherit',\n } as React.CSSProperties,\n questionStatic: {\n fontSize: '1rem',\n fontWeight: 600,\n color: '#1f2937',\n margin: '0 0 0.5rem',\n } as React.CSSProperties,\n chevron: { flexShrink: 0, marginLeft: '1rem', transition: 'transform 0.2s', fontSize: '1.25rem', color: '#9ca3af' } as React.CSSProperties,\n answer: { fontSize: '0.9375rem', color: '#4b5563', lineHeight: 1.6, paddingTop: '0.5rem' } as React.CSSProperties,\n};\n\nfunction FaqItemComponent({\n item,\n collapsible,\n defaultOpen,\n}: {\n item: FaqItem;\n collapsible: boolean;\n defaultOpen: boolean;\n}) {\n const [open, setOpen] = useState(defaultOpen);\n\n if (!collapsible) {\n return (\n <div style={styles.item}>\n <p style={styles.questionStatic}>{item.question}</p>\n <div style={styles.answer}>{item.answer}</div>\n </div>\n );\n }\n\n return (\n <div style={styles.item}>\n <button\n style={styles.question}\n onClick={() => setOpen(!open)}\n aria-expanded={open}\n >\n <span>{item.question}</span>\n <span style={{ ...styles.chevron, transform: open ? 'rotate(180deg)' : 'rotate(0deg)' }}>\n &#9660;\n </span>\n </button>\n {open && <div style={styles.answer}>{item.answer}</div>}\n </div>\n );\n}\n\n/**\n * FAQ block with optional collapse behavior and Schema.org FAQPage markup.\n *\n * ```tsx\n * <FaqBlock items={article.faq} collapsible />\n * ```\n */\nexport function FaqBlock({\n items,\n collapsible = true,\n defaultOpen = false,\n className,\n title = 'Frequently Asked Questions',\n}: FaqBlockProps) {\n if (!items || items.length === 0) return null;\n\n const schemaData = {\n '@context': 'https://schema.org',\n '@type': 'FAQPage',\n mainEntity: items.map((item) => ({\n '@type': 'Question',\n name: item.question,\n acceptedAnswer: {\n '@type': 'Answer',\n text: item.answer,\n },\n })),\n };\n\n return (\n <section className={className} style={styles.wrapper}>\n <h2 style={styles.title}>{title}</h2>\n {items.map((item, i) => (\n <FaqItemComponent key={i} item={item} collapsible={collapsible} defaultOpen={defaultOpen} />\n ))}\n <script\n type=\"application/ld+json\"\n dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaData) }}\n />\n </section>\n );\n}\n","'use client';\n\nimport React from 'react';\nimport type { ArticleListItem } from '../types';\n\nexport interface RelatedArticlesProps {\n articles: ArticleListItem[];\n title?: string;\n limit?: number;\n onArticleClick?: (slug: string) => void;\n className?: string;\n}\n\nconst styles = {\n wrapper: { marginTop: '1rem' } as React.CSSProperties,\n title: { fontSize: '1.25rem', fontWeight: 700, color: '#111827', margin: '0 0 1rem' } as React.CSSProperties,\n grid: { display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(250px, 1fr))', gap: '1rem' } as React.CSSProperties,\n card: {\n border: '1px solid #e5e7eb',\n borderRadius: '0.5rem',\n overflow: 'hidden',\n cursor: 'pointer',\n transition: 'box-shadow 0.2s',\n background: '#fff',\n } as React.CSSProperties,\n image: { width: '100%', height: '140px', objectFit: 'cover' as const, display: 'block' } as React.CSSProperties,\n body: { padding: '1rem' } as React.CSSProperties,\n cardTitle: { fontSize: '0.9375rem', fontWeight: 600, color: '#111827', margin: 0, lineHeight: 1.3 } as React.CSSProperties,\n excerpt: { fontSize: '0.8125rem', color: '#6b7280', marginTop: '0.5rem', lineHeight: 1.4 } as React.CSSProperties,\n};\n\n/**\n * Related articles widget.\n *\n * ```tsx\n * <RelatedArticles articles={related} onArticleClick={(slug) => router.push(`/blog/${slug}`)} />\n * ```\n */\nexport function RelatedArticles({\n articles,\n title = 'Related Articles',\n limit = 3,\n onArticleClick,\n className,\n}: RelatedArticlesProps) {\n const displayed = articles.slice(0, limit);\n if (displayed.length === 0) return null;\n\n return (\n <section className={className} style={styles.wrapper}>\n <h3 style={styles.title}>{title}</h3>\n <div style={styles.grid}>\n {displayed.map((a) => (\n <div\n key={a.id}\n style={styles.card}\n onClick={() => onArticleClick?.(a.slug)}\n role=\"link\"\n tabIndex={0}\n onKeyDown={(e) => e.key === 'Enter' && onArticleClick?.(a.slug)}\n >\n {a.featured_image_url && (\n <img\n src={a.featured_image_url}\n alt={a.featured_image_alt || a.title}\n style={styles.image}\n loading=\"lazy\"\n />\n )}\n <div style={styles.body}>\n <h4 style={styles.cardTitle}>{a.title}</h4>\n {a.excerpt && <p style={styles.excerpt}>{a.excerpt}</p>}\n </div>\n </div>\n ))}\n </div>\n </section>\n );\n}\n","'use client';\n\nimport React from 'react';\nimport type { Article, ArticleListItem, FaqItem } from '../types';\nimport { FaqBlock } from './FaqBlock';\nimport { RelatedArticles } from './RelatedArticles';\n\nexport interface ArticlePageProps {\n article: Article;\n showFaq?: boolean;\n showTableOfContents?: boolean;\n showMeta?: boolean;\n showRelated?: boolean;\n relatedArticles?: ArticleListItem[];\n onRelatedClick?: (slug: string) => void;\n className?: string;\n components?: {\n H1?: React.ComponentType<{ children: React.ReactNode }>;\n Toc?: React.ComponentType<{ headings: Article['headings'] }>;\n Faq?: React.ComponentType<{ items: FaqItem[] }>;\n };\n}\n\nconst styles = {\n wrapper: { maxWidth: '48rem', margin: '0 auto', fontFamily: 'system-ui, -apple-system, sans-serif' } as React.CSSProperties,\n meta: { display: 'flex', gap: '1rem', flexWrap: 'wrap' as const, fontSize: '0.875rem', color: '#6b7280', marginBottom: '1.5rem' } as React.CSSProperties,\n badge: { display: 'inline-block', padding: '0.125rem 0.5rem', borderRadius: '9999px', background: '#eff6ff', color: '#2563eb', fontSize: '0.75rem' } as React.CSSProperties,\n h1: { fontSize: '2.25rem', fontWeight: 700, lineHeight: 1.2, color: '#111827', margin: '0 0 1rem' } as React.CSSProperties,\n image: { width: '100%', borderRadius: '0.75rem', marginBottom: '2rem' } as React.CSSProperties,\n toc: { background: '#f9fafb', border: '1px solid #e5e7eb', borderRadius: '0.75rem', padding: '1.25rem', marginBottom: '2rem' } as React.CSSProperties,\n tocTitle: { fontSize: '0.875rem', fontWeight: 600, color: '#374151', margin: '0 0 0.75rem', textTransform: 'uppercase' as const, letterSpacing: '0.05em' } as React.CSSProperties,\n tocList: { listStyle: 'none', padding: 0, margin: 0 } as React.CSSProperties,\n tocItem: { padding: '0.25rem 0' } as React.CSSProperties,\n tocLink: { color: '#4b5563', textDecoration: 'none', fontSize: '0.875rem' } as React.CSSProperties,\n content: { lineHeight: 1.75, color: '#374151', fontSize: '1.0625rem' } as React.CSSProperties,\n divider: { border: 'none', borderTop: '1px solid #e5e7eb', margin: '2.5rem 0' } as React.CSSProperties,\n};\n\nfunction DefaultToc({ headings }: { headings: Article['headings'] }) {\n if (!headings || headings.length === 0) return null;\n return (\n <nav style={styles.toc}>\n <p style={styles.tocTitle}>Table of Contents</p>\n <ul style={styles.tocList}>\n {headings.map((h, i) => (\n <li key={i} style={{ ...styles.tocItem, paddingLeft: `${(h.level - 2) * 1}rem` }}>\n <a href={`#${h.id}`} style={styles.tocLink}>\n {h.text}\n </a>\n </li>\n ))}\n </ul>\n </nav>\n );\n}\n\n/**\n * Renders a full article page with optional TOC, FAQ, and related articles.\n *\n * ```tsx\n * <ArticlePage article={article} showTableOfContents showFaq />\n * ```\n */\nexport function ArticlePage({\n article,\n showFaq = true,\n showTableOfContents = true,\n showMeta = true,\n showRelated = false,\n relatedArticles,\n onRelatedClick,\n className,\n components,\n}: ArticlePageProps) {\n const H1 = components?.H1 || (({ children }: { children: React.ReactNode }) => <h1 style={styles.h1}>{children}</h1>);\n const Toc = components?.Toc || DefaultToc;\n const FaqComponent = components?.Faq || FaqBlock;\n\n return (\n <article className={className} style={styles.wrapper}>\n {/* Meta badges */}\n {showMeta && (\n <div style={styles.meta}>\n {article.pillar_name && <span style={styles.badge}>{article.pillar_name}</span>}\n {article.content_type && (\n <span style={{ ...styles.badge, background: '#f0fdf4', color: '#16a34a' }}>\n {article.content_type.replace(/_/g, ' ')}\n </span>\n )}\n {article.reading_time_minutes && <span>{article.reading_time_minutes} min read</span>}\n {article.published_at && <span>{new Date(article.published_at).toLocaleDateString()}</span>}\n </div>\n )}\n\n {/* H1 */}\n <H1>{article.h1 || article.title}</H1>\n\n {/* Featured image */}\n {article.featured_image_url && (\n <img\n src={article.featured_image_url}\n alt={article.featured_image_alt || article.title}\n style={styles.image}\n />\n )}\n\n {/* Table of contents */}\n {showTableOfContents && article.headings?.length > 0 && (\n <Toc headings={article.headings} />\n )}\n\n {/* Article body */}\n <div\n style={styles.content}\n dangerouslySetInnerHTML={{ __html: article.content_html }}\n />\n\n {/* FAQ */}\n {showFaq && article.faq?.length > 0 && (\n <>\n <hr style={styles.divider} />\n <FaqComponent items={article.faq} />\n </>\n )}\n\n {/* Schema.org JSON-LD */}\n {article.schema_json && (\n <script\n type=\"application/ld+json\"\n dangerouslySetInnerHTML={{ __html: JSON.stringify(article.schema_json) }}\n />\n )}\n\n {/* Related articles */}\n {showRelated && relatedArticles && relatedArticles.length > 0 && (\n <>\n <hr style={styles.divider} />\n <RelatedArticles articles={relatedArticles} onArticleClick={onRelatedClick} />\n </>\n )}\n </article>\n );\n}\n","import type { Article } from '../types';\n\n/**\n * Generate Next.js App Router Metadata object from an Article.\n * Use in page.tsx generateMetadata():\n *\n * ```ts\n * import { generateArticleMetadata } from \"@dsa/content-sdk/server\";\n *\n * export async function generateMetadata({ params }) {\n * const article = await fetchArticleBySlug(config, params.slug);\n * return generateArticleMetadata(article, \"https://example.com\");\n * }\n * ```\n */\nexport function generateArticleMetadata(\n article: Article,\n siteUrl?: string,\n): Record<string, any> {\n const url = siteUrl\n ? `${siteUrl.replace(/\\/+$/, '')}/blog/${article.slug}`\n : undefined;\n\n return {\n title: article.meta_title || article.title,\n description: article.meta_description || article.excerpt || '',\n openGraph: {\n title: article.meta_title || article.title,\n description: article.meta_description || article.excerpt || '',\n type: 'article',\n publishedTime: article.published_at || undefined,\n modifiedTime: article.updated_at || undefined,\n ...(url ? { url } : {}),\n ...(article.featured_image_url\n ? {\n images: [\n {\n url: article.featured_image_url,\n alt: article.featured_image_alt || article.title,\n },\n ],\n }\n : {}),\n },\n twitter: {\n card: 'summary_large_image',\n title: article.meta_title || article.title,\n description: article.meta_description || article.excerpt || '',\n ...(article.featured_image_url ? { images: [article.featured_image_url] } : {}),\n },\n ...(article.canonical_url\n ? { alternates: { canonical: article.canonical_url } }\n : url\n ? { alternates: { canonical: url } }\n : {}),\n };\n}\n\n/**\n * Renders JSON-LD structured data for an article.\n * Include this component in your article page layout for SEO.\n *\n * ```tsx\n * <SeoMetaBridge article={article} siteUrl=\"https://example.com\" />\n * ```\n */\nexport function SeoMetaBridge({\n article,\n siteUrl,\n}: {\n article: Article;\n siteUrl?: string;\n}) {\n const schema = article.schema_json || {\n '@context': 'https://schema.org',\n '@type': 'Article',\n headline: article.meta_title || article.title,\n description: article.meta_description || article.excerpt || '',\n datePublished: article.published_at || undefined,\n dateModified: article.updated_at || article.published_at || undefined,\n ...(article.featured_image_url ? { image: article.featured_image_url } : {}),\n ...(siteUrl ? { url: `${siteUrl.replace(/\\/+$/, '')}/blog/${article.slug}` } : {}),\n ...(article.target_keyword\n ? { keywords: [article.target_keyword, ...(article.secondary_keywords || [])].join(', ') }\n : {}),\n };\n\n return (\n <script\n type=\"application/ld+json\"\n dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }}\n />\n );\n}\n"],"mappings":";0jBAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,iBAAAE,EAAA,gBAAAC,EAAA,kBAAAC,EAAA,uBAAAC,EAAA,aAAAC,EAAA,oBAAAC,EAAA,kBAAAC,EAAA,4BAAAC,EAAA,eAAAC,EAAA,gBAAAC,EAAA,kBAAAC,EAAA,kBAAAC,EAAA,uBAAAC,IAAA,eAAAC,EAAAf,ICcO,IAAMgB,EAAN,KAAoB,CAMzB,YAAYC,EAA0B,CACpC,KAAK,OAASA,EAAO,OAAO,QAAQ,OAAQ,EAAE,EAC9C,KAAK,OAASA,EAAO,OACrB,KAAK,cACHA,EAAO,gBAAkB,aACrB,UACAA,EAAO,gBAAkB,cACvB,cACA,WACR,KAAK,kBAAoBA,EAAO,iBAClC,CAEA,MAAc,QAAWC,EAAcC,EAAkE,CACvG,IAAMC,EAAM,IAAI,IAAI,GAAG,KAAK,MAAM,GAAGF,CAAI,EAAE,EACvCC,GACF,OAAO,QAAQA,CAAM,EAAE,QAAQ,CAAC,CAACE,EAAGC,CAAC,IAAM,CAClBA,GAAM,MAAQA,IAAM,IACzCF,EAAI,aAAa,IAAIC,EAAG,OAAOC,CAAC,CAAC,CAErC,CAAC,EAEHF,EAAI,aAAa,IAAI,WAAY,KAAK,MAAM,EAE5C,IAAMG,EAAiE,CACrE,OAAQ,MACR,QAAS,CAAE,YAAa,KAAK,MAAO,EACpC,MAAO,KAAK,aACd,EAGI,KAAK,mBAAqB,KAAK,gBAAkB,aACnDA,EAAa,KAAO,CAAE,WAAY,KAAK,iBAAkB,GAG3D,IAAMC,EAAM,MAAM,MAAMJ,E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AQ,kBAAkB,CAAE,EAAI,CAAC,CAC/E,EACA,GAAIA,EAAQ,cACR,CAAE,WAAY,CAAE,UAAWA,EAAQ,aAAc,CAAE,EACnDE,EACE,CAAE,WAAY,CAAE,UAAWA,CAAI,CAAE,EACjC,CAAC,CACT,CACF,CAUO,SAASC,EAAc,CAC5B,QAAAH,EACA,QAAAC,CACF,EAGG,CACD,IAAMG,EAASJ,EAAQ,aAAe,CACpC,WAAY,qBACZ,QAAS,UACT,SAAUA,EAAQ,YAAcA,EAAQ,MACxC,YAAaA,EAAQ,kBAAoBA,EAAQ,SAAW,GAC5D,cAAeA,EAAQ,cAAgB,OACvC,aAAcA,EAAQ,YAAcA,EAAQ,cAAgB,OAC5D,GAAIA,EAAQ,mBAAqB,CAAE,MAAOA,EAAQ,kBAAmB,EAAI,CAAC,EAC1E,GAAIC,EAAU,CAAE,IAAK,GAAGA,EAAQ,QAAQ,OAAQ,EAAE,CAAC,SAASD,EAAQ,IAAI,EAAG,EAAI,CAAC,EAChF,GAAIA,EAAQ,eACR,CAAE,SAAU,CAACA,EAAQ,eAAgB,GAAIA,EAAQ,oBAAsB,CAAC,CAAE,EAAE,KAAK,IAAI,CAAE,EACvF,CAAC,CACP,EAEA,SACE,OAAC,UACC,KAAK,sBACL,wBAAyB,CAAE,OAAQ,KAAK,UAAUI,CAAM,CAAE,EAC5D,CAEJ","names":["src_exports","__export","ArticleFeed","ArticlePage","ContentClient","DsaContentProvider","FaqBlock","RelatedArticles","SeoMetaBridge","generateArticleMetadata","useArticle","useArticles","useCategories","useDsaContent","useRelatedArticles","__toCommonJS","ContentClient","config","path","params","url","k","v","fetchOptions","res","text","filters","slug","limit","import_react","import_jsx_runtime","ContentContext","DsaContentProvider","config","children","client","ContentClient","useDsaContent","import_react","useArticles","filters","client","useDsaContent","state","setState","fetch","s","res","err","useArticle","slug","article","useRelatedArticles","limit","articles","useCategories","categories","import_react","import_jsx_runtime","baseStyles","DefaultCard","article","layout","showExcerpt","showImage","showMeta","onClick","isGrid","hovered","setHovered","React","e","ArticleFeed","articles","columns","onArticleClick","className","renderArticle","gridTemplateColumns","import_react","import_jsx_runtime","styles","FaqItemComponent","item","collapsible","defaultOpen","open","setOpen","FaqBlock","items","className","title","schemaData","i","import_jsx_runtime","styles","RelatedArticles","articles","title","limit","onArticleClick","className","displayed","a","e","import_jsx_runtime","styles","DefaultToc","headings","h","i","ArticlePage","article","showFaq","showTableOfContents","showMeta","showRelated","relatedArticles","onRelatedClick","className","components","H1","children","Toc","FaqComponent","FaqBlock","RelatedArticles","import_jsx_runtime","generateArticleMetadata","article","siteUrl","url","SeoMetaBridge","schema"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ var C=class{constructor(t){this.apiUrl=t.apiUrl.replace(/\/+$/,""),this.apiKey=t.apiKey,this.cacheStrategy=t.cacheStrategy==="revalidate"?"default":t.cacheStrategy==="force-cache"?"force-cache":"no-cache",this.revalidateSeconds=t.revalidateSeconds}async request(t,o){let n=new URL(`${this.apiUrl}${t}`);o&&Object.entries(o).forEach(([a,l])=>{l!=null&&l!==""&&n.searchParams.set(a,String(l))}),n.searchParams.set("site_key",this.apiKey);let i={method:"GET",headers:{"X-API-Key":this.apiKey},cache:this.cacheStrategy};this.revalidateSeconds&&this.cacheStrategy!=="no-cache"&&(i.next={revalidate:this.revalidateSeconds});let r=await fetch(n.toString(),i);if(!r.ok){let a=await r.text().catch(()=>"");throw new Error(`DSA Content API error ${r.status}: ${a||r.statusText}`)}return r.json()}async getArticles(t){return this.request("/api/public/articles",{page:t?.page,per_page:t?.per_page,pillar:t?.pillar,cluster:t?.cluster,content_type:t?.content_type,search:t?.search})}async getArticleBySlug(t){return this.request(`/api/public/articles/${encodeURIComponent(t)}`)}async getRelatedArticles(t,o=3){return this.request(`/api/public/articles/${encodeURIComponent(t)}/related`,{limit:o})}async getCategories(){return this.request("/api/public/categories")}async getSitemap(){return this.request("/api/public/sitemap")}};import{createContext as H,useContext as M,useMemo as $}from"react";import{jsx as W}from"react/jsx-runtime";var I=H(null);function N({config:e,children:t}){let o=$(()=>new C(e),[e.apiUrl,e.apiKey]);return W(I.Provider,{value:o,children:t})}function h(){let e=M(I);if(!e)throw new Error("useDsaContent() must be used inside <DsaContentProvider>");return e}import{useState as A,useEffect as x,useCallback as P}from"react";function O(e){let t=h(),[o,n]=A({articles:[],loading:!0,error:null,pagination:{page:1,per_page:10,total:0,total_pages:0}}),i=P(()=>{n(r=>({...r,loading:!0,error:null})),t.getArticles(e).then(r=>n({articles:r.items,loading:!1,error:null,pagination:{page:r.page,per_page:r.per_page,total:r.total,total_pages:r.total_pages}})).catch(r=>n(a=>({...a,loading:!1,error:r instanceof Error?r:new Error(String(r))})))},[t,e?.page,e?.per_page,e?.pillar,e?.cluster,e?.content_type,e?.search]);return x(()=>{i()},[i]),{...o,refetch:i}}function K(e){let t=h(),[o,n]=A({article:null,loading:!0,error:null}),i=P(()=>{if(!e){n({article:null,loading:!1,error:null});return}n(r=>({...r,loading:!0,error:null})),t.getArticleBySlug(e).then(r=>n({article:r,loading:!1,error:null})).catch(r=>n({article:null,loading:!1,error:r instanceof Error?r:new Error(String(r))}))},[t,e]);return x(()=>{i()},[i]),{...o,refetch:i}}function j(e,t=3){let o=h(),[n,i]=A({articles:[],loading:!0,error:null}),r=P(()=>{if(!e){i({articles:[],loading:!1,error:null});return}i(a=>({...a,loading:!0,error:null})),o.getRelatedArticles(e,t).then(a=>i({articles:a,loading:!1,error:null})).catch(a=>i({articles:[],loading:!1,error:a instanceof Error?a:new Error(String(a))}))},[o,e,t]);return x(()=>{r()},[r]),{...n,refetch:r}}function G(){let e=h(),[t,o]=A({categories:[],loading:!0,error:null}),n=P(()=>{o(i=>({...i,loading:!0,error:null})),e.getCategories().then(i=>o({categories:i,loading:!1,error:null})).catch(i=>o({categories:[],loading:!1,error:i instanceof Error?i:new Error(String(i))}))},[e]);return x(()=>{n()},[n]),{...t,refetch:n}}import q from"react";import{jsx as m,jsxs as R}from"react/jsx-runtime";var p={grid:{display:"grid",gap:"1.5rem"},card:{border:"1px solid #e5e7eb",borderRadius:"0.75rem",overflow:"hidden",background:"#fff",cursor:"pointer",transition:"box-shadow 0.2s"},cardHover:{boxShadow:"0 4px 12px rgba(0,0,0,0.08)"},image:{width:"100%",height:"200px",objectFit:"cover",display:"block"},body:{padding:"1.25rem"},title:{margin:"0 0 0.5rem",fontSize:"1.125rem",fontWeight:600,lineHeight:1.3,color:"#111827"},excerpt:{margin:"0 0 0.75rem",fontSize:"0.875rem",color:"#6b7280",lineHeight:1.5},meta:{display:"flex",gap:"0.75rem",fontSize:"0.75rem",color:"#9ca3af",flexWrap:"wrap"},badge:{display:"inline-block",padding:"0.125rem 0.5rem",borderRadius:"9999px",background:"#f3f4f6",fontSize:"0.75rem",color:"#4b5563"},listCard:{display:"flex",border:"1px solid #e5e7eb",borderRadius:"0.75rem",overflow:"hidden",background:"#fff",cursor:"pointer",transition:"box-shadow 0.2s"},listImage:{width:"240px",minHeight:"160px",objectFit:"cover",flexShrink:0},listBody:{padding:"1.25rem",flex:1}};function J({article:e,layout:t,showExcerpt:o,showImage:n,showMeta:i,onClick:r}){let a=t==="grid",[l,d]=q.useState(!1);return R("article",{style:{...a?p.card:p.listCard,...l?p.cardHover:{}},onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onClick:r,role:"link",tabIndex:0,onKeyDown:b=>b.key==="Enter"&&r?.(),children:[n&&e.featured_image_url&&m("img",{src:e.featured_image_url,alt:e.featured_image_alt||e.title,style:a?p.image:p.listImage,loading:"lazy"}),R("div",{style:a?p.body:p.listBody,children:[m("h3",{style:p.title,children:e.title}),o&&e.excerpt&&m("p",{style:p.excerpt,children:e.excerpt}),i&&R("div",{style:p.meta,children:[e.pillar_name&&m("span",{style:p.badge,children:e.pillar_name}),e.content_type&&m("span",{style:p.badge,children:e.content_type.replace(/_/g," ")}),e.reading_time_minutes&&R("span",{children:[e.reading_time_minutes," min read"]}),e.published_at&&m("span",{children:new Date(e.published_at).toLocaleDateString()})]})]})]})}function L({articles:e,layout:t="grid",columns:o=3,showExcerpt:n=!0,showImage:i=!0,showMeta:r=!0,onArticleClick:a,className:l,renderArticle:d}){let b=t==="grid"?`repeat(${o}, 1fr)`:"1fr";return m("div",{className:l,style:{...p.grid,gridTemplateColumns:b},children:e.map(y=>d?m(q.Fragment,{children:d(y)},y.id):m(J,{article:y,layout:t,showExcerpt:n,showImage:i,showMeta:r,onClick:()=>a?.(y.slug)},y.id))})}import{useState as Q}from"react";import{jsx as u,jsxs as v}from"react/jsx-runtime";var g={wrapper:{marginTop:"1rem"},title:{fontSize:"1.5rem",fontWeight:700,color:"#111827",margin:"0 0 1rem"},item:{borderBottom:"1px solid #e5e7eb",padding:"0.75rem 0"},question:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",background:"none",border:"none",width:"100%",textAlign:"left",padding:"0.5rem 0",fontSize:"1rem",fontWeight:600,color:"#1f2937",fontFamily:"inherit"},questionStatic:{fontSize:"1rem",fontWeight:600,color:"#1f2937",margin:"0 0 0.5rem"},chevron:{flexShrink:0,marginLeft:"1rem",transition:"transform 0.2s",fontSize:"1.25rem",color:"#9ca3af"},answer:{fontSize:"0.9375rem",color:"#4b5563",lineHeight:1.6,paddingTop:"0.5rem"}};function X({item:e,collapsible:t,defaultOpen:o}){let[n,i]=Q(o);return t?v("div",{style:g.item,children:[v("button",{style:g.question,onClick:()=>i(!n),"aria-expanded":n,children:[u("span",{children:e.question}),u("span",{style:{...g.chevron,transform:n?"rotate(180deg)":"rotate(0deg)"},children:"\u25BC"})]}),n&&u("div",{style:g.answer,children:e.answer})]}):v("div",{style:g.item,children:[u("p",{style:g.questionStatic,children:e.question}),u("div",{style:g.answer,children:e.answer})]})}function w({items:e,collapsible:t=!0,defaultOpen:o=!1,className:n,title:i="Frequently Asked Questions"}){if(!e||e.length===0)return null;let r={"@context":"https://schema.org","@type":"FAQPage",mainEntity:e.map(a=>({"@type":"Question",name:a.question,acceptedAnswer:{"@type":"Answer",text:a.answer}}))};return v("section",{className:n,style:g.wrapper,children:[u("h2",{style:g.title,children:i}),e.map((a,l)=>u(X,{item:a,collapsible:t,defaultOpen:o},l)),u("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(r)}})]})}import{jsx as _,jsxs as F}from"react/jsx-runtime";var f={wrapper:{marginTop:"1rem"},title:{fontSize:"1.25rem",fontWeight:700,color:"#111827",margin:"0 0 1rem"},grid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(250px, 1fr))",gap:"1rem"},card:{border:"1px solid #e5e7eb",borderRadius:"0.5rem",overflow:"hidden",cursor:"pointer",transition:"box-shadow 0.2s",background:"#fff"},image:{width:"100%",height:"140px",objectFit:"cover",display:"block"},body:{padding:"1rem"},cardTitle:{fontSize:"0.9375rem",fontWeight:600,color:"#111827",margin:0,lineHeight:1.3},excerpt:{fontSize:"0.8125rem",color:"#6b7280",marginTop:"0.5rem",lineHeight:1.4}};function k({articles:e,title:t="Related Articles",limit:o=3,onArticleClick:n,className:i}){let r=e.slice(0,o);return r.length===0?null:F("section",{className:i,style:f.wrapper,children:[_("h3",{style:f.title,children:t}),_("div",{style:f.grid,children:r.map(a=>F("div",{style:f.card,onClick:()=>n?.(a.slug),role:"link",tabIndex:0,onKeyDown:l=>l.key==="Enter"&&n?.(a.slug),children:[a.featured_image_url&&_("img",{src:a.featured_image_url,alt:a.featured_image_alt||a.title,style:f.image,loading:"lazy"}),F("div",{style:f.body,children:[_("h4",{style:f.cardTitle,children:a.title}),a.excerpt&&_("p",{style:f.excerpt,children:a.excerpt})]})]},a.id))})]})}import{Fragment as T,jsx as s,jsxs as S}from"react/jsx-runtime";var c={wrapper:{maxWidth:"48rem",margin:"0 auto",fontFamily:"system-ui, -apple-system, sans-serif"},meta:{display:"flex",gap:"1rem",flexWrap:"wrap",fontSize:"0.875rem",color:"#6b7280",marginBottom:"1.5rem"},badge:{display:"inline-block",padding:"0.125rem 0.5rem",borderRadius:"9999px",background:"#eff6ff",color:"#2563eb",fontSize:"0.75rem"},h1:{fontSize:"2.25rem",fontWeight:700,lineHeight:1.2,color:"#111827",margin:"0 0 1rem"},image:{width:"100%",borderRadius:"0.75rem",marginBottom:"2rem"},toc:{background:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:"0.75rem",padding:"1.25rem",marginBottom:"2rem"},tocTitle:{fontSize:"0.875rem",fontWeight:600,color:"#374151",margin:"0 0 0.75rem",textTransform:"uppercase",letterSpacing:"0.05em"},tocList:{listStyle:"none",padding:0,margin:0},tocItem:{padding:"0.25rem 0"},tocLink:{color:"#4b5563",textDecoration:"none",fontSize:"0.875rem"},content:{lineHeight:1.75,color:"#374151",fontSize:"1.0625rem"},divider:{border:"none",borderTop:"1px solid #e5e7eb",margin:"2.5rem 0"}};function V({headings:e}){return!e||e.length===0?null:S("nav",{style:c.toc,children:[s("p",{style:c.tocTitle,children:"Table of Contents"}),s("ul",{style:c.tocList,children:e.map((t,o)=>s("li",{style:{...c.tocItem,paddingLeft:`${(t.level-2)*1}rem`},children:s("a",{href:`#${t.id}`,style:c.tocLink,children:t.text})},o))})]})}function D({article:e,showFaq:t=!0,showTableOfContents:o=!0,showMeta:n=!0,showRelated:i=!1,relatedArticles:r,onRelatedClick:a,className:l,components:d}){let b=d?.H1||(({children:B})=>s("h1",{style:c.h1,children:B})),y=d?.Toc||V,z=d?.Faq||w;return S("article",{className:l,style:c.wrapper,children:[n&&S("div",{style:c.meta,children:[e.pillar_name&&s("span",{style:c.badge,children:e.pillar_name}),e.content_type&&s("span",{style:{...c.badge,background:"#f0fdf4",color:"#16a34a"},children:e.content_type.replace(/_/g," ")}),e.reading_time_minutes&&S("span",{children:[e.reading_time_minutes," min read"]}),e.published_at&&s("span",{children:new Date(e.published_at).toLocaleDateString()})]}),s(b,{children:e.h1||e.title}),e.featured_image_url&&s("img",{src:e.featured_image_url,alt:e.featured_image_alt||e.title,style:c.image}),o&&e.headings?.length>0&&s(y,{headings:e.headings}),s("div",{style:c.content,dangerouslySetInnerHTML:{__html:e.content_html}}),t&&e.faq?.length>0&&S(T,{children:[s("hr",{style:c.divider}),s(z,{items:e.faq})]}),e.schema_json&&s("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e.schema_json)}}),i&&r&&r.length>0&&S(T,{children:[s("hr",{style:c.divider}),s(k,{articles:r,onArticleClick:a})]})]})}import{jsx as Y}from"react/jsx-runtime";function E(e,t){let o=t?`${t.replace(/\/+$/,"")}/blog/${e.slug}`:void 0;return{title:e.meta_title||e.title,description:e.meta_description||e.excerpt||"",openGraph:{title:e.meta_title||e.title,description:e.meta_description||e.excerpt||"",type:"article",publishedTime:e.published_at||void 0,modifiedTime:e.updated_at||void 0,...o?{url:o}:{},...e.featured_image_url?{images:[{url:e.featured_image_url,alt:e.featured_image_alt||e.title}]}:{}},twitter:{card:"summary_large_image",title:e.meta_title||e.title,description:e.meta_description||e.excerpt||"",...e.featured_image_url?{images:[e.featured_image_url]}:{}},...e.canonical_url?{alternates:{canonical:e.canonical_url}}:o?{alternates:{canonical:o}}:{}}}function U({article:e,siteUrl:t}){let o=e.schema_json||{"@context":"https://schema.org","@type":"Article",headline:e.meta_title||e.title,description:e.meta_description||e.excerpt||"",datePublished:e.published_at||void 0,dateModified:e.updated_at||e.published_at||void 0,...e.featured_image_url?{image:e.featured_image_url}:{},...t?{url:`${t.replace(/\/+$/,"")}/blog/${e.slug}`}:{},...e.target_keyword?{keywords:[e.target_keyword,...e.secondary_keywords||[]].join(", ")}:{}};return Y("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(o)}})}export{L as ArticleFeed,D as ArticlePage,C as ContentClient,N as DsaContentProvider,w as FaqBlock,k as RelatedArticles,U as SeoMetaBridge,E as generateArticleMetadata,K as useArticle,O as useArticles,G as useCategories,h as useDsaContent,j as useRelatedArticles};
3
+ //# sourceMappingURL=index.mjs.map