@revturbine/sdk 0.9.3 → 0.10.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist/headless.d.ts +749 -88
  3. package/dist/headless.js +2 -2
  4. package/dist/headless.js.map +1 -1
  5. package/dist/index.d.ts +750 -89
  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 +94 -22
  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,75 @@ 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.0
44
+
45
+ ### `publicKey` is the browser credential; `apiKey` is the server key
46
+
47
+ **What changed.** The browser init option for the ingest (public) key is
48
+ `publicKey` — on `initRevTurbine`, `<RevTurbineProvider options>`, and the
49
+ headless init alike. Every browser bearer (ingest, launched-Playbook delivery,
50
+ user context, branding, trial status) uses that one key. `apiKey` now means
51
+ one thing everywhere: the secret **server key**, as it always did on
52
+ `@revturbine/sdk/server` — pass it from backend code only (a route handler
53
+ using `@revturbine/sdk/headless` keeps using `apiKey`). The name states what the
54
+ credential is at the call site: a security scanner or an agent that meets
55
+ `publicKey` in a bundle knows it belongs there, where `apiKey` reads as a leak.
56
+
57
+ `apiKey` and `ingestPublicKey` are still accepted on a browser init as aliases
58
+ of `publicKey` for one minor (precedence: `publicKey`, then `ingestPublicKey`,
59
+ then `apiKey`). Using an alias without `publicKey` in a browser logs a one-time
60
+ development warning naming `publicKey`; production builds are silent. On the
61
+ browser `RevTurbineInitOptions` type, `apiKey` is now optional (it was required)
62
+ and `ingestPublicKey` is `@deprecated`. Keyless local-only init is unchanged,
63
+ and the plan 95 anonymous `sdk_init` beacon still fires only when no public key
64
+ (`publicKey` or `ingestPublicKey`) was supplied.
65
+
66
+ Ruling: Kent, 2026-09-21, devkit PR #808 (closed).
67
+
68
+ **Landed in** `0.10.0`. **Fail-closed in** not yet — the aliases are removed one
69
+ minor later; until then the old shape works and warns.
70
+
71
+ **Proving test:** `web-sdk/public-key-option.test.ts` — precedence, the single
72
+ bearer across ingest and control-plane fetches, the browser-only warning, and
73
+ the keyless local-only init. Type-level: `web-sdk/init-options-exactness.test-d.ts`
74
+ accepts `publicKey` and rejects the `publickey` casing typo.
75
+
76
+ ### `endpoint` and `mode` are optional on `initRevTurbine` and `<RevTurbineProvider>`
77
+
78
+ **What changed.** `RevTurbineInitOptions.endpoint` defaults to
79
+ `https://revturbine.com/app` (`DEFAULT_HOSTED_ENDPOINT`, exported) and
80
+ `RevTurbineInitOptions.mode` defaults to `'snippet'` (`DEFAULT_SDK_MODE`,
81
+ exported); `<RevTurbineProvider>` passes `'react'` when the app does not set it.
82
+ Both were required; `mode` only ever labelled telemetry (`page_view.mode` and a
83
+ diagnostics message), and every hosted integration used the same endpoint.
84
+ Existing calls that pass them are unchanged. Local mode is unchanged (its
85
+ placeholder defaults already applied). Additive, no version bump required.
86
+
87
+ **Landed in** `0.10.0`. **Fail-closed in** n/a — nothing old is rejected.
88
+
89
+ **Proving test:** `web-sdk/public-init.test.ts` — "defaults endpoint and mode
90
+ for a hosted init that omits them".
91
+
92
+ ### Reason-code compatibility verification
93
+
94
+ Added a reviewed baseline for 27 entitlement and 21 placement reason values,
95
+ checked against live SDK/core fixtures. Removal/rename controls exercise every
96
+ protected value, and baseline changes require this changelog to change through
97
+ the existing public-API gate. Custom provider reasons remain extensible and
98
+ free-form diagnostics are excluded. This adds verification only; no runtime
99
+ reason values or package versions change.
100
+
101
+ Proving tests: `web-sdk/reason-contract.test.ts` and
102
+ `web-sdk/reason-contract-policy.test.ts`. The intentional-change procedure is
103
+ in `docs/reason-code-contract.md`.
104
+
38
105
  ## 0.9.3
39
106
 
40
107
  ### Fixed