b2m-utils 0.0.242 → 0.0.244

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/build/index.js CHANGED
@@ -972,17 +972,40 @@ var getFilteredFeesToAudit = function (_a) {
972
972
  }
973
973
  return false;
974
974
  });
975
- // Remover fees duplicadas, mantendo apenas uma ocorrência de cada feeId
976
- var seenFeeIds = new Set();
975
+ // Remover fees duplicadas, considerando feeId + intervalos de peso/km
976
+ var seenFees = new Set();
977
977
  var uniqueFees = filteredFees === null || filteredFees === void 0 ? void 0 : filteredFees.filter(function (fee) {
978
- if (fee.feeId && seenFeeIds.has(fee.feeId)) {
978
+ var _a, _b, _c, _d, _e;
979
+ // Criar chave única considerando feeId + intervalos + vehicleTypeId
980
+ var key = "".concat(fee.feeId, "_").concat((_a = fee.minWeight) !== null && _a !== void 0 ? _a : 'null', "_").concat((_b = fee.maxWeight) !== null && _b !== void 0 ? _b : 'null', "_").concat((_c = fee.minKm) !== null && _c !== void 0 ? _c : 'null', "_").concat((_d = fee.maxKm) !== null && _d !== void 0 ? _d : 'null', "_").concat((_e = fee.vehicleTypeId) !== null && _e !== void 0 ? _e : 'null');
981
+ if (seenFees.has(key)) {
979
982
  return false;
980
983
  }
981
- if (fee.feeId) {
982
- seenFeeIds.add(fee.feeId);
983
- }
984
+ seenFees.add(key);
984
985
  return true;
985
986
  });
987
+ // Garantir que ICMS sempre esteja presente
988
+ var hasIcms = uniqueFees === null || uniqueFees === void 0 ? void 0 : uniqueFees.some(function (fee) { return fee.feeId === exports.FeeEnum.ICMS; });
989
+ if (!hasIcms) {
990
+ // Adicionar ICMS com valor 0 se não existir
991
+ uniqueFees === null || uniqueFees === void 0 ? void 0 : uniqueFees.push({
992
+ id: 0,
993
+ laneId: lane.id,
994
+ feeId: exports.FeeEnum.ICMS,
995
+ value: 0,
996
+ currencyId: null,
997
+ minKm: null,
998
+ maxKm: null,
999
+ minWeight: null,
1000
+ maxWeight: null,
1001
+ vehicleTypeId: null,
1002
+ fee: {
1003
+ id: exports.FeeEnum.ICMS,
1004
+ name: 'ICMS',
1005
+ parentId: null,
1006
+ },
1007
+ });
1008
+ }
986
1009
  return uniqueFees;
987
1010
  };
988
1011
 
package/build/index.js.gz CHANGED
Binary file