@zauru-sdk/services 2.0.198 → 2.0.200
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.
|
@@ -95,6 +95,20 @@ export async function closeCase(headers, id) {
|
|
|
95
95
|
return true;
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* sendCaseEmail
|
|
100
|
+
* @param headers
|
|
101
|
+
* @param id
|
|
102
|
+
* @returns
|
|
103
|
+
*/
|
|
104
|
+
export async function sendCaseEmail(headers, id) {
|
|
105
|
+
return handlePossibleAxiosErrors(async () => {
|
|
106
|
+
await httpZauru.get(`/support/cases/${id}/send_email.json`, {
|
|
107
|
+
headers,
|
|
108
|
+
});
|
|
109
|
+
return true;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
98
112
|
//==============================================
|
|
99
113
|
//======= ENDPOINTS DE POS/CASES
|
|
100
114
|
//==============================================
|
|
@@ -239,8 +239,17 @@ export async function getInvoiceFormSubmissionsByInvoiceId(headersZauru, session
|
|
|
239
239
|
throw new Error(response.data.errors.map((x) => x.message).join(";"));
|
|
240
240
|
}
|
|
241
241
|
let registers = response?.data?.data?.submission_invoices;
|
|
242
|
+
// Filtrar los registros para obtener sólo los de la versión más alta.
|
|
243
|
+
const groupedByVersion = registers.reduce((acc, record) => {
|
|
244
|
+
const zid = record.settings_form_submission.zid;
|
|
245
|
+
if (!acc[zid]) {
|
|
246
|
+
acc[zid] = record;
|
|
247
|
+
}
|
|
248
|
+
return acc;
|
|
249
|
+
}, {});
|
|
250
|
+
let latestVersionRecords = Object.values(groupedByVersion).reverse();
|
|
242
251
|
if (withFiles) {
|
|
243
|
-
|
|
252
|
+
latestVersionRecords = await Promise.all(latestVersionRecords.map(async (register) => {
|
|
244
253
|
try {
|
|
245
254
|
const responseZauru = await httpZauru.get(`/settings/forms/form_submissions/${register.settings_form_submission.id}.json`, {
|
|
246
255
|
headers: headersZauru,
|
|
@@ -264,15 +273,6 @@ export async function getInvoiceFormSubmissionsByInvoiceId(headersZauru, session
|
|
|
264
273
|
}
|
|
265
274
|
}));
|
|
266
275
|
}
|
|
267
|
-
// Filtrar los registros para obtener sólo los de la versión más alta.
|
|
268
|
-
const groupedByVersion = registers.reduce((acc, record) => {
|
|
269
|
-
const zid = record.settings_form_submission.zid;
|
|
270
|
-
if (!acc[zid]) {
|
|
271
|
-
acc[zid] = record;
|
|
272
|
-
}
|
|
273
|
-
return acc;
|
|
274
|
-
}, {});
|
|
275
|
-
const latestVersionRecords = Object.values(groupedByVersion).reverse();
|
|
276
276
|
return latestVersionRecords;
|
|
277
277
|
});
|
|
278
278
|
}
|
|
@@ -290,8 +290,17 @@ export async function getCaseFormSubmissionsByCaseId(headersZauru, session, case
|
|
|
290
290
|
throw new Error(response.data.errors.map((x) => x.message).join(";"));
|
|
291
291
|
}
|
|
292
292
|
let registers = response?.data?.data?.submission_cases;
|
|
293
|
+
// Filtrar los registros para obtener sólo los de la versión más alta.
|
|
294
|
+
const groupedByVersion = registers.reduce((acc, record) => {
|
|
295
|
+
const zid = record.settings_form_submission.zid;
|
|
296
|
+
if (!acc[zid]) {
|
|
297
|
+
acc[zid] = record;
|
|
298
|
+
}
|
|
299
|
+
return acc;
|
|
300
|
+
}, {});
|
|
301
|
+
let latestVersionRecords = Object.values(groupedByVersion).reverse();
|
|
293
302
|
if (withFiles) {
|
|
294
|
-
|
|
303
|
+
latestVersionRecords = await Promise.all(latestVersionRecords.map(async (register) => {
|
|
295
304
|
try {
|
|
296
305
|
const responseZauru = await httpZauru.get(`/settings/forms/form_submissions/${register.settings_form_submission.id}.json`, {
|
|
297
306
|
headers: headersZauru,
|
|
@@ -315,15 +324,6 @@ export async function getCaseFormSubmissionsByCaseId(headersZauru, session, case
|
|
|
315
324
|
}
|
|
316
325
|
}));
|
|
317
326
|
}
|
|
318
|
-
// Filtrar los registros para obtener sólo los de la versión más alta.
|
|
319
|
-
const groupedByVersion = registers.reduce((acc, record) => {
|
|
320
|
-
const zid = record.settings_form_submission.zid;
|
|
321
|
-
if (!acc[zid]) {
|
|
322
|
-
acc[zid] = record;
|
|
323
|
-
}
|
|
324
|
-
return acc;
|
|
325
|
-
}, {});
|
|
326
|
-
const latestVersionRecords = Object.values(groupedByVersion).reverse();
|
|
327
327
|
return latestVersionRecords;
|
|
328
328
|
});
|
|
329
329
|
}
|
|
@@ -38,6 +38,13 @@ export declare function deleteCase(headers: any, id: string | number): Promise<A
|
|
|
38
38
|
* @returns
|
|
39
39
|
*/
|
|
40
40
|
export declare function closeCase(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
|
|
41
|
+
/**
|
|
42
|
+
* sendCaseEmail
|
|
43
|
+
* @param headers
|
|
44
|
+
* @param id
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
export declare function sendCaseEmail(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
|
|
41
48
|
/**
|
|
42
49
|
* createPOSCase
|
|
43
50
|
* @param headers
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/services",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.200",
|
|
4
4
|
"description": "Servicios de consulta a Zauru",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"axios": "^1.6.7",
|
|
33
33
|
"chalk": "5.3.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "03df85eff31f6d868ffd76806e59b32e214a821e"
|
|
36
36
|
}
|