@revturbine/sdk 0.7.12 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/headless.d.ts +1506 -114
- package/dist/headless.js +2 -2
- package/dist/headless.js.map +1 -1
- package/dist/index.d.ts +1749 -121
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/types/web-sdk/config-artifact.d.ts +54 -12
- package/dist/types/web-sdk/config-artifact.d.ts.map +1 -1
- package/dist/types/web-sdk/control-plane-events.d.ts +6 -5
- package/dist/types/web-sdk/control-plane-events.d.ts.map +1 -1
- package/dist/types/web-sdk/controllers.d.ts +17 -0
- package/dist/types/web-sdk/controllers.d.ts.map +1 -1
- package/dist/types/web-sdk/customer-side.d.ts +332 -4
- package/dist/types/web-sdk/customer-side.d.ts.map +1 -1
- package/dist/types/web-sdk/headless.d.ts +1 -1
- package/dist/types/web-sdk/headless.d.ts.map +1 -1
- package/dist/types/web-sdk/pii-redact.d.ts +19 -0
- package/dist/types/web-sdk/pii-redact.d.ts.map +1 -1
- package/dist/types/web-sdk/placements/FixedSurfaceSlot.d.ts +14 -3
- package/dist/types/web-sdk/placements/FixedSurfaceSlot.d.ts.map +1 -1
- package/dist/types/web-sdk/placements/MessageSurfaceSlot.d.ts.map +1 -1
- package/dist/types/web-sdk/placements/useSurfaceSlot.d.ts +24 -0
- package/dist/types/web-sdk/placements/useSurfaceSlot.d.ts.map +1 -1
- package/dist/types/web-sdk/react/InitFailureDiagnostic.d.ts +35 -0
- package/dist/types/web-sdk/react/InitFailureDiagnostic.d.ts.map +1 -0
- package/dist/types/web-sdk/react/RevTurbineProvider.d.ts +18 -4
- package/dist/types/web-sdk/react/RevTurbineProvider.d.ts.map +1 -1
- package/dist/types/web-sdk/react/index.d.ts +2 -0
- package/dist/types/web-sdk/react/index.d.ts.map +1 -1
- package/dist/types/web-sdk/react/init-status.d.ts +63 -0
- package/dist/types/web-sdk/react/init-status.d.ts.map +1 -0
- package/dist/types/web-sdk/react/useRevTurbine.d.ts +18 -0
- package/dist/types/web-sdk/react/useRevTurbine.d.ts.map +1 -1
- package/dist/types/web-sdk/theme/ThemeContext.d.ts +28 -2
- package/dist/types/web-sdk/theme/ThemeContext.d.ts.map +1 -1
- package/dist/types/web-sdk/theme/defaults.d.ts +44 -3
- package/dist/types/web-sdk/theme/defaults.d.ts.map +1 -1
- package/dist/types/web-sdk/theme/index.d.ts +4 -2
- package/dist/types/web-sdk/theme/index.d.ts.map +1 -1
- package/dist/types/web-sdk/theme/useColorScheme.d.ts +14 -0
- package/dist/types/web-sdk/theme/useColorScheme.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -1,24 +1,65 @@
|
|
|
1
1
|
import { type Playbook, type RevTurbineConfig } from '@revt-eng/schema';
|
|
2
|
+
declare const REQUIRED_BODY_ARRAY_FIELDS: readonly ["plans", "entitlements", "entitlement_rules", "segments", "content_ui_paths"];
|
|
2
3
|
/** A canonical Playbook or the deprecated RevTurbineConfig wire shape. */
|
|
3
4
|
export type ConfigArtifact = Playbook | RevTurbineConfig;
|
|
4
5
|
/**
|
|
5
6
|
* A config artifact as raw parsed JSON — what
|
|
6
7
|
* `import playbook from './revturbine.playbook.json'` produces.
|
|
7
8
|
*
|
|
8
|
-
* TypeScript widens JSON modules to plain `string`/`number`
|
|
9
|
-
* which can never satisfy the literal-typed
|
|
10
|
-
* (`artifact_type: "playbook"` etc.), so a strict-mode
|
|
11
|
-
* the imported JSON without a cast.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
9
|
+
* This exists because TypeScript widens JSON modules to plain `string`/`number`
|
|
10
|
+
* property types, which can never satisfy the literal-typed
|
|
11
|
+
* {@link ConfigArtifact} (`artifact_type: "playbook"` etc.), so a strict-mode
|
|
12
|
+
* project could not pass the imported JSON without a cast.
|
|
13
|
+
*
|
|
14
|
+
* Widening affects only *literal* types, so it is no reason to give up on the
|
|
15
|
+
* rest of the shape. The body arrays are structurally required here, which
|
|
16
|
+
* makes a truncated artifact a **compile** error at the `localRuntime`
|
|
17
|
+
* boundary rather than a runtime one — the whole point of plan 233. The header
|
|
18
|
+
* fields stay unconstrained because those are exactly the widened ones.
|
|
19
|
+
*
|
|
20
|
+
* The required-field list is *derived* from {@link REQUIRED_BODY_ARRAY_FIELDS},
|
|
21
|
+
* the same constant {@link normalizeConfigArtifactOrThrow} validates against at
|
|
22
|
+
* runtime, so the compile-time and runtime contracts cannot drift apart.
|
|
23
|
+
*
|
|
24
|
+
* The index signature keeps every other field open: a Playbook carries many
|
|
25
|
+
* optional header fields, and a *fetched* artifact (`await res.json()`, typed
|
|
26
|
+
* `any`) still satisfies this, so the served path is not made harder to write —
|
|
27
|
+
* only harder to get silently wrong. Values are still validated at runtime by
|
|
28
|
+
* {@link normalizeConfigArtifactOrThrow}, which fails fast with a descriptive
|
|
29
|
+
* error; this type constrains the *shape*, never the values.
|
|
30
|
+
*/
|
|
31
|
+
export type UnvalidatedConfigArtifact = {
|
|
32
|
+
[K in (typeof REQUIRED_BODY_ARRAY_FIELDS)[number]]: unknown[];
|
|
33
|
+
} & {
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The target (tenant + environment) the SDK was initialized against.
|
|
38
|
+
*
|
|
39
|
+
* These are the **authority** on which tenant a runtime decides for. An
|
|
40
|
+
* artifact's own `tenant_id` / `environment_id` are a *guard*: they exist so the
|
|
41
|
+
* CLI can refuse to upload a config to the wrong tenant while setting up demo
|
|
42
|
+
* environments, and they are not a runtime input (plan 233 REQ-2, Kent 2026-09-10).
|
|
43
|
+
*
|
|
44
|
+
* A disagreement between the two warns and proceeds on these values — it never
|
|
45
|
+
* fails init. See {@link normalizeConfigArtifactOrThrow}.
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
15
48
|
*/
|
|
16
|
-
export
|
|
17
|
-
/**
|
|
18
|
-
export interface LegacyConfigTargetDefaults {
|
|
49
|
+
export interface ConfigTargetDefaults {
|
|
50
|
+
/** Tenant the SDK was initialized with. Wins over the artifact's `tenant_id`. */
|
|
19
51
|
tenantId: string;
|
|
52
|
+
/** Environment the SDK was initialized with. Wins over the artifact's `environment_id`. */
|
|
20
53
|
environmentId: string;
|
|
21
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated Renamed to {@link ConfigTargetDefaults} in plan 233 — these values
|
|
57
|
+
* are no longer "legacy defaults" applied only to pre-stamping artifacts; they
|
|
58
|
+
* are the authoritative target for every artifact shape. Kept as an alias so the
|
|
59
|
+
* already-shipped export keeps resolving.
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
export type LegacyConfigTargetDefaults = ConfigTargetDefaults;
|
|
22
63
|
/**
|
|
23
64
|
* Parse either supported wire shape into the canonical Playbook shape.
|
|
24
65
|
*
|
|
@@ -26,7 +67,7 @@ export interface LegacyConfigTargetDefaults {
|
|
|
26
67
|
* an unsupported future `format_version` can never fall back to legacy.
|
|
27
68
|
*/
|
|
28
69
|
export declare function normalizeConfigArtifactOrThrow(raw: unknown, // sdk-ok: boundary-parse
|
|
29
|
-
source: string,
|
|
70
|
+
source: string, targetDefaults?: ConfigTargetDefaults): Playbook | undefined;
|
|
30
71
|
/**
|
|
31
72
|
* Normalize a raw config artifact to the canonical Playbook the runtime
|
|
32
73
|
* evaluator consumes.
|
|
@@ -37,5 +78,6 @@ source: string, legacyTargetDefaults?: LegacyConfigTargetDefaults): Playbook | u
|
|
|
37
78
|
* (callers now read `format_version` / `playbook_version_id`).
|
|
38
79
|
*/
|
|
39
80
|
export declare function configArtifactForRuntime(raw: unknown, // sdk-ok: boundary-parse
|
|
40
|
-
source: string,
|
|
81
|
+
source: string, targetDefaults?: ConfigTargetDefaults): RevTurbineConfig | undefined;
|
|
82
|
+
export {};
|
|
41
83
|
//# sourceMappingURL=config-artifact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-artifact.d.ts","sourceRoot":"","sources":["../../../config-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"config-artifact.d.ts","sourceRoot":"","sources":["../../../config-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAI1B,QAAA,MAAM,0BAA0B,yFAMtB,CAAC;AAGX,0EAA0E;AAC1E,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,gBAAgB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,yBAAyB,GACjC;KAAG,CAAC,IAAI,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,GAAG,OAAO,EAAE;CAAE,GACjE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAE/B;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,oBAAoB;IACnC,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,2FAA2F;IAC3F,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAmG9D;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,OAAO,EAAE,yBAAyB;AACvC,MAAM,EAAE,MAAM,EACd,cAAc,CAAC,EAAE,oBAAoB,GACpC,QAAQ,GAAG,SAAS,CAmEtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,OAAO,EAAE,yBAAyB;AACvC,MAAM,EAAE,MAAM,EACd,cAAc,CAAC,EAAE,oBAAoB,GACpC,gBAAgB,GAAG,SAAS,CAE9B"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Control-plane semantic events (plan 112).
|
|
3
3
|
*
|
|
4
|
-
* A typed layer over the SDK's
|
|
5
|
-
* control-plane activity — web/CLI auth,
|
|
6
|
-
* product-entity actions. This is the "dogfood" surface:
|
|
7
|
-
* product usage through the same SDK a customer uses.
|
|
4
|
+
* A typed layer over the SDK's raw event emit path for RevTurbine's OWN
|
|
5
|
+
* control-plane activity — web/CLI auth, playbook-version lifecycle, playbook
|
|
6
|
+
* transfer, and product-entity actions. This is the "dogfood" surface:
|
|
7
|
+
* RevTurbine emits its product usage through the same SDK a customer uses.
|
|
8
8
|
*
|
|
9
9
|
* The taxonomy itself is the canonical `ControlPlaneEventType` /
|
|
10
10
|
* `ControlPlaneEventSource` enums from `@revt-eng/schema`; this module adds the
|
|
@@ -24,7 +24,8 @@ export type { ControlPlaneEventType, ControlPlaneEventSource };
|
|
|
24
24
|
/**
|
|
25
25
|
* Canonical source classification for every control-plane event type — mirrors
|
|
26
26
|
* the scaffold taxonomy. `system` covers identity/auth + CLI command telemetry;
|
|
27
|
-
* `workflow` covers
|
|
27
|
+
* `workflow` covers playbook-version lifecycle, playbook transfer, and
|
|
28
|
+
* product-entity actions.
|
|
28
29
|
*
|
|
29
30
|
* Typed as a total `Record`, so adding a new `ControlPlaneEventType` in scaffold
|
|
30
31
|
* without classifying it here is a compile error.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-plane-events.d.ts","sourceRoot":"","sources":["../../../control-plane-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEvF,YAAY,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,CAAC;AAE/D
|
|
1
|
+
{"version":3,"file":"control-plane-events.d.ts","sourceRoot":"","sources":["../../../control-plane-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEvF,YAAY,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,CAAC;AAE/D;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,qBAAqB,EAAE,uBAAuB,CA8B7F,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,qBAAqB,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,qBAAqB,EAChC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAM,GACtC,qBAAqB,CAQvB"}
|
|
@@ -214,8 +214,25 @@ export declare class PlacementController {
|
|
|
214
214
|
/** Re-fetch the placement decision (clears impression + render + exposure tracking). */
|
|
215
215
|
refresh(): Promise<RevTurbinePlacementDecision | null>;
|
|
216
216
|
/** Record a dismiss interaction and hide the placement. */
|
|
217
|
+
/**
|
|
218
|
+
* Record a dismissal.
|
|
219
|
+
*
|
|
220
|
+
* @param cooldownMs - Optional explicit window. Omit it — which is the normal
|
|
221
|
+
* case — and the SDK resolves the payload's authored `caps.cooldown_days`,
|
|
222
|
+
* falling back to the 7-day default. This used to default to 24h here and
|
|
223
|
+
* pass it ALWAYS, so the authored value and the 7-day default were both
|
|
224
|
+
* unreachable from React (plan 233 TASK-8b).
|
|
225
|
+
*/
|
|
217
226
|
dismiss(cooldownMs?: number): Promise<void>;
|
|
218
227
|
/** Record a snooze/remind-me-later interaction and hide the placement. */
|
|
228
|
+
/**
|
|
229
|
+
* Record a snooze / remind-me-later.
|
|
230
|
+
*
|
|
231
|
+
* @param seconds - Optional explicit window. Omit it and the SDK resolves the
|
|
232
|
+
* payload's authored `remind_later_minutes`, falling back to the tenant
|
|
233
|
+
* default (plan 233 TASK-8c). Remind-later is a DIFFERENT window from
|
|
234
|
+
* dismiss and resolves independently.
|
|
235
|
+
*/
|
|
219
236
|
snooze(seconds?: number): Promise<void>;
|
|
220
237
|
/** Alias for {@link snooze}. */
|
|
221
238
|
remindMeLater(seconds?: number): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controllers.d.ts","sourceRoot":"","sources":["../../../controllers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;
|
|
1
|
+
{"version":3,"file":"controllers.d.ts","sourceRoot":"","sources":["../../../controllers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,KAAK,EACV,qBAAqB,EACrB,0BAA0B,EAC1B,yBAAyB,EACzB,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,oCAAoC,EACpC,gCAAgC,EAChC,qBAAqB,EACrB,4BAA4B,EAC5B,qBAAqB,EACrB,KAAK,EAGL,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,UAAU,EAEX,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAwB,MAAM,eAAe,CAAC;AAM3E,kEAAkE;AAClE,MAAM,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC;AAexC;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,2DAA2D;IAC3D,SAAS,CAAC,EAAE,yBAAyB,CAAC;IACtC,yEAAyE;IACzE,WAAW,CAAC,EAAE,2BAA2B,CAAC;IAC1C,oEAA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,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7E;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAGnC;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,cAAc,CAAC,KAAK,SAAS,qBAAqB,GAAG,qBAAqB,EAC9F,OAAO,EAAE,iBAAiB,GAAG;IAAE,IAAI,CAAC,EAAE,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAA;CAAE,GAC1E,OAAO,CAAC,UAAU,CAAC,CAqDrB"}
|
|
@@ -6,6 +6,8 @@ import type { BrandingConfig } from './generated';
|
|
|
6
6
|
import type { ControlPlaneEventType } from './control-plane-events';
|
|
7
7
|
import type { RevTurbineStorage } from './storage';
|
|
8
8
|
import type { ServerEvaluationPayload as GeneratedServerEvaluationPayload, EntitlementStatus as SchemaEntitlementStatus, Playbook, RevTurbineConfig, RevTurbineConfigSegmentsItem, ContentUiPath, UserContext, UserTrialStatus, TrialInstance, TriggerEventType } from '@revt-eng/schema';
|
|
9
|
+
import { CONTROL_PLANE_EVENT_NAMES } from '@revt-eng/schema';
|
|
10
|
+
import type { EventPayloadInput, PlatformEventName } from '@revt-eng/schema';
|
|
9
11
|
import type { JsonValue, JsonObject, PredicateEvaluationResult } from '@revt-eng/core';
|
|
10
12
|
import { type TrustedKey } from '@revt-eng/core/bundle';
|
|
11
13
|
import { ImpressionHistory } from '@revt-eng/core';
|
|
@@ -93,6 +95,43 @@ export type RevTurbineLocalOnlyMinimalInitOptions = Omit<RevTurbineInitOptions,
|
|
|
93
95
|
* alias) is provided.
|
|
94
96
|
*/
|
|
95
97
|
export type RevTurbineInitInputOptions = RevTurbineInitWithProviderOptions | (RevTurbineLocalOnlyMinimalInitOptions & RevTurbineProviderOptionAugmentations);
|
|
98
|
+
/**
|
|
99
|
+
* Every key any init-options branch accepts.
|
|
100
|
+
*
|
|
101
|
+
* Built from the branches rather than written as `keyof RevTurbineInitInputOptions`:
|
|
102
|
+
* `keyof` over a union yields the INTERSECTION of its members' keys, so that
|
|
103
|
+
* form would reject `localRuntime` (local-only branch) and `provider`
|
|
104
|
+
* (augmentation branch) — every key that makes the union worth having.
|
|
105
|
+
*/
|
|
106
|
+
type RevTurbineInitOptionKey = keyof RevTurbineInitOptions | keyof RevTurbineProviderOptionAugmentations;
|
|
107
|
+
/**
|
|
108
|
+
* Exact-check for init options (plan 233 REQ-2b).
|
|
109
|
+
*
|
|
110
|
+
* A key the options do not declare becomes `never`, which turns a typo or a
|
|
111
|
+
* stale option into a compile error instead of a value the SDK silently ignores.
|
|
112
|
+
*
|
|
113
|
+
* The motivating shape is the same one `Exact` was introduced for in plan 191:
|
|
114
|
+
* TypeScript's excess-property check applies only to fresh object literals, so
|
|
115
|
+
* options assembled in a variable — or in an un-annotated `useMemo`, which is
|
|
116
|
+
* exactly how React integrations build them — carried unknown keys with no
|
|
117
|
+
* diagnostic at all.
|
|
118
|
+
*
|
|
119
|
+
* Scope limit worth stating: this cannot catch a wrong VALUE. The escalated
|
|
120
|
+
* `tenant_id` defect was never reachable from here — that one is caught by
|
|
121
|
+
* init-time validation (REQ-1/REQ-2) and the reachable init status (REQ-3).
|
|
122
|
+
*
|
|
123
|
+
* It is *not* true that a Playbook is beyond compile-time reach. An earlier
|
|
124
|
+
* version of this note claimed a served artifact is `Record<string, unknown>`
|
|
125
|
+
* “by necessity”; that was wrong. {@link UnvalidatedConfigArtifact} structurally
|
|
126
|
+
* requires the body arrays, so a truncated Playbook fails to compile at the
|
|
127
|
+
* `localRuntime` boundary. What genuinely cannot be checked is the artifact's
|
|
128
|
+
* *contents* — whether a plan handle exists, whether a rule is satisfiable.
|
|
129
|
+
*
|
|
130
|
+
* @public
|
|
131
|
+
*/
|
|
132
|
+
export type ExactInitOptions<T> = {
|
|
133
|
+
[K in keyof T]: K extends RevTurbineInitOptionKey ? T[K] : never;
|
|
134
|
+
};
|
|
96
135
|
/**
|
|
97
136
|
* SDK integration mode.
|
|
98
137
|
* - `snippet` — lightweight script tag embed
|
|
@@ -814,7 +853,14 @@ export interface RevTurbineEndpointOverrides {
|
|
|
814
853
|
/** Keyless anonymous SDK telemetry endpoint (`POST /api/sdk/meta`). */
|
|
815
854
|
ingestSdkMeta: string;
|
|
816
855
|
touchpointTransition: string;
|
|
817
|
-
|
|
856
|
+
/**
|
|
857
|
+
* @deprecated Ignored since plan 232. This pointed at a fallback the SDK
|
|
858
|
+
* retried when the interactions POST failed — against a route the app does
|
|
859
|
+
* not serve, with the internal queue shape rather than the wire shape, so it
|
|
860
|
+
* could only ever 404. Setting it has no effect; the key remains so an
|
|
861
|
+
* existing integration that passes it still compiles.
|
|
862
|
+
*/
|
|
863
|
+
legacyInteractions?: string;
|
|
818
864
|
placementTypes: string;
|
|
819
865
|
surfaceSlots: string;
|
|
820
866
|
}
|
|
@@ -1193,6 +1239,67 @@ export declare function createTreatmentInteraction(userId: string, placementId:
|
|
|
1193
1239
|
export interface RevTurbineEventOptions {
|
|
1194
1240
|
immediate?: boolean;
|
|
1195
1241
|
}
|
|
1242
|
+
/**
|
|
1243
|
+
* One surface slot this app currently has mounted.
|
|
1244
|
+
*
|
|
1245
|
+
* @public
|
|
1246
|
+
*/
|
|
1247
|
+
export interface RevTurbineRegisteredSlot {
|
|
1248
|
+
/**
|
|
1249
|
+
* The author-facing slot id — what a Playbook placement's `trigger.slot_id`
|
|
1250
|
+
* must equal. NOT the internal hashed registry key.
|
|
1251
|
+
*/
|
|
1252
|
+
slotId: string;
|
|
1253
|
+
/** Display name supplied at registration. */
|
|
1254
|
+
name: string;
|
|
1255
|
+
/** Normalized route the slot was mounted on. */
|
|
1256
|
+
route: string;
|
|
1257
|
+
/** The SDK's internal registry id (hashed). Useful when correlating logs. */
|
|
1258
|
+
internalId: string;
|
|
1259
|
+
/** Surface template ids the slot declared it can render, if any. */
|
|
1260
|
+
surfaceTemplateIds: string[];
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* A Playbook placement that targets a surface slot.
|
|
1264
|
+
*
|
|
1265
|
+
* @public
|
|
1266
|
+
*/
|
|
1267
|
+
export interface RevTurbineAuthoredSlotRef {
|
|
1268
|
+
/** The slot id the placement targets (`trigger.slot_id`). */
|
|
1269
|
+
slotId: string;
|
|
1270
|
+
/** The authored placement's id. */
|
|
1271
|
+
placementId: string;
|
|
1272
|
+
/** The placement's category, when the Playbook declares one. */
|
|
1273
|
+
category?: string;
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Result of {@link RevTurbineCustomerSdk.diagnoseSlotInventory}.
|
|
1277
|
+
*
|
|
1278
|
+
* @public
|
|
1279
|
+
*/
|
|
1280
|
+
export interface RevTurbineSlotInventoryDiagnosis {
|
|
1281
|
+
/** Every slot mounted by this app right now. */
|
|
1282
|
+
mounted: RevTurbineRegisteredSlot[];
|
|
1283
|
+
/** Every slot-targeted placement in the Playbook. */
|
|
1284
|
+
authored: RevTurbineAuthoredSlotRef[];
|
|
1285
|
+
/**
|
|
1286
|
+
* Placements targeting a slot no code renders. **These can never show**, and
|
|
1287
|
+
* nothing else reports them — the decision path is never asked about a slot
|
|
1288
|
+
* that was never mounted, so there is no error and no reason code.
|
|
1289
|
+
*/
|
|
1290
|
+
authoredButUnmounted: RevTurbineAuthoredSlotRef[];
|
|
1291
|
+
/**
|
|
1292
|
+
* Slots mounted that no placement targets. They render their fallback
|
|
1293
|
+
* forever; usually a typo in the slot id, or config that was never deployed.
|
|
1294
|
+
*/
|
|
1295
|
+
mountedButUnauthored: RevTurbineRegisteredSlot[];
|
|
1296
|
+
/**
|
|
1297
|
+
* Whether a Playbook was available to diff against. When `false`, `authored`
|
|
1298
|
+
* is empty because nothing could be read — which is NOT the same as "nothing
|
|
1299
|
+
* is authored", and a caller must not treat the two alike.
|
|
1300
|
+
*/
|
|
1301
|
+
configAvailable: boolean;
|
|
1302
|
+
}
|
|
1196
1303
|
/**
|
|
1197
1304
|
* User targeting context for payload eligibility.
|
|
1198
1305
|
* Re-exported from `@revt-eng/core`.
|
|
@@ -1250,6 +1357,31 @@ export type RevTurbineTriggerPayload = TrialTriggerPayload | UsageTriggerPayload
|
|
|
1250
1357
|
*/
|
|
1251
1358
|
export declare function createSemanticEvent(eventType: string, payload: SdkEventProperties, options?: RevTurbineEventOptions): RevTurbineSemanticEvent;
|
|
1252
1359
|
export type { RevTurbineEventEnvelope } from '@revt-eng/core';
|
|
1360
|
+
/**
|
|
1361
|
+
* Every event name on the taxonomy's `control_plane` surface — emitted via
|
|
1362
|
+
* {@link RevTurbineCustomerSdk.trackControlPlaneEvent}, never the platform
|
|
1363
|
+
* surface. The TYPE is the CP ingest enum; the runtime set below derives
|
|
1364
|
+
* from the taxonomy's surface field, so a scaffold surface reclassification
|
|
1365
|
+
* (plan 228's dogfood ruling moved `area_viewed`/`feature_gated` OUT of
|
|
1366
|
+
* this surface) flows through on a pin bump with no SDK edit.
|
|
1367
|
+
*/
|
|
1368
|
+
type ControlPlaneEventName = (typeof CONTROL_PLANE_EVENT_NAMES)[number];
|
|
1369
|
+
/**
|
|
1370
|
+
* Every platform event the typed emit surface accepts: the full taxonomy
|
|
1371
|
+
* MINUS the control-plane surface (structural exclusion — the CP has its own
|
|
1372
|
+
* typed path with source classification, and a customer emitting
|
|
1373
|
+
* `playbook_version_deployed` would be forging RevTurbine's own product
|
|
1374
|
+
* telemetry). Includes the R-2 billing vocabulary: billing facts consumed
|
|
1375
|
+
* from Stripe must be equally emittable first-party (plan 228 R-1).
|
|
1376
|
+
*/
|
|
1377
|
+
export type EmittablePlatformEventName = Exclude<PlatformEventName, ControlPlaneEventName>;
|
|
1378
|
+
/**
|
|
1379
|
+
* Runtime mirror of {@link EmittablePlatformEventName}, derived from the
|
|
1380
|
+
* payload-contract map so the emit surface and the taxonomy cannot drift —
|
|
1381
|
+
* the parity test asserts this set plus the control-plane surface IS the
|
|
1382
|
+
* taxonomy.
|
|
1383
|
+
*/
|
|
1384
|
+
export declare const EMITTABLE_PLATFORM_EVENT_NAMES: readonly string[];
|
|
1253
1385
|
/**
|
|
1254
1386
|
* The core RevTurbine customer-facing SDK.
|
|
1255
1387
|
*
|
|
@@ -1258,7 +1390,9 @@ export type { RevTurbineEventEnvelope } from '@revt-eng/core';
|
|
|
1258
1390
|
* - **Placements** — `registerPlacement()`, `getPlacementDecision()`, `getPlacement()`
|
|
1259
1391
|
* - **Entitlements** — `checkEntitlement()`, `updateUsage()`
|
|
1260
1392
|
* - **Trials** — `getTrialStatus()`
|
|
1261
|
-
* - **Events** — `
|
|
1393
|
+
* - **Events** — `track()` / `capture()` (generic lane; platform-name
|
|
1394
|
+
* collisions are namespaced), `emitPlatformEvent()` (typed platform lane,
|
|
1395
|
+
* contract-validated payloads)
|
|
1262
1396
|
* - **Interactions** — `trackTreatmentInteraction()`, `dismiss()`, `convert()`
|
|
1263
1397
|
* - **Context** — `setUserContext()`, `setPageContext()`, `refreshPageContext()`
|
|
1264
1398
|
*
|
|
@@ -1314,6 +1448,22 @@ export declare class RevTurbineCustomerSdk {
|
|
|
1314
1448
|
private readonly anonymousId;
|
|
1315
1449
|
private readonly sessionId;
|
|
1316
1450
|
private readonly decisionCache;
|
|
1451
|
+
/**
|
|
1452
|
+
* `output_id` → the placement it was decided for, plus the attribution fields
|
|
1453
|
+
* the interaction path needs.
|
|
1454
|
+
*
|
|
1455
|
+
* The public `dismiss()` / `snooze()` / `convert()` take an **output** id,
|
|
1456
|
+
* while every terminal-state write is keyed by the **placement** id. Without
|
|
1457
|
+
* this index those three methods cannot reach the interaction path at all,
|
|
1458
|
+
* which is why `convert()` only ever emitted an event (plan 233 TASK-14).
|
|
1459
|
+
*
|
|
1460
|
+
* It outlives the decision cache deliberately. A conversion is confirmed after
|
|
1461
|
+
* the user comes back from a checkout redirect, long after a 60-second
|
|
1462
|
+
* decision TTL has expired and often in a fresh page load — so this persists,
|
|
1463
|
+
* and is bounded so a long session cannot grow it without limit.
|
|
1464
|
+
*/
|
|
1465
|
+
private readonly outputPlacementIndex;
|
|
1466
|
+
private readonly outputPlacementIndexLimit;
|
|
1317
1467
|
private readonly interactionState;
|
|
1318
1468
|
private readonly interactionQueue;
|
|
1319
1469
|
private readonly defaultDecisionTtlMs;
|
|
@@ -1338,6 +1488,14 @@ export declare class RevTurbineCustomerSdk {
|
|
|
1338
1488
|
private emittedAssignmentFactRevision?;
|
|
1339
1489
|
private providerResolutionController;
|
|
1340
1490
|
private lastEffectiveContext?;
|
|
1491
|
+
/**
|
|
1492
|
+
* The effective segment memberships from the most recent provider
|
|
1493
|
+
* resolution — resolved provider segments ∪ locally evaluated segments.
|
|
1494
|
+
* Stamped onto every event envelope as `segment_ids`, exactly as
|
|
1495
|
+
* `experiment_assignments` is stamped (plan 228 TASK-4 / REQ-11a), so
|
|
1496
|
+
* segment cuts read as-of-event truth instead of requiring a config join.
|
|
1497
|
+
*/
|
|
1498
|
+
private lastEffectiveSegmentIds;
|
|
1341
1499
|
private pageContext;
|
|
1342
1500
|
/**
|
|
1343
1501
|
* Secure per-user client token (`rt_client_`, plan 157). Minted by the
|
|
@@ -1486,6 +1644,16 @@ export declare class RevTurbineCustomerSdk {
|
|
|
1486
1644
|
private decisionCacheStorageKey;
|
|
1487
1645
|
private interactionStateStorageKey;
|
|
1488
1646
|
private presentationCapsStorageKey;
|
|
1647
|
+
private outputPlacementIndexStorageKey;
|
|
1648
|
+
/**
|
|
1649
|
+
* Remember which placement an output belonged to.
|
|
1650
|
+
*
|
|
1651
|
+
* Called from every path that hands a decision to a caller, because any
|
|
1652
|
+
* output a caller can see is an output they can later pass to `convert()`.
|
|
1653
|
+
*/
|
|
1654
|
+
private indexDecisionOutput;
|
|
1655
|
+
private hydrateOutputPlacementIndex;
|
|
1656
|
+
private persistOutputPlacementIndex;
|
|
1489
1657
|
private hydrateDecisionCache;
|
|
1490
1658
|
private persistDecisionCache;
|
|
1491
1659
|
private hydrateInteractionState;
|
|
@@ -1789,6 +1957,34 @@ export declare class RevTurbineCustomerSdk {
|
|
|
1789
1957
|
*/
|
|
1790
1958
|
getTelemetryCounters(): TelemetryCounters;
|
|
1791
1959
|
capture(eventName: string, properties: SdkEventProperties, options?: RevTurbineEventOptions): Promise<void>;
|
|
1960
|
+
/**
|
|
1961
|
+
* Emit a typed platform event (plan 228 TASK-4).
|
|
1962
|
+
*
|
|
1963
|
+
* The sanctioned first-party path for every platform event OUTSIDE the
|
|
1964
|
+
* control plane — SDK lifecycle, gates, placements, milestones, growth
|
|
1965
|
+
* signals, and the R-2 billing vocabulary (a billing fact consumed from
|
|
1966
|
+
* Stripe is equally emittable here; the ingest path dedupes on the
|
|
1967
|
+
* contract's identity keys, e.g. `billing_ref`). The payload parameter type
|
|
1968
|
+
* is inferred from the event's payload contract, so the API cannot drift
|
|
1969
|
+
* from the schema the payload is validated against.
|
|
1970
|
+
*
|
|
1971
|
+
* The name is sent RAW — no `clickstream_*` namespacing — which is exactly
|
|
1972
|
+
* what distinguishes this from {@link track}: the generic lane namespaces
|
|
1973
|
+
* platform collisions, the typed lane IS the platform.
|
|
1974
|
+
*
|
|
1975
|
+
* In development/test builds the payload is validated against its contract
|
|
1976
|
+
* at emit time; a violation emits an `sdk_validation_warning` alongside
|
|
1977
|
+
* (never a throw — telemetry must not break the host app). Production
|
|
1978
|
+
* builds skip validation; the ingest boundary re-validates authoritatively.
|
|
1979
|
+
*/
|
|
1980
|
+
emitPlatformEvent<K extends EmittablePlatformEventName>(eventName: K, payload: EventPayloadInput<K>, options?: RevTurbineEventOptions): Promise<void>;
|
|
1981
|
+
/**
|
|
1982
|
+
* Emit an `sdk_validation_warning` conforming to its own payload contract
|
|
1983
|
+
* (`message` is the contract's required field; `reason` rides along for
|
|
1984
|
+
* pre-228 consumers). Fire-and-forget — never throws into the host app.
|
|
1985
|
+
*/
|
|
1986
|
+
private emitSdkWarning;
|
|
1987
|
+
private captureRaw;
|
|
1792
1988
|
/**
|
|
1793
1989
|
* Emit a typed control-plane semantic event (plan 112).
|
|
1794
1990
|
*
|
|
@@ -1812,7 +2008,7 @@ export declare class RevTurbineCustomerSdk {
|
|
|
1812
2008
|
* @example
|
|
1813
2009
|
* ```ts
|
|
1814
2010
|
* sdk.identify('operator_42', { account_id: 'tn_acme' });
|
|
1815
|
-
* await sdk.trackControlPlaneEvent('
|
|
2011
|
+
* await sdk.trackControlPlaneEvent('playbook_version_deployed', { change_set_id: 'cs_9' });
|
|
1816
2012
|
* ```
|
|
1817
2013
|
*/
|
|
1818
2014
|
trackControlPlaneEvent(eventType: ControlPlaneEventType, payload?: SdkEventProperties, options?: RevTurbineEventOptions): Promise<void>;
|
|
@@ -1838,6 +2034,36 @@ export declare class RevTurbineCustomerSdk {
|
|
|
1838
2034
|
* instance (e.g. SPA unmount) to avoid a dangling interval/listeners.
|
|
1839
2035
|
*/
|
|
1840
2036
|
dispose(): void;
|
|
2037
|
+
/**
|
|
2038
|
+
* Emit a semantic event through the GENERIC string lane.
|
|
2039
|
+
*
|
|
2040
|
+
* Since plan 228 TASK-4 this is a customer-lane API, not a platform one: it
|
|
2041
|
+
* rides {@link capture}, so a name colliding with platform vocabulary is
|
|
2042
|
+
* namespaced `clickstream_*` — platform events cannot be forged from here.
|
|
2043
|
+
* The SDK's own platform emissions use {@link emitPlatformEvent}, whose
|
|
2044
|
+
* payloads are typed and contract-validated.
|
|
2045
|
+
*
|
|
2046
|
+
* The fields are passed to {@link capture} DIRECTLY, exactly as a customer's
|
|
2047
|
+
* own `capture(name, {...})` call would. Anything else double-wraps them.
|
|
2048
|
+
*
|
|
2049
|
+
* This used to send `{semantic: true, payload: fields}`. The wire mapping
|
|
2050
|
+
* already stores an envelope's properties under the key `payload`, so that
|
|
2051
|
+
* inner wrapper landed the fields at `properties.payload.payload.<field>` in
|
|
2052
|
+
* `events_clickstream` — one level deeper than every `capture()` event and
|
|
2053
|
+
* than the canonical carrier this SDK documents. Readers that followed the
|
|
2054
|
+
* documented shape (`user_context_fields`, any analytics pipe) found nothing
|
|
2055
|
+
* on a semantic event, which is why gate telemetry was invisible to the
|
|
2056
|
+
* entitlement metrics despite being emitted correctly.
|
|
2057
|
+
*
|
|
2058
|
+
* The `semantic: true` marker went with it: it was written here and read
|
|
2059
|
+
* nowhere in the SDK, the web app, or any pipe. It marked nothing and cost a
|
|
2060
|
+
* whole nesting level.
|
|
2061
|
+
*
|
|
2062
|
+
* `liftClickstreamFields` / `pickClickstreamField` are unaffected — they
|
|
2063
|
+
* resolve top-level first and fall back to the nested bag, so they read the
|
|
2064
|
+
* fields either way. Only the STORED JSON changes shape, and it changes to
|
|
2065
|
+
* the shape everything else already expects.
|
|
2066
|
+
*/
|
|
1841
2067
|
emitSemantic(eventType: string, payload: SdkEventProperties, options?: RevTurbineEventOptions): Promise<void>;
|
|
1842
2068
|
/**
|
|
1843
2069
|
* Optimized routine to evaluate segment membership and usage thresholds.
|
|
@@ -1901,6 +2127,50 @@ export declare class RevTurbineCustomerSdk {
|
|
|
1901
2127
|
placementScopeKey?: string;
|
|
1902
2128
|
normalizedPageRoute?: string;
|
|
1903
2129
|
}): Promise<string>;
|
|
2130
|
+
/**
|
|
2131
|
+
* Every surface slot this SDK instance currently has mounted.
|
|
2132
|
+
*
|
|
2133
|
+
* Plan 233 TASK-10. `verify-integration` names the gap this closes in its own
|
|
2134
|
+
* text: *"A placement targeting a slot no code renders can never show, and
|
|
2135
|
+
* nothing reports this; there is no probe, so walk the Playbook's placement
|
|
2136
|
+
* triggers against your inventory of rendered slots."* There was no way to
|
|
2137
|
+
* obtain that inventory at runtime — the registry is private and keyed by a
|
|
2138
|
+
* hashed id, not by the slot id the author wrote.
|
|
2139
|
+
*
|
|
2140
|
+
* `slotId` is the author-facing identity (what a Playbook's
|
|
2141
|
+
* `trigger.slot_id` must match), not the internal hash. That distinction is
|
|
2142
|
+
* the whole point: a diff against authored config is meaningless in hash
|
|
2143
|
+
* space.
|
|
2144
|
+
*
|
|
2145
|
+
* @public
|
|
2146
|
+
*/
|
|
2147
|
+
getRegisteredSlots(): RevTurbineRegisteredSlot[];
|
|
2148
|
+
/**
|
|
2149
|
+
* Diff the authored Playbook against what this app actually mounted, in both
|
|
2150
|
+
* directions.
|
|
2151
|
+
*
|
|
2152
|
+
* Plan 233 TASK-10 / AC-12. Both directions matter and they fail differently:
|
|
2153
|
+
*
|
|
2154
|
+
* - **authoredButUnmounted** — a placement targets a slot no code renders. It
|
|
2155
|
+
* can never show. Nothing reports this today; the decision path is never
|
|
2156
|
+
* even asked about a slot that was never mounted, so there is no error, no
|
|
2157
|
+
* warning, and no reason code. This is the silent one.
|
|
2158
|
+
* - **mountedButUnauthored** — a slot is mounted that no placement targets. It
|
|
2159
|
+
* renders its fallback forever, which usually means a typo in the slot id
|
|
2160
|
+
* or config that was never deployed.
|
|
2161
|
+
*
|
|
2162
|
+
* This is a diagnostic and deliberately reports rather than throws: it is run
|
|
2163
|
+
* against a live app, and an integration with a stale slot should keep
|
|
2164
|
+
* working while someone reads the output.
|
|
2165
|
+
*
|
|
2166
|
+
* A config-side audit **cannot** produce this. That is the lesson from the
|
|
2167
|
+
* August diagnosis of the escalated integration, which concluded the fixed
|
|
2168
|
+
* slots were unmounted: they were mounted, and the call sites passed slot ids
|
|
2169
|
+
* that no placement targeted. Only the running app knows what it mounted.
|
|
2170
|
+
*
|
|
2171
|
+
* @public
|
|
2172
|
+
*/
|
|
2173
|
+
diagnoseSlotInventory(): RevTurbineSlotInventoryDiagnosis;
|
|
1904
2174
|
/**
|
|
1905
2175
|
* @deprecated Use `registerSurfaceSlot`.
|
|
1906
2176
|
*/
|
|
@@ -1948,8 +2218,37 @@ export declare class RevTurbineCustomerSdk {
|
|
|
1948
2218
|
getPlacementDecision(input: RevTurbinePlacementDecisionInput): Promise<RevTurbinePlacementDecision>;
|
|
1949
2219
|
preloadPlacementDecisions(inputs: RevTurbinePlacementDecisionInput[]): Promise<void>;
|
|
1950
2220
|
bootstrapPlacementDecisions(inputs: RevTurbinePlacementDecisionInput[]): Promise<void>;
|
|
2221
|
+
/**
|
|
2222
|
+
* The authored suppression windows for a payload, in milliseconds.
|
|
2223
|
+
*
|
|
2224
|
+
* Plan 233 TASK-8b/8c. `caps.cooldown_days` and `remind_later_minutes` are
|
|
2225
|
+
* authored per payload and round-trip through export/import (plan 167 AC-8,
|
|
2226
|
+
* AC-11), but nothing ever read them back: the only consumer was the
|
|
2227
|
+
* `hasAuthoredCaps` feature-flag derivation, which uses their PRESENCE to
|
|
2228
|
+
* switch caps enforcement on and discards their values. So a Playbook saying
|
|
2229
|
+
* `cooldown_days: 7` flipped a boolean and otherwise did nothing.
|
|
2230
|
+
*
|
|
2231
|
+
* The decision's `output_id` is the payload id (the resolver sets
|
|
2232
|
+
* `output_id: payload.id`), so the authored values are recoverable from the
|
|
2233
|
+
* loaded config at interaction time.
|
|
2234
|
+
*/
|
|
2235
|
+
private authoredSuppressionWindows;
|
|
1951
2236
|
private updateInteractionState;
|
|
1952
2237
|
private flushInteractionQueue;
|
|
2238
|
+
/**
|
|
2239
|
+
* Re-queue a failed interaction flush and make the failure VISIBLE.
|
|
2240
|
+
*
|
|
2241
|
+
* This used to retry against a legacy path that does not exist in the app,
|
|
2242
|
+
* with the internal queue shape rather than the wire shape — so a failure
|
|
2243
|
+
* produced a silent 404, the batch went back on the queue, and it was
|
|
2244
|
+
* discarded at page unload with nothing recorded anywhere. That is how a
|
|
2245
|
+
* whole class of dropped presentations stayed invisible (plan 232).
|
|
2246
|
+
*
|
|
2247
|
+
* Re-queuing is still right — a transient failure should retry on the next
|
|
2248
|
+
* flush — but it is now paired with a counter and a diagnostic, so a
|
|
2249
|
+
* persistent failure is observable instead of merely quiet.
|
|
2250
|
+
*/
|
|
2251
|
+
private failInteractionFlush;
|
|
1953
2252
|
trackTreatmentInteraction(input: RevTurbineTreatmentInteractionInput): Promise<void>;
|
|
1954
2253
|
getPlacementContent(placementId: string, request?: JsonObject): Promise<RevTurbinePlacementContent>;
|
|
1955
2254
|
/**
|
|
@@ -2231,6 +2530,23 @@ export declare class RevTurbineCustomerSdk {
|
|
|
2231
2530
|
* throwOnMissing: true })` remains the strict opt-in.
|
|
2232
2531
|
*/
|
|
2233
2532
|
private warnOnUiPathResolverCoverageGaps;
|
|
2533
|
+
/**
|
|
2534
|
+
* Route an output-addressed interaction through the one interaction path.
|
|
2535
|
+
*
|
|
2536
|
+
* Plan 233 TASK-14. These three methods each emitted a `placement_interaction`
|
|
2537
|
+
* event and stopped, so none of them wrote any terminal state:
|
|
2538
|
+
* `sdk.dismiss()` did not suppress, and `sdk.convert()` did not retire. Only
|
|
2539
|
+
* the controller path (`trackTreatmentInteraction`) ever did, which is why the
|
|
2540
|
+
* defect was invisible to every React integration test.
|
|
2541
|
+
*
|
|
2542
|
+
* The public API takes an **output** id while every terminal-state write is
|
|
2543
|
+
* keyed by the **placement** id, so the output is resolved through
|
|
2544
|
+
* `outputPlacementIndex`. When it cannot be resolved — an output this SDK
|
|
2545
|
+
* instance never decided, or one evicted from a very long session — we emit
|
|
2546
|
+
* the bare event as before and say so. Silently doing nothing is what shipped;
|
|
2547
|
+
* being loud about the one case we cannot serve is the point.
|
|
2548
|
+
*/
|
|
2549
|
+
private trackOutputInteraction;
|
|
2234
2550
|
dismiss(outputId: string): Promise<void>;
|
|
2235
2551
|
snooze(outputId: string, seconds?: number): Promise<void>;
|
|
2236
2552
|
convert(outputId: string): Promise<void>;
|
|
@@ -2241,10 +2557,22 @@ export declare class RevTurbineCustomerSdk {
|
|
|
2241
2557
|
* name to {@link RevTurbineTriggerEvent} and attaches standard context
|
|
2242
2558
|
* (user_id, plan, timestamp) automatically.
|
|
2243
2559
|
*
|
|
2560
|
+
* **Three trigger names land namespaced on the wire.** This rides the
|
|
2561
|
+
* generic emit lane, which prefixes `clickstream_` to any name the platform
|
|
2562
|
+
* taxonomy already declares — the rule that stops a client forging a
|
|
2563
|
+
* first-party fact by naming an event after one. `trial_expired`,
|
|
2564
|
+
* `payment_failed` and `feature_gated` collide, so they are stored as
|
|
2565
|
+
* `clickstream_trial_expired`, `clickstream_payment_failed` and
|
|
2566
|
+
* `clickstream_feature_gated`. Query those names, not the raw ones. The
|
|
2567
|
+
* remaining triggers are unaffected, and the platform's own versions of the
|
|
2568
|
+
* three are emitted first-party through the typed surface. Pinned by
|
|
2569
|
+
* `trigger-namespacing-parity.test.ts` (plan 231 REQ-4).
|
|
2570
|
+
*
|
|
2244
2571
|
* @example
|
|
2245
2572
|
* ```ts
|
|
2246
2573
|
* await sdk.emitTrigger('usage_limit_approaching', { usage_percent: 85, threshold: 80 });
|
|
2247
2574
|
* await sdk.emitTrigger('trial_expiring', { days_remaining: 2 });
|
|
2575
|
+
* // stored as `clickstream_feature_gated` — see the collision note above
|
|
2248
2576
|
* await sdk.emitTrigger('feature_gated', { feature: 'advanced_automation' });
|
|
2249
2577
|
* ```
|
|
2250
2578
|
*/
|
|
@@ -2386,7 +2714,7 @@ export declare class RevTurbineCustomerSdk {
|
|
|
2386
2714
|
* });
|
|
2387
2715
|
* ```
|
|
2388
2716
|
*/
|
|
2389
|
-
export declare function initRevTurbine(options:
|
|
2717
|
+
export declare function initRevTurbine<T extends RevTurbineInitInputOptions>(options: T & ExactInitOptions<T>): RevTurbineCustomerSdk;
|
|
2390
2718
|
declare global {
|
|
2391
2719
|
interface Window {
|
|
2392
2720
|
RevTurbine?: {
|