@microsoft/omnichannel-chat-sdk 1.11.9-main.e5288e0 → 2.0.0-main.b82e941

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.
Files changed (55) hide show
  1. package/README.md +27 -6
  2. package/lib/OmnichannelChatSDK.d.ts +38 -0
  3. package/lib/OmnichannelChatSDK.js +273 -39
  4. package/lib/OmnichannelChatSDK.js.map +1 -1
  5. package/lib/config/settings.d.ts +2 -2
  6. package/lib/config/settings.js +2 -2
  7. package/lib/config/settings.js.map +1 -1
  8. package/lib/core/ChatSDKError.d.ts +11 -1
  9. package/lib/core/ChatSDKError.js +10 -0
  10. package/lib/core/ChatSDKError.js.map +1 -1
  11. package/lib/core/ChatSDKExceptionDetails.d.ts +6 -0
  12. package/lib/core/StartChatOptionalParams.d.ts +10 -0
  13. package/lib/core/messaging/ACSClient.d.ts +7 -0
  14. package/lib/core/messaging/ACSClient.js +216 -12
  15. package/lib/core/messaging/ACSClient.js.map +1 -1
  16. package/lib/core/messaging/OmnichannelStreamingMessage.d.ts +13 -0
  17. package/lib/core/messaging/OmnichannelStreamingMessage.js +3 -0
  18. package/lib/core/messaging/OmnichannelStreamingMessage.js.map +1 -0
  19. package/lib/core/messaging/OnStreamingMessageOptionalParams.d.ts +8 -0
  20. package/lib/core/messaging/OnStreamingMessageOptionalParams.js +3 -0
  21. package/lib/core/messaging/OnStreamingMessageOptionalParams.js.map +1 -0
  22. package/lib/core/messaging/PolicyViolation.d.ts +8 -0
  23. package/lib/core/messaging/PolicyViolation.js +3 -0
  24. package/lib/core/messaging/PolicyViolation.js.map +1 -0
  25. package/lib/core/messaging/StreamingMetadata.d.ts +11 -0
  26. package/lib/core/messaging/StreamingMetadata.js +3 -0
  27. package/lib/core/messaging/StreamingMetadata.js.map +1 -0
  28. package/lib/index.d.ts +5 -1
  29. package/lib/index.js.map +1 -1
  30. package/lib/telemetry/MessageSource.d.ts +1 -0
  31. package/lib/telemetry/MessageSource.js +1 -0
  32. package/lib/telemetry/MessageSource.js.map +1 -1
  33. package/lib/telemetry/TelemetryEvent.d.ts +23 -1
  34. package/lib/telemetry/TelemetryEvent.js +23 -0
  35. package/lib/telemetry/TelemetryEvent.js.map +1 -1
  36. package/lib/tsconfig.tsbuildinfo +1 -1
  37. package/lib/utils/createOmnichannelMessage.js +27 -1
  38. package/lib/utils/createOmnichannelMessage.js.map +1 -1
  39. package/lib/utils/createOmnichannelStreamingMessage.d.ts +14 -0
  40. package/lib/utils/createOmnichannelStreamingMessage.js +106 -0
  41. package/lib/utils/createOmnichannelStreamingMessage.js.map +1 -0
  42. package/lib/utils/errorClassifier.d.ts +25 -0
  43. package/lib/utils/errorClassifier.js +75 -0
  44. package/lib/utils/errorClassifier.js.map +1 -0
  45. package/lib/utils/exceptionThrowers.d.ts +38 -4
  46. package/lib/utils/exceptionThrowers.js +25 -8
  47. package/lib/utils/exceptionThrowers.js.map +1 -1
  48. package/lib/utils/printers/MessagePrinterFactory.d.ts +3 -2
  49. package/lib/utils/printers/MessagePrinterFactory.js +6 -0
  50. package/lib/utils/printers/MessagePrinterFactory.js.map +1 -1
  51. package/lib/utils/printers/StreamingMessagePrinter.d.ts +5 -0
  52. package/lib/utils/printers/StreamingMessagePrinter.js +33 -0
  53. package/lib/utils/printers/StreamingMessagePrinter.js.map +1 -0
  54. package/lib/utils/printers/types/MessageType.d.ts +2 -1
  55. package/package.json +14 -8
package/README.md CHANGED
@@ -5,9 +5,9 @@
5
5
  ![Release CI](https://github.com/microsoft/omnichannel-chat-sdk/workflows/Release%20CI/badge.svg)
6
6
  ![npm](https://img.shields.io/npm/dm/@microsoft/omnichannel-chat-sdk)
7
7
 
8
- > ❗ We recommend using official release versions in production as listed [here](#releases). Support will be provided only on official versions.
9
-
10
- > 📢 Try out our new React component library [omnichannel-chat-widget](https://github.com/microsoft/omnichannel-chat-widget) with Chat SDK
8
+ > [!IMPORTANT]
9
+ > * We recommend using official release versions in production as listed [here](#releases). Support will be provided only on official versions.
10
+ > * Microsoft provides this SDK to ensure a scaleable and secure use of our platform. Do not directly access the APIs used in this repository — you may experience breaking changes, and we will not be able to provide support for any issues.
11
11
 
12
12
  Headless Chat SDK to build your own chat widget against Dynamics 365 Omnichannel Services.
13
13
 
@@ -45,6 +45,8 @@ Please make sure you have a chat widget configured before using this package or
45
45
  - [Get Voice & Video Calling](#get-voice--video-calling)
46
46
  - [Get Post Chat Survey Context](#get-post-chat-survey-context)
47
47
  - [Get Persistent Chat History](#get-persistent-chat-history)
48
+ - [Send Read Receipt](#send-read-receipt)
49
+ - [Get Unread Message Count](#get-unread-message-count)
48
50
  - [Common Scenarios](#common-scenarios)
49
51
  - [Using BotFramework-WebChat](#using-botframework-webchat)
50
52
  - [Escalation to Voice & Video](#escalation-to-voice--video)
@@ -56,7 +58,7 @@ Please make sure you have a chat widget configured before using this package or
56
58
  - [Persistent Chat History](#persistent-chat-history)
57
59
  - [Chat Reconnect with Authenticated User](#chat-reconnect-with-authenticated-user)
58
60
  - [Chat Reconnect with Unauthenticated User](#chat-reconnect-with-unauthenticated-user)
59
- - [Best Practices for Chat Session Management: Handling Disconnections and Network Instabilit(#best-practices-for-chat-session-management:-handling-disconnections-and-network-instability)
61
+ - [Best Practices for Chat Session Management: Handling Disconnections and Network Instability](#best-practices-for-chat-session-management-handling-disconnections-and-network-instability)
60
62
  - [Operating Hours](#operating-hours)
61
63
  - [Single Sign-on for Bots](/docs/scenarios/SINGLE_SIGN_ON_FOR_BOTS.md)
62
64
  - [Sample Apps](https://github.com/microsoft/omnichannel-chat-sdk-samples)
@@ -106,9 +108,9 @@ Omnichannel offers a live chat widget (LCW) by default. You can use the Chat SDK
106
108
 
107
109
  New releases are published on a regular basis to ensure the product quality.
108
110
 
109
- for a detailed tracking of the releases, please refer to the [Changelog document](https://github.com/microsoft/omnichannel-chat-sdk/blob/main/CHANGELOG.md)
111
+ For a detailed tracking of the releases, please refer to the [Changelog document](https://github.com/microsoft/omnichannel-chat-sdk/blob/main/CHANGELOG.md)
110
112
 
111
- _**Important Note:**_ Versions below 1.11.0 will not be supported after November 1st, 2025. Please update to recent versions to ensure you have the latest features and bug fixes.
113
+ _**Important Note:**_ Versions below 1.11.0 are no longer supported after November 1st, 2025. Please update to recent versions to ensure you have the latest features and bug fixes.
112
114
 
113
115
 
114
116
  | Version | Docs | Release Date | End of Support | Deprecated |
@@ -607,6 +609,25 @@ It gets information on whether a queue is available, and whether there are agent
607
609
  const agentAvailability = await chatSDK.getAgentAvailability();
608
610
  ```
609
611
 
612
+ ### Send Read Receipt
613
+
614
+ Logs a particular message (and all previous messages) as read by the user. Read indicators will appear for Contact Center Representatives and Admins in the Admin Center.
615
+
616
+ ```ts
617
+ await chatSDK.sendReadReceipt(messageId: string);
618
+ ```
619
+
620
+ ### Get Unread Message Count
621
+
622
+ Returns the number of unread messages in an authenticated persistent conversation. This call is **authenticated-only** — the user must be authenticated, otherwise an `UndefinedAuthToken` error is thrown.
623
+
624
+ ```ts
625
+ const response = await chatSDK.getUnreadMessageCount();
626
+
627
+ // response.unreadMessageCount: number — Number of unread messages in the conversation
628
+ // response.mostRecentUnreadMessage: object | null — The most recent unread message, or null if there are none
629
+ ```
630
+
610
631
  ## Common Scenarios
611
632
 
612
633
  ### Pre-Chat Survey
@@ -30,7 +30,9 @@ import InitializeOptionalParams from "./core/InitializeOptionalParams";
30
30
  import LiveWorkItemDetails from "./core/LiveWorkItemDetails";
31
31
  import OmnichannelConfig from "./core/OmnichannelConfig";
32
32
  import OmnichannelMessage from "./core/messaging/OmnichannelMessage";
33
+ import OmnichannelStreamingMessage from "./core/messaging/OmnichannelStreamingMessage";
33
34
  import OnNewMessageOptionalParams from "./core/messaging/OnNewMessageOptionalParams";
35
+ import OnStreamingMessageOptionalParams from "./core/messaging/OnStreamingMessageOptionalParams";
34
36
  import PostChatContext from "./core/PostChatContext";
35
37
  import StartChatOptionalParams from "./core/StartChatOptionalParams";
36
38
  declare class OmnichannelChatSDK {
@@ -171,7 +173,36 @@ declare class OmnichannelChatSDK {
171
173
  sendMessage(message: ChatSDKMessage): Promise<OmnichannelMessage | void>;
172
174
  onNewMessage(onNewMessageCallback: CallableFunction, optionalParams?: OnNewMessageOptionalParams): Promise<void>;
173
175
  sendTypingEvent(): Promise<void>;
176
+ /**
177
+ * Fetches unread message count for the authenticated user.
178
+ * Auth-only — does not require an active chat session.
179
+ */
180
+ getUnreadMessageCount(): Promise<object>;
181
+ /**
182
+ * Sends a read receipt for a specific message.
183
+ * Authenticated: calls MRT (updates NRD + forwards to ACS).
184
+ * Unauthenticated: calls ACS directly.
185
+ */
186
+ sendReadReceipt(messageId: string): Promise<void>;
174
187
  onTypingEvent(onTypingEventCallback: CallableFunction): Promise<void>;
188
+ /**
189
+ * Subscribes to ACS-driven streaming message chunks for progressive bot message rendering.
190
+ * Each chunk contains the full assembled text so far (not just the delta).
191
+ * Existing onNewMessage consumers continue receiving final messages without changes.
192
+ *
193
+ * Available only in LiveChatVersion.V2. Must call startChat() before registering.
194
+ *
195
+ * @param onStreamingMessageCallback - Called for each streaming chunk
196
+ * @param optionalParams - Reserved for future configuration
197
+ * @example
198
+ * chatSDK.onStreamingMessage((message) => {
199
+ * switch (message.streamingMetadata.streamingMessageType) {
200
+ * case "streaming": // Update bubble with message.content
201
+ * case "final": // Stream complete
202
+ * }
203
+ * });
204
+ */
205
+ onStreamingMessage(onStreamingMessageCallback: (message: OmnichannelStreamingMessage) => void, optionalParams?: OnStreamingMessageOptionalParams): Promise<void>;
175
206
  onAgentEndSession(onAgentEndSessionCallback: (message: IRawThread | ParticipantsRemovedEvent) => void): Promise<void>;
176
207
  uploadFileAttachment(fileInfo: IFileInfo | File): Promise<UploadFileAttachmentResponse>;
177
208
  downloadFileAttachment(fileMetadata: FileMetadata | IFileMetadata): Promise<Blob>;
@@ -198,6 +229,13 @@ declare class OmnichannelChatSDK {
198
229
  private setCallingOptionConfiguration;
199
230
  private setLiveChatVersionConfiguration;
200
231
  private setWidgetSnippetBaseUrl;
232
+ /**
233
+ * Creates diagnostic data for getChatConfig errors using the error classifier
234
+ * @param e The error object
235
+ * @param clientElapsedMs Optional elapsed time in milliseconds from client's perspective
236
+ * @returns Diagnostic data with clientElapsedMs, online status, and cancellation reason
237
+ */
238
+ private createGetChatConfigDiagnosticData;
201
239
  private getChatConfig;
202
240
  private buildConfigurations;
203
241
  private resolveIC3ClientUrl;