b2m-utils 0.0.229 → 0.0.231

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.
@@ -363,6 +363,16 @@ function __generator(thisArg, body) {
363
363
  }
364
364
  }
365
365
 
366
+ function __spreadArray(to, from, pack) {
367
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
368
+ if (ar || !(i in from)) {
369
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
370
+ ar[i] = from[i];
371
+ }
372
+ }
373
+ return to.concat(ar || Array.prototype.slice.call(from));
374
+ }
375
+
366
376
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
367
377
  var e = new Error(message);
368
378
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
@@ -810,27 +820,39 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
810
820
  }
811
821
  };
812
822
 
813
- var getCteLane = function (cte) {
814
- var _a, _b, _c, _d, _e;
815
- if (cte === null || cte === void 0 ? void 0 : cte.carrier) {
816
- var carrier = cte === null || cte === void 0 ? void 0 : cte.carrier;
817
- if ((_a = carrier === null || carrier === void 0 ? void 0 : carrier.Ratecard) === null || _a === void 0 ? void 0 : _a.length) {
818
- var destinationUf_1 = (_c = (_b = cte === null || cte === void 0 ? void 0 : cte.cityDestination) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.uf;
819
- if (carrier === null || carrier === void 0 ? void 0 : carrier.Ratecard[0]) {
820
- var ratecard = carrier === null || carrier === void 0 ? void 0 : carrier.Ratecard[0];
821
- if (ratecard.RatecardLane && ((_d = ratecard.RatecardLane) === null || _d === void 0 ? void 0 : _d.length) > 0 && cte.cityOriginId && destinationUf_1) {
822
- var region = (_e = ratecard.RatecardRegionCity) === null || _e === void 0 ? void 0 : _e.find(function (it) { return it.cityId === cte.cityDestinationId; });
823
- var regionId_1 = (region === null || region === void 0 ? void 0 : region.ratecardRegionId) ? region.ratecardRegionId : (region === null || region === void 0 ? void 0 : region.regionId) ? region.regionId : 0;
824
- return ratecard.RatecardLane.find(function (i) {
825
- if (i.cityOriginId === cte.cityOriginId && i.ufDestination === destinationUf_1 && i.ratecardRegionId === regionId_1) {
826
- return true;
827
- }
828
- return false;
829
- });
830
- }
831
- }
832
- }
823
+ /**
824
+ * Calcula o valor do ICMS baseado no total das outras taxas
825
+ *
826
+ * @param totalFromAllFees - Array com os valores das outras taxas
827
+ * @param icmsRate - Alíquota do ICMS (ex: 0.12 para 12%)
828
+ * @returns Objeto com o valor calculado e detalhes do cálculo
829
+ */
830
+ var calculateIcms = function (totalFromAllFees, icmsRate) {
831
+ // Filtra valores válidos e soma
832
+ var totalValueFromAllFees = totalFromAllFees
833
+ .filter(function (value) { return !isNaN(+value) && +value > 0; })
834
+ .reduce(function (previous, current) { return +previous + +current; }, 0);
835
+ // Verifica se valor válido para cálculo
836
+ if (!totalValueFromAllFees || isNaN(+totalValueFromAllFees)) {
837
+ return {
838
+ total: 0,
839
+ totalValueFromAllFees: 0,
840
+ valueToDivide: 0,
841
+ firstTotal: 0,
842
+ isValid: false
843
+ };
833
844
  }
845
+ // Cálculo do ICMS: (soma / (1 - alíquota)) * alíquota
846
+ var valueToDivide = (1 - icmsRate).toFixed(2);
847
+ var firstTotal = +totalValueFromAllFees / +valueToDivide;
848
+ var total = +firstTotal * icmsRate;
849
+ return {
850
+ total: total,
851
+ totalValueFromAllFees: totalValueFromAllFees,
852
+ valueToDivide: valueToDivide,
853
+ firstTotal: firstTotal,
854
+ isValid: true
855
+ };
834
856
  };
835
857
 
836
858
  var verifyConditionalFee = function (conditionalFeeToVerify, cte) {
@@ -853,83 +875,220 @@ var verifyConditionalFee = function (conditionalFeeToVerify, cte) {
853
875
  return false;
854
876
  };
855
877
 
856
- var getLaneFeesToCalc = function (cte) {
857
- var _a, _b;
858
- var ratecard = getRatecardFromCte(cte);
859
- var lane = getCteLane(cte);
860
- if ((_a = lane === null || lane === void 0 ? void 0 : lane.RatecardLaneFee) === null || _a === void 0 ? void 0 : _a.length) {
861
- var newFilteredFees = (_b = lane === null || lane === void 0 ? void 0 : lane.RatecardLaneFee) === null || _b === void 0 ? void 0 : _b.filter(function (i) {
862
- var _a, _b, _c, _d, _e;
863
- var defaultConditionalFees = [
864
- FeeEnum.TDA_FREIGHT,
865
- FeeEnum.TDA_MIN,
866
- FeeEnum.TDE_FREIGHT,
867
- FeeEnum.TDE_MIN,
868
- ];
869
- var conditionalFeeToVerify;
870
- var conditionalFees = (_a = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardConditionalFee) === null || _a === void 0 ? void 0 : _a.filter(function (it) { var _a; return it.feeId === ((_a = i.fee) === null || _a === void 0 ? void 0 : _a.id); });
871
- if (defaultConditionalFees.includes((_b = i.fee) === null || _b === void 0 ? void 0 : _b.id) && !(conditionalFees === null || conditionalFees === void 0 ? void 0 : conditionalFees.length)) {
872
- return false;
878
+ var getFilteredFeesToAudit = function (_a) {
879
+ var _b;
880
+ var lane = _a.lane, ratecard = _a.ratecard, cte = _a.cte;
881
+ var filteredFees = (_b = lane === null || lane === void 0 ? void 0 : lane.RatecardLaneFee) === null || _b === void 0 ? void 0 : _b.filter(function (i) {
882
+ var _a, _b, _c, _d, _e, _f, _g;
883
+ var defaultConditionalFees = [
884
+ FeeEnum.SUFRAMA,
885
+ FeeEnum.TDA_FREIGHT,
886
+ FeeEnum.TDA_MIN,
887
+ FeeEnum.TDE_FREIGHT,
888
+ FeeEnum.TDE_MIN,
889
+ FeeEnum.TRT_FREIGHT,
890
+ FeeEnum.TRT_MIN,
891
+ 94,
892
+ ];
893
+ var collectFees = [
894
+ FeeEnum.COLLECT_PERCENTAGE_TOTAL,
895
+ FeeEnum.COLLECT_REVERSE_PERCENTAGE_TOTAL,
896
+ ];
897
+ if (collectFees.includes((_a = i.fee) === null || _a === void 0 ? void 0 : _a.id)) {
898
+ switch ((_b = i.fee) === null || _b === void 0 ? void 0 : _b.id) {
899
+ case FeeEnum.COLLECT_PERCENTAGE_TOTAL:
900
+ return cte.isCollect;
901
+ case FeeEnum.COLLECT_REVERSE_PERCENTAGE_TOTAL:
902
+ return cte.isCollectReverse;
873
903
  }
874
- if (conditionalFees && (conditionalFees === null || conditionalFees === void 0 ? void 0 : conditionalFees.length) > 0) {
875
- var _loop_1 = function (index) {
876
- var conditionalFee = conditionalFees[index];
877
- if (conditionalFee) {
878
- conditionalFeeToVerify = conditionalFee;
879
- }
880
- else if ((_c = i.fee) === null || _c === void 0 ? void 0 : _c.parentId) {
881
- var siblingFee_1 = (_d = lane === null || lane === void 0 ? void 0 : lane.RatecardLaneFee) === null || _d === void 0 ? void 0 : _d.find(function (it) { var _a, _b; return ((_a = it.fee) === null || _a === void 0 ? void 0 : _a.parentId) === i.fee.parentId && ((_b = it.fee) === null || _b === void 0 ? void 0 : _b.id) !== i.fee.id; });
882
- if (siblingFee_1) {
883
- var conditionalFeeSibling = (_e = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardConditionalFee) === null || _e === void 0 ? void 0 : _e.find(function (i) { var _a; return i.feeId === ((_a = siblingFee_1.fee) === null || _a === void 0 ? void 0 : _a.id); });
884
- if (conditionalFeeSibling) {
885
- conditionalFeeToVerify = conditionalFeeSibling;
886
- }
904
+ }
905
+ var conditionalFeeToVerify;
906
+ var conditionalFees = (_c = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardConditionalFee) === null || _c === void 0 ? void 0 : _c.filter(function (it) { var _a; return it.feeId === ((_a = i.fee) === null || _a === void 0 ? void 0 : _a.id); });
907
+ if (defaultConditionalFees.includes((_d = i.fee) === null || _d === void 0 ? void 0 : _d.id) && !(conditionalFees === null || conditionalFees === void 0 ? void 0 : conditionalFees.length)) {
908
+ return false;
909
+ }
910
+ if (conditionalFees && (conditionalFees === null || conditionalFees === void 0 ? void 0 : conditionalFees.length) > 0) {
911
+ var _loop_1 = function (index) {
912
+ var conditionalFee = conditionalFees[index];
913
+ if (conditionalFee) {
914
+ conditionalFeeToVerify = conditionalFee;
915
+ }
916
+ else if ((_e = i.fee) === null || _e === void 0 ? void 0 : _e.parentId) {
917
+ var siblingFee_1 = (_f = lane === null || lane === void 0 ? void 0 : lane.RatecardLaneFee) === null || _f === void 0 ? void 0 : _f.find(function (it) { var _a, _b; return ((_a = it.fee) === null || _a === void 0 ? void 0 : _a.parentId) === i.fee.parentId && ((_b = it.fee) === null || _b === void 0 ? void 0 : _b.id) !== i.fee.id; });
918
+ if (siblingFee_1) {
919
+ var conditionalFeeSibling = (_g = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardConditionalFee) === null || _g === void 0 ? void 0 : _g.find(function (i) { var _a; return i.feeId === ((_a = siblingFee_1.fee) === null || _a === void 0 ? void 0 : _a.id); });
920
+ if (conditionalFeeSibling) {
921
+ conditionalFeeToVerify = conditionalFeeSibling;
887
922
  }
888
923
  }
889
- if (conditionalFeeToVerify === null || conditionalFeeToVerify === void 0 ? void 0 : conditionalFeeToVerify.id) {
890
- var result = verifyConditionalFee(conditionalFeeToVerify, cte);
891
- if (result) {
892
- return { value: true };
893
- }
894
- else if (index === conditionalFees.length - 1) {
895
- return { value: false };
896
- }
924
+ }
925
+ if (conditionalFeeToVerify === null || conditionalFeeToVerify === void 0 ? void 0 : conditionalFeeToVerify.id) {
926
+ var result = verifyConditionalFee(conditionalFeeToVerify, cte);
927
+ if (result) {
928
+ return { value: true };
929
+ }
930
+ else if (index === conditionalFees.length - 1) {
931
+ return { value: false };
897
932
  }
898
- };
899
- for (var index = 0; index < conditionalFees.length; index++) {
900
- var state_1 = _loop_1(index);
901
- if (typeof state_1 === "object")
902
- return state_1.value;
903
933
  }
934
+ };
935
+ for (var index = 0; index < conditionalFees.length; index++) {
936
+ var state_1 = _loop_1(index);
937
+ if (typeof state_1 === "object")
938
+ return state_1.value;
904
939
  }
905
- if (i.minWeight) {
906
- if (cte === null || cte === void 0 ? void 0 : cte.taxedWeight) {
907
- if (Math.ceil(+cte.taxedWeight) >= +i.minWeight) {
908
- if (Math.ceil(+cte.taxedWeight) <= +i.maxWeight) {
909
- return true;
910
- }
911
- else if (!i.maxWeight) {
912
- return true;
913
- }
914
- }
940
+ }
941
+ if (i.minKm !== null && i.minKm !== undefined) {
942
+ if (cte === null || cte === void 0 ? void 0 : cte.distance) {
943
+ var distanceInRange = +cte.distance >= +i.minKm && (!i.maxKm || +cte.distance <= +i.maxKm);
944
+ var vehicleTypeMatches = !i.vehicleTypeId || cte.vehicleTypeId === i.vehicleTypeId;
945
+ if (distanceInRange && vehicleTypeMatches) {
946
+ return true;
915
947
  }
916
948
  }
917
- else {
918
- return true;
949
+ }
950
+ else if (i.minWeight) {
951
+ if (cte === null || cte === void 0 ? void 0 : cte.taxedWeight) {
952
+ if (Math.ceil(+cte.taxedWeight) >= +i.minWeight) {
953
+ if (Math.ceil(+cte.taxedWeight) <= +i.maxWeight) {
954
+ return true;
955
+ }
956
+ else if (!i.maxWeight) {
957
+ return true;
958
+ }
959
+ }
919
960
  }
961
+ }
962
+ else {
963
+ return true;
964
+ }
965
+ return false;
966
+ });
967
+ // Remover fees duplicadas, mantendo apenas uma ocorrência de cada feeId
968
+ var seenFeeIds = new Set();
969
+ var uniqueFees = filteredFees === null || filteredFees === void 0 ? void 0 : filteredFees.filter(function (fee) {
970
+ if (fee.feeId && seenFeeIds.has(fee.feeId)) {
920
971
  return false;
921
- });
922
- if ((newFilteredFees === null || newFilteredFees === void 0 ? void 0 : newFilteredFees.length) > 0) {
923
- return newFilteredFees;
924
972
  }
973
+ if (fee.feeId) {
974
+ seenFeeIds.add(fee.feeId);
975
+ }
976
+ return true;
977
+ });
978
+ return uniqueFees;
979
+ };
980
+
981
+ var getAllFeesForCalculation = function (_a) {
982
+ var _b;
983
+ var lane = _a.lane, ratecard = _a.ratecard, cte = _a.cte;
984
+ // Obter taxas aplicáveis (função atual)
985
+ var applicableFees = getFilteredFeesToAudit({ lane: lane, ratecard: ratecard, cte: cte });
986
+ // Extrair tipos de taxas únicos das taxas aplicáveis
987
+ var feeTypes = Array.from(new Set(applicableFees === null || applicableFees === void 0 ? void 0 : applicableFees.map(function (fee) { var _a; return (_a = fee.fee) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean)));
988
+ // Encontrar taxas de intervalo do mesmo tipo
989
+ var intervalFees = (_b = lane === null || lane === void 0 ? void 0 : lane.RatecardLaneFee) === null || _b === void 0 ? void 0 : _b.filter(function (fee) {
990
+ var _a;
991
+ return feeTypes.includes((_a = fee.fee) === null || _a === void 0 ? void 0 : _a.id) &&
992
+ (fee.minWeight || fee.maxWeight);
993
+ });
994
+ // Combinar taxas aplicáveis com taxas de intervalo, removendo duplicatas
995
+ var allFees = __spreadArray(__spreadArray([], (applicableFees || []), true), (intervalFees || []), true);
996
+ var uniqueFees = Array.from(new Map(allFees.map(function (fee) { return [fee.id, fee]; })).values());
997
+ return uniqueFees;
998
+ };
999
+
1000
+ var getLaneFromRatecard = function (cte) {
1001
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1002
+ var ratecard = getRatecardFromCte(cte);
1003
+ var cityOriginId = cte.cityOriginId, cityDestination = cte.cityDestination;
1004
+ var destinationUf = (_a = cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.state) === null || _a === void 0 ? void 0 : _a.uf;
1005
+ // Encontrar a ratecardRegion da cidade de destino
1006
+ var destinationRatecardRegionId = (_c = (_b = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardRegionCity) === null || _b === void 0 ? void 0 : _b.find(function (regionCity) { return regionCity.cityId === (cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.id); })) === null || _c === void 0 ? void 0 : _c.ratecardRegionId;
1007
+ if (!(ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardLane) || ((_d = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardLane) === null || _d === void 0 ? void 0 : _d.length) === 0) {
1008
+ return undefined;
1009
+ }
1010
+ // Lógica diferenciada por modal
1011
+ switch (ratecard.modalId) {
1012
+ case RatecardModalEnum.ROAD_DOMESTIC_FTL:
1013
+ // FTL: Verificar rota por UF de destino
1014
+ if (destinationUf) {
1015
+ var directLane = ratecard.RatecardLane.find(function (i) {
1016
+ return i.ufDestination === destinationUf && i.ratecardRegionId === destinationRatecardRegionId;
1017
+ });
1018
+ if (directLane) {
1019
+ return directLane;
1020
+ }
1021
+ // Fallback: Verificar se existe lane única com fees de KM e cidade origem no ratecard_origin_cities
1022
+ var uniqueLane = ratecard.RatecardLane[0];
1023
+ // Verificar se a lane tem fees com intervalo de KM
1024
+ var hasKmFees = (_e = uniqueLane === null || uniqueLane === void 0 ? void 0 : uniqueLane.RatecardLaneFee) === null || _e === void 0 ? void 0 : _e.some(function (fee) { return fee.minKm !== null; });
1025
+ // Verificar se a cidade de origem está no ratecard_origin_cities
1026
+ var hasOriginCity = (_f = ratecard.ratecard_origin_cities) === null || _f === void 0 ? void 0 : _f.some(function (originCity) { return originCity.cityId === cityOriginId; });
1027
+ if (hasKmFees && hasOriginCity) {
1028
+ // Mockar informações para exibição no frontend
1029
+ return __assign(__assign({}, uniqueLane), { city: cte.cityOrigin, ufDestination: destinationUf, ratecardRegion: uniqueLane.ratecardRegion || { name: destinationUf } });
1030
+ }
1031
+ // Rota inversa FTL: Verificar se cidade de destino está em ratecard_origin_cities
1032
+ var originUf_1 = (_h = (_g = cte.cityOrigin) === null || _g === void 0 ? void 0 : _g.state) === null || _h === void 0 ? void 0 : _h.uf;
1033
+ if (originUf_1) {
1034
+ // Verificar se existe lane com ufDestination = originUf
1035
+ var reverseLane = ratecard.RatecardLane.find(function (i) {
1036
+ return i.ufDestination === originUf_1;
1037
+ });
1038
+ if (reverseLane) {
1039
+ // Verificar se a cidade de destino está no ratecard_origin_cities
1040
+ var hasDestinationCity = (_j = ratecard.ratecard_origin_cities) === null || _j === void 0 ? void 0 : _j.some(function (originCity) { return originCity.cityId === (cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.id); });
1041
+ if (hasDestinationCity) {
1042
+ return reverseLane;
1043
+ }
1044
+ }
1045
+ // Fallback inverso: Lane única com cidade de destino em ratecard_origin_cities
1046
+ var hasDestinationCityInOrigins = (_k = ratecard.ratecard_origin_cities) === null || _k === void 0 ? void 0 : _k.some(function (originCity) { return originCity.cityId === (cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.id); });
1047
+ if (hasKmFees && hasDestinationCityInOrigins) {
1048
+ // Mockar informações para exibição no frontend (rota inversa)
1049
+ return __assign(__assign({}, uniqueLane), { city: cityDestination, ufDestination: originUf_1, ratecardRegion: uniqueLane.ratecardRegion || { name: originUf_1 } });
1050
+ }
1051
+ }
1052
+ }
1053
+ break;
1054
+ case RatecardModalEnum.ROAD_DOMESTIC_LTL:
1055
+ default:
1056
+ // LTL: Lógica original (rota direta + inversa)
1057
+ if (cityOriginId && destinationUf) {
1058
+ // Primeiro, buscar rota direta (Origem -> Destino)
1059
+ var directLane = ratecard.RatecardLane.find(function (i) {
1060
+ return i.cityOriginId === cityOriginId && i.ufDestination === destinationUf && i.ratecardRegionId === destinationRatecardRegionId;
1061
+ });
1062
+ if (directLane) {
1063
+ return directLane;
1064
+ }
1065
+ // Se não encontrar rota direta, buscar rota inversa (Destino -> Origem)
1066
+ // Para isso, precisamos encontrar a UF da origem e sua ratecardRegion
1067
+ var originUf_2 = (_m = (_l = cte.cityOrigin) === null || _l === void 0 ? void 0 : _l.state) === null || _m === void 0 ? void 0 : _m.uf;
1068
+ // Encontrar a ratecardRegion da cidade de origem
1069
+ var originRatecardRegionId_1 = (_p = (_o = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardRegionCity) === null || _o === void 0 ? void 0 : _o.find(function (regionCity) { return regionCity.cityId === cityOriginId; })) === null || _p === void 0 ? void 0 : _p.ratecardRegionId;
1070
+ if (originUf_2) {
1071
+ var reverseLane = ratecard.RatecardLane.find(function (i) {
1072
+ return i.cityOriginId === (cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.id) && i.ufDestination === originUf_2 && i.ratecardRegionId === originRatecardRegionId_1;
1073
+ });
1074
+ if (reverseLane) {
1075
+ return reverseLane;
1076
+ }
1077
+ }
1078
+ }
1079
+ break;
925
1080
  }
1081
+ return undefined;
926
1082
  };
927
1083
 
928
- var getCtesFeesResult = function (feesToCalc, cte) {
929
- var _a, _b, _c, _d;
1084
+ var getCtesFeesResult = function (feesToCalc, cte, allFeesForCalc) {
1085
+ var _a, _b, _c;
930
1086
  var results = [];
1087
+ // Separar ICMS das outras fees
1088
+ var icmsFee = feesToCalc.find(function (f) { var _a; return ((_a = f.fee) === null || _a === void 0 ? void 0 : _a.id) === FeeEnum.ICMS; });
1089
+ var nonIcmsFees = feesToCalc.filter(function (f) { var _a; return ((_a = f.fee) === null || _a === void 0 ? void 0 : _a.id) !== FeeEnum.ICMS; });
931
1090
  var _loop_1 = function (item) {
932
- var feeTotal = calculateFee(item, cte, feesToCalc);
1091
+ var feeTotal = calculateFee(item, cte, feesToCalc, false, allFeesForCalc);
933
1092
  if (feeTotal === null || feeTotal === void 0 ? void 0 : feeTotal.totalFee) {
934
1093
  var totalFee = feeTotal.totalFee, resultFee = feeTotal.resultFee, feeValue = feeTotal.feeValue;
935
1094
  var totalToPush = totalFee;
@@ -938,9 +1097,9 @@ var getCtesFeesResult = function (feesToCalc, cte) {
938
1097
  var siblingFees = feesToCalc === null || feesToCalc === void 0 ? void 0 : feesToCalc.filter(function (i) { var _a, _b; return ((_a = i.fee) === null || _a === void 0 ? void 0 : _a.parentId) === fee_1.parentId && ((_b = i.fee) === null || _b === void 0 ? void 0 : _b.id) !== fee_1.id; });
939
1098
  if (siblingFees && (siblingFees === null || siblingFees === void 0 ? void 0 : siblingFees.length) > 0) {
940
1099
  var siblingFeesResults = [];
941
- for (var _e = 0, siblingFees_1 = siblingFees; _e < siblingFees_1.length; _e++) {
942
- var item_1 = siblingFees_1[_e];
943
- var result = calculateFee(item_1, cte);
1100
+ for (var _d = 0, siblingFees_1 = siblingFees; _d < siblingFees_1.length; _d++) {
1101
+ var item_1 = siblingFees_1[_d];
1102
+ var result = calculateFee(item_1, cte, feesToCalc, false, allFeesForCalc);
944
1103
  siblingFeesResults.push(result);
945
1104
  }
946
1105
  siblingFeesResults.sort(function (a, b) {
@@ -958,24 +1117,45 @@ var getCtesFeesResult = function (feesToCalc, cte) {
958
1117
  }
959
1118
  if (!isNaN(+totalToPush)) {
960
1119
  results.push({
961
- total: totalToPush,
1120
+ total: +(totalToPush).toFixed(2),
962
1121
  resultFee: resultFee,
963
1122
  feeValue: feeValue,
964
- feeId: (_d = item.fee) === null || _d === void 0 ? void 0 : _d.id,
1123
+ feeId: item.feeId,
965
1124
  });
966
1125
  }
967
1126
  }
968
1127
  };
969
- for (var _i = 0, feesToCalc_1 = feesToCalc; _i < feesToCalc_1.length; _i++) {
970
- var item = feesToCalc_1[_i];
1128
+ // PRIMEIRA PASSADA: Calcular todas as fees exceto ICMS
1129
+ for (var _i = 0, nonIcmsFees_1 = nonIcmsFees; _i < nonIcmsFees_1.length; _i++) {
1130
+ var item = nonIcmsFees_1[_i];
971
1131
  _loop_1(item);
972
1132
  }
1133
+ // SEGUNDA PASSADA: Calcular ICMS com base nos resultados já filtrados
1134
+ if (icmsFee) {
1135
+ // Coletar apenas os valores das fees que realmente contam (total > 0)
1136
+ var valuesForIcms = results
1137
+ .filter(function (r) { return r.total > 0; })
1138
+ .map(function (r) { return r.total; });
1139
+ var icmsRate = (cte.icmsIncidence !== undefined && cte.icmsIncidence !== null && !isNaN(+cte.icmsIncidence))
1140
+ ? +(cte.icmsIncidence) / 100
1141
+ : icmsFee.value || 0;
1142
+ // Usar calculateIcms diretamente
1143
+ var icmsCalculation = calculateIcms(valuesForIcms, icmsRate);
1144
+ if (icmsCalculation.isValid && !isNaN(+icmsCalculation.total)) {
1145
+ results.push({
1146
+ total: +(icmsCalculation.total).toFixed(2),
1147
+ resultFee: "(".concat(icmsCalculation.totalValueFromAllFees.toFixed(2), " / ").concat(icmsCalculation.valueToDivide, ") x ").concat(icmsRate, " = ").concat(icmsCalculation.total.toFixed(2)),
1148
+ feeValue: icmsRate,
1149
+ feeId: icmsFee.feeId,
1150
+ });
1151
+ }
1152
+ }
973
1153
  return results;
974
1154
  };
975
1155
 
976
- var getCteLaneFeesTotal = function (feesToCalc, cte) {
1156
+ var getCteLaneFeesTotal = function (feesToCalc, cte, allFeesForCalc) {
977
1157
  if ((feesToCalc === null || feesToCalc === void 0 ? void 0 : feesToCalc.length) > 0) {
978
- var results = getCtesFeesResult(feesToCalc, cte);
1158
+ var results = getCtesFeesResult(feesToCalc, cte, allFeesForCalc);
979
1159
  /*const results = [];
980
1160
 
981
1161
  for (const item of feesToCalc) {
@@ -1048,9 +1228,26 @@ var getCteLaneFeesTotal = function (feesToCalc, cte) {
1048
1228
  };
1049
1229
 
1050
1230
  var getAuditTotalFromCte = function (cte) {
1051
- var laneFees = getLaneFeesToCalc(cte);
1052
- var total = getCteLaneFeesTotal(laneFees !== null && laneFees !== void 0 ? laneFees : [], cte);
1053
- if (cte.id === 38) ;
1231
+ var lane = getLaneFromRatecard(cte);
1232
+ var ratecard = getRatecardFromCte(cte);
1233
+ // Obter taxas filtradas com lógica de coleta
1234
+ var laneFees = lane && ratecard ?
1235
+ getFilteredFeesToAudit({ lane: lane, ratecard: ratecard, cte: cte }) : [];
1236
+ // Obter todas as taxas para cálculo
1237
+ var allFeesForCalc = lane && ratecard ?
1238
+ getAllFeesForCalculation({
1239
+ lane: lane,
1240
+ ratecard: ratecard,
1241
+ cte: cte
1242
+ }) : [];
1243
+ var total = getCteLaneFeesTotal(laneFees || [], cte, allFeesForCalc);
1244
+ // Se for reentrega, verificar o valor mínimo
1245
+ if (cte.isRedelivery && total) {
1246
+ var ratecard_1 = getRatecardFromCte(cte);
1247
+ if ((ratecard_1 === null || ratecard_1 === void 0 ? void 0 : ratecard_1.redeliveryMinValue) && total < ratecard_1.redeliveryMinValue) {
1248
+ return +ratecard_1.redeliveryMinValue;
1249
+ }
1250
+ }
1054
1251
  return total !== null && total !== void 0 ? total : 0;
1055
1252
  };
1056
1253
 
@@ -7185,176 +7382,99 @@ var getCteDateRange = function (ctes) {
7185
7382
  return "".concat(formatDate(oldest), " - ").concat(formatDate(newest));
7186
7383
  };
7187
7384
 
7188
- var getFilteredFeesToAudit = function (_a) {
7189
- var _b;
7190
- var lane = _a.lane, ratecard = _a.ratecard, cte = _a.cte;
7191
- var filteredFees = (_b = lane === null || lane === void 0 ? void 0 : lane.RatecardLaneFee) === null || _b === void 0 ? void 0 : _b.filter(function (i) {
7192
- var _a, _b, _c, _d, _e;
7193
- var defaultConditionalFees = [
7194
- FeeEnum.SUFRAMA,
7195
- FeeEnum.TDA_FREIGHT,
7196
- FeeEnum.TDA_MIN,
7197
- FeeEnum.TDE_FREIGHT,
7198
- FeeEnum.TDE_MIN,
7199
- ];
7200
- var conditionalFeeToVerify;
7201
- var conditionalFees = (_a = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardConditionalFee) === null || _a === void 0 ? void 0 : _a.filter(function (it) { var _a; return it.feeId === ((_a = i.fee) === null || _a === void 0 ? void 0 : _a.id); });
7202
- if (defaultConditionalFees.includes((_b = i.fee) === null || _b === void 0 ? void 0 : _b.id) && !(conditionalFees === null || conditionalFees === void 0 ? void 0 : conditionalFees.length)) {
7203
- return false;
7204
- }
7205
- if (conditionalFees && (conditionalFees === null || conditionalFees === void 0 ? void 0 : conditionalFees.length) > 0) {
7206
- var _loop_1 = function (index) {
7207
- var conditionalFee = conditionalFees[index];
7208
- if (conditionalFee) {
7209
- conditionalFeeToVerify = conditionalFee;
7210
- }
7211
- else if ((_c = i.fee) === null || _c === void 0 ? void 0 : _c.parentId) {
7212
- var siblingFee_1 = (_d = lane === null || lane === void 0 ? void 0 : lane.RatecardLaneFee) === null || _d === void 0 ? void 0 : _d.find(function (it) { var _a, _b; return ((_a = it.fee) === null || _a === void 0 ? void 0 : _a.parentId) === i.fee.parentId && ((_b = it.fee) === null || _b === void 0 ? void 0 : _b.id) !== i.fee.id; });
7213
- if (siblingFee_1) {
7214
- var conditionalFeeSibling = (_e = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardConditionalFee) === null || _e === void 0 ? void 0 : _e.find(function (i) { var _a; return i.feeId === ((_a = siblingFee_1.fee) === null || _a === void 0 ? void 0 : _a.id); });
7215
- if (conditionalFeeSibling) {
7216
- conditionalFeeToVerify = conditionalFeeSibling;
7385
+ var getCteLane = function (cte) {
7386
+ var _a, _b, _c, _d, _e;
7387
+ if (cte === null || cte === void 0 ? void 0 : cte.carrier) {
7388
+ var carrier = cte === null || cte === void 0 ? void 0 : cte.carrier;
7389
+ if ((_a = carrier === null || carrier === void 0 ? void 0 : carrier.Ratecard) === null || _a === void 0 ? void 0 : _a.length) {
7390
+ var destinationUf_1 = (_c = (_b = cte === null || cte === void 0 ? void 0 : cte.cityDestination) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.uf;
7391
+ if (carrier === null || carrier === void 0 ? void 0 : carrier.Ratecard[0]) {
7392
+ var ratecard = carrier === null || carrier === void 0 ? void 0 : carrier.Ratecard[0];
7393
+ if (ratecard.RatecardLane && ((_d = ratecard.RatecardLane) === null || _d === void 0 ? void 0 : _d.length) > 0 && cte.cityOriginId && destinationUf_1) {
7394
+ var region = (_e = ratecard.RatecardRegionCity) === null || _e === void 0 ? void 0 : _e.find(function (it) { return it.cityId === cte.cityDestinationId; });
7395
+ var regionId_1 = (region === null || region === void 0 ? void 0 : region.ratecardRegionId) ? region.ratecardRegionId : (region === null || region === void 0 ? void 0 : region.regionId) ? region.regionId : 0;
7396
+ return ratecard.RatecardLane.find(function (i) {
7397
+ if (i.cityOriginId === cte.cityOriginId && i.ufDestination === destinationUf_1 && i.ratecardRegionId === regionId_1) {
7398
+ return true;
7217
7399
  }
7218
- }
7219
- }
7220
- if (conditionalFeeToVerify === null || conditionalFeeToVerify === void 0 ? void 0 : conditionalFeeToVerify.id) {
7221
- var result = verifyConditionalFee(conditionalFeeToVerify, cte);
7222
- if (result) {
7223
- return { value: true };
7224
- }
7225
- else if (index === conditionalFees.length - 1) {
7226
- return { value: false };
7227
- }
7228
- }
7229
- };
7230
- for (var index = 0; index < conditionalFees.length; index++) {
7231
- var state_1 = _loop_1(index);
7232
- if (typeof state_1 === "object")
7233
- return state_1.value;
7234
- }
7235
- }
7236
- if (i.minKm !== null && i.minKm !== undefined) {
7237
- if (cte === null || cte === void 0 ? void 0 : cte.distance) {
7238
- var distanceInRange = +cte.distance >= +i.minKm && (!i.maxKm || +cte.distance <= +i.maxKm);
7239
- var vehicleTypeMatches = !i.vehicleTypeId || cte.vehicleTypeId === i.vehicleTypeId;
7240
- if (distanceInRange && vehicleTypeMatches) {
7241
- return true;
7242
- }
7243
- }
7244
- }
7245
- else if (i.minWeight) {
7246
- if (cte === null || cte === void 0 ? void 0 : cte.taxedWeight) {
7247
- if (Math.ceil(+cte.taxedWeight) >= +i.minWeight) {
7248
- if (Math.ceil(+cte.taxedWeight) <= +i.maxWeight) {
7249
- return true;
7250
- }
7251
- else if (!i.maxWeight) {
7252
- return true;
7253
- }
7400
+ return false;
7401
+ });
7254
7402
  }
7255
7403
  }
7256
7404
  }
7257
- else {
7258
- return true;
7259
- }
7260
- return false;
7261
- });
7262
- // Remover fees duplicadas, mantendo apenas uma ocorrência de cada feeId
7263
- var seenFeeIds = new Set();
7264
- var uniqueFees = filteredFees === null || filteredFees === void 0 ? void 0 : filteredFees.filter(function (fee) {
7265
- if (fee.feeId && seenFeeIds.has(fee.feeId)) {
7266
- return false;
7267
- }
7268
- if (fee.feeId) {
7269
- seenFeeIds.add(fee.feeId);
7270
- }
7271
- return true;
7272
- });
7273
- return uniqueFees;
7405
+ }
7274
7406
  };
7275
7407
 
7276
- var getLaneFromRatecard = function (cte) {
7277
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
7408
+ var getLaneFeesToCalc = function (cte) {
7409
+ var _a, _b;
7278
7410
  var ratecard = getRatecardFromCte(cte);
7279
- var cityOriginId = cte.cityOriginId, cityDestination = cte.cityDestination;
7280
- var destinationUf = (_a = cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.state) === null || _a === void 0 ? void 0 : _a.uf;
7281
- // Encontrar a ratecardRegion da cidade de destino
7282
- var destinationRatecardRegionId = (_c = (_b = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardRegionCity) === null || _b === void 0 ? void 0 : _b.find(function (regionCity) { return regionCity.cityId === (cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.id); })) === null || _c === void 0 ? void 0 : _c.ratecardRegionId;
7283
- if (!(ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardLane) || ((_d = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardLane) === null || _d === void 0 ? void 0 : _d.length) === 0) {
7284
- return undefined;
7285
- }
7286
- // Lógica diferenciada por modal
7287
- switch (ratecard.modalId) {
7288
- case RatecardModalEnum.ROAD_DOMESTIC_FTL:
7289
- // FTL: Verificar rota por UF de destino
7290
- if (destinationUf) {
7291
- var directLane = ratecard.RatecardLane.find(function (i) {
7292
- return i.ufDestination === destinationUf && i.ratecardRegionId === destinationRatecardRegionId;
7293
- });
7294
- if (directLane) {
7295
- return directLane;
7296
- }
7297
- // Fallback: Verificar se existe lane única com fees de KM e cidade origem no ratecard_origin_cities
7298
- var uniqueLane = ratecard.RatecardLane[0];
7299
- // Verificar se a lane tem fees com intervalo de KM
7300
- var hasKmFees = (_e = uniqueLane === null || uniqueLane === void 0 ? void 0 : uniqueLane.RatecardLaneFee) === null || _e === void 0 ? void 0 : _e.some(function (fee) { return fee.minKm !== null; });
7301
- // Verificar se a cidade de origem está no ratecard_origin_cities
7302
- var hasOriginCity = (_f = ratecard.ratecard_origin_cities) === null || _f === void 0 ? void 0 : _f.some(function (originCity) { return originCity.cityId === cityOriginId; });
7303
- if (hasKmFees && hasOriginCity) {
7304
- // Mockar informações para exibição no frontend
7305
- return __assign(__assign({}, uniqueLane), { city: cte.cityOrigin, ufDestination: destinationUf, ratecardRegion: uniqueLane.ratecardRegion || { name: destinationUf } });
7306
- }
7307
- // Rota inversa FTL: Verificar se cidade de destino está em ratecard_origin_cities
7308
- var originUf_1 = (_h = (_g = cte.cityOrigin) === null || _g === void 0 ? void 0 : _g.state) === null || _h === void 0 ? void 0 : _h.uf;
7309
- if (originUf_1) {
7310
- // Verificar se existe lane com ufDestination = originUf
7311
- var reverseLane = ratecard.RatecardLane.find(function (i) {
7312
- return i.ufDestination === originUf_1;
7313
- });
7314
- if (reverseLane) {
7315
- // Verificar se a cidade de destino está no ratecard_origin_cities
7316
- var hasDestinationCity = (_j = ratecard.ratecard_origin_cities) === null || _j === void 0 ? void 0 : _j.some(function (originCity) { return originCity.cityId === (cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.id); });
7317
- if (hasDestinationCity) {
7318
- return reverseLane;
7411
+ var lane = getCteLane(cte);
7412
+ if ((_a = lane === null || lane === void 0 ? void 0 : lane.RatecardLaneFee) === null || _a === void 0 ? void 0 : _a.length) {
7413
+ var newFilteredFees = (_b = lane === null || lane === void 0 ? void 0 : lane.RatecardLaneFee) === null || _b === void 0 ? void 0 : _b.filter(function (i) {
7414
+ var _a, _b, _c, _d, _e;
7415
+ var defaultConditionalFees = [
7416
+ FeeEnum.TDA_FREIGHT,
7417
+ FeeEnum.TDA_MIN,
7418
+ FeeEnum.TDE_FREIGHT,
7419
+ FeeEnum.TDE_MIN,
7420
+ ];
7421
+ var conditionalFeeToVerify;
7422
+ var conditionalFees = (_a = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardConditionalFee) === null || _a === void 0 ? void 0 : _a.filter(function (it) { var _a; return it.feeId === ((_a = i.fee) === null || _a === void 0 ? void 0 : _a.id); });
7423
+ if (defaultConditionalFees.includes((_b = i.fee) === null || _b === void 0 ? void 0 : _b.id) && !(conditionalFees === null || conditionalFees === void 0 ? void 0 : conditionalFees.length)) {
7424
+ return false;
7425
+ }
7426
+ if (conditionalFees && (conditionalFees === null || conditionalFees === void 0 ? void 0 : conditionalFees.length) > 0) {
7427
+ var _loop_1 = function (index) {
7428
+ var conditionalFee = conditionalFees[index];
7429
+ if (conditionalFee) {
7430
+ conditionalFeeToVerify = conditionalFee;
7431
+ }
7432
+ else if ((_c = i.fee) === null || _c === void 0 ? void 0 : _c.parentId) {
7433
+ var siblingFee_1 = (_d = lane === null || lane === void 0 ? void 0 : lane.RatecardLaneFee) === null || _d === void 0 ? void 0 : _d.find(function (it) { var _a, _b; return ((_a = it.fee) === null || _a === void 0 ? void 0 : _a.parentId) === i.fee.parentId && ((_b = it.fee) === null || _b === void 0 ? void 0 : _b.id) !== i.fee.id; });
7434
+ if (siblingFee_1) {
7435
+ var conditionalFeeSibling = (_e = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardConditionalFee) === null || _e === void 0 ? void 0 : _e.find(function (i) { var _a; return i.feeId === ((_a = siblingFee_1.fee) === null || _a === void 0 ? void 0 : _a.id); });
7436
+ if (conditionalFeeSibling) {
7437
+ conditionalFeeToVerify = conditionalFeeSibling;
7438
+ }
7319
7439
  }
7320
7440
  }
7321
- // Fallback inverso: Lane única com cidade de destino em ratecard_origin_cities
7322
- var hasDestinationCityInOrigins = (_k = ratecard.ratecard_origin_cities) === null || _k === void 0 ? void 0 : _k.some(function (originCity) { return originCity.cityId === (cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.id); });
7323
- if (hasKmFees && hasDestinationCityInOrigins) {
7324
- // Mockar informações para exibição no frontend (rota inversa)
7325
- return __assign(__assign({}, uniqueLane), { city: cityDestination, ufDestination: originUf_1, ratecardRegion: uniqueLane.ratecardRegion || { name: originUf_1 } });
7441
+ if (conditionalFeeToVerify === null || conditionalFeeToVerify === void 0 ? void 0 : conditionalFeeToVerify.id) {
7442
+ var result = verifyConditionalFee(conditionalFeeToVerify, cte);
7443
+ if (result) {
7444
+ return { value: true };
7445
+ }
7446
+ else if (index === conditionalFees.length - 1) {
7447
+ return { value: false };
7448
+ }
7326
7449
  }
7450
+ };
7451
+ for (var index = 0; index < conditionalFees.length; index++) {
7452
+ var state_1 = _loop_1(index);
7453
+ if (typeof state_1 === "object")
7454
+ return state_1.value;
7327
7455
  }
7328
7456
  }
7329
- break;
7330
- case RatecardModalEnum.ROAD_DOMESTIC_LTL:
7331
- default:
7332
- // LTL: Lógica original (rota direta + inversa)
7333
- if (cityOriginId && destinationUf) {
7334
- // Primeiro, buscar rota direta (Origem -> Destino)
7335
- var directLane = ratecard.RatecardLane.find(function (i) {
7336
- return i.cityOriginId === cityOriginId && i.ufDestination === destinationUf && i.ratecardRegionId === destinationRatecardRegionId;
7337
- });
7338
- if (directLane) {
7339
- return directLane;
7340
- }
7341
- // Se não encontrar rota direta, buscar rota inversa (Destino -> Origem)
7342
- // Para isso, precisamos encontrar a UF da origem e sua ratecardRegion
7343
- var originUf_2 = (_m = (_l = cte.cityOrigin) === null || _l === void 0 ? void 0 : _l.state) === null || _m === void 0 ? void 0 : _m.uf;
7344
- // Encontrar a ratecardRegion da cidade de origem
7345
- var originRatecardRegionId_1 = (_p = (_o = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardRegionCity) === null || _o === void 0 ? void 0 : _o.find(function (regionCity) { return regionCity.cityId === cityOriginId; })) === null || _p === void 0 ? void 0 : _p.ratecardRegionId;
7346
- if (originUf_2) {
7347
- var reverseLane = ratecard.RatecardLane.find(function (i) {
7348
- return i.cityOriginId === (cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.id) && i.ufDestination === originUf_2 && i.ratecardRegionId === originRatecardRegionId_1;
7349
- });
7350
- if (reverseLane) {
7351
- return reverseLane;
7457
+ if (i.minWeight) {
7458
+ if (cte === null || cte === void 0 ? void 0 : cte.taxedWeight) {
7459
+ if (Math.ceil(+cte.taxedWeight) >= +i.minWeight) {
7460
+ if (Math.ceil(+cte.taxedWeight) <= +i.maxWeight) {
7461
+ return true;
7462
+ }
7463
+ else if (!i.maxWeight) {
7464
+ return true;
7465
+ }
7352
7466
  }
7353
7467
  }
7354
7468
  }
7355
- break;
7469
+ else {
7470
+ return true;
7471
+ }
7472
+ return false;
7473
+ });
7474
+ if ((newFilteredFees === null || newFilteredFees === void 0 ? void 0 : newFilteredFees.length) > 0) {
7475
+ return newFilteredFees;
7476
+ }
7356
7477
  }
7357
- return undefined;
7358
7478
  };
7359
7479
 
7360
7480
  var getNormalizedCityName = function (name) {
@@ -7552,5 +7672,5 @@ var setFormattedDatesInObjects = function (objectFormat) { return __awaiter(void
7552
7672
  });
7553
7673
  }); };
7554
7674
 
7555
- export { ApplicationColumnNameEnum, ApplicationEnum, CountryEnum, CteStatusEnum, CteVehicleTypeEnum, CurrencyEnum, DocumentTypeEnum, DomainConfigurationEnum, DomainTypeEnum, FeeCalculationTypeEnum, FeeCategoryEnum, FeeEnum, FreightRegionEnum, ImapHostsEnum, ModalEnum, NotificationTypeEnum, PermissionEnum, RatecardConditionalFeeTypeEnum, RatecardModalEnum, SlaRegionEnum, SpotStatusEnum, TrackProcessProviderTypeEnum, applyRedeliveryMultiplier, calculateFee, convertNumberToCurrency, filterSiblingFees, formatDateString, getAuditTotalFromCte, getConfigurationFromDomain, getContractFromFreight, getContractRouteFromFreight, getCookies, getCteDateRange, getCteLane, getCteLaneFeesTotal, getCtesFeesResult, getDataFromToken, getFilteredFeesToAudit, getFormattedFreightPlaceName, getLaneFeesToCalc, getLaneFromRatecard, getNormalizedCityName, getRatecardFromCte, getRouteDeliveryTimeFromFreight, getRouteOnTimeFromFreight, normalizeString, setFormattedDatesInObjects, verifyConditionalFee, verifyDefaultFees };
7675
+ export { ApplicationColumnNameEnum, ApplicationEnum, CountryEnum, CteStatusEnum, CteVehicleTypeEnum, CurrencyEnum, DocumentTypeEnum, DomainConfigurationEnum, DomainTypeEnum, FeeCalculationTypeEnum, FeeCategoryEnum, FeeEnum, FreightRegionEnum, ImapHostsEnum, ModalEnum, NotificationTypeEnum, PermissionEnum, RatecardConditionalFeeTypeEnum, RatecardModalEnum, SlaRegionEnum, SpotStatusEnum, TrackProcessProviderTypeEnum, applyRedeliveryMultiplier, calculateFee, calculateIcms, convertNumberToCurrency, filterSiblingFees, formatDateString, getAllFeesForCalculation, getAuditTotalFromCte, getConfigurationFromDomain, getContractFromFreight, getContractRouteFromFreight, getCookies, getCteDateRange, getCteLane, getCteLaneFeesTotal, getCtesFeesResult, getDataFromToken, getFilteredFeesToAudit, getFormattedFreightPlaceName, getLaneFeesToCalc, getLaneFromRatecard, getNormalizedCityName, getRatecardFromCte, getRouteDeliveryTimeFromFreight, getRouteOnTimeFromFreight, normalizeString, setFormattedDatesInObjects, verifyConditionalFee, verifyDefaultFees };
7556
7676
  //# sourceMappingURL=index.esm.js.map