@brandlab-digital/site-next 3.17.1 → 3.19.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/contact/client-entry.d.ts +2 -1
- package/dist/contact/client-entry.d.ts.map +1 -1
- package/dist/contact/client-entry.js +1 -0
- package/dist/contact/client-entry.js.map +1 -1
- package/dist/contact/form-client.d.ts +12 -3
- package/dist/contact/form-client.d.ts.map +1 -1
- package/dist/contact/form-client.js +18 -2
- package/dist/contact/form-client.js.map +1 -1
- package/dist/contact/google-tag-navigate.d.ts +32 -0
- package/dist/contact/google-tag-navigate.d.ts.map +1 -0
- package/dist/contact/google-tag-navigate.js +72 -0
- package/dist/contact/google-tag-navigate.js.map +1 -0
- package/dist/next-config.d.ts +5 -0
- package/dist/next-config.d.ts.map +1 -1
- package/dist/next-config.js +6 -1
- package/dist/next-config.js.map +1 -1
- package/dist/ui-kit/form/quote-form.d.ts +6 -2
- package/dist/ui-kit/form/quote-form.d.ts.map +1 -1
- package/dist/ui-kit/form/quote-form.js +6 -3
- package/dist/ui-kit/form/quote-form.js.map +1 -1
- package/dist/ui-kit/primitives/media-frame.d.ts +5 -0
- package/dist/ui-kit/primitives/media-frame.d.ts.map +1 -1
- package/dist/ui-kit/primitives/media-frame.js +5 -2
- package/dist/ui-kit/primitives/media-frame.js.map +1 -1
- package/dist/ui-kit/primitives/media.d.ts +2 -0
- package/dist/ui-kit/primitives/media.d.ts.map +1 -1
- package/dist/ui-kit/primitives/media.js +1 -1
- package/dist/ui-kit/primitives/media.js.map +1 -1
- package/dist/ui-kit/repeated-slots.d.ts +1 -1
- package/dist/ui-kit/repeated-slots.js +1 -1
- package/dist/ui-kit/repeated-slots.js.map +1 -1
- package/dist/ui-kit/sections/hero.d.ts +5 -0
- package/dist/ui-kit/sections/hero.d.ts.map +1 -1
- package/dist/ui-kit/sections/hero.js +1 -1
- package/dist/ui-kit/sections/hero.js.map +1 -1
- package/dist/ui-kit/sections/licences.d.ts +23 -0
- package/dist/ui-kit/sections/licences.d.ts.map +1 -1
- package/dist/ui-kit/sections/licences.js +29 -3
- package/dist/ui-kit/sections/licences.js.map +1 -1
- package/package.json +2 -2
package/dist/next-config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-config.js","sourceRoot":"","sources":["../src/next-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,eAAe,EAA8B,MAAM,uCAAuC,CAAA;AACnG,OAAO,EACL,wBAAwB,EACxB,yBAAyB,GAI1B,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,mCAAmC,EACnC,wBAAwB,EACxB,6BAA6B,GAM9B,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAoB,MAAM,yBAAyB,CAAA;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AA4GzD,gGAAgG;AAChG,MAAM,CAAC,MAAM,2BAA2B,GAAG,qCAAqC,CAAA;AAEhF,mFAAmF;AACnF,MAAM,CAAC,MAAM,oCAAoC,GAAG,MAAM,CAAC,MAAM,CAAC;IAChE,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC;QAC5B,yBAAyB;QACzB,wCAAwC;QACxC,gDAAgD;KACjD,CAAC;CACH,CAAC,CAAA;AAEF,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;AACnE,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,MAAM;IACN,YAAY;IACZ,WAAW;IACX,QAAQ;IACR,KAAK;IACL,MAAM;IACN,mBAAmB;IACnB,cAAc;IACd,kBAAkB;IAClB,KAAK;IACL,OAAO;IACP,a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CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;AACnD,CAAC","sourcesContent":["import { readdirSync, statSync } from 'node:fs'\nimport { join, posix } from 'node:path'\nimport { defineRedirects, type BrandlabRedirectTable } from '@brandlab-digital/site-core/redirects'\nimport {\n assertBrandlabAliasHosts,\n resolveBrandlabDeployment,\n type BrandlabDeploymentEnvironment,\n type BrandlabEnvironment,\n type BrandlabSite,\n} from '@brandlab-digital/site-core/site'\nimport {\n BRANDLAB_STATIC_ASSET_CACHE_CONTROL,\n buildBrandlabHeaderRules,\n parseBrandlabStaticAssetCache,\n type BrandlabContentSecurityPolicyExtensions,\n type BrandlabHeader,\n type BrandlabHeaderRule,\n type BrandlabHstsExpansion,\n type BrandlabStaticAssetFolder,\n} from './headers.js'\nimport { defineSiteIcons, ICON_SPRITE_ENV, type SiteIconSet } from './ui-kit/icon-glyphs.js'\nimport { writeIconSprite } from './ui-kit/icon-sprite.js'\n\n/** Next redirect records: 308 stays `permanent: true`, 301 stays `statusCode: 301`. */\nexport type BrandlabNextRedirect = {\n source: string\n destination: string\n has?: { type: 'host'; value: string }[]\n} & ({ permanent: true; statusCode?: never } | { statusCode: 301; permanent?: never })\n\nexport interface BrandlabNextRemotePattern {\n protocol?: 'http' | 'https'\n hostname: string\n port?: string\n pathname?: string\n search?: string\n}\n\n/** The site's own image settings; the output format is always WebP. */\nexport interface BrandlabNextImagesOptions {\n deviceSizes?: readonly number[]\n imageSizes?: readonly number[]\n qualities?: readonly number[]\n minimumCacheTTL?: number\n /**\n * Remote image sources the optimiser may fetch. From 3.3.3 a production build\n * (`next build`, `next start`) refuses an `http` pattern, a pattern without an\n * explicit `https` protocol and a local or private-network host such as `localhost`.\n */\n remotePatterns?: readonly BrandlabNextRemotePattern[]\n /**\n * Sources for `next dev` only, such as `{ protocol: 'http', hostname: 'localhost' }`\n * (3.3.3). They are added to remotePatterns when the build is not a production\n * build and never reach a deployment.\n */\n developmentRemotePatterns?: readonly BrandlabNextRemotePattern[]\n}\n\nexport interface BrandlabNextImagesConfig {\n formats: 'image/webp'[]\n deviceSizes?: number[]\n imageSizes?: number[]\n qualities?: number[]\n minimumCacheTTL?: number\n remotePatterns?: BrandlabNextRemotePattern[]\n}\n\nexport interface BrandlabNextConfig {\n poweredByHeader: false\n /** Trailing slashes are handled by single-hop redirect rules instead. */\n skipTrailingSlashRedirect: true\n env: {\n NEXT_PUBLIC_VERCEL_ENV: BrandlabDeploymentEnvironment\n /** The icon sprite's path (3.14.0), set when `icons` is declared. */\n NEXT_PUBLIC_BL_ICON_SPRITE?: string\n }\n outputFileTracingIncludes: Record<string, string[]>\n images: BrandlabNextImagesConfig\n pageExtensions?: string[]\n headers: () => Promise<BrandlabHeaderRule[]>\n redirects: () => Promise<BrandlabNextRedirect[]>\n}\n\nexport interface BrandlabNextConfigOptions {\n site: BrandlabSite\n /**\n * Hosts that permanently redirect every path to the canonical origin (the\n * `www` host, a Vercel project host, a retired domain). Declared here rather\n * than in the site identity, which client components import, so the list\n * never reaches a browser bundle. Their rules follow any `site.aliasHosts`\n * rules, in order, as the last redirects.\n */\n aliasHosts?: readonly string[]\n /** The src/data/redirects.ts table (defineRedirects). */\n redirects: BrandlabRedirectTable\n images: BrandlabNextImagesOptions\n /** Reviewed CSP origins for declared integrations such as Meta Pixel or map embeds. */\n csp?: BrandlabContentSecurityPolicyExtensions\n hsts?: BrandlabHstsExpansion\n /** Reviewed exception to the default Permissions-Policy that is already live. */\n permissionsPolicy?: string\n /** Reviewed response headers that are already live; protected headers cannot be replaced. */\n extraHeaders?: readonly BrandlabHeader[]\n /**\n * Public folders of static files that never change in place, written as Next\n * sources such as `['/images/:path*', '/fonts/:path*']`. Production builds serve\n * their files (names with an extension) with `public, max-age=31536000, immutable`;\n * Previews keep `private, no-store`. Each folder must exist under `public/`, and\n * no route under `src/app` or `app` may answer below it.\n */\n staticAssetCache?: readonly string[]\n /**\n * The ui-kit icon sprite (3.14.0). When declared, loading the config writes `public/_bl/icons.<hash>.svg` (every\n * library icon plus `site`, the set from `defineSiteIcons`), removes older sprites there and sets\n * `NEXT_PUBLIC_BL_ICON_SPRITE`, so every `Icon` renders a `<use>` into the sprite instead of an inline glyph.\n * Production builds serve the file with `public, max-age=31536000, immutable`. Add `public/_bl/` to `.gitignore`.\n */\n icons?: BrandlabIconsOptions\n /** Defaults to process.env; tests supply a fixed environment. */\n environment?: BrandlabEnvironment\n /** The project root for the staticAssetCache checks and the icon sprite; defaults to process.cwd(). */\n projectRoot?: string\n}\n\nexport interface BrandlabIconsOptions {\n /** The site's own icons, from `defineSiteIcons` (`src/site/icons.ts`). */\n site?: SiteIconSet\n}\n\n/** The sprite's cache rule: content-hashed names only, so a stale name never reaches a page. */\nexport const BRANDLAB_ICON_SPRITE_SOURCE = '/_bl/:file(icons\\\\.[0-9a-f]+\\\\.svg)'\n\n/** Sharp's Linux binaries must travel with the contact route's image sanitiser. */\nexport const BRANDLAB_CONTACT_OUTPUT_FILE_TRACING = Object.freeze({\n '/api/contact': Object.freeze([\n 'node_modules/sharp/**/*',\n 'node_modules/@img/sharp-linux-x64/**/*',\n 'node_modules/@img/sharp-libvips-linux-x64/**/*',\n ]),\n})\n\nconst MDX_PAGE_EXTENSIONS = ['tsx', 'ts', 'jsx', 'js', 'mdx', 'md']\nconst OPTION_KEYS = new Set([\n 'site',\n 'aliasHosts',\n 'redirects',\n 'images',\n 'csp',\n 'hsts',\n 'permissionsPolicy',\n 'extraHeaders',\n 'staticAssetCache',\n 'mdx',\n 'icons',\n 'environment',\n 'projectRoot',\n])\nconst IMAGE_KEYS = new Set(['deviceSizes', 'imageSizes', 'qualities', 'minimumCacheTTL', 'remotePatterns', 'developmentRemotePatterns'])\nconst REMOTE_PATTERN_KEYS = new Set(['protocol', 'hostname', 'port', 'pathname', 'search'])\n\nfunction assertKnownKeys(value: object, allowed: ReadonlySet<string>, field: string, hint = '') {\n const unsupported = Object.keys(value).filter((key) => !allowed.has(key))\n if (unsupported.length > 0) {\n throw new Error(`${field} contains unsupported keys: ${unsupported.join(', ')}.${hint}`)\n }\n}\n\nfunction positiveIntegers(values: readonly number[] | undefined, field: string) {\n if (values === undefined) return undefined\n if (\n !Array.isArray(values) ||\n values.length === 0 ||\n values.some((value) => !Number.isSafeInteger(value) || value < 1)\n ) {\n throw new Error(`images.${field} must list positive integers.`)\n }\n return [...values]\n}\n\n/**\n * A host no deployment should fetch images from: loopback (`localhost`, `*.localhost`,\n * 127.0.0.0/8, ::1), unspecified (0.0.0.0, ::), private (10/8, 172.16/12, 192.168/16,\n * fc00::/7), shared (100.64/10) or link-local (169.254/16, fe80::/10), in any spelling a URL\n * reads as one of them, or a wildcard host that admits one (`**`, `10.*.*.*`).\n */\nfunction isLocalImageHost(hostname: string): boolean {\n const host = hostname.trim().toLowerCase().replace(/^\\[(.*)\\]$/, '$1').replace(/\\.$/, '')\n // Other picomatch syntax (?, braces, classes, extglobs) cannot be judged here, so it is refused.\n if (/[?{}[\\]()!@+]/.test(host)) return true\n // A wildcard host is local when it admits a local address: Next matches hostnames with picomatch, whose `*` stops\n // only at a slash, so `*` and `**` both admit `localhost`, and `10.*.*.*` admits 10.0.0.1. Any wildcard address\n // (`192.168.1.*`, `fd12:*`) counts as local.\n if (host.includes('*')) {\n if (/^[\\d.*]+$/.test(host) || host.includes(':')) return true\n const source = host.split(/(\\*\\*|\\*)/).map((part) => (part === '**' ? '.*' : part === '*' ? '[^/]*' : part.replace(/[.+?^$()|{}[\\]\\\\]/g, '\\\\$&'))).join('')\n const glob = new RegExp('^' + source + '$')\n return LOCAL_HOST_SAMPLES.some((sample) => glob.test(sample))\n }\n // The address a URL reads it as: 127.1, 0x7f.0.0.1 and [::ffff:127.0.0.1] all name 127.0.0.1.\n let named = host\n try {\n named = new URL('https://' + (host.includes(':') ? '[' + host + ']' : host)).hostname.replace(/^\\[(.*)\\]$/, '$1')\n } catch {\n // not a host a URL can name: judged as written\n }\n if (named === 'localhost' || named.endsWith('.localhost')) return true\n const hex = named.match(/^(?:0{0,4}:){0,5}:?ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/)\n const dotted = hex ? [parseInt(hex[1]!, 16) >> 8, parseInt(hex[1]!, 16) & 255, parseInt(hex[2]!, 16) >> 8, parseInt(hex[2]!, 16) & 255].join('.') : undefined\n const mapped = named.match(/^(?:0{0,4}:){0,5}:?ffff:(\\d{1,3}(?:\\.\\d{1,3}){3})$/)\n const ipv4 = (dotted ?? mapped?.[1] ?? named).match(/^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/)\n if (ipv4) {\n const [a, b] = [Number(ipv4[1]), Number(ipv4[2])]\n return a === 0 || a === 10 || a === 127 || (a === 169 && b === 254) || (a === 172 && b >= 16 && b <= 31) ||\n (a === 192 && b === 168) || (a === 100 && b >= 64 && b <= 127)\n }\n if (!named.includes(':')) return false\n const groups = named.split(':')\n const allZero = (parts: string[]) => parts.every((part) => /^0*$/.test(part))\n // :: and ::1 in any spelling (0:0:0:0:0:0:0:1), then the private and link-local prefixes.\n if (allZero(groups) || (allZero(groups.slice(0, -1)) && /^0*1$/.test(groups.at(-1) ?? ''))) return true\n return /^f[cd][0-9a-f]{0,2}:/.test(named) || /^fe[89ab][0-9a-f]?:/.test(named)\n}\n\n/** One address in each local range, to judge a wildcard host by. */\nconst LOCAL_HOST_SAMPLES = ['localhost', 'a.localhost', '0.0.0.0', '10.0.0.1', '100.64.0.1', '127.0.0.1', '169.254.169.254', '172.16.0.1', '192.168.0.1', '::1', 'fc00::1', 'fe80::1']\n\nfunction describeRemotePattern(pattern: BrandlabNextRemotePattern): string {\n const path = pattern.pathname === undefined ? '/**' : pattern.pathname.startsWith('/') ? pattern.pathname : `/${pattern.pathname}`\n return `${pattern.protocol ?? 'any protocol'}://${pattern.hostname}${pattern.port ? `:${pattern.port}` : ''}${path}`\n}\n\n/** A validated copy of a remote pattern list: the keys and value types Next reads. */\nfunction remotePatternList(value: unknown, field: string): BrandlabNextRemotePattern[] | undefined {\n if (value === undefined) return undefined\n if (!Array.isArray(value)) throw new Error(`images.${field} must be an array.`)\n return value.map((pattern: unknown, index) => {\n const at = `images.${field}[${index}]`\n if (!pattern || typeof pattern !== 'object' || Array.isArray(pattern)) {\n throw new Error(`${at} must be a { protocol, hostname, port?, pathname?, search? } pattern.`)\n }\n assertKnownKeys(pattern, REMOTE_PATTERN_KEYS, at)\n const record = pattern as Record<string, unknown>\n if (typeof record.hostname !== 'string' || !record.hostname.trim()) throw new Error(`${at}.hostname must name a host.`)\n if (record.protocol !== undefined && record.protocol !== 'https' && record.protocol !== 'http') {\n throw new Error(`${at}.protocol must be 'https' ('http' only in images.developmentRemotePatterns).`)\n }\n for (const key of ['port', 'pathname', 'search'] as const) {\n if (record[key] !== undefined && typeof record[key] !== 'string') throw new Error(`${at}.${key} must be a string.`)\n }\n return { ...(pattern as BrandlabNextRemotePattern) }\n })\n}\n\n/**\n * A production build fetches remote images only over https from a public host:\n * the optimiser fetches a remote pattern's images on any visitor's request\n * (GHSA-cjq9-62q9-8jv4), and an http or local source is a development convenience.\n */\nfunction assertProductionRemotePatterns(patterns: readonly BrandlabNextRemotePattern[]) {\n patterns.forEach((pattern, index) => {\n const problems = [\n ...(pattern.protocol === 'https' ? [] : [pattern.protocol === 'http' ? 'uses http' : \"does not name protocol 'https'\"]),\n ...(isLocalImageHost(pattern.hostname)\n ? [/[*?{}[\\]()!@+]/.test(pattern.hostname) ? `admits local addresses (${pattern.hostname} can match localhost or a private address)` : `names the local address ${pattern.hostname}`]\n : []),\n ]\n if (problems.length === 0) return\n throw new Error(\n `images.remotePatterns[${index}] (${describeRemotePattern(pattern)}) ${problems.join(' and ')}. ` +\n 'A production build only fetches remote images over https from a public host. Remove the pattern, ' +\n 'or move a development-only source to images.developmentRemotePatterns, which only next dev uses.',\n )\n })\n}\n\nfunction buildImagesConfig(images: BrandlabNextImagesOptions, productionBuild: boolean): BrandlabNextImagesConfig {\n if (!images || typeof images !== 'object' || Array.isArray(images)) {\n throw new Error('images must declare the site image settings ({} for Next defaults).')\n }\n assertKnownKeys(images, IMAGE_KEYS, 'images', ' The output format is always image/webp.')\n const deviceSizes = positiveIntegers(images.deviceSizes, 'deviceSizes')\n const imageSizes = positiveIntegers(images.imageSizes, 'imageSizes')\n const qualities = positiveIntegers(images.qualities, 'qualities')\n if (qualities?.some((quality) => quality > 100)) {\n throw new Error('images.qualities must be between 1 and 100.')\n }\n if (\n images.minimumCacheTTL !== undefined &&\n (!Number.isSafeInteger(images.minimumCacheTTL) || images.minimumCacheTTL < 0)\n ) {\n throw new Error('images.minimumCacheTTL must be a non-negative integer of seconds.')\n }\n const remotePatterns = remotePatternList(images.remotePatterns, 'remotePatterns')\n const developmentRemotePatterns = remotePatternList(images.developmentRemotePatterns, 'developmentRemotePatterns')\n if (productionBuild && remotePatterns) assertProductionRemotePatterns(remotePatterns)\n // next dev (and tests) also fetch the development-only sources; a production build never does.\n const served = productionBuild || !developmentRemotePatterns?.length\n ? remotePatterns\n : [...(remotePatterns ?? []), ...developmentRemotePatterns]\n return {\n formats: ['image/webp'],\n ...(deviceSizes ? { deviceSizes } : {}),\n ...(imageSizes ? { imageSizes } : {}),\n ...(qualities ? { qualities } : {}),\n ...(images.minimumCacheTTL !== undefined ? { minimumCacheTTL: images.minimumCacheTTL } : {}),\n ...(served ? { remotePatterns: served } : {}),\n }\n}\n\nconst PAGE_OR_ROUTE_FILE = /^(?:page|route)\\.[A-Za-z0-9]+$/\nconst METADATA_ROUTE_FILE = /^(?:opengraph-image|twitter-image|icon|apple-icon|sitemap|robots|manifest)(?:[\\w.-]*)\\.[A-Za-z0-9]+$/\n\nfunction isDirectory(path: string) {\n try {\n return statSync(path).isDirectory()\n } catch {\n return false\n }\n}\n\n/**\n * The first route file under an app directory that can answer a path strictly\n * below `/<folder>/`. `depth` counts the folder segments matched so far: route\n * groups, intercepts and parallel slots add none, a dynamic segment matches any\n * one, and a catch-all reaches every path below the folder.\n */\nfunction routeBelowFolder(\n directory: string,\n folder: readonly string[],\n depth: number,\n relative: string,\n): string | null {\n for (const entry of readdirSync(directory, { withFileTypes: true })) {\n const name = entry.name\n if (name.startsWith('_') || name.startsWith('.') || name === 'node_modules') continue\n const path = join(directory, name)\n const nextRelative = posix.join(relative, name)\n if (entry.isFile()) {\n // Page and route files serve their own directory; metadata files serve a path below it.\n const below = depth > folder.length && PAGE_OR_ROUTE_FILE.test(name)\n const metadata = depth >= folder.length && METADATA_ROUTE_FILE.test(name)\n if (below || metadata) return nextRelative\n continue\n }\n if (!entry.isDirectory()) continue\n let next: number | null = null\n if (name.startsWith('(') || name.startsWith('@')) next = depth\n else if (/^\\[\\[?\\.\\.\\./.test(name)) next = folder.length + 1\n else if (depth >= folder.length || name.startsWith('[') || name === folder[depth]) next = depth + 1\n if (next === null) continue\n const found = routeBelowFolder(path, folder, next, nextRelative)\n if (found) return found\n }\n return null\n}\n\n/** Each declared folder exists under public/ and no app route answers below it. */\nfunction assertStaticAssetFolders(folders: readonly BrandlabStaticAssetFolder[], root: string) {\n for (const { source, folder } of folders) {\n const publicFolder = posix.join('public', ...folder)\n if (!isDirectory(join(root, publicFolder))) {\n throw new Error(`staticAssetCache \"${source}\": ${publicFolder} is not a folder of static files in ${root}.`)\n }\n for (const appDirectory of ['src/app', 'app']) {\n if (!isDirectory(join(root, appDirectory))) continue\n const route = routeBelowFolder(join(root, appDirectory), folder, 0, appDirectory)\n if (route) {\n throw new Error(\n `staticAssetCache \"${source}\": ${route} answers below /${folder.join('/')}, so immutable caching could reach a page or route.`,\n )\n }\n }\n }\n}\n\n/** A site icon set, checked again here: the config may be handed an object that never went through defineSiteIcons. */\nfunction siteIconSet(site: unknown): SiteIconSet | undefined {\n if (site === undefined) return undefined\n const set = site as Partial<SiteIconSet>\n if (!set || typeof set !== 'object' || !Array.isArray(set.names) || !set.glyphs || typeof set.glyphs !== 'object') {\n throw new Error('icons.site must come from defineSiteIcons.')\n }\n return defineSiteIcons(Object.fromEntries(set.names.map((name) => [name, set.glyphs![name]!])))\n}\n\n/**\n * Converts the redirect table to Next redirects: each entry keeps its 301 or\n * 308 status (Next forwards the query string), gains a single-hop\n * trailing-slash variant, then one trailing-slash rule and one permanent\n * canonical-host rule per alias host follow. There is no x-forwarded-proto\n * rule: Vercel's edge already enforces HTTPS.\n */\nexport function buildBrandlabRedirects(options: {\n site: BrandlabSite\n redirects: BrandlabRedirectTable\n /** next.config's alias hosts, after the site identity's own (3.2.1). */\n aliasHosts?: readonly string[]\n}): BrandlabNextRedirect[] {\n const aliasHosts = brandlabAliasHosts(options.site, options.aliasHosts)\n const table = defineRedirects(options.redirects)\n const entries = table.flatMap((redirect): BrandlabNextRedirect[] => {\n const status = redirect.status === 301\n ? { statusCode: 301 as const }\n : { permanent: true as const }\n const has = redirect.host ? { has: [{ type: 'host' as const, value: redirect.host }] } : {}\n const record = (source: string): BrandlabNextRedirect => ({\n source,\n destination: redirect.destination,\n ...status,\n ...has,\n })\n return redirect.source === '/'\n ? [record(redirect.source)]\n : [record(redirect.source), record(`${redirect.source}/`)]\n })\n return [\n ...entries,\n { source: '/:path+/', destination: '/:path+', permanent: true },\n ...aliasHosts.map((host): BrandlabNextRedirect => ({\n source: '/:path*',\n has: [{ type: 'host', value: host }],\n destination: `${options.site.canonicalUrl}/:path*`,\n permanent: true,\n })),\n ]\n}\n\n/**\n * Every alias host: the site identity's (the 3.0–3.2.0 place) then next.config's\n * (3.2.1), validated together so a host is never declared twice.\n */\nexport function brandlabAliasHosts(site: BrandlabSite, aliasHosts: readonly string[] | undefined): readonly string[] {\n if (aliasHosts === undefined) return site.aliasHosts\n assertBrandlabAliasHosts(aliasHosts, site.canonicalHost ?? new URL(site.canonicalUrl).hostname, 'next.config aliasHosts')\n const all = [...site.aliasHosts, ...aliasHosts]\n const duplicate = all.find((host, index) => all.indexOf(host) !== index)\n if (duplicate) throw new Error(`Alias host \"${duplicate}\" is declared in both the site identity and next.config aliasHosts.`)\n return all\n}\n\n/**\n * The whole next.config.ts after its first line\n * `import '@brandlab-digital/site-next/image-runtime'`:\n * `export default defineBrandlabNextConfig({ site, redirects, images })`.\n *\n * Sets poweredByHeader: false, WebP image output, Sharp output tracing for\n * /api/contact, NEXT_PUBLIC_VERCEL_ENV for browser gates, the deployment's\n * header rules (with immutable caching for the declared static public folders on\n * production builds) and the redirect table. Validation runs when the config\n * loads, so an invalid table, header exception or static folder fails the build,\n * as does (3.3.3) a production build's http or local image remote pattern.\n */\nexport function defineBrandlabNextConfig(\n options: BrandlabNextConfigOptions & { mdx?: undefined },\n): BrandlabNextConfig\nexport function defineBrandlabNextConfig<Wrapped>(\n options: BrandlabNextConfigOptions & {\n /** The @next/mdx wrapper: createMDX({ options: { remarkPlugins: ['remark-gfm'] } }). */\n mdx: (config: BrandlabNextConfig) => Wrapped\n },\n): Wrapped\nexport function defineBrandlabNextConfig(\n options: BrandlabNextConfigOptions & { mdx?: (config: BrandlabNextConfig) => unknown },\n): unknown {\n if (!options || typeof options !== 'object') {\n throw new TypeError('defineBrandlabNextConfig requires the site, redirects and images.')\n }\n assertKnownKeys(options, OPTION_KEYS, 'next.config options')\n if (!options.site?.canonicalUrl || !Array.isArray(options.site.aliasHosts)) {\n throw new Error('site must come from defineBrandlabSite.')\n }\n if (options.mdx !== undefined && typeof options.mdx !== 'function') {\n throw new TypeError('mdx must be the @next/mdx config wrapper.')\n }\n const deployment = resolveBrandlabDeployment(options.environment ?? process.env)\n if (options.staticAssetCache !== undefined) {\n assertStaticAssetFolders(\n parseBrandlabStaticAssetCache(options.staticAssetCache),\n options.projectRoot ?? process.cwd(),\n )\n }\n const headerRules = buildBrandlabHeaderRules({\n deployment,\n canonicalHost: options.site.canonicalHost ?? new URL(options.site.canonicalUrl).hostname,\n ...(options.csp ? { contentSecurityPolicyExtensions: options.csp } : {}),\n ...(options.hsts ? { hsts: options.hsts } : {}),\n ...(options.permissionsPolicy ? { permissionsPolicy: options.permissionsPolicy } : {}),\n ...(options.extraHeaders ? { extraHeaders: options.extraHeaders } : {}),\n ...(options.staticAssetCache ? { staticAssetCache: options.staticAssetCache } : {}),\n })\n if (options.icons !== undefined) {\n if (!options.icons || typeof options.icons !== 'object' || Array.isArray(options.icons)) {\n throw new Error('icons must be { site?: defineSiteIcons(...) } ({} for the library icons only).')\n }\n assertKnownKeys(options.icons, new Set(['site']), 'icons')\n }\n const sprite = options.icons === undefined ? undefined : writeIconSprite(options.projectRoot ?? process.cwd(), siteIconSet(options.icons.site))\n // The same production-only rule as staticAssetCache: Previews keep private, no-store.\n if (sprite && deployment.productionBuild && deployment.environment !== 'preview') {\n // After the static folders, before the non-canonical host rule.\n const at = headerRules.findIndex((rule) => rule.missing !== undefined)\n headerRules.splice(at === -1 ? headerRules.length : at, 0, {\n source: BRANDLAB_ICON_SPRITE_SOURCE,\n headers: [{ key: 'Cache-Control', value: BRANDLAB_STATIC_ASSET_CACHE_CONTROL }],\n })\n }\n const redirects = buildBrandlabRedirects({\n site: options.site,\n redirects: options.redirects,\n ...(options.aliasHosts !== undefined ? { aliasHosts: options.aliasHosts } : {}),\n })\n\n const config: BrandlabNextConfig = {\n poweredByHeader: false,\n skipTrailingSlashRedirect: true,\n env: {\n NEXT_PUBLIC_VERCEL_ENV: deployment.environment,\n ...(sprite ? { [ICON_SPRITE_ENV]: sprite.href } : {}),\n },\n outputFileTracingIncludes: Object.fromEntries(\n Object.entries(BRANDLAB_CONTACT_OUTPUT_FILE_TRACING).map(([route, globs]) => [route, [...globs]]),\n ),\n // A Vercel build (preview or production) is checked like any production build, whatever NODE_ENV says.\n images: buildImagesConfig(options.images, deployment.productionBuild || deployment.environment !== 'development'),\n ...(options.mdx ? { pageExtensions: [...MDX_PAGE_EXTENSIONS] } : {}),\n headers: async () =>\n headerRules.map((rule) => ({\n source: rule.source,\n ...(rule.missing ? { missing: rule.missing.map((condition) => ({ ...condition })) } : {}),\n headers: rule.headers.map((header) => ({ ...header })),\n })),\n redirects: async () =>\n redirects.map((redirect) => ({\n ...redirect,\n ...(redirect.has ? { has: redirect.has.map((condition) => ({ ...condition })) } : {}),\n })),\n }\n return options.mdx ? options.mdx(config) : config\n}\n"]}
|
|
1
|
+
{"version":3,"file":"next-config.js","sourceRoot":"","sources":["../src/next-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,eAAe,EAA8B,MAAM,uCAAuC,CAAA;AACnG,OAAO,EACL,wBAAwB,EACxB,yBAAyB,GAI1B,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,mCAAmC,EACnC,wBAAwB,EACxB,6BAA6B,GAM9B,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAoB,MAAM,yBAAyB,CAAA;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AA4GzD,gGAAgG;AAChG,MAAM,CAAC,MAAM,2BAA2B,GAAG,qCAAqC,CAAA;AAEhF,mFAAmF;AACnF,MAAM,CAAC,MAAM,oCAAoC,GAAG,MAAM,CAAC,MAAM,CAAC;IAChE,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC;QAC5B,yBAAyB;QACzB,wCAAwC;QACxC,gDAAgD;KACjD,CAAC;CACH,CAAC,CAAA;AAEF,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;AACnE,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,MAAM;IACN,YAAY;IACZ,WAAW;IACX,QAAQ;IACR,KAAK;IACL,MAAM;IACN,mBAAmB;IACnB,cAAc;IACd,kBAAkB;IAClB,KAAK;IACL,OAAO;IACP,aAAa;IACb,aAAa;CACd,CAAC,CAAA;AACF;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,GAAG,EAAE,GAAG,EAA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GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;AACnD,CAAC","sourcesContent":["import { readdirSync, statSync } from 'node:fs'\nimport { join, posix } from 'node:path'\nimport { defineRedirects, type BrandlabRedirectTable } from '@brandlab-digital/site-core/redirects'\nimport {\n assertBrandlabAliasHosts,\n resolveBrandlabDeployment,\n type BrandlabDeploymentEnvironment,\n type BrandlabEnvironment,\n type BrandlabSite,\n} from '@brandlab-digital/site-core/site'\nimport {\n BRANDLAB_STATIC_ASSET_CACHE_CONTROL,\n buildBrandlabHeaderRules,\n parseBrandlabStaticAssetCache,\n type BrandlabContentSecurityPolicyExtensions,\n type BrandlabHeader,\n type BrandlabHeaderRule,\n type BrandlabHstsExpansion,\n type BrandlabStaticAssetFolder,\n} from './headers.js'\nimport { defineSiteIcons, ICON_SPRITE_ENV, type SiteIconSet } from './ui-kit/icon-glyphs.js'\nimport { writeIconSprite } from './ui-kit/icon-sprite.js'\n\n/** Next redirect records: 308 stays `permanent: true`, 301 stays `statusCode: 301`. */\nexport type BrandlabNextRedirect = {\n source: string\n destination: string\n has?: { type: 'host'; value: string }[]\n} & ({ permanent: true; statusCode?: never } | { statusCode: 301; permanent?: never })\n\nexport interface BrandlabNextRemotePattern {\n protocol?: 'http' | 'https'\n hostname: string\n port?: string\n pathname?: string\n search?: string\n}\n\n/** The site's own image settings; the output format is always WebP. */\nexport interface BrandlabNextImagesOptions {\n deviceSizes?: readonly number[]\n imageSizes?: readonly number[]\n qualities?: readonly number[]\n minimumCacheTTL?: number\n /**\n * Remote image sources the optimiser may fetch. From 3.3.3 a production build\n * (`next build`, `next start`) refuses an `http` pattern, a pattern without an\n * explicit `https` protocol and a local or private-network host such as `localhost`.\n */\n remotePatterns?: readonly BrandlabNextRemotePattern[]\n /**\n * Sources for `next dev` only, such as `{ protocol: 'http', hostname: 'localhost' }`\n * (3.3.3). They are added to remotePatterns when the build is not a production\n * build and never reach a deployment.\n */\n developmentRemotePatterns?: readonly BrandlabNextRemotePattern[]\n}\n\nexport interface BrandlabNextImagesConfig {\n formats: 'image/webp'[]\n deviceSizes?: number[]\n imageSizes?: number[]\n qualities?: number[]\n minimumCacheTTL?: number\n remotePatterns?: BrandlabNextRemotePattern[]\n}\n\nexport interface BrandlabNextConfig {\n poweredByHeader: false\n /** Trailing slashes are handled by single-hop redirect rules instead. */\n skipTrailingSlashRedirect: true\n env: {\n NEXT_PUBLIC_VERCEL_ENV: BrandlabDeploymentEnvironment\n /** The icon sprite's path (3.14.0), set when `icons` is declared. */\n NEXT_PUBLIC_BL_ICON_SPRITE?: string\n }\n outputFileTracingIncludes: Record<string, string[]>\n images: BrandlabNextImagesConfig\n pageExtensions?: string[]\n headers: () => Promise<BrandlabHeaderRule[]>\n redirects: () => Promise<BrandlabNextRedirect[]>\n}\n\nexport interface BrandlabNextConfigOptions {\n site: BrandlabSite\n /**\n * Hosts that permanently redirect every path to the canonical origin (the\n * `www` host, a Vercel project host, a retired domain). Declared here rather\n * than in the site identity, which client components import, so the list\n * never reaches a browser bundle. Their rules follow any `site.aliasHosts`\n * rules, in order, as the last redirects.\n */\n aliasHosts?: readonly string[]\n /** The src/data/redirects.ts table (defineRedirects). */\n redirects: BrandlabRedirectTable\n images: BrandlabNextImagesOptions\n /** Reviewed CSP origins for declared integrations such as Meta Pixel or map embeds. */\n csp?: BrandlabContentSecurityPolicyExtensions\n hsts?: BrandlabHstsExpansion\n /** Reviewed exception to the default Permissions-Policy that is already live. */\n permissionsPolicy?: string\n /** Reviewed response headers that are already live; protected headers cannot be replaced. */\n extraHeaders?: readonly BrandlabHeader[]\n /**\n * Public folders of static files that never change in place, written as Next\n * sources such as `['/images/:path*', '/fonts/:path*']`. Production builds serve\n * their files (names with an extension) with `public, max-age=31536000, immutable`;\n * Previews keep `private, no-store`. Each folder must exist under `public/`, and\n * no route under `src/app` or `app` may answer below it.\n */\n staticAssetCache?: readonly string[]\n /**\n * The ui-kit icon sprite (3.14.0). When declared, loading the config writes `public/_bl/icons.<hash>.svg` (every\n * library icon plus `site`, the set from `defineSiteIcons`), removes older sprites there and sets\n * `NEXT_PUBLIC_BL_ICON_SPRITE`, so every `Icon` renders a `<use>` into the sprite instead of an inline glyph.\n * Production builds serve the file with `public, max-age=31536000, immutable`. Add `public/_bl/` to `.gitignore`.\n */\n icons?: BrandlabIconsOptions\n /** Defaults to process.env; tests supply a fixed environment. */\n environment?: BrandlabEnvironment\n /** The project root for the staticAssetCache checks and the icon sprite; defaults to process.cwd(). */\n projectRoot?: string\n}\n\nexport interface BrandlabIconsOptions {\n /** The site's own icons, from `defineSiteIcons` (`src/site/icons.ts`). */\n site?: SiteIconSet\n}\n\n/** The sprite's cache rule: content-hashed names only, so a stale name never reaches a page. */\nexport const BRANDLAB_ICON_SPRITE_SOURCE = '/_bl/:file(icons\\\\.[0-9a-f]+\\\\.svg)'\n\n/** Sharp's Linux binaries must travel with the contact route's image sanitiser. */\nexport const BRANDLAB_CONTACT_OUTPUT_FILE_TRACING = Object.freeze({\n '/api/contact': Object.freeze([\n 'node_modules/sharp/**/*',\n 'node_modules/@img/sharp-linux-x64/**/*',\n 'node_modules/@img/sharp-libvips-linux-x64/**/*',\n ]),\n})\n\nconst MDX_PAGE_EXTENSIONS = ['tsx', 'ts', 'jsx', 'js', 'mdx', 'md']\nconst OPTION_KEYS = new Set([\n 'site',\n 'aliasHosts',\n 'redirects',\n 'images',\n 'csp',\n 'hsts',\n 'permissionsPolicy',\n 'extraHeaders',\n 'staticAssetCache',\n 'mdx',\n 'icons',\n 'environment',\n 'projectRoot',\n])\n/**\n * Next's own device widths plus 1440 (3.18.0): a hero on a 1440 px screen gets a 1440 px file instead of a 1920 px one,\n * about 40% fewer bytes (B1). A site's own `images.deviceSizes` replaces the list.\n */\nexport const BRANDLAB_DEFAULT_DEVICE_SIZES = [640, 750, 828, 1080, 1200, 1440, 1920, 2048, 3840] as const\n\nconst IMAGE_KEYS = new Set(['deviceSizes', 'imageSizes', 'qualities', 'minimumCacheTTL', 'remotePatterns', 'developmentRemotePatterns'])\nconst REMOTE_PATTERN_KEYS = new Set(['protocol', 'hostname', 'port', 'pathname', 'search'])\n\nfunction assertKnownKeys(value: object, allowed: ReadonlySet<string>, field: string, hint = '') {\n const unsupported = Object.keys(value).filter((key) => !allowed.has(key))\n if (unsupported.length > 0) {\n throw new Error(`${field} contains unsupported keys: ${unsupported.join(', ')}.${hint}`)\n }\n}\n\nfunction positiveIntegers(values: readonly number[] | undefined, field: string) {\n if (values === undefined) return undefined\n if (\n !Array.isArray(values) ||\n values.length === 0 ||\n values.some((value) => !Number.isSafeInteger(value) || value < 1)\n ) {\n throw new Error(`images.${field} must list positive integers.`)\n }\n return [...values]\n}\n\n/**\n * A host no deployment should fetch images from: loopback (`localhost`, `*.localhost`,\n * 127.0.0.0/8, ::1), unspecified (0.0.0.0, ::), private (10/8, 172.16/12, 192.168/16,\n * fc00::/7), shared (100.64/10) or link-local (169.254/16, fe80::/10), in any spelling a URL\n * reads as one of them, or a wildcard host that admits one (`**`, `10.*.*.*`).\n */\nfunction isLocalImageHost(hostname: string): boolean {\n const host = hostname.trim().toLowerCase().replace(/^\\[(.*)\\]$/, '$1').replace(/\\.$/, '')\n // Other picomatch syntax (?, braces, classes, extglobs) cannot be judged here, so it is refused.\n if (/[?{}[\\]()!@+]/.test(host)) return true\n // A wildcard host is local when it admits a local address: Next matches hostnames with picomatch, whose `*` stops\n // only at a slash, so `*` and `**` both admit `localhost`, and `10.*.*.*` admits 10.0.0.1. Any wildcard address\n // (`192.168.1.*`, `fd12:*`) counts as local.\n if (host.includes('*')) {\n if (/^[\\d.*]+$/.test(host) || host.includes(':')) return true\n const source = host.split(/(\\*\\*|\\*)/).map((part) => (part === '**' ? '.*' : part === '*' ? '[^/]*' : part.replace(/[.+?^$()|{}[\\]\\\\]/g, '\\\\$&'))).join('')\n const glob = new RegExp('^' + source + '$')\n return LOCAL_HOST_SAMPLES.some((sample) => glob.test(sample))\n }\n // The address a URL reads it as: 127.1, 0x7f.0.0.1 and [::ffff:127.0.0.1] all name 127.0.0.1.\n let named = host\n try {\n named = new URL('https://' + (host.includes(':') ? '[' + host + ']' : host)).hostname.replace(/^\\[(.*)\\]$/, '$1')\n } catch {\n // not a host a URL can name: judged as written\n }\n if (named === 'localhost' || named.endsWith('.localhost')) return true\n const hex = named.match(/^(?:0{0,4}:){0,5}:?ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/)\n const dotted = hex ? [parseInt(hex[1]!, 16) >> 8, parseInt(hex[1]!, 16) & 255, parseInt(hex[2]!, 16) >> 8, parseInt(hex[2]!, 16) & 255].join('.') : undefined\n const mapped = named.match(/^(?:0{0,4}:){0,5}:?ffff:(\\d{1,3}(?:\\.\\d{1,3}){3})$/)\n const ipv4 = (dotted ?? mapped?.[1] ?? named).match(/^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/)\n if (ipv4) {\n const [a, b] = [Number(ipv4[1]), Number(ipv4[2])]\n return a === 0 || a === 10 || a === 127 || (a === 169 && b === 254) || (a === 172 && b >= 16 && b <= 31) ||\n (a === 192 && b === 168) || (a === 100 && b >= 64 && b <= 127)\n }\n if (!named.includes(':')) return false\n const groups = named.split(':')\n const allZero = (parts: string[]) => parts.every((part) => /^0*$/.test(part))\n // :: and ::1 in any spelling (0:0:0:0:0:0:0:1), then the private and link-local prefixes.\n if (allZero(groups) || (allZero(groups.slice(0, -1)) && /^0*1$/.test(groups.at(-1) ?? ''))) return true\n return /^f[cd][0-9a-f]{0,2}:/.test(named) || /^fe[89ab][0-9a-f]?:/.test(named)\n}\n\n/** One address in each local range, to judge a wildcard host by. */\nconst LOCAL_HOST_SAMPLES = ['localhost', 'a.localhost', '0.0.0.0', '10.0.0.1', '100.64.0.1', '127.0.0.1', '169.254.169.254', '172.16.0.1', '192.168.0.1', '::1', 'fc00::1', 'fe80::1']\n\nfunction describeRemotePattern(pattern: BrandlabNextRemotePattern): string {\n const path = pattern.pathname === undefined ? '/**' : pattern.pathname.startsWith('/') ? pattern.pathname : `/${pattern.pathname}`\n return `${pattern.protocol ?? 'any protocol'}://${pattern.hostname}${pattern.port ? `:${pattern.port}` : ''}${path}`\n}\n\n/** A validated copy of a remote pattern list: the keys and value types Next reads. */\nfunction remotePatternList(value: unknown, field: string): BrandlabNextRemotePattern[] | undefined {\n if (value === undefined) return undefined\n if (!Array.isArray(value)) throw new Error(`images.${field} must be an array.`)\n return value.map((pattern: unknown, index) => {\n const at = `images.${field}[${index}]`\n if (!pattern || typeof pattern !== 'object' || Array.isArray(pattern)) {\n throw new Error(`${at} must be a { protocol, hostname, port?, pathname?, search? } pattern.`)\n }\n assertKnownKeys(pattern, REMOTE_PATTERN_KEYS, at)\n const record = pattern as Record<string, unknown>\n if (typeof record.hostname !== 'string' || !record.hostname.trim()) throw new Error(`${at}.hostname must name a host.`)\n if (record.protocol !== undefined && record.protocol !== 'https' && record.protocol !== 'http') {\n throw new Error(`${at}.protocol must be 'https' ('http' only in images.developmentRemotePatterns).`)\n }\n for (const key of ['port', 'pathname', 'search'] as const) {\n if (record[key] !== undefined && typeof record[key] !== 'string') throw new Error(`${at}.${key} must be a string.`)\n }\n return { ...(pattern as BrandlabNextRemotePattern) }\n })\n}\n\n/**\n * A production build fetches remote images only over https from a public host:\n * the optimiser fetches a remote pattern's images on any visitor's request\n * (GHSA-cjq9-62q9-8jv4), and an http or local source is a development convenience.\n */\nfunction assertProductionRemotePatterns(patterns: readonly BrandlabNextRemotePattern[]) {\n patterns.forEach((pattern, index) => {\n const problems = [\n ...(pattern.protocol === 'https' ? [] : [pattern.protocol === 'http' ? 'uses http' : \"does not name protocol 'https'\"]),\n ...(isLocalImageHost(pattern.hostname)\n ? [/[*?{}[\\]()!@+]/.test(pattern.hostname) ? `admits local addresses (${pattern.hostname} can match localhost or a private address)` : `names the local address ${pattern.hostname}`]\n : []),\n ]\n if (problems.length === 0) return\n throw new Error(\n `images.remotePatterns[${index}] (${describeRemotePattern(pattern)}) ${problems.join(' and ')}. ` +\n 'A production build only fetches remote images over https from a public host. Remove the pattern, ' +\n 'or move a development-only source to images.developmentRemotePatterns, which only next dev uses.',\n )\n })\n}\n\nfunction buildImagesConfig(images: BrandlabNextImagesOptions, productionBuild: boolean): BrandlabNextImagesConfig {\n if (!images || typeof images !== 'object' || Array.isArray(images)) {\n throw new Error('images must declare the site image settings ({} for Next defaults).')\n }\n assertKnownKeys(images, IMAGE_KEYS, 'images', ' The output format is always image/webp.')\n const deviceSizes = positiveIntegers(images.deviceSizes, 'deviceSizes')\n const imageSizes = positiveIntegers(images.imageSizes, 'imageSizes')\n const qualities = positiveIntegers(images.qualities, 'qualities')\n if (qualities?.some((quality) => quality > 100)) {\n throw new Error('images.qualities must be between 1 and 100.')\n }\n if (\n images.minimumCacheTTL !== undefined &&\n (!Number.isSafeInteger(images.minimumCacheTTL) || images.minimumCacheTTL < 0)\n ) {\n throw new Error('images.minimumCacheTTL must be a non-negative integer of seconds.')\n }\n const remotePatterns = remotePatternList(images.remotePatterns, 'remotePatterns')\n const developmentRemotePatterns = remotePatternList(images.developmentRemotePatterns, 'developmentRemotePatterns')\n if (productionBuild && remotePatterns) assertProductionRemotePatterns(remotePatterns)\n // next dev (and tests) also fetch the development-only sources; a production build never does.\n const served = productionBuild || !developmentRemotePatterns?.length\n ? remotePatterns\n : [...(remotePatterns ?? []), ...developmentRemotePatterns]\n return {\n formats: ['image/webp'],\n deviceSizes: deviceSizes ?? [...BRANDLAB_DEFAULT_DEVICE_SIZES],\n ...(imageSizes ? { imageSizes } : {}),\n ...(qualities ? { qualities } : {}),\n ...(images.minimumCacheTTL !== undefined ? { minimumCacheTTL: images.minimumCacheTTL } : {}),\n ...(served ? { remotePatterns: served } : {}),\n }\n}\n\nconst PAGE_OR_ROUTE_FILE = /^(?:page|route)\\.[A-Za-z0-9]+$/\nconst METADATA_ROUTE_FILE = /^(?:opengraph-image|twitter-image|icon|apple-icon|sitemap|robots|manifest)(?:[\\w.-]*)\\.[A-Za-z0-9]+$/\n\nfunction isDirectory(path: string) {\n try {\n return statSync(path).isDirectory()\n } catch {\n return false\n }\n}\n\n/**\n * The first route file under an app directory that can answer a path strictly\n * below `/<folder>/`. `depth` counts the folder segments matched so far: route\n * groups, intercepts and parallel slots add none, a dynamic segment matches any\n * one, and a catch-all reaches every path below the folder.\n */\nfunction routeBelowFolder(\n directory: string,\n folder: readonly string[],\n depth: number,\n relative: string,\n): string | null {\n for (const entry of readdirSync(directory, { withFileTypes: true })) {\n const name = entry.name\n if (name.startsWith('_') || name.startsWith('.') || name === 'node_modules') continue\n const path = join(directory, name)\n const nextRelative = posix.join(relative, name)\n if (entry.isFile()) {\n // Page and route files serve their own directory; metadata files serve a path below it.\n const below = depth > folder.length && PAGE_OR_ROUTE_FILE.test(name)\n const metadata = depth >= folder.length && METADATA_ROUTE_FILE.test(name)\n if (below || metadata) return nextRelative\n continue\n }\n if (!entry.isDirectory()) continue\n let next: number | null = null\n if (name.startsWith('(') || name.startsWith('@')) next = depth\n else if (/^\\[\\[?\\.\\.\\./.test(name)) next = folder.length + 1\n else if (depth >= folder.length || name.startsWith('[') || name === folder[depth]) next = depth + 1\n if (next === null) continue\n const found = routeBelowFolder(path, folder, next, nextRelative)\n if (found) return found\n }\n return null\n}\n\n/** Each declared folder exists under public/ and no app route answers below it. */\nfunction assertStaticAssetFolders(folders: readonly BrandlabStaticAssetFolder[], root: string) {\n for (const { source, folder } of folders) {\n const publicFolder = posix.join('public', ...folder)\n if (!isDirectory(join(root, publicFolder))) {\n throw new Error(`staticAssetCache \"${source}\": ${publicFolder} is not a folder of static files in ${root}.`)\n }\n for (const appDirectory of ['src/app', 'app']) {\n if (!isDirectory(join(root, appDirectory))) continue\n const route = routeBelowFolder(join(root, appDirectory), folder, 0, appDirectory)\n if (route) {\n throw new Error(\n `staticAssetCache \"${source}\": ${route} answers below /${folder.join('/')}, so immutable caching could reach a page or route.`,\n )\n }\n }\n }\n}\n\n/** A site icon set, checked again here: the config may be handed an object that never went through defineSiteIcons. */\nfunction siteIconSet(site: unknown): SiteIconSet | undefined {\n if (site === undefined) return undefined\n const set = site as Partial<SiteIconSet>\n if (!set || typeof set !== 'object' || !Array.isArray(set.names) || !set.glyphs || typeof set.glyphs !== 'object') {\n throw new Error('icons.site must come from defineSiteIcons.')\n }\n return defineSiteIcons(Object.fromEntries(set.names.map((name) => [name, set.glyphs![name]!])))\n}\n\n/**\n * Converts the redirect table to Next redirects: each entry keeps its 301 or\n * 308 status (Next forwards the query string), gains a single-hop\n * trailing-slash variant, then one trailing-slash rule and one permanent\n * canonical-host rule per alias host follow. There is no x-forwarded-proto\n * rule: Vercel's edge already enforces HTTPS.\n */\nexport function buildBrandlabRedirects(options: {\n site: BrandlabSite\n redirects: BrandlabRedirectTable\n /** next.config's alias hosts, after the site identity's own (3.2.1). */\n aliasHosts?: readonly string[]\n}): BrandlabNextRedirect[] {\n const aliasHosts = brandlabAliasHosts(options.site, options.aliasHosts)\n const table = defineRedirects(options.redirects)\n const entries = table.flatMap((redirect): BrandlabNextRedirect[] => {\n const status = redirect.status === 301\n ? { statusCode: 301 as const }\n : { permanent: true as const }\n const has = redirect.host ? { has: [{ type: 'host' as const, value: redirect.host }] } : {}\n const record = (source: string): BrandlabNextRedirect => ({\n source,\n destination: redirect.destination,\n ...status,\n ...has,\n })\n return redirect.source === '/'\n ? [record(redirect.source)]\n : [record(redirect.source), record(`${redirect.source}/`)]\n })\n return [\n ...entries,\n { source: '/:path+/', destination: '/:path+', permanent: true },\n ...aliasHosts.map((host): BrandlabNextRedirect => ({\n source: '/:path*',\n has: [{ type: 'host', value: host }],\n destination: `${options.site.canonicalUrl}/:path*`,\n permanent: true,\n })),\n ]\n}\n\n/**\n * Every alias host: the site identity's (the 3.0–3.2.0 place) then next.config's\n * (3.2.1), validated together so a host is never declared twice.\n */\nexport function brandlabAliasHosts(site: BrandlabSite, aliasHosts: readonly string[] | undefined): readonly string[] {\n if (aliasHosts === undefined) return site.aliasHosts\n assertBrandlabAliasHosts(aliasHosts, site.canonicalHost ?? new URL(site.canonicalUrl).hostname, 'next.config aliasHosts')\n const all = [...site.aliasHosts, ...aliasHosts]\n const duplicate = all.find((host, index) => all.indexOf(host) !== index)\n if (duplicate) throw new Error(`Alias host \"${duplicate}\" is declared in both the site identity and next.config aliasHosts.`)\n return all\n}\n\n/**\n * The whole next.config.ts after its first line\n * `import '@brandlab-digital/site-next/image-runtime'`:\n * `export default defineBrandlabNextConfig({ site, redirects, images })`.\n *\n * Sets poweredByHeader: false, WebP image output, Sharp output tracing for\n * /api/contact, NEXT_PUBLIC_VERCEL_ENV for browser gates, the deployment's\n * header rules (with immutable caching for the declared static public folders on\n * production builds) and the redirect table. Validation runs when the config\n * loads, so an invalid table, header exception or static folder fails the build,\n * as does (3.3.3) a production build's http or local image remote pattern.\n */\nexport function defineBrandlabNextConfig(\n options: BrandlabNextConfigOptions & { mdx?: undefined },\n): BrandlabNextConfig\nexport function defineBrandlabNextConfig<Wrapped>(\n options: BrandlabNextConfigOptions & {\n /** The @next/mdx wrapper: createMDX({ options: { remarkPlugins: ['remark-gfm'] } }). */\n mdx: (config: BrandlabNextConfig) => Wrapped\n },\n): Wrapped\nexport function defineBrandlabNextConfig(\n options: BrandlabNextConfigOptions & { mdx?: (config: BrandlabNextConfig) => unknown },\n): unknown {\n if (!options || typeof options !== 'object') {\n throw new TypeError('defineBrandlabNextConfig requires the site, redirects and images.')\n }\n assertKnownKeys(options, OPTION_KEYS, 'next.config options')\n if (!options.site?.canonicalUrl || !Array.isArray(options.site.aliasHosts)) {\n throw new Error('site must come from defineBrandlabSite.')\n }\n if (options.mdx !== undefined && typeof options.mdx !== 'function') {\n throw new TypeError('mdx must be the @next/mdx config wrapper.')\n }\n const deployment = resolveBrandlabDeployment(options.environment ?? process.env)\n if (options.staticAssetCache !== undefined) {\n assertStaticAssetFolders(\n parseBrandlabStaticAssetCache(options.staticAssetCache),\n options.projectRoot ?? process.cwd(),\n )\n }\n const headerRules = buildBrandlabHeaderRules({\n deployment,\n canonicalHost: options.site.canonicalHost ?? new URL(options.site.canonicalUrl).hostname,\n ...(options.csp ? { contentSecurityPolicyExtensions: options.csp } : {}),\n ...(options.hsts ? { hsts: options.hsts } : {}),\n ...(options.permissionsPolicy ? { permissionsPolicy: options.permissionsPolicy } : {}),\n ...(options.extraHeaders ? { extraHeaders: options.extraHeaders } : {}),\n ...(options.staticAssetCache ? { staticAssetCache: options.staticAssetCache } : {}),\n })\n if (options.icons !== undefined) {\n if (!options.icons || typeof options.icons !== 'object' || Array.isArray(options.icons)) {\n throw new Error('icons must be { site?: defineSiteIcons(...) } ({} for the library icons only).')\n }\n assertKnownKeys(options.icons, new Set(['site']), 'icons')\n }\n const sprite = options.icons === undefined ? undefined : writeIconSprite(options.projectRoot ?? process.cwd(), siteIconSet(options.icons.site))\n // The same production-only rule as staticAssetCache: Previews keep private, no-store.\n if (sprite && deployment.productionBuild && deployment.environment !== 'preview') {\n // After the static folders, before the non-canonical host rule.\n const at = headerRules.findIndex((rule) => rule.missing !== undefined)\n headerRules.splice(at === -1 ? headerRules.length : at, 0, {\n source: BRANDLAB_ICON_SPRITE_SOURCE,\n headers: [{ key: 'Cache-Control', value: BRANDLAB_STATIC_ASSET_CACHE_CONTROL }],\n })\n }\n const redirects = buildBrandlabRedirects({\n site: options.site,\n redirects: options.redirects,\n ...(options.aliasHosts !== undefined ? { aliasHosts: options.aliasHosts } : {}),\n })\n\n const config: BrandlabNextConfig = {\n poweredByHeader: false,\n skipTrailingSlashRedirect: true,\n env: {\n NEXT_PUBLIC_VERCEL_ENV: deployment.environment,\n ...(sprite ? { [ICON_SPRITE_ENV]: sprite.href } : {}),\n },\n outputFileTracingIncludes: Object.fromEntries(\n Object.entries(BRANDLAB_CONTACT_OUTPUT_FILE_TRACING).map(([route, globs]) => [route, [...globs]]),\n ),\n // A Vercel build (preview or production) is checked like any production build, whatever NODE_ENV says.\n images: buildImagesConfig(options.images, deployment.productionBuild || deployment.environment !== 'development'),\n ...(options.mdx ? { pageExtensions: [...MDX_PAGE_EXTENSIONS] } : {}),\n headers: async () =>\n headerRules.map((rule) => ({\n source: rule.source,\n ...(rule.missing ? { missing: rule.missing.map((condition) => ({ ...condition })) } : {}),\n headers: rule.headers.map((header) => ({ ...header })),\n })),\n redirects: async () =>\n redirects.map((redirect) => ({\n ...redirect,\n ...(redirect.has ? { has: redirect.has.map((condition) => ({ ...condition })) } : {}),\n })),\n }\n return options.mdx ? options.mdx(config) : config\n}\n"]}
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* the site's copy. Errors appear only after a submit attempt, as a summary plus a message under each field; every
|
|
9
9
|
* typed value and chosen photo is kept on any error. The button stays disabled until the page has hydrated and is
|
|
10
10
|
* locked with a busy label while photos are prepared or the enquiry sends. An accepted enquiry sends one
|
|
11
|
-
* `contact_form` (with `has_photos`) and opens the thank-you page.
|
|
11
|
+
* `contact_form` (with `has_photos`) and opens the thank-you page once Google's tag can send it (3.18.0). A submit the
|
|
12
|
+
* form's own checks stop sends `lead_form_error` (stage `validation`, the first failing field).
|
|
12
13
|
*
|
|
13
14
|
* `contract` and `analytics` can't cross from a server component, so a site binds them once with `createQuoteForm`
|
|
14
15
|
* in its own `'use client'` file and renders the bound `QuoteForm` and `QuoteDialog` from its pages.
|
|
@@ -107,7 +108,10 @@ export interface QuoteFormProps extends QuoteFormSkin {
|
|
|
107
108
|
readonly honeypotField?: string | undefined;
|
|
108
109
|
/** The contact endpoint (default `/api/contact`). */
|
|
109
110
|
readonly contactEndpoint?: string | undefined;
|
|
110
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* Client navigation to the thank-you page, for example `router.push`. By default a full page load once Google's tag
|
|
113
|
+
* has sent the enquiry's hits (`navigateAfterGoogleTag`, 3.18.0; at most 8 s).
|
|
114
|
+
*/
|
|
111
115
|
readonly navigate?: ((href: string) => void) | undefined;
|
|
112
116
|
/** Test seams: a fetch implementation and the photo preparation's options. */
|
|
113
117
|
readonly fetcher?: typeof fetch | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quote-form.d.ts","sourceRoot":"","sources":["../../../src/ui-kit/form/quote-form.tsx"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"quote-form.d.ts","sourceRoot":"","sources":["../../../src/ui-kit/form/quote-form.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC7B,MAAM,qCAAqC,CAAA;AAE5C,OAAO,EAA6B,KAAK,GAAG,EAAkB,MAAM,OAAO,CAAA;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EACV,oCAAoC,EACpC,oCAAoC,EACrC,MAAM,qCAAqC,CAAA;AAO5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAGjD,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAErE,eAAO,MAAM,mBAAmB,sCAAuC,CAAA;AACvE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEnE,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,6DAA8D,CAAA;AAChG,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvE,wHAAwH;AACxH,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAKhG,CAAA;AAED,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,KAAK,GACL,OAAO,GACP,OAAO,GACP,OAAO,GACP,UAAU,GACV,MAAM,GACN,UAAU,GACV,SAAS,GACT,QAAQ,GACR,OAAO,GACP,OA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as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
10
10
|
* the site's copy. Errors appear only after a submit attempt, as a summary plus a message under each field; every
|
|
11
11
|
* typed value and chosen photo is kept on any error. The button stays disabled until the page has hydrated and is
|
|
12
12
|
* locked with a busy label while photos are prepared or the enquiry sends. An accepted enquiry sends one
|
|
13
|
-
* `contact_form` (with `has_photos`) and opens the thank-you page.
|
|
13
|
+
* `contact_form` (with `has_photos`) and opens the thank-you page once Google's tag can send it (3.18.0). A submit the
|
|
14
|
+
* form's own checks stop sends `lead_form_error` (stage `validation`, the first failing field).
|
|
14
15
|
*
|
|
15
16
|
* `contract` and `analytics` can't cross from a server component, so a site binds them once with `createQuoteForm`
|
|
16
17
|
* in its own `'use client'` file and renders the bound `QuoteForm` and `QuoteDialog` from its pages.
|
|
@@ -19,6 +20,7 @@ import { defineContactContract, isValidAustralianPhoneNumber, } from '@brandlab-
|
|
|
19
20
|
import { usePathname } from 'next/navigation';
|
|
20
21
|
import { useMemo, useRef, useState } from 'react';
|
|
21
22
|
import { contactFieldProps, useBrandlabContactForm } from '../../contact/form-client.js';
|
|
23
|
+
import { navigateAfterGoogleTag } from '../../contact/google-tag-navigate.js';
|
|
22
24
|
import { CONTACT_FORM_FIELDS, CONTACT_PHONE_CHARACTERS } from '../../contact/shared.js';
|
|
23
25
|
import { HeadlessErrorSummary } from '../../ui.js';
|
|
24
26
|
import { HeadlessErrorFocus } from '../../ui-client.js';
|
|
@@ -163,7 +165,7 @@ export function QuoteForm({ formId, contract, analytics, attachmentPolicy, redir
|
|
|
163
165
|
formId,
|
|
164
166
|
redirectTo,
|
|
165
167
|
redirectDelayMs: 0,
|
|
166
|
-
|
|
168
|
+
navigate: navigate ?? navigateAfterGoogleTag,
|
|
167
169
|
...(contactEndpoint ? { contactEndpoint } : {}),
|
|
168
170
|
...(fetcher ? { fetcher } : {}),
|
|
169
171
|
attachments: { ...attachmentOptions, ...(attachmentPolicy ? { policy: attachmentPolicy } : {}) },
|
|
@@ -172,7 +174,8 @@ export function QuoteForm({ formId, contract, analytics, attachmentPolicy, redir
|
|
|
172
174
|
setAttempt((count) => count + 1);
|
|
173
175
|
if (Object.keys(errors).length > 0) {
|
|
174
176
|
setClientErrors(errors);
|
|
175
|
-
|
|
177
|
+
// Nothing is sent; lead_form_error reports the failed checks, in the order of the fields (3.18.0).
|
|
178
|
+
return { invalidFields: Object.keys(errors) };
|
|
176
179
|
}
|
|
177
180
|
setClientErrors(null);
|
|
178
181
|
setWithPhotos(photoCount.current > 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quote-form.js","sourceRoot":"","sources":["../../../src/ui-kit/form/quote-form.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,qBAAqB,EACrB,4BAA4B,GAG7B,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAA4B,MAAM,OAAO,CAAA;AAM3E,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AACxF,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAA;AAErE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAM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AAG,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;QAClF,OAAO,CACL,KAAC,SAAS,OACJ,MAAM,EACV,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAC/E,OAAO,EAAE,IAAI,EAAE,OAAO,EACtB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,IAAI,EAAE,OAAO,GACtB,CACH,CAAA;IACH,CAAC;IAED,SAAS,gBAAgB,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,kBAAkB,EAAyB;QACnG,OAAO,CACL,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,YAC7E,KAAC,cAAc,IACb,MAAM,EAAC,cAAc,KACjB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAChC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACtD,GACU,CACf,CAAA;IACH,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC,CAAA;AACpF,CAAC","sourcesContent":["'use client'\n\n/**\n * `QuoteForm`: the one enquiry form for the hero, the quote dialog, the contact page and cost guides, on the shared\n * contact runtime (`useBrandlabContactForm`, `POST /api/contact`, photo preparation, idempotent retries).\n *\n * Locked layout (F8): Name · Suburb; Phone · Email, both required; the message (\"How can we help?\"), 5 rows; the\n * \"Add photos\" drop box with its \"0 of 5\" counter; the button; then one consent line linking the privacy policy. One\n * column below 640 px. No job select, no \"(required)\", no helper or reassurance lines: every label and message is\n * the site's copy. Errors appear only after a submit attempt, as a summary plus a message under each field; every\n * typed value and chosen photo is kept on any error. The button stays disabled until the page has hydrated and is\n * locked with a busy label while photos are prepared or the enquiry sends. An accepted enquiry sends one\n * `contact_form` (with `has_photos`) and opens the thank-you page.\n *\n * `contract` and `analytics` can't cross from a server component, so a site binds them once with `createQuoteForm`\n * in its own `'use client'` file and renders the bound `QuoteForm` and `QuoteDialog` from its pages.\n */\nimport {\n defineContactContract,\n isValidAustralianPhoneNumber,\n type BrandlabContactContract,\n type ContactAttachmentPolicy,\n} from '@brandlab-digital/site-core/contact'\nimport { usePathname } from 'next/navigation'\nimport { useMemo, useRef, useState, type JSX, type RefObject } from 'react'\nimport type { BrandlabAnalytics } from '../../analytics.js'\nimport type {\n BrandlabContactAttachmentErrorReason,\n UseBrandlabContactAttachmentsOptions,\n} from '../../contact/attachments-client.js'\nimport { contactFieldProps, useBrandlabContactForm } from '../../contact/form-client.js'\nimport { CONTACT_FORM_FIELDS, CONTACT_PHONE_CHARACTERS } from '../../contact/shared.js'\nimport { HeadlessErrorSummary } from '../../ui.js'\nimport { HeadlessErrorFocus } from '../../ui-client.js'\nimport { TextLink } from '../primitives/links.js'\nimport type { RepeatedSlotOf } from '../repeated-slots.js'\nimport { slot, type SkinEntry } from '../skin.js'\nimport { Field } from './field.js'\nimport { PhotoUpload } from './photo-upload.js'\nimport { QuoteDialog, type QuoteDialogSkin } from './quote-dialog.js'\n\nexport const QUOTE_FORM_VARIANTS = ['card', 'plain', 'inline'] as const\nexport type QuoteFormVariant = (typeof QUOTE_FORM_VARIANTS)[number]\n\n/** The form's id and its lead diagnostics' `form_id`, one per placement. */\nexport const QUOTE_FORM_PLACEMENTS = ['quote-hero', 'quote-dialog', 'contact', 'guide'] as const\nexport type QuoteFormPlacement = (typeof QUOTE_FORM_PLACEMENTS)[number]\n\n/** The variant each placement takes unless the skin names one: the hero aside, the dialog and contact page, a guide. */\nexport const QUOTE_FORM_PLACEMENT_VARIANTS: Readonly<Record<QuoteFormPlacement, QuoteFormVariant>> = {\n 'quote-hero': 'card',\n 'quote-dialog': 'plain',\n contact: 'plain',\n guide: 'inline',\n}\n\nexport type QuoteFormSlot =\n | 'root'\n | 'row'\n | 'field'\n | 'label'\n | 'input'\n | 'textarea'\n | 'drop'\n | 'dropIcon'\n | 'counter'\n | 'photos'\n | 'photo'\n | 'thumb'\n | 'remove'\n | 'submit'\n | 'consent'\n | 'errorSummary'\n | 'error'\n | 'status'\n/** Labels always sit above their fields; density sets the spacing. */\nexport interface QuoteFormLayout {\n readonly density?: 'comfortable' | 'compact'\n}\n/** The photo boxes, rendered once per chosen photo: styled from the skin stylesheet, never by class (3.14.0). */\nexport type QuoteFormRepeatedSlot = RepeatedSlotOf<'quoteForm'>\nexport type QuoteFormSkin = SkinEntry<QuoteFormSlot, QuoteFormVariant, QuoteFormLayout, QuoteFormRepeatedSlot>\n\n/** Every visible phrase of the form, in the site's Australian English. */\nexport interface QuoteFormCopy {\n readonly labels: {\n readonly name: string\n readonly suburb: string\n readonly phone: string\n readonly email: string\n /** For example \"How can we help?\". */\n readonly message: string\n /** For example \"Add photos\". */\n readonly photos: string\n }\n /** The message placeholder, for example \"Tell us about your project\". */\n readonly messagePlaceholder: string\n /** The site's recorded button label, for example \"Get my free quote\". */\n readonly submit: string\n /** Busy labels: \"Sending…\", \"Sending photos…\" and \"Preparing photos…\". */\n readonly sending: string\n readonly sendingPhotos: string\n readonly preparingPhotos: string\n /** The photo counter with `{count}` and `{max}`, for example \"{count} of {max}\". */\n readonly photoCount: string\n /** Each remove button's name with `{number}`, for example \"Remove photo {number}\". */\n readonly removePhoto: string\n /** The one consent line: the sentence, the words in it that link, and the privacy policy's path. */\n readonly consent: { readonly sentence: string; readonly linkText: string; readonly href: string }\n /** The error summary's heading, for example \"Please check these details\". */\n readonly errorSummary: string\n /** A message under each field after a submit attempt. `photos` is needed only when photos are required. */\n readonly errors: {\n readonly name: string\n readonly suburb: string\n readonly phone: string\n readonly phoneFormat: string\n readonly email: string\n readonly emailFormat: string\n readonly message: string\n readonly photos?: string\n }\n /**\n * Why a chosen photo was refused: not an image type, too large, all photos together too large, more than the\n * limit (`{max}` allowed), or it couldn't be prepared (an iPhone photo that wouldn't convert). Needed when the\n * contract takes photos.\n */\n readonly photoErrors?: Readonly<Record<BrandlabContactAttachmentErrorReason, string>>\n /** Shown when sending fails: the photos were refused, or anything else (say how to call instead). */\n readonly failed: { readonly attachment: string; readonly general: string }\n}\n\nexport interface QuoteFormProps extends QuoteFormSkin {\n readonly formId: QuoteFormPlacement\n /** The contact contract from src/config/contact.ts. */\n readonly contract: BrandlabContactContract\n /** The site's defineBrandlabAnalytics binding. */\n readonly analytics?: BrandlabAnalytics | undefined\n /** Photo limits; the contract's attachment mode decides the default. */\n readonly attachmentPolicy?: ContactAttachmentPolicy | undefined\n /** The thank-you page opened after an accepted enquiry, for example `/thank-you`. */\n readonly redirectTo: string\n readonly copy: QuoteFormCopy\n /** The enquiry email's page row, for example \"Contact\". */\n readonly pageLabel?: string | undefined\n /** The runtime's honeypot field (default `website`). */\n readonly honeypotField?: string | undefined\n /** The contact endpoint (default `/api/contact`). */\n readonly contactEndpoint?: string | undefined\n /** Client navigation to the thank-you page, for example `router.push`; a full page load by default. */\n readonly navigate?: ((href: string) => void) | undefined\n /** Test seams: a fetch implementation and the photo preparation's options. */\n readonly fetcher?: typeof fetch | undefined\n readonly attachmentOptions?: Omit<UseBrandlabContactAttachmentsOptions, 'policy'> | undefined\n}\n\nconst EMAIL_PATTERN = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\nconst PHOTOS = 'photos'\n\ninterface QuoteFields {\n readonly name: string\n /** The suburb: always required when the contract has one, as the server requires every location field. */\n readonly location: string | undefined\n readonly phone: string\n readonly email: string\n readonly message: string\n readonly maxLength: Readonly<Record<string, number | undefined>>\n}\n\n/**\n * The contract's keys for the locked layout. A required field the form can't render would make every enquiry fail,\n * so it throws instead, when the site binds the form (at build).\n */\nfunction quoteFields(contract: BrandlabContactContract): QuoteFields {\n defineContactContract(contract)\n const role = (name: string) => contract.fields.find((field) => field.role === name)\n const location = role('location')\n if (location && location.kind !== 'text') {\n throw new Error(`QuoteForm renders the suburb as a text field; the contract's \"${location.key}\" is a ${location.kind}.`)\n }\n const unrendered = contract.fields.find((field) => field.role === 'custom' && field.required)\n if (unrendered) {\n throw new Error(`QuoteForm has no place for the required field \"${unrendered.key}\"; make it optional or drop it.`)\n }\n return {\n name: role('name')!.key,\n location: location?.key,\n phone: role('phone')!.key,\n email: role('email')!.key,\n message: role('message')!.key,\n maxLength: Object.fromEntries(contract.fields.map((field) => [field.key, field.maxLength])),\n }\n}\n\nconst PHOTO_ERROR_REASONS = ['type', 'size', 'total', 'count', 'prepare'] as const\n\nfunction assertCopy(copy: QuoteFormCopy, photos: 'none' | 'optional' | 'required') {\n const text = [\n ...Object.values(copy.labels),\n copy.messagePlaceholder,\n copy.submit,\n copy.sending,\n copy.sendingPhotos,\n copy.preparingPhotos,\n copy.photoCount,\n copy.removePhoto,\n copy.consent.sentence,\n copy.consent.linkText,\n copy.consent.href,\n copy.errorSummary,\n copy.errors.name,\n copy.errors.suburb,\n copy.errors.phone,\n copy.errors.phoneFormat,\n copy.errors.email,\n copy.errors.emailFormat,\n copy.errors.message,\n copy.failed.attachment,\n copy.failed.general,\n ...(photos === 'none' ? [] : PHOTO_ERROR_REASONS.map((reason) => copy.photoErrors?.[reason])),\n ...(photos === 'required' ? [copy.errors.photos] : []),\n ]\n if (text.some((value) => typeof value !== 'string' || !value.trim())) {\n throw new Error('QuoteForm copy is incomplete: every label, message and the consent line is the site\\'s own text.')\n }\n}\n\n/** The checks the server makes, run before sending: never stricter than the server, so no real enquiry is blocked. */\nfunction validate(\n form: HTMLFormElement,\n fields: QuoteFields,\n copy: QuoteFormCopy,\n photos: { required: boolean; count: number },\n): Record<string, string> {\n const value = (name: string) => {\n const element = form.elements.namedItem(name)\n return element && 'value' in element ? String(element.value).trim() : ''\n }\n const errors: Record<string, string> = {}\n if (!value(fields.name)) errors[fields.name] = copy.errors.name\n if (fields.location && !value(fields.location)) errors[fields.location] = copy.errors.suburb\n const phone = value(fields.phone)\n if (!phone) errors[fields.phone] = copy.errors.phone\n else if (!CONTACT_PHONE_CHARACTERS.test(phone) || !isValidAustralianPhoneNumber(phone)) {\n errors[fields.phone] = copy.errors.phoneFormat\n }\n const email = value(fields.email).toLowerCase()\n if (!email) errors[fields.email] = copy.errors.email\n else if (!EMAIL_PATTERN.test(email)) errors[fields.email] = copy.errors.emailFormat\n if (!value(fields.message)) errors[fields.message] = copy.errors.message\n if (photos.required && photos.count === 0 && copy.errors.photos) errors[PHOTOS] = copy.errors.photos\n return errors\n}\n\n/**\n * The site's message for a field the server refused: the runtime's own wording never shows. An empty field gets its\n * \"enter\" message; a filled phone or email its format message.\n */\nfunction serverFieldMessage(form: HTMLFormElement | null, key: string, fields: QuoteFields, copy: QuoteFormCopy) {\n const element = form?.elements.namedItem(key)\n const filled = Boolean(element && 'value' in element && String(element.value).trim())\n if (key === fields.phone) return filled ? copy.errors.phoneFormat : copy.errors.phone\n if (key === fields.email) return filled ? copy.errors.emailFormat : copy.errors.email\n if (key === fields.name) return copy.errors.name\n if (key === fields.location) return copy.errors.suburb\n return copy.errors.message\n}\n\nfunction ConsentLine({ consent, hooks }: { consent: QuoteFormCopy['consent']; hooks: ReturnType<typeof slot> }) {\n const at = consent.sentence.indexOf(consent.linkText)\n const link = <TextLink href={consent.href}>{at < 0 ? consent.sentence : consent.linkText}</TextLink>\n return (\n <p {...hooks}>\n {at < 0 ? link : (\n <>\n {consent.sentence.slice(0, at)}\n {link}\n {consent.sentence.slice(at + consent.linkText.length)}\n </>\n )}\n </p>\n )\n}\n\nexport function QuoteForm({\n formId,\n contract,\n analytics,\n attachmentPolicy,\n redirectTo,\n copy,\n pageLabel,\n honeypotField = CONTACT_FORM_FIELDS.honeypot,\n contactEndpoint,\n navigate,\n fetcher,\n attachmentOptions,\n variant,\n layout,\n classes,\n}: QuoteFormProps) {\n const fields = useMemo(() => quoteFields(contract), [contract])\n const mode = contract.attachments.mode\n const photosEnabled = mode !== 'none'\n const photosRequired = mode === 'images-required'\n assertCopy(copy, photosRequired ? 'required' : photosEnabled ? 'optional' : 'none')\n const pagePath = usePathname() || '/'\n const [clientErrors, setClientErrors] = useState<Record<string, string> | null>(null)\n const [attempt, setAttempt] = useState(0)\n const [withPhotos, setWithPhotos] = useState(false)\n const photoCount = useRef(0)\n\n const form = useBrandlabContactForm({\n contract,\n ...(analytics ? { analytics } : {}),\n pagePath,\n ...(pageLabel ? { pageLabel } : {}),\n formId,\n redirectTo,\n redirectDelayMs: 0,\n ...(navigate ? { navigate } : {}),\n ...(contactEndpoint ? { contactEndpoint } : {}),\n ...(fetcher ? { fetcher } : {}),\n attachments: { ...attachmentOptions, ...(attachmentPolicy ? { policy: attachmentPolicy } : {}) },\n onSubmitStart: ({ form: element }) => {\n const errors = validate(element, fields, copy, { required: photosRequired, count: photoCount.current })\n setAttempt((count) => count + 1)\n if (Object.keys(errors).length > 0) {\n setClientErrors(errors)\n return false\n }\n setClientErrors(null)\n setWithPhotos(photoCount.current > 0)\n return undefined\n },\n })\n photoCount.current = form.attachments.images.length\n\n const fieldId = (key: string) => `${formId}-${key}`\n const order = [fields.name, fields.location, fields.phone, fields.email, fields.message, photosEnabled ? PHOTOS : undefined]\n .filter((key): key is string => Boolean(key))\n const errors: Record<string, string> = clientErrors ?? Object.fromEntries(\n order.flatMap((key) =>\n key !== PHOTOS && form.fieldError(key) ? [[key, serverFieldMessage(form.formProps.ref.current, key, fields, copy)]] : []),\n )\n const summary = order.flatMap((key) => (errors[key] ? [{ fieldId: fieldId(key), message: errors[key] }] : []))\n\n const leaving = form.succeeded\n const busyLabel = form.attachments.isProcessing\n ? copy.preparingPhotos\n : form.pending || leaving\n ? withPhotos ? copy.sendingPhotos : copy.sending\n : undefined\n const result = form.result\n const failure = !busyLabel && clientErrors === null && result && !result.ok && summary.length === 0\n ? result.code === 'attachment_rejected' ? copy.failed.attachment : copy.failed.general\n : undefined\n\n const fieldClasses = { field: classes?.field, label: classes?.label, error: classes?.error }\n const max = (key: string) => fields.maxLength[key]\n const textField = (key: string, label: string, props: { type: 'text' | 'tel' | 'email'; autoComplete: string }) => (\n <Field id={fieldId(key)} label={label} error={errors[key]} required classes={fieldClasses}>\n {(control) => (\n <input\n {...contactFieldProps(form, key)}\n {...control}\n {...slot(classes, 'input')}\n type={props.type}\n autoComplete={props.autoComplete}\n {...(props.type === 'tel' ? { inputMode: 'tel' as const } : { maxLength: max(key) })}\n {...(props.type === 'email' ? { autoCapitalize: 'none', spellCheck: false } : {})}\n />\n )}\n </Field>\n )\n\n return (\n <form\n {...form.formProps}\n noValidate\n data-bl=\"quote-form\"\n data-variant={variant ?? QUOTE_FORM_PLACEMENT_VARIANTS[formId]}\n data-density={layout?.density ?? 'comfortable'}\n className={classes?.root}\n >\n <HeadlessErrorSummary\n {...slot(classes, 'errorSummary')}\n id={`${formId}-errors`}\n headingId={`${formId}-errors-heading`}\n heading={copy.errorSummary}\n errors={summary}\n />\n <HeadlessErrorFocus key={attempt} active={summary.length > 0} formId={formId} summaryId={`${formId}-errors`} />\n <div data-bl-honeypot=\"\" data-bl-visually-hidden=\"\" aria-hidden=\"true\" inert>\n <input type=\"text\" name={honeypotField} tabIndex={-1} autoComplete=\"off\" />\n </div>\n\n <div {...slot(classes, 'row')}>\n {textField(fields.name, copy.labels.name, { type: 'text', autoComplete: 'name' })}\n {fields.location ? (\n <Field id={fieldId(fields.location)} label={copy.labels.suburb} error={errors[fields.location]} required classes={fieldClasses}>\n {(control) => (\n <input\n {...contactFieldProps(form, fields.location!)}\n {...control}\n {...slot(classes, 'input')}\n type=\"text\"\n autoComplete=\"address-level2\"\n maxLength={max(fields.location!)}\n />\n )}\n </Field>\n ) : null}\n </div>\n <div {...slot(classes, 'row')}>\n {textField(fields.phone, copy.labels.phone, { type: 'tel', autoComplete: 'tel' })}\n {textField(fields.email, copy.labels.email, { type: 'email', autoComplete: 'email' })}\n </div>\n <Field id={fieldId(fields.message)} label={copy.labels.message} error={errors[fields.message]} required classes={fieldClasses}>\n {(control) => (\n <textarea\n {...contactFieldProps(form, fields.message)}\n {...control}\n {...slot(classes, 'textarea')}\n rows={5}\n placeholder={copy.messagePlaceholder}\n maxLength={max(fields.message)}\n />\n )}\n </Field>\n {photosEnabled ? (\n <PhotoUpload\n id={fieldId(PHOTOS)}\n label={copy.labels.photos}\n attachments={form.attachments}\n counter={copy.photoCount}\n removeLabel={copy.removePhoto}\n errorMessages={copy.photoErrors}\n accept={mode === 'images-and-pdfs-optional' ? 'image/*,application/pdf' : 'image/*'}\n error={errors[PHOTOS]}\n required={photosRequired}\n disabled={form.pending || leaving}\n classes={classes}\n />\n ) : null}\n\n <button\n {...form.submitProps}\n {...slot(classes, 'submit')}\n disabled={form.submitDisabled || leaving}\n data-state={busyLabel ? 'busy' : 'idle'}\n >\n {busyLabel ?? copy.submit}\n </button>\n <ConsentLine consent={copy.consent} hooks={slot(classes, 'consent')} />\n <div\n {...slot(classes, 'status')}\n ref={form.statusRef as RefObject<HTMLDivElement>}\n role=\"status\"\n aria-live=\"polite\"\n tabIndex={-1}\n data-state={failure ? 'error' : busyLabel ? 'busy' : 'idle'}\n >\n {failure ?? (busyLabel ? <span data-bl-visually-hidden=\"\">{busyLabel}</span> : null)}\n </div>\n </form>\n )\n}\n\nexport interface CreateQuoteFormOptions {\n readonly contract: BrandlabContactContract\n readonly analytics?: BrandlabAnalytics | undefined\n readonly attachmentPolicy?: ContactAttachmentPolicy | undefined\n /** The thank-you page, for example `/thank-you`. */\n readonly redirectTo: string\n readonly copy: QuoteFormCopy\n /** The site's quote form skin; leave `variant` unset so each placement takes its own. */\n readonly skin?: QuoteFormSkin | undefined\n /** The quote dialog's skin. */\n readonly dialogSkin?: QuoteDialogSkin | undefined\n readonly honeypotField?: string | undefined\n readonly contactEndpoint?: string | undefined\n readonly navigate?: ((href: string) => void) | undefined\n readonly fetcher?: typeof fetch | undefined\n readonly attachmentOptions?: Omit<UseBrandlabContactAttachmentsOptions, 'policy'> | undefined\n}\n\n/** What a page passes to the bound form: plain data, so a server component can render it. */\nexport interface BoundQuoteFormProps {\n readonly formId: QuoteFormPlacement\n readonly pageLabel?: string\n /** This placement's own placeholder, for example on a cost guide. */\n readonly messagePlaceholder?: string\n readonly layout?: QuoteFormLayout\n}\n\nexport interface BoundQuoteDialogProps {\n /** The dialog's H2, for example \"Get a free quote\". */\n readonly title: string\n /** The close button's accessible name, for example \"Close\". */\n readonly closeLabel: string\n readonly pageLabel?: string\n readonly messagePlaceholder?: string\n}\n\nexport interface BoundQuoteForm {\n readonly QuoteForm: (props: BoundQuoteFormProps) => JSX.Element\n readonly QuoteDialog: (props: BoundQuoteDialogProps) => JSX.Element\n}\n\n/**\n * Binds the form to the site's contract, analytics, photo policy, thank-you page, copy and skin. Call it once in the\n * site's own `'use client'` file (`src/site/quote-form.tsx`) and export the two components:\n *\n * ```tsx\n * 'use client'\n * const quote = createQuoteForm({ contract: contactContract, analytics, redirectTo: '/thank-you', copy, skin: skin.quoteForm })\n * export const QuoteForm = quote.QuoteForm\n * export const QuoteDialog = quote.QuoteDialog\n * ```\n *\n * It checks the contract and copy when the module loads, so a form that couldn't send fails the build instead.\n */\nexport function createQuoteForm(options: CreateQuoteFormOptions): BoundQuoteForm {\n if (!options || typeof options !== 'object') throw new TypeError('createQuoteForm needs the contract, copy and thank-you page.')\n if (typeof options.redirectTo !== 'string' || !/^\\/(?!\\/)[^\\s]*$/.test(options.redirectTo)) {\n throw new TypeError('redirectTo must be a root-relative path such as /thank-you.')\n }\n quoteFields(options.contract)\n const mode = options.contract.attachments.mode\n assertCopy(options.copy, mode === 'images-required' ? 'required' : mode === 'none' ? 'none' : 'optional')\n const { skin, dialogSkin, ...shared } = options\n\n function BoundQuoteForm({ formId, pageLabel, messagePlaceholder, layout }: BoundQuoteFormProps) {\n const merged = skin?.layout || layout ? { ...skin?.layout, ...layout } : undefined\n return (\n <QuoteForm\n {...shared}\n formId={formId}\n pageLabel={pageLabel}\n copy={messagePlaceholder ? { ...shared.copy, messagePlaceholder } : shared.copy}\n variant={skin?.variant}\n layout={merged}\n classes={skin?.classes}\n />\n )\n }\n\n function BoundQuoteDialog({ title, closeLabel, pageLabel, messagePlaceholder }: BoundQuoteDialogProps) {\n return (\n <QuoteDialog title={title} closeLabel={closeLabel} classes={dialogSkin?.classes}>\n <BoundQuoteForm\n formId=\"quote-dialog\"\n {...(pageLabel ? { pageLabel } : {})}\n {...(messagePlaceholder ? { messagePlaceholder } : {})}\n />\n </QuoteDialog>\n )\n }\n\n return Object.freeze({ QuoteForm: BoundQuoteForm, QuoteDialog: BoundQuoteDialog })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"quote-form.js","sourceRoot":"","sources":["../../../src/ui-kit/form/quote-form.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,qBAAqB,EACrB,4BAA4B,GAG7B,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAA4B,MAAM,OAAO,CAAA;AAM3E,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CA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Ac,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,EAAuB;QAC5F,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;QAClF,OAAO,CACL,KAAC,SAAS,OACJ,MAAM,EACV,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAC/E,OAAO,EAAE,IAAI,EAAE,OAAO,EACtB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,IAAI,EAAE,OAAO,GACtB,CACH,CAAA;IACH,CAAC;IAED,SAAS,gBAAgB,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,kBAAkB,EAAyB;QACnG,OAAO,CACL,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,YAC7E,KAAC,cAAc,IACb,MAAM,EAAC,cAAc,KACjB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAChC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACtD,GACU,CACf,CAAA;IACH,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC,CAAA;AACpF,CAAC","sourcesContent":["'use client'\n\n/**\n * `QuoteForm`: the one enquiry form for the hero, the quote dialog, the contact page and cost guides, on the shared\n * contact runtime (`useBrandlabContactForm`, `POST /api/contact`, photo preparation, idempotent retries).\n *\n * Locked layout (F8): Name · Suburb; Phone · Email, both required; the message (\"How can we help?\"), 5 rows; the\n * \"Add photos\" drop box with its \"0 of 5\" counter; the button; then one consent line linking the privacy policy. One\n * column below 640 px. No job select, no \"(required)\", no helper or reassurance lines: every label and message is\n * the site's copy. Errors appear only after a submit attempt, as a summary plus a message under each field; every\n * typed value and chosen photo is kept on any error. The button stays disabled until the page has hydrated and is\n * locked with a busy label while photos are prepared or the enquiry sends. An accepted enquiry sends one\n * `contact_form` (with `has_photos`) and opens the thank-you page once Google's tag can send it (3.18.0). A submit the\n * form's own checks stop sends `lead_form_error` (stage `validation`, the first failing field).\n *\n * `contract` and `analytics` can't cross from a server component, so a site binds them once with `createQuoteForm`\n * in its own `'use client'` file and renders the bound `QuoteForm` and `QuoteDialog` from its pages.\n */\nimport {\n defineContactContract,\n isValidAustralianPhoneNumber,\n type BrandlabContactContract,\n type ContactAttachmentPolicy,\n} from '@brandlab-digital/site-core/contact'\nimport { usePathname } from 'next/navigation'\nimport { useMemo, useRef, useState, type JSX, type RefObject } from 'react'\nimport type { BrandlabAnalytics } from '../../analytics.js'\nimport type {\n BrandlabContactAttachmentErrorReason,\n UseBrandlabContactAttachmentsOptions,\n} from '../../contact/attachments-client.js'\nimport { contactFieldProps, useBrandlabContactForm } from '../../contact/form-client.js'\nimport { navigateAfterGoogleTag } from '../../contact/google-tag-navigate.js'\nimport { CONTACT_FORM_FIELDS, CONTACT_PHONE_CHARACTERS } from '../../contact/shared.js'\nimport { HeadlessErrorSummary } from '../../ui.js'\nimport { HeadlessErrorFocus } from '../../ui-client.js'\nimport { TextLink } from '../primitives/links.js'\nimport type { RepeatedSlotOf } from '../repeated-slots.js'\nimport { slot, type SkinEntry } from '../skin.js'\nimport { Field } from './field.js'\nimport { PhotoUpload } from './photo-upload.js'\nimport { QuoteDialog, type QuoteDialogSkin } from './quote-dialog.js'\n\nexport const QUOTE_FORM_VARIANTS = ['card', 'plain', 'inline'] as const\nexport type QuoteFormVariant = (typeof QUOTE_FORM_VARIANTS)[number]\n\n/** The form's id and its lead diagnostics' `form_id`, one per placement. */\nexport const QUOTE_FORM_PLACEMENTS = ['quote-hero', 'quote-dialog', 'contact', 'guide'] as const\nexport type QuoteFormPlacement = (typeof QUOTE_FORM_PLACEMENTS)[number]\n\n/** The variant each placement takes unless the skin names one: the hero aside, the dialog and contact page, a guide. */\nexport const QUOTE_FORM_PLACEMENT_VARIANTS: Readonly<Record<QuoteFormPlacement, QuoteFormVariant>> = {\n 'quote-hero': 'card',\n 'quote-dialog': 'plain',\n contact: 'plain',\n guide: 'inline',\n}\n\nexport type QuoteFormSlot =\n | 'root'\n | 'row'\n | 'field'\n | 'label'\n | 'input'\n | 'textarea'\n | 'drop'\n | 'dropIcon'\n | 'counter'\n | 'photos'\n | 'photo'\n | 'thumb'\n | 'remove'\n | 'submit'\n | 'consent'\n | 'errorSummary'\n | 'error'\n | 'status'\n/** Labels always sit above their fields; density sets the spacing. */\nexport interface QuoteFormLayout {\n readonly density?: 'comfortable' | 'compact'\n}\n/** The photo boxes, rendered once per chosen photo: styled from the skin stylesheet, never by class (3.14.0). */\nexport type QuoteFormRepeatedSlot = RepeatedSlotOf<'quoteForm'>\nexport type QuoteFormSkin = SkinEntry<QuoteFormSlot, QuoteFormVariant, QuoteFormLayout, QuoteFormRepeatedSlot>\n\n/** Every visible phrase of the form, in the site's Australian English. */\nexport interface QuoteFormCopy {\n readonly labels: {\n readonly name: string\n readonly suburb: string\n readonly phone: string\n readonly email: string\n /** For example \"How can we help?\". */\n readonly message: string\n /** For example \"Add photos\". */\n readonly photos: string\n }\n /** The message placeholder, for example \"Tell us about your project\". */\n readonly messagePlaceholder: string\n /** The site's recorded button label, for example \"Get my free quote\". */\n readonly submit: string\n /** Busy labels: \"Sending…\", \"Sending photos…\" and \"Preparing photos…\". */\n readonly sending: string\n readonly sendingPhotos: string\n readonly preparingPhotos: string\n /** The photo counter with `{count}` and `{max}`, for example \"{count} of {max}\". */\n readonly photoCount: string\n /** Each remove button's name with `{number}`, for example \"Remove photo {number}\". */\n readonly removePhoto: string\n /** The one consent line: the sentence, the words in it that link, and the privacy policy's path. */\n readonly consent: { readonly sentence: string; readonly linkText: string; readonly href: string }\n /** The error summary's heading, for example \"Please check these details\". */\n readonly errorSummary: string\n /** A message under each field after a submit attempt. `photos` is needed only when photos are required. */\n readonly errors: {\n readonly name: string\n readonly suburb: string\n readonly phone: string\n readonly phoneFormat: string\n readonly email: string\n readonly emailFormat: string\n readonly message: string\n readonly photos?: string\n }\n /**\n * Why a chosen photo was refused: not an image type, too large, all photos together too large, more than the\n * limit (`{max}` allowed), or it couldn't be prepared (an iPhone photo that wouldn't convert). Needed when the\n * contract takes photos.\n */\n readonly photoErrors?: Readonly<Record<BrandlabContactAttachmentErrorReason, string>>\n /** Shown when sending fails: the photos were refused, or anything else (say how to call instead). */\n readonly failed: { readonly attachment: string; readonly general: string }\n}\n\nexport interface QuoteFormProps extends QuoteFormSkin {\n readonly formId: QuoteFormPlacement\n /** The contact contract from src/config/contact.ts. */\n readonly contract: BrandlabContactContract\n /** The site's defineBrandlabAnalytics binding. */\n readonly analytics?: BrandlabAnalytics | undefined\n /** Photo limits; the contract's attachment mode decides the default. */\n readonly attachmentPolicy?: ContactAttachmentPolicy | undefined\n /** The thank-you page opened after an accepted enquiry, for example `/thank-you`. */\n readonly redirectTo: string\n readonly copy: QuoteFormCopy\n /** The enquiry email's page row, for example \"Contact\". */\n readonly pageLabel?: string | undefined\n /** The runtime's honeypot field (default `website`). */\n readonly honeypotField?: string | undefined\n /** The contact endpoint (default `/api/contact`). */\n readonly contactEndpoint?: string | undefined\n /**\n * Client navigation to the thank-you page, for example `router.push`. By default a full page load once Google's tag\n * has sent the enquiry's hits (`navigateAfterGoogleTag`, 3.18.0; at most 8 s).\n */\n readonly navigate?: ((href: string) => void) | undefined\n /** Test seams: a fetch implementation and the photo preparation's options. */\n readonly fetcher?: typeof fetch | undefined\n readonly attachmentOptions?: Omit<UseBrandlabContactAttachmentsOptions, 'policy'> | undefined\n}\n\nconst EMAIL_PATTERN = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\nconst PHOTOS = 'photos'\n\ninterface QuoteFields {\n readonly name: string\n /** The suburb: always required when the contract has one, as the server requires every location field. */\n readonly location: string | undefined\n readonly phone: string\n readonly email: string\n readonly message: string\n readonly maxLength: Readonly<Record<string, number | undefined>>\n}\n\n/**\n * The contract's keys for the locked layout. A required field the form can't render would make every enquiry fail,\n * so it throws instead, when the site binds the form (at build).\n */\nfunction quoteFields(contract: BrandlabContactContract): QuoteFields {\n defineContactContract(contract)\n const role = (name: string) => contract.fields.find((field) => field.role === name)\n const location = role('location')\n if (location && location.kind !== 'text') {\n throw new Error(`QuoteForm renders the suburb as a text field; the contract's \"${location.key}\" is a ${location.kind}.`)\n }\n const unrendered = contract.fields.find((field) => field.role === 'custom' && field.required)\n if (unrendered) {\n throw new Error(`QuoteForm has no place for the required field \"${unrendered.key}\"; make it optional or drop it.`)\n }\n return {\n name: role('name')!.key,\n location: location?.key,\n phone: role('phone')!.key,\n email: role('email')!.key,\n message: role('message')!.key,\n maxLength: Object.fromEntries(contract.fields.map((field) => [field.key, field.maxLength])),\n }\n}\n\nconst PHOTO_ERROR_REASONS = ['type', 'size', 'total', 'count', 'prepare'] as const\n\nfunction assertCopy(copy: QuoteFormCopy, photos: 'none' | 'optional' | 'required') {\n const text = [\n ...Object.values(copy.labels),\n copy.messagePlaceholder,\n copy.submit,\n copy.sending,\n copy.sendingPhotos,\n copy.preparingPhotos,\n copy.photoCount,\n copy.removePhoto,\n copy.consent.sentence,\n copy.consent.linkText,\n copy.consent.href,\n copy.errorSummary,\n copy.errors.name,\n copy.errors.suburb,\n copy.errors.phone,\n copy.errors.phoneFormat,\n copy.errors.email,\n copy.errors.emailFormat,\n copy.errors.message,\n copy.failed.attachment,\n copy.failed.general,\n ...(photos === 'none' ? [] : PHOTO_ERROR_REASONS.map((reason) => copy.photoErrors?.[reason])),\n ...(photos === 'required' ? [copy.errors.photos] : []),\n ]\n if (text.some((value) => typeof value !== 'string' || !value.trim())) {\n throw new Error('QuoteForm copy is incomplete: every label, message and the consent line is the site\\'s own text.')\n }\n}\n\n/** The checks the server makes, run before sending: never stricter than the server, so no real enquiry is blocked. */\nfunction validate(\n form: HTMLFormElement,\n fields: QuoteFields,\n copy: QuoteFormCopy,\n photos: { required: boolean; count: number },\n): Record<string, string> {\n const value = (name: string) => {\n const element = form.elements.namedItem(name)\n return element && 'value' in element ? String(element.value).trim() : ''\n }\n const errors: Record<string, string> = {}\n if (!value(fields.name)) errors[fields.name] = copy.errors.name\n if (fields.location && !value(fields.location)) errors[fields.location] = copy.errors.suburb\n const phone = value(fields.phone)\n if (!phone) errors[fields.phone] = copy.errors.phone\n else if (!CONTACT_PHONE_CHARACTERS.test(phone) || !isValidAustralianPhoneNumber(phone)) {\n errors[fields.phone] = copy.errors.phoneFormat\n }\n const email = value(fields.email).toLowerCase()\n if (!email) errors[fields.email] = copy.errors.email\n else if (!EMAIL_PATTERN.test(email)) errors[fields.email] = copy.errors.emailFormat\n if (!value(fields.message)) errors[fields.message] = copy.errors.message\n if (photos.required && photos.count === 0 && copy.errors.photos) errors[PHOTOS] = copy.errors.photos\n return errors\n}\n\n/**\n * The site's message for a field the server refused: the runtime's own wording never shows. An empty field gets its\n * \"enter\" message; a filled phone or email its format message.\n */\nfunction serverFieldMessage(form: HTMLFormElement | null, key: string, fields: QuoteFields, copy: QuoteFormCopy) {\n const element = form?.elements.namedItem(key)\n const filled = Boolean(element && 'value' in element && String(element.value).trim())\n if (key === fields.phone) return filled ? copy.errors.phoneFormat : copy.errors.phone\n if (key === fields.email) return filled ? copy.errors.emailFormat : copy.errors.email\n if (key === fields.name) return copy.errors.name\n if (key === fields.location) return copy.errors.suburb\n return copy.errors.message\n}\n\nfunction ConsentLine({ consent, hooks }: { consent: QuoteFormCopy['consent']; hooks: ReturnType<typeof slot> }) {\n const at = consent.sentence.indexOf(consent.linkText)\n const link = <TextLink href={consent.href}>{at < 0 ? consent.sentence : consent.linkText}</TextLink>\n return (\n <p {...hooks}>\n {at < 0 ? link : (\n <>\n {consent.sentence.slice(0, at)}\n {link}\n {consent.sentence.slice(at + consent.linkText.length)}\n </>\n )}\n </p>\n )\n}\n\nexport function QuoteForm({\n formId,\n contract,\n analytics,\n attachmentPolicy,\n redirectTo,\n copy,\n pageLabel,\n honeypotField = CONTACT_FORM_FIELDS.honeypot,\n contactEndpoint,\n navigate,\n fetcher,\n attachmentOptions,\n variant,\n layout,\n classes,\n}: QuoteFormProps) {\n const fields = useMemo(() => quoteFields(contract), [contract])\n const mode = contract.attachments.mode\n const photosEnabled = mode !== 'none'\n const photosRequired = mode === 'images-required'\n assertCopy(copy, photosRequired ? 'required' : photosEnabled ? 'optional' : 'none')\n const pagePath = usePathname() || '/'\n const [clientErrors, setClientErrors] = useState<Record<string, string> | null>(null)\n const [attempt, setAttempt] = useState(0)\n const [withPhotos, setWithPhotos] = useState(false)\n const photoCount = useRef(0)\n\n const form = useBrandlabContactForm({\n contract,\n ...(analytics ? { analytics } : {}),\n pagePath,\n ...(pageLabel ? { pageLabel } : {}),\n formId,\n redirectTo,\n redirectDelayMs: 0,\n navigate: navigate ?? navigateAfterGoogleTag,\n ...(contactEndpoint ? { contactEndpoint } : {}),\n ...(fetcher ? { fetcher } : {}),\n attachments: { ...attachmentOptions, ...(attachmentPolicy ? { policy: attachmentPolicy } : {}) },\n onSubmitStart: ({ form: element }) => {\n const errors = validate(element, fields, copy, { required: photosRequired, count: photoCount.current })\n setAttempt((count) => count + 1)\n if (Object.keys(errors).length > 0) {\n setClientErrors(errors)\n // Nothing is sent; lead_form_error reports the failed checks, in the order of the fields (3.18.0).\n return { invalidFields: Object.keys(errors) }\n }\n setClientErrors(null)\n setWithPhotos(photoCount.current > 0)\n return undefined\n },\n })\n photoCount.current = form.attachments.images.length\n\n const fieldId = (key: string) => `${formId}-${key}`\n const order = [fields.name, fields.location, fields.phone, fields.email, fields.message, photosEnabled ? PHOTOS : undefined]\n .filter((key): key is string => Boolean(key))\n const errors: Record<string, string> = clientErrors ?? Object.fromEntries(\n order.flatMap((key) =>\n key !== PHOTOS && form.fieldError(key) ? [[key, serverFieldMessage(form.formProps.ref.current, key, fields, copy)]] : []),\n )\n const summary = order.flatMap((key) => (errors[key] ? [{ fieldId: fieldId(key), message: errors[key] }] : []))\n\n const leaving = form.succeeded\n const busyLabel = form.attachments.isProcessing\n ? copy.preparingPhotos\n : form.pending || leaving\n ? withPhotos ? copy.sendingPhotos : copy.sending\n : undefined\n const result = form.result\n const failure = !busyLabel && clientErrors === null && result && !result.ok && summary.length === 0\n ? result.code === 'attachment_rejected' ? copy.failed.attachment : copy.failed.general\n : undefined\n\n const fieldClasses = { field: classes?.field, label: classes?.label, error: classes?.error }\n const max = (key: string) => fields.maxLength[key]\n const textField = (key: string, label: string, props: { type: 'text' | 'tel' | 'email'; autoComplete: string }) => (\n <Field id={fieldId(key)} label={label} error={errors[key]} required classes={fieldClasses}>\n {(control) => (\n <input\n {...contactFieldProps(form, key)}\n {...control}\n {...slot(classes, 'input')}\n type={props.type}\n autoComplete={props.autoComplete}\n {...(props.type === 'tel' ? { inputMode: 'tel' as const } : { maxLength: max(key) })}\n {...(props.type === 'email' ? { autoCapitalize: 'none', spellCheck: false } : {})}\n />\n )}\n </Field>\n )\n\n return (\n <form\n {...form.formProps}\n noValidate\n data-bl=\"quote-form\"\n data-variant={variant ?? QUOTE_FORM_PLACEMENT_VARIANTS[formId]}\n data-density={layout?.density ?? 'comfortable'}\n className={classes?.root}\n >\n <HeadlessErrorSummary\n {...slot(classes, 'errorSummary')}\n id={`${formId}-errors`}\n headingId={`${formId}-errors-heading`}\n heading={copy.errorSummary}\n errors={summary}\n />\n <HeadlessErrorFocus key={attempt} active={summary.length > 0} formId={formId} summaryId={`${formId}-errors`} />\n <div data-bl-honeypot=\"\" data-bl-visually-hidden=\"\" aria-hidden=\"true\" inert>\n <input type=\"text\" name={honeypotField} tabIndex={-1} autoComplete=\"off\" />\n </div>\n\n <div {...slot(classes, 'row')}>\n {textField(fields.name, copy.labels.name, { type: 'text', autoComplete: 'name' })}\n {fields.location ? (\n <Field id={fieldId(fields.location)} label={copy.labels.suburb} error={errors[fields.location]} required classes={fieldClasses}>\n {(control) => (\n <input\n {...contactFieldProps(form, fields.location!)}\n {...control}\n {...slot(classes, 'input')}\n type=\"text\"\n autoComplete=\"address-level2\"\n maxLength={max(fields.location!)}\n />\n )}\n </Field>\n ) : null}\n </div>\n <div {...slot(classes, 'row')}>\n {textField(fields.phone, copy.labels.phone, { type: 'tel', autoComplete: 'tel' })}\n {textField(fields.email, copy.labels.email, { type: 'email', autoComplete: 'email' })}\n </div>\n <Field id={fieldId(fields.message)} label={copy.labels.message} error={errors[fields.message]} required classes={fieldClasses}>\n {(control) => (\n <textarea\n {...contactFieldProps(form, fields.message)}\n {...control}\n {...slot(classes, 'textarea')}\n rows={5}\n placeholder={copy.messagePlaceholder}\n maxLength={max(fields.message)}\n />\n )}\n </Field>\n {photosEnabled ? (\n <PhotoUpload\n id={fieldId(PHOTOS)}\n label={copy.labels.photos}\n attachments={form.attachments}\n counter={copy.photoCount}\n removeLabel={copy.removePhoto}\n errorMessages={copy.photoErrors}\n accept={mode === 'images-and-pdfs-optional' ? 'image/*,application/pdf' : 'image/*'}\n error={errors[PHOTOS]}\n required={photosRequired}\n disabled={form.pending || leaving}\n classes={classes}\n />\n ) : null}\n\n <button\n {...form.submitProps}\n {...slot(classes, 'submit')}\n disabled={form.submitDisabled || leaving}\n data-state={busyLabel ? 'busy' : 'idle'}\n >\n {busyLabel ?? copy.submit}\n </button>\n <ConsentLine consent={copy.consent} hooks={slot(classes, 'consent')} />\n <div\n {...slot(classes, 'status')}\n ref={form.statusRef as RefObject<HTMLDivElement>}\n role=\"status\"\n aria-live=\"polite\"\n tabIndex={-1}\n data-state={failure ? 'error' : busyLabel ? 'busy' : 'idle'}\n >\n {failure ?? (busyLabel ? <span data-bl-visually-hidden=\"\">{busyLabel}</span> : null)}\n </div>\n </form>\n )\n}\n\nexport interface CreateQuoteFormOptions {\n readonly contract: BrandlabContactContract\n readonly analytics?: BrandlabAnalytics | undefined\n readonly attachmentPolicy?: ContactAttachmentPolicy | undefined\n /** The thank-you page, for example `/thank-you`. */\n readonly redirectTo: string\n readonly copy: QuoteFormCopy\n /** The site's quote form skin; leave `variant` unset so each placement takes its own. */\n readonly skin?: QuoteFormSkin | undefined\n /** The quote dialog's skin. */\n readonly dialogSkin?: QuoteDialogSkin | undefined\n readonly honeypotField?: string | undefined\n readonly contactEndpoint?: string | undefined\n readonly navigate?: ((href: string) => void) | undefined\n readonly fetcher?: typeof fetch | undefined\n readonly attachmentOptions?: Omit<UseBrandlabContactAttachmentsOptions, 'policy'> | undefined\n}\n\n/** What a page passes to the bound form: plain data, so a server component can render it. */\nexport interface BoundQuoteFormProps {\n readonly formId: QuoteFormPlacement\n readonly pageLabel?: string\n /** This placement's own placeholder, for example on a cost guide. */\n readonly messagePlaceholder?: string\n readonly layout?: QuoteFormLayout\n}\n\nexport interface BoundQuoteDialogProps {\n /** The dialog's H2, for example \"Get a free quote\". */\n readonly title: string\n /** The close button's accessible name, for example \"Close\". */\n readonly closeLabel: string\n readonly pageLabel?: string\n readonly messagePlaceholder?: string\n}\n\nexport interface BoundQuoteForm {\n readonly QuoteForm: (props: BoundQuoteFormProps) => JSX.Element\n readonly QuoteDialog: (props: BoundQuoteDialogProps) => JSX.Element\n}\n\n/**\n * Binds the form to the site's contract, analytics, photo policy, thank-you page, copy and skin. Call it once in the\n * site's own `'use client'` file (`src/site/quote-form.tsx`) and export the two components:\n *\n * ```tsx\n * 'use client'\n * const quote = createQuoteForm({ contract: contactContract, analytics, redirectTo: '/thank-you', copy, skin: skin.quoteForm })\n * export const QuoteForm = quote.QuoteForm\n * export const QuoteDialog = quote.QuoteDialog\n * ```\n *\n * It checks the contract and copy when the module loads, so a form that couldn't send fails the build instead.\n */\nexport function createQuoteForm(options: CreateQuoteFormOptions): BoundQuoteForm {\n if (!options || typeof options !== 'object') throw new TypeError('createQuoteForm needs the contract, copy and thank-you page.')\n if (typeof options.redirectTo !== 'string' || !/^\\/(?!\\/)[^\\s]*$/.test(options.redirectTo)) {\n throw new TypeError('redirectTo must be a root-relative path such as /thank-you.')\n }\n quoteFields(options.contract)\n const mode = options.contract.attachments.mode\n assertCopy(options.copy, mode === 'images-required' ? 'required' : mode === 'none' ? 'none' : 'optional')\n const { skin, dialogSkin, ...shared } = options\n\n function BoundQuoteForm({ formId, pageLabel, messagePlaceholder, layout }: BoundQuoteFormProps) {\n const merged = skin?.layout || layout ? { ...skin?.layout, ...layout } : undefined\n return (\n <QuoteForm\n {...shared}\n formId={formId}\n pageLabel={pageLabel}\n copy={messagePlaceholder ? { ...shared.copy, messagePlaceholder } : shared.copy}\n variant={skin?.variant}\n layout={merged}\n classes={skin?.classes}\n />\n )\n }\n\n function BoundQuoteDialog({ title, closeLabel, pageLabel, messagePlaceholder }: BoundQuoteDialogProps) {\n return (\n <QuoteDialog title={title} closeLabel={closeLabel} classes={dialogSkin?.classes}>\n <BoundQuoteForm\n formId=\"quote-dialog\"\n {...(pageLabel ? { pageLabel } : {})}\n {...(messagePlaceholder ? { messagePlaceholder } : {})}\n />\n </QuoteDialog>\n )\n }\n\n return Object.freeze({ QuoteForm: BoundQuoteForm, QuoteDialog: BoundQuoteDialog })\n}\n"]}
|
|
@@ -23,6 +23,11 @@ export type MediaFrameProps = MediaFrameSkin & MediaFrameSizing & {
|
|
|
23
23
|
readonly caption?: ReactNode;
|
|
24
24
|
/** The page's largest image: preloaded, high fetch priority, never lazy. */
|
|
25
25
|
readonly priority?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The WebP quality, 1 to 100 (3.18.0; Next's default is 75). The site lists it in `brandlabNextConfig`'s
|
|
28
|
+
* `images.qualities`, or Next refuses it. A photo-heavy hero over B1's 200 KB usually passes at 60 to 65.
|
|
29
|
+
*/
|
|
30
|
+
readonly quality?: number;
|
|
26
31
|
};
|
|
27
32
|
export declare function MediaFrame(props: MediaFrameProps): import("react/jsx-runtime").JSX.Element;
|
|
28
33
|
//# sourceMappingURL=media-frame.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-frame.d.ts","sourceRoot":"","sources":["../../../src/ui-kit/primitives/media-frame.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAyB,KAAK,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAC3H,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAEjD,qFAAqF;AACrF,MAAM,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,YAAY,CAAC,GAC/F,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,YAAY,GAAG,YAAY,CAAC,CAAC,CAAA;AAEhE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,CAAA;AACjE,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC,cAAc,CAAC,CAAA;AAEtD,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,iBAAiB,CAAA;AAEhD,8GAA8G;AAC9G,MAAM,MAAM,gBAAgB,GACxB;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,KAAK,CAAA;CAAE,GACzD;IAAE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAA;AAE7D,MAAM,MAAM,eAAe,GAAG,cAAc,GAC1C,gBAAgB,GAAG;IACjB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,kFAAkF;IACl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O,CAAA;IACvB,kFAAkF;IAClF,QAAQ,CAAC,KAAK,CAAC,EAAE,kBAAkB,CAAA;IACnC,mFAAmF;IACnF,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAA;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAC1B,CAAA;AAUH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAyDhD"}
|
|
@@ -29,7 +29,10 @@ function ratioOf(ratio) {
|
|
|
29
29
|
return height / width;
|
|
30
30
|
}
|
|
31
31
|
export function MediaFrame(props) {
|
|
32
|
-
const { media, ratio, caption, priority = false, classes } = props;
|
|
32
|
+
const { media, ratio, caption, priority = false, quality, classes } = props;
|
|
33
|
+
if (quality !== undefined && (!Number.isInteger(quality) || quality < 1 || quality > 100)) {
|
|
34
|
+
throw new Error(`MediaFrame ${media.src}: quality must be a whole number from 1 to 100.`);
|
|
35
|
+
}
|
|
33
36
|
if (ratio !== undefined && !BRANDLAB_MEDIA_RATIOS.includes(ratio)) {
|
|
34
37
|
throw new Error(`MediaFrame ${media.src}: ratio "${ratio}" is not one of ${BRANDLAB_MEDIA_RATIOS.join(', ')}.`);
|
|
35
38
|
}
|
|
@@ -53,6 +56,6 @@ export function MediaFrame(props) {
|
|
|
53
56
|
const hasCaption = caption !== undefined && caption !== null && caption !== '';
|
|
54
57
|
const Root = illustration || hasCaption ? 'figure' : 'div';
|
|
55
58
|
const focal = media.focalPoint ? { objectPosition: `${media.focalPoint.x}% ${media.focalPoint.y}%` } : undefined;
|
|
56
|
-
return (_jsxs(Root, { "data-bl": "media", "data-ratio": ratio, "data-fit": sizes ? 'fluid' : 'fixed', "data-provenance": media.provenance, className: classes?.root, children: [_jsx(Image, { src: media.src, alt: media.decorative ? '' : media.alt, width: width, height: height, sizes: sizes, style: focal, ...(priority ? { preload: true, fetchPriority: 'high' } : { loading: 'lazy' }), ...slot(classes, 'img') }), illustration || hasCaption ? (_jsxs("figcaption", { ...slot(classes, 'caption'), children: [illustration ? _jsx("span", { ...slot(classes, 'label'), children: ILLUSTRATION_LABEL }) : null, illustration && hasCaption ? ' ' : null, hasCaption ? caption : null] })) : null] }));
|
|
59
|
+
return (_jsxs(Root, { "data-bl": "media", "data-ratio": ratio, "data-fit": sizes ? 'fluid' : 'fixed', "data-provenance": media.provenance, className: classes?.root, children: [_jsx(Image, { src: media.src, alt: media.decorative ? '' : media.alt, width: width, height: height, sizes: sizes, ...(quality === undefined ? {} : { quality }), style: focal, ...(priority ? { preload: true, fetchPriority: 'high' } : { loading: 'lazy' }), ...slot(classes, 'img') }), illustration || hasCaption ? (_jsxs("figcaption", { ...slot(classes, 'caption'), children: [illustration ? _jsx("span", { ...slot(classes, 'label'), children: ILLUSTRATION_LABEL }) : null, illustration && hasCaption ? ' ' : null, hasCaption ? caption : null] })) : null] }));
|
|
57
60
|
}
|
|
58
61
|
//# sourceMappingURL=media-frame.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-frame.js","sourceRoot":"","sources":["../../../src/ui-kit/primitives/media-frame.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,MAAM,YAAY,CAAA;AAE9B,OAAO,EAAE,qBAAqB,EAAoD,MAAM,mCAAmC,CAAA;AAC3H,OAAO,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AASjD,mFAAmF;AACnF,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"media-frame.js","sourceRoot":"","sources":["../../../src/ui-kit/primitives/media-frame.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,MAAM,YAAY,CAAA;AAE9B,OAAO,EAAE,qBAAqB,EAAoD,MAAM,mCAAmC,CAAA;AAC3H,OAAO,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EACjC,SAAS,EAAE,OAAO,EAAE,IAAI,aAExB,KAAC,KAAK,IACJ,GAAG,EAAE,KAAK,CAAC,GAAG,EACd,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EACtC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,KACR,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAC9C,KAAK,EAAE,KAAK,KACR,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAe,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAe,EAAE,CAAC,KAC7F,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,GACxB,EACD,YAAY,IAAI,UAAU,CAAC,CAAC,CAAC,CAC5B,yBAAgB,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,aACrC,YAAY,CAAC,CAAC,CAAC,kBAAU,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,YAAG,kBAAkB,GAAQ,CAAC,CAAC,CAAC,IAAI,EACnF,YAAY,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EACvC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,IACjB,CACd,CAAC,CAAC,CAAC,IAAI,IACH,CACR,CAAA;AACH,CAAC","sourcesContent":["/**\n * `MediaFrame` (3.14.0, F13): one image from the site's media manifest in a frame of an allowed ratio. Server\n * component over `next/image`, and the library's one image path: `Media` and the hero render through it, so the\n * \"Illustration\" label and the sizing rule below live here only. It is provenance-aware: the root carries\n * `data-provenance`, and an AI image shows the locked visible label \"Illustration\" inside the `<figcaption>`, so the\n * figure's accessible caption names it an illustration too. A caption (\"{what}, {suburb}, {month year}\") or the label\n * makes the root a `<figure>`; otherwise it is a `<div>`.\n *\n * Sizing (cost item 1g) is one of two kinds, and the type takes exactly one:\n * - **fluid** (`sizes`, which must have a `vw` part, for example `(min-width: 1024px) 50vw, 100vw`): Next keeps only the\n * widths the layout can use.\n * - **fixed** (`displayWidth`, the CSS width in pixels): no `sizes` at all, so Next emits a 1x and a 2x candidate only.\n * A `sizes` without `vw` (for example `sizes=\"148px\"`) makes Next list all 16 widths, which was 28–30% of some pages'\n * HTML; it is refused here.\n *\n * `priority` is for the page's largest image (the hero): preloaded and fetched with high priority, never lazy. Every\n * other image loads lazily.\n */\nimport Image from 'next/image'\nimport type { ReactNode } from 'react'\nimport { BRANDLAB_MEDIA_RATIOS, type BrandlabMediaEntry, type BrandlabMediaRatio } from '@brandlab-digital/site-core/media'\nimport { slot, type SkinEntry } from '../skin.js'\n\n/** What a frame needs from a `media.ts` entry; a whole `BrandlabMediaEntry` fits. */\nexport type UiMedia = Pick<BrandlabMediaEntry, 'src' | 'width' | 'height' | 'alt' | 'provenance'> &\n Partial<Pick<BrandlabMediaEntry, 'decorative' | 'focalPoint'>>\n\nexport type MediaFrameSlot = 'root' | 'img' | 'caption' | 'label'\nexport type MediaFrameSkin = SkinEntry<MediaFrameSlot>\n\n/** The locked visible label on an AI image (F13; truth wording, not site copy). */\nexport const ILLUSTRATION_LABEL = 'Illustration'\n\n/** Exactly one sizing: `sizes` with a `vw` part for a fluid image, or `displayWidth` for a fixed-size one. */\nexport type MediaFrameSizing =\n | { readonly sizes: string; readonly displayWidth?: never }\n | { readonly displayWidth: number; readonly sizes?: never }\n\nexport type MediaFrameProps = MediaFrameSkin &\n MediaFrameSizing & {\n readonly media: UiMedia\n /** Crop to an allowed ratio; by default the frame keeps the image's own shape. */\n readonly ratio?: BrandlabMediaRatio\n /** \"{what}, {suburb}, {month year}\", only when the photo really shows that job. */\n readonly caption?: ReactNode\n /** The page's largest image: preloaded, high fetch priority, never lazy. */\n readonly priority?: boolean\n /**\n * The WebP quality, 1 to 100 (3.18.0; Next's default is 75). The site lists it in `brandlabNextConfig`'s\n * `images.qualities`, or Next refuses it. A photo-heavy hero over B1's 200 KB usually passes at 60 to 65.\n */\n readonly quality?: number\n }\n\n/** Next's own test for a `vw` part in `sizes` (shared/lib/get-img-props). */\nconst VIEWPORT_WIDTH = /(^|\\s)(1?\\d?\\d)vw/\n\nfunction ratioOf(ratio: BrandlabMediaRatio): number {\n const [width, height] = ratio.split(':').map(Number) as [number, number]\n return height / width\n}\n\nexport function MediaFrame(props: MediaFrameProps) {\n const { media, ratio, caption, priority = false, quality, classes } = props\n if (quality !== undefined && (!Number.isInteger(quality) || quality < 1 || quality > 100)) {\n throw new Error(`MediaFrame ${media.src}: quality must be a whole number from 1 to 100.`)\n }\n if (ratio !== undefined && !(BRANDLAB_MEDIA_RATIOS as readonly string[]).includes(ratio)) {\n throw new Error(`MediaFrame ${media.src}: ratio \"${ratio}\" is not one of ${BRANDLAB_MEDIA_RATIOS.join(', ')}.`)\n }\n let width = media.width\n let height = media.height\n let sizes: string | undefined\n if (props.sizes !== undefined) {\n if (!VIEWPORT_WIDTH.test(props.sizes)) {\n throw new Error(\n `MediaFrame ${media.src}: sizes \"${props.sizes}\" has no vw part, so Next would list every width. Give a fluid image a vw size, or a fixed-size image its displayWidth instead.`,\n )\n }\n sizes = props.sizes\n } else {\n if (!Number.isInteger(props.displayWidth) || props.displayWidth <= 0) {\n throw new Error(`MediaFrame ${media.src}: displayWidth must be the image's CSS width in whole pixels.`)\n }\n width = props.displayWidth\n height = Math.round(props.displayWidth * (ratio ? ratioOf(ratio) : media.height / media.width))\n }\n const illustration = media.provenance === 'illustrative-ai'\n const hasCaption = caption !== undefined && caption !== null && caption !== ''\n const Root = illustration || hasCaption ? 'figure' : 'div'\n const focal = media.focalPoint ? { objectPosition: `${media.focalPoint.x}% ${media.focalPoint.y}%` } : undefined\n return (\n <Root\n data-bl=\"media\"\n data-ratio={ratio}\n data-fit={sizes ? 'fluid' : 'fixed'}\n data-provenance={media.provenance}\n className={classes?.root}\n >\n <Image\n src={media.src}\n alt={media.decorative ? '' : media.alt}\n width={width}\n height={height}\n sizes={sizes}\n {...(quality === undefined ? {} : { quality })}\n style={focal}\n {...(priority ? { preload: true, fetchPriority: 'high' as const } : { loading: 'lazy' as const })}\n {...slot(classes, 'img')}\n />\n {illustration || hasCaption ? (\n <figcaption {...slot(classes, 'caption')}>\n {illustration ? <span {...slot(classes, 'label')}>{ILLUSTRATION_LABEL}</span> : null}\n {illustration && hasCaption ? ' ' : null}\n {hasCaption ? caption : null}\n </figcaption>\n ) : null}\n </Root>\n )\n}\n"]}
|