@algolia/client-insights 5.7.0 → 5.8.1

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 (39) hide show
  1. package/README.md +5 -7
  2. package/dist/browser.d.ts +99 -98
  3. package/dist/builds/browser.js +5 -11
  4. package/dist/builds/browser.js.map +1 -1
  5. package/dist/builds/browser.min.js +1 -1
  6. package/dist/builds/browser.min.js.map +1 -1
  7. package/dist/builds/browser.umd.js +2 -2
  8. package/dist/builds/fetch.js +2 -8
  9. package/dist/builds/fetch.js.map +1 -1
  10. package/dist/builds/node.cjs +2 -8
  11. package/dist/builds/node.cjs.map +1 -1
  12. package/dist/builds/node.js +3 -9
  13. package/dist/builds/node.js.map +1 -1
  14. package/dist/fetch.d.ts +98 -96
  15. package/dist/node.d.cts +98 -96
  16. package/dist/node.d.ts +98 -96
  17. package/dist/src/insightsClient.cjs +1 -7
  18. package/dist/src/insightsClient.cjs.map +1 -1
  19. package/dist/src/insightsClient.js +1 -7
  20. package/dist/src/insightsClient.js.map +1 -1
  21. package/index.d.ts +0 -1
  22. package/index.js +1 -2
  23. package/model/addedToCartObjectIDs.ts +2 -2
  24. package/model/addedToCartObjectIDsAfterSearch.ts +2 -2
  25. package/model/clickedFilters.ts +1 -1
  26. package/model/clickedObjectIDs.ts +1 -1
  27. package/model/clickedObjectIDsAfterSearch.ts +2 -2
  28. package/model/clientMethodProps.ts +4 -4
  29. package/model/convertedFilters.ts +1 -1
  30. package/model/convertedObjectIDs.ts +1 -1
  31. package/model/convertedObjectIDsAfterSearch.ts +1 -1
  32. package/model/eventsItems.ts +11 -9
  33. package/model/index.ts +5 -5
  34. package/model/insightsEvents.ts +1 -1
  35. package/model/purchasedObjectIDs.ts +2 -2
  36. package/model/purchasedObjectIDsAfterSearch.ts +2 -2
  37. package/model/viewedFilters.ts +1 -1
  38. package/model/viewedObjectIDs.ts +1 -1
  39. package/package.json +6 -6
package/dist/node.d.cts CHANGED
@@ -1,76 +1,6 @@
1
1
  import * as _algolia_client_common from '@algolia/client-common';
2
2
  import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
3
3
 
4
- /**
5
- * Properties for the `customDelete` method.
6
- */
7
- type CustomDeleteProps = {
8
- /**
9
- * Path of the endpoint, anything after \"/1\" must be specified.
10
- */
11
- path: string;
12
- /**
13
- * Query parameters to apply to the current query.
14
- */
15
- parameters?: Record<string, any>;
16
- };
17
- /**
18
- * Properties for the `customGet` method.
19
- */
20
- type CustomGetProps = {
21
- /**
22
- * Path of the endpoint, anything after \"/1\" must be specified.
23
- */
24
- path: string;
25
- /**
26
- * Query parameters to apply to the current query.
27
- */
28
- parameters?: Record<string, any>;
29
- };
30
- /**
31
- * Properties for the `customPost` method.
32
- */
33
- type CustomPostProps = {
34
- /**
35
- * Path of the endpoint, anything after \"/1\" must be specified.
36
- */
37
- path: string;
38
- /**
39
- * Query parameters to apply to the current query.
40
- */
41
- parameters?: Record<string, any>;
42
- /**
43
- * Parameters to send with the custom request.
44
- */
45
- body?: Record<string, unknown>;
46
- };
47
- /**
48
- * Properties for the `customPut` method.
49
- */
50
- type CustomPutProps = {
51
- /**
52
- * Path of the endpoint, anything after \"/1\" must be specified.
53
- */
54
- path: string;
55
- /**
56
- * Query parameters to apply to the current query.
57
- */
58
- parameters?: Record<string, any>;
59
- /**
60
- * Parameters to send with the custom request.
61
- */
62
- body?: Record<string, unknown>;
63
- };
64
- /**
65
- * Properties for the `deleteUserToken` method.
66
- */
67
- type DeleteUserTokenProps = {
68
- /**
69
- * User token for which to delete all associated events.
70
- */
71
- userToken: string;
72
- };
73
-
74
4
  /**
75
5
  * The response of the Insights API.
76
6
  */
@@ -130,7 +60,7 @@ type AddedToCartObjectIDs = {
130
60
  /**
131
61
  * Object IDs of the records that are part of the event.
132
62
  */
133
- objectIDs: string[];
63
+ objectIDs: Array<string>;
134
64
  /**
135
65
  * Anonymous or pseudonymous user identifier. Don\'t use personally identifiable information in user tokens. For more information, see [User token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
136
66
  */
@@ -146,7 +76,7 @@ type AddedToCartObjectIDs = {
146
76
  /**
147
77
  * Extra information about the records involved in a purchase or add-to-cart event. If specified, it must have the same length as `objectIDs`.
148
78
  */
149
- objectData?: ObjectData[];
79
+ objectData?: Array<ObjectData>;
150
80
  /**
151
81
  * Timestamp of the event, measured in milliseconds since the Unix epoch. By default, the Insights API uses the time it receives an event as its timestamp.
152
82
  */
@@ -188,7 +118,7 @@ type AddedToCartObjectIDsAfterSearch = {
188
118
  /**
189
119
  * Object IDs of the records that are part of the event.
190
120
  */
191
- objectIDs: string[];
121
+ objectIDs: Array<string>;
192
122
  /**
193
123
  * Anonymous or pseudonymous user identifier. Don\'t use personally identifiable information in user tokens. For more information, see [User token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
194
124
  */
@@ -204,7 +134,7 @@ type AddedToCartObjectIDsAfterSearch = {
204
134
  /**
205
135
  * Extra information about the records involved in a purchase or add-to-cart events. If provided, it must be the same length as `objectIDs`.
206
136
  */
207
- objectData?: ObjectDataAfterSearch[];
137
+ objectData?: Array<ObjectDataAfterSearch>;
208
138
  /**
209
139
  * Timestamp of the event, measured in milliseconds since the Unix epoch. By default, the Insights API uses the time it receives an event as its timestamp.
210
140
  */
@@ -230,7 +160,7 @@ type ClickedFilters = {
230
160
  /**
231
161
  * Applied facet filters. Facet filters are `facet:value` pairs. Facet values must be URL-encoded, such as, `discount:10%25`.
232
162
  */
233
- filters: string[];
163
+ filters: Array<string>;
234
164
  /**
235
165
  * Anonymous or pseudonymous user identifier. Don\'t use personally identifiable information in user tokens. For more information, see [User token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
236
166
  */
@@ -261,7 +191,7 @@ type ClickedObjectIDs = {
261
191
  /**
262
192
  * Object IDs of the records that are part of the event.
263
193
  */
264
- objectIDs: string[];
194
+ objectIDs: Array<string>;
265
195
  /**
266
196
  * Anonymous or pseudonymous user identifier. Don\'t use personally identifiable information in user tokens. For more information, see [User token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
267
197
  */
@@ -292,11 +222,11 @@ type ClickedObjectIDsAfterSearch = {
292
222
  /**
293
223
  * Object IDs of the records that are part of the event.
294
224
  */
295
- objectIDs: string[];
225
+ objectIDs: Array<string>;
296
226
  /**
297
227
  * Position of the clicked item the search results. You must provide 1 `position` for each `objectID`.
298
228
  */
299
- positions: number[];
229
+ positions: Array<number>;
300
230
  /**
301
231
  * Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response.
302
232
  */
@@ -328,7 +258,7 @@ type ConvertedFilters = {
328
258
  /**
329
259
  * Applied facet filters. Facet filters are `facet:value` pairs. Facet values must be URL-encoded, such as, `discount:10%25`.
330
260
  */
331
- filters: string[];
261
+ filters: Array<string>;
332
262
  /**
333
263
  * Anonymous or pseudonymous user identifier. Don\'t use personally identifiable information in user tokens. For more information, see [User token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
334
264
  */
@@ -359,7 +289,7 @@ type ConvertedObjectIDs = {
359
289
  /**
360
290
  * Object IDs of the records that are part of the event.
361
291
  */
362
- objectIDs: string[];
292
+ objectIDs: Array<string>;
363
293
  /**
364
294
  * Anonymous or pseudonymous user identifier. Don\'t use personally identifiable information in user tokens. For more information, see [User token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
365
295
  */
@@ -390,7 +320,7 @@ type ConvertedObjectIDsAfterSearch = {
390
320
  /**
391
321
  * Object IDs of the records that are part of the event.
392
322
  */
393
- objectIDs: string[];
323
+ objectIDs: Array<string>;
394
324
  /**
395
325
  * Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response.
396
326
  */
@@ -428,7 +358,7 @@ type PurchasedObjectIDs = {
428
358
  /**
429
359
  * Object IDs of the records that are part of the event.
430
360
  */
431
- objectIDs: string[];
361
+ objectIDs: Array<string>;
432
362
  /**
433
363
  * Anonymous or pseudonymous user identifier. Don\'t use personally identifiable information in user tokens. For more information, see [User token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
434
364
  */
@@ -444,7 +374,7 @@ type PurchasedObjectIDs = {
444
374
  /**
445
375
  * Extra information about the records involved in a purchase or add-to-cart event. If specified, it must have the same length as `objectIDs`.
446
376
  */
447
- objectData?: ObjectData[];
377
+ objectData?: Array<ObjectData>;
448
378
  /**
449
379
  * Timestamp of the event, measured in milliseconds since the Unix epoch. By default, the Insights API uses the time it receives an event as its timestamp.
450
380
  */
@@ -469,7 +399,7 @@ type PurchasedObjectIDsAfterSearch = {
469
399
  /**
470
400
  * Object IDs of the records that are part of the event.
471
401
  */
472
- objectIDs: string[];
402
+ objectIDs: Array<string>;
473
403
  /**
474
404
  * Anonymous or pseudonymous user identifier. Don\'t use personally identifiable information in user tokens. For more information, see [User token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
475
405
  */
@@ -485,7 +415,7 @@ type PurchasedObjectIDsAfterSearch = {
485
415
  /**
486
416
  * Extra information about the records involved in a purchase or add-to-cart events. If provided, it must be the same length as `objectIDs`.
487
417
  */
488
- objectData: ObjectDataAfterSearch[];
418
+ objectData: Array<ObjectDataAfterSearch>;
489
419
  /**
490
420
  * Timestamp of the event, measured in milliseconds since the Unix epoch. By default, the Insights API uses the time it receives an event as its timestamp.
491
421
  */
@@ -511,7 +441,7 @@ type ViewedFilters = {
511
441
  /**
512
442
  * Applied facet filters. Facet filters are `facet:value` pairs. Facet values must be URL-encoded, such as, `discount:10%25`.
513
443
  */
514
- filters: string[];
444
+ filters: Array<string>;
515
445
  /**
516
446
  * Anonymous or pseudonymous user identifier. Don\'t use personally identifiable information in user tokens. For more information, see [User token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
517
447
  */
@@ -542,7 +472,7 @@ type ViewedObjectIDs = {
542
472
  /**
543
473
  * Object IDs of the records that are part of the event.
544
474
  */
545
- objectIDs: string[];
475
+ objectIDs: Array<string>;
546
476
  /**
547
477
  * Anonymous or pseudonymous user identifier. Don\'t use personally identifiable information in user tokens. For more information, see [User token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
548
478
  */
@@ -557,16 +487,94 @@ type ViewedObjectIDs = {
557
487
  timestamp?: number;
558
488
  };
559
489
 
560
- type EventsItems = AddedToCartObjectIDs | AddedToCartObjectIDsAfterSearch | ClickedFilters | ClickedObjectIDs | ClickedObjectIDsAfterSearch | ConvertedFilters | ConvertedObjectIDs | ConvertedObjectIDsAfterSearch | PurchasedObjectIDs | PurchasedObjectIDsAfterSearch | ViewedFilters | ViewedObjectIDs;
490
+ type EventsItems = ClickedObjectIDsAfterSearch | AddedToCartObjectIDsAfterSearch | PurchasedObjectIDsAfterSearch | ConvertedObjectIDsAfterSearch | ClickedObjectIDs | PurchasedObjectIDs | AddedToCartObjectIDs | ConvertedObjectIDs | ClickedFilters | ConvertedFilters | ViewedObjectIDs | ViewedFilters;
561
491
 
562
492
  type InsightsEvents = {
563
493
  /**
564
494
  * Click and conversion events. **All** events must be valid, otherwise the API returns an error.
565
495
  */
566
- events: EventsItems[];
496
+ events: Array<EventsItems>;
497
+ };
498
+
499
+ /**
500
+ * Properties for the `customDelete` method.
501
+ */
502
+ type CustomDeleteProps = {
503
+ /**
504
+ * Path of the endpoint, anything after \"/1\" must be specified.
505
+ */
506
+ path: string;
507
+ /**
508
+ * Query parameters to apply to the current query.
509
+ */
510
+ parameters?: {
511
+ [key: string]: any;
512
+ };
513
+ };
514
+ /**
515
+ * Properties for the `customGet` method.
516
+ */
517
+ type CustomGetProps = {
518
+ /**
519
+ * Path of the endpoint, anything after \"/1\" must be specified.
520
+ */
521
+ path: string;
522
+ /**
523
+ * Query parameters to apply to the current query.
524
+ */
525
+ parameters?: {
526
+ [key: string]: any;
527
+ };
528
+ };
529
+ /**
530
+ * Properties for the `customPost` method.
531
+ */
532
+ type CustomPostProps = {
533
+ /**
534
+ * Path of the endpoint, anything after \"/1\" must be specified.
535
+ */
536
+ path: string;
537
+ /**
538
+ * Query parameters to apply to the current query.
539
+ */
540
+ parameters?: {
541
+ [key: string]: any;
542
+ };
543
+ /**
544
+ * Parameters to send with the custom request.
545
+ */
546
+ body?: Record<string, unknown>;
547
+ };
548
+ /**
549
+ * Properties for the `customPut` method.
550
+ */
551
+ type CustomPutProps = {
552
+ /**
553
+ * Path of the endpoint, anything after \"/1\" must be specified.
554
+ */
555
+ path: string;
556
+ /**
557
+ * Query parameters to apply to the current query.
558
+ */
559
+ parameters?: {
560
+ [key: string]: any;
561
+ };
562
+ /**
563
+ * Parameters to send with the custom request.
564
+ */
565
+ body?: Record<string, unknown>;
566
+ };
567
+ /**
568
+ * Properties for the `deleteUserToken` method.
569
+ */
570
+ type DeleteUserTokenProps = {
571
+ /**
572
+ * User token for which to delete all associated events.
573
+ */
574
+ userToken: string;
567
575
  };
568
576
 
569
- declare const apiClientVersion = "5.7.0";
577
+ declare const apiClientVersion = "5.8.1";
570
578
  declare const REGIONS: readonly ["de", "us"];
571
579
  type Region = (typeof REGIONS)[number];
572
580
  declare function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & {
@@ -603,7 +611,6 @@ declare function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption
603
611
  }): void;
604
612
  /**
605
613
  * This method allow you to send requests to the Algolia REST API.
606
- *
607
614
  * @param customDelete - The customDelete object.
608
615
  * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
609
616
  * @param customDelete.parameters - Query parameters to apply to the current query.
@@ -612,7 +619,6 @@ declare function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption
612
619
  customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
613
620
  /**
614
621
  * This method allow you to send requests to the Algolia REST API.
615
- *
616
622
  * @param customGet - The customGet object.
617
623
  * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
618
624
  * @param customGet.parameters - Query parameters to apply to the current query.
@@ -621,7 +627,6 @@ declare function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption
621
627
  customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
622
628
  /**
623
629
  * This method allow you to send requests to the Algolia REST API.
624
- *
625
630
  * @param customPost - The customPost object.
626
631
  * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
627
632
  * @param customPost.parameters - Query parameters to apply to the current query.
@@ -631,7 +636,6 @@ declare function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption
631
636
  customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
632
637
  /**
633
638
  * This method allow you to send requests to the Algolia REST API.
634
- *
635
639
  * @param customPut - The customPut object.
636
640
  * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
637
641
  * @param customPut.parameters - Query parameters to apply to the current query.
@@ -641,7 +645,6 @@ declare function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption
641
645
  customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
642
646
  /**
643
647
  * Deletes all events related to the specified user token from events metrics and analytics. The deletion is asynchronous, and processed within 48 hours. To delete a personalization user profile, see `Delete a user profile` in the Personalization API.
644
- *
645
648
  * @param deleteUserToken - The deleteUserToken object.
646
649
  * @param deleteUserToken.userToken - User token for which to delete all associated events.
647
650
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
@@ -649,7 +652,6 @@ declare function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption
649
652
  deleteUserToken({ userToken }: DeleteUserTokenProps, requestOptions?: RequestOptions): Promise<void>;
650
653
  /**
651
654
  * Sends a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2&nbsp;MB.
652
- *
653
655
  * @param insightsEvents - The insightsEvents object.
654
656
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
655
657
  */