@processmaker/screen-builder 3.8.29 → 3.8.30

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": "3.8.29",
3
+ "version": "3.8.30",
4
4
  "scripts": {
5
5
  "dev": "VITE_COVERAGE=true vite",
6
6
  "build": "vite build",
@@ -293,6 +293,7 @@ export default {
293
293
  .getTasks(url)
294
294
  .then((response) => {
295
295
  this.task = response.data;
296
+ this.setSelfService(this.task);
296
297
  this.linkTask(mounting);
297
298
  this.checkTaskStatus();
298
299
  if (
@@ -391,6 +392,7 @@ export default {
391
392
  }
392
393
  },
393
394
  checkTaskStatus() {
395
+ this.setSelfService(this.task);
394
396
  if (
395
397
  this.task.status == 'COMPLETED' ||
396
398
  this.task.status == 'CLOSED' ||
@@ -402,13 +404,19 @@ export default {
402
404
  }
403
405
  this.prepareTask();
404
406
  },
405
- setSelfService() {
407
+ resolveSelfService(task = this.task) {
408
+ if (task) {
409
+ return (
410
+ _.get(task, 'process_request.status') === 'ACTIVE'
411
+ && Boolean(_.get(task, 'is_self_service', false))
412
+ );
413
+ }
414
+
415
+ return Boolean(_.get(window, 'ProcessMaker.isSelfService', false));
416
+ },
417
+ setSelfService(task = this.task) {
406
418
  this.$nextTick(() => {
407
- if (window.ProcessMaker.isSelfService) {
408
- this.isSelfService = true;
409
- } else {
410
- this.isSelfService = false;
411
- }
419
+ this.isSelfService = this.resolveSelfService(task);
412
420
  });
413
421
  },
414
422
  /**
@@ -1 +0,0 @@
1
- {"version":3,"file":"worker-6b397baf.js","sources":["../node_modules/flatted/esm/index.js","../src/workers/worker.js"],"sourcesContent":["/// <reference types=\"../types/index.d.ts\" />\n\n// (c) 2020-present Andrea Giammarchi\n\nconst {parse: $parse, stringify: $stringify} = JSON;\nconst {keys} = Object;\n\nconst Primitive = String; // it could be Number\nconst primitive = 'string'; // it could be 'number'\n\nconst ignore = {};\nconst object = 'object';\n\nconst noop = (_, value) => value;\n\nconst primitives = value => (\n value instanceof Primitive ? Primitive(value) : value\n);\n\nconst Primitives = (_, value) => (\n typeof value === primitive ? new Primitive(value) : value\n);\n\nconst revive = (input, parsed, output, $) => {\n const lazy = [];\n for (let ke = keys(output), {length} = ke, y = 0; y < length; y++) {\n const k = ke[y];\n const value = output[k];\n if (value instanceof Primitive) {\n const tmp = input[value];\n if (typeof tmp === object && !parsed.has(tmp)) {\n parsed.add(tmp);\n output[k] = ignore;\n lazy.push({k, a: [input, parsed, tmp, $]});\n }\n else\n output[k] = $.call(output, k, tmp);\n }\n else if (output[k] !== ignore)\n output[k] = $.call(output, k, value);\n }\n for (let {length} = lazy, i = 0; i < length; i++) {\n const {k, a} = lazy[i];\n output[k] = $.call(output, k, revive.apply(null, a));\n }\n return output;\n};\n\nconst set = (known, input, value) => {\n const index = Primitive(input.push(value) - 1);\n known.set(value, index);\n return index;\n};\n\n/**\n * Converts a specialized flatted string into a JS value.\n * @param {string} text\n * @param {(this: any, key: string, value: any) => any} [reviver]\n * @returns {any}\n */\nexport const parse = (text, reviver) => {\n const input = $parse(text, Primitives).map(primitives);\n const value = input[0];\n const $ = reviver || noop;\n const tmp = typeof value === object && value ?\n revive(input, new Set, value, $) :\n value;\n return $.call({'': tmp}, '', tmp);\n};\n\n/**\n * Converts a JS value into a specialized flatted string.\n * @param {any} value\n * @param {((this: any, key: string, value: any) => any) | (string | number)[] | null | undefined} [replacer]\n * @param {string | number | undefined} [space]\n * @returns {string}\n */\nexport const stringify = (value, replacer, space) => {\n const $ = replacer && typeof replacer === object ?\n (k, v) => (k === '' || -1 < replacer.indexOf(k) ? v : void 0) :\n (replacer || noop);\n const known = new Map;\n const input = [];\n const output = [];\n let i = +set(known, input, $.call({'': value}, '', value));\n let firstRun = !i;\n while (i < input.length) {\n firstRun = true;\n output[i] = $stringify(input[i++], replace, space);\n }\n return '[' + output.join(',') + ']';\n function replace(key, value) {\n if (firstRun) {\n firstRun = !firstRun;\n return value;\n }\n const after = $.call(this, key, value);\n switch (typeof after) {\n case object:\n if (after === null) return after;\n case primitive:\n return known.get(after) || set(known, input, after);\n }\n return after;\n }\n};\n\n/**\n * Converts a generic value into a JSON serializable object without losing recursion.\n * @param {any} value\n * @returns {any}\n */\nexport const toJSON = value => $parse(stringify(value));\n\n/**\n * Converts a previously serialized object with recursion into a recursive one.\n * @param {any} value\n * @returns {any}\n */\nexport const fromJSON = value => parse($stringify(value));\n","// worker.js\nimport { parse } from 'flatted';\n\nself.onmessage = async function (e) {\n const { fn, dataRefs } = e.data;\n const { data, scope, parent } = parse(dataRefs);\n\n try {\n // Validate inputs\n if (!fn || typeof fn !== 'string') {\n throw new Error('Function code must be a string');\n }\n\n // Check if the code is asynchronous\n const isAsync = detectAsyncCode(fn);\n\n // If the code contains await, wrap it in an async function\n const functionBody = isAsync\n ? `return (async () => { ${fn} })();`\n : fn;\n\n // Use Function constructor with explicit parameter and body\n // eslint-disable-next-line no-new-func\n const userFunc = new Function('data', 'parent', functionBody);\n const result = isAsync ? await userFunc.apply(scope, [data, parent]) : userFunc.apply(scope, [data, parent]);\n\n self.postMessage({ result });\n } catch (error) {\n console.error('❌ Error executing handler:', error);\n\n self.postMessage({\n error: error.message || error.toString(),\n stack: error.stack\n });\n }\n};\n\nfunction detectAsyncCode(code) {\n // Remove comments and strings to avoid false positives\n const cleanCode = code\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, '') // Remove block comments\n .replace(/\\/\\/.*$/gm, '') // Remove line comments\n .replace(/\"[^\"]*\"/g, '\"\"') // Replace string content\n .replace(/'[^']*'/g, \"''\") // Replace string content\n .replace(/`[^`]*`/g, '``'); // Replace template literals\n\n // Check for async patterns\n const asyncPatterns = [\n /\\bawait\\b/, // await keyword\n /\\bPromise\\b/, // Promise constructor\n /\\bfetch\\b/, // fetch API\n /\\bsetTimeout\\b/, // setTimeout\n /\\bsetInterval\\b/, // setInterval\n /\\brequestAnimationFrame\\b/, // requestAnimationFrame\n /\\brequestIdleCallback\\b/, // requestIdleCallback\n /\\bnew\\s+Promise/, // new Promise\n /\\b\\.then\\s*\\(/, // .then() method\n /\\b\\.catch\\s*\\(/, // .catch() method\n /\\b\\.finally\\s*\\(/, // .finally() method\n /\\bPromise\\./, // Promise static methods\n /\\basync\\b/, // async keyword (in case it's used)\n ];\n\n // Check if any async pattern is found\n return asyncPatterns.some((pattern) => pattern.test(cleanCode));\n}\n"],"names":["$parse","$stringify","keys","Primitive","primitive","ignore","object","noop","_","value","primitives","Primitives","revive","input","parsed","output","$","lazy","ke","length","y","k","tmp","i","a","parse","text","reviver","e","fn","dataRefs","data","scope","parent","isAsync","detectAsyncCode","functionBody","userFunc","result","error","code","cleanCode","pattern"],"mappings":"yBAIA,KAAM,CAAC,MAAOA,EAAQ,UAAWC,CAAU,EAAI,KACzC,CAAC,KAAAC,CAAI,EAAI,OAETC,EAAY,OACZC,EAAY,SAEZC,EAAS,CAAA,EACTC,EAAS,SAETC,EAAO,CAACC,EAAGC,IAAUA,EAErBC,EAAaD,GACjBA,aAAiBN,EAAYA,EAAUM,CAAK,EAAIA,EAG5CE,EAAa,CAACH,EAAGC,IACrB,OAAOA,IAAUL,EAAY,IAAID,EAAUM,CAAK,EAAIA,EAGhDG,EAAS,CAACC,EAAOC,EAAQC,EAAQC,IAAM,CAC3C,MAAMC,EAAO,CAAA,EACb,QAASC,EAAKhB,EAAKa,CAAM,EAAG,CAAC,OAAAI,CAAM,EAAID,EAAIE,EAAI,EAAGA,EAAID,EAAQC,IAAK,CACjE,MAAMC,EAAIH,EAAGE,CAAC,EACRX,EAAQM,EAAOM,CAAC,EACtB,GAAIZ,aAAiBN,EAAW,CAC9B,MAAMmB,EAAMT,EAAMJ,CAAK,EACnB,OAAOa,IAAQhB,GAAU,CAACQ,EAAO,IAAIQ,CAAG,GAC1CR,EAAO,IAAIQ,CAAG,EACdP,EAAOM,CAAC,EAAIhB,EACZY,EAAK,KAAK,CA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