@revturbine/sdk 0.7.8 → 0.7.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/growthbook.d.ts +119 -2
  2. package/dist/growthbook.js +1 -1
  3. package/dist/growthbook.js.map +1 -1
  4. package/dist/headless.d.ts +1331 -483
  5. package/dist/headless.js +2 -2
  6. package/dist/headless.js.map +1 -1
  7. package/dist/index.d.ts +1319 -471
  8. package/dist/index.js +2 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/optimizely.d.ts +416 -0
  11. package/dist/optimizely.js +2 -0
  12. package/dist/optimizely.js.map +1 -0
  13. package/dist/types/server-node/local-server.d.ts +1 -1
  14. package/dist/types/server-node/local-server.d.ts.map +1 -1
  15. package/dist/types/web-sdk/browser-runtime.d.ts +1 -1
  16. package/dist/types/web-sdk/browser-runtime.d.ts.map +1 -1
  17. package/dist/types/web-sdk/customer-side.d.ts +19 -3
  18. package/dist/types/web-sdk/customer-side.d.ts.map +1 -1
  19. package/dist/types/web-sdk/environment.d.ts +10 -0
  20. package/dist/types/web-sdk/environment.d.ts.map +1 -0
  21. package/dist/types/web-sdk/optimizely.d.ts +8 -0
  22. package/dist/types/web-sdk/optimizely.d.ts.map +1 -0
  23. package/dist/types/web-sdk/providers/basic-experiment-provider.d.ts.map +1 -1
  24. package/dist/types/web-sdk/providers/experiment-context.d.ts +20 -0
  25. package/dist/types/web-sdk/providers/experiment-context.d.ts.map +1 -0
  26. package/dist/types/web-sdk/providers/growthbook-experiment-provider.d.ts +3 -1
  27. package/dist/types/web-sdk/providers/growthbook-experiment-provider.d.ts.map +1 -1
  28. package/dist/types/web-sdk/providers/index.d.ts +3 -1
  29. package/dist/types/web-sdk/providers/index.d.ts.map +1 -1
  30. package/dist/types/web-sdk/providers/optimizely-experiment-provider.d.ts +50 -0
  31. package/dist/types/web-sdk/providers/optimizely-experiment-provider.d.ts.map +1 -0
  32. package/dist/types/web-sdk/providers/types.d.ts +1 -1
  33. package/dist/types/web-sdk/providers/types.d.ts.map +1 -1
  34. package/package.json +15 -5
@@ -0,0 +1,416 @@
1
+ import { Client, UserAttributes } from '@optimizely/optimizely-sdk';
2
+ import { toJSONSchema, JSONSchemaMeta } from 'zod/v4/core';
3
+ import { z } from 'zod';
4
+
5
+ type OverrideParameters = Parameters<NonNullable<NonNullable<Parameters<typeof toJSONSchema>[1]>['override']>>[0];
6
+ type OverrideSchemaParameters = Omit<OverrideParameters, 'zodSchema'>;
7
+ type IExtensionType = any;
8
+ type ISpecificationExtension = {
9
+ [extensionName: IExtensionName]: IExtensionType;
10
+ };
11
+ interface ExternalDocumentationObject extends ISpecificationExtension {
12
+ description?: string;
13
+ url: string;
14
+ }
15
+ type ParameterLocation = 'query' | 'header' | 'path' | 'cookie';
16
+ type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
17
+ interface BaseParameterObject extends ISpecificationExtension {
18
+ description?: string;
19
+ required?: boolean;
20
+ deprecated?: boolean;
21
+ allowEmptyValue?: boolean;
22
+ style?: ParameterStyle;
23
+ explode?: boolean;
24
+ allowReserved?: boolean;
25
+ schema?: SchemaObject | ReferenceObject;
26
+ examples?: {
27
+ [param: string]: ExampleObject | ReferenceObject;
28
+ };
29
+ example?: any;
30
+ content?: ContentObject;
31
+ }
32
+ interface ParameterObject extends BaseParameterObject {
33
+ name: string;
34
+ in: ParameterLocation;
35
+ }
36
+ interface ContentObject {
37
+ [mediatype: string]: MediaTypeObject;
38
+ }
39
+ interface MediaTypeObject extends ISpecificationExtension {
40
+ schema?: SchemaObject | ReferenceObject;
41
+ examples?: ExamplesObject;
42
+ example?: any;
43
+ encoding?: EncodingObject;
44
+ }
45
+ interface EncodingObject extends ISpecificationExtension {
46
+ [property: string]: EncodingPropertyObject | any;
47
+ }
48
+ interface EncodingPropertyObject {
49
+ contentType?: string;
50
+ headers?: {
51
+ [key: string]: HeaderObject | ReferenceObject;
52
+ };
53
+ style?: string;
54
+ explode?: boolean;
55
+ allowReserved?: boolean;
56
+ [key: string]: any;
57
+ }
58
+ interface ExampleObject {
59
+ summary?: string;
60
+ description?: string;
61
+ value?: any;
62
+ externalValue?: string;
63
+ [property: string]: any;
64
+ }
65
+ interface HeaderObject extends BaseParameterObject {
66
+ $ref?: string;
67
+ }
68
+ interface ExamplesObject {
69
+ [name: string]: ExampleObject | ReferenceObject;
70
+ }
71
+ interface ReferenceObject {
72
+ $ref: string;
73
+ summary?: string;
74
+ description?: string;
75
+ }
76
+ type SchemaObjectType = 'integer' | 'number' | 'string' | 'boolean' | 'object' | 'null' | 'array';
77
+ interface SchemaObject extends ISpecificationExtension {
78
+ $ref?: string;
79
+ discriminator?: DiscriminatorObject;
80
+ readOnly?: boolean;
81
+ writeOnly?: boolean;
82
+ xml?: XmlObject;
83
+ externalDocs?: ExternalDocumentationObject;
84
+ example?: any;
85
+ examples?: any[];
86
+ deprecated?: boolean;
87
+ type?: SchemaObjectType | SchemaObjectType[];
88
+ format?: 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | 'password' | string;
89
+ allOf?: (SchemaObject | ReferenceObject)[];
90
+ oneOf?: (SchemaObject | ReferenceObject)[];
91
+ anyOf?: (SchemaObject | ReferenceObject)[];
92
+ not?: SchemaObject | ReferenceObject;
93
+ items?: SchemaObject | ReferenceObject;
94
+ properties?: {
95
+ [propertyName: string]: SchemaObject | ReferenceObject;
96
+ };
97
+ additionalProperties?: SchemaObject | ReferenceObject | boolean;
98
+ propertyNames?: SchemaObject | ReferenceObject;
99
+ description?: string;
100
+ default?: any;
101
+ title?: string;
102
+ multipleOf?: number;
103
+ maximum?: number;
104
+ const?: any;
105
+ exclusiveMaximum?: number;
106
+ minimum?: number;
107
+ exclusiveMinimum?: number;
108
+ maxLength?: number;
109
+ minLength?: number;
110
+ pattern?: string;
111
+ maxItems?: number;
112
+ minItems?: number;
113
+ uniqueItems?: boolean;
114
+ maxProperties?: number;
115
+ minProperties?: number;
116
+ required?: string[];
117
+ enum?: any[];
118
+ prefixItems?: (SchemaObject | ReferenceObject)[];
119
+ contentMediaType?: string;
120
+ contentEncoding?: string;
121
+ }
122
+ interface DiscriminatorObject {
123
+ propertyName: string;
124
+ mapping?: {
125
+ [key: string]: string;
126
+ };
127
+ }
128
+ interface XmlObject extends ISpecificationExtension {
129
+ name?: string;
130
+ namespace?: string;
131
+ prefix?: string;
132
+ attribute?: boolean;
133
+ wrapped?: boolean;
134
+ }
135
+ type ZodOpenApiOverrideMetaContext = OverrideSchemaParameters;
136
+ type ZodOpenApiOverrideMeta = (ctx: ZodOpenApiOverrideMetaContext) => void;
137
+ interface ZodOpenApiBaseMetadata {
138
+ /**
139
+ * Used to set metadata for a parameter
140
+ */
141
+ param?: Partial<ParameterObject> & {
142
+ /**
143
+ * Used to output this Zod Schema in the components parameters section. Any usage of this Zod Schema will then be transformed into a $ref.
144
+ */
145
+ id?: string;
146
+ };
147
+ /**
148
+ * Used to set metadata for a response header
149
+ */
150
+ header?: Partial<HeaderObject> & {
151
+ /**
152
+ * Used to output this Zod Schema in the components headers section. Any usage of this Zod Schema will then be transformed into a $ref.
153
+ */
154
+ id?: string;
155
+ };
156
+ /**
157
+ * Use to override the rendered schema
158
+ */
159
+ override?: SchemaObject | ZodOpenApiOverrideMeta;
160
+ /**
161
+ * For use only if this Zod Schema is manually registered in the `components` section
162
+ * and is not used anywhere else in the document.
163
+ * Defaults to `output` if not specified.
164
+ */
165
+ unusedIO?: 'input' | 'output';
166
+ /**
167
+ * An alternate id to use for this schema in the event a registered schema is used in both a request and response schema.
168
+ * If not specified, the id will be simply derived as the id of the schema plus an `Output` suffix. Please note that `id` must be set.
169
+ */
170
+ outputId?: string;
171
+ }
172
+ interface ZodOpenApiMetadata extends ZodOpenApiBaseMetadata, JSONSchemaMeta {
173
+ examples?: unknown[];
174
+ /**
175
+ * @deprecated - Use `examples` instead.
176
+ * Use of `example` is discouraged, and later versions of OpenAPI specification may remove it.
177
+ */
178
+ example?: unknown;
179
+ }
180
+ declare module 'zod/v4' {
181
+ interface GlobalMeta extends ZodOpenApiMetadata {}
182
+ }
183
+
184
+ /**
185
+ * User schemas — Zod definitions for user context, trial status, and usage.
186
+ *
187
+ * These are external/SDK-facing types that describe an identified user's
188
+ * current state (plan, entitlements, usage, personalization tokens).
189
+ */
190
+
191
+ /** A single usage entry derived from a credits / usage_limit entitlement. */
192
+ declare const UserUsageEntrySchema: z.ZodObject<{
193
+ entitlement_handle: z.ZodString;
194
+ unit: z.ZodString;
195
+ amount: z.ZodNumber;
196
+ limit: z.ZodOptional<z.ZodNumber>;
197
+ reset_date: z.ZodOptional<z.ZodString>;
198
+ }, z.core.$strip>;
199
+ /**
200
+ * Plan context for the identified user (plan 191 Q-1 amendment): `handle` is
201
+ * the plan's `unique_handle` — the same matching identity as the flat
202
+ * top-level `plan_handle` — renamed from `id`, which in practice was always
203
+ * populated with the handle anyway. There is no `id` in plan context.
204
+ */
205
+ declare const UserPlanContextSchema: z.ZodObject<{
206
+ handle: z.ZodString;
207
+ name: z.ZodString;
208
+ price: z.ZodOptional<z.ZodString>;
209
+ billing_period: z.ZodOptional<z.ZodEnum<{
210
+ monthly: "monthly";
211
+ annual: "annual";
212
+ none: "none";
213
+ }>>;
214
+ }, z.core.$strip>;
215
+
216
+ // AUTO-GENERATED by scripts/generate-zod-outputs.ts - do not edit.
217
+
218
+
219
+ type UserPlanContext = z.infer<typeof UserPlanContextSchema>;
220
+ type UserUsageEntry = z.infer<typeof UserUsageEntrySchema>;
221
+
222
+ /**
223
+ * Pure utility functions extracted from web-sdk/customer-side.ts.
224
+ *
225
+ * No side effects, no browser APIs, no `this` — just transforms.
226
+ */
227
+
228
+ /** JSON-serializable value for SDK data bags. */
229
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
230
+ [key: string]: JsonValue;
231
+ };
232
+
233
+ /**
234
+ * User context lifecycle — pure functions for building, merging,
235
+ * and deriving targeting state from user context + RevTurbineConfig.
236
+ */
237
+
238
+ /** SDK-facing user context (widened for customer convenience). */
239
+ interface UserContextSnapshot {
240
+ id?: string;
241
+ /**
242
+ * THE plan matching identity — the plan's `unique_handle` (plan 191 Q-1).
243
+ * Rule targets, segment plan predicates, and plan resolution match on this
244
+ * value alone.
245
+ */
246
+ plan_handle?: string;
247
+ /**
248
+ * The plan as a bare handle string, or as `{ handle, name, … }` (plan 191
249
+ * Q-1 amendment — the object's identity symbol is `handle`; there is no
250
+ * `id` in plan context). Both shapes carry the same matching identity as
251
+ * the flat `plan_handle` above, which wins when both are set.
252
+ */
253
+ plan?: string | UserPlanContext;
254
+ custom?: Record<string, JsonValue>;
255
+ entitlements?: Record<string, boolean>;
256
+ usage?: Record<string, UserUsageEntry>;
257
+ personalization?: Record<string, JsonValue>;
258
+ /** Canonical experiment-handle to variant-handle assignments. */
259
+ experiments?: Record<string, string>;
260
+ }
261
+
262
+ /**
263
+ * Trait namespace — allows multiple trait-contributing providers to register
264
+ * under `traits:<namespace>` and merge into the unified traits bag.
265
+ *
266
+ * SDK built-ins: `'traits:trial'`, `'traits:usage'`.
267
+ * Customers can register any namespace (e.g. `'traits:permissions'`,
268
+ * `'traits:feature_flags'`).
269
+ */
270
+ type TraitsNamespace = `traits:${string}`;
271
+ /**
272
+ * Domain names recognized by the SDK provider registry.
273
+ * Each domain maps to a specific decision-engine input primitive.
274
+ *
275
+ * The `traits` domain and any `traits:<namespace>` domain are merged
276
+ * into a single `traits` slot in `ResolvedProviderContext`.
277
+ */
278
+ type DomainProviderName = 'plan' | 'entitlements' | 'segments' | 'experiments' | 'content' | 'rules' | 'traits' | 'theme' | 'events' | 'cta' | TraitsNamespace;
279
+ /** Immutable inputs available while resolving a domain provider. */
280
+ interface DomainProviderResolutionInput {
281
+ /** Current caller-supplied and trusted server-enriched context snapshot. */
282
+ readonly userContext: Readonly<UserContextSnapshot>;
283
+ /** Changes whenever identity or user context changes. */
284
+ readonly contextRevision: string;
285
+ /** Aborted when this resolution is no longer valid for the current identity. */
286
+ readonly signal: AbortSignal;
287
+ }
288
+ /**
289
+ * Base interface all domain providers implement.
290
+ *
291
+ * A domain provider supplies a named slice of the decision-engine's input:
292
+ * current plan, entitlement state, user segments, marketing content, rules,
293
+ * or custom traits.
294
+ */
295
+ interface DomainProvider<D extends DomainProviderName = DomainProviderName, T = unknown> {
296
+ /** Provider domain name — used as the registry key. */
297
+ readonly domain: D;
298
+ /**
299
+ * Resolve the current value. Called before placement decisions.
300
+ * May be async (e.g. reading from a database or API).
301
+ */
302
+ resolve(input?: DomainProviderResolutionInput): T | Promise<T>;
303
+ /**
304
+ * Optional: subscribe to changes (enables push-based invalidation).
305
+ * Returns an unsubscribe function.
306
+ */
307
+ subscribe?(listener: (next: T) => void): () => void;
308
+ /** Cache TTL in ms. 0 = re-resolve every call (default). */
309
+ cacheTtlMs?: number;
310
+ /** Customer-controlled revision used to invalidate cached provider output. */
311
+ readonly providerRevision?: string | number;
312
+ }
313
+ /**
314
+ * The user's experiment assignments, keyed by **experiment handle** with the
315
+ * assigned **variant handle** as the value (plan 183).
316
+ *
317
+ * Handles on both sides, deliberately: a handle is the canonical, version-stable
318
+ * identifier, which is what a `Segment.experiment_handle` match and an analytics
319
+ * grouping must key on. The version id — which *definition* of the experiment
320
+ * was live — travels separately in telemetry, never as the match key.
321
+ *
322
+ * A map because a user can be enrolled in several experiments at once. Absent or
323
+ * empty means enrolled in nothing, which is distinct from "assigned to control".
324
+ */
325
+ interface ExperimentProviderState {
326
+ /** `{ [experimentHandle]: variantHandle }`. */
327
+ assignments: Record<string, string>;
328
+ /** Structured outcomes keyed by experiment handle, when supplied by the provider. */
329
+ selections?: Record<string, ExperimentVariantSelection>;
330
+ }
331
+ /** Named reasons for a provider not returning an assignment. */
332
+ type ExperimentVariantNonAssignmentReason = 'not_enrolled' | 'provider_not_ready' | 'provider_unavailable' | 'provider_error' | 'timeout' | 'aborted' | 'unknown_variant' | 'invalid_handle' | 'mapping_missing' | 'provider_missing' | 'ownership_conflict' | 'assignment_conflict';
333
+ /**
334
+ * Normalized result returned for one canonical experiment handle.
335
+ * Missing and failed vendor values remain explicit and never become control.
336
+ */
337
+ type ExperimentVariantSelection = {
338
+ status: 'assigned';
339
+ experimentHandle: string;
340
+ variantHandle: string;
341
+ providerHandle?: string;
342
+ providerRevision?: string | number;
343
+ } | {
344
+ status: 'not_assigned' | 'unavailable' | 'unsupported';
345
+ experimentHandle: string;
346
+ reason: ExperimentVariantNonAssignmentReason;
347
+ providerHandle?: string;
348
+ providerRevision?: string | number;
349
+ };
350
+ /**
351
+ * Supplies experiment enrollment and variant assignment.
352
+ *
353
+ * The binding declares whether RevTurbine manages the desired allocation or an
354
+ * external provider is authoritative. Both modes satisfy this one interface,
355
+ * so segment matching, decisions and telemetry never need to know which
356
+ * produced a value.
357
+ */
358
+ interface ExperimentAssignmentProvider extends DomainProvider<'experiments', ExperimentProviderState> {
359
+ readonly domain: 'experiments';
360
+ /** Stable diagnostic identifier; vendor credentials never belong here. */
361
+ readonly providerHandle?: string;
362
+ /** Canonical RevTurbine experiment handles this provider owns. */
363
+ readonly ownedExperimentHandles?: readonly string[];
364
+ }
365
+
366
+ /**
367
+ * Optimizely-backed experiment assignment provider.
368
+ *
369
+ * The customer injects an initialized client. The adapter contains no SDK
370
+ * credentials and is shipped only from the optional Optimizely entry point.
371
+ */
372
+
373
+ /** One RevTurbine experiment handle mapped to an Optimizely experiment key. */
374
+ interface OptimizelyExperimentBinding {
375
+ /** Stable RevTurbine experiment handle used by decisions and telemetry. */
376
+ experimentHandle: string;
377
+ /** Experiment key configured in the customer-owned Optimizely project. */
378
+ experimentKey: string;
379
+ /** Optional allowlist that rejects unexpected Optimizely variation keys. */
380
+ allowedVariants?: readonly string[];
381
+ }
382
+ /** Options for the separately bundled Optimizely assignment adapter. */
383
+ interface OptimizelyExperimentAssignmentOptions {
384
+ /** An initialized customer-owned Optimizely client. */
385
+ client: Pick<Client, 'getVariation'>;
386
+ /** Explicit experiment mappings; no naming convention is assumed. */
387
+ bindings: readonly OptimizelyExperimentBinding[];
388
+ /** Override how the Optimizely user id is derived from current context. */
389
+ userId?: (input: DomainProviderResolutionInput) => string | undefined;
390
+ /** Optional customer-owned Optimizely attributes for audience evaluation. */
391
+ attributes?: (input: DomainProviderResolutionInput) => UserAttributes | undefined;
392
+ /** Customer-controlled revision for Optimizely datafile/context changes. */
393
+ providerRevision?: string | number;
394
+ }
395
+ /** Machine-readable reasons an Optimizely assignment cannot be normalized. */
396
+ type OptimizelyAssignmentErrorReason = 'duplicate_experiment_handle' | 'invalid_binding' | 'unexpected_variant';
397
+ /** Raised for invalid Optimizely mappings or variation values. */
398
+ declare class OptimizelyAssignmentError extends Error {
399
+ /** Stable reason suitable for diagnostics and structured SDK outcomes. */
400
+ readonly reason: OptimizelyAssignmentErrorReason;
401
+ /** RevTurbine experiment whose mapping failed. */
402
+ readonly experimentHandle: string;
403
+ /** Optimizely experiment key used for lookup. */
404
+ readonly experimentKey: string;
405
+ /** Construct a named Optimizely normalization failure. */
406
+ constructor(reason: OptimizelyAssignmentErrorReason, binding: OptimizelyExperimentBinding, detail: string);
407
+ }
408
+ /**
409
+ * Create an assignment provider backed by an initialized Optimizely client.
410
+ * A null variation is retained as explicit non-enrollment and never converted
411
+ * to a control assignment.
412
+ */
413
+ declare function createOptimizelyExperimentAssignmentProvider(options: OptimizelyExperimentAssignmentOptions): ExperimentAssignmentProvider;
414
+
415
+ export { OptimizelyAssignmentError, createOptimizelyExperimentAssignmentProvider };
416
+ export type { OptimizelyAssignmentErrorReason, OptimizelyExperimentAssignmentOptions, OptimizelyExperimentBinding };
@@ -0,0 +1,2 @@
1
+ var m=Object.defineProperty;var x=(e,i,n)=>i in e?m(e,i,{enumerable:true,configurable:true,writable:true,value:n}):e[i]=n;var p=(e,i,n)=>x(e,typeof i!="symbol"?i+"":i,n);var s=class extends Error{constructor(n,t,d){super(`Optimizely assignment for experiment "${t.experimentHandle}" (experiment key "${t.experimentKey}") failed: ${d}`);p(this,"reason");p(this,"experimentHandle");p(this,"experimentKey");this.name="OptimizelyAssignmentError",this.reason=n,this.experimentHandle=t.experimentHandle,this.experimentKey=t.experimentKey;}};function v(e){let i=new Set;for(let n of e){if(!n.experimentHandle.trim()||!n.experimentKey.trim())throw new s("invalid_binding",n,"experiment handles and Optimizely keys must be non-empty");if(i.has(n.experimentHandle))throw new s("duplicate_experiment_handle",n,"the experiment handle is mapped more than once");i.add(n.experimentHandle);}}function u(e){return v(e.bindings),{domain:"experiments",providerHandle:"optimizely",providerRevision:e.providerRevision,ownedExperimentHandles:e.bindings.map(i=>i.experimentHandle),resolve(i){let n=new AbortController,t=i??{userContext:{},contextRevision:"legacy",signal:n.signal},d=e.userId?.(t)??t.userContext.id,l={},a={};for(let r of e.bindings){if(!d){a[r.experimentHandle]={status:"unavailable",experimentHandle:r.experimentHandle,reason:"provider_not_ready",providerHandle:"optimizely",...e.providerRevision!==void 0?{providerRevision:e.providerRevision}:{}};continue}let o=e.client.getVariation(r.experimentKey,d,e.attributes?.(t));if(o===null||o.length===0){a[r.experimentHandle]={status:"not_assigned",experimentHandle:r.experimentHandle,reason:"not_enrolled",providerHandle:"optimizely",...e.providerRevision!==void 0?{providerRevision:e.providerRevision}:{}};continue}if(r.allowedVariants&&!r.allowedVariants.includes(o))throw new s("unexpected_variant",r,`variant "${o}" is outside the configured allowlist`);l[r.experimentHandle]=o,a[r.experimentHandle]={status:"assigned",experimentHandle:r.experimentHandle,variantHandle:o,providerHandle:"optimizely",...e.providerRevision!==void 0?{providerRevision:e.providerRevision}:{}};}return {assignments:l,selections:a}}}}export{s as OptimizelyAssignmentError,u as createOptimizelyExperimentAssignmentProvider};//# sourceMappingURL=optimizely.js.map
2
+ //# sourceMappingURL=optimizely.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../providers/optimizely-experiment-provider.ts"],"names":["OptimizelyAssignmentError","reason","binding","detail","__publicField","validateBindings","bindings","handles","createOptimizelyExperimentAssignmentProvider","options","input","f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,CAAA,CAC7C,EACN,CAAA,CACA,QACF,CAEA,IAAMO,EAAUP,CAAAA,CAAQ,MAAA,CAAO,YAAA,CAC7BP,CAAAA,CAAQ,cACRW,CAAAA,CACAJ,CAAAA,CAAQ,UAAA,GAAaG,CAAe,CACtC,CAAA,CACA,GAAII,CAAAA,GAAY,IAAA,EAAQA,CAAAA,CAAQ,MAAA,GAAW,CAAA,CAAG,CAC5CD,EAAWb,CAAAA,CAAQ,gBAAgB,CAAA,CAAI,CACrC,OAAQ,cAAA,CACR,gBAAA,CAAkBA,CAAAA,CAAQ,gBAAA,CAC1B,OAAQ,cAAA,CACR,cAAA,CAAgB,YAAA,CAChB,GAAIO,CAAAA,CAAQ,gBAAA,GAAqB,MAAA,CAC7B,CAAE,iBAAkBA,CAAAA,CAAQ,gBAAiB,CAAA,CAC7C,EACN,CAAA,CACA,QACF,CACA,GAAIP,CAAAA,CAAQ,eAAA,EAAmB,CAACA,CAAAA,CAAQ,eAAA,CAAgB,QAAA,CAASc,CAAO,CAAA,CACtE,MAAM,IAAIhB,CAAAA,CACR,oBAAA,CACAE,CAAAA,CACA,YAAYc,CAAO,CAAA,qCAAA,CACrB,CAAA,CAGFF,CAAAA,CAAYZ,EAAQ,gBAAgB,CAAA,CAAIc,CAAAA,CACxCD,CAAAA,CAAWb,CAAAA,CAAQ,gBAAgB,CAAA,CAAI,CACrC,OAAQ,UAAA,CACR,gBAAA,CAAkBA,CAAAA,CAAQ,gBAAA,CAC1B,cAAec,CAAAA,CACf,cAAA,CAAgB,YAAA,CAChB,GAAIP,EAAQ,gBAAA,GAAqB,MAAA,CAC7B,CAAE,gBAAA,CAAkBA,CAAAA,CAAQ,gBAAiB,CAAA,CAC7C,EACN,EACF,CAEA,OAAO,CAAE,YAAAK,CAAAA,CAAa,UAAA,CAAAC,CAAW,CACnC,CACF,CACF","file":"optimizely.js","sourcesContent":["/**\n * Optimizely-backed experiment assignment provider.\n *\n * The customer injects an initialized client. The adapter contains no SDK\n * credentials and is shipped only from the optional Optimizely entry point.\n */\nimport type { Client, UserAttributes } from '@optimizely/optimizely-sdk';\nimport type {\n DomainProviderResolutionInput,\n ExperimentAssignmentProvider,\n ExperimentProviderState,\n} from '@revt-eng/core';\n\n/** One RevTurbine experiment handle mapped to an Optimizely experiment key. */\nexport interface OptimizelyExperimentBinding {\n /** Stable RevTurbine experiment handle used by decisions and telemetry. */\n experimentHandle: string;\n /** Experiment key configured in the customer-owned Optimizely project. */\n experimentKey: string;\n /** Optional allowlist that rejects unexpected Optimizely variation keys. */\n allowedVariants?: readonly string[];\n}\n\n/** Options for the separately bundled Optimizely assignment adapter. */\nexport interface OptimizelyExperimentAssignmentOptions {\n /** An initialized customer-owned Optimizely client. */\n client: Pick<Client, 'getVariation'>;\n /** Explicit experiment mappings; no naming convention is assumed. */\n bindings: readonly OptimizelyExperimentBinding[];\n /** Override how the Optimizely user id is derived from current context. */\n userId?: (input: DomainProviderResolutionInput) => string | undefined;\n /** Optional customer-owned Optimizely attributes for audience evaluation. */\n attributes?: (input: DomainProviderResolutionInput) => UserAttributes | undefined;\n /** Customer-controlled revision for Optimizely datafile/context changes. */\n providerRevision?: string | number;\n}\n\n/** Machine-readable reasons an Optimizely assignment cannot be normalized. */\nexport type OptimizelyAssignmentErrorReason =\n | 'duplicate_experiment_handle'\n | 'invalid_binding'\n | 'unexpected_variant';\n\n/** Raised for invalid Optimizely mappings or variation values. */\nexport class OptimizelyAssignmentError extends Error {\n /** Stable reason suitable for diagnostics and structured SDK outcomes. */\n readonly reason: OptimizelyAssignmentErrorReason;\n /** RevTurbine experiment whose mapping failed. */\n readonly experimentHandle: string;\n /** Optimizely experiment key used for lookup. */\n readonly experimentKey: string;\n\n /** Construct a named Optimizely normalization failure. */\n constructor(\n reason: OptimizelyAssignmentErrorReason,\n binding: OptimizelyExperimentBinding,\n detail: string,\n ) {\n super(\n `Optimizely assignment for experiment \"${binding.experimentHandle}\" `\n + `(experiment key \"${binding.experimentKey}\") failed: ${detail}`,\n );\n this.name = 'OptimizelyAssignmentError';\n this.reason = reason;\n this.experimentHandle = binding.experimentHandle;\n this.experimentKey = binding.experimentKey;\n }\n}\n\nfunction validateBindings(bindings: readonly OptimizelyExperimentBinding[]): void {\n const handles = new Set<string>();\n for (const binding of bindings) {\n if (!binding.experimentHandle.trim() || !binding.experimentKey.trim()) {\n throw new OptimizelyAssignmentError(\n 'invalid_binding',\n binding,\n 'experiment handles and Optimizely keys must be non-empty',\n );\n }\n if (handles.has(binding.experimentHandle)) {\n throw new OptimizelyAssignmentError(\n 'duplicate_experiment_handle',\n binding,\n 'the experiment handle is mapped more than once',\n );\n }\n handles.add(binding.experimentHandle);\n }\n}\n\n/**\n * Create an assignment provider backed by an initialized Optimizely client.\n * A null variation is retained as explicit non-enrollment and never converted\n * to a control assignment.\n */\nexport function createOptimizelyExperimentAssignmentProvider(\n options: OptimizelyExperimentAssignmentOptions,\n): ExperimentAssignmentProvider {\n validateBindings(options.bindings);\n\n return {\n domain: 'experiments',\n providerHandle: 'optimizely',\n providerRevision: options.providerRevision,\n ownedExperimentHandles: options.bindings.map((binding) => binding.experimentHandle),\n resolve(input?: DomainProviderResolutionInput): ExperimentProviderState {\n const fallbackController = new AbortController();\n const resolutionInput = input ?? {\n userContext: {},\n contextRevision: 'legacy',\n signal: fallbackController.signal,\n };\n const userId = options.userId?.(resolutionInput) ?? resolutionInput.userContext.id;\n const assignments: Record<string, string> = {};\n const selections: NonNullable<ExperimentProviderState['selections']> = {};\n\n for (const binding of options.bindings) {\n if (!userId) {\n selections[binding.experimentHandle] = {\n status: 'unavailable',\n experimentHandle: binding.experimentHandle,\n reason: 'provider_not_ready',\n providerHandle: 'optimizely',\n ...(options.providerRevision !== undefined\n ? { providerRevision: options.providerRevision }\n : {}),\n };\n continue;\n }\n\n const variant = options.client.getVariation(\n binding.experimentKey,\n userId,\n options.attributes?.(resolutionInput),\n );\n if (variant === null || variant.length === 0) {\n selections[binding.experimentHandle] = {\n status: 'not_assigned',\n experimentHandle: binding.experimentHandle,\n reason: 'not_enrolled',\n providerHandle: 'optimizely',\n ...(options.providerRevision !== undefined\n ? { providerRevision: options.providerRevision }\n : {}),\n };\n continue;\n }\n if (binding.allowedVariants && !binding.allowedVariants.includes(variant)) {\n throw new OptimizelyAssignmentError(\n 'unexpected_variant',\n binding,\n `variant \"${variant}\" is outside the configured allowlist`,\n );\n }\n\n assignments[binding.experimentHandle] = variant;\n selections[binding.experimentHandle] = {\n status: 'assigned',\n experimentHandle: binding.experimentHandle,\n variantHandle: variant,\n providerHandle: 'optimizely',\n ...(options.providerRevision !== undefined\n ? { providerRevision: options.providerRevision }\n : {}),\n };\n }\n\n return { assignments, selections };\n },\n };\n}\n"]}
@@ -31,7 +31,7 @@ export interface LocalEvaluationServerOptions {
31
31
  providers: AnyDomainProvider[];
32
32
  /** RevTurbineConfig for local placement resolution. */
33
33
  exportedConfig?: ConfigArtifact;
34
- /** Target fallback for legacy configs that predate environment stamping. */
34
+ /** Target fallback for legacy configs. Omitted or blank resolves to `production`. */
35
35
  environmentId?: string;
36
36
  /** Optional storage for interaction state (defaults to in-memory). */
37
37
  storage?: RevTurbineStorage;
@@ -1 +1 @@
1
- {"version":3,"file":"local-server.d.ts","sourceRoot":"","sources":["../../../../server-node/local-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAKH,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EACV,uBAAuB,EAGxB,MAAM,SAAS,CAAC;AASjB,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,4FAA4F;IAC5F,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,uDAAuD;IACvD,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,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;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,4FAA4F;IAC5F,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,uDAAuD;IACvD,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,qFAAqF;IACrF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,KAAK,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC,CAAC;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;gBAE/B,OAAO,EAAE,4BAA4B;IAyB3C,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAwDlF;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,4BAA4B,GACpC,qBAAqB,CAEvB"}
@@ -35,7 +35,7 @@ import { type ConfigArtifact } from './config-artifact';
35
35
  export interface BrowserRuntimeOptions extends Omit<LocalRuntimeOptions, 'storage' | 'impressionStore' | 'exportedConfig'> {
36
36
  /** Canonical Playbook or deprecated RevTurbineConfig input. */
37
37
  exportedConfig: ConfigArtifact;
38
- /** Target fallback for legacy configs that predate environment stamping. */
38
+ /** Target fallback for legacy configs. Omitted or blank resolves to `production`. */
39
39
  environmentId?: string;
40
40
  /**
41
41
  * Override the storage backend. When omitted, `localStorage` is used
@@ -1 +1 @@
1
- {"version":3,"file":"browser-runtime.d.ts","sourceRoot":"","sources":["../../../browser-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,YAAY,EAA0B,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAM3B,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,mBAAmB,EACnB,SAAS,GAAG,iBAAiB,GAAG,gBAAgB,CACjD;IACC,+DAA+D;IAC/D,cAAc,EAAE,cAAc,CAAC;IAE/B,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAE5B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAMD,qBAAa,cAAe,SAAQ,YAAY;IAC9C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAuB;gBAE3C,OAAO,EAAE,qBAAqB;IAqC1C;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAK7B"}
1
+ {"version":3,"file":"browser-runtime.d.ts","sourceRoot":"","sources":["../../../browser-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,YAAY,EAA0B,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAO3B,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,mBAAmB,EACnB,SAAS,GAAG,iBAAiB,GAAG,gBAAgB,CACjD;IACC,+DAA+D;IAC/D,cAAc,EAAE,cAAc,CAAC;IAE/B,qFAAqF;IACrF,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAE5B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAMD,qBAAa,cAAe,SAAQ,YAAY;IAC9C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAuB;gBAE3C,OAAO,EAAE,qBAAqB;IAqC1C;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAK7B"}
@@ -1,5 +1,5 @@
1
1
  import { DomainProviderRegistry } from './providers/registry';
2
- import type { AnyDomainProvider } from './providers/types';
2
+ import type { AnyDomainProvider, ExperimentVariantSelection } from './providers/types';
3
3
  import { type ResolvedBranding } from './branding';
4
4
  import type { BrandingConfig } from './generated';
5
5
  import type { ControlPlaneEventType } from './control-plane-events';
@@ -534,9 +534,9 @@ export interface RevTurbineInitOptions {
534
534
  trustedManifestKeys?: readonly TrustedKey[];
535
535
  /**
536
536
  * Environment identifier stamped on every ingested clickstream event
537
- * (`TrackEvent.environment_id`, e.g. `'prod'` / `'staging'`). Lets a
537
+ * (`TrackEvent.environment_id`, e.g. `'production'` / `'staging'`). Lets a
538
538
  * tenant separate analytics by deployment environment. Defaults to
539
- * `'default'` when omitted.
539
+ * `'production'` when omitted, empty, or whitespace-only.
540
540
  */
541
541
  environmentId?: string;
542
542
  /**
@@ -651,6 +651,8 @@ export interface RevTurbineInitOptions {
651
651
  providerFailureSlotBehavior?: RevTurbineProviderFailureSlotBehavior;
652
652
  /** Typed domain providers (plan, entitlements, segments, content, rules, traits). */
653
653
  domainProviders?: AnyDomainProvider[];
654
+ /** Maximum time for one client experiment provider resolution. Default: 5000ms. */
655
+ experimentProviderTimeoutMs?: number;
654
656
  /** Optional UI path resolver map used by `validateUiPathResolvers()`. */
655
657
  uiPathResolvers?: RevTurbineUiPathResolverMap;
656
658
  /**
@@ -1312,6 +1314,9 @@ export declare class RevTurbineCustomerSdk {
1312
1314
  private readonly placements;
1313
1315
  private readonly syncedSurfaceSlotIds;
1314
1316
  private userContext;
1317
+ private contextRevision;
1318
+ private providerResolutionController;
1319
+ private lastEffectiveContext?;
1315
1320
  private pageContext;
1316
1321
  /**
1317
1322
  * Secure per-user client token (`rt_client_`, plan 157). Minted by the
@@ -1400,6 +1405,17 @@ export declare class RevTurbineCustomerSdk {
1400
1405
  * interpolation (e.g. `{{usage_remaining}}`).
1401
1406
  */
1402
1407
  private synthesizeProviderContext;
1408
+ private immutableProviderUserContext;
1409
+ private invalidateEffectiveContext;
1410
+ private resolveEffectiveProviderContext;
1411
+ /**
1412
+ * Resolve the normalized variant used by RevTurbine decisions and telemetry.
1413
+ * Missing, conflicting, and unavailable assignments remain explicit and are
1414
+ * never converted to a control variant.
1415
+ */
1416
+ getExperimentVariant(experimentHandle: string): Promise<ExperimentVariantSelection>;
1417
+ /** Return the immutable ephemeral context currently entering local evaluation. */
1418
+ getEffectiveUserContext(): Promise<Readonly<RevTurbineUserContext>>;
1403
1419
  private markAllSegmentsDirty;
1404
1420
  private markSegmentsDirtyForFields;
1405
1421
  private toSegmentEvaluationTraits;