@frontegg/angular 6.13.0-alpha.7349472316 → 6.13.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/CHANGELOG.md +523 -0
- package/bundles/frontegg-angular.umd.js +54 -106
- package/bundles/frontegg-angular.umd.js.map +1 -1
- package/esm2015/lib/frontegg-app.module.js +1 -3
- package/esm2015/lib/frontegg-auth.service.js +4 -18
- package/esm2015/lib/frontegg-entitlements.service.js +51 -27
- package/esm2015/sdkVersion.js +2 -2
- package/fesm2015/frontegg-angular.js +54 -104
- package/fesm2015/frontegg-angular.js.map +1 -1
- package/lib/frontegg-app.module.d.ts.map +1 -1
- package/lib/frontegg-auth.service.d.ts +2 -15
- package/lib/frontegg-auth.service.d.ts.map +1 -1
- package/lib/frontegg-entitlements.service.d.ts +17 -4
- package/lib/frontegg-entitlements.service.d.ts.map +1 -1
- package/package.json +2 -2
- package/esm2015/lib/frontegg-user-subscription.service.js +0 -65
- package/lib/frontegg-user-subscription.service.d.ts +0 -31
- package/lib/frontegg-user-subscription.service.d.ts.map +0 -1
|
@@ -357,7 +357,7 @@
|
|
|
357
357
|
}]
|
|
358
358
|
}] });
|
|
359
359
|
|
|
360
|
-
var sdkVersion = { version: '6.
|
|
360
|
+
var sdkVersion = { version: '6.13.0' };
|
|
361
361
|
|
|
362
362
|
var FronteggAppOptionsClass = /** @class */ (function () {
|
|
363
363
|
function FronteggAppOptionsClass() {
|
|
@@ -624,75 +624,11 @@
|
|
|
624
624
|
}
|
|
625
625
|
};
|
|
626
626
|
|
|
627
|
-
/**
|
|
628
|
-
* A service for managing user state subscription
|
|
629
|
-
* The service gives the ability to subscribe to user state change and get a manipulated data when the user state changes
|
|
630
|
-
*/
|
|
631
|
-
var FronteggUserSubscriptionService = /** @class */ (function () {
|
|
632
|
-
function FronteggUserSubscriptionService(fronteggAppService) {
|
|
633
|
-
var _this = this;
|
|
634
|
-
this.fronteggAppService = fronteggAppService;
|
|
635
|
-
this.userStateSubject = new rxjs.BehaviorSubject(undefined);
|
|
636
|
-
var state = this.fronteggAppService.fronteggApp.store.getState();
|
|
637
|
-
this.updateUserStateIfNeeded(state.auth);
|
|
638
|
-
// Memoized user State
|
|
639
|
-
this.fronteggAppService.fronteggApp.store.subscribe(function () {
|
|
640
|
-
var newState = _this.fronteggAppService.fronteggApp.store.getState();
|
|
641
|
-
_this.updateUserStateIfNeeded(newState.auth);
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
/**
|
|
645
|
-
* Trigger user subject change event if the user reference changes
|
|
646
|
-
* No need for deep equal because we already check it internally
|
|
647
|
-
* @param authState
|
|
648
|
-
*/
|
|
649
|
-
FronteggUserSubscriptionService.prototype.updateUserStateIfNeeded = function (authState) {
|
|
650
|
-
var userState = authState.user;
|
|
651
|
-
if (this.userStateSubject.value === userState) {
|
|
652
|
-
return;
|
|
653
|
-
}
|
|
654
|
-
this.userStateSubject.next(userState);
|
|
655
|
-
};
|
|
656
|
-
/**
|
|
657
|
-
* The function gives the ability to return a manipulated data of the user state as a subscription.
|
|
658
|
-
*
|
|
659
|
-
* @param dataManipulator Manipulator function that receives user state and returns a manipulated data
|
|
660
|
-
* @param observer For receiving manipulated data result
|
|
661
|
-
* @returns a subscription to be able to unsubscribe
|
|
662
|
-
*/
|
|
663
|
-
FronteggUserSubscriptionService.prototype.getUserManipulatorSubscription = function (dataManipulator, observer) {
|
|
664
|
-
// used for computing the end user result because we don't return the state itself, but a calculated one
|
|
665
|
-
var userSubject = new rxjs.BehaviorSubject(undefined);
|
|
666
|
-
var stateSubscription = this.userStateSubject.subscribe(function (user) {
|
|
667
|
-
userSubject.next(dataManipulator(user));
|
|
668
|
-
});
|
|
669
|
-
// subscribing the consumer observer
|
|
670
|
-
var userResultSubscription = userSubject.asObservable().subscribe(observer);
|
|
671
|
-
// monkey patched to manage both un-subscriptions: state and user manipulated result
|
|
672
|
-
var originalUnsubscribe = userResultSubscription.unsubscribe.bind(userResultSubscription);
|
|
673
|
-
userResultSubscription.unsubscribe = function () {
|
|
674
|
-
originalUnsubscribe();
|
|
675
|
-
stateSubscription.unsubscribe();
|
|
676
|
-
};
|
|
677
|
-
return userResultSubscription;
|
|
678
|
-
};
|
|
679
|
-
return FronteggUserSubscriptionService;
|
|
680
|
-
}());
|
|
681
|
-
FronteggUserSubscriptionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FronteggUserSubscriptionService, deps: [{ token: FronteggAppService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
682
|
-
FronteggUserSubscriptionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FronteggUserSubscriptionService, providedIn: 'root' });
|
|
683
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FronteggUserSubscriptionService, decorators: [{
|
|
684
|
-
type: i0.Injectable,
|
|
685
|
-
args: [{
|
|
686
|
-
providedIn: 'root',
|
|
687
|
-
}]
|
|
688
|
-
}], ctorParameters: function () { return [{ type: FronteggAppService }]; } });
|
|
689
|
-
|
|
690
627
|
var FronteggAuthService = /** @class */ (function () {
|
|
691
|
-
function FronteggAuthService(fronteggAppService, router
|
|
628
|
+
function FronteggAuthService(fronteggAppService, router) {
|
|
692
629
|
var _this = this;
|
|
693
630
|
this.fronteggAppService = fronteggAppService;
|
|
694
631
|
this.router = router;
|
|
695
|
-
this.fronteggUserSubscriptionService = fronteggUserSubscriptionService;
|
|
696
632
|
this.authStateSubject = new rxjs.BehaviorSubject({ isAuthenticated: false, isLoading: true });
|
|
697
633
|
this.acceptInvitationStateSubject = new rxjs.BehaviorSubject({});
|
|
698
634
|
this.accountSettingsStateSubject = new rxjs.BehaviorSubject({});
|
|
@@ -715,11 +651,6 @@
|
|
|
715
651
|
this.isLoadingSubject = new rxjs.BehaviorSubject(true);
|
|
716
652
|
this.isSSOAuthSubject = new rxjs.BehaviorSubject(false);
|
|
717
653
|
this.ssoACSSubject = new rxjs.BehaviorSubject('');
|
|
718
|
-
/**
|
|
719
|
-
* Triggers step up flow
|
|
720
|
-
* @param options.maxAge optional max age
|
|
721
|
-
*/
|
|
722
|
-
this.stepUp = function (options) { return _this.fronteggAppService.fronteggApp.stepUp(options); };
|
|
723
654
|
// Root Actions
|
|
724
655
|
this.setState = function (state) { return _this.dispatchAction('setState', state); };
|
|
725
656
|
this.resetState = function () { return _this.dispatchAction('resetState'); };
|
|
@@ -1105,24 +1036,16 @@
|
|
|
1105
1036
|
var hostedLoginRedirectUrl = this.fronteggAppService.authRoutes.hostedLoginRedirectUrl;
|
|
1106
1037
|
return path.startsWith(hostedLoginRedirectUrl !== null && hostedLoginRedirectUrl !== void 0 ? hostedLoginRedirectUrl : '/oauth/callback');
|
|
1107
1038
|
};
|
|
1108
|
-
/**
|
|
1109
|
-
* @param options.maxAge optional max age
|
|
1110
|
-
* @returns A subscription for step up state - true when user is stepped up, false otherwise
|
|
1111
|
-
*/
|
|
1112
|
-
FronteggAuthService.prototype.isSteppedUp$ = function (observer, options) {
|
|
1113
|
-
var _this = this;
|
|
1114
|
-
return this.fronteggUserSubscriptionService.getUserManipulatorSubscription(function () { return _this.fronteggAppService.fronteggApp.isSteppedUp(options); }, observer);
|
|
1115
|
-
};
|
|
1116
1039
|
return FronteggAuthService;
|
|
1117
1040
|
}());
|
|
1118
|
-
FronteggAuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FronteggAuthService, deps: [{ token: FronteggAppService }, { token: i1__namespace.Router }
|
|
1041
|
+
FronteggAuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FronteggAuthService, deps: [{ token: FronteggAppService }, { token: i1__namespace.Router }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1119
1042
|
FronteggAuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FronteggAuthService, providedIn: 'root' });
|
|
1120
1043
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FronteggAuthService, decorators: [{
|
|
1121
1044
|
type: i0.Injectable,
|
|
1122
1045
|
args: [{
|
|
1123
1046
|
providedIn: 'root',
|
|
1124
1047
|
}]
|
|
1125
|
-
}], ctorParameters: function () { return [{ type: FronteggAppService }, { type: i1__namespace.Router }
|
|
1048
|
+
}], ctorParameters: function () { return [{ type: FronteggAppService }, { type: i1__namespace.Router }]; } });
|
|
1126
1049
|
|
|
1127
1050
|
var FronteggAuthGuard = /** @class */ (function (_super) {
|
|
1128
1051
|
__extends(FronteggAuthGuard, _super);
|
|
@@ -1337,10 +1260,53 @@
|
|
|
1337
1260
|
* 3. Load entitlements on demand.
|
|
1338
1261
|
*/
|
|
1339
1262
|
var FronteggEntitlementsService = /** @class */ (function () {
|
|
1340
|
-
function FronteggEntitlementsService(fronteggAppService
|
|
1263
|
+
function FronteggEntitlementsService(fronteggAppService) {
|
|
1264
|
+
var _this = this;
|
|
1341
1265
|
this.fronteggAppService = fronteggAppService;
|
|
1342
|
-
this.
|
|
1266
|
+
this.userStateSubject = new rxjs.BehaviorSubject(undefined);
|
|
1267
|
+
var state = this.fronteggAppService.fronteggApp.store.getState();
|
|
1268
|
+
this.updateUserStateIfNeeded(state.auth);
|
|
1269
|
+
// Memoized entitlements State
|
|
1270
|
+
this.fronteggAppService.fronteggApp.store.subscribe(function () {
|
|
1271
|
+
var newState = _this.fronteggAppService.fronteggApp.store.getState();
|
|
1272
|
+
_this.updateUserStateIfNeeded(newState.auth);
|
|
1273
|
+
});
|
|
1343
1274
|
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Trigger entitlements subject change event if the entitlements reference changes
|
|
1277
|
+
* No need for deep equal because we already check it internally
|
|
1278
|
+
* @param authState
|
|
1279
|
+
*/
|
|
1280
|
+
FronteggEntitlementsService.prototype.updateUserStateIfNeeded = function (authState) {
|
|
1281
|
+
var entitlementsState = authState.user;
|
|
1282
|
+
if (this.userStateSubject.value === entitlementsState) {
|
|
1283
|
+
return;
|
|
1284
|
+
}
|
|
1285
|
+
this.userStateSubject.next(entitlementsState);
|
|
1286
|
+
};
|
|
1287
|
+
/**
|
|
1288
|
+
* The function gives the ability to return a manipulated data of the user state as a subscription.
|
|
1289
|
+
*
|
|
1290
|
+
* @param dataManipulator Manipulator function that receives user state and returns a manipulated data
|
|
1291
|
+
* @param observer For receiving manipulated data result
|
|
1292
|
+
* @returns a subscription to be able to unsubscribe
|
|
1293
|
+
*/
|
|
1294
|
+
FronteggEntitlementsService.prototype.getUserManipulatorSubscription = function (dataManipulator, observer) {
|
|
1295
|
+
// used for computing the entitlements result because we don't return the state itself, but a calculated one
|
|
1296
|
+
var userSubject = new rxjs.BehaviorSubject(undefined);
|
|
1297
|
+
var stateSubscription = this.userStateSubject.subscribe(function (user) {
|
|
1298
|
+
userSubject.next(dataManipulator(user));
|
|
1299
|
+
});
|
|
1300
|
+
// subscribing the consumer observer
|
|
1301
|
+
var userResultSubscription = userSubject.asObservable().subscribe(observer);
|
|
1302
|
+
// monkey patched to manage both un-subscriptions: state and user manipulated result
|
|
1303
|
+
var originalUnsubscribe = userResultSubscription.unsubscribe.bind(userResultSubscription);
|
|
1304
|
+
userResultSubscription.unsubscribe = function () {
|
|
1305
|
+
originalUnsubscribe();
|
|
1306
|
+
stateSubscription.unsubscribe();
|
|
1307
|
+
};
|
|
1308
|
+
return userResultSubscription;
|
|
1309
|
+
};
|
|
1344
1310
|
/**
|
|
1345
1311
|
* @param feature
|
|
1346
1312
|
* @param observer For receiving the feature entitlements result including if the user is entitled to the given feature.
|
|
@@ -1351,13 +1317,7 @@
|
|
|
1351
1317
|
*/
|
|
1352
1318
|
FronteggEntitlementsService.prototype.featureEntitlements$ = function (feature, observer, customAttributes) {
|
|
1353
1319
|
var _this = this;
|
|
1354
|
-
return this.
|
|
1355
|
-
// the entitlemenets-common npm doesn't know to overcome the case of signed out user, then we get console errors
|
|
1356
|
-
if (user) {
|
|
1357
|
-
return _this.fronteggAppService.fronteggApp.getFeatureEntitlements(feature, customAttributes);
|
|
1358
|
-
}
|
|
1359
|
-
return { isEntitled: false, justification: restApi.NotEntitledJustification.MISSING_FEATURE };
|
|
1360
|
-
}, observer);
|
|
1320
|
+
return this.getUserManipulatorSubscription(function () { return _this.fronteggAppService.fronteggApp.getFeatureEntitlements(feature, customAttributes); }, observer);
|
|
1361
1321
|
};
|
|
1362
1322
|
/**
|
|
1363
1323
|
* @param permission
|
|
@@ -1368,12 +1328,7 @@
|
|
|
1368
1328
|
*/
|
|
1369
1329
|
FronteggEntitlementsService.prototype.permissionEntitlements$ = function (permission, observer, customAttributes) {
|
|
1370
1330
|
var _this = this;
|
|
1371
|
-
return this.
|
|
1372
|
-
if (user) {
|
|
1373
|
-
return _this.fronteggAppService.fronteggApp.getPermissionEntitlements(permission, customAttributes);
|
|
1374
|
-
}
|
|
1375
|
-
return { isEntitled: false, justification: restApi.NotEntitledJustification.MISSING_PERMISSION };
|
|
1376
|
-
}, observer);
|
|
1331
|
+
return this.getUserManipulatorSubscription(function () { return _this.fronteggAppService.fronteggApp.getPermissionEntitlements(permission, customAttributes); }, observer);
|
|
1377
1332
|
};
|
|
1378
1333
|
/**
|
|
1379
1334
|
* @param options permissionKey or featureKey in an options object
|
|
@@ -1384,13 +1339,7 @@
|
|
|
1384
1339
|
*/
|
|
1385
1340
|
FronteggEntitlementsService.prototype.entitlements$ = function (options, observer, customAttributes) {
|
|
1386
1341
|
var _this = this;
|
|
1387
|
-
return this.
|
|
1388
|
-
if (user) {
|
|
1389
|
-
return _this.fronteggAppService.fronteggApp.getEntitlements(options, customAttributes);
|
|
1390
|
-
}
|
|
1391
|
-
var justification = 'featureKey' in options ? restApi.NotEntitledJustification.MISSING_FEATURE : restApi.NotEntitledJustification.MISSING_PERMISSION;
|
|
1392
|
-
return { isEntitled: false, justification: justification };
|
|
1393
|
-
}, observer);
|
|
1342
|
+
return this.getUserManipulatorSubscription(function () { return _this.fronteggAppService.fronteggApp.getEntitlements(options, customAttributes); }, observer);
|
|
1394
1343
|
};
|
|
1395
1344
|
/**
|
|
1396
1345
|
* Load entitlements data on demand
|
|
@@ -1401,14 +1350,14 @@
|
|
|
1401
1350
|
};
|
|
1402
1351
|
return FronteggEntitlementsService;
|
|
1403
1352
|
}());
|
|
1404
|
-
FronteggEntitlementsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FronteggEntitlementsService, deps: [{ token: FronteggAppService }
|
|
1353
|
+
FronteggEntitlementsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FronteggEntitlementsService, deps: [{ token: FronteggAppService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1405
1354
|
FronteggEntitlementsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FronteggEntitlementsService, providedIn: 'root' });
|
|
1406
1355
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FronteggEntitlementsService, decorators: [{
|
|
1407
1356
|
type: i0.Injectable,
|
|
1408
1357
|
args: [{
|
|
1409
1358
|
providedIn: 'root',
|
|
1410
1359
|
}]
|
|
1411
|
-
}], ctorParameters: function () { return [{ type: FronteggAppService }
|
|
1360
|
+
}], ctorParameters: function () { return [{ type: FronteggAppService }]; } });
|
|
1412
1361
|
|
|
1413
1362
|
var FronteggAppModule = /** @class */ (function () {
|
|
1414
1363
|
function FronteggAppModule() {
|
|
@@ -1423,7 +1372,6 @@
|
|
|
1423
1372
|
FronteggAuthService,
|
|
1424
1373
|
FronteggEntitlementsService,
|
|
1425
1374
|
FronteggSubscriptionService,
|
|
1426
|
-
FronteggUserSubscriptionService,
|
|
1427
1375
|
{
|
|
1428
1376
|
provide: FronteggAppOptionsClass,
|
|
1429
1377
|
useValue: config,
|