@splitsoftware/splitio-browserjs 0.1.1-canary.1 → 0.2.1-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 +10 -3
- package/README.md +2 -1
- package/cjs/{slim → full}/index.js +7 -8
- package/cjs/{slim → full}/splitFactory.js +10 -5
- package/cjs/index.js +17 -8
- package/cjs/platform/{getFetch.js → getFetchFull.js} +0 -0
- package/cjs/platform/{getFetchMin.js → getFetchSlim.js} +0 -0
- package/cjs/platform/getModules.js +26 -18
- package/cjs/settings/defaults.js +1 -1
- package/cjs/settings/{slim.js → full.js} +4 -1
- package/cjs/settings/index.js +5 -2
- package/cjs/splitFactory.js +9 -3
- package/esm/{slim → full}/index.js +3 -2
- package/esm/{slim → full}/splitFactory.js +8 -4
- package/esm/index.js +8 -2
- package/esm/platform/{getFetch.js → getFetchFull.js} +0 -0
- package/esm/platform/{getFetchMin.js → getFetchSlim.js} +0 -0
- package/esm/platform/getModules.js +26 -18
- package/esm/settings/defaults.js +1 -1
- package/esm/settings/{slim.js → full.js} +4 -1
- package/esm/settings/index.js +5 -2
- package/esm/splitFactory.js +8 -3
- package/full/package.json +6 -0
- package/package.json +12 -10
- package/src/{slim → full}/index.ts +3 -2
- package/src/{slim → full}/splitFactory.ts +9 -4
- package/src/full/umd.ts +14 -0
- package/src/index.ts +8 -2
- package/src/platform/{getFetch.ts → getFetchFull.ts} +0 -0
- package/src/platform/{getFetchMin.ts → getFetchSlim.ts} +0 -0
- package/src/platform/getModules.ts +28 -21
- package/src/settings/defaults.ts +1 -1
- package/src/settings/{slim.ts → full.ts} +4 -1
- package/src/settings/index.ts +5 -2
- package/src/splitFactory.ts +9 -3
- package/src/umd.ts +0 -15
- package/types/{slim → full}/index.d.ts +13 -5
- package/types/index.d.ts +51 -2
- package/types/splitio.d.ts +339 -75
- package/cjs/platform/getModulesSlim.js +0 -39
- package/esm/platform/getModulesSlim.js +0 -34
- package/slim/package.json +0 -6
- package/src/platform/getModulesSlim.ts +0 -52
- package/src/slim/umd.ts +0 -6
package/CHANGES.txt
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
0.
|
|
2
|
-
-
|
|
3
|
-
- Updated
|
|
1
|
+
0.2.0 (October 20, 2021)
|
|
2
|
+
- Added localhost mode support (Read more in our docs here: https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode).
|
|
3
|
+
- Updated @splitsoftware/splitio-commons dependency to version 1.0.0, which includes:
|
|
4
|
+
- Updated localhost mode to emit SDK_READY_FROM_CACHE event in Browser when using localStorage (Related to issue https://github.com/splitio/react-client/issues/34).
|
|
5
|
+
- Updated streaming logic to use the newest version of our streaming service, including:
|
|
6
|
+
- Integration with Auth service V2, connecting to the new channels and applying the received connection delay.
|
|
7
|
+
- Implemented handling of the new MySegmentsV2 notification types (SegmentRemoval, KeyList, Bounded and Unbounded)
|
|
8
|
+
- New control notification for environment scoped streaming reset.
|
|
9
|
+
- Fix of some log messages typos, among other improvements.
|
|
10
|
+
- Updated some NPM dependencies for vulnerability fixes.
|
|
4
11
|
|
|
5
12
|
0.1.0 (March 30, 2021)
|
|
6
13
|
- Initial public release. Check the official documentation for details: https://help.split.io/hc/en-us/articles/360058730852
|
package/README.md
CHANGED
|
@@ -67,11 +67,12 @@ Split has built and maintains SDKs for:
|
|
|
67
67
|
* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
|
|
68
68
|
* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
|
|
69
69
|
* Javascript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
|
|
70
|
+
* Javascript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK)
|
|
70
71
|
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
|
|
71
|
-
* Javascript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852)
|
|
72
72
|
* PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
|
|
73
73
|
* Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)
|
|
74
74
|
* React [Github](https://github.com/splitio/react-client) [Docs](https://help.split.io/hc/en-us/articles/360038825091-React-SDK)
|
|
75
|
+
* React Native [Github](https://github.com/splitio/react-native-client) [Docs](https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK)
|
|
75
76
|
* Redux [Github](https://github.com/splitio/redux-client) [Docs](https://help.split.io/hc/en-us/articles/360038851551-Redux-SDK)
|
|
76
77
|
* Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK)
|
|
77
78
|
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
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.SplitToGoogleAnalytics = exports.GoogleAnalyticsToSplit = exports.InLocalStorage = exports.SplitFactory = void 0;
|
|
7
4
|
var splitFactory_1 = require("./splitFactory");
|
|
8
5
|
Object.defineProperty(exports, "SplitFactory", { enumerable: true, get: function () { return splitFactory_1.SplitFactory; } });
|
|
9
6
|
var index_1 = require("@splitsoftware/splitio-commons/cjs/storages/inLocalStorage/index");
|
|
10
7
|
Object.defineProperty(exports, "InLocalStorage", { enumerable: true, get: function () { return index_1.InLocalStorage; } });
|
|
11
|
-
var
|
|
12
|
-
Object.defineProperty(exports, "GoogleAnalyticsToSplit", { enumerable: true, get: function () { return
|
|
13
|
-
var
|
|
14
|
-
Object.defineProperty(exports, "SplitToGoogleAnalytics", { enumerable: true, get: function () { return
|
|
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; } });
|
|
15
12
|
var ErrorLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/ErrorLogger");
|
|
16
13
|
Object.defineProperty(exports, "ErrorLogger", { enumerable: true, get: function () { return ErrorLogger_1.ErrorLogger; } });
|
|
17
14
|
var WarnLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/WarnLogger");
|
|
@@ -20,3 +17,5 @@ var InfoLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/In
|
|
|
20
17
|
Object.defineProperty(exports, "InfoLogger", { enumerable: true, get: function () { return InfoLogger_1.InfoLogger; } });
|
|
21
18
|
var DebugLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/DebugLogger");
|
|
22
19
|
Object.defineProperty(exports, "DebugLogger", { enumerable: true, get: function () { return DebugLogger_1.DebugLogger; } });
|
|
20
|
+
var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/storages/pluggable");
|
|
21
|
+
Object.defineProperty(exports, "PluggableStorage", { enumerable: true, get: function () { return pluggable_1.PluggableStorage; } });
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SplitFactory = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var full_1 = require("../settings/full");
|
|
6
|
+
var getModules_1 = require("../platform/getModules");
|
|
6
7
|
var index_1 = require("@splitsoftware/splitio-commons/cjs/sdkFactory/index");
|
|
7
8
|
var lang_1 = require("@splitsoftware/splitio-commons/cjs/utils/lang");
|
|
9
|
+
var getFetchFull_1 = require("../platform/getFetchFull");
|
|
10
|
+
var getEventSource_1 = require("../platform/getEventSource");
|
|
11
|
+
var MinEvents_1 = tslib_1.__importDefault(require("@splitsoftware/splitio-commons/cjs/utils/MinEvents"));
|
|
12
|
+
var platform = { getFetch: getFetchFull_1.getFetch, getEventSource: getEventSource_1.getEventSource, EventEmitter: MinEvents_1.default };
|
|
8
13
|
/**
|
|
9
14
|
* SplitFactory with pluggable modules for Browser.
|
|
10
|
-
*
|
|
15
|
+
* Includes localhost mode and fetch polyfill out-of-the-box.
|
|
11
16
|
*
|
|
12
17
|
* @param config configuration object used to instantiates the SDK
|
|
13
18
|
* @param customModules optional object of SDK modules to overwrite default ones. Use with caution since, unlike `config`, this param is not validated.
|
|
14
19
|
* @throws Will throw an error if the provided config is invalid.
|
|
15
20
|
*/
|
|
16
21
|
function SplitFactory(config, customModules) {
|
|
17
|
-
var settings =
|
|
18
|
-
var modules =
|
|
22
|
+
var settings = full_1.settingsValidator(config);
|
|
23
|
+
var modules = getModules_1.getModules(settings, platform);
|
|
19
24
|
return index_1.sdkFactory(customModules ? lang_1.merge(modules, customModules) : modules);
|
|
20
25
|
}
|
|
21
26
|
exports.SplitFactory = SplitFactory;
|
package/cjs/index.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SplitToGoogleAnalytics = exports.GoogleAnalyticsToSplit = exports.InLocalStorage = exports.SplitFactory = void 0;
|
|
3
|
+
exports.PluggableStorage = exports.LocalhostFromObject = exports.DebugLogger = exports.InfoLogger = exports.WarnLogger = exports.ErrorLogger = exports.SplitToGoogleAnalytics = exports.GoogleAnalyticsToSplit = exports.InLocalStorage = exports.SplitFactory = void 0;
|
|
7
4
|
var splitFactory_1 = require("./splitFactory");
|
|
8
5
|
Object.defineProperty(exports, "SplitFactory", { enumerable: true, get: function () { return splitFactory_1.SplitFactory; } });
|
|
9
6
|
var index_1 = require("@splitsoftware/splitio-commons/cjs/storages/inLocalStorage/index");
|
|
10
7
|
Object.defineProperty(exports, "InLocalStorage", { enumerable: true, get: function () { return index_1.InLocalStorage; } });
|
|
11
|
-
var
|
|
12
|
-
Object.defineProperty(exports, "GoogleAnalyticsToSplit", { enumerable: true, get: function () { return
|
|
13
|
-
var
|
|
14
|
-
Object.defineProperty(exports, "SplitToGoogleAnalytics", { enumerable: true, get: function () { return
|
|
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
|
+
var ErrorLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/ErrorLogger");
|
|
13
|
+
Object.defineProperty(exports, "ErrorLogger", { enumerable: true, get: function () { return ErrorLogger_1.ErrorLogger; } });
|
|
14
|
+
var WarnLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/WarnLogger");
|
|
15
|
+
Object.defineProperty(exports, "WarnLogger", { enumerable: true, get: function () { return WarnLogger_1.WarnLogger; } });
|
|
16
|
+
var InfoLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/InfoLogger");
|
|
17
|
+
Object.defineProperty(exports, "InfoLogger", { enumerable: true, get: function () { return InfoLogger_1.InfoLogger; } });
|
|
18
|
+
var DebugLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/DebugLogger");
|
|
19
|
+
Object.defineProperty(exports, "DebugLogger", { enumerable: true, get: function () { return DebugLogger_1.DebugLogger; } });
|
|
20
|
+
var LocalhostFromObject_1 = require("@splitsoftware/splitio-commons/cjs/sync/offline/LocalhostFromObject");
|
|
21
|
+
Object.defineProperty(exports, "LocalhostFromObject", { enumerable: true, get: function () { return LocalhostFromObject_1.LocalhostFromObject; } });
|
|
22
|
+
var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/storages/pluggable");
|
|
23
|
+
Object.defineProperty(exports, "PluggableStorage", { enumerable: true, get: function () { return pluggable_1.PluggableStorage; } });
|
|
File without changes
|
|
File without changes
|
|
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getModules = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var splitApi_1 = require("@splitsoftware/splitio-commons/cjs/services/splitApi");
|
|
6
|
-
var splitsParserFromSettings_1 = require("@splitsoftware/splitio-commons/cjs/sync/offline/splitsParser/splitsParserFromSettings");
|
|
7
|
-
var syncManagerOffline_1 = require("@splitsoftware/splitio-commons/cjs/sync/syncManagerOffline");
|
|
8
6
|
var syncManagerOnline_1 = require("@splitsoftware/splitio-commons/cjs/sync/syncManagerOnline");
|
|
9
7
|
var pushManager_1 = tslib_1.__importDefault(require("@splitsoftware/splitio-commons/cjs/sync/streaming/pushManager"));
|
|
10
8
|
var pollingManagerCS_1 = tslib_1.__importDefault(require("@splitsoftware/splitio-commons/cjs/sync/polling/pollingManagerCS"));
|
|
@@ -13,30 +11,40 @@ var sdkClientMethodCS_1 = require("@splitsoftware/splitio-commons/cjs/sdkClient/
|
|
|
13
11
|
var browser_1 = tslib_1.__importDefault(require("@splitsoftware/splitio-commons/cjs/listeners/browser"));
|
|
14
12
|
var impressionObserverCS_1 = require("@splitsoftware/splitio-commons/cjs/trackers/impressionObserver/impressionObserverCS");
|
|
15
13
|
var pluggable_1 = tslib_1.__importDefault(require("@splitsoftware/splitio-commons/cjs/integrations/pluggable"));
|
|
16
|
-
var MinEvents_1 = tslib_1.__importDefault(require("@splitsoftware/splitio-commons/cjs/utils/MinEvents"));
|
|
17
|
-
var getFetch_1 = require("./getFetch");
|
|
18
|
-
var getEventSource_1 = require("./getEventSource");
|
|
19
14
|
var utils_1 = require("@splitsoftware/splitio-commons/cjs/trackers/impressionObserver/utils");
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
function getModules(settings) {
|
|
28
|
-
return {
|
|
15
|
+
var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
|
|
16
|
+
var syncManagerStandaloneFactory;
|
|
17
|
+
var syncManagerSubmittersFactory;
|
|
18
|
+
function getModules(settings, platform) {
|
|
19
|
+
if (!syncManagerStandaloneFactory)
|
|
20
|
+
syncManagerStandaloneFactory = syncManagerOnline_1.syncManagerOnlineFactory(pollingManagerCS_1.default, pushManager_1.default);
|
|
21
|
+
var modules = {
|
|
29
22
|
settings: settings,
|
|
30
|
-
platform:
|
|
23
|
+
platform: platform,
|
|
31
24
|
storageFactory: settings.storage,
|
|
32
|
-
splitApiFactory:
|
|
33
|
-
syncManagerFactory:
|
|
25
|
+
splitApiFactory: splitApi_1.splitApiFactory,
|
|
26
|
+
syncManagerFactory: syncManagerStandaloneFactory,
|
|
34
27
|
sdkManagerFactory: index_1.sdkManagerFactory,
|
|
35
28
|
sdkClientMethodFactory: sdkClientMethodCS_1.sdkClientMethodCSFactory,
|
|
36
|
-
SignalListener:
|
|
29
|
+
SignalListener: browser_1.default,
|
|
37
30
|
impressionListener: settings.impressionListener,
|
|
38
31
|
integrationsManagerFactory: settings.integrations && settings.integrations.length > 0 ? pluggable_1.default.bind(null, settings.integrations) : undefined,
|
|
39
32
|
impressionsObserverFactory: utils_1.shouldAddPt(settings) ? impressionObserverCS_1.impressionObserverCSFactory : undefined,
|
|
40
33
|
};
|
|
34
|
+
switch (settings.mode) {
|
|
35
|
+
case constants_1.LOCALHOST_MODE:
|
|
36
|
+
modules.splitApiFactory = undefined;
|
|
37
|
+
modules.syncManagerFactory = settings.sync.localhostMode;
|
|
38
|
+
modules.SignalListener = undefined;
|
|
39
|
+
break;
|
|
40
|
+
case constants_1.CONSUMER_MODE:
|
|
41
|
+
modules.syncManagerFactory = undefined;
|
|
42
|
+
break;
|
|
43
|
+
case constants_1.CONSUMER_PARTIAL_MODE:
|
|
44
|
+
if (!syncManagerSubmittersFactory)
|
|
45
|
+
syncManagerSubmittersFactory = syncManagerOnline_1.syncManagerOnlineFactory(undefined, undefined);
|
|
46
|
+
modules.syncManagerFactory = syncManagerSubmittersFactory;
|
|
47
|
+
}
|
|
48
|
+
return modules;
|
|
41
49
|
}
|
|
42
50
|
exports.getModules = getModules;
|
package/cjs/settings/defaults.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
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
|
-
var packageVersion = '0.
|
|
5
|
+
var packageVersion = '0.2.1-rc.0';
|
|
6
6
|
/**
|
|
7
7
|
* In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
|
|
8
8
|
* Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'.
|
|
@@ -6,11 +6,14 @@ var defaults_1 = require("./defaults");
|
|
|
6
6
|
var storageCS_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/storage/storageCS");
|
|
7
7
|
var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/integrations/pluggable");
|
|
8
8
|
var pluggableLogger_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/logger/pluggableLogger");
|
|
9
|
+
var builtin_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/localhost/builtin");
|
|
9
10
|
var params = {
|
|
10
11
|
defaults: defaults_1.defaults,
|
|
11
12
|
storage: storageCS_1.validateStorageCS,
|
|
12
13
|
integrations: pluggable_1.validatePluggableIntegrations,
|
|
13
|
-
logger: pluggableLogger_1.validateLogger
|
|
14
|
+
logger: pluggableLogger_1.validateLogger,
|
|
15
|
+
// Full SplitFactory returns a default instance, except a valid one is provided
|
|
16
|
+
localhost: builtin_1.validateLocalhostWithDefault
|
|
14
17
|
};
|
|
15
18
|
function settingsValidator(config) {
|
|
16
19
|
return index_1.settingsValidation(config, params);
|
package/cjs/settings/index.js
CHANGED
|
@@ -5,12 +5,15 @@ var index_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidati
|
|
|
5
5
|
var defaults_1 = require("./defaults");
|
|
6
6
|
var storageCS_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/storage/storageCS");
|
|
7
7
|
var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/integrations/pluggable");
|
|
8
|
-
var
|
|
8
|
+
var pluggableLogger_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/logger/pluggableLogger");
|
|
9
|
+
var pluggable_2 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/localhost/pluggable");
|
|
9
10
|
var params = {
|
|
10
11
|
defaults: defaults_1.defaults,
|
|
11
12
|
storage: storageCS_1.validateStorageCS,
|
|
12
13
|
integrations: pluggable_1.validatePluggableIntegrations,
|
|
13
|
-
logger:
|
|
14
|
+
logger: pluggableLogger_1.validateLogger,
|
|
15
|
+
// Slim SplitFactory validates that the localhost module is passed in localhost mode
|
|
16
|
+
localhost: pluggable_2.validateLocalhost
|
|
14
17
|
};
|
|
15
18
|
function settingsValidator(config) {
|
|
16
19
|
return index_1.settingsValidation(config, params);
|
package/cjs/splitFactory.js
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SplitFactory = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
4
5
|
var settings_1 = require("./settings");
|
|
5
6
|
var getModules_1 = require("./platform/getModules");
|
|
6
7
|
var index_1 = require("@splitsoftware/splitio-commons/cjs/sdkFactory/index");
|
|
7
8
|
var lang_1 = require("@splitsoftware/splitio-commons/cjs/utils/lang");
|
|
9
|
+
var getFetchSlim_1 = require("./platform/getFetchSlim");
|
|
10
|
+
var getEventSource_1 = require("./platform/getEventSource");
|
|
11
|
+
var MinEvents_1 = tslib_1.__importDefault(require("@splitsoftware/splitio-commons/cjs/utils/MinEvents"));
|
|
12
|
+
var platform = { getFetch: getFetchSlim_1.getFetch, getEventSource: getEventSource_1.getEventSource, EventEmitter: MinEvents_1.default };
|
|
8
13
|
/**
|
|
9
|
-
* SplitFactory with pluggable modules for Browser.
|
|
10
|
-
*
|
|
14
|
+
* Slim SplitFactory with pluggable modules for Browser.
|
|
15
|
+
* Doesn't include localhost mode and fetch ponyfill out-of-the-box.
|
|
11
16
|
*
|
|
12
17
|
* @param config configuration object used to instantiates the SDK
|
|
13
18
|
* @param customModules optional object of SDK modules to overwrite default ones. Use with caution since, unlike `config`, this param is not validated.
|
|
19
|
+
* @throws Will throw an error if the provided config is invalid.
|
|
14
20
|
*/
|
|
15
21
|
function SplitFactory(config, customModules) {
|
|
16
22
|
var settings = settings_1.settingsValidator(config);
|
|
17
|
-
var modules = getModules_1.getModules(settings);
|
|
23
|
+
var modules = getModules_1.getModules(settings, platform);
|
|
18
24
|
return index_1.sdkFactory(customModules ? lang_1.merge(modules, customModules) : modules);
|
|
19
25
|
}
|
|
20
26
|
exports.SplitFactory = SplitFactory;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { SplitFactory } from './splitFactory';
|
|
2
2
|
export { InLocalStorage } from '@splitsoftware/splitio-commons/esm/storages/inLocalStorage/index';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { GoogleAnalyticsToSplit } from '@splitsoftware/splitio-commons/esm/integrations/ga/GoogleAnalyticsToSplit';
|
|
4
|
+
export { SplitToGoogleAnalytics } from '@splitsoftware/splitio-commons/esm/integrations/ga/SplitToGoogleAnalytics';
|
|
5
5
|
export { ErrorLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/ErrorLogger';
|
|
6
6
|
export { WarnLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/WarnLogger';
|
|
7
7
|
export { InfoLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/InfoLogger';
|
|
8
8
|
export { DebugLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/DebugLogger';
|
|
9
|
+
export { PluggableStorage } from '@splitsoftware/splitio-commons/esm/storages/pluggable';
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { settingsValidator } from '../settings/
|
|
2
|
-
import { getModules } from '../platform/
|
|
1
|
+
import { settingsValidator } from '../settings/full';
|
|
2
|
+
import { getModules } from '../platform/getModules';
|
|
3
3
|
import { sdkFactory } from '@splitsoftware/splitio-commons/esm/sdkFactory/index';
|
|
4
4
|
import { merge } from '@splitsoftware/splitio-commons/esm/utils/lang';
|
|
5
|
+
import { getFetch } from '../platform/getFetchFull';
|
|
6
|
+
import { getEventSource } from '../platform/getEventSource';
|
|
7
|
+
import EventEmitter from '@splitsoftware/splitio-commons/esm/utils/MinEvents';
|
|
8
|
+
var platform = { getFetch: getFetch, getEventSource: getEventSource, EventEmitter: EventEmitter };
|
|
5
9
|
/**
|
|
6
10
|
* SplitFactory with pluggable modules for Browser.
|
|
7
|
-
*
|
|
11
|
+
* Includes localhost mode and fetch polyfill out-of-the-box.
|
|
8
12
|
*
|
|
9
13
|
* @param config configuration object used to instantiates the SDK
|
|
10
14
|
* @param customModules optional object of SDK modules to overwrite default ones. Use with caution since, unlike `config`, this param is not validated.
|
|
@@ -12,6 +16,6 @@ import { merge } from '@splitsoftware/splitio-commons/esm/utils/lang';
|
|
|
12
16
|
*/
|
|
13
17
|
export function SplitFactory(config, customModules) {
|
|
14
18
|
var settings = settingsValidator(config);
|
|
15
|
-
var modules = getModules(settings);
|
|
19
|
+
var modules = getModules(settings, platform);
|
|
16
20
|
return sdkFactory(customModules ? merge(modules, customModules) : modules);
|
|
17
21
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export { SplitFactory } from './splitFactory';
|
|
2
2
|
export { InLocalStorage } from '@splitsoftware/splitio-commons/esm/storages/inLocalStorage/index';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { GoogleAnalyticsToSplit } from '@splitsoftware/splitio-commons/esm/integrations/ga/GoogleAnalyticsToSplit';
|
|
4
|
+
export { SplitToGoogleAnalytics } from '@splitsoftware/splitio-commons/esm/integrations/ga/SplitToGoogleAnalytics';
|
|
5
|
+
export { ErrorLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/ErrorLogger';
|
|
6
|
+
export { WarnLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/WarnLogger';
|
|
7
|
+
export { InfoLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/InfoLogger';
|
|
8
|
+
export { DebugLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/DebugLogger';
|
|
9
|
+
export { LocalhostFromObject } from '@splitsoftware/splitio-commons/esm/sync/offline/LocalhostFromObject';
|
|
10
|
+
export { PluggableStorage } from '@splitsoftware/splitio-commons/esm/storages/pluggable';
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { splitApiFactory } from '@splitsoftware/splitio-commons/esm/services/splitApi';
|
|
2
|
-
import { splitsParserFromSettingsFactory } from '@splitsoftware/splitio-commons/esm/sync/offline/splitsParser/splitsParserFromSettings';
|
|
3
|
-
import { syncManagerOfflineFactory } from '@splitsoftware/splitio-commons/esm/sync/syncManagerOffline';
|
|
4
2
|
import { syncManagerOnlineFactory } from '@splitsoftware/splitio-commons/esm/sync/syncManagerOnline';
|
|
5
3
|
import pushManagerFactory from '@splitsoftware/splitio-commons/esm/sync/streaming/pushManager';
|
|
6
4
|
import pollingManagerCSFactory from '@splitsoftware/splitio-commons/esm/sync/polling/pollingManagerCS';
|
|
@@ -9,29 +7,39 @@ import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/esm/sdk
|
|
|
9
7
|
import BrowserSignalListener from '@splitsoftware/splitio-commons/esm/listeners/browser';
|
|
10
8
|
import { impressionObserverCSFactory } from '@splitsoftware/splitio-commons/esm/trackers/impressionObserver/impressionObserverCS';
|
|
11
9
|
import integrationsManagerFactory from '@splitsoftware/splitio-commons/esm/integrations/pluggable';
|
|
12
|
-
import EventEmitter from '@splitsoftware/splitio-commons/esm/utils/MinEvents';
|
|
13
|
-
import { getFetch } from './getFetch';
|
|
14
|
-
import { getEventSource } from './getEventSource';
|
|
15
10
|
import { shouldAddPt } from '@splitsoftware/splitio-commons/esm/trackers/impressionObserver/utils';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
export function getModules(settings) {
|
|
24
|
-
return {
|
|
11
|
+
import { CONSUMER_MODE, CONSUMER_PARTIAL_MODE, LOCALHOST_MODE } from '@splitsoftware/splitio-commons/esm/utils/constants';
|
|
12
|
+
var syncManagerStandaloneFactory;
|
|
13
|
+
var syncManagerSubmittersFactory;
|
|
14
|
+
export function getModules(settings, platform) {
|
|
15
|
+
if (!syncManagerStandaloneFactory)
|
|
16
|
+
syncManagerStandaloneFactory = syncManagerOnlineFactory(pollingManagerCSFactory, pushManagerFactory);
|
|
17
|
+
var modules = {
|
|
25
18
|
settings: settings,
|
|
26
|
-
platform:
|
|
19
|
+
platform: platform,
|
|
27
20
|
storageFactory: settings.storage,
|
|
28
|
-
splitApiFactory:
|
|
29
|
-
syncManagerFactory:
|
|
21
|
+
splitApiFactory: splitApiFactory,
|
|
22
|
+
syncManagerFactory: syncManagerStandaloneFactory,
|
|
30
23
|
sdkManagerFactory: sdkManagerFactory,
|
|
31
24
|
sdkClientMethodFactory: sdkClientMethodCSFactory,
|
|
32
|
-
SignalListener:
|
|
25
|
+
SignalListener: BrowserSignalListener,
|
|
33
26
|
impressionListener: settings.impressionListener,
|
|
34
27
|
integrationsManagerFactory: settings.integrations && settings.integrations.length > 0 ? integrationsManagerFactory.bind(null, settings.integrations) : undefined,
|
|
35
28
|
impressionsObserverFactory: shouldAddPt(settings) ? impressionObserverCSFactory : undefined,
|
|
36
29
|
};
|
|
30
|
+
switch (settings.mode) {
|
|
31
|
+
case LOCALHOST_MODE:
|
|
32
|
+
modules.splitApiFactory = undefined;
|
|
33
|
+
modules.syncManagerFactory = settings.sync.localhostMode;
|
|
34
|
+
modules.SignalListener = undefined;
|
|
35
|
+
break;
|
|
36
|
+
case CONSUMER_MODE:
|
|
37
|
+
modules.syncManagerFactory = undefined;
|
|
38
|
+
break;
|
|
39
|
+
case CONSUMER_PARTIAL_MODE:
|
|
40
|
+
if (!syncManagerSubmittersFactory)
|
|
41
|
+
syncManagerSubmittersFactory = syncManagerOnlineFactory(undefined, undefined);
|
|
42
|
+
modules.syncManagerFactory = syncManagerSubmittersFactory;
|
|
43
|
+
}
|
|
44
|
+
return modules;
|
|
37
45
|
}
|
package/esm/settings/defaults.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/esm/logger/index';
|
|
2
|
-
var packageVersion = '0.
|
|
2
|
+
var packageVersion = '0.2.1-rc.0';
|
|
3
3
|
/**
|
|
4
4
|
* In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
|
|
5
5
|
* Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'.
|
|
@@ -3,11 +3,14 @@ import { defaults } from './defaults';
|
|
|
3
3
|
import { validateStorageCS } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/storage/storageCS';
|
|
4
4
|
import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/integrations/pluggable';
|
|
5
5
|
import { validateLogger } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/logger/pluggableLogger';
|
|
6
|
+
import { validateLocalhostWithDefault } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/localhost/builtin';
|
|
6
7
|
var params = {
|
|
7
8
|
defaults: defaults,
|
|
8
9
|
storage: validateStorageCS,
|
|
9
10
|
integrations: validatePluggableIntegrations,
|
|
10
|
-
logger: validateLogger
|
|
11
|
+
logger: validateLogger,
|
|
12
|
+
// Full SplitFactory returns a default instance, except a valid one is provided
|
|
13
|
+
localhost: validateLocalhostWithDefault
|
|
11
14
|
};
|
|
12
15
|
export function settingsValidator(config) {
|
|
13
16
|
return settingsValidation(config, params);
|
package/esm/settings/index.js
CHANGED
|
@@ -2,12 +2,15 @@ import { settingsValidation } from '@splitsoftware/splitio-commons/esm/utils/set
|
|
|
2
2
|
import { defaults } from './defaults';
|
|
3
3
|
import { validateStorageCS } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/storage/storageCS';
|
|
4
4
|
import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/integrations/pluggable';
|
|
5
|
-
import { validateLogger } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/logger/
|
|
5
|
+
import { validateLogger } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/logger/pluggableLogger';
|
|
6
|
+
import { validateLocalhost } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/localhost/pluggable';
|
|
6
7
|
var params = {
|
|
7
8
|
defaults: defaults,
|
|
8
9
|
storage: validateStorageCS,
|
|
9
10
|
integrations: validatePluggableIntegrations,
|
|
10
|
-
logger: validateLogger
|
|
11
|
+
logger: validateLogger,
|
|
12
|
+
// Slim SplitFactory validates that the localhost module is passed in localhost mode
|
|
13
|
+
localhost: validateLocalhost
|
|
11
14
|
};
|
|
12
15
|
export function settingsValidator(config) {
|
|
13
16
|
return settingsValidation(config, params);
|
package/esm/splitFactory.js
CHANGED
|
@@ -2,15 +2,20 @@ import { settingsValidator } from './settings';
|
|
|
2
2
|
import { getModules } from './platform/getModules';
|
|
3
3
|
import { sdkFactory } from '@splitsoftware/splitio-commons/esm/sdkFactory/index';
|
|
4
4
|
import { merge } from '@splitsoftware/splitio-commons/esm/utils/lang';
|
|
5
|
+
import { getFetch } from './platform/getFetchSlim';
|
|
6
|
+
import { getEventSource } from './platform/getEventSource';
|
|
7
|
+
import EventEmitter from '@splitsoftware/splitio-commons/esm/utils/MinEvents';
|
|
8
|
+
var platform = { getFetch: getFetch, getEventSource: getEventSource, EventEmitter: EventEmitter };
|
|
5
9
|
/**
|
|
6
|
-
* SplitFactory with pluggable modules for Browser.
|
|
7
|
-
*
|
|
10
|
+
* Slim SplitFactory with pluggable modules for Browser.
|
|
11
|
+
* Doesn't include localhost mode and fetch ponyfill out-of-the-box.
|
|
8
12
|
*
|
|
9
13
|
* @param config configuration object used to instantiates the SDK
|
|
10
14
|
* @param customModules optional object of SDK modules to overwrite default ones. Use with caution since, unlike `config`, this param is not validated.
|
|
15
|
+
* @throws Will throw an error if the provided config is invalid.
|
|
11
16
|
*/
|
|
12
17
|
export function SplitFactory(config, customModules) {
|
|
13
18
|
var settings = settingsValidator(config);
|
|
14
|
-
var modules = getModules(settings);
|
|
19
|
+
var modules = getModules(settings, platform);
|
|
15
20
|
return sdkFactory(customModules ? merge(modules, customModules) : modules);
|
|
16
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splitsoftware/splitio-browserjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1-rc.0",
|
|
4
4
|
"description": "Split SDK for Javascript on Browser",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"esm",
|
|
15
15
|
"src",
|
|
16
16
|
"types",
|
|
17
|
-
"
|
|
17
|
+
"full"
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
20
|
"check": "npm run check:lint && npm run check:types && npm run check:version",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"build": "npm run build:cjs && npm run build:esm && npm run build:umd",
|
|
25
25
|
"build:esm": "rimraf esm && tsc -outDir esm --importHelpers && ./scripts/build_esm_replace_imports.sh",
|
|
26
26
|
"build:cjs": "rimraf cjs && tsc -outDir cjs -m CommonJS --importHelpers && ./scripts/build_cjs_replace_imports.sh",
|
|
27
|
-
"build:umd": "rollup --config rollup.visualizer.config.js",
|
|
28
|
-
"build:umd
|
|
27
|
+
"build:umd-visualizer": "rollup --config rollup.visualizer.config.js",
|
|
28
|
+
"build:umd": "rollup --config rollup.ci.config.js --branch=$BUILD_BRANCH --commit_hash=$BUILD_COMMIT",
|
|
29
29
|
"test": "npm run test:unit && npm run test:e2e",
|
|
30
30
|
"test:unit": "jest",
|
|
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-errors && npm run test:e2e-push && npm run test:e2e-gaintegration",
|
|
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-errors && npm run test:e2e-push && npm run test:e2e-gaintegration && npm run test:e2e-consumer",
|
|
32
32
|
"test:e2e-logger": "karma start karma/e2e.logger.karma.conf.js",
|
|
33
33
|
"test:e2e-offline": "karma start karma/e2e.offline.karma.conf.js",
|
|
34
34
|
"test:e2e-online": "karma start karma/e2e.online.karma.conf.js",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"test:e2e-errors": "karma start karma/e2e.errors.karma.conf.js",
|
|
37
37
|
"test:e2e-push": "karma start karma/e2e.push.karma.conf.js",
|
|
38
38
|
"test:e2e-gaintegration": "karma start karma/e2e.gaintegration.karma.conf.js",
|
|
39
|
+
"test:e2e-consumer": "karma start karma/e2e.consumer.karma.conf.js",
|
|
39
40
|
"pretest-ts-decls": "npm run build:esm && npm run build:cjs && npm link",
|
|
40
41
|
"test-ts-decls": "./scripts/ts-tests.sh",
|
|
41
42
|
"posttest-ts-decls": "npm unlink && npm install",
|
|
@@ -60,37 +61,38 @@
|
|
|
60
61
|
"bugs": "https://github.com/splitio/javascript-browser-client/issues",
|
|
61
62
|
"homepage": "https://github.com/splitio/javascript-browser-client#readme",
|
|
62
63
|
"dependencies": {
|
|
63
|
-
"@splitsoftware/splitio-commons": "0.1
|
|
64
|
+
"@splitsoftware/splitio-commons": "1.0.1-rc.2",
|
|
64
65
|
"@types/google.analytics": "0.0.40"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
67
68
|
"@rollup/plugin-commonjs": "^13.0.0",
|
|
68
69
|
"@rollup/plugin-json": "^4.1.0",
|
|
69
70
|
"@rollup/plugin-node-resolve": "^8.0.1",
|
|
71
|
+
"@types/jest": "^27.0.2",
|
|
70
72
|
"@types/node-fetch": "^2.5.7",
|
|
71
73
|
"@types/object-assign": "^4.0.30",
|
|
72
74
|
"@typescript-eslint/eslint-plugin": "^4.14.1",
|
|
73
75
|
"@typescript-eslint/parser": "^4.14.1",
|
|
74
|
-
"rollup-plugin-ts": "^1.4.0",
|
|
75
76
|
"eslint": "^7.18.0",
|
|
76
77
|
"eslint-plugin-compat": "^3.9.0",
|
|
77
78
|
"fetch-mock": "^9.11.0",
|
|
78
|
-
"jest": "^
|
|
79
|
+
"jest": "^27.2.3",
|
|
79
80
|
"karma": "^6.3.2",
|
|
80
81
|
"karma-chrome-launcher": "^3.1.0",
|
|
81
82
|
"karma-rollup-preprocessor": "^7.0.5",
|
|
82
83
|
"karma-tap": "^4.2.0",
|
|
83
|
-
"replace": "^1.2.
|
|
84
|
+
"replace": "^1.2.1",
|
|
84
85
|
"rimraf": "^3.0.2",
|
|
85
86
|
"rollup": "^2.35.1",
|
|
86
87
|
"rollup-plugin-node-polyfills": "^0.2.1",
|
|
87
88
|
"rollup-plugin-string": "^3.0.0",
|
|
88
89
|
"rollup-plugin-terser": "^7.0.2",
|
|
90
|
+
"rollup-plugin-ts": "^1.4.0",
|
|
89
91
|
"rollup-plugin-visualizer": "^4.2.0",
|
|
90
92
|
"sinon": "^9.2.2",
|
|
91
93
|
"tape": "4.13.2",
|
|
92
94
|
"tape-catch": "1.0.6",
|
|
93
|
-
"ts-jest": "^
|
|
95
|
+
"ts-jest": "^27.0.5",
|
|
94
96
|
"typescript": "^4.1.3",
|
|
95
97
|
"unfetch": "^4.2.0"
|
|
96
98
|
},
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { SplitFactory } from './splitFactory';
|
|
2
2
|
export { InLocalStorage } from '@splitsoftware/splitio-commons/src/storages/inLocalStorage/index';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { GoogleAnalyticsToSplit } from '@splitsoftware/splitio-commons/src/integrations/ga/GoogleAnalyticsToSplit';
|
|
4
|
+
export { SplitToGoogleAnalytics } from '@splitsoftware/splitio-commons/src/integrations/ga/SplitToGoogleAnalytics';
|
|
5
5
|
export { ErrorLogger } from '@splitsoftware/splitio-commons/src/logger/browser/ErrorLogger';
|
|
6
6
|
export { WarnLogger } from '@splitsoftware/splitio-commons/src/logger/browser/WarnLogger';
|
|
7
7
|
export { InfoLogger } from '@splitsoftware/splitio-commons/src/logger/browser/InfoLogger';
|
|
8
8
|
export { DebugLogger } from '@splitsoftware/splitio-commons/src/logger/browser/DebugLogger';
|
|
9
|
+
export { PluggableStorage } from '@splitsoftware/splitio-commons/src/storages/pluggable';
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import { settingsValidator } from '../settings/
|
|
2
|
-
import { getModules } from '../platform/
|
|
1
|
+
import { settingsValidator } from '../settings/full';
|
|
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';
|
|
5
5
|
import { merge } from '@splitsoftware/splitio-commons/src/utils/lang';
|
|
6
|
+
import { getFetch } from '../platform/getFetchFull';
|
|
7
|
+
import { getEventSource } from '../platform/getEventSource';
|
|
8
|
+
import EventEmitter from '@splitsoftware/splitio-commons/src/utils/MinEvents';
|
|
9
|
+
|
|
10
|
+
const platform = { getFetch, getEventSource, EventEmitter };
|
|
6
11
|
|
|
7
12
|
/**
|
|
8
13
|
* SplitFactory with pluggable modules for Browser.
|
|
9
|
-
*
|
|
14
|
+
* Includes localhost mode and fetch polyfill out-of-the-box.
|
|
10
15
|
*
|
|
11
16
|
* @param config configuration object used to instantiates the SDK
|
|
12
17
|
* @param customModules optional object of SDK modules to overwrite default ones. Use with caution since, unlike `config`, this param is not validated.
|
|
@@ -14,6 +19,6 @@ import { merge } from '@splitsoftware/splitio-commons/src/utils/lang';
|
|
|
14
19
|
*/
|
|
15
20
|
export function SplitFactory(config: any, customModules?: Partial<ISdkFactoryParams>) {
|
|
16
21
|
const settings = settingsValidator(config);
|
|
17
|
-
const modules = getModules(settings);
|
|
22
|
+
const modules = getModules(settings, platform);
|
|
18
23
|
return sdkFactory(customModules ? merge(modules, customModules) as ISdkFactoryParams : modules);
|
|
19
24
|
}
|