Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

@microsoft/omnichannel-chat-sdk

Package Overview
Dependencies
Maintainers
3
Versions
336
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/omnichannel-chat-sdk - npm Package Compare versions

Comparing version 0.2.1-main.0041e6a to 0.2.1-main.02dac57

lib/core/ChatReconnectContext.d.ts

13

CHANGELOG.md

@@ -5,3 +5,16 @@ # Changelog

## [Unreleased]
### Added
- Persistent Chat Support
- Chat Reconnect Support
### Changed
- Uptake [@microsoft/ocsdk@0.2.0](https://www.npmjs.com/package/@microsoft/ocsdk/v/0.2.0)
- Add `getCallingToken`
- 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

@@ -8,0 +21,0 @@ ### Added

4

lib/config/settings.d.ts

@@ -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';

@@ -11,5 +11,14 @@ import ChatAdapterConfig from "./ChatAdapterConfig";

}
interface PersistentChatConfig {
disable: boolean;
tokenUpdateTime: number;
}
interface ChatReconnectConfig {
disable: boolean;
}
interface IChatSDKConfig {
dataMasking?: IDataMaskingSDKConfig;
telemetry?: TelemetrySDKConfig;
persistentChat?: PersistentChatConfig;
chatReconnect?: ChatReconnectConfig;
getAuthToken?: () => Promise<string | null>;

@@ -16,0 +25,0 @@ ic3Config?: IC3Config;

@@ -12,2 +12,3 @@ import InitContext from "@microsoft/ocsdk/lib/Model/InitContext";

initContext?: InitContext;
reconnectId?: string;
}

@@ -14,4 +14,6 @@ import IChatConfig from "./core/IChatConfig";

import IStartChatOptionalParams from "./core/IStartChatOptionalParams";
import LiveWorkItemDetails from "./core/LiveWorkItemDetails";
import OnNewMessageOptionalParams from "./core/OnNewMessageOptionalParams";
import LiveWorkItemDetails from "./core/LiveWorkItemDetails";
import ChatReconnectOptionalParams from "./core/ChatReconnectOptionalParams";
import ChatReconnectContext from "./core/ChatReconnectContext";
declare class OmnichannelChatSDK {

@@ -39,5 +41,10 @@ private debug;

private ocSdkLogger;
private isPersistentChat;
private isChatReconnect;
private reconnectId;
private refreshTokenTimer;
constructor(omnichannelConfig: IOmnichannelConfig, chatSDKConfig?: IChatSDKConfig);
setDebug(flag: boolean): void;
initialize(): Promise<IChatConfig>;
getChatReconnectContext(optionalParams?: ChatReconnectOptionalParams): Promise<ChatReconnectContext>;
startChat(optionalParams?: IStartChatOptionalParams): Promise<void>;

@@ -54,2 +61,3 @@ endChat(): Promise<void>;

getChatToken(cached?: boolean): Promise<IChatToken>;
getCallingToken(): Promise<string>;
getMessages(): Promise<IMessage[] | undefined>;

@@ -72,3 +80,4 @@ getDataMaskingRules(): Promise<any>;

private resolveChatAdapterUrl;
private updateChatToken;
}
export default OmnichannelChatSDK;

@@ -25,3 +25,5 @@ declare enum TelemetryEvent {

StopCall = "StopCall",
OnCallDisconnected = "OnCallDisconnected"
OnCallDisconnected = "OnCallDisconnected",
UpdateChatToken = "UpdateChatToken",
GetChatReconnectContext = "GetChatReconnectContext"
}

@@ -28,0 +30,0 @@ export declare const startEvent: (event: TelemetryEvent) => string;

@@ -30,2 +30,4 @@ "use strict";

TelemetryEvent["OnCallDisconnected"] = "OnCallDisconnected";
TelemetryEvent["UpdateChatToken"] = "UpdateChatToken";
TelemetryEvent["GetChatReconnectContext"] = "GetChatReconnectContext";
})(TelemetryEvent || (TelemetryEvent = {}));

@@ -32,0 +34,0 @@ exports.startEvent = function (event) {

@@ -13,2 +13,9 @@ "use strict";

ariaTelemetryKey: settings_1.ariaTelemetryKey
},
persistentChat: {
disable: true,
tokenUpdateTime: 21600000
},
chatReconnect: {
disable: true,
}

@@ -15,0 +22,0 @@ };

{
"name": "@microsoft/omnichannel-chat-sdk",
"version": "0.2.1-main.0041e6a",
"version": "0.2.1-main.02dac57",
"description": "Microsoft Omnichannel Chat SDK",

@@ -41,5 +41,5 @@ "files": [

"dependencies": {
"@microsoft/ocsdk": "^0.1.1",
"@microsoft/ocsdk": "^0.2.0",
"@microsoft/omnichannel-ic3core": "^0.1.1"
}
}

@@ -36,4 +36,4 @@ # Omnichannel Chat SDK

| Escalation to Voice & Video | βœ” | Web Only |
| Co-browse | βœ” | ❌ |
| Screen Sharing | βœ” | ❌ |
| Co-browse | βœ” | Web Only |
| Screen Sharing | βœ” | Web Only |
| Authenticated Chat | βœ” | βœ” |

@@ -50,2 +50,4 @@ | Pre-chat Survey | βœ” | βœ” |

| Proactive Chat | βœ” | BYOI **\*** |
| Persistent Chat | βœ” | βœ” |
| Chat Reconnect | βœ” | βœ” |

@@ -71,4 +73,6 @@ **\*** 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 | |
| OmnichannelChatSDK.getChatToken() | Get chat token | |
| OmnichannelChatSDK.getCallingToken() | Get calling token | |
| OmnichannelChatSDK.getMessages() | Get all messages | |

@@ -118,2 +122,11 @@ | OmnichannelChatSDK.sendMessage() | Send message | |

### Get Current Chat Reconnect Context
```ts
const optionalParams = {
reconnectId: '', // reconnect Id
};
const chatReconnectContext = await chatSDK.getChatReconnectContext(optionalParams);
```
### Get Conversation Details

@@ -129,2 +142,7 @@ ```ts

### Get Calling Token
```ts
const callingToken = await chatSDK.getCallingToken();
```
### Get Live Chat Config

@@ -353,2 +371,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)

@@ -355,0 +477,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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc