@microsoft/omnichannel-chat-sdk
Advanced tools
Comparing version 0.2.1-main.8648fe2 to 0.2.1-main.8a2a55f
@@ -5,2 +5,6 @@ # Changelog | ||
## [Unreleased] | ||
### Added | ||
- Persistent Chat Support | ||
- Chat Reconnect Support | ||
### Changed | ||
@@ -10,3 +14,8 @@ - Uptake [@microsoft/ocsdk@0.2.0](https://www.npmjs.com/package/@microsoft/ocsdk/v/0.2.0) | ||
- Send `ChannelId-lcw` message tag | ||
- Uptake [IC3Client@2021.08.14.1](https://comms.omnichannelengagementhub.com/release/2021.08.14.1/Scripts/SDK/SDK.min.js) | ||
- 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) | ||
### Fixed | ||
- `msdyn_enablechatreconnect` not being parsed properly | ||
## [0.2.0] - 2021-04-30 | ||
@@ -13,0 +22,0 @@ ### Added |
@@ -1,4 +0,4 @@ | ||
declare const ic3ClientVersion = "2021.03.02.1"; | ||
declare const webChatIC3AdapterVersion = "0.1.0-master.92b1505"; | ||
declare const ic3ClientVersion = "2021.08.14.1"; | ||
declare const webChatIC3AdapterVersion = "0.1.0-master.2dba07b"; | ||
declare const ariaTelemetryKey = "c7655518acf1403f93ff6b9f77942f0a-d01a02fd-6b50-4de3-a566-62eda11f93bc-7083"; | ||
export { ic3ClientVersion, webChatIC3AdapterVersion, ariaTelemetryKey }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ariaTelemetryKey = exports.webChatIC3AdapterVersion = exports.ic3ClientVersion = void 0; | ||
var ic3ClientVersion = '2021.03.02.1'; | ||
var ic3ClientVersion = '2021.08.14.1'; | ||
exports.ic3ClientVersion = ic3ClientVersion; | ||
var webChatIC3AdapterVersion = '0.1.0-master.92b1505'; | ||
var webChatIC3AdapterVersion = '0.1.0-master.2dba07b'; | ||
exports.webChatIC3AdapterVersion = webChatIC3AdapterVersion; | ||
@@ -8,0 +8,0 @@ var ariaTelemetryKey = 'c7655518acf1403f93ff6b9f77942f0a-d01a02fd-6b50-4de3-a566-62eda11f93bc-7083'; |
@@ -27,3 +27,3 @@ import ChatAdapterConfig from "./ChatAdapterConfig"; | ||
} | ||
export { IDataMaskingSDKConfig }; | ||
export { IDataMaskingSDKConfig, PersistentChatConfig }; | ||
export default IChatSDKConfig; |
@@ -35,2 +35,7 @@ "use strict"; | ||
}; | ||
var validatePersistentChatConfig = function (persistentChatConfig) { | ||
if (typeof persistentChatConfig.tokenUpdateTime !== "number" || !persistentChatConfig.tokenUpdateTime) { | ||
persistentChatConfig.tokenUpdateTime = defaultChatSDKConfig.persistentChat.tokenUpdateTime; // eslint-disable-line @typescript-eslint/no-non-null-assertion | ||
} | ||
}; | ||
var validateSDKConfig = function (chatSDKConfig) { | ||
@@ -40,4 +45,7 @@ if (chatSDKConfig.dataMasking) { | ||
} | ||
if (chatSDKConfig.persistentChat) { | ||
validatePersistentChatConfig(chatSDKConfig.persistentChat); | ||
} | ||
}; | ||
exports.default = validateSDKConfig; | ||
//# sourceMappingURL=SDKConfigValidators.js.map |
{ | ||
"name": "@microsoft/omnichannel-chat-sdk", | ||
"version": "0.2.1-main.8648fe2", | ||
"version": "0.2.1-main.8a2a55f", | ||
"description": "Microsoft Omnichannel Chat SDK", | ||
@@ -5,0 +5,0 @@ "files": [ |
116
README.md
@@ -49,2 +49,4 @@ # Omnichannel Chat SDK | ||
| Proactive Chat | β | BYOI **\*** | | ||
| Persistent Chat | β | β | | ||
| Chat Reconnect | β | β | | ||
@@ -70,2 +72,3 @@ **\*** BYOI: Bring Your Own Implementation | ||
| OmnichannelChatSDK.getCurrentLiveChatContext() | Get current live chat context information to reconnect to the same chat | | | ||
| OmnichannelChatSDK.getChatReconnectContext() | Get current reconnectable chat context information to reconnect to a previous existing chat session | | | ||
| OmnichannelChatSDK.getConversationDetails() | Get details of the current conversation such as its state & when the agent joined the conversation | | | ||
@@ -118,2 +121,11 @@ | OmnichannelChatSDK.getChatToken() | Get chat token | | | ||
### Get Current Chat Reconnect Context | ||
```ts | ||
const optionalParams = { | ||
reconnectId: '', // reconnect Id | ||
}; | ||
const chatReconnectContext = await chatSDK.getChatReconnectContext(optionalParams); | ||
``` | ||
### Get Conversation Details | ||
@@ -357,2 +369,106 @@ ```ts | ||
### Persistent Chat | ||
```ts | ||
const chatSDKConfig = { | ||
persistentChat: { | ||
disable: false, | ||
tokenUpdateTime: 21600000 | ||
}, | ||
getAuthToken: async () => { | ||
const response = await fetch("http://contosohelp.com/token"); | ||
if (response.ok) { | ||
return await response.text(); | ||
} | ||
else { | ||
return null | ||
} | ||
} | ||
} | ||
const chatSDK = new OmnichannelChatSDK.OmnichannelChatSDK(omnichannelConfig, chatSDKConfig); | ||
await chatSDK.initialize(); | ||
// from this point, this acts like a persistent chat | ||
``` | ||
### Chat Reconnect with Authenticated User | ||
```ts | ||
const chatSDKConfig = { | ||
chatReconnect: { | ||
disable: false, | ||
}, | ||
getAuthToken: async () => { | ||
const response = await fetch("http://contosohelp.com/token"); | ||
if (response.ok) { | ||
return await response.text(); | ||
} | ||
else { | ||
return null | ||
} | ||
} | ||
} | ||
const chatSDK = new OmnichannelChatSDK.OmnichannelChatSDK(omnichannelConfig, chatSDKConfig); | ||
await chatSDK.initialize(); | ||
... | ||
const chatReconnectContext = await chatSDK.getChatReconnectContext(); | ||
if (chatReconnectContext.reconnectId) { | ||
// Add UX with options to reconnect to previous existing chat or start new chat | ||
} | ||
// Reconnect chat option | ||
const optionalParams = {}; | ||
optionalParams.reconnectId = chatReconnectContext.reconnectId; | ||
chatSDK.startChat(optionalParams); | ||
// Start new chat option | ||
chatSDK.startChat(); | ||
``` | ||
### Chat Reconnect with Unauthenticated User | ||
```ts | ||
const chatSDKConfig = { | ||
chatReconnect: { | ||
disable: false, | ||
}, | ||
} | ||
const chatSDK = new OmnichannelChatSDK.OmnichannelChatSDK(omnichannelConfig, chatSDKConfig); | ||
await chatSDK.initialize(); | ||
.... | ||
const optionalParams: any = {}; | ||
// Retrieve reconnect id from the URL | ||
const urlParams = new URLSearchParams(window.location.search); | ||
const reconnectId = urlParams.get('oc.reconnectid'); | ||
const params = { | ||
reconnectId | ||
}; | ||
// Validate reconnect id | ||
const chatReconnectContext = await chatSDK.getChatReconnectContext(params); | ||
// If the reconnect id is invalid or expired, redirect URL if there is any URL set in the configuration | ||
if (chatReconnectContext.redirectURL) { | ||
window.location.replace(chatReconnectContext.redirectURL); | ||
} | ||
// Valid reconnect id, reconnect to previous chat | ||
if (chatReconnectContext.reconnectId) { | ||
await chatSDK.startChat({ | ||
reconnectId: chatReconnectContext.reconnectId | ||
}); | ||
} else { // Reconnect id from URL is not valid, start new chat session | ||
await chatSDK.startChat(); | ||
} | ||
``` | ||
### Use [BotFramework-WebChat](https://github.com/microsoft/BotFramework-WebChat) | ||
@@ -359,0 +475,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
749666
9159
677