@frontegg/admin-portal
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -10,2 +10,5 @@ import Injector from '@frontegg/injector'; | ||
headerImage?: string; | ||
backgroundImage?: string; | ||
store?: EnhancedStore; | ||
customStyles?: string; | ||
} | ||
@@ -27,3 +30,3 @@ declare type Unsubscribe = () => void; | ||
private storeSubscribers; | ||
protected constructor(name: string, options: FronteggConfigOptions); | ||
protected constructor(name: string, { store, ...options }: FronteggConfigOptions); | ||
private initInjectors; | ||
@@ -30,0 +33,0 @@ private static getInstance; |
@@ -59,2 +59,13 @@ "use strict"; | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -68,4 +79,5 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
var FronteggApp = /** @class */ (function () { | ||
function FronteggApp(name, options) { | ||
function FronteggApp(name, _a) { | ||
var _this = this; | ||
var store = _a.store, options = __rest(_a, ["store"]); | ||
this.loaded = false; | ||
@@ -85,2 +97,3 @@ this.loadSubscribers = []; | ||
this.options = options; | ||
this.store = store; | ||
this.initInjectors(); | ||
@@ -95,2 +108,3 @@ } | ||
loginBoxName = this.name + "_login-box"; | ||
document.body.classList.add('frontegg-loading'); | ||
injector_1.default.init(__assign({ | ||
@@ -198,10 +212,12 @@ // cdn: 'https://fronteggdeveustorage.blob.core.windows.net/admin-box', | ||
}; | ||
Object.assign(window, { | ||
FronteggApp: FronteggApp, | ||
AdminPortal: exports.AdminPortal, | ||
LoginBox: exports.LoginBox, | ||
Frontegg: { | ||
initialize: exports.initialize, | ||
}, | ||
}); | ||
if (typeof window != 'undefined') { | ||
Object.assign(window, { | ||
FronteggApp: FronteggApp, | ||
AdminPortal: exports.AdminPortal, | ||
LoginBox: exports.LoginBox, | ||
Frontegg: { | ||
initialize: exports.initialize, | ||
}, | ||
}); | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -10,2 +10,5 @@ import Injector from '@frontegg/injector'; | ||
headerImage?: string; | ||
backgroundImage?: string; | ||
store?: EnhancedStore; | ||
customStyles?: string; | ||
} | ||
@@ -27,3 +30,3 @@ declare type Unsubscribe = () => void; | ||
private storeSubscribers; | ||
protected constructor(name: string, options: FronteggConfigOptions); | ||
protected constructor(name: string, { store, ...options }: FronteggConfigOptions); | ||
private initInjectors; | ||
@@ -30,0 +33,0 @@ private static getInstance; |
@@ -10,6 +10,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
import Injector from '@frontegg/injector'; | ||
export * from './AdminBoxMetadata'; | ||
class FronteggApp { | ||
constructor(name, options) { | ||
constructor(name, _a) { | ||
var { store } = _a, options = __rest(_a, ["store"]); | ||
this.loaded = false; | ||
@@ -29,2 +41,3 @@ this.loadSubscribers = []; | ||
this.options = options; | ||
this.store = store; | ||
this.initInjectors(); | ||
@@ -36,2 +49,3 @@ } | ||
const loginBoxName = `${this.name}_login-box`; | ||
document.body.classList.add('frontegg-loading'); | ||
Injector.init(Object.assign({ | ||
@@ -128,10 +142,12 @@ // cdn: 'https://fronteggdeveustorage.blob.core.windows.net/admin-box', | ||
}; | ||
Object.assign(window, { | ||
FronteggApp, | ||
AdminPortal, | ||
LoginBox, | ||
Frontegg: { | ||
initialize, | ||
}, | ||
}); | ||
if (typeof window != 'undefined') { | ||
Object.assign(window, { | ||
FronteggApp, | ||
AdminPortal, | ||
LoginBox, | ||
Frontegg: { | ||
initialize, | ||
}, | ||
}); | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -10,2 +10,5 @@ import Injector from '@frontegg/injector'; | ||
headerImage?: string; | ||
backgroundImage?: string; | ||
store?: EnhancedStore; | ||
customStyles?: string; | ||
} | ||
@@ -27,3 +30,3 @@ declare type Unsubscribe = () => void; | ||
private storeSubscribers; | ||
protected constructor(name: string, options: FronteggConfigOptions); | ||
protected constructor(name: string, { store, ...options }: FronteggConfigOptions); | ||
private initInjectors; | ||
@@ -30,0 +33,0 @@ private static getInstance; |
@@ -48,7 +48,19 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
import Injector from '@frontegg/injector'; | ||
export * from './AdminBoxMetadata'; | ||
var FronteggApp = /** @class */ (function () { | ||
function FronteggApp(name, options) { | ||
function FronteggApp(name, _a) { | ||
var _this = this; | ||
var store = _a.store, options = __rest(_a, ["store"]); | ||
this.loaded = false; | ||
@@ -68,2 +80,3 @@ this.loadSubscribers = []; | ||
this.options = options; | ||
this.store = store; | ||
this.initInjectors(); | ||
@@ -78,2 +91,3 @@ } | ||
loginBoxName = this.name + "_login-box"; | ||
document.body.classList.add('frontegg-loading'); | ||
Injector.init(__assign({ | ||
@@ -180,10 +194,12 @@ // cdn: 'https://fronteggdeveustorage.blob.core.windows.net/admin-box', | ||
}; | ||
Object.assign(window, { | ||
FronteggApp: FronteggApp, | ||
AdminPortal: AdminPortal, | ||
LoginBox: LoginBox, | ||
Frontegg: { | ||
initialize: initialize, | ||
}, | ||
}); | ||
if (typeof window != 'undefined') { | ||
Object.assign(window, { | ||
FronteggApp: FronteggApp, | ||
AdminPortal: AdminPortal, | ||
LoginBox: LoginBox, | ||
Frontegg: { | ||
initialize: initialize, | ||
}, | ||
}); | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@frontegg/admin-portal", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"main": "cjs/index.js", | ||
@@ -5,0 +5,0 @@ "types": "es2015/index.d.ts", |
@@ -58,5 +58,17 @@ (function (global, factory) { | ||
}; | ||
var __rest = (window && window.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
var FronteggApp = /** @class */ (function () { | ||
function FronteggApp(name, options) { | ||
function FronteggApp(name, _a) { | ||
var _this = this; | ||
var store = _a.store, options = __rest(_a, ["store"]); | ||
this.loaded = false; | ||
@@ -76,2 +88,3 @@ this.loadSubscribers = []; | ||
this.options = options; | ||
this.store = store; | ||
this.initInjectors(); | ||
@@ -86,2 +99,3 @@ } | ||
loginBoxName = this.name + "_login-box"; | ||
document.body.classList.add('frontegg-loading'); | ||
Injector__default['default'].init(__assign({ | ||
@@ -188,10 +202,12 @@ // cdn: 'https://fronteggdeveustorage.blob.core.windows.net/admin-box', | ||
}; | ||
Object.assign(window, { | ||
FronteggApp: FronteggApp, | ||
AdminPortal: AdminPortal, | ||
LoginBox: LoginBox, | ||
Frontegg: { | ||
initialize: initialize, | ||
}, | ||
}); | ||
if (typeof window != 'undefined') { | ||
Object.assign(window, { | ||
FronteggApp: FronteggApp, | ||
AdminPortal: AdminPortal, | ||
LoginBox: LoginBox, | ||
Frontegg: { | ||
initialize: initialize, | ||
}, | ||
}); | ||
} | ||
@@ -198,0 +214,0 @@ exports.AdminPortal = AdminPortal; |
@@ -1,1 +0,1 @@ | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@frontegg/injector")):"function"==typeof define&&define.amd?define(["exports","@frontegg/injector"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).AdminBoxInjector={},n.Injector)}(this,function(n,t){"use strict";function o(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var r=o(t),a=window&&window.__assign||function(){return(a=Object.assign||function(n){for(var t,o=1,e=arguments.length;o<e;o++)for(var i in t=arguments[o])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}).apply(this,arguments)},e=window&&window.__awaiter||function(n,a,u,l){return new(u=u||Promise)(function(o,t){function e(n){try{r(l.next(n))}catch(n){t(n)}}function i(n){try{r(l.throw(n))}catch(n){t(n)}}function r(n){var t;n.done?o(n.value):((t=n.value)instanceof u?t:new u(function(n){n(t)})).then(e,i)}r((l=l.apply(n,a||[])).next())})},u=window&&window.__generator||function(o,e){var i,r,a,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;u;)try{if(i=1,r&&(a=2&t[0]?r.return:t[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,t[1])).done)return a;switch(r=0,(t=a?[2&t[0],a.value]:t)[0]){case 0:case 1:a=t;break;case 4:return u.label++,{value:t[1],done:!1};case 5:u.label++,r=t[1],t=[0];continue;case 7:t=u.ops.pop(),u.trys.pop();continue;default:if(!(a=0<(a=u.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){u=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){u.label=t[1];break}if(6===t[0]&&u.label<a[1]){u.label=a[1],a=t;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(t);break}a[2]&&u.ops.pop(),u.trys.pop();continue}t=e.call(o,u)}catch(n){t=[6,n],r=0}finally{i=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,n])}}},i=(l.prototype.initInjectors=function(){return e(this,void 0,void 0,function(){var t,o,e,i=this;return u(this,function(n){return t=this.name+"_admin-portal",o=this.name+"_login-box",r.default.init(a({cdn:"https://assets.frontegg.com/admin-box",version:"latest"},this.options),t),r.default.init(a({cdn:"https://assets.frontegg.com/login-box",version:"latest"},this.options),o),this.adminPortal=r.default.getInstance(t),this.loginBox=r.default.getInstance(o),e=setInterval(function(){var n,t;null!==(n=i.adminPortal)&&void 0!==n&&n.loaded&&null!==(t=i.loginBox)&&void 0!==t&&t.loaded&&i.store&&(clearInterval(e),i.loaded=!0,i.loadSubscribers.forEach(function(n){return n()}),null!==(t=i.store)&&void 0!==t&&t.subscribe(function(){i.storeSubscribers.forEach(function(n){var t,o=null===(t=null===(o=i.store)||void 0===o?void 0:o.getState)||void 0===t?void 0:t.call(o);o&&n(o)})}))},50),(this.adminPortal.app=this).loginBox.app=this,[2]})})},l.getInstance=function(n){var t=l._apps[n];if(!t)throw Error("Frontegg instance not found for name: "+n+".\nFrontegg.initialize(options"+("default"===n?"":", '"+n+"'")+") must be called");return t},l.setConfig=function(n,t){var o=l._apps[t=void 0===t?"default":t];return o?console.warn("Frontegg instance already initialized for name: "+t):(o=new l(t,n),l._apps[t]=o),o},l.getConfig=function(n){return l.getInstance(n=void 0===n?"default":n)},l.prototype.mountAdminPortal=function(){var n;null!==(n=this.adminPortal)&&void 0!==n&&n.open()},l.prototype.unmountAdminPortal=function(){var n;null!==(n=this.adminPortal)&&void 0!==n&&n.close()},l.prototype.mountLoginBox=function(){var n;null!==(n=this.loginBox)&&void 0!==n&&n.open()},l.prototype.unmountLoginBox=function(){var n;null!==(n=this.loginBox)&&void 0!==n&&n.close()},l._apps={},l);function l(n,t){var o=this;this.loaded=!1,this.loadSubscribers=[],this.storeSubscribers=[],this.onLoad=function(n){o.loadSubscribers.push(n),o.loaded&&n()},this.onStoreChanged=function(n){o.storeSubscribers.push(n)},this.name=n,this.options=t,this.initInjectors()}function s(n,t){return void 0===t&&(t="default"),i.setConfig(n,t)}var c={show:function(n){void 0===n&&(n="default"),i.getConfig(n).mountAdminPortal()},hide:function(n){void 0===n&&(n="default"),i.getConfig(n).unmountAdminPortal()}},t={show:function(n){void 0===n&&(n="default"),i.getConfig(n).mountLoginBox()},hide:function(n){void 0===n&&(n="default"),i.getConfig(n).unmountLoginBox()}};Object.assign(window,{FronteggApp:i,AdminPortal:c,LoginBox:t,Frontegg:{initialize:s}}),n.AdminPortal=c,n.LoginBox=t,n.initialize=s,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@frontegg/injector")):"function"==typeof define&&define.amd?define(["exports","@frontegg/injector"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).AdminBoxInjector={},n.Injector)}(this,function(n,t){"use strict";function o(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var r=o(t),a=window&&window.__assign||function(){return(a=Object.assign||function(n){for(var t,o=1,e=arguments.length;o<e;o++)for(var i in t=arguments[o])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}).apply(this,arguments)},e=window&&window.__awaiter||function(n,a,l,u){return new(l=l||Promise)(function(o,t){function e(n){try{r(u.next(n))}catch(n){t(n)}}function i(n){try{r(u.throw(n))}catch(n){t(n)}}function r(n){var t;n.done?o(n.value):((t=n.value)instanceof l?t:new l(function(n){n(t)})).then(e,i)}r((u=u.apply(n,a||[])).next())})},l=window&&window.__generator||function(o,e){var i,r,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;l;)try{if(i=1,r&&(a=2&t[0]?r.return:t[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,t[1])).done)return a;switch(r=0,(t=a?[2&t[0],a.value]:t)[0]){case 0:case 1:a=t;break;case 4:return l.label++,{value:t[1],done:!1};case 5:l.label++,r=t[1],t=[0];continue;case 7:t=l.ops.pop(),l.trys.pop();continue;default:if(!(a=0<(a=l.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){l=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){l.label=t[1];break}if(6===t[0]&&l.label<a[1]){l.label=a[1],a=t;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(t);break}a[2]&&l.ops.pop(),l.trys.pop();continue}t=e.call(o,l)}catch(n){t=[6,n],r=0}finally{i=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,n])}}},i=window&&window.__rest||function(n,t){var o={};for(i in n)Object.prototype.hasOwnProperty.call(n,i)&&t.indexOf(i)<0&&(o[i]=n[i]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols)for(var e=0,i=Object.getOwnPropertySymbols(n);e<i.length;e++)t.indexOf(i[e])<0&&Object.prototype.propertyIsEnumerable.call(n,i[e])&&(o[i[e]]=n[i[e]]);return o},u=(s.prototype.initInjectors=function(){return e(this,void 0,void 0,function(){var t,o,e,i=this;return l(this,function(n){return t=this.name+"_admin-portal",o=this.name+"_login-box",document.body.classList.add("frontegg-loading"),r.default.init(a({cdn:"https://assets.frontegg.com/admin-box",version:"latest"},this.options),t),r.default.init(a({cdn:"https://assets.frontegg.com/login-box",version:"latest"},this.options),o),this.adminPortal=r.default.getInstance(t),this.loginBox=r.default.getInstance(o),e=setInterval(function(){var n,t;null!==(n=i.adminPortal)&&void 0!==n&&n.loaded&&null!==(t=i.loginBox)&&void 0!==t&&t.loaded&&i.store&&(clearInterval(e),i.loaded=!0,i.loadSubscribers.forEach(function(n){return n()}),null!==(t=i.store)&&void 0!==t&&t.subscribe(function(){i.storeSubscribers.forEach(function(n){var t,o=null===(t=null===(o=i.store)||void 0===o?void 0:o.getState)||void 0===t?void 0:t.call(o);o&&n(o)})}))},50),(this.adminPortal.app=this).loginBox.app=this,[2]})})},s.getInstance=function(n){var t=s._apps[n];if(!t)throw Error("Frontegg instance not found for name: "+n+".\nFrontegg.initialize(options"+("default"===n?"":", '"+n+"'")+") must be called");return t},s.setConfig=function(n,t){var o=s._apps[t=void 0===t?"default":t];return o?console.warn("Frontegg instance already initialized for name: "+t):(o=new s(t,n),s._apps[t]=o),o},s.getConfig=function(n){return s.getInstance(n=void 0===n?"default":n)},s.prototype.mountAdminPortal=function(){var n;null!==(n=this.adminPortal)&&void 0!==n&&n.open()},s.prototype.unmountAdminPortal=function(){var n;null!==(n=this.adminPortal)&&void 0!==n&&n.close()},s.prototype.mountLoginBox=function(){var n;null!==(n=this.loginBox)&&void 0!==n&&n.open()},s.prototype.unmountLoginBox=function(){var n;null!==(n=this.loginBox)&&void 0!==n&&n.close()},s._apps={},s);function s(n,t){var o=this,e=t.store,t=i(t,["store"]);this.loaded=!1,this.loadSubscribers=[],this.storeSubscribers=[],this.onLoad=function(n){o.loadSubscribers.push(n),o.loaded&&n()},this.onStoreChanged=function(n){o.storeSubscribers.push(n)},this.name=n,this.options=t,this.store=e,this.initInjectors()}function c(n,t){return void 0===t&&(t="default"),u.setConfig(n,t)}var f={show:function(n){void 0===n&&(n="default"),u.getConfig(n).mountAdminPortal()},hide:function(n){void 0===n&&(n="default"),u.getConfig(n).unmountAdminPortal()}},t={show:function(n){void 0===n&&(n="default"),u.getConfig(n).mountLoginBox()},hide:function(n){void 0===n&&(n="default"),u.getConfig(n).unmountLoginBox()}};"undefined"!=typeof window&&Object.assign(window,{FronteggApp:u,AdminPortal:f,LoginBox:t,Frontegg:{initialize:c}}),n.AdminPortal=f,n.LoginBox=t,n.initialize=c,Object.defineProperty(n,"__esModule",{value:!0})}); |
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
106599
1273