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

flex-plugin

Package Overview
Dependencies
Maintainers
1
Versions
294
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flex-plugin - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

28

dev_assets/flex.js

@@ -0,1 +1,4 @@

const REDIRECT_KEY = 'LOCAL_FLEX_PLUGIN_LOGIN_REDIRECT';
const FIRST_LOAD_KEY = 'LOCAL_FLEX_PLUGIN_FIRST_LOAD';
function loadFlex() {

@@ -11,8 +14,23 @@ if (

} else {
Twilio.Flex.create(appConfig).then(flex => {
flex.init('#container');
}).catch(err => {
window.location.replace('http://www.twilio.com/service-login/flex?localPort=8080');
});
const loginUrl = `http://www.twilio.com/service-login/flex/${appConfig.sso.accountSid || accountSid}?localPort=${window.location.port}`
if (!localStorage.getItem(FIRST_LOAD_KEY)) {
localStorage.setItem(FIRST_LOAD_KEY, 'redirected');
window.location.replace(loginUrl);
return;
} else {
Twilio.Flex.create(appConfig).then(flex => {
localStorage.removeItem(REDIRECT_KEY);
localStorage.removeItem(FIRST_LOAD_KEY);
flex.init('#container');
}).catch(err => {
if (!localStorage.getItem(REDIRECT_KEY)) {
localStorage.setItem(REDIRECT_KEY, 'redirected');
window.location.replace(loginUrl);
} else {
throw new Error('Failed to authenticate user.');
}
});
}
}
}

@@ -5,2 +5,5 @@ import * as Flex from '@twilio/flex-ui';

serviceBaseUrl?: string;
appConfig?: {
serviceBaseUrl?: string;
};
}

@@ -7,0 +10,0 @@ }

@@ -27,2 +27,5 @@ "use strict";

}
if (window.appConfig && window.appConfig.serviceBaseUrl) {
return window.appConfig.serviceBaseUrl;
}
if (document && document.currentScript) {

@@ -29,0 +32,0 @@ var pluginScript = document.currentScript;

4

package.json
{
"name": "flex-plugin",
"version": "0.4.0",
"version": "0.5.0",
"bin": {

@@ -37,3 +37,3 @@ "flex-check-start": "./bin/check-start"

},
"gitHead": "fb838f4eade771c991f4422a3a27586c16c9c82b",
"gitHead": "d76062a30f625e908e4d83ff34fff5240084407b",
"dependencies": {

@@ -40,0 +40,0 @@ "chalk": "^2.4.1",

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