@brandlab-digital/site-core 4.3.1 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -194,11 +194,42 @@ Pass `{ ...siteStrategy, on }` for the options.
194
194
 
195
195
  ### Titles and H1s (`./page-titles`)
196
196
 
197
- `buildPageTitle({ family, brand, shortBrand?, phrase?, service?, place?, tier?, proofTail?, year?, job? })` writes
198
- v2 §5.2's patterns: "{Service} {Place}" for region, suburb, service-region and service-in-suburb pages (no "in", no
199
- "the"), the home and service phrases, cost guides and projects; titles stay within 60 characters by using the short
200
- brand, then dropping the brand, never cutting the keyword. A proof tail is allowed only on service and head-tier pages.
201
- Pass the `title` with `titleMode: 'absolute'`. `locationHeadingProblem` is the rule check E1-pattern applies.
197
+ `buildPageTitle({ family, brand, shortBrand?, phrase?, service?, place?, placeWithWord?, year?, job? })` writes
198
+ v2 §5.2's patterns: the compact "{Service} {Place}" title for region, suburb, service-region and service-in-suburb
199
+ pages, the home and service phrases, cost guides and projects; titles stay within 60 characters by using the short
200
+ brand, then dropping the brand, never cutting the keyword. From 4.4.0 a title carries no price or proof tail
201
+ (`proofTail` and `tier` are removed; passing `proofTail` throws). A location page's on-page H1 may read naturally:
202
+ pass `placeWithWord` (`definePlaceNames(...).get(slug).withPlaceWord`, "in Ryde", "on the Northern Beaches") and the
203
+ H1 is "Tree Removal in Ryde" while the title stays "Tree Removal Ryde | Brand". Without it the H1 is the compact form.
204
+ Pass the `title` with `titleMode: 'absolute'`. `locationHeadingProblem` is the rule check E1-pattern applies; it
205
+ accepts both H1 forms. Length is advice from 4.4.1: `locationTitleAdvice(title)` returns a note above about 60
206
+ characters, and a long title never fails.
207
+
208
+ Licences are never removed (4.4.1; Romie, 4 November 2026): `renderableLicences` returns every licence and
209
+ `licenceRenderState` reports `mayRender: true` in every state, `expired` included. The state tells the caller what
210
+ to re-check; the ready gate's T3 warns on a passed date.
211
+
212
+ ### A page's own section order (`briefSectionOrder` in `./section-order`, from 4.4.0)
213
+
214
+ Each page's search brief sets its section order. `briefSectionOrder(family, sections)` turns the brief's list into
215
+ the order `planSectionSequence` takes, and the manifest then says `order: 'brief'`:
216
+
217
+ ```ts
218
+ const order = briefSectionOrder('suburb', ['hero', 'area-map', 'reviews', 'services', 'local-facts', 'cta'])
219
+ const plan = planSectionSequence(order, candidates, path)
220
+ ```
221
+
222
+ Only structure is enforced: the page opens with its hero, page header or article header; the CTA band, when listed,
223
+ is last; a suburb page keeps its `area-map`; nothing is listed twice. Every other listed section is conditional
224
+ (it renders when its data exists and otherwise names what is missing). The family defaults (`defaultSectionOrder`,
225
+ `defineSectionOrder`) are unchanged and remain the order for a page without a brief.
226
+
227
+ ### The site's kit tones (`siteSystem.kit` in `./project`, from 4.4.0)
228
+
229
+ `siteSystem: { tier, kit: { tones: { band: 2, 'ink-panel': 1 } } }` records the section tones the site's own design
230
+ kit limits, by the `data-tone` name its sections carry, and how many sections of each a page may carry (1 to 12). The
231
+ ready gate's K8 reads it. A tone that is not listed has no limit; a site that declares no kit keeps one `band` section
232
+ a page.
202
233
 
203
234
  ### Trade map (`./section-order`)
204
235
 
@@ -174,13 +174,13 @@ export declare function unknownFact<T>(): BrandlabFact<T>;
174
174
  export declare function notApplicableFact<T>(reason: string): BrandlabFact<T>;
175
175
  export declare function resolveVerifiedFactForSurface<T>(fact: BrandlabFact<T>, surface: BrandlabEvidenceSurface, asOf?: Date): T | undefined;
176
176
  /**
177
- * Whether a licence may render and in what state: `expired` once today (Sydney) is past `expiresOn`, which never
178
- * renders; `unchecked` when the register has not been checked, or not within 30 days; `expiring` within 60 days of
177
+ * A licence's state. A licence always renders (4.4.1; Romie, 4 November 2026: licences stay through renewal and are
178
+ * never removed), so `mayRender` is true in every state; the state says what to re-check. `expired` once today
179
+ * (Sydney) is past `expiresOn`: chase the renewal and update the date; `unchecked` when the register has not been checked, or not within 30 days; `expiring` within 60 days of
179
180
  * `expiresOn`; otherwise `current`. A licence without the 3.8.0 fields has no expiry to pass, and is `unchecked`.
180
- * Only an expired licence is held back: the other states render and tell the caller what to re-check.
181
181
  */
182
182
  export declare function licenceRenderState(licence: Pick<BrandlabLicence, 'expiresOn' | 'checkedOn'>, asOf?: Date): BrandlabLicenceRenderStatus;
183
- /** The licences a page may show: every licence except the expired ones. */
183
+ /** The licences a page may show: all of them (4.4.1). A licence past its expiry date stays while it is renewed; the ready gate warns. */
184
184
  export declare function renderableLicences<T extends Pick<BrandlabLicence, 'expiresOn' | 'checkedOn'>>(licences: readonly T[], asOf?: Date): T[];
185
185
  export declare function defineBrandlabBusiness<const T extends BrandlabBusiness>(business: T): T;
186
186
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"business.d.ts","sourceRoot":"","sources":["../src/business.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,SAAS,GAAG,gBAAgB,CAAA;AAEzE,eAAO,MAAM,8BAA8B,sMAUjC,CAAA;AAEV,MAAM,MAAM,0BAA0B,GACpC,CAAC,OAAO,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAA;AAEjD,eAAO,MAAM,0BAA0B,gGAQ7B,CAAA;AAEV,MAAM,MAAM,uBAAuB,GACjC,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAA;AAE7C,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,0BAA0B,CAAA;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,SAAS,uBAAuB,EAAE,CAAA;CACpD;AAED,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,MAAM,EAAE,UAAU,CAAA;IAClB,KAAK,EAAE,CAAC,CAAA;IACR,QAAQ,EAAE,iBAAiB,CAAA;CAC5B;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,IACtB,YAAY,CAAC,CAAC,CAAC,G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`${from}T00:00:00Z`)) / 86_400_000);
78
78
  }
79
79
  /**
80
- * Whether a licence may render and in what state: `expired` once today (Sydney) is past `expiresOn`, which never
81
- * renders; `unchecked` when the register has not been checked, or not within 30 days; `expiring` within 60 days of
80
+ * A licence's state. A licence always renders (4.4.1; Romie, 4 November 2026: licences stay through renewal and are
81
+ * never removed), so `mayRender` is true in every state; the state says what to re-check. `expired` once today
82
+ * (Sydney) is past `expiresOn`: chase the renewal and update the date; `unchecked` when the register has not been checked, or not within 30 days; `expiring` within 60 days of
82
83
  * `expiresOn`; otherwise `current`. A licence without the 3.8.0 fields has no expiry to pass, and is `unchecked`.
83
- * Only an expired licence is held back: the other states render and tell the caller what to re-check.
84
84
  */
85
85
  export function licenceRenderState(licence, asOf = new Date()) {
86
86
  const today = sydneyCalendarDate(asOf);
@@ -91,7 +91,7 @@ export function licenceRenderState(licence, asOf = new Date()) {
91
91
  ...(daysSinceChecked !== undefined ? { daysSinceChecked } : {}),
92
92
  };
93
93
  if (daysToExpiry !== undefined && daysToExpiry < 0)
94
- return { state: 'expired', mayRender: false, ...details };
94
+ return { state: 'expired', mayRender: true, ...details };
95
95
  if (daysSinceChecked === undefined || daysSinceChecked > BRANDLAB_LICENCE_CHECK_MAX_AGE_DAYS) {
96
96
  return { state: 'unchecked', mayRender: true, ...details };
97
97
  }
@@ -100,7 +100,7 @@ export function licenceRenderState(licence, asOf = new Date()) {
100
100
  }
101
101
  return { state: 'current', mayRender: true, ...details };
102
102
  }
103
- /** The licences a page may show: every licence except the expired ones. */
103
+ /** The licences a page may show: all of them (4.4.1). A licence past its expiry date stays while it is renewed; the ready gate warns. */
104
104
  export function renderableLicences(licences, asOf = new Date()) {
105
105
  return licences.filter((licence) => licenceRenderState(licence, asOf).mayRender);
106
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"business.js","sourceRoot":"","sources":["../src/business.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,mBAAmB;IACn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C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACnF,CAAC","sourcesContent":["export type VerificationState = 'verified' | 'unknown' | 'not-applicable'\n\nexport const BRANDLAB_EVIDENCE_SOURCE_KINDS = [\n 'official-registry',\n 'google-business-profile',\n 'client-document',\n 'client-confirmation',\n 'first-party-record',\n 'public-authority',\n 'asset-rights',\n 'other-independent',\n 'synthetic-test',\n] as const\n\nexport type BrandlabEvidenceSourceKind =\n (typeof BRANDLAB_EVIDENCE_SOURCE_KINDS)[number]\n\nexport const BRANDLAB_EVIDENCE_SURFACES = [\n 'website-copy',\n 'metadata',\n 'schema',\n 'reviews',\n 'projects',\n 'images',\n 'operations',\n] as const\n\nexport type BrandlabEvidenceSurface =\n (typeof BRANDLAB_EVIDENCE_SURFACES)[number]\n\nexport interface EvidenceReference {\n sourceKind: BrandlabEvidenceSourceKind\n reference: string\n verifiedAt: string\n expiresAt?: string\n allowedSurfaces: readonly BrandlabEvidenceSurface[]\n}\n\nexport interface VerifiedFact<T> {\n status: 'verified'\n value: T\n evidence: EvidenceReference\n}\n\nexport type BrandlabFact<T> =\n | VerifiedFact<T>\n | { status: 'unknown' }\n | { status: 'not-applicable'; reason: string }\n\nexport interface BrandlabPhoneNumber {\n /** As the business shows it, for example \"02 9000 1234\", \"0412 345 678\" or \"1300 329 600\". */\n display: string\n /**\n * E.164 form: \"+61290001234\". A 13, 1300 or 1800 number keeps its national\n * digits after +61 (\"+611300329600\", \"+61131234\").\n */\n e164: string\n}\n\nexport interface BrandlabPostalAddress {\n streetAddress: string\n addressLocality: string\n addressRegion: string\n postalCode: string\n addressCountry: string\n}\n\nexport interface BrandlabServiceArea {\n id: string\n name: string\n kind: 'city' | 'region' | 'suburb' | 'state' | 'country'\n}\n\nexport type BrandlabOpeningHoursDay =\n | 'Monday'\n | 'Tuesday'\n | 'Wednesday'\n | 'Thursday'\n | 'Friday'\n | 'Saturday'\n | 'Sunday'\n\nexport interface BrandlabOpeningHours {\n days: readonly BrandlabOpeningHoursDay[]\n opens: string\n closes: string\n}\n\nexport const BRANDLAB_LICENCE_HOLDER_TYPES = ['person', 'company'] as const\n\nexport type BrandlabLicenceHolderType = (typeof BRANDLAB_LICENCE_HOLDER_TYPES)[number]\n\n/** One class of work a licence covers, with any conditions the register attaches to it. */\nexport interface BrandlabLicenceClass {\n /** The class as the register names it, for example \"Building work\" or \"Electrical wiring work\". */\n name: string\n /** Conditions on the class, as the register words them, for example a Home Building Compensation limit. */\n conditions?: readonly string[]\n}\n\n/** The body that issues the licence. The two NSW regulators are named; any other regulator is plain text. */\nexport type BrandlabLicenceRegulator = 'NSW Fair Trading' | 'SafeWork NSW' | (string & {})\n\n/** A Home Building Compensation certificate of eligibility held with the licence. */\nexport interface BrandlabHbcCertificate {\n reference: string\n insurer?: string\n /** ISO date (YYYY-MM-DD). */\n expiresOn?: string\n}\n\n/**\n * A licence as the register shows it. `name` and `identifier` are the original fields and stay valid alone; the rest\n * (3.8.0) lets a page name the licensee, carry the classes and their conditions, and be held back when the licence\n * has expired or has not been checked against the register lately.\n */\nexport interface BrandlabLicence {\n name: string\n identifier: string\n jurisdiction?: string\n /** Whether the licensee is a person or a company. */\n holderType?: BrandlabLicenceHolderType\n /** The licensee's name as the register shows it; shown beside the number when it differs from the trading name. */\n licensee?: string\n classes?: readonly BrandlabLicenceClass[]\n regulator?: BrandlabLicenceRegulator\n hbcCertificates?: readonly BrandlabHbcCertificate[]\n /** ISO date (YYYY-MM-DD) the licence expires. */\n expiresOn?: string\n /** The public register entry for this licence. */\n registerUrl?: string\n /** ISO date (YYYY-MM-DD) the register entry was last checked. */\n checkedOn?: string\n}\n\n/** A licence expiring within this many days is `expiring`. */\nexport const BRANDLAB_LICENCE_EXPIRY_WARNING_DAYS = 60\n/** A licence last checked against the register more than this many days ago is `unchecked`. */\nexport const BRANDLAB_LICENCE_CHECK_MAX_AGE_DAYS = 30\n\nexport type BrandlabLicenceRenderState = 'current' | 'expiring' | 'expired' | 'unchecked'\n\nexport interface BrandlabLicenceRenderStatus {\n state: BrandlabLicenceRenderState\n /** False only for an expired licence: an expired licence never renders. */\n mayRender: boolean\n /** Whole days from today to `expiresOn` (negative once expired); absent when no expiry is recorded. */\n daysToExpiry?: number\n /** Whole days since `checkedOn`; absent when the licence has never been checked. */\n daysSinceChecked?: number\n}\n\nexport interface BrandlabProofReference {\n id: string\n kind: 'project' | 'review' | 'accreditation' | 'licence' | 'external-source'\n evidence: EvidenceReference\n}\n\nconst BRANDLAB_PROOF_KINDS = new Set<BrandlabProofReference['kind']>([\n 'project',\n 'review',\n 'accreditation',\n 'licence',\n 'external-source',\n])\nconst BRANDLAB_OPENING_HOURS_DAYS = new Set<BrandlabOpeningHoursDay>([\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n 'Sunday',\n])\n\nexport interface BrandlabBusiness {\n identity: {\n tradingName: BrandlabFact<string> & { status: 'verified' }\n legalName: BrandlabFact<string>\n }\n canonicalUrl: BrandlabFact<string> & { status: 'verified' }\n contact: {\n phone: BrandlabFact<BrandlabPhoneNumber>\n email: BrandlabFact<string>\n }\n location: {\n model: 'service-area' | 'physical-location' | 'hybrid'\n addressVisibility: 'public' | 'hidden' | 'not-applicable'\n address: BrandlabFact<BrandlabPostalAddress>\n serviceAreas: BrandlabFact<readonly BrandlabServiceArea[]>\n }\n openingHours: BrandlabFact<readonly BrandlabOpeningHours[]>\n registration: {\n abn: BrandlabFact<string>\n licences: BrandlabFact<readonly BrandlabLicence[]>\n }\n externalEntities: {\n googlePlaceId: BrandlabFact<string>\n sameAs: BrandlabFact<readonly string[]>\n }\n /** Optional structured proof references for projects that use them operationally. */\n proof?: BrandlabFact<readonly BrandlabProofReference[]>\n /** Insurance, qualifications, experience and the established date, each with its evidence (3.14.0). */\n credentials?: BrandlabBusinessCredentials\n}\n\nexport interface BrandlabDerivedBusinessFacts {\n tradingName: string\n legalName?: string\n canonicalUrl: string\n canonicalDomain: string\n phone?: BrandlabPhoneNumber & {\n digits: string\n /**\n * An Australian 13, 1300 or 1800 number: callable only within Australia\n * and only as dialled nationally.\n */\n nonGeographic: boolean\n /** `tel:+61…` for landline and mobile numbers; the national digits (`tel:1300329600`) for a non-geographic number. */\n telHref: string\n /** Schema.org `telephone`: E.164 for landline and mobile numbers, the displayed number for a non-geographic one. */\n schemaTelephone: string\n }\n email?: string\n publicAddress?: BrandlabPostalAddress\n serviceAreas: readonly BrandlabServiceArea[]\n openingHours: readonly BrandlabOpeningHours[]\n abn?: string\n licences: readonly BrandlabLicence[]\n googlePlaceId?: string\n sameAs: readonly string[]\n proof: readonly BrandlabProofReference[]\n}\n\nexport function verifiedFact<T>(\n value: T,\n evidence: EvidenceReference,\n): VerifiedFact<T> {\n return {\n status: 'verified',\n value,\n evidence,\n }\n}\n\nexport function unknownFact<T>(): BrandlabFact<T> {\n return { status: 'unknown' }\n}\n\nexport function notApplicableFact<T>(reason: string): BrandlabFact<T> {\n return { status: 'not-applicable', reason }\n}\n\nexport function resolveVerifiedFactForSurface<T>(\n fact: BrandlabFact<T>,\n surface: BrandlabEvidenceSurface,\n asOf: Date = new Date(),\n): T | undefined {\n if (fact.status !== 'verified') return undefined\n if (!fact.evidence.allowedSurfaces.includes(surface)) return undefined\n if (\n fact.evidence.expiresAt &&\n Date.parse(fact.evidence.expiresAt) < asOf.getTime()\n ) {\n return undefined\n }\n return fact.value\n}\n\nconst SYDNEY_DATE = new Intl.DateTimeFormat('en-CA', {\n timeZone: 'Australia/Sydney',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n})\n\n/** Today's calendar date in Sydney as YYYY-MM-DD: a licence is valid through its expiry date there. */\nfunction sydneyCalendarDate(asOf: Date): string {\n return SYDNEY_DATE.format(asOf)\n}\n\nfunction wholeDaysBetween(from: string, to: string): number {\n return Math.round((Date.parse(`${to}T00:00:00Z`) - Date.parse(`${from}T00:00:00Z`)) / 86_400_000)\n}\n\n/**\n * Whether a licence may render and in what state: `expired` once today (Sydney) is past `expiresOn`, which never\n * renders; `unchecked` when the register has not been checked, or not within 30 days; `expiring` within 60 days of\n * `expiresOn`; otherwise `current`. A licence without the 3.8.0 fields has no expiry to pass, and is `unchecked`.\n * Only an expired licence is held back: the other states render and tell the caller what to re-check.\n */\nexport function licenceRenderState(\n licence: Pick<BrandlabLicence, 'expiresOn' | 'checkedOn'>,\n asOf: Date = new Date(),\n): BrandlabLicenceRenderStatus {\n const today = sydneyCalendarDate(asOf)\n const daysToExpiry = licence.expiresOn !== undefined ? wholeDaysBetween(today, licence.expiresOn) : undefined\n const daysSinceChecked = licence.checkedOn !== undefined ? wholeDaysBetween(licence.checkedOn, today) : undefined\n const details = {\n ...(daysToExpiry !== undefined ? { daysToExpiry } : {}),\n ...(daysSinceChecked !== undefined ? { daysSinceChecked } : {}),\n }\n if (daysToExpiry !== undefined && daysToExpiry < 0) return { state: 'expired', mayRender: false, ...details }\n if (daysSinceChecked === undefined || daysSinceChecked > BRANDLAB_LICENCE_CHECK_MAX_AGE_DAYS) {\n return { state: 'unchecked', mayRender: true, ...details }\n }\n if (daysToExpiry !== undefined && daysToExpiry <= BRANDLAB_LICENCE_EXPIRY_WARNING_DAYS) {\n return { state: 'expiring', mayRender: true, ...details }\n }\n return { state: 'current', mayRender: true, ...details }\n}\n\n/** The licences a page may show: every licence except the expired ones. */\nexport function renderableLicences<T extends Pick<BrandlabLicence, 'expiresOn' | 'checkedOn'>>(\n licences: readonly T[],\n asOf: Date = new Date(),\n): T[] {\n return licences.filter((licence) => licenceRenderState(licence, asOf).mayRender)\n}\n\nfunction assertText(value: unknown, field: string, maximum = 500) {\n if (\n typeof value !== 'string' ||\n !value.trim() ||\n value.trim() !== value ||\n value.length > maximum ||\n /[\\u0000-\\u001f\\u007f]/.test(value)\n ) {\n throw new Error(`${field} must be bounded, trimmed text.`)\n }\n}\n\nfunction assertDate(value: string | undefined, field: string) {\n if (\n value !== undefined &&\n (!/^\\d{4}-\\d{2}-\\d{2}(?:T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z)?$/.test(value) ||\n Number.isNaN(Date.parse(value)))\n ) {\n throw new Error(`${field} must be a valid ISO date or UTC timestamp.`)\n }\n}\n\nconst BRANDLAB_EVIDENCE_SOURCE_KIND_SET = new Set<BrandlabEvidenceSourceKind>(\n BRANDLAB_EVIDENCE_SOURCE_KINDS,\n)\nconst BRANDLAB_EVIDENCE_SURFACE_SET = new Set<BrandlabEvidenceSurface>(\n BRANDLAB_EVIDENCE_SURFACES,\n)\nconst CIRCULAR_EVIDENCE_PREFIX =\n /^(?:existing-production-config|repository-config|source-code):/i\n\nfunction assertEvidenceReference(\n evidence: EvidenceReference,\n field: string,\n) {\n assertExactKeys(\n evidence,\n ['sourceKind', 'reference', 'verifiedAt', 'expiresAt', 'allowedSurfaces'],\n field,\n )\n if (!BRANDLAB_EVIDENCE_SOURCE_KIND_SET.has(evidence.sourceKind)) {\n throw new Error(`${field}.sourceKind is invalid.`)\n }\n assertText(evidence.reference, `${field}.reference`)\n if (CIRCULAR_EVIDENCE_PREFIX.test(evidence.reference)) {\n throw new Error(\n `${field}.reference cannot cite repository configuration as independent verification.`,\n )\n }\n assertDate(evidence.verifiedAt, `${field}.verifiedAt`)\n assertDate(evidence.expiresAt, `${field}.expiresAt`)\n if (\n evidence.expiresAt &&\n Date.parse(evidence.expiresAt) < Date.parse(evidence.verifiedAt)\n ) {\n throw new Error(`${field}.expiresAt cannot precede verifiedAt.`)\n }\n if (\n !Array.isArray(evidence.allowedSurfaces) ||\n evidence.allowedSurfaces.length === 0\n ) {\n throw new Error(`${field}.allowedSurfaces cannot be empty.`)\n }\n assertUniqueStrings(evidence.allowedSurfaces, `${field}.allowedSurfaces`)\n if (\n evidence.allowedSurfaces.some(\n (surface) => !BRANDLAB_EVIDENCE_SURFACE_SET.has(surface),\n )\n ) {\n throw new Error(`${field}.allowedSurfaces contains an invalid surface.`)\n }\n}\n\nfunction assertExactKeys(\n value: unknown,\n allowed: readonly string[],\n field: string,\n) {\n if (\n !value ||\n typeof value !== 'object' ||\n Array.isArray(value) ||\n ![Object.prototype, null].includes(Object.getPrototypeOf(value))\n ) {\n throw new Error(`${field} must be a plain object.`)\n }\n const unknown = Object.keys(value).find((key) => !allowed.includes(key))\n if (unknown) throw new Error(`${field}.${unknown} is not a supported business fact key.`)\n}\n\nfunction assertFact<T>(fact: BrandlabFact<T>, field: string, validate?: (value: T) => void) {\n if (!fact || typeof fact !== 'object' || Array.isArray(fact)) {\n throw new Error(`${field} must be a typed Brandlab fact.`)\n }\n const record = fact as BrandlabFact<T> & Record<string, unknown>\n if (record.status === 'verified') {\n const verified = record as Extract<BrandlabFact<T>, { status: 'verified' }> &\n Record<string, unknown>\n if (!Object.prototype.hasOwnProperty.call(verified, 'value') || verified.value === undefined) {\n throw new Error(`${field}.value is required for a verified fact.`)\n }\n assertExactKeys(verified, ['status', 'value', 'evidence'], field)\n assertEvidenceReference(verified.evidence, `${field}.evidence`)\n if (typeof verified.value === 'string') assertText(verified.value, `${field}.value`)\n validate?.(verified.value)\n } else if (record.status === 'unknown') {\n if (Object.prototype.hasOwnProperty.call(record, 'value')) {\n throw new Error(`${field} cannot carry a value while its status is unknown.`)\n }\n assertExactKeys(record, ['status'], field)\n } else if (record.status === 'not-applicable') {\n if (Object.prototype.hasOwnProperty.call(record, 'value')) {\n throw new Error(`${field} cannot carry a value while it is not applicable.`)\n }\n assertExactKeys(record, ['status', 'reason'], field)\n assertText(record.reason, `${field}.reason`)\n } else {\n throw new Error(`${field}.status must be verified, unknown or not-applicable.`)\n }\n}\n\nfunction assertAbsoluteHttpsUrl(value: string, field: string, requireOrigin = false) {\n let url: URL\n try {\n url = new URL(value)\n } catch {\n throw new Error(`${field} must be an absolute HTTPS URL.`)\n }\n\n if (\n url.protocol !== 'https:' ||\n url.username ||\n url.password ||\n (requireOrigin && (url.pathname !== '/' || url.search || url.hash))\n ) {\n throw new Error(`${field} must be an absolute HTTPS URL.`)\n }\n}\n\nfunction assertUniqueStrings(values: readonly string[], field: string) {\n const duplicate = values.find((value, index) => values.indexOf(value) !== index)\n if (duplicate) throw new Error(`${field} contains duplicate value \"${duplicate}\".`)\n}\n\nfunction assertTime(value: string, field: string) {\n if (!/^(?:[01]\\d|2[0-3]):[0-5]\\d$/.test(value)) {\n throw new Error(`${field} must use a valid 24-hour HH:MM time.`)\n }\n}\n\nfunction assertAddress(address: BrandlabPostalAddress) {\n assertExactKeys(\n address,\n [\n 'streetAddress',\n 'addressLocality',\n 'addressRegion',\n 'postalCode',\n 'addressCountry',\n ],\n 'location.address.value',\n )\n Object.entries(address).forEach(([field, value]) =>\n assertText(value, `location.address.value.${field}`, 200),\n )\n if (address.addressCountry !== 'AU') {\n throw new Error('location.address.value.addressCountry must be \"AU\".')\n }\n if (!/^[A-Z]{2,3}$/.test(address.addressRegion)) {\n throw new Error('location.address.value.addressRegion must be an uppercase Australian region.')\n }\n if (!/^\\d{4}$/.test(address.postalCode)) {\n throw new Error('location.address.value.postalCode must be a four-digit Australian postcode.')\n }\n}\n\n/** Landline and mobile numbers: +61 then a 2, 3, 4, 7 or 8 area or mobile prefix. */\nconst AUSTRALIAN_GEOGRAPHIC_E164 = /^\\+61[23478]\\d{8}$/\n/** Non-geographic numbers: 13 xx xx, 1300 xxx xxx and 1800 xxx xxx. */\nconst AUSTRALIAN_NON_GEOGRAPHIC_E164 = /^\\+61(?:1[38]00\\d{6}|13(?!00)\\d{4})$/\n\nfunction isNonGeographicPhone(e164: string) {\n return AUSTRALIAN_NON_GEOGRAPHIC_E164.test(e164)\n}\n\nfunction assertPhone(phone: BrandlabPhoneNumber) {\n assertExactKeys(phone, ['display', 'e164'], 'contact.phone.value')\n assertText(phone.display, 'contact.phone.value.display')\n if (\n phone.display.trim() !== phone.display ||\n phone.display.length > 32 ||\n !/^[+()\\d\\s.-]+$/.test(phone.display)\n ) {\n throw new Error('contact.phone.value.display must be a bounded Australian phone number.')\n }\n const nonGeographic = isNonGeographicPhone(phone.e164)\n if (!nonGeographic && !AUSTRALIAN_GEOGRAPHIC_E164.test(phone.e164)) {\n throw new Error(\n 'contact.phone.value.e164 must be a valid Australian E.164 number: a landline or mobile, or a 13, 1300 or 1800 number.',\n )\n }\n const national = phone.e164.slice(3)\n const displayDigits = phone.display.replace(/\\D/g, '')\n // A landline or mobile shows its trunk 0 or +61; a non-geographic number is shown as dialled.\n const sameNumber = displayDigits === `61${national}` ||\n displayDigits === (nonGeographic ? national : `0${national}`)\n if (!sameNumber) {\n throw new Error('contact.phone.value.display must identify the same number as e164.')\n }\n}\n\nfunction assertEmail(email: string) {\n if (\n email.length > 254 ||\n email.trim() !== email ||\n /[\\u0000-\\u001f\\u007f]/.test(email) ||\n !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email)\n ) {\n throw new Error('contact.email.value must be a valid email address.')\n }\n}\n\nfunction normalizeAbn(value: string) {\n return value.replace(/\\s/g, '')\n}\n\nfunction assertAbn(value: string) {\n const digits = normalizeAbn(value)\n if (!/^\\d{11}$/.test(digits) || !/^\\d{2}(?: \\d{3}){3}$|^\\d{11}$/.test(value)) {\n throw new Error('registration.abn.value must be an 11-digit Australian Business Number.')\n }\n const weights = [10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]\n const numbers = [...digits].map(Number)\n numbers[0] = numbers[0]! - 1\n const checksum = numbers.reduce(\n (sum, digit, index) => sum + digit * weights[index]!,\n 0,\n )\n if (checksum % 89 !== 0) {\n throw new Error('registration.abn.value has an invalid ABN checksum.')\n }\n}\n\nfunction assertUniqueIds(records: readonly { id: string }[], field: string) {\n records.forEach((record, index) => assertText(record.id, `${field}[${index}].id`))\n const duplicate = records.find((record, index) =>\n records.slice(0, index).some((candidate) => candidate.id === record.id),\n )\n if (duplicate) throw new Error(`${field} contains duplicate ID \"${duplicate.id}\".`)\n}\n\nexport function defineBrandlabBusiness<const T extends BrandlabBusiness>(business: T): T {\n assertExactKeys(\n business,\n [\n 'identity',\n 'canonicalUrl',\n 'contact',\n 'location',\n 'openingHours',\n 'registration',\n 'externalEntities',\n 'proof',\n 'credentials',\n ],\n 'business',\n )\n assertExactKeys(business.identity, ['tradingName', 'legalName'], 'identity')\n assertExactKeys(business.contact, ['phone', 'email'], 'contact')\n assertExactKeys(\n business.location,\n ['model', 'addressVisibility', 'address', 'serviceAreas'],\n 'location',\n )\n assertExactKeys(business.registration, ['abn', 'licences'], 'registration')\n assertExactKeys(\n business.externalEntities,\n ['googlePlaceId', 'sameAs'],\n 'externalEntities',\n )\n if (!['service-area', 'physical-location', 'hybrid'].includes(business.location.model)) {\n throw new Error('location.model is invalid.')\n }\n if (!['public', 'hidden', 'not-applicable'].includes(business.location.addressVisibility)) {\n throw new Error('location.addressVisibility is invalid.')\n }\n assertFact(business.identity.tradingName, 'identity.tradingName')\n assertFact(business.identity.legalName, 'identity.legalName')\n assertFact(business.canonicalUrl, 'canonicalUrl', (value) =>\n assertAbsoluteHttpsUrl(value, 'canonicalUrl.value', true),\n )\n assertFact(business.contact.phone, 'contact.phone', assertPhone)\n assertFact(business.contact.email, 'contact.email', assertEmail)\n assertFact(business.location.address, 'location.address', assertAddress)\n assertFact(business.location.serviceAreas, 'location.serviceAreas', assertServiceAreas)\n assertFact(business.openingHours, 'openingHours', assertOpeningHours)\n assertFact(business.registration.abn, 'registration.abn', assertAbn)\n assertFact(business.registration.licences, 'registration.licences', assertLicences)\n assertFact(business.externalEntities.googlePlaceId, 'externalEntities.googlePlaceId')\n assertFact(business.externalEntities.sameAs, 'externalEntities.sameAs', assertSameAs)\n if (business.proof) {\n assertFact(business.proof, 'proof', (proof) => {\n assertUniqueIds(proof, 'proof.value')\n proof.forEach((item, index) => {\n assertExactKeys(\n item,\n ['id', 'kind', 'evidence'],\n `proof.value[${index}]`,\n )\n if (!BRANDLAB_PROOF_KINDS.has(item.kind)) {\n throw new Error(`proof.value[${index}].kind is invalid.`)\n }\n assertEvidenceReference(\n item.evidence,\n `proof.value[${index}].evidence`,\n )\n })\n })\n }\n\n if (business.credentials !== undefined) assertCredentials(business.credentials, 'credentials')\n\n assertLocationModel({\n model: business.location.model,\n addressVisibility: business.location.addressVisibility,\n address: verifiedValue(business.location.address),\n serviceAreas: verifiedValue(business.location.serviceAreas),\n })\n\n return business\n}\n\nfunction assertLocationModel(location: BrandlabBusinessFactValues['location']) {\n if (location.addressVisibility === 'not-applicable' && location.address) {\n throw new Error('A verified address cannot use addressVisibility \"not-applicable\".')\n }\n if (location.addressVisibility === 'public' && !location.address) {\n throw new Error('A public address must have verified address facts.')\n }\n if (location.model === 'service-area' && location.addressVisibility === 'public') {\n throw new Error('A service-area business cannot expose a public address.')\n }\n if (location.model === 'physical-location' && location.addressVisibility !== 'public') {\n throw new Error('A physical-location business must expose its verified public address.')\n }\n if (\n (location.model === 'service-area' || location.model === 'hybrid') &&\n (!location.serviceAreas || location.serviceAreas.length === 0)\n ) {\n throw new Error('Service-area and hybrid businesses require verified service areas.')\n }\n}\n\nfunction assertServiceAreas(areas: readonly BrandlabServiceArea[]) {\n assertUniqueIds(areas, 'location.serviceAreas.value')\n areas.forEach((area, index) => {\n assertExactKeys(\n area,\n ['id', 'name', 'kind'],\n `location.serviceAreas.value[${index}]`,\n )\n assertText(area.name, `location.serviceAreas.value[${index}].name`)\n if (area.name.trim() !== area.name || area.name.length > 160) {\n throw new Error(`location.serviceAreas.value[${index}].name must be bounded canonical text.`)\n }\n if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(area.id)) {\n throw new Error(`location.serviceAreas.value[${index}].id must be lowercase kebab-case.`)\n }\n if (!['city', 'region', 'suburb', 'state', 'country'].includes(area.kind)) {\n throw new Error(`location.serviceAreas.value[${index}].kind is invalid.`)\n }\n })\n}\n\nfunction assertOpeningHours(hours: readonly BrandlabOpeningHours[]) {\n const allDays: BrandlabOpeningHoursDay[] = []\n hours.forEach((period, index) => {\n assertExactKeys(\n period,\n ['days', 'opens', 'closes'],\n `openingHours.value[${index}]`,\n )\n if (period.days.length === 0) {\n throw new Error(`openingHours.value[${index}].days cannot be empty.`)\n }\n assertUniqueStrings(period.days, `openingHours.value[${index}].days`)\n if (period.days.some((day) => !BRANDLAB_OPENING_HOURS_DAYS.has(day))) {\n throw new Error(`openingHours.value[${index}].days contains an invalid day.`)\n }\n allDays.push(...period.days)\n assertTime(period.opens, `openingHours.value[${index}].opens`)\n assertTime(period.closes, `openingHours.value[${index}].closes`)\n })\n assertUniqueStrings(allDays, 'openingHours.value.days')\n}\n\nconst BRANDLAB_LICENCE_HOLDER_TYPE_SET = new Set<string>(BRANDLAB_LICENCE_HOLDER_TYPES)\n\nfunction assertIsoDay(value: unknown, field: string) {\n if (\n typeof value !== 'string' ||\n !/^\\d{4}-\\d{2}-\\d{2}$/.test(value) ||\n Number.isNaN(Date.parse(`${value}T00:00:00Z`)) ||\n new Date(`${value}T00:00:00Z`).toISOString().slice(0, 10) !== value\n ) {\n throw new Error(`${field} must be a valid ISO date (YYYY-MM-DD).`)\n }\n}\n\nfunction assertLicenceClasses(classes: readonly BrandlabLicenceClass[], field: string) {\n if (!Array.isArray(classes) || classes.length === 0) {\n throw new Error(`${field} cannot be empty.`)\n }\n classes.forEach((licenceClass, index) => {\n assertExactKeys(licenceClass, ['name', 'conditions'], `${field}[${index}]`)\n assertText(licenceClass.name, `${field}[${index}].name`, 160)\n const conditions: unknown = licenceClass.conditions\n if (conditions !== undefined) {\n if (!Array.isArray(conditions) || conditions.length === 0) {\n throw new Error(`${field}[${index}].conditions cannot be empty when present.`)\n }\n conditions.forEach((condition: unknown, conditionIndex: number) =>\n assertText(condition, `${field}[${index}].conditions[${conditionIndex}]`, 300),\n )\n }\n })\n assertUniqueStrings(\n classes.map((licenceClass) => licenceClass.name.toLowerCase()),\n `${field}.names`,\n )\n}\n\nfunction assertHbcCertificates(certificates: readonly BrandlabHbcCertificate[], field: string) {\n if (!Array.isArray(certificates) || certificates.length === 0) {\n throw new Error(`${field} cannot be empty when present.`)\n }\n certificates.forEach((certificate, index) => {\n assertExactKeys(certificate, ['reference', 'insurer', 'expiresOn'], `${field}[${index}]`)\n assertText(certificate.reference, `${field}[${index}].reference`, 120)\n if (certificate.insurer !== undefined) assertText(certificate.insurer, `${field}[${index}].insurer`, 120)\n if (certificate.expiresOn !== undefined) assertIsoDay(certificate.expiresOn, `${field}[${index}].expiresOn`)\n })\n}\n\nfunction assertLicences(licences: readonly BrandlabLicence[]) {\n assertUniqueStrings(\n licences.map((licence) => licence.identifier),\n 'registration.licences.value.identifiers',\n )\n licences.forEach((licence, index) => {\n const field = `registration.licences.value[${index}]`\n assertExactKeys(\n licence,\n [\n 'name',\n 'identifier',\n 'jurisdiction',\n 'holderType',\n 'licensee',\n 'classes',\n 'regulator',\n 'hbcCertificates',\n 'expiresOn',\n 'registerUrl',\n 'checkedOn',\n ],\n field,\n )\n assertText(licence.name, `${field}.name`)\n assertText(licence.identifier, `${field}.identifier`)\n if (licence.jurisdiction !== undefined) {\n assertText(licence.jurisdiction, `${field}.jurisdiction`, 120)\n }\n if (licence.holderType !== undefined && !BRANDLAB_LICENCE_HOLDER_TYPE_SET.has(licence.holderType)) {\n throw new Error(`${field}.holderType must be \"person\" or \"company\".`)\n }\n if (licence.licensee !== undefined) assertText(licence.licensee, `${field}.licensee`, 200)\n if (licence.classes !== undefined) assertLicenceClasses(licence.classes, `${field}.classes`)\n if (licence.regulator !== undefined) assertText(licence.regulator, `${field}.regulator`, 120)\n if (licence.hbcCertificates !== undefined) {\n assertHbcCertificates(licence.hbcCertificates, `${field}.hbcCertificates`)\n }\n if (licence.expiresOn !== undefined) assertIsoDay(licence.expiresOn, `${field}.expiresOn`)\n if (licence.registerUrl !== undefined) assertAbsoluteHttpsUrl(licence.registerUrl, `${field}.registerUrl`)\n if (licence.checkedOn !== undefined) assertIsoDay(licence.checkedOn, `${field}.checkedOn`)\n })\n}\n\nfunction assertSameAs(urls: readonly string[]) {\n assertUniqueStrings(urls, 'externalEntities.sameAs.value')\n urls.forEach((url, index) =>\n assertAbsoluteHttpsUrl(url, `externalEntities.sameAs.value[${index}]`),\n )\n}\n\nfunction verifiedValue<T>(fact: BrandlabFact<T>): T | undefined {\n return fact.status === 'verified' ? fact.value : undefined\n}\n\n/**\n * The business facts as a site displays them: the verified values without their\n * evidence (unknown and not-applicable facts are absent). Client components read\n * these from `src/data/business.ts`; the evidence stays in the server-only\n * `src/data/businessEvidence.ts`, which declares the facts over these values with\n * `defineBrandlabBusiness` (3.2.1).\n */\nexport interface BrandlabBusinessFactValues {\n identity: { tradingName: string; legalName?: string }\n canonicalUrl: string\n contact?: { phone?: BrandlabPhoneNumber; email?: string }\n location: {\n model: BrandlabBusiness['location']['model']\n addressVisibility: BrandlabBusiness['location']['addressVisibility']\n address?: BrandlabPostalAddress\n serviceAreas?: readonly BrandlabServiceArea[]\n }\n openingHours?: readonly BrandlabOpeningHours[]\n registration?: { abn?: string; licences?: readonly BrandlabLicence[] }\n externalEntities?: { googlePlaceId?: string; sameAs?: readonly string[] }\n}\n\nfunction factValues(business: BrandlabBusiness): BrandlabBusinessFactValues {\n return {\n identity: {\n tradingName: business.identity.tradingName.value,\n ...(verifiedValue(business.identity.legalName) !== undefined ? { legalName: verifiedValue(business.identity.legalName)! } : {}),\n },\n canonicalUrl: business.canonicalUrl.value,\n contact: {\n ...(verifiedValue(business.contact.phone) ? { phone: verifiedValue(business.contact.phone)! } : {}),\n ...(verifiedValue(business.contact.email) !== undefined ? { email: verifiedValue(business.contact.email)! } : {}),\n },\n location: {\n model: business.location.model,\n addressVisibility: business.location.addressVisibility,\n ...(verifiedValue(business.location.address) ? { address: verifiedValue(business.location.address)! } : {}),\n ...(verifiedValue(business.location.serviceAreas) ? { serviceAreas: verifiedValue(business.location.serviceAreas)! } : {}),\n },\n ...(verifiedValue(business.openingHours) ? { openingHours: verifiedValue(business.openingHours)! } : {}),\n registration: {\n ...(verifiedValue(business.registration.abn) !== undefined ? { abn: verifiedValue(business.registration.abn)! } : {}),\n ...(verifiedValue(business.registration.licences) ? { licences: verifiedValue(business.registration.licences)! } : {}),\n },\n externalEntities: {\n ...(verifiedValue(business.externalEntities.googlePlaceId) !== undefined ? { googlePlaceId: verifiedValue(business.externalEntities.googlePlaceId)! } : {}),\n ...(verifiedValue(business.externalEntities.sameAs) ? { sameAs: verifiedValue(business.externalEntities.sameAs)! } : {}),\n },\n }\n}\n\nfunction deriveFromValues(values: BrandlabBusinessFactValues): Omit<BrandlabDerivedBusinessFacts, 'proof'> {\n const canonicalUrl = new URL(values.canonicalUrl).origin\n const phone = values.contact?.phone\n const address = values.location.address\n\n return {\n tradingName: values.identity.tradingName,\n ...(values.identity.legalName !== undefined\n ? { legalName: values.identity.legalName }\n : {}),\n canonicalUrl,\n canonicalDomain: new URL(canonicalUrl).hostname,\n ...(phone\n ? {\n phone: {\n ...phone,\n digits: phone.e164.replace(/\\D/g, ''),\n nonGeographic: isNonGeographicPhone(phone.e164),\n // 13, 1300 and 1800 numbers cannot be dialled in international form.\n telHref: isNonGeographicPhone(phone.e164) ? `tel:${phone.e164.slice(3)}` : `tel:${phone.e164}`,\n schemaTelephone: isNonGeographicPhone(phone.e164) ? phone.display : phone.e164,\n },\n }\n : {}),\n ...(values.contact?.email !== undefined\n ? { email: values.contact.email.trim().toLowerCase() }\n : {}),\n ...(values.location.addressVisibility === 'public' && address\n ? { publicAddress: address }\n : {}),\n serviceAreas: values.location.serviceAreas ?? [],\n openingHours: values.openingHours ?? [],\n ...(values.registration?.abn !== undefined\n ? { abn: normalizeAbn(values.registration.abn) }\n : {}),\n licences: values.registration?.licences ?? [],\n ...(values.externalEntities?.googlePlaceId !== undefined\n ? { googlePlaceId: values.externalEntities.googlePlaceId }\n : {}),\n sameAs: values.externalEntities?.sameAs ?? [],\n }\n}\n\nexport function deriveBusinessFacts(business: BrandlabBusiness): BrandlabDerivedBusinessFacts {\n defineBrandlabBusiness(business)\n return {\n ...deriveFromValues(factValues(business)),\n proof: business.proof ? verifiedValue(business.proof) ?? [] : [],\n }\n}\n\n/**\n * What `deriveBusinessFacts` gives, from the display values alone (3.2.1), for\n * the client-safe modules that derive links and labels from the facts. The values\n * are checked as `defineBrandlabBusiness` checks the facts; proof references carry\n * evidence, so they are never part of the display values (`proof` is empty).\n */\nexport function deriveBusinessDisplayFacts(values: BrandlabBusinessFactValues): BrandlabDerivedBusinessFacts {\n assertBusinessFactValues(values)\n return { ...deriveFromValues(values), proof: [] }\n}\n\nfunction assertBusinessFactValues(values: BrandlabBusinessFactValues) {\n if (!values || typeof values !== 'object') throw new Error('The business fact values must be an object.')\n assertExactKeys(values, ['identity', 'canonicalUrl', 'contact', 'location', 'openingHours', 'registration', 'externalEntities'], 'business values')\n assertExactKeys(values.identity, ['tradingName', 'legalName'], 'identity')\n assertText(values.identity.tradingName, 'identity.tradingName.value')\n if (values.identity.legalName !== undefined) assertText(values.identity.legalName, 'identity.legalName.value')\n assertText(values.canonicalUrl, 'canonicalUrl.value')\n assertAbsoluteHttpsUrl(values.canonicalUrl, 'canonicalUrl.value', true)\n if (values.contact !== undefined) {\n assertExactKeys(values.contact, ['phone', 'email'], 'contact')\n if (values.contact.phone !== undefined) assertPhone(values.contact.phone)\n if (values.contact.email !== undefined) assertEmail(values.contact.email)\n }\n assertExactKeys(values.location, ['model', 'addressVisibility', 'address', 'serviceAreas'], 'location')\n if (!['service-area', 'physical-location', 'hybrid'].includes(values.location.model)) {\n throw new Error('location.model is invalid.')\n }\n if (!['public', 'hidden', 'not-applicable'].includes(values.location.addressVisibility)) {\n throw new Error('location.addressVisibility is invalid.')\n }\n if (values.location.address !== undefined) assertAddress(values.location.address)\n if (values.location.serviceAreas !== undefined) assertServiceAreas(values.location.serviceAreas)\n if (values.openingHours !== undefined) assertOpeningHours(values.openingHours)\n if (values.registration !== undefined) {\n assertExactKeys(values.registration, ['abn', 'licences'], 'registration')\n if (values.registration.abn !== undefined) assertAbn(values.registration.abn)\n if (values.registration.licences !== undefined) assertLicences(values.registration.licences)\n }\n if (values.externalEntities !== undefined) {\n assertExactKeys(values.externalEntities, ['googlePlaceId', 'sameAs'], 'externalEntities')\n if (values.externalEntities.googlePlaceId !== undefined) assertText(values.externalEntities.googlePlaceId, 'externalEntities.googlePlaceId.value')\n if (values.externalEntities.sameAs !== undefined) assertSameAs(values.externalEntities.sameAs)\n }\n assertLocationModel(values.location)\n}\n\n// ---------------------------------------------------------------------------\n// Credentials: insurance, qualifications, experience, established (3.14.0)\n// ---------------------------------------------------------------------------\n\n/** The insurance covers a site may name. */\nexport const BRANDLAB_INSURANCE_COVERS = ['public-liability', 'professional-indemnity', 'workers-compensation'] as const\nexport type BrandlabInsuranceCover = (typeof BRANDLAB_INSURANCE_COVERS)[number]\n\n/** Whose experience a years figure is: the practitioner's (never claimed as the company's) or the business's own. */\nexport const BRANDLAB_EXPERIENCE_HOLDERS = ['practitioner', 'business'] as const\nexport type BrandlabExperienceHolder = (typeof BRANDLAB_EXPERIENCE_HOLDERS)[number]\n\n/**\n * What every credential carries: the claims-register entry that approves its wording (`docs/claims-register.md`, for\n * example AA's \"CLM-22\") and the evidence for it. The evidence's `allowedSurfaces` and `expiresAt` decide where and\n * until when it renders.\n */\nexport interface BrandlabCredentialClaim {\n /** The claims-register id, for example \"CLM-21\": capital letters, a hyphen and a number. */\n claimId: string\n evidence: EvidenceReference\n}\n\nexport interface BrandlabInsurance {\n cover: BrandlabInsuranceCover\n /** The cover in whole Australian dollars, for example 20_000_000. */\n amountAud: number\n insurer?: string\n /** YYYY-MM-DD the policy (certificate of currency) runs to; from the day after, it never renders. */\n expiresOn?: string\n}\n\n/** A qualification as the business may state it, without a person's name (\"AQF Level 3-qualified arborist\"). */\nexport interface BrandlabQualification {\n title: string\n}\n\n/** \"More than {years} years of {field} experience\": at least this many whole years, as the evidence recorded them. */\nexport interface BrandlabExperience {\n years: number\n holder: BrandlabExperienceHolder\n /** The work, for example \"tree work\". */\n field: string\n}\n\n/** When the business was established (for example from the ABN's active-from date). */\nexport interface BrandlabEstablishment {\n year: number\n /** 1 to 12, when known. */\n month?: number\n}\n\n/**\n * After-hours work the business really does (3.15.0), recorded in the claims register like any credential: what the\n * work is and, for a seasonal offer such as a storm season, the last day it runs. `EmergencyBand` renders only while a\n * renderable entry exists; it never carries a response time, which no entry records.\n */\nexport interface BrandlabAfterHours {\n /** The work done after hours, for example \"fallen and storm-damaged trees\". */\n work: string\n /** YYYY-MM-DD the offer ends (a storm season); from the day after (Sydney), it never renders. */\n endsOn?: string\n}\n\n/**\n * The credentials a site may show (3.14.0). Each entry has its own claim id and evidence, so an owner-confirmed figure\n * and a certificate-backed one are recorded side by side. Nothing renders without evidence: read them for a page with\n * `renderableCredentials`.\n */\nexport interface BrandlabBusinessCredentials {\n insurance?: readonly (BrandlabInsurance & BrandlabCredentialClaim)[]\n qualifications?: readonly (BrandlabQualification & BrandlabCredentialClaim)[]\n experience?: readonly (BrandlabExperience & BrandlabCredentialClaim)[]\n established?: BrandlabEstablishment & BrandlabCredentialClaim\n /** After-hours work (3.15.0). */\n afterHours?: BrandlabAfterHours & BrandlabCredentialClaim\n}\n\n/** The credentials a surface may show, without their evidence. */\nexport interface BrandlabRenderableCredentials {\n insurance: readonly (BrandlabInsurance & { claimId: string })[]\n qualifications: readonly (BrandlabQualification & { claimId: string })[]\n experience: readonly (BrandlabExperience & { claimId: string })[]\n established?: BrandlabEstablishment & { claimId: string }\n afterHours?: BrandlabAfterHours & { claimId: string }\n}\n\nconst CLAIM_ID = /^[A-Z][A-Z0-9]*-\\d+$/\n\nfunction assertClaim(claim: BrandlabCredentialClaim, field: string) {\n if (typeof claim.claimId !== 'string' || !CLAIM_ID.test(claim.claimId)) {\n throw new Error(`${field}.claimId must be the claims-register id, such as \"CLM-21\".`)\n }\n assertEvidenceReference(claim.evidence, `${field}.evidence`)\n}\n\nfunction assertCredentialList<T>(\n list: readonly T[] | undefined,\n field: string,\n keys: readonly string[],\n validate: (entry: T, field: string) => void,\n) {\n if (list === undefined) return\n if (!Array.isArray(list)) throw new Error(`${field} must be a list.`)\n list.forEach((entry, index) => {\n const entryField = `${field}[${index}]`\n assertExactKeys(entry, [...keys, 'claimId', 'evidence'], entryField)\n assertClaim(entry as BrandlabCredentialClaim, entryField)\n validate(entry, entryField)\n })\n}\n\nfunction assertCredentials(credentials: BrandlabBusinessCredentials, field: string) {\n assertExactKeys(credentials, ['insurance', 'qualifications', 'experience', 'established', 'afterHours'], field)\n assertCredentialList(credentials.insurance, `${field}.insurance`, ['cover', 'amountAud', 'insurer', 'expiresOn'], (entry, at) => {\n if (!(BRANDLAB_INSURANCE_COVERS as readonly string[]).includes(entry.cover)) {\n throw new Error(`${at}.cover must be one of ${BRANDLAB_INSURANCE_COVERS.join(', ')}.`)\n }\n if (!Number.isSafeInteger(entry.amountAud) || entry.amountAud <= 0) {\n throw new Error(`${at}.amountAud must be a whole number of dollars above zero.`)\n }\n if (entry.insurer !== undefined) assertText(entry.insurer, `${at}.insurer`, 120)\n if (entry.expiresOn !== undefined) assertIsoDay(entry.expiresOn, `${at}.expiresOn`)\n })\n assertCredentialList(credentials.qualifications, `${field}.qualifications`, ['title'], (entry, at) => {\n assertText(entry.title, `${at}.title`, 120)\n })\n assertCredentialList(credentials.experience, `${field}.experience`, ['years', 'holder', 'field'], (entry, at) => {\n if (!Number.isInteger(entry.years) || entry.years < 1 || entry.years > 80) {\n throw new Error(`${at}.years must be a whole number of years from 1 to 80.`)\n }\n if (!(BRANDLAB_EXPERIENCE_HOLDERS as readonly string[]).includes(entry.holder)) {\n throw new Error(`${at}.holder must be one of ${BRANDLAB_EXPERIENCE_HOLDERS.join(', ')}.`)\n }\n assertText(entry.field, `${at}.field`, 80)\n })\n const established = credentials.established\n if (established !== undefined) {\n const at = `${field}.established`\n assertExactKeys(established, ['year', 'month', 'claimId', 'evidence'], at)\n assertClaim(established, at)\n if (!Number.isInteger(established.year) || established.year < 1850) throw new Error(`${at}.year must be a four-digit year.`)\n if (established.month !== undefined && (!Number.isInteger(established.month) || established.month < 1 || established.month > 12)) {\n throw new Error(`${at}.month must be 1 to 12.`)\n }\n const verified = established.evidence.verifiedAt.slice(0, 7)\n const recorded = `${established.year}-${String(established.month ?? 1).padStart(2, '0')}`\n if (recorded > verified) throw new Error(`${at} is after the evidence for it was read (${established.evidence.verifiedAt}).`)\n }\n const afterHours = credentials.afterHours\n if (afterHours !== undefined) {\n const at = `${field}.afterHours`\n assertExactKeys(afterHours, ['work', 'endsOn', 'claimId', 'evidence'], at)\n assertClaim(afterHours, at)\n assertText(afterHours.work, `${at}.work`, 120)\n if (afterHours.endsOn !== undefined) assertIsoDay(afterHours.endsOn, `${at}.endsOn`)\n }\n}\n\n/** Validates a site's credentials (also checked inside `defineBrandlabBusiness`) and returns them unchanged. */\nexport function defineBusinessCredentials<const T extends BrandlabBusinessCredentials>(credentials: T): T {\n assertCredentials(credentials, 'credentials')\n return credentials\n}\n\nfunction claimMayRender(claim: BrandlabCredentialClaim, surface: BrandlabEvidenceSurface, asOf: Date): boolean {\n if (!claim.evidence.allowedSurfaces.includes(surface)) return false\n return !(claim.evidence.expiresAt && Date.parse(claim.evidence.expiresAt) < asOf.getTime())\n}\n\nfunction withoutEvidence<T extends BrandlabCredentialClaim>(entry: T): Omit<T, 'evidence'> {\n const { evidence: _evidence, ...rest } = entry\n return rest\n}\n\n/**\n * The credentials a surface may show on `asOf`: only entries whose evidence allows the surface and has not expired,\n * no insurance past its `expiresOn` and no after-hours offer past its `endsOn` (Sydney). The evidence stays behind; the claim id comes along so the page\n * can be traced to the register.\n */\nexport function renderableCredentials(\n credentials: BrandlabBusinessCredentials | undefined,\n surface: BrandlabEvidenceSurface,\n asOf: Date = new Date(),\n): BrandlabRenderableCredentials {\n const today = sydneyCalendarDate(asOf)\n const pick = <T extends BrandlabCredentialClaim>(list: readonly T[] | undefined) =>\n (list ?? []).filter((entry) => claimMayRender(entry, surface, asOf)).map(withoutEvidence)\n const established = credentials?.established\n const afterHours = credentials?.afterHours\n const afterHoursRuns = afterHours !== undefined && (afterHours.endsOn === undefined || afterHours.endsOn >= today)\n return {\n insurance: pick(credentials?.insurance).filter((entry) => entry.expiresOn === undefined || entry.expiresOn >= today),\n qualifications: pick(credentials?.qualifications),\n experience: pick(credentials?.experience),\n ...(established && claimMayRender(established, surface, asOf) ? { established: withoutEvidence(established) } : {}),\n ...(afterHours && afterHoursRuns && claimMayRender(afterHours, surface, asOf) ? { afterHours: withoutEvidence(afterHours) } : {}),\n }\n}\n\n/** A cover amount as copy says it: \"$20 million\", \"$2.5 million\", or the dollar figure under a million. */\nexport function formatInsuranceAmount(amountAud: number): string {\n if (amountAud >= 1_000_000) {\n const millions = Math.round((amountAud / 1_000_000) * 10) / 10\n return `$${millions.toLocaleString('en-AU')} million`\n }\n return `$${amountAud.toLocaleString('en-AU')}`\n}\n\n/** Whole years since the business was established, on `asOf` in Sydney; without a month only completed calendar years count. */\nexport function yearsSinceEstablished(established: BrandlabEstablishment, asOf: Date = new Date()): number {\n const [year, month] = sydneyCalendarDate(asOf).split('-').map(Number) as [number, number]\n if (established.month === undefined) return Math.max(0, year - established.year - 1)\n return Math.max(0, year - established.year - (month < established.month ? 1 : 0))\n}\n"]}
1
+ {"version":3,"file":"business.js","sourceRoot":"","sources":["../src/business.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,mBAAmB;IACnB,yBAAyB;IACzB,iBAAiB;IACjB,qBAAqB;IACrB,oBAAoB;IACpB,kBAAkB;IAClB,cAAc;IACd,mBAAmB;IACnB,gBAAgB;CACR,CAAA;AAKV,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,cAAc;IACd,UAAU;IACV,QAAQ;IACR,SAAS;IACT,UAAU;IACV,QAAQ;IACR,YAAY;CACJ,CAAA;AA+DV,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAU,CAAA;AA+C3E,8DAA8D;AAC9D,MAAM,CAAC,MAAM,oCAAoC,GAAG,EAAE,CAAA;AACtD,+FAA+F;AAC/F,MAAM,CAAC,MAAM,mCAAmC,GAAG,EAAE,CAAA;AAoBrD,MA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AM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAA;QAC9D,OAAO,IAAI,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,UAAU,CAAA;IACvD,CAAC;IACD,OAAO,IAAI,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAA;AAChD,CAAC;AAED,gIAAgI;AAChI,MAAM,UAAU,qBAAqB,CAAC,WAAkC,EAAE,OAAa,IAAI,IAAI,EAAE;IAC/F,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAqB,CAAA;IACzF,IAAI,WAAW,CAAC,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC,IAAI,GAAG,CAAC,CAAC,CAAA;IACpF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC,IAAI,GAAG,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACnF,CAAC","sourcesContent":["export type VerificationState = 'verified' | 'unknown' | 'not-applicable'\n\nexport const BRANDLAB_EVIDENCE_SOURCE_KINDS = [\n 'official-registry',\n 'google-business-profile',\n 'client-document',\n 'client-confirmation',\n 'first-party-record',\n 'public-authority',\n 'asset-rights',\n 'other-independent',\n 'synthetic-test',\n] as const\n\nexport type BrandlabEvidenceSourceKind =\n (typeof BRANDLAB_EVIDENCE_SOURCE_KINDS)[number]\n\nexport const BRANDLAB_EVIDENCE_SURFACES = [\n 'website-copy',\n 'metadata',\n 'schema',\n 'reviews',\n 'projects',\n 'images',\n 'operations',\n] as const\n\nexport type BrandlabEvidenceSurface =\n (typeof BRANDLAB_EVIDENCE_SURFACES)[number]\n\nexport interface EvidenceReference {\n sourceKind: BrandlabEvidenceSourceKind\n reference: string\n verifiedAt: string\n expiresAt?: string\n allowedSurfaces: readonly BrandlabEvidenceSurface[]\n}\n\nexport interface VerifiedFact<T> {\n status: 'verified'\n value: T\n evidence: EvidenceReference\n}\n\nexport type BrandlabFact<T> =\n | VerifiedFact<T>\n | { status: 'unknown' }\n | { status: 'not-applicable'; reason: string }\n\nexport interface BrandlabPhoneNumber {\n /** As the business shows it, for example \"02 9000 1234\", \"0412 345 678\" or \"1300 329 600\". */\n display: string\n /**\n * E.164 form: \"+61290001234\". A 13, 1300 or 1800 number keeps its national\n * digits after +61 (\"+611300329600\", \"+61131234\").\n */\n e164: string\n}\n\nexport interface BrandlabPostalAddress {\n streetAddress: string\n addressLocality: string\n addressRegion: string\n postalCode: string\n addressCountry: string\n}\n\nexport interface BrandlabServiceArea {\n id: string\n name: string\n kind: 'city' | 'region' | 'suburb' | 'state' | 'country'\n}\n\nexport type BrandlabOpeningHoursDay =\n | 'Monday'\n | 'Tuesday'\n | 'Wednesday'\n | 'Thursday'\n | 'Friday'\n | 'Saturday'\n | 'Sunday'\n\nexport interface BrandlabOpeningHours {\n days: readonly BrandlabOpeningHoursDay[]\n opens: string\n closes: string\n}\n\nexport const BRANDLAB_LICENCE_HOLDER_TYPES = ['person', 'company'] as const\n\nexport type BrandlabLicenceHolderType = (typeof BRANDLAB_LICENCE_HOLDER_TYPES)[number]\n\n/** One class of work a licence covers, with any conditions the register attaches to it. */\nexport interface BrandlabLicenceClass {\n /** The class as the register names it, for example \"Building work\" or \"Electrical wiring work\". */\n name: string\n /** Conditions on the class, as the register words them, for example a Home Building Compensation limit. */\n conditions?: readonly string[]\n}\n\n/** The body that issues the licence. The two NSW regulators are named; any other regulator is plain text. */\nexport type BrandlabLicenceRegulator = 'NSW Fair Trading' | 'SafeWork NSW' | (string & {})\n\n/** A Home Building Compensation certificate of eligibility held with the licence. */\nexport interface BrandlabHbcCertificate {\n reference: string\n insurer?: string\n /** ISO date (YYYY-MM-DD). */\n expiresOn?: string\n}\n\n/**\n * A licence as the register shows it. `name` and `identifier` are the original fields and stay valid alone; the rest\n * (3.8.0) lets a page name the licensee, carry the classes and their conditions, and be held back when the licence\n * has expired or has not been checked against the register lately.\n */\nexport interface BrandlabLicence {\n name: string\n identifier: string\n jurisdiction?: string\n /** Whether the licensee is a person or a company. */\n holderType?: BrandlabLicenceHolderType\n /** The licensee's name as the register shows it; shown beside the number when it differs from the trading name. */\n licensee?: string\n classes?: readonly BrandlabLicenceClass[]\n regulator?: BrandlabLicenceRegulator\n hbcCertificates?: readonly BrandlabHbcCertificate[]\n /** ISO date (YYYY-MM-DD) the licence expires. */\n expiresOn?: string\n /** The public register entry for this licence. */\n registerUrl?: string\n /** ISO date (YYYY-MM-DD) the register entry was last checked. */\n checkedOn?: string\n}\n\n/** A licence expiring within this many days is `expiring`. */\nexport const BRANDLAB_LICENCE_EXPIRY_WARNING_DAYS = 60\n/** A licence last checked against the register more than this many days ago is `unchecked`. */\nexport const BRANDLAB_LICENCE_CHECK_MAX_AGE_DAYS = 30\n\nexport type BrandlabLicenceRenderState = 'current' | 'expiring' | 'expired' | 'unchecked'\n\nexport interface BrandlabLicenceRenderStatus {\n state: BrandlabLicenceRenderState\n /** False only for an expired licence: an expired licence never renders. */\n mayRender: boolean\n /** Whole days from today to `expiresOn` (negative once expired); absent when no expiry is recorded. */\n daysToExpiry?: number\n /** Whole days since `checkedOn`; absent when the licence has never been checked. */\n daysSinceChecked?: number\n}\n\nexport interface BrandlabProofReference {\n id: string\n kind: 'project' | 'review' | 'accreditation' | 'licence' | 'external-source'\n evidence: EvidenceReference\n}\n\nconst BRANDLAB_PROOF_KINDS = new Set<BrandlabProofReference['kind']>([\n 'project',\n 'review',\n 'accreditation',\n 'licence',\n 'external-source',\n])\nconst BRANDLAB_OPENING_HOURS_DAYS = new Set<BrandlabOpeningHoursDay>([\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n 'Sunday',\n])\n\nexport interface BrandlabBusiness {\n identity: {\n tradingName: BrandlabFact<string> & { status: 'verified' }\n legalName: BrandlabFact<string>\n }\n canonicalUrl: BrandlabFact<string> & { status: 'verified' }\n contact: {\n phone: BrandlabFact<BrandlabPhoneNumber>\n email: BrandlabFact<string>\n }\n location: {\n model: 'service-area' | 'physical-location' | 'hybrid'\n addressVisibility: 'public' | 'hidden' | 'not-applicable'\n address: BrandlabFact<BrandlabPostalAddress>\n serviceAreas: BrandlabFact<readonly BrandlabServiceArea[]>\n }\n openingHours: BrandlabFact<readonly BrandlabOpeningHours[]>\n registration: {\n abn: BrandlabFact<string>\n licences: BrandlabFact<readonly BrandlabLicence[]>\n }\n externalEntities: {\n googlePlaceId: BrandlabFact<string>\n sameAs: BrandlabFact<readonly string[]>\n }\n /** Optional structured proof references for projects that use them operationally. */\n proof?: BrandlabFact<readonly BrandlabProofReference[]>\n /** Insurance, qualifications, experience and the established date, each with its evidence (3.14.0). */\n credentials?: BrandlabBusinessCredentials\n}\n\nexport interface BrandlabDerivedBusinessFacts {\n tradingName: string\n legalName?: string\n canonicalUrl: string\n canonicalDomain: string\n phone?: BrandlabPhoneNumber & {\n digits: string\n /**\n * An Australian 13, 1300 or 1800 number: callable only within Australia\n * and only as dialled nationally.\n */\n nonGeographic: boolean\n /** `tel:+61…` for landline and mobile numbers; the national digits (`tel:1300329600`) for a non-geographic number. */\n telHref: string\n /** Schema.org `telephone`: E.164 for landline and mobile numbers, the displayed number for a non-geographic one. */\n schemaTelephone: string\n }\n email?: string\n publicAddress?: BrandlabPostalAddress\n serviceAreas: readonly BrandlabServiceArea[]\n openingHours: readonly BrandlabOpeningHours[]\n abn?: string\n licences: readonly BrandlabLicence[]\n googlePlaceId?: string\n sameAs: readonly string[]\n proof: readonly BrandlabProofReference[]\n}\n\nexport function verifiedFact<T>(\n value: T,\n evidence: EvidenceReference,\n): VerifiedFact<T> {\n return {\n status: 'verified',\n value,\n evidence,\n }\n}\n\nexport function unknownFact<T>(): BrandlabFact<T> {\n return { status: 'unknown' }\n}\n\nexport function notApplicableFact<T>(reason: string): BrandlabFact<T> {\n return { status: 'not-applicable', reason }\n}\n\nexport function resolveVerifiedFactForSurface<T>(\n fact: BrandlabFact<T>,\n surface: BrandlabEvidenceSurface,\n asOf: Date = new Date(),\n): T | undefined {\n if (fact.status !== 'verified') return undefined\n if (!fact.evidence.allowedSurfaces.includes(surface)) return undefined\n if (\n fact.evidence.expiresAt &&\n Date.parse(fact.evidence.expiresAt) < asOf.getTime()\n ) {\n return undefined\n }\n return fact.value\n}\n\nconst SYDNEY_DATE = new Intl.DateTimeFormat('en-CA', {\n timeZone: 'Australia/Sydney',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n})\n\n/** Today's calendar date in Sydney as YYYY-MM-DD: a licence is valid through its expiry date there. */\nfunction sydneyCalendarDate(asOf: Date): string {\n return SYDNEY_DATE.format(asOf)\n}\n\nfunction wholeDaysBetween(from: string, to: string): number {\n return Math.round((Date.parse(`${to}T00:00:00Z`) - Date.parse(`${from}T00:00:00Z`)) / 86_400_000)\n}\n\n/**\n * A licence's state. A licence always renders (4.4.1; Romie, 4 November 2026: licences stay through renewal and are\n * never removed), so `mayRender` is true in every state; the state says what to re-check. `expired` once today\n * (Sydney) is past `expiresOn`: chase the renewal and update the date; `unchecked` when the register has not been checked, or not within 30 days; `expiring` within 60 days of\n * `expiresOn`; otherwise `current`. A licence without the 3.8.0 fields has no expiry to pass, and is `unchecked`.\n */\nexport function licenceRenderState(\n licence: Pick<BrandlabLicence, 'expiresOn' | 'checkedOn'>,\n asOf: Date = new Date(),\n): BrandlabLicenceRenderStatus {\n const today = sydneyCalendarDate(asOf)\n const daysToExpiry = licence.expiresOn !== undefined ? wholeDaysBetween(today, licence.expiresOn) : undefined\n const daysSinceChecked = licence.checkedOn !== undefined ? wholeDaysBetween(licence.checkedOn, today) : undefined\n const details = {\n ...(daysToExpiry !== undefined ? { daysToExpiry } : {}),\n ...(daysSinceChecked !== undefined ? { daysSinceChecked } : {}),\n }\n if (daysToExpiry !== undefined && daysToExpiry < 0) return { state: 'expired', mayRender: true, ...details }\n if (daysSinceChecked === undefined || daysSinceChecked > BRANDLAB_LICENCE_CHECK_MAX_AGE_DAYS) {\n return { state: 'unchecked', mayRender: true, ...details }\n }\n if (daysToExpiry !== undefined && daysToExpiry <= BRANDLAB_LICENCE_EXPIRY_WARNING_DAYS) {\n return { state: 'expiring', mayRender: true, ...details }\n }\n return { state: 'current', mayRender: true, ...details }\n}\n\n/** The licences a page may show: all of them (4.4.1). A licence past its expiry date stays while it is renewed; the ready gate warns. */\nexport function renderableLicences<T extends Pick<BrandlabLicence, 'expiresOn' | 'checkedOn'>>(\n licences: readonly T[],\n asOf: Date = new Date(),\n): T[] {\n return licences.filter((licence) => licenceRenderState(licence, asOf).mayRender)\n}\n\nfunction assertText(value: unknown, field: string, maximum = 500) {\n if (\n typeof value !== 'string' ||\n !value.trim() ||\n value.trim() !== value ||\n value.length > maximum ||\n /[\\u0000-\\u001f\\u007f]/.test(value)\n ) {\n throw new Error(`${field} must be bounded, trimmed text.`)\n }\n}\n\nfunction assertDate(value: string | undefined, field: string) {\n if (\n value !== undefined &&\n (!/^\\d{4}-\\d{2}-\\d{2}(?:T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z)?$/.test(value) ||\n Number.isNaN(Date.parse(value)))\n ) {\n throw new Error(`${field} must be a valid ISO date or UTC timestamp.`)\n }\n}\n\nconst BRANDLAB_EVIDENCE_SOURCE_KIND_SET = new Set<BrandlabEvidenceSourceKind>(\n BRANDLAB_EVIDENCE_SOURCE_KINDS,\n)\nconst BRANDLAB_EVIDENCE_SURFACE_SET = new Set<BrandlabEvidenceSurface>(\n BRANDLAB_EVIDENCE_SURFACES,\n)\nconst CIRCULAR_EVIDENCE_PREFIX =\n /^(?:existing-production-config|repository-config|source-code):/i\n\nfunction assertEvidenceReference(\n evidence: EvidenceReference,\n field: string,\n) {\n assertExactKeys(\n evidence,\n ['sourceKind', 'reference', 'verifiedAt', 'expiresAt', 'allowedSurfaces'],\n field,\n )\n if (!BRANDLAB_EVIDENCE_SOURCE_KIND_SET.has(evidence.sourceKind)) {\n throw new Error(`${field}.sourceKind is invalid.`)\n }\n assertText(evidence.reference, `${field}.reference`)\n if (CIRCULAR_EVIDENCE_PREFIX.test(evidence.reference)) {\n throw new Error(\n `${field}.reference cannot cite repository configuration as independent verification.`,\n )\n }\n assertDate(evidence.verifiedAt, `${field}.verifiedAt`)\n assertDate(evidence.expiresAt, `${field}.expiresAt`)\n if (\n evidence.expiresAt &&\n Date.parse(evidence.expiresAt) < Date.parse(evidence.verifiedAt)\n ) {\n throw new Error(`${field}.expiresAt cannot precede verifiedAt.`)\n }\n if (\n !Array.isArray(evidence.allowedSurfaces) ||\n evidence.allowedSurfaces.length === 0\n ) {\n throw new Error(`${field}.allowedSurfaces cannot be empty.`)\n }\n assertUniqueStrings(evidence.allowedSurfaces, `${field}.allowedSurfaces`)\n if (\n evidence.allowedSurfaces.some(\n (surface) => !BRANDLAB_EVIDENCE_SURFACE_SET.has(surface),\n )\n ) {\n throw new Error(`${field}.allowedSurfaces contains an invalid surface.`)\n }\n}\n\nfunction assertExactKeys(\n value: unknown,\n allowed: readonly string[],\n field: string,\n) {\n if (\n !value ||\n typeof value !== 'object' ||\n Array.isArray(value) ||\n ![Object.prototype, null].includes(Object.getPrototypeOf(value))\n ) {\n throw new Error(`${field} must be a plain object.`)\n }\n const unknown = Object.keys(value).find((key) => !allowed.includes(key))\n if (unknown) throw new Error(`${field}.${unknown} is not a supported business fact key.`)\n}\n\nfunction assertFact<T>(fact: BrandlabFact<T>, field: string, validate?: (value: T) => void) {\n if (!fact || typeof fact !== 'object' || Array.isArray(fact)) {\n throw new Error(`${field} must be a typed Brandlab fact.`)\n }\n const record = fact as BrandlabFact<T> & Record<string, unknown>\n if (record.status === 'verified') {\n const verified = record as Extract<BrandlabFact<T>, { status: 'verified' }> &\n Record<string, unknown>\n if (!Object.prototype.hasOwnProperty.call(verified, 'value') || verified.value === undefined) {\n throw new Error(`${field}.value is required for a verified fact.`)\n }\n assertExactKeys(verified, ['status', 'value', 'evidence'], field)\n assertEvidenceReference(verified.evidence, `${field}.evidence`)\n if (typeof verified.value === 'string') assertText(verified.value, `${field}.value`)\n validate?.(verified.value)\n } else if (record.status === 'unknown') {\n if (Object.prototype.hasOwnProperty.call(record, 'value')) {\n throw new Error(`${field} cannot carry a value while its status is unknown.`)\n }\n assertExactKeys(record, ['status'], field)\n } else if (record.status === 'not-applicable') {\n if (Object.prototype.hasOwnProperty.call(record, 'value')) {\n throw new Error(`${field} cannot carry a value while it is not applicable.`)\n }\n assertExactKeys(record, ['status', 'reason'], field)\n assertText(record.reason, `${field}.reason`)\n } else {\n throw new Error(`${field}.status must be verified, unknown or not-applicable.`)\n }\n}\n\nfunction assertAbsoluteHttpsUrl(value: string, field: string, requireOrigin = false) {\n let url: URL\n try {\n url = new URL(value)\n } catch {\n throw new Error(`${field} must be an absolute HTTPS URL.`)\n }\n\n if (\n url.protocol !== 'https:' ||\n url.username ||\n url.password ||\n (requireOrigin && (url.pathname !== '/' || url.search || url.hash))\n ) {\n throw new Error(`${field} must be an absolute HTTPS URL.`)\n }\n}\n\nfunction assertUniqueStrings(values: readonly string[], field: string) {\n const duplicate = values.find((value, index) => values.indexOf(value) !== index)\n if (duplicate) throw new Error(`${field} contains duplicate value \"${duplicate}\".`)\n}\n\nfunction assertTime(value: string, field: string) {\n if (!/^(?:[01]\\d|2[0-3]):[0-5]\\d$/.test(value)) {\n throw new Error(`${field} must use a valid 24-hour HH:MM time.`)\n }\n}\n\nfunction assertAddress(address: BrandlabPostalAddress) {\n assertExactKeys(\n address,\n [\n 'streetAddress',\n 'addressLocality',\n 'addressRegion',\n 'postalCode',\n 'addressCountry',\n ],\n 'location.address.value',\n )\n Object.entries(address).forEach(([field, value]) =>\n assertText(value, `location.address.value.${field}`, 200),\n )\n if (address.addressCountry !== 'AU') {\n throw new Error('location.address.value.addressCountry must be \"AU\".')\n }\n if (!/^[A-Z]{2,3}$/.test(address.addressRegion)) {\n throw new Error('location.address.value.addressRegion must be an uppercase Australian region.')\n }\n if (!/^\\d{4}$/.test(address.postalCode)) {\n throw new Error('location.address.value.postalCode must be a four-digit Australian postcode.')\n }\n}\n\n/** Landline and mobile numbers: +61 then a 2, 3, 4, 7 or 8 area or mobile prefix. */\nconst AUSTRALIAN_GEOGRAPHIC_E164 = /^\\+61[23478]\\d{8}$/\n/** Non-geographic numbers: 13 xx xx, 1300 xxx xxx and 1800 xxx xxx. */\nconst AUSTRALIAN_NON_GEOGRAPHIC_E164 = /^\\+61(?:1[38]00\\d{6}|13(?!00)\\d{4})$/\n\nfunction isNonGeographicPhone(e164: string) {\n return AUSTRALIAN_NON_GEOGRAPHIC_E164.test(e164)\n}\n\nfunction assertPhone(phone: BrandlabPhoneNumber) {\n assertExactKeys(phone, ['display', 'e164'], 'contact.phone.value')\n assertText(phone.display, 'contact.phone.value.display')\n if (\n phone.display.trim() !== phone.display ||\n phone.display.length > 32 ||\n !/^[+()\\d\\s.-]+$/.test(phone.display)\n ) {\n throw new Error('contact.phone.value.display must be a bounded Australian phone number.')\n }\n const nonGeographic = isNonGeographicPhone(phone.e164)\n if (!nonGeographic && !AUSTRALIAN_GEOGRAPHIC_E164.test(phone.e164)) {\n throw new Error(\n 'contact.phone.value.e164 must be a valid Australian E.164 number: a landline or mobile, or a 13, 1300 or 1800 number.',\n )\n }\n const national = phone.e164.slice(3)\n const displayDigits = phone.display.replace(/\\D/g, '')\n // A landline or mobile shows its trunk 0 or +61; a non-geographic number is shown as dialled.\n const sameNumber = displayDigits === `61${national}` ||\n displayDigits === (nonGeographic ? national : `0${national}`)\n if (!sameNumber) {\n throw new Error('contact.phone.value.display must identify the same number as e164.')\n }\n}\n\nfunction assertEmail(email: string) {\n if (\n email.length > 254 ||\n email.trim() !== email ||\n /[\\u0000-\\u001f\\u007f]/.test(email) ||\n !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email)\n ) {\n throw new Error('contact.email.value must be a valid email address.')\n }\n}\n\nfunction normalizeAbn(value: string) {\n return value.replace(/\\s/g, '')\n}\n\nfunction assertAbn(value: string) {\n const digits = normalizeAbn(value)\n if (!/^\\d{11}$/.test(digits) || !/^\\d{2}(?: \\d{3}){3}$|^\\d{11}$/.test(value)) {\n throw new Error('registration.abn.value must be an 11-digit Australian Business Number.')\n }\n const weights = [10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]\n const numbers = [...digits].map(Number)\n numbers[0] = numbers[0]! - 1\n const checksum = numbers.reduce(\n (sum, digit, index) => sum + digit * weights[index]!,\n 0,\n )\n if (checksum % 89 !== 0) {\n throw new Error('registration.abn.value has an invalid ABN checksum.')\n }\n}\n\nfunction assertUniqueIds(records: readonly { id: string }[], field: string) {\n records.forEach((record, index) => assertText(record.id, `${field}[${index}].id`))\n const duplicate = records.find((record, index) =>\n records.slice(0, index).some((candidate) => candidate.id === record.id),\n )\n if (duplicate) throw new Error(`${field} contains duplicate ID \"${duplicate.id}\".`)\n}\n\nexport function defineBrandlabBusiness<const T extends BrandlabBusiness>(business: T): T {\n assertExactKeys(\n business,\n [\n 'identity',\n 'canonicalUrl',\n 'contact',\n 'location',\n 'openingHours',\n 'registration',\n 'externalEntities',\n 'proof',\n 'credentials',\n ],\n 'business',\n )\n assertExactKeys(business.identity, ['tradingName', 'legalName'], 'identity')\n assertExactKeys(business.contact, ['phone', 'email'], 'contact')\n assertExactKeys(\n business.location,\n ['model', 'addressVisibility', 'address', 'serviceAreas'],\n 'location',\n )\n assertExactKeys(business.registration, ['abn', 'licences'], 'registration')\n assertExactKeys(\n business.externalEntities,\n ['googlePlaceId', 'sameAs'],\n 'externalEntities',\n )\n if (!['service-area', 'physical-location', 'hybrid'].includes(business.location.model)) {\n throw new Error('location.model is invalid.')\n }\n if (!['public', 'hidden', 'not-applicable'].includes(business.location.addressVisibility)) {\n throw new Error('location.addressVisibility is invalid.')\n }\n assertFact(business.identity.tradingName, 'identity.tradingName')\n assertFact(business.identity.legalName, 'identity.legalName')\n assertFact(business.canonicalUrl, 'canonicalUrl', (value) =>\n assertAbsoluteHttpsUrl(value, 'canonicalUrl.value', true),\n )\n assertFact(business.contact.phone, 'contact.phone', assertPhone)\n assertFact(business.contact.email, 'contact.email', assertEmail)\n assertFact(business.location.address, 'location.address', assertAddress)\n assertFact(business.location.serviceAreas, 'location.serviceAreas', assertServiceAreas)\n assertFact(business.openingHours, 'openingHours', assertOpeningHours)\n assertFact(business.registration.abn, 'registration.abn', assertAbn)\n assertFact(business.registration.licences, 'registration.licences', assertLicences)\n assertFact(business.externalEntities.googlePlaceId, 'externalEntities.googlePlaceId')\n assertFact(business.externalEntities.sameAs, 'externalEntities.sameAs', assertSameAs)\n if (business.proof) {\n assertFact(business.proof, 'proof', (proof) => {\n assertUniqueIds(proof, 'proof.value')\n proof.forEach((item, index) => {\n assertExactKeys(\n item,\n ['id', 'kind', 'evidence'],\n `proof.value[${index}]`,\n )\n if (!BRANDLAB_PROOF_KINDS.has(item.kind)) {\n throw new Error(`proof.value[${index}].kind is invalid.`)\n }\n assertEvidenceReference(\n item.evidence,\n `proof.value[${index}].evidence`,\n )\n })\n })\n }\n\n if (business.credentials !== undefined) assertCredentials(business.credentials, 'credentials')\n\n assertLocationModel({\n model: business.location.model,\n addressVisibility: business.location.addressVisibility,\n address: verifiedValue(business.location.address),\n serviceAreas: verifiedValue(business.location.serviceAreas),\n })\n\n return business\n}\n\nfunction assertLocationModel(location: BrandlabBusinessFactValues['location']) {\n if (location.addressVisibility === 'not-applicable' && location.address) {\n throw new Error('A verified address cannot use addressVisibility \"not-applicable\".')\n }\n if (location.addressVisibility === 'public' && !location.address) {\n throw new Error('A public address must have verified address facts.')\n }\n if (location.model === 'service-area' && location.addressVisibility === 'public') {\n throw new Error('A service-area business cannot expose a public address.')\n }\n if (location.model === 'physical-location' && location.addressVisibility !== 'public') {\n throw new Error('A physical-location business must expose its verified public address.')\n }\n if (\n (location.model === 'service-area' || location.model === 'hybrid') &&\n (!location.serviceAreas || location.serviceAreas.length === 0)\n ) {\n throw new Error('Service-area and hybrid businesses require verified service areas.')\n }\n}\n\nfunction assertServiceAreas(areas: readonly BrandlabServiceArea[]) {\n assertUniqueIds(areas, 'location.serviceAreas.value')\n areas.forEach((area, index) => {\n assertExactKeys(\n area,\n ['id', 'name', 'kind'],\n `location.serviceAreas.value[${index}]`,\n )\n assertText(area.name, `location.serviceAreas.value[${index}].name`)\n if (area.name.trim() !== area.name || area.name.length > 160) {\n throw new Error(`location.serviceAreas.value[${index}].name must be bounded canonical text.`)\n }\n if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(area.id)) {\n throw new Error(`location.serviceAreas.value[${index}].id must be lowercase kebab-case.`)\n }\n if (!['city', 'region', 'suburb', 'state', 'country'].includes(area.kind)) {\n throw new Error(`location.serviceAreas.value[${index}].kind is invalid.`)\n }\n })\n}\n\nfunction assertOpeningHours(hours: readonly BrandlabOpeningHours[]) {\n const allDays: BrandlabOpeningHoursDay[] = []\n hours.forEach((period, index) => {\n assertExactKeys(\n period,\n ['days', 'opens', 'closes'],\n `openingHours.value[${index}]`,\n )\n if (period.days.length === 0) {\n throw new Error(`openingHours.value[${index}].days cannot be empty.`)\n }\n assertUniqueStrings(period.days, `openingHours.value[${index}].days`)\n if (period.days.some((day) => !BRANDLAB_OPENING_HOURS_DAYS.has(day))) {\n throw new Error(`openingHours.value[${index}].days contains an invalid day.`)\n }\n allDays.push(...period.days)\n assertTime(period.opens, `openingHours.value[${index}].opens`)\n assertTime(period.closes, `openingHours.value[${index}].closes`)\n })\n assertUniqueStrings(allDays, 'openingHours.value.days')\n}\n\nconst BRANDLAB_LICENCE_HOLDER_TYPE_SET = new Set<string>(BRANDLAB_LICENCE_HOLDER_TYPES)\n\nfunction assertIsoDay(value: unknown, field: string) {\n if (\n typeof value !== 'string' ||\n !/^\\d{4}-\\d{2}-\\d{2}$/.test(value) ||\n Number.isNaN(Date.parse(`${value}T00:00:00Z`)) ||\n new Date(`${value}T00:00:00Z`).toISOString().slice(0, 10) !== value\n ) {\n throw new Error(`${field} must be a valid ISO date (YYYY-MM-DD).`)\n }\n}\n\nfunction assertLicenceClasses(classes: readonly BrandlabLicenceClass[], field: string) {\n if (!Array.isArray(classes) || classes.length === 0) {\n throw new Error(`${field} cannot be empty.`)\n }\n classes.forEach((licenceClass, index) => {\n assertExactKeys(licenceClass, ['name', 'conditions'], `${field}[${index}]`)\n assertText(licenceClass.name, `${field}[${index}].name`, 160)\n const conditions: unknown = licenceClass.conditions\n if (conditions !== undefined) {\n if (!Array.isArray(conditions) || conditions.length === 0) {\n throw new Error(`${field}[${index}].conditions cannot be empty when present.`)\n }\n conditions.forEach((condition: unknown, conditionIndex: number) =>\n assertText(condition, `${field}[${index}].conditions[${conditionIndex}]`, 300),\n )\n }\n })\n assertUniqueStrings(\n classes.map((licenceClass) => licenceClass.name.toLowerCase()),\n `${field}.names`,\n )\n}\n\nfunction assertHbcCertificates(certificates: readonly BrandlabHbcCertificate[], field: string) {\n if (!Array.isArray(certificates) || certificates.length === 0) {\n throw new Error(`${field} cannot be empty when present.`)\n }\n certificates.forEach((certificate, index) => {\n assertExactKeys(certificate, ['reference', 'insurer', 'expiresOn'], `${field}[${index}]`)\n assertText(certificate.reference, `${field}[${index}].reference`, 120)\n if (certificate.insurer !== undefined) assertText(certificate.insurer, `${field}[${index}].insurer`, 120)\n if (certificate.expiresOn !== undefined) assertIsoDay(certificate.expiresOn, `${field}[${index}].expiresOn`)\n })\n}\n\nfunction assertLicences(licences: readonly BrandlabLicence[]) {\n assertUniqueStrings(\n licences.map((licence) => licence.identifier),\n 'registration.licences.value.identifiers',\n )\n licences.forEach((licence, index) => {\n const field = `registration.licences.value[${index}]`\n assertExactKeys(\n licence,\n [\n 'name',\n 'identifier',\n 'jurisdiction',\n 'holderType',\n 'licensee',\n 'classes',\n 'regulator',\n 'hbcCertificates',\n 'expiresOn',\n 'registerUrl',\n 'checkedOn',\n ],\n field,\n )\n assertText(licence.name, `${field}.name`)\n assertText(licence.identifier, `${field}.identifier`)\n if (licence.jurisdiction !== undefined) {\n assertText(licence.jurisdiction, `${field}.jurisdiction`, 120)\n }\n if (licence.holderType !== undefined && !BRANDLAB_LICENCE_HOLDER_TYPE_SET.has(licence.holderType)) {\n throw new Error(`${field}.holderType must be \"person\" or \"company\".`)\n }\n if (licence.licensee !== undefined) assertText(licence.licensee, `${field}.licensee`, 200)\n if (licence.classes !== undefined) assertLicenceClasses(licence.classes, `${field}.classes`)\n if (licence.regulator !== undefined) assertText(licence.regulator, `${field}.regulator`, 120)\n if (licence.hbcCertificates !== undefined) {\n assertHbcCertificates(licence.hbcCertificates, `${field}.hbcCertificates`)\n }\n if (licence.expiresOn !== undefined) assertIsoDay(licence.expiresOn, `${field}.expiresOn`)\n if (licence.registerUrl !== undefined) assertAbsoluteHttpsUrl(licence.registerUrl, `${field}.registerUrl`)\n if (licence.checkedOn !== undefined) assertIsoDay(licence.checkedOn, `${field}.checkedOn`)\n })\n}\n\nfunction assertSameAs(urls: readonly string[]) {\n assertUniqueStrings(urls, 'externalEntities.sameAs.value')\n urls.forEach((url, index) =>\n assertAbsoluteHttpsUrl(url, `externalEntities.sameAs.value[${index}]`),\n )\n}\n\nfunction verifiedValue<T>(fact: BrandlabFact<T>): T | undefined {\n return fact.status === 'verified' ? fact.value : undefined\n}\n\n/**\n * The business facts as a site displays them: the verified values without their\n * evidence (unknown and not-applicable facts are absent). Client components read\n * these from `src/data/business.ts`; the evidence stays in the server-only\n * `src/data/businessEvidence.ts`, which declares the facts over these values with\n * `defineBrandlabBusiness` (3.2.1).\n */\nexport interface BrandlabBusinessFactValues {\n identity: { tradingName: string; legalName?: string }\n canonicalUrl: string\n contact?: { phone?: BrandlabPhoneNumber; email?: string }\n location: {\n model: BrandlabBusiness['location']['model']\n addressVisibility: BrandlabBusiness['location']['addressVisibility']\n address?: BrandlabPostalAddress\n serviceAreas?: readonly BrandlabServiceArea[]\n }\n openingHours?: readonly BrandlabOpeningHours[]\n registration?: { abn?: string; licences?: readonly BrandlabLicence[] }\n externalEntities?: { googlePlaceId?: string; sameAs?: readonly string[] }\n}\n\nfunction factValues(business: BrandlabBusiness): BrandlabBusinessFactValues {\n return {\n identity: {\n tradingName: business.identity.tradingName.value,\n ...(verifiedValue(business.identity.legalName) !== undefined ? { legalName: verifiedValue(business.identity.legalName)! } : {}),\n },\n canonicalUrl: business.canonicalUrl.value,\n contact: {\n ...(verifiedValue(business.contact.phone) ? { phone: verifiedValue(business.contact.phone)! } : {}),\n ...(verifiedValue(business.contact.email) !== undefined ? { email: verifiedValue(business.contact.email)! } : {}),\n },\n location: {\n model: business.location.model,\n addressVisibility: business.location.addressVisibility,\n ...(verifiedValue(business.location.address) ? { address: verifiedValue(business.location.address)! } : {}),\n ...(verifiedValue(business.location.serviceAreas) ? { serviceAreas: verifiedValue(business.location.serviceAreas)! } : {}),\n },\n ...(verifiedValue(business.openingHours) ? { openingHours: verifiedValue(business.openingHours)! } : {}),\n registration: {\n ...(verifiedValue(business.registration.abn) !== undefined ? { abn: verifiedValue(business.registration.abn)! } : {}),\n ...(verifiedValue(business.registration.licences) ? { licences: verifiedValue(business.registration.licences)! } : {}),\n },\n externalEntities: {\n ...(verifiedValue(business.externalEntities.googlePlaceId) !== undefined ? { googlePlaceId: verifiedValue(business.externalEntities.googlePlaceId)! } : {}),\n ...(verifiedValue(business.externalEntities.sameAs) ? { sameAs: verifiedValue(business.externalEntities.sameAs)! } : {}),\n },\n }\n}\n\nfunction deriveFromValues(values: BrandlabBusinessFactValues): Omit<BrandlabDerivedBusinessFacts, 'proof'> {\n const canonicalUrl = new URL(values.canonicalUrl).origin\n const phone = values.contact?.phone\n const address = values.location.address\n\n return {\n tradingName: values.identity.tradingName,\n ...(values.identity.legalName !== undefined\n ? { legalName: values.identity.legalName }\n : {}),\n canonicalUrl,\n canonicalDomain: new URL(canonicalUrl).hostname,\n ...(phone\n ? {\n phone: {\n ...phone,\n digits: phone.e164.replace(/\\D/g, ''),\n nonGeographic: isNonGeographicPhone(phone.e164),\n // 13, 1300 and 1800 numbers cannot be dialled in international form.\n telHref: isNonGeographicPhone(phone.e164) ? `tel:${phone.e164.slice(3)}` : `tel:${phone.e164}`,\n schemaTelephone: isNonGeographicPhone(phone.e164) ? phone.display : phone.e164,\n },\n }\n : {}),\n ...(values.contact?.email !== undefined\n ? { email: values.contact.email.trim().toLowerCase() }\n : {}),\n ...(values.location.addressVisibility === 'public' && address\n ? { publicAddress: address }\n : {}),\n serviceAreas: values.location.serviceAreas ?? [],\n openingHours: values.openingHours ?? [],\n ...(values.registration?.abn !== undefined\n ? { abn: normalizeAbn(values.registration.abn) }\n : {}),\n licences: values.registration?.licences ?? [],\n ...(values.externalEntities?.googlePlaceId !== undefined\n ? { googlePlaceId: values.externalEntities.googlePlaceId }\n : {}),\n sameAs: values.externalEntities?.sameAs ?? [],\n }\n}\n\nexport function deriveBusinessFacts(business: BrandlabBusiness): BrandlabDerivedBusinessFacts {\n defineBrandlabBusiness(business)\n return {\n ...deriveFromValues(factValues(business)),\n proof: business.proof ? verifiedValue(business.proof) ?? [] : [],\n }\n}\n\n/**\n * What `deriveBusinessFacts` gives, from the display values alone (3.2.1), for\n * the client-safe modules that derive links and labels from the facts. The values\n * are checked as `defineBrandlabBusiness` checks the facts; proof references carry\n * evidence, so they are never part of the display values (`proof` is empty).\n */\nexport function deriveBusinessDisplayFacts(values: BrandlabBusinessFactValues): BrandlabDerivedBusinessFacts {\n assertBusinessFactValues(values)\n return { ...deriveFromValues(values), proof: [] }\n}\n\nfunction assertBusinessFactValues(values: BrandlabBusinessFactValues) {\n if (!values || typeof values !== 'object') throw new Error('The business fact values must be an object.')\n assertExactKeys(values, ['identity', 'canonicalUrl', 'contact', 'location', 'openingHours', 'registration', 'externalEntities'], 'business values')\n assertExactKeys(values.identity, ['tradingName', 'legalName'], 'identity')\n assertText(values.identity.tradingName, 'identity.tradingName.value')\n if (values.identity.legalName !== undefined) assertText(values.identity.legalName, 'identity.legalName.value')\n assertText(values.canonicalUrl, 'canonicalUrl.value')\n assertAbsoluteHttpsUrl(values.canonicalUrl, 'canonicalUrl.value', true)\n if (values.contact !== undefined) {\n assertExactKeys(values.contact, ['phone', 'email'], 'contact')\n if (values.contact.phone !== undefined) assertPhone(values.contact.phone)\n if (values.contact.email !== undefined) assertEmail(values.contact.email)\n }\n assertExactKeys(values.location, ['model', 'addressVisibility', 'address', 'serviceAreas'], 'location')\n if (!['service-area', 'physical-location', 'hybrid'].includes(values.location.model)) {\n throw new Error('location.model is invalid.')\n }\n if (!['public', 'hidden', 'not-applicable'].includes(values.location.addressVisibility)) {\n throw new Error('location.addressVisibility is invalid.')\n }\n if (values.location.address !== undefined) assertAddress(values.location.address)\n if (values.location.serviceAreas !== undefined) assertServiceAreas(values.location.serviceAreas)\n if (values.openingHours !== undefined) assertOpeningHours(values.openingHours)\n if (values.registration !== undefined) {\n assertExactKeys(values.registration, ['abn', 'licences'], 'registration')\n if (values.registration.abn !== undefined) assertAbn(values.registration.abn)\n if (values.registration.licences !== undefined) assertLicences(values.registration.licences)\n }\n if (values.externalEntities !== undefined) {\n assertExactKeys(values.externalEntities, ['googlePlaceId', 'sameAs'], 'externalEntities')\n if (values.externalEntities.googlePlaceId !== undefined) assertText(values.externalEntities.googlePlaceId, 'externalEntities.googlePlaceId.value')\n if (values.externalEntities.sameAs !== undefined) assertSameAs(values.externalEntities.sameAs)\n }\n assertLocationModel(values.location)\n}\n\n// ---------------------------------------------------------------------------\n// Credentials: insurance, qualifications, experience, established (3.14.0)\n// ---------------------------------------------------------------------------\n\n/** The insurance covers a site may name. */\nexport const BRANDLAB_INSURANCE_COVERS = ['public-liability', 'professional-indemnity', 'workers-compensation'] as const\nexport type BrandlabInsuranceCover = (typeof BRANDLAB_INSURANCE_COVERS)[number]\n\n/** Whose experience a years figure is: the practitioner's (never claimed as the company's) or the business's own. */\nexport const BRANDLAB_EXPERIENCE_HOLDERS = ['practitioner', 'business'] as const\nexport type BrandlabExperienceHolder = (typeof BRANDLAB_EXPERIENCE_HOLDERS)[number]\n\n/**\n * What every credential carries: the claims-register entry that approves its wording (`docs/claims-register.md`, for\n * example AA's \"CLM-22\") and the evidence for it. The evidence's `allowedSurfaces` and `expiresAt` decide where and\n * until when it renders.\n */\nexport interface BrandlabCredentialClaim {\n /** The claims-register id, for example \"CLM-21\": capital letters, a hyphen and a number. */\n claimId: string\n evidence: EvidenceReference\n}\n\nexport interface BrandlabInsurance {\n cover: BrandlabInsuranceCover\n /** The cover in whole Australian dollars, for example 20_000_000. */\n amountAud: number\n insurer?: string\n /** YYYY-MM-DD the policy (certificate of currency) runs to; from the day after, it never renders. */\n expiresOn?: string\n}\n\n/** A qualification as the business may state it, without a person's name (\"AQF Level 3-qualified arborist\"). */\nexport interface BrandlabQualification {\n title: string\n}\n\n/** \"More than {years} years of {field} experience\": at least this many whole years, as the evidence recorded them. */\nexport interface BrandlabExperience {\n years: number\n holder: BrandlabExperienceHolder\n /** The work, for example \"tree work\". */\n field: string\n}\n\n/** When the business was established (for example from the ABN's active-from date). */\nexport interface BrandlabEstablishment {\n year: number\n /** 1 to 12, when known. */\n month?: number\n}\n\n/**\n * After-hours work the business really does (3.15.0), recorded in the claims register like any credential: what the\n * work is and, for a seasonal offer such as a storm season, the last day it runs. `EmergencyBand` renders only while a\n * renderable entry exists; it never carries a response time, which no entry records.\n */\nexport interface BrandlabAfterHours {\n /** The work done after hours, for example \"fallen and storm-damaged trees\". */\n work: string\n /** YYYY-MM-DD the offer ends (a storm season); from the day after (Sydney), it never renders. */\n endsOn?: string\n}\n\n/**\n * The credentials a site may show (3.14.0). Each entry has its own claim id and evidence, so an owner-confirmed figure\n * and a certificate-backed one are recorded side by side. Nothing renders without evidence: read them for a page with\n * `renderableCredentials`.\n */\nexport interface BrandlabBusinessCredentials {\n insurance?: readonly (BrandlabInsurance & BrandlabCredentialClaim)[]\n qualifications?: readonly (BrandlabQualification & BrandlabCredentialClaim)[]\n experience?: readonly (BrandlabExperience & BrandlabCredentialClaim)[]\n established?: BrandlabEstablishment & BrandlabCredentialClaim\n /** After-hours work (3.15.0). */\n afterHours?: BrandlabAfterHours & BrandlabCredentialClaim\n}\n\n/** The credentials a surface may show, without their evidence. */\nexport interface BrandlabRenderableCredentials {\n insurance: readonly (BrandlabInsurance & { claimId: string })[]\n qualifications: readonly (BrandlabQualification & { claimId: string })[]\n experience: readonly (BrandlabExperience & { claimId: string })[]\n established?: BrandlabEstablishment & { claimId: string }\n afterHours?: BrandlabAfterHours & { claimId: string }\n}\n\nconst CLAIM_ID = /^[A-Z][A-Z0-9]*-\\d+$/\n\nfunction assertClaim(claim: BrandlabCredentialClaim, field: string) {\n if (typeof claim.claimId !== 'string' || !CLAIM_ID.test(claim.claimId)) {\n throw new Error(`${field}.claimId must be the claims-register id, such as \"CLM-21\".`)\n }\n assertEvidenceReference(claim.evidence, `${field}.evidence`)\n}\n\nfunction assertCredentialList<T>(\n list: readonly T[] | undefined,\n field: string,\n keys: readonly string[],\n validate: (entry: T, field: string) => void,\n) {\n if (list === undefined) return\n if (!Array.isArray(list)) throw new Error(`${field} must be a list.`)\n list.forEach((entry, index) => {\n const entryField = `${field}[${index}]`\n assertExactKeys(entry, [...keys, 'claimId', 'evidence'], entryField)\n assertClaim(entry as BrandlabCredentialClaim, entryField)\n validate(entry, entryField)\n })\n}\n\nfunction assertCredentials(credentials: BrandlabBusinessCredentials, field: string) {\n assertExactKeys(credentials, ['insurance', 'qualifications', 'experience', 'established', 'afterHours'], field)\n assertCredentialList(credentials.insurance, `${field}.insurance`, ['cover', 'amountAud', 'insurer', 'expiresOn'], (entry, at) => {\n if (!(BRANDLAB_INSURANCE_COVERS as readonly string[]).includes(entry.cover)) {\n throw new Error(`${at}.cover must be one of ${BRANDLAB_INSURANCE_COVERS.join(', ')}.`)\n }\n if (!Number.isSafeInteger(entry.amountAud) || entry.amountAud <= 0) {\n throw new Error(`${at}.amountAud must be a whole number of dollars above zero.`)\n }\n if (entry.insurer !== undefined) assertText(entry.insurer, `${at}.insurer`, 120)\n if (entry.expiresOn !== undefined) assertIsoDay(entry.expiresOn, `${at}.expiresOn`)\n })\n assertCredentialList(credentials.qualifications, `${field}.qualifications`, ['title'], (entry, at) => {\n assertText(entry.title, `${at}.title`, 120)\n })\n assertCredentialList(credentials.experience, `${field}.experience`, ['years', 'holder', 'field'], (entry, at) => {\n if (!Number.isInteger(entry.years) || entry.years < 1 || entry.years > 80) {\n throw new Error(`${at}.years must be a whole number of years from 1 to 80.`)\n }\n if (!(BRANDLAB_EXPERIENCE_HOLDERS as readonly string[]).includes(entry.holder)) {\n throw new Error(`${at}.holder must be one of ${BRANDLAB_EXPERIENCE_HOLDERS.join(', ')}.`)\n }\n assertText(entry.field, `${at}.field`, 80)\n })\n const established = credentials.established\n if (established !== undefined) {\n const at = `${field}.established`\n assertExactKeys(established, ['year', 'month', 'claimId', 'evidence'], at)\n assertClaim(established, at)\n if (!Number.isInteger(established.year) || established.year < 1850) throw new Error(`${at}.year must be a four-digit year.`)\n if (established.month !== undefined && (!Number.isInteger(established.month) || established.month < 1 || established.month > 12)) {\n throw new Error(`${at}.month must be 1 to 12.`)\n }\n const verified = established.evidence.verifiedAt.slice(0, 7)\n const recorded = `${established.year}-${String(established.month ?? 1).padStart(2, '0')}`\n if (recorded > verified) throw new Error(`${at} is after the evidence for it was read (${established.evidence.verifiedAt}).`)\n }\n const afterHours = credentials.afterHours\n if (afterHours !== undefined) {\n const at = `${field}.afterHours`\n assertExactKeys(afterHours, ['work', 'endsOn', 'claimId', 'evidence'], at)\n assertClaim(afterHours, at)\n assertText(afterHours.work, `${at}.work`, 120)\n if (afterHours.endsOn !== undefined) assertIsoDay(afterHours.endsOn, `${at}.endsOn`)\n }\n}\n\n/** Validates a site's credentials (also checked inside `defineBrandlabBusiness`) and returns them unchanged. */\nexport function defineBusinessCredentials<const T extends BrandlabBusinessCredentials>(credentials: T): T {\n assertCredentials(credentials, 'credentials')\n return credentials\n}\n\nfunction claimMayRender(claim: BrandlabCredentialClaim, surface: BrandlabEvidenceSurface, asOf: Date): boolean {\n if (!claim.evidence.allowedSurfaces.includes(surface)) return false\n return !(claim.evidence.expiresAt && Date.parse(claim.evidence.expiresAt) < asOf.getTime())\n}\n\nfunction withoutEvidence<T extends BrandlabCredentialClaim>(entry: T): Omit<T, 'evidence'> {\n const { evidence: _evidence, ...rest } = entry\n return rest\n}\n\n/**\n * The credentials a surface may show on `asOf`: only entries whose evidence allows the surface and has not expired,\n * no insurance past its `expiresOn` and no after-hours offer past its `endsOn` (Sydney). The evidence stays behind; the claim id comes along so the page\n * can be traced to the register.\n */\nexport function renderableCredentials(\n credentials: BrandlabBusinessCredentials | undefined,\n surface: BrandlabEvidenceSurface,\n asOf: Date = new Date(),\n): BrandlabRenderableCredentials {\n const today = sydneyCalendarDate(asOf)\n const pick = <T extends BrandlabCredentialClaim>(list: readonly T[] | undefined) =>\n (list ?? []).filter((entry) => claimMayRender(entry, surface, asOf)).map(withoutEvidence)\n const established = credentials?.established\n const afterHours = credentials?.afterHours\n const afterHoursRuns = afterHours !== undefined && (afterHours.endsOn === undefined || afterHours.endsOn >= today)\n return {\n insurance: pick(credentials?.insurance).filter((entry) => entry.expiresOn === undefined || entry.expiresOn >= today),\n qualifications: pick(credentials?.qualifications),\n experience: pick(credentials?.experience),\n ...(established && claimMayRender(established, surface, asOf) ? { established: withoutEvidence(established) } : {}),\n ...(afterHours && afterHoursRuns && claimMayRender(afterHours, surface, asOf) ? { afterHours: withoutEvidence(afterHours) } : {}),\n }\n}\n\n/** A cover amount as copy says it: \"$20 million\", \"$2.5 million\", or the dollar figure under a million. */\nexport function formatInsuranceAmount(amountAud: number): string {\n if (amountAud >= 1_000_000) {\n const millions = Math.round((amountAud / 1_000_000) * 10) / 10\n return `$${millions.toLocaleString('en-AU')} million`\n }\n return `$${amountAud.toLocaleString('en-AU')}`\n}\n\n/** Whole years since the business was established, on `asOf` in Sydney; without a month only completed calendar years count. */\nexport function yearsSinceEstablished(established: BrandlabEstablishment, asOf: Date = new Date()): number {\n const [year, month] = sydneyCalendarDate(asOf).split('-').map(Number) as [number, number]\n if (established.month === undefined) return Math.max(0, year - established.year - 1)\n return Math.max(0, year - established.year - (month < established.month ? 1 : 0))\n}\n"]}