@revturbine/sdk 0.11.11 → 0.11.13

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
@@ -47,6 +47,92 @@ also require a changelog entry.
47
47
 
48
48
  ---
49
49
 
50
+ ## 0.11.13
51
+
52
+ ### Slot lifecycle events carry the slot's `route` (BL-0207, ruling D-30)
53
+
54
+ **What changed.** Every slot lifecycle event (`slot_evaluated`, `slot_filled`,
55
+ `slot_empty`, `slot_suppressed`, `slot_error`) now carries `route`: the app
56
+ route the slot rendered on. Ingestion-driven surface-slot discovery reads it
57
+ and persists it on the discovered slot. There is no SDK write to any CRUD
58
+ route. The field is additive and optional in the scaffold contract
59
+ (`slotContextBase.route`).
60
+
61
+ A route is a **path, never a URL**. It has no origin, query string or
62
+ fragment. The React layer computes it at emission time:
63
+
64
+ - **Default:** `window.location.pathname`, with identifier-like segments
65
+ templated to `:id`. That covers numbers, UUIDs, long hex, prefixed ids like
66
+ `cus_…`, long opaque tokens and email-shaped values, raw or
67
+ percent-encoded. For example, `/accounts/4821/billing?coupon=X` reports
68
+ `/accounts/:id/billing`.
69
+ - **`<RevTurbineRoute route={…}>`** (new, renderless) declares the framework
70
+ route pattern for its subtree, and the innermost boundary wins.
71
+ - **Next.js App Router:** build the pattern with the new pure helper
72
+ `routePatternFromParams(usePathname(), useParams())`, which gives
73
+ `/projects/[projectId]/settings`. The SDK does not import `next/navigation`.
74
+
75
+ Also new:
76
+
77
+ - **Headless exports:** `normalizeSlotRoute`, `routePatternFromParams`,
78
+ `currentBrowserRoute`, `isIdentifierLikeSegment` and `SLOT_ROUTE_MAX_LENGTH`
79
+ (512).
80
+ - **React hook:** `useSlotRoute()`.
81
+ - **Headless controller option:** `PlacementControllerOptions.route` accepts a
82
+ string or a getter. When it is omitted, a headless controller emits
83
+ `route: null`.
84
+
85
+ **Landed in:** 0.11.13 (`web-sdk` only; `server-python`/`server-rust` bumped
86
+ in lockstep with no behavior change — no port emits slot events). The
87
+ `@revt-eng/*` pins move to `0.1.366` (the scaffold contract: `slotContextBase.route`,
88
+ `SurfaceSlotSchema.route`, and the `SurfaceSlotStatus` = `live | idle`
89
+ vocabulary), and the vendored port types are re-synced — `SurfaceSlot.status`
90
+ is now `SurfaceSlotStatus` (`live`/`idle`, default `idle`) in both ports.
91
+ **Fail-closed in:** n/a (additive telemetry field).
92
+ **Proving test:**
93
+ - `web-sdk/slot-route.test.ts`: normalization, PII/query stripping, the
94
+ Next.js params recipe, and controller emission including the
95
+ throwing-getter case.
96
+ - `web-sdk/react/usePlacement.route.test.tsx`: the plain-DOM pathname case and
97
+ the `<RevTurbineRoute>` Next.js pattern case.
98
+
99
+ ## 0.11.12
100
+
101
+ ### `builtin_dimensions` now reaches the browser SDK from the client-context fetch (BL-0312, plan 279 TASK-5)
102
+
103
+ **What changed.** `0.11.11` (BL-0310/BL-0311) taught the shared evaluator to
104
+ stamp `rt_<dimension>` segment traits from a `builtin_dimensions` object on the
105
+ user context, but nothing yet delivered that object into `web-sdk`'s held
106
+ context. `fetchClientContext` (`GET /api/sdk/client-context`) now maps the
107
+ response's `builtin_dimensions` onto `RevTurbineUserContext.builtin_dimensions`,
108
+ overlaying per leaf the same way it overlays `plan_handle`: a leaf the server
109
+ evaluated on this fetch replaces the held value; a leaf it did not evaluate
110
+ leaves whatever the app (or a prior fetch) had set untouched. A leaf absent on
111
+ both sides stays absent — unknown is trait absence (plan 255), never a
112
+ sentinel.
113
+
114
+ The hash-skip that decides whether a fetch actually changed anything and
115
+ should re-apply (and so re-evaluate segments) now accounts for
116
+ `builtin_dimensions`. This surfaced a real gap: the shared
117
+ `computeUserContextHash` helper re-projects its input to a fixed key set
118
+ (`plan_handle`, `plan`, `usage`, `custom`, `trial`, `instances`) and silently
119
+ drops anything outside it, so simply adding `builtin_dimensions` to the object
120
+ passed to it was a no-op. `builtin_dimensions` is folded into the skip key as
121
+ a literal suffix instead — the same technique already used for the coarse
122
+ `payment_at_risk` signal, which has the identical problem.
123
+
124
+ **Landed in:** 0.11.12 (`web-sdk` only; `server-python`/`server-rust` bumped
125
+ in lockstep with no behavior change — the ports have no client-context fetch
126
+ of their own and resolve built-ins only from an app-supplied
127
+ `builtin_dimensions`, per plan 279's TASK-17 backlog note).
128
+ **Fail-closed in:** 0.11.12. Before this release, a client-context response
129
+ that changed only `builtin_dimensions` was hash-skipped and segments never
130
+ re-evaluated against the new value.
131
+ **Proving test:** `web-sdk/customer-side-client-context.test.ts`, describe
132
+ block `builtin_dimensions (plan 279 AC-4)` — server-overlays-app, an
133
+ unevaluated leaf survives, a changed value re-applies (new context object),
134
+ an unchanged value does not.
135
+
50
136
  ## 0.11.11
51
137
 
52
138
  ### Built-in segment dimensions: reserved `rt_*` segment traits (BL-0310/BL-0311, plan 279 TASK-3/TASK-4)
@@ -226,11 +226,11 @@ declare const UserPlanContextSchema: z.ZodObject<{
226
226
  */
227
227
  declare const UserBuiltinDimensionsSchema: z.ZodObject<{
228
228
  activity_level: z.ZodOptional<z.ZodEnum<{
229
- inactive: "inactive";
230
229
  new: "new";
231
230
  high: "high";
232
231
  medium: "medium";
233
232
  low: "low";
233
+ inactive: "inactive";
234
234
  }>>;
235
235
  subscription_state: z.ZodOptional<z.ZodEnum<{
236
236
  trial: "trial";