@frontegg/js 6.4.0 → 6.6.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,6 @@
1
1
  import { EnhancedStore } from '@frontegg/redux-store';
2
2
  import { FronteggAppOptions, FronteggCheckoutDialogOptions, LocalizationsOverrides } from '@frontegg/types';
3
+ import * as FronteggRestApi from '@frontegg/rest-api';
3
4
  declare type FronteggAppContainers = {
4
5
  adminPortalEl: HTMLElement;
5
6
  loginBoxEl: HTMLElement;
@@ -25,11 +26,13 @@ export declare class FronteggApp {
25
26
  checkoutDialogContainer?: HTMLElement;
26
27
  loginBoxRenderer?: any;
27
28
  store: EnhancedStore;
29
+ flags: FronteggRestApi.IFeatureFlagsAttributes;
28
30
  loadingListeners: (() => void)[];
29
31
  updateLocalizations?: (localizations: LocalizationsOverrides) => void;
30
32
  constructor(_options: FronteggAppOptions, name: string, iframeRendering?: boolean);
31
33
  loadAdminBoxMetadata: () => Promise<void>;
32
34
  requestAuthorize: () => Promise<void>;
35
+ loadFeatureFlags: () => Promise<void>;
33
36
  initContainers(elements: FronteggAppContainers): Promise<void>;
34
37
  updateLocalizationsSetter: (localizationUpdateFn: (localizations: LocalizationsOverrides) => void) => void;
35
38
  updateMetadata(metadata: FronteggAppOptions['metadata']): void;
@@ -27,6 +27,7 @@ export class FronteggApp {
27
27
  this.checkoutDialogContainer = void 0;
28
28
  this.loginBoxRenderer = void 0;
29
29
  this.store = void 0;
30
+ this.flags = {};
30
31
  this.loadingListeners = [];
31
32
  this.updateLocalizations = void 0;
32
33
 
@@ -60,6 +61,14 @@ export class FronteggApp {
60
61
  }
61
62
  };
62
63
 
64
+ this.loadFeatureFlags = async () => {
65
+ try {
66
+ this.flags = await FronteggRestApi.loadFeatureFlags();
67
+ } catch (e) {
68
+ console.error('failed to get admin portal feature flags', e);
69
+ }
70
+ };
71
+
63
72
  this.updateLocalizationsSetter = localizationUpdateFn => {
64
73
  this.updateLocalizations = localizationUpdateFn;
65
74
  };
@@ -89,7 +98,7 @@ export class FronteggApp {
89
98
  }, this, this.options.previewMode, authOptions, {
90
99
  auth: (_this$options$authOpt = this.options.authOptions) != null ? _this$options$authOpt : {},
91
100
  audits: (_this$options$auditsO = this.options.auditsOptions) != null ? _this$options$auditsO : {}
92
- });
101
+ }, false, this.options.urlStrategy);
93
102
  AppHolder.setInstance(appName, this);
94
103
  }
95
104
 
@@ -105,7 +114,7 @@ export class FronteggApp {
105
114
  document.body.classList.add('frontegg-loading');
106
115
  } catch (e) {}
107
116
 
108
- await Promise.all([this.loadAdminBoxMetadata(), this.requestAuthorize()]);
117
+ await Promise.all([this.loadAdminBoxMetadata(), this.requestAuthorize(), this.loadFeatureFlags()]);
109
118
 
110
119
  if (!this.options.previewMode && !this.options.customLoginBox) {
111
120
  this.loadLoginBox();
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.4.0
1
+ /** @license Frontegg v6.6.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.
@@ -45,6 +45,7 @@ class FronteggApp {
45
45
  this.checkoutDialogContainer = void 0;
46
46
  this.loginBoxRenderer = void 0;
47
47
  this.store = void 0;
48
+ this.flags = {};
48
49
  this.loadingListeners = [];
49
50
  this.updateLocalizations = void 0;
50
51
 
@@ -78,6 +79,14 @@ class FronteggApp {
78
79
  }
79
80
  };
80
81
 
82
+ this.loadFeatureFlags = async () => {
83
+ try {
84
+ this.flags = await FronteggRestApi.loadFeatureFlags();
85
+ } catch (e) {
86
+ console.error('failed to get admin portal feature flags', e);
87
+ }
88
+ };
89
+
81
90
  this.updateLocalizationsSetter = localizationUpdateFn => {
82
91
  this.updateLocalizations = localizationUpdateFn;
83
92
  };
@@ -107,7 +116,7 @@ class FronteggApp {
107
116
  }, this, this.options.previewMode, authOptions, {
108
117
  auth: (_this$options$authOpt = this.options.authOptions) != null ? _this$options$authOpt : {},
109
118
  audits: (_this$options$auditsO = this.options.auditsOptions) != null ? _this$options$auditsO : {}
110
- });
119
+ }, false, this.options.urlStrategy);
111
120
 
112
121
  _AppHolder.AppHolder.setInstance(appName, this);
113
122
  }
@@ -124,7 +133,7 @@ class FronteggApp {
124
133
  document.body.classList.add('frontegg-loading');
125
134
  } catch (e) {}
126
135
 
127
- await Promise.all([this.loadAdminBoxMetadata(), this.requestAuthorize()]);
136
+ await Promise.all([this.loadAdminBoxMetadata(), this.requestAuthorize(), this.loadFeatureFlags()]);
128
137
 
129
138
  if (!this.options.previewMode && !this.options.customLoginBox) {
130
139
  this.loadLoginBox();
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.4.0
1
+ /** @license Frontegg v6.6.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.4.0"
8
+ "cdnVersion": "6.6.0"
9
9
  };
10
10
  exports.default = _default;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@frontegg/js",
3
- "version": "6.4.0",
3
+ "version": "6.6.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
7
7
  "@babel/runtime": "^7.18.6",
8
- "@frontegg/types": "6.4.0"
8
+ "@frontegg/types": "6.6.0"
9
9
  },
10
10
  "sideEffects": false,
11
11
  "private": false,
package/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export default {
2
- "cdnVersion": "6.4.0"
2
+ "cdnVersion": "6.6.0"
3
3
  };