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

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 (2) hide show
  1. package/README.md +85 -6
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/%40microsoft%2Fomnichannel-chat-sdk.svg)](https://badge.fury.io/js/%40microsoft%2Fomnichannel-chat-sdk)
4
4
  [![install size](https://packagephobia.com/badge?p=@microsoft/omnichannel-chat-sdk)](https://packagephobia.com/result?p=@microsoft/omnichannel-chat-sdk)
5
- ![Release CI](https://github.com/microsoft/omnichannel-chat-sdk/workflows/Release%20CI/badge.svg)
5
+ [![npm Release](https://github.com/microsoft/omnichannel-chat-sdk/actions/workflows/npm-release.yml/badge.svg)](https://github.com/microsoft/omnichannel-chat-sdk/actions/workflows/npm-release.yml)
6
6
  ![npm](https://img.shields.io/npm/dm/@microsoft/omnichannel-chat-sdk)
7
7
 
8
8
  > [!IMPORTANT]
@@ -22,6 +22,7 @@ Please make sure you have a chat widget configured before using this package or
22
22
  - [SDK Methods](#sdk-methods)
23
23
  - [Initialization](#initialization)
24
24
  - [Start Chat](#start-chat)
25
+ - [Authenticate Chat](#authenticate-chat)
25
26
  - [End Chat](#end-chat)
26
27
  - [Get Pre-Chat Survey](#get-pre-chat-survey)
27
28
  - [Get Live Chat Config](#get-live-chat-config)
@@ -34,6 +35,7 @@ Please make sure you have a chat widget configured before using this package or
34
35
  - [Get Messages](#get-messages)
35
36
  - [Send Messages](#send-messages)
36
37
  - [On New Message](#on-new-message)
38
+ - [On Streaming Message](#on-streaming-message)
37
39
  - [On Typing Event](#on-typing-event)
38
40
  - [On Agent End Session](#on-agent-end-session)
39
41
  - [Send Typing Event](#send-typing-event)
@@ -112,18 +114,35 @@ For a detailed tracking of the releases, please refer to the [Changelog document
112
114
 
113
115
  _**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.
114
116
 
115
-
116
117
  | Version | Docs | Release Date | End of Support | Deprecated |
117
118
  | -- | -- | -- | -- | -- |
119
+ | 2.0.0 | [Migration Guide](docs/MIGRATION_2.0.md) / [Release Notes](https://github.com/microsoft/omnichannel-chat-sdk/releases/tag/v2.0.0) | Aug 13th 2026 | Aug 13th 2027 | |
118
120
  | 1.11.4 | [Release Notes](https://github.com/microsoft/omnichannel-chat-sdk/releases/tag/v1.11.4) | Jul 17th 2025 | Jul 17th 2026 | |
119
121
  | 1.11.3 | [Release Notes](https://github.com/microsoft/omnichannel-chat-sdk/releases/tag/v1.11.3) | Jul 14th 2025 | Jul 14th 2026 | |
120
122
  | 1.11.2 | [Release Notes](https://github.com/microsoft/omnichannel-chat-sdk/releases/tag/v1.11.2) | Jun 24th 2025 | Jun 24th 2026 | |
121
123
  | 1.11.1 | [Release Notes](https://github.com/microsoft/omnichannel-chat-sdk/releases/tag/v1.11.1) | Jun 5th 2025 | Jun 5th 2026 | |
122
124
  | 1.11.0 | [Release Notes](https://github.com/microsoft/omnichannel-chat-sdk/releases/tag/v1.11.0) | May 27th 2025 | May 27th 2026 | |
123
125
 
126
+ ### Upgrade to 2.0.0
127
+
128
+ Version `2.0.0` requires Node.js `>=22.12.0`. This requirement also applies to the official OC SDK and AMS client dependencies.
129
+
130
+ ```bash
131
+ npm install @microsoft/omnichannel-chat-sdk@2.0.0 --save-exact
132
+ ```
133
+
134
+ The npm `latest` dist-tag can point to a `main` prerelease. Use the exact version for production.
135
+
136
+ Regenerate the application lockfile after the update. Then run the application build and tests on Node.js 22.
137
+
138
+ Version `2.0.0` adds progressive bot-message streaming, mid-conversation authentication, read receipts, and unread-message counts. Existing `onNewMessage` handlers continue to receive final streaming messages.
139
+
140
+ See the [2.0 migration guide](docs/MIGRATION_2.0.md) for the complete upgrade and validation procedure.
124
141
 
125
142
  ## Installation
126
143
 
144
+ Node.js `>=22.12.0` is required.
145
+
127
146
  ```console
128
147
  npm install @microsoft/omnichannel-chat-sdk --save
129
148
  ```
@@ -312,6 +331,32 @@ const optionalParams = {
312
331
  await chatSDK.startChat(optionalParams);
313
332
  ```
314
333
 
334
+ ### Authenticate Chat
335
+
336
+ It authenticates an active unauthenticated conversation. Enable optional authenticated sign-in for the workstream before you use this method.
337
+
338
+ Call `initialize()` and `startChat()` before `authenticateChat()`. The first argument can be a token or an asynchronous token provider.
339
+
340
+ ```ts
341
+ await chatSDK.initialize();
342
+ await chatSDK.startChat();
343
+
344
+ await chatSDK.authenticateChat(async () => {
345
+ const response = await fetch("https://contoso.example/token");
346
+ if (!response.ok) {
347
+ throw new Error("Token request failed");
348
+ }
349
+
350
+ return response.text();
351
+ }, {
352
+ refreshChatToken: true
353
+ });
354
+ ```
355
+
356
+ Set `refreshChatToken` to `true` when subsequent SDK calls must use a refreshed authenticated chat token.
357
+
358
+ The method throws `InvalidConversation` when no conversation is active. It throws `MidConversationAuthFailure` when token resolution or authentication fails.
359
+
315
360
  ### End Chat
316
361
 
317
362
  It ends the current Omnichannel conversation.
@@ -456,6 +501,38 @@ chatSDK.onNewMessage((message) => {
456
501
  }, optionalParams);
457
502
  ```
458
503
 
504
+ ### On Streaming Message
505
+
506
+ It subscribes to progressive ACS bot-message updates. This API is available only for Live Chat version 2.
507
+
508
+ Enable streaming when you start the conversation. Then register the handler after `startChat()` completes.
509
+
510
+ ```ts
511
+ await chatSDK.initialize();
512
+ await chatSDK.startChat({
513
+ supportsLcwStreaming: true
514
+ });
515
+
516
+ await chatSDK.onStreamingMessage((message) => {
517
+ const { streamingMessageType, streamEndReason } = message.streamingMetadata;
518
+
519
+ // Each event contains the full assembled content, not only the new text.
520
+ renderStreamingMessage(message.id, message.content);
521
+
522
+ if (message.policyViolation) {
523
+ handlePolicyViolation(message.policyViolation.result);
524
+ }
525
+
526
+ if (streamingMessageType === "final") {
527
+ completeStreamingMessage(message.id, streamEndReason);
528
+ }
529
+ });
530
+ ```
531
+
532
+ `streamingMessageType` can be `start`, `informative`, `streaming`, or `final`. A final message also reaches existing `onNewMessage` handlers.
533
+
534
+ Calling this method before `startChat()` throws `UninitializedConversation`. Calling it for another Live Chat version throws `UnsupportedLiveChatVersion`.
535
+
459
536
  ### On Typing Event
460
537
 
461
538
  It subscribes to an agent typing event.
@@ -613,13 +690,15 @@ const agentAvailability = await chatSDK.getAgentAvailability();
613
690
 
614
691
  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
692
 
693
+ Authenticated chat sends the receipt through Messaging Runtime. Unauthenticated chat sends it through ACS and requires Live Chat version 2.
694
+
616
695
  ```ts
617
696
  await chatSDK.sendReadReceipt(messageId: string);
618
697
  ```
619
698
 
620
699
  ### Get Unread Message Count
621
700
 
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.
701
+ Returns unread-message data for an authenticated user. An active chat session is not required. This call is **authenticated-only** — the user must be authenticated, otherwise an `UndefinedAuthToken` error is thrown.
623
702
 
624
703
  ```ts
625
704
  const response = await chatSDK.getUnreadMessageCount();
@@ -1323,11 +1402,11 @@ const chatSDK = new OmnichannelChatSDK.OmnichannelChatSDK(omnichannelConfig, cha
1323
1402
  await chatSDK.initialize();
1324
1403
  ```
1325
1404
 
1326
- # Releasing
1405
+ ## Releasing
1327
1406
 
1328
- See [docs/RELEASING.md](docs/RELEASING.md) for how to publish new versions to npm.
1407
+ See [docs/RELEASING.md](docs/RELEASING.md) for development builds, official npm and GitHub releases, release notes, and hotfixes.
1329
1408
 
1330
- # Contributing
1409
+ ## Contributing
1331
1410
 
1332
1411
  This project welcomes contributions and suggestions. Most contributions require you to agree to a
1333
1412
  Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-sdk",
3
- "version": "2.0.0-main.b82e941",
3
+ "version": "2.0.0",
4
4
  "description": "Microsoft Omnichannel Chat SDK",
5
5
  "files": [
6
6
  "lib/**/*"
@@ -52,8 +52,8 @@
52
52
  "@azure/communication-chat": "1.6.0-beta.7",
53
53
  "@azure/communication-common": "2.4.2",
54
54
  "@microsoft/botframework-webchat-adapter-azure-communication-chat": "0.0.1-beta.8",
55
- "@microsoft/ocsdk": "0.6.0-main.dcb2d46",
56
- "@microsoft/omnichannel-amsclient": "0.2.0-main.3e03701",
55
+ "@microsoft/ocsdk": "0.6.0",
56
+ "@microsoft/omnichannel-amsclient": "0.2.0",
57
57
  "@microsoft/omnichannel-ic3core": "^0.1.5"
58
58
  },
59
59
  "overrides": {