Gap fixes: top-level searchSettings, public shouldLoadGoogle, consent/stats collection overrides

- ipalKit({ searchSettings }): switches off / reshapes Site Settings → Search & AI
  without `seo`; read as options.searchSettings ?? options.seo?.searchSettings.
- shouldLoadGoogle moved to a pure module (analytics/shouldLoadGoogle.ts) and
  exported from @intecion/ipal-kit and /client.
- consentLog.collectionOverrides and stats.collectionOverrides (object merges
  access/admin/hooks key by key, function takes over), via the new exported
  applyCollectionOverride / CollectionOverride. The stats view and dashboard
  chart now follow the stats-visits read access, so overrides narrow them too.

All additive; defaults unchanged. Docs: AGENT.md, ipal-reference, consent,
stats, seo, analytics, ipal-setup.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-22 18:54:08 +02:00
co-authored by Claude Opus 5.5
parent 4911da7112
commit 5a07c42f76
22 changed files with 235 additions and 54 deletions
+2 -1
View File
@@ -45,6 +45,7 @@ ipalKit({
| `retentionDays` | `90` | older visits (by `lastAt`) are deleted |
| `timeZone` | `'Europe/Warsaw'` | day boundary (`day` field, salt rotation, charts) |
| `dashboard` | `true` | `false` removes only `StatsWidget` from the dashboard — the view and the nav link stay |
| `collectionOverrides` | none | changes `stats-visits`: an object merges `access` / `admin` / `hooks` key by key (your keys win), a function `(collection) => collection` takes over (keep the slug). Its `access.read` also decides who sees the stats view and the dashboard chart |
Adds:
- the `stats-visits` collection (group *Statistics*, read and delete: admin; `create`/`update` via API
@@ -161,7 +162,7 @@ przechowujemy przez 90 dni.
- **Turn off:** without the `stats` option nothing is added; `stats: { dashboard: false }` hides only
the dashboard chart; without `<PageStats>` (or with `SiteProviders stats` = `false`) nothing is sent.
- **Override:** `retentionDays`, `timeZone`; `<PageStats endpoint>` for your own endpoint path.
- **Override:** `retentionDays`, `timeZone`, `collectionOverrides` (e.g. `{ access: { read: ({ req }) => req.user?.email === '[email protected]' } }` in a project without roles); `<PageStats endpoint>` for your own endpoint path.
The counting rules (bots, prefetch, 30 min, 10 s) currently cannot be changed with an option.
- **Extend:** `STATS_SLUG` + the types `StatsOptions` / `StatsVisit` / `StatsPage` (from
`@intecion/ipal-kit`) for your own queries and reports (Local API); `StatsView` / `StatsWidget` from