@microsoft/omnichannel-chat-sdk 1.10.5-main.fbe1b61 → 1.10.6-main.348dce2
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/README.md +24 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -53,6 +53,7 @@ Please make sure you have a chat widget configured before using this package or
|
|
53
53
|
- [Persistent Chat](#persistent-chat)
|
54
54
|
- [Chat Reconnect with Authenticated User](#chat-reconnect-with-authenticated-user)
|
55
55
|
- [Chat Reconnect with Unauthenticated User](#chat-reconnect-with-unauthenticated-user)
|
56
|
+
- [Handling chat Disconnect on Mobile platform](#handling-chat-disconnect-on-mobile-platform)
|
56
57
|
- [Operating Hours](#operating-hours)
|
57
58
|
- [Single Sign-on for Bots](/docs/scenarios/SINGLE_SIGN_ON_FOR_BOTS.md)
|
58
59
|
- [Sample Apps](https://github.com/microsoft/omnichannel-chat-sdk-samples)
|
@@ -774,6 +775,29 @@ if (outOfOperatingHours === "True") {
|
|
774
775
|
}
|
775
776
|
```
|
776
777
|
|
778
|
+
### Handling chat Disconnect on Mobile platform
|
779
|
+
|
780
|
+
> On mobile platforms, where users often switch the app between foreground and background, it is important to verify if the chat is still active before allowing the user to send a message after returning from the background .
|
781
|
+
|
782
|
+
```ts
|
783
|
+
// 1. Register a listener for visbilitychange event
|
784
|
+
window.addEventListener("visibilitychange", async () => {
|
785
|
+
// 2. verify if the browser is in the foreground by checking the document.hidden property
|
786
|
+
if (!document.hidden) {
|
787
|
+
//3. Check conversation state by making a call to getConversationDetails
|
788
|
+
const optionalParams = {
|
789
|
+
liveChatContext: {}, // EXISTING chat context data
|
790
|
+
};
|
791
|
+
const conversationDetails = await chatSDK.getConversationDetails(optionalParams);
|
792
|
+
if (conversationDetails?.state === "WrapUp" || conversationDetails?.state === "Closed") {
|
793
|
+
//4. Show disconnect notification to customer and disable the input box so that user cannot send a message
|
794
|
+
}
|
795
|
+
|
796
|
+
}
|
797
|
+
});
|
798
|
+
```
|
799
|
+
|
800
|
+
|
777
801
|
### Using [BotFramework-WebChat](https://github.com/microsoft/BotFramework-WebChat)
|
778
802
|
> :warning: Currently supported on web only
|
779
803
|
|