@ninetailed/experience.js 1.0.1-beta.9 → 1.2.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/index.esm.js CHANGED
@@ -3412,7 +3412,7 @@ class NinetailedApiClient {
3412
3412
  'Content-Type': 'application/json'
3413
3413
  },
3414
3414
  body: JSON.stringify(body),
3415
- timeout: 8000
3415
+ timeout: options.timeout || 3000
3416
3416
  });
3417
3417
  log('Profile Request: ', request);
3418
3418
  const {
@@ -4124,7 +4124,8 @@ class Ninetailed {
4124
4124
  plugins,
4125
4125
  url,
4126
4126
  profile,
4127
- locale
4127
+ locale,
4128
+ requestTimeout
4128
4129
  } = {}) {
4129
4130
  this.page = (data, options) => {
4130
4131
  return this.instance.page(data, this.buildOptions(options));
@@ -4181,7 +4182,8 @@ class Ninetailed {
4181
4182
  environment,
4182
4183
  url,
4183
4184
  profile,
4184
- locale
4185
+ locale,
4186
+ requestTimeout
4185
4187
  })]
4186
4188
  }); // put in private method
4187
4189
 
@@ -4266,7 +4268,7 @@ const selectVariant = (baseline, variants, {
4266
4268
  return {
4267
4269
  loading: false,
4268
4270
  variant: Object.assign({
4269
- id: 'baseline',
4271
+ id: baseline.id,
4270
4272
  audience: {
4271
4273
  id: 'baseline'
4272
4274
  }
package/index.umd.js CHANGED
@@ -3497,7 +3497,7 @@
3497
3497
  'Content-Type': 'application/json'
3498
3498
  },
3499
3499
  body: JSON.stringify(body),
3500
- timeout: 8000
3500
+ timeout: options.timeout || 3000
3501
3501
  })];
3502
3502
 
3503
3503
  case 2:
@@ -3885,7 +3885,8 @@
3885
3885
  plugins = _c.plugins,
3886
3886
  url = _c.url,
3887
3887
  profile = _c.profile,
3888
- locale = _c.locale;
3888
+ locale = _c.locale,
3889
+ requestTimeout = _c.requestTimeout;
3889
3890
 
3890
3891
  this.page = function (data, options) {
3891
3892
  return _this.instance.page(data, _this.buildOptions(options));
@@ -3941,7 +3942,8 @@
3941
3942
  environment: environment,
3942
3943
  url: url,
3943
3944
  profile: profile,
3944
- locale: locale
3945
+ locale: locale,
3946
+ requestTimeout: requestTimeout
3945
3947
  })], false)
3946
3948
  }); // put in private method
3947
3949
 
@@ -4039,7 +4041,7 @@
4039
4041
  return {
4040
4042
  loading: false,
4041
4043
  variant: __assign({
4042
- id: 'baseline',
4044
+ id: baseline.id,
4043
4045
  audience: {
4044
4046
  id: 'baseline'
4045
4047
  }
@@ -6,6 +6,7 @@ declare type Options = {
6
6
  locale?: Locale;
7
7
  plugins?: (AnalyticsPlugin | AnalyticsPlugin[])[];
8
8
  profile?: Profile;
9
+ requestTimeout?: number;
9
10
  };
10
11
  declare type EventFunctionOptions = {
11
12
  plugins?: {
@@ -45,7 +46,7 @@ export declare class Ninetailed implements NinetailedInstance {
45
46
  clientId: string;
46
47
  environment?: string;
47
48
  preview?: boolean;
48
- }, { plugins, url, profile, locale }?: Options);
49
+ }, { plugins, url, profile, locale, requestTimeout }?: Options);
49
50
  page: (data?: PageData, options?: EventFunctionOptions) => Promise<any>;
50
51
  track: (event: string, payload?: unknown, options?: EventFunctionOptions) => Promise<any>;
51
52
  trackHasSeenComponent: TrackHasSeenComponent;
@@ -12,6 +12,7 @@ declare type AnalyticsPluginNinetailedConfig = {
12
12
  url?: string;
13
13
  profile?: Profile;
14
14
  locale?: Locale;
15
+ requestTimeout?: number;
15
16
  };
16
17
  export declare const NINETAILED_TRACKER_EVENTS: {
17
18
  /**
@@ -4,7 +4,9 @@ declare type NinetailedApiClientOptions = {
4
4
  environment: string;
5
5
  url?: string;
6
6
  };
7
- declare type ProfileOptions = IngestProfileEventsRequestBody;
7
+ declare type ProfileOptions = IngestProfileEventsRequestBody & {
8
+ timeout?: number;
9
+ };
8
10
  declare type ProfileResponse = {
9
11
  profile: Profile;
10
12
  signals: AudienceSignals;
@@ -31,5 +31,7 @@ declare type Fail<T> = {
31
31
  error: Error;
32
32
  };
33
33
  declare type Result<T> = Loading<T> | Success<T> | Fail<T>;
34
- export declare const selectVariant: <T>(baseline: T, variants: Variant<T>[], { loading, profile, error }: ProfileState, options?: Options) => Result<T>;
34
+ export declare const selectVariant: <T extends {
35
+ id: string;
36
+ }>(baseline: T, variants: Variant<T>[], { loading, profile, error }: ProfileState, options?: Options) => Result<T>;
35
37
  export {};
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js",
3
- "version": "1.0.1-beta.9",
3
+ "version": "1.2.1",
4
4
  "main": "./index.umd.js",
5
5
  "module": "./index.esm.js",
6
6
  "typings": "./index.d.ts",
7
7
  "dependencies": {
8
- "@ninetailed/experience.js-shared": "1.0.1-beta.9",
8
+ "@ninetailed/experience.js-shared": "1.2.1",
9
9
  "uuid": "^8.3.2",
10
10
  "ts-toolbelt": "^9.6.0",
11
11
  "locale-enum": "^1.1.1",