myio-js-library 0.1.214 → 0.1.217

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.
@@ -28848,13 +28848,31 @@
28848
28848
  };
28849
28849
 
28850
28850
  // src/components/premium-modals/settings/SettingsFetcher.ts
28851
- var DefaultSettingsFetcher = class {
28851
+ var DefaultSettingsFetcher = class _DefaultSettingsFetcher {
28852
28852
  jwtToken;
28853
28853
  tbBaseUrl;
28854
+ static FETCH_TIMEOUT_MS = 8e3;
28855
+ // 8 second timeout
28854
28856
  constructor(jwtToken, apiConfig) {
28855
28857
  this.jwtToken = jwtToken;
28856
28858
  this.tbBaseUrl = apiConfig?.tbBaseUrl || window.location.origin;
28857
28859
  }
28860
+ /**
28861
+ * Fetch with timeout to prevent hanging requests from blocking modal render
28862
+ */
28863
+ async fetchWithTimeout(url, options, timeoutMs = _DefaultSettingsFetcher.FETCH_TIMEOUT_MS) {
28864
+ const controller = new AbortController();
28865
+ const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
28866
+ try {
28867
+ const response = await fetch(url, {
28868
+ ...options,
28869
+ signal: controller.signal
28870
+ });
28871
+ return response;
28872
+ } finally {
28873
+ clearTimeout(timeoutId);
28874
+ }
28875
+ }
28858
28876
  async fetchCurrentSettings(deviceId, jwtToken, scope = "SERVER_SCOPE") {
28859
28877
  try {
28860
28878
  const [entityResult, attributesResult] = await Promise.allSettled([
@@ -28888,9 +28906,12 @@
28888
28906
  }
28889
28907
  }
28890
28908
  async fetchDeviceEntity(deviceId) {
28891
- const response = await fetch(`${this.tbBaseUrl}/api/device/${deviceId}`, {
28892
- headers: { "X-Authorization": `Bearer ${this.jwtToken}` }
28893
- });
28909
+ const response = await this.fetchWithTimeout(
28910
+ `${this.tbBaseUrl}/api/device/${deviceId}`,
28911
+ {
28912
+ headers: { "X-Authorization": `Bearer ${this.jwtToken}` }
28913
+ }
28914
+ );
28894
28915
  if (!response.ok) {
28895
28916
  throw new Error(
28896
28917
  `Failed to fetch device entity: ${response.status} ${response.statusText}`
@@ -28902,7 +28923,7 @@
28902
28923
  };
28903
28924
  }
28904
28925
  async fetchDeviceAttributes(deviceId, scope) {
28905
- const response = await fetch(
28926
+ const response = await this.fetchWithTimeout(
28906
28927
  `${this.tbBaseUrl}/api/plugins/telemetry/DEVICE/${deviceId}/values/attributes/${scope}`,
28907
28928
  {
28908
28929
  headers: { "X-Authorization": `Bearer ${this.jwtToken}` }
@@ -29111,12 +29132,16 @@
29111
29132
  const tbBaseUrl = this.params.api?.tbBaseUrl || window.location.origin;
29112
29133
  const url = `${tbBaseUrl}/api/plugins/telemetry/CUSTOMER/${customerId}/values/attributes/SERVER_SCOPE?keys=mapInstantaneousPower`;
29113
29134
  console.log("[SettingsModal] RFC-0080: Fetching GLOBAL from:", url);
29135
+ const controller = new AbortController();
29136
+ const timeoutId = setTimeout(() => controller.abort(), 8e3);
29114
29137
  const response = await fetch(url, {
29115
29138
  headers: {
29116
29139
  "X-Authorization": `Bearer ${jwtToken}`,
29117
29140
  "Content-Type": "application/json"
29118
- }
29141
+ },
29142
+ signal: controller.signal
29119
29143
  });
29144
+ clearTimeout(timeoutId);
29120
29145
  if (!response.ok) {
29121
29146
  throw new Error(`HTTP ${response.status}`);
29122
29147
  }
@@ -43353,6 +43378,1064 @@
43353
43378
  }
43354
43379
  }
43355
43380
 
43381
+ // src/components/premium-modals/measurement-setup/types.ts
43382
+ var WATER_UNITS = [
43383
+ { value: "m3", label: "Metros C\xFAbicos (m\xB3)" },
43384
+ { value: "liters", label: "Litros (L)" }
43385
+ ];
43386
+ var ENERGY_UNITS = [
43387
+ { value: "auto", label: "Autom\xE1tico (kWh/MWh)" },
43388
+ { value: "kwh", label: "Quilowatt-hora (kWh)" },
43389
+ { value: "mwh", label: "Megawatt-hora (MWh)" }
43390
+ ];
43391
+ var TEMPERATURE_UNITS = [
43392
+ { value: "celsius", label: "Celsius (\xB0C)" },
43393
+ { value: "fahrenheit", label: "Fahrenheit (\xB0F)" }
43394
+ ];
43395
+ var DECIMAL_OPTIONS = [
43396
+ { value: 0, label: "0 casas" },
43397
+ { value: 1, label: "1 casa" },
43398
+ { value: 2, label: "2 casas" },
43399
+ { value: 3, label: "3 casas" },
43400
+ { value: 4, label: "4 casas" },
43401
+ { value: 5, label: "5 casas" },
43402
+ { value: 6, label: "6 casas" }
43403
+ ];
43404
+ var DOMAIN_CONFIG5 = {
43405
+ water: {
43406
+ icon: "\u{1F4A7}",
43407
+ label: "\xC1gua",
43408
+ color: "#3b82f6",
43409
+ bgColor: "rgba(59, 130, 246, 0.1)"
43410
+ },
43411
+ energy: {
43412
+ icon: "\u26A1",
43413
+ label: "Energia",
43414
+ color: "#f59e0b",
43415
+ bgColor: "rgba(245, 158, 11, 0.1)"
43416
+ },
43417
+ temperature: {
43418
+ icon: "\u{1F321}\uFE0F",
43419
+ label: "Temperatura",
43420
+ color: "#ef4444",
43421
+ bgColor: "rgba(239, 68, 68, 0.1)"
43422
+ }
43423
+ };
43424
+ var DEFAULT_SETTINGS = {
43425
+ version: "1.0.0",
43426
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
43427
+ water: {
43428
+ unit: "m3",
43429
+ decimalPlaces: 3,
43430
+ autoScale: true
43431
+ },
43432
+ energy: {
43433
+ unit: "auto",
43434
+ decimalPlaces: 3,
43435
+ forceUnit: false
43436
+ },
43437
+ temperature: {
43438
+ unit: "celsius",
43439
+ decimalPlaces: 1
43440
+ }
43441
+ };
43442
+
43443
+ // src/components/premium-modals/measurement-setup/MeasurementSetupView.ts
43444
+ var MeasurementSetupView = class {
43445
+ container = null;
43446
+ overlayEl = null;
43447
+ config;
43448
+ formData;
43449
+ isLoading = false;
43450
+ isSaving = false;
43451
+ constructor(config) {
43452
+ this.config = config;
43453
+ this.formData = {
43454
+ water: { ...DEFAULT_SETTINGS.water },
43455
+ energy: { ...DEFAULT_SETTINGS.energy },
43456
+ temperature: { ...DEFAULT_SETTINGS.temperature }
43457
+ };
43458
+ }
43459
+ render(targetContainer) {
43460
+ this.overlayEl = document.createElement("div");
43461
+ this.overlayEl.className = "myio-measurement-setup-overlay";
43462
+ this.overlayEl.innerHTML = `
43463
+ <style>${this.getStyles()}</style>
43464
+ <div class="myio-measurement-setup-card">
43465
+ ${this.renderHeader()}
43466
+ <div class="myio-measurement-setup-body">
43467
+ ${this.renderWaterSection()}
43468
+ ${this.renderEnergySection()}
43469
+ ${this.renderTemperatureSection()}
43470
+ </div>
43471
+ ${this.renderToolbar()}
43472
+ ${this.renderLoadingState()}
43473
+ ${this.renderErrorState()}
43474
+ ${this.renderSuccessState()}
43475
+ </div>
43476
+ `;
43477
+ const target = targetContainer || document.body;
43478
+ target.appendChild(this.overlayEl);
43479
+ this.container = this.overlayEl.querySelector(".myio-measurement-setup-card");
43480
+ this.setupEventListeners();
43481
+ requestAnimationFrame(() => {
43482
+ this.overlayEl?.classList.add("active");
43483
+ });
43484
+ return this.overlayEl;
43485
+ }
43486
+ renderHeader() {
43487
+ return `
43488
+ <div class="myio-modal-header">
43489
+ <h2 class="myio-modal-title">\u{1F4D0} Configura\xE7\xE3o de Medidas</h2>
43490
+ <button class="myio-modal-close" id="msm-close-btn" type="button" aria-label="Fechar modal">\xD7</button>
43491
+ </div>
43492
+ `;
43493
+ }
43494
+ renderWaterSection() {
43495
+ const cfg = DOMAIN_CONFIG5.water;
43496
+ return `
43497
+ <div class="myio-measurement-section" style="--section-color: ${cfg.color}; --section-bg: ${cfg.bgColor};">
43498
+ <div class="myio-section-header">
43499
+ <span class="myio-section-icon">${cfg.icon}</span>
43500
+ <span class="myio-section-title">${cfg.label}</span>
43501
+ </div>
43502
+ <div class="myio-section-content">
43503
+ <div class="myio-form-group">
43504
+ <label for="msm-water-unit">Unidade</label>
43505
+ <select id="msm-water-unit" class="myio-select">
43506
+ ${WATER_UNITS.map((u) => `
43507
+ <option value="${u.value}" ${u.value === this.formData.water.unit ? "selected" : ""}>
43508
+ ${u.label}
43509
+ </option>
43510
+ `).join("")}
43511
+ </select>
43512
+ </div>
43513
+ <div class="myio-form-group">
43514
+ <label for="msm-water-decimals">Casas Decimais</label>
43515
+ <select id="msm-water-decimals" class="myio-select">
43516
+ ${DECIMAL_OPTIONS.map((d) => `
43517
+ <option value="${d.value}" ${d.value === this.formData.water.decimalPlaces ? "selected" : ""}>
43518
+ ${d.label}
43519
+ </option>
43520
+ `).join("")}
43521
+ </select>
43522
+ </div>
43523
+ <div class="myio-form-group myio-checkbox-group">
43524
+ <label class="myio-checkbox-label">
43525
+ <input type="checkbox" id="msm-water-autoscale" ${this.formData.water.autoScale ? "checked" : ""}>
43526
+ <span class="myio-checkbox-text">Escala autom\xE1tica (L\u2194m\xB3)</span>
43527
+ </label>
43528
+ <span class="myio-form-hint">Converte automaticamente entre unidades</span>
43529
+ </div>
43530
+ </div>
43531
+ <div class="myio-section-preview">
43532
+ <span class="myio-preview-label">Exemplo:</span>
43533
+ <span class="myio-preview-value" id="msm-water-preview">1.234,567 m\xB3</span>
43534
+ </div>
43535
+ </div>
43536
+ `;
43537
+ }
43538
+ renderEnergySection() {
43539
+ const cfg = DOMAIN_CONFIG5.energy;
43540
+ return `
43541
+ <div class="myio-measurement-section" style="--section-color: ${cfg.color}; --section-bg: ${cfg.bgColor};">
43542
+ <div class="myio-section-header">
43543
+ <span class="myio-section-icon">${cfg.icon}</span>
43544
+ <span class="myio-section-title">${cfg.label}</span>
43545
+ </div>
43546
+ <div class="myio-section-content">
43547
+ <div class="myio-form-group">
43548
+ <label for="msm-energy-unit">Unidade</label>
43549
+ <select id="msm-energy-unit" class="myio-select">
43550
+ ${ENERGY_UNITS.map((u) => `
43551
+ <option value="${u.value}" ${u.value === this.formData.energy.unit ? "selected" : ""}>
43552
+ ${u.label}
43553
+ </option>
43554
+ `).join("")}
43555
+ </select>
43556
+ </div>
43557
+ <div class="myio-form-group">
43558
+ <label for="msm-energy-decimals">Casas Decimais</label>
43559
+ <select id="msm-energy-decimals" class="myio-select">
43560
+ ${DECIMAL_OPTIONS.filter((d) => d.value <= 4).map((d) => `
43561
+ <option value="${d.value}" ${d.value === this.formData.energy.decimalPlaces ? "selected" : ""}>
43562
+ ${d.label}
43563
+ </option>
43564
+ `).join("")}
43565
+ </select>
43566
+ </div>
43567
+ <div class="myio-form-group myio-checkbox-group">
43568
+ <label class="myio-checkbox-label">
43569
+ <input type="checkbox" id="msm-energy-forceunit" ${this.formData.energy.forceUnit ? "checked" : ""}>
43570
+ <span class="myio-checkbox-text">For\xE7ar unidade selecionada</span>
43571
+ </label>
43572
+ <span class="myio-form-hint">Quando ativo, n\xE3o converte automaticamente kWh\u2194MWh</span>
43573
+ </div>
43574
+ </div>
43575
+ <div class="myio-section-preview">
43576
+ <span class="myio-preview-label">Exemplo:</span>
43577
+ <span class="myio-preview-value" id="msm-energy-preview">1.234,567 kWh</span>
43578
+ </div>
43579
+ </div>
43580
+ `;
43581
+ }
43582
+ renderTemperatureSection() {
43583
+ const cfg = DOMAIN_CONFIG5.temperature;
43584
+ return `
43585
+ <div class="myio-measurement-section" style="--section-color: ${cfg.color}; --section-bg: ${cfg.bgColor};">
43586
+ <div class="myio-section-header">
43587
+ <span class="myio-section-icon">${cfg.icon}</span>
43588
+ <span class="myio-section-title">${cfg.label}</span>
43589
+ </div>
43590
+ <div class="myio-section-content">
43591
+ <div class="myio-form-group">
43592
+ <label for="msm-temp-unit">Unidade</label>
43593
+ <select id="msm-temp-unit" class="myio-select">
43594
+ ${TEMPERATURE_UNITS.map((u) => `
43595
+ <option value="${u.value}" ${u.value === this.formData.temperature.unit ? "selected" : ""}>
43596
+ ${u.label}
43597
+ </option>
43598
+ `).join("")}
43599
+ </select>
43600
+ </div>
43601
+ <div class="myio-form-group">
43602
+ <label for="msm-temp-decimals">Casas Decimais</label>
43603
+ <select id="msm-temp-decimals" class="myio-select">
43604
+ ${DECIMAL_OPTIONS.filter((d) => d.value <= 3).map((d) => `
43605
+ <option value="${d.value}" ${d.value === this.formData.temperature.decimalPlaces ? "selected" : ""}>
43606
+ ${d.label}
43607
+ </option>
43608
+ `).join("")}
43609
+ </select>
43610
+ </div>
43611
+ </div>
43612
+ <div class="myio-section-preview">
43613
+ <span class="myio-preview-label">Exemplo:</span>
43614
+ <span class="myio-preview-value" id="msm-temp-preview">23,5 \xB0C</span>
43615
+ </div>
43616
+ </div>
43617
+ `;
43618
+ }
43619
+ renderToolbar() {
43620
+ return `
43621
+ <div class="myio-measurement-setup-toolbar">
43622
+ <div class="myio-toolbar-actions">
43623
+ <button class="myio-btn myio-btn-secondary" id="msm-reset-btn" type="button">
43624
+ Restaurar Padr\xE3o
43625
+ </button>
43626
+ <button class="myio-btn myio-btn-primary" id="msm-save-btn" type="button">
43627
+ <span class="myio-btn-text">Salvar</span>
43628
+ <span class="myio-btn-spinner" style="display: none;"></span>
43629
+ </button>
43630
+ </div>
43631
+ </div>
43632
+ `;
43633
+ }
43634
+ renderLoadingState() {
43635
+ return `
43636
+ <div class="myio-measurement-setup-loading" id="msm-loading" style="display: none;">
43637
+ <div class="myio-spinner"></div>
43638
+ <span>Carregando configura\xE7\xE3o...</span>
43639
+ </div>
43640
+ `;
43641
+ }
43642
+ renderErrorState() {
43643
+ return `
43644
+ <div class="myio-measurement-setup-error" id="msm-error" style="display: none;">
43645
+ <span class="myio-error-icon">&#x26A0;</span>
43646
+ <span class="myio-error-message" id="msm-error-msg"></span>
43647
+ </div>
43648
+ `;
43649
+ }
43650
+ renderSuccessState() {
43651
+ return `
43652
+ <div class="myio-measurement-setup-success" id="msm-success" style="display: none;">
43653
+ <span class="myio-success-icon">&#x2713;</span>
43654
+ <span class="myio-success-message">Configura\xE7\xE3o salva com sucesso!</span>
43655
+ </div>
43656
+ `;
43657
+ }
43658
+ setupEventListeners() {
43659
+ if (!this.overlayEl) return;
43660
+ const closeBtn = this.overlayEl.querySelector("#msm-close-btn");
43661
+ closeBtn?.addEventListener("click", () => this.close());
43662
+ this.overlayEl.addEventListener("click", (e) => {
43663
+ if (e.target === this.overlayEl) {
43664
+ this.close();
43665
+ }
43666
+ });
43667
+ document.addEventListener("keydown", this.handleKeyDown);
43668
+ const saveBtn = this.overlayEl.querySelector("#msm-save-btn");
43669
+ saveBtn?.addEventListener("click", () => this.handleSave());
43670
+ const resetBtn = this.overlayEl.querySelector("#msm-reset-btn");
43671
+ resetBtn?.addEventListener("click", () => this.handleReset());
43672
+ const waterUnit = this.overlayEl.querySelector("#msm-water-unit");
43673
+ const waterDecimals = this.overlayEl.querySelector("#msm-water-decimals");
43674
+ const waterAutoScale = this.overlayEl.querySelector("#msm-water-autoscale");
43675
+ waterUnit?.addEventListener("change", (e) => {
43676
+ this.formData.water.unit = e.target.value;
43677
+ this.updatePreviews();
43678
+ });
43679
+ waterDecimals?.addEventListener("change", (e) => {
43680
+ this.formData.water.decimalPlaces = parseInt(e.target.value, 10);
43681
+ this.updatePreviews();
43682
+ });
43683
+ waterAutoScale?.addEventListener("change", (e) => {
43684
+ this.formData.water.autoScale = e.target.checked;
43685
+ });
43686
+ const energyUnit = this.overlayEl.querySelector("#msm-energy-unit");
43687
+ const energyDecimals = this.overlayEl.querySelector("#msm-energy-decimals");
43688
+ const energyForceUnit = this.overlayEl.querySelector("#msm-energy-forceunit");
43689
+ energyUnit?.addEventListener("change", (e) => {
43690
+ this.formData.energy.unit = e.target.value;
43691
+ this.updatePreviews();
43692
+ });
43693
+ energyDecimals?.addEventListener("change", (e) => {
43694
+ this.formData.energy.decimalPlaces = parseInt(e.target.value, 10);
43695
+ this.updatePreviews();
43696
+ });
43697
+ energyForceUnit?.addEventListener("change", (e) => {
43698
+ this.formData.energy.forceUnit = e.target.checked;
43699
+ });
43700
+ const tempUnit = this.overlayEl.querySelector("#msm-temp-unit");
43701
+ const tempDecimals = this.overlayEl.querySelector("#msm-temp-decimals");
43702
+ tempUnit?.addEventListener("change", (e) => {
43703
+ this.formData.temperature.unit = e.target.value;
43704
+ this.updatePreviews();
43705
+ });
43706
+ tempDecimals?.addEventListener("change", (e) => {
43707
+ this.formData.temperature.decimalPlaces = parseInt(e.target.value, 10);
43708
+ this.updatePreviews();
43709
+ });
43710
+ this.updatePreviews();
43711
+ }
43712
+ updatePreviews() {
43713
+ const waterPreview = this.overlayEl?.querySelector("#msm-water-preview");
43714
+ if (waterPreview) {
43715
+ const sampleValue = 1234.567;
43716
+ const unit = this.formData.water.unit === "liters" ? "L" : "m\xB3";
43717
+ const displayValue = this.formData.water.unit === "liters" ? sampleValue * 1e3 : sampleValue;
43718
+ waterPreview.textContent = this.formatNumber(displayValue, this.formData.water.decimalPlaces) + " " + unit;
43719
+ }
43720
+ const energyPreview = this.overlayEl?.querySelector("#msm-energy-preview");
43721
+ if (energyPreview) {
43722
+ const sampleValueKwh = 1234.567;
43723
+ let displayValue = sampleValueKwh;
43724
+ let unit = "kWh";
43725
+ if (this.formData.energy.unit === "mwh") {
43726
+ displayValue = sampleValueKwh / 1e3;
43727
+ unit = "MWh";
43728
+ } else if (this.formData.energy.unit === "auto" && sampleValueKwh > 1e3) {
43729
+ displayValue = sampleValueKwh / 1e3;
43730
+ unit = "MWh";
43731
+ }
43732
+ energyPreview.textContent = this.formatNumber(displayValue, this.formData.energy.decimalPlaces) + " " + unit;
43733
+ }
43734
+ const tempPreview = this.overlayEl?.querySelector("#msm-temp-preview");
43735
+ if (tempPreview) {
43736
+ const sampleCelsius = 23.5;
43737
+ let displayValue = sampleCelsius;
43738
+ let unit = "\xB0C";
43739
+ if (this.formData.temperature.unit === "fahrenheit") {
43740
+ displayValue = sampleCelsius * 9 / 5 + 32;
43741
+ unit = "\xB0F";
43742
+ }
43743
+ tempPreview.textContent = this.formatNumber(displayValue, this.formData.temperature.decimalPlaces) + " " + unit;
43744
+ }
43745
+ }
43746
+ formatNumber(value, decimals) {
43747
+ const parts = value.toFixed(decimals).split(".");
43748
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
43749
+ return decimals > 0 ? parts.join(",") : parts[0];
43750
+ }
43751
+ handleKeyDown = (e) => {
43752
+ if (e.key === "Escape") {
43753
+ this.close();
43754
+ }
43755
+ };
43756
+ async handleSave() {
43757
+ if (this.isSaving) return;
43758
+ this.isSaving = true;
43759
+ this.showSaveLoading(true);
43760
+ this.hideError();
43761
+ this.hideSuccess();
43762
+ try {
43763
+ await this.config.onSave();
43764
+ this.showSuccess();
43765
+ setTimeout(() => this.hideSuccess(), 3e3);
43766
+ } catch (error) {
43767
+ this.showError(error.message || "Falha ao salvar configura\xE7\xE3o");
43768
+ } finally {
43769
+ this.isSaving = false;
43770
+ this.showSaveLoading(false);
43771
+ }
43772
+ }
43773
+ handleReset() {
43774
+ this.formData = {
43775
+ water: { ...DEFAULT_SETTINGS.water },
43776
+ energy: { ...DEFAULT_SETTINGS.energy },
43777
+ temperature: { ...DEFAULT_SETTINGS.temperature }
43778
+ };
43779
+ this.updateFormInputs();
43780
+ this.updatePreviews();
43781
+ this.hideError();
43782
+ this.hideSuccess();
43783
+ }
43784
+ updateFormInputs() {
43785
+ const waterUnit = this.overlayEl?.querySelector("#msm-water-unit");
43786
+ const waterDecimals = this.overlayEl?.querySelector("#msm-water-decimals");
43787
+ const waterAutoScale = this.overlayEl?.querySelector("#msm-water-autoscale");
43788
+ if (waterUnit) waterUnit.value = this.formData.water.unit;
43789
+ if (waterDecimals) waterDecimals.value = String(this.formData.water.decimalPlaces);
43790
+ if (waterAutoScale) waterAutoScale.checked = this.formData.water.autoScale;
43791
+ const energyUnit = this.overlayEl?.querySelector("#msm-energy-unit");
43792
+ const energyDecimals = this.overlayEl?.querySelector("#msm-energy-decimals");
43793
+ const energyForceUnit = this.overlayEl?.querySelector("#msm-energy-forceunit");
43794
+ if (energyUnit) energyUnit.value = this.formData.energy.unit;
43795
+ if (energyDecimals) energyDecimals.value = String(this.formData.energy.decimalPlaces);
43796
+ if (energyForceUnit) energyForceUnit.checked = this.formData.energy.forceUnit;
43797
+ const tempUnit = this.overlayEl?.querySelector("#msm-temp-unit");
43798
+ const tempDecimals = this.overlayEl?.querySelector("#msm-temp-decimals");
43799
+ if (tempUnit) tempUnit.value = this.formData.temperature.unit;
43800
+ if (tempDecimals) tempDecimals.value = String(this.formData.temperature.decimalPlaces);
43801
+ }
43802
+ close() {
43803
+ document.removeEventListener("keydown", this.handleKeyDown);
43804
+ if (this.overlayEl) {
43805
+ this.overlayEl.classList.remove("active");
43806
+ setTimeout(() => {
43807
+ this.overlayEl?.remove();
43808
+ this.overlayEl = null;
43809
+ this.container = null;
43810
+ this.config.onClose();
43811
+ }, 300);
43812
+ }
43813
+ }
43814
+ destroy() {
43815
+ document.removeEventListener("keydown", this.handleKeyDown);
43816
+ this.overlayEl?.remove();
43817
+ this.overlayEl = null;
43818
+ this.container = null;
43819
+ }
43820
+ showLoading() {
43821
+ this.isLoading = true;
43822
+ const loadingEl = this.overlayEl?.querySelector("#msm-loading");
43823
+ const bodyEl = this.overlayEl?.querySelector(".myio-measurement-setup-body");
43824
+ if (loadingEl) loadingEl.style.display = "flex";
43825
+ if (bodyEl) bodyEl.style.opacity = "0.5";
43826
+ }
43827
+ hideLoading() {
43828
+ this.isLoading = false;
43829
+ const loadingEl = this.overlayEl?.querySelector("#msm-loading");
43830
+ const bodyEl = this.overlayEl?.querySelector(".myio-measurement-setup-body");
43831
+ if (loadingEl) loadingEl.style.display = "none";
43832
+ if (bodyEl) bodyEl.style.opacity = "1";
43833
+ }
43834
+ showSaveLoading(show) {
43835
+ const saveBtn = this.overlayEl?.querySelector("#msm-save-btn");
43836
+ const btnText = saveBtn?.querySelector(".myio-btn-text");
43837
+ const btnSpinner = saveBtn?.querySelector(".myio-btn-spinner");
43838
+ if (saveBtn) saveBtn.disabled = show;
43839
+ if (btnText) btnText.style.display = show ? "none" : "inline";
43840
+ if (btnSpinner) btnSpinner.style.display = show ? "inline-block" : "none";
43841
+ }
43842
+ showError(message) {
43843
+ const errorEl = this.overlayEl?.querySelector("#msm-error");
43844
+ const errorMsg = this.overlayEl?.querySelector("#msm-error-msg");
43845
+ if (errorEl) errorEl.style.display = "flex";
43846
+ if (errorMsg) errorMsg.textContent = message;
43847
+ }
43848
+ hideError() {
43849
+ const errorEl = this.overlayEl?.querySelector("#msm-error");
43850
+ if (errorEl) errorEl.style.display = "none";
43851
+ }
43852
+ showSuccess() {
43853
+ const successEl = this.overlayEl?.querySelector("#msm-success");
43854
+ if (successEl) successEl.style.display = "flex";
43855
+ }
43856
+ hideSuccess() {
43857
+ const successEl = this.overlayEl?.querySelector("#msm-success");
43858
+ if (successEl) successEl.style.display = "none";
43859
+ }
43860
+ getFormData() {
43861
+ return {
43862
+ water: { ...this.formData.water },
43863
+ energy: { ...this.formData.energy },
43864
+ temperature: { ...this.formData.temperature }
43865
+ };
43866
+ }
43867
+ setFormData(data) {
43868
+ if (data.water) this.formData.water = { ...data.water };
43869
+ if (data.energy) this.formData.energy = { ...data.energy };
43870
+ if (data.temperature) this.formData.temperature = { ...data.temperature };
43871
+ this.updateFormInputs();
43872
+ this.updatePreviews();
43873
+ }
43874
+ getStyles() {
43875
+ const styles = this.config.styles || {};
43876
+ const primaryColor = styles.primaryColor || "#4A148C";
43877
+ const successColor = styles.successColor || "#22c55e";
43878
+ const dangerColor = styles.dangerColor || "#ef4444";
43879
+ return `
43880
+ .myio-measurement-setup-overlay {
43881
+ position: fixed;
43882
+ top: 0;
43883
+ left: 0;
43884
+ right: 0;
43885
+ bottom: 0;
43886
+ background: rgba(0, 0, 0, 0.6);
43887
+ display: flex;
43888
+ align-items: center;
43889
+ justify-content: center;
43890
+ z-index: ${styles.zIndex || 1e4};
43891
+ opacity: 0;
43892
+ visibility: hidden;
43893
+ transition: all 0.3s ease;
43894
+ font-family: ${styles.fontFamily || "'Roboto', Arial, sans-serif"};
43895
+ }
43896
+
43897
+ .myio-measurement-setup-overlay.active {
43898
+ opacity: 1;
43899
+ visibility: visible;
43900
+ }
43901
+
43902
+ .myio-measurement-setup-card {
43903
+ background: ${styles.backgroundColor || "#ffffff"};
43904
+ border-radius: ${styles.borderRadius || "8px"};
43905
+ width: 90%;
43906
+ max-width: 580px;
43907
+ max-height: 90vh;
43908
+ overflow-y: auto;
43909
+ transform: scale(0.9);
43910
+ transition: transform 0.3s ease;
43911
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
43912
+ }
43913
+
43914
+ .myio-measurement-setup-overlay.active .myio-measurement-setup-card {
43915
+ transform: scale(1);
43916
+ }
43917
+
43918
+ /* Header */
43919
+ .myio-modal-header {
43920
+ display: flex;
43921
+ align-items: center;
43922
+ justify-content: space-between;
43923
+ padding: 6px 12px;
43924
+ background: ${primaryColor};
43925
+ border-radius: 8px 8px 0 0;
43926
+ min-height: 18px;
43927
+ }
43928
+
43929
+ .myio-modal-title {
43930
+ margin: 4px;
43931
+ font-size: 14px;
43932
+ font-weight: 600;
43933
+ color: white;
43934
+ line-height: 1.5;
43935
+ }
43936
+
43937
+ .myio-modal-close {
43938
+ background: none;
43939
+ border: none;
43940
+ font-size: 18px;
43941
+ cursor: pointer;
43942
+ padding: 2px 8px;
43943
+ border-radius: 4px;
43944
+ color: rgba(255, 255, 255, 0.8);
43945
+ transition: background-color 0.2s, color 0.2s;
43946
+ line-height: 1;
43947
+ }
43948
+
43949
+ .myio-modal-close:hover {
43950
+ background-color: rgba(255, 255, 255, 0.2);
43951
+ color: white;
43952
+ }
43953
+
43954
+ /* Body */
43955
+ .myio-measurement-setup-body {
43956
+ padding: 12px 16px;
43957
+ display: flex;
43958
+ flex-direction: column;
43959
+ gap: 10px;
43960
+ transition: opacity 0.3s;
43961
+ }
43962
+
43963
+ /* Section cards */
43964
+ .myio-measurement-section {
43965
+ background: var(--section-bg);
43966
+ border: 1px solid var(--section-color);
43967
+ border-radius: 6px;
43968
+ padding: 10px 12px;
43969
+ transition: transform 0.2s, box-shadow 0.2s;
43970
+ }
43971
+
43972
+ .myio-measurement-section:hover {
43973
+ transform: translateY(-1px);
43974
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
43975
+ }
43976
+
43977
+ .myio-section-header {
43978
+ display: flex;
43979
+ align-items: center;
43980
+ gap: 6px;
43981
+ margin-bottom: 8px;
43982
+ padding-bottom: 6px;
43983
+ border-bottom: 1px solid rgba(0, 0, 0, 0.08);
43984
+ }
43985
+
43986
+ .myio-section-icon {
43987
+ font-size: 16px;
43988
+ line-height: 1;
43989
+ }
43990
+
43991
+ .myio-section-title {
43992
+ font-weight: 600;
43993
+ font-size: 13px;
43994
+ color: #1f2937;
43995
+ }
43996
+
43997
+ .myio-section-content {
43998
+ display: grid;
43999
+ grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
44000
+ gap: 10px;
44001
+ }
44002
+
44003
+ .myio-section-preview {
44004
+ margin-top: 8px;
44005
+ padding-top: 6px;
44006
+ border-top: 1px dashed rgba(0, 0, 0, 0.08);
44007
+ display: flex;
44008
+ align-items: center;
44009
+ gap: 6px;
44010
+ }
44011
+
44012
+ .myio-preview-label {
44013
+ font-size: 11px;
44014
+ color: #6b7280;
44015
+ }
44016
+
44017
+ .myio-preview-value {
44018
+ font-size: 13px;
44019
+ font-weight: 600;
44020
+ color: var(--section-color);
44021
+ font-family: 'Consolas', 'Monaco', monospace;
44022
+ }
44023
+
44024
+ /* Form elements */
44025
+ .myio-form-group {
44026
+ display: flex;
44027
+ flex-direction: column;
44028
+ gap: 3px;
44029
+ }
44030
+
44031
+ .myio-form-group label {
44032
+ font-size: 11px;
44033
+ font-weight: 500;
44034
+ color: #374151;
44035
+ }
44036
+
44037
+ .myio-select {
44038
+ padding: 6px 8px;
44039
+ border: 1px solid #d1d5db;
44040
+ border-radius: 4px;
44041
+ font-size: 12px;
44042
+ background: white;
44043
+ color: #1f2937;
44044
+ transition: border-color 0.2s, box-shadow 0.2s;
44045
+ cursor: pointer;
44046
+ }
44047
+
44048
+ .myio-select:focus {
44049
+ outline: none;
44050
+ border-color: ${primaryColor};
44051
+ box-shadow: 0 0 0 2px ${this.hexToRgba(primaryColor, 0.1)};
44052
+ }
44053
+
44054
+ .myio-checkbox-group {
44055
+ grid-column: 1 / -1;
44056
+ }
44057
+
44058
+ .myio-checkbox-label {
44059
+ display: flex;
44060
+ align-items: center;
44061
+ gap: 6px;
44062
+ cursor: pointer;
44063
+ }
44064
+
44065
+ .myio-checkbox-label input[type="checkbox"] {
44066
+ width: 14px;
44067
+ height: 14px;
44068
+ accent-color: ${primaryColor};
44069
+ cursor: pointer;
44070
+ }
44071
+
44072
+ .myio-checkbox-text {
44073
+ font-size: 12px;
44074
+ color: #374151;
44075
+ }
44076
+
44077
+ .myio-form-hint {
44078
+ font-size: 10px;
44079
+ color: #9ca3af;
44080
+ margin-top: 2px;
44081
+ }
44082
+
44083
+ /* Toolbar */
44084
+ .myio-measurement-setup-toolbar {
44085
+ display: flex;
44086
+ justify-content: flex-end;
44087
+ padding: 10px 16px;
44088
+ background: #f9fafb;
44089
+ border-top: 1px solid #e5e7eb;
44090
+ border-radius: 0 0 8px 8px;
44091
+ }
44092
+
44093
+ .myio-toolbar-actions {
44094
+ display: flex;
44095
+ align-items: center;
44096
+ gap: 8px;
44097
+ }
44098
+
44099
+ .myio-btn {
44100
+ padding: 6px 14px;
44101
+ border-radius: ${styles.buttonRadius || "4px"};
44102
+ font-size: 12px;
44103
+ font-weight: 500;
44104
+ cursor: pointer;
44105
+ border: none;
44106
+ transition: all 0.2s;
44107
+ display: inline-flex;
44108
+ align-items: center;
44109
+ gap: 4px;
44110
+ }
44111
+
44112
+ .myio-btn:disabled {
44113
+ opacity: 0.6;
44114
+ cursor: not-allowed;
44115
+ }
44116
+
44117
+ .myio-btn-primary {
44118
+ background: ${primaryColor};
44119
+ color: white;
44120
+ }
44121
+
44122
+ .myio-btn-primary:hover:not(:disabled) {
44123
+ background: ${this.lightenColor(primaryColor, -10)};
44124
+ }
44125
+
44126
+ .myio-btn-secondary {
44127
+ background: #e5e7eb;
44128
+ color: #374151;
44129
+ }
44130
+
44131
+ .myio-btn-secondary:hover:not(:disabled) {
44132
+ background: #d1d5db;
44133
+ }
44134
+
44135
+ .myio-btn-spinner {
44136
+ width: 12px;
44137
+ height: 12px;
44138
+ border: 2px solid white;
44139
+ border-top-color: transparent;
44140
+ border-radius: 50%;
44141
+ animation: spin 0.8s linear infinite;
44142
+ }
44143
+
44144
+ @keyframes spin {
44145
+ to { transform: rotate(360deg); }
44146
+ }
44147
+
44148
+ /* Loading, Error, Success states */
44149
+ .myio-measurement-setup-loading,
44150
+ .myio-measurement-setup-error,
44151
+ .myio-measurement-setup-success {
44152
+ display: flex;
44153
+ align-items: center;
44154
+ justify-content: center;
44155
+ gap: 8px;
44156
+ padding: 8px 12px;
44157
+ margin: 0 16px 12px;
44158
+ border-radius: 4px;
44159
+ font-size: 12px;
44160
+ }
44161
+
44162
+ .myio-measurement-setup-loading {
44163
+ background: #f3f4f6;
44164
+ color: #6b7280;
44165
+ }
44166
+
44167
+ .myio-measurement-setup-error {
44168
+ background: #fef2f2;
44169
+ color: ${dangerColor};
44170
+ border: 1px solid ${dangerColor};
44171
+ }
44172
+
44173
+ .myio-measurement-setup-success {
44174
+ background: #f0fdf4;
44175
+ color: ${successColor};
44176
+ border: 1px solid ${successColor};
44177
+ }
44178
+
44179
+ .myio-spinner {
44180
+ width: 16px;
44181
+ height: 16px;
44182
+ border: 2px solid #e5e7eb;
44183
+ border-top-color: ${primaryColor};
44184
+ border-radius: 50%;
44185
+ animation: spin 0.8s linear infinite;
44186
+ }
44187
+
44188
+ .myio-error-icon, .myio-success-icon {
44189
+ font-size: 14px;
44190
+ }
44191
+
44192
+ @media (max-width: 500px) {
44193
+ .myio-section-content {
44194
+ grid-template-columns: 1fr;
44195
+ }
44196
+
44197
+ .myio-toolbar-actions {
44198
+ flex-direction: column;
44199
+ width: 100%;
44200
+ }
44201
+
44202
+ .myio-btn {
44203
+ width: 100%;
44204
+ justify-content: center;
44205
+ }
44206
+ }
44207
+ `;
44208
+ }
44209
+ lightenColor(hex, percent) {
44210
+ const num = parseInt(hex.replace("#", ""), 16);
44211
+ const amt = Math.round(2.55 * percent);
44212
+ const R = (num >> 16) + amt;
44213
+ const G = (num >> 8 & 255) + amt;
44214
+ const B = (num & 255) + amt;
44215
+ return "#" + (16777216 + (R < 255 ? R < 1 ? 0 : R : 255) * 65536 + (G < 255 ? G < 1 ? 0 : G : 255) * 256 + (B < 255 ? B < 1 ? 0 : B : 255)).toString(16).slice(1);
44216
+ }
44217
+ hexToRgba(hex, alpha) {
44218
+ const num = parseInt(hex.replace("#", ""), 16);
44219
+ const R = num >> 16;
44220
+ const G = num >> 8 & 255;
44221
+ const B = num & 255;
44222
+ return `rgba(${R}, ${G}, ${B}, ${alpha})`;
44223
+ }
44224
+ };
44225
+
44226
+ // src/components/premium-modals/measurement-setup/MeasurementSetupPersister.ts
44227
+ var MeasurementSetupPersister = class _MeasurementSetupPersister {
44228
+ token;
44229
+ tbBaseUrl;
44230
+ static ATTRIBUTE_KEY = "measurementDisplaySettings";
44231
+ static FETCH_TIMEOUT_MS = 8e3;
44232
+ constructor(token, tbBaseUrl) {
44233
+ this.token = token;
44234
+ this.tbBaseUrl = tbBaseUrl || window.location.origin;
44235
+ }
44236
+ /**
44237
+ * Fetch with timeout to prevent hanging requests
44238
+ */
44239
+ async fetchWithTimeout(url, options, timeoutMs = _MeasurementSetupPersister.FETCH_TIMEOUT_MS) {
44240
+ const controller = new AbortController();
44241
+ const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
44242
+ try {
44243
+ const response = await fetch(url, {
44244
+ ...options,
44245
+ signal: controller.signal
44246
+ });
44247
+ return response;
44248
+ } finally {
44249
+ clearTimeout(timeoutId);
44250
+ }
44251
+ }
44252
+ /**
44253
+ * Load measurement settings from customer SERVER_SCOPE
44254
+ */
44255
+ async loadSettings(customerId) {
44256
+ try {
44257
+ const url = `${this.tbBaseUrl}/api/plugins/telemetry/CUSTOMER/${customerId}/values/attributes/SERVER_SCOPE?keys=${_MeasurementSetupPersister.ATTRIBUTE_KEY}`;
44258
+ console.log("[MeasurementSetupPersister] Loading settings from:", url);
44259
+ const response = await this.fetchWithTimeout(url, {
44260
+ headers: {
44261
+ "X-Authorization": `Bearer ${this.token}`,
44262
+ "Content-Type": "application/json"
44263
+ }
44264
+ });
44265
+ if (!response.ok) {
44266
+ console.warn(`[MeasurementSetupPersister] HTTP ${response.status}: ${response.statusText}`);
44267
+ return null;
44268
+ }
44269
+ const attrs = await response.json();
44270
+ const settingsAttr = attrs.find((a) => a.key === _MeasurementSetupPersister.ATTRIBUTE_KEY);
44271
+ if (!settingsAttr) {
44272
+ console.log("[MeasurementSetupPersister] No existing settings found, using defaults");
44273
+ return null;
44274
+ }
44275
+ const value = typeof settingsAttr.value === "string" ? JSON.parse(settingsAttr.value) : settingsAttr.value;
44276
+ console.log("[MeasurementSetupPersister] Loaded settings:", value);
44277
+ return this.validateAndMergeSettings(value);
44278
+ } catch (error) {
44279
+ console.error("[MeasurementSetupPersister] Failed to load settings:", error);
44280
+ return null;
44281
+ }
44282
+ }
44283
+ /**
44284
+ * Save measurement settings to customer SERVER_SCOPE
44285
+ */
44286
+ async saveSettings(customerId, settings) {
44287
+ try {
44288
+ const url = `${this.tbBaseUrl}/api/plugins/telemetry/CUSTOMER/${customerId}/attributes/SERVER_SCOPE`;
44289
+ console.log("[MeasurementSetupPersister] Saving settings to:", url);
44290
+ const payload = {
44291
+ [_MeasurementSetupPersister.ATTRIBUTE_KEY]: JSON.stringify(settings)
44292
+ };
44293
+ const response = await this.fetchWithTimeout(url, {
44294
+ method: "POST",
44295
+ headers: {
44296
+ "X-Authorization": `Bearer ${this.token}`,
44297
+ "Content-Type": "application/json"
44298
+ },
44299
+ body: JSON.stringify(payload)
44300
+ });
44301
+ if (!response.ok) {
44302
+ const errorText = await response.text();
44303
+ console.error("[MeasurementSetupPersister] Save failed:", response.status, errorText);
44304
+ return {
44305
+ ok: false,
44306
+ error: {
44307
+ code: response.status === 401 ? "AUTH_ERROR" : "NETWORK_ERROR",
44308
+ message: `Failed to save settings: HTTP ${response.status}`,
44309
+ cause: errorText
44310
+ }
44311
+ };
44312
+ }
44313
+ console.log("[MeasurementSetupPersister] Settings saved successfully");
44314
+ return { ok: true, settings };
44315
+ } catch (error) {
44316
+ console.error("[MeasurementSetupPersister] Save error:", error);
44317
+ return {
44318
+ ok: false,
44319
+ error: {
44320
+ code: "UNKNOWN_ERROR",
44321
+ message: error.message || "Failed to save settings",
44322
+ cause: error
44323
+ }
44324
+ };
44325
+ }
44326
+ }
44327
+ /**
44328
+ * Validate and merge settings with defaults to ensure all fields exist
44329
+ */
44330
+ validateAndMergeSettings(settings) {
44331
+ return {
44332
+ version: settings.version || DEFAULT_SETTINGS.version,
44333
+ updatedAt: settings.updatedAt || DEFAULT_SETTINGS.updatedAt,
44334
+ updatedBy: settings.updatedBy,
44335
+ water: {
44336
+ unit: settings.water?.unit || DEFAULT_SETTINGS.water.unit,
44337
+ decimalPlaces: settings.water?.decimalPlaces ?? DEFAULT_SETTINGS.water.decimalPlaces,
44338
+ autoScale: settings.water?.autoScale ?? DEFAULT_SETTINGS.water.autoScale
44339
+ },
44340
+ energy: {
44341
+ unit: settings.energy?.unit || DEFAULT_SETTINGS.energy.unit,
44342
+ decimalPlaces: settings.energy?.decimalPlaces ?? DEFAULT_SETTINGS.energy.decimalPlaces,
44343
+ forceUnit: settings.energy?.forceUnit ?? DEFAULT_SETTINGS.energy.forceUnit
44344
+ },
44345
+ temperature: {
44346
+ unit: settings.temperature?.unit || DEFAULT_SETTINGS.temperature.unit,
44347
+ decimalPlaces: settings.temperature?.decimalPlaces ?? DEFAULT_SETTINGS.temperature.decimalPlaces
44348
+ }
44349
+ };
44350
+ }
44351
+ /**
44352
+ * Convert form data to full settings object for persistence
44353
+ */
44354
+ formDataToSettings(formData, existingSettings) {
44355
+ return {
44356
+ version: existingSettings?.version || DEFAULT_SETTINGS.version,
44357
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
44358
+ updatedBy: existingSettings?.updatedBy,
44359
+ water: { ...formData.water },
44360
+ energy: { ...formData.energy },
44361
+ temperature: { ...formData.temperature }
44362
+ };
44363
+ }
44364
+ /**
44365
+ * Extract form data from settings
44366
+ */
44367
+ settingsToFormData(settings) {
44368
+ const s = settings || DEFAULT_SETTINGS;
44369
+ return {
44370
+ water: { ...s.water },
44371
+ energy: { ...s.energy },
44372
+ temperature: { ...s.temperature }
44373
+ };
44374
+ }
44375
+ };
44376
+
44377
+ // src/components/premium-modals/measurement-setup/openMeasurementSetupModal.ts
44378
+ async function openMeasurementSetupModal(params) {
44379
+ if (!params.token) {
44380
+ throw new Error("[MeasurementSetupModal] token is required");
44381
+ }
44382
+ if (!params.customerId) {
44383
+ throw new Error("[MeasurementSetupModal] customerId is required");
44384
+ }
44385
+ const persister = new MeasurementSetupPersister(params.token, params.tbBaseUrl);
44386
+ let existingSettings = params.existingSettings || null;
44387
+ const view = new MeasurementSetupView({
44388
+ styles: params.styles,
44389
+ onSave: async () => {
44390
+ const formData = view.getFormData();
44391
+ const settings = persister.formDataToSettings(formData, existingSettings);
44392
+ const result = await persister.saveSettings(params.customerId, settings);
44393
+ if (!result.ok) {
44394
+ throw new Error(result.error?.message || "Failed to save configuration");
44395
+ }
44396
+ existingSettings = settings;
44397
+ if (params.onSave) {
44398
+ params.onSave(settings);
44399
+ }
44400
+ },
44401
+ onClose: () => {
44402
+ if (params.onClose) {
44403
+ params.onClose();
44404
+ }
44405
+ }
44406
+ });
44407
+ async function loadFormData() {
44408
+ view.showLoading();
44409
+ try {
44410
+ if (!existingSettings) {
44411
+ existingSettings = await persister.loadSettings(params.customerId);
44412
+ }
44413
+ const formData = persister.settingsToFormData(existingSettings);
44414
+ view.setFormData(formData);
44415
+ } catch (error) {
44416
+ console.error("[MeasurementSetupModal] Error loading form data:", error);
44417
+ view.showError(error.message || "Failed to load configuration");
44418
+ } finally {
44419
+ view.hideLoading();
44420
+ }
44421
+ }
44422
+ let container;
44423
+ if (params.container) {
44424
+ if (typeof params.container === "string") {
44425
+ container = document.querySelector(params.container);
44426
+ } else {
44427
+ container = params.container;
44428
+ }
44429
+ }
44430
+ view.render(container);
44431
+ await loadFormData();
44432
+ return {
44433
+ destroy: () => view.destroy(),
44434
+ getFormData: () => view.getFormData(),
44435
+ setFormData: (data) => view.setFormData(data)
44436
+ };
44437
+ }
44438
+
43356
44439
  exports.ANNOTATION_TYPE_COLORS = ANNOTATION_TYPE_COLORS;
43357
44440
  exports.ANNOTATION_TYPE_LABELS = ANNOTATION_TYPE_LABELS;
43358
44441
  exports.ANNOTATION_TYPE_LABELS_EN = ANNOTATION_TYPE_LABELS_EN;
@@ -43363,14 +44446,17 @@
43363
44446
  exports.CONSUMPTION_THEME_COLORS = THEME_COLORS;
43364
44447
  exports.ConnectionStatusType = ConnectionStatusType;
43365
44448
  exports.ContractSummaryTooltip = ContractSummaryTooltip;
44449
+ exports.DECIMAL_OPTIONS = DECIMAL_OPTIONS;
43366
44450
  exports.DEFAULT_CLAMP_RANGE = DEFAULT_CLAMP_RANGE;
43367
44451
  exports.DEFAULT_ENERGY_GROUP_COLORS = DEFAULT_ENERGY_GROUP_COLORS;
43368
44452
  exports.DEFAULT_GAS_GROUP_COLORS = DEFAULT_GAS_GROUP_COLORS;
44453
+ exports.DEFAULT_MEASUREMENT_SETTINGS = DEFAULT_SETTINGS;
43369
44454
  exports.DEFAULT_SHOPPING_COLORS = DEFAULT_SHOPPING_COLORS;
43370
44455
  exports.DEFAULT_WATER_GROUP_COLORS = DEFAULT_WATER_GROUP_COLORS;
43371
44456
  exports.DEVICE_COUNT_KEYS = DEVICE_COUNT_KEYS;
43372
44457
  exports.DeviceComparisonTooltip = DeviceComparisonTooltip;
43373
44458
  exports.DeviceStatusType = DeviceStatusType;
44459
+ exports.ENERGY_UNITS = ENERGY_UNITS;
43374
44460
  exports.EXPORT_DEFAULT_COLORS = EXPORT_DEFAULT_COLORS;
43375
44461
  exports.EXPORT_DOMAIN_ICONS = EXPORT_DOMAIN_ICONS;
43376
44462
  exports.EXPORT_DOMAIN_LABELS = EXPORT_DOMAIN_LABELS;
@@ -43381,6 +44467,7 @@
43381
44467
  exports.IMPORTANCE_LABELS = IMPORTANCE_LABELS;
43382
44468
  exports.IMPORTANCE_LABELS_EN = IMPORTANCE_LABELS_EN;
43383
44469
  exports.InfoTooltip = InfoTooltip;
44470
+ exports.MEASUREMENT_DOMAIN_CONFIG = DOMAIN_CONFIG5;
43384
44471
  exports.MyIOChartModal = MyIOChartModal;
43385
44472
  exports.MyIODraggableCard = MyIODraggableCard;
43386
44473
  exports.MyIOSelectionStoreClass = MyIOSelectionStoreClass;
@@ -43391,9 +44478,11 @@
43391
44478
  exports.STATUS_COLORS = STATUS_COLORS;
43392
44479
  exports.STATUS_LABELS = STATUS_LABELS;
43393
44480
  exports.STATUS_LABELS_EN = STATUS_LABELS_EN;
44481
+ exports.TEMPERATURE_UNITS = TEMPERATURE_UNITS;
43394
44482
  exports.TempComparisonTooltip = TempComparisonTooltip;
43395
44483
  exports.TempRangeTooltip = TempRangeTooltip;
43396
44484
  exports.TempSensorSummaryTooltip = TempSensorSummaryTooltip;
44485
+ exports.WATER_UNITS = WATER_UNITS;
43397
44486
  exports.WaterSummaryTooltip = WaterSummaryTooltip;
43398
44487
  exports.addDetectionContext = addDetectionContext;
43399
44488
  exports.addNamespace = addNamespace;
@@ -43499,6 +44588,7 @@
43499
44588
  exports.openDashboardPopupWaterTank = openDashboardPopupWaterTank;
43500
44589
  exports.openDemandModal = openDemandModal;
43501
44590
  exports.openGoalsPanel = openGoalsPanel;
44591
+ exports.openMeasurementSetupModal = openMeasurementSetupModal;
43502
44592
  exports.openPowerLimitsSetupModal = openPowerLimitsSetupModal;
43503
44593
  exports.openRealTimeTelemetryModal = openRealTimeTelemetryModal;
43504
44594
  exports.openTemperatureComparisonModal = openTemperatureComparisonModal;