@revturbine/sdk 0.8.9 → 0.9.1
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 +637 -0
- package/dist/headless.d.ts +34 -54
- package/dist/headless.js +2 -2
- package/dist/headless.js.map +1 -1
- package/dist/index.d.ts +38 -56
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/types/web-sdk/customer-side.d.ts +4 -19
- package/dist/types/web-sdk/customer-side.d.ts.map +1 -1
- package/dist/types/web-sdk/placements/PlacementRenderer.d.ts +4 -2
- package/dist/types/web-sdk/placements/PlacementRenderer.d.ts.map +1 -1
- package/dist/types/web-sdk/placements/cta-resolvers.d.ts.map +1 -1
- package/dist/types/web-sdk/placements/types.d.ts +2 -0
- package/dist/types/web-sdk/placements/types.d.ts.map +1 -1
- package/dist/types/web-sdk/placements/useSurfaceSlot.d.ts.map +1 -1
- package/package.json +6 -5
package/dist/index.d.ts
CHANGED
|
@@ -16536,6 +16536,8 @@ interface RevTurbineTreatmentInteractionInput {
|
|
|
16536
16536
|
interface InteractionState {
|
|
16537
16537
|
/** Unix timestamp (ms) — when suppression expires. */
|
|
16538
16538
|
suppressedUntil?: number;
|
|
16539
|
+
/** Independent system suppression expiry; category exemptions never bypass it. */
|
|
16540
|
+
explicitSuppressedUntil?: number;
|
|
16539
16541
|
/** Type of last interaction. */
|
|
16540
16542
|
lastInteractionType?: RevTurbineTreatmentInteractionType;
|
|
16541
16543
|
/** ISO timestamp of last update. */
|
|
@@ -17170,7 +17172,7 @@ declare class InteractionTracker {
|
|
|
17170
17172
|
/** Track an interaction and update suppression state. */
|
|
17171
17173
|
track(input: RevTurbineTreatmentInteractionInput): void;
|
|
17172
17174
|
/** Check whether a placement is suppressed by a recent interaction. */
|
|
17173
|
-
checkSuppression(placementId: string, userId: string, treatmentId?: string): SuppressionResult;
|
|
17175
|
+
checkSuppression(placementId: string, userId: string, treatmentId?: string, category?: string): SuppressionResult;
|
|
17174
17176
|
/** Clear suppression state for a specific placement. */
|
|
17175
17177
|
clearSuppression(placementId: string, userId: string, treatmentId?: string): void;
|
|
17176
17178
|
/** Load state from storage. Called automatically on construction. */
|
|
@@ -17252,11 +17254,11 @@ interface EvaluationContext {
|
|
|
17252
17254
|
* DecisionEngine — isomorphic placement decision pipeline.
|
|
17253
17255
|
*
|
|
17254
17256
|
* Runs the full decision flow:
|
|
17255
|
-
* 1.
|
|
17256
|
-
* 2.
|
|
17257
|
-
* 3.
|
|
17258
|
-
* 4.
|
|
17259
|
-
* 5.
|
|
17257
|
+
* 1. Resolve domain providers (DomainProviderRegistry)
|
|
17258
|
+
* 2. Evaluate segments
|
|
17259
|
+
* 3. Match entitlement rules
|
|
17260
|
+
* 4. Resolve placement (local resolver or pre-resolved output)
|
|
17261
|
+
* 5. Apply category-aware interaction suppression (InteractionTracker)
|
|
17260
17262
|
* 6. Enforce presentation caps (CapEnforcer)
|
|
17261
17263
|
* 7. Return decision
|
|
17262
17264
|
*
|
|
@@ -17288,8 +17290,8 @@ declare class DecisionEngine {
|
|
|
17288
17290
|
/**
|
|
17289
17291
|
* Evaluate a single placement decision.
|
|
17290
17292
|
*
|
|
17291
|
-
* Full pipeline:
|
|
17292
|
-
*
|
|
17293
|
+
* Full pipeline: provider resolution → segment evaluation → local resolver →
|
|
17294
|
+
* category-aware suppression → cap enforcement → decision.
|
|
17293
17295
|
*/
|
|
17294
17296
|
evaluate(input: RevTurbinePlacementDecisionInput): Promise<RevTurbinePlacementDecision>;
|
|
17295
17297
|
/**
|
|
@@ -17318,9 +17320,8 @@ declare class DecisionEngine {
|
|
|
17318
17320
|
* Impression history types.
|
|
17319
17321
|
*
|
|
17320
17322
|
* Tracks placement impressions and interactions (dismiss, click-through,
|
|
17321
|
-
* conversion, suppress)
|
|
17322
|
-
*
|
|
17323
|
-
* cooldown window for a dismiss / bare click / system suppression.
|
|
17323
|
+
* conversion, suppress) for analytics and dismiss / bare click / system
|
|
17324
|
+
* suppression windows. Conversion does not change placement eligibility.
|
|
17324
17325
|
*/
|
|
17325
17326
|
/**
|
|
17326
17327
|
* Interaction outcomes tracked by the impression history system.
|
|
@@ -17332,12 +17333,11 @@ declare class DecisionEngine {
|
|
|
17332
17333
|
* "Cooldown After Dismiss". NOT permanent.
|
|
17333
17334
|
* - `'clicked_thru'` — user clicked the CTA but did **not** confirm completion
|
|
17334
17335
|
* (e.g. abandoned checkout). Time-boxed like a dismiss — they may return.
|
|
17335
|
-
* - `'cta_completed'` —
|
|
17336
|
-
*
|
|
17336
|
+
* - `'cta_completed'` — confirmed conversion analytics. Current targeting
|
|
17337
|
+
* determines whether the placement remains applicable.
|
|
17337
17338
|
* - `'suppressed'` — system or admin suppressed the placement (time-based).
|
|
17338
17339
|
*
|
|
17339
|
-
*
|
|
17340
|
-
* or a bare click is a cooldown.
|
|
17340
|
+
* Plan 254 supersedes plan 167's conversion retirement policy.
|
|
17341
17341
|
*/
|
|
17342
17342
|
type ImpressionOutcome = 'impressed' | 'dismissed' | 'clicked_thru' | 'cta_completed' | 'suppressed';
|
|
17343
17343
|
/**
|
|
@@ -17383,10 +17383,8 @@ interface ImpressionHistoryStore {
|
|
|
17383
17383
|
*/
|
|
17384
17384
|
query(userId: string, query?: ImpressionQuery): ImpressionRecord[] | Promise<ImpressionRecord[]>;
|
|
17385
17385
|
/**
|
|
17386
|
-
*
|
|
17387
|
-
*
|
|
17388
|
-
*
|
|
17389
|
-
* This is the hot-path check used by the resolver.
|
|
17386
|
+
* @deprecated Conversion no longer retires placements. Built-in stores return
|
|
17387
|
+
* an empty set; the resolver does not consult custom retirement indexes.
|
|
17390
17388
|
*/
|
|
17391
17389
|
getRetiredPlacementIds(userId: string): Set<string> | Promise<Set<string>>;
|
|
17392
17390
|
/**
|
|
@@ -17404,8 +17402,8 @@ interface ImpressionHistoryStore {
|
|
|
17404
17402
|
* ImpressionHistory — records and queries placement impression/interaction history.
|
|
17405
17403
|
*
|
|
17406
17404
|
* Wraps an ImpressionHistoryStore backend and provides a clean API for:
|
|
17407
|
-
* - Recording impressions and
|
|
17408
|
-
* - Checking
|
|
17405
|
+
* - Recording impressions and interactions, including conversion analytics.
|
|
17406
|
+
* - Checking active dismissal and suppression windows.
|
|
17409
17407
|
* - Querying full history for debugging / analytics.
|
|
17410
17408
|
*
|
|
17411
17409
|
* Isomorphic: works with any store backend (in-memory, localStorage, Postgres).
|
|
@@ -17430,15 +17428,13 @@ declare class ImpressionHistory {
|
|
|
17430
17428
|
private userId;
|
|
17431
17429
|
private readonly defaultSuppressionMs;
|
|
17432
17430
|
private readonly defaultDismissCooldownMs;
|
|
17433
|
-
/**
|
|
17434
|
-
* Hot cache of permanently retired placement IDs (confirmed conversions).
|
|
17435
|
-
*/
|
|
17436
|
-
private retiredCache;
|
|
17437
17431
|
/**
|
|
17438
17432
|
* Hot cache of time-suppressed placement IDs → suppressUntil ISO timestamp.
|
|
17439
17433
|
* Covers dismiss / bare-click cooldowns and system suppressions.
|
|
17440
17434
|
*/
|
|
17441
17435
|
private suppressedCache;
|
|
17436
|
+
/** Derived from existing explicit suppression records; never persisted separately. */
|
|
17437
|
+
private explicitSuppressedCache;
|
|
17442
17438
|
constructor(options: ImpressionHistoryOptions);
|
|
17443
17439
|
/**
|
|
17444
17440
|
* Record an impression — the placement was shown to the user.
|
|
@@ -17466,7 +17462,7 @@ declare class ImpressionHistory {
|
|
|
17466
17462
|
recordClickThru(placementId: string, payloadId?: string, surfaceTemplateId?: string, metadata?: Record<string, unknown>, cooldownMs?: number): Promise<void>;
|
|
17467
17463
|
/**
|
|
17468
17464
|
* Record a confirmed conversion — the user completed the CTA action.
|
|
17469
|
-
*
|
|
17465
|
+
* Analytics only: current targeting determines future eligibility (plan 254).
|
|
17470
17466
|
*/
|
|
17471
17467
|
recordConversion(placementId: string, payloadId?: string, surfaceTemplateId?: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
17472
17468
|
/**
|
|
@@ -17477,17 +17473,15 @@ declare class ImpressionHistory {
|
|
|
17477
17473
|
*/
|
|
17478
17474
|
recordSuppression(placementId: string, payloadId?: string, surfaceTemplateId?: string, metadata?: Record<string, unknown>, durationMs?: number): Promise<void>;
|
|
17479
17475
|
/**
|
|
17480
|
-
*
|
|
17476
|
+
* @deprecated Placements are no longer retired by conversion. Always false.
|
|
17481
17477
|
*/
|
|
17482
17478
|
isRetired(placementId: string): Promise<boolean>;
|
|
17483
17479
|
/**
|
|
17484
|
-
*
|
|
17485
|
-
* Caches the result for synchronous access via `isRetiredSync()`.
|
|
17480
|
+
* @deprecated Placements are no longer retired by conversion. Always empty.
|
|
17486
17481
|
*/
|
|
17487
17482
|
getRetiredIds(): Promise<Set<string>>;
|
|
17488
17483
|
/**
|
|
17489
|
-
*
|
|
17490
|
-
* has populated the cache. Returns `false` if the cache is cold.
|
|
17484
|
+
* @deprecated Placements are no longer retired by conversion. Always false.
|
|
17491
17485
|
*/
|
|
17492
17486
|
isRetiredSync(placementId: string): boolean;
|
|
17493
17487
|
/**
|
|
@@ -17496,15 +17490,15 @@ declare class ImpressionHistory {
|
|
|
17496
17490
|
*/
|
|
17497
17491
|
isSuppressedSync(placementId: string): boolean;
|
|
17498
17492
|
/**
|
|
17499
|
-
* Synchronous check: placement
|
|
17493
|
+
* Synchronous check: placement is within an active suppression window.
|
|
17500
17494
|
*/
|
|
17501
|
-
isHiddenSync(placementId: string): boolean;
|
|
17495
|
+
isHiddenSync(placementId: string, category?: string): boolean;
|
|
17502
17496
|
/**
|
|
17503
17497
|
* Query full history (for debugging, analytics, or inspector panels).
|
|
17504
17498
|
*/
|
|
17505
17499
|
queryHistory(query?: ImpressionQuery): Promise<ImpressionRecord[]>;
|
|
17506
17500
|
/**
|
|
17507
|
-
* Pre-warm the
|
|
17501
|
+
* Pre-warm the suppression cache from the store.
|
|
17508
17502
|
* Call during SDK initialization for synchronous access.
|
|
17509
17503
|
*/
|
|
17510
17504
|
hydrate(): Promise<void>;
|
|
@@ -17517,7 +17511,6 @@ declare class ImpressionHistory {
|
|
|
17517
17511
|
*/
|
|
17518
17512
|
setUserId(userId: string): void;
|
|
17519
17513
|
private appendRecord;
|
|
17520
|
-
private retireInCache;
|
|
17521
17514
|
private suppressInCache;
|
|
17522
17515
|
}
|
|
17523
17516
|
|
|
@@ -18479,6 +18472,8 @@ interface CtaResolverContext {
|
|
|
18479
18472
|
placement: PlacementOutput;
|
|
18480
18473
|
/** Which CTA fired — the primary button or a secondary action. */
|
|
18481
18474
|
kind: 'primary' | 'secondary';
|
|
18475
|
+
/** Report snooze through the mounted controller and close this occurrence. */
|
|
18476
|
+
remindLater?: (seconds?: number) => void;
|
|
18482
18477
|
}
|
|
18483
18478
|
/**
|
|
18484
18479
|
* A resolver bound to a CTA action type via `registerCtaResolver`.
|
|
@@ -21106,7 +21101,7 @@ declare class RevTurbineCustomerSdk {
|
|
|
21106
21101
|
private interactionStateKey;
|
|
21107
21102
|
private readDecisionCache;
|
|
21108
21103
|
private writeDecisionCache;
|
|
21109
|
-
private
|
|
21104
|
+
private gateDecisionByInteraction;
|
|
21110
21105
|
private placementCapKey;
|
|
21111
21106
|
private extractPlacementCapPolicies;
|
|
21112
21107
|
private applyPlacementCapsIfNeeded;
|
|
@@ -21379,8 +21374,8 @@ declare class RevTurbineCustomerSdk {
|
|
|
21379
21374
|
recordClickThru(placementId: string, payloadId?: string, surfaceTemplateId?: string, metadata?: RevTurbineImpressionMetadata, cooldownMs?: number): Promise<void>;
|
|
21380
21375
|
/**
|
|
21381
21376
|
* Record a confirmed conversion — the user completed the CTA action. The
|
|
21382
|
-
*
|
|
21383
|
-
*
|
|
21377
|
+
* record is retained for analytics. Future eligibility is evaluated from
|
|
21378
|
+
* the current UserContext and Playbook.
|
|
21384
21379
|
*
|
|
21385
21380
|
* @param placementId - The placement's stable rule_id.
|
|
21386
21381
|
* @param payloadId - Optional payload variant id.
|
|
@@ -21440,22 +21435,7 @@ declare class RevTurbineCustomerSdk {
|
|
|
21440
21435
|
* throwOnMissing: true })` remains the strict opt-in.
|
|
21441
21436
|
*/
|
|
21442
21437
|
private warnOnUiPathResolverCoverageGaps;
|
|
21443
|
-
/**
|
|
21444
|
-
* Route an output-addressed interaction through the one interaction path.
|
|
21445
|
-
*
|
|
21446
|
-
* Plan 233 TASK-14. These three methods each emitted a `placement_interaction`
|
|
21447
|
-
* event and stopped, so none of them wrote any terminal state:
|
|
21448
|
-
* `sdk.dismiss()` did not suppress, and `sdk.convert()` did not retire. Only
|
|
21449
|
-
* the controller path (`trackTreatmentInteraction`) ever did, which is why the
|
|
21450
|
-
* defect was invisible to every React integration test.
|
|
21451
|
-
*
|
|
21452
|
-
* The public API takes an **output** id while every terminal-state write is
|
|
21453
|
-
* keyed by the **placement** id, so the output is resolved through
|
|
21454
|
-
* `outputPlacementIndex`. When it cannot be resolved — an output this SDK
|
|
21455
|
-
* instance never decided, or one evicted from a very long session — we emit
|
|
21456
|
-
* the bare event as before and say so. Silently doing nothing is what shipped;
|
|
21457
|
-
* being loud about the one case we cannot serve is the point.
|
|
21458
|
-
*/
|
|
21438
|
+
/** Route output-addressed callbacks through the canonical interaction/analytics path. */
|
|
21459
21439
|
private trackOutputInteraction;
|
|
21460
21440
|
dismiss(outputId: string): Promise<void>;
|
|
21461
21441
|
snooze(outputId: string, seconds?: number): Promise<void>;
|
|
@@ -27809,7 +27789,9 @@ interface PlacementRendererProps {
|
|
|
27809
27789
|
* dismissible slots render a defer control; omit it and no defer control
|
|
27810
27790
|
* appears (plan 167 REQ-7). Additive/opt-in.
|
|
27811
27791
|
*/
|
|
27812
|
-
onRemindLater?: (outputId: string) => void;
|
|
27792
|
+
onRemindLater?: (outputId: string, seconds?: number) => void;
|
|
27793
|
+
/** Handle an authored snooze CTA without enabling an extra defer control. */
|
|
27794
|
+
onSnooze?: (outputId: string, seconds?: number) => void;
|
|
27813
27795
|
/** Callback fired once when the placement is first rendered visible. */
|
|
27814
27796
|
onImpression?: (outputId: string) => void;
|
|
27815
27797
|
/**
|
|
@@ -27841,7 +27823,7 @@ interface PlacementRendererProps {
|
|
|
27841
27823
|
* - UI path and promotion parsing
|
|
27842
27824
|
* - CTA and dismiss callback wiring
|
|
27843
27825
|
*/
|
|
27844
|
-
declare function PlacementRenderer({ placement, personalization, registry, acceptedComponentTypes, ctaResolvers, onCtaClick, onSecondaryCtaClick, onDismiss, onRemindLater, onImpression, exposureRef, visible, className, style, fallback, }: PlacementRendererProps): React__default.JSX.Element;
|
|
27826
|
+
declare function PlacementRenderer({ placement, personalization, registry, acceptedComponentTypes, ctaResolvers, onCtaClick, onSecondaryCtaClick, onDismiss, onRemindLater, onSnooze, onImpression, exposureRef, visible, className, style, fallback, }: PlacementRendererProps): React__default.JSX.Element;
|
|
27845
27827
|
declare namespace PlacementRenderer {
|
|
27846
27828
|
var displayName: string;
|
|
27847
27829
|
}
|