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