@contentful/optimization-api-client 0.1.0-alpha8 → 0.1.0-alpha9

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 (79) hide show
  1. package/README.md +55 -24
  2. package/dist/199.mjs +2 -0
  3. package/dist/649.mjs +131 -0
  4. package/dist/649.mjs.map +1 -0
  5. package/dist/api-schemas.cjs +60 -0
  6. package/dist/api-schemas.cjs.map +1 -0
  7. package/dist/api-schemas.d.cts +4 -0
  8. package/dist/api-schemas.d.mts +4 -0
  9. package/dist/api-schemas.d.ts +4 -0
  10. package/dist/api-schemas.mjs +2 -0
  11. package/dist/index.cjs +588 -575
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +327 -68
  14. package/dist/index.d.mts +327 -68
  15. package/dist/index.d.ts +1649 -8
  16. package/dist/index.mjs +103 -136
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/logger.cjs +207 -0
  19. package/dist/logger.cjs.map +1 -0
  20. package/dist/logger.d.cts +287 -0
  21. package/dist/logger.d.mts +287 -0
  22. package/dist/logger.d.ts +287 -0
  23. package/dist/logger.mjs +1 -0
  24. package/package.json +24 -6
  25. package/dist/ApiClient.d.ts +0 -74
  26. package/dist/ApiClient.d.ts.map +0 -1
  27. package/dist/ApiClient.js +0 -61
  28. package/dist/ApiClient.js.map +0 -1
  29. package/dist/ApiClientBase.d.ts +0 -113
  30. package/dist/ApiClientBase.d.ts.map +0 -1
  31. package/dist/ApiClientBase.js +0 -94
  32. package/dist/ApiClientBase.js.map +0 -1
  33. package/dist/builders/EventBuilder.d.ts +0 -589
  34. package/dist/builders/EventBuilder.d.ts.map +0 -1
  35. package/dist/builders/EventBuilder.js +0 -349
  36. package/dist/builders/EventBuilder.js.map +0 -1
  37. package/dist/builders/index.d.ts +0 -3
  38. package/dist/builders/index.d.ts.map +0 -1
  39. package/dist/builders/index.js +0 -3
  40. package/dist/builders/index.js.map +0 -1
  41. package/dist/experience/ExperienceApiClient.d.ts +0 -267
  42. package/dist/experience/ExperienceApiClient.d.ts.map +0 -1
  43. package/dist/experience/ExperienceApiClient.js +0 -324
  44. package/dist/experience/ExperienceApiClient.js.map +0 -1
  45. package/dist/experience/index.d.ts +0 -4
  46. package/dist/experience/index.d.ts.map +0 -1
  47. package/dist/experience/index.js +0 -4
  48. package/dist/experience/index.js.map +0 -1
  49. package/dist/fetch/Fetch.d.ts +0 -96
  50. package/dist/fetch/Fetch.d.ts.map +0 -1
  51. package/dist/fetch/Fetch.js +0 -27
  52. package/dist/fetch/Fetch.js.map +0 -1
  53. package/dist/fetch/createProtectedFetchMethod.d.ts +0 -40
  54. package/dist/fetch/createProtectedFetchMethod.d.ts.map +0 -1
  55. package/dist/fetch/createProtectedFetchMethod.js +0 -53
  56. package/dist/fetch/createProtectedFetchMethod.js.map +0 -1
  57. package/dist/fetch/createRetryFetchMethod.d.ts +0 -60
  58. package/dist/fetch/createRetryFetchMethod.d.ts.map +0 -1
  59. package/dist/fetch/createRetryFetchMethod.js +0 -138
  60. package/dist/fetch/createRetryFetchMethod.js.map +0 -1
  61. package/dist/fetch/createTimeoutFetchMethod.d.ts +0 -51
  62. package/dist/fetch/createTimeoutFetchMethod.d.ts.map +0 -1
  63. package/dist/fetch/createTimeoutFetchMethod.js +0 -51
  64. package/dist/fetch/createTimeoutFetchMethod.js.map +0 -1
  65. package/dist/fetch/index.d.ts +0 -7
  66. package/dist/fetch/index.d.ts.map +0 -1
  67. package/dist/fetch/index.js +0 -7
  68. package/dist/fetch/index.js.map +0 -1
  69. package/dist/index.d.ts.map +0 -1
  70. package/dist/index.js +0 -8
  71. package/dist/index.js.map +0 -1
  72. package/dist/insights/InsightsApiClient.d.ts +0 -130
  73. package/dist/insights/InsightsApiClient.d.ts.map +0 -1
  74. package/dist/insights/InsightsApiClient.js +0 -143
  75. package/dist/insights/InsightsApiClient.js.map +0 -1
  76. package/dist/insights/index.d.ts +0 -4
  77. package/dist/insights/index.d.ts.map +0 -1
  78. package/dist/insights/index.js +0 -4
  79. package/dist/insights/index.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,8 +1,1649 @@
1
- export { default as ApiClient } from './ApiClient';
2
- export * from '@contentful/optimization-api-schemas';
3
- export * from './ApiClient';
4
- export * from './ApiClientBase';
5
- export * from './builders';
6
- export * from './experience';
7
- export * from './insights';
8
- //# sourceMappingURL=index.d.ts.map
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * The Contentful Optimization API Client Library provides methods for
5
+ * interfacing with Contentful's Experience and Insights APIs, which serve its
6
+ * Personalization and Analytics products.
7
+ */
8
+
9
+ import { App } from '@contentful/optimization-api-schemas';
10
+ import { BatchExperienceEventArray } from '@contentful/optimization-api-schemas';
11
+ import { BatchExperienceResponseData } from '@contentful/optimization-api-schemas';
12
+ import { BatchInsightsEventArray } from '@contentful/optimization-api-schemas';
13
+ import { Channel } from '@contentful/optimization-api-schemas';
14
+ import { ComponentClickEvent } from '@contentful/optimization-api-schemas';
15
+ import { ComponentHoverEvent } from '@contentful/optimization-api-schemas';
16
+ import { ComponentViewEvent } from '@contentful/optimization-api-schemas';
17
+ import { ExperienceEventArray } from '@contentful/optimization-api-schemas';
18
+ import { IdentifyEvent } from '@contentful/optimization-api-schemas';
19
+ import { Library } from '@contentful/optimization-api-schemas';
20
+ import { OptimizationData } from '@contentful/optimization-api-schemas';
21
+ import { Page } from '@contentful/optimization-api-schemas';
22
+ import { PageViewEvent } from '@contentful/optimization-api-schemas';
23
+ import { ScreenViewEvent } from '@contentful/optimization-api-schemas';
24
+ import { TrackEvent as TrackEvent_2 } from '@contentful/optimization-api-schemas';
25
+ import { UniversalEventProperties } from '@contentful/optimization-api-schemas';
26
+ import * as z from 'zod/mini';
27
+
28
+ /**
29
+ * Aggregated API client providing access to Experience and Insights APIs.
30
+ *
31
+ * @remarks
32
+ * This client encapsulates shared configuration and exposes dedicated
33
+ * sub-clients for personalization and analytics use cases.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const client = new ApiClient({
38
+ * clientId: 'org-id',
39
+ * environment: 'main',
40
+ * personalization: {
41
+ * // experience-specific overrides
42
+ * },
43
+ * analytics: {
44
+ * // insights-specific overrides
45
+ * },
46
+ * })
47
+ *
48
+ * const profile = await client.experience.getProfile('profile-id')
49
+ * await client.insights.sendBatchEvents(batches)
50
+ * ```
51
+ *
52
+ * @see {@link ExperienceApiClient}
53
+ * @see {@link InsightsApiClient}
54
+ *
55
+ * @public
56
+ */
57
+ export declare class ApiClient {
58
+ /**
59
+ * Shared configuration applied to both Experience and Insights clients.
60
+ *
61
+ * @see {@link ApiConfig}
62
+ */
63
+ readonly config: ApiConfig;
64
+ /**
65
+ * Client for personalization and experience-related operations.
66
+ *
67
+ * @see {@link ExperienceApiClient}
68
+ */
69
+ readonly experience: ExperienceApiClient;
70
+ /**
71
+ * Client for analytics and insights-related operations.
72
+ *
73
+ * @see {@link InsightsApiClient}
74
+ */
75
+ readonly insights: InsightsApiClient;
76
+ /**
77
+ * Creates a new aggregated {@link ApiClient} instance.
78
+ *
79
+ * @param config - Global API client configuration with optional per-client overrides.
80
+ */
81
+ constructor(config: ApiClientConfig);
82
+ }
83
+
84
+ /**
85
+ * Base class for API clients that provides shared configuration and error logging.
86
+ *
87
+ * @remarks
88
+ * This abstract class is intended for internal use within the package and
89
+ * should not be treated as part of the public API surface.
90
+ *
91
+ * Concrete API clients should extend this class to inherit consistent logging
92
+ * behavior and fetch configuration.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * interface MyClientConfig extends ApiConfig {
97
+ * // additional config
98
+ * }
99
+ *
100
+ * class MyClient extends ApiClientBase {
101
+ * constructor(config: MyClientConfig) {
102
+ * super('MyClient', config)
103
+ * }
104
+ *
105
+ * async getSomething() {
106
+ * const response = await this.fetch('https://example.com', { method: 'GET' })
107
+ * return response.json()
108
+ * }
109
+ * }
110
+ * ```
111
+ *
112
+ * @internal
113
+ */
114
+ declare abstract class ApiClientBase {
115
+ /**
116
+ * Name of the API client, used in log messages and as the `apiName` for fetch.
117
+ */
118
+ protected readonly name: string;
119
+ /**
120
+ * Client identifier used for authentication or tracking.
121
+ */
122
+ protected readonly clientId: string;
123
+ /**
124
+ * Contentful environment associated with this client.
125
+ */
126
+ protected readonly environment: string;
127
+ /**
128
+ * Protected fetch method used by the client to perform HTTP requests.
129
+ */
130
+ protected readonly fetch: FetchMethod;
131
+ /**
132
+ * Creates a new API client base instance.
133
+ *
134
+ * @param name - Human-readable name of the client (used for logging and `apiName`).
135
+ * @param config - Configuration options for the client.
136
+ */
137
+ constructor(name: string, { fetchOptions, clientId, environment }: ApiConfig);
138
+ /**
139
+ * Logs errors that occur during API requests with standardized messages.
140
+ *
141
+ * @param error - The error thrown by the underlying operation.
142
+ * @param options - Additional metadata about the request.
143
+ * @param options.requestName - Human-readable name of the request operation.
144
+ *
145
+ * @remarks
146
+ * Abort errors are logged at `warn` level and other errors at `error` level.
147
+ * The log message includes the client name for better debugging context.
148
+ */
149
+ protected logRequestError(error: unknown, { requestName }: {
150
+ requestName: string;
151
+ }): void;
152
+ }
153
+
154
+ /**
155
+ * Configuration for the high-level {@link ApiClient}.
156
+ *
157
+ * @public
158
+ */
159
+ export declare interface ApiClientConfig extends Pick<ApiConfig, GlobalApiConfigProperties> {
160
+ /**
161
+ * Configuration for the personalization (Experience) API client.
162
+ *
163
+ * @remarks
164
+ * Shared fields (`clientId`, `environment`, `fetchOptions`) are inherited
165
+ * from top-level config; this object is for Experience-specific options.
166
+ */
167
+ personalization?: Omit<ExperienceApiClientConfig, GlobalApiConfigProperties>;
168
+ /**
169
+ * Configuration for the analytics (Insights) API client.
170
+ *
171
+ * @remarks
172
+ * Shared fields (`clientId`, `environment`, `fetchOptions`) are inherited
173
+ * from top-level config; this object is for Insights-specific options.
174
+ */
175
+ analytics?: Omit<InsightsApiClientConfig, GlobalApiConfigProperties>;
176
+ }
177
+
178
+ /**
179
+ * Configuration options for API clients extending {@link ApiClientBase}.
180
+ *
181
+ * @public
182
+ */
183
+ export declare interface ApiConfig {
184
+ /**
185
+ * Base URL for the API.
186
+ *
187
+ * @remarks
188
+ * When omitted, the concrete client is expected to construct full URLs
189
+ * internally.
190
+ */
191
+ baseUrl?: string;
192
+ /**
193
+ * Contentful environment identifier.
194
+ *
195
+ * @defaultValue `'main'`
196
+ */
197
+ environment?: string;
198
+ /**
199
+ * Options used to configure the underlying protected fetch method.
200
+ *
201
+ * @remarks
202
+ * `apiName` is derived from the client name and must not be provided here.
203
+ */
204
+ fetchOptions?: Omit<ProtectedFetchMethodOptions, 'apiName'>;
205
+ /**
206
+ * Client identifier used for authentication or tracking.
207
+ */
208
+ clientId: string;
209
+ }
210
+
211
+ /**
212
+ * Base options shared across fetch method factories.
213
+ *
214
+ * @public
215
+ */
216
+ declare interface BaseFetchMethodOptions {
217
+ /**
218
+ * Human-readable name of the API being called.
219
+ *
220
+ * @remarks
221
+ * Used primarily for logging and error messages.
222
+ */
223
+ apiName?: string;
224
+ /**
225
+ * Custom fetch implementation to use instead of the global `fetch`.
226
+ *
227
+ * @remarks
228
+ * This is useful for providing polyfills, mocks, or instrumented fetch
229
+ * implementations.
230
+ */
231
+ fetchMethod?: FetchMethod;
232
+ }
233
+
234
+ /**
235
+ * Parameters used when performing a batch profile update.
236
+ *
237
+ * @internal
238
+ */
239
+ declare interface BatchUpdateProfileParams {
240
+ /**
241
+ * Batch of events to process.
242
+ */
243
+ events: BatchExperienceEventArray;
244
+ }
245
+
246
+ /**
247
+ * Arguments for constructing component click events.
248
+ *
249
+ * @public
250
+ */
251
+ export declare type ComponentClickBuilderArgs = z.infer<typeof ComponentClickBuilderArgs_2>;
252
+
253
+ declare const ComponentClickBuilderArgs_2: z.ZodMiniObject<{
254
+ campaign: z.ZodMiniOptional<z.ZodMiniObject<{
255
+ name: z.ZodMiniOptional<z.ZodMiniString<string>>;
256
+ source: z.ZodMiniOptional<z.ZodMiniString<string>>;
257
+ medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
258
+ term: z.ZodMiniOptional<z.ZodMiniString<string>>;
259
+ content: z.ZodMiniOptional<z.ZodMiniString<string>>;
260
+ }, z.core.$strip>>;
261
+ locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
262
+ location: z.ZodMiniOptional<z.ZodMiniObject<{
263
+ coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
264
+ latitude: z.ZodMiniNumber<number>;
265
+ longitude: z.ZodMiniNumber<number>;
266
+ }, z.core.$strip>>;
267
+ city: z.ZodMiniOptional<z.ZodMiniString<string>>;
268
+ postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
269
+ region: z.ZodMiniOptional<z.ZodMiniString<string>>;
270
+ regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
271
+ country: z.ZodMiniOptional<z.ZodMiniString<string>>;
272
+ countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
273
+ continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
274
+ timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
275
+ }, z.core.$strip>>;
276
+ page: z.ZodMiniOptional<z.ZodMiniObject<{
277
+ path: z.ZodMiniString<string>;
278
+ query: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
279
+ referrer: z.ZodMiniString<string>;
280
+ search: z.ZodMiniString<string>;
281
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
282
+ url: z.ZodMiniString<string>;
283
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
284
+ screen: z.ZodMiniOptional<z.ZodMiniObject<{
285
+ name: z.ZodMiniString<string>;
286
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
287
+ userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
288
+ componentId: z.ZodMiniString<string>;
289
+ experienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
290
+ variantIndex: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
291
+ }, z.core.$strip>;
292
+
293
+ /**
294
+ * Arguments for constructing component click events.
295
+ *
296
+ * @public
297
+ */
298
+ declare type ComponentClickBuilderArgs = z.infer<typeof ComponentClickBuilderArgs_2>;
299
+
300
+ /**
301
+ * Arguments for constructing component hover events.
302
+ *
303
+ * @public
304
+ */
305
+ export declare type ComponentHoverBuilderArgs = z.infer<typeof ComponentHoverBuilderArgs_2>;
306
+
307
+ declare const ComponentHoverBuilderArgs_2: z.ZodMiniObject<{
308
+ campaign: z.ZodMiniOptional<z.ZodMiniObject<{
309
+ name: z.ZodMiniOptional<z.ZodMiniString<string>>;
310
+ source: z.ZodMiniOptional<z.ZodMiniString<string>>;
311
+ medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
312
+ term: z.ZodMiniOptional<z.ZodMiniString<string>>;
313
+ content: z.ZodMiniOptional<z.ZodMiniString<string>>;
314
+ }, z.core.$strip>>;
315
+ locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
316
+ location: z.ZodMiniOptional<z.ZodMiniObject<{
317
+ coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
318
+ latitude: z.ZodMiniNumber<number>;
319
+ longitude: z.ZodMiniNumber<number>;
320
+ }, z.core.$strip>>;
321
+ city: z.ZodMiniOptional<z.ZodMiniString<string>>;
322
+ postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
323
+ region: z.ZodMiniOptional<z.ZodMiniString<string>>;
324
+ regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
325
+ country: z.ZodMiniOptional<z.ZodMiniString<string>>;
326
+ countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
327
+ continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
328
+ timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
329
+ }, z.core.$strip>>;
330
+ page: z.ZodMiniOptional<z.ZodMiniObject<{
331
+ path: z.ZodMiniString<string>;
332
+ query: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
333
+ referrer: z.ZodMiniString<string>;
334
+ search: z.ZodMiniString<string>;
335
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
336
+ url: z.ZodMiniString<string>;
337
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
338
+ screen: z.ZodMiniOptional<z.ZodMiniObject<{
339
+ name: z.ZodMiniString<string>;
340
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
341
+ userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
342
+ componentId: z.ZodMiniString<string>;
343
+ experienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
344
+ variantIndex: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
345
+ componentHoverId: z.ZodMiniString<string>;
346
+ hoverDurationMs: z.ZodMiniNumber<number>;
347
+ }, z.core.$strip>;
348
+
349
+ /**
350
+ * Arguments for constructing component hover events.
351
+ *
352
+ * @public
353
+ */
354
+ declare type ComponentHoverBuilderArgs = z.infer<typeof ComponentHoverBuilderArgs_2>;
355
+
356
+ /**
357
+ * Arguments shared by component view, click, and hover events.
358
+ *
359
+ * @public
360
+ */
361
+ export declare type ComponentInteractionBuilderArgsBase = z.infer<typeof ComponentInteractionBuilderArgsBase_2>;
362
+
363
+ declare const ComponentInteractionBuilderArgsBase_2: z.ZodMiniObject<{
364
+ campaign: z.ZodMiniOptional<z.ZodMiniObject<{
365
+ name: z.ZodMiniOptional<z.ZodMiniString<string>>;
366
+ source: z.ZodMiniOptional<z.ZodMiniString<string>>;
367
+ medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
368
+ term: z.ZodMiniOptional<z.ZodMiniString<string>>;
369
+ content: z.ZodMiniOptional<z.ZodMiniString<string>>;
370
+ }, z.core.$strip>>;
371
+ locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
372
+ location: z.ZodMiniOptional<z.ZodMiniObject<{
373
+ coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
374
+ latitude: z.ZodMiniNumber<number>;
375
+ longitude: z.ZodMiniNumber<number>;
376
+ }, z.core.$strip>>;
377
+ city: z.ZodMiniOptional<z.ZodMiniString<string>>;
378
+ postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
379
+ region: z.ZodMiniOptional<z.ZodMiniString<string>>;
380
+ regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
381
+ country: z.ZodMiniOptional<z.ZodMiniString<string>>;
382
+ countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
383
+ continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
384
+ timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
385
+ }, z.core.$strip>>;
386
+ page: z.ZodMiniOptional<z.ZodMiniObject<{
387
+ path: z.ZodMiniString<string>;
388
+ query: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
389
+ referrer: z.ZodMiniString<string>;
390
+ search: z.ZodMiniString<string>;
391
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
392
+ url: z.ZodMiniString<string>;
393
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
394
+ screen: z.ZodMiniOptional<z.ZodMiniObject<{
395
+ name: z.ZodMiniString<string>;
396
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
397
+ userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
398
+ componentId: z.ZodMiniString<string>;
399
+ experienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
400
+ variantIndex: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
401
+ }, z.core.$strip>;
402
+
403
+ /**
404
+ * Arguments shared by component view, click, and hover events.
405
+ *
406
+ * @public
407
+ */
408
+ declare type ComponentInteractionBuilderArgsBase = z.infer<typeof ComponentInteractionBuilderArgsBase_2>;
409
+
410
+ /**
411
+ * Arguments for constructing component view events.
412
+ *
413
+ * @public
414
+ */
415
+ export declare type ComponentViewBuilderArgs = z.infer<typeof ComponentViewBuilderArgs_2>;
416
+
417
+ declare const ComponentViewBuilderArgs_2: z.ZodMiniObject<{
418
+ campaign: z.ZodMiniOptional<z.ZodMiniObject<{
419
+ name: z.ZodMiniOptional<z.ZodMiniString<string>>;
420
+ source: z.ZodMiniOptional<z.ZodMiniString<string>>;
421
+ medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
422
+ term: z.ZodMiniOptional<z.ZodMiniString<string>>;
423
+ content: z.ZodMiniOptional<z.ZodMiniString<string>>;
424
+ }, z.core.$strip>>;
425
+ locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
426
+ location: z.ZodMiniOptional<z.ZodMiniObject<{
427
+ coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
428
+ latitude: z.ZodMiniNumber<number>;
429
+ longitude: z.ZodMiniNumber<number>;
430
+ }, z.core.$strip>>;
431
+ city: z.ZodMiniOptional<z.ZodMiniString<string>>;
432
+ postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
433
+ region: z.ZodMiniOptional<z.ZodMiniString<string>>;
434
+ regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
435
+ country: z.ZodMiniOptional<z.ZodMiniString<string>>;
436
+ countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
437
+ continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
438
+ timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
439
+ }, z.core.$strip>>;
440
+ page: z.ZodMiniOptional<z.ZodMiniObject<{
441
+ path: z.ZodMiniString<string>;
442
+ query: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
443
+ referrer: z.ZodMiniString<string>;
444
+ search: z.ZodMiniString<string>;
445
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
446
+ url: z.ZodMiniString<string>;
447
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
448
+ screen: z.ZodMiniOptional<z.ZodMiniObject<{
449
+ name: z.ZodMiniString<string>;
450
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
451
+ userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
452
+ componentId: z.ZodMiniString<string>;
453
+ experienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
454
+ variantIndex: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
455
+ sticky: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
456
+ componentViewId: z.ZodMiniString<string>;
457
+ viewDurationMs: z.ZodMiniNumber<number>;
458
+ }, z.core.$strip>;
459
+
460
+ /**
461
+ * Arguments for constructing component view events.
462
+ *
463
+ * @public
464
+ */
465
+ declare type ComponentViewBuilderArgs = z.infer<typeof ComponentViewBuilderArgs_2>;
466
+
467
+ /**
468
+ * Parameters used when creating a profile.
469
+ *
470
+ * @internal
471
+ */
472
+ declare interface CreateProfileParams {
473
+ /**
474
+ * Events used to aggregate the profile state.
475
+ */
476
+ events: ExperienceEventArray;
477
+ }
478
+
479
+ /**
480
+ * Default page properties used when no explicit page information is available.
481
+ *
482
+ * @defaultValue
483
+ * ```ts
484
+ * {
485
+ * path: '',
486
+ * query: {},
487
+ * referrer: '',
488
+ * search: '',
489
+ * title: '',
490
+ * url: '',
491
+ * }
492
+ * ```
493
+ *
494
+ * @remarks
495
+ * Values are required by the API; values may not be `undefined`. Empty values are valid.
496
+ *
497
+ * @public
498
+ */
499
+ export declare const DEFAULT_PAGE_PROPERTIES: {
500
+ path: string;
501
+ query: {};
502
+ referrer: string;
503
+ search: string;
504
+ title: string;
505
+ url: string;
506
+ };
507
+
508
+ /**
509
+ * Helper class for building analytics and personalization events.
510
+ *
511
+ * @remarks
512
+ * This class coordinates configuration and argument validation to produce
513
+ * strongly-typed event payloads compatible with
514
+ * `@contentful/optimization-api-schemas`.
515
+ *
516
+ * @see {@link EventBuilderConfig}
517
+ *
518
+ * @public
519
+ */
520
+ export declare class EventBuilder {
521
+ /**
522
+ * Application metadata attached to each event.
523
+ *
524
+ * @internal
525
+ */
526
+ app?: App;
527
+ /**
528
+ * Channel value attached to each event.
529
+ *
530
+ * @internal
531
+ */
532
+ channel: Channel;
533
+ /**
534
+ * Library metadata attached to each event.
535
+ *
536
+ * @internal
537
+ */
538
+ library: Library;
539
+ /**
540
+ * Function that provides the locale when available.
541
+ *
542
+ * @internal
543
+ */
544
+ getLocale: () => string | undefined;
545
+ /**
546
+ * Function that provides baseline page properties.
547
+ *
548
+ * @internal
549
+ */
550
+ getPageProperties: () => Page;
551
+ /**
552
+ * Function that provides the user agent string when available.
553
+ *
554
+ * @internal
555
+ */
556
+ getUserAgent: () => string | undefined;
557
+ /**
558
+ * Creates a new {@link EventBuilder} instance.
559
+ *
560
+ * @param config - Configuration used to customize event payloads.
561
+ *
562
+ * @remarks
563
+ * Callers are expected to reuse a single instance when possible to avoid
564
+ * repeatedly reconfiguring the builder.
565
+ *
566
+ * @example
567
+ * ```ts
568
+ * const builder = new EventBuilder({
569
+ * channel: 'web',
570
+ * library: { name: '@contentful/optimization-sdk', version: '1.0.0' },
571
+ * })
572
+ * ```
573
+ */
574
+ constructor(config: EventBuilderConfig);
575
+ /**
576
+ * Builds the universal event properties shared across all event types.
577
+ *
578
+ * @param args - Arguments overriding the default context values.
579
+ * @returns A fully populated {@link UniversalEventProperties} object.
580
+ *
581
+ * @remarks
582
+ * This method is used internally by the specific event-builder methods
583
+ * (e.g. {@link EventBuilder.buildPageView}).
584
+ */
585
+ protected buildUniversalEventProperties({ campaign, locale, location, page, screen, userAgent, }: UniversalEventBuilderArgs): UniversalEventProperties;
586
+ private buildEntryComponentBase;
587
+ /**
588
+ * Builds a component view event payload for a Contentful entry-based component.
589
+ *
590
+ * @param args - {@link ComponentViewBuilderArgs} arguments describing the component view.
591
+ * @returns A {@link ComponentViewEvent} describing the view.
592
+ *
593
+ * @example
594
+ * ```ts
595
+ * const event = builder.buildComponentView({
596
+ * componentId: 'entry-123',
597
+ * componentViewId: crypto.randomUUID(),
598
+ * experienceId: 'personalization-123',
599
+ * variantIndex: 1,
600
+ * viewDurationMs: 1_000,
601
+ * })
602
+ * ```
603
+ *
604
+ * @public
605
+ */
606
+ buildComponentView(args: ComponentViewBuilderArgs): ComponentViewEvent;
607
+ /**
608
+ * Builds a component click event payload for a Contentful entry-based component.
609
+ *
610
+ * @param args - {@link ComponentClickBuilderArgs} arguments describing the component click.
611
+ * @returns A {@link ComponentClickEvent} describing the click.
612
+ *
613
+ * @example
614
+ * ```ts
615
+ * const event = builder.buildComponentClick({
616
+ * componentId: 'entry-123',
617
+ * experienceId: 'personalization-123',
618
+ * variantIndex: 1,
619
+ * })
620
+ * ```
621
+ *
622
+ * @public
623
+ */
624
+ buildComponentClick(args: ComponentClickBuilderArgs): ComponentClickEvent;
625
+ /**
626
+ * Builds a component hover event payload for a Contentful entry-based component.
627
+ *
628
+ * @param args - {@link ComponentHoverBuilderArgs} arguments describing the component hover.
629
+ * @returns A {@link ComponentHoverEvent} describing the hover.
630
+ *
631
+ * @example
632
+ * ```ts
633
+ * const event = builder.buildComponentHover({
634
+ * componentId: 'entry-123',
635
+ * componentHoverId: crypto.randomUUID(),
636
+ * experienceId: 'personalization-123',
637
+ * hoverDurationMs: 1_000,
638
+ * variantIndex: 1,
639
+ * })
640
+ * ```
641
+ *
642
+ * @public
643
+ */
644
+ buildComponentHover(args: ComponentHoverBuilderArgs): ComponentHoverEvent;
645
+ /**
646
+ * Builds a component view event payload for a Custom Flag component.
647
+ *
648
+ * @param args - {@link ComponentViewBuilderArgs} arguments describing the Custom Flag view.
649
+ * @returns A {@link ComponentViewEvent} describing the view.
650
+ *
651
+ * @remarks
652
+ * This is a specialized variant of {@link EventBuilder.buildComponentView}
653
+ * that sets `componentType` to `'Variable'`.
654
+ *
655
+ * @example
656
+ * ```ts
657
+ * const event = builder.buildFlagView({
658
+ * componentId: 'feature-flag-key',
659
+ * componentViewId: crypto.randomUUID(),
660
+ * experienceId: 'personalization-123',
661
+ * viewDurationMs: 1_000,
662
+ * })
663
+ * ```
664
+ *
665
+ * @public
666
+ */
667
+ buildFlagView(args: ComponentViewBuilderArgs): ComponentViewEvent;
668
+ /**
669
+ * Builds an identify event payload to associate a user ID with traits.
670
+ *
671
+ * @param args - {@link IdentifyBuilderArgs} arguments describing the identified user.
672
+ * @returns An {@link IdentifyEvent} payload.
673
+ *
674
+ * @remarks
675
+ * - Traits are merged by the API; only specified properties may be overwritten.
676
+ * - The User ID is consumer-specified and should not contain the value of any
677
+ * ID generated by the Experience API.
678
+ *
679
+ * @example
680
+ * ```ts
681
+ * const event = builder.buildIdentify({
682
+ * userId: 'user-123',
683
+ * traits: { plan: 'pro' },
684
+ * })
685
+ * ```
686
+ *
687
+ * @public
688
+ */
689
+ buildIdentify(args: IdentifyBuilderArgs): IdentifyEvent;
690
+ /**
691
+ * Builds a page view event payload.
692
+ *
693
+ * @param args - Optional {@link PageViewBuilderArgs} overrides for the page view event.
694
+ * @returns A {@link PageViewEvent} payload.
695
+ *
696
+ * @remarks
697
+ * Page properties are created by merging:
698
+ * 1. The base page properties from {@link EventBuilderConfig.getPageProperties}, and
699
+ * 2. The partial `properties` argument passed in.
700
+ *
701
+ * The title always falls back to {@link DEFAULT_PAGE_PROPERTIES}.title when undefined.
702
+ *
703
+ * @example
704
+ * ```ts
705
+ * const event = builder.buildPageView({
706
+ * properties: {
707
+ * title: 'Homepage',
708
+ * },
709
+ * })
710
+ * ```
711
+ *
712
+ * @public
713
+ */
714
+ buildPageView(args?: PageViewBuilderArgs): PageViewEvent;
715
+ /**
716
+ * Builds a screen view event payload.
717
+ *
718
+ * @param args - {@link ScreenViewBuilderArgs} arguments for the screen view event.
719
+ * @returns A {@link ScreenViewEvent} payload.
720
+ *
721
+ * @example
722
+ * ```ts
723
+ * const event = builder.buildScreenView({
724
+ * name: 'home',
725
+ * properties: {
726
+ * title: 'Home Screen',
727
+ * },
728
+ * })
729
+ * ```
730
+ *
731
+ * @public
732
+ */
733
+ buildScreenView(args: ScreenViewBuilderArgs): ScreenViewEvent;
734
+ /**
735
+ * Builds a track event payload for arbitrary user actions.
736
+ *
737
+ * @param args - {@link TrackBuilderArgs} arguments describing the tracked event.
738
+ * @returns A {@link TrackEvent} payload.
739
+ *
740
+ * @example
741
+ * ```ts
742
+ * const event = builder.buildTrack({
743
+ * event: 'button_clicked',
744
+ * properties: { id: 'primary-cta', location: 'hero' },
745
+ * })
746
+ * ```
747
+ *
748
+ * @public
749
+ */
750
+ buildTrack(args: TrackBuilderArgs): TrackEvent_2;
751
+ }
752
+
753
+ /**
754
+ * Configuration options for creating an {@link EventBuilder} instance.
755
+ *
756
+ * @remarks
757
+ * The configuration is typically provided by the host application to adapt
758
+ * event payloads to the runtime environment (browser, framework, etc.).
759
+ *
760
+ * @example
761
+ * ```ts
762
+ * const builder = new EventBuilder({
763
+ * app: { name: 'my-app', version: '1.0.0' },
764
+ * channel: 'web',
765
+ * library: { name: '@contentful/optimization-sdk', version: '1.2.3' },
766
+ * getLocale: () => navigator.language,
767
+ * getPageProperties: () => ({
768
+ * path: window.location.pathname,
769
+ * url: window.location.href,
770
+ * title: document.title,
771
+ * query: {},
772
+ * referrer: document.referrer,
773
+ * search: window.location.search,
774
+ * }),
775
+ * })
776
+ * ```
777
+ *
778
+ * @public
779
+ */
780
+ export declare interface EventBuilderConfig {
781
+ /**
782
+ * The application definition used to attribute events to a specific consumer app.
783
+ *
784
+ * @remarks
785
+ * When not provided, events will not contain app metadata in their context.
786
+ */
787
+ app?: App;
788
+ /**
789
+ * The channel that identifies where events originate from (e.g. web, mobile).
790
+ *
791
+ * @see {@link Channel}
792
+ */
793
+ channel: Channel;
794
+ /**
795
+ * The client library metadata that is attached to all events.
796
+ *
797
+ * @remarks
798
+ * This is typically used to record the library name and version.
799
+ */
800
+ library: Library;
801
+ /**
802
+ * Function used to resolve the locale for outgoing events.
803
+ *
804
+ * @remarks
805
+ * If not provided, the builder falls back to the default `'en-US'`. Locale
806
+ * values supplied directly as arguments to event builder methods take
807
+ * precedence.
808
+ *
809
+ * @returns The locale string (e.g. `'en-US'`), or `undefined` if unavailable.
810
+ */
811
+ getLocale?: () => string | undefined;
812
+ /**
813
+ * Function that returns the current page properties.
814
+ *
815
+ * @remarks
816
+ * Page properties are currently added to the context of all events, as well
817
+ * as the `properties` of the page event. When specified, all properties of
818
+ * the `Page` type are required, but may contain empty values.
819
+ *
820
+ * @returns A {@link Page} object containing information about the current page.
821
+ * @see {@link Page}
822
+ */
823
+ getPageProperties?: () => Page;
824
+ /**
825
+ * Function used to obtain the current user agent string when applicable.
826
+ *
827
+ * @returns A user agent string, or `undefined` if unavailable.
828
+ */
829
+ getUserAgent?: () => string | undefined;
830
+ }
831
+
832
+ /**
833
+ * Default base URL for the Experience API.
834
+ *
835
+ * @public
836
+ */
837
+ export declare const EXPERIENCE_BASE_URL = "https://experience.ninetailed.co/";
838
+
839
+ /**
840
+ * Client for interacting with the Experience API.
841
+ *
842
+ * @remarks
843
+ * This client is responsible for reading and mutating Ninetailed profiles
844
+ * using the Experience API.
845
+ *
846
+ * @example
847
+ * ```ts
848
+ * const client = new ExperienceApiClient({
849
+ * clientId: 'org-id',
850
+ * environment: 'main',
851
+ * })
852
+ *
853
+ * const profile = await client.getProfile('profile-id')
854
+ * ```
855
+ *
856
+ * @see {@link ApiClientBase}
857
+ *
858
+ * @public
859
+ */
860
+ declare class ExperienceApiClient extends ApiClientBase {
861
+ /**
862
+ * Base URL used for Experience API requests.
863
+ */
864
+ protected readonly baseUrl: string;
865
+ private readonly enabledFeatures?;
866
+ private readonly ip?;
867
+ private readonly locale?;
868
+ private readonly plainText?;
869
+ private readonly preflight?;
870
+ /**
871
+ * Creates a new {@link ExperienceApiClient} instance.
872
+ *
873
+ * @param config - Configuration for the Experience API client.
874
+ */
875
+ constructor(config: ExperienceApiClientConfig);
876
+ /**
877
+ * Retrieves a profile by ID.
878
+ *
879
+ * @param id - The profile ID to retrieve.
880
+ * @param options - Optional request options. `preflight` and `plainText` are not allowed here.
881
+ * @returns The current optimization data for the profile.
882
+ *
883
+ * @throws {@link Error}
884
+ * Thrown if `id` is missing or the underlying request fails.
885
+ *
886
+ * @example
887
+ * ```ts
888
+ * const profile = await client.getProfile('profile-id', {
889
+ * locale: 'en-US',
890
+ * })
891
+ * ```
892
+ */
893
+ getProfile(id: string, options?: Omit<RequestOptions, 'preflight' | 'plainText'>): Promise<OptimizationData>;
894
+ /**
895
+ * Sends a POST request to mutate a profile or profiles.
896
+ *
897
+ * @param request - Mutation request options including URL, body, and request options.
898
+ * @returns The raw {@link Response} from the underlying fetch.
899
+ *
900
+ * @internal
901
+ */
902
+ private makeProfileMutationRequest;
903
+ /**
904
+ * Creates a profile and returns the resulting optimization data.
905
+ *
906
+ * @param params - Parameters containing the events to aggregate into the profile.
907
+ * @param options - Optional request options.
908
+ * @returns The optimization data for the newly created profile.
909
+ *
910
+ * @remarks
911
+ * The returned profile ID can be used for subsequent update requests.
912
+ *
913
+ * @example
914
+ * ```ts
915
+ * const data = await client.createProfile({
916
+ * events: [{ type: 'identify', userId: 'user-123' }],
917
+ * })
918
+ * ```
919
+ */
920
+ createProfile({ events }: CreateProfileParams, options?: RequestOptions): Promise<OptimizationData>;
921
+ /**
922
+ * Updates an existing profile with the given profile ID.
923
+ *
924
+ * @param params - Parameters including the profile ID and events.
925
+ * @param options - Optional request options.
926
+ * @returns The updated optimization data for the profile.
927
+ *
928
+ * @throws {@link Error}
929
+ * Thrown if `profileId` is missing or the underlying request fails.
930
+ *
931
+ * @example
932
+ * ```ts
933
+ * const data = await client.updateProfile({
934
+ * profileId: 'profile-id',
935
+ * events: [{ type: 'track', event: 'viewed_video' }],
936
+ * })
937
+ * ```
938
+ */
939
+ updateProfile({ profileId, events }: UpdateProfileParams, options?: RequestOptions): Promise<OptimizationData>;
940
+ /**
941
+ * Creates or updates a profile depending on whether a `profileId` is provided.
942
+ *
943
+ * @param params - Parameters including optional profile ID and events.
944
+ * @param options - Optional request options.
945
+ * @returns The resulting optimization data.
946
+ *
947
+ * @example
948
+ * ```ts
949
+ * // Create
950
+ * await client.upsertProfile({ events })
951
+ *
952
+ * // Update
953
+ * await client.upsertProfile({ profileId: 'profile-id', events })
954
+ * ```
955
+ */
956
+ upsertProfile({ profileId, events }: UpsertProfileParams, options?: RequestOptions): Promise<OptimizationData>;
957
+ /**
958
+ * Sends multiple events to the Ninetailed Experience API to upsert many profiles.
959
+ *
960
+ * @param params - Parameters containing the batch of events.
961
+ * @param options - Optional request options.
962
+ * @returns The list of profiles affected by the batch operation.
963
+ *
964
+ * @remarks
965
+ * Batch requests must contain at least one event. Every event must contain
966
+ * an anonymous ID. Profiles will be created or updated according to the
967
+ * anonymous ID.
968
+ *
969
+ * This method is intended to be used from server environments.
970
+ *
971
+ * @example
972
+ * ```ts
973
+ * const profiles = await client.upsertManyProfiles({
974
+ * events: [
975
+ * { anonymousId: 'anon-1', type: 'identify', ... },
976
+ * { anonymousId: 'anon-2', type: 'identify', ... },
977
+ * ],
978
+ * })
979
+ * ```
980
+ */
981
+ upsertManyProfiles({ events }: BatchUpdateProfileParams, options?: RequestOptions): Promise<BatchExperienceResponseData['profiles']>;
982
+ /**
983
+ * Constructs a request URL with query parameters derived from request options.
984
+ *
985
+ * @param path - Path relative to the Experience API base URL.
986
+ * @param options - Request options that may influence query parameters.
987
+ * @returns The fully constructed URL as a string.
988
+ *
989
+ * @internal
990
+ */
991
+ private constructUrl;
992
+ /**
993
+ * Constructs request headers based on request options and default configuration.
994
+ *
995
+ * @param options - Request options that may influence headers.
996
+ * @returns A record of HTTP headers to send with the request.
997
+ *
998
+ * @internal
999
+ */
1000
+ private constructHeaders;
1001
+ /**
1002
+ * Constructs the `options` section of the request body for profile mutations.
1003
+ *
1004
+ * @param options - Request options that may specify enabled features.
1005
+ * @returns Experience API body options including feature flags.
1006
+ *
1007
+ * @internal
1008
+ */
1009
+ private readonly constructBodyOptions;
1010
+ /**
1011
+ * Construct and validate the singular Experience mutation request payload.
1012
+ *
1013
+ * @param events - Events that should be evaluated by the Experience API.
1014
+ * @param options - Request options that may contribute body options.
1015
+ * @returns Validated singular Experience request body.
1016
+ *
1017
+ * @internal
1018
+ */
1019
+ private constructExperienceRequestBody;
1020
+ }
1021
+
1022
+ /**
1023
+ * Configuration for {@link ExperienceApiClient}.
1024
+ *
1025
+ * @public
1026
+ */
1027
+ export declare interface ExperienceApiClientConfig extends ApiConfig, RequestOptions {
1028
+ }
1029
+
1030
+ /**
1031
+ * Feature flags supported by the Experience API.
1032
+ *
1033
+ * @internal
1034
+ */
1035
+ declare type Feature = 'ip-enrichment' | 'location';
1036
+
1037
+ /**
1038
+ * Signature of a fetch method used by the API clients.
1039
+ *
1040
+ * @param url - The request URL.
1041
+ * @param init - Initialization options passed to `fetch`.
1042
+ * @returns A promise that resolves with the {@link Response}.
1043
+ *
1044
+ * @remarks
1045
+ * This abstraction allows the underlying implementation to be replaced,
1046
+ * for example in tests or different runtime environments.
1047
+ *
1048
+ * @example
1049
+ * ```ts
1050
+ * const method: FetchMethod = async (url, init) => {
1051
+ * return fetch(url, init)
1052
+ * }
1053
+ * ```
1054
+ *
1055
+ * @public
1056
+ */
1057
+ declare type FetchMethod = (url: string | URL, init: RequestInit) => Promise<Response>;
1058
+
1059
+ /**
1060
+ * Options passed to callback functions invoked by fetch wrappers.
1061
+ *
1062
+ * @remarks
1063
+ * Not all fields are guaranteed to be present in all callback scenarios.
1064
+ *
1065
+ * @public
1066
+ */
1067
+ declare interface FetchMethodCallbackOptions {
1068
+ /**
1069
+ * Name of the API associated with the request.
1070
+ */
1071
+ apiName?: string;
1072
+ /**
1073
+ * Error that caused the callback to be invoked, if available.
1074
+ */
1075
+ error?: Error;
1076
+ /**
1077
+ * The current attempt number (for retry callbacks).
1078
+ */
1079
+ attemptNumber?: number;
1080
+ /**
1081
+ * Number of retry attempts remaining (for retry callbacks).
1082
+ */
1083
+ retriesLeft?: number;
1084
+ }
1085
+
1086
+ /**
1087
+ * Properties that may be shared between global and per-client API configuration.
1088
+ *
1089
+ * @public
1090
+ */
1091
+ export declare type GlobalApiConfigProperties = 'environment' | 'fetchOptions' | 'clientId';
1092
+
1093
+ /**
1094
+ * Arguments for constructing identify events.
1095
+ *
1096
+ * @remarks
1097
+ * Traits are merged by the API; only specified properties may be overwritten.
1098
+ *
1099
+ * @public
1100
+ */
1101
+ export declare type IdentifyBuilderArgs = z.infer<typeof IdentifyBuilderArgs_2>;
1102
+
1103
+ declare const IdentifyBuilderArgs_2: z.ZodMiniObject<{
1104
+ campaign: z.ZodMiniOptional<z.ZodMiniObject<{
1105
+ name: z.ZodMiniOptional<z.ZodMiniString<string>>;
1106
+ source: z.ZodMiniOptional<z.ZodMiniString<string>>;
1107
+ medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
1108
+ term: z.ZodMiniOptional<z.ZodMiniString<string>>;
1109
+ content: z.ZodMiniOptional<z.ZodMiniString<string>>;
1110
+ }, z.core.$strip>>;
1111
+ locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
1112
+ location: z.ZodMiniOptional<z.ZodMiniObject<{
1113
+ coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
1114
+ latitude: z.ZodMiniNumber<number>;
1115
+ longitude: z.ZodMiniNumber<number>;
1116
+ }, z.core.$strip>>;
1117
+ city: z.ZodMiniOptional<z.ZodMiniString<string>>;
1118
+ postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
1119
+ region: z.ZodMiniOptional<z.ZodMiniString<string>>;
1120
+ regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
1121
+ country: z.ZodMiniOptional<z.ZodMiniString<string>>;
1122
+ countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
1123
+ continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
1124
+ timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
1125
+ }, z.core.$strip>>;
1126
+ page: z.ZodMiniOptional<z.ZodMiniObject<{
1127
+ path: z.ZodMiniString<string>;
1128
+ query: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
1129
+ referrer: z.ZodMiniString<string>;
1130
+ search: z.ZodMiniString<string>;
1131
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
1132
+ url: z.ZodMiniString<string>;
1133
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
1134
+ screen: z.ZodMiniOptional<z.ZodMiniObject<{
1135
+ name: z.ZodMiniString<string>;
1136
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
1137
+ userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
1138
+ traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>>;
1139
+ userId: z.ZodMiniString<string>;
1140
+ }, z.core.$strip>;
1141
+
1142
+ /**
1143
+ * Arguments for constructing identify events.
1144
+ *
1145
+ * @remarks
1146
+ * Traits are merged by the API; only specified properties may be overwritten.
1147
+ *
1148
+ * @public
1149
+ */
1150
+ declare type IdentifyBuilderArgs = z.infer<typeof IdentifyBuilderArgs_2>;
1151
+
1152
+ /**
1153
+ * Default base URL for the Insights ingest API.
1154
+ *
1155
+ * @public
1156
+ */
1157
+ export declare const INSIGHTS_BASE_URL = "https://ingest.insights.ninetailed.co/";
1158
+
1159
+ /**
1160
+ * Client for sending analytics and insights events to the Ninetailed Insights API.
1161
+ *
1162
+ * @remarks
1163
+ * This client is optimized for sending batched events, optionally using a
1164
+ * custom beacon-like handler when available.
1165
+ *
1166
+ * @example
1167
+ * ```ts
1168
+ * const insightsClient = new InsightsApiClient({
1169
+ * clientId: 'org-id',
1170
+ * environment: 'main',
1171
+ * })
1172
+ *
1173
+ * await insightsClient.sendBatchEvents([
1174
+ * {
1175
+ * profile: { id: 'profile-123', ... },
1176
+ * events: [
1177
+ * {
1178
+ * type: 'track',
1179
+ * event: 'button_clicked',
1180
+ * properties: { id: 'primary-cta' },
1181
+ * },
1182
+ * ],
1183
+ * }
1184
+ * ])
1185
+ * ```
1186
+ *
1187
+ * @see {@link ApiClientBase}
1188
+ *
1189
+ * @public
1190
+ */
1191
+ declare class InsightsApiClient extends ApiClientBase {
1192
+ /**
1193
+ * Base URL used for Insights API requests.
1194
+ */
1195
+ protected readonly baseUrl: string;
1196
+ /**
1197
+ * Optional handler used to enqueue events via the Beacon API or a similar mechanism.
1198
+ */
1199
+ private readonly beaconHandler;
1200
+ /**
1201
+ * Creates a new {@link InsightsApiClient} instance.
1202
+ *
1203
+ * @param config - Configuration for the Insights API client.
1204
+ *
1205
+ * @example
1206
+ * ```ts
1207
+ * const client = new InsightsApiClient({
1208
+ * clientId: 'org-id',
1209
+ * environment: 'main',
1210
+ * beaconHandler: (url, data) => {
1211
+ * return navigator.sendBeacon(url.toString(), JSON.stringify(data))
1212
+ * },
1213
+ * })
1214
+ * ```
1215
+ */
1216
+ constructor(config: InsightsApiClientConfig);
1217
+ /**
1218
+ * Sends batches of insights events to the Ninetailed Insights API.
1219
+ *
1220
+ * @param batches - Array of event batches to send.
1221
+ * @param options - Optional request options, including a per-call `beaconHandler`.
1222
+ * @returns `true` when the event batch is successfully queued by the beacon
1223
+ * handler or a direct request is successfully sent, `false` otherwise.
1224
+ *
1225
+ * @remarks
1226
+ * If a `beaconHandler` is provided (either in the method call or in the
1227
+ * client configuration) it will be invoked first. When the handler returns
1228
+ * `true`, the events are considered successfully queued and no network
1229
+ * request is made by this method.
1230
+ *
1231
+ * If the handler is missing or returns `false`, the events are emitted
1232
+ * immediately via `fetch`.
1233
+ *
1234
+ * @example
1235
+ * ```ts
1236
+ * const success = await insightsClient.sendBatchEvents(batches)
1237
+ * ```
1238
+ *
1239
+ * @example
1240
+ * ```ts
1241
+ * // Override beaconHandler for a single call
1242
+ * const success = await insightsClient.sendBatchEvents(batches, {
1243
+ * beaconHandler: (url, data) => {
1244
+ * return navigator.sendBeacon(url.toString(), JSON.stringify(data))
1245
+ * },
1246
+ * })
1247
+ * ```
1248
+ */
1249
+ sendBatchEvents(batches: BatchInsightsEventArray, options?: RequestOptions_2): Promise<boolean>;
1250
+ }
1251
+
1252
+ /**
1253
+ * Configuration for {@link InsightsApiClient}.
1254
+ *
1255
+ * @public
1256
+ */
1257
+ export declare interface InsightsApiClientConfig extends ApiConfig, RequestOptions_2 {
1258
+ }
1259
+
1260
+ /**
1261
+ * Arguments for constructing page view events.
1262
+ *
1263
+ * @remarks
1264
+ * Any properties passed here are merged with the base page properties from
1265
+ * {@link EventBuilderConfig.getPageProperties}.
1266
+ *
1267
+ * @public
1268
+ */
1269
+ export declare type PageViewBuilderArgs = z.infer<typeof PageViewBuilderArgs_2>;
1270
+
1271
+ declare const PageViewBuilderArgs_2: z.ZodMiniObject<{
1272
+ campaign: z.ZodMiniOptional<z.ZodMiniObject<{
1273
+ name: z.ZodMiniOptional<z.ZodMiniString<string>>;
1274
+ source: z.ZodMiniOptional<z.ZodMiniString<string>>;
1275
+ medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
1276
+ term: z.ZodMiniOptional<z.ZodMiniString<string>>;
1277
+ content: z.ZodMiniOptional<z.ZodMiniString<string>>;
1278
+ }, z.core.$strip>>;
1279
+ locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
1280
+ location: z.ZodMiniOptional<z.ZodMiniObject<{
1281
+ coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
1282
+ latitude: z.ZodMiniNumber<number>;
1283
+ longitude: z.ZodMiniNumber<number>;
1284
+ }, z.core.$strip>>;
1285
+ city: z.ZodMiniOptional<z.ZodMiniString<string>>;
1286
+ postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
1287
+ region: z.ZodMiniOptional<z.ZodMiniString<string>>;
1288
+ regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
1289
+ country: z.ZodMiniOptional<z.ZodMiniString<string>>;
1290
+ countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
1291
+ continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
1292
+ timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
1293
+ }, z.core.$strip>>;
1294
+ page: z.ZodMiniOptional<z.ZodMiniObject<{
1295
+ path: z.ZodMiniString<string>;
1296
+ query: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
1297
+ referrer: z.ZodMiniString<string>;
1298
+ search: z.ZodMiniString<string>;
1299
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
1300
+ url: z.ZodMiniString<string>;
1301
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
1302
+ screen: z.ZodMiniOptional<z.ZodMiniObject<{
1303
+ name: z.ZodMiniString<string>;
1304
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
1305
+ userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
1306
+ properties: z.ZodMiniOptional<z.ZodMiniObject<{
1307
+ path: z.ZodMiniOptional<z.ZodMiniString<string>>;
1308
+ query: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
1309
+ referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
1310
+ search: z.ZodMiniOptional<z.ZodMiniString<string>>;
1311
+ title: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniString<string>>>;
1312
+ url: z.ZodMiniOptional<z.ZodMiniString<string>>;
1313
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
1314
+ }, z.core.$strip>;
1315
+
1316
+ /**
1317
+ * Arguments for constructing page view events.
1318
+ *
1319
+ * @remarks
1320
+ * Any properties passed here are merged with the base page properties from
1321
+ * {@link EventBuilderConfig.getPageProperties}.
1322
+ *
1323
+ * @public
1324
+ */
1325
+ declare type PageViewBuilderArgs = z.infer<typeof PageViewBuilderArgs_2>;
1326
+
1327
+ /**
1328
+ * Options for {@link createProtectedFetchMethod}, combining timeout and retry behavior.
1329
+ *
1330
+ * @see {@link RetryFetchMethodOptions}
1331
+ * @see {@link TimeoutFetchMethodOptions}
1332
+ *
1333
+ * @public
1334
+ */
1335
+ declare interface ProtectedFetchMethodOptions extends RetryFetchMethodOptions, TimeoutFetchMethodOptions {
1336
+ }
1337
+
1338
+ /**
1339
+ * Options that control how requests to the Experience API are handled.
1340
+ *
1341
+ * @internal
1342
+ */
1343
+ declare interface RequestOptions {
1344
+ /**
1345
+ * Enabled features (for example, `"ip-enrichment"`) which the API should use for this request.
1346
+ *
1347
+ * @remarks
1348
+ * When omitted, a default set of features may be applied.
1349
+ */
1350
+ enabledFeatures?: Feature[];
1351
+ /**
1352
+ * IP address to override the API behavior for IP analysis.
1353
+ *
1354
+ * @remarks
1355
+ * Commonly used in ESR or SSR environments, as the API would otherwise use
1356
+ * the server IP.
1357
+ */
1358
+ ip?: string;
1359
+ /**
1360
+ * Locale used to translate `location.city` and `location.country`.
1361
+ *
1362
+ * @remarks
1363
+ * When omitted, a server-side default may be used.
1364
+ */
1365
+ locale?: string;
1366
+ /**
1367
+ * When `true`, sends performance-critical endpoints in plain text.
1368
+ *
1369
+ * @remarks
1370
+ * The Ninetailed API accepts certain endpoints in plain text to avoid CORS
1371
+ * preflight requests, which can improve performance in browser environments.
1372
+ */
1373
+ plainText?: boolean;
1374
+ /**
1375
+ * When `true`, instructs the API to aggregate a new profile state but not store it.
1376
+ *
1377
+ * @remarks
1378
+ * This is commonly used in ESR or SSR environments where you want to
1379
+ * preview the result without persisting changes.
1380
+ */
1381
+ preflight?: boolean;
1382
+ }
1383
+
1384
+ /**
1385
+ * Options that control how Insights events are sent.
1386
+ *
1387
+ * @internal
1388
+ */
1389
+ declare interface RequestOptions_2 {
1390
+ /**
1391
+ * Handler used to enqueue events via the Beacon API or a similar mechanism.
1392
+ *
1393
+ * @param url - Target URL for the batched events.
1394
+ * @param data - Array of batched insights events to be sent.
1395
+ * @returns `true` if the events were successfully queued, `false` otherwise.
1396
+ *
1397
+ * @remarks
1398
+ * When provided, this handler is preferred over direct `fetch` calls. If it
1399
+ * returns `false`, the client falls back to emitting events immediately via
1400
+ * `fetch`.
1401
+ */
1402
+ beaconHandler?: (url: string | URL, data: BatchInsightsEventArray) => boolean;
1403
+ }
1404
+
1405
+ /**
1406
+ * Configuration options for {@link createRetryFetchMethod}.
1407
+ *
1408
+ * @public
1409
+ */
1410
+ declare interface RetryFetchMethodOptions extends BaseFetchMethodOptions {
1411
+ /**
1412
+ * Delay (in milliseconds) between retry attempts.
1413
+ *
1414
+ * @defaultValue `0`
1415
+ */
1416
+ intervalTimeout?: number;
1417
+ /**
1418
+ * Callback invoked whenever a retry attempt fails.
1419
+ *
1420
+ * @param options - Information about the failed attempt.
1421
+ *
1422
+ * @remarks
1423
+ * This callback is invoked with additional metadata such as the attempt
1424
+ * number and the number of retries left.
1425
+ */
1426
+ onFailedAttempt?: (options: FetchMethodCallbackOptions) => void;
1427
+ /**
1428
+ * Maximum number of retry attempts.
1429
+ *
1430
+ * @defaultValue `1`
1431
+ */
1432
+ retries?: number;
1433
+ }
1434
+
1435
+ /**
1436
+ * Arguments for constructing screen view events.
1437
+ *
1438
+ * @remarks
1439
+ * Any properties passed here are merged with the base screen properties from
1440
+ * {@link EventBuilderConfig.getScreenProperties}.
1441
+ *
1442
+ * @public
1443
+ */
1444
+ export declare type ScreenViewBuilderArgs = z.infer<typeof ScreenViewBuilderArgs_2>;
1445
+
1446
+ declare const ScreenViewBuilderArgs_2: z.ZodMiniObject<{
1447
+ campaign: z.ZodMiniOptional<z.ZodMiniObject<{
1448
+ name: z.ZodMiniOptional<z.ZodMiniString<string>>;
1449
+ source: z.ZodMiniOptional<z.ZodMiniString<string>>;
1450
+ medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
1451
+ term: z.ZodMiniOptional<z.ZodMiniString<string>>;
1452
+ content: z.ZodMiniOptional<z.ZodMiniString<string>>;
1453
+ }, z.core.$strip>>;
1454
+ locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
1455
+ location: z.ZodMiniOptional<z.ZodMiniObject<{
1456
+ coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
1457
+ latitude: z.ZodMiniNumber<number>;
1458
+ longitude: z.ZodMiniNumber<number>;
1459
+ }, z.core.$strip>>;
1460
+ city: z.ZodMiniOptional<z.ZodMiniString<string>>;
1461
+ postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
1462
+ region: z.ZodMiniOptional<z.ZodMiniString<string>>;
1463
+ regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
1464
+ country: z.ZodMiniOptional<z.ZodMiniString<string>>;
1465
+ countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
1466
+ continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
1467
+ timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
1468
+ }, z.core.$strip>>;
1469
+ page: z.ZodMiniOptional<z.ZodMiniObject<{
1470
+ path: z.ZodMiniString<string>;
1471
+ query: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
1472
+ referrer: z.ZodMiniString<string>;
1473
+ search: z.ZodMiniString<string>;
1474
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
1475
+ url: z.ZodMiniString<string>;
1476
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
1477
+ screen: z.ZodMiniOptional<z.ZodMiniObject<{
1478
+ name: z.ZodMiniString<string>;
1479
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
1480
+ userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
1481
+ name: z.ZodMiniString<string>;
1482
+ properties: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>;
1483
+ }, z.core.$strip>;
1484
+
1485
+ /**
1486
+ * Arguments for constructing screen view events.
1487
+ *
1488
+ * @remarks
1489
+ * Any properties passed here are merged with the base screen properties from
1490
+ * {@link EventBuilderConfig.getScreenProperties}.
1491
+ *
1492
+ * @public
1493
+ */
1494
+ declare type ScreenViewBuilderArgs = z.infer<typeof ScreenViewBuilderArgs_2>;
1495
+
1496
+ /**
1497
+ * Configuration options for {@link createTimeoutFetchMethod}.
1498
+ *
1499
+ * @public
1500
+ */
1501
+ declare interface TimeoutFetchMethodOptions extends BaseFetchMethodOptions {
1502
+ /**
1503
+ * Callback invoked when a request exceeds the configured timeout.
1504
+ *
1505
+ * @param options - Information about the timed-out request.
1506
+ *
1507
+ * @remarks
1508
+ * If this callback is not provided, a default error is logged.
1509
+ *
1510
+ * @see {@link FetchMethodCallbackOptions}
1511
+ */
1512
+ onRequestTimeout?: (options: FetchMethodCallbackOptions) => void;
1513
+ /**
1514
+ * Maximum time (in milliseconds) to wait for a response before aborting the request.
1515
+ *
1516
+ * @defaultValue `3000`
1517
+ */
1518
+ requestTimeout?: number;
1519
+ }
1520
+
1521
+ /**
1522
+ * Arguments for constructing track events.
1523
+ *
1524
+ * @public
1525
+ */
1526
+ export declare type TrackBuilderArgs = z.infer<typeof TrackBuilderArgs_2>;
1527
+
1528
+ declare const TrackBuilderArgs_2: z.ZodMiniObject<{
1529
+ campaign: z.ZodMiniOptional<z.ZodMiniObject<{
1530
+ name: z.ZodMiniOptional<z.ZodMiniString<string>>;
1531
+ source: z.ZodMiniOptional<z.ZodMiniString<string>>;
1532
+ medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
1533
+ term: z.ZodMiniOptional<z.ZodMiniString<string>>;
1534
+ content: z.ZodMiniOptional<z.ZodMiniString<string>>;
1535
+ }, z.core.$strip>>;
1536
+ locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
1537
+ location: z.ZodMiniOptional<z.ZodMiniObject<{
1538
+ coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
1539
+ latitude: z.ZodMiniNumber<number>;
1540
+ longitude: z.ZodMiniNumber<number>;
1541
+ }, z.core.$strip>>;
1542
+ city: z.ZodMiniOptional<z.ZodMiniString<string>>;
1543
+ postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
1544
+ region: z.ZodMiniOptional<z.ZodMiniString<string>>;
1545
+ regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
1546
+ country: z.ZodMiniOptional<z.ZodMiniString<string>>;
1547
+ countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
1548
+ continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
1549
+ timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
1550
+ }, z.core.$strip>>;
1551
+ page: z.ZodMiniOptional<z.ZodMiniObject<{
1552
+ path: z.ZodMiniString<string>;
1553
+ query: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
1554
+ referrer: z.ZodMiniString<string>;
1555
+ search: z.ZodMiniString<string>;
1556
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
1557
+ url: z.ZodMiniString<string>;
1558
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
1559
+ screen: z.ZodMiniOptional<z.ZodMiniObject<{
1560
+ name: z.ZodMiniString<string>;
1561
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
1562
+ userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
1563
+ event: z.ZodMiniString<string>;
1564
+ properties: z.ZodMiniOptional<z.ZodMiniPrefault<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>>>;
1565
+ }, z.core.$strip>;
1566
+
1567
+ /**
1568
+ * Arguments for constructing track events.
1569
+ *
1570
+ * @public
1571
+ */
1572
+ declare type TrackBuilderArgs = z.infer<typeof TrackBuilderArgs_2>;
1573
+
1574
+ /**
1575
+ * Arguments used to construct the universal (shared) portion of all events.
1576
+ *
1577
+ * @public
1578
+ */
1579
+ export declare type UniversalEventBuilderArgs = z.infer<typeof UniversalEventBuilderArgs_2>;
1580
+
1581
+ declare const UniversalEventBuilderArgs_2: z.ZodMiniObject<{
1582
+ campaign: z.ZodMiniOptional<z.ZodMiniObject<{
1583
+ name: z.ZodMiniOptional<z.ZodMiniString<string>>;
1584
+ source: z.ZodMiniOptional<z.ZodMiniString<string>>;
1585
+ medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
1586
+ term: z.ZodMiniOptional<z.ZodMiniString<string>>;
1587
+ content: z.ZodMiniOptional<z.ZodMiniString<string>>;
1588
+ }, z.core.$strip>>;
1589
+ locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
1590
+ location: z.ZodMiniOptional<z.ZodMiniObject<{
1591
+ coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
1592
+ latitude: z.ZodMiniNumber<number>;
1593
+ longitude: z.ZodMiniNumber<number>;
1594
+ }, z.core.$strip>>;
1595
+ city: z.ZodMiniOptional<z.ZodMiniString<string>>;
1596
+ postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
1597
+ region: z.ZodMiniOptional<z.ZodMiniString<string>>;
1598
+ regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
1599
+ country: z.ZodMiniOptional<z.ZodMiniString<string>>;
1600
+ countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
1601
+ continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
1602
+ timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
1603
+ }, z.core.$strip>>;
1604
+ page: z.ZodMiniOptional<z.ZodMiniObject<{
1605
+ path: z.ZodMiniString<string>;
1606
+ query: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
1607
+ referrer: z.ZodMiniString<string>;
1608
+ search: z.ZodMiniString<string>;
1609
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
1610
+ url: z.ZodMiniString<string>;
1611
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
1612
+ screen: z.ZodMiniOptional<z.ZodMiniObject<{
1613
+ name: z.ZodMiniString<string>;
1614
+ }, z.core.$catchall<z.ZodMiniJSONSchema>>>;
1615
+ userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
1616
+ }, z.core.$strip>;
1617
+
1618
+ /**
1619
+ * Arguments used to construct the universal (shared) portion of all events.
1620
+ *
1621
+ * @public
1622
+ */
1623
+ declare type UniversalEventBuilderArgs = z.infer<typeof UniversalEventBuilderArgs_2>;
1624
+
1625
+ /**
1626
+ * Parameters used when updating an existing profile.
1627
+ *
1628
+ * @internal
1629
+ */
1630
+ declare interface UpdateProfileParams extends CreateProfileParams {
1631
+ /**
1632
+ * ID of the profile to update.
1633
+ */
1634
+ profileId: string;
1635
+ }
1636
+
1637
+ /**
1638
+ * Parameters used when creating or updating a profile.
1639
+ *
1640
+ * @internal
1641
+ */
1642
+ declare interface UpsertProfileParams extends CreateProfileParams {
1643
+ /**
1644
+ * Optional ID of the profile; when omitted, a new profile is created.
1645
+ */
1646
+ profileId?: string;
1647
+ }
1648
+
1649
+ export { }