@processmaker/screen-builder 3.8.42 → 3.8.43

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.
@@ -55375,24 +55375,21 @@ const dae = () => new Promise((t) => {
55375
55375
  const t = sessionStorage.getItem("sessionUrlSelfService");
55376
55376
  return t ? (sessionStorage.removeItem("sessionUrlSelfService"), t) : document.referrer || "/tasks";
55377
55377
  },
55378
- loadNextAssignedTask(t = null) {
55378
+ loadNextAssignedTask(t = null, e = null) {
55379
55379
  if (t || (t = this.requestId), !this.userId)
55380
- return;
55381
- const e = window.Cypress ? "" : `&t=${Date.now()}`, r = `?user_id=${this.userId}&status=ACTIVE&process_request_id=${t}&include_sub_tasks=1${e}`;
55382
- return this.$dataProvider.getTasks(r).then((i) => {
55383
- if (this.$emit("load-data-task", i), i.data.data.length > 0) {
55384
- let a = i.data.data[0];
55385
- if (a.process_request_id !== this.requestId) {
55386
- if (this.redirecting === a.process_request_id)
55387
- return;
55388
- this.unsubscribeSocketListeners(), this.redirecting = a.process_request_id, this.$emit("redirect", a.id, !0);
55389
- return;
55390
- } else
55391
- this.emitIfTaskCompleted(t);
55392
- this.taskId = a.id, this.nodeId = a.element_id, this.loadTask();
55380
+ return !1;
55381
+ const r = window.Cypress ? "" : `&t=${Date.now()}`, i = e ? `&task_id=${encodeURIComponent(e)}` : "", a = `?user_id=${this.userId}&status=ACTIVE&process_request_id=${t}&include_sub_tasks=1${i}${r}`;
55382
+ return this.$dataProvider.getTasks(a).then((n) => {
55383
+ this.$emit("load-data-task", n);
55384
+ const s = n.data.data, o = e ? s.find(({ id: u }) => String(u) === String(e)) : s[0];
55385
+ if (o) {
55386
+ const u = this.isWebEntry && o.web_entry_available === !1;
55387
+ if (o.process_request_id !== this.requestId || u)
55388
+ return this.redirecting === o.process_request_id || (this.unsubscribeSocketListeners(), this.redirecting = o.process_request_id, this.$emit("redirect", this.isWebEntry ? o : o.id, !0)), !0;
55389
+ this.emitIfTaskCompleted(t), this.taskId = o.id, this.nodeId = o.element_id, this.loadTask();
55393
55390
  } else
55394
- this.parentRequest && ["COMPLETED", "CLOSED"].includes(this.task.process_request.status) && this.$emit("completed", this.getAllowedRequestId());
55395
- this.disabled = !1;
55391
+ !e && this.parentRequest && ["COMPLETED", "CLOSED"].includes(this.task.process_request.status) && this.$emit("completed", this.getAllowedRequestId());
55392
+ return this.disabled = !1, !!o;
55396
55393
  });
55397
55394
  },
55398
55395
  emitIfTaskCompleted(t) {
@@ -55435,20 +55432,24 @@ const dae = () => new Promise((t) => {
55435
55432
  * @param {Function} apiCall - The API call to be made.
55436
55433
  * @param {number} retries - The number of retry attempts.
55437
55434
  * @param {number} delay - The delay between retries in milliseconds.
55435
+ * @param {Function} shouldRetry - Determines whether a successful response should be retried.
55438
55436
  * @returns {Promise} - The response from the API call.
55439
55437
  */
55440
55438
  // eslint-disable-next-line consistent-return
55441
- async retryApiCall(t, e = 3, r = 1e3) {
55442
- for (let i = 0; i < e; i++)
55439
+ async retryApiCall(t, e = 3, r = 1e3, i = () => !1) {
55440
+ for (let a = 0; a < e; a++) {
55443
55441
  try {
55444
- return await t();
55445
- } catch (a) {
55446
- if (i === e - 1)
55447
- throw a;
55448
- await new Promise((n) => {
55449
- setTimeout(n, r);
55450
- });
55442
+ const n = await t();
55443
+ if (!i(n) || a === e - 1)
55444
+ return n;
55445
+ } catch (n) {
55446
+ if (a === e - 1)
55447
+ throw n;
55451
55448
  }
55449
+ await new Promise((n) => {
55450
+ setTimeout(n, r);
55451
+ });
55452
+ }
55452
55453
  },
55453
55454
  /**
55454
55455
  * Gets the next request by posting to the specified endpoint.
@@ -55647,6 +55648,26 @@ const dae = () => new Promise((t) => {
55647
55648
  this.handleDefaultRedirect(t);
55648
55649
  }
55649
55650
  },
55651
+ async handleWebEntryTaskRedirect(t, e) {
55652
+ var i, a;
55653
+ let r = !1;
55654
+ try {
55655
+ r = await this.retryApiCall(
55656
+ () => this.loadNextAssignedTask(this.requestId, e),
55657
+ 3,
55658
+ 1e3,
55659
+ (n) => n !== !0
55660
+ );
55661
+ } catch {
55662
+ r = !1;
55663
+ } finally {
55664
+ r || (this.loadingTask = !1, this.disabled = !1);
55665
+ }
55666
+ if (!r) {
55667
+ const n = ((a = (i = t == null ? void 0 : t.params) == null ? void 0 : i[0]) == null ? void 0 : a.payloadUrl) || (e ? `/tasks/${e}/edit` : `/requests/${this.requestId}`);
55668
+ window.location.href = n;
55669
+ }
55670
+ },
55650
55671
  /**
55651
55672
  * Handles the 'redirectToTask' event by loading the specified task.
55652
55673
  * Updates the current task ID and reloads the task data.
@@ -55661,6 +55682,10 @@ const dae = () => new Promise((t) => {
55661
55682
  window.location.href = await this.getDestinationUrl();
55662
55683
  return;
55663
55684
  }
55685
+ if (this.isWebEntry) {
55686
+ await this.handleWebEntryTaskRedirect(t, e);
55687
+ return;
55688
+ }
55664
55689
  this.nodeId = i, this.taskId = e, this.renderComponent === "ConversationalForm" && (window.location.href = `/tasks/${this.taskId}/edit`), this.reload();
55665
55690
  }
55666
55691
  },
@@ -55781,7 +55806,7 @@ var pae = function() {
55781
55806
  hae,
55782
55807
  !1,
55783
55808
  null,
55784
- "da3ae6f1"
55809
+ "a60832f1"
55785
55810
  );
55786
55811
  const vae = mae.exports;
55787
55812
  const gae = {