@revturbine/sdk 0.9.3 → 0.10.1

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/dist/headless.d.ts +772 -89
  3. package/dist/headless.js +2 -2
  4. package/dist/headless.js.map +1 -1
  5. package/dist/index.d.ts +773 -90
  6. package/dist/index.js +2 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/types/server-node/client.d.ts +1 -1
  9. package/dist/types/server-node/client.d.ts.map +1 -1
  10. package/dist/types/server-node/local-server.d.ts.map +1 -1
  11. package/dist/types/server-node/types.d.ts +8 -1
  12. package/dist/types/server-node/types.d.ts.map +1 -1
  13. package/dist/types/web-sdk/analytics.d.ts +2 -2
  14. package/dist/types/web-sdk/analytics.d.ts.map +1 -1
  15. package/dist/types/web-sdk/controllers.d.ts +3 -3
  16. package/dist/types/web-sdk/controllers.d.ts.map +1 -1
  17. package/dist/types/web-sdk/customer-side.d.ts +117 -23
  18. package/dist/types/web-sdk/customer-side.d.ts.map +1 -1
  19. package/dist/types/web-sdk/headless.d.ts +1 -1
  20. package/dist/types/web-sdk/index.d.ts +1 -1
  21. package/dist/types/web-sdk/react/EngagementArea.d.ts.map +1 -1
  22. package/dist/types/web-sdk/react/RevTurbineProvider.d.ts +1 -1
  23. package/dist/types/web-sdk/react/RevTurbineProvider.d.ts.map +1 -1
  24. package/dist/types/web-sdk/react/Track.d.ts.map +1 -1
  25. package/dist/types/web-sdk/react/TrackOnView.d.ts.map +1 -1
  26. package/dist/types/web-sdk/react/useGatedAction.d.ts.map +1 -1
  27. package/dist/types/web-sdk/react/useTrack.d.ts.map +1 -1
  28. package/dist/types/web-sdk/react/useTrackedAction.d.ts.map +1 -1
  29. package/dist/types/web-sdk/telemetry/dom-capture.d.ts.map +1 -1
  30. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -33,8 +33,117 @@ the old shape was accepted and did nothing. Those windows are the expensive ones
33
33
  > **minor** position (`0.6.0` → `0.7.0`), not the major. `npm`'s caret on a `0.x`
34
34
  > range does **not** span minors, so `^0.7.0` will not silently pull `0.8.0`.
35
35
 
36
+ Built-in decision reason values have a separate reviewed
37
+ [compatibility baseline](docs/reason-code-contract.md). Live fixture checks
38
+ protect those values independently of `@public` method tags; baseline changes
39
+ also require a changelog entry.
40
+
36
41
  ---
37
42
 
43
+ ## 0.10.1
44
+
45
+ ### Treatment interactions carry the identified `account_id`
46
+
47
+ **What changed.** Every treatment interaction the SDK sends to
48
+ `/api/events/interactions` — the impression that writes a
49
+ `placement_presentations` row, plus dismiss / click / conversion — now carries
50
+ `account_id`, taken from the account the integration identified
51
+ (`identify(userId, { account_id })` / `setUserContext`). It was never sent at
52
+ all, so the ingest route's `account_id ?? user_id` fallback stamped a **user**
53
+ id into an **account** column. `placement_presentations.account_id` is a join
54
+ key, not a label: `monetization_funnel` matches it against account ids from
55
+ `events_clickstream` / `events_billing`, and every experiment summary pipe
56
+ reads it when `analysis_unit='account'`. Those joins therefore matched only
57
+ where a user id happened to equal an account id — and an account-grain
58
+ experiment readout returned the user-grain n while looking perfectly valid.
59
+
60
+ Two details make it a usable key. The value is PII-redacted **identically to
61
+ `/api/track`**, so an email-shaped account id becomes the same hash in
62
+ `placement_presentations` and in `events_clickstream` and the funnel actually
63
+ joins. And when no account was identified the field is **omitted**, never set
64
+ to the user id — the route keeps its own fallback for SDKs that have not
65
+ upgraded, but a wrong join key is worse than a missing one.
66
+
67
+ No public API change: nothing new is asked of the caller, and
68
+ `RevTurbineTreatmentInteractionInput` is unchanged. Integrations that already
69
+ pass `account_id` to `identify()` get correct account-grain analytics with no
70
+ code change; integrations that never identify an account are unaffected on the
71
+ wire and see the same route-side fallback as before.
72
+
73
+ **Landed in** `0.10.1`. **Fail-closed in** n/a — additive; nothing old is
74
+ rejected.
75
+
76
+ **Proving test:** `web-sdk/interaction-wire-contract.test.ts` — "the account
77
+ identity the analytics joins key on": the identified account reaches the wire
78
+ distinct from `user_id`, an unidentified one is omitted rather than copied from
79
+ `user_id`, an email-shaped account id matches the `/api/track` lane
80
+ byte-for-byte, and a re-queued batch keeps the account that was acting when
81
+ each interaction happened.
82
+
83
+ ---
84
+
85
+ ## 0.10.0
86
+
87
+ ### `publicKey` is the browser credential; `apiKey` is the server key
88
+
89
+ **What changed.** The browser init option for the ingest (public) key is
90
+ `publicKey` — on `initRevTurbine`, `<RevTurbineProvider options>`, and the
91
+ headless init alike. Every browser bearer (ingest, launched-Playbook delivery,
92
+ user context, branding, trial status) uses that one key. `apiKey` now means
93
+ one thing everywhere: the secret **server key**, as it always did on
94
+ `@revturbine/sdk/server` — pass it from backend code only (a route handler
95
+ using `@revturbine/sdk/headless` keeps using `apiKey`). The name states what the
96
+ credential is at the call site: a security scanner or an agent that meets
97
+ `publicKey` in a bundle knows it belongs there, where `apiKey` reads as a leak.
98
+
99
+ `apiKey` and `ingestPublicKey` are still accepted on a browser init as aliases
100
+ of `publicKey` for one minor (precedence: `publicKey`, then `ingestPublicKey`,
101
+ then `apiKey`). Using an alias without `publicKey` in a browser logs a one-time
102
+ development warning naming `publicKey`; production builds are silent. On the
103
+ browser `RevTurbineInitOptions` type, `apiKey` is now optional (it was required)
104
+ and `ingestPublicKey` is `@deprecated`. Keyless local-only init is unchanged,
105
+ and the plan 95 anonymous `sdk_init` beacon still fires only when no public key
106
+ (`publicKey` or `ingestPublicKey`) was supplied.
107
+
108
+ Ruling: Kent, 2026-09-21, devkit PR #808 (closed).
109
+
110
+ **Landed in** `0.10.0`. **Fail-closed in** not yet — the aliases are removed one
111
+ minor later; until then the old shape works and warns.
112
+
113
+ **Proving test:** `web-sdk/public-key-option.test.ts` — precedence, the single
114
+ bearer across ingest and control-plane fetches, the browser-only warning, and
115
+ the keyless local-only init. Type-level: `web-sdk/init-options-exactness.test-d.ts`
116
+ accepts `publicKey` and rejects the `publickey` casing typo.
117
+
118
+ ### `endpoint` and `mode` are optional on `initRevTurbine` and `<RevTurbineProvider>`
119
+
120
+ **What changed.** `RevTurbineInitOptions.endpoint` defaults to
121
+ `https://revturbine.com/app` (`DEFAULT_HOSTED_ENDPOINT`, exported) and
122
+ `RevTurbineInitOptions.mode` defaults to `'snippet'` (`DEFAULT_SDK_MODE`,
123
+ exported); `<RevTurbineProvider>` passes `'react'` when the app does not set it.
124
+ Both were required; `mode` only ever labelled telemetry (`page_view.mode` and a
125
+ diagnostics message), and every hosted integration used the same endpoint.
126
+ Existing calls that pass them are unchanged. Local mode is unchanged (its
127
+ placeholder defaults already applied). Additive, no version bump required.
128
+
129
+ **Landed in** `0.10.0`. **Fail-closed in** n/a — nothing old is rejected.
130
+
131
+ **Proving test:** `web-sdk/public-init.test.ts` — "defaults endpoint and mode
132
+ for a hosted init that omits them".
133
+
134
+ ### Reason-code compatibility verification
135
+
136
+ Added a reviewed baseline for 27 entitlement and 21 placement reason values,
137
+ checked against live SDK/core fixtures. Removal/rename controls exercise every
138
+ protected value, and baseline changes require this changelog to change through
139
+ the existing public-API gate. Custom provider reasons remain extensible and
140
+ free-form diagnostics are excluded. This adds verification only; no runtime
141
+ reason values or package versions change.
142
+
143
+ Proving tests: `web-sdk/reason-contract.test.ts` and
144
+ `web-sdk/reason-contract-policy.test.ts`. The intentional-change procedure is
145
+ in `docs/reason-code-contract.md`.
146
+
38
147
  ## 0.9.3
39
148
 
40
149
  ### Fixed