@frontegg/angular 4.10.0-alpha.2070505620 → 4.10.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/bundles/frontegg-angular.umd.js +119 -75
- package/bundles/frontegg-angular.umd.js.map +1 -1
- package/bundles/frontegg-angular.umd.min.js +1 -1
- package/bundles/frontegg-angular.umd.min.js.map +1 -1
- package/esm2015/lib/frontegg-subscription.services.js +44 -0
- package/esm2015/public-api.js +4 -3
- package/fesm2015/frontegg-angular.js +105 -68
- package/fesm2015/frontegg-angular.js.map +1 -1
- package/frontegg-angular.metadata.json +1 -1
- package/lib/frontegg-subscription.services.d.ts +12 -0
- package/lib/frontegg-subscription.services.d.ts.map +1 -0
- package/package.json +6 -6
- package/public-api.d.ts +3 -2
- package/public-api.d.ts.map +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/router'), require('@frontegg/admin-portal'), require('rxjs'), require('@frontegg/rest-api'), require('fast-deep-equal'), require('@frontegg/redux-store')
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@frontegg/angular', ['exports', '@angular/core', '@angular/router', '@frontegg/admin-portal', 'rxjs', '@frontegg/rest-api', 'fast-deep-equal', '@frontegg/redux-store'
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.frontegg = global.frontegg || {}, global.frontegg.angular = {}), global.ng.core, global.ng.router, global.FronteggAdminPortal, global.rxjs, global.FronteggRestApi, global.
|
|
5
|
-
}(this, (function (exports, i0, i1, adminPortal, rxjs, restApi, FastDeepEqual, reduxStore
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('@frontegg/admin-portal'), require('rxjs'), require('@frontegg/rest-api'), require('rxjs/operators'), require('fast-deep-equal'), require('@frontegg/redux-store')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@frontegg/angular', ['exports', '@angular/core', '@angular/common', '@angular/router', '@frontegg/admin-portal', 'rxjs', '@frontegg/rest-api', 'rxjs/operators', 'fast-deep-equal', '@frontegg/redux-store'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.frontegg = global.frontegg || {}, global.frontegg.angular = {}), global.ng.core, global.ng.common, global.ng.router, global.FronteggAdminPortal, global.rxjs, global.FronteggRestApi, global.rxjs.operators, global.FastDeepEqual, global.FronteggReduxStore));
|
|
5
|
+
}(this, (function (exports, i0, common, i1, adminPortal, rxjs, restApi, operators, FastDeepEqual, reduxStore) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -557,6 +557,77 @@
|
|
|
557
557
|
{ type: i0.NgZone }
|
|
558
558
|
]; };
|
|
559
559
|
|
|
560
|
+
var FronteggBaseGuard = /** @class */ (function () {
|
|
561
|
+
function FronteggBaseGuard() {
|
|
562
|
+
}
|
|
563
|
+
FronteggBaseGuard.prototype.parse = function (url) {
|
|
564
|
+
var dus = new i1.DefaultUrlSerializer();
|
|
565
|
+
return dus.parse(url);
|
|
566
|
+
};
|
|
567
|
+
FronteggBaseGuard.prototype.serialize = function (tree) {
|
|
568
|
+
var dus = new i1.DefaultUrlSerializer();
|
|
569
|
+
return dus
|
|
570
|
+
.serialize(tree)
|
|
571
|
+
.replace(/%40/gi, '@')
|
|
572
|
+
.replace(/%3A/gi, ':')
|
|
573
|
+
.replace(/%24/gi, '$')
|
|
574
|
+
.replace(/%2C/gi, ',')
|
|
575
|
+
.replace(/%3B/gi, ';')
|
|
576
|
+
.replace(/%2B/gi, '+')
|
|
577
|
+
.replace(/%3D/gi, '=')
|
|
578
|
+
.replace(/%3F/gi, '?')
|
|
579
|
+
.replace(/%2F/gi, '/')
|
|
580
|
+
.replace(/(https?):\/([\w\d])/gi, '$1://$2');
|
|
581
|
+
};
|
|
582
|
+
return FronteggBaseGuard;
|
|
583
|
+
}());
|
|
584
|
+
|
|
585
|
+
var FronteggAuthGuard = /** @class */ (function (_super) {
|
|
586
|
+
__extends(FronteggAuthGuard, _super);
|
|
587
|
+
function FronteggAuthGuard(fronteggAppService, router, ngZone) {
|
|
588
|
+
var _this = _super.call(this) || this;
|
|
589
|
+
_this.fronteggAppService = fronteggAppService;
|
|
590
|
+
_this.router = router;
|
|
591
|
+
_this.ngZone = ngZone;
|
|
592
|
+
return _this;
|
|
593
|
+
}
|
|
594
|
+
FronteggAuthGuard.prototype.navigateToUrl = function (redirectUrl) {
|
|
595
|
+
this.router.navigateByUrl(this.fronteggAppService.authRoutes.loginUrl + '?redirectUrl=' + encodeURIComponent(redirectUrl));
|
|
596
|
+
};
|
|
597
|
+
FronteggAuthGuard.prototype.canActivate = function (route, state) {
|
|
598
|
+
var _this = this;
|
|
599
|
+
var redirectUrl = state.url;
|
|
600
|
+
return new Promise(function (resolve, reject) {
|
|
601
|
+
var subscription = _this.fronteggAppService.isAuthenticated$.pipe(operators.take(1)).subscribe(function (isAuthenticated) {
|
|
602
|
+
if (isAuthenticated) {
|
|
603
|
+
resolve(true);
|
|
604
|
+
}
|
|
605
|
+
else {
|
|
606
|
+
if (i0.NgZone.isInAngularZone()) {
|
|
607
|
+
_this.navigateToUrl(redirectUrl);
|
|
608
|
+
}
|
|
609
|
+
else {
|
|
610
|
+
_this.ngZone.run(function () {
|
|
611
|
+
_this.navigateToUrl(redirectUrl);
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
reject('unauthorized');
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
subscription.unsubscribe();
|
|
618
|
+
});
|
|
619
|
+
};
|
|
620
|
+
return FronteggAuthGuard;
|
|
621
|
+
}(FronteggBaseGuard));
|
|
622
|
+
FronteggAuthGuard.decorators = [
|
|
623
|
+
{ type: i0.Injectable }
|
|
624
|
+
];
|
|
625
|
+
FronteggAuthGuard.ctorParameters = function () { return [
|
|
626
|
+
{ type: FronteggAppService },
|
|
627
|
+
{ type: i1.Router },
|
|
628
|
+
{ type: i0.NgZone }
|
|
629
|
+
]; };
|
|
630
|
+
|
|
560
631
|
var FronteggAuthService = /** @class */ (function () {
|
|
561
632
|
function FronteggAuthService(fronteggAppService) {
|
|
562
633
|
var _this = this;
|
|
@@ -941,77 +1012,6 @@
|
|
|
941
1012
|
{ type: FronteggAppService }
|
|
942
1013
|
]; };
|
|
943
1014
|
|
|
944
|
-
var FronteggBaseGuard = /** @class */ (function () {
|
|
945
|
-
function FronteggBaseGuard() {
|
|
946
|
-
}
|
|
947
|
-
FronteggBaseGuard.prototype.parse = function (url) {
|
|
948
|
-
var dus = new i1.DefaultUrlSerializer();
|
|
949
|
-
return dus.parse(url);
|
|
950
|
-
};
|
|
951
|
-
FronteggBaseGuard.prototype.serialize = function (tree) {
|
|
952
|
-
var dus = new i1.DefaultUrlSerializer();
|
|
953
|
-
return dus
|
|
954
|
-
.serialize(tree)
|
|
955
|
-
.replace(/%40/gi, '@')
|
|
956
|
-
.replace(/%3A/gi, ':')
|
|
957
|
-
.replace(/%24/gi, '$')
|
|
958
|
-
.replace(/%2C/gi, ',')
|
|
959
|
-
.replace(/%3B/gi, ';')
|
|
960
|
-
.replace(/%2B/gi, '+')
|
|
961
|
-
.replace(/%3D/gi, '=')
|
|
962
|
-
.replace(/%3F/gi, '?')
|
|
963
|
-
.replace(/%2F/gi, '/')
|
|
964
|
-
.replace(/(https?):\/([\w\d])/gi, '$1://$2');
|
|
965
|
-
};
|
|
966
|
-
return FronteggBaseGuard;
|
|
967
|
-
}());
|
|
968
|
-
|
|
969
|
-
var FronteggAuthGuard = /** @class */ (function (_super) {
|
|
970
|
-
__extends(FronteggAuthGuard, _super);
|
|
971
|
-
function FronteggAuthGuard(fronteggAppService, router, ngZone) {
|
|
972
|
-
var _this = _super.call(this) || this;
|
|
973
|
-
_this.fronteggAppService = fronteggAppService;
|
|
974
|
-
_this.router = router;
|
|
975
|
-
_this.ngZone = ngZone;
|
|
976
|
-
return _this;
|
|
977
|
-
}
|
|
978
|
-
FronteggAuthGuard.prototype.navigateToUrl = function (redirectUrl) {
|
|
979
|
-
this.router.navigateByUrl(this.fronteggAppService.authRoutes.loginUrl + '?redirectUrl=' + encodeURIComponent(redirectUrl));
|
|
980
|
-
};
|
|
981
|
-
FronteggAuthGuard.prototype.canActivate = function (route, state) {
|
|
982
|
-
var _this = this;
|
|
983
|
-
var redirectUrl = state.url;
|
|
984
|
-
return new Promise(function (resolve, reject) {
|
|
985
|
-
var subscription = _this.fronteggAppService.isAuthenticated$.pipe(operators.take(1)).subscribe(function (isAuthenticated) {
|
|
986
|
-
if (isAuthenticated) {
|
|
987
|
-
resolve(true);
|
|
988
|
-
}
|
|
989
|
-
else {
|
|
990
|
-
if (i0.NgZone.isInAngularZone()) {
|
|
991
|
-
_this.navigateToUrl(redirectUrl);
|
|
992
|
-
}
|
|
993
|
-
else {
|
|
994
|
-
_this.ngZone.run(function () {
|
|
995
|
-
_this.navigateToUrl(redirectUrl);
|
|
996
|
-
});
|
|
997
|
-
}
|
|
998
|
-
reject('unauthorized');
|
|
999
|
-
}
|
|
1000
|
-
});
|
|
1001
|
-
subscription.unsubscribe();
|
|
1002
|
-
});
|
|
1003
|
-
};
|
|
1004
|
-
return FronteggAuthGuard;
|
|
1005
|
-
}(FronteggBaseGuard));
|
|
1006
|
-
FronteggAuthGuard.decorators = [
|
|
1007
|
-
{ type: i0.Injectable }
|
|
1008
|
-
];
|
|
1009
|
-
FronteggAuthGuard.ctorParameters = function () { return [
|
|
1010
|
-
{ type: FronteggAppService },
|
|
1011
|
-
{ type: i1.Router },
|
|
1012
|
-
{ type: i0.NgZone }
|
|
1013
|
-
]; };
|
|
1014
|
-
|
|
1015
1015
|
var AuthorizedContentDirective = /** @class */ (function () {
|
|
1016
1016
|
function AuthorizedContentDirective(templateRef, viewContainer, fronteggAuthService) {
|
|
1017
1017
|
this.templateRef = templateRef;
|
|
@@ -1082,6 +1082,49 @@
|
|
|
1082
1082
|
},] }
|
|
1083
1083
|
];
|
|
1084
1084
|
|
|
1085
|
+
var FronteggSubscriptionService = /** @class */ (function () {
|
|
1086
|
+
function FronteggSubscriptionService(fronteggAppService) {
|
|
1087
|
+
var _this = this;
|
|
1088
|
+
this.fronteggAppService = fronteggAppService;
|
|
1089
|
+
this.subscriptionStateSubject = new rxjs.BehaviorSubject({});
|
|
1090
|
+
this.loadSubscription = function () { return _this.dispatchAction('billing/subscription/loadSubscription'); };
|
|
1091
|
+
// Memoized Subscription State
|
|
1092
|
+
this.fronteggAppService.subscriptionsState$.subscribe(function (subscriptionState) {
|
|
1093
|
+
var _a;
|
|
1094
|
+
if (subscriptionState != null) {
|
|
1095
|
+
var subscription = subscriptionState.billing.subscription;
|
|
1096
|
+
if (FastDeepEqual__default['default'](_this.subscriptionStateSubject.getValue(), subscription)) {
|
|
1097
|
+
if (!(((_a = subscription.subscription) === null || _a === void 0 ? void 0 : _a.externallyManaged) || !subscription)) {
|
|
1098
|
+
_this.subscriptionStateSubject.next(Object.assign(Object.assign({}, subscription), { subscription: undefined }));
|
|
1099
|
+
}
|
|
1100
|
+
_this.subscriptionStateSubject.next(subscription);
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
Object.defineProperty(FronteggSubscriptionService.prototype, "subscriptionState$", {
|
|
1106
|
+
get: function () {
|
|
1107
|
+
return this.subscriptionStateSubject.asObservable();
|
|
1108
|
+
},
|
|
1109
|
+
enumerable: false,
|
|
1110
|
+
configurable: true
|
|
1111
|
+
});
|
|
1112
|
+
FronteggSubscriptionService.prototype.dispatchAction = function (type, payload) {
|
|
1113
|
+
var store = this.fronteggAppService.fronteggApp.store;
|
|
1114
|
+
store.dispatch({ type: reduxStore.subscriptionsStoreName + "/" + type, payload: payload });
|
|
1115
|
+
};
|
|
1116
|
+
return FronteggSubscriptionService;
|
|
1117
|
+
}());
|
|
1118
|
+
FronteggSubscriptionService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function FronteggSubscriptionService_Factory() { return new FronteggSubscriptionService(i0__namespace.ɵɵinject(FronteggAppService)); }, token: FronteggSubscriptionService, providedIn: "root" });
|
|
1119
|
+
FronteggSubscriptionService.decorators = [
|
|
1120
|
+
{ type: i0.Injectable, args: [{
|
|
1121
|
+
providedIn: 'root',
|
|
1122
|
+
},] }
|
|
1123
|
+
];
|
|
1124
|
+
FronteggSubscriptionService.ctorParameters = function () { return [
|
|
1125
|
+
{ type: FronteggAppService }
|
|
1126
|
+
]; };
|
|
1127
|
+
|
|
1085
1128
|
/*
|
|
1086
1129
|
* Public API Surface of frontegg-app
|
|
1087
1130
|
*/
|
|
@@ -1097,6 +1140,7 @@
|
|
|
1097
1140
|
exports.FronteggAuthService = FronteggAuthService;
|
|
1098
1141
|
exports.FronteggComponent = FronteggComponent;
|
|
1099
1142
|
exports.FronteggLoadGuard = FronteggLoadGuard;
|
|
1143
|
+
exports.FronteggSubscriptionService = FronteggSubscriptionService;
|
|
1100
1144
|
exports.ɵa = FronteggAppOptionsClass;
|
|
1101
1145
|
exports.ɵb = FronteggBaseGuard;
|
|
1102
1146
|
|