@zauru-sdk/utils 2.0.200 → 2.0.202

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.
@@ -22,24 +22,32 @@ export function transformFormSubmitObject(input) {
22
22
  groups_path: "[]",
23
23
  value: "",
24
24
  };
25
- if (input[key] instanceof File) {
26
- const fileType = input[key].type;
27
- if (input[key]?.size > 0) {
28
- // Verifica si el archivo es una imagen
25
+ // Verifica si se ha enviado un archivo (tipo File o signed_id acompañado de file_type)
26
+ if (input[key] instanceof File ||
27
+ (typeof input[key] === "string" && input[`${key}_file_type`])) {
28
+ if ((input[key] instanceof File && input[key]?.size > 0) ||
29
+ (typeof input[key] === "string" && input[`${key}_file_type`])) {
30
+ // Determina el tipo usando ya sea el file original o el file_type enviado
31
+ const fileType = input[key] instanceof File
32
+ ? input[key].type
33
+ : input[`${key}_file_type`];
34
+ // Si es imagen
29
35
  if (fileType.startsWith("image/")) {
30
36
  newObj["image"] = input[key];
31
37
  }
32
- // Verifica si el archivo es un PDF
38
+ // Si es PDF
33
39
  else if (fileType === "application/pdf") {
34
40
  newObj["pdf"] = input[key];
35
41
  }
36
- // Cualquier otro tipo de archivo
42
+ // Para otros tipos de archivo
37
43
  else {
38
44
  newObj["file"] = input[key];
39
45
  }
46
+ delete newObj.value;
40
47
  }
41
48
  }
42
49
  else if (isJsonArray(input[key])) {
50
+ // Manejo de JSON array (para tablas, etc.)
43
51
  const tableJsonArray = JSON.parse(input[key]);
44
52
  if (tableJsonArray.length > 0) {
45
53
  const form_table_values_attributes = [];
@@ -61,6 +69,7 @@ export function transformFormSubmitObject(input) {
61
69
  }
62
70
  }
63
71
  else {
72
+ // Para otros valores simples
64
73
  newObj["value"] = input[key];
65
74
  }
66
75
  form_submission_values.push(newObj);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/utils",
3
- "version": "2.0.200",
3
+ "version": "2.0.202",
4
4
  "description": "Utilidades, parseo de request y demás para desarrollo de webapps de Zauru",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -27,8 +27,8 @@
27
27
  "@zauru-sdk/common": "^2.0.198",
28
28
  "@zauru-sdk/config": "^2.0.100",
29
29
  "@zauru-sdk/graphql": "^2.0.195",
30
- "@zauru-sdk/services": "^2.0.200",
30
+ "@zauru-sdk/services": "^2.0.202",
31
31
  "@zauru-sdk/types": "^2.0.197"
32
32
  },
33
- "gitHead": "03df85eff31f6d868ffd76806e59b32e214a821e"
33
+ "gitHead": "02024107088737551a72e04666cfd3d297547c95"
34
34
  }