@microsoft/omnichannel-chat-sdk
Advanced tools
Comparing version 0.3.0 to 0.3.1-main.31aff70
@@ -6,2 +6,11 @@ # Changelog | ||
### 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 | ||
### Fixed | ||
- `onNewMessage` with `rehydrate` flag set to `true` crashing when `getMessages` returns `undefined` | ||
- Fix `AriaTelemetry` unable to read property `logEvent` of undefined on `React Native` | ||
- Fix `Escalation to Voice & Video` library not being imported properly | ||
## [0.3.0] - 2021-09-03 | ||
@@ -31,3 +40,3 @@ ### Added | ||
- 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) | ||
@@ -34,0 +43,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 + "]"); |
@@ -41,2 +41,3 @@ "use strict"; | ||
AriaTelemetry.info = function (properties, scenarioType) { | ||
var _a; | ||
if (scenarioType === void 0) { scenarioType = ScenarioType_1.default.EVENTS; } | ||
@@ -68,5 +69,6 @@ var event = { | ||
this._debug && console.log(event.properties.Event); | ||
!AriaTelemetry._disable && AriaTelemetry.logger.logEvent(event); | ||
!AriaTelemetry._disable && ((_a = AriaTelemetry.logger) === null || _a === void 0 ? void 0 : _a.logEvent(event)); | ||
}; | ||
AriaTelemetry.debug = function (properties, scenarioType) { | ||
var _a; | ||
if (scenarioType === void 0) { scenarioType = ScenarioType_1.default.EVENTS; } | ||
@@ -98,5 +100,6 @@ var event = { | ||
this._debug && console.log(event.properties.Event); | ||
!AriaTelemetry._disable && AriaTelemetry.logger.logEvent(event); | ||
!AriaTelemetry._disable && ((_a = AriaTelemetry.logger) === null || _a === void 0 ? void 0 : _a.logEvent(event)); | ||
}; | ||
AriaTelemetry.warn = function (properties, scenarioType) { | ||
var _a; | ||
if (scenarioType === void 0) { scenarioType = ScenarioType_1.default.EVENTS; } | ||
@@ -128,5 +131,6 @@ var event = { | ||
this._debug && console.log(event.properties.Event); | ||
!AriaTelemetry._disable && AriaTelemetry.logger.logEvent(event); | ||
!AriaTelemetry._disable && ((_a = AriaTelemetry.logger) === null || _a === void 0 ? void 0 : _a.logEvent(event)); | ||
}; | ||
AriaTelemetry.error = function (properties, scenarioType) { | ||
var _a; | ||
if (scenarioType === void 0) { scenarioType = ScenarioType_1.default.EVENTS; } | ||
@@ -158,5 +162,6 @@ var event = { | ||
this._debug && console.log(event.properties.Event); | ||
!AriaTelemetry._disable && AriaTelemetry.logger.logEvent(event); | ||
!AriaTelemetry._disable && ((_a = AriaTelemetry.logger) === null || _a === void 0 ? void 0 : _a.logEvent(event)); | ||
}; | ||
AriaTelemetry.log = function (properties, scenarioType) { | ||
var _a; | ||
if (scenarioType === void 0) { scenarioType = ScenarioType_1.default.EVENTS; } | ||
@@ -188,3 +193,3 @@ var event = { | ||
this._debug && console.log(event.properties.Event); | ||
!AriaTelemetry._disable && AriaTelemetry.logger.logEvent(event); | ||
!AriaTelemetry._disable && ((_a = AriaTelemetry.logger) === null || _a === void 0 ? void 0 : _a.logEvent(event)); | ||
}; | ||
@@ -191,0 +196,0 @@ Object.defineProperty(AriaTelemetry, "logger", { |
{ | ||
"name": "@microsoft/omnichannel-chat-sdk", | ||
"version": "0.3.0", | ||
"version": "0.3.1-main.31aff70", | ||
"description": "Microsoft Omnichannel Chat SDK", | ||
@@ -41,5 +41,5 @@ "files": [ | ||
"dependencies": { | ||
"@microsoft/ocsdk": "^0.2.0", | ||
"@microsoft/ocsdk": "^0.3.0", | ||
"@microsoft/omnichannel-ic3core": "^0.1.1" | ||
} | ||
} |
@@ -5,2 +5,3 @@ # Omnichannel Chat SDK | ||
![Release CI](https://github.com/microsoft/omnichannel-chat-sdk/workflows/Release%20CI/badge.svg) | ||
![npm](https://img.shields.io/npm/dm/@microsoft/omnichannel-chat-sdk) | ||
@@ -7,0 +8,0 @@ Headless Chat SDK to build your own chat widget against Dynamics 365 Omnichannel Services. |
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
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
750177
687
9160
+ Added@microsoft/ocsdk@0.3.4(transitive)
- Removed@microsoft/ocsdk@0.2.0(transitive)
Updated@microsoft/ocsdk@^0.3.0