b2m-utils 0.0.219 → 0.0.220

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.
@@ -12,6 +12,7 @@ export declare enum FeeEnum {
12
12
  COLLECT_COMMODITY_VALUE = 136,
13
13
  TDA_MIN = 141,
14
14
  TDA_FREIGHT = 142,
15
+ FREIGHT_RODO_FIXED_VALUE = 143,
15
16
  COLLECT = 151,
16
17
  COLLECT_PERCENTAGE_TOTAL = 152,
17
18
  COLLECT_REVERSE_PERCENTAGE_TOTAL = 153
@@ -125,6 +125,7 @@ var FeeEnum;
125
125
  FeeEnum[FeeEnum["COLLECT_COMMODITY_VALUE"] = 136] = "COLLECT_COMMODITY_VALUE";
126
126
  FeeEnum[FeeEnum["TDA_MIN"] = 141] = "TDA_MIN";
127
127
  FeeEnum[FeeEnum["TDA_FREIGHT"] = 142] = "TDA_FREIGHT";
128
+ FeeEnum[FeeEnum["FREIGHT_RODO_FIXED_VALUE"] = 143] = "FREIGHT_RODO_FIXED_VALUE";
128
129
  FeeEnum[FeeEnum["COLLECT"] = 151] = "COLLECT";
129
130
  FeeEnum[FeeEnum["COLLECT_PERCENTAGE_TOTAL"] = 152] = "COLLECT_PERCENTAGE_TOTAL";
130
131
  FeeEnum[FeeEnum["COLLECT_REVERSE_PERCENTAGE_TOTAL"] = 153] = "COLLECT_REVERSE_PERCENTAGE_TOTAL";
@@ -7090,7 +7091,7 @@ var getCteDateRange = function (ctes) {
7090
7091
  var getFilteredFeesToAudit = function (_a) {
7091
7092
  var _b;
7092
7093
  var lane = _a.lane, ratecard = _a.ratecard, cte = _a.cte;
7093
- return (_b = lane === null || lane === void 0 ? void 0 : lane.RatecardLaneFee) === null || _b === void 0 ? void 0 : _b.filter(function (i) {
7094
+ var filteredFees = (_b = lane === null || lane === void 0 ? void 0 : lane.RatecardLaneFee) === null || _b === void 0 ? void 0 : _b.filter(function (i) {
7094
7095
  var _a, _b, _c, _d, _e;
7095
7096
  var defaultConditionalFees = [
7096
7097
  FeeEnum.SUFRAMA,
@@ -7135,7 +7136,16 @@ var getFilteredFeesToAudit = function (_a) {
7135
7136
  return state_1.value;
7136
7137
  }
7137
7138
  }
7138
- if (i.minWeight) {
7139
+ if (i.minKm !== null && i.minKm !== undefined) {
7140
+ if (cte === null || cte === void 0 ? void 0 : cte.distance) {
7141
+ var distanceInRange = +cte.distance >= +i.minKm && (!i.maxKm || +cte.distance <= +i.maxKm);
7142
+ var vehicleTypeMatches = !i.vehicleTypeId || cte.vehicleTypeId === i.vehicleTypeId;
7143
+ if (distanceInRange && vehicleTypeMatches) {
7144
+ return true;
7145
+ }
7146
+ }
7147
+ }
7148
+ else if (i.minWeight) {
7139
7149
  if (cte === null || cte === void 0 ? void 0 : cte.taxedWeight) {
7140
7150
  if (Math.ceil(+cte.taxedWeight) >= +i.minWeight) {
7141
7151
  if (Math.ceil(+cte.taxedWeight) <= +i.maxWeight) {
@@ -7152,6 +7162,18 @@ var getFilteredFeesToAudit = function (_a) {
7152
7162
  }
7153
7163
  return false;
7154
7164
  });
7165
+ // Remover fees duplicadas, mantendo apenas uma ocorrência de cada feeId
7166
+ var seenFeeIds = new Set();
7167
+ var uniqueFees = filteredFees === null || filteredFees === void 0 ? void 0 : filteredFees.filter(function (fee) {
7168
+ if (fee.feeId && seenFeeIds.has(fee.feeId)) {
7169
+ return false;
7170
+ }
7171
+ if (fee.feeId) {
7172
+ seenFeeIds.add(fee.feeId);
7173
+ }
7174
+ return true;
7175
+ });
7176
+ return uniqueFees;
7155
7177
  };
7156
7178
 
7157
7179
  var getLaneFromRatecard = function (cte) {
Binary file