@algolia/client-abtesting 5.0.0 → 5.1.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 +69 -0
- package/dist/builds/browser.d.ts +1 -0
- package/dist/builds/browser.d.ts.map +1 -1
- package/dist/builds/node.d.ts +1 -0
- package/dist/builds/node.d.ts.map +1 -1
- package/dist/client-abtesting.cjs +38 -1
- package/dist/client-abtesting.esm.browser.js +38 -1
- package/dist/client-abtesting.esm.node.js +38 -1
- package/dist/client-abtesting.umd.js +2 -2
- package/dist/model/index.d.ts +2 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/scheduleABTestResponse.d.ts +7 -0
- package/dist/model/scheduleABTestResponse.d.ts.map +1 -0
- package/dist/model/scheduleABTestsRequest.d.ts +20 -0
- package/dist/model/scheduleABTestsRequest.d.ts.map +1 -0
- package/dist/src/abtestingClient.d.ts +13 -1
- package/dist/src/abtestingClient.d.ts.map +1 -1
- package/model/index.ts +2 -0
- package/model/scheduleABTestResponse.ts +8 -0
- package/model/scheduleABTestsRequest.ts +25 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://www.algolia.com">
|
|
3
|
+
<img alt="Algolia for JavaScript" src="https://raw.githubusercontent.com/algolia/algoliasearch-client-common/master/banners/javascript.png" >
|
|
4
|
+
</a>
|
|
5
|
+
|
|
6
|
+
<h4 align="center">The perfect starting point to integrate <a href="https://algolia.com" target="_blank">Algolia</a> within your JavaScript project</h4>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://npmjs.org/package/@algolia/client-abtesting"><img src="https://img.shields.io/npm/v/@algolia/client-abtesting.svg?style=flat-square" alt="NPM version"></img></a>
|
|
10
|
+
<a href="http://npm-stat.com/charts.html?package=@algolia/client-abtesting"><img src="https://img.shields.io/npm/dm/@algolia/client-abtesting.svg?style=flat-square" alt="NPM downloads"></a>
|
|
11
|
+
<a href="https://www.jsdelivr.com/package/npm/@algolia/client-abtesting"><img src="https://data.jsdelivr.com/v1/package/npm/@algolia/client-abtesting/badge" alt="jsDelivr Downloads"></img></a>
|
|
12
|
+
<a href="LICENSE.md"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="License"></a>
|
|
13
|
+
</p>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://www.algolia.com/doc/api-client/getting-started/install/javascript/" target="_blank">Documentation</a> •
|
|
18
|
+
<a href="https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/" target="_blank">InstantSearch</a> •
|
|
19
|
+
<a href="https://discourse.algolia.com" target="_blank">Community Forum</a> •
|
|
20
|
+
<a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a> •
|
|
21
|
+
<a href="https://github.com/algolia/algoliasearch-client-javascript/issues" target="_blank">Report a bug</a> •
|
|
22
|
+
<a href="https://www.algolia.com/doc/api-client/troubleshooting/faq/javascript/" target="_blank">FAQ</a> •
|
|
23
|
+
<a href="https://alg.li/support" target="_blank">Support</a>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
## ✨ Features
|
|
27
|
+
|
|
28
|
+
- Thin & **minimal low-level HTTP client** to interact with Algolia's API
|
|
29
|
+
- Works both on the **browser** and **node.js**
|
|
30
|
+
- **UMD and ESM compatible**, you can use it with any module loader
|
|
31
|
+
- Built with TypeScript
|
|
32
|
+
|
|
33
|
+
## 💡 Getting Started
|
|
34
|
+
|
|
35
|
+
To get started, you first need to install @algolia/client-abtesting (or any other available API client package).
|
|
36
|
+
|
|
37
|
+
All of our clients comes with type definition, and are available for both browser and node environments.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
yarn add @algolia/client-abtesting
|
|
41
|
+
# or
|
|
42
|
+
npm install @algolia/client-abtesting
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Without a package manager
|
|
46
|
+
|
|
47
|
+
Add the following JavaScript snippet to the <head> of your website:
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<script src="https://cdn.jsdelivr.net/npm/algoliasearch/dist/client-abtesting.umd.min.js"></script>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
You can now import the Algolia API client in your project and play with it.
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
import { abtestingClient } from '@algolia/client-abtesting';
|
|
57
|
+
|
|
58
|
+
const client = abtestingClient('YOUR_APP_ID', 'YOUR_API_KEY');
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
For full documentation, visit the **[Algolia JavaScript API Client](https://www.algolia.com/doc/api-client/getting-started/install/javascript/)**.
|
|
62
|
+
|
|
63
|
+
## ❓ Troubleshooting
|
|
64
|
+
|
|
65
|
+
Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/api-client/troubleshooting/faq/javascript/) where you will find answers for the most common issues and gotchas with the client. You can also open [a GitHub issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=&projects=&template=Bug_report.md)
|
|
66
|
+
|
|
67
|
+
## 📄 License
|
|
68
|
+
|
|
69
|
+
The Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE).
|
package/dist/builds/browser.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare function abtestingClient(appId: string, apiKey: string, region?:
|
|
|
20
20
|
deleteABTest({ id }: import("../model").DeleteABTestProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<import("../model").ABTestResponse>;
|
|
21
21
|
getABTest({ id }: import("../model").GetABTestProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<import("../model").ABTest>;
|
|
22
22
|
listABTests({ offset, limit, indexPrefix, indexSuffix }?: import("../model").ListABTestsProps, requestOptions?: import("@algolia/client-common").RequestOptions | undefined): Promise<import("../model").ListABTestsResponse>;
|
|
23
|
+
scheduleABTest(scheduleABTestsRequest: import("../model").ScheduleABTestsRequest, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<import("../model").ScheduleABTestResponse>;
|
|
23
24
|
stopABTest({ id }: import("../model").StopABTestProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<import("../model").ABTestResponse>;
|
|
24
25
|
};
|
|
25
26
|
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../builds/browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAW5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAOrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAClE,cAAc,UAAU,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAGjE,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../builds/browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAW5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAOrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAClE,cAAc,UAAU,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAGjE,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa;;;;;;;;;;;;;;;;EAsCxB"}
|
package/dist/builds/node.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare function abtestingClient(appId: string, apiKey: string, region?:
|
|
|
20
20
|
deleteABTest({ id }: import("../model").DeleteABTestProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<import("../model").ABTestResponse>;
|
|
21
21
|
getABTest({ id }: import("../model").GetABTestProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<import("../model").ABTest>;
|
|
22
22
|
listABTests({ offset, limit, indexPrefix, indexSuffix }?: import("../model").ListABTestsProps, requestOptions?: import("@algolia/client-common").RequestOptions | undefined): Promise<import("../model").ListABTestsResponse>;
|
|
23
|
+
scheduleABTest(scheduleABTestsRequest: import("../model").ScheduleABTestsRequest, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<import("../model").ScheduleABTestResponse>;
|
|
23
24
|
stopABTest({ id }: import("../model").StopABTestProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<import("../model").ABTestResponse>;
|
|
24
25
|
};
|
|
25
26
|
//# sourceMappingURL=node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../builds/node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAU5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAClE,cAAc,UAAU,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAGjE,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../builds/node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAU5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAClE,cAAc,UAAU,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAGjE,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa;;;;;;;;;;;;;;;;EAkCxB"}
|
|
@@ -4,7 +4,7 @@ var clientCommon = require('@algolia/client-common');
|
|
|
4
4
|
var requesterNodeHttp = require('@algolia/requester-node-http');
|
|
5
5
|
|
|
6
6
|
// 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.
|
|
7
|
-
const apiClientVersion = '5.
|
|
7
|
+
const apiClientVersion = '5.1.0';
|
|
8
8
|
const REGIONS = ['de', 'us'];
|
|
9
9
|
function getDefaultHosts(region) {
|
|
10
10
|
const url = !region
|
|
@@ -280,6 +280,43 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
|
|
|
280
280
|
};
|
|
281
281
|
return transporter.request(request, requestOptions);
|
|
282
282
|
},
|
|
283
|
+
/**
|
|
284
|
+
* Schedule an A/B test to be started at a later time.
|
|
285
|
+
*
|
|
286
|
+
* Required API Key ACLs:
|
|
287
|
+
* - editSettings.
|
|
288
|
+
*
|
|
289
|
+
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
|
|
290
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
291
|
+
*/
|
|
292
|
+
scheduleABTest(scheduleABTestsRequest, requestOptions) {
|
|
293
|
+
if (!scheduleABTestsRequest) {
|
|
294
|
+
throw new Error('Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.');
|
|
295
|
+
}
|
|
296
|
+
if (!scheduleABTestsRequest.name) {
|
|
297
|
+
throw new Error('Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.');
|
|
298
|
+
}
|
|
299
|
+
if (!scheduleABTestsRequest.variants) {
|
|
300
|
+
throw new Error('Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.');
|
|
301
|
+
}
|
|
302
|
+
if (!scheduleABTestsRequest.scheduledAt) {
|
|
303
|
+
throw new Error('Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.');
|
|
304
|
+
}
|
|
305
|
+
if (!scheduleABTestsRequest.endAt) {
|
|
306
|
+
throw new Error('Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.');
|
|
307
|
+
}
|
|
308
|
+
const requestPath = '/2/abtests/schedule';
|
|
309
|
+
const headers = {};
|
|
310
|
+
const queryParameters = {};
|
|
311
|
+
const request = {
|
|
312
|
+
method: 'POST',
|
|
313
|
+
path: requestPath,
|
|
314
|
+
queryParameters,
|
|
315
|
+
headers,
|
|
316
|
+
data: scheduleABTestsRequest,
|
|
317
|
+
};
|
|
318
|
+
return transporter.request(request, requestOptions);
|
|
319
|
+
},
|
|
283
320
|
/**
|
|
284
321
|
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
|
|
285
322
|
*
|
|
@@ -676,7 +676,7 @@ function createXhrRequester() {
|
|
|
676
676
|
}
|
|
677
677
|
|
|
678
678
|
// 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.
|
|
679
|
-
const apiClientVersion = '5.
|
|
679
|
+
const apiClientVersion = '5.1.0';
|
|
680
680
|
const REGIONS = ['de', 'us'];
|
|
681
681
|
function getDefaultHosts(region) {
|
|
682
682
|
const url = !region
|
|
@@ -952,6 +952,43 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
|
|
|
952
952
|
};
|
|
953
953
|
return transporter.request(request, requestOptions);
|
|
954
954
|
},
|
|
955
|
+
/**
|
|
956
|
+
* Schedule an A/B test to be started at a later time.
|
|
957
|
+
*
|
|
958
|
+
* Required API Key ACLs:
|
|
959
|
+
* - editSettings.
|
|
960
|
+
*
|
|
961
|
+
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
|
|
962
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
963
|
+
*/
|
|
964
|
+
scheduleABTest(scheduleABTestsRequest, requestOptions) {
|
|
965
|
+
if (!scheduleABTestsRequest) {
|
|
966
|
+
throw new Error('Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.');
|
|
967
|
+
}
|
|
968
|
+
if (!scheduleABTestsRequest.name) {
|
|
969
|
+
throw new Error('Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.');
|
|
970
|
+
}
|
|
971
|
+
if (!scheduleABTestsRequest.variants) {
|
|
972
|
+
throw new Error('Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.');
|
|
973
|
+
}
|
|
974
|
+
if (!scheduleABTestsRequest.scheduledAt) {
|
|
975
|
+
throw new Error('Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.');
|
|
976
|
+
}
|
|
977
|
+
if (!scheduleABTestsRequest.endAt) {
|
|
978
|
+
throw new Error('Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.');
|
|
979
|
+
}
|
|
980
|
+
const requestPath = '/2/abtests/schedule';
|
|
981
|
+
const headers = {};
|
|
982
|
+
const queryParameters = {};
|
|
983
|
+
const request = {
|
|
984
|
+
method: 'POST',
|
|
985
|
+
path: requestPath,
|
|
986
|
+
queryParameters,
|
|
987
|
+
headers,
|
|
988
|
+
data: scheduleABTestsRequest,
|
|
989
|
+
};
|
|
990
|
+
return transporter.request(request, requestOptions);
|
|
991
|
+
},
|
|
955
992
|
/**
|
|
956
993
|
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
|
|
957
994
|
*
|
|
@@ -2,7 +2,7 @@ import { createAuth, createTransporter, getAlgoliaAgent, DEFAULT_CONNECT_TIMEOUT
|
|
|
2
2
|
import { createHttpRequester } from '@algolia/requester-node-http';
|
|
3
3
|
|
|
4
4
|
// 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.
|
|
5
|
-
const apiClientVersion = '5.
|
|
5
|
+
const apiClientVersion = '5.1.0';
|
|
6
6
|
const REGIONS = ['de', 'us'];
|
|
7
7
|
function getDefaultHosts(region) {
|
|
8
8
|
const url = !region
|
|
@@ -278,6 +278,43 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
|
|
|
278
278
|
};
|
|
279
279
|
return transporter.request(request, requestOptions);
|
|
280
280
|
},
|
|
281
|
+
/**
|
|
282
|
+
* Schedule an A/B test to be started at a later time.
|
|
283
|
+
*
|
|
284
|
+
* Required API Key ACLs:
|
|
285
|
+
* - editSettings.
|
|
286
|
+
*
|
|
287
|
+
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
|
|
288
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
289
|
+
*/
|
|
290
|
+
scheduleABTest(scheduleABTestsRequest, requestOptions) {
|
|
291
|
+
if (!scheduleABTestsRequest) {
|
|
292
|
+
throw new Error('Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.');
|
|
293
|
+
}
|
|
294
|
+
if (!scheduleABTestsRequest.name) {
|
|
295
|
+
throw new Error('Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.');
|
|
296
|
+
}
|
|
297
|
+
if (!scheduleABTestsRequest.variants) {
|
|
298
|
+
throw new Error('Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.');
|
|
299
|
+
}
|
|
300
|
+
if (!scheduleABTestsRequest.scheduledAt) {
|
|
301
|
+
throw new Error('Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.');
|
|
302
|
+
}
|
|
303
|
+
if (!scheduleABTestsRequest.endAt) {
|
|
304
|
+
throw new Error('Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.');
|
|
305
|
+
}
|
|
306
|
+
const requestPath = '/2/abtests/schedule';
|
|
307
|
+
const headers = {};
|
|
308
|
+
const queryParameters = {};
|
|
309
|
+
const request = {
|
|
310
|
+
method: 'POST',
|
|
311
|
+
path: requestPath,
|
|
312
|
+
queryParameters,
|
|
313
|
+
headers,
|
|
314
|
+
data: scheduleABTestsRequest,
|
|
315
|
+
};
|
|
316
|
+
return transporter.request(request, requestOptions);
|
|
317
|
+
},
|
|
281
318
|
/**
|
|
282
319
|
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
|
|
283
320
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! client-abtesting.umd.js | 5.
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/client-abtesting"]={})}(this,(function(e){"use strict";function t(e){let t;const r=`algolia-client-js-${e.key}`;function s(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(s().getItem(r)||"{}")}function o(e){s().setItem(r,JSON.stringify(e))}return{get:(t,r,s={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=a(),s=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(o(s),!t)return;o(Object.fromEntries(Object.entries(s).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),a()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||s.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const o=a();return o[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},s().setItem(r,JSON.stringify(o)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],s().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{s().removeItem(r)}))}}function r(e){const t=[...e.caches],s=t.shift();return void 0===s?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,o={miss:()=>Promise.resolve()})=>s.get(e,a,o).catch((()=>r({caches:t}).get(e,a,o))),set:(e,a)=>s.set(e,a).catch((()=>r({caches:t}).set(e,a))),delete:e=>s.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>s.clear().catch((()=>r({caches:t}).clear()))}}function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const o=JSON.stringify(r);if(o in t)return Promise.resolve(e.serializable?JSON.parse(t[o]):t[o]);const n=s();return n.then((e=>a.miss(e))).then((()=>n))},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const a=12e4;function o(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>a},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=a}}}function n(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class i extends Error{constructor(e,t){super(e),n(this,"name","AlgoliaError"),t&&(this.name=t)}}class u extends i{constructor(e,t,r){super(e,r),n(this,"stackTrace",void 0),this.stackTrace=t}}class c extends u{constructor(e){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.",e,"RetryError")}}class l extends u{constructor(e,t,r,s="ApiError"){super(e,r,s),n(this,"status",void 0),this.status=t}}class d extends i{constructor(e,t){super(e,"DeserializationError"),n(this,"response",void 0),this.response=t}}class m extends l{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),n(this,"error",void 0),this.error=r}}function h(e,t,r){const s=(a=r,Object.keys(a).filter((e=>void 0!==a[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(a[e])?a[e].join(","):a[e]).replaceAll("+","%20")}`)).join("&"));var a;let o=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return s.length&&(o+=`?${s}`),o}function p(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function f({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:n,requester:i,requestsCache:u,responsesCache:f}){async function g(u,f,g=!0){const y=[],P=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(u,f),w=function(e,t,r){const s={Accept:"application/json",...e,...t,...r},a={};return Object.keys(s).forEach((e=>{const t=s[e];a[e.toLowerCase()]=t})),a}(r,u.headers,f.headers),v="GET"===u.method?{...u.data,...f.data}:{},T={...s,...u.queryParameters,...v};if(a.value&&(T["x-algolia-agent"]=a.value),f&&f.queryParameters)for(const e of Object.keys(f.queryParameters))f.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(f.queryParameters[e])?T[e]=f.queryParameters[e].toString():T[e]=f.queryParameters[e];let q=0;const b=async(e,r)=>{const s=e.pop();if(void 0===s)throw new c(function(e){return e.map((e=>p(e)))}(y));let a=g?f.timeouts?.read||n.read:f.timeouts?.write||n.write;const v={data:P,headers:w,method:u.method,url:h(s,u.path,T),connectTimeout:r(q,f.timeouts?.connect||n.connect),responseTimeout:r(q,a)},O=t=>{const r={request:v,response:t,host:s,triesLeft:e.length};return y.push(r),r},A=await i.send(v);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(A)){const a=O(A);return A.isTimedOut&&q++,console.log("Retryable failure",p(a)),await t.set(s,o(s,A.isTimedOut?"timed out":"down")),b(e,r)}if(function({status:e}){return 2==~~(e/100)}(A))return function(e){try{return JSON.parse(e.content)}catch(t){throw new d(t.message,e)}}(A);throw O(A),function({content:e,status:t},r){try{const s=JSON.parse(e);return"error"in s?new m(s.message,t,s.error,r):new l(s.message,t,r)}catch(e){}return new l(e,t,r)}(A,y)},O=e.filter((e=>"readWrite"===e.accept||(g?"read"===e.accept:"write"===e.accept))),A=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(o(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),n=[...s,...a];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(O);return b([...A.hosts].reverse(),A.getTimeout)}return{hostsCache:t,requester:i,timeouts:n,algoliaAgent:a,baseHeaders:r,baseQueryParameters:s,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return g(e,t,a);const o=()=>g(e,t);if(!0!==(t.cacheable||e.cacheable))return o();const n={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return f.get(n,(()=>u.get(n,(()=>u.set(n,o()).then((e=>Promise.all([u.delete(n),e])),(e=>Promise.all([u.delete(n),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>f.set(n,e)})},requestsCache:u,responsesCache:f}}function g({algoliaAgents:e,client:t,version:r}){const s=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>s.add(e))),s}const y="5.0.0",P=["de","us"];e.abtestingClient=function(e,a,o,n){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");if(o&&("string"!=typeof o||!P.includes(o)))throw new Error(`\`region\` must be one of the following: ${P.join(", ")}`);return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,region:a,...o}){const n=function(e,t,r="WithinHeaders"){const s={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?s:{},queryParameters:()=>"WithinQueryParameters"===r?s:{}}}(e,t,r),i=f({hosts:(u=a,[{url:u?"analytics.{region}.algolia.com".replace("{region}",u):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]),...o,algoliaAgent:g({algoliaAgents:s,client:"Abtesting",version:y}),baseHeaders:{"content-type":"text/plain",...n.headers(),...o.baseHeaders},baseQueryParameters:{...n.queryParameters(),...o.baseQueryParameters}});var u;return{transporter:i,appId:e,clearCache:()=>Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then((()=>{})),get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,t){i.algoliaAgent.add({segment:e,version:t})},addABTests(e,t){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");const r={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return i.request(r,t)},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const s={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const s={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},customPost({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const a={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},customPut({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const a={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},deleteABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");const r={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},getABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");const r={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},listABTests({offset:e,limit:t,indexPrefix:r,indexSuffix:s}={},a=void 0){const o={};void 0!==e&&(o.offset=e.toString()),void 0!==t&&(o.limit=t.toString()),void 0!==r&&(o.indexPrefix=r.toString()),void 0!==s&&(o.indexSuffix=s.toString());const n={method:"GET",path:"/2/abtests",queryParameters:o,headers:{}};return i.request(n,a)},stopABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");const r={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)}}}({appId:e,apiKey:a,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const s=(e,s)=>setTimeout((()=>{r.abort(),t({status:0,content:s,isTimedOut:!0})}),e),a=s(e.connectTimeout,"Connection timeout");let o;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===o&&(clearTimeout(a),o=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(o),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(o),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:r({caches:[t({key:`${y}-${e}`}),s()]}),...n})},e.apiClientVersion=y}));
|
|
1
|
+
/*! client-abtesting.umd.js | 5.1.0 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/client-abtesting"]={})}(this,(function(e){"use strict";function t(e){let t;const r=`algolia-client-js-${e.key}`;function s(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(s().getItem(r)||"{}")}function n(e){s().setItem(r,JSON.stringify(e))}return{get:(t,r,s={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=a(),s=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(n(s),!t)return;n(Object.fromEntries(Object.entries(s).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),a()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||s.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=a();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},s().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],s().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{s().removeItem(r)}))}}function r(e){const t=[...e.caches],s=t.shift();return void 0===s?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,n={miss:()=>Promise.resolve()})=>s.get(e,a,n).catch((()=>r({caches:t}).get(e,a,n))),set:(e,a)=>s.set(e,a).catch((()=>r({caches:t}).set(e,a))),delete:e=>s.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>s.clear().catch((()=>r({caches:t}).clear()))}}function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=s();return o.then((e=>a.miss(e))).then((()=>o))},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const a=12e4;function n(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>a},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=a}}}function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class i extends Error{constructor(e,t){super(e),o(this,"name","AlgoliaError"),t&&(this.name=t)}}class u extends i{constructor(e,t,r){super(e,r),o(this,"stackTrace",void 0),this.stackTrace=t}}class c extends u{constructor(e){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.",e,"RetryError")}}class l extends u{constructor(e,t,r,s="ApiError"){super(e,r,s),o(this,"status",void 0),this.status=t}}class d extends i{constructor(e,t){super(e,"DeserializationError"),o(this,"response",void 0),this.response=t}}class h extends l{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),o(this,"error",void 0),this.error=r}}function m(e,t,r){const s=(a=r,Object.keys(a).filter((e=>void 0!==a[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(a[e])?a[e].join(","):a[e]).replaceAll("+","%20")}`)).join("&"));var a;let n=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return s.length&&(n+=`?${s}`),n}function p(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function f({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:o,requester:i,requestsCache:u,responsesCache:f}){async function g(u,f,g=!0){const w=[],y=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(u,f),P=function(e,t,r){const s={Accept:"application/json",...e,...t,...r},a={};return Object.keys(s).forEach((e=>{const t=s[e];a[e.toLowerCase()]=t})),a}(r,u.headers,f.headers),T="GET"===u.method?{...u.data,...f.data}:{},q={...s,...u.queryParameters,...T};if(a.value&&(q["x-algolia-agent"]=a.value),f&&f.queryParameters)for(const e of Object.keys(f.queryParameters))f.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(f.queryParameters[e])?q[e]=f.queryParameters[e].toString():q[e]=f.queryParameters[e];let v=0;const b=async(e,r)=>{const s=e.pop();if(void 0===s)throw new c(function(e){return e.map((e=>p(e)))}(w));let a=g?f.timeouts?.read||o.read:f.timeouts?.write||o.write;const T={data:y,headers:P,method:u.method,url:m(s,u.path,q),connectTimeout:r(v,f.timeouts?.connect||o.connect),responseTimeout:r(v,a)},A=t=>{const r={request:T,response:t,host:s,triesLeft:e.length};return w.push(r),r},E=await i.send(T);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(E)){const a=A(E);return E.isTimedOut&&v++,console.log("Retryable failure",p(a)),await t.set(s,n(s,E.isTimedOut?"timed out":"down")),b(e,r)}if(function({status:e}){return 2==~~(e/100)}(E))return function(e){try{return JSON.parse(e.content)}catch(t){throw new d(t.message,e)}}(E);throw A(E),function({content:e,status:t},r){try{const s=JSON.parse(e);return"error"in s?new h(s.message,t,s.error,r):new l(s.message,t,r)}catch(e){}return new l(e,t,r)}(E,w)},A=e.filter((e=>"readWrite"===e.accept||(g?"read"===e.accept:"write"===e.accept))),E=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(n(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),o=[...s,...a];return{hosts:o.length>0?o:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(A);return b([...E.hosts].reverse(),E.getTimeout)}return{hostsCache:t,requester:i,timeouts:o,algoliaAgent:a,baseHeaders:r,baseQueryParameters:s,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return g(e,t,a);const n=()=>g(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return f.get(o,(()=>u.get(o,(()=>u.set(o,n()).then((e=>Promise.all([u.delete(o),e])),(e=>Promise.all([u.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>f.set(o,e)})},requestsCache:u,responsesCache:f}}function g({algoliaAgents:e,client:t,version:r}){const s=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>s.add(e))),s}const w="5.1.0",y=["de","us"];e.abtestingClient=function(e,a,n,o){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");if(n&&("string"!=typeof n||!y.includes(n)))throw new Error(`\`region\` must be one of the following: ${y.join(", ")}`);return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,region:a,...n}){const o=function(e,t,r="WithinHeaders"){const s={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?s:{},queryParameters:()=>"WithinQueryParameters"===r?s:{}}}(e,t,r),i=f({hosts:(u=a,[{url:u?"analytics.{region}.algolia.com".replace("{region}",u):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]),...n,algoliaAgent:g({algoliaAgents:s,client:"Abtesting",version:w}),baseHeaders:{"content-type":"text/plain",...o.headers(),...n.baseHeaders},baseQueryParameters:{...o.queryParameters(),...n.baseQueryParameters}});var u;return{transporter:i,appId:e,clearCache:()=>Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then((()=>{})),get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,t){i.algoliaAgent.add({segment:e,version:t})},addABTests(e,t){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");const r={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return i.request(r,t)},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const s={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const s={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},customPost({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const a={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},customPut({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const a={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},deleteABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");const r={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},getABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");const r={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},listABTests({offset:e,limit:t,indexPrefix:r,indexSuffix:s}={},a=void 0){const n={};void 0!==e&&(n.offset=e.toString()),void 0!==t&&(n.limit=t.toString()),void 0!==r&&(n.indexPrefix=r.toString()),void 0!==s&&(n.indexSuffix=s.toString());const o={method:"GET",path:"/2/abtests",queryParameters:n,headers:{}};return i.request(o,a)},scheduleABTest(e,t){if(!e)throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");if(!e.name)throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");if(!e.variants)throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");if(!e.scheduledAt)throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");if(!e.endAt)throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");const r={method:"POST",path:"/2/abtests/schedule",queryParameters:{},headers:{},data:e};return i.request(r,t)},stopABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");const r={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)}}}({appId:e,apiKey:a,region:n,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const s=(e,s)=>setTimeout((()=>{r.abort(),t({status:0,content:s,isTimedOut:!0})}),e),a=s(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:r({caches:[t({key:`${w}-${e}`}),s()]}),...o})},e.apiClientVersion=w}));
|
package/dist/model/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export * from './listABTestsResponse';
|
|
|
16
16
|
export * from './minimumDetectableEffect';
|
|
17
17
|
export * from './outliers';
|
|
18
18
|
export * from './outliersFilter';
|
|
19
|
+
export * from './scheduleABTestResponse';
|
|
20
|
+
export * from './scheduleABTestsRequest';
|
|
19
21
|
export * from './status';
|
|
20
22
|
export * from './variant';
|
|
21
23
|
export * from './clientMethodProps';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../model/index.ts"],"names":[],"mappings":"AAEA,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../model/index.ts"],"names":[],"mappings":"AAEA,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduleABTestResponse.d.ts","sourceRoot":"","sources":["../../model/scheduleABTestResponse.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AddABTestsVariant } from './addABTestsVariant';
|
|
2
|
+
export type ScheduleABTestsRequest = {
|
|
3
|
+
/**
|
|
4
|
+
* A/B test name.
|
|
5
|
+
*/
|
|
6
|
+
name: string;
|
|
7
|
+
/**
|
|
8
|
+
* A/B test variants.
|
|
9
|
+
*/
|
|
10
|
+
variants: AddABTestsVariant[];
|
|
11
|
+
/**
|
|
12
|
+
* Date and time when the A/B test is scheduled to start, in RFC 3339 format.
|
|
13
|
+
*/
|
|
14
|
+
scheduledAt: string;
|
|
15
|
+
/**
|
|
16
|
+
* End date and time of the A/B test, in RFC 3339 format.
|
|
17
|
+
*/
|
|
18
|
+
endAt: string;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=scheduleABTestsRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduleABTestsRequest.d.ts","sourceRoot":"","sources":["../../model/scheduleABTestsRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAE9B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
@@ -4,7 +4,9 @@ import type { ABTestResponse } from '../model/aBTestResponse';
|
|
|
4
4
|
import type { AddABTestsRequest } from '../model/addABTestsRequest';
|
|
5
5
|
import type { CustomDeleteProps, CustomGetProps, CustomPostProps, CustomPutProps, DeleteABTestProps, GetABTestProps, ListABTestsProps, StopABTestProps } from '../model/clientMethodProps';
|
|
6
6
|
import type { ListABTestsResponse } from '../model/listABTestsResponse';
|
|
7
|
-
|
|
7
|
+
import type { ScheduleABTestResponse } from '../model/scheduleABTestResponse';
|
|
8
|
+
import type { ScheduleABTestsRequest } from '../model/scheduleABTestsRequest';
|
|
9
|
+
export declare const apiClientVersion = "5.1.0";
|
|
8
10
|
export declare const REGIONS: readonly ["de", "us"];
|
|
9
11
|
export type Region = (typeof REGIONS)[number];
|
|
10
12
|
export declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & {
|
|
@@ -114,6 +116,16 @@ export declare function createAbtestingClient({ appId: appIdOption, apiKey: apiK
|
|
|
114
116
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
115
117
|
*/
|
|
116
118
|
listABTests({ offset, limit, indexPrefix, indexSuffix }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
|
|
119
|
+
/**
|
|
120
|
+
* Schedule an A/B test to be started at a later time.
|
|
121
|
+
*
|
|
122
|
+
* Required API Key ACLs:
|
|
123
|
+
* - editSettings.
|
|
124
|
+
*
|
|
125
|
+
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
|
|
126
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
127
|
+
*/
|
|
128
|
+
scheduleABTest(scheduleABTestsRequest: ScheduleABTestsRequest, requestOptions?: RequestOptions): Promise<ScheduleABTestResponse>;
|
|
117
129
|
/**
|
|
118
130
|
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
|
|
119
131
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abtestingClient.d.ts","sourceRoot":"","sources":["../../src/abtestingClient.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,mBAAmB,EAKnB,cAAc,EACf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"abtestingClient.d.ts","sourceRoot":"","sources":["../../src/abtestingClient.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,mBAAmB,EAKnB,cAAc,EACf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAE9E,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,eAAO,MAAM,OAAO,uBAAwB,CAAC;AAC7C,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAW9C,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,YAAY,EACpB,QAAQ,EACR,aAAa,EACb,MAAM,EAAE,YAAY,EACpB,GAAG,OAAO,EACX,EAAE,mBAAmB,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;;IAwBxC;;OAEG;;IAGH;;OAEG;kBACW,OAAO,CAAC,IAAI,CAAC;IAO3B;;OAEG;;IAKH;;;;;OAKG;6BACsB,MAAM,YAAY,MAAM,GAAG,IAAI;IAIxD;;;;;;;;OAQG;kCAEkB,iBAAiB,mBACnB,cAAc,GAC9B,OAAO,CAAC,cAAc,CAAC;IAsC1B;;;;;;;OAOG;uCAEqB,iBAAiB,mBACtB,cAAc,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAqB/B;;;;;;;OAOG;oCAEqB,cAAc,mBACnB,cAAc,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAqB/B;;;;;;;;OAQG;2CAE2B,eAAe,mBAC1B,cAAc,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAsB/B;;;;;;;;OAQG;0CAE2B,cAAc,mBACzB,cAAc,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAsB/B;;;;;;;;;OASG;yBAEO,iBAAiB,mBACR,cAAc,GAC9B,OAAO,CAAC,cAAc,CAAC;IAwB1B;;;;;;;;;OASG;sBAEO,cAAc,mBACL,cAAc,GAC9B,OAAO,CAAC,MAAM,CAAC;IAsBlB;;;;;;;;;;;;OAYG;8DAE4C,gBAAgB,mBAC7C,cAAc,GAAG,SAAS,GACzC,OAAO,CAAC,mBAAmB,CAAC;IA+B/B;;;;;;;;OAQG;2CAEuB,sBAAsB,mBAC7B,cAAc,GAC9B,OAAO,CAAC,sBAAsB,CAAC;IA2ClC;;;;;;;;;OASG;uBAEO,eAAe,mBACN,cAAc,GAC9B,OAAO,CAAC,cAAc,CAAC;EAwB7B"}
|
package/model/index.ts
CHANGED
|
@@ -18,6 +18,8 @@ export * from './listABTestsResponse';
|
|
|
18
18
|
export * from './minimumDetectableEffect';
|
|
19
19
|
export * from './outliers';
|
|
20
20
|
export * from './outliersFilter';
|
|
21
|
+
export * from './scheduleABTestResponse';
|
|
22
|
+
export * from './scheduleABTestsRequest';
|
|
21
23
|
export * from './status';
|
|
22
24
|
export * from './variant';
|
|
23
25
|
export * from './clientMethodProps';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// 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.
|
|
2
|
+
|
|
3
|
+
export type ScheduleABTestResponse = {
|
|
4
|
+
/**
|
|
5
|
+
* Unique scheduled A/B test identifier.
|
|
6
|
+
*/
|
|
7
|
+
abTestScheduleID: number;
|
|
8
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// 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.
|
|
2
|
+
|
|
3
|
+
import type { AddABTestsVariant } from './addABTestsVariant';
|
|
4
|
+
|
|
5
|
+
export type ScheduleABTestsRequest = {
|
|
6
|
+
/**
|
|
7
|
+
* A/B test name.
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A/B test variants.
|
|
13
|
+
*/
|
|
14
|
+
variants: AddABTestsVariant[];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Date and time when the A/B test is scheduled to start, in RFC 3339 format.
|
|
18
|
+
*/
|
|
19
|
+
scheduledAt: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* End date and time of the A/B test, in RFC 3339 format.
|
|
23
|
+
*/
|
|
24
|
+
endAt: string;
|
|
25
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@algolia/client-abtesting",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "JavaScript client for client-abtesting",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"clean": "rm -rf ./dist || true"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@algolia/client-common": "5.
|
|
46
|
-
"@algolia/requester-browser-xhr": "5.
|
|
47
|
-
"@algolia/requester-node-http": "5.
|
|
45
|
+
"@algolia/client-common": "5.1.0",
|
|
46
|
+
"@algolia/requester-browser-xhr": "5.1.0",
|
|
47
|
+
"@algolia/requester-node-http": "5.1.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/node": "22.2.0",
|