webitel-sdk 23.12.2 → 23.12.7

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 (51) hide show
  1. package/bundles/index.esm.js +177 -11
  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 +220 -12
  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/engine-activity-workspace-widget-response.js +13 -0
  10. package/esm2015/api/engine-activity-workspace-widget-response.js.map +1 -0
  11. package/esm2015/api/index.js +1 -0
  12. package/esm2015/api/index.js.map +1 -1
  13. package/esm2015/api/system-setting-service-api.js +42 -7
  14. package/esm2015/api/system-setting-service-api.js.map +1 -1
  15. package/esm2015/api/user-helper-service-api.js +87 -0
  16. package/esm2015/api/user-helper-service-api.js.map +1 -1
  17. package/esm2015/sip/webrtc/index.js +2 -2
  18. package/esm2015/socket/client.js +33 -2
  19. package/esm2015/socket/client.js.map +1 -1
  20. package/esm5/api/engine-activity-workspace-widget-response.js +13 -0
  21. package/esm5/api/engine-activity-workspace-widget-response.js.map +1 -0
  22. package/esm5/api/index.js +1 -0
  23. package/esm5/api/index.js.map +1 -1
  24. package/esm5/api/system-setting-service-api.js +42 -7
  25. package/esm5/api/system-setting-service-api.js.map +1 -1
  26. package/esm5/api/user-helper-service-api.js +100 -0
  27. package/esm5/api/user-helper-service-api.js.map +1 -1
  28. package/esm5/sip/webrtc/index.js +2 -2
  29. package/esm5/socket/client.js +63 -3
  30. package/esm5/socket/client.js.map +1 -1
  31. package/package.json +1 -1
  32. package/types/api/engine-activity-workspace-widget-response.d.ts +151 -0
  33. package/types/api/engine-activity-workspace-widget-response.d.ts.map +1 -0
  34. package/types/api/engine-agent-team.d.ts +6 -0
  35. package/types/api/engine-agent-team.d.ts.map +1 -1
  36. package/types/api/engine-create-agent-team-request.d.ts +6 -0
  37. package/types/api/engine-create-agent-team-request.d.ts.map +1 -1
  38. package/types/api/engine-history-call.d.ts +6 -0
  39. package/types/api/engine-history-call.d.ts.map +1 -1
  40. package/types/api/engine-update-agent-team-request.d.ts +6 -0
  41. package/types/api/engine-update-agent-team-request.d.ts.map +1 -1
  42. package/types/api/index.d.ts +1 -0
  43. package/types/api/index.d.ts.map +1 -1
  44. package/types/api/storage-upload-file-request-metadata.d.ts +6 -0
  45. package/types/api/storage-upload-file-request-metadata.d.ts.map +1 -1
  46. package/types/api/system-setting-service-api.d.ts +24 -4
  47. package/types/api/system-setting-service-api.d.ts.map +1 -1
  48. package/types/api/user-helper-service-api.d.ts +30 -0
  49. package/types/api/user-helper-service-api.d.ts.map +1 -1
  50. package/types/socket/client.d.ts +4 -1
  51. package/types/socket/client.d.ts.map +1 -1
@@ -35124,10 +35124,15 @@ const SystemSettingServiceApiAxiosParamCreator = function (configuration) {
35124
35124
  },
35125
35125
  /**
35126
35126
  *
35127
+ * @param {number} [page]
35128
+ * @param {number} [size]
35129
+ * @param {string} [q]
35130
+ * @param {string} [sort]
35131
+ * @param {Array<string>} [fields]
35127
35132
  * @param {*} [options] Override http request option.
35128
35133
  * @throws {RequiredError}
35129
35134
  */
35130
- searchAvailableSystemSetting: async (options = {}) => {
35135
+ searchAvailableSystemSetting: async (page, size, q, sort, fields, options = {}) => {
35131
35136
  const localVarPath = `/settings/available`;
35132
35137
  const localVarUrlObj = parse(localVarPath, true);
35133
35138
  let baseOptions;
@@ -35148,6 +35153,21 @@ const SystemSettingServiceApiAxiosParamCreator = function (configuration) {
35148
35153
  : await configuration.apiKey;
35149
35154
  localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
35150
35155
  }
35156
+ if (page !== undefined) {
35157
+ localVarQueryParameter['page'] = page;
35158
+ }
35159
+ if (size !== undefined) {
35160
+ localVarQueryParameter['size'] = size;
35161
+ }
35162
+ if (q !== undefined) {
35163
+ localVarQueryParameter['q'] = q;
35164
+ }
35165
+ if (sort !== undefined) {
35166
+ localVarQueryParameter['sort'] = sort;
35167
+ }
35168
+ if (fields) {
35169
+ localVarQueryParameter['fields'] = fields;
35170
+ }
35151
35171
  localVarUrlObj.query = {
35152
35172
  ...localVarUrlObj.query,
35153
35173
  ...localVarQueryParameter,
@@ -35365,11 +35385,16 @@ const SystemSettingServiceApiFp = function (configuration) {
35365
35385
  },
35366
35386
  /**
35367
35387
  *
35388
+ * @param {number} [page]
35389
+ * @param {number} [size]
35390
+ * @param {string} [q]
35391
+ * @param {string} [sort]
35392
+ * @param {Array<string>} [fields]
35368
35393
  * @param {*} [options] Override http request option.
35369
35394
  * @throws {RequiredError}
35370
35395
  */
35371
- async searchAvailableSystemSetting(options) {
35372
- const localVarAxiosArgs = await SystemSettingServiceApiAxiosParamCreator(configuration).searchAvailableSystemSetting(options);
35396
+ async searchAvailableSystemSetting(page, size, q, sort, fields, options) {
35397
+ const localVarAxiosArgs = await SystemSettingServiceApiAxiosParamCreator(configuration).searchAvailableSystemSetting(page, size, q, sort, fields, options);
35373
35398
  return (axios = globalAxios, basePath = BASE_PATH) => {
35374
35399
  const axiosRequestArgs = {
35375
35400
  ...localVarAxiosArgs.options,
@@ -35470,12 +35495,17 @@ const SystemSettingServiceApiFactory = function (configuration, basePath, axios)
35470
35495
  },
35471
35496
  /**
35472
35497
  *
35498
+ * @param {number} [page]
35499
+ * @param {number} [size]
35500
+ * @param {string} [q]
35501
+ * @param {string} [sort]
35502
+ * @param {Array<string>} [fields]
35473
35503
  * @param {*} [options] Override http request option.
35474
35504
  * @throws {RequiredError}
35475
35505
  */
35476
- searchAvailableSystemSetting(options) {
35506
+ searchAvailableSystemSetting(page, size, q, sort, fields, options) {
35477
35507
  return SystemSettingServiceApiFp(configuration)
35478
- .searchAvailableSystemSetting(options)
35508
+ .searchAvailableSystemSetting(page, size, q, sort, fields, options)
35479
35509
  .then((request) => request(axios, basePath));
35480
35510
  },
35481
35511
  /**
@@ -35565,13 +35595,18 @@ class SystemSettingServiceApi extends BaseAPI {
35565
35595
  }
35566
35596
  /**
35567
35597
  *
35598
+ * @param {number} [page]
35599
+ * @param {number} [size]
35600
+ * @param {string} [q]
35601
+ * @param {string} [sort]
35602
+ * @param {Array<string>} [fields]
35568
35603
  * @param {*} [options] Override http request option.
35569
35604
  * @throws {RequiredError}
35570
35605
  * @memberof SystemSettingServiceApi
35571
35606
  */
35572
- searchAvailableSystemSetting(options) {
35607
+ searchAvailableSystemSetting(page, size, q, sort, fields, options) {
35573
35608
  return SystemSettingServiceApiFp(this.configuration)
35574
- .searchAvailableSystemSetting(options)
35609
+ .searchAvailableSystemSetting(page, size, q, sort, fields, options)
35575
35610
  .then((request) => request(this.axios, this.basePath));
35576
35611
  }
35577
35612
  /**
@@ -37518,6 +37553,54 @@ class TriggerServiceApi extends BaseAPI {
37518
37553
  */
37519
37554
  const UserHelperServiceApiAxiosParamCreator = function (configuration) {
37520
37555
  return {
37556
+ /**
37557
+ *
37558
+ * @param {Array<string>} [fields]
37559
+ * @param {*} [options] Override http request option.
37560
+ * @throws {RequiredError}
37561
+ */
37562
+ activityWorkspaceWidget: async (fields, options = {}) => {
37563
+ const localVarPath = `/user/widget/activity/today`;
37564
+ const localVarUrlObj = parse(localVarPath, true);
37565
+ let baseOptions;
37566
+ if (configuration) {
37567
+ baseOptions = configuration.baseOptions;
37568
+ }
37569
+ const localVarRequestOptions = {
37570
+ method: 'GET',
37571
+ ...baseOptions,
37572
+ ...options,
37573
+ };
37574
+ const localVarHeaderParameter = {};
37575
+ const localVarQueryParameter = {};
37576
+ // authentication AccessToken required
37577
+ if (configuration && configuration.apiKey) {
37578
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
37579
+ ? await configuration.apiKey('X-Webitel-Access')
37580
+ : await configuration.apiKey;
37581
+ localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
37582
+ }
37583
+ if (fields) {
37584
+ localVarQueryParameter['fields'] = fields;
37585
+ }
37586
+ localVarUrlObj.query = {
37587
+ ...localVarUrlObj.query,
37588
+ ...localVarQueryParameter,
37589
+ ...options.query,
37590
+ };
37591
+ // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
37592
+ delete localVarUrlObj.search;
37593
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
37594
+ localVarRequestOptions.headers = {
37595
+ ...localVarHeaderParameter,
37596
+ ...headersFromBaseOptions,
37597
+ ...options.headers,
37598
+ };
37599
+ return {
37600
+ url: format(localVarUrlObj),
37601
+ options: localVarRequestOptions,
37602
+ };
37603
+ },
37521
37604
  /**
37522
37605
  *
37523
37606
  * @param {string} type
@@ -37575,6 +37658,22 @@ const UserHelperServiceApiAxiosParamCreator = function (configuration) {
37575
37658
  */
37576
37659
  const UserHelperServiceApiFp = function (configuration) {
37577
37660
  return {
37661
+ /**
37662
+ *
37663
+ * @param {Array<string>} [fields]
37664
+ * @param {*} [options] Override http request option.
37665
+ * @throws {RequiredError}
37666
+ */
37667
+ async activityWorkspaceWidget(fields, options) {
37668
+ const localVarAxiosArgs = await UserHelperServiceApiAxiosParamCreator(configuration).activityWorkspaceWidget(fields, options);
37669
+ return (axios = globalAxios, basePath = BASE_PATH) => {
37670
+ const axiosRequestArgs = {
37671
+ ...localVarAxiosArgs.options,
37672
+ url: basePath + localVarAxiosArgs.url,
37673
+ };
37674
+ return axios.request(axiosRequestArgs);
37675
+ };
37676
+ },
37578
37677
  /**
37579
37678
  *
37580
37679
  * @param {string} type
@@ -37599,6 +37698,17 @@ const UserHelperServiceApiFp = function (configuration) {
37599
37698
  */
37600
37699
  const UserHelperServiceApiFactory = function (configuration, basePath, axios) {
37601
37700
  return {
37701
+ /**
37702
+ *
37703
+ * @param {Array<string>} [fields]
37704
+ * @param {*} [options] Override http request option.
37705
+ * @throws {RequiredError}
37706
+ */
37707
+ activityWorkspaceWidget(fields, options) {
37708
+ return UserHelperServiceApiFp(configuration)
37709
+ .activityWorkspaceWidget(fields, options)
37710
+ .then((request) => request(axios, basePath));
37711
+ },
37602
37712
  /**
37603
37713
  *
37604
37714
  * @param {string} type
@@ -37619,6 +37729,18 @@ const UserHelperServiceApiFactory = function (configuration, basePath, axios) {
37619
37729
  * @extends {BaseAPI}
37620
37730
  */
37621
37731
  class UserHelperServiceApi extends BaseAPI {
37732
+ /**
37733
+ *
37734
+ * @param {Array<string>} [fields]
37735
+ * @param {*} [options] Override http request option.
37736
+ * @throws {RequiredError}
37737
+ * @memberof UserHelperServiceApi
37738
+ */
37739
+ activityWorkspaceWidget(fields, options) {
37740
+ return UserHelperServiceApiFp(this.configuration)
37741
+ .activityWorkspaceWidget(fields, options)
37742
+ .then((request) => request(this.axios, this.basePath));
37743
+ }
37622
37744
  /**
37623
37745
  *
37624
37746
  * @param {string} type
@@ -38998,6 +39120,19 @@ class Configuration {
38998
39120
  * Do not edit the class manually.
38999
39121
  */
39000
39122
 
39123
+ // tslint:disable
39124
+ /**
39125
+ * Webitel API
39126
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
39127
+ *
39128
+ * The version of the OpenAPI document: 23.09.0
39129
+ * Contact: support@webitel.com
39130
+ *
39131
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
39132
+ * https://openapi-generator.tech
39133
+ * Do not edit the class manually.
39134
+ */
39135
+
39001
39136
  // tslint:disable
39002
39137
  /**
39003
39138
  * Webitel API
@@ -43992,8 +44127,8 @@ class SipPhone extends EventEmitter {
43992
44127
  // use_preloaded_route: true,
43993
44128
  display_name: sipConf.display_name,
43994
44129
  register_expires: sipConf.register_expires || 90,
43995
- connection_recovery_min_interval: 5,
43996
- connection_recovery_max_interval: 60,
44130
+ connection_recovery_min_interval: 2,
44131
+ connection_recovery_max_interval: 30,
43997
44132
  };
43998
44133
  const ua = (this.ua = new UA(configuration));
43999
44134
  // ua.on('connected', (e: object) => {})
@@ -45882,6 +46017,7 @@ class Client extends EventEmitter {
45882
46017
  this.pingTimer = null;
45883
46018
  this.basePath = `${formatBaseUri(_config.storageEndpoint || _config.endpoint)}`;
45884
46019
  this.lastError = null;
46020
+ this.lastLatency = null;
45885
46021
  }
45886
46022
  async connect() {
45887
46023
  await this.connectToSocket();
@@ -46096,9 +46232,19 @@ class Client extends EventEmitter {
46096
46232
  }
46097
46233
  }
46098
46234
  async ping() {
46099
- return this.request(WEBSOCKET_PING, {
46235
+ const response = (await this.request(WEBSOCKET_PING, {
46100
46236
  ping: 1,
46101
- });
46237
+ }));
46238
+ if (response && response.server_ts) {
46239
+ const ack = {
46240
+ client_ts: 0,
46241
+ client_ack_ts: 0,
46242
+ server_ts: response.server_ts,
46243
+ server_ack_ts: 0,
46244
+ };
46245
+ return this.calculateLatency(ack);
46246
+ }
46247
+ return response;
46102
46248
  }
46103
46249
  sessionInfo() {
46104
46250
  return this.connectionInfo.session;
@@ -46488,6 +46634,26 @@ class Client extends EventEmitter {
46488
46634
  }
46489
46635
  return this.registerCallClient(new SipPhone(this.instanceId, this._config.debug));
46490
46636
  }
46637
+ async latency() {
46638
+ const ack = {
46639
+ client_ts: 0,
46640
+ client_ack_ts: 0,
46641
+ server_ts: 0,
46642
+ server_ack_ts: 0,
46643
+ };
46644
+ Object.assign(ack, await this.request(`latency_start`, ack));
46645
+ return this.calculateLatency(ack);
46646
+ }
46647
+ async calculateLatency(ack) {
46648
+ ack.client_ts = Date.now();
46649
+ Object.assign(ack, await this.request(`latency_ack`, ack));
46650
+ ack.client_ack_ts = Date.now();
46651
+ this.lastLatency = Math.abs(ack.server_ack_ts -
46652
+ ack.server_ts -
46653
+ (ack.client_ack_ts - ack.client_ts) * 0.5);
46654
+ this.log.info(`[websocket] latency: ${this.lastLatency}`);
46655
+ return this.lastLatency;
46656
+ }
46491
46657
  callBySession(session) {
46492
46658
  for (const call of this.allCall()) {
46493
46659
  if (call.sip && call.sip.id === session.id) {