myio-js-library 0.1.310 → 0.1.312

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.
@@ -26220,6 +26220,7 @@
26220
26220
  --wm-logout-btn-border: ${p.logoutBtnBorder};
26221
26221
  --wm-card-bg: ${p.shoppingCardBg};
26222
26222
  --wm-card-border: ${p.shoppingCardBorder};
26223
+ --wm-font-scale: 1;
26223
26224
 
26224
26225
  position: fixed;
26225
26226
  inset: 0;
@@ -26621,7 +26622,7 @@
26621
26622
 
26622
26623
  .myio-welcome-card-title {
26623
26624
  margin: 0 !important;
26624
- font-size: 22px !important;
26625
+ font-size: calc(22px * var(--wm-font-scale)) !important;
26625
26626
  font-weight: 700 !important;
26626
26627
  color: var(--wm-ink);
26627
26628
  letter-spacing: 0.02em;
@@ -26630,7 +26631,7 @@
26630
26631
 
26631
26632
  .myio-welcome-card-subtitle {
26632
26633
  margin: 0 !important;
26633
- font-size: 13px !important;
26634
+ font-size: calc(13px * var(--wm-font-scale)) !important;
26634
26635
  font-weight: 400 !important;
26635
26636
  color: var(--wm-muted);
26636
26637
  }
@@ -26655,7 +26656,7 @@
26655
26656
  gap: 4px !important;
26656
26657
  padding: 4px 8px !important;
26657
26658
  min-width: 50px !important;
26658
- font-size: 11px !important;
26659
+ font-size: calc(11px * var(--wm-font-scale)) !important;
26659
26660
  font-weight: 600 !important;
26660
26661
  color: var(--wm-muted);
26661
26662
  background: rgba(0, 0, 0, 0.3);
@@ -26672,7 +26673,7 @@
26672
26673
  }
26673
26674
 
26674
26675
  .myio-welcome-card-device-count .value {
26675
- font-size: 10px !important;
26676
+ font-size: calc(10px * var(--wm-font-scale)) !important;
26676
26677
  font-weight: 400 !important;
26677
26678
  opacity: 0.85;
26678
26679
  white-space: nowrap;
@@ -26685,7 +26686,7 @@
26685
26686
  }
26686
26687
 
26687
26688
  .myio-welcome-card-device-count .icon {
26688
- font-size: 10px !important;
26689
+ font-size: calc(10px * var(--wm-font-scale)) !important;
26689
26690
  }
26690
26691
 
26691
26692
  .myio-welcome-card-device-count.energy:hover {
@@ -26835,7 +26836,7 @@
26835
26836
  }
26836
26837
 
26837
26838
  .myio-welcome-card-title {
26838
- font-size: 16px !important;
26839
+ font-size: calc(16px * var(--wm-font-scale)) !important;
26839
26840
  }
26840
26841
 
26841
26842
  .myio-welcome-card-device-counts {
@@ -26845,16 +26846,16 @@
26845
26846
 
26846
26847
  .myio-welcome-card-device-count {
26847
26848
  padding: 4px 8px;
26848
- font-size: 12px;
26849
+ font-size: calc(12px * var(--wm-font-scale));
26849
26850
  min-width: 52px !important;
26850
26851
  }
26851
26852
 
26852
26853
  .myio-welcome-card-device-count .icon {
26853
- font-size: 11px !important;
26854
+ font-size: calc(11px * var(--wm-font-scale)) !important;
26854
26855
  }
26855
26856
 
26856
26857
  .myio-welcome-card-device-count .value {
26857
- font-size: 11px !important;
26858
+ font-size: calc(11px * var(--wm-font-scale)) !important;
26858
26859
  }
26859
26860
  }
26860
26861
 
@@ -26923,7 +26924,7 @@
26923
26924
  }
26924
26925
 
26925
26926
  .myio-welcome-card-title {
26926
- font-size: 14px !important;
26927
+ font-size: calc(14px * var(--wm-font-scale)) !important;
26927
26928
  }
26928
26929
 
26929
26930
  .myio-welcome-card-device-counts {
@@ -26933,16 +26934,16 @@
26933
26934
 
26934
26935
  .myio-welcome-card-device-count {
26935
26936
  padding: 3px 6px;
26936
- font-size: 11px;
26937
+ font-size: calc(11px * var(--wm-font-scale));
26937
26938
  min-width: 44px !important;
26938
26939
  }
26939
26940
 
26940
26941
  .myio-welcome-card-device-count .icon {
26941
- font-size: 10px !important;
26942
+ font-size: calc(10px * var(--wm-font-scale)) !important;
26942
26943
  }
26943
26944
 
26944
26945
  .myio-welcome-card-device-count .value {
26945
- font-size: 10px !important;
26946
+ font-size: calc(10px * var(--wm-font-scale)) !important;
26946
26947
  }
26947
26948
 
26948
26949
  .myio-welcome-card-arrow {
@@ -27511,16 +27512,33 @@
27511
27512
  const fontSizeRange = this.container.querySelector("#fontSizeRange");
27512
27513
  const fontSizeValue = this.container.querySelector("#fontSizeValue");
27513
27514
  if (fontSizeRange && fontSizeValue) {
27515
+ const applyFontScale = (scale) => {
27516
+ const cardTitles = this.container.querySelectorAll(".myio-welcome-card-title");
27517
+ cardTitles.forEach((el) => {
27518
+ el.style.setProperty("font-size", `${22 * scale}px`, "important");
27519
+ });
27520
+ const cardSubtitles = this.container.querySelectorAll(".myio-welcome-card-subtitle");
27521
+ cardSubtitles.forEach((el) => {
27522
+ el.style.setProperty("font-size", `${13 * scale}px`, "important");
27523
+ });
27524
+ const deviceCounts = this.container.querySelectorAll(".myio-welcome-card-device-count");
27525
+ deviceCounts.forEach((el) => {
27526
+ el.style.setProperty("font-size", `${11 * scale}px`, "important");
27527
+ });
27528
+ const countValues = this.container.querySelectorAll(".myio-welcome-card-device-count .value");
27529
+ countValues.forEach((el) => {
27530
+ el.style.setProperty("font-size", `${10 * scale}px`, "important");
27531
+ });
27532
+ const countIcons = this.container.querySelectorAll(".myio-welcome-card-device-count .icon");
27533
+ countIcons.forEach((el) => {
27534
+ el.style.setProperty("font-size", `${10 * scale}px`, "important");
27535
+ });
27536
+ };
27514
27537
  fontSizeRange.addEventListener("input", () => {
27515
27538
  const value = parseInt(fontSizeRange.value, 10);
27516
27539
  fontSizeValue.textContent = `${value}%`;
27517
27540
  const scale = value / 100;
27518
- this.container.style.setProperty("--wm-font-scale", `${scale}`);
27519
- const deviceCounts = this.container.querySelectorAll(".myio-welcome-card-device-counts");
27520
- deviceCounts.forEach((el) => {
27521
- el.style.transform = `scale(${scale})`;
27522
- el.style.transformOrigin = "left center";
27523
- });
27541
+ applyFontScale(scale);
27524
27542
  });
27525
27543
  }
27526
27544
  this.bindTooltipEvents();
@@ -27743,12 +27761,13 @@
27743
27761
  temperatureDevices: temperatureItems.length
27744
27762
  });
27745
27763
  }
27764
+ const energyCategories = win.MyIOLibrary?.buildEquipmentCategoryDataForTooltip?.(energyItems) || [];
27746
27765
  return {
27747
27766
  energy: {
27748
27767
  totalDevices: energyItems.length,
27749
27768
  totalConsumption: energyTotal,
27750
27769
  unit: "kWh",
27751
- byCategory: [
27770
+ byCategory: energyCategories.length > 0 ? energyCategories : [
27752
27771
  {
27753
27772
  id: "equipamentos",
27754
27773
  name: "Equipamentos",
@@ -27756,8 +27775,9 @@
27756
27775
  deviceCount: energyItems.filter(
27757
27776
  (d) => d.deviceType !== "3F_MEDIDOR" || d.deviceProfile !== "3F_MEDIDOR"
27758
27777
  ).length,
27759
- consumption: 0,
27760
- percentage: 0
27778
+ consumption: energyTotal * 0.3,
27779
+ // Fallback estimate
27780
+ percentage: 30
27761
27781
  },
27762
27782
  {
27763
27783
  id: "lojas",
@@ -27766,42 +27786,49 @@
27766
27786
  deviceCount: energyItems.filter(
27767
27787
  (d) => d.deviceType === "3F_MEDIDOR" && d.deviceProfile === "3F_MEDIDOR"
27768
27788
  ).length,
27769
- consumption: 0,
27770
- percentage: 0
27789
+ consumption: energyTotal * 0.7,
27790
+ // Fallback estimate
27791
+ percentage: 70
27771
27792
  }
27772
27793
  ],
27773
27794
  byStatus: aggregateStatus(energyItems),
27774
27795
  lastUpdated: now,
27775
27796
  customerName: card.title
27776
27797
  },
27777
- water: {
27778
- totalDevices: waterItems.length,
27779
- totalConsumption: waterTotal,
27780
- unit: "m\xB3",
27781
- byCategory: [
27782
- {
27783
- id: "areaComum",
27784
- name: "\xC1rea Comum",
27785
- icon: "\u{1F3E2}",
27786
- deviceCount: waterItems.filter((d) => (d.deviceProfile || "").includes("AREA_COMUM")).length,
27787
- consumption: 0,
27788
- percentage: 0
27789
- },
27790
- {
27791
- id: "lojas",
27792
- name: "Lojas",
27793
- icon: "\u{1F3EA}",
27794
- deviceCount: waterItems.filter(
27795
- (d) => !(d.deviceProfile || "").includes("AREA_COMUM") && !(d.deviceProfile || "").includes("SHOPPING")
27796
- ).length,
27797
- consumption: 0,
27798
- percentage: 0
27799
- }
27800
- ],
27801
- byStatus: aggregateStatus(waterItems),
27802
- lastUpdated: now,
27803
- customerName: card.title
27804
- },
27798
+ water: (() => {
27799
+ const areaComumItems = waterItems.filter((d) => (d.deviceProfile || "").includes("AREA_COMUM"));
27800
+ const lojaItems = waterItems.filter(
27801
+ (d) => !(d.deviceProfile || "").includes("AREA_COMUM") && !(d.deviceProfile || "").includes("SHOPPING")
27802
+ );
27803
+ const areaComumConsumption = areaComumItems.reduce((sum, d) => sum + Number(d.value || d.pulses || 0), 0);
27804
+ const lojasConsumption = lojaItems.reduce((sum, d) => sum + Number(d.value || d.pulses || 0), 0);
27805
+ return {
27806
+ totalDevices: waterItems.length,
27807
+ totalConsumption: waterTotal,
27808
+ unit: "m\xB3",
27809
+ byCategory: [
27810
+ {
27811
+ id: "areaComum",
27812
+ name: "\xC1rea Comum",
27813
+ icon: "\u{1F3E2}",
27814
+ deviceCount: areaComumItems.length,
27815
+ consumption: areaComumConsumption,
27816
+ percentage: waterTotal > 0 ? areaComumConsumption / waterTotal * 100 : 0
27817
+ },
27818
+ {
27819
+ id: "lojas",
27820
+ name: "Lojas",
27821
+ icon: "\u{1F3EA}",
27822
+ deviceCount: lojaItems.length,
27823
+ consumption: lojasConsumption,
27824
+ percentage: waterTotal > 0 ? lojasConsumption / waterTotal * 100 : 0
27825
+ }
27826
+ ],
27827
+ byStatus: aggregateStatus(waterItems),
27828
+ lastUpdated: now,
27829
+ customerName: card.title
27830
+ };
27831
+ })(),
27805
27832
  temperature: {
27806
27833
  devices: temperatureItems.map((d) => ({
27807
27834
  name: d.label || d.name || "Sensor",
@@ -31296,6 +31323,12 @@
31296
31323
  if (!ingestionToken2) {
31297
31324
  throw new Error("Ingestion token not available");
31298
31325
  }
31326
+ const credentials = win.MyIOUtils?.getCredentials?.() || {};
31327
+ const clientId = credentials.clientId;
31328
+ const clientSecret = credentials.clientSecret;
31329
+ if (!clientId || !clientSecret) {
31330
+ this.log.warn("clientId/clientSecret not found in MyIOUtils.getCredentials()");
31331
+ }
31299
31332
  const dataSources = entities.map((entity) => ({
31300
31333
  type: "device",
31301
31334
  id: entity.ingestionId || entity.id,
@@ -31320,6 +31353,8 @@
31320
31353
  startDate: start,
31321
31354
  endDate: end,
31322
31355
  granularity,
31356
+ clientId,
31357
+ clientSecret,
31323
31358
  chartsBaseUrl: this.chartsBaseUrl,
31324
31359
  dataApiHost: this.dataApiHost,
31325
31360
  theme: this.params.theme ?? "dark",
@@ -61974,7 +62009,7 @@ ${errors.slice(0, 5).join("\n")}` + (errors.length > 5 ? `
61974
62009
  }
61975
62010
  if (this.state.filters.selectedShoppingIds.length > 0) {
61976
62011
  filtered = filtered.filter(
61977
- (d) => this.state.filters.selectedShoppingIds.includes(d.customerId)
62012
+ (d) => this.state.filters.selectedShoppingIds.includes(d.customerId) || this.state.filters.selectedShoppingIds.includes(d.ingestionId)
61978
62013
  );
61979
62014
  }
61980
62015
  if (this.state.filters.selectedDeviceIds && this.state.filters.selectedDeviceIds.size > 0) {