New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@frontegg/injector

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frontegg/injector - npm Package Compare versions

Comparing version 0.0.17 to 0.0.18

4

package.json
{
"name": "@frontegg/injector",
"version": "0.0.17",
"version": "0.0.18",
"main": "dist/cjs/index.js",

@@ -19,3 +19,3 @@ "types": "dist/esm/index.d.ts",

},
"gitHead": "12c4bfcc6bea137998f3d69545d094de090a543e"
"gitHead": "055d894c6ebcfbb239122dbc0a843965f5a22fb5"
}

@@ -101,41 +101,48 @@ import Logger from './logger';

injectJavascript(url: string | HTMLScriptElement): Promise<void> {
return new Promise(async (resolve) => {
injectJavascript(url: string | HTMLScriptElement) {
// if (typeof url === 'string') {
// }else{
// return this.shadowEl.appendChild(url);
// }
return (async () => {
const logger = this.logger;
if (typeof url === 'string') {
logger.info('Loading JS file from ', url);
// const bundleScript = document.createElement('script');
// bundleScript.setAttribute('charset', 'utf-8');
// bundleScript.src = url;
// this.shadowEl.appendChild(bundleScript);
// bundleScript.onload = e => {
// logger.info('JS loaded successfully', url);
// resolve();
// };
if (typeof url !== 'string') {
url = url.src;
}
logger.info('Loading JS file from ', url);
// const bundleScript = document.createElement('script');
// bundleScript.setAttribute('charset', 'utf-8');
// bundleScript.src = url;
// this.shadowEl.appendChild(bundleScript);
// bundleScript.onload = e => {
// logger.info('JS loaded successfully', url);
// resolve();
// };
const res = await fetch(url, { method: 'GET', cache: 'default' });
let contentScript = await res.text();
const bundleScript = document.createElement('script');
bundleScript.setAttribute('charset', 'utf-8');
bundleScript.setAttribute('type', 'text/javascript');
const res = await fetch(url, { method: 'GET', cache: 'default' });
let contentScript = await res.text();
const bundleScript = document.createElement('script');
bundleScript.setAttribute('charset', 'utf-8');
bundleScript.setAttribute('type', 'text/javascript');
if (contentScript.indexOf('FRONTEGG_INJECTOR_CDN_HOST')) {
contentScript = contentScript.replace('/FRONTEGG_INJECTOR_CDN_HOST', this.cdn);
if (contentScript.indexOf('FRONTEGG_INJECTOR_CDN_HOST')) {
contentScript = contentScript.replace('/FRONTEGG_INJECTOR_CDN_HOST', this.cdn);
contentScript = `(()=> { const fronteggInjector = FronteggInjector.getInstance('${this.name}');
contentScript = `(()=> { const fronteggInjector = FronteggInjector.getInstance('${this.name}');
${contentScript}
})();`;
}
bundleScript.innerHTML = contentScript;
}
bundleScript.innerHTML = contentScript;
this.shadowEl.appendChild(bundleScript);
logger.info('JS loaded successfully', url);
this.shadowEl.appendChild(bundleScript);
logger.info('JS loaded successfully', url);
} else {
logger.info('Loading lazy JS file from ', url.src);
this.shadowEl.appendChild(url);
}
resolve();
});
// } else {
// logger.info('Loading lazy JS file from ', url.src);
// this.shadowEl.appendChild(url);
// }
// resolve();
})();
}

@@ -142,0 +149,0 @@

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