@frontegg/js 6.147.0-alpha.6 → 6.147.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.
- package/FronteggApp/FronteggApp.d.ts +5 -23
- package/FronteggApp/FronteggApp.js +12 -44
- package/index.js +1 -1
- package/node/FronteggApp/FronteggApp.js +11 -43
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +93 -1369
- package/umd/frontegg.production.min.js +1 -1
- package/umd/frontegg.production.min.js.LICENSE.txt +1 -1
- package/version.js +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { EnhancedStore, EntitledToOptions, Entitlement } 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';
|
|
5
4
|
declare type FronteggAppContainers = {
|
|
6
5
|
adminPortalEl: HTMLElement;
|
|
7
6
|
loginBoxEl: HTMLElement;
|
|
@@ -50,11 +49,6 @@ export declare class FronteggApp {
|
|
|
50
49
|
* @param previewFeatureFlags
|
|
51
50
|
*/
|
|
52
51
|
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;
|
|
58
52
|
initContainers(elements: FronteggAppContainers): Promise<void>;
|
|
59
53
|
updateLocalizationsSetter: (localizationUpdateFn: (localizations: LocalizationsOverrides) => void) => void;
|
|
60
54
|
updateMetadata(metadata: FronteggAppOptions['metadata']): void;
|
|
@@ -73,35 +67,23 @@ export declare class FronteggApp {
|
|
|
73
67
|
*/
|
|
74
68
|
private getEntitlementsFromStore;
|
|
75
69
|
/**
|
|
76
|
-
|
|
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
|
+
@param key
|
|
87
71
|
@returns if the user is entitled to the given feature. Attaching the justification if not
|
|
88
72
|
@throws when entitlement is not enabled via frontegg options
|
|
89
73
|
*/
|
|
90
|
-
getFeatureEntitlements(key: string
|
|
74
|
+
getFeatureEntitlements(key: string): Entitlement;
|
|
91
75
|
/**
|
|
92
|
-
@param key
|
|
93
|
-
@param customAttributes user attributes
|
|
76
|
+
@param key
|
|
94
77
|
@returns if the user is entitled to the given permission. Attaching the justification if not
|
|
95
78
|
@throws when entitlement is not enabled via frontegg options
|
|
96
79
|
*/
|
|
97
|
-
getPermissionEntitlements(key: string
|
|
80
|
+
getPermissionEntitlements(key: string): Entitlement;
|
|
98
81
|
/**
|
|
99
82
|
@param options - including permission or feature key
|
|
100
|
-
@param customAttributes user attributes
|
|
101
83
|
@returns if the user is entitled to the given permission or feature. Attaching the justification if not
|
|
102
84
|
@throws when entitlement is not enabled via frontegg options
|
|
103
85
|
*/
|
|
104
|
-
getEntitlements(options: EntitledToOptions
|
|
86
|
+
getEntitlements(options: EntitledToOptions): Entitlement;
|
|
105
87
|
/**
|
|
106
88
|
* Load entitlements
|
|
107
89
|
* @param callback called on request completed with true if succeeded, false if failed
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
3
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
@@ -8,7 +7,7 @@ import { createFronteggStore, getPermissionEntitlements as _getPermissionEntitle
|
|
|
8
7
|
import { Metadata } from '@frontegg/types';
|
|
9
8
|
import { formatName, restoreSearchParams } from '../utils';
|
|
10
9
|
import { AppHolder } from '../AppHolder';
|
|
11
|
-
import { fetch as FronteggFetch, ContextHolder
|
|
10
|
+
import { fetch as FronteggFetch, ContextHolder } from '@frontegg/rest-api';
|
|
12
11
|
import { RequestSource } from '@frontegg/rest-api';
|
|
13
12
|
import * as FronteggRestApi from '@frontegg/rest-api';
|
|
14
13
|
import * as FronteggTypes from '@frontegg/types';
|
|
@@ -139,9 +138,6 @@ export var FronteggApp = /*#__PURE__*/function () {
|
|
|
139
138
|
this.setFeatureFlagsForPreview = function (previewFeatureFlags) {
|
|
140
139
|
FronteggRestApi.FeatureFlags.set(_extends({}, mockFlagsList, previewFeatureFlags), _this.name);
|
|
141
140
|
};
|
|
142
|
-
this.queryFeatureFlags = function (flags) {
|
|
143
|
-
return FronteggRestApi.FeatureFlags.getFeatureFlags(flags, _this.name);
|
|
144
|
-
};
|
|
145
141
|
this.updateLocalizationsSetter = function (localizationUpdateFn) {
|
|
146
142
|
_this.updateLocalizations = localizationUpdateFn;
|
|
147
143
|
};
|
|
@@ -149,25 +145,6 @@ export var FronteggApp = /*#__PURE__*/function () {
|
|
|
149
145
|
var _this$store$getState$;
|
|
150
146
|
return (_this$store$getState$ = _this.store.getState().auth.user) == null ? void 0 : _this$store$getState$.entitlements;
|
|
151
147
|
};
|
|
152
|
-
this.getUserFromStore = function () {
|
|
153
|
-
return _this.store.getState().auth.user;
|
|
154
|
-
};
|
|
155
|
-
this.getEntitlementsQueryData = function (customAttributes) {
|
|
156
|
-
var user = _this.getUserFromStore();
|
|
157
|
-
var entitlements = _this.getEntitlementsFromStore();
|
|
158
|
-
var attributes = {
|
|
159
|
-
custom: customAttributes,
|
|
160
|
-
frontegg: user
|
|
161
|
-
};
|
|
162
|
-
var _this$queryFeatureFla = _this.queryFeatureFlags([USE_ENTITLEMENTS_V2_ENDPOINT_FF]),
|
|
163
|
-
_this$queryFeatureFla2 = _slicedToArray(_this$queryFeatureFla, 1),
|
|
164
|
-
useEntitlementsV2 = _this$queryFeatureFla2[0];
|
|
165
|
-
return {
|
|
166
|
-
entitlements: entitlements,
|
|
167
|
-
attributes: attributes,
|
|
168
|
-
isV2: useEntitlementsV2
|
|
169
|
-
};
|
|
170
|
-
};
|
|
171
148
|
var appName = formatName(name);
|
|
172
149
|
var customElementName = "frontegg-app-".concat(appName);
|
|
173
150
|
this.iframeRendering = iframeRendering;
|
|
@@ -488,49 +465,40 @@ export var FronteggApp = /*#__PURE__*/function () {
|
|
|
488
465
|
key: "getFeatureEntitlements",
|
|
489
466
|
value:
|
|
490
467
|
/**
|
|
491
|
-
@param key
|
|
492
|
-
@param customAttributes user attributes
|
|
468
|
+
@param key
|
|
493
469
|
@returns if the user is entitled to the given feature. Attaching the justification if not
|
|
494
470
|
@throws when entitlement is not enabled via frontegg options
|
|
495
471
|
*/
|
|
496
|
-
function getFeatureEntitlements(key
|
|
497
|
-
var
|
|
498
|
-
|
|
499
|
-
attributes = _this$getEntitlements.attributes,
|
|
500
|
-
isV2 = _this$getEntitlements.isV2;
|
|
501
|
-
return _getFeatureEntitlements(entitlements, key, attributes, isV2);
|
|
472
|
+
function getFeatureEntitlements(key) {
|
|
473
|
+
var entitlements = this.getEntitlementsFromStore();
|
|
474
|
+
return _getFeatureEntitlements(entitlements, key);
|
|
502
475
|
}
|
|
503
476
|
|
|
504
477
|
/**
|
|
505
|
-
@param key
|
|
506
|
-
@param customAttributes user attributes
|
|
478
|
+
@param key
|
|
507
479
|
@returns if the user is entitled to the given permission. Attaching the justification if not
|
|
508
480
|
@throws when entitlement is not enabled via frontegg options
|
|
509
481
|
*/
|
|
510
482
|
}, {
|
|
511
483
|
key: "getPermissionEntitlements",
|
|
512
|
-
value: function getPermissionEntitlements(key
|
|
513
|
-
var
|
|
514
|
-
|
|
515
|
-
attributes = _this$getEntitlements2.attributes,
|
|
516
|
-
isV2 = _this$getEntitlements2.isV2;
|
|
517
|
-
return _getPermissionEntitlements(entitlements, key, attributes, isV2);
|
|
484
|
+
value: function getPermissionEntitlements(key) {
|
|
485
|
+
var entitlements = this.getEntitlementsFromStore();
|
|
486
|
+
return _getPermissionEntitlements(entitlements, key);
|
|
518
487
|
}
|
|
519
488
|
|
|
520
489
|
/**
|
|
521
490
|
@param options - including permission or feature key
|
|
522
|
-
@param customAttributes user attributes
|
|
523
491
|
@returns if the user is entitled to the given permission or feature. Attaching the justification if not
|
|
524
492
|
@throws when entitlement is not enabled via frontegg options
|
|
525
493
|
*/
|
|
526
494
|
}, {
|
|
527
495
|
key: "getEntitlements",
|
|
528
|
-
value: function getEntitlements(options
|
|
496
|
+
value: function getEntitlements(options) {
|
|
529
497
|
// we use permissionKey (options key) to decide if the user is using permission key or feature key
|
|
530
498
|
if ('permissionKey' in options) {
|
|
531
|
-
return this.getPermissionEntitlements(options.permissionKey
|
|
499
|
+
return this.getPermissionEntitlements(options.permissionKey);
|
|
532
500
|
}
|
|
533
|
-
return this.getFeatureEntitlements(options.featureKey
|
|
501
|
+
return this.getFeatureEntitlements(options.featureKey);
|
|
534
502
|
}
|
|
535
503
|
|
|
536
504
|
/**
|
package/index.js
CHANGED
|
@@ -7,7 +7,6 @@ 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"));
|
|
11
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -146,9 +145,6 @@ var FronteggApp = /*#__PURE__*/function () {
|
|
|
146
145
|
this.setFeatureFlagsForPreview = function (previewFeatureFlags) {
|
|
147
146
|
FronteggRestApi.FeatureFlags.set((0, _extends2["default"])({}, _mockFlagsList.mockFlagsList, previewFeatureFlags), _this.name);
|
|
148
147
|
};
|
|
149
|
-
this.queryFeatureFlags = function (flags) {
|
|
150
|
-
return FronteggRestApi.FeatureFlags.getFeatureFlags(flags, _this.name);
|
|
151
|
-
};
|
|
152
148
|
this.updateLocalizationsSetter = function (localizationUpdateFn) {
|
|
153
149
|
_this.updateLocalizations = localizationUpdateFn;
|
|
154
150
|
};
|
|
@@ -156,25 +152,6 @@ var FronteggApp = /*#__PURE__*/function () {
|
|
|
156
152
|
var _this$store$getState$;
|
|
157
153
|
return (_this$store$getState$ = _this.store.getState().auth.user) == null ? void 0 : _this$store$getState$.entitlements;
|
|
158
154
|
};
|
|
159
|
-
this.getUserFromStore = function () {
|
|
160
|
-
return _this.store.getState().auth.user;
|
|
161
|
-
};
|
|
162
|
-
this.getEntitlementsQueryData = function (customAttributes) {
|
|
163
|
-
var user = _this.getUserFromStore();
|
|
164
|
-
var entitlements = _this.getEntitlementsFromStore();
|
|
165
|
-
var attributes = {
|
|
166
|
-
custom: customAttributes,
|
|
167
|
-
frontegg: user
|
|
168
|
-
};
|
|
169
|
-
var _this$queryFeatureFla = _this.queryFeatureFlags([FronteggRestApi.USE_ENTITLEMENTS_V2_ENDPOINT_FF]),
|
|
170
|
-
_this$queryFeatureFla2 = (0, _slicedToArray2["default"])(_this$queryFeatureFla, 1),
|
|
171
|
-
useEntitlementsV2 = _this$queryFeatureFla2[0];
|
|
172
|
-
return {
|
|
173
|
-
entitlements: entitlements,
|
|
174
|
-
attributes: attributes,
|
|
175
|
-
isV2: useEntitlementsV2
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
155
|
var appName = (0, _utils.formatName)(name);
|
|
179
156
|
var customElementName = "frontegg-app-".concat(appName);
|
|
180
157
|
this.iframeRendering = iframeRendering;
|
|
@@ -495,49 +472,40 @@ var FronteggApp = /*#__PURE__*/function () {
|
|
|
495
472
|
key: "getFeatureEntitlements",
|
|
496
473
|
value:
|
|
497
474
|
/**
|
|
498
|
-
@param key
|
|
499
|
-
@param customAttributes user attributes
|
|
475
|
+
@param key
|
|
500
476
|
@returns if the user is entitled to the given feature. Attaching the justification if not
|
|
501
477
|
@throws when entitlement is not enabled via frontegg options
|
|
502
478
|
*/
|
|
503
|
-
function getFeatureEntitlements(key
|
|
504
|
-
var
|
|
505
|
-
|
|
506
|
-
attributes = _this$getEntitlements.attributes,
|
|
507
|
-
isV2 = _this$getEntitlements.isV2;
|
|
508
|
-
return (0, _reduxStore.getFeatureEntitlements)(entitlements, key, attributes, isV2);
|
|
479
|
+
function getFeatureEntitlements(key) {
|
|
480
|
+
var entitlements = this.getEntitlementsFromStore();
|
|
481
|
+
return (0, _reduxStore.getFeatureEntitlements)(entitlements, key);
|
|
509
482
|
}
|
|
510
483
|
|
|
511
484
|
/**
|
|
512
|
-
@param key
|
|
513
|
-
@param customAttributes user attributes
|
|
485
|
+
@param key
|
|
514
486
|
@returns if the user is entitled to the given permission. Attaching the justification if not
|
|
515
487
|
@throws when entitlement is not enabled via frontegg options
|
|
516
488
|
*/
|
|
517
489
|
}, {
|
|
518
490
|
key: "getPermissionEntitlements",
|
|
519
|
-
value: function getPermissionEntitlements(key
|
|
520
|
-
var
|
|
521
|
-
|
|
522
|
-
attributes = _this$getEntitlements2.attributes,
|
|
523
|
-
isV2 = _this$getEntitlements2.isV2;
|
|
524
|
-
return (0, _reduxStore.getPermissionEntitlements)(entitlements, key, attributes, isV2);
|
|
491
|
+
value: function getPermissionEntitlements(key) {
|
|
492
|
+
var entitlements = this.getEntitlementsFromStore();
|
|
493
|
+
return (0, _reduxStore.getPermissionEntitlements)(entitlements, key);
|
|
525
494
|
}
|
|
526
495
|
|
|
527
496
|
/**
|
|
528
497
|
@param options - including permission or feature key
|
|
529
|
-
@param customAttributes user attributes
|
|
530
498
|
@returns if the user is entitled to the given permission or feature. Attaching the justification if not
|
|
531
499
|
@throws when entitlement is not enabled via frontegg options
|
|
532
500
|
*/
|
|
533
501
|
}, {
|
|
534
502
|
key: "getEntitlements",
|
|
535
|
-
value: function getEntitlements(options
|
|
503
|
+
value: function getEntitlements(options) {
|
|
536
504
|
// we use permissionKey (options key) to decide if the user is using permission key or feature key
|
|
537
505
|
if ('permissionKey' in options) {
|
|
538
|
-
return this.getPermissionEntitlements(options.permissionKey
|
|
506
|
+
return this.getPermissionEntitlements(options.permissionKey);
|
|
539
507
|
}
|
|
540
|
-
return this.getFeatureEntitlements(options.featureKey
|
|
508
|
+
return this.getFeatureEntitlements(options.featureKey);
|
|
541
509
|
}
|
|
542
510
|
|
|
543
511
|
/**
|
package/node/index.js
CHANGED
package/node/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/js",
|
|
3
|
-
"version": "6.147.0
|
|
3
|
+
"version": "6.147.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.147.0
|
|
9
|
+
"@frontegg/types": "6.147.0"
|
|
10
10
|
},
|
|
11
11
|
"browserslist": {
|
|
12
12
|
"production": [
|