@brandlab-digital/site-next 3.19.0 → 3.20.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 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
- generateSchema(slug: string): import("@brandlab-digital/site-core/schema").BrandlabSchemaNode | undefined;
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
- generateSchema(slug: string): import("@brandlab-digital/site-core/schema").BrandlabSchemaNode | undefined;
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";
@@ -1 +1 @@
1
- {"version":3,"file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AS,GAAG,QAAQ,CACrB,GAAG;IAAE,MAAM,EAAE,oBAAoB,CAAA;CAAE,CAAA;AAEpC,wBAAgB,8BAA8B,CAAC,OAAO,EACpD,OAAO,EAAE,oCAAoC,CAAC,OAAO,CAAC;;;;;wBAlJhC,MAAM;;;;;;;2BAMH,MAAM,GAAG,sBAAsB,GAAG,SAAS;IAkBlE;;;;OAIG;yBACkB,MAAM;4BAA+B,SAAS,MAAM,EAAE;kCAA4B,MAAM;;yBA8BxF,YAAY,EAAE;0BAcb,MAAM;;;;;kBA+CR,MAAM;;;;;;;EA6B7B;AAED,wBAAgB,qCAAqC,CAAC,OAAO,EAC3D,OAAO,EAAE,oCAAoC,CAAC,OAAO,CAAC;;;;;wBAxJhC,MAAM;;;;;;;2BAMH,MAAM,GAAG,sBAAsB,GAAG,SAAS;IAkBlE;;;;OAIG;yBACkB,MAAM;4BAA+B,SAAS,MAAM,EAAE;kCAA4B,MAAM;;yBA8BxF,YAAY,EAAE;0BAcb,MAAM;;;;;kBA+CR,MAAM;;;;;;;EAmC7B"}
package/dist/blog.js CHANGED
@@ -56,7 +56,12 @@ function createBrandlabBlogAdapter(options) {
56
56
  ...(post.image ? { socialImage: post.image } : {}),
57
57
  });
58
58
  },
59
- generateSchema(slug) {
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
- authorNames: post.authors.map((author) => author.name),
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,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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KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CAAA;QAChF,IAAI,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,KAAK,KAAK,SAAS,IAAI,CAAC,CAAA;IACzF,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,MAAwB,EAAE,SAA2B;IACzE,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAA;IACnD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;IACvC,OAAO,CACL,CAAC,SAAS,CAAC,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 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,KA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AC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CAAA;QAChF,IAAI,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,KAAK,KAAK,SAAS,IAAI,CAAC,CAAA;IACzF,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,MAAwB,EAAE,SAA2B;IACzE,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAA;IACnD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;IACvC,OAAO,CACL,CAAC,SAAS,CAAC,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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"nearby-jobs.d.ts","sourceRoot":"","sources":["../../../src/ui-kit/sections/nearby-jobs.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;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Jobs({ title, eyebrow, lead, jobs, pageSuburb, serviceName
40
40
  const ratio = layout?.ratio ?? '4:3';
41
41
  const feature = variant === 'grid' && layout?.arrangement === 'feature' && jobs.length === 3;
42
42
  const sizes = imageSizes ?? `(min-width: 1024px) ${Math.round(100 / columns)}vw, (min-width: 640px) 50vw, 100vw`;
43
- const headings = cardHeadings(jobs, layout?.cardTitle ?? 'label', (job) => jobCardLabel(job, { service: serviceName(job.service), suburbName: suburbName(job.suburb), pageSuburb, ...(labelPrefix === undefined ? {} : { prefix: labelPrefix }) }), pageSuburb);
43
+ const headings = cardHeadings(jobs, layout?.cardTitle ?? 'label',
44
+ // The ui-kit is frozen (2 Nov 2026), so its cards keep their "nearby: {Suburb}" wording; site-core's own default
45
+ // names the job's suburb plainly from 3.20.0.
46
+ (job) => jobCardLabel(job, { service: serviceName(job.service), suburbName: suburbName(job.suburb), pageSuburb, nearby: true, ...(labelPrefix === undefined ? {} : { prefix: labelPrefix }) }), pageSuburb);
44
47
  return (_jsxs(Section, { id: "nearby-jobs", labelledBy: headingId, tone: tone, variant: variant, classes: classes, hooks: { 'data-columns': String(columns), 'data-ratio': ratio, 'data-arrangement': feature ? 'feature' : undefined }, children: [_jsx(SectionHeading, { id: headingId, title: title, eyebrow: eyebrow, lead: lead, classes: classes }), _jsx("ul", { role: "list", ...slot(classes, 'list'), children: jobs.map(({ job }, index) => {
45
48
  const label = headings[index];
46
49
  const href = jobHref?.(job);
@@ -1 +1 @@
1
- {"version":3,"file":"nearby-jobs.js","sourceRoot":"","sources":["../../../src/ui-kit/sections/nearby-jobs.tsx"],"names":[],"mappings":";AAsBA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAA4C,MAAM,kCAAkC,CAAA;AAEpI,OAAO,EAAE,aAAa,EAAiC,MAAM,2CAA2C,CAAA;AACxG,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,wB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,EAAE,oBAAoB,CAAC,WAAW,YAClE,IAAI,CAAC,KAAK,GACF,GACT,CACL,CAAC,CAAC,CAAC,IAAI,IACA,CACX,CAAA;AACH,CAAC;AAED,4HAA4H;AAC5H,SAAS,YAAY,CACnB,IAAkC,EAClC,SAA0B,EAC1B,OAAqC,EACrC,UAAkB;IAElB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,gGAAgG;IAChG,MAAM,OAAO,GAAG,CAAC,GAAgB,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACnH,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;QAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QAC1B,IAAI,OAAO,GAAG,SAAS,KAAK,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACjE,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,0CAA0C,OAAO,gBAAgB,GAAG,CAAC,EAAE,iCAAiC,CAAC,CAAA;YAC3H,CAAC;YACD,OAAO,GAAG,KAAK,CAAA;QACjB,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACjB,OAAO,OAAO,CAAA;IAChB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/**\n * `NearbyJobs` (S17, `nearby-jobs`, 3.15.0): proof of real work near this place. Server component.\n *\n * The cards come from the job log (site-core `./jobs`): `nearbyJobs(origin, jobs, { centreOf, service })` ranks the\n * page suburb's own jobs first, then others by real distance within 10 km, at most three. Each card's heading is\n * `jobCardLabel`: \"Tree removal in Castle Hill\" for the page's own suburb, \"Tree removal nearby: Ryde\" for any other\n * (L4); only a job whose month is known says \"Recent\" (or `labelPrefix`) and ends \", {Month Year}\". Distances rank the cards and are never\n * printed (L10). A card shows the job's first photo through `Media`, and only a genuine photo of that job: a stock or AI\n * image never stands for the client's work. With no job close enough the section renders nothing and its guard says\n * so (`no-jobs-nearby`, D2). A card links to the job's project page when the site has one (prefetch on intent).\n * Card photos are always lazy. `pagePhotos` names the photos the page already shows (the hero's): a card then takes the\n * job's next genuine photo, or none, so the hero's priority photo is never repeated below as a lazy copy (3.15.0; on\n * AA's suburb pages the repeat made Next report the hero, the LCP image, as lazy and downloaded it twice).\n *\n * 3.17.0: two cards never share a heading. Where a card's label repeats an earlier one (\"Tree removal in Eastwood\"\n * twice) it takes the job's own `title`, and a job without one fails the build; `layout.cardTitle: 'job'` uses the\n * title on every card that has one. A title from another suburb reads \"Nearby: {title}\" (L4, 3.17.1). `linkCue` (\"View job\") shows on a linked card, and the whole card then follows\n * the heading's link (the cue is `aria-hidden`, so the link's name stays the heading). `layout.arrangement: 'feature'`\n * sets one tall card beside two stacked from 1024 px. `footer` (a count line) and `link` (\"See all our projects\")\n * follow the list.\n */\nimport type { ReactNode } from 'react'\nimport { JOB_CARD_LIMIT, jobCardLabel, jobPhotos, type BrandlabJob, type BrandlabNearbyJob } from '@brandlab-digital/site-core/jobs'\nimport type { BrandlabMediaManifest } from '@brandlab-digital/site-core/media'\nimport { SECTION_READY, type BrandlabSectionReadiness } from '@brandlab-digital/site-core/section-order'\nimport { LINK_PREFETCH_POLICY } from '../prefetch.js'\nimport { Anchor, TextLink } from '../primitives/links.js'\nimport { Media, type MediaLayout } from '../primitives/media.js'\nimport { Section, SectionHeading, type SectionHeadingSlot, type SectionSlot, type SectionTone } from '../primitives/layout.js'\nimport type { RepeatedSlotOf } from '../repeated-slots.js'\nimport { repeatedSlot, slot, type SkinEntry } from '../skin.js'\nimport type { UiLink } from '../types.js'\n\nexport const NEARBY_JOBS_VARIANTS = ['grid', 'rail'] as const\nexport type NearbyJobsVariant = (typeof NEARBY_JOBS_VARIANTS)[number]\nexport type NearbyJobsSlot = SectionSlot | SectionHeadingSlot | 'list' | 'footer' | 'more' | RepeatedSlotOf<'nearbyJobs'>\n/** Rendered once per job: styled from the skin stylesheet, never by class. */\nexport type NearbyJobsRepeatedSlot = RepeatedSlotOf<'nearbyJobs'>\nexport interface NearbyJobsLayout {\n /** `grid`: columns on wide screens. Defaults to 3. */\n readonly columns?: 2 | 3\n /** The photo's crop. Defaults to 4:3. */\n readonly ratio?: NonNullable<MediaLayout['ratio']>\n /** `grid`: `even` (the default) or `feature`, one tall card beside two stacked from 1024 px (3.17.0). */\n readonly arrangement?: 'even' | 'feature'\n /** `label` (the default): the `jobCardLabel` heading; `job`: the job's own `title` where it has one (3.17.0). */\n readonly cardTitle?: 'label' | 'job'\n}\nexport type NearbyJobsSkin = SkinEntry<NearbyJobsSlot, NearbyJobsVariant, NearbyJobsLayout, NearbyJobsRepeatedSlot>\n\nexport interface NearbyJobsProps extends NearbyJobsSkin {\n /** The H2, for example \"Recent tree work near Castle Hill\". */\n readonly title: ReactNode\n readonly eyebrow?: ReactNode\n readonly lead?: ReactNode\n /** The ranked cards from `nearbyJobs()`, nearest first; at most three. */\n readonly jobs: readonly BrandlabNearbyJob[]\n /** The page's suburb slug: its own jobs read \"in {Suburb}\", every other \"nearby: {Suburb}\". */\n readonly pageSuburb: string\n /** The service's name from the site's catalogue, for example `(slug) => services[slug].name`. */\n readonly serviceName: (service: string) => string\n /** The suburb's name from the registry. */\n readonly suburbName: (suburb: string) => string\n /** Replaces \"Recent\" on a dated card (\"Completed tree removal …\"); `''` for none. An undated card never has one. */\n readonly labelPrefix?: string\n /** The media manifest, for the jobs' photos. Left out, the cards show no photo. */\n readonly media?: BrandlabMediaManifest\n /** Photos the page already shows, such as the hero's: media ids or `src` paths. A card never repeats one. */\n readonly pagePhotos?: readonly string[]\n /** The job's project page, when the site has one. */\n readonly jobHref?: (job: BrandlabJob) => string | undefined\n /** A visible cue on a linked card (3.17.0), for example \"View job\". Decorative: the link's name is the heading. */\n readonly linkCue?: ReactNode\n /** A line after the list (3.17.0), for example \"42 jobs logged across the Hills District\". */\n readonly footer?: ReactNode\n /** A link after the list (3.17.0), for example `{ label: 'See all our projects', href: '/projects' }`. */\n readonly link?: UiLink\n /** The photo `sizes`. Defaults to one column of the grid. */\n readonly imageSizes?: string\n /** Defaults to `nearby-jobs-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\n/** The guard for `SectionSequence`: no card means no section (D2). */\nexport function nearbyJobsReady({ jobs }: Pick<NearbyJobsProps, 'jobs'>): BrandlabSectionReadiness {\n return jobs.length > 0 ? SECTION_READY : { render: false, reason: 'no-jobs-nearby' }\n}\n\nfunction photoOf(job: BrandlabJob, media: BrandlabMediaManifest | undefined, shown: ReadonlySet<string>) {\n if (!media) return undefined\n const photo = jobPhotos(job, media).find((entry) => !shown.has(entry.id) && !shown.has(entry.src))\n if (!photo) return undefined\n if (photo.provenance !== 'genuine') {\n throw new Error(`NearbyJobs: \"${photo.id}\" is ${photo.provenance}; only a genuine photo of the job shows on its card.`)\n }\n if (photo.job !== undefined && photo.job !== job.id) throw new Error(`NearbyJobs: \"${photo.id}\" is a photo of ${photo.job}, not ${job.id}.`)\n return photo\n}\n\nexport function NearbyJobs({\n title,\n eyebrow,\n lead,\n jobs,\n pageSuburb,\n serviceName,\n suburbName,\n labelPrefix,\n media,\n pagePhotos,\n jobHref,\n linkCue,\n footer,\n link,\n imageSizes,\n headingId = 'nearby-jobs-heading',\n tone,\n variant = 'grid',\n layout,\n classes,\n}: NearbyJobsProps) {\n if (jobs.length === 0) return null\n if (jobs.length > JOB_CARD_LIMIT) throw new Error(`NearbyJobs: ${jobs.length} jobs; a page shows at most ${JOB_CARD_LIMIT} job cards.`)\n const ids = new Set<string>()\n for (const { job } of jobs) {\n if (ids.has(job.id)) throw new Error(`NearbyJobs: \"${job.id}\" is listed twice.`)\n ids.add(job.id)\n }\n const shown = new Set(pagePhotos)\n const columns = layout?.columns ?? 3\n const ratio = layout?.ratio ?? '4:3'\n const feature = variant === 'grid' && layout?.arrangement === 'feature' && jobs.length === 3\n const sizes = imageSizes ?? `(min-width: 1024px) ${Math.round(100 / columns)}vw, (min-width: 640px) 50vw, 100vw`\n const headings = cardHeadings(\n jobs,\n layout?.cardTitle ?? 'label',\n (job) => jobCardLabel(job, { service: serviceName(job.service), suburbName: suburbName(job.suburb), pageSuburb, ...(labelPrefix === undefined ? {} : { prefix: labelPrefix }) }),\n pageSuburb,\n )\n return (\n <Section\n id=\"nearby-jobs\"\n labelledBy={headingId}\n tone={tone}\n variant={variant}\n classes={classes}\n hooks={{ 'data-columns': String(columns), 'data-ratio': ratio, 'data-arrangement': feature ? 'feature' : undefined }}\n >\n <SectionHeading id={headingId} title={title} eyebrow={eyebrow} lead={lead} classes={classes} />\n <ul role=\"list\" {...slot(classes, 'list')}>\n {jobs.map(({ job }, index) => {\n const label = headings[index]\n const href = jobHref?.(job)\n const photo = photoOf(job, media, shown)\n return (\n <li key={job.id} {...repeatedSlot('item')} data-item={job.id} data-suburb={job.suburb} data-linked={href ? '' : undefined}>\n <div {...repeatedSlot('body')}>\n <h3 {...repeatedSlot('title')}>\n {href ? (\n <Anchor href={href} prefetch={LINK_PREFETCH_POLICY.contentCard} hooks={repeatedSlot('link')}>\n {label}\n </Anchor>\n ) : (\n label\n )}\n </h3>\n <p {...repeatedSlot('outcome')}>{job.outcome}</p>\n {href && linkCue ? (\n <span {...repeatedSlot('cue')} aria-hidden=\"true\">\n {linkCue}\n </span>\n ) : null}\n </div>\n {photo ? (\n <div {...repeatedSlot('media')}>\n <Media media={photo} sizes={sizes} layout={{ ratio }} />\n </div>\n ) : null}\n </li>\n )\n })}\n </ul>\n {footer ? <p {...slot(classes, 'footer')}>{footer}</p> : null}\n {link ? (\n <p {...slot(classes, 'more')}>\n <TextLink href={link.href} prefetch={LINK_PREFETCH_POLICY.contentCard}>\n {link.label}\n </TextLink>\n </p>\n ) : null}\n </Section>\n )\n}\n\n/** Each card's heading: its label, or the job's title where the label repeats an earlier card's or `cardTitle` is `job`. */\nfunction cardHeadings(\n jobs: readonly BrandlabNearbyJob[],\n cardTitle: 'label' | 'job',\n labelOf: (job: BrandlabJob) => string,\n pageSuburb: string,\n): string[] {\n const used = new Set<string>()\n // A job from another suburb keeps the \"nearby\" label when its own title stands in (L4, 3.17.1).\n const titleOf = (job: BrandlabJob) => (job.title && job.suburb !== pageSuburb ? `Nearby: ${job.title}` : job.title)\n return jobs.map(({ job }) => {\n const title = titleOf(job)\n let heading = cardTitle === 'job' && title ? title : labelOf(job)\n if (used.has(heading)) {\n if (!title || used.has(title)) {\n throw new Error(`NearbyJobs: two cards would both read \"${heading}\"; give job \"${job.id}\" its own title in the job log.`)\n }\n heading = title\n }\n used.add(heading)\n return heading\n })\n}\n"]}
1
+ {"version":3,"file":"nearby-jobs.js","sourceRoot":"","sources":["../../../src/ui-kit/sections/nearby-jobs.tsx"],"names":[],"mappings":";AAsBA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAA4C,MAAM,kCAAkC,CAAA;AAEpI,OAAO,EAAE,aAAa,EAAiC,MAAM,2CAA2C,CAAA;AACxG,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,KAAK,EAAoB,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAE,OAAO,EAAE,cAAc,EAA+D,MAAM,yBAAyB,CAAA;AAE9H,OAAO,EAAE,YAAY,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AAG/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CA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AC1B,OAAqC,EACrC,UAAkB;IAElB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,gGAAgG;IAChG,MAAM,OAAO,GAAG,CAAC,GAAgB,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACnH,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;QAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QAC1B,IAAI,OAAO,GAAG,SAAS,KAAK,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACjE,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,0CAA0C,OAAO,gBAAgB,GAAG,CAAC,EAAE,iCAAiC,CAAC,CAAA;YAC3H,CAAC;YACD,OAAO,GAAG,KAAK,CAAA;QACjB,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACjB,OAAO,OAAO,CAAA;IAChB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/**\n * `NearbyJobs` (S17, `nearby-jobs`, 3.15.0): proof of real work near this place. Server component.\n *\n * The cards come from the job log (site-core `./jobs`): `nearbyJobs(origin, jobs, { centreOf, service })` ranks the\n * page suburb's own jobs first, then others by real distance within 10 km, at most three. Each card's heading is\n * `jobCardLabel`: \"Tree removal in Castle Hill\" for the page's own suburb, \"Tree removal nearby: Ryde\" for any other\n * (L4); only a job whose month is known says \"Recent\" (or `labelPrefix`) and ends \", {Month Year}\". Distances rank the cards and are never\n * printed (L10). A card shows the job's first photo through `Media`, and only a genuine photo of that job: a stock or AI\n * image never stands for the client's work. With no job close enough the section renders nothing and its guard says\n * so (`no-jobs-nearby`, D2). A card links to the job's project page when the site has one (prefetch on intent).\n * Card photos are always lazy. `pagePhotos` names the photos the page already shows (the hero's): a card then takes the\n * job's next genuine photo, or none, so the hero's priority photo is never repeated below as a lazy copy (3.15.0; on\n * AA's suburb pages the repeat made Next report the hero, the LCP image, as lazy and downloaded it twice).\n *\n * 3.17.0: two cards never share a heading. Where a card's label repeats an earlier one (\"Tree removal in Eastwood\"\n * twice) it takes the job's own `title`, and a job without one fails the build; `layout.cardTitle: 'job'` uses the\n * title on every card that has one. A title from another suburb reads \"Nearby: {title}\" (L4, 3.17.1). `linkCue` (\"View job\") shows on a linked card, and the whole card then follows\n * the heading's link (the cue is `aria-hidden`, so the link's name stays the heading). `layout.arrangement: 'feature'`\n * sets one tall card beside two stacked from 1024 px. `footer` (a count line) and `link` (\"See all our projects\")\n * follow the list.\n */\nimport type { ReactNode } from 'react'\nimport { JOB_CARD_LIMIT, jobCardLabel, jobPhotos, type BrandlabJob, type BrandlabNearbyJob } from '@brandlab-digital/site-core/jobs'\nimport type { BrandlabMediaManifest } from '@brandlab-digital/site-core/media'\nimport { SECTION_READY, type BrandlabSectionReadiness } from '@brandlab-digital/site-core/section-order'\nimport { LINK_PREFETCH_POLICY } from '../prefetch.js'\nimport { Anchor, TextLink } from '../primitives/links.js'\nimport { Media, type MediaLayout } from '../primitives/media.js'\nimport { Section, SectionHeading, type SectionHeadingSlot, type SectionSlot, type SectionTone } from '../primitives/layout.js'\nimport type { RepeatedSlotOf } from '../repeated-slots.js'\nimport { repeatedSlot, slot, type SkinEntry } from '../skin.js'\nimport type { UiLink } from '../types.js'\n\nexport const NEARBY_JOBS_VARIANTS = ['grid', 'rail'] as const\nexport type NearbyJobsVariant = (typeof NEARBY_JOBS_VARIANTS)[number]\nexport type NearbyJobsSlot = SectionSlot | SectionHeadingSlot | 'list' | 'footer' | 'more' | RepeatedSlotOf<'nearbyJobs'>\n/** Rendered once per job: styled from the skin stylesheet, never by class. */\nexport type NearbyJobsRepeatedSlot = RepeatedSlotOf<'nearbyJobs'>\nexport interface NearbyJobsLayout {\n /** `grid`: columns on wide screens. Defaults to 3. */\n readonly columns?: 2 | 3\n /** The photo's crop. Defaults to 4:3. */\n readonly ratio?: NonNullable<MediaLayout['ratio']>\n /** `grid`: `even` (the default) or `feature`, one tall card beside two stacked from 1024 px (3.17.0). */\n readonly arrangement?: 'even' | 'feature'\n /** `label` (the default): the `jobCardLabel` heading; `job`: the job's own `title` where it has one (3.17.0). */\n readonly cardTitle?: 'label' | 'job'\n}\nexport type NearbyJobsSkin = SkinEntry<NearbyJobsSlot, NearbyJobsVariant, NearbyJobsLayout, NearbyJobsRepeatedSlot>\n\nexport interface NearbyJobsProps extends NearbyJobsSkin {\n /** The H2, for example \"Recent tree work near Castle Hill\". */\n readonly title: ReactNode\n readonly eyebrow?: ReactNode\n readonly lead?: ReactNode\n /** The ranked cards from `nearbyJobs()`, nearest first; at most three. */\n readonly jobs: readonly BrandlabNearbyJob[]\n /** The page's suburb slug: its own jobs read \"in {Suburb}\", every other \"nearby: {Suburb}\". */\n readonly pageSuburb: string\n /** The service's name from the site's catalogue, for example `(slug) => services[slug].name`. */\n readonly serviceName: (service: string) => string\n /** The suburb's name from the registry. */\n readonly suburbName: (suburb: string) => string\n /** Replaces \"Recent\" on a dated card (\"Completed tree removal …\"); `''` for none. An undated card never has one. */\n readonly labelPrefix?: string\n /** The media manifest, for the jobs' photos. Left out, the cards show no photo. */\n readonly media?: BrandlabMediaManifest\n /** Photos the page already shows, such as the hero's: media ids or `src` paths. A card never repeats one. */\n readonly pagePhotos?: readonly string[]\n /** The job's project page, when the site has one. */\n readonly jobHref?: (job: BrandlabJob) => string | undefined\n /** A visible cue on a linked card (3.17.0), for example \"View job\". Decorative: the link's name is the heading. */\n readonly linkCue?: ReactNode\n /** A line after the list (3.17.0), for example \"42 jobs logged across the Hills District\". */\n readonly footer?: ReactNode\n /** A link after the list (3.17.0), for example `{ label: 'See all our projects', href: '/projects' }`. */\n readonly link?: UiLink\n /** The photo `sizes`. Defaults to one column of the grid. */\n readonly imageSizes?: string\n /** Defaults to `nearby-jobs-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\n/** The guard for `SectionSequence`: no card means no section (D2). */\nexport function nearbyJobsReady({ jobs }: Pick<NearbyJobsProps, 'jobs'>): BrandlabSectionReadiness {\n return jobs.length > 0 ? SECTION_READY : { render: false, reason: 'no-jobs-nearby' }\n}\n\nfunction photoOf(job: BrandlabJob, media: BrandlabMediaManifest | undefined, shown: ReadonlySet<string>) {\n if (!media) return undefined\n const photo = jobPhotos(job, media).find((entry) => !shown.has(entry.id) && !shown.has(entry.src))\n if (!photo) return undefined\n if (photo.provenance !== 'genuine') {\n throw new Error(`NearbyJobs: \"${photo.id}\" is ${photo.provenance}; only a genuine photo of the job shows on its card.`)\n }\n if (photo.job !== undefined && photo.job !== job.id) throw new Error(`NearbyJobs: \"${photo.id}\" is a photo of ${photo.job}, not ${job.id}.`)\n return photo\n}\n\nexport function NearbyJobs({\n title,\n eyebrow,\n lead,\n jobs,\n pageSuburb,\n serviceName,\n suburbName,\n labelPrefix,\n media,\n pagePhotos,\n jobHref,\n linkCue,\n footer,\n link,\n imageSizes,\n headingId = 'nearby-jobs-heading',\n tone,\n variant = 'grid',\n layout,\n classes,\n}: NearbyJobsProps) {\n if (jobs.length === 0) return null\n if (jobs.length > JOB_CARD_LIMIT) throw new Error(`NearbyJobs: ${jobs.length} jobs; a page shows at most ${JOB_CARD_LIMIT} job cards.`)\n const ids = new Set<string>()\n for (const { job } of jobs) {\n if (ids.has(job.id)) throw new Error(`NearbyJobs: \"${job.id}\" is listed twice.`)\n ids.add(job.id)\n }\n const shown = new Set(pagePhotos)\n const columns = layout?.columns ?? 3\n const ratio = layout?.ratio ?? '4:3'\n const feature = variant === 'grid' && layout?.arrangement === 'feature' && jobs.length === 3\n const sizes = imageSizes ?? `(min-width: 1024px) ${Math.round(100 / columns)}vw, (min-width: 640px) 50vw, 100vw`\n const headings = cardHeadings(\n jobs,\n layout?.cardTitle ?? 'label',\n // The ui-kit is frozen (2 Nov 2026), so its cards keep their \"nearby: {Suburb}\" wording; site-core's own default\n // names the job's suburb plainly from 3.20.0.\n (job) => jobCardLabel(job, { service: serviceName(job.service), suburbName: suburbName(job.suburb), pageSuburb, nearby: true, ...(labelPrefix === undefined ? {} : { prefix: labelPrefix }) }),\n pageSuburb,\n )\n return (\n <Section\n id=\"nearby-jobs\"\n labelledBy={headingId}\n tone={tone}\n variant={variant}\n classes={classes}\n hooks={{ 'data-columns': String(columns), 'data-ratio': ratio, 'data-arrangement': feature ? 'feature' : undefined }}\n >\n <SectionHeading id={headingId} title={title} eyebrow={eyebrow} lead={lead} classes={classes} />\n <ul role=\"list\" {...slot(classes, 'list')}>\n {jobs.map(({ job }, index) => {\n const label = headings[index]\n const href = jobHref?.(job)\n const photo = photoOf(job, media, shown)\n return (\n <li key={job.id} {...repeatedSlot('item')} data-item={job.id} data-suburb={job.suburb} data-linked={href ? '' : undefined}>\n <div {...repeatedSlot('body')}>\n <h3 {...repeatedSlot('title')}>\n {href ? (\n <Anchor href={href} prefetch={LINK_PREFETCH_POLICY.contentCard} hooks={repeatedSlot('link')}>\n {label}\n </Anchor>\n ) : (\n label\n )}\n </h3>\n <p {...repeatedSlot('outcome')}>{job.outcome}</p>\n {href && linkCue ? (\n <span {...repeatedSlot('cue')} aria-hidden=\"true\">\n {linkCue}\n </span>\n ) : null}\n </div>\n {photo ? (\n <div {...repeatedSlot('media')}>\n <Media media={photo} sizes={sizes} layout={{ ratio }} />\n </div>\n ) : null}\n </li>\n )\n })}\n </ul>\n {footer ? <p {...slot(classes, 'footer')}>{footer}</p> : null}\n {link ? (\n <p {...slot(classes, 'more')}>\n <TextLink href={link.href} prefetch={LINK_PREFETCH_POLICY.contentCard}>\n {link.label}\n </TextLink>\n </p>\n ) : null}\n </Section>\n )\n}\n\n/** Each card's heading: its label, or the job's title where the label repeats an earlier card's or `cardTitle` is `job`. */\nfunction cardHeadings(\n jobs: readonly BrandlabNearbyJob[],\n cardTitle: 'label' | 'job',\n labelOf: (job: BrandlabJob) => string,\n pageSuburb: string,\n): string[] {\n const used = new Set<string>()\n // A job from another suburb keeps the \"nearby\" label when its own title stands in (L4, 3.17.1).\n const titleOf = (job: BrandlabJob) => (job.title && job.suburb !== pageSuburb ? `Nearby: ${job.title}` : job.title)\n return jobs.map(({ job }) => {\n const title = titleOf(job)\n let heading = cardTitle === 'job' && title ? title : labelOf(job)\n if (used.has(heading)) {\n if (!title || used.has(title)) {\n throw new Error(`NearbyJobs: two cards would both read \"${heading}\"; give job \"${job.id}\" its own title in the job log.`)\n }\n heading = title\n }\n used.add(heading)\n return heading\n })\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brandlab-digital/site-next",
3
- "version": "3.19.0",
3
+ "version": "3.20.0",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  "typecheck": "tsc --noEmit -p tsconfig.json"
26
26
  },
27
27
  "dependencies": {
28
- "@brandlab-digital/site-core": "3.19.0",
28
+ "@brandlab-digital/site-core": "3.20.0",
29
29
  "browser-image-compression": "2.0.2",
30
30
  "pdf-lib": "1.17.1",
31
31
  "server-only": "0.0.1",