@oursprivacy/platform-sdk 1.49.0 → 1.50.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 (57) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/client.d.mts +5 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +5 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/analytics.d.mts +62 -0
  12. package/resources/analytics.d.mts.map +1 -0
  13. package/resources/analytics.d.ts +62 -0
  14. package/resources/analytics.d.ts.map +1 -0
  15. package/resources/analytics.js +25 -0
  16. package/resources/analytics.js.map +1 -0
  17. package/resources/analytics.mjs +21 -0
  18. package/resources/analytics.mjs.map +1 -0
  19. package/resources/consent-settings.d.mts +9 -0
  20. package/resources/consent-settings.d.mts.map +1 -1
  21. package/resources/consent-settings.d.ts +9 -0
  22. package/resources/consent-settings.d.ts.map +1 -1
  23. package/resources/funnels.d.mts +88 -980
  24. package/resources/funnels.d.mts.map +1 -1
  25. package/resources/funnels.d.ts +88 -980
  26. package/resources/funnels.d.ts.map +1 -1
  27. package/resources/funnels.js +24 -19
  28. package/resources/funnels.js.map +1 -1
  29. package/resources/funnels.mjs +24 -19
  30. package/resources/funnels.mjs.map +1 -1
  31. package/resources/index.d.mts +2 -1
  32. package/resources/index.d.mts.map +1 -1
  33. package/resources/index.d.ts +2 -1
  34. package/resources/index.d.ts.map +1 -1
  35. package/resources/index.js +3 -1
  36. package/resources/index.js.map +1 -1
  37. package/resources/index.mjs +1 -0
  38. package/resources/index.mjs.map +1 -1
  39. package/resources/web-scanners.d.mts +129 -1
  40. package/resources/web-scanners.d.mts.map +1 -1
  41. package/resources/web-scanners.d.ts +129 -1
  42. package/resources/web-scanners.d.ts.map +1 -1
  43. package/resources/web-scanners.js +40 -0
  44. package/resources/web-scanners.js.map +1 -1
  45. package/resources/web-scanners.mjs +40 -0
  46. package/resources/web-scanners.mjs.map +1 -1
  47. package/src/client.ts +23 -0
  48. package/src/resources/analytics.ts +98 -0
  49. package/src/resources/consent-settings.ts +16 -0
  50. package/src/resources/funnels.ts +114 -1616
  51. package/src/resources/index.ts +10 -0
  52. package/src/resources/web-scanners.ts +220 -0
  53. package/src/version.ts +1 -1
  54. package/version.d.mts +1 -1
  55. package/version.d.ts +1 -1
  56. package/version.js +1 -1
  57. package/version.mjs +1 -1
@@ -3,16 +3,18 @@ import { APIPromise } from "../core/api-promise.js";
3
3
  import { RequestOptions } from "../internal/request-options.js";
4
4
  export declare class Funnels extends APIResource {
5
5
  /**
6
- * List every funnel configured on this account. Each funnel includes its step
7
- * configuration, funnel type, and conversion window. Funnel results are computed
8
- * on demand, so `status` is always `READY` and `reportDateRange` is always `null`;
9
- * both fields are retained for backward compatibility and should not be used to
10
- * decide whether results are available. Requires scope: web-analytics:view
6
+ * List readable funnels configured on this account. Each funnel includes its
7
+ * canonical versioned definition. If some funnels cannot be loaded,
8
+ * `unavailableCount` and `warnings` identify the incomplete result; omitted
9
+ * funnels must not be treated as deleted. A complete list has
10
+ * `unavailableCount: 0` and no warnings. Funnel results are computed on demand, so
11
+ * `status` is always `READY` and `reportDateRange` is always `null`. Requires
12
+ * scope: web-analytics:view
11
13
  */
12
14
  list(options?: RequestOptions): APIPromise<FunnelListResponse>;
13
15
  /**
14
- * Create a session-based funnel with 2 to 10 ordered event steps. Returns the
15
- * complete saved configuration. Requires scope: web-analytics:write
16
+ * Create a funnel from a versioned definition. Returns the complete saved
17
+ * configuration. Requires scope: web-analytics:write
16
18
  */
17
19
  create(body: FunnelCreateParams, options?: RequestOptions): APIPromise<FunnelCreateResponse>;
18
20
  /**
@@ -22,9 +24,9 @@ export declare class Funnels extends APIResource {
22
24
  */
23
25
  retrieve(id: string, options?: RequestOptions): APIPromise<FunnelRetrieveResponse>;
24
26
  /**
25
- * Update one or more Funnel fields. Omitted fields remain unchanged. Send `null`
26
- * to clear an optional field. `globalLogic` and legacy `utmFilters` cannot be set
27
- * together. Requires scope: web-analytics:write
27
+ * Update one or more funnel fields. Omitted fields remain unchanged. The canonical
28
+ * definition can be replaced by supplying `queryDefinition`. Requires scope:
29
+ * web-analytics:write
28
30
  */
29
31
  update(id: string, body: FunnelUpdateParams, options?: RequestOptions): APIPromise<FunnelUpdateResponse>;
30
32
  /**
@@ -33,173 +35,55 @@ export declare class Funnels extends APIResource {
33
35
  */
34
36
  delete(id: string, options?: RequestOptions): APIPromise<FunnelDeleteResponse>;
35
37
  /**
36
- * Duplicate a funnel configuration in the same account. The copy keeps the funnel
37
- * steps and settings, receives a new ID, and is named `Copy of …`. Requires scope:
38
- * web-analytics:write
38
+ * Duplicate a funnel configuration in the same account. The copy keeps the
39
+ * canonical definition, receives a new ID, and is named `Copy of …`. Requires
40
+ * scope: web-analytics:write
39
41
  */
40
42
  duplicate(id: string, options?: RequestOptions): APIPromise<FunnelDuplicateResponse>;
41
43
  /**
42
- * Compute funnel step analytics for a funnel over a date window. Returns per-step
43
- * visitor counts, conversion rates, drop-off rates, average time to next step, and
44
- * sample session IDs for replay. Results are computed on demand from event data at
45
- * request time, so any date window within the supported range returns current
46
- * results. `to` must be on or after `from`, and the window may span at most 31
47
- * days including both endpoints. Requires scope: web-analytics:view
44
+ * Compute funnel step analytics from the funnel’s saved `queryDefinition` over a
45
+ * requested date window. Returns per-step visitor counts, conversion rates,
46
+ * drop-off rates, average time to next step, sample session IDs for replay, and
47
+ * the resolved entry/observation scope. Results are computed on demand from event
48
+ * data at request time; ad hoc filter, saved-scope, and web-source overrides are
49
+ * not accepted. Observation completeness is null when the source coverage
50
+ * watermark is unavailable. `to` must be on or after `from`, and the window may
51
+ * span at most 91 days including both endpoints. Requires scope:
52
+ * web-analytics:view
48
53
  */
49
54
  results(id: string, query: FunnelResultsParams, options?: RequestOptions): APIPromise<FunnelResultsResponse>;
50
55
  }
51
56
  export interface FunnelListResponse {
52
57
  /**
53
- * All funnels configured on this account.
58
+ * The readable funnels configured on this account.
54
59
  */
55
60
  entities: Array<FunnelListResponse.Entity>;
61
+ /**
62
+ * Number of funnels that could not be loaded. A positive count means the list is
63
+ * incomplete.
64
+ */
65
+ unavailableCount: number;
66
+ /**
67
+ * Warnings about incomplete results. Empty when every funnel was loaded.
68
+ */
69
+ warnings: Array<string>;
56
70
  }
57
71
  export declare namespace FunnelListResponse {
58
72
  interface Entity {
59
73
  createdAt: string;
60
74
  funnelId: string;
61
- funnelType: 'SESSION_BASED' | 'VISITOR_BASED';
62
75
  name: string;
76
+ /**
77
+ * Versioned funnel definition with typed steps and filters.
78
+ */
79
+ queryDefinition: unknown;
63
80
  status: 'READY' | 'PROCESSING';
64
- steps: Array<Entity.Step>;
65
81
  updatedAt: string;
66
- conversionWindow?: Entity.ConversionWindow | null;
67
- countingMethod?: 'UNIQUES' | 'TOTALS' | 'SESSIONS' | null;
68
82
  description?: string | null;
69
- /**
70
- * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
71
- * UTM filters.
72
- */
73
- globalLogic?: Entity.GlobalLogic | null;
74
83
  reportDateRange?: Entity.ReportDateRange | null;
75
- stepOrder?: 'EXACT' | 'ANY' | null;
76
- /**
77
- * Legacy exact-match UTM filters. Do not combine with globalLogic; globalLogic
78
- * takes precedence.
79
- */
80
- utmFilters?: unknown | null;
81
84
  watched?: boolean | null;
82
85
  }
83
86
  namespace Entity {
84
- interface Step {
85
- eventName: string;
86
- name: string;
87
- order: number;
88
- stepId: string;
89
- /**
90
- * Step-level event filters (JSON object).
91
- */
92
- filters?: unknown;
93
- /**
94
- * Step-level event logic.
95
- */
96
- logic?: Step.Logic | null;
97
- }
98
- namespace Step {
99
- /**
100
- * Step-level event logic.
101
- */
102
- interface Logic {
103
- /**
104
- * All child nodes must match. Each child is itself a logic node (leaf `condition`
105
- * or combinator).
106
- */
107
- AND?: Array<unknown> | null;
108
- condition?: Logic.Condition | null;
109
- /**
110
- * Negates a single child logic node.
111
- */
112
- NOT?: unknown;
113
- /**
114
- * Any child node must match. Each child is itself a logic node (leaf `condition`
115
- * or combinator).
116
- */
117
- OR?: Array<unknown> | null;
118
- }
119
- namespace Logic {
120
- interface Condition {
121
- /**
122
- * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
123
- * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
124
- * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
125
- * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
126
- * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
127
- * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
128
- * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
129
- * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
130
- */
131
- operator: 'Is' | 'IsNot' | 'Contains' | 'DoesNotContain' | 'StartsWith' | 'EndsWith' | 'IsFalsy' | 'IsTruthy' | 'IsNull' | 'IsNotNull' | 'IsUndefined' | 'IsNotUndefined' | 'IsGreaterThan' | 'IsGreaterThanOrEqual' | 'IsLessThan' | 'IsLessThanOrEqual' | 'IsIn' | 'IsNotIn' | 'IsFoundIn' | 'IsNotFoundIn' | 'IsTrue' | 'IsFalse' | 'IsBefore' | 'IsAfter' | 'IsBetween' | 'IsOnOrBefore' | 'IsOnOrAfter' | 'MatchesRegex' | 'MatchesRegexIgnoreCase' | 'DoesNotMatchRegex' | 'DoesNotMatchRegexIgnoreCase';
132
- /**
133
- * Bare dotted path into the event/visitor record. Examples: `$event.event`,
134
- * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
135
- * optional and stripped before lookup. Do **not** use `{{...}}` here — that
136
- * template syntax is for mapping values (`mappings[].map`), not logic conditions,
137
- * and would be compared as a literal string.
138
- */
139
- property: string;
140
- /**
141
- * String compared against the resolved property. Operators that take no value
142
- * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
143
- * `IsTrue`, `IsFalse`) ignore this field — send `""`.
144
- */
145
- value: string;
146
- }
147
- }
148
- }
149
- interface ConversionWindow {
150
- unit: 'MINUTES' | 'HOURS' | 'DAYS';
151
- value: number;
152
- }
153
- /**
154
- * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
155
- * UTM filters.
156
- */
157
- interface GlobalLogic {
158
- /**
159
- * All child nodes must match. Each child is itself a logic node (leaf `condition`
160
- * or combinator).
161
- */
162
- AND?: Array<unknown> | null;
163
- condition?: GlobalLogic.Condition | null;
164
- /**
165
- * Negates a single child logic node.
166
- */
167
- NOT?: unknown;
168
- /**
169
- * Any child node must match. Each child is itself a logic node (leaf `condition`
170
- * or combinator).
171
- */
172
- OR?: Array<unknown> | null;
173
- }
174
- namespace GlobalLogic {
175
- interface Condition {
176
- /**
177
- * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
178
- * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
179
- * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
180
- * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
181
- * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
182
- * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
183
- * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
184
- * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
185
- */
186
- operator: 'Is' | 'IsNot' | 'Contains' | 'DoesNotContain' | 'StartsWith' | 'EndsWith' | 'IsFalsy' | 'IsTruthy' | 'IsNull' | 'IsNotNull' | 'IsUndefined' | 'IsNotUndefined' | 'IsGreaterThan' | 'IsGreaterThanOrEqual' | 'IsLessThan' | 'IsLessThanOrEqual' | 'IsIn' | 'IsNotIn' | 'IsFoundIn' | 'IsNotFoundIn' | 'IsTrue' | 'IsFalse' | 'IsBefore' | 'IsAfter' | 'IsBetween' | 'IsOnOrBefore' | 'IsOnOrAfter' | 'MatchesRegex' | 'MatchesRegexIgnoreCase' | 'DoesNotMatchRegex' | 'DoesNotMatchRegexIgnoreCase';
187
- /**
188
- * Bare dotted path into the event/visitor record. Examples: `$event.event`,
189
- * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
190
- * optional and stripped before lookup. Do **not** use `{{...}}` here — that
191
- * template syntax is for mapping values (`mappings[].map`), not logic conditions,
192
- * and would be compared as a literal string.
193
- */
194
- property: string;
195
- /**
196
- * String compared against the resolved property. Operators that take no value
197
- * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
198
- * `IsTrue`, `IsFalse`) ignore this field — send `""`.
199
- */
200
- value: string;
201
- }
202
- }
203
87
  interface ReportDateRange {
204
88
  from: string;
205
89
  to: string;
@@ -209,148 +93,18 @@ export declare namespace FunnelListResponse {
209
93
  export interface FunnelCreateResponse {
210
94
  createdAt: string;
211
95
  funnelId: string;
212
- funnelType: 'SESSION_BASED' | 'VISITOR_BASED';
213
96
  name: string;
97
+ /**
98
+ * Versioned funnel definition with typed steps and filters.
99
+ */
100
+ queryDefinition: unknown;
214
101
  status: 'READY' | 'PROCESSING';
215
- steps: Array<FunnelCreateResponse.Step>;
216
102
  updatedAt: string;
217
- conversionWindow?: FunnelCreateResponse.ConversionWindow | null;
218
- countingMethod?: 'UNIQUES' | 'TOTALS' | 'SESSIONS' | null;
219
103
  description?: string | null;
220
- /**
221
- * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
222
- * UTM filters.
223
- */
224
- globalLogic?: FunnelCreateResponse.GlobalLogic | null;
225
104
  reportDateRange?: FunnelCreateResponse.ReportDateRange | null;
226
- stepOrder?: 'EXACT' | 'ANY' | null;
227
- /**
228
- * Legacy exact-match UTM filters. Do not combine with globalLogic; globalLogic
229
- * takes precedence.
230
- */
231
- utmFilters?: unknown | null;
232
105
  watched?: boolean | null;
233
106
  }
234
107
  export declare namespace FunnelCreateResponse {
235
- interface Step {
236
- eventName: string;
237
- name: string;
238
- order: number;
239
- stepId: string;
240
- /**
241
- * Step-level event filters (JSON object).
242
- */
243
- filters?: unknown;
244
- /**
245
- * Step-level event logic.
246
- */
247
- logic?: Step.Logic | null;
248
- }
249
- namespace Step {
250
- /**
251
- * Step-level event logic.
252
- */
253
- interface Logic {
254
- /**
255
- * All child nodes must match. Each child is itself a logic node (leaf `condition`
256
- * or combinator).
257
- */
258
- AND?: Array<unknown> | null;
259
- condition?: Logic.Condition | null;
260
- /**
261
- * Negates a single child logic node.
262
- */
263
- NOT?: unknown;
264
- /**
265
- * Any child node must match. Each child is itself a logic node (leaf `condition`
266
- * or combinator).
267
- */
268
- OR?: Array<unknown> | null;
269
- }
270
- namespace Logic {
271
- interface Condition {
272
- /**
273
- * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
274
- * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
275
- * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
276
- * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
277
- * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
278
- * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
279
- * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
280
- * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
281
- */
282
- operator: 'Is' | 'IsNot' | 'Contains' | 'DoesNotContain' | 'StartsWith' | 'EndsWith' | 'IsFalsy' | 'IsTruthy' | 'IsNull' | 'IsNotNull' | 'IsUndefined' | 'IsNotUndefined' | 'IsGreaterThan' | 'IsGreaterThanOrEqual' | 'IsLessThan' | 'IsLessThanOrEqual' | 'IsIn' | 'IsNotIn' | 'IsFoundIn' | 'IsNotFoundIn' | 'IsTrue' | 'IsFalse' | 'IsBefore' | 'IsAfter' | 'IsBetween' | 'IsOnOrBefore' | 'IsOnOrAfter' | 'MatchesRegex' | 'MatchesRegexIgnoreCase' | 'DoesNotMatchRegex' | 'DoesNotMatchRegexIgnoreCase';
283
- /**
284
- * Bare dotted path into the event/visitor record. Examples: `$event.event`,
285
- * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
286
- * optional and stripped before lookup. Do **not** use `{{...}}` here — that
287
- * template syntax is for mapping values (`mappings[].map`), not logic conditions,
288
- * and would be compared as a literal string.
289
- */
290
- property: string;
291
- /**
292
- * String compared against the resolved property. Operators that take no value
293
- * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
294
- * `IsTrue`, `IsFalse`) ignore this field — send `""`.
295
- */
296
- value: string;
297
- }
298
- }
299
- }
300
- interface ConversionWindow {
301
- unit: 'MINUTES' | 'HOURS' | 'DAYS';
302
- value: number;
303
- }
304
- /**
305
- * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
306
- * UTM filters.
307
- */
308
- interface GlobalLogic {
309
- /**
310
- * All child nodes must match. Each child is itself a logic node (leaf `condition`
311
- * or combinator).
312
- */
313
- AND?: Array<unknown> | null;
314
- condition?: GlobalLogic.Condition | null;
315
- /**
316
- * Negates a single child logic node.
317
- */
318
- NOT?: unknown;
319
- /**
320
- * Any child node must match. Each child is itself a logic node (leaf `condition`
321
- * or combinator).
322
- */
323
- OR?: Array<unknown> | null;
324
- }
325
- namespace GlobalLogic {
326
- interface Condition {
327
- /**
328
- * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
329
- * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
330
- * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
331
- * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
332
- * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
333
- * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
334
- * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
335
- * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
336
- */
337
- operator: 'Is' | 'IsNot' | 'Contains' | 'DoesNotContain' | 'StartsWith' | 'EndsWith' | 'IsFalsy' | 'IsTruthy' | 'IsNull' | 'IsNotNull' | 'IsUndefined' | 'IsNotUndefined' | 'IsGreaterThan' | 'IsGreaterThanOrEqual' | 'IsLessThan' | 'IsLessThanOrEqual' | 'IsIn' | 'IsNotIn' | 'IsFoundIn' | 'IsNotFoundIn' | 'IsTrue' | 'IsFalse' | 'IsBefore' | 'IsAfter' | 'IsBetween' | 'IsOnOrBefore' | 'IsOnOrAfter' | 'MatchesRegex' | 'MatchesRegexIgnoreCase' | 'DoesNotMatchRegex' | 'DoesNotMatchRegexIgnoreCase';
338
- /**
339
- * Bare dotted path into the event/visitor record. Examples: `$event.event`,
340
- * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
341
- * optional and stripped before lookup. Do **not** use `{{...}}` here — that
342
- * template syntax is for mapping values (`mappings[].map`), not logic conditions,
343
- * and would be compared as a literal string.
344
- */
345
- property: string;
346
- /**
347
- * String compared against the resolved property. Operators that take no value
348
- * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
349
- * `IsTrue`, `IsFalse`) ignore this field — send `""`.
350
- */
351
- value: string;
352
- }
353
- }
354
108
  interface ReportDateRange {
355
109
  from: string;
356
110
  to: string;
@@ -362,148 +116,18 @@ export declare namespace FunnelCreateResponse {
362
116
  export interface FunnelRetrieveResponse {
363
117
  createdAt: string;
364
118
  funnelId: string;
365
- funnelType: 'SESSION_BASED' | 'VISITOR_BASED';
366
119
  name: string;
120
+ /**
121
+ * Versioned funnel definition with typed steps and filters.
122
+ */
123
+ queryDefinition: unknown;
367
124
  status: 'READY' | 'PROCESSING';
368
- steps: Array<FunnelRetrieveResponse.Step>;
369
125
  updatedAt: string;
370
- conversionWindow?: FunnelRetrieveResponse.ConversionWindow | null;
371
- countingMethod?: 'UNIQUES' | 'TOTALS' | 'SESSIONS' | null;
372
126
  description?: string | null;
373
- /**
374
- * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
375
- * UTM filters.
376
- */
377
- globalLogic?: FunnelRetrieveResponse.GlobalLogic | null;
378
127
  reportDateRange?: FunnelRetrieveResponse.ReportDateRange | null;
379
- stepOrder?: 'EXACT' | 'ANY' | null;
380
- /**
381
- * Legacy exact-match UTM filters. Do not combine with globalLogic; globalLogic
382
- * takes precedence.
383
- */
384
- utmFilters?: unknown | null;
385
128
  watched?: boolean | null;
386
129
  }
387
130
  export declare namespace FunnelRetrieveResponse {
388
- interface Step {
389
- eventName: string;
390
- name: string;
391
- order: number;
392
- stepId: string;
393
- /**
394
- * Step-level event filters (JSON object).
395
- */
396
- filters?: unknown;
397
- /**
398
- * Step-level event logic.
399
- */
400
- logic?: Step.Logic | null;
401
- }
402
- namespace Step {
403
- /**
404
- * Step-level event logic.
405
- */
406
- interface Logic {
407
- /**
408
- * All child nodes must match. Each child is itself a logic node (leaf `condition`
409
- * or combinator).
410
- */
411
- AND?: Array<unknown> | null;
412
- condition?: Logic.Condition | null;
413
- /**
414
- * Negates a single child logic node.
415
- */
416
- NOT?: unknown;
417
- /**
418
- * Any child node must match. Each child is itself a logic node (leaf `condition`
419
- * or combinator).
420
- */
421
- OR?: Array<unknown> | null;
422
- }
423
- namespace Logic {
424
- interface Condition {
425
- /**
426
- * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
427
- * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
428
- * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
429
- * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
430
- * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
431
- * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
432
- * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
433
- * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
434
- */
435
- operator: 'Is' | 'IsNot' | 'Contains' | 'DoesNotContain' | 'StartsWith' | 'EndsWith' | 'IsFalsy' | 'IsTruthy' | 'IsNull' | 'IsNotNull' | 'IsUndefined' | 'IsNotUndefined' | 'IsGreaterThan' | 'IsGreaterThanOrEqual' | 'IsLessThan' | 'IsLessThanOrEqual' | 'IsIn' | 'IsNotIn' | 'IsFoundIn' | 'IsNotFoundIn' | 'IsTrue' | 'IsFalse' | 'IsBefore' | 'IsAfter' | 'IsBetween' | 'IsOnOrBefore' | 'IsOnOrAfter' | 'MatchesRegex' | 'MatchesRegexIgnoreCase' | 'DoesNotMatchRegex' | 'DoesNotMatchRegexIgnoreCase';
436
- /**
437
- * Bare dotted path into the event/visitor record. Examples: `$event.event`,
438
- * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
439
- * optional and stripped before lookup. Do **not** use `{{...}}` here — that
440
- * template syntax is for mapping values (`mappings[].map`), not logic conditions,
441
- * and would be compared as a literal string.
442
- */
443
- property: string;
444
- /**
445
- * String compared against the resolved property. Operators that take no value
446
- * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
447
- * `IsTrue`, `IsFalse`) ignore this field — send `""`.
448
- */
449
- value: string;
450
- }
451
- }
452
- }
453
- interface ConversionWindow {
454
- unit: 'MINUTES' | 'HOURS' | 'DAYS';
455
- value: number;
456
- }
457
- /**
458
- * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
459
- * UTM filters.
460
- */
461
- interface GlobalLogic {
462
- /**
463
- * All child nodes must match. Each child is itself a logic node (leaf `condition`
464
- * or combinator).
465
- */
466
- AND?: Array<unknown> | null;
467
- condition?: GlobalLogic.Condition | null;
468
- /**
469
- * Negates a single child logic node.
470
- */
471
- NOT?: unknown;
472
- /**
473
- * Any child node must match. Each child is itself a logic node (leaf `condition`
474
- * or combinator).
475
- */
476
- OR?: Array<unknown> | null;
477
- }
478
- namespace GlobalLogic {
479
- interface Condition {
480
- /**
481
- * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
482
- * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
483
- * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
484
- * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
485
- * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
486
- * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
487
- * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
488
- * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
489
- */
490
- operator: 'Is' | 'IsNot' | 'Contains' | 'DoesNotContain' | 'StartsWith' | 'EndsWith' | 'IsFalsy' | 'IsTruthy' | 'IsNull' | 'IsNotNull' | 'IsUndefined' | 'IsNotUndefined' | 'IsGreaterThan' | 'IsGreaterThanOrEqual' | 'IsLessThan' | 'IsLessThanOrEqual' | 'IsIn' | 'IsNotIn' | 'IsFoundIn' | 'IsNotFoundIn' | 'IsTrue' | 'IsFalse' | 'IsBefore' | 'IsAfter' | 'IsBetween' | 'IsOnOrBefore' | 'IsOnOrAfter' | 'MatchesRegex' | 'MatchesRegexIgnoreCase' | 'DoesNotMatchRegex' | 'DoesNotMatchRegexIgnoreCase';
491
- /**
492
- * Bare dotted path into the event/visitor record. Examples: `$event.event`,
493
- * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
494
- * optional and stripped before lookup. Do **not** use `{{...}}` here — that
495
- * template syntax is for mapping values (`mappings[].map`), not logic conditions,
496
- * and would be compared as a literal string.
497
- */
498
- property: string;
499
- /**
500
- * String compared against the resolved property. Operators that take no value
501
- * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
502
- * `IsTrue`, `IsFalse`) ignore this field — send `""`.
503
- */
504
- value: string;
505
- }
506
- }
507
131
  interface ReportDateRange {
508
132
  from: string;
509
133
  to: string;
@@ -512,148 +136,18 @@ export declare namespace FunnelRetrieveResponse {
512
136
  export interface FunnelUpdateResponse {
513
137
  createdAt: string;
514
138
  funnelId: string;
515
- funnelType: 'SESSION_BASED' | 'VISITOR_BASED';
516
139
  name: string;
140
+ /**
141
+ * Versioned funnel definition with typed steps and filters.
142
+ */
143
+ queryDefinition: unknown;
517
144
  status: 'READY' | 'PROCESSING';
518
- steps: Array<FunnelUpdateResponse.Step>;
519
145
  updatedAt: string;
520
- conversionWindow?: FunnelUpdateResponse.ConversionWindow | null;
521
- countingMethod?: 'UNIQUES' | 'TOTALS' | 'SESSIONS' | null;
522
146
  description?: string | null;
523
- /**
524
- * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
525
- * UTM filters.
526
- */
527
- globalLogic?: FunnelUpdateResponse.GlobalLogic | null;
528
147
  reportDateRange?: FunnelUpdateResponse.ReportDateRange | null;
529
- stepOrder?: 'EXACT' | 'ANY' | null;
530
- /**
531
- * Legacy exact-match UTM filters. Do not combine with globalLogic; globalLogic
532
- * takes precedence.
533
- */
534
- utmFilters?: unknown | null;
535
148
  watched?: boolean | null;
536
149
  }
537
150
  export declare namespace FunnelUpdateResponse {
538
- interface Step {
539
- eventName: string;
540
- name: string;
541
- order: number;
542
- stepId: string;
543
- /**
544
- * Step-level event filters (JSON object).
545
- */
546
- filters?: unknown;
547
- /**
548
- * Step-level event logic.
549
- */
550
- logic?: Step.Logic | null;
551
- }
552
- namespace Step {
553
- /**
554
- * Step-level event logic.
555
- */
556
- interface Logic {
557
- /**
558
- * All child nodes must match. Each child is itself a logic node (leaf `condition`
559
- * or combinator).
560
- */
561
- AND?: Array<unknown> | null;
562
- condition?: Logic.Condition | null;
563
- /**
564
- * Negates a single child logic node.
565
- */
566
- NOT?: unknown;
567
- /**
568
- * Any child node must match. Each child is itself a logic node (leaf `condition`
569
- * or combinator).
570
- */
571
- OR?: Array<unknown> | null;
572
- }
573
- namespace Logic {
574
- interface Condition {
575
- /**
576
- * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
577
- * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
578
- * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
579
- * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
580
- * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
581
- * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
582
- * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
583
- * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
584
- */
585
- operator: 'Is' | 'IsNot' | 'Contains' | 'DoesNotContain' | 'StartsWith' | 'EndsWith' | 'IsFalsy' | 'IsTruthy' | 'IsNull' | 'IsNotNull' | 'IsUndefined' | 'IsNotUndefined' | 'IsGreaterThan' | 'IsGreaterThanOrEqual' | 'IsLessThan' | 'IsLessThanOrEqual' | 'IsIn' | 'IsNotIn' | 'IsFoundIn' | 'IsNotFoundIn' | 'IsTrue' | 'IsFalse' | 'IsBefore' | 'IsAfter' | 'IsBetween' | 'IsOnOrBefore' | 'IsOnOrAfter' | 'MatchesRegex' | 'MatchesRegexIgnoreCase' | 'DoesNotMatchRegex' | 'DoesNotMatchRegexIgnoreCase';
586
- /**
587
- * Bare dotted path into the event/visitor record. Examples: `$event.event`,
588
- * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
589
- * optional and stripped before lookup. Do **not** use `{{...}}` here — that
590
- * template syntax is for mapping values (`mappings[].map`), not logic conditions,
591
- * and would be compared as a literal string.
592
- */
593
- property: string;
594
- /**
595
- * String compared against the resolved property. Operators that take no value
596
- * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
597
- * `IsTrue`, `IsFalse`) ignore this field — send `""`.
598
- */
599
- value: string;
600
- }
601
- }
602
- }
603
- interface ConversionWindow {
604
- unit: 'MINUTES' | 'HOURS' | 'DAYS';
605
- value: number;
606
- }
607
- /**
608
- * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
609
- * UTM filters.
610
- */
611
- interface GlobalLogic {
612
- /**
613
- * All child nodes must match. Each child is itself a logic node (leaf `condition`
614
- * or combinator).
615
- */
616
- AND?: Array<unknown> | null;
617
- condition?: GlobalLogic.Condition | null;
618
- /**
619
- * Negates a single child logic node.
620
- */
621
- NOT?: unknown;
622
- /**
623
- * Any child node must match. Each child is itself a logic node (leaf `condition`
624
- * or combinator).
625
- */
626
- OR?: Array<unknown> | null;
627
- }
628
- namespace GlobalLogic {
629
- interface Condition {
630
- /**
631
- * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
632
- * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
633
- * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
634
- * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
635
- * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
636
- * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
637
- * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
638
- * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
639
- */
640
- operator: 'Is' | 'IsNot' | 'Contains' | 'DoesNotContain' | 'StartsWith' | 'EndsWith' | 'IsFalsy' | 'IsTruthy' | 'IsNull' | 'IsNotNull' | 'IsUndefined' | 'IsNotUndefined' | 'IsGreaterThan' | 'IsGreaterThanOrEqual' | 'IsLessThan' | 'IsLessThanOrEqual' | 'IsIn' | 'IsNotIn' | 'IsFoundIn' | 'IsNotFoundIn' | 'IsTrue' | 'IsFalse' | 'IsBefore' | 'IsAfter' | 'IsBetween' | 'IsOnOrBefore' | 'IsOnOrAfter' | 'MatchesRegex' | 'MatchesRegexIgnoreCase' | 'DoesNotMatchRegex' | 'DoesNotMatchRegexIgnoreCase';
641
- /**
642
- * Bare dotted path into the event/visitor record. Examples: `$event.event`,
643
- * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
644
- * optional and stripped before lookup. Do **not** use `{{...}}` here — that
645
- * template syntax is for mapping values (`mappings[].map`), not logic conditions,
646
- * and would be compared as a literal string.
647
- */
648
- property: string;
649
- /**
650
- * String compared against the resolved property. Operators that take no value
651
- * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
652
- * `IsTrue`, `IsFalse`) ignore this field — send `""`.
653
- */
654
- value: string;
655
- }
656
- }
657
151
  interface ReportDateRange {
658
152
  from: string;
659
153
  to: string;
@@ -666,158 +160,38 @@ export interface FunnelDeleteResponse {
666
160
  export interface FunnelDuplicateResponse {
667
161
  createdAt: string;
668
162
  funnelId: string;
669
- funnelType: 'SESSION_BASED' | 'VISITOR_BASED';
670
163
  name: string;
164
+ /**
165
+ * Versioned funnel definition with typed steps and filters.
166
+ */
167
+ queryDefinition: unknown;
671
168
  status: 'READY' | 'PROCESSING';
672
- steps: Array<FunnelDuplicateResponse.Step>;
673
169
  updatedAt: string;
674
- conversionWindow?: FunnelDuplicateResponse.ConversionWindow | null;
675
- countingMethod?: 'UNIQUES' | 'TOTALS' | 'SESSIONS' | null;
676
170
  description?: string | null;
677
- /**
678
- * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
679
- * UTM filters.
680
- */
681
- globalLogic?: FunnelDuplicateResponse.GlobalLogic | null;
682
171
  reportDateRange?: FunnelDuplicateResponse.ReportDateRange | null;
683
- stepOrder?: 'EXACT' | 'ANY' | null;
684
- /**
685
- * Legacy exact-match UTM filters. Do not combine with globalLogic; globalLogic
686
- * takes precedence.
687
- */
688
- utmFilters?: unknown | null;
689
172
  watched?: boolean | null;
690
173
  }
691
174
  export declare namespace FunnelDuplicateResponse {
692
- interface Step {
693
- eventName: string;
694
- name: string;
695
- order: number;
696
- stepId: string;
697
- /**
698
- * Step-level event filters (JSON object).
699
- */
700
- filters?: unknown;
701
- /**
702
- * Step-level event logic.
703
- */
704
- logic?: Step.Logic | null;
705
- }
706
- namespace Step {
707
- /**
708
- * Step-level event logic.
709
- */
710
- interface Logic {
711
- /**
712
- * All child nodes must match. Each child is itself a logic node (leaf `condition`
713
- * or combinator).
714
- */
715
- AND?: Array<unknown> | null;
716
- condition?: Logic.Condition | null;
717
- /**
718
- * Negates a single child logic node.
719
- */
720
- NOT?: unknown;
721
- /**
722
- * Any child node must match. Each child is itself a logic node (leaf `condition`
723
- * or combinator).
724
- */
725
- OR?: Array<unknown> | null;
726
- }
727
- namespace Logic {
728
- interface Condition {
729
- /**
730
- * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
731
- * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
732
- * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
733
- * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
734
- * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
735
- * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
736
- * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
737
- * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
738
- */
739
- operator: 'Is' | 'IsNot' | 'Contains' | 'DoesNotContain' | 'StartsWith' | 'EndsWith' | 'IsFalsy' | 'IsTruthy' | 'IsNull' | 'IsNotNull' | 'IsUndefined' | 'IsNotUndefined' | 'IsGreaterThan' | 'IsGreaterThanOrEqual' | 'IsLessThan' | 'IsLessThanOrEqual' | 'IsIn' | 'IsNotIn' | 'IsFoundIn' | 'IsNotFoundIn' | 'IsTrue' | 'IsFalse' | 'IsBefore' | 'IsAfter' | 'IsBetween' | 'IsOnOrBefore' | 'IsOnOrAfter' | 'MatchesRegex' | 'MatchesRegexIgnoreCase' | 'DoesNotMatchRegex' | 'DoesNotMatchRegexIgnoreCase';
740
- /**
741
- * Bare dotted path into the event/visitor record. Examples: `$event.event`,
742
- * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
743
- * optional and stripped before lookup. Do **not** use `{{...}}` here — that
744
- * template syntax is for mapping values (`mappings[].map`), not logic conditions,
745
- * and would be compared as a literal string.
746
- */
747
- property: string;
748
- /**
749
- * String compared against the resolved property. Operators that take no value
750
- * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
751
- * `IsTrue`, `IsFalse`) ignore this field — send `""`.
752
- */
753
- value: string;
754
- }
755
- }
756
- }
757
- interface ConversionWindow {
758
- unit: 'MINUTES' | 'HOURS' | 'DAYS';
759
- value: number;
760
- }
761
- /**
762
- * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
763
- * UTM filters.
764
- */
765
- interface GlobalLogic {
766
- /**
767
- * All child nodes must match. Each child is itself a logic node (leaf `condition`
768
- * or combinator).
769
- */
770
- AND?: Array<unknown> | null;
771
- condition?: GlobalLogic.Condition | null;
772
- /**
773
- * Negates a single child logic node.
774
- */
775
- NOT?: unknown;
776
- /**
777
- * Any child node must match. Each child is itself a logic node (leaf `condition`
778
- * or combinator).
779
- */
780
- OR?: Array<unknown> | null;
781
- }
782
- namespace GlobalLogic {
783
- interface Condition {
784
- /**
785
- * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
786
- * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
787
- * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
788
- * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
789
- * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
790
- * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
791
- * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
792
- * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
793
- */
794
- operator: 'Is' | 'IsNot' | 'Contains' | 'DoesNotContain' | 'StartsWith' | 'EndsWith' | 'IsFalsy' | 'IsTruthy' | 'IsNull' | 'IsNotNull' | 'IsUndefined' | 'IsNotUndefined' | 'IsGreaterThan' | 'IsGreaterThanOrEqual' | 'IsLessThan' | 'IsLessThanOrEqual' | 'IsIn' | 'IsNotIn' | 'IsFoundIn' | 'IsNotFoundIn' | 'IsTrue' | 'IsFalse' | 'IsBefore' | 'IsAfter' | 'IsBetween' | 'IsOnOrBefore' | 'IsOnOrAfter' | 'MatchesRegex' | 'MatchesRegexIgnoreCase' | 'DoesNotMatchRegex' | 'DoesNotMatchRegexIgnoreCase';
795
- /**
796
- * Bare dotted path into the event/visitor record. Examples: `$event.event`,
797
- * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
798
- * optional and stripped before lookup. Do **not** use `{{...}}` here — that
799
- * template syntax is for mapping values (`mappings[].map`), not logic conditions,
800
- * and would be compared as a literal string.
801
- */
802
- property: string;
803
- /**
804
- * String compared against the resolved property. Operators that take no value
805
- * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
806
- * `IsTrue`, `IsFalse`) ignore this field — send `""`.
807
- */
808
- value: string;
809
- }
810
- }
811
175
  interface ReportDateRange {
812
176
  from: string;
813
177
  to: string;
814
178
  }
815
179
  }
816
180
  export interface FunnelResultsResponse {
181
+ definitionUpdatedAt: string;
182
+ engine: string;
817
183
  /**
818
184
  * Conversion rate from first step to last step as a percentage.
819
185
  */
820
186
  overallConversionRate: number;
187
+ scope: FunnelResultsResponse.Scope;
188
+ semanticVersion: 1;
189
+ /**
190
+ * Known Events v3 source limitations: equal-load conflicts, corrections that move
191
+ * across physical keys, and source completeness are unverified.
192
+ */
193
+ sourceLimitations: Array<'equal-load-conflicts-unverified' | 'cross-key-corrections-unverified' | 'source-completeness-unverified'>;
194
+ sourcePolicy: 'events-v3-physical-key';
821
195
  /**
822
196
  * Per-step funnel analytics, ordered by step number.
823
197
  */
@@ -830,336 +204,70 @@ export interface FunnelResultsResponse {
830
204
  * Average time from first step to last step in seconds. Null when no completions.
831
205
  */
832
206
  overallAvgTimeToConversion?: number | null;
833
- /**
834
- * Present when the results are wider than the funnel as configured. Some step
835
- * conditions could not be expressed as a query and were ignored, so the counts
836
- * above include visitors those conditions would have excluded. Absent when the
837
- * whole definition was applied. The dashboard surfaces the same caveat.
838
- */
839
- warning?: string;
207
+ sourceRevision?: string | null;
840
208
  }
841
209
  export declare namespace FunnelResultsResponse {
210
+ interface Scope {
211
+ entryFrom: string;
212
+ entryTo: string;
213
+ observationFrom: string;
214
+ observationTo: string;
215
+ timezone: 'UTC';
216
+ windowMs: number;
217
+ observationComplete?: boolean | null;
218
+ settledEntryTo?: string | null;
219
+ watermark?: string | null;
220
+ }
842
221
  interface Step {
843
222
  conversionCount: number;
844
223
  conversionRate: number;
845
224
  dropOffRate: number;
846
225
  dropOffSessionIds: Array<string>;
226
+ dropOffVisitorIds: Array<string>;
847
227
  overallConversionRate: number;
848
228
  sessionIds: Array<string>;
849
229
  stepNumber: number;
850
230
  visitorCount: number;
231
+ visitorIds: Array<string>;
851
232
  avgTimeToNextStep?: number | null;
852
233
  }
853
234
  }
854
235
  export interface FunnelCreateParams {
855
236
  name: string;
856
- steps: Array<FunnelCreateParams.Step>;
857
- conversionWindow?: unknown | null;
858
- countingMethod?: string | null;
859
- description?: string | null;
860
237
  /**
861
- * Funnels are session-based. `SESSION_BASED` is the only supported value and is
862
- * applied when omitted.
238
+ * Versioned funnel definition with typed steps and filters.
863
239
  */
864
- funnelType?: 'SESSION_BASED';
865
- /**
866
- * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
867
- * UTM filters.
868
- */
869
- globalLogic?: FunnelCreateParams.GlobalLogic | null;
870
- stepOrder?: string | null;
871
- /**
872
- * Legacy exact-match UTM filters. Do not combine with globalLogic; globalLogic
873
- * takes precedence.
874
- */
875
- utmFilters?: unknown | null;
240
+ queryDefinition: unknown;
241
+ description?: string | null;
876
242
  watched?: boolean | null;
877
243
  }
878
- export declare namespace FunnelCreateParams {
879
- interface Step {
880
- eventName: string;
881
- name: string;
882
- order: number;
883
- filters?: unknown | null;
884
- logic?: Step.Logic | null;
885
- }
886
- namespace Step {
887
- interface Logic {
888
- /**
889
- * All child nodes must match. Each child is itself a logic node (leaf `condition`
890
- * or combinator).
891
- */
892
- AND?: Array<unknown> | null;
893
- condition?: Logic.Condition | null;
894
- /**
895
- * Negates a single child logic node.
896
- */
897
- NOT?: unknown;
898
- /**
899
- * Any child node must match. Each child is itself a logic node (leaf `condition`
900
- * or combinator).
901
- */
902
- OR?: Array<unknown> | null;
903
- }
904
- namespace Logic {
905
- interface Condition {
906
- /**
907
- * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
908
- * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
909
- * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
910
- * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
911
- * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
912
- * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
913
- * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
914
- * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
915
- */
916
- operator: 'Is' | 'IsNot' | 'Contains' | 'DoesNotContain' | 'StartsWith' | 'EndsWith' | 'IsFalsy' | 'IsTruthy' | 'IsNull' | 'IsNotNull' | 'IsUndefined' | 'IsNotUndefined' | 'IsGreaterThan' | 'IsGreaterThanOrEqual' | 'IsLessThan' | 'IsLessThanOrEqual' | 'IsIn' | 'IsNotIn' | 'IsFoundIn' | 'IsNotFoundIn' | 'IsTrue' | 'IsFalse' | 'IsBefore' | 'IsAfter' | 'IsBetween' | 'IsOnOrBefore' | 'IsOnOrAfter' | 'MatchesRegex' | 'MatchesRegexIgnoreCase' | 'DoesNotMatchRegex' | 'DoesNotMatchRegexIgnoreCase';
917
- /**
918
- * Bare dotted path into the event/visitor record. Examples: `$event.event`,
919
- * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
920
- * optional and stripped before lookup. Do **not** use `{{...}}` here — that
921
- * template syntax is for mapping values (`mappings[].map`), not logic conditions,
922
- * and would be compared as a literal string.
923
- */
924
- property: string;
925
- /**
926
- * String compared against the resolved property. Operators that take no value
927
- * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
928
- * `IsTrue`, `IsFalse`) ignore this field — send `""`.
929
- */
930
- value: string;
931
- }
932
- }
933
- }
934
- /**
935
- * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
936
- * UTM filters.
937
- */
938
- interface GlobalLogic {
939
- /**
940
- * All child nodes must match. Each child is itself a logic node (leaf `condition`
941
- * or combinator).
942
- */
943
- AND?: Array<unknown> | null;
944
- condition?: GlobalLogic.Condition | null;
945
- /**
946
- * Negates a single child logic node.
947
- */
948
- NOT?: unknown;
949
- /**
950
- * Any child node must match. Each child is itself a logic node (leaf `condition`
951
- * or combinator).
952
- */
953
- OR?: Array<unknown> | null;
954
- }
955
- namespace GlobalLogic {
956
- interface Condition {
957
- /**
958
- * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
959
- * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
960
- * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
961
- * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
962
- * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
963
- * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
964
- * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
965
- * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
966
- */
967
- operator: 'Is' | 'IsNot' | 'Contains' | 'DoesNotContain' | 'StartsWith' | 'EndsWith' | 'IsFalsy' | 'IsTruthy' | 'IsNull' | 'IsNotNull' | 'IsUndefined' | 'IsNotUndefined' | 'IsGreaterThan' | 'IsGreaterThanOrEqual' | 'IsLessThan' | 'IsLessThanOrEqual' | 'IsIn' | 'IsNotIn' | 'IsFoundIn' | 'IsNotFoundIn' | 'IsTrue' | 'IsFalse' | 'IsBefore' | 'IsAfter' | 'IsBetween' | 'IsOnOrBefore' | 'IsOnOrAfter' | 'MatchesRegex' | 'MatchesRegexIgnoreCase' | 'DoesNotMatchRegex' | 'DoesNotMatchRegexIgnoreCase';
968
- /**
969
- * Bare dotted path into the event/visitor record. Examples: `$event.event`,
970
- * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
971
- * optional and stripped before lookup. Do **not** use `{{...}}` here — that
972
- * template syntax is for mapping values (`mappings[].map`), not logic conditions,
973
- * and would be compared as a literal string.
974
- */
975
- property: string;
976
- /**
977
- * String compared against the resolved property. Operators that take no value
978
- * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
979
- * `IsTrue`, `IsFalse`) ignore this field — send `""`.
980
- */
981
- value: string;
982
- }
983
- }
984
- }
985
244
  export interface FunnelUpdateParams {
986
- conversionWindow?: unknown | null;
987
- countingMethod?: string | null;
988
245
  description?: string | null;
989
- funnelType?: 'SESSION_BASED';
990
- /**
991
- * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
992
- * UTM filters.
993
- */
994
- globalLogic?: FunnelUpdateParams.GlobalLogic | null;
995
246
  name?: string;
996
- stepOrder?: string | null;
997
- steps?: Array<FunnelUpdateParams.Step>;
998
247
  /**
999
- * Legacy exact-match UTM filters. Do not combine with globalLogic; globalLogic
1000
- * takes precedence.
248
+ * Versioned funnel definition with typed steps and filters.
1001
249
  */
1002
- utmFilters?: unknown | null;
250
+ queryDefinition?: unknown;
1003
251
  watched?: boolean | null;
1004
252
  }
1005
- export declare namespace FunnelUpdateParams {
1006
- /**
1007
- * Nested visitor logic for the entire funnel. When supplied, this replaces legacy
1008
- * UTM filters.
1009
- */
1010
- interface GlobalLogic {
1011
- /**
1012
- * All child nodes must match. Each child is itself a logic node (leaf `condition`
1013
- * or combinator).
1014
- */
1015
- AND?: Array<unknown> | null;
1016
- condition?: GlobalLogic.Condition | null;
1017
- /**
1018
- * Negates a single child logic node.
1019
- */
1020
- NOT?: unknown;
1021
- /**
1022
- * Any child node must match. Each child is itself a logic node (leaf `condition`
1023
- * or combinator).
1024
- */
1025
- OR?: Array<unknown> | null;
1026
- }
1027
- namespace GlobalLogic {
1028
- interface Condition {
1029
- /**
1030
- * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
1031
- * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
1032
- * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
1033
- * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
1034
- * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
1035
- * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
1036
- * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
1037
- * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
1038
- */
1039
- operator: 'Is' | 'IsNot' | 'Contains' | 'DoesNotContain' | 'StartsWith' | 'EndsWith' | 'IsFalsy' | 'IsTruthy' | 'IsNull' | 'IsNotNull' | 'IsUndefined' | 'IsNotUndefined' | 'IsGreaterThan' | 'IsGreaterThanOrEqual' | 'IsLessThan' | 'IsLessThanOrEqual' | 'IsIn' | 'IsNotIn' | 'IsFoundIn' | 'IsNotFoundIn' | 'IsTrue' | 'IsFalse' | 'IsBefore' | 'IsAfter' | 'IsBetween' | 'IsOnOrBefore' | 'IsOnOrAfter' | 'MatchesRegex' | 'MatchesRegexIgnoreCase' | 'DoesNotMatchRegex' | 'DoesNotMatchRegexIgnoreCase';
1040
- /**
1041
- * Bare dotted path into the event/visitor record. Examples: `$event.event`,
1042
- * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
1043
- * optional and stripped before lookup. Do **not** use `{{...}}` here — that
1044
- * template syntax is for mapping values (`mappings[].map`), not logic conditions,
1045
- * and would be compared as a literal string.
1046
- */
1047
- property: string;
1048
- /**
1049
- * String compared against the resolved property. Operators that take no value
1050
- * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
1051
- * `IsTrue`, `IsFalse`) ignore this field — send `""`.
1052
- */
1053
- value: string;
1054
- }
1055
- }
1056
- interface Step {
1057
- eventName: string;
1058
- name: string;
1059
- order: number;
1060
- filters?: unknown | null;
1061
- logic?: Step.Logic | null;
1062
- }
1063
- namespace Step {
1064
- interface Logic {
1065
- /**
1066
- * All child nodes must match. Each child is itself a logic node (leaf `condition`
1067
- * or combinator).
1068
- */
1069
- AND?: Array<unknown> | null;
1070
- condition?: Logic.Condition | null;
1071
- /**
1072
- * Negates a single child logic node.
1073
- */
1074
- NOT?: unknown;
1075
- /**
1076
- * Any child node must match. Each child is itself a logic node (leaf `condition`
1077
- * or combinator).
1078
- */
1079
- OR?: Array<unknown> | null;
1080
- }
1081
- namespace Logic {
1082
- interface Condition {
1083
- /**
1084
- * Comparison verb in PascalCase. Equality/text: `Is`, `IsNot`, `Contains`,
1085
- * `DoesNotContain`, `StartsWith`, `EndsWith`. Truthiness/nullability: `IsFalsy`,
1086
- * `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`, `IsTrue`,
1087
- * `IsFalse`. Numeric: `IsGreaterThan`, `IsGreaterThanOrEqual`, `IsLessThan`,
1088
- * `IsLessThanOrEqual`. Set membership: `IsIn`, `IsNotIn`, `IsFoundIn`,
1089
- * `IsNotFoundIn`. Date: `IsBefore`, `IsAfter`, `IsBetween`, `IsOnOrBefore`,
1090
- * `IsOnOrAfter`. Regex: `MatchesRegex`, `MatchesRegexIgnoreCase`,
1091
- * `DoesNotMatchRegex`, `DoesNotMatchRegexIgnoreCase`.
1092
- */
1093
- operator: 'Is' | 'IsNot' | 'Contains' | 'DoesNotContain' | 'StartsWith' | 'EndsWith' | 'IsFalsy' | 'IsTruthy' | 'IsNull' | 'IsNotNull' | 'IsUndefined' | 'IsNotUndefined' | 'IsGreaterThan' | 'IsGreaterThanOrEqual' | 'IsLessThan' | 'IsLessThanOrEqual' | 'IsIn' | 'IsNotIn' | 'IsFoundIn' | 'IsNotFoundIn' | 'IsTrue' | 'IsFalse' | 'IsBefore' | 'IsAfter' | 'IsBetween' | 'IsOnOrBefore' | 'IsOnOrAfter' | 'MatchesRegex' | 'MatchesRegexIgnoreCase' | 'DoesNotMatchRegex' | 'DoesNotMatchRegexIgnoreCase';
1094
- /**
1095
- * Bare dotted path into the event/visitor record. Examples: `$event.event`,
1096
- * `$event.event_properties.value`, `visitor.consent.marketing`. The leading `$` is
1097
- * optional and stripped before lookup. Do **not** use `{{...}}` here — that
1098
- * template syntax is for mapping values (`mappings[].map`), not logic conditions,
1099
- * and would be compared as a literal string.
1100
- */
1101
- property: string;
1102
- /**
1103
- * String compared against the resolved property. Operators that take no value
1104
- * (`IsFalsy`, `IsTruthy`, `IsNull`, `IsNotNull`, `IsUndefined`, `IsNotUndefined`,
1105
- * `IsTrue`, `IsFalse`) ignore this field — send `""`.
1106
- */
1107
- value: string;
1108
- }
1109
- }
1110
- }
1111
- }
1112
253
  export interface FunnelResultsParams {
1113
254
  /**
1114
255
  * Inclusive lower bound of the analysis window, as a UTC calendar day in
1115
- * `YYYY-MM-DD` format. The window may span at most 31 days including both
256
+ * `YYYY-MM-DD` format. The window may span at most 91 days including both
1116
257
  * endpoints.
1117
258
  */
1118
259
  from: string;
1119
260
  /**
1120
261
  * Inclusive upper bound of the analysis window, as a UTC calendar day in
1121
262
  * `YYYY-MM-DD` format. Must be on or after `from`, and the window may span at most
1122
- * 31 days including both endpoints.
263
+ * 91 days including both endpoints.
1123
264
  */
1124
265
  to: string;
1125
266
  /**
1126
- * Accepted for backward compatibility but NOT applied. Funnel sessions carry a
1127
- * single attribution set, so there is no initial vs. last-touch distinction to
1128
- * select between.
1129
- */
1130
- attributionType?: 'INITIAL' | 'LAST_TOUCH';
1131
- /**
1132
- * Restrict the funnel to sessions on a device class. `MOBILE` matches phone
1133
- * sessions; `DESKTOP` matches every session that is not a phone, tablet, TV,
1134
- * console, wearable, XR, or embedded device. `ALL` (the default) applies no device
1135
- * filter.
1136
- */
1137
- deviceType?: 'DESKTOP' | 'MOBILE' | 'ALL';
1138
- /**
1139
- * Restrict the funnel to sessions whose `utm_campaign` exactly matches this value.
1140
- */
1141
- utmCampaign?: string;
1142
- /**
1143
- * Restrict the funnel to sessions whose `utm_content` exactly matches this value.
1144
- */
1145
- utmContent?: string;
1146
- /**
1147
- * Restrict the funnel to sessions whose `utm_medium` exactly matches this value.
1148
- */
1149
- utmMedium?: string;
1150
- /**
1151
- * Accepted for backward compatibility but NOT applied — there is no campaign-name
1152
- * dimension on funnel sessions. Use `utmCampaign` instead.
1153
- */
1154
- utmName?: string;
1155
- /**
1156
- * Restrict the funnel to sessions whose `utm_source` exactly matches this value.
1157
- */
1158
- utmSource?: string;
1159
- /**
1160
- * Restrict the funnel to sessions whose `utm_term` exactly matches this value.
267
+ * Require this saved definition revision. Returns a conflict if the funnel has
268
+ * changed.
1161
269
  */
1162
- utmTerm?: string;
270
+ expectedDefinitionUpdatedAt?: string;
1163
271
  }
1164
272
  export declare namespace Funnels {
1165
273
  export { type FunnelListResponse as FunnelListResponse, type FunnelCreateResponse as FunnelCreateResponse, type FunnelRetrieveResponse as FunnelRetrieveResponse, type FunnelUpdateResponse as FunnelUpdateResponse, type FunnelDeleteResponse as FunnelDeleteResponse, type FunnelDuplicateResponse as FunnelDuplicateResponse, type FunnelResultsResponse as FunnelResultsResponse, type FunnelCreateParams as FunnelCreateParams, type FunnelUpdateParams as FunnelUpdateParams, type FunnelResultsParams as FunnelResultsParams, };