@algolia/abtesting 0.0.1-alpha.2 → 0.0.1-alpha.4

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
@@ -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@0.0.1-alpha.2
44
+ yarn add @algolia/abtesting@0.0.1-alpha.4
45
45
  # or
46
- npm install @algolia/abtesting@0.0.1-alpha.2
46
+ npm install @algolia/abtesting@0.0.1-alpha.4
47
47
  # or
48
- pnpm add @algolia/abtesting@0.0.1-alpha.2
48
+ pnpm add @algolia/abtesting@0.0.1-alpha.4
49
49
  ```
50
50
 
51
51
  ### Without a package manager
@@ -53,7 +53,7 @@ pnpm add @algolia/abtesting@0.0.1-alpha.2
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@0.0.1-alpha.2/dist/builds/browser.umd.js"></script>
56
+ <script src="https://cdn.jsdelivr.net/npm/@algolia/abtesting@0.0.1-alpha.4/dist/builds/browser.umd.js"></script>
57
57
  ```
58
58
 
59
59
  ### Usage
package/dist/browser.d.ts CHANGED
@@ -61,7 +61,49 @@ type ABTestConfiguration = {
61
61
  */
62
62
  type Status = 'active' | 'stopped' | 'expired' | 'failed';
63
63
 
64
- type Metric = 'search_count' | 'tracked_search_count' | 'user_count' | 'tracked_user_count' | 'no_result_count' | 'add_to_cart_count' | 'purchase_count' | 'clicked_search_count' | 'converted_search_count' | 'click_through_rate' | 'conversion_rate' | 'add_to_cart_rate' | 'purchase_rate' | 'average_click_position' | 'revenue';
64
+ /**
65
+ * Metric specific metadata.
66
+ */
67
+ type MetricMetadata = {
68
+ /**
69
+ * Only present in case the metric is \'revenue\'. It is the amount exceeding the 95th percentile of global revenue transactions involved in the AB Test. This amount is not considered when calculating statistical significance. It is tied to a per revenue-currency pair contrary to other global filter effects (such as outliers and empty search count).
70
+ */
71
+ winsorizedValue?: number | undefined;
72
+ };
73
+
74
+ type MetricResult = {
75
+ name: string;
76
+ /**
77
+ * Date and time when the metric was last updated, in RFC 3339 format.
78
+ */
79
+ updatedAt: string;
80
+ value: number;
81
+ /**
82
+ * The upper bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
83
+ */
84
+ valueCIHigh?: number | undefined;
85
+ /**
86
+ * The lower bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
87
+ */
88
+ valueCILow?: number | undefined;
89
+ /**
90
+ * PValue for the first variant (control) will always be 0. For the other variants, pValue is calculated for the current variant based on the control.
91
+ */
92
+ pValue: number;
93
+ /**
94
+ * Dimension defined during test creation.
95
+ */
96
+ dimension?: string | undefined;
97
+ metadata?: MetricMetadata | undefined;
98
+ /**
99
+ * The value that was computed during error correction. It is used to determine significance of the metric pValue. The critical value is calculated using Bonferroni or Benjamini-Hochberg corrections, based on the given configuration during the A/B test creation.
100
+ */
101
+ criticalValue?: number | undefined;
102
+ /**
103
+ * Whether the pValue is significant or not based on the critical value and the error correction algorithm used.
104
+ */
105
+ significant?: boolean | undefined;
106
+ };
65
107
 
66
108
  /**
67
109
  * Empty searches removed from the A/B test as a result of configuration settings.
@@ -126,7 +168,7 @@ type Variant = {
126
168
  /**
127
169
  * All ABTest metrics that were defined during test creation.
128
170
  */
129
- metrics: Array<Metric>;
171
+ metrics: Array<MetricResult>;
130
172
  metadata?: VariantMetadata | undefined;
131
173
  };
132
174
 
@@ -207,7 +249,7 @@ type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
207
249
  /**
208
250
  * Defines a metric to be retrieved during an A/B test.
209
251
  */
210
- type ParametersMetric = {
252
+ type CreateMetric = {
211
253
  /**
212
254
  * Name of the metric.
213
255
  */
@@ -230,7 +272,7 @@ type AddABTestsRequest = {
230
272
  /**
231
273
  * A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
232
274
  */
233
- metrics: Array<ParametersMetric>;
275
+ metrics: Array<CreateMetric>;
234
276
  configuration?: ABTestConfiguration | undefined;
235
277
  /**
236
278
  * End date and time of the A/B test, in RFC 3339 format.
@@ -302,7 +344,7 @@ type ScheduleABTestsRequest = {
302
344
  /**
303
345
  * A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
304
346
  */
305
- metrics: Array<ParametersMetric>;
347
+ metrics: Array<CreateMetric>;
306
348
  configuration?: ABTestConfiguration | undefined;
307
349
  /**
308
350
  * Date and time when the A/B test is scheduled to start, in RFC 3339 format.
@@ -322,7 +364,7 @@ type MetricDate = {
322
364
  /**
323
365
  * All ABTest metrics that were defined during test creation.
324
366
  */
325
- metrics?: Array<Metric> | undefined;
367
+ metrics?: Array<MetricResult> | undefined;
326
368
  };
327
369
 
328
370
  type TimeseriesVariant = {
@@ -340,6 +382,8 @@ type Timeseries = {
340
382
  variants: Array<TimeseriesVariant>;
341
383
  };
342
384
 
385
+ type MetricName = 'search_count' | 'tracked_search_count' | 'user_count' | 'tracked_user_count' | 'no_result_count' | 'add_to_cart_count' | 'purchase_count' | 'clicked_search_count' | 'converted_search_count' | 'click_through_rate' | 'conversion_rate' | 'add_to_cart_rate' | 'purchase_rate' | 'average_click_position' | 'revenue';
386
+
343
387
  /**
344
388
  * Properties for the `customDelete` method.
345
389
  */
@@ -445,7 +489,7 @@ type GetTimeseriesProps = {
445
489
  /**
446
490
  * List of metrics to retrieve. If not specified, all metrics are returned.
447
491
  */
448
- metric?: Array<Metric> | undefined;
492
+ metric?: Array<MetricName> | undefined;
449
493
  };
450
494
  /**
451
495
  * Properties for the `listABTests` method.
@@ -478,7 +522,7 @@ type StopABTestProps = {
478
522
  id: number;
479
523
  };
480
524
 
481
- declare const apiClientVersion = "0.0.1-alpha.2";
525
+ declare const apiClientVersion = "0.0.1-alpha.4";
482
526
  declare const REGIONS: readonly ["de", "us"];
483
527
  type Region = (typeof REGIONS)[number];
484
528
  type RegionOptions = {
@@ -644,17 +688,7 @@ type ErrorBase = Record<string, any> & {
644
688
  message?: string | undefined;
645
689
  };
646
690
 
647
- /**
648
- * Metric specific metadata.
649
- */
650
- type MetricMetadata = {
651
- /**
652
- * Only present in case the metric is \'revenue\'. It is the amount exceeding the 95th percentile of global revenue transactions involved in the AB Test. This amount is not considered when calculating statistical significance. It is tied to a per revenue-currency pair contrary to other global filter effects (such as outliers and empty search count).
653
- */
654
- winsorizedValue?: number | undefined;
655
- };
656
-
657
691
  declare function abtestingClient(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingClient;
658
692
  type AbtestingClient = ReturnType<typeof createAbtestingClient>;
659
693
 
660
- export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingClient, type AddABTestsRequest, type AddABTestsVariant, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, 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 Metric, type MetricDate, type MetricMetadata, type MetricsFilter, type MinimumDetectableEffect, type OutliersFilter, type ParametersMetric, type Region, type RegionOptions, type ScheduleABTestResponse, type ScheduleABTestsRequest, type Status, type StopABTestProps, type Timeseries, type TimeseriesVariant, type Variant, type VariantMetadata, abtestingClient, apiClientVersion };
694
+ export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingClient, type AddABTestsRequest, type AddABTestsVariant, type CreateMetric, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, 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, abtestingClient, apiClientVersion };
@@ -9,7 +9,7 @@ import {
9
9
 
10
10
  // src/abtestingClient.ts
11
11
  import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
12
- var apiClientVersion = "0.0.1-alpha.2";
12
+ var apiClientVersion = "0.0.1-alpha.4";
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);
@@ -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.2';\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 requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n listABTests(\n { offset, limit, indexPrefix, indexSuffix }: ListABTestsProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<ListABTestsResponse> {\n const requestPath = '/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 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,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EAAE,CAAC;AACjF,YAAM,UAAmB,CAAC;AAC1B,YAAM,kBAAmC,CAAC;AAE1C,YAAM,UAAmB;AAAA,QACvB,QAAQ;AAAA,QACR,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACF;AAEA,aAAO,YAAY,QAAQ,SAAS,cAAc;AAAA,IACpD;AAAA,EACF;AACF;;;AD1gBO,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/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.4';\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 requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n listABTests(\n { offset, limit, indexPrefix, indexSuffix }: ListABTestsProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<ListABTestsResponse> {\n const requestPath = '/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 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,gBAAgB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA,IACX,CAAC;AAAA,IACD,aAAa;AAAA,MACX,gBAAgB;AAAA,MAChB,GAAG,KAAK,QAAQ;AAAA,MAChB,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,qBAAqB;AAAA,MACnB,GAAG,KAAK,gBAAgB;AAAA,MACxB,GAAG,QAAQ;AAAA,IACb;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA;AAAA;AAAA;AAAA,IAKA,OAAO;AAAA;AAAA;AAAA;AAAA,IAKP,QAAQ;AAAA;AAAA;AAAA;AAAA,IAKR,aAA4B;AAC1B,aAAO,QAAQ,IAAI,CAAC,YAAY,cAAc,MAAM,GAAG,YAAY,eAAe,MAAM,CAAC,CAAC,EAAE,KAAK,M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AAA,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"),f;r.onreadystatechange=()=>{r.readyState>r.OPENED&&f===void 0&&(clearTimeout(d),f=u(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(d),clearTimeout(f),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(d),clearTimeout(f),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 f(){let n=t.timeToLive?t.timeToLive*1e3:null,s=u(),a=Object.fromEntries(Object.entries(s).filter(([,m])=>m.timestamp!==void 0));if(d(a),!n)return;let c=Object.fromEntries(Object.entries(a).filter(([,m])=>{let P=new Date().getTime();return!(m.timestamp+n<P)}));d(c)}return{get(n,s,a={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(f(),u()[JSON.stringify(n)])).then(c=>Promise.all([c?c.value:s(),c!==void 0])).then(([c,m])=>Promise.all([c,m||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 w(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(()=>w({caches:e}).get(r,u,d))},set(r,u){return o.set(r,u).catch(()=>w({caches:e}).set(r,u))},delete(r){return o.delete(r).catch(()=>w({caches:e}).delete(r))},clear(){return o.clear().catch(()=>w({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 f=r();return f.then(n=>u.miss(n)).then(()=>f)},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 f=r[d];u[d.toLowerCase()]=f}),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 le({status:t}){return~~(t/100)===2}function me(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:f,requester:n,requestsCache:s,responsesCache:a}){async function c(i){let l=await Promise.all(i.map(h=>e.get(h,()=>Promise.resolve($(h))))),p=l.filter(h=>h.isUp()),g=l.filter(h=>h.isTimedOut()),E=[...p,...g];return{hosts:E.length>0?E:i,getTimeout(h,A){return(g.length===0&&h===0?1:g.length+3+h)*A}}}async function m(i,l,p=!0){let g=[],E=oe(i,l),y=ae(o,i.headers,l.headers),h=i.method==="GET"?{...i.data,...l.data}:{},A={...u,...i.queryParameters,...h};if(d.value&&(A["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]"?A[T]=l.queryParameters[T]:A[T]=l.queryParameters[T].toString();let x=0,N=async(T,B)=>{let R=T.pop();if(R===void 0)throw new Z(me(g));let S={...f,...l.timeouts},_={data:E,headers:y,method:i.method,url:re(R,i.path,A),connectTimeout:B(x,S.connect),responseTimeout:B(x,p?S.read:S.write)},H=b=>{let L={request:_,response:b,host:R,triesLeft:T.length};return g.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(le(q))return ne(q);throw H(q),ie(q,g)},K=t.filter(T=>T.accept==="readWrite"||(p?T.accept==="read":T.accept==="write")),D=await c(K);return N([...D.hosts].reverse(),D.getTimeout)}function P(i,l={}){let p=i.useReadTransporter||i.method==="GET";if(!p)return m(i,l,p);let g=()=>m(i,l);if((l.cacheable||i.cacheable)!==!0)return g();let y={request:i,requestOptions:l,transporter:{queryParameters:u,headers:o}};return a.get(y,()=>s.get(y,()=>s.set(y,g()).then(h=>Promise.all([s.delete(y),h]),h=>Promise.all([s.delete(y),Promise.reject(h)])).then(([h,A])=>A)),{miss:h=>a.set(y,h)})}return{hostsCache:e,requester:n,timeouts:f,logger:r,algoliaAgent:d,baseHeaders:o,baseQueryParameters:u,hosts:t,request:P,requestsCache:s,responsesCache:a}}var O="0.0.1-alpha.2",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 f=Q(t,e,o),n=F({hosts:de(u),...d,algoliaAgent:j({algoliaAgents:r,client:"Abtesting",version:O}),baseHeaders:{"content-type":"text/plain",...f.headers(),...d.baseHeaders},baseQueryParameters:{...f.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 l={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{}};return n.request(l,c)},customGet({path:s,parameters:a},c){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let l={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{}};return n.request(l,c)},customPost({path:s,parameters:a,body:c},m){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let p={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{},data:c||{}};return n.request(p,m)},customPut({path:s,parameters:a,body:c},m){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let p={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{},data:c||{}};return n.request(p,m)},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:m},P){if(!s)throw new Error("Parameter `id` is required when calling `getTimeseries`.");let i="/3/abtests/{id}/timeseries".replace("{id}",encodeURIComponent(s)),l={},p={};a!==void 0&&(p.startDate=a.toString()),c!==void 0&&(p.endDate=c.toString()),m!==void 0&&(p.metric=m.toString());let g={method:"GET",path:i,queryParameters:p,headers:l};return n.request(g,P)},listABTests({offset:s,limit:a,indexPrefix:c,indexSuffix:m}={},P=void 0){let i="/3/abtests",l={},p={};s!==void 0&&(p.offset=s.toString()),a!==void 0&&(p.limit=a.toString()),c!==void 0&&(p.indexPrefix=c.toString()),m!==void 0&&(p.indexSuffix=m.toString());let g={method:"GET",path:i,queryParameters:p,headers:l};return n.request(g,P)},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 at(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:w({caches:[G({key:`${O}-${t}`}),v()]}),...r})}export{at 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"),f;r.onreadystatechange=()=>{r.readyState>r.OPENED&&f===void 0&&(clearTimeout(d),f=u(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(d),clearTimeout(f),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(d),clearTimeout(f),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 f(){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 P=new Date().getTime();return!(l.timestamp+n<P)}));d(c)}return{get(n,s,a={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(f(),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 w(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(()=>w({caches:e}).get(r,u,d))},set(r,u){return o.set(r,u).catch(()=>w({caches:e}).set(r,u))},delete(r){return o.delete(r).catch(()=>w({caches:e}).delete(r))},clear(){return o.clear().catch(()=>w({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 f=r();return f.then(n=>u.miss(n)).then(()=>f)},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 f=r[d];u[d.toLowerCase()]=f}),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:f,requester:n,requestsCache:s,responsesCache:a}){async function c(i){let m=await Promise.all(i.map(h=>e.get(h,()=>Promise.resolve($(h))))),p=m.filter(h=>h.isUp()),g=m.filter(h=>h.isTimedOut()),E=[...p,...g];return{hosts:E.length>0?E:i,getTimeout(h,A){return(g.length===0&&h===0?1:g.length+3+h)*A}}}async function l(i,m,p=!0){let g=[],E=oe(i,m),y=ae(o,i.headers,m.headers),h=i.method==="GET"?{...i.data,...m.data}:{},A={...u,...i.queryParameters,...h};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(g));let S={...f,...m.timeouts},_={data:E,headers:y,method:i.method,url:re(R,i.path,A),connectTimeout:B(x,S.connect),responseTimeout:B(x,p?S.read:S.write)},H=b=>{let L={request:_,response:b,host:R,triesLeft:T.length};return g.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,g)},K=t.filter(T=>T.accept==="readWrite"||(p?T.accept==="read":T.accept==="write")),D=await c(K);return N([...D.hosts].reverse(),D.getTimeout)}function P(i,m={}){let p=i.useReadTransporter||i.method==="GET";if(!p)return l(i,m,p);let g=()=>l(i,m);if((m.cacheable||i.cacheable)!==!0)return g();let y={request:i,requestOptions:m,transporter:{queryParameters:u,headers:o}};return a.get(y,()=>s.get(y,()=>s.set(y,g()).then(h=>Promise.all([s.delete(y),h]),h=>Promise.all([s.delete(y),Promise.reject(h)])).then(([h,A])=>A)),{miss:h=>a.set(y,h)})}return{hostsCache:e,requester:n,timeouts:f,logger:r,algoliaAgent:d,baseHeaders:o,baseQueryParameters:u,hosts:t,request:P,requestsCache:s,responsesCache:a}}var O="0.0.1-alpha.4",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 f=Q(t,e,o),n=F({hosts:de(u),...d,algoliaAgent:j({algoliaAgents:r,client:"Abtesting",version:O}),baseHeaders:{"content-type":"text/plain",...f.headers(),...d.baseHeaders},baseQueryParameters:{...f.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 p={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{},data:c||{}};return n.request(p,l)},customPut({path:s,parameters:a,body:c},l){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let p={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{},data:c||{}};return n.request(p,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},P){if(!s)throw new Error("Parameter `id` is required when calling `getTimeseries`.");let i="/3/abtests/{id}/timeseries".replace("{id}",encodeURIComponent(s)),m={},p={};a!==void 0&&(p.startDate=a.toString()),c!==void 0&&(p.endDate=c.toString()),l!==void 0&&(p.metric=l.toString());let g={method:"GET",path:i,queryParameters:p,headers:m};return n.request(g,P)},listABTests({offset:s,limit:a,indexPrefix:c,indexSuffix:l}={},P=void 0){let i="/3/abtests",m={},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());let g={method:"GET",path:i,queryParameters:p,headers:m};return n.request(g,P)},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 nt(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:w({caches:[G({key:`${O}-${t}`}),v()]}),...r})}export{nt as abtestingClient,O as apiClientVersion};
2
2
  //# sourceMappingURL=browser.min.js.map