@frontegg/angular 4.5.2-alpha.1663220219 → 4.5.3-alpha.80880
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 +75 -62
- 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-app.service.js +21 -19
- package/esm2015/lib/guards/frontegg-auth.guard.js +28 -8
- package/esm2015/lib/guards/frontegg-load.guard.js +4 -9
- package/fesm2015/frontegg-angular.js +71 -52
- package/fesm2015/frontegg-angular.js.map +1 -1
- package/frontegg-angular.metadata.json +1 -1
- package/lib/frontegg-app.service.d.ts +3 -1
- package/lib/frontegg-app.service.d.ts.map +1 -1
- package/lib/guards/frontegg-auth.guard.d.ts +5 -1
- package/lib/guards/frontegg-auth.guard.d.ts.map +1 -1
- package/lib/guards/frontegg-load.guard.d.ts +3 -5
- package/lib/guards/frontegg-load.guard.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -342,38 +342,9 @@
|
|
|
342
342
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
-
var
|
|
346
|
-
function
|
|
347
|
-
|
|
348
|
-
FronteggBaseGuard.prototype.parse = function (url) {
|
|
349
|
-
var dus = new i1.DefaultUrlSerializer();
|
|
350
|
-
return dus.parse(url);
|
|
351
|
-
};
|
|
352
|
-
FronteggBaseGuard.prototype.serialize = function (tree) {
|
|
353
|
-
var dus = new i1.DefaultUrlSerializer();
|
|
354
|
-
return dus
|
|
355
|
-
.serialize(tree)
|
|
356
|
-
.replace(/%40/gi, '@')
|
|
357
|
-
.replace(/%3A/gi, ':')
|
|
358
|
-
.replace(/%24/gi, '$')
|
|
359
|
-
.replace(/%2C/gi, ',')
|
|
360
|
-
.replace(/%3B/gi, ';')
|
|
361
|
-
.replace(/%2B/gi, '+')
|
|
362
|
-
.replace(/%3D/gi, '=')
|
|
363
|
-
.replace(/%3F/gi, '?')
|
|
364
|
-
.replace(/%2F/gi, '/')
|
|
365
|
-
.replace(/(https?):\/([\w\d])/gi, '$1://$2');
|
|
366
|
-
};
|
|
367
|
-
return FronteggBaseGuard;
|
|
368
|
-
}());
|
|
369
|
-
|
|
370
|
-
var FronteggLoadGuard = /** @class */ (function (_super) {
|
|
371
|
-
__extends(FronteggLoadGuard, _super);
|
|
372
|
-
function FronteggLoadGuard(fronteggAppService, router) {
|
|
373
|
-
var _this = _super.call(this) || this;
|
|
374
|
-
_this.fronteggAppService = fronteggAppService;
|
|
375
|
-
_this.router = router;
|
|
376
|
-
return _this;
|
|
345
|
+
var FronteggLoadGuard = /** @class */ (function () {
|
|
346
|
+
function FronteggLoadGuard(fronteggAppService) {
|
|
347
|
+
this.fronteggAppService = fronteggAppService;
|
|
377
348
|
}
|
|
378
349
|
FronteggLoadGuard.prototype.canActivate = function (route, state) {
|
|
379
350
|
var _this = this;
|
|
@@ -386,13 +357,12 @@
|
|
|
386
357
|
});
|
|
387
358
|
};
|
|
388
359
|
return FronteggLoadGuard;
|
|
389
|
-
}(
|
|
360
|
+
}());
|
|
390
361
|
FronteggLoadGuard.decorators = [
|
|
391
362
|
{ type: i0.Injectable }
|
|
392
363
|
];
|
|
393
364
|
FronteggLoadGuard.ctorParameters = function () { return [
|
|
394
|
-
{ type: FronteggAppService }
|
|
395
|
-
{ type: i1.Router }
|
|
365
|
+
{ type: FronteggAppService }
|
|
396
366
|
]; };
|
|
397
367
|
|
|
398
368
|
var FronteggComponent = /** @class */ (function () {
|
|
@@ -417,10 +387,11 @@
|
|
|
417
387
|
return FronteggAppOptionsClass;
|
|
418
388
|
}());
|
|
419
389
|
var FronteggAppService = /** @class */ (function () {
|
|
420
|
-
function FronteggAppService(config, router) {
|
|
390
|
+
function FronteggAppService(config, router, ngZone) {
|
|
421
391
|
var _this = this;
|
|
422
392
|
this.config = config;
|
|
423
393
|
this.router = router;
|
|
394
|
+
this.ngZone = ngZone;
|
|
424
395
|
this.isLoadingSubject = new rxjs.BehaviorSubject(true);
|
|
425
396
|
this.isAuthenticatedSubject = new rxjs.BehaviorSubject(false);
|
|
426
397
|
this.stateSubject = new rxjs.BehaviorSubject({});
|
|
@@ -442,12 +413,21 @@
|
|
|
442
413
|
window.location.href = path;
|
|
443
414
|
}
|
|
444
415
|
else {
|
|
445
|
-
|
|
446
|
-
|
|
416
|
+
console.warn('FronteggRouting.start');
|
|
417
|
+
try {
|
|
418
|
+
console.warn('FronteggRouting', ngZone.isStable, i0.NgZone.isInAngularZone());
|
|
447
419
|
}
|
|
448
|
-
|
|
449
|
-
_this.router.navigate([path]);
|
|
420
|
+
catch (e) {
|
|
450
421
|
}
|
|
422
|
+
_this.ngZone.run(function () {
|
|
423
|
+
console.warn('FronteggRouting.inside-ngZone');
|
|
424
|
+
if (opts === null || opts === void 0 ? void 0 : opts.replace) {
|
|
425
|
+
_this.router.navigateByUrl(path, { replaceUrl: true });
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
_this.router.navigateByUrl(path);
|
|
429
|
+
}
|
|
430
|
+
});
|
|
451
431
|
}
|
|
452
432
|
};
|
|
453
433
|
restApi.ContextHolder.setOnRedirectTo(onRedirectTo);
|
|
@@ -460,18 +440,6 @@
|
|
|
460
440
|
children: __spreadArray([], __read(this.router.config)),
|
|
461
441
|
},
|
|
462
442
|
]));
|
|
463
|
-
this.router.events.subscribe(function (event) {
|
|
464
|
-
if (event instanceof i1.NavigationStart) {
|
|
465
|
-
var authRoutes = _this.mapAuthComponents.map(function (_b) {
|
|
466
|
-
var path = _b.path;
|
|
467
|
-
return (path === null || path === void 0 ? void 0 : path.startsWith('/')) ? path : "/" + path;
|
|
468
|
-
});
|
|
469
|
-
var curr = authRoutes.find(function (path) { return event.url.split('?')[0] !== path && event.url.startsWith(path); });
|
|
470
|
-
if (curr) {
|
|
471
|
-
_this.router.navigateByUrl("" + curr + decodeURIComponent(event.url.split(curr)[1]));
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
});
|
|
475
443
|
// Subscribe on fronteggApp store to change state subjects
|
|
476
444
|
this.fronteggApp.store.subscribe(function () {
|
|
477
445
|
var fronteggStore = _this.fronteggApp.store.getState();
|
|
@@ -581,7 +549,7 @@
|
|
|
581
549
|
};
|
|
582
550
|
return FronteggAppService;
|
|
583
551
|
}());
|
|
584
|
-
FronteggAppService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function FronteggAppService_Factory() { return new FronteggAppService(i0__namespace.ɵɵinject(FronteggAppOptionsClass), i0__namespace.ɵɵinject(i1__namespace.Router)); }, token: FronteggAppService, providedIn: "root" });
|
|
552
|
+
FronteggAppService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function FronteggAppService_Factory() { return new FronteggAppService(i0__namespace.ɵɵinject(FronteggAppOptionsClass), i0__namespace.ɵɵinject(i1__namespace.Router), i0__namespace.ɵɵinject(i0__namespace.NgZone)); }, token: FronteggAppService, providedIn: "root" });
|
|
585
553
|
FronteggAppService.decorators = [
|
|
586
554
|
{ type: i0.Injectable, args: [{
|
|
587
555
|
providedIn: 'root',
|
|
@@ -589,7 +557,8 @@
|
|
|
589
557
|
];
|
|
590
558
|
FronteggAppService.ctorParameters = function () { return [
|
|
591
559
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [FronteggAppOptionsClass,] }] },
|
|
592
|
-
{ type: i1.Router }
|
|
560
|
+
{ type: i1.Router },
|
|
561
|
+
{ type: i0.NgZone }
|
|
593
562
|
]; };
|
|
594
563
|
|
|
595
564
|
var FronteggAuthService = /** @class */ (function () {
|
|
@@ -976,27 +945,70 @@
|
|
|
976
945
|
{ type: FronteggAppService }
|
|
977
946
|
]; };
|
|
978
947
|
|
|
948
|
+
var FronteggBaseGuard = /** @class */ (function () {
|
|
949
|
+
function FronteggBaseGuard() {
|
|
950
|
+
}
|
|
951
|
+
FronteggBaseGuard.prototype.parse = function (url) {
|
|
952
|
+
var dus = new i1.DefaultUrlSerializer();
|
|
953
|
+
return dus.parse(url);
|
|
954
|
+
};
|
|
955
|
+
FronteggBaseGuard.prototype.serialize = function (tree) {
|
|
956
|
+
var dus = new i1.DefaultUrlSerializer();
|
|
957
|
+
return dus
|
|
958
|
+
.serialize(tree)
|
|
959
|
+
.replace(/%40/gi, '@')
|
|
960
|
+
.replace(/%3A/gi, ':')
|
|
961
|
+
.replace(/%24/gi, '$')
|
|
962
|
+
.replace(/%2C/gi, ',')
|
|
963
|
+
.replace(/%3B/gi, ';')
|
|
964
|
+
.replace(/%2B/gi, '+')
|
|
965
|
+
.replace(/%3D/gi, '=')
|
|
966
|
+
.replace(/%3F/gi, '?')
|
|
967
|
+
.replace(/%2F/gi, '/')
|
|
968
|
+
.replace(/(https?):\/([\w\d])/gi, '$1://$2');
|
|
969
|
+
};
|
|
970
|
+
return FronteggBaseGuard;
|
|
971
|
+
}());
|
|
972
|
+
|
|
979
973
|
var FronteggAuthGuard = /** @class */ (function (_super) {
|
|
980
974
|
__extends(FronteggAuthGuard, _super);
|
|
981
|
-
function FronteggAuthGuard(fronteggAppService, router) {
|
|
975
|
+
function FronteggAuthGuard(fronteggAppService, router, ngZone) {
|
|
982
976
|
var _this = _super.call(this) || this;
|
|
983
977
|
_this.fronteggAppService = fronteggAppService;
|
|
984
978
|
_this.router = router;
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
FronteggAuthGuard.prototype.canActivate = function (route, state) {
|
|
988
|
-
var _this = this;
|
|
989
|
-
return new rxjs.Observable(function (obs) {
|
|
979
|
+
_this.ngZone = ngZone;
|
|
980
|
+
_this.authObservable = new rxjs.Observable(function (obs) {
|
|
990
981
|
_this.fronteggAppService.isAuthenticated$.subscribe(function (isAuthenticated) {
|
|
991
982
|
if (isAuthenticated) {
|
|
992
983
|
obs.next(true);
|
|
993
984
|
}
|
|
994
985
|
else {
|
|
995
|
-
|
|
986
|
+
console.warn('FronteggAuthGuard.start');
|
|
987
|
+
try {
|
|
988
|
+
console.warn('FronteggAuthGuard', ngZone.isStable, i0.NgZone.isInAngularZone());
|
|
989
|
+
}
|
|
990
|
+
catch (e) {
|
|
991
|
+
}
|
|
992
|
+
if (i0.NgZone.isInAngularZone()) {
|
|
993
|
+
_this.navigateToUrl();
|
|
994
|
+
}
|
|
995
|
+
else {
|
|
996
|
+
_this.ngZone.run(function () {
|
|
997
|
+
_this.navigateToUrl();
|
|
998
|
+
});
|
|
999
|
+
}
|
|
996
1000
|
obs.next(false);
|
|
997
1001
|
}
|
|
998
1002
|
});
|
|
999
1003
|
});
|
|
1004
|
+
return _this;
|
|
1005
|
+
}
|
|
1006
|
+
FronteggAuthGuard.prototype.navigateToUrl = function () {
|
|
1007
|
+
var redirectUrl = this.router.routerState.snapshot.url;
|
|
1008
|
+
this.router.navigateByUrl(this.fronteggAppService.authRoutes.loginUrl + '?redirectUrl=' + encodeURIComponent(redirectUrl));
|
|
1009
|
+
};
|
|
1010
|
+
FronteggAuthGuard.prototype.canActivate = function (route, state) {
|
|
1011
|
+
return this.authObservable;
|
|
1000
1012
|
};
|
|
1001
1013
|
return FronteggAuthGuard;
|
|
1002
1014
|
}(FronteggBaseGuard));
|
|
@@ -1005,7 +1017,8 @@
|
|
|
1005
1017
|
];
|
|
1006
1018
|
FronteggAuthGuard.ctorParameters = function () { return [
|
|
1007
1019
|
{ type: FronteggAppService },
|
|
1008
|
-
{ type: i1.Router }
|
|
1020
|
+
{ type: i1.Router },
|
|
1021
|
+
{ type: i0.NgZone }
|
|
1009
1022
|
]; };
|
|
1010
1023
|
|
|
1011
1024
|
var AuthorizedContentDirective = /** @class */ (function () {
|