@hmcts/rpx-xui-common-lib 1.7.22 → 1.7.28
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/hmcts-rpx-xui-common-lib.umd.js +25 -21
- package/bundles/hmcts-rpx-xui-common-lib.umd.js.map +1 -1
- package/bundles/hmcts-rpx-xui-common-lib.umd.min.js +1 -1
- package/bundles/hmcts-rpx-xui-common-lib.umd.min.js.map +1 -1
- package/esm2015/lib/services/role-guard/role.guard.js +22 -15
- package/esm2015/lib/services/role-guard/role.service.js +13 -13
- package/esm5/lib/services/role-guard/role.guard.js +22 -15
- package/esm5/lib/services/role-guard/role.service.js +13 -13
- package/fesm2015/hmcts-rpx-xui-common-lib.js +28 -23
- package/fesm2015/hmcts-rpx-xui-common-lib.js.map +1 -1
- package/fesm5/hmcts-rpx-xui-common-lib.js +29 -24
- package/fesm5/hmcts-rpx-xui-common-lib.js.map +1 -1
- package/lib/services/role-guard/role.guard.d.ts +2 -1
- package/lib/services/role-guard/role.service.d.ts +3 -1
- package/package.json +1 -1
|
@@ -10,9 +10,9 @@ import { Title } from '@angular/platform-browser';
|
|
|
10
10
|
import { DocumentInterruptSource, Idle } from '@ng-idle/core';
|
|
11
11
|
import { Keepalive } from '@ng-idle/keepalive';
|
|
12
12
|
import { RouterModule, Router, NavigationEnd } from '@angular/router';
|
|
13
|
-
import { Component, EventEmitter, Input, Output, ViewEncapsulation, Injectable, Directive, TemplateRef, ViewContainerRef, ElementRef, Inject, ViewChild, ChangeDetectorRef, InjectionToken, defineInjectable, inject,
|
|
13
|
+
import { Component, EventEmitter, Input, Output, ViewEncapsulation, Injectable, Directive, TemplateRef, ViewContainerRef, ElementRef, Inject, ViewChild, ChangeDetectorRef, InjectionToken, defineInjectable, inject, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
14
14
|
import { BehaviorSubject, of, zip, Subject, combineLatest } from 'rxjs';
|
|
15
|
-
import { distinctUntilChanged, map, debounceTime, filter, mergeMap, tap, catchError, switchMap, delay } from 'rxjs/operators';
|
|
15
|
+
import { distinctUntilChanged, map, debounceTime, filter, mergeMap, tap, catchError, switchMap, delay, skipWhile } from 'rxjs/operators';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @fileoverview added by tsickle
|
|
@@ -7694,21 +7694,20 @@ var TimeoutNotificationsService = /** @class */ (function () {
|
|
|
7694
7694
|
*/
|
|
7695
7695
|
var RoleService = /** @class */ (function () {
|
|
7696
7696
|
function RoleService() {
|
|
7697
|
-
this.pRoles =
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
get: /**
|
|
7697
|
+
this.pRoles = new BehaviorSubject(null);
|
|
7698
|
+
this.roles$ = this.pRoles.asObservable().pipe(skipWhile((/**
|
|
7699
|
+
* @param {?} item
|
|
7701
7700
|
* @return {?}
|
|
7702
7701
|
*/
|
|
7703
|
-
function () {
|
|
7704
|
-
|
|
7705
|
-
|
|
7702
|
+
function (item) { return item === null; })));
|
|
7703
|
+
}
|
|
7704
|
+
Object.defineProperty(RoleService.prototype, "roles", {
|
|
7706
7705
|
set: /**
|
|
7707
7706
|
* @param {?} roles
|
|
7708
7707
|
* @return {?}
|
|
7709
7708
|
*/
|
|
7710
7709
|
function (roles) {
|
|
7711
|
-
this.pRoles
|
|
7710
|
+
this.pRoles.next(roles);
|
|
7712
7711
|
},
|
|
7713
7712
|
enumerable: true,
|
|
7714
7713
|
configurable: true
|
|
@@ -7749,25 +7748,31 @@ var RoleGuard = /** @class */ (function () {
|
|
|
7749
7748
|
*/
|
|
7750
7749
|
function (route) {
|
|
7751
7750
|
var _this = this;
|
|
7752
|
-
/**
|
|
7753
|
-
|
|
7754
|
-
/** @type {?} */
|
|
7755
|
-
var check = (/**
|
|
7756
|
-
* @param {?} roleRegEx
|
|
7751
|
+
return this.roleService.roles$.pipe(map((/**
|
|
7752
|
+
* @param {?} roles
|
|
7757
7753
|
* @return {?}
|
|
7758
7754
|
*/
|
|
7759
|
-
function (
|
|
7755
|
+
function (roles) {
|
|
7756
|
+
/** @type {?} */
|
|
7757
|
+
var canActivateRoles = ((/** @type {?} */ (route.data.needsRole)));
|
|
7760
7758
|
/** @type {?} */
|
|
7761
|
-
var
|
|
7762
|
-
|
|
7763
|
-
* @param {?} role
|
|
7759
|
+
var check = (/**
|
|
7760
|
+
* @param {?} roleRegEx
|
|
7764
7761
|
* @return {?}
|
|
7765
7762
|
*/
|
|
7766
|
-
function (
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7763
|
+
function (roleRegEx) {
|
|
7764
|
+
/** @type {?} */
|
|
7765
|
+
var regex = new RegExp(roleRegEx);
|
|
7766
|
+
return roles.some((/**
|
|
7767
|
+
* @param {?} role
|
|
7768
|
+
* @return {?}
|
|
7769
|
+
*/
|
|
7770
|
+
function (role) { return regex.test(role); }));
|
|
7771
|
+
});
|
|
7772
|
+
/** @type {?} */
|
|
7773
|
+
var match = route.data.roleMatching === RoleMatching.ALL ? canActivateRoles.every(check) : canActivateRoles.some(check);
|
|
7774
|
+
return match || _this.router.parseUrl((/** @type {?} */ (route.data.noRoleMatchRedirect)));
|
|
7775
|
+
})));
|
|
7771
7776
|
};
|
|
7772
7777
|
RoleGuard.decorators = [
|
|
7773
7778
|
{ type: Injectable, args: [{
|