b2m-utils 0.0.186 → 0.0.188
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.esm.js +13 -9
- package/build/index.esm.js.gz +0 -0
- package/build/index.esm.js.map +1 -1
- package/build/index.js +13 -9
- package/build/index.js.gz +0 -0
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.esm.js
CHANGED
|
@@ -7127,27 +7127,31 @@ var getFilteredFeesToAudit = function (_a) {
|
|
|
7127
7127
|
};
|
|
7128
7128
|
|
|
7129
7129
|
var getLaneFromRatecard = function (cte) {
|
|
7130
|
-
var _a, _b, _c, _d;
|
|
7130
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7131
7131
|
var ratecard = getRatecardFromCte(cte);
|
|
7132
7132
|
var cityOriginId = cte.cityOriginId, cityDestination = cte.cityDestination;
|
|
7133
7133
|
var destinationUf = (_a = cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.state) === null || _a === void 0 ? void 0 : _a.uf;
|
|
7134
|
-
|
|
7134
|
+
// Encontrar a ratecardRegion da cidade de destino
|
|
7135
|
+
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;
|
|
7136
|
+
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 && cityOriginId && destinationUf) {
|
|
7135
7137
|
// Primeiro, buscar rota direta (Origem -> Destino)
|
|
7136
7138
|
var directLane = ratecard.RatecardLane.find(function (i) {
|
|
7137
|
-
return i.cityOriginId === cityOriginId && i.ufDestination === destinationUf;
|
|
7139
|
+
return i.cityOriginId === cityOriginId && i.ufDestination === destinationUf && i.ratecardRegionId === destinationRatecardRegionId;
|
|
7138
7140
|
});
|
|
7139
|
-
if (directLane) {
|
|
7140
|
-
return directLane;
|
|
7141
|
-
}
|
|
7142
7141
|
console.log({
|
|
7143
7142
|
directLane: directLane,
|
|
7144
7143
|
});
|
|
7144
|
+
if (directLane) {
|
|
7145
|
+
return directLane;
|
|
7146
|
+
}
|
|
7145
7147
|
// Se não encontrar rota direta, buscar rota inversa (Destino -> Origem)
|
|
7146
|
-
// Para isso, precisamos encontrar a UF da origem
|
|
7147
|
-
var originUf_1 = (
|
|
7148
|
+
// Para isso, precisamos encontrar a UF da origem e sua ratecardRegion
|
|
7149
|
+
var originUf_1 = (_f = (_e = cte.cityOrigin) === null || _e === void 0 ? void 0 : _e.state) === null || _f === void 0 ? void 0 : _f.uf;
|
|
7150
|
+
// Encontrar a ratecardRegion da cidade de origem
|
|
7151
|
+
var originRatecardRegionId_1 = (_h = (_g = ratecard === null || ratecard === void 0 ? void 0 : ratecard.RatecardRegionCity) === null || _g === void 0 ? void 0 : _g.find(function (regionCity) { return regionCity.cityId === cityOriginId; })) === null || _h === void 0 ? void 0 : _h.ratecardRegionId;
|
|
7148
7152
|
if (originUf_1) {
|
|
7149
7153
|
var reverseLane = ratecard.RatecardLane.find(function (i) {
|
|
7150
|
-
return i.cityOriginId === (cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.id) && i.ufDestination === originUf_1;
|
|
7154
|
+
return i.cityOriginId === (cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.id) && i.ufDestination === originUf_1 && i.ratecardRegionId === originRatecardRegionId_1;
|
|
7151
7155
|
});
|
|
7152
7156
|
console.log({
|
|
7153
7157
|
reverseLane: reverseLane,
|
package/build/index.esm.js.gz
CHANGED
|
Binary file
|