@frontegg/js 6.185.0-alpha.0 → 6.185.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.
@@ -1,4 +1,5 @@
1
1
  export declare class AdminPortal {
2
2
  static show(name?: string): void;
3
+ static showMultiApp(name?: string): void;
3
4
  static hide(name?: string): void;
4
5
  }
@@ -11,6 +11,14 @@ export var AdminPortal = /*#__PURE__*/function () {
11
11
  var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
12
12
  AppHolder.getInstance(name).showAdminPortal();
13
13
  }
14
+ }, {
15
+ key: "showMultiApp",
16
+ value: function showMultiApp() {
17
+ var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
18
+ AppHolder.getInstance(name).showAdminPortal({
19
+ isMultiApp: true
20
+ });
21
+ }
14
22
  }, {
15
23
  key: "hide",
16
24
  value: function hide() {
@@ -64,7 +64,9 @@ export declare class FronteggApp {
64
64
  logout(): void;
65
65
  loadScript(component: string): Promise<unknown>;
66
66
  loadLoginBox(): Promise<void>;
67
- showAdminPortal(): Promise<void>;
67
+ showAdminPortal(options?: {
68
+ isMultiApp?: boolean;
69
+ }): Promise<void>;
68
70
  hideAdminPortal(): void;
69
71
  showCheckoutDialog(opts: FronteggCheckoutDialogOptions): Promise<void>;
70
72
  hideCheckoutDialog(): void;
@@ -1,3 +1,4 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
3
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/esm/createClass";
@@ -6,7 +7,7 @@ import { createFronteggStore, getPermissionEntitlements as _getPermissionEntitle
6
7
  import { Metadata } from '@frontegg/types';
7
8
  import { formatName, restoreSearchParams } from '../utils';
8
9
  import { AppHolder } from '../AppHolder';
9
- import { fetch as FronteggFetch, ContextHolder } from '@frontegg/rest-api';
10
+ import { fetch as FronteggFetch, ContextHolder, USE_ENTITLEMENTS_V2_ENDPOINT_FF } from '@frontegg/rest-api';
10
11
  import { RequestSource } from '@frontegg/rest-api';
11
12
  import * as FronteggRestApi from '@frontegg/rest-api';
12
13
  import * as FronteggTypes from '@frontegg/types';
@@ -159,9 +160,13 @@ export var FronteggApp = /*#__PURE__*/function () {
159
160
  custom: customAttributes,
160
161
  jwt: user
161
162
  };
163
+ var _this$queryFeatureFla = _this.queryFeatureFlags([USE_ENTITLEMENTS_V2_ENDPOINT_FF]),
164
+ _this$queryFeatureFla2 = _slicedToArray(_this$queryFeatureFla, 1),
165
+ useEntitlementsV2 = _this$queryFeatureFla2[0];
162
166
  return {
163
167
  entitlements: entitlements,
164
- attributes: attributes
168
+ attributes: attributes,
169
+ isV2: useEntitlementsV2
165
170
  };
166
171
  };
167
172
  var appName = formatName(name);
@@ -399,27 +404,32 @@ export var FronteggApp = /*#__PURE__*/function () {
399
404
  }, {
400
405
  key: "showAdminPortal",
401
406
  value: function () {
402
- var _showAdminPortal = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
403
- var FronteggAdminPortal;
407
+ var _showAdminPortal = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(options) {
408
+ var _ref4, isMultiApp, FronteggAdminPortal;
404
409
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
405
410
  while (1) switch (_context6.prev = _context6.next) {
406
411
  case 0:
412
+ _ref4 = options != null ? options : {
413
+ isMultiApp: false
414
+ }, isMultiApp = _ref4.isMultiApp;
407
415
  FronteggRestApi.ContextHolder.setRequestSource(RequestSource.AdminPortal);
408
- _context6.next = 3;
416
+ _context6.next = 4;
409
417
  return this.loadScript('FronteggAdminPortal');
410
- case 3:
418
+ case 4:
411
419
  FronteggAdminPortal = _context6.sent;
412
420
  this.adminPortalRenderer = FronteggAdminPortal.render(this.adminPortalEl, {
413
421
  injector: this,
414
- options: this.options
422
+ options: Object.assign({
423
+ isMultiApp: isMultiApp
424
+ }, this.options)
415
425
  });
416
- case 5:
426
+ case 6:
417
427
  case "end":
418
428
  return _context6.stop();
419
429
  }
420
430
  }, _callee6, this);
421
431
  }));
422
- function showAdminPortal() {
432
+ function showAdminPortal(_x2) {
423
433
  return _showAdminPortal.apply(this, arguments);
424
434
  }
425
435
  return showAdminPortal;
@@ -461,7 +471,7 @@ export var FronteggApp = /*#__PURE__*/function () {
461
471
  }
462
472
  }, _callee7, this);
463
473
  }));
464
- function showCheckoutDialog(_x2) {
474
+ function showCheckoutDialog(_x3) {
465
475
  return _showCheckoutDialog.apply(this, arguments);
466
476
  }
467
477
  return showCheckoutDialog;
@@ -492,8 +502,9 @@ export var FronteggApp = /*#__PURE__*/function () {
492
502
  function getFeatureEntitlements(key, customAttributes) {
493
503
  var _this$getEntitlements = this.getEntitlementsQueryData(customAttributes),
494
504
  entitlements = _this$getEntitlements.entitlements,
495
- attributes = _this$getEntitlements.attributes;
496
- return _getFeatureEntitlements(entitlements, key, attributes);
505
+ attributes = _this$getEntitlements.attributes,
506
+ isV2 = _this$getEntitlements.isV2;
507
+ return _getFeatureEntitlements(entitlements, key, attributes, isV2);
497
508
  }
498
509
 
499
510
  /**
@@ -507,8 +518,9 @@ export var FronteggApp = /*#__PURE__*/function () {
507
518
  value: function getPermissionEntitlements(key, customAttributes) {
508
519
  var _this$getEntitlements2 = this.getEntitlementsQueryData(customAttributes),
509
520
  entitlements = _this$getEntitlements2.entitlements,
510
- attributes = _this$getEntitlements2.attributes;
511
- return _getPermissionEntitlements(entitlements, key, attributes);
521
+ attributes = _this$getEntitlements2.attributes,
522
+ isV2 = _this$getEntitlements2.isV2;
523
+ return _getPermissionEntitlements(entitlements, key, attributes, isV2);
512
524
  }
513
525
 
514
526
  /**
@@ -550,9 +562,9 @@ export var FronteggApp = /*#__PURE__*/function () {
550
562
  key: "stepUp",
551
563
  value: function stepUp(options) {
552
564
  var state = this.store.getState();
553
- var _ref4 = (state == null ? void 0 : state.auth) || {},
554
- hostedLoginBox = _ref4.hostedLoginBox,
555
- stepUpUrl = _ref4.routes.stepUpUrl;
565
+ var _ref5 = (state == null ? void 0 : state.auth) || {},
566
+ hostedLoginBox = _ref5.hostedLoginBox,
567
+ stepUpUrl = _ref5.routes.stepUpUrl;
556
568
  if (hostedLoginBox) {
557
569
  this.store.dispatch({
558
570
  type: 'auth/stepUpHostedLogin',
@@ -572,8 +584,8 @@ export var FronteggApp = /*#__PURE__*/function () {
572
584
  value: function isSteppedUp() {
573
585
  var _this$store$getState;
574
586
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
575
- var _ref5 = ((_this$store$getState = this.store.getState()) == null ? void 0 : _this$store$getState.auth) || {},
576
- user = _ref5.user;
587
+ var _ref6 = ((_this$store$getState = this.store.getState()) == null ? void 0 : _this$store$getState.auth) || {},
588
+ user = _ref6.user;
577
589
  return _isSteppedUp(user, options);
578
590
  }
579
591
  }, {
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.185.0-alpha.0
1
+ /** @license Frontegg v6.185.0-alpha.2
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.
@@ -18,6 +18,14 @@ var AdminPortal = /*#__PURE__*/function () {
18
18
  var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
19
19
  _AppHolder.AppHolder.getInstance(name).showAdminPortal();
20
20
  }
21
+ }, {
22
+ key: "showMultiApp",
23
+ value: function showMultiApp() {
24
+ var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
25
+ _AppHolder.AppHolder.getInstance(name).showAdminPortal({
26
+ isMultiApp: true
27
+ });
28
+ }
21
29
  }, {
22
30
  key: "hide",
23
31
  value: function hide() {
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.FronteggApp = void 0;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -166,9 +167,13 @@ var FronteggApp = /*#__PURE__*/function () {
166
167
  custom: customAttributes,
167
168
  jwt: user
168
169
  };
170
+ var _this$queryFeatureFla = _this.queryFeatureFlags([FronteggRestApi.USE_ENTITLEMENTS_V2_ENDPOINT_FF]),
171
+ _this$queryFeatureFla2 = (0, _slicedToArray2["default"])(_this$queryFeatureFla, 1),
172
+ useEntitlementsV2 = _this$queryFeatureFla2[0];
169
173
  return {
170
174
  entitlements: entitlements,
171
- attributes: attributes
175
+ attributes: attributes,
176
+ isV2: useEntitlementsV2
172
177
  };
173
178
  };
174
179
  var appName = (0, _utils.formatName)(name);
@@ -406,27 +411,32 @@ var FronteggApp = /*#__PURE__*/function () {
406
411
  }, {
407
412
  key: "showAdminPortal",
408
413
  value: function () {
409
- var _showAdminPortal = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
410
- var FronteggAdminPortal;
414
+ var _showAdminPortal = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(options) {
415
+ var _ref4, isMultiApp, FronteggAdminPortal;
411
416
  return _regenerator["default"].wrap(function _callee6$(_context6) {
412
417
  while (1) switch (_context6.prev = _context6.next) {
413
418
  case 0:
419
+ _ref4 = options != null ? options : {
420
+ isMultiApp: false
421
+ }, isMultiApp = _ref4.isMultiApp;
414
422
  FronteggRestApi.ContextHolder.setRequestSource(FronteggRestApi.RequestSource.AdminPortal);
415
- _context6.next = 3;
423
+ _context6.next = 4;
416
424
  return this.loadScript('FronteggAdminPortal');
417
- case 3:
425
+ case 4:
418
426
  FronteggAdminPortal = _context6.sent;
419
427
  this.adminPortalRenderer = FronteggAdminPortal.render(this.adminPortalEl, {
420
428
  injector: this,
421
- options: this.options
429
+ options: Object.assign({
430
+ isMultiApp: isMultiApp
431
+ }, this.options)
422
432
  });
423
- case 5:
433
+ case 6:
424
434
  case "end":
425
435
  return _context6.stop();
426
436
  }
427
437
  }, _callee6, this);
428
438
  }));
429
- function showAdminPortal() {
439
+ function showAdminPortal(_x2) {
430
440
  return _showAdminPortal.apply(this, arguments);
431
441
  }
432
442
  return showAdminPortal;
@@ -468,7 +478,7 @@ var FronteggApp = /*#__PURE__*/function () {
468
478
  }
469
479
  }, _callee7, this);
470
480
  }));
471
- function showCheckoutDialog(_x2) {
481
+ function showCheckoutDialog(_x3) {
472
482
  return _showCheckoutDialog.apply(this, arguments);
473
483
  }
474
484
  return showCheckoutDialog;
@@ -499,8 +509,9 @@ var FronteggApp = /*#__PURE__*/function () {
499
509
  function getFeatureEntitlements(key, customAttributes) {
500
510
  var _this$getEntitlements = this.getEntitlementsQueryData(customAttributes),
501
511
  entitlements = _this$getEntitlements.entitlements,
502
- attributes = _this$getEntitlements.attributes;
503
- return (0, _reduxStore.getFeatureEntitlements)(entitlements, key, attributes);
512
+ attributes = _this$getEntitlements.attributes,
513
+ isV2 = _this$getEntitlements.isV2;
514
+ return (0, _reduxStore.getFeatureEntitlements)(entitlements, key, attributes, isV2);
504
515
  }
505
516
 
506
517
  /**
@@ -514,8 +525,9 @@ var FronteggApp = /*#__PURE__*/function () {
514
525
  value: function getPermissionEntitlements(key, customAttributes) {
515
526
  var _this$getEntitlements2 = this.getEntitlementsQueryData(customAttributes),
516
527
  entitlements = _this$getEntitlements2.entitlements,
517
- attributes = _this$getEntitlements2.attributes;
518
- return (0, _reduxStore.getPermissionEntitlements)(entitlements, key, attributes);
528
+ attributes = _this$getEntitlements2.attributes,
529
+ isV2 = _this$getEntitlements2.isV2;
530
+ return (0, _reduxStore.getPermissionEntitlements)(entitlements, key, attributes, isV2);
519
531
  }
520
532
 
521
533
  /**
@@ -557,9 +569,9 @@ var FronteggApp = /*#__PURE__*/function () {
557
569
  key: "stepUp",
558
570
  value: function stepUp(options) {
559
571
  var state = this.store.getState();
560
- var _ref4 = (state == null ? void 0 : state.auth) || {},
561
- hostedLoginBox = _ref4.hostedLoginBox,
562
- stepUpUrl = _ref4.routes.stepUpUrl;
572
+ var _ref5 = (state == null ? void 0 : state.auth) || {},
573
+ hostedLoginBox = _ref5.hostedLoginBox,
574
+ stepUpUrl = _ref5.routes.stepUpUrl;
563
575
  if (hostedLoginBox) {
564
576
  this.store.dispatch({
565
577
  type: 'auth/stepUpHostedLogin',
@@ -579,8 +591,8 @@ var FronteggApp = /*#__PURE__*/function () {
579
591
  value: function isSteppedUp() {
580
592
  var _this$store$getState;
581
593
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
582
- var _ref5 = ((_this$store$getState = this.store.getState()) == null ? void 0 : _this$store$getState.auth) || {},
583
- user = _ref5.user;
594
+ var _ref6 = ((_this$store$getState = this.store.getState()) == null ? void 0 : _this$store$getState.auth) || {},
595
+ user = _ref6.user;
584
596
  return (0, _reduxStore.isSteppedUp)(user, options);
585
597
  }
586
598
  }, {
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.185.0-alpha.0
1
+ /** @license Frontegg v6.185.0-alpha.2
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.185.0-alpha.0'
8
+ cdnVersion: '6.185.0-alpha.2'
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.185.0-alpha.0",
3
+ "version": "6.185.0-alpha.2",
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.185.0-alpha.0"
9
+ "@frontegg/types": "6.185.0-alpha.2"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [