File: //proc/self/root/home/arjun/projects/buyercall/buyercall/assets/vue/widgets/CommWidget/utils.js
export const getChatSessionId = () => {
// Check if local storage have chat sessionid
if (!localStorage.getItem('bc_chat_session_id')) {
return null;
}
//check if local storage have chat session timestamp
if (!localStorage.getItem('bc_chat_session_timeout')) {
return null;
}
//check if the timestamp is a valid timestamp
if (!new Date(timestamp).getTime() > 0) {
return null;
}
// check if chat session have not expired
if (new Date(timestamp).getTime() - new Date().getTime() < 0) {
localStorage.removeItem('bc_chat_session_id');
localStorage.removeItem('bc_chat_session_timeout');
return null;
}
return localStorage.getItem('bc_chat_session_id');
};