Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@devcycle/js-client-sdk

Package Overview
Dependencies
Maintainers
6
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devcycle/js-client-sdk - npm Package Compare versions

Comparing version 1.16.0 to 1.16.1

4

package.json
{
"name": "@devcycle/js-client-sdk",
"version": "1.16.0",
"version": "1.16.1",
"description": "The Javascript Client SDK for DevCycle",

@@ -17,3 +17,3 @@ "author": "",

"dependencies": {
"@devcycle/types": "^1.4.0",
"@devcycle/types": "^1.4.1",
"axios": "^1.0.0",

@@ -20,0 +20,0 @@ "axios-retry": "^3.3.1",

@@ -43,2 +43,3 @@ import { DVCFeatureSet, DevCycleOptions, DVCVariableSet, DVCVariableValue, DevCycleEvent, DevCycleUser, ErrorCallback, DVCFeature, VariableDefinitions } from './types';

private windowPageHideHandler?;
private configRefetchHandler;
constructor(sdkKey: string, options: DevCycleOptionsWithDeferredInitialization);

@@ -161,2 +162,11 @@ constructor(sdkKey: string, user: DevCycleUser, options?: DevCycleOptions);

get closing(): boolean;
/**
* Method to be called by the Isomorphic SDKs to update the bootstrapped config and user data when the server's
* representation has changed.
* NOTE: It is not recommended to call this yourself.
* @param config
* @param user
* @param userAgent
*/
synchronizeBootstrapData(config: BucketedUserConfig, user: DevCycleUser, userAgent?: string): void;
private refetchConfig;

@@ -163,0 +173,0 @@ private handleConfigReceived;

@@ -74,2 +74,3 @@ "use strict";

var _this = this;
var _a;
this._isInitialized = false;

@@ -168,2 +169,5 @@ this.userSaved = false;

}
if ((_a = options.next) === null || _a === void 0 ? void 0 : _a.configRefreshHandler) {
this.configRefetchHandler = options.next.configRefreshHandler;
}
this.logger =

@@ -488,2 +492,19 @@ options.logger || (0, logger_1.dvcDefaultLogger)({ level: options.logLevel });

});
/**
* Method to be called by the Isomorphic SDKs to update the bootstrapped config and user data when the server's
* representation has changed.
* NOTE: It is not recommended to call this yourself.
* @param config
* @param user
* @param userAgent
*/
DevCycleClient.prototype.synchronizeBootstrapData = function (config, user, userAgent) {
this.options.bootstrapConfig = config;
if (this.options.deferInitialization && !this.initializeTriggered) {
void this.clientInitialization(user);
return;
}
var populatedUser = new User_1.DVCPopulatedUser(user, this.options, undefined, undefined, userAgent);
this.handleConfigReceived(config, populatedUser, Date.now());
};
DevCycleClient.prototype.refetchConfig = function (sse, lastModified, etag) {

@@ -496,6 +517,14 @@ return __awaiter(this, void 0, void 0, function () {

_a.sent();
return [4 /*yield*/, this.requestConsolidator.queue(null, { sse: sse, lastModified: lastModified, etag: etag })];
case 2:
if (!this.configRefetchHandler) return [3 /*break*/, 2];
this.configRefetchHandler(lastModified);
return [3 /*break*/, 4];
case 2: return [4 /*yield*/, this.requestConsolidator.queue(null, {
sse: sse,
lastModified: lastModified,
etag: etag,
})];
case 3:
_a.sent();
return [2 /*return*/];
_a.label = 4;
case 4: return [2 /*return*/];
}

@@ -502,0 +531,0 @@ });

@@ -29,2 +29,3 @@ import { DevCycleEvent, DevCycleOptions, DevCycleUser, VariableDefinitions } from './types';

export declare function initializeDevCycle<Variables extends VariableDefinitions = VariableDefinitions>(sdkKey: string, user: DevCycleUser, options?: DevCycleOptions): DevCycleClient<Variables>;
export { DVCPopulatedUser } from './User';
/**

@@ -31,0 +32,0 @@ * @deprecated Use initializeDevCycle instead

@@ -17,3 +17,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.initialize = exports.initializeDevCycle = exports.DevCycleClient = exports.dvcDefaultLogger = void 0;
exports.initialize = exports.DVCPopulatedUser = exports.initializeDevCycle = exports.DevCycleClient = exports.dvcDefaultLogger = void 0;
var Client_1 = require("./Client");

@@ -26,6 +26,2 @@ Object.defineProperty(exports, "DevCycleClient", { enumerable: true, get: function () { return Client_1.DevCycleClient; } });

if (optionsArg === void 0) { optionsArg = {}; }
// TODO: implement logger
if (typeof window === 'undefined') {
console.warn('Window is not defined, try initializing in a browser context');
}
var options = optionsArg;

@@ -37,2 +33,6 @@ var isDeferred = false;

}
// TODO: implement logger
if (typeof window === 'undefined' && !options.next) {
console.warn('Window is not defined, try initializing in a browser context');
}
if (typeof window !== 'undefined' &&

@@ -73,2 +73,4 @@ !window.addEventListener &&

exports.initializeDevCycle = initializeDevCycle;
var User_1 = require("./User");
Object.defineProperty(exports, "DVCPopulatedUser", { enumerable: true, get: function () { return User_1.DVCPopulatedUser; } });
/**

@@ -75,0 +77,0 @@ * @deprecated Use initializeDevCycle instead

@@ -95,2 +95,8 @@ import { DVCLogger, DVCDefaultLogLevel, VariableTypeAlias, VariableValue, DVCJSON, DVCCustomDataJSON, BucketedUserConfig } from '@devcycle/types';

bootstrapConfig?: BucketedUserConfig;
/**
* options set by Next SDK. Not for direct use.
*/
next?: {
configRefreshHandler?: (lastModifiedDate?: number) => void;
};
}

@@ -97,0 +103,0 @@ export interface DevCycleUser {

@@ -21,3 +21,3 @@ import { DevCycleOptions, DevCycleUser, DVCCustomDataJSON } from './types';

readonly sdkVersion: string;
constructor(user: DevCycleUser, options: DevCycleOptions, staticData?: StaticData, anonymousUserId?: string);
constructor(user: DevCycleUser, options: DevCycleOptions, staticData?: StaticData, anonymousUserId?: string, headerUserAgent?: string);
getStaticData(): StaticData;

@@ -24,0 +24,0 @@ updateUser(user: DevCycleUser, options: DevCycleOptions): DVCPopulatedUser;

@@ -11,3 +11,3 @@ "use strict";

var DVCPopulatedUser = /** @class */ (function () {
function DVCPopulatedUser(user, options, staticData, anonymousUserId) {
function DVCPopulatedUser(user, options, staticData, anonymousUserId, headerUserAgent) {
var _a;

@@ -31,2 +31,5 @@ if (((_a = user.user_id) === null || _a === void 0 ? void 0 : _a.trim()) === '') {

this.lastSeenDate = new Date();
var userAgentString = typeof window !== 'undefined'
? window.navigator.userAgent
: headerUserAgent;
/**

@@ -39,5 +42,3 @@ * Read only properties initialized once

else {
var userAgent = new ua_parser_js_1.default(typeof window !== 'undefined'
? window.navigator.userAgent
: undefined);
var userAgent = new ua_parser_js_1.default(userAgentString);
var platformVersion = userAgent.getBrowser().name &&

@@ -51,5 +52,3 @@ "".concat(userAgent.getBrowser().name, " ").concat(userAgent.getBrowser().version);

? globalThis.DeviceInfo.getModel()
: typeof window !== 'undefined'
? window.navigator.userAgent
: 'SSR - unknown';
: userAgentString !== null && userAgentString !== void 0 ? userAgentString : 'SSR - unknown';
this.sdkType = 'client';

@@ -56,0 +55,0 @@ this.sdkVersion = package_json_1.default.version;

@@ -43,2 +43,3 @@ import { DVCFeatureSet, DevCycleOptions, DVCVariableSet, DVCVariableValue, DevCycleEvent, DevCycleUser, ErrorCallback, DVCFeature, VariableDefinitions } from './types';

private windowPageHideHandler?;
private configRefetchHandler;
constructor(sdkKey: string, options: DevCycleOptionsWithDeferredInitialization);

@@ -161,2 +162,11 @@ constructor(sdkKey: string, user: DevCycleUser, options?: DevCycleOptions);

readonly closing: boolean;
/**
* Method to be called by the Isomorphic SDKs to update the bootstrapped config and user data when the server's
* representation has changed.
* NOTE: It is not recommended to call this yourself.
* @param config
* @param user
* @param userAgent
*/
synchronizeBootstrapData(config: BucketedUserConfig, user: DevCycleUser, userAgent?: string): void;
private refetchConfig;

@@ -163,0 +173,0 @@ private handleConfigReceived;

@@ -29,2 +29,3 @@ import { DevCycleEvent, DevCycleOptions, DevCycleUser, VariableDefinitions } from './types';

export declare function initializeDevCycle<Variables extends VariableDefinitions = VariableDefinitions>(sdkKey: string, user: DevCycleUser, options?: DevCycleOptions): DevCycleClient<Variables>;
export { DVCPopulatedUser } from './User';
/**

@@ -31,0 +32,0 @@ * @deprecated Use initializeDevCycle instead

@@ -95,2 +95,8 @@ import { DVCLogger, DVCDefaultLogLevel, VariableTypeAlias, VariableValue, DVCJSON, DVCCustomDataJSON, BucketedUserConfig } from '@devcycle/types';

bootstrapConfig?: BucketedUserConfig;
/**
* options set by Next SDK. Not for direct use.
*/
next?: {
configRefreshHandler?: (lastModifiedDate?: number) => void;
};
}

@@ -97,0 +103,0 @@ export interface DevCycleUser {

@@ -21,3 +21,3 @@ import { DevCycleOptions, DevCycleUser, DVCCustomDataJSON } from './types';

readonly sdkVersion: string;
constructor(user: DevCycleUser, options: DevCycleOptions, staticData?: StaticData, anonymousUserId?: string);
constructor(user: DevCycleUser, options: DevCycleOptions, staticData?: StaticData, anonymousUserId?: string, headerUserAgent?: string);
getStaticData(): StaticData;

@@ -24,0 +24,0 @@ updateUser(user: DevCycleUser, options: DevCycleOptions): DVCPopulatedUser;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc