@dsaplatform/content-sdk 1.2.0 → 1.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.
- package/README.md +72 -0
- package/dist/headless.d.mts +23 -0
- package/dist/headless.d.ts +23 -0
- package/dist/index.d.mts +67 -9
- package/dist/index.d.ts +67 -9
- package/dist/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -1
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +23 -0
- package/dist/server.d.ts +23 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -111,6 +111,78 @@ function BlogPost({ slug }: { slug: string }) {
|
|
|
111
111
|
}
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
+
## Theming & Styling
|
|
115
|
+
|
|
116
|
+
### Light / Dark theme (works out of the box)
|
|
117
|
+
|
|
118
|
+
The SDK ships built-in prose styles for headings, paragraphs, lists, blockquotes, tables, and links inside the article body. These are scoped via `[data-dsa-article-body]` and injected once via `<style>` — they work even when Tailwind Preflight resets all margins.
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
<ArticlePage article={article} theme="light" />
|
|
122
|
+
<ArticlePage article={article} theme="dark" />
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Override any value with CSS variables on a parent element:
|
|
126
|
+
|
|
127
|
+
```css
|
|
128
|
+
:root {
|
|
129
|
+
--dsa-text: #0f172a;
|
|
130
|
+
--dsa-content-text: #334155;
|
|
131
|
+
--dsa-h2-text: #0f172a;
|
|
132
|
+
--dsa-h3-text: #1e293b;
|
|
133
|
+
--dsa-link: #2563eb;
|
|
134
|
+
--dsa-link-hover: #1d4ed8;
|
|
135
|
+
--dsa-toc-bg: #f8fafc;
|
|
136
|
+
--dsa-card-border: #e2e8f0;
|
|
137
|
+
--dsa-badge-bg: #eff6ff;
|
|
138
|
+
--dsa-badge-text: #2563eb;
|
|
139
|
+
--dsa-badge-alt-bg: #f0fdf4;
|
|
140
|
+
--dsa-badge-alt-text: #16a34a;
|
|
141
|
+
--dsa-divider: #e2e8f0;
|
|
142
|
+
--dsa-blockquote-border: #cbd5e1;
|
|
143
|
+
--dsa-blockquote-text: #475569;
|
|
144
|
+
--dsa-pre-bg: #f1f5f9;
|
|
145
|
+
--dsa-table-border: #e2e8f0;
|
|
146
|
+
--dsa-table-header-bg: #f8fafc;
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
To disable the built-in prose styles (e.g. if you use `@tailwindcss/typography`):
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
<ArticlePage article={article} disableProseStyles />
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Inherit theme (full control)
|
|
157
|
+
|
|
158
|
+
`theme="inherit"` removes **all** inline styles and injected `<style>` tags. The SDK renders only semantic HTML with stable CSS classes and `data-*` attributes.
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
<ArticlePage
|
|
162
|
+
article={article}
|
|
163
|
+
theme="inherit"
|
|
164
|
+
className="max-w-3xl mx-auto font-sans"
|
|
165
|
+
contentClassName="prose dark:prose-invert"
|
|
166
|
+
/>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
> **Tailwind + Preflight note:** In `inherit` mode, paragraph margins, heading sizes, and list styles are all reset to zero by Preflight. You must provide your own prose styles — for example via `@tailwindcss/typography` (`prose` class) or custom CSS targeting the stable selectors below.
|
|
170
|
+
|
|
171
|
+
### Stable CSS selectors
|
|
172
|
+
|
|
173
|
+
Always present regardless of theme:
|
|
174
|
+
|
|
175
|
+
| Element | CSS class | Data attribute |
|
|
176
|
+
|---------|-----------|----------------|
|
|
177
|
+
| Root | your `className` | `data-dsa-theme="light\|dark\|inherit"` |
|
|
178
|
+
| Article body | `dsa-article-body` + `contentClassName` | `data-dsa-article-body` |
|
|
179
|
+
| TOC nav | `dsa-toc` | `data-dsa-toc` |
|
|
180
|
+
| Meta row | `dsa-meta` | `data-dsa-meta` |
|
|
181
|
+
| H1 | `dsa-h1` | — |
|
|
182
|
+
| Badge | `dsa-badge` | — |
|
|
183
|
+
| Featured image | `dsa-featured-image` | — |
|
|
184
|
+
| Divider | `dsa-divider` | — |
|
|
185
|
+
|
|
114
186
|
## Components
|
|
115
187
|
|
|
116
188
|
| Component | Description |
|
package/dist/headless.d.mts
CHANGED
|
@@ -29,6 +29,10 @@ interface Article {
|
|
|
29
29
|
pillar_name?: string;
|
|
30
30
|
cluster_name?: string;
|
|
31
31
|
content_type?: string;
|
|
32
|
+
/** Author info from site settings (E-E-A-T) */
|
|
33
|
+
author?: ArticleAuthor | null;
|
|
34
|
+
/** Publisher info from site settings (E-E-A-T) */
|
|
35
|
+
publisher?: ArticlePublisher | null;
|
|
32
36
|
}
|
|
33
37
|
/**
|
|
34
38
|
* Article heading (from H1-H6 tags)
|
|
@@ -52,6 +56,25 @@ interface InternalLink {
|
|
|
52
56
|
slug: string;
|
|
53
57
|
anchor_text: string;
|
|
54
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Author information (E-E-A-T) — populated from site settings
|
|
61
|
+
*/
|
|
62
|
+
interface ArticleAuthor {
|
|
63
|
+
name: string;
|
|
64
|
+
url?: string | null;
|
|
65
|
+
bio?: string | null;
|
|
66
|
+
image_url?: string | null;
|
|
67
|
+
job_title?: string | null;
|
|
68
|
+
socials?: Record<string, string>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Publisher information (E-E-A-T) — populated from site settings
|
|
72
|
+
*/
|
|
73
|
+
interface ArticlePublisher {
|
|
74
|
+
name: string;
|
|
75
|
+
logo_url?: string | null;
|
|
76
|
+
url?: string | null;
|
|
77
|
+
}
|
|
55
78
|
|
|
56
79
|
/**
|
|
57
80
|
* Headless utilities — data transformers with zero UI / zero inline styles.
|
package/dist/headless.d.ts
CHANGED
|
@@ -29,6 +29,10 @@ interface Article {
|
|
|
29
29
|
pillar_name?: string;
|
|
30
30
|
cluster_name?: string;
|
|
31
31
|
content_type?: string;
|
|
32
|
+
/** Author info from site settings (E-E-A-T) */
|
|
33
|
+
author?: ArticleAuthor | null;
|
|
34
|
+
/** Publisher info from site settings (E-E-A-T) */
|
|
35
|
+
publisher?: ArticlePublisher | null;
|
|
32
36
|
}
|
|
33
37
|
/**
|
|
34
38
|
* Article heading (from H1-H6 tags)
|
|
@@ -52,6 +56,25 @@ interface InternalLink {
|
|
|
52
56
|
slug: string;
|
|
53
57
|
anchor_text: string;
|
|
54
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Author information (E-E-A-T) — populated from site settings
|
|
61
|
+
*/
|
|
62
|
+
interface ArticleAuthor {
|
|
63
|
+
name: string;
|
|
64
|
+
url?: string | null;
|
|
65
|
+
bio?: string | null;
|
|
66
|
+
image_url?: string | null;
|
|
67
|
+
job_title?: string | null;
|
|
68
|
+
socials?: Record<string, string>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Publisher information (E-E-A-T) — populated from site settings
|
|
72
|
+
*/
|
|
73
|
+
interface ArticlePublisher {
|
|
74
|
+
name: string;
|
|
75
|
+
logo_url?: string | null;
|
|
76
|
+
url?: string | null;
|
|
77
|
+
}
|
|
55
78
|
|
|
56
79
|
/**
|
|
57
80
|
* Headless utilities — data transformers with zero UI / zero inline styles.
|
package/dist/index.d.mts
CHANGED
|
@@ -45,6 +45,10 @@ interface Article {
|
|
|
45
45
|
pillar_name?: string;
|
|
46
46
|
cluster_name?: string;
|
|
47
47
|
content_type?: string;
|
|
48
|
+
/** Author info from site settings (E-E-A-T) */
|
|
49
|
+
author?: ArticleAuthor | null;
|
|
50
|
+
/** Publisher info from site settings (E-E-A-T) */
|
|
51
|
+
publisher?: ArticlePublisher | null;
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
50
54
|
* Abbreviated article for lists
|
|
@@ -88,6 +92,25 @@ interface InternalLink {
|
|
|
88
92
|
slug: string;
|
|
89
93
|
anchor_text: string;
|
|
90
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Author information (E-E-A-T) — populated from site settings
|
|
97
|
+
*/
|
|
98
|
+
interface ArticleAuthor {
|
|
99
|
+
name: string;
|
|
100
|
+
url?: string | null;
|
|
101
|
+
bio?: string | null;
|
|
102
|
+
image_url?: string | null;
|
|
103
|
+
job_title?: string | null;
|
|
104
|
+
socials?: Record<string, string>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Publisher information (E-E-A-T) — populated from site settings
|
|
108
|
+
*/
|
|
109
|
+
interface ArticlePublisher {
|
|
110
|
+
name: string;
|
|
111
|
+
logo_url?: string | null;
|
|
112
|
+
url?: string | null;
|
|
113
|
+
}
|
|
91
114
|
/**
|
|
92
115
|
* Category with clusters
|
|
93
116
|
*/
|
|
@@ -287,6 +310,7 @@ interface ArticleFeedProps {
|
|
|
287
310
|
*/
|
|
288
311
|
declare function ArticleFeed({ articles, layout, columns, showExcerpt, showImage, showMeta, onArticleClick, className, theme, renderArticle, }: ArticleFeedProps): react_jsx_runtime.JSX.Element;
|
|
289
312
|
|
|
313
|
+
type ArticleTheme = 'light' | 'dark' | 'inherit';
|
|
290
314
|
interface ArticlePageProps {
|
|
291
315
|
article: Article;
|
|
292
316
|
showFaq?: boolean;
|
|
@@ -296,8 +320,22 @@ interface ArticlePageProps {
|
|
|
296
320
|
relatedArticles?: ArticleListItem[];
|
|
297
321
|
onRelatedClick?: (slug: string) => void;
|
|
298
322
|
className?: string;
|
|
299
|
-
/**
|
|
300
|
-
|
|
323
|
+
/** Extra class(es) on the `<div>` that wraps `content_html`. */
|
|
324
|
+
contentClassName?: string;
|
|
325
|
+
/**
|
|
326
|
+
* `"light"` / `"dark"` — SDK applies inline styles + CSS vars + built-in prose rules.
|
|
327
|
+
* `"inherit"` — SDK applies NO inline styles; only CSS classes and
|
|
328
|
+
* `data-*` attributes are rendered so the host site has full control.
|
|
329
|
+
*
|
|
330
|
+
* In all modes the content body div has:
|
|
331
|
+
* - `className="dsa-article-body"`
|
|
332
|
+
* - `data-dsa-article-body`
|
|
333
|
+
*
|
|
334
|
+
* @default "light"
|
|
335
|
+
*/
|
|
336
|
+
theme?: ArticleTheme;
|
|
337
|
+
/** Disable built-in prose styles injected via `<style>`. Works only in light/dark themes. */
|
|
338
|
+
disableProseStyles?: boolean;
|
|
301
339
|
components?: {
|
|
302
340
|
H1?: React.ComponentType<{
|
|
303
341
|
children: React.ReactNode;
|
|
@@ -312,12 +350,31 @@ interface ArticlePageProps {
|
|
|
312
350
|
}
|
|
313
351
|
/**
|
|
314
352
|
* Full article page with optional TOC, FAQ, related articles, and JSON-LD.
|
|
315
|
-
* Supports theme="light" | "dark" | "inherit" via CSS variables.
|
|
316
353
|
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
354
|
+
* **light / dark** — SDK applies inline styles with `--dsa-*` CSS variable
|
|
355
|
+
* overrides, plus built-in prose rules for the article body.
|
|
356
|
+
*
|
|
357
|
+
* **inherit** — SDK renders only semantic HTML with stable CSS classes
|
|
358
|
+
* and `data-*` attributes. No inline styles, no injected `<style>`.
|
|
359
|
+
*
|
|
360
|
+
* ### Stable CSS selectors (always present)
|
|
361
|
+
*
|
|
362
|
+
* | Element | Class | Data attribute |
|
|
363
|
+
* |---------|-------|----------------|
|
|
364
|
+
* | Root | `className` prop | `data-dsa-theme` |
|
|
365
|
+
* | Body | `dsa-article-body` + `contentClassName` | `data-dsa-article-body` |
|
|
366
|
+
* | TOC | `dsa-toc` | `data-dsa-toc` |
|
|
367
|
+
* | Meta | `dsa-meta` | `data-dsa-meta` |
|
|
368
|
+
*
|
|
369
|
+
* ```tsx
|
|
370
|
+
* // Works out of the box
|
|
371
|
+
* <ArticlePage article={article} />
|
|
372
|
+
*
|
|
373
|
+
* // Inherit — host site provides all styles
|
|
374
|
+
* <ArticlePage article={article} theme="inherit" contentClassName="prose dark:prose-invert" />
|
|
375
|
+
* ```
|
|
319
376
|
*/
|
|
320
|
-
declare function ArticlePage({ article, showFaq, showTableOfContents, showMeta, showRelated, relatedArticles, onRelatedClick, className, theme, components, }: ArticlePageProps): react_jsx_runtime.JSX.Element;
|
|
377
|
+
declare function ArticlePage({ article, showFaq, showTableOfContents, showMeta, showRelated, relatedArticles, onRelatedClick, className, contentClassName, theme, disableProseStyles, components, }: ArticlePageProps): react_jsx_runtime.JSX.Element;
|
|
321
378
|
|
|
322
379
|
interface FaqBlockProps {
|
|
323
380
|
items: FaqItem[];
|
|
@@ -354,7 +411,7 @@ declare function RelatedArticles({ articles, title, limit, onArticleClick, class
|
|
|
354
411
|
* Use in page.tsx generateMetadata():
|
|
355
412
|
*
|
|
356
413
|
* ```ts
|
|
357
|
-
* import { generateArticleMetadata } from "@
|
|
414
|
+
* import { generateArticleMetadata } from "@dsaplatform/content-sdk/server";
|
|
358
415
|
*
|
|
359
416
|
* export async function generateMetadata({ params }) {
|
|
360
417
|
* const article = await fetchArticleBySlug(config, params.slug);
|
|
@@ -365,7 +422,8 @@ declare function RelatedArticles({ articles, title, limit, onArticleClick, class
|
|
|
365
422
|
declare function generateArticleMetadata(article: Article, siteUrl?: string): Record<string, any>;
|
|
366
423
|
/**
|
|
367
424
|
* Renders JSON-LD structured data for an article.
|
|
368
|
-
*
|
|
425
|
+
* Outputs Article schema (with Author, Publisher, Speakable, FAQ)
|
|
426
|
+
* and BreadcrumbList schema when siteUrl is provided.
|
|
369
427
|
*
|
|
370
428
|
* ```tsx
|
|
371
429
|
* <SeoMetaBridge article={article} siteUrl="https://example.com" />
|
|
@@ -376,4 +434,4 @@ declare function SeoMetaBridge({ article, siteUrl, }: {
|
|
|
376
434
|
siteUrl?: string;
|
|
377
435
|
}): react_jsx_runtime.JSX.Element;
|
|
378
436
|
|
|
379
|
-
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 };
|
|
437
|
+
export { type Article, type ArticleAuthor, ArticleFeed, type ArticleFeedProps, type ArticleFilters, type ArticleHeading, type ArticleListItem, ArticlePage, type ArticlePageProps, type ArticlePublisher, type ArticleTheme, 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.d.ts
CHANGED
|
@@ -45,6 +45,10 @@ interface Article {
|
|
|
45
45
|
pillar_name?: string;
|
|
46
46
|
cluster_name?: string;
|
|
47
47
|
content_type?: string;
|
|
48
|
+
/** Author info from site settings (E-E-A-T) */
|
|
49
|
+
author?: ArticleAuthor | null;
|
|
50
|
+
/** Publisher info from site settings (E-E-A-T) */
|
|
51
|
+
publisher?: ArticlePublisher | null;
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
50
54
|
* Abbreviated article for lists
|
|
@@ -88,6 +92,25 @@ interface InternalLink {
|
|
|
88
92
|
slug: string;
|
|
89
93
|
anchor_text: string;
|
|
90
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Author information (E-E-A-T) — populated from site settings
|
|
97
|
+
*/
|
|
98
|
+
interface ArticleAuthor {
|
|
99
|
+
name: string;
|
|
100
|
+
url?: string | null;
|
|
101
|
+
bio?: string | null;
|
|
102
|
+
image_url?: string | null;
|
|
103
|
+
job_title?: string | null;
|
|
104
|
+
socials?: Record<string, string>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Publisher information (E-E-A-T) — populated from site settings
|
|
108
|
+
*/
|
|
109
|
+
interface ArticlePublisher {
|
|
110
|
+
name: string;
|
|
111
|
+
logo_url?: string | null;
|
|
112
|
+
url?: string | null;
|
|
113
|
+
}
|
|
91
114
|
/**
|
|
92
115
|
* Category with clusters
|
|
93
116
|
*/
|
|
@@ -287,6 +310,7 @@ interface ArticleFeedProps {
|
|
|
287
310
|
*/
|
|
288
311
|
declare function ArticleFeed({ articles, layout, columns, showExcerpt, showImage, showMeta, onArticleClick, className, theme, renderArticle, }: ArticleFeedProps): react_jsx_runtime.JSX.Element;
|
|
289
312
|
|
|
313
|
+
type ArticleTheme = 'light' | 'dark' | 'inherit';
|
|
290
314
|
interface ArticlePageProps {
|
|
291
315
|
article: Article;
|
|
292
316
|
showFaq?: boolean;
|
|
@@ -296,8 +320,22 @@ interface ArticlePageProps {
|
|
|
296
320
|
relatedArticles?: ArticleListItem[];
|
|
297
321
|
onRelatedClick?: (slug: string) => void;
|
|
298
322
|
className?: string;
|
|
299
|
-
/**
|
|
300
|
-
|
|
323
|
+
/** Extra class(es) on the `<div>` that wraps `content_html`. */
|
|
324
|
+
contentClassName?: string;
|
|
325
|
+
/**
|
|
326
|
+
* `"light"` / `"dark"` — SDK applies inline styles + CSS vars + built-in prose rules.
|
|
327
|
+
* `"inherit"` — SDK applies NO inline styles; only CSS classes and
|
|
328
|
+
* `data-*` attributes are rendered so the host site has full control.
|
|
329
|
+
*
|
|
330
|
+
* In all modes the content body div has:
|
|
331
|
+
* - `className="dsa-article-body"`
|
|
332
|
+
* - `data-dsa-article-body`
|
|
333
|
+
*
|
|
334
|
+
* @default "light"
|
|
335
|
+
*/
|
|
336
|
+
theme?: ArticleTheme;
|
|
337
|
+
/** Disable built-in prose styles injected via `<style>`. Works only in light/dark themes. */
|
|
338
|
+
disableProseStyles?: boolean;
|
|
301
339
|
components?: {
|
|
302
340
|
H1?: React.ComponentType<{
|
|
303
341
|
children: React.ReactNode;
|
|
@@ -312,12 +350,31 @@ interface ArticlePageProps {
|
|
|
312
350
|
}
|
|
313
351
|
/**
|
|
314
352
|
* Full article page with optional TOC, FAQ, related articles, and JSON-LD.
|
|
315
|
-
* Supports theme="light" | "dark" | "inherit" via CSS variables.
|
|
316
353
|
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
354
|
+
* **light / dark** — SDK applies inline styles with `--dsa-*` CSS variable
|
|
355
|
+
* overrides, plus built-in prose rules for the article body.
|
|
356
|
+
*
|
|
357
|
+
* **inherit** — SDK renders only semantic HTML with stable CSS classes
|
|
358
|
+
* and `data-*` attributes. No inline styles, no injected `<style>`.
|
|
359
|
+
*
|
|
360
|
+
* ### Stable CSS selectors (always present)
|
|
361
|
+
*
|
|
362
|
+
* | Element | Class | Data attribute |
|
|
363
|
+
* |---------|-------|----------------|
|
|
364
|
+
* | Root | `className` prop | `data-dsa-theme` |
|
|
365
|
+
* | Body | `dsa-article-body` + `contentClassName` | `data-dsa-article-body` |
|
|
366
|
+
* | TOC | `dsa-toc` | `data-dsa-toc` |
|
|
367
|
+
* | Meta | `dsa-meta` | `data-dsa-meta` |
|
|
368
|
+
*
|
|
369
|
+
* ```tsx
|
|
370
|
+
* // Works out of the box
|
|
371
|
+
* <ArticlePage article={article} />
|
|
372
|
+
*
|
|
373
|
+
* // Inherit — host site provides all styles
|
|
374
|
+
* <ArticlePage article={article} theme="inherit" contentClassName="prose dark:prose-invert" />
|
|
375
|
+
* ```
|
|
319
376
|
*/
|
|
320
|
-
declare function ArticlePage({ article, showFaq, showTableOfContents, showMeta, showRelated, relatedArticles, onRelatedClick, className, theme, components, }: ArticlePageProps): react_jsx_runtime.JSX.Element;
|
|
377
|
+
declare function ArticlePage({ article, showFaq, showTableOfContents, showMeta, showRelated, relatedArticles, onRelatedClick, className, contentClassName, theme, disableProseStyles, components, }: ArticlePageProps): react_jsx_runtime.JSX.Element;
|
|
321
378
|
|
|
322
379
|
interface FaqBlockProps {
|
|
323
380
|
items: FaqItem[];
|
|
@@ -354,7 +411,7 @@ declare function RelatedArticles({ articles, title, limit, onArticleClick, class
|
|
|
354
411
|
* Use in page.tsx generateMetadata():
|
|
355
412
|
*
|
|
356
413
|
* ```ts
|
|
357
|
-
* import { generateArticleMetadata } from "@
|
|
414
|
+
* import { generateArticleMetadata } from "@dsaplatform/content-sdk/server";
|
|
358
415
|
*
|
|
359
416
|
* export async function generateMetadata({ params }) {
|
|
360
417
|
* const article = await fetchArticleBySlug(config, params.slug);
|
|
@@ -365,7 +422,8 @@ declare function RelatedArticles({ articles, title, limit, onArticleClick, class
|
|
|
365
422
|
declare function generateArticleMetadata(article: Article, siteUrl?: string): Record<string, any>;
|
|
366
423
|
/**
|
|
367
424
|
* Renders JSON-LD structured data for an article.
|
|
368
|
-
*
|
|
425
|
+
* Outputs Article schema (with Author, Publisher, Speakable, FAQ)
|
|
426
|
+
* and BreadcrumbList schema when siteUrl is provided.
|
|
369
427
|
*
|
|
370
428
|
* ```tsx
|
|
371
429
|
* <SeoMetaBridge article={article} siteUrl="https://example.com" />
|
|
@@ -376,4 +434,4 @@ declare function SeoMetaBridge({ article, siteUrl, }: {
|
|
|
376
434
|
siteUrl?: string;
|
|
377
435
|
}): react_jsx_runtime.JSX.Element;
|
|
378
436
|
|
|
379
|
-
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 };
|
|
437
|
+
export { type Article, type ArticleAuthor, ArticleFeed, type ArticleFeedProps, type ArticleFilters, type ArticleHeading, type ArticleListItem, ArticlePage, type ArticlePageProps, type ArticlePublisher, type ArticleTheme, 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
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var $=Object.create;var A=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var K=(e,t)=>{for(var r in t)A(e,r,{get:t[r],enumerable:!0})},F=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of j(t))!O.call(e,n)&&n!==r&&A(e,n,{get:()=>t[n],enumerable:!(o=N(t,n))||o.enumerable});return e};var V=(e,t,r)=>(r=e!=null?$(W(e)):{},F(t||!e||!e.__esModule?A(r,"default",{value:e,enumerable:!0}):r,e)),G=e=>F(A({},"__esModule",{value:!0}),e);var re={};K(re,{ArticleFeed:()=>w,ArticlePage:()=>k,ContentClient:()=>y,DsaContentProvider:()=>I,FaqBlock:()=>v,RelatedArticles:()=>_,SeoMetaBridge:()=>P,generateArticleMetadata:()=>R,useArticle:()=>D,useArticles:()=>L,useCategories:()=>E,useDsaContent:()=>h,useRelatedArticles:()=>z});module.exports=G(re);var y=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 o=new URL(`${this.apiUrl}${t}`);r&&Object.entries(r).forEach(([i,p])=>{p!=null&&p!==""&&o.searchParams.set(i,String(p))}),o.searchParams.set("site_key",this.apiKey);let n={method:"GET",headers:{"X-API-Key":this.apiKey},cache:this.cacheStrategy};this.revalidateSeconds&&this.cacheStrategy!=="no-cache"&&(n.next={revalidate:this.revalidateSeconds});let a=await fetch(o.toString(),n);if(!a.ok){let i=await a.text().catch(()=>"");throw new Error(`DSA Content API error ${a.status}: ${i||a.statusText}`)}return a.json()}normalizeArticle(t){return{...t,headings:t.headings??[],faq:t.faq??[],internal_links:t.internal_links??[],secondary_keywords:t.secondary_keywords??[],schema_json:t.schema_json??null,content_json:t.content_json??null}}async getArticles(t){let r=await 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});return{items:r.items??r.data??[],total:r.total??0,page:r.page??1,per_page:r.per_page??20,total_pages:r.total_pages??r.pages??1}}async getArticleBySlug(t){let r=await this.request(`/api/public/articles/${encodeURIComponent(t)}`);return this.normalizeArticle(r)}async getRelatedArticles(t,r=3){let o=await this.request(`/api/public/articles/${encodeURIComponent(t)}/related`,{limit:r});return o.items??(Array.isArray(o)?o:[])}async getCategories(){let t=await this.request("/api/public/categories");return t.items??(Array.isArray(t)?t:[])}async getSitemap(){let t=await this.request("/api/public/sitemap");return t.items??(Array.isArray(t)?t:[])}};var b=require("react");var T=require("react/jsx-runtime"),q=(0,b.createContext)(null);function I({config:e,children:t}){let r=(0,b.useMemo)(()=>new y(e),[e.apiUrl,e.apiKey]);return(0,T.jsx)(q.Provider,{value:r,children:t})}function h(){let e=(0,b.useContext)(q);if(!e)throw new Error("useDsaContent() must be used inside <DsaContentProvider>");return e}var l=require("react");function L(e){let t=h(),[r,o]=(0,l.useState)({articles:[],loading:!0,error:null,pagination:{page:1,per_page:10,total:0,total_pages:0}}),n=(0,l.useCallback)(()=>{o(a=>({...a,loading:!0,error:null})),t.getArticles(e).then(a=>o({articles:a.items,loading:!1,error:null,pagination:{page:a.page,per_page:a.per_page,total:a.total,total_pages:a.total_pages}})).catch(a=>o(i=>({...i,loading:!1,error:a instanceof Error?a:new Error(String(a))})))},[t,e?.page,e?.per_page,e?.pillar,e?.cluster,e?.content_type,e?.search]);return(0,l.useEffect)(()=>{n()},[n]),{...r,refetch:n}}function D(e){let t=h(),[r,o]=(0,l.useState)({article:null,loading:!0,error:null}),n=(0,l.useCallback)(()=>{if(!e){o({article:null,loading:!1,error:null});return}o(a=>({...a,loading:!0,error:null})),t.getArticleBySlug(e).then(a=>o({article:a,loading:!1,error:null})).catch(a=>o({article:null,loading:!1,error:a instanceof Error?a:new Error(String(a))}))},[t,e]);return(0,l.useEffect)(()=>{n()},[n]),{...r,refetch:n}}function z(e,t=3){let r=h(),[o,n]=(0,l.useState)({articles:[],loading:!0,error:null}),a=(0,l.useCallback)(()=>{if(!e){n({articles:[],loading:!1,error:null});return}n(i=>({...i,loading:!0,error:null})),r.getRelatedArticles(e,t).then(i=>n({articles:i,loading:!1,error:null})).catch(i=>n({articles:[],loading:!1,error:i instanceof Error?i:new Error(String(i))}))},[r,e,t]);return(0,l.useEffect)(()=>{a()},[a]),{...o,refetch:a}}function E(){let e=h(),[t,r]=(0,l.useState)({categories:[],loading:!0,error:null}),o=(0,l.useCallback)(()=>{r(n=>({...n,loading:!0,error:null})),e.getCategories().then(n=>r({categories:n,loading:!1,error:null})).catch(n=>r({categories:[],loading:!1,error:n instanceof Error?n:new Error(String(n))}))},[e]);return(0,l.useEffect)(()=>{o()},[o]),{...t,refetch:o}}var C=V(require("react")),c=require("react/jsx-runtime"),J={light:{"--dsa-text":"#111827","--dsa-text-muted":"#6b7280","--dsa-text-faint":"#9ca3af","--dsa-card-bg":"#fff","--dsa-card-border":"#e5e7eb","--dsa-badge-bg":"#f3f4f6","--dsa-badge-text":"#4b5563","--dsa-hover-shadow":"0 4px 12px rgba(0,0,0,0.08)"},dark:{"--dsa-text":"#f3f4f6","--dsa-text-muted":"#9ca3af","--dsa-text-faint":"#6b7280","--dsa-card-bg":"#1f2937","--dsa-card-border":"#374151","--dsa-badge-bg":"#374151","--dsa-badge-text":"#d1d5db","--dsa-hover-shadow":"0 4px 12px rgba(0,0,0,0.3)"}};function Q({article:e,layout:t,showExcerpt:r,showImage:o,showMeta:n,onClick:a}){let i=t==="grid",[p,d]=C.default.useState(!1),m={...i?{border:"1px solid var(--dsa-card-border)",borderRadius:"0.75rem",overflow:"hidden",background:"var(--dsa-card-bg)",cursor:"pointer",transition:"box-shadow 0.2s"}:{display:"flex",border:"1px solid var(--dsa-card-border)",borderRadius:"0.75rem",overflow:"hidden",background:"var(--dsa-card-bg)",cursor:"pointer",transition:"box-shadow 0.2s"},...p?{boxShadow:"var(--dsa-hover-shadow)"}:{}};return(0,c.jsxs)("article",{style:m,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onClick:a,role:"link",tabIndex:0,onKeyDown:x=>x.key==="Enter"&&a?.(),children:[o&&e.featured_image_url&&(0,c.jsx)("img",{src:e.featured_image_url,alt:e.featured_image_alt||e.title,style:i?{width:"100%",height:"200px",objectFit:"cover",display:"block"}:{width:"240px",minHeight:"160px",objectFit:"cover",flexShrink:0},loading:"lazy"}),(0,c.jsxs)("div",{style:i?{padding:"1.25rem"}:{padding:"1.25rem",flex:1},children:[(0,c.jsx)("h3",{style:{margin:"0 0 0.5rem",fontSize:"1.125rem",fontWeight:600,lineHeight:1.3,color:"var(--dsa-text)"},children:e.title}),r&&e.excerpt&&(0,c.jsx)("p",{style:{margin:"0 0 0.75rem",fontSize:"0.875rem",color:"var(--dsa-text-muted)",lineHeight:1.5},children:e.excerpt}),n&&(0,c.jsxs)("div",{style:{display:"flex",gap:"0.75rem",fontSize:"0.75rem",color:"var(--dsa-text-faint)",flexWrap:"wrap"},children:[e.pillar_name&&(0,c.jsx)("span",{style:{display:"inline-block",padding:"0.125rem 0.5rem",borderRadius:"9999px",background:"var(--dsa-badge-bg)",fontSize:"0.75rem",color:"var(--dsa-badge-text)"},children:e.pillar_name}),e.content_type&&(0,c.jsx)("span",{style:{display:"inline-block",padding:"0.125rem 0.5rem",borderRadius:"9999px",background:"var(--dsa-badge-bg)",fontSize:"0.75rem",color:"var(--dsa-badge-text)"},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:o=!0,showImage:n=!0,showMeta:a=!0,onArticleClick:i,className:p,theme:d="light",renderArticle:m}){let x=t==="grid"?`repeat(${r}, 1fr)`:"1fr",S=d!=="inherit"?J[d]:{};return(0,c.jsx)("div",{className:p,style:{display:"grid",gap:"1.5rem",gridTemplateColumns:x,...S},children:(e??[]).map(f=>m?(0,c.jsx)(C.default.Fragment,{children:m(f)},f.id):(0,c.jsx)(Q,{article:f,layout:t,showExcerpt:o,showImage:n,showMeta:a,onClick:()=>i?.(f.slug)},f.id))})}var U=require("react"),g=require("react/jsx-runtime"),X={light:{"--dsa-text":"#111827","--dsa-text-muted":"#4b5563","--dsa-text-faint":"#9ca3af","--dsa-divider":"#e5e7eb"},dark:{"--dsa-text":"#f3f4f6","--dsa-text-muted":"#d1d5db","--dsa-text-faint":"#6b7280","--dsa-divider":"#374151"}};function Y({item:e,collapsible:t,defaultOpen:r}){let[o,n]=(0,U.useState)(r);return t?(0,g.jsxs)("div",{style:{borderBottom:"1px solid var(--dsa-divider)",padding:"0.75rem 0"},children:[(0,g.jsxs)("button",{style:{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:"var(--dsa-text)",fontFamily:"inherit"},onClick:()=>n(!o),"aria-expanded":o,children:[(0,g.jsx)("span",{children:e.question}),(0,g.jsx)("span",{style:{flexShrink:0,marginLeft:"1rem",transition:"transform 0.2s",fontSize:"1.25rem",color:"var(--dsa-text-faint)",transform:o?"rotate(180deg)":"rotate(0deg)"},children:"\u25BC"})]}),o&&(0,g.jsx)("div",{style:{fontSize:"0.9375rem",color:"var(--dsa-text-muted)",lineHeight:1.6,paddingTop:"0.5rem"},children:e.answer})]}):(0,g.jsxs)("div",{style:{borderBottom:"1px solid var(--dsa-divider)",padding:"0.75rem 0"},children:[(0,g.jsx)("p",{style:{fontSize:"1rem",fontWeight:600,color:"var(--dsa-text)",margin:"0 0 0.5rem"},children:e.question}),(0,g.jsx)("div",{style:{fontSize:"0.9375rem",color:"var(--dsa-text-muted)",lineHeight:1.6},children:e.answer})]})}function v({items:e,collapsible:t=!0,defaultOpen:r=!1,className:o,title:n="Frequently Asked Questions",theme:a="light"}){if(!e||e.length===0)return null;let i=a!=="inherit"?X[a]:{},p={"@context":"https://schema.org","@type":"FAQPage",mainEntity:e.map(d=>({"@type":"Question",name:d.question,acceptedAnswer:{"@type":"Answer",text:d.answer}}))};return(0,g.jsxs)("section",{className:o,style:{marginTop:"1rem",...i},children:[(0,g.jsx)("h2",{style:{fontSize:"1.5rem",fontWeight:700,color:"var(--dsa-text)",margin:"0 0 1rem"},children:n}),e.map((d,m)=>(0,g.jsx)(Y,{item:d,collapsible:t,defaultOpen:r},m)),(0,g.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(p)}})]})}var u=require("react/jsx-runtime"),Z={light:{"--dsa-text":"#111827","--dsa-text-muted":"#6b7280","--dsa-card-bg":"#fff","--dsa-card-border":"#e5e7eb"},dark:{"--dsa-text":"#f3f4f6","--dsa-text-muted":"#9ca3af","--dsa-card-bg":"#1f2937","--dsa-card-border":"#374151"}};function _({articles:e,title:t="Related Articles",limit:r=3,onArticleClick:o,className:n,theme:a="light"}){let i=(e??[]).slice(0,r);if(i.length===0)return null;let p=a!=="inherit"?Z[a]:{};return(0,u.jsxs)("section",{className:n,style:{marginTop:"1rem",...p},children:[(0,u.jsx)("h3",{style:{fontSize:"1.25rem",fontWeight:700,color:"var(--dsa-text)",margin:"0 0 1rem"},children:t}),(0,u.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(250px, 1fr))",gap:"1rem"},children:i.map(d=>(0,u.jsxs)("div",{style:{border:"1px solid var(--dsa-card-border)",borderRadius:"0.5rem",overflow:"hidden",cursor:"pointer",transition:"box-shadow 0.2s",background:"var(--dsa-card-bg)"},onClick:()=>o?.(d.slug),role:"link",tabIndex:0,onKeyDown:m=>m.key==="Enter"&&o?.(d.slug),children:[d.featured_image_url&&(0,u.jsx)("img",{src:d.featured_image_url,alt:d.featured_image_alt||d.title,style:{width:"100%",height:"140px",objectFit:"cover",display:"block"},loading:"lazy"}),(0,u.jsxs)("div",{style:{padding:"1rem"},children:[(0,u.jsx)("h4",{style:{fontSize:"0.9375rem",fontWeight:600,color:"var(--dsa-text)",margin:0,lineHeight:1.3},children:d.title}),d.excerpt&&(0,u.jsx)("p",{style:{fontSize:"0.8125rem",color:"var(--dsa-text-muted)",marginTop:"0.5rem",lineHeight:1.4},children:d.excerpt})]})]},d.id))})]})}var s=require("react/jsx-runtime"),ee={light:{"--dsa-text":"#111827","--dsa-text-muted":"#6b7280","--dsa-text-faint":"#9ca3af","--dsa-card-bg":"#fff","--dsa-card-border":"#e5e7eb","--dsa-toc-bg":"#f9fafb","--dsa-badge-bg":"#eff6ff","--dsa-badge-text":"#2563eb","--dsa-badge-alt-bg":"#f0fdf4","--dsa-badge-alt-text":"#16a34a","--dsa-content-text":"#374151","--dsa-divider":"#e5e7eb"},dark:{"--dsa-text":"#f3f4f6","--dsa-text-muted":"#9ca3af","--dsa-text-faint":"#6b7280","--dsa-card-bg":"#1f2937","--dsa-card-border":"#374151","--dsa-toc-bg":"#111827","--dsa-badge-bg":"#1e3a5f","--dsa-badge-text":"#93c5fd","--dsa-badge-alt-bg":"#14532d","--dsa-badge-alt-text":"#86efac","--dsa-content-text":"#d1d5db","--dsa-divider":"#374151"}};function te({headings:e}){return!e||e.length===0?null:(0,s.jsxs)("nav",{style:{background:"var(--dsa-toc-bg, #f9fafb)",border:"1px solid var(--dsa-card-border, #e5e7eb)",borderRadius:"0.75rem",padding:"1.25rem",marginBottom:"2rem"},children:[(0,s.jsx)("p",{style:{fontSize:"0.875rem",fontWeight:600,color:"var(--dsa-text-muted, #374151)",margin:"0 0 0.75rem",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Table of Contents"}),(0,s.jsx)("ul",{style:{listStyle:"none",padding:0,margin:0},children:e.map((t,r)=>(0,s.jsx)("li",{style:{padding:"0.25rem 0",paddingLeft:`${(t.level-2)*1}rem`},children:(0,s.jsx)("a",{href:`#${t.id}`,style:{color:"var(--dsa-text-muted, #4b5563)",textDecoration:"none",fontSize:"0.875rem"},children:t.text})},r))})]})}function k({article:e,showFaq:t=!0,showTableOfContents:r=!0,showMeta:o=!0,showRelated:n=!1,relatedArticles:a,onRelatedClick:i,className:p,theme:d="light",components:m}){let x=m?.H1||(({children:M})=>(0,s.jsx)("h1",{style:{fontSize:"2.25rem",fontWeight:700,lineHeight:1.2,color:"var(--dsa-text)",margin:"0 0 1rem"},children:M})),S=m?.Toc||te,f=m?.Faq||v,H=d!=="inherit"?ee[d]:{};return(0,s.jsxs)("article",{className:p,style:{maxWidth:"48rem",margin:"0 auto",fontFamily:"system-ui, -apple-system, sans-serif",...H},children:[o&&(0,s.jsxs)("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",fontSize:"0.875rem",color:"var(--dsa-text-muted)",marginBottom:"1.5rem"},children:[e.pillar_name&&(0,s.jsx)("span",{style:{display:"inline-block",padding:"0.125rem 0.5rem",borderRadius:"9999px",background:"var(--dsa-badge-bg)",color:"var(--dsa-badge-text)",fontSize:"0.75rem"},children:e.pillar_name}),e.content_type&&(0,s.jsx)("span",{style:{display:"inline-block",padding:"0.125rem 0.5rem",borderRadius:"9999px",background:"var(--dsa-badge-alt-bg, var(--dsa-badge-bg))",color:"var(--dsa-badge-alt-text, var(--dsa-badge-text))",fontSize:"0.75rem"},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)(x,{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:{width:"100%",borderRadius:"0.75rem",marginBottom:"2rem"}}),r&&(e.headings??[]).length>0&&(0,s.jsx)(S,{headings:e.headings}),(0,s.jsx)("div",{style:{lineHeight:1.75,color:"var(--dsa-content-text)",fontSize:"1.0625rem"},dangerouslySetInnerHTML:{__html:e.content_html}}),t&&(e.faq??[]).length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("hr",{style:{border:"none",borderTop:"1px solid var(--dsa-divider)",margin:"2.5rem 0"}}),(0,s.jsx)(f,{items:e.faq})]}),e.schema_json&&(0,s.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e.schema_json)}}),n&&a&&a.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("hr",{style:{border:"none",borderTop:"1px solid var(--dsa-divider)",margin:"2.5rem 0"}}),(0,s.jsx)(_,{articles:a,onArticleClick:i,theme:d})]})]})}var B=require("react/jsx-runtime");function R(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 P({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,B.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});
|
|
2
|
+
"use strict";var Q=Object.create;var k=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var Z=(e,t)=>{for(var a in t)k(e,a,{get:t[a],enumerable:!0})},F=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of G(t))!Y.call(e,o)&&o!==a&&k(e,o,{get:()=>t[o],enumerable:!(r=V(t,o))||r.enumerable});return e};var N=(e,t,a)=>(a=e!=null?Q(X(e)):{},F(t||!e||!e.__esModule?k(a,"default",{value:e,enumerable:!0}):a,e)),ee=e=>F(k({},"__esModule",{value:!0}),e);var ge={};Z(ge,{ArticleFeed:()=>R,ArticlePage:()=>P,ContentClient:()=>y,DsaContentProvider:()=>z,FaqBlock:()=>A,RelatedArticles:()=>S,SeoMetaBridge:()=>I,generateArticleMetadata:()=>q,useArticle:()=>D,useArticles:()=>E,useCategories:()=>$,useDsaContent:()=>h,useRelatedArticles:()=>B});module.exports=ee(ge);var y=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,a){let r=new URL(`${this.apiUrl}${t}`);a&&Object.entries(a).forEach(([i,p])=>{p!=null&&p!==""&&r.searchParams.set(i,String(p))}),r.searchParams.set("site_key",this.apiKey);let o={method:"GET",headers:{"X-API-Key":this.apiKey},cache:this.cacheStrategy};this.revalidateSeconds&&this.cacheStrategy!=="no-cache"&&(o.next={revalidate:this.revalidateSeconds});let s=await fetch(r.toString(),o);if(!s.ok){let i=await s.text().catch(()=>"");throw new Error(`DSA Content API error ${s.status}: ${i||s.statusText}`)}return s.json()}normalizeArticle(t){return{...t,headings:t.headings??[],faq:t.faq??[],internal_links:t.internal_links??[],secondary_keywords:t.secondary_keywords??[],schema_json:t.schema_json??null,content_json:t.content_json??null}}async getArticles(t){let a=await 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});return{items:a.items??a.data??[],total:a.total??0,page:a.page??1,per_page:a.per_page??20,total_pages:a.total_pages??a.pages??1}}async getArticleBySlug(t){let a=await this.request(`/api/public/articles/${encodeURIComponent(t)}`);return this.normalizeArticle(a)}async getRelatedArticles(t,a=3){let r=await this.request(`/api/public/articles/${encodeURIComponent(t)}/related`,{limit:a});return r.items??(Array.isArray(r)?r:[])}async getCategories(){let t=await this.request("/api/public/categories");return t.items??(Array.isArray(t)?t:[])}async getSitemap(){let t=await this.request("/api/public/sitemap");return t.items??(Array.isArray(t)?t:[])}};var x=require("react");var L=require("react/jsx-runtime"),T=(0,x.createContext)(null);function z({config:e,children:t}){let a=(0,x.useMemo)(()=>new y(e),[e.apiUrl,e.apiKey]);return(0,L.jsx)(T.Provider,{value:a,children:t})}function h(){let e=(0,x.useContext)(T);if(!e)throw new Error("useDsaContent() must be used inside <DsaContentProvider>");return e}var c=require("react");function E(e){let t=h(),[a,r]=(0,c.useState)({articles:[],loading:!0,error:null,pagination:{page:1,per_page:10,total:0,total_pages:0}}),o=(0,c.useCallback)(()=>{r(s=>({...s,loading:!0,error:null})),t.getArticles(e).then(s=>r({articles:s.items,loading:!1,error:null,pagination:{page:s.page,per_page:s.per_page,total:s.total,total_pages:s.total_pages}})).catch(s=>r(i=>({...i,loading:!1,error:s instanceof Error?s:new Error(String(s))})))},[t,e?.page,e?.per_page,e?.pillar,e?.cluster,e?.content_type,e?.search]);return(0,c.useEffect)(()=>{o()},[o]),{...a,refetch:o}}function D(e){let t=h(),[a,r]=(0,c.useState)({article:null,loading:!0,error:null}),o=(0,c.useCallback)(()=>{if(!e){r({article:null,loading:!1,error:null});return}r(s=>({...s,loading:!0,error:null})),t.getArticleBySlug(e).then(s=>r({article:s,loading:!1,error:null})).catch(s=>r({article:null,loading:!1,error:s instanceof Error?s:new Error(String(s))}))},[t,e]);return(0,c.useEffect)(()=>{o()},[o]),{...a,refetch:o}}function B(e,t=3){let a=h(),[r,o]=(0,c.useState)({articles:[],loading:!0,error:null}),s=(0,c.useCallback)(()=>{if(!e){o({articles:[],loading:!1,error:null});return}o(i=>({...i,loading:!0,error:null})),a.getRelatedArticles(e,t).then(i=>o({articles:i,loading:!1,error:null})).catch(i=>o({articles:[],loading:!1,error:i instanceof Error?i:new Error(String(i))}))},[a,e,t]);return(0,c.useEffect)(()=>{s()},[s]),{...r,refetch:s}}function $(){let e=h(),[t,a]=(0,c.useState)({categories:[],loading:!0,error:null}),r=(0,c.useCallback)(()=>{a(o=>({...o,loading:!0,error:null})),e.getCategories().then(o=>a({categories:o,loading:!1,error:null})).catch(o=>a({categories:[],loading:!1,error:o instanceof Error?o:new Error(String(o))}))},[e]);return(0,c.useEffect)(()=>{r()},[r]),{...t,refetch:r}}var C=N(require("react")),m=require("react/jsx-runtime"),te={light:{"--dsa-text":"#111827","--dsa-text-muted":"#6b7280","--dsa-text-faint":"#9ca3af","--dsa-card-bg":"#fff","--dsa-card-border":"#e5e7eb","--dsa-badge-bg":"#f3f4f6","--dsa-badge-text":"#4b5563","--dsa-hover-shadow":"0 4px 12px rgba(0,0,0,0.08)"},dark:{"--dsa-text":"#f3f4f6","--dsa-text-muted":"#9ca3af","--dsa-text-faint":"#6b7280","--dsa-card-bg":"#1f2937","--dsa-card-border":"#374151","--dsa-badge-bg":"#374151","--dsa-badge-text":"#d1d5db","--dsa-hover-shadow":"0 4px 12px rgba(0,0,0,0.3)"}};function ae({article:e,layout:t,showExcerpt:a,showImage:r,showMeta:o,onClick:s}){let i=t==="grid",[p,l]=C.default.useState(!1),u={...i?{border:"1px solid var(--dsa-card-border)",borderRadius:"0.75rem",overflow:"hidden",background:"var(--dsa-card-bg)",cursor:"pointer",transition:"box-shadow 0.2s"}:{display:"flex",border:"1px solid var(--dsa-card-border)",borderRadius:"0.75rem",overflow:"hidden",background:"var(--dsa-card-bg)",cursor:"pointer",transition:"box-shadow 0.2s"},...p?{boxShadow:"var(--dsa-hover-shadow)"}:{}};return(0,m.jsxs)("article",{style:u,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onClick:s,role:"link",tabIndex:0,onKeyDown:v=>v.key==="Enter"&&s?.(),children:[r&&e.featured_image_url&&(0,m.jsx)("img",{src:e.featured_image_url,alt:e.featured_image_alt||e.title,style:i?{width:"100%",height:"200px",objectFit:"cover",display:"block"}:{width:"240px",minHeight:"160px",objectFit:"cover",flexShrink:0},loading:"lazy"}),(0,m.jsxs)("div",{style:i?{padding:"1.25rem"}:{padding:"1.25rem",flex:1},children:[(0,m.jsx)("h3",{style:{margin:"0 0 0.5rem",fontSize:"1.125rem",fontWeight:600,lineHeight:1.3,color:"var(--dsa-text)"},children:e.title}),a&&e.excerpt&&(0,m.jsx)("p",{style:{margin:"0 0 0.75rem",fontSize:"0.875rem",color:"var(--dsa-text-muted)",lineHeight:1.5},children:e.excerpt}),o&&(0,m.jsxs)("div",{style:{display:"flex",gap:"0.75rem",fontSize:"0.75rem",color:"var(--dsa-text-faint)",flexWrap:"wrap"},children:[e.pillar_name&&(0,m.jsx)("span",{style:{display:"inline-block",padding:"0.125rem 0.5rem",borderRadius:"9999px",background:"var(--dsa-badge-bg)",fontSize:"0.75rem",color:"var(--dsa-badge-text)"},children:e.pillar_name}),e.content_type&&(0,m.jsx)("span",{style:{display:"inline-block",padding:"0.125rem 0.5rem",borderRadius:"9999px",background:"var(--dsa-badge-bg)",fontSize:"0.75rem",color:"var(--dsa-badge-text)"},children:e.content_type.replace(/_/g," ")}),e.reading_time_minutes&&(0,m.jsxs)("span",{children:[e.reading_time_minutes," min read"]}),e.published_at&&(0,m.jsx)("span",{children:new Date(e.published_at).toLocaleDateString()})]})]})]})}function R({articles:e,layout:t="grid",columns:a=3,showExcerpt:r=!0,showImage:o=!0,showMeta:s=!0,onArticleClick:i,className:p,theme:l="light",renderArticle:u}){let v=t==="grid"?`repeat(${a}, 1fr)`:"1fr",_=l!=="inherit"?te[l]:{};return(0,m.jsx)("div",{className:p,style:{display:"grid",gap:"1.5rem",gridTemplateColumns:v,..._},children:(e??[]).map(d=>u?(0,m.jsx)(C.default.Fragment,{children:u(d)},d.id):(0,m.jsx)(ae,{article:d,layout:t,showExcerpt:r,showImage:o,showMeta:s,onClick:()=>i?.(d.slug)},d.id))})}var H=N(require("react"));var j=require("react"),g=require("react/jsx-runtime"),re={light:{"--dsa-text":"#111827","--dsa-text-muted":"#4b5563","--dsa-text-faint":"#9ca3af","--dsa-divider":"#e5e7eb"},dark:{"--dsa-text":"#f3f4f6","--dsa-text-muted":"#d1d5db","--dsa-text-faint":"#6b7280","--dsa-divider":"#374151"}};function oe({item:e,collapsible:t,defaultOpen:a}){let[r,o]=(0,j.useState)(a);return t?(0,g.jsxs)("div",{style:{borderBottom:"1px solid var(--dsa-divider)",padding:"0.75rem 0"},children:[(0,g.jsxs)("button",{style:{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:"var(--dsa-text)",fontFamily:"inherit"},onClick:()=>o(!r),"aria-expanded":r,children:[(0,g.jsx)("span",{children:e.question}),(0,g.jsx)("span",{style:{flexShrink:0,marginLeft:"1rem",transition:"transform 0.2s",fontSize:"1.25rem",color:"var(--dsa-text-faint)",transform:r?"rotate(180deg)":"rotate(0deg)"},children:"\u25BC"})]}),r&&(0,g.jsx)("div",{style:{fontSize:"0.9375rem",color:"var(--dsa-text-muted)",lineHeight:1.6,paddingTop:"0.5rem"},children:e.answer})]}):(0,g.jsxs)("div",{style:{borderBottom:"1px solid var(--dsa-divider)",padding:"0.75rem 0"},children:[(0,g.jsx)("p",{style:{fontSize:"1rem",fontWeight:600,color:"var(--dsa-text)",margin:"0 0 0.5rem"},children:e.question}),(0,g.jsx)("div",{style:{fontSize:"0.9375rem",color:"var(--dsa-text-muted)",lineHeight:1.6},children:e.answer})]})}function A({items:e,collapsible:t=!0,defaultOpen:a=!1,className:r,title:o="Frequently Asked Questions",theme:s="light"}){if(!e||e.length===0)return null;let i=s!=="inherit"?re[s]:{},p={"@context":"https://schema.org","@type":"FAQPage",mainEntity:e.map(l=>({"@type":"Question",name:l.question,acceptedAnswer:{"@type":"Answer",text:l.answer}}))};return(0,g.jsxs)("section",{className:r,style:{marginTop:"1rem",...i},children:[(0,g.jsx)("h2",{style:{fontSize:"1.5rem",fontWeight:700,color:"var(--dsa-text)",margin:"0 0 1rem"},children:o}),e.map((l,u)=>(0,g.jsx)(oe,{item:l,collapsible:t,defaultOpen:a},u)),(0,g.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(p)}})]})}var f=require("react/jsx-runtime"),se={light:{"--dsa-text":"#111827","--dsa-text-muted":"#6b7280","--dsa-card-bg":"#fff","--dsa-card-border":"#e5e7eb"},dark:{"--dsa-text":"#f3f4f6","--dsa-text-muted":"#9ca3af","--dsa-card-bg":"#1f2937","--dsa-card-border":"#374151"}};function S({articles:e,title:t="Related Articles",limit:a=3,onArticleClick:r,className:o,theme:s="light"}){let i=(e??[]).slice(0,a);if(i.length===0)return null;let p=s!=="inherit"?se[s]:{};return(0,f.jsxs)("section",{className:o,style:{marginTop:"1rem",...p},children:[(0,f.jsx)("h3",{style:{fontSize:"1.25rem",fontWeight:700,color:"var(--dsa-text)",margin:"0 0 1rem"},children:t}),(0,f.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(250px, 1fr))",gap:"1rem"},children:i.map(l=>(0,f.jsxs)("div",{style:{border:"1px solid var(--dsa-card-border)",borderRadius:"0.5rem",overflow:"hidden",cursor:"pointer",transition:"box-shadow 0.2s",background:"var(--dsa-card-bg)"},onClick:()=>r?.(l.slug),role:"link",tabIndex:0,onKeyDown:u=>u.key==="Enter"&&r?.(l.slug),children:[l.featured_image_url&&(0,f.jsx)("img",{src:l.featured_image_url,alt:l.featured_image_alt||l.title,style:{width:"100%",height:"140px",objectFit:"cover",display:"block"},loading:"lazy"}),(0,f.jsxs)("div",{style:{padding:"1rem"},children:[(0,f.jsx)("h4",{style:{fontSize:"0.9375rem",fontWeight:600,color:"var(--dsa-text)",margin:0,lineHeight:1.3},children:l.title}),l.excerpt&&(0,f.jsx)("p",{style:{fontSize:"0.8125rem",color:"var(--dsa-text-muted)",marginTop:"0.5rem",lineHeight:1.4},children:l.excerpt})]})]},l.id))})]})}var n=require("react/jsx-runtime"),ne={light:{"--dsa-text":"#111827","--dsa-text-muted":"#6b7280","--dsa-text-faint":"#9ca3af","--dsa-card-bg":"#fff","--dsa-card-border":"#e5e7eb","--dsa-toc-bg":"#f9fafb","--dsa-badge-bg":"#eff6ff","--dsa-badge-text":"#2563eb","--dsa-badge-alt-bg":"#f0fdf4","--dsa-badge-alt-text":"#16a34a","--dsa-content-text":"#374151","--dsa-h2-text":"#111827","--dsa-h3-text":"#1f2937","--dsa-h4-text":"#1f2937","--dsa-link":"#2563eb","--dsa-link-hover":"#1d4ed8","--dsa-blockquote-border":"#d1d5db","--dsa-blockquote-text":"#4b5563","--dsa-pre-bg":"#f3f4f6","--dsa-table-border":"#e5e7eb","--dsa-table-header-bg":"#f9fafb","--dsa-divider":"#e5e7eb"},dark:{"--dsa-text":"#f3f4f6","--dsa-text-muted":"#9ca3af","--dsa-text-faint":"#6b7280","--dsa-card-bg":"#1f2937","--dsa-card-border":"#374151","--dsa-toc-bg":"#111827","--dsa-badge-bg":"#1e3a5f","--dsa-badge-text":"#93c5fd","--dsa-badge-alt-bg":"#14532d","--dsa-badge-alt-text":"#86efac","--dsa-content-text":"#d1d5db","--dsa-h2-text":"#f3f4f6","--dsa-h3-text":"#e5e7eb","--dsa-h4-text":"#e5e7eb","--dsa-link":"#60a5fa","--dsa-link-hover":"#93c5fd","--dsa-blockquote-border":"#4b5563","--dsa-blockquote-text":"#9ca3af","--dsa-pre-bg":"#111827","--dsa-table-border":"#374151","--dsa-table-header-bg":"#111827","--dsa-divider":"#374151"}},U="dsa-article-prose",ie=`
|
|
3
|
+
[data-dsa-article-body] h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; color: var(--dsa-h2-text, #111827); margin: 2rem 0 0.75rem; }
|
|
4
|
+
[data-dsa-article-body] h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; color: var(--dsa-h3-text, #1f2937); margin: 1.75rem 0 0.5rem; }
|
|
5
|
+
[data-dsa-article-body] h4 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; color: var(--dsa-h4-text, #1f2937); margin: 1.5rem 0 0.5rem; }
|
|
6
|
+
[data-dsa-article-body] p { margin: 0 0 1.25rem; }
|
|
7
|
+
[data-dsa-article-body] ul,
|
|
8
|
+
[data-dsa-article-body] ol { margin: 0 0 1.25rem; padding-left: 1.5rem; }
|
|
9
|
+
[data-dsa-article-body] li { margin: 0 0 0.375rem; }
|
|
10
|
+
[data-dsa-article-body] li > ul,
|
|
11
|
+
[data-dsa-article-body] li > ol { margin: 0.375rem 0 0; }
|
|
12
|
+
[data-dsa-article-body] blockquote { margin: 1.5rem 0; padding: 0.75rem 1.25rem; border-left: 4px solid var(--dsa-blockquote-border, #d1d5db); color: var(--dsa-blockquote-text, #4b5563); font-style: italic; }
|
|
13
|
+
[data-dsa-article-body] pre { margin: 1.5rem 0; padding: 1rem; background: var(--dsa-pre-bg, #f3f4f6); border-radius: 0.5rem; overflow-x: auto; font-size: 0.875rem; }
|
|
14
|
+
[data-dsa-article-body] code { font-size: 0.875em; }
|
|
15
|
+
[data-dsa-article-body] table { width: 100%; margin: 1.5rem 0; border-collapse: collapse; font-size: 0.9375rem; }
|
|
16
|
+
[data-dsa-article-body] th,
|
|
17
|
+
[data-dsa-article-body] td { padding: 0.5rem 0.75rem; border: 1px solid var(--dsa-table-border, #e5e7eb); text-align: left; }
|
|
18
|
+
[data-dsa-article-body] th { background: var(--dsa-table-header-bg, #f9fafb); font-weight: 600; }
|
|
19
|
+
[data-dsa-article-body] img { max-width: 100%; height: auto; border-radius: 0.5rem; margin: 1.5rem 0; }
|
|
20
|
+
[data-dsa-article-body] a { color: var(--dsa-link, #2563eb); text-decoration: underline; text-underline-offset: 2px; }
|
|
21
|
+
[data-dsa-article-body] a:hover { color: var(--dsa-link-hover, #1d4ed8); }
|
|
22
|
+
[data-dsa-article-body] hr { border: none; border-top: 1px solid var(--dsa-divider, #e5e7eb); margin: 2rem 0; }
|
|
23
|
+
[data-dsa-article-body] > *:first-child { margin-top: 0; }
|
|
24
|
+
[data-dsa-article-body] > *:last-child { margin-bottom: 0; }
|
|
25
|
+
`.trim();function de(e){H.default.useEffect(()=>{if(!e||typeof document>"u"||document.getElementById(U))return;let t=document.createElement("style");t.id=U,t.textContent=ie,document.head.appendChild(t)},[e])}function le({headings:e}){return!e||e.length===0?null:(0,n.jsxs)("nav",{className:"dsa-toc","data-dsa-toc":"",style:{background:"var(--dsa-toc-bg, #f9fafb)",border:"1px solid var(--dsa-card-border, #e5e7eb)",borderRadius:"0.75rem",padding:"1.25rem",marginBottom:"2rem"},children:[(0,n.jsx)("p",{style:{fontSize:"0.875rem",fontWeight:600,color:"var(--dsa-text-muted, #374151)",margin:"0 0 0.75rem",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Table of Contents"}),(0,n.jsx)("ul",{style:{listStyle:"none",padding:0,margin:0},children:e.map((t,a)=>(0,n.jsx)("li",{style:{padding:"0.25rem 0",paddingLeft:`${(t.level-2)*1}rem`},children:(0,n.jsx)("a",{href:`#${t.id}`,style:{color:"var(--dsa-text-muted, #4b5563)",textDecoration:"none",fontSize:"0.875rem"},children:t.text})},a))})]})}function ce({headings:e}){return!e||e.length===0?null:(0,n.jsxs)("nav",{className:"dsa-toc","data-dsa-toc":"",children:[(0,n.jsx)("p",{className:"dsa-toc-title",children:"Table of Contents"}),(0,n.jsx)("ul",{className:"dsa-toc-list",children:e.map((t,a)=>(0,n.jsx)("li",{className:"dsa-toc-item",style:{paddingLeft:`${(t.level-2)*1}rem`},children:(0,n.jsx)("a",{href:`#${t.id}`,className:"dsa-toc-link",children:t.text})},a))})]})}function P({article:e,showFaq:t=!0,showTableOfContents:a=!0,showMeta:r=!0,showRelated:o=!1,relatedArticles:s,onRelatedClick:i,className:p,contentClassName:l,theme:u="light",disableProseStyles:v=!1,components:_}){let d=u==="inherit";de(!d&&!v);let M=_?.H1||(d?({children:w})=>(0,n.jsx)("h1",{className:"dsa-h1",children:w}):({children:w})=>(0,n.jsx)("h1",{className:"dsa-h1",style:{fontSize:"2.25rem",fontWeight:700,lineHeight:1.2,color:"var(--dsa-text)",margin:"0 0 1rem"},children:w})),O=_?.Toc||(d?ce:le),W=_?.Faq||A,K=d?{}:ne[u],J=["dsa-article-body",l].filter(Boolean).join(" ");return(0,n.jsxs)("article",{className:p,"data-dsa-theme":u,style:d?void 0:{maxWidth:"48rem",margin:"0 auto",fontFamily:"system-ui, -apple-system, sans-serif",...K},children:[r&&(0,n.jsxs)("div",{className:"dsa-meta","data-dsa-meta":"",style:d?void 0:{display:"flex",gap:"1rem",flexWrap:"wrap",fontSize:"0.875rem",color:"var(--dsa-text-muted)",marginBottom:"1.5rem"},children:[e.pillar_name&&(0,n.jsx)("span",{className:"dsa-badge",style:d?void 0:{display:"inline-block",padding:"0.125rem 0.5rem",borderRadius:"9999px",background:"var(--dsa-badge-bg)",color:"var(--dsa-badge-text)",fontSize:"0.75rem"},children:e.pillar_name}),e.content_type&&(0,n.jsx)("span",{className:"dsa-badge dsa-badge--alt",style:d?void 0:{display:"inline-block",padding:"0.125rem 0.5rem",borderRadius:"9999px",background:"var(--dsa-badge-alt-bg, var(--dsa-badge-bg))",color:"var(--dsa-badge-alt-text, var(--dsa-badge-text))",fontSize:"0.75rem"},children:e.content_type.replace(/_/g," ")}),e.reading_time_minutes&&(0,n.jsxs)("span",{className:"dsa-reading-time",children:[e.reading_time_minutes," min read"]}),e.published_at&&(0,n.jsx)("span",{className:"dsa-published-at",children:new Date(e.published_at).toLocaleDateString()})]}),(0,n.jsx)(M,{children:e.h1||e.title}),e.author?.name&&(0,n.jsxs)("div",{className:"dsa-author","data-dsa-author":"",style:d?void 0:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"1.5rem"},children:[e.author.image_url&&(0,n.jsx)("img",{className:"dsa-author-avatar",src:e.author.image_url,alt:e.author.name,style:d?void 0:{width:"2.5rem",height:"2.5rem",borderRadius:"9999px",objectFit:"cover"}}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{style:d?void 0:{fontSize:"0.875rem",fontWeight:600,color:"var(--dsa-text)"},children:[e.author.url?(0,n.jsx)("a",{href:e.author.url,className:"dsa-author-link",rel:"author",style:d?void 0:{color:"inherit",textDecoration:"none"},children:e.author.name}):e.author.name,e.author.job_title&&(0,n.jsxs)("span",{className:"dsa-author-title",style:d?void 0:{fontWeight:400,color:"var(--dsa-text-muted)",marginLeft:"0.25rem"},children:[" ","\xB7 ",e.author.job_title]})]}),e.author.bio&&(0,n.jsx)("p",{className:"dsa-author-bio",style:d?void 0:{fontSize:"0.75rem",color:"var(--dsa-text-muted)",margin:"0.125rem 0 0"},children:e.author.bio})]})]}),e.featured_image_url&&(0,n.jsx)("img",{className:"dsa-featured-image",src:e.featured_image_url,alt:e.featured_image_alt||e.title,style:d?void 0:{width:"100%",borderRadius:"0.75rem",marginBottom:"2rem"}}),a&&(e.headings??[]).length>0&&(0,n.jsx)(O,{headings:e.headings}),(0,n.jsx)("div",{className:J,"data-dsa-article-body":"",style:d?void 0:{lineHeight:1.75,color:"var(--dsa-content-text)",fontSize:"1.0625rem"},dangerouslySetInnerHTML:{__html:e.content_html}}),t&&(e.faq??[]).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("hr",{className:"dsa-divider",style:d?void 0:{border:"none",borderTop:"1px solid var(--dsa-divider)",margin:"2.5rem 0"}}),(0,n.jsx)(W,{items:e.faq})]}),e.schema_json&&(0,n.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e.schema_json)}}),o&&s&&s.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("hr",{className:"dsa-divider",style:d?void 0:{border:"none",borderTop:"1px solid var(--dsa-divider)",margin:"2.5rem 0"}}),(0,n.jsx)(S,{articles:s,onArticleClick:i,theme:u})]})]})}var b=require("react/jsx-runtime");function q(e,t){let a=t?`${t.replace(/\/+$/,"")}/blog/${e.slug}`:void 0,r={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,...a?{url:a}:{},...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}}:a?{alternates:{canonical:a}}:{}};return e.author?.name&&(r.authors=[{name:e.author.name,url:e.author.url||void 0}]),r}function me(e,t){if(e.schema_json&&e.schema_json["@context"])return e.schema_json;let a=t?`${t.replace(/\/+$/,"")}/blog/${e.slug}`:void 0,r={"@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}:{},...a?{url:a}:{},...e.target_keyword?{keywords:[e.target_keyword,...e.secondary_keywords||[]].join(", ")}:{}};if(e.author?.name){let o={"@type":"Person",name:e.author.name};e.author.url&&(o.url=e.author.url),e.author.image_url&&(o.image=e.author.image_url),e.author.job_title&&(o.jobTitle=e.author.job_title);let s=[];if(e.author.url&&s.push(e.author.url),e.author.socials)for(let i of Object.values(e.author.socials))i&&i.startsWith("http")&&s.push(i);s.length&&(o.sameAs=s),r.author=o}if(e.publisher?.name){let o={"@type":"Organization",name:e.publisher.name};e.publisher.url&&(o.url=e.publisher.url),e.publisher.logo_url&&(o.logo={"@type":"ImageObject",url:e.publisher.logo_url}),r.publisher=o}return r.speakable={"@type":"SpeakableSpecification",cssSelector:["[data-speakable]",".dsa-article-body > p:first-of-type"]},e.faq?.length&&(r.mainEntity=e.faq.map(o=>({"@type":"Question",name:o.question,acceptedAnswer:{"@type":"Answer",text:o.answer}}))),r}function pe(e,t){if(!t)return null;let a=t.replace(/\/+$/,""),r=[{name:"Home",url:a},{name:"Blog",url:`${a}/blog`}];return e.pillar_name&&r.push({name:e.pillar_name,url:`${a}/blog?pillar=${encodeURIComponent(e.pillar_name)}`}),r.push({name:e.h1||e.title,url:`${a}/blog/${e.slug}`}),{"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:r.map((o,s)=>({"@type":"ListItem",position:s+1,name:o.name,item:o.url}))}}function I({article:e,siteUrl:t}){let a=me(e,t),r=pe(e,t);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(a)}}),r&&(0,b.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
26
|
//# sourceMappingURL=index.js.map
|