@brandlab-digital/site-next 3.18.0 → 3.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -101,7 +101,7 @@ export declare const REPEATED_SLOTS: {
101
101
  };
102
102
  readonly licences: {
103
103
  readonly scope: "[data-bl-section=\"licences\"] [data-slot=\"list\"]";
104
- readonly slots: readonly ["row", "label", "value", "number", "holder", "classes", "class", "register", "cover", "amount"];
104
+ readonly slots: readonly ["row", "label", "value", "number", "holder", "classes", "class", "register", "cover", "amount", "date", "abn", "lookup"];
105
105
  };
106
106
  readonly thankYou: {
107
107
  readonly scope: "[data-bl=\"thank-you\"]";
@@ -77,7 +77,7 @@ export const REPEATED_SLOTS = {
77
77
  beforeAfter: { scope: '[data-bl-section="before-after"] [data-slot="list"]', slots: ['pair', 'frames', 'frame', 'note'] },
78
78
  licences: {
79
79
  scope: '[data-bl-section="licences"] [data-slot="list"]',
80
- slots: ['row', 'label', 'value', 'number', 'holder', 'classes', 'class', 'register', 'cover', 'amount'],
80
+ slots: ['row', 'label', 'value', 'number', 'holder', 'classes', 'class', 'register', 'cover', 'amount', 'date', 'abn', 'lookup'],
81
81
  },
82
82
  thankYou: { scope: '[data-bl="thank-you"]', slots: ['step'] },
83
83
  photoUpload: { scope: '[data-bl="photo-upload"]', slots: ['photo', 'thumb', 'remove'] },
@@ -1 +1 @@
1
- {"version":3,"file":"repeated-slots.js","sourceRoot":"","sources":["../../src/ui-kit/repeated-slots.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,UAAU,EAAE;QACV,KAAK,EAAE,uCAAuC;QAC9C,KAAK,EAAE;YACL,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW;YAClH,YAAY,EAAE,WAAW,EAAE,UAAU,E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K,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;IAC/D,IAAI,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;IAC7D,IAAI,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE;IACtE,QAAQ,EAAE,EAAE,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;IACrF,mGAAmG;IACnG,QAAQ,EAAE,EAAE,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE;CACxG,CAAA;AAMV,sHAAsH;AACtH,MAAM,UAAU,oBAAoB,CAA0C,SAAoB,EAAE,IAA+B;IACjI,MAAM,KAAK,GAAkF,cAAc,CAAC,SAAS,CAAC,CAAA;IACtH,OAAO,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,IAAI,eAAe,IAAI,IAAI,EAAE,CAAA;AAC3E,CAAC","sourcesContent":["/**\n * The repeated slots of every shared component (3.14.0): the parts a component renders once per entry of a list in\n * its data. They carry their `data-slot` hook and never a class, so a long class string is not repeated in the HTML and\n * the RSC payload for every link, review, star, card or chip. A site styles them once in `src/site/skin.css`:\n *\n * ```css\n * @layer components {\n * [data-bl=\"footer\"] [data-slot=\"link\"] { @apply text-sm text-white/80 hover:text-white; }\n * [data-bl=\"header\"] [data-slot=\"list\"] [data-slot=\"panelLink\"] { padding: 0.5rem 0.75rem; }\n * }\n * ```\n *\n * `scope` is the selector that holds the repeated slots without reaching a nested component that reuses a slot name\n * (the drawer sits inside the header; the rating chip inside the reviews band uses `stars` too).\n * `repeatedSlotSelector()` joins the two. Pure data: safe to import anywhere.\n */\nexport const REPEATED_SLOTS = {\n siteHeader: {\n scope: '[data-bl=\"header\"] [data-slot=\"list\"]',\n slots: [\n 'item', 'itemRow', 'link', 'trigger', 'panel', 'panelBody', 'panelList', 'panelGroup', 'panelHeading', 'panelLink',\n 'panelLabel', 'panelText', 'featured', 'featuredMedia', 'featuredLabel', 'featuredText',\n ],\n },\n mobileDrawer: {\n scope: '[data-bl=\"drawer\"]',\n slots: ['group', 'groupTrigger', 'groupLinks', 'groupLink', 'link', 'socialLink'],\n },\n utilityBar: { scope: '[data-bl=\"utility\"]', slots: ['item', 'licence', 'socialLink'] },\n siteFooter: {\n scope: '[data-bl=\"footer\"]',\n slots: ['licenceLink', 'socialLink', 'column', 'heading', 'toggle', 'list', 'link', 'policyLink'],\n },\n accordion: { scope: '[data-bl=\"accordion\"]', slots: ['item', 'summary', 'label', 'marker', 'content'] },\n faqs: {\n scope: '[data-bl-section=\"faqs\"] [data-slot=\"columns\"]',\n slots: ['column', 'group', 'subheading', 'accordion', 'item', 'summary', 'label', 'marker', 'content'],\n /** The nested accordion's root is its own component: `data-bl=\"accordion\"`, not a `data-slot`. */\n hooks: { accordion: '[data-bl=\"accordion\"]' },\n },\n priceTable: {\n scope: '[data-bl=\"price-table\"]',\n slots: ['row', 'job', 'cell', 'label', 'range', 'unit', 'gst', 'parts', 'part', 'includes', 'excludes'],\n },\n priceGuide: {\n scope: '[data-bl-section=\"price-guide\"]',\n slots: [\n 'row', 'job', 'cell', 'label', 'range', 'unit', 'gst', 'parts', 'part', 'includes', 'excludes', 'card', 'title',\n 'figures', 'band', 'factor', 'name', 'effect', 'detail',\n ],\n },\n proofStrip: {\n scope: '[data-bl-section=\"proof-strip\"] [data-slot=\"list\"]',\n slots: ['item', 'link', 'icon', 'stars', 'value', 'label', 'linkLabel'],\n },\n reviewsBand: {\n scope: '[data-bl-section=\"reviews\"] [data-slot=\"list\"]',\n slots: ['item', 'stars', 'quote', 'more', 'author', 'avatar', 'name', 'date'],\n },\n contactBlock: { scope: '[data-bl-section=\"contact\"] [data-slot=\"details\"]', slots: ['line', 'note'] },\n servicesGrid: {\n scope: '[data-bl-section=\"services\"] [data-slot=\"list\"]',\n slots: ['item', 'body', 'media', 'title', 'summary', 'points', 'point', 'action', 'link'],\n },\n breadcrumbs: { scope: '[data-bl=\"breadcrumbs\"]', slots: ['item', 'link', 'current'] },\n // Location sections (3.15.0). Their link lists are `LinkList`s, reached through `linkList` (`[data-bl=\"link-list\"]`).\n localFacts: { scope: '[data-bl-section=\"local-facts\"]', slots: ['fact', 'factSource', 'fee'] },\n councilRules: { scope: '[data-bl-section=\"council-rules\"]', slots: ['fee'] },\n nearbyJobs: { scope: '[data-bl-section=\"nearby-jobs\"] [data-slot=\"list\"]', slots: ['item', 'body', 'media', 'title', 'link', 'outcome', 'cue'] },\n coverage: { scope: '[data-bl-section=\"coverage\"] [data-slot=\"groups\"]', slots: ['group', 'groupHeading'] },\n relatedServices: {\n scope: '[data-bl-section=\"related-services\"] [data-slot=\"list\"]',\n slots: ['item', 'body', 'media', 'title', 'summary', 'link'],\n },\n // Proof sections (3.15.0). Their photos are nested `[data-bl=\"media\"]` frames; project cards are `[data-bl=\"card\"]`.\n gallery: { scope: '[data-bl-section=\"gallery\"] [data-slot=\"list\"]', slots: ['item', 'link'] },\n beforeAfter: { scope: '[data-bl-section=\"before-after\"] [data-slot=\"list\"]', slots: ['pair', 'frames', 'frame', 'note'] },\n licences: {\n scope: '[data-bl-section=\"licences\"] [data-slot=\"list\"]',\n slots: ['row', 'label', 'value', 'number', 'holder', 'classes', 'class', 'register', 'cover', 'amount'],\n },\n thankYou: { scope: '[data-bl=\"thank-you\"]', slots: ['step'] },\n photoUpload: { scope: '[data-bl=\"photo-upload\"]', slots: ['photo', 'thumb', 'remove'] },\n quoteForm: { scope: '[data-bl=\"quote-form\"] [data-bl=\"photo-upload\"]', slots: ['photo', 'thumb', 'remove'] },\n // Primitives rendered once per list entry (3.14.0): every part is repeated, the root included (style the root\n // through its own hook, `[data-bl=\"card\"]`).\n card: { scope: '[data-bl=\"card\"]', slots: ['media', 'body', 'title', 'link', 'text', 'meta'] },\n badge: { scope: '[data-bl=\"badge\"]', slots: ['icon', 'label'] },\n chip: { scope: '[data-bl=\"chip\"]', slots: ['icon', 'label'] },\n stat: { scope: '[data-bl=\"stat\"]', slots: ['value', 'label', 'link'] },\n tickList: { scope: '[data-bl=\"tick-list\"]', slots: ['item', 'tick', 'text', 'link'] },\n /** A lean list (cost item 1f): plain `<li><a>` entries with no `data-slot`, reached by element. */\n linkList: { scope: '[data-bl=\"link-list\"]', slots: ['item', 'link'], hooks: { item: '> li', link: '> li > a' } },\n} as const\n\nexport type RepeatedSlotComponent = keyof typeof REPEATED_SLOTS\n/** The repeated slots of one component, for example `RepeatedSlotOf<'siteFooter'>` is `'licenceLink' | … | 'policyLink'`. */\nexport type RepeatedSlotOf<Component extends RepeatedSlotComponent> = (typeof REPEATED_SLOTS)[Component]['slots'][number]\n\n/** The selector a skin stylesheet uses for one repeated slot, for example `[data-bl=\"footer\"] [data-slot=\"link\"]`. */\nexport function repeatedSlotSelector<Component extends RepeatedSlotComponent>(component: Component, slot: RepeatedSlotOf<Component>): string {\n const entry: { readonly scope: string; readonly hooks?: Readonly<Record<string, string>> } = REPEATED_SLOTS[component]\n return `${entry.scope} ${entry.hooks?.[slot] ?? `[data-slot=\"${slot}\"]`}`\n}\n"]}
1
+ {"version":3,"file":"repeated-slots.js","sourceRoot":"","sources":["../../src/ui-kit/repeated-slots.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,UAAU,EAAE;QACV,KAAK,EAAE,uCAAuC;QAC9C,KAAK,EAAE;YACL,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE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M,EAAE,MAAM,CAAC,EAAE;IAC9F,KAAK,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;IAC/D,IAAI,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;IAC7D,IAAI,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE;IACtE,QAAQ,EAAE,EAAE,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;IACrF,mGAAmG;IACnG,QAAQ,EAAE,EAAE,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE;CACxG,CAAA;AAMV,sHAAsH;AACtH,MAAM,UAAU,oBAAoB,CAA0C,SAAoB,EAAE,IAA+B;IACjI,MAAM,KAAK,GAAkF,cAAc,CAAC,SAAS,CAAC,CAAA;IACtH,OAAO,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,IAAI,eAAe,IAAI,IAAI,EAAE,CAAA;AAC3E,CAAC","sourcesContent":["/**\n * The repeated slots of every shared component (3.14.0): the parts a component renders once per entry of a list in\n * its data. They carry their `data-slot` hook and never a class, so a long class string is not repeated in the HTML and\n * the RSC payload for every link, review, star, card or chip. A site styles them once in `src/site/skin.css`:\n *\n * ```css\n * @layer components {\n * [data-bl=\"footer\"] [data-slot=\"link\"] { @apply text-sm text-white/80 hover:text-white; }\n * [data-bl=\"header\"] [data-slot=\"list\"] [data-slot=\"panelLink\"] { padding: 0.5rem 0.75rem; }\n * }\n * ```\n *\n * `scope` is the selector that holds the repeated slots without reaching a nested component that reuses a slot name\n * (the drawer sits inside the header; the rating chip inside the reviews band uses `stars` too).\n * `repeatedSlotSelector()` joins the two. Pure data: safe to import anywhere.\n */\nexport const REPEATED_SLOTS = {\n siteHeader: {\n scope: '[data-bl=\"header\"] [data-slot=\"list\"]',\n slots: [\n 'item', 'itemRow', 'link', 'trigger', 'panel', 'panelBody', 'panelList', 'panelGroup', 'panelHeading', 'panelLink',\n 'panelLabel', 'panelText', 'featured', 'featuredMedia', 'featuredLabel', 'featuredText',\n ],\n },\n mobileDrawer: {\n scope: '[data-bl=\"drawer\"]',\n slots: ['group', 'groupTrigger', 'groupLinks', 'groupLink', 'link', 'socialLink'],\n },\n utilityBar: { scope: '[data-bl=\"utility\"]', slots: ['item', 'licence', 'socialLink'] },\n siteFooter: {\n scope: '[data-bl=\"footer\"]',\n slots: ['licenceLink', 'socialLink', 'column', 'heading', 'toggle', 'list', 'link', 'policyLink'],\n },\n accordion: { scope: '[data-bl=\"accordion\"]', slots: ['item', 'summary', 'label', 'marker', 'content'] },\n faqs: {\n scope: '[data-bl-section=\"faqs\"] [data-slot=\"columns\"]',\n slots: ['column', 'group', 'subheading', 'accordion', 'item', 'summary', 'label', 'marker', 'content'],\n /** The nested accordion's root is its own component: `data-bl=\"accordion\"`, not a `data-slot`. */\n hooks: { accordion: '[data-bl=\"accordion\"]' },\n },\n priceTable: {\n scope: '[data-bl=\"price-table\"]',\n slots: ['row', 'job', 'cell', 'label', 'range', 'unit', 'gst', 'parts', 'part', 'includes', 'excludes'],\n },\n priceGuide: {\n scope: '[data-bl-section=\"price-guide\"]',\n slots: [\n 'row', 'job', 'cell', 'label', 'range', 'unit', 'gst', 'parts', 'part', 'includes', 'excludes', 'card', 'title',\n 'figures', 'band', 'factor', 'name', 'effect', 'detail',\n ],\n },\n proofStrip: {\n scope: '[data-bl-section=\"proof-strip\"] [data-slot=\"list\"]',\n slots: ['item', 'link', 'icon', 'stars', 'value', 'label', 'linkLabel'],\n },\n reviewsBand: {\n scope: '[data-bl-section=\"reviews\"] [data-slot=\"list\"]',\n slots: ['item', 'stars', 'quote', 'more', 'author', 'avatar', 'name', 'date'],\n },\n contactBlock: { scope: '[data-bl-section=\"contact\"] [data-slot=\"details\"]', slots: ['line', 'note'] },\n servicesGrid: {\n scope: '[data-bl-section=\"services\"] [data-slot=\"list\"]',\n slots: ['item', 'body', 'media', 'title', 'summary', 'points', 'point', 'action', 'link'],\n },\n breadcrumbs: { scope: '[data-bl=\"breadcrumbs\"]', slots: ['item', 'link', 'current'] },\n // Location sections (3.15.0). Their link lists are `LinkList`s, reached through `linkList` (`[data-bl=\"link-list\"]`).\n localFacts: { scope: '[data-bl-section=\"local-facts\"]', slots: ['fact', 'factSource', 'fee'] },\n councilRules: { scope: '[data-bl-section=\"council-rules\"]', slots: ['fee'] },\n nearbyJobs: { scope: '[data-bl-section=\"nearby-jobs\"] [data-slot=\"list\"]', slots: ['item', 'body', 'media', 'title', 'link', 'outcome', 'cue'] },\n coverage: { scope: '[data-bl-section=\"coverage\"] [data-slot=\"groups\"]', slots: ['group', 'groupHeading'] },\n relatedServices: {\n scope: '[data-bl-section=\"related-services\"] [data-slot=\"list\"]',\n slots: ['item', 'body', 'media', 'title', 'summary', 'link'],\n },\n // Proof sections (3.15.0). Their photos are nested `[data-bl=\"media\"]` frames; project cards are `[data-bl=\"card\"]`.\n gallery: { scope: '[data-bl-section=\"gallery\"] [data-slot=\"list\"]', slots: ['item', 'link'] },\n beforeAfter: { scope: '[data-bl-section=\"before-after\"] [data-slot=\"list\"]', slots: ['pair', 'frames', 'frame', 'note'] },\n licences: {\n scope: '[data-bl-section=\"licences\"] [data-slot=\"list\"]',\n slots: ['row', 'label', 'value', 'number', 'holder', 'classes', 'class', 'register', 'cover', 'amount', 'date', 'abn', 'lookup'],\n },\n thankYou: { scope: '[data-bl=\"thank-you\"]', slots: ['step'] },\n photoUpload: { scope: '[data-bl=\"photo-upload\"]', slots: ['photo', 'thumb', 'remove'] },\n quoteForm: { scope: '[data-bl=\"quote-form\"] [data-bl=\"photo-upload\"]', slots: ['photo', 'thumb', 'remove'] },\n // Primitives rendered once per list entry (3.14.0): every part is repeated, the root included (style the root\n // through its own hook, `[data-bl=\"card\"]`).\n card: { scope: '[data-bl=\"card\"]', slots: ['media', 'body', 'title', 'link', 'text', 'meta'] },\n badge: { scope: '[data-bl=\"badge\"]', slots: ['icon', 'label'] },\n chip: { scope: '[data-bl=\"chip\"]', slots: ['icon', 'label'] },\n stat: { scope: '[data-bl=\"stat\"]', slots: ['value', 'label', 'link'] },\n tickList: { scope: '[data-bl=\"tick-list\"]', slots: ['item', 'tick', 'text', 'link'] },\n /** A lean list (cost item 1f): plain `<li><a>` entries with no `data-slot`, reached by element. */\n linkList: { scope: '[data-bl=\"link-list\"]', slots: ['item', 'link'], hooks: { item: '> li', link: '> li > a' } },\n} as const\n\nexport type RepeatedSlotComponent = keyof typeof REPEATED_SLOTS\n/** The repeated slots of one component, for example `RepeatedSlotOf<'siteFooter'>` is `'licenceLink' | … | 'policyLink'`. */\nexport type RepeatedSlotOf<Component extends RepeatedSlotComponent> = (typeof REPEATED_SLOTS)[Component]['slots'][number]\n\n/** The selector a skin stylesheet uses for one repeated slot, for example `[data-bl=\"footer\"] [data-slot=\"link\"]`. */\nexport function repeatedSlotSelector<Component extends RepeatedSlotComponent>(component: Component, slot: RepeatedSlotOf<Component>): string {\n const entry: { readonly scope: string; readonly hooks?: Readonly<Record<string, string>> } = REPEATED_SLOTS[component]\n return `${entry.scope} ${entry.hooks?.[slot] ?? `[data-slot=\"${slot}\"]`}`\n}\n"]}
@@ -18,6 +18,13 @@
18
18
  * with nothing to show, the section renders nothing;
19
19
  * - no default visible copy: the row labels, cover names and register link text are the site's (`labels`). A line
20
20
  * with no label fails the build rather than render unlabelled.
21
+ *
22
+ * Optional lines (3.19.0), shown only when the site gives their label:
23
+ * - `labels.experience` with `labels.experienceLine` ("More than {years} years of {field}"): the evidenced
24
+ * experience of the person doing the work (`holder: 'practitioner'`), right after the qualifications. A business's
25
+ * own age is never shown here; that is the established line;
26
+ * - `labels.established`: the month and year the business was established (`credentials.established`), and with
27
+ * `labels.abn` the verified ABN from `registration.abn`, linking to ABN Lookup when `labels.abnLookup` is given.
21
28
  */
22
29
  import type { ReactNode } from 'react';
23
30
  import { type BrandlabBusiness, type BrandlabInsuranceCover, type BrandlabLicence, type BrandlabRenderableCredentials } from '@brandlab-digital/site-core/business';
@@ -41,7 +48,21 @@ export interface LicencesLabels {
41
48
  readonly covers?: Readonly<Partial<Record<BrandlabInsuranceCover, string>>>;
42
49
  /** The register link's text, for example "Check the register". Left out, no register link renders. */
43
50
  readonly register?: string;
51
+ /** The experience row's label, for example "Experience" (3.19.0). Left out, the row doesn't render. */
52
+ readonly experience?: string;
53
+ /** Each experience line with `{years}` and `{field}`, for example "More than {years} years of {field}". */
54
+ readonly experienceLine?: string;
55
+ /** The established row's label, for example "Established" (3.19.0). Left out, the row doesn't render. */
56
+ readonly established?: string;
57
+ /** The ABN's label in the established row, for example "ABN". Left out, the ABN doesn't show. */
58
+ readonly abn?: string;
59
+ /** The ABN Lookup link's text, for example "Check ABN Lookup". Left out, the ABN shows without a link. */
60
+ readonly abnLookup?: string;
44
61
  }
62
+ /** The public ABN Lookup page for an 11-digit ABN. */
63
+ export declare function abnLookupUrl(abn: string): string;
64
+ /** An ABN as it is written: "12 345 678 901". */
65
+ export declare function formatAbn(abn: string): string;
45
66
  /** The business facts the ledger reads: `business.registration` and `business.credentials`. */
46
67
  export type LicencesBusiness = Pick<BrandlabBusiness, 'registration' | 'credentials'>;
47
68
  export interface LicencesProps extends LicencesSkin {
@@ -62,6 +83,8 @@ interface LedgerContent {
62
83
  readonly licences: readonly BrandlabLicence[];
63
84
  readonly credentials: BrandlabRenderableCredentials;
64
85
  readonly skips: readonly BrandlabSectionSlotSkip[];
86
+ /** The verified ABN the website may show (3.19.0). */
87
+ readonly abn?: string;
65
88
  }
66
89
  /** What the evidence lets the variant show today, and the expected lines it has to leave out. */
67
90
  export declare function licencesContent(business: LicencesBusiness, variant: LicencesVariant, asOf?: Date): LedgerContent;
@@ -1 +1 @@
1
- {"version":3,"file":"licences.d.ts","sourceRoot":"","sources":["../../../src/ui-kit/sections/licences.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAKL,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,6BAA6B,EACnC,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC7B,MAAM,2CAA2C,CAAA;AAClD,OAAO,EAA2B,KAAK,kBAAkB,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE9H,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAE/D,eAAO,MAAM,iBAAiB,wCAAyC,CAAA;AACvE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAChE,+EAA+E;AAC/E,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,UAAU,CAAC,CAAA;AAC7D,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,kBAAkB,GAAG,MAAM,GAAG,oBAAoB,CAAA;AAC3F,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC,YAAY,EAAE,eAAe,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,oBAAoB,CAAC,CAAA;AAE/G,kFAAkF;AAClF,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;IAChC,0DAA0D;IAC1D,QA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,EAAE,gBAAgB,CAAA;IACnC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAA;IAC/B,gDAAgD;IAChD,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAA;IACpB,sCAAsC;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,gCAAgC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAC5B;AAED,UAAU,aAAa;IACrB,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAA;IAC7C,QAAQ,CAAC,WAAW,EAAE,6BAA6B,CAAA;IACnD,QAAQ,CAAC,KAAK,EAAE,SAAS,uBAAuB,EAAE,CAAA;IAClD,sDAAsD;IACtD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,iGAAiG;AACjG,wBAAgB,eAAe,CAAC,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,eAAe,EAAE,IAAI,GAAE,IAAiB,GAAG,aAAa,CAkB5H;AAMD,kGAAkG;AAClG,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,OAAmB,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC,GAAG,wBAAwB,CAErJ;AA2CD,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,SAA8B,EAAE,IAAI,EAAE,OAAmB,EAAE,OAAO,EAAE,EAAE,aAAa,kDAqF3J"}
@@ -5,6 +5,16 @@ import { Section, SectionHeading } from '../primitives/layout.js';
5
5
  import { Anchor } from '../primitives/links.js';
6
6
  import { repeatedSlot, slot } from '../skin.js';
7
7
  export const LICENCES_VARIANTS = ['licence', 'qualifications'];
8
+ /** The public ABN Lookup page for an 11-digit ABN. */
9
+ export function abnLookupUrl(abn) {
10
+ return `https://abr.business.gov.au/ABN/View?abn=${abn.replace(/\s/g, '')}`;
11
+ }
12
+ /** An ABN as it is written: "12 345 678 901". */
13
+ export function formatAbn(abn) {
14
+ const digits = abn.replace(/\s/g, '');
15
+ return `${digits.slice(0, 2)} ${digits.slice(2, 5)} ${digits.slice(5, 8)} ${digits.slice(8)}`;
16
+ }
17
+ const MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
8
18
  /** What the evidence lets the variant show today, and the expected lines it has to leave out. */
9
19
  export function licencesContent(business, variant, asOf = new Date()) {
10
20
  const credentials = renderableCredentials(business.credentials, 'website-copy', asOf);
@@ -16,7 +26,17 @@ export function licencesContent(business, variant, asOf = new Date()) {
16
26
  skips.push({ slot: 'qualifications', reason: 'no-evidenced-qualification' });
17
27
  if (variant === 'qualifications' && credentials.insurance.length === 0)
18
28
  skips.push({ slot: 'insurance', reason: 'no-current-insurance' });
19
- return { licences, credentials: variant === 'qualifications' ? credentials : { ...credentials, qualifications: [] }, skips };
29
+ const abn = resolveVerifiedFactForSurface(business.registration.abn, 'website-copy', asOf);
30
+ return {
31
+ licences,
32
+ credentials: {
33
+ ...(variant === 'qualifications' ? credentials : { ...credentials, qualifications: [] }),
34
+ // A person's experience only: the business's age is the established line.
35
+ experience: credentials.experience.filter((entry) => entry.holder === 'practitioner'),
36
+ },
37
+ skips,
38
+ ...(abn ? { abn } : {}),
39
+ };
20
40
  }
21
41
  function hasLines({ licences, credentials }) {
22
42
  return licences.length + credentials.qualifications.length + credentials.insurance.length > 0;
@@ -37,10 +57,16 @@ export function Licences({ title, eyebrow, lead, business, labels, asOf, heading
37
57
  const content = licencesContent(business, variant, asOf);
38
58
  if (!hasLines(content))
39
59
  return null;
40
- const { licences, credentials, skips } = content;
60
+ const { licences, credentials, skips, abn } = content;
61
+ const experience = labels.experience && credentials.experience.length > 0 ? credentials.experience : [];
62
+ const experienceLine = experience.length > 0 ? required(labels.experienceLine, 'experienceLine') : undefined;
63
+ if (experienceLine && !experienceLine.includes('{years}'))
64
+ throw new Error('Licences: labels.experienceLine needs {years}.');
65
+ const established = labels.established ? credentials.established : undefined;
66
+ const shownAbn = established && labels.abn && abn ? abn : undefined;
41
67
  const qualificationsLabel = credentials.qualifications.length > 0 ? required(labels.qualifications, 'qualifications') : undefined;
42
68
  const insuranceLabel = credentials.insurance.length > 0 ? required(labels.insurance, 'insurance') : undefined;
43
69
  const coverName = (cover) => required(labels.covers?.[cover], `covers['${cover}']`);
44
- return (_jsxs(Section, { id: "licences", labelledBy: headingId, tone: tone, variant: variant, classes: classes, hooks: skips.length > 0 ? { [SECTION_SLOT_SKIP_ATTRIBUTE]: formatSectionSlotSkips(skips) } : undefined, children: [_jsx(SectionHeading, { id: headingId, title: title, eyebrow: eyebrow, lead: lead, classes: classes }), _jsxs("dl", { ...slot(classes, 'list'), children: [licences.map((licence) => (_jsx(LicenceLine, { licence: licence, registerLabel: labels.register }, `${licence.name}-${licence.identifier}`))), qualificationsLabel ? (_jsxs("div", { ...repeatedSlot('row'), [SECTION_SLOT_ATTRIBUTE]: 'qualifications', children: [_jsx("dt", { ...repeatedSlot('label'), children: qualificationsLabel }), credentials.qualifications.map((entry) => (_jsx("dd", { ...repeatedSlot('value'), children: entry.title }, entry.title)))] })) : null, insuranceLabel ? (_jsxs("div", { ...repeatedSlot('row'), [SECTION_SLOT_ATTRIBUTE]: 'insurance', children: [_jsx("dt", { ...repeatedSlot('label'), children: insuranceLabel }), credentials.insurance.map((entry) => (_jsxs("dd", { ...repeatedSlot('value'), children: [_jsx("span", { ...repeatedSlot('cover'), children: coverName(entry.cover) }), ' ', _jsx("span", { ...repeatedSlot('amount'), children: formatInsuranceAmount(entry.amountAud) })] }, `${entry.cover}-${entry.amountAud}`)))] })) : null] })] }));
70
+ return (_jsxs(Section, { id: "licences", labelledBy: headingId, tone: tone, variant: variant, classes: classes, hooks: skips.length > 0 ? { [SECTION_SLOT_SKIP_ATTRIBUTE]: formatSectionSlotSkips(skips) } : undefined, children: [_jsx(SectionHeading, { id: headingId, title: title, eyebrow: eyebrow, lead: lead, classes: classes }), _jsxs("dl", { ...slot(classes, 'list'), children: [licences.map((licence) => (_jsx(LicenceLine, { licence: licence, registerLabel: labels.register }, `${licence.name}-${licence.identifier}`))), qualificationsLabel ? (_jsxs("div", { ...repeatedSlot('row'), [SECTION_SLOT_ATTRIBUTE]: 'qualifications', children: [_jsx("dt", { ...repeatedSlot('label'), children: qualificationsLabel }), credentials.qualifications.map((entry) => (_jsx("dd", { ...repeatedSlot('value'), children: entry.title }, entry.title)))] })) : null, experienceLine ? (_jsxs("div", { ...repeatedSlot('row'), [SECTION_SLOT_ATTRIBUTE]: 'experience', children: [_jsx("dt", { ...repeatedSlot('label'), children: labels.experience }), experience.map((entry) => (_jsx("dd", { ...repeatedSlot('value'), children: experienceLine.replaceAll('{years}', String(entry.years)).replaceAll('{field}', entry.field) }, entry.claimId)))] })) : null, established ? (_jsxs("div", { ...repeatedSlot('row'), [SECTION_SLOT_ATTRIBUTE]: 'established', children: [_jsx("dt", { ...repeatedSlot('label'), children: labels.established }), _jsx("dd", { ...repeatedSlot('value'), children: _jsx("span", { ...repeatedSlot('date'), children: established.month ? `${MONTHS[established.month - 1]} ${established.year}` : established.year }) }), shownAbn ? (_jsxs("dd", { ...repeatedSlot('abn'), children: [labels.abn, " ", formatAbn(shownAbn), labels.abnLookup ? (_jsxs(_Fragment, { children: [' ', _jsx("span", { ...repeatedSlot('lookup'), children: _jsx(Anchor, { href: abnLookupUrl(shownAbn), prefetch: false, hooks: {}, children: labels.abnLookup }) })] })) : null] })) : null] })) : null, insuranceLabel ? (_jsxs("div", { ...repeatedSlot('row'), [SECTION_SLOT_ATTRIBUTE]: 'insurance', children: [_jsx("dt", { ...repeatedSlot('label'), children: insuranceLabel }), credentials.insurance.map((entry) => (_jsxs("dd", { ...repeatedSlot('value'), children: [_jsx("span", { ...repeatedSlot('cover'), children: coverName(entry.cover) }), ' ', _jsx("span", { ...repeatedSlot('amount'), children: formatInsuranceAmount(entry.amountAud) })] }, `${entry.cover}-${entry.amountAud}`)))] })) : null] })] }));
45
71
  }
46
72
  //# sourceMappingURL=licences.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"licences.js","sourceRoot":"","sources":["../../../src/ui-kit/sections/licences.tsx"],"names":[],"mappings":";AAsBA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,6BAA6B,GAK9B,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,GAGvB,MAAM,2CAA2C,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,cAAc,EAA+D,MAAM,yBAAyB,CAAA;AAC9H,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAE/C,OAAO,EAAE,YAAY,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AAE/D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,gBAAgB,CAAU,CAAA;AA2CvE,iGAAiG;AACjG,MAAM,UAAU,eAAe,CAAC,QAA0B,EAAE,OAAwB,EAAE,OAAa,IAAI,IAAI,EAAE;IAC3G,MAAM,WAAW,GAAG,qBAAqB,CAAC,QAAQ,CAAC,WAAW,EAAE,cAAc,EAAE,IAAI,CAAC,CAAA;IACrF,MAAM,QAAQ,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACjK,MAAM,KAAK,GAA8B,EAAE,CAAA;IAC3C,IAAI,OAAO,KAAK,SAAS,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,oBAA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,GAAG,EACpE,kBAAU,YAAY,CAAC,QAAQ,CAAC,YAAG,qBAAqB,CAAC,KAAK,CAAC,SAAS,CAAC,GAAQ,KAF1E,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,SAAS,EAAE,CAGvC,CACN,CAAC,IACE,CACP,CAAC,CAAC,CAAC,IAAI,IACL,IACG,CACX,CAAA;AACH,CAAC","sourcesContent":["/**\n * `Licences` (`licences`, 3.15.0): the business's credentials as a ruled ledger, read straight from the site's business\n * facts (`site-core/business`), so the page can only say what the evidence allows. Server component.\n *\n * Variants (matrix part B):\n * - `licence` (licensed trades): each current licence as the register shows it (its name, number, licensee, classes\n * with their conditions and the register link), then the insurance lines;\n * - `qualifications` (trades with no licence, such as tree work): the qualifications as the business may state them,\n * without a person's name (\"AQF Level 3-qualified arborist\"), then the insurance lines.\n *\n * Locked:\n * - licences come only from a verified `registration.licences` fact whose evidence allows website copy and has not\n * expired, less any expired licence (`renderableLicences`); a licence number is never typed in by hand;\n * - qualifications and insurance come only through `renderableCredentials(credentials, 'website-copy')`: evidenced\n * for the surface, not expired, and no policy past its end date. The amount is `formatInsuranceAmount`'s (\"$20 million\");\n * - each line carries its K12-slots hook (`data-bl-slot=\"licence\" | \"qualifications\" | \"insurance\"`); a line the\n * variant expects but the evidence doesn't allow is left out and listed in `data-bl-slot-skip` with its reason;\n * with nothing to show, the section renders nothing;\n * - no default visible copy: the row labels, cover names and register link text are the site's (`labels`). A line\n * with no label fails the build rather than render unlabelled.\n */\nimport type { ReactNode } from 'react'\nimport {\n formatInsuranceAmount,\n renderableCredentials,\n renderableLicences,\n resolveVerifiedFactForSurface,\n type BrandlabBusiness,\n type BrandlabInsuranceCover,\n type BrandlabLicence,\n type BrandlabRenderableCredentials,\n} from '@brandlab-digital/site-core/business'\nimport {\n SECTION_READY,\n SECTION_SLOT_ATTRIBUTE,\n SECTION_SLOT_SKIP_ATTRIBUTE,\n formatSectionSlotSkips,\n type BrandlabSectionReadiness,\n type BrandlabSectionSlotSkip,\n} from '@brandlab-digital/site-core/section-order'\nimport { Section, SectionHeading, type SectionHeadingSlot, type SectionSlot, type SectionTone } from '../primitives/layout.js'\nimport { Anchor } from '../primitives/links.js'\nimport type { RepeatedSlotOf } from '../repeated-slots.js'\nimport { repeatedSlot, slot, type SkinEntry } from '../skin.js'\n\nexport const LICENCES_VARIANTS = ['licence', 'qualifications'] as const\nexport type LicencesVariant = (typeof LICENCES_VARIANTS)[number]\n/** Rendered once per line: styled from the skin stylesheet, never by class. */\nexport type LicencesRepeatedSlot = RepeatedSlotOf<'licences'>\nexport type LicencesSlot = SectionSlot | SectionHeadingSlot | 'list' | LicencesRepeatedSlot\nexport type LicencesSkin = SkinEntry<LicencesSlot, LicencesVariant, Record<never, never>, LicencesRepeatedSlot>\n\n/** The site's words for the ledger. Each is needed only when its line renders. */\nexport interface LicencesLabels {\n /** The qualifications row's label, for example \"Qualifications\". */\n readonly qualifications?: string\n /** The insurance row's label, for example \"Insurance\". */\n readonly insurance?: string\n /** Each cover's name, for example `{ 'public-liability': 'Public liability' }`. */\n readonly covers?: Readonly<Partial<Record<BrandlabInsuranceCover, string>>>\n /** The register link's text, for example \"Check the register\". Left out, no register link renders. */\n readonly register?: string\n}\n\n/** The business facts the ledger reads: `business.registration` and `business.credentials`. */\nexport type LicencesBusiness = Pick<BrandlabBusiness, 'registration' | 'credentials'>\n\nexport interface LicencesProps extends LicencesSkin {\n /** The H2, for example \"Qualified and insured\". */\n readonly title: ReactNode\n readonly eyebrow?: ReactNode\n readonly lead?: ReactNode\n readonly business: LicencesBusiness\n readonly labels: LicencesLabels\n /** The day the page is built (tests pin it). */\n readonly asOf?: Date\n /** Defaults to `licences-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\ninterface LedgerContent {\n readonly licences: readonly BrandlabLicence[]\n readonly credentials: BrandlabRenderableCredentials\n readonly skips: readonly BrandlabSectionSlotSkip[]\n}\n\n/** What the evidence lets the variant show today, and the expected lines it has to leave out. */\nexport function licencesContent(business: LicencesBusiness, variant: LicencesVariant, asOf: Date = new Date()): LedgerContent {\n const credentials = renderableCredentials(business.credentials, 'website-copy', asOf)\n const licences = variant === 'licence' ? renderableLicences(resolveVerifiedFactForSurface(business.registration.licences, 'website-copy', asOf) ?? [], asOf) : []\n const skips: BrandlabSectionSlotSkip[] = []\n if (variant === 'licence' && licences.length === 0) skips.push({ slot: 'licence', reason: 'no-current-licence' })\n if (variant === 'qualifications' && credentials.qualifications.length === 0) skips.push({ slot: 'qualifications', reason: 'no-evidenced-qualification' })\n if (variant === 'qualifications' && credentials.insurance.length === 0) skips.push({ slot: 'insurance', reason: 'no-current-insurance' })\n return { licences, credentials: variant === 'qualifications' ? credentials : { ...credentials, qualifications: [] }, skips }\n}\n\nfunction hasLines({ licences, credentials }: LedgerContent): boolean {\n return licences.length + credentials.qualifications.length + credentials.insurance.length > 0\n}\n\n/** The section's guard for `SectionSequence`: skipped when the evidence allows no line at all. */\nexport function licencesReady({ business, variant = 'licence', asOf }: Pick<LicencesProps, 'business' | 'variant' | 'asOf'>): BrandlabSectionReadiness {\n return hasLines(licencesContent(business, variant, asOf)) ? SECTION_READY : { render: false, reason: 'no-evidenced-credentials' }\n}\n\nfunction required(value: string | undefined, name: string): string {\n if (!value?.trim()) throw new Error(`Licences: labels.${name} is needed to show this line, in the site's words.`)\n return value\n}\n\nfunction LicenceLine({ licence, registerLabel }: { licence: BrandlabLicence; registerLabel: string | undefined }) {\n return (\n <div {...repeatedSlot('row')} {...{ [SECTION_SLOT_ATTRIBUTE]: 'licence' }}>\n <dt {...repeatedSlot('label')}>{licence.name}</dt>\n <dd {...repeatedSlot('value')}>\n <span {...repeatedSlot('number')}>{licence.identifier}</span>\n {licence.licensee ? (\n <>\n {' '}\n <span {...repeatedSlot('holder')}>{licence.licensee}</span>\n </>\n ) : null}\n </dd>\n {licence.classes && licence.classes.length > 0 ? (\n <dd {...repeatedSlot('classes')}>\n <ul role=\"list\">\n {licence.classes.map((entry) => (\n <li key={entry.name} {...repeatedSlot('class')}>\n {entry.name}\n {entry.conditions && entry.conditions.length > 0 ? `: ${entry.conditions.join('; ')}` : null}\n </li>\n ))}\n </ul>\n </dd>\n ) : null}\n {licence.registerUrl && registerLabel ? (\n <dd {...repeatedSlot('register')}>\n <Anchor href={licence.registerUrl} prefetch={false} hooks={{}}>\n {registerLabel}\n </Anchor>\n </dd>\n ) : null}\n </div>\n )\n}\n\nexport function Licences({ title, eyebrow, lead, business, labels, asOf, headingId = 'licences-heading', tone, variant = 'licence', classes }: LicencesProps) {\n const content = licencesContent(business, variant, asOf)\n if (!hasLines(content)) return null\n const { licences, credentials, skips } = content\n const qualificationsLabel = credentials.qualifications.length > 0 ? required(labels.qualifications, 'qualifications') : undefined\n const insuranceLabel = credentials.insurance.length > 0 ? required(labels.insurance, 'insurance') : undefined\n const coverName = (cover: BrandlabInsuranceCover) => required(labels.covers?.[cover], `covers['${cover}']`)\n return (\n <Section\n id=\"licences\"\n labelledBy={headingId}\n tone={tone}\n variant={variant}\n classes={classes}\n hooks={skips.length > 0 ? { [SECTION_SLOT_SKIP_ATTRIBUTE]: formatSectionSlotSkips(skips) } : undefined}\n >\n <SectionHeading id={headingId} title={title} eyebrow={eyebrow} lead={lead} classes={classes} />\n <dl {...slot(classes, 'list')}>\n {licences.map((licence) => (\n <LicenceLine key={`${licence.name}-${licence.identifier}`} licence={licence} registerLabel={labels.register} />\n ))}\n {qualificationsLabel ? (\n <div {...repeatedSlot('row')} {...{ [SECTION_SLOT_ATTRIBUTE]: 'qualifications' }}>\n <dt {...repeatedSlot('label')}>{qualificationsLabel}</dt>\n {credentials.qualifications.map((entry) => (\n <dd key={entry.title} {...repeatedSlot('value')}>\n {entry.title}\n </dd>\n ))}\n </div>\n ) : null}\n {insuranceLabel ? (\n <div {...repeatedSlot('row')} {...{ [SECTION_SLOT_ATTRIBUTE]: 'insurance' }}>\n <dt {...repeatedSlot('label')}>{insuranceLabel}</dt>\n {credentials.insurance.map((entry) => (\n <dd key={`${entry.cover}-${entry.amountAud}`} {...repeatedSlot('value')}>\n <span {...repeatedSlot('cover')}>{coverName(entry.cover)}</span>{' '}\n <span {...repeatedSlot('amount')}>{formatInsuranceAmount(entry.amountAud)}</span>\n </dd>\n ))}\n </div>\n ) : null}\n </dl>\n </Section>\n )\n}\n"]}
1
+ {"version":3,"file":"licences.js","sourceRoot":"","sources":["../../../src/ui-kit/sections/licences.tsx"],"names":[],"mappings":";AA6BA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,6BAA6B,GAK9B,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,GAGvB,MAAM,2CAA2C,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,cAAc,EAA+D,MAAM,yBAAyB,CAAA;AAC9H,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAE/C,OAAO,EAAE,YAAY,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AAE/D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,gBAAgB,CAAU,CAAA;AA6BvE,sDAAsD;AACtD,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,4CAA4C,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAA;AAC7E,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IACrC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,C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GAAG,OAAG,SAAS,CAAC,QAAQ,CAAC,EAChC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAClB,8BACG,GAAG,EACJ,kBAAU,YAAY,CAAC,QAAQ,CAAC,YAC9B,KAAC,MAAM,IAAC,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,YAC7D,MAAM,CAAC,SAAS,GACV,GACJ,IACN,CACJ,CAAC,CAAC,CAAC,IAAI,IACL,CACN,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC,CAAC,CAAC,IAAI,EACP,cAAc,CAAC,CAAC,CAAC,CAChB,kBAAS,YAAY,CAAC,KAAK,CAAC,EAAQ,CAAC,sBAAsB,CAAC,EAAE,WAAW,aACvE,gBAAQ,YAAY,CAAC,OAAO,CAAC,YAAG,cAAc,GAAM,EACnD,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACpC,iBAAkD,YAAY,CAAC,OAAO,CAAC,aACrE,kBAAU,YAAY,CAAC,OAAO,CAAC,YAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,GAAQ,EAAC,GAAG,EACpE,kBAAU,YAAY,CAAC,QAAQ,CAAC,YAAG,qBAAqB,CAAC,KAAK,CAAC,SAAS,CAAC,GAAQ,KAF1E,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,SAAS,EAAE,CAGvC,CACN,CAAC,IACE,CACP,CAAC,CAAC,CAAC,IAAI,IACL,IACG,CACX,CAAA;AACH,CAAC","sourcesContent":["/**\n * `Licences` (`licences`, 3.15.0): the business's credentials as a ruled ledger, read straight from the site's business\n * facts (`site-core/business`), so the page can only say what the evidence allows. Server component.\n *\n * Variants (matrix part B):\n * - `licence` (licensed trades): each current licence as the register shows it (its name, number, licensee, classes\n * with their conditions and the register link), then the insurance lines;\n * - `qualifications` (trades with no licence, such as tree work): the qualifications as the business may state them,\n * without a person's name (\"AQF Level 3-qualified arborist\"), then the insurance lines.\n *\n * Locked:\n * - licences come only from a verified `registration.licences` fact whose evidence allows website copy and has not\n * expired, less any expired licence (`renderableLicences`); a licence number is never typed in by hand;\n * - qualifications and insurance come only through `renderableCredentials(credentials, 'website-copy')`: evidenced\n * for the surface, not expired, and no policy past its end date. The amount is `formatInsuranceAmount`'s (\"$20 million\");\n * - each line carries its K12-slots hook (`data-bl-slot=\"licence\" | \"qualifications\" | \"insurance\"`); a line the\n * variant expects but the evidence doesn't allow is left out and listed in `data-bl-slot-skip` with its reason;\n * with nothing to show, the section renders nothing;\n * - no default visible copy: the row labels, cover names and register link text are the site's (`labels`). A line\n * with no label fails the build rather than render unlabelled.\n *\n * Optional lines (3.19.0), shown only when the site gives their label:\n * - `labels.experience` with `labels.experienceLine` (\"More than {years} years of {field}\"): the evidenced\n * experience of the person doing the work (`holder: 'practitioner'`), right after the qualifications. A business's\n * own age is never shown here; that is the established line;\n * - `labels.established`: the month and year the business was established (`credentials.established`), and with\n * `labels.abn` the verified ABN from `registration.abn`, linking to ABN Lookup when `labels.abnLookup` is given.\n */\nimport type { ReactNode } from 'react'\nimport {\n formatInsuranceAmount,\n renderableCredentials,\n renderableLicences,\n resolveVerifiedFactForSurface,\n type BrandlabBusiness,\n type BrandlabInsuranceCover,\n type BrandlabLicence,\n type BrandlabRenderableCredentials,\n} from '@brandlab-digital/site-core/business'\nimport {\n SECTION_READY,\n SECTION_SLOT_ATTRIBUTE,\n SECTION_SLOT_SKIP_ATTRIBUTE,\n formatSectionSlotSkips,\n type BrandlabSectionReadiness,\n type BrandlabSectionSlotSkip,\n} from '@brandlab-digital/site-core/section-order'\nimport { Section, SectionHeading, type SectionHeadingSlot, type SectionSlot, type SectionTone } from '../primitives/layout.js'\nimport { Anchor } from '../primitives/links.js'\nimport type { RepeatedSlotOf } from '../repeated-slots.js'\nimport { repeatedSlot, slot, type SkinEntry } from '../skin.js'\n\nexport const LICENCES_VARIANTS = ['licence', 'qualifications'] as const\nexport type LicencesVariant = (typeof LICENCES_VARIANTS)[number]\n/** Rendered once per line: styled from the skin stylesheet, never by class. */\nexport type LicencesRepeatedSlot = RepeatedSlotOf<'licences'>\nexport type LicencesSlot = SectionSlot | SectionHeadingSlot | 'list' | LicencesRepeatedSlot\nexport type LicencesSkin = SkinEntry<LicencesSlot, LicencesVariant, Record<never, never>, LicencesRepeatedSlot>\n\n/** The site's words for the ledger. Each is needed only when its line renders. */\nexport interface LicencesLabels {\n /** The qualifications row's label, for example \"Qualifications\". */\n readonly qualifications?: string\n /** The insurance row's label, for example \"Insurance\". */\n readonly insurance?: string\n /** Each cover's name, for example `{ 'public-liability': 'Public liability' }`. */\n readonly covers?: Readonly<Partial<Record<BrandlabInsuranceCover, string>>>\n /** The register link's text, for example \"Check the register\". Left out, no register link renders. */\n readonly register?: string\n /** The experience row's label, for example \"Experience\" (3.19.0). Left out, the row doesn't render. */\n readonly experience?: string\n /** Each experience line with `{years}` and `{field}`, for example \"More than {years} years of {field}\". */\n readonly experienceLine?: string\n /** The established row's label, for example \"Established\" (3.19.0). Left out, the row doesn't render. */\n readonly established?: string\n /** The ABN's label in the established row, for example \"ABN\". Left out, the ABN doesn't show. */\n readonly abn?: string\n /** The ABN Lookup link's text, for example \"Check ABN Lookup\". Left out, the ABN shows without a link. */\n readonly abnLookup?: string\n}\n\n/** The public ABN Lookup page for an 11-digit ABN. */\nexport function abnLookupUrl(abn: string): string {\n return `https://abr.business.gov.au/ABN/View?abn=${abn.replace(/\\s/g, '')}`\n}\n\n/** An ABN as it is written: \"12 345 678 901\". */\nexport function formatAbn(abn: string): string {\n const digits = abn.replace(/\\s/g, '')\n return `${digits.slice(0, 2)} ${digits.slice(2, 5)} ${digits.slice(5, 8)} ${digits.slice(8)}`\n}\n\nconst MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n\n/** The business facts the ledger reads: `business.registration` and `business.credentials`. */\nexport type LicencesBusiness = Pick<BrandlabBusiness, 'registration' | 'credentials'>\n\nexport interface LicencesProps extends LicencesSkin {\n /** The H2, for example \"Qualified and insured\". */\n readonly title: ReactNode\n readonly eyebrow?: ReactNode\n readonly lead?: ReactNode\n readonly business: LicencesBusiness\n readonly labels: LicencesLabels\n /** The day the page is built (tests pin it). */\n readonly asOf?: Date\n /** Defaults to `licences-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\ninterface LedgerContent {\n readonly licences: readonly BrandlabLicence[]\n readonly credentials: BrandlabRenderableCredentials\n readonly skips: readonly BrandlabSectionSlotSkip[]\n /** The verified ABN the website may show (3.19.0). */\n readonly abn?: string\n}\n\n/** What the evidence lets the variant show today, and the expected lines it has to leave out. */\nexport function licencesContent(business: LicencesBusiness, variant: LicencesVariant, asOf: Date = new Date()): LedgerContent {\n const credentials = renderableCredentials(business.credentials, 'website-copy', asOf)\n const licences = variant === 'licence' ? renderableLicences(resolveVerifiedFactForSurface(business.registration.licences, 'website-copy', asOf) ?? [], asOf) : []\n const skips: BrandlabSectionSlotSkip[] = []\n if (variant === 'licence' && licences.length === 0) skips.push({ slot: 'licence', reason: 'no-current-licence' })\n if (variant === 'qualifications' && credentials.qualifications.length === 0) skips.push({ slot: 'qualifications', reason: 'no-evidenced-qualification' })\n if (variant === 'qualifications' && credentials.insurance.length === 0) skips.push({ slot: 'insurance', reason: 'no-current-insurance' })\n const abn = resolveVerifiedFactForSurface(business.registration.abn, 'website-copy', asOf)\n return {\n licences,\n credentials: {\n ...(variant === 'qualifications' ? credentials : { ...credentials, qualifications: [] }),\n // A person's experience only: the business's age is the established line.\n experience: credentials.experience.filter((entry) => entry.holder === 'practitioner'),\n },\n skips,\n ...(abn ? { abn } : {}),\n }\n}\n\nfunction hasLines({ licences, credentials }: LedgerContent): boolean {\n return licences.length + credentials.qualifications.length + credentials.insurance.length > 0\n}\n\n/** The section's guard for `SectionSequence`: skipped when the evidence allows no line at all. */\nexport function licencesReady({ business, variant = 'licence', asOf }: Pick<LicencesProps, 'business' | 'variant' | 'asOf'>): BrandlabSectionReadiness {\n return hasLines(licencesContent(business, variant, asOf)) ? SECTION_READY : { render: false, reason: 'no-evidenced-credentials' }\n}\n\nfunction required(value: string | undefined, name: string): string {\n if (!value?.trim()) throw new Error(`Licences: labels.${name} is needed to show this line, in the site's words.`)\n return value\n}\n\nfunction LicenceLine({ licence, registerLabel }: { licence: BrandlabLicence; registerLabel: string | undefined }) {\n return (\n <div {...repeatedSlot('row')} {...{ [SECTION_SLOT_ATTRIBUTE]: 'licence' }}>\n <dt {...repeatedSlot('label')}>{licence.name}</dt>\n <dd {...repeatedSlot('value')}>\n <span {...repeatedSlot('number')}>{licence.identifier}</span>\n {licence.licensee ? (\n <>\n {' '}\n <span {...repeatedSlot('holder')}>{licence.licensee}</span>\n </>\n ) : null}\n </dd>\n {licence.classes && licence.classes.length > 0 ? (\n <dd {...repeatedSlot('classes')}>\n <ul role=\"list\">\n {licence.classes.map((entry) => (\n <li key={entry.name} {...repeatedSlot('class')}>\n {entry.name}\n {entry.conditions && entry.conditions.length > 0 ? `: ${entry.conditions.join('; ')}` : null}\n </li>\n ))}\n </ul>\n </dd>\n ) : null}\n {licence.registerUrl && registerLabel ? (\n <dd {...repeatedSlot('register')}>\n <Anchor href={licence.registerUrl} prefetch={false} hooks={{}}>\n {registerLabel}\n </Anchor>\n </dd>\n ) : null}\n </div>\n )\n}\n\nexport function Licences({ title, eyebrow, lead, business, labels, asOf, headingId = 'licences-heading', tone, variant = 'licence', classes }: LicencesProps) {\n const content = licencesContent(business, variant, asOf)\n if (!hasLines(content)) return null\n const { licences, credentials, skips, abn } = content\n const experience = labels.experience && credentials.experience.length > 0 ? credentials.experience : []\n const experienceLine = experience.length > 0 ? required(labels.experienceLine, 'experienceLine') : undefined\n if (experienceLine && !experienceLine.includes('{years}')) throw new Error('Licences: labels.experienceLine needs {years}.')\n const established = labels.established ? credentials.established : undefined\n const shownAbn = established && labels.abn && abn ? abn : undefined\n const qualificationsLabel = credentials.qualifications.length > 0 ? required(labels.qualifications, 'qualifications') : undefined\n const insuranceLabel = credentials.insurance.length > 0 ? required(labels.insurance, 'insurance') : undefined\n const coverName = (cover: BrandlabInsuranceCover) => required(labels.covers?.[cover], `covers['${cover}']`)\n return (\n <Section\n id=\"licences\"\n labelledBy={headingId}\n tone={tone}\n variant={variant}\n classes={classes}\n hooks={skips.length > 0 ? { [SECTION_SLOT_SKIP_ATTRIBUTE]: formatSectionSlotSkips(skips) } : undefined}\n >\n <SectionHeading id={headingId} title={title} eyebrow={eyebrow} lead={lead} classes={classes} />\n <dl {...slot(classes, 'list')}>\n {licences.map((licence) => (\n <LicenceLine key={`${licence.name}-${licence.identifier}`} licence={licence} registerLabel={labels.register} />\n ))}\n {qualificationsLabel ? (\n <div {...repeatedSlot('row')} {...{ [SECTION_SLOT_ATTRIBUTE]: 'qualifications' }}>\n <dt {...repeatedSlot('label')}>{qualificationsLabel}</dt>\n {credentials.qualifications.map((entry) => (\n <dd key={entry.title} {...repeatedSlot('value')}>\n {entry.title}\n </dd>\n ))}\n </div>\n ) : null}\n {experienceLine ? (\n <div {...repeatedSlot('row')} {...{ [SECTION_SLOT_ATTRIBUTE]: 'experience' }}>\n <dt {...repeatedSlot('label')}>{labels.experience}</dt>\n {experience.map((entry) => (\n <dd key={entry.claimId} {...repeatedSlot('value')}>\n {experienceLine.replaceAll('{years}', String(entry.years)).replaceAll('{field}', entry.field)}\n </dd>\n ))}\n </div>\n ) : null}\n {established ? (\n <div {...repeatedSlot('row')} {...{ [SECTION_SLOT_ATTRIBUTE]: 'established' }}>\n <dt {...repeatedSlot('label')}>{labels.established}</dt>\n <dd {...repeatedSlot('value')}>\n <span {...repeatedSlot('date')}>\n {established.month ? `${MONTHS[established.month - 1]} ${established.year}` : established.year}\n </span>\n </dd>\n {shownAbn ? (\n <dd {...repeatedSlot('abn')}>\n {labels.abn} {formatAbn(shownAbn)}\n {labels.abnLookup ? (\n <>\n {' '}\n <span {...repeatedSlot('lookup')}>\n <Anchor href={abnLookupUrl(shownAbn)} prefetch={false} hooks={{}}>\n {labels.abnLookup}\n </Anchor>\n </span>\n </>\n ) : null}\n </dd>\n ) : null}\n </div>\n ) : null}\n {insuranceLabel ? (\n <div {...repeatedSlot('row')} {...{ [SECTION_SLOT_ATTRIBUTE]: 'insurance' }}>\n <dt {...repeatedSlot('label')}>{insuranceLabel}</dt>\n {credentials.insurance.map((entry) => (\n <dd key={`${entry.cover}-${entry.amountAud}`} {...repeatedSlot('value')}>\n <span {...repeatedSlot('cover')}>{coverName(entry.cover)}</span>{' '}\n <span {...repeatedSlot('amount')}>{formatInsuranceAmount(entry.amountAud)}</span>\n </dd>\n ))}\n </div>\n ) : null}\n </dl>\n </Section>\n )\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brandlab-digital/site-next",
3
- "version": "3.18.0",
3
+ "version": "3.19.0",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  "typecheck": "tsc --noEmit -p tsconfig.json"
26
26
  },
27
27
  "dependencies": {
28
- "@brandlab-digital/site-core": "3.18.0",
28
+ "@brandlab-digital/site-core": "3.19.0",
29
29
  "browser-image-compression": "2.0.2",
30
30
  "pdf-lib": "1.17.1",
31
31
  "server-only": "0.0.1",