@brandlab-digital/site-next 3.19.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blog.d.ts +18 -2
- package/dist/blog.d.ts.map +1 -1
- package/dist/blog.js +14 -2
- package/dist/blog.js.map +1 -1
- package/dist/instrumentation-client.d.ts +1 -1
- package/dist/instrumentation-client.js +1 -1
- package/dist/instrumentation-client.js.map +1 -1
- package/dist/navigation/index.d.ts +2 -3
- package/dist/navigation/index.d.ts.map +1 -1
- package/dist/navigation/index.js +2 -3
- package/dist/navigation/index.js.map +1 -1
- package/dist/next-config.d.ts +1 -17
- package/dist/next-config.d.ts.map +1 -1
- package/dist/next-config.js +2 -33
- package/dist/next-config.js.map +1 -1
- package/package.json +4 -33
- package/dist/ui-kit/brandlab-skin.d.ts +0 -112
- package/dist/ui-kit/brandlab-skin.d.ts.map +0 -1
- package/dist/ui-kit/brandlab-skin.js +0 -2
- package/dist/ui-kit/brandlab-skin.js.map +0 -1
- package/dist/ui-kit/form/copy.d.ts +0 -3
- package/dist/ui-kit/form/copy.d.ts.map +0 -1
- package/dist/ui-kit/form/copy.js +0 -5
- package/dist/ui-kit/form/copy.js.map +0 -1
- package/dist/ui-kit/form/dialog.d.ts +0 -24
- package/dist/ui-kit/form/dialog.d.ts.map +0 -1
- package/dist/ui-kit/form/dialog.js +0 -17
- package/dist/ui-kit/form/dialog.js.map +0 -1
- package/dist/ui-kit/form/field.d.ts +0 -30
- package/dist/ui-kit/form/field.d.ts.map +0 -1
- package/dist/ui-kit/form/field.js +0 -11
- package/dist/ui-kit/form/field.js.map +0 -1
- package/dist/ui-kit/form/index.d.ts +0 -7
- package/dist/ui-kit/form/index.d.ts.map +0 -1
- package/dist/ui-kit/form/index.js +0 -7
- package/dist/ui-kit/form/index.js.map +0 -1
- package/dist/ui-kit/form/photo-upload.d.ts +0 -40
- package/dist/ui-kit/form/photo-upload.d.ts.map +0 -1
- package/dist/ui-kit/form/photo-upload.js +0 -19
- package/dist/ui-kit/form/photo-upload.js.map +0 -1
- package/dist/ui-kit/form/quote-dialog.d.ts +0 -15
- package/dist/ui-kit/form/quote-dialog.d.ts.map +0 -1
- package/dist/ui-kit/form/quote-dialog.js +0 -68
- package/dist/ui-kit/form/quote-dialog.js.map +0 -1
- package/dist/ui-kit/form/quote-form.d.ts +0 -172
- package/dist/ui-kit/form/quote-form.d.ts.map +0 -1
- package/dist/ui-kit/form/quote-form.js +0 -238
- package/dist/ui-kit/form/quote-form.js.map +0 -1
- package/dist/ui-kit/form/thank-you.d.ts +0 -40
- package/dist/ui-kit/form/thank-you.d.ts.map +0 -1
- package/dist/ui-kit/form/thank-you.js +0 -36
- package/dist/ui-kit/form/thank-you.js.map +0 -1
- package/dist/ui-kit/icon-glyphs.d.ts +0 -41
- package/dist/ui-kit/icon-glyphs.d.ts.map +0 -1
- package/dist/ui-kit/icon-glyphs.js +0 -138
- package/dist/ui-kit/icon-glyphs.js.map +0 -1
- package/dist/ui-kit/icon-sprite.d.ts +0 -19
- package/dist/ui-kit/icon-sprite.d.ts.map +0 -1
- package/dist/ui-kit/icon-sprite.js +0 -44
- package/dist/ui-kit/icon-sprite.js.map +0 -1
- package/dist/ui-kit/icons.d.ts +0 -50
- package/dist/ui-kit/icons.d.ts.map +0 -1
- package/dist/ui-kit/icons.js +0 -55
- package/dist/ui-kit/icons.js.map +0 -1
- package/dist/ui-kit/prefetch.d.ts +0 -59
- package/dist/ui-kit/prefetch.d.ts.map +0 -1
- package/dist/ui-kit/prefetch.js +0 -63
- package/dist/ui-kit/prefetch.js.map +0 -1
- package/dist/ui-kit/primitives/badge.d.ts +0 -25
- package/dist/ui-kit/primitives/badge.d.ts.map +0 -1
- package/dist/ui-kit/primitives/badge.js +0 -21
- package/dist/ui-kit/primitives/badge.js.map +0 -1
- package/dist/ui-kit/primitives/breadcrumbs.d.ts +0 -27
- package/dist/ui-kit/primitives/breadcrumbs.d.ts.map +0 -1
- package/dist/ui-kit/primitives/breadcrumbs.js +0 -40
- package/dist/ui-kit/primitives/breadcrumbs.js.map +0 -1
- package/dist/ui-kit/primitives/button.d.ts +0 -32
- package/dist/ui-kit/primitives/button.d.ts.map +0 -1
- package/dist/ui-kit/primitives/button.js +0 -8
- package/dist/ui-kit/primitives/button.js.map +0 -1
- package/dist/ui-kit/primitives/card.d.ts +0 -40
- package/dist/ui-kit/primitives/card.d.ts.map +0 -1
- package/dist/ui-kit/primitives/card.js +0 -8
- package/dist/ui-kit/primitives/card.js.map +0 -1
- package/dist/ui-kit/primitives/index.d.ts +0 -16
- package/dist/ui-kit/primitives/index.d.ts.map +0 -1
- package/dist/ui-kit/primitives/index.js +0 -16
- package/dist/ui-kit/primitives/index.js.map +0 -1
- package/dist/ui-kit/primitives/layout.d.ts +0 -85
- package/dist/ui-kit/primitives/layout.d.ts.map +0 -1
- package/dist/ui-kit/primitives/layout.js +0 -52
- package/dist/ui-kit/primitives/layout.js.map +0 -1
- package/dist/ui-kit/primitives/links.d.ts +0 -74
- package/dist/ui-kit/primitives/links.d.ts.map +0 -1
- package/dist/ui-kit/primitives/links.js +0 -41
- package/dist/ui-kit/primitives/links.js.map +0 -1
- package/dist/ui-kit/primitives/lists.d.ts +0 -51
- package/dist/ui-kit/primitives/lists.d.ts.map +0 -1
- package/dist/ui-kit/primitives/lists.js +0 -34
- package/dist/ui-kit/primitives/lists.js.map +0 -1
- package/dist/ui-kit/primitives/media-frame.d.ts +0 -33
- package/dist/ui-kit/primitives/media-frame.d.ts.map +0 -1
- package/dist/ui-kit/primitives/media-frame.js +0 -61
- package/dist/ui-kit/primitives/media-frame.js.map +0 -1
- package/dist/ui-kit/primitives/media.d.ts +0 -40
- package/dist/ui-kit/primitives/media.d.ts.map +0 -1
- package/dist/ui-kit/primitives/media.js +0 -9
- package/dist/ui-kit/primitives/media.js.map +0 -1
- package/dist/ui-kit/primitives/quote-button.d.ts +0 -46
- package/dist/ui-kit/primitives/quote-button.d.ts.map +0 -1
- package/dist/ui-kit/primitives/quote-button.js +0 -38
- package/dist/ui-kit/primitives/quote-button.js.map +0 -1
- package/dist/ui-kit/primitives/stat.d.ts +0 -25
- package/dist/ui-kit/primitives/stat.d.ts.map +0 -1
- package/dist/ui-kit/primitives/stat.js +0 -7
- package/dist/ui-kit/primitives/stat.js.map +0 -1
- package/dist/ui-kit/repeated-slots.d.ts +0 -153
- package/dist/ui-kit/repeated-slots.d.ts.map +0 -1
- package/dist/ui-kit/repeated-slots.js +0 -100
- package/dist/ui-kit/repeated-slots.js.map +0 -1
- package/dist/ui-kit/sections/accordion.d.ts +0 -28
- package/dist/ui-kit/sections/accordion.d.ts.map +0 -1
- package/dist/ui-kit/sections/accordion.js +0 -14
- package/dist/ui-kit/sections/accordion.js.map +0 -1
- package/dist/ui-kit/sections/area-map.d.ts +0 -64
- package/dist/ui-kit/sections/area-map.d.ts.map +0 -1
- package/dist/ui-kit/sections/area-map.js +0 -146
- package/dist/ui-kit/sections/area-map.js.map +0 -1
- package/dist/ui-kit/sections/before-after.d.ts +0 -59
- package/dist/ui-kit/sections/before-after.d.ts.map +0 -1
- package/dist/ui-kit/sections/before-after.js +0 -42
- package/dist/ui-kit/sections/before-after.js.map +0 -1
- package/dist/ui-kit/sections/contact-block.d.ts +0 -77
- package/dist/ui-kit/sections/contact-block.d.ts.map +0 -1
- package/dist/ui-kit/sections/contact-block.js +0 -23
- package/dist/ui-kit/sections/contact-block.js.map +0 -1
- package/dist/ui-kit/sections/council-rules.d.ts +0 -64
- package/dist/ui-kit/sections/council-rules.d.ts.map +0 -1
- package/dist/ui-kit/sections/council-rules.js +0 -46
- package/dist/ui-kit/sections/council-rules.js.map +0 -1
- package/dist/ui-kit/sections/coverage.d.ts +0 -53
- package/dist/ui-kit/sections/coverage.d.ts.map +0 -1
- package/dist/ui-kit/sections/coverage.js +0 -57
- package/dist/ui-kit/sections/coverage.js.map +0 -1
- package/dist/ui-kit/sections/cta-band.d.ts +0 -67
- package/dist/ui-kit/sections/cta-band.d.ts.map +0 -1
- package/dist/ui-kit/sections/cta-band.js +0 -11
- package/dist/ui-kit/sections/cta-band.js.map +0 -1
- package/dist/ui-kit/sections/emergency-band.d.ts +0 -60
- package/dist/ui-kit/sections/emergency-band.d.ts.map +0 -1
- package/dist/ui-kit/sections/emergency-band.js +0 -43
- package/dist/ui-kit/sections/emergency-band.js.map +0 -1
- package/dist/ui-kit/sections/faqs.d.ts +0 -46
- package/dist/ui-kit/sections/faqs.d.ts.map +0 -1
- package/dist/ui-kit/sections/faqs.js +0 -39
- package/dist/ui-kit/sections/faqs.js.map +0 -1
- package/dist/ui-kit/sections/gallery.d.ts +0 -60
- package/dist/ui-kit/sections/gallery.d.ts.map +0 -1
- package/dist/ui-kit/sections/gallery.js +0 -39
- package/dist/ui-kit/sections/gallery.js.map +0 -1
- package/dist/ui-kit/sections/hero.d.ts +0 -168
- package/dist/ui-kit/sections/hero.d.ts.map +0 -1
- package/dist/ui-kit/sections/hero.js +0 -147
- package/dist/ui-kit/sections/hero.js.map +0 -1
- package/dist/ui-kit/sections/index.d.ts +0 -29
- package/dist/ui-kit/sections/index.d.ts.map +0 -1
- package/dist/ui-kit/sections/index.js +0 -29
- package/dist/ui-kit/sections/index.js.map +0 -1
- package/dist/ui-kit/sections/licences.d.ts +0 -95
- package/dist/ui-kit/sections/licences.d.ts.map +0 -1
- package/dist/ui-kit/sections/licences.js +0 -72
- package/dist/ui-kit/sections/licences.js.map +0 -1
- package/dist/ui-kit/sections/local-facts.d.ts +0 -107
- package/dist/ui-kit/sections/local-facts.d.ts.map +0 -1
- package/dist/ui-kit/sections/local-facts.js +0 -44
- package/dist/ui-kit/sections/local-facts.js.map +0 -1
- package/dist/ui-kit/sections/nearby-areas.d.ts +0 -50
- package/dist/ui-kit/sections/nearby-areas.d.ts.map +0 -1
- package/dist/ui-kit/sections/nearby-areas.js +0 -49
- package/dist/ui-kit/sections/nearby-areas.js.map +0 -1
- package/dist/ui-kit/sections/nearby-jobs.d.ts +0 -84
- package/dist/ui-kit/sections/nearby-jobs.d.ts.map +0 -1
- package/dist/ui-kit/sections/nearby-jobs.js +0 -69
- package/dist/ui-kit/sections/nearby-jobs.js.map +0 -1
- package/dist/ui-kit/sections/page-header.d.ts +0 -29
- package/dist/ui-kit/sections/page-header.d.ts.map +0 -1
- package/dist/ui-kit/sections/page-header.js +0 -9
- package/dist/ui-kit/sections/page-header.js.map +0 -1
- package/dist/ui-kit/sections/price-guide.d.ts +0 -59
- package/dist/ui-kit/sections/price-guide.d.ts.map +0 -1
- package/dist/ui-kit/sections/price-guide.js +0 -28
- package/dist/ui-kit/sections/price-guide.js.map +0 -1
- package/dist/ui-kit/sections/price-table.d.ts +0 -42
- package/dist/ui-kit/sections/price-table.d.ts.map +0 -1
- package/dist/ui-kit/sections/price-table.js +0 -29
- package/dist/ui-kit/sections/price-table.js.map +0 -1
- package/dist/ui-kit/sections/projects.d.ts +0 -79
- package/dist/ui-kit/sections/projects.d.ts.map +0 -1
- package/dist/ui-kit/sections/projects.js +0 -69
- package/dist/ui-kit/sections/projects.js.map +0 -1
- package/dist/ui-kit/sections/proof-strip.d.ts +0 -68
- package/dist/ui-kit/sections/proof-strip.d.ts.map +0 -1
- package/dist/ui-kit/sections/proof-strip.js +0 -27
- package/dist/ui-kit/sections/proof-strip.js.map +0 -1
- package/dist/ui-kit/sections/quote-checklist.d.ts +0 -43
- package/dist/ui-kit/sections/quote-checklist.d.ts.map +0 -1
- package/dist/ui-kit/sections/quote-checklist.js +0 -19
- package/dist/ui-kit/sections/quote-checklist.js.map +0 -1
- package/dist/ui-kit/sections/rating-chip.d.ts +0 -35
- package/dist/ui-kit/sections/rating-chip.d.ts.map +0 -1
- package/dist/ui-kit/sections/rating-chip.js +0 -21
- package/dist/ui-kit/sections/rating-chip.js.map +0 -1
- package/dist/ui-kit/sections/related-services.d.ts +0 -41
- package/dist/ui-kit/sections/related-services.d.ts.map +0 -1
- package/dist/ui-kit/sections/related-services.js +0 -52
- package/dist/ui-kit/sections/related-services.js.map +0 -1
- package/dist/ui-kit/sections/reviews-band.d.ts +0 -124
- package/dist/ui-kit/sections/reviews-band.d.ts.map +0 -1
- package/dist/ui-kit/sections/reviews-band.js +0 -115
- package/dist/ui-kit/sections/reviews-band.js.map +0 -1
- package/dist/ui-kit/sections/section-sequence.d.ts +0 -41
- package/dist/ui-kit/sections/section-sequence.d.ts.map +0 -1
- package/dist/ui-kit/sections/section-sequence.js +0 -36
- package/dist/ui-kit/sections/section-sequence.js.map +0 -1
- package/dist/ui-kit/sections/services-grid.d.ts +0 -82
- package/dist/ui-kit/sections/services-grid.d.ts.map +0 -1
- package/dist/ui-kit/sections/services-grid.js +0 -90
- package/dist/ui-kit/sections/services-grid.js.map +0 -1
- package/dist/ui-kit/sections/signature-section.d.ts +0 -42
- package/dist/ui-kit/sections/signature-section.d.ts.map +0 -1
- package/dist/ui-kit/sections/signature-section.js +0 -14
- package/dist/ui-kit/sections/signature-section.js.map +0 -1
- package/dist/ui-kit/sections/site-footer-columns.d.ts +0 -12
- package/dist/ui-kit/sections/site-footer-columns.d.ts.map +0 -1
- package/dist/ui-kit/sections/site-footer-columns.js +0 -63
- package/dist/ui-kit/sections/site-footer-columns.js.map +0 -1
- package/dist/ui-kit/sections/site-footer.d.ts +0 -66
- package/dist/ui-kit/sections/site-footer.d.ts.map +0 -1
- package/dist/ui-kit/sections/site-footer.js +0 -49
- package/dist/ui-kit/sections/site-footer.js.map +0 -1
- package/dist/ui-kit/sections/work-photos.d.ts +0 -15
- package/dist/ui-kit/sections/work-photos.d.ts.map +0 -1
- package/dist/ui-kit/sections/work-photos.js +0 -24
- package/dist/ui-kit/sections/work-photos.js.map +0 -1
- package/dist/ui-kit/shell/back-to-top-client.d.ts +0 -9
- package/dist/ui-kit/shell/back-to-top-client.d.ts.map +0 -1
- package/dist/ui-kit/shell/back-to-top-client.js +0 -8
- package/dist/ui-kit/shell/back-to-top-client.js.map +0 -1
- package/dist/ui-kit/shell/back-to-top.d.ts +0 -13
- package/dist/ui-kit/shell/back-to-top.d.ts.map +0 -1
- package/dist/ui-kit/shell/back-to-top.js +0 -14
- package/dist/ui-kit/shell/back-to-top.js.map +0 -1
- package/dist/ui-kit/shell/call-bar-client.d.ts +0 -8
- package/dist/ui-kit/shell/call-bar-client.d.ts.map +0 -1
- package/dist/ui-kit/shell/call-bar-client.js +0 -13
- package/dist/ui-kit/shell/call-bar-client.js.map +0 -1
- package/dist/ui-kit/shell/current-link.d.ts +0 -45
- package/dist/ui-kit/shell/current-link.d.ts.map +0 -1
- package/dist/ui-kit/shell/current-link.js +0 -54
- package/dist/ui-kit/shell/current-link.js.map +0 -1
- package/dist/ui-kit/shell/drawer-client.d.ts +0 -22
- package/dist/ui-kit/shell/drawer-client.d.ts.map +0 -1
- package/dist/ui-kit/shell/drawer-client.js +0 -70
- package/dist/ui-kit/shell/drawer-client.js.map +0 -1
- package/dist/ui-kit/shell/header-client.d.ts +0 -44
- package/dist/ui-kit/shell/header-client.d.ts.map +0 -1
- package/dist/ui-kit/shell/header-client.js +0 -59
- package/dist/ui-kit/shell/header-client.js.map +0 -1
- package/dist/ui-kit/shell/index.d.ts +0 -7
- package/dist/ui-kit/shell/index.d.ts.map +0 -1
- package/dist/ui-kit/shell/index.js +0 -7
- package/dist/ui-kit/shell/index.js.map +0 -1
- package/dist/ui-kit/shell/intent-prefetch.d.ts +0 -4
- package/dist/ui-kit/shell/intent-prefetch.d.ts.map +0 -1
- package/dist/ui-kit/shell/intent-prefetch.js +0 -62
- package/dist/ui-kit/shell/intent-prefetch.js.map +0 -1
- package/dist/ui-kit/shell/mobile-call-bar.d.ts +0 -25
- package/dist/ui-kit/shell/mobile-call-bar.d.ts.map +0 -1
- package/dist/ui-kit/shell/mobile-call-bar.js +0 -21
- package/dist/ui-kit/shell/mobile-call-bar.js.map +0 -1
- package/dist/ui-kit/shell/mobile-drawer.d.ts +0 -41
- package/dist/ui-kit/shell/mobile-drawer.d.ts.map +0 -1
- package/dist/ui-kit/shell/mobile-drawer.js +0 -41
- package/dist/ui-kit/shell/mobile-drawer.js.map +0 -1
- package/dist/ui-kit/shell/shell-context.d.ts +0 -3
- package/dist/ui-kit/shell/shell-context.d.ts.map +0 -1
- package/dist/ui-kit/shell/shell-context.js +0 -5
- package/dist/ui-kit/shell/shell-context.js.map +0 -1
- package/dist/ui-kit/shell/shell-quote.d.ts +0 -10
- package/dist/ui-kit/shell/shell-quote.d.ts.map +0 -1
- package/dist/ui-kit/shell/shell-quote.js +0 -13
- package/dist/ui-kit/shell/shell-quote.js.map +0 -1
- package/dist/ui-kit/shell/site-header.d.ts +0 -55
- package/dist/ui-kit/shell/site-header.d.ts.map +0 -1
- package/dist/ui-kit/shell/site-header.js +0 -35
- package/dist/ui-kit/shell/site-header.js.map +0 -1
- package/dist/ui-kit/shell/social-links.d.ts +0 -7
- package/dist/ui-kit/shell/social-links.d.ts.map +0 -1
- package/dist/ui-kit/shell/social-links.js +0 -12
- package/dist/ui-kit/shell/social-links.js.map +0 -1
- package/dist/ui-kit/shell/utility-bar.d.ts +0 -33
- package/dist/ui-kit/shell/utility-bar.d.ts.map +0 -1
- package/dist/ui-kit/shell/utility-bar.js +0 -15
- package/dist/ui-kit/shell/utility-bar.js.map +0 -1
- package/dist/ui-kit/skin-index.d.ts +0 -4
- package/dist/ui-kit/skin-index.d.ts.map +0 -1
- package/dist/ui-kit/skin-index.js +0 -3
- package/dist/ui-kit/skin-index.js.map +0 -1
- package/dist/ui-kit/skin.d.ts +0 -65
- package/dist/ui-kit/skin.d.ts.map +0 -1
- package/dist/ui-kit/skin.js +0 -60
- package/dist/ui-kit/skin.js.map +0 -1
- package/dist/ui-kit/structure.css +0 -2546
- package/dist/ui-kit/types.d.ts +0 -27
- package/dist/ui-kit/types.d.ts.map +0 -1
- package/dist/ui-kit/types.js +0 -6
- package/dist/ui-kit/types.js.map +0 -1
package/dist/blog.d.ts
CHANGED
|
@@ -34,7 +34,15 @@ export declare function createRouteAwareMdxBlogAdapter<Content>(options: Brandla
|
|
|
34
34
|
slug: string;
|
|
35
35
|
}[];
|
|
36
36
|
generateMetadata(slug: string): NextCompatibleMetadata | undefined;
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* The post's BlogPosting node. An author with a `schemaId` (the business byline) is referenced by that `@id`, never
|
|
39
|
+
* typed as a Person (3.20.0). `about` names the nodes the guide is about (the service's `#service` node) and
|
|
40
|
+
* `articleSection` its group of guides.
|
|
41
|
+
*/
|
|
42
|
+
generateSchema(slug: string, extra?: {
|
|
43
|
+
readonly aboutIds?: readonly string[];
|
|
44
|
+
readonly articleSection?: string;
|
|
45
|
+
}): import("@brandlab-digital/site-core/schema").BrandlabSchemaNode | undefined;
|
|
38
46
|
getSitemapEntries(): SitemapEntry[];
|
|
39
47
|
getRelatedPosts(slug: string, limit?: number): (BrandlabBlogPost & {
|
|
40
48
|
status: "published";
|
|
@@ -62,7 +70,15 @@ export declare function createRouteAwareStructuredBlogAdapter<Content>(options:
|
|
|
62
70
|
slug: string;
|
|
63
71
|
}[];
|
|
64
72
|
generateMetadata(slug: string): NextCompatibleMetadata | undefined;
|
|
65
|
-
|
|
73
|
+
/**
|
|
74
|
+
* The post's BlogPosting node. An author with a `schemaId` (the business byline) is referenced by that `@id`, never
|
|
75
|
+
* typed as a Person (3.20.0). `about` names the nodes the guide is about (the service's `#service` node) and
|
|
76
|
+
* `articleSection` its group of guides.
|
|
77
|
+
*/
|
|
78
|
+
generateSchema(slug: string, extra?: {
|
|
79
|
+
readonly aboutIds?: readonly string[];
|
|
80
|
+
readonly articleSection?: string;
|
|
81
|
+
}): import("@brandlab-digital/site-core/schema").BrandlabSchemaNode | undefined;
|
|
66
82
|
getSitemapEntries(): SitemapEntry[];
|
|
67
83
|
getRelatedPosts(slug: string, limit?: number): (BrandlabBlogPost & {
|
|
68
84
|
status: "published";
|
package/dist/blog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blog.d.ts","sourceRoot":"","sources":["../src/blog.ts"],"names":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.js
CHANGED
|
@@ -56,7 +56,12 @@ function createBrandlabBlogAdapter(options) {
|
|
|
56
56
|
...(post.image ? { socialImage: post.image } : {}),
|
|
57
57
|
});
|
|
58
58
|
},
|
|
59
|
-
|
|
59
|
+
/**
|
|
60
|
+
* The post's BlogPosting node. An author with a `schemaId` (the business byline) is referenced by that `@id`, never
|
|
61
|
+
* typed as a Person (3.20.0). `about` names the nodes the guide is about (the service's `#service` node) and
|
|
62
|
+
* `articleSection` its group of guides.
|
|
63
|
+
*/
|
|
64
|
+
generateSchema(slug, extra = {}) {
|
|
60
65
|
const post = published().find((candidate) => candidate.slug === slug);
|
|
61
66
|
if (!post)
|
|
62
67
|
return undefined;
|
|
@@ -69,8 +74,15 @@ function createBrandlabBlogAdapter(options) {
|
|
|
69
74
|
description: post.description,
|
|
70
75
|
datePublished: post.publishedAt,
|
|
71
76
|
...(post.modifiedAt ? { dateModified: post.modifiedAt } : {}),
|
|
72
|
-
|
|
77
|
+
...(post.authors.some((author) => author.schemaId === undefined)
|
|
78
|
+
? { authorNames: post.authors.filter((author) => author.schemaId === undefined).map((author) => author.name) }
|
|
79
|
+
: {}),
|
|
80
|
+
...(post.authors.some((author) => author.schemaId !== undefined)
|
|
81
|
+
? { authorIds: post.authors.flatMap((author) => (author.schemaId === undefined ? [] : [author.schemaId])) }
|
|
82
|
+
: {}),
|
|
73
83
|
publisherId: options.publisherId,
|
|
84
|
+
...(extra.aboutIds && extra.aboutIds.length > 0 ? { aboutIds: extra.aboutIds } : {}),
|
|
85
|
+
...(extra.articleSection !== undefined ? { articleSection: extra.articleSection } : {}),
|
|
74
86
|
...(post.image
|
|
75
87
|
? { imageUrls: [resolveBlogAssetUrl(options.site.canonicalUrl, post.image.url)] }
|
|
76
88
|
: {}),
|
package/dist/blog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blog.js","sourceRoot":"","sources":["../src/blog.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,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,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC;QACtF,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAC7D,CAAA;AACH,CAAC","sourcesContent":["import {\n defineBlogPost,\n getPublishedBlogPosts,\n isPublishedBlogPost,\n type BrandlabBlogAdapter,\n type BrandlabBlogPost,\n} from '@brandlab-digital/site-core/blog'\nimport { getAbsoluteUrl } from '@brandlab-digital/site-core/metadata'\nimport {\n getRouteByPath,\n type BrandlabRoute,\n type BrandlabRouteCatalog,\n} from '@brandlab-digital/site-core/routes'\nimport { buildBlogPostingSchema } from '@brandlab-digital/site-core/schema'\nimport type { BrandlabSite } from '@brandlab-digital/site-core/site'\nimport { escapeXml, type SitemapEntry } from '@brandlab-digital/site-core/sitemaps'\nimport {\n createRouteMetadataBuilder,\n type NextCompatibleMetadata,\n} from './metadata.js'\n\nexport interface BrandlabBlogAdapterOptions<Content> {\n adapter: BrandlabBlogAdapter\n posts: readonly BrandlabBlogPost[]\n /** The site identity from defineBrandlabSite; supplies canonical URLs and metadata defaults. */\n site: BrandlabSite\n publisherId: string\n resolveContent: (post: BrandlabBlogPost) => Content | Promise<Content>\n now?: () => Date\n routes: BrandlabRouteCatalog\n rss?: {\n title: string\n description: string\n path?: string\n }\n}\n\nfunction createBrandlabBlogAdapter<Content>(\n options: BrandlabBlogAdapterOptions<Content>,\n) {\n options.posts.forEach(defineBlogPost)\n assertUniquePosts(options.posts)\n const mismatchedAdapter = options.posts.find((post) => post.adapter !== options.adapter)\n if (mismatchedAdapter) {\n throw new Error(\n `Blog post \"${mismatchedAdapter.id}\" uses adapter \"${mismatchedAdapter.adapter}\" instead of \"${options.adapter}\".`,\n )\n }\n const eligiblePosts = options.posts.filter((post) => post.adapter === options.adapter)\n const published = () => getPublishedBlogPosts(eligiblePosts, options.now?.() ?? new Date())\n const routeMetadata = createRouteMetadataBuilder(options.site, options.routes)\n const validationTime = options.now?.() ?? new Date()\n eligiblePosts.forEach((post) => {\n const route = getBlogRoute(post, options.routes)\n if (route.kind !== 'blog-post') {\n throw new Error(`Blog post \"${post.id}\" must reference a blog-post route.`)\n }\n if (!isPublishedBlogPost(post, validationTime) && route.indexing === 'index') {\n throw new Error(\n `Unpublished blog post \"${post.id}\" must not use an indexable route.`,\n )\n }\n })\n const postPaths = new Set(eligiblePosts.map((post) => post.path))\n const routeWithoutPost = options.routes.find(\n (route) => route.kind === 'blog-post' && !postPaths.has(route.path),\n )\n if (routeWithoutPost) {\n throw new Error(\n `Blog-post route \"${routeWithoutPost.id}\" has no matching ${options.adapter} content record.`,\n )\n }\n\n return {\n getPublishedPosts: published,\n getPostBySlug(slug: string) {\n return published().find((post) => post.slug === slug)\n },\n generateStaticParams() {\n return published().map((post) => ({ slug: post.slug }))\n },\n generateMetadata(slug: string): NextCompatibleMetadata | undefined {\n const post = published().find((candidate) => candidate.slug === slug)\n if (!post) return undefined\n const metadataTitle = post.seo?.title ?? post.headline\n const route = getBlogRoute(post, options.routes)\n return routeMetadata({\n routeId: route.id,\n title: metadataTitle,\n description: post.description,\n ...(post.seo?.titleMode ? { titleMode: post.seo.titleMode } : {}),\n article: {\n publishedTime: post.publishedAt,\n ...(post.modifiedAt ? { modifiedTime: post.modifiedAt } : {}),\n authors: post.authors.map((author) => author.name),\n },\n ...(post.image ? { socialImage: post.image } : {}),\n })\n },\n generateSchema(slug: string) {\n const post = published().find((candidate) => candidate.slug === slug)\n if (!post) return undefined\n const route = getBlogRoute(post, options.routes)\n const url = getAbsoluteUrl(\n options.site.canonicalUrl,\n route.canonicalPath ?? route.path,\n )\n return buildBlogPostingSchema({\n id: `${url}#article`,\n url,\n headline: post.headline,\n description: post.description,\n datePublished: post.publishedAt,\n ...(post.modifiedAt ? { dateModified: post.modifiedAt } : {}),\n authorNames: post.authors.map((author) => author.name),\n publisherId: options.publisherId,\n ...(post.image\n ? { imageUrls: [resolveBlogAssetUrl(options.site.canonicalUrl, post.image.url)] }\n : {}),\n mainEntityOfPageId: url,\n })\n },\n getSitemapEntries(): SitemapEntry[] {\n return published().flatMap((post) => {\n const route = getBlogRoute(post, options.routes)\n if (route.indexing !== 'index') return []\n return [{\n url: getAbsoluteUrl(\n options.site.canonicalUrl,\n route.canonicalPath ?? route.path,\n ),\n lastModified:\n route.lastSignificantChange ?? post.modifiedAt ?? post.publishedAt,\n }]\n })\n },\n getRelatedPosts(slug: string, limit = 3) {\n const source = published().find((post) => post.slug === slug)\n if (!source || limit < 1) return []\n return published()\n .filter((post) => post.slug !== slug)\n .map((post) => ({ post, score: relatedScore(source, post) }))\n .filter((candidate) => candidate.score > 0)\n .sort((left, right) => right.score - left.score || right.post.headline.localeCompare(left.post.headline))\n .slice(0, limit)\n .map((candidate) => candidate.post)\n },\n renderRss() {\n if (!options.rss) return undefined\n const feedUrl = getAbsoluteUrl(options.site.canonicalUrl, options.rss.path ?? '/rss.xml')\n const siteUrl = getAbsoluteUrl(options.site.canonicalUrl, '/')\n const items = published()\n .map((post) => {\n const route = getBlogRoute(post, options.routes)\n if (route.indexing !== 'index') return ''\n const url = getAbsoluteUrl(\n options.site.canonicalUrl,\n route.canonicalPath ?? route.path,\n )\n return [\n ' <item>',\n ` <title>${escapeXml(post.headline)}</title>`,\n ` <link>${escapeXml(url)}</link>`,\n ` <guid isPermaLink=\"true\">${escapeXml(url)}</guid>`,\n ` <description>${escapeXml(post.description)}</description>`,\n ` <pubDate>${new Date(post.publishedAt).toUTCString()}</pubDate>`,\n ' </item>',\n ].join('\\n')\n })\n .join('\\n')\n return [\n '<?xml version=\"1.0\" encoding=\"UTF-8\"?>',\n '<rss version=\"2.0\">',\n ' <channel>',\n ` <title>${escapeXml(options.rss.title)}</title>`,\n ` <link>${escapeXml(siteUrl)}</link>`,\n ` <description>${escapeXml(options.rss.description)}</description>`,\n ` <atom:link xmlns:atom=\"http://www.w3.org/2005/Atom\" href=\"${escapeXml(feedUrl)}\" rel=\"self\" type=\"application/rss+xml\"/>`,\n items,\n ' </channel>',\n '</rss>',\n ].filter(Boolean).join('\\n')\n },\n async resolve(slug: string) {\n const post = published().find((candidate) => candidate.slug === slug)\n return post ? { post, content: await options.resolveContent(post) } : undefined\n },\n }\n}\n\nfunction resolveBlogAssetUrl(siteUrl: string, value: string) {\n let resolved: URL\n try {\n resolved = new URL(value, getAbsoluteUrl(siteUrl, '/'))\n } catch {\n throw new Error('Blog image URL must resolve to absolute HTTPS.')\n }\n if (resolved.protocol !== 'https:' || resolved.username || resolved.password) {\n throw new Error('Blog image URL must resolve to absolute HTTPS.')\n }\n return resolved.href\n}\n\nexport type BrandlabRouteAwareBlogAdapterOptions<Content> = Omit<\n BrandlabBlogAdapterOptions<Content>,\n 'adapter' | 'routes'\n> & { routes: BrandlabRouteCatalog }\n\nexport function createRouteAwareMdxBlogAdapter<Content>(\n options: BrandlabRouteAwareBlogAdapterOptions<Content>,\n) {\n return createBrandlabBlogAdapter({ ...options, adapter: 'mdx' })\n}\n\nexport function createRouteAwareStructuredBlogAdapter<Content>(\n options: BrandlabRouteAwareBlogAdapterOptions<Content>,\n) {\n return createBrandlabBlogAdapter({ ...options, adapter: 'structured' })\n}\n\nfunction getBlogRoute(post: BrandlabBlogPost, routes: BrandlabRouteCatalog): BrandlabRoute {\n const route = getRouteByPath(routes, post.path)\n if (!route) throw new Error(`Blog post \"${post.id}\" has no route-catalog record for \"${post.path}\".`)\n return route\n}\n\nfunction assertUniquePosts(posts: readonly BrandlabBlogPost[]) {\n for (const field of ['id', 'slug', 'path'] as const) {\n const values = posts.map((post) => post[field])\n const duplicate = values.find((value, index) => values.indexOf(value) !== index)\n if (duplicate) throw new Error(`Blog posts contain duplicate ${field} \"${duplicate}\".`)\n }\n}\n\nfunction relatedScore(source: BrandlabBlogPost, candidate: BrandlabBlogPost) {\n const categories = new Set(source.categories ?? [])\n const tags = new Set(source.tags ?? [])\n return (\n (candidate.categories ?? []).filter((category) => categories.has(category)).length * 2 +\n (candidate.tags ?? []).filter((tag) => tags.has(tag)).length\n )\n}\n"]}
|
|
1
|
+
{"version":3,"file":"blog.js","sourceRoot":"","sources":["../src/blog.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,mBAAmB,GAGpB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AACrE,OAAO,EACL,cAAc,GAGf,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAE3E,OAAO,EAAE,SAAS,EAAqB,MAAM,sCAAsC,CAAA;AACnF,OAAO,EACL,0BAA0B,GAE3B,MAAM,eAAe,CAAA;AAkBtB,SAAS,yBAAyB,CAChC,OAA4C;IAE5C,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;IACrC,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAChC,MAAM,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACxF,IAAI,iBAAiB,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,cAAc,iBAAiB,CAAC,EAAE,mBAAmB,iBAAiB,CAAC,OAAO,iBAAiB,OAAO,CAAC,OAAO,IAAI,CACnH,CAAA;IACH,CAAC;IACD,MAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACtF,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,qBAAqB,CAAC,aA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UAAU,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC;QACtF,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAC7D,CAAA;AACH,CAAC","sourcesContent":["import {\n defineBlogPost,\n getPublishedBlogPosts,\n isPublishedBlogPost,\n type BrandlabBlogAdapter,\n type BrandlabBlogPost,\n} from '@brandlab-digital/site-core/blog'\nimport { getAbsoluteUrl } from '@brandlab-digital/site-core/metadata'\nimport {\n getRouteByPath,\n type BrandlabRoute,\n type BrandlabRouteCatalog,\n} from '@brandlab-digital/site-core/routes'\nimport { buildBlogPostingSchema } from '@brandlab-digital/site-core/schema'\nimport type { BrandlabSite } from '@brandlab-digital/site-core/site'\nimport { escapeXml, type SitemapEntry } from '@brandlab-digital/site-core/sitemaps'\nimport {\n createRouteMetadataBuilder,\n type NextCompatibleMetadata,\n} from './metadata.js'\n\nexport interface BrandlabBlogAdapterOptions<Content> {\n adapter: BrandlabBlogAdapter\n posts: readonly BrandlabBlogPost[]\n /** The site identity from defineBrandlabSite; supplies canonical URLs and metadata defaults. */\n site: BrandlabSite\n publisherId: string\n resolveContent: (post: BrandlabBlogPost) => Content | Promise<Content>\n now?: () => Date\n routes: BrandlabRouteCatalog\n rss?: {\n title: string\n description: string\n path?: string\n }\n}\n\nfunction createBrandlabBlogAdapter<Content>(\n options: BrandlabBlogAdapterOptions<Content>,\n) {\n options.posts.forEach(defineBlogPost)\n assertUniquePosts(options.posts)\n const mismatchedAdapter = options.posts.find((post) => post.adapter !== options.adapter)\n if (mismatchedAdapter) {\n throw new Error(\n `Blog post \"${mismatchedAdapter.id}\" uses adapter \"${mismatchedAdapter.adapter}\" instead of \"${options.adapter}\".`,\n )\n }\n const eligiblePosts = options.posts.filter((post) => post.adapter === options.adapter)\n const published = () => getPublishedBlogPosts(eligiblePosts, options.now?.() ?? new Date())\n const routeMetadata = createRouteMetadataBuilder(options.site, options.routes)\n const validationTime = options.now?.() ?? new Date()\n eligiblePosts.forEach((post) => {\n const route = getBlogRoute(post, options.routes)\n if (route.kind !== 'blog-post') {\n throw new Error(`Blog post \"${post.id}\" must reference a blog-post route.`)\n }\n if (!isPublishedBlogPost(post, validationTime) && route.indexing === 'index') {\n throw new Error(\n `Unpublished blog post \"${post.id}\" must not use an indexable route.`,\n )\n }\n })\n const postPaths = new Set(eligiblePosts.map((post) => post.path))\n const routeWithoutPost = options.routes.find(\n (route) => route.kind === 'blog-post' && !postPaths.has(route.path),\n )\n if (routeWithoutPost) {\n throw new Error(\n `Blog-post route \"${routeWithoutPost.id}\" has no matching ${options.adapter} content record.`,\n )\n }\n\n return {\n getPublishedPosts: published,\n getPostBySlug(slug: string) {\n return published().find((post) => post.slug === slug)\n },\n generateStaticParams() {\n return published().map((post) => ({ slug: post.slug }))\n },\n generateMetadata(slug: string): NextCompatibleMetadata | undefined {\n const post = published().find((candidate) => candidate.slug === slug)\n if (!post) return undefined\n const metadataTitle = post.seo?.title ?? post.headline\n const route = getBlogRoute(post, options.routes)\n return routeMetadata({\n routeId: route.id,\n title: metadataTitle,\n description: post.description,\n ...(post.seo?.titleMode ? { titleMode: post.seo.titleMode } : {}),\n article: {\n publishedTime: post.publishedAt,\n ...(post.modifiedAt ? { modifiedTime: post.modifiedAt } : {}),\n authors: post.authors.map((author) => author.name),\n },\n ...(post.image ? { socialImage: post.image } : {}),\n })\n },\n /**\n * The post's BlogPosting node. An author with a `schemaId` (the business byline) is referenced by that `@id`, never\n * typed as a Person (3.20.0). `about` names the nodes the guide is about (the service's `#service` node) and\n * `articleSection` its group of guides.\n */\n generateSchema(slug: string, extra: { readonly aboutIds?: readonly string[]; readonly articleSection?: string } = {}) {\n const post = published().find((candidate) => candidate.slug === slug)\n if (!post) return undefined\n const route = getBlogRoute(post, options.routes)\n const url = getAbsoluteUrl(\n options.site.canonicalUrl,\n route.canonicalPath ?? route.path,\n )\n return buildBlogPostingSchema({\n id: `${url}#article`,\n url,\n headline: post.headline,\n description: post.description,\n datePublished: post.publishedAt,\n ...(post.modifiedAt ? { dateModified: post.modifiedAt } : {}),\n ...(post.authors.some((author) => author.schemaId === undefined)\n ? { authorNames: post.authors.filter((author) => author.schemaId === undefined).map((author) => author.name) }\n : {}),\n ...(post.authors.some((author) => author.schemaId !== undefined)\n ? { authorIds: post.authors.flatMap((author) => (author.schemaId === undefined ? [] : [author.schemaId])) }\n : {}),\n publisherId: options.publisherId,\n ...(extra.aboutIds && extra.aboutIds.length > 0 ? { aboutIds: extra.aboutIds } : {}),\n ...(extra.articleSection !== undefined ? { articleSection: extra.articleSection } : {}),\n ...(post.image\n ? { imageUrls: [resolveBlogAssetUrl(options.site.canonicalUrl, post.image.url)] }\n : {}),\n mainEntityOfPageId: url,\n })\n },\n getSitemapEntries(): SitemapEntry[] {\n return published().flatMap((post) => {\n const route = getBlogRoute(post, options.routes)\n if (route.indexing !== 'index') return []\n return [{\n url: getAbsoluteUrl(\n options.site.canonicalUrl,\n route.canonicalPath ?? route.path,\n ),\n lastModified:\n route.lastSignificantChange ?? post.modifiedAt ?? post.publishedAt,\n }]\n })\n },\n getRelatedPosts(slug: string, limit = 3) {\n const source = published().find((post) => post.slug === slug)\n if (!source || limit < 1) return []\n return published()\n .filter((post) => post.slug !== slug)\n .map((post) => ({ post, score: relatedScore(source, post) }))\n .filter((candidate) => candidate.score > 0)\n .sort((left, right) => right.score - left.score || right.post.headline.localeCompare(left.post.headline))\n .slice(0, limit)\n .map((candidate) => candidate.post)\n },\n renderRss() {\n if (!options.rss) return undefined\n const feedUrl = getAbsoluteUrl(options.site.canonicalUrl, options.rss.path ?? '/rss.xml')\n const siteUrl = getAbsoluteUrl(options.site.canonicalUrl, '/')\n const items = published()\n .map((post) => {\n const route = getBlogRoute(post, options.routes)\n if (route.indexing !== 'index') return ''\n const url = getAbsoluteUrl(\n options.site.canonicalUrl,\n route.canonicalPath ?? route.path,\n )\n return [\n ' <item>',\n ` <title>${escapeXml(post.headline)}</title>`,\n ` <link>${escapeXml(url)}</link>`,\n ` <guid isPermaLink=\"true\">${escapeXml(url)}</guid>`,\n ` <description>${escapeXml(post.description)}</description>`,\n ` <pubDate>${new Date(post.publishedAt).toUTCString()}</pubDate>`,\n ' </item>',\n ].join('\\n')\n })\n .join('\\n')\n return [\n '<?xml version=\"1.0\" encoding=\"UTF-8\"?>',\n '<rss version=\"2.0\">',\n ' <channel>',\n ` <title>${escapeXml(options.rss.title)}</title>`,\n ` <link>${escapeXml(siteUrl)}</link>`,\n ` <description>${escapeXml(options.rss.description)}</description>`,\n ` <atom:link xmlns:atom=\"http://www.w3.org/2005/Atom\" href=\"${escapeXml(feedUrl)}\" rel=\"self\" type=\"application/rss+xml\"/>`,\n items,\n ' </channel>',\n '</rss>',\n ].filter(Boolean).join('\\n')\n },\n async resolve(slug: string) {\n const post = published().find((candidate) => candidate.slug === slug)\n return post ? { post, content: await options.resolveContent(post) } : undefined\n },\n }\n}\n\nfunction resolveBlogAssetUrl(siteUrl: string, value: string) {\n let resolved: URL\n try {\n resolved = new URL(value, getAbsoluteUrl(siteUrl, '/'))\n } catch {\n throw new Error('Blog image URL must resolve to absolute HTTPS.')\n }\n if (resolved.protocol !== 'https:' || resolved.username || resolved.password) {\n throw new Error('Blog image URL must resolve to absolute HTTPS.')\n }\n return resolved.href\n}\n\nexport type BrandlabRouteAwareBlogAdapterOptions<Content> = Omit<\n BrandlabBlogAdapterOptions<Content>,\n 'adapter' | 'routes'\n> & { routes: BrandlabRouteCatalog }\n\nexport function createRouteAwareMdxBlogAdapter<Content>(\n options: BrandlabRouteAwareBlogAdapterOptions<Content>,\n) {\n return createBrandlabBlogAdapter({ ...options, adapter: 'mdx' })\n}\n\nexport function createRouteAwareStructuredBlogAdapter<Content>(\n options: BrandlabRouteAwareBlogAdapterOptions<Content>,\n) {\n return createBrandlabBlogAdapter({ ...options, adapter: 'structured' })\n}\n\nfunction getBlogRoute(post: BrandlabBlogPost, routes: BrandlabRouteCatalog): BrandlabRoute {\n const route = getRouteByPath(routes, post.path)\n if (!route) throw new Error(`Blog post \"${post.id}\" has no route-catalog record for \"${post.path}\".`)\n return route\n}\n\nfunction assertUniquePosts(posts: readonly BrandlabBlogPost[]) {\n for (const field of ['id', 'slug', 'path'] as const) {\n const values = posts.map((post) => post[field])\n const duplicate = values.find((value, index) => values.indexOf(value) !== index)\n if (duplicate) throw new Error(`Blog posts contain duplicate ${field} \"${duplicate}\".`)\n }\n}\n\nfunction relatedScore(source: BrandlabBlogPost, candidate: BrandlabBlogPost) {\n const categories = new Set(source.categories ?? [])\n const tags = new Set(source.tags ?? [])\n return (\n (candidate.categories ?? []).filter((category) => categories.has(category)).length * 2 +\n (candidate.tags ?? []).filter((tag) => tags.has(tag)).length\n )\n}\n"]}
|
|
@@ -37,7 +37,7 @@ export declare function installPhoneClickListener(options: {
|
|
|
37
37
|
}): () => void;
|
|
38
38
|
/**
|
|
39
39
|
* The single delegated listener for lead calls to action: a click on an
|
|
40
|
-
* element carrying `data-bl-cta` (
|
|
40
|
+
* element carrying `data-bl-cta` (a site's quote button) sends one
|
|
41
41
|
* `lead_cta_click` with its cta id and its `data-bl-cta-placement`. Elements
|
|
42
42
|
* without an id or with a placement outside `LEAD_CTA_PLACEMENTS` send nothing.
|
|
43
43
|
* Rapid repeats of the same call to action on the same page are de-duplicated
|
|
@@ -160,7 +160,7 @@ function leadCtaPlacementValue(value) {
|
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
162
|
* The single delegated listener for lead calls to action: a click on an
|
|
163
|
-
* element carrying `data-bl-cta` (
|
|
163
|
+
* element carrying `data-bl-cta` (a site's quote button) sends one
|
|
164
164
|
* `lead_cta_click` with its cta id and its `data-bl-cta-placement`. Elements
|
|
165
165
|
* without an id or with a placement outside `LEAD_CTA_PLACEMENTS` send nothing.
|
|
166
166
|
* Rapid repeats of the same call to action on the same page are de-duplicated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation-client.js","sourceRoot":"","sources":["../src/instrumentation-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAErB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GAItB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,0BAA0B,EAC1B,kCAAkC,GACnC,MAAM,0BAA0B,CAAA;AASjC,MAAM,CAAC,MAAM,8BAA8B,GAAG,0BAA0B,CAAA;AACxE,MAAM,CAAC,MAAM,mCAAmC,GAAG,IAAI,CAAA;AAEvD,MAAM,UAAU,2BAA2B,CAAC,QAAmC;IAC7E,MAAM,OAAO,GAAG,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAG,CAAA;IACvC,IACE,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;QACxB,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;QACxB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;QACtB,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC;QAC3B,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC;QACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;QACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EACrB,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;IACD,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;IAClD,OAAO,UAAU,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AAClE,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,QAAgB,EAAE,IAAY;IACrE,OAAO,GAAG,QAAQ,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AG,EAAE,CAAC,SAAS,CAAA;IACnB,MAAM,QAAQ,GAAG,GAAG,EAAE;QACpB,cAAc,EAAE,CAAA;QAChB,iBAAiB,EAAE,CAAA;QACnB,IAAI,wBAAwB,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,QAAQ;YAAE,wBAAwB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC1F,CAAC,CAAA;IACD,wBAAwB,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC3C,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["import {\n isContactVisitSource,\n type ContactAttributionSummary,\n} from '@brandlab-digital/site-core/contact'\nimport {\n LEAD_CTA_PLACEMENTS,\n PHONE_CALL_PLACEMENTS,\n type BrandlabAnalytics,\n type LeadCtaPlacement,\n type PhoneCallPlacement,\n} from './analytics.js'\nimport {\n classifyContactAttribution,\n normalizeContactAttributionSummary,\n} from './contact/attribution.js'\n\nexport type PhoneCallLocation = PhoneCallPlacement\n\nexport interface LastPhoneCallEvent {\n key: string\n at: number\n}\n\nexport const INITIAL_LANDING_STORAGE_PREFIX = 'brandlab.initialLanding.'\nexport const DEFAULT_PHONE_CALL_DEDUPE_WINDOW_MS = 1200\n\nexport function normalizeInitialLandingPath(pathname: string | null | undefined) {\n const trimmed = pathname?.trim() || '/'\n if (\n !trimmed.startsWith('/') ||\n trimmed.startsWith('//') ||\n trimmed.includes('\\\\') ||\n /%(?:2f|5c)/i.test(trimmed) ||\n /[\\u0000-\\u001f\\u007f]/.test(trimmed) ||\n trimmed.includes('?') ||\n trimmed.includes('#')\n ) {\n return '/'\n }\n const normalized = trimmed.replace(/\\/{2,}/g, '/')\n return normalized === '/' ? '/' : normalized.replace(/\\/+$/, '')\n}\n\nexport function createPhoneCallDedupeKey(pagePath: string, href: string) {\n return `${pagePath}|${href}`\n}\n\nexport function shouldTrackPhoneCallClick(options: {\n key: string\n now: number\n lastEvent?: LastPhoneCallEvent\n dedupeWindowMs?: number\n}) {\n const windowMs = options.dedupeWindowMs ?? DEFAULT_PHONE_CALL_DEDUPE_WINDOW_MS\n return !(\n options.lastEvent &&\n options.lastEvent.key === options.key &&\n options.now - options.lastEvent.at < windowMs\n )\n}\n\nexport function persistInitialLanding(win: Window = window) {\n try {\n const pathKey = `${INITIAL_LANDING_STORAGE_PREFIX}path`\n const sourceKey = `${INITIAL_LANDING_STORAGE_PREFIX}source`\n const detailKey = `${INITIAL_LANDING_STORAGE_PREFIX}sourceDetail`\n const existingPath = win.sessionStorage.getItem(pathKey)\n const safePath = normalizeInitialLandingPath(existingPath ?? win.location.pathname)\n if (existingPath !== safePath) {\n win.sessionStorage.setItem(pathKey, safePath)\n }\n const existingSource = win.sessionStorage.getItem(sourceKey)\n if (!isContactVisitSource(existingSource)) {\n const attribution = classifyContactAttribution({\n initialLandingPath: safePath,\n search: win.location.search,\n referrer: win.document.referrer,\n siteOrigin: win.location.origin,\n })\n win.sessionStorage.setItem(sourceKey, attribution.visitSource)\n if (attribution.visitSourceDetail) {\n win.sessionStorage.setItem(detailKey, attribution.visitSourceDetail)\n } else {\n win.sessionStorage.removeItem(detailKey)\n }\n }\n // Remove values written by the pre-RC privacy contract. Query strings and\n // referrers are not needed for canonical lead measurement.\n win.sessionStorage.removeItem(`${INITIAL_LANDING_STORAGE_PREFIX}url`)\n win.sessionStorage.removeItem(`${INITIAL_LANDING_STORAGE_PREFIX}referrer`)\n } catch {\n // Storage failures must not affect navigation or lead tracking.\n }\n}\n\nexport function getInitialLandingPath(win: Window = window) {\n try {\n const value = win.sessionStorage.getItem(`${INITIAL_LANDING_STORAGE_PREFIX}path`)\n return value ? normalizeInitialLandingPath(value) : undefined\n } catch {\n return undefined\n }\n}\n\nexport function getInitialContactAttribution(win: Window = window): ContactAttributionSummary {\n const fallbackPath = normalizeInitialLandingPath(win.location.pathname)\n try {\n const initialLandingPath = normalizeInitialLandingPath(\n win.sessionStorage.getItem(`${INITIAL_LANDING_STORAGE_PREFIX}path`) ?? fallbackPath,\n )\n const visitSource = win.sessionStorage.getItem(`${INITIAL_LANDING_STORAGE_PREFIX}source`)\n const visitSourceDetail = win.sessionStorage.getItem(\n `${INITIAL_LANDING_STORAGE_PREFIX}sourceDetail`,\n )\n return normalizeContactAttributionSummary({\n initialLandingPath,\n visitSource: isContactVisitSource(visitSource) ? visitSource : 'direct-or-unknown',\n ...(visitSourceDetail ? { visitSourceDetail } : {}),\n })\n } catch {\n return { initialLandingPath: fallbackPath, visitSource: 'direct-or-unknown' }\n }\n}\n\nfunction placementValue(value: string | null | undefined): PhoneCallLocation | undefined {\n const normalized = value?.trim().toLowerCase()\n return PHONE_CALL_PLACEMENTS.includes(normalized as PhoneCallLocation)\n ? normalized as PhoneCallLocation\n : undefined\n}\n\n/**\n * Placement of a telephone link: its own `data-phone-location`, then a\n * `<header>` or `<footer>` ancestor, then the nearest ancestor declaring a\n * valid `data-phone-location` (for example a hero or call-to-action section),\n * otherwise `page`. Unrecognised values are ignored, so every tap still\n * produces exactly one event.\n */\nexport function getPhoneCallLocation(link: HTMLAnchorElement): PhoneCallLocation {\n const explicit = placementValue(link.getAttribute('data-phone-location'))\n if (explicit) return explicit\n if (link.closest('header')) return 'header'\n if (link.closest('footer')) return 'footer'\n for (\n let ancestor = link.parentElement?.closest('[data-phone-location]');\n ancestor;\n ancestor = ancestor.parentElement?.closest('[data-phone-location]')\n ) {\n const placement = placementValue(ancestor.getAttribute('data-phone-location'))\n if (placement) return placement\n }\n return 'page'\n}\n\nexport function installPhoneClickListener(options: {\n trackPhoneLinkClick: (context: {\n pagePath: string\n location: PhoneCallLocation\n initialLandingPath?: string\n }) => void\n win?: Window\n dedupeWindowMs?: number\n}) {\n const win = options.win ?? window\n const trackPhoneLinkClick = options.trackPhoneLinkClick\n if (!trackPhoneLinkClick) {\n throw new Error('installPhoneClickListener requires trackPhoneLinkClick.')\n }\n let lastEvent: LastPhoneCallEvent | undefined\n\n const handlePhoneClick = (event: MouseEvent) => {\n const target = event.target\n if (!(target instanceof Element)) return\n\n const link = target.closest<HTMLAnchorElement>('a[href^=\"tel:\"]')\n if (!link) return\n\n const pagePath = win.location.pathname || '/'\n const href = link.getAttribute('href') || link.href\n const key = createPhoneCallDedupeKey(pagePath, href)\n const now = Date.now()\n\n if (\n !shouldTrackPhoneCallClick({\n key,\n now,\n lastEvent,\n dedupeWindowMs: options.dedupeWindowMs,\n })\n ) {\n return\n }\n\n lastEvent = { key, at: now }\n trackPhoneLinkClick({\n pagePath,\n location: getPhoneCallLocation(link),\n initialLandingPath: getInitialLandingPath(win),\n })\n }\n\n win.document.addEventListener('click', handlePhoneClick, true)\n\n return () => {\n win.document.removeEventListener('click', handlePhoneClick, true)\n }\n}\n\nfunction leadCtaPlacementValue(value: string | null | undefined): LeadCtaPlacement | undefined {\n const normalized = value?.trim().toLowerCase()\n return LEAD_CTA_PLACEMENTS.includes(normalized as LeadCtaPlacement)\n ? normalized as LeadCtaPlacement\n : undefined\n}\n\n/**\n * The single delegated listener for lead calls to action: a click on an\n * element carrying `data-bl-cta` (the ui-kit `QuoteButton`) sends one\n * `lead_cta_click` with its cta id and its `data-bl-cta-placement`. Elements\n * without an id or with a placement outside `LEAD_CTA_PLACEMENTS` send nothing.\n * Rapid repeats of the same call to action on the same page are de-duplicated\n * with the phone listener's window.\n */\nexport function installLeadCtaClickListener(options: {\n trackLeadCtaClick: (context: {\n pagePath: string\n ctaId: string\n placement: LeadCtaPlacement\n }) => void\n win?: Window\n dedupeWindowMs?: number\n}) {\n const win = options.win ?? window\n const trackLeadCtaClick = options.trackLeadCtaClick\n if (!trackLeadCtaClick) {\n throw new Error('installLeadCtaClickListener requires trackLeadCtaClick.')\n }\n\n let lastEvent: LastPhoneCallEvent | undefined\n\n const handleCtaClick = (event: MouseEvent) => {\n const target = event.target\n if (!(target instanceof Element)) return\n const cta = target.closest<HTMLElement>('[data-bl-cta]')\n if (!cta) return\n const ctaId = cta.getAttribute('data-bl-cta')?.trim()\n const placement = leadCtaPlacementValue(cta.getAttribute('data-bl-cta-placement'))\n if (!ctaId || !placement) return\n const pagePath = win.location.pathname || '/'\n const key = `${pagePath}|${ctaId}|${placement}`\n const now = Date.now()\n if (!shouldTrackPhoneCallClick({ key, now, lastEvent, dedupeWindowMs: options.dedupeWindowMs })) return\n lastEvent = { key, at: now }\n trackLeadCtaClick({ pagePath, ctaId, placement })\n }\n\n win.document.addEventListener('click', handleCtaClick, true)\n\n return () => {\n win.document.removeEventListener('click', handleCtaClick, true)\n }\n}\n\nconst installedInstrumentation = new WeakMap<Window, () => void>()\n\n/**\n * The whole of `src/instrumentation-client.ts`:\n * `installBrandlabInstrumentation(analytics)`. Stores the privacy-safe landing\n * path and visit source for contact attribution, and installs the single\n * telephone-link listener that sends one `phone_link_click` per tap (rapid\n * repeats of the same link are de-duplicated). With the binding's\n * `trackLeadCtaClick`, it also installs the `data-bl-cta` listener, which sends\n * `lead_cta_click` only while lead diagnostics are on. Installing twice in one\n * window is a no-op; the returned function removes the listeners.\n */\nexport function installBrandlabInstrumentation(\n analytics: Pick<BrandlabAnalytics, 'trackPhoneLinkClick'> &\n Partial<Pick<BrandlabAnalytics, 'trackLeadCtaClick'>>,\n options: { win?: Window; dedupeWindowMs?: number } = {},\n): () => void {\n if (!analytics || typeof analytics.trackPhoneLinkClick !== 'function') {\n throw new TypeError('installBrandlabInstrumentation requires the defineBrandlabAnalytics binding.')\n }\n const win = options.win ?? (typeof window === 'undefined' ? undefined : window)\n if (!win) return () => undefined\n const existing = installedInstrumentation.get(win)\n if (existing) return existing\n\n persistInitialLanding(win)\n const removeListener = installPhoneClickListener({\n win,\n ...(options.dedupeWindowMs !== undefined ? { dedupeWindowMs: options.dedupeWindowMs } : {}),\n trackPhoneLinkClick: ({ pagePath, location }) => {\n try {\n analytics.trackPhoneLinkClick({ pagePath, placement: location })\n } catch {\n // Tracking must never block the telephone action.\n }\n },\n })\n const removeCtaListener = typeof analytics.trackLeadCtaClick === 'function'\n ? installLeadCtaClickListener({\n win,\n ...(options.dedupeWindowMs !== undefined ? { dedupeWindowMs: options.dedupeWindowMs } : {}),\n trackLeadCtaClick: (input) => {\n try {\n analytics.trackLeadCtaClick?.(input)\n } catch {\n // Tracking must never block the call to action.\n }\n },\n })\n : () => undefined\n const teardown = () => {\n removeListener()\n removeCtaListener()\n if (installedInstrumentation.get(win) === teardown) installedInstrumentation.delete(win)\n }\n installedInstrumentation.set(win, teardown)\n return teardown\n}\n"]}
|
|
1
|
+
{"version":3,"file":"instrumentation-client.js","sourceRoot":"","sources":["../src/instrumentation-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAErB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GAItB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,0BAA0B,EAC1B,kCAAkC,GACnC,MAAM,0BAA0B,CAAA;AASjC,MAAM,CAAC,MAAM,8BAA8B,GAAG,0BAA0B,CAAA;AACxE,MAAM,CAAC,MAAM,mCAAmC,GAAG,IAAI,CAAA;AAEvD,MAAM,UAAU,2BAA2B,CAAC,QAAmC;IAC7E,MAAM,OAAO,GAAG,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAG,CAAA;IACvC,IACE,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;QACxB,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;QACxB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;QACtB,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC;QAC3B,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC;QACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;QACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EACrB,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;IACD,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;IAClD,OAAO,UAAU,KAAK,GAAG,CAAC,CAAC,CAAC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AI,CAAC;oBACH,SAAS,CAAC,iBAAiB,EAAE,CAAC,KAAK,CAAC,CAAA;gBACtC,CAAC;gBAAC,MAAM,CAAC;oBACP,gDAAgD;gBAClD,CAAC;YACH,CAAC;SACF,CAAC;QACF,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAA;IACnB,MAAM,QAAQ,GAAG,GAAG,EAAE;QACpB,cAAc,EAAE,CAAA;QAChB,iBAAiB,EAAE,CAAA;QACnB,IAAI,wBAAwB,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,QAAQ;YAAE,wBAAwB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC1F,CAAC,CAAA;IACD,wBAAwB,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC3C,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["import {\n isContactVisitSource,\n type ContactAttributionSummary,\n} from '@brandlab-digital/site-core/contact'\nimport {\n LEAD_CTA_PLACEMENTS,\n PHONE_CALL_PLACEMENTS,\n type BrandlabAnalytics,\n type LeadCtaPlacement,\n type PhoneCallPlacement,\n} from './analytics.js'\nimport {\n classifyContactAttribution,\n normalizeContactAttributionSummary,\n} from './contact/attribution.js'\n\nexport type PhoneCallLocation = PhoneCallPlacement\n\nexport interface LastPhoneCallEvent {\n key: string\n at: number\n}\n\nexport const INITIAL_LANDING_STORAGE_PREFIX = 'brandlab.initialLanding.'\nexport const DEFAULT_PHONE_CALL_DEDUPE_WINDOW_MS = 1200\n\nexport function normalizeInitialLandingPath(pathname: string | null | undefined) {\n const trimmed = pathname?.trim() || '/'\n if (\n !trimmed.startsWith('/') ||\n trimmed.startsWith('//') ||\n trimmed.includes('\\\\') ||\n /%(?:2f|5c)/i.test(trimmed) ||\n /[\\u0000-\\u001f\\u007f]/.test(trimmed) ||\n trimmed.includes('?') ||\n trimmed.includes('#')\n ) {\n return '/'\n }\n const normalized = trimmed.replace(/\\/{2,}/g, '/')\n return normalized === '/' ? '/' : normalized.replace(/\\/+$/, '')\n}\n\nexport function createPhoneCallDedupeKey(pagePath: string, href: string) {\n return `${pagePath}|${href}`\n}\n\nexport function shouldTrackPhoneCallClick(options: {\n key: string\n now: number\n lastEvent?: LastPhoneCallEvent\n dedupeWindowMs?: number\n}) {\n const windowMs = options.dedupeWindowMs ?? DEFAULT_PHONE_CALL_DEDUPE_WINDOW_MS\n return !(\n options.lastEvent &&\n options.lastEvent.key === options.key &&\n options.now - options.lastEvent.at < windowMs\n )\n}\n\nexport function persistInitialLanding(win: Window = window) {\n try {\n const pathKey = `${INITIAL_LANDING_STORAGE_PREFIX}path`\n const sourceKey = `${INITIAL_LANDING_STORAGE_PREFIX}source`\n const detailKey = `${INITIAL_LANDING_STORAGE_PREFIX}sourceDetail`\n const existingPath = win.sessionStorage.getItem(pathKey)\n const safePath = normalizeInitialLandingPath(existingPath ?? win.location.pathname)\n if (existingPath !== safePath) {\n win.sessionStorage.setItem(pathKey, safePath)\n }\n const existingSource = win.sessionStorage.getItem(sourceKey)\n if (!isContactVisitSource(existingSource)) {\n const attribution = classifyContactAttribution({\n initialLandingPath: safePath,\n search: win.location.search,\n referrer: win.document.referrer,\n siteOrigin: win.location.origin,\n })\n win.sessionStorage.setItem(sourceKey, attribution.visitSource)\n if (attribution.visitSourceDetail) {\n win.sessionStorage.setItem(detailKey, attribution.visitSourceDetail)\n } else {\n win.sessionStorage.removeItem(detailKey)\n }\n }\n // Remove values written by the pre-RC privacy contract. Query strings and\n // referrers are not needed for canonical lead measurement.\n win.sessionStorage.removeItem(`${INITIAL_LANDING_STORAGE_PREFIX}url`)\n win.sessionStorage.removeItem(`${INITIAL_LANDING_STORAGE_PREFIX}referrer`)\n } catch {\n // Storage failures must not affect navigation or lead tracking.\n }\n}\n\nexport function getInitialLandingPath(win: Window = window) {\n try {\n const value = win.sessionStorage.getItem(`${INITIAL_LANDING_STORAGE_PREFIX}path`)\n return value ? normalizeInitialLandingPath(value) : undefined\n } catch {\n return undefined\n }\n}\n\nexport function getInitialContactAttribution(win: Window = window): ContactAttributionSummary {\n const fallbackPath = normalizeInitialLandingPath(win.location.pathname)\n try {\n const initialLandingPath = normalizeInitialLandingPath(\n win.sessionStorage.getItem(`${INITIAL_LANDING_STORAGE_PREFIX}path`) ?? fallbackPath,\n )\n const visitSource = win.sessionStorage.getItem(`${INITIAL_LANDING_STORAGE_PREFIX}source`)\n const visitSourceDetail = win.sessionStorage.getItem(\n `${INITIAL_LANDING_STORAGE_PREFIX}sourceDetail`,\n )\n return normalizeContactAttributionSummary({\n initialLandingPath,\n visitSource: isContactVisitSource(visitSource) ? visitSource : 'direct-or-unknown',\n ...(visitSourceDetail ? { visitSourceDetail } : {}),\n })\n } catch {\n return { initialLandingPath: fallbackPath, visitSource: 'direct-or-unknown' }\n }\n}\n\nfunction placementValue(value: string | null | undefined): PhoneCallLocation | undefined {\n const normalized = value?.trim().toLowerCase()\n return PHONE_CALL_PLACEMENTS.includes(normalized as PhoneCallLocation)\n ? normalized as PhoneCallLocation\n : undefined\n}\n\n/**\n * Placement of a telephone link: its own `data-phone-location`, then a\n * `<header>` or `<footer>` ancestor, then the nearest ancestor declaring a\n * valid `data-phone-location` (for example a hero or call-to-action section),\n * otherwise `page`. Unrecognised values are ignored, so every tap still\n * produces exactly one event.\n */\nexport function getPhoneCallLocation(link: HTMLAnchorElement): PhoneCallLocation {\n const explicit = placementValue(link.getAttribute('data-phone-location'))\n if (explicit) return explicit\n if (link.closest('header')) return 'header'\n if (link.closest('footer')) return 'footer'\n for (\n let ancestor = link.parentElement?.closest('[data-phone-location]');\n ancestor;\n ancestor = ancestor.parentElement?.closest('[data-phone-location]')\n ) {\n const placement = placementValue(ancestor.getAttribute('data-phone-location'))\n if (placement) return placement\n }\n return 'page'\n}\n\nexport function installPhoneClickListener(options: {\n trackPhoneLinkClick: (context: {\n pagePath: string\n location: PhoneCallLocation\n initialLandingPath?: string\n }) => void\n win?: Window\n dedupeWindowMs?: number\n}) {\n const win = options.win ?? window\n const trackPhoneLinkClick = options.trackPhoneLinkClick\n if (!trackPhoneLinkClick) {\n throw new Error('installPhoneClickListener requires trackPhoneLinkClick.')\n }\n let lastEvent: LastPhoneCallEvent | undefined\n\n const handlePhoneClick = (event: MouseEvent) => {\n const target = event.target\n if (!(target instanceof Element)) return\n\n const link = target.closest<HTMLAnchorElement>('a[href^=\"tel:\"]')\n if (!link) return\n\n const pagePath = win.location.pathname || '/'\n const href = link.getAttribute('href') || link.href\n const key = createPhoneCallDedupeKey(pagePath, href)\n const now = Date.now()\n\n if (\n !shouldTrackPhoneCallClick({\n key,\n now,\n lastEvent,\n dedupeWindowMs: options.dedupeWindowMs,\n })\n ) {\n return\n }\n\n lastEvent = { key, at: now }\n trackPhoneLinkClick({\n pagePath,\n location: getPhoneCallLocation(link),\n initialLandingPath: getInitialLandingPath(win),\n })\n }\n\n win.document.addEventListener('click', handlePhoneClick, true)\n\n return () => {\n win.document.removeEventListener('click', handlePhoneClick, true)\n }\n}\n\nfunction leadCtaPlacementValue(value: string | null | undefined): LeadCtaPlacement | undefined {\n const normalized = value?.trim().toLowerCase()\n return LEAD_CTA_PLACEMENTS.includes(normalized as LeadCtaPlacement)\n ? normalized as LeadCtaPlacement\n : undefined\n}\n\n/**\n * The single delegated listener for lead calls to action: a click on an\n * element carrying `data-bl-cta` (a site's quote button) sends one\n * `lead_cta_click` with its cta id and its `data-bl-cta-placement`. Elements\n * without an id or with a placement outside `LEAD_CTA_PLACEMENTS` send nothing.\n * Rapid repeats of the same call to action on the same page are de-duplicated\n * with the phone listener's window.\n */\nexport function installLeadCtaClickListener(options: {\n trackLeadCtaClick: (context: {\n pagePath: string\n ctaId: string\n placement: LeadCtaPlacement\n }) => void\n win?: Window\n dedupeWindowMs?: number\n}) {\n const win = options.win ?? window\n const trackLeadCtaClick = options.trackLeadCtaClick\n if (!trackLeadCtaClick) {\n throw new Error('installLeadCtaClickListener requires trackLeadCtaClick.')\n }\n\n let lastEvent: LastPhoneCallEvent | undefined\n\n const handleCtaClick = (event: MouseEvent) => {\n const target = event.target\n if (!(target instanceof Element)) return\n const cta = target.closest<HTMLElement>('[data-bl-cta]')\n if (!cta) return\n const ctaId = cta.getAttribute('data-bl-cta')?.trim()\n const placement = leadCtaPlacementValue(cta.getAttribute('data-bl-cta-placement'))\n if (!ctaId || !placement) return\n const pagePath = win.location.pathname || '/'\n const key = `${pagePath}|${ctaId}|${placement}`\n const now = Date.now()\n if (!shouldTrackPhoneCallClick({ key, now, lastEvent, dedupeWindowMs: options.dedupeWindowMs })) return\n lastEvent = { key, at: now }\n trackLeadCtaClick({ pagePath, ctaId, placement })\n }\n\n win.document.addEventListener('click', handleCtaClick, true)\n\n return () => {\n win.document.removeEventListener('click', handleCtaClick, true)\n }\n}\n\nconst installedInstrumentation = new WeakMap<Window, () => void>()\n\n/**\n * The whole of `src/instrumentation-client.ts`:\n * `installBrandlabInstrumentation(analytics)`. Stores the privacy-safe landing\n * path and visit source for contact attribution, and installs the single\n * telephone-link listener that sends one `phone_link_click` per tap (rapid\n * repeats of the same link are de-duplicated). With the binding's\n * `trackLeadCtaClick`, it also installs the `data-bl-cta` listener, which sends\n * `lead_cta_click` only while lead diagnostics are on. Installing twice in one\n * window is a no-op; the returned function removes the listeners.\n */\nexport function installBrandlabInstrumentation(\n analytics: Pick<BrandlabAnalytics, 'trackPhoneLinkClick'> &\n Partial<Pick<BrandlabAnalytics, 'trackLeadCtaClick'>>,\n options: { win?: Window; dedupeWindowMs?: number } = {},\n): () => void {\n if (!analytics || typeof analytics.trackPhoneLinkClick !== 'function') {\n throw new TypeError('installBrandlabInstrumentation requires the defineBrandlabAnalytics binding.')\n }\n const win = options.win ?? (typeof window === 'undefined' ? undefined : window)\n if (!win) return () => undefined\n const existing = installedInstrumentation.get(win)\n if (existing) return existing\n\n persistInitialLanding(win)\n const removeListener = installPhoneClickListener({\n win,\n ...(options.dedupeWindowMs !== undefined ? { dedupeWindowMs: options.dedupeWindowMs } : {}),\n trackPhoneLinkClick: ({ pagePath, location }) => {\n try {\n analytics.trackPhoneLinkClick({ pagePath, placement: location })\n } catch {\n // Tracking must never block the telephone action.\n }\n },\n })\n const removeCtaListener = typeof analytics.trackLeadCtaClick === 'function'\n ? installLeadCtaClickListener({\n win,\n ...(options.dedupeWindowMs !== undefined ? { dedupeWindowMs: options.dedupeWindowMs } : {}),\n trackLeadCtaClick: (input) => {\n try {\n analytics.trackLeadCtaClick?.(input)\n } catch {\n // Tracking must never block the call to action.\n }\n },\n })\n : () => undefined\n const teardown = () => {\n removeListener()\n removeCtaListener()\n if (installedInstrumentation.get(win) === teardown) installedInstrumentation.delete(win)\n }\n installedInstrumentation.set(win, teardown)\n return teardown\n}\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@brandlab-digital/site-next/navigation`:
|
|
3
|
-
* The
|
|
4
|
-
* are client modules; the constants are plain values a server component can read.
|
|
2
|
+
* `@brandlab-digital/site-next/navigation`: client hooks for a site's own header and menus, and their timings and
|
|
3
|
+
* breakpoints. The hook modules are client modules; the constants are plain values a server component can read.
|
|
5
4
|
*/
|
|
6
5
|
export { BACK_TO_TOP_AFTER_SCREENS, CALL_BAR_MEDIA_QUERY, CALL_BAR_STATE_ATTRIBUTE, CALL_BAR_STATE_EVENT, CALL_PATH_SELECTOR, HEADER_COMPACT_AFTER_SCROLL_PX, HEADER_COMPACT_MIN_WIDTH, HEADER_DESKTOP_MIN_WIDTH, MAIN_CONTENT_ID, NAV_HOVER_CLOSE_DELAY_MS, NAV_HOVER_MEDIA_QUERY, NAV_HOVER_OPEN_DELAY_MS, headerModeFor, type HeaderMode, } from './constants.js';
|
|
7
6
|
export { useNavigationMenu, type NavigationMenu, type NavigationOpenedBy } from './use-navigation-menu.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,8BAA8B,EAC9B,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EACf,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,KAAK,UAAU,GAChB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,KAAK,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC1G,OAAO,EAAE,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA"}
|
package/dist/navigation/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@brandlab-digital/site-next/navigation`:
|
|
3
|
-
* The
|
|
4
|
-
* are client modules; the constants are plain values a server component can read.
|
|
2
|
+
* `@brandlab-digital/site-next/navigation`: client hooks for a site's own header and menus, and their timings and
|
|
3
|
+
* breakpoints. The hook modules are client modules; the constants are plain values a server component can read.
|
|
5
4
|
*/
|
|
6
5
|
export { BACK_TO_TOP_AFTER_SCREENS, CALL_BAR_MEDIA_QUERY, CALL_BAR_STATE_ATTRIBUTE, CALL_BAR_STATE_EVENT, CALL_PATH_SELECTOR, HEADER_COMPACT_AFTER_SCROLL_PX, HEADER_COMPACT_MIN_WIDTH, HEADER_DESKTOP_MIN_WIDTH, MAIN_CONTENT_ID, NAV_HOVER_CLOSE_DELAY_MS, NAV_HOVER_MEDIA_QUERY, NAV_HOVER_OPEN_DELAY_MS, headerModeFor, } from './constants.js';
|
|
7
6
|
export { useNavigationMenu } from './use-navigation-menu.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/navigation/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/navigation/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,8BAA8B,EAC9B,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EACf,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,GAEd,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAgD,MAAM,0BAA0B,CAAA;AAC1G,OAAO,EAAE,gBAAgB,EAAsB,MAAM,yBAAyB,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA","sourcesContent":["/**\n * `@brandlab-digital/site-next/navigation`: client hooks for a site's own header and menus, and their timings and\n * breakpoints. The hook modules are client modules; the constants are plain values a server component can read.\n */\nexport {\n BACK_TO_TOP_AFTER_SCREENS,\n CALL_BAR_MEDIA_QUERY,\n CALL_BAR_STATE_ATTRIBUTE,\n CALL_BAR_STATE_EVENT,\n CALL_PATH_SELECTOR,\n HEADER_COMPACT_AFTER_SCROLL_PX,\n HEADER_COMPACT_MIN_WIDTH,\n HEADER_DESKTOP_MIN_WIDTH,\n MAIN_CONTENT_ID,\n NAV_HOVER_CLOSE_DELAY_MS,\n NAV_HOVER_MEDIA_QUERY,\n NAV_HOVER_OPEN_DELAY_MS,\n headerModeFor,\n type HeaderMode,\n} from './constants.js'\nexport { useNavigationMenu, type NavigationMenu, type NavigationOpenedBy } from './use-navigation-menu.js'\nexport { useHeaderMetrics, type HeaderMetrics } from './use-header-metrics.js'\nexport { useStickyCallBar } from './use-sticky-call-bar.js'\nexport { useBackToTop } from './use-back-to-top.js'\n"]}
|
package/dist/next-config.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type BrandlabRedirectTable } from '@brandlab-digital/site-core/redirects';
|
|
2
2
|
import { type BrandlabDeploymentEnvironment, type BrandlabEnvironment, type BrandlabSite } from '@brandlab-digital/site-core/site';
|
|
3
3
|
import { type BrandlabContentSecurityPolicyExtensions, type BrandlabHeader, type BrandlabHeaderRule, type BrandlabHstsExpansion } from './headers.js';
|
|
4
|
-
import { type SiteIconSet } from './ui-kit/icon-glyphs.js';
|
|
5
4
|
/** Next redirect records: 308 stays `permanent: true`, 301 stays `statusCode: 301`. */
|
|
6
5
|
export type BrandlabNextRedirect = {
|
|
7
6
|
source: string;
|
|
@@ -57,8 +56,6 @@ export interface BrandlabNextConfig {
|
|
|
57
56
|
skipTrailingSlashRedirect: true;
|
|
58
57
|
env: {
|
|
59
58
|
NEXT_PUBLIC_VERCEL_ENV: BrandlabDeploymentEnvironment;
|
|
60
|
-
/** The icon sprite's path (3.14.0), set when `icons` is declared. */
|
|
61
|
-
NEXT_PUBLIC_BL_ICON_SPRITE?: string;
|
|
62
59
|
};
|
|
63
60
|
outputFileTracingIncludes: Record<string, string[]>;
|
|
64
61
|
images: BrandlabNextImagesConfig;
|
|
@@ -94,24 +91,11 @@ export interface BrandlabNextConfigOptions {
|
|
|
94
91
|
* no route under `src/app` or `app` may answer below it.
|
|
95
92
|
*/
|
|
96
93
|
staticAssetCache?: readonly string[];
|
|
97
|
-
/**
|
|
98
|
-
* The ui-kit icon sprite (3.14.0). When declared, loading the config writes `public/_bl/icons.<hash>.svg` (every
|
|
99
|
-
* library icon plus `site`, the set from `defineSiteIcons`), removes older sprites there and sets
|
|
100
|
-
* `NEXT_PUBLIC_BL_ICON_SPRITE`, so every `Icon` renders a `<use>` into the sprite instead of an inline glyph.
|
|
101
|
-
* Production builds serve the file with `public, max-age=31536000, immutable`. Add `public/_bl/` to `.gitignore`.
|
|
102
|
-
*/
|
|
103
|
-
icons?: BrandlabIconsOptions;
|
|
104
94
|
/** Defaults to process.env; tests supply a fixed environment. */
|
|
105
95
|
environment?: BrandlabEnvironment;
|
|
106
|
-
/** The project root for the staticAssetCache checks
|
|
96
|
+
/** The project root for the staticAssetCache checks; defaults to process.cwd(). */
|
|
107
97
|
projectRoot?: string;
|
|
108
98
|
}
|
|
109
|
-
export interface BrandlabIconsOptions {
|
|
110
|
-
/** The site's own icons, from `defineSiteIcons` (`src/site/icons.ts`). */
|
|
111
|
-
site?: SiteIconSet;
|
|
112
|
-
}
|
|
113
|
-
/** The sprite's cache rule: content-hashed names only, so a stale name never reaches a page. */
|
|
114
|
-
export declare const BRANDLAB_ICON_SPRITE_SOURCE = "/_bl/:file(icons\\.[0-9a-f]+\\.svg)";
|
|
115
99
|
/** Sharp's Linux binaries must travel with the contact route's image sanitiser. */
|
|
116
100
|
export declare const BRANDLAB_CONTACT_OUTPUT_FILE_TRACING: Readonly<{
|
|
117
101
|
'/api/contact': readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-config.d.ts","sourceRoot":"","sources":["../src/next-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AACnG,OAAO,EAGL,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAClB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAIL,KAAK,uCAAuC,EAC5C,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAE3B,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"next-config.d.ts","sourceRoot":"","sources":["../src/next-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AACnG,OAAO,EAGL,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAClB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAIL,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AM,6BAA6B,8DAA+D,CAAA;AA4NzG;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAC9C,IAAI,EAAE,YAAY,CAAA;IAClB,SAAS,EAAE,qBAAqB,CAAA;IAChC,wEAAwE;IACxE,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC/B,GAAG,oBAAoB,EAAE,CA4BzB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,SAAS,MAAM,EAAE,CAOnH;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,yBAAyB,GAAG;IAAE,GAAG,CAAC,EAAE,SAAS,CAAA;CAAE,GACvD,kBAAkB,CAAA;AACrB,wBAAgB,wBAAwB,CAAC,OAAO,EAC9C,OAAO,EAAE,yBAAyB,GAAG;IACnC,wFAAwF;IACxF,GAAG,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAA;CAC7C,GACA,OAAO,CAAA"}
|
package/dist/next-config.js
CHANGED
|
@@ -3,10 +3,6 @@ import { join, posix } from 'node:path';
|
|
|
3
3
|
import { defineRedirects } from '@brandlab-digital/site-core/redirects';
|
|
4
4
|
import { assertBrandlabAliasHosts, resolveBrandlabDeployment, } from '@brandlab-digital/site-core/site';
|
|
5
5
|
import { BRANDLAB_STATIC_ASSET_CACHE_CONTROL, buildBrandlabHeaderRules, parseBrandlabStaticAssetCache, } from './headers.js';
|
|
6
|
-
import { defineSiteIcons, ICON_SPRITE_ENV } from './ui-kit/icon-glyphs.js';
|
|
7
|
-
import { writeIconSprite } from './ui-kit/icon-sprite.js';
|
|
8
|
-
/** The sprite's cache rule: content-hashed names only, so a stale name never reaches a page. */
|
|
9
|
-
export const BRANDLAB_ICON_SPRITE_SOURCE = '/_bl/:file(icons\\.[0-9a-f]+\\.svg)';
|
|
10
6
|
/** Sharp's Linux binaries must travel with the contact route's image sanitiser. */
|
|
11
7
|
export const BRANDLAB_CONTACT_OUTPUT_FILE_TRACING = Object.freeze({
|
|
12
8
|
'/api/contact': Object.freeze([
|
|
@@ -27,7 +23,6 @@ const OPTION_KEYS = new Set([
|
|
|
27
23
|
'extraHeaders',
|
|
28
24
|
'staticAssetCache',
|
|
29
25
|
'mdx',
|
|
30
|
-
'icons',
|
|
31
26
|
'environment',
|
|
32
27
|
'projectRoot',
|
|
33
28
|
]);
|
|
@@ -251,16 +246,6 @@ function assertStaticAssetFolders(folders, root) {
|
|
|
251
246
|
}
|
|
252
247
|
}
|
|
253
248
|
}
|
|
254
|
-
/** A site icon set, checked again here: the config may be handed an object that never went through defineSiteIcons. */
|
|
255
|
-
function siteIconSet(site) {
|
|
256
|
-
if (site === undefined)
|
|
257
|
-
return undefined;
|
|
258
|
-
const set = site;
|
|
259
|
-
if (!set || typeof set !== 'object' || !Array.isArray(set.names) || !set.glyphs || typeof set.glyphs !== 'object') {
|
|
260
|
-
throw new Error('icons.site must come from defineSiteIcons.');
|
|
261
|
-
}
|
|
262
|
-
return defineSiteIcons(Object.fromEntries(set.names.map((name) => [name, set.glyphs[name]])));
|
|
263
|
-
}
|
|
264
249
|
/**
|
|
265
250
|
* Converts the redirect table to Next redirects: each entry keeps its 301 or
|
|
266
251
|
* 308 status (Next forwards the query string), gains a single-hop
|
|
@@ -315,7 +300,8 @@ export function defineBrandlabNextConfig(options) {
|
|
|
315
300
|
if (!options || typeof options !== 'object') {
|
|
316
301
|
throw new TypeError('defineBrandlabNextConfig requires the site, redirects and images.');
|
|
317
302
|
}
|
|
318
|
-
|
|
303
|
+
// 4.0.0 removed the ui-kit and its icon sprite; name it so a site upgrading from 3.x knows what to delete.
|
|
304
|
+
assertKnownKeys(options, OPTION_KEYS, 'next.config options', 'icons' in options ? ' icons (the ui-kit icon sprite) was removed in 4.0.0: delete it.' : '');
|
|
319
305
|
if (!options.site?.canonicalUrl || !Array.isArray(options.site.aliasHosts)) {
|
|
320
306
|
throw new Error('site must come from defineBrandlabSite.');
|
|
321
307
|
}
|
|
@@ -335,22 +321,6 @@ export function defineBrandlabNextConfig(options) {
|
|
|
335
321
|
...(options.extraHeaders ? { extraHeaders: options.extraHeaders } : {}),
|
|
336
322
|
...(options.staticAssetCache ? { staticAssetCache: options.staticAssetCache } : {}),
|
|
337
323
|
});
|
|
338
|
-
if (options.icons !== undefined) {
|
|
339
|
-
if (!options.icons || typeof options.icons !== 'object' || Array.isArray(options.icons)) {
|
|
340
|
-
throw new Error('icons must be { site?: defineSiteIcons(...) } ({} for the library icons only).');
|
|
341
|
-
}
|
|
342
|
-
assertKnownKeys(options.icons, new Set(['site']), 'icons');
|
|
343
|
-
}
|
|
344
|
-
const sprite = options.icons === undefined ? undefined : writeIconSprite(options.projectRoot ?? process.cwd(), siteIconSet(options.icons.site));
|
|
345
|
-
// The same production-only rule as staticAssetCache: Previews keep private, no-store.
|
|
346
|
-
if (sprite && deployment.productionBuild && deployment.environment !== 'preview') {
|
|
347
|
-
// After the static folders, before the non-canonical host rule.
|
|
348
|
-
const at = headerRules.findIndex((rule) => rule.missing !== undefined);
|
|
349
|
-
headerRules.splice(at === -1 ? headerRules.length : at, 0, {
|
|
350
|
-
source: BRANDLAB_ICON_SPRITE_SOURCE,
|
|
351
|
-
headers: [{ key: 'Cache-Control', value: BRANDLAB_STATIC_ASSET_CACHE_CONTROL }],
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
324
|
const redirects = buildBrandlabRedirects({
|
|
355
325
|
site: options.site,
|
|
356
326
|
redirects: options.redirects,
|
|
@@ -361,7 +331,6 @@ export function defineBrandlabNextConfig(options) {
|
|
|
361
331
|
skipTrailingSlashRedirect: true,
|
|
362
332
|
env: {
|
|
363
333
|
NEXT_PUBLIC_VERCEL_ENV: deployment.environment,
|
|
364
|
-
...(sprite ? { [ICON_SPRITE_ENV]: sprite.href } : {}),
|
|
365
334
|
},
|
|
366
335
|
outputFileTracingIncludes: Object.fromEntries(Object.entries(BRANDLAB_CONTACT_OUTPUT_FILE_TRACING).map(([route, globs]) => [route, [...globs]])),
|
|
367
336
|
// A Vercel build (preview or production) is checked like any production build, whatever NODE_ENV says.
|