@oursprivacy/platform-sdk 1.12.0 → 1.13.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.
Files changed (152) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +31 -0
  3. package/client.d.mts +32 -14
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +32 -14
  6. package/client.d.ts.map +1 -1
  7. package/client.js +26 -4
  8. package/client.js.map +1 -1
  9. package/client.mjs +26 -4
  10. package/client.mjs.map +1 -1
  11. package/core/pagination.d.mts +60 -0
  12. package/core/pagination.d.mts.map +1 -0
  13. package/core/pagination.d.ts +60 -0
  14. package/core/pagination.d.ts.map +1 -0
  15. package/core/pagination.js +101 -0
  16. package/core/pagination.js.map +1 -0
  17. package/core/pagination.mjs +95 -0
  18. package/core/pagination.mjs.map +1 -0
  19. package/index.d.mts +1 -0
  20. package/index.d.mts.map +1 -1
  21. package/index.d.ts +1 -0
  22. package/index.d.ts.map +1 -1
  23. package/index.js +3 -1
  24. package/index.js.map +1 -1
  25. package/index.mjs +1 -0
  26. package/index.mjs.map +1 -1
  27. package/package.json +11 -1
  28. package/pagination.d.mts +2 -0
  29. package/pagination.d.mts.map +1 -0
  30. package/pagination.d.ts +2 -0
  31. package/pagination.d.ts.map +1 -0
  32. package/pagination.js +6 -0
  33. package/pagination.js.map +1 -0
  34. package/pagination.mjs +2 -0
  35. package/pagination.mjs.map +1 -0
  36. package/resources/allowed-events.d.mts +18 -18
  37. package/resources/allowed-events.d.mts.map +1 -1
  38. package/resources/allowed-events.d.ts +18 -18
  39. package/resources/allowed-events.d.ts.map +1 -1
  40. package/resources/allowed-events.js +7 -7
  41. package/resources/allowed-events.js.map +1 -1
  42. package/resources/allowed-events.mjs +7 -7
  43. package/resources/allowed-events.mjs.map +1 -1
  44. package/resources/consent-settings.d.mts +2568 -124
  45. package/resources/consent-settings.d.mts.map +1 -1
  46. package/resources/consent-settings.d.ts +2568 -124
  47. package/resources/consent-settings.d.ts.map +1 -1
  48. package/resources/consent-settings.js +24 -7
  49. package/resources/consent-settings.js.map +1 -1
  50. package/resources/consent-settings.mjs +24 -7
  51. package/resources/consent-settings.mjs.map +1 -1
  52. package/resources/destinations.d.mts +33 -32
  53. package/resources/destinations.d.mts.map +1 -1
  54. package/resources/destinations.d.ts +33 -32
  55. package/resources/destinations.d.ts.map +1 -1
  56. package/resources/destinations.js +8 -7
  57. package/resources/destinations.js.map +1 -1
  58. package/resources/destinations.mjs +8 -7
  59. package/resources/destinations.mjs.map +1 -1
  60. package/resources/experiment-settings.d.mts +277 -0
  61. package/resources/experiment-settings.d.mts.map +1 -0
  62. package/resources/experiment-settings.d.ts +277 -0
  63. package/resources/experiment-settings.d.ts.map +1 -0
  64. package/resources/experiment-settings.js +77 -0
  65. package/resources/experiment-settings.js.map +1 -0
  66. package/resources/experiment-settings.mjs +73 -0
  67. package/resources/experiment-settings.mjs.map +1 -0
  68. package/resources/experiment-variants.d.mts +659 -0
  69. package/resources/experiment-variants.d.mts.map +1 -0
  70. package/resources/experiment-variants.d.ts +659 -0
  71. package/resources/experiment-variants.d.ts.map +1 -0
  72. package/resources/experiment-variants.js +79 -0
  73. package/resources/experiment-variants.js.map +1 -0
  74. package/resources/experiment-variants.mjs +75 -0
  75. package/resources/experiment-variants.mjs.map +1 -0
  76. package/resources/experiments.d.mts +2002 -0
  77. package/resources/experiments.d.mts.map +1 -0
  78. package/resources/experiments.d.ts +2002 -0
  79. package/resources/experiments.d.ts.map +1 -0
  80. package/resources/experiments.js +166 -0
  81. package/resources/experiments.js.map +1 -0
  82. package/resources/experiments.mjs +162 -0
  83. package/resources/experiments.mjs.map +1 -0
  84. package/resources/global-dispatch-centers.d.mts +125 -58
  85. package/resources/global-dispatch-centers.d.mts.map +1 -1
  86. package/resources/global-dispatch-centers.d.ts +125 -58
  87. package/resources/global-dispatch-centers.d.ts.map +1 -1
  88. package/resources/global-dispatch-centers.js +10 -7
  89. package/resources/global-dispatch-centers.js.map +1 -1
  90. package/resources/global-dispatch-centers.mjs +10 -7
  91. package/resources/global-dispatch-centers.mjs.map +1 -1
  92. package/resources/index.d.mts +11 -7
  93. package/resources/index.d.mts.map +1 -1
  94. package/resources/index.d.ts +11 -7
  95. package/resources/index.d.ts.map +1 -1
  96. package/resources/index.js +9 -1
  97. package/resources/index.js.map +1 -1
  98. package/resources/index.mjs +4 -0
  99. package/resources/index.mjs.map +1 -1
  100. package/resources/mappings.d.mts +136 -0
  101. package/resources/mappings.d.mts.map +1 -0
  102. package/resources/mappings.d.ts +136 -0
  103. package/resources/mappings.d.ts.map +1 -0
  104. package/resources/mappings.js +41 -0
  105. package/resources/mappings.js.map +1 -0
  106. package/resources/mappings.mjs +37 -0
  107. package/resources/mappings.mjs.map +1 -0
  108. package/resources/replay-settings.d.mts +48 -48
  109. package/resources/replay-settings.d.mts.map +1 -1
  110. package/resources/replay-settings.d.ts +48 -48
  111. package/resources/replay-settings.d.ts.map +1 -1
  112. package/resources/replay-settings.js +13 -8
  113. package/resources/replay-settings.js.map +1 -1
  114. package/resources/replay-settings.mjs +13 -8
  115. package/resources/replay-settings.mjs.map +1 -1
  116. package/resources/sources.d.mts +64 -27
  117. package/resources/sources.d.mts.map +1 -1
  118. package/resources/sources.d.ts +64 -27
  119. package/resources/sources.d.ts.map +1 -1
  120. package/resources/sources.js +14 -7
  121. package/resources/sources.js.map +1 -1
  122. package/resources/sources.mjs +14 -7
  123. package/resources/sources.mjs.map +1 -1
  124. package/resources/versions.d.mts +742 -16
  125. package/resources/versions.d.mts.map +1 -1
  126. package/resources/versions.d.ts +742 -16
  127. package/resources/versions.d.ts.map +1 -1
  128. package/resources/versions.js +45 -5
  129. package/resources/versions.js.map +1 -1
  130. package/resources/versions.mjs +45 -5
  131. package/resources/versions.mjs.map +1 -1
  132. package/src/client.ts +206 -29
  133. package/src/core/pagination.ts +165 -0
  134. package/src/index.ts +1 -0
  135. package/src/pagination.ts +2 -0
  136. package/src/resources/allowed-events.ts +27 -27
  137. package/src/resources/consent-settings.ts +3036 -244
  138. package/src/resources/destinations.ts +128 -127
  139. package/src/resources/experiment-settings.ts +367 -0
  140. package/src/resources/experiment-variants.ts +870 -0
  141. package/src/resources/experiments.ts +2446 -0
  142. package/src/resources/global-dispatch-centers.ts +155 -65
  143. package/src/resources/index.ts +75 -7
  144. package/src/resources/mappings.ts +230 -0
  145. package/src/resources/replay-settings.ts +67 -59
  146. package/src/resources/sources.ts +116 -71
  147. package/src/resources/versions.ts +1130 -17
  148. package/src/version.ts +1 -1
  149. package/version.d.mts +1 -1
  150. package/version.d.ts +1 -1
  151. package/version.js +1 -1
  152. package/version.mjs +1 -1
@@ -0,0 +1,2446 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
8
+
9
+ export class Experiments extends APIResource {
10
+ /**
11
+ * List experiments for this account. Supports cursor pagination and filtering by
12
+ * `status`, `type`, and free-text `search` matched against experiment id, name,
13
+ * and description. Combine filters with AND semantics. Requires scope:
14
+ * experiment:list
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * // Automatically fetches more pages as needed.
19
+ * for await (const experimentListResponse of client.experiments.list()) {
20
+ * // ...
21
+ * }
22
+ * ```
23
+ */
24
+ list(
25
+ query: ExperimentListParams | null | undefined = {},
26
+ options?: RequestOptions,
27
+ ): PagePromise<ExperimentListResponsesCursor, ExperimentListResponse> {
28
+ return this._client.getAPIList('/rest/v1/experiments', Cursor<ExperimentListResponse>, {
29
+ query,
30
+ ...options,
31
+ });
32
+ }
33
+
34
+ /**
35
+ * Create a new experiment. Requires scope: experiment:create
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const experiment = await client.experiments.create({
40
+ * experimentSettingsId:
41
+ * 'settings_01HZX9BB73EY2Q37VGK5A0VW7A',
42
+ * name: 'Homepage Hero Headline Test',
43
+ * });
44
+ * ```
45
+ */
46
+ create(body: ExperimentCreateParams, options?: RequestOptions): APIPromise<ExperimentCreateResponse> {
47
+ return this._client.post('/rest/v1/experiments', { body, ...options });
48
+ }
49
+
50
+ /**
51
+ * Find a single experiment by ID. Requires scope: experiment:find
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const experiment = await client.experiments.retrieve('id');
56
+ * ```
57
+ */
58
+ retrieve(id: string, options?: RequestOptions): APIPromise<ExperimentRetrieveResponse> {
59
+ return this._client.get(path`/rest/v1/experiments/${id}`, options);
60
+ }
61
+
62
+ /**
63
+ * Partially update an experiment. Only the fields you send are changed. Edits are
64
+ * only accepted while the experiment is in `draft` status — running, paused, and
65
+ * completed experiments return 409 with
66
+ * `Experiment can only be edited in draft status`. Use the lifecycle endpoints
67
+ * (`/start`, `/pause`, `/resume`, `/stop`) to change status. Requires scope:
68
+ * experiment:update
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const experiment = await client.experiments.update('id');
73
+ * ```
74
+ */
75
+ update(
76
+ id: string,
77
+ body: ExperimentUpdateParams,
78
+ options?: RequestOptions,
79
+ ): APIPromise<ExperimentUpdateResponse> {
80
+ return this._client.patch(path`/rest/v1/experiments/${id}`, { body, ...options });
81
+ }
82
+
83
+ /**
84
+ * Delete an experiment. Requires scope: experiment:delete
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * const experiment = await client.experiments.delete('id');
89
+ * ```
90
+ */
91
+ delete(id: string, options?: RequestOptions): APIPromise<ExperimentDeleteResponse> {
92
+ return this._client.delete(path`/rest/v1/experiments/${id}`, options);
93
+ }
94
+
95
+ /**
96
+ * Start an experiment. The request body is optional — send `{}` to use defaults.
97
+ * Requires scope: experiment:start
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * const response = await client.experiments.start('id');
102
+ * ```
103
+ */
104
+ start(
105
+ id: string,
106
+ body: ExperimentStartParams | null | undefined = {},
107
+ options?: RequestOptions,
108
+ ): APIPromise<ExperimentStartResponse> {
109
+ return this._client.post(path`/rest/v1/experiments/${id}/start`, { body, ...options });
110
+ }
111
+
112
+ /**
113
+ * Stop an experiment. The request body is optional — send `{}` to stop without
114
+ * recording a winner. Requires scope: experiment:stop
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * const response = await client.experiments.stop('id');
119
+ * ```
120
+ */
121
+ stop(
122
+ id: string,
123
+ body: ExperimentStopParams | null | undefined = {},
124
+ options?: RequestOptions,
125
+ ): APIPromise<ExperimentStopResponse> {
126
+ return this._client.post(path`/rest/v1/experiments/${id}/stop`, { body, ...options });
127
+ }
128
+
129
+ /**
130
+ * Pause a running experiment. Stops new variant assignments while preserving
131
+ * existing ones; the experiment can later be resumed. The request body is
132
+ * optional. Requires scope: experiment:stop
133
+ *
134
+ * @example
135
+ * ```ts
136
+ * const response = await client.experiments.pause('id');
137
+ * ```
138
+ */
139
+ pause(
140
+ id: string,
141
+ body: ExperimentPauseParams | null | undefined = {},
142
+ options?: RequestOptions,
143
+ ): APIPromise<ExperimentPauseResponse> {
144
+ return this._client.post(path`/rest/v1/experiments/${id}/pause`, { body, ...options });
145
+ }
146
+
147
+ /**
148
+ * Resume a previously-paused experiment so new visitors can be assigned again. The
149
+ * request body is optional. Requires scope: experiment:start
150
+ *
151
+ * @example
152
+ * ```ts
153
+ * const response = await client.experiments.resume('id');
154
+ * ```
155
+ */
156
+ resume(
157
+ id: string,
158
+ body: ExperimentResumeParams | null | undefined = {},
159
+ options?: RequestOptions,
160
+ ): APIPromise<ExperimentResumeResponse> {
161
+ return this._client.post(path`/rest/v1/experiments/${id}/resume`, { body, ...options });
162
+ }
163
+
164
+ /**
165
+ * Aggregate per-variant impressions, conversions, conversion rate, and Bayesian
166
+ * probability-to-be-best across the experiment runtime window. Requires scope:
167
+ * experiment:find
168
+ *
169
+ * @example
170
+ * ```ts
171
+ * const response = await client.experiments.results('id');
172
+ * ```
173
+ */
174
+ results(
175
+ id: string,
176
+ query: ExperimentResultsParams | null | undefined = {},
177
+ options?: RequestOptions,
178
+ ): APIPromise<ExperimentResultsResponse> {
179
+ return this._client.get(path`/rest/v1/experiments/${id}/results`, { query, ...options });
180
+ }
181
+
182
+ /**
183
+ * Per-day per-variant impressions, conversions, and conversion rate, sliced to a
184
+ * date range. Use this to chart trends, compare windows, or zoom in on a specific
185
+ * period. Pass `startDate` / `endDate` (`YYYY-MM-DD`, UTC, both inclusive) to set
186
+ * the window; both default to the full experiment runtime when omitted, so the
187
+ * no-arg call returns every day from start to today (or to `stoppedAt` for
188
+ * completed experiments). The response orders days oldest-first and omits days
189
+ * with no impressions, so an empty `days` array means there was no measured
190
+ * traffic in the window. Requires scope: experiment:find
191
+ *
192
+ * @example
193
+ * ```ts
194
+ * const response = await client.experiments.resultsTimeSeries(
195
+ * 'id',
196
+ * );
197
+ * ```
198
+ */
199
+ resultsTimeSeries(
200
+ id: string,
201
+ query: ExperimentResultsTimeSeriesParams | null | undefined = {},
202
+ options?: RequestOptions,
203
+ ): APIPromise<ExperimentResultsTimeSeriesResponse> {
204
+ return this._client.get(path`/rest/v1/experiments/${id}/results-time-series`, { query, ...options });
205
+ }
206
+ }
207
+
208
+ export type ExperimentListResponsesCursor = Cursor<ExperimentListResponse>;
209
+
210
+ export interface ExperimentListResponse {
211
+ /**
212
+ * Unique identifier for the experiment.
213
+ */
214
+ id: string;
215
+
216
+ /**
217
+ * ISO-8601 timestamp when the experiment was created.
218
+ */
219
+ createdAt: string;
220
+
221
+ /**
222
+ * Stable code-facing key for the experiment. Use this with the headless SDK
223
+ * `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
224
+ * application code.
225
+ */
226
+ key: string;
227
+
228
+ /**
229
+ * Short, human-readable experiment name.
230
+ */
231
+ name: string;
232
+
233
+ /**
234
+ * Lifecycle state. `draft` is editable, `running` is active, `paused` is
235
+ * temporarily inactive, and `completed` is permanently stopped.
236
+ */
237
+ status: 'completed' | 'draft' | 'paused' | 'running';
238
+
239
+ /**
240
+ * Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
241
+ * enrollment without deleting the experiment.
242
+ */
243
+ trafficAllocation: number;
244
+
245
+ /**
246
+ * Optional human-readable hypothesis or summary. In GraphQL this is backed by the
247
+ * experiment hypothesis field.
248
+ */
249
+ description?: string | null;
250
+
251
+ /**
252
+ * For redirect variants, whether the original page query string should be
253
+ * forwarded onto the redirect URL.
254
+ */
255
+ includeQueryString?: boolean | null;
256
+
257
+ /**
258
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
259
+ * from a GET response can be PATCHed back without modification.
260
+ */
261
+ metrics?: ExperimentListResponse.Metrics | null;
262
+
263
+ /**
264
+ * ISO-8601 timestamp when the experiment most recently entered a running state.
265
+ */
266
+ startedAt?: string | null;
267
+
268
+ /**
269
+ * ISO-8601 timestamp when the experiment was completed, if it has been stopped.
270
+ */
271
+ stoppedAt?: string | null;
272
+
273
+ /**
274
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
275
+ * visitor status, and (server-side) visitor properties. Same shape as the
276
+ * create/patch input.
277
+ */
278
+ targetingRules?: ExperimentListResponse.TargetingRules | null;
279
+
280
+ /**
281
+ * Experiment mode. `ab` and `multivariate` use traffic allocation and results;
282
+ * `personalization` is always-on targeting.
283
+ */
284
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
285
+
286
+ /**
287
+ * ISO-8601 timestamp for the last persisted update, if any.
288
+ */
289
+ updatedAt?: string | null;
290
+
291
+ /**
292
+ * Variant ID persisted as the winner when the experiment was stopped. Set via
293
+ * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
294
+ */
295
+ winnerVariantId?: string | null;
296
+ }
297
+
298
+ export namespace ExperimentListResponse {
299
+ /**
300
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
301
+ * from a GET response can be PATCHed back without modification.
302
+ */
303
+ export interface Metrics {
304
+ /**
305
+ * Primary success metric used in the results report.
306
+ */
307
+ primary?: unknown | null;
308
+
309
+ /**
310
+ * Optional secondary metrics tracked alongside the primary goal.
311
+ */
312
+ secondary?: Array<Metrics.Secondary> | null;
313
+ }
314
+
315
+ export namespace Metrics {
316
+ export interface Secondary {
317
+ /**
318
+ * Name of the event used to measure success for this metric.
319
+ */
320
+ eventName?: string | null;
321
+
322
+ /**
323
+ * Optional funnel identifier when the metric is derived from an existing funnel
324
+ * definition.
325
+ */
326
+ funnelId?: string | null;
327
+ }
328
+ }
329
+
330
+ /**
331
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
332
+ * visitor status, and (server-side) visitor properties. Same shape as the
333
+ * create/patch input.
334
+ */
335
+ export interface TargetingRules {
336
+ /**
337
+ * Glob-style URL patterns that must match for the experiment to be eligible. Up to
338
+ * 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
339
+ * the field) matches all URLs — equivalent to `["**"]`.
340
+ */
341
+ urlPatterns: Array<string>;
342
+
343
+ /**
344
+ * Optional audience identifier used for server-side eligibility filtering.
345
+ */
346
+ audienceId?: string | null;
347
+
348
+ /**
349
+ * Additional query-string conditions that must all match for the visitor to
350
+ * qualify.
351
+ */
352
+ queryParams?: Array<TargetingRules.QueryParam> | null;
353
+
354
+ /**
355
+ * Optional visitor-property matching rules. These are passed through as JSON for
356
+ * experimentation targeting.
357
+ */
358
+ visitorProperties?: unknown | null;
359
+
360
+ /**
361
+ * Whether the experiment should target new visitors, returning visitors, or any
362
+ * visitor.
363
+ */
364
+ visitorStatus?: string | null;
365
+ }
366
+
367
+ export namespace TargetingRules {
368
+ export interface QueryParam {
369
+ /**
370
+ * Query string key to inspect on the current page URL.
371
+ */
372
+ key: string;
373
+
374
+ /**
375
+ * Comparison operator applied to the query string value.
376
+ */
377
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
378
+
379
+ /**
380
+ * Comparison value used by operators that require one. Omit for `exists` and
381
+ * `not_exists`.
382
+ */
383
+ value?: string | null;
384
+ }
385
+ }
386
+ }
387
+
388
+ export interface ExperimentCreateResponse {
389
+ /**
390
+ * Unique identifier for the experiment.
391
+ */
392
+ id: string;
393
+
394
+ /**
395
+ * ISO-8601 timestamp when the experiment was created.
396
+ */
397
+ createdAt: string;
398
+
399
+ /**
400
+ * Stable code-facing key for the experiment. Use this with the headless SDK
401
+ * `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
402
+ * application code.
403
+ */
404
+ key: string;
405
+
406
+ /**
407
+ * Short, human-readable experiment name.
408
+ */
409
+ name: string;
410
+
411
+ /**
412
+ * Lifecycle state. `draft` is editable, `running` is active, `paused` is
413
+ * temporarily inactive, and `completed` is permanently stopped.
414
+ */
415
+ status: 'completed' | 'draft' | 'paused' | 'running';
416
+
417
+ /**
418
+ * Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
419
+ * enrollment without deleting the experiment.
420
+ */
421
+ trafficAllocation: number;
422
+
423
+ /**
424
+ * All persisted variants for this experiment, including the control variant. A
425
+ * non-personalization experiment needs at least two variants before it can be
426
+ * started.
427
+ */
428
+ variants: Array<ExperimentCreateResponse.Variant>;
429
+
430
+ /**
431
+ * Optional human-readable hypothesis or summary. In GraphQL this is backed by the
432
+ * experiment hypothesis field.
433
+ */
434
+ description?: string | null;
435
+
436
+ /**
437
+ * For redirect variants, whether the original page query string should be
438
+ * forwarded onto the redirect URL.
439
+ */
440
+ includeQueryString?: boolean | null;
441
+
442
+ /**
443
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
444
+ * from a GET response can be PATCHed back without modification.
445
+ */
446
+ metrics?: ExperimentCreateResponse.Metrics | null;
447
+
448
+ /**
449
+ * ISO-8601 timestamp when the experiment most recently entered a running state.
450
+ */
451
+ startedAt?: string | null;
452
+
453
+ /**
454
+ * ISO-8601 timestamp when the experiment was completed, if it has been stopped.
455
+ */
456
+ stoppedAt?: string | null;
457
+
458
+ /**
459
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
460
+ * visitor status, and (server-side) visitor properties. Same shape as the
461
+ * create/patch input.
462
+ */
463
+ targetingRules?: ExperimentCreateResponse.TargetingRules | null;
464
+
465
+ /**
466
+ * Experiment mode. `ab` and `multivariate` use traffic allocation and results;
467
+ * `personalization` is always-on targeting.
468
+ */
469
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
470
+
471
+ /**
472
+ * ISO-8601 timestamp for the last persisted update, if any.
473
+ */
474
+ updatedAt?: string | null;
475
+
476
+ /**
477
+ * Variant ID persisted as the winner when the experiment was stopped. Set via
478
+ * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
479
+ */
480
+ winnerVariantId?: string | null;
481
+ }
482
+
483
+ export namespace ExperimentCreateResponse {
484
+ export interface Variant {
485
+ /**
486
+ * Unique identifier for this experiment variant.
487
+ */
488
+ id: string;
489
+
490
+ /**
491
+ * Parent experiment ID this variant belongs to.
492
+ */
493
+ experimentId: string;
494
+
495
+ /**
496
+ * Whether this is the baseline control variant.
497
+ */
498
+ isControl: boolean;
499
+
500
+ /**
501
+ * Human-readable variant name shown in the dashboard and results.
502
+ */
503
+ name: string;
504
+
505
+ /**
506
+ * Relative traffic weight used when assigning visitors among variants in an active
507
+ * experiment.
508
+ */
509
+ weight: number;
510
+
511
+ /**
512
+ * Ordered list of declarative DOM mutations applied when this variant is assigned.
513
+ */
514
+ domModifications?: Array<Variant.DomModification> | null;
515
+
516
+ /**
517
+ * Target URL for redirect variants. Use either a site-relative path such as
518
+ * `/pricing-v2` or an absolute `https://` URL. Cross-origin `http://` URLs are
519
+ * rejected. Omit for DOM modification variants.
520
+ */
521
+ redirectUrl?: string | null;
522
+
523
+ /**
524
+ * How this variant changes the user experience. `dom_modifications` for on-page
525
+ * changes or `redirect` for redirect tests.
526
+ */
527
+ variantType?: string | null;
528
+ }
529
+
530
+ export namespace Variant {
531
+ export interface DomModification {
532
+ /**
533
+ * Mutation to apply when the selector matches. Use `redirectUrl` instead of DOM
534
+ * modifications for redirect variants.
535
+ */
536
+ action:
537
+ | 'customCss'
538
+ | 'customJs'
539
+ | 'insertAfter'
540
+ | 'insertBefore'
541
+ | 'remove'
542
+ | 'setAttribute'
543
+ | 'setHtml'
544
+ | 'setImage'
545
+ | 'setStyle'
546
+ | 'setText';
547
+
548
+ /**
549
+ * CSS selector used to find the element to modify on the page at runtime.
550
+ */
551
+ selector: string;
552
+
553
+ /**
554
+ * Canonical action payload. For `setText` / `setHtml` / `customCss` / `customJs` /
555
+ * `setImage` / `insertBefore` / `insertAfter` this is the literal
556
+ * text/HTML/CSS/JS/URL. For `setStyle` and `setAttribute` it is a JSON-stringified
557
+ * `{key: value}` object — prefer the structured `styles` / `attribute` fields
558
+ * below to avoid manual JSON encoding.
559
+ */
560
+ value: string;
561
+
562
+ /**
563
+ * Populated on read for `setAttribute` modifications, parsed from `value`.
564
+ * Customers may also send this field instead of a JSON-stringified `value` on
565
+ * write — see `domModificationInputSchema`.
566
+ */
567
+ attribute?: unknown | null;
568
+
569
+ /**
570
+ * Populated on read for `setStyle` modifications, parsed from `value`. Customers
571
+ * may also send this field instead of a JSON-stringified `value` on write — see
572
+ * `domModificationInputSchema`.
573
+ */
574
+ styles?: Array<DomModification.Style> | null;
575
+ }
576
+
577
+ export namespace DomModification {
578
+ export interface Style {
579
+ /**
580
+ * CSS property name in camelCase or kebab-case.
581
+ */
582
+ property: string;
583
+
584
+ /**
585
+ * CSS value to assign to the property.
586
+ */
587
+ value: string;
588
+ }
589
+ }
590
+ }
591
+
592
+ /**
593
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
594
+ * from a GET response can be PATCHed back without modification.
595
+ */
596
+ export interface Metrics {
597
+ /**
598
+ * Primary success metric used in the results report.
599
+ */
600
+ primary?: unknown | null;
601
+
602
+ /**
603
+ * Optional secondary metrics tracked alongside the primary goal.
604
+ */
605
+ secondary?: Array<Metrics.Secondary> | null;
606
+ }
607
+
608
+ export namespace Metrics {
609
+ export interface Secondary {
610
+ /**
611
+ * Name of the event used to measure success for this metric.
612
+ */
613
+ eventName?: string | null;
614
+
615
+ /**
616
+ * Optional funnel identifier when the metric is derived from an existing funnel
617
+ * definition.
618
+ */
619
+ funnelId?: string | null;
620
+ }
621
+ }
622
+
623
+ /**
624
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
625
+ * visitor status, and (server-side) visitor properties. Same shape as the
626
+ * create/patch input.
627
+ */
628
+ export interface TargetingRules {
629
+ /**
630
+ * Glob-style URL patterns that must match for the experiment to be eligible. Up to
631
+ * 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
632
+ * the field) matches all URLs — equivalent to `["**"]`.
633
+ */
634
+ urlPatterns: Array<string>;
635
+
636
+ /**
637
+ * Optional audience identifier used for server-side eligibility filtering.
638
+ */
639
+ audienceId?: string | null;
640
+
641
+ /**
642
+ * Additional query-string conditions that must all match for the visitor to
643
+ * qualify.
644
+ */
645
+ queryParams?: Array<TargetingRules.QueryParam> | null;
646
+
647
+ /**
648
+ * Optional visitor-property matching rules. These are passed through as JSON for
649
+ * experimentation targeting.
650
+ */
651
+ visitorProperties?: unknown | null;
652
+
653
+ /**
654
+ * Whether the experiment should target new visitors, returning visitors, or any
655
+ * visitor.
656
+ */
657
+ visitorStatus?: string | null;
658
+ }
659
+
660
+ export namespace TargetingRules {
661
+ export interface QueryParam {
662
+ /**
663
+ * Query string key to inspect on the current page URL.
664
+ */
665
+ key: string;
666
+
667
+ /**
668
+ * Comparison operator applied to the query string value.
669
+ */
670
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
671
+
672
+ /**
673
+ * Comparison value used by operators that require one. Omit for `exists` and
674
+ * `not_exists`.
675
+ */
676
+ value?: string | null;
677
+ }
678
+ }
679
+ }
680
+
681
+ export interface ExperimentRetrieveResponse {
682
+ /**
683
+ * Unique identifier for the experiment.
684
+ */
685
+ id: string;
686
+
687
+ /**
688
+ * ISO-8601 timestamp when the experiment was created.
689
+ */
690
+ createdAt: string;
691
+
692
+ /**
693
+ * Stable code-facing key for the experiment. Use this with the headless SDK
694
+ * `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
695
+ * application code.
696
+ */
697
+ key: string;
698
+
699
+ /**
700
+ * Short, human-readable experiment name.
701
+ */
702
+ name: string;
703
+
704
+ /**
705
+ * Lifecycle state. `draft` is editable, `running` is active, `paused` is
706
+ * temporarily inactive, and `completed` is permanently stopped.
707
+ */
708
+ status: 'completed' | 'draft' | 'paused' | 'running';
709
+
710
+ /**
711
+ * Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
712
+ * enrollment without deleting the experiment.
713
+ */
714
+ trafficAllocation: number;
715
+
716
+ /**
717
+ * All persisted variants for this experiment, including the control variant. A
718
+ * non-personalization experiment needs at least two variants before it can be
719
+ * started.
720
+ */
721
+ variants: Array<ExperimentRetrieveResponse.Variant>;
722
+
723
+ /**
724
+ * Optional human-readable hypothesis or summary. In GraphQL this is backed by the
725
+ * experiment hypothesis field.
726
+ */
727
+ description?: string | null;
728
+
729
+ /**
730
+ * For redirect variants, whether the original page query string should be
731
+ * forwarded onto the redirect URL.
732
+ */
733
+ includeQueryString?: boolean | null;
734
+
735
+ /**
736
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
737
+ * from a GET response can be PATCHed back without modification.
738
+ */
739
+ metrics?: ExperimentRetrieveResponse.Metrics | null;
740
+
741
+ /**
742
+ * ISO-8601 timestamp when the experiment most recently entered a running state.
743
+ */
744
+ startedAt?: string | null;
745
+
746
+ /**
747
+ * ISO-8601 timestamp when the experiment was completed, if it has been stopped.
748
+ */
749
+ stoppedAt?: string | null;
750
+
751
+ /**
752
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
753
+ * visitor status, and (server-side) visitor properties. Same shape as the
754
+ * create/patch input.
755
+ */
756
+ targetingRules?: ExperimentRetrieveResponse.TargetingRules | null;
757
+
758
+ /**
759
+ * Experiment mode. `ab` and `multivariate` use traffic allocation and results;
760
+ * `personalization` is always-on targeting.
761
+ */
762
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
763
+
764
+ /**
765
+ * ISO-8601 timestamp for the last persisted update, if any.
766
+ */
767
+ updatedAt?: string | null;
768
+
769
+ /**
770
+ * Variant ID persisted as the winner when the experiment was stopped. Set via
771
+ * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
772
+ */
773
+ winnerVariantId?: string | null;
774
+ }
775
+
776
+ export namespace ExperimentRetrieveResponse {
777
+ export interface Variant {
778
+ /**
779
+ * Unique identifier for this experiment variant.
780
+ */
781
+ id: string;
782
+
783
+ /**
784
+ * Parent experiment ID this variant belongs to.
785
+ */
786
+ experimentId: string;
787
+
788
+ /**
789
+ * Whether this is the baseline control variant.
790
+ */
791
+ isControl: boolean;
792
+
793
+ /**
794
+ * Human-readable variant name shown in the dashboard and results.
795
+ */
796
+ name: string;
797
+
798
+ /**
799
+ * Relative traffic weight used when assigning visitors among variants in an active
800
+ * experiment.
801
+ */
802
+ weight: number;
803
+
804
+ /**
805
+ * Ordered list of declarative DOM mutations applied when this variant is assigned.
806
+ */
807
+ domModifications?: Array<Variant.DomModification> | null;
808
+
809
+ /**
810
+ * Target URL for redirect variants. Use either a site-relative path such as
811
+ * `/pricing-v2` or an absolute `https://` URL. Cross-origin `http://` URLs are
812
+ * rejected. Omit for DOM modification variants.
813
+ */
814
+ redirectUrl?: string | null;
815
+
816
+ /**
817
+ * How this variant changes the user experience. `dom_modifications` for on-page
818
+ * changes or `redirect` for redirect tests.
819
+ */
820
+ variantType?: string | null;
821
+ }
822
+
823
+ export namespace Variant {
824
+ export interface DomModification {
825
+ /**
826
+ * Mutation to apply when the selector matches. Use `redirectUrl` instead of DOM
827
+ * modifications for redirect variants.
828
+ */
829
+ action:
830
+ | 'customCss'
831
+ | 'customJs'
832
+ | 'insertAfter'
833
+ | 'insertBefore'
834
+ | 'remove'
835
+ | 'setAttribute'
836
+ | 'setHtml'
837
+ | 'setImage'
838
+ | 'setStyle'
839
+ | 'setText';
840
+
841
+ /**
842
+ * CSS selector used to find the element to modify on the page at runtime.
843
+ */
844
+ selector: string;
845
+
846
+ /**
847
+ * Canonical action payload. For `setText` / `setHtml` / `customCss` / `customJs` /
848
+ * `setImage` / `insertBefore` / `insertAfter` this is the literal
849
+ * text/HTML/CSS/JS/URL. For `setStyle` and `setAttribute` it is a JSON-stringified
850
+ * `{key: value}` object — prefer the structured `styles` / `attribute` fields
851
+ * below to avoid manual JSON encoding.
852
+ */
853
+ value: string;
854
+
855
+ /**
856
+ * Populated on read for `setAttribute` modifications, parsed from `value`.
857
+ * Customers may also send this field instead of a JSON-stringified `value` on
858
+ * write — see `domModificationInputSchema`.
859
+ */
860
+ attribute?: unknown | null;
861
+
862
+ /**
863
+ * Populated on read for `setStyle` modifications, parsed from `value`. Customers
864
+ * may also send this field instead of a JSON-stringified `value` on write — see
865
+ * `domModificationInputSchema`.
866
+ */
867
+ styles?: Array<DomModification.Style> | null;
868
+ }
869
+
870
+ export namespace DomModification {
871
+ export interface Style {
872
+ /**
873
+ * CSS property name in camelCase or kebab-case.
874
+ */
875
+ property: string;
876
+
877
+ /**
878
+ * CSS value to assign to the property.
879
+ */
880
+ value: string;
881
+ }
882
+ }
883
+ }
884
+
885
+ /**
886
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
887
+ * from a GET response can be PATCHed back without modification.
888
+ */
889
+ export interface Metrics {
890
+ /**
891
+ * Primary success metric used in the results report.
892
+ */
893
+ primary?: unknown | null;
894
+
895
+ /**
896
+ * Optional secondary metrics tracked alongside the primary goal.
897
+ */
898
+ secondary?: Array<Metrics.Secondary> | null;
899
+ }
900
+
901
+ export namespace Metrics {
902
+ export interface Secondary {
903
+ /**
904
+ * Name of the event used to measure success for this metric.
905
+ */
906
+ eventName?: string | null;
907
+
908
+ /**
909
+ * Optional funnel identifier when the metric is derived from an existing funnel
910
+ * definition.
911
+ */
912
+ funnelId?: string | null;
913
+ }
914
+ }
915
+
916
+ /**
917
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
918
+ * visitor status, and (server-side) visitor properties. Same shape as the
919
+ * create/patch input.
920
+ */
921
+ export interface TargetingRules {
922
+ /**
923
+ * Glob-style URL patterns that must match for the experiment to be eligible. Up to
924
+ * 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
925
+ * the field) matches all URLs — equivalent to `["**"]`.
926
+ */
927
+ urlPatterns: Array<string>;
928
+
929
+ /**
930
+ * Optional audience identifier used for server-side eligibility filtering.
931
+ */
932
+ audienceId?: string | null;
933
+
934
+ /**
935
+ * Additional query-string conditions that must all match for the visitor to
936
+ * qualify.
937
+ */
938
+ queryParams?: Array<TargetingRules.QueryParam> | null;
939
+
940
+ /**
941
+ * Optional visitor-property matching rules. These are passed through as JSON for
942
+ * experimentation targeting.
943
+ */
944
+ visitorProperties?: unknown | null;
945
+
946
+ /**
947
+ * Whether the experiment should target new visitors, returning visitors, or any
948
+ * visitor.
949
+ */
950
+ visitorStatus?: string | null;
951
+ }
952
+
953
+ export namespace TargetingRules {
954
+ export interface QueryParam {
955
+ /**
956
+ * Query string key to inspect on the current page URL.
957
+ */
958
+ key: string;
959
+
960
+ /**
961
+ * Comparison operator applied to the query string value.
962
+ */
963
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
964
+
965
+ /**
966
+ * Comparison value used by operators that require one. Omit for `exists` and
967
+ * `not_exists`.
968
+ */
969
+ value?: string | null;
970
+ }
971
+ }
972
+ }
973
+
974
+ export interface ExperimentUpdateResponse {
975
+ /**
976
+ * Unique identifier for the experiment.
977
+ */
978
+ id: string;
979
+
980
+ /**
981
+ * ISO-8601 timestamp when the experiment was created.
982
+ */
983
+ createdAt: string;
984
+
985
+ /**
986
+ * Stable code-facing key for the experiment. Use this with the headless SDK
987
+ * `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
988
+ * application code.
989
+ */
990
+ key: string;
991
+
992
+ /**
993
+ * Short, human-readable experiment name.
994
+ */
995
+ name: string;
996
+
997
+ /**
998
+ * Lifecycle state. `draft` is editable, `running` is active, `paused` is
999
+ * temporarily inactive, and `completed` is permanently stopped.
1000
+ */
1001
+ status: 'completed' | 'draft' | 'paused' | 'running';
1002
+
1003
+ /**
1004
+ * Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
1005
+ * enrollment without deleting the experiment.
1006
+ */
1007
+ trafficAllocation: number;
1008
+
1009
+ /**
1010
+ * Optional human-readable hypothesis or summary. In GraphQL this is backed by the
1011
+ * experiment hypothesis field.
1012
+ */
1013
+ description?: string | null;
1014
+
1015
+ /**
1016
+ * For redirect variants, whether the original page query string should be
1017
+ * forwarded onto the redirect URL.
1018
+ */
1019
+ includeQueryString?: boolean | null;
1020
+
1021
+ /**
1022
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
1023
+ * from a GET response can be PATCHed back without modification.
1024
+ */
1025
+ metrics?: ExperimentUpdateResponse.Metrics | null;
1026
+
1027
+ /**
1028
+ * ISO-8601 timestamp when the experiment most recently entered a running state.
1029
+ */
1030
+ startedAt?: string | null;
1031
+
1032
+ /**
1033
+ * ISO-8601 timestamp when the experiment was completed, if it has been stopped.
1034
+ */
1035
+ stoppedAt?: string | null;
1036
+
1037
+ /**
1038
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
1039
+ * visitor status, and (server-side) visitor properties. Same shape as the
1040
+ * create/patch input.
1041
+ */
1042
+ targetingRules?: ExperimentUpdateResponse.TargetingRules | null;
1043
+
1044
+ /**
1045
+ * Experiment mode. `ab` and `multivariate` use traffic allocation and results;
1046
+ * `personalization` is always-on targeting.
1047
+ */
1048
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
1049
+
1050
+ /**
1051
+ * ISO-8601 timestamp for the last persisted update, if any.
1052
+ */
1053
+ updatedAt?: string | null;
1054
+
1055
+ /**
1056
+ * Variant ID persisted as the winner when the experiment was stopped. Set via
1057
+ * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
1058
+ */
1059
+ winnerVariantId?: string | null;
1060
+ }
1061
+
1062
+ export namespace ExperimentUpdateResponse {
1063
+ /**
1064
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
1065
+ * from a GET response can be PATCHed back without modification.
1066
+ */
1067
+ export interface Metrics {
1068
+ /**
1069
+ * Primary success metric used in the results report.
1070
+ */
1071
+ primary?: unknown | null;
1072
+
1073
+ /**
1074
+ * Optional secondary metrics tracked alongside the primary goal.
1075
+ */
1076
+ secondary?: Array<Metrics.Secondary> | null;
1077
+ }
1078
+
1079
+ export namespace Metrics {
1080
+ export interface Secondary {
1081
+ /**
1082
+ * Name of the event used to measure success for this metric.
1083
+ */
1084
+ eventName?: string | null;
1085
+
1086
+ /**
1087
+ * Optional funnel identifier when the metric is derived from an existing funnel
1088
+ * definition.
1089
+ */
1090
+ funnelId?: string | null;
1091
+ }
1092
+ }
1093
+
1094
+ /**
1095
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
1096
+ * visitor status, and (server-side) visitor properties. Same shape as the
1097
+ * create/patch input.
1098
+ */
1099
+ export interface TargetingRules {
1100
+ /**
1101
+ * Glob-style URL patterns that must match for the experiment to be eligible. Up to
1102
+ * 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
1103
+ * the field) matches all URLs — equivalent to `["**"]`.
1104
+ */
1105
+ urlPatterns: Array<string>;
1106
+
1107
+ /**
1108
+ * Optional audience identifier used for server-side eligibility filtering.
1109
+ */
1110
+ audienceId?: string | null;
1111
+
1112
+ /**
1113
+ * Additional query-string conditions that must all match for the visitor to
1114
+ * qualify.
1115
+ */
1116
+ queryParams?: Array<TargetingRules.QueryParam> | null;
1117
+
1118
+ /**
1119
+ * Optional visitor-property matching rules. These are passed through as JSON for
1120
+ * experimentation targeting.
1121
+ */
1122
+ visitorProperties?: unknown | null;
1123
+
1124
+ /**
1125
+ * Whether the experiment should target new visitors, returning visitors, or any
1126
+ * visitor.
1127
+ */
1128
+ visitorStatus?: string | null;
1129
+ }
1130
+
1131
+ export namespace TargetingRules {
1132
+ export interface QueryParam {
1133
+ /**
1134
+ * Query string key to inspect on the current page URL.
1135
+ */
1136
+ key: string;
1137
+
1138
+ /**
1139
+ * Comparison operator applied to the query string value.
1140
+ */
1141
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
1142
+
1143
+ /**
1144
+ * Comparison value used by operators that require one. Omit for `exists` and
1145
+ * `not_exists`.
1146
+ */
1147
+ value?: string | null;
1148
+ }
1149
+ }
1150
+ }
1151
+
1152
+ /**
1153
+ * Whether the experiment was deleted successfully.
1154
+ */
1155
+ export type ExperimentDeleteResponse = boolean;
1156
+
1157
+ export interface ExperimentStartResponse {
1158
+ /**
1159
+ * Number of unpublished version changes detected at the time of the lifecycle
1160
+ * action. Values greater than 1 mean other unpublished work exists besides this
1161
+ * experiment state change.
1162
+ */
1163
+ concurrentVersionChanges: number;
1164
+
1165
+ experiment: ExperimentStartResponse.Experiment;
1166
+
1167
+ /**
1168
+ * Whether the status change was also published to the current live version
1169
+ * immediately.
1170
+ */
1171
+ publishStatus: 'pending_publish' | 'published';
1172
+ }
1173
+
1174
+ export namespace ExperimentStartResponse {
1175
+ export interface Experiment {
1176
+ /**
1177
+ * Unique identifier for the experiment.
1178
+ */
1179
+ id: string;
1180
+
1181
+ /**
1182
+ * ISO-8601 timestamp when the experiment was created.
1183
+ */
1184
+ createdAt: string;
1185
+
1186
+ /**
1187
+ * Stable code-facing key for the experiment. Use this with the headless SDK
1188
+ * `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
1189
+ * application code.
1190
+ */
1191
+ key: string;
1192
+
1193
+ /**
1194
+ * Short, human-readable experiment name.
1195
+ */
1196
+ name: string;
1197
+
1198
+ /**
1199
+ * Lifecycle state. `draft` is editable, `running` is active, `paused` is
1200
+ * temporarily inactive, and `completed` is permanently stopped.
1201
+ */
1202
+ status: 'completed' | 'draft' | 'paused' | 'running';
1203
+
1204
+ /**
1205
+ * Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
1206
+ * enrollment without deleting the experiment.
1207
+ */
1208
+ trafficAllocation: number;
1209
+
1210
+ /**
1211
+ * Optional human-readable hypothesis or summary. In GraphQL this is backed by the
1212
+ * experiment hypothesis field.
1213
+ */
1214
+ description?: string | null;
1215
+
1216
+ /**
1217
+ * For redirect variants, whether the original page query string should be
1218
+ * forwarded onto the redirect URL.
1219
+ */
1220
+ includeQueryString?: boolean | null;
1221
+
1222
+ /**
1223
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
1224
+ * from a GET response can be PATCHed back without modification.
1225
+ */
1226
+ metrics?: Experiment.Metrics | null;
1227
+
1228
+ /**
1229
+ * ISO-8601 timestamp when the experiment most recently entered a running state.
1230
+ */
1231
+ startedAt?: string | null;
1232
+
1233
+ /**
1234
+ * ISO-8601 timestamp when the experiment was completed, if it has been stopped.
1235
+ */
1236
+ stoppedAt?: string | null;
1237
+
1238
+ /**
1239
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
1240
+ * visitor status, and (server-side) visitor properties. Same shape as the
1241
+ * create/patch input.
1242
+ */
1243
+ targetingRules?: Experiment.TargetingRules | null;
1244
+
1245
+ /**
1246
+ * Experiment mode. `ab` and `multivariate` use traffic allocation and results;
1247
+ * `personalization` is always-on targeting.
1248
+ */
1249
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
1250
+
1251
+ /**
1252
+ * ISO-8601 timestamp for the last persisted update, if any.
1253
+ */
1254
+ updatedAt?: string | null;
1255
+
1256
+ /**
1257
+ * Variant ID persisted as the winner when the experiment was stopped. Set via
1258
+ * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
1259
+ */
1260
+ winnerVariantId?: string | null;
1261
+ }
1262
+
1263
+ export namespace Experiment {
1264
+ /**
1265
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
1266
+ * from a GET response can be PATCHed back without modification.
1267
+ */
1268
+ export interface Metrics {
1269
+ /**
1270
+ * Primary success metric used in the results report.
1271
+ */
1272
+ primary?: unknown | null;
1273
+
1274
+ /**
1275
+ * Optional secondary metrics tracked alongside the primary goal.
1276
+ */
1277
+ secondary?: Array<Metrics.Secondary> | null;
1278
+ }
1279
+
1280
+ export namespace Metrics {
1281
+ export interface Secondary {
1282
+ /**
1283
+ * Name of the event used to measure success for this metric.
1284
+ */
1285
+ eventName?: string | null;
1286
+
1287
+ /**
1288
+ * Optional funnel identifier when the metric is derived from an existing funnel
1289
+ * definition.
1290
+ */
1291
+ funnelId?: string | null;
1292
+ }
1293
+ }
1294
+
1295
+ /**
1296
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
1297
+ * visitor status, and (server-side) visitor properties. Same shape as the
1298
+ * create/patch input.
1299
+ */
1300
+ export interface TargetingRules {
1301
+ /**
1302
+ * Glob-style URL patterns that must match for the experiment to be eligible. Up to
1303
+ * 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
1304
+ * the field) matches all URLs — equivalent to `["**"]`.
1305
+ */
1306
+ urlPatterns: Array<string>;
1307
+
1308
+ /**
1309
+ * Optional audience identifier used for server-side eligibility filtering.
1310
+ */
1311
+ audienceId?: string | null;
1312
+
1313
+ /**
1314
+ * Additional query-string conditions that must all match for the visitor to
1315
+ * qualify.
1316
+ */
1317
+ queryParams?: Array<TargetingRules.QueryParam> | null;
1318
+
1319
+ /**
1320
+ * Optional visitor-property matching rules. These are passed through as JSON for
1321
+ * experimentation targeting.
1322
+ */
1323
+ visitorProperties?: unknown | null;
1324
+
1325
+ /**
1326
+ * Whether the experiment should target new visitors, returning visitors, or any
1327
+ * visitor.
1328
+ */
1329
+ visitorStatus?: string | null;
1330
+ }
1331
+
1332
+ export namespace TargetingRules {
1333
+ export interface QueryParam {
1334
+ /**
1335
+ * Query string key to inspect on the current page URL.
1336
+ */
1337
+ key: string;
1338
+
1339
+ /**
1340
+ * Comparison operator applied to the query string value.
1341
+ */
1342
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
1343
+
1344
+ /**
1345
+ * Comparison value used by operators that require one. Omit for `exists` and
1346
+ * `not_exists`.
1347
+ */
1348
+ value?: string | null;
1349
+ }
1350
+ }
1351
+ }
1352
+ }
1353
+
1354
+ export interface ExperimentStopResponse {
1355
+ /**
1356
+ * Number of unpublished version changes detected at the time of the lifecycle
1357
+ * action. Values greater than 1 mean other unpublished work exists besides this
1358
+ * experiment state change.
1359
+ */
1360
+ concurrentVersionChanges: number;
1361
+
1362
+ experiment: ExperimentStopResponse.Experiment;
1363
+
1364
+ /**
1365
+ * Whether the status change was also published to the current live version
1366
+ * immediately.
1367
+ */
1368
+ publishStatus: 'pending_publish' | 'published';
1369
+ }
1370
+
1371
+ export namespace ExperimentStopResponse {
1372
+ export interface Experiment {
1373
+ /**
1374
+ * Unique identifier for the experiment.
1375
+ */
1376
+ id: string;
1377
+
1378
+ /**
1379
+ * ISO-8601 timestamp when the experiment was created.
1380
+ */
1381
+ createdAt: string;
1382
+
1383
+ /**
1384
+ * Stable code-facing key for the experiment. Use this with the headless SDK
1385
+ * `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
1386
+ * application code.
1387
+ */
1388
+ key: string;
1389
+
1390
+ /**
1391
+ * Short, human-readable experiment name.
1392
+ */
1393
+ name: string;
1394
+
1395
+ /**
1396
+ * Lifecycle state. `draft` is editable, `running` is active, `paused` is
1397
+ * temporarily inactive, and `completed` is permanently stopped.
1398
+ */
1399
+ status: 'completed' | 'draft' | 'paused' | 'running';
1400
+
1401
+ /**
1402
+ * Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
1403
+ * enrollment without deleting the experiment.
1404
+ */
1405
+ trafficAllocation: number;
1406
+
1407
+ /**
1408
+ * Optional human-readable hypothesis or summary. In GraphQL this is backed by the
1409
+ * experiment hypothesis field.
1410
+ */
1411
+ description?: string | null;
1412
+
1413
+ /**
1414
+ * For redirect variants, whether the original page query string should be
1415
+ * forwarded onto the redirect URL.
1416
+ */
1417
+ includeQueryString?: boolean | null;
1418
+
1419
+ /**
1420
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
1421
+ * from a GET response can be PATCHed back without modification.
1422
+ */
1423
+ metrics?: Experiment.Metrics | null;
1424
+
1425
+ /**
1426
+ * ISO-8601 timestamp when the experiment most recently entered a running state.
1427
+ */
1428
+ startedAt?: string | null;
1429
+
1430
+ /**
1431
+ * ISO-8601 timestamp when the experiment was completed, if it has been stopped.
1432
+ */
1433
+ stoppedAt?: string | null;
1434
+
1435
+ /**
1436
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
1437
+ * visitor status, and (server-side) visitor properties. Same shape as the
1438
+ * create/patch input.
1439
+ */
1440
+ targetingRules?: Experiment.TargetingRules | null;
1441
+
1442
+ /**
1443
+ * Experiment mode. `ab` and `multivariate` use traffic allocation and results;
1444
+ * `personalization` is always-on targeting.
1445
+ */
1446
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
1447
+
1448
+ /**
1449
+ * ISO-8601 timestamp for the last persisted update, if any.
1450
+ */
1451
+ updatedAt?: string | null;
1452
+
1453
+ /**
1454
+ * Variant ID persisted as the winner when the experiment was stopped. Set via
1455
+ * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
1456
+ */
1457
+ winnerVariantId?: string | null;
1458
+ }
1459
+
1460
+ export namespace Experiment {
1461
+ /**
1462
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
1463
+ * from a GET response can be PATCHed back without modification.
1464
+ */
1465
+ export interface Metrics {
1466
+ /**
1467
+ * Primary success metric used in the results report.
1468
+ */
1469
+ primary?: unknown | null;
1470
+
1471
+ /**
1472
+ * Optional secondary metrics tracked alongside the primary goal.
1473
+ */
1474
+ secondary?: Array<Metrics.Secondary> | null;
1475
+ }
1476
+
1477
+ export namespace Metrics {
1478
+ export interface Secondary {
1479
+ /**
1480
+ * Name of the event used to measure success for this metric.
1481
+ */
1482
+ eventName?: string | null;
1483
+
1484
+ /**
1485
+ * Optional funnel identifier when the metric is derived from an existing funnel
1486
+ * definition.
1487
+ */
1488
+ funnelId?: string | null;
1489
+ }
1490
+ }
1491
+
1492
+ /**
1493
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
1494
+ * visitor status, and (server-side) visitor properties. Same shape as the
1495
+ * create/patch input.
1496
+ */
1497
+ export interface TargetingRules {
1498
+ /**
1499
+ * Glob-style URL patterns that must match for the experiment to be eligible. Up to
1500
+ * 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
1501
+ * the field) matches all URLs — equivalent to `["**"]`.
1502
+ */
1503
+ urlPatterns: Array<string>;
1504
+
1505
+ /**
1506
+ * Optional audience identifier used for server-side eligibility filtering.
1507
+ */
1508
+ audienceId?: string | null;
1509
+
1510
+ /**
1511
+ * Additional query-string conditions that must all match for the visitor to
1512
+ * qualify.
1513
+ */
1514
+ queryParams?: Array<TargetingRules.QueryParam> | null;
1515
+
1516
+ /**
1517
+ * Optional visitor-property matching rules. These are passed through as JSON for
1518
+ * experimentation targeting.
1519
+ */
1520
+ visitorProperties?: unknown | null;
1521
+
1522
+ /**
1523
+ * Whether the experiment should target new visitors, returning visitors, or any
1524
+ * visitor.
1525
+ */
1526
+ visitorStatus?: string | null;
1527
+ }
1528
+
1529
+ export namespace TargetingRules {
1530
+ export interface QueryParam {
1531
+ /**
1532
+ * Query string key to inspect on the current page URL.
1533
+ */
1534
+ key: string;
1535
+
1536
+ /**
1537
+ * Comparison operator applied to the query string value.
1538
+ */
1539
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
1540
+
1541
+ /**
1542
+ * Comparison value used by operators that require one. Omit for `exists` and
1543
+ * `not_exists`.
1544
+ */
1545
+ value?: string | null;
1546
+ }
1547
+ }
1548
+ }
1549
+ }
1550
+
1551
+ export interface ExperimentPauseResponse {
1552
+ /**
1553
+ * Number of unpublished version changes detected at the time of the lifecycle
1554
+ * action. Values greater than 1 mean other unpublished work exists besides this
1555
+ * experiment state change.
1556
+ */
1557
+ concurrentVersionChanges: number;
1558
+
1559
+ experiment: ExperimentPauseResponse.Experiment;
1560
+
1561
+ /**
1562
+ * Whether the status change was also published to the current live version
1563
+ * immediately.
1564
+ */
1565
+ publishStatus: 'pending_publish' | 'published';
1566
+ }
1567
+
1568
+ export namespace ExperimentPauseResponse {
1569
+ export interface Experiment {
1570
+ /**
1571
+ * Unique identifier for the experiment.
1572
+ */
1573
+ id: string;
1574
+
1575
+ /**
1576
+ * ISO-8601 timestamp when the experiment was created.
1577
+ */
1578
+ createdAt: string;
1579
+
1580
+ /**
1581
+ * Stable code-facing key for the experiment. Use this with the headless SDK
1582
+ * `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
1583
+ * application code.
1584
+ */
1585
+ key: string;
1586
+
1587
+ /**
1588
+ * Short, human-readable experiment name.
1589
+ */
1590
+ name: string;
1591
+
1592
+ /**
1593
+ * Lifecycle state. `draft` is editable, `running` is active, `paused` is
1594
+ * temporarily inactive, and `completed` is permanently stopped.
1595
+ */
1596
+ status: 'completed' | 'draft' | 'paused' | 'running';
1597
+
1598
+ /**
1599
+ * Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
1600
+ * enrollment without deleting the experiment.
1601
+ */
1602
+ trafficAllocation: number;
1603
+
1604
+ /**
1605
+ * Optional human-readable hypothesis or summary. In GraphQL this is backed by the
1606
+ * experiment hypothesis field.
1607
+ */
1608
+ description?: string | null;
1609
+
1610
+ /**
1611
+ * For redirect variants, whether the original page query string should be
1612
+ * forwarded onto the redirect URL.
1613
+ */
1614
+ includeQueryString?: boolean | null;
1615
+
1616
+ /**
1617
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
1618
+ * from a GET response can be PATCHed back without modification.
1619
+ */
1620
+ metrics?: Experiment.Metrics | null;
1621
+
1622
+ /**
1623
+ * ISO-8601 timestamp when the experiment most recently entered a running state.
1624
+ */
1625
+ startedAt?: string | null;
1626
+
1627
+ /**
1628
+ * ISO-8601 timestamp when the experiment was completed, if it has been stopped.
1629
+ */
1630
+ stoppedAt?: string | null;
1631
+
1632
+ /**
1633
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
1634
+ * visitor status, and (server-side) visitor properties. Same shape as the
1635
+ * create/patch input.
1636
+ */
1637
+ targetingRules?: Experiment.TargetingRules | null;
1638
+
1639
+ /**
1640
+ * Experiment mode. `ab` and `multivariate` use traffic allocation and results;
1641
+ * `personalization` is always-on targeting.
1642
+ */
1643
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
1644
+
1645
+ /**
1646
+ * ISO-8601 timestamp for the last persisted update, if any.
1647
+ */
1648
+ updatedAt?: string | null;
1649
+
1650
+ /**
1651
+ * Variant ID persisted as the winner when the experiment was stopped. Set via
1652
+ * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
1653
+ */
1654
+ winnerVariantId?: string | null;
1655
+ }
1656
+
1657
+ export namespace Experiment {
1658
+ /**
1659
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
1660
+ * from a GET response can be PATCHed back without modification.
1661
+ */
1662
+ export interface Metrics {
1663
+ /**
1664
+ * Primary success metric used in the results report.
1665
+ */
1666
+ primary?: unknown | null;
1667
+
1668
+ /**
1669
+ * Optional secondary metrics tracked alongside the primary goal.
1670
+ */
1671
+ secondary?: Array<Metrics.Secondary> | null;
1672
+ }
1673
+
1674
+ export namespace Metrics {
1675
+ export interface Secondary {
1676
+ /**
1677
+ * Name of the event used to measure success for this metric.
1678
+ */
1679
+ eventName?: string | null;
1680
+
1681
+ /**
1682
+ * Optional funnel identifier when the metric is derived from an existing funnel
1683
+ * definition.
1684
+ */
1685
+ funnelId?: string | null;
1686
+ }
1687
+ }
1688
+
1689
+ /**
1690
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
1691
+ * visitor status, and (server-side) visitor properties. Same shape as the
1692
+ * create/patch input.
1693
+ */
1694
+ export interface TargetingRules {
1695
+ /**
1696
+ * Glob-style URL patterns that must match for the experiment to be eligible. Up to
1697
+ * 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
1698
+ * the field) matches all URLs — equivalent to `["**"]`.
1699
+ */
1700
+ urlPatterns: Array<string>;
1701
+
1702
+ /**
1703
+ * Optional audience identifier used for server-side eligibility filtering.
1704
+ */
1705
+ audienceId?: string | null;
1706
+
1707
+ /**
1708
+ * Additional query-string conditions that must all match for the visitor to
1709
+ * qualify.
1710
+ */
1711
+ queryParams?: Array<TargetingRules.QueryParam> | null;
1712
+
1713
+ /**
1714
+ * Optional visitor-property matching rules. These are passed through as JSON for
1715
+ * experimentation targeting.
1716
+ */
1717
+ visitorProperties?: unknown | null;
1718
+
1719
+ /**
1720
+ * Whether the experiment should target new visitors, returning visitors, or any
1721
+ * visitor.
1722
+ */
1723
+ visitorStatus?: string | null;
1724
+ }
1725
+
1726
+ export namespace TargetingRules {
1727
+ export interface QueryParam {
1728
+ /**
1729
+ * Query string key to inspect on the current page URL.
1730
+ */
1731
+ key: string;
1732
+
1733
+ /**
1734
+ * Comparison operator applied to the query string value.
1735
+ */
1736
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
1737
+
1738
+ /**
1739
+ * Comparison value used by operators that require one. Omit for `exists` and
1740
+ * `not_exists`.
1741
+ */
1742
+ value?: string | null;
1743
+ }
1744
+ }
1745
+ }
1746
+ }
1747
+
1748
+ export interface ExperimentResumeResponse {
1749
+ /**
1750
+ * Number of unpublished version changes detected at the time of the lifecycle
1751
+ * action. Values greater than 1 mean other unpublished work exists besides this
1752
+ * experiment state change.
1753
+ */
1754
+ concurrentVersionChanges: number;
1755
+
1756
+ experiment: ExperimentResumeResponse.Experiment;
1757
+
1758
+ /**
1759
+ * Whether the status change was also published to the current live version
1760
+ * immediately.
1761
+ */
1762
+ publishStatus: 'pending_publish' | 'published';
1763
+ }
1764
+
1765
+ export namespace ExperimentResumeResponse {
1766
+ export interface Experiment {
1767
+ /**
1768
+ * Unique identifier for the experiment.
1769
+ */
1770
+ id: string;
1771
+
1772
+ /**
1773
+ * ISO-8601 timestamp when the experiment was created.
1774
+ */
1775
+ createdAt: string;
1776
+
1777
+ /**
1778
+ * Stable code-facing key for the experiment. Use this with the headless SDK
1779
+ * `getExperimentByKey()` API instead of hard-coding opaque experiment IDs into
1780
+ * application code.
1781
+ */
1782
+ key: string;
1783
+
1784
+ /**
1785
+ * Short, human-readable experiment name.
1786
+ */
1787
+ name: string;
1788
+
1789
+ /**
1790
+ * Lifecycle state. `draft` is editable, `running` is active, `paused` is
1791
+ * temporarily inactive, and `completed` is permanently stopped.
1792
+ */
1793
+ status: 'completed' | 'draft' | 'paused' | 'running';
1794
+
1795
+ /**
1796
+ * Percent of eligible traffic assigned into the experiment. Use 0 to fully disable
1797
+ * enrollment without deleting the experiment.
1798
+ */
1799
+ trafficAllocation: number;
1800
+
1801
+ /**
1802
+ * Optional human-readable hypothesis or summary. In GraphQL this is backed by the
1803
+ * experiment hypothesis field.
1804
+ */
1805
+ description?: string | null;
1806
+
1807
+ /**
1808
+ * For redirect variants, whether the original page query string should be
1809
+ * forwarded onto the redirect URL.
1810
+ */
1811
+ includeQueryString?: boolean | null;
1812
+
1813
+ /**
1814
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
1815
+ * from a GET response can be PATCHed back without modification.
1816
+ */
1817
+ metrics?: Experiment.Metrics | null;
1818
+
1819
+ /**
1820
+ * ISO-8601 timestamp when the experiment most recently entered a running state.
1821
+ */
1822
+ startedAt?: string | null;
1823
+
1824
+ /**
1825
+ * ISO-8601 timestamp when the experiment was completed, if it has been stopped.
1826
+ */
1827
+ stoppedAt?: string | null;
1828
+
1829
+ /**
1830
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
1831
+ * visitor status, and (server-side) visitor properties. Same shape as the
1832
+ * create/patch input.
1833
+ */
1834
+ targetingRules?: Experiment.TargetingRules | null;
1835
+
1836
+ /**
1837
+ * Experiment mode. `ab` and `multivariate` use traffic allocation and results;
1838
+ * `personalization` is always-on targeting.
1839
+ */
1840
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
1841
+
1842
+ /**
1843
+ * ISO-8601 timestamp for the last persisted update, if any.
1844
+ */
1845
+ updatedAt?: string | null;
1846
+
1847
+ /**
1848
+ * Variant ID persisted as the winner when the experiment was stopped. Set via
1849
+ * `POST /experiments/{id}/stop` with a `winnerVariantId` body field.
1850
+ */
1851
+ winnerVariantId?: string | null;
1852
+ }
1853
+
1854
+ export namespace Experiment {
1855
+ /**
1856
+ * Configured success metrics. The read shape mirrors the write shape — `metrics`
1857
+ * from a GET response can be PATCHed back without modification.
1858
+ */
1859
+ export interface Metrics {
1860
+ /**
1861
+ * Primary success metric used in the results report.
1862
+ */
1863
+ primary?: unknown | null;
1864
+
1865
+ /**
1866
+ * Optional secondary metrics tracked alongside the primary goal.
1867
+ */
1868
+ secondary?: Array<Metrics.Secondary> | null;
1869
+ }
1870
+
1871
+ export namespace Metrics {
1872
+ export interface Secondary {
1873
+ /**
1874
+ * Name of the event used to measure success for this metric.
1875
+ */
1876
+ eventName?: string | null;
1877
+
1878
+ /**
1879
+ * Optional funnel identifier when the metric is derived from an existing funnel
1880
+ * definition.
1881
+ */
1882
+ funnelId?: string | null;
1883
+ }
1884
+ }
1885
+
1886
+ /**
1887
+ * Eligibility rules: URL-pattern globs, optional audience, query-param conditions,
1888
+ * visitor status, and (server-side) visitor properties. Same shape as the
1889
+ * create/patch input.
1890
+ */
1891
+ export interface TargetingRules {
1892
+ /**
1893
+ * Glob-style URL patterns that must match for the experiment to be eligible. Up to
1894
+ * 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
1895
+ * the field) matches all URLs — equivalent to `["**"]`.
1896
+ */
1897
+ urlPatterns: Array<string>;
1898
+
1899
+ /**
1900
+ * Optional audience identifier used for server-side eligibility filtering.
1901
+ */
1902
+ audienceId?: string | null;
1903
+
1904
+ /**
1905
+ * Additional query-string conditions that must all match for the visitor to
1906
+ * qualify.
1907
+ */
1908
+ queryParams?: Array<TargetingRules.QueryParam> | null;
1909
+
1910
+ /**
1911
+ * Optional visitor-property matching rules. These are passed through as JSON for
1912
+ * experimentation targeting.
1913
+ */
1914
+ visitorProperties?: unknown | null;
1915
+
1916
+ /**
1917
+ * Whether the experiment should target new visitors, returning visitors, or any
1918
+ * visitor.
1919
+ */
1920
+ visitorStatus?: string | null;
1921
+ }
1922
+
1923
+ export namespace TargetingRules {
1924
+ export interface QueryParam {
1925
+ /**
1926
+ * Query string key to inspect on the current page URL.
1927
+ */
1928
+ key: string;
1929
+
1930
+ /**
1931
+ * Comparison operator applied to the query string value.
1932
+ */
1933
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
1934
+
1935
+ /**
1936
+ * Comparison value used by operators that require one. Omit for `exists` and
1937
+ * `not_exists`.
1938
+ */
1939
+ value?: string | null;
1940
+ }
1941
+ }
1942
+ }
1943
+ }
1944
+
1945
+ export interface ExperimentResultsResponse {
1946
+ /**
1947
+ * Aggregate performance metrics for each variant in the experiment over the
1948
+ * experiment runtime window.
1949
+ */
1950
+ variants: Array<ExperimentResultsResponse.Variant>;
1951
+ }
1952
+
1953
+ export namespace ExperimentResultsResponse {
1954
+ export interface Variant {
1955
+ /**
1956
+ * Variant ID this result row belongs to.
1957
+ */
1958
+ id: string;
1959
+
1960
+ /**
1961
+ * Conversions divided by impressions for this variant.
1962
+ */
1963
+ conversionRate: number;
1964
+
1965
+ /**
1966
+ * Number of post-exposure conversions attributed to the variant.
1967
+ */
1968
+ conversions: number;
1969
+
1970
+ /**
1971
+ * Number of distinct experiment-impression events counted for the variant.
1972
+ */
1973
+ impressions: number;
1974
+
1975
+ /**
1976
+ * Whether this variant is the experiment control. Exactly one variant per
1977
+ * experiment is the control.
1978
+ */
1979
+ isControl: boolean;
1980
+
1981
+ /**
1982
+ * Human-readable variant name as configured on the experiment (e.g. `Control`,
1983
+ * `Treatment`). Lets callers label results without a separate lookup against
1984
+ * `/experiment-variants`.
1985
+ */
1986
+ name: string;
1987
+
1988
+ /**
1989
+ * Bayesian probability that this variant is the best-performing option among all
1990
+ * variants in the experiment.
1991
+ */
1992
+ probabilityToBeBest: number;
1993
+ }
1994
+ }
1995
+
1996
+ export interface ExperimentResultsTimeSeriesResponse {
1997
+ /**
1998
+ * Per-day metrics for each variant. Days with no impression rows are omitted from
1999
+ * the response.
2000
+ */
2001
+ days: Array<ExperimentResultsTimeSeriesResponse.Day>;
2002
+ }
2003
+
2004
+ export namespace ExperimentResultsTimeSeriesResponse {
2005
+ export interface Day {
2006
+ /**
2007
+ * UTC calendar day in `YYYY-MM-DD` format.
2008
+ */
2009
+ date: string;
2010
+
2011
+ variants: Array<Day.Variant>;
2012
+ }
2013
+
2014
+ export namespace Day {
2015
+ export interface Variant {
2016
+ id: string;
2017
+
2018
+ conversionRate: number;
2019
+
2020
+ conversions: number;
2021
+
2022
+ impressions: number;
2023
+ }
2024
+ }
2025
+ }
2026
+
2027
+ export interface ExperimentListParams extends CursorParams {
2028
+ /**
2029
+ * Optional case-insensitive text search matched against experiment ID, name, and
2030
+ * description.
2031
+ */
2032
+ search?: string;
2033
+
2034
+ /**
2035
+ * Optional lifecycle-state filter.
2036
+ */
2037
+ status?: 'completed' | 'draft' | 'paused' | 'running';
2038
+
2039
+ /**
2040
+ * Optional experiment-type filter.
2041
+ */
2042
+ type?: 'ab' | 'multivariate' | 'personalization';
2043
+ }
2044
+
2045
+ export interface ExperimentCreateParams {
2046
+ /**
2047
+ * ID of the experiment settings record that owns this experiment. Call
2048
+ * `GET /rest/v1/experiment-settings` first if you need to discover the correct ID
2049
+ * for the current account.
2050
+ */
2051
+ experimentSettingsId: string;
2052
+
2053
+ /**
2054
+ * Short experiment name.
2055
+ */
2056
+ name: string;
2057
+
2058
+ /**
2059
+ * Optional hypothesis or operator note.
2060
+ */
2061
+ description?: string | null;
2062
+
2063
+ /**
2064
+ * Whether redirect variants in this experiment should preserve the original
2065
+ * request query string.
2066
+ */
2067
+ includeQueryString?: boolean | null;
2068
+
2069
+ /**
2070
+ * Optional stable code-facing key. When omitted, the API slugifies the name
2071
+ * automatically.
2072
+ */
2073
+ key?: string | null;
2074
+
2075
+ /**
2076
+ * Goal events. If you send `metrics.primary`, `metrics.primary.eventName` must be
2077
+ * a non-blank string. A primary event name is required before the experiment can
2078
+ * be started.
2079
+ */
2080
+ metrics?: ExperimentCreateParams.Metrics | null;
2081
+
2082
+ /**
2083
+ * Eligibility rules — URL patterns, audience, visitor status, query-param
2084
+ * conditions. Omit to inherit defaults.
2085
+ */
2086
+ targetingRules?: ExperimentCreateParams.TargetingRules | null;
2087
+
2088
+ /**
2089
+ * Initial traffic allocation percentage from 0 to 100.
2090
+ */
2091
+ trafficAllocation?: number | null;
2092
+
2093
+ /**
2094
+ * Experiment mode to create. `ab` and `multivariate` use traffic allocation and
2095
+ * results; `personalization` is always-on targeting. Omit to create a standard
2096
+ * `ab` experiment.
2097
+ */
2098
+ type?: 'ab' | 'multivariate' | 'personalization' | null;
2099
+ }
2100
+
2101
+ export namespace ExperimentCreateParams {
2102
+ /**
2103
+ * Goal events. If you send `metrics.primary`, `metrics.primary.eventName` must be
2104
+ * a non-blank string. A primary event name is required before the experiment can
2105
+ * be started.
2106
+ */
2107
+ export interface Metrics {
2108
+ /**
2109
+ * Primary success metric. When provided, `eventName` must be a non-blank string.
2110
+ */
2111
+ primary?: Metrics.Primary | null;
2112
+
2113
+ /**
2114
+ * Optional secondary metrics tracked alongside the primary goal.
2115
+ */
2116
+ secondary?: Array<Metrics.Secondary> | null;
2117
+ }
2118
+
2119
+ export namespace Metrics {
2120
+ /**
2121
+ * Primary success metric. When provided, `eventName` must be a non-blank string.
2122
+ */
2123
+ export interface Primary {
2124
+ /**
2125
+ * Event name to use as the goal for this metric.
2126
+ */
2127
+ eventName?: string | null;
2128
+
2129
+ /**
2130
+ * Optional funnel identifier when the metric should be derived from an existing
2131
+ * funnel definition.
2132
+ */
2133
+ funnelId?: string | null;
2134
+ }
2135
+
2136
+ export interface Secondary {
2137
+ /**
2138
+ * Event name to use as the goal for this metric.
2139
+ */
2140
+ eventName?: string | null;
2141
+
2142
+ /**
2143
+ * Optional funnel identifier when the metric should be derived from an existing
2144
+ * funnel definition.
2145
+ */
2146
+ funnelId?: string | null;
2147
+ }
2148
+ }
2149
+
2150
+ /**
2151
+ * Eligibility rules — URL patterns, audience, visitor status, query-param
2152
+ * conditions. Omit to inherit defaults.
2153
+ */
2154
+ export interface TargetingRules {
2155
+ /**
2156
+ * Glob-style URL patterns that must match for the experiment to be eligible. Up to
2157
+ * 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
2158
+ * the field) matches all URLs — equivalent to `["**"]`.
2159
+ */
2160
+ urlPatterns: Array<string>;
2161
+
2162
+ /**
2163
+ * Optional audience identifier used for server-side eligibility filtering.
2164
+ */
2165
+ audienceId?: string | null;
2166
+
2167
+ /**
2168
+ * Additional query-string conditions that must all match for the visitor to
2169
+ * qualify.
2170
+ */
2171
+ queryParams?: Array<TargetingRules.QueryParam> | null;
2172
+
2173
+ /**
2174
+ * Optional visitor-property matching rules. These are passed through as JSON for
2175
+ * experimentation targeting.
2176
+ */
2177
+ visitorProperties?: unknown | null;
2178
+
2179
+ /**
2180
+ * Whether the experiment should target new visitors, returning visitors, or any
2181
+ * visitor.
2182
+ */
2183
+ visitorStatus?: string | null;
2184
+ }
2185
+
2186
+ export namespace TargetingRules {
2187
+ export interface QueryParam {
2188
+ /**
2189
+ * Query string key to inspect on the current page URL.
2190
+ */
2191
+ key: string;
2192
+
2193
+ /**
2194
+ * Comparison operator applied to the query string value.
2195
+ */
2196
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
2197
+
2198
+ /**
2199
+ * Comparison value used by operators that require one. Omit for `exists` and
2200
+ * `not_exists`.
2201
+ */
2202
+ value?: string | null;
2203
+ }
2204
+ }
2205
+ }
2206
+
2207
+ export interface ExperimentUpdateParams {
2208
+ /**
2209
+ * Updated experiment hypothesis or operator note.
2210
+ */
2211
+ description?: string | null;
2212
+
2213
+ /**
2214
+ * Updated redirect query-string forwarding behavior for the experiment.
2215
+ */
2216
+ includeQueryString?: boolean | null;
2217
+
2218
+ /**
2219
+ * Updated stable code-facing key. When blank, the API falls back to a slugified
2220
+ * key derived from the current experiment name.
2221
+ */
2222
+ key?: string | null;
2223
+
2224
+ /**
2225
+ * Updated goal events. Send the full nested object — replaces the previous value,
2226
+ * not merged. If you send `metrics.primary`, `metrics.primary.eventName` must be a
2227
+ * non-blank string.
2228
+ */
2229
+ metrics?: ExperimentUpdateParams.Metrics | null;
2230
+
2231
+ /**
2232
+ * Updated experiment name.
2233
+ */
2234
+ name?: string | null;
2235
+
2236
+ /**
2237
+ * Updated eligibility rules. Send the full nested object — replaces the previous
2238
+ * value, not merged.
2239
+ */
2240
+ targetingRules?: ExperimentUpdateParams.TargetingRules | null;
2241
+
2242
+ /**
2243
+ * Updated traffic allocation percentage from 0 to 100.
2244
+ */
2245
+ trafficAllocation?: number | null;
2246
+ }
2247
+
2248
+ export namespace ExperimentUpdateParams {
2249
+ /**
2250
+ * Updated goal events. Send the full nested object — replaces the previous value,
2251
+ * not merged. If you send `metrics.primary`, `metrics.primary.eventName` must be a
2252
+ * non-blank string.
2253
+ */
2254
+ export interface Metrics {
2255
+ /**
2256
+ * Primary success metric. When provided, `eventName` must be a non-blank string.
2257
+ */
2258
+ primary?: Metrics.Primary | null;
2259
+
2260
+ /**
2261
+ * Optional secondary metrics tracked alongside the primary goal.
2262
+ */
2263
+ secondary?: Array<Metrics.Secondary> | null;
2264
+ }
2265
+
2266
+ export namespace Metrics {
2267
+ /**
2268
+ * Primary success metric. When provided, `eventName` must be a non-blank string.
2269
+ */
2270
+ export interface Primary {
2271
+ /**
2272
+ * Event name to use as the goal for this metric.
2273
+ */
2274
+ eventName?: string | null;
2275
+
2276
+ /**
2277
+ * Optional funnel identifier when the metric should be derived from an existing
2278
+ * funnel definition.
2279
+ */
2280
+ funnelId?: string | null;
2281
+ }
2282
+
2283
+ export interface Secondary {
2284
+ /**
2285
+ * Event name to use as the goal for this metric.
2286
+ */
2287
+ eventName?: string | null;
2288
+
2289
+ /**
2290
+ * Optional funnel identifier when the metric should be derived from an existing
2291
+ * funnel definition.
2292
+ */
2293
+ funnelId?: string | null;
2294
+ }
2295
+ }
2296
+
2297
+ /**
2298
+ * Updated eligibility rules. Send the full nested object — replaces the previous
2299
+ * value, not merged.
2300
+ */
2301
+ export interface TargetingRules {
2302
+ /**
2303
+ * Glob-style URL patterns that must match for the experiment to be eligible. Up to
2304
+ * 200 patterns; each pattern up to 2000 characters. An empty array (or omitting
2305
+ * the field) matches all URLs — equivalent to `["**"]`.
2306
+ */
2307
+ urlPatterns: Array<string>;
2308
+
2309
+ /**
2310
+ * Optional audience identifier used for server-side eligibility filtering.
2311
+ */
2312
+ audienceId?: string | null;
2313
+
2314
+ /**
2315
+ * Additional query-string conditions that must all match for the visitor to
2316
+ * qualify.
2317
+ */
2318
+ queryParams?: Array<TargetingRules.QueryParam> | null;
2319
+
2320
+ /**
2321
+ * Optional visitor-property matching rules. These are passed through as JSON for
2322
+ * experimentation targeting.
2323
+ */
2324
+ visitorProperties?: unknown | null;
2325
+
2326
+ /**
2327
+ * Whether the experiment should target new visitors, returning visitors, or any
2328
+ * visitor.
2329
+ */
2330
+ visitorStatus?: string | null;
2331
+ }
2332
+
2333
+ export namespace TargetingRules {
2334
+ export interface QueryParam {
2335
+ /**
2336
+ * Query string key to inspect on the current page URL.
2337
+ */
2338
+ key: string;
2339
+
2340
+ /**
2341
+ * Comparison operator applied to the query string value.
2342
+ */
2343
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists';
2344
+
2345
+ /**
2346
+ * Comparison value used by operators that require one. Omit for `exists` and
2347
+ * `not_exists`.
2348
+ */
2349
+ value?: string | null;
2350
+ }
2351
+ }
2352
+ }
2353
+
2354
+ export interface ExperimentStartParams {
2355
+ /**
2356
+ * When true (default on the REST surface), publish the current draft version
2357
+ * immediately after starting the experiment. Any other unpublished changes in the
2358
+ * same account version are included in that publish. Pass `false` explicitly to
2359
+ * stage the change without publishing; the response will report `pending_publish`.
2360
+ */
2361
+ publishAfterStart?: boolean;
2362
+ }
2363
+
2364
+ export interface ExperimentStopParams {
2365
+ /**
2366
+ * Optional winning variant ID to persist when completing the experiment.
2367
+ */
2368
+ winnerVariantId?: string;
2369
+ }
2370
+
2371
+ export interface ExperimentPauseParams {
2372
+ /**
2373
+ * When true (default on the REST surface), publish the current draft version
2374
+ * immediately after pausing the experiment. Any other unpublished changes in the
2375
+ * same account version are included in that publish. Pass `false` explicitly to
2376
+ * stage the change without publishing; the response will report `pending_publish`.
2377
+ */
2378
+ publishAfterPause?: boolean;
2379
+ }
2380
+
2381
+ export interface ExperimentResumeParams {
2382
+ /**
2383
+ * When true (default on the REST surface), publish the current draft version
2384
+ * immediately after resuming the experiment. Any other unpublished changes in the
2385
+ * same account version are included in that publish. Pass `false` explicitly to
2386
+ * stage the change without publishing; the response will report `pending_publish`.
2387
+ */
2388
+ publishAfterResume?: boolean;
2389
+ }
2390
+
2391
+ export interface ExperimentResultsParams {
2392
+ /**
2393
+ * Optional override for the conversion event name. When omitted, the experiment
2394
+ * primary metric event is used.
2395
+ */
2396
+ eventName?: string;
2397
+ }
2398
+
2399
+ export interface ExperimentResultsTimeSeriesParams {
2400
+ /**
2401
+ * Inclusive upper bound of the response window, as a UTC calendar day in
2402
+ * `YYYY-MM-DD` format. Defaults to the experiment stop date for completed
2403
+ * experiments, or today for running experiments. Values after that are silently
2404
+ * clamped. The window between `startDate` and `endDate` must be 366 days or fewer.
2405
+ */
2406
+ endDate?: string;
2407
+
2408
+ /**
2409
+ * Optional override for the conversion event name. When omitted, the experiment
2410
+ * primary metric event is used.
2411
+ */
2412
+ eventName?: string;
2413
+
2414
+ /**
2415
+ * Inclusive lower bound of the response window, as a UTC calendar day in
2416
+ * `YYYY-MM-DD` format. Defaults to the experiment start date when omitted. Values
2417
+ * before the experiment started are silently clamped to the experiment start.
2418
+ */
2419
+ startDate?: string;
2420
+ }
2421
+
2422
+ export declare namespace Experiments {
2423
+ export {
2424
+ type ExperimentListResponse as ExperimentListResponse,
2425
+ type ExperimentCreateResponse as ExperimentCreateResponse,
2426
+ type ExperimentRetrieveResponse as ExperimentRetrieveResponse,
2427
+ type ExperimentUpdateResponse as ExperimentUpdateResponse,
2428
+ type ExperimentDeleteResponse as ExperimentDeleteResponse,
2429
+ type ExperimentStartResponse as ExperimentStartResponse,
2430
+ type ExperimentStopResponse as ExperimentStopResponse,
2431
+ type ExperimentPauseResponse as ExperimentPauseResponse,
2432
+ type ExperimentResumeResponse as ExperimentResumeResponse,
2433
+ type ExperimentResultsResponse as ExperimentResultsResponse,
2434
+ type ExperimentResultsTimeSeriesResponse as ExperimentResultsTimeSeriesResponse,
2435
+ type ExperimentListResponsesCursor as ExperimentListResponsesCursor,
2436
+ type ExperimentListParams as ExperimentListParams,
2437
+ type ExperimentCreateParams as ExperimentCreateParams,
2438
+ type ExperimentUpdateParams as ExperimentUpdateParams,
2439
+ type ExperimentStartParams as ExperimentStartParams,
2440
+ type ExperimentStopParams as ExperimentStopParams,
2441
+ type ExperimentPauseParams as ExperimentPauseParams,
2442
+ type ExperimentResumeParams as ExperimentResumeParams,
2443
+ type ExperimentResultsParams as ExperimentResultsParams,
2444
+ type ExperimentResultsTimeSeriesParams as ExperimentResultsTimeSeriesParams,
2445
+ };
2446
+ }