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.15 to 0.0.16

2

dist/cjs/helpers.js

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

}
return [4 /*yield*/, fetch(cdn + "/" + version + ".json", { cache: 'no-cache', mode: 'no-cors' })];
return [4 /*yield*/, fetch(cdn + "/" + version + ".json", { cache: 'no-cache' })];
case 1:

@@ -64,0 +64,0 @@ res = _a.sent();

@@ -26,3 +26,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
const res = yield fetch(`${cdn}/${version}.json`, { cache: 'no-cache', mode: 'no-cors' });
const res = yield fetch(`${cdn}/${version}.json`, { cache: 'no-cache' });
return res.json();

@@ -29,0 +29,0 @@ });

@@ -57,3 +57,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
return [4 /*yield*/, fetch(cdn + "/" + version + ".json", { cache: 'no-cache', mode: 'no-cors' })];
return [4 /*yield*/, fetch(cdn + "/" + version + ".json", { cache: 'no-cache' })];
case 1:

@@ -60,0 +60,0 @@ res = _a.sent();

@@ -94,3 +94,3 @@ (function (global, factory) {

}
return [4 /*yield*/, fetch(cdn + "/" + version + ".json", { cache: 'no-cache', mode: 'no-cors' })];
return [4 /*yield*/, fetch(cdn + "/" + version + ".json", { cache: 'no-cache' })];
case 1:

@@ -97,0 +97,0 @@ res = _a.sent();

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

!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n="undefined"!=typeof globalThis?globalThis:n||self).AdminBoxInjector=t()}(this,function(){"use strict";var e=function(n,t){var o=this;void 0===n&&(n=!1),this.disabled=n,this.logger=t,this.log=function(n,t,e){return o.disabled?function(){}:"function"==typeof o.logger?o.logger:void 0===console.log.bind?Function.prototype.bind.call(console[n],console,t||"",e||"-"):console[n].bind(console,t||"",e||"-")},this.info=null===(t=this.log)||void 0===t?void 0:t.call(this,"log","%c[AdminBox]","background:#e8e8e8;"),this.warn=null===(t=this.log)||void 0===t?void 0:t.call(this,"warn","[AdminBox]"),this.error=null===(t=this.log)||void 0===t?void 0:t.call(this,"error","[AdminBox]")},c=window&&window.__awaiter||function(n,s,c,a){return new(c=c||Promise)(function(e,t){function o(n){try{r(a.next(n))}catch(n){t(n)}}function i(n){try{r(a.throw(n))}catch(n){t(n)}}function r(n){var t;n.done?e(n.value):((t=n.value)instanceof c?t:new c(function(n){n(t)})).then(o,i)}r((a=a.apply(n,s||[])).next())})},a=window&&window.__generator||function(e,o){var i,r,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},n={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function t(t){return function(n){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,r&&(s=2&t[0]?r.return:t[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,t[1])).done)return s;switch(r=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,r=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3])){c.label=t[1];break}if(6===t[0]&&c.label<s[1]){c.label=s[1],s=t;break}if(s&&c.label<s[2]){c.label=s[2],c.ops.push(t);break}s[2]&&c.ops.pop(),c.trys.pop();continue}t=o.call(e,c)}catch(n){t=[6,n],r=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,n])}}};function o(n,t){var e=t.querySelector("#"+n);return e||((e=document.createElement("div")).setAttribute("id",n),t.appendChild(e)),e}var l=window&&window.__assign||function(){return(l=Object.assign||function(n){for(var t,e=1,o=arguments.length;e<o;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}).apply(this,arguments)},t=window&&window.__awaiter||function(n,s,c,a){return new(c=c||Promise)(function(e,t){function o(n){try{r(a.next(n))}catch(n){t(n)}}function i(n){try{r(a.throw(n))}catch(n){t(n)}}function r(n){var t;n.done?e(n.value):((t=n.value)instanceof c?t:new c(function(n){n(t)})).then(o,i)}r((a=a.apply(n,s||[])).next())})},u=window&&window.__generator||function(e,o){var i,r,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},n={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function t(t){return function(n){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,r&&(s=2&t[0]?r.return:t[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,t[1])).done)return s;switch(r=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,r=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3])){c.label=t[1];break}if(6===t[0]&&c.label<s[1]){c.label=s[1],s=t;break}if(s&&c.label<s[2]){c.label=s[2],c.ops.push(t);break}s[2]&&c.ops.pop(),c.trys.pop();continue}t=o.call(e,c)}catch(n){t=[6,n],r=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,n])}}},i=window&&window.__spreadArrays||function(){for(var n=0,t=0,e=arguments.length;t<e;t++)n+=arguments[t].length;for(var o=Array(n),i=0,t=0;t<e;t++)for(var r=arguments[t],s=0,c=r.length;s<c;s++,i++)o[i]=r[s];return o};function f(n){var t=this;this.js=[],this.css=[],this.name="default",this.cdn="https://fronteggdeveustorage.blob.core.windows.net/admin-box",this.version="latest",this.mount=function(){t.logger.error("App not loaded yet")},this.unmount=function(){t.logger.error("App not loaded yet")},this.logger=new e,this.logger.info("Create shadow dom element"),this.hostEl=o("frontegg-host-"+n,document.body),this.shadowEl=this.hostEl.attachShadow({mode:"open"}),this.rootEl=o("frontegg-content",this.shadowEl),this.name=n,this.open=this.open.bind(this),this.close=this.close.bind(this),this.destroy=this.destroy.bind(this),this.injectJavascript=this.injectJavascript.bind(this),this.injectCss=this.injectCss.bind(this)}return f.init=function(i,r){var s;return void 0===r&&(r="default"),t(this,void 0,void 0,function(){var t,e,o;return u(this,function(n){switch(n.label){case 0:return Object.assign(window,{FronteggInjector:f}),t=new f(r),(e=t.logger).info("Initializing Injector instance"),t.cdn=null!==(s=i.cdn)&&void 0!==s?s:t.cdn,t.cdn=t.cdn.endsWith("/")?t.cdn.substring(0,t.cdn.length-1):t.cdn,e.info("Retrieving version metadata"),[4,function(e,o,i){return c(this,void 0,void 0,function(){var t;return a(this,function(n){switch(n.label){case 0:return e.info("Retrieving version from cdn: "+o+" version: "+i),"latest"!==(t=i)&&"stable"!==t&&(t=i+"/config"),[4,fetch(o+"/"+t+".json",{cache:"no-cache",mode:"no-cors"})];case 1:return[2,n.sent().json()]}})})}(e,t.cdn,i.version)];case 1:return o=n.sent(),t.version=o.version,t.js=o.js,t.css=o.css,e.info("Injector instance initialized successfully",l({name:r,cdn:t.version},o)),f._apps[r]=t,e.info("Loading entrypoint files"),[4,t.loadEntrypoints()];case 2:return n.sent(),e.info("Entrypoint files loaded successfully"),[2]}})})},f.getInstance=function(n){var t=f._apps[n=void 0===n?"default":n];if(!t)throw Error("injector instance not found for name: "+n+".\nInject.init(options"+("default"===n?"":", '"+n+"'")+") must be called");return t},f.prototype.open=function(){this.mount(this.rootEl)},f.prototype.close=function(){this.unmount(this.rootEl)},f.prototype.destroy=function(){delete f._apps[this.name],this.hostEl.remove(),this.logger.info(this.name+" destroyed")},f.prototype.loadEntrypoints=function(){return t(this,void 0,void 0,function(){var t=this;return u(this,function(n){return[2,Promise.all(i(this.js.map(function(n){return t.injectJavascript(t.cdn+"/"+t.version+"/js/"+n)}),this.css.map(function(n){return t.injectCss(t.cdn+"/"+t.version+"/css/"+n)})))]})})},f.prototype.injectJavascript=function(r){var n=this;return new Promise(function(i){return t(n,void 0,void 0,function(){var t,e,o;return u(this,function(n){switch(n.label){case 0:return(t=this.logger,"string"!=typeof r)?[3,3]:(t.info("Loading JS file from ",r),[4,fetch(r,{method:"GET",cache:"default"})]);case 1:return[4,n.sent().text()];case 2:return e=n.sent(),(o=document.createElement("script")).setAttribute("charset","utf-8"),o.setAttribute("type","text/javascript"),e.indexOf("FRONTEGG_INJECTOR_CDN_HOST")&&(e=e.replace("/FRONTEGG_INJECTOR_CDN_HOST",this.cdn),e="(()=> { const fronteggInjector = FronteggInjector.getInstance('"+this.name+"');\n "+e+"\n })();"),o.innerHTML=e,this.shadowEl.appendChild(o),t.info("JS loaded successfully",r),[3,4];case 3:t.info("Loading lazy JS file from ",r.src),this.shadowEl.appendChild(r),n.label=4;case 4:return i(),[2]}})})})},f.prototype.injectCss=function(o){var i=this;return new Promise(function(t){var n,e=i.logger;"string"==typeof o?(e.info("Loading CSS file from ",o),(n=document.createElement("link")).href=o,n.rel="stylesheet",n.type="text/css",i.shadowEl.prepend(n),n.onload=function(n){e.info("CSS loaded successfully",o),t()}):(e.info("Loading lazy CSS file from ",o.href),i.shadowEl.insertBefore(o,i.rootEl),t())})},f._apps={},f});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).AdminBoxInjector=n()}(this,function(){"use strict";var e=function(t,n){var o=this;void 0===t&&(t=!1),this.disabled=t,this.logger=n,this.log=function(t,n,e){return o.disabled?function(){}:"function"==typeof o.logger?o.logger:void 0===console.log.bind?Function.prototype.bind.call(console[t],console,n||"",e||"-"):console[t].bind(console,n||"",e||"-")},this.info=null===(n=this.log)||void 0===n?void 0:n.call(this,"log","%c[AdminBox]","background:#e8e8e8;"),this.warn=null===(n=this.log)||void 0===n?void 0:n.call(this,"warn","[AdminBox]"),this.error=null===(n=this.log)||void 0===n?void 0:n.call(this,"error","[AdminBox]")},c=window&&window.__awaiter||function(t,s,c,a){return new(c=c||Promise)(function(e,n){function o(t){try{r(a.next(t))}catch(t){n(t)}}function i(t){try{r(a.throw(t))}catch(t){n(t)}}function r(t){var n;t.done?e(t.value):((n=t.value)instanceof c?n:new c(function(t){t(n)})).then(o,i)}r((a=a.apply(t,s||[])).next())})},a=window&&window.__generator||function(e,o){var i,r,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},t={next:n(0),throw:n(1),return:n(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function n(n){return function(t){return function(n){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,r&&(s=2&n[0]?r.return:n[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,n[1])).done)return s;switch(r=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,r=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){c.label=n[1];break}if(6===n[0]&&c.label<s[1]){c.label=s[1],s=n;break}if(s&&c.label<s[2]){c.label=s[2],c.ops.push(n);break}s[2]&&c.ops.pop(),c.trys.pop();continue}n=o.call(e,c)}catch(t){n=[6,t],r=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,t])}}};function o(t,n){var e=n.querySelector("#"+t);return e||((e=document.createElement("div")).setAttribute("id",t),n.appendChild(e)),e}var l=window&&window.__assign||function(){return(l=Object.assign||function(t){for(var n,e=1,o=arguments.length;e<o;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t}).apply(this,arguments)},n=window&&window.__awaiter||function(t,s,c,a){return new(c=c||Promise)(function(e,n){function o(t){try{r(a.next(t))}catch(t){n(t)}}function i(t){try{r(a.throw(t))}catch(t){n(t)}}function r(t){var n;t.done?e(t.value):((n=t.value)instanceof c?n:new c(function(t){t(n)})).then(o,i)}r((a=a.apply(t,s||[])).next())})},u=window&&window.__generator||function(e,o){var i,r,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},t={next:n(0),throw:n(1),return:n(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function n(n){return function(t){return function(n){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,r&&(s=2&n[0]?r.return:n[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,n[1])).done)return s;switch(r=0,(n=s?[2&n[0],s.value]:n)[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,r=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){c.label=n[1];break}if(6===n[0]&&c.label<s[1]){c.label=s[1],s=n;break}if(s&&c.label<s[2]){c.label=s[2],c.ops.push(n);break}s[2]&&c.ops.pop(),c.trys.pop();continue}n=o.call(e,c)}catch(t){n=[6,t],r=0}finally{i=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,t])}}},i=window&&window.__spreadArrays||function(){for(var t=0,n=0,e=arguments.length;n<e;n++)t+=arguments[n].length;for(var o=Array(t),i=0,n=0;n<e;n++)for(var r=arguments[n],s=0,c=r.length;s<c;s++,i++)o[i]=r[s];return o};function f(t){var n=this;this.js=[],this.css=[],this.name="default",this.cdn="https://fronteggdeveustorage.blob.core.windows.net/admin-box",this.version="latest",this.mount=function(){n.logger.error("App not loaded yet")},this.unmount=function(){n.logger.error("App not loaded yet")},this.logger=new e,this.logger.info("Create shadow dom element"),this.hostEl=o("frontegg-host-"+t,document.body),this.shadowEl=this.hostEl.attachShadow({mode:"open"}),this.rootEl=o("frontegg-content",this.shadowEl),this.name=t,this.open=this.open.bind(this),this.close=this.close.bind(this),this.destroy=this.destroy.bind(this),this.injectJavascript=this.injectJavascript.bind(this),this.injectCss=this.injectCss.bind(this)}return f.init=function(i,r){var s;return void 0===r&&(r="default"),n(this,void 0,void 0,function(){var n,e,o;return u(this,function(t){switch(t.label){case 0:return Object.assign(window,{FronteggInjector:f}),n=new f(r),(e=n.logger).info("Initializing Injector instance"),n.cdn=null!==(s=i.cdn)&&void 0!==s?s:n.cdn,n.cdn=n.cdn.endsWith("/")?n.cdn.substring(0,n.cdn.length-1):n.cdn,e.info("Retrieving version metadata"),[4,function(e,o,i){return c(this,void 0,void 0,function(){var n;return a(this,function(t){switch(t.label){case 0:return e.info("Retrieving version from cdn: "+o+" version: "+i),"latest"!==(n=i)&&"stable"!==n&&(n=i+"/config"),[4,fetch(o+"/"+n+".json",{cache:"no-cache"})];case 1:return[2,t.sent().json()]}})})}(e,n.cdn,i.version)];case 1:return o=t.sent(),n.version=o.version,n.js=o.js,n.css=o.css,e.info("Injector instance initialized successfully",l({name:r,cdn:n.version},o)),f._apps[r]=n,e.info("Loading entrypoint files"),[4,n.loadEntrypoints()];case 2:return t.sent(),e.info("Entrypoint files loaded successfully"),[2]}})})},f.getInstance=function(t){var n=f._apps[t=void 0===t?"default":t];if(!n)throw Error("injector instance not found for name: "+t+".\nInject.init(options"+("default"===t?"":", '"+t+"'")+") must be called");return n},f.prototype.open=function(){this.mount(this.rootEl)},f.prototype.close=function(){this.unmount(this.rootEl)},f.prototype.destroy=function(){delete f._apps[this.name],this.hostEl.remove(),this.logger.info(this.name+" destroyed")},f.prototype.loadEntrypoints=function(){return n(this,void 0,void 0,function(){var n=this;return u(this,function(t){return[2,Promise.all(i(this.js.map(function(t){return n.injectJavascript(n.cdn+"/"+n.version+"/js/"+t)}),this.css.map(function(t){return n.injectCss(n.cdn+"/"+n.version+"/css/"+t)})))]})})},f.prototype.injectJavascript=function(r){var t=this;return new Promise(function(i){return n(t,void 0,void 0,function(){var n,e,o;return u(this,function(t){switch(t.label){case 0:return(n=this.logger,"string"!=typeof r)?[3,3]:(n.info("Loading JS file from ",r),[4,fetch(r,{method:"GET",cache:"default"})]);case 1:return[4,t.sent().text()];case 2:return e=t.sent(),(o=document.createElement("script")).setAttribute("charset","utf-8"),o.setAttribute("type","text/javascript"),e.indexOf("FRONTEGG_INJECTOR_CDN_HOST")&&(e=e.replace("/FRONTEGG_INJECTOR_CDN_HOST",this.cdn),e="(()=> { const fronteggInjector = FronteggInjector.getInstance('"+this.name+"');\n "+e+"\n })();"),o.innerHTML=e,this.shadowEl.appendChild(o),n.info("JS loaded successfully",r),[3,4];case 3:n.info("Loading lazy JS file from ",r.src),this.shadowEl.appendChild(r),t.label=4;case 4:return i(),[2]}})})})},f.prototype.injectCss=function(o){var i=this;return new Promise(function(n){var t,e=i.logger;"string"==typeof o?(e.info("Loading CSS file from ",o),(t=document.createElement("link")).href=o,t.rel="stylesheet",t.type="text/css",i.shadowEl.prepend(t),t.onload=function(t){e.info("CSS loaded successfully",o),n()}):(e.info("Loading lazy CSS file from ",o.href),i.shadowEl.insertBefore(o,i.rootEl),n())})},f._apps={},f});
{
"name": "@frontegg/injector",
"version": "0.0.15",
"version": "0.0.16",
"main": "dist/cjs/index.js",

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

},
"gitHead": "78f1cfa1bd68d3b8a666ccb7220380b9574e6bdd"
"gitHead": "60d1f0055656c5b16a9fba31d39a79cae6792843"
}

@@ -20,4 +20,4 @@ import Logger from './logger';

}
const res = await fetch(`${cdn}/${version}.json`, { cache: 'no-cache', mode: 'no-cors' });
const res = await fetch(`${cdn}/${version}.json`, { cache: 'no-cache' });
return res.json();
}

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

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