@frontegg/js 6.10.0 → 6.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AdminPortal/index.js +20 -7
- package/AdminPortalRenderer/index.js +99 -59
- package/AppHolder/index.js +22 -11
- package/CheckoutDialog/index.js +20 -7
- package/FronteggApp/FronteggApp.js +334 -166
- package/HostedLogin/index.js +35 -24
- package/LoginBoxRenderer/index.js +111 -70
- package/index.js +1 -1
- package/initialize.js +113 -81
- package/node/AdminPortal/index.js +25 -7
- package/node/AdminPortalRenderer/index.js +105 -63
- package/node/AppHolder/index.js +25 -11
- package/node/CheckoutDialog/index.js +25 -7
- package/node/FronteggApp/FronteggApp.js +342 -171
- package/node/FronteggApp/index.js +1 -1
- package/node/HostedLogin/index.js +42 -29
- package/node/LoginBoxRenderer/index.js +117 -74
- package/node/index.js +9 -9
- package/node/initialize.js +120 -82
- package/node/utils/index.js +31 -22
- package/node/version.js +3 -3
- package/package.json +14 -2
- package/umd/frontegg.development.js +26518 -0
- package/umd/frontegg.production.min.js +2 -0
- package/umd/frontegg.production.min.js.LICENSE.txt +1 -0
- package/utils/index.js +29 -20
- package/version.js +1 -1
|
@@ -5,10 +5,18 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.getThemeByName = exports.defaultTheme = exports
|
|
8
|
+
exports.getThemeByName = exports.defaultTheme = exports["default"] = exports.LoginBoxRenderer = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
13
|
|
|
10
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
15
|
|
|
16
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
|
|
18
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
+
|
|
12
20
|
var _reduxStore = require("@frontegg/redux-store");
|
|
13
21
|
|
|
14
22
|
var _types = require("@frontegg/types");
|
|
@@ -17,44 +25,45 @@ var _FronteggApp = require("../FronteggApp");
|
|
|
17
25
|
|
|
18
26
|
var _utils = require("../utils");
|
|
19
27
|
|
|
20
|
-
|
|
28
|
+
var defaultTheme = 'modern';
|
|
21
29
|
exports.defaultTheme = defaultTheme;
|
|
22
30
|
|
|
23
|
-
|
|
31
|
+
var getThemeByName = function getThemeByName(name) {
|
|
24
32
|
var _name;
|
|
25
33
|
|
|
26
34
|
// Load themes from window chunk to support cdn getThemeByName
|
|
27
|
-
|
|
35
|
+
var themes = window['FronteggAdminPortal'].themes;
|
|
28
36
|
return (_name = themes[name]) != null ? _name : themes[defaultTheme];
|
|
29
37
|
};
|
|
30
38
|
|
|
31
39
|
exports.getThemeByName = getThemeByName;
|
|
32
40
|
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
var LoginBoxRenderer = /*#__PURE__*/function () {
|
|
42
|
+
function LoginBoxRenderer(name, themeOptions, store, appOptions) {
|
|
43
|
+
(0, _classCallCheck2["default"])(this, LoginBoxRenderer);
|
|
35
44
|
this.app = void 0;
|
|
36
45
|
this.options = void 0;
|
|
37
46
|
this.store = void 0;
|
|
38
47
|
this.themeSetter = void 0;
|
|
39
48
|
|
|
40
|
-
this.setRoute = ()
|
|
49
|
+
this.setRoute = function () {};
|
|
41
50
|
|
|
42
51
|
this.themeOptions = {};
|
|
43
|
-
|
|
52
|
+
var contextOptions = {
|
|
44
53
|
baseUrl: 'preview'
|
|
45
54
|
};
|
|
46
55
|
this.store = store != null ? store : (0, _reduxStore.createFronteggStore)({
|
|
47
56
|
context: contextOptions
|
|
48
57
|
}, this, true, undefined, undefined, true);
|
|
49
|
-
this.options = (0, _extends2
|
|
50
|
-
themeOptions,
|
|
58
|
+
this.options = (0, _extends2["default"])({
|
|
59
|
+
themeOptions: themeOptions,
|
|
51
60
|
iframeRendering: true,
|
|
52
61
|
metadata: {},
|
|
53
62
|
previewMode: true,
|
|
54
63
|
builderMode: true,
|
|
55
64
|
store: this.store,
|
|
56
|
-
contextOptions,
|
|
57
|
-
onRedirectTo: ()
|
|
65
|
+
contextOptions: contextOptions,
|
|
66
|
+
onRedirectTo: function onRedirectTo() {
|
|
58
67
|
console.debug('path');
|
|
59
68
|
}
|
|
60
69
|
}, appOptions);
|
|
@@ -63,78 +72,112 @@ class LoginBoxRenderer {
|
|
|
63
72
|
_types.Metadata.set({}, name);
|
|
64
73
|
}
|
|
65
74
|
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
(0, _createClass2["default"])(LoginBoxRenderer, [{
|
|
76
|
+
key: "render",
|
|
77
|
+
value: function () {
|
|
78
|
+
var _render = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(loginBoxContainer) {
|
|
79
|
+
var _this = this;
|
|
80
|
+
|
|
81
|
+
var loginBoxEl, setThemeSetter, setStaticRouteSetter, FronteggLoginBox;
|
|
82
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
83
|
+
while (1) {
|
|
84
|
+
switch (_context.prev = _context.next) {
|
|
85
|
+
case 0:
|
|
86
|
+
loginBoxEl = loginBoxContainer.querySelector('#root');
|
|
87
|
+
|
|
88
|
+
if (!loginBoxEl) {
|
|
89
|
+
loginBoxEl = loginBoxContainer.ownerDocument.createElement('div');
|
|
90
|
+
loginBoxEl.setAttribute('id', 'root');
|
|
91
|
+
loginBoxContainer.appendChild(loginBoxEl);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
this.app.loginBoxContainer = loginBoxContainer;
|
|
95
|
+
this.app.loginBoxEl = loginBoxEl;
|
|
96
|
+
|
|
97
|
+
setThemeSetter = function setThemeSetter(themeSetter) {
|
|
98
|
+
_this.themeSetter = themeSetter;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
setStaticRouteSetter = function setStaticRouteSetter(setStaticRoute) {
|
|
102
|
+
_this.setRoute = setStaticRoute;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
_context.next = 8;
|
|
106
|
+
return this.app.loadScript('FronteggLoginBox');
|
|
107
|
+
|
|
108
|
+
case 8:
|
|
109
|
+
FronteggLoginBox = _context.sent;
|
|
110
|
+
this.app.loginBoxRenderer = FronteggLoginBox.renderPage(loginBoxEl, {
|
|
111
|
+
options: this.options,
|
|
112
|
+
injector: this.app,
|
|
113
|
+
setThemeSetter: setThemeSetter,
|
|
114
|
+
setStaticRouteSetter: setStaticRouteSetter,
|
|
115
|
+
staticRoute: '/account/login'
|
|
116
|
+
});
|
|
117
|
+
_context.next = 12;
|
|
118
|
+
return (0, _utils.waitThemeSetter)(this);
|
|
119
|
+
|
|
120
|
+
case 12:
|
|
121
|
+
case "end":
|
|
122
|
+
return _context.stop();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}, _callee, this);
|
|
126
|
+
}));
|
|
127
|
+
|
|
128
|
+
function render(_x) {
|
|
129
|
+
return _render.apply(this, arguments);
|
|
130
|
+
}
|
|
68
131
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
132
|
+
return render;
|
|
133
|
+
}()
|
|
134
|
+
}, {
|
|
135
|
+
key: "unmount",
|
|
136
|
+
value: function unmount() {
|
|
137
|
+
try {
|
|
138
|
+
var _this$app$loginBoxRen;
|
|
139
|
+
|
|
140
|
+
(_this$app$loginBoxRen = this.app.loginBoxRenderer) == null ? void 0 : _this$app$loginBoxRen.unmount();
|
|
141
|
+
} catch (e) {
|
|
142
|
+
console.error('Failed to unmount login box renderer', e);
|
|
143
|
+
}
|
|
73
144
|
}
|
|
145
|
+
}, {
|
|
146
|
+
key: "setTheme",
|
|
147
|
+
value: function setTheme(themeOptions) {
|
|
148
|
+
var _this$themeSetter;
|
|
74
149
|
|
|
75
|
-
|
|
76
|
-
this.app.loginBoxEl = loginBoxEl;
|
|
150
|
+
this.themeOptions = themeOptions;
|
|
77
151
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const setStaticRouteSetter = setStaticRoute => {
|
|
83
|
-
this.setRoute = setStaticRoute;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const FronteggLoginBox = await this.app.loadScript('FronteggLoginBox');
|
|
87
|
-
this.app.loginBoxRenderer = FronteggLoginBox.renderPage(loginBoxEl, {
|
|
88
|
-
options: this.options,
|
|
89
|
-
injector: this.app,
|
|
90
|
-
setThemeSetter,
|
|
91
|
-
setStaticRouteSetter,
|
|
92
|
-
staticRoute: '/account/login'
|
|
93
|
-
});
|
|
94
|
-
await (0, _utils.waitThemeSetter)(this);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
unmount() {
|
|
98
|
-
try {
|
|
99
|
-
var _this$app$loginBoxRen;
|
|
152
|
+
if (!this.themeSetter) {
|
|
153
|
+
console.warn("this.themeSetter is not defined yet");
|
|
154
|
+
}
|
|
100
155
|
|
|
101
|
-
(_this$
|
|
102
|
-
} catch (e) {
|
|
103
|
-
console.error('Failed to unmount login box renderer', e);
|
|
156
|
+
(_this$themeSetter = this.themeSetter) == null ? void 0 : _this$themeSetter.call(this, this.themeOptions);
|
|
104
157
|
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
158
|
+
}, {
|
|
159
|
+
key: "setStaticRoute",
|
|
160
|
+
value: function setStaticRoute(staticRoute) {
|
|
161
|
+
var _this$setRoute;
|
|
109
162
|
|
|
110
|
-
|
|
163
|
+
if (!this.setRoute) {
|
|
164
|
+
console.warn("this.setRoute is not defined yet");
|
|
165
|
+
}
|
|
111
166
|
|
|
112
|
-
|
|
113
|
-
console.warn("this.themeSetter is not defined yet");
|
|
167
|
+
(_this$setRoute = this.setRoute) == null ? void 0 : _this$setRoute.call(this, staticRoute);
|
|
114
168
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (!this.setRoute) {
|
|
123
|
-
console.warn("this.setRoute is not defined yet");
|
|
169
|
+
}, {
|
|
170
|
+
key: "setStore",
|
|
171
|
+
value: function setStore(state) {
|
|
172
|
+
this.store.dispatch({
|
|
173
|
+
type: 'auth/setState',
|
|
174
|
+
payload: state
|
|
175
|
+
});
|
|
124
176
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
setStore(state) {
|
|
130
|
-
this.store.dispatch({
|
|
131
|
-
type: 'auth/setState',
|
|
132
|
-
payload: state
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
}
|
|
177
|
+
}]);
|
|
178
|
+
return LoginBoxRenderer;
|
|
179
|
+
}();
|
|
137
180
|
|
|
138
181
|
exports.LoginBoxRenderer = LoginBoxRenderer;
|
|
139
182
|
var _default = LoginBoxRenderer;
|
|
140
|
-
exports
|
|
183
|
+
exports["default"] = _default;
|
package/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license Frontegg v6.
|
|
1
|
+
/** @license Frontegg v6.11.0
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -16,7 +16,7 @@ Object.keys(_AppHolder).forEach(function (key) {
|
|
|
16
16
|
if (key in exports && exports[key] === _AppHolder[key]) return;
|
|
17
17
|
Object.defineProperty(exports, key, {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () {
|
|
19
|
+
get: function get() {
|
|
20
20
|
return _AppHolder[key];
|
|
21
21
|
}
|
|
22
22
|
});
|
|
@@ -29,7 +29,7 @@ Object.keys(_FronteggApp).forEach(function (key) {
|
|
|
29
29
|
if (key in exports && exports[key] === _FronteggApp[key]) return;
|
|
30
30
|
Object.defineProperty(exports, key, {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () {
|
|
32
|
+
get: function get() {
|
|
33
33
|
return _FronteggApp[key];
|
|
34
34
|
}
|
|
35
35
|
});
|
|
@@ -42,7 +42,7 @@ Object.keys(_HostedLogin).forEach(function (key) {
|
|
|
42
42
|
if (key in exports && exports[key] === _HostedLogin[key]) return;
|
|
43
43
|
Object.defineProperty(exports, key, {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () {
|
|
45
|
+
get: function get() {
|
|
46
46
|
return _HostedLogin[key];
|
|
47
47
|
}
|
|
48
48
|
});
|
|
@@ -55,7 +55,7 @@ Object.keys(_AdminPortal).forEach(function (key) {
|
|
|
55
55
|
if (key in exports && exports[key] === _AdminPortal[key]) return;
|
|
56
56
|
Object.defineProperty(exports, key, {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function () {
|
|
58
|
+
get: function get() {
|
|
59
59
|
return _AdminPortal[key];
|
|
60
60
|
}
|
|
61
61
|
});
|
|
@@ -68,7 +68,7 @@ Object.keys(_CheckoutDialog).forEach(function (key) {
|
|
|
68
68
|
if (key in exports && exports[key] === _CheckoutDialog[key]) return;
|
|
69
69
|
Object.defineProperty(exports, key, {
|
|
70
70
|
enumerable: true,
|
|
71
|
-
get: function () {
|
|
71
|
+
get: function get() {
|
|
72
72
|
return _CheckoutDialog[key];
|
|
73
73
|
}
|
|
74
74
|
});
|
|
@@ -81,7 +81,7 @@ Object.keys(_AdminPortalRenderer).forEach(function (key) {
|
|
|
81
81
|
if (key in exports && exports[key] === _AdminPortalRenderer[key]) return;
|
|
82
82
|
Object.defineProperty(exports, key, {
|
|
83
83
|
enumerable: true,
|
|
84
|
-
get: function () {
|
|
84
|
+
get: function get() {
|
|
85
85
|
return _AdminPortalRenderer[key];
|
|
86
86
|
}
|
|
87
87
|
});
|
|
@@ -94,7 +94,7 @@ Object.keys(_LoginBoxRenderer).forEach(function (key) {
|
|
|
94
94
|
if (key in exports && exports[key] === _LoginBoxRenderer[key]) return;
|
|
95
95
|
Object.defineProperty(exports, key, {
|
|
96
96
|
enumerable: true,
|
|
97
|
-
get: function () {
|
|
97
|
+
get: function get() {
|
|
98
98
|
return _LoginBoxRenderer[key];
|
|
99
99
|
}
|
|
100
100
|
});
|
|
@@ -107,7 +107,7 @@ Object.keys(_initialize).forEach(function (key) {
|
|
|
107
107
|
if (key in exports && exports[key] === _initialize[key]) return;
|
|
108
108
|
Object.defineProperty(exports, key, {
|
|
109
109
|
enumerable: true,
|
|
110
|
-
get: function () {
|
|
110
|
+
get: function get() {
|
|
111
111
|
return _initialize[key];
|
|
112
112
|
}
|
|
113
113
|
});
|
package/node/initialize.js
CHANGED
|
@@ -1,125 +1,163 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.initialize = void 0;
|
|
7
9
|
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
|
|
16
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
+
|
|
18
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
+
|
|
20
|
+
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
21
|
+
|
|
8
22
|
var _FronteggApp = require("./FronteggApp");
|
|
9
23
|
|
|
10
24
|
var _AppHolder = require("./AppHolder");
|
|
11
25
|
|
|
12
26
|
var _utils = require("./utils");
|
|
13
27
|
|
|
14
|
-
|
|
15
|
-
|
|
28
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
29
|
+
|
|
30
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
|
+
|
|
32
|
+
var initialize = function initialize(options) {
|
|
33
|
+
var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
|
|
34
|
+
var createdApp = new _FronteggApp.FronteggApp(options, name);
|
|
16
35
|
|
|
17
36
|
if (typeof document !== 'undefined') {
|
|
18
37
|
var _document$querySelect;
|
|
19
38
|
|
|
20
39
|
if (!options.contextOptions.baseUrl) {
|
|
21
|
-
|
|
22
|
-
document.body.innerHTML =
|
|
40
|
+
var error = new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');
|
|
41
|
+
document.body.innerHTML = "";
|
|
23
42
|
alert(error.message);
|
|
24
43
|
throw error;
|
|
25
44
|
}
|
|
26
45
|
|
|
27
46
|
if (!customElements.get('frontegg-app')) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
super(...args);
|
|
31
|
-
this.app = null;
|
|
32
|
-
}
|
|
47
|
+
var FronteggAppContainer = /*#__PURE__*/function (_HTMLElement) {
|
|
48
|
+
(0, _inherits2["default"])(FronteggAppContainer, _HTMLElement);
|
|
33
49
|
|
|
34
|
-
|
|
35
|
-
return ['app-name'];
|
|
36
|
-
}
|
|
50
|
+
var _super = _createSuper(FronteggAppContainer);
|
|
37
51
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
52
|
+
function FronteggAppContainer() {
|
|
53
|
+
var _this;
|
|
41
54
|
|
|
42
|
-
|
|
43
|
-
if (name === 'app-name') {
|
|
44
|
-
if (oldValue === null) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
55
|
+
(0, _classCallCheck2["default"])(this, FronteggAppContainer);
|
|
47
56
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
this.innerHTML = '';
|
|
53
|
-
|
|
54
|
-
if (newValue === null) {
|
|
55
|
-
this.remove();
|
|
56
|
-
} else {
|
|
57
|
-
this.updateContent();
|
|
58
|
-
}
|
|
57
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
58
|
+
args[_key] = arguments[_key];
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
62
|
+
_this.app = null;
|
|
63
|
+
return _this;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
(0, _createClass2["default"])(FronteggAppContainer, [{
|
|
67
|
+
key: "connectedCallback",
|
|
68
|
+
value: function connectedCallback() {
|
|
69
|
+
this.updateContent();
|
|
70
|
+
}
|
|
71
|
+
}, {
|
|
72
|
+
key: "attributeChangedCallback",
|
|
73
|
+
value: function attributeChangedCallback(name, oldValue, newValue) {
|
|
74
|
+
if (name === 'app-name') {
|
|
75
|
+
if (oldValue === null) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (oldValue === newValue) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
this.innerHTML = '';
|
|
84
|
+
|
|
85
|
+
if (newValue === null) {
|
|
86
|
+
this.remove();
|
|
87
|
+
} else {
|
|
88
|
+
this.updateContent();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
66
91
|
|
|
67
|
-
|
|
92
|
+
console.debug('attributeChangedCallback', name, oldValue, newValue);
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "updateContent",
|
|
96
|
+
value: function updateContent() {
|
|
97
|
+
var _this$getAttribute;
|
|
68
98
|
|
|
69
|
-
|
|
99
|
+
var appName = (_this$getAttribute = this.getAttribute('app-name')) != null ? _this$getAttribute : 'default';
|
|
70
100
|
|
|
71
|
-
|
|
72
|
-
throw Error(`FronteggApp not found for appName: '${appName}'`);
|
|
73
|
-
}
|
|
101
|
+
var app = _AppHolder.AppHolder.getInstance(appName);
|
|
74
102
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
});
|
|
79
|
-
const loginBoxContainer = (0, _utils.createElement)(this, 'div', {
|
|
80
|
-
id: `frontegg-login-box-container-${app.name}`
|
|
81
|
-
});
|
|
82
|
-
const checkoutDialogContainer = (0, _utils.createElement)(this, 'div', {
|
|
83
|
-
id: `frontegg-checkout-dialog-container-${app.name}`
|
|
84
|
-
});
|
|
85
|
-
const adminBoxShadowEl = adminPortalContainer.attachShadow({
|
|
86
|
-
mode: 'open'
|
|
87
|
-
});
|
|
88
|
-
const loginBoxShadowEl = loginBoxContainer.attachShadow({
|
|
89
|
-
mode: 'open'
|
|
90
|
-
});
|
|
91
|
-
const checkoutDialogShadowEl = checkoutDialogContainer.attachShadow({
|
|
92
|
-
mode: 'open'
|
|
93
|
-
});
|
|
94
|
-
const adminPortalEl = (0, _utils.createElement)(adminBoxShadowEl, 'div', {
|
|
95
|
-
id: `frontegg-admin-portal-${app.name}`,
|
|
96
|
-
class: 'frontegg-root-content'
|
|
97
|
-
});
|
|
98
|
-
const loginBoxEl = (0, _utils.createElement)(loginBoxShadowEl, 'div', {
|
|
99
|
-
id: `frontegg-login-box-${app.name}`,
|
|
100
|
-
class: 'frontegg-root-content'
|
|
101
|
-
});
|
|
102
|
-
const checkoutDialogEl = (0, _utils.createElement)(checkoutDialogShadowEl, 'div', {
|
|
103
|
-
id: `frontegg-checkout-dialog-${app.name}`,
|
|
104
|
-
class: 'frontegg-root-content'
|
|
105
|
-
});
|
|
106
|
-
app.initContainers({
|
|
107
|
-
adminPortalEl,
|
|
108
|
-
loginBoxEl,
|
|
109
|
-
adminPortalContainer,
|
|
110
|
-
loginBoxContainer,
|
|
111
|
-
checkoutDialogContainer,
|
|
112
|
-
checkoutDialogEl
|
|
113
|
-
});
|
|
114
|
-
}
|
|
103
|
+
if (app === null) {
|
|
104
|
+
throw Error("FronteggApp not found for appName: '".concat(appName, "'"));
|
|
105
|
+
}
|
|
115
106
|
|
|
116
|
-
|
|
107
|
+
this.setAttribute('id', "frontegg-app-".concat(app.name));
|
|
108
|
+
var adminPortalContainer = (0, _utils.createElement)(this, 'div', {
|
|
109
|
+
id: "frontegg-admin-portal-container-".concat(app.name)
|
|
110
|
+
});
|
|
111
|
+
var loginBoxContainer = (0, _utils.createElement)(this, 'div', {
|
|
112
|
+
id: "frontegg-login-box-container-".concat(app.name)
|
|
113
|
+
});
|
|
114
|
+
var checkoutDialogContainer = (0, _utils.createElement)(this, 'div', {
|
|
115
|
+
id: "frontegg-checkout-dialog-container-".concat(app.name)
|
|
116
|
+
});
|
|
117
|
+
var adminBoxShadowEl = adminPortalContainer.attachShadow({
|
|
118
|
+
mode: 'open'
|
|
119
|
+
});
|
|
120
|
+
var loginBoxShadowEl = loginBoxContainer.attachShadow({
|
|
121
|
+
mode: 'open'
|
|
122
|
+
});
|
|
123
|
+
var checkoutDialogShadowEl = checkoutDialogContainer.attachShadow({
|
|
124
|
+
mode: 'open'
|
|
125
|
+
});
|
|
126
|
+
var adminPortalEl = (0, _utils.createElement)(adminBoxShadowEl, 'div', {
|
|
127
|
+
id: "frontegg-admin-portal-".concat(app.name),
|
|
128
|
+
"class": 'frontegg-root-content'
|
|
129
|
+
});
|
|
130
|
+
var loginBoxEl = (0, _utils.createElement)(loginBoxShadowEl, 'div', {
|
|
131
|
+
id: "frontegg-login-box-".concat(app.name),
|
|
132
|
+
"class": 'frontegg-root-content'
|
|
133
|
+
});
|
|
134
|
+
var checkoutDialogEl = (0, _utils.createElement)(checkoutDialogShadowEl, 'div', {
|
|
135
|
+
id: "frontegg-checkout-dialog-".concat(app.name),
|
|
136
|
+
"class": 'frontegg-root-content'
|
|
137
|
+
});
|
|
138
|
+
app.initContainers({
|
|
139
|
+
adminPortalEl: adminPortalEl,
|
|
140
|
+
loginBoxEl: loginBoxEl,
|
|
141
|
+
adminPortalContainer: adminPortalContainer,
|
|
142
|
+
loginBoxContainer: loginBoxContainer,
|
|
143
|
+
checkoutDialogContainer: checkoutDialogContainer,
|
|
144
|
+
checkoutDialogEl: checkoutDialogEl
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}], [{
|
|
148
|
+
key: "observedAttributes",
|
|
149
|
+
get: function get() {
|
|
150
|
+
return ['app-name'];
|
|
151
|
+
}
|
|
152
|
+
}]);
|
|
153
|
+
return FronteggAppContainer;
|
|
154
|
+
}( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(HTMLElement));
|
|
117
155
|
|
|
118
156
|
customElements.define('frontegg-app', FronteggAppContainer);
|
|
119
157
|
}
|
|
120
158
|
|
|
121
|
-
(_document$querySelect = document.querySelector(
|
|
122
|
-
|
|
159
|
+
(_document$querySelect = document.querySelector("frontegg-app[app-name=\"".concat(createdApp.name, "\"]"))) == null ? void 0 : _document$querySelect.remove();
|
|
160
|
+
var element = document.createElement('frontegg-app');
|
|
123
161
|
element.setAttribute('app-name', createdApp.name);
|
|
124
162
|
document.body.appendChild(element);
|
|
125
163
|
}
|
package/node/utils/index.js
CHANGED
|
@@ -5,36 +5,45 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.waitThemeSetter = exports.formatName = exports.createElement = void 0;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
var formatName = function formatName(name) {
|
|
9
|
+
return name.replace(/\W+/g, ' ').split(/ |\B(?=[A-Z])/).map(function (word) {
|
|
10
|
+
return word.toLowerCase();
|
|
11
|
+
}).join('');
|
|
12
|
+
};
|
|
9
13
|
|
|
10
14
|
exports.formatName = formatName;
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
var createElement = function createElement(container, type) {
|
|
17
|
+
var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
18
|
+
var el = document.createElement(type);
|
|
19
|
+
Object.keys(attrs).forEach(function (key) {
|
|
20
|
+
return el.setAttribute(key, attrs[key]);
|
|
21
|
+
});
|
|
15
22
|
container.appendChild(el);
|
|
16
23
|
return el;
|
|
17
24
|
};
|
|
18
25
|
|
|
19
26
|
exports.createElement = createElement;
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
28
|
+
var waitThemeSetter = function waitThemeSetter(instance) {
|
|
29
|
+
return new Promise(function (resolve, reject) {
|
|
30
|
+
var timeout = 4000;
|
|
31
|
+
var interval = setInterval(function () {
|
|
32
|
+
if (instance.themeSetter != null) {
|
|
33
|
+
clearInterval(interval);
|
|
34
|
+
resolve(true);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (timeout < 0) {
|
|
39
|
+
reject('Failed to load Renderer with themeSetter');
|
|
40
|
+
clearInterval(interval);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
timeout -= 50;
|
|
45
|
+
}, 50);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
39
48
|
|
|
40
49
|
exports.waitThemeSetter = waitThemeSetter;
|
package/node/version.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = void 0;
|
|
7
7
|
var _default = {
|
|
8
|
-
"cdnVersion": "6.
|
|
8
|
+
"cdnVersion": "6.11.0"
|
|
9
9
|
};
|
|
10
|
-
exports
|
|
10
|
+
exports["default"] = _default;
|