@codefast/tracking 0.5.0-canary.9 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,288 @@
1
1
  # @codefast/tracking
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [#690](https://github.com/codefastlabs/codefast/pull/690) [`f4b1aa6`](https://github.com/codefastlabs/codefast/commit/f4b1aa6335f535574eae5cf559b81a568f5a7a30) Thanks [@thevuong](https://github.com/thevuong)! - Report the failures that were being swallowed or mislabelled, and derive the types the build emits.
8
+
9
+ `@codefast/di`:
10
+
11
+ - `@inject`, `@postConstruct` and `@preDestroy` on a static member now throw `StaticMemberDecoratorError` instead of
12
+ `InternalError`. All three act on one instance, so this is caller misuse — and `InternalError` means the library
13
+ broke, which sent anyone catching it to file a bug against their own mistake. SPEC §10 already recorded that mistake
14
+ for predicate ambiguity.
15
+ - `AsyncResolutionError` names the token the caller asked for and the token whose factory is async, which is what SPEC
16
+ has always specified. Every throw site passed the same token twice, so the message read "Token 'X' requires async
17
+ resolution because 'X' in its dependency chain has an async factory"; a `resolve(App)` that fails on an async
18
+ `Database` now says so. `asyncSourceToken` defaults to `tokenName` for the case where the requested binding is itself
19
+ the source.
20
+ - A `MetadataReader` that names a `@postConstruct`/`@preDestroy` method the instance does not have raises
21
+ `InvalidMetadataError` instead of skipping the hook — a hook that silently never runs is the failure a caller cannot
22
+ see. `InvalidMetadataError`'s message no longer says "constructor", since it now covers both answers; the specifics
23
+ moved into `reason`.
24
+ - `MissingScopeContextError` from `ScopeManager` names its token instead of `"(unknown)"`, and the scoped read takes one
25
+ map lookup where it took two.
26
+ - `Token`, `Constructor` and `InjectionDescriptor` declare `out Value`, so the compiler checks the covariance the engine
27
+ already relied on.
28
+
29
+ Repo-wide: `isolatedDeclarations` is on for every package that emits declarations, so a public type can always be
30
+ written down from the source file alone. `allowJs` is gone from the shared base config — no package has JavaScript
31
+ sources. `@codefast/theme` and `@codefast/tracking` gained explicit annotations on four exported constants to satisfy
32
+ it; the emitted types are unchanged. `@codefast/ui` and `@codefast/benchmark-viewer` opt out for reasons recorded in
33
+ their configs.
34
+
35
+ ## 0.5.0
36
+
37
+ ### Minor Changes
38
+
39
+ - [#605](https://github.com/codefastlabs/codefast/pull/605) [`cb46bdd`](https://github.com/codefastlabs/codefast/commit/cb46bdd64902230839aef738477a720f98a6479e) Thanks [@thevuong](https://github.com/thevuong)! - Adds the shared ad-destination frame for consuming one `{ ads, analytics }` decision across ad platforms (spec-destinations §5): `toAdConsentState(decision)` normalizes it to the two independent levers — `analytics` drives whether events transmit, `ads` drives Limited Data Use — so per-vendor mappings cannot drift. Ships a reference Meta destination (`createMetaDestination`, `toMetaDataProcessingOptions`) that maps each event and the live `ads` decision to Meta's `dataProcessingOptions` (geolocated LDU when `ads` is denied) and hands it to an injected `transport`. Consent-restriction mapping only — the Pixel/CAPI transport and credentials are the integrator's to supply; an ad sink is never `exempt`.
40
+
41
+ - [#612](https://github.com/codefastlabs/codefast/pull/612) [`1337fc3`](https://github.com/codefastlabs/codefast/commit/1337fc33929c9508936f0ac5807c215d0a2371d7) Thanks [@thevuong](https://github.com/thevuong)! - Adds the TCF/GPP interop reconciler (spec-ad-consent-frameworks): the system **reads** an external CMP and reconciles it with the native `{ ads, analytics }` decision — it never becomes a CMP or mints TC/GPP strings. `reconcileAdFrameworkConsent({ native, cmp, hasGlobalPrivacyControlSignal })` applies the §3 precedence (a governing CMP overrides its categories; fail-closed to denied while the CMP is loading; a missing or out-of-scope CMP leaves native standing; GPC only tightens `ads`), covering conformance vectors V1–V6. `hasTcfApi`/`hasGppApi` detect the `__tcfapi`/`__gpp` read APIs without invoking them. TCF purpose ids and the Google vendor id are deliberately **not** hard-coded — that mapping is ad-ops policy, so the caller derives the `CmpConsentSignal` it passes in.
42
+
43
+ - [#615](https://github.com/codefastlabs/codefast/pull/615) [`2bcd31f`](https://github.com/codefastlabs/codefast/commit/2bcd31fe99933d6e4fcc164069628555eef6e11c) Thanks [@thevuong](https://github.com/thevuong)! - Let `codefast mirror` generate `package.json#exports` from `dist/`, the same as every other library package (di, theme), instead of hand-curating them under mirror's preserve mode. The per-module build output is unchanged, so mirror emits a subpath for each built module, and the root becomes the client entry.
44
+
45
+ Breaking:
46
+
47
+ - The root `@codefast/tracking` is now the **client entry** — it re-exports the isomorphic core plus the whole browser surface (`createClientTracker`, `createConsentRuntime`, the React bindings, the gtag + ad-network destinations). Server code must import the core it needs from `@codefast/tracking/core/*`, not from the root.
48
+ - The `./client`, `./server`, `./core`, `./react`, and `./destinations` group barrels are gone. Use the client root for browser code, or a module's own subpath for granular/server imports (`@codefast/tracking/server/initial-consent`, `@codefast/tracking/client/gpc`, …).
49
+ - The TanStack Start adapter is now `@codefast/tracking/adapters/tanstack-start` (was `/tanstack-start`); the import-protection deny-list is `@codefast/tracking/tooling/import-protection` (was `/import-protection`). `SERVER_ONLY_SUBPATHS` now denies `server/**` and `adapters/**`.
50
+
51
+ - [#563](https://github.com/codefastlabs/codefast/pull/563) [`bad015c`](https://github.com/codefastlabs/codefast/commit/bad015c8237182b24ef24304ddcd0f939f917c1e) Thanks [@thevuong](https://github.com/thevuong)! - Switch gtag/GTM bootstraps to Google Consent Mode **advanced**:
52
+
53
+ - `buildGtagConsentBootstrapScript` / `buildGtmConsentBootstrapScript` always set Consent Mode v2 `default` (from stored decision or region fallback), then **always** load gtag.js / gtm.js — even when analytics/ads storage is denied — so cookieless pings and consent modeling can run.
54
+ - Runtime grants/denies still use `updateGoogleConsent`; `loadGtagScript` / `loadGtmScript` remain idempotent safety nets when the bootstrap did not run.
55
+ - The package's first-party consent gate is unchanged — identifiers and non-exempt destinations stay blocked without consent; only Google tag _script loading_ changes.
56
+
57
+ - [#563](https://github.com/codefastlabs/codefast/pull/563) [`bad015c`](https://github.com/codefastlabs/codefast/commit/bad015c8237182b24ef24304ddcd0f939f917c1e) Thanks [@thevuong](https://github.com/thevuong)! - Tighten the package's API contracts and framework independence, found in an architecture audit.
58
+
59
+ **Breaking:**
60
+
61
+ - `ClientTrackerOptions.anonymousId` is now `() => string` only — the plain-`string` form is removed. A resolver was already the documented best practice (defers minting an id until an event is actually allowed to send); the string form let callers accidentally mint one as an import-time side effect. Wrap a stable value in a resolver: `anonymousId: () => myId`.
62
+ - `Destination.send` now always returns `Promise<void>` — the previous `Promise<void> | void` let sync and async destinations disagree on contract. Mark a synchronous `send` `async` so a thrown error rejects the returned promise instead of throwing synchronously.
63
+
64
+ **Also:**
65
+
66
+ - `createVercelAnalyticsDestination` now imports `track` from the framework-agnostic `@vercel/analytics` instead of `@vercel/analytics/react` — the destination renders nothing, so it had no reason to depend on React.
67
+ - Adds `assertNever` (`@codefast/tracking/core`) and wires it into the `default` case of every `switch (event.type)` across the GA4/Vercel destinations — extending `TrackedEvent` with a new variant now fails to compile at every switch instead of silently falling through.
68
+ - The package root (`@codefast/tracking`) now re-exports `#/core`'s surface by explicit name instead of `export *`, matching the `client`/`server`/`destinations`/`react` subpaths, which were already explicit.
69
+ - `useConsent`'s returned object and its `save`/`denyAll`/`grantAll` callbacks are now memoized (`useMemo`/`useCallback`), so a consumer passing the hook's result down as a prop or effect dependency doesn't get a new reference every render.
70
+
71
+ - [#617](https://github.com/codefastlabs/codefast/pull/617) [`b979371`](https://github.com/codefastlabs/codefast/commit/b979371fb4b437be04a59cb5985de03ebe810e0d) Thanks [@thevuong](https://github.com/thevuong)! - Harden the package from a full audit — correctness, coverage, and a leaner public surface.
72
+
73
+ - **`isConsentReceiptInput` now validates `method` and `subjectIdType` against their enums**, not just `typeof === "string"` — the untrusted-body guard no longer narrows a bogus value to a closed union member.
74
+ - **`CookieAnonymousId` gains `current()`** — a non-minting read of the existing id (`undefined` when none) so a consent receipt stamps the id the visitor already carries instead of a throwaway that never correlates for erasure.
75
+ - **`coarsenIp` rejects out-of-range IPv4 octets** (`"999.…"`) rather than storing a malformed coarse value.
76
+ - **Microsoft UET consent routes through the shared `toAdConsentState` ad lever**, so its `ad_storage` mapping can't drift from Meta/TikTok.
77
+ - **Dropped unused foreign type re-exports** so each type has one home: `InitialConsent` no longer re-exported from `adapters/tanstack-start` or `server/initial-consent` (import it from `core/consent`), and the `AnonymousIdResponseCookieOptions` alias is gone — `setAnonymousIdResponseCookie` takes `AnonymousIdCookieOptions` from `server/anonymous-id-cookie` directly.
78
+ - **Collapsed the `TrackedEvent` envelope to a single interface** — the unused `TrackedEventBase` and `TrackEvent` names are gone (`TrackedEvent` keeps the `type: "track"` discriminant for a future additive union).
79
+
80
+ Also adds test coverage for the previously-untested `recordConsentReceiptFromRequest` adapter path (no-store header, body-IP rejection, coarsened IP, PII-free ack).
81
+
82
+ - [#617](https://github.com/codefastlabs/codefast/pull/617) [`b979371`](https://github.com/codefastlabs/codefast/commit/b979371fb4b437be04a59cb5985de03ebe810e0d) Thanks [@thevuong](https://github.com/thevuong)! - Remove two leftover indirection layers in the server lane that no call site used.
83
+
84
+ Breaking:
85
+
86
+ - The `@codefast/tracking/adapters/request-context` subpath is gone. Its `RequestContext` seam (a `getHeader`/`setHeader` interface) plus the parallel `*FromContext`/`*OnContext` helpers existed only to back a hypothetical future `./next`/`./remix` adapter, but there was exactly one adapter and it duplicated every signature and doc comment. `@codefast/tracking/adapters/tanstack-start` now calls `getRequestHeader`/`setResponseHeader` directly; its public surface (`resolveInitialConsentFromRequest`, `setAnonymousIdResponseCookie`, `clearAnonymousIdResponseCookie`, `recordConsentReceiptFromRequest`) is unchanged.
87
+ - `resolveRegion(headers)` is removed from `@codefast/tracking/server/region`. It was a pre-fail-closed leftover with no production call site, and its missing-geo semantics (unknown region → opt-out) contradicted the fail-closed invariant the server-first path relies on. Use `resolveRegionFromCountryCode` (what the production path already uses via `resolveInitialConsent`), or `resolveInitialConsentFromRequest` for the full per-request resolution.
88
+
89
+ - [`08f10fb`](https://github.com/codefastlabs/codefast/commit/08f10fb6f4f16e175557fac1adeb5b480dc691db) Thanks [@thevuong](https://github.com/thevuong)! - Rebuild `ConsentBanner` as composable compound parts (`ConsentBannerTitle`/`Description`/`Actions`/`Accept`/`Reject`/`Customize`/`Preferences`/`Category`/`Save`) — the root owns visibility (`needsPrompt`, overridable via `open` for a "Cookie settings" reopen) and the preferences-layer state, action parts wire their own clicks and compose the consumer's `onClick`, so any markup including a design system's button styles slots in via `className`. The monolithic `message`/`acceptLabel`/`categories` props are gone. An optional plain-CSS default theme ships at `@codefast/tracking/css/consent.css` — data-slot selectors, `--consent-*` custom properties with `light-dark()` fallbacks, zero Tailwind dependency.
90
+
91
+ - [#565](https://github.com/codefastlabs/codefast/pull/565) [`1e80096`](https://github.com/codefastlabs/codefast/commit/1e800961f956fdc5f23c434c1bf6f9bedb6f187b) Thanks [@thevuong](https://github.com/thevuong)! - Remove `defaultConsentExpression` from gtag/GTM consent bootstraps. Pass a literal `defaultConsent` (strictest bake on shared HTML) and upgrade after hydration via the server-fn lane + `updateGoogleConsent`.
92
+
93
+ - [#567](https://github.com/codefastlabs/codefast/pull/567) [`74c52ac`](https://github.com/codefastlabs/codefast/commit/74c52acf675225cfa50c73403644ff983166c82d) Thanks [@thevuong](https://github.com/thevuong)! - Collapse the consent "must match" contracts into one `ConsentConfig`, and add `createConsentRuntime`.
94
+
95
+ Previously `storageKey`, `policyVersion`, and `requestedCategories` had to be hand-threaded — matching exactly — through `useConsent`, `createIsAnalyticsAllowed`, and the gtag consent bootstrap; one drifted string was a silent consent bug. Now:
96
+
97
+ - **`ConsentConfig` + `defineConsentConfig` (root/core)** — the one bag for `storageKey`, `policyVersion`, and `requestedCategories`. Isomorphic plain data: the same object is imported on both sides.
98
+ - **`createConsentRuntime` (client)** — derives the live client instances from the config: the shared `ConsentStorage`, the initial-consent store over your server lane, `ensureInitialConsentResolved`, and the `isAnalyticsAllowed` tracker gate wired to the store's resolved mode (GPC read from the real navigator signal by default).
99
+
100
+ **Breaking option changes (config-first):**
101
+
102
+ - `useConsent({ policyVersion, requestedCategories?, ... })` → `useConsent({ config, ... })`. The `["analytics"]` default for `requestedCategories` is gone — the config always states the requested purposes explicitly.
103
+ - `createIsAnalyticsAllowed({ policyVersion, requestedCategories, ... })` → `createIsAnalyticsAllowed({ config, ... })`.
104
+ - `GtagConsentBootstrapOptions` (and the `<GtagConsentBootstrap />` props): `consentStorageKey` + `policyVersion` → `config`.
105
+
106
+ - [`079b8df`](https://github.com/codefastlabs/codefast/commit/079b8dfad7bd58d1d1f0d9a8ef376383544a37c2) Thanks [@thevuong](https://github.com/thevuong)! - Rebuild the consent layer on `useSyncExternalStore` and expose `data-slot` styling hooks on the consent UI.
107
+
108
+ - `useConsent` treats the stored `ConsentRecord` as the single source of truth: the server snapshot is always "no decision yet" (hydration-safe by construction on prerendered pages), a decision made in one tab syncs to every other tab, and a record saved under an older `policyVersion` is ignored so bumping the version re-prompts as documented.
109
+ - **Breaking:** `ConsentStorage` gains a required `subscribe(listener)` method — custom implementations must notify on changes. `createLocalStorageConsentStorage` implements it (same-tab saves plus the cross-tab `storage` event) and now degrades a blocked `localStorage` (private mode/quota) to a session-scoped in-memory record instead of re-prompting in a loop.
110
+ - **Breaking:** `ConsentBanner` renders a labeled region instead of a non-modal `<dialog>` (which neither traps focus nor blocks, so the dialog semantics over-promised). Both components extend their host element's `ComponentProps` and expose `data-slot` attributes (`consent-message`, `consent-actions`, `consent-action`, `consent-toggle`) for Tailwind `**:data-[slot=...]` styling.
111
+
112
+ - [#563](https://github.com/codefastlabs/codefast/pull/563) [`bad015c`](https://github.com/codefastlabs/codefast/commit/bad015c8237182b24ef24304ddcd0f939f917c1e) Thanks [@thevuong](https://github.com/thevuong)! - Gate the client tracker on consent and keep destinations from leaking pre-consent or duplicate data.
113
+
114
+ `createClientTracker` gains `isTrackingAllowed?: () => boolean`, consulted per event — while it returns `false` nothing is sent or queued, so a mid-session consent change applies immediately. `anonymousId` also accepts a `() => string` resolver, invoked only when an event is actually allowed to send, so apps can defer minting an identifier cookie until consent exists. `storage` is now optional; without it the queue lives in memory only instead of persisting to `localStorage`. The Vercel destination takes an options object (`{ name?, trackPageViews? }` replaces the positional name), drops `$page_viewed` unless `trackPageViews` is on — the mounted `<Analytics />` component already tracks page views natively — and drops `$identify`/`$group`, which Vercel Analytics has no identity API to translate to. The global `gtag` type gains the `config` and `js` command signatures so apps can queue them directly, e.g. when loading gtag.js on demand for basic Consent Mode.
115
+
116
+ - [#563](https://github.com/codefastlabs/codefast/pull/563) [`bad015c`](https://github.com/codefastlabs/codefast/commit/bad015c8237182b24ef24304ddcd0f939f917c1e) Thanks [@thevuong](https://github.com/thevuong)! - Consent internals cleanup. The gtag and GTM bootstraps now share one preamble builder (`googleConsentBootstrapPreamble` — generated output unchanged), `toGoogleConsentParams` derives from the signal map instead of hand-writing it, the runtime consent setters (`updateGoogleConsent`, `setGoogleConsentDefault`, `setGoogleAdsDataRedaction`, `setGoogleUrlPassthrough`) accept a `dataLayerName`, `VercelAnalyticsDestinationOptions` is exported from the destinations barrel, and the cookie-string parser is shared as `readCookieValue` (`@codefast/tracking/core/cookie`). Removed never-consumed exports: `GOOGLE_CONSENT_SIGNAL_CATEGORIES`, `GoogleConsentSignal`, `isGa4EventName`, `consentDecisionShapeCheckExpression`, `consentSignalAssignmentsExpression`.
117
+
118
+ - [#567](https://github.com/codefastlabs/codefast/pull/567) [`74c52ac`](https://github.com/codefastlabs/codefast/commit/74c52acf675225cfa50c73403644ff983166c82d) Thanks [@thevuong](https://github.com/thevuong)! - Cut every lane that shipped with zero consumer call sites — the package now covers exactly a consented gtag + Vercel Analytics setup on TanStack Start, and nothing speculative. Removed (recoverable from git history when a real need returns):
119
+
120
+ - **Server-side tracking**: `createServerTracker`, the beacon relay/ingest lane (`relayTrackedEvents`, `createTrackedEventIngestHandler`), `deriveEventId`, the consent-cookie mirror (`withConsentCookieMirror`, codec, `readConsentDecisionCookie`/`readConsentDecisionRequestCookie`), `ConsentConfig.decisionCookieName`, and the GA4 Measurement Protocol destination (its subpath included).
121
+ - **Offline queue machinery**: `EventQueue`, `createLocalStorageQueueStorage`, `attachClientLifecycle`, `flushWithBeacon`, `createHttpDestination`, `Destination.delivery`/`sendBatch` — every real destination (gtag.js, Vercel) owns its own in-page queue and unload delivery.
122
+ - **Segment-style event kinds**: `identify`/`group`/`alias`/`page` on the tracker and the envelope union, `EventDefinition.owner` + `EventsOf` (with no server side there is nothing to split), `attachRouterPageTracking` — page views belong to gtag `config` + Enhanced Measurement and Vercel's native `<Analytics />`.
123
+ - **GTM**: destination, bootstrap, loader.
124
+ - **Unused gtag helpers**: `setGoogleConsentDefault`, `setGoogleAdsDataRedaction`, `setGoogleUrlPassthrough`, `extractGa4ClientId`/`extractGa4SessionId`.
125
+
126
+ Follow-on API changes: `ClientTracker` is now `track()` only (`clear()` had nothing left to clear, so `ConsentWithdrawalHandlerOptions.clearTracker` is gone too); catalogs drop the `owner` tag (`{ schema }` only); `TrackedEvent` is the `track` envelope alone, still discriminated on `type` so a future kind is additive.
127
+
128
+ - [#606](https://github.com/codefastlabs/codefast/pull/606) [`5a4ff42`](https://github.com/codefastlabs/codefast/commit/5a4ff423b89a5e249c3cb48d62c86c27fc2b2293) Thanks [@thevuong](https://github.com/thevuong)! - Adds `createDurableReceiptStore({ backend })` — a durable `ReceiptStore` over an injected `ReceiptStoreBackend` (a minimal id-keyed `get`/`put` primitive). The package supplies the append-only contract and adaptation; the deployment supplies the backend client (Vercel KV, Postgres, an append-only log), so no database dependency is baked in. `put` MUST be idempotent-by-id so the append-only guarantee holds atomically under retries/concurrency (e.g. KV set-if-absent, Postgres `INSERT … ON CONFLICT DO NOTHING`) — the frame delegates rather than doing a racy get-then-put. Pair it with a real backend in production, where `createInMemoryReceiptStore` is not a lawful store on its own.
129
+
130
+ - [#604](https://github.com/codefastlabs/codefast/pull/604) [`7bb4be7`](https://github.com/codefastlabs/codefast/commit/7bb4be7edeb015542fb1b4852026db98db6a735b) Thanks [@thevuong](https://github.com/thevuong)! - `createClientTracker` now accepts an optional `isExemptionAllowed` gate, consulted before an `exempt` destination receives an event while the consent gate is closed. ePrivacy audience-measurement exemption is jurisdiction-dependent (spec-destinations §2), so it must be gateable per region rather than assumed global — returning `false` withholds even exempt sinks where exemption is not defensible. Omit it to keep the prior behavior (exempt everywhere). The gate is irrelevant once consent is granted, since every destination then receives the full envelope.
131
+
132
+ - [`41951df`](https://github.com/codefastlabs/codefast/commit/41951dfe97776bb0147e4ce766c9162327ef53b4) Thanks [@thevuong](https://github.com/thevuong)! - Expose the stored decision from `useConsent` and ignore tampered consent records.
133
+
134
+ - `UseConsentResult` gains `decision` — the stored decision under the current policy version, `undefined` until the visitor makes one. Consumers need it to replay a returning visitor's decision into Google Consent Mode (e.g. from an effect) without conflating "denied" with "no decision yet", which the boolean `isTrackingAllowed` cannot distinguish.
135
+ - `useConsent` now counts only a well-formed `decision` (`"granted"`/`"denied"`): the record is tamperable plain JSON, and a garbage value re-prompts instead of silently denying. This matches how a pre-hydration Consent Mode bootstrap reading the same record should treat it.
136
+ - Documented that `createLocalStorageConsentStorage` persists the record as plain `JSON.stringify(ConsentRecord)` — a stable contract, so inline scripts can read the decision synchronously before any tag fires.
137
+
138
+ - [#565](https://github.com/codefastlabs/codefast/pull/565) [`1e80096`](https://github.com/codefastlabs/codefast/commit/1e800961f956fdc5f23c434c1bf6f9bedb6f187b) Thanks [@thevuong](https://github.com/thevuong)! - `resolveInitialConsent` (née `buildInitialConsent`) now fails closed for a missing country code: an unknown visitor (prerender crawl, host without a geo header) resolves to the strictest opt-in default instead of `"other"`'s analytics-granted opt-out. A known non-EU country still resolves to opt-out — unknown is not known-elsewhere. Behavior change only for callers that passed `countryCode: undefined` and relied on the opt-out fallback; callers that guarded the missing case themselves can drop the guard.
139
+
140
+ - [`079b8df`](https://github.com/codefastlabs/codefast/commit/079b8dfad7bd58d1d1f0d9a8ef376383544a37c2) Thanks [@thevuong](https://github.com/thevuong)! - Align the Google Analytics (gtag) destination with GA4's event and consent semantics.
141
+
142
+ - GA4 rejects `$`-prefixed event names, so the tracker's built-ins are now translated instead of forwarded verbatim: `$identify` → `gtag('set', { user_id })`, `$group` → the recommended `join_group` event (`group_id` param), and other invalid names are warned about and dropped instead of being sent to nowhere.
143
+ - `$page_viewed` is dropped by default — `gtag('config')` plus Enhanced Measurement (on by default in GA4 admin) already report page views, so forwarding it double-counted. Opt in with `trackPageViews: true` after disabling both.
144
+ - **`setGoogleConsentDefault`/`updateGoogleConsent` now grant `analytics_storage` only**; the `ad_*` Consent Mode v2 categories stay denied unless the new `includeAds` option is set, since an analytics-only banner never asked the visitor about ads data sharing.
145
+ - Both consent functions define the standard gtag.js queueing stub themselves, so the default signal can be issued before the tag loads — as their docs always promised.
146
+
147
+ - [`079b8df`](https://github.com/codefastlabs/codefast/commit/079b8dfad7bd58d1d1f0d9a8ef376383544a37c2) Thanks [@thevuong](https://github.com/thevuong)! - Correlate GA4 Measurement Protocol hits with gtag.js's own identifiers.
148
+
149
+ GA4 joins hits on gtag's client ID (the `_ga` cookie), not on an app-generated anonymous ID — MP events sent with our ID landed on a different GA4 user than the visitor's client-side hits. New `extractGa4ClientId`/`extractGa4SessionId` helpers read gtag's `_ga`/`_ga_<stream>` request cookies (both GS1 and GS2 formats) so the destination can echo them via the new `clientId`/`sessionId` options. Events now also carry `engagement_time_msec`, `session_id`, and `timestamp_micros` — without them GA4 accepts the hit but leaves it out of realtime and session-scoped reports, and retried events drift to receipt time. `$group` maps to `join_group`; `$alias` is dropped (GA4 merges identities via `user_id`).
150
+
151
+ - [#608](https://github.com/codefastlabs/codefast/pull/608) [`6cdd930`](https://github.com/codefastlabs/codefast/commit/6cdd930ede8ad6b2d25c23dd3f9fb14a1d970e11) Thanks [@thevuong](https://github.com/thevuong)! - Adds GA4 DSR delegation (spec-data-subject-rights §3): the system delegates per-visitor deletion to the platform rather than building a deletion store. `buildGa4UserDeletionRequest({ propertyId, clientId })` returns the network-free request shape and `submitGa4UserDeletion({ …, accessToken, transport? })` POSTs it — targeting the current **Analytics Admin API** `properties.submitUserDeletion` (the legacy v3 `userDeletionRequests:upsert` was sunset with Universal Analytics), keyed by a flat `clientId`. Authorization is the caller's: pass a bearer token for the `analytics.edit` scope; no OAuth or HTTP client is baked in. Server-only (`@codefast/tracking/server`).
152
+
153
+ - [#563](https://github.com/codefastlabs/codefast/pull/563) [`bad015c`](https://github.com/codefastlabs/codefast/commit/bad015c8237182b24ef24304ddcd0f939f917c1e) Thanks [@thevuong](https://github.com/thevuong)! - Improve gtag/GTM loader DX without changing consent-first loading:
154
+
155
+ - `ensureGtag` / `loadGtagScript` / `buildGtagConsentBootstrapScript` accept optional `dataLayerName`, `nonce` (CSP), and `debugMode`.
156
+ - Add `createGoogleTagManagerDestination`, `buildGtmConsentBootstrapScript`, and `loadGtmScript` for consent-gated GTM.
157
+ - Add `<GtagConsentBootstrap />` — a framework-agnostic inline script wrapper for the pre-hydration bootstrap.
158
+
159
+ - [#563](https://github.com/codefastlabs/codefast/pull/563) [`bad015c`](https://github.com/codefastlabs/codefast/commit/bad015c8237182b24ef24304ddcd0f939f917c1e) Thanks [@thevuong](https://github.com/thevuong)! - Rename the `http-destination` module to `http`, matching the `create<X>Destination` file-naming convention used by every other destination. Breaking for deep imports only: `@codefast/tracking/destinations/http-destination` is now `@codefast/tracking/destinations/http`; imports from the `@codefast/tracking/destinations` barrel are unaffected.
160
+
161
+ - [#617](https://github.com/codefastlabs/codefast/pull/617) [`b979371`](https://github.com/codefastlabs/codefast/commit/b979371fb4b437be04a59cb5985de03ebe810e0d) Thanks [@thevuong](https://github.com/thevuong)! - Adopt TanStack Start's first-class server helpers in the adapter instead of hand-rolling over raw request/response headers.
162
+
163
+ - The anonymous-id cookie is now written with `setCookie`/`deleteCookie` (from `@tanstack/react-start/server`) rather than `setResponseHeader("set-cookie", …)`. The raw header call **replaces** any existing `Set-Cookie` on the response — it would clobber a session or framework cookie set on the same response — whereas `setCookie` appends. No behavior change to the emitted cookie (still `Path=/; Max-Age=1y; SameSite=Lax; Secure`, not `HttpOnly`).
164
+ - The connection IP for consent receipts is now read with `getRequestIP({ xForwardedFor: true })` — the maintained, platform-aware path — instead of hand-parsing `x-forwarded-for`/`x-real-ip`.
165
+
166
+ Breaking (`@codefast/tracking/server/anonymous-id-cookie`): the string builders `buildAnonymousIdSetCookie`/`buildClearAnonymousIdSetCookie` are replaced by `resolveAnonymousIdCookie`/`resolveClearAnonymousIdCookie`, which return the validated name/value plus cookie attributes for a framework `setCookie`/`deleteCookie` call. `isValidAnonymousId` is unchanged; the cookie-name guard is now the exported `assertValidAnonymousIdCookieName`.
167
+
168
+ - [`079b8df`](https://github.com/codefastlabs/codefast/commit/079b8dfad7bd58d1d1f0d9a8ef376383544a37c2) Thanks [@thevuong](https://github.com/thevuong)! - Deliver events to SDK-backed destinations at track time instead of through the batching queue.
169
+
170
+ `Destination` gains an optional `delivery: "immediate" | "queued"` field. The Google Analytics and Vercel destinations are marked `"immediate"` — their SDKs own batching and unload delivery, so routing them through the queue only delayed events and replayed stale ones next session with wrong timestamps. The queue keeps serving HTTP destinations and the `flushWithBeacon` path unchanged.
171
+
172
+ - [#567](https://github.com/codefastlabs/codefast/pull/567) [`74c52ac`](https://github.com/codefastlabs/codefast/commit/74c52acf675225cfa50c73403644ff983166c82d) Thanks [@thevuong](https://github.com/thevuong)! - Collapse the export map to group entries — per-file subpaths froze the internal file layout into public API.
173
+
174
+ **Breaking:** deep subpaths (`./client/*`, `./core/*`, `./server/*`, `./react/*`, and per-file `./destinations/*`) no longer resolve. Import from the group entry instead:
175
+
176
+ - `@codefast/tracking/core` and `@codefast/tracking/core/*` → `@codefast/tracking` (the root has always re-exported the whole isomorphic core surface).
177
+ - `@codefast/tracking/client/*` → `@codefast/tracking/client`; same pattern for `server` and `react`.
178
+ - Google helpers → `@codefast/tracking/destinations`.
179
+
180
+ One destination keeps a dedicated subpath on purpose: `@codefast/tracking/destinations/vercel-analytics` — its top-level `@vercel/analytics` import would make the optional peer mandatory for every barrel consumer.
181
+
182
+ All entries are unbundled ESM with `sideEffects: false`, so group imports tree-shake per file — the trim changes what is addressable, not what ships.
183
+
184
+ - [#607](https://github.com/codefastlabs/codefast/pull/607) [`749dd16`](https://github.com/codefastlabs/codefast/commit/749dd166b4e6d4ddf49e0589831b69a0e9458478) Thanks [@thevuong](https://github.com/thevuong)! - Adds server-side GA4 Measurement Protocol primitives for forwarding a **server-owned** event (re-added now that a consumer tracks one — a server-recorded consent decision): `sendMeasurementProtocolEvents` POSTs `{ client_id, events, consent? }` to the credentialed `/mp/collect` endpoint through an injected `transport` (default `fetch`), so no HTTP client or credentials are baked in; `extractGaClientId` derives the GA4 `client_id` from a `_ga` cookie; `toMeasurementProtocolConsent` maps the package `ConsentDecision` to the MP `consent` signals. Server-only (`@codefast/tracking/server`). The caller owns the credentials and the consent gate.
185
+
186
+ - [#602](https://github.com/codefastlabs/codefast/pull/602) [`5ca04e2`](https://github.com/codefastlabs/codefast/commit/5ca04e2f7fe970397c9b90be727fc81d89a737a2) Thanks [@thevuong](https://github.com/thevuong)! - `createClientTracker` now accepts an optional `onDeliveryError` hook, called once per failed delivery (a destination throwing synchronously or rejecting) with `{ destination, error, event }`. The tracker still swallows the failure so tracking never breaks the interaction — the hook is a metering seam for wiring delivery failures to a monitor in production. The hook is itself guarded, so a throwing observer can't break the interaction either. Exposes the `DeliveryErrorContext` type from `@codefast/tracking/client`.
187
+
188
+ - [#610](https://github.com/codefastlabs/codefast/pull/610) [`fdb8d7c`](https://github.com/codefastlabs/codefast/commit/fdb8d7c928847a957ecb1d571e82b1948fac5a2e) Thanks [@thevuong](https://github.com/thevuong)! - Adds the per-destination erasure capability for DSR withdrawal (spec-data-subject-rights §3, DSR-V2/V4): `Destination` gains an optional `onErasure(id)` hook, and `createClientTracker` returns an `erase(id)` method that invokes each destination's `onErasure` once on withdrawal, swallowing failures so a destination can never break the flow. The reference `createMetaDestination` implements `onErasure` as cookie-clear (via an injected `clearCookies` seam) plus stop-send — Meta exposes no per-visitor deletion API, so the binding never fabricates one. Destinations with nothing to erase omit the hook.
189
+
190
+ - [`2ebb0c0`](https://github.com/codefastlabs/codefast/commit/2ebb0c0202891297f75525156b57ed9b2040ab82) Thanks [@thevuong](https://github.com/thevuong)! - Make consent per-category, mirroring Google Consent Mode v2. `ConsentDecision` is now `{ ads: boolean, analytics: boolean }` instead of a single `"granted" | "denied"` flag, `useConsent` takes the `categories` the app's prompt asks about (`grantAll`/`denyAll`/`save` replace `grant`/`deny`), and `ConsentBanner` gains a per-category preferences layer plus a `ReactNode` message for the privacy-policy link. The GA4 helpers map the decision onto the v2 signals (`ads` drives `ad_storage`/`ad_user_data`/`ad_personalization`), take `wait_for_update`/`region`, and gain `setGoogleAdsDataRedaction`/`setGoogleUrlPassthrough`; the destination-side `includeAds` override is gone — the visitor's decision carries ads consent. `resolveDefaultConsent` replaces `shouldTrackByDefault` and honors GPC as an ads-only opt-out. Previously stored string decisions fail shape validation and re-prompt, no policy-version bump needed.
191
+
192
+ - [#563](https://github.com/codefastlabs/codefast/pull/563) [`bad015c`](https://github.com/codefastlabs/codefast/commit/bad015c8237182b24ef24304ddcd0f939f917c1e) Thanks [@thevuong](https://github.com/thevuong)! - Add three helpers that pull common consent/tracking wiring out of consumer apps and into the package:
193
+
194
+ - `resolveEffectiveConsent(storage, policyVersion, categories, mode, hasGpc)` and `readStoredDecision(storage, policyVersion)` (`@codefast/tracking/core`) — the same "stored decision, else region default" rule `useConsent` applies internally, now exposed so a non-React gate (e.g. a tracker's `isTrackingAllowed` option) doesn't have to reimplement it by hand.
195
+ - `buildGtagConsentBootstrapScript(options)` (`@codefast/tracking/destinations`) — generates the pre-hydration `<script>` source that applies Google Consent Mode v2's default signal from the stored decision (or a supplied fallback) and conditionally loads gtag.js, replacing a hand-written JS string per app.
196
+ - `createCookieAnonymousId(options)` (`@codefast/tracking/client`) — an opt-in `document.cookie`-backed anonymous id `getOrCreate`/`clear` pair for apps that don't need a custom identity strategy.
197
+
198
+ None of these change existing exports' behavior; `useConsent` is refactored internally to use `readStoredDecision` but its output is unchanged.
199
+
200
+ - [#565](https://github.com/codefastlabs/codefast/pull/565) [`1e80096`](https://github.com/codefastlabs/codefast/commit/1e800961f956fdc5f23c434c1bf6f9bedb6f187b) Thanks [@thevuong](https://github.com/thevuong)! - Remove the deprecated edge-middleware cookie bootstrap path:
201
+
202
+ - Drop `buildInitialConsentBootstrapScript` and the `@codefast/tracking/destinations/initial-consent-bootstrap` subpath.
203
+ - Resolve region consent via a server function (`resolveInitialConsent`) plus a client snapshot instead — see `apps/ui` `visitor-consent.ts` / `resolve-visitor-consent.ts`.
204
+
205
+ - [#563](https://github.com/codefastlabs/codefast/pull/563) [`bad015c`](https://github.com/codefastlabs/codefast/commit/bad015c8237182b24ef24304ddcd0f939f917c1e) Thanks [@thevuong](https://github.com/thevuong)! - Rename `UseConsentResult.needsPrompt` to `isPromptNeeded` — a boolean should read as an assertion, matching `isTrackingAllowed` on the same result (Swift API Design Guidelines pass).
206
+
207
+ **Breaking:** consumers of `useConsent`/`ConsentBanner` reading `needsPrompt` must switch to `isPromptNeeded`.
208
+
209
+ - [#563](https://github.com/codefastlabs/codefast/pull/563) [`bad015c`](https://github.com/codefastlabs/codefast/commit/bad015c8237182b24ef24304ddcd0f939f917c1e) Thanks [@thevuong](https://github.com/thevuong)! - Add `deriveEventId(requestId, discriminant)` (`@codefast/tracking/core`) and wire it into `createServerTracker`: pass `requestId` on `ServerTrackerContext` to make a server-owned event's `eventId` deterministic instead of random. Retrying the same request with the same `track`/`group`/`alias` call now reproduces the same `eventId`, so a destination that dedupes on it treats the retry as a no-op instead of double-counting — closing the gap between the package's documented idempotency intent and its previous always-random default. Omitting `requestId` keeps the existing random behavior, so this is additive and non-breaking.
210
+
211
+ - [#566](https://github.com/codefastlabs/codefast/pull/566) [`ffd777c`](https://github.com/codefastlabs/codefast/commit/ffd777c13a66a377bee287fbb9cd692056b6a6cc) Thanks [@thevuong](https://github.com/thevuong)! - Modernize the package around server-first React frameworks and shrink what the client pays for.
212
+
213
+ Breaking (pre-release):
214
+
215
+ - Event catalogs now accept any Standard Schema library (zod, `zod/mini`, valibot) — `EventDefinition` is typed on `StandardSchemaV1`, validation runs through the new `assertValidEventProperties`, and `zod` is no longer a dependency (`@standard-schema/spec` is the only one).
216
+ - `buildInitialConsent` → `resolveInitialConsent`; `ServerTrackContext` → `ServerTrackerContext`.
217
+ - `attachClientLifecycle` drops `flushIntervalMs` — the queue schedules its own flushes (one-shot idle timer armed only while events are pending, offline-aware); the lifecycle keeps hide/pagehide delivery (beacon, or a keepalive `fetch` fallback) and flush-on-reconnect.
218
+ - The `./destinations` barrel is browser-lane only: import `createVercelAnalyticsDestination` from `./destinations/vercel-analytics` (its top-level `@vercel/analytics` import made the optional peer mandatory for barrel consumers) and `createGa4MeasurementProtocolDestination` from its own subpath.
219
+ - `./server`, `./server/*`, `./tanstack-start`, and `./destinations/ga4-measurement-protocol` are server-only by contract: on TanStack Start, deny them in the client environment via `importProtection.client.specifiers` (README shows the config) so a leak fails the build with a traced violation instead of silently shipping server code or the GA4 `apiSecret`.
220
+
221
+ New:
222
+
223
+ - `@codefast/tracking/tanstack-start` (optional peer on `@tanstack/react-start`): `resolveInitialConsentFromRequest`, `setAnonymousIdResponseCookie`/`clearAnonymousIdResponseCookie`, `readAnonymousIdRequestCookie`, `readConsentDecisionRequestCookie`, `resolveServerTrackerContextFromRequest` — consumers' server functions become one-liners.
224
+ - `createInitialConsentStore` (client) + `useInitialConsent` (react): the whole post-hydration region-resolution lane — strictest-until-resolved, single-flight, per-session cache validated by the new `isInitialConsent` guard, fail-closed-but-retryable errors, retry on tab-visible.
225
+ - `createServerTracker`: `waitUntil` hands delivery (and its retry ladder) to the platform's post-response scheduler; `withContext` binds per-request identity once.
226
+ - Beacon receive half: `relayTrackedEvents` + `createTrackedEventIngestHandler` (`Request → Response`) validate client envelopes, re-stamp server-read identity, and keep client `eventId`s so re-sent beacons dedupe.
227
+ - Consent-aware server tracking: consent-cookie codec (core), `withConsentCookieMirror` (client), `readConsentRecordCookie`/`readConsentDecisionCookie` (server).
228
+ - Transport hardening: `requestTimeoutMs` (default 10s) on the fetch destinations, `keepalive` threading for unload flushes, `Destination.sendBatch` (implemented by `createHttpDestination` — one POST per queue flush).
229
+ - `CookieAnonymousId.refresh()` prolongs an existing id without ever minting; `STRICTEST_INITIAL_CONSENT`, `CONSENT_REGIONS`, `isConsentRegion` are exported from core; the localStorage consent storage caches parsed records behind a raw-string compare; client-only react modules ship `"use client"`.
230
+
231
+ - [#563](https://github.com/codefastlabs/codefast/pull/563) [`bad015c`](https://github.com/codefastlabs/codefast/commit/bad015c8237182b24ef24304ddcd0f939f917c1e) Thanks [@thevuong](https://github.com/thevuong)! - Add server-persisted anonymous id ("client mints, server persists"). `createServerPersistedAnonymousId` (client) keeps the lazy, post-consent minting of `createCookieAnonymousId` and delegates the durable cookie write to an app-supplied server round-trip, so the id outlives Safari ITP's 7-day cap on script-written cookies. The server half — `readAnonymousIdCookie`, `buildAnonymousIdSetCookie`, `buildClearAnonymousIdSetCookie`, `isValidAnonymousId` — is framework-agnostic string-in/string-out: always `Secure; SameSite=Lax`, validates the cookie name, and throws on any non-UUID id so a public persist endpoint can never echo attacker input into a response header. The server persists and prolongs an id the client hands it; it never mints one per request.
232
+
233
+ - [#563](https://github.com/codefastlabs/codefast/pull/563) [`bad015c`](https://github.com/codefastlabs/codefast/commit/bad015c8237182b24ef24304ddcd0f939f917c1e) Thanks [@thevuong](https://github.com/thevuong)! - Add a TanStack Start wiring kit so consumer apps no longer hand-roll consent/bootstrap glue:
234
+
235
+ - `resolveInitialConsent` (née `buildInitialConsent`) + exported `EU_COUNTRY_CODES` / `OPT_IN_EQUIVALENT_COUNTRY_CODES` (`@codefast/tracking/server`) — region → mode → default decision for server functions (or a fail-closed bake when country is unknown).
236
+ - `clearGoogleAnalyticsCookies` (`@codefast/tracking/destinations`) — expire `_ga` / `_ga_*` on consent withdrawal.
237
+ - `createIsTrackingAllowed` / `createConsentWithdrawalHandler` (`@codefast/tracking/client`) — tracker gate + revoke clears.
238
+ - `useGoogleConsentSync` (`@codefast/tracking/react`) — Consent Mode `update` + optional gtag load, including cross-tab / privacy-page decisions.
239
+
240
+ `InitialConsent` is exported from `@codefast/tracking` / `@codefast/tracking/core`. None of these change existing export behavior.
241
+
242
+ - [#565](https://github.com/codefastlabs/codefast/pull/565) [`1e80096`](https://github.com/codefastlabs/codefast/commit/1e800961f956fdc5f23c434c1bf6f9bedb6f187b) Thanks [@thevuong](https://github.com/thevuong)! - Rename public APIs to follow Swift API Design Guidelines (name by role; nouns for properties; imperative verbs for builders; assertion-form booleans).
243
+
244
+ **Breaking:**
245
+
246
+ - Envelope field: `TrackEvent.props` / `PageViewEvent.props` → `properties` (and the `track`/`page` method parameters). Segment-style name; `Props` is reserved for React components.
247
+ - Analytics gate: `isTrackingAllowed` → `isAnalyticsAllowed` on `ClientTrackerOptions` and `UseConsentResult` (the gate reads the `analytics` category only). `createIsTrackingAllowed` → `createIsAnalyticsAllowed`; subpath `./client/is-tracking-allowed` → `./client/is-analytics-allowed`.
248
+ - Options naming (drop `Create*` / `Build*` filler): `CreateIsAnalyticsAllowedOptions` → `IsAnalyticsAllowedOptions`; `CreateConsentWithdrawalHandlerOptions` → `ConsentWithdrawalHandlerOptions`; `BuildInitialConsentOptions` → `InitialConsentOptions`; `BuildAnonymousIdSetCookieOptions` → `AnonymousIdSetCookieOptions`. `ClientLifecycleOptions` stays (product-named, no verb prefix).
249
+ - Prompt scope option: `categories` → `requestedCategories` on `UseConsentOptions`, `IsAnalyticsAllowedOptions`, and `InitialConsentOptions`.
250
+ - `Destination.consent` / `VercelAnalyticsDestinationOptions.consent` → `consentRequirement` (`"exempt" | "required"`).
251
+ - `googleConsentBootstrapPreamble` → `buildGoogleConsentBootstrapPreamble`; `dataLayerOf` → `ensureDataLayer`.
252
+ - `UseConsentResult.save` → `saveDecision`.
253
+ - Demote package-private deep exports: remove `./client/queue`, `./destinations/shared`, and `./destinations/google-consent` from `package.json#exports`. `EventQueue` / `EventQueueOptions` leave the `./client` barrel; `EventQueueStorage` stays (custom offline persistence). Consent Mode helpers remain on `./destinations` / `./react`.
254
+ - Options-object for multi-arg consent resolvers (clarity at the call site): `resolveDefaultConsent(mode, requestedCategories, hasGlobalPrivacyControlSignal)` → `resolveDefaultConsent(options)` and `resolveEffectiveConsent(storage, policyVersion, requestedCategories, mode, hasGlobalPrivacyControlSignal)` → `resolveEffectiveConsent(options)`; new `ResolveDefaultConsentOptions` / `ResolveEffectiveConsentOptions` types. `readStoredDecision(storage, policyVersion)` keeps its positional args.
255
+ - GA4 Measurement Protocol debug flag: `Ga4MeasurementProtocolDestinationOptions.debug` → `debugMode` (matches `debugMode` on the gtag options).
256
+ - Server `group` signature: `ServerTracker.group(groupId, traits, context)` → `group(groupId, context, traits?)` so `traits` is truly optional instead of a forced `undefined`.
257
+ - Remove `assertNever` from the public exports (generic, non-tracking helper; internal-only now).
258
+ - `readCookieValue` is now also exported from the root entry (previously only on `./core`).
259
+
260
+ - [#611](https://github.com/codefastlabs/codefast/pull/611) [`a5527c3`](https://github.com/codefastlabs/codefast/commit/a5527c3e7ddaf2d0ca1d11026be2cb2bd5fd476c) Thanks [@thevuong](https://github.com/thevuong)! - Extends the ad-destination frame with two more reference vendors (spec-destinations §5), consuming the same `{ ads, analytics }` decision: `createMicrosoftUetDestination` / `toMicrosoftUetConsent` map `ads` to UET's only enforced signal, `ad_storage` (UET has no `analytics_storage`); `createTiktokDestination` / `toTiktokConsent` map `ads` to TikTok's single `limited_data_use` boolean (not Meta's `dataProcessingOptions` structure). Both take an injected `transport` (no pixel id, tag id, or network client baked in) and implement `onErasure` as cookie-clear + stop-send, since neither exposes a per-visitor deletion API. `consentRequirement` stays `"required"`.
261
+
262
+ - [#563](https://github.com/codefastlabs/codefast/pull/563) [`bad015c`](https://github.com/codefastlabs/codefast/commit/bad015c8237182b24ef24304ddcd0f939f917c1e) Thanks [@thevuong](https://github.com/thevuong)! - Discriminate event envelopes by `type` and add a consent-exempt destination lane.
263
+
264
+ `TrackedEvent` is now a union discriminated on `type: "track" | "page" | "identify" | "group" | "alias"` (Segment-style) instead of encoding built-ins into `$`-prefixed magic names — destinations translate each kind into their own vocabulary via an exhaustive `switch` (`identify` carries `traits`, `group` carries `groupId`/`traits`, `alias` carries `previousId`), and the app-chosen `name` only exists on `track`/`page`. This changes the wire format seen by HTTP destinations and the queue storage; stale queue records without a `type` are dropped silently. `Destination` gains `consent?: "exempt" | "required"` — while the tracker's consent gate is closed, exempt immediate destinations keep receiving `track`/`page` events stripped of `anonymousId`/`userId` (identity kinds and queueing stay fully gated), so cookieless sinks like Vercel Analytics can keep counting interactions without consent-gated identifiers. The Vercel destination accepts the flag via its options and still defaults to `"required"`.
265
+
266
+ ### Patch Changes
267
+
268
+ - [#676](https://github.com/codefastlabs/codefast/pull/676) [`641e233`](https://github.com/codefastlabs/codefast/commit/641e2338d77fb61be2ca585a5986f34cf32ec746) Thanks [@thevuong](https://github.com/thevuong)! - Collapse the `types` and `default` lanes of `package.json#imports` from fallback arrays to single strings.
269
+
270
+ Node resolves an imports array by taking the first candidate it can parse, without checking that the file exists and without falling through — a specifier whose first candidate is missing throws `ERR_MODULE_NOT_FOUND` rather than trying the second. `./dist/*/index.js` and `./dist/*/index.d.ts` could therefore never be reached, so they read as a safety net that does not exist. The `source` lane keeps its extension candidates, which only `tsc` and Vite read and both probe.
271
+
272
+ - [#565](https://github.com/codefastlabs/codefast/pull/565) [`1e80096`](https://github.com/codefastlabs/codefast/commit/1e800961f956fdc5f23c434c1bf6f9bedb6f187b) Thanks [@thevuong](https://github.com/thevuong)! - Prefer the live anonymous-id cookie over the in-memory cache so a cross-tab consent withdrawal cannot revive the pre-withdrawal identity on re-grant.
273
+
274
+ - [#563](https://github.com/codefastlabs/codefast/pull/563) [`bad015c`](https://github.com/codefastlabs/codefast/commit/bad015c8237182b24ef24304ddcd0f939f917c1e) Thanks [@thevuong](https://github.com/thevuong)! - Fix bugs found in review of the consent-gated tracking pipeline, and dedupe the GA4/Vercel destinations.
275
+
276
+ `createClientTracker`'s `identify()` no longer commits `userId` to the tracker's closure while consent is denied — a denied `identify` could otherwise leak its `userId` onto a later, allowed `track`/`page`/`group` call. `createServerTracker`'s per-request `eventId` derivation now factors in `userId`, so two `alias()` calls with the same `previousId` but different merge targets in one request no longer collide on `eventId`. `createLocalStorageQueueStorage.load()` now drops pre-migration/malformed queue records via a new `isTrackedEvent` guard (exported from `@codefast/tracking/core`), instead of relying on each destination's `switch` to silently no-op on an unrecognized shape.
277
+
278
+ Also: the GA4 (`gtag`/Measurement Protocol) and Vercel Analytics destinations now share one prop-flattening helper and one `group`→`join_group` mapping (`@codefast/tracking/destinations`'s internal `shared.ts`) instead of three near-duplicate implementations; `buildGtagConsentBootstrapScript`'s pre-hydration Consent Mode signal mapping is generated from the same table `toGoogleConsentParams` uses instead of a hand-duplicated literal; and the package's `ensureGtag` gtag.js stub helper, plus a new `loadGtagScript(options)` (loads gtag.js on demand, idempotent), are now exported so apps don't have to reimplement on-demand script loading themselves.
279
+
280
+ - [#565](https://github.com/codefastlabs/codefast/pull/565) [`1e80096`](https://github.com/codefastlabs/codefast/commit/1e800961f956fdc5f23c434c1bf6f9bedb6f187b) Thanks [@thevuong](https://github.com/thevuong)! - Guard `createLocalStorageConsentStorage` with `isConsentRecord` so malformed localStorage JSON cannot be treated as a valid consent record.
281
+
282
+ - [`46c32d6`](https://github.com/codefastlabs/codefast/commit/46c32d6a5dfcfbccd5e1b3dd6a5488cb84b31b6a) Thanks [@thevuong](https://github.com/thevuong)! - Default `engagement_time_msec` on Measurement Protocol events to 100ms — the fallback Google's own MP documentation prescribes when the elapsed time since the previous event is unknown — instead of 1ms.
283
+
284
+ - [#565](https://github.com/codefastlabs/codefast/pull/565) [`1e80096`](https://github.com/codefastlabs/codefast/commit/1e800961f956fdc5f23c434c1bf6f9bedb6f187b) Thanks [@thevuong](https://github.com/thevuong)! - Skip `clearOnServer` when the anonymous-id cookie is already gone, so a second withdrawal clear in the same tick does not fire a redundant server round-trip.
285
+
3
286
  ## 0.5.0-canary.9
4
287
 
5
288
  ### Patch Changes
package/README.md CHANGED
@@ -5,23 +5,21 @@ Consent-gated, type-safe event tracking for TanStack Start apps.
5
5
  [![npm version](https://img.shields.io/npm/v/@codefast/tracking)](https://www.npmjs.com/package/@codefast/tracking)
6
6
  [![license](https://img.shields.io/npm/l/@codefast/tracking)](https://github.com/codefastlabs/codefast/blob/main/LICENSE)
7
7
 
8
- - **One catalog, typed end to end** — apps define their events over any
9
- [Standard Schema](https://standardschema.dev) library (zod, `zod/mini`, valibot, ...);
10
- `track()` validates properties at the call site and at runtime, and the client bundle
11
- only pays for the schema library the app already ships.
12
- - **One consent config, every surface** — `ConsentConfig` is the single bag for the
13
- storage key, policy version, and requested purposes; the React hooks, the tracker gate,
14
- and the pre-hydration gtag bootstrap all take the same object, so nothing drifts.
15
- - **ISR-safe by design** — shared/CDN-cached HTML bakes the strictest consent default;
16
- the region-correct default arrives per visitor over a private server-function lane.
8
+ - **One catalog, typed end to end** — apps define their events over any [Standard Schema](https://standardschema.dev)
9
+ library (zod, `zod/mini`, valibot, ...); `track()` validates properties at the call site and at runtime, and the
10
+ client bundle only pays for the schema library the app already ships.
11
+ - **One consent config, every surface** — `ConsentConfig` is the single bag for the storage key, policy version, and
12
+ requested purposes; the React hooks, the tracker gate, and the pre-hydration gtag bootstrap all take the same object,
13
+ so nothing drifts.
14
+ - **ISR-safe by design** — shared/CDN-cached HTML bakes the strictest consent default; the region-correct default
15
+ arrives per visitor over a private server-function lane.
17
16
 
18
17
  ## Status
19
18
 
20
- Pre-1.0 (canary). The surface is deliberately small: it covers exactly what a consented
21
- gtag + Vercel Analytics setup on TanStack Start needs, and nothing speculative. Lanes
22
- that shipped here before (offline queue, beacon relay, server-side tracker, GTM,
23
- Segment-style `identify`/`group`/`alias`/`page`) were removed because no consumer called
24
- them — git history has them if a real need returns.
19
+ Pre-1.0 (canary). The surface is deliberately small: it covers exactly what a consented gtag + Vercel Analytics setup on
20
+ TanStack Start needs, and nothing speculative. Lanes that shipped here before (offline queue, beacon relay, server-side
21
+ tracker, GTM, Segment-style `identify`/`group`/`alias`/`page`) were removed because no consumer called them — git
22
+ history has them if a real need returns.
25
23
 
26
24
  ## Installation
27
25
 
@@ -29,9 +27,8 @@ them — git history has them if a real need returns.
29
27
  pnpm add @codefast/tracking
30
28
  ```
31
29
 
32
- Every peer is optional and only needed by the surface that uses it: `react`/`react-dom`
33
- (>= 19) for `/react`, `@tanstack/react-start` (>= 1.168) for `/adapters/tanstack-start`, and
34
- `@vercel/analytics` for the Vercel destination.
30
+ Every peer is optional and only needed by the surface that uses it: `react`/`react-dom` (>= 19) for `/react`,
31
+ `@tanstack/react-start` (>= 1.168) for `/adapters/tanstack-start`, and `@vercel/analytics` for the Vercel destination.
35
32
 
36
33
  ## Quick Start
37
34
 
@@ -88,102 +85,89 @@ export const tracker = createClientTracker({
88
85
  tracker.track("copy_code", { name: "button" }); // typed + runtime-validated
89
86
  ```
90
87
 
91
- Destinations own their transport (gtag.js and Vercel both batch in-page), so `track()`
92
- is fire-and-forget — a failing destination can never break the interaction.
88
+ Destinations own their transport (gtag.js and Vercel both batch in-page), so `track()` is fire-and-forget — a failing
89
+ destination can never break the interaction.
93
90
 
94
91
  ## Event catalog
95
92
 
96
- The package ships no events and no schema library — every app builds its own catalog
97
- with `defineEventCatalog` over whatever Standard Schema validator it already uses.
98
- `track()` infers both the event name and its properties from the catalog, then validates
99
- the properties at runtime; a mismatch throws at the call site. Async schemas are rejected
100
- by design — tracking sits on synchronous call paths.
93
+ The package ships no events and no schema library — every app builds its own catalog with `defineEventCatalog` over
94
+ whatever Standard Schema validator it already uses. `track()` infers both the event name and its properties from the
95
+ catalog, then validates the properties at runtime; a mismatch throws at the call site. Async schemas are rejected by
96
+ design — tracking sits on synchronous call paths.
101
97
 
102
98
  ## Subpaths
103
99
 
104
- The root `@codefast/tracking` is the **client entry**: it re-exports the isomorphic core
105
- (catalog types, `Destination`, consent model + config) plus the whole browser-side surface
106
- (tracker, consent runtime, React bindings, and the client destinations). Server-only lanes
107
- are their own subpaths and are never re-exported from the root:
100
+ The root `@codefast/tracking` is the **client entry**: it re-exports the isomorphic core (catalog types, `Destination`,
101
+ consent model + config) plus the whole browser-side surface (tracker, consent runtime, React bindings, and the client
102
+ destinations). Server-only lanes are their own subpaths and are never re-exported from the root:
108
103
 
109
- - `@codefast/tracking` — client entry: core + `createClientTracker`, `createConsentRuntime`,
110
- the `useConsent`/`ConsentBanner`/`GtagConsentBootstrap` React bindings, the gtag +
111
- ad-network destinations.
112
- - `@codefast/tracking/destinations/vercel-analytics` — its own subpath so its
113
- `@vercel/analytics` peer is only pulled in when used.
104
+ - `@codefast/tracking` — client entry: core + `createClientTracker`, `createConsentRuntime`, the
105
+ `useConsent`/`ConsentBanner`/`GtagConsentBootstrap` React bindings, the gtag + ad-network destinations.
106
+ - `@codefast/tracking/destinations/vercel-analytics` — its own subpath so its `@vercel/analytics` peer is only pulled in
107
+ when used.
114
108
  - `@codefast/tracking/server/*` — request-scoped, **server-only**: `server/initial-consent`,
115
- `server/consent-receipt-store`, `server/measurement-protocol`, … (server code imports the
116
- core it needs from `@codefast/tracking/core/*`, never from the client root).
117
- - `@codefast/tracking/adapters/tanstack-start` — request/response glue over Start's server
118
- context, **server-only**.
119
- - `@codefast/tracking/tooling/import-protection` — `SERVER_ONLY_SUBPATHS` deny-list for
120
- client bundles.
109
+ `server/consent-receipt-store`, `server/measurement-protocol`, … (server code imports the core it needs from
110
+ `@codefast/tracking/core/*`, never from the client root).
111
+ - `@codefast/tracking/adapters/tanstack-start` — request/response glue over Start's server context, **server-only**.
112
+ - `@codefast/tracking/tooling/import-protection` — `SERVER_ONLY_SUBPATHS` deny-list for client bundles.
121
113
  - `@codefast/tracking/css/consent.css` — optional plain-CSS theme for the consent banner.
122
114
 
123
- Every built module is also its own subpath (e.g. `@codefast/tracking/client/gpc`) for
124
- granular imports. Server-only lanes (`server/*`, `adapters/*`) must never enter a client
125
- bundle — feed `SERVER_ONLY_SUBPATHS` to the framework's import-protection (see below). There
126
- is deliberately no server-side tracker: destinations batch in-page, and the server half of
127
- the package is consent resolution plus cookie persistence.
115
+ Every built module is also its own subpath (e.g. `@codefast/tracking/client/gpc`) for granular imports. Server-only
116
+ lanes (`server/*`, `adapters/*`) must never enter a client bundle — feed `SERVER_ONLY_SUBPATHS` to the framework's
117
+ import-protection (see below). There is deliberately no server-side tracker: destinations batch in-page, and the server
118
+ half of the package is consent resolution plus cookie persistence.
128
119
 
129
120
  ## Consent (region-based, per-category)
130
121
 
131
- `ConsentDecision` is per-purpose (`{ ads, analytics }`), mirroring Google Consent Mode
132
- v2. Region resolves the mode: GDPR (EU, plus UK/EEA-EFTA equivalents) and Vietnam's PDPL
133
- get **opt-in**; the US (CCPA/CPRA) and unrecognized regions get **opt-out**, with GPC
134
- honored as an ads-only opt-out. Stored records are policy-versioned and shape-checked —
135
- a malformed or legacy-shaped record re-prompts instead of silently deciding.
122
+ `ConsentDecision` is per-purpose (`{ ads, analytics }`), mirroring Google Consent Mode v2. Region resolves the mode:
123
+ GDPR (EU, plus UK/EEA-EFTA equivalents) and Vietnam's PDPL get **opt-in**; the US (CCPA/CPRA) and unrecognized regions
124
+ get **opt-out**, with GPC honored as an ads-only opt-out. Stored records are policy-versioned and shape-checked — a
125
+ malformed or legacy-shaped record re-prompts instead of silently deciding.
136
126
 
137
- - `useConsent({ config, mode, storage })` — `useSyncExternalStore` bridge over the stored
138
- decision; cross-tab saves sync through the `storage` event.
127
+ - `useConsent({ config, mode, storage })` — `useSyncExternalStore` bridge over the stored decision; cross-tab saves sync
128
+ through the `storage` event.
139
129
  - `ConsentBanner` + parts (`Title`/`Description`/`Actions`/`Accept`/`Reject`/`Customize`/
140
- `Preferences`/`Category`/`Save`) — headless, `data-slot`-styleable; optional plain-CSS
141
- theme at `@codefast/tracking/css/consent.css`. `ConsentToggle` is the persistent
142
- opt-out control CCPA requires.
143
- - `useGoogleConsentSync(consent, { loadGtagScript? })` — pushes Consent Mode `update`
144
- signals, including privacy-page and cross-tab decisions.
145
- - `createConsentWithdrawalHandler({ clearAnonymousId?, clearGoogleAnalyticsCookies? })` —
146
- wire to `onDecision` so a denial clears first-party identifiers.
130
+ `Preferences`/`Category`/`Save`) — headless, `data-slot`-styleable; optional plain-CSS theme at
131
+ `@codefast/tracking/css/consent.css`. `ConsentToggle` is the persistent opt-out control CCPA requires.
132
+ - `useGoogleConsentSync(consent, { loadGtagScript? })` — pushes Consent Mode `update` signals, including privacy-page
133
+ and cross-tab decisions.
134
+ - `createConsentWithdrawalHandler({ clearAnonymousId?, clearGoogleAnalyticsCookies? })` — wire to `onDecision` so a
135
+ denial clears first-party identifiers.
147
136
 
148
137
  ### The ISR lane
149
138
 
150
- ISR/CDN-cached HTML is shared across visitors, so no render may read geo. Bake
151
- `STRICTEST_INITIAL_CONSENT` into the shared render (and into `<GtagConsentBootstrap />`),
152
- then resolve the region-correct default per visitor after hydration:
139
+ ISR/CDN-cached HTML is shared across visitors, so no render may read geo. Bake `STRICTEST_INITIAL_CONSENT` into the
140
+ shared render (and into `<GtagConsentBootstrap />`), then resolve the region-correct default per visitor after
141
+ hydration:
153
142
 
154
143
  1. **Server function** — `resolveInitialConsentFromRequest({ requestedCategories })`
155
144
  (`@codefast/tracking/adapters/tanstack-start`) reads the geo header and `sec-gpc`, stamps
156
145
  `cache-control: private, no-store`, and fails closed when geo is missing.
157
- 2. **Client** — `createConsentRuntime` owns the rest: strictest default until the server
158
- answers, single-flight resolve, per-session cache, fail-closed-but-retryable errors.
159
- Kick `runtime.ensureInitialConsentResolved()` at router creation (window-guarded) so
160
- the round trip overlaps hydration; read it reactively via
146
+ 2. **Client** — `createConsentRuntime` owns the rest: strictest default until the server answers, single-flight resolve,
147
+ per-session cache, fail-closed-but-retryable errors. Kick `runtime.ensureInitialConsentResolved()` at router creation
148
+ (window-guarded) so the round trip overlaps hydration; read it reactively via
161
149
  `useInitialConsent(runtime.initialConsentStore)` (`@codefast/tracking/react/use-initial-consent`).
162
150
 
163
151
  ## Durable anonymous id ("client mints, server persists")
164
152
 
165
153
  `createServerPersistedAnonymousId` (`@codefast/tracking/client/server-persisted-anonymous-id`) mints a UUID cookie
166
- lazily — only once an event is actually allowed to send — and asks the server to re-issue
167
- it via `Set-Cookie`, which escapes Safari ITP's 7-day cap on script-written cookies. The
168
- server half is one line per endpoint with `setAnonymousIdResponseCookie` /
169
- `clearAnonymousIdResponseCookie` (`@codefast/tracking/adapters/tanstack-start`); both validate the
170
- id is exactly UUID-shaped, so a public endpoint can never echo attacker input into a
171
- response header.
154
+ lazily — only once an event is actually allowed to send — and asks the server to re-issue it via `Set-Cookie`, which
155
+ escapes Safari ITP's 7-day cap on script-written cookies. The server half is one line per endpoint with
156
+ `setAnonymousIdResponseCookie` / `clearAnonymousIdResponseCookie` (`@codefast/tracking/adapters/tanstack-start`); both
157
+ validate the id is exactly UUID-shaped, so a public endpoint can never echo attacker input into a response header.
172
158
 
173
159
  ## Google tag (advanced Consent Mode)
174
160
 
175
161
  `<GtagConsentBootstrap config={consentConfig} defaultConsent={...} gaMeasurementId="G-…" />`
176
- (`@codefast/tracking/react/use-initial-consent`) renders the pre-hydration inline script: Consent Mode v2
177
- `default` first (stored decision wins over the baked fallback), then gtag.js always loads
178
- so cookieless pings and consent modeling can run even when storage is denied. Page views
179
- are gtag's own job (`config` + Enhanced Measurement) — the destination only forwards
180
- catalog events. Runtime changes go through `useGoogleConsentSync`/`updateGoogleConsent`.
162
+ (`@codefast/tracking/react/use-initial-consent`) renders the pre-hydration inline script: Consent Mode v2 `default`
163
+ first (stored decision wins over the baked fallback), then gtag.js always loads so cookieless pings and consent modeling
164
+ can run even when storage is denied. Page views are gtag's own job (`config` + Enhanced Measurement) — the destination
165
+ only forwards catalog events. Runtime changes go through `useGoogleConsentSync`/`updateGoogleConsent`.
181
166
 
182
167
  ## Keeping server-only subpaths out of client bundles
183
168
 
184
- `./server` and `./adapters/tanstack-start` must never enter a client bundle. On TanStack Start,
185
- spread the package's own deny-list into the plugin's import-protection so it versions
186
- with the package instead of going stale in your config:
169
+ `./server` and `./adapters/tanstack-start` must never enter a client bundle. On TanStack Start, spread the package's own
170
+ deny-list into the plugin's import-protection so it versions with the package instead of going stale in your config:
187
171
 
188
172
  ```ts
189
173
  import { SERVER_ONLY_SUBPATHS } from "@codefast/tracking/tooling/import-protection";
@@ -195,15 +179,14 @@ tanstackStart({
195
179
  });
196
180
  ```
197
181
 
198
- A violation is mocked with a console diagnostic in dev and fails the build in prod, with
199
- a trace of the offending import chain.
182
+ A violation is mocked with a console diagnostic in dev and fails the build in prod, with a trace of the offending import
183
+ chain.
200
184
 
201
185
  ## Reference consumer
202
186
 
203
187
  [`apps/ui` (`src/features/tracking/`)](https://github.com/codefastlabs/codefast/tree/main/apps/ui/src/features/tracking)
204
- in this repo wires everything above on a real ISR-deployed TanStack Start site — consent
205
- config + runtime, banner + persistent toggle, gtag bootstrap, durable anonymous id, and
206
- the private server-function consent lane.
188
+ in this repo wires everything above on a real ISR-deployed TanStack Start site — consent config + runtime, banner +
189
+ persistent toggle, gtag bootstrap, durable anonymous id, and the private server-function consent lane.
207
190
 
208
191
  ## License
209
192
 
@@ -8,7 +8,7 @@ import type { ConsentDecision } from "#/core/consent";
8
8
  export type ConsentReceiptEventType = "give" | "update" | "withdraw";
9
9
  /**
10
10
  * How the decision was expressed — the "how" dimension a demonstrable-consent record must
11
- * capture (GDPR Art. 7(1); EDPB 05/2020 §5.1). See spec/spec-consent-receipts.md.
11
+ * capture (GDPR Art. 7(1); EDPB 05/2020 §5.1).
12
12
  *
13
13
  * @since 1.0.0-canary.7
14
14
  */
@@ -1 +1 @@
1
- {"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../../src/core/cookie.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,QAAqB,CAAC;AAEtD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAc/G"}
1
+ {"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../../src/core/cookie.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAA2B,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAc/G"}
@@ -1 +1 @@
1
- {"version":3,"file":"cookie.js","sourceRoot":"","sources":["../../src/core/cookie.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,YAAuC,EAAE,UAAkB;IACzF,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3C,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAEzC,IAAI,cAAc,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,IAAI,EAAE,KAAK,UAAU,EAAE,CAAC;YACjF,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
1
+ {"version":3,"file":"cookie.js","sourceRoot":"","sources":["../../src/core/cookie.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAW,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,YAAuC,EAAE,UAAkB;IACzF,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3C,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAEzC,IAAI,cAAc,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,IAAI,EAAE,KAAK,UAAU,EAAE,CAAC;YACjF,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -9,8 +9,9 @@
9
9
  * browser-side surface (tracker, consent runtime, React bindings, client destinations).
10
10
  * Server-only lanes are their own subpaths and never belong here — `@codefast/tracking/server/*`
11
11
  * and `@codefast/tracking/adapters/*` (deny them in the client environment via
12
- * `SERVER_ONLY_SUBPATHS`). The Vercel destination stays on `@codefast/tracking/destinations/
13
- * vercel-analytics` so its `@vercel/analytics` peer is only pulled in when used.
12
+ * `SERVER_ONLY_SUBPATHS`). The Vercel destination stays on
13
+ * `@codefast/tracking/destinations/vercel-analytics` so its `@vercel/analytics` peer is only
14
+ * pulled in when used.
14
15
  */
15
16
  export type { ConsentCategory, ConsentDecision, ConsentMode, ConsentRecord, ConsentRegion, ConsentStorage, InitialConsent, ResolveDefaultConsentOptions, ResolveEffectiveConsentOptions, } from "#/core/consent";
16
17
  export { CONSENT_CATEGORIES, CONSENT_REGIONS, createConsentDecision, isConsentDecision, isConsentRecord, isConsentRegion, isInitialConsent, normalizeConsentDecision, readStoredDecision, resolveConsentMode, resolveDefaultConsent, resolveEffectiveConsent, STRICTEST_INITIAL_CONSENT, } from "#/core/consent";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,YAAY,EACV,eAAe,EACf,eAAe,EACf,WAAW,EACX,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,YAAY,EACV,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,kCAAkC,EAAE,MAAM,+BAA+B,CAAC;AACrH,OAAO,EAAE,SAAS,EAAE,SAA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AAE,MAAM,uBAAuB,CAAC;AACzG,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -9,8 +9,9 @@
9
9
  * browser-side surface (tracker, consent runtime, React bindings, client destinations).
10
10
  * Server-only lanes are their own subpaths and never belong here — `@codefast/tracking/server/*`
11
11
  * and `@codefast/tracking/adapters/*` (deny them in the client environment via
12
- * `SERVER_ONLY_SUBPATHS`). The Vercel destination stays on `@codefast/tracking/destinations/
13
- * vercel-analytics` so its `@vercel/analytics` peer is only pulled in when used.
12
+ * `SERVER_ONLY_SUBPATHS`). The Vercel destination stays on
13
+ * `@codefast/tracking/destinations/vercel-analytics` so its `@vercel/analytics` peer is only
14
+ * pulled in when used.
14
15
  */
15
16
  export { CONSENT_CATEGORIES, CONSENT_REGIONS, createConsentDecision, isConsentDecision, isConsentRecord, isConsentRegion, isInitialConsent, normalizeConsentDecision, readStoredDecision, resolveConsentMode, resolveDefaultConsent, resolveEffectiveConsent, STRICTEST_INITIAL_CONSENT, } from "#/core/consent";
16
17
  export { defineConsentConfig } from "#/core/consent-config";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAcH,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAS5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKhD,OAAO,EAAE,0BAA0B,EAAE,kBA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C;AAG3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAGzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAgB1F,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,GACd,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAGtE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAIhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAS7D,OAAO,EACL,+BAA+B,EAC/B,2BAA2B,EAC3B,gCAAgC,EAChC,UAAU,EACV,cAAc,EACd,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAOzF,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAGpG,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codefast/tracking",
3
- "version": "0.5.0-canary.9",
3
+ "version": "0.6.0",
4
4
  "description": "Consent-gated, type-safe event tracking for TanStack Start — client tracker and server consent helpers over a per-app Standard Schema event catalog",
5
5
  "keywords": [
6
6
  "analytics",
@@ -275,12 +275,12 @@
275
275
  "@standard-schema/spec": "^1.1.0"
276
276
  },
277
277
  "devDependencies": {
278
- "@tanstack/react-start": "^1.168.34",
278
+ "@tanstack/react-start": "^1.168.44",
279
279
  "@testing-library/dom": "^10.4.1",
280
- "@testing-library/jest-dom": "^7.0.0",
280
+ "@testing-library/jest-dom": "^7.0.1",
281
281
  "@testing-library/react": "^16.3.2",
282
- "@testing-library/user-event": "^14.6.1",
283
- "@types/node": "^26.1.2",
282
+ "@testing-library/user-event": "^14.6.4",
283
+ "@types/node": "^26.2.0",
284
284
  "@types/react": "^19.2.18",
285
285
  "@types/react-dom": "^19.2.4",
286
286
  "@vercel/analytics": "^2.0.1",
@@ -293,7 +293,7 @@
293
293
  "typescript": "^7.0.2",
294
294
  "vitest": "^4.1.10",
295
295
  "zod": "^4.4.3",
296
- "@codefast/typescript-config": "0.5.0-canary.9"
296
+ "@codefast/typescript-config": "0.6.0"
297
297
  },
298
298
  "peerDependencies": {
299
299
  "@tanstack/react-start": ">=1.168.0",
@@ -11,7 +11,7 @@ export type ConsentReceiptEventType = "give" | "update" | "withdraw";
11
11
 
12
12
  /**
13
13
  * How the decision was expressed — the "how" dimension a demonstrable-consent record must
14
- * capture (GDPR Art. 7(1); EDPB 05/2020 §5.1). See spec/spec-consent-receipts.md.
14
+ * capture (GDPR Art. 7(1); EDPB 05/2020 §5.1).
15
15
  *
16
16
  * @since 1.0.0-canary.7
17
17
  */
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @since 1.0.0-canary.6
5
5
  */
6
- export const ONE_YEAR_IN_SECONDS = 60 * 60 * 24 * 365;
6
+ export const ONE_YEAR_IN_SECONDS: number = 60 * 60 * 24 * 365;
7
7
 
8
8
  /**
9
9
  * The value of `cookieName` inside a cookie string — a request `Cookie` header or
package/src/index.ts CHANGED
@@ -9,11 +9,12 @@
9
9
  * browser-side surface (tracker, consent runtime, React bindings, client destinations).
10
10
  * Server-only lanes are their own subpaths and never belong here — `@codefast/tracking/server/*`
11
11
  * and `@codefast/tracking/adapters/*` (deny them in the client environment via
12
- * `SERVER_ONLY_SUBPATHS`). The Vercel destination stays on `@codefast/tracking/destinations/
13
- * vercel-analytics` so its `@vercel/analytics` peer is only pulled in when used.
12
+ * `SERVER_ONLY_SUBPATHS`). The Vercel destination stays on
13
+ * `@codefast/tracking/destinations/vercel-analytics` so its `@vercel/analytics` peer is only
14
+ * pulled in when used.
14
15
  */
15
16
 
16
- // ── Core (isomorphic) ───────────────────────────────────────────────────────────────
17
+ // ── Core (isomorphic) ────────────────────────────────────────────────────────────────────────────────────────────────
17
18
  export type {
18
19
  ConsentCategory,
19
20
  ConsentDecision,
@@ -64,7 +65,7 @@ export { generateEventId } from "#/core/event-id";
64
65
 
65
66
  export type { TrackedEvent } from "#/core/tracked-event";
66
67
 
67
- // ── Client ──────────────────────────────────────────────────────────────────────────
68
+ // ── Client ───────────────────────────────────────────────────────────────────────────────────────────────────────────
68
69
  export type { CmpConsentSignal, CmpStatus, ReconcileAdFrameworkConsentOptions } from "#/client/ad-framework-consent";
69
70
  export { hasGppApi, hasTcfApi, reconcileAdFrameworkConsent } from "#/client/ad-framework-consent";
70
71
 
@@ -97,7 +98,7 @@ export { createIsAnalyticsAllowed } from "#/client/is-analytics-allowed";
97
98
  export type { ServerPersistedAnonymousIdOptions } from "#/client/server-persisted-anonymous-id";
98
99
  export { createServerPersistedAnonymousId } from "#/client/server-persisted-anonymous-id";
99
100
 
100
- // ── React ───────────────────────────────────────────────────────────────────────────
101
+ // ── React ────────────────────────────────────────────────────────────────────────────────────────────────────────────
101
102
  export type {
102
103
  ConsentBannerAcceptProps,
103
104
  ConsentBannerActionsProps,
@@ -136,7 +137,7 @@ export { useGoogleConsentSync } from "#/react/use-google-consent-sync";
136
137
 
137
138
  export { useInitialConsent } from "#/react/use-initial-consent";
138
139
 
139
- // ── Destinations (client-lane; Vercel stays on its own subpath) ───────────────────────
140
+ // ── Destinations (client-lane; Vercel stays on its own subpath) ──────────────────────────────────────────────────────
140
141
  export type { AdConsentState } from "#/destinations/ad-consent";
141
142
  export { toAdConsentState } from "#/destinations/ad-consent";
142
143