@revturbine/sdk 0.9.1 → 0.9.3

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
@@ -35,6 +35,29 @@ the old shape was accepted and did nothing. Those windows are the expensive ones
35
35
 
36
36
  ---
37
37
 
38
+ ## 0.9.3
39
+
40
+ ### Fixed
41
+
42
+ - Placement explanations use the same published segment-eligibility helper as
43
+ decisions, keeping OR-within-segments and AND-with-plan behavior aligned.
44
+ The explanation/decision matrix covers local and provider-backed Playbooks,
45
+ unknown or missing segments, exact handle matching and plan-filter combinations.
46
+
47
+ ## 0.9.2
48
+
49
+ ### Public initializer user context
50
+
51
+ `await initRevTurbine({ user: { id, ...context }, ...options })` from
52
+ `@revturbine/sdk` or `@revturbine/sdk/headless` now passes `id` only as the
53
+ identity argument. Supported user context retains its existing behavior without
54
+ the spurious unrecognized-context-key warning for `id`; genuinely unknown keys
55
+ still warn. Public quick starts now show the awaited `SdkSession` and
56
+ `session.sdk.getBranding()`. The separate synchronous core initializer is unchanged.
57
+
58
+ Proving tests: `web-sdk/public-init.test.ts` and the installed public-package
59
+ runtime/type examples in `web-sdk/scripts/check-public-diagnostics.mjs`.
60
+
38
61
  ## 0.9.1
39
62
 
40
63
  ### Public changelog distribution
@@ -19260,7 +19260,7 @@ type ExportedConfigProvider = RevTurbineConfigProvider;
19260
19260
  * ```ts
19261
19261
  * import { initRevTurbine } from '@revturbine/sdk';
19262
19262
  *
19263
- * const sdk = initRevTurbine({
19263
+ * const session = await initRevTurbine({
19264
19264
  * tenantId: 'tenant_abc',
19265
19265
  * apiKey: 'rt_live_xxx',
19266
19266
  * endpoint: 'https://edge.example.com',
@@ -20111,15 +20111,17 @@ declare const EMITTABLE_PLATFORM_EVENT_NAMES: readonly string[];
20111
20111
  *
20112
20112
  * @example
20113
20113
  * ```ts
20114
- * const sdk = initRevTurbine({
20114
+ * import { initRevTurbine } from '@revturbine/sdk';
20115
+ *
20116
+ * const session = await initRevTurbine({
20115
20117
  * tenantId: 'tenant_abc',
20116
20118
  * apiKey: 'rt_live_xxx',
20117
20119
  * endpoint: 'https://edge.example.com',
20118
20120
  * mode: 'react',
20119
20121
  * });
20120
20122
  *
20121
- * sdk.identify('user_123', { plan: 'pro' });
20122
- * const decision = await sdk.getPlacementDecision({ placementId, userId: 'user_123' });
20123
+ * session.identify('user_123', { plan_handle: 'pro' });
20124
+ * const branding = session.sdk.getBranding();
20123
20125
  * ```
20124
20126
  */
20125
20127
  declare class RevTurbineCustomerSdk {
@@ -20830,8 +20832,8 @@ declare class RevTurbineCustomerSdk {
20830
20832
  * @example
20831
20833
  * ```ts
20832
20834
  * // In your React component / page hydration:
20833
- * const sdk = initRevTurbine({ tenantId, apiKey, endpoint, mode: 'react' });
20834
- * sdk.hydrate(serverPayload);
20835
+ * const session = await initRevTurbine({ tenantId, apiKey, endpoint, mode: 'react' });
20836
+ * session.sdk.hydrate(serverPayload);
20835
20837
  * ```
20836
20838
  */
20837
20839
  hydrate(payload: ServerEvaluationHydrationPayload): void;
@@ -21392,19 +21394,18 @@ declare class RevTurbineCustomerSdk {
21392
21394
  }): void;
21393
21395
  }
21394
21396
  /**
21395
- * Initialize the RevTurbine SDK.
21397
+ * Initialize the synchronous RevTurbine core SDK.
21396
21398
  *
21397
- * This is the primary entry point for browser integration.
21398
- * Also available as `window.RevTurbine.init()` for non-module environments.
21399
+ * Available as `window.RevTurbine.init()` for non-module environments.
21400
+ * The package entrypoints expose the asynchronous session initializer instead:
21401
+ * `const session = await initRevTurbine(options); const sdk = session.sdk;`.
21399
21402
  *
21400
21403
  * @param options - SDK initialization options
21401
21404
  * @returns A configured SDK instance
21402
21405
  *
21403
21406
  * @example
21404
21407
  * ```ts
21405
- * import { initRevTurbine } from '@revturbine/sdk';
21406
- *
21407
- * const sdk = initRevTurbine({
21408
+ * const sdk = window.RevTurbine?.init({
21408
21409
  * tenantId: 'tenant_abc',
21409
21410
  * apiKey: 'rt_live_xxx',
21410
21411
  * endpoint: 'https://edge.example.com',
@@ -21557,6 +21558,7 @@ type RevTurbineThemeInput = {
21557
21558
  * tenantId: 'tenant_abc',
21558
21559
  * apiKey: 'rt_live_xxx',
21559
21560
  * endpoint: 'https://edge.example.com',
21561
+ * mode: 'snippet',
21560
21562
  * user: { id: 'user_123', plan_handle: 'pro' },
21561
21563
  * });
21562
21564
  *
@@ -21930,6 +21932,7 @@ type SdkSessionOptions = RevTurbineInitInputOptions & {
21930
21932
  * tenantId: 'tenant_abc',
21931
21933
  * apiKey: 'rt_live_xxx',
21932
21934
  * endpoint: 'https://edge.example.com',
21935
+ * mode: 'snippet',
21933
21936
  * user: { id: 'user_123', plan_handle: 'pro' },
21934
21937
  * });
21935
21938
  *
@@ -22074,6 +22077,7 @@ declare class SdkSession {
22074
22077
  * tenantId: 'tenant_abc',
22075
22078
  * apiKey: 'rt_live_xxx',
22076
22079
  * endpoint: 'https://edge.example.com',
22080
+ * mode: 'snippet',
22077
22081
  * user: { id: 'user_123', plan_handle: 'pro' },
22078
22082
  * bootstrapPlacements: [
22079
22083
  * { placement: { name: 'pricing_banner' } },
@@ -26495,7 +26499,7 @@ declare function createBasicExperimentProvider(options: BasicBucketerOptions): E
26495
26499
  *
26496
26500
  * @example
26497
26501
  * ```ts
26498
- * import { createAnalyticsProvider } from '@revturbine/sdk';
26502
+ * import { createAnalyticsProvider, initRevTurbine } from '@revturbine/sdk';
26499
26503
  *
26500
26504
  * const analytics = createAnalyticsProvider({
26501
26505
  * handler: (eventName, properties) => {
@@ -26503,7 +26507,13 @@ declare function createBasicExperimentProvider(options: BasicBucketerOptions): E
26503
26507
  * },
26504
26508
  * });
26505
26509
  *
26506
- * initRevTurbine({ domainProviders: [analytics], ... });
26510
+ * const session = await initRevTurbine({
26511
+ * tenantId: 'tenant_abc',
26512
+ * apiKey: 'rt_live_xxx',
26513
+ * endpoint: 'https://edge.example.com',
26514
+ * mode: 'snippet',
26515
+ * domainProviders: [analytics],
26516
+ * });
26507
26517
  * ```
26508
26518
  *
26509
26519
  * @module
@@ -26647,7 +26657,13 @@ interface PostHogAnalyticsProviderOptions {
26647
26657
  * import { createPostHogAnalyticsProvider, initRevTurbine } from '@revturbine/sdk';
26648
26658
  *
26649
26659
  * const analytics = createPostHogAnalyticsProvider({ posthog });
26650
- * initRevTurbine({ domainProviders: [analytics], ... });
26660
+ * const session = await initRevTurbine({
26661
+ * tenantId: 'tenant_abc',
26662
+ * apiKey: 'rt_live_xxx',
26663
+ * endpoint: 'https://edge.example.com',
26664
+ * mode: 'snippet',
26665
+ * domainProviders: [analytics],
26666
+ * });
26651
26667
  * ```
26652
26668
  */
26653
26669
  declare function createPostHogAnalyticsProvider(options: PostHogAnalyticsProviderOptions): EventConsumerProvider;