@frontegg/js 7.69.0 → 7.70.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,5 +1,5 @@
1
1
  import { EntitledToOptions, Entitlement, FronteggStore, IsSteppedUpOptions, StepUpOptions } from '@frontegg/redux-store';
2
- import { FronteggAppOptions, FronteggCheckoutDialogOptions, LoadEntitlementsCallback, LocalizationsOverrides, ShowAdminPortalOptions, SwitchTenantOptions } from '@frontegg/types';
2
+ import { FronteggAppOptions, FronteggCheckoutDialogOptions, LoadEntitlementsCallback, LocalizationsOverrides, ShowAdminPortalOptions, SwitchTenantOptions, UseInviteUserDialogStoreOptions, UseTableStoreOptions } from '@frontegg/types';
3
3
  import { FetchClient, FronteggApiClient, IFeatureFlagsAttributes } from '@frontegg/rest-api';
4
4
  import { CustomAttributes } from '@frontegg/entitlements-javascript-commons';
5
5
  type FronteggAppContainers = {
@@ -97,25 +97,25 @@ export declare class FronteggApp {
97
97
  */
98
98
  private getEntitlementsQueryData;
99
99
  /**
100
- @param key feature key
101
- @param customAttributes user attributes
102
- @returns if the user is entitled to the given feature. Attaching the justification if not
103
- @throws when entitlement is not enabled via frontegg options
104
- */
100
+ @param key feature key
101
+ @param customAttributes user attributes
102
+ @returns if the user is entitled to the given feature. Attaching the justification if not
103
+ @throws when entitlement is not enabled via frontegg options
104
+ */
105
105
  getFeatureEntitlements(key: string, customAttributes?: CustomAttributes): Entitlement;
106
106
  /**
107
- @param key permission key
108
- @param customAttributes user attributes
109
- @returns if the user is entitled to the given permission. Attaching the justification if not
110
- @throws when entitlement is not enabled via frontegg options
111
- */
107
+ @param key permission key
108
+ @param customAttributes user attributes
109
+ @returns if the user is entitled to the given permission. Attaching the justification if not
110
+ @throws when entitlement is not enabled via frontegg options
111
+ */
112
112
  getPermissionEntitlements(key: string, customAttributes?: CustomAttributes): Entitlement;
113
113
  /**
114
- @param options - including permission or feature key
115
- @param customAttributes user attributes
116
- @returns if the user is entitled to the given permission or feature. Attaching the justification if not
117
- @throws when entitlement is not enabled via frontegg options
118
- */
114
+ @param options - including permission or feature key
115
+ @param customAttributes user attributes
116
+ @returns if the user is entitled to the given permission or feature. Attaching the justification if not
117
+ @throws when entitlement is not enabled via frontegg options
118
+ */
119
119
  getEntitlements(options: EntitledToOptions, customAttributes?: CustomAttributes): Entitlement;
120
120
  /**
121
121
  * Load entitlements
@@ -139,5 +139,11 @@ export declare class FronteggApp {
139
139
  */
140
140
  switchTenant(payload: SwitchTenantOptions): void;
141
141
  close(): void;
142
+ renderUsersTable: (container: HTMLElement, props: any, options: any) => Promise<any>;
143
+ renderInviteUserDialog: (container: HTMLElement, props: any, options: any) => Promise<any>;
144
+ renderChangePasswordForm: (container: HTMLElement, props: any, options: any) => Promise<any>;
145
+ renderProfilePage: (container: HTMLElement, props: any, options: any) => Promise<any>;
146
+ getUsersTableStore: (options: UseTableStoreOptions) => Promise<any>;
147
+ getInviteUserDialogStore: (options: UseInviteUserDialogStoreOptions) => Promise<any>;
142
148
  }
143
149
  export {};
@@ -186,6 +186,155 @@ export var FronteggApp = /*#__PURE__*/function () {
186
186
  attributes: attributes
187
187
  };
188
188
  };
189
+ this.renderUsersTable = /*#__PURE__*/function () {
190
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(container, props, options) {
191
+ var FronteggAdminPortal;
192
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
193
+ while (1) switch (_context4.prev = _context4.next) {
194
+ case 0:
195
+ _context4.next = 2;
196
+ return _this.loadScript('FronteggAdminPortal');
197
+ case 2:
198
+ FronteggAdminPortal = _context4.sent;
199
+ return _context4.abrupt("return", FronteggAdminPortal.renderUsersTable(container, {
200
+ injector: _this,
201
+ options: _this.options,
202
+ container: container,
203
+ props: props,
204
+ themeOptions: options.themeOptions
205
+ }));
206
+ case 4:
207
+ case "end":
208
+ return _context4.stop();
209
+ }
210
+ }, _callee4);
211
+ }));
212
+ return function (_x, _x2, _x3) {
213
+ return _ref4.apply(this, arguments);
214
+ };
215
+ }();
216
+ this.renderInviteUserDialog = /*#__PURE__*/function () {
217
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(container, props, options) {
218
+ var FronteggAdminPortal;
219
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
220
+ while (1) switch (_context5.prev = _context5.next) {
221
+ case 0:
222
+ _context5.next = 2;
223
+ return _this.loadScript('FronteggAdminPortal');
224
+ case 2:
225
+ FronteggAdminPortal = _context5.sent;
226
+ return _context5.abrupt("return", FronteggAdminPortal.renderInviteUserDialog(container, {
227
+ injector: _this,
228
+ options: _this.options,
229
+ container: container,
230
+ props: props,
231
+ themeOptions: options.themeOptions
232
+ }));
233
+ case 4:
234
+ case "end":
235
+ return _context5.stop();
236
+ }
237
+ }, _callee5);
238
+ }));
239
+ return function (_x4, _x5, _x6) {
240
+ return _ref5.apply(this, arguments);
241
+ };
242
+ }();
243
+ this.renderChangePasswordForm = /*#__PURE__*/function () {
244
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(container, props, options) {
245
+ var FronteggAdminPortal;
246
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
247
+ while (1) switch (_context6.prev = _context6.next) {
248
+ case 0:
249
+ _context6.next = 2;
250
+ return _this.loadScript('FronteggAdminPortal');
251
+ case 2:
252
+ FronteggAdminPortal = _context6.sent;
253
+ return _context6.abrupt("return", FronteggAdminPortal.renderChangePasswordForm(container, {
254
+ injector: _this,
255
+ options: _this.options,
256
+ props: props,
257
+ themeOptions: options.themeOptions
258
+ }));
259
+ case 4:
260
+ case "end":
261
+ return _context6.stop();
262
+ }
263
+ }, _callee6);
264
+ }));
265
+ return function (_x7, _x8, _x9) {
266
+ return _ref6.apply(this, arguments);
267
+ };
268
+ }();
269
+ this.renderProfilePage = /*#__PURE__*/function () {
270
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(container, props, options) {
271
+ var FronteggAdminPortal;
272
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
273
+ while (1) switch (_context7.prev = _context7.next) {
274
+ case 0:
275
+ _context7.next = 2;
276
+ return _this.loadScript('FronteggAdminPortal');
277
+ case 2:
278
+ FronteggAdminPortal = _context7.sent;
279
+ return _context7.abrupt("return", FronteggAdminPortal.renderProfilePage(container, {
280
+ injector: _this,
281
+ options: _this.options,
282
+ props: props,
283
+ themeOptions: options.themeOptions,
284
+ localizations: options.localizations
285
+ }));
286
+ case 4:
287
+ case "end":
288
+ return _context7.stop();
289
+ }
290
+ }, _callee7);
291
+ }));
292
+ return function (_x10, _x11, _x12) {
293
+ return _ref7.apply(this, arguments);
294
+ };
295
+ }();
296
+ this.getUsersTableStore = /*#__PURE__*/function () {
297
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(options) {
298
+ var FronteggAdminPortal;
299
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
300
+ while (1) switch (_context8.prev = _context8.next) {
301
+ case 0:
302
+ _context8.next = 2;
303
+ return _this.loadScript('FronteggAdminPortal');
304
+ case 2:
305
+ FronteggAdminPortal = _context8.sent;
306
+ return _context8.abrupt("return", FronteggAdminPortal.useUsersTableStore(options));
307
+ case 4:
308
+ case "end":
309
+ return _context8.stop();
310
+ }
311
+ }, _callee8);
312
+ }));
313
+ return function (_x13) {
314
+ return _ref8.apply(this, arguments);
315
+ };
316
+ }();
317
+ this.getInviteUserDialogStore = /*#__PURE__*/function () {
318
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(options) {
319
+ var FronteggAdminPortal;
320
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
321
+ while (1) switch (_context9.prev = _context9.next) {
322
+ case 0:
323
+ _context9.next = 2;
324
+ return _this.loadScript('FronteggAdminPortal');
325
+ case 2:
326
+ FronteggAdminPortal = _context9.sent;
327
+ return _context9.abrupt("return", FronteggAdminPortal.useInviteUserDialogStore(options));
328
+ case 4:
329
+ case "end":
330
+ return _context9.stop();
331
+ }
332
+ }, _callee9);
333
+ }));
334
+ return function (_x14) {
335
+ return _ref9.apply(this, arguments);
336
+ };
337
+ }();
189
338
  var appName = formatName(name);
190
339
  var customElementName = "frontegg-app-".concat(appName);
191
340
  this.iframeRendering = iframeRendering;
@@ -278,9 +427,9 @@ export var FronteggApp = /*#__PURE__*/function () {
278
427
  }, {
279
428
  key: "initContainers",
280
429
  value: function () {
281
- var _initContainers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(elements) {
282
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
283
- while (1) switch (_context4.prev = _context4.next) {
430
+ var _initContainers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(elements) {
431
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
432
+ while (1) switch (_context10.prev = _context10.next) {
284
433
  case 0:
285
434
  this.adminPortalEl = elements.adminPortalEl;
286
435
  this.loginBoxEl = elements.loginBoxEl;
@@ -295,7 +444,7 @@ export var FronteggApp = /*#__PURE__*/function () {
295
444
  } catch (e) {
296
445
  console.error('Failed to add frontegg-loading to body classList');
297
446
  }
298
- _context4.next = 9;
447
+ _context10.next = 9;
299
448
  return Promise.all([this.loadFeatureFlags(), this.loadAdminBoxMetadata(), this.requestAuthorize()]);
300
449
  case 9:
301
450
  if (!this.options.previewMode && !this.options.customLoginBox) {
@@ -307,11 +456,11 @@ export var FronteggApp = /*#__PURE__*/function () {
307
456
  }
308
457
  case 11:
309
458
  case "end":
310
- return _context4.stop();
459
+ return _context10.stop();
311
460
  }
312
- }, _callee4, this);
461
+ }, _callee10, this);
313
462
  }));
314
- function initContainers(_x) {
463
+ function initContainers(_x15) {
315
464
  return _initContainers.apply(this, arguments);
316
465
  }
317
466
  return initContainers;
@@ -424,15 +573,15 @@ export var FronteggApp = /*#__PURE__*/function () {
424
573
  }, {
425
574
  key: "loadLoginBox",
426
575
  value: function () {
427
- var _loadLoginBox = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
576
+ var _loadLoginBox = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
428
577
  var FronteggLoginBox;
429
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
430
- while (1) switch (_context5.prev = _context5.next) {
578
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
579
+ while (1) switch (_context11.prev = _context11.next) {
431
580
  case 0:
432
- _context5.next = 2;
581
+ _context11.next = 2;
433
582
  return this.loadScript('FronteggLoginBox');
434
583
  case 2:
435
- FronteggLoginBox = _context5.sent;
584
+ FronteggLoginBox = _context11.sent;
436
585
  FronteggLoginBox.render(this.loginBoxEl, {
437
586
  injector: this,
438
587
  options: this.options
@@ -448,9 +597,9 @@ export var FronteggApp = /*#__PURE__*/function () {
448
597
  this.loadingListeners = [];
449
598
  case 7:
450
599
  case "end":
451
- return _context5.stop();
600
+ return _context11.stop();
452
601
  }
453
- }, _callee5, this);
602
+ }, _callee11, this);
454
603
  }));
455
604
  function loadLoginBox() {
456
605
  return _loadLoginBox.apply(this, arguments);
@@ -460,20 +609,20 @@ export var FronteggApp = /*#__PURE__*/function () {
460
609
  }, {
461
610
  key: "showAdminPortal",
462
611
  value: function () {
463
- var _showAdminPortal = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(options) {
464
- var _ref4, isMultiApp, _this$queryFeatureFla, _this$queryFeatureFla2, multiAppsFlag, FronteggAdminPortal;
465
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
466
- while (1) switch (_context6.prev = _context6.next) {
612
+ var _showAdminPortal = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(options) {
613
+ var _ref10, isMultiApp, _this$queryFeatureFla, _this$queryFeatureFla2, multiAppsFlag, FronteggAdminPortal;
614
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
615
+ while (1) switch (_context12.prev = _context12.next) {
467
616
  case 0:
468
- _ref4 = options != null ? options : {
617
+ _ref10 = options != null ? options : {
469
618
  isMultiApp: false
470
- }, isMultiApp = _ref4.isMultiApp;
619
+ }, isMultiApp = _ref10.isMultiApp;
471
620
  _this$queryFeatureFla = this.queryFeatureFlags(['multi-apps-admin-portal']), _this$queryFeatureFla2 = _slicedToArray(_this$queryFeatureFla, 1), multiAppsFlag = _this$queryFeatureFla2[0];
472
621
  ContextHolder["for"](this.name).setRequestSource(RequestSource.AdminPortal);
473
- _context6.next = 5;
622
+ _context12.next = 5;
474
623
  return this.loadScript('FronteggAdminPortal');
475
624
  case 5:
476
- FronteggAdminPortal = _context6.sent;
625
+ FronteggAdminPortal = _context12.sent;
477
626
  this.adminPortalRenderer = FronteggAdminPortal.render(this.adminPortalEl, {
478
627
  injector: this,
479
628
  options: Object.assign({
@@ -482,11 +631,11 @@ export var FronteggApp = /*#__PURE__*/function () {
482
631
  });
483
632
  case 7:
484
633
  case "end":
485
- return _context6.stop();
634
+ return _context12.stop();
486
635
  }
487
- }, _callee6, this);
636
+ }, _callee12, this);
488
637
  }));
489
- function showAdminPortal(_x2) {
638
+ function showAdminPortal(_x16) {
490
639
  return _showAdminPortal.apply(this, arguments);
491
640
  }
492
641
  return showAdminPortal;
@@ -525,15 +674,15 @@ export var FronteggApp = /*#__PURE__*/function () {
525
674
  }, {
526
675
  key: "showCheckoutDialog",
527
676
  value: function () {
528
- var _showCheckoutDialog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(opts) {
677
+ var _showCheckoutDialog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(opts) {
529
678
  var FronteggAdminPortal;
530
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
531
- while (1) switch (_context7.prev = _context7.next) {
679
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
680
+ while (1) switch (_context13.prev = _context13.next) {
532
681
  case 0:
533
- _context7.next = 2;
682
+ _context13.next = 2;
534
683
  return this.loadScript('FronteggAdminPortal');
535
684
  case 2:
536
- FronteggAdminPortal = _context7.sent;
685
+ FronteggAdminPortal = _context13.sent;
537
686
  this.checkoutDialogRenderer = FronteggAdminPortal.renderCheckoutDialog(this.checkoutDialogEl, Object.assign({
538
687
  injector: this
539
688
  }, opts, {
@@ -541,11 +690,11 @@ export var FronteggApp = /*#__PURE__*/function () {
541
690
  }));
542
691
  case 4:
543
692
  case "end":
544
- return _context7.stop();
693
+ return _context13.stop();
545
694
  }
546
- }, _callee7, this);
695
+ }, _callee13, this);
547
696
  }));
548
- function showCheckoutDialog(_x3) {
697
+ function showCheckoutDialog(_x17) {
549
698
  return _showCheckoutDialog.apply(this, arguments);
550
699
  }
551
700
  return showCheckoutDialog;
@@ -568,11 +717,11 @@ export var FronteggApp = /*#__PURE__*/function () {
568
717
  key: "getFeatureEntitlements",
569
718
  value:
570
719
  /**
571
- @param key feature key
572
- @param customAttributes user attributes
573
- @returns if the user is entitled to the given feature. Attaching the justification if not
574
- @throws when entitlement is not enabled via frontegg options
575
- */
720
+ @param key feature key
721
+ @param customAttributes user attributes
722
+ @returns if the user is entitled to the given feature. Attaching the justification if not
723
+ @throws when entitlement is not enabled via frontegg options
724
+ */
576
725
  function getFeatureEntitlements(key, customAttributes) {
577
726
  var _this$getEntitlements = this.getEntitlementsQueryData(customAttributes),
578
727
  entitlements = _this$getEntitlements.entitlements,
@@ -581,11 +730,11 @@ export var FronteggApp = /*#__PURE__*/function () {
581
730
  }
582
731
 
583
732
  /**
584
- @param key permission key
585
- @param customAttributes user attributes
586
- @returns if the user is entitled to the given permission. Attaching the justification if not
587
- @throws when entitlement is not enabled via frontegg options
588
- */
733
+ @param key permission key
734
+ @param customAttributes user attributes
735
+ @returns if the user is entitled to the given permission. Attaching the justification if not
736
+ @throws when entitlement is not enabled via frontegg options
737
+ */
589
738
  }, {
590
739
  key: "getPermissionEntitlements",
591
740
  value: function getPermissionEntitlements(key, customAttributes) {
@@ -596,11 +745,11 @@ export var FronteggApp = /*#__PURE__*/function () {
596
745
  }
597
746
 
598
747
  /**
599
- @param options - including permission or feature key
600
- @param customAttributes user attributes
601
- @returns if the user is entitled to the given permission or feature. Attaching the justification if not
602
- @throws when entitlement is not enabled via frontegg options
603
- */
748
+ @param options - including permission or feature key
749
+ @param customAttributes user attributes
750
+ @returns if the user is entitled to the given permission or feature. Attaching the justification if not
751
+ @throws when entitlement is not enabled via frontegg options
752
+ */
604
753
  }, {
605
754
  key: "getEntitlements",
606
755
  value: function getEntitlements(options, customAttributes) {
@@ -634,9 +783,9 @@ export var FronteggApp = /*#__PURE__*/function () {
634
783
  key: "stepUp",
635
784
  value: function stepUp(options) {
636
785
  var state = this.store.getState();
637
- var _ref5 = (state == null ? void 0 : state.auth) || {},
638
- hostedLoginBox = _ref5.hostedLoginBox,
639
- stepUpUrl = _ref5.routes.stepUpUrl;
786
+ var _ref11 = (state == null ? void 0 : state.auth) || {},
787
+ hostedLoginBox = _ref11.hostedLoginBox,
788
+ stepUpUrl = _ref11.routes.stepUpUrl;
640
789
  if (hostedLoginBox) {
641
790
  this.store.dispatch({
642
791
  type: 'auth/stepUpHostedLogin',
@@ -656,8 +805,8 @@ export var FronteggApp = /*#__PURE__*/function () {
656
805
  value: function isSteppedUp() {
657
806
  var _this$store$getState;
658
807
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
659
- var _ref6 = ((_this$store$getState = this.store.getState()) == null ? void 0 : _this$store$getState.auth) || {},
660
- user = _ref6.user;
808
+ var _ref12 = ((_this$store$getState = this.store.getState()) == null ? void 0 : _this$store$getState.auth) || {},
809
+ user = _ref12.user;
661
810
  return _isSteppedUp(user, options);
662
811
  }
663
812
 
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.69.0
1
+ /** @license Frontegg v7.70.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/initialize.js CHANGED
@@ -80,7 +80,7 @@ export var initialize = function initialize(options) {
80
80
  var adminBoxShadowEl = adminPortalContainer.attachShadow({
81
81
  mode: 'open'
82
82
  });
83
- var loginBoxShadowEl = loginBoxContainer.attachShadow({
83
+ var loginBoxShadowEl = options.iframeRendering ? loginBoxContainer : loginBoxContainer.attachShadow({
84
84
  mode: 'open'
85
85
  });
86
86
  var checkoutDialogShadowEl = checkoutDialogContainer.attachShadow({