@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.
@@ -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. Check dismissal suppression (InteractionTracker)
17256
- * 2. Resolve domain providers (DomainProviderRegistry)
17257
- * 3. Evaluate segments
17258
- * 4. Match entitlement rules
17259
- * 5. Resolve placement (local resolver or pre-resolved output)
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: suppression check → provider resolution → segment evaluation →
17292
- * local resolver → cap enforcement → decision.
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) so the decision engine can exclude placements the user
17322
- * has already acted on — permanently for a confirmed conversion, or for a
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'` — user confirmed the conversion action. **Permanent** —
17336
- * a converted user never sees the upsell again.
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
- * See plan 167 (Q-1 ruling): only a confirmed conversion is terminal; a dismiss
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
- * Return the set of placement IDs that have a terminal outcome
17387
- * for this user (`cta_completed` — a confirmed conversion).
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 terminal interactions.
17408
- * - Checking whether a placement is retired (should never be shown again).
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
- * The placement is **permanently** retired for this user (plan 167, Q-1).
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
- * Check whether a placement has been permanently retired for this user.
17476
+ * @deprecated Placements are no longer retired by conversion. Always false.
17481
17477
  */
17482
17478
  isRetired(placementId: string): Promise<boolean>;
17483
17479
  /**
17484
- * Return the set of placement IDs retired for this user.
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
- * Synchronous check — only valid after `getRetiredIds()` or a recording call
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 should not be shown (retired OR suppressed).
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 retired and suppressed caches from the store.
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
 
@@ -18434,6 +18427,8 @@ interface CtaResolverContext {
18434
18427
  placement: PlacementOutput;
18435
18428
  /** Which CTA fired — the primary button or a secondary action. */
18436
18429
  kind: 'primary' | 'secondary';
18430
+ /** Report snooze through the mounted controller and close this occurrence. */
18431
+ remindLater?: (seconds?: number) => void;
18437
18432
  }
18438
18433
  /**
18439
18434
  * Promotion attached to a placement payload.
@@ -20914,7 +20909,7 @@ declare class RevTurbineCustomerSdk {
20914
20909
  private interactionStateKey;
20915
20910
  private readDecisionCache;
20916
20911
  private writeDecisionCache;
20917
- private suppressionForState;
20912
+ private gateDecisionByInteraction;
20918
20913
  private placementCapKey;
20919
20914
  private extractPlacementCapPolicies;
20920
20915
  private applyPlacementCapsIfNeeded;
@@ -21187,8 +21182,8 @@ declare class RevTurbineCustomerSdk {
21187
21182
  recordClickThru(placementId: string, payloadId?: string, surfaceTemplateId?: string, metadata?: RevTurbineImpressionMetadata, cooldownMs?: number): Promise<void>;
21188
21183
  /**
21189
21184
  * Record a confirmed conversion — the user completed the CTA action. The
21190
- * placement is **permanently** retired for this user; subsequent
21191
- * `getPlacementDecision` calls return `visible: false` for good (plan 167).
21185
+ * record is retained for analytics. Future eligibility is evaluated from
21186
+ * the current UserContext and Playbook.
21192
21187
  *
21193
21188
  * @param placementId - The placement's stable rule_id.
21194
21189
  * @param payloadId - Optional payload variant id.
@@ -21248,22 +21243,7 @@ declare class RevTurbineCustomerSdk {
21248
21243
  * throwOnMissing: true })` remains the strict opt-in.
21249
21244
  */
21250
21245
  private warnOnUiPathResolverCoverageGaps;
21251
- /**
21252
- * Route an output-addressed interaction through the one interaction path.
21253
- *
21254
- * Plan 233 TASK-14. These three methods each emitted a `placement_interaction`
21255
- * event and stopped, so none of them wrote any terminal state:
21256
- * `sdk.dismiss()` did not suppress, and `sdk.convert()` did not retire. Only
21257
- * the controller path (`trackTreatmentInteraction`) ever did, which is why the
21258
- * defect was invisible to every React integration test.
21259
- *
21260
- * The public API takes an **output** id while every terminal-state write is
21261
- * keyed by the **placement** id, so the output is resolved through
21262
- * `outputPlacementIndex`. When it cannot be resolved — an output this SDK
21263
- * instance never decided, or one evicted from a very long session — we emit
21264
- * the bare event as before and say so. Silently doing nothing is what shipped;
21265
- * being loud about the one case we cannot serve is the point.
21266
- */
21246
+ /** Route output-addressed callbacks through the canonical interaction/analytics path. */
21267
21247
  private trackOutputInteraction;
21268
21248
  dismiss(outputId: string): Promise<void>;
21269
21249
  snooze(outputId: string, seconds?: number): Promise<void>;