webitel-sdk 0.1.147 → 0.1.150

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.
Files changed (40) hide show
  1. package/bundles/index.esm.js +40 -18
  2. package/bundles/index.esm.js.map +1 -1
  3. package/bundles/index.esm.min.js +1 -1
  4. package/bundles/index.esm.min.js.map +1 -1
  5. package/bundles/index.umd.js +52 -23
  6. package/bundles/index.umd.js.map +1 -1
  7. package/bundles/index.umd.min.js +1 -1
  8. package/bundles/index.umd.min.js.map +1 -1
  9. package/esm2015/api/call-service-api.js +14 -7
  10. package/esm2015/api/call-service-api.js.map +1 -1
  11. package/esm2015/socket/agent.js +4 -2
  12. package/esm2015/socket/agent.js.map +1 -1
  13. package/esm2015/socket/call.js +5 -0
  14. package/esm2015/socket/call.js.map +1 -1
  15. package/esm2015/socket/client.js +7 -7
  16. package/esm2015/socket/client.js.map +1 -1
  17. package/esm2015/socket/conversation.js +10 -2
  18. package/esm2015/socket/conversation.js.map +1 -1
  19. package/esm5/api/call-service-api.js +14 -7
  20. package/esm5/api/call-service-api.js.map +1 -1
  21. package/esm5/socket/agent.js +16 -7
  22. package/esm5/socket/agent.js.map +1 -1
  23. package/esm5/socket/call.js +5 -0
  24. package/esm5/socket/call.js.map +1 -1
  25. package/esm5/socket/client.js +7 -7
  26. package/esm5/socket/client.js.map +1 -1
  27. package/esm5/socket/conversation.js +10 -2
  28. package/esm5/socket/conversation.js.map +1 -1
  29. package/package.json +1 -1
  30. package/types/api/call-service-api.d.ts +8 -4
  31. package/types/api/call-service-api.d.ts.map +1 -1
  32. package/types/api/storage-create-import-template-request.d.ts +7 -0
  33. package/types/api/storage-create-import-template-request.d.ts.map +1 -1
  34. package/types/socket/agent.d.ts +6 -1
  35. package/types/socket/agent.d.ts.map +1 -1
  36. package/types/socket/call.d.ts +6 -1
  37. package/types/socket/call.d.ts.map +1 -1
  38. package/types/socket/client.d.ts.map +1 -1
  39. package/types/socket/conversation.d.ts +3 -0
  40. package/types/socket/conversation.d.ts.map +1 -1
@@ -7131,10 +7131,11 @@ const CallServiceApiAxiosParamCreator = function (configuration) {
7131
7131
  * @param {Array<string>} [directions]
7132
7132
  * @param {'undefined' | 'true' | 'false'} [hasTranscript]
7133
7133
  * @param {string} [agentDescription]
7134
+ * @param {Array<string>} [ownerId]
7134
7135
  * @param {*} [options] Override http request option.
7135
7136
  * @throws {RequiredError}
7136
7137
  */
7137
- searchHistoryCall: async (page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, fts, directions, hasTranscript, agentDescription, options = {}) => {
7138
+ searchHistoryCall: async (page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, fts, directions, hasTranscript, agentDescription, ownerId, options = {}) => {
7138
7139
  const localVarPath = `/calls/history`;
7139
7140
  const localVarUrlObj = parse(localVarPath, true);
7140
7141
  let baseOptions;
@@ -7266,6 +7267,9 @@ const CallServiceApiAxiosParamCreator = function (configuration) {
7266
7267
  if (agentDescription !== undefined) {
7267
7268
  localVarQueryParameter['agent_description'] = agentDescription;
7268
7269
  }
7270
+ if (ownerId) {
7271
+ localVarQueryParameter['owner_id'] = ownerId;
7272
+ }
7269
7273
  localVarUrlObj.query = {
7270
7274
  ...localVarUrlObj.query,
7271
7275
  ...localVarQueryParameter,
@@ -7689,11 +7693,12 @@ const CallServiceApiFp = function (configuration) {
7689
7693
  * @param {Array<string>} [directions]
7690
7694
  * @param {'undefined' | 'true' | 'false'} [hasTranscript]
7691
7695
  * @param {string} [agentDescription]
7696
+ * @param {Array<string>} [ownerId]
7692
7697
  * @param {*} [options] Override http request option.
7693
7698
  * @throws {RequiredError}
7694
7699
  */
7695
- async searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, fts, directions, hasTranscript, agentDescription, options) {
7696
- const localVarAxiosArgs = await CallServiceApiAxiosParamCreator(configuration).searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, fts, directions, hasTranscript, agentDescription, options);
7700
+ async searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, fts, directions, hasTranscript, agentDescription, ownerId, options) {
7701
+ const localVarAxiosArgs = await CallServiceApiAxiosParamCreator(configuration).searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, fts, directions, hasTranscript, agentDescription, ownerId, options);
7697
7702
  return (axios = globalAxios, basePath = BASE_PATH) => {
7698
7703
  const axiosRequestArgs = {
7699
7704
  ...localVarAxiosArgs.options,
@@ -7955,12 +7960,13 @@ const CallServiceApiFactory = function (configuration, basePath, axios) {
7955
7960
  * @param {Array<string>} [directions]
7956
7961
  * @param {'undefined' | 'true' | 'false'} [hasTranscript]
7957
7962
  * @param {string} [agentDescription]
7963
+ * @param {Array<string>} [ownerId]
7958
7964
  * @param {*} [options] Override http request option.
7959
7965
  * @throws {RequiredError}
7960
7966
  */
7961
- searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, fts, directions, hasTranscript, agentDescription, options) {
7967
+ searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, fts, directions, hasTranscript, agentDescription, ownerId, options) {
7962
7968
  return CallServiceApiFp(configuration)
7963
- .searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, fts, directions, hasTranscript, agentDescription, options)
7969
+ .searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, fts, directions, hasTranscript, agentDescription, ownerId, options)
7964
7970
  .then((request) => request(axios, basePath));
7965
7971
  },
7966
7972
  /**
@@ -8219,13 +8225,14 @@ class CallServiceApi extends BaseAPI {
8219
8225
  * @param {Array<string>} [directions]
8220
8226
  * @param {'undefined' | 'true' | 'false'} [hasTranscript]
8221
8227
  * @param {string} [agentDescription]
8228
+ * @param {Array<string>} [ownerId]
8222
8229
  * @param {*} [options] Override http request option.
8223
8230
  * @throws {RequiredError}
8224
8231
  * @memberof CallServiceApi
8225
8232
  */
8226
- searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, fts, directions, hasTranscript, agentDescription, options) {
8233
+ searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, fts, directions, hasTranscript, agentDescription, ownerId, options) {
8227
8234
  return CallServiceApiFp(this.configuration)
8228
- .searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, fts, directions, hasTranscript, agentDescription, options)
8235
+ .searchHistoryCall(page, size, q, sort, fields, createdAtFrom, createdAtTo, userId, agentId, queueId, teamId, memberId, gatewayId, durationFrom, durationTo, skipParent, parentId, cause, hasFile, domainId, number, direction, answeredAtFrom, answeredAtTo, missed, storedAtFrom, storedAtTo, id, transferFrom, transferTo, dependencyId, tags, amdResult, fts, directions, hasTranscript, agentDescription, ownerId, options)
8229
8236
  .then((request) => request(this.axios, this.basePath));
8230
8237
  }
8231
8238
  /**
@@ -25556,7 +25563,7 @@ async function getMediaStream(constraints) {
25556
25563
 
25557
25564
  const getVersion = () => {
25558
25565
  // @ts-ignore
25559
- return '"0.1.147"';
25566
+ return '"0.1.150"';
25560
25567
  };
25561
25568
  var version = getVersion();
25562
25569
 
@@ -25809,6 +25816,7 @@ class Agent {
25809
25816
  this.info = info;
25810
25817
  this.task = new Map();
25811
25818
  this._channel = info.channels[0]; // todo
25819
+ this._listOfflineMembers = null;
25812
25820
  this.lastStatusChange = Date.now() - this.info.status_duration * 1000;
25813
25821
  }
25814
25822
  get agentId() {
@@ -26013,12 +26021,13 @@ class Agent {
26013
26021
  });
26014
26022
  }
26015
26023
  async offlineMembers(q, page, perPage) {
26016
- return this.client.request(`cc_fetch_offline_members`, {
26024
+ this._listOfflineMembers = (await this.client.request(`cc_fetch_offline_members`, {
26017
26025
  agent_id: this.agentId,
26018
26026
  page,
26019
26027
  q,
26020
26028
  per_page: perPage,
26021
- });
26029
+ }));
26030
+ return this._listOfflineMembers;
26022
26031
  }
26023
26032
  hasTask(task) {
26024
26033
  return this.task.has(task.id);
@@ -26042,6 +26051,11 @@ var CallReportingStatus;
26042
26051
  CallReportingStatus["Abandoned"] = "abandoned";
26043
26052
  CallReportingStatus["Cancel"] = "cancel";
26044
26053
  CallReportingStatus["Success"] = "success";
26054
+ CallReportingStatus["Failed"] = "failed";
26055
+ CallReportingStatus["Missed"] = "missed";
26056
+ CallReportingStatus["Timeout"] = "timeout";
26057
+ CallReportingStatus["Endless"] = "endless";
26058
+ CallReportingStatus["Transferred"] = "transferred";
26045
26059
  })(CallReportingStatus || (CallReportingStatus = {}));
26046
26060
  var CallActions;
26047
26061
  (function (CallActions) {
@@ -26496,6 +26510,7 @@ class Conversation {
26496
26510
  this.closedAt = 0;
26497
26511
  this.task = null;
26498
26512
  this.data = null;
26513
+ this.queue = null;
26499
26514
  this.members = (members || []).map((i) => wrapChannelMember(i));
26500
26515
  this._messages = messages || [];
26501
26516
  this.state = ConversationState.Invite;
@@ -26503,6 +26518,7 @@ class Conversation {
26503
26518
  this._hasReporting = !!(variables && variables.cc_reporting === 'true');
26504
26519
  this._autoAnswer = false;
26505
26520
  this._cause = null;
26521
+ this.lastAction = null;
26506
26522
  for (const k in variables) {
26507
26523
  if (!k.startsWith('cc_') && variables.hasOwnProperty(k)) {
26508
26524
  if (k === 'wbt_auto_answer') {
@@ -26516,6 +26532,10 @@ class Conversation {
26516
26532
  if (variables &&
26517
26533
  variables.hasOwnProperty('cc_attempt_id') &&
26518
26534
  this.client.agent) {
26535
+ this.queue = {
26536
+ id: +variables.cc_queue_id || null,
26537
+ name: variables.cc_queue_name || '',
26538
+ };
26519
26539
  this.task = this.client.agent.task.get(+variables.cc_attempt_id) || null;
26520
26540
  }
26521
26541
  }
@@ -26540,10 +26560,12 @@ class Conversation {
26540
26560
  this.closedAt = timestamp;
26541
26561
  }
26542
26562
  setDecline(e) {
26543
- this.state = ConversationState.Closed;
26544
- this.closedAt = e.timestamp;
26563
+ this.setClosed(e.timestamp);
26545
26564
  this._cause = e.cause || null;
26546
26565
  }
26566
+ setLeave(e) {
26567
+ this.setClosed(e.timestamp);
26568
+ }
26547
26569
  get id() {
26548
26570
  return this.channelId || this.inviteId || this.conversationId;
26549
26571
  }
@@ -27187,11 +27209,10 @@ class Client extends EventEmitter {
27187
27209
  return call.hangupAt > 0 && !this.hasAgentTask(call.task);
27188
27210
  }
27189
27211
  conversationDestroyed(conv) {
27190
- const res = conv.closedAt > 0 &&
27191
- (!this.hasAgentTask(conv.task) &&
27192
- (conv.hasReporting ||
27193
- [DeclineCause.Busy, DeclineCause.Timeout].indexOf(conv.cause) > -1));
27194
- return res;
27212
+ return (conv.closedAt > 0 &&
27213
+ !this.hasAgentTask(conv.task) &&
27214
+ (conv.hasReporting ||
27215
+ !(conv.lastAction === ChatActions.Close && conv.answeredAt > 0)));
27195
27216
  }
27196
27217
  reportingChannelTask(task) {
27197
27218
  switch (task.channel) {
@@ -27552,7 +27573,7 @@ class Client extends EventEmitter {
27552
27573
  const l = event.data;
27553
27574
  conversation = this.conversationById(l.leaved_channel_id);
27554
27575
  if (conversation) {
27555
- conversation.setClosed(timestamp);
27576
+ conversation.setLeave(l);
27556
27577
  }
27557
27578
  break;
27558
27579
  case ChatActions.Decline:
@@ -27565,6 +27586,7 @@ class Client extends EventEmitter {
27565
27586
  default:
27566
27587
  }
27567
27588
  if (conversation) {
27589
+ conversation.lastAction = event.action;
27568
27590
  this.eventHandler.emit(WEBSOCKET_EVENT_CHAT, event.action, conversation);
27569
27591
  if (this.conversationDestroyed(conversation)) {
27570
27592
  this.destroyConversation(conversation);