myio-js-library 0.1.46 → 0.1.48

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/dist/index.cjs CHANGED
@@ -7058,11 +7058,20 @@ var AllReportModal = class {
7058
7058
  loadBtn?.addEventListener("click", () => this.loadData());
7059
7059
  exportBtn?.addEventListener("click", () => this.exportCSV());
7060
7060
  filterBtn?.addEventListener("click", () => this.openFilterModal());
7061
- searchInput?.addEventListener("input", (e) => {
7062
- this.searchFilter = e.target.value.toLowerCase();
7063
- this.currentPage = 1;
7064
- this.renderTable();
7065
- });
7061
+ if (searchInput) {
7062
+ searchInput.addEventListener("input", (e) => {
7063
+ this.searchFilter = e.target.value.toLowerCase();
7064
+ this.currentPage = 1;
7065
+ this.renderTable();
7066
+ this.renderPagination();
7067
+ });
7068
+ searchInput.addEventListener("keyup", (e) => {
7069
+ this.searchFilter = e.target.value.toLowerCase();
7070
+ this.currentPage = 1;
7071
+ this.renderTable();
7072
+ this.renderPagination();
7073
+ });
7074
+ }
7066
7075
  try {
7067
7076
  this.dateRangePicker = await attach(dateRangeInput, {
7068
7077
  presetStart: this.getDefaultStartDate(),
@@ -7472,6 +7481,8 @@ var AllReportModal = class {
7472
7481
  mapCustomerTotalsResponse(apiResponse) {
7473
7482
  this.debugLog("\u{1F50D} Starting mapCustomerTotalsResponse", { apiResponse });
7474
7483
  const apiArray = Array.isArray(apiResponse?.data) ? apiResponse.data : Array.isArray(apiResponse) ? apiResponse : [];
7484
+ console.log("[AllReportModal] NEW MAPPING - API array length:", apiArray.length);
7485
+ console.log("[AllReportModal] NEW MAPPING - ItemsList length:", this.params.itemsList.length);
7475
7486
  this.debugLog("\u{1F4CB} API data array extracted", {
7476
7487
  isDataProperty: !!apiResponse?.data,
7477
7488
  isDirectArray: Array.isArray(apiResponse),
@@ -7485,9 +7496,20 @@ var AllReportModal = class {
7485
7496
  }
7486
7497
  const sumByApiId = /* @__PURE__ */ new Map();
7487
7498
  let apiItemsWithoutId = 0;
7499
+ let totalApiConsumption = 0;
7488
7500
  this.debugLog("\u{1F528} Building ID index from API data...");
7489
7501
  for (const [index, item] of apiArray.entries()) {
7490
7502
  const consumption = this.pickConsumption(item);
7503
+ totalApiConsumption += consumption;
7504
+ if (index < 3) {
7505
+ console.log(`[AllReportModal] NEW MAPPING - API item ${index}:`, {
7506
+ id: item?.id,
7507
+ name: item?.name,
7508
+ assetName: item?.assetName,
7509
+ total_value: item?.total_value,
7510
+ extractedConsumption: consumption
7511
+ });
7512
+ }
7491
7513
  this.debugLog(`\u{1F4CA} Processing API item ${index}`, {
7492
7514
  item,
7493
7515
  extractedConsumption: consumption,
@@ -7503,17 +7525,28 @@ var AllReportModal = class {
7503
7525
  this.debugLog(`\u274C API item without ID:`, item);
7504
7526
  }
7505
7527
  }
7528
+ console.log("[AllReportModal] NEW MAPPING - Total API consumption:", totalApiConsumption);
7529
+ console.log("[AllReportModal] NEW MAPPING - Unique API IDs:", sumByApiId.size);
7506
7530
  this.debugLog("\u{1F4CA} ID index built", {
7507
7531
  sumByApiIdSize: sumByApiId.size,
7508
7532
  sumByApiIdEntries: Array.from(sumByApiId.entries()),
7509
7533
  apiItemsWithoutId
7510
7534
  });
7511
7535
  let matchedById = 0, matchedBySubstring = 0;
7536
+ let totalMappedConsumption = 0;
7512
7537
  this.debugLog("\u{1F3AF} Starting itemsList mapping...");
7513
7538
  const rows = this.params.itemsList.map((listItem, index) => {
7514
7539
  this.debugLog(`\u{1F50D} Processing listItem ${index}`, listItem);
7515
7540
  let consumption = sumByApiId.get(listItem.id) ?? 0;
7516
7541
  this.debugLog(`\u{1F3AF} Primary ID match for ${listItem.id}: ${consumption}`);
7542
+ if (index < 3) {
7543
+ console.log(`[AllReportModal] NEW MAPPING - ItemsList item ${index}:`, {
7544
+ id: listItem.id,
7545
+ identifier: listItem.identifier,
7546
+ label: listItem.label,
7547
+ idMatchConsumption: consumption
7548
+ });
7549
+ }
7517
7550
  if (consumption > 0) {
7518
7551
  matchedById++;
7519
7552
  this.debugLog(`\u2705 Matched by ID: ${listItem.id} -> ${consumption}`);
@@ -7527,6 +7560,14 @@ var AllReportModal = class {
7527
7560
  if (assetNameMatch || nameMatch) {
7528
7561
  const itemConsumption = this.pickConsumption(apiItem);
7529
7562
  consumption += itemConsumption;
7563
+ if (index < 3) {
7564
+ console.log(`[AllReportModal] NEW MAPPING - Substring match for ${listItem.identifier}:`, {
7565
+ apiItemName: name,
7566
+ apiItemAssetName: assetName,
7567
+ itemConsumption,
7568
+ totalConsumption: consumption
7569
+ });
7570
+ }
7530
7571
  this.debugLog(`\u2705 Substring match found in API item ${apiIndex}`, {
7531
7572
  listItemIdentifier: listItem.identifier,
7532
7573
  apiItemAssetName: assetName,
@@ -7550,6 +7591,7 @@ var AllReportModal = class {
7550
7591
  name: listItem.label,
7551
7592
  consumption: Math.round(consumption * 100) / 100
7552
7593
  };
7594
+ totalMappedConsumption += result.consumption;
7553
7595
  this.debugLog(`\u{1F4DD} Final row for ${listItem.identifier}:`, result);
7554
7596
  return result;
7555
7597
  });
@@ -7560,8 +7602,11 @@ var AllReportModal = class {
7560
7602
  matchedById,
7561
7603
  matchedBySubstring,
7562
7604
  unmatched: this.params.itemsList.length - matchedById - matchedBySubstring,
7563
- apiItemsWithoutId
7605
+ apiItemsWithoutId,
7606
+ totalApiConsumption,
7607
+ totalMappedConsumption
7564
7608
  };
7609
+ console.log("[AllReportModal] NEW MAPPING - Final stats:", stats);
7565
7610
  this.debugLog("\u{1F4CA} Final mapping stats:", stats);
7566
7611
  console.log("[AllReportModal] Mapping stats:", stats);
7567
7612
  return rows;
package/dist/index.js CHANGED
@@ -6991,11 +6991,20 @@ var AllReportModal = class {
6991
6991
  loadBtn?.addEventListener("click", () => this.loadData());
6992
6992
  exportBtn?.addEventListener("click", () => this.exportCSV());
6993
6993
  filterBtn?.addEventListener("click", () => this.openFilterModal());
6994
- searchInput?.addEventListener("input", (e) => {
6995
- this.searchFilter = e.target.value.toLowerCase();
6996
- this.currentPage = 1;
6997
- this.renderTable();
6998
- });
6994
+ if (searchInput) {
6995
+ searchInput.addEventListener("input", (e) => {
6996
+ this.searchFilter = e.target.value.toLowerCase();
6997
+ this.currentPage = 1;
6998
+ this.renderTable();
6999
+ this.renderPagination();
7000
+ });
7001
+ searchInput.addEventListener("keyup", (e) => {
7002
+ this.searchFilter = e.target.value.toLowerCase();
7003
+ this.currentPage = 1;
7004
+ this.renderTable();
7005
+ this.renderPagination();
7006
+ });
7007
+ }
6999
7008
  try {
7000
7009
  this.dateRangePicker = await attach(dateRangeInput, {
7001
7010
  presetStart: this.getDefaultStartDate(),
@@ -7405,6 +7414,8 @@ var AllReportModal = class {
7405
7414
  mapCustomerTotalsResponse(apiResponse) {
7406
7415
  this.debugLog("\u{1F50D} Starting mapCustomerTotalsResponse", { apiResponse });
7407
7416
  const apiArray = Array.isArray(apiResponse?.data) ? apiResponse.data : Array.isArray(apiResponse) ? apiResponse : [];
7417
+ console.log("[AllReportModal] NEW MAPPING - API array length:", apiArray.length);
7418
+ console.log("[AllReportModal] NEW MAPPING - ItemsList length:", this.params.itemsList.length);
7408
7419
  this.debugLog("\u{1F4CB} API data array extracted", {
7409
7420
  isDataProperty: !!apiResponse?.data,
7410
7421
  isDirectArray: Array.isArray(apiResponse),
@@ -7418,9 +7429,20 @@ var AllReportModal = class {
7418
7429
  }
7419
7430
  const sumByApiId = /* @__PURE__ */ new Map();
7420
7431
  let apiItemsWithoutId = 0;
7432
+ let totalApiConsumption = 0;
7421
7433
  this.debugLog("\u{1F528} Building ID index from API data...");
7422
7434
  for (const [index, item] of apiArray.entries()) {
7423
7435
  const consumption = this.pickConsumption(item);
7436
+ totalApiConsumption += consumption;
7437
+ if (index < 3) {
7438
+ console.log(`[AllReportModal] NEW MAPPING - API item ${index}:`, {
7439
+ id: item?.id,
7440
+ name: item?.name,
7441
+ assetName: item?.assetName,
7442
+ total_value: item?.total_value,
7443
+ extractedConsumption: consumption
7444
+ });
7445
+ }
7424
7446
  this.debugLog(`\u{1F4CA} Processing API item ${index}`, {
7425
7447
  item,
7426
7448
  extractedConsumption: consumption,
@@ -7436,17 +7458,28 @@ var AllReportModal = class {
7436
7458
  this.debugLog(`\u274C API item without ID:`, item);
7437
7459
  }
7438
7460
  }
7461
+ console.log("[AllReportModal] NEW MAPPING - Total API consumption:", totalApiConsumption);
7462
+ console.log("[AllReportModal] NEW MAPPING - Unique API IDs:", sumByApiId.size);
7439
7463
  this.debugLog("\u{1F4CA} ID index built", {
7440
7464
  sumByApiIdSize: sumByApiId.size,
7441
7465
  sumByApiIdEntries: Array.from(sumByApiId.entries()),
7442
7466
  apiItemsWithoutId
7443
7467
  });
7444
7468
  let matchedById = 0, matchedBySubstring = 0;
7469
+ let totalMappedConsumption = 0;
7445
7470
  this.debugLog("\u{1F3AF} Starting itemsList mapping...");
7446
7471
  const rows = this.params.itemsList.map((listItem, index) => {
7447
7472
  this.debugLog(`\u{1F50D} Processing listItem ${index}`, listItem);
7448
7473
  let consumption = sumByApiId.get(listItem.id) ?? 0;
7449
7474
  this.debugLog(`\u{1F3AF} Primary ID match for ${listItem.id}: ${consumption}`);
7475
+ if (index < 3) {
7476
+ console.log(`[AllReportModal] NEW MAPPING - ItemsList item ${index}:`, {
7477
+ id: listItem.id,
7478
+ identifier: listItem.identifier,
7479
+ label: listItem.label,
7480
+ idMatchConsumption: consumption
7481
+ });
7482
+ }
7450
7483
  if (consumption > 0) {
7451
7484
  matchedById++;
7452
7485
  this.debugLog(`\u2705 Matched by ID: ${listItem.id} -> ${consumption}`);
@@ -7460,6 +7493,14 @@ var AllReportModal = class {
7460
7493
  if (assetNameMatch || nameMatch) {
7461
7494
  const itemConsumption = this.pickConsumption(apiItem);
7462
7495
  consumption += itemConsumption;
7496
+ if (index < 3) {
7497
+ console.log(`[AllReportModal] NEW MAPPING - Substring match for ${listItem.identifier}:`, {
7498
+ apiItemName: name,
7499
+ apiItemAssetName: assetName,
7500
+ itemConsumption,
7501
+ totalConsumption: consumption
7502
+ });
7503
+ }
7463
7504
  this.debugLog(`\u2705 Substring match found in API item ${apiIndex}`, {
7464
7505
  listItemIdentifier: listItem.identifier,
7465
7506
  apiItemAssetName: assetName,
@@ -7483,6 +7524,7 @@ var AllReportModal = class {
7483
7524
  name: listItem.label,
7484
7525
  consumption: Math.round(consumption * 100) / 100
7485
7526
  };
7527
+ totalMappedConsumption += result.consumption;
7486
7528
  this.debugLog(`\u{1F4DD} Final row for ${listItem.identifier}:`, result);
7487
7529
  return result;
7488
7530
  });
@@ -7493,8 +7535,11 @@ var AllReportModal = class {
7493
7535
  matchedById,
7494
7536
  matchedBySubstring,
7495
7537
  unmatched: this.params.itemsList.length - matchedById - matchedBySubstring,
7496
- apiItemsWithoutId
7538
+ apiItemsWithoutId,
7539
+ totalApiConsumption,
7540
+ totalMappedConsumption
7497
7541
  };
7542
+ console.log("[AllReportModal] NEW MAPPING - Final stats:", stats);
7498
7543
  this.debugLog("\u{1F4CA} Final mapping stats:", stats);
7499
7544
  console.log("[AllReportModal] Mapping stats:", stats);
7500
7545
  return rows;
@@ -6980,11 +6980,20 @@
6980
6980
  loadBtn?.addEventListener("click", () => this.loadData());
6981
6981
  exportBtn?.addEventListener("click", () => this.exportCSV());
6982
6982
  filterBtn?.addEventListener("click", () => this.openFilterModal());
6983
- searchInput?.addEventListener("input", (e) => {
6984
- this.searchFilter = e.target.value.toLowerCase();
6985
- this.currentPage = 1;
6986
- this.renderTable();
6987
- });
6983
+ if (searchInput) {
6984
+ searchInput.addEventListener("input", (e) => {
6985
+ this.searchFilter = e.target.value.toLowerCase();
6986
+ this.currentPage = 1;
6987
+ this.renderTable();
6988
+ this.renderPagination();
6989
+ });
6990
+ searchInput.addEventListener("keyup", (e) => {
6991
+ this.searchFilter = e.target.value.toLowerCase();
6992
+ this.currentPage = 1;
6993
+ this.renderTable();
6994
+ this.renderPagination();
6995
+ });
6996
+ }
6988
6997
  try {
6989
6998
  this.dateRangePicker = await attach(dateRangeInput, {
6990
6999
  presetStart: this.getDefaultStartDate(),
@@ -7394,6 +7403,8 @@
7394
7403
  mapCustomerTotalsResponse(apiResponse) {
7395
7404
  this.debugLog("\u{1F50D} Starting mapCustomerTotalsResponse", { apiResponse });
7396
7405
  const apiArray = Array.isArray(apiResponse?.data) ? apiResponse.data : Array.isArray(apiResponse) ? apiResponse : [];
7406
+ console.log("[AllReportModal] NEW MAPPING - API array length:", apiArray.length);
7407
+ console.log("[AllReportModal] NEW MAPPING - ItemsList length:", this.params.itemsList.length);
7397
7408
  this.debugLog("\u{1F4CB} API data array extracted", {
7398
7409
  isDataProperty: !!apiResponse?.data,
7399
7410
  isDirectArray: Array.isArray(apiResponse),
@@ -7407,9 +7418,20 @@
7407
7418
  }
7408
7419
  const sumByApiId = /* @__PURE__ */ new Map();
7409
7420
  let apiItemsWithoutId = 0;
7421
+ let totalApiConsumption = 0;
7410
7422
  this.debugLog("\u{1F528} Building ID index from API data...");
7411
7423
  for (const [index, item] of apiArray.entries()) {
7412
7424
  const consumption = this.pickConsumption(item);
7425
+ totalApiConsumption += consumption;
7426
+ if (index < 3) {
7427
+ console.log(`[AllReportModal] NEW MAPPING - API item ${index}:`, {
7428
+ id: item?.id,
7429
+ name: item?.name,
7430
+ assetName: item?.assetName,
7431
+ total_value: item?.total_value,
7432
+ extractedConsumption: consumption
7433
+ });
7434
+ }
7413
7435
  this.debugLog(`\u{1F4CA} Processing API item ${index}`, {
7414
7436
  item,
7415
7437
  extractedConsumption: consumption,
@@ -7425,17 +7447,28 @@
7425
7447
  this.debugLog(`\u274C API item without ID:`, item);
7426
7448
  }
7427
7449
  }
7450
+ console.log("[AllReportModal] NEW MAPPING - Total API consumption:", totalApiConsumption);
7451
+ console.log("[AllReportModal] NEW MAPPING - Unique API IDs:", sumByApiId.size);
7428
7452
  this.debugLog("\u{1F4CA} ID index built", {
7429
7453
  sumByApiIdSize: sumByApiId.size,
7430
7454
  sumByApiIdEntries: Array.from(sumByApiId.entries()),
7431
7455
  apiItemsWithoutId
7432
7456
  });
7433
7457
  let matchedById = 0, matchedBySubstring = 0;
7458
+ let totalMappedConsumption = 0;
7434
7459
  this.debugLog("\u{1F3AF} Starting itemsList mapping...");
7435
7460
  const rows = this.params.itemsList.map((listItem, index) => {
7436
7461
  this.debugLog(`\u{1F50D} Processing listItem ${index}`, listItem);
7437
7462
  let consumption = sumByApiId.get(listItem.id) ?? 0;
7438
7463
  this.debugLog(`\u{1F3AF} Primary ID match for ${listItem.id}: ${consumption}`);
7464
+ if (index < 3) {
7465
+ console.log(`[AllReportModal] NEW MAPPING - ItemsList item ${index}:`, {
7466
+ id: listItem.id,
7467
+ identifier: listItem.identifier,
7468
+ label: listItem.label,
7469
+ idMatchConsumption: consumption
7470
+ });
7471
+ }
7439
7472
  if (consumption > 0) {
7440
7473
  matchedById++;
7441
7474
  this.debugLog(`\u2705 Matched by ID: ${listItem.id} -> ${consumption}`);
@@ -7449,6 +7482,14 @@
7449
7482
  if (assetNameMatch || nameMatch) {
7450
7483
  const itemConsumption = this.pickConsumption(apiItem);
7451
7484
  consumption += itemConsumption;
7485
+ if (index < 3) {
7486
+ console.log(`[AllReportModal] NEW MAPPING - Substring match for ${listItem.identifier}:`, {
7487
+ apiItemName: name,
7488
+ apiItemAssetName: assetName,
7489
+ itemConsumption,
7490
+ totalConsumption: consumption
7491
+ });
7492
+ }
7452
7493
  this.debugLog(`\u2705 Substring match found in API item ${apiIndex}`, {
7453
7494
  listItemIdentifier: listItem.identifier,
7454
7495
  apiItemAssetName: assetName,
@@ -7472,6 +7513,7 @@
7472
7513
  name: listItem.label,
7473
7514
  consumption: Math.round(consumption * 100) / 100
7474
7515
  };
7516
+ totalMappedConsumption += result.consumption;
7475
7517
  this.debugLog(`\u{1F4DD} Final row for ${listItem.identifier}:`, result);
7476
7518
  return result;
7477
7519
  });
@@ -7482,8 +7524,11 @@
7482
7524
  matchedById,
7483
7525
  matchedBySubstring,
7484
7526
  unmatched: this.params.itemsList.length - matchedById - matchedBySubstring,
7485
- apiItemsWithoutId
7527
+ apiItemsWithoutId,
7528
+ totalApiConsumption,
7529
+ totalMappedConsumption
7486
7530
  };
7531
+ console.log("[AllReportModal] NEW MAPPING - Final stats:", stats);
7487
7532
  this.debugLog("\u{1F4CA} Final mapping stats:", stats);
7488
7533
  console.log("[AllReportModal] Mapping stats:", stats);
7489
7534
  return rows;