@algolia/abtesting 1.19.0 → 1.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -40,11 +40,11 @@ All of our clients comes with type definition, and are available for both browse
40
40
  ### With a package manager
41
41
 
42
42
  ```bash
43
- yarn add @algolia/abtesting@1.19.0
43
+ yarn add @algolia/abtesting@1.20.1
44
44
  # or
45
- npm install @algolia/abtesting@1.19.0
45
+ npm install @algolia/abtesting@1.20.1
46
46
  # or
47
- pnpm add @algolia/abtesting@1.19.0
47
+ pnpm add @algolia/abtesting@1.20.1
48
48
  ```
49
49
 
50
50
  ### Without a package manager
@@ -52,7 +52,7 @@ pnpm add @algolia/abtesting@1.19.0
52
52
  Add the following JavaScript snippet to the <head> of your website:
53
53
 
54
54
  ```html
55
- <script src="https://cdn.jsdelivr.net/npm/@algolia/abtesting@1.19.0/dist/builds/browser.umd.js"></script>
55
+ <script src="https://cdn.jsdelivr.net/npm/@algolia/abtesting@1.20.1/dist/builds/browser.umd.js"></script>
56
56
  ```
57
57
 
58
58
  ### Usage
package/dist/browser.d.ts CHANGED
@@ -512,7 +512,7 @@ type StopABTestProps = {
512
512
  id: number;
513
513
  };
514
514
 
515
- declare const apiClientVersion = "1.19.0";
515
+ declare const apiClientVersion = "1.20.1";
516
516
  declare const REGIONS: readonly ["de", "us"];
517
517
  type Region = (typeof REGIONS)[number];
518
518
  type RegionOptions = {
@@ -8,8 +8,8 @@ import {
8
8
  import { createXhrRequester } from "@algolia/requester-browser-xhr";
9
9
 
10
10
  // src/abtestingV3Client.ts
11
- import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
12
- var apiClientVersion = "1.19.0";
11
+ import { createAuth, createTransporter, getAlgoliaAgent, validateRequired } from "@algolia/client-common";
12
+ var apiClientVersion = "1.20.1";
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);
@@ -95,21 +95,11 @@ function createAbtestingV3Client({
95
95
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
96
96
  */
97
97
  addABTests(addABTestsRequest, requestOptions) {
98
- if (!addABTestsRequest) {
99
- throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
100
- }
101
- if (!addABTestsRequest.name) {
102
- throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
103
- }
104
- if (!addABTestsRequest.variants) {
105
- throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
106
- }
107
- if (!addABTestsRequest.metrics) {
108
- throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");
109
- }
110
- if (!addABTestsRequest.endAt) {
111
- throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
112
- }
98
+ validateRequired("addABTestsRequest", "addABTests", addABTestsRequest);
99
+ validateRequired("addABTestsRequest.name", "addABTests", addABTestsRequest.name);
100
+ validateRequired("addABTestsRequest.variants", "addABTests", addABTestsRequest.variants);
101
+ validateRequired("addABTestsRequest.metrics", "addABTests", addABTestsRequest.metrics);
102
+ validateRequired("addABTestsRequest.endAt", "addABTests", addABTestsRequest.endAt);
113
103
  const requestPath = "/3/abtests";
114
104
  const headers = {};
115
105
  const queryParameters = {};
@@ -130,9 +120,7 @@ function createAbtestingV3Client({
130
120
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
131
121
  */
132
122
  customDelete({ path, parameters }, requestOptions) {
133
- if (!path) {
134
- throw new Error("Parameter `path` is required when calling `customDelete`.");
135
- }
123
+ validateRequired("path", "customDelete", path);
136
124
  const requestPath = "/{path}".replace("{path}", path);
137
125
  const headers = {};
138
126
  const queryParameters = parameters ? parameters : {};
@@ -152,9 +140,7 @@ function createAbtestingV3Client({
152
140
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
153
141
  */
154
142
  customGet({ path, parameters }, requestOptions) {
155
- if (!path) {
156
- throw new Error("Parameter `path` is required when calling `customGet`.");
157
- }
143
+ validateRequired("path", "customGet", path);
158
144
  const requestPath = "/{path}".replace("{path}", path);
159
145
  const headers = {};
160
146
  const queryParameters = parameters ? parameters : {};
@@ -175,9 +161,7 @@ function createAbtestingV3Client({
175
161
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
176
162
  */
177
163
  customPost({ path, parameters, body }, requestOptions) {
178
- if (!path) {
179
- throw new Error("Parameter `path` is required when calling `customPost`.");
180
- }
164
+ validateRequired("path", "customPost", path);
181
165
  const requestPath = "/{path}".replace("{path}", path);
182
166
  const headers = {};
183
167
  const queryParameters = parameters ? parameters : {};
@@ -199,9 +183,7 @@ function createAbtestingV3Client({
199
183
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
200
184
  */
201
185
  customPut({ path, parameters, body }, requestOptions) {
202
- if (!path) {
203
- throw new Error("Parameter `path` is required when calling `customPut`.");
204
- }
186
+ validateRequired("path", "customPut", path);
205
187
  const requestPath = "/{path}".replace("{path}", path);
206
188
  const headers = {};
207
189
  const queryParameters = parameters ? parameters : {};
@@ -224,9 +206,7 @@ function createAbtestingV3Client({
224
206
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
225
207
  */
226
208
  deleteABTest({ id }, requestOptions) {
227
- if (!id) {
228
- throw new Error("Parameter `id` is required when calling `deleteABTest`.");
229
- }
209
+ validateRequired("id", "deleteABTest", id);
230
210
  const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
231
211
  const headers = {};
232
212
  const queryParameters = {};
@@ -247,15 +227,9 @@ function createAbtestingV3Client({
247
227
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
248
228
  */
249
229
  estimateABTest(estimateABTestRequest, requestOptions) {
250
- if (!estimateABTestRequest) {
251
- throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
252
- }
253
- if (!estimateABTestRequest.configuration) {
254
- throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
255
- }
256
- if (!estimateABTestRequest.variants) {
257
- throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
258
- }
230
+ validateRequired("estimateABTestRequest", "estimateABTest", estimateABTestRequest);
231
+ validateRequired("estimateABTestRequest.configuration", "estimateABTest", estimateABTestRequest.configuration);
232
+ validateRequired("estimateABTestRequest.variants", "estimateABTest", estimateABTestRequest.variants);
259
233
  const requestPath = "/3/abtests/estimate";
260
234
  const headers = {};
261
235
  const queryParameters = {};
@@ -278,9 +252,7 @@ function createAbtestingV3Client({
278
252
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
279
253
  */
280
254
  getABTest({ id }, requestOptions) {
281
- if (!id) {
282
- throw new Error("Parameter `id` is required when calling `getABTest`.");
283
- }
255
+ validateRequired("id", "getABTest", id);
284
256
  const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
285
257
  const headers = {};
286
258
  const queryParameters = {};
@@ -305,9 +277,7 @@ function createAbtestingV3Client({
305
277
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
306
278
  */
307
279
  getTimeseries({ id, startDate, endDate, metric }, requestOptions) {
308
- if (!id) {
309
- throw new Error("Parameter `id` is required when calling `getTimeseries`.");
310
- }
280
+ validateRequired("id", "getTimeseries", id);
311
281
  const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
312
282
  const headers = {};
313
283
  const queryParameters = {};
@@ -378,9 +348,7 @@ function createAbtestingV3Client({
378
348
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
379
349
  */
380
350
  stopABTest({ id }, requestOptions) {
381
- if (!id) {
382
- throw new Error("Parameter `id` is required when calling `stopABTest`.");
383
- }
351
+ validateRequired("id", "stopABTest", id);
384
352
  const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
385
353
  const headers = {};
386
354
  const queryParameters = {};
@@ -1 +1 @@
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 {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\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 const { compression: _compression, ...browserOptions } = options || {};\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 ...browserOptions,\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';\nimport type { EstimateABTestRequest } from '../model/estimateABTestRequest';\nimport type { EstimateABTestResponse } from '../model/estimateABTestResponse';\nimport type { ListABTestsResponse } from '../model/listABTestsResponse';\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.19.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 * 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;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;;;ACEnC,SAAS,YAAY,mBAAmB,uBAAuB;AAsBxD,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,wBAAwB;AAAA,EACtC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAAwC;AACtC,QAAM,OAAO,WAAW,aAAa,cAAc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AAC;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 {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\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 const { compression: _compression, ...browserOptions } = options || {};\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 ...browserOptions,\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, validateRequired } from '@algolia/client-common';\n\nimport type { ABTest } from '../model/aBTest';\nimport type { ABTestResponse } from '../model/aBTestResponse';\nimport type { AddABTestsRequest } from '../model/addABTestsRequest';\nimport type { EstimateABTestRequest } from '../model/estimateABTestRequest';\nimport type { EstimateABTestResponse } from '../model/estimateABTestResponse';\nimport type { ListABTestsResponse } from '../model/listABTestsResponse';\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.20.1';\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 validateRequired('addABTestsRequest', 'addABTests', addABTestsRequest);\n\n validateRequired('addABTestsRequest.name', 'addABTests', addABTestsRequest.name);\n validateRequired('addABTestsRequest.variants', 'addABTests', addABTestsRequest.variants);\n validateRequired('addABTestsRequest.metrics', 'addABTests', addABTestsRequest.metrics);\n validateRequired('addABTestsRequest.endAt', 'addABTests', addABTestsRequest.endAt);\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 validateRequired('path', 'customDelete', path);\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 validateRequired('path', 'customGet', path);\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 validateRequired('path', 'customPost', path);\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 validateRequired('path', 'customPut', path);\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 validateRequired('id', 'deleteABTest', id);\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 validateRequired('estimateABTestRequest', 'estimateABTest', estimateABTestRequest);\n\n validateRequired('estimateABTestRequest.configuration', 'estimateABTest', estimateABTestRequest.configuration);\n validateRequired('estimateABTestRequest.variants', 'estimateABTest', estimateABTestRequest.variants);\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 validateRequired('id', 'getABTest', id);\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 validateRequired('id', 'getTimeseries', id);\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 * 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 validateRequired('id', 'stopABTest', id);\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;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;;;ACEnC,SAAS,YAAY,mBAAmB,iBAAiB,wBAAwB;AAsB1E,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,wBAAwB;AAAA,EACtC,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,gBAAgB;AAAA,MAC5B;AAAA,M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AAU,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,QAAM,EAAE,aAAa,cAAc,GAAG,eAAe,IAAI,WAAW,CAAC;AAErE,SAAO,wBAAwB;AAAA,IAC7B;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA,QAAQ,iBAAiB;AAAA,IACzB,WAAW,mBAAmB;AAAA,IAC9B,eAAe,CAAC,EAAE,SAAS,UAAU,CAAC;AAAA,IACtC,UAAU;AAAA,IACV,gBAAgB,kBAAkB;AAAA,IAClC,eAAe,kBAAkB,EAAE,cAAc,MAAM,CAAC;AAAA,IACxD,YAAY,wBAAwB;AAAA,MAClC,QAAQ,CAAC,+BAA+B,EAAE,KAAK,GAAG,gBAAgB,IAAI,KAAK,GAAG,CAAC,GAAG,kBAAkB,CAAC;AAAA,IACvG,CAAC;AAAA,IACD,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
@@ -1,2 +1,6 @@
1
- function J(t){let e,s=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function a(){return JSON.parse(r().getItem(s)||"{}")}function d(o){r().setItem(s,JSON.stringify(o))}function f(){return new Promise(o=>setTimeout(o,0))}function u(){let o=t.timeToLive?t.timeToLive*1e3:null,n=a(),i=new Date().getTime(),p=!1;return{namespace:Object.fromEntries(Object.entries(n).filter(([,m])=>!m||m.timestamp===void 0||o&&m.timestamp+o<i?(p=!0,!1):!0)),changed:p}}return{get(o,n,i={miss:()=>Promise.resolve()}){return f().then(()=>{let{namespace:p,changed:g}=u(),m=p[JSON.stringify(o)];return g&&d(p),m?m.value:n().then(P=>i.miss(P).then(()=>P))})},set(o,n){return f().then(()=>{let i=a();return i[JSON.stringify(o)]={timestamp:new Date().getTime(),value:n},r().setItem(s,JSON.stringify(i)),n})},delete(o){return f().then(()=>{let n=a();delete n[JSON.stringify(o)],r().setItem(s,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{r().removeItem(s)})}}}function re(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(a=>Promise.all([a,s.miss(a)])).then(([a])=>a)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function x(t){let e=[...t.caches],s=e.shift();return s===void 0?re():{get(r,a,d={miss:()=>Promise.resolve()}){return s.get(r,a,d).catch(()=>x({caches:e}).get(r,a,d))},set(r,a){return s.set(r,a).catch(()=>x({caches:e}).set(r,a))},delete(r){return s.delete(r).catch(()=>x({caches:e}).delete(r))},clear(){return s.clear().catch(()=>x({caches:e}).clear())}}}function b(t={serializable:!0}){let e={};return{get(s,r,a={miss:()=>Promise.resolve()}){let d=JSON.stringify(s);if(d in e)return Promise.resolve(t.serializable?JSON.parse(e[d]):e[d]);let f=r();return f.then(u=>a.miss(u)).then(()=>f)},set(s,r){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function se(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let r=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(r)===-1&&(e.value=`${e.value}${r}`),e}};return e}function j(t,e,s="WithinHeaders"){let r={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?r:{}},queryParameters(){return s==="WithinQueryParameters"?r:{}}}}function W({algoliaAgents:t,client:e,version:s}){let r=se(s).add({segment:e,version:s});return t.forEach(a=>r.add(a)),r}function M(){return{debug(t,e){return Promise.resolve()},info(t,e){return Promise.resolve()},error(t,e){return Promise.resolve()}}}var oe=750,Q=120*1e3;function z(t,e="up"){let s=Date.now();function r(){return e==="up"||Date.now()-s>Q}function a(){return e==="timed out"&&Date.now()-s<=Q}return{...t,status:e,lastUpdate:s,isUp:r,isTimedOut:a}}var V=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}};var F=class extends V{stackTrace;constructor(t,e,s){super(t,s),this.stackTrace=e}},ne=class extends F{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",t,"RetryError")}},I=class extends F{status;constructor(t,e,s,r="ApiError"){super(t,s,r),this.status=e}},ae=class extends V{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},ie=class extends I{error;constructor(t,e,s,r){super(t,e,r,"DetailedApiError"),this.error=s}};function ue(t,e,s){let r=ce(s),a=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(a+=`?${r}`),a}function ce(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 le(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function me(t,e,s){let r={Accept:"application/json",...t,...e,...s},a={};return Object.keys(r).forEach(d=>{let f=r[d];a[d.toLowerCase()]=f}),a}function de(t){try{return JSON.parse(t.content)}catch(e){throw new ae(e.message,t)}}function pe({content:t,status:e},s){try{let r=JSON.parse(t);return"error"in r?new ie(r.message,e,r.error,s):new I(r.message,e,s)}catch{}return new I(t,e,s)}function fe({isTimedOut:t,status:e}){return!t&&~~e===0}function he({isTimedOut:t,status:e}){return t||fe({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function ge({status:t}){return~~(t/100)===2}function Pe(t){return t.map(e=>X(e))}function X(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function K({hosts:t,hostsCache:e,baseHeaders:s,logger:r,baseQueryParameters:a,algoliaAgent:d,timeouts:f,requester:u,requestsCache:o,responsesCache:n,compress:i,compression:p}){async function g(c){let l=await Promise.all(c.map(h=>e.get(h,()=>Promise.resolve(z(h))))),A=l.filter(h=>h.isUp()),q=l.filter(h=>h.isTimedOut()),w=[...A,...q];return{hosts:w.length>0?w:c,getTimeout(h,R){return(q.length===0&&h===0?1:q.length+3+h)*R}}}async function m(c,l,A){let q=[],w=le(c,l),y=me(s,c.headers,l.headers),h=p==="gzip"&&w!==void 0&&w.length>oe&&(c.method==="POST"||c.method==="PUT");h&&i===void 0&&r.info("Compression is disabled because no compress method is available.");let R=h&&i!==void 0,H=R?await i(w):w;R&&(y["content-encoding"]="gzip");let ee=c.method==="GET"?{...c.data,...l.data}:{},O={...a,...c.queryParameters,...ee};if(d.value&&(O["x-algolia-agent"]=d.value),l&&l.queryParameters)for(let T of Object.keys(l.queryParameters))!l.queryParameters[T]||Object.prototype.toString.call(l.queryParameters[T])==="[object Object]"?O[T]=l.queryParameters[T]:O[T]=l.queryParameters[T].toString();let B=0,L=async(T,C)=>{let v=T.pop();if(v===void 0)throw new ne(Pe(q));let N={...f,...l.timeouts},k={data:H,headers:y,method:c.method,url:ue(v,c.path,O),connectTimeout:C(B,N.connect),responseTimeout:C(B,A?N.read:N.write)},$=D=>{let G={request:k,response:D,host:v,triesLeft:T.length};return q.push(G),G},E=await u.send(k);if(he(E)){let D=$(E);return E.isTimedOut&&B++,r.info("Retryable failure",X(D)),await e.set(v,z(v,E.isTimedOut?"timed out":"down")),L(T,C)}if(ge(E))return de(E);throw $(E),pe(E,q)},te=t.filter(T=>T.accept==="readWrite"||(A?T.accept==="read":T.accept==="write")),U=await g(te);return L([...U.hosts].reverse(),U.getTimeout)}function P(c,l={}){let A=()=>m(c,l,q),q=c.useReadTransporter||c.method==="GET";if((l.cacheable||c.cacheable)!==!0)return A();let y={request:c,requestOptions:l,transporter:{queryParameters:a,headers:s}};return n.get(y,()=>o.get(y,()=>o.set(y,A()).then(h=>Promise.all([o.delete(y),h]),h=>Promise.all([o.delete(y),Promise.reject(h)])).then(([h,R])=>R)),{miss:h=>n.set(y,h)})}return{hostsCache:e,requester:u,timeouts:f,logger:r,algoliaAgent:d,baseHeaders:s,baseQueryParameters:a,hosts:t,request:P,requestsCache:o,responsesCache:n}}function Y(){function t(e){return new Promise(s=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(u=>r.setRequestHeader(u,e.headers[u]));let a=(u,o)=>setTimeout(()=>{r.abort(),s({status:0,content:o,isTimedOut:!0})},u),d=a(e.connectTimeout,"Connection timeout"),f;r.onreadystatechange=()=>{r.readyState>r.OPENED&&f===void 0&&(clearTimeout(d),f=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(d),clearTimeout(f),s({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(d),clearTimeout(f),s({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}var S="1.19.0",_=["de","us"];function Te(t){return[{url:t?"analytics.{region}.algolia.com".replace("{region}",t):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function Z({appId:t,apiKey:e,authMode:s,algoliaAgents:r,region:a,...d}){let f=j(t,e,s),u=K({hosts:Te(a),...d,algoliaAgent:W({algoliaAgents:r,client:"AbtestingV3",version:S}),baseHeaders:{"content-type":"text/plain",...f.headers(),...d.baseHeaders},baseQueryParameters:{...f.queryParameters(),...d.baseQueryParameters}});return{transporter:u,appId:t,apiKey:e,clearCache(){return Promise.all([u.requestsCache.clear(),u.responsesCache.clear()]).then(()=>{})},get _ua(){return u.algoliaAgent.value},addAlgoliaAgent(o,n){u.algoliaAgent.add({segment:o,version:n})},setClientApiKey({apiKey:o}){!s||s==="WithinHeaders"?u.baseHeaders["x-algolia-api-key"]=o:u.baseQueryParameters["x-algolia-api-key"]=o},addABTests(o,n){if(!o)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!o.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!o.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!o.metrics)throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");if(!o.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let m={method:"POST",path:"/3/abtests",queryParameters:{},headers:{},data:o};return u.request(m,n)},customDelete({path:o,parameters:n},i){if(!o)throw new Error("Parameter `path` is required when calling `customDelete`.");let P={method:"DELETE",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{}};return u.request(P,i)},customGet({path:o,parameters:n},i){if(!o)throw new Error("Parameter `path` is required when calling `customGet`.");let P={method:"GET",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{}};return u.request(P,i)},customPost({path:o,parameters:n,body:i},p){if(!o)throw new Error("Parameter `path` is required when calling `customPost`.");let c={method:"POST",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{},data:i||{}};return u.request(c,p)},customPut({path:o,parameters:n,body:i},p){if(!o)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{},data:i||{}};return u.request(c,p)},deleteABTest({id:o},n){if(!o)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let m={method:"DELETE",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(o)),queryParameters:{},headers:{}};return u.request(m,n)},estimateABTest(o,n){if(!o)throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");if(!o.configuration)throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");if(!o.variants)throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");let m={method:"POST",path:"/3/abtests/estimate",queryParameters:{},headers:{},data:o};return u.request(m,n)},getABTest({id:o},n){if(!o)throw new Error("Parameter `id` is required when calling `getABTest`.");let m={method:"GET",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(o)),queryParameters:{},headers:{}};return u.request(m,n)},getTimeseries({id:o,startDate:n,endDate:i,metric:p},g){if(!o)throw new Error("Parameter `id` is required when calling `getTimeseries`.");let m="/3/abtests/{id}/timeseries".replace("{id}",encodeURIComponent(o)),P={},c={};n!==void 0&&(c.startDate=n.toString()),i!==void 0&&(c.endDate=i.toString()),p!==void 0&&(c.metric=p.toString());let l={method:"GET",path:m,queryParameters:c,headers:P};return u.request(l,g)},listABTests({offset:o,limit:n,indexPrefix:i,indexSuffix:p,direction:g}={},m=void 0){let P="/3/abtests",c={},l={};o!==void 0&&(l.offset=o.toString()),n!==void 0&&(l.limit=n.toString()),i!==void 0&&(l.indexPrefix=i.toString()),p!==void 0&&(l.indexSuffix=p.toString()),g!==void 0&&(l.direction=g.toString());let A={method:"GET",path:P,queryParameters:l,headers:c};return u.request(A,m)},stopABTest({id:o},n){if(!o)throw new Error("Parameter `id` is required when calling `stopABTest`.");let m={method:"POST",path:"/3/abtests/{id}/stop".replace("{id}",encodeURIComponent(o)),queryParameters:{},headers:{}};return u.request(m,n)}}}function mt(t,e,s,r){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(s&&(typeof s!="string"||!_.includes(s)))throw new Error(`\`region\` must be one of the following: ${_.join(", ")}`);let{compression:a,...d}=r||{};return Z({appId:t,apiKey:e,region:s,timeouts:{connect:1e3,read:2e3,write:3e4},logger:M(),requester:Y(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:b(),requestsCache:b({serializable:!1}),hostsCache:x({caches:[J({key:`${S}-${t}`}),b()]}),...d})}export{mt as abtestingV3Client,S as apiClientVersion};
1
+ function Y(t){let e,s=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function a(){return JSON.parse(r().getItem(s)||"{}")}function d(o){r().setItem(s,JSON.stringify(o))}function h(){return new Promise(o=>setTimeout(o,0))}function c(){let o=t.timeToLive?t.timeToLive*1e3:null,n=a(),u=new Date().getTime(),p=!1;return{namespace:Object.fromEntries(Object.entries(n).filter(([,m])=>!m||m.timestamp===void 0||o&&m.timestamp+o<u?(p=!0,!1):!0)),changed:p}}return{get(o,n,u={miss:()=>Promise.resolve()}){return h().then(()=>{let{namespace:p,changed:f}=c(),m=p[JSON.stringify(o)];return f&&d(p),m?m.value:n().then(T=>u.miss(T).then(()=>T))})},set(o,n){return h().then(()=>{let u=a();return u[JSON.stringify(o)]={timestamp:new Date().getTime(),value:n},r().setItem(s,JSON.stringify(u)),n})},delete(o){return h().then(()=>{let n=a();delete n[JSON.stringify(o)],r().setItem(s,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{r().removeItem(s)})}}}function ce(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(a=>Promise.all([a,s.miss(a)])).then(([a])=>a)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function O(t){let e=[...t.caches],s=e.shift();return s===void 0?ce():{get(r,a,d={miss:()=>Promise.resolve()}){return s.get(r,a,d).catch(()=>O({caches:e}).get(r,a,d))},set(r,a){return s.set(r,a).catch(()=>O({caches:e}).set(r,a))},delete(r){return s.delete(r).catch(()=>O({caches:e}).delete(r))},clear(){return s.clear().catch(()=>O({caches:e}).clear())}}}function D(t={serializable:!0}){let e={};return{get(s,r,a={miss:()=>Promise.resolve()}){let d=JSON.stringify(s);if(d in e)return Promise.resolve(t.serializable?JSON.parse(e[d]):e[d]);let h=r();return h.then(c=>a.miss(c)).then(()=>h)},set(s,r){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function ue(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let r=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(r)===-1&&(e.value=`${e.value}${r}`),e}};return e}function Z(t,e,s="WithinHeaders"){let r={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?r:{}},queryParameters(){return s==="WithinQueryParameters"?r:{}}}}function ee({algoliaAgents:t,client:e,version:s}){let r=ue(s).add({segment:e,version:s});return t.forEach(a=>r.add(a)),r}function te(){return{debug(t,e){return Promise.resolve()},info(t,e){return Promise.resolve()},error(t,e){return Promise.resolve()}}}var le=10*1024*1024;async function*de(t){let e=t.getReader();try{for(;;){let{done:s,value:r}=await e.read();if(s)return;yield r}}finally{e.releaseLock()}}function me(t){return Symbol.asyncIterator in t?t:de(t)}async function*pe(t){let e=new TextDecoder("utf-8"),s=[],r=0,a=!1,d=!0;for await(let c of me(t)){let o=e.decode(c,{stream:!0}),n=0;for(a&&(a=!1,o.length>0&&o[0]===`
2
+ `&&(n=1));n<o.length;){let u=o.indexOf("\r",n),p=o.indexOf(`
3
+ `,n);if(u===-1&&p===-1){let i=o.slice(n);if(s.push(i),r+=i.length,r>le)throw new Error("SSE line buffer exceeded 10MB");break}let f,m;u!==-1&&(p===-1||u<p)?(f=u,u+1<o.length?m=o[u+1]===`
4
+ `?2:1:(a=!0,m=1)):(f=p,m=1);let T=o.slice(n,f);s.push(T);let y=s.length===1?s[0]:s.join("");s.length=0,r=0,d&&(y.startsWith("\uFEFF")&&(y=y.slice(1)),d=!1),yield y,n=f+m}}let h=e.decode();if(h&&s.push(h),s.length>0){let c=s.join("");d&&c.startsWith("\uFEFF")&&(c=c.slice(1)),yield c}}var fe=class{data=[];eventType="";lastEventId=null;retry=null;decode(t){if(t==="")return this.dispatch();if(t[0]===":")return null;let e=t.indexOf(":"),s,r;switch(e===-1?(s=t,r=""):(s=t.slice(0,e),r=t.slice(e+1),r[0]===" "&&(r=r.slice(1))),s){case"data":this.data.push(r);break;case"event":this.eventType=r;break;case"id":r.includes("\0")||(this.lastEventId=r);break;case"retry":/^[0-9]+$/.test(r)&&(this.retry=parseInt(r,10));break}return null}dispatch(){let t=this.eventType;if(this.eventType="",this.data.length===0)return null;let e={data:this.data.join(`
5
+ `),event:t,id:this.lastEventId,retry:this.retry};return this.data=[],e}};async function*he(t){let e=new fe;for await(let s of pe(t)){let r=e.decode(s);r!==null&&(yield r)}}var ge=750,Q=120*1e3;function J(t,e="up"){let s=Date.now();function r(){return e==="up"||Date.now()-s>Q}function a(){return e==="timed out"&&Date.now()-s<=Q}return{...t,status:e,lastUpdate:s,isUp:r,isTimedOut:a}}var re=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}};var se=class extends re{stackTrace;constructor(t,e,s){super(t,s),this.stackTrace=e}},M=class extends se{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",t,"RetryError")}},$=class extends se{status;constructor(t,e,s,r="ApiError"){super(t,s,r),this.status=e}},ye=class extends re{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},Pe=class extends ${error;constructor(t,e,s,r){super(t,e,r,"DetailedApiError"),this.error=s}};function V(t,e,s){let r=Te(s),a=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(a+=`?${r}`),a}function Te(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 X(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function K(t,e,s){let r={Accept:"application/json",...t,...e,...s},a={};return Object.keys(r).forEach(d=>{let h=r[d];a[d.toLowerCase()]=h}),a}function Ae(t){if(!(t.status===204||t.content.length===0))try{return JSON.parse(t.content)}catch(e){throw new ye(e.message,t)}}function Ee({content:t,status:e},s){try{let r=JSON.parse(t);return"error"in r?new Pe(r.message,e,r.error,s):new $(r.message,e,s)}catch{}return new $(t,e,s)}function Re({isTimedOut:t,status:e}){return!t&&~~e===0}function ve({isTimedOut:t,status:e}){return t||Re({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function xe({status:t}){return~~(t/100)===2}function qe(t){return t.map(e=>oe(e))}function oe(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 ne({hosts:t,hostsCache:e,baseHeaders:s,logger:r,baseQueryParameters:a,algoliaAgent:d,timeouts:h,requester:c,requestsCache:o,responsesCache:n,compress:u,compression:p}){async function f(i){let l=await Promise.all(i.map(g=>e.get(g,()=>Promise.resolve(J(g))))),q=l.filter(g=>g.isUp()),R=l.filter(g=>g.isTimedOut()),x=[...q,...R];return{hosts:x.length>0?x:i,getTimeout(g,b){return(R.length===0&&g===0?1:R.length+3+g)*b}}}async function m(i,l,q){let R=[],x=X(i,l),A=K(s,i.headers,l.headers),g=p==="gzip"&&x!==void 0&&x.length>ge&&(i.method==="POST"||i.method==="PUT");g&&u===void 0&&r.info("Compression is disabled because no compress method is available.");let b=g&&u!==void 0,k=b?await u(x):x;b&&(A["content-encoding"]="gzip");let I=i.method==="GET"?{...i.data,...l.data}:{},S={...a,...i.queryParameters,...I};if(d.value&&(S["x-algolia-agent"]=d.value),l&&l.queryParameters)for(let E of Object.keys(l.queryParameters))!l.queryParameters[E]||Object.prototype.toString.call(l.queryParameters[E])==="[object Object]"?S[E]=l.queryParameters[E]:S[E]=l.queryParameters[E].toString();let B=0,N=async(E,L)=>{let C=E.pop();if(C===void 0)throw new M(qe(R));let H={...h,...l.timeouts},F={data:k,headers:A,method:i.method,url:V(C,i.path,S),connectTimeout:L(B,H.connect),responseTimeout:L(B,q?H.read:H.write)},W=U=>{let z={request:F,response:U,host:C,triesLeft:E.length};return R.push(z),z},w=await c.send(F);if(ve(w)){let U=W(w);return w.isTimedOut&&B++,r.info("Retryable failure",oe(U)),await e.set(C,J(C,w.isTimedOut?"timed out":"down")),N(E,L)}if(xe(w))return Ae(w);throw W(w),Ee(w,R)},v=t.filter(E=>E.accept==="readWrite"||(q?E.accept==="read":E.accept==="write")),G=await f(v);return N([...G.hosts].reverse(),G.getTimeout)}function T(i,l={}){let q=()=>m(i,l,R),R=i.useReadTransporter||i.method==="GET";if((l.cacheable||i.cacheable)!==!0)return q();let A={request:i,requestOptions:l,transporter:{queryParameters:a,headers:s}};return n.get(A,()=>o.get(A,()=>o.set(A,q()).then(g=>Promise.all([o.delete(A),g]),g=>Promise.all([o.delete(A),Promise.reject(g)])).then(([g,b])=>b)),{miss:g=>n.set(A,g)})}async function*y(i,l={}){if(!c.sendStream)throw new Error("This requester does not support streaming");let q=X(i,l),R=K(s,i.headers,l.headers);R.accept="text/event-stream";let x=i.method==="GET"?{...i.data,...l.data}:{},A={...a,...i.queryParameters,...x};if(d.value&&(A["x-algolia-agent"]=d.value),l&&l.queryParameters)for(let v of Object.keys(l.queryParameters))!l.queryParameters[v]||Object.prototype.toString.call(l.queryParameters[v])==="[object Object]"?A[v]=l.queryParameters[v]:A[v]=l.queryParameters[v].toString();let g=i.useReadTransporter||i.method==="GET",b=t.filter(v=>v.accept==="readWrite"||(g?v.accept==="read":v.accept==="write")),I=(await f(b)).hosts[0];if(!I)throw new M([]);let S={...h,...l.timeouts},B={data:q,headers:R,method:i.method,url:V(I,i.path,A),connectTimeout:S.connect,responseTimeout:g?S.read:S.write},N=await c.sendStream(B);yield*he(N)}return{hostsCache:e,requester:c,timeouts:h,logger:r,algoliaAgent:d,baseHeaders:s,baseQueryParameters:a,hosts:t,request:T,requestStream:y,requestsCache:o,responsesCache:n}}function P(t,e,s){if(s==null||typeof s=="string"&&s.length===0)throw new Error(`Parameter \`${t}\` is required when calling \`${e}\`.`)}function ae(){function t(e){return new Promise(s=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(c=>r.setRequestHeader(c,e.headers[c]));let a=(c,o)=>setTimeout(()=>{r.abort(),s({status:0,content:o,isTimedOut:!0})},c),d=a(e.connectTimeout,"Connection timeout"),h;r.onreadystatechange=()=>{r.readyState>r.OPENED&&h===void 0&&(clearTimeout(d),h=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(d),clearTimeout(h),s({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(d),clearTimeout(h),s({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}var _="1.20.1",j=["de","us"];function be(t){return[{url:t?"analytics.{region}.algolia.com".replace("{region}",t):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function ie({appId:t,apiKey:e,authMode:s,algoliaAgents:r,region:a,...d}){let h=Z(t,e,s),c=ne({hosts:be(a),...d,algoliaAgent:ee({algoliaAgents:r,client:"AbtestingV3",version:_}),baseHeaders:{"content-type":"text/plain",...h.headers(),...d.baseHeaders},baseQueryParameters:{...h.queryParameters(),...d.baseQueryParameters}});return{transporter:c,appId:t,apiKey:e,clearCache(){return Promise.all([c.requestsCache.clear(),c.responsesCache.clear()]).then(()=>{})},get _ua(){return c.algoliaAgent.value},addAlgoliaAgent(o,n){c.algoliaAgent.add({segment:o,version:n})},setClientApiKey({apiKey:o}){!s||s==="WithinHeaders"?c.baseHeaders["x-algolia-api-key"]=o:c.baseQueryParameters["x-algolia-api-key"]=o},addABTests(o,n){P("addABTestsRequest","addABTests",o),P("addABTestsRequest.name","addABTests",o.name),P("addABTestsRequest.variants","addABTests",o.variants),P("addABTestsRequest.metrics","addABTests",o.metrics),P("addABTestsRequest.endAt","addABTests",o.endAt);let m={method:"POST",path:"/3/abtests",queryParameters:{},headers:{},data:o};return c.request(m,n)},customDelete({path:o,parameters:n},u){P("path","customDelete",o);let T={method:"DELETE",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{}};return c.request(T,u)},customGet({path:o,parameters:n},u){P("path","customGet",o);let T={method:"GET",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{}};return c.request(T,u)},customPost({path:o,parameters:n,body:u},p){P("path","customPost",o);let y={method:"POST",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{},data:u||{}};return c.request(y,p)},customPut({path:o,parameters:n,body:u},p){P("path","customPut",o);let y={method:"PUT",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{},data:u||{}};return c.request(y,p)},deleteABTest({id:o},n){P("id","deleteABTest",o);let m={method:"DELETE",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(o)),queryParameters:{},headers:{}};return c.request(m,n)},estimateABTest(o,n){P("estimateABTestRequest","estimateABTest",o),P("estimateABTestRequest.configuration","estimateABTest",o.configuration),P("estimateABTestRequest.variants","estimateABTest",o.variants);let m={method:"POST",path:"/3/abtests/estimate",queryParameters:{},headers:{},data:o};return c.request(m,n)},getABTest({id:o},n){P("id","getABTest",o);let m={method:"GET",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(o)),queryParameters:{},headers:{}};return c.request(m,n)},getTimeseries({id:o,startDate:n,endDate:u,metric:p},f){P("id","getTimeseries",o);let m="/3/abtests/{id}/timeseries".replace("{id}",encodeURIComponent(o)),T={},y={};n!==void 0&&(y.startDate=n.toString()),u!==void 0&&(y.endDate=u.toString()),p!==void 0&&(y.metric=p.toString());let i={method:"GET",path:m,queryParameters:y,headers:T};return c.request(i,f)},listABTests({offset:o,limit:n,indexPrefix:u,indexSuffix:p,direction:f}={},m=void 0){let T="/3/abtests",y={},i={};o!==void 0&&(i.offset=o.toString()),n!==void 0&&(i.limit=n.toString()),u!==void 0&&(i.indexPrefix=u.toString()),p!==void 0&&(i.indexSuffix=p.toString()),f!==void 0&&(i.direction=f.toString());let l={method:"GET",path:T,queryParameters:i,headers:y};return c.request(l,m)},stopABTest({id:o},n){P("id","stopABTest",o);let m={method:"POST",path:"/3/abtests/{id}/stop".replace("{id}",encodeURIComponent(o)),queryParameters:{},headers:{}};return c.request(m,n)}}}function At(t,e,s,r){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(s&&(typeof s!="string"||!j.includes(s)))throw new Error(`\`region\` must be one of the following: ${j.join(", ")}`);let{compression:a,...d}=r||{};return ie({appId:t,apiKey:e,region:s,timeouts:{connect:1e3,read:2e3,write:3e4},logger:te(),requester:ae(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:D(),requestsCache:D({serializable:!1}),hostsCache:O({caches:[Y({key:`${_}-${t}`}),D()]}),...d})}export{At as abtestingV3Client,_ as apiClientVersion};
2
6
  //# sourceMappingURL=browser.min.js.map