@splitsoftware/splitio-browserjs 1.0.0-rc.2 → 1.0.0-rc.3
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 +1 -2
- package/cjs/full/index.js +17 -0
- package/cjs/full/splitFactory.js +28 -0
- package/cjs/platform/getFetchFull.js +9 -0
- package/cjs/settings/defaults.js +1 -1
- package/cjs/settings/full.js +24 -0
- package/cjs/splitFactory.js +2 -2
- package/esm/full/index.js +7 -0
- package/esm/full/splitFactory.js +24 -0
- package/esm/platform/getFetchFull.js +4 -0
- package/esm/settings/defaults.js +1 -1
- package/esm/settings/full.js +20 -0
- package/esm/splitFactory.js +1 -1
- package/full/package.json +6 -0
- package/package.json +6 -4
- package/src/full/index.ts +7 -0
- package/src/full/splitFactory.ts +27 -0
- package/src/platform/getFetchFull.ts +6 -0
- package/src/settings/defaults.ts +1 -1
- package/src/settings/full.ts +23 -0
- package/src/splitFactory.ts +1 -1
- package/types/full/index.d.ts +62 -0
- package/types/index.d.ts +2 -2
- /package/cjs/{umd-full.js → full/umd.js} +0 -0
- /package/cjs/platform/{getFetch.js → getFetchSlim.js} +0 -0
- /package/esm/{umd-full.js → full/umd.js} +0 -0
- /package/esm/platform/{getFetch.js → getFetchSlim.js} +0 -0
- /package/src/{umd-full.ts → full/umd.ts} +0 -0
- /package/src/platform/{getFetch.ts → getFetchSlim.ts} +0 -0
package/CHANGES.txt
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
- Added `factory.destroy()` method, which invokes the `destroy` method of all clients created by the factory.
|
|
4
4
|
- Updated @splitsoftware/splitio-commons package to version 2.0.0 that includes major updates and updated some transitive dependencies for vulnerability fixes.
|
|
5
5
|
- BREAKING CHANGES:
|
|
6
|
-
- Renamed some TypeScript definitions in the SplitIO namespace to avoid conflicts with other
|
|
6
|
+
- Renamed some TypeScript definitions in the SplitIO namespace to avoid conflicts with other Split packages: `SplitIO.IBrowserSettings` to `SplitIO.IClientSideSettings`, `SplitIO.IBrowserAsyncSettings` to `SplitIO.IClientSideAsyncSettings`, `SplitIO.ISDK` to `SplitIO.IBrowserSDK`, and `SplitIO.IAsyncSDK` to `SplitIO.IBrowserAsyncSDK`.
|
|
7
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
8
|
- Removed the deprecated `GoogleAnalyticsToSplit` and `SplitToGoogleAnalytics` pluggable integration modules, along with the related interfaces in the TypeScript definitions.
|
|
9
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.
|
|
11
10
|
|
|
12
11
|
0.15.0 (September 13, 2024)
|
|
13
12
|
- Updated @splitsoftware/splitio-commons package to version 1.17.0 that includes minor updates:
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PluggableStorage = exports.DebugLogger = exports.InfoLogger = exports.WarnLogger = exports.ErrorLogger = 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 ErrorLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/ErrorLogger");
|
|
9
|
+
Object.defineProperty(exports, "ErrorLogger", { enumerable: true, get: function () { return ErrorLogger_1.ErrorLogger; } });
|
|
10
|
+
var WarnLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/WarnLogger");
|
|
11
|
+
Object.defineProperty(exports, "WarnLogger", { enumerable: true, get: function () { return WarnLogger_1.WarnLogger; } });
|
|
12
|
+
var InfoLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/InfoLogger");
|
|
13
|
+
Object.defineProperty(exports, "InfoLogger", { enumerable: true, get: function () { return InfoLogger_1.InfoLogger; } });
|
|
14
|
+
var DebugLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/DebugLogger");
|
|
15
|
+
Object.defineProperty(exports, "DebugLogger", { enumerable: true, get: function () { return DebugLogger_1.DebugLogger; } });
|
|
16
|
+
var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/storages/pluggable");
|
|
17
|
+
Object.defineProperty(exports, "PluggableStorage", { enumerable: true, get: function () { return pluggable_1.PluggableStorage; } });
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
* It includes a `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;
|
|
@@ -0,0 +1,9 @@
|
|
|
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/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 = '1.0.0-rc.
|
|
6
|
+
var packageVersion = '1.0.0-rc.3';
|
|
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'.
|
|
@@ -0,0 +1,24 @@
|
|
|
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 consent_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/consent");
|
|
11
|
+
var params = {
|
|
12
|
+
defaults: defaults_1.defaults,
|
|
13
|
+
acceptKey: true,
|
|
14
|
+
runtime: runtime_1.validateRuntime,
|
|
15
|
+
storage: storageCS_1.validateStorageCS,
|
|
16
|
+
integrations: pluggable_1.validatePluggableIntegrations,
|
|
17
|
+
logger: pluggableLogger_1.validateLogger,
|
|
18
|
+
consent: consent_1.validateConsent,
|
|
19
|
+
};
|
|
20
|
+
function settingsFactory(config) {
|
|
21
|
+
var settings = (0, index_1.settingsValidation)(config, params);
|
|
22
|
+
return settings;
|
|
23
|
+
}
|
|
24
|
+
exports.settingsFactory = settingsFactory;
|
package/cjs/splitFactory.js
CHANGED
|
@@ -4,11 +4,11 @@ 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 getFetchSlim_1 = require("./platform/getFetchSlim");
|
|
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: getFetchSlim_1.getFetch, getEventSource: getEventSource_1.getEventSource, EventEmitter: MinEvents_1.EventEmitter, now: browser_1.now };
|
|
12
12
|
/**
|
|
13
13
|
* SplitFactory with pluggable modules for Browser.
|
|
14
14
|
*
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { SplitFactory } from './splitFactory';
|
|
2
|
+
export { InLocalStorage } from '@splitsoftware/splitio-commons/esm/storages/inLocalStorage/index';
|
|
3
|
+
export { ErrorLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/ErrorLogger';
|
|
4
|
+
export { WarnLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/WarnLogger';
|
|
5
|
+
export { InfoLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/InfoLogger';
|
|
6
|
+
export { DebugLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/DebugLogger';
|
|
7
|
+
export { PluggableStorage } from '@splitsoftware/splitio-commons/esm/storages/pluggable';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { settingsFactory } from '../settings/full';
|
|
2
|
+
import { getModules } from '../platform/getModules';
|
|
3
|
+
import { sdkFactory } from '@splitsoftware/splitio-commons/esm/sdkFactory/index';
|
|
4
|
+
import { getFetch } from '../platform/getFetchFull';
|
|
5
|
+
import { getEventSource } from '../platform/getEventSource';
|
|
6
|
+
import { EventEmitter } from '@splitsoftware/splitio-commons/esm/utils/MinEvents';
|
|
7
|
+
import { now } from '@splitsoftware/splitio-commons/esm/utils/timeTracker/now/browser';
|
|
8
|
+
var platform = { getFetch: getFetch, getEventSource: getEventSource, EventEmitter: EventEmitter, now: now };
|
|
9
|
+
/**
|
|
10
|
+
* SplitFactory with pluggable modules for Browser.
|
|
11
|
+
* It includes a `fetch` polyfill out-of-the-box.
|
|
12
|
+
*
|
|
13
|
+
* @param config - configuration object used to instantiate the SDK
|
|
14
|
+
* @param __updateModules - optional function that lets redefine internal SDK modules. Use with
|
|
15
|
+
* caution since, unlike `config`, this param is not validated neither considered part of the public API.
|
|
16
|
+
* @throws Will throw an error if the provided config is invalid.
|
|
17
|
+
*/
|
|
18
|
+
export function SplitFactory(config, __updateModules) {
|
|
19
|
+
var settings = settingsFactory(config);
|
|
20
|
+
var modules = getModules(settings, platform);
|
|
21
|
+
if (__updateModules)
|
|
22
|
+
__updateModules(modules);
|
|
23
|
+
return sdkFactory(modules);
|
|
24
|
+
}
|
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 = '1.0.0-rc.
|
|
3
|
+
var packageVersion = '1.0.0-rc.3';
|
|
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'.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { settingsValidation } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/index';
|
|
2
|
+
import { defaults } from './defaults';
|
|
3
|
+
import { validateRuntime } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/runtime';
|
|
4
|
+
import { validateStorageCS } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/storage/storageCS';
|
|
5
|
+
import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/integrations/pluggable';
|
|
6
|
+
import { validateLogger } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/logger/pluggableLogger';
|
|
7
|
+
import { validateConsent } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/consent';
|
|
8
|
+
var params = {
|
|
9
|
+
defaults: defaults,
|
|
10
|
+
acceptKey: true,
|
|
11
|
+
runtime: validateRuntime,
|
|
12
|
+
storage: validateStorageCS,
|
|
13
|
+
integrations: validatePluggableIntegrations,
|
|
14
|
+
logger: validateLogger,
|
|
15
|
+
consent: validateConsent,
|
|
16
|
+
};
|
|
17
|
+
export function settingsFactory(config) {
|
|
18
|
+
var settings = settingsValidation(config, params);
|
|
19
|
+
return settings;
|
|
20
|
+
}
|
package/esm/splitFactory.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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/getFetchSlim';
|
|
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';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splitsoftware/splitio-browserjs",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.3",
|
|
4
4
|
"description": "Split SDK for JavaScript on Browser",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"cjs",
|
|
14
14
|
"esm",
|
|
15
15
|
"src",
|
|
16
|
-
"types"
|
|
16
|
+
"types",
|
|
17
|
+
"full"
|
|
17
18
|
],
|
|
18
19
|
"scripts": {
|
|
19
20
|
"check": "npm run check:lint && npm run check:types && npm run check:version",
|
|
@@ -58,8 +59,9 @@
|
|
|
58
59
|
"bugs": "https://github.com/splitio/javascript-browser-client/issues",
|
|
59
60
|
"homepage": "https://github.com/splitio/javascript-browser-client#readme",
|
|
60
61
|
"dependencies": {
|
|
61
|
-
"@splitsoftware/splitio-commons": "2.0.0-rc.
|
|
62
|
-
"tslib": "^2.3.1"
|
|
62
|
+
"@splitsoftware/splitio-commons": "2.0.0-rc.6",
|
|
63
|
+
"tslib": "^2.3.1",
|
|
64
|
+
"unfetch": "^4.2.0"
|
|
63
65
|
},
|
|
64
66
|
"devDependencies": {
|
|
65
67
|
"@rollup/plugin-commonjs": "^24.0.1",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { SplitFactory } from './splitFactory';
|
|
2
|
+
export { InLocalStorage } from '@splitsoftware/splitio-commons/src/storages/inLocalStorage/index';
|
|
3
|
+
export { ErrorLogger } from '@splitsoftware/splitio-commons/src/logger/browser/ErrorLogger';
|
|
4
|
+
export { WarnLogger } from '@splitsoftware/splitio-commons/src/logger/browser/WarnLogger';
|
|
5
|
+
export { InfoLogger } from '@splitsoftware/splitio-commons/src/logger/browser/InfoLogger';
|
|
6
|
+
export { DebugLogger } from '@splitsoftware/splitio-commons/src/logger/browser/DebugLogger';
|
|
7
|
+
export { PluggableStorage } from '@splitsoftware/splitio-commons/src/storages/pluggable';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type SplitIO from '@splitsoftware/splitio-commons/types/splitio';
|
|
2
|
+
import { settingsFactory } from '../settings/full';
|
|
3
|
+
import { getModules } from '../platform/getModules';
|
|
4
|
+
import { sdkFactory } from '@splitsoftware/splitio-commons/src/sdkFactory/index';
|
|
5
|
+
import { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types';
|
|
6
|
+
import { getFetch } from '../platform/getFetchFull';
|
|
7
|
+
import { getEventSource } from '../platform/getEventSource';
|
|
8
|
+
import { EventEmitter } from '@splitsoftware/splitio-commons/src/utils/MinEvents';
|
|
9
|
+
import { now } from '@splitsoftware/splitio-commons/src/utils/timeTracker/now/browser';
|
|
10
|
+
|
|
11
|
+
const platform = { getFetch, getEventSource, EventEmitter, now };
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* SplitFactory with pluggable modules for Browser.
|
|
15
|
+
* It includes a `fetch` polyfill out-of-the-box.
|
|
16
|
+
*
|
|
17
|
+
* @param config - configuration object used to instantiate the SDK
|
|
18
|
+
* @param __updateModules - optional function that lets redefine internal SDK modules. Use with
|
|
19
|
+
* caution since, unlike `config`, this param is not validated neither considered part of the public API.
|
|
20
|
+
* @throws Will throw an error if the provided config is invalid.
|
|
21
|
+
*/
|
|
22
|
+
export function SplitFactory(config: SplitIO.IClientSideSettings, __updateModules?: (modules: ISdkFactoryParams) => void) {
|
|
23
|
+
const settings = settingsFactory(config);
|
|
24
|
+
const modules = getModules(settings, platform);
|
|
25
|
+
if (__updateModules) __updateModules(modules);
|
|
26
|
+
return sdkFactory(modules);
|
|
27
|
+
}
|
package/src/settings/defaults.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type SplitIO from '@splitsoftware/splitio-commons/types/splitio';
|
|
|
2
2
|
import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/src/logger/index';
|
|
3
3
|
import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/src/utils/constants';
|
|
4
4
|
|
|
5
|
-
const packageVersion = '1.0.0-rc.
|
|
5
|
+
const packageVersion = '1.0.0-rc.3';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { settingsValidation } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/index';
|
|
2
|
+
import { defaults } from './defaults';
|
|
3
|
+
import { validateRuntime } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/runtime';
|
|
4
|
+
import { validateStorageCS } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/storage/storageCS';
|
|
5
|
+
import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/integrations/pluggable';
|
|
6
|
+
import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/pluggableLogger';
|
|
7
|
+
import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/consent';
|
|
8
|
+
|
|
9
|
+
const params = {
|
|
10
|
+
defaults,
|
|
11
|
+
acceptKey: true, // Client with bound key
|
|
12
|
+
runtime: validateRuntime,
|
|
13
|
+
storage: validateStorageCS,
|
|
14
|
+
integrations: validatePluggableIntegrations,
|
|
15
|
+
logger: validateLogger,
|
|
16
|
+
consent: validateConsent,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export function settingsFactory(config: any) {
|
|
20
|
+
const settings = settingsValidation(config, params);
|
|
21
|
+
|
|
22
|
+
return settings;
|
|
23
|
+
}
|
package/src/splitFactory.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { settingsFactory } from './settings';
|
|
|
3
3
|
import { getModules } from './platform/getModules';
|
|
4
4
|
import { sdkFactory } from '@splitsoftware/splitio-commons/src/sdkFactory/index';
|
|
5
5
|
import { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types';
|
|
6
|
-
import { getFetch } from './platform/
|
|
6
|
+
import { getFetch } from './platform/getFetchSlim';
|
|
7
7
|
import { getEventSource } from './platform/getEventSource';
|
|
8
8
|
import { EventEmitter } from '@splitsoftware/splitio-commons/src/utils/MinEvents';
|
|
9
9
|
import { now } from '@splitsoftware/splitio-commons/src/utils/timeTracker/now/browser';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Declaration file for JavaScript Browser Split Software SDK
|
|
2
|
+
// Project: http://www.split.io/
|
|
3
|
+
// Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>
|
|
4
|
+
|
|
5
|
+
import '@splitsoftware/splitio-commons';
|
|
6
|
+
|
|
7
|
+
export = JsSdk;
|
|
8
|
+
|
|
9
|
+
declare module JsSdk {
|
|
10
|
+
/**
|
|
11
|
+
* Full version of the Split.io SDK factory function.
|
|
12
|
+
*
|
|
13
|
+
* Unlike the default version, it includes a `fetch` polyfill to support old browsers @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#language-support}.
|
|
14
|
+
*
|
|
15
|
+
* The settings parameter should be an object that complies with the SplitIO.IClientSideSettings or SplitIO.IClientSideAsyncSettings interfaces.
|
|
16
|
+
* For more information read the corresponding article: @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#configuration}
|
|
17
|
+
*/
|
|
18
|
+
export function SplitFactory(settings: SplitIO.IClientSideSettings): SplitIO.IBrowserSDK;
|
|
19
|
+
export function SplitFactory(settings: SplitIO.IClientSideAsyncSettings): SplitIO.IBrowserAsyncSDK;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Persistent storage based on the LocalStorage Web API for browsers.
|
|
23
|
+
*
|
|
24
|
+
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#storage}
|
|
25
|
+
*/
|
|
26
|
+
export function InLocalStorage(options?: SplitIO.InLocalStorageOptions): SplitIO.StorageSyncFactory;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Pluggable storage to use the SDK in consumer mode.
|
|
30
|
+
*
|
|
31
|
+
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#sharing-state-with-a-pluggable-storage}
|
|
32
|
+
*/
|
|
33
|
+
export function PluggableStorage(options: SplitIO.PluggableStorageOptions): SplitIO.StorageAsyncFactory;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Creates a logger instance that enables descriptive log messages with DEBUG log level when passed in the factory settings.
|
|
37
|
+
*
|
|
38
|
+
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging}
|
|
39
|
+
*/
|
|
40
|
+
export function DebugLogger(): SplitIO.ILogger;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Creates a logger instance that enables descriptive log messages with INFO log level when passed in the factory settings.
|
|
44
|
+
*
|
|
45
|
+
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging}
|
|
46
|
+
*/
|
|
47
|
+
export function InfoLogger(): SplitIO.ILogger;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Creates a logger instance that enables descriptive log messages with WARN log level when passed in the factory settings.
|
|
51
|
+
*
|
|
52
|
+
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging}
|
|
53
|
+
*/
|
|
54
|
+
export function WarnLogger(): SplitIO.ILogger;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Creates a logger instance that enables descriptive log messages with ERROR log level when passed in the factory settings.
|
|
58
|
+
*
|
|
59
|
+
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging}
|
|
60
|
+
*/
|
|
61
|
+
export function ErrorLogger(): SplitIO.ILogger;
|
|
62
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ declare module JsSdk {
|
|
|
13
13
|
* The settings parameter should be an object that complies with the SplitIO.IClientSideSettings or SplitIO.IClientSideAsyncSettings interfaces.
|
|
14
14
|
* For more information read the corresponding article: @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#configuration}
|
|
15
15
|
*/
|
|
16
|
-
export function SplitFactory(settings: SplitIO.IClientSideSettings): SplitIO.
|
|
17
|
-
export function SplitFactory(settings: SplitIO.IClientSideAsyncSettings): SplitIO.
|
|
16
|
+
export function SplitFactory(settings: SplitIO.IClientSideSettings): SplitIO.IBrowserSDK;
|
|
17
|
+
export function SplitFactory(settings: SplitIO.IClientSideAsyncSettings): SplitIO.IBrowserAsyncSDK;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Persistent storage based on the LocalStorage Web API for browsers.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|