@algolia/abtesting 0.0.1-alpha.6 → 1.2.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 +7 -7
- package/dist/browser.d.ts +9 -5
- package/dist/builds/browser.js +7 -7
- 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 +7 -7
- package/dist/builds/fetch.js.map +1 -1
- package/dist/builds/node.cjs +8 -8
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +7 -7
- package/dist/builds/node.js.map +1 -1
- package/dist/builds/worker.js +7 -7
- package/dist/builds/worker.js.map +1 -1
- package/dist/fetch.d.ts +9 -5
- package/dist/node.d.cts +9 -5
- package/dist/node.d.ts +9 -5
- package/dist/src/{abtestingClient.cjs → abtestingV3Client.cjs} +10 -10
- package/dist/src/abtestingV3Client.cjs.map +1 -0
- package/dist/src/{abtestingClient.js → abtestingV3Client.js} +6 -6
- package/dist/src/abtestingV3Client.js.map +1 -0
- package/dist/worker.d.ts +9 -5
- package/package.json +7 -7
- package/dist/src/abtestingClient.cjs.map +0 -1
- package/dist/src/abtestingClient.js.map +0 -1
package/README.md
CHANGED
|
@@ -41,11 +41,11 @@ All of our clients comes with type definition, and are available for both browse
|
|
|
41
41
|
### With a package manager
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
yarn add @algolia/abtesting@
|
|
44
|
+
yarn add @algolia/abtesting@1.2.0
|
|
45
45
|
# or
|
|
46
|
-
npm install @algolia/abtesting@
|
|
46
|
+
npm install @algolia/abtesting@1.2.0
|
|
47
47
|
# or
|
|
48
|
-
pnpm add @algolia/abtesting@
|
|
48
|
+
pnpm add @algolia/abtesting@1.2.0
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
### Without a package manager
|
|
@@ -53,7 +53,7 @@ pnpm add @algolia/abtesting@0.0.1-alpha.6
|
|
|
53
53
|
Add the following JavaScript snippet to the <head> of your website:
|
|
54
54
|
|
|
55
55
|
```html
|
|
56
|
-
<script src="https://cdn.jsdelivr.net/npm/@algolia/abtesting@
|
|
56
|
+
<script src="https://cdn.jsdelivr.net/npm/@algolia/abtesting@1.2.0/dist/builds/browser.umd.js"></script>
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
### Usage
|
|
@@ -61,12 +61,12 @@ Add the following JavaScript snippet to the <head> of your website:
|
|
|
61
61
|
You can now import the Algolia API client in your project and play with it.
|
|
62
62
|
|
|
63
63
|
```js
|
|
64
|
-
import {
|
|
64
|
+
import { abtestingV3Client } from '@algolia/abtesting';
|
|
65
65
|
|
|
66
|
-
const client =
|
|
66
|
+
const client = abtestingV3Client('YOUR_APP_ID', 'YOUR_API_KEY');
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
For full documentation, visit the **[Algolia JavaScript API Client](https://www.algolia.com/doc/libraries/javascript/v5/methods/abtesting/)**.
|
|
69
|
+
For full documentation, visit the **[Algolia JavaScript API Client](https://www.algolia.com/doc/libraries/javascript/v5/methods/abtesting-v3/)**.
|
|
70
70
|
|
|
71
71
|
## ❓ Troubleshooting
|
|
72
72
|
|
package/dist/browser.d.ts
CHANGED
|
@@ -197,6 +197,10 @@ type ABTest = {
|
|
|
197
197
|
* End date and time of the A/B test, in RFC 3339 format.
|
|
198
198
|
*/
|
|
199
199
|
endAt: string;
|
|
200
|
+
/**
|
|
201
|
+
* Date and time when the A/B test was stopped, in RFC 3339 format.
|
|
202
|
+
*/
|
|
203
|
+
stoppedAt?: string | null | undefined;
|
|
200
204
|
/**
|
|
201
205
|
* A/B test name.
|
|
202
206
|
*/
|
|
@@ -539,13 +543,13 @@ type StopABTestProps = {
|
|
|
539
543
|
id: number;
|
|
540
544
|
};
|
|
541
545
|
|
|
542
|
-
declare const apiClientVersion = "
|
|
546
|
+
declare const apiClientVersion = "1.2.0";
|
|
543
547
|
declare const REGIONS: readonly ["de", "us"];
|
|
544
548
|
type Region = (typeof REGIONS)[number];
|
|
545
549
|
type RegionOptions = {
|
|
546
550
|
region?: Region | undefined;
|
|
547
551
|
};
|
|
548
|
-
declare function
|
|
552
|
+
declare function createAbtestingV3Client({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
|
|
549
553
|
transporter: _algolia_client_common.Transporter;
|
|
550
554
|
/**
|
|
551
555
|
* The `appId` currently in use.
|
|
@@ -706,7 +710,7 @@ type ErrorBase = Record<string, any> & {
|
|
|
706
710
|
message?: string | undefined;
|
|
707
711
|
};
|
|
708
712
|
|
|
709
|
-
declare function
|
|
710
|
-
type
|
|
713
|
+
declare function abtestingV3Client(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingV3Client;
|
|
714
|
+
type AbtestingV3Client = ReturnType<typeof createAbtestingV3Client>;
|
|
711
715
|
|
|
712
|
-
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type
|
|
716
|
+
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingV3Client, type AddABTestsRequest, type AddABTestsVariant, type CreateMetric, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type Direction, type EffectMetric, type EmptySearchFilter, type ErrorBase, type ErrorCorrectionType, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type GetTimeseriesProps, type ListABTestsProps, type ListABTestsResponse, type MetricDate, type MetricMetadata, type MetricName, type MetricResult, type MetricsFilter, type MinimumDetectableEffect, type OutliersFilter, type Region, type RegionOptions, type ScheduleABTestResponse, type ScheduleABTestsRequest, type Status, type StopABTestProps, type Timeseries, type TimeseriesVariant, type Variant, type VariantMetadata, abtestingV3Client, apiClientVersion };
|
package/dist/builds/browser.js
CHANGED
|
@@ -7,15 +7,15 @@ import {
|
|
|
7
7
|
createNullLogger
|
|
8
8
|
} from "@algolia/client-common";
|
|
9
9
|
|
|
10
|
-
// src/
|
|
10
|
+
// src/abtestingV3Client.ts
|
|
11
11
|
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
|
|
12
|
-
var apiClientVersion = "
|
|
12
|
+
var apiClientVersion = "1.2.0";
|
|
13
13
|
var REGIONS = ["de", "us"];
|
|
14
14
|
function getDefaultHosts(region) {
|
|
15
15
|
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
|
|
16
16
|
return [{ url, accept: "readWrite", protocol: "https" }];
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function createAbtestingV3Client({
|
|
19
19
|
appId: appIdOption,
|
|
20
20
|
apiKey: apiKeyOption,
|
|
21
21
|
authMode,
|
|
@@ -29,7 +29,7 @@ function createAbtestingClient({
|
|
|
29
29
|
...options,
|
|
30
30
|
algoliaAgent: getAlgoliaAgent({
|
|
31
31
|
algoliaAgents,
|
|
32
|
-
client: "
|
|
32
|
+
client: "AbtestingV3",
|
|
33
33
|
version: apiClientVersion
|
|
34
34
|
}),
|
|
35
35
|
baseHeaders: {
|
|
@@ -435,7 +435,7 @@ function createAbtestingClient({
|
|
|
435
435
|
}
|
|
436
436
|
|
|
437
437
|
// builds/browser.ts
|
|
438
|
-
function
|
|
438
|
+
function abtestingV3Client(appId, apiKey, region, options) {
|
|
439
439
|
if (!appId || typeof appId !== "string") {
|
|
440
440
|
throw new Error("`appId` is missing.");
|
|
441
441
|
}
|
|
@@ -445,7 +445,7 @@ function abtestingClient(appId, apiKey, region, options) {
|
|
|
445
445
|
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
|
|
446
446
|
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
|
|
447
447
|
}
|
|
448
|
-
return
|
|
448
|
+
return createAbtestingV3Client({
|
|
449
449
|
appId,
|
|
450
450
|
apiKey,
|
|
451
451
|
region,
|
|
@@ -467,7 +467,7 @@ function abtestingClient(appId, apiKey, region, options) {
|
|
|
467
467
|
});
|
|
468
468
|
}
|
|
469
469
|
export {
|
|
470
|
-
|
|
470
|
+
abtestingV3Client,
|
|
471
471
|
apiClientVersion
|
|
472
472
|
};
|
|
473
473
|
//# sourceMappingURL=browser.js.map
|
|
@@ -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 { createXhrRequester } from '@algolia/requester-browser-xhr';\n\nimport {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { apiClientVersion, createAbtestingClient } from '../src/abtestingClient';\n\nimport type { Region } from '../src/abtestingClient';\nimport { REGIONS } from '../src/abtestingClient';\n\nexport type { Region, RegionOptions } from '../src/abtestingClient';\n\nexport { apiClientVersion } from '../src/abtestingClient';\n\nexport * from '../model';\n\nexport function abtestingClient(\n appId: string,\n apiKey: string,\n region?: Region | undefined,\n options?: ClientOptions | undefined,\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: 1000,\n read: 2000,\n write: 30000,\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 { EstimateABTestRequest } from '../model/estimateABTestRequest';\nimport type { EstimateABTestResponse } from '../model/estimateABTestResponse';\nimport type { ListABTestsResponse } from '../model/listABTestsResponse';\n\nimport type { ScheduleABTestResponse } from '../model/scheduleABTestResponse';\nimport type { ScheduleABTestsRequest } from '../model/scheduleABTestsRequest';\nimport type { Timeseries } from '../model/timeseries';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteABTestProps,\n GetABTestProps,\n GetTimeseriesProps,\n ListABTestsProps,\n StopABTestProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '0.0.1-alpha.6';\n\nexport const REGIONS = ['de', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region?: Region | undefined };\n\nfunction getDefaultHosts(region?: Region | undefined): 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\nexport function createAbtestingClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\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 * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\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 | undefined): 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.metrics) {\n throw new Error('Parameter `addABTestsRequest.metrics` 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 = '/3/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 lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\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 lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\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 lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\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 lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\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 = '/3/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 * Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.\n *\n * Required API Key ACLs:\n * - analytics\n * @param estimateABTestRequest - The estimateABTestRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n estimateABTest(\n estimateABTestRequest: EstimateABTestRequest,\n requestOptions?: RequestOptions,\n ): Promise<EstimateABTestResponse> {\n if (!estimateABTestRequest) {\n throw new Error('Parameter `estimateABTestRequest` is required when calling `estimateABTest`.');\n }\n\n if (!estimateABTestRequest.configuration) {\n throw new Error('Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.');\n }\n if (!estimateABTestRequest.variants) {\n throw new Error('Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.');\n }\n\n const requestPath = '/3/abtests/estimate';\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: estimateABTestRequest,\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 = '/3/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 * Retrieves timeseries for an A/B test by its ID.\n *\n * Required API Key ACLs:\n * - analytics\n * @param getTimeseries - The getTimeseries object.\n * @param getTimeseries.id - Unique A/B test identifier.\n * @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.\n * @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.\n * @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getTimeseries(\n { id, startDate, endDate, metric }: GetTimeseriesProps,\n requestOptions?: RequestOptions,\n ): Promise<Timeseries> {\n if (!id) {\n throw new Error('Parameter `id` is required when calling `getTimeseries`.');\n }\n\n const requestPath = '/3/abtests/{id}/timeseries'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (startDate !== undefined) {\n queryParameters['startDate'] = startDate.toString();\n }\n\n if (endDate !== undefined) {\n queryParameters['endDate'] = endDate.toString();\n }\n\n if (metric !== undefined) {\n queryParameters['metric'] = metric.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 * 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 listABTests.direction - Sort order for A/B tests by start date. Use \\'asc\\' for ascending or \\'desc\\' for descending. Active A/B tests are always listed first.\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, direction }: ListABTestsProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<ListABTestsResponse> {\n const requestPath = '/3/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 if (direction !== undefined) {\n queryParameters['direction'] = direction.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.metrics) {\n throw new Error('Parameter `scheduleABTestsRequest.metrics` 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 = '/3/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 = '/3/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,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACCP,SAAS,YAAY,mBAAmB,uBAAuB;AA0BxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAIlC,SAAS,gBAAgB,QAAqC;AAC5D,QAAM,MAAM,CAAC,SAAS,0BAA0B,iCAAiC,QAAQ,YAAY,MAAM;AAE3G,SAAO,CAAC,EAAE,KAAK,QAAQ,aAAa,UAAU,QAAQ,CAAC;AACzD;AAEO,SAAS,sBAAsB;AAAA,EACpC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAAwC;AACtC,QAAM,OAAO,WAAW,aAAa,cAAc,QAAQ;AAC3D,QAAM,cAAc,kBAAkB;AAAA,IACpC,OAAO,gBAAgB,YAAY;AAAA,IACnC,GAAG;AAAA,IACH,cAAc,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;AACF;;;AD/gBO,SAAS,gBACd,OACA,QACA,QACA,SACiB;AACjB,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACvC,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,MAAI,WAAW,OAAO,WAAW,YAAY,CAAC,QAAQ,SAAS,MAAM,IAAI;AACvE,UAAM,IAAI,MAAM,4CAA4C,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,EAClF;AAEA,SAAO,sBAAsB;AAAA,IAC3B;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA,QAAQ,iBAAiB;AAAA,IACzB,WAAW,mBAAmB;AAAA,IAC9B,eAAe,CAAC,EAAE,SAAS,UAAU,CAAC;AAAA,IACtC,UAAU;AAAA,IACV,gBAAgB,kBAAkB;AAAA,IAClC,eAAe,kBAAkB,EAAE,cAAc,MAAM,CAAC;AAAA,IACxD,YAAY,wBAAwB;AAAA,MAClC,QAAQ,CAAC,+BAA+B,EAAE,KAAK,GAAG,gBAAgB,IAAI,KAAK,GAAG,CAAC,GAAG,kBAAkB,CAAC;AAAA,IACvG,CAAC;AAAA,IACD,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../builds/browser.ts","../../src/abtestingV3Client.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 createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { apiClientVersion, createAbtestingV3Client } from '../src/abtestingV3Client';\n\nimport type { Region } from '../src/abtestingV3Client';\nimport { REGIONS } from '../src/abtestingV3Client';\n\nexport type { Region, RegionOptions } from '../src/abtestingV3Client';\n\nexport { apiClientVersion } from '../src/abtestingV3Client';\n\nexport * from '../model';\n\nexport function abtestingV3Client(\n appId: string,\n apiKey: string,\n region?: Region | undefined,\n options?: ClientOptions | undefined,\n): AbtestingV3Client {\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 createAbtestingV3Client({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 1000,\n read: 2000,\n write: 30000,\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 AbtestingV3Client = ReturnType<typeof createAbtestingV3Client>;\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 { EstimateABTestRequest } from '../model/estimateABTestRequest';\nimport type { EstimateABTestResponse } from '../model/estimateABTestResponse';\nimport type { ListABTestsResponse } from '../model/listABTestsResponse';\n\nimport type { ScheduleABTestResponse } from '../model/scheduleABTestResponse';\nimport type { ScheduleABTestsRequest } from '../model/scheduleABTestsRequest';\nimport type { Timeseries } from '../model/timeseries';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteABTestProps,\n GetABTestProps,\n GetTimeseriesProps,\n ListABTestsProps,\n StopABTestProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '1.2.0';\n\nexport const REGIONS = ['de', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region?: Region | undefined };\n\nfunction getDefaultHosts(region?: Region | undefined): 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\nexport function createAbtestingV3Client({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'AbtestingV3',\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 * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\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 | undefined): 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.metrics) {\n throw new Error('Parameter `addABTestsRequest.metrics` 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 = '/3/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 lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\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 lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\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 lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\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 lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\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 = '/3/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 * Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.\n *\n * Required API Key ACLs:\n * - analytics\n * @param estimateABTestRequest - The estimateABTestRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n estimateABTest(\n estimateABTestRequest: EstimateABTestRequest,\n requestOptions?: RequestOptions,\n ): Promise<EstimateABTestResponse> {\n if (!estimateABTestRequest) {\n throw new Error('Parameter `estimateABTestRequest` is required when calling `estimateABTest`.');\n }\n\n if (!estimateABTestRequest.configuration) {\n throw new Error('Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.');\n }\n if (!estimateABTestRequest.variants) {\n throw new Error('Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.');\n }\n\n const requestPath = '/3/abtests/estimate';\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: estimateABTestRequest,\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 = '/3/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 * Retrieves timeseries for an A/B test by its ID.\n *\n * Required API Key ACLs:\n * - analytics\n * @param getTimeseries - The getTimeseries object.\n * @param getTimeseries.id - Unique A/B test identifier.\n * @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.\n * @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.\n * @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getTimeseries(\n { id, startDate, endDate, metric }: GetTimeseriesProps,\n requestOptions?: RequestOptions,\n ): Promise<Timeseries> {\n if (!id) {\n throw new Error('Parameter `id` is required when calling `getTimeseries`.');\n }\n\n const requestPath = '/3/abtests/{id}/timeseries'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (startDate !== undefined) {\n queryParameters['startDate'] = startDate.toString();\n }\n\n if (endDate !== undefined) {\n queryParameters['endDate'] = endDate.toString();\n }\n\n if (metric !== undefined) {\n queryParameters['metric'] = metric.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 * 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 listABTests.direction - Sort order for A/B tests by start date. Use \\'asc\\' for ascending or \\'desc\\' for descending. Active A/B tests are always listed first.\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, direction }: ListABTestsProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<ListABTestsResponse> {\n const requestPath = '/3/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 if (direction !== undefined) {\n queryParameters['direction'] = direction.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.metrics) {\n throw new Error('Parameter `scheduleABTestsRequest.metrics` 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 = '/3/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 = '/3/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 queryPar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,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 U(){function t(e){return new Promise(o=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(n=>r.setRequestHeader(n,e.headers[n]));let u=(n,s)=>setTimeout(()=>{r.abort(),o({status:0,content:s,isTimedOut:!0})},n),d=u(e.connectTimeout,"Connection timeout"),g;r.onreadystatechange=()=>{r.readyState>r.OPENED&&g===void 0&&(clearTimeout(d),g=u(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(d),clearTimeout(g),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(d),clearTimeout(g),o({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}function G(t){let e,o=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function u(){return JSON.parse(r().getItem(o)||"{}")}function d(n){r().setItem(o,JSON.stringify(n))}function g(){let n=t.timeToLive?t.timeToLive*1e3:null,s=u(),a=Object.fromEntries(Object.entries(s).filter(([,l])=>l.timestamp!==void 0));if(d(a),!n)return;let c=Object.fromEntries(Object.entries(a).filter(([,l])=>{let h=new Date().getTime();return!(l.timestamp+n<h)}));d(c)}return{get(n,s,a={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(g(),u()[JSON.stringify(n)])).then(c=>Promise.all([c?c.value:s(),c!==void 0])).then(([c,l])=>Promise.all([c,l||a.miss(c)])).then(([c])=>c)},set(n,s){return Promise.resolve().then(()=>{let a=u();return a[JSON.stringify(n)]={timestamp:new Date().getTime(),value:s},r().setItem(o,JSON.stringify(a)),s})},delete(n){return Promise.resolve().then(()=>{let s=u();delete s[JSON.stringify(n)],r().setItem(o,JSON.stringify(s))})},clear(){return Promise.resolve().then(()=>{r().removeItem(o)})}}}function V(){return{get(t,e,o={miss:()=>Promise.resolve()}){return e().then(u=>Promise.all([u,o.miss(u)])).then(([u])=>u)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function E(t){let e=[...t.caches],o=e.shift();return o===void 0?V():{get(r,u,d={miss:()=>Promise.resolve()}){return o.get(r,u,d).catch(()=>E({caches:e}).get(r,u,d))},set(r,u){return o.set(r,u).catch(()=>E({caches:e}).set(r,u))},delete(r){return o.delete(r).catch(()=>E({caches:e}).delete(r))},clear(){return o.clear().catch(()=>E({caches:e}).clear())}}}function v(t={serializable:!0}){let e={};return{get(o,r,u={miss:()=>Promise.resolve()}){let d=JSON.stringify(o);if(d in e)return Promise.resolve(t.serializable?JSON.parse(e[d]):e[d]);let g=r();return g.then(n=>u.miss(n)).then(()=>g)},set(o,r){return e[JSON.stringify(o)]=t.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function Y(t){let e={value:`Algolia for JavaScript (${t})`,add(o){let r=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(r)===-1&&(e.value=`${e.value}${r}`),e}};return e}function Q(t,e,o="WithinHeaders"){let r={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return o==="WithinHeaders"?r:{}},queryParameters(){return o==="WithinQueryParameters"?r:{}}}}function j({algoliaAgents:t,client:e,version:o}){let r=Y(o).add({segment:e,version:o});return t.forEach(u=>r.add(u)),r}function W(){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 $(t,e="up"){let o=Date.now();function r(){return e==="up"||Date.now()-o>k}function u(){return e==="timed out"&&Date.now()-o<=k}return{...t,status:e,lastUpdate:o,isUp:r,isTimedOut:u}}var J=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}};var z=class extends J{stackTrace;constructor(t,e,o){super(t,o),this.stackTrace=e}},Z=class extends z{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 z{status;constructor(t,e,o,r="ApiError"){super(t,o,r),this.status=e}},ee=class extends J{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},te=class extends C{error;constructor(t,e,o,r){super(t,e,r,"DetailedApiError"),this.error=o}};function re(t,e,o){let r=se(o),u=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(u+=`?${r}`),u}function se(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 oe(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let o=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(o)}function ae(t,e,o){let r={Accept:"application/json",...t,...e,...o},u={};return Object.keys(r).forEach(d=>{let g=r[d];u[d.toLowerCase()]=g}),u}function ne(t){try{return JSON.parse(t.content)}catch(e){throw new ee(e.message,t)}}function ie({content:t,status:e},o){try{let r=JSON.parse(t);return"error"in r?new te(r.message,e,r.error,o):new C(r.message,e,o)}catch{}return new C(t,e,o)}function ue({isTimedOut:t,status:e}){return!t&&~~e===0}function ce({isTimedOut:t,status:e}){return t||ue({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function me({status:t}){return~~(t/100)===2}function le(t){return t.map(e=>M(e))}function M(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 F({hosts:t,hostsCache:e,baseHeaders:o,logger:r,baseQueryParameters:u,algoliaAgent:d,timeouts:g,requester:n,requestsCache:s,responsesCache:a}){async function c(i){let m=await Promise.all(i.map(P=>e.get(P,()=>Promise.resolve($(P))))),f=m.filter(P=>P.isUp()),p=m.filter(P=>P.isTimedOut()),w=[...f,...p];return{hosts:w.length>0?w:i,getTimeout(P,A){return(p.length===0&&P===0?1:p.length+3+P)*A}}}async function l(i,m,f=!0){let p=[],w=oe(i,m),y=ae(o,i.headers,m.headers),P=i.method==="GET"?{...i.data,...m.data}:{},A={...u,...i.queryParameters,...P};if(d.value&&(A["x-algolia-agent"]=d.value),m&&m.queryParameters)for(let T of Object.keys(m.queryParameters))!m.queryParameters[T]||Object.prototype.toString.call(m.queryParameters[T])==="[object Object]"?A[T]=m.queryParameters[T]:A[T]=m.queryParameters[T].toString();let x=0,N=async(T,B)=>{let R=T.pop();if(R===void 0)throw new Z(le(p));let S={...g,...m.timeouts},_={data:w,headers:y,method:i.method,url:re(R,i.path,A),connectTimeout:B(x,S.connect),responseTimeout:B(x,f?S.read:S.write)},H=b=>{let L={request:_,response:b,host:R,triesLeft:T.length};return p.push(L),L},q=await n.send(_);if(ce(q)){let b=H(q);return q.isTimedOut&&x++,r.info("Retryable failure",M(b)),await e.set(R,$(R,q.isTimedOut?"timed out":"down")),N(T,B)}if(me(q))return ne(q);throw H(q),ie(q,p)},K=t.filter(T=>T.accept==="readWrite"||(f?T.accept==="read":T.accept==="write")),D=await c(K);return N([...D.hosts].reverse(),D.getTimeout)}function h(i,m={}){let f=i.useReadTransporter||i.method==="GET";if(!f)return l(i,m,f);let p=()=>l(i,m);if((m.cacheable||i.cacheable)!==!0)return p();let y={request:i,requestOptions:m,transporter:{queryParameters:u,headers:o}};return a.get(y,()=>s.get(y,()=>s.set(y,p()).then(P=>Promise.all([s.delete(y),P]),P=>Promise.all([s.delete(y),Promise.reject(P)])).then(([P,A])=>A)),{miss:P=>a.set(y,P)})}return{hostsCache:e,requester:n,timeouts:g,logger:r,algoliaAgent:d,baseHeaders:o,baseQueryParameters:u,hosts:t,request:h,requestsCache:s,responsesCache:a}}var O="0.0.1-alpha.6",I=["de","us"];function de(t){return[{url:t?"analytics.{region}.algolia.com".replace("{region}",t):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function X({appId:t,apiKey:e,authMode:o,algoliaAgents:r,region:u,...d}){let g=Q(t,e,o),n=F({hosts:de(u),...d,algoliaAgent:j({algoliaAgents:r,client:"Abtesting",version:O}),baseHeaders:{"content-type":"text/plain",...g.headers(),...d.baseHeaders},baseQueryParameters:{...g.queryParameters(),...d.baseQueryParameters}});return{transporter:n,appId:t,apiKey:e,clearCache(){return Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then(()=>{})},get _ua(){return n.algoliaAgent.value},addAlgoliaAgent(s,a){n.algoliaAgent.add({segment:s,version:a})},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?n.baseHeaders["x-algolia-api-key"]=s:n.baseQueryParameters["x-algolia-api-key"]=s},addABTests(s,a){if(!s)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!s.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!s.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!s.metrics)throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");if(!s.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let i={method:"POST",path:"/3/abtests",queryParameters:{},headers:{},data:s};return n.request(i,a)},customDelete({path:s,parameters:a},c){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let m={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{}};return n.request(m,c)},customGet({path:s,parameters:a},c){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let m={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{}};return n.request(m,c)},customPost({path:s,parameters:a,body:c},l){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{},data:c||{}};return n.request(f,l)},customPut({path:s,parameters:a,body:c},l){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{},data:c||{}};return n.request(f,l)},deleteABTest({id:s},a){if(!s)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let i={method:"DELETE",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(i,a)},estimateABTest(s,a){if(!s)throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");if(!s.configuration)throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");if(!s.variants)throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");let i={method:"POST",path:"/3/abtests/estimate",queryParameters:{},headers:{},data:s};return n.request(i,a)},getABTest({id:s},a){if(!s)throw new Error("Parameter `id` is required when calling `getABTest`.");let i={method:"GET",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(i,a)},getTimeseries({id:s,startDate:a,endDate:c,metric:l},h){if(!s)throw new Error("Parameter `id` is required when calling `getTimeseries`.");let i="/3/abtests/{id}/timeseries".replace("{id}",encodeURIComponent(s)),m={},f={};a!==void 0&&(f.startDate=a.toString()),c!==void 0&&(f.endDate=c.toString()),l!==void 0&&(f.metric=l.toString());let p={method:"GET",path:i,queryParameters:f,headers:m};return n.request(p,h)},listABTests({offset:s,limit:a,indexPrefix:c,indexSuffix:l,direction:h}={},i=void 0){let m="/3/abtests",f={},p={};s!==void 0&&(p.offset=s.toString()),a!==void 0&&(p.limit=a.toString()),c!==void 0&&(p.indexPrefix=c.toString()),l!==void 0&&(p.indexSuffix=l.toString()),h!==void 0&&(p.direction=h.toString());let w={method:"GET",path:m,queryParameters:p,headers:f};return n.request(w,i)},scheduleABTest(s,a){if(!s)throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");if(!s.name)throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");if(!s.variants)throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");if(!s.metrics)throw new Error("Parameter `scheduleABTestsRequest.metrics` is required when calling `scheduleABTest`.");if(!s.scheduledAt)throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");if(!s.endAt)throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");let i={method:"POST",path:"/3/abtests/schedule",queryParameters:{},headers:{},data:s};return n.request(i,a)},stopABTest({id:s},a){if(!s)throw new Error("Parameter `id` is required when calling `stopABTest`.");let i={method:"POST",path:"/3/abtests/{id}/stop".replace("{id}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(i,a)}}}function it(t,e,o,r){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(o&&(typeof o!="string"||!I.includes(o)))throw new Error(`\`region\` must be one of the following: ${I.join(", ")}`);return X({appId:t,apiKey:e,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},logger:W(),requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:v(),requestsCache:v({serializable:!1}),hostsCache:E({caches:[G({key:`${O}-${t}`}),v()]}),...r})}export{it as abtestingClient,O as apiClientVersion};
|
|
1
|
+
function U(){function t(e){return new Promise(o=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(n=>r.setRequestHeader(n,e.headers[n]));let u=(n,s)=>setTimeout(()=>{r.abort(),o({status:0,content:s,isTimedOut:!0})},n),d=u(e.connectTimeout,"Connection timeout"),g;r.onreadystatechange=()=>{r.readyState>r.OPENED&&g===void 0&&(clearTimeout(d),g=u(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(d),clearTimeout(g),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(d),clearTimeout(g),o({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}function G(t){let e,o=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function u(){return JSON.parse(r().getItem(o)||"{}")}function d(n){r().setItem(o,JSON.stringify(n))}function g(){let n=t.timeToLive?t.timeToLive*1e3:null,s=u(),a=Object.fromEntries(Object.entries(s).filter(([,l])=>l.timestamp!==void 0));if(d(a),!n)return;let c=Object.fromEntries(Object.entries(a).filter(([,l])=>{let h=new Date().getTime();return!(l.timestamp+n<h)}));d(c)}return{get(n,s,a={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(g(),u()[JSON.stringify(n)])).then(c=>Promise.all([c?c.value:s(),c!==void 0])).then(([c,l])=>Promise.all([c,l||a.miss(c)])).then(([c])=>c)},set(n,s){return Promise.resolve().then(()=>{let a=u();return a[JSON.stringify(n)]={timestamp:new Date().getTime(),value:s},r().setItem(o,JSON.stringify(a)),s})},delete(n){return Promise.resolve().then(()=>{let s=u();delete s[JSON.stringify(n)],r().setItem(o,JSON.stringify(s))})},clear(){return Promise.resolve().then(()=>{r().removeItem(o)})}}}function K(){return{get(t,e,o={miss:()=>Promise.resolve()}){return e().then(u=>Promise.all([u,o.miss(u)])).then(([u])=>u)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function E(t){let e=[...t.caches],o=e.shift();return o===void 0?K():{get(r,u,d={miss:()=>Promise.resolve()}){return o.get(r,u,d).catch(()=>E({caches:e}).get(r,u,d))},set(r,u){return o.set(r,u).catch(()=>E({caches:e}).set(r,u))},delete(r){return o.delete(r).catch(()=>E({caches:e}).delete(r))},clear(){return o.clear().catch(()=>E({caches:e}).clear())}}}function v(t={serializable:!0}){let e={};return{get(o,r,u={miss:()=>Promise.resolve()}){let d=JSON.stringify(o);if(d in e)return Promise.resolve(t.serializable?JSON.parse(e[d]):e[d]);let g=r();return g.then(n=>u.miss(n)).then(()=>g)},set(o,r){return e[JSON.stringify(o)]=t.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function Y(t){let e={value:`Algolia for JavaScript (${t})`,add(o){let r=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(r)===-1&&(e.value=`${e.value}${r}`),e}};return e}function Q(t,e,o="WithinHeaders"){let r={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return o==="WithinHeaders"?r:{}},queryParameters(){return o==="WithinQueryParameters"?r:{}}}}function j({algoliaAgents:t,client:e,version:o}){let r=Y(o).add({segment:e,version:o});return t.forEach(u=>r.add(u)),r}function W(){return{debug(t,e){return Promise.resolve()},info(t,e){return Promise.resolve()},error(t,e){return Promise.resolve()}}}var k=120*1e3;function $(t,e="up"){let o=Date.now();function r(){return e==="up"||Date.now()-o>k}function u(){return e==="timed out"&&Date.now()-o<=k}return{...t,status:e,lastUpdate:o,isUp:r,isTimedOut:u}}var J=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}};var z=class extends J{stackTrace;constructor(t,e,o){super(t,o),this.stackTrace=e}},Z=class extends z{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 z{status;constructor(t,e,o,r="ApiError"){super(t,o,r),this.status=e}},ee=class extends J{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},te=class extends C{error;constructor(t,e,o,r){super(t,e,r,"DetailedApiError"),this.error=o}};function re(t,e,o){let r=se(o),u=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(u+=`?${r}`),u}function se(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 oe(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let o=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(o)}function ae(t,e,o){let r={Accept:"application/json",...t,...e,...o},u={};return Object.keys(r).forEach(d=>{let g=r[d];u[d.toLowerCase()]=g}),u}function ne(t){try{return JSON.parse(t.content)}catch(e){throw new ee(e.message,t)}}function ie({content:t,status:e},o){try{let r=JSON.parse(t);return"error"in r?new te(r.message,e,r.error,o):new C(r.message,e,o)}catch{}return new C(t,e,o)}function ue({isTimedOut:t,status:e}){return!t&&~~e===0}function ce({isTimedOut:t,status:e}){return t||ue({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function me({status:t}){return~~(t/100)===2}function le(t){return t.map(e=>M(e))}function M(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:o,logger:r,baseQueryParameters:u,algoliaAgent:d,timeouts:g,requester:n,requestsCache:s,responsesCache:a}){async function c(i){let m=await Promise.all(i.map(P=>e.get(P,()=>Promise.resolve($(P))))),f=m.filter(P=>P.isUp()),p=m.filter(P=>P.isTimedOut()),w=[...f,...p];return{hosts:w.length>0?w:i,getTimeout(P,A){return(p.length===0&&P===0?1:p.length+3+P)*A}}}async function l(i,m,f=!0){let p=[],w=oe(i,m),y=ae(o,i.headers,m.headers),P=i.method==="GET"?{...i.data,...m.data}:{},A={...u,...i.queryParameters,...P};if(d.value&&(A["x-algolia-agent"]=d.value),m&&m.queryParameters)for(let T of Object.keys(m.queryParameters))!m.queryParameters[T]||Object.prototype.toString.call(m.queryParameters[T])==="[object Object]"?A[T]=m.queryParameters[T]:A[T]=m.queryParameters[T].toString();let x=0,N=async(T,B)=>{let R=T.pop();if(R===void 0)throw new Z(le(p));let S={...g,...m.timeouts},_={data:w,headers:y,method:i.method,url:re(R,i.path,A),connectTimeout:B(x,S.connect),responseTimeout:B(x,f?S.read:S.write)},H=b=>{let L={request:_,response:b,host:R,triesLeft:T.length};return p.push(L),L},q=await n.send(_);if(ce(q)){let b=H(q);return q.isTimedOut&&x++,r.info("Retryable failure",M(b)),await e.set(R,$(R,q.isTimedOut?"timed out":"down")),N(T,B)}if(me(q))return ne(q);throw H(q),ie(q,p)},X=t.filter(T=>T.accept==="readWrite"||(f?T.accept==="read":T.accept==="write")),D=await c(X);return N([...D.hosts].reverse(),D.getTimeout)}function h(i,m={}){let f=i.useReadTransporter||i.method==="GET";if(!f)return l(i,m,f);let p=()=>l(i,m);if((m.cacheable||i.cacheable)!==!0)return p();let y={request:i,requestOptions:m,transporter:{queryParameters:u,headers:o}};return a.get(y,()=>s.get(y,()=>s.set(y,p()).then(P=>Promise.all([s.delete(y),P]),P=>Promise.all([s.delete(y),Promise.reject(P)])).then(([P,A])=>A)),{miss:P=>a.set(y,P)})}return{hostsCache:e,requester:n,timeouts:g,logger:r,algoliaAgent:d,baseHeaders:o,baseQueryParameters:u,hosts:t,request:h,requestsCache:s,responsesCache:a}}var O="1.2.0",I=["de","us"];function de(t){return[{url:t?"analytics.{region}.algolia.com".replace("{region}",t):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function F({appId:t,apiKey:e,authMode:o,algoliaAgents:r,region:u,...d}){let g=Q(t,e,o),n=V({hosts:de(u),...d,algoliaAgent:j({algoliaAgents:r,client:"AbtestingV3",version:O}),baseHeaders:{"content-type":"text/plain",...g.headers(),...d.baseHeaders},baseQueryParameters:{...g.queryParameters(),...d.baseQueryParameters}});return{transporter:n,appId:t,apiKey:e,clearCache(){return Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then(()=>{})},get _ua(){return n.algoliaAgent.value},addAlgoliaAgent(s,a){n.algoliaAgent.add({segment:s,version:a})},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?n.baseHeaders["x-algolia-api-key"]=s:n.baseQueryParameters["x-algolia-api-key"]=s},addABTests(s,a){if(!s)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!s.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!s.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!s.metrics)throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");if(!s.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let i={method:"POST",path:"/3/abtests",queryParameters:{},headers:{},data:s};return n.request(i,a)},customDelete({path:s,parameters:a},c){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let m={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{}};return n.request(m,c)},customGet({path:s,parameters:a},c){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let m={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{}};return n.request(m,c)},customPost({path:s,parameters:a,body:c},l){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{},data:c||{}};return n.request(f,l)},customPut({path:s,parameters:a,body:c},l){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{},data:c||{}};return n.request(f,l)},deleteABTest({id:s},a){if(!s)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let i={method:"DELETE",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(i,a)},estimateABTest(s,a){if(!s)throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");if(!s.configuration)throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");if(!s.variants)throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");let i={method:"POST",path:"/3/abtests/estimate",queryParameters:{},headers:{},data:s};return n.request(i,a)},getABTest({id:s},a){if(!s)throw new Error("Parameter `id` is required when calling `getABTest`.");let i={method:"GET",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(i,a)},getTimeseries({id:s,startDate:a,endDate:c,metric:l},h){if(!s)throw new Error("Parameter `id` is required when calling `getTimeseries`.");let i="/3/abtests/{id}/timeseries".replace("{id}",encodeURIComponent(s)),m={},f={};a!==void 0&&(f.startDate=a.toString()),c!==void 0&&(f.endDate=c.toString()),l!==void 0&&(f.metric=l.toString());let p={method:"GET",path:i,queryParameters:f,headers:m};return n.request(p,h)},listABTests({offset:s,limit:a,indexPrefix:c,indexSuffix:l,direction:h}={},i=void 0){let m="/3/abtests",f={},p={};s!==void 0&&(p.offset=s.toString()),a!==void 0&&(p.limit=a.toString()),c!==void 0&&(p.indexPrefix=c.toString()),l!==void 0&&(p.indexSuffix=l.toString()),h!==void 0&&(p.direction=h.toString());let w={method:"GET",path:m,queryParameters:p,headers:f};return n.request(w,i)},scheduleABTest(s,a){if(!s)throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");if(!s.name)throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");if(!s.variants)throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");if(!s.metrics)throw new Error("Parameter `scheduleABTestsRequest.metrics` is required when calling `scheduleABTest`.");if(!s.scheduledAt)throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");if(!s.endAt)throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");let i={method:"POST",path:"/3/abtests/schedule",queryParameters:{},headers:{},data:s};return n.request(i,a)},stopABTest({id:s},a){if(!s)throw new Error("Parameter `id` is required when calling `stopABTest`.");let i={method:"POST",path:"/3/abtests/{id}/stop".replace("{id}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(i,a)}}}function it(t,e,o,r){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(o&&(typeof o!="string"||!I.includes(o)))throw new Error(`\`region\` must be one of the following: ${I.join(", ")}`);return F({appId:t,apiKey:e,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},logger:W(),requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:v(),requestsCache:v({serializable:!1}),hostsCache:E({caches:[G({key:`${O}-${t}`}),v()]}),...r})}export{it as abtestingV3Client,O as apiClientVersion};
|
|
2
2
|
//# sourceMappingURL=browser.min.js.map
|