myio-js-library 0.1.172 → 0.1.173

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
@@ -1671,6 +1671,204 @@ declare function openDashboardPopupWaterTank(options: OpenDashboardPopupWaterTan
1671
1671
  close: () => void;
1672
1672
  }>;
1673
1673
 
1674
+ type DeviceStatusName = 'standBy' | 'normal' | 'alert' | 'failure';
1675
+ interface StatusLimits {
1676
+ deviceStatusName: DeviceStatusName;
1677
+ limitsValues: {
1678
+ baseValue: number | null;
1679
+ topValue: number | null;
1680
+ };
1681
+ }
1682
+ interface DeviceTypeLimits {
1683
+ deviceType: string;
1684
+ name: string;
1685
+ description: string;
1686
+ limitsByDeviceStatus: StatusLimits[];
1687
+ }
1688
+ interface TelemetryTypeLimits {
1689
+ telemetryType: string;
1690
+ itemsByDeviceType: DeviceTypeLimits[];
1691
+ }
1692
+ interface InstantaneousPowerLimits {
1693
+ version: string;
1694
+ limitsByInstantaneoustPowerType: TelemetryTypeLimits[];
1695
+ }
1696
+ interface PowerLimitsFormData {
1697
+ deviceType: string;
1698
+ telemetryType: string;
1699
+ standby: {
1700
+ baseValue: number | null;
1701
+ topValue: number | null;
1702
+ };
1703
+ normal: {
1704
+ baseValue: number | null;
1705
+ topValue: number | null;
1706
+ };
1707
+ alert: {
1708
+ baseValue: number | null;
1709
+ topValue: number | null;
1710
+ };
1711
+ failure: {
1712
+ baseValue: number | null;
1713
+ topValue: number | null;
1714
+ };
1715
+ }
1716
+ interface PowerLimitsModalStyles {
1717
+ primaryColor?: string;
1718
+ successColor?: string;
1719
+ warningColor?: string;
1720
+ dangerColor?: string;
1721
+ infoColor?: string;
1722
+ textPrimary?: string;
1723
+ textSecondary?: string;
1724
+ backgroundColor?: string;
1725
+ overlayColor?: string;
1726
+ borderRadius?: string;
1727
+ buttonRadius?: string;
1728
+ zIndex?: number;
1729
+ fontFamily?: string;
1730
+ }
1731
+ interface PowerLimitsModalParams {
1732
+ token: string;
1733
+ customerId: string;
1734
+ tbBaseUrl?: string;
1735
+ deviceType?: string;
1736
+ telemetryType?: string;
1737
+ existingMapPower?: InstantaneousPowerLimits | null;
1738
+ container?: HTMLElement | string;
1739
+ onSave?: (json: InstantaneousPowerLimits) => void;
1740
+ onClose?: () => void;
1741
+ locale?: 'pt-BR' | 'en-US' | string;
1742
+ styles?: PowerLimitsModalStyles;
1743
+ }
1744
+ interface PowerLimitsModalInstance {
1745
+ destroy(): void;
1746
+ getFormData(): PowerLimitsFormData;
1747
+ setFormData(data: Partial<PowerLimitsFormData>): void;
1748
+ }
1749
+ interface PowerLimitsError {
1750
+ code: 'VALIDATION_ERROR' | 'NETWORK_ERROR' | 'AUTH_ERROR' | 'TOKEN_EXPIRED' | 'UNKNOWN_ERROR';
1751
+ message: string;
1752
+ field?: string;
1753
+ cause?: unknown;
1754
+ }
1755
+ declare const DEVICE_TYPES: readonly [{
1756
+ readonly value: "ELEVADOR";
1757
+ readonly label: "Elevator";
1758
+ }, {
1759
+ readonly value: "ESCADA_ROLANTE";
1760
+ readonly label: "Escalator";
1761
+ }, {
1762
+ readonly value: "MOTOR";
1763
+ readonly label: "Motor";
1764
+ }, {
1765
+ readonly value: "BOMBA";
1766
+ readonly label: "Pump";
1767
+ }, {
1768
+ readonly value: "CHILLER";
1769
+ readonly label: "Chiller";
1770
+ }, {
1771
+ readonly value: "AR_CONDICIONADO";
1772
+ readonly label: "Air Conditioner";
1773
+ }, {
1774
+ readonly value: "HVAC";
1775
+ readonly label: "HVAC";
1776
+ }, {
1777
+ readonly value: "FANCOIL";
1778
+ readonly label: "Fancoil";
1779
+ }, {
1780
+ readonly value: "3F_MEDIDOR";
1781
+ readonly label: "Three-phase Meter";
1782
+ }];
1783
+ declare const TELEMETRY_TYPES: readonly [{
1784
+ readonly value: "consumption";
1785
+ readonly label: "Consumption (kW)";
1786
+ readonly unit: "kW";
1787
+ }, {
1788
+ readonly value: "voltage_a";
1789
+ readonly label: "Voltage A (V)";
1790
+ readonly unit: "V";
1791
+ }, {
1792
+ readonly value: "voltage_b";
1793
+ readonly label: "Voltage B (V)";
1794
+ readonly unit: "V";
1795
+ }, {
1796
+ readonly value: "voltage_c";
1797
+ readonly label: "Voltage C (V)";
1798
+ readonly unit: "V";
1799
+ }, {
1800
+ readonly value: "current_a";
1801
+ readonly label: "Current A (A)";
1802
+ readonly unit: "A";
1803
+ }, {
1804
+ readonly value: "current_b";
1805
+ readonly label: "Current B (A)";
1806
+ readonly unit: "A";
1807
+ }, {
1808
+ readonly value: "current_c";
1809
+ readonly label: "Current C (A)";
1810
+ readonly unit: "A";
1811
+ }, {
1812
+ readonly value: "total_current";
1813
+ readonly label: "Total Current (A)";
1814
+ readonly unit: "A";
1815
+ }, {
1816
+ readonly value: "fp_a";
1817
+ readonly label: "Power Factor A";
1818
+ readonly unit: "";
1819
+ }, {
1820
+ readonly value: "fp_b";
1821
+ readonly label: "Power Factor B";
1822
+ readonly unit: "";
1823
+ }, {
1824
+ readonly value: "fp_c";
1825
+ readonly label: "Power Factor C";
1826
+ readonly unit: "";
1827
+ }];
1828
+ declare const STATUS_CONFIG: {
1829
+ readonly standBy: {
1830
+ readonly label: "StandBy";
1831
+ readonly color: "#22c55e";
1832
+ readonly bgColor: "rgba(34, 197, 94, 0.1)";
1833
+ };
1834
+ readonly normal: {
1835
+ readonly label: "Normal";
1836
+ readonly color: "#3b82f6";
1837
+ readonly bgColor: "rgba(59, 130, 246, 0.1)";
1838
+ };
1839
+ readonly alert: {
1840
+ readonly label: "Alert";
1841
+ readonly color: "#f59e0b";
1842
+ readonly bgColor: "rgba(245, 158, 11, 0.1)";
1843
+ };
1844
+ readonly failure: {
1845
+ readonly label: "Failure";
1846
+ readonly color: "#ef4444";
1847
+ readonly bgColor: "rgba(239, 68, 68, 0.1)";
1848
+ };
1849
+ };
1850
+
1851
+ /**
1852
+ * Opens a modal for configuring power limits stored in customer server_scope attributes.
1853
+ *
1854
+ * @example
1855
+ * ```typescript
1856
+ * const modal = await openPowerLimitsSetupModal({
1857
+ * token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
1858
+ * customerId: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
1859
+ * tbBaseUrl: 'https://tb.myio-bas.com',
1860
+ * deviceType: 'ELEVADOR',
1861
+ * telemetryType: 'consumption',
1862
+ * onSave: (json) => console.log('Saved:', json),
1863
+ * onClose: () => console.log('Modal closed')
1864
+ * });
1865
+ *
1866
+ * // Clean up when needed
1867
+ * modal.destroy();
1868
+ * ```
1869
+ */
1870
+ declare function openPowerLimitsSetupModal(params: PowerLimitsModalParams): Promise<PowerLimitsModalInstance>;
1871
+
1674
1872
  type TbScope = 'CLIENT_SCOPE' | 'SERVER_SCOPE';
1675
1873
  type Domain = 'energy' | 'water' | 'temperature';
1676
1874
  interface OpenDashboardPopupSettingsParams {
@@ -3477,4 +3675,4 @@ declare function getThemeColors(theme: ThemeMode): DistributionThemeColors;
3477
3675
  */
3478
3676
  declare function getHashColor(str: string): string;
3479
3677
 
3480
- 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, DeviceStatusType, 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 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, type PersistResult, type RealTimeTelemetryInstance, type RealTimeTelemetryParams, type SettingsError, type SettingsEvent, type ShoppingColors, type ShoppingDataPoint, 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, 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, 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 };
3678
+ 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 };