webitel-sdk 0.1.81 → 0.1.85

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 (65) hide show
  1. package/bundles/index.esm.js +146 -27
  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 +194 -41
  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 +7 -21
  10. package/esm2015/api/call-service-api.js.map +1 -1
  11. package/esm2015/api/engine-reset-members-request.js +13 -0
  12. package/esm2015/api/engine-reset-members-request.js.map +1 -0
  13. package/esm2015/api/engine-reset-members-response.js +13 -0
  14. package/esm2015/api/engine-reset-members-response.js.map +1 -0
  15. package/esm2015/api/index.js.map +1 -1
  16. package/esm2015/api/member-service-api.js +106 -0
  17. package/esm2015/api/member-service-api.js.map +1 -1
  18. package/esm2015/api-consumers/list-getter/base-list-getter-api-consumer/base-list-getter-api-consumer.js +1 -1
  19. package/esm2015/api-consumers/list-getter/base-list-getter-api-consumer/base-list-getter-api-consumer.js.map +1 -1
  20. package/esm2015/socket/call.js +10 -0
  21. package/esm2015/socket/call.js.map +1 -1
  22. package/esm2015/socket/client.js +23 -6
  23. package/esm2015/socket/client.js.map +1 -1
  24. package/esm5/api/call-service-api.js +8 -22
  25. package/esm5/api/call-service-api.js.map +1 -1
  26. package/esm5/api/engine-reset-members-request.js +13 -0
  27. package/esm5/api/engine-reset-members-request.js.map +1 -0
  28. package/esm5/api/engine-reset-members-response.js +13 -0
  29. package/esm5/api/engine-reset-members-response.js.map +1 -0
  30. package/esm5/api/index.js.map +1 -1
  31. package/esm5/api/member-service-api.js +119 -0
  32. package/esm5/api/member-service-api.js.map +1 -1
  33. package/esm5/api-consumers/list-getter/base-list-getter-api-consumer/base-list-getter-api-consumer.js +1 -1
  34. package/esm5/api-consumers/list-getter/base-list-getter-api-consumer/base-list-getter-api-consumer.js.map +1 -1
  35. package/esm5/socket/call.js +18 -0
  36. package/esm5/socket/call.js.map +1 -1
  37. package/esm5/socket/client.js +49 -19
  38. package/esm5/socket/client.js.map +1 -1
  39. package/package.json +1 -1
  40. package/types/api/call-service-api.d.ts +4 -9
  41. package/types/api/call-service-api.d.ts.map +1 -1
  42. package/types/api/engine-attempt-history.d.ts +6 -0
  43. package/types/api/engine-attempt-history.d.ts.map +1 -1
  44. package/types/api/engine-history-call.d.ts +6 -0
  45. package/types/api/engine-history-call.d.ts.map +1 -1
  46. package/types/api/engine-reset-members-request.d.ts +63 -0
  47. package/types/api/engine-reset-members-request.d.ts.map +1 -0
  48. package/types/api/engine-reset-members-response.d.ts +25 -0
  49. package/types/api/engine-reset-members-response.d.ts.map +1 -0
  50. package/types/api/index.d.ts +2 -1
  51. package/types/api/index.d.ts.map +1 -1
  52. package/types/api/member-service-api.d.ts +38 -0
  53. package/types/api/member-service-api.d.ts.map +1 -1
  54. package/types/api-consumers/list-getter/base-list-getter-api-consumer/base-list-getter-api-consumer.d.ts +1 -2
  55. package/types/api-consumers/list-getter/base-list-getter-api-consumer/base-list-getter-api-consumer.d.ts.map +1 -1
  56. package/types/socket/call.d.ts +2 -0
  57. package/types/socket/call.d.ts.map +1 -1
  58. package/types/socket/client.d.ts +4 -0
  59. package/types/socket/client.d.ts.map +1 -1
  60. package/esm2015/api-consumers/list-getter/_shared/interfaces/response/lookup-list-getter-response.js +0 -1
  61. package/esm2015/api-consumers/list-getter/_shared/interfaces/response/lookup-list-getter-response.js.map +0 -1
  62. package/esm5/api-consumers/list-getter/_shared/interfaces/response/lookup-list-getter-response.js +0 -1
  63. package/esm5/api-consumers/list-getter/_shared/interfaces/response/lookup-list-getter-response.js.map +0 -1
  64. package/types/api-consumers/list-getter/_shared/interfaces/response/lookup-list-getter-response.d.ts +0 -3
  65. package/types/api-consumers/list-getter/_shared/interfaces/response/lookup-list-getter-response.d.ts.map +0 -1
@@ -6441,11 +6441,10 @@ const CallServiceApiAxiosParamCreator = function (configuration) {
6441
6441
  *
6442
6442
  * @param {string} callId
6443
6443
  * @param {string} id
6444
- * @param {EngineDeleteCallAnnotationRequest} body
6445
6444
  * @param {*} [options] Override http request option.
6446
6445
  * @throws {RequiredError}
6447
6446
  */
6448
- deleteCallAnnotation: async (callId, id, body, options = {}) => {
6447
+ deleteCallAnnotation: async (callId, id, options = {}) => {
6449
6448
  // verify required parameter 'callId' is not null or undefined
6450
6449
  if (callId === null || callId === undefined) {
6451
6450
  throw new RequiredError('callId', 'Required parameter callId was null or undefined when calling deleteCallAnnotation.');
@@ -6454,10 +6453,6 @@ const CallServiceApiAxiosParamCreator = function (configuration) {
6454
6453
  if (id === null || id === undefined) {
6455
6454
  throw new RequiredError('id', 'Required parameter id was null or undefined when calling deleteCallAnnotation.');
6456
6455
  }
6457
- // verify required parameter 'body' is not null or undefined
6458
- if (body === null || body === undefined) {
6459
- throw new RequiredError('body', 'Required parameter body was null or undefined when calling deleteCallAnnotation.');
6460
- }
6461
6456
  const localVarPath = `/calls/history/{call_id}/annotation/{id}`
6462
6457
  .replace(`{${'call_id'}}`, encodeURIComponent(String(callId)))
6463
6458
  .replace(`{${'id'}}`, encodeURIComponent(String(id)));
@@ -6480,7 +6475,6 @@ const CallServiceApiAxiosParamCreator = function (configuration) {
6480
6475
  : await configuration.apiKey;
6481
6476
  localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
6482
6477
  }
6483
- localVarHeaderParameter['Content-Type'] = 'application/json';
6484
6478
  localVarUrlObj.query = {
6485
6479
  ...localVarUrlObj.query,
6486
6480
  ...localVarQueryParameter,
@@ -6494,11 +6488,6 @@ const CallServiceApiAxiosParamCreator = function (configuration) {
6494
6488
  ...headersFromBaseOptions,
6495
6489
  ...options.headers,
6496
6490
  };
6497
- const needsSerialization = typeof body !== 'string' ||
6498
- localVarRequestOptions.headers['Content-Type'] === 'application/json';
6499
- localVarRequestOptions.data = needsSerialization
6500
- ? JSON.stringify(body !== undefined ? body : {})
6501
- : body || '';
6502
6491
  return {
6503
6492
  url: format(localVarUrlObj),
6504
6493
  options: localVarRequestOptions,
@@ -7337,12 +7326,11 @@ const CallServiceApiFp = function (configuration) {
7337
7326
  *
7338
7327
  * @param {string} callId
7339
7328
  * @param {string} id
7340
- * @param {EngineDeleteCallAnnotationRequest} body
7341
7329
  * @param {*} [options] Override http request option.
7342
7330
  * @throws {RequiredError}
7343
7331
  */
7344
- async deleteCallAnnotation(callId, id, body, options) {
7345
- const localVarAxiosArgs = await CallServiceApiAxiosParamCreator(configuration).deleteCallAnnotation(callId, id, body, options);
7332
+ async deleteCallAnnotation(callId, id, options) {
7333
+ const localVarAxiosArgs = await CallServiceApiAxiosParamCreator(configuration).deleteCallAnnotation(callId, id, options);
7346
7334
  return (axios = globalAxios, basePath = BASE_PATH) => {
7347
7335
  const axiosRequestArgs = {
7348
7336
  ...localVarAxiosArgs.options,
@@ -7623,13 +7611,12 @@ const CallServiceApiFactory = function (configuration, basePath, axios) {
7623
7611
  *
7624
7612
  * @param {string} callId
7625
7613
  * @param {string} id
7626
- * @param {EngineDeleteCallAnnotationRequest} body
7627
7614
  * @param {*} [options] Override http request option.
7628
7615
  * @throws {RequiredError}
7629
7616
  */
7630
- deleteCallAnnotation(callId, id, body, options) {
7617
+ deleteCallAnnotation(callId, id, options) {
7631
7618
  return CallServiceApiFp(configuration)
7632
- .deleteCallAnnotation(callId, id, body, options)
7619
+ .deleteCallAnnotation(callId, id, options)
7633
7620
  .then((request) => request(axios, basePath));
7634
7621
  },
7635
7622
  /**
@@ -7864,14 +7851,13 @@ class CallServiceApi extends BaseAPI {
7864
7851
  *
7865
7852
  * @param {string} callId
7866
7853
  * @param {string} id
7867
- * @param {EngineDeleteCallAnnotationRequest} body
7868
7854
  * @param {*} [options] Override http request option.
7869
7855
  * @throws {RequiredError}
7870
7856
  * @memberof CallServiceApi
7871
7857
  */
7872
- deleteCallAnnotation(callId, id, body, options) {
7858
+ deleteCallAnnotation(callId, id, options) {
7873
7859
  return CallServiceApiFp(this.configuration)
7874
- .deleteCallAnnotation(callId, id, body, options)
7860
+ .deleteCallAnnotation(callId, id, options)
7875
7861
  .then((request) => request(this.axios, this.basePath));
7876
7862
  }
7877
7863
  /**
@@ -11312,6 +11298,67 @@ const MemberServiceApiAxiosParamCreator = function (configuration) {
11312
11298
  options: localVarRequestOptions,
11313
11299
  };
11314
11300
  },
11301
+ /**
11302
+ *
11303
+ * @summary ResetMembers
11304
+ * @param {string} queueId
11305
+ * @param {EngineResetMembersRequest} body
11306
+ * @param {*} [options] Override http request option.
11307
+ * @throws {RequiredError}
11308
+ */
11309
+ resetMembers: async (queueId, body, options = {}) => {
11310
+ // verify required parameter 'queueId' is not null or undefined
11311
+ if (queueId === null || queueId === undefined) {
11312
+ throw new RequiredError('queueId', 'Required parameter queueId was null or undefined when calling resetMembers.');
11313
+ }
11314
+ // verify required parameter 'body' is not null or undefined
11315
+ if (body === null || body === undefined) {
11316
+ throw new RequiredError('body', 'Required parameter body was null or undefined when calling resetMembers.');
11317
+ }
11318
+ const localVarPath = `/call_center/queues/{queue_id}/members/reset`.replace(`{${'queue_id'}}`, encodeURIComponent(String(queueId)));
11319
+ const localVarUrlObj = parse(localVarPath, true);
11320
+ let baseOptions;
11321
+ if (configuration) {
11322
+ baseOptions = configuration.baseOptions;
11323
+ }
11324
+ const localVarRequestOptions = {
11325
+ method: 'PATCH',
11326
+ ...baseOptions,
11327
+ ...options,
11328
+ };
11329
+ const localVarHeaderParameter = {};
11330
+ const localVarQueryParameter = {};
11331
+ // authentication AccessToken required
11332
+ if (configuration && configuration.apiKey) {
11333
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
11334
+ ? await configuration.apiKey('X-Webitel-Access')
11335
+ : await configuration.apiKey;
11336
+ localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
11337
+ }
11338
+ localVarHeaderParameter['Content-Type'] = 'application/json';
11339
+ localVarUrlObj.query = {
11340
+ ...localVarUrlObj.query,
11341
+ ...localVarQueryParameter,
11342
+ ...options.query,
11343
+ };
11344
+ // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
11345
+ delete localVarUrlObj.search;
11346
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
11347
+ localVarRequestOptions.headers = {
11348
+ ...localVarHeaderParameter,
11349
+ ...headersFromBaseOptions,
11350
+ ...options.headers,
11351
+ };
11352
+ const needsSerialization = typeof body !== 'string' ||
11353
+ localVarRequestOptions.headers['Content-Type'] === 'application/json';
11354
+ localVarRequestOptions.data = needsSerialization
11355
+ ? JSON.stringify(body !== undefined ? body : {})
11356
+ : body || '';
11357
+ return {
11358
+ url: format(localVarUrlObj),
11359
+ options: localVarRequestOptions,
11360
+ };
11361
+ },
11315
11362
  /**
11316
11363
  *
11317
11364
  * @summary SearchAttempts
@@ -11961,6 +12008,24 @@ const MemberServiceApiFp = function (configuration) {
11961
12008
  return axios.request(axiosRequestArgs);
11962
12009
  };
11963
12010
  },
12011
+ /**
12012
+ *
12013
+ * @summary ResetMembers
12014
+ * @param {string} queueId
12015
+ * @param {EngineResetMembersRequest} body
12016
+ * @param {*} [options] Override http request option.
12017
+ * @throws {RequiredError}
12018
+ */
12019
+ async resetMembers(queueId, body, options) {
12020
+ const localVarAxiosArgs = await MemberServiceApiAxiosParamCreator(configuration).resetMembers(queueId, body, options);
12021
+ return (axios = globalAxios, basePath = BASE_PATH) => {
12022
+ const axiosRequestArgs = {
12023
+ ...localVarAxiosArgs.options,
12024
+ url: basePath + localVarAxiosArgs.url,
12025
+ };
12026
+ return axios.request(axiosRequestArgs);
12027
+ };
12028
+ },
11964
12029
  /**
11965
12030
  *
11966
12031
  * @summary SearchAttempts
@@ -12241,6 +12306,19 @@ const MemberServiceApiFactory = function (configuration, basePath, axios) {
12241
12306
  .readMember(queueId, id, domainId, options)
12242
12307
  .then((request) => request(axios, basePath));
12243
12308
  },
12309
+ /**
12310
+ *
12311
+ * @summary ResetMembers
12312
+ * @param {string} queueId
12313
+ * @param {EngineResetMembersRequest} body
12314
+ * @param {*} [options] Override http request option.
12315
+ * @throws {RequiredError}
12316
+ */
12317
+ resetMembers(queueId, body, options) {
12318
+ return MemberServiceApiFp(configuration)
12319
+ .resetMembers(queueId, body, options)
12320
+ .then((request) => request(axios, basePath));
12321
+ },
12244
12322
  /**
12245
12323
  *
12246
12324
  * @summary SearchAttempts
@@ -12502,6 +12580,20 @@ class MemberServiceApi extends BaseAPI {
12502
12580
  .readMember(queueId, id, domainId, options)
12503
12581
  .then((request) => request(this.axios, this.basePath));
12504
12582
  }
12583
+ /**
12584
+ *
12585
+ * @summary ResetMembers
12586
+ * @param {string} queueId
12587
+ * @param {EngineResetMembersRequest} body
12588
+ * @param {*} [options] Override http request option.
12589
+ * @throws {RequiredError}
12590
+ * @memberof MemberServiceApi
12591
+ */
12592
+ resetMembers(queueId, body, options) {
12593
+ return MemberServiceApiFp(this.configuration)
12594
+ .resetMembers(queueId, body, options)
12595
+ .then((request) => request(this.axios, this.basePath));
12596
+ }
12505
12597
  /**
12506
12598
  *
12507
12599
  * @summary SearchAttempts
@@ -22644,6 +22736,7 @@ class Call {
22644
22736
  this.hangupAt = 0;
22645
22737
  this.bridgedAt = 0;
22646
22738
  this.reportingAt = 0;
22739
+ this.autoAnswered = false;
22647
22740
  this.peerStreams = [];
22648
22741
  this.localStreams = [];
22649
22742
  // fixme
@@ -22883,6 +22976,15 @@ class Call {
22883
22976
  }
22884
22977
  return false;
22885
22978
  }
22979
+ answerDelay(req, delay) {
22980
+ if (this.autoAnswered) {
22981
+ return;
22982
+ }
22983
+ this.autoAnswered = true;
22984
+ setTimeout(async () => {
22985
+ await this.answer(req);
22986
+ }, delay);
22987
+ }
22886
22988
  async hangup(cause) {
22887
22989
  let _cause = cause;
22888
22990
  if (this.answeredAt === 0 && !cause) {
@@ -23285,6 +23387,7 @@ const API_HEADER_TOKEN = 'X-Webitel-Access';
23285
23387
  const WEBSOCKET_AUTHENTICATION_CHALLENGE = 'authentication_challenge';
23286
23388
  const WEBSOCKET_DEFAULT_DEVICE_CONFIG = 'user_default_device';
23287
23389
  const WEBSOCKET_AGENT_SESSION = 'cc_agent_session';
23390
+ const WEBSOCKET_PING = 'ping';
23288
23391
  // const WEBSOCKET_CALL_BY_USER = 'call_by_user'
23289
23392
  const WEBSOCKET_MAKE_OUTBOUND_CALL = 'call_invite';
23290
23393
  const WEBSOCKET_MAKE_USER_CALL = 'call_user';
@@ -23311,6 +23414,7 @@ class Client extends EventEmitter {
23311
23414
  this.eventHandler = new EventEmitter();
23312
23415
  this.callStore = new Map();
23313
23416
  this.conversationStore = new Map();
23417
+ this.pingTimer = null;
23314
23418
  this.basePath = `${formatBaseUri(_config.storageEndpoint || _config.endpoint)}`;
23315
23419
  }
23316
23420
  async connect() {
@@ -23473,6 +23577,11 @@ class Client extends EventEmitter {
23473
23577
  token: this._config.token,
23474
23578
  });
23475
23579
  }
23580
+ async ping() {
23581
+ return this.request(WEBSOCKET_PING, {
23582
+ ping: 1,
23583
+ });
23584
+ }
23476
23585
  sessionInfo() {
23477
23586
  return this.connectionInfo.session;
23478
23587
  }
@@ -23711,8 +23820,20 @@ class Client extends EventEmitter {
23711
23820
  this.eventHandler.emit(TASK_EVENT, e.status, task);
23712
23821
  }
23713
23822
  }
23823
+ async pingServer() {
23824
+ if (this.pingTimer) {
23825
+ await this.ping();
23826
+ }
23827
+ if (this.connectionInfo.ping_interval) {
23828
+ // @ts-ignore
23829
+ this.pingTimer = setTimeout(this.pingServer.bind(this), +this.connectionInfo.ping_interval);
23830
+ }
23831
+ }
23714
23832
  async connected(info) {
23715
23833
  this.connectionInfo = info;
23834
+ if (info.ping_interval) {
23835
+ await this.pingServer();
23836
+ }
23716
23837
  if (!this.useWebPhone()) {
23717
23838
  return;
23718
23839
  }
@@ -23740,12 +23861,10 @@ class Client extends EventEmitter {
23740
23861
  }
23741
23862
  checkAutoAnswer(call) {
23742
23863
  if ( /*!document.hidden && */call.autoAnswer) {
23743
- setTimeout(async () => {
23744
- await call.answer({
23745
- video: call.params.video,
23746
- screen: call.params.screen,
23747
- disableStun: call.params.disableStun,
23748
- });
23864
+ call.answerDelay({
23865
+ video: call.params.video,
23866
+ screen: call.params.screen,
23867
+ disableStun: call.params.disableStun,
23749
23868
  }, 300);
23750
23869
  }
23751
23870
  }