@processmaker/screen-builder 2.99.0 → 2.99.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/screen-builder",
3
- "version": "2.99.0",
3
+ "version": "2.99.1",
4
4
  "scripts": {
5
5
  "dev": "VITE_COVERAGE=true vite",
6
6
  "build": "vite build",
@@ -260,7 +260,7 @@ export default {
260
260
  this.loadNextAssignedTask();
261
261
  }
262
262
  },
263
- loadTask() {
263
+ loadTask(mounting = false) {
264
264
  if (!this.taskId) {
265
265
  return;
266
266
  }
@@ -276,7 +276,7 @@ export default {
276
276
  .getTasks(url)
277
277
  .then((response) => {
278
278
  this.task = response.data;
279
- this.linkTask();
279
+ this.linkTask(mounting);
280
280
  this.checkTaskStatus();
281
281
  if (
282
282
  window.PM4ConfigOverrides
@@ -296,12 +296,27 @@ export default {
296
296
  });
297
297
  });
298
298
  },
299
- linkTask() {
299
+ linkTask(mounting) {
300
300
  this.nodeId = this.task.element_id;
301
301
  this.listenForParentChanges();
302
302
  if (this.task.process_request.status === 'COMPLETED') {
303
303
  if (!this.taskPreview) {
304
304
  this.$emit('completed', this.task.process_request.id);
305
+ // When the process ends before the request is opened
306
+ if (mounting) {
307
+ // get end event element destination config
308
+ window.ProcessMaker.apiClient.get(`/requests/${this.requestId}/end-event-destination`)
309
+ .then((response) => {
310
+ if (!response.data?.data?.endEventDestination) {
311
+ // by default it goes to summary
312
+ window.location.href = `/requests/${this.requestId}`;
313
+ return;
314
+ }
315
+
316
+ // process the end event destination
317
+ this.processCompletedRedirect(response.data.data, this.userId, this.requestId);
318
+ });
319
+ }
305
320
  }
306
321
  }
307
322
  if (this.taskPreview && this.task.status === "CLOSED") {
@@ -978,7 +993,7 @@ export default {
978
993
  this.nodeId = this.initialNodeId;
979
994
  this.requestData = this.value;
980
995
  this.loopContext = this.initialLoopContext;
981
- this.loadTask();
996
+ this.loadTask(true);
982
997
  },
983
998
  destroyed() {
984
999
  this.unsubscribeSocketListeners();