myio-js-library 0.1.140 → 0.1.142

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
@@ -2073,4 +2073,213 @@ declare function openGoalsPanel(params: {
2073
2073
  locale?: string;
2074
2074
  }): any;
2075
2075
 
2076
- export { ConnectionStatusType, type CreateDateRangePickerOptions, type CreateInputDateRangePickerInsideDIVParams, type DateRangeControl, type DateRangeInputController, type DateRangeResult, type DemandModalInstance, type DemandModalParams, type DemandModalPdfConfig, type DemandModalStyles, DeviceStatusType, type EnergyModalContext, type EnergyModalError, type EnergyModalI18n, type EnergyModalStyleOverrides, type MyIOAuthConfig, type MyIOAuthInstance, MyIOChartModal, MyIODraggableCard, MyIOSelectionStore, MyIOSelectionStoreClass, MyIOToast, type OpenDashboardPopupEnergyOptions, type OpenDashboardPopupSettingsParams, type OpenDashboardPopupWaterTankOptions, type PersistResult, type RealTimeTelemetryInstance, type RealTimeTelemetryParams, type SettingsError, type SettingsEvent, type StoreRow, type TbScope, type TelemetryFetcher, type ThingsboardCustomerAttrsConfig, type TimedValue, type WaterRow, type WaterTankDataPoint, type WaterTankModalContext, type WaterTankModalError, type WaterTankModalI18n, type WaterTankModalStyleOverrides, type WaterTankTelemetryData, addDetectionContext, addNamespace, averageByDay, buildListItemsThingsboardByUniqueDatasource, buildMyioIngestionAuth, buildWaterReportCSV, buildWaterStoresCSV, calcDeltaPercent, calculateDeviceStatus, calculateDeviceStatusWithRanges, classify, classifyWaterLabel, classifyWaterLabels, clearAllAuthCaches, connectionStatusIcons, createDateRangePicker, createInputDateRangePickerInsideDIV, decodePayload, decodePayloadBase64Xor, detectDeviceType, determineInterval, deviceStatusIcons, exportToCSV, exportToCSVAll, extractMyIOCredentials, fetchThingsboardCustomerAttrsFromStorage, fetchThingsboardCustomerServerScopeAttrs, findValue, fmtPerc$1 as fmtPerc, fmtPerc as fmtPercLegacy, formatAllInSameUnit, formatAllInSameWaterUnit, formatDateForInput, formatDateToYMD, formatDateWithTimezoneOffset, formatEnergy, formatNumberReadable, formatTankHeadFromCm, formatWaterByGroup, formatWaterVolumeM3, getAuthCacheStats, getAvailableContexts, getConnectionStatusIcon, getDateRangeArray, getDeviceStatusIcon, getDeviceStatusInfo, getSaoPauloISOString, getSaoPauloISOStringFixed, getValueByDatakey, getValueByDatakeyLegacy, getWaterCategories, groupByDay, isDeviceOffline, isValidConnectionStatus, isValidDeviceStatus, isWaterCategory, mapDeviceStatusToCardStatus, mapDeviceToConnectionStatus, normalizeRecipients, numbers, openDashboardPopup, openDashboardPopupAllReport, openDashboardPopupEnergy, openDashboardPopupReport, openDashboardPopupSettings, openDashboardPopupWaterTank, openDemandModal, openGoalsPanel, openRealTimeTelemetryModal, parseInputDateToDate, renderCardComponent$2 as renderCardComponent, renderCardComponent$1 as renderCardComponentEnhanced, renderCardComponentHeadOffice, renderCardComponentLegacy, renderCardComponentV2, renderCardComponent as renderCardComponentV5, renderCardComponentV5 as renderCardV5, shouldFlashIcon, strings, timeWindowFromInputYMD, toCSV, toFixedSafe, waterDeviceStatusIcons };
2076
+ /**
2077
+ * Temperature Modal Utilities
2078
+ * Shared functions for temperature modal components
2079
+ * RFC-0085: Temperature Modal Component
2080
+ */
2081
+ interface TemperatureTelemetry {
2082
+ ts: number;
2083
+ value: number | string;
2084
+ }
2085
+ interface TemperatureStats {
2086
+ avg: number;
2087
+ min: number;
2088
+ max: number;
2089
+ count: number;
2090
+ }
2091
+ interface DailyTemperatureStats {
2092
+ date: string;
2093
+ dateTs: number;
2094
+ avg: number;
2095
+ min: number;
2096
+ max: number;
2097
+ count: number;
2098
+ }
2099
+ interface ClampRange {
2100
+ min: number;
2101
+ max: number;
2102
+ }
2103
+ type TemperatureGranularity = 'hour' | 'day';
2104
+ declare const DEFAULT_CLAMP_RANGE: ClampRange;
2105
+ declare const CHART_COLORS: string[];
2106
+ /**
2107
+ * Fetches temperature telemetry data from ThingsBoard API
2108
+ */
2109
+ declare function fetchTemperatureData(token: string, deviceId: string, startTs: number, endTs: number): Promise<TemperatureTelemetry[]>;
2110
+ /**
2111
+ * Clamps temperature value to avoid outliers
2112
+ * Values below min are clamped to min, values above max are clamped to max
2113
+ */
2114
+ declare function clampTemperature(value: number | string, range?: ClampRange): number;
2115
+ /**
2116
+ * Calculates statistics from temperature data
2117
+ */
2118
+ declare function calculateStats(data: TemperatureTelemetry[], clampRange?: ClampRange): TemperatureStats;
2119
+ /**
2120
+ * Interpolates temperature data to fill gaps with 30-minute intervals
2121
+ * Uses 'repeat-last' strategy: if no reading in interval, repeats last known temperature
2122
+ */
2123
+ declare function interpolateTemperature(data: TemperatureTelemetry[], options: {
2124
+ intervalMinutes: number;
2125
+ startTs: number;
2126
+ endTs: number;
2127
+ clampRange?: ClampRange;
2128
+ }): TemperatureTelemetry[];
2129
+ /**
2130
+ * Aggregates temperature data by day, calculating daily statistics
2131
+ */
2132
+ declare function aggregateByDay(data: TemperatureTelemetry[], clampRange?: ClampRange): DailyTemperatureStats[];
2133
+ /**
2134
+ * Formats temperature value for display
2135
+ */
2136
+ declare function formatTemperature(value: number, decimals?: number): string;
2137
+ /**
2138
+ * Exports temperature data to CSV format
2139
+ */
2140
+ declare function exportTemperatureCSV(data: TemperatureTelemetry[], deviceLabel: string, stats: TemperatureStats, startDate: string, endDate: string): void;
2141
+
2142
+ /**
2143
+ * Temperature Modal Component
2144
+ * RFC-0085: Single device temperature visualization
2145
+ *
2146
+ * Displays temperature telemetry data with statistics and timeline chart.
2147
+ * Fetches data from ThingsBoard API.
2148
+ */
2149
+
2150
+ interface TemperatureModalParams {
2151
+ /** JWT token for ThingsBoard API */
2152
+ token: string;
2153
+ /** ThingsBoard device UUID */
2154
+ deviceId: string;
2155
+ /** Start date in ISO format */
2156
+ startDate: string;
2157
+ /** End date in ISO format */
2158
+ endDate: string;
2159
+ /** Device label for display */
2160
+ label?: string;
2161
+ /** Current temperature value */
2162
+ currentTemperature?: number;
2163
+ /** Minimum threshold for visual range */
2164
+ temperatureMin?: number;
2165
+ /** Maximum threshold for visual range */
2166
+ temperatureMax?: number;
2167
+ /** Temperature status indicator */
2168
+ temperatureStatus?: 'ok' | 'above' | 'below';
2169
+ /** Container element or selector */
2170
+ container?: HTMLElement | string;
2171
+ /** Callback when modal closes */
2172
+ onClose?: () => void;
2173
+ /** Locale for formatting */
2174
+ locale?: 'pt-BR' | 'en-US';
2175
+ /** Outlier clamping range */
2176
+ clampRange?: ClampRange;
2177
+ /** Initial granularity */
2178
+ granularity?: TemperatureGranularity;
2179
+ /** Initial theme */
2180
+ theme?: 'dark' | 'light';
2181
+ }
2182
+ interface TemperatureModalInstance {
2183
+ /** Destroys the modal */
2184
+ destroy: () => void;
2185
+ /** Updates data with new date range */
2186
+ updateData: (startDate: string, endDate: string, granularity?: TemperatureGranularity) => Promise<void>;
2187
+ }
2188
+ /**
2189
+ * Opens a temperature modal for a single device
2190
+ */
2191
+ declare function openTemperatureModal(params: TemperatureModalParams): Promise<TemperatureModalInstance>;
2192
+
2193
+ /**
2194
+ * Temperature Comparison Modal Component
2195
+ * RFC-0085: Multi-device temperature comparison visualization
2196
+ *
2197
+ * Displays temperature telemetry data for multiple devices with comparison chart.
2198
+ * Fetches data from ThingsBoard API.
2199
+ */
2200
+
2201
+ interface TemperatureDevice {
2202
+ /** ThingsBoard device UUID */
2203
+ id: string;
2204
+ /** Device label for legend */
2205
+ label: string;
2206
+ /** Alternative ThingsBoard ID */
2207
+ tbId?: string;
2208
+ /** Customer name (for grouping/display) */
2209
+ customerName?: string;
2210
+ /** Minimum threshold for this device's ideal range */
2211
+ temperatureMin?: number;
2212
+ /** Maximum threshold for this device's ideal range */
2213
+ temperatureMax?: number;
2214
+ }
2215
+ interface TemperatureComparisonModalParams {
2216
+ /** JWT token for ThingsBoard API */
2217
+ token: string;
2218
+ /** Array of devices to compare */
2219
+ devices: TemperatureDevice[];
2220
+ /** Start date in ISO format */
2221
+ startDate: string;
2222
+ /** End date in ISO format */
2223
+ endDate: string;
2224
+ /** Container element or selector */
2225
+ container?: HTMLElement | string;
2226
+ /** Callback when modal closes */
2227
+ onClose?: () => void;
2228
+ /** Locale for formatting */
2229
+ locale?: 'pt-BR' | 'en-US';
2230
+ /** Outlier clamping range */
2231
+ clampRange?: ClampRange;
2232
+ /** Initial granularity */
2233
+ granularity?: TemperatureGranularity;
2234
+ /** Initial theme */
2235
+ theme?: 'dark' | 'light';
2236
+ /** Minimum threshold for ideal range (Y-axis will include this) */
2237
+ temperatureMin?: number;
2238
+ /** Maximum threshold for ideal range (Y-axis will include this) */
2239
+ temperatureMax?: number;
2240
+ }
2241
+ interface TemperatureComparisonModalInstance {
2242
+ /** Destroys the modal */
2243
+ destroy: () => void;
2244
+ /** Updates data with new date range */
2245
+ updateData: (startDate: string, endDate: string, granularity?: TemperatureGranularity) => Promise<void>;
2246
+ }
2247
+ /**
2248
+ * Opens a temperature comparison modal for multiple devices
2249
+ */
2250
+ declare function openTemperatureComparisonModal(params: TemperatureComparisonModalParams): Promise<TemperatureComparisonModalInstance>;
2251
+
2252
+ /**
2253
+ * Temperature Settings Modal Component
2254
+ * RFC-0085: Customer-level temperature threshold configuration
2255
+ *
2256
+ * Allows configuring minTemperature and maxTemperature attributes
2257
+ * for a ThingsBoard customer (SERVER_SCOPE).
2258
+ */
2259
+ interface TemperatureSettingsParams {
2260
+ /** JWT token for ThingsBoard API */
2261
+ token: string;
2262
+ /** Customer ID (ThingsBoard UUID) */
2263
+ customerId: string;
2264
+ /** Customer name for display */
2265
+ customerName?: string;
2266
+ /** Callback when settings are saved */
2267
+ onSave?: (settings: {
2268
+ minTemperature: number;
2269
+ maxTemperature: number;
2270
+ }) => void;
2271
+ /** Callback when modal closes */
2272
+ onClose?: () => void;
2273
+ /** Initial theme */
2274
+ theme?: 'dark' | 'light';
2275
+ }
2276
+ interface TemperatureSettingsInstance {
2277
+ /** Destroys the modal */
2278
+ destroy: () => void;
2279
+ }
2280
+ /**
2281
+ * Opens the temperature settings modal for a customer
2282
+ */
2283
+ declare function openTemperatureSettingsModal(params: TemperatureSettingsParams): TemperatureSettingsInstance;
2284
+
2285
+ export { CHART_COLORS, type ClampRange, ConnectionStatusType, type CreateDateRangePickerOptions, type CreateInputDateRangePickerInsideDIVParams, DEFAULT_CLAMP_RANGE, type DateRangeControl, type DateRangeInputController, type DateRangeResult, type DemandModalInstance, type DemandModalParams, type DemandModalPdfConfig, type DemandModalStyles, DeviceStatusType, type EnergyModalContext, type EnergyModalError, type EnergyModalI18n, type EnergyModalStyleOverrides, type MyIOAuthConfig, type MyIOAuthInstance, MyIOChartModal, MyIODraggableCard, MyIOSelectionStore, MyIOSelectionStoreClass, MyIOToast, type OpenDashboardPopupEnergyOptions, type OpenDashboardPopupSettingsParams, type OpenDashboardPopupWaterTankOptions, type PersistResult, type RealTimeTelemetryInstance, type RealTimeTelemetryParams, type SettingsError, type SettingsEvent, type StoreRow, type TbScope, type TelemetryFetcher, 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, averageByDay, buildListItemsThingsboardByUniqueDatasource, buildMyioIngestionAuth, buildWaterReportCSV, buildWaterStoresCSV, calcDeltaPercent, calculateDeviceStatus, calculateDeviceStatusWithRanges, calculateStats, clampTemperature, classify, classifyWaterLabel, classifyWaterLabels, clearAllAuthCaches, connectionStatusIcons, createDateRangePicker, createInputDateRangePickerInsideDIV, decodePayload, decodePayloadBase64Xor, detectDeviceType, determineInterval, deviceStatusIcons, exportTemperatureCSV, exportToCSV, exportToCSVAll, extractMyIOCredentials, fetchTemperatureData, fetchThingsboardCustomerAttrsFromStorage, fetchThingsboardCustomerServerScopeAttrs, findValue, fmtPerc$1 as fmtPerc, fmtPerc as fmtPercLegacy, formatAllInSameUnit, formatAllInSameWaterUnit, formatDateForInput, formatDateToYMD, formatDateWithTimezoneOffset, formatEnergy, formatNumberReadable, formatTankHeadFromCm, formatTemperature, formatWaterByGroup, formatWaterVolumeM3, getAuthCacheStats, getAvailableContexts, getConnectionStatusIcon, getDateRangeArray, getDeviceStatusIcon, getDeviceStatusInfo, getSaoPauloISOString, getSaoPauloISOStringFixed, getValueByDatakey, getValueByDatakeyLegacy, getWaterCategories, groupByDay, interpolateTemperature, isDeviceOffline, isValidConnectionStatus, isValidDeviceStatus, isWaterCategory, mapDeviceStatusToCardStatus, mapDeviceToConnectionStatus, normalizeRecipients, numbers, openDashboardPopup, openDashboardPopupAllReport, openDashboardPopupEnergy, openDashboardPopupReport, openDashboardPopupSettings, openDashboardPopupWaterTank, openDemandModal, openGoalsPanel, 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 };