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
@@ -7198,14 +7198,13 @@
7198
7198
  *
7199
7199
  * @param {string} callId
7200
7200
  * @param {string} id
7201
- * @param {EngineDeleteCallAnnotationRequest} body
7202
7201
  * @param {*} [options] Override http request option.
7203
7202
  * @throws {RequiredError}
7204
7203
  */
7205
- deleteCallAnnotation: function (callId, id, body, options) {
7204
+ deleteCallAnnotation: function (callId, id, options) {
7206
7205
  if (options === void 0) { options = {}; }
7207
7206
  return tslib.__awaiter(_this, void 0, void 0, function () {
7208
- var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarApiKeyValue, _a, headersFromBaseOptions, needsSerialization;
7207
+ var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarApiKeyValue, _a, headersFromBaseOptions;
7209
7208
  return tslib.__generator(this, function (_b) {
7210
7209
  switch (_b.label) {
7211
7210
  case 0:
@@ -7217,10 +7216,6 @@
7217
7216
  if (id === null || id === undefined) {
7218
7217
  throw new RequiredError('id', 'Required parameter id was null or undefined when calling deleteCallAnnotation.');
7219
7218
  }
7220
- // verify required parameter 'body' is not null or undefined
7221
- if (body === null || body === undefined) {
7222
- throw new RequiredError('body', 'Required parameter body was null or undefined when calling deleteCallAnnotation.');
7223
- }
7224
7219
  localVarPath = "/calls/history/{call_id}/annotation/{id}"
7225
7220
  .replace("{" + 'call_id' + "}", encodeURIComponent(String(callId)))
7226
7221
  .replace("{" + 'id' + "}", encodeURIComponent(String(id)));
@@ -7246,17 +7241,11 @@
7246
7241
  localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
7247
7242
  _b.label = 5;
7248
7243
  case 5:
7249
- localVarHeaderParameter['Content-Type'] = 'application/json';
7250
7244
  localVarUrlObj.query = tslib.__assign(tslib.__assign(tslib.__assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
7251
7245
  // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
7252
7246
  delete localVarUrlObj.search;
7253
7247
  headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
7254
7248
  localVarRequestOptions.headers = tslib.__assign(tslib.__assign(tslib.__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
7255
- needsSerialization = typeof body !== 'string' ||
7256
- localVarRequestOptions.headers['Content-Type'] === 'application/json';
7257
- localVarRequestOptions.data = needsSerialization
7258
- ? JSON.stringify(body !== undefined ? body : {})
7259
- : body || '';
7260
7249
  return [2 /*return*/, {
7261
7250
  url: globalImportUrl.format(localVarUrlObj),
7262
7251
  options: localVarRequestOptions,
@@ -8166,16 +8155,15 @@
8166
8155
  *
8167
8156
  * @param {string} callId
8168
8157
  * @param {string} id
8169
- * @param {EngineDeleteCallAnnotationRequest} body
8170
8158
  * @param {*} [options] Override http request option.
8171
8159
  * @throws {RequiredError}
8172
8160
  */
8173
- deleteCallAnnotation: function (callId, id, body, options) {
8161
+ deleteCallAnnotation: function (callId, id, options) {
8174
8162
  return tslib.__awaiter(this, void 0, void 0, function () {
8175
8163
  var localVarAxiosArgs;
8176
8164
  return tslib.__generator(this, function (_a) {
8177
8165
  switch (_a.label) {
8178
- case 0: return [4 /*yield*/, CallServiceApiAxiosParamCreator(configuration).deleteCallAnnotation(callId, id, body, options)];
8166
+ case 0: return [4 /*yield*/, CallServiceApiAxiosParamCreator(configuration).deleteCallAnnotation(callId, id, options)];
8179
8167
  case 1:
8180
8168
  localVarAxiosArgs = _a.sent();
8181
8169
  return [2 /*return*/, function (axios, basePath) {
@@ -8532,13 +8520,12 @@
8532
8520
  *
8533
8521
  * @param {string} callId
8534
8522
  * @param {string} id
8535
- * @param {EngineDeleteCallAnnotationRequest} body
8536
8523
  * @param {*} [options] Override http request option.
8537
8524
  * @throws {RequiredError}
8538
8525
  */
8539
- deleteCallAnnotation: function (callId, id, body, options) {
8526
+ deleteCallAnnotation: function (callId, id, options) {
8540
8527
  return CallServiceApiFp(configuration)
8541
- .deleteCallAnnotation(callId, id, body, options)
8528
+ .deleteCallAnnotation(callId, id, options)
8542
8529
  .then(function (request) { return request(axios, basePath); });
8543
8530
  },
8544
8531
  /**
@@ -8781,15 +8768,14 @@
8781
8768
  *
8782
8769
  * @param {string} callId
8783
8770
  * @param {string} id
8784
- * @param {EngineDeleteCallAnnotationRequest} body
8785
8771
  * @param {*} [options] Override http request option.
8786
8772
  * @throws {RequiredError}
8787
8773
  * @memberof CallServiceApi
8788
8774
  */
8789
- CallServiceApi.prototype.deleteCallAnnotation = function (callId, id, body, options) {
8775
+ CallServiceApi.prototype.deleteCallAnnotation = function (callId, id, options) {
8790
8776
  var _this = this;
8791
8777
  return CallServiceApiFp(this.configuration)
8792
- .deleteCallAnnotation(callId, id, body, options)
8778
+ .deleteCallAnnotation(callId, id, options)
8793
8779
  .then(function (request) { return request(_this.axios, _this.basePath); });
8794
8780
  };
8795
8781
  /**
@@ -12604,6 +12590,71 @@
12604
12590
  });
12605
12591
  });
12606
12592
  },
12593
+ /**
12594
+ *
12595
+ * @summary ResetMembers
12596
+ * @param {string} queueId
12597
+ * @param {EngineResetMembersRequest} body
12598
+ * @param {*} [options] Override http request option.
12599
+ * @throws {RequiredError}
12600
+ */
12601
+ resetMembers: function (queueId, body, options) {
12602
+ if (options === void 0) { options = {}; }
12603
+ return tslib.__awaiter(_this, void 0, void 0, function () {
12604
+ var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarApiKeyValue, _a, headersFromBaseOptions, needsSerialization;
12605
+ return tslib.__generator(this, function (_b) {
12606
+ switch (_b.label) {
12607
+ case 0:
12608
+ // verify required parameter 'queueId' is not null or undefined
12609
+ if (queueId === null || queueId === undefined) {
12610
+ throw new RequiredError('queueId', 'Required parameter queueId was null or undefined when calling resetMembers.');
12611
+ }
12612
+ // verify required parameter 'body' is not null or undefined
12613
+ if (body === null || body === undefined) {
12614
+ throw new RequiredError('body', 'Required parameter body was null or undefined when calling resetMembers.');
12615
+ }
12616
+ localVarPath = "/call_center/queues/{queue_id}/members/reset".replace("{" + 'queue_id' + "}", encodeURIComponent(String(queueId)));
12617
+ localVarUrlObj = globalImportUrl.parse(localVarPath, true);
12618
+ if (configuration) {
12619
+ baseOptions = configuration.baseOptions;
12620
+ }
12621
+ localVarRequestOptions = tslib.__assign(tslib.__assign({ method: 'PATCH' }, baseOptions), options);
12622
+ localVarHeaderParameter = {};
12623
+ localVarQueryParameter = {};
12624
+ if (!(configuration && configuration.apiKey)) return [3 /*break*/, 5];
12625
+ if (!(typeof configuration.apiKey === 'function')) return [3 /*break*/, 2];
12626
+ return [4 /*yield*/, configuration.apiKey('X-Webitel-Access')];
12627
+ case 1:
12628
+ _a = _b.sent();
12629
+ return [3 /*break*/, 4];
12630
+ case 2: return [4 /*yield*/, configuration.apiKey];
12631
+ case 3:
12632
+ _a = _b.sent();
12633
+ _b.label = 4;
12634
+ case 4:
12635
+ localVarApiKeyValue = _a;
12636
+ localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
12637
+ _b.label = 5;
12638
+ case 5:
12639
+ localVarHeaderParameter['Content-Type'] = 'application/json';
12640
+ localVarUrlObj.query = tslib.__assign(tslib.__assign(tslib.__assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
12641
+ // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
12642
+ delete localVarUrlObj.search;
12643
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
12644
+ localVarRequestOptions.headers = tslib.__assign(tslib.__assign(tslib.__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
12645
+ needsSerialization = typeof body !== 'string' ||
12646
+ localVarRequestOptions.headers['Content-Type'] === 'application/json';
12647
+ localVarRequestOptions.data = needsSerialization
12648
+ ? JSON.stringify(body !== undefined ? body : {})
12649
+ : body || '';
12650
+ return [2 /*return*/, {
12651
+ url: globalImportUrl.format(localVarUrlObj),
12652
+ options: localVarRequestOptions,
12653
+ }];
12654
+ }
12655
+ });
12656
+ });
12657
+ },
12607
12658
  /**
12608
12659
  *
12609
12660
  * @summary SearchAttempts
@@ -13357,6 +13408,32 @@
13357
13408
  });
13358
13409
  });
13359
13410
  },
13411
+ /**
13412
+ *
13413
+ * @summary ResetMembers
13414
+ * @param {string} queueId
13415
+ * @param {EngineResetMembersRequest} body
13416
+ * @param {*} [options] Override http request option.
13417
+ * @throws {RequiredError}
13418
+ */
13419
+ resetMembers: function (queueId, body, options) {
13420
+ return tslib.__awaiter(this, void 0, void 0, function () {
13421
+ var localVarAxiosArgs;
13422
+ return tslib.__generator(this, function (_a) {
13423
+ switch (_a.label) {
13424
+ case 0: return [4 /*yield*/, MemberServiceApiAxiosParamCreator(configuration).resetMembers(queueId, body, options)];
13425
+ case 1:
13426
+ localVarAxiosArgs = _a.sent();
13427
+ return [2 /*return*/, function (axios, basePath) {
13428
+ if (axios === void 0) { axios = globalAxios; }
13429
+ if (basePath === void 0) { basePath = BASE_PATH; }
13430
+ var axiosRequestArgs = tslib.__assign(tslib.__assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
13431
+ return axios.request(axiosRequestArgs);
13432
+ }];
13433
+ }
13434
+ });
13435
+ });
13436
+ },
13360
13437
  /**
13361
13438
  *
13362
13439
  * @summary SearchAttempts
@@ -13685,6 +13762,19 @@
13685
13762
  .readMember(queueId, id, domainId, options)
13686
13763
  .then(function (request) { return request(axios, basePath); });
13687
13764
  },
13765
+ /**
13766
+ *
13767
+ * @summary ResetMembers
13768
+ * @param {string} queueId
13769
+ * @param {EngineResetMembersRequest} body
13770
+ * @param {*} [options] Override http request option.
13771
+ * @throws {RequiredError}
13772
+ */
13773
+ resetMembers: function (queueId, body, options) {
13774
+ return MemberServiceApiFp(configuration)
13775
+ .resetMembers(queueId, body, options)
13776
+ .then(function (request) { return request(axios, basePath); });
13777
+ },
13688
13778
  /**
13689
13779
  *
13690
13780
  * @summary SearchAttempts
@@ -13960,6 +14050,21 @@
13960
14050
  .readMember(queueId, id, domainId, options)
13961
14051
  .then(function (request) { return request(_this.axios, _this.basePath); });
13962
14052
  };
14053
+ /**
14054
+ *
14055
+ * @summary ResetMembers
14056
+ * @param {string} queueId
14057
+ * @param {EngineResetMembersRequest} body
14058
+ * @param {*} [options] Override http request option.
14059
+ * @throws {RequiredError}
14060
+ * @memberof MemberServiceApi
14061
+ */
14062
+ MemberServiceApi.prototype.resetMembers = function (queueId, body, options) {
14063
+ var _this = this;
14064
+ return MemberServiceApiFp(this.configuration)
14065
+ .resetMembers(queueId, body, options)
14066
+ .then(function (request) { return request(_this.axios, _this.basePath); });
14067
+ };
13963
14068
  /**
13964
14069
  *
13965
14070
  * @summary SearchAttempts
@@ -26407,6 +26512,7 @@
26407
26512
  var WEBSOCKET_AUTHENTICATION_CHALLENGE = 'authentication_challenge';
26408
26513
  var WEBSOCKET_DEFAULT_DEVICE_CONFIG = 'user_default_device';
26409
26514
  var WEBSOCKET_AGENT_SESSION = 'cc_agent_session';
26515
+ var WEBSOCKET_PING = 'ping';
26410
26516
  // const WEBSOCKET_CALL_BY_USER = 'call_by_user'
26411
26517
  var WEBSOCKET_MAKE_OUTBOUND_CALL = 'call_invite';
26412
26518
  var WEBSOCKET_MAKE_USER_CALL = 'call_user';
@@ -26433,6 +26539,7 @@
26433
26539
  _this.eventHandler = new eeTs.EventEmitter();
26434
26540
  _this.callStore = new Map();
26435
26541
  _this.conversationStore = new Map();
26542
+ _this.pingTimer = null;
26436
26543
  _this.basePath = "" + formatBaseUri(_config.storageEndpoint || _config.endpoint);
26437
26544
  return _this;
26438
26545
  }
@@ -26682,6 +26789,15 @@
26682
26789
  });
26683
26790
  });
26684
26791
  };
26792
+ Client.prototype.ping = function () {
26793
+ return tslib.__awaiter(this, void 0, void 0, function () {
26794
+ return tslib.__generator(this, function (_a) {
26795
+ return [2 /*return*/, this.request(WEBSOCKET_PING, {
26796
+ ping: 1,
26797
+ })];
26798
+ });
26799
+ });
26800
+ };
26685
26801
  Client.prototype.sessionInfo = function () {
26686
26802
  return this.connectionInfo.session;
26687
26803
  };
@@ -27042,14 +27158,43 @@
27042
27158
  this.eventHandler.emit(TASK_EVENT, e.status, task);
27043
27159
  }
27044
27160
  };
27161
+ Client.prototype.pingServer = function () {
27162
+ return tslib.__awaiter(this, void 0, void 0, function () {
27163
+ return tslib.__generator(this, function (_a) {
27164
+ switch (_a.label) {
27165
+ case 0:
27166
+ if (!this.pingTimer) return [3 /*break*/, 2];
27167
+ return [4 /*yield*/, this.ping()];
27168
+ case 1:
27169
+ _a.sent();
27170
+ _a.label = 2;
27171
+ case 2:
27172
+ if (this.connectionInfo.ping_interval) {
27173
+ // @ts-ignore
27174
+ this.pingTimer = setTimeout(this.pingServer.bind(this), +this.connectionInfo.ping_interval);
27175
+ }
27176
+ return [2 /*return*/];
27177
+ }
27178
+ });
27179
+ });
27180
+ };
27045
27181
  Client.prototype.connected = function (info) {
27046
27182
  return tslib.__awaiter(this, void 0, void 0, function () {
27047
27183
  return tslib.__generator(this, function (_a) {
27048
- this.connectionInfo = info;
27049
- if (!this.useWebPhone()) {
27050
- return [2 /*return*/];
27184
+ switch (_a.label) {
27185
+ case 0:
27186
+ this.connectionInfo = info;
27187
+ if (!info.ping_interval) return [3 /*break*/, 2];
27188
+ return [4 /*yield*/, this.pingServer()];
27189
+ case 1:
27190
+ _a.sent();
27191
+ _a.label = 2;
27192
+ case 2:
27193
+ if (!this.useWebPhone()) {
27194
+ return [2 /*return*/];
27195
+ }
27196
+ return [2 /*return*/, this.registerCallClient(new SipPhone(this.instanceId, this._config.debug))];
27051
27197
  }
27052
- return [2 /*return*/, this.registerCallClient(new SipPhone(this.instanceId, this._config.debug))];
27053
27198
  });
27054
27199
  });
27055
27200
  };
@@ -27101,6 +27246,9 @@
27101
27246
  }
27102
27247
  _this.socket.on('message', _this.onMessage.bind(_this));
27103
27248
  _this.socket.on('close', function (code) {
27249
+ if (_this.pingTimer) {
27250
+ clearTimeout(_this.pingTimer);
27251
+ }
27104
27252
  _this.log.error('socket close code: ', code);
27105
27253
  _this.eventHandler.off('*');
27106
27254
  if (code !== 1000) {