@frontegg/js 7.0.0-alpha.1 → 7.0.0-alpha.2
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/AdminPortalRenderer/index.js +1 -2
- package/FronteggApp/FronteggApp.d.ts +36 -7
- package/FronteggApp/FronteggApp.js +123 -36
- package/HostedLogin/index.js +6 -8
- package/LoginBoxRenderer/index.js +1 -2
- package/index.js +1 -1
- package/node/AdminPortalRenderer/index.js +1 -2
- package/node/FronteggApp/FronteggApp.js +121 -35
- package/node/HostedLogin/index.js +6 -8
- package/node/LoginBoxRenderer/index.js +1 -2
- package/node/index.js +1 -1
- package/node/utils/mockFlagsList.js +2 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg-helpers.production.min.js +1 -1
- package/umd/frontegg.development.js +25945 -28573
- package/umd/frontegg.production.min.js +1 -1
- package/umd/frontegg.production.min.js.LICENSE.txt +25 -17
- package/utils/mockFlagsList.js +2 -1
- package/version.js +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
@@ -37,7 +36,7 @@ export var AdminPortalRenderer = /*#__PURE__*/function () {
|
|
|
37
36
|
appName: name
|
|
38
37
|
}, this, true, undefined, undefined, true);
|
|
39
38
|
}
|
|
40
|
-
this.options =
|
|
39
|
+
this.options = Object.assign({
|
|
41
40
|
themeOptions: themeOptions,
|
|
42
41
|
iframeRendering: true,
|
|
43
42
|
metadata: {},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FronteggStore, EntitledToOptions, Entitlement, StepUpOptions, IsSteppedUpOptions } from '@frontegg/redux-store';
|
|
2
2
|
import { FronteggAppOptions, FronteggCheckoutDialogOptions, LocalizationsOverrides, LoadEntitlementsCallback } from '@frontegg/types';
|
|
3
3
|
import { IFeatureFlagsAttributes } from '@frontegg/rest-api';
|
|
4
|
+
import { CustomAttributes } from '@frontegg/entitlements-javascript-commons';
|
|
4
5
|
declare type FronteggAppContainers = {
|
|
5
6
|
adminPortalEl: HTMLElement;
|
|
6
7
|
loginBoxEl: HTMLElement;
|
|
@@ -25,7 +26,7 @@ export declare class FronteggApp {
|
|
|
25
26
|
loginBoxContainer?: HTMLElement;
|
|
26
27
|
checkoutDialogContainer?: HTMLElement;
|
|
27
28
|
loginBoxRenderer?: any;
|
|
28
|
-
store:
|
|
29
|
+
store: FronteggStore;
|
|
29
30
|
loadingListeners: (() => void)[];
|
|
30
31
|
updateLocalizations?: (localizations: LocalizationsOverrides) => void;
|
|
31
32
|
constructor(_options: FronteggAppOptions, name: string, iframeRendering?: boolean, allowMultipleRenderers?: boolean);
|
|
@@ -34,6 +35,7 @@ export declare class FronteggApp {
|
|
|
34
35
|
* @param entitlementsOptions - entitlements options from frontegg options
|
|
35
36
|
*/
|
|
36
37
|
private setEntitlementsOptions;
|
|
38
|
+
private setSessionContext;
|
|
37
39
|
loadAdminBoxMetadata: () => Promise<void>;
|
|
38
40
|
/**
|
|
39
41
|
* Loading required information on first load, mainly for refresh token and initial data.
|
|
@@ -48,6 +50,11 @@ export declare class FronteggApp {
|
|
|
48
50
|
* @param previewFeatureFlags
|
|
49
51
|
*/
|
|
50
52
|
setFeatureFlagsForPreview: (previewFeatureFlags: IFeatureFlagsAttributes) => void;
|
|
53
|
+
/**
|
|
54
|
+
* @param flags keys to check
|
|
55
|
+
* @returns an array of feature flags on/off boolean values
|
|
56
|
+
*/
|
|
57
|
+
private queryFeatureFlags;
|
|
51
58
|
initContainers(elements: FronteggAppContainers): Promise<void>;
|
|
52
59
|
updateLocalizationsSetter: (localizationUpdateFn: (localizations: LocalizationsOverrides) => void) => void;
|
|
53
60
|
updateMetadata(metadata: FronteggAppOptions['metadata']): void;
|
|
@@ -66,28 +73,50 @@ export declare class FronteggApp {
|
|
|
66
73
|
*/
|
|
67
74
|
private getEntitlementsFromStore;
|
|
68
75
|
/**
|
|
69
|
-
|
|
76
|
+
* @returns user store data
|
|
77
|
+
*/
|
|
78
|
+
private getUserFromStore;
|
|
79
|
+
/**
|
|
80
|
+
* @param customAttributes consumer attributes
|
|
81
|
+
* @returns is entitled query data including: entitltments state, final attributes (consumer and frontegg) and API version to use
|
|
82
|
+
*/
|
|
83
|
+
private getEntitlementsQueryData;
|
|
84
|
+
/**
|
|
85
|
+
@param key feature key
|
|
86
|
+
@param customAttributes user attributes
|
|
70
87
|
@returns if the user is entitled to the given feature. Attaching the justification if not
|
|
71
88
|
@throws when entitlement is not enabled via frontegg options
|
|
72
89
|
*/
|
|
73
|
-
getFeatureEntitlements(key: string): Entitlement;
|
|
90
|
+
getFeatureEntitlements(key: string, customAttributes?: CustomAttributes): Entitlement;
|
|
74
91
|
/**
|
|
75
|
-
@param key
|
|
92
|
+
@param key permission key
|
|
93
|
+
@param customAttributes user attributes
|
|
76
94
|
@returns if the user is entitled to the given permission. Attaching the justification if not
|
|
77
95
|
@throws when entitlement is not enabled via frontegg options
|
|
78
96
|
*/
|
|
79
|
-
getPermissionEntitlements(key: string): Entitlement;
|
|
97
|
+
getPermissionEntitlements(key: string, customAttributes?: CustomAttributes): Entitlement;
|
|
80
98
|
/**
|
|
81
99
|
@param options - including permission or feature key
|
|
100
|
+
@param customAttributes user attributes
|
|
82
101
|
@returns if the user is entitled to the given permission or feature. Attaching the justification if not
|
|
83
102
|
@throws when entitlement is not enabled via frontegg options
|
|
84
103
|
*/
|
|
85
|
-
getEntitlements(options: EntitledToOptions): Entitlement;
|
|
104
|
+
getEntitlements(options: EntitledToOptions, customAttributes?: CustomAttributes): Entitlement;
|
|
86
105
|
/**
|
|
87
106
|
* Load entitlements
|
|
88
107
|
* @param callback called on request completed with true if succeeded, false if failed
|
|
89
108
|
*/
|
|
90
109
|
loadEntitlements(callback?: LoadEntitlementsCallback): void;
|
|
110
|
+
/**
|
|
111
|
+
* Redirects to the step up page with the max age param and set the redirect url in the local storage
|
|
112
|
+
* @param options.maxAge optional max age
|
|
113
|
+
*/
|
|
114
|
+
stepUp(options?: StepUpOptions): void;
|
|
115
|
+
/**
|
|
116
|
+
* @param options.maxAge optional max age
|
|
117
|
+
* @return true when user is stepped up, false otherwise
|
|
118
|
+
*/
|
|
119
|
+
isSteppedUp(options?: IsSteppedUpOptions): boolean;
|
|
91
120
|
close(): void;
|
|
92
121
|
}
|
|
93
122
|
export {};
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
|
-
import {
|
|
6
|
+
import { getPermissionEntitlements as _getPermissionEntitlements, getFeatureEntitlements as _getFeatureEntitlements, redirectByStepUpUrl, isSteppedUp as _isSteppedUp, createStore } from '@frontegg/redux-store';
|
|
7
7
|
import { Metadata } from '@frontegg/types';
|
|
8
8
|
import { formatName, restoreSearchParams } from '../utils';
|
|
9
9
|
import { AppHolder } from '../AppHolder';
|
|
10
|
-
import { fetch as FronteggFetch, ContextHolder } from '@frontegg/rest-api';
|
|
10
|
+
import { fetch as FronteggFetch, ContextHolder, USE_ENTITLEMENTS_V2_ENDPOINT_FF } from '@frontegg/rest-api';
|
|
11
11
|
import { RequestSource } from '@frontegg/rest-api';
|
|
12
12
|
import * as FronteggRestApi from '@frontegg/rest-api';
|
|
13
13
|
import * as FronteggTypes from '@frontegg/types';
|
|
14
|
+
import * as FronteggReduxStore from '@frontegg/redux-store';
|
|
14
15
|
import versions from '../version';
|
|
15
16
|
import { mockFlagsList } from '../utils/mockFlagsList';
|
|
16
17
|
import { loadGTM } from './utils';
|
|
18
|
+
import * as ValtioVanilla from 'valtio/vanilla';
|
|
17
19
|
export var FronteggApp = /*#__PURE__*/function () {
|
|
18
20
|
function FronteggApp(_options, name) {
|
|
19
21
|
var _this = this,
|
|
20
|
-
_this$options$authOpt3
|
|
22
|
+
_this$options$authOpt3,
|
|
23
|
+
_options$authOptions;
|
|
21
24
|
var iframeRendering = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
22
25
|
var allowMultipleRenderers = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
23
26
|
_classCallCheck(this, FronteggApp);
|
|
@@ -79,14 +82,16 @@ export var FronteggApp = /*#__PURE__*/function () {
|
|
|
79
82
|
case 0:
|
|
80
83
|
shouldRequestHostedLoginAuthorize = (_this$options$authOpt = _this.options.authOptions) == null ? void 0 : (_this$options$authOpt2 = _this$options$authOpt.hostedLoginOptions) == null ? void 0 : _this$options$authOpt2.loadUserOnFirstLoad;
|
|
81
84
|
if (!_this.options.builderMode && _this.options.framework !== 'nextjs') {
|
|
82
|
-
if (_this.options.hostedLoginBox && !_this.options.customLoginBox
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
if (_this.options.hostedLoginBox && !_this.options.customLoginBox) {
|
|
86
|
+
if (shouldRequestHostedLoginAuthorize) {
|
|
87
|
+
_this.store.dispatch({
|
|
88
|
+
type: 'auth/requestHostedLoginAuthorizeV2',
|
|
89
|
+
payload: {
|
|
90
|
+
shouldRedirectToLogin: false,
|
|
91
|
+
firstTime: true
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
90
95
|
} else {
|
|
91
96
|
_this.store.dispatch({
|
|
92
97
|
type: 'auth/requestAuthorize',
|
|
@@ -135,7 +140,10 @@ export var FronteggApp = /*#__PURE__*/function () {
|
|
|
135
140
|
}, _callee3, null, [[4, 12]]);
|
|
136
141
|
}));
|
|
137
142
|
this.setFeatureFlagsForPreview = function (previewFeatureFlags) {
|
|
138
|
-
FronteggRestApi.FeatureFlags.set(
|
|
143
|
+
FronteggRestApi.FeatureFlags.set(Object.assign({}, mockFlagsList, previewFeatureFlags), _this.name);
|
|
144
|
+
};
|
|
145
|
+
this.queryFeatureFlags = function (flags) {
|
|
146
|
+
return FronteggRestApi.FeatureFlags.getFeatureFlags(flags, _this.name);
|
|
139
147
|
};
|
|
140
148
|
this.updateLocalizationsSetter = function (localizationUpdateFn) {
|
|
141
149
|
_this.updateLocalizations = localizationUpdateFn;
|
|
@@ -144,12 +152,31 @@ export var FronteggApp = /*#__PURE__*/function () {
|
|
|
144
152
|
var _this$store$getState$;
|
|
145
153
|
return (_this$store$getState$ = _this.store.getState().auth.user) == null ? void 0 : _this$store$getState$.entitlements;
|
|
146
154
|
};
|
|
155
|
+
this.getUserFromStore = function () {
|
|
156
|
+
return _this.store.getState().auth.user;
|
|
157
|
+
};
|
|
158
|
+
this.getEntitlementsQueryData = function (customAttributes) {
|
|
159
|
+
var user = _this.getUserFromStore();
|
|
160
|
+
var entitlements = _this.getEntitlementsFromStore();
|
|
161
|
+
var attributes = {
|
|
162
|
+
custom: customAttributes,
|
|
163
|
+
jwt: user
|
|
164
|
+
};
|
|
165
|
+
var _this$queryFeatureFla = _this.queryFeatureFlags([USE_ENTITLEMENTS_V2_ENDPOINT_FF]),
|
|
166
|
+
_this$queryFeatureFla2 = _slicedToArray(_this$queryFeatureFla, 1),
|
|
167
|
+
useEntitlementsV2 = _this$queryFeatureFla2[0];
|
|
168
|
+
return {
|
|
169
|
+
entitlements: entitlements,
|
|
170
|
+
attributes: attributes,
|
|
171
|
+
isV2: useEntitlementsV2
|
|
172
|
+
};
|
|
173
|
+
};
|
|
147
174
|
var appName = formatName(name);
|
|
148
175
|
var customElementName = "frontegg-app-".concat(appName);
|
|
149
176
|
this.iframeRendering = iframeRendering;
|
|
150
177
|
this.name = appName;
|
|
151
|
-
this.options =
|
|
152
|
-
contextOptions:
|
|
178
|
+
this.options = Object.assign({}, _options, {
|
|
179
|
+
contextOptions: Object.assign({
|
|
153
180
|
requestCredentials: 'include'
|
|
154
181
|
}, _options.contextOptions)
|
|
155
182
|
});
|
|
@@ -157,11 +184,12 @@ export var FronteggApp = /*#__PURE__*/function () {
|
|
|
157
184
|
this.cdnUrl = this.options.cdnUrl;
|
|
158
185
|
}
|
|
159
186
|
this.customElementName = customElementName;
|
|
160
|
-
var authOptions = this.options.authOptions ?
|
|
187
|
+
var authOptions = this.options.authOptions ? Object.assign({}, this.options.authOptions, {
|
|
161
188
|
hostedLoginBox: this.options.hostedLoginBox
|
|
162
189
|
}) : {
|
|
163
190
|
hostedLoginBox: this.options.hostedLoginBox
|
|
164
191
|
};
|
|
192
|
+
authOptions.onRedirectTo = _options.onRedirectTo;
|
|
165
193
|
authOptions.disableSilentRefresh = (_this$options$authOpt3 = this.options.authOptions) == null ? void 0 : _this$options$authOpt3.disableSilentRefresh;
|
|
166
194
|
if (this.options.store) {
|
|
167
195
|
this.store = this.options.store;
|
|
@@ -170,16 +198,24 @@ export var FronteggApp = /*#__PURE__*/function () {
|
|
|
170
198
|
}
|
|
171
199
|
} else {
|
|
172
200
|
var _this$options$authOpt4, _this$options$auditsO;
|
|
173
|
-
this.store =
|
|
201
|
+
this.store = createStore({
|
|
174
202
|
context: this.options.contextOptions,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
203
|
+
name: this.name,
|
|
204
|
+
builderMode: this.options.builderMode,
|
|
205
|
+
previewMode: this.options.previewMode,
|
|
206
|
+
storeHolder: this,
|
|
207
|
+
urlStrategy: this.options.urlStrategy,
|
|
208
|
+
initialState: {
|
|
209
|
+
auth: Object.assign({}, authOptions, (_this$options$authOpt4 = this.options.authOptions) != null ? _this$options$authOpt4 : {}),
|
|
210
|
+
auditLogs: Object.assign({}, (_this$options$auditsO = this.options.auditsOptions) != null ? _this$options$auditsO : {})
|
|
211
|
+
}
|
|
212
|
+
});
|
|
180
213
|
}
|
|
181
214
|
AppHolder.setInstance(appName, this);
|
|
182
215
|
this.setEntitlementsOptions(_options.entitlementsOptions);
|
|
216
|
+
this.setSessionContext({
|
|
217
|
+
enableSessionPerTenant: (_options$authOptions = _options.authOptions) == null ? void 0 : _options$authOptions.enableSessionPerTenant
|
|
218
|
+
});
|
|
183
219
|
|
|
184
220
|
// for feature flags (for entitlements)
|
|
185
221
|
ContextHolder.setAppName(appName);
|
|
@@ -192,7 +228,12 @@ export var FronteggApp = /*#__PURE__*/function () {
|
|
|
192
228
|
_createClass(FronteggApp, [{
|
|
193
229
|
key: "setEntitlementsOptions",
|
|
194
230
|
value: function setEntitlementsOptions(entitlementsOptions) {
|
|
195
|
-
ContextHolder.setEntitlementsOptions(
|
|
231
|
+
ContextHolder.setEntitlementsOptions(Object.assign({}, entitlementsOptions));
|
|
232
|
+
}
|
|
233
|
+
}, {
|
|
234
|
+
key: "setSessionContext",
|
|
235
|
+
value: function setSessionContext(sessionContext) {
|
|
236
|
+
ContextHolder.setSessionContext(Object.assign({}, sessionContext));
|
|
196
237
|
}
|
|
197
238
|
}, {
|
|
198
239
|
key: "initContainers",
|
|
@@ -318,7 +359,9 @@ export var FronteggApp = /*#__PURE__*/function () {
|
|
|
318
359
|
if (window["".concat(component, "Init")]) {
|
|
319
360
|
resolve(window["".concat(component, "Init")]({
|
|
320
361
|
FronteggRestApi: FronteggRestApi,
|
|
321
|
-
FronteggTypes: FronteggTypes
|
|
362
|
+
FronteggTypes: FronteggTypes,
|
|
363
|
+
FronteggReduxStore: FronteggReduxStore,
|
|
364
|
+
ValtioVanilla: ValtioVanilla
|
|
322
365
|
}));
|
|
323
366
|
} else {
|
|
324
367
|
resolve(window[component]);
|
|
@@ -422,7 +465,7 @@ export var FronteggApp = /*#__PURE__*/function () {
|
|
|
422
465
|
return this.loadScript('FronteggAdminPortal');
|
|
423
466
|
case 2:
|
|
424
467
|
FronteggAdminPortal = _context7.sent;
|
|
425
|
-
this.checkoutDialogRenderer = FronteggAdminPortal.renderCheckoutDialog(this.checkoutDialogEl,
|
|
468
|
+
this.checkoutDialogRenderer = FronteggAdminPortal.renderCheckoutDialog(this.checkoutDialogEl, Object.assign({
|
|
426
469
|
injector: this
|
|
427
470
|
}, opts, {
|
|
428
471
|
options: this.options
|
|
@@ -456,40 +499,49 @@ export var FronteggApp = /*#__PURE__*/function () {
|
|
|
456
499
|
key: "getFeatureEntitlements",
|
|
457
500
|
value:
|
|
458
501
|
/**
|
|
459
|
-
@param key
|
|
502
|
+
@param key feature key
|
|
503
|
+
@param customAttributes user attributes
|
|
460
504
|
@returns if the user is entitled to the given feature. Attaching the justification if not
|
|
461
505
|
@throws when entitlement is not enabled via frontegg options
|
|
462
506
|
*/
|
|
463
|
-
function getFeatureEntitlements(key) {
|
|
464
|
-
var
|
|
465
|
-
|
|
507
|
+
function getFeatureEntitlements(key, customAttributes) {
|
|
508
|
+
var _this$getEntitlements = this.getEntitlementsQueryData(customAttributes),
|
|
509
|
+
entitlements = _this$getEntitlements.entitlements,
|
|
510
|
+
attributes = _this$getEntitlements.attributes,
|
|
511
|
+
isV2 = _this$getEntitlements.isV2;
|
|
512
|
+
return _getFeatureEntitlements(entitlements, key, attributes, isV2);
|
|
466
513
|
}
|
|
467
514
|
|
|
468
515
|
/**
|
|
469
|
-
@param key
|
|
516
|
+
@param key permission key
|
|
517
|
+
@param customAttributes user attributes
|
|
470
518
|
@returns if the user is entitled to the given permission. Attaching the justification if not
|
|
471
519
|
@throws when entitlement is not enabled via frontegg options
|
|
472
520
|
*/
|
|
473
521
|
}, {
|
|
474
522
|
key: "getPermissionEntitlements",
|
|
475
|
-
value: function getPermissionEntitlements(key) {
|
|
476
|
-
var
|
|
477
|
-
|
|
523
|
+
value: function getPermissionEntitlements(key, customAttributes) {
|
|
524
|
+
var _this$getEntitlements2 = this.getEntitlementsQueryData(customAttributes),
|
|
525
|
+
entitlements = _this$getEntitlements2.entitlements,
|
|
526
|
+
attributes = _this$getEntitlements2.attributes,
|
|
527
|
+
isV2 = _this$getEntitlements2.isV2;
|
|
528
|
+
return _getPermissionEntitlements(entitlements, key, attributes, isV2);
|
|
478
529
|
}
|
|
479
530
|
|
|
480
531
|
/**
|
|
481
532
|
@param options - including permission or feature key
|
|
533
|
+
@param customAttributes user attributes
|
|
482
534
|
@returns if the user is entitled to the given permission or feature. Attaching the justification if not
|
|
483
535
|
@throws when entitlement is not enabled via frontegg options
|
|
484
536
|
*/
|
|
485
537
|
}, {
|
|
486
538
|
key: "getEntitlements",
|
|
487
|
-
value: function getEntitlements(options) {
|
|
539
|
+
value: function getEntitlements(options, customAttributes) {
|
|
488
540
|
// we use permissionKey (options key) to decide if the user is using permission key or feature key
|
|
489
541
|
if ('permissionKey' in options) {
|
|
490
|
-
return this.getPermissionEntitlements(options.permissionKey);
|
|
542
|
+
return this.getPermissionEntitlements(options.permissionKey, customAttributes);
|
|
491
543
|
}
|
|
492
|
-
return this.getFeatureEntitlements(options.featureKey);
|
|
544
|
+
return this.getFeatureEntitlements(options.featureKey, customAttributes);
|
|
493
545
|
}
|
|
494
546
|
|
|
495
547
|
/**
|
|
@@ -506,6 +558,41 @@ export var FronteggApp = /*#__PURE__*/function () {
|
|
|
506
558
|
}
|
|
507
559
|
});
|
|
508
560
|
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Redirects to the step up page with the max age param and set the redirect url in the local storage
|
|
564
|
+
* @param options.maxAge optional max age
|
|
565
|
+
*/
|
|
566
|
+
}, {
|
|
567
|
+
key: "stepUp",
|
|
568
|
+
value: function stepUp(options) {
|
|
569
|
+
var state = this.store.getState();
|
|
570
|
+
var _ref4 = (state == null ? void 0 : state.auth) || {},
|
|
571
|
+
hostedLoginBox = _ref4.hostedLoginBox,
|
|
572
|
+
stepUpUrl = _ref4.routes.stepUpUrl;
|
|
573
|
+
if (hostedLoginBox) {
|
|
574
|
+
this.store.dispatch({
|
|
575
|
+
type: 'auth/stepUpHostedLogin',
|
|
576
|
+
payload: options
|
|
577
|
+
});
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
redirectByStepUpUrl(stepUpUrl, state.auth.onRedirectTo, options == null ? void 0 : options.maxAge);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* @param options.maxAge optional max age
|
|
585
|
+
* @return true when user is stepped up, false otherwise
|
|
586
|
+
*/
|
|
587
|
+
}, {
|
|
588
|
+
key: "isSteppedUp",
|
|
589
|
+
value: function isSteppedUp() {
|
|
590
|
+
var _this$store$getState;
|
|
591
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
592
|
+
var _ref5 = ((_this$store$getState = this.store.getState()) == null ? void 0 : _this$store$getState.auth) || {},
|
|
593
|
+
user = _ref5.user;
|
|
594
|
+
return _isSteppedUp(user, options);
|
|
595
|
+
}
|
|
509
596
|
}, {
|
|
510
597
|
key: "close",
|
|
511
598
|
value: function close() {
|
package/HostedLogin/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import { authActions } from '@frontegg/redux-store';
|
|
5
3
|
import { AppHolder } from '../AppHolder';
|
|
6
4
|
import { ContextHolder } from '@frontegg/rest-api';
|
|
7
5
|
export var HostedLogin = /*#__PURE__*/function () {
|
|
@@ -15,23 +13,23 @@ export var HostedLogin = /*#__PURE__*/function () {
|
|
|
15
13
|
var app = AppHolder.getInstance(appName);
|
|
16
14
|
if (isAuthenticated && accessToken) {
|
|
17
15
|
ContextHolder.setAccessToken(accessToken);
|
|
18
|
-
ContextHolder.setUser(
|
|
16
|
+
ContextHolder.setUser(Object.assign({}, user, {
|
|
19
17
|
accessToken: accessToken
|
|
20
18
|
}));
|
|
21
|
-
app.store.
|
|
19
|
+
app.store.actions.setAuthState({
|
|
22
20
|
isLoading: false,
|
|
23
21
|
isAuthenticated: isAuthenticated,
|
|
24
22
|
user: user
|
|
25
|
-
})
|
|
26
|
-
app.store.
|
|
23
|
+
});
|
|
24
|
+
app.store.actions.loadTenants();
|
|
27
25
|
} else {
|
|
28
26
|
ContextHolder.setAccessToken(null);
|
|
29
27
|
ContextHolder.setUser(null);
|
|
30
|
-
app.store.
|
|
28
|
+
app.store.actions.setAuthState({
|
|
31
29
|
isLoading: false,
|
|
32
30
|
isAuthenticated: false,
|
|
33
31
|
user: null
|
|
34
|
-
})
|
|
32
|
+
});
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
35
|
}]);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
@@ -39,7 +38,7 @@ export var LoginBoxRenderer = /*#__PURE__*/function () {
|
|
|
39
38
|
appName: name
|
|
40
39
|
}, this, true, undefined, undefined, true);
|
|
41
40
|
}
|
|
42
|
-
this.options =
|
|
41
|
+
this.options = Object.assign({
|
|
43
42
|
themeOptions: themeOptions,
|
|
44
43
|
iframeRendering: true,
|
|
45
44
|
metadata: {},
|
package/index.js
CHANGED
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getThemeAdminByName = exports["default"] = exports.AdminPortalRenderer = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
12
|
var _reduxStore = require("@frontegg/redux-store");
|
|
@@ -45,7 +44,7 @@ var AdminPortalRenderer = /*#__PURE__*/function () {
|
|
|
45
44
|
appName: name
|
|
46
45
|
}, this, true, undefined, undefined, true);
|
|
47
46
|
}
|
|
48
|
-
this.options = (
|
|
47
|
+
this.options = Object.assign({
|
|
49
48
|
themeOptions: themeOptions,
|
|
50
49
|
iframeRendering: true,
|
|
51
50
|
metadata: {},
|