@microsoft/omnichannel-chat-sdk 0.2.1-main.f5ff432 → 0.3.1-main.577db56

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 (132) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/README.md +165 -9
  3. package/lib/OmnichannelChatSDK.d.ts +39 -22
  4. package/lib/OmnichannelChatSDK.js +1032 -335
  5. package/lib/OmnichannelChatSDK.js.map +1 -1
  6. package/lib/api/createVoiceVideoCalling.d.ts +1 -0
  7. package/lib/api/createVoiceVideoCalling.js +91 -83
  8. package/lib/api/createVoiceVideoCalling.js.map +1 -1
  9. package/lib/config/settings.d.ts +4 -3
  10. package/lib/config/settings.js +5 -3
  11. package/lib/config/settings.js.map +1 -1
  12. package/lib/core/{IAuthSettings.d.ts → AuthSettings.d.ts} +1 -1
  13. package/lib/core/{IAuthSettings.js → AuthSettings.js} +1 -1
  14. package/lib/core/AuthSettings.js.map +1 -0
  15. package/lib/core/{IChatConfig.d.ts → ChatConfig.d.ts} +1 -1
  16. package/lib/core/{IChatConfig.js → ChatConfig.js} +1 -1
  17. package/lib/core/ChatConfig.js.map +1 -0
  18. package/lib/core/ChatReconnectContext.d.ts +4 -0
  19. package/lib/core/ChatReconnectContext.js +3 -0
  20. package/lib/core/ChatReconnectContext.js.map +1 -0
  21. package/lib/core/ChatReconnectOptionalParams.d.ts +3 -0
  22. package/lib/core/ChatReconnectOptionalParams.js +3 -0
  23. package/lib/core/ChatReconnectOptionalParams.js.map +1 -0
  24. package/lib/core/{IChatSDKConfig.d.ts → ChatSDKConfig.d.ts} +11 -7
  25. package/lib/core/{IChatSDKConfig.js → ChatSDKConfig.js} +1 -1
  26. package/lib/core/ChatSDKConfig.js.map +1 -0
  27. package/lib/core/{IChatTranscriptBody.d.ts → ChatTranscriptBody.d.ts} +1 -1
  28. package/lib/core/ChatTranscriptBody.js +3 -0
  29. package/lib/core/ChatTranscriptBody.js.map +1 -0
  30. package/lib/core/{ILiveChatContext.d.ts → LiveChatContext.d.ts} +1 -1
  31. package/lib/core/LiveChatContext.js +3 -0
  32. package/lib/core/LiveChatContext.js.map +1 -0
  33. package/lib/core/LiveChatVersion.d.ts +5 -0
  34. package/lib/core/LiveChatVersion.js +9 -0
  35. package/lib/core/LiveChatVersion.js.map +1 -0
  36. package/lib/core/{IOmnichannelConfig.d.ts → OmnichannelConfig.d.ts} +1 -1
  37. package/lib/core/OmnichannelConfig.js +3 -0
  38. package/lib/core/OmnichannelConfig.js.map +1 -0
  39. package/lib/core/{IStartChatOptionalParams.d.ts → StartChatOptionalParams.d.ts} +4 -3
  40. package/lib/core/StartChatOptionalParams.js +3 -0
  41. package/lib/core/StartChatOptionalParams.js.map +1 -0
  42. package/lib/core/messaging/ACSChatMessageType.d.ts +7 -0
  43. package/lib/core/messaging/ACSChatMessageType.js +11 -0
  44. package/lib/core/messaging/ACSChatMessageType.js.map +1 -0
  45. package/lib/core/messaging/ACSClient.d.ts +44 -0
  46. package/lib/core/messaging/ACSClient.js +588 -0
  47. package/lib/core/messaging/ACSClient.js.map +1 -0
  48. package/lib/core/messaging/ACSClientConfig.d.ts +4 -0
  49. package/lib/core/messaging/ACSClientConfig.js +3 -0
  50. package/lib/core/messaging/ACSClientConfig.js.map +1 -0
  51. package/lib/core/messaging/ACSParticipantDisplayName.d.ts +6 -0
  52. package/lib/core/messaging/ACSParticipantDisplayName.js +10 -0
  53. package/lib/core/messaging/ACSParticipantDisplayName.js.map +1 -0
  54. package/lib/core/messaging/ACSSessionInfo.d.ts +5 -0
  55. package/lib/core/messaging/ACSSessionInfo.js +3 -0
  56. package/lib/core/messaging/ACSSessionInfo.js.map +1 -0
  57. package/lib/core/{ChatAdapterConfig.d.ts → messaging/ChatAdapterConfig.d.ts} +2 -0
  58. package/lib/core/{ChatAdapterConfig.js → messaging/ChatAdapterConfig.js} +0 -0
  59. package/lib/core/messaging/ChatAdapterConfig.js.map +1 -0
  60. package/lib/core/{ChatAdapterProtocols.d.ts → messaging/ChatAdapterProtocols.d.ts} +1 -0
  61. package/lib/core/{ChatAdapterProtocols.js → messaging/ChatAdapterProtocols.js} +3 -1
  62. package/lib/core/messaging/ChatAdapterProtocols.js.map +1 -0
  63. package/lib/core/{IChatSDKMessage.d.ts → messaging/ChatSDKMessage.d.ts} +2 -1
  64. package/lib/core/messaging/ChatSDKMessage.js +3 -0
  65. package/lib/core/messaging/ChatSDKMessage.js.map +1 -0
  66. package/lib/core/{IC3Config.d.ts → messaging/IC3Config.d.ts} +0 -0
  67. package/lib/core/{IC3Config.js → messaging/IC3Config.js} +0 -0
  68. package/lib/core/messaging/IC3Config.js.map +1 -0
  69. package/lib/core/messaging/MessageTags.d.ts +1 -0
  70. package/lib/core/messaging/MessageTags.js +5 -0
  71. package/lib/core/messaging/MessageTags.js.map +1 -0
  72. package/lib/core/messaging/OmnichannelMessage.d.ts +64 -0
  73. package/lib/core/messaging/OmnichannelMessage.js +52 -0
  74. package/lib/core/messaging/OmnichannelMessage.js.map +1 -0
  75. package/lib/core/{OnNewMessageOptionalParams.d.ts → messaging/OnNewMessageOptionalParams.d.ts} +0 -0
  76. package/lib/core/{OnNewMessageOptionalParams.js → messaging/OnNewMessageOptionalParams.js} +0 -0
  77. package/lib/core/messaging/OnNewMessageOptionalParams.js.map +1 -0
  78. package/lib/external/ACSAdapter/AMSFileManager.d.ts +39 -0
  79. package/lib/external/ACSAdapter/AMSFileManager.js +306 -0
  80. package/lib/external/ACSAdapter/AMSFileManager.js.map +1 -0
  81. package/lib/external/IC3Adapter/IChatToken.d.ts +2 -0
  82. package/lib/index.d.ts +2 -2
  83. package/lib/telemetry/AriaTelemetry.d.ts +4 -0
  84. package/lib/telemetry/AriaTelemetry.js +150 -13
  85. package/lib/telemetry/AriaTelemetry.js.map +1 -1
  86. package/lib/telemetry/EventMarker.d.ts +3 -0
  87. package/lib/telemetry/EventMarker.js +13 -0
  88. package/lib/telemetry/EventMarker.js.map +1 -0
  89. package/lib/telemetry/ScenarioMarker.d.ts +9 -7
  90. package/lib/telemetry/ScenarioMarker.js +12 -7
  91. package/lib/telemetry/ScenarioMarker.js.map +1 -1
  92. package/lib/telemetry/ScenarioType.d.ts +2 -0
  93. package/lib/telemetry/ScenarioType.js +2 -0
  94. package/lib/telemetry/ScenarioType.js.map +1 -1
  95. package/lib/telemetry/TelemetryEvent.d.ts +10 -4
  96. package/lib/telemetry/TelemetryEvent.js +9 -10
  97. package/lib/telemetry/TelemetryEvent.js.map +1 -1
  98. package/lib/tsconfig.tsbuildinfo +5378 -1320
  99. package/lib/utils/createOmnichannelMessage.d.ts +11 -0
  100. package/lib/utils/createOmnichannelMessage.js +63 -0
  101. package/lib/utils/createOmnichannelMessage.js.map +1 -0
  102. package/lib/utils/libraries.d.ts +3 -1
  103. package/lib/utils/libraries.js +9 -2
  104. package/lib/utils/libraries.js.map +1 -1
  105. package/lib/utils/loggers.d.ts +42 -6
  106. package/lib/utils/loggers.js +197 -2
  107. package/lib/utils/loggers.js.map +1 -1
  108. package/lib/utils/utilities.js +10 -3
  109. package/lib/utils/utilities.js.map +1 -1
  110. package/lib/validators/OmnichannelConfigValidator.d.ts +2 -2
  111. package/lib/validators/OmnichannelConfigValidator.js.map +1 -1
  112. package/lib/validators/SDKConfigValidators.d.ts +3 -3
  113. package/lib/validators/SDKConfigValidators.js +11 -0
  114. package/lib/validators/SDKConfigValidators.js.map +1 -1
  115. package/package.json +14 -10
  116. package/lib/core/ChatAdapterConfig.js.map +0 -1
  117. package/lib/core/ChatAdapterProtocols.js.map +0 -1
  118. package/lib/core/IAuthSettings.js.map +0 -1
  119. package/lib/core/IC3Config.js.map +0 -1
  120. package/lib/core/IChatConfig.js.map +0 -1
  121. package/lib/core/IChatSDKConfig.js.map +0 -1
  122. package/lib/core/IChatSDKMessage.js +0 -3
  123. package/lib/core/IChatSDKMessage.js.map +0 -1
  124. package/lib/core/IChatTranscriptBody.js +0 -3
  125. package/lib/core/IChatTranscriptBody.js.map +0 -1
  126. package/lib/core/ILiveChatContext.js +0 -3
  127. package/lib/core/ILiveChatContext.js.map +0 -1
  128. package/lib/core/IOmnichannelConfig.js +0 -3
  129. package/lib/core/IOmnichannelConfig.js.map +0 -1
  130. package/lib/core/IStartChatOptionalParams.js +0 -3
  131. package/lib/core/IStartChatOptionalParams.js.map +0 -1
  132. package/lib/core/OnNewMessageOptionalParams.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,14 +2,47 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
4
  ## [Unreleased]
5
+
6
+ ### Added
7
+ - Add `GetAuthToken` & `GetPreChatSurvey` telemetry events
8
+ - Add `Domain` telemetry base property
9
+ - Add `GetCurrentLiveChatContext`, `GetMessages`, `SendMessages`, `OnNewMessage` & `OnTypingEvent ` telemetry events
10
+ - Live Chat V2 Support
11
+
12
+ ### Changed
13
+ - Uptake [@microsoft/ocsdk@0.3.0](https://www.npmjs.com/package/@microsoft/ocsdk/v/0.3.0)
14
+ - Uptake [@microsoft/omnichannel-ic3core@0.1.2](https://www.npmjs.com/package/@microsoft/omnichannel-ic3core/v/0.1.2)
15
+
16
+ ### Fixed
17
+ - `onNewMessage` with `rehydrate` flag set to `true` crashing when `getMessages` returns `undefined`
18
+ - Fix `AriaTelemetry` unable to read property `logEvent` of undefined on `React Native`
19
+ - Fix `Escalation to Voice & Video` library not being imported properly
20
+
21
+ ## [0.3.0] - 2021-09-03
22
+ ### Added
23
+ - Persistent Chat Support
24
+ - Chat Reconnect Support
25
+ - Operating Hours Documentation
26
+
5
27
  ### Changed
6
28
  - Uptake [@microsoft/ocsdk@0.2.0](https://www.npmjs.com/package/@microsoft/ocsdk/v/0.2.0)
7
29
  - Add `getCallingToken`
30
+ - Send `ChannelId-lcw` message tag
31
+ - Uptake [IC3Client@2021.08.14.1](https://comms.omnichannelengagementhub.com/release/2021.08.14.1/Scripts/SDK/SDK.min.js)
32
+ - Uptake [botframework-webchat-adapter-ic3@0.1.0-master.2dba07b](https://www.npmjs.com/package/botframework-webchat-adapter-ic3/v/0.1.0-master.2dba07b)
33
+ - Uptake [jest@27.1.0](https://www.npmjs.com/package/jest/v/27.1.0)
34
+ - Update [@types/jest@27.0.1](https://www.npmjs.com/package/@types/jest/v/27.0.1)
35
+ - Uptake [ts-jest@27.0.5](https://www.npmjs.com/package/ts-jest/v/27.0.5)
36
+
37
+ ### Fixed
38
+ - `msdyn_enablechatreconnect` not being parsed properly
39
+ - Fix unable to start multiple conversations with same instance due to chat client being disposed
40
+ - Pass logger to adapter
8
41
 
9
42
  ## [0.2.0] - 2021-04-30
10
43
  ### Added
11
44
  - React Native sample app using Omnichannel Chat SDK with [react-native-gifted-chat](https://github.com/FaridSafi/react-native-gifted-chat)
12
- - Escalation to Voice & View support (Web Only)
45
+ - Escalation to Voice & Video support (Web Only)
13
46
  - React sample app using Omnichannel Chat SDK with [BotFramework-WebChat](https://github.com/microsoft/BotFramework-WebChat)
14
47
  - Expose `sessiontInit`'s `initContext` on `startChat`'s optional paramaters
15
48
  - Add ability to use custom `ic3Config` & `chatAdapterConfig`
package/README.md CHANGED
@@ -2,6 +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
  ![Release CI](https://github.com/microsoft/omnichannel-chat-sdk/workflows/Release%20CI/badge.svg)
5
+ ![npm](https://img.shields.io/npm/dm/@microsoft/omnichannel-chat-sdk)
5
6
 
6
7
  Headless Chat SDK to build your own chat widget against Dynamics 365 Omnichannel Services.
7
8
 
@@ -10,12 +11,14 @@ Please make sure you have a chat widget configured before using this package or
10
11
  ## Table of Contents
11
12
  - [Live Chat Widget vs. Chat SDK](#live-chat-widget-vs-chat-sdk)
12
13
  - [Installation](#installation)
14
+ - [Installation on React Native](#installation-on-react-native)
13
15
  - [API Reference](#api-reference)
14
16
  - [API Examples](#api-examples)
15
17
  - [Sample Apps](samples/)
16
18
  - [Common Scenarios](#common-scenarios)
17
19
  - [Feature Comparisons](#feature-comparisons)
18
20
  - [Telemetry](#telemetry)
21
+ - [Troubleshooting Guide](docs/TROUBLESHOOTING_GUIDE.md)
19
22
 
20
23
  ## Live Chat Widget vs. Chat SDK
21
24
 
@@ -46,6 +49,9 @@ Omnichannel offers an live chat widget (LCW) by default. You can use the Chat SD
46
49
  | File Attachments | ✔ | ✔ |
47
50
  | Custom Context | ✔ | ✔ |
48
51
  | Proactive Chat | ✔ | BYOI **\*** |
52
+ | Persistent Chat | ✔ | ✔ |
53
+ | Chat Reconnect | ✔ | ✔ |
54
+ | Operating Hours | ✔ | ✔ |
49
55
 
50
56
  **\*** BYOI: Bring Your Own Implementation
51
57
 
@@ -55,6 +61,35 @@ Omnichannel offers an live chat widget (LCW) by default. You can use the Chat SD
55
61
  npm install @microsoft/omnichannel-chat-sdk --save
56
62
  ```
57
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. Run `npm install node-libs-react-native --save-dev`
69
+ 1. Update *metro.config.js* to use React Native compatible Node Core modules
70
+ ```ts
71
+ module.exports = {
72
+ // ...
73
+ resolver: {
74
+ extraNodeModules: {
75
+ ...require('node-libs-react-native'),
76
+ net: require.resolve('node-libs-react-native/mock/net'),
77
+ tls: require.resolve('node-libs-react-native/mock/tls')
78
+ }
79
+ }
80
+ };
81
+ ```
82
+
83
+ 1. Import 'node-libs-react-native/globals' on top of your entry point file
84
+ ```ts
85
+ import 'node-libs-react-native/globals';
86
+ ```
87
+
88
+ 1. Install `react-native-randomBytes`
89
+ ```
90
+ npm install react-native-randombytes --save-dev
91
+ ```
92
+
58
93
  ## API Reference
59
94
 
60
95
  | Method | Description | Notes |
@@ -66,6 +101,7 @@ Omnichannel offers an live chat widget (LCW) by default. You can use the Chat SD
66
101
  | OmnichannelChatSDK.getLiveChatConfig() | Get live chat config | |
67
102
  | OmnichannelChatSDK.getDataMaskingRules() | Get active data masking rules | |
68
103
  | OmnichannelChatSDK.getCurrentLiveChatContext() | Get current live chat context information to reconnect to the same chat | |
104
+ | OmnichannelChatSDK.getChatReconnectContext() | Get current reconnectable chat context information to reconnect to a previous existing chat session | |
69
105
  | OmnichannelChatSDK.getConversationDetails() | Get details of the current conversation such as its state & when the agent joined the conversation | |
70
106
  | OmnichannelChatSDK.getChatToken() | Get chat token | |
71
107
  | OmnichannelChatSDK.getCallingToken() | Get calling token | |
@@ -113,6 +149,15 @@ Omnichannel offers an live chat widget (LCW) by default. You can use the Chat SD
113
149
  const liveChatContext = await chatSDK.getCurrentLiveChatContext();
114
150
  ```
115
151
 
152
+ ### Get Current Chat Reconnect Context
153
+ ```ts
154
+ const optionalParams = {
155
+ reconnectId: '', // reconnect Id
156
+ };
157
+
158
+ const chatReconnectContext = await chatSDK.getChatReconnectContext(optionalParams);
159
+ ```
160
+
116
161
  ### Get Conversation Details
117
162
  ```ts
118
163
  const conversationDetails = await chatSDK.getConversationDetails();
@@ -351,6 +396,125 @@ Omnichannel offers an live chat widget (LCW) by default. You can use the Chat SD
351
396
  // from this point, this acts like a regular chat widget
352
397
  ```
353
398
 
399
+ ### Persistent Chat
400
+
401
+ ```ts
402
+ const chatSDKConfig = {
403
+ persistentChat: {
404
+ disable: false,
405
+ tokenUpdateTime: 21600000
406
+ },
407
+ getAuthToken: async () => {
408
+ const response = await fetch("http://contosohelp.com/token");
409
+ if (response.ok) {
410
+ return await response.text();
411
+ }
412
+ else {
413
+ return null
414
+ }
415
+ }
416
+ }
417
+
418
+ const chatSDK = new OmnichannelChatSDK.OmnichannelChatSDK(omnichannelConfig, chatSDKConfig);
419
+ await chatSDK.initialize();
420
+
421
+ // from this point, this acts like a persistent chat
422
+ ```
423
+ ### Chat Reconnect with Authenticated User
424
+
425
+ ```ts
426
+ const chatSDKConfig = {
427
+ chatReconnect: {
428
+ disable: false,
429
+ },
430
+ getAuthToken: async () => {
431
+ const response = await fetch("http://contosohelp.com/token");
432
+ if (response.ok) {
433
+ return await response.text();
434
+ }
435
+ else {
436
+ return null
437
+ }
438
+ }
439
+ }
440
+
441
+ const chatSDK = new OmnichannelChatSDK.OmnichannelChatSDK(omnichannelConfig, chatSDKConfig);
442
+ await chatSDK.initialize();
443
+
444
+ ...
445
+
446
+ const chatReconnectContext = await chatSDK.getChatReconnectContext();
447
+
448
+ if (chatReconnectContext.reconnectId) {
449
+ // Add UX with options to reconnect to previous existing chat or start new chat
450
+ }
451
+
452
+ // Reconnect chat option
453
+ const optionalParams = {};
454
+ optionalParams.reconnectId = chatReconnectContext.reconnectId;
455
+ chatSDK.startChat(optionalParams);
456
+
457
+ // Start new chat option
458
+ chatSDK.startChat();
459
+ ```
460
+
461
+ ### Chat Reconnect with Unauthenticated User
462
+
463
+ ```ts
464
+ const chatSDKConfig = {
465
+ chatReconnect: {
466
+ disable: false,
467
+ },
468
+ }
469
+
470
+ const chatSDK = new OmnichannelChatSDK.OmnichannelChatSDK(omnichannelConfig, chatSDKConfig);
471
+ await chatSDK.initialize();
472
+
473
+ ....
474
+
475
+ const optionalParams: any = {};
476
+
477
+ // Retrieve reconnect id from the URL
478
+ const urlParams = new URLSearchParams(window.location.search);
479
+ const reconnectId = urlParams.get('oc.reconnectid');
480
+
481
+ const params = {
482
+ reconnectId
483
+ };
484
+
485
+ // Validate reconnect id
486
+ const chatReconnectContext = await chatSDK.getChatReconnectContext(params);
487
+
488
+ // If the reconnect id is invalid or expired, redirect URL if there is any URL set in the configuration
489
+ if (chatReconnectContext.redirectURL) {
490
+ window.location.replace(chatReconnectContext.redirectURL);
491
+ }
492
+
493
+ // Valid reconnect id, reconnect to previous chat
494
+ if (chatReconnectContext.reconnectId) {
495
+ await chatSDK.startChat({
496
+ reconnectId: chatReconnectContext.reconnectId
497
+ });
498
+ } else { // Reconnect id from URL is not valid, start new chat session
499
+ await chatSDK.startChat();
500
+ }
501
+ ```
502
+
503
+ ### Operating Hours
504
+
505
+ ```ts
506
+ const chatConfig = await chatSDK.getLiveChatConfig();
507
+ const {LiveWSAndLiveChatEngJoin: liveWSAndLiveChatEngJoin} = liveChatConfig;
508
+ const {OutOfOperatingHours: outOfOperatingHours} = liveWSAndLiveChatEngJoin;
509
+
510
+ if (outOfOperatingHours === "True") {
511
+ // Handles UX on Out of Operating Hours
512
+ } else {
513
+ await chatSDK.startChat();
514
+ // Renders Custom Chat Widget
515
+ }
516
+ ```
517
+
354
518
  ### Use [BotFramework-WebChat](https://github.com/microsoft/BotFramework-WebChat)
355
519
 
356
520
  **NOTE**: Currently supported on web only
@@ -370,20 +534,12 @@ Omnichannel offers an live chat widget (LCW) by default. You can use the Chat SD
370
534
  await chatSDK.startChat(optionalParams);
371
535
  const chatAdapter = await chatSDK.createChatAdapter();
372
536
 
373
- // Subscribes to incoming message (OPTION 1)
537
+ // Subscribes to incoming message
374
538
  chatSDK.onNewMessage((message) => {
375
539
  console.log(`[NewMessage] ${message.content}`); // IC3 protocol message data
376
540
  console.log(message);
377
541
  });
378
542
 
379
- // Subscribes to incoming message (OPTION 2)
380
- (chatAdapter as any).activity$.subscribe((activity: any) => {
381
- if (activity.type === "message") {
382
- console.log("[Message activity]");
383
- console.log(activity); // DirectLine protocol activity data
384
- }
385
- });
386
-
387
543
  ...
388
544
 
389
545
  <ReactWebChat
@@ -1,30 +1,41 @@
1
- import IChatConfig from "./core/IChatConfig";
2
- import IChatSDKConfig from "./core/IChatSDKConfig";
3
- import IChatSDKMessage from "./core/IChatSDKMessage";
1
+ import ACSClient from "./core/messaging/ACSClient";
2
+ import ChatConfig from "./core/ChatConfig";
3
+ import ChatReconnectContext from "./core/ChatReconnectContext";
4
+ import ChatReconnectOptionalParams from "./core/ChatReconnectOptionalParams";
5
+ import ChatSDKConfig from "./core/ChatSDKConfig";
6
+ import ChatSDKMessage from "./core/messaging/ChatSDKMessage";
7
+ import ChatTranscriptBody from "./core/ChatTranscriptBody";
8
+ import { ParticipantsRemovedEvent } from '@azure/communication-signaling';
9
+ import FileMetadata from "@microsoft/omnichannel-amsclient/lib/FileMetadata";
10
+ import FramedClient from "@microsoft/omnichannel-amsclient/lib/FramedClient";
11
+ import FramedlessClient from "@microsoft/omnichannel-amsclient/lib/FramedlessClient";
4
12
  import IChatToken from "./external/IC3Adapter/IChatToken";
5
- import IChatTranscriptBody from "./core/IChatTranscriptBody";
6
13
  import IFileInfo from "@microsoft/omnichannel-ic3core/lib/interfaces/IFileInfo";
7
14
  import IFileMetadata from "@microsoft/omnichannel-ic3core/lib/model/IFileMetadata";
8
- import ILiveChatContext from "./core/ILiveChatContext";
9
15
  import IMessage from "@microsoft/omnichannel-ic3core/lib/model/IMessage";
10
- import IOmnichannelConfig from "./core/IOmnichannelConfig";
16
+ import OmnichannelConfig from "./core/OmnichannelConfig";
11
17
  import IRawMessage from "@microsoft/omnichannel-ic3core/lib/model/IRawMessage";
12
18
  import IRawThread from "@microsoft/omnichannel-ic3core/lib/interfaces/IRawThread";
13
- import IStartChatOptionalParams from "./core/IStartChatOptionalParams";
14
- import OnNewMessageOptionalParams from "./core/OnNewMessageOptionalParams";
19
+ import LiveChatContext from "./core/LiveChatContext";
15
20
  import LiveWorkItemDetails from "./core/LiveWorkItemDetails";
21
+ import OnNewMessageOptionalParams from "./core/messaging/OnNewMessageOptionalParams";
22
+ import OmnichannelMessage from "./core/messaging/OmnichannelMessage";
23
+ import StartChatOptionalParams from "./core/StartChatOptionalParams";
16
24
  declare class OmnichannelChatSDK {
17
25
  private debug;
18
26
  OCSDKProvider: unknown;
19
27
  IC3SDKProvider: unknown;
20
28
  OCClient: any;
21
29
  IC3Client: any;
22
- omnichannelConfig: IOmnichannelConfig;
23
- chatSDKConfig: IChatSDKConfig;
30
+ ACSClient: ACSClient | null;
31
+ AMSClient: FramedClient | FramedlessClient | null;
32
+ omnichannelConfig: OmnichannelConfig;
33
+ chatSDKConfig: ChatSDKConfig;
24
34
  isInitialized: boolean;
25
35
  requestId: string;
26
36
  private chatToken;
27
37
  private liveChatConfig;
38
+ private liveChatVersion;
28
39
  private dataMaskingRules;
29
40
  private authSettings;
30
41
  private authenticatedUserToken;
@@ -35,39 +46,45 @@ declare class OmnichannelChatSDK {
35
46
  private scenarioMarker;
36
47
  private ic3ClientLogger;
37
48
  private ocSdkLogger;
49
+ private acsClientLogger;
50
+ private acsAdapterLogger;
38
51
  private isPersistentChat;
52
+ private isChatReconnect;
39
53
  private reconnectId;
40
- constructor(omnichannelConfig: IOmnichannelConfig, chatSDKConfig?: IChatSDKConfig);
54
+ private refreshTokenTimer;
55
+ constructor(omnichannelConfig: OmnichannelConfig, chatSDKConfig?: ChatSDKConfig);
41
56
  setDebug(flag: boolean): void;
42
- initialize(): Promise<IChatConfig>;
43
- startChat(optionalParams?: IStartChatOptionalParams): Promise<void>;
57
+ initialize(): Promise<ChatConfig>;
58
+ getChatReconnectContext(optionalParams?: ChatReconnectOptionalParams): Promise<ChatReconnectContext>;
59
+ startChat(optionalParams?: StartChatOptionalParams): Promise<void>;
44
60
  endChat(): Promise<void>;
45
- getCurrentLiveChatContext(): Promise<ILiveChatContext | {}>;
61
+ getCurrentLiveChatContext(): Promise<LiveChatContext | {}>;
46
62
  getConversationDetails(): Promise<LiveWorkItemDetails>;
47
63
  /**
48
64
  * Gets PreChat Survey.
49
65
  * @param parse Whether to parse PreChatSurvey to JSON or not.
50
66
  */
51
67
  getPreChatSurvey(parse?: boolean): Promise<any>;
52
- getLiveChatConfig(cached?: boolean): Promise<IChatConfig>;
68
+ getLiveChatConfig(cached?: boolean): Promise<ChatConfig>;
53
69
  getChatToken(cached?: boolean): Promise<IChatToken>;
54
70
  getCallingToken(): Promise<string>;
55
- getMessages(): Promise<IMessage[] | undefined>;
71
+ getMessages(): Promise<IMessage[] | OmnichannelMessage[] | undefined>;
56
72
  getDataMaskingRules(): Promise<any>;
57
- sendMessage(message: IChatSDKMessage): Promise<void>;
73
+ sendMessage(message: ChatSDKMessage): Promise<void>;
58
74
  onNewMessage(onNewMessageCallback: CallableFunction, optionalParams?: OnNewMessageOptionalParams | unknown): Promise<void>;
59
75
  sendTypingEvent(): Promise<void>;
60
76
  onTypingEvent(onTypingEventCallback: CallableFunction): Promise<void>;
61
- onAgentEndSession(onAgentEndSessionCallback: (message: IRawThread) => void): Promise<void>;
62
- uploadFileAttachment(fileInfo: IFileInfo | File): Promise<IRawMessage>;
63
- downloadFileAttachment(fileMetadata: IFileMetadata): Promise<Blob>;
64
- emailLiveChatTranscript(body: IChatTranscriptBody): Promise<any>;
77
+ onAgentEndSession(onAgentEndSessionCallback: (message: IRawThread | ParticipantsRemovedEvent) => void): Promise<void>;
78
+ uploadFileAttachment(fileInfo: IFileInfo | File): Promise<IRawMessage | OmnichannelMessage>;
79
+ downloadFileAttachment(fileMetadata: FileMetadata | IFileMetadata): Promise<Blob>;
80
+ emailLiveChatTranscript(body: ChatTranscriptBody): Promise<any>;
65
81
  getLiveChatTranscript(): Promise<any>;
66
- createChatAdapter(protocol?: string): Promise<unknown>;
82
+ createChatAdapter(protocol?: string | null): Promise<unknown>;
67
83
  getVoiceVideoCalling(params?: any): Promise<any>;
68
84
  private getIC3Client;
69
85
  private getChatConfig;
70
86
  private resolveIC3ClientUrl;
71
87
  private resolveChatAdapterUrl;
88
+ private updateChatToken;
72
89
  }
73
90
  export default OmnichannelChatSDK;