webitel-sdk 0.1.82 → 0.1.86

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 (59) hide show
  1. package/bundles/index.esm.js +135 -21
  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 +174 -26
  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/client.js +22 -0
  21. package/esm2015/socket/client.js.map +1 -1
  22. package/esm5/api/call-service-api.js +8 -22
  23. package/esm5/api/call-service-api.js.map +1 -1
  24. package/esm5/api/engine-reset-members-request.js +13 -0
  25. package/esm5/api/engine-reset-members-request.js.map +1 -0
  26. package/esm5/api/engine-reset-members-response.js +13 -0
  27. package/esm5/api/engine-reset-members-response.js.map +1 -0
  28. package/esm5/api/index.js.map +1 -1
  29. package/esm5/api/member-service-api.js +119 -0
  30. package/esm5/api/member-service-api.js.map +1 -1
  31. package/esm5/api-consumers/list-getter/base-list-getter-api-consumer/base-list-getter-api-consumer.js +1 -1
  32. package/esm5/api-consumers/list-getter/base-list-getter-api-consumer/base-list-getter-api-consumer.js.map +1 -1
  33. package/esm5/socket/client.js +47 -4
  34. package/esm5/socket/client.js.map +1 -1
  35. package/package.json +1 -1
  36. package/types/api/call-service-api.d.ts +4 -9
  37. package/types/api/call-service-api.d.ts.map +1 -1
  38. package/types/api/engine-attempt-history.d.ts +6 -0
  39. package/types/api/engine-attempt-history.d.ts.map +1 -1
  40. package/types/api/engine-history-call.d.ts +6 -0
  41. package/types/api/engine-history-call.d.ts.map +1 -1
  42. package/types/api/engine-reset-members-request.d.ts +63 -0
  43. package/types/api/engine-reset-members-request.d.ts.map +1 -0
  44. package/types/api/engine-reset-members-response.d.ts +25 -0
  45. package/types/api/engine-reset-members-response.d.ts.map +1 -0
  46. package/types/api/index.d.ts +2 -1
  47. package/types/api/index.d.ts.map +1 -1
  48. package/types/api/member-service-api.d.ts +38 -0
  49. package/types/api/member-service-api.d.ts.map +1 -1
  50. package/types/api-consumers/list-getter/base-list-getter-api-consumer/base-list-getter-api-consumer.d.ts +1 -2
  51. package/types/api-consumers/list-getter/base-list-getter-api-consumer/base-list-getter-api-consumer.d.ts.map +1 -1
  52. package/types/socket/client.d.ts +4 -0
  53. package/types/socket/client.d.ts.map +1 -1
  54. package/esm2015/api-consumers/list-getter/_shared/interfaces/response/lookup-list-getter-response.js +0 -1
  55. package/esm2015/api-consumers/list-getter/_shared/interfaces/response/lookup-list-getter-response.js.map +0 -1
  56. package/esm5/api-consumers/list-getter/_shared/interfaces/response/lookup-list-getter-response.js +0 -1
  57. package/esm5/api-consumers/list-getter/_shared/interfaces/response/lookup-list-getter-response.js.map +0 -1
  58. package/types/api-consumers/list-getter/_shared/interfaces/response/lookup-list-getter-response.d.ts +0 -3
  59. 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
@@ -23295,6 +23387,7 @@ const API_HEADER_TOKEN = 'X-Webitel-Access';
23295
23387
  const WEBSOCKET_AUTHENTICATION_CHALLENGE = 'authentication_challenge';
23296
23388
  const WEBSOCKET_DEFAULT_DEVICE_CONFIG = 'user_default_device';
23297
23389
  const WEBSOCKET_AGENT_SESSION = 'cc_agent_session';
23390
+ const WEBSOCKET_PING = 'ping';
23298
23391
  // const WEBSOCKET_CALL_BY_USER = 'call_by_user'
23299
23392
  const WEBSOCKET_MAKE_OUTBOUND_CALL = 'call_invite';
23300
23393
  const WEBSOCKET_MAKE_USER_CALL = 'call_user';
@@ -23321,6 +23414,7 @@ class Client extends EventEmitter {
23321
23414
  this.eventHandler = new EventEmitter();
23322
23415
  this.callStore = new Map();
23323
23416
  this.conversationStore = new Map();
23417
+ this.pingTimer = null;
23324
23418
  this.basePath = `${formatBaseUri(_config.storageEndpoint || _config.endpoint)}`;
23325
23419
  }
23326
23420
  async connect() {
@@ -23483,6 +23577,11 @@ class Client extends EventEmitter {
23483
23577
  token: this._config.token,
23484
23578
  });
23485
23579
  }
23580
+ async ping() {
23581
+ return this.request(WEBSOCKET_PING, {
23582
+ ping: 1,
23583
+ });
23584
+ }
23486
23585
  sessionInfo() {
23487
23586
  return this.connectionInfo.session;
23488
23587
  }
@@ -23721,8 +23820,20 @@ class Client extends EventEmitter {
23721
23820
  this.eventHandler.emit(TASK_EVENT, e.status, task);
23722
23821
  }
23723
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
+ }
23724
23832
  async connected(info) {
23725
23833
  this.connectionInfo = info;
23834
+ if (info.ping_interval) {
23835
+ await this.pingServer();
23836
+ }
23726
23837
  if (!this.useWebPhone()) {
23727
23838
  return;
23728
23839
  }
@@ -23769,6 +23880,9 @@ class Client extends EventEmitter {
23769
23880
  }
23770
23881
  this.socket.on('message', this.onMessage.bind(this));
23771
23882
  this.socket.on('close', (code) => {
23883
+ if (this.pingTimer) {
23884
+ clearTimeout(this.pingTimer);
23885
+ }
23772
23886
  this.log.error('socket close code: ', code);
23773
23887
  this.eventHandler.off('*');
23774
23888
  if (code !== 1000) {