myio-js-library 0.1.199 → 0.1.201
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.cjs +930 -0
- package/dist/index.d.cts +146 -1
- package/dist/index.js +928 -0
- package/dist/myio-js-library.umd.js +928 -0
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -5021,4 +5021,149 @@ declare function getThemeColors(theme: ThemeMode): DistributionThemeColors;
|
|
|
5021
5021
|
*/
|
|
5022
5022
|
declare function getHashColor(str: string): string;
|
|
5023
5023
|
|
|
5024
|
-
|
|
5024
|
+
/**
|
|
5025
|
+
* RFC-0107: Contract Devices Modal Types
|
|
5026
|
+
* Modal for managing device count attributes on CUSTOMER SERVER_SCOPE
|
|
5027
|
+
*/
|
|
5028
|
+
type ContractDomain = 'energy' | 'water' | 'temperature';
|
|
5029
|
+
/**
|
|
5030
|
+
* Device count keys structure matching RFC-0107
|
|
5031
|
+
*/
|
|
5032
|
+
interface DeviceCountKeys {
|
|
5033
|
+
energy: {
|
|
5034
|
+
total: string;
|
|
5035
|
+
entries: string;
|
|
5036
|
+
commonArea: string;
|
|
5037
|
+
stores: string;
|
|
5038
|
+
};
|
|
5039
|
+
water: {
|
|
5040
|
+
total: string;
|
|
5041
|
+
entries: string;
|
|
5042
|
+
commonArea: string;
|
|
5043
|
+
stores: string;
|
|
5044
|
+
};
|
|
5045
|
+
temperature: {
|
|
5046
|
+
total: string;
|
|
5047
|
+
internal: string;
|
|
5048
|
+
stores: string;
|
|
5049
|
+
};
|
|
5050
|
+
}
|
|
5051
|
+
/**
|
|
5052
|
+
* Device counts data structure
|
|
5053
|
+
*/
|
|
5054
|
+
interface ContractDeviceCounts {
|
|
5055
|
+
energy: {
|
|
5056
|
+
total: number | null;
|
|
5057
|
+
entries: number | null;
|
|
5058
|
+
commonArea: number | null;
|
|
5059
|
+
stores: number | null;
|
|
5060
|
+
};
|
|
5061
|
+
water: {
|
|
5062
|
+
total: number | null;
|
|
5063
|
+
entries: number | null;
|
|
5064
|
+
commonArea: number | null;
|
|
5065
|
+
stores: number | null;
|
|
5066
|
+
};
|
|
5067
|
+
temperature: {
|
|
5068
|
+
total: number | null;
|
|
5069
|
+
internal: number | null;
|
|
5070
|
+
stores: number | null;
|
|
5071
|
+
};
|
|
5072
|
+
}
|
|
5073
|
+
/**
|
|
5074
|
+
* Parameters for opening the contract devices modal
|
|
5075
|
+
*/
|
|
5076
|
+
interface OpenContractDevicesModalParams {
|
|
5077
|
+
customerId: string;
|
|
5078
|
+
customerName?: string;
|
|
5079
|
+
jwtToken: string;
|
|
5080
|
+
api?: {
|
|
5081
|
+
tbBaseUrl?: string;
|
|
5082
|
+
};
|
|
5083
|
+
seed?: Partial<ContractDeviceCounts>;
|
|
5084
|
+
onSaved?: (result: ContractDevicesPersistResult) => void;
|
|
5085
|
+
onClose?: () => void;
|
|
5086
|
+
onError?: (error: ContractDevicesError) => void;
|
|
5087
|
+
ui?: {
|
|
5088
|
+
title?: string;
|
|
5089
|
+
width?: number | string;
|
|
5090
|
+
closeOnBackdrop?: boolean;
|
|
5091
|
+
};
|
|
5092
|
+
}
|
|
5093
|
+
/**
|
|
5094
|
+
* Result of persisting contract device counts
|
|
5095
|
+
*/
|
|
5096
|
+
interface ContractDevicesPersistResult {
|
|
5097
|
+
ok: boolean;
|
|
5098
|
+
updatedKeys?: string[];
|
|
5099
|
+
error?: ContractDevicesError;
|
|
5100
|
+
timestamp?: string;
|
|
5101
|
+
}
|
|
5102
|
+
/**
|
|
5103
|
+
* Error structure for contract devices modal
|
|
5104
|
+
*/
|
|
5105
|
+
interface ContractDevicesError {
|
|
5106
|
+
code: 'VALIDATION_ERROR' | 'NETWORK_ERROR' | 'AUTH_ERROR' | 'TOKEN_EXPIRED' | 'UNKNOWN_ERROR';
|
|
5107
|
+
message: string;
|
|
5108
|
+
field?: string;
|
|
5109
|
+
userAction?: 'RETRY' | 'RE_AUTH' | 'CONTACT_ADMIN' | 'FIX_INPUT';
|
|
5110
|
+
cause?: unknown;
|
|
5111
|
+
}
|
|
5112
|
+
/**
|
|
5113
|
+
* Default device count keys (matches RFC-0107)
|
|
5114
|
+
*/
|
|
5115
|
+
declare const DEVICE_COUNT_KEYS: DeviceCountKeys;
|
|
5116
|
+
|
|
5117
|
+
/**
|
|
5118
|
+
* RFC-0107: Open Contract Devices Modal
|
|
5119
|
+
* Entry point function for the contract devices configuration modal
|
|
5120
|
+
*/
|
|
5121
|
+
|
|
5122
|
+
/**
|
|
5123
|
+
* Opens a modal for configuring contracted device counts per domain (energy, water, temperature).
|
|
5124
|
+
*
|
|
5125
|
+
* This function creates a modal interface for editing device count attributes that are
|
|
5126
|
+
* persisted to ThingsBoard CUSTOMER SERVER_SCOPE. These counts represent the contracted
|
|
5127
|
+
* number of devices for each domain and subcategory (entries, common area, stores).
|
|
5128
|
+
*
|
|
5129
|
+
* Attribute keys managed:
|
|
5130
|
+
* - Energy: qtDevices3f, qtDevices3f-Entries, qtDevices3f-CommonArea, qtDevices3f-Stores
|
|
5131
|
+
* - Water: qtDevicesHidr, qtDevicesHidr-Entries, qtDevicesHidr-CommonArea, qtDevicesHidr-Stores
|
|
5132
|
+
* - Temperature: qtDevicesTemp, qtDevicesTemp-Internal, qtDevicesTemp-Stores
|
|
5133
|
+
*
|
|
5134
|
+
* @param params Configuration parameters for the modal
|
|
5135
|
+
* @returns Promise that resolves when the modal is displayed
|
|
5136
|
+
*
|
|
5137
|
+
* @example
|
|
5138
|
+
* ```typescript
|
|
5139
|
+
* // Basic usage
|
|
5140
|
+
* await openContractDevicesModal({
|
|
5141
|
+
* customerId: 'customer-123',
|
|
5142
|
+
* jwtToken: localStorage.getItem('jwt_token'),
|
|
5143
|
+
* customerName: 'Shopping Center XYZ',
|
|
5144
|
+
* onSaved: (result) => {
|
|
5145
|
+
* if (result.ok) {
|
|
5146
|
+
* console.log('Contract devices saved:', result.updatedKeys);
|
|
5147
|
+
* }
|
|
5148
|
+
* }
|
|
5149
|
+
* });
|
|
5150
|
+
*
|
|
5151
|
+
* // With pre-populated data
|
|
5152
|
+
* await openContractDevicesModal({
|
|
5153
|
+
* customerId: 'customer-123',
|
|
5154
|
+
* jwtToken: jwtToken,
|
|
5155
|
+
* customerName: 'Shopping Center XYZ',
|
|
5156
|
+
* seed: {
|
|
5157
|
+
* energy: { total: 50, entries: 2, commonArea: 10, stores: 38 },
|
|
5158
|
+
* water: { total: 30, entries: 1, commonArea: 5, stores: 24 },
|
|
5159
|
+
* temperature: { total: 20, internal: 5, stores: 15 }
|
|
5160
|
+
* },
|
|
5161
|
+
* onSaved: (result) => console.log('Saved:', result)
|
|
5162
|
+
* });
|
|
5163
|
+
* ```
|
|
5164
|
+
*
|
|
5165
|
+
* @throws {Error} When required parameters (jwtToken, customerId) are missing
|
|
5166
|
+
*/
|
|
5167
|
+
declare function openContractDevicesModal(params: OpenContractDevicesModalParams): Promise<void>;
|
|
5168
|
+
|
|
5169
|
+
export { ANNOTATION_TYPE_COLORS, ANNOTATION_TYPE_LABELS, ANNOTATION_TYPE_LABELS_EN, type Annotation, type AnnotationFilterState, AnnotationIndicator, type AnnotationIndicatorConfig, type AnnotationIndicatorTheme, type AnnotationStatus, type AnnotationSummary, type AnnotationType, type AuditAction, type AuditEntry, type BuildTemplateExportParams, CHART_COLORS, DEFAULT_COLORS as CONSUMPTION_CHART_COLORS, DEFAULT_CONFIG as CONSUMPTION_CHART_DEFAULTS, THEME_COLORS as CONSUMPTION_THEME_COLORS, type CategorySummary, 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 ContractDeviceCounts, type ContractDevicesError, type ContractDevicesPersistResult, type ContractDomain, type ContractDomainCounts, type ContractSummaryData, ContractSummaryTooltip, type ContractTemperatureCounts, type CreateDateRangePickerOptions, type CreateInputDateRangePickerInsideDIVParams, DEFAULT_CLAMP_RANGE, DEFAULT_ENERGY_GROUP_COLORS, DEFAULT_GAS_GROUP_COLORS, DEFAULT_SHOPPING_COLORS, DEFAULT_WATER_GROUP_COLORS, DEVICE_COUNT_KEYS, type DashboardEnergySummary, type DashboardWaterSummary, type DateRangeControl, type DateRangeInputController, type DateRangeResult, type DemandModalInstance, type DemandModalParams, type DemandModalPdfConfig, type DemandModalStyles, type DeviceComparisonData, DeviceComparisonTooltip, type DeviceCountKeys, type DeviceInfo$1 as DeviceInfo, 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, EnergySummaryTooltip, 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, IMPORTANCE_COLORS, IMPORTANCE_LABELS, IMPORTANCE_LABELS_EN, type ImportanceLevel, InfoTooltip, type InstantaneousPowerLimits, type LogAnnotationsAttribute, type ExportFormat$1 as ModalExportFormat, type ModalHeaderConfig, type ModalHeaderInstance, type ModalTheme, type MyIOAuthConfig, type MyIOAuthInstance, MyIOChartModal, MyIODraggableCard, MyIOSelectionStore, MyIOSelectionStoreClass, MyIOToast, type NewAnnotationData, type OpenContractDevicesModalParams, 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 PaginationState, type PermissionSet, type PersistResult, type PowerLimitsError, type PowerLimitsFormData, type PowerLimitsModalInstance, type PowerLimitsModalParams, type PowerLimitsModalStyles, type PowerRange, type PowerRanges, type RealTimeTelemetryInstance, type RealTimeTelemetryParams, STATUS_COLORS, STATUS_LABELS, STATUS_LABELS_EN, type SettingsError, type SettingsEvent, type ShoppingColors, type ShoppingDataPoint, type StatusLimits, type StatusSummary$1 as StatusSummary, type StoreRow, type TbScope, type TelemetryFetcher, type TelemetryTypeLimits, type TempComparisonData, TempComparisonTooltip, type TempEntityData, TempRangeTooltip, type TempSensorDevice, type TempSensorSummaryData, TempSensorSummaryTooltip, 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 UserInfo, type WaterCategorySummary, type WaterRow, WaterSummaryTooltip, 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, canModifyAnnotation, clampTemperature, classify, classifyWaterLabel, classifyWaterLabels, clearAllAuthCaches, connectionStatusIcons, createAnnotationIndicator, createConsumption7DaysChart, createConsumptionChartWidget, createConsumptionModal, createDateRangePicker, createDistributionChartWidget, createInputDateRangePickerInsideDIV, createModalHeader, decodePayload, decodePayloadBase64Xor, detectDeviceType, detectSuperAdminHolding, detectSuperAdminMyio, determineInterval, deviceStatusIcons, exportTemperatureCSV, exportToCSV, exportToCSVAll, extractMyIOCredentials, fetchCurrentUserInfo, 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, getAnnotationPermissions, 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, openContractDevicesModal, 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 };
|