@oursprivacy/platform-sdk 1.12.0 → 1.14.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 +24 -0
  2. package/README.md +35 -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 +653 -0
  69. package/resources/experiment-variants.d.mts.map +1 -0
  70. package/resources/experiment-variants.d.ts +653 -0
  71. package/resources/experiment-variants.d.ts.map +1 -0
  72. package/resources/experiment-variants.js +86 -0
  73. package/resources/experiment-variants.js.map +1 -0
  74. package/resources/experiment-variants.mjs +82 -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 +138 -0
  101. package/resources/mappings.d.mts.map +1 -0
  102. package/resources/mappings.d.ts +138 -0
  103. package/resources/mappings.d.ts.map +1 -0
  104. package/resources/mappings.js +45 -0
  105. package/resources/mappings.js.map +1 -0
  106. package/resources/mappings.mjs +41 -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 +210 -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 +868 -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 +77 -7
  144. package/src/resources/mappings.ts +236 -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,868 @@
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 ExperimentVariants extends APIResource {
10
+ /**
11
+ * List variants for a specific parent experiment. Requires the `experimentId`
12
+ * query parameter — variants are always scoped to a single experiment. Supports
13
+ * cursor pagination via `limit` and `cursor`; SDK runtimes that need the full set
14
+ * in one request can pass `?limit=100`. Requires scope: experiment:find
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * // Automatically fetches more pages as needed.
19
+ * for await (const experimentVariantListResponse of client.experimentVariants.list(
20
+ * { experimentId: '08524dc8-5289-48e8-bf40-b3a7cfa6ca0a' },
21
+ * )) {
22
+ * // ...
23
+ * }
24
+ * ```
25
+ */
26
+ list(
27
+ query: ExperimentVariantListParams,
28
+ options?: RequestOptions,
29
+ ): PagePromise<ExperimentVariantListResponsesCursor, ExperimentVariantListResponse> {
30
+ return this._client.getAPIList('/rest/v1/experiment-variants', Cursor<ExperimentVariantListResponse>, {
31
+ query,
32
+ ...options,
33
+ });
34
+ }
35
+
36
+ /**
37
+ * Create a new experiment variant. Requires scope: experiment:update
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const experimentVariant =
42
+ * await client.experimentVariants.create({
43
+ * experimentId: 'x',
44
+ * name: 'Variant B',
45
+ * weight: 50,
46
+ * });
47
+ * ```
48
+ */
49
+ create(
50
+ body: ExperimentVariantCreateParams,
51
+ options?: RequestOptions,
52
+ ): APIPromise<ExperimentVariantCreateResponse> {
53
+ return this._client.post('/rest/v1/experiment-variants', { body, ...options });
54
+ }
55
+
56
+ /**
57
+ * Find a single experiment variant by ID. Requires scope: experiment:find
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const experimentVariant =
62
+ * await client.experimentVariants.retrieve('id');
63
+ * ```
64
+ */
65
+ retrieve(id: string, options?: RequestOptions): APIPromise<ExperimentVariantRetrieveResponse> {
66
+ return this._client.get(path`/rest/v1/experiment-variants/${id}`, options);
67
+ }
68
+
69
+ /**
70
+ * Partially update an experiment variant. Only the fields you send are changed.
71
+ * Requires scope: experiment:update
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * const experimentVariant =
76
+ * await client.experimentVariants.update('id');
77
+ * ```
78
+ */
79
+ update(
80
+ id: string,
81
+ body: ExperimentVariantUpdateParams,
82
+ options?: RequestOptions,
83
+ ): APIPromise<ExperimentVariantUpdateResponse> {
84
+ return this._client.patch(path`/rest/v1/experiment-variants/${id}`, { body, ...options });
85
+ }
86
+
87
+ /**
88
+ * Delete an experiment variant. Requires scope: experiment:update
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * const experimentVariant =
93
+ * await client.experimentVariants.delete('id');
94
+ * ```
95
+ */
96
+ delete(id: string, options?: RequestOptions): APIPromise<ExperimentVariantDeleteResponse> {
97
+ return this._client.delete(path`/rest/v1/experiment-variants/${id}`, options);
98
+ }
99
+ }
100
+
101
+ export type ExperimentVariantListResponsesCursor = Cursor<ExperimentVariantListResponse>;
102
+
103
+ export interface ExperimentVariantListResponse {
104
+ /**
105
+ * Unique identifier for this experiment variant.
106
+ */
107
+ id: string;
108
+
109
+ /**
110
+ * Parent experiment ID this variant belongs to.
111
+ */
112
+ experimentId: string;
113
+
114
+ /**
115
+ * Whether this is the baseline control variant.
116
+ */
117
+ isControl: boolean;
118
+
119
+ /**
120
+ * Human-readable variant name shown in the dashboard and results.
121
+ */
122
+ name: string;
123
+
124
+ /**
125
+ * Relative traffic weight used when assigning visitors among variants in an active
126
+ * experiment.
127
+ */
128
+ weight: number;
129
+
130
+ /**
131
+ * Ordered list of declarative DOM mutations applied when this variant is assigned.
132
+ */
133
+ domModifications?: Array<ExperimentVariantListResponse.DomModification> | null;
134
+
135
+ /**
136
+ * Target URL for redirect variants. Use either a site-relative path such as
137
+ * `/pricing-v2` or an absolute `https://` URL. Cross-origin `http://` URLs are
138
+ * rejected. Omit for DOM modification variants.
139
+ */
140
+ redirectUrl?: string | null;
141
+
142
+ /**
143
+ * How this variant changes the user experience. `dom_modifications` for on-page
144
+ * changes or `redirect` for redirect tests.
145
+ */
146
+ variantType?: string | null;
147
+ }
148
+
149
+ export namespace ExperimentVariantListResponse {
150
+ export interface DomModification {
151
+ /**
152
+ * Mutation to apply when the selector matches. Use `redirectUrl` instead of DOM
153
+ * modifications for redirect variants.
154
+ */
155
+ action:
156
+ | 'customCss'
157
+ | 'customJs'
158
+ | 'insertAfter'
159
+ | 'insertBefore'
160
+ | 'remove'
161
+ | 'setAttribute'
162
+ | 'setHtml'
163
+ | 'setImage'
164
+ | 'setStyle'
165
+ | 'setText';
166
+
167
+ /**
168
+ * CSS selector used to find the element to modify on the page at runtime.
169
+ */
170
+ selector: string;
171
+
172
+ /**
173
+ * Canonical action payload. For `setText` / `setHtml` / `customCss` / `customJs` /
174
+ * `setImage` / `insertBefore` / `insertAfter` this is the literal
175
+ * text/HTML/CSS/JS/URL. For `setStyle` and `setAttribute` it is a JSON-stringified
176
+ * `{key: value}` object — prefer the structured `styles` / `attribute` fields
177
+ * below to avoid manual JSON encoding.
178
+ */
179
+ value: string;
180
+
181
+ /**
182
+ * Populated on read for `setAttribute` modifications, parsed from `value`.
183
+ * Customers may also send this field instead of a JSON-stringified `value` on
184
+ * write — see `domModificationInputSchema`.
185
+ */
186
+ attribute?: unknown | null;
187
+
188
+ /**
189
+ * Populated on read for `setStyle` modifications, parsed from `value`. Customers
190
+ * may also send this field instead of a JSON-stringified `value` on write — see
191
+ * `domModificationInputSchema`.
192
+ */
193
+ styles?: Array<DomModification.Style> | null;
194
+ }
195
+
196
+ export namespace DomModification {
197
+ export interface Style {
198
+ /**
199
+ * CSS property name in camelCase or kebab-case.
200
+ */
201
+ property: string;
202
+
203
+ /**
204
+ * CSS value to assign to the property.
205
+ */
206
+ value: string;
207
+ }
208
+ }
209
+ }
210
+
211
+ export interface ExperimentVariantCreateResponse {
212
+ /**
213
+ * Unique identifier for this experiment variant.
214
+ */
215
+ id: string;
216
+
217
+ /**
218
+ * Parent experiment ID this variant belongs to.
219
+ */
220
+ experimentId: string;
221
+
222
+ /**
223
+ * Whether this is the baseline control variant.
224
+ */
225
+ isControl: boolean;
226
+
227
+ /**
228
+ * Human-readable variant name shown in the dashboard and results.
229
+ */
230
+ name: string;
231
+
232
+ /**
233
+ * Relative traffic weight used when assigning visitors among variants in an active
234
+ * experiment.
235
+ */
236
+ weight: number;
237
+
238
+ /**
239
+ * Ordered list of declarative DOM mutations applied when this variant is assigned.
240
+ */
241
+ domModifications?: Array<ExperimentVariantCreateResponse.DomModification> | null;
242
+
243
+ /**
244
+ * Target URL for redirect variants. Use either a site-relative path such as
245
+ * `/pricing-v2` or an absolute `https://` URL. Cross-origin `http://` URLs are
246
+ * rejected. Omit for DOM modification variants.
247
+ */
248
+ redirectUrl?: string | null;
249
+
250
+ /**
251
+ * How this variant changes the user experience. `dom_modifications` for on-page
252
+ * changes or `redirect` for redirect tests.
253
+ */
254
+ variantType?: string | null;
255
+ }
256
+
257
+ export namespace ExperimentVariantCreateResponse {
258
+ export interface DomModification {
259
+ /**
260
+ * Mutation to apply when the selector matches. Use `redirectUrl` instead of DOM
261
+ * modifications for redirect variants.
262
+ */
263
+ action:
264
+ | 'customCss'
265
+ | 'customJs'
266
+ | 'insertAfter'
267
+ | 'insertBefore'
268
+ | 'remove'
269
+ | 'setAttribute'
270
+ | 'setHtml'
271
+ | 'setImage'
272
+ | 'setStyle'
273
+ | 'setText';
274
+
275
+ /**
276
+ * CSS selector used to find the element to modify on the page at runtime.
277
+ */
278
+ selector: string;
279
+
280
+ /**
281
+ * Canonical action payload. For `setText` / `setHtml` / `customCss` / `customJs` /
282
+ * `setImage` / `insertBefore` / `insertAfter` this is the literal
283
+ * text/HTML/CSS/JS/URL. For `setStyle` and `setAttribute` it is a JSON-stringified
284
+ * `{key: value}` object — prefer the structured `styles` / `attribute` fields
285
+ * below to avoid manual JSON encoding.
286
+ */
287
+ value: string;
288
+
289
+ /**
290
+ * Populated on read for `setAttribute` modifications, parsed from `value`.
291
+ * Customers may also send this field instead of a JSON-stringified `value` on
292
+ * write — see `domModificationInputSchema`.
293
+ */
294
+ attribute?: unknown | null;
295
+
296
+ /**
297
+ * Populated on read for `setStyle` modifications, parsed from `value`. Customers
298
+ * may also send this field instead of a JSON-stringified `value` on write — see
299
+ * `domModificationInputSchema`.
300
+ */
301
+ styles?: Array<DomModification.Style> | null;
302
+ }
303
+
304
+ export namespace DomModification {
305
+ export interface Style {
306
+ /**
307
+ * CSS property name in camelCase or kebab-case.
308
+ */
309
+ property: string;
310
+
311
+ /**
312
+ * CSS value to assign to the property.
313
+ */
314
+ value: string;
315
+ }
316
+ }
317
+ }
318
+
319
+ export interface ExperimentVariantRetrieveResponse {
320
+ /**
321
+ * Unique identifier for this experiment variant.
322
+ */
323
+ id: string;
324
+
325
+ /**
326
+ * Parent experiment ID this variant belongs to.
327
+ */
328
+ experimentId: string;
329
+
330
+ /**
331
+ * Whether this is the baseline control variant.
332
+ */
333
+ isControl: boolean;
334
+
335
+ /**
336
+ * Human-readable variant name shown in the dashboard and results.
337
+ */
338
+ name: string;
339
+
340
+ /**
341
+ * Relative traffic weight used when assigning visitors among variants in an active
342
+ * experiment.
343
+ */
344
+ weight: number;
345
+
346
+ /**
347
+ * Ordered list of declarative DOM mutations applied when this variant is assigned.
348
+ */
349
+ domModifications?: Array<ExperimentVariantRetrieveResponse.DomModification> | null;
350
+
351
+ /**
352
+ * Target URL for redirect variants. Use either a site-relative path such as
353
+ * `/pricing-v2` or an absolute `https://` URL. Cross-origin `http://` URLs are
354
+ * rejected. Omit for DOM modification variants.
355
+ */
356
+ redirectUrl?: string | null;
357
+
358
+ /**
359
+ * How this variant changes the user experience. `dom_modifications` for on-page
360
+ * changes or `redirect` for redirect tests.
361
+ */
362
+ variantType?: string | null;
363
+ }
364
+
365
+ export namespace ExperimentVariantRetrieveResponse {
366
+ export interface DomModification {
367
+ /**
368
+ * Mutation to apply when the selector matches. Use `redirectUrl` instead of DOM
369
+ * modifications for redirect variants.
370
+ */
371
+ action:
372
+ | 'customCss'
373
+ | 'customJs'
374
+ | 'insertAfter'
375
+ | 'insertBefore'
376
+ | 'remove'
377
+ | 'setAttribute'
378
+ | 'setHtml'
379
+ | 'setImage'
380
+ | 'setStyle'
381
+ | 'setText';
382
+
383
+ /**
384
+ * CSS selector used to find the element to modify on the page at runtime.
385
+ */
386
+ selector: string;
387
+
388
+ /**
389
+ * Canonical action payload. For `setText` / `setHtml` / `customCss` / `customJs` /
390
+ * `setImage` / `insertBefore` / `insertAfter` this is the literal
391
+ * text/HTML/CSS/JS/URL. For `setStyle` and `setAttribute` it is a JSON-stringified
392
+ * `{key: value}` object — prefer the structured `styles` / `attribute` fields
393
+ * below to avoid manual JSON encoding.
394
+ */
395
+ value: string;
396
+
397
+ /**
398
+ * Populated on read for `setAttribute` modifications, parsed from `value`.
399
+ * Customers may also send this field instead of a JSON-stringified `value` on
400
+ * write — see `domModificationInputSchema`.
401
+ */
402
+ attribute?: unknown | null;
403
+
404
+ /**
405
+ * Populated on read for `setStyle` modifications, parsed from `value`. Customers
406
+ * may also send this field instead of a JSON-stringified `value` on write — see
407
+ * `domModificationInputSchema`.
408
+ */
409
+ styles?: Array<DomModification.Style> | null;
410
+ }
411
+
412
+ export namespace DomModification {
413
+ export interface Style {
414
+ /**
415
+ * CSS property name in camelCase or kebab-case.
416
+ */
417
+ property: string;
418
+
419
+ /**
420
+ * CSS value to assign to the property.
421
+ */
422
+ value: string;
423
+ }
424
+ }
425
+ }
426
+
427
+ export interface ExperimentVariantUpdateResponse {
428
+ /**
429
+ * Unique identifier for this experiment variant.
430
+ */
431
+ id: string;
432
+
433
+ /**
434
+ * Parent experiment ID this variant belongs to.
435
+ */
436
+ experimentId: string;
437
+
438
+ /**
439
+ * Whether this is the baseline control variant.
440
+ */
441
+ isControl: boolean;
442
+
443
+ /**
444
+ * Human-readable variant name shown in the dashboard and results.
445
+ */
446
+ name: string;
447
+
448
+ /**
449
+ * Relative traffic weight used when assigning visitors among variants in an active
450
+ * experiment.
451
+ */
452
+ weight: number;
453
+
454
+ /**
455
+ * Ordered list of declarative DOM mutations applied when this variant is assigned.
456
+ */
457
+ domModifications?: Array<ExperimentVariantUpdateResponse.DomModification> | null;
458
+
459
+ /**
460
+ * Target URL for redirect variants. Use either a site-relative path such as
461
+ * `/pricing-v2` or an absolute `https://` URL. Cross-origin `http://` URLs are
462
+ * rejected. Omit for DOM modification variants.
463
+ */
464
+ redirectUrl?: string | null;
465
+
466
+ /**
467
+ * How this variant changes the user experience. `dom_modifications` for on-page
468
+ * changes or `redirect` for redirect tests.
469
+ */
470
+ variantType?: string | null;
471
+ }
472
+
473
+ export namespace ExperimentVariantUpdateResponse {
474
+ export interface DomModification {
475
+ /**
476
+ * Mutation to apply when the selector matches. Use `redirectUrl` instead of DOM
477
+ * modifications for redirect variants.
478
+ */
479
+ action:
480
+ | 'customCss'
481
+ | 'customJs'
482
+ | 'insertAfter'
483
+ | 'insertBefore'
484
+ | 'remove'
485
+ | 'setAttribute'
486
+ | 'setHtml'
487
+ | 'setImage'
488
+ | 'setStyle'
489
+ | 'setText';
490
+
491
+ /**
492
+ * CSS selector used to find the element to modify on the page at runtime.
493
+ */
494
+ selector: string;
495
+
496
+ /**
497
+ * Canonical action payload. For `setText` / `setHtml` / `customCss` / `customJs` /
498
+ * `setImage` / `insertBefore` / `insertAfter` this is the literal
499
+ * text/HTML/CSS/JS/URL. For `setStyle` and `setAttribute` it is a JSON-stringified
500
+ * `{key: value}` object — prefer the structured `styles` / `attribute` fields
501
+ * below to avoid manual JSON encoding.
502
+ */
503
+ value: string;
504
+
505
+ /**
506
+ * Populated on read for `setAttribute` modifications, parsed from `value`.
507
+ * Customers may also send this field instead of a JSON-stringified `value` on
508
+ * write — see `domModificationInputSchema`.
509
+ */
510
+ attribute?: unknown | null;
511
+
512
+ /**
513
+ * Populated on read for `setStyle` modifications, parsed from `value`. Customers
514
+ * may also send this field instead of a JSON-stringified `value` on write — see
515
+ * `domModificationInputSchema`.
516
+ */
517
+ styles?: Array<DomModification.Style> | null;
518
+ }
519
+
520
+ export namespace DomModification {
521
+ export interface Style {
522
+ /**
523
+ * CSS property name in camelCase or kebab-case.
524
+ */
525
+ property: string;
526
+
527
+ /**
528
+ * CSS value to assign to the property.
529
+ */
530
+ value: string;
531
+ }
532
+ }
533
+ }
534
+
535
+ export interface ExperimentVariantDeleteResponse {
536
+ /**
537
+ * Unique identifier for this experiment variant.
538
+ */
539
+ id: string;
540
+
541
+ /**
542
+ * Parent experiment ID this variant belongs to.
543
+ */
544
+ experimentId: string;
545
+
546
+ /**
547
+ * Whether this is the baseline control variant.
548
+ */
549
+ isControl: boolean;
550
+
551
+ /**
552
+ * Human-readable variant name shown in the dashboard and results.
553
+ */
554
+ name: string;
555
+
556
+ /**
557
+ * Relative traffic weight used when assigning visitors among variants in an active
558
+ * experiment.
559
+ */
560
+ weight: number;
561
+
562
+ /**
563
+ * Ordered list of declarative DOM mutations applied when this variant is assigned.
564
+ */
565
+ domModifications?: Array<ExperimentVariantDeleteResponse.DomModification> | null;
566
+
567
+ /**
568
+ * Target URL for redirect variants. Use either a site-relative path such as
569
+ * `/pricing-v2` or an absolute `https://` URL. Cross-origin `http://` URLs are
570
+ * rejected. Omit for DOM modification variants.
571
+ */
572
+ redirectUrl?: string | null;
573
+
574
+ /**
575
+ * How this variant changes the user experience. `dom_modifications` for on-page
576
+ * changes or `redirect` for redirect tests.
577
+ */
578
+ variantType?: string | null;
579
+ }
580
+
581
+ export namespace ExperimentVariantDeleteResponse {
582
+ export interface DomModification {
583
+ /**
584
+ * Mutation to apply when the selector matches. Use `redirectUrl` instead of DOM
585
+ * modifications for redirect variants.
586
+ */
587
+ action:
588
+ | 'customCss'
589
+ | 'customJs'
590
+ | 'insertAfter'
591
+ | 'insertBefore'
592
+ | 'remove'
593
+ | 'setAttribute'
594
+ | 'setHtml'
595
+ | 'setImage'
596
+ | 'setStyle'
597
+ | 'setText';
598
+
599
+ /**
600
+ * CSS selector used to find the element to modify on the page at runtime.
601
+ */
602
+ selector: string;
603
+
604
+ /**
605
+ * Canonical action payload. For `setText` / `setHtml` / `customCss` / `customJs` /
606
+ * `setImage` / `insertBefore` / `insertAfter` this is the literal
607
+ * text/HTML/CSS/JS/URL. For `setStyle` and `setAttribute` it is a JSON-stringified
608
+ * `{key: value}` object — prefer the structured `styles` / `attribute` fields
609
+ * below to avoid manual JSON encoding.
610
+ */
611
+ value: string;
612
+
613
+ /**
614
+ * Populated on read for `setAttribute` modifications, parsed from `value`.
615
+ * Customers may also send this field instead of a JSON-stringified `value` on
616
+ * write — see `domModificationInputSchema`.
617
+ */
618
+ attribute?: unknown | null;
619
+
620
+ /**
621
+ * Populated on read for `setStyle` modifications, parsed from `value`. Customers
622
+ * may also send this field instead of a JSON-stringified `value` on write — see
623
+ * `domModificationInputSchema`.
624
+ */
625
+ styles?: Array<DomModification.Style> | null;
626
+ }
627
+
628
+ export namespace DomModification {
629
+ export interface Style {
630
+ /**
631
+ * CSS property name in camelCase or kebab-case.
632
+ */
633
+ property: string;
634
+
635
+ /**
636
+ * CSS value to assign to the property.
637
+ */
638
+ value: string;
639
+ }
640
+ }
641
+ }
642
+
643
+ export interface ExperimentVariantListParams extends CursorParams {
644
+ /**
645
+ * Required. List variants belonging to this parent experiment.
646
+ */
647
+ experimentId: string;
648
+ }
649
+
650
+ export interface ExperimentVariantCreateParams {
651
+ /**
652
+ * Parent experiment ID that will own this new variant.
653
+ */
654
+ experimentId: string;
655
+
656
+ /**
657
+ * Human-readable name for the new variant.
658
+ */
659
+ name: string;
660
+
661
+ /**
662
+ * Traffic weight to assign to this variant. Weights are relative shares; the
663
+ * runtime normalizes by their sum. Must be a positive integer in the range
664
+ * 1..1_000_000.
665
+ */
666
+ weight: number;
667
+
668
+ /**
669
+ * Required for DOM modification variants. Omit for redirect variants. Each entry
670
+ * is `{selector, action, value}`.
671
+ */
672
+ domModifications?: Array<ExperimentVariantCreateParams.DomModification> | null;
673
+
674
+ /**
675
+ * Mark this variant as the experiment control. Defaults to `false`. The API
676
+ * rejects the request with 409 if the experiment already has a control variant —
677
+ * to swap controls, first PATCH the existing control to clear `isControl`, then
678
+ * create or PATCH the new one with `isControl: true`. The auto-generated control
679
+ * variant created with each new experiment can be replaced this way. DELETE on the
680
+ * control returns 409.
681
+ */
682
+ isControl?: boolean | null;
683
+
684
+ /**
685
+ * Required for redirect variants. Use either a site-relative path such as
686
+ * `/pricing-v2` or an absolute `https://` URL. Cross-origin `http://` URLs are
687
+ * rejected. Omit for DOM modification variants.
688
+ */
689
+ redirectUrl?: string | null;
690
+
691
+ /**
692
+ * Variant type to create. Use `redirect` for redirect tests or `dom_modifications`
693
+ * for on-page changes.
694
+ */
695
+ variantType?: 'dom_modifications' | 'redirect' | null;
696
+ }
697
+
698
+ export namespace ExperimentVariantCreateParams {
699
+ export interface DomModification {
700
+ /**
701
+ * Mutation to apply when the selector matches.
702
+ */
703
+ action:
704
+ | 'customCss'
705
+ | 'customJs'
706
+ | 'insertAfter'
707
+ | 'insertBefore'
708
+ | 'remove'
709
+ | 'setAttribute'
710
+ | 'setHtml'
711
+ | 'setImage'
712
+ | 'setStyle'
713
+ | 'setText';
714
+
715
+ /**
716
+ * CSS selector used to find the element to modify on the page at runtime.
717
+ */
718
+ selector: string;
719
+
720
+ /**
721
+ * Use this for `setAttribute` to avoid JSON-stringifying `{name: value}` yourself.
722
+ * Ignored for other actions.
723
+ */
724
+ attribute?: unknown | null;
725
+
726
+ /**
727
+ * Use this for `setStyle` to avoid JSON-stringifying `{property: value}` yourself.
728
+ * Ignored for other actions.
729
+ */
730
+ styles?: Array<DomModification.Style> | null;
731
+
732
+ /**
733
+ * Canonical action payload. For `setText` / `setHtml` / `customCss` / `customJs` /
734
+ * `setImage` / `insertBefore` / `insertAfter` this is the literal
735
+ * text/HTML/CSS/JS/URL. For `setStyle` and `setAttribute` it is a JSON-stringified
736
+ * `{key: value}` object — or you can supply the structured `styles` / `attribute`
737
+ * field instead and the server will normalize.
738
+ */
739
+ value?: string | null;
740
+ }
741
+
742
+ export namespace DomModification {
743
+ export interface Style {
744
+ /**
745
+ * CSS property name in camelCase or kebab-case.
746
+ */
747
+ property: string;
748
+
749
+ /**
750
+ * CSS value to assign to the property.
751
+ */
752
+ value: string;
753
+ }
754
+ }
755
+ }
756
+
757
+ export interface ExperimentVariantUpdateParams {
758
+ /**
759
+ * Updated declarative DOM mutations. Sending this field replaces the prior list —
760
+ * partial-array merging is not supported.
761
+ */
762
+ domModifications?: Array<ExperimentVariantUpdateParams.DomModification> | null;
763
+
764
+ /**
765
+ * Promote or demote this variant as the control. Promoting a second variant while
766
+ * another already has `isControl: true` is rejected with 409 — clear the existing
767
+ * control first.
768
+ */
769
+ isControl?: boolean | null;
770
+
771
+ /**
772
+ * Updated variant name.
773
+ */
774
+ name?: string | null;
775
+
776
+ /**
777
+ * Updated redirect URL for redirect variants. Use either a site-relative path such
778
+ * as `/pricing-v2` or an absolute `https://` URL. Cross-origin `http://` URLs are
779
+ * rejected.
780
+ */
781
+ redirectUrl?: string | null;
782
+
783
+ /**
784
+ * Updated variant type — `redirect` or `dom_modifications`. Changing this also
785
+ * requires updating the matching payload field (`redirectUrl` or
786
+ * `domModifications`).
787
+ */
788
+ variantType?: 'dom_modifications' | 'redirect' | null;
789
+
790
+ /**
791
+ * Updated traffic weight relative to other variants. Must be a positive integer in
792
+ * the range 1..1_000_000.
793
+ */
794
+ weight?: number | null;
795
+ }
796
+
797
+ export namespace ExperimentVariantUpdateParams {
798
+ export interface DomModification {
799
+ /**
800
+ * Mutation to apply when the selector matches.
801
+ */
802
+ action:
803
+ | 'customCss'
804
+ | 'customJs'
805
+ | 'insertAfter'
806
+ | 'insertBefore'
807
+ | 'remove'
808
+ | 'setAttribute'
809
+ | 'setHtml'
810
+ | 'setImage'
811
+ | 'setStyle'
812
+ | 'setText';
813
+
814
+ /**
815
+ * CSS selector used to find the element to modify on the page at runtime.
816
+ */
817
+ selector: string;
818
+
819
+ /**
820
+ * Use this for `setAttribute` to avoid JSON-stringifying `{name: value}` yourself.
821
+ * Ignored for other actions.
822
+ */
823
+ attribute?: unknown | null;
824
+
825
+ /**
826
+ * Use this for `setStyle` to avoid JSON-stringifying `{property: value}` yourself.
827
+ * Ignored for other actions.
828
+ */
829
+ styles?: Array<DomModification.Style> | null;
830
+
831
+ /**
832
+ * Canonical action payload. For `setText` / `setHtml` / `customCss` / `customJs` /
833
+ * `setImage` / `insertBefore` / `insertAfter` this is the literal
834
+ * text/HTML/CSS/JS/URL. For `setStyle` and `setAttribute` it is a JSON-stringified
835
+ * `{key: value}` object — or you can supply the structured `styles` / `attribute`
836
+ * field instead and the server will normalize.
837
+ */
838
+ value?: string | null;
839
+ }
840
+
841
+ export namespace DomModification {
842
+ export interface Style {
843
+ /**
844
+ * CSS property name in camelCase or kebab-case.
845
+ */
846
+ property: string;
847
+
848
+ /**
849
+ * CSS value to assign to the property.
850
+ */
851
+ value: string;
852
+ }
853
+ }
854
+ }
855
+
856
+ export declare namespace ExperimentVariants {
857
+ export {
858
+ type ExperimentVariantListResponse as ExperimentVariantListResponse,
859
+ type ExperimentVariantCreateResponse as ExperimentVariantCreateResponse,
860
+ type ExperimentVariantRetrieveResponse as ExperimentVariantRetrieveResponse,
861
+ type ExperimentVariantUpdateResponse as ExperimentVariantUpdateResponse,
862
+ type ExperimentVariantDeleteResponse as ExperimentVariantDeleteResponse,
863
+ type ExperimentVariantListResponsesCursor as ExperimentVariantListResponsesCursor,
864
+ type ExperimentVariantListParams as ExperimentVariantListParams,
865
+ type ExperimentVariantCreateParams as ExperimentVariantCreateParams,
866
+ type ExperimentVariantUpdateParams as ExperimentVariantUpdateParams,
867
+ };
868
+ }