cardus 0.0.98 → 0.0.99

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/dist/index.js CHANGED
@@ -307,7 +307,12 @@ class IntegrationManager {
307
307
  2 - si "forzarAgrupamientoDeLinea" es true, se crea una linea por cada linea
308
308
  3- si NO esta agrupado y "forzarAgrupamientoDeLinea" NO es true, se crea una linea por cada unidad de cada linea
309
309
  */
310
- //let grouped = Number(group?.grouped === 1);
310
+ const { integrationsService } = this.services;
311
+ const userIntegrationConfiguration = yield integrationsService.getDefaultIntegrationsData({
312
+ id_usuario: idUsuario,
313
+ id_integracion: this.integrationType
314
+ });
315
+ const measuresFromConfig = !!(userIntegrationConfiguration === null || userIntegrationConfiguration === void 0 ? void 0 : userIntegrationConfiguration.dimensiones_medidas_configuradas);
311
316
  const createBultoFromLine = (_b) => __awaiter(this, [_b], void 0, function* ({ line, idEnvioTemporal, shouldGroup }) {
312
317
  const result = yield crearBulto({
313
318
  lineItems: { idEnvioTemporal, line },
@@ -329,7 +334,11 @@ class IntegrationManager {
329
334
  orders.forEach(({ idEnvioTemporal, lineas }) => {
330
335
  if (!idEnvioTemporal)
331
336
  return;
332
- const shouldGroup = (group === null || group === void 0 ? void 0 : group.grouped) === 1 && lineas.length > 1;
337
+ // Debe agrupar si:
338
+ // 1. grouped es 1 + hay más de una línea
339
+ // 2. grouped es 1 + hay una línea + configuración integraciones tiene el campo dimensiones_medidas_configuradas a 1
340
+ const shouldGroup = ((group === null || group === void 0 ? void 0 : group.grouped) === 1 && lineas.length > 1) ||
341
+ ((group === null || group === void 0 ? void 0 : group.grouped) === 1 && lineas.length === 1 && measuresFromConfig);
333
342
  if (shouldGroup) {
334
343
  this.insertTempShipmentGroupLine({ idEnvioTemporal, group });
335
344
  }
package/index.ts CHANGED
@@ -523,7 +523,16 @@ export class IntegrationManager {
523
523
  3- si NO esta agrupado y "forzarAgrupamientoDeLinea" NO es true, se crea una linea por cada unidad de cada linea
524
524
  */
525
525
 
526
- //let grouped = Number(group?.grouped === 1);
526
+ const { integrationsService } = this.services;
527
+
528
+ const userIntegrationConfiguration =
529
+ await integrationsService.getDefaultIntegrationsData({
530
+ id_usuario: idUsuario,
531
+ id_integracion: this.integrationType
532
+ });
533
+
534
+ const measuresFromConfig =
535
+ !!userIntegrationConfiguration?.dimensiones_medidas_configuradas;
527
536
 
528
537
  const createBultoFromLine = async ({
529
538
  line,
@@ -557,7 +566,12 @@ export class IntegrationManager {
557
566
  orders.forEach(({ idEnvioTemporal, lineas }) => {
558
567
  if (!idEnvioTemporal) return;
559
568
 
560
- const shouldGroup = group?.grouped === 1 && lineas.length > 1;
569
+ // Debe agrupar si:
570
+ // 1. grouped es 1 + hay más de una línea
571
+ // 2. grouped es 1 + hay una línea + configuración integraciones tiene el campo dimensiones_medidas_configuradas a 1
572
+ const shouldGroup =
573
+ (group?.grouped === 1 && lineas.length > 1) ||
574
+ (group?.grouped === 1 && lineas.length === 1 && measuresFromConfig);
561
575
 
562
576
  if (shouldGroup) {
563
577
  this.insertTempShipmentGroupLine({ idEnvioTemporal, group });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cardus",
3
- "version": "0.0.98",
3
+ "version": "0.0.99",
4
4
  "description": "an integration manager",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/types/index.ts CHANGED
@@ -269,6 +269,7 @@ export type IntegrationsService = {
269
269
  id_integracion: number;
270
270
  }) => Promise<{
271
271
  sku_almacen: 0 | 1;
272
+ dimensiones_medidas_configuradas: 0 | 1;
272
273
  }>;
273
274
  };
274
275