@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.
@@ -7701,19 +7701,18 @@
7701
7701
  */
7702
7702
  var RoleService = /** @class */ (function () {
7703
7703
  function RoleService() {
7704
- this.pRoles = [];
7704
+ this.pRoles = new rxjs.BehaviorSubject(null);
7705
+ this.roles$ = this.pRoles.asObservable().pipe(operators.skipWhile(( /**
7706
+ * @param {?} item
7707
+ * @return {?}
7708
+ */function (item) { return item === null; })));
7705
7709
  }
7706
7710
  Object.defineProperty(RoleService.prototype, "roles", {
7707
- get: /**
7708
- * @return {?}
7709
- */ function () {
7710
- return this.pRoles;
7711
- },
7712
7711
  set: /**
7713
7712
  * @param {?} roles
7714
7713
  * @return {?}
7715
7714
  */ function (roles) {
7716
- this.pRoles = roles;
7715
+ this.pRoles.next(roles);
7717
7716
  },
7718
7717
  enumerable: true,
7719
7718
  configurable: true
@@ -7754,23 +7753,28 @@
7754
7753
  */
7755
7754
  function (route) {
7756
7755
  var _this = this;
7757
- /** @type {?} */
7758
- var roles = (( /** @type {?} */(route.data.needsRole)));
7759
- /** @type {?} */
7760
- var check = ( /**
7761
- * @param {?} roleRegEx
7756
+ return this.roleService.roles$.pipe(operators.map(( /**
7757
+ * @param {?} roles
7762
7758
  * @return {?}
7763
- */function (roleRegEx) {
7759
+ */function (roles) {
7760
+ /** @type {?} */
7761
+ var canActivateRoles = (( /** @type {?} */(route.data.needsRole)));
7764
7762
  /** @type {?} */
7765
- var regex = new RegExp(roleRegEx);
7766
- return _this.roleService.roles.some(( /**
7767
- * @param {?} role
7763
+ var check = ( /**
7764
+ * @param {?} roleRegEx
7768
7765
  * @return {?}
7769
- */function (role) { return regex.test(role); }));
7770
- });
7771
- /** @type {?} */
7772
- var match = route.data.roleMatching === RoleMatching.ALL ? roles.every(check) : roles.some(check);
7773
- return match || this.router.parseUrl(( /** @type {?} */(route.data.noRoleMatchRedirect)));
7766
+ */function (roleRegEx) {
7767
+ /** @type {?} */
7768
+ var regex = new RegExp(roleRegEx);
7769
+ return roles.some(( /**
7770
+ * @param {?} role
7771
+ * @return {?}
7772
+ */function (role) { return regex.test(role); }));
7773
+ });
7774
+ /** @type {?} */
7775
+ var match = route.data.roleMatching === RoleMatching.ALL ? canActivateRoles.every(check) : canActivateRoles.some(check);
7776
+ return match || _this.router.parseUrl(( /** @type {?} */(route.data.noRoleMatchRedirect)));
7777
+ })));
7774
7778
  };
7775
7779
  RoleGuard.decorators = [
7776
7780
  { type: i0.Injectable, args: [{