@splitsoftware/splitio-browserjs 0.15.1-rc.0 → 1.0.0-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 +12 -7
- package/cjs/index.js +1 -7
- package/cjs/platform/getModules.js +2 -1
- package/cjs/settings/defaults.js +1 -3
- package/cjs/settings/index.js +0 -6
- package/cjs/splitFactory.js +3 -4
- package/cjs/{full/umd.js → umd-full.js} +0 -4
- package/esm/index.js +0 -3
- package/esm/platform/getModules.js +2 -1
- package/esm/settings/defaults.js +1 -3
- package/esm/settings/index.js +0 -6
- package/esm/splitFactory.js +2 -3
- package/esm/{full/umd.js → umd-full.js} +0 -4
- package/package.json +5 -13
- package/src/index.ts +0 -3
- package/src/platform/getModules.ts +2 -2
- package/src/settings/defaults.ts +1 -3
- package/src/settings/index.ts +0 -6
- package/src/splitFactory.ts +4 -5
- package/src/{full/umd.ts → umd-full.ts} +0 -4
- package/types/index.d.ts +6 -30
- package/cjs/full/index.js +0 -21
- package/cjs/full/splitFactory.js +0 -28
- package/cjs/platform/getFetchFull.js +0 -9
- package/cjs/settings/full.js +0 -30
- package/esm/full/index.js +0 -9
- package/esm/full/splitFactory.js +0 -24
- package/esm/platform/getFetchFull.js +0 -4
- package/esm/settings/full.js +0 -26
- package/full/package.json +0 -6
- package/scripts/ga-to-split-autorequire.js +0 -1
- package/src/full/index.ts +0 -9
- package/src/full/splitFactory.ts +0 -27
- package/src/platform/getFetchFull.ts +0 -6
- package/src/settings/full.ts +0 -29
- package/types/full/index.d.ts +0 -76
- package/types/splitio.d.ts +0 -1734
- /package/cjs/platform/{getFetchSlim.js → getFetch.js} +0 -0
- /package/esm/platform/{getFetchSlim.js → getFetch.js} +0 -0
- /package/src/platform/{getFetchSlim.ts → getFetch.ts} +0 -0
package/CHANGES.txt
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
0.
|
|
2
|
-
- Added
|
|
3
|
-
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
+
- Renamed some TypeScript definitions in the SplitIO namespace to avoid conflicts with other libraries: `SplitIO.IBrowserSettings` to `SplitIO.IClientSideSettings`, `SplitIO.IBrowserAsyncSettings` to `SplitIO.IClientSideAsyncSettings`.
|
|
7
|
+
- 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.
|
|
8
|
+
- Removed the deprecated `GoogleAnalyticsToSplit` and `SplitToGoogleAnalytics` pluggable integration modules, along with the related interfaces in the TypeScript definitions.
|
|
9
|
+
- Removed the `LocalhostFromObject` export from the default import (`import { LocalhostFromObject } from '@splitsoftware/splitio-browserjs'`). It is no longer necessary to manually import and configure it in the `sync.localhostMode` option to enable localhost mode.
|
|
10
|
+
- Removed the "full" import (`import { SplitFactory } from '@splitsoftware/splitio-browserjs/full'`), since with the removal of `LocalhostFromObject` from the default import, the difference between them is minimal. The "full" import differs only by including the `unfetch` ponyfill to support older browsers.
|
|
6
11
|
|
|
7
12
|
0.15.0 (September 13, 2024)
|
|
8
13
|
- Updated @splitsoftware/splitio-commons package to version 1.17.0 that includes minor updates:
|
|
@@ -58,7 +63,7 @@
|
|
|
58
63
|
- Updated some transitive dependencies for vulnerability fixes.
|
|
59
64
|
- Updated @splitsoftware/splitio-commons package to version 1.8.3 that includes:
|
|
60
65
|
- 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.
|
|
61
|
-
- Bugfixing - The `destroy` method has been updated to immediately flag the SDK client as destroyed, to prevent unexpected
|
|
66
|
+
- 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.
|
|
62
67
|
|
|
63
68
|
0.9.5 (May 15, 2023)
|
|
64
69
|
- Updated @splitsoftware/splitio-commons package to version 1.8.2 that includes minor improvements.
|
|
@@ -68,7 +73,7 @@
|
|
|
68
73
|
|
|
69
74
|
0.9.4 (May 4, 2023)
|
|
70
75
|
- Updated some transitive dependencies for vulnerability fixes.
|
|
71
|
-
- Bugfixing - Updated `unfetch` package as a runtime dependency, required when using the "full"
|
|
76
|
+
- Bugfixing - Updated `unfetch` package as a runtime dependency, required when using the "full" import (`import { SplitFactory } from '@splitsoftware/splitio-browserjs/full'`).
|
|
72
77
|
|
|
73
78
|
0.9.3 (March 20, 2023)
|
|
74
79
|
- Updated @splitsoftware/splitio-commons package to version 1.8.1 that includes minor improvements.
|
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.
|
|
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");
|
|
@@ -17,7 +13,5 @@ var InfoLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/In
|
|
|
17
13
|
Object.defineProperty(exports, "InfoLogger", { enumerable: true, get: function () { return InfoLogger_1.InfoLogger; } });
|
|
18
14
|
var DebugLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/DebugLogger");
|
|
19
15
|
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
16
|
var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/storages/pluggable");
|
|
23
17
|
Object.defineProperty(exports, "PluggableStorage", { enumerable: true, get: function () { return pluggable_1.PluggableStorage; } });
|
|
@@ -12,6 +12,7 @@ var impressionObserverCS_1 = require("@splitsoftware/splitio-commons/cjs/tracker
|
|
|
12
12
|
var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/integrations/pluggable");
|
|
13
13
|
var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
|
|
14
14
|
var sdkUserConsent_1 = require("@splitsoftware/splitio-commons/cjs/consent/sdkUserConsent");
|
|
15
|
+
var LocalhostFromObject_1 = require("@splitsoftware/splitio-commons/cjs/sync/offline/LocalhostFromObject");
|
|
15
16
|
var syncManagerStandaloneFactory;
|
|
16
17
|
var syncManagerSubmittersFactory;
|
|
17
18
|
function getModules(settings, platform) {
|
|
@@ -37,7 +38,7 @@ function getModules(settings, platform) {
|
|
|
37
38
|
switch (settings.mode) {
|
|
38
39
|
case constants_1.LOCALHOST_MODE:
|
|
39
40
|
modules.splitApiFactory = undefined;
|
|
40
|
-
modules.syncManagerFactory =
|
|
41
|
+
modules.syncManagerFactory = LocalhostFromObject_1.localhostFromObjectFactory;
|
|
41
42
|
modules.SignalListener = undefined;
|
|
42
43
|
break;
|
|
43
44
|
case constants_1.CONSUMER_MODE:
|
package/cjs/settings/defaults.js
CHANGED
|
@@ -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.
|
|
6
|
+
var packageVersion = '1.0.0-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'.
|
|
@@ -29,8 +29,6 @@ exports.defaults = {
|
|
|
29
29
|
readyTimeout: 10,
|
|
30
30
|
// Amount of time we will wait before the first push of events.
|
|
31
31
|
eventsFirstPushWindow: 10,
|
|
32
|
-
// Wait for large segments to emit SDK_READY event.
|
|
33
|
-
waitForLargeSegments: true,
|
|
34
32
|
},
|
|
35
33
|
// Consent is considered granted by default
|
|
36
34
|
userConsent: constants_1.CONSENT_GRANTED,
|
package/cjs/settings/index.js
CHANGED
|
@@ -7,9 +7,7 @@ var runtime_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValida
|
|
|
7
7
|
var storageCS_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/storage/storageCS");
|
|
8
8
|
var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/integrations/pluggable");
|
|
9
9
|
var pluggableLogger_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/logger/pluggableLogger");
|
|
10
|
-
var pluggable_2 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/localhost/pluggable");
|
|
11
10
|
var consent_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/consent");
|
|
12
|
-
var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
|
|
13
11
|
var params = {
|
|
14
12
|
defaults: defaults_1.defaults,
|
|
15
13
|
acceptKey: true,
|
|
@@ -17,14 +15,10 @@ var params = {
|
|
|
17
15
|
storage: storageCS_1.validateStorageCS,
|
|
18
16
|
integrations: pluggable_1.validatePluggableIntegrations,
|
|
19
17
|
logger: pluggableLogger_1.validateLogger,
|
|
20
|
-
localhost: pluggable_2.validateLocalhost,
|
|
21
18
|
consent: consent_1.validateConsent,
|
|
22
19
|
};
|
|
23
20
|
function settingsFactory(config) {
|
|
24
21
|
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
22
|
return settings;
|
|
29
23
|
}
|
|
30
24
|
exports.settingsFactory = settingsFactory;
|
package/cjs/splitFactory.js
CHANGED
|
@@ -4,14 +4,13 @@ exports.SplitFactory = void 0;
|
|
|
4
4
|
var settings_1 = require("./settings");
|
|
5
5
|
var getModules_1 = require("./platform/getModules");
|
|
6
6
|
var index_1 = require("@splitsoftware/splitio-commons/cjs/sdkFactory/index");
|
|
7
|
-
var
|
|
7
|
+
var getFetch_1 = require("./platform/getFetch");
|
|
8
8
|
var getEventSource_1 = require("./platform/getEventSource");
|
|
9
9
|
var MinEvents_1 = require("@splitsoftware/splitio-commons/cjs/utils/MinEvents");
|
|
10
10
|
var browser_1 = require("@splitsoftware/splitio-commons/cjs/utils/timeTracker/now/browser");
|
|
11
|
-
var platform = { getFetch:
|
|
11
|
+
var platform = { getFetch: getFetch_1.getFetch, getEventSource: getEventSource_1.getEventSource, EventEmitter: MinEvents_1.EventEmitter, now: browser_1.now };
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
* Doesn't include localhost mode and fetch ponyfill out-of-the-box.
|
|
13
|
+
* SplitFactory with pluggable modules for Browser.
|
|
15
14
|
*
|
|
16
15
|
* @param config configuration object used to instantiate the SDK
|
|
17
16
|
* @param __updateModules optional function that lets redefine internal SDK modules. Use with
|
|
@@ -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/esm/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
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';
|
|
8
6
|
export { DebugLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/DebugLogger';
|
|
9
|
-
export { LocalhostFromObject } from '@splitsoftware/splitio-commons/esm/sync/offline/LocalhostFromObject';
|
|
10
7
|
export { PluggableStorage } from '@splitsoftware/splitio-commons/esm/storages/pluggable';
|
|
@@ -9,6 +9,7 @@ import { impressionObserverCSFactory } from '@splitsoftware/splitio-commons/esm/
|
|
|
9
9
|
import { pluggableIntegrationsManagerFactory } from '@splitsoftware/splitio-commons/esm/integrations/pluggable';
|
|
10
10
|
import { CONSUMER_MODE, CONSUMER_PARTIAL_MODE, LOCALHOST_MODE } from '@splitsoftware/splitio-commons/esm/utils/constants';
|
|
11
11
|
import { createUserConsentAPI } from '@splitsoftware/splitio-commons/esm/consent/sdkUserConsent';
|
|
12
|
+
import { localhostFromObjectFactory } from '@splitsoftware/splitio-commons/esm/sync/offline/LocalhostFromObject';
|
|
12
13
|
var syncManagerStandaloneFactory;
|
|
13
14
|
var syncManagerSubmittersFactory;
|
|
14
15
|
export function getModules(settings, platform) {
|
|
@@ -34,7 +35,7 @@ export function getModules(settings, platform) {
|
|
|
34
35
|
switch (settings.mode) {
|
|
35
36
|
case LOCALHOST_MODE:
|
|
36
37
|
modules.splitApiFactory = undefined;
|
|
37
|
-
modules.syncManagerFactory =
|
|
38
|
+
modules.syncManagerFactory = localhostFromObjectFactory;
|
|
38
39
|
modules.SignalListener = undefined;
|
|
39
40
|
break;
|
|
40
41
|
case CONSUMER_MODE:
|
package/esm/settings/defaults.js
CHANGED
|
@@ -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.
|
|
3
|
+
var packageVersion = '1.0.0-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'.
|
|
@@ -26,8 +26,6 @@ export var defaults = {
|
|
|
26
26
|
readyTimeout: 10,
|
|
27
27
|
// Amount of time we will wait before the first push of events.
|
|
28
28
|
eventsFirstPushWindow: 10,
|
|
29
|
-
// Wait for large segments to emit SDK_READY event.
|
|
30
|
-
waitForLargeSegments: true,
|
|
31
29
|
},
|
|
32
30
|
// Consent is considered granted by default
|
|
33
31
|
userConsent: CONSENT_GRANTED,
|
package/esm/settings/index.js
CHANGED
|
@@ -4,9 +4,7 @@ import { validateRuntime } from '@splitsoftware/splitio-commons/esm/utils/settin
|
|
|
4
4
|
import { validateStorageCS } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/storage/storageCS';
|
|
5
5
|
import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/integrations/pluggable';
|
|
6
6
|
import { validateLogger } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/logger/pluggableLogger';
|
|
7
|
-
import { validateLocalhost } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/localhost/pluggable';
|
|
8
7
|
import { validateConsent } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/consent';
|
|
9
|
-
import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/esm/utils/constants';
|
|
10
8
|
var params = {
|
|
11
9
|
defaults: defaults,
|
|
12
10
|
acceptKey: true,
|
|
@@ -14,13 +12,9 @@ var params = {
|
|
|
14
12
|
storage: validateStorageCS,
|
|
15
13
|
integrations: validatePluggableIntegrations,
|
|
16
14
|
logger: validateLogger,
|
|
17
|
-
localhost: validateLocalhost,
|
|
18
15
|
consent: validateConsent,
|
|
19
16
|
};
|
|
20
17
|
export function settingsFactory(config) {
|
|
21
18
|
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
19
|
return settings;
|
|
26
20
|
}
|
package/esm/splitFactory.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { settingsFactory } from './settings';
|
|
2
2
|
import { getModules } from './platform/getModules';
|
|
3
3
|
import { sdkFactory } from '@splitsoftware/splitio-commons/esm/sdkFactory/index';
|
|
4
|
-
import { getFetch } from './platform/
|
|
4
|
+
import { getFetch } from './platform/getFetch';
|
|
5
5
|
import { getEventSource } from './platform/getEventSource';
|
|
6
6
|
import { EventEmitter } from '@splitsoftware/splitio-commons/esm/utils/MinEvents';
|
|
7
7
|
import { now } from '@splitsoftware/splitio-commons/esm/utils/timeTracker/now/browser';
|
|
8
8
|
var platform = { getFetch: getFetch, getEventSource: getEventSource, EventEmitter: EventEmitter, now: now };
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
* Doesn't include localhost mode and fetch ponyfill out-of-the-box.
|
|
10
|
+
* SplitFactory with pluggable modules for Browser.
|
|
12
11
|
*
|
|
13
12
|
* @param config configuration object used to instantiate the SDK
|
|
14
13
|
* @param __updateModules optional function that lets redefine internal SDK modules. Use with
|
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splitsoftware/splitio-browserjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
4
|
"description": "Split SDK for JavaScript on Browser",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -13,9 +13,7 @@
|
|
|
13
13
|
"cjs",
|
|
14
14
|
"esm",
|
|
15
15
|
"src",
|
|
16
|
-
"types"
|
|
17
|
-
"full",
|
|
18
|
-
"scripts/ga-to-split-autorequire.js"
|
|
16
|
+
"types"
|
|
19
17
|
],
|
|
20
18
|
"scripts": {
|
|
21
19
|
"check": "npm run check:lint && npm run check:types && npm run check:version",
|
|
@@ -27,7 +25,6 @@
|
|
|
27
25
|
"build:cjs": "rimraf cjs && tsc -outDir cjs -m CommonJS && ./scripts/build_cjs_replace_imports.sh",
|
|
28
26
|
"build:umd-visualizer": "rimraf umd && rollup --config rollup.visualizer.config.js",
|
|
29
27
|
"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
28
|
"test": "npm run test:unit && npm run test:e2e",
|
|
32
29
|
"test:unit": "jest",
|
|
33
30
|
"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,11 +34,8 @@
|
|
|
37
34
|
"test:e2e-destroy": "karma start karma/e2e.destroy.karma.conf.js",
|
|
38
35
|
"test:e2e-errorCatching": "karma start karma/e2e.errorCatching.karma.conf.js",
|
|
39
36
|
"test:e2e-push": "karma start karma/e2e.push.karma.conf.js",
|
|
40
|
-
"test:e2e-gaIntegration": "karma start karma/e2e.gaIntegration.karma.conf.js",
|
|
41
37
|
"test:e2e-consumer": "karma start karma/e2e.consumer.karma.conf.js",
|
|
42
|
-
"
|
|
43
|
-
"test-ts-decls": "./scripts/ts-tests.sh",
|
|
44
|
-
"posttest-ts-decls": "npm rm --location=global @splitsoftware/splitio-browserjs && npm install",
|
|
38
|
+
"test-ts-decls": "tsc --build ts-tests",
|
|
45
39
|
"all": "npm run check && npm run build && npm run test-ts-decls && npm run test",
|
|
46
40
|
"publish:rc": "npm run check && npm run build && npm publish --tag rc",
|
|
47
41
|
"publish:stable": "npm run check && npm run build && npm publish"
|
|
@@ -64,10 +58,8 @@
|
|
|
64
58
|
"bugs": "https://github.com/splitio/javascript-browser-client/issues",
|
|
65
59
|
"homepage": "https://github.com/splitio/javascript-browser-client#readme",
|
|
66
60
|
"dependencies": {
|
|
67
|
-
"@splitsoftware/splitio-commons": "
|
|
68
|
-
"
|
|
69
|
-
"tslib": "^2.3.1",
|
|
70
|
-
"unfetch": "^4.2.0"
|
|
61
|
+
"@splitsoftware/splitio-commons": "2.0.0-rc.4",
|
|
62
|
+
"tslib": "^2.3.1"
|
|
71
63
|
},
|
|
72
64
|
"devDependencies": {
|
|
73
65
|
"@rollup/plugin-commonjs": "^24.0.1",
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
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';
|
|
8
6
|
export { DebugLogger } from '@splitsoftware/splitio-commons/src/logger/browser/DebugLogger';
|
|
9
|
-
export { LocalhostFromObject } from '@splitsoftware/splitio-commons/src/sync/offline/LocalhostFromObject';
|
|
10
7
|
export { PluggableStorage } from '@splitsoftware/splitio-commons/src/storages/pluggable';
|
|
@@ -7,11 +7,11 @@ import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/src/sdk
|
|
|
7
7
|
import { BrowserSignalListener } from '@splitsoftware/splitio-commons/src/listeners/browser';
|
|
8
8
|
import { impressionObserverCSFactory } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/impressionObserverCS';
|
|
9
9
|
import { pluggableIntegrationsManagerFactory } from '@splitsoftware/splitio-commons/src/integrations/pluggable';
|
|
10
|
-
|
|
11
10
|
import { IPlatform, ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types';
|
|
12
11
|
import { ISettings } from '@splitsoftware/splitio-commons/src/types';
|
|
13
12
|
import { CONSUMER_MODE, CONSUMER_PARTIAL_MODE, LOCALHOST_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';
|
|
14
13
|
import { createUserConsentAPI } from '@splitsoftware/splitio-commons/src/consent/sdkUserConsent';
|
|
14
|
+
import { localhostFromObjectFactory } from '@splitsoftware/splitio-commons/src/sync/offline/LocalhostFromObject';
|
|
15
15
|
|
|
16
16
|
let syncManagerStandaloneFactory: ISdkFactoryParams['syncManagerFactory'];
|
|
17
17
|
let syncManagerSubmittersFactory: ISdkFactoryParams['syncManagerFactory'];
|
|
@@ -51,7 +51,7 @@ export function getModules(settings: ISettings, platform: IPlatform): ISdkFactor
|
|
|
51
51
|
switch (settings.mode) {
|
|
52
52
|
case LOCALHOST_MODE:
|
|
53
53
|
modules.splitApiFactory = undefined;
|
|
54
|
-
modules.syncManagerFactory =
|
|
54
|
+
modules.syncManagerFactory = localhostFromObjectFactory;
|
|
55
55
|
modules.SignalListener = undefined;
|
|
56
56
|
break;
|
|
57
57
|
case CONSUMER_MODE:
|
package/src/settings/defaults.ts
CHANGED
|
@@ -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.
|
|
5
|
+
const packageVersion = '1.0.0-rc.1';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
|
|
@@ -31,8 +31,6 @@ export const defaults = {
|
|
|
31
31
|
readyTimeout: 10,
|
|
32
32
|
// Amount of time we will wait before the first push of events.
|
|
33
33
|
eventsFirstPushWindow: 10,
|
|
34
|
-
// Wait for large segments to emit SDK_READY event.
|
|
35
|
-
waitForLargeSegments: true,
|
|
36
34
|
},
|
|
37
35
|
|
|
38
36
|
// Consent is considered granted by default
|
package/src/settings/index.ts
CHANGED
|
@@ -4,9 +4,7 @@ import { validateRuntime } from '@splitsoftware/splitio-commons/src/utils/settin
|
|
|
4
4
|
import { validateStorageCS } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/storage/storageCS';
|
|
5
5
|
import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/integrations/pluggable';
|
|
6
6
|
import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/pluggableLogger';
|
|
7
|
-
import { validateLocalhost } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/localhost/pluggable';
|
|
8
7
|
import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/consent';
|
|
9
|
-
import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';
|
|
10
8
|
|
|
11
9
|
const params = {
|
|
12
10
|
defaults,
|
|
@@ -15,15 +13,11 @@ const params = {
|
|
|
15
13
|
storage: validateStorageCS,
|
|
16
14
|
integrations: validatePluggableIntegrations,
|
|
17
15
|
logger: validateLogger,
|
|
18
|
-
localhost: validateLocalhost, // Slim SplitFactory validates that the localhost module is passed in localhost mode
|
|
19
16
|
consent: validateConsent,
|
|
20
17
|
};
|
|
21
18
|
|
|
22
19
|
export function settingsFactory(config: any) {
|
|
23
20
|
const settings = settingsValidation(config, params);
|
|
24
21
|
|
|
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
22
|
return settings;
|
|
29
23
|
}
|
package/src/splitFactory.ts
CHANGED
|
@@ -2,24 +2,23 @@ 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';
|
|
5
|
-
import { getFetch } from './platform/
|
|
5
|
+
import { getFetch } from './platform/getFetch';
|
|
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
|
|
9
|
+
import SplitIO from '@splitsoftware/splitio-commons/types/splitio';
|
|
10
10
|
|
|
11
11
|
const platform = { getFetch, getEventSource, EventEmitter, now };
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* Doesn't include localhost mode and fetch ponyfill out-of-the-box.
|
|
14
|
+
* SplitFactory with pluggable modules for Browser.
|
|
16
15
|
*
|
|
17
16
|
* @param config configuration object used to instantiate the SDK
|
|
18
17
|
* @param __updateModules optional function that lets redefine internal SDK modules. Use with
|
|
19
18
|
* caution since, unlike `config`, this param is not validated neither considered part of the public API.
|
|
20
19
|
* @throws Will throw an error if the provided config is invalid.
|
|
21
20
|
*/
|
|
22
|
-
export function SplitFactory(config:
|
|
21
|
+
export function SplitFactory(config: SplitIO.IClientSideSettings, __updateModules?: (modules: ISdkFactoryParams) => void) {
|
|
23
22
|
const settings = settingsFactory(config);
|
|
24
23
|
const modules = getModules(settings, platform);
|
|
25
24
|
if (__updateModules) __updateModules(modules);
|
|
@@ -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/types/index.d.ts
CHANGED
|
@@ -2,21 +2,19 @@
|
|
|
2
2
|
// Project: http://www.split.io/
|
|
3
3
|
// Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import '@splitsoftware/splitio-commons';
|
|
6
|
+
|
|
6
7
|
export = JsSdk;
|
|
7
8
|
|
|
8
9
|
declare module JsSdk {
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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
|
-
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode}.
|
|
11
|
+
* Split.io SDK factory function.
|
|
14
12
|
*
|
|
15
|
-
* The settings parameter should be an object that complies with the SplitIO.
|
|
13
|
+
* The settings parameter should be an object that complies with the SplitIO.IClientSideSettings or SplitIO.IClientSideAsyncSettings interfaces.
|
|
16
14
|
* For more information read the corresponding article: @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#configuration}
|
|
17
15
|
*/
|
|
18
|
-
export function SplitFactory(settings: SplitIO.
|
|
19
|
-
export function SplitFactory(settings: SplitIO.
|
|
16
|
+
export function SplitFactory(settings: SplitIO.IClientSideSettings): SplitIO.ISDK;
|
|
17
|
+
export function SplitFactory(settings: SplitIO.IClientSideAsyncSettings): SplitIO.IAsyncSDK;
|
|
20
18
|
|
|
21
19
|
/**
|
|
22
20
|
* Persistent storage based on the LocalStorage Web API for browsers.
|
|
@@ -32,20 +30,6 @@ declare module JsSdk {
|
|
|
32
30
|
*/
|
|
33
31
|
export function PluggableStorage(options: SplitIO.PluggableStorageOptions): SplitIO.StorageAsyncFactory;
|
|
34
32
|
|
|
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
33
|
/**
|
|
50
34
|
* Creates a logger instance that enables descriptive log messages with DEBUG log level when passed in the factory settings.
|
|
51
35
|
*
|
|
@@ -73,12 +57,4 @@ declare module JsSdk {
|
|
|
73
57
|
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging}
|
|
74
58
|
*/
|
|
75
59
|
export function ErrorLogger(): SplitIO.ILogger;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Required to enable localhost mode when importing the SDK from the slim entry point of the library.
|
|
79
|
-
* It uses the mocked features map defined in the 'features' config object.
|
|
80
|
-
*
|
|
81
|
-
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode}
|
|
82
|
-
*/
|
|
83
|
-
export function LocalhostFromObject(): SplitIO.LocalhostFactory;
|
|
84
60
|
}
|
package/cjs/full/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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;
|
|
4
|
-
var splitFactory_1 = require("./splitFactory");
|
|
5
|
-
Object.defineProperty(exports, "SplitFactory", { enumerable: true, get: function () { return splitFactory_1.SplitFactory; } });
|
|
6
|
-
var index_1 = require("@splitsoftware/splitio-commons/cjs/storages/inLocalStorage/index");
|
|
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
|
-
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 pluggable_1 = require("@splitsoftware/splitio-commons/cjs/storages/pluggable");
|
|
21
|
-
Object.defineProperty(exports, "PluggableStorage", { enumerable: true, get: function () { return pluggable_1.PluggableStorage; } });
|
package/cjs/full/splitFactory.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SplitFactory = void 0;
|
|
4
|
-
var full_1 = require("../settings/full");
|
|
5
|
-
var getModules_1 = require("../platform/getModules");
|
|
6
|
-
var index_1 = require("@splitsoftware/splitio-commons/cjs/sdkFactory/index");
|
|
7
|
-
var getFetchFull_1 = require("../platform/getFetchFull");
|
|
8
|
-
var getEventSource_1 = require("../platform/getEventSource");
|
|
9
|
-
var MinEvents_1 = require("@splitsoftware/splitio-commons/cjs/utils/MinEvents");
|
|
10
|
-
var browser_1 = require("@splitsoftware/splitio-commons/cjs/utils/timeTracker/now/browser");
|
|
11
|
-
var platform = { getFetch: getFetchFull_1.getFetch, getEventSource: getEventSource_1.getEventSource, EventEmitter: MinEvents_1.EventEmitter, now: browser_1.now };
|
|
12
|
-
/**
|
|
13
|
-
* SplitFactory with pluggable modules for Browser.
|
|
14
|
-
* Includes localhost mode and fetch polyfill out-of-the-box.
|
|
15
|
-
*
|
|
16
|
-
* @param config configuration object used to instantiate the SDK
|
|
17
|
-
* @param __updateModules optional function that lets redefine internal SDK modules. Use with
|
|
18
|
-
* caution since, unlike `config`, this param is not validated neither considered part of the public API.
|
|
19
|
-
* @throws Will throw an error if the provided config is invalid.
|
|
20
|
-
*/
|
|
21
|
-
function SplitFactory(config, __updateModules) {
|
|
22
|
-
var settings = (0, full_1.settingsFactory)(config);
|
|
23
|
-
var modules = (0, getModules_1.getModules)(settings, platform);
|
|
24
|
-
if (__updateModules)
|
|
25
|
-
__updateModules(modules);
|
|
26
|
-
return (0, index_1.sdkFactory)(modules);
|
|
27
|
-
}
|
|
28
|
-
exports.SplitFactory = SplitFactory;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFetch = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var unfetch_1 = (0, tslib_1.__importDefault)(require("unfetch"));
|
|
6
|
-
function getFetch() {
|
|
7
|
-
return typeof fetch === 'function' ? fetch : unfetch_1.default;
|
|
8
|
-
}
|
|
9
|
-
exports.getFetch = getFetch;
|
package/cjs/settings/full.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.settingsFactory = void 0;
|
|
4
|
-
var index_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/index");
|
|
5
|
-
var defaults_1 = require("./defaults");
|
|
6
|
-
var runtime_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/runtime");
|
|
7
|
-
var storageCS_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/storage/storageCS");
|
|
8
|
-
var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/integrations/pluggable");
|
|
9
|
-
var pluggableLogger_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/logger/pluggableLogger");
|
|
10
|
-
var builtin_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/localhost/builtin");
|
|
11
|
-
var consent_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/consent");
|
|
12
|
-
var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
|
|
13
|
-
var params = {
|
|
14
|
-
defaults: defaults_1.defaults,
|
|
15
|
-
acceptKey: true,
|
|
16
|
-
runtime: runtime_1.validateRuntime,
|
|
17
|
-
storage: storageCS_1.validateStorageCS,
|
|
18
|
-
integrations: pluggable_1.validatePluggableIntegrations,
|
|
19
|
-
logger: pluggableLogger_1.validateLogger,
|
|
20
|
-
localhost: builtin_1.validateLocalhostWithDefault,
|
|
21
|
-
consent: consent_1.validateConsent,
|
|
22
|
-
};
|
|
23
|
-
function settingsFactory(config) {
|
|
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;
|
|
29
|
-
}
|
|
30
|
-
exports.settingsFactory = settingsFactory;
|