b2m-utils 0.0.296 → 0.0.297

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.
@@ -1442,7 +1442,17 @@ var getCtesFeesResult = function (feesToCalc, cte, allFeesForCalc) {
1442
1442
  if (totalPercentageFees.length > 0) {
1443
1443
  console.log("\n\uD83D\uDD04 [getCtesFeesResult] Calculando ".concat(totalPercentageFees.length, " fees TOTAL_PERCENTAGE"));
1444
1444
  console.log("\uD83D\uDCCB Fees: ".concat(totalPercentageFees.map(function (f) { var _a; return "".concat((_a = f.fee) === null || _a === void 0 ? void 0 : _a.name, " (").concat(f.value, "%)"); }).join(', ')));
1445
- var percentageFeesCache = calculateTotalPercentageFees(feesToCalc, cte, allFeesForCalc);
1445
+ // Criar Map com valores já calculados das fees normais (respeitando lógica de siblings)
1446
+ var preCalculatedValues_1 = new Map();
1447
+ results.forEach(function (r) {
1448
+ var _a;
1449
+ var fee = feesToCalc.find(function (f) { return f.feeId === r.feeId; });
1450
+ if ((_a = fee === null || fee === void 0 ? void 0 : fee.fee) === null || _a === void 0 ? void 0 : _a.id) {
1451
+ preCalculatedValues_1.set(fee.fee.id, r.total);
1452
+ }
1453
+ });
1454
+ console.log("\uD83D\uDCCA Usando ".concat(preCalculatedValues_1.size, " valores pr\u00E9-calculados"));
1455
+ var percentageFeesCache = calculateTotalPercentageFees(feesToCalc, cte, allFeesForCalc, preCalculatedValues_1);
1446
1456
  console.log("\u2705 Cache gerado com ".concat(percentageFeesCache.size, " fees"));
1447
1457
  for (var _g = 0, totalPercentageFees_1 = totalPercentageFees; _g < totalPercentageFees_1.length; _g++) {
1448
1458
  var item = totalPercentageFees_1[_g];
Binary file