@topconsultnpm/sdkui-react 6.21.0-dev5.9 → 6.21.0-dev6.3

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.
@@ -1,6 +1,7 @@
1
1
  import { ArrowSymbol, DiagramItemTypes } from './interfaces';
2
2
  import { CultureIDs, Severities, WFAppTypes, WorkItemSetRules, WorkItemStatus } from '@topconsultnpm/sdk-ts';
3
3
  import { parseQueryDescriptorXml, serializeQueryDescriptorXml } from './queryDescriptorParser'; // Import the new parser
4
+ import { generateUUID } from '../../../../helper/helpers';
4
5
  import { parseMetadataValuesXml, serializeMetadataValuesToXml } from './metadataParser';
5
6
  // Funzione helper per escapare i caratteri XML speciali (necessaria per i campi stringa)
6
7
  const escapeXml = (unsafe) => {
@@ -293,7 +294,7 @@ export const parseWfDiagramXml = (xmlString) => {
293
294
  // Parsing Connections
294
295
  const connectionsXML = rootElement.querySelectorAll("Connections > Connection");
295
296
  connectionsXML.forEach((connectionXML) => {
296
- const connectionId = connectionXML.querySelector("ID")?.textContent || crypto.randomUUID();
297
+ const connectionId = connectionXML.querySelector("ID")?.textContent || generateUUID();
297
298
  // Leggi il valore numerico di OutputStatus dall'XML
298
299
  const xmlOutputStatus = parseInt(connectionXML.querySelector("OutputStatus")?.textContent || "0", 10);
299
300
  const connection = {
@@ -16,6 +16,9 @@ declare const getColor: (color: ColorsType) => string;
16
16
  /**
17
17
  * Genera un Universally Unique Identifier (UUID) versione 4.
18
18
  * Simile a Guid.NewGuid() in C#.
19
+ * Usa crypto.randomUUID() quando disponibile (HTTPS / localhost) e ricade
20
+ * su crypto.getRandomValues() — disponibile anche in contesti non sicuri (HTTP) —
21
+ * cosi funziona indipendentemente dal protocollo, senza dipendenze esterne.
19
22
  * @returns {string} Un UUID in formato stringa.
20
23
  */
21
24
  export declare const generateUUID: () => string;
@@ -103,10 +103,29 @@ const getColor = (color) => {
103
103
  /**
104
104
  * Genera un Universally Unique Identifier (UUID) versione 4.
105
105
  * Simile a Guid.NewGuid() in C#.
106
+ * Usa crypto.randomUUID() quando disponibile (HTTPS / localhost) e ricade
107
+ * su crypto.getRandomValues() — disponibile anche in contesti non sicuri (HTTP) —
108
+ * cosi funziona indipendentemente dal protocollo, senza dipendenze esterne.
106
109
  * @returns {string} Un UUID in formato stringa.
107
110
  */
108
111
  export const generateUUID = () => {
109
- return crypto.randomUUID();
112
+ // 1) Nativo: disponibile solo in secure context (HTTPS o localhost)
113
+ if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
114
+ return crypto.randomUUID();
115
+ }
116
+ // 2) Fallback crittografico, funziona anche in HTTP
117
+ if (typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function') {
118
+ const b = crypto.getRandomValues(new Uint8Array(16));
119
+ b[6] = (b[6] & 0x0f) | 0x40; // versione 4
120
+ b[8] = (b[8] & 0x3f) | 0x80; // variante 10xx
121
+ const h = Array.from(b, x => x.toString(16).padStart(2, '0'));
122
+ return `${h[0]}${h[1]}${h[2]}${h[3]}-${h[4]}${h[5]}-${h[6]}${h[7]}-${h[8]}${h[9]}-${h.slice(10).join('')}`;
123
+ }
124
+ // 3) Ultima spiaggia (ambienti senza Web Crypto)
125
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
126
+ const r = (Math.random() * 16) | 0;
127
+ return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
128
+ });
110
129
  };
111
130
  const makeID = (length) => {
112
131
  let result = '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.21.0-dev5.9",
3
+ "version": "6.21.0-dev6.3",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -39,7 +39,7 @@
39
39
  "lib"
40
40
  ],
41
41
  "dependencies": {
42
- "@topconsultnpm/sdk-ts": "6.21.0-dev5.3",
42
+ "@topconsultnpm/sdk-ts": "6.21.0-dev6.3",
43
43
  "@zip.js/zip.js": "2.8.26",
44
44
  "buffer": "^6.0.3",
45
45
  "devextreme": "^25.2.6",