New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@microsoft/omnichannel-chat-sdk

Package Overview
Dependencies
Maintainers
3
Versions
388
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

to
0.3.1-main.c96fb51

9

CHANGELOG.md

@@ -6,5 +6,9 @@ # Changelog

### Added
- Add `GetAuthToken` & `GetPreChatSurvey` telemetry events
- Add `Domain` telemetry base property
### Changed
- Uptake [@microsoft/ocsdk@0.3.0](https://www.npmjs.com/package/@microsoft/ocsdk/v/0.3.0)
- Use `lockfileVersion: 2` in `package-lock.json` via npm v7
- Uptake [@microsoft/omnichannel-ic3core@0.1.2](https://www.npmjs.com/package/@microsoft/omnichannel-ic3core/v/0.1.2)

@@ -14,2 +18,3 @@ ### Fixed

- Fix `AriaTelemetry` unable to read property `logEvent` of undefined on `React Native`
- Fix `Escalation to Voice & Video` library not being imported properly

@@ -40,3 +45,3 @@ ## [0.3.0] - 2021-09-03

- React Native sample app using Omnichannel Chat SDK with [react-native-gifted-chat](https://github.com/FaridSafi/react-native-gifted-chat)
- Escalation to Voice & View support (Web Only)
- Escalation to Voice & Video support (Web Only)
- React sample app using Omnichannel Chat SDK with [BotFramework-WebChat](https://github.com/microsoft/BotFramework-WebChat)

@@ -43,0 +48,0 @@ - Expose `sessiontInit`'s `initContext` on `startChat`'s optional paramaters

@@ -17,2 +17,3 @@ import IChatToken from "../external/IC3Adapter/IChatToken";

private debug;
private callClientName;
private logger;

@@ -19,0 +20,0 @@ private proxy;

@@ -54,6 +54,18 @@ "use strict";

})(SecondaryChannelEvents || (SecondaryChannelEvents = {}));
var CallingEvents;
(function (CallingEvents) {
CallingEvents["CallAdded"] = "callAdded";
CallingEvents["LocalVideoStreamAdded"] = "localVideoStreamAdded";
CallingEvents["LocalVideoStreamRemoved"] = "localVideoStreamRemoved";
CallingEvents["RemoteVideoStreamAdded"] = "remoteVideoStreamAdded";
CallingEvents["RemoteVideoStreamRemoved"] = "remoteVideoStreamRemoved";
CallingEvents["CallDisconnected"] = "callDisconnected";
CallingEvents["ParticipantDisconnected"] = "participantDisconnected";
CallingEvents["IncomingCallEnded"] = "incomingCallEnded";
})(CallingEvents || (CallingEvents = {}));
var VoiceVideoCallingProxy = /** @class */ (function () {
function VoiceVideoCallingProxy() {
this.debug = false;
this.proxy = window.Microsoft.OmniChannel.SDK.VoiceVideoCalling;
this.callClientName = 'ElevateToVoiceVideo';
this.proxy = window["Microsoft.Omnichannel.Calling.SDK"].VoiceVideoCalling; // eslint-disable-line @typescript-eslint/no-explicit-any
this.proxyInstance = this.proxy.getInstance();

@@ -90,7 +102,7 @@ }

VoiceVideoCallingProxy.prototype.initialize = function (params) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
var _a, _b, _c, _d, _e, _f, _g, _h;
return __awaiter(this, void 0, void 0, function () {
var _k;
return __generator(this, function (_l) {
switch (_l.label) {
var error_1;
return __generator(this, function (_j) {
switch (_j.label) {
case 0:

@@ -100,6 +112,3 @@ /* istanbul ignore next */

this.callingParams = params;
this.callId = (_a = this.callingParams) === null || _a === void 0 ? void 0 : _a.chatToken.chatId;
(_b = this.scenarioMarker) === null || _b === void 0 ? void 0 : _b.startScenario(TelemetryEvent_1.default.InitializeVoiceVideoCallingSDK, {
CallId: this.callId || ''
});
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.startScenario(TelemetryEvent_1.default.InitializeVoiceVideoCallingSDK);
/* istanbul ignore next */

@@ -110,24 +119,20 @@ this.debug && console.debug("[VoiceVideoCallingProxy][initialize] _isLoaded: " + this.proxyInstance._isLoaded);

case 1:
_l.sent();
_l.label = 2;
_j.sent();
_j.label = 2;
case 2:
_l.trys.push([2, 4, , 5]);
_j.trys.push([2, 4, , 5]);
return [4 /*yield*/, this.proxyInstance.initialize({
skypeid: (_c = this.callingParams) === null || _c === void 0 ? void 0 : _c.chatToken.visitorId,
accesstoken: (_d = this.callingParams) === null || _d === void 0 ? void 0 : _d.chatToken.token,
environment: ((_e = this.callingParams) === null || _e === void 0 ? void 0 : _e.environment) || 'prod',
selfVideoHTMLElementId: (_f = this.callingParams) === null || _f === void 0 ? void 0 : _f.selfVideoHTMLElementId,
remoteVideoHTMLElementId: (_g = this.callingParams) === null || _g === void 0 ? void 0 : _g.remoteVideoHTMLElementId
callClientName: this.callClientName,
accesstoken: ((_c = (_b = this.callingParams) === null || _b === void 0 ? void 0 : _b.chatToken.voiceVideoCallToken) === null || _c === void 0 ? void 0 : _c.Token) || ((_d = this.callingParams) === null || _d === void 0 ? void 0 : _d.chatToken.token),
selfVideoHTMLElementId: (_e = this.callingParams) === null || _e === void 0 ? void 0 : _e.selfVideoHTMLElementId,
remoteVideoHTMLElementId: (_f = this.callingParams) === null || _f === void 0 ? void 0 : _f.remoteVideoHTMLElementId
})];
case 3:
_l.sent();
(_h = this.scenarioMarker) === null || _h === void 0 ? void 0 : _h.completeScenario(TelemetryEvent_1.default.InitializeVoiceVideoCallingSDK, {
CallId: this.callId || ''
});
_j.sent();
(_g = this.scenarioMarker) === null || _g === void 0 ? void 0 : _g.completeScenario(TelemetryEvent_1.default.InitializeVoiceVideoCallingSDK);
return [3 /*break*/, 5];
case 4:
_k = _l.sent();
(_j = this.scenarioMarker) === null || _j === void 0 ? void 0 : _j.failScenario(TelemetryEvent_1.default.InitializeVoiceVideoCallingSDK, {
CallId: this.callId || ''
});
error_1 = _j.sent();
console.log(error_1);
(_h = this.scenarioMarker) === null || _h === void 0 ? void 0 : _h.failScenario(TelemetryEvent_1.default.InitializeVoiceVideoCallingSDK);
return [3 /*break*/, 5];

@@ -142,7 +147,9 @@ case 5: return [2 /*return*/];

this.proxyInstance.registerEvent(eventName, function (params) {
var _a;
var callId = params.callId;
if (eventName === CallingEvents.CallAdded) {
_this.callId = callId;
}
/* istanbul ignore next */
_this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "] callId: " + callId);
if (callId !== ((_a = _this.callingParams) === null || _a === void 0 ? void 0 : _a.chatToken.chatId)) {
if (callId !== _this.callId) {
return;

@@ -154,4 +161,4 @@ }

VoiceVideoCallingProxy.prototype.isMicrophoneMuted = function () {
var callId = this.callId;
return this.proxyInstance.isMicrophoneMuted({ callId: callId });
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
return this.proxyInstance.isMicrophoneMuted({ callClientName: callClientName, callId: callId });
};

@@ -162,7 +169,7 @@ VoiceVideoCallingProxy.prototype.acceptCall = function (params) {

return __awaiter(this, void 0, void 0, function () {
var callId, _g, exceptionDetails, body, exceptionDetails;
return __generator(this, function (_h) {
switch (_h.label) {
var _g, callClientName, callId, _h, exceptionDetails, body, exceptionDetails;
return __generator(this, function (_j) {
switch (_j.label) {
case 0:
callId = this.callId;
_g = this, callClientName = _g.callClientName, callId = _g.callId;
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.startScenario(params.withVideo ? TelemetryEvent_1.default.AcceptVideoCall : TelemetryEvent_1.default.AcceptVoiceCall, {

@@ -175,11 +182,11 @@ CallId: callId || ''

this.debug && console.debug(params);
_h.label = 1;
_j.label = 1;
case 1:
_h.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.proxyInstance.acceptCall({ callId: callId, withVideo: params.withVideo || false })];
_j.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.proxyInstance.acceptCall({ callClientName: callClientName, callId: callId, withVideo: params.withVideo || false })];
case 2:
_h.sent();
_j.sent();
return [3 /*break*/, 4];
case 3:
_g = _h.sent();
_h = _j.sent();
exceptionDetails = {

@@ -224,7 +231,7 @@ response: params.withVideo ? "AcceptVideoCallFailed" : "AcceptVoiceCallFailed"

return __awaiter(this, void 0, void 0, function () {
var callId, _g, exceptionDetails, body, exceptionDetails;
return __generator(this, function (_h) {
switch (_h.label) {
var _g, callClientName, callId, _h, exceptionDetails, body, exceptionDetails;
return __generator(this, function (_j) {
switch (_j.label) {
case 0:
callId = this.callId;
_g = this, callClientName = _g.callClientName, callId = _g.callId;
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.startScenario(TelemetryEvent_1.default.RejectCall, {

@@ -235,8 +242,8 @@ CallId: callId || ''

this.debug && console.debug("[VoiceVideoCallingProxy][rejectCall] callId: " + callId);
_h.label = 1;
_j.label = 1;
case 1:
_h.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.proxyInstance.rejectCall({ callId: callId })];
_j.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.proxyInstance.rejectCall({ callClientName: callClientName, callId: callId })];
case 2:
_h.sent();
_j.sent();
(_b = this.scenarioMarker) === null || _b === void 0 ? void 0 : _b.completeScenario(TelemetryEvent_1.default.RejectCall, {

@@ -247,3 +254,3 @@ CallId: callId || ''

case 3:
_g = _h.sent();
_h = _j.sent();
exceptionDetails = {

@@ -284,9 +291,9 @@ response: "RejectCallFailed"

VoiceVideoCallingProxy.prototype.stopCall = function () {
var _a, _b, _c;
var _a, _b, _c, _d, _e;
return __awaiter(this, void 0, void 0, function () {
var callId, _d;
return __generator(this, function (_e) {
switch (_e.label) {
var _f, callClientName, callId, forEveryone, _g;
return __generator(this, function (_h) {
switch (_h.label) {
case 0:
callId = this.callId;
_f = this, callClientName = _f.callClientName, callId = _f.callId;
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.startScenario(TelemetryEvent_1.default.StopCall, {

@@ -297,9 +304,10 @@ CallId: callId || ''

this.debug && console.debug("[VoiceVideoCallingProxy][stopCall] callId: " + callId);
_e.label = 1;
forEveryone = ((_c = (_b = this.callingParams) === null || _b === void 0 ? void 0 : _b.chatToken.voiceVideoCallToken) === null || _c === void 0 ? void 0 : _c.Token) ? true : false;
_h.label = 1;
case 1:
_e.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.proxyInstance.stopCall({ callId: callId })];
_h.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.proxyInstance.stopCall({ callClientName: callClientName, callId: callId, forEveryone: forEveryone })];
case 2:
_e.sent();
(_b = this.scenarioMarker) === null || _b === void 0 ? void 0 : _b.completeScenario(TelemetryEvent_1.default.StopCall, {
_h.sent();
(_d = this.scenarioMarker) === null || _d === void 0 ? void 0 : _d.completeScenario(TelemetryEvent_1.default.StopCall, {
CallId: callId || ''

@@ -309,4 +317,4 @@ });

case 3:
_d = _e.sent();
(_c = this.scenarioMarker) === null || _c === void 0 ? void 0 : _c.failScenario(TelemetryEvent_1.default.StopCall, {
_g = _h.sent();
(_e = this.scenarioMarker) === null || _e === void 0 ? void 0 : _e.failScenario(TelemetryEvent_1.default.StopCall, {
CallId: callId || '',

@@ -322,6 +330,6 @@ });

return __awaiter(this, void 0, void 0, function () {
var callId;
return __generator(this, function (_a) {
callId = this.callId;
return [2 /*return*/, this.proxyInstance.toggleMute({ callId: callId })];
var _a, callClientName, callId;
return __generator(this, function (_b) {
_a = this, callClientName = _a.callClientName, callId = _a.callId;
return [2 /*return*/, this.proxyInstance.toggleMute({ callClientName: callClientName, callId: callId })];
});

@@ -331,15 +339,15 @@ });

VoiceVideoCallingProxy.prototype.isRemoteVideoEnabled = function () {
var callId = this.callId;
return this.proxyInstance.isRemoteVideoEnabled({ callId: callId });
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
return this.proxyInstance.isRemoteVideoEnabled({ callClientName: callClientName, callId: callId });
};
VoiceVideoCallingProxy.prototype.isLocalVideoEnabled = function () {
var callId = this.callId;
return this.proxyInstance.isLocalVideoEnabled({ callId: callId });
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
return this.proxyInstance.isLocalVideoEnabled({ callClientName: callClientName, callId: callId });
};
VoiceVideoCallingProxy.prototype.toggleLocalVideo = function () {
return __awaiter(this, void 0, void 0, function () {
var callId;
return __generator(this, function (_a) {
callId = this.callId;
return [2 /*return*/, this.proxyInstance.toggleLocalVideo({ callId: callId })];
var _a, callClientName, callId;
return __generator(this, function (_b) {
_a = this, callClientName = _a.callClientName, callId = _a.callId;
return [2 /*return*/, this.proxyInstance.toggleLocalVideo({ callClientName: callClientName, callId: callId })];
});

@@ -349,12 +357,12 @@ });

VoiceVideoCallingProxy.prototype.isInACall = function () {
var callId = this.callId;
return this.proxyInstance.isInACall({ callId: callId });
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
return this.proxyInstance.isInACall({ callClientName: callClientName, callId: callId });
};
VoiceVideoCallingProxy.prototype.renderVideoStreams = function () {
var callId = this.callId;
return this.proxyInstance.renderVideoStreams({ callId: callId });
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
return this.proxyInstance.renderVideoStreams({ callClientName: callClientName, callId: callId });
};
VoiceVideoCallingProxy.prototype.disposeVideoRenderers = function () {
var callId = this.callId;
return this.proxyInstance.disposeVideoRenderers({ callId: callId });
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
return this.proxyInstance.disposeVideoRenderers({ callClientName: callClientName, callId: callId });
};

@@ -369,3 +377,3 @@ VoiceVideoCallingProxy.prototype.close = function () {

VoiceVideoCallingProxy.prototype.onCallAdded = function (callback) {
var eventName = 'callAdded';
var eventName = CallingEvents.CallAdded;
/* istanbul ignore next */

@@ -376,3 +384,3 @@ this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");

VoiceVideoCallingProxy.prototype.onLocalVideoStreamAdded = function (callback) {
var eventName = 'localVideoStreamAdded';
var eventName = CallingEvents.LocalVideoStreamAdded;
/* istanbul ignore next */

@@ -383,3 +391,3 @@ this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");

VoiceVideoCallingProxy.prototype.onLocalVideoStreamRemoved = function (callback) {
var eventName = 'localVideoStreamRemoved';
var eventName = CallingEvents.LocalVideoStreamRemoved;
/* istanbul ignore next */

@@ -390,3 +398,3 @@ this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");

VoiceVideoCallingProxy.prototype.onRemoteVideoStreamAdded = function (callback) {
var eventName = 'remoteVideoStreamAdded';
var eventName = CallingEvents.RemoteVideoStreamAdded;
/* istanbul ignore next */

@@ -397,3 +405,3 @@ this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");

VoiceVideoCallingProxy.prototype.onRemoteVideoStreamRemoved = function (callback) {
var eventName = 'remoteVideoStreamRemoved';
var eventName = CallingEvents.RemoteVideoStreamRemoved;
/* istanbul ignore next */

@@ -405,3 +413,3 @@ this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");

var _this = this;
var eventName = 'callDisconnected';
var eventName = CallingEvents.CallDisconnected;
/* istanbul ignore next */

@@ -408,0 +416,0 @@ this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");

@@ -26,2 +26,3 @@ import { AWTEventData } from '../external/aria/webjs/AriaSDK';

private static fillMobilePlatformData;
private static fillWebPlatformData;
private static populateIC3ClientBaseProperties;

@@ -28,0 +29,0 @@ private static populateOCSDKBaseProperties;

@@ -45,3 +45,3 @@ "use strict";

name: ScenarioType_1.default.EVENTS,
properties: __assign(__assign(__assign(__assign({}, AriaTelemetry.populateBaseProperties()), AriaTelemetry.fillMobilePlatformData()), properties), { LogLevel: LogLevel_1.default.INFO }),
properties: __assign(__assign(__assign(__assign(__assign({}, AriaTelemetry.populateBaseProperties()), AriaTelemetry.fillWebPlatformData()), AriaTelemetry.fillMobilePlatformData()), properties), { LogLevel: LogLevel_1.default.INFO }),
priority: Enums_1.AWTEventPriority.High

@@ -76,3 +76,3 @@ };

name: ScenarioType_1.default.EVENTS,
properties: __assign(__assign(__assign(__assign({}, AriaTelemetry.populateBaseProperties()), AriaTelemetry.fillMobilePlatformData()), properties), { LogLevel: LogLevel_1.default.DEBUG }),
properties: __assign(__assign(__assign(__assign(__assign({}, AriaTelemetry.populateBaseProperties()), AriaTelemetry.fillWebPlatformData()), AriaTelemetry.fillMobilePlatformData()), properties), { LogLevel: LogLevel_1.default.DEBUG }),
priority: Enums_1.AWTEventPriority.High

@@ -107,3 +107,3 @@ };

name: ScenarioType_1.default.EVENTS,
properties: __assign(__assign(__assign(__assign({}, AriaTelemetry.populateBaseProperties()), AriaTelemetry.fillMobilePlatformData()), properties), { LogLevel: LogLevel_1.default.WARN }),
properties: __assign(__assign(__assign(__assign(__assign({}, AriaTelemetry.populateBaseProperties()), AriaTelemetry.fillWebPlatformData()), AriaTelemetry.fillMobilePlatformData()), properties), { LogLevel: LogLevel_1.default.WARN }),
priority: Enums_1.AWTEventPriority.High

@@ -138,3 +138,3 @@ };

name: ScenarioType_1.default.EVENTS,
properties: __assign(__assign(__assign(__assign({}, AriaTelemetry.populateBaseProperties()), AriaTelemetry.fillMobilePlatformData()), properties), { LogLevel: LogLevel_1.default.ERROR }),
properties: __assign(__assign(__assign(__assign(__assign({}, AriaTelemetry.populateBaseProperties()), AriaTelemetry.fillWebPlatformData()), AriaTelemetry.fillMobilePlatformData()), properties), { LogLevel: LogLevel_1.default.ERROR }),
priority: Enums_1.AWTEventPriority.High

@@ -169,3 +169,3 @@ };

name: ScenarioType_1.default.EVENTS,
properties: __assign(__assign(__assign(__assign({}, AriaTelemetry.populateBaseProperties()), AriaTelemetry.fillMobilePlatformData()), properties), { LogLevel: LogLevel_1.default.LOG }),
properties: __assign(__assign(__assign(__assign(__assign({}, AriaTelemetry.populateBaseProperties()), AriaTelemetry.fillWebPlatformData()), AriaTelemetry.fillMobilePlatformData()), properties), { LogLevel: LogLevel_1.default.LOG }),
priority: Enums_1.AWTEventPriority.High

@@ -219,2 +219,3 @@ };

CallId: '',
Domain: '',
ExceptionDetails: '',

@@ -251,2 +252,18 @@ ElapsedTimeInMilliseconds: '',

};
AriaTelemetry.fillWebPlatformData = function () {
var platformData = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
if (!window) {
return platformData;
}
try {
platformData.Domain = window.location.origin || '';
/* istanbul ignore next */
this._debug && console.log("[AriaTelemetry][fillWebPlatformData]");
}
catch (_a) {
/* istanbul ignore next */
this._debug && console.log("[AriaTelemetry][fillWebPlatformData][Error]");
}
return platformData;
};
AriaTelemetry.populateIC3ClientBaseProperties = function () {

@@ -253,0 +270,0 @@ return {

@@ -8,2 +8,4 @@ declare enum TelemetryEvent {

GetLiveChatConfig = "GetLiveChatConfig",
GetAuthToken = "GetAuthToken",
GetPreChatSurvey = "GetPreChatSurvey",
GetChatToken = "GetChatToken",

@@ -10,0 +12,0 @@ GetConversationDetails = "GetConversationDetails",

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

TelemetryEvent["GetLiveChatConfig"] = "GetLiveChatConfig";
TelemetryEvent["GetAuthToken"] = "GetAuthToken";
TelemetryEvent["GetPreChatSurvey"] = "GetPreChatSurvey";
TelemetryEvent["GetChatToken"] = "GetChatToken";

@@ -14,0 +16,0 @@ TelemetryEvent["GetConversationDetails"] = "GetConversationDetails";

{
"name": "@microsoft/omnichannel-chat-sdk",
"version": "0.3.1-main.c474307",
"version": "0.3.1-main.c96fb51",
"description": "Microsoft Omnichannel Chat SDK",

@@ -42,4 +42,4 @@ "files": [

"@microsoft/ocsdk": "^0.3.0",
"@microsoft/omnichannel-ic3core": "^0.1.1"
"@microsoft/omnichannel-ic3core": "^0.1.2"
}
}

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