@splitsoftware/splitio-browserjs
Advanced tools
Comparing version 0.0.1-beta.2 to 0.0.1-beta.3
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SplitToGoogleAnalytics = exports.GoogleAnalyticsToSplit = exports.InLocalStorage = exports.SplitFactory = void 0; | ||
exports.DebugLogger = exports.InfoLogger = exports.WarnLogger = exports.ErrorLogger = exports.SplitToGoogleAnalytics = exports.GoogleAnalyticsToSplit = exports.InLocalStorage = exports.SplitFactory = void 0; | ||
var splitFactoryMinOnline_1 = require("./splitFactoryMinOnline"); | ||
@@ -16,1 +16,9 @@ Object.defineProperty(exports, "SplitFactory", { enumerable: true, get: function () { return splitFactoryMinOnline_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; } }); |
@@ -9,2 +9,3 @@ "use strict"; | ||
var pollingManagerCS_1 = tslib_1.__importDefault(require("@splitsoftware/splitio-commons/cjs/sync/polling/pollingManagerCS")); | ||
var index_1 = require("@splitsoftware/splitio-commons/cjs/sdkManager/index"); | ||
var sdkClientMethodCS_1 = require("@splitsoftware/splitio-commons/cjs/sdkClient/sdkClientMethodCS"); | ||
@@ -31,2 +32,3 @@ var browser_1 = tslib_1.__importDefault(require("@splitsoftware/splitio-commons/cjs/listeners/browser")); | ||
syncManagerFactory: syncManagerOnlineCSFactory, | ||
sdkManagerFactory: index_1.sdkManagerFactory, | ||
sdkClientMethodFactory: sdkClientMethodCS_1.sdkClientMethodCSFactory, | ||
@@ -33,0 +35,0 @@ SignalListener: browser_1.default, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var packageVersion = '0.0.1-beta.2'; | ||
var index_1 = require("@splitsoftware/splitio-commons/cjs/logger/index"); | ||
var packageVersion = '0.0.1-beta.3'; | ||
/** | ||
* In browser, the default debug level, can be set via the `localStorage.splitio_debug` item. | ||
* Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'. | ||
* Other acceptable values are 'on', 'enable' and 'enabled', which are equivalent to 'DEBUG'. | ||
* Any other string value is equivalent to disable ('NONE'). | ||
*/ | ||
var initialLogLevel; | ||
var LS_KEY = 'splitio_debug'; | ||
try { | ||
var initialState = localStorage.getItem(LS_KEY) || ''; | ||
// Kept to avoid a breaking change ('on', 'enable' and 'enabled' are equivalent) | ||
initialLogLevel = /^(enabled?|on)/i.test(initialState) ? index_1.LogLevels.DEBUG : index_1.isLogLevelString(initialState) ? initialState : index_1.LogLevels.NONE; | ||
// eslint-disable-next-line no-empty | ||
} | ||
catch (_a) { } | ||
exports.default = { | ||
@@ -16,3 +32,4 @@ startup: { | ||
// Instance version. | ||
version: "browserjs-" + packageVersion | ||
version: "browserjs-" + packageVersion, | ||
debug: initialLogLevel | ||
}; |
@@ -9,2 +9,3 @@ "use strict"; | ||
var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/integrations/pluggable"); | ||
var pluggableLogger_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/logger/pluggableLogger"); | ||
var params = { | ||
@@ -14,3 +15,4 @@ defaults: defaults_1.default, | ||
storage: storageCS_1.validateStorageCS, | ||
integrations: pluggable_1.validatePluggableIntegrations | ||
integrations: pluggable_1.validatePluggableIntegrations, | ||
logger: pluggableLogger_1.validateLogger | ||
}; | ||
@@ -17,0 +19,0 @@ function browserSettingsValidator(config) { |
@@ -5,1 +5,5 @@ export { SplitFactory } from './splitFactoryMinOnline'; | ||
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'; |
@@ -5,2 +5,3 @@ import { splitApiFactory } from '@splitsoftware/splitio-commons/esm/services/splitApi'; | ||
import pollingManagerCSFactory from '@splitsoftware/splitio-commons/esm/sync/polling/pollingManagerCS'; | ||
import { sdkManagerFactory } from '@splitsoftware/splitio-commons/esm/sdkManager/index'; | ||
import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/esm/sdkClient/sdkClientMethodCS'; | ||
@@ -27,2 +28,3 @@ import BrowserSignalListener from '@splitsoftware/splitio-commons/esm/listeners/browser'; | ||
syncManagerFactory: syncManagerOnlineCSFactory, | ||
sdkManagerFactory: sdkManagerFactory, | ||
sdkClientMethodFactory: sdkClientMethodCSFactory, | ||
@@ -29,0 +31,0 @@ SignalListener: BrowserSignalListener, |
@@ -1,2 +0,18 @@ | ||
var packageVersion = '0.0.1-beta.2'; | ||
import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/esm/logger/index'; | ||
var packageVersion = '0.0.1-beta.3'; | ||
/** | ||
* In browser, the default debug level, can be set via the `localStorage.splitio_debug` item. | ||
* Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'. | ||
* Other acceptable values are 'on', 'enable' and 'enabled', which are equivalent to 'DEBUG'. | ||
* Any other string value is equivalent to disable ('NONE'). | ||
*/ | ||
var initialLogLevel; | ||
var LS_KEY = 'splitio_debug'; | ||
try { | ||
var initialState = localStorage.getItem(LS_KEY) || ''; | ||
// Kept to avoid a breaking change ('on', 'enable' and 'enabled' are equivalent) | ||
initialLogLevel = /^(enabled?|on)/i.test(initialState) ? LogLevels.DEBUG : isLogLevelString(initialState) ? initialState : LogLevels.NONE; | ||
// eslint-disable-next-line no-empty | ||
} | ||
catch (_a) { } | ||
export default { | ||
@@ -14,3 +30,4 @@ startup: { | ||
// Instance version. | ||
version: "browserjs-" + packageVersion | ||
version: "browserjs-" + packageVersion, | ||
debug: initialLogLevel | ||
}; |
@@ -6,2 +6,3 @@ 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/pluggableLogger'; | ||
var params = { | ||
@@ -11,3 +12,4 @@ defaults: defaults, | ||
storage: validateStorageCS, | ||
integrations: validatePluggableIntegrations | ||
integrations: validatePluggableIntegrations, | ||
logger: validateLogger | ||
}; | ||
@@ -14,0 +16,0 @@ export default function browserSettingsValidator(config) { |
{ | ||
"name": "@splitsoftware/splitio-browserjs", | ||
"version": "0.0.1-beta.2", | ||
"version": "0.0.1-beta.3", | ||
"description": "Split SDK for Javascript on Browser", | ||
@@ -30,5 +30,6 @@ "main": "cjs/index.js", | ||
"test:unit": "jest", | ||
"test:e2e": "npm run test:e2e-offline && npm run test:e2e-online && npm run test:e2e-destroy && npm run test:e2e-errors && npm run test:e2e-push && npm run test:e2e-gaintegration", | ||
"test:e2e": "npm run test:e2e-logger && npm run test:e2e-offline && npm run test:e2e-online && npm run test:e2e-destroy && npm run test:e2e-errors && npm run test:e2e-push && npm run test:e2e-gaintegration", | ||
"test:e2e-logger": "karma start karma/e2e.logger.karma.conf.js", | ||
"test:e2e-offline": "karma start karma/e2e.offline.karma.conf.js", | ||
"test:e2e-online": "karma start karma/e2e.online.karma.conf.js", | ||
"test:e2e-offline": "karma start karma/e2e.offline.karma.conf.js", | ||
"test:e2e-destroy": "karma start karma/e2e.destroy.karma.conf.js", | ||
@@ -62,3 +63,3 @@ "test:e2e-errors": "karma start karma/e2e.errors.karma.conf.js", | ||
"dependencies": { | ||
"@splitsoftware/splitio-commons": "0.0.1-beta.2", | ||
"@splitsoftware/splitio-commons": "0.0.1-beta.3", | ||
"@types/google.analytics": "0.0.40" | ||
@@ -65,0 +66,0 @@ }, |
@@ -5,1 +5,5 @@ export { SplitFactory } from './splitFactoryMinOnline'; | ||
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'; |
@@ -40,7 +40,11 @@ import { splitApiFactory } from '@splitsoftware/splitio-commons/src/services/splitApi'; | ||
splitApiFactory: settings.mode === 'localhost' ? undefined : splitApiFactory, | ||
syncManagerFactory: settings.mode === 'localhost' ? syncManagerOfflineCSBrowserFactory : syncManagerOnlineCSFactory, | ||
sdkManagerFactory, | ||
sdkClientMethodFactory: sdkClientMethodCSFactory, | ||
SignalListener: settings.mode === 'localhost' ? undefined : BrowserSignalListener as ISdkFactoryParams['SignalListener'], | ||
impressionListener: settings.impressionListener as SplitIO.IImpressionListener, | ||
@@ -47,0 +51,0 @@ |
import splitsParserFromSettings from '@splitsoftware/splitio-commons/src/sync/offline/splitsParser/splitsParserFromSettings'; | ||
import { syncManagerOfflineFactory } from '@splitsoftware/splitio-commons/src/sync/syncManagerOffline'; | ||
import { sdkManagerFactory } from '@splitsoftware/splitio-commons/src/sdkManager/index'; | ||
import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/src/sdkClient/sdkClientMethodCS'; | ||
@@ -27,2 +28,4 @@ import EventEmitter from '@splitsoftware/splitio-commons/src/utils/MinEvents'; | ||
sdkManagerFactory, | ||
sdkClientMethodFactory: sdkClientMethodCSFactory, | ||
@@ -29,0 +32,0 @@ |
@@ -5,2 +5,3 @@ import { splitApiFactory } from '@splitsoftware/splitio-commons/src/services/splitApi'; | ||
import pollingManagerCSFactory from '@splitsoftware/splitio-commons/src/sync/polling/pollingManagerCS'; | ||
import { sdkManagerFactory } from '@splitsoftware/splitio-commons/src/sdkManager/index'; | ||
import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/src/sdkClient/sdkClientMethodCS'; | ||
@@ -40,2 +41,4 @@ import BrowserSignalListener from '@splitsoftware/splitio-commons/src/listeners/browser'; | ||
sdkManagerFactory, | ||
sdkClientMethodFactory: sdkClientMethodCSFactory, | ||
@@ -42,0 +45,0 @@ |
@@ -1,3 +0,23 @@ | ||
const packageVersion = '0.0.1-beta.2'; | ||
import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/src/logger/index'; | ||
import { LogLevel } from '@splitsoftware/splitio-commons/src/types'; | ||
const packageVersion = '0.0.1-beta.3'; | ||
/** | ||
* In browser, the default debug level, can be set via the `localStorage.splitio_debug` item. | ||
* Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'. | ||
* Other acceptable values are 'on', 'enable' and 'enabled', which are equivalent to 'DEBUG'. | ||
* Any other string value is equivalent to disable ('NONE'). | ||
*/ | ||
let initialLogLevel: LogLevel | undefined; | ||
const LS_KEY = 'splitio_debug'; | ||
try { | ||
const initialState = localStorage.getItem(LS_KEY) || ''; | ||
// Kept to avoid a breaking change ('on', 'enable' and 'enabled' are equivalent) | ||
initialLogLevel = /^(enabled?|on)/i.test(initialState) ? LogLevels.DEBUG : isLogLevelString(initialState) ? initialState : LogLevels.NONE; | ||
// eslint-disable-next-line no-empty | ||
} catch { } | ||
export default { | ||
@@ -16,3 +36,5 @@ startup: { | ||
// Instance version. | ||
version: `browserjs-${packageVersion}` | ||
version: `browserjs-${packageVersion}`, | ||
debug: initialLogLevel | ||
}; |
@@ -6,2 +6,3 @@ 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/pluggableLogger'; | ||
@@ -12,3 +13,4 @@ const params = { | ||
storage: validateStorageCS, | ||
integrations: validatePluggableIntegrations | ||
integrations: validatePluggableIntegrations, | ||
logger: validateLogger | ||
}; | ||
@@ -15,0 +17,0 @@ |
@@ -6,2 +6,6 @@ // @ts-nocheck | ||
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'; | ||
@@ -13,3 +17,7 @@ // Include all pluggable modules as properties to expose at the global `splitio` object | ||
SplitFactory.SplitToGoogleAnalytics = SplitToGoogleAnalytics; | ||
SplitFactory.ErrorLogger = ErrorLogger; | ||
SplitFactory.WarnLogger = WarnLogger; | ||
SplitFactory.InfoLogger = InfoLogger; | ||
SplitFactory.DebugLogger = DebugLogger; | ||
export default SplitFactory; |
@@ -11,3 +11,3 @@ // Declaration file for Javascript Browser Split Software SDK v1.0.0 | ||
* Split.io sdk factory function. | ||
* The settings parameter should be an object that complies with the SplitIO.IClientSideSettings. | ||
* The settings parameter should be an object that complies with the SplitIO.IBrowserSettings. | ||
* For more information read the corresponding article: @see {@link @TODO} | ||
@@ -35,2 +35,31 @@ */ | ||
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/360020448791-JavaScript-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/360020448791-JavaScript-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/360020448791-JavaScript-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/360020448791-JavaScript-SDK#logging} | ||
*/ | ||
export function ErrorLogger(): SplitIO.ILogger; | ||
} |
@@ -69,3 +69,3 @@ // Type definitions for Javascript Browser Split Software SDK v1.0.0 | ||
readonly integrations?: SplitIO.IntegrationFactory[], | ||
readonly debug: boolean, | ||
readonly debug: boolean | SplitIO.ILogger, | ||
readonly version: string, | ||
@@ -119,7 +119,10 @@ readonly streamingEnabled: boolean, | ||
/** | ||
* Whether the logger should be enabled or disabled by default. | ||
* @property {Boolean} debug | ||
* Boolean value to indicate whether the logger should be enabled or disabled by default, or a Logger object. | ||
* 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/360020448791-JavaScript-SDK#logging} | ||
* | ||
* @property {boolean | ILogger} debug | ||
* @default false | ||
*/ | ||
debug?: boolean, | ||
debug?: boolean | SplitIO.ILogger, | ||
/** | ||
@@ -641,2 +644,10 @@ * The impression listener, which is optional. Whatever you provide here needs to comply with the SplitIO.IImpressionListener interface, | ||
*/ | ||
/** | ||
* Logger | ||
* Its interface details are not part of the public API. It shouldn't be used directly. | ||
* @interface ILogger | ||
*/ | ||
interface ILogger { | ||
setLogLevel(logLevel: LogLevel): void | ||
} | ||
interface IBrowserSettings extends ISharedSettings { | ||
@@ -782,5 +793,4 @@ /** | ||
* @returns {IManager} The manager instance. | ||
* @todo at the moment it returns undefined, until the manager module could be plugged in. | ||
*/ | ||
manager(): undefined | ||
manager(): IManager | ||
} | ||
@@ -787,0 +797,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
84564
1552
+ Added@splitsoftware/splitio-commons@0.0.1-beta.3(transitive)
- Removed@splitsoftware/splitio-commons@0.0.1-beta.2(transitive)