Skip to content

Commit

Permalink
fixing the resetting
Browse files Browse the repository at this point in the history
  • Loading branch information
mithunj committed Dec 17, 2024
1 parent b077c23 commit 1c64fd0
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions chat-widget/src/components/livechatwidget/common/startChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,17 +338,11 @@ const checkIfConversationStillValid = async (chatSDK: any, dispatch: Dispatch<IL
chatSDK.requestId = requestIdFromCache;
conversationDetails = await getConversationDetailsCall(chatSDK, liveChatContext);

if (Object.keys(conversationDetails).length === 0) {
return false;
}

if (conversationDetails.state === LiveWorkItemState.Closed || conversationDetails.state === LiveWorkItemState.WrapUp) {
if (Object.keys(conversationDetails).length === 0 || conversationDetails.state === LiveWorkItemState.Closed || conversationDetails.state === LiveWorkItemState.WrapUp) {
dispatch({ type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT, payload: undefined });
// reset the requestId to current initial requestId in sdk
if (state?.domainStates?.initialChatSdkRequestId) {
chatSDK.requestId = state?.domainStates?.initialChatSdkRequestId;
if (currentRequestId) {
chatSDK.requestId = currentRequestId;
}

return false;
}
return true;
Expand All @@ -364,6 +358,10 @@ const checkIfConversationStillValid = async (chatSDK: any, dispatch: Dispatch<IL
}
};

const resetChatState = (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, state: ILiveChatWidgetContext) => {

Check warning on line 361 in chat-widget/src/components/livechatwidget/common/startChat.ts

View workflow job for this annotation

GitHub Actions / build

'resetChatState' is assigned a value but never used

Check warning on line 361 in chat-widget/src/components/livechatwidget/common/startChat.ts

View workflow job for this annotation

GitHub Actions / build

'chatSDK' is defined but never used

Check warning on line 361 in chat-widget/src/components/livechatwidget/common/startChat.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type

Check warning on line 361 in chat-widget/src/components/livechatwidget/common/startChat.ts

View workflow job for this annotation

GitHub Actions / build

'dispatch' is defined but never used

Check warning on line 361 in chat-widget/src/components/livechatwidget/common/startChat.ts

View workflow job for this annotation

GitHub Actions / build

'state' is defined but never used

Check failure on line 361 in chat-widget/src/components/livechatwidget/common/startChat.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected empty arrow function

}

Check failure on line 363 in chat-widget/src/components/livechatwidget/common/startChat.ts

View workflow job for this annotation

GitHub Actions / build

Missing semicolon

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const getInitContextParamsForPopout = async (): Promise<any> => {
return window.opener ? await getInitContextParamForPopoutFromOuterScope(window.opener) : null;
Expand Down

0 comments on commit 1c64fd0

Please sign in to comment.