@brggroup/share-lib 0.0.93 → 0.0.95
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/fesm2022/brggroup-share-lib.mjs +16 -20
- package/fesm2022/brggroup-share-lib.mjs.map +1 -1
- package/lib/auth/auth.service.d.ts +2 -2
- package/lib/auth/auth.service.d.ts.map +1 -1
- package/lib/auth/session-manager.service.d.ts +1 -2
- package/lib/auth/session-manager.service.d.ts.map +1 -1
- package/lib/services/vsc.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injectable, Component, HostListener, ViewContainerRef, Input, ViewChild, EventEmitter, Output, Directive, Optional, Self, HostBinding, forwardRef, Pipe } from '@angular/core';
|
|
2
|
+
import { inject, Injectable, NgZone, Component, HostListener, ViewContainerRef, Input, ViewChild, EventEmitter, Output, Directive, Optional, Self, HostBinding, forwardRef, Pipe } from '@angular/core';
|
|
3
3
|
import * as i1$4 from '@angular/router';
|
|
4
4
|
import { Router, ActivatedRoute, NavigationEnd, RouterLink, RouterOutlet } from '@angular/router';
|
|
5
5
|
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
|
@@ -587,7 +587,7 @@ class AuthService extends HTTPService {
|
|
|
587
587
|
/* ----------------------------------------
|
|
588
588
|
LOGIN
|
|
589
589
|
---------------------------------------- */
|
|
590
|
-
async
|
|
590
|
+
async _signIn(username, password, orgid, returnUrl) {
|
|
591
591
|
try {
|
|
592
592
|
const body = {
|
|
593
593
|
UserName: username,
|
|
@@ -619,7 +619,7 @@ class AuthService extends HTTPService {
|
|
|
619
619
|
/* ----------------------------------------
|
|
620
620
|
LOGOUT
|
|
621
621
|
---------------------------------------- */
|
|
622
|
-
|
|
622
|
+
_signOut() {
|
|
623
623
|
TokenStorage.clearToken();
|
|
624
624
|
const currentUrl = this.router.routerState.snapshot.url;
|
|
625
625
|
this.router.navigate(['/login'], {
|
|
@@ -930,10 +930,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImpor
|
|
|
930
930
|
}] });
|
|
931
931
|
|
|
932
932
|
class SessionManagerService {
|
|
933
|
-
zone;
|
|
934
|
-
constructor(zone) {
|
|
935
|
-
this.zone = zone;
|
|
936
|
-
}
|
|
933
|
+
zone = inject(NgZone);
|
|
937
934
|
authService = inject(AuthService);
|
|
938
935
|
idleTimer;
|
|
939
936
|
refreshTimer;
|
|
@@ -951,19 +948,19 @@ class SessionManagerService {
|
|
|
951
948
|
LOGOUT_EVENT = 'APP_LOGOUT_EVENT';
|
|
952
949
|
ACTIVITY_EVENT = 'APP_ACTIVITY_EVENT';
|
|
953
950
|
TOKEN_REFRESH_EVENT = 'APP_TOKEN_REFRESH_EVENT';
|
|
954
|
-
tabId =
|
|
951
|
+
tabId = Date.now() + Math.random();
|
|
955
952
|
isLeader = false;
|
|
956
953
|
refreshLock = false;
|
|
957
954
|
channel = null;
|
|
958
955
|
/* -------------------------------- START -------------------------------- */
|
|
959
956
|
start() {
|
|
960
|
-
|
|
961
|
-
return;
|
|
962
|
-
console.log('SessionManagerService > start > IDLE_TIME:', SessionManagerService.IDLE_MIN);
|
|
957
|
+
console.log('SessionManagerService > start > IDLE_TIME: ' + SessionManagerService.IDLE_MIN + ' mins');
|
|
963
958
|
if ('BroadcastChannel' in window) {
|
|
964
959
|
this.channel = new BroadcastChannel('APP_SESSION');
|
|
965
960
|
this.listenChannel();
|
|
966
961
|
}
|
|
962
|
+
if (this.IDLE_TIME <= 0)
|
|
963
|
+
return;
|
|
967
964
|
this.listenActivity();
|
|
968
965
|
this.updateActivity();
|
|
969
966
|
this.resetIdle();
|
|
@@ -975,14 +972,14 @@ class SessionManagerService {
|
|
|
975
972
|
// clearInterval(this.heartbeatTimer);
|
|
976
973
|
// }
|
|
977
974
|
async login(username, password, orgid, returnUrl) {
|
|
978
|
-
var ret = await this.authService.
|
|
975
|
+
var ret = await this.authService._signIn(username, password, orgid, returnUrl);
|
|
979
976
|
if (ret) {
|
|
980
977
|
console.log('SessionManagerService > broadcast LOGIN');
|
|
981
978
|
this.broadcast(this.LOGIN_EVENT);
|
|
982
979
|
}
|
|
983
980
|
}
|
|
984
981
|
logout() {
|
|
985
|
-
this.authService.
|
|
982
|
+
this.authService._signOut();
|
|
986
983
|
this.broadcast(this.LOGOUT_EVENT);
|
|
987
984
|
}
|
|
988
985
|
/* -------------------------------- ACTIVITY -------------------------------- */
|
|
@@ -1006,12 +1003,12 @@ class SessionManagerService {
|
|
|
1006
1003
|
const last = Number(localStorage.getItem(this.ACTIVITY_KEY) || Date.now());
|
|
1007
1004
|
const remain = this.IDLE_TIME - (Date.now() - last);
|
|
1008
1005
|
if (remain <= 0) {
|
|
1009
|
-
this.authService.
|
|
1006
|
+
this.authService._signOut();
|
|
1010
1007
|
return;
|
|
1011
1008
|
}
|
|
1012
1009
|
this.zone.runOutsideAngular(() => {
|
|
1013
1010
|
this.idleTimer = setTimeout(() => {
|
|
1014
|
-
this.zone.run(() => this.authService.
|
|
1011
|
+
this.zone.run(() => this.authService._signOut());
|
|
1015
1012
|
}, remain);
|
|
1016
1013
|
});
|
|
1017
1014
|
}
|
|
@@ -1026,7 +1023,7 @@ class SessionManagerService {
|
|
|
1026
1023
|
}
|
|
1027
1024
|
becomeLeader() {
|
|
1028
1025
|
this.isLeader = true;
|
|
1029
|
-
localStorage.setItem(this.LEADER_KEY, this.tabId);
|
|
1026
|
+
localStorage.setItem(this.LEADER_KEY, '' + this.tabId);
|
|
1030
1027
|
this.startHeartbeat();
|
|
1031
1028
|
this.scheduleRefresh();
|
|
1032
1029
|
}
|
|
@@ -1084,6 +1081,7 @@ class SessionManagerService {
|
|
|
1084
1081
|
}
|
|
1085
1082
|
/* -------------------------------- CHANNEL -------------------------------- */
|
|
1086
1083
|
listenChannel() {
|
|
1084
|
+
console.log('SessionManagerService > listenChannel:', this.channel);
|
|
1087
1085
|
if (!this.channel)
|
|
1088
1086
|
return;
|
|
1089
1087
|
this.channel.onmessage = (msg) => {
|
|
@@ -1122,7 +1120,7 @@ class SessionManagerService {
|
|
|
1122
1120
|
const payload = token.split('.')[1];
|
|
1123
1121
|
return JSON.parse(atob(payload));
|
|
1124
1122
|
}
|
|
1125
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: SessionManagerService, deps: [
|
|
1123
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: SessionManagerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1126
1124
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: SessionManagerService, providedIn: 'root' });
|
|
1127
1125
|
}
|
|
1128
1126
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: SessionManagerService, decorators: [{
|
|
@@ -1130,7 +1128,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImpor
|
|
|
1130
1128
|
args: [{
|
|
1131
1129
|
providedIn: 'root',
|
|
1132
1130
|
}]
|
|
1133
|
-
}]
|
|
1131
|
+
}] });
|
|
1134
1132
|
|
|
1135
1133
|
class CustomModalService {
|
|
1136
1134
|
modal;
|
|
@@ -6089,7 +6087,6 @@ class VscService extends HTTPService {
|
|
|
6089
6087
|
this.checkVersion();
|
|
6090
6088
|
}
|
|
6091
6089
|
checkVersion(all = false) {
|
|
6092
|
-
console.log('Check version');
|
|
6093
6090
|
this.checkFrontendVersion();
|
|
6094
6091
|
if (all) {
|
|
6095
6092
|
this.checkBackendVersion();
|
|
@@ -6101,7 +6098,6 @@ class VscService extends HTTPService {
|
|
|
6101
6098
|
if (this.isShowingPopup) {
|
|
6102
6099
|
return;
|
|
6103
6100
|
}
|
|
6104
|
-
console.log('Check version');
|
|
6105
6101
|
console.log('current version: ', VscService.feClientVersion);
|
|
6106
6102
|
this.get(AppGlobals.versionCheck + '?t=' + new Date().getTime()).then(async (response) => {
|
|
6107
6103
|
VscService.feServerVersion = response.version;
|