@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.
- package/README.md +5 -7
- package/dist/browser.d.ts +99 -98
- package/dist/builds/browser.js +5 -11
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +1 -1
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +2 -2
- package/dist/builds/fetch.js +2 -8
- package/dist/builds/fetch.js.map +1 -1
- package/dist/builds/node.cjs +2 -8
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +3 -9
- package/dist/builds/node.js.map +1 -1
- package/dist/fetch.d.ts +98 -96
- package/dist/node.d.cts +98 -96
- package/dist/node.d.ts +98 -96
- package/dist/src/insightsClient.cjs +1 -7
- package/dist/src/insightsClient.cjs.map +1 -1
- package/dist/src/insightsClient.js +1 -7
- package/dist/src/insightsClient.js.map +1 -1
- package/index.d.ts +0 -1
- package/index.js +1 -2
- package/model/addedToCartObjectIDs.ts +2 -2
- package/model/addedToCartObjectIDsAfterSearch.ts +2 -2
- package/model/clickedFilters.ts +1 -1
- package/model/clickedObjectIDs.ts +1 -1
- package/model/clickedObjectIDsAfterSearch.ts +2 -2
- package/model/clientMethodProps.ts +4 -4
- package/model/convertedFilters.ts +1 -1
- package/model/convertedObjectIDs.ts +1 -1
- package/model/convertedObjectIDsAfterSearch.ts +1 -1
- package/model/eventsItems.ts +11 -9
- package/model/index.ts +5 -5
- package/model/insightsEvents.ts +1 -1
- package/model/purchasedObjectIDs.ts +2 -2
- package/model/purchasedObjectIDsAfterSearch.ts +2 -2
- package/model/viewedFilters.ts +1 -1
- package/model/viewedObjectIDs.ts +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -32,19 +32,17 @@
|
|
|
32
32
|
|
|
33
33
|
## 💡 Getting Started
|
|
34
34
|
|
|
35
|
-
|
|
36
35
|
To get started, you first need to install @algolia/client-insights (or any other available API client package).
|
|
37
36
|
All of our clients comes with type definition, and are available for both browser and node environments.
|
|
38
37
|
|
|
39
38
|
### With a package manager
|
|
40
39
|
|
|
41
|
-
|
|
42
40
|
```bash
|
|
43
|
-
yarn add @algolia/client-insights@5.
|
|
41
|
+
yarn add @algolia/client-insights@5.8.1
|
|
44
42
|
# or
|
|
45
|
-
npm install @algolia/client-insights@5.
|
|
43
|
+
npm install @algolia/client-insights@5.8.1
|
|
46
44
|
# or
|
|
47
|
-
pnpm add @algolia/client-insights@5.
|
|
45
|
+
pnpm add @algolia/client-insights@5.8.1
|
|
48
46
|
```
|
|
49
47
|
|
|
50
48
|
### Without a package manager
|
|
@@ -52,7 +50,7 @@ pnpm add @algolia/client-insights@5.7.0
|
|
|
52
50
|
Add the following JavaScript snippet to the <head> of your website:
|
|
53
51
|
|
|
54
52
|
```html
|
|
55
|
-
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-insights@5.
|
|
53
|
+
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-insights@5.8.1/dist/builds/browser.umd.js"></script>
|
|
56
54
|
```
|
|
57
55
|
|
|
58
56
|
### Usage
|
|
@@ -73,4 +71,4 @@ Encountering an issue? Before reaching out to support, we recommend heading to o
|
|
|
73
71
|
|
|
74
72
|
## 📄 License
|
|
75
73
|
|
|
76
|
-
The Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE).
|
|
74
|
+
The Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE).
|
package/dist/browser.d.ts
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 =
|
|
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>;
|
|
567
497
|
};
|
|
568
498
|
|
|
569
|
-
|
|
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;
|
|
575
|
+
};
|
|
576
|
+
|
|
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 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
|
*/
|
|
@@ -663,8 +665,7 @@ type ErrorBase = Record<string, any> & {
|
|
|
663
665
|
message?: string;
|
|
664
666
|
};
|
|
665
667
|
|
|
666
|
-
type InsightsClient = ReturnType<typeof createInsightsClient>;
|
|
667
|
-
|
|
668
668
|
declare function insightsClient(appId: string, apiKey: string, region?: Region, options?: ClientOptions): InsightsClient;
|
|
669
|
+
type InsightsClient = ReturnType<typeof createInsightsClient>;
|
|
669
670
|
|
|
670
671
|
export { type AddToCartEvent, type AddedToCartObjectIDs, type AddedToCartObjectIDsAfterSearch, type ClickEvent, type ClickedFilters, type ClickedObjectIDs, type ClickedObjectIDsAfterSearch, type ConversionEvent, type ConvertedFilters, type ConvertedObjectIDs, type ConvertedObjectIDsAfterSearch, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type DeleteUserTokenProps, type Discount, type ErrorBase, type EventsItems, type EventsResponse, type InsightsClient, type InsightsEvents, type ObjectData, type ObjectDataAfterSearch, type Price, type PurchaseEvent, type PurchasedObjectIDs, type PurchasedObjectIDsAfterSearch, type Region, type Value, type ViewEvent, type ViewedFilters, type ViewedObjectIDs, apiClientVersion, insightsClient };
|
package/dist/builds/browser.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// builds/browser.ts
|
|
2
|
+
import { createXhrRequester } from "@algolia/requester-browser-xhr";
|
|
2
3
|
import {
|
|
3
|
-
createNullLogger,
|
|
4
|
-
createMemoryCache,
|
|
5
|
-
createFallbackableCache,
|
|
6
4
|
createBrowserLocalStorageCache,
|
|
5
|
+
createFallbackableCache,
|
|
6
|
+
createMemoryCache,
|
|
7
|
+
createNullLogger,
|
|
7
8
|
DEFAULT_CONNECT_TIMEOUT_BROWSER,
|
|
8
9
|
DEFAULT_READ_TIMEOUT_BROWSER,
|
|
9
10
|
DEFAULT_WRITE_TIMEOUT_BROWSER
|
|
10
11
|
} from "@algolia/client-common";
|
|
11
|
-
import { createXhrRequester } from "@algolia/requester-browser-xhr";
|
|
12
12
|
|
|
13
13
|
// src/insightsClient.ts
|
|
14
14
|
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
|
|
15
|
-
var apiClientVersion = "5.
|
|
15
|
+
var apiClientVersion = "5.8.1";
|
|
16
16
|
var REGIONS = ["de", "us"];
|
|
17
17
|
function getDefaultHosts(region) {
|
|
18
18
|
const url = !region ? "insights.algolia.io" : "insights.{region}.algolia.io".replace("{region}", region);
|
|
@@ -87,7 +87,6 @@ function createInsightsClient({
|
|
|
87
87
|
},
|
|
88
88
|
/**
|
|
89
89
|
* This method allow you to send requests to the Algolia REST API.
|
|
90
|
-
*
|
|
91
90
|
* @param customDelete - The customDelete object.
|
|
92
91
|
* @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
93
92
|
* @param customDelete.parameters - Query parameters to apply to the current query.
|
|
@@ -110,7 +109,6 @@ function createInsightsClient({
|
|
|
110
109
|
},
|
|
111
110
|
/**
|
|
112
111
|
* This method allow you to send requests to the Algolia REST API.
|
|
113
|
-
*
|
|
114
112
|
* @param customGet - The customGet object.
|
|
115
113
|
* @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
116
114
|
* @param customGet.parameters - Query parameters to apply to the current query.
|
|
@@ -133,7 +131,6 @@ function createInsightsClient({
|
|
|
133
131
|
},
|
|
134
132
|
/**
|
|
135
133
|
* This method allow you to send requests to the Algolia REST API.
|
|
136
|
-
*
|
|
137
134
|
* @param customPost - The customPost object.
|
|
138
135
|
* @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
139
136
|
* @param customPost.parameters - Query parameters to apply to the current query.
|
|
@@ -158,7 +155,6 @@ function createInsightsClient({
|
|
|
158
155
|
},
|
|
159
156
|
/**
|
|
160
157
|
* This method allow you to send requests to the Algolia REST API.
|
|
161
|
-
*
|
|
162
158
|
* @param customPut - The customPut object.
|
|
163
159
|
* @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
164
160
|
* @param customPut.parameters - Query parameters to apply to the current query.
|
|
@@ -183,7 +179,6 @@ function createInsightsClient({
|
|
|
183
179
|
},
|
|
184
180
|
/**
|
|
185
181
|
* 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.
|
|
186
|
-
*
|
|
187
182
|
* @param deleteUserToken - The deleteUserToken object.
|
|
188
183
|
* @param deleteUserToken.userToken - User token for which to delete all associated events.
|
|
189
184
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -205,7 +200,6 @@ function createInsightsClient({
|
|
|
205
200
|
},
|
|
206
201
|
/**
|
|
207
202
|
* 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 MB.
|
|
208
|
-
*
|
|
209
203
|
* @param insightsEvents - The insightsEvents object.
|
|
210
204
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
211
205
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../builds/browser.ts","../../src/insightsClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type { ClientOptions } from '@algolia/client-common';\nimport {\n createNullLogger,\n createMemoryCache,\n createFallbackableCache,\n createBrowserLocalStorageCache,\n DEFAULT_CONNECT_TIMEOUT_BROWSER,\n DEFAULT_READ_TIMEOUT_BROWSER,\n DEFAULT_WRITE_TIMEOUT_BROWSER,\n} from '@algolia/client-common';\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\n\nimport type { Region } from '../src/insightsClient';\nimport { createInsightsClient, apiClientVersion, REGIONS } from '../src/insightsClient';\n\nexport type InsightsClient = ReturnType<typeof createInsightsClient>;\n\nexport { apiClientVersion, Region } from '../src/insightsClient';\nexport * from '../model';\n\nexport function insightsClient(\n appId: string,\n apiKey: string,\n region?: Region,\n options?: ClientOptions,\n): InsightsClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {\n throw new Error(`\\`region\\` must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return createInsightsClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: DEFAULT_CONNECT_TIMEOUT_BROWSER,\n read: DEFAULT_READ_TIMEOUT_BROWSER,\n write: DEFAULT_WRITE_TIMEOUT_BROWSER,\n },\n logger: createNullLogger(),\n requester: createXhrRequester(),\n algoliaAgents: [{ segment: 'Browser' }],\n authMode: 'WithinQueryParameters',\n responsesCache: createMemoryCache(),\n requestsCache: createMemoryCache({ serializable: false }),\n hostsCache: createFallbackableCache({\n caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],\n }),\n ...options,\n });\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserTokenProps,\n} from '../model/clientMethodProps';\nimport type { EventsResponse } from '../model/eventsResponse';\nimport type { InsightsEvents } from '../model/insightsEvents';\n\nexport const apiClientVersion = '5.7.0';\n\nexport const REGIONS = ['de', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\n\nfunction getDefaultHosts(region?: Region): Host[] {\n const url = !region ? 'insights.algolia.io' : 'insights.{region}.algolia.io'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function createInsightsClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & { region?: Region }) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Insights',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * 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.\n *\n * @param deleteUserToken - The deleteUserToken object.\n * @param deleteUserToken.userToken - User token for which to delete all associated events.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUserToken({ userToken }: DeleteUserTokenProps, requestOptions?: RequestOptions): Promise<void> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `deleteUserToken`.');\n }\n\n const requestPath = '/1/usertokens/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * 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 MB.\n *\n * @param insightsEvents - The insightsEvents object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n pushEvents(insightsEvents: InsightsEvents, requestOptions?: RequestOptions): Promise<EventsResponse> {\n if (!insightsEvents) {\n throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');\n }\n\n if (!insightsEvents.events) {\n throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');\n }\n\n const requestPath = '/1/events';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: insightsEvents,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAGA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+BAA+B,EAAE,KAAK,GAAG,gBAAgB,IAAI,KAAK,GAAG,CAAC,GAAG,kBAAkB,CAAC;AAAA,IACvG,CAAC;AAAA,IACD,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../builds/browser.ts","../../src/insightsClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\n\nimport {\n ClientOptions,\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n DEFAULT_CONNECT_TIMEOUT_BROWSER,\n DEFAULT_READ_TIMEOUT_BROWSER,\n DEFAULT_WRITE_TIMEOUT_BROWSER,\n} from '@algolia/client-common';\n\nimport { apiClientVersion, createInsightsClient } from '../src/insightsClient';\n\nimport { Region, REGIONS } from '../src/insightsClient';\n\nexport * from '../model';\nexport { apiClientVersion, Region } from '../src/insightsClient';\n\nexport function insightsClient(\n appId: string,\n apiKey: string,\n region?: Region,\n options?: ClientOptions,\n): InsightsClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {\n throw new Error(`\\`region\\` must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return createInsightsClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: DEFAULT_CONNECT_TIMEOUT_BROWSER,\n read: DEFAULT_READ_TIMEOUT_BROWSER,\n write: DEFAULT_WRITE_TIMEOUT_BROWSER,\n },\n logger: createNullLogger(),\n requester: createXhrRequester(),\n algoliaAgents: [{ segment: 'Browser' }],\n authMode: 'WithinQueryParameters',\n responsesCache: createMemoryCache(),\n requestsCache: createMemoryCache({ serializable: false }),\n hostsCache: createFallbackableCache({\n caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],\n }),\n ...options,\n });\n}\n\nexport type InsightsClient = ReturnType<typeof createInsightsClient>;\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\n\nimport type { EventsResponse } from '../model/eventsResponse';\nimport type { InsightsEvents } from '../model/insightsEvents';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserTokenProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.8.1';\n\nexport const REGIONS = ['de', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\n\nfunction getDefaultHosts(region?: Region): Host[] {\n const url = !region ? 'insights.algolia.io' : 'insights.{region}.algolia.io'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createInsightsClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & { region?: Region }) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Insights',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * 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.\n * @param deleteUserToken - The deleteUserToken object.\n * @param deleteUserToken.userToken - User token for which to delete all associated events.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUserToken({ userToken }: DeleteUserTokenProps, requestOptions?: RequestOptions): Promise<void> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `deleteUserToken`.');\n }\n\n const requestPath = '/1/usertokens/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * 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 MB.\n * @param insightsEvents - The insightsEvents object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n pushEvents(insightsEvents: InsightsEvents, requestOptions?: RequestOptions): Promise<EventsResponse> {\n if (!insightsEvents) {\n throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');\n }\n\n if (!insightsEvents.events) {\n throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');\n }\n\n const requestPath = '/1/events';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: insightsEvents,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAEA,SAAS,0BAA0B;AAEnC;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACHP,SAAS,YAAY,mBAAmB,uBAAuB;AAaxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAGlC,SAAS,gBAAgB,QAAyB;AAChD,QAAM,MAAM,CAAC,SAAS,wBAAwB,+BAA+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AC;AAE1C,YAAM,UAAmB;AAAA,QACvB,QAAQ;AAAA,QACR,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,MAAM;AAAA,MACR;AAEA,aAAO,YAAY,QAAQ,SAAS,cAAc;AAAA,IACpD;AAAA,EACF;AACF;;;ADjQO,SAAS,eACd,OACA,QACA,QACA,SACgB;AAChB,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACvC,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,MAAI,WAAW,OAAO,WAAW,YAAY,CAAC,QAAQ,SAAS,MAAM,IAAI;AACvE,UAAM,IAAI,MAAM,4CAA4C,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,EAClF;AAEA,SAAO,qBAAqB;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA,QAAQ,iBAAiB;AAAA,IACzB,WAAW,mBAAmB;AAAA,IAC9B,eAAe,CAAC,EAAE,SAAS,UAAU,CAAC;AAAA,IACtC,UAAU;AAAA,IACV,gBAAgB,kBAAkB;AAAA,IAClC,eAAe,kBAAkB,EAAE,cAAc,MAAM,CAAC;AAAA,IACxD,YAAY,wBAAwB;AAAA,MAClC,QAAQ,CAAC,+BAA+B,EAAE,KAAK,GAAG,gBAAgB,IAAI,KAAK,GAAG,CAAC,GAAG,kBAAkB,CAAC;AAAA,IACvG,CAAC;AAAA,IACD,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function $(r){let e,o=`algolia-client-js-${r.key}`;function t(){return e===void 0&&(e=r.localStorage||window.localStorage),e}function n(){return JSON.parse(t().getItem(o)||"{}")}function l(a){t().setItem(o,JSON.stringify(a))}function h(){let a=r.timeToLive?r.timeToLive*1e3:null,s=n(),i=Object.fromEntries(Object.entries(s).filter(([,p])=>p.timestamp!==void 0));if(l(i),!a)return;let m=Object.fromEntries(Object.entries(i).filter(([,p])=>{let y=new Date().getTime();return!(p.timestamp+a<y)}));l(m)}return{get(a,s,i={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(h(),n()[JSON.stringify(a)])).then(m=>Promise.all([m?m.value:s(),m!==void 0])).then(([m,p])=>Promise.all([m,p||i.miss(m)])).then(([m])=>m)},set(a,s){return Promise.resolve().then(()=>{let i=n();return i[JSON.stringify(a)]={timestamp:new Date().getTime(),value:s},t().setItem(o,JSON.stringify(i)),s})},delete(a){return Promise.resolve().then(()=>{let s=n();delete s[JSON.stringify(a)],t().setItem(o,JSON.stringify(s))})},clear(){return Promise.resolve().then(()=>{t().removeItem(o)})}}}function ee(){return{get(r,e,o={miss:()=>Promise.resolve()}){return e().then(n=>Promise.all([n,o.miss(n)])).then(([n])=>n)},set(r,e){return Promise.resolve(e)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function R(r){let e=[...r.caches],o=e.shift();return o===void 0?ee():{get(t,n,l={miss:()=>Promise.resolve()}){return o.get(t,n,l).catch(()=>R({caches:e}).get(t,n,l))},set(t,n){return o.set(t,n).catch(()=>R({caches:e}).set(t,n))},delete(t){return o.delete(t).catch(()=>R({caches:e}).delete(t))},clear(){return o.clear().catch(()=>R({caches:e}).clear())}}}function q(r={serializable:!0}){let e={};return{get(o,t,n={miss:()=>Promise.resolve()}){let l=JSON.stringify(o);if(l in e)return Promise.resolve(r.serializable?JSON.parse(e[l]):e[l]);let h=t();return h.then(a=>n.miss(a)).then(()=>h)},set(o,t){return e[JSON.stringify(o)]=r.serializable?JSON.stringify(t):t,Promise.resolve(t)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var j=1e3,J=2e3,M=3e4;function re(r){let e={value:`Algolia for JavaScript (${r})`,add(o){let t=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(t)===-1&&(e.value=`${e.value}${t}`),e}};return e}function z(r,e,o="WithinHeaders"){let t={"x-algolia-api-key":e,"x-algolia-application-id":r};return{headers(){return o==="WithinHeaders"?t:{}},queryParameters(){return o==="WithinQueryParameters"?t:{}}}}function Q({algoliaAgents:r,client:e,version:o}){let t=re(o).add({segment:e,version:o});return r.forEach(n=>t.add(n)),t}function F(){return{debug(r,e){return Promise.resolve()},info(r,e){return Promise.resolve()},error(r,e){return Promise.resolve()}}}var W=2*60*1e3;function H(r,e="up"){let o=Date.now();function t(){return e==="up"||Date.now()-o>W}function n(){return e==="timed out"&&Date.now()-o<=W}return{...r,status:e,lastUpdate:o,isUp:t,isTimedOut:n}}var G=class extends Error{name="AlgoliaError";constructor(r,e){super(r),e&&(this.name=e)}},B=class extends G{stackTrace;constructor(r,e,o){super(r,o),this.stackTrace=e}},te=class extends B{constructor(r){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",r,"RetryError")}},_=class extends B{status;constructor(r,e,o,t="ApiError"){super(r,o,t),this.status=e}},oe=class extends G{response;constructor(r,e){super(r,"DeserializationError"),this.response=e}},se=class extends _{error;constructor(r,e,o,t){super(r,e,t,"DetailedApiError"),this.error=o}};function ne(r,e,o){let t=ae(o),n=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return t.length&&(n+=`?${t}`),n}function ae(r){return Object.keys(r).filter(e=>r[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(r[e])==="[object Array]"?r[e].join(","):r[e]).replaceAll("+","%20")}`).join("&")}function ie(r,e){if(r.method==="GET"||r.data===void 0&&e.data===void 0)return;let o=Array.isArray(r.data)?r.data:{...r.data,...e.data};return JSON.stringify(o)}function ce(r,e,o){let t={Accept:"application/json",...r,...e,...o},n={};return Object.keys(t).forEach(l=>{let h=t[l];n[l.toLowerCase()]=h}),n}function ue(r){try{return JSON.parse(r.content)}catch(e){throw new oe(e.message,r)}}function le({content:r,status:e},o){try{let t=JSON.parse(r);return"error"in t?new se(t.message,e,t.error,o):new _(t.message,e,o)}catch{}return new _(r,e,o)}function me({isTimedOut:r,status:e}){return!r&&~~e===0}function de({isTimedOut:r,status:e}){return r||me({isTimedOut:r,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function he({status:r}){return~~(r/100)===2}function pe(r){return r.map(e=>X(e))}function X(r){let e=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...r,request:{...r.request,headers:{...r.request.headers,...e}}}}function K({hosts:r,hostsCache:e,baseHeaders:o,logger:t,baseQueryParameters:n,algoliaAgent:l,timeouts:h,requester:a,requestsCache:s,responsesCache:i}){async function m(c){let u=await Promise.all(c.map(d=>e.get(d,()=>Promise.resolve(H(d))))),g=u.filter(d=>d.isUp()),P=u.filter(d=>d.isTimedOut()),w=[...g,...P];return{hosts:w.length>0?w:c,getTimeout(d,T){return(P.length===0&&d===0?1:P.length+3+d)*T}}}async function p(c,u,g=!0){let P=[],w=ie(c,u),E=ce(o,c.headers,u.headers),d=c.method==="GET"?{...c.data,...u.data}:{},T={...n,...c.queryParameters,...d};if(l.value&&(T["x-algolia-agent"]=l.value),u&&u.queryParameters)for(let f of Object.keys(u.queryParameters))!u.queryParameters[f]||Object.prototype.toString.call(u.queryParameters[f])==="[object Object]"?T[f]=u.queryParameters[f]:T[f]=u.queryParameters[f].toString();let x=0,D=async(f,S)=>{let O=f.pop();if(O===void 0)throw new te(pe(P));let C={...h,...u.timeouts},k={data:w,headers:E,method:c.method,url:ne(O,c.path,T),connectTimeout:S(x,C.connect),responseTimeout:S(x,g?C.read:C.write)},U=b=>{let L={request:k,response:b,host:O,triesLeft:f.length};return P.push(L),L},v=await a.send(k);if(de(v)){let b=U(v);return v.isTimedOut&&x++,t.info("Retryable failure",X(b)),await e.set(O,H(O,v.isTimedOut?"timed out":"down")),D(f,S)}if(he(v))return ue(v);throw U(v),le(v,P)},Z=r.filter(f=>f.accept==="readWrite"||(g?f.accept==="read":f.accept==="write")),I=await m(Z);return D([...I.hosts].reverse(),I.getTimeout)}function y(c,u={}){let g=c.useReadTransporter||c.method==="GET";if(!g)return p(c,u,g);let P=()=>p(c,u);if((u.cacheable||c.cacheable)!==!0)return P();let E={request:c,requestOptions:u,transporter:{queryParameters:n,headers:o}};return i.get(E,()=>s.get(E,()=>s.set(E,P()).then(d=>Promise.all([s.delete(E),d]),d=>Promise.all([s.delete(E),Promise.reject(d)])).then(([d,T])=>T)),{miss:d=>i.set(E,d)})}return{hostsCache:e,requester:a,timeouts:h,logger:t,algoliaAgent:l,baseHeaders:o,baseQueryParameters:n,hosts:r,request:y,requestsCache:s,responsesCache:i}}function V(){function r(e){return new Promise(o=>{let t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>t.setRequestHeader(a,e.headers[a]));let n=(a,s)=>setTimeout(()=>{t.abort(),o({status:0,content:s,isTimedOut:!0})},a),l=n(e.connectTimeout,"Connection timeout"),h;t.onreadystatechange=()=>{t.readyState>t.OPENED&&h===void 0&&(clearTimeout(l),h=n(e.responseTimeout,"Socket timeout"))},t.onerror=()=>{t.status===0&&(clearTimeout(l),clearTimeout(h),o({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}))},t.onload=()=>{clearTimeout(l),clearTimeout(h),o({content:t.responseText,status:t.status,isTimedOut:!1})},t.send(e.data)})}return{send:r}}var A="5.7.0",N=["de","us"];function fe(r){return[{url:r?"insights.{region}.algolia.io".replace("{region}",r):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function Y({appId:r,apiKey:e,authMode:o,algoliaAgents:t,region:n,...l}){let h=z(r,e,o),a=K({hosts:fe(n),...l,algoliaAgent:Q({algoliaAgents:t,client:"Insights",version:A}),baseHeaders:{"content-type":"text/plain",...h.headers(),...l.baseHeaders},baseQueryParameters:{...h.queryParameters(),...l.baseQueryParameters}});return{transporter:a,appId:r,clearCache(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then(()=>{})},get _ua(){return a.algoliaAgent.value},addAlgoliaAgent(s,i){a.algoliaAgent.add({segment:s,version:i})},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?a.baseHeaders["x-algolia-api-key"]=s:a.baseQueryParameters["x-algolia-api-key"]=s},customDelete({path:s,parameters:i},m){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let u={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return a.request(u,m)},customGet({path:s,parameters:i},m){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let u={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return a.request(u,m)},customPost({path:s,parameters:i,body:m},p){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let g={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:m||{}};return a.request(g,p)},customPut({path:s,parameters:i,body:m},p){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let g={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:m||{}};return a.request(g,p)},deleteUserToken({userToken:s},i){if(!s)throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");let c={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return a.request(c,i)},pushEvents(s,i){if(!s)throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");if(!s.events)throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");let c={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:s};return a.request(c,i)}}}function tr(r,e,o,t){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(o&&(typeof o!="string"||!N.includes(o)))throw new Error(`\`region\` must be one of the following: ${N.join(", ")}`);return Y({appId:r,apiKey:e,region:o,timeouts:{connect:j,read:J,write:M},logger:F(),requester:V(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:q(),requestsCache:q({serializable:!1}),hostsCache:R({caches:[$({key:`${A}-${r}`}),q()]}),...t})}export{A as apiClientVersion,tr as insightsClient};
|
|
1
|
+
function W(){function r(e){return new Promise(o=>{let t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>t.setRequestHeader(a,e.headers[a]));let n=(a,s)=>setTimeout(()=>{t.abort(),o({status:0,content:s,isTimedOut:!0})},a),l=n(e.connectTimeout,"Connection timeout"),h;t.onreadystatechange=()=>{t.readyState>t.OPENED&&h===void 0&&(clearTimeout(l),h=n(e.responseTimeout,"Socket timeout"))},t.onerror=()=>{t.status===0&&(clearTimeout(l),clearTimeout(h),o({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}))},t.onload=()=>{clearTimeout(l),clearTimeout(h),o({content:t.responseText,status:t.status,isTimedOut:!1})},t.send(e.data)})}return{send:r}}function j(r){let e,o=`algolia-client-js-${r.key}`;function t(){return e===void 0&&(e=r.localStorage||window.localStorage),e}function n(){return JSON.parse(t().getItem(o)||"{}")}function l(a){t().setItem(o,JSON.stringify(a))}function h(){let a=r.timeToLive?r.timeToLive*1e3:null,s=n(),i=Object.fromEntries(Object.entries(s).filter(([,p])=>p.timestamp!==void 0));if(l(i),!a)return;let m=Object.fromEntries(Object.entries(i).filter(([,p])=>{let E=new Date().getTime();return!(p.timestamp+a<E)}));l(m)}return{get(a,s,i={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(h(),n()[JSON.stringify(a)])).then(m=>Promise.all([m?m.value:s(),m!==void 0])).then(([m,p])=>Promise.all([m,p||i.miss(m)])).then(([m])=>m)},set(a,s){return Promise.resolve().then(()=>{let i=n();return i[JSON.stringify(a)]={timestamp:new Date().getTime(),value:s},t().setItem(o,JSON.stringify(i)),s})},delete(a){return Promise.resolve().then(()=>{let s=n();delete s[JSON.stringify(a)],t().setItem(o,JSON.stringify(s))})},clear(){return Promise.resolve().then(()=>{t().removeItem(o)})}}}function ee(){return{get(r,e,o={miss:()=>Promise.resolve()}){return e().then(n=>Promise.all([n,o.miss(n)])).then(([n])=>n)},set(r,e){return Promise.resolve(e)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function R(r){let e=[...r.caches],o=e.shift();return o===void 0?ee():{get(t,n,l={miss:()=>Promise.resolve()}){return o.get(t,n,l).catch(()=>R({caches:e}).get(t,n,l))},set(t,n){return o.set(t,n).catch(()=>R({caches:e}).set(t,n))},delete(t){return o.delete(t).catch(()=>R({caches:e}).delete(t))},clear(){return o.clear().catch(()=>R({caches:e}).clear())}}}function q(r={serializable:!0}){let e={};return{get(o,t,n={miss:()=>Promise.resolve()}){let l=JSON.stringify(o);if(l in e)return Promise.resolve(r.serializable?JSON.parse(e[l]):e[l]);let h=t();return h.then(a=>n.miss(a)).then(()=>h)},set(o,t){return e[JSON.stringify(o)]=r.serializable?JSON.stringify(t):t,Promise.resolve(t)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var J=1e3,M=2e3,z=3e4;function re(r){let e={value:`Algolia for JavaScript (${r})`,add(o){let t=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(t)===-1&&(e.value=`${e.value}${t}`),e}};return e}function Q(r,e,o="WithinHeaders"){let t={"x-algolia-api-key":e,"x-algolia-application-id":r};return{headers(){return o==="WithinHeaders"?t:{}},queryParameters(){return o==="WithinQueryParameters"?t:{}}}}function F({algoliaAgents:r,client:e,version:o}){let t=re(o).add({segment:e,version:o});return r.forEach(n=>t.add(n)),t}function G(){return{debug(r,e){return Promise.resolve()},info(r,e){return Promise.resolve()},error(r,e){return Promise.resolve()}}}var H=2*60*1e3;function $(r,e="up"){let o=Date.now();function t(){return e==="up"||Date.now()-o>H}function n(){return e==="timed out"&&Date.now()-o<=H}return{...r,status:e,lastUpdate:o,isUp:t,isTimedOut:n}}var B=class extends Error{name="AlgoliaError";constructor(r,e){super(r),e&&(this.name=e)}},X=class extends B{stackTrace;constructor(r,e,o){super(r,o),this.stackTrace=e}},te=class extends X{constructor(r){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",r,"RetryError")}},_=class extends X{status;constructor(r,e,o,t="ApiError"){super(r,o,t),this.status=e}},oe=class extends B{response;constructor(r,e){super(r,"DeserializationError"),this.response=e}},se=class extends _{error;constructor(r,e,o,t){super(r,e,t,"DetailedApiError"),this.error=o}};function ne(r,e,o){let t=ae(o),n=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return t.length&&(n+=`?${t}`),n}function ae(r){return Object.keys(r).filter(e=>r[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(r[e])==="[object Array]"?r[e].join(","):r[e]).replace(/\+/g,"%20")}`).join("&")}function ie(r,e){if(r.method==="GET"||r.data===void 0&&e.data===void 0)return;let o=Array.isArray(r.data)?r.data:{...r.data,...e.data};return JSON.stringify(o)}function ce(r,e,o){let t={Accept:"application/json",...r,...e,...o},n={};return Object.keys(t).forEach(l=>{let h=t[l];n[l.toLowerCase()]=h}),n}function ue(r){try{return JSON.parse(r.content)}catch(e){throw new oe(e.message,r)}}function le({content:r,status:e},o){try{let t=JSON.parse(r);return"error"in t?new se(t.message,e,t.error,o):new _(t.message,e,o)}catch{}return new _(r,e,o)}function me({isTimedOut:r,status:e}){return!r&&~~e===0}function de({isTimedOut:r,status:e}){return r||me({isTimedOut:r,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function he({status:r}){return~~(r/100)===2}function pe(r){return r.map(e=>K(e))}function K(r){let e=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...r,request:{...r.request,headers:{...r.request.headers,...e}}}}function V({hosts:r,hostsCache:e,baseHeaders:o,logger:t,baseQueryParameters:n,algoliaAgent:l,timeouts:h,requester:a,requestsCache:s,responsesCache:i}){async function m(c){let u=await Promise.all(c.map(d=>e.get(d,()=>Promise.resolve($(d))))),g=u.filter(d=>d.isUp()),P=u.filter(d=>d.isTimedOut()),w=[...g,...P];return{hosts:w.length>0?w:c,getTimeout(d,T){return(P.length===0&&d===0?1:P.length+3+d)*T}}}async function p(c,u,g=!0){let P=[],w=ie(c,u),y=ce(o,c.headers,u.headers),d=c.method==="GET"?{...c.data,...u.data}:{},T={...n,...c.queryParameters,...d};if(l.value&&(T["x-algolia-agent"]=l.value),u&&u.queryParameters)for(let f of Object.keys(u.queryParameters))!u.queryParameters[f]||Object.prototype.toString.call(u.queryParameters[f])==="[object Object]"?T[f]=u.queryParameters[f]:T[f]=u.queryParameters[f].toString();let x=0,D=async(f,S)=>{let O=f.pop();if(O===void 0)throw new te(pe(P));let C={...h,...u.timeouts},k={data:w,headers:y,method:c.method,url:ne(O,c.path,T),connectTimeout:S(x,C.connect),responseTimeout:S(x,g?C.read:C.write)},U=b=>{let L={request:k,response:b,host:O,triesLeft:f.length};return P.push(L),L},v=await a.send(k);if(de(v)){let b=U(v);return v.isTimedOut&&x++,t.info("Retryable failure",K(b)),await e.set(O,$(O,v.isTimedOut?"timed out":"down")),D(f,S)}if(he(v))return ue(v);throw U(v),le(v,P)},Z=r.filter(f=>f.accept==="readWrite"||(g?f.accept==="read":f.accept==="write")),I=await m(Z);return D([...I.hosts].reverse(),I.getTimeout)}function E(c,u={}){let g=c.useReadTransporter||c.method==="GET";if(!g)return p(c,u,g);let P=()=>p(c,u);if((u.cacheable||c.cacheable)!==!0)return P();let y={request:c,requestOptions:u,transporter:{queryParameters:n,headers:o}};return i.get(y,()=>s.get(y,()=>s.set(y,P()).then(d=>Promise.all([s.delete(y),d]),d=>Promise.all([s.delete(y),Promise.reject(d)])).then(([d,T])=>T)),{miss:d=>i.set(y,d)})}return{hostsCache:e,requester:a,timeouts:h,logger:t,algoliaAgent:l,baseHeaders:o,baseQueryParameters:n,hosts:r,request:E,requestsCache:s,responsesCache:i}}var A="5.8.1",N=["de","us"];function fe(r){return[{url:r?"insights.{region}.algolia.io".replace("{region}",r):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function Y({appId:r,apiKey:e,authMode:o,algoliaAgents:t,region:n,...l}){let h=Q(r,e,o),a=V({hosts:fe(n),...l,algoliaAgent:F({algoliaAgents:t,client:"Insights",version:A}),baseHeaders:{"content-type":"text/plain",...h.headers(),...l.baseHeaders},baseQueryParameters:{...h.queryParameters(),...l.baseQueryParameters}});return{transporter:a,appId:r,clearCache(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then(()=>{})},get _ua(){return a.algoliaAgent.value},addAlgoliaAgent(s,i){a.algoliaAgent.add({segment:s,version:i})},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?a.baseHeaders["x-algolia-api-key"]=s:a.baseQueryParameters["x-algolia-api-key"]=s},customDelete({path:s,parameters:i},m){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let u={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return a.request(u,m)},customGet({path:s,parameters:i},m){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let u={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return a.request(u,m)},customPost({path:s,parameters:i,body:m},p){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let g={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:m||{}};return a.request(g,p)},customPut({path:s,parameters:i,body:m},p){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let g={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:m||{}};return a.request(g,p)},deleteUserToken({userToken:s},i){if(!s)throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");let c={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return a.request(c,i)},pushEvents(s,i){if(!s)throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");if(!s.events)throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");let c={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:s};return a.request(c,i)}}}function nr(r,e,o,t){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(o&&(typeof o!="string"||!N.includes(o)))throw new Error(`\`region\` must be one of the following: ${N.join(", ")}`);return Y({appId:r,apiKey:e,region:o,timeouts:{connect:J,read:M,write:z},logger:G(),requester:W(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:q(),requestsCache:q({serializable:!1}),hostsCache:R({caches:[j({key:`${A}-${r}`}),q()]}),...t})}export{A as apiClientVersion,nr as insightsClient};
|
|
2
2
|
//# sourceMappingURL=browser.min.js.map
|