webitel-sdk 0.1.100 → 0.1.102
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/bundles/index.esm.js +30 -2
- package/bundles/index.esm.js.map +1 -1
- package/bundles/index.esm.min.js +1 -1
- package/bundles/index.esm.min.js.map +1 -1
- package/bundles/index.umd.js +44 -9
- package/bundles/index.umd.js.map +1 -1
- package/bundles/index.umd.min.js +1 -1
- package/bundles/index.umd.min.js.map +1 -1
- package/esm2015/socket/client.js +13 -1
- package/esm2015/socket/client.js.map +1 -1
- package/esm2015/socket/conversation.js +12 -1
- package/esm2015/socket/conversation.js.map +1 -1
- package/esm2015/socket/errors.js +6 -0
- package/esm2015/socket/errors.js.map +1 -0
- package/esm5/socket/client.js +24 -8
- package/esm5/socket/client.js.map +1 -1
- package/esm5/socket/conversation.js +13 -1
- package/esm5/socket/conversation.js.map +1 -1
- package/esm5/socket/errors.js +10 -0
- package/esm5/socket/errors.js.map +1 -0
- package/package.json +1 -1
- package/types/socket/client.d.ts +1 -0
- package/types/socket/client.d.ts.map +1 -1
- package/types/socket/conversation.d.ts +1 -0
- package/types/socket/conversation.d.ts.map +1 -1
- package/types/socket/errors.d.ts +4 -0
- package/types/socket/errors.d.ts.map +1 -0
package/bundles/index.esm.js
CHANGED
|
@@ -23989,9 +23989,15 @@ class Conversation {
|
|
|
23989
23989
|
this.state = ConversationState.Invite;
|
|
23990
23990
|
this.variables = {};
|
|
23991
23991
|
this._hasReporting = !!(variables && variables.cc_reporting === 'true');
|
|
23992
|
+
this._autoAnswer = false;
|
|
23992
23993
|
for (const k in variables) {
|
|
23993
23994
|
if (!k.startsWith('cc_') && variables.hasOwnProperty(k)) {
|
|
23994
|
-
|
|
23995
|
+
if (k === 'wbt_auto_answer') {
|
|
23996
|
+
this._autoAnswer = variables.wbt_auto_answer === 'true';
|
|
23997
|
+
}
|
|
23998
|
+
else {
|
|
23999
|
+
this.variables[k] = variables[k];
|
|
24000
|
+
}
|
|
23995
24001
|
}
|
|
23996
24002
|
}
|
|
23997
24003
|
if (variables &&
|
|
@@ -24003,6 +24009,11 @@ class Conversation {
|
|
|
24003
24009
|
setInvite(inviteId, timestamp) {
|
|
24004
24010
|
this.inviteId = inviteId;
|
|
24005
24011
|
this.invitedAt = timestamp;
|
|
24012
|
+
if (this._autoAnswer) {
|
|
24013
|
+
this.join().catch((e) => {
|
|
24014
|
+
this.client.emit('error', e);
|
|
24015
|
+
});
|
|
24016
|
+
}
|
|
24006
24017
|
}
|
|
24007
24018
|
setAnswered(channelId, timestamp, member) {
|
|
24008
24019
|
this.state = ConversationState.Active;
|
|
@@ -24223,6 +24234,12 @@ function wrapChannelMember(m) {
|
|
|
24223
24234
|
return m;
|
|
24224
24235
|
}
|
|
24225
24236
|
|
|
24237
|
+
class DeviceNotFoundError extends Error {
|
|
24238
|
+
constructor(msg) {
|
|
24239
|
+
super(msg);
|
|
24240
|
+
}
|
|
24241
|
+
}
|
|
24242
|
+
|
|
24226
24243
|
const SOCKET_URL_SUFFIX = 'websocket';
|
|
24227
24244
|
const spamData = `\u0000\u0000\u0000\u0000`;
|
|
24228
24245
|
class Socket extends EventEmitter {
|
|
@@ -24532,7 +24549,18 @@ class Client extends EventEmitter {
|
|
|
24532
24549
|
}
|
|
24533
24550
|
async call(req) {
|
|
24534
24551
|
if (this.phone) {
|
|
24535
|
-
|
|
24552
|
+
try {
|
|
24553
|
+
await this.phone.call(req);
|
|
24554
|
+
}
|
|
24555
|
+
catch (e) {
|
|
24556
|
+
switch (e.name) {
|
|
24557
|
+
case 'NotFoundError':
|
|
24558
|
+
this.emit('error', new DeviceNotFoundError(e));
|
|
24559
|
+
break;
|
|
24560
|
+
default:
|
|
24561
|
+
this.emit('error', e);
|
|
24562
|
+
}
|
|
24563
|
+
}
|
|
24536
24564
|
}
|
|
24537
24565
|
else {
|
|
24538
24566
|
await this.invite(req);
|