@microsoft/omnichannel-chat-sdk 1.0.1-main.fa78d5f → 1.1.1-main.4abcbae

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 (61) hide show
  1. package/CHANGELOG.md +21 -3
  2. package/README.md +87 -59
  3. package/lib/OmnichannelChatSDK.d.ts +6 -4
  4. package/lib/OmnichannelChatSDK.js +302 -302
  5. package/lib/OmnichannelChatSDK.js.map +1 -1
  6. package/lib/api/createVoiceVideoCalling.js +6 -2
  7. package/lib/api/createVoiceVideoCalling.js.map +1 -1
  8. package/lib/config/settings.d.ts +1 -1
  9. package/lib/config/settings.js +1 -1
  10. package/lib/core/ChatConfig.d.ts +4 -0
  11. package/lib/core/ChatSDKExceptionDetails.d.ts +5 -0
  12. package/lib/core/ChatSDKExceptionDetails.js +3 -0
  13. package/lib/core/ChatSDKExceptionDetails.js.map +1 -0
  14. package/lib/core/ChatTranscriptBody.d.ts +1 -1
  15. package/lib/core/LiveWorkItemDetails.d.ts +2 -0
  16. package/lib/core/OmnichannelErrorCodes.d.ts +4 -0
  17. package/lib/core/OmnichannelErrorCodes.js +8 -0
  18. package/lib/core/OmnichannelErrorCodes.js.map +1 -0
  19. package/lib/core/PostChatContext.d.ts +1 -0
  20. package/lib/core/messaging/ChatAdapterOptionalParams.d.ts +14 -0
  21. package/lib/core/messaging/ChatAdapterOptionalParams.js +3 -0
  22. package/lib/core/messaging/ChatAdapterOptionalParams.js.map +1 -0
  23. package/lib/core/messaging/MessageTags.d.ts +2 -0
  24. package/lib/core/messaging/MessageTags.js +4 -2
  25. package/lib/core/messaging/MessageTags.js.map +1 -1
  26. package/lib/external/ACSAdapter/createChannelDataEgressMiddleware.d.ts +5 -0
  27. package/lib/external/ACSAdapter/createChannelDataEgressMiddleware.js +34 -0
  28. package/lib/external/ACSAdapter/createChannelDataEgressMiddleware.js.map +1 -0
  29. package/lib/external/CallingSDK/ICallingSDKLogData.d.ts +7 -0
  30. package/lib/external/CallingSDK/ICallingSDKLogData.js +3 -0
  31. package/lib/external/CallingSDK/ICallingSDKLogData.js.map +1 -0
  32. package/lib/external/IC3Adapter/IIC3AdapterOptions.d.ts +12 -0
  33. package/lib/index.d.ts +7 -6
  34. package/lib/index.js +13 -8
  35. package/lib/index.js.map +1 -1
  36. package/lib/telemetry/AriaTelemetry.d.ts +1 -0
  37. package/lib/telemetry/AriaTelemetry.js +55 -0
  38. package/lib/telemetry/AriaTelemetry.js.map +1 -1
  39. package/lib/telemetry/ScenarioMarker.d.ts +2 -0
  40. package/lib/telemetry/ScenarioMarker.js +7 -3
  41. package/lib/telemetry/ScenarioMarker.js.map +1 -1
  42. package/lib/telemetry/ScenarioType.d.ts +1 -0
  43. package/lib/telemetry/ScenarioType.js +1 -0
  44. package/lib/telemetry/ScenarioType.js.map +1 -1
  45. package/lib/telemetry/TelemetryEvent.d.ts +1 -3
  46. package/lib/telemetry/TelemetryEvent.js +0 -2
  47. package/lib/telemetry/TelemetryEvent.js.map +1 -1
  48. package/lib/tsconfig.tsbuildinfo +158 -63
  49. package/lib/utils/WebUtils.d.ts +3 -1
  50. package/lib/utils/WebUtils.js +8 -2
  51. package/lib/utils/WebUtils.js.map +1 -1
  52. package/lib/utils/libraries.d.ts +1 -3
  53. package/lib/utils/libraries.js +2 -11
  54. package/lib/utils/libraries.js.map +1 -1
  55. package/lib/utils/locale.d.ts +2 -0
  56. package/lib/utils/locale.js +5 -3
  57. package/lib/utils/locale.js.map +1 -1
  58. package/lib/utils/loggers.d.ts +26 -1
  59. package/lib/utils/loggers.js +94 -2
  60. package/lib/utils/loggers.js.map +1 -1
  61. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -3,19 +3,37 @@ All notable changes to this project will be documented in this file.
3
3
 
4
4
  ## [Unreleased]
5
5
 
6
+ ## [1.1.0] - 2022-04-15
6
7
  ### Added
7
- - Add Post Chat Survey Support
8
- - Add `getPostChatSurveyContext` & `initializePostChatRenderer` and `renderPostChatSurvey` API methods
9
- - Add `GetPostChatSurveyContext`, `RenderPostChatSurvey`, and `InitializePostChatRenderer` telemetry events
8
+ - Add `getPostChatSurveyContext` API method
9
+ - Add `GetPostChatSurveyContext` telemetry event
10
10
  - Add `widgetId` & `clientMessageId` as metadata on sending message
11
+ - Update `ChatConfig` interface with `LiveChatVersion`, `allowedFileExtensions` & `maxUploadFileSize` properties
12
+ - Add ability to automatically detect locale from chat config
13
+ - Add `runtimeId` attribute in `OmnichannelChatSDK` & `ChatSDKRuntimeId` field in telemetry
14
+ - Add ability to automatically pass locale from chat config on calling `ChatSDK.emailLiveChatTranscript()`
15
+ - Bubble up `WidgetUseOutsideOperatingHour` exception
16
+ - Add `acs_webchat-chat-adapter` middleware to add default `channelData.tags` & `channelData.metadata`
17
+ - Update `ChatConfig` interface with `msdyn_enablemarkdown` property
18
+ - Throw exception on `ChatSDK.getVoiceVideoCalling()` if feature is disabled or platform is not supported
19
+ - Add `participantType` & `canRenderPostChat` as response of getConversationDetails() API
20
+ - Add support for separate bot post chat survey feature
21
+ - Pass `logger` to `acs_webchat-chat-adapter`
11
22
 
12
23
  ### Fix
13
24
  - Add `acs_webchat-chat-adapter` middlewares to format `channelData.tags`
25
+ - Skip `session init` call on existing conversation
26
+ - Fix `chat reconnect` not ending the conversation on calling `ChatSDK.endChat()`
27
+ - Fix on messaging client not sending heartbeat on new conversations subsequent to the first conversation
28
+ - Fix `ChatSDK.getConversationDetails()` not passing `authenticatedUserToken`
29
+ - Fix `IC3Client.dispose()` called when `IC3Client` is `undefined`
14
30
 
15
31
  ### Changed
16
32
  - README: added examples on usages of the post chat APIs.
17
33
  - Uptake [@azure/communication-chat@1.1.1](https://www.npmjs.com/package/@azure/communication-chat/v/1.1.1)
18
34
  - Uptake [acs_webchat-chat-adapter@0.0.35-beta.2](https://unpkg.com/acs_webchat-chat-adapter@0.0.35-beta.2/dist/chat-adapter.js)
35
+ - Update `locale` property in `ChatTranscriptBody` interface to be optional
36
+ - Uptake [acs_webchat-chat-adapter@0.0.35-beta.4](https://unpkg.com/acs_webchat-chat-adapter@0.0.35-beta.4/dist/chat-adapter.js)
19
37
 
20
38
  ## [1.0.0] - 2021-10-08
21
39
  ### Added
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Omnichannel Chat SDK
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
+ [![install size](https://packagephobia.com/badge?p=@microsoft/omnichannel-chat-sdk)](https://packagephobia.com/result?p=@microsoft/omnichannel-chat-sdk)
4
5
  ![Release CI](https://github.com/microsoft/omnichannel-chat-sdk/workflows/Release%20CI/badge.svg)
5
6
  ![npm](https://img.shields.io/npm/dm/@microsoft/omnichannel-chat-sdk)
6
7
 
@@ -18,6 +19,7 @@ Please make sure you have a chat widget configured before using this package or
18
19
  - [Common Scenarios](#common-scenarios)
19
20
  - [Feature Comparisons](#feature-comparisons)
20
21
  - [Telemetry](#telemetry)
22
+ - [Development Guide](docs/DEVELOPMENT_GUIDE.md)
21
23
  - [Troubleshooting Guide](docs/TROUBLESHOOTING_GUIDE.md)
22
24
 
23
25
  ## Live Chat Widget vs. Chat SDK
@@ -40,7 +42,7 @@ Omnichannel offers an live chat widget (LCW) by default. You can use the Chat SD
40
42
  | Screen Sharing | ✔ | 3rd party add-on | Only supported on Web |
41
43
  | Authenticated Chat | ✔ | ✔ |
42
44
  | Pre-chat Survey | ✔ | ✔ |
43
- | Post-chat Survey | ✔ | |
45
+ | Post-chat Survey | ✔ | |
44
46
  | Download Transcript | ✔ | ✔ |
45
47
  | Email Transcript | ✔ | ✔ |
46
48
  | Data Masking | ✔ | ✔ |
@@ -131,8 +133,9 @@ The following steps will be required to run Omnichannel Chat SDK on React Native
131
133
  | OmnichannelChatSDK.getLiveChatTranscript() | Get transcript data (JSON) | |
132
134
  | OmnichannelChatSDK.uploadFileAttachment() | Send file attachment | |
133
135
  | OmnichannelChatSDK.downloadFileAttachment() | Download file attachment | |
134
- | OmnichannelChatSDK.createChatAdapter() | Get IC3Adapter | **Web only** |
136
+ | OmnichannelChatSDK.createChatAdapter() | Get Chat Adapter | **Web only** |
135
137
  | OmnichannelChatSDK.getVoiceVideoCalling() | Get VoiceVideoCall SDK for Escalation to Voice & Video | **Web only** |
138
+ | OmnichannelChatSDK.getPostChatSurveyContext() | Get post chat survey link, survey locale, and whether an agent has joined the survey | |
136
139
 
137
140
  ## API examples
138
141
 
@@ -210,6 +213,21 @@ The following steps will be required to run Omnichannel Chat SDK on React Native
210
213
  const preChatSurvey = await getPreChatSurvey(parseToJSON); // Adaptive Cards payload data as string
211
214
  ```
212
215
 
216
+ ### Get PostChat Survey
217
+ ```ts
218
+ try {
219
+ const context = await chatSDK.getPostChatSurveyContext();
220
+ if (context.participantJoined) { // participantJoined will be true if an agent has joined the conversation, or a bot has joined the conversation and the bot survey flag has been turned on on the admin side.
221
+ // formsProLocale is the default language you have set on the CustomerVoice portal. You can override this url parameter with any locale that CustomerVoice supports.
222
+ // If "&lang=" is not set on the url, the locale will be English.
223
+ const linkToSend = context.surveyInviteLink + "&lang=" + context.formsProLocale;
224
+ // This link is accessible and will redirect to the survey page. Use it as you see fit.
225
+ }
226
+ } catch (ex) {
227
+ // If the post chat should not be shown by any reason (e.g. post chat is not enabled), promise will be rejected.
228
+ }
229
+ ```
230
+
213
231
  ### Start Chat
214
232
  ```ts
215
233
  const customContext = {
@@ -319,8 +337,7 @@ The following steps will be required to run Omnichannel Chat SDK on React Native
319
337
  ```ts
320
338
  const body = {
321
339
  emailAddress: 'contoso@microsoft.com',
322
- attachmentMessage: 'Attachment Message',
323
- locale: 'en-us'
340
+ attachmentMessage: 'Attachment Message'
324
341
  };
325
342
  await chatSDK.emailLiveChatTranscript(body);
326
343
  ```
@@ -581,82 +598,93 @@ The following steps will be required to run Omnichannel Chat SDK on React Native
581
598
  console.log("VoiceVideoCalling loaded");
582
599
  } catch (e) {
583
600
  console.log(`Failed to load VoiceVideoCalling: ${e}`);
601
+
602
+ if (e.message === 'UnsupportedPlatform') {
603
+ // Voice Video Calling feature is not supported on this platform
604
+ }
605
+
606
+ if (e.message === 'FeatureDisabled') {
607
+ // Voice Video Calling feature is disabled on admin side
608
+ }
584
609
  }
585
610
 
586
611
  await chatSDK.startChat();
587
612
 
588
613
  const chatToken: any = await chatSDK.getChatToken();
589
614
 
590
- try {
591
- await VoiceVideoCallingSDK.initialize({
592
- chatToken,
593
- selfVideoHTMLElementId: 'selfVideo', // HTML element id where video stream of the agent will be rendered
594
- remoteVideoHTMLElementId: 'remoteVideo', // HTML element id where video stream of the customer will be rendered
595
- OCClient: chatSDK.OCClient
596
- });
597
- } catch (e) {
598
- console.error("Failed to initialize VoiceVideoCalling!");
599
- }
615
+ // Initialize only if VoiceVideoCallingSDK is defined
616
+ if (VoiceVideoCallingSDK) {
617
+ try {
618
+ await VoiceVideoCallingSDK.initialize({
619
+ chatToken,
620
+ selfVideoHTMLElementId: 'selfVideo', // HTML element id where video stream of the agent will be rendered
621
+ remoteVideoHTMLElementId: 'remoteVideo', // HTML element id where video stream of the customer will be rendered
622
+ OCClient: chatSDK.OCClient
623
+ });
624
+ } catch (e) {
625
+ console.error("Failed to initialize VoiceVideoCalling!");
626
+ }
600
627
 
601
- // Triggered when there's an incoming call
602
- VoiceVideoCallingSDK.onCallAdded(() => {
603
- ...
604
- });
628
+ // Triggered when there's an incoming call
629
+ VoiceVideoCallingSDK.onCallAdded(() => {
630
+ ...
631
+ });
605
632
 
606
- // Triggered when local video stream is available (e.g.: Local video added succesfully in selfVideoHTMLElement)
607
- VoiceVideoCallingSDK.onLocalVideoStreamAdded(() => {
608
- ...
609
- });
633
+ // Triggered when local video stream is available (e.g.: Local video added succesfully in selfVideoHTMLElement)
634
+ VoiceVideoCallingSDK.onLocalVideoStreamAdded(() => {
635
+ ...
636
+ });
610
637
 
611
- // Triggered when local video stream is unavailable (e.g.: Customer turning off local video)
612
- VoiceVideoCallingSDK.onLocalVideoStreamRemoved(() => {
613
- ...
614
- });
638
+ // Triggered when local video stream is unavailable (e.g.: Customer turning off local video)
639
+ VoiceVideoCallingSDK.onLocalVideoStreamRemoved(() => {
640
+ ...
641
+ });
615
642
 
616
- // Triggered when remote video stream is available (e.g.: Remote video added succesfully in remoteVideoHTMLElement)
617
- VoiceVideoCallingSDK.onRemoteVideoStreamAdded(() => {
618
- ...
619
- });
643
+ // Triggered when remote video stream is available (e.g.: Remote video added succesfully in remoteVideoHTMLElement)
644
+ VoiceVideoCallingSDK.onRemoteVideoStreamAdded(() => {
645
+ ...
646
+ });
620
647
 
621
- // Triggered when remote video stream is unavailable (e.g.: Agent turning off remote video)
622
- VoiceVideoCallingSDK.onRemoteVideoStreamRemoved(() => {
623
- ...
624
- });
648
+ // Triggered when remote video stream is unavailable (e.g.: Agent turning off remote video)
649
+ VoiceVideoCallingSDK.onRemoteVideoStreamRemoved(() => {
650
+ ...
651
+ });
625
652
 
626
- // Triggered when current call has ended or disconnected regardless the party
627
- VoiceVideoCalling.onCallDisconnected(() => {
628
- ...
629
- });
653
+ // Triggered when current call has ended or disconnected regardless the party
654
+ VoiceVideoCalling.onCallDisconnected(() => {
655
+ ...
656
+ });
630
657
 
631
- // Check if microphone is muted
632
- const isMicrophoneMuted = VoiceVideoCallingSDK.isMicrophoneMuted();
658
+ // Check if microphone is muted
659
+ const isMicrophoneMuted = VoiceVideoCallingSDK.isMicrophoneMuted();
633
660
 
634
- // Check if remote video is available
635
- const isRemoteVideoEnabled = VoiceVideoCallingSDK.isRemoteVideoEnabled();
661
+ // Check if remote video is available
662
+ const isRemoteVideoEnabled = VoiceVideoCallingSDK.isRemoteVideoEnabled();
636
663
 
637
- // Check if local video is available
638
- const isLocalVideoEnabled = VoiceVideoCallingSDK.isLocalVideoEnabled();
664
+ // Check if local video is available
665
+ const isLocalVideoEnabled = VoiceVideoCallingSDK.isLocalVideoEnabled();
639
666
 
640
- // Accepts incoming call
641
- const acceptCallConfig = {
642
- withVideo: true // Accept call with/without video stream
643
- };
644
- await VoiceVideoCallingSDK.acceptCall(acceptCallConfig);
667
+ // Accepts incoming call
668
+ const acceptCallConfig = {
669
+ withVideo: true // Accept call with/without video stream
670
+ };
671
+ await VoiceVideoCallingSDK.acceptCall(acceptCallConfig);
645
672
 
646
- // Rejects incoming call
647
- await VoiceVideoCallingSDK.rejectCall();
673
+ // Rejects incoming call
674
+ await VoiceVideoCallingSDK.rejectCall();
648
675
 
649
- // Ends/Stops current call
650
- await VoiceVideoCallingSDK.stopCall();
676
+ // Ends/Stops current call
677
+ await VoiceVideoCallingSDK.stopCall();
651
678
 
652
- // Mute/Unmute current call
653
- await VoiceVideoCallingSDK.toggleMute()
679
+ // Mute/Unmute current call
680
+ await VoiceVideoCallingSDK.toggleMute()
654
681
 
655
- // Display/Hide local video of current call
656
- await VoiceVideoCallingSDK.toggleLocalVideo()
682
+ // Display/Hide local video of current call
683
+ await VoiceVideoCallingSDK.toggleLocalVideo()
657
684
 
658
- // Clean up VoiceVideoCallingSDK (e.g.: Usually called when customer ends chat session)
659
- VoiceVideoCallingSDK.close();
685
+ // Clean up VoiceVideoCallingSDK (e.g.: Usually called when customer ends chat session)
686
+ VoiceVideoCallingSDK.close();
687
+ }
660
688
  ```
661
689
 
662
690
  ## Feature Comparisons
@@ -1,5 +1,6 @@
1
1
  import ACSClient from "./core/messaging/ACSClient";
2
2
  import { ParticipantsRemovedEvent } from '@azure/communication-signaling';
3
+ import ChatAdapterOptionalParams from "./core/messaging/ChatAdapterOptionalParams";
3
4
  import ChatConfig from "./core/ChatConfig";
4
5
  import ChatReconnectContext from "./core/ChatReconnectContext";
5
6
  import ChatReconnectOptionalParams from "./core/ChatReconnectOptionalParams";
@@ -20,10 +21,10 @@ import LiveWorkItemDetails from "./core/LiveWorkItemDetails";
20
21
  import OmnichannelConfig from "./core/OmnichannelConfig";
21
22
  import OmnichannelMessage from "./core/messaging/OmnichannelMessage";
22
23
  import OnNewMessageOptionalParams from "./core/messaging/OnNewMessageOptionalParams";
23
- import PostChatContext from "./core/PostChatContext";
24
24
  import StartChatOptionalParams from "./core/StartChatOptionalParams";
25
25
  declare class OmnichannelChatSDK {
26
26
  private debug;
27
+ runtimeId: string;
27
28
  OCSDKProvider: unknown;
28
29
  IC3SDKProvider: unknown;
29
30
  OCClient: any;
@@ -33,6 +34,7 @@ declare class OmnichannelChatSDK {
33
34
  omnichannelConfig: OmnichannelConfig;
34
35
  chatSDKConfig: ChatSDKConfig;
35
36
  isInitialized: boolean;
37
+ localeId: string;
36
38
  requestId: string;
37
39
  private chatToken;
38
40
  private liveChatConfig;
@@ -49,6 +51,7 @@ declare class OmnichannelChatSDK {
49
51
  private ocSdkLogger;
50
52
  private acsClientLogger;
51
53
  private acsAdapterLogger;
54
+ private callingSdkLogger;
52
55
  private isPersistentChat;
53
56
  private isChatReconnect;
54
57
  private reconnectId;
@@ -80,15 +83,14 @@ declare class OmnichannelChatSDK {
80
83
  downloadFileAttachment(fileMetadata: FileMetadata | IFileMetadata): Promise<Blob>;
81
84
  emailLiveChatTranscript(body: ChatTranscriptBody): Promise<any>;
82
85
  getLiveChatTranscript(): Promise<any>;
83
- createChatAdapter(protocol?: string | null): Promise<unknown>;
86
+ createChatAdapter(optionalParams?: ChatAdapterOptionalParams): Promise<unknown>;
84
87
  getVoiceVideoCalling(params?: any): Promise<any>;
85
88
  getPostChatSurveyContext(): Promise<any>;
86
- initializePostChatRenderer(): Promise<void>;
87
- renderPostChatSurvey(containerId: string, postChatContext: PostChatContext): Promise<void>;
88
89
  private getIC3Client;
89
90
  private getChatConfig;
90
91
  private resolveIC3ClientUrl;
91
92
  private resolveChatAdapterUrl;
92
93
  private updateChatToken;
94
+ private setAuthTokenProvider;
93
95
  }
94
96
  export default OmnichannelChatSDK;