@processmaker/screen-builder 2.99.0 → 2.99.2

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.2",
4
4
  "scripts": {
5
5
  "dev": "VITE_COVERAGE=true vite",
6
6
  "build": "vite build",
@@ -56,7 +56,7 @@
56
56
  "@fortawesome/fontawesome-free": "^5.6.1",
57
57
  "@originjs/vite-plugin-commonjs": "^1.0.3",
58
58
  "@panter/vue-i18next": "^0.15.2",
59
- "@processmaker/vue-form-elements": "0.59.0",
59
+ "@processmaker/vue-form-elements": "0.60.0",
60
60
  "@processmaker/vue-multiselect": "2.3.0",
61
61
  "@storybook/addon-essentials": "^7.6.13",
62
62
  "@storybook/addon-interactions": "^7.6.13",
@@ -115,7 +115,7 @@
115
115
  },
116
116
  "peerDependencies": {
117
117
  "@panter/vue-i18next": "^0.15.0",
118
- "@processmaker/vue-form-elements": "0.59.0",
118
+ "@processmaker/vue-form-elements": "0.60.0",
119
119
  "i18next": "^15.0.8",
120
120
  "vue": "^2.6.12",
121
121
  "vuex": "^3.1.1"
@@ -81,16 +81,26 @@ export default {
81
81
  const hasIncludeScreen = params.match(/include=.*,screen,/);
82
82
  const hasIncludeNested = params.match(/include=.*,nested,/);
83
83
 
84
+ // Extract screen_version from params.
85
+ const screenVersionMatch = params.match(/screen_version=([^&]+)/);
86
+ const screenVersion = screenVersionMatch ? screenVersionMatch[1] : null;
87
+
84
88
  // remove params ?...
85
89
  promises.push(
86
90
  this.get(endpoint + params.replace(/,screen,|,nested,/g, ","))
87
91
  );
88
92
  // Get the screen from a separated cached endpoint
89
93
  if (hasIncludeScreen) {
90
- const screenEndpoint = `${(endpoint + params).replace(
94
+ let screenEndpoint = `${(endpoint + params).replace(
91
95
  /\?.+$/,
92
96
  ""
93
97
  )}/screen?include=screen${hasIncludeNested ? ",nested" : ""}`;
98
+
99
+ // Append screen_version only if screenVersion is not empty.
100
+ if (screenVersion) {
101
+ screenEndpoint += `&screen_version=${screenVersion}`;
102
+ }
103
+
94
104
  promises.push(this.get(screenEndpoint));
95
105
  }
96
106
  // Await for both promises to resolve
@@ -94,6 +94,7 @@ export default {
94
94
  initialRequestId: { type: Number, default: null },
95
95
  initialProcessId: { type: Number, default: null },
96
96
  initialNodeId: { type: String, default: null },
97
+ screenVersion: { type: Number, default: null },
97
98
  userId: { type: Number, default: null },
98
99
  csrfToken: { type: String, default: null },
99
100
  value: { type: Object, default: () => {} },
@@ -260,12 +261,17 @@ export default {
260
261
  this.loadNextAssignedTask();
261
262
  }
262
263
  },
263
- loadTask() {
264
+ loadTask(mounting = false) {
264
265
  if (!this.taskId) {
265
266
  return;
266
267
  }
267
268
 
268
- const url = `/${this.taskId}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission,elementDestination`;
269
+ let url = `/${this.taskId}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission,elementDestination`;
270
+
271
+ if (this.screenVersion) {
272
+ url += `&screen_version=${this.screenVersion}`;
273
+ }
274
+
269
275
  // For Vocabularies
270
276
  if (window.ProcessMaker && window.ProcessMaker.packages && window.ProcessMaker.packages.includes('package-vocabularies')) {
271
277
  window.ProcessMaker.VocabulariesSchemaUrl = `vocabularies/task_schema/${this.taskId}`;
@@ -276,7 +282,7 @@ export default {
276
282
  .getTasks(url)
277
283
  .then((response) => {
278
284
  this.task = response.data;
279
- this.linkTask();
285
+ this.linkTask(mounting);
280
286
  this.checkTaskStatus();
281
287
  if (
282
288
  window.PM4ConfigOverrides
@@ -296,12 +302,27 @@ export default {
296
302
  });
297
303
  });
298
304
  },
299
- linkTask() {
305
+ linkTask(mounting) {
300
306
  this.nodeId = this.task.element_id;
301
307
  this.listenForParentChanges();
302
308
  if (this.task.process_request.status === 'COMPLETED') {
303
309
  if (!this.taskPreview) {
304
310
  this.$emit('completed', this.task.process_request.id);
311
+ // When the process ends before the request is opened
312
+ if (mounting) {
313
+ // get end event element destination config
314
+ window.ProcessMaker.apiClient.get(`/requests/${this.requestId}/end-event-destination`)
315
+ .then((response) => {
316
+ if (!response.data?.data?.endEventDestination) {
317
+ // by default it goes to summary
318
+ window.location.href = `/requests/${this.requestId}`;
319
+ return;
320
+ }
321
+
322
+ // process the end event destination
323
+ this.processCompletedRedirect(response.data.data, this.userId, this.requestId);
324
+ });
325
+ }
305
326
  }
306
327
  }
307
328
  if (this.taskPreview && this.task.status === "CLOSED") {
@@ -517,6 +538,7 @@ export default {
517
538
  } else if (this.parentRequest && ['COMPLETED', 'CLOSED'].includes(this.task.process_request.status)) {
518
539
  this.$emit('completed', this.getAllowedRequestId());
519
540
  }
541
+ this.disabled = false;
520
542
  });
521
543
  },
522
544
  emitIfTaskCompleted(requestId) {
@@ -978,7 +1000,7 @@ export default {
978
1000
  this.nodeId = this.initialNodeId;
979
1001
  this.requestData = this.value;
980
1002
  this.loopContext = this.initialLoopContext;
981
- this.loadTask();
1003
+ this.loadTask(true);
982
1004
  },
983
1005
  destroyed() {
984
1006
  this.unsubscribeSocketListeners();