@splitsoftware/splitio-browserjs
Advanced tools
Comparing version 0.1.1-canary.1 to 0.1.1-canary.2
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SplitToGoogleAnalytics = exports.GoogleAnalyticsToSplit = exports.InLocalStorage = exports.SplitFactory = void 0; | ||
exports.LocalhostFromObject = exports.DebugLogger = exports.InfoLogger = exports.WarnLogger = exports.ErrorLogger = exports.SplitToGoogleAnalytics = exports.GoogleAnalyticsToSplit = exports.InLocalStorage = exports.SplitFactory = void 0; | ||
var splitFactory_1 = require("./splitFactory"); | ||
@@ -16,1 +16,11 @@ Object.defineProperty(exports, "SplitFactory", { enumerable: true, get: function () { return splitFactory_1.SplitFactory; } }); | ||
Object.defineProperty(exports, "SplitToGoogleAnalytics", { enumerable: true, get: function () { return __importDefault(SplitToGaPlugin_1).default; } }); | ||
var ErrorLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/ErrorLogger"); | ||
Object.defineProperty(exports, "ErrorLogger", { enumerable: true, get: function () { return ErrorLogger_1.ErrorLogger; } }); | ||
var WarnLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/WarnLogger"); | ||
Object.defineProperty(exports, "WarnLogger", { enumerable: true, get: function () { return WarnLogger_1.WarnLogger; } }); | ||
var InfoLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/InfoLogger"); | ||
Object.defineProperty(exports, "InfoLogger", { enumerable: true, get: function () { return InfoLogger_1.InfoLogger; } }); | ||
var DebugLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/DebugLogger"); | ||
Object.defineProperty(exports, "DebugLogger", { enumerable: true, get: function () { return DebugLogger_1.DebugLogger; } }); | ||
var syncManagerFromObject_1 = require("@splitsoftware/splitio-commons/cjs/sync/syncManagerFromObject"); | ||
Object.defineProperty(exports, "LocalhostFromObject", { enumerable: true, get: function () { return syncManagerFromObject_1.LocalhostFromObject; } }); |
@@ -6,4 +6,2 @@ "use strict"; | ||
var splitApi_1 = require("@splitsoftware/splitio-commons/cjs/services/splitApi"); | ||
var splitsParserFromSettings_1 = require("@splitsoftware/splitio-commons/cjs/sync/offline/splitsParser/splitsParserFromSettings"); | ||
var syncManagerOffline_1 = require("@splitsoftware/splitio-commons/cjs/sync/syncManagerOffline"); | ||
var syncManagerOnline_1 = require("@splitsoftware/splitio-commons/cjs/sync/syncManagerOnline"); | ||
@@ -17,20 +15,11 @@ var pushManager_1 = tslib_1.__importDefault(require("@splitsoftware/splitio-commons/cjs/sync/streaming/pushManager")); | ||
var pluggable_1 = tslib_1.__importDefault(require("@splitsoftware/splitio-commons/cjs/integrations/pluggable")); | ||
var MinEvents_1 = tslib_1.__importDefault(require("@splitsoftware/splitio-commons/cjs/utils/MinEvents")); | ||
var getFetch_1 = require("./getFetch"); | ||
var getEventSource_1 = require("./getEventSource"); | ||
var utils_1 = require("@splitsoftware/splitio-commons/cjs/trackers/impressionObserver/utils"); | ||
var browserPlatform = { | ||
getFetch: getFetch_1.getFetch, | ||
getEventSource: getEventSource_1.getEventSource, | ||
EventEmitter: MinEvents_1.default | ||
}; | ||
var syncManagerOfflineCSBrowserFactory = syncManagerOffline_1.syncManagerOfflineFactory(splitsParserFromSettings_1.splitsParserFromSettingsFactory); | ||
var syncManagerOnlineCSFactory = syncManagerOnline_1.syncManagerOnlineFactory(pollingManagerCS_1.default, pushManager_1.default); | ||
function getModules(settings) { | ||
function getModules(settings, platform) { | ||
return { | ||
settings: settings, | ||
platform: browserPlatform, | ||
platform: platform, | ||
storageFactory: settings.storage, | ||
splitApiFactory: settings.mode === 'localhost' ? undefined : splitApi_1.splitApiFactory, | ||
syncManagerFactory: settings.mode === 'localhost' ? syncManagerOfflineCSBrowserFactory : syncManagerOnlineCSFactory, | ||
syncManagerFactory: settings.mode === 'localhost' ? settings.sync.localhostMode : syncManagerOnlineCSFactory, | ||
sdkManagerFactory: index_1.sdkManagerFactory, | ||
@@ -37,0 +26,0 @@ sdkClientMethodFactory: sdkClientMethodCS_1.sdkClientMethodCSFactory, |
@@ -5,3 +5,3 @@ "use strict"; | ||
var index_1 = require("@splitsoftware/splitio-commons/cjs/logger/index"); | ||
var packageVersion = '0.1.1-canary.1'; | ||
var packageVersion = '0.1.1-canary.2'; | ||
/** | ||
@@ -8,0 +8,0 @@ * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item. |
@@ -8,3 +8,4 @@ "use strict"; | ||
var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/integrations/pluggable"); | ||
var builtinLogger_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/logger/builtinLogger"); | ||
var pluggableLogger_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/logger/pluggableLogger"); | ||
var localhost_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/localhost"); | ||
var params = { | ||
@@ -14,3 +15,5 @@ defaults: defaults_1.defaults, | ||
integrations: pluggable_1.validatePluggableIntegrations, | ||
logger: builtinLogger_1.validateLogger | ||
logger: pluggableLogger_1.validateLogger, | ||
// Slim SplitFactory validates that the localhost module is passed in localhost mode | ||
localhost: localhost_1.validateLocalhost | ||
}; | ||
@@ -17,0 +20,0 @@ function settingsValidator(config) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SplitFactory = void 0; | ||
var tslib_1 = require("tslib"); | ||
var settings_1 = require("./settings"); | ||
@@ -8,14 +9,19 @@ var getModules_1 = require("./platform/getModules"); | ||
var lang_1 = require("@splitsoftware/splitio-commons/cjs/utils/lang"); | ||
var getFetchSlim_1 = require("./platform/getFetchSlim"); | ||
var getEventSource_1 = require("./platform/getEventSource"); | ||
var MinEvents_1 = tslib_1.__importDefault(require("@splitsoftware/splitio-commons/cjs/utils/MinEvents")); | ||
var platform = { getFetch: getFetchSlim_1.getFetch, getEventSource: getEventSource_1.getEventSource, EventEmitter: MinEvents_1.default }; | ||
/** | ||
* SplitFactory with pluggable modules for Browser. | ||
* Includes localhost mode and logger. | ||
* Slim SplitFactory with pluggable modules for Browser. | ||
* Doesn't include localhost mode, verbose log messages and fetch ponyfill. | ||
* | ||
* @param config configuration object used to instantiates the SDK | ||
* @param customModules optional object of SDK modules to overwrite default ones. Use with caution since, unlike `config`, this param is not validated. | ||
* @throws Will throw an error if the provided config is invalid. | ||
*/ | ||
function SplitFactory(config, customModules) { | ||
var settings = settings_1.settingsValidator(config); | ||
var modules = getModules_1.getModules(settings); | ||
var modules = getModules_1.getModules(settings, platform); | ||
return index_1.sdkFactory(customModules ? lang_1.merge(modules, customModules) : modules); | ||
} | ||
exports.SplitFactory = SplitFactory; |
@@ -5,1 +5,6 @@ export { SplitFactory } from './splitFactory'; | ||
export { default as SplitToGoogleAnalytics } from '@splitsoftware/splitio-commons/esm/integrations/ga/SplitToGaPlugin'; | ||
export { ErrorLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/ErrorLogger'; | ||
export { WarnLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/WarnLogger'; | ||
export { InfoLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/InfoLogger'; | ||
export { DebugLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/DebugLogger'; | ||
export { LocalhostFromObject } from '@splitsoftware/splitio-commons/esm/sync/syncManagerFromObject'; |
import { splitApiFactory } from '@splitsoftware/splitio-commons/esm/services/splitApi'; | ||
import { splitsParserFromSettingsFactory } from '@splitsoftware/splitio-commons/esm/sync/offline/splitsParser/splitsParserFromSettings'; | ||
import { syncManagerOfflineFactory } from '@splitsoftware/splitio-commons/esm/sync/syncManagerOffline'; | ||
import { syncManagerOnlineFactory } from '@splitsoftware/splitio-commons/esm/sync/syncManagerOnline'; | ||
@@ -12,20 +10,11 @@ import pushManagerFactory from '@splitsoftware/splitio-commons/esm/sync/streaming/pushManager'; | ||
import integrationsManagerFactory from '@splitsoftware/splitio-commons/esm/integrations/pluggable'; | ||
import EventEmitter from '@splitsoftware/splitio-commons/esm/utils/MinEvents'; | ||
import { getFetch } from './getFetch'; | ||
import { getEventSource } from './getEventSource'; | ||
import { shouldAddPt } from '@splitsoftware/splitio-commons/esm/trackers/impressionObserver/utils'; | ||
var browserPlatform = { | ||
getFetch: getFetch, | ||
getEventSource: getEventSource, | ||
EventEmitter: EventEmitter | ||
}; | ||
var syncManagerOfflineCSBrowserFactory = syncManagerOfflineFactory(splitsParserFromSettingsFactory); | ||
var syncManagerOnlineCSFactory = syncManagerOnlineFactory(pollingManagerCSFactory, pushManagerFactory); | ||
export function getModules(settings) { | ||
export function getModules(settings, platform) { | ||
return { | ||
settings: settings, | ||
platform: browserPlatform, | ||
platform: platform, | ||
storageFactory: settings.storage, | ||
splitApiFactory: settings.mode === 'localhost' ? undefined : splitApiFactory, | ||
syncManagerFactory: settings.mode === 'localhost' ? syncManagerOfflineCSBrowserFactory : syncManagerOnlineCSFactory, | ||
syncManagerFactory: settings.mode === 'localhost' ? settings.sync.localhostMode : syncManagerOnlineCSFactory, | ||
sdkManagerFactory: sdkManagerFactory, | ||
@@ -32,0 +21,0 @@ sdkClientMethodFactory: sdkClientMethodCSFactory, |
import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/esm/logger/index'; | ||
var packageVersion = '0.1.1-canary.1'; | ||
var packageVersion = '0.1.1-canary.2'; | ||
/** | ||
@@ -4,0 +4,0 @@ * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item. |
@@ -5,3 +5,4 @@ import { settingsValidation } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/index'; | ||
import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/integrations/pluggable'; | ||
import { validateLogger } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/logger/builtinLogger'; | ||
import { validateLogger } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/logger/pluggableLogger'; | ||
import { validateLocalhost } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/localhost'; | ||
var params = { | ||
@@ -11,3 +12,5 @@ defaults: defaults, | ||
integrations: validatePluggableIntegrations, | ||
logger: validateLogger | ||
logger: validateLogger, | ||
// Slim SplitFactory validates that the localhost module is passed in localhost mode | ||
localhost: validateLocalhost | ||
}; | ||
@@ -14,0 +17,0 @@ export function settingsValidator(config) { |
@@ -5,13 +5,18 @@ import { settingsValidator } from './settings'; | ||
import { merge } from '@splitsoftware/splitio-commons/esm/utils/lang'; | ||
import { getFetch } from './platform/getFetchSlim'; | ||
import { getEventSource } from './platform/getEventSource'; | ||
import EventEmitter from '@splitsoftware/splitio-commons/esm/utils/MinEvents'; | ||
var platform = { getFetch: getFetch, getEventSource: getEventSource, EventEmitter: EventEmitter }; | ||
/** | ||
* SplitFactory with pluggable modules for Browser. | ||
* Includes localhost mode and logger. | ||
* Slim SplitFactory with pluggable modules for Browser. | ||
* Doesn't include localhost mode, verbose log messages and fetch ponyfill. | ||
* | ||
* @param config configuration object used to instantiates the SDK | ||
* @param customModules optional object of SDK modules to overwrite default ones. Use with caution since, unlike `config`, this param is not validated. | ||
* @throws Will throw an error if the provided config is invalid. | ||
*/ | ||
export function SplitFactory(config, customModules) { | ||
var settings = settingsValidator(config); | ||
var modules = getModules(settings); | ||
var modules = getModules(settings, platform); | ||
return sdkFactory(customModules ? merge(modules, customModules) : modules); | ||
} |
{ | ||
"name": "@splitsoftware/splitio-browserjs", | ||
"version": "0.1.1-canary.1", | ||
"version": "0.1.1-canary.2", | ||
"description": "Split SDK for Javascript on Browser", | ||
@@ -17,3 +17,3 @@ "main": "cjs/index.js", | ||
"types", | ||
"slim" | ||
"full" | ||
], | ||
@@ -28,4 +28,4 @@ "scripts": { | ||
"build:cjs": "rimraf cjs && tsc -outDir cjs -m CommonJS --importHelpers && ./scripts/build_cjs_replace_imports.sh", | ||
"build:umd": "rollup --config rollup.visualizer.config.js", | ||
"build:umd-ci": "rollup --config rollup.ci.config.js --branch=$BUILD_BRANCH --commit_hash=$BUILD_COMMIT", | ||
"build:umd-visualizer": "rollup --config rollup.visualizer.config.js", | ||
"build:umd": "rollup --config rollup.ci.config.js --branch=$BUILD_BRANCH --commit_hash=$BUILD_COMMIT", | ||
"test": "npm run test:unit && npm run test:e2e", | ||
@@ -65,3 +65,3 @@ "test:unit": "jest", | ||
"dependencies": { | ||
"@splitsoftware/splitio-commons": "0.1.1-canary.16", | ||
"@splitsoftware/splitio-commons": "0.1.1-rc.18", | ||
"@types/google.analytics": "0.0.40" | ||
@@ -73,2 +73,3 @@ }, | ||
"@rollup/plugin-node-resolve": "^8.0.1", | ||
"@types/jest": "^27.0.2", | ||
"@types/node-fetch": "^2.5.7", | ||
@@ -78,7 +79,6 @@ "@types/object-assign": "^4.0.30", | ||
"@typescript-eslint/parser": "^4.14.1", | ||
"rollup-plugin-ts": "^1.4.0", | ||
"eslint": "^7.18.0", | ||
"eslint-plugin-compat": "^3.9.0", | ||
"fetch-mock": "^9.11.0", | ||
"jest": "^26.6.3", | ||
"jest": "^27.2.3", | ||
"karma": "^6.3.2", | ||
@@ -88,3 +88,3 @@ "karma-chrome-launcher": "^3.1.0", | ||
"karma-tap": "^4.2.0", | ||
"replace": "^1.2.0", | ||
"replace": "^1.2.1", | ||
"rimraf": "^3.0.2", | ||
@@ -95,2 +95,3 @@ "rollup": "^2.35.1", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-ts": "^1.4.0", | ||
"rollup-plugin-visualizer": "^4.2.0", | ||
@@ -100,3 +101,3 @@ "sinon": "^9.2.2", | ||
"tape-catch": "1.0.6", | ||
"ts-jest": "^26.4.4", | ||
"ts-jest": "^27.0.5", | ||
"typescript": "^4.1.3", | ||
@@ -103,0 +104,0 @@ "unfetch": "^4.2.0" |
@@ -5,1 +5,6 @@ export { SplitFactory } from './splitFactory'; | ||
export { default as SplitToGoogleAnalytics } from '@splitsoftware/splitio-commons/src/integrations/ga/SplitToGaPlugin'; | ||
export { ErrorLogger } from '@splitsoftware/splitio-commons/src/logger/browser/ErrorLogger'; | ||
export { WarnLogger } from '@splitsoftware/splitio-commons/src/logger/browser/WarnLogger'; | ||
export { InfoLogger } from '@splitsoftware/splitio-commons/src/logger/browser/InfoLogger'; | ||
export { DebugLogger } from '@splitsoftware/splitio-commons/src/logger/browser/DebugLogger'; | ||
export { LocalhostFromObject } from '@splitsoftware/splitio-commons/src/sync/syncManagerFromObject'; |
import { splitApiFactory } from '@splitsoftware/splitio-commons/src/services/splitApi'; | ||
import { splitsParserFromSettingsFactory } from '@splitsoftware/splitio-commons/src/sync/offline/splitsParser/splitsParserFromSettings'; | ||
import { syncManagerOfflineFactory } from '@splitsoftware/splitio-commons/src/sync/syncManagerOffline'; | ||
import { syncManagerOnlineFactory } from '@splitsoftware/splitio-commons/src/sync/syncManagerOnline'; | ||
@@ -12,21 +10,10 @@ import pushManagerFactory from '@splitsoftware/splitio-commons/src/sync/streaming/pushManager'; | ||
import integrationsManagerFactory from '@splitsoftware/splitio-commons/src/integrations/pluggable'; | ||
import EventEmitter from '@splitsoftware/splitio-commons/src/utils/MinEvents'; | ||
import { getFetch } from './getFetch'; | ||
import { getEventSource } from './getEventSource'; | ||
import { shouldAddPt } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/utils'; | ||
import { ISettingsInternal } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/types'; | ||
import { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types'; | ||
import { SplitIO } from '@splitsoftware/splitio-commons/src/types'; | ||
import { IPlatform, ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types'; | ||
import { SplitIO, ISettings } from '@splitsoftware/splitio-commons/src/types'; | ||
const browserPlatform = { | ||
getFetch, | ||
getEventSource, | ||
EventEmitter | ||
}; | ||
const syncManagerOfflineCSBrowserFactory = syncManagerOfflineFactory(splitsParserFromSettingsFactory); | ||
const syncManagerOnlineCSFactory = syncManagerOnlineFactory(pollingManagerCSFactory, pushManagerFactory); | ||
export function getModules(settings: ISettingsInternal): ISdkFactoryParams { | ||
export function getModules(settings: ISettings, platform: IPlatform): ISdkFactoryParams { | ||
@@ -36,3 +23,3 @@ return { | ||
platform: browserPlatform, | ||
platform, | ||
@@ -43,3 +30,3 @@ storageFactory: settings.storage, | ||
syncManagerFactory: settings.mode === 'localhost' ? syncManagerOfflineCSBrowserFactory : syncManagerOnlineCSFactory, | ||
syncManagerFactory: settings.mode === 'localhost' ? settings.sync.localhostMode : syncManagerOnlineCSFactory, | ||
@@ -46,0 +33,0 @@ sdkManagerFactory, |
import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/src/logger/index'; | ||
import { LogLevel } from '@splitsoftware/splitio-commons/src/types'; | ||
const packageVersion = '0.1.1-canary.1'; | ||
const packageVersion = '0.1.1-canary.2'; | ||
@@ -6,0 +6,0 @@ /** |
@@ -5,3 +5,4 @@ import { settingsValidation } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/index'; | ||
import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/integrations/pluggable'; | ||
import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/builtinLogger'; | ||
import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/pluggableLogger'; | ||
import { validateLocalhost } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/localhost'; | ||
@@ -12,3 +13,5 @@ const params = { | ||
integrations: validatePluggableIntegrations, | ||
logger: validateLogger | ||
logger: validateLogger, | ||
// Slim SplitFactory validates that the localhost module is passed in localhost mode | ||
localhost: validateLocalhost | ||
}; | ||
@@ -15,0 +18,0 @@ |
@@ -6,14 +6,20 @@ import { settingsValidator } from './settings'; | ||
import { merge } from '@splitsoftware/splitio-commons/src/utils/lang'; | ||
import { getFetch } from './platform/getFetchSlim'; | ||
import { getEventSource } from './platform/getEventSource'; | ||
import EventEmitter from '@splitsoftware/splitio-commons/src/utils/MinEvents'; | ||
const platform = { getFetch, getEventSource, EventEmitter }; | ||
/** | ||
* SplitFactory with pluggable modules for Browser. | ||
* Includes localhost mode and logger. | ||
* Slim SplitFactory with pluggable modules for Browser. | ||
* Doesn't include localhost mode, verbose log messages and fetch ponyfill. | ||
* | ||
* @param config configuration object used to instantiates the SDK | ||
* @param customModules optional object of SDK modules to overwrite default ones. Use with caution since, unlike `config`, this param is not validated. | ||
* @throws Will throw an error if the provided config is invalid. | ||
*/ | ||
export function SplitFactory(config: any, customModules?: Partial<ISdkFactoryParams>) { | ||
const settings = settingsValidator(config); | ||
const modules = getModules(settings); | ||
const modules = getModules(settings, platform); | ||
return sdkFactory(customModules ? merge(modules, customModules) as ISdkFactoryParams : modules); | ||
} |
// @ts-nocheck | ||
import { SplitFactory } from './splitFactory'; | ||
import { InLocalStorage } from '@splitsoftware/splitio-commons/src/storages/inLocalStorage/index'; | ||
import { default as GoogleAnalyticsToSplit } from '@splitsoftware/splitio-commons/src/integrations/ga/GaToSplitPlugin'; | ||
import { default as SplitToGoogleAnalytics } from '@splitsoftware/splitio-commons/src/integrations/ga/SplitToGaPlugin'; | ||
import { ErrorLogger } from '@splitsoftware/splitio-commons/src/logger/browser/ErrorLogger'; | ||
import { WarnLogger } from '@splitsoftware/splitio-commons/src/logger/browser/WarnLogger'; | ||
import { InfoLogger } from '@splitsoftware/splitio-commons/src/logger/browser/InfoLogger'; | ||
import { DebugLogger } from '@splitsoftware/splitio-commons/src/logger/browser/DebugLogger'; | ||
// Include all pluggable modules as properties to expose at the global `splitio` object | ||
SplitFactory.SplitFactory = SplitFactory; | ||
SplitFactory.InLocalStorage = InLocalStorage; | ||
SplitFactory.GoogleAnalyticsToSplit = GoogleAnalyticsToSplit; | ||
SplitFactory.SplitToGoogleAnalytics = SplitToGoogleAnalytics; | ||
SplitFactory.ErrorLogger = ErrorLogger; | ||
SplitFactory.WarnLogger = WarnLogger; | ||
SplitFactory.InfoLogger = InfoLogger; | ||
SplitFactory.DebugLogger = DebugLogger; | ||
export default SplitFactory; |
@@ -10,3 +10,7 @@ // Declaration file for Javascript Browser Split Software SDK v1.0.0 | ||
/** | ||
* Split.io sdk factory function. | ||
* Slim version of the Split.io sdk factory function. | ||
* | ||
* Recommended to use for bundle size reduction in production, since it doesn't include localhost mode by default | ||
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode}. | ||
* | ||
* The settings parameter should be an object that complies with the SplitIO.IBrowserSettings. | ||
@@ -37,2 +41,39 @@ * For more information read the corresponding article: @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#configuration} | ||
export function SplitToGoogleAnalytics(options?: SplitIO.SplitToGoogleAnalyticsOptions): SplitIO.IntegrationFactory; | ||
/** | ||
* Creates a logger instance that enables descriptive log messages with DEBUG log level when passed in the factory settings. | ||
* | ||
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging} | ||
*/ | ||
export function DebugLogger(): SplitIO.ILogger; | ||
/** | ||
* Creates a logger instance that enables descriptive log messages with INFO log level when passed in the factory settings. | ||
* | ||
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging} | ||
*/ | ||
export function InfoLogger(): SplitIO.ILogger; | ||
/** | ||
* Creates a logger instance that enables descriptive log messages with WARN log level when passed in the factory settings. | ||
* | ||
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging} | ||
*/ | ||
export function WarnLogger(): SplitIO.ILogger; | ||
/** | ||
* Creates a logger instance that enables descriptive log messages with ERROR log level when passed in the factory settings. | ||
* | ||
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging} | ||
*/ | ||
export function ErrorLogger(): SplitIO.ILogger; | ||
/** | ||
* Required to enable localhost mode when importing the SDK from the slim entry point of the library. | ||
* It uses the mocked features map defined in the 'features' config object. | ||
* | ||
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode} | ||
*/ | ||
export function LocalhostFromObject(): SplitIO.LocalhostFactory; | ||
} |
@@ -36,2 +36,7 @@ // Type definitions for Javascript Browser Split Software SDK v1.0.0 | ||
/** | ||
* Storage types. | ||
* @typedef {string} StorageType | ||
*/ | ||
type StorageType = 'MEMORY' | 'LOCALSTORAGE'; | ||
/** | ||
* Settings interface. This is a representation of the settings the SDK expose, that's why | ||
@@ -125,5 +130,11 @@ * most of it's props are readonly. Only features should be rewritten when localhost mode is active. | ||
* Boolean value to indicate whether the logger should be enabled or disabled by default, or a log level string or a Logger object. | ||
* Passing a logger object is required when using the slim version of the SDK in order to get descriptive log messages. Otherwise most logs will print with message codes. | ||
* Passing a logger object is required to get descriptive log messages. Otherwise most logs will print with message codes. | ||
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging} | ||
* | ||
* Examples: | ||
* ```typescript | ||
* config.debug = true | ||
* config.debug = 'WARN' | ||
* config.debug = ErrorLogger() | ||
* ``` | ||
* @property {boolean | LogLevel | ILogger} debug | ||
@@ -157,2 +168,3 @@ * @default false | ||
* At the moment, two types of split filters are supported: by name and by prefix. | ||
* | ||
* Example: | ||
@@ -175,2 +187,18 @@ * `splitFilter: [ | ||
impressionsMode?: SplitIO.ImpressionsMode, | ||
/** | ||
* Defines the factory function to instanciate the SDK in localhost mode. | ||
* NOTE: this is only required if using the slim entry point of the library to init the SDK in localhost mode. | ||
* For more information @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode} | ||
* | ||
* Example: | ||
* ```typescript | ||
* config: { | ||
* sync: { | ||
* localhostMode: LocalhostFromObject() | ||
* } | ||
* } | ||
* ``` | ||
* @property {Object} localhostMode | ||
*/ | ||
localhostMode?: SplitIO.LocalhostFactory | ||
} | ||
@@ -343,2 +371,7 @@ } | ||
/** | ||
* Localhost types. | ||
* @typedef {string} LocalhostType | ||
*/ | ||
type LocalhostType = 'FROM_OBJECT' | 'FROM_FILE' | ||
/** | ||
* Object with information about an impression. It contains the generated impression DTO as well as | ||
@@ -437,3 +470,6 @@ * complementary information around where and how it was generated in that way. | ||
*/ | ||
type StorageSyncFactory = (params: {}) => (StorageSync | undefined) | ||
type StorageSyncFactory = { | ||
type: StorageType | ||
(params: {}): (StorageSync | undefined) | ||
} | ||
/** | ||
@@ -451,2 +487,10 @@ * Configuration params for InLocalStorage plugable storage | ||
/** | ||
* Localhost mode factory. | ||
* Its interface details are not part of the public API. | ||
*/ | ||
type LocalhostFactory = { | ||
type: LocalhostType | ||
(params: {}): {} | ||
} | ||
/** | ||
* Impression listener interface. This is the interface that needs to be implemented | ||
@@ -788,2 +832,9 @@ * by the element you provide to the SDK as impression listener. | ||
* Defines the factory function to instanciate the storage. If not provided, the default IN MEMORY storage is used. | ||
* | ||
* Example: | ||
* ```typescript | ||
* config: { | ||
* storage: InLocalStorage() | ||
* } | ||
* ``` | ||
* @property {Object} storage | ||
@@ -800,2 +851,9 @@ */ | ||
* Defines an optional list of factory functions used to instantiate SDK integrations. | ||
* | ||
* Example: | ||
* ```typescript | ||
* config: { | ||
* integrations: [SplitToGoogleAnalytics(), GoogleAnalyticsToSplit()] | ||
* } | ||
* ``` | ||
* @property {Object} integrations | ||
@@ -802,0 +860,0 @@ */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1793
99860
30
44
+ Added@splitsoftware/splitio-commons@0.1.1-rc.18(transitive)
- Removed@splitsoftware/splitio-commons@0.1.1-canary.16(transitive)