@splitsoftware/splitio-browserjs 0.8.0 → 0.8.1-rc.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/CHANGES.txt CHANGED
@@ -1,3 +1,6 @@
1
+ 0.8.1 (September XXX, 2022)
2
+ - Updated @splitsoftware/splitio-commons package to version 1.6.2, that improves the performance of split evaluations (i.e., `getTreatment(s)` method calls) when using the default storage in memory.
3
+
1
4
  0.8.0 (July 22, 2022)
2
5
  - Added `autoRequire` configuration option to the Google Analytics to Split integration, which takes care of requiring the splitTracker plugin on trackers dynamically created by Google tag managers (See https://help.split.io/hc/en-us/articles/360040838752#set-up-with-gtm-and-gtag.js).
3
6
  - Updated browser listener to push remaining impressions and events on 'visibilitychange' and 'pagehide' DOM events, instead of 'unload', which is not reliable in modern mobile and desktop Web browsers.
@@ -19,7 +19,7 @@ var platform = { getFetch: getFetchFull_1.getFetch, getEventSource: getEventSour
19
19
  * @throws Will throw an error if the provided config is invalid.
20
20
  */
21
21
  function SplitFactory(config, __updateModules) {
22
- var settings = (0, full_1.settingsValidator)(config);
22
+ var settings = (0, full_1.settingsFactory)(config);
23
23
  var modules = (0, getModules_1.getModules)(settings, platform);
24
24
  if (__updateModules)
25
25
  __updateModules(modules);
@@ -10,7 +10,6 @@ var sdkClientMethodCS_1 = require("@splitsoftware/splitio-commons/cjs/sdkClient/
10
10
  var browser_1 = require("@splitsoftware/splitio-commons/cjs/listeners/browser");
11
11
  var impressionObserverCS_1 = require("@splitsoftware/splitio-commons/cjs/trackers/impressionObserver/impressionObserverCS");
12
12
  var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/integrations/pluggable");
13
- var utils_1 = require("@splitsoftware/splitio-commons/cjs/trackers/impressionObserver/utils");
14
13
  var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
15
14
  var sdkUserConsent_1 = require("@splitsoftware/splitio-commons/cjs/consent/sdkUserConsent");
16
15
  var syncManagerStandaloneFactory;
@@ -28,7 +27,7 @@ function getModules(settings, platform) {
28
27
  sdkClientMethodFactory: sdkClientMethodCS_1.sdkClientMethodCSFactory,
29
28
  SignalListener: browser_1.BrowserSignalListener,
30
29
  integrationsManagerFactory: settings.integrations && settings.integrations.length > 0 ? pluggable_1.pluggableIntegrationsManagerFactory.bind(null, settings.integrations) : undefined,
31
- impressionsObserverFactory: (0, utils_1.shouldAddPt)(settings) ? impressionObserverCS_1.impressionObserverCSFactory : undefined,
30
+ impressionsObserverFactory: impressionObserverCS_1.impressionObserverCSFactory,
32
31
  extraProps: function (params) {
33
32
  return {
34
33
  UserConsent: (0, sdkUserConsent_1.createUserConsentAPI)(params)
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaults = void 0;
4
4
  var index_1 = require("@splitsoftware/splitio-commons/cjs/logger/index");
5
5
  var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
6
- var packageVersion = '0.8.0';
6
+ var packageVersion = '0.8.1-rc.1';
7
7
  /**
8
8
  * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
9
9
  * Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.settingsValidator = void 0;
3
+ exports.settingsFactory = void 0;
4
4
  var index_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/index");
5
5
  var defaults_1 = require("./defaults");
6
6
  var runtime_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/runtime");
@@ -19,7 +19,7 @@ var params = {
19
19
  localhost: builtin_1.validateLocalhostWithDefault,
20
20
  consent: consent_1.validateConsent,
21
21
  };
22
- function settingsValidator(config) {
22
+ function settingsFactory(config) {
23
23
  return (0, index_1.settingsValidation)(config, params);
24
24
  }
25
- exports.settingsValidator = settingsValidator;
25
+ exports.settingsFactory = settingsFactory;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.settingsValidator = void 0;
3
+ exports.settingsFactory = void 0;
4
4
  var index_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/index");
5
5
  var defaults_1 = require("./defaults");
6
6
  var runtime_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/runtime");
@@ -19,7 +19,7 @@ var params = {
19
19
  localhost: pluggable_2.validateLocalhost,
20
20
  consent: consent_1.validateConsent,
21
21
  };
22
- function settingsValidator(config) {
22
+ function settingsFactory(config) {
23
23
  return (0, index_1.settingsValidation)(config, params);
24
24
  }
25
- exports.settingsValidator = settingsValidator;
25
+ exports.settingsFactory = settingsFactory;
@@ -19,7 +19,7 @@ var platform = { getFetch: getFetchSlim_1.getFetch, getEventSource: getEventSour
19
19
  * @throws Will throw an error if the provided config is invalid.
20
20
  */
21
21
  function SplitFactory(config, __updateModules) {
22
- var settings = (0, settings_1.settingsValidator)(config);
22
+ var settings = (0, settings_1.settingsFactory)(config);
23
23
  var modules = (0, getModules_1.getModules)(settings, platform);
24
24
  if (__updateModules)
25
25
  __updateModules(modules);
@@ -1,4 +1,4 @@
1
- import { settingsValidator } from '../settings/full';
1
+ import { settingsFactory } from '../settings/full';
2
2
  import { getModules } from '../platform/getModules';
3
3
  import { sdkFactory } from '@splitsoftware/splitio-commons/esm/sdkFactory/index';
4
4
  import { getFetch } from '../platform/getFetchFull';
@@ -16,7 +16,7 @@ var platform = { getFetch: getFetch, getEventSource: getEventSource, EventEmitte
16
16
  * @throws Will throw an error if the provided config is invalid.
17
17
  */
18
18
  export function SplitFactory(config, __updateModules) {
19
- var settings = settingsValidator(config);
19
+ var settings = settingsFactory(config);
20
20
  var modules = getModules(settings, platform);
21
21
  if (__updateModules)
22
22
  __updateModules(modules);
@@ -7,7 +7,6 @@ import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/esm/sdk
7
7
  import { BrowserSignalListener } from '@splitsoftware/splitio-commons/esm/listeners/browser';
8
8
  import { impressionObserverCSFactory } from '@splitsoftware/splitio-commons/esm/trackers/impressionObserver/impressionObserverCS';
9
9
  import { pluggableIntegrationsManagerFactory } from '@splitsoftware/splitio-commons/esm/integrations/pluggable';
10
- import { shouldAddPt } from '@splitsoftware/splitio-commons/esm/trackers/impressionObserver/utils';
11
10
  import { CONSUMER_MODE, CONSUMER_PARTIAL_MODE, LOCALHOST_MODE } from '@splitsoftware/splitio-commons/esm/utils/constants';
12
11
  import { createUserConsentAPI } from '@splitsoftware/splitio-commons/esm/consent/sdkUserConsent';
13
12
  var syncManagerStandaloneFactory;
@@ -25,7 +24,7 @@ export function getModules(settings, platform) {
25
24
  sdkClientMethodFactory: sdkClientMethodCSFactory,
26
25
  SignalListener: BrowserSignalListener,
27
26
  integrationsManagerFactory: settings.integrations && settings.integrations.length > 0 ? pluggableIntegrationsManagerFactory.bind(null, settings.integrations) : undefined,
28
- impressionsObserverFactory: shouldAddPt(settings) ? impressionObserverCSFactory : undefined,
27
+ impressionsObserverFactory: impressionObserverCSFactory,
29
28
  extraProps: function (params) {
30
29
  return {
31
30
  UserConsent: createUserConsentAPI(params)
@@ -1,6 +1,6 @@
1
1
  import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/esm/logger/index';
2
2
  import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/esm/utils/constants';
3
- var packageVersion = '0.8.0';
3
+ var packageVersion = '0.8.1-rc.1';
4
4
  /**
5
5
  * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
6
6
  * Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'.
@@ -16,6 +16,6 @@ var params = {
16
16
  localhost: validateLocalhostWithDefault,
17
17
  consent: validateConsent,
18
18
  };
19
- export function settingsValidator(config) {
19
+ export function settingsFactory(config) {
20
20
  return settingsValidation(config, params);
21
21
  }
@@ -16,6 +16,6 @@ var params = {
16
16
  localhost: validateLocalhost,
17
17
  consent: validateConsent,
18
18
  };
19
- export function settingsValidator(config) {
19
+ export function settingsFactory(config) {
20
20
  return settingsValidation(config, params);
21
21
  }
@@ -1,4 +1,4 @@
1
- import { settingsValidator } from './settings';
1
+ import { settingsFactory } from './settings';
2
2
  import { getModules } from './platform/getModules';
3
3
  import { sdkFactory } from '@splitsoftware/splitio-commons/esm/sdkFactory/index';
4
4
  import { getFetch } from './platform/getFetchSlim';
@@ -16,7 +16,7 @@ var platform = { getFetch: getFetch, getEventSource: getEventSource, EventEmitte
16
16
  * @throws Will throw an error if the provided config is invalid.
17
17
  */
18
18
  export function SplitFactory(config, __updateModules) {
19
- var settings = settingsValidator(config);
19
+ var settings = settingsFactory(config);
20
20
  var modules = getModules(settings, platform);
21
21
  if (__updateModules)
22
22
  __updateModules(modules);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio-browserjs",
3
- "version": "0.8.0",
3
+ "version": "0.8.1-rc.1",
4
4
  "description": "Split SDK for Javascript on Browser",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -30,14 +30,14 @@
30
30
  "build:ga-to-split-autorequire": "terser ./node_modules/@splitsoftware/splitio-commons/src/integrations/ga/autoRequire.js --mangle --output ./scripts/ga-to-split-autorequire.js",
31
31
  "test": "npm run test:unit && npm run test:e2e",
32
32
  "test:unit": "jest",
33
- "test:e2e": "npm run test:e2e-logger && npm run test:e2e-offline && npm run test:e2e-online && npm run test:e2e-destroy && npm run test:e2e-errors && npm run test:e2e-push && npm run test:e2e-gaintegration && npm run test:e2e-consumer",
33
+ "test:e2e": "npm run test:e2e-logger && npm run test:e2e-offline && npm run test:e2e-online && npm run test:e2e-destroy && npm run test:e2e-errorCatching && npm run test:e2e-push && npm run test:e2e-gaIntegration && npm run test:e2e-consumer",
34
34
  "test:e2e-logger": "karma start karma/e2e.logger.karma.conf.js",
35
35
  "test:e2e-offline": "karma start karma/e2e.offline.karma.conf.js",
36
36
  "test:e2e-online": "karma start karma/e2e.online.karma.conf.js",
37
37
  "test:e2e-destroy": "karma start karma/e2e.destroy.karma.conf.js",
38
- "test:e2e-errors": "karma start karma/e2e.errors.karma.conf.js",
38
+ "test:e2e-errorCatching": "karma start karma/e2e.errorCatching.karma.conf.js",
39
39
  "test:e2e-push": "karma start karma/e2e.push.karma.conf.js",
40
- "test:e2e-gaintegration": "karma start karma/e2e.gaintegration.karma.conf.js",
40
+ "test:e2e-gaIntegration": "karma start karma/e2e.gaIntegration.karma.conf.js",
41
41
  "test:e2e-consumer": "karma start karma/e2e.consumer.karma.conf.js",
42
42
  "pretest-ts-decls": "npm run build:esm && npm run build:cjs && npm link",
43
43
  "test-ts-decls": "./scripts/ts-tests.sh",
@@ -63,7 +63,7 @@
63
63
  "bugs": "https://github.com/splitio/javascript-browser-client/issues",
64
64
  "homepage": "https://github.com/splitio/javascript-browser-client#readme",
65
65
  "dependencies": {
66
- "@splitsoftware/splitio-commons": "1.6.1",
66
+ "@splitsoftware/splitio-commons": "1.6.2-rc.10",
67
67
  "@types/google.analytics": "0.0.40"
68
68
  },
69
69
  "devDependencies": {
@@ -1,4 +1,4 @@
1
- import { settingsValidator } from '../settings/full';
1
+ import { settingsFactory } from '../settings/full';
2
2
  import { getModules } from '../platform/getModules';
3
3
  import { sdkFactory } from '@splitsoftware/splitio-commons/src/sdkFactory/index';
4
4
  import { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types';
@@ -6,6 +6,7 @@ import { getFetch } from '../platform/getFetchFull';
6
6
  import { getEventSource } from '../platform/getEventSource';
7
7
  import { EventEmitter } from '@splitsoftware/splitio-commons/src/utils/MinEvents';
8
8
  import { now } from '@splitsoftware/splitio-commons/src/utils/timeTracker/now/browser';
9
+ import { IBrowserSettings } from '../../types/splitio';
9
10
 
10
11
  const platform = { getFetch, getEventSource, EventEmitter, now };
11
12
 
@@ -18,8 +19,8 @@ const platform = { getFetch, getEventSource, EventEmitter, now };
18
19
  * caution since, unlike `config`, this param is not validated neither considered part of the public API.
19
20
  * @throws Will throw an error if the provided config is invalid.
20
21
  */
21
- export function SplitFactory(config: any, __updateModules?: (modules: ISdkFactoryParams) => void) {
22
- const settings = settingsValidator(config);
22
+ export function SplitFactory(config: IBrowserSettings, __updateModules?: (modules: ISdkFactoryParams) => void) {
23
+ const settings = settingsFactory(config);
23
24
  const modules = getModules(settings, platform);
24
25
  if (__updateModules) __updateModules(modules);
25
26
  return sdkFactory(modules);
@@ -8,7 +8,6 @@ import { BrowserSignalListener } from '@splitsoftware/splitio-commons/src/listen
8
8
  import { impressionObserverCSFactory } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/impressionObserverCS';
9
9
  import { pluggableIntegrationsManagerFactory } from '@splitsoftware/splitio-commons/src/integrations/pluggable';
10
10
 
11
- import { shouldAddPt } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/utils';
12
11
  import { IPlatform, ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types';
13
12
  import { ISettings } from '@splitsoftware/splitio-commons/src/types';
14
13
  import { CONSUMER_MODE, CONSUMER_PARTIAL_MODE, LOCALHOST_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';
@@ -40,7 +39,7 @@ export function getModules(settings: ISettings, platform: IPlatform): ISdkFactor
40
39
 
41
40
  integrationsManagerFactory: settings.integrations && settings.integrations.length > 0 ? pluggableIntegrationsManagerFactory.bind(null, settings.integrations) : undefined,
42
41
 
43
- impressionsObserverFactory: shouldAddPt(settings) ? impressionObserverCSFactory : undefined,
42
+ impressionsObserverFactory: impressionObserverCSFactory,
44
43
 
45
44
  extraProps: (params) => {
46
45
  return {
@@ -2,7 +2,7 @@ import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/src/
2
2
  import { ConsentStatus, LogLevel } from '@splitsoftware/splitio-commons/src/types';
3
3
  import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/src/utils/constants';
4
4
 
5
- const packageVersion = '0.8.0';
5
+ const packageVersion = '0.8.1-rc.1';
6
6
 
7
7
  /**
8
8
  * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
@@ -18,6 +18,6 @@ const params = {
18
18
  consent: validateConsent,
19
19
  };
20
20
 
21
- export function settingsValidator(config: any) {
21
+ export function settingsFactory(config: any) {
22
22
  return settingsValidation(config, params);
23
23
  }
@@ -18,6 +18,6 @@ const params = {
18
18
  consent: validateConsent,
19
19
  };
20
20
 
21
- export function settingsValidator(config: any) {
21
+ export function settingsFactory(config: any) {
22
22
  return settingsValidation(config, params);
23
23
  }
@@ -1,4 +1,4 @@
1
- import { settingsValidator } from './settings';
1
+ import { settingsFactory } from './settings';
2
2
  import { getModules } from './platform/getModules';
3
3
  import { sdkFactory } from '@splitsoftware/splitio-commons/src/sdkFactory/index';
4
4
  import { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types';
@@ -6,6 +6,7 @@ import { getFetch } from './platform/getFetchSlim';
6
6
  import { getEventSource } from './platform/getEventSource';
7
7
  import { EventEmitter } from '@splitsoftware/splitio-commons/src/utils/MinEvents';
8
8
  import { now } from '@splitsoftware/splitio-commons/src/utils/timeTracker/now/browser';
9
+ import { IBrowserSettings } from '../types/splitio';
9
10
 
10
11
  const platform = { getFetch, getEventSource, EventEmitter, now };
11
12
 
@@ -18,8 +19,8 @@ const platform = { getFetch, getEventSource, EventEmitter, now };
18
19
  * caution since, unlike `config`, this param is not validated neither considered part of the public API.
19
20
  * @throws Will throw an error if the provided config is invalid.
20
21
  */
21
- export function SplitFactory(config: any, __updateModules?: (modules: ISdkFactoryParams) => void) {
22
- const settings = settingsValidator(config);
22
+ export function SplitFactory(config: IBrowserSettings, __updateModules?: (modules: ISdkFactoryParams) => void) {
23
+ const settings = settingsFactory(config);
23
24
  const modules = getModules(settings, platform);
24
25
  if (__updateModules) __updateModules(modules);
25
26
  return sdkFactory(modules);
@@ -91,8 +91,8 @@ interface ISettings {
91
91
  readonly sync: {
92
92
  splitFilters: SplitIO.SplitFilter[],
93
93
  impressionsMode: SplitIO.ImpressionsMode,
94
- localhostMode?: SplitIO.LocalhostFactory,
95
- enabled?: boolean
94
+ enabled: boolean,
95
+ localhostMode?: SplitIO.LocalhostFactory
96
96
  },
97
97
  readonly userConsent: SplitIO.ConsentStatus
98
98
  }
@@ -247,7 +247,7 @@ interface ISharedSettings {
247
247
  * Controls the SDK continuous synchronization flags.
248
248
  *
249
249
  * When `true` a running SDK will process rollout plan updates performed on the UI (default).
250
- * When false it'll just fetch all data upon init
250
+ * When false it'll just fetch all data upon init.
251
251
  *
252
252
  * @property {boolean} enabled
253
253
  * @default true
@@ -809,7 +809,7 @@ declare namespace SplitIO {
809
809
  * ImpressionsMode type
810
810
  * @typedef {string} ImpressionsMode
811
811
  */
812
- type ImpressionsMode = 'OPTIMIZED' | 'DEBUG';
812
+ type ImpressionsMode = 'OPTIMIZED' | 'DEBUG' | 'NONE';
813
813
  /**
814
814
  * User consent status.
815
815
  * @typedef {string} ConsentStatus