cardus 0.0.97 → 0.0.98

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,12 +307,7 @@ 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
- 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);
310
+ //let grouped = Number(group?.grouped === 1);
316
311
  const createBultoFromLine = (_b) => __awaiter(this, [_b], void 0, function* ({ line, idEnvioTemporal, shouldGroup }) {
317
312
  const result = yield crearBulto({
318
313
  lineItems: { idEnvioTemporal, line },
@@ -334,11 +329,7 @@ class IntegrationManager {
334
329
  orders.forEach(({ idEnvioTemporal, lineas }) => {
335
330
  if (!idEnvioTemporal)
336
331
  return;
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);
332
+ const shouldGroup = (group === null || group === void 0 ? void 0 : group.grouped) === 1 && lineas.length > 1;
342
333
  if (shouldGroup) {
343
334
  this.insertTempShipmentGroupLine({ idEnvioTemporal, group });
344
335
  }
@@ -394,13 +385,18 @@ class IntegrationManager {
394
385
  });
395
386
  }
396
387
  if (!shouldGroup && !forzarAgrupamientoDeLinea) {
397
- const arrayFake = Array.from({ length: Number(cantidad) });
398
- arrayFake.forEach(() => {
399
- this.dataToInsert.lines.push({
400
- id_envio: idEnvioTemporal,
401
- bulto
388
+ if ((group === null || group === void 0 ? void 0 : group.grouped) === 1 && Number(cantidad) > 1) {
389
+ this.insertTempShipmentGroupLine({ idEnvioTemporal, group });
390
+ }
391
+ else {
392
+ const arrayFake = Array.from({ length: Number(cantidad) });
393
+ arrayFake.forEach(() => {
394
+ this.dataToInsert.lines.push({
395
+ id_envio: idEnvioTemporal,
396
+ bulto
397
+ });
402
398
  });
403
- });
399
+ }
404
400
  }
405
401
  }
406
402
  catch (e) {
package/index.ts CHANGED
@@ -523,16 +523,7 @@ 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
- 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;
526
+ //let grouped = Number(group?.grouped === 1);
536
527
 
537
528
  const createBultoFromLine = async ({
538
529
  line,
@@ -566,12 +557,7 @@ export class IntegrationManager {
566
557
  orders.forEach(({ idEnvioTemporal, lineas }) => {
567
558
  if (!idEnvioTemporal) return;
568
559
 
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);
560
+ const shouldGroup = group?.grouped === 1 && lineas.length > 1;
575
561
 
576
562
  if (shouldGroup) {
577
563
  this.insertTempShipmentGroupLine({ idEnvioTemporal, group });
@@ -647,14 +633,18 @@ export class IntegrationManager {
647
633
  }
648
634
 
649
635
  if (!shouldGroup && !forzarAgrupamientoDeLinea) {
650
- const arrayFake = Array.from({ length: Number(cantidad) });
651
-
652
- arrayFake.forEach(() => {
653
- this.dataToInsert.lines.push({
654
- id_envio: idEnvioTemporal,
655
- bulto
636
+ if (group?.grouped === 1 && Number(cantidad) > 1) {
637
+ this.insertTempShipmentGroupLine({ idEnvioTemporal, group });
638
+ } else {
639
+ const arrayFake = Array.from({ length: Number(cantidad) });
640
+
641
+ arrayFake.forEach(() => {
642
+ this.dataToInsert.lines.push({
643
+ id_envio: idEnvioTemporal,
644
+ bulto
645
+ });
656
646
  });
657
- });
647
+ }
658
648
  }
659
649
  } catch (e) {
660
650
  console.log(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cardus",
3
- "version": "0.0.97",
3
+ "version": "0.0.98",
4
4
  "description": "an integration manager",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/types/index.ts CHANGED
@@ -269,7 +269,6 @@ export type IntegrationsService = {
269
269
  id_integracion: number;
270
270
  }) => Promise<{
271
271
  sku_almacen: 0 | 1;
272
- dimensiones_medidas_configuradas: 0 | 1;
273
272
  }>;
274
273
  };
275
274