@microsoft/omnichannel-chat-sdk 1.9.7-main.9019907 → 1.9.7-main.b4583a2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/OmnichannelChatSDK.d.ts +128 -128
- package/lib/OmnichannelChatSDK.js +2609 -2609
- package/lib/api/createVoiceVideoCalling.d.ts +53 -53
- package/lib/api/createVoiceVideoCalling.js +462 -462
- package/lib/config/ocSDKConfiguration.d.ts +7 -7
- package/lib/config/ocSDKConfiguration.js +9 -9
- package/lib/config/settings.d.ts +6 -6
- package/lib/config/settings.js +13 -13
- package/lib/core/AuthSettings.d.ts +5 -5
- package/lib/core/AuthSettings.js +2 -2
- package/lib/core/AxiosErrorCodes.d.ts +4 -4
- package/lib/core/AxiosErrorCodes.js +7 -7
- package/lib/core/CallingOptionsOptionSetNumber.d.ts +6 -6
- package/lib/core/CallingOptionsOptionSetNumber.js +9 -9
- package/lib/core/ChatConfig.d.ts +10 -10
- package/lib/core/ChatConfig.js +2 -2
- package/lib/core/ChatReconnectContext.d.ts +4 -4
- package/lib/core/ChatReconnectContext.js +2 -2
- package/lib/core/ChatReconnectOptionalParams.d.ts +3 -3
- package/lib/core/ChatReconnectOptionalParams.js +2 -2
- package/lib/core/ChatSDKConfig.d.ts +38 -38
- package/lib/core/ChatSDKConfig.js +2 -2
- package/lib/core/ChatSDKError.d.ts +64 -64
- package/lib/core/ChatSDKError.js +73 -73
- package/lib/core/ChatSDKExceptionDetails.d.ts +13 -13
- package/lib/core/ChatSDKExceptionDetails.js +2 -2
- package/lib/core/ChatTranscriptBody.d.ts +5 -5
- package/lib/core/ChatTranscriptBody.js +2 -2
- package/lib/core/ConversationMode.d.ts +5 -5
- package/lib/core/ConversationMode.js +8 -8
- package/lib/core/EmailLiveChatTranscriptOptionalParams.d.ts +4 -4
- package/lib/core/EmailLiveChatTranscriptOptionalParams.js +2 -2
- package/lib/core/GetAgentAvailabilityOptionalParams.d.ts +13 -13
- package/lib/core/GetAgentAvailabilityOptionalParams.js +2 -2
- package/lib/core/GetChatTokenOptionalParams.d.ts +3 -3
- package/lib/core/GetChatTokenOptionalParams.js +2 -2
- package/lib/core/GetConversationDetailsOptionalParams.d.ts +4 -4
- package/lib/core/GetConversationDetailsOptionalParams.js +2 -2
- package/lib/core/GetLiveChatConfigOptionalParams.d.ts +5 -5
- package/lib/core/GetLiveChatConfigOptionalParams.js +2 -2
- package/lib/core/GetLiveChatTranscriptOptionalParams.d.ts +4 -4
- package/lib/core/GetLiveChatTranscriptOptionalParams.js +2 -2
- package/lib/core/InitializeOptionalParams.d.ts +6 -6
- package/lib/core/InitializeOptionalParams.js +2 -2
- package/lib/core/LiveChatContext.d.ts +14 -14
- package/lib/core/LiveChatContext.js +2 -2
- package/lib/core/LiveChatVersion.d.ts +5 -5
- package/lib/core/LiveChatVersion.js +8 -8
- package/lib/core/LiveWorkItemDetails.d.ts +8 -8
- package/lib/core/LiveWorkItemDetails.js +2 -2
- package/lib/core/LiveWorkItemState.d.ts +8 -8
- package/lib/core/LiveWorkItemState.js +11 -11
- package/lib/core/OmnichannelConfig.d.ts +5 -5
- package/lib/core/OmnichannelConfig.js +2 -2
- package/lib/core/OmnichannelErrorCodes.d.ts +4 -4
- package/lib/core/OmnichannelErrorCodes.js +7 -7
- package/lib/core/PostChatContext.d.ts +8 -8
- package/lib/core/PostChatContext.js +2 -2
- package/lib/core/SetAuthTokenProviderOptionalParams.d.ts +3 -3
- package/lib/core/SetAuthTokenProviderOptionalParams.js +2 -2
- package/lib/core/StartChatOptionalParams.d.ts +18 -18
- package/lib/core/StartChatOptionalParams.js +2 -2
- package/lib/core/messaging/ACSChatMessageType.d.ts +7 -7
- package/lib/core/messaging/ACSChatMessageType.js +10 -10
- package/lib/core/messaging/ACSClient.d.ts +45 -45
- package/lib/core/messaging/ACSClient.js +612 -612
- package/lib/core/messaging/ACSClientConfig.d.ts +5 -5
- package/lib/core/messaging/ACSClientConfig.js +2 -2
- package/lib/core/messaging/ACSParticipantDisplayName.d.ts +6 -6
- package/lib/core/messaging/ACSParticipantDisplayName.js +9 -9
- package/lib/core/messaging/ACSSessionInfo.d.ts +5 -5
- package/lib/core/messaging/ACSSessionInfo.js +2 -2
- package/lib/core/messaging/ChatAdapterConfig.d.ts +8 -8
- package/lib/core/messaging/ChatAdapterConfig.js +2 -2
- package/lib/core/messaging/ChatAdapterOptionalParams.d.ts +24 -24
- package/lib/core/messaging/ChatAdapterOptionalParams.js +2 -2
- package/lib/core/messaging/ChatAdapterProtocols.d.ts +6 -6
- package/lib/core/messaging/ChatAdapterProtocols.js +10 -10
- package/lib/core/messaging/ChatSDKMessage.d.ts +6 -6
- package/lib/core/messaging/ChatSDKMessage.js +2 -2
- package/lib/core/messaging/IC3Config.d.ts +4 -4
- package/lib/core/messaging/IC3Config.js +2 -2
- package/lib/core/messaging/MessageTags.d.ts +3 -3
- package/lib/core/messaging/MessageTags.js +6 -6
- package/lib/core/messaging/OmnichannelMessage.d.ts +64 -64
- package/lib/core/messaging/OmnichannelMessage.js +51 -51
- package/lib/core/messaging/OnNewMessageOptionalParams.d.ts +3 -3
- package/lib/core/messaging/OnNewMessageOptionalParams.js +2 -2
- package/lib/external/ACSAdapter/AMSFileManager.d.ts +76 -76
- package/lib/external/ACSAdapter/AMSFileManager.js +394 -394
- package/lib/external/ACSAdapter/AMSFileScanner.d.ts +36 -36
- package/lib/external/ACSAdapter/AMSFileScanner.js +275 -275
- package/lib/external/ACSAdapter/activityUtils.d.ts +9 -9
- package/lib/external/ACSAdapter/activityUtils.js +79 -79
- package/lib/external/ACSAdapter/createChannelDataEgressMiddleware.d.ts +5 -5
- package/lib/external/ACSAdapter/createChannelDataEgressMiddleware.js +33 -33
- package/lib/external/ACSAdapter/createFileScanIngressMiddleware.d.ts +2 -2
- package/lib/external/ACSAdapter/createFileScanIngressMiddleware.js +95 -95
- package/lib/external/ACSAdapter/createFormatEgressTagsMiddleware.d.ts +2 -2
- package/lib/external/ACSAdapter/createFormatEgressTagsMiddleware.js +30 -30
- package/lib/external/ACSAdapter/createFormatIngressTagsMiddleware.d.ts +2 -2
- package/lib/external/ACSAdapter/createFormatIngressTagsMiddleware.js +24 -24
- package/lib/external/CallingSDK/ICallingSDKLogData.d.ts +7 -7
- package/lib/external/CallingSDK/ICallingSDKLogData.js +2 -2
- package/lib/external/IC3Adapter/IChatToken.d.ts +11 -11
- package/lib/external/IC3Adapter/IChatToken.js +3 -3
- package/lib/external/IC3Adapter/IIC3AdapterOptions.d.ts +22 -22
- package/lib/external/IC3Adapter/IIC3AdapterOptions.js +2 -2
- package/lib/external/IC3Adapter/INotification.d.ts +6 -6
- package/lib/external/IC3Adapter/INotification.js +2 -2
- package/lib/external/IC3Adapter/Notification.d.ts +7 -7
- package/lib/external/IC3Adapter/Notification.js +14 -14
- package/lib/external/IC3Client/IIC3SDKLogData.d.ts +9 -9
- package/lib/external/IC3Client/IIC3SDKLogData.js +2 -2
- package/lib/external/OCSDK/IOCSDKLogData.d.ts +14 -14
- package/lib/external/OCSDK/IOCSDKLogData.js +2 -2
- package/lib/index.d.ts +25 -25
- package/lib/index.js +34 -34
- package/lib/telemetry/AriaTelemetry.d.ts +40 -40
- package/lib/telemetry/AriaTelemetry.js +539 -539
- package/lib/telemetry/EUDomainNames.d.ts +2 -2
- package/lib/telemetry/EUDomainNames.js +16 -16
- package/lib/telemetry/EventMarker.d.ts +3 -3
- package/lib/telemetry/EventMarker.js +12 -12
- package/lib/telemetry/GCCDomainPatterns.d.ts +2 -2
- package/lib/telemetry/GCCDomainPatterns.js +7 -7
- package/lib/telemetry/LogLevel.d.ts +8 -8
- package/lib/telemetry/LogLevel.js +11 -11
- package/lib/telemetry/ScenarioMarker.d.ts +21 -21
- package/lib/telemetry/ScenarioMarker.js +82 -82
- package/lib/telemetry/ScenarioType.d.ts +11 -11
- package/lib/telemetry/ScenarioType.js +14 -14
- package/lib/telemetry/StopWatch.d.ts +6 -6
- package/lib/telemetry/StopWatch.js +14 -14
- package/lib/telemetry/TelemetryEvent.d.ts +46 -46
- package/lib/telemetry/TelemetryEvent.js +49 -49
- package/lib/telemetry/retrieveCollectorUri.d.ts +2 -2
- package/lib/telemetry/retrieveCollectorUri.js +25 -25
- package/lib/tsconfig.tsbuildinfo +1914 -1966
- package/lib/utils/AMSClientLoadStates.d.ts +6 -6
- package/lib/utils/AMSClientLoadStates.js +11 -11
- package/lib/utils/CoreServicesUtils.d.ts +7 -7
- package/lib/utils/CoreServicesUtils.js +39 -39
- package/lib/utils/WebUtils.d.ts +10 -10
- package/lib/utils/WebUtils.js +128 -128
- package/lib/utils/chatAdapterCreators.d.ts +20 -20
- package/lib/utils/chatAdapterCreators.js +208 -208
- package/lib/utils/createOcSDKConfiguration.d.ts +4 -4
- package/lib/utils/createOcSDKConfiguration.js +22 -22
- package/lib/utils/createOmnichannelMessage.d.ts +11 -11
- package/lib/utils/createOmnichannelMessage.js +77 -77
- package/lib/utils/createTelemetry.d.ts +3 -3
- package/lib/utils/createTelemetry.js +9 -9
- package/lib/utils/exceptionSuppressors.d.ts +29 -29
- package/lib/utils/exceptionSuppressors.js +49 -49
- package/lib/utils/exceptionThrowers.d.ts +119 -119
- package/lib/utils/exceptionThrowers.js +137 -137
- package/lib/utils/internalUtils.d.ts +4 -4
- package/lib/utils/internalUtils.js +16 -16
- package/lib/utils/libraries.d.ts +12 -12
- package/lib/utils/libraries.js +34 -34
- package/lib/utils/locale.d.ts +4 -4
- package/lib/utils/locale.js +60 -60
- package/lib/utils/location.d.ts +7 -7
- package/lib/utils/location.js +95 -95
- package/lib/utils/loggerUtils.d.ts +15 -15
- package/lib/utils/loggerUtils.js +55 -55
- package/lib/utils/loggers.d.ts +111 -111
- package/lib/utils/loggers.js +501 -501
- package/lib/utils/parsers.d.ts +6 -6
- package/lib/utils/parsers.js +10 -10
- package/lib/utils/platform.d.ts +9 -9
- package/lib/utils/platform.js +11 -11
- package/lib/utils/setOcUserAgent.d.ts +2 -2
- package/lib/utils/setOcUserAgent.js +21 -21
- package/lib/utils/sleep.d.ts +2 -2
- package/lib/utils/sleep.js +4 -4
- package/lib/utils/urlResolvers.d.ts +10 -10
- package/lib/utils/urlResolvers.js +64 -64
- package/lib/utils/utilities.d.ts +5 -5
- package/lib/utils/utilities.js +36 -36
- package/lib/validators/OmnichannelConfigValidator.d.ts +3 -3
- package/lib/validators/OmnichannelConfigValidator.js +28 -28
- package/lib/validators/SDKConfigValidators.d.ts +5 -5
- package/lib/validators/SDKConfigValidators.js +48 -48
- package/package.json +1 -1
- package/lib/utils/fillMobilePlatformData.d.ts +0 -2
- package/lib/utils/fillMobilePlatformData.js +0 -44
- package/lib/utils/fillMobilePlatformData.js.map +0 -1
- package/lib/utils/fillPlatformData.browser.d.ts +0 -2
- package/lib/utils/fillPlatformData.browser.js +0 -8
- package/lib/utils/fillPlatformData.browser.js.map +0 -1
- package/lib/utils/fillPlatformData.d.ts +0 -2
- package/lib/utils/fillPlatformData.js +0 -8
- package/lib/utils/fillPlatformData.js.map +0 -1
- package/lib/utils/fillWebPlatformData.d.ts +0 -2
- package/lib/utils/fillWebPlatformData.js +0 -21
- package/lib/utils/fillWebPlatformData.js.map +0 -1
@@ -1,463 +1,463 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
|
-
function step(op) {
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (_) try {
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
|
-
switch (op[0]) {
|
21
|
-
case 0: case 1: t = op; break;
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25
|
-
default:
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30
|
-
if (t[2]) _.ops.pop();
|
31
|
-
_.trys.pop(); continue;
|
32
|
-
}
|
33
|
-
op = body.call(thisArg, _);
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
36
|
-
}
|
37
|
-
};
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
39
|
-
exports.VoiceVideoCallingProxy = void 0;
|
40
|
-
var TelemetryEvent_1 = require("../telemetry/TelemetryEvent");
|
41
|
-
var SecondaryChannelType;
|
42
|
-
(function (SecondaryChannelType) {
|
43
|
-
SecondaryChannelType[SecondaryChannelType["Voice"] = 192370000] = "Voice";
|
44
|
-
SecondaryChannelType[SecondaryChannelType["Video"] = 192380000] = "Video";
|
45
|
-
SecondaryChannelType[SecondaryChannelType["Cobrowse"] = 192390000] = "Cobrowse";
|
46
|
-
})(SecondaryChannelType || (SecondaryChannelType = {}));
|
47
|
-
var SecondaryChannelEvents;
|
48
|
-
(function (SecondaryChannelEvents) {
|
49
|
-
SecondaryChannelEvents["Accept"] = "accept";
|
50
|
-
SecondaryChannelEvents["Reject"] = "reject";
|
51
|
-
SecondaryChannelEvents["Connect"] = "connect";
|
52
|
-
SecondaryChannelEvents["End"] = "end";
|
53
|
-
})(SecondaryChannelEvents || (SecondaryChannelEvents = {}));
|
54
|
-
var CallingEvents;
|
55
|
-
(function (CallingEvents) {
|
56
|
-
CallingEvents["CallAdded"] = "callAdded";
|
57
|
-
CallingEvents["LocalVideoStreamAdded"] = "localVideoStreamAdded";
|
58
|
-
CallingEvents["LocalVideoStreamRemoved"] = "localVideoStreamRemoved";
|
59
|
-
CallingEvents["RemoteVideoStreamAdded"] = "remoteVideoStreamAdded";
|
60
|
-
CallingEvents["RemoteVideoStreamRemoved"] = "remoteVideoStreamRemoved";
|
61
|
-
CallingEvents["CallDisconnected"] = "callDisconnected";
|
62
|
-
CallingEvents["ParticipantDisconnected"] = "participantDisconnected";
|
63
|
-
CallingEvents["IncomingCallEnded"] = "incomingCallEnded";
|
64
|
-
})(CallingEvents || (CallingEvents = {}));
|
65
|
-
var VoiceVideoCallingProxy = /** @class */ (function () {
|
66
|
-
function VoiceVideoCallingProxy() {
|
67
|
-
this.debug = false;
|
68
|
-
this.callClientName = 'ElevateToVoiceVideo';
|
69
|
-
this.proxy = window["Microsoft.Omnichannel.Calling.SDK"].VoiceVideoCalling; // eslint-disable-line @typescript-eslint/no-explicit-any
|
70
|
-
this.proxyInstance = this.proxy.getInstance();
|
71
|
-
}
|
72
|
-
VoiceVideoCallingProxy.getInstance = function () {
|
73
|
-
if (!this._instance) {
|
74
|
-
this._instance = new VoiceVideoCallingProxy();
|
75
|
-
}
|
76
|
-
return this._instance;
|
77
|
-
};
|
78
|
-
/* istanbul ignore next */
|
79
|
-
VoiceVideoCallingProxy.prototype.setDebug = function (flag) {
|
80
|
-
this.debug = flag;
|
81
|
-
};
|
82
|
-
VoiceVideoCallingProxy.prototype.useScenarioMarker = function (scenarioMarker) {
|
83
|
-
this.scenarioMarker = scenarioMarker;
|
84
|
-
};
|
85
|
-
VoiceVideoCallingProxy.prototype.load = function (params) {
|
86
|
-
if (params === void 0) { params = {}; }
|
87
|
-
return __awaiter(this, void 0, void 0, function () {
|
88
|
-
return __generator(this, function (_a) {
|
89
|
-
if (params.logger) {
|
90
|
-
this.logger = params.logger;
|
91
|
-
}
|
92
|
-
this.proxyInstance.load(params);
|
93
|
-
return [2 /*return*/];
|
94
|
-
});
|
95
|
-
});
|
96
|
-
};
|
97
|
-
VoiceVideoCallingProxy.prototype.isInitialized = function () {
|
98
|
-
return this.proxyInstance.isInitialized();
|
99
|
-
};
|
100
|
-
VoiceVideoCallingProxy.prototype.initialize = function (params) {
|
101
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
102
|
-
return __awaiter(this, void 0, void 0, function () {
|
103
|
-
var error_1;
|
104
|
-
return __generator(this, function (_j) {
|
105
|
-
switch (_j.label) {
|
106
|
-
case 0:
|
107
|
-
/* istanbul ignore next */
|
108
|
-
this.debug && console.debug("[VoiceVideoCallingProxy] VoiceVideoCallingParams: " + JSON.stringify(params));
|
109
|
-
this.callingParams = params;
|
110
|
-
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.startScenario(TelemetryEvent_1.default.InitializeVoiceVideoCallingSDK);
|
111
|
-
/* istanbul ignore next */
|
112
|
-
this.debug && console.debug("[VoiceVideoCallingProxy][initialize] _isLoaded: " + this.proxyInstance._isLoaded);
|
113
|
-
if (!!this.proxyInstance._isLoaded) return [3 /*break*/, 2];
|
114
|
-
return [4 /*yield*/, this.proxyInstance.load({
|
115
|
-
logger: this.logger || undefined
|
116
|
-
})];
|
117
|
-
case 1:
|
118
|
-
_j.sent();
|
119
|
-
_j.label = 2;
|
120
|
-
case 2:
|
121
|
-
_j.trys.push([2, 4, , 5]);
|
122
|
-
return [4 /*yield*/, this.proxyInstance.initialize({
|
123
|
-
callClientName: this.callClientName,
|
124
|
-
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),
|
125
|
-
selfVideoHTMLElementId: (_e = this.callingParams) === null || _e === void 0 ? void 0 : _e.selfVideoHTMLElementId,
|
126
|
-
remoteVideoHTMLElementId: (_f = this.callingParams) === null || _f === void 0 ? void 0 : _f.remoteVideoHTMLElementId
|
127
|
-
})];
|
128
|
-
case 3:
|
129
|
-
_j.sent();
|
130
|
-
(_g = this.scenarioMarker) === null || _g === void 0 ? void 0 : _g.completeScenario(TelemetryEvent_1.default.InitializeVoiceVideoCallingSDK);
|
131
|
-
return [3 /*break*/, 5];
|
132
|
-
case 4:
|
133
|
-
error_1 = _j.sent();
|
134
|
-
console.log(error_1);
|
135
|
-
(_h = this.scenarioMarker) === null || _h === void 0 ? void 0 : _h.failScenario(TelemetryEvent_1.default.InitializeVoiceVideoCallingSDK);
|
136
|
-
return [3 /*break*/, 5];
|
137
|
-
case 5: return [2 /*return*/];
|
138
|
-
}
|
139
|
-
});
|
140
|
-
});
|
141
|
-
};
|
142
|
-
VoiceVideoCallingProxy.prototype.addEventListener = function (eventName, callback) {
|
143
|
-
var _this = this;
|
144
|
-
this.proxyInstance.registerEvent(eventName, function (params) {
|
145
|
-
var callId = params.callId;
|
146
|
-
if (eventName === CallingEvents.CallAdded) {
|
147
|
-
_this.callId = callId;
|
148
|
-
}
|
149
|
-
/* istanbul ignore next */
|
150
|
-
_this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "] callId: " + callId);
|
151
|
-
if (callId !== _this.callId) {
|
152
|
-
return;
|
153
|
-
}
|
154
|
-
callback(params);
|
155
|
-
});
|
156
|
-
};
|
157
|
-
VoiceVideoCallingProxy.prototype.isMicrophoneMuted = function () {
|
158
|
-
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
|
159
|
-
return this.proxyInstance.isMicrophoneMuted({ callClientName: callClientName, callId: callId });
|
160
|
-
};
|
161
|
-
VoiceVideoCallingProxy.prototype.acceptCall = function (params) {
|
162
|
-
var _a, _b, _c, _d, _e, _f;
|
163
|
-
if (params === void 0) { params = {}; }
|
164
|
-
return __awaiter(this, void 0, void 0, function () {
|
165
|
-
var _g, callClientName, callId, _h, exceptionDetails, body, exceptionDetails;
|
166
|
-
return __generator(this, function (_j) {
|
167
|
-
switch (_j.label) {
|
168
|
-
case 0:
|
169
|
-
_g = this, callClientName = _g.callClientName, callId = _g.callId;
|
170
|
-
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.startScenario(params.withVideo ? TelemetryEvent_1.default.AcceptVideoCall : TelemetryEvent_1.default.AcceptVoiceCall, {
|
171
|
-
CallId: callId || ''
|
172
|
-
});
|
173
|
-
/* istanbul ignore next */
|
174
|
-
this.debug && console.debug("[VoiceVideoCallingProxy][acceptCall] callId: " + callId);
|
175
|
-
/* istanbul ignore next */
|
176
|
-
this.debug && console.debug(params);
|
177
|
-
_j.label = 1;
|
178
|
-
case 1:
|
179
|
-
_j.trys.push([1, 3, , 4]);
|
180
|
-
return [4 /*yield*/, this.proxyInstance.acceptCall({ callClientName: callClientName, callId: callId, withVideo: params.withVideo || false })];
|
181
|
-
case 2:
|
182
|
-
_j.sent();
|
183
|
-
return [3 /*break*/, 4];
|
184
|
-
case 3:
|
185
|
-
_h = _j.sent();
|
186
|
-
exceptionDetails = {
|
187
|
-
response: params.withVideo ? "AcceptVideoCallFailed" : "AcceptVoiceCallFailed"
|
188
|
-
};
|
189
|
-
(_b = this.scenarioMarker) === null || _b === void 0 ? void 0 : _b.failScenario(params.withVideo ? TelemetryEvent_1.default.AcceptVideoCall : TelemetryEvent_1.default.AcceptVoiceCall, {
|
190
|
-
CallId: callId || '',
|
191
|
-
ExceptionDetails: JSON.stringify(exceptionDetails)
|
192
|
-
});
|
193
|
-
return [3 /*break*/, 4];
|
194
|
-
case 4:
|
195
|
-
body = {
|
196
|
-
SecondaryChannelType: params.withVideo ? SecondaryChannelType.Video : SecondaryChannelType.Voice,
|
197
|
-
SecondaryChannelEventType: SecondaryChannelEvents.Accept
|
198
|
-
};
|
199
|
-
try {
|
200
|
-
(_c = this.callingParams) === null || _c === void 0 ? void 0 : _c.OCClient.makeSecondaryChannelEventRequest((_d = this.callingParams) === null || _d === void 0 ? void 0 : _d.chatToken.requestId, body);
|
201
|
-
(_e = this.scenarioMarker) === null || _e === void 0 ? void 0 : _e.completeScenario(params.withVideo ? TelemetryEvent_1.default.AcceptVideoCall : TelemetryEvent_1.default.AcceptVoiceCall, {
|
202
|
-
CallId: callId || ''
|
203
|
-
});
|
204
|
-
/* istanbul ignore next */
|
205
|
-
this.debug && console.debug("[VoiceVideoCallingProxy][acceptCall][makeSecondaryChannelEventRequest]");
|
206
|
-
}
|
207
|
-
catch (e) {
|
208
|
-
exceptionDetails = {
|
209
|
-
response: "OCClientMakeSecondaryChannelEventRequestFailed"
|
210
|
-
};
|
211
|
-
(_f = this.scenarioMarker) === null || _f === void 0 ? void 0 : _f.failScenario(params.withVideo ? TelemetryEvent_1.default.AcceptVideoCall : TelemetryEvent_1.default.AcceptVoiceCall, {
|
212
|
-
CallId: callId || '',
|
213
|
-
ExceptionDetails: JSON.stringify(exceptionDetails)
|
214
|
-
});
|
215
|
-
console.error("[VoiceVideoCallingProxy][acceptCall][makeSecondaryChannelEventRequest] Failure " + e);
|
216
|
-
}
|
217
|
-
return [2 /*return*/];
|
218
|
-
}
|
219
|
-
});
|
220
|
-
});
|
221
|
-
};
|
222
|
-
VoiceVideoCallingProxy.prototype.rejectCall = function () {
|
223
|
-
var _a, _b, _c, _d, _e, _f;
|
224
|
-
return __awaiter(this, void 0, void 0, function () {
|
225
|
-
var _g, callClientName, callId, _h, exceptionDetails, body, exceptionDetails;
|
226
|
-
return __generator(this, function (_j) {
|
227
|
-
switch (_j.label) {
|
228
|
-
case 0:
|
229
|
-
_g = this, callClientName = _g.callClientName, callId = _g.callId;
|
230
|
-
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.startScenario(TelemetryEvent_1.default.RejectCall, {
|
231
|
-
CallId: callId || ''
|
232
|
-
});
|
233
|
-
/* istanbul ignore next */
|
234
|
-
this.debug && console.debug("[VoiceVideoCallingProxy][rejectCall] callId: " + callId);
|
235
|
-
_j.label = 1;
|
236
|
-
case 1:
|
237
|
-
_j.trys.push([1, 3, , 4]);
|
238
|
-
return [4 /*yield*/, this.proxyInstance.rejectCall({ callClientName: callClientName, callId: callId })];
|
239
|
-
case 2:
|
240
|
-
_j.sent();
|
241
|
-
(_b = this.scenarioMarker) === null || _b === void 0 ? void 0 : _b.completeScenario(TelemetryEvent_1.default.RejectCall, {
|
242
|
-
CallId: callId || ''
|
243
|
-
});
|
244
|
-
return [3 /*break*/, 4];
|
245
|
-
case 3:
|
246
|
-
_h = _j.sent();
|
247
|
-
exceptionDetails = {
|
248
|
-
response: "RejectCallFailed"
|
249
|
-
};
|
250
|
-
(_c = this.scenarioMarker) === null || _c === void 0 ? void 0 : _c.failScenario(TelemetryEvent_1.default.RejectCall, {
|
251
|
-
CallId: callId || '',
|
252
|
-
ExceptionDetails: JSON.stringify(exceptionDetails)
|
253
|
-
});
|
254
|
-
return [3 /*break*/, 4];
|
255
|
-
case 4:
|
256
|
-
body = {
|
257
|
-
SecondaryChannelType: this.isRemoteVideoEnabled() ? SecondaryChannelType.Video : SecondaryChannelType.Voice,
|
258
|
-
SecondaryChannelEventType: SecondaryChannelEvents.Reject
|
259
|
-
};
|
260
|
-
try {
|
261
|
-
(_d = this.callingParams) === null || _d === void 0 ? void 0 : _d.OCClient.makeSecondaryChannelEventRequest((_e = this.callingParams) === null || _e === void 0 ? void 0 : _e.chatToken.requestId, body);
|
262
|
-
/* istanbul ignore next */
|
263
|
-
this.debug && console.debug("[VoiceVideoCallingProxy][rejectCall][makeSecondaryChannelEventRequest]");
|
264
|
-
}
|
265
|
-
catch (e) {
|
266
|
-
exceptionDetails = {
|
267
|
-
response: "OCClientMakeSecondaryChannelEventRequestFailed"
|
268
|
-
};
|
269
|
-
(_f = this.scenarioMarker) === null || _f === void 0 ? void 0 : _f.failScenario(TelemetryEvent_1.default.RejectCall, {
|
270
|
-
CallId: callId || '',
|
271
|
-
ExceptionDetails: JSON.stringify(exceptionDetails)
|
272
|
-
});
|
273
|
-
console.error("[VoiceVideoCallingProxy][rejectCall][makeSecondaryChannelEventRequest] Failure " + e);
|
274
|
-
}
|
275
|
-
return [2 /*return*/];
|
276
|
-
}
|
277
|
-
});
|
278
|
-
});
|
279
|
-
};
|
280
|
-
VoiceVideoCallingProxy.prototype.stopCall = function () {
|
281
|
-
var _a, _b, _c, _d, _e;
|
282
|
-
return __awaiter(this, void 0, void 0, function () {
|
283
|
-
var _f, callClientName, callId, forEveryone, _g;
|
284
|
-
return __generator(this, function (_h) {
|
285
|
-
switch (_h.label) {
|
286
|
-
case 0:
|
287
|
-
_f = this, callClientName = _f.callClientName, callId = _f.callId;
|
288
|
-
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.startScenario(TelemetryEvent_1.default.StopCall, {
|
289
|
-
CallId: callId || ''
|
290
|
-
});
|
291
|
-
/* istanbul ignore next */
|
292
|
-
this.debug && console.debug("[VoiceVideoCallingProxy][stopCall] callId: " + callId);
|
293
|
-
forEveryone = ((_c = (_b = this.callingParams) === null || _b === void 0 ? void 0 : _b.chatToken.voiceVideoCallToken) === null || _c === void 0 ? void 0 : _c.Token) ? true : false;
|
294
|
-
_h.label = 1;
|
295
|
-
case 1:
|
296
|
-
_h.trys.push([1, 3, , 4]);
|
297
|
-
return [4 /*yield*/, this.proxyInstance.stopCall({ callClientName: callClientName, callId: callId, forEveryone: forEveryone })];
|
298
|
-
case 2:
|
299
|
-
_h.sent();
|
300
|
-
(_d = this.scenarioMarker) === null || _d === void 0 ? void 0 : _d.completeScenario(TelemetryEvent_1.default.StopCall, {
|
301
|
-
CallId: callId || ''
|
302
|
-
});
|
303
|
-
return [3 /*break*/, 4];
|
304
|
-
case 3:
|
305
|
-
_g = _h.sent();
|
306
|
-
(_e = this.scenarioMarker) === null || _e === void 0 ? void 0 : _e.failScenario(TelemetryEvent_1.default.StopCall, {
|
307
|
-
CallId: callId || '',
|
308
|
-
});
|
309
|
-
return [3 /*break*/, 4];
|
310
|
-
case 4: return [2 /*return*/];
|
311
|
-
}
|
312
|
-
});
|
313
|
-
});
|
314
|
-
};
|
315
|
-
VoiceVideoCallingProxy.prototype.toggleMute = function () {
|
316
|
-
return __awaiter(this, void 0, void 0, function () {
|
317
|
-
var _a, callClientName, callId;
|
318
|
-
return __generator(this, function (_b) {
|
319
|
-
_a = this, callClientName = _a.callClientName, callId = _a.callId;
|
320
|
-
return [2 /*return*/, this.proxyInstance.toggleMute({ callClientName: callClientName, callId: callId })];
|
321
|
-
});
|
322
|
-
});
|
323
|
-
};
|
324
|
-
VoiceVideoCallingProxy.prototype.isRemoteVideoEnabled = function () {
|
325
|
-
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
|
326
|
-
return this.proxyInstance.isRemoteVideoEnabled({ callClientName: callClientName, callId: callId });
|
327
|
-
};
|
328
|
-
VoiceVideoCallingProxy.prototype.isLocalVideoEnabled = function () {
|
329
|
-
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
|
330
|
-
return this.proxyInstance.isLocalVideoEnabled({ callClientName: callClientName, callId: callId });
|
331
|
-
};
|
332
|
-
VoiceVideoCallingProxy.prototype.toggleLocalVideo = function () {
|
333
|
-
return __awaiter(this, void 0, void 0, function () {
|
334
|
-
var _a, callClientName, callId;
|
335
|
-
return __generator(this, function (_b) {
|
336
|
-
_a = this, callClientName = _a.callClientName, callId = _a.callId;
|
337
|
-
return [2 /*return*/, this.proxyInstance.toggleLocalVideo({ callClientName: callClientName, callId: callId })];
|
338
|
-
});
|
339
|
-
});
|
340
|
-
};
|
341
|
-
VoiceVideoCallingProxy.prototype.isInACall = function () {
|
342
|
-
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
|
343
|
-
return this.proxyInstance.isInACall({ callClientName: callClientName, callId: callId });
|
344
|
-
};
|
345
|
-
VoiceVideoCallingProxy.prototype.renderVideoStreams = function () {
|
346
|
-
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
|
347
|
-
return this.proxyInstance.renderVideoStreams({ callClientName: callClientName, callId: callId });
|
348
|
-
};
|
349
|
-
VoiceVideoCallingProxy.prototype.disposeVideoRenderers = function () {
|
350
|
-
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
|
351
|
-
return this.proxyInstance.disposeVideoRenderers({ callClientName: callClientName, callId: callId });
|
352
|
-
};
|
353
|
-
VoiceVideoCallingProxy.prototype.close = function () {
|
354
|
-
/* istanbul ignore next */
|
355
|
-
this.debug && console.debug("[VoiceVideoCallingProxy][close]");
|
356
|
-
this.proxyInstance.dispose();
|
357
|
-
this.callingParams = undefined;
|
358
|
-
this.callId = undefined;
|
359
|
-
};
|
360
|
-
VoiceVideoCallingProxy.prototype.onCallAdded = function (callback) {
|
361
|
-
var eventName = CallingEvents.CallAdded;
|
362
|
-
/* istanbul ignore next */
|
363
|
-
this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");
|
364
|
-
this.addEventListener(eventName, callback);
|
365
|
-
};
|
366
|
-
VoiceVideoCallingProxy.prototype.onLocalVideoStreamAdded = function (callback) {
|
367
|
-
var eventName = CallingEvents.LocalVideoStreamAdded;
|
368
|
-
/* istanbul ignore next */
|
369
|
-
this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");
|
370
|
-
this.addEventListener(eventName, callback);
|
371
|
-
};
|
372
|
-
VoiceVideoCallingProxy.prototype.onLocalVideoStreamRemoved = function (callback) {
|
373
|
-
var eventName = CallingEvents.LocalVideoStreamRemoved;
|
374
|
-
/* istanbul ignore next */
|
375
|
-
this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");
|
376
|
-
this.addEventListener(eventName, callback);
|
377
|
-
};
|
378
|
-
VoiceVideoCallingProxy.prototype.onRemoteVideoStreamAdded = function (callback) {
|
379
|
-
var eventName = CallingEvents.RemoteVideoStreamAdded;
|
380
|
-
/* istanbul ignore next */
|
381
|
-
this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");
|
382
|
-
this.addEventListener(eventName, callback);
|
383
|
-
};
|
384
|
-
VoiceVideoCallingProxy.prototype.onRemoteVideoStreamRemoved = function (callback) {
|
385
|
-
var eventName = CallingEvents.RemoteVideoStreamRemoved;
|
386
|
-
/* istanbul ignore next */
|
387
|
-
this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");
|
388
|
-
this.addEventListener(eventName, callback);
|
389
|
-
};
|
390
|
-
VoiceVideoCallingProxy.prototype.onCallDisconnected = function (callback) {
|
391
|
-
var _this = this;
|
392
|
-
var eventName = CallingEvents.CallDisconnected;
|
393
|
-
/* istanbul ignore next */
|
394
|
-
this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");
|
395
|
-
this.addEventListener(eventName, function (params) { return __awaiter(_this, void 0, void 0, function () {
|
396
|
-
var body, exceptionDetails;
|
397
|
-
var _a, _b, _c, _d, _e;
|
398
|
-
return __generator(this, function (_f) {
|
399
|
-
body = {
|
400
|
-
SecondaryChannelType: SecondaryChannelType.Voice,
|
401
|
-
SecondaryChannelEventType: SecondaryChannelEvents.End
|
402
|
-
};
|
403
|
-
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.startScenario(TelemetryEvent_1.default.OnCallDisconnected, {
|
404
|
-
CallId: this.callId || ''
|
405
|
-
});
|
406
|
-
try {
|
407
|
-
(_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);
|
408
|
-
this.debug && console.debug("[VoiceVideoCallingProxy][onCallDisconnected][makeSecondaryChannelEventRequest]");
|
409
|
-
(_d = this.scenarioMarker) === null || _d === void 0 ? void 0 : _d.completeScenario(TelemetryEvent_1.default.OnCallDisconnected, {
|
410
|
-
CallId: this.callId || ''
|
411
|
-
});
|
412
|
-
}
|
413
|
-
catch (e) {
|
414
|
-
console.error("[VoiceVideoCallingProxy][onCallDisconnected][makeSecondaryChannelEventRequest] Failure " + e);
|
415
|
-
exceptionDetails = {
|
416
|
-
response: 'OCClientMakeSecondaryChannelEventRequestFailed'
|
417
|
-
};
|
418
|
-
(_e = this.scenarioMarker) === null || _e === void 0 ? void 0 : _e.failScenario(TelemetryEvent_1.default.OnCallDisconnected, {
|
419
|
-
CallId: this.callId || '',
|
420
|
-
ExceptionDetails: JSON.stringify(exceptionDetails)
|
421
|
-
});
|
422
|
-
}
|
423
|
-
this.clearRemoteVideoElementChildren();
|
424
|
-
callback(params);
|
425
|
-
return [2 /*return*/];
|
426
|
-
});
|
427
|
-
}); });
|
428
|
-
};
|
429
|
-
VoiceVideoCallingProxy.prototype.clearRemoteVideoElementChildren = function () {
|
430
|
-
var _a, _b;
|
431
|
-
// Remove remoteVideoHTMLElement children if any or video won't be rendered properly
|
432
|
-
if ((_a = this.callingParams) === null || _a === void 0 ? void 0 : _a.remoteVideoHTMLElementId) {
|
433
|
-
var remoteVideoElement = document.getElementById((_b = this.callingParams) === null || _b === void 0 ? void 0 : _b.remoteVideoHTMLElementId);
|
434
|
-
while (remoteVideoElement === null || remoteVideoElement === void 0 ? void 0 : remoteVideoElement.firstChild) {
|
435
|
-
/* istanbul ignore next */
|
436
|
-
this.debug && console.debug('[VoiceVideoCallingProxy][clearRemoteVideoElement]');
|
437
|
-
remoteVideoElement.firstChild.remove();
|
438
|
-
}
|
439
|
-
}
|
440
|
-
};
|
441
|
-
return VoiceVideoCallingProxy;
|
442
|
-
}());
|
443
|
-
exports.VoiceVideoCallingProxy = VoiceVideoCallingProxy;
|
444
|
-
var createVoiceVideoCalling = function (params) {
|
445
|
-
if (params === void 0) { params = {}; }
|
446
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
447
|
-
var proxy;
|
448
|
-
return __generator(this, function (_a) {
|
449
|
-
switch (_a.label) {
|
450
|
-
case 0:
|
451
|
-
proxy = VoiceVideoCallingProxy.getInstance();
|
452
|
-
return [4 /*yield*/, proxy.load({
|
453
|
-
logger: params.logger || undefined
|
454
|
-
})];
|
455
|
-
case 1:
|
456
|
-
_a.sent();
|
457
|
-
return [2 /*return*/, Promise.resolve(proxy)];
|
458
|
-
}
|
459
|
-
});
|
460
|
-
});
|
461
|
-
};
|
462
|
-
exports.default = createVoiceVideoCalling;
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
|
+
function step(op) {
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
17
|
+
while (_) try {
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
|
+
switch (op[0]) {
|
21
|
+
case 0: case 1: t = op; break;
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25
|
+
default:
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30
|
+
if (t[2]) _.ops.pop();
|
31
|
+
_.trys.pop(); continue;
|
32
|
+
}
|
33
|
+
op = body.call(thisArg, _);
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
36
|
+
}
|
37
|
+
};
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
39
|
+
exports.VoiceVideoCallingProxy = void 0;
|
40
|
+
var TelemetryEvent_1 = require("../telemetry/TelemetryEvent");
|
41
|
+
var SecondaryChannelType;
|
42
|
+
(function (SecondaryChannelType) {
|
43
|
+
SecondaryChannelType[SecondaryChannelType["Voice"] = 192370000] = "Voice";
|
44
|
+
SecondaryChannelType[SecondaryChannelType["Video"] = 192380000] = "Video";
|
45
|
+
SecondaryChannelType[SecondaryChannelType["Cobrowse"] = 192390000] = "Cobrowse";
|
46
|
+
})(SecondaryChannelType || (SecondaryChannelType = {}));
|
47
|
+
var SecondaryChannelEvents;
|
48
|
+
(function (SecondaryChannelEvents) {
|
49
|
+
SecondaryChannelEvents["Accept"] = "accept";
|
50
|
+
SecondaryChannelEvents["Reject"] = "reject";
|
51
|
+
SecondaryChannelEvents["Connect"] = "connect";
|
52
|
+
SecondaryChannelEvents["End"] = "end";
|
53
|
+
})(SecondaryChannelEvents || (SecondaryChannelEvents = {}));
|
54
|
+
var CallingEvents;
|
55
|
+
(function (CallingEvents) {
|
56
|
+
CallingEvents["CallAdded"] = "callAdded";
|
57
|
+
CallingEvents["LocalVideoStreamAdded"] = "localVideoStreamAdded";
|
58
|
+
CallingEvents["LocalVideoStreamRemoved"] = "localVideoStreamRemoved";
|
59
|
+
CallingEvents["RemoteVideoStreamAdded"] = "remoteVideoStreamAdded";
|
60
|
+
CallingEvents["RemoteVideoStreamRemoved"] = "remoteVideoStreamRemoved";
|
61
|
+
CallingEvents["CallDisconnected"] = "callDisconnected";
|
62
|
+
CallingEvents["ParticipantDisconnected"] = "participantDisconnected";
|
63
|
+
CallingEvents["IncomingCallEnded"] = "incomingCallEnded";
|
64
|
+
})(CallingEvents || (CallingEvents = {}));
|
65
|
+
var VoiceVideoCallingProxy = /** @class */ (function () {
|
66
|
+
function VoiceVideoCallingProxy() {
|
67
|
+
this.debug = false;
|
68
|
+
this.callClientName = 'ElevateToVoiceVideo';
|
69
|
+
this.proxy = window["Microsoft.Omnichannel.Calling.SDK"].VoiceVideoCalling; // eslint-disable-line @typescript-eslint/no-explicit-any
|
70
|
+
this.proxyInstance = this.proxy.getInstance();
|
71
|
+
}
|
72
|
+
VoiceVideoCallingProxy.getInstance = function () {
|
73
|
+
if (!this._instance) {
|
74
|
+
this._instance = new VoiceVideoCallingProxy();
|
75
|
+
}
|
76
|
+
return this._instance;
|
77
|
+
};
|
78
|
+
/* istanbul ignore next */
|
79
|
+
VoiceVideoCallingProxy.prototype.setDebug = function (flag) {
|
80
|
+
this.debug = flag;
|
81
|
+
};
|
82
|
+
VoiceVideoCallingProxy.prototype.useScenarioMarker = function (scenarioMarker) {
|
83
|
+
this.scenarioMarker = scenarioMarker;
|
84
|
+
};
|
85
|
+
VoiceVideoCallingProxy.prototype.load = function (params) {
|
86
|
+
if (params === void 0) { params = {}; }
|
87
|
+
return __awaiter(this, void 0, void 0, function () {
|
88
|
+
return __generator(this, function (_a) {
|
89
|
+
if (params.logger) {
|
90
|
+
this.logger = params.logger;
|
91
|
+
}
|
92
|
+
this.proxyInstance.load(params);
|
93
|
+
return [2 /*return*/];
|
94
|
+
});
|
95
|
+
});
|
96
|
+
};
|
97
|
+
VoiceVideoCallingProxy.prototype.isInitialized = function () {
|
98
|
+
return this.proxyInstance.isInitialized();
|
99
|
+
};
|
100
|
+
VoiceVideoCallingProxy.prototype.initialize = function (params) {
|
101
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
102
|
+
return __awaiter(this, void 0, void 0, function () {
|
103
|
+
var error_1;
|
104
|
+
return __generator(this, function (_j) {
|
105
|
+
switch (_j.label) {
|
106
|
+
case 0:
|
107
|
+
/* istanbul ignore next */
|
108
|
+
this.debug && console.debug("[VoiceVideoCallingProxy] VoiceVideoCallingParams: " + JSON.stringify(params));
|
109
|
+
this.callingParams = params;
|
110
|
+
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.startScenario(TelemetryEvent_1.default.InitializeVoiceVideoCallingSDK);
|
111
|
+
/* istanbul ignore next */
|
112
|
+
this.debug && console.debug("[VoiceVideoCallingProxy][initialize] _isLoaded: " + this.proxyInstance._isLoaded);
|
113
|
+
if (!!this.proxyInstance._isLoaded) return [3 /*break*/, 2];
|
114
|
+
return [4 /*yield*/, this.proxyInstance.load({
|
115
|
+
logger: this.logger || undefined
|
116
|
+
})];
|
117
|
+
case 1:
|
118
|
+
_j.sent();
|
119
|
+
_j.label = 2;
|
120
|
+
case 2:
|
121
|
+
_j.trys.push([2, 4, , 5]);
|
122
|
+
return [4 /*yield*/, this.proxyInstance.initialize({
|
123
|
+
callClientName: this.callClientName,
|
124
|
+
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),
|
125
|
+
selfVideoHTMLElementId: (_e = this.callingParams) === null || _e === void 0 ? void 0 : _e.selfVideoHTMLElementId,
|
126
|
+
remoteVideoHTMLElementId: (_f = this.callingParams) === null || _f === void 0 ? void 0 : _f.remoteVideoHTMLElementId
|
127
|
+
})];
|
128
|
+
case 3:
|
129
|
+
_j.sent();
|
130
|
+
(_g = this.scenarioMarker) === null || _g === void 0 ? void 0 : _g.completeScenario(TelemetryEvent_1.default.InitializeVoiceVideoCallingSDK);
|
131
|
+
return [3 /*break*/, 5];
|
132
|
+
case 4:
|
133
|
+
error_1 = _j.sent();
|
134
|
+
console.log(error_1);
|
135
|
+
(_h = this.scenarioMarker) === null || _h === void 0 ? void 0 : _h.failScenario(TelemetryEvent_1.default.InitializeVoiceVideoCallingSDK);
|
136
|
+
return [3 /*break*/, 5];
|
137
|
+
case 5: return [2 /*return*/];
|
138
|
+
}
|
139
|
+
});
|
140
|
+
});
|
141
|
+
};
|
142
|
+
VoiceVideoCallingProxy.prototype.addEventListener = function (eventName, callback) {
|
143
|
+
var _this = this;
|
144
|
+
this.proxyInstance.registerEvent(eventName, function (params) {
|
145
|
+
var callId = params.callId;
|
146
|
+
if (eventName === CallingEvents.CallAdded) {
|
147
|
+
_this.callId = callId;
|
148
|
+
}
|
149
|
+
/* istanbul ignore next */
|
150
|
+
_this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "] callId: " + callId);
|
151
|
+
if (callId !== _this.callId) {
|
152
|
+
return;
|
153
|
+
}
|
154
|
+
callback(params);
|
155
|
+
});
|
156
|
+
};
|
157
|
+
VoiceVideoCallingProxy.prototype.isMicrophoneMuted = function () {
|
158
|
+
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
|
159
|
+
return this.proxyInstance.isMicrophoneMuted({ callClientName: callClientName, callId: callId });
|
160
|
+
};
|
161
|
+
VoiceVideoCallingProxy.prototype.acceptCall = function (params) {
|
162
|
+
var _a, _b, _c, _d, _e, _f;
|
163
|
+
if (params === void 0) { params = {}; }
|
164
|
+
return __awaiter(this, void 0, void 0, function () {
|
165
|
+
var _g, callClientName, callId, _h, exceptionDetails, body, exceptionDetails;
|
166
|
+
return __generator(this, function (_j) {
|
167
|
+
switch (_j.label) {
|
168
|
+
case 0:
|
169
|
+
_g = this, callClientName = _g.callClientName, callId = _g.callId;
|
170
|
+
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.startScenario(params.withVideo ? TelemetryEvent_1.default.AcceptVideoCall : TelemetryEvent_1.default.AcceptVoiceCall, {
|
171
|
+
CallId: callId || ''
|
172
|
+
});
|
173
|
+
/* istanbul ignore next */
|
174
|
+
this.debug && console.debug("[VoiceVideoCallingProxy][acceptCall] callId: " + callId);
|
175
|
+
/* istanbul ignore next */
|
176
|
+
this.debug && console.debug(params);
|
177
|
+
_j.label = 1;
|
178
|
+
case 1:
|
179
|
+
_j.trys.push([1, 3, , 4]);
|
180
|
+
return [4 /*yield*/, this.proxyInstance.acceptCall({ callClientName: callClientName, callId: callId, withVideo: params.withVideo || false })];
|
181
|
+
case 2:
|
182
|
+
_j.sent();
|
183
|
+
return [3 /*break*/, 4];
|
184
|
+
case 3:
|
185
|
+
_h = _j.sent();
|
186
|
+
exceptionDetails = {
|
187
|
+
response: params.withVideo ? "AcceptVideoCallFailed" : "AcceptVoiceCallFailed"
|
188
|
+
};
|
189
|
+
(_b = this.scenarioMarker) === null || _b === void 0 ? void 0 : _b.failScenario(params.withVideo ? TelemetryEvent_1.default.AcceptVideoCall : TelemetryEvent_1.default.AcceptVoiceCall, {
|
190
|
+
CallId: callId || '',
|
191
|
+
ExceptionDetails: JSON.stringify(exceptionDetails)
|
192
|
+
});
|
193
|
+
return [3 /*break*/, 4];
|
194
|
+
case 4:
|
195
|
+
body = {
|
196
|
+
SecondaryChannelType: params.withVideo ? SecondaryChannelType.Video : SecondaryChannelType.Voice,
|
197
|
+
SecondaryChannelEventType: SecondaryChannelEvents.Accept
|
198
|
+
};
|
199
|
+
try {
|
200
|
+
(_c = this.callingParams) === null || _c === void 0 ? void 0 : _c.OCClient.makeSecondaryChannelEventRequest((_d = this.callingParams) === null || _d === void 0 ? void 0 : _d.chatToken.requestId, body);
|
201
|
+
(_e = this.scenarioMarker) === null || _e === void 0 ? void 0 : _e.completeScenario(params.withVideo ? TelemetryEvent_1.default.AcceptVideoCall : TelemetryEvent_1.default.AcceptVoiceCall, {
|
202
|
+
CallId: callId || ''
|
203
|
+
});
|
204
|
+
/* istanbul ignore next */
|
205
|
+
this.debug && console.debug("[VoiceVideoCallingProxy][acceptCall][makeSecondaryChannelEventRequest]");
|
206
|
+
}
|
207
|
+
catch (e) {
|
208
|
+
exceptionDetails = {
|
209
|
+
response: "OCClientMakeSecondaryChannelEventRequestFailed"
|
210
|
+
};
|
211
|
+
(_f = this.scenarioMarker) === null || _f === void 0 ? void 0 : _f.failScenario(params.withVideo ? TelemetryEvent_1.default.AcceptVideoCall : TelemetryEvent_1.default.AcceptVoiceCall, {
|
212
|
+
CallId: callId || '',
|
213
|
+
ExceptionDetails: JSON.stringify(exceptionDetails)
|
214
|
+
});
|
215
|
+
console.error("[VoiceVideoCallingProxy][acceptCall][makeSecondaryChannelEventRequest] Failure " + e);
|
216
|
+
}
|
217
|
+
return [2 /*return*/];
|
218
|
+
}
|
219
|
+
});
|
220
|
+
});
|
221
|
+
};
|
222
|
+
VoiceVideoCallingProxy.prototype.rejectCall = function () {
|
223
|
+
var _a, _b, _c, _d, _e, _f;
|
224
|
+
return __awaiter(this, void 0, void 0, function () {
|
225
|
+
var _g, callClientName, callId, _h, exceptionDetails, body, exceptionDetails;
|
226
|
+
return __generator(this, function (_j) {
|
227
|
+
switch (_j.label) {
|
228
|
+
case 0:
|
229
|
+
_g = this, callClientName = _g.callClientName, callId = _g.callId;
|
230
|
+
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.startScenario(TelemetryEvent_1.default.RejectCall, {
|
231
|
+
CallId: callId || ''
|
232
|
+
});
|
233
|
+
/* istanbul ignore next */
|
234
|
+
this.debug && console.debug("[VoiceVideoCallingProxy][rejectCall] callId: " + callId);
|
235
|
+
_j.label = 1;
|
236
|
+
case 1:
|
237
|
+
_j.trys.push([1, 3, , 4]);
|
238
|
+
return [4 /*yield*/, this.proxyInstance.rejectCall({ callClientName: callClientName, callId: callId })];
|
239
|
+
case 2:
|
240
|
+
_j.sent();
|
241
|
+
(_b = this.scenarioMarker) === null || _b === void 0 ? void 0 : _b.completeScenario(TelemetryEvent_1.default.RejectCall, {
|
242
|
+
CallId: callId || ''
|
243
|
+
});
|
244
|
+
return [3 /*break*/, 4];
|
245
|
+
case 3:
|
246
|
+
_h = _j.sent();
|
247
|
+
exceptionDetails = {
|
248
|
+
response: "RejectCallFailed"
|
249
|
+
};
|
250
|
+
(_c = this.scenarioMarker) === null || _c === void 0 ? void 0 : _c.failScenario(TelemetryEvent_1.default.RejectCall, {
|
251
|
+
CallId: callId || '',
|
252
|
+
ExceptionDetails: JSON.stringify(exceptionDetails)
|
253
|
+
});
|
254
|
+
return [3 /*break*/, 4];
|
255
|
+
case 4:
|
256
|
+
body = {
|
257
|
+
SecondaryChannelType: this.isRemoteVideoEnabled() ? SecondaryChannelType.Video : SecondaryChannelType.Voice,
|
258
|
+
SecondaryChannelEventType: SecondaryChannelEvents.Reject
|
259
|
+
};
|
260
|
+
try {
|
261
|
+
(_d = this.callingParams) === null || _d === void 0 ? void 0 : _d.OCClient.makeSecondaryChannelEventRequest((_e = this.callingParams) === null || _e === void 0 ? void 0 : _e.chatToken.requestId, body);
|
262
|
+
/* istanbul ignore next */
|
263
|
+
this.debug && console.debug("[VoiceVideoCallingProxy][rejectCall][makeSecondaryChannelEventRequest]");
|
264
|
+
}
|
265
|
+
catch (e) {
|
266
|
+
exceptionDetails = {
|
267
|
+
response: "OCClientMakeSecondaryChannelEventRequestFailed"
|
268
|
+
};
|
269
|
+
(_f = this.scenarioMarker) === null || _f === void 0 ? void 0 : _f.failScenario(TelemetryEvent_1.default.RejectCall, {
|
270
|
+
CallId: callId || '',
|
271
|
+
ExceptionDetails: JSON.stringify(exceptionDetails)
|
272
|
+
});
|
273
|
+
console.error("[VoiceVideoCallingProxy][rejectCall][makeSecondaryChannelEventRequest] Failure " + e);
|
274
|
+
}
|
275
|
+
return [2 /*return*/];
|
276
|
+
}
|
277
|
+
});
|
278
|
+
});
|
279
|
+
};
|
280
|
+
VoiceVideoCallingProxy.prototype.stopCall = function () {
|
281
|
+
var _a, _b, _c, _d, _e;
|
282
|
+
return __awaiter(this, void 0, void 0, function () {
|
283
|
+
var _f, callClientName, callId, forEveryone, _g;
|
284
|
+
return __generator(this, function (_h) {
|
285
|
+
switch (_h.label) {
|
286
|
+
case 0:
|
287
|
+
_f = this, callClientName = _f.callClientName, callId = _f.callId;
|
288
|
+
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.startScenario(TelemetryEvent_1.default.StopCall, {
|
289
|
+
CallId: callId || ''
|
290
|
+
});
|
291
|
+
/* istanbul ignore next */
|
292
|
+
this.debug && console.debug("[VoiceVideoCallingProxy][stopCall] callId: " + callId);
|
293
|
+
forEveryone = ((_c = (_b = this.callingParams) === null || _b === void 0 ? void 0 : _b.chatToken.voiceVideoCallToken) === null || _c === void 0 ? void 0 : _c.Token) ? true : false;
|
294
|
+
_h.label = 1;
|
295
|
+
case 1:
|
296
|
+
_h.trys.push([1, 3, , 4]);
|
297
|
+
return [4 /*yield*/, this.proxyInstance.stopCall({ callClientName: callClientName, callId: callId, forEveryone: forEveryone })];
|
298
|
+
case 2:
|
299
|
+
_h.sent();
|
300
|
+
(_d = this.scenarioMarker) === null || _d === void 0 ? void 0 : _d.completeScenario(TelemetryEvent_1.default.StopCall, {
|
301
|
+
CallId: callId || ''
|
302
|
+
});
|
303
|
+
return [3 /*break*/, 4];
|
304
|
+
case 3:
|
305
|
+
_g = _h.sent();
|
306
|
+
(_e = this.scenarioMarker) === null || _e === void 0 ? void 0 : _e.failScenario(TelemetryEvent_1.default.StopCall, {
|
307
|
+
CallId: callId || '',
|
308
|
+
});
|
309
|
+
return [3 /*break*/, 4];
|
310
|
+
case 4: return [2 /*return*/];
|
311
|
+
}
|
312
|
+
});
|
313
|
+
});
|
314
|
+
};
|
315
|
+
VoiceVideoCallingProxy.prototype.toggleMute = function () {
|
316
|
+
return __awaiter(this, void 0, void 0, function () {
|
317
|
+
var _a, callClientName, callId;
|
318
|
+
return __generator(this, function (_b) {
|
319
|
+
_a = this, callClientName = _a.callClientName, callId = _a.callId;
|
320
|
+
return [2 /*return*/, this.proxyInstance.toggleMute({ callClientName: callClientName, callId: callId })];
|
321
|
+
});
|
322
|
+
});
|
323
|
+
};
|
324
|
+
VoiceVideoCallingProxy.prototype.isRemoteVideoEnabled = function () {
|
325
|
+
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
|
326
|
+
return this.proxyInstance.isRemoteVideoEnabled({ callClientName: callClientName, callId: callId });
|
327
|
+
};
|
328
|
+
VoiceVideoCallingProxy.prototype.isLocalVideoEnabled = function () {
|
329
|
+
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
|
330
|
+
return this.proxyInstance.isLocalVideoEnabled({ callClientName: callClientName, callId: callId });
|
331
|
+
};
|
332
|
+
VoiceVideoCallingProxy.prototype.toggleLocalVideo = function () {
|
333
|
+
return __awaiter(this, void 0, void 0, function () {
|
334
|
+
var _a, callClientName, callId;
|
335
|
+
return __generator(this, function (_b) {
|
336
|
+
_a = this, callClientName = _a.callClientName, callId = _a.callId;
|
337
|
+
return [2 /*return*/, this.proxyInstance.toggleLocalVideo({ callClientName: callClientName, callId: callId })];
|
338
|
+
});
|
339
|
+
});
|
340
|
+
};
|
341
|
+
VoiceVideoCallingProxy.prototype.isInACall = function () {
|
342
|
+
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
|
343
|
+
return this.proxyInstance.isInACall({ callClientName: callClientName, callId: callId });
|
344
|
+
};
|
345
|
+
VoiceVideoCallingProxy.prototype.renderVideoStreams = function () {
|
346
|
+
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
|
347
|
+
return this.proxyInstance.renderVideoStreams({ callClientName: callClientName, callId: callId });
|
348
|
+
};
|
349
|
+
VoiceVideoCallingProxy.prototype.disposeVideoRenderers = function () {
|
350
|
+
var _a = this, callClientName = _a.callClientName, callId = _a.callId;
|
351
|
+
return this.proxyInstance.disposeVideoRenderers({ callClientName: callClientName, callId: callId });
|
352
|
+
};
|
353
|
+
VoiceVideoCallingProxy.prototype.close = function () {
|
354
|
+
/* istanbul ignore next */
|
355
|
+
this.debug && console.debug("[VoiceVideoCallingProxy][close]");
|
356
|
+
this.proxyInstance.dispose();
|
357
|
+
this.callingParams = undefined;
|
358
|
+
this.callId = undefined;
|
359
|
+
};
|
360
|
+
VoiceVideoCallingProxy.prototype.onCallAdded = function (callback) {
|
361
|
+
var eventName = CallingEvents.CallAdded;
|
362
|
+
/* istanbul ignore next */
|
363
|
+
this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");
|
364
|
+
this.addEventListener(eventName, callback);
|
365
|
+
};
|
366
|
+
VoiceVideoCallingProxy.prototype.onLocalVideoStreamAdded = function (callback) {
|
367
|
+
var eventName = CallingEvents.LocalVideoStreamAdded;
|
368
|
+
/* istanbul ignore next */
|
369
|
+
this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");
|
370
|
+
this.addEventListener(eventName, callback);
|
371
|
+
};
|
372
|
+
VoiceVideoCallingProxy.prototype.onLocalVideoStreamRemoved = function (callback) {
|
373
|
+
var eventName = CallingEvents.LocalVideoStreamRemoved;
|
374
|
+
/* istanbul ignore next */
|
375
|
+
this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");
|
376
|
+
this.addEventListener(eventName, callback);
|
377
|
+
};
|
378
|
+
VoiceVideoCallingProxy.prototype.onRemoteVideoStreamAdded = function (callback) {
|
379
|
+
var eventName = CallingEvents.RemoteVideoStreamAdded;
|
380
|
+
/* istanbul ignore next */
|
381
|
+
this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");
|
382
|
+
this.addEventListener(eventName, callback);
|
383
|
+
};
|
384
|
+
VoiceVideoCallingProxy.prototype.onRemoteVideoStreamRemoved = function (callback) {
|
385
|
+
var eventName = CallingEvents.RemoteVideoStreamRemoved;
|
386
|
+
/* istanbul ignore next */
|
387
|
+
this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");
|
388
|
+
this.addEventListener(eventName, callback);
|
389
|
+
};
|
390
|
+
VoiceVideoCallingProxy.prototype.onCallDisconnected = function (callback) {
|
391
|
+
var _this = this;
|
392
|
+
var eventName = CallingEvents.CallDisconnected;
|
393
|
+
/* istanbul ignore next */
|
394
|
+
this.debug && console.debug("[VoiceVideoCallingProxy][" + eventName + "]");
|
395
|
+
this.addEventListener(eventName, function (params) { return __awaiter(_this, void 0, void 0, function () {
|
396
|
+
var body, exceptionDetails;
|
397
|
+
var _a, _b, _c, _d, _e;
|
398
|
+
return __generator(this, function (_f) {
|
399
|
+
body = {
|
400
|
+
SecondaryChannelType: SecondaryChannelType.Voice,
|
401
|
+
SecondaryChannelEventType: SecondaryChannelEvents.End
|
402
|
+
};
|
403
|
+
(_a = this.scenarioMarker) === null || _a === void 0 ? void 0 : _a.startScenario(TelemetryEvent_1.default.OnCallDisconnected, {
|
404
|
+
CallId: this.callId || ''
|
405
|
+
});
|
406
|
+
try {
|
407
|
+
(_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);
|
408
|
+
this.debug && console.debug("[VoiceVideoCallingProxy][onCallDisconnected][makeSecondaryChannelEventRequest]");
|
409
|
+
(_d = this.scenarioMarker) === null || _d === void 0 ? void 0 : _d.completeScenario(TelemetryEvent_1.default.OnCallDisconnected, {
|
410
|
+
CallId: this.callId || ''
|
411
|
+
});
|
412
|
+
}
|
413
|
+
catch (e) {
|
414
|
+
console.error("[VoiceVideoCallingProxy][onCallDisconnected][makeSecondaryChannelEventRequest] Failure " + e);
|
415
|
+
exceptionDetails = {
|
416
|
+
response: 'OCClientMakeSecondaryChannelEventRequestFailed'
|
417
|
+
};
|
418
|
+
(_e = this.scenarioMarker) === null || _e === void 0 ? void 0 : _e.failScenario(TelemetryEvent_1.default.OnCallDisconnected, {
|
419
|
+
CallId: this.callId || '',
|
420
|
+
ExceptionDetails: JSON.stringify(exceptionDetails)
|
421
|
+
});
|
422
|
+
}
|
423
|
+
this.clearRemoteVideoElementChildren();
|
424
|
+
callback(params);
|
425
|
+
return [2 /*return*/];
|
426
|
+
});
|
427
|
+
}); });
|
428
|
+
};
|
429
|
+
VoiceVideoCallingProxy.prototype.clearRemoteVideoElementChildren = function () {
|
430
|
+
var _a, _b;
|
431
|
+
// Remove remoteVideoHTMLElement children if any or video won't be rendered properly
|
432
|
+
if ((_a = this.callingParams) === null || _a === void 0 ? void 0 : _a.remoteVideoHTMLElementId) {
|
433
|
+
var remoteVideoElement = document.getElementById((_b = this.callingParams) === null || _b === void 0 ? void 0 : _b.remoteVideoHTMLElementId);
|
434
|
+
while (remoteVideoElement === null || remoteVideoElement === void 0 ? void 0 : remoteVideoElement.firstChild) {
|
435
|
+
/* istanbul ignore next */
|
436
|
+
this.debug && console.debug('[VoiceVideoCallingProxy][clearRemoteVideoElement]');
|
437
|
+
remoteVideoElement.firstChild.remove();
|
438
|
+
}
|
439
|
+
}
|
440
|
+
};
|
441
|
+
return VoiceVideoCallingProxy;
|
442
|
+
}());
|
443
|
+
exports.VoiceVideoCallingProxy = VoiceVideoCallingProxy;
|
444
|
+
var createVoiceVideoCalling = function (params) {
|
445
|
+
if (params === void 0) { params = {}; }
|
446
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
447
|
+
var proxy;
|
448
|
+
return __generator(this, function (_a) {
|
449
|
+
switch (_a.label) {
|
450
|
+
case 0:
|
451
|
+
proxy = VoiceVideoCallingProxy.getInstance();
|
452
|
+
return [4 /*yield*/, proxy.load({
|
453
|
+
logger: params.logger || undefined
|
454
|
+
})];
|
455
|
+
case 1:
|
456
|
+
_a.sent();
|
457
|
+
return [2 /*return*/, Promise.resolve(proxy)];
|
458
|
+
}
|
459
|
+
});
|
460
|
+
});
|
461
|
+
};
|
462
|
+
exports.default = createVoiceVideoCalling;
|
463
463
|
//# sourceMappingURL=createVoiceVideoCalling.js.map
|