@oursprivacy/platform-sdk 1.42.2 → 1.44.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 (98) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/client.d.mts +14 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +14 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +12 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +12 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/audience-conversion-reports.d.mts +216 -0
  12. package/resources/audience-conversion-reports.d.mts.map +1 -0
  13. package/resources/audience-conversion-reports.d.ts +216 -0
  14. package/resources/audience-conversion-reports.d.ts.map +1 -0
  15. package/resources/audience-conversion-reports.js +55 -0
  16. package/resources/audience-conversion-reports.js.map +1 -0
  17. package/resources/audience-conversion-reports.mjs +51 -0
  18. package/resources/audience-conversion-reports.mjs.map +1 -0
  19. package/resources/conversion-journey-summaries.d.mts +169 -0
  20. package/resources/conversion-journey-summaries.d.mts.map +1 -0
  21. package/resources/conversion-journey-summaries.d.ts +169 -0
  22. package/resources/conversion-journey-summaries.d.ts.map +1 -0
  23. package/resources/conversion-journey-summaries.js +51 -0
  24. package/resources/conversion-journey-summaries.js.map +1 -0
  25. package/resources/conversion-journey-summaries.mjs +47 -0
  26. package/resources/conversion-journey-summaries.mjs.map +1 -0
  27. package/resources/destinations.d.mts +38 -17
  28. package/resources/destinations.d.mts.map +1 -1
  29. package/resources/destinations.d.ts +38 -17
  30. package/resources/destinations.d.ts.map +1 -1
  31. package/resources/experiments.d.mts +6 -4
  32. package/resources/experiments.d.mts.map +1 -1
  33. package/resources/experiments.d.ts +6 -4
  34. package/resources/experiments.d.ts.map +1 -1
  35. package/resources/experiments.js +4 -3
  36. package/resources/experiments.js.map +1 -1
  37. package/resources/experiments.mjs +4 -3
  38. package/resources/experiments.mjs.map +1 -1
  39. package/resources/funnels.d.mts +844 -21
  40. package/resources/funnels.d.mts.map +1 -1
  41. package/resources/funnels.d.ts +844 -21
  42. package/resources/funnels.d.ts.map +1 -1
  43. package/resources/funnels.js +30 -6
  44. package/resources/funnels.js.map +1 -1
  45. package/resources/funnels.mjs +30 -6
  46. package/resources/funnels.mjs.map +1 -1
  47. package/resources/index.d.mts +5 -1
  48. package/resources/index.d.mts.map +1 -1
  49. package/resources/index.d.ts +5 -1
  50. package/resources/index.d.ts.map +1 -1
  51. package/resources/index.js +9 -1
  52. package/resources/index.js.map +1 -1
  53. package/resources/index.mjs +4 -0
  54. package/resources/index.mjs.map +1 -1
  55. package/resources/versions.d.mts +40 -0
  56. package/resources/versions.d.mts.map +1 -1
  57. package/resources/versions.d.ts +40 -0
  58. package/resources/versions.d.ts.map +1 -1
  59. package/resources/video-channels.d.mts +237 -0
  60. package/resources/video-channels.d.mts.map +1 -0
  61. package/resources/video-channels.d.ts +237 -0
  62. package/resources/video-channels.d.ts.map +1 -0
  63. package/resources/video-channels.js +95 -0
  64. package/resources/video-channels.js.map +1 -0
  65. package/resources/video-channels.mjs +91 -0
  66. package/resources/video-channels.mjs.map +1 -0
  67. package/resources/videos.d.mts +251 -0
  68. package/resources/videos.d.mts.map +1 -0
  69. package/resources/videos.d.ts +251 -0
  70. package/resources/videos.d.ts.map +1 -0
  71. package/resources/videos.js +81 -0
  72. package/resources/videos.js.map +1 -0
  73. package/resources/videos.mjs +77 -0
  74. package/resources/videos.mjs.map +1 -0
  75. package/resources/web-scanners.d.mts +53 -8
  76. package/resources/web-scanners.d.mts.map +1 -1
  77. package/resources/web-scanners.d.ts +53 -8
  78. package/resources/web-scanners.d.ts.map +1 -1
  79. package/resources/web-scanners.js +9 -8
  80. package/resources/web-scanners.js.map +1 -1
  81. package/resources/web-scanners.mjs +9 -8
  82. package/resources/web-scanners.mjs.map +1 -1
  83. package/src/client.ts +146 -0
  84. package/src/resources/audience-conversion-reports.ts +466 -0
  85. package/src/resources/conversion-journey-summaries.ts +384 -0
  86. package/src/resources/destinations.ts +158 -12
  87. package/src/resources/experiments.ts +6 -4
  88. package/src/resources/funnels.ts +1400 -20
  89. package/src/resources/index.ts +67 -0
  90. package/src/resources/versions.ts +50 -0
  91. package/src/resources/video-channels.ts +405 -0
  92. package/src/resources/videos.ts +418 -0
  93. package/src/resources/web-scanners.ts +73 -8
  94. package/src/version.ts +1 -1
  95. package/version.d.mts +1 -1
  96. package/version.d.ts +1 -1
  97. package/version.js +1 -1
  98. package/version.mjs +1 -1
@@ -8,14 +8,23 @@ import { path } from '../internal/utils/path';
8
8
  export class Funnels extends APIResource {
9
9
  /**
10
10
  * List every funnel configured on this account. Each funnel includes its step
11
- * configuration, funnel type, conversion window, and current processing status.
12
- * The available report date range (if any pre-computed reports exist) is returned
13
- * in `reportDateRange`. Requires scope: web-analytics:view
11
+ * configuration, funnel type, and conversion window. Funnel results are computed
12
+ * on demand, so `status` is always `READY` and `reportDateRange` is always `null`;
13
+ * both fields are retained for backward compatibility and should not be used to
14
+ * decide whether results are available. Requires scope: web-analytics:view
14
15
  */
15
16
  list(options?: RequestOptions): APIPromise<FunnelListResponse> {
16
17
  return this._client.get('/rest/v1/funnels', options);
17
18
  }
18
19
 
20
+ /**
21
+ * Create a session-based funnel with 2 to 10 ordered event steps. Returns the
22
+ * complete saved configuration. Requires scope: web-analytics:write
23
+ */
24
+ create(body: FunnelCreateParams, options?: RequestOptions): APIPromise<FunnelCreateResponse> {
25
+ return this._client.post('/rest/v1/funnels', { body, ...options });
26
+ }
27
+
19
28
  /**
20
29
  * Fetch a single funnel configuration by its id. Returns `404` when the funnel
21
30
  * does not exist or belongs to a different account. Requires scope:
@@ -25,12 +34,30 @@ export class Funnels extends APIResource {
25
34
  return this._client.get(path`/rest/v1/funnels/${id}`, options);
26
35
  }
27
36
 
37
+ /**
38
+ * Update one or more Funnel fields. Omitted fields remain unchanged. Send `null`
39
+ * to clear an optional field. `globalLogic` and legacy `utmFilters` cannot be set
40
+ * together. Requires scope: web-analytics:write
41
+ */
42
+ update(id: string, body: FunnelUpdateParams, options?: RequestOptions): APIPromise<FunnelUpdateResponse> {
43
+ return this._client.patch(path`/rest/v1/funnels/${id}`, { body, ...options });
44
+ }
45
+
46
+ /**
47
+ * Delete a Funnel configuration. Existing analytics data is unaffected. Requires
48
+ * scope: web-analytics:write
49
+ */
50
+ delete(id: string, options?: RequestOptions): APIPromise<FunnelDeleteResponse> {
51
+ return this._client.delete(path`/rest/v1/funnels/${id}`, options);
52
+ }
53
+
28
54
  /**
29
55
  * Compute funnel step analytics for a funnel over a date window. Returns per-step
30
56
  * visitor counts, conversion rates, drop-off rates, average time to next step, and
31
- * sample session IDs for replay. Funnel results are pre-computed daily from S3;
32
- * reports outside the `reportDateRange` shown on the funnel config will return
33
- * empty steps. Requires scope: web-analytics:view
57
+ * sample session IDs for replay. Results are computed on demand from event data at
58
+ * request time, so any date window within the supported range returns current
59
+ * results. `to` must be on or after `from`, and the window may span at most 31 days
60
+ * including both endpoints. Requires scope: web-analytics:view
34
61
  */
35
62
  results(
36
63
  id: string,
@@ -70,14 +97,21 @@ export namespace FunnelListResponse {
70
97
 
71
98
  description?: string | null;
72
99
 
100
+ /**
101
+ * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
102
+ * UTM filters.
103
+ */
104
+ globalLogic?: Entity.GlobalLogic | null;
105
+
73
106
  reportDateRange?: Entity.ReportDateRange | null;
74
107
 
75
108
  stepOrder?: 'EXACT' | 'ANY' | null;
76
109
 
77
110
  /**
78
- * UTM filter object (JSON).
111
+ * Legacy exact-match UTM filters. Do not combine with globalLogic; globalLogic
112
+ * takes precedence.
79
113
  */
80
- utmFilters?: unknown;
114
+ utmFilters?: unknown | null;
81
115
 
82
116
  watched?: boolean | null;
83
117
  }
@@ -96,6 +130,100 @@ export namespace FunnelListResponse {
96
130
  * Step-level event filters (JSON object).
97
131
  */
98
132
  filters?: unknown;
133
+
134
+ /**
135
+ * Step-level event logic.
136
+ */
137
+ logic?: Step.Logic | null;
138
+ }
139
+
140
+ export namespace Step {
141
+ /**
142
+ * Step-level event logic.
143
+ */
144
+ export interface Logic {
145
+ /**
146
+ * All child nodes must match. Each child is itself a logic node (leaf `condition`
147
+ * or combinator).
148
+ */
149
+ AND?: Array<unknown> | null;
150
+
151
+ condition?: Logic.Condition;
152
+
153
+ /**
154
+ * Negates a single child logic node.
155
+ */
156
+ NOT?: unknown;
157
+
158
+ /**
159
+ * Any child node must match. Each child is itself a logic node (leaf `condition`
160
+ * or combinator).
161
+ */
162
+ OR?: Array<unknown> | null;
163
+ }
164
+
165
+ export namespace Logic {
166
+ export interface Condition {
167
+ /**
168
+ * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
169
+ * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
170
+ * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
171
+ * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
172
+ * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
173
+ * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
174
+ * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
175
+ * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
176
+ */
177
+ operator:
178
+ | 'Is'
179
+ | 'IsNot'
180
+ | 'Contains'
181
+ | 'DoesNotContain'
182
+ | 'StartsWith'
183
+ | 'EndsWith'
184
+ | 'IsFalsy'
185
+ | 'IsTruthy'
186
+ | 'IsNull'
187
+ | 'IsNotNull'
188
+ | 'IsUndefined'
189
+ | 'IsNotUndefined'
190
+ | 'IsGreaterThan'
191
+ | 'IsGreaterThanOrEqual'
192
+ | 'IsLessThan'
193
+ | 'IsLessThanOrEqual'
194
+ | 'IsIn'
195
+ | 'IsNotIn'
196
+ | 'IsFoundIn'
197
+ | 'IsNotFoundIn'
198
+ | 'IsTrue'
199
+ | 'IsFalse'
200
+ | 'IsBefore'
201
+ | 'IsAfter'
202
+ | 'IsBetween'
203
+ | 'IsOnOrBefore'
204
+ | 'IsOnOrAfter'
205
+ | 'MatchesRegex'
206
+ | 'MatchesRegexIgnoreCase'
207
+ | 'DoesNotMatchRegex'
208
+ | 'DoesNotMatchRegexIgnoreCase';
209
+
210
+ /**
211
+ * Bare dotted path into the event/visitor record. Examples: `$event.event`,
212
+ * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
213
+ * optional and stripped before lookup. Do **not** use `{{...}}` here — that
214
+ * template syntax is for mapping values (`mappings[].map`), not logic conditions,
215
+ * and would be compared as a literal string.
216
+ */
217
+ property: string;
218
+
219
+ /**
220
+ * String compared against the resolved property. Operators that take no value
221
+ * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
222
+ * `IsTrue`, `IsFalse`) ignore this field — send `""`.
223
+ */
224
+ value: string;
225
+ }
226
+ }
99
227
  }
100
228
 
101
229
  export interface ConversionWindow {
@@ -104,6 +232,94 @@ export namespace FunnelListResponse {
104
232
  value: number;
105
233
  }
106
234
 
235
+ /**
236
+ * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
237
+ * UTM filters.
238
+ */
239
+ export interface GlobalLogic {
240
+ /**
241
+ * All child nodes must match. Each child is itself a logic node (leaf `condition`
242
+ * or combinator).
243
+ */
244
+ AND?: Array<unknown> | null;
245
+
246
+ condition?: GlobalLogic.Condition;
247
+
248
+ /**
249
+ * Negates a single child logic node.
250
+ */
251
+ NOT?: unknown;
252
+
253
+ /**
254
+ * Any child node must match. Each child is itself a logic node (leaf `condition`
255
+ * or combinator).
256
+ */
257
+ OR?: Array<unknown> | null;
258
+ }
259
+
260
+ export namespace GlobalLogic {
261
+ export interface Condition {
262
+ /**
263
+ * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
264
+ * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
265
+ * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
266
+ * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
267
+ * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
268
+ * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
269
+ * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
270
+ * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
271
+ */
272
+ operator:
273
+ | 'Is'
274
+ | 'IsNot'
275
+ | 'Contains'
276
+ | 'DoesNotContain'
277
+ | 'StartsWith'
278
+ | 'EndsWith'
279
+ | 'IsFalsy'
280
+ | 'IsTruthy'
281
+ | 'IsNull'
282
+ | 'IsNotNull'
283
+ | 'IsUndefined'
284
+ | 'IsNotUndefined'
285
+ | 'IsGreaterThan'
286
+ | 'IsGreaterThanOrEqual'
287
+ | 'IsLessThan'
288
+ | 'IsLessThanOrEqual'
289
+ | 'IsIn'
290
+ | 'IsNotIn'
291
+ | 'IsFoundIn'
292
+ | 'IsNotFoundIn'
293
+ | 'IsTrue'
294
+ | 'IsFalse'
295
+ | 'IsBefore'
296
+ | 'IsAfter'
297
+ | 'IsBetween'
298
+ | 'IsOnOrBefore'
299
+ | 'IsOnOrAfter'
300
+ | 'MatchesRegex'
301
+ | 'MatchesRegexIgnoreCase'
302
+ | 'DoesNotMatchRegex'
303
+ | 'DoesNotMatchRegexIgnoreCase';
304
+
305
+ /**
306
+ * Bare dotted path into the event/visitor record. Examples: `$event.event`,
307
+ * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
308
+ * optional and stripped before lookup. Do **not** use `{{...}}` here — that
309
+ * template syntax is for mapping values (`mappings[].map`), not logic conditions,
310
+ * and would be compared as a literal string.
311
+ */
312
+ property: string;
313
+
314
+ /**
315
+ * String compared against the resolved property. Operators that take no value
316
+ * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
317
+ * `IsTrue`, `IsFalse`) ignore this field — send `""`.
318
+ */
319
+ value: string;
320
+ }
321
+ }
322
+
107
323
  export interface ReportDateRange {
108
324
  from: string;
109
325
 
@@ -112,6 +328,260 @@ export namespace FunnelListResponse {
112
328
  }
113
329
  }
114
330
 
331
+ /**
332
+ * Created funnel configuration
333
+ */
334
+ export interface FunnelCreateResponse {
335
+ createdAt: string;
336
+
337
+ funnelId: string;
338
+
339
+ funnelType: 'SESSION_BASED' | 'VISITOR_BASED';
340
+
341
+ name: string;
342
+
343
+ status: 'READY' | 'PROCESSING';
344
+
345
+ steps: Array<FunnelCreateResponse.Step>;
346
+
347
+ updatedAt: string;
348
+
349
+ conversionWindow?: FunnelCreateResponse.ConversionWindow | null;
350
+
351
+ countingMethod?: 'UNIQUES' | 'TOTALS' | 'SESSIONS' | null;
352
+
353
+ description?: string | null;
354
+
355
+ /**
356
+ * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
357
+ * UTM filters.
358
+ */
359
+ globalLogic?: FunnelCreateResponse.GlobalLogic | null;
360
+
361
+ reportDateRange?: FunnelCreateResponse.ReportDateRange | null;
362
+
363
+ stepOrder?: 'EXACT' | 'ANY' | null;
364
+
365
+ /**
366
+ * Legacy exact-match UTM filters. Do not combine with globalLogic; globalLogic
367
+ * takes precedence.
368
+ */
369
+ utmFilters?: unknown | null;
370
+
371
+ watched?: boolean | null;
372
+ }
373
+
374
+ export namespace FunnelCreateResponse {
375
+ export interface Step {
376
+ eventName: string;
377
+
378
+ name: string;
379
+
380
+ order: number;
381
+
382
+ stepId: string;
383
+
384
+ /**
385
+ * Step-level event filters (JSON object).
386
+ */
387
+ filters?: unknown;
388
+
389
+ /**
390
+ * Step-level event logic.
391
+ */
392
+ logic?: Step.Logic | null;
393
+ }
394
+
395
+ export namespace Step {
396
+ /**
397
+ * Step-level event logic.
398
+ */
399
+ export interface Logic {
400
+ /**
401
+ * All child nodes must match. Each child is itself a logic node (leaf `condition`
402
+ * or combinator).
403
+ */
404
+ AND?: Array<unknown> | null;
405
+
406
+ condition?: Logic.Condition;
407
+
408
+ /**
409
+ * Negates a single child logic node.
410
+ */
411
+ NOT?: unknown;
412
+
413
+ /**
414
+ * Any child node must match. Each child is itself a logic node (leaf `condition`
415
+ * or combinator).
416
+ */
417
+ OR?: Array<unknown> | null;
418
+ }
419
+
420
+ export namespace Logic {
421
+ export interface Condition {
422
+ /**
423
+ * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
424
+ * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
425
+ * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
426
+ * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
427
+ * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
428
+ * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
429
+ * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
430
+ * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
431
+ */
432
+ operator:
433
+ | 'Is'
434
+ | 'IsNot'
435
+ | 'Contains'
436
+ | 'DoesNotContain'
437
+ | 'StartsWith'
438
+ | 'EndsWith'
439
+ | 'IsFalsy'
440
+ | 'IsTruthy'
441
+ | 'IsNull'
442
+ | 'IsNotNull'
443
+ | 'IsUndefined'
444
+ | 'IsNotUndefined'
445
+ | 'IsGreaterThan'
446
+ | 'IsGreaterThanOrEqual'
447
+ | 'IsLessThan'
448
+ | 'IsLessThanOrEqual'
449
+ | 'IsIn'
450
+ | 'IsNotIn'
451
+ | 'IsFoundIn'
452
+ | 'IsNotFoundIn'
453
+ | 'IsTrue'
454
+ | 'IsFalse'
455
+ | 'IsBefore'
456
+ | 'IsAfter'
457
+ | 'IsBetween'
458
+ | 'IsOnOrBefore'
459
+ | 'IsOnOrAfter'
460
+ | 'MatchesRegex'
461
+ | 'MatchesRegexIgnoreCase'
462
+ | 'DoesNotMatchRegex'
463
+ | 'DoesNotMatchRegexIgnoreCase';
464
+
465
+ /**
466
+ * Bare dotted path into the event/visitor record. Examples: `$event.event`,
467
+ * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
468
+ * optional and stripped before lookup. Do **not** use `{{...}}` here — that
469
+ * template syntax is for mapping values (`mappings[].map`), not logic conditions,
470
+ * and would be compared as a literal string.
471
+ */
472
+ property: string;
473
+
474
+ /**
475
+ * String compared against the resolved property. Operators that take no value
476
+ * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
477
+ * `IsTrue`, `IsFalse`) ignore this field — send `""`.
478
+ */
479
+ value: string;
480
+ }
481
+ }
482
+ }
483
+
484
+ export interface ConversionWindow {
485
+ unit: 'MINUTES' | 'HOURS' | 'DAYS';
486
+
487
+ value: number;
488
+ }
489
+
490
+ /**
491
+ * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
492
+ * UTM filters.
493
+ */
494
+ export interface GlobalLogic {
495
+ /**
496
+ * All child nodes must match. Each child is itself a logic node (leaf `condition`
497
+ * or combinator).
498
+ */
499
+ AND?: Array<unknown> | null;
500
+
501
+ condition?: GlobalLogic.Condition;
502
+
503
+ /**
504
+ * Negates a single child logic node.
505
+ */
506
+ NOT?: unknown;
507
+
508
+ /**
509
+ * Any child node must match. Each child is itself a logic node (leaf `condition`
510
+ * or combinator).
511
+ */
512
+ OR?: Array<unknown> | null;
513
+ }
514
+
515
+ export namespace GlobalLogic {
516
+ export interface Condition {
517
+ /**
518
+ * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
519
+ * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
520
+ * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
521
+ * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
522
+ * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
523
+ * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
524
+ * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
525
+ * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
526
+ */
527
+ operator:
528
+ | 'Is'
529
+ | 'IsNot'
530
+ | 'Contains'
531
+ | 'DoesNotContain'
532
+ | 'StartsWith'
533
+ | 'EndsWith'
534
+ | 'IsFalsy'
535
+ | 'IsTruthy'
536
+ | 'IsNull'
537
+ | 'IsNotNull'
538
+ | 'IsUndefined'
539
+ | 'IsNotUndefined'
540
+ | 'IsGreaterThan'
541
+ | 'IsGreaterThanOrEqual'
542
+ | 'IsLessThan'
543
+ | 'IsLessThanOrEqual'
544
+ | 'IsIn'
545
+ | 'IsNotIn'
546
+ | 'IsFoundIn'
547
+ | 'IsNotFoundIn'
548
+ | 'IsTrue'
549
+ | 'IsFalse'
550
+ | 'IsBefore'
551
+ | 'IsAfter'
552
+ | 'IsBetween'
553
+ | 'IsOnOrBefore'
554
+ | 'IsOnOrAfter'
555
+ | 'MatchesRegex'
556
+ | 'MatchesRegexIgnoreCase'
557
+ | 'DoesNotMatchRegex'
558
+ | 'DoesNotMatchRegexIgnoreCase';
559
+
560
+ /**
561
+ * Bare dotted path into the event/visitor record. Examples: `$event.event`,
562
+ * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
563
+ * optional and stripped before lookup. Do **not** use `{{...}}` here — that
564
+ * template syntax is for mapping values (`mappings[].map`), not logic conditions,
565
+ * and would be compared as a literal string.
566
+ */
567
+ property: string;
568
+
569
+ /**
570
+ * String compared against the resolved property. Operators that take no value
571
+ * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
572
+ * `IsTrue`, `IsFalse`) ignore this field — send `""`.
573
+ */
574
+ value: string;
575
+ }
576
+ }
577
+
578
+ export interface ReportDateRange {
579
+ from: string;
580
+
581
+ to: string;
582
+ }
583
+ }
584
+
115
585
  /**
116
586
  * Funnel configuration details.
117
587
  */
@@ -136,14 +606,21 @@ export interface FunnelRetrieveResponse {
136
606
 
137
607
  description?: string | null;
138
608
 
609
+ /**
610
+ * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
611
+ * UTM filters.
612
+ */
613
+ globalLogic?: FunnelRetrieveResponse.GlobalLogic | null;
614
+
139
615
  reportDateRange?: FunnelRetrieveResponse.ReportDateRange | null;
140
616
 
141
617
  stepOrder?: 'EXACT' | 'ANY' | null;
142
618
 
143
619
  /**
144
- * UTM filter object (JSON).
620
+ * Legacy exact-match UTM filters. Do not combine with globalLogic; globalLogic
621
+ * takes precedence.
145
622
  */
146
- utmFilters?: unknown;
623
+ utmFilters?: unknown | null;
147
624
 
148
625
  watched?: boolean | null;
149
626
  }
@@ -162,6 +639,354 @@ export namespace FunnelRetrieveResponse {
162
639
  * Step-level event filters (JSON object).
163
640
  */
164
641
  filters?: unknown;
642
+
643
+ /**
644
+ * Step-level event logic.
645
+ */
646
+ logic?: Step.Logic | null;
647
+ }
648
+
649
+ export namespace Step {
650
+ /**
651
+ * Step-level event logic.
652
+ */
653
+ export interface Logic {
654
+ /**
655
+ * All child nodes must match. Each child is itself a logic node (leaf `condition`
656
+ * or combinator).
657
+ */
658
+ AND?: Array<unknown> | null;
659
+
660
+ condition?: Logic.Condition;
661
+
662
+ /**
663
+ * Negates a single child logic node.
664
+ */
665
+ NOT?: unknown;
666
+
667
+ /**
668
+ * Any child node must match. Each child is itself a logic node (leaf `condition`
669
+ * or combinator).
670
+ */
671
+ OR?: Array<unknown> | null;
672
+ }
673
+
674
+ export namespace Logic {
675
+ export interface Condition {
676
+ /**
677
+ * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
678
+ * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
679
+ * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
680
+ * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
681
+ * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
682
+ * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
683
+ * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
684
+ * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
685
+ */
686
+ operator:
687
+ | 'Is'
688
+ | 'IsNot'
689
+ | 'Contains'
690
+ | 'DoesNotContain'
691
+ | 'StartsWith'
692
+ | 'EndsWith'
693
+ | 'IsFalsy'
694
+ | 'IsTruthy'
695
+ | 'IsNull'
696
+ | 'IsNotNull'
697
+ | 'IsUndefined'
698
+ | 'IsNotUndefined'
699
+ | 'IsGreaterThan'
700
+ | 'IsGreaterThanOrEqual'
701
+ | 'IsLessThan'
702
+ | 'IsLessThanOrEqual'
703
+ | 'IsIn'
704
+ | 'IsNotIn'
705
+ | 'IsFoundIn'
706
+ | 'IsNotFoundIn'
707
+ | 'IsTrue'
708
+ | 'IsFalse'
709
+ | 'IsBefore'
710
+ | 'IsAfter'
711
+ | 'IsBetween'
712
+ | 'IsOnOrBefore'
713
+ | 'IsOnOrAfter'
714
+ | 'MatchesRegex'
715
+ | 'MatchesRegexIgnoreCase'
716
+ | 'DoesNotMatchRegex'
717
+ | 'DoesNotMatchRegexIgnoreCase';
718
+
719
+ /**
720
+ * Bare dotted path into the event/visitor record. Examples: `$event.event`,
721
+ * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
722
+ * optional and stripped before lookup. Do **not** use `{{...}}` here — that
723
+ * template syntax is for mapping values (`mappings[].map`), not logic conditions,
724
+ * and would be compared as a literal string.
725
+ */
726
+ property: string;
727
+
728
+ /**
729
+ * String compared against the resolved property. Operators that take no value
730
+ * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
731
+ * `IsTrue`, `IsFalse`) ignore this field — send `""`.
732
+ */
733
+ value: string;
734
+ }
735
+ }
736
+ }
737
+
738
+ export interface ConversionWindow {
739
+ unit: 'MINUTES' | 'HOURS' | 'DAYS';
740
+
741
+ value: number;
742
+ }
743
+
744
+ /**
745
+ * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
746
+ * UTM filters.
747
+ */
748
+ export interface GlobalLogic {
749
+ /**
750
+ * All child nodes must match. Each child is itself a logic node (leaf `condition`
751
+ * or combinator).
752
+ */
753
+ AND?: Array<unknown> | null;
754
+
755
+ condition?: GlobalLogic.Condition;
756
+
757
+ /**
758
+ * Negates a single child logic node.
759
+ */
760
+ NOT?: unknown;
761
+
762
+ /**
763
+ * Any child node must match. Each child is itself a logic node (leaf `condition`
764
+ * or combinator).
765
+ */
766
+ OR?: Array<unknown> | null;
767
+ }
768
+
769
+ export namespace GlobalLogic {
770
+ export interface Condition {
771
+ /**
772
+ * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
773
+ * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
774
+ * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
775
+ * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
776
+ * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
777
+ * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
778
+ * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
779
+ * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
780
+ */
781
+ operator:
782
+ | 'Is'
783
+ | 'IsNot'
784
+ | 'Contains'
785
+ | 'DoesNotContain'
786
+ | 'StartsWith'
787
+ | 'EndsWith'
788
+ | 'IsFalsy'
789
+ | 'IsTruthy'
790
+ | 'IsNull'
791
+ | 'IsNotNull'
792
+ | 'IsUndefined'
793
+ | 'IsNotUndefined'
794
+ | 'IsGreaterThan'
795
+ | 'IsGreaterThanOrEqual'
796
+ | 'IsLessThan'
797
+ | 'IsLessThanOrEqual'
798
+ | 'IsIn'
799
+ | 'IsNotIn'
800
+ | 'IsFoundIn'
801
+ | 'IsNotFoundIn'
802
+ | 'IsTrue'
803
+ | 'IsFalse'
804
+ | 'IsBefore'
805
+ | 'IsAfter'
806
+ | 'IsBetween'
807
+ | 'IsOnOrBefore'
808
+ | 'IsOnOrAfter'
809
+ | 'MatchesRegex'
810
+ | 'MatchesRegexIgnoreCase'
811
+ | 'DoesNotMatchRegex'
812
+ | 'DoesNotMatchRegexIgnoreCase';
813
+
814
+ /**
815
+ * Bare dotted path into the event/visitor record. Examples: `$event.event`,
816
+ * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
817
+ * optional and stripped before lookup. Do **not** use `{{...}}` here — that
818
+ * template syntax is for mapping values (`mappings[].map`), not logic conditions,
819
+ * and would be compared as a literal string.
820
+ */
821
+ property: string;
822
+
823
+ /**
824
+ * String compared against the resolved property. Operators that take no value
825
+ * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
826
+ * `IsTrue`, `IsFalse`) ignore this field — send `""`.
827
+ */
828
+ value: string;
829
+ }
830
+ }
831
+
832
+ export interface ReportDateRange {
833
+ from: string;
834
+
835
+ to: string;
836
+ }
837
+ }
838
+
839
+ /**
840
+ * Updated funnel configuration
841
+ */
842
+ export interface FunnelUpdateResponse {
843
+ createdAt: string;
844
+
845
+ funnelId: string;
846
+
847
+ funnelType: 'SESSION_BASED' | 'VISITOR_BASED';
848
+
849
+ name: string;
850
+
851
+ status: 'READY' | 'PROCESSING';
852
+
853
+ steps: Array<FunnelUpdateResponse.Step>;
854
+
855
+ updatedAt: string;
856
+
857
+ conversionWindow?: FunnelUpdateResponse.ConversionWindow | null;
858
+
859
+ countingMethod?: 'UNIQUES' | 'TOTALS' | 'SESSIONS' | null;
860
+
861
+ description?: string | null;
862
+
863
+ /**
864
+ * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
865
+ * UTM filters.
866
+ */
867
+ globalLogic?: FunnelUpdateResponse.GlobalLogic | null;
868
+
869
+ reportDateRange?: FunnelUpdateResponse.ReportDateRange | null;
870
+
871
+ stepOrder?: 'EXACT' | 'ANY' | null;
872
+
873
+ /**
874
+ * Legacy exact-match UTM filters. Do not combine with globalLogic; globalLogic
875
+ * takes precedence.
876
+ */
877
+ utmFilters?: unknown | null;
878
+
879
+ watched?: boolean | null;
880
+ }
881
+
882
+ export namespace FunnelUpdateResponse {
883
+ export interface Step {
884
+ eventName: string;
885
+
886
+ name: string;
887
+
888
+ order: number;
889
+
890
+ stepId: string;
891
+
892
+ /**
893
+ * Step-level event filters (JSON object).
894
+ */
895
+ filters?: unknown;
896
+
897
+ /**
898
+ * Step-level event logic.
899
+ */
900
+ logic?: Step.Logic | null;
901
+ }
902
+
903
+ export namespace Step {
904
+ /**
905
+ * Step-level event logic.
906
+ */
907
+ export interface Logic {
908
+ /**
909
+ * All child nodes must match. Each child is itself a logic node (leaf `condition`
910
+ * or combinator).
911
+ */
912
+ AND?: Array<unknown> | null;
913
+
914
+ condition?: Logic.Condition;
915
+
916
+ /**
917
+ * Negates a single child logic node.
918
+ */
919
+ NOT?: unknown;
920
+
921
+ /**
922
+ * Any child node must match. Each child is itself a logic node (leaf `condition`
923
+ * or combinator).
924
+ */
925
+ OR?: Array<unknown> | null;
926
+ }
927
+
928
+ export namespace Logic {
929
+ export interface Condition {
930
+ /**
931
+ * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
932
+ * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
933
+ * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
934
+ * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
935
+ * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
936
+ * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
937
+ * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
938
+ * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
939
+ */
940
+ operator:
941
+ | 'Is'
942
+ | 'IsNot'
943
+ | 'Contains'
944
+ | 'DoesNotContain'
945
+ | 'StartsWith'
946
+ | 'EndsWith'
947
+ | 'IsFalsy'
948
+ | 'IsTruthy'
949
+ | 'IsNull'
950
+ | 'IsNotNull'
951
+ | 'IsUndefined'
952
+ | 'IsNotUndefined'
953
+ | 'IsGreaterThan'
954
+ | 'IsGreaterThanOrEqual'
955
+ | 'IsLessThan'
956
+ | 'IsLessThanOrEqual'
957
+ | 'IsIn'
958
+ | 'IsNotIn'
959
+ | 'IsFoundIn'
960
+ | 'IsNotFoundIn'
961
+ | 'IsTrue'
962
+ | 'IsFalse'
963
+ | 'IsBefore'
964
+ | 'IsAfter'
965
+ | 'IsBetween'
966
+ | 'IsOnOrBefore'
967
+ | 'IsOnOrAfter'
968
+ | 'MatchesRegex'
969
+ | 'MatchesRegexIgnoreCase'
970
+ | 'DoesNotMatchRegex'
971
+ | 'DoesNotMatchRegexIgnoreCase';
972
+
973
+ /**
974
+ * Bare dotted path into the event/visitor record. Examples: `$event.event`,
975
+ * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
976
+ * optional and stripped before lookup. Do **not** use `{{...}}` here — that
977
+ * template syntax is for mapping values (`mappings[].map`), not logic conditions,
978
+ * and would be compared as a literal string.
979
+ */
980
+ property: string;
981
+
982
+ /**
983
+ * String compared against the resolved property. Operators that take no value
984
+ * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
985
+ * `IsTrue`, `IsFalse`) ignore this field — send `""`.
986
+ */
987
+ value: string;
988
+ }
989
+ }
165
990
  }
166
991
 
167
992
  export interface ConversionWindow {
@@ -170,6 +995,94 @@ export namespace FunnelRetrieveResponse {
170
995
  value: number;
171
996
  }
172
997
 
998
+ /**
999
+ * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
1000
+ * UTM filters.
1001
+ */
1002
+ export interface GlobalLogic {
1003
+ /**
1004
+ * All child nodes must match. Each child is itself a logic node (leaf `condition`
1005
+ * or combinator).
1006
+ */
1007
+ AND?: Array<unknown> | null;
1008
+
1009
+ condition?: GlobalLogic.Condition;
1010
+
1011
+ /**
1012
+ * Negates a single child logic node.
1013
+ */
1014
+ NOT?: unknown;
1015
+
1016
+ /**
1017
+ * Any child node must match. Each child is itself a logic node (leaf `condition`
1018
+ * or combinator).
1019
+ */
1020
+ OR?: Array<unknown> | null;
1021
+ }
1022
+
1023
+ export namespace GlobalLogic {
1024
+ export interface Condition {
1025
+ /**
1026
+ * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
1027
+ * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
1028
+ * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
1029
+ * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
1030
+ * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
1031
+ * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
1032
+ * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
1033
+ * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
1034
+ */
1035
+ operator:
1036
+ | 'Is'
1037
+ | 'IsNot'
1038
+ | 'Contains'
1039
+ | 'DoesNotContain'
1040
+ | 'StartsWith'
1041
+ | 'EndsWith'
1042
+ | 'IsFalsy'
1043
+ | 'IsTruthy'
1044
+ | 'IsNull'
1045
+ | 'IsNotNull'
1046
+ | 'IsUndefined'
1047
+ | 'IsNotUndefined'
1048
+ | 'IsGreaterThan'
1049
+ | 'IsGreaterThanOrEqual'
1050
+ | 'IsLessThan'
1051
+ | 'IsLessThanOrEqual'
1052
+ | 'IsIn'
1053
+ | 'IsNotIn'
1054
+ | 'IsFoundIn'
1055
+ | 'IsNotFoundIn'
1056
+ | 'IsTrue'
1057
+ | 'IsFalse'
1058
+ | 'IsBefore'
1059
+ | 'IsAfter'
1060
+ | 'IsBetween'
1061
+ | 'IsOnOrBefore'
1062
+ | 'IsOnOrAfter'
1063
+ | 'MatchesRegex'
1064
+ | 'MatchesRegexIgnoreCase'
1065
+ | 'DoesNotMatchRegex'
1066
+ | 'DoesNotMatchRegexIgnoreCase';
1067
+
1068
+ /**
1069
+ * Bare dotted path into the event/visitor record. Examples: `$event.event`,
1070
+ * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
1071
+ * optional and stripped before lookup. Do **not** use `{{...}}` here — that
1072
+ * template syntax is for mapping values (`mappings[].map`), not logic conditions,
1073
+ * and would be compared as a literal string.
1074
+ */
1075
+ property: string;
1076
+
1077
+ /**
1078
+ * String compared against the resolved property. Operators that take no value
1079
+ * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
1080
+ * `IsTrue`, `IsFalse`) ignore this field — send `""`.
1081
+ */
1082
+ value: string;
1083
+ }
1084
+ }
1085
+
173
1086
  export interface ReportDateRange {
174
1087
  from: string;
175
1088
 
@@ -177,6 +1090,12 @@ export namespace FunnelRetrieveResponse {
177
1090
  }
178
1091
  }
179
1092
 
1093
+ export interface FunnelDeleteResponse {
1094
+ deleted: true;
1095
+
1096
+ id: string;
1097
+ }
1098
+
180
1099
  export interface FunnelResultsResponse {
181
1100
  /**
182
1101
  * Conversion rate from first step to last step as a percentage.
@@ -197,6 +1116,14 @@ export interface FunnelResultsResponse {
197
1116
  * Average time from first step to last step in seconds. Null when no completions.
198
1117
  */
199
1118
  overallAvgTimeToConversion?: number | null;
1119
+
1120
+ /**
1121
+ * Present when the results are wider than the funnel as configured. Some step
1122
+ * conditions could not be expressed as a query and were ignored, so the counts
1123
+ * above include visitors those conditions would have excluded. Absent when the
1124
+ * whole definition was applied. The dashboard surfaces the same caveat.
1125
+ */
1126
+ warning?: string;
200
1127
  }
201
1128
 
202
1129
  export namespace FunnelResultsResponse {
@@ -221,56 +1148,504 @@ export namespace FunnelResultsResponse {
221
1148
  }
222
1149
  }
223
1150
 
1151
+ export interface FunnelCreateParams {
1152
+ name: string;
1153
+
1154
+ steps: Array<FunnelCreateParams.Step>;
1155
+
1156
+ conversionWindow?: unknown | null;
1157
+
1158
+ countingMethod?: string | null;
1159
+
1160
+ description?: string | null;
1161
+
1162
+ /**
1163
+ * Funnels are session-based. `SESSION_BASED` is the only supported value and is
1164
+ * applied when omitted.
1165
+ */
1166
+ funnelType?: 'SESSION_BASED';
1167
+
1168
+ /**
1169
+ * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
1170
+ * UTM filters.
1171
+ */
1172
+ globalLogic?: FunnelCreateParams.GlobalLogic | null;
1173
+
1174
+ stepOrder?: string | null;
1175
+
1176
+ /**
1177
+ * Legacy exact-match UTM filters. Do not combine with globalLogic; globalLogic
1178
+ * takes precedence.
1179
+ */
1180
+ utmFilters?: unknown | null;
1181
+
1182
+ watched?: boolean | null;
1183
+ }
1184
+
1185
+ export namespace FunnelCreateParams {
1186
+ export interface Step {
1187
+ eventName: string;
1188
+
1189
+ name: string;
1190
+
1191
+ order: number;
1192
+
1193
+ filters?: unknown | null;
1194
+
1195
+ logic?: Step.Logic | null;
1196
+ }
1197
+
1198
+ export namespace Step {
1199
+ export interface Logic {
1200
+ /**
1201
+ * All child nodes must match. Each child is itself a logic node (leaf `condition`
1202
+ * or combinator).
1203
+ */
1204
+ AND?: Array<unknown> | null;
1205
+
1206
+ condition?: Logic.Condition;
1207
+
1208
+ /**
1209
+ * Negates a single child logic node.
1210
+ */
1211
+ NOT?: unknown;
1212
+
1213
+ /**
1214
+ * Any child node must match. Each child is itself a logic node (leaf `condition`
1215
+ * or combinator).
1216
+ */
1217
+ OR?: Array<unknown> | null;
1218
+ }
1219
+
1220
+ export namespace Logic {
1221
+ export interface Condition {
1222
+ /**
1223
+ * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
1224
+ * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
1225
+ * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
1226
+ * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
1227
+ * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
1228
+ * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
1229
+ * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
1230
+ * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
1231
+ */
1232
+ operator:
1233
+ | 'Is'
1234
+ | 'IsNot'
1235
+ | 'Contains'
1236
+ | 'DoesNotContain'
1237
+ | 'StartsWith'
1238
+ | 'EndsWith'
1239
+ | 'IsFalsy'
1240
+ | 'IsTruthy'
1241
+ | 'IsNull'
1242
+ | 'IsNotNull'
1243
+ | 'IsUndefined'
1244
+ | 'IsNotUndefined'
1245
+ | 'IsGreaterThan'
1246
+ | 'IsGreaterThanOrEqual'
1247
+ | 'IsLessThan'
1248
+ | 'IsLessThanOrEqual'
1249
+ | 'IsIn'
1250
+ | 'IsNotIn'
1251
+ | 'IsFoundIn'
1252
+ | 'IsNotFoundIn'
1253
+ | 'IsTrue'
1254
+ | 'IsFalse'
1255
+ | 'IsBefore'
1256
+ | 'IsAfter'
1257
+ | 'IsBetween'
1258
+ | 'IsOnOrBefore'
1259
+ | 'IsOnOrAfter'
1260
+ | 'MatchesRegex'
1261
+ | 'MatchesRegexIgnoreCase'
1262
+ | 'DoesNotMatchRegex'
1263
+ | 'DoesNotMatchRegexIgnoreCase';
1264
+
1265
+ /**
1266
+ * Bare dotted path into the event/visitor record. Examples: `$event.event`,
1267
+ * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
1268
+ * optional and stripped before lookup. Do **not** use `{{...}}` here — that
1269
+ * template syntax is for mapping values (`mappings[].map`), not logic conditions,
1270
+ * and would be compared as a literal string.
1271
+ */
1272
+ property: string;
1273
+
1274
+ /**
1275
+ * String compared against the resolved property. Operators that take no value
1276
+ * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
1277
+ * `IsTrue`, `IsFalse`) ignore this field — send `""`.
1278
+ */
1279
+ value: string;
1280
+ }
1281
+ }
1282
+ }
1283
+
1284
+ /**
1285
+ * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
1286
+ * UTM filters.
1287
+ */
1288
+ export interface GlobalLogic {
1289
+ /**
1290
+ * All child nodes must match. Each child is itself a logic node (leaf `condition`
1291
+ * or combinator).
1292
+ */
1293
+ AND?: Array<unknown> | null;
1294
+
1295
+ condition?: GlobalLogic.Condition;
1296
+
1297
+ /**
1298
+ * Negates a single child logic node.
1299
+ */
1300
+ NOT?: unknown;
1301
+
1302
+ /**
1303
+ * Any child node must match. Each child is itself a logic node (leaf `condition`
1304
+ * or combinator).
1305
+ */
1306
+ OR?: Array<unknown> | null;
1307
+ }
1308
+
1309
+ export namespace GlobalLogic {
1310
+ export interface Condition {
1311
+ /**
1312
+ * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
1313
+ * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
1314
+ * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
1315
+ * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
1316
+ * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
1317
+ * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
1318
+ * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
1319
+ * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
1320
+ */
1321
+ operator:
1322
+ | 'Is'
1323
+ | 'IsNot'
1324
+ | 'Contains'
1325
+ | 'DoesNotContain'
1326
+ | 'StartsWith'
1327
+ | 'EndsWith'
1328
+ | 'IsFalsy'
1329
+ | 'IsTruthy'
1330
+ | 'IsNull'
1331
+ | 'IsNotNull'
1332
+ | 'IsUndefined'
1333
+ | 'IsNotUndefined'
1334
+ | 'IsGreaterThan'
1335
+ | 'IsGreaterThanOrEqual'
1336
+ | 'IsLessThan'
1337
+ | 'IsLessThanOrEqual'
1338
+ | 'IsIn'
1339
+ | 'IsNotIn'
1340
+ | 'IsFoundIn'
1341
+ | 'IsNotFoundIn'
1342
+ | 'IsTrue'
1343
+ | 'IsFalse'
1344
+ | 'IsBefore'
1345
+ | 'IsAfter'
1346
+ | 'IsBetween'
1347
+ | 'IsOnOrBefore'
1348
+ | 'IsOnOrAfter'
1349
+ | 'MatchesRegex'
1350
+ | 'MatchesRegexIgnoreCase'
1351
+ | 'DoesNotMatchRegex'
1352
+ | 'DoesNotMatchRegexIgnoreCase';
1353
+
1354
+ /**
1355
+ * Bare dotted path into the event/visitor record. Examples: `$event.event`,
1356
+ * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
1357
+ * optional and stripped before lookup. Do **not** use `{{...}}` here — that
1358
+ * template syntax is for mapping values (`mappings[].map`), not logic conditions,
1359
+ * and would be compared as a literal string.
1360
+ */
1361
+ property: string;
1362
+
1363
+ /**
1364
+ * String compared against the resolved property. Operators that take no value
1365
+ * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
1366
+ * `IsTrue`, `IsFalse`) ignore this field — send `""`.
1367
+ */
1368
+ value: string;
1369
+ }
1370
+ }
1371
+ }
1372
+
1373
+ export interface FunnelUpdateParams {
1374
+ conversionWindow?: unknown | null;
1375
+
1376
+ countingMethod?: string | null;
1377
+
1378
+ description?: string | null;
1379
+
1380
+ funnelType?: 'SESSION_BASED';
1381
+
1382
+ /**
1383
+ * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
1384
+ * UTM filters.
1385
+ */
1386
+ globalLogic?: FunnelUpdateParams.GlobalLogic | null;
1387
+
1388
+ name?: string;
1389
+
1390
+ stepOrder?: string | null;
1391
+
1392
+ steps?: Array<FunnelUpdateParams.Step>;
1393
+
1394
+ /**
1395
+ * Legacy exact-match UTM filters. Do not combine with globalLogic; globalLogic
1396
+ * takes precedence.
1397
+ */
1398
+ utmFilters?: unknown | null;
1399
+
1400
+ watched?: boolean | null;
1401
+ }
1402
+
1403
+ export namespace FunnelUpdateParams {
1404
+ /**
1405
+ * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
1406
+ * UTM filters.
1407
+ */
1408
+ export interface GlobalLogic {
1409
+ /**
1410
+ * All child nodes must match. Each child is itself a logic node (leaf `condition`
1411
+ * or combinator).
1412
+ */
1413
+ AND?: Array<unknown> | null;
1414
+
1415
+ condition?: GlobalLogic.Condition;
1416
+
1417
+ /**
1418
+ * Negates a single child logic node.
1419
+ */
1420
+ NOT?: unknown;
1421
+
1422
+ /**
1423
+ * Any child node must match. Each child is itself a logic node (leaf `condition`
1424
+ * or combinator).
1425
+ */
1426
+ OR?: Array<unknown> | null;
1427
+ }
1428
+
1429
+ export namespace GlobalLogic {
1430
+ export interface Condition {
1431
+ /**
1432
+ * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
1433
+ * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
1434
+ * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
1435
+ * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
1436
+ * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
1437
+ * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
1438
+ * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
1439
+ * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
1440
+ */
1441
+ operator:
1442
+ | 'Is'
1443
+ | 'IsNot'
1444
+ | 'Contains'
1445
+ | 'DoesNotContain'
1446
+ | 'StartsWith'
1447
+ | 'EndsWith'
1448
+ | 'IsFalsy'
1449
+ | 'IsTruthy'
1450
+ | 'IsNull'
1451
+ | 'IsNotNull'
1452
+ | 'IsUndefined'
1453
+ | 'IsNotUndefined'
1454
+ | 'IsGreaterThan'
1455
+ | 'IsGreaterThanOrEqual'
1456
+ | 'IsLessThan'
1457
+ | 'IsLessThanOrEqual'
1458
+ | 'IsIn'
1459
+ | 'IsNotIn'
1460
+ | 'IsFoundIn'
1461
+ | 'IsNotFoundIn'
1462
+ | 'IsTrue'
1463
+ | 'IsFalse'
1464
+ | 'IsBefore'
1465
+ | 'IsAfter'
1466
+ | 'IsBetween'
1467
+ | 'IsOnOrBefore'
1468
+ | 'IsOnOrAfter'
1469
+ | 'MatchesRegex'
1470
+ | 'MatchesRegexIgnoreCase'
1471
+ | 'DoesNotMatchRegex'
1472
+ | 'DoesNotMatchRegexIgnoreCase';
1473
+
1474
+ /**
1475
+ * Bare dotted path into the event/visitor record. Examples: `$event.event`,
1476
+ * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
1477
+ * optional and stripped before lookup. Do **not** use `{{...}}` here — that
1478
+ * template syntax is for mapping values (`mappings[].map`), not logic conditions,
1479
+ * and would be compared as a literal string.
1480
+ */
1481
+ property: string;
1482
+
1483
+ /**
1484
+ * String compared against the resolved property. Operators that take no value
1485
+ * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
1486
+ * `IsTrue`, `IsFalse`) ignore this field — send `""`.
1487
+ */
1488
+ value: string;
1489
+ }
1490
+ }
1491
+
1492
+ export interface Step {
1493
+ eventName: string;
1494
+
1495
+ name: string;
1496
+
1497
+ order: number;
1498
+
1499
+ filters?: unknown | null;
1500
+
1501
+ logic?: Step.Logic | null;
1502
+ }
1503
+
1504
+ export namespace Step {
1505
+ export interface Logic {
1506
+ /**
1507
+ * All child nodes must match. Each child is itself a logic node (leaf `condition`
1508
+ * or combinator).
1509
+ */
1510
+ AND?: Array<unknown> | null;
1511
+
1512
+ condition?: Logic.Condition;
1513
+
1514
+ /**
1515
+ * Negates a single child logic node.
1516
+ */
1517
+ NOT?: unknown;
1518
+
1519
+ /**
1520
+ * Any child node must match. Each child is itself a logic node (leaf `condition`
1521
+ * or combinator).
1522
+ */
1523
+ OR?: Array<unknown> | null;
1524
+ }
1525
+
1526
+ export namespace Logic {
1527
+ export interface Condition {
1528
+ /**
1529
+ * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
1530
+ * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
1531
+ * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
1532
+ * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
1533
+ * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
1534
+ * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
1535
+ * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
1536
+ * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
1537
+ */
1538
+ operator:
1539
+ | 'Is'
1540
+ | 'IsNot'
1541
+ | 'Contains'
1542
+ | 'DoesNotContain'
1543
+ | 'StartsWith'
1544
+ | 'EndsWith'
1545
+ | 'IsFalsy'
1546
+ | 'IsTruthy'
1547
+ | 'IsNull'
1548
+ | 'IsNotNull'
1549
+ | 'IsUndefined'
1550
+ | 'IsNotUndefined'
1551
+ | 'IsGreaterThan'
1552
+ | 'IsGreaterThanOrEqual'
1553
+ | 'IsLessThan'
1554
+ | 'IsLessThanOrEqual'
1555
+ | 'IsIn'
1556
+ | 'IsNotIn'
1557
+ | 'IsFoundIn'
1558
+ | 'IsNotFoundIn'
1559
+ | 'IsTrue'
1560
+ | 'IsFalse'
1561
+ | 'IsBefore'
1562
+ | 'IsAfter'
1563
+ | 'IsBetween'
1564
+ | 'IsOnOrBefore'
1565
+ | 'IsOnOrAfter'
1566
+ | 'MatchesRegex'
1567
+ | 'MatchesRegexIgnoreCase'
1568
+ | 'DoesNotMatchRegex'
1569
+ | 'DoesNotMatchRegexIgnoreCase';
1570
+
1571
+ /**
1572
+ * Bare dotted path into the event/visitor record. Examples: `$event.event`,
1573
+ * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
1574
+ * optional and stripped before lookup. Do **not** use `{{...}}` here — that
1575
+ * template syntax is for mapping values (`mappings[].map`), not logic conditions,
1576
+ * and would be compared as a literal string.
1577
+ */
1578
+ property: string;
1579
+
1580
+ /**
1581
+ * String compared against the resolved property. Operators that take no value
1582
+ * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
1583
+ * `IsTrue`, `IsFalse`) ignore this field — send `""`.
1584
+ */
1585
+ value: string;
1586
+ }
1587
+ }
1588
+ }
1589
+ }
1590
+
224
1591
  export interface FunnelResultsParams {
225
1592
  /**
226
1593
  * Inclusive lower bound of the analysis window, as a UTC calendar day in
227
- * `YYYY-MM-DD` format.
1594
+ * `YYYY-MM-DD` format. The window may span at most 31 days including both
1595
+ * endpoints.
228
1596
  */
229
1597
  from: string;
230
1598
 
231
1599
  /**
232
1600
  * Inclusive upper bound of the analysis window, as a UTC calendar day in
233
- * `YYYY-MM-DD` format.
1601
+ * `YYYY-MM-DD` format. Must be on or after `from`, and the window may span at most
1602
+ * 31 days including both endpoints.
234
1603
  */
235
1604
  to: string;
236
1605
 
237
1606
  /**
238
- * Attribution type for UTM filter matching in funnel steps.
1607
+ * Accepted for backward compatibility but NOT applied. Funnel sessions carry a
1608
+ * single attribution set, so there is no initial vs. last-touch distinction to
1609
+ * select between.
239
1610
  */
240
1611
  attributionType?: 'INITIAL' | 'LAST_TOUCH';
241
1612
 
242
1613
  /**
243
- * Filter funnel analytics to a specific device type. Defaults to `ALL`.
1614
+ * Restrict the funnel to sessions on a device class. `MOBILE` matches phone
1615
+ * sessions; `DESKTOP` matches every session that is not a phone, tablet, TV,
1616
+ * console, wearable, XR, or embedded device. `ALL` (the default) applies no device
1617
+ * filter.
244
1618
  */
245
1619
  deviceType?: 'DESKTOP' | 'MOBILE' | 'ALL';
246
1620
 
247
1621
  /**
248
- * Filter by UTM campaign.
1622
+ * Restrict the funnel to sessions whose `utm_campaign` exactly matches this value.
249
1623
  */
250
1624
  utmCampaign?: string;
251
1625
 
252
1626
  /**
253
- * Filter by UTM content.
1627
+ * Restrict the funnel to sessions whose `utm_content` exactly matches this value.
254
1628
  */
255
1629
  utmContent?: string;
256
1630
 
257
1631
  /**
258
- * Filter by UTM medium.
1632
+ * Restrict the funnel to sessions whose `utm_medium` exactly matches this value.
259
1633
  */
260
1634
  utmMedium?: string;
261
1635
 
262
1636
  /**
263
- * Filter by UTM name.
1637
+ * Accepted for backward compatibility but NOT applied — there is no campaign-name
1638
+ * dimension on funnel sessions. Use `utmCampaign` instead.
264
1639
  */
265
1640
  utmName?: string;
266
1641
 
267
1642
  /**
268
- * Filter by UTM source.
1643
+ * Restrict the funnel to sessions whose `utm_source` exactly matches this value.
269
1644
  */
270
1645
  utmSource?: string;
271
1646
 
272
1647
  /**
273
- * Filter by UTM term.
1648
+ * Restrict the funnel to sessions whose `utm_term` exactly matches this value.
274
1649
  */
275
1650
  utmTerm?: string;
276
1651
  }
@@ -278,8 +1653,13 @@ export interface FunnelResultsParams {
278
1653
  export declare namespace Funnels {
279
1654
  export {
280
1655
  type FunnelListResponse as FunnelListResponse,
1656
+ type FunnelCreateResponse as FunnelCreateResponse,
281
1657
  type FunnelRetrieveResponse as FunnelRetrieveResponse,
1658
+ type FunnelUpdateResponse as FunnelUpdateResponse,
1659
+ type FunnelDeleteResponse as FunnelDeleteResponse,
282
1660
  type FunnelResultsResponse as FunnelResultsResponse,
1661
+ type FunnelCreateParams as FunnelCreateParams,
1662
+ type FunnelUpdateParams as FunnelUpdateParams,
283
1663
  type FunnelResultsParams as FunnelResultsParams,
284
1664
  };
285
1665
  }