@revturbine/sdk 0.7.13 → 0.8.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 (38) hide show
  1. package/dist/headless.d.ts +324 -54
  2. package/dist/headless.js +2 -2
  3. package/dist/headless.js.map +1 -1
  4. package/dist/index.d.ts +568 -62
  5. package/dist/index.js +2 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/types/web-sdk/config-artifact.d.ts +54 -12
  8. package/dist/types/web-sdk/config-artifact.d.ts.map +1 -1
  9. package/dist/types/web-sdk/controllers.d.ts +17 -0
  10. package/dist/types/web-sdk/controllers.d.ts.map +1 -1
  11. package/dist/types/web-sdk/customer-side.d.ts +201 -1
  12. package/dist/types/web-sdk/customer-side.d.ts.map +1 -1
  13. package/dist/types/web-sdk/headless.d.ts +1 -1
  14. package/dist/types/web-sdk/headless.d.ts.map +1 -1
  15. package/dist/types/web-sdk/placements/FixedSurfaceSlot.d.ts +14 -3
  16. package/dist/types/web-sdk/placements/FixedSurfaceSlot.d.ts.map +1 -1
  17. package/dist/types/web-sdk/placements/MessageSurfaceSlot.d.ts.map +1 -1
  18. package/dist/types/web-sdk/placements/useSurfaceSlot.d.ts +24 -0
  19. package/dist/types/web-sdk/placements/useSurfaceSlot.d.ts.map +1 -1
  20. package/dist/types/web-sdk/react/InitFailureDiagnostic.d.ts +35 -0
  21. package/dist/types/web-sdk/react/InitFailureDiagnostic.d.ts.map +1 -0
  22. package/dist/types/web-sdk/react/RevTurbineProvider.d.ts +18 -4
  23. package/dist/types/web-sdk/react/RevTurbineProvider.d.ts.map +1 -1
  24. package/dist/types/web-sdk/react/index.d.ts +2 -0
  25. package/dist/types/web-sdk/react/index.d.ts.map +1 -1
  26. package/dist/types/web-sdk/react/init-status.d.ts +63 -0
  27. package/dist/types/web-sdk/react/init-status.d.ts.map +1 -0
  28. package/dist/types/web-sdk/react/useRevTurbine.d.ts +18 -0
  29. package/dist/types/web-sdk/react/useRevTurbine.d.ts.map +1 -1
  30. package/dist/types/web-sdk/theme/ThemeContext.d.ts +28 -2
  31. package/dist/types/web-sdk/theme/ThemeContext.d.ts.map +1 -1
  32. package/dist/types/web-sdk/theme/defaults.d.ts +44 -3
  33. package/dist/types/web-sdk/theme/defaults.d.ts.map +1 -1
  34. package/dist/types/web-sdk/theme/index.d.ts +4 -2
  35. package/dist/types/web-sdk/theme/index.d.ts.map +1 -1
  36. package/dist/types/web-sdk/theme/useColorScheme.d.ts +14 -0
  37. package/dist/types/web-sdk/theme/useColorScheme.d.ts.map +1 -0
  38. package/package.json +4 -4
@@ -23,11 +23,22 @@ export type FixedSurfaceSlotProps = {
23
23
  personalization?: PersonalizationContext;
24
24
  registry?: PlacementTypeRegistry;
25
25
  onCtaClick?: (uiPath: PlacementUiPath) => void;
26
+ /**
27
+ * Called after the user dismisses the placement (plan 233 TASK-9).
28
+ *
29
+ * `MessageSurfaceSlot` advertised this prop but never fired it — the handler
30
+ * was built and then discarded. It is wired for both slots now.
31
+ */
32
+ onDismissed?: () => void;
26
33
  className?: string;
27
34
  style?: React.CSSProperties;
28
35
  /**
29
- * Content to display when no placement decision matches.
30
- * Fixed slots always render something — either a placement or the fallback.
36
+ * Content to display when **no placement matches**.
37
+ *
38
+ * NOT shown after the user dismisses. Rendering the fallback on dismissal
39
+ * puts something back in the space the user just closed — the escalated
40
+ * integration called it a ghost popup and needed a MutationObserver to
41
+ * suppress it (plan 233 TASK-9).
31
42
  */
32
43
  fallback?: React.ReactNode;
33
44
  };
@@ -49,7 +60,7 @@ export type FixedSurfaceSlotProps = {
49
60
  * />
50
61
  * ```
51
62
  */
52
- export declare function FixedSurfaceSlot({ id, name, surfaceTemplateIds, metadata, fallback, ...options }: FixedSurfaceSlotProps): React.JSX.Element;
63
+ export declare function FixedSurfaceSlot({ id, name, surfaceTemplateIds, metadata, fallback, ...options }: FixedSurfaceSlotProps): React.JSX.Element | null;
53
64
  export declare namespace FixedSurfaceSlot {
54
65
  var displayName: string;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;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,kBAAkB,uGAkF7B,CAAC"}
@@ -23,14 +23,38 @@ export type UseSurfaceSlotOptions = {
23
23
  acceptedComponentTypes?: readonly RevTurbineComponentType[];
24
24
  /** Callback when CTA is clicked. Receives the parsed ui_path. */
25
25
  onCtaClick?: (uiPath: PlacementUiPath) => void;
26
+ /**
27
+ * Called after the user dismisses the placement (plan 233 TASK-9).
28
+ *
29
+ * Fires once per dismissal, after the interaction is recorded.
30
+ */
31
+ onDismissed?: () => void;
26
32
  /** Custom CSS class for the rendered placement. */
27
33
  className?: string;
28
34
  /** Custom inline styles for the rendered placement. */
29
35
  style?: React.CSSProperties;
30
36
  };
37
+ /**
38
+ * Why a slot is rendering nothing.
39
+ *
40
+ * `null` while visible. The distinction matters because a slot that always
41
+ * renders `fallback` when `!visible` shows its fallback content the instant the
42
+ * user dismisses — a "ghost" that reappears in place of the thing just closed.
43
+ * The escalated integration needed three attempts and a MutationObserver to
44
+ * work around it (plan 233 TASK-9).
45
+ *
46
+ * @public
47
+ */
48
+ export type SurfaceSlotHiddenReason = 'dismissed' | 'no_match' | null;
31
49
  export type UseSurfaceSlotResult = UsePlacementResult & {
32
50
  /** Pre-built React element that renders the placement using the correct slot type. */
33
51
  element: React.ReactNode;
52
+ /**
53
+ * Why nothing is rendering — `'dismissed'`, `'no_match'`, or `null` when
54
+ * visible. Lets a slot distinguish "the user closed this" from "nothing
55
+ * matched", which are the same `visible: false` but want opposite UI.
56
+ */
57
+ hiddenReason: SurfaceSlotHiddenReason;
34
58
  };
35
59
  /**
36
60
  * Hook that combines `usePlacement` decision loading with automatic
@@ -1 +1 @@
1
- {"version":3,"file":"useSurfaceSlot.d.ts","sourceRoot":"","sources":["../../../../placements/useSurfaceSlot.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EACV,qBAAqB,EACrB,oCAAoC,EACpC,2BAA2B,EAC3B,uB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AG,kBAAkB,GAAG;IACtD,sFAAsF;IACtF,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;;OAIG;IACH,YAAY,EAAE,uBAAuB,CAAC;CACvC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,oBAAoB,CAiInF"}
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import type { RevTurbineInitStatus } from './init-status';
3
+ /**
4
+ * Development-only visual surface for a failed SDK initialization.
5
+ *
6
+ * Plan 233 TASK-2. The provider renders this beside `children` when init threw
7
+ * and the build is not production. It exists because the app renders correctly
8
+ * without RevTurbine **by design** — a failed init changes nothing a developer
9
+ * can see, so the only prior signal was one `console.error` line competing with
10
+ * everything else in the log. That cost a customer 36 hours.
11
+ *
12
+ * Deliberately self-contained: inline styles, no theme tokens, no portal. The
13
+ * theme itself resolves during init, so a diagnostic that depended on it would
14
+ * be least reliable exactly when it is needed. It must never throw — a crashing
15
+ * error reporter is worse than none.
16
+ *
17
+ * @public
18
+ */
19
+ export interface InitFailureDiagnosticProps {
20
+ /** The failed status. Rendering is the caller's decision; this only draws. */
21
+ status: RevTurbineInitStatus;
22
+ }
23
+ /**
24
+ * Render a development-only banner describing a failed SDK initialization.
25
+ *
26
+ * Returns `null` for a healthy status, so the caller can render it
27
+ * unconditionally in development without branching.
28
+ *
29
+ * @public
30
+ */
31
+ export declare function InitFailureDiagnostic({ status }: InitFailureDiagnosticProps): React.JSX.Element | null;
32
+ export declare namespace InitFailureDiagnostic {
33
+ var displayName: string;
34
+ }
35
+ //# sourceMappingURL=InitFailureDiagnostic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InitFailureDiagnostic.d.ts","sourceRoot":"","sources":["../../../../react/InitFailureDiagnostic.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,0BAA0B;IACzC,8EAA8E;IAC9E,MAAM,EAAE,oBAAoB,CAAC;CAC9B;AAuBD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,MAAM,EAAE,EAAE,0BAA0B,4BA2B3E;yBA3Be,qBAAqB"}
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
- import { type RevTurbineInitInputOptions, type RevTurbinePlacementConfig, type RevTurbinePlacementDecisionInput, type RevTurbineUserContext, type Exact } from '../customer-side';
2
+ import { type RevTurbineInitInputOptions, type RevTurbinePlacementConfig, type RevTurbinePlacementDecisionInput, type RevTurbineUserContext, type Exact, type ExactInitOptions } from '../customer-side';
3
+ import { type RevTurbineColorScheme } from '../theme/defaults';
3
4
  import { type AnnotatedCaptureOptions } from '../telemetry';
4
5
  type BootstrapPlacementInput = Omit<RevTurbinePlacementDecisionInput, 'placementId'> & {
5
6
  placement: RevTurbinePlacementConfig;
6
7
  };
7
- export type RevTurbineProviderProps<TUser extends RevTurbineUserContext = RevTurbineUserContext> = {
8
+ export type RevTurbineProviderProps<TUser extends RevTurbineUserContext = RevTurbineUserContext, TOptions extends RevTurbineInitInputOptions = RevTurbineInitInputOptions> = {
8
9
  /**
9
10
  * SDK initialization options. Accepts optional provider or factory.
10
11
  *
@@ -14,7 +15,7 @@ export type RevTurbineProviderProps<TUser extends RevTurbineUserContext = RevTur
14
15
  * in an un-annotated `useMemo`, which is precisely where TypeScript's own
15
16
  * excess-property check stops applying.
16
17
  */
17
- options: RevTurbineInitInputOptions & {
18
+ options: TOptions & ExactInitOptions<TOptions> & {
18
19
  user?: Exact<RevTurbineUserContext, TUser>;
19
20
  };
20
21
  /** Placements to bootstrap (preload decisions) on mount. */
@@ -29,6 +30,19 @@ export type RevTurbineProviderProps<TUser extends RevTurbineUserContext = RevTur
29
30
  * Omit to disable. Memoize an object value to avoid re-installing.
30
31
  */
31
32
  domCapture?: boolean | AnnotatedCaptureOptions;
33
+ /**
34
+ * Light/dark palette for rendered placements (plan 233 TASK-6).
35
+ *
36
+ * Deliberately a provider prop rather than an SDK init option: `options`
37
+ * identity drives re-initialization, so a scheme toggle placed there would
38
+ * rebuild the SDK on every switch. That was the customer workaround this
39
+ * replaces. Defaults to `'system'`, which follows `prefers-color-scheme` and
40
+ * keeps following it.
41
+ *
42
+ * A branding theme still applies on top — the scheme only selects which base
43
+ * palette its tokens merge over.
44
+ */
45
+ colorScheme?: RevTurbineColorScheme;
32
46
  /** React children. */
33
47
  children: React.ReactNode;
34
48
  };
@@ -47,6 +61,6 @@ export type RevTurbineProviderProps<TUser extends RevTurbineUserContext = RevTur
47
61
  * </RevTurbineProvider>
48
62
  * ```
49
63
  */
50
- export declare function RevTurbineProvider<TUser extends RevTurbineUserContext = RevTurbineUserContext>({ options, bootstrapPlacements, domCapture, children, }: RevTurbineProviderProps<TUser>): React.JSX.Element;
64
+ export declare function RevTurbineProvider<TUser extends RevTurbineUserContext = RevTurbineUserContext, TOptions extends RevTurbineInitInputOptions = RevTurbineInitInputOptions>({ options, bootstrapPlacements, domCapture, colorScheme, children, }: RevTurbineProviderProps<TUser, TOptions>): React.JSX.Element;
51
65
  export {};
52
66
  //# 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,EACrC,KAAK,qBAAqB,EAC1B,KAAK,KAAK,EAGX,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EAA2B,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAIrF,KAAK,uBAAuB,GAAG,IAAI,CAAC,gCAAgC,EAAE,aAAa,CAAC,GAAG;IAC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qBAAqB,EAC3D,QAAQ,SAAS,0BAA0B,GAAG,0BAA0B,IACtE;IACF;;;;;;;;OAQG;IACH,OAAO,EAAE,QAAQ,GAAG,gBAAgB,CAAC,QAAQ,CAAC,GAAG;QAAE,IAAI,CAAC,EAAE,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAA;KAAE,CAAC;IAChG,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAChD;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAC;IAC/C;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,sBAAsB;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AASF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,SAAS,qBAAqB,GAAG,qBAAqB,EAC3D,QAAQ,SAAS,0BAA0B,GAAG,0BAA0B,EACxE,EACA,OAAO,EACP,mBAAmB,EACnB,UAAU,EACV,WAAsB,EACtB,QAAQ,GACT,EAAE,uBAAuB,CAAC,KAAK,EAAE,QAAQ,CAAC,qBAkR1C"}
@@ -1,5 +1,7 @@
1
1
  export * from './RevTurbineProvider';
2
2
  export { useRevTurbine } from './useRevTurbine';
3
+ export { INIT_STATUS_OK, initStatusForError, remediationFor, type RevTurbineInitPhase, type RevTurbineInitStatus, } from './init-status';
4
+ export { InitFailureDiagnostic, type InitFailureDiagnosticProps, } from './InitFailureDiagnostic';
3
5
  export * from './usePlacement';
4
6
  export * from './Placement';
5
7
  export * from './SurfaceTypes';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../react/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;A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AE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Init status — the one surface that is reachable when the SDK is not.
3
+ *
4
+ * Plan 233 TASK-2. Every diagnostic the SDK ships (`getPolicy()`,
5
+ * `getExportedConfig()`, `getTargeting()`, `getTelemetryCounters()`,
6
+ * `validateUiPathResolvers()`, `explainPlacementDecision()`) is an instance
7
+ * method, so all of them are unreachable in precisely the failure mode that
8
+ * matters most: the one where the instance was never created. When init throws,
9
+ * `useRevTurbine().sdk` is `null` and there is nothing left to ask.
10
+ *
11
+ * The provider already caught the error and logged it, but a `console.error` in
12
+ * an app that renders correctly without us is indistinguishable from silence —
13
+ * a customer ran dead for 36 hours and found it only by pasting a raw browser
14
+ * console log. So the status lives on the context value, beside `sdk`, and is
15
+ * populated exactly when `sdk` is not.
16
+ */
17
+ /**
18
+ * Where initialization was when it failed. Useful because the phases fail for
19
+ * different reasons: `construct` is almost always malformed options, `theme`
20
+ * a branding/network problem, `bootstrap` a placement that does not resolve.
21
+ *
22
+ * @public
23
+ */
24
+ export type RevTurbineInitPhase = 'construct' | 'identify' | 'theme' | 'placements' | 'bootstrap';
25
+ /**
26
+ * The provider's initialization outcome, readable with no SDK instance.
27
+ *
28
+ * `ok: true` with no other fields is the healthy state. On failure every field
29
+ * is populated — `remediation` is never empty, because a diagnostic that only
30
+ * restates the error leaves the reader exactly where they started.
31
+ *
32
+ * @public
33
+ */
34
+ export interface RevTurbineInitStatus {
35
+ /** `false` once initialization has thrown; `true` while healthy. */
36
+ readonly ok: boolean;
37
+ /** Which phase threw. Absent while healthy. */
38
+ readonly phase?: RevTurbineInitPhase;
39
+ /** The underlying error message, unmodified. Absent while healthy. */
40
+ readonly message?: string;
41
+ /** What to actually change, in the caller's own code. Absent while healthy. */
42
+ readonly remediation?: string;
43
+ }
44
+ /** The healthy status. Frozen so a consumer cannot mutate the shared default. */
45
+ export declare const INIT_STATUS_OK: RevTurbineInitStatus;
46
+ /**
47
+ * Resolve the remediation for a thrown init error.
48
+ *
49
+ * @param message - The error message as thrown.
50
+ * @returns Actionable guidance. Never empty.
51
+ * @public
52
+ */
53
+ export declare function remediationFor(message: string): string;
54
+ /**
55
+ * Build the failure status for a thrown init error.
56
+ *
57
+ * @param phase - The phase that was running when the error was thrown.
58
+ * @param error - The thrown value; non-Errors are stringified.
59
+ * @returns A fully-populated failure status.
60
+ * @public
61
+ */
62
+ export declare function initStatusForError(phase: RevTurbineInitPhase, error: unknown): RevTurbineInitStatus;
63
+ //# sourceMappingURL=init-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-status.d.ts","sourceRoot":"","sources":["../../../../react/init-status.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAC3B,WAAW,GACX,UAAU,GACV,OAAO,GACP,YAAY,GACZ,WAAW,CAAC;AAEhB;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,QAAQ,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC;IACrC,sEAAsE;IACtE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,+EAA+E;IAC/E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,iFAAiF;AACjF,eAAO,MAAM,cAAc,EAAE,oBAAkD,CAAC;AAoDhF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKtD;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,mBAAmB,EAC1B,KAAK,EAAE,OAAO,GACb,oBAAoB,CAQtB"}
@@ -1,8 +1,26 @@
1
1
  import type { RevTurbineUserContext } from '../customer-side';
2
+ import { type RevTurbineInitStatus } from './init-status';
2
3
  type RevTurbineContextValue = {
3
4
  sdk: import('../customer-side').RevTurbineCustomerSdk | null;
4
5
  isReady: boolean;
5
6
  error: string;
7
+ /**
8
+ * Initialization outcome, readable even when {@link sdk} is `null`.
9
+ *
10
+ * Every other diagnostic the SDK exposes is an instance method, so all of
11
+ * them are unreachable when init failed — which is the failure that matters
12
+ * most (plan 233 TASK-2). On failure this carries the phase, the underlying
13
+ * message, and a non-empty `remediation` naming what to change.
14
+ */
15
+ initStatus: RevTurbineInitStatus;
16
+ /**
17
+ * The colour scheme currently painting placements — `'light'` or `'dark'`,
18
+ * with `'system'` already resolved against `prefers-color-scheme`.
19
+ *
20
+ * Read-only: set it with the provider's `colorScheme` prop. Changing it
21
+ * re-renders placements without re-initializing the SDK (plan 233 TASK-6).
22
+ */
23
+ colorScheme: 'light' | 'dark';
6
24
  /**
7
25
  * Update the SDK's user context. Merges the provided fields into the
8
26
  * existing context and triggers segment re-evaluation.
@@ -1 +1 @@
1
- {"version":3,"file":"useRevTurbine.d.ts","sourceRoot":"","sources":["../../../../react/useRevTurbine.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D,KAAK,sBAAsB,GAAG;IAC5B,GAAG,EAAE,OAAO,kBAAkB,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC7D,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,UAAU,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACtD,CAAC;AAEF,eAAO,MAAM,iBAAiB,iDAK5B,CAAC;AAEH,wBAAgB,aAAa,2BAE5B"}
1
+ {"version":3,"file":"useRevTurbine.d.ts","sourceRoot":"","sources":["../../../../react/useRevTurbine.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAkB,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1E,KAAK,sBAAsB,GAAG;IAC5B,GAAG,EAAE,OAAO,kBAAkB,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC7D,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,UAAU,EAAE,oBAAoB,CAAC;IACjC;;;;;;OAMG;IACH,WAAW,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,UAAU,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACtD,CAAC;AAEF,eAAO,MAAM,iBAAiB,iDAO5B,CAAC;AAEH,wBAAgB,aAAa,2BAE5B"}
@@ -1,13 +1,39 @@
1
1
  import React from 'react';
2
- import type { RevTurbineTheme } from './types';
2
+ import type { RevTurbineTheme, RevTurbineThemeInput } from './types';
3
+ /**
4
+ * Whether a {@link RevTurbineThemeProvider} is already mounted above the caller.
5
+ *
6
+ * Used by {@link RevTurbineProvider} to decide whether to mount its own. Exposed
7
+ * so an app can make the same check — e.g. a design-system wrapper that only
8
+ * supplies a theme when nothing upstream has.
9
+ *
10
+ * @returns `true` when an ancestor mounted a theme provider.
11
+ * @public
12
+ */
13
+ export declare function useRevTurbineThemeProviderPresent(): boolean;
3
14
  export interface RevTurbineThemeProviderProps {
4
- theme: RevTurbineTheme;
15
+ /**
16
+ * Theme tokens. A **partial** theme is fine — every token you omit falls back
17
+ * to {@link DEFAULT_THEME}, so `{ colors: { primary: '#f00' } }` is a complete,
18
+ * valid value (plan 233 TASK-4).
19
+ */
20
+ theme: RevTurbineThemeInput;
5
21
  children: React.ReactNode;
6
22
  }
7
23
  /**
8
24
  * Provides the active {@link RevTurbineTheme} to all child SDK components.
9
25
  * Typically rendered internally by {@link RevTurbineProvider} — consumers
10
26
  * don't need to add this manually.
27
+ *
28
+ * The theme is merged over {@link DEFAULT_THEME} here, so
29
+ * {@link useRevTurbineTheme} always returns a complete theme.
30
+ *
31
+ * That merge used to be the caller's job while the prop was typed as a complete
32
+ * `RevTurbineTheme`, which made a partial theme a runtime crash rather than a
33
+ * type error: components read `theme.typography.fontSize` and got `undefined`
34
+ * on a theme that only set colors. `RevTurbineThemeInput` has always documented
35
+ * itself as "all values are optional — the SDK deep-merges with defaults"; this
36
+ * is the component honouring that.
11
37
  */
12
38
  export declare function RevTurbineThemeProvider({ theme, children }: RevTurbineThemeProviderProps): React.JSX.Element;
13
39
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeContext.d.ts","sourceRoot":"","sources":["../../../../theme/ThemeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK/C,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,4BAA4B,qBAExF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD"}
1
+ {"version":3,"file":"ThemeContext.d.ts","sourceRoot":"","sources":["../../../../theme/ThemeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAgBrE;;;;;;;;;GASG;AACH,wBAAgB,iCAAiC,IAAI,OAAO,CAE3D;AAED,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,KAAK,EAAE,oBAAoB,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,4BAA4B,qBASxF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD"}
@@ -6,8 +6,49 @@ import type { RevTurbineTheme, RevTurbineThemeInput } from './types';
6
6
  */
7
7
  export declare const DEFAULT_THEME: Readonly<RevTurbineTheme>;
8
8
  /**
9
- * Deep-merge a partial theme input with the default theme, producing a
10
- * complete {@link RevTurbineTheme}.
9
+ * Dark counterpart to {@link DEFAULT_THEME}.
10
+ *
11
+ * Plan 233 TASK-6. The SDK had no sanctioned dark story at all, so a customer
12
+ * running a dark app either lived with white modals or — as the escalated one
13
+ * did — injected a palette into the Playbook object and re-initialized the SDK
14
+ * on every toggle. Shipping the palette is what makes `colorScheme` a swap
15
+ * rather than a rebuild.
16
+ *
17
+ * Only the colors differ. Typography, shape and shadows are scheme-independent,
18
+ * so they are inherited from {@link DEFAULT_THEME} rather than duplicated —
19
+ * a second copy would drift the moment either is edited.
20
+ *
21
+ * Contrast: every text-on-surface pair here clears WCAG AA at body size against
22
+ * its intended background.
23
+ *
24
+ * @public
11
25
  */
12
- export declare function mergeTheme(input?: RevTurbineThemeInput | null): RevTurbineTheme;
26
+ export declare const DARK_THEME: Readonly<RevTurbineTheme>;
27
+ /**
28
+ * The colour scheme a theme resolves against.
29
+ *
30
+ * `'system'` follows the OS/browser `prefers-color-scheme` and keeps following
31
+ * it as the user changes it.
32
+ *
33
+ * @public
34
+ */
35
+ export type RevTurbineColorScheme = 'light' | 'dark' | 'system';
36
+ /**
37
+ * The base palette for a resolved scheme.
38
+ *
39
+ * @param scheme - `'light'` or `'dark'`. Resolve `'system'` before calling.
40
+ * @returns The matching base theme.
41
+ * @public
42
+ */
43
+ export declare function baseThemeForScheme(scheme: 'light' | 'dark'): Readonly<RevTurbineTheme>;
44
+ /**
45
+ * Deep-merge a partial theme input with a base theme, producing a complete
46
+ * {@link RevTurbineTheme}.
47
+ *
48
+ * @param input - Partial tokens. Every omitted token falls back to `base`.
49
+ * @param base - The palette to merge over. Defaults to {@link DEFAULT_THEME};
50
+ * pass {@link DARK_THEME} (or use {@link baseThemeForScheme}) to resolve a
51
+ * partial brand theme against the dark palette instead.
52
+ */
53
+ export declare function mergeTheme(input?: RevTurbineThemeInput | null, base?: Readonly<RevTurbineTheme>): RevTurbineTheme;
13
54
  //# sourceMappingURL=defaults.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../../theme/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,eAAe,CA2ClD,CAAC;AAEH;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,CAAC,EAAE,oBAAoB,GAAG,IAAI,GAAG,eAAe,CAY/E"}
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../../theme/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,eAAe,CA2ClD,CAAC;AAGH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,eAAe,CA2B/C,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,eAAe,CAAC,CAEtF;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,KAAK,CAAC,EAAE,oBAAoB,GAAG,IAAI,EACnC,IAAI,GAAE,QAAQ,CAAC,eAAe,CAAiB,GAC9C,eAAe,CAYjB"}
@@ -1,6 +1,8 @@
1
1
  export type { RevTurbineTheme, RevTurbineThemeInput, RevTurbineThemeColors, RevTurbineThemeTypography, RevTurbineThemeShape, RevTurbineThemeShadows, } from './types';
2
- export { DEFAULT_THEME, mergeTheme } from './defaults';
2
+ export { DEFAULT_THEME, DARK_THEME, baseThemeForScheme, mergeTheme, } from './defaults';
3
+ export type { RevTurbineColorScheme } from './defaults';
4
+ export { useResolvedColorScheme } from './useColorScheme';
3
5
  export { loadTheme, clearPersistedTheme } from './theme-loader';
4
6
  export type { ThemeLoaderOptions } from './theme-loader';
5
- export { RevTurbineThemeProvider, useRevTurbineTheme } from './ThemeContext';
7
+ export { RevTurbineThemeProvider, useRevTurbineTheme, useRevTurbineThemeProviderPresent, } from './ThemeContext';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../theme/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAChE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../theme/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAChE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,iCAAiC,GAClC,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { RevTurbineColorScheme } from './defaults';
2
+ /**
3
+ * Resolve a {@link RevTurbineColorScheme} to the concrete scheme to paint.
4
+ *
5
+ * `'system'` tracks `prefers-color-scheme` and keeps tracking it: a user
6
+ * flipping their OS theme updates the resolved value without a remount, which
7
+ * is the difference between following the system and sampling it once at init.
8
+ *
9
+ * @param preference - The requested scheme. `'system'` follows the OS.
10
+ * @returns `'light'` or `'dark'`.
11
+ * @public
12
+ */
13
+ export declare function useResolvedColorScheme(preference: RevTurbineColorScheme): 'light' | 'dark';
14
+ //# sourceMappingURL=useColorScheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useColorScheme.d.ts","sourceRoot":"","sources":["../../../../theme/useColorScheme.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAoBxD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,GAAG,MAAM,CAuC1F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revturbine/sdk",
3
- "version": "0.7.13",
3
+ "version": "0.8.0",
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",
@@ -55,9 +55,9 @@
55
55
  "devDependencies": {
56
56
  "@growthbook/growthbook": "^1.7.0",
57
57
  "@optimizely/optimizely-sdk": "^6.5.0",
58
- "@revt-eng/core": "0.1.302",
59
- "@revt-eng/schema": "0.1.302",
60
- "@revt-eng/schema-external": "0.1.302",
58
+ "@revt-eng/core": "0.1.306",
59
+ "@revt-eng/schema": "0.1.306",
60
+ "@revt-eng/schema-external": "0.1.306",
61
61
  "@types/react": "^19.2.17",
62
62
  "@types/react-dom": "^19.2.3",
63
63
  "openapi-fetch": "^0.17.0",