webitel-sdk 26.4.33 → 26.4.34

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.
package/index.cjs CHANGED
@@ -66734,7 +66734,7 @@ _defineProperty(SipPhone$1, "userAgent", `Webitel-Phone/${version$1}`);
66734
66734
  _defineProperty(SipPhone$1, "sipVersion", version$1);
66735
66735
  //#endregion
66736
66736
  //#region src/version.ts
66737
- const version = "26.4.33";
66737
+ const version = "26.4.34";
66738
66738
  //#endregion
66739
66739
  //#region src/socket/errors.ts
66740
66740
  /**
@@ -67189,6 +67189,8 @@ var Task = class {
67189
67189
  "_autoAnswerTimerId",
67190
67190
  void 0
67191
67191
  );
67192
+ _defineProperty(this, "_baseProcessingSec", 0);
67193
+ _defineProperty(this, "_renewedSec", 0);
67192
67194
  this.id = e.attempt_id;
67193
67195
  this.state = "offering";
67194
67196
  this.setState(e.status);
@@ -67363,7 +67365,10 @@ var Task = class {
67363
67365
  setProcessing(now, p) {
67364
67366
  this.state = "processing";
67365
67367
  this.closedAt = now;
67366
- if (!this.startProcessingAt) this.startProcessingAt = Date.now();
67368
+ if (!this.startProcessingAt) {
67369
+ this.startProcessingAt = Date.now();
67370
+ this._baseProcessingSec = p.sec;
67371
+ }
67367
67372
  if (p.sec && !p.timeout) p.timeout = Date.now() + p.sec * 1e3;
67368
67373
  this._processing = p;
67369
67374
  }
@@ -67404,9 +67409,8 @@ var Task = class {
67404
67409
  * @returns {number | null}
67405
67410
  */
67406
67411
  get processingSec() {
67407
- var _this$_processing2;
67408
- if (!((_this$_processing2 = this._processing) === null || _this$_processing2 === void 0 ? void 0 : _this$_processing2.sec)) return null;
67409
- return this._processing.sec;
67412
+ var _this$_processing$sec, _this$_processing2;
67413
+ return (_this$_processing$sec = (_this$_processing2 = this._processing) === null || _this$_processing2 === void 0 ? void 0 : _this$_processing2.sec) !== null && _this$_processing$sec !== void 0 ? _this$_processing$sec : null;
67410
67414
  }
67411
67415
  /**
67412
67416
  * Отримати спробу.
@@ -67554,10 +67558,16 @@ var Task = class {
67554
67558
  * @returns {Promise<any>}
67555
67559
  */
67556
67560
  async renew(sec) {
67557
- return this.client.request("cc_renewal", {
67561
+ const renewSec = sec || this.processingSec;
67562
+ const res = await this.client.request("cc_renewal", {
67558
67563
  attempt_id: this.id,
67559
- renewal_sec: sec ? sec : this.processingSec
67564
+ renewal_sec: renewSec
67560
67565
  });
67566
+ this._renewedSec += renewSec !== null && renewSec !== void 0 ? renewSec : 0;
67567
+ return res;
67568
+ }
67569
+ get totalProcessingSec() {
67570
+ return this._processing ? this._baseProcessingSec + this._renewedSec : null;
67561
67571
  }
67562
67572
  /**
67563
67573
  * Виконати дію з формою.