@devcycle/js-client-sdk
Advanced tools
Comparing version 1.27.0 to 1.27.1
@@ -667,3 +667,3 @@ 'use strict'; | ||
var name = "@devcycle/js-client-sdk"; | ||
var version = "1.27.0"; | ||
var version = "1.27.1"; | ||
var description = "The Javascript Client SDK for DevCycle"; | ||
@@ -991,2 +991,7 @@ var author = "DevCycle <support@devcycle.com>"; | ||
} | ||
updateURL(url) { | ||
this.close(); | ||
this.url = url; | ||
this.openConnection(); | ||
} | ||
openConnection() { | ||
@@ -1042,3 +1047,2 @@ if (typeof EventSource === 'undefined') { | ||
this.clientInitialization = async (initialUser) => { | ||
var _a, _b; | ||
if (this.initializeTriggered || this._closing) { | ||
@@ -1079,10 +1083,2 @@ return this; | ||
} | ||
if ((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.sse) === null || _b === void 0 ? void 0 : _b.url) { | ||
if (!this.options.disableRealtimeUpdates) { | ||
this.streamingConnection = new StreamingConnection(this.config.sse.url, this.onSSEMessage.bind(this), this.logger); | ||
} | ||
else { | ||
this.logger.info('Disabling Realtime Updates based on Initialization parameter'); | ||
} | ||
} | ||
return this; | ||
@@ -1428,3 +1424,3 @@ }; | ||
handleConfigReceived(config, user, dateFetched) { | ||
var _a, _b, _c; | ||
var _a, _b, _c, _d, _e; | ||
const oldConfig = this.config; | ||
@@ -1446,2 +1442,17 @@ this.config = config; | ||
} | ||
// Update the streaming connection URL if it has changed (for ex. if the current user has targeting overrides) | ||
if ((_d = config === null || config === void 0 ? void 0 : config.sse) === null || _d === void 0 ? void 0 : _d.url) { | ||
// construct the streamingConnection if necessary | ||
if (!this.streamingConnection) { | ||
if (!this.options.disableRealtimeUpdates) { | ||
this.streamingConnection = new StreamingConnection(config.sse.url, this.onSSEMessage.bind(this), this.logger); | ||
} | ||
else { | ||
this.logger.info('Disabling Realtime Updates based on Initialization parameter'); | ||
} | ||
} | ||
else if (config.sse.url !== ((_e = oldConfig === null || oldConfig === void 0 ? void 0 : oldConfig.sse) === null || _e === void 0 ? void 0 : _e.url)) { | ||
this.streamingConnection.updateURL(config.sse.url); | ||
} | ||
} | ||
} | ||
@@ -1448,0 +1459,0 @@ async setUser(user) { |
@@ -656,3 +656,3 @@ import fetchWithRetry from 'fetch-retry'; | ||
var name = "@devcycle/js-client-sdk"; | ||
var version = "1.27.0"; | ||
var version = "1.27.1"; | ||
var description = "The Javascript Client SDK for DevCycle"; | ||
@@ -980,2 +980,7 @@ var author = "DevCycle <support@devcycle.com>"; | ||
} | ||
updateURL(url) { | ||
this.close(); | ||
this.url = url; | ||
this.openConnection(); | ||
} | ||
openConnection() { | ||
@@ -1031,3 +1036,2 @@ if (typeof EventSource === 'undefined') { | ||
this.clientInitialization = async (initialUser) => { | ||
var _a, _b; | ||
if (this.initializeTriggered || this._closing) { | ||
@@ -1068,10 +1072,2 @@ return this; | ||
} | ||
if ((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.sse) === null || _b === void 0 ? void 0 : _b.url) { | ||
if (!this.options.disableRealtimeUpdates) { | ||
this.streamingConnection = new StreamingConnection(this.config.sse.url, this.onSSEMessage.bind(this), this.logger); | ||
} | ||
else { | ||
this.logger.info('Disabling Realtime Updates based on Initialization parameter'); | ||
} | ||
} | ||
return this; | ||
@@ -1417,3 +1413,3 @@ }; | ||
handleConfigReceived(config, user, dateFetched) { | ||
var _a, _b, _c; | ||
var _a, _b, _c, _d, _e; | ||
const oldConfig = this.config; | ||
@@ -1435,2 +1431,17 @@ this.config = config; | ||
} | ||
// Update the streaming connection URL if it has changed (for ex. if the current user has targeting overrides) | ||
if ((_d = config === null || config === void 0 ? void 0 : config.sse) === null || _d === void 0 ? void 0 : _d.url) { | ||
// construct the streamingConnection if necessary | ||
if (!this.streamingConnection) { | ||
if (!this.options.disableRealtimeUpdates) { | ||
this.streamingConnection = new StreamingConnection(config.sse.url, this.onSSEMessage.bind(this), this.logger); | ||
} | ||
else { | ||
this.logger.info('Disabling Realtime Updates based on Initialization parameter'); | ||
} | ||
} | ||
else if (config.sse.url !== ((_e = oldConfig === null || oldConfig === void 0 ? void 0 : oldConfig.sse) === null || _e === void 0 ? void 0 : _e.url)) { | ||
this.streamingConnection.updateURL(config.sse.url); | ||
} | ||
} | ||
} | ||
@@ -1437,0 +1448,0 @@ async setUser(user) { |
{ | ||
"name": "@devcycle/js-client-sdk", | ||
"version": "1.27.0", | ||
"version": "1.27.1", | ||
"description": "The Javascript Client SDK for DevCycle", | ||
@@ -5,0 +5,0 @@ "author": "DevCycle <support@devcycle.com>", |
@@ -8,2 +8,3 @@ import type { DVCLogger } from '@devcycle/types'; | ||
constructor(url: string, onMessage: (message: unknown) => void, logger: DVCLogger); | ||
updateURL(url: string): void; | ||
private openConnection; | ||
@@ -10,0 +11,0 @@ isConnected(): boolean; |
@@ -8,2 +8,3 @@ import { DVCLogger } from '@devcycle/types'; | ||
constructor(url: string, onMessage: (message: unknown) => void, logger: DVCLogger); | ||
updateURL(url: string): void; | ||
private openConnection; | ||
@@ -10,0 +11,0 @@ isConnected(): boolean; |
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
184112
4592