@dsaplatform/content-sdk 1.4.0 → 1.5.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/dist/headless.d.mts +0 -23
- package/dist/headless.d.ts +0 -23
- package/dist/index.d.mts +123 -27
- package/dist/index.d.ts +123 -27
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +0 -23
- package/dist/server.d.ts +0 -23
- package/package.json +6 -3
package/dist/headless.d.mts
CHANGED
|
@@ -29,10 +29,6 @@ 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;
|
|
36
32
|
}
|
|
37
33
|
/**
|
|
38
34
|
* Article heading (from H1-H6 tags)
|
|
@@ -56,25 +52,6 @@ interface InternalLink {
|
|
|
56
52
|
slug: string;
|
|
57
53
|
anchor_text: string;
|
|
58
54
|
}
|
|
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
|
-
}
|
|
78
55
|
|
|
79
56
|
/**
|
|
80
57
|
* Headless utilities — data transformers with zero UI / zero inline styles.
|
package/dist/headless.d.ts
CHANGED
|
@@ -29,10 +29,6 @@ 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;
|
|
36
32
|
}
|
|
37
33
|
/**
|
|
38
34
|
* Article heading (from H1-H6 tags)
|
|
@@ -56,25 +52,6 @@ interface InternalLink {
|
|
|
56
52
|
slug: string;
|
|
57
53
|
anchor_text: string;
|
|
58
54
|
}
|
|
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
|
-
}
|
|
78
55
|
|
|
79
56
|
/**
|
|
80
57
|
* Headless utilities — data transformers with zero UI / zero inline styles.
|
package/dist/index.d.mts
CHANGED
|
@@ -45,10 +45,6 @@ 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;
|
|
52
48
|
}
|
|
53
49
|
/**
|
|
54
50
|
* Abbreviated article for lists
|
|
@@ -92,25 +88,6 @@ interface InternalLink {
|
|
|
92
88
|
slug: string;
|
|
93
89
|
anchor_text: string;
|
|
94
90
|
}
|
|
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
|
-
}
|
|
114
91
|
/**
|
|
115
92
|
* Category with clusters
|
|
116
93
|
*/
|
|
@@ -198,6 +175,60 @@ interface UseCategoriesState {
|
|
|
198
175
|
loading: boolean;
|
|
199
176
|
error: Error | null;
|
|
200
177
|
}
|
|
178
|
+
/** Supported form field names */
|
|
179
|
+
type LeadFormFieldName = 'name' | 'email' | 'phone' | 'company' | 'website' | 'message' | 'city' | 'country';
|
|
180
|
+
/** Form field descriptor */
|
|
181
|
+
interface LeadFormField {
|
|
182
|
+
name: LeadFormFieldName;
|
|
183
|
+
label?: string;
|
|
184
|
+
placeholder?: string;
|
|
185
|
+
type?: 'text' | 'email' | 'tel' | 'url' | 'textarea';
|
|
186
|
+
required?: boolean;
|
|
187
|
+
}
|
|
188
|
+
/** Lead magnet config shown before/after form submission */
|
|
189
|
+
interface LeadMagnetConfig {
|
|
190
|
+
title: string;
|
|
191
|
+
description?: string;
|
|
192
|
+
/** URL to download the lead magnet after form submission */
|
|
193
|
+
downloadUrl?: string;
|
|
194
|
+
/** Image/cover URL for the lead magnet */
|
|
195
|
+
imageUrl?: string;
|
|
196
|
+
}
|
|
197
|
+
/** Configuration for DsaLeadForm component */
|
|
198
|
+
interface DsaLeadFormConfig {
|
|
199
|
+
/** DSA Orchestrator base URL (e.g. "https://api.example.com") */
|
|
200
|
+
webhookUrl: string;
|
|
201
|
+
/** Project slug in DSA */
|
|
202
|
+
projectSlug: string;
|
|
203
|
+
/** Form webhook secret token */
|
|
204
|
+
webhookToken: string;
|
|
205
|
+
}
|
|
206
|
+
/** Payload submitted to the DSA webhook */
|
|
207
|
+
interface LeadFormPayload {
|
|
208
|
+
email: string;
|
|
209
|
+
name?: string;
|
|
210
|
+
phone?: string;
|
|
211
|
+
company?: string;
|
|
212
|
+
website?: string;
|
|
213
|
+
message?: string;
|
|
214
|
+
city?: string;
|
|
215
|
+
country?: string;
|
|
216
|
+
source_url?: string;
|
|
217
|
+
}
|
|
218
|
+
/** Result of a form submission */
|
|
219
|
+
interface LeadFormSubmitResult {
|
|
220
|
+
ok: boolean;
|
|
221
|
+
message?: string;
|
|
222
|
+
error?: string;
|
|
223
|
+
}
|
|
224
|
+
/** Hook state for lead form */
|
|
225
|
+
interface UseLeadFormState {
|
|
226
|
+
submitting: boolean;
|
|
227
|
+
submitted: boolean;
|
|
228
|
+
error: Error | null;
|
|
229
|
+
submit: (data: LeadFormPayload) => Promise<LeadFormSubmitResult>;
|
|
230
|
+
reset: () => void;
|
|
231
|
+
}
|
|
201
232
|
|
|
202
233
|
/**
|
|
203
234
|
* ContentClient — HTTP client for DSA Content Engine Public API.
|
|
@@ -286,6 +317,25 @@ declare function useCategories(): UseCategoriesState & {
|
|
|
286
317
|
refetch: () => void;
|
|
287
318
|
};
|
|
288
319
|
|
|
320
|
+
/**
|
|
321
|
+
* Headless hook for lead capture — handles submission to DSA webhook.
|
|
322
|
+
* Use this when you want full control over form UI.
|
|
323
|
+
*
|
|
324
|
+
* ```tsx
|
|
325
|
+
* const { submitting, submitted, error, submit, reset } = useDsaLeadForm({
|
|
326
|
+
* webhookUrl: "https://api.example.com",
|
|
327
|
+
* projectSlug: "my-project",
|
|
328
|
+
* webhookToken: "abc123",
|
|
329
|
+
* });
|
|
330
|
+
*
|
|
331
|
+
* const handleSubmit = (e) => {
|
|
332
|
+
* e.preventDefault();
|
|
333
|
+
* submit({ email: "user@example.com", name: "John" });
|
|
334
|
+
* };
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
declare function useDsaLeadForm(config: DsaLeadFormConfig): UseLeadFormState;
|
|
338
|
+
|
|
289
339
|
interface ArticleFeedProps {
|
|
290
340
|
articles: ArticleListItem[];
|
|
291
341
|
layout?: 'grid' | 'list';
|
|
@@ -411,7 +461,7 @@ declare function RelatedArticles({ articles, title, limit, onArticleClick, class
|
|
|
411
461
|
* Use in page.tsx generateMetadata():
|
|
412
462
|
*
|
|
413
463
|
* ```ts
|
|
414
|
-
* import { generateArticleMetadata } from "@
|
|
464
|
+
* import { generateArticleMetadata } from "@dsa/content-sdk/server";
|
|
415
465
|
*
|
|
416
466
|
* export async function generateMetadata({ params }) {
|
|
417
467
|
* const article = await fetchArticleBySlug(config, params.slug);
|
|
@@ -422,8 +472,7 @@ declare function RelatedArticles({ articles, title, limit, onArticleClick, class
|
|
|
422
472
|
declare function generateArticleMetadata(article: Article, siteUrl?: string): Record<string, any>;
|
|
423
473
|
/**
|
|
424
474
|
* Renders JSON-LD structured data for an article.
|
|
425
|
-
*
|
|
426
|
-
* and BreadcrumbList schema when siteUrl is provided.
|
|
475
|
+
* Include this component in your article page layout for SEO.
|
|
427
476
|
*
|
|
428
477
|
* ```tsx
|
|
429
478
|
* <SeoMetaBridge article={article} siteUrl="https://example.com" />
|
|
@@ -434,4 +483,51 @@ declare function SeoMetaBridge({ article, siteUrl, }: {
|
|
|
434
483
|
siteUrl?: string;
|
|
435
484
|
}): react_jsx_runtime.JSX.Element;
|
|
436
485
|
|
|
437
|
-
|
|
486
|
+
/** Theme for the lead form */
|
|
487
|
+
type LeadFormTheme = 'light' | 'dark' | 'inherit';
|
|
488
|
+
interface DsaLeadFormProps extends DsaLeadFormConfig {
|
|
489
|
+
/** Form fields to display. Shorthand: pass an array of field names. */
|
|
490
|
+
fields?: (LeadFormFieldName | LeadFormField)[];
|
|
491
|
+
/** Lead magnet to promote above the form / show after submission */
|
|
492
|
+
leadMagnet?: LeadMagnetConfig;
|
|
493
|
+
/** CTA button text */
|
|
494
|
+
ctaText?: string;
|
|
495
|
+
/** Thank-you message shown after successful submission */
|
|
496
|
+
thankYouMessage?: string;
|
|
497
|
+
/** Theme: "light" | "dark" | "inherit" (no styles) */
|
|
498
|
+
theme?: LeadFormTheme;
|
|
499
|
+
/** Additional CSS class on the wrapper */
|
|
500
|
+
className?: string;
|
|
501
|
+
/** Called after successful submission */
|
|
502
|
+
onSuccess?: (data: LeadFormPayload) => void;
|
|
503
|
+
/** Called on submission error */
|
|
504
|
+
onError?: (error: Error) => void;
|
|
505
|
+
/** Override source_url (defaults to window.location.href) */
|
|
506
|
+
sourceUrl?: string;
|
|
507
|
+
/** Render prop for full custom rendering */
|
|
508
|
+
children?: (state: {
|
|
509
|
+
submitting: boolean;
|
|
510
|
+
submitted: boolean;
|
|
511
|
+
error: Error | null;
|
|
512
|
+
submit: (data: LeadFormPayload) => void;
|
|
513
|
+
reset: () => void;
|
|
514
|
+
}) => React.ReactNode;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Ready-to-use lead capture form with built-in DSA webhook integration.
|
|
518
|
+
*
|
|
519
|
+
* ```tsx
|
|
520
|
+
* <DsaLeadForm
|
|
521
|
+
* webhookUrl="https://api.example.com"
|
|
522
|
+
* projectSlug="my-project"
|
|
523
|
+
* webhookToken="abc123"
|
|
524
|
+
* fields={['name', 'email', 'company']}
|
|
525
|
+
* ctaText="Get Free Audit"
|
|
526
|
+
* leadMagnet={{ title: "SEO Audit Checklist", description: "47-point checklist" }}
|
|
527
|
+
* theme="dark"
|
|
528
|
+
* />
|
|
529
|
+
* ```
|
|
530
|
+
*/
|
|
531
|
+
declare function DsaLeadForm({ webhookUrl, projectSlug, webhookToken, fields, leadMagnet, ctaText, thankYouMessage, theme, className, onSuccess, onError, sourceUrl, children, }: DsaLeadFormProps): react_jsx_runtime.JSX.Element;
|
|
532
|
+
|
|
533
|
+
export { type Article, ArticleFeed, type ArticleFeedProps, type ArticleFilters, type ArticleHeading, type ArticleListItem, ArticlePage, type ArticlePageProps, type ArticleTheme, type Category, type ClusterInfo, ContentClient, type DsaContentConfig, DsaContentProvider, type DsaContentProviderProps, DsaLeadForm, type DsaLeadFormConfig, type DsaLeadFormProps, FaqBlock, type FaqBlockProps, type FaqItem, type InternalLink, type LeadFormField, type LeadFormFieldName, type LeadFormPayload, type LeadFormSubmitResult, type LeadFormTheme, type LeadMagnetConfig, type PaginatedResponse, RelatedArticles, type RelatedArticlesProps, SeoMetaBridge, type SitemapEntry, type UseArticleListState, type UseArticleState, type UseArticlesState, type UseCategoriesState, type UseLeadFormState, generateArticleMetadata, useArticle, useArticles, useCategories, useDsaContent, useDsaLeadForm, useRelatedArticles };
|
package/dist/index.d.ts
CHANGED
|
@@ -45,10 +45,6 @@ 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;
|
|
52
48
|
}
|
|
53
49
|
/**
|
|
54
50
|
* Abbreviated article for lists
|
|
@@ -92,25 +88,6 @@ interface InternalLink {
|
|
|
92
88
|
slug: string;
|
|
93
89
|
anchor_text: string;
|
|
94
90
|
}
|
|
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
|
-
}
|
|
114
91
|
/**
|
|
115
92
|
* Category with clusters
|
|
116
93
|
*/
|
|
@@ -198,6 +175,60 @@ interface UseCategoriesState {
|
|
|
198
175
|
loading: boolean;
|
|
199
176
|
error: Error | null;
|
|
200
177
|
}
|
|
178
|
+
/** Supported form field names */
|
|
179
|
+
type LeadFormFieldName = 'name' | 'email' | 'phone' | 'company' | 'website' | 'message' | 'city' | 'country';
|
|
180
|
+
/** Form field descriptor */
|
|
181
|
+
interface LeadFormField {
|
|
182
|
+
name: LeadFormFieldName;
|
|
183
|
+
label?: string;
|
|
184
|
+
placeholder?: string;
|
|
185
|
+
type?: 'text' | 'email' | 'tel' | 'url' | 'textarea';
|
|
186
|
+
required?: boolean;
|
|
187
|
+
}
|
|
188
|
+
/** Lead magnet config shown before/after form submission */
|
|
189
|
+
interface LeadMagnetConfig {
|
|
190
|
+
title: string;
|
|
191
|
+
description?: string;
|
|
192
|
+
/** URL to download the lead magnet after form submission */
|
|
193
|
+
downloadUrl?: string;
|
|
194
|
+
/** Image/cover URL for the lead magnet */
|
|
195
|
+
imageUrl?: string;
|
|
196
|
+
}
|
|
197
|
+
/** Configuration for DsaLeadForm component */
|
|
198
|
+
interface DsaLeadFormConfig {
|
|
199
|
+
/** DSA Orchestrator base URL (e.g. "https://api.example.com") */
|
|
200
|
+
webhookUrl: string;
|
|
201
|
+
/** Project slug in DSA */
|
|
202
|
+
projectSlug: string;
|
|
203
|
+
/** Form webhook secret token */
|
|
204
|
+
webhookToken: string;
|
|
205
|
+
}
|
|
206
|
+
/** Payload submitted to the DSA webhook */
|
|
207
|
+
interface LeadFormPayload {
|
|
208
|
+
email: string;
|
|
209
|
+
name?: string;
|
|
210
|
+
phone?: string;
|
|
211
|
+
company?: string;
|
|
212
|
+
website?: string;
|
|
213
|
+
message?: string;
|
|
214
|
+
city?: string;
|
|
215
|
+
country?: string;
|
|
216
|
+
source_url?: string;
|
|
217
|
+
}
|
|
218
|
+
/** Result of a form submission */
|
|
219
|
+
interface LeadFormSubmitResult {
|
|
220
|
+
ok: boolean;
|
|
221
|
+
message?: string;
|
|
222
|
+
error?: string;
|
|
223
|
+
}
|
|
224
|
+
/** Hook state for lead form */
|
|
225
|
+
interface UseLeadFormState {
|
|
226
|
+
submitting: boolean;
|
|
227
|
+
submitted: boolean;
|
|
228
|
+
error: Error | null;
|
|
229
|
+
submit: (data: LeadFormPayload) => Promise<LeadFormSubmitResult>;
|
|
230
|
+
reset: () => void;
|
|
231
|
+
}
|
|
201
232
|
|
|
202
233
|
/**
|
|
203
234
|
* ContentClient — HTTP client for DSA Content Engine Public API.
|
|
@@ -286,6 +317,25 @@ declare function useCategories(): UseCategoriesState & {
|
|
|
286
317
|
refetch: () => void;
|
|
287
318
|
};
|
|
288
319
|
|
|
320
|
+
/**
|
|
321
|
+
* Headless hook for lead capture — handles submission to DSA webhook.
|
|
322
|
+
* Use this when you want full control over form UI.
|
|
323
|
+
*
|
|
324
|
+
* ```tsx
|
|
325
|
+
* const { submitting, submitted, error, submit, reset } = useDsaLeadForm({
|
|
326
|
+
* webhookUrl: "https://api.example.com",
|
|
327
|
+
* projectSlug: "my-project",
|
|
328
|
+
* webhookToken: "abc123",
|
|
329
|
+
* });
|
|
330
|
+
*
|
|
331
|
+
* const handleSubmit = (e) => {
|
|
332
|
+
* e.preventDefault();
|
|
333
|
+
* submit({ email: "user@example.com", name: "John" });
|
|
334
|
+
* };
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
declare function useDsaLeadForm(config: DsaLeadFormConfig): UseLeadFormState;
|
|
338
|
+
|
|
289
339
|
interface ArticleFeedProps {
|
|
290
340
|
articles: ArticleListItem[];
|
|
291
341
|
layout?: 'grid' | 'list';
|
|
@@ -411,7 +461,7 @@ declare function RelatedArticles({ articles, title, limit, onArticleClick, class
|
|
|
411
461
|
* Use in page.tsx generateMetadata():
|
|
412
462
|
*
|
|
413
463
|
* ```ts
|
|
414
|
-
* import { generateArticleMetadata } from "@
|
|
464
|
+
* import { generateArticleMetadata } from "@dsa/content-sdk/server";
|
|
415
465
|
*
|
|
416
466
|
* export async function generateMetadata({ params }) {
|
|
417
467
|
* const article = await fetchArticleBySlug(config, params.slug);
|
|
@@ -422,8 +472,7 @@ declare function RelatedArticles({ articles, title, limit, onArticleClick, class
|
|
|
422
472
|
declare function generateArticleMetadata(article: Article, siteUrl?: string): Record<string, any>;
|
|
423
473
|
/**
|
|
424
474
|
* Renders JSON-LD structured data for an article.
|
|
425
|
-
*
|
|
426
|
-
* and BreadcrumbList schema when siteUrl is provided.
|
|
475
|
+
* Include this component in your article page layout for SEO.
|
|
427
476
|
*
|
|
428
477
|
* ```tsx
|
|
429
478
|
* <SeoMetaBridge article={article} siteUrl="https://example.com" />
|
|
@@ -434,4 +483,51 @@ declare function SeoMetaBridge({ article, siteUrl, }: {
|
|
|
434
483
|
siteUrl?: string;
|
|
435
484
|
}): react_jsx_runtime.JSX.Element;
|
|
436
485
|
|
|
437
|
-
|
|
486
|
+
/** Theme for the lead form */
|
|
487
|
+
type LeadFormTheme = 'light' | 'dark' | 'inherit';
|
|
488
|
+
interface DsaLeadFormProps extends DsaLeadFormConfig {
|
|
489
|
+
/** Form fields to display. Shorthand: pass an array of field names. */
|
|
490
|
+
fields?: (LeadFormFieldName | LeadFormField)[];
|
|
491
|
+
/** Lead magnet to promote above the form / show after submission */
|
|
492
|
+
leadMagnet?: LeadMagnetConfig;
|
|
493
|
+
/** CTA button text */
|
|
494
|
+
ctaText?: string;
|
|
495
|
+
/** Thank-you message shown after successful submission */
|
|
496
|
+
thankYouMessage?: string;
|
|
497
|
+
/** Theme: "light" | "dark" | "inherit" (no styles) */
|
|
498
|
+
theme?: LeadFormTheme;
|
|
499
|
+
/** Additional CSS class on the wrapper */
|
|
500
|
+
className?: string;
|
|
501
|
+
/** Called after successful submission */
|
|
502
|
+
onSuccess?: (data: LeadFormPayload) => void;
|
|
503
|
+
/** Called on submission error */
|
|
504
|
+
onError?: (error: Error) => void;
|
|
505
|
+
/** Override source_url (defaults to window.location.href) */
|
|
506
|
+
sourceUrl?: string;
|
|
507
|
+
/** Render prop for full custom rendering */
|
|
508
|
+
children?: (state: {
|
|
509
|
+
submitting: boolean;
|
|
510
|
+
submitted: boolean;
|
|
511
|
+
error: Error | null;
|
|
512
|
+
submit: (data: LeadFormPayload) => void;
|
|
513
|
+
reset: () => void;
|
|
514
|
+
}) => React.ReactNode;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Ready-to-use lead capture form with built-in DSA webhook integration.
|
|
518
|
+
*
|
|
519
|
+
* ```tsx
|
|
520
|
+
* <DsaLeadForm
|
|
521
|
+
* webhookUrl="https://api.example.com"
|
|
522
|
+
* projectSlug="my-project"
|
|
523
|
+
* webhookToken="abc123"
|
|
524
|
+
* fields={['name', 'email', 'company']}
|
|
525
|
+
* ctaText="Get Free Audit"
|
|
526
|
+
* leadMagnet={{ title: "SEO Audit Checklist", description: "47-point checklist" }}
|
|
527
|
+
* theme="dark"
|
|
528
|
+
* />
|
|
529
|
+
* ```
|
|
530
|
+
*/
|
|
531
|
+
declare function DsaLeadForm({ webhookUrl, projectSlug, webhookToken, fields, leadMagnet, ctaText, thankYouMessage, theme, className, onSuccess, onError, sourceUrl, children, }: DsaLeadFormProps): react_jsx_runtime.JSX.Element;
|
|
532
|
+
|
|
533
|
+
export { type Article, ArticleFeed, type ArticleFeedProps, type ArticleFilters, type ArticleHeading, type ArticleListItem, ArticlePage, type ArticlePageProps, type ArticleTheme, type Category, type ClusterInfo, ContentClient, type DsaContentConfig, DsaContentProvider, type DsaContentProviderProps, DsaLeadForm, type DsaLeadFormConfig, type DsaLeadFormProps, FaqBlock, type FaqBlockProps, type FaqItem, type InternalLink, type LeadFormField, type LeadFormFieldName, type LeadFormPayload, type LeadFormSubmitResult, type LeadFormTheme, type LeadMagnetConfig, type PaginatedResponse, RelatedArticles, type RelatedArticlesProps, SeoMetaBridge, type SitemapEntry, type UseArticleListState, type UseArticleState, type UseArticlesState, type UseCategoriesState, type UseLeadFormState, generateArticleMetadata, useArticle, useArticles, useCategories, useDsaContent, useDsaLeadForm, useRelatedArticles };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
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=`
|
|
2
|
+
"use strict";var se=Object.create;var D=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var ce=(e,t)=>{for(var a in t)D(e,a,{get:t[a],enumerable:!0})},j=(e,t,a,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ne(t))!le.call(e,r)&&r!==a&&D(e,r,{get:()=>t[r],enumerable:!(s=ie(t,r))||s.enumerable});return e};var O=(e,t,a)=>(a=e!=null?se(de(e)):{},j(t||!e||!e.__esModule?D(a,"default",{value:e,enumerable:!0}):a,e)),me=e=>j(D({},"__esModule",{value:!0}),e);var Ce={};ce(Ce,{ArticleFeed:()=>B,ArticlePage:()=>$,ContentClient:()=>L,DsaContentProvider:()=>V,DsaLeadForm:()=>M,FaqBlock:()=>q,RelatedArticles:()=>T,SeoMetaBridge:()=>W,generateArticleMetadata:()=>H,useArticle:()=>Y,useArticles:()=>J,useCategories:()=>X,useDsaContent:()=>w,useDsaLeadForm:()=>z,useRelatedArticles:()=>Q});module.exports=me(Ce);var L=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 s=new URL(`${this.apiUrl}${t}`);a&&Object.entries(a).forEach(([n,m])=>{m!=null&&m!==""&&s.searchParams.set(n,String(m))}),s.searchParams.set("site_key",this.apiKey);let r={method:"GET",headers:{"X-API-Key":this.apiKey},cache:this.cacheStrategy};this.revalidateSeconds&&this.cacheStrategy!=="no-cache"&&(r.next={revalidate:this.revalidateSeconds});let o=await fetch(s.toString(),r);if(!o.ok){let n=await o.text().catch(()=>"");throw new Error(`DSA Content API error ${o.status}: ${n||o.statusText}`)}return o.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 s=await this.request(`/api/public/articles/${encodeURIComponent(t)}/related`,{limit:a});return s.items??(Array.isArray(s)?s:[])}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 N=require("react");var G=require("react/jsx-runtime"),K=(0,N.createContext)(null);function V({config:e,children:t}){let a=(0,N.useMemo)(()=>new L(e),[e.apiUrl,e.apiKey]);return(0,G.jsx)(K.Provider,{value:a,children:t})}function w(){let e=(0,N.useContext)(K);if(!e)throw new Error("useDsaContent() must be used inside <DsaContentProvider>");return e}var b=require("react");function J(e){let t=w(),[a,s]=(0,b.useState)({articles:[],loading:!0,error:null,pagination:{page:1,per_page:10,total:0,total_pages:0}}),r=(0,b.useCallback)(()=>{s(o=>({...o,loading:!0,error:null})),t.getArticles(e).then(o=>s({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=>s(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,b.useEffect)(()=>{r()},[r]),{...a,refetch:r}}function Y(e){let t=w(),[a,s]=(0,b.useState)({article:null,loading:!0,error:null}),r=(0,b.useCallback)(()=>{if(!e){s({article:null,loading:!1,error:null});return}s(o=>({...o,loading:!0,error:null})),t.getArticleBySlug(e).then(o=>s({article:o,loading:!1,error:null})).catch(o=>s({article:null,loading:!1,error:o instanceof Error?o:new Error(String(o))}))},[t,e]);return(0,b.useEffect)(()=>{r()},[r]),{...a,refetch:r}}function Q(e,t=3){let a=w(),[s,r]=(0,b.useState)({articles:[],loading:!0,error:null}),o=(0,b.useCallback)(()=>{if(!e){r({articles:[],loading:!1,error:null});return}r(n=>({...n,loading:!0,error:null})),a.getRelatedArticles(e,t).then(n=>r({articles:n,loading:!1,error:null})).catch(n=>r({articles:[],loading:!1,error:n instanceof Error?n:new Error(String(n))}))},[a,e,t]);return(0,b.useEffect)(()=>{o()},[o]),{...s,refetch:o}}function X(){let e=w(),[t,a]=(0,b.useState)({categories:[],loading:!0,error:null}),s=(0,b.useCallback)(()=>{a(r=>({...r,loading:!0,error:null})),e.getCategories().then(r=>a({categories:r,loading:!1,error:null})).catch(r=>a({categories:[],loading:!1,error:r instanceof Error?r:new Error(String(r))}))},[e]);return(0,b.useEffect)(()=>{s()},[s]),{...t,refetch:s}}var A=require("react");function z(e){let[t,a]=(0,A.useState)(!1),[s,r]=(0,A.useState)(!1),[o,n]=(0,A.useState)(null),m=(0,A.useCallback)(async g=>{a(!0),n(null);try{let C=`${e.webhookUrl.replace(/\/+$/,"")}/api/webhook/form/${encodeURIComponent(e.projectSlug)}?token=${encodeURIComponent(e.webhookToken)}`,l={...g};!l.source_url&&typeof window<"u"&&(l.source_url=window.location.href);let y=await fetch(C,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}),u=await y.json().catch(()=>({}));if(!y.ok){let R=u.error||`Submission failed (${y.status})`;throw new Error(R)}return r(!0),{ok:!0,message:u.message}}catch(_){let C=_ instanceof Error?_:new Error(String(_));return n(C),{ok:!1,error:C.message}}finally{a(!1)}},[e.webhookUrl,e.projectSlug,e.webhookToken]),d=(0,A.useCallback)(()=>{a(!1),r(!1),n(null)},[]);return{submitting:t,submitted:s,error:o,submit:m,reset:d}}var U=O(require("react")),h=require("react/jsx-runtime"),pe={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 ge({article:e,layout:t,showExcerpt:a,showImage:s,showMeta:r,onClick:o}){let n=t==="grid",[m,d]=U.default.useState(!1),g={...n?{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"},...m?{boxShadow:"var(--dsa-hover-shadow)"}:{}};return(0,h.jsxs)("article",{style:g,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onClick:o,role:"link",tabIndex:0,onKeyDown:_=>_.key==="Enter"&&o?.(),children:[s&&e.featured_image_url&&(0,h.jsx)("img",{src:e.featured_image_url,alt:e.featured_image_alt||e.title,style:n?{width:"100%",height:"200px",objectFit:"cover",display:"block"}:{width:"240px",minHeight:"160px",objectFit:"cover",flexShrink:0},loading:"lazy"}),(0,h.jsxs)("div",{style:n?{padding:"1.25rem"}:{padding:"1.25rem",flex:1},children:[(0,h.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,h.jsx)("p",{style:{margin:"0 0 0.75rem",fontSize:"0.875rem",color:"var(--dsa-text-muted)",lineHeight:1.5},children:e.excerpt}),r&&(0,h.jsxs)("div",{style:{display:"flex",gap:"0.75rem",fontSize:"0.75rem",color:"var(--dsa-text-faint)",flexWrap:"wrap"},children:[e.pillar_name&&(0,h.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,h.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,h.jsxs)("span",{children:[e.reading_time_minutes," min read"]}),e.published_at&&(0,h.jsx)("span",{children:new Date(e.published_at).toLocaleDateString()})]})]})]})}function B({articles:e,layout:t="grid",columns:a=3,showExcerpt:s=!0,showImage:r=!0,showMeta:o=!0,onArticleClick:n,className:m,theme:d="light",renderArticle:g}){let _=t==="grid"?`repeat(${a}, 1fr)`:"1fr",C=d!=="inherit"?pe[d]:{};return(0,h.jsx)("div",{className:m,style:{display:"grid",gap:"1.5rem",gridTemplateColumns:_,...C},children:(e??[]).map(l=>g?(0,h.jsx)(U.default.Fragment,{children:g(l)},l.id):(0,h.jsx)(ge,{article:l,layout:t,showExcerpt:s,showImage:r,showMeta:o,onClick:()=>n?.(l.slug)},l.id))})}var te=O(require("react"));var Z=require("react"),S=require("react/jsx-runtime"),fe={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 ue({item:e,collapsible:t,defaultOpen:a}){let[s,r]=(0,Z.useState)(a);return t?(0,S.jsxs)("div",{style:{borderBottom:"1px solid var(--dsa-divider)",padding:"0.75rem 0"},children:[(0,S.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:()=>r(!s),"aria-expanded":s,children:[(0,S.jsx)("span",{children:e.question}),(0,S.jsx)("span",{style:{flexShrink:0,marginLeft:"1rem",transition:"transform 0.2s",fontSize:"1.25rem",color:"var(--dsa-text-faint)",transform:s?"rotate(180deg)":"rotate(0deg)"},children:"\u25BC"})]}),s&&(0,S.jsx)("div",{style:{fontSize:"0.9375rem",color:"var(--dsa-text-muted)",lineHeight:1.6,paddingTop:"0.5rem"},children:e.answer})]}):(0,S.jsxs)("div",{style:{borderBottom:"1px solid var(--dsa-divider)",padding:"0.75rem 0"},children:[(0,S.jsx)("p",{style:{fontSize:"1rem",fontWeight:600,color:"var(--dsa-text)",margin:"0 0 0.5rem"},children:e.question}),(0,S.jsx)("div",{style:{fontSize:"0.9375rem",color:"var(--dsa-text-muted)",lineHeight:1.6},children:e.answer})]})}function q({items:e,collapsible:t=!0,defaultOpen:a=!1,className:s,title:r="Frequently Asked Questions",theme:o="light"}){if(!e||e.length===0)return null;let n=o!=="inherit"?fe[o]:{},m={"@context":"https://schema.org","@type":"FAQPage",mainEntity:e.map(d=>({"@type":"Question",name:d.question,acceptedAnswer:{"@type":"Answer",text:d.answer}}))};return(0,S.jsxs)("section",{className:s,style:{marginTop:"1rem",...n},children:[(0,S.jsx)("h2",{style:{fontSize:"1.5rem",fontWeight:700,color:"var(--dsa-text)",margin:"0 0 1rem"},children:r}),e.map((d,g)=>(0,S.jsx)(ue,{item:d,collapsible:t,defaultOpen:a},g)),(0,S.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(m)}})]})}var F=require("react/jsx-runtime"),be={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 T({articles:e,title:t="Related Articles",limit:a=3,onArticleClick:s,className:r,theme:o="light"}){let n=(e??[]).slice(0,a);if(n.length===0)return null;let m=o!=="inherit"?be[o]:{};return(0,F.jsxs)("section",{className:r,style:{marginTop:"1rem",...m},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:n.map(d=>(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:()=>s?.(d.slug),role:"link",tabIndex:0,onKeyDown:g=>g.key==="Enter"&&s?.(d.slug),children:[d.featured_image_url&&(0,F.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,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:d.title}),d.excerpt&&(0,F.jsx)("p",{style:{fontSize:"0.8125rem",color:"var(--dsa-text-muted)",marginTop:"0.5rem",lineHeight:1.4},children:d.excerpt})]})]},d.id))})]})}var i=require("react/jsx-runtime"),he={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"}},ee="dsa-article-prose",ye=`
|
|
3
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
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
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; }
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
[data-dsa-article-body] hr { border: none; border-top: 1px solid var(--dsa-divider, #e5e7eb); margin: 2rem 0; }
|
|
23
23
|
[data-dsa-article-body] > *:first-child { margin-top: 0; }
|
|
24
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});
|
|
25
|
+
`.trim();function xe(e){te.default.useEffect(()=>{if(!e||typeof document>"u"||document.getElementById(ee))return;let t=document.createElement("style");t.id=ee,t.textContent=ye,document.head.appendChild(t)},[e])}function ve({headings:e}){return!e||e.length===0?null:(0,i.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,i.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,i.jsx)("ul",{style:{listStyle:"none",padding:0,margin:0},children:e.map((t,a)=>(0,i.jsx)("li",{style:{padding:"0.25rem 0",paddingLeft:`${(t.level-2)*1}rem`},children:(0,i.jsx)("a",{href:`#${t.id}`,style:{color:"var(--dsa-text-muted, #4b5563)",textDecoration:"none",fontSize:"0.875rem"},children:t.text})},a))})]})}function Se({headings:e}){return!e||e.length===0?null:(0,i.jsxs)("nav",{className:"dsa-toc","data-dsa-toc":"",children:[(0,i.jsx)("p",{className:"dsa-toc-title",children:"Table of Contents"}),(0,i.jsx)("ul",{className:"dsa-toc-list",children:e.map((t,a)=>(0,i.jsx)("li",{className:"dsa-toc-item",style:{paddingLeft:`${(t.level-2)*1}rem`},children:(0,i.jsx)("a",{href:`#${t.id}`,className:"dsa-toc-link",children:t.text})},a))})]})}function $({article:e,showFaq:t=!0,showTableOfContents:a=!0,showMeta:s=!0,showRelated:r=!1,relatedArticles:o,onRelatedClick:n,className:m,contentClassName:d,theme:g="light",disableProseStyles:_=!1,components:C}){let l=g==="inherit";xe(!l&&!_);let y=C?.H1||(l?({children:p})=>(0,i.jsx)("h1",{className:"dsa-h1",children:p}):({children:p})=>(0,i.jsx)("h1",{className:"dsa-h1",style:{fontSize:"2.25rem",fontWeight:700,lineHeight:1.2,color:"var(--dsa-text)",margin:"0 0 1rem"},children:p})),u=C?.Toc||(l?Se:ve),R=C?.Faq||q,I=l?{}:he[g],E=["dsa-article-body",d].filter(Boolean).join(" ");return(0,i.jsxs)("article",{className:m,"data-dsa-theme":g,style:l?void 0:{maxWidth:"48rem",margin:"0 auto",fontFamily:"system-ui, -apple-system, sans-serif",...I},children:[s&&(0,i.jsxs)("div",{className:"dsa-meta","data-dsa-meta":"",style:l?void 0:{display:"flex",gap:"1rem",flexWrap:"wrap",fontSize:"0.875rem",color:"var(--dsa-text-muted)",marginBottom:"1.5rem"},children:[e.pillar_name&&(0,i.jsx)("span",{className:"dsa-badge",style:l?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,i.jsx)("span",{className:"dsa-badge dsa-badge--alt",style:l?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,i.jsxs)("span",{className:"dsa-reading-time",children:[e.reading_time_minutes," min read"]}),e.published_at&&(0,i.jsx)("span",{className:"dsa-published-at",children:new Date(e.published_at).toLocaleDateString()})]}),(0,i.jsx)(y,{children:e.h1||e.title}),e.featured_image_url&&(0,i.jsx)("img",{className:"dsa-featured-image",src:e.featured_image_url,alt:e.featured_image_alt||e.title,style:l?void 0:{width:"100%",borderRadius:"0.75rem",marginBottom:"2rem"}}),a&&(e.headings??[]).length>0&&(0,i.jsx)(u,{headings:e.headings}),(0,i.jsx)("div",{className:E,"data-dsa-article-body":"",style:l?void 0:{lineHeight:1.75,color:"var(--dsa-content-text)",fontSize:"1.0625rem"},dangerouslySetInnerHTML:{__html:e.content_html}}),t&&(e.faq??[]).length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("hr",{className:"dsa-divider",style:l?void 0:{border:"none",borderTop:"1px solid var(--dsa-divider)",margin:"2.5rem 0"}}),(0,i.jsx)(R,{items:e.faq})]}),e.schema_json&&(0,i.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e.schema_json)}}),r&&o&&o.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("hr",{className:"dsa-divider",style:l?void 0:{border:"none",borderTop:"1px solid var(--dsa-divider)",margin:"2.5rem 0"}}),(0,i.jsx)(T,{articles:o,onArticleClick:n,theme:g})]})]})}var ae=require("react/jsx-runtime");function H(e,t){let a=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,...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}}:{}}}function W({article:e,siteUrl:t}){let a=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,ae.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(a)}})}var oe=require("react");var c=require("react/jsx-runtime"),re={name:{label:"Name",placeholder:"Your name",type:"text",required:!1},email:{label:"Email",placeholder:"you@company.com",type:"email",required:!0},phone:{label:"Phone",placeholder:"+1 (555) 000-0000",type:"tel",required:!1},company:{label:"Company",placeholder:"Company name",type:"text",required:!1},website:{label:"Website",placeholder:"https://...",type:"url",required:!1},message:{label:"Message",placeholder:"How can we help?",type:"textarea",required:!1},city:{label:"City",placeholder:"City",type:"text",required:!1},country:{label:"Country",placeholder:"Country",type:"text",required:!1}};function _e(e){if(typeof e=="string"){let a=re[e];return{name:e,...a}}return{...re[e.name],...e}}function M({webhookUrl:e,projectSlug:t,webhookToken:a,fields:s=["name","email"],leadMagnet:r,ctaText:o="Submit",thankYouMessage:n,theme:m="light",className:d,onSuccess:g,onError:_,sourceUrl:C,children:l}){let y=z({webhookUrl:e,projectSlug:t,webhookToken:a}),[u,R]=(0,oe.useState)({}),I=s.map(_e);if(l)return(0,c.jsx)(c.Fragment,{children:l({...y})});let E=async f=>{f.preventDefault();let P={email:u.email||"",name:u.name,phone:u.phone,company:u.company,website:u.website,message:u.message,city:u.city,country:u.country,source_url:C},k=await y.submit(P);k.ok?g?.(P):k.error&&_?.(new Error(k.error))},p=m==="inherit",x=m==="dark",v=p?{}:{wrapper:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',backgroundColor:x?"#1e293b":"#ffffff",border:`1px solid ${x?"#334155":"#e2e8f0"}`,borderRadius:"12px",padding:"24px",maxWidth:"480px",color:x?"#f1f5f9":"#0f172a"},heading:{margin:"0 0 4px 0",fontSize:"18px",fontWeight:700,color:x?"#f1f5f9":"#0f172a"},description:{margin:"0 0 16px 0",fontSize:"14px",color:x?"#94a3b8":"#64748b"},label:{display:"block",fontSize:"13px",fontWeight:500,marginBottom:"4px",color:x?"#cbd5e1":"#374151"},input:{display:"block",width:"100%",padding:"8px 12px",fontSize:"14px",border:`1px solid ${x?"#475569":"#d1d5db"}`,borderRadius:"8px",backgroundColor:x?"#0f172a":"#ffffff",color:x?"#f1f5f9":"#0f172a",outline:"none",boxSizing:"border-box"},textarea:{display:"block",width:"100%",padding:"8px 12px",fontSize:"14px",border:`1px solid ${x?"#475569":"#d1d5db"}`,borderRadius:"8px",backgroundColor:x?"#0f172a":"#ffffff",color:x?"#f1f5f9":"#0f172a",outline:"none",minHeight:"80px",resize:"vertical",fontFamily:"inherit",boxSizing:"border-box"},button:{width:"100%",padding:"10px 20px",fontSize:"14px",fontWeight:600,color:"#ffffff",backgroundColor:"#2563eb",border:"none",borderRadius:"8px",cursor:"pointer",marginTop:"4px",opacity:y.submitting?.7:1},fieldGroup:{marginBottom:"12px"},error:{fontSize:"13px",color:"#ef4444",marginTop:"8px"},success:{textAlign:"center",padding:"16px 0"},successTitle:{fontSize:"18px",fontWeight:700,color:x?"#34d399":"#059669",marginBottom:"8px"},successText:{fontSize:"14px",color:x?"#94a3b8":"#64748b",marginBottom:"16px"},downloadLink:{display:"inline-block",padding:"10px 24px",fontSize:"14px",fontWeight:600,color:"#ffffff",backgroundColor:"#2563eb",borderRadius:"8px",textDecoration:"none"}};return y.submitted?(0,c.jsx)("div",{className:`dsa-lead-form dsa-lead-form--success ${d||""}`,"data-dsa-lead-form":!0,"data-theme":m,style:p?void 0:v.wrapper,children:(0,c.jsxs)("div",{style:p?void 0:v.success,children:[(0,c.jsx)("div",{style:p?void 0:v.successTitle,children:n||"Thank you!"}),r?.downloadUrl&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("p",{style:p?void 0:v.successText,children:"Your download is ready:"}),(0,c.jsxs)("a",{href:r.downloadUrl,target:"_blank",rel:"noopener noreferrer",className:"dsa-lead-form__download",style:p?void 0:v.downloadLink,children:["Download ",r.title]})]})]})}):(0,c.jsxs)("div",{className:`dsa-lead-form ${d||""}`,"data-dsa-lead-form":!0,"data-theme":m,style:p?void 0:v.wrapper,children:[r&&(0,c.jsxs)("div",{className:"dsa-lead-form__magnet",style:{marginBottom:"16px"},children:[r.imageUrl&&(0,c.jsx)("img",{src:r.imageUrl,alt:r.title,style:p?void 0:{width:"100%",borderRadius:"8px",marginBottom:"12px",display:"block"},className:"dsa-lead-form__magnet-image"}),(0,c.jsx)("h3",{className:"dsa-lead-form__magnet-title",style:p?void 0:v.heading,children:r.title}),r.description&&(0,c.jsx)("p",{className:"dsa-lead-form__magnet-description",style:p?void 0:v.description,children:r.description})]}),(0,c.jsxs)("form",{onSubmit:E,className:"dsa-lead-form__form",noValidate:!0,children:[I.map(f=>(0,c.jsxs)("div",{className:"dsa-lead-form__field",style:p?void 0:v.fieldGroup,children:[(0,c.jsxs)("label",{className:"dsa-lead-form__label",style:p?void 0:v.label,children:[f.label,f.required&&" *"]}),f.type==="textarea"?(0,c.jsx)("textarea",{name:f.name,placeholder:f.placeholder,required:f.required,value:u[f.name]||"",onChange:P=>R(k=>({...k,[f.name]:P.target.value})),className:"dsa-lead-form__textarea",style:p?void 0:v.textarea}):(0,c.jsx)("input",{type:f.type||"text",name:f.name,placeholder:f.placeholder,required:f.required,value:u[f.name]||"",onChange:P=>R(k=>({...k,[f.name]:P.target.value})),className:"dsa-lead-form__input",style:p?void 0:v.input})]},f.name)),(0,c.jsx)("button",{type:"submit",disabled:y.submitting,className:"dsa-lead-form__submit",style:p?void 0:v.button,children:y.submitting?"Sending...":o}),y.error&&(0,c.jsx)("p",{className:"dsa-lead-form__error",style:p?void 0:v.error,children:y.error.message})]})]})}0&&(module.exports={ArticleFeed,ArticlePage,ContentClient,DsaContentProvider,DsaLeadForm,FaqBlock,RelatedArticles,SeoMetaBridge,generateArticleMetadata,useArticle,useArticles,useCategories,useDsaContent,useDsaLeadForm,useRelatedArticles});
|
|
26
26
|
//# sourceMappingURL=index.js.map
|