@microsoft/omnichannel-chat-sdk 1.10.16-main.e4f7671 → 1.10.17-main.243dcc1

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 CHANGED
@@ -14,48 +14,49 @@ Headless Chat SDK to build your own chat widget against Dynamics 365 Omnichannel
14
14
  Please make sure you have a chat widget configured before using this package or you can follow this [link](https://docs.microsoft.com/en-us/dynamics365/customer-service/add-chat-widget)
15
15
 
16
16
  ## Table of Contents
17
+
17
18
  - [Live Chat Widget vs. Chat SDK](#live-chat-widget-vs-chat-sdk)
18
19
  - [Releases](#releases)
19
20
  - [Installation](#installation)
20
21
  - [Installation on React Native](#installation-on-react-native)
21
22
  - [SDK Methods](#sdk-methods)
22
- - [Initialization](#initialization)
23
- - [Start Chat](#start-chat)
24
- - [End Chat](#end-chat)
25
- - [Get Pre-Chat Survey](#get-pre-chat-survey)
26
- - [Get Live Chat Config](#get-live-chat-config)
27
- - [Get Current Live Chat Context](#get-current-live-chat-context)
28
- - [Get Data Masking Rules](#get-data-masking-rules)
29
- - [Get Chat Reconnect Context](#get-chat-reconnect-context)
30
- - [Get Conversation Details](#get-conversation-details)
31
- - [Get Chat Token](#get-chat-token)
32
- - [Get Calling Token](#get-calling-token)
33
- - [Get Messages](#get-messages)
34
- - [Send Messages](#send-messages)
35
- - [On New Message](#on-new-message)
36
- - [On Typing Event](#on-typing-event)
37
- - [On Agent End Session](#on-agent-end-session)
38
- - [Send Typing Event](#send-typing-event)
39
- - [Email Live Chat Transcript](#email-live-chat-transcript)
40
- - [Get Live Chat Transcript](#get-live-chat-transcript)
41
- - [Upload File Attachment](#upload-file-attachment)
42
- - [Download File Attachment](#download-file-attachment)
43
- - [Create Chat Adapter](#create-chat-adapter)
44
- - [Get Voice & Video Calling](#get-voice--video-calling)
45
- - [Get Post Chat Survey Context](#get-post-chat-survey-context)
23
+ - [Initialization](#initialization)
24
+ - [Start Chat](#start-chat)
25
+ - [End Chat](#end-chat)
26
+ - [Get Pre-Chat Survey](#get-pre-chat-survey)
27
+ - [Get Live Chat Config](#get-live-chat-config)
28
+ - [Get Current Live Chat Context](#get-current-live-chat-context)
29
+ - [Get Data Masking Rules](#get-data-masking-rules)
30
+ - [Get Chat Reconnect Context](#get-chat-reconnect-context)
31
+ - [Get Conversation Details](#get-conversation-details)
32
+ - [Get Chat Token](#get-chat-token)
33
+ - [Get Calling Token](#get-calling-token)
34
+ - [Get Messages](#get-messages)
35
+ - [Send Messages](#send-messages)
36
+ - [On New Message](#on-new-message)
37
+ - [On Typing Event](#on-typing-event)
38
+ - [On Agent End Session](#on-agent-end-session)
39
+ - [Send Typing Event](#send-typing-event)
40
+ - [Email Live Chat Transcript](#email-live-chat-transcript)
41
+ - [Get Live Chat Transcript](#get-live-chat-transcript)
42
+ - [Upload File Attachment](#upload-file-attachment)
43
+ - [Download File Attachment](#download-file-attachment)
44
+ - [Create Chat Adapter](#create-chat-adapter)
45
+ - [Get Voice & Video Calling](#get-voice--video-calling)
46
+ - [Get Post Chat Survey Context](#get-post-chat-survey-context)
46
47
  - [Common Scenarios](#common-scenarios)
47
- - [Using BotFramework-WebChat](#using-botframework-webchat)
48
- - [Escalation to Voice & Video](#escalation-to-voice--video)
49
- - [Pre-Chat Survey](#pre-chat-survey)
50
- - [Post-Chat Survey](#post-chat-survey)
51
- - [Reconnect to existing Chat](#reconnect-to-existing-chat)
52
- - [Authenticated Chat](#authenticated-chat)
53
- - [Persistent Chat](#persistent-chat)
54
- - [Chat Reconnect with Authenticated User](#chat-reconnect-with-authenticated-user)
55
- - [Chat Reconnect with Unauthenticated User](#chat-reconnect-with-unauthenticated-user)
56
- - [Handling chat Disconnect on Mobile platform](#handling-chat-disconnect-on-mobile-platform)
57
- - [Operating Hours](#operating-hours)
58
- - [Single Sign-on for Bots](/docs/scenarios/SINGLE_SIGN_ON_FOR_BOTS.md)
48
+ - [Using BotFramework-WebChat](#using-botframework-webchat)
49
+ - [Escalation to Voice & Video](#escalation-to-voice--video)
50
+ - [Pre-Chat Survey](#pre-chat-survey)
51
+ - [Post-Chat Survey](#post-chat-survey)
52
+ - [Reconnect to existing Chat](#reconnect-to-existing-chat)
53
+ - [Authenticated Chat](#authenticated-chat)
54
+ - [Persistent Chat](#persistent-chat)
55
+ - [Chat Reconnect with Authenticated User](#chat-reconnect-with-authenticated-user)
56
+ - [Chat Reconnect with Unauthenticated User](#chat-reconnect-with-unauthenticated-user)
57
+ - [Handling chat Disconnect on Mobile platform](#handling-chat-disconnect-on-mobile-platform)
58
+ - [Operating Hours](#operating-hours)
59
+ - [Single Sign-on for Bots](/docs/scenarios/SINGLE_SIGN_ON_FOR_BOTS.md)
59
60
  - [Sample Apps](https://github.com/microsoft/omnichannel-chat-sdk-samples)
60
61
  - [Feature Comparisons](#feature-comparisons)
61
62
  - [Telemetry](#telemetry)
@@ -65,6 +66,7 @@ Please make sure you have a chat widget configured before using this package or
65
66
  ## Live Chat Widget vs. Chat SDK
66
67
 
67
68
  Omnichannel offers a live chat widget (LCW) by default. You can use the Chat SDK to build your custom chat widget if:
69
+
68
70
  - You want to fully customize the user interface of the chat widget to conform with your branding.
69
71
  - You want to integrate Omnichannel into your mobile app using React Native.
70
72
  - You want to integrate additional functionalities that LCW does not offer.
@@ -75,24 +77,24 @@ Omnichannel offers a live chat widget (LCW) by default. You can use the Chat SDK
75
77
  | Feature | Live Chat Widget | Chat SDK | Notes |
76
78
  | ----- | ----- | ----- | ----- |
77
79
  | Bring Your Own Widget | ❌ | ✔ | |
78
- | Web Support | ✔ | ✔ |
79
- | React Native Support | ❌ | ✔ |
80
+ | Web Support | ✔ | ✔ ||
81
+ | React Native Support | ❌ | ✔ | |
80
82
  | Escalation to Voice & Video | ✔ | ✔ | Only supported on Web |
81
83
  | Co-browse | ✔ | 3rd party add-on | Only supported on Web |
82
84
  | Screen Sharing | ✔ | 3rd party add-on | Only supported on Web |
83
- | Authenticated Chat | ✔ | ✔ |
84
- | Pre-chat Survey | ✔ | ✔ |
85
- | Post-chat Survey | ✔ | ✔ |
86
- | Download Transcript | ✔ | ✔ |
87
- | Email Transcript | ✔ | ✔ |
88
- | Data Masking | ✔ | ✔ |
89
- | File Attachments | ✔ | ✔ |
90
- | Custom Context | ✔ | ✔ |
91
- | Proactive Chat | ✔ | BYOI **\*** |
92
- | Persistent Chat | ✔ | ✔ |
93
- | Chat Reconnect | ✔ | ✔ |
94
- | Operating Hours | ✔ | ✔ |
95
- | Get Agent Availability | ✔ | ✔ |
85
+ | Authenticated Chat | ✔ | ✔ | |
86
+ | Pre-chat Survey | ✔ | ✔ | |
87
+ | Post-chat Survey | ✔ | ✔ | |
88
+ | Download Transcript | ✔ | ✔ | |
89
+ | Email Transcript | ✔ | ✔ | |
90
+ | Data Masking | ✔ | ✔ | |
91
+ | File Attachments | ✔ | ✔ | |
92
+ | Custom Context | ✔ | ✔ | |
93
+ | Proactive Chat | ✔ | BYOI **\*** | |
94
+ | Persistent Chat | ✔ | ✔ | |
95
+ | Chat Reconnect | ✔ | ✔ | |
96
+ | Operating Hours | ✔ | ✔ | |
97
+ | Get Agent Availability | ✔ | ✔ | |
96
98
  | Queue Position | ✔ | ✔ | No SDK method. Handled as *system message* |
97
99
  | Average Wait Time | ✔ | ✔ | No SDK method. Handled as *system message* |
98
100
 
@@ -142,7 +144,7 @@ New releases are published on a regular basis to ensure the product quality.
142
144
 
143
145
  ## Installation
144
146
 
145
- ```
147
+ ```console
146
148
  npm install @microsoft/omnichannel-chat-sdk --save
147
149
  ```
148
150
 
@@ -151,31 +153,37 @@ npm install @microsoft/omnichannel-chat-sdk --save
151
153
  The following steps will be required to run Omnichannel Chat SDK on React Native:
152
154
 
153
155
  1. Install `node-libs-react-native`
154
- ```
156
+
157
+ ```console
155
158
  npm install node-libs-react-native --save-dev
156
159
  ```
157
160
 
158
161
  1. Install `react-native-randomBytes`
159
- ```
162
+
163
+ ```console
160
164
  npm install react-native-randombytes --save-dev
161
165
  ```
162
166
 
163
167
  1. Install `react-native-get-random-values`
164
- ```
168
+
169
+ ```console
165
170
  npm install react-native-get-random-values --save-dev
166
171
  ```
167
172
 
168
173
  1. Install `react-native-url-polyfill`
169
- ```
174
+
175
+ ```console
170
176
  npm install react-native-url-polyfill --save-dev
171
177
  ```
172
178
 
173
179
  1. Install `@azure/core-asynciterator-polyfill`
174
- ```
180
+
181
+ ```console
175
182
  npm install @azure/core-asynciterator-polyfill --save-dev
176
183
  ```
177
184
 
178
185
  1. Update *metro.config.js* to use React Native compatible Node Core modules
186
+
179
187
  ```ts
180
188
  module.exports = {
181
189
  // ...
@@ -190,6 +198,7 @@ The following steps will be required to run Omnichannel Chat SDK on React Native
190
198
  ```
191
199
 
192
200
  1. Add the following *import* on top of your entry point file
201
+
193
202
  ```ts
194
203
  import 'node-libs-react-native/globals';
195
204
  import 'react-native-get-random-values';
@@ -223,10 +232,14 @@ const chatSDK = new OmnichannelChatSDK.OmnichannelChatSDK(omnichannelConfig, cha
223
232
 
224
233
  const optionalParams = {
225
234
  getLiveChatConfigOptionalParams: {
226
- sendCacheHeaders: false // Whether to send Cache-Control HTTP header to GetChatConfig call
235
+ sendCacheHeaders: false,// Whether to send Cache-Control HTTP header to GetChatConfig call
236
+ useSequentialLoad: false // Whether to use sequential load for chat config, if not present, by default uses parallel load for faster initialization
237
+
227
238
  }
228
239
  };
229
240
 
241
+
242
+ // For the case when the widget doesnt have enabled support for attachments, Upload/download operations wont be supported
230
243
  await chatSDK.initialize(optionalParams);
231
244
  ```
232
245
 
@@ -372,7 +385,6 @@ import {DeliveryMode, MessageContentType, MessageType, PersonType} from '@micros
372
385
 
373
386
  ...
374
387
 
375
- const displayName = "Contoso"
376
388
  const message = "Sample message from customer";
377
389
  const messageToSend = {
378
390
  content: message
@@ -395,6 +407,7 @@ chatSDK.onNewMessage((message) => {
395
407
  console.log(message);
396
408
  }, optionalParams);
397
409
  ```
410
+
398
411
  ### On Typing Event
399
412
 
400
413
  It subscribes to an agent typing event.
@@ -513,6 +526,7 @@ try {
513
526
  }
514
527
  }
515
528
  ```
529
+
516
530
  ### Get Post Chat Survey Context
517
531
 
518
532
  It gets the participant type that should be used for the survey and both the default and bot survey details.
@@ -533,7 +547,7 @@ const agentAvailability = await chatSDK.getAgentAvailability();
533
547
 
534
548
  ### Pre-Chat Survey
535
549
 
536
- > See https://docs.microsoft.com/en-us/dynamics365/customer-service/configure-pre-chat-survey?tabs=customerserviceadmincenter on how to set up pre-conversation surveys
550
+ > See <https://docs.microsoft.com/en-us/dynamics365/customer-service/configure-pre-chat-survey?tabs=customerserviceadmincenter> on how to set up pre-conversation surveys
537
551
 
538
552
  ```ts
539
553
  import * as AdaptiveCards, { Action } from "adaptivecards";
@@ -568,7 +582,7 @@ const agentAvailability = await chatSDK.getAgentAvailability();
568
582
 
569
583
  ### Post-Chat Survey
570
584
 
571
- > See https://docs.microsoft.com/en-us/dynamics365/customer-service/configure-post-conversation-survey?tabs=customerserviceadmincenter on how to set up post-conversation surveys
585
+ > See <https://docs.microsoft.com/en-us/dynamics365/customer-service/configure-post-conversation-survey?tabs=customerserviceadmincenter> on how to set up post-conversation surveys
572
586
 
573
587
  > ❗ `chatSDK.getPostChatSurveyContext()` needs to be called before `chatSDK.endChat()` is called
574
588
 
@@ -627,7 +641,7 @@ messages.reverse().forEach((message: any) => renderMessage(message)); // Logic t
627
641
 
628
642
  ### Authenticated Chat
629
643
 
630
- > See https://docs.microsoft.com/en-us/dynamics365/customer-service/create-chat-auth-settings?tabs=customerserviceadmincenter#create-a-chat-authentication-setting-record on how to set up an authenticated chat
644
+ > See <https://docs.microsoft.com/en-us/dynamics365/customer-service/create-chat-auth-settings?tabs=customerserviceadmincenter#create-a-chat-authentication-setting-record> on how to set up an authenticated chat
631
645
 
632
646
  ```ts
633
647
  const chatSDKConfig = {
@@ -650,7 +664,7 @@ await chatSDK.initialize();
650
664
 
651
665
  ### Persistent Chat
652
666
 
653
- > See https://docs.microsoft.com/en-us/dynamics365/customer-service/persistent-chat on how to set up persistent chat
667
+ > See <https://docs.microsoft.com/en-us/dynamics365/customer-service/persistent-chat> on how to set up persistent chat
654
668
 
655
669
  ```ts
656
670
  const chatSDKConfig = {
@@ -674,9 +688,10 @@ await chatSDK.initialize();
674
688
 
675
689
  // from this point, this acts like a persistent chat
676
690
  ```
691
+
677
692
  ### Chat Reconnect with Authenticated User
678
693
 
679
- > See https://docs.microsoft.com/en-us/dynamics365/customer-service/configure-reconnect-chat?tabs=customerserviceadmincenter#enable-reconnection-to-a-previous-chat-session on how to set up chat reconnect
694
+ > See <https://docs.microsoft.com/en-us/dynamics365/customer-service/configure-reconnect-chat?tabs=customerserviceadmincenter#enable-reconnection-to-a-previous-chat-session> on how to set up chat reconnect
680
695
 
681
696
  ```ts
682
697
  const chatSDKConfig = {
@@ -716,7 +731,7 @@ chatSDK.startChat();
716
731
 
717
732
  ### Chat Reconnect with Unauthenticated User
718
733
 
719
- > See https://docs.microsoft.com/en-us/dynamics365/customer-service/configure-reconnect-chat?tabs=customerserviceadmincenter#enable-reconnection-to-a-previous-chat-session on how to set up chat reconnect
734
+ > See <https://docs.microsoft.com/en-us/dynamics365/customer-service/configure-reconnect-chat?tabs=customerserviceadmincenter#enable-reconnection-to-a-previous-chat-session> on how to set up chat reconnect
720
735
 
721
736
  ```ts
722
737
  const chatSDKConfig = {
@@ -760,7 +775,7 @@ if (chatReconnectContext.reconnectId) {
760
775
 
761
776
  ### Operating Hours
762
777
 
763
- > See https://docs.microsoft.com/en-us/dynamics365/customer-service/create-operating-hours?tabs=customerserviceadmincenter on how to set up operating hours
778
+ > See <https://docs.microsoft.com/en-us/dynamics365/customer-service/create-operating-hours?tabs=customerserviceadmincenter> on how to set up operating hours
764
779
 
765
780
  ```ts
766
781
  const chatConfig = await chatSDK.getLiveChatConfig();
@@ -797,11 +812,12 @@ window.addEventListener("visibilitychange", async () => {
797
812
  });
798
813
  ```
799
814
 
800
-
801
815
  ### Using [BotFramework-WebChat](https://github.com/microsoft/BotFramework-WebChat)
816
+ >
802
817
  > :warning: Currently supported on web only
803
818
 
804
819
  Minimum Requirement Checklist
820
+
805
821
  1. [ ] Initialize ChatSDK
806
822
  1. [ ] Start new conversation
807
823
  1. [ ] Create Chat Adapter
@@ -839,9 +855,10 @@ const store = createStore(
839
855
  ```
840
856
 
841
857
  ### Escalation to Voice & Video
858
+ >
842
859
  > :warning: Currently supported on web only
843
860
 
844
- > See https://docs.microsoft.com/en-us/dynamics365/customer-service/call-options-visual-engagement on how to set up calling options
861
+ > See <https://docs.microsoft.com/en-us/dynamics365/customer-service/call-options-visual-engagement> on how to set up calling options
845
862
 
846
863
  ```ts
847
864
  import OmnichannelChatSDK from '@microsoft/omnichannel-chat-sdk';
@@ -949,17 +966,19 @@ if (VoiceVideoCallingSDK) {
949
966
  ## Feature Comparisons
950
967
 
951
968
  ### Web
969
+
952
970
  | | Custom Control | WebChat Control |
953
971
  | --- | --- | --- |
954
972
  | **Features** | | |
955
973
  | Chat Widget UI | Not provided | Basic chat client provided |
956
974
  | Data Masking | Embedded | Requires `Data Masking Middleware` implementation |
957
975
  | Send Typing indicator | Embedded | Requires `sendTypingIndicator` flag set to `true` |
958
- | PreChat Survey | Requires Adaptive Cards renderer | Requires Adaptive Cards renderer
976
+ | PreChat Survey | Requires Adaptive Cards renderer | Requires Adaptive Cards renderer|
959
977
  | Display Attachments | Requires implementation | Basic interface provided & Customizable |
960
978
  | Incoming messages handling | IC3 protocol message data | DirectLine activity data |
961
979
 
962
980
  ### React Native
981
+
963
982
  | | Custom Control | Gifted Chat Control | WebChat Control |
964
983
  | --- | --- | --- | --- |
965
984
  | **Features** | | | Currently not supported |
@@ -1008,7 +1027,7 @@ await chatSDK.initialize();
1008
1027
 
1009
1028
  This project welcomes contributions and suggestions. Most contributions require you to agree to a
1010
1029
  Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
1011
- the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
1030
+ the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.
1012
1031
 
1013
1032
  When you submit a pull request, a CLA bot will automatically determine whether you need to provide
1014
1033
  a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
@@ -11,6 +11,7 @@ import ChatSDKMessage from "./core/messaging/ChatSDKMessage";
11
11
  import ChatTranscriptBody from "./core/ChatTranscriptBody";
12
12
  import EmailLiveChatTranscriptOptionaParams from "./core/EmailLiveChatTranscriptOptionalParams";
13
13
  import EndChatOptionalParams from "./core/EndChatOptionalParams";
14
+ import FetchChatTokenResponse from "@microsoft/ocsdk/lib/Model/FetchChatTokenResponse";
14
15
  import FileMetadata from "@microsoft/omnichannel-amsclient/lib/FileMetadata";
15
16
  import FramedClient from "@microsoft/omnichannel-amsclient/lib/FramedClient";
16
17
  import FramedlessClient from "@microsoft/omnichannel-amsclient/lib/FramedlessClient";
@@ -26,10 +27,10 @@ import IRawThread from "@microsoft/omnichannel-ic3core/lib/interfaces/IRawThread
26
27
  import InitializeOptionalParams from "./core/InitializeOptionalParams";
27
28
  import LiveWorkItemDetails from "./core/LiveWorkItemDetails";
28
29
  import OmnichannelConfig from "./core/OmnichannelConfig";
30
+ import OmnichannelMessage from "./core/messaging/OmnichannelMessage";
29
31
  import OnNewMessageOptionalParams from "./core/messaging/OnNewMessageOptionalParams";
30
32
  import PostChatContext from "./core/PostChatContext";
31
33
  import StartChatOptionalParams from "./core/StartChatOptionalParams";
32
- import FetchChatTokenResponse from "@microsoft/ocsdk/lib/Model/FetchChatTokenResponse";
33
34
  declare class OmnichannelChatSDK {
34
35
  private debug;
35
36
  runtimeId: string;
@@ -72,11 +73,13 @@ declare class OmnichannelChatSDK {
72
73
  private AMSClientLoadCurrentState;
73
74
  private isMaskingDisabled;
74
75
  private maskingCharacter;
76
+ private isAMSClientAllowed;
75
77
  constructor(omnichannelConfig: OmnichannelConfig, chatSDKConfig?: ChatSDKConfig);
76
78
  setDebug(flag: boolean): void;
77
79
  private retryLoadAMSClient;
78
80
  private getAMSClient;
79
81
  private loadInitComponents;
82
+ private evaluateAMSAvailability;
80
83
  private loadAmsClient;
81
84
  private parallelInitialization;
82
85
  private sequentialInitialization;
@@ -109,7 +112,7 @@ declare class OmnichannelChatSDK {
109
112
  getMessages(): Promise<GetMessagesResponse>;
110
113
  getDataMaskingRules(): Promise<MaskingRules>;
111
114
  private transformMessage;
112
- sendMessage(message: ChatSDKMessage): Promise<void>;
115
+ sendMessage(message: ChatSDKMessage): Promise<OmnichannelMessage | void>;
113
116
  onNewMessage(onNewMessageCallback: CallableFunction, optionalParams?: OnNewMessageOptionalParams): Promise<void>;
114
117
  sendTypingEvent(): Promise<void>;
115
118
  onTypingEvent(onTypingEventCallback: CallableFunction): Promise<void>;