webitel-sdk 0.1.98 → 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 +31 -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 +45 -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/enums/messenger-type.enum.js +1 -1
- package/esm2015/enums/messenger-type.enum.js.map +1 -1
- package/esm2015/socket/client.js +13 -1
- package/esm2015/socket/client.js.map +1 -1
- package/esm2015/socket/conversation.js +13 -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/enums/messenger-type.enum.js +1 -1
- package/esm5/enums/messenger-type.enum.js.map +1 -1
- package/esm5/socket/client.js +24 -8
- package/esm5/socket/client.js.map +1 -1
- package/esm5/socket/conversation.js +14 -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/enums/messenger-type.enum.d.ts +1 -1
- package/types/enums/messenger-type.enum.d.ts.map +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 +2 -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;
|
|
@@ -24034,6 +24045,7 @@ class Conversation {
|
|
|
24034
24045
|
};
|
|
24035
24046
|
if (i.hasOwnProperty('file')) {
|
|
24036
24047
|
i.file.url = this.client.fileUrlDownload(i.file.id);
|
|
24048
|
+
i.file.streamUrl = this.client.fileUrlStream(i.file.id);
|
|
24037
24049
|
msg.file = i.file;
|
|
24038
24050
|
}
|
|
24039
24051
|
if (i.hasOwnProperty('text')) {
|
|
@@ -24222,6 +24234,12 @@ function wrapChannelMember(m) {
|
|
|
24222
24234
|
return m;
|
|
24223
24235
|
}
|
|
24224
24236
|
|
|
24237
|
+
class DeviceNotFoundError extends Error {
|
|
24238
|
+
constructor(msg) {
|
|
24239
|
+
super(msg);
|
|
24240
|
+
}
|
|
24241
|
+
}
|
|
24242
|
+
|
|
24225
24243
|
const SOCKET_URL_SUFFIX = 'websocket';
|
|
24226
24244
|
const spamData = `\u0000\u0000\u0000\u0000`;
|
|
24227
24245
|
class Socket extends EventEmitter {
|
|
@@ -24531,7 +24549,18 @@ class Client extends EventEmitter {
|
|
|
24531
24549
|
}
|
|
24532
24550
|
async call(req) {
|
|
24533
24551
|
if (this.phone) {
|
|
24534
|
-
|
|
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
|
+
}
|
|
24535
24564
|
}
|
|
24536
24565
|
else {
|
|
24537
24566
|
await this.invite(req);
|