@brandlab-digital/site-core 3.13.0 → 3.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -0
- package/dist/area-map.d.ts +36 -3
- package/dist/area-map.d.ts.map +1 -1
- package/dist/area-map.js +71 -11
- package/dist/area-map.js.map +1 -1
- package/dist/business.d.ts +97 -0
- package/dist/business.d.ts.map +1 -1
- package/dist/business.js +128 -0
- package/dist/business.js.map +1 -1
- package/dist/council-register.d.ts +53 -0
- package/dist/council-register.d.ts.map +1 -0
- package/dist/council-register.js +113 -0
- package/dist/council-register.js.map +1 -0
- package/dist/geography.js +2 -2
- package/dist/geography.js.map +1 -1
- package/dist/jobs.d.ts +74 -0
- package/dist/jobs.d.ts.map +1 -0
- package/dist/jobs.js +116 -0
- package/dist/jobs.js.map +1 -0
- package/dist/locations.d.ts +10 -0
- package/dist/locations.d.ts.map +1 -1
- package/dist/locations.js +15 -0
- package/dist/locations.js.map +1 -1
- package/dist/navigation.d.ts +37 -1
- package/dist/navigation.d.ts.map +1 -1
- package/dist/navigation.js +107 -2
- package/dist/navigation.js.map +1 -1
- package/dist/page-titles.d.ts +71 -0
- package/dist/page-titles.d.ts.map +1 -0
- package/dist/page-titles.js +161 -0
- package/dist/page-titles.js.map +1 -0
- package/dist/project.d.ts +23 -0
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +33 -1
- package/dist/project.js.map +1 -1
- package/dist/section-order.d.ts +49 -3
- package/dist/section-order.d.ts.map +1 -1
- package/dist/section-order.js +108 -3
- package/dist/section-order.js.map +1 -1
- package/dist/strategy.d.ts +208 -0
- package/dist/strategy.d.ts.map +1 -1
- package/dist/strategy.js +340 -2
- package/dist/strategy.js.map +1 -1
- package/package.json +13 -1
package/dist/business.d.ts
CHANGED
|
@@ -139,6 +139,8 @@ export interface BrandlabBusiness {
|
|
|
139
139
|
};
|
|
140
140
|
/** Optional structured proof references for projects that use them operationally. */
|
|
141
141
|
proof?: BrandlabFact<readonly BrandlabProofReference[]>;
|
|
142
|
+
/** Insurance, qualifications, experience and the established date, each with its evidence (3.14.0). */
|
|
143
|
+
credentials?: BrandlabBusinessCredentials;
|
|
142
144
|
}
|
|
143
145
|
export interface BrandlabDerivedBusinessFacts {
|
|
144
146
|
tradingName: string;
|
|
@@ -222,4 +224,99 @@ export declare function deriveBusinessFacts(business: BrandlabBusiness): Brandla
|
|
|
222
224
|
* evidence, so they are never part of the display values (`proof` is empty).
|
|
223
225
|
*/
|
|
224
226
|
export declare function deriveBusinessDisplayFacts(values: BrandlabBusinessFactValues): BrandlabDerivedBusinessFacts;
|
|
227
|
+
/** The insurance covers a site may name. */
|
|
228
|
+
export declare const BRANDLAB_INSURANCE_COVERS: readonly ["public-liability", "professional-indemnity", "workers-compensation"];
|
|
229
|
+
export type BrandlabInsuranceCover = (typeof BRANDLAB_INSURANCE_COVERS)[number];
|
|
230
|
+
/** Whose experience a years figure is: the practitioner's (never claimed as the company's) or the business's own. */
|
|
231
|
+
export declare const BRANDLAB_EXPERIENCE_HOLDERS: readonly ["practitioner", "business"];
|
|
232
|
+
export type BrandlabExperienceHolder = (typeof BRANDLAB_EXPERIENCE_HOLDERS)[number];
|
|
233
|
+
/**
|
|
234
|
+
* What every credential carries: the claims-register entry that approves its wording (`docs/claims-register.md`, for
|
|
235
|
+
* example AA's "CLM-22") and the evidence for it. The evidence's `allowedSurfaces` and `expiresAt` decide where and
|
|
236
|
+
* until when it renders.
|
|
237
|
+
*/
|
|
238
|
+
export interface BrandlabCredentialClaim {
|
|
239
|
+
/** The claims-register id, for example "CLM-21": capital letters, a hyphen and a number. */
|
|
240
|
+
claimId: string;
|
|
241
|
+
evidence: EvidenceReference;
|
|
242
|
+
}
|
|
243
|
+
export interface BrandlabInsurance {
|
|
244
|
+
cover: BrandlabInsuranceCover;
|
|
245
|
+
/** The cover in whole Australian dollars, for example 20_000_000. */
|
|
246
|
+
amountAud: number;
|
|
247
|
+
insurer?: string;
|
|
248
|
+
/** YYYY-MM-DD the policy (certificate of currency) runs to; from the day after, it never renders. */
|
|
249
|
+
expiresOn?: string;
|
|
250
|
+
}
|
|
251
|
+
/** A qualification as the business may state it, without a person's name ("AQF Level 3-qualified arborist"). */
|
|
252
|
+
export interface BrandlabQualification {
|
|
253
|
+
title: string;
|
|
254
|
+
}
|
|
255
|
+
/** "More than {years} years of {field} experience": at least this many whole years, as the evidence recorded them. */
|
|
256
|
+
export interface BrandlabExperience {
|
|
257
|
+
years: number;
|
|
258
|
+
holder: BrandlabExperienceHolder;
|
|
259
|
+
/** The work, for example "tree work". */
|
|
260
|
+
field: string;
|
|
261
|
+
}
|
|
262
|
+
/** When the business was established (for example from the ABN's active-from date). */
|
|
263
|
+
export interface BrandlabEstablishment {
|
|
264
|
+
year: number;
|
|
265
|
+
/** 1 to 12, when known. */
|
|
266
|
+
month?: number;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* After-hours work the business really does (3.15.0), recorded in the claims register like any credential: what the
|
|
270
|
+
* work is and, for a seasonal offer such as a storm season, the last day it runs. `EmergencyBand` renders only while a
|
|
271
|
+
* renderable entry exists; it never carries a response time, which no entry records.
|
|
272
|
+
*/
|
|
273
|
+
export interface BrandlabAfterHours {
|
|
274
|
+
/** The work done after hours, for example "fallen and storm-damaged trees". */
|
|
275
|
+
work: string;
|
|
276
|
+
/** YYYY-MM-DD the offer ends (a storm season); from the day after (Sydney), it never renders. */
|
|
277
|
+
endsOn?: string;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* The credentials a site may show (3.14.0). Each entry has its own claim id and evidence, so an owner-confirmed figure
|
|
281
|
+
* and a certificate-backed one are recorded side by side. Nothing renders without evidence: read them for a page with
|
|
282
|
+
* `renderableCredentials`.
|
|
283
|
+
*/
|
|
284
|
+
export interface BrandlabBusinessCredentials {
|
|
285
|
+
insurance?: readonly (BrandlabInsurance & BrandlabCredentialClaim)[];
|
|
286
|
+
qualifications?: readonly (BrandlabQualification & BrandlabCredentialClaim)[];
|
|
287
|
+
experience?: readonly (BrandlabExperience & BrandlabCredentialClaim)[];
|
|
288
|
+
established?: BrandlabEstablishment & BrandlabCredentialClaim;
|
|
289
|
+
/** After-hours work (3.15.0). */
|
|
290
|
+
afterHours?: BrandlabAfterHours & BrandlabCredentialClaim;
|
|
291
|
+
}
|
|
292
|
+
/** The credentials a surface may show, without their evidence. */
|
|
293
|
+
export interface BrandlabRenderableCredentials {
|
|
294
|
+
insurance: readonly (BrandlabInsurance & {
|
|
295
|
+
claimId: string;
|
|
296
|
+
})[];
|
|
297
|
+
qualifications: readonly (BrandlabQualification & {
|
|
298
|
+
claimId: string;
|
|
299
|
+
})[];
|
|
300
|
+
experience: readonly (BrandlabExperience & {
|
|
301
|
+
claimId: string;
|
|
302
|
+
})[];
|
|
303
|
+
established?: BrandlabEstablishment & {
|
|
304
|
+
claimId: string;
|
|
305
|
+
};
|
|
306
|
+
afterHours?: BrandlabAfterHours & {
|
|
307
|
+
claimId: string;
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
/** Validates a site's credentials (also checked inside `defineBrandlabBusiness`) and returns them unchanged. */
|
|
311
|
+
export declare function defineBusinessCredentials<const T extends BrandlabBusinessCredentials>(credentials: T): T;
|
|
312
|
+
/**
|
|
313
|
+
* The credentials a surface may show on `asOf`: only entries whose evidence allows the surface and has not expired,
|
|
314
|
+
* 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
|
|
315
|
+
* can be traced to the register.
|
|
316
|
+
*/
|
|
317
|
+
export declare function renderableCredentials(credentials: BrandlabBusinessCredentials | undefined, surface: BrandlabEvidenceSurface, asOf?: Date): BrandlabRenderableCredentials;
|
|
318
|
+
/** A cover amount as copy says it: "$20 million", "$2.5 million", or the dollar figure under a million. */
|
|
319
|
+
export declare function formatInsuranceAmount(amountAud: number): string;
|
|
320
|
+
/** Whole years since the business was established, on `asOf` in Sydney; without a month only completed calendar years count. */
|
|
321
|
+
export declare function yearsSinceEstablished(established: BrandlabEstablishment, asOf?: Date): number;
|
|
225
322
|
//# sourceMappingURL=business.d.ts.map
|
package/dist/business.d.ts.map
CHANGED
|
@@ -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,GACf;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhD,MAAM,WAAW,mBAAmB;IAClC,8FAA8F;IAC9F,OAAO,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,C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,EAAE,qBAAqB,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;IACzD,UAAU,CAAC,EAAE,kBAAkB,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CACtD;AA0ED,gHAAgH;AAChH,wBAAgB,yBAAyB,CAAC,KAAK,CAAC,CAAC,SAAS,2BAA2B,EAAE,WAAW,EAAE,CAAC,GAAG,CAAC,CAGxG;AAYD;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,2BAA2B,GAAG,SAAS,EACpD,OAAO,EAAE,uBAAuB,EAChC,IAAI,GAAE,IAAiB,GACtB,6BAA6B,CAc/B;AAED,2GAA2G;AAC3G,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAM/D;AAED,gIAAgI;AAChI,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,qBAAqB,EAAE,IAAI,GAAE,IAAiB,GAAG,MAAM,CAIzG"}
|
package/dist/business.js
CHANGED
|
@@ -303,6 +303,7 @@ export function defineBrandlabBusiness(business) {
|
|
|
303
303
|
'registration',
|
|
304
304
|
'externalEntities',
|
|
305
305
|
'proof',
|
|
306
|
+
'credentials',
|
|
306
307
|
], 'business');
|
|
307
308
|
assertExactKeys(business.identity, ['tradingName', 'legalName'], 'identity');
|
|
308
309
|
assertExactKeys(business.contact, ['phone', 'email'], 'contact');
|
|
@@ -339,6 +340,8 @@ export function defineBrandlabBusiness(business) {
|
|
|
339
340
|
});
|
|
340
341
|
});
|
|
341
342
|
}
|
|
343
|
+
if (business.credentials !== undefined)
|
|
344
|
+
assertCredentials(business.credentials, 'credentials');
|
|
342
345
|
assertLocationModel({
|
|
343
346
|
model: business.location.model,
|
|
344
347
|
addressVisibility: business.location.addressVisibility,
|
|
@@ -618,4 +621,129 @@ function assertBusinessFactValues(values) {
|
|
|
618
621
|
}
|
|
619
622
|
assertLocationModel(values.location);
|
|
620
623
|
}
|
|
624
|
+
// ---------------------------------------------------------------------------
|
|
625
|
+
// Credentials: insurance, qualifications, experience, established (3.14.0)
|
|
626
|
+
// ---------------------------------------------------------------------------
|
|
627
|
+
/** The insurance covers a site may name. */
|
|
628
|
+
export const BRANDLAB_INSURANCE_COVERS = ['public-liability', 'professional-indemnity', 'workers-compensation'];
|
|
629
|
+
/** Whose experience a years figure is: the practitioner's (never claimed as the company's) or the business's own. */
|
|
630
|
+
export const BRANDLAB_EXPERIENCE_HOLDERS = ['practitioner', 'business'];
|
|
631
|
+
const CLAIM_ID = /^[A-Z][A-Z0-9]*-\d+$/;
|
|
632
|
+
function assertClaim(claim, field) {
|
|
633
|
+
if (typeof claim.claimId !== 'string' || !CLAIM_ID.test(claim.claimId)) {
|
|
634
|
+
throw new Error(`${field}.claimId must be the claims-register id, such as "CLM-21".`);
|
|
635
|
+
}
|
|
636
|
+
assertEvidenceReference(claim.evidence, `${field}.evidence`);
|
|
637
|
+
}
|
|
638
|
+
function assertCredentialList(list, field, keys, validate) {
|
|
639
|
+
if (list === undefined)
|
|
640
|
+
return;
|
|
641
|
+
if (!Array.isArray(list))
|
|
642
|
+
throw new Error(`${field} must be a list.`);
|
|
643
|
+
list.forEach((entry, index) => {
|
|
644
|
+
const entryField = `${field}[${index}]`;
|
|
645
|
+
assertExactKeys(entry, [...keys, 'claimId', 'evidence'], entryField);
|
|
646
|
+
assertClaim(entry, entryField);
|
|
647
|
+
validate(entry, entryField);
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
function assertCredentials(credentials, field) {
|
|
651
|
+
assertExactKeys(credentials, ['insurance', 'qualifications', 'experience', 'established', 'afterHours'], field);
|
|
652
|
+
assertCredentialList(credentials.insurance, `${field}.insurance`, ['cover', 'amountAud', 'insurer', 'expiresOn'], (entry, at) => {
|
|
653
|
+
if (!BRANDLAB_INSURANCE_COVERS.includes(entry.cover)) {
|
|
654
|
+
throw new Error(`${at}.cover must be one of ${BRANDLAB_INSURANCE_COVERS.join(', ')}.`);
|
|
655
|
+
}
|
|
656
|
+
if (!Number.isSafeInteger(entry.amountAud) || entry.amountAud <= 0) {
|
|
657
|
+
throw new Error(`${at}.amountAud must be a whole number of dollars above zero.`);
|
|
658
|
+
}
|
|
659
|
+
if (entry.insurer !== undefined)
|
|
660
|
+
assertText(entry.insurer, `${at}.insurer`, 120);
|
|
661
|
+
if (entry.expiresOn !== undefined)
|
|
662
|
+
assertIsoDay(entry.expiresOn, `${at}.expiresOn`);
|
|
663
|
+
});
|
|
664
|
+
assertCredentialList(credentials.qualifications, `${field}.qualifications`, ['title'], (entry, at) => {
|
|
665
|
+
assertText(entry.title, `${at}.title`, 120);
|
|
666
|
+
});
|
|
667
|
+
assertCredentialList(credentials.experience, `${field}.experience`, ['years', 'holder', 'field'], (entry, at) => {
|
|
668
|
+
if (!Number.isInteger(entry.years) || entry.years < 1 || entry.years > 80) {
|
|
669
|
+
throw new Error(`${at}.years must be a whole number of years from 1 to 80.`);
|
|
670
|
+
}
|
|
671
|
+
if (!BRANDLAB_EXPERIENCE_HOLDERS.includes(entry.holder)) {
|
|
672
|
+
throw new Error(`${at}.holder must be one of ${BRANDLAB_EXPERIENCE_HOLDERS.join(', ')}.`);
|
|
673
|
+
}
|
|
674
|
+
assertText(entry.field, `${at}.field`, 80);
|
|
675
|
+
});
|
|
676
|
+
const established = credentials.established;
|
|
677
|
+
if (established !== undefined) {
|
|
678
|
+
const at = `${field}.established`;
|
|
679
|
+
assertExactKeys(established, ['year', 'month', 'claimId', 'evidence'], at);
|
|
680
|
+
assertClaim(established, at);
|
|
681
|
+
if (!Number.isInteger(established.year) || established.year < 1850)
|
|
682
|
+
throw new Error(`${at}.year must be a four-digit year.`);
|
|
683
|
+
if (established.month !== undefined && (!Number.isInteger(established.month) || established.month < 1 || established.month > 12)) {
|
|
684
|
+
throw new Error(`${at}.month must be 1 to 12.`);
|
|
685
|
+
}
|
|
686
|
+
const verified = established.evidence.verifiedAt.slice(0, 7);
|
|
687
|
+
const recorded = `${established.year}-${String(established.month ?? 1).padStart(2, '0')}`;
|
|
688
|
+
if (recorded > verified)
|
|
689
|
+
throw new Error(`${at} is after the evidence for it was read (${established.evidence.verifiedAt}).`);
|
|
690
|
+
}
|
|
691
|
+
const afterHours = credentials.afterHours;
|
|
692
|
+
if (afterHours !== undefined) {
|
|
693
|
+
const at = `${field}.afterHours`;
|
|
694
|
+
assertExactKeys(afterHours, ['work', 'endsOn', 'claimId', 'evidence'], at);
|
|
695
|
+
assertClaim(afterHours, at);
|
|
696
|
+
assertText(afterHours.work, `${at}.work`, 120);
|
|
697
|
+
if (afterHours.endsOn !== undefined)
|
|
698
|
+
assertIsoDay(afterHours.endsOn, `${at}.endsOn`);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
/** Validates a site's credentials (also checked inside `defineBrandlabBusiness`) and returns them unchanged. */
|
|
702
|
+
export function defineBusinessCredentials(credentials) {
|
|
703
|
+
assertCredentials(credentials, 'credentials');
|
|
704
|
+
return credentials;
|
|
705
|
+
}
|
|
706
|
+
function claimMayRender(claim, surface, asOf) {
|
|
707
|
+
if (!claim.evidence.allowedSurfaces.includes(surface))
|
|
708
|
+
return false;
|
|
709
|
+
return !(claim.evidence.expiresAt && Date.parse(claim.evidence.expiresAt) < asOf.getTime());
|
|
710
|
+
}
|
|
711
|
+
function withoutEvidence(entry) {
|
|
712
|
+
const { evidence: _evidence, ...rest } = entry;
|
|
713
|
+
return rest;
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* The credentials a surface may show on `asOf`: only entries whose evidence allows the surface and has not expired,
|
|
717
|
+
* 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
|
|
718
|
+
* can be traced to the register.
|
|
719
|
+
*/
|
|
720
|
+
export function renderableCredentials(credentials, surface, asOf = new Date()) {
|
|
721
|
+
const today = sydneyCalendarDate(asOf);
|
|
722
|
+
const pick = (list) => (list ?? []).filter((entry) => claimMayRender(entry, surface, asOf)).map(withoutEvidence);
|
|
723
|
+
const established = credentials?.established;
|
|
724
|
+
const afterHours = credentials?.afterHours;
|
|
725
|
+
const afterHoursRuns = afterHours !== undefined && (afterHours.endsOn === undefined || afterHours.endsOn >= today);
|
|
726
|
+
return {
|
|
727
|
+
insurance: pick(credentials?.insurance).filter((entry) => entry.expiresOn === undefined || entry.expiresOn >= today),
|
|
728
|
+
qualifications: pick(credentials?.qualifications),
|
|
729
|
+
experience: pick(credentials?.experience),
|
|
730
|
+
...(established && claimMayRender(established, surface, asOf) ? { established: withoutEvidence(established) } : {}),
|
|
731
|
+
...(afterHours && afterHoursRuns && claimMayRender(afterHours, surface, asOf) ? { afterHours: withoutEvidence(afterHours) } : {}),
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
/** A cover amount as copy says it: "$20 million", "$2.5 million", or the dollar figure under a million. */
|
|
735
|
+
export function formatInsuranceAmount(amountAud) {
|
|
736
|
+
if (amountAud >= 1_000_000) {
|
|
737
|
+
const millions = Math.round((amountAud / 1_000_000) * 10) / 10;
|
|
738
|
+
return `$${millions.toLocaleString('en-AU')} million`;
|
|
739
|
+
}
|
|
740
|
+
return `$${amountAud.toLocaleString('en-AU')}`;
|
|
741
|
+
}
|
|
742
|
+
/** Whole years since the business was established, on `asOf` in Sydney; without a month only completed calendar years count. */
|
|
743
|
+
export function yearsSinceEstablished(established, asOf = new Date()) {
|
|
744
|
+
const [year, month] = sydneyCalendarDate(asOf).split('-').map(Number);
|
|
745
|
+
if (established.month === undefined)
|
|
746
|
+
return Math.max(0, year - established.year - 1);
|
|
747
|
+
return Math.max(0, year - established.year - (month < established.month ? 1 : 0));
|
|
748
|
+
}
|
|
621
749
|
//# sourceMappingURL=business.js.map
|