@revturbine/sdk 0.11.5 → 0.11.7

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.
@@ -3579,6 +3579,138 @@ declare const AnalyticsCatalogConceptSchema: z.ZodObject<{
3579
3579
  }>>;
3580
3580
  }, z.core.$strip>>;
3581
3581
  livemode_qualified: z.ZodOptional<z.ZodBoolean>;
3582
+ record_contract: z.ZodOptional<z.ZodObject<{
3583
+ record_id: z.ZodArray<z.ZodString>;
3584
+ source_namespace: z.ZodString;
3585
+ occurred_time_field: z.ZodString;
3586
+ received_time_field: z.ZodOptional<z.ZodString>;
3587
+ dedup: z.ZodEnum<{
3588
+ unknown: "unknown";
3589
+ deduplicated_on_record_id: "deduplicated_on_record_id";
3590
+ summed_on_sorting_key: "summed_on_sorting_key";
3591
+ append_only: "append_only";
3592
+ upsert_on_primary_key: "upsert_on_primary_key";
3593
+ recomputed_at_query: "recomputed_at_query";
3594
+ }>;
3595
+ revision: z.ZodEnum<{
3596
+ unknown: "unknown";
3597
+ immutable: "immutable";
3598
+ re_emit_higher_version: "re_emit_higher_version";
3599
+ in_place_update: "in_place_update";
3600
+ recomputed_from_source: "recomputed_from_source";
3601
+ }>;
3602
+ late_arrival: z.ZodEnum<{
3603
+ unknown: "unknown";
3604
+ accepted: "accepted";
3605
+ accepted_within_retention: "accepted_within_retention";
3606
+ rejected: "rejected";
3607
+ }>;
3608
+ correlation_keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
3609
+ livemode_field: z.ZodOptional<z.ZodString>;
3610
+ policy_version_fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
3611
+ note: z.ZodOptional<z.ZodString>;
3612
+ }, z.core.$strip>>;
3613
+ keys: z.ZodOptional<z.ZodArray<z.ZodObject<{
3614
+ key: z.ZodString;
3615
+ path: z.ZodString;
3616
+ resolution: z.ZodEnum<{
3617
+ source: "source";
3618
+ enriched: "enriched";
3619
+ absent: "absent";
3620
+ }>;
3621
+ note: z.ZodOptional<z.ZodString>;
3622
+ }, z.core.$strip>>>;
3623
+ measures: z.ZodOptional<z.ZodArray<z.ZodObject<{
3624
+ name: z.ZodString;
3625
+ source: z.ZodString;
3626
+ unit: z.ZodEnum<{
3627
+ count: "count";
3628
+ ratio: "ratio";
3629
+ seconds: "seconds";
3630
+ currency_minor: "currency_minor";
3631
+ timestamp: "timestamp";
3632
+ usage_unit: "usage_unit";
3633
+ polymorphic: "polymorphic";
3634
+ }>;
3635
+ temporal: z.ZodEnum<{
3636
+ stock: "stock";
3637
+ flow: "flow";
3638
+ gauge: "gauge";
3639
+ }>;
3640
+ sign: z.ZodEnum<{
3641
+ signed: "signed";
3642
+ positive_magnitude: "positive_magnitude";
3643
+ unsigned: "unsigned";
3644
+ }>;
3645
+ aggregation_semantics: z.ZodEnum<{
3646
+ additive: "additive";
3647
+ semi_additive: "semi_additive";
3648
+ non_additive: "non_additive";
3649
+ }>;
3650
+ note: z.ZodOptional<z.ZodString>;
3651
+ }, z.core.$strip>>>;
3652
+ event_attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
3653
+ name: z.ZodString;
3654
+ path: z.ZodString;
3655
+ note: z.ZodOptional<z.ZodString>;
3656
+ }, z.core.$strip>>>;
3657
+ sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
3658
+ kind: z.ZodEnum<{
3659
+ unavailable: "unavailable";
3660
+ ingested_event: "ingested_event";
3661
+ datasource: "datasource";
3662
+ control_plane_table: "control_plane_table";
3663
+ build: "build";
3664
+ }>;
3665
+ ref: z.ZodString;
3666
+ blocker: z.ZodOptional<z.ZodString>;
3667
+ note: z.ZodOptional<z.ZodString>;
3668
+ }, z.core.$strip>>>;
3669
+ build: z.ZodOptional<z.ZodObject<{
3670
+ kind: z.ZodEnum<{
3671
+ pipe: "pipe";
3672
+ unavailable: "unavailable";
3673
+ materialized_view: "materialized_view";
3674
+ worker: "worker";
3675
+ query_time: "query_time";
3676
+ }>;
3677
+ ref: z.ZodString;
3678
+ inputs: z.ZodArray<z.ZodString>;
3679
+ blocker: z.ZodOptional<z.ZodString>;
3680
+ }, z.core.$strip>>;
3681
+ maturity: z.ZodOptional<z.ZodObject<{
3682
+ status: z.ZodEnum<{
3683
+ unavailable: "unavailable";
3684
+ declared: "declared";
3685
+ }>;
3686
+ horizon_field: z.ZodOptional<z.ZodString>;
3687
+ observed_through_field: z.ZodOptional<z.ZodString>;
3688
+ blocker: z.ZodOptional<z.ZodString>;
3689
+ }, z.core.$strip>>;
3690
+ oracle_family: z.ZodOptional<z.ZodObject<{
3691
+ family: z.ZodEnum<{
3692
+ none: "none";
3693
+ funnel: "funnel";
3694
+ revenue: "revenue";
3695
+ gate: "gate";
3696
+ presentation: "presentation";
3697
+ attribution: "attribution";
3698
+ event_count: "event_count";
3699
+ cohort: "cohort";
3700
+ read_through: "read_through";
3701
+ }>;
3702
+ blocker: z.ZodOptional<z.ZodString>;
3703
+ }, z.core.$strip>>;
3704
+ policy_dependencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
3705
+ kind: z.ZodEnum<{
3706
+ attribution: "attribution";
3707
+ mrr: "mrr";
3708
+ lifecycle: "lifecycle";
3709
+ engagement: "engagement";
3710
+ }>;
3711
+ stamped: z.ZodBoolean;
3712
+ blocker: z.ZodOptional<z.ZodString>;
3713
+ }, z.core.$strip>>>;
3582
3714
  deprecation: z.ZodOptional<z.ZodObject<{
3583
3715
  deprecated: z.ZodBoolean;
3584
3716
  replaced_by: z.ZodOptional<z.ZodString>;
@@ -5768,6 +5900,138 @@ declare const AnalyticsCatalogSchema: z.ZodObject<{
5768
5900
  }>>;
5769
5901
  }, z.core.$strip>>;
5770
5902
  livemode_qualified: z.ZodOptional<z.ZodBoolean>;
5903
+ record_contract: z.ZodOptional<z.ZodObject<{
5904
+ record_id: z.ZodArray<z.ZodString>;
5905
+ source_namespace: z.ZodString;
5906
+ occurred_time_field: z.ZodString;
5907
+ received_time_field: z.ZodOptional<z.ZodString>;
5908
+ dedup: z.ZodEnum<{
5909
+ unknown: "unknown";
5910
+ deduplicated_on_record_id: "deduplicated_on_record_id";
5911
+ summed_on_sorting_key: "summed_on_sorting_key";
5912
+ append_only: "append_only";
5913
+ upsert_on_primary_key: "upsert_on_primary_key";
5914
+ recomputed_at_query: "recomputed_at_query";
5915
+ }>;
5916
+ revision: z.ZodEnum<{
5917
+ unknown: "unknown";
5918
+ immutable: "immutable";
5919
+ re_emit_higher_version: "re_emit_higher_version";
5920
+ in_place_update: "in_place_update";
5921
+ recomputed_from_source: "recomputed_from_source";
5922
+ }>;
5923
+ late_arrival: z.ZodEnum<{
5924
+ unknown: "unknown";
5925
+ accepted: "accepted";
5926
+ accepted_within_retention: "accepted_within_retention";
5927
+ rejected: "rejected";
5928
+ }>;
5929
+ correlation_keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
5930
+ livemode_field: z.ZodOptional<z.ZodString>;
5931
+ policy_version_fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
5932
+ note: z.ZodOptional<z.ZodString>;
5933
+ }, z.core.$strip>>;
5934
+ keys: z.ZodOptional<z.ZodArray<z.ZodObject<{
5935
+ key: z.ZodString;
5936
+ path: z.ZodString;
5937
+ resolution: z.ZodEnum<{
5938
+ source: "source";
5939
+ enriched: "enriched";
5940
+ absent: "absent";
5941
+ }>;
5942
+ note: z.ZodOptional<z.ZodString>;
5943
+ }, z.core.$strip>>>;
5944
+ measures: z.ZodOptional<z.ZodArray<z.ZodObject<{
5945
+ name: z.ZodString;
5946
+ source: z.ZodString;
5947
+ unit: z.ZodEnum<{
5948
+ count: "count";
5949
+ ratio: "ratio";
5950
+ seconds: "seconds";
5951
+ currency_minor: "currency_minor";
5952
+ timestamp: "timestamp";
5953
+ usage_unit: "usage_unit";
5954
+ polymorphic: "polymorphic";
5955
+ }>;
5956
+ temporal: z.ZodEnum<{
5957
+ stock: "stock";
5958
+ flow: "flow";
5959
+ gauge: "gauge";
5960
+ }>;
5961
+ sign: z.ZodEnum<{
5962
+ signed: "signed";
5963
+ positive_magnitude: "positive_magnitude";
5964
+ unsigned: "unsigned";
5965
+ }>;
5966
+ aggregation_semantics: z.ZodEnum<{
5967
+ additive: "additive";
5968
+ semi_additive: "semi_additive";
5969
+ non_additive: "non_additive";
5970
+ }>;
5971
+ note: z.ZodOptional<z.ZodString>;
5972
+ }, z.core.$strip>>>;
5973
+ event_attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
5974
+ name: z.ZodString;
5975
+ path: z.ZodString;
5976
+ note: z.ZodOptional<z.ZodString>;
5977
+ }, z.core.$strip>>>;
5978
+ sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
5979
+ kind: z.ZodEnum<{
5980
+ unavailable: "unavailable";
5981
+ ingested_event: "ingested_event";
5982
+ datasource: "datasource";
5983
+ control_plane_table: "control_plane_table";
5984
+ build: "build";
5985
+ }>;
5986
+ ref: z.ZodString;
5987
+ blocker: z.ZodOptional<z.ZodString>;
5988
+ note: z.ZodOptional<z.ZodString>;
5989
+ }, z.core.$strip>>>;
5990
+ build: z.ZodOptional<z.ZodObject<{
5991
+ kind: z.ZodEnum<{
5992
+ pipe: "pipe";
5993
+ unavailable: "unavailable";
5994
+ materialized_view: "materialized_view";
5995
+ worker: "worker";
5996
+ query_time: "query_time";
5997
+ }>;
5998
+ ref: z.ZodString;
5999
+ inputs: z.ZodArray<z.ZodString>;
6000
+ blocker: z.ZodOptional<z.ZodString>;
6001
+ }, z.core.$strip>>;
6002
+ maturity: z.ZodOptional<z.ZodObject<{
6003
+ status: z.ZodEnum<{
6004
+ unavailable: "unavailable";
6005
+ declared: "declared";
6006
+ }>;
6007
+ horizon_field: z.ZodOptional<z.ZodString>;
6008
+ observed_through_field: z.ZodOptional<z.ZodString>;
6009
+ blocker: z.ZodOptional<z.ZodString>;
6010
+ }, z.core.$strip>>;
6011
+ oracle_family: z.ZodOptional<z.ZodObject<{
6012
+ family: z.ZodEnum<{
6013
+ none: "none";
6014
+ funnel: "funnel";
6015
+ revenue: "revenue";
6016
+ gate: "gate";
6017
+ presentation: "presentation";
6018
+ attribution: "attribution";
6019
+ event_count: "event_count";
6020
+ cohort: "cohort";
6021
+ read_through: "read_through";
6022
+ }>;
6023
+ blocker: z.ZodOptional<z.ZodString>;
6024
+ }, z.core.$strip>>;
6025
+ policy_dependencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
6026
+ kind: z.ZodEnum<{
6027
+ attribution: "attribution";
6028
+ mrr: "mrr";
6029
+ lifecycle: "lifecycle";
6030
+ engagement: "engagement";
6031
+ }>;
6032
+ stamped: z.ZodBoolean;
6033
+ blocker: z.ZodOptional<z.ZodString>;
6034
+ }, z.core.$strip>>>;
5771
6035
  deprecation: z.ZodOptional<z.ZodObject<{
5772
6036
  deprecated: z.ZodBoolean;
5773
6037
  replaced_by: z.ZodOptional<z.ZodString>;
@@ -7957,9 +8221,9 @@ declare const WebhookProcessingStatusSchema: z.ZodEnum<{
7957
8221
  */
7958
8222
  declare const WebhookDispatchStatusSchema: z.ZodEnum<{
7959
8223
  unknown: "unknown";
8224
+ accepted: "accepted";
7960
8225
  failed: "failed";
7961
8226
  pending: "pending";
7962
- accepted: "accepted";
7963
8227
  terminal: "terminal";
7964
8228
  not_required: "not_required";
7965
8229
  dispatching: "dispatching";
@@ -8015,9 +8279,9 @@ declare const WebhookDeliverySchema: z.ZodObject<{
8015
8279
  }>>;
8016
8280
  dispatch_status: z.ZodDefault<z.ZodEnum<{
8017
8281
  unknown: "unknown";
8282
+ accepted: "accepted";
8018
8283
  failed: "failed";
8019
8284
  pending: "pending";
8020
- accepted: "accepted";
8021
8285
  terminal: "terminal";
8022
8286
  not_required: "not_required";
8023
8287
  dispatching: "dispatching";
@@ -9170,6 +9434,9 @@ declare const TrialInstanceSchema: z.ZodObject<{
9170
9434
  usage_limit_value: z.ZodOptional<z.ZodNumber>;
9171
9435
  converted_at: z.ZodDefault<z.ZodNullable<z.ZodString>>;
9172
9436
  cancelled_at: z.ZodDefault<z.ZodNullable<z.ZodString>>;
9437
+ trial_episode_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9438
+ stripe_subscription_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9439
+ actual_end_at: z.ZodDefault<z.ZodNullable<z.ZodString>>;
9173
9440
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
9174
9441
  }, z.core.$strip>;
9175
9442
  declare const trialPaths: ZodOpenApiPathsObject;
@@ -15736,12 +16003,12 @@ declare const ServerEvaluationPayloadSchema: z.ZodObject<{
15736
16003
 
15737
16004
  declare const PlaybookVersionStatusSchema: z.ZodEnum<{
15738
16005
  draft: "draft";
16006
+ rejected: "rejected";
15739
16007
  archived: "archived";
15740
16008
  awaiting_approval: "awaiting_approval";
15741
16009
  approved: "approved";
15742
16010
  deploying: "deploying";
15743
16011
  deployed: "deployed";
15744
- rejected: "rejected";
15745
16012
  }>;
15746
16013
  declare const PlaybookVersionSchema: z.ZodObject<{
15747
16014
  id: z.ZodString;
@@ -15753,12 +16020,12 @@ declare const PlaybookVersionSchema: z.ZodObject<{
15753
16020
  description: z.ZodOptional<z.ZodString>;
15754
16021
  status: z.ZodDefault<z.ZodEnum<{
15755
16022
  draft: "draft";
16023
+ rejected: "rejected";
15756
16024
  archived: "archived";
15757
16025
  awaiting_approval: "awaiting_approval";
15758
16026
  approved: "approved";
15759
16027
  deploying: "deploying";
15760
16028
  deployed: "deployed";
15761
- rejected: "rejected";
15762
16029
  }>>;
15763
16030
  labels: z.ZodDefault<z.ZodArray<z.ZodString>>;
15764
16031
  created_by: z.ZodString;
@@ -16269,9 +16536,9 @@ declare const AuthMemberSchema: z.ZodObject<{
16269
16536
  declare const InvitationStatusSchema: z.ZodEnum<{
16270
16537
  canceled: "canceled";
16271
16538
  expired: "expired";
16272
- pending: "pending";
16273
16539
  accepted: "accepted";
16274
16540
  rejected: "rejected";
16541
+ pending: "pending";
16275
16542
  }>;
16276
16543
  declare const AuthInvitationSchema: z.ZodObject<{
16277
16544
  id: z.ZodString;
@@ -16286,9 +16553,9 @@ declare const AuthInvitationSchema: z.ZodObject<{
16286
16553
  status: z.ZodDefault<z.ZodEnum<{
16287
16554
  canceled: "canceled";
16288
16555
  expired: "expired";
16289
- pending: "pending";
16290
16556
  accepted: "accepted";
16291
16557
  rejected: "rejected";
16558
+ pending: "pending";
16292
16559
  }>>;
16293
16560
  expires_at: z.ZodString;
16294
16561
  created_at: z.ZodString;
@@ -17171,11 +17438,14 @@ interface RevTurbineTreatmentInteractionInput {
17171
17438
  * `PlacementOutput.rule_id` — projected onto the `placement_interaction`
17172
17439
  * clickstream payload as `rule_handle` (BL-0182).
17173
17440
  *
17174
- * Unlike its neighbours this does NOT reach the wire
17175
- * `TreatmentInteractionInputSchema` / `placement_presentations`: that path is
17176
- * column-shaped and would need a datasource migration. The clickstream
17177
- * carries payload fields inside a JSON column, so the rule slice for
17178
- * interactions is readable the moment producers send it.
17441
+ * It reaches the wire `TreatmentInteractionInputSchema` too, as of BL-0200.
17442
+ * It deliberately did not under BL-0182: that path is column-shaped and the
17443
+ * rule would have needed a datasource migration, while the clickstream
17444
+ * carries payload fields inside a JSON column and was readable at once.
17445
+ * `placement_exposure_attribution.rule_handle` exists now (web ledger 015),
17446
+ * so the base exposure row records the rule the exposure was DECIDED by
17447
+ * rather than waiting for attribution to reconstruct one when a conversion
17448
+ * lands — which is what makes presentation-grain rule cuts servable.
17179
17449
  *
17180
17450
  * Omitted, never sent empty, when no decision is in scope — a bare
17181
17451
  * `trackTreatmentInteraction` caller supplies no rule, and absence is what
@@ -21147,6 +21417,12 @@ declare class RevTurbineCustomerSdk {
21147
21417
  * redundant segment re-evaluation.
21148
21418
  */
21149
21419
  private lastServerContextHash?;
21420
+ /**
21421
+ * The plan move an optimistic `convert()` made ahead of the server (BL-0004),
21422
+ * held only until a `client-context` read stops reporting the old plan. See
21423
+ * {@link dropStalePostConversionPlan}.
21424
+ */
21425
+ private pendingConversionPlan?;
21150
21426
  private usageBalances;
21151
21427
  private localDecisionsByPlacementId;
21152
21428
  private localPlacementsByLookupKey;
@@ -22291,12 +22567,16 @@ declare class RevTurbineCustomerSdk {
22291
22567
  /** Map the client-safe context response into a UserContext patch (plan 157). */
22292
22568
  private mapClientSafeContext;
22293
22569
  /**
22294
- * Apply a server-derived UserContext patch (plan 157) — mirrors setUserContext
22295
- * but accepts a partial. The patch's RevTurbine-authoritative fields (trial,
22296
- * billing signals) overlay the held context; undefined fields are skipped by
22297
- * the merge, so app-set values are never nulled.
22570
+ * Apply a UserContext patch — mirrors setUserContext but accepts a partial.
22571
+ * RevTurbine-authoritative fields (trial, billing signals, server plan)
22572
+ * overlay the held context; undefined fields are skipped by the merge, so
22573
+ * app-set values are never nulled.
22574
+ *
22575
+ * Two callers: the server client-context fetch (plan 157) and the optimistic
22576
+ * post-conversion plan move (BL-0004). Both notify subscribers, which is what
22577
+ * makes mounted slots and gates re-resolve.
22298
22578
  */
22299
- private applyServerContextPatch;
22579
+ private applyUserContextPatch;
22300
22580
  /**
22301
22581
  * Record that a placement was rendered to the user. Plan 43 TASK-9.
22302
22582
  *
@@ -22473,13 +22753,73 @@ declare class RevTurbineCustomerSdk {
22473
22753
  */
22474
22754
  snooze(outputId: string, seconds?: number): Promise<void>;
22475
22755
  /**
22476
- * Record a confirmed CTA completion and retire the decision's placement
22477
- * permanently — future calls to `getPlacementDecision` for it will not
22478
- * return it again.
22756
+ * Record a confirmed CTA completion, then reload the UserContext so every
22757
+ * mounted surface re-decides against the plan the user just converted to.
22758
+ *
22759
+ * Conversion is **not** a suppression: it writes no cooldown and no permanent
22760
+ * retirement (spec §"interaction" table; Kent's plan 254 D-9 ruling). What
22761
+ * makes a converted upgrade banner leave the screen is the user no longer
22762
+ * matching it — so a conversion that did not refresh the context left the
22763
+ * placement mounted until something else happened to re-resolve it. Kent,
22764
+ * 2026-09-25 (BL-0004): *"Converting should trigger a reloading of UserContext
22765
+ * with the new plan/billing state the user has converted to."*
22766
+ *
22767
+ * Ordering, and why it is this way round:
22768
+ *
22769
+ * 1. The interaction is recorded (analytics + attribution), as before.
22770
+ * 2. **Optimistically**, locally: when the converted output's CTA names a
22771
+ * target plan (`cta_path.plan_handle`), the held context moves to that plan
22772
+ * immediately. Billing truth arrives by Stripe webhook, so
22773
+ * `GET /api/sdk/client-context` can still report the OLD plan for seconds
22774
+ * after a successful checkout — waiting for it would leave the upgrade
22775
+ * prompt on screen exactly when the user has just paid.
22776
+ * 3. Subscribers are notified either way — a conversion whose CTA names no
22777
+ * plan still re-decides mounted slots and re-checks mounted gates, which is
22778
+ * what turns a plan change the host applied itself into a re-render.
22779
+ * 4. **Then** the server refresh (`fetchClientContext()`), which overlays the
22780
+ * RevTurbine-authoritative trial / billing-health / plan fields and
22781
+ * notifies again if it changed anything. It is best-effort and never
22782
+ * throws, so awaiting it cannot fail a conversion; with no client-session
22783
+ * minter configured it is a no-op and the optimistic state stands.
22784
+ *
22785
+ * Mounted `PlacementController`s re-decide and mounted `EntitlementGate`s
22786
+ * re-check through their `watchUserContext()` subscriptions — which the React
22787
+ * bindings attach for you. Re-resolution emits the normal lifecycle events
22788
+ * once per final decision; the transient states emit nothing.
22789
+ * `PlacementController.ctaComplete()` is unchanged and remains the
22790
+ * component-level path.
22479
22791
  *
22480
22792
  * @public
22481
22793
  */
22482
22794
  convert(outputId: string): Promise<void>;
22795
+ /**
22796
+ * The BL-0004 post-conversion context reload: optimistic local plan move,
22797
+ * then the server refresh. See {@link convert} for the ordering rationale.
22798
+ */
22799
+ private reloadUserContextAfterConversion;
22800
+ /**
22801
+ * Keep a stale server plan from undoing an optimistic conversion (BL-0004).
22802
+ *
22803
+ * Billing truth arrives by Stripe webhook, so a `client-context` read that
22804
+ * races the webhook reports the PRE-conversion plan — and the server plan
22805
+ * deliberately overlays the app-supplied one (plan 179 TASK-1), so applying
22806
+ * that read verbatim would put the upgrade prompt straight back on screen
22807
+ * seconds after the user paid.
22808
+ *
22809
+ * So while a conversion is pending, a server plan equal to the plan converted
22810
+ * AWAY from is dropped — only the plan fields, never the trial or billing-health
22811
+ * signals, which are authoritative regardless. Any other value (the new plan,
22812
+ * or a third one the user was moved to out-of-band) clears the pending state
22813
+ * and applies, so this can suppress at most the one value it was created for
22814
+ * and cannot outlive the lag it exists to cover.
22815
+ */
22816
+ private dropStalePostConversionPlan;
22817
+ /**
22818
+ * The display name the loaded Playbook gives a plan handle, else the handle.
22819
+ * Keeps an optimistic plan move from putting a raw handle in front of a user
22820
+ * when the Playbook already knows the plan's name.
22821
+ */
22822
+ private planNameForHandle;
22483
22823
  /**
22484
22824
  * Emit a canonical trigger event. There is no in-SDK consumer that matches
22485
22825
  * on trigger names — the shipped behavior is ingest to `events_clickstream`
@@ -22943,12 +23283,41 @@ declare class PlacementController {
22943
23283
  private _awaitingConfig;
22944
23284
  private _configRetries;
22945
23285
  private _playbookUnsubscribe;
23286
+ private _userContextUnsubscribe;
22946
23287
  constructor(sdk: RevTurbineCustomerSdk, options: PlacementControllerOptions);
22947
23288
  /**
22948
- * Stop listening for Playbook loads. Idempotent; call it when the owning
22949
- * component unmounts (`usePlacement` does).
23289
+ * Stop listening for Playbook loads and user-context changes. Idempotent; call
23290
+ * it when the owning component unmounts (`usePlacement` does).
22950
23291
  */
22951
23292
  dispose(): void;
23293
+ /**
23294
+ * Drop only the Playbook-load subscription — the within-load-cycle teardown
23295
+ * (BL-0177). A mounted controller keeps watching the user context (BL-0004).
23296
+ */
23297
+ private unsubscribePlaybook;
23298
+ /**
23299
+ * Re-decide whenever the user context changes (BL-0004).
23300
+ *
23301
+ * The counterpart to {@link EntitlementGate.watchUserContext}, and the reason
23302
+ * `sdk.convert()` now removes a converted placement in place: conversion writes
23303
+ * no suppression — eligibility is a function of the user's CURRENT plan and
23304
+ * targeting — so the only thing that can take a converted upgrade banner off
23305
+ * screen is a re-decide against the reloaded context. Without this the
23306
+ * placement stayed mounted until something else happened to re-resolve it, and
23307
+ * the host had to call `refresh()` itself or use the component's
23308
+ * `ctaComplete()` (the limitation plan 236 TASK-13 recorded).
23309
+ *
23310
+ * Only re-decides a controller that has already resolved something: before the
23311
+ * first `load()` there is nothing on screen to be stale, and firing then would
23312
+ * turn every startup `identify()` into a duplicate decision.
23313
+ *
23314
+ * Calls `load()` rather than `refresh()` on purpose — `refresh()` clears
23315
+ * impression/exposure tracking, so a context change would re-credit a
23316
+ * presentation the user never saw again.
23317
+ *
23318
+ * Returns an unsubscribe function; {@link dispose} also drops it.
23319
+ */
23320
+ watchUserContext(): () => void;
22952
23321
  /**
22953
23322
  * Is this decision a race against a Playbook load rather than a verdict?
22954
23323
  *
@@ -23166,12 +23535,18 @@ declare class EntitlementGate {
23166
23535
  private _awaitedResult;
23167
23536
  private _configRetries;
23168
23537
  private _playbookUnsubscribe;
23538
+ private _userContextUnsubscribe;
23169
23539
  constructor(sdk: RevTurbineCustomerSdk, options: EntitlementGateOptions);
23170
23540
  /**
23171
- * Stop listening for Playbook loads. Idempotent; call it when the owning
23172
- * component unmounts (`useEntitlement` does).
23541
+ * Stop listening for Playbook loads and user-context changes. Idempotent; call
23542
+ * it when the owning component unmounts (`useEntitlement` does).
23173
23543
  */
23174
23544
  dispose(): void;
23545
+ /**
23546
+ * Drop only the Playbook-load subscription — the within-check-cycle teardown
23547
+ * (BL-0179). A mounted gate keeps watching the user context (BL-0004).
23548
+ */
23549
+ private unsubscribePlaybook;
23175
23550
  /** Current state snapshot. */
23176
23551
  get state(): EntitlementGateState;
23177
23552
  /** Convenience: `true` when the entitlement is allowed. */
@@ -23271,8 +23646,13 @@ declare class EntitlementGate {
23271
23646
  * `check()` there is nothing on screen to be stale, and firing then would
23272
23647
  * turn every `identify()` at startup into a redundant evaluation.
23273
23648
  *
23649
+ * `sdk.convert()` reloads the UserContext (BL-0004), so this is also what
23650
+ * flips a mounted `useCan` gate to allowed after a conversion.
23651
+ *
23274
23652
  * Returns an unsubscribe function. Call it when the gate is discarded —
23275
23653
  * without that, a gate outlives its consumer and keeps re-checking.
23654
+ * Idempotent: a second call returns the first subscription rather than
23655
+ * orphaning it, and {@link dispose} drops it too.
23276
23656
  */
23277
23657
  watchUserContext(): () => void;
23278
23658
  private notify;