webitel-sdk 26.4.33 → 26.4.35

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.mjs CHANGED
@@ -66709,7 +66709,7 @@ _defineProperty(SipPhone$1, "userAgent", `Webitel-Phone/${version$1}`);
66709
66709
  _defineProperty(SipPhone$1, "sipVersion", version$1);
66710
66710
  //#endregion
66711
66711
  //#region src/version.ts
66712
- const version = "26.4.33";
66712
+ const version = "26.4.35";
66713
66713
  //#endregion
66714
66714
  //#region src/socket/errors.ts
66715
66715
  /**
@@ -67164,6 +67164,8 @@ var Task = class {
67164
67164
  "_autoAnswerTimerId",
67165
67165
  void 0
67166
67166
  );
67167
+ _defineProperty(this, "_baseProcessingSec", 0);
67168
+ _defineProperty(this, "_renewedSec", 0);
67167
67169
  this.id = e.attempt_id;
67168
67170
  this.state = "offering";
67169
67171
  this.setState(e.status);
@@ -67338,7 +67340,10 @@ var Task = class {
67338
67340
  setProcessing(now, p) {
67339
67341
  this.state = "processing";
67340
67342
  this.closedAt = now;
67341
- if (!this.startProcessingAt) this.startProcessingAt = Date.now();
67343
+ if (!this.startProcessingAt) {
67344
+ this.startProcessingAt = Date.now();
67345
+ this._baseProcessingSec = p.sec;
67346
+ }
67342
67347
  if (p.sec && !p.timeout) p.timeout = Date.now() + p.sec * 1e3;
67343
67348
  this._processing = p;
67344
67349
  }
@@ -67379,9 +67384,8 @@ var Task = class {
67379
67384
  * @returns {number | null}
67380
67385
  */
67381
67386
  get processingSec() {
67382
- var _this$_processing2;
67383
- if (!((_this$_processing2 = this._processing) === null || _this$_processing2 === void 0 ? void 0 : _this$_processing2.sec)) return null;
67384
- return this._processing.sec;
67387
+ var _this$_processing$sec, _this$_processing2;
67388
+ 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;
67385
67389
  }
67386
67390
  /**
67387
67391
  * Отримати спробу.
@@ -67529,10 +67533,16 @@ var Task = class {
67529
67533
  * @returns {Promise<any>}
67530
67534
  */
67531
67535
  async renew(sec) {
67532
- return this.client.request("cc_renewal", {
67536
+ const renewSec = sec || this.processingSec;
67537
+ const res = await this.client.request("cc_renewal", {
67533
67538
  attempt_id: this.id,
67534
- renewal_sec: sec ? sec : this.processingSec
67539
+ renewal_sec: renewSec
67535
67540
  });
67541
+ this._renewedSec += renewSec !== null && renewSec !== void 0 ? renewSec : 0;
67542
+ return res;
67543
+ }
67544
+ get totalProcessingSec() {
67545
+ return this._processing ? this._baseProcessingSec + this._renewedSec : null;
67536
67546
  }
67537
67547
  /**
67538
67548
  * Виконати дію з формою.