@revturbine/sdk 0.2.13

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 (147) hide show
  1. package/dist/headless.js +131 -0
  2. package/dist/headless.js.map +1 -0
  3. package/dist/index.js +131 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/types/server-node/client.d.ts +75 -0
  6. package/dist/types/server-node/client.d.ts.map +1 -0
  7. package/dist/types/server-node/index.d.ts +37 -0
  8. package/dist/types/server-node/index.d.ts.map +1 -0
  9. package/dist/types/server-node/local-server.d.ts +60 -0
  10. package/dist/types/server-node/local-server.d.ts.map +1 -0
  11. package/dist/types/server-node/types.d.ts +68 -0
  12. package/dist/types/server-node/types.d.ts.map +1 -0
  13. package/dist/types/web-sdk/adapters/api.d.ts +24 -0
  14. package/dist/types/web-sdk/adapters/api.d.ts.map +1 -0
  15. package/dist/types/web-sdk/analytics.d.ts +111 -0
  16. package/dist/types/web-sdk/analytics.d.ts.map +1 -0
  17. package/dist/types/web-sdk/api-client.d.ts +44 -0
  18. package/dist/types/web-sdk/api-client.d.ts.map +1 -0
  19. package/dist/types/web-sdk/browser-runtime.d.ts +62 -0
  20. package/dist/types/web-sdk/browser-runtime.d.ts.map +1 -0
  21. package/dist/types/web-sdk/controllers.d.ts +363 -0
  22. package/dist/types/web-sdk/controllers.d.ts.map +1 -0
  23. package/dist/types/web-sdk/customer-side.d.ts +1367 -0
  24. package/dist/types/web-sdk/customer-side.d.ts.map +1 -0
  25. package/dist/types/web-sdk/env.d.ts +5 -0
  26. package/dist/types/web-sdk/env.d.ts.map +1 -0
  27. package/dist/types/web-sdk/generated.d.ts +8 -0
  28. package/dist/types/web-sdk/generated.d.ts.map +1 -0
  29. package/dist/types/web-sdk/headless.d.ts +69 -0
  30. package/dist/types/web-sdk/headless.d.ts.map +1 -0
  31. package/dist/types/web-sdk/index.d.ts +51 -0
  32. package/dist/types/web-sdk/index.d.ts.map +1 -0
  33. package/dist/types/web-sdk/placements/AccessGateSurfaceSlot.d.ts +88 -0
  34. package/dist/types/web-sdk/placements/AccessGateSurfaceSlot.d.ts.map +1 -0
  35. package/dist/types/web-sdk/placements/FixedSurfaceSlot.d.ts +56 -0
  36. package/dist/types/web-sdk/placements/FixedSurfaceSlot.d.ts.map +1 -0
  37. package/dist/types/web-sdk/placements/MessageSurfaceSlot.d.ts +87 -0
  38. package/dist/types/web-sdk/placements/MessageSurfaceSlot.d.ts.map +1 -0
  39. package/dist/types/web-sdk/placements/PlacementRenderer.d.ts +57 -0
  40. package/dist/types/web-sdk/placements/PlacementRenderer.d.ts.map +1 -0
  41. package/dist/types/web-sdk/placements/SurfaceSlotComponent.d.ts +70 -0
  42. package/dist/types/web-sdk/placements/SurfaceSlotComponent.d.ts.map +1 -0
  43. package/dist/types/web-sdk/placements/abstract/BannerFrame.d.ts +53 -0
  44. package/dist/types/web-sdk/placements/abstract/BannerFrame.d.ts.map +1 -0
  45. package/dist/types/web-sdk/placements/abstract/InlineCardPlacement.d.ts +52 -0
  46. package/dist/types/web-sdk/placements/abstract/InlineCardPlacement.d.ts.map +1 -0
  47. package/dist/types/web-sdk/placements/abstract/ModalFrame.d.ts +68 -0
  48. package/dist/types/web-sdk/placements/abstract/ModalFrame.d.ts.map +1 -0
  49. package/dist/types/web-sdk/placements/abstract/QuotaMeterFrame.d.ts +76 -0
  50. package/dist/types/web-sdk/placements/abstract/QuotaMeterFrame.d.ts.map +1 -0
  51. package/dist/types/web-sdk/placements/abstract/index.d.ts +9 -0
  52. package/dist/types/web-sdk/placements/abstract/index.d.ts.map +1 -0
  53. package/dist/types/web-sdk/placements/builtin.d.ts +18 -0
  54. package/dist/types/web-sdk/placements/builtin.d.ts.map +1 -0
  55. package/dist/types/web-sdk/placements/cta-resolvers.d.ts +67 -0
  56. package/dist/types/web-sdk/placements/cta-resolvers.d.ts.map +1 -0
  57. package/dist/types/web-sdk/placements/index.d.ts +28 -0
  58. package/dist/types/web-sdk/placements/index.d.ts.map +1 -0
  59. package/dist/types/web-sdk/placements/local-resolver.d.ts +8 -0
  60. package/dist/types/web-sdk/placements/local-resolver.d.ts.map +1 -0
  61. package/dist/types/web-sdk/placements/payload-resolution.d.ts +8 -0
  62. package/dist/types/web-sdk/placements/payload-resolution.d.ts.map +1 -0
  63. package/dist/types/web-sdk/placements/recommendation.d.ts +35 -0
  64. package/dist/types/web-sdk/placements/recommendation.d.ts.map +1 -0
  65. package/dist/types/web-sdk/placements/registry.d.ts +84 -0
  66. package/dist/types/web-sdk/placements/registry.d.ts.map +1 -0
  67. package/dist/types/web-sdk/placements/slots/AgentConnectorSlot.d.ts +11 -0
  68. package/dist/types/web-sdk/placements/slots/AgentConnectorSlot.d.ts.map +1 -0
  69. package/dist/types/web-sdk/placements/slots/BannerSlot.d.ts +35 -0
  70. package/dist/types/web-sdk/placements/slots/BannerSlot.d.ts.map +1 -0
  71. package/dist/types/web-sdk/placements/slots/ButtonSlot.d.ts +23 -0
  72. package/dist/types/web-sdk/placements/slots/ButtonSlot.d.ts.map +1 -0
  73. package/dist/types/web-sdk/placements/slots/ChannelPreviewSlots.d.ts +48 -0
  74. package/dist/types/web-sdk/placements/slots/ChannelPreviewSlots.d.ts.map +1 -0
  75. package/dist/types/web-sdk/placements/slots/CliSlot.d.ts +11 -0
  76. package/dist/types/web-sdk/placements/slots/CliSlot.d.ts.map +1 -0
  77. package/dist/types/web-sdk/placements/slots/CreditBalanceSlot.d.ts +19 -0
  78. package/dist/types/web-sdk/placements/slots/CreditBalanceSlot.d.ts.map +1 -0
  79. package/dist/types/web-sdk/placements/slots/FullPageSlot.d.ts +14 -0
  80. package/dist/types/web-sdk/placements/slots/FullPageSlot.d.ts.map +1 -0
  81. package/dist/types/web-sdk/placements/slots/InPageSlot.d.ts +13 -0
  82. package/dist/types/web-sdk/placements/slots/InPageSlot.d.ts.map +1 -0
  83. package/dist/types/web-sdk/placements/slots/InlineEmbedSlot.d.ts +16 -0
  84. package/dist/types/web-sdk/placements/slots/InlineEmbedSlot.d.ts.map +1 -0
  85. package/dist/types/web-sdk/placements/slots/ModalSlot.d.ts +30 -0
  86. package/dist/types/web-sdk/placements/slots/ModalSlot.d.ts.map +1 -0
  87. package/dist/types/web-sdk/placements/slots/QuotaMeterSlot.d.ts +19 -0
  88. package/dist/types/web-sdk/placements/slots/QuotaMeterSlot.d.ts.map +1 -0
  89. package/dist/types/web-sdk/placements/slots/ToastSlot.d.ts +17 -0
  90. package/dist/types/web-sdk/placements/slots/ToastSlot.d.ts.map +1 -0
  91. package/dist/types/web-sdk/placements/slots/TooltipSlot.d.ts +15 -0
  92. package/dist/types/web-sdk/placements/slots/TooltipSlot.d.ts.map +1 -0
  93. package/dist/types/web-sdk/placements/slots/index.d.ts +14 -0
  94. package/dist/types/web-sdk/placements/slots/index.d.ts.map +1 -0
  95. package/dist/types/web-sdk/placements/surface-slot-constants.d.ts +13 -0
  96. package/dist/types/web-sdk/placements/surface-slot-constants.d.ts.map +1 -0
  97. package/dist/types/web-sdk/placements/surface-template-defaults.d.ts +16 -0
  98. package/dist/types/web-sdk/placements/surface-template-defaults.d.ts.map +1 -0
  99. package/dist/types/web-sdk/placements/token-derivation.d.ts +7 -0
  100. package/dist/types/web-sdk/placements/token-derivation.d.ts.map +1 -0
  101. package/dist/types/web-sdk/placements/types.d.ts +226 -0
  102. package/dist/types/web-sdk/placements/types.d.ts.map +1 -0
  103. package/dist/types/web-sdk/placements/usePlacementPersonalization.d.ts +20 -0
  104. package/dist/types/web-sdk/placements/usePlacementPersonalization.d.ts.map +1 -0
  105. package/dist/types/web-sdk/placements/useSurfaceSlot.d.ts +60 -0
  106. package/dist/types/web-sdk/placements/useSurfaceSlot.d.ts.map +1 -0
  107. package/dist/types/web-sdk/providers/index.d.ts +3 -0
  108. package/dist/types/web-sdk/providers/index.d.ts.map +1 -0
  109. package/dist/types/web-sdk/providers/registry.d.ts +8 -0
  110. package/dist/types/web-sdk/providers/registry.d.ts.map +1 -0
  111. package/dist/types/web-sdk/providers/types.d.ts +8 -0
  112. package/dist/types/web-sdk/providers/types.d.ts.map +1 -0
  113. package/dist/types/web-sdk/react/Placement.d.ts +50 -0
  114. package/dist/types/web-sdk/react/Placement.d.ts.map +1 -0
  115. package/dist/types/web-sdk/react/PlacementDecisionInspector.d.ts +40 -0
  116. package/dist/types/web-sdk/react/PlacementDecisionInspector.d.ts.map +1 -0
  117. package/dist/types/web-sdk/react/RevTurbineProvider.d.ts +31 -0
  118. package/dist/types/web-sdk/react/RevTurbineProvider.d.ts.map +1 -0
  119. package/dist/types/web-sdk/react/SurfaceTypes.d.ts +19 -0
  120. package/dist/types/web-sdk/react/SurfaceTypes.d.ts.map +1 -0
  121. package/dist/types/web-sdk/react/UserProfile.d.ts +23 -0
  122. package/dist/types/web-sdk/react/UserProfile.d.ts.map +1 -0
  123. package/dist/types/web-sdk/react/index.d.ts +11 -0
  124. package/dist/types/web-sdk/react/index.d.ts.map +1 -0
  125. package/dist/types/web-sdk/react/useEntitlement.d.ts +53 -0
  126. package/dist/types/web-sdk/react/useEntitlement.d.ts.map +1 -0
  127. package/dist/types/web-sdk/react/usePlacement.d.ts +63 -0
  128. package/dist/types/web-sdk/react/usePlacement.d.ts.map +1 -0
  129. package/dist/types/web-sdk/react/useRevTurbine.d.ts +17 -0
  130. package/dist/types/web-sdk/react/useRevTurbine.d.ts.map +1 -0
  131. package/dist/types/web-sdk/react/useUsageSnapshot.d.ts +7 -0
  132. package/dist/types/web-sdk/react/useUsageSnapshot.d.ts.map +1 -0
  133. package/dist/types/web-sdk/segments.d.ts +9 -0
  134. package/dist/types/web-sdk/segments.d.ts.map +1 -0
  135. package/dist/types/web-sdk/storage.d.ts +38 -0
  136. package/dist/types/web-sdk/storage.d.ts.map +1 -0
  137. package/dist/types/web-sdk/theme/ThemeContext.d.ts +18 -0
  138. package/dist/types/web-sdk/theme/ThemeContext.d.ts.map +1 -0
  139. package/dist/types/web-sdk/theme/defaults.d.ts +13 -0
  140. package/dist/types/web-sdk/theme/defaults.d.ts.map +1 -0
  141. package/dist/types/web-sdk/theme/index.d.ts +6 -0
  142. package/dist/types/web-sdk/theme/index.d.ts.map +1 -0
  143. package/dist/types/web-sdk/theme/theme-loader.d.ts +26 -0
  144. package/dist/types/web-sdk/theme/theme-loader.d.ts.map +1 -0
  145. package/dist/types/web-sdk/theme/types.d.ts +121 -0
  146. package/dist/types/web-sdk/theme/types.d.ts.map +1 -0
  147. package/package.json +57 -0
@@ -0,0 +1,60 @@
1
+ import React from 'react';
2
+ import type { RevTurbineContextMode, RevTurbinePlacementDecisionOverrides, RevTurbineSurfaceSlotConfig } from '../customer-side';
3
+ import { type UsePlacementResult } from '../react/usePlacement';
4
+ import type { PersonalizationContext, PlacementUiPath } from '../placements/types';
5
+ import type { PlacementTypeRegistry } from '../placements/registry';
6
+ export type UseSurfaceSlotOptions = {
7
+ surfaceSlot: RevTurbineSurfaceSlotConfig;
8
+ contextMode?: RevTurbineContextMode;
9
+ overrides?: RevTurbinePlacementDecisionOverrides;
10
+ traits?: Record<string, string | number | boolean>;
11
+ ttlMs?: number;
12
+ /**
13
+ * Whether to load the placement decision automatically.
14
+ * Managed internally by each surface slot component.
15
+ * @internal
16
+ */
17
+ autoLoad?: boolean;
18
+ /** Personalization context for token resolution in rendered content. */
19
+ personalization?: PersonalizationContext;
20
+ /** Custom registry for slot type resolution. */
21
+ registry?: PlacementTypeRegistry;
22
+ /** Callback when CTA is clicked. Receives the parsed ui_path. */
23
+ onCtaClick?: (uiPath: PlacementUiPath) => void;
24
+ /** Custom CSS class for the rendered placement. */
25
+ className?: string;
26
+ /** Custom inline styles for the rendered placement. */
27
+ style?: React.CSSProperties;
28
+ };
29
+ export type UseSurfaceSlotResult = UsePlacementResult & {
30
+ /** Pre-built React element that renders the placement using the correct slot type. */
31
+ element: React.ReactNode;
32
+ };
33
+ /**
34
+ * Hook that combines `usePlacement` decision loading with automatic
35
+ * rendering via `PlacementRenderer`.
36
+ *
37
+ * Returns everything `usePlacement` returns, plus an `element` property
38
+ * containing a pre-rendered React element. Drop `element` into your JSX
39
+ * to render the placement without writing custom rendering logic.
40
+ *
41
+ * @example
42
+ * ```tsx
43
+ * function FeatureGate() {
44
+ * const { element, visible } = useSurfaceSlot({
45
+ * surfaceSlot: { id: 'ai-export-gate', name: 'AI Export Gate' },
46
+ * personalization: { user_name: 'Jane' },
47
+ * onCtaClick: (uiPath) => handleCTA(uiPath),
48
+ * });
49
+ *
50
+ * return (
51
+ * <div>
52
+ * <h2>Export</h2>
53
+ * {element}
54
+ * </div>
55
+ * );
56
+ * }
57
+ * ```
58
+ */
59
+ export declare function useSurfaceSlot(options: UseSurfaceSlotOptions): UseSurfaceSlotResult;
60
+ //# sourceMappingURL=useSurfaceSlot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSurfaceSlot.d.ts","sourceRoot":"","sources":["../../../../placements/useSurfaceSlot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EACV,qBAAqB,EACrB,oCAAoC,EACpC,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAGpE,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,2BAA2B,CAAC;IACzC,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,SAAS,CAAC,EAAE,oCAAoC,CAAC;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wEAAwE;IACxE,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC,gDAAgD;IAChD,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,iEAAiE;IACjE,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC/C,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,GAAG;IACtD,sFAAsF;IACtF,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,oBAAoB,CAkGnF"}
@@ -0,0 +1,3 @@
1
+ export type { DomainProviderName, DomainProvider, AnyDomainProvider, ResolvedProviderContext, ResolvedDomainType, TraitsNamespace, PlanProvider, PlanProviderState, EntitlementProvider, EntitlementProviderState, EntitlementUsageEntry, SegmentProvider, SegmentProviderState, ContentProvider, ContentProviderState, MessageBlockSnapshot, PlacementPayloadSnapshot, RuleProvider, RuleProviderState, EntitlementRuleSnapshot, PlanRuleSnapshot, TraitsProvider, TraitsProviderState, TrialStatusTraits, TrialStatusProvider, UsageTraits, UsageTraitsProvider, ThemeProvider, ThemeProviderState, EventConsumer, EventConsumerProvider, EventConsumerProviderState, CtaHandler, CtaHandlerMap, CtaHandlerProvider, CtaHandlerProviderState, } from './types';
2
+ export { DomainProviderRegistry } from './registry';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../providers/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAElB,eAAe,EAEf,YAAY,EACZ,iBAAiB,EAEjB,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EAErB,eAAe,EACf,oBAAoB,EAEpB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EAExB,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAEhB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EAEnB,aAAa,EACb,kBAAkB,EAElB,aAAa,EACb,qBAAqB,EACrB,0BAA0B,EAE1B,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * DomainProviderRegistry — re-exported from @revt-eng/core.
3
+ *
4
+ * This file maintains backward compatibility for web-sdk consumers.
5
+ * The canonical implementation lives in core/providers/registry.ts.
6
+ */
7
+ export { DomainProviderRegistry } from '@revt-eng/core';
8
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../providers/registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Domain provider types — re-exported from @revt-eng/core.
3
+ *
4
+ * This file maintains backward compatibility for web-sdk consumers.
5
+ * All canonical type definitions live in core/providers/types.ts.
6
+ */
7
+ export type { TraitsNamespace, DomainProviderName, DomainProvider, PlanProviderState, PlanProvider, EntitlementUsageEntry, EntitlementProviderState, EntitlementProvider, SegmentProviderState, SegmentProvider, MessageBlockSnapshot, PlacementPayloadSnapshot, ContentProviderState, ContentProvider, EntitlementRuleSnapshot, PlanRuleSnapshot, RuleProviderState, RuleProvider, TraitsProviderState, TraitsProvider, TrialStatusTraits, TrialStatusProvider, UsageTraits, UsageTraitsProvider, ThemeProviderState, ThemeProvider, EventConsumer, EventConsumerProviderState, EventConsumerProvider, CtaHandler, CtaHandlerMap, CtaHandlerProviderState, CtaHandlerProvider, ResolvedProviderContext, AnyDomainProvider, ResolvedDomainType, } from '@revt-eng/core';
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../providers/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,0BAA0B,EAC1B,qBAAqB,EACrB,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import { type RevTurbinePlacementDecisionOverrides, type RevTurbineContextMode, type RevTurbinePlacementConfig } from '../customer-side';
3
+ import { usePlacement } from './usePlacement';
4
+ type PlacementRenderArgs = ReturnType<typeof usePlacement>;
5
+ /**
6
+ * Props for the {@link Placement} render-prop component.
7
+ */
8
+ export type PlacementProps = {
9
+ /** Placement configuration. */
10
+ placement: RevTurbinePlacementConfig;
11
+ /** Target user ID. */
12
+ userId?: string;
13
+ /** Context resolution mode. */
14
+ contextMode?: RevTurbineContextMode;
15
+ /** Decision overrides for testing. */
16
+ overrides?: RevTurbinePlacementDecisionOverrides;
17
+ /** Custom traits. */
18
+ traits?: Record<string, string | number | boolean>;
19
+ /** Cache TTL in milliseconds. */
20
+ ttlMs?: number;
21
+ /** Auto-load on mount. */
22
+ autoLoad?: boolean;
23
+ /** Fallback UI when the placement is not visible. */
24
+ fallback?: React.ReactNode;
25
+ /** Render function receiving the placement state. */
26
+ children: (args: PlacementRenderArgs) => React.ReactNode;
27
+ };
28
+ /**
29
+ * Render-prop component for placement integration.
30
+ *
31
+ * An alternative to {@link usePlacement} for class components or when
32
+ * render-prop composition is preferred.
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * <Placement placement={{ name: 'upgrade_modal' }} userId="user_123">
37
+ * {({ visible, content, ctaClick }) =>
38
+ * visible ? (
39
+ * <div>
40
+ * <h2>{content?.header}</h2>
41
+ * <button onClick={() => ctaClick()}>{content?.cta_label}</button>
42
+ * </div>
43
+ * ) : null
44
+ * }
45
+ * </Placement>
46
+ * ```
47
+ */
48
+ export declare function Placement({ placement, userId, contextMode, overrides, traits, ttlMs, autoLoad, fallback, children, }: PlacementProps): React.JSX.Element;
49
+ export {};
50
+ //# sourceMappingURL=Placement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Placement.d.ts","sourceRoot":"","sources":["../../../../react/Placement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,oCAAoC,EAAE,KAAK,qBAAqB,EAAE,KAAK,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AACzI,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,KAAK,mBAAmB,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,+BAA+B;IAC/B,SAAS,EAAE,yBAAyB,CAAC;IACrC,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,sCAAsC;IACtC,SAAS,CAAC,EAAE,oCAAoC,CAAC;IACjD,qBAAqB;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACnD,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,qDAAqD;IACrD,QAAQ,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,KAAK,CAAC,SAAS,CAAC;CAC1D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,EACxB,SAAS,EACT,MAAM,EACN,WAAW,EACX,SAAS,EACT,MAAM,EACN,KAAK,EACL,QAAQ,EACR,QAAe,EACf,QAAQ,GACT,EAAE,cAAc,qBAahB"}
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import type { RevTurbineContextMode, RevTurbinePlacementConfig, RevTurbinePlacementDecisionOverrides, RevTurbineSurfaceSlotConfig } from '../customer-side';
3
+ /**
4
+ * Props for {@link PlacementDecisionInspector}.
5
+ */
6
+ export interface PlacementDecisionInspectorProps {
7
+ /**
8
+ * Placement registration config used to resolve a placement ID.
9
+ * @deprecated Use `surfaceSlot` instead.
10
+ */
11
+ placement?: RevTurbinePlacementConfig;
12
+ /** Surface slot config used to resolve a placement ID. Preferred over `placement`. */
13
+ surfaceSlot?: Pick<RevTurbineSurfaceSlotConfig, 'id' | 'name' | 'surfaceTemplateIds'>;
14
+ /** Target user ID. Falls back to the SDK's current user context. */
15
+ userId?: string;
16
+ /** Context resolution mode. Defaults to `'auto'`. */
17
+ contextMode?: RevTurbineContextMode;
18
+ /** Optional segment/plan/usage overrides for debugging. */
19
+ overrides?: RevTurbinePlacementDecisionOverrides;
20
+ /** Optional traits merged into the decision request. */
21
+ traits?: Record<string, string | number | boolean>;
22
+ /** Optional decision cache TTL for the underlying decision call. */
23
+ ttlMs?: number;
24
+ /** Auto-load explanation on mount and dependency changes. Defaults to `true`. */
25
+ autoLoad?: boolean;
26
+ /** Optional class name for the root container. */
27
+ className?: string;
28
+ /** Optional inline styles for the root container. */
29
+ style?: React.CSSProperties;
30
+ /** Whether to render full JSON dumps for deep debugging. Defaults to `false`. */
31
+ showRawJson?: boolean;
32
+ }
33
+ /**
34
+ * Visual debug panel that explains why a placement decision was selected.
35
+ *
36
+ * Includes segment predicate evaluations, entitlement-rule matching,
37
+ * final decision metadata, and policy/targeting snapshots.
38
+ */
39
+ export declare function PlacementDecisionInspector({ placement, surfaceSlot, userId, contextMode, overrides, traits, ttlMs, autoLoad, className, style, showRawJson, }: PlacementDecisionInspectorProps): React.JSX.Element;
40
+ //# sourceMappingURL=PlacementDecisionInspector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlacementDecisionInspector.d.ts","sourceRoot":"","sources":["../../../../react/PlacementDecisionInspector.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,KAAK,EACV,qBAAqB,EACrB,yBAAyB,EAEzB,oCAAoC,EACpC,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC;AAqB1B;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C;;;OAGG;IACH,SAAS,CAAC,EAAE,yBAAyB,CAAC;IACtC,sFAAsF;IACtF,WAAW,CAAC,EAAE,IAAI,CAAC,2BAA2B,EAAE,IAAI,GAAG,MAAM,GAAG,oBAAoB,CAAC,CAAC;IACtF,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,2DAA2D;IAC3D,SAAS,CAAC,EAAE,oCAAoC,CAAC;IACjD,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACnD,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,iFAAiF;IACjF,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,SAAS,EACT,WAAW,EACX,MAAM,EACN,WAAoB,EACpB,SAAS,EACT,MAAM,EACN,KAAK,EACL,QAAe,EACf,SAAS,EACT,KAAK,EACL,WAAmB,GACpB,EAAE,+BAA+B,qBAsajC"}
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { type RevTurbineInitInputOptions, type RevTurbinePlacementConfig, type RevTurbinePlacementDecisionInput } from '../customer-side';
3
+ type BootstrapPlacementInput = Omit<RevTurbinePlacementDecisionInput, 'placementId'> & {
4
+ placement: RevTurbinePlacementConfig;
5
+ };
6
+ export type RevTurbineProviderProps = {
7
+ /** SDK initialization options. Accepts optional provider or factory. */
8
+ options: RevTurbineInitInputOptions;
9
+ /** Placements to bootstrap (preload decisions) on mount. */
10
+ bootstrapPlacements?: BootstrapPlacementInput[];
11
+ /** React children. */
12
+ children: React.ReactNode;
13
+ };
14
+ /**
15
+ * React context provider for the RevTurbine SDK.
16
+ *
17
+ * Wraps your application to provide SDK access to all child components.
18
+ * Handles initialization, user identification, and optional placement bootstrap.
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * <RevTurbineProvider
23
+ * options={{ tenantId: 'abc', apiKey: 'key', endpoint: '/api', mode: 'react', user: { id: 'user_123' } }}
24
+ * >
25
+ * <App />
26
+ * </RevTurbineProvider>
27
+ * ```
28
+ */
29
+ export declare function RevTurbineProvider({ options, bootstrapPlacements, children }: RevTurbineProviderProps): React.JSX.Element;
30
+ export {};
31
+ //# sourceMappingURL=RevTurbineProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RevTurbineProvider.d.ts","sourceRoot":"","sources":["../../../../react/RevTurbineProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,EAGtC,MAAM,kBAAkB,CAAC;AAO1B,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,sBAAsB;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAcF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,EAAE,uBAAuB,qBAiIrG"}
@@ -0,0 +1,19 @@
1
+ import { type BannerSlotProps, type ButtonSlotProps, type InPageSlotProps, type ModalSlotProps, type ToastSlotProps } from '../placements';
2
+ import type { PersonalizationContext } from '../placements/types';
3
+ type SurfacePersonalizationProps = {
4
+ userId?: string;
5
+ personalization?: PersonalizationContext;
6
+ personalizationRefreshKey?: string | number;
7
+ };
8
+ export type ButtonSurfaceProps = ButtonSlotProps & SurfacePersonalizationProps;
9
+ export declare function ButtonSurface({ userId, personalization, personalizationRefreshKey, ...props }: ButtonSurfaceProps): import("react").JSX.Element;
10
+ export type InPageSurfaceProps = InPageSlotProps & SurfacePersonalizationProps;
11
+ export declare function InPageSurface({ userId, personalization, personalizationRefreshKey, ...props }: InPageSurfaceProps): import("react").JSX.Element;
12
+ export type BannerSurfaceProps = BannerSlotProps & SurfacePersonalizationProps;
13
+ export declare function BannerSurface({ userId, personalization, personalizationRefreshKey, ...props }: BannerSurfaceProps): import("react").JSX.Element;
14
+ export type ModalSurfaceProps = ModalSlotProps & SurfacePersonalizationProps;
15
+ export declare function ModalSurface({ userId, personalization, personalizationRefreshKey, ...props }: ModalSurfaceProps): import("react").JSX.Element;
16
+ export type ToastSurfaceProps = ToastSlotProps & SurfacePersonalizationProps;
17
+ export declare function ToastSurface({ userId, personalization, personalizationRefreshKey, ...props }: ToastSurfaceProps): import("react").JSX.Element;
18
+ export {};
19
+ //# sourceMappingURL=SurfaceTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SurfaceTypes.d.ts","sourceRoot":"","sources":["../../../../react/SurfaceTypes.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,eAAe,EAEpB,KAAK,eAAe,EAEpB,KAAK,eAAe,EAEpB,KAAK,cAAc,EAEnB,KAAK,cAAc,EACpB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,sBAAsB,EAAmB,MAAM,qBAAqB,CAAC;AAGnF,KAAK,2BAA2B,GAAG;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC,yBAAyB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7C,CAAC;AAkBF,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG,2BAA2B,CAAC;AAE/E,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,eAAe,EACf,yBAAyB,EACzB,GAAG,KAAK,EACT,EAAE,kBAAkB,+BAOpB;AAED,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG,2BAA2B,CAAC;AAE/E,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,eAAe,EACf,yBAAyB,EACzB,GAAG,KAAK,EACT,EAAE,kBAAkB,+BAOpB;AAED,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG,2BAA2B,CAAC;AAE/E,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,eAAe,EACf,yBAAyB,EACzB,GAAG,KAAK,EACT,EAAE,kBAAkB,+BAOpB;AAED,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,2BAA2B,CAAC;AAE7E,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,eAAe,EACf,yBAAyB,EACzB,GAAG,KAAK,EACT,EAAE,iBAAiB,+BAOnB;AAED,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,2BAA2B,CAAC;AAE7E,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,eAAe,EACf,yBAAyB,EACzB,GAAG,KAAK,EACT,EAAE,iBAAiB,+BAOnB"}
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import type { RevTurbineTargeting } from '../customer-side';
3
+ /**
4
+ * Props for {@link UserProfile}.
5
+ */
6
+ export interface UserProfileProps {
7
+ /** Targeting/user context snapshot to render. */
8
+ targeting: RevTurbineTargeting;
9
+ /** Optional heading override. */
10
+ title?: string;
11
+ /** Optional class name for root container. */
12
+ className?: string;
13
+ /** Optional inline styles for root container. */
14
+ style?: React.CSSProperties;
15
+ }
16
+ /**
17
+ * Read-only visualization of the resolved SDK user context.
18
+ *
19
+ * Displays user id, plan, matched segments, usage balances, and traits that
20
+ * were used for segment evaluation and placement decisioning.
21
+ */
22
+ export declare function UserProfile({ targeting, title, className, style, }: UserProfileProps): React.JSX.Element;
23
+ //# sourceMappingURL=UserProfile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserProfile.d.ts","sourceRoot":"","sources":["../../../../react/UserProfile.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iDAAiD;IACjD,SAAS,EAAE,mBAAmB,CAAC;IAC/B,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,KAAsB,EACtB,SAAS,EACT,KAAK,GACN,EAAE,gBAAgB,qBAiDlB"}
@@ -0,0 +1,11 @@
1
+ export * from './RevTurbineProvider';
2
+ export { useRevTurbine } from './useRevTurbine';
3
+ export * from './usePlacement';
4
+ export * from './Placement';
5
+ export * from './SurfaceTypes';
6
+ export * from './PlacementDecisionInspector';
7
+ export * from './UserProfile';
8
+ export * from './useEntitlement';
9
+ export * from './useUsageSnapshot';
10
+ export { useRevTurbineTheme } from '../theme/ThemeContext';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,53 @@
1
+ import type { EntitlementResult, PlacementOutput, RevTurbineEntitlementContext, RevTurbinePlacementRequestConfig } from '../customer-side';
2
+ export interface UseEntitlementOptions {
3
+ /** The entitlement handle to check (e.g. 'brand_kit', 'mp4_download'). */
4
+ handle: string;
5
+ /** Optional context (usage, required tier, etc.). */
6
+ context?: RevTurbineEntitlementContext;
7
+ /** Whether to fetch automatically on mount. Defaults to `true`. */
8
+ autoCheck?: boolean;
9
+ /**
10
+ * When true, auto-resolve and return a gated placement for denied entitlements.
11
+ * Defaults to `false` for backward compatibility.
12
+ */
13
+ autoGate?: boolean;
14
+ /**
15
+ * Optional placement request fields used when auto-gating needs to fetch
16
+ * a placement and one is not attached directly to the entitlement response.
17
+ */
18
+ gatePlacementRequest?: Omit<RevTurbinePlacementRequestConfig, 'entitlementHandle'>;
19
+ }
20
+ export interface UseEntitlementResult {
21
+ /** Whether the entitlement check is in progress. */
22
+ isLoading: boolean;
23
+ /** Error message if the check failed. */
24
+ error: string | null;
25
+ /** The entitlement result from the SDK. `null` until resolved. */
26
+ result: EntitlementResult | null;
27
+ /** Convenience: `true` when the entitlement is allowed. */
28
+ allowed: boolean;
29
+ /** Convenience: `true` when usage is limited (partially exhausted). */
30
+ limited: boolean;
31
+ /** Convenience: `true` when the entitlement is denied. */
32
+ denied: boolean;
33
+ /** Resolved gated placement when `denied` and `autoGate` are active. */
34
+ gatedPlacement: PlacementOutput | null;
35
+ /** Re-run the entitlement check. */
36
+ recheck: () => Promise<void>;
37
+ }
38
+ /**
39
+ * React hook that wraps `sdk.checkEntitlement()`.
40
+ *
41
+ * Returns a reactive entitlement result that can drive access-gate UI.
42
+ *
43
+ * @example
44
+ * ```tsx
45
+ * function BrandKitSection() {
46
+ * const { allowed, denied, result } = useEntitlement({ handle: 'brand_kit' });
47
+ * if (denied) return <UpgradePrompt reason={result?.reason} />;
48
+ * return <BrandKitEditor />;
49
+ * }
50
+ * ```
51
+ */
52
+ export declare function useEntitlement({ handle, context, autoCheck, autoGate, gatePlacementRequest, }: UseEntitlementOptions): UseEntitlementResult;
53
+ //# sourceMappingURL=useEntitlement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEntitlement.d.ts","sourceRoot":"","sources":["../../../../react/useEntitlement.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,4BAA4B,EAC5B,gCAAgC,EACjC,MAAM,kBAAkB,CAAC;AAM1B,MAAM,WAAW,qBAAqB;IACpC,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,OAAO,CAAC,EAAE,4BAA4B,CAAC;IACvC,mEAAmE;IACnE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,IAAI,CAAC,gCAAgC,EAAE,mBAAmB,CAAC,CAAC;CACpF;AAED,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,SAAS,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,kEAAkE;IAClE,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,2DAA2D;IAC3D,OAAO,EAAE,OAAO,CAAC;IACjB,uEAAuE;IACvE,OAAO,EAAE,OAAO,CAAC;IACjB,0DAA0D;IAC1D,MAAM,EAAE,OAAO,CAAC;IAChB,wEAAwE;IACxE,cAAc,EAAE,eAAe,GAAG,IAAI,CAAC;IACvC,oCAAoC;IACpC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAMD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,OAAO,EACP,SAAgB,EAChB,QAAgB,EAChB,oBAAoB,GACrB,EAAE,qBAAqB,GAAG,oBAAoB,CAqD9C"}
@@ -0,0 +1,63 @@
1
+ import { type RevTurbinePlacementConfig, type RevTurbineSurfaceSlotConfig, type RevTurbinePlacementContent, type RevTurbinePlacementDecision, type RevTurbinePlacementDecisionOverrides, type RevTurbineContextMode } from '../customer-side';
2
+ /**
3
+ * Options for the {@link usePlacement} hook.
4
+ */
5
+ export type UsePlacementOptions = {
6
+ /** Placement configuration (name, scope key, metadata). */
7
+ placement?: RevTurbinePlacementConfig;
8
+ /** Canonical surface slot configuration (preferred over `placement`). */
9
+ surfaceSlot?: RevTurbineSurfaceSlotConfig;
10
+ /** Target user ID. Falls back to the SDK's current user context. */
11
+ userId?: string;
12
+ /** Context resolution mode. Default `'auto'`. */
13
+ contextMode?: RevTurbineContextMode;
14
+ /** Override segment, plan, or usage for testing. */
15
+ overrides?: RevTurbinePlacementDecisionOverrides;
16
+ /** Custom traits to include in the decision request. */
17
+ traits?: Record<string, string | number | boolean>;
18
+ /** Decision cache TTL in milliseconds. */
19
+ ttlMs?: number;
20
+ /** Automatically load a decision on mount. Default `true`. */
21
+ autoLoad?: boolean;
22
+ };
23
+ /**
24
+ * Result returned by the {@link usePlacement} hook.
25
+ */
26
+ export type UsePlacementResult = {
27
+ isLoading: boolean;
28
+ error: string;
29
+ placementId: string;
30
+ visible: boolean;
31
+ decision: RevTurbinePlacementDecision | null;
32
+ content: RevTurbinePlacementContent['content'] | null;
33
+ refresh: () => Promise<void>;
34
+ dismiss: (cooldownMs?: number) => Promise<void>;
35
+ snooze: (seconds?: number) => Promise<void>;
36
+ remindMeLater: (seconds?: number) => Promise<void>;
37
+ ctaClick: (ctaTarget?: string) => Promise<void>;
38
+ ctaComplete: (ctaTarget?: string) => Promise<void>;
39
+ };
40
+ /**
41
+ * React hook for loading a placement decision and managing interactions.
42
+ *
43
+ * Handles registration, decision fetching, impression tracking,
44
+ * and exposes interaction methods (dismiss, remind me later, CTA click/complete).
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * const { visible, content, ctaClick, dismiss } = usePlacement({
49
+ * placement: { name: 'pricing_banner' },
50
+ * userId: 'user_123',
51
+ * });
52
+ *
53
+ * if (!visible) return null;
54
+ * return (
55
+ * <div>
56
+ * <h2>{content?.header}</h2>
57
+ * <button onClick={() => ctaClick()}>{content?.cta_label}</button>
58
+ * </div>
59
+ * );
60
+ * ```
61
+ */
62
+ export declare function usePlacement({ placement, surfaceSlot, userId, contextMode, overrides, traits, ttlMs, autoLoad, }: UsePlacementOptions): UsePlacementResult;
63
+ //# sourceMappingURL=usePlacement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePlacement.d.ts","sourceRoot":"","sources":["../../../../react/usePlacement.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,oCAAoC,EACzC,KAAK,qBAAqB,EAC3B,MAAM,kBAAkB,CAAC;AAI1B;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,2DAA2D;IAC3D,SAAS,CAAC,EAAE,yBAAyB,CAAC;IACtC,yEAAyE;IACzE,WAAW,CAAC,EAAE,2BAA2B,CAAC;IAC1C,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,oDAAoD;IACpD,SAAS,CAAC,EAAE,oCAAoC,CAAC;IACjD,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACnD,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,2BAA2B,GAAG,IAAI,CAAC;IAC7C,OAAO,EAAE,0BAA0B,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IACtD,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,WAAW,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,WAAW,EACX,MAAM,EACN,WAAoB,EACpB,SAAS,EACT,MAAM,EACN,KAAK,EACL,QAAe,GAChB,EAAE,mBAAmB,GAAG,kBAAkB,CA+E1C"}
@@ -0,0 +1,17 @@
1
+ import type { RevTurbineUserContext } from '../customer-side';
2
+ type RevTurbineContextValue = {
3
+ sdk: import('../customer-side').RevTurbineCustomerSdk | null;
4
+ isReady: boolean;
5
+ error: string;
6
+ /**
7
+ * Update the SDK's user context. Merges the provided fields into the
8
+ * existing context and triggers segment re-evaluation.
9
+ *
10
+ * This is the React-side wrapper around `sdk.setUserContext()`.
11
+ */
12
+ setContext: (context: RevTurbineUserContext) => void;
13
+ };
14
+ export declare const RevTurbineContext: import("react").Context<RevTurbineContextValue>;
15
+ export declare function useRevTurbine(): RevTurbineContextValue;
16
+ export {};
17
+ //# sourceMappingURL=useRevTurbine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRevTurbine.d.ts","sourceRoot":"","sources":["../../../../react/useRevTurbine.ts"],"names":[],"mappings":"AACA,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"}
@@ -0,0 +1,7 @@
1
+ import type { RevTurbineUsageSnapshot } from '../customer-side';
2
+ export interface UseUsageSnapshotResult {
3
+ usage: RevTurbineUsageSnapshot;
4
+ refresh: () => void;
5
+ }
6
+ export declare function useUsageSnapshot(): UseUsageSnapshotResult;
7
+ //# sourceMappingURL=useUsageSnapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUsageSnapshot.d.ts","sourceRoot":"","sources":["../../../../react/useUsageSnapshot.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAGhE,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,uBAAuB,CAAC;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,gBAAgB,IAAI,sBAAsB,CAmBzD"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Segment evaluation — re-exported from @revt-eng/core.
3
+ *
4
+ * @see @revt-eng/core/evaluation/segments
5
+ */
6
+ export { evaluateSegments } from '@revt-eng/core';
7
+ export type { Trait } from '@revt-eng/core';
8
+ export type { ExportedConfigSegmentsItem, ExportedConfigSegmentsItemPredicatesItem, } from '@revt-eng/schema';
9
+ //# sourceMappingURL=segments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segments.d.ts","sourceRoot":"","sources":["../../../segments.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,YAAY,EACV,0BAA0B,EAC1B,wCAAwC,GACzC,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Storage abstraction for the RevTurbine web SDK.
3
+ *
4
+ * Re-exports core storage types and adds browser-specific implementations.
5
+ */
6
+ import type { RevTurbineStorage } from '@revt-eng/core';
7
+ export type { RevTurbineStorage } from '@revt-eng/core';
8
+ export { InMemoryStorage } from '@revt-eng/core';
9
+ /**
10
+ * Wraps a browser `Storage` object (`localStorage` or `sessionStorage`)
11
+ * with try/catch guards for quota and security-policy errors.
12
+ */
13
+ export declare class BrowserStorage implements RevTurbineStorage {
14
+ private readonly backend;
15
+ constructor(backend: Storage);
16
+ getItem(key: string): string | null;
17
+ setItem(key: string, value: string): void;
18
+ removeItem(key: string): void;
19
+ }
20
+ /**
21
+ * Resolve a persistent storage provider.
22
+ *
23
+ * Priority:
24
+ * 1. Explicitly provided `storage` (customer override)
25
+ * 2. `localStorage` when running in a browser
26
+ * 3. In-memory fallback
27
+ */
28
+ export declare function resolvePersistentStorage(storage?: RevTurbineStorage): RevTurbineStorage;
29
+ /**
30
+ * Resolve a session-scoped storage provider.
31
+ *
32
+ * Priority:
33
+ * 1. Explicitly provided `storage` (customer override)
34
+ * 2. `sessionStorage` when running in a browser
35
+ * 3. In-memory fallback
36
+ */
37
+ export declare function resolveSessionStorage(storage?: RevTurbineStorage): RevTurbineStorage;
38
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;GAGG;AACH,qBAAa,cAAe,YAAW,iBAAiB;IACtD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBACtB,OAAO,EAAE,OAAO;IAI5B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAOnC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAOzC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAO9B;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CAUvF;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CAUpF"}
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import type { RevTurbineTheme } from './types';
3
+ export interface RevTurbineThemeProviderProps {
4
+ theme: RevTurbineTheme;
5
+ children: React.ReactNode;
6
+ }
7
+ /**
8
+ * Provides the active {@link RevTurbineTheme} to all child SDK components.
9
+ * Typically rendered internally by {@link RevTurbineProvider} — consumers
10
+ * don't need to add this manually.
11
+ */
12
+ export declare function RevTurbineThemeProvider({ theme, children }: RevTurbineThemeProviderProps): React.JSX.Element;
13
+ /**
14
+ * Access the current SDK theme tokens from any component inside a
15
+ * {@link RevTurbineProvider} tree.
16
+ */
17
+ export declare function useRevTurbineTheme(): RevTurbineTheme;
18
+ //# sourceMappingURL=ThemeContext.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,13 @@
1
+ import type { RevTurbineTheme, RevTurbineThemeInput } from './types';
2
+ /**
3
+ * Default theme tokens — matches the original hardcoded styles across all
4
+ * built-in placement components. Serves as the fallback when no custom
5
+ * theme is configured or the theme API is unreachable.
6
+ */
7
+ export declare const DEFAULT_THEME: Readonly<RevTurbineTheme>;
8
+ /**
9
+ * Deep-merge a partial theme input with the default theme, producing a
10
+ * complete {@link RevTurbineTheme}.
11
+ */
12
+ export declare function mergeTheme(input?: RevTurbineThemeInput | null): RevTurbineTheme;
13
+ //# sourceMappingURL=defaults.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,6 @@
1
+ export type { RevTurbineTheme, RevTurbineThemeInput, RevTurbineThemeColors, RevTurbineThemeTypography, RevTurbineThemeShape, RevTurbineThemeShadows, } from './types';
2
+ export { DEFAULT_THEME, mergeTheme } from './defaults';
3
+ export { loadTheme, clearPersistedTheme } from './theme-loader';
4
+ export type { ThemeLoaderOptions } from './theme-loader';
5
+ export { RevTurbineThemeProvider, useRevTurbineTheme } from './ThemeContext';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,26 @@
1
+ import type { RevTurbineTheme } from './types';
2
+ import type { RevTurbineStorage } from '../storage';
3
+ /** Clear persisted theme (useful on identity reset). */
4
+ export declare function clearPersistedTheme(tenantId: string, storage?: RevTurbineStorage): void;
5
+ export interface ThemeLoaderOptions {
6
+ /** RevTurbine tenant identifier. */
7
+ tenantId: string;
8
+ /** Base URL of the RevTurbine API Edge. */
9
+ endpoint: string;
10
+ /** API key for authentication. */
11
+ apiKey: string;
12
+ /** Optional storage provider. Falls back to localStorage in browser, in-memory on server. */
13
+ storage?: RevTurbineStorage;
14
+ }
15
+ /**
16
+ * Load the tenant's theme:
17
+ * 1. Return the locally-persisted theme immediately (fast path).
18
+ * 2. Fetch the latest from the API in the background.
19
+ * 3. If the remote version differs, update local storage and return the new theme.
20
+ *
21
+ * Returns a resolved {@link RevTurbineTheme} (merged with defaults).
22
+ * Also provides an `onUpdate` callback callers can use to react to
23
+ * background refreshes.
24
+ */
25
+ export declare function loadTheme(opts: ThemeLoaderOptions, onUpdate?: (theme: RevTurbineTheme) => void): Promise<RevTurbineTheme>;
26
+ //# sourceMappingURL=theme-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-loader.d.ts","sourceRoot":"","sources":["../../../../theme/theme-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAwB,MAAM,SAAS,CAAC;AAErE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AA+BpD,wDAAwD;AACxD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAOvF;AAED,MAAM,WAAW,kBAAkB;IACjC,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,6FAA6F;IAC7F,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAED;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,kBAAkB,EACxB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GAC1C,OAAO,CAAC,eAAe,CAAC,CAqB1B"}