@azure/communication-react
Version:
React library for building modern communication user experiences utilizing Azure Communication Services
52 lines • 2.27 kB
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
/**
* @private
*/
export class ProxyTeamsIncomingCall {
constructor(context) {
this._context = context;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
get(target, prop) {
switch (prop) {
case 'accept':
{
return this._context.withAsyncErrorTeedToState(function (...args) {
return __awaiter(this, void 0, void 0, function* () {
return yield target.accept(...args);
});
}, 'IncomingCall.accept');
}
case 'reject':
{
return this._context.withAsyncErrorTeedToState(function (...args) {
return __awaiter(this, void 0, void 0, function* () {
return yield target.reject(...args);
});
}, 'IncomingCall.reject');
}
default:
return Reflect.get(target, prop);
}
}
}
/**
* Creates a declarative TeamsIncomingCall by proxying TeamsIncomingCall using ProxyIncomingCall.
* @param incomingCall - TeamsIncomingCall from SDK
* @returns proxied TeamsIncomingCall
*/
export const teamsIncomingCallDeclaratify = (incomingCall, context) => {
const proxyIncomingCall = new ProxyTeamsIncomingCall(context);
return new Proxy(incomingCall, proxyIncomingCall);
};
//# sourceMappingURL=TeamsIncomingCallDeclarative.js.map