Skip to content

Commit

Permalink
1097 session storage wasa changes
Browse files Browse the repository at this point in the history
  • Loading branch information
NKOKKILIGADDA87 committed Dec 13, 2024
1 parent c7bfc0a commit f7f67f5
Show file tree
Hide file tree
Showing 12 changed files with 248 additions and 110 deletions.
20 changes: 11 additions & 9 deletions src/app/dashboard-user-id/dashboardUserId.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { Subscription } from "rxjs/Subscription";
import { CallServices } from "app/services/callservices/callservice.service";
import { SetLanguageComponent } from "app/set-language.component";
import { HttpServices } from "app/services/http-services/http_services.service";
import { sessionStorageService } from "app/services/sessionStorageService/session-storage.service";

@Component({
selector: "dashboard-user-id",
Expand All @@ -45,6 +46,7 @@ export class DashboardUserIdComponent implements OnInit {
constructor(
public dataSettingService: dataService,
public router: Router,
private sessionstorage:sessionStorageService,
private callService: CallServices,
private Czentrix: CzentrixServices,
private message: ConfirmationDialogsService,
Expand Down Expand Up @@ -80,10 +82,10 @@ export class DashboardUserIdComponent implements OnInit {

if (
!this.dataSettingService.current_campaign &&
sessionStorage.getItem("current_campaign")
this.sessionstorage.getItem("current_campaign")
) {
this.dataSettingService.current_campaign =
sessionStorage.getItem("current_campaign");
this.sessionstorage.getItem("current_campaign");
}
if (res.data.dialer_type) {
if (res.data.dialer_type.toUpperCase() == "PROGRESSIVE") {
Expand Down Expand Up @@ -120,15 +122,15 @@ export class DashboardUserIdComponent implements OnInit {
.switchToOutbound(this.dataSettingService.cZentrixAgentID)
.subscribe(
(response) => {
sessionStorage.setItem("current_campaign", "OUTBOUND");
this.sessionstorage.setItem("current_campaign", "OUTBOUND");
this.callService.onceOutbound = true;
this.callService.onlyOutbound = false;
this.timerSubscription.unsubscribe();
console.log("outbound");
},
(err) => {
console.log("agent in not logged in");
sessionStorage.setItem("current_campaign", "OUTBOUND");
this.sessionstorage.setItem("current_campaign", "OUTBOUND");
}
);
}
Expand All @@ -146,10 +148,10 @@ export class DashboardUserIdComponent implements OnInit {
this.status.toUpperCase() === "INCALL" ||
this.status.toUpperCase() === "CLOSURE"
) {
if (!sessionStorage.getItem("session_id")) {
if (!this.sessionstorage.getItem("session_id")) {
this.routeToInnerPage(res);
} else if (
sessionStorage.getItem("session_id") !== res.session_id
this.sessionstorage.getItem("session_id") !== res.session_id
) {
// If session id is different from previous session id then allow the call to drop
this.routeToInnerPage(res);
Expand All @@ -176,9 +178,9 @@ export class DashboardUserIdComponent implements OnInit {
session_id !== "undefined" &&
session_id !== ""
) {
sessionStorage.setItem("isOnCall", "yes");
sessionStorage.setItem("CLI", CLI);
sessionStorage.setItem("session_id", session_id);
this.sessionstorage.setItem("isOnCall", "yes");
this.sessionstorage.setItem("CLI", CLI);
this.sessionstorage.setItem("session_id", session_id);
this.dataSettingService.setUniqueCallIDForInBound = true;
this.router.navigate([
"/MultiRoleScreenComponent/RedirectToInnerpageComponent",
Expand Down
74 changes: 38 additions & 36 deletions src/app/innerpage/innerpage.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { AuthService } from "../services/authentication/auth.service";
import { RegisterService } from "../services/register-services/register-service";
import { Subscription } from "rxjs/Subscription";
import { SetLanguageComponent } from "app/set-language.component";
import { sessionStorageService } from "app/services/sessionStorageService/session-storage.service";

declare const jQuery: any;

Expand Down Expand Up @@ -120,6 +121,7 @@ export class InnerpageComponent implements OnInit {
current_roleID: any;

constructor(
private sessionstorage:sessionStorageService,
public getCommonData: dataService,
private _callServices: CallServices,
public basicrouter: Router,
Expand Down Expand Up @@ -173,11 +175,11 @@ export class InnerpageComponent implements OnInit {
this.ctiHandlerURL = this.sanitizer.bypassSecurityTrustResourceUrl(url);
console.log("url = " + url);
this.ctiHandlerURL = this.sanitizer.bypassSecurityTrustResourceUrl(url);
if (sessionStorage.getItem("CLI") !== undefined) {
this.callerNumber = sessionStorage.getItem("CLI");
if (this.sessionstorage.getItem("CLI") !== undefined) {
this.callerNumber = this.sessionstorage.getItem("CLI");
}
if (sessionStorage.getItem("callCategory") !== undefined) {
if (sessionStorage.getItem("callCategory") === "OUTBOUND") {
if (this.sessionstorage.getItem("callCategory") !== undefined) {
if (this.sessionstorage.getItem("callCategory") === "OUTBOUND") {
this.getCommonData.isOutbound = true;
} else {
this.getCommonData.isOutbound = false;
Expand Down Expand Up @@ -219,7 +221,7 @@ export class InnerpageComponent implements OnInit {
// this.addListener();
this.getAgentStatus();
this.getAgentCallDetails();
this.isEverwell = sessionStorage.getItem("isEverwellCall");
this.isEverwell = this.sessionstorage.getItem("isEverwellCall");

this.fetchLanguageSet();
}
Expand Down Expand Up @@ -463,11 +465,11 @@ export class InnerpageComponent implements OnInit {
);
} else {
this.ipSuccessLogoutHandler(this.getCommonData.loginIP);
// sessionStorage.removeItem('isOnCall');
// sessionStorage.removeItem('isEverwellCall');
// this.sessionstorage.removeItem('isOnCall');
// this.sessionstorage.removeItem('isEverwellCall');
// this.basicrouter.navigate(['']);
// this.authService.removeToken();
// sessionStorage.removeItem("setLanguage");
// this.sessionstorage.removeItem("setLanguage");
// this.getCommonData.appLanguage="English";
}
}
Expand Down Expand Up @@ -497,20 +499,20 @@ export class InnerpageComponent implements OnInit {
if (this.current_role.toLowerCase() === "supervisor") {
this.Czentrix.userLogout().subscribe(
(response) => {
sessionStorage.removeItem("isOnCall");
sessionStorage.removeItem("isEverwellCall");
sessionStorage.removeItem("apiman_key");
sessionStorage.removeItem("setLanguage");
this.sessionstorage.removeItem("isOnCall");
this.sessionstorage.removeItem("isEverwellCall");
this.sessionstorage.removeItem("apiman_key");
this.sessionstorage.removeItem("setLanguage");
this.authService.removeToken();
this.getCommonData.appLanguage = "English";
this.basicrouter.navigate([""]);
// this.socketService.logOut();
},
(err) => {
sessionStorage.removeItem("isOnCall");
sessionStorage.removeItem("isEverwellCall");
sessionStorage.removeItem("apiman_key");
sessionStorage.removeItem("setLanguage");
this.sessionstorage.removeItem("isOnCall");
this.sessionstorage.removeItem("isEverwellCall");
this.sessionstorage.removeItem("apiman_key");
this.sessionstorage.removeItem("setLanguage");
this.authService.removeToken();
this.getCommonData.appLanguage = "English";
this.basicrouter.navigate([""]);
Expand All @@ -526,20 +528,20 @@ export class InnerpageComponent implements OnInit {
if (res.response.status.toUpperCase() !== "FAIL") {
this.Czentrix.userLogout().subscribe(
(response) => {
sessionStorage.removeItem("isOnCall");
sessionStorage.removeItem("isEverwellCall");
sessionStorage.removeItem("apiman_key");
sessionStorage.removeItem("setLanguage");
this.sessionstorage.removeItem("isOnCall");
this.sessionstorage.removeItem("isEverwellCall");
this.sessionstorage.removeItem("apiman_key");
this.sessionstorage.removeItem("setLanguage");
this.authService.removeToken();
this.getCommonData.appLanguage = "English";
this.basicrouter.navigate([""]);
// this.socketService.logOut();
},
(err) => {
sessionStorage.removeItem("isOnCall");
sessionStorage.removeItem("isEverwellCall");
sessionStorage.removeItem("apiman_key");
sessionStorage.removeItem("setLanguage");
this.sessionstorage.removeItem("isOnCall");
this.sessionstorage.removeItem("isEverwellCall");
this.sessionstorage.removeItem("apiman_key");
this.sessionstorage.removeItem("setLanguage");
this.getCommonData.appLanguage = "English";
this.authService.removeToken();
this.basicrouter.navigate([""]);
Expand All @@ -561,9 +563,9 @@ export class InnerpageComponent implements OnInit {
// if (this.current_role.toLowerCase() !== 'supervisor') {
// this.Czentrix.agentLogout(this.getCommonData.cZentrixAgentID, response).subscribe((res) => {
// if (res.response.status.toUpperCase() !== 'FAIL') {
// sessionStorage.removeItem('isOnCall');
// sessionStorage.removeItem('isEverwellCall');
// sessionStorage.removeItem("setLanguage");
// this.sessionstorage.removeItem('isOnCall');
// this.sessionstorage.removeItem('isEverwellCall');
// this.sessionstorage.removeItem("setLanguage");
// this.getCommonData.appLanguage="English";
// this.basicrouter.navigate(['']);
// } else {
Expand All @@ -575,9 +577,9 @@ export class InnerpageComponent implements OnInit {
// this.remarksMessage.alert(err.errorMessage);
// });
// } else {
// sessionStorage.removeItem('isOnCall');
// sessionStorage.removeItem('isEverwellCall');
// sessionStorage.removeItem("setLanguage");
// this.sessionstorage.removeItem('isOnCall');
// this.sessionstorage.removeItem('isEverwellCall');
// this.sessionstorage.removeItem("setLanguage");
// this.getCommonData.appLanguage="English";
// this.basicrouter.navigate(['']);
// }
Expand Down Expand Up @@ -798,13 +800,13 @@ export class InnerpageComponent implements OnInit {
requestObj["agentID"] = this.getCommonData.cZentrixAgentID;
requestObj["endCall"] = true;
}
if (sessionStorage.getItem("session_id") === this.custdisconnectCallID) {
if (this.sessionstorage.getItem("session_id") === this.custdisconnectCallID) {
this._callServices.closeCall(requestObj).subscribe(
(response) => {
if (response) {
this.remarksMessage.alert(message, "success");
sessionStorage.removeItem("isOnCall");
sessionStorage.removeItem("isEverwellCall");
this.sessionstorage.removeItem("isOnCall");
this.sessionstorage.removeItem("isEverwellCall");
this.basicrouter.navigate(["/MultiRoleScreenComponent/dashboard"]);
this._common.everwellCallNotConnected = null;
}
Expand Down Expand Up @@ -983,8 +985,8 @@ export class InnerpageComponent implements OnInit {
}

getLanguage() {
if (sessionStorage.getItem("setLanguage") != null) {
this.changeLanguage(sessionStorage.getItem("setLanguage"));
if (this.sessionstorage.getItem("setLanguage") != null) {
this.changeLanguage(this.sessionstorage.getItem("setLanguage"));
} else {
this.changeLanguage(this.app_language);
}
Expand Down Expand Up @@ -1014,7 +1016,7 @@ export class InnerpageComponent implements OnInit {
}
console.log("language is ", response);
this.currentLanguageSet = response[language];
sessionStorage.setItem("setLanguage", language);
this.sessionstorage.setItem("setLanguage", language);
if (this.currentLanguageSet) {
this.languageArray.forEach((item) => {
if (item.languageName === language) {
Expand Down
39 changes: 28 additions & 11 deletions src/app/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { Subscription } from 'rxjs';
import { InterceptedHttp } from 'app/http.interceptor';
// import { SHA256, enc } from 'crypto-js';
import * as CryptoJS from 'crypto-js';
import { sessionStorageService } from 'app/services/sessionStorageService/session-storage.service';
// import { AES } from 'crypto-js';
// import { SHA256 } from 'crypto-js';

Expand Down Expand Up @@ -69,7 +70,7 @@ export class loginContentClass implements OnInit, OnDestroy {
previlageObj: any = [];
encryptPassword: any;

constructor(public loginservice: loginService, public router: Router, public alertService: ConfirmationDialogsService,
constructor(public loginservice: loginService,private sessionstorage:sessionStorageService, public router: Router, public alertService: ConfirmationDialogsService,
public dataSettingService: dataService, private czentrixServices: CzentrixServices, private socketService: SocketService, private httpService: InterceptedHttp) {
this._keySize = 256;
this._ivSize = 128;
Expand All @@ -91,8 +92,8 @@ export class loginContentClass implements OnInit, OnDestroy {
this.dataSettingService.loginIP = response.loginIPAddress;
console.log('array' + this.previlageObj);
if (response.isAuthenticated === true && response.Status === 'Active') {
sessionStorage.removeItem('isOnCall');
sessionStorage.removeItem('isEverwellCall');
this.sessionstorage.removeItem('isOnCall');
this.sessionstorage.removeItem('isEverwellCall');
this.router.navigate(['/MultiRoleScreenComponent'], { skipLocationChange: true });
}
// } else {
Expand Down Expand Up @@ -134,8 +135,8 @@ export class loginContentClass implements OnInit, OnDestroy {
this.dataSettingService.loginIP = response.loginIPAddress;
console.log('array' + this.previlageObj);
if (response.isAuthenticated === true && response.Status === 'Active') {
sessionStorage.removeItem('isOnCall');
sessionStorage.removeItem('isEverwellCall');
this.sessionstorage.removeItem('isOnCall');
this.sessionstorage.removeItem('isEverwellCall');
this.router.navigate(['/MultiRoleScreenComponent'], { skipLocationChange: true });
}
// } else {
Expand Down Expand Up @@ -234,10 +235,15 @@ export class loginContentClass implements OnInit, OnDestroy {
// this.password = CryptoJS.SHA256(this.password).toString();
// this.encryptedVar=SHA256(this.password).toString(enc.Hex);
// this.password=this.encryptedVar.substr(0, 16);
this.loginservice
console.error("response");
this.loginservice
.authenticateUser(this.userID, this.encryptPassword, doLogOut)
.subscribe(
(response: any) => {
console.error("response",response);
let tkn = response.Jwttoken;
this.sessionstorage.setCookie('Jwttoken', tkn,1 );

if (
response !== undefined &&
response !== null &&
Expand All @@ -246,10 +252,18 @@ export class loginContentClass implements OnInit, OnDestroy {
) {
this.successCallback(response, this.userID, this.password);
}

},

(error: any) => this.errorCallback(error)
);

);




}


// login(doLogOut) {
// this.loginservice
Expand Down Expand Up @@ -280,6 +294,9 @@ export class loginContentClass implements OnInit, OnDestroy {
.authenticateUser(this.userID, this.encryptPassword, doLogOut)
.subscribe(
(response: any) => {
console.log("response.Jwttoken",response)
let tkn = response.Jwttoken;
this.sessionstorage.setCookie('Jwttoken', tkn,1 );
if (
response !== undefined &&
response !== null &&
Expand Down Expand Up @@ -328,17 +345,17 @@ export class loginContentClass implements OnInit, OnDestroy {
if (this.dataSettingService.current_serviceID === undefined) {
alert('ServiceID not found. Some things may not work');
}
sessionStorage.removeItem('isOnCall');
sessionStorage.removeItem('isEverwellCall');
this.sessionstorage.removeItem('isOnCall');
this.sessionstorage.removeItem('isEverwellCall');
sessionStorage.setItem('authToken', response.key);
this.router.navigate(['/MultiRoleScreenComponent'], { skipLocationChange: true });
// this.socketService.reInstantiate();

}
if (response.isAuthenticated === true && response.Status === 'New') {
sessionStorage.setItem('authToken', response.key);
sessionStorage.removeItem('isOnCall');
sessionStorage.removeItem('isEverwellCall');
this.sessionstorage.removeItem('isOnCall');
this.sessionstorage.removeItem('isEverwellCall');
this.router.navigate(['/setQuestions']);
}
// } else {
Expand Down
Loading

0 comments on commit f7f67f5

Please sign in to comment.