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.12 to 0.0.13

2

dist/cjs/helpers.d.ts
import Logger from './logger';
import { VersionMetadata } from './types';
export declare function getOrCreateHtmlElementInside(id: string, container: HTMLElement | ShadowRoot): HTMLElement;
export declare function getVersionMetadata(logger: Logger, cdn: string, version: string): Promise<VersionMetadata>;
export declare function getVersionMetadata(logger: Logger, cdn: string, _version: string): Promise<VersionMetadata>;

@@ -50,10 +50,14 @@ "use strict";

exports.getOrCreateHtmlElementInside = getOrCreateHtmlElementInside;
function getVersionMetadata(logger, cdn, version) {
function getVersionMetadata(logger, cdn, _version) {
return __awaiter(this, void 0, void 0, function () {
var res;
var version, res;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
logger.info("Retrieving version from cdn: " + version);
return [4 /*yield*/, fetch(cdn + "/" + version, { cache: 'no-cache' })];
logger.info("Retrieving version from cdn: " + cdn + " version: " + _version);
version = _version;
if (version !== 'latest' && version !== 'stable') {
version = _version + "/config";
}
return [4 /*yield*/, fetch(cdn + "/" + version + ".json", { cache: 'no-cache', mode: 'no-cors' })];
case 1:

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

@@ -178,3 +178,5 @@ "use strict";

_a.label = 4;
case 4: return [2 /*return*/];
case 4:
resolve();
return [2 /*return*/];
}

@@ -203,2 +205,3 @@ });

_this.shadowEl.insertBefore(url, _this.rootEl);
resolve();
}

@@ -205,0 +208,0 @@ });

import Logger from './logger';
import { VersionMetadata } from './types';
export declare function getOrCreateHtmlElementInside(id: string, container: HTMLElement | ShadowRoot): HTMLElement;
export declare function getVersionMetadata(logger: Logger, cdn: string, version: string): Promise<VersionMetadata>;
export declare function getVersionMetadata(logger: Logger, cdn: string, _version: string): Promise<VersionMetadata>;

@@ -19,6 +19,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
export function getVersionMetadata(logger, cdn, version) {
export function getVersionMetadata(logger, cdn, _version) {
return __awaiter(this, void 0, void 0, function* () {
logger.info(`Retrieving version from cdn: ${version}`);
const res = yield fetch(`${cdn}/${version}`, { cache: 'no-cache' });
logger.info(`Retrieving version from cdn: ${cdn} version: ${_version}`);
let version = _version;
if (version !== 'latest' && version !== 'stable') {
version = `${_version}/config`;
}
const res = yield fetch(`${cdn}/${version}.json`, { cache: 'no-cache', mode: 'no-cors' });
return res.json();

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

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

}
resolve();
}));

@@ -127,2 +128,3 @@ }

this.shadowEl.insertBefore(url, this.rootEl);
resolve();
}

@@ -129,0 +131,0 @@ });

import Logger from './logger';
import { VersionMetadata } from './types';
export declare function getOrCreateHtmlElementInside(id: string, container: HTMLElement | ShadowRoot): HTMLElement;
export declare function getVersionMetadata(logger: Logger, cdn: string, version: string): Promise<VersionMetadata>;
export declare function getVersionMetadata(logger: Logger, cdn: string, _version: string): Promise<VersionMetadata>;

@@ -46,10 +46,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
export function getVersionMetadata(logger, cdn, version) {
export function getVersionMetadata(logger, cdn, _version) {
return __awaiter(this, void 0, void 0, function () {
var res;
var version, res;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
logger.info("Retrieving version from cdn: " + version);
return [4 /*yield*/, fetch(cdn + "/" + version, { cache: 'no-cache' })];
logger.info("Retrieving version from cdn: " + cdn + " version: " + _version);
version = _version;
if (version !== 'latest' && version !== 'stable') {
version = _version + "/config";
}
return [4 /*yield*/, fetch(cdn + "/" + version + ".json", { cache: 'no-cache', mode: 'no-cors' })];
case 1:

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

@@ -173,3 +173,5 @@ var __assign = (this && this.__assign) || function () {

_a.label = 4;
case 4: return [2 /*return*/];
case 4:
resolve();
return [2 /*return*/];
}

@@ -198,2 +200,3 @@ });

_this.shadowEl.insertBefore(url, _this.rootEl);
resolve();
}

@@ -200,0 +203,0 @@ });

@@ -83,10 +83,14 @@ (function (global, factory) {

}
function getVersionMetadata(logger, cdn, version) {
function getVersionMetadata(logger, cdn, _version) {
return __awaiter(this, void 0, void 0, function () {
var res;
var version, res;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
logger.info("Retrieving version from cdn: " + version);
return [4 /*yield*/, fetch(cdn + "/" + version, { cache: 'no-cache' })];
logger.info("Retrieving version from cdn: " + cdn + " version: " + _version);
version = _version;
if (version !== 'latest' && version !== 'stable') {
version = _version + "/config";
}
return [4 /*yield*/, fetch(cdn + "/" + version + ".json", { cache: 'no-cache', mode: 'no-cors' })];
case 1:

@@ -269,3 +273,5 @@ res = _a.sent();

_a.label = 4;
case 4: return [2 /*return*/];
case 4:
resolve();
return [2 /*return*/];
}

@@ -294,2 +300,3 @@ });

_this.shadowEl.insertBefore(url, _this.rootEl);
resolve();
}

@@ -296,0 +303,0 @@ });

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

!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)},u=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())})},f=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 d(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 d.init=function(i,r){var s;return void 0===r&&(r="default"),u(this,void 0,void 0,function(){var n,e,o;return f(this,function(t){switch(t.label){case 0:return Object.assign(window,{FronteggInjector:d}),n=new d(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(n,e,o){return c(this,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:return n.info("Retrieving version from cdn: "+o),[4,fetch(e+"/"+o,{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)),d._apps[r]=n,e.info("Loading entrypoint files"),[4,n.loadEntrypoints()];case 2:return t.sent(),e.info("Entrypoint files loaded successfully"),[2]}})})},d.getInstance=function(t){var n=d._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},d.prototype.open=function(){this.mount(this.rootEl)},d.prototype.close=function(){this.unmount(this.rootEl)},d.prototype.destroy=function(){delete d._apps[this.name],this.hostEl.remove(),this.logger.info(this.name+" destroyed")},d.prototype.loadEntrypoints=function(){return u(this,void 0,void 0,function(){var n=this;return f(this,function(t){return[2,Promise.all(i(this.js.map(function(t){return n.injectJavascript(n.cdn+"/"+n.version+"/js/"+t,!0)}),this.css.map(function(t){return n.injectCss(n.cdn+"/"+n.version+"/css/"+t)})))]})})},d.prototype.injectJavascript=function(i,t){var n=this;return new Promise(function(t){return u(n,void 0,void 0,function(){var n,e,o;return f(this,function(t){switch(t.label){case 0:return(n=this.logger,"string"!=typeof i)?[3,3]:(n.info("Loading JS file from ",i),[4,fetch(i,{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",i),[3,4];case 3:n.info("Loading lazy JS file from ",i.src),this.shadowEl.appendChild(i),t.label=4;case 4:return[2]}})})})},d.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))})},d._apps={},d});
!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)},u=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())})},f=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 d(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 d.init=function(i,r){var s;return void 0===r&&(r="default"),u(this,void 0,void 0,function(){var t,e,o;return f(this,function(n){switch(n.label){case 0:return Object.assign(window,{FronteggInjector:d}),t=new d(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)),d._apps[r]=t,e.info("Loading entrypoint files"),[4,t.loadEntrypoints()];case 2:return n.sent(),e.info("Entrypoint files loaded successfully"),[2]}})})},d.getInstance=function(n){var t=d._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},d.prototype.open=function(){this.mount(this.rootEl)},d.prototype.close=function(){this.unmount(this.rootEl)},d.prototype.destroy=function(){delete d._apps[this.name],this.hostEl.remove(),this.logger.info(this.name+" destroyed")},d.prototype.loadEntrypoints=function(){return u(this,void 0,void 0,function(){var t=this;return f(this,function(n){return[2,Promise.all(i(this.js.map(function(n){return t.injectJavascript(t.cdn+"/"+t.version+"/js/"+n,!0)}),this.css.map(function(n){return t.injectCss(t.cdn+"/"+t.version+"/css/"+n)})))]})})},d.prototype.injectJavascript=function(r,n){var t=this;return new Promise(function(i){return u(t,void 0,void 0,function(){var t,e,o;return f(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]}})})})},d.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())})},d._apps={},d});
{
"name": "@frontegg/injector",
"version": "0.0.12",
"version": "0.0.13",
"main": "dist/cjs/index.js",

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

},
"gitHead": "0beb8e9ce92debc8a586d606569c222ba9a12d29"
"gitHead": "1349c5623559be3b3652ec9e6e6a7f56badf0990"
}

@@ -15,3 +15,3 @@ import Logger from './logger';

export async function getVersionMetadata(logger: Logger, cdn: string, _version: string): Promise<VersionMetadata> {
logger.info(`Retrieving version from cdn: ${_version}`);
logger.info(`Retrieving version from cdn: ${cdn} version: ${_version}`);
let version = _version;

@@ -18,0 +18,0 @@ if (version !== 'latest' && version !== 'stable') {

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

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