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
4
Versions
347
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.1.1-main.db70035 to 0.1.1-main.ee979c7

lib/core/LiveWorkItemDetails.d.ts

2

CHANGELOG.md

@@ -12,2 +12,4 @@ # Changelog

- Add telemetry
- Add `rehydrate` flag for `onNewMessage` to rehydrate all messages of existing conversation
- Add `getConversationDetails`

@@ -14,0 +16,0 @@ ### Changed

@@ -387,5 +387,5 @@ "use strict";

this.addEventListener(eventName, function (params) { return __awaiter(_this, void 0, void 0, function () {
var body;
var _a, _b;
return __generator(this, function (_c) {
var body, exceptionDetails;
var _a, _b, _c, _d, _e;
return __generator(this, function (_f) {
body = {

@@ -395,8 +395,21 @@ SecondaryChannelType: SecondaryChannelType.Voice,

};
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.startScenario(TelemetryEvent_1.default.OnCallDisconnected, {
CallId: this.callId || ''
});
try {
(_a = this.callingParams) === null || _a === void 0 ? void 0 : _a.OCClient.makeSecondaryChannelEventRequest((_b = this.callingParams) === null || _b === void 0 ? void 0 : _b.chatToken.requestId, body);
(_b = this.callingParams) === null || _b === void 0 ? void 0 : _b.OCClient.makeSecondaryChannelEventRequest((_c = this.callingParams) === null || _c === void 0 ? void 0 : _c.chatToken.requestId, body);
this.debug && console.debug("[VoiceVideoCallingProxy][onCallDisconnected][makeSecondaryChannelEventRequest]");
(_d = this.scenarioMarker) === null || _d === void 0 ? void 0 : _d.completeScenario(TelemetryEvent_1.default.OnCallDisconnected, {
CallId: this.callId || ''
});
}
catch (e) {
console.error("[VoiceVideoCallingProxy][onCallDisconnected][makeSecondaryChannelEventRequest] Failure " + e);
exceptionDetails = {
response: 'OCClientMakeSecondaryChannelEventRequestFailed'
};
(_e = this.scenarioMarker) === null || _e === void 0 ? void 0 : _e.failScenario(TelemetryEvent_1.default.OnCallDisconnected, {
CallId: this.callId || '',
ExceptionDetails: JSON.stringify(exceptionDetails)
});
}

@@ -403,0 +416,0 @@ this.clearRemoteVideoElementChildren();

9

lib/OmnichannelChatSDK.d.ts

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

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

@@ -35,2 +37,4 @@ private debug;

private scenarioMarker;
private ic3ClientLogger;
private ocSdkLogger;
constructor(omnichannelConfig: IOmnichannelConfig, chatSDKConfig?: IChatSDKConfig);

@@ -42,2 +46,3 @@ setDebug(flag: boolean): void;

getCurrentLiveChatContext(): Promise<ILiveChatContext | {}>;
getConversationDetails(): Promise<LiveWorkItemDetails>;
/**

@@ -53,7 +58,7 @@ * Gets PreChat Survey.

sendMessage(message: IChatSDKMessage): Promise<void>;
onNewMessage(onNewMessageCallback: CallableFunction): void;
onNewMessage(onNewMessageCallback: CallableFunction, optionalParams?: OnNewMessageOptionalParams | unknown): Promise<void>;
sendTypingEvent(): Promise<void>;
onTypingEvent(onTypingEventCallback: CallableFunction): Promise<void>;
onAgentEndSession(onAgentEndSessionCallback: (message: IRawThread) => void): Promise<void>;
uploadFileAttachment(fileInfo: IFileInfo): Promise<IRawMessage>;
uploadFileAttachment(fileInfo: IFileInfo | File): Promise<IRawMessage>;
downloadFileAttachment(fileMetadata: IFileMetadata): Promise<Blob>;

@@ -60,0 +65,0 @@ emailLiveChatTranscript(body: IChatTranscriptBody): Promise<any>;

import { AWTEventData } from '../external/aria/webjs/AriaSDK';
import ScenarioType from '../telemetry/ScenarioType';
interface CDNPackagesInfo {

@@ -16,11 +17,13 @@ IC3Client?: string;

static setCDNPackages(packages: CDNPackagesInfo): void;
static info(properties: AWTEventData["properties"]): void;
static debug(properties: AWTEventData["properties"]): void;
static warn(properties: AWTEventData["properties"]): void;
static error(properties: AWTEventData["properties"]): void;
static log(properties: AWTEventData["properties"]): void;
static info(properties: AWTEventData["properties"], scenarioType?: ScenarioType): void;
static debug(properties: AWTEventData["properties"], scenarioType?: ScenarioType): void;
static warn(properties: AWTEventData["properties"], scenarioType?: ScenarioType): void;
static error(properties: AWTEventData["properties"], scenarioType?: ScenarioType): void;
static log(properties: AWTEventData["properties"], scenarioType?: ScenarioType): void;
private static get logger();
private static populateBaseProperties;
private static fillMobilePlatformData;
private static populateIC3ClientBaseProperties;
private static populateOCSDKBaseProperties;
}
export default AriaTelemetry;

@@ -19,2 +19,3 @@ "use strict";

var ScenarioType_1 = require("../telemetry/ScenarioType");
var settings_2 = require("../config/settings");
var AriaTelemetry = /** @class */ (function () {

@@ -35,3 +36,4 @@ function AriaTelemetry() {

};
AriaTelemetry.info = function (properties) {
AriaTelemetry.info = function (properties, scenarioType) {
if (scenarioType === void 0) { scenarioType = ScenarioType_1.default.EVENTS; }
var event = {

@@ -42,9 +44,26 @@ name: ScenarioType_1.default.EVENTS,

};
if (scenarioType == ScenarioType_1.default.IC3CLIENT) {
event = {
name: ScenarioType_1.default.IC3CLIENT,
properties: __assign(__assign(__assign({}, AriaTelemetry.populateIC3ClientBaseProperties()), properties), { LogLevel: LogLevel_1.default.INFO }),
priority: Enums_1.AWTEventPriority.High
};
}
if (scenarioType == ScenarioType_1.default.OCSDK) {
event = {
name: ScenarioType_1.default.OCSDK,
properties: __assign(__assign(__assign({}, AriaTelemetry.populateOCSDKBaseProperties()), properties), { LogLevel: LogLevel_1.default.INFO }),
priority: Enums_1.AWTEventPriority.High
};
}
/* istanbul ignore next */
this._debug && console.log("[AriaTelemetry][info]");
this._debug && console.log("[AriaTelemetry][info] " + scenarioType);
/* istanbul ignore next */
this._debug && console.log(event);
/* istanbul ignore next */
this._debug && console.log(event.properties.Event);
!AriaTelemetry._disable && AriaTelemetry.logger.logEvent(event);
};
AriaTelemetry.debug = function (properties) {
AriaTelemetry.debug = function (properties, scenarioType) {
if (scenarioType === void 0) { scenarioType = ScenarioType_1.default.EVENTS; }
var event = {

@@ -55,9 +74,26 @@ name: ScenarioType_1.default.EVENTS,

};
if (scenarioType == ScenarioType_1.default.IC3CLIENT) {
event = {
name: ScenarioType_1.default.IC3CLIENT,
properties: __assign(__assign(__assign({}, AriaTelemetry.populateIC3ClientBaseProperties()), properties), { LogLevel: LogLevel_1.default.DEBUG }),
priority: Enums_1.AWTEventPriority.High
};
}
if (scenarioType == ScenarioType_1.default.OCSDK) {
event = {
name: ScenarioType_1.default.OCSDK,
properties: __assign(__assign(__assign({}, AriaTelemetry.populateOCSDKBaseProperties()), properties), { LogLevel: LogLevel_1.default.DEBUG }),
priority: Enums_1.AWTEventPriority.High
};
}
/* istanbul ignore next */
this._debug && console.log("[AriaTelemetry][debug]");
this._debug && console.log("[AriaTelemetry][debug] " + scenarioType);
/* istanbul ignore next */
this._debug && console.log(event);
/* istanbul ignore next */
this._debug && console.log(event.properties.Event);
!AriaTelemetry._disable && AriaTelemetry.logger.logEvent(event);
};
AriaTelemetry.warn = function (properties) {
AriaTelemetry.warn = function (properties, scenarioType) {
if (scenarioType === void 0) { scenarioType = ScenarioType_1.default.EVENTS; }
var event = {

@@ -68,9 +104,26 @@ name: ScenarioType_1.default.EVENTS,

};
if (scenarioType == ScenarioType_1.default.IC3CLIENT) {
event = {
name: ScenarioType_1.default.IC3CLIENT,
properties: __assign(__assign(__assign({}, AriaTelemetry.populateIC3ClientBaseProperties()), properties), { LogLevel: LogLevel_1.default.WARN }),
priority: Enums_1.AWTEventPriority.High
};
}
if (scenarioType == ScenarioType_1.default.OCSDK) {
event = {
name: ScenarioType_1.default.OCSDK,
properties: __assign(__assign(__assign({}, AriaTelemetry.populateOCSDKBaseProperties()), properties), { LogLevel: LogLevel_1.default.WARN }),
priority: Enums_1.AWTEventPriority.High
};
}
/* istanbul ignore next */
this._debug && console.log("[AriaTelemetry][warn]");
this._debug && console.log("[AriaTelemetry][warn] " + scenarioType);
/* istanbul ignore next */
this._debug && console.log(event);
/* istanbul ignore next */
this._debug && console.log(event.properties.Event);
!AriaTelemetry._disable && AriaTelemetry.logger.logEvent(event);
};
AriaTelemetry.error = function (properties) {
AriaTelemetry.error = function (properties, scenarioType) {
if (scenarioType === void 0) { scenarioType = ScenarioType_1.default.EVENTS; }
var event = {

@@ -81,9 +134,26 @@ name: ScenarioType_1.default.EVENTS,

};
if (scenarioType == ScenarioType_1.default.IC3CLIENT) {
event = {
name: ScenarioType_1.default.IC3CLIENT,
properties: __assign(__assign(__assign({}, AriaTelemetry.populateIC3ClientBaseProperties()), properties), { LogLevel: LogLevel_1.default.ERROR }),
priority: Enums_1.AWTEventPriority.High
};
}
if (scenarioType == ScenarioType_1.default.OCSDK) {
event = {
name: ScenarioType_1.default.OCSDK,
properties: __assign(__assign(__assign({}, AriaTelemetry.populateOCSDKBaseProperties()), properties), { LogLevel: LogLevel_1.default.ERROR }),
priority: Enums_1.AWTEventPriority.High
};
}
/* istanbul ignore next */
this._debug && console.log("[AriaTelemetry][error]");
this._debug && console.log("[AriaTelemetry][error] " + scenarioType);
/* istanbul ignore next */
this._debug && console.log(event);
/* istanbul ignore next */
this._debug && console.log(event.properties.Event);
!AriaTelemetry._disable && AriaTelemetry.logger.logEvent(event);
};
AriaTelemetry.log = function (properties) {
AriaTelemetry.log = function (properties, scenarioType) {
if (scenarioType === void 0) { scenarioType = ScenarioType_1.default.EVENTS; }
var event = {

@@ -94,2 +164,16 @@ name: ScenarioType_1.default.EVENTS,

};
if (scenarioType == ScenarioType_1.default.IC3CLIENT) {
event = {
name: ScenarioType_1.default.IC3CLIENT,
properties: __assign(__assign(__assign({}, AriaTelemetry.populateIC3ClientBaseProperties()), properties), { LogLevel: LogLevel_1.default.LOG }),
priority: Enums_1.AWTEventPriority.High
};
}
if (scenarioType == ScenarioType_1.default.OCSDK) {
event = {
name: ScenarioType_1.default.OCSDK,
properties: __assign(__assign(__assign({}, AriaTelemetry.populateOCSDKBaseProperties()), properties), { LogLevel: LogLevel_1.default.LOG }),
priority: Enums_1.AWTEventPriority.High
};
}
/* istanbul ignore next */

@@ -99,2 +183,4 @@ this._debug && console.log("[AriaTelemetry][log]");

this._debug && console.log(event);
/* istanbul ignore next */
this._debug && console.log(event.properties.Event);
!AriaTelemetry._disable && AriaTelemetry.logger.logEvent(event);

@@ -156,2 +242,34 @@ };

};
AriaTelemetry.populateIC3ClientBaseProperties = function () {
return {
OrgId: '',
OrgUrl: '',
WidgetId: '',
RequestId: '',
ChatId: '',
Event: '',
Description: '',
SubscriptionId: '',
EndpointId: '',
EndpointUrl: '',
ErrorCode: '',
ExceptionDetails: '',
ElapsedTimeInMilliseconds: '',
IC3ClientVersion: settings_2.ic3ClientVersion
};
};
AriaTelemetry.populateOCSDKBaseProperties = function () {
return {
OrgId: '',
OrgUrl: '',
WidgetId: '',
RequestId: '',
ChatId: '',
TransactionId: '',
Event: '',
ExceptionDetails: '',
ElapsedTimeInMilliseconds: '',
OCSDKVersion: require('@microsoft/ocsdk/package.json').version // eslint-disable-line @typescript-eslint/no-var-requires
};
};
AriaTelemetry._debug = false;

@@ -158,0 +276,0 @@ AriaTelemetry._disable = false;

declare enum ScenarioType {
EVENTS = "occhatsdk_events",
IC3CLIENT = "occhatsdk_ic3clientevents",
OCSDK = "occhatsdk_ocsdkevents",
UNDEFINED = "undefined"
}
export default ScenarioType;

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

ScenarioType["EVENTS"] = "occhatsdk_events";
ScenarioType["IC3CLIENT"] = "occhatsdk_ic3clientevents";
ScenarioType["OCSDK"] = "occhatsdk_ocsdkevents";
ScenarioType["UNDEFINED"] = "undefined";

@@ -8,0 +10,0 @@ })(ScenarioType || (ScenarioType = {}));

@@ -9,5 +9,6 @@ declare enum TelemetryEvent {

GetChatToken = "GetChatToken",
GetConversationDetails = "GetConversationDetails",
SendTypingEvent = "SendTypingEvent",
OnAgentEndSession = "OnAgentEndSession",
UploadFileAttachment = "UpdateFileAttachment",
UploadFileAttachment = "UploadFileAttachment",
DownloadFileAttachment = "DownloadFileAttachment",

@@ -25,3 +26,3 @@ EmailLiveChatTranscript = "EmailLiveChatTranscript",

StopCall = "StopCall",
onCallDisconnected = "onCallDisconnected"
OnCallDisconnected = "OnCallDisconnected"
}

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

@@ -13,5 +13,6 @@ "use strict";

TelemetryEvent["GetChatToken"] = "GetChatToken";
TelemetryEvent["GetConversationDetails"] = "GetConversationDetails";
TelemetryEvent["SendTypingEvent"] = "SendTypingEvent";
TelemetryEvent["OnAgentEndSession"] = "OnAgentEndSession";
TelemetryEvent["UploadFileAttachment"] = "UpdateFileAttachment";
TelemetryEvent["UploadFileAttachment"] = "UploadFileAttachment";
TelemetryEvent["DownloadFileAttachment"] = "DownloadFileAttachment";

@@ -29,3 +30,3 @@ TelemetryEvent["EmailLiveChatTranscript"] = "EmailLiveChatTranscript";

TelemetryEvent["StopCall"] = "StopCall";
TelemetryEvent["onCallDisconnected"] = "onCallDisconnected";
TelemetryEvent["OnCallDisconnected"] = "OnCallDisconnected";
})(TelemetryEvent || (TelemetryEvent = {}));

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

{
"name": "@microsoft/omnichannel-chat-sdk",
"version": "0.1.1-main.db70035",
"version": "0.1.1-main.ee979c7",
"description": "Microsoft Omnichannel Chat SDK",

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

@@ -69,2 +69,3 @@ # Omnichannel Chat SDK

| OmnichannelChatSDK.getCurrentLiveChatContext() | Get current live chat context information to reconnect to the same chat | |
| OmnichannelChatSDK.getConversationDetails() | Get details of the current conversation such as its state & when the agent joined the conversation | |
| OmnichannelChatSDK.getChatToken() | Get chat token | |

@@ -115,2 +116,7 @@ | OmnichannelChatSDK.getMessages() | Get all messages | |

### Get Conversation Details
```ts
const conversationDetails = await chatSDK.getConversationDetails();
```
### Get Chat Token

@@ -165,6 +171,10 @@ ```ts

```ts
const optionalParams = {
rehydrate: true, // Rehydrate all previous messages of existing conversation (false by default)
}
chatSDK.onNewMessage((message) => {
console.log(`[NewMessage] ${message.content}`); // IC3 protocol message data
console.log(message);
});
}, optionalParams);
```

@@ -171,0 +181,0 @@

Sorry, the diff of this file is not supported yet

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

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