@zauru-sdk/common 2.14.1 → 2.16.0
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/CHANGELOG.md +19 -0
- package/dist/common.d.ts +3 -3
- package/dist/esm/common.js +21 -7
- package/package.json +3 -3
- package/src/common.ts +21 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.16.0](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.15.1...v2.16.0) (2025-08-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* actualizando memo recursos ([0c2cf6a](https://github.com/intuitiva/zauru-typescript-sdk/commit/0c2cf6a5d615c2e550130cccb8ce536f5c91b9c0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [2.15.1](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.15.0...v2.15.1) (2025-08-22)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @zauru-sdk/common
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [2.14.1](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.14.0...v2.14.1) (2025-08-13)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @zauru-sdk/common
|
package/dist/common.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import "moment-timezone";
|
|
|
2
2
|
import type { PayeeGraphQL, AxiosUtilsResponse, BasketSchema, SelectFieldOption } from "@zauru-sdk/types";
|
|
3
3
|
export declare const DESTINOS_MUESTRA_OPTIONS: SelectFieldOption[];
|
|
4
4
|
/**
|
|
5
|
-
* Obtener el objeto de canastas en base al
|
|
6
|
-
* @param
|
|
5
|
+
* Obtener el objeto de canastas en base al memo
|
|
6
|
+
* @param memo
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
export declare const getBasketsSchema: (
|
|
9
|
+
export declare const getBasketsSchema: (memo: string) => BasketSchema[];
|
|
10
10
|
export declare function generateClientUUID(): string;
|
|
11
11
|
/**
|
|
12
12
|
* extractValueBetweenTags
|
package/dist/esm/common.js
CHANGED
|
@@ -29,16 +29,30 @@ exports.DESTINOS_MUESTRA_OPTIONS = [
|
|
|
29
29
|
{ label: "Residuos de plaguicidas", value: "residuos_de_plaguicidas" },
|
|
30
30
|
];
|
|
31
31
|
moment_1.default.locale("es");
|
|
32
|
+
// Helper function to parse JSON memo safely
|
|
33
|
+
const parseJsonMemo = (memo) => {
|
|
34
|
+
if (!memo)
|
|
35
|
+
return {};
|
|
36
|
+
try {
|
|
37
|
+
return JSON.parse(memo);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.log("Error parsing memo JSON:", error);
|
|
41
|
+
return {
|
|
42
|
+
qualityControlBaskets: memo.split(","),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
};
|
|
32
46
|
/**
|
|
33
|
-
* Obtener el objeto de canastas en base al
|
|
34
|
-
* @param
|
|
47
|
+
* Obtener el objeto de canastas en base al memo
|
|
48
|
+
* @param memo
|
|
35
49
|
* @returns
|
|
36
50
|
*/
|
|
37
|
-
const getBasketsSchema = (
|
|
51
|
+
const getBasketsSchema = (memo) => {
|
|
38
52
|
//Sacar conteo de canastas y su descripción de colores
|
|
39
|
-
//ejemplo: vienen en un campo así: 8-53311-VERDE,3-53315-ROSADA,4-53313-ROJA
|
|
40
|
-
const
|
|
41
|
-
const baskets =
|
|
53
|
+
//ejemplo: vienen en un campo así: ["8-53311-VERDE","3-53315-ROSADA","4-53313-ROJA"]
|
|
54
|
+
const jsonMemo = parseJsonMemo(memo);
|
|
55
|
+
const baskets = jsonMemo.qualityControlBaskets?.map((splited) => {
|
|
42
56
|
const values = splited.split("-");
|
|
43
57
|
return {
|
|
44
58
|
total: Number(values[0]) ?? 0,
|
|
@@ -46,7 +60,7 @@ const getBasketsSchema = (basketsString) => {
|
|
|
46
60
|
color: values[2] ?? "Sin Canasta",
|
|
47
61
|
};
|
|
48
62
|
});
|
|
49
|
-
return baskets;
|
|
63
|
+
return baskets ?? [];
|
|
50
64
|
};
|
|
51
65
|
exports.getBasketsSchema = getBasketsSchema;
|
|
52
66
|
function generateClientUUID() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/common",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.0",
|
|
4
4
|
"description": "Funciones de uso común en el desarrollo de webapps en Zauru",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@remix-run/node": "^2.8.1",
|
|
23
|
-
"@zauru-sdk/types": "^2.
|
|
23
|
+
"@zauru-sdk/types": "^2.16.0",
|
|
24
24
|
"moment": "^2.30.1",
|
|
25
25
|
"moment-timezone": "^0.5.45"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "fde982ba8b3b70f9aea45e44e9a65ba31428a6dd"
|
|
28
28
|
}
|
package/src/common.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
BasketSchema,
|
|
7
7
|
SelectFieldOption,
|
|
8
8
|
MonthsType,
|
|
9
|
+
JsonMemoType,
|
|
9
10
|
} from "@zauru-sdk/types";
|
|
10
11
|
import { MONTHS } from "@zauru-sdk/types";
|
|
11
12
|
|
|
@@ -16,16 +17,29 @@ export const DESTINOS_MUESTRA_OPTIONS: SelectFieldOption[] = [
|
|
|
16
17
|
|
|
17
18
|
moment.locale("es");
|
|
18
19
|
|
|
20
|
+
// Helper function to parse JSON memo safely
|
|
21
|
+
const parseJsonMemo = (memo?: string): JsonMemoType => {
|
|
22
|
+
if (!memo) return {};
|
|
23
|
+
try {
|
|
24
|
+
return JSON.parse(memo);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.log("Error parsing memo JSON:", error);
|
|
27
|
+
return {
|
|
28
|
+
qualityControlBaskets: memo.split(","),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
19
33
|
/**
|
|
20
|
-
* Obtener el objeto de canastas en base al
|
|
21
|
-
* @param
|
|
34
|
+
* Obtener el objeto de canastas en base al memo
|
|
35
|
+
* @param memo
|
|
22
36
|
* @returns
|
|
23
37
|
*/
|
|
24
|
-
export const getBasketsSchema = (
|
|
38
|
+
export const getBasketsSchema = (memo: string): BasketSchema[] => {
|
|
25
39
|
//Sacar conteo de canastas y su descripción de colores
|
|
26
|
-
//ejemplo: vienen en un campo así: 8-53311-VERDE,3-53315-ROSADA,4-53313-ROJA
|
|
27
|
-
const
|
|
28
|
-
const baskets =
|
|
40
|
+
//ejemplo: vienen en un campo así: ["8-53311-VERDE","3-53315-ROSADA","4-53313-ROJA"]
|
|
41
|
+
const jsonMemo = parseJsonMemo(memo);
|
|
42
|
+
const baskets = jsonMemo.qualityControlBaskets?.map((splited: string) => {
|
|
29
43
|
const values = splited.split("-");
|
|
30
44
|
return {
|
|
31
45
|
total: Number(values[0]) ?? 0,
|
|
@@ -34,7 +48,7 @@ export const getBasketsSchema = (basketsString: string): BasketSchema[] => {
|
|
|
34
48
|
} as BasketSchema;
|
|
35
49
|
});
|
|
36
50
|
|
|
37
|
-
return baskets;
|
|
51
|
+
return baskets ?? [];
|
|
38
52
|
};
|
|
39
53
|
|
|
40
54
|
export function generateClientUUID() {
|