myio-js-library 0.1.180 → 0.1.182

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.d.cts CHANGED
@@ -2527,6 +2527,11 @@ interface TemperatureSettingsParams {
2527
2527
  }) => void;
2528
2528
  /** Callback when modal closes */
2529
2529
  onClose?: () => void;
2530
+ /** Callback when API error occurs (e.g., 401 unauthorized) */
2531
+ onError?: (error: {
2532
+ status: number;
2533
+ message: string;
2534
+ }) => void;
2530
2535
  /** Initial theme */
2531
2536
  theme?: 'dark' | 'light';
2532
2537
  }
@@ -2539,6 +2544,151 @@ interface TemperatureSettingsInstance {
2539
2544
  */
2540
2545
  declare function openTemperatureSettingsModal(params: TemperatureSettingsParams): TemperatureSettingsInstance;
2541
2546
 
2547
+ /**
2548
+ * Temperature Range Tooltip Component
2549
+ *
2550
+ * A reusable tooltip that shows temperature status with:
2551
+ * - Current temperature value
2552
+ * - Visual ruler showing position within configured range
2553
+ * - Deviation percentage from ideal range
2554
+ * - Status indicators (cold/ok/hot)
2555
+ *
2556
+ * @module TempRangeTooltip
2557
+ */
2558
+ interface TempEntityData {
2559
+ /** Current temperature value */
2560
+ val?: number;
2561
+ currentTemperature?: number;
2562
+ temperature?: number;
2563
+ /** Minimum temperature of ideal range */
2564
+ temperatureMin?: number;
2565
+ minTemperature?: number;
2566
+ /** Maximum temperature of ideal range */
2567
+ temperatureMax?: number;
2568
+ maxTemperature?: number;
2569
+ /** Display label */
2570
+ labelOrName?: string;
2571
+ name?: string;
2572
+ label?: string;
2573
+ }
2574
+ type TempStatus = 'cold' | 'ok' | 'hot' | 'unknown';
2575
+ interface TempStatusResult {
2576
+ status: TempStatus;
2577
+ deviation: number | null;
2578
+ deviationPercent: number | null;
2579
+ }
2580
+ declare const TempRangeTooltip: {
2581
+ containerId: string;
2582
+ /**
2583
+ * Create or get the tooltip container
2584
+ */
2585
+ getContainer(): HTMLElement;
2586
+ /**
2587
+ * Calculate temperature status and deviation
2588
+ */
2589
+ calculateStatus(currentTemp: number, tempMin: number | null, tempMax: number | null): TempStatusResult;
2590
+ /**
2591
+ * Calculate marker position on ruler (0-100%)
2592
+ */
2593
+ calculateMarkerPosition(currentTemp: number, tempMin: number | null, tempMax: number | null): number;
2594
+ /**
2595
+ * Show tooltip for a temperature card
2596
+ * @param triggerElement - The card element
2597
+ * @param entityData - Entity data with temperature info
2598
+ * @param event - Mouse event for cursor position
2599
+ */
2600
+ show(triggerElement: HTMLElement, entityData: TempEntityData, event?: MouseEvent): void;
2601
+ /**
2602
+ * Hide tooltip
2603
+ */
2604
+ hide(): void;
2605
+ /**
2606
+ * Attach tooltip to an element
2607
+ * Returns cleanup function
2608
+ */
2609
+ attach(element: HTMLElement, entityData: TempEntityData): () => void;
2610
+ };
2611
+
2612
+ /**
2613
+ * EnergyRangeTooltip - Reusable Energy Range Tooltip Component
2614
+ *
2615
+ * Shows power value with ruler visualization and status ranges.
2616
+ * Used in card-head-office and template-card-v5 for energy domain devices.
2617
+ *
2618
+ * @example
2619
+ * // Attach to an element (recommended)
2620
+ * const cleanup = EnergyRangeTooltip.attach(imageElement, entityData);
2621
+ * // Later: cleanup();
2622
+ *
2623
+ * // Or manual control
2624
+ * EnergyRangeTooltip.show(element, entityData, event);
2625
+ * EnergyRangeTooltip.hide();
2626
+ */
2627
+ interface PowerRange {
2628
+ down: number;
2629
+ up: number;
2630
+ }
2631
+ interface PowerRanges {
2632
+ standbyRange?: PowerRange;
2633
+ normalRange?: PowerRange;
2634
+ alertRange?: PowerRange;
2635
+ failureRange?: PowerRange;
2636
+ }
2637
+ interface EnergyEntityData {
2638
+ labelOrName?: string;
2639
+ name?: string;
2640
+ instantaneousPower?: number;
2641
+ consumption_power?: number;
2642
+ powerRanges?: PowerRanges;
2643
+ ranges?: PowerRanges;
2644
+ }
2645
+ type EnergyStatus = 'standby' | 'normal' | 'alert' | 'failure' | 'offline';
2646
+ interface EnergyStatusResult {
2647
+ status: EnergyStatus;
2648
+ label: string;
2649
+ }
2650
+ declare const EnergyRangeTooltip: {
2651
+ containerId: string;
2652
+ /**
2653
+ * Create or get the tooltip container
2654
+ */
2655
+ getContainer(): HTMLElement;
2656
+ /**
2657
+ * Determine status based on power value and ranges
2658
+ */
2659
+ calculateStatus(powerValue: number | null | undefined, ranges: PowerRanges | undefined): EnergyStatusResult;
2660
+ /**
2661
+ * Calculate marker position on ruler (0-100%)
2662
+ */
2663
+ calculateMarkerPosition(powerValue: number | null | undefined, ranges: PowerRanges | undefined): number;
2664
+ /**
2665
+ * Calculate segment widths for the ruler
2666
+ */
2667
+ calculateSegmentWidths(ranges: PowerRanges | undefined): {
2668
+ standby: number;
2669
+ normal: number;
2670
+ alert: number;
2671
+ failure: number;
2672
+ };
2673
+ /**
2674
+ * Format power value for display
2675
+ */
2676
+ formatPower(value: number | null | undefined): string;
2677
+ /**
2678
+ * Show tooltip for an energy card
2679
+ */
2680
+ show(triggerElement: HTMLElement, entityObject: EnergyEntityData, event?: MouseEvent): void;
2681
+ /**
2682
+ * Hide tooltip
2683
+ */
2684
+ hide(): void;
2685
+ /**
2686
+ * Attach tooltip to an element with automatic show/hide on hover
2687
+ * Returns cleanup function to remove event listeners
2688
+ */
2689
+ attach(element: HTMLElement, entityData: EnergyEntityData): () => void;
2690
+ };
2691
+
2542
2692
  /**
2543
2693
  * MyIO Modal Header Component
2544
2694
  *
@@ -3680,4 +3830,4 @@ declare function getThemeColors(theme: ThemeMode): DistributionThemeColors;
3680
3830
  */
3681
3831
  declare function getHashColor(str: string): string;
3682
3832
 
3683
- export { type BuildTemplateExportParams, CHART_COLORS, DEFAULT_COLORS as CONSUMPTION_CHART_COLORS, DEFAULT_CONFIG as CONSUMPTION_CHART_DEFAULTS, THEME_COLORS as CONSUMPTION_THEME_COLORS, type ChartDomain, type ClampRange, ConnectionStatusType, type Consumption7DaysColors, type Consumption7DaysConfig, type Consumption7DaysData, type Consumption7DaysInstance, type ChartType as ConsumptionChartType, type ConsumptionDataPoint, type IdealRangeConfig as ConsumptionIdealRangeConfig, type ConsumptionModalConfig, type ConsumptionModalInstance, type TemperatureConfig as ConsumptionTemperatureConfig, type TemperatureReferenceLine as ConsumptionTemperatureReferenceLine, type ThemeColors as ConsumptionThemeColors, type ThemeMode$1 as ConsumptionThemeMode, type VizMode as ConsumptionVizMode, type ConsumptionWidgetConfig, type ConsumptionWidgetInstance, type CreateDateRangePickerOptions, type CreateInputDateRangePickerInsideDIVParams, DEFAULT_CLAMP_RANGE, DEFAULT_ENERGY_GROUP_COLORS, DEFAULT_GAS_GROUP_COLORS, DEFAULT_SHOPPING_COLORS, DEFAULT_WATER_GROUP_COLORS, type DateRangeControl, type DateRangeInputController, type DateRangeResult, type DemandModalInstance, type DemandModalParams, type DemandModalPdfConfig, type DemandModalStyles, type DeviceStatusName, DeviceStatusType, type DeviceTypeLimits, type DistributionChartConfig, type DistributionChartInstance, type DistributionData, type DistributionDomain, type DistributionMode, type DistributionThemeColors, EXPORT_DEFAULT_COLORS, EXPORT_DOMAIN_ICONS, EXPORT_DOMAIN_LABELS, EXPORT_DOMAIN_UNITS, type EnergyModalContext, type EnergyModalError, type EnergyModalI18n, type EnergyModalStyleOverrides, type ExportColorsPallet, type ExportComparisonData, type ExportConfigTemplate, type ExportCustomerData, type ExportCustomerInfo, type ExportData, type ExportDataInput, type ExportDataInstance, type ExportDataPoint, type ExportDeviceInfo, type ExportDomain, type ExportFormat, type ExportGroupData, type ExportOptions, type ExportProgressCallback, type ExportResult, type ExportStats, type ExportType, type GroupColors, type InstantaneousPowerLimits, type ExportFormat$1 as ModalExportFormat, type ModalHeaderConfig, type ModalHeaderInstance, type ModalTheme, type MyIOAuthConfig, type MyIOAuthInstance, MyIOChartModal, MyIODraggableCard, MyIOSelectionStore, MyIOSelectionStoreClass, MyIOToast, type OpenDashboardPopupEnergyOptions, type OpenDashboardPopupSettingsParams, type OpenDashboardPopupWaterTankOptions, DEVICE_TYPES as POWER_LIMITS_DEVICE_TYPES, STATUS_CONFIG as POWER_LIMITS_STATUS_CONFIG, TELEMETRY_TYPES as POWER_LIMITS_TELEMETRY_TYPES, type PersistResult, type PowerLimitsError, type PowerLimitsFormData, type PowerLimitsModalInstance, type PowerLimitsModalParams, type PowerLimitsModalStyles, type RealTimeTelemetryInstance, type RealTimeTelemetryParams, type SettingsError, type SettingsEvent, type ShoppingColors, type ShoppingDataPoint, type StatusLimits, type StoreRow, type TbScope, type TelemetryFetcher, type TelemetryTypeLimits, type TemperatureComparisonModalInstance, type TemperatureComparisonModalParams, type TemperatureDevice, type TemperatureGranularity, type TemperatureModalInstance, type TemperatureModalParams, type TemperatureSettingsInstance, type TemperatureSettingsParams, type TemperatureStats, type TemperatureTelemetry, type ThingsboardCustomerAttrsConfig, type TimedValue, type WaterRow, type WaterTankDataPoint, type WaterTankModalContext, type WaterTankModalError, type WaterTankModalI18n, type WaterTankModalStyleOverrides, type WaterTankTelemetryData, addDetectionContext, addNamespace, aggregateByDay, assignShoppingColors, averageByDay, buildListItemsThingsboardByUniqueDatasource, buildMyioIngestionAuth, buildTemplateExport, buildWaterReportCSV, buildWaterStoresCSV, calcDeltaPercent, calculateDeviceStatus, calculateDeviceStatusWithRanges, calculateStats as calculateExportStats, calculateStats$1 as calculateStats, clampTemperature, classify, classifyWaterLabel, classifyWaterLabels, clearAllAuthCaches, connectionStatusIcons, createConsumption7DaysChart, createConsumptionChartWidget, createConsumptionModal, createDateRangePicker, createDistributionChartWidget, createInputDateRangePickerInsideDIV, createModalHeader, decodePayload, decodePayloadBase64Xor, detectDeviceType, determineInterval, deviceStatusIcons, exportTemperatureCSV, exportToCSV, exportToCSVAll, extractMyIOCredentials, fetchTemperatureData, fetchThingsboardCustomerAttrsFromStorage, fetchThingsboardCustomerServerScopeAttrs, findValue, findValueWithDefault, fmtPerc$1 as fmtPerc, fmtPerc as fmtPercLegacy, formatAllInSameUnit, formatAllInSameWaterUnit, formatDateForInput, formatDateToYMD, formatDateWithTimezoneOffset, formatDuration, formatEnergy, formatNumberReadable, formatRelativeTime, formatTankHeadFromCm, formatTemperature, formatWater, formatWaterByGroup, formatWaterVolumeM3, formatarDuracao, generateFilename as generateExportFilename, getAuthCacheStats, getAvailableContexts, getConnectionStatusIcon, getDateRangeArray, getDefaultGroupColors, getDeviceStatusIcon, getDeviceStatusInfo, getThemeColors as getDistributionThemeColors, getGroupColor, getHashColor, getModalHeaderStyles, getSaoPauloISOString, getSaoPauloISOStringFixed, getShoppingColor, getValueByDatakey, getValueByDatakeyLegacy, getWaterCategories, groupByDay, interpolateTemperature, isDeviceOffline, isValidConnectionStatus, isValidDeviceStatus, isWaterCategory, mapConnectionStatus, mapDeviceStatusToCardStatus, mapDeviceToConnectionStatus, myioExportData, normalizeRecipients, numbers, openDashboardPopup, openDashboardPopupAllReport, openDashboardPopupEnergy, openDashboardPopupReport, openDashboardPopupSettings, openDashboardPopupWaterTank, openDemandModal, openGoalsPanel, openPowerLimitsSetupModal, openRealTimeTelemetryModal, openTemperatureComparisonModal, openTemperatureModal, openTemperatureSettingsModal, parseInputDateToDate, renderCardComponent$2 as renderCardComponent, renderCardComponent$1 as renderCardComponentEnhanced, renderCardComponentHeadOffice, renderCardComponentLegacy, renderCardComponentV2, renderCardComponent as renderCardComponentV5, renderCardComponentV5 as renderCardV5, shouldFlashIcon, strings, timeWindowFromInputYMD, toCSV, toFixedSafe, waterDeviceStatusIcons };
3833
+ export { type BuildTemplateExportParams, CHART_COLORS, DEFAULT_COLORS as CONSUMPTION_CHART_COLORS, DEFAULT_CONFIG as CONSUMPTION_CHART_DEFAULTS, THEME_COLORS as CONSUMPTION_THEME_COLORS, type ChartDomain, type ClampRange, ConnectionStatusType, type Consumption7DaysColors, type Consumption7DaysConfig, type Consumption7DaysData, type Consumption7DaysInstance, type ChartType as ConsumptionChartType, type ConsumptionDataPoint, type IdealRangeConfig as ConsumptionIdealRangeConfig, type ConsumptionModalConfig, type ConsumptionModalInstance, type TemperatureConfig as ConsumptionTemperatureConfig, type TemperatureReferenceLine as ConsumptionTemperatureReferenceLine, type ThemeColors as ConsumptionThemeColors, type ThemeMode$1 as ConsumptionThemeMode, type VizMode as ConsumptionVizMode, type ConsumptionWidgetConfig, type ConsumptionWidgetInstance, type CreateDateRangePickerOptions, type CreateInputDateRangePickerInsideDIVParams, DEFAULT_CLAMP_RANGE, DEFAULT_ENERGY_GROUP_COLORS, DEFAULT_GAS_GROUP_COLORS, DEFAULT_SHOPPING_COLORS, DEFAULT_WATER_GROUP_COLORS, type DateRangeControl, type DateRangeInputController, type DateRangeResult, type DemandModalInstance, type DemandModalParams, type DemandModalPdfConfig, type DemandModalStyles, type DeviceStatusName, DeviceStatusType, type DeviceTypeLimits, type DistributionChartConfig, type DistributionChartInstance, type DistributionData, type DistributionDomain, type DistributionMode, type DistributionThemeColors, EXPORT_DEFAULT_COLORS, EXPORT_DOMAIN_ICONS, EXPORT_DOMAIN_LABELS, EXPORT_DOMAIN_UNITS, type EnergyEntityData, type EnergyModalContext, type EnergyModalError, type EnergyModalI18n, type EnergyModalStyleOverrides, EnergyRangeTooltip, type EnergyStatus, type EnergyStatusResult, type ExportColorsPallet, type ExportComparisonData, type ExportConfigTemplate, type ExportCustomerData, type ExportCustomerInfo, type ExportData, type ExportDataInput, type ExportDataInstance, type ExportDataPoint, type ExportDeviceInfo, type ExportDomain, type ExportFormat, type ExportGroupData, type ExportOptions, type ExportProgressCallback, type ExportResult, type ExportStats, type ExportType, type GroupColors, type InstantaneousPowerLimits, type ExportFormat$1 as ModalExportFormat, type ModalHeaderConfig, type ModalHeaderInstance, type ModalTheme, type MyIOAuthConfig, type MyIOAuthInstance, MyIOChartModal, MyIODraggableCard, MyIOSelectionStore, MyIOSelectionStoreClass, MyIOToast, type OpenDashboardPopupEnergyOptions, type OpenDashboardPopupSettingsParams, type OpenDashboardPopupWaterTankOptions, DEVICE_TYPES as POWER_LIMITS_DEVICE_TYPES, STATUS_CONFIG as POWER_LIMITS_STATUS_CONFIG, TELEMETRY_TYPES as POWER_LIMITS_TELEMETRY_TYPES, type PersistResult, type PowerLimitsError, type PowerLimitsFormData, type PowerLimitsModalInstance, type PowerLimitsModalParams, type PowerLimitsModalStyles, type PowerRange, type PowerRanges, type RealTimeTelemetryInstance, type RealTimeTelemetryParams, type SettingsError, type SettingsEvent, type ShoppingColors, type ShoppingDataPoint, type StatusLimits, type StoreRow, type TbScope, type TelemetryFetcher, type TelemetryTypeLimits, type TempEntityData, TempRangeTooltip, type TempStatus, type TempStatusResult, type TemperatureComparisonModalInstance, type TemperatureComparisonModalParams, type TemperatureDevice, type TemperatureGranularity, type TemperatureModalInstance, type TemperatureModalParams, type TemperatureSettingsInstance, type TemperatureSettingsParams, type TemperatureStats, type TemperatureTelemetry, type ThingsboardCustomerAttrsConfig, type TimedValue, type WaterRow, type WaterTankDataPoint, type WaterTankModalContext, type WaterTankModalError, type WaterTankModalI18n, type WaterTankModalStyleOverrides, type WaterTankTelemetryData, addDetectionContext, addNamespace, aggregateByDay, assignShoppingColors, averageByDay, buildListItemsThingsboardByUniqueDatasource, buildMyioIngestionAuth, buildTemplateExport, buildWaterReportCSV, buildWaterStoresCSV, calcDeltaPercent, calculateDeviceStatus, calculateDeviceStatusWithRanges, calculateStats as calculateExportStats, calculateStats$1 as calculateStats, clampTemperature, classify, classifyWaterLabel, classifyWaterLabels, clearAllAuthCaches, connectionStatusIcons, createConsumption7DaysChart, createConsumptionChartWidget, createConsumptionModal, createDateRangePicker, createDistributionChartWidget, createInputDateRangePickerInsideDIV, createModalHeader, decodePayload, decodePayloadBase64Xor, detectDeviceType, determineInterval, deviceStatusIcons, exportTemperatureCSV, exportToCSV, exportToCSVAll, extractMyIOCredentials, fetchTemperatureData, fetchThingsboardCustomerAttrsFromStorage, fetchThingsboardCustomerServerScopeAttrs, findValue, findValueWithDefault, fmtPerc$1 as fmtPerc, fmtPerc as fmtPercLegacy, formatAllInSameUnit, formatAllInSameWaterUnit, formatDateForInput, formatDateToYMD, formatDateWithTimezoneOffset, formatDuration, formatEnergy, formatNumberReadable, formatRelativeTime, formatTankHeadFromCm, formatTemperature, formatWater, formatWaterByGroup, formatWaterVolumeM3, formatarDuracao, generateFilename as generateExportFilename, getAuthCacheStats, getAvailableContexts, getConnectionStatusIcon, getDateRangeArray, getDefaultGroupColors, getDeviceStatusIcon, getDeviceStatusInfo, getThemeColors as getDistributionThemeColors, getGroupColor, getHashColor, getModalHeaderStyles, getSaoPauloISOString, getSaoPauloISOStringFixed, getShoppingColor, getValueByDatakey, getValueByDatakeyLegacy, getWaterCategories, groupByDay, interpolateTemperature, isDeviceOffline, isValidConnectionStatus, isValidDeviceStatus, isWaterCategory, mapConnectionStatus, mapDeviceStatusToCardStatus, mapDeviceToConnectionStatus, myioExportData, normalizeRecipients, numbers, openDashboardPopup, openDashboardPopupAllReport, openDashboardPopupEnergy, openDashboardPopupReport, openDashboardPopupSettings, openDashboardPopupWaterTank, openDemandModal, openGoalsPanel, openPowerLimitsSetupModal, openRealTimeTelemetryModal, openTemperatureComparisonModal, openTemperatureModal, openTemperatureSettingsModal, parseInputDateToDate, renderCardComponent$2 as renderCardComponent, renderCardComponent$1 as renderCardComponentEnhanced, renderCardComponentHeadOffice, renderCardComponentLegacy, renderCardComponentV2, renderCardComponent as renderCardComponentV5, renderCardComponentV5 as renderCardV5, shouldFlashIcon, strings, timeWindowFromInputYMD, toCSV, toFixedSafe, waterDeviceStatusIcons };