@splitsoftware/splitio-browserjs 0.15.0 → 1.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGES.txt CHANGED
@@ -1,3 +1,11 @@
1
+ 1.0.0 (October XX, 2024)
2
+ - Added support for targeting rules based on large segments for browsers.
3
+ - Added `factory.destroy()` method, which invokes the `destroy` method of all clients created by the factory.
4
+ - Updated @splitsoftware/splitio-commons package to version 2.0.0 that includes major updates and updated some transitive dependencies for vulnerability fixes.
5
+ - BREAKING CHANGES:
6
+ - Removed internal ponyfills for the `Map` and `Set` global objects, dropping support for IE and other outdated browsers. The SDK now requires the runtime environment to support these features natively or provide a polyfill.
7
+ - Removed the deprecated `GoogleAnalyticsToSplit` and `SplitToGoogleAnalytics` pluggable integration modules, along with the related interfaces in the TypeScript definitions.
8
+
1
9
  0.15.0 (September 13, 2024)
2
10
  - Updated @splitsoftware/splitio-commons package to version 1.17.0 that includes minor updates:
3
11
  - Added `sync.requestOptions.getHeaderOverrides` configuration option to enhance SDK HTTP request Headers for Authorization Frameworks.
@@ -52,7 +60,7 @@
52
60
  - Updated some transitive dependencies for vulnerability fixes.
53
61
  - Updated @splitsoftware/splitio-commons package to version 1.8.3 that includes:
54
62
  - Updated SDK_READY_TIMED_OUT event to be emitted immediately when a connection error occurs using pluggable storage (i.e., when the wrapper `connect` promise is rejected) in consumer and partial consumer modes.
55
- - Bugfixing - The `destroy` method has been updated to immediately flag the SDK client as destroyed, to prevent unexpected behaviours when `getTreatment` and `track` methods are called synchronously after `destroy` method is called.
63
+ - Bugfixing - The `destroy` method has been updated to immediately flag the SDK client as destroyed, to prevent unexpected behaviors when `getTreatment` and `track` methods are called synchronously after `destroy` method is called.
56
64
 
57
65
  0.9.5 (May 15, 2023)
58
66
  - Updated @splitsoftware/splitio-commons package to version 1.8.2 that includes minor improvements.
package/cjs/full/index.js CHANGED
@@ -1,14 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PluggableStorage = exports.DebugLogger = exports.InfoLogger = exports.WarnLogger = exports.ErrorLogger = exports.SplitToGoogleAnalytics = exports.GoogleAnalyticsToSplit = exports.InLocalStorage = exports.SplitFactory = void 0;
3
+ exports.PluggableStorage = exports.DebugLogger = exports.InfoLogger = exports.WarnLogger = exports.ErrorLogger = exports.InLocalStorage = exports.SplitFactory = void 0;
4
4
  var splitFactory_1 = require("./splitFactory");
5
5
  Object.defineProperty(exports, "SplitFactory", { enumerable: true, get: function () { return splitFactory_1.SplitFactory; } });
6
6
  var index_1 = require("@splitsoftware/splitio-commons/cjs/storages/inLocalStorage/index");
7
7
  Object.defineProperty(exports, "InLocalStorage", { enumerable: true, get: function () { return index_1.InLocalStorage; } });
8
- var GoogleAnalyticsToSplit_1 = require("@splitsoftware/splitio-commons/cjs/integrations/ga/GoogleAnalyticsToSplit");
9
- Object.defineProperty(exports, "GoogleAnalyticsToSplit", { enumerable: true, get: function () { return GoogleAnalyticsToSplit_1.GoogleAnalyticsToSplit; } });
10
- var SplitToGoogleAnalytics_1 = require("@splitsoftware/splitio-commons/cjs/integrations/ga/SplitToGoogleAnalytics");
11
- Object.defineProperty(exports, "SplitToGoogleAnalytics", { enumerable: true, get: function () { return SplitToGoogleAnalytics_1.SplitToGoogleAnalytics; } });
12
8
  var ErrorLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/ErrorLogger");
13
9
  Object.defineProperty(exports, "ErrorLogger", { enumerable: true, get: function () { return ErrorLogger_1.ErrorLogger; } });
14
10
  var WarnLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/WarnLogger");
package/cjs/full/umd.js CHANGED
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  // @ts-nocheck
4
4
  var splitFactory_1 = require("./splitFactory");
5
5
  var index_1 = require("@splitsoftware/splitio-commons/cjs/storages/inLocalStorage/index");
6
- var GoogleAnalyticsToSplit_1 = require("@splitsoftware/splitio-commons/cjs/integrations/ga/GoogleAnalyticsToSplit");
7
- var SplitToGoogleAnalytics_1 = require("@splitsoftware/splitio-commons/cjs/integrations/ga/SplitToGoogleAnalytics");
8
6
  var ErrorLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/ErrorLogger");
9
7
  var WarnLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/WarnLogger");
10
8
  var InfoLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/InfoLogger");
@@ -12,8 +10,6 @@ var DebugLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/D
12
10
  // Include all pluggable modules as properties to expose at the global `splitio` object
13
11
  splitFactory_1.SplitFactory.SplitFactory = splitFactory_1.SplitFactory;
14
12
  splitFactory_1.SplitFactory.InLocalStorage = index_1.InLocalStorage;
15
- splitFactory_1.SplitFactory.GoogleAnalyticsToSplit = GoogleAnalyticsToSplit_1.GoogleAnalyticsToSplit;
16
- splitFactory_1.SplitFactory.SplitToGoogleAnalytics = SplitToGoogleAnalytics_1.SplitToGoogleAnalytics;
17
13
  splitFactory_1.SplitFactory.ErrorLogger = ErrorLogger_1.ErrorLogger;
18
14
  splitFactory_1.SplitFactory.WarnLogger = WarnLogger_1.WarnLogger;
19
15
  splitFactory_1.SplitFactory.InfoLogger = InfoLogger_1.InfoLogger;
package/cjs/index.js CHANGED
@@ -1,14 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PluggableStorage = exports.LocalhostFromObject = exports.DebugLogger = exports.InfoLogger = exports.WarnLogger = exports.ErrorLogger = exports.SplitToGoogleAnalytics = exports.GoogleAnalyticsToSplit = exports.InLocalStorage = exports.SplitFactory = void 0;
3
+ exports.PluggableStorage = exports.LocalhostFromObject = exports.DebugLogger = exports.InfoLogger = exports.WarnLogger = exports.ErrorLogger = exports.InLocalStorage = exports.SplitFactory = void 0;
4
4
  var splitFactory_1 = require("./splitFactory");
5
5
  Object.defineProperty(exports, "SplitFactory", { enumerable: true, get: function () { return splitFactory_1.SplitFactory; } });
6
6
  var index_1 = require("@splitsoftware/splitio-commons/cjs/storages/inLocalStorage/index");
7
7
  Object.defineProperty(exports, "InLocalStorage", { enumerable: true, get: function () { return index_1.InLocalStorage; } });
8
- var GoogleAnalyticsToSplit_1 = require("@splitsoftware/splitio-commons/cjs/integrations/ga/GoogleAnalyticsToSplit");
9
- Object.defineProperty(exports, "GoogleAnalyticsToSplit", { enumerable: true, get: function () { return GoogleAnalyticsToSplit_1.GoogleAnalyticsToSplit; } });
10
- var SplitToGoogleAnalytics_1 = require("@splitsoftware/splitio-commons/cjs/integrations/ga/SplitToGoogleAnalytics");
11
- Object.defineProperty(exports, "SplitToGoogleAnalytics", { enumerable: true, get: function () { return SplitToGoogleAnalytics_1.SplitToGoogleAnalytics; } });
12
8
  var ErrorLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/ErrorLogger");
13
9
  Object.defineProperty(exports, "ErrorLogger", { enumerable: true, get: function () { return ErrorLogger_1.ErrorLogger; } });
14
10
  var WarnLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/WarnLogger");
@@ -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.15.0';
6
+ var packageVersion = '1.0.0-rc.0';
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'.
@@ -28,7 +28,7 @@ exports.defaults = {
28
28
  // Maximum amount of time used before notifies me a timeout.
29
29
  readyTimeout: 10,
30
30
  // Amount of time we will wait before the first push of events.
31
- eventsFirstPushWindow: 10
31
+ eventsFirstPushWindow: 10,
32
32
  },
33
33
  // Consent is considered granted by default
34
34
  userConsent: constants_1.CONSENT_GRANTED,
@@ -9,6 +9,7 @@ var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsVali
9
9
  var pluggableLogger_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/logger/pluggableLogger");
10
10
  var builtin_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/localhost/builtin");
11
11
  var consent_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/consent");
12
+ var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
12
13
  var params = {
13
14
  defaults: defaults_1.defaults,
14
15
  acceptKey: true,
@@ -20,6 +21,10 @@ var params = {
20
21
  consent: consent_1.validateConsent,
21
22
  };
22
23
  function settingsFactory(config) {
23
- return (0, index_1.settingsValidation)(config, params);
24
+ var settings = (0, index_1.settingsValidation)(config, params);
25
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
26
+ if (settings.mode !== constants_1.STANDALONE_MODE)
27
+ settings.sync.largeSegmentsEnabled = false;
28
+ return settings;
24
29
  }
25
30
  exports.settingsFactory = settingsFactory;
@@ -9,6 +9,7 @@ var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsVali
9
9
  var pluggableLogger_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/logger/pluggableLogger");
10
10
  var pluggable_2 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/localhost/pluggable");
11
11
  var consent_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/consent");
12
+ var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
12
13
  var params = {
13
14
  defaults: defaults_1.defaults,
14
15
  acceptKey: true,
@@ -20,6 +21,10 @@ var params = {
20
21
  consent: consent_1.validateConsent,
21
22
  };
22
23
  function settingsFactory(config) {
23
- return (0, index_1.settingsValidation)(config, params);
24
+ var settings = (0, index_1.settingsValidation)(config, params);
25
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
26
+ if (settings.mode !== constants_1.STANDALONE_MODE)
27
+ settings.sync.largeSegmentsEnabled = false;
28
+ return settings;
24
29
  }
25
30
  exports.settingsFactory = settingsFactory;
package/esm/full/index.js CHANGED
@@ -1,7 +1,5 @@
1
1
  export { SplitFactory } from './splitFactory';
2
2
  export { InLocalStorage } from '@splitsoftware/splitio-commons/esm/storages/inLocalStorage/index';
3
- export { GoogleAnalyticsToSplit } from '@splitsoftware/splitio-commons/esm/integrations/ga/GoogleAnalyticsToSplit';
4
- export { SplitToGoogleAnalytics } from '@splitsoftware/splitio-commons/esm/integrations/ga/SplitToGoogleAnalytics';
5
3
  export { ErrorLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/ErrorLogger';
6
4
  export { WarnLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/WarnLogger';
7
5
  export { InfoLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/InfoLogger';
package/esm/full/umd.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // @ts-nocheck
2
2
  import { SplitFactory } from './splitFactory';
3
3
  import { InLocalStorage } from '@splitsoftware/splitio-commons/esm/storages/inLocalStorage/index';
4
- import { GoogleAnalyticsToSplit } from '@splitsoftware/splitio-commons/esm/integrations/ga/GoogleAnalyticsToSplit';
5
- import { SplitToGoogleAnalytics } from '@splitsoftware/splitio-commons/esm/integrations/ga/SplitToGoogleAnalytics';
6
4
  import { ErrorLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/ErrorLogger';
7
5
  import { WarnLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/WarnLogger';
8
6
  import { InfoLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/InfoLogger';
@@ -10,8 +8,6 @@ import { DebugLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/D
10
8
  // Include all pluggable modules as properties to expose at the global `splitio` object
11
9
  SplitFactory.SplitFactory = SplitFactory;
12
10
  SplitFactory.InLocalStorage = InLocalStorage;
13
- SplitFactory.GoogleAnalyticsToSplit = GoogleAnalyticsToSplit;
14
- SplitFactory.SplitToGoogleAnalytics = SplitToGoogleAnalytics;
15
11
  SplitFactory.ErrorLogger = ErrorLogger;
16
12
  SplitFactory.WarnLogger = WarnLogger;
17
13
  SplitFactory.InfoLogger = InfoLogger;
package/esm/index.js CHANGED
@@ -1,7 +1,5 @@
1
1
  export { SplitFactory } from './splitFactory';
2
2
  export { InLocalStorage } from '@splitsoftware/splitio-commons/esm/storages/inLocalStorage/index';
3
- export { GoogleAnalyticsToSplit } from '@splitsoftware/splitio-commons/esm/integrations/ga/GoogleAnalyticsToSplit';
4
- export { SplitToGoogleAnalytics } from '@splitsoftware/splitio-commons/esm/integrations/ga/SplitToGoogleAnalytics';
5
3
  export { ErrorLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/ErrorLogger';
6
4
  export { WarnLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/WarnLogger';
7
5
  export { InfoLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/InfoLogger';
@@ -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.15.0';
3
+ var packageVersion = '1.0.0-rc.0';
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'.
@@ -25,7 +25,7 @@ export var defaults = {
25
25
  // Maximum amount of time used before notifies me a timeout.
26
26
  readyTimeout: 10,
27
27
  // Amount of time we will wait before the first push of events.
28
- eventsFirstPushWindow: 10
28
+ eventsFirstPushWindow: 10,
29
29
  },
30
30
  // Consent is considered granted by default
31
31
  userConsent: CONSENT_GRANTED,
@@ -6,6 +6,7 @@ import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/es
6
6
  import { validateLogger } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/logger/pluggableLogger';
7
7
  import { validateLocalhostWithDefault } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/localhost/builtin';
8
8
  import { validateConsent } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/consent';
9
+ import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/esm/utils/constants';
9
10
  var params = {
10
11
  defaults: defaults,
11
12
  acceptKey: true,
@@ -17,5 +18,9 @@ var params = {
17
18
  consent: validateConsent,
18
19
  };
19
20
  export function settingsFactory(config) {
20
- return settingsValidation(config, params);
21
+ var settings = settingsValidation(config, params);
22
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
23
+ if (settings.mode !== STANDALONE_MODE)
24
+ settings.sync.largeSegmentsEnabled = false;
25
+ return settings;
21
26
  }
@@ -6,6 +6,7 @@ import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/es
6
6
  import { validateLogger } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/logger/pluggableLogger';
7
7
  import { validateLocalhost } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/localhost/pluggable';
8
8
  import { validateConsent } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/consent';
9
+ import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/esm/utils/constants';
9
10
  var params = {
10
11
  defaults: defaults,
11
12
  acceptKey: true,
@@ -17,5 +18,9 @@ var params = {
17
18
  consent: validateConsent,
18
19
  };
19
20
  export function settingsFactory(config) {
20
- return settingsValidation(config, params);
21
+ var settings = settingsValidation(config, params);
22
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
23
+ if (settings.mode !== STANDALONE_MODE)
24
+ settings.sync.largeSegmentsEnabled = false;
25
+ return settings;
21
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio-browserjs",
3
- "version": "0.15.0",
3
+ "version": "1.0.0-rc.0",
4
4
  "description": "Split SDK for JavaScript on Browser",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -14,8 +14,7 @@
14
14
  "esm",
15
15
  "src",
16
16
  "types",
17
- "full",
18
- "scripts/ga-to-split-autorequire.js"
17
+ "full"
19
18
  ],
20
19
  "scripts": {
21
20
  "check": "npm run check:lint && npm run check:types && npm run check:version",
@@ -27,7 +26,6 @@
27
26
  "build:cjs": "rimraf cjs && tsc -outDir cjs -m CommonJS && ./scripts/build_cjs_replace_imports.sh",
28
27
  "build:umd-visualizer": "rimraf umd && rollup --config rollup.visualizer.config.js",
29
28
  "build:umd": "rimraf umd && rollup --config rollup.ci.config.js --branch=$BUILD_BRANCH",
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
29
  "test": "npm run test:unit && npm run test:e2e",
32
30
  "test:unit": "jest",
33
31
  "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-consumer",
@@ -37,7 +35,6 @@
37
35
  "test:e2e-destroy": "karma start karma/e2e.destroy.karma.conf.js",
38
36
  "test:e2e-errorCatching": "karma start karma/e2e.errorCatching.karma.conf.js",
39
37
  "test:e2e-push": "karma start karma/e2e.push.karma.conf.js",
40
- "test:e2e-gaIntegration": "karma start karma/e2e.gaIntegration.karma.conf.js",
41
38
  "test:e2e-consumer": "karma start karma/e2e.consumer.karma.conf.js",
42
39
  "pretest-ts-decls": "npm run build:esm && npm run build:cjs && npm link",
43
40
  "test-ts-decls": "./scripts/ts-tests.sh",
@@ -64,8 +61,7 @@
64
61
  "bugs": "https://github.com/splitio/javascript-browser-client/issues",
65
62
  "homepage": "https://github.com/splitio/javascript-browser-client#readme",
66
63
  "dependencies": {
67
- "@splitsoftware/splitio-commons": "1.17.0",
68
- "@types/google.analytics": "0.0.40",
64
+ "@splitsoftware/splitio-commons": "2.0.0-rc.2",
69
65
  "tslib": "^2.3.1",
70
66
  "unfetch": "^4.2.0"
71
67
  },
package/src/full/index.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  export { SplitFactory } from './splitFactory';
2
2
  export { InLocalStorage } from '@splitsoftware/splitio-commons/src/storages/inLocalStorage/index';
3
- export { GoogleAnalyticsToSplit } from '@splitsoftware/splitio-commons/src/integrations/ga/GoogleAnalyticsToSplit';
4
- export { SplitToGoogleAnalytics } from '@splitsoftware/splitio-commons/src/integrations/ga/SplitToGoogleAnalytics';
5
3
  export { ErrorLogger } from '@splitsoftware/splitio-commons/src/logger/browser/ErrorLogger';
6
4
  export { WarnLogger } from '@splitsoftware/splitio-commons/src/logger/browser/WarnLogger';
7
5
  export { InfoLogger } from '@splitsoftware/splitio-commons/src/logger/browser/InfoLogger';
package/src/full/umd.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  // @ts-nocheck
2
2
  import { SplitFactory } from './splitFactory';
3
3
  import { InLocalStorage } from '@splitsoftware/splitio-commons/src/storages/inLocalStorage/index';
4
- import { GoogleAnalyticsToSplit } from '@splitsoftware/splitio-commons/src/integrations/ga/GoogleAnalyticsToSplit';
5
- import { SplitToGoogleAnalytics } from '@splitsoftware/splitio-commons/src/integrations/ga/SplitToGoogleAnalytics';
6
4
  import { ErrorLogger } from '@splitsoftware/splitio-commons/src/logger/browser/ErrorLogger';
7
5
  import { WarnLogger } from '@splitsoftware/splitio-commons/src/logger/browser/WarnLogger';
8
6
  import { InfoLogger } from '@splitsoftware/splitio-commons/src/logger/browser/InfoLogger';
@@ -11,8 +9,6 @@ import { DebugLogger } from '@splitsoftware/splitio-commons/src/logger/browser/D
11
9
  // Include all pluggable modules as properties to expose at the global `splitio` object
12
10
  SplitFactory.SplitFactory = SplitFactory;
13
11
  SplitFactory.InLocalStorage = InLocalStorage;
14
- SplitFactory.GoogleAnalyticsToSplit = GoogleAnalyticsToSplit;
15
- SplitFactory.SplitToGoogleAnalytics = SplitToGoogleAnalytics;
16
12
  SplitFactory.ErrorLogger = ErrorLogger;
17
13
  SplitFactory.WarnLogger = WarnLogger;
18
14
  SplitFactory.InfoLogger = InfoLogger;
package/src/index.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  export { SplitFactory } from './splitFactory';
2
2
  export { InLocalStorage } from '@splitsoftware/splitio-commons/src/storages/inLocalStorage/index';
3
- export { GoogleAnalyticsToSplit } from '@splitsoftware/splitio-commons/src/integrations/ga/GoogleAnalyticsToSplit';
4
- export { SplitToGoogleAnalytics } from '@splitsoftware/splitio-commons/src/integrations/ga/SplitToGoogleAnalytics';
5
3
  export { ErrorLogger } from '@splitsoftware/splitio-commons/src/logger/browser/ErrorLogger';
6
4
  export { WarnLogger } from '@splitsoftware/splitio-commons/src/logger/browser/WarnLogger';
7
5
  export { InfoLogger } from '@splitsoftware/splitio-commons/src/logger/browser/InfoLogger';
@@ -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.15.0';
5
+ const packageVersion = '1.0.0-rc.0';
6
6
 
7
7
  /**
8
8
  * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
@@ -30,7 +30,7 @@ export const defaults = {
30
30
  // Maximum amount of time used before notifies me a timeout.
31
31
  readyTimeout: 10,
32
32
  // Amount of time we will wait before the first push of events.
33
- eventsFirstPushWindow: 10
33
+ eventsFirstPushWindow: 10,
34
34
  },
35
35
 
36
36
  // Consent is considered granted by default
@@ -6,6 +6,7 @@ import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/sr
6
6
  import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/pluggableLogger';
7
7
  import { validateLocalhostWithDefault } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/localhost/builtin';
8
8
  import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/consent';
9
+ import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';
9
10
 
10
11
  const params = {
11
12
  defaults,
@@ -19,5 +20,10 @@ const params = {
19
20
  };
20
21
 
21
22
  export function settingsFactory(config: any) {
22
- return settingsValidation(config, params);
23
+ const settings = settingsValidation(config, params);
24
+
25
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
26
+ if (settings.mode !== STANDALONE_MODE) settings.sync.largeSegmentsEnabled = false;
27
+
28
+ return settings;
23
29
  }
@@ -6,6 +6,7 @@ import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/sr
6
6
  import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/pluggableLogger';
7
7
  import { validateLocalhost } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/localhost/pluggable';
8
8
  import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/consent';
9
+ import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';
9
10
 
10
11
  const params = {
11
12
  defaults,
@@ -19,5 +20,10 @@ const params = {
19
20
  };
20
21
 
21
22
  export function settingsFactory(config: any) {
22
- return settingsValidation(config, params);
23
+ const settings = settingsValidation(config, params);
24
+
25
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
26
+ if (settings.mode !== STANDALONE_MODE) settings.sync.largeSegmentsEnabled = false;
27
+
28
+ return settings;
23
29
  }
@@ -7,7 +7,7 @@ export = JsSdk;
7
7
 
8
8
  declare module JsSdk {
9
9
  /**
10
- * Full version of the Split.io sdk factory function.
10
+ * Full version of the Split.io SDK factory function.
11
11
  *
12
12
  * Unlike the slim version, it doesn't require a 'fetch' polyfill to support old browsers @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#language-support}.
13
13
  * and includes localhost mode out-of-the-box @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode}.
@@ -32,20 +32,6 @@ declare module JsSdk {
32
32
  */
33
33
  export function PluggableStorage(options: SplitIO.PluggableStorageOptions): SplitIO.StorageAsyncFactory;
34
34
 
35
- /**
36
- * Enable 'Google Analytics to Split' integration, to track Google Analytics hits as Split events.
37
- *
38
- * @see {@link https://help.split.io/hc/en-us/articles/360040838752#google-analytics-to-split}
39
- */
40
- export function GoogleAnalyticsToSplit(options?: SplitIO.GoogleAnalyticsToSplitOptions): SplitIO.IntegrationFactory;
41
-
42
- /**
43
- * Enable 'Split to Google Analytics' integration, to track Split impressions and events as Google Analytics hits.
44
- *
45
- * @see {@link https://help.split.io/hc/en-us/articles/360040838752#split-to-google-analytics}
46
- */
47
- export function SplitToGoogleAnalytics(options?: SplitIO.SplitToGoogleAnalyticsOptions): SplitIO.IntegrationFactory;
48
-
49
35
  /**
50
36
  * Creates a logger instance that enables descriptive log messages with DEBUG log level when passed in the factory settings.
51
37
  *
package/types/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export = JsSdk;
7
7
 
8
8
  declare module JsSdk {
9
9
  /**
10
- * Slim version of the Split.io sdk factory function.
10
+ * Slim version of the Split.io SDK factory function.
11
11
  *
12
12
  * Recommended to use for bundle size reduction in production, since it doesn't include a 'fetch' polyfill and localhost mode out-of-the-box
13
13
  * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode}.
@@ -32,20 +32,6 @@ declare module JsSdk {
32
32
  */
33
33
  export function PluggableStorage(options: SplitIO.PluggableStorageOptions): SplitIO.StorageAsyncFactory;
34
34
 
35
- /**
36
- * Enable 'Google Analytics to Split' integration, to track Google Analytics hits as Split events.
37
- *
38
- * @see {@link https://help.split.io/hc/en-us/articles/360040838752#google-analytics-to-split}
39
- */
40
- export function GoogleAnalyticsToSplit(options?: SplitIO.GoogleAnalyticsToSplitOptions): SplitIO.IntegrationFactory;
41
-
42
- /**
43
- * Enable 'Split to Google Analytics' integration, to track Split impressions and events as Google Analytics hits.
44
- *
45
- * @see {@link https://help.split.io/hc/en-us/articles/360040838752#split-to-google-analytics}
46
- */
47
- export function SplitToGoogleAnalytics(options?: SplitIO.SplitToGoogleAnalyticsOptions): SplitIO.IntegrationFactory;
48
-
49
35
  /**
50
36
  * Creates a logger instance that enables descriptive log messages with DEBUG log level when passed in the factory settings.
51
37
  *
@@ -2,8 +2,6 @@
2
2
  // Project: http://www.split.io/
3
3
  // Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>
4
4
 
5
- /// <reference types="google.analytics" />
6
-
7
5
  export as namespace SplitIO;
8
6
  export = SplitIO;
9
7
 
@@ -232,7 +230,7 @@ interface ISharedSettings {
232
230
  *
233
231
  * NOTE: this is only required if using the slim entry point of the library to init the SDK in localhost mode.
234
232
  *
235
- * For more information @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode}
233
+ * For more information see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode}
236
234
  *
237
235
  * Example:
238
236
  * ```typescript
@@ -302,9 +300,8 @@ interface IStatusInterface extends IEventEmitter {
302
300
  */
303
301
  Event: EventConsts,
304
302
  /**
305
- * Returns a promise that resolves once the SDK has finished loading (SDK_READY event emitted) or rejected if the SDK has timedout (SDK_READY_TIMED_OUT event emitted).
306
- * As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event, calling the `ready` method after the
307
- * SDK had timed out will return a new promise that should eventually resolve if the SDK gets ready.
303
+ * Returns a promise that resolves once the SDK has finished loading (`SDK_READY` event emitted) or rejected if the SDK has timedout (`SDK_READY_TIMED_OUT` event emitted).
304
+ * As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event, the `ready` method will return a resolved promise once the SDK is ready.
308
305
  *
309
306
  * Caveats: the method was designed to avoid an unhandled Promise rejection if the rejection case is not handled, so that `onRejected` handler is optional when using promises.
310
307
  * However, when using async/await syntax, the rejection should be explicitly propagated like in the following example:
@@ -359,13 +356,18 @@ interface IBasicSDK {
359
356
  * User consent API.
360
357
  * @property UserConsent
361
358
  */
362
- UserConsent: IUserConsentAPI
359
+ UserConsent: IUserConsentAPI,
360
+ /**
361
+ * Destroys all the clients created by this factory.
362
+ * @function destroy
363
+ * @returns {Promise<void>}
364
+ */
365
+ destroy(): Promise<void>
363
366
  }
364
367
  /****** Exposed namespace ******/
365
368
  /**
366
369
  * Types and interfaces for @splitsoftware/splitio-browserjs package for usage when integrating javascript browser sdk on typescript apps.
367
- * For the SDK package information
368
- * @see {@link https://www.npmjs.com/package/@splitsoftware/splitio-browserjs}
370
+ * For the SDK package information see {@link https://www.npmjs.com/package/@splitsoftware/splitio-browserjs}
369
371
  */
370
372
  declare namespace SplitIO {
371
373
  /**
@@ -675,62 +677,6 @@ declare namespace SplitIO {
675
677
  key?: string;
676
678
  timestamp?: number;
677
679
  };
678
- /**
679
- * Configuration params for 'Google Analytics to Split' integration plugin, to track Google Analytics hits as Split events.
680
- *
681
- * @see {@link https://help.split.io/hc/en-us/articles/360040838752#google-analytics-to-split}
682
- */
683
- interface GoogleAnalyticsToSplitOptions {
684
- /**
685
- * Optional flag to filter GA hits from being tracked as Split events.
686
- * @property {boolean} hits
687
- * @default true
688
- */
689
- hits?: boolean,
690
- /**
691
- * Optional predicate used to define a custom filter for tracking GA hits as Split events.
692
- * For example, the following filter allows to track only 'event' hits:
693
- * `(model) => model.get('hitType') === 'event'`
694
- * By default, all hits are tracked as Split events.
695
- */
696
- filter?: (model: UniversalAnalytics.Model) => boolean,
697
- /**
698
- * Optional function useful when you need to modify the Split event before tracking it.
699
- * This function is invoked with two arguments:
700
- * 1. the GA model object representing the hit.
701
- * 2. the default format of the mapped Split event instance.
702
- * The return value must be a Split event, that can be the second argument or a new object.
703
- *
704
- * For example, the following mapper adds a custom property to events:
705
- * `(model, defaultMapping) => {
706
- * defaultMapping.properties.someProperty = SOME_VALUE;
707
- * return defaultMapping;
708
- * }`
709
- */
710
- mapper?: (model: UniversalAnalytics.Model, defaultMapping: SplitIO.EventData) => SplitIO.EventData,
711
- /**
712
- * Optional prefix for EventTypeId, to prevent any kind of data collision between events.
713
- * @property {string} prefix
714
- * @default 'ga'
715
- */
716
- prefix?: string,
717
- /**
718
- * List of Split identities (key & traffic type pairs) used to track events.
719
- * If not provided, events are sent using the key and traffic type provided at SDK config.
720
- */
721
- identities: Identity[],
722
- /**
723
- * Optional flag to log an error if the `auto-require` script is not detected.
724
- * The auto-require script automatically requires the `splitTracker` plugin for created trackers,
725
- * and should be placed right after your Google Analytics, Google Tag Manager or gtag.js script tag.
726
- *
727
- * @see {@link https://help.split.io/hc/en-us/articles/360040838752#set-up-with-gtm-and-gtag.js}
728
- *
729
- * @property {boolean} autoRequire
730
- * @default false
731
- */
732
- autoRequire?: boolean,
733
- }
734
680
  /**
735
681
  * Object representing the data sent by Split (events and impressions).
736
682
  * @typedef {Object} IntegrationData
@@ -738,67 +684,6 @@ declare namespace SplitIO {
738
684
  * @property {ImpressionData | EventData} payload The data instance itself.
739
685
  */
740
686
  type IntegrationData = { type: 'IMPRESSION', payload: SplitIO.ImpressionData } | { type: 'EVENT', payload: SplitIO.EventData };
741
- /**
742
- * Configuration params for 'Split to Google Analytics' integration plugin, to track Split impressions and events as Google Analytics hits.
743
- *
744
- * @see {@link https://help.split.io/hc/en-us/articles/360040838752#split-to-google-analytics}
745
- */
746
- interface SplitToGoogleAnalyticsOptions {
747
- /**
748
- * Optional flag to filter Split impressions from being tracked as GA hits.
749
- * @property {boolean} impressions
750
- * @default true
751
- */
752
- impressions?: boolean,
753
- /**
754
- * Optional flag to filter Split events from being tracked as GA hits.
755
- * @property {boolean} events
756
- * @default true
757
- */
758
- events?: boolean,
759
- /**
760
- * Optional predicate used to define a custom filter for tracking Split data (events and impressions) as GA hits.
761
- * For example, the following filter allows to track only impressions, equivalent to setting events to false:
762
- * `(data) => data.type === 'IMPRESSION'`
763
- */
764
- filter?: (data: SplitIO.IntegrationData) => boolean,
765
- /**
766
- * Optional function useful when you need to modify the GA hit before sending it.
767
- * This function is invoked with two arguments:
768
- * 1. the input data (Split event or impression).
769
- * 2. the default format of the mapped FieldsObject instance (GA hit).
770
- * The return value must be a FieldsObject, that can be the second argument or a new object.
771
- *
772
- * For example, the following mapper adds a custom dimension to hits:
773
- * `(data, defaultMapping) => {
774
- * defaultMapping.dimension1 = SOME_VALUE;
775
- * return defaultMapping;
776
- * }`
777
- *
778
- * Default FieldsObject instance for data.type === 'IMPRESSION':
779
- * `{
780
- * hitType: 'event',
781
- * eventCategory: 'split-impression',
782
- * eventAction: 'Evaluate ' + data.payload.impression.feature,
783
- * eventLabel: 'Treatment: ' + data.payload.impression.treatment + '. Targeting rule: ' + data.payload.impression.label + '.',
784
- * nonInteraction: true,
785
- * }`
786
- * Default FieldsObject instance for data.type === 'EVENT':
787
- * `{
788
- * hitType: 'event',
789
- * eventCategory: 'split-event',
790
- * eventAction: data.payload.eventTypeId,
791
- * eventValue: data.payload.value,
792
- * nonInteraction: true,
793
- * }`
794
- */
795
- mapper?: (data: SplitIO.IntegrationData, defaultMapping: UniversalAnalytics.FieldsObject) => UniversalAnalytics.FieldsObject,
796
- /**
797
- * List of tracker names to send the hit. An empty string represents the default tracker.
798
- * If not provided, hits are only sent to default tracker.
799
- */
800
- trackerNames?: string[],
801
- }
802
687
  /**
803
688
  * Available URL settings for the SDKs.
804
689
  */
@@ -888,12 +773,14 @@ declare namespace SplitIO {
888
773
  */
889
774
  core: {
890
775
  /**
891
- * Your SDK key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
776
+ * Your SDK key.
777
+ * @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
892
778
  * @property {string} authorizationKey
893
779
  */
894
780
  authorizationKey: string,
895
781
  /**
896
- * Customer identifier. Whatever this means to you. @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
782
+ * Customer identifier. Whatever this means to you.
783
+ * @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
897
784
  * @property {SplitKey} key
898
785
  */
899
786
  key: SplitKey,
@@ -913,13 +800,8 @@ declare namespace SplitIO {
913
800
  /**
914
801
  * Defines an optional list of factory functions used to instantiate SDK integrations.
915
802
  *
916
- * Example:
917
- * ```typescript
918
- * SplitFactory({
919
- * ...
920
- * integrations: [SplitToGoogleAnalytics(), GoogleAnalyticsToSplit()]
921
- * })
922
- * ```
803
+ * NOTE: at the moment there are not integrations to plug in Browser SDK.
804
+ *
923
805
  * @property {Object} integrations
924
806
  */
925
807
  integrations?: IntegrationFactory[],
@@ -951,7 +833,7 @@ declare namespace SplitIO {
951
833
  */
952
834
  mode?: 'standalone',
953
835
  /**
954
- * Mocked features map. For testing purposses only. For using this you should specify "localhost" as authorizationKey on core settings.
836
+ * Mocked features map. For testing purposes only. For using this you should specify "localhost" as authorizationKey on core settings.
955
837
  * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode}
956
838
  */
957
839
  features?: MockedFeaturesMap,
@@ -1051,7 +933,7 @@ declare namespace SplitIO {
1051
933
  eventsQueueSize?: number,
1052
934
  /**
1053
935
  * For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
1054
- * For more information @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode}
936
+ * For more information see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode}
1055
937
  * @property {number} offlineRefreshRate
1056
938
  * @default 15
1057
939
  */
@@ -1 +0,0 @@
1
- (function(n,t,e){n[e]=n[e]||t;n[t]=n[t]||function(){n[t].q.push(arguments)};n[t].q=n[t].q||[];var r={};function i(n){return typeof n==="object"&&typeof n.name==="string"&&n.name}function o(e){if(e&&e[0]==="create"){var o=i(e[1])||i(e[2])||i(e[3])||(typeof e[3]==="string"?e[3]:undefined);if(!r[o]){r[o]=true;n[t]((o?o+".":"")+"require","splitTracker")}}}n[t].q.forEach(o);var u=n[t].q.push;n[t].q.push=function(n){var t=u.apply(this,arguments);o(n);return t}})(window,"ga","GoogleAnalyticsObject");