@algolia/client-abtesting 5.7.0 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -6
- package/dist/browser.d.ts +70 -69
- package/dist/builds/browser.js +15 -25
- 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 +12 -22
- package/dist/builds/fetch.js.map +1 -1
- package/dist/builds/node.cjs +12 -22
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +13 -23
- package/dist/builds/node.js.map +1 -1
- package/dist/fetch.d.ts +69 -67
- package/dist/node.d.cts +69 -67
- package/dist/node.d.ts +69 -67
- package/dist/src/abtestingClient.cjs +11 -21
- package/dist/src/abtestingClient.cjs.map +1 -1
- package/dist/src/abtestingClient.js +11 -21
- package/dist/src/abtestingClient.js.map +1 -1
- package/index.js +1 -1
- package/model/aBTest.ts +2 -2
- package/model/addABTestsRequest.ts +1 -1
- package/model/clientMethodProps.ts +4 -4
- package/model/index.ts +1 -1
- package/model/listABTestsResponse.ts +1 -1
- package/model/scheduleABTestsRequest.ts +1 -1
- package/model/status.ts +1 -1
- package/model/variant.ts +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -40,13 +40,12 @@ All of our clients comes with type definition, and are available for both browse
|
|
|
40
40
|
|
|
41
41
|
### With a package manager
|
|
42
42
|
|
|
43
|
-
|
|
44
43
|
```bash
|
|
45
|
-
yarn add @algolia/client-abtesting@5.
|
|
44
|
+
yarn add @algolia/client-abtesting@5.8.0
|
|
46
45
|
# or
|
|
47
|
-
npm install @algolia/client-abtesting@5.
|
|
46
|
+
npm install @algolia/client-abtesting@5.8.0
|
|
48
47
|
# or
|
|
49
|
-
pnpm add @algolia/client-abtesting@5.
|
|
48
|
+
pnpm add @algolia/client-abtesting@5.8.0
|
|
50
49
|
```
|
|
51
50
|
|
|
52
51
|
### Without a package manager
|
|
@@ -54,7 +53,7 @@ pnpm add @algolia/client-abtesting@5.7.0
|
|
|
54
53
|
Add the following JavaScript snippet to the <head> of your website:
|
|
55
54
|
|
|
56
55
|
```html
|
|
57
|
-
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-abtesting@5.
|
|
56
|
+
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-abtesting@5.8.0/dist/builds/browser.umd.js"></script>
|
|
58
57
|
```
|
|
59
58
|
|
|
60
59
|
### Usage
|
|
@@ -75,4 +74,4 @@ Encountering an issue? Before reaching out to support, we recommend heading to o
|
|
|
75
74
|
|
|
76
75
|
## 📄 License
|
|
77
76
|
|
|
78
|
-
The Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE).
|
|
77
|
+
The Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE).
|
package/dist/browser.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ type ABTestConfiguration = {
|
|
|
49
49
|
/**
|
|
50
50
|
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
|
|
51
51
|
*/
|
|
52
|
-
type Status = 'active' | '
|
|
52
|
+
type Status = 'active' | 'stopped' | 'expired' | 'failed';
|
|
53
53
|
|
|
54
54
|
type Currency = {
|
|
55
55
|
/**
|
|
@@ -138,7 +138,9 @@ type Variant = {
|
|
|
138
138
|
/**
|
|
139
139
|
* A/B test currencies.
|
|
140
140
|
*/
|
|
141
|
-
currencies?:
|
|
141
|
+
currencies?: {
|
|
142
|
+
[key: string]: Currency;
|
|
143
|
+
};
|
|
142
144
|
/**
|
|
143
145
|
* Description for this variant.
|
|
144
146
|
*/
|
|
@@ -195,7 +197,9 @@ type ABTest = {
|
|
|
195
197
|
conversionSignificance?: number | null;
|
|
196
198
|
addToCartSignificance?: number | null;
|
|
197
199
|
purchaseSignificance?: number | null;
|
|
198
|
-
revenueSignificance?:
|
|
200
|
+
revenueSignificance?: {
|
|
201
|
+
[key: string]: number;
|
|
202
|
+
} | null;
|
|
199
203
|
/**
|
|
200
204
|
* Date and time when the A/B test was last updated, in RFC 3339 format.
|
|
201
205
|
*/
|
|
@@ -216,7 +220,7 @@ type ABTest = {
|
|
|
216
220
|
/**
|
|
217
221
|
* A/B test variants. The first variant is your _control_ index, typically your production index. The second variant is an index with changed settings that you want to test against the control.
|
|
218
222
|
*/
|
|
219
|
-
variants: Variant
|
|
223
|
+
variants: Array<Variant>;
|
|
220
224
|
configuration?: ABTestConfiguration;
|
|
221
225
|
};
|
|
222
226
|
|
|
@@ -269,7 +273,48 @@ type AddABTestsRequest = {
|
|
|
269
273
|
/**
|
|
270
274
|
* A/B test variants.
|
|
271
275
|
*/
|
|
272
|
-
variants: AddABTestsVariant
|
|
276
|
+
variants: Array<AddABTestsVariant>;
|
|
277
|
+
/**
|
|
278
|
+
* End date and time of the A/B test, in RFC 3339 format.
|
|
279
|
+
*/
|
|
280
|
+
endAt: string;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
type ListABTestsResponse = {
|
|
284
|
+
/**
|
|
285
|
+
* A/B tests.
|
|
286
|
+
*/
|
|
287
|
+
abtests: Array<ABTest> | null;
|
|
288
|
+
/**
|
|
289
|
+
* Number of A/B tests.
|
|
290
|
+
*/
|
|
291
|
+
count: number;
|
|
292
|
+
/**
|
|
293
|
+
* Number of retrievable A/B tests.
|
|
294
|
+
*/
|
|
295
|
+
total: number;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
type ScheduleABTestResponse = {
|
|
299
|
+
/**
|
|
300
|
+
* Unique scheduled A/B test identifier.
|
|
301
|
+
*/
|
|
302
|
+
abTestScheduleID: number;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
type ScheduleABTestsRequest = {
|
|
306
|
+
/**
|
|
307
|
+
* A/B test name.
|
|
308
|
+
*/
|
|
309
|
+
name: string;
|
|
310
|
+
/**
|
|
311
|
+
* A/B test variants.
|
|
312
|
+
*/
|
|
313
|
+
variants: Array<AddABTestsVariant>;
|
|
314
|
+
/**
|
|
315
|
+
* Date and time when the A/B test is scheduled to start, in RFC 3339 format.
|
|
316
|
+
*/
|
|
317
|
+
scheduledAt: string;
|
|
273
318
|
/**
|
|
274
319
|
* End date and time of the A/B test, in RFC 3339 format.
|
|
275
320
|
*/
|
|
@@ -287,7 +332,9 @@ type CustomDeleteProps = {
|
|
|
287
332
|
/**
|
|
288
333
|
* Query parameters to apply to the current query.
|
|
289
334
|
*/
|
|
290
|
-
parameters?:
|
|
335
|
+
parameters?: {
|
|
336
|
+
[key: string]: any;
|
|
337
|
+
};
|
|
291
338
|
};
|
|
292
339
|
/**
|
|
293
340
|
* Properties for the `customGet` method.
|
|
@@ -300,7 +347,9 @@ type CustomGetProps = {
|
|
|
300
347
|
/**
|
|
301
348
|
* Query parameters to apply to the current query.
|
|
302
349
|
*/
|
|
303
|
-
parameters?:
|
|
350
|
+
parameters?: {
|
|
351
|
+
[key: string]: any;
|
|
352
|
+
};
|
|
304
353
|
};
|
|
305
354
|
/**
|
|
306
355
|
* Properties for the `customPost` method.
|
|
@@ -313,7 +362,9 @@ type CustomPostProps = {
|
|
|
313
362
|
/**
|
|
314
363
|
* Query parameters to apply to the current query.
|
|
315
364
|
*/
|
|
316
|
-
parameters?:
|
|
365
|
+
parameters?: {
|
|
366
|
+
[key: string]: any;
|
|
367
|
+
};
|
|
317
368
|
/**
|
|
318
369
|
* Parameters to send with the custom request.
|
|
319
370
|
*/
|
|
@@ -330,7 +381,9 @@ type CustomPutProps = {
|
|
|
330
381
|
/**
|
|
331
382
|
* Query parameters to apply to the current query.
|
|
332
383
|
*/
|
|
333
|
-
parameters?:
|
|
384
|
+
parameters?: {
|
|
385
|
+
[key: string]: any;
|
|
386
|
+
};
|
|
334
387
|
/**
|
|
335
388
|
* Parameters to send with the custom request.
|
|
336
389
|
*/
|
|
@@ -385,48 +438,7 @@ type StopABTestProps = {
|
|
|
385
438
|
id: number;
|
|
386
439
|
};
|
|
387
440
|
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* A/B tests.
|
|
391
|
-
*/
|
|
392
|
-
abtests: ABTest[] | null;
|
|
393
|
-
/**
|
|
394
|
-
* Number of A/B tests.
|
|
395
|
-
*/
|
|
396
|
-
count: number;
|
|
397
|
-
/**
|
|
398
|
-
* Number of retrievable A/B tests.
|
|
399
|
-
*/
|
|
400
|
-
total: number;
|
|
401
|
-
};
|
|
402
|
-
|
|
403
|
-
type ScheduleABTestResponse = {
|
|
404
|
-
/**
|
|
405
|
-
* Unique scheduled A/B test identifier.
|
|
406
|
-
*/
|
|
407
|
-
abTestScheduleID: number;
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
type ScheduleABTestsRequest = {
|
|
411
|
-
/**
|
|
412
|
-
* A/B test name.
|
|
413
|
-
*/
|
|
414
|
-
name: string;
|
|
415
|
-
/**
|
|
416
|
-
* A/B test variants.
|
|
417
|
-
*/
|
|
418
|
-
variants: AddABTestsVariant[];
|
|
419
|
-
/**
|
|
420
|
-
* Date and time when the A/B test is scheduled to start, in RFC 3339 format.
|
|
421
|
-
*/
|
|
422
|
-
scheduledAt: string;
|
|
423
|
-
/**
|
|
424
|
-
* End date and time of the A/B test, in RFC 3339 format.
|
|
425
|
-
*/
|
|
426
|
-
endAt: string;
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
declare const apiClientVersion = "5.7.0";
|
|
441
|
+
declare const apiClientVersion = "5.8.0";
|
|
430
442
|
declare const REGIONS: readonly ["de", "us"];
|
|
431
443
|
type Region = (typeof REGIONS)[number];
|
|
432
444
|
declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & {
|
|
@@ -465,15 +477,13 @@ declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOptio
|
|
|
465
477
|
* Creates a new A/B test.
|
|
466
478
|
*
|
|
467
479
|
* Required API Key ACLs:
|
|
468
|
-
*
|
|
469
|
-
*
|
|
480
|
+
* - editSettings
|
|
470
481
|
* @param addABTestsRequest - The addABTestsRequest object.
|
|
471
482
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
472
483
|
*/
|
|
473
484
|
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
|
|
474
485
|
/**
|
|
475
486
|
* This method allow you to send requests to the Algolia REST API.
|
|
476
|
-
*
|
|
477
487
|
* @param customDelete - The customDelete object.
|
|
478
488
|
* @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
479
489
|
* @param customDelete.parameters - Query parameters to apply to the current query.
|
|
@@ -482,7 +492,6 @@ declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOptio
|
|
|
482
492
|
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
|
|
483
493
|
/**
|
|
484
494
|
* This method allow you to send requests to the Algolia REST API.
|
|
485
|
-
*
|
|
486
495
|
* @param customGet - The customGet object.
|
|
487
496
|
* @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
488
497
|
* @param customGet.parameters - Query parameters to apply to the current query.
|
|
@@ -491,7 +500,6 @@ declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOptio
|
|
|
491
500
|
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
|
|
492
501
|
/**
|
|
493
502
|
* This method allow you to send requests to the Algolia REST API.
|
|
494
|
-
*
|
|
495
503
|
* @param customPost - The customPost object.
|
|
496
504
|
* @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
497
505
|
* @param customPost.parameters - Query parameters to apply to the current query.
|
|
@@ -501,7 +509,6 @@ declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOptio
|
|
|
501
509
|
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
|
|
502
510
|
/**
|
|
503
511
|
* This method allow you to send requests to the Algolia REST API.
|
|
504
|
-
*
|
|
505
512
|
* @param customPut - The customPut object.
|
|
506
513
|
* @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
507
514
|
* @param customPut.parameters - Query parameters to apply to the current query.
|
|
@@ -513,8 +520,7 @@ declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOptio
|
|
|
513
520
|
* Deletes an A/B test by its ID.
|
|
514
521
|
*
|
|
515
522
|
* Required API Key ACLs:
|
|
516
|
-
*
|
|
517
|
-
*
|
|
523
|
+
* - editSettings
|
|
518
524
|
* @param deleteABTest - The deleteABTest object.
|
|
519
525
|
* @param deleteABTest.id - Unique A/B test identifier.
|
|
520
526
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -524,8 +530,7 @@ declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOptio
|
|
|
524
530
|
* Retrieves the details for an A/B test by its ID.
|
|
525
531
|
*
|
|
526
532
|
* Required API Key ACLs:
|
|
527
|
-
*
|
|
528
|
-
*
|
|
533
|
+
* - analytics
|
|
529
534
|
* @param getABTest - The getABTest object.
|
|
530
535
|
* @param getABTest.id - Unique A/B test identifier.
|
|
531
536
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -535,8 +540,7 @@ declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOptio
|
|
|
535
540
|
* Lists all A/B tests you configured for this application.
|
|
536
541
|
*
|
|
537
542
|
* Required API Key ACLs:
|
|
538
|
-
*
|
|
539
|
-
*
|
|
543
|
+
* - analytics
|
|
540
544
|
* @param listABTests - The listABTests object.
|
|
541
545
|
* @param listABTests.offset - Position of the first item to return.
|
|
542
546
|
* @param listABTests.limit - Number of items to return.
|
|
@@ -549,8 +553,7 @@ declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOptio
|
|
|
549
553
|
* Schedule an A/B test to be started at a later time.
|
|
550
554
|
*
|
|
551
555
|
* Required API Key ACLs:
|
|
552
|
-
*
|
|
553
|
-
*
|
|
556
|
+
* - editSettings
|
|
554
557
|
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
|
|
555
558
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
556
559
|
*/
|
|
@@ -559,8 +562,7 @@ declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOptio
|
|
|
559
562
|
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
|
|
560
563
|
*
|
|
561
564
|
* Required API Key ACLs:
|
|
562
|
-
*
|
|
563
|
-
*
|
|
565
|
+
* - editSettings
|
|
564
566
|
* @param stopABTest - The stopABTest object.
|
|
565
567
|
* @param stopABTest.id - Unique A/B test identifier.
|
|
566
568
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -575,8 +577,7 @@ type ErrorBase = Record<string, any> & {
|
|
|
575
577
|
message?: string;
|
|
576
578
|
};
|
|
577
579
|
|
|
578
|
-
type AbtestingClient = ReturnType<typeof createAbtestingClient>;
|
|
579
|
-
|
|
580
580
|
declare function abtestingClient(appId: string, apiKey: string, region?: Region, options?: ClientOptions): AbtestingClient;
|
|
581
|
+
type AbtestingClient = ReturnType<typeof createAbtestingClient>;
|
|
581
582
|
|
|
582
583
|
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingClient, type AddABTestsRequest, type AddABTestsVariant, type Currency, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type Effect, type EmptySearch, type EmptySearchFilter, type ErrorBase, type FilterEffects, type GetABTestProps, type ListABTestsProps, type ListABTestsResponse, type MinimumDetectableEffect, type Outliers, type OutliersFilter, type Region, type ScheduleABTestResponse, type ScheduleABTestsRequest, type Status, type StopABTestProps, type Variant, abtestingClient, apiClientVersion };
|
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/abtestingClient.ts
|
|
14
14
|
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
|
|
15
|
-
var apiClientVersion = "5.
|
|
15
|
+
var apiClientVersion = "5.8.0";
|
|
16
16
|
var REGIONS = ["de", "us"];
|
|
17
17
|
function getDefaultHosts(region) {
|
|
18
18
|
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
|
|
@@ -89,8 +89,7 @@ function createAbtestingClient({
|
|
|
89
89
|
* Creates a new A/B test.
|
|
90
90
|
*
|
|
91
91
|
* Required API Key ACLs:
|
|
92
|
-
*
|
|
93
|
-
*
|
|
92
|
+
* - editSettings
|
|
94
93
|
* @param addABTestsRequest - The addABTestsRequest object.
|
|
95
94
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
96
95
|
*/
|
|
@@ -121,7 +120,6 @@ function createAbtestingClient({
|
|
|
121
120
|
},
|
|
122
121
|
/**
|
|
123
122
|
* This method allow you to send requests to the Algolia REST API.
|
|
124
|
-
*
|
|
125
123
|
* @param customDelete - The customDelete object.
|
|
126
124
|
* @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
127
125
|
* @param customDelete.parameters - Query parameters to apply to the current query.
|
|
@@ -144,7 +142,6 @@ function createAbtestingClient({
|
|
|
144
142
|
},
|
|
145
143
|
/**
|
|
146
144
|
* This method allow you to send requests to the Algolia REST API.
|
|
147
|
-
*
|
|
148
145
|
* @param customGet - The customGet object.
|
|
149
146
|
* @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
150
147
|
* @param customGet.parameters - Query parameters to apply to the current query.
|
|
@@ -167,7 +164,6 @@ function createAbtestingClient({
|
|
|
167
164
|
},
|
|
168
165
|
/**
|
|
169
166
|
* This method allow you to send requests to the Algolia REST API.
|
|
170
|
-
*
|
|
171
167
|
* @param customPost - The customPost object.
|
|
172
168
|
* @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
173
169
|
* @param customPost.parameters - Query parameters to apply to the current query.
|
|
@@ -192,7 +188,6 @@ function createAbtestingClient({
|
|
|
192
188
|
},
|
|
193
189
|
/**
|
|
194
190
|
* This method allow you to send requests to the Algolia REST API.
|
|
195
|
-
*
|
|
196
191
|
* @param customPut - The customPut object.
|
|
197
192
|
* @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
198
193
|
* @param customPut.parameters - Query parameters to apply to the current query.
|
|
@@ -219,8 +214,7 @@ function createAbtestingClient({
|
|
|
219
214
|
* Deletes an A/B test by its ID.
|
|
220
215
|
*
|
|
221
216
|
* Required API Key ACLs:
|
|
222
|
-
*
|
|
223
|
-
*
|
|
217
|
+
* - editSettings
|
|
224
218
|
* @param deleteABTest - The deleteABTest object.
|
|
225
219
|
* @param deleteABTest.id - Unique A/B test identifier.
|
|
226
220
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -244,8 +238,7 @@ function createAbtestingClient({
|
|
|
244
238
|
* Retrieves the details for an A/B test by its ID.
|
|
245
239
|
*
|
|
246
240
|
* Required API Key ACLs:
|
|
247
|
-
*
|
|
248
|
-
*
|
|
241
|
+
* - analytics
|
|
249
242
|
* @param getABTest - The getABTest object.
|
|
250
243
|
* @param getABTest.id - Unique A/B test identifier.
|
|
251
244
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -269,8 +262,7 @@ function createAbtestingClient({
|
|
|
269
262
|
* Lists all A/B tests you configured for this application.
|
|
270
263
|
*
|
|
271
264
|
* Required API Key ACLs:
|
|
272
|
-
*
|
|
273
|
-
*
|
|
265
|
+
* - analytics
|
|
274
266
|
* @param listABTests - The listABTests object.
|
|
275
267
|
* @param listABTests.offset - Position of the first item to return.
|
|
276
268
|
* @param listABTests.limit - Number of items to return.
|
|
@@ -283,16 +275,16 @@ function createAbtestingClient({
|
|
|
283
275
|
const headers = {};
|
|
284
276
|
const queryParameters = {};
|
|
285
277
|
if (offset !== void 0) {
|
|
286
|
-
queryParameters
|
|
278
|
+
queryParameters["offset"] = offset.toString();
|
|
287
279
|
}
|
|
288
280
|
if (limit !== void 0) {
|
|
289
|
-
queryParameters
|
|
281
|
+
queryParameters["limit"] = limit.toString();
|
|
290
282
|
}
|
|
291
283
|
if (indexPrefix !== void 0) {
|
|
292
|
-
queryParameters
|
|
284
|
+
queryParameters["indexPrefix"] = indexPrefix.toString();
|
|
293
285
|
}
|
|
294
286
|
if (indexSuffix !== void 0) {
|
|
295
|
-
queryParameters
|
|
287
|
+
queryParameters["indexSuffix"] = indexSuffix.toString();
|
|
296
288
|
}
|
|
297
289
|
const request = {
|
|
298
290
|
method: "GET",
|
|
@@ -306,8 +298,7 @@ function createAbtestingClient({
|
|
|
306
298
|
* Schedule an A/B test to be started at a later time.
|
|
307
299
|
*
|
|
308
300
|
* Required API Key ACLs:
|
|
309
|
-
*
|
|
310
|
-
*
|
|
301
|
+
* - editSettings
|
|
311
302
|
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
|
|
312
303
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
313
304
|
*/
|
|
@@ -343,8 +334,7 @@ function createAbtestingClient({
|
|
|
343
334
|
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
|
|
344
335
|
*
|
|
345
336
|
* Required API Key ACLs:
|
|
346
|
-
*
|
|
347
|
-
*
|
|
337
|
+
* - editSettings
|
|
348
338
|
* @param stopABTest - The stopABTest object.
|
|
349
339
|
* @param stopABTest.id - Unique A/B test identifier.
|
|
350
340
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../builds/browser.ts","../../src/abtestingClient.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/abtestingClient';\nimport { createAbtestingClient, apiClientVersion, REGIONS } from '../src/abtestingClient';\n\nexport type AbtestingClient = ReturnType<typeof createAbtestingClient>;\n\nexport { apiClientVersion, Region } from '../src/abtestingClient';\nexport * from '../model';\n\nexport function abtestingClient(\n appId: string,\n apiKey: string,\n region?: Region,\n options?: ClientOptions,\n): AbtestingClient {\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 createAbtestingClient({\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 { ABTest } from '../model/aBTest';\nimport type { ABTestResponse } from '../model/aBTestResponse';\nimport type { AddABTestsRequest } from '../model/addABTestsRequest';\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteABTestProps,\n GetABTestProps,\n ListABTestsProps,\n StopABTestProps,\n} from '../model/clientMethodProps';\nimport type { ListABTestsResponse } from '../model/listABTestsResponse';\nimport type { ScheduleABTestResponse } from '../model/scheduleABTestResponse';\nimport type { ScheduleABTestsRequest } from '../model/scheduleABTestsRequest';\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 ? 'analytics.algolia.com' : 'analytics.{region}.algolia.com'.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 createAbtestingClient({\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: 'Abtesting',\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 * Creates a new A/B test.\n *\n * Required API Key ACLs:\n * - editSettings.\n *\n * @param addABTestsRequest - The addABTestsRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse> {\n if (!addABTestsRequest) {\n throw new Error('Parameter `addABTestsRequest` is required when calling `addABTests`.');\n }\n\n if (!addABTestsRequest.name) {\n throw new Error('Parameter `addABTestsRequest.name` is required when calling `addABTests`.');\n }\n if (!addABTestsRequest.variants) {\n throw new Error('Parameter `addABTestsRequest.variants` is required when calling `addABTests`.');\n }\n if (!addABTestsRequest.endAt) {\n throw new Error('Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.');\n }\n\n const requestPath = '/2/abtests';\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: addABTestsRequest,\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 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 an A/B test by its ID.\n *\n * Required API Key ACLs:\n * - editSettings.\n *\n * @param deleteABTest - The deleteABTest object.\n * @param deleteABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse> {\n if (!id) {\n throw new Error('Parameter `id` is required when calling `deleteABTest`.');\n }\n\n const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));\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 * Retrieves the details for an A/B test by its ID.\n *\n * Required API Key ACLs:\n * - analytics.\n *\n * @param getABTest - The getABTest object.\n * @param getABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest> {\n if (!id) {\n throw new Error('Parameter `id` is required when calling `getABTest`.');\n }\n\n const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\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 * Lists all A/B tests you configured for this application.\n *\n * Required API Key ACLs:\n * - analytics.\n *\n * @param listABTests - The listABTests object.\n * @param listABTests.offset - Position of the first item to return.\n * @param listABTests.limit - Number of items to return.\n * @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.\n * @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n listABTests(\n { offset, limit, indexPrefix, indexSuffix }: ListABTestsProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<ListABTestsResponse> {\n const requestPath = '/2/abtests';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n if (offset !== undefined) {\n queryParameters.offset = offset.toString();\n }\n\n if (limit !== undefined) {\n queryParameters.limit = limit.toString();\n }\n if (indexPrefix !== undefined) {\n queryParameters.indexPrefix = indexPrefix.toString();\n }\n if (indexSuffix !== undefined) {\n queryParameters.indexSuffix = indexSuffix.toString();\n }\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 * Schedule an A/B test to be started at a later time.\n *\n * Required API Key ACLs:\n * - editSettings.\n *\n * @param scheduleABTestsRequest - The scheduleABTestsRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n scheduleABTest(\n scheduleABTestsRequest: ScheduleABTestsRequest,\n requestOptions?: RequestOptions,\n ): Promise<ScheduleABTestResponse> {\n if (!scheduleABTestsRequest) {\n throw new Error('Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.');\n }\n\n if (!scheduleABTestsRequest.name) {\n throw new Error('Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.');\n }\n if (!scheduleABTestsRequest.variants) {\n throw new Error('Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.');\n }\n if (!scheduleABTestsRequest.scheduledAt) {\n throw new Error('Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.');\n }\n if (!scheduleABTestsRequest.endAt) {\n throw new Error('Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.');\n }\n\n const requestPath = '/2/abtests/schedule';\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: scheduleABTestsRequest,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Stops an A/B test by its ID. You can\\'t restart stopped A/B tests.\n *\n * Required API Key ACLs:\n * - editSettings.\n *\n * @param stopABTest - The stopABTest object.\n * @param stopABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse> {\n if (!id) {\n throw new Error('Parameter `id` is required when calling `stopABTest`.');\n }\n\n const requestPath = '/2/abtests/{id}/stop'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAGA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;;;ACVnC,SAAS,YAAY,mBAAmB,uBAAuB;AA2BxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAGlC,SAAS,gBAAgB,QAAyB;AAChD,QAAM,MAAM,CAAC,SAAS,0BAA0B,iCAAiC,QAAQ,YAAY,MAAM;AAE3G,SAAO,CAAC,EAAE,KAAK,QAAQ,aAAa,UAAU,QAAQ,CAAC;AACzD;AAGO,SAAS,sBAAsB;AAAA,EACpC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAA8C;AAC5C,QAAM,OAAO,WAAW,aAAa,cAAc,QAAQ;AAC3D,QAAM,cAAc,kBAAkB;AAAA,IACpC,OAAO,gBAAgB,YAAY;AAAA,IACnC,GAAG;AAAA,IACH,cAAc,gBAAgB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA,IACX,CAAC;AAAA,IACD,aAAa;AAAA,MACX,gBAAgB;AAAA,MAChB,GAAG,KAAK,QAAQ;AAAA,MAChB,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,qBAAqB;AAAA,MACnB,GAAG,KAAK,gBAAgB;AAAA,MACxB,GAAG,QAAQ;AAAA,IACb;AAAA,EAC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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
|
+
{"version":3,"sources":["../../builds/browser.ts","../../src/abtestingClient.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, createAbtestingClient } from '../src/abtestingClient';\n\nimport { Region, REGIONS } from '../src/abtestingClient';\n\nexport * from '../model';\nexport { apiClientVersion, Region } from '../src/abtestingClient';\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function abtestingClient(\n appId: string,\n apiKey: string,\n region?: Region,\n options?: ClientOptions,\n): AbtestingClient {\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 createAbtestingClient({\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 AbtestingClient = ReturnType<typeof createAbtestingClient>;\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 { ABTest } from '../model/aBTest';\nimport type { ABTestResponse } from '../model/aBTestResponse';\nimport type { AddABTestsRequest } from '../model/addABTestsRequest';\n\nimport type { ListABTestsResponse } from '../model/listABTestsResponse';\nimport type { ScheduleABTestResponse } from '../model/scheduleABTestResponse';\nimport type { ScheduleABTestsRequest } from '../model/scheduleABTestsRequest';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteABTestProps,\n GetABTestProps,\n ListABTestsProps,\n StopABTestProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.8.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 ? 'analytics.algolia.com' : 'analytics.{region}.algolia.com'.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 createAbtestingClient({\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: 'Abtesting',\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 * Creates a new A/B test.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param addABTestsRequest - The addABTestsRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse> {\n if (!addABTestsRequest) {\n throw new Error('Parameter `addABTestsRequest` is required when calling `addABTests`.');\n }\n\n if (!addABTestsRequest.name) {\n throw new Error('Parameter `addABTestsRequest.name` is required when calling `addABTests`.');\n }\n if (!addABTestsRequest.variants) {\n throw new Error('Parameter `addABTestsRequest.variants` is required when calling `addABTests`.');\n }\n if (!addABTestsRequest.endAt) {\n throw new Error('Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.');\n }\n\n const requestPath = '/2/abtests';\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: addABTestsRequest,\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 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 an A/B test by its ID.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param deleteABTest - The deleteABTest object.\n * @param deleteABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse> {\n if (!id) {\n throw new Error('Parameter `id` is required when calling `deleteABTest`.');\n }\n\n const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));\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 * Retrieves the details for an A/B test by its ID.\n *\n * Required API Key ACLs:\n * - analytics\n * @param getABTest - The getABTest object.\n * @param getABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest> {\n if (!id) {\n throw new Error('Parameter `id` is required when calling `getABTest`.');\n }\n\n const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\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 * Lists all A/B tests you configured for this application.\n *\n * Required API Key ACLs:\n * - analytics\n * @param listABTests - The listABTests object.\n * @param listABTests.offset - Position of the first item to return.\n * @param listABTests.limit - Number of items to return.\n * @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.\n * @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n listABTests(\n { offset, limit, indexPrefix, indexSuffix }: ListABTestsProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<ListABTestsResponse> {\n const requestPath = '/2/abtests';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (offset !== undefined) {\n queryParameters['offset'] = offset.toString();\n }\n\n if (limit !== undefined) {\n queryParameters['limit'] = limit.toString();\n }\n\n if (indexPrefix !== undefined) {\n queryParameters['indexPrefix'] = indexPrefix.toString();\n }\n\n if (indexSuffix !== undefined) {\n queryParameters['indexSuffix'] = indexSuffix.toString();\n }\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 * Schedule an A/B test to be started at a later time.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param scheduleABTestsRequest - The scheduleABTestsRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n scheduleABTest(\n scheduleABTestsRequest: ScheduleABTestsRequest,\n requestOptions?: RequestOptions,\n ): Promise<ScheduleABTestResponse> {\n if (!scheduleABTestsRequest) {\n throw new Error('Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.');\n }\n\n if (!scheduleABTestsRequest.name) {\n throw new Error('Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.');\n }\n if (!scheduleABTestsRequest.variants) {\n throw new Error('Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.');\n }\n if (!scheduleABTestsRequest.scheduledAt) {\n throw new Error('Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.');\n }\n if (!scheduleABTestsRequest.endAt) {\n throw new Error('Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.');\n }\n\n const requestPath = '/2/abtests/schedule';\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: scheduleABTestsRequest,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Stops an A/B test by its ID. You can\\'t restart stopped A/B tests.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param stopABTest - The stopABTest object.\n * @param stopABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse> {\n if (!id) {\n throw new Error('Parameter `id` is required when calling `stopABTest`.');\n }\n\n const requestPath = '/2/abtests/{id}/stop'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\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;AAqBxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAGlC,SAAS,gBAAgB,QAAyB;AAChD,QAAM,MAAM,CAAC,SAAS,0BAA0B,iCAAiC,QAAQ,YAAY,MAAM;AAE3G,SAAO,CAAC,EAAE,KAAK,QAAQ,aAAa,UAAU,QAAQ,CAAC;AACzD;AAGO,SAAS,sBAAsB;AAAA,EACpC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAA8C;AAC5C,QAAM,OAAO,WAAW,aAAa,cAAc,QAAQ;AAC3D,QAAM,cAAc,kBAAkB;AAAA,IACpC,OAAO,gBAAgB,YAAY;AAAA,IACnC,GAAG;AAAA,IACH,cAAc,gBAAgB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA,IACX,CAAC;AAAA,IACD,aAAa;AAAA,MACX,gBAAgB;AAAA,MAChB,GAAG,KAAK,QAAQ;AAAA,MAChB,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,qBAAqB;AAAA,MACnB,GAAG,KAAK,gBAAgB;AAAA,MACxB,GAAG,QAAQ;AAAA,IACb;AAAA,EACF,CAAC;AAED,SAAO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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 W(t){let e,s=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function i(){return JSON.parse(r().getItem(s)||"{}")}function m(a){r().setItem(s,JSON.stringify(a))}function p(){let a=t.timeToLive?t.timeToLive*1e3:null,o=i(),n=Object.fromEntries(Object.entries(o).filter(([,d])=>d.timestamp!==void 0));if(m(n),!a)return;let u=Object.fromEntries(Object.entries(n).filter(([,d])=>{let P=new Date().getTime();return!(d.timestamp+a<P)}));m(u)}return{get(a,o,n={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(p(),i()[JSON.stringify(a)])).then(u=>Promise.all([u?u.value:o(),u!==void 0])).then(([u,d])=>Promise.all([u,d||n.miss(u)])).then(([u])=>u)},set(a,o){return Promise.resolve().then(()=>{let n=i();return n[JSON.stringify(a)]={timestamp:new Date().getTime(),value:o},r().setItem(s,JSON.stringify(n)),o})},delete(a){return Promise.resolve().then(()=>{let o=i();delete o[JSON.stringify(a)],r().setItem(s,JSON.stringify(o))})},clear(){return Promise.resolve().then(()=>{r().removeItem(s)})}}}function ee(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(i=>Promise.all([i,s.miss(i)])).then(([i])=>i)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function q(t){let e=[...t.caches],s=e.shift();return s===void 0?ee():{get(r,i,m={miss:()=>Promise.resolve()}){return s.get(r,i,m).catch(()=>q({caches:e}).get(r,i,m))},set(r,i){return s.set(r,i).catch(()=>q({caches:e}).set(r,i))},delete(r){return s.delete(r).catch(()=>q({caches:e}).delete(r))},clear(){return s.clear().catch(()=>q({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return{get(s,r,i={miss:()=>Promise.resolve()}){let m=JSON.stringify(s);if(m in e)return Promise.resolve(t.serializable?JSON.parse(e[m]):e[m]);let p=r();return p.then(a=>i.miss(a)).then(()=>p)},set(s,r){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var $=1e3,j=2e3,J=3e4;function te(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let r=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(r)===-1&&(e.value=`${e.value}${r}`),e}};return e}function Q(t,e,s="WithinHeaders"){let r={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?r:{}},queryParameters(){return s==="WithinQueryParameters"?r:{}}}}function G({algoliaAgents:t,client:e,version:s}){let r=te(s).add({segment:e,version:s});return t.forEach(i=>r.add(i)),r}function M(){return{debug(t,e){return Promise.resolve()},info(t,e){return Promise.resolve()},error(t,e){return Promise.resolve()}}}var k=2*60*1e3;function H(t,e="up"){let s=Date.now();function r(){return e==="up"||Date.now()-s>k}function i(){return e==="timed out"&&Date.now()-s<=k}return{...t,status:e,lastUpdate:s,isUp:r,isTimedOut:i}}var z=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}},F=class extends z{stackTrace;constructor(t,e,s){super(t,s),this.stackTrace=e}},re=class extends F{constructor(t){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.",t,"RetryError")}},C=class extends F{status;constructor(t,e,s,r="ApiError"){super(t,s,r),this.status=e}},se=class extends z{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},oe=class extends C{error;constructor(t,e,s,r){super(t,e,r,"DetailedApiError"),this.error=s}};function ae(t,e,s){let r=ne(s),i=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(i+=`?${r}`),i}function ne(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replaceAll("+","%20")}`).join("&")}function ie(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function ce(t,e,s){let r={Accept:"application/json",...t,...e,...s},i={};return Object.keys(r).forEach(m=>{let p=r[m];i[m.toLowerCase()]=p}),i}function ue(t){try{return JSON.parse(t.content)}catch(e){throw new se(e.message,t)}}function le({content:t,status:e},s){try{let r=JSON.parse(t);return"error"in r?new oe(r.message,e,r.error,s):new C(r.message,e,s)}catch{}return new C(t,e,s)}function me({isTimedOut:t,status:e}){return!t&&~~e===0}function de({isTimedOut:t,status:e}){return t||me({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function he({status:t}){return~~(t/100)===2}function pe(t){return t.map(e=>X(e))}function X(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function K({hosts:t,hostsCache:e,baseHeaders:s,logger:r,baseQueryParameters:i,algoliaAgent:m,timeouts:p,requester:a,requestsCache:o,responsesCache:n}){async function u(c){let l=await Promise.all(c.map(h=>e.get(h,()=>Promise.resolve(H(h))))),f=l.filter(h=>h.isUp()),T=l.filter(h=>h.isTimedOut()),w=[...f,...T];return{hosts:w.length>0?w:c,getTimeout(h,A){return(T.length===0&&h===0?1:T.length+3+h)*A}}}async function d(c,l,f=!0){let T=[],w=ie(c,l),y=ce(s,c.headers,l.headers),h=c.method==="GET"?{...c.data,...l.data}:{},A={...i,...c.queryParameters,...h};if(m.value&&(A["x-algolia-agent"]=m.value),l&&l.queryParameters)for(let g of Object.keys(l.queryParameters))!l.queryParameters[g]||Object.prototype.toString.call(l.queryParameters[g])==="[object Object]"?A[g]=l.queryParameters[g]:A[g]=l.queryParameters[g].toString();let v=0,N=async(g,b)=>{let R=g.pop();if(R===void 0)throw new re(pe(T));let B={...p,...l.timeouts},I={data:w,headers:y,method:c.method,url:ae(R,c.path,A),connectTimeout:b(v,B.connect),responseTimeout:b(v,f?B.read:B.write)},U=x=>{let L={request:I,response:x,host:R,triesLeft:g.length};return T.push(L),L},E=await a.send(I);if(de(E)){let x=U(E);return E.isTimedOut&&v++,r.info("Retryable failure",X(x)),await e.set(R,H(R,E.isTimedOut?"timed out":"down")),N(g,b)}if(he(E))return ue(E);throw U(E),le(E,T)},Z=t.filter(g=>g.accept==="readWrite"||(f?g.accept==="read":g.accept==="write")),D=await u(Z);return N([...D.hosts].reverse(),D.getTimeout)}function P(c,l={}){let f=c.useReadTransporter||c.method==="GET";if(!f)return d(c,l,f);let T=()=>d(c,l);if((l.cacheable||c.cacheable)!==!0)return T();let y={request:c,requestOptions:l,transporter:{queryParameters:i,headers:s}};return n.get(y,()=>o.get(y,()=>o.set(y,T()).then(h=>Promise.all([o.delete(y),h]),h=>Promise.all([o.delete(y),Promise.reject(h)])).then(([h,A])=>A)),{miss:h=>n.set(y,h)})}return{hostsCache:e,requester:a,timeouts:p,logger:r,algoliaAgent:m,baseHeaders:s,baseQueryParameters:i,hosts:t,request:P,requestsCache:o,responsesCache:n}}function V(){function t(e){return new Promise(s=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>r.setRequestHeader(a,e.headers[a]));let i=(a,o)=>setTimeout(()=>{r.abort(),s({status:0,content:o,isTimedOut:!0})},a),m=i(e.connectTimeout,"Connection timeout"),p;r.onreadystatechange=()=>{r.readyState>r.OPENED&&p===void 0&&(clearTimeout(m),p=i(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(m),clearTimeout(p),s({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(m),clearTimeout(p),s({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}var S="5.7.0",_=["de","us"];function fe(t){return[{url:t?"analytics.{region}.algolia.com".replace("{region}",t):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function Y({appId:t,apiKey:e,authMode:s,algoliaAgents:r,region:i,...m}){let p=Q(t,e,s),a=K({hosts:fe(i),...m,algoliaAgent:G({algoliaAgents:r,client:"Abtesting",version:S}),baseHeaders:{"content-type":"text/plain",...p.headers(),...m.baseHeaders},baseQueryParameters:{...p.queryParameters(),...m.baseQueryParameters}});return{transporter:a,appId:t,clearCache(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then(()=>{})},get _ua(){return a.algoliaAgent.value},addAlgoliaAgent(o,n){a.algoliaAgent.add({segment:o,version:n})},setClientApiKey({apiKey:o}){!s||s==="WithinHeaders"?a.baseHeaders["x-algolia-api-key"]=o:a.baseQueryParameters["x-algolia-api-key"]=o},addABTests(o,n){if(!o)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!o.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!o.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!o.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let c={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:o};return a.request(c,n)},customDelete({path:o,parameters:n},u){if(!o)throw new Error("Parameter `path` is required when calling `customDelete`.");let l={method:"DELETE",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{}};return a.request(l,u)},customGet({path:o,parameters:n},u){if(!o)throw new Error("Parameter `path` is required when calling `customGet`.");let l={method:"GET",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{}};return a.request(l,u)},customPost({path:o,parameters:n,body:u},d){if(!o)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{},data:u||{}};return a.request(f,d)},customPut({path:o,parameters:n,body:u},d){if(!o)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{},data:u||{}};return a.request(f,d)},deleteABTest({id:o},n){if(!o)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let c={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(o)),queryParameters:{},headers:{}};return a.request(c,n)},getABTest({id:o},n){if(!o)throw new Error("Parameter `id` is required when calling `getABTest`.");let c={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(o)),queryParameters:{},headers:{}};return a.request(c,n)},listABTests({offset:o,limit:n,indexPrefix:u,indexSuffix:d}={},P=void 0){let c="/2/abtests",l={},f={};o!==void 0&&(f.offset=o.toString()),n!==void 0&&(f.limit=n.toString()),u!==void 0&&(f.indexPrefix=u.toString()),d!==void 0&&(f.indexSuffix=d.toString());let T={method:"GET",path:c,queryParameters:f,headers:l};return a.request(T,P)},scheduleABTest(o,n){if(!o)throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");if(!o.name)throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");if(!o.variants)throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");if(!o.scheduledAt)throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");if(!o.endAt)throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");let c={method:"POST",path:"/2/abtests/schedule",queryParameters:{},headers:{},data:o};return a.request(c,n)},stopABTest({id:o},n){if(!o)throw new Error("Parameter `id` is required when calling `stopABTest`.");let c={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(o)),queryParameters:{},headers:{}};return a.request(c,n)}}}function Ye(t,e,s,r){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(s&&(typeof s!="string"||!_.includes(s)))throw new Error(`\`region\` must be one of the following: ${_.join(", ")}`);return Y({appId:t,apiKey:e,region:s,timeouts:{connect:$,read:j,write:J},logger:M(),requester:V(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:q({caches:[W({key:`${S}-${t}`}),O()]}),...r})}export{Ye as abtestingClient,S as apiClientVersion};
|
|
1
|
+
function k(){function t(e){return new Promise(s=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>r.setRequestHeader(a,e.headers[a]));let i=(a,o)=>setTimeout(()=>{r.abort(),s({status:0,content:o,isTimedOut:!0})},a),m=i(e.connectTimeout,"Connection timeout"),p;r.onreadystatechange=()=>{r.readyState>r.OPENED&&p===void 0&&(clearTimeout(m),p=i(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(m),clearTimeout(p),s({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(m),clearTimeout(p),s({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}function $(t){let e,s=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function i(){return JSON.parse(r().getItem(s)||"{}")}function m(a){r().setItem(s,JSON.stringify(a))}function p(){let a=t.timeToLive?t.timeToLive*1e3:null,o=i(),n=Object.fromEntries(Object.entries(o).filter(([,d])=>d.timestamp!==void 0));if(m(n),!a)return;let u=Object.fromEntries(Object.entries(n).filter(([,d])=>{let P=new Date().getTime();return!(d.timestamp+a<P)}));m(u)}return{get(a,o,n={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(p(),i()[JSON.stringify(a)])).then(u=>Promise.all([u?u.value:o(),u!==void 0])).then(([u,d])=>Promise.all([u,d||n.miss(u)])).then(([u])=>u)},set(a,o){return Promise.resolve().then(()=>{let n=i();return n[JSON.stringify(a)]={timestamp:new Date().getTime(),value:o},r().setItem(s,JSON.stringify(n)),o})},delete(a){return Promise.resolve().then(()=>{let o=i();delete o[JSON.stringify(a)],r().setItem(s,JSON.stringify(o))})},clear(){return Promise.resolve().then(()=>{r().removeItem(s)})}}}function ee(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(i=>Promise.all([i,s.miss(i)])).then(([i])=>i)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function q(t){let e=[...t.caches],s=e.shift();return s===void 0?ee():{get(r,i,m={miss:()=>Promise.resolve()}){return s.get(r,i,m).catch(()=>q({caches:e}).get(r,i,m))},set(r,i){return s.set(r,i).catch(()=>q({caches:e}).set(r,i))},delete(r){return s.delete(r).catch(()=>q({caches:e}).delete(r))},clear(){return s.clear().catch(()=>q({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return{get(s,r,i={miss:()=>Promise.resolve()}){let m=JSON.stringify(s);if(m in e)return Promise.resolve(t.serializable?JSON.parse(e[m]):e[m]);let p=r();return p.then(a=>i.miss(a)).then(()=>p)},set(s,r){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var j=1e3,J=2e3,Q=3e4;function te(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let r=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(r)===-1&&(e.value=`${e.value}${r}`),e}};return e}function G(t,e,s="WithinHeaders"){let r={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?r:{}},queryParameters(){return s==="WithinQueryParameters"?r:{}}}}function M({algoliaAgents:t,client:e,version:s}){let r=te(s).add({segment:e,version:s});return t.forEach(i=>r.add(i)),r}function z(){return{debug(t,e){return Promise.resolve()},info(t,e){return Promise.resolve()},error(t,e){return Promise.resolve()}}}var H=2*60*1e3;function W(t,e="up"){let s=Date.now();function r(){return e==="up"||Date.now()-s>H}function i(){return e==="timed out"&&Date.now()-s<=H}return{...t,status:e,lastUpdate:s,isUp:r,isTimedOut:i}}var F=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}},X=class extends F{stackTrace;constructor(t,e,s){super(t,s),this.stackTrace=e}},re=class extends X{constructor(t){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.",t,"RetryError")}},C=class extends X{status;constructor(t,e,s,r="ApiError"){super(t,s,r),this.status=e}},se=class extends F{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},oe=class extends C{error;constructor(t,e,s,r){super(t,e,r,"DetailedApiError"),this.error=s}};function ae(t,e,s){let r=ne(s),i=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(i+=`?${r}`),i}function ne(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replace(/\+/g,"%20")}`).join("&")}function ie(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function ce(t,e,s){let r={Accept:"application/json",...t,...e,...s},i={};return Object.keys(r).forEach(m=>{let p=r[m];i[m.toLowerCase()]=p}),i}function ue(t){try{return JSON.parse(t.content)}catch(e){throw new se(e.message,t)}}function le({content:t,status:e},s){try{let r=JSON.parse(t);return"error"in r?new oe(r.message,e,r.error,s):new C(r.message,e,s)}catch{}return new C(t,e,s)}function me({isTimedOut:t,status:e}){return!t&&~~e===0}function de({isTimedOut:t,status:e}){return t||me({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function he({status:t}){return~~(t/100)===2}function pe(t){return t.map(e=>K(e))}function K(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function V({hosts:t,hostsCache:e,baseHeaders:s,logger:r,baseQueryParameters:i,algoliaAgent:m,timeouts:p,requester:a,requestsCache:o,responsesCache:n}){async function u(c){let l=await Promise.all(c.map(h=>e.get(h,()=>Promise.resolve(W(h))))),f=l.filter(h=>h.isUp()),T=l.filter(h=>h.isTimedOut()),w=[...f,...T];return{hosts:w.length>0?w:c,getTimeout(h,A){return(T.length===0&&h===0?1:T.length+3+h)*A}}}async function d(c,l,f=!0){let T=[],w=ie(c,l),y=ce(s,c.headers,l.headers),h=c.method==="GET"?{...c.data,...l.data}:{},A={...i,...c.queryParameters,...h};if(m.value&&(A["x-algolia-agent"]=m.value),l&&l.queryParameters)for(let g of Object.keys(l.queryParameters))!l.queryParameters[g]||Object.prototype.toString.call(l.queryParameters[g])==="[object Object]"?A[g]=l.queryParameters[g]:A[g]=l.queryParameters[g].toString();let v=0,N=async(g,b)=>{let R=g.pop();if(R===void 0)throw new re(pe(T));let B={...p,...l.timeouts},I={data:w,headers:y,method:c.method,url:ae(R,c.path,A),connectTimeout:b(v,B.connect),responseTimeout:b(v,f?B.read:B.write)},U=x=>{let L={request:I,response:x,host:R,triesLeft:g.length};return T.push(L),L},E=await a.send(I);if(de(E)){let x=U(E);return E.isTimedOut&&v++,r.info("Retryable failure",K(x)),await e.set(R,W(R,E.isTimedOut?"timed out":"down")),N(g,b)}if(he(E))return ue(E);throw U(E),le(E,T)},Z=t.filter(g=>g.accept==="readWrite"||(f?g.accept==="read":g.accept==="write")),D=await u(Z);return N([...D.hosts].reverse(),D.getTimeout)}function P(c,l={}){let f=c.useReadTransporter||c.method==="GET";if(!f)return d(c,l,f);let T=()=>d(c,l);if((l.cacheable||c.cacheable)!==!0)return T();let y={request:c,requestOptions:l,transporter:{queryParameters:i,headers:s}};return n.get(y,()=>o.get(y,()=>o.set(y,T()).then(h=>Promise.all([o.delete(y),h]),h=>Promise.all([o.delete(y),Promise.reject(h)])).then(([h,A])=>A)),{miss:h=>n.set(y,h)})}return{hostsCache:e,requester:a,timeouts:p,logger:r,algoliaAgent:m,baseHeaders:s,baseQueryParameters:i,hosts:t,request:P,requestsCache:o,responsesCache:n}}var S="5.8.0",_=["de","us"];function fe(t){return[{url:t?"analytics.{region}.algolia.com".replace("{region}",t):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function Y({appId:t,apiKey:e,authMode:s,algoliaAgents:r,region:i,...m}){let p=G(t,e,s),a=V({hosts:fe(i),...m,algoliaAgent:M({algoliaAgents:r,client:"Abtesting",version:S}),baseHeaders:{"content-type":"text/plain",...p.headers(),...m.baseHeaders},baseQueryParameters:{...p.queryParameters(),...m.baseQueryParameters}});return{transporter:a,appId:t,clearCache(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then(()=>{})},get _ua(){return a.algoliaAgent.value},addAlgoliaAgent(o,n){a.algoliaAgent.add({segment:o,version:n})},setClientApiKey({apiKey:o}){!s||s==="WithinHeaders"?a.baseHeaders["x-algolia-api-key"]=o:a.baseQueryParameters["x-algolia-api-key"]=o},addABTests(o,n){if(!o)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!o.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!o.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!o.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let c={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:o};return a.request(c,n)},customDelete({path:o,parameters:n},u){if(!o)throw new Error("Parameter `path` is required when calling `customDelete`.");let l={method:"DELETE",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{}};return a.request(l,u)},customGet({path:o,parameters:n},u){if(!o)throw new Error("Parameter `path` is required when calling `customGet`.");let l={method:"GET",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{}};return a.request(l,u)},customPost({path:o,parameters:n,body:u},d){if(!o)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{},data:u||{}};return a.request(f,d)},customPut({path:o,parameters:n,body:u},d){if(!o)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{},data:u||{}};return a.request(f,d)},deleteABTest({id:o},n){if(!o)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let c={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(o)),queryParameters:{},headers:{}};return a.request(c,n)},getABTest({id:o},n){if(!o)throw new Error("Parameter `id` is required when calling `getABTest`.");let c={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(o)),queryParameters:{},headers:{}};return a.request(c,n)},listABTests({offset:o,limit:n,indexPrefix:u,indexSuffix:d}={},P=void 0){let c="/2/abtests",l={},f={};o!==void 0&&(f.offset=o.toString()),n!==void 0&&(f.limit=n.toString()),u!==void 0&&(f.indexPrefix=u.toString()),d!==void 0&&(f.indexSuffix=d.toString());let T={method:"GET",path:c,queryParameters:f,headers:l};return a.request(T,P)},scheduleABTest(o,n){if(!o)throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");if(!o.name)throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");if(!o.variants)throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");if(!o.scheduledAt)throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");if(!o.endAt)throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");let c={method:"POST",path:"/2/abtests/schedule",queryParameters:{},headers:{},data:o};return a.request(c,n)},stopABTest({id:o},n){if(!o)throw new Error("Parameter `id` is required when calling `stopABTest`.");let c={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(o)),queryParameters:{},headers:{}};return a.request(c,n)}}}function tt(t,e,s,r){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(s&&(typeof s!="string"||!_.includes(s)))throw new Error(`\`region\` must be one of the following: ${_.join(", ")}`);return Y({appId:t,apiKey:e,region:s,timeouts:{connect:j,read:J,write:Q},logger:z(),requester:k(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:q({caches:[$({key:`${S}-${t}`}),O()]}),...r})}export{tt as abtestingClient,S as apiClientVersion};
|
|
2
2
|
//# sourceMappingURL=browser.min.js.map
|