@microsoft/omnichannel-chat-sdk 0.3.1-main.c96fb51 → 1.0.1-main.077d17c
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/CHANGELOG.md +33 -0
- package/README.md +138 -66
- package/lib/OmnichannelChatSDK.d.ts +41 -24
- package/lib/OmnichannelChatSDK.js +1104 -408
- package/lib/OmnichannelChatSDK.js.map +1 -1
- package/lib/api/createVoiceVideoCalling.js +6 -2
- package/lib/api/createVoiceVideoCalling.js.map +1 -1
- package/lib/config/settings.d.ts +2 -1
- package/lib/config/settings.js +3 -1
- package/lib/config/settings.js.map +1 -1
- package/lib/core/{IAuthSettings.d.ts → AuthSettings.d.ts} +1 -1
- package/lib/core/{IAuthSettings.js → AuthSettings.js} +1 -1
- package/lib/core/AuthSettings.js.map +1 -0
- package/lib/core/ChatConfig.d.ts +10 -0
- package/lib/core/{IChatConfig.js → ChatConfig.js} +1 -1
- package/lib/core/ChatConfig.js.map +1 -0
- package/lib/core/{IChatSDKConfig.d.ts → ChatSDKConfig.d.ts} +7 -7
- package/lib/core/{IChatSDKConfig.js → ChatSDKConfig.js} +1 -1
- package/lib/core/ChatSDKConfig.js.map +1 -0
- package/lib/core/ChatSDKExceptionDetails.d.ts +5 -0
- package/lib/core/ChatSDKExceptionDetails.js +3 -0
- package/lib/core/ChatSDKExceptionDetails.js.map +1 -0
- package/lib/core/ChatTranscriptBody.d.ts +5 -0
- package/lib/core/ChatTranscriptBody.js +3 -0
- package/lib/core/ChatTranscriptBody.js.map +1 -0
- package/lib/core/{ILiveChatContext.d.ts → LiveChatContext.d.ts} +1 -1
- package/lib/core/LiveChatContext.js +3 -0
- package/lib/core/LiveChatContext.js.map +1 -0
- package/lib/core/LiveChatVersion.d.ts +5 -0
- package/lib/core/LiveChatVersion.js +9 -0
- package/lib/core/LiveChatVersion.js.map +1 -0
- package/lib/core/LiveWorkItemDetails.d.ts +2 -0
- package/lib/core/{IOmnichannelConfig.d.ts → OmnichannelConfig.d.ts} +1 -1
- package/lib/core/OmnichannelConfig.js +3 -0
- package/lib/core/OmnichannelConfig.js.map +1 -0
- package/lib/core/OmnichannelErrorCodes.d.ts +4 -0
- package/lib/core/OmnichannelErrorCodes.js +8 -0
- package/lib/core/OmnichannelErrorCodes.js.map +1 -0
- package/lib/core/PostChatContext.d.ts +6 -0
- package/lib/core/PostChatContext.js +3 -0
- package/lib/core/PostChatContext.js.map +1 -0
- package/lib/core/{IStartChatOptionalParams.d.ts → StartChatOptionalParams.d.ts} +3 -3
- package/lib/core/StartChatOptionalParams.js +3 -0
- package/lib/core/StartChatOptionalParams.js.map +1 -0
- package/lib/core/messaging/ACSChatMessageType.d.ts +7 -0
- package/lib/core/messaging/ACSChatMessageType.js +11 -0
- package/lib/core/messaging/ACSChatMessageType.js.map +1 -0
- package/lib/core/messaging/ACSClient.d.ts +44 -0
- package/lib/core/messaging/ACSClient.js +588 -0
- package/lib/core/messaging/ACSClient.js.map +1 -0
- package/lib/core/messaging/ACSClientConfig.d.ts +4 -0
- package/lib/core/messaging/ACSClientConfig.js +3 -0
- package/lib/core/messaging/ACSClientConfig.js.map +1 -0
- package/lib/core/messaging/ACSParticipantDisplayName.d.ts +6 -0
- package/lib/core/messaging/ACSParticipantDisplayName.js +10 -0
- package/lib/core/messaging/ACSParticipantDisplayName.js.map +1 -0
- package/lib/core/messaging/ACSSessionInfo.d.ts +5 -0
- package/lib/core/messaging/ACSSessionInfo.js +3 -0
- package/lib/core/messaging/ACSSessionInfo.js.map +1 -0
- package/lib/core/{ChatAdapterConfig.d.ts → messaging/ChatAdapterConfig.d.ts} +2 -0
- package/lib/core/{ChatAdapterConfig.js → messaging/ChatAdapterConfig.js} +0 -0
- package/lib/core/messaging/ChatAdapterConfig.js.map +1 -0
- package/lib/core/messaging/ChatAdapterOptionalParams.d.ts +14 -0
- package/lib/core/messaging/ChatAdapterOptionalParams.js +3 -0
- package/lib/core/messaging/ChatAdapterOptionalParams.js.map +1 -0
- package/lib/core/{ChatAdapterProtocols.d.ts → messaging/ChatAdapterProtocols.d.ts} +1 -0
- package/lib/core/{ChatAdapterProtocols.js → messaging/ChatAdapterProtocols.js} +3 -1
- package/lib/core/messaging/ChatAdapterProtocols.js.map +1 -0
- package/lib/core/{IChatSDKMessage.d.ts → messaging/ChatSDKMessage.d.ts} +2 -1
- package/lib/core/messaging/ChatSDKMessage.js +3 -0
- package/lib/core/messaging/ChatSDKMessage.js.map +1 -0
- package/lib/core/{IC3Config.d.ts → messaging/IC3Config.d.ts} +0 -0
- package/lib/core/{IC3Config.js → messaging/IC3Config.js} +0 -0
- package/lib/core/messaging/IC3Config.js.map +1 -0
- package/lib/core/messaging/MessageTags.d.ts +3 -0
- package/lib/core/messaging/MessageTags.js +7 -0
- package/lib/core/messaging/MessageTags.js.map +1 -0
- package/lib/core/messaging/OmnichannelMessage.d.ts +64 -0
- package/lib/core/messaging/OmnichannelMessage.js +52 -0
- package/lib/core/messaging/OmnichannelMessage.js.map +1 -0
- package/lib/core/{OnNewMessageOptionalParams.d.ts → messaging/OnNewMessageOptionalParams.d.ts} +0 -0
- package/lib/core/{OnNewMessageOptionalParams.js → messaging/OnNewMessageOptionalParams.js} +0 -0
- package/lib/core/messaging/OnNewMessageOptionalParams.js.map +1 -0
- package/lib/external/ACSAdapter/AMSFileManager.d.ts +39 -0
- package/lib/external/ACSAdapter/AMSFileManager.js +306 -0
- package/lib/external/ACSAdapter/AMSFileManager.js.map +1 -0
- package/lib/external/ACSAdapter/createChannelDataEgressMiddleware.d.ts +5 -0
- package/lib/external/ACSAdapter/createChannelDataEgressMiddleware.js +34 -0
- package/lib/external/ACSAdapter/createChannelDataEgressMiddleware.js.map +1 -0
- package/lib/external/ACSAdapter/createFormatEgressTagsMiddleware.d.ts +2 -0
- package/lib/external/ACSAdapter/createFormatEgressTagsMiddleware.js +31 -0
- package/lib/external/ACSAdapter/createFormatEgressTagsMiddleware.js.map +1 -0
- package/lib/external/ACSAdapter/createFormatIngressTagsMiddleware.d.ts +2 -0
- package/lib/external/ACSAdapter/createFormatIngressTagsMiddleware.js +25 -0
- package/lib/external/ACSAdapter/createFormatIngressTagsMiddleware.js.map +1 -0
- package/lib/external/CallingSDK/ICallingSDKLogData.d.ts +7 -0
- package/lib/external/CallingSDK/ICallingSDKLogData.js +3 -0
- package/lib/external/CallingSDK/ICallingSDKLogData.js.map +1 -0
- package/lib/external/IC3Adapter/IChatToken.d.ts +2 -0
- package/lib/external/IC3Adapter/IIC3AdapterOptions.d.ts +12 -0
- package/lib/index.d.ts +7 -6
- package/lib/index.js +13 -8
- package/lib/index.js.map +1 -1
- package/lib/telemetry/AriaTelemetry.d.ts +4 -0
- package/lib/telemetry/AriaTelemetry.js +174 -4
- package/lib/telemetry/AriaTelemetry.js.map +1 -1
- package/lib/telemetry/EventMarker.d.ts +3 -0
- package/lib/telemetry/EventMarker.js +13 -0
- package/lib/telemetry/EventMarker.js.map +1 -0
- package/lib/telemetry/ScenarioMarker.d.ts +11 -7
- package/lib/telemetry/ScenarioMarker.js +16 -7
- package/lib/telemetry/ScenarioMarker.js.map +1 -1
- package/lib/telemetry/ScenarioType.d.ts +3 -0
- package/lib/telemetry/ScenarioType.js +3 -0
- package/lib/telemetry/ScenarioType.js.map +1 -1
- package/lib/telemetry/TelemetryEvent.d.ts +7 -4
- package/lib/telemetry/TelemetryEvent.js +6 -10
- package/lib/telemetry/TelemetryEvent.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +5186 -1323
- package/lib/utils/WebUtils.d.ts +3 -1
- package/lib/utils/WebUtils.js +8 -2
- package/lib/utils/WebUtils.js.map +1 -1
- package/lib/utils/createOmnichannelMessage.d.ts +11 -0
- package/lib/utils/createOmnichannelMessage.js +63 -0
- package/lib/utils/createOmnichannelMessage.js.map +1 -0
- package/lib/utils/libraries.d.ts +3 -1
- package/lib/utils/libraries.js +9 -2
- package/lib/utils/libraries.js.map +1 -1
- package/lib/utils/locale.d.ts +4 -0
- package/lib/utils/locale.js +61 -0
- package/lib/utils/locale.js.map +1 -0
- package/lib/utils/loggers.d.ts +67 -6
- package/lib/utils/loggers.js +289 -2
- package/lib/utils/loggers.js.map +1 -1
- package/lib/utils/utilities.js +10 -3
- package/lib/utils/utilities.js.map +1 -1
- package/lib/validators/OmnichannelConfigValidator.d.ts +2 -2
- package/lib/validators/OmnichannelConfigValidator.js.map +1 -1
- package/lib/validators/SDKConfigValidators.d.ts +3 -3
- package/lib/validators/SDKConfigValidators.js.map +1 -1
- package/package.json +5 -1
- package/lib/core/ChatAdapterConfig.js.map +0 -1
- package/lib/core/ChatAdapterProtocols.js.map +0 -1
- package/lib/core/IAuthSettings.js.map +0 -1
- package/lib/core/IC3Config.js.map +0 -1
- package/lib/core/IChatConfig.d.ts +0 -5
- package/lib/core/IChatConfig.js.map +0 -1
- package/lib/core/IChatSDKConfig.js.map +0 -1
- package/lib/core/IChatSDKMessage.js +0 -3
- package/lib/core/IChatSDKMessage.js.map +0 -1
- package/lib/core/IChatTranscriptBody.d.ts +0 -5
- package/lib/core/IChatTranscriptBody.js +0 -3
- package/lib/core/IChatTranscriptBody.js.map +0 -1
- package/lib/core/ILiveChatContext.js +0 -3
- package/lib/core/ILiveChatContext.js.map +0 -1
- package/lib/core/IOmnichannelConfig.js +0 -3
- package/lib/core/IOmnichannelConfig.js.map +0 -1
- package/lib/core/IStartChatOptionalParams.js +0 -3
- package/lib/core/IStartChatOptionalParams.js.map +0 -1
- package/lib/core/MessageTags.d.ts +0 -1
- package/lib/core/MessageTags.js +0 -5
- package/lib/core/MessageTags.js.map +0 -1
- package/lib/core/OnNewMessageOptionalParams.js.map +0 -1
package/CHANGELOG.md
CHANGED
@@ -3,9 +3,42 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
|
4
4
|
## [Unreleased]
|
5
5
|
|
6
|
+
### Added
|
7
|
+
- Add `getPostChatSurveyContext` API method
|
8
|
+
- Add `GetPostChatSurveyContext` telemetry event
|
9
|
+
- Add `widgetId` & `clientMessageId` as metadata on sending message
|
10
|
+
- Update `ChatConfig` interface with `LiveChatVersion`, `allowedFileExtensions` & `maxUploadFileSize` properties
|
11
|
+
- Add ability to automatically detect locale from chat config
|
12
|
+
- Add `runtimeId` attribute in `OmnichannelChatSDK` & `ChatSDKRuntimeId` field in telemetry
|
13
|
+
- Add ability to automatically pass locale from chat config on calling `ChatSDK.emailLiveChatTranscript()`
|
14
|
+
- Bubble up `WidgetUseOutsideOperatingHour` exception
|
15
|
+
- Add `acs_webchat-chat-adapter` middleware to add default `channelData.tags` & `channelData.metadata`
|
16
|
+
- Update `ChatConfig` interface with `msdyn_enablemarkdown` property
|
17
|
+
- Throw exception on `ChatSDK.getVoiceVideoCalling()` if feature is disabled or platform is not supported
|
18
|
+
- Add `participantType` & `canRenderPostChat` as response of getConversationDetails() API
|
19
|
+
- Add support for separate bot post chat survey feature
|
20
|
+
|
21
|
+
### Fix
|
22
|
+
- Add `acs_webchat-chat-adapter` middlewares to format `channelData.tags`
|
23
|
+
- Skip `session init` call on existing conversation
|
24
|
+
- Fix `chat reconnect` not ending the conversation on calling `ChatSDK.endChat()`
|
25
|
+
- Fix on messaging client not sending heartbeat on new conversations subsequent to the first conversation
|
26
|
+
- Fix `ChatSDK.getConversationDetails()` not passing `authenticatedUserToken`
|
27
|
+
- Fix `IC3Client.dispose()` called when `IC3Client` is `undefined`
|
28
|
+
|
29
|
+
### Changed
|
30
|
+
- README: added examples on usages of the post chat APIs.
|
31
|
+
- Uptake [@azure/communication-chat@1.1.1](https://www.npmjs.com/package/@azure/communication-chat/v/1.1.1)
|
32
|
+
- 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)
|
33
|
+
- Update `locale` property in `ChatTranscriptBody` interface to be optional
|
34
|
+
|
35
|
+
## [1.0.0] - 2021-10-08
|
6
36
|
### Added
|
7
37
|
- Add `GetAuthToken` & `GetPreChatSurvey` telemetry events
|
8
38
|
- Add `Domain` telemetry base property
|
39
|
+
- Add `GetCurrentLiveChatContext`, `GetMessages`, `SendMessages`, `OnNewMessage` & `OnTypingEvent` telemetry events
|
40
|
+
- Live Chat V2 Support
|
41
|
+
- Add `PlatformDetails` telemetry event
|
9
42
|
|
10
43
|
### Changed
|
11
44
|
- Uptake [@microsoft/ocsdk@0.3.0](https://www.npmjs.com/package/@microsoft/ocsdk/v/0.3.0)
|
package/README.md
CHANGED
@@ -11,9 +11,10 @@ Please make sure you have a chat widget configured before using this package or
|
|
11
11
|
## Table of Contents
|
12
12
|
- [Live Chat Widget vs. Chat SDK](#live-chat-widget-vs-chat-sdk)
|
13
13
|
- [Installation](#installation)
|
14
|
+
- [Installation on React Native](#installation-on-react-native)
|
14
15
|
- [API Reference](#api-reference)
|
15
16
|
- [API Examples](#api-examples)
|
16
|
-
- [Sample Apps](samples
|
17
|
+
- [Sample Apps](https://github.com/microsoft/omnichannel-chat-sdk-samples)
|
17
18
|
- [Common Scenarios](#common-scenarios)
|
18
19
|
- [Feature Comparisons](#feature-comparisons)
|
19
20
|
- [Telemetry](#telemetry)
|
@@ -34,14 +35,12 @@ Omnichannel offers an live chat widget (LCW) by default. You can use the Chat SD
|
|
34
35
|
| Bring Your Own Widget | ❌ | ✔ | |
|
35
36
|
| Web Support | ✔ | ✔ |
|
36
37
|
| React Native Support | ❌ | ✔ |
|
37
|
-
| Escalation to Voice & Video | ✔ |
|
38
|
-
| Co-browse | ✔ |
|
39
|
-
| Screen Sharing | ✔ |
|
38
|
+
| Escalation to Voice & Video | ✔ | ✔ | Only supported on Web |
|
39
|
+
| Co-browse | ✔ | 3rd party add-on | Only supported on Web |
|
40
|
+
| Screen Sharing | ✔ | 3rd party add-on | Only supported on Web |
|
40
41
|
| Authenticated Chat | ✔ | ✔ |
|
41
42
|
| Pre-chat Survey | ✔ | ✔ |
|
42
|
-
| Post-chat Survey | ✔ |
|
43
|
-
| Queue Position | ✔ | ✔ |
|
44
|
-
| Average Wait Time | ✔ | ✔ |
|
43
|
+
| Post-chat Survey | ✔ | ✔ |
|
45
44
|
| Download Transcript | ✔ | ✔ |
|
46
45
|
| Email Transcript | ✔ | ✔ |
|
47
46
|
| Data Masking | ✔ | ✔ |
|
@@ -51,6 +50,8 @@ Omnichannel offers an live chat widget (LCW) by default. You can use the Chat SD
|
|
51
50
|
| Persistent Chat | ✔ | ✔ |
|
52
51
|
| Chat Reconnect | ✔ | ✔ |
|
53
52
|
| Operating Hours | ✔ | ✔ |
|
53
|
+
| Queue Position | ✔ | ✔ | No SDK method. Handled as *system message* |
|
54
|
+
| Average Wait Time | ✔ | ✔ | No SDK method. Handled as *system message* |
|
54
55
|
|
55
56
|
**\*** BYOI: Bring Your Own Implementation
|
56
57
|
|
@@ -60,6 +61,51 @@ Omnichannel offers an live chat widget (LCW) by default. You can use the Chat SD
|
|
60
61
|
npm install @microsoft/omnichannel-chat-sdk --save
|
61
62
|
```
|
62
63
|
|
64
|
+
## Installation on React Native
|
65
|
+
|
66
|
+
The following steps will be required to run Omnichannel Chat SDK on React Native:
|
67
|
+
|
68
|
+
1. Install `node-libs-react-native`
|
69
|
+
```
|
70
|
+
npm install node-libs-react-native --save-dev
|
71
|
+
```
|
72
|
+
|
73
|
+
1. Install `react-native-randomBytes`
|
74
|
+
```
|
75
|
+
npm install react-native-randombytes --save-dev
|
76
|
+
```
|
77
|
+
|
78
|
+
1. Install `react-native-get-random-values`
|
79
|
+
```
|
80
|
+
npm install react-native-get-random-values --save-dev
|
81
|
+
```
|
82
|
+
|
83
|
+
1. Install `react-native-url-polyfill`
|
84
|
+
```
|
85
|
+
npm install react-native-url-polyfill --save-dev
|
86
|
+
```
|
87
|
+
|
88
|
+
1. Update *metro.config.js* to use React Native compatible Node Core modules
|
89
|
+
```ts
|
90
|
+
module.exports = {
|
91
|
+
// ...
|
92
|
+
resolver: {
|
93
|
+
extraNodeModules: {
|
94
|
+
...require('node-libs-react-native'),
|
95
|
+
net: require.resolve('node-libs-react-native/mock/net'),
|
96
|
+
tls: require.resolve('node-libs-react-native/mock/tls')
|
97
|
+
}
|
98
|
+
}
|
99
|
+
};
|
100
|
+
```
|
101
|
+
|
102
|
+
1. Add following *import* on top of your entry point file
|
103
|
+
```ts
|
104
|
+
import 'node-libs-react-native/globals';
|
105
|
+
import 'react-native-get-random-values';
|
106
|
+
import 'react-native-url-polyfill';
|
107
|
+
```
|
108
|
+
|
63
109
|
## API Reference
|
64
110
|
|
65
111
|
| Method | Description | Notes |
|
@@ -85,8 +131,9 @@ Omnichannel offers an live chat widget (LCW) by default. You can use the Chat SD
|
|
85
131
|
| OmnichannelChatSDK.getLiveChatTranscript() | Get transcript data (JSON) | |
|
86
132
|
| OmnichannelChatSDK.uploadFileAttachment() | Send file attachment | |
|
87
133
|
| OmnichannelChatSDK.downloadFileAttachment() | Download file attachment | |
|
88
|
-
| OmnichannelChatSDK.createChatAdapter() | Get
|
89
|
-
| OmnichannelChatSDK.getVoiceVideoCalling() | Get VoiceVideoCall SDK for Escalation to Voice & Video| **Web only** |
|
134
|
+
| OmnichannelChatSDK.createChatAdapter() | Get Chat Adapter | **Web only** |
|
135
|
+
| OmnichannelChatSDK.getVoiceVideoCalling() | Get VoiceVideoCall SDK for Escalation to Voice & Video | **Web only** |
|
136
|
+
| OmnichannelChatSDK.getPostChatSurveyContext() | Get post chat survey link, survey locale, and whether an agent has joined the survey | |
|
90
137
|
|
91
138
|
## API examples
|
92
139
|
|
@@ -164,6 +211,21 @@ Omnichannel offers an live chat widget (LCW) by default. You can use the Chat SD
|
|
164
211
|
const preChatSurvey = await getPreChatSurvey(parseToJSON); // Adaptive Cards payload data as string
|
165
212
|
```
|
166
213
|
|
214
|
+
### Get PostChat Survey
|
215
|
+
```ts
|
216
|
+
try {
|
217
|
+
const context = await chatSDK.getPostChatSurveyContext();
|
218
|
+
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.
|
219
|
+
// formsProLocale is the default language you have set on the CustomerVoice portal. You can override this url parameter with any locale that CustomerVoice supports.
|
220
|
+
// If "&lang=" is not set on the url, the locale will be English.
|
221
|
+
const linkToSend = context.surveyInviteLink + "&lang=" + context.formsProLocale;
|
222
|
+
// This link is accessible and will redirect to the survey page. Use it as you see fit.
|
223
|
+
}
|
224
|
+
} catch (ex) {
|
225
|
+
// If the post chat should not be shown by any reason (e.g. post chat is not enabled), promise will be rejected.
|
226
|
+
}
|
227
|
+
```
|
228
|
+
|
167
229
|
### Start Chat
|
168
230
|
```ts
|
169
231
|
const customContext = {
|
@@ -273,8 +335,7 @@ Omnichannel offers an live chat widget (LCW) by default. You can use the Chat SD
|
|
273
335
|
```ts
|
274
336
|
const body = {
|
275
337
|
emailAddress: 'contoso@microsoft.com',
|
276
|
-
attachmentMessage: 'Attachment Message'
|
277
|
-
locale: 'en-us'
|
338
|
+
attachmentMessage: 'Attachment Message'
|
278
339
|
};
|
279
340
|
await chatSDK.emailLiveChatTranscript(body);
|
280
341
|
```
|
@@ -535,82 +596,93 @@ Omnichannel offers an live chat widget (LCW) by default. You can use the Chat SD
|
|
535
596
|
console.log("VoiceVideoCalling loaded");
|
536
597
|
} catch (e) {
|
537
598
|
console.log(`Failed to load VoiceVideoCalling: ${e}`);
|
599
|
+
|
600
|
+
if (e.message === 'UnsupportedPlatform') {
|
601
|
+
// Voice Video Calling feature is not supported on this platform
|
602
|
+
}
|
603
|
+
|
604
|
+
if (e.message === 'FeatureDisabled') {
|
605
|
+
// Voice Video Calling feature is disabled on admin side
|
606
|
+
}
|
538
607
|
}
|
539
608
|
|
540
609
|
await chatSDK.startChat();
|
541
610
|
|
542
611
|
const chatToken: any = await chatSDK.getChatToken();
|
543
612
|
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
613
|
+
// Initialize only if VoiceVideoCallingSDK is defined
|
614
|
+
if (VoiceVideoCallingSDK) {
|
615
|
+
try {
|
616
|
+
await VoiceVideoCallingSDK.initialize({
|
617
|
+
chatToken,
|
618
|
+
selfVideoHTMLElementId: 'selfVideo', // HTML element id where video stream of the agent will be rendered
|
619
|
+
remoteVideoHTMLElementId: 'remoteVideo', // HTML element id where video stream of the customer will be rendered
|
620
|
+
OCClient: chatSDK.OCClient
|
621
|
+
});
|
622
|
+
} catch (e) {
|
623
|
+
console.error("Failed to initialize VoiceVideoCalling!");
|
624
|
+
}
|
554
625
|
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
626
|
+
// Triggered when there's an incoming call
|
627
|
+
VoiceVideoCallingSDK.onCallAdded(() => {
|
628
|
+
...
|
629
|
+
});
|
559
630
|
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
631
|
+
// Triggered when local video stream is available (e.g.: Local video added succesfully in selfVideoHTMLElement)
|
632
|
+
VoiceVideoCallingSDK.onLocalVideoStreamAdded(() => {
|
633
|
+
...
|
634
|
+
});
|
564
635
|
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
636
|
+
// Triggered when local video stream is unavailable (e.g.: Customer turning off local video)
|
637
|
+
VoiceVideoCallingSDK.onLocalVideoStreamRemoved(() => {
|
638
|
+
...
|
639
|
+
});
|
569
640
|
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
641
|
+
// Triggered when remote video stream is available (e.g.: Remote video added succesfully in remoteVideoHTMLElement)
|
642
|
+
VoiceVideoCallingSDK.onRemoteVideoStreamAdded(() => {
|
643
|
+
...
|
644
|
+
});
|
574
645
|
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
646
|
+
// Triggered when remote video stream is unavailable (e.g.: Agent turning off remote video)
|
647
|
+
VoiceVideoCallingSDK.onRemoteVideoStreamRemoved(() => {
|
648
|
+
...
|
649
|
+
});
|
579
650
|
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
651
|
+
// Triggered when current call has ended or disconnected regardless the party
|
652
|
+
VoiceVideoCalling.onCallDisconnected(() => {
|
653
|
+
...
|
654
|
+
});
|
584
655
|
|
585
|
-
|
586
|
-
|
656
|
+
// Check if microphone is muted
|
657
|
+
const isMicrophoneMuted = VoiceVideoCallingSDK.isMicrophoneMuted();
|
587
658
|
|
588
|
-
|
589
|
-
|
659
|
+
// Check if remote video is available
|
660
|
+
const isRemoteVideoEnabled = VoiceVideoCallingSDK.isRemoteVideoEnabled();
|
590
661
|
|
591
|
-
|
592
|
-
|
662
|
+
// Check if local video is available
|
663
|
+
const isLocalVideoEnabled = VoiceVideoCallingSDK.isLocalVideoEnabled();
|
593
664
|
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
665
|
+
// Accepts incoming call
|
666
|
+
const acceptCallConfig = {
|
667
|
+
withVideo: true // Accept call with/without video stream
|
668
|
+
};
|
669
|
+
await VoiceVideoCallingSDK.acceptCall(acceptCallConfig);
|
599
670
|
|
600
|
-
|
601
|
-
|
671
|
+
// Rejects incoming call
|
672
|
+
await VoiceVideoCallingSDK.rejectCall();
|
602
673
|
|
603
|
-
|
604
|
-
|
674
|
+
// Ends/Stops current call
|
675
|
+
await VoiceVideoCallingSDK.stopCall();
|
605
676
|
|
606
|
-
|
607
|
-
|
677
|
+
// Mute/Unmute current call
|
678
|
+
await VoiceVideoCallingSDK.toggleMute()
|
608
679
|
|
609
|
-
|
610
|
-
|
680
|
+
// Display/Hide local video of current call
|
681
|
+
await VoiceVideoCallingSDK.toggleLocalVideo()
|
611
682
|
|
612
|
-
|
613
|
-
|
683
|
+
// Clean up VoiceVideoCallingSDK (e.g.: Usually called when customer ends chat session)
|
684
|
+
VoiceVideoCallingSDK.close();
|
685
|
+
}
|
614
686
|
```
|
615
687
|
|
616
688
|
## Feature Comparisons
|
@@ -1,32 +1,44 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
1
|
+
import ACSClient from "./core/messaging/ACSClient";
|
2
|
+
import { ParticipantsRemovedEvent } from '@azure/communication-signaling';
|
3
|
+
import ChatAdapterOptionalParams from "./core/messaging/ChatAdapterOptionalParams";
|
4
|
+
import ChatConfig from "./core/ChatConfig";
|
5
|
+
import ChatReconnectContext from "./core/ChatReconnectContext";
|
6
|
+
import ChatReconnectOptionalParams from "./core/ChatReconnectOptionalParams";
|
7
|
+
import ChatSDKConfig from "./core/ChatSDKConfig";
|
8
|
+
import ChatSDKMessage from "./core/messaging/ChatSDKMessage";
|
9
|
+
import ChatTranscriptBody from "./core/ChatTranscriptBody";
|
10
|
+
import FileMetadata from "@microsoft/omnichannel-amsclient/lib/FileMetadata";
|
11
|
+
import FramedClient from "@microsoft/omnichannel-amsclient/lib/FramedClient";
|
12
|
+
import FramedlessClient from "@microsoft/omnichannel-amsclient/lib/FramedlessClient";
|
4
13
|
import IChatToken from "./external/IC3Adapter/IChatToken";
|
5
|
-
import IChatTranscriptBody from "./core/IChatTranscriptBody";
|
6
14
|
import IFileInfo from "@microsoft/omnichannel-ic3core/lib/interfaces/IFileInfo";
|
7
15
|
import IFileMetadata from "@microsoft/omnichannel-ic3core/lib/model/IFileMetadata";
|
8
|
-
import ILiveChatContext from "./core/ILiveChatContext";
|
9
16
|
import IMessage from "@microsoft/omnichannel-ic3core/lib/model/IMessage";
|
10
|
-
import IOmnichannelConfig from "./core/IOmnichannelConfig";
|
11
17
|
import IRawMessage from "@microsoft/omnichannel-ic3core/lib/model/IRawMessage";
|
12
18
|
import IRawThread from "@microsoft/omnichannel-ic3core/lib/interfaces/IRawThread";
|
13
|
-
import
|
19
|
+
import LiveChatContext from "./core/LiveChatContext";
|
14
20
|
import LiveWorkItemDetails from "./core/LiveWorkItemDetails";
|
15
|
-
import
|
16
|
-
import
|
17
|
-
import
|
21
|
+
import OmnichannelConfig from "./core/OmnichannelConfig";
|
22
|
+
import OmnichannelMessage from "./core/messaging/OmnichannelMessage";
|
23
|
+
import OnNewMessageOptionalParams from "./core/messaging/OnNewMessageOptionalParams";
|
24
|
+
import StartChatOptionalParams from "./core/StartChatOptionalParams";
|
18
25
|
declare class OmnichannelChatSDK {
|
19
26
|
private debug;
|
27
|
+
runtimeId: string;
|
20
28
|
OCSDKProvider: unknown;
|
21
29
|
IC3SDKProvider: unknown;
|
22
30
|
OCClient: any;
|
23
31
|
IC3Client: any;
|
24
|
-
|
25
|
-
|
32
|
+
ACSClient: ACSClient | null;
|
33
|
+
AMSClient: FramedClient | FramedlessClient | null;
|
34
|
+
omnichannelConfig: OmnichannelConfig;
|
35
|
+
chatSDKConfig: ChatSDKConfig;
|
26
36
|
isInitialized: boolean;
|
37
|
+
localeId: string;
|
27
38
|
requestId: string;
|
28
39
|
private chatToken;
|
29
40
|
private liveChatConfig;
|
41
|
+
private liveChatVersion;
|
30
42
|
private dataMaskingRules;
|
31
43
|
private authSettings;
|
32
44
|
private authenticatedUserToken;
|
@@ -37,43 +49,48 @@ declare class OmnichannelChatSDK {
|
|
37
49
|
private scenarioMarker;
|
38
50
|
private ic3ClientLogger;
|
39
51
|
private ocSdkLogger;
|
52
|
+
private acsClientLogger;
|
53
|
+
private acsAdapterLogger;
|
54
|
+
private callingSdkLogger;
|
40
55
|
private isPersistentChat;
|
41
56
|
private isChatReconnect;
|
42
57
|
private reconnectId;
|
43
58
|
private refreshTokenTimer;
|
44
|
-
constructor(omnichannelConfig:
|
59
|
+
constructor(omnichannelConfig: OmnichannelConfig, chatSDKConfig?: ChatSDKConfig);
|
45
60
|
setDebug(flag: boolean): void;
|
46
|
-
initialize(): Promise<
|
61
|
+
initialize(): Promise<ChatConfig>;
|
47
62
|
getChatReconnectContext(optionalParams?: ChatReconnectOptionalParams): Promise<ChatReconnectContext>;
|
48
|
-
startChat(optionalParams?:
|
63
|
+
startChat(optionalParams?: StartChatOptionalParams): Promise<void>;
|
49
64
|
endChat(): Promise<void>;
|
50
|
-
getCurrentLiveChatContext(): Promise<
|
65
|
+
getCurrentLiveChatContext(): Promise<LiveChatContext | {}>;
|
51
66
|
getConversationDetails(): Promise<LiveWorkItemDetails>;
|
52
67
|
/**
|
53
68
|
* Gets PreChat Survey.
|
54
69
|
* @param parse Whether to parse PreChatSurvey to JSON or not.
|
55
70
|
*/
|
56
71
|
getPreChatSurvey(parse?: boolean): Promise<any>;
|
57
|
-
getLiveChatConfig(cached?: boolean): Promise<
|
72
|
+
getLiveChatConfig(cached?: boolean): Promise<ChatConfig>;
|
58
73
|
getChatToken(cached?: boolean): Promise<IChatToken>;
|
59
74
|
getCallingToken(): Promise<string>;
|
60
|
-
getMessages(): Promise<IMessage[] | undefined>;
|
75
|
+
getMessages(): Promise<IMessage[] | OmnichannelMessage[] | undefined>;
|
61
76
|
getDataMaskingRules(): Promise<any>;
|
62
|
-
sendMessage(message:
|
77
|
+
sendMessage(message: ChatSDKMessage): Promise<void>;
|
63
78
|
onNewMessage(onNewMessageCallback: CallableFunction, optionalParams?: OnNewMessageOptionalParams | unknown): Promise<void>;
|
64
79
|
sendTypingEvent(): Promise<void>;
|
65
80
|
onTypingEvent(onTypingEventCallback: CallableFunction): Promise<void>;
|
66
|
-
onAgentEndSession(onAgentEndSessionCallback: (message: IRawThread) => void): Promise<void>;
|
67
|
-
uploadFileAttachment(fileInfo: IFileInfo | File): Promise<IRawMessage>;
|
68
|
-
downloadFileAttachment(fileMetadata: IFileMetadata): Promise<Blob>;
|
69
|
-
emailLiveChatTranscript(body:
|
81
|
+
onAgentEndSession(onAgentEndSessionCallback: (message: IRawThread | ParticipantsRemovedEvent) => void): Promise<void>;
|
82
|
+
uploadFileAttachment(fileInfo: IFileInfo | File): Promise<IRawMessage | OmnichannelMessage>;
|
83
|
+
downloadFileAttachment(fileMetadata: FileMetadata | IFileMetadata): Promise<Blob>;
|
84
|
+
emailLiveChatTranscript(body: ChatTranscriptBody): Promise<any>;
|
70
85
|
getLiveChatTranscript(): Promise<any>;
|
71
|
-
createChatAdapter(
|
86
|
+
createChatAdapter(optionalParams?: ChatAdapterOptionalParams): Promise<unknown>;
|
72
87
|
getVoiceVideoCalling(params?: any): Promise<any>;
|
88
|
+
getPostChatSurveyContext(): Promise<any>;
|
73
89
|
private getIC3Client;
|
74
90
|
private getChatConfig;
|
75
91
|
private resolveIC3ClientUrl;
|
76
92
|
private resolveChatAdapterUrl;
|
77
93
|
private updateChatToken;
|
94
|
+
private setAuthTokenProvider;
|
78
95
|
}
|
79
96
|
export default OmnichannelChatSDK;
|