@brandlab-digital/site-core 3.5.0 → 3.7.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 CHANGED
@@ -1,3 +1,99 @@
1
1
  # `@brandlab-digital/site-core`
2
2
 
3
3
  Proprietary software © Brandlab Digital Marketing. All rights reserved. Published for Brandlab client sites.
4
+
5
+ ## Google reviews (`./google-business-reviews`, from 3.5.0)
6
+
7
+ `parseBusinessProfileReviews` validates a Brandlab reviews feed answer;
8
+ `selectBusinessProfileReviews(feed, { policy, limit, exclude? })` chooses what a
9
+ placement shows, newest first and word for word (`recent`, or `five-star` for
10
+ rating 5 only). The fetch is `site-next/google-business-reviews/server`.
11
+
12
+ ### Leaving out related-party reviews (`exclude`, from 3.7.0)
13
+
14
+ Romie, 19 October 2026: "ok remove suspected Related-party reviews from
15
+ displaying but only if theres enough other reviews to display instead".
16
+ Featuring a review written by a relative of the owner or of Brandlab is a
17
+ consumer-law risk, so a site can name reviews it would rather not feature:
18
+
19
+ ```ts
20
+ // src/config/reviews.ts
21
+ export const reviews = {
22
+ feedSite: 'harbour-electrical',
23
+ policy: 'recent',
24
+ maxReviews: 3,
25
+ exclude: [
26
+ { authorName: 'Jane Example', reason: "Owner's sister; suspected related party (Romie, 19 Oct 2026)." },
27
+ { reviewId: 'AbC123', reason: 'Written by a Brandlab relative (coordinator sweep, 19 Oct 2026).' },
28
+ ],
29
+ } as const
30
+
31
+ // src/lib/reviews.ts
32
+ selectBusinessProfileReviews(feed, { policy: reviews.policy, limit: reviews.maxReviews, exclude: reviews.exclude })
33
+ ```
34
+
35
+ - Each entry names exactly one of `reviewId` (that review, matched exactly) or
36
+ `authorName` (every review by that name, ignoring case, spacing and accent
37
+ composition), plus a non-empty `reason` saying who decided and why. Anything
38
+ else throws, even without a feed, so a bad list fails tests and builds.
39
+ - **Guard:** excluded reviews are hidden only while enough other reviews remain
40
+ to fill `limit`. Otherwise the fewest excluded reviews needed to fill it stay
41
+ (the newest of them), in the policy's order, so a placement never shows fewer
42
+ reviews than it would without the list. A review kept this way was already
43
+ among those shown without the list; `five-star` still shows five-star reviews
44
+ only.
45
+ - The profile's average rating and total are Google's and never change.
46
+ - `excludedBusinessProfileReviewsShown(shown, exclude)` lists the shown reviews
47
+ that match an exclusion (with the entry each matched), so a site can log or
48
+ test when the guard kept one. It is empty whenever the list did its job.
49
+ - The list lives in the site's `src/config/reviews.ts` (`reviews.exclude`).
50
+ brandlab.config carries only `provider` and `selection`; an `exclude` key there
51
+ is refused.
52
+
53
+ ## Service-area maps (`./area-map`, from 3.6.0)
54
+
55
+ Shared boundary data and the map engine: behaviour, never appearance. Server
56
+ data (`browser: null`), like `./geography`: build models on the server and pass
57
+ plain values to components. Each site draws the models in its own style.
58
+
59
+ Data: `areaMapBoundaries` (NSW Spatial Services suburb boundaries for the
60
+ Sydney and Central Coast registries, simplified with shared borders kept
61
+ shared; method in `standards/registry/README.md`), `AREA_MAP_ATTRIBUTION` (the
62
+ CC BY 4.0 credit every map shows in its caption), `suburbOutline(slug)`,
63
+ `regionOutline(slug)` (regions and sub-regions), `councilOutline(slug)`,
64
+ `landOutline()` (water is everything else), `placeOutline(document, slug)` and
65
+ `areaMapBoundaryProblems(document)` for a site's own towns.
66
+
67
+ Geometry: `areaMapBounds`, `fitAreaMapFrame(bounds, { width, padding, aspect,
68
+ minSpanKm })` (latitude-corrected equirectangular), `projectAreaMapPoint`,
69
+ `areaMapPath(frame, rings)` (simplified to the frame, clipped, whole numbers,
70
+ relative commands) and `areaMapLabelPoint(rings)` (the pole of
71
+ inaccessibility, with `room` to the nearest edge, so labels sit inside without
72
+ hand nudges).
73
+
74
+ Models: `defineAreaMapSite({ registry, estate, decisions, href,
75
+ siteOwnedPlaces?, siteOwnedBoundaries? })` binds the site's estate and indexing
76
+ decisions (only `index` pages are ever linked; a published place without a
77
+ boundary throws). Then:
78
+
79
+ - `overviewMap(site, options)`: home and locations hub. Served regions
80
+ (linked when the region page is indexable), others muted, towns, the base and
81
+ job places, a label point per region.
82
+ - `regionMap(site, regionSlug, options)`: a region's localities: indexed
83
+ linked, served-but-noindex served and unlinked, the rest muted; job places.
84
+ - `suburbLocator(site, slug, { neighbours, jobs })`: the place, its nearest
85
+ neighbours in the order given (the page's own nearby list) and job places;
86
+ undefined when there is nothing to show.
87
+
88
+ Each model is plain data: `id` (`overview`, `region-<slug>`, `suburb-<slug>`),
89
+ `viewBox`, `shapes` (the inline overlay: linked shapes with `href` and `d`),
90
+ `labels` (`x`, `y`, `room`, `state`), `markers` (base and jobs, one per place
91
+ with a count), `crop` (the phone crop) and `layers`. `renderAreaMapBaseSvg(site,
92
+ model)` draws the static base layer (`land`, `focus`, `served`, `outline`
93
+ groups with no colours) for a cached static route; the page draws each group
94
+ with `<use href="<file>#<id>">` (`areaMapLayerIds(model)`) and styles the
95
+ `<use>` with its own tokens.
96
+
97
+ `./area-map/encode` (Node tools): `encodeAreaMapBoundaries` builds a document
98
+ in the shared format (topology, per-arc Douglas-Peucker, dissolves, base64url
99
+ arcs); the registry generator and `brandlab-area-map places` use it.