@revturbine/sdk 0.2.81 → 0.2.82

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.
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type RevTurbineInitInputOptions, type RevTurbinePlacementConfig, type RevTurbinePlacementDecisionInput } from '../customer-side';
2
+ import { type RevTurbineInitInputOptions, type RevTurbinePlacementConfig, type RevTurbinePlacementDecisionInput, type ServerEvaluationHydrationPayload } from '../customer-side';
3
3
  import { type AnnotatedCaptureOptions } from '../telemetry';
4
4
  type BootstrapPlacementInput = Omit<RevTurbinePlacementDecisionInput, 'placementId'> & {
5
5
  placement: RevTurbinePlacementConfig;
@@ -19,6 +19,34 @@ export type RevTurbineProviderProps = {
19
19
  * Omit to disable. Memoize an object value to avoid re-installing.
20
20
  */
21
21
  domCapture?: boolean | AnnotatedCaptureOptions;
22
+ /**
23
+ * A server-evaluated payload to hydrate the SDK from (plan 186 TASK-2).
24
+ *
25
+ * Produced by the server SDK — `RevTurbineServer.evaluate()` or
26
+ * `LocalEvaluationServer.evaluate()` — and serialized into page props / RSC
27
+ * props. Applied synchronously the moment the SDK instance exists, before any
28
+ * awaited init work, so the decisions and entitlements it carries are already
29
+ * cached the first time a gate reads them. Without it, a server-rendered app
30
+ * evaluates once on the server and then re-evaluates from scratch on the
31
+ * client.
32
+ *
33
+ * Carries no credential — it is built for browser delivery. A malformed or
34
+ * unknown-version payload is logged and skipped rather than thrown: hydration
35
+ * is an optimization, so a bad payload degrades to normal client-side
36
+ * evaluation instead of breaking the provider.
37
+ *
38
+ * Re-hydrates when the payload's identity changes (e.g. a server navigation
39
+ * supplies a fresh one), so a provider mounted in a root layout stays current
40
+ * without remounting. Memoize a value you rebuild every render.
41
+ *
42
+ * @example
43
+ * ```tsx
44
+ * // app/layout.tsx (Server Component)
45
+ * const payload = await server.evaluate({ userId, placements: [{ slotId: 'hero' }] });
46
+ * return <RevTurbineProvider options={options} serverPayload={payload}>{children}</RevTurbineProvider>;
47
+ * ```
48
+ */
49
+ serverPayload?: ServerEvaluationHydrationPayload;
22
50
  /** React children. */
23
51
  children: React.ReactNode;
24
52
  };
@@ -37,6 +65,6 @@ export type RevTurbineProviderProps = {
37
65
  * </RevTurbineProvider>
38
66
  * ```
39
67
  */
40
- export declare function RevTurbineProvider({ options, bootstrapPlacements, domCapture, children }: RevTurbineProviderProps): React.JSX.Element;
68
+ export declare function RevTurbineProvider({ options, bootstrapPlacements, domCapture, serverPayload, children }: RevTurbineProviderProps): React.JSX.Element;
41
69
  export {};
42
70
  //# sourceMappingURL=RevTurbineProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RevTurbineProvider.d.ts","sourceRoot":"","sources":["../../../../react/RevTurbineProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,EAItC,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EAA2B,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAIrF,KAAK,uBAAuB,GAAG,IAAI,CAAC,gCAAgC,EAAE,aAAa,CAAC,GAAG;IACrF,SAAS,EAAE,yBAAyB,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,wEAAwE;IACxE,OAAO,EAAE,0BAA0B,CAAC;IACpC,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAChD;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAC;IAC/C,sBAAsB;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AASF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,uBAAuB,qBAuKjH"}
1
+ {"version":3,"file":"RevTurbineProvider.d.ts","sourceRoot":"","sources":["../../../../react/RevTurbineProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,EAErC,KAAK,gCAAgC,EAGtC,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EAA2B,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAIrF,KAAK,uBAAuB,GAAG,IAAI,CAAC,gCAAgC,EAAE,aAAa,CAAC,GAAG;IACrF,SAAS,EAAE,yBAAyB,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,wEAAwE;IACxE,OAAO,EAAE,0BAA0B,CAAC;IACpC,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAChD;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAC;IAC/C;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,aAAa,CAAC,EAAE,gCAAgC,CAAC;IACjD,sBAAsB;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAgCF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,uBAAuB,qBAoMhI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revturbine/sdk",
3
- "version": "0.2.81",
3
+ "version": "0.2.82",
4
4
  "description": "RevTurbine customer-facing SDK — placement decisioning, entitlement checks, and usage tracking.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.12.0",