@frontegg/js 6.165.0 → 6.166.0-alpha.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.
@@ -1,4 +1,4 @@
1
- import { EnhancedStore, EntitledToOptions, Entitlement } from '@frontegg/redux-store';
1
+ import { EnhancedStore, 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
4
  import { CustomAttributes } from '@frontegg/entitlements-javascript-commons';
@@ -107,6 +107,16 @@ export declare class FronteggApp {
107
107
  * @param callback called on request completed with true if succeeded, false if failed
108
108
  */
109
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;
110
120
  close(): void;
111
121
  }
112
122
  export {};
@@ -4,7 +4,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
4
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
5
5
  import _createClass from "@babel/runtime/helpers/esm/createClass";
6
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
- import { createFronteggStore, getPermissionEntitlements as _getPermissionEntitlements, getFeatureEntitlements as _getFeatureEntitlements } from '@frontegg/redux-store';
7
+ import { createFronteggStore, getPermissionEntitlements as _getPermissionEntitlements, getFeatureEntitlements as _getFeatureEntitlements, redirectByStepUpUrl, isSteppedUp as _isSteppedUp } from '@frontegg/redux-store';
8
8
  import { Metadata } from '@frontegg/types';
9
9
  import { formatName, restoreSearchParams } from '../utils';
10
10
  import { AppHolder } from '../AppHolder';
@@ -549,6 +549,41 @@ export var FronteggApp = /*#__PURE__*/function () {
549
549
  }
550
550
  });
551
551
  }
552
+
553
+ /**
554
+ * Redirects to the step up page with the max age param and set the redirect url in the local storage
555
+ * @param options.maxAge optional max age
556
+ */
557
+ }, {
558
+ key: "stepUp",
559
+ value: function stepUp(options) {
560
+ var state = this.store.getState();
561
+ var _ref4 = (state == null ? void 0 : state.auth) || {},
562
+ hostedLoginBox = _ref4.hostedLoginBox,
563
+ stepUpUrl = _ref4.routes.stepUpUrl;
564
+ if (hostedLoginBox) {
565
+ this.store.dispatch({
566
+ type: 'auth/stepUpHostedLogin',
567
+ payload: options
568
+ });
569
+ return;
570
+ }
571
+ redirectByStepUpUrl(stepUpUrl, state.auth.onRedirectTo, options == null ? void 0 : options.maxAge);
572
+ }
573
+
574
+ /**
575
+ * @param options.maxAge optional max age
576
+ * @return true when user is stepped up, false otherwise
577
+ */
578
+ }, {
579
+ key: "isSteppedUp",
580
+ value: function isSteppedUp() {
581
+ var _this$store$getState;
582
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
583
+ var _ref5 = ((_this$store$getState = this.store.getState()) == null ? void 0 : _this$store$getState.auth) || {},
584
+ user = _ref5.user;
585
+ return _isSteppedUp(user, options);
586
+ }
552
587
  }, {
553
588
  key: "close",
554
589
  value: function close() {
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.165.0
1
+ /** @license Frontegg v6.166.0-alpha.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.
@@ -556,6 +556,41 @@ var FronteggApp = /*#__PURE__*/function () {
556
556
  }
557
557
  });
558
558
  }
559
+
560
+ /**
561
+ * Redirects to the step up page with the max age param and set the redirect url in the local storage
562
+ * @param options.maxAge optional max age
563
+ */
564
+ }, {
565
+ key: "stepUp",
566
+ value: function stepUp(options) {
567
+ var state = this.store.getState();
568
+ var _ref4 = (state == null ? void 0 : state.auth) || {},
569
+ hostedLoginBox = _ref4.hostedLoginBox,
570
+ stepUpUrl = _ref4.routes.stepUpUrl;
571
+ if (hostedLoginBox) {
572
+ this.store.dispatch({
573
+ type: 'auth/stepUpHostedLogin',
574
+ payload: options
575
+ });
576
+ return;
577
+ }
578
+ (0, _reduxStore.redirectByStepUpUrl)(stepUpUrl, state.auth.onRedirectTo, options == null ? void 0 : options.maxAge);
579
+ }
580
+
581
+ /**
582
+ * @param options.maxAge optional max age
583
+ * @return true when user is stepped up, false otherwise
584
+ */
585
+ }, {
586
+ key: "isSteppedUp",
587
+ value: function isSteppedUp() {
588
+ var _this$store$getState;
589
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
590
+ var _ref5 = ((_this$store$getState = this.store.getState()) == null ? void 0 : _this$store$getState.auth) || {},
591
+ user = _ref5.user;
592
+ return (0, _reduxStore.isSteppedUp)(user, options);
593
+ }
559
594
  }, {
560
595
  key: "close",
561
596
  value: function close() {
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.165.0
1
+ /** @license Frontegg v6.166.0-alpha.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.
package/node/version.js CHANGED
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _default = {
8
- cdnVersion: '6.165.0'
8
+ cdnVersion: '6.166.0-alpha.0'
9
9
  };
10
10
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@frontegg/js",
3
- "version": "6.165.0",
3
+ "version": "6.166.0-alpha.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
7
7
  "dependencies": {
8
8
  "@babel/runtime": "^7.18.6",
9
- "@frontegg/types": "6.165.0"
9
+ "@frontegg/types": "6.166.0-alpha.0"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [