@seamapi/react 2.20.0 → 3.0.1
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/README.md +4 -4
- package/dist/elements.js +19676 -25734
- package/dist/elements.js.map +1 -1
- package/lib/object.d.ts +5 -0
- package/lib/object.js +14 -0
- package/lib/object.js.map +1 -0
- package/lib/seam/SeamProvider.d.ts +5 -4
- package/lib/seam/SeamProvider.js.map +1 -1
- package/lib/seam/access-codes/use-access-code.d.ts +3 -2
- package/lib/seam/access-codes/use-access-code.js +2 -3
- package/lib/seam/access-codes/use-access-code.js.map +1 -1
- package/lib/seam/access-codes/use-access-codes.d.ts +3 -2
- package/lib/seam/access-codes/use-access-codes.js +3 -5
- package/lib/seam/access-codes/use-access-codes.js.map +1 -1
- package/lib/seam/access-codes/use-create-access-code.d.ts +4 -3
- package/lib/seam/access-codes/use-create-access-code.js +5 -4
- package/lib/seam/access-codes/use-create-access-code.js.map +1 -1
- package/lib/seam/access-codes/use-delete-access-code.d.ts +4 -6
- package/lib/seam/access-codes/use-delete-access-code.js +10 -8
- package/lib/seam/access-codes/use-delete-access-code.js.map +1 -1
- package/lib/seam/access-codes/use-generate-access-code-code.d.ts +4 -4
- package/lib/seam/access-codes/use-generate-access-code-code.js +3 -2
- package/lib/seam/access-codes/use-generate-access-code-code.js.map +1 -1
- package/lib/seam/access-codes/use-update-access-code.d.ts +4 -4
- package/lib/seam/access-codes/use-update-access-code.js +9 -7
- package/lib/seam/access-codes/use-update-access-code.js.map +1 -1
- package/lib/seam/client-sessions/use-client-session.d.ts +1 -1
- package/lib/seam/client-sessions/use-client-session.js +1 -1
- package/lib/seam/client-sessions/use-client-session.js.map +1 -1
- package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.d.ts +1 -1
- package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.js +14 -6
- package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.js.map +1 -1
- package/lib/seam/components/AccessCodeDetails/AccessCodeDevice.d.ts +1 -1
- package/lib/seam/components/AccessCodeDetails/AccessCodeDevice.js +9 -6
- package/lib/seam/components/AccessCodeDetails/AccessCodeDevice.js.map +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeHealthBar.d.ts +3 -4
- package/lib/seam/components/AccessCodeTable/AccessCodeHealthBar.js.map +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeMainIcon.d.ts +3 -3
- package/lib/seam/components/AccessCodeTable/AccessCodeMainIcon.js.map +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeMenu.d.ts +3 -3
- package/lib/seam/components/AccessCodeTable/AccessCodeMenu.js +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeMenu.js.map +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeRow.d.ts +3 -3
- package/lib/seam/components/AccessCodeTable/AccessCodeRow.js.map +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeTable.d.ts +2 -4
- package/lib/seam/components/AccessCodeTable/AccessCodeTable.js +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeTable.js.map +1 -1
- package/lib/seam/components/AccessCodeTable/CodeDetails.d.ts +2 -2
- package/lib/seam/components/AccessCodeTable/CodeDetails.js +5 -2
- package/lib/seam/components/AccessCodeTable/CodeDetails.js.map +1 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.d.ts +1 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.js +3 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.js.map +1 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.d.ts +1 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.js +3 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.js.map +1 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.d.ts +1 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.js +3 -3
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.js.map +1 -1
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRow.d.ts +3 -3
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRow.js.map +1 -1
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRowDetails.d.ts +2 -2
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRowDetails.js.map +1 -1
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.d.ts +2 -2
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.js +1 -1
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.js.map +1 -1
- package/lib/seam/components/ConnectAccountButton/ConnectAccountButton.d.ts +1 -1
- package/lib/seam/components/ConnectAccountButton/ConnectAccountButton.js +2 -2
- package/lib/seam/components/CreateAccessCodeForm/CreateAccessCodeForm.d.ts +3 -3
- package/lib/seam/components/CreateAccessCodeForm/CreateAccessCodeForm.js +12 -9
- package/lib/seam/components/CreateAccessCodeForm/CreateAccessCodeForm.js.map +1 -1
- package/lib/seam/components/CreateClimateSettingScheduleForm/CreateClimateSettingScheduleForm.d.ts +1 -1
- package/lib/seam/components/CreateClimateSettingScheduleForm/CreateClimateSettingScheduleForm.js +1 -1
- package/lib/seam/components/DeviceDetails/DeviceDetails.d.ts +1 -1
- package/lib/seam/components/DeviceDetails/DeviceDetails.js +3 -1
- package/lib/seam/components/DeviceDetails/DeviceDetails.js.map +1 -1
- package/lib/seam/components/DeviceDetails/DeviceInfo.d.ts +3 -3
- package/lib/seam/components/DeviceDetails/DeviceInfo.js +3 -1
- package/lib/seam/components/DeviceDetails/DeviceInfo.js.map +1 -1
- package/lib/seam/components/DeviceDetails/DeviceModel.d.ts +3 -3
- package/lib/seam/components/DeviceDetails/LockDeviceDetails.d.ts +2 -2
- package/lib/seam/components/DeviceDetails/LockDeviceDetails.js +5 -5
- package/lib/seam/components/DeviceDetails/LockDeviceDetails.js.map +1 -1
- package/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.d.ts +2 -2
- package/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.js.map +1 -1
- package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.d.ts +2 -2
- package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.js +3 -3
- package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.js.map +1 -1
- package/lib/seam/components/DeviceTable/DeviceHealthBar.d.ts +3 -4
- package/lib/seam/components/DeviceTable/DeviceHealthBar.js.map +1 -1
- package/lib/seam/components/DeviceTable/DeviceRow.d.ts +4 -3
- package/lib/seam/components/DeviceTable/DeviceRow.js +2 -2
- package/lib/seam/components/DeviceTable/DeviceRow.js.map +1 -1
- package/lib/seam/components/DeviceTable/DeviceTable.d.ts +3 -6
- package/lib/seam/components/DeviceTable/DeviceTable.js +4 -2
- package/lib/seam/components/DeviceTable/DeviceTable.js.map +1 -1
- package/lib/seam/components/EditAccessCodeForm/EditAccessCodeForm.d.ts +1 -1
- package/lib/seam/components/EditAccessCodeForm/EditAccessCodeForm.js +2 -2
- package/lib/seam/components/EditAccessCodeForm/EditAccessCodeForm.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/FilterCategoryMenu.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js +2 -2
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.d.ts +3 -3
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceManufacturerSection.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/use-device-model.d.ts +2 -2
- package/lib/seam/components/SupportedDeviceTable/use-device-model.js +3 -4
- package/lib/seam/components/SupportedDeviceTable/use-device-model.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/use-device-models.js +2 -4
- package/lib/seam/components/SupportedDeviceTable/use-device-models.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/use-manufacturer.d.ts +2 -2
- package/lib/seam/components/SupportedDeviceTable/use-manufacturer.js +2 -3
- package/lib/seam/components/SupportedDeviceTable/use-manufacturer.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/use-manufacturers.js +1 -3
- package/lib/seam/components/SupportedDeviceTable/use-manufacturers.js.map +1 -1
- package/lib/seam/components/common-props.d.ts +2 -2
- package/lib/seam/components/common-props.js.map +1 -1
- package/lib/seam/connect-webviews/use-create-connect-webview.d.ts +4 -3
- package/lib/seam/connect-webviews/use-create-connect-webview.js +3 -3
- package/lib/seam/connect-webviews/use-create-connect-webview.js.map +1 -1
- package/lib/seam/connected-accounts/use-connected-account.d.ts +3 -2
- package/lib/seam/connected-accounts/use-connected-account.js +2 -3
- package/lib/seam/connected-accounts/use-connected-account.js.map +1 -1
- package/lib/seam/devices/use-device-providers.d.ts +3 -2
- package/lib/seam/devices/use-device-providers.js.map +1 -1
- package/lib/seam/devices/use-device.d.ts +5 -4
- package/lib/seam/devices/use-device.js +2 -3
- package/lib/seam/devices/use-device.js.map +1 -1
- package/lib/seam/devices/use-devices.d.ts +4 -3
- package/lib/seam/devices/use-devices.js +2 -3
- package/lib/seam/devices/use-devices.js.map +1 -1
- package/lib/seam/events/use-events.d.ts +5 -4
- package/lib/seam/events/use-events.js +5 -5
- package/lib/seam/events/use-events.js.map +1 -1
- package/lib/seam/filters.d.ts +7 -7
- package/lib/seam/filters.js.map +1 -1
- package/lib/seam/locks/lock-device.d.ts +5 -0
- package/lib/seam/locks/lock-device.js +2 -0
- package/lib/seam/locks/lock-device.js.map +1 -0
- package/lib/seam/locks/use-toggle-lock.d.ts +16 -0
- package/lib/seam/locks/use-toggle-lock.js +59 -0
- package/lib/seam/locks/use-toggle-lock.js.map +1 -0
- package/lib/seam/noise-sensors/noise-sensor-device.d.ts +5 -0
- package/lib/seam/noise-sensors/noise-sensor-device.js +2 -0
- package/lib/seam/noise-sensors/noise-sensor-device.js.map +1 -0
- package/lib/seam/noise-sensors/use-noise-thresholds.d.ts +4 -3
- package/lib/seam/noise-sensors/use-noise-thresholds.js +2 -3
- package/lib/seam/noise-sensors/use-noise-thresholds.js.map +1 -1
- package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedule.d.ts +3 -2
- package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedule.js +2 -10
- package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedule.js.map +1 -1
- package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.d.ts +3 -2
- package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.js +3 -4
- package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.js.map +1 -1
- package/lib/seam/thermostats/climate-setting-schedules/use-create-climate-setting-schedule.d.ts +5 -3
- package/lib/seam/thermostats/climate-setting-schedules/use-create-climate-setting-schedule.js +10 -6
- package/lib/seam/thermostats/climate-setting-schedules/use-create-climate-setting-schedule.js.map +1 -1
- package/lib/seam/thermostats/climate-setting-schedules/use-delete-climate-setting-schedule.d.ts +5 -4
- package/lib/seam/thermostats/climate-setting-schedules/use-delete-climate-setting-schedule.js +13 -13
- package/lib/seam/thermostats/climate-setting-schedules/use-delete-climate-setting-schedule.js.map +1 -1
- package/lib/seam/thermostats/climate-setting-schedules/use-update-climate-setting-schedule.d.ts +5 -5
- package/lib/seam/thermostats/climate-setting-schedules/use-update-climate-setting-schedule.js +12 -17
- package/lib/seam/thermostats/climate-setting-schedules/use-update-climate-setting-schedule.js.map +1 -1
- package/lib/{temperature-bounds.d.ts → seam/thermostats/temperature-bounds.d.ts} +1 -1
- package/lib/{temperature-bounds.js → seam/thermostats/temperature-bounds.js} +4 -4
- package/lib/seam/thermostats/temperature-bounds.js.map +1 -0
- package/lib/seam/thermostats/thermostat-device.d.ts +17 -0
- package/lib/seam/thermostats/thermostat-device.js +2 -0
- package/lib/seam/thermostats/thermostat-device.js.map +1 -0
- package/lib/seam/thermostats/unit-conversion.d.ts +19 -0
- package/lib/seam/thermostats/unit-conversion.js +43 -0
- package/lib/seam/thermostats/unit-conversion.js.map +1 -0
- package/lib/seam/thermostats/use-cool-thermostat.d.ts +10 -4
- package/lib/seam/thermostats/use-cool-thermostat.js +34 -27
- package/lib/seam/thermostats/use-cool-thermostat.js.map +1 -1
- package/lib/seam/thermostats/use-heat-cool-thermostat.d.ts +10 -4
- package/lib/seam/thermostats/use-heat-cool-thermostat.js +34 -22
- package/lib/seam/thermostats/use-heat-cool-thermostat.js.map +1 -1
- package/lib/seam/thermostats/use-heat-thermostat.d.ts +10 -4
- package/lib/seam/thermostats/use-heat-thermostat.js +34 -27
- package/lib/seam/thermostats/use-heat-thermostat.js.map +1 -1
- package/lib/seam/thermostats/use-set-thermostat-fan-mode.d.ts +12 -0
- package/lib/seam/thermostats/use-set-thermostat-fan-mode.js +46 -0
- package/lib/seam/thermostats/use-set-thermostat-fan-mode.js.map +1 -0
- package/lib/seam/thermostats/use-set-thermostat-off.d.ts +10 -4
- package/lib/seam/thermostats/use-set-thermostat-off.js +36 -25
- package/lib/seam/thermostats/use-set-thermostat-off.js.map +1 -1
- package/lib/seam/thermostats/use-update-thermostat.d.ts +5 -5
- package/lib/seam/thermostats/use-update-thermostat.js +28 -27
- package/lib/seam/thermostats/use-update-thermostat.js.map +1 -1
- package/lib/seam/use-seam-client.d.ts +3 -3
- package/lib/seam/use-seam-client.js +5 -21
- package/lib/seam/use-seam-client.js.map +1 -1
- package/lib/seam/use-seam-query-result.d.ts +2 -2
- package/lib/ui/AccessCodeForm/AccessCodeForm.d.ts +5 -7
- package/lib/ui/AccessCodeForm/AccessCodeForm.js +9 -14
- package/lib/ui/AccessCodeForm/AccessCodeForm.js.map +1 -1
- package/lib/ui/AccessCodeForm/AccessCodeFormDatePicker.d.ts +1 -1
- package/lib/ui/AccessCodeForm/AccessCodeFormTimeZonePicker.d.ts +1 -1
- package/lib/ui/AccessCodeForm/AccessCodeFormTimes.d.ts +1 -1
- package/lib/ui/Checkbox.d.ts +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.d.ts +2 -2
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.js +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.js.map +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.d.ts +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.js +3 -3
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.js.map +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDefaultClimateSetting.d.ts +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDefaultClimateSetting.js.map +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDeviceSelect.d.ts +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormNameAndSchedule.d.ts +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormTimeZonePicker.d.ts +1 -1
- package/lib/ui/ClimateSettingForm/set-point-bounds.d.ts +4 -0
- package/lib/ui/ClimateSettingForm/set-point-bounds.js +17 -0
- package/lib/ui/ClimateSettingForm/set-point-bounds.js.map +1 -0
- package/lib/ui/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/lib/ui/FormField.d.ts +1 -1
- package/lib/ui/IconButton.d.ts +1 -1
- package/lib/ui/LoadingToast/LoadingToast.d.ts +1 -1
- package/lib/ui/RadioField/Radio.d.ts +1 -1
- package/lib/ui/RadioField/RadioField.d.ts +1 -1
- package/lib/ui/Snackbar/Snackbar.d.ts +1 -1
- package/lib/ui/Spinner/Spinner.d.ts +1 -1
- package/lib/ui/Switch/Switch.d.ts +1 -1
- package/lib/ui/TabSet.d.ts +1 -1
- package/lib/ui/Table/EmptyPlaceholder.d.ts +1 -1
- package/lib/ui/Table/TableCell.d.ts +1 -1
- package/lib/ui/Table/TableFilterBar/TableFilterBar.d.ts +1 -1
- package/lib/ui/Table/TableFilterBar/TableFilterItem.d.ts +1 -1
- package/lib/ui/Table/TableRow.d.ts +1 -1
- package/lib/ui/TextButton.d.ts +1 -1
- package/lib/ui/TextField/SearchTextField.d.ts +1 -1
- package/lib/ui/TimeZonePicker/TimeZonePicker.d.ts +1 -1
- package/lib/ui/clipboard.d.ts +1 -1
- package/lib/ui/clipboard.js +2 -2
- package/lib/ui/clipboard.js.map +1 -1
- package/lib/ui/device/BatteryStatusIndicator.d.ts +7 -0
- package/lib/ui/device/{BatteryStatus.js → BatteryStatusIndicator.js} +2 -2
- package/lib/ui/device/BatteryStatusIndicator.js.map +1 -0
- package/lib/ui/device/DeviceImage.d.ts +2 -2
- package/lib/ui/device/LockStatus.d.ts +3 -3
- package/lib/ui/device/LockStatus.js +1 -1
- package/lib/ui/device/LockStatus.js.map +1 -1
- package/lib/ui/device/NoiseLevelStatus.d.ts +2 -2
- package/lib/ui/device/NoiseLevelStatus.js +4 -4
- package/lib/ui/device/NoiseLevelStatus.js.map +1 -1
- package/lib/ui/device/OnlineStatus.d.ts +4 -4
- package/lib/ui/device/OnlineStatus.js.map +1 -1
- package/lib/ui/layout/ContentHeader.d.ts +1 -1
- package/lib/ui/layout/DotDivider.d.ts +1 -1
- package/lib/ui/noise-sensor/NoiseSensorActivityList.d.ts +2 -2
- package/lib/ui/noise-sensor/NoiseSensorActivityList.js +4 -2
- package/lib/ui/noise-sensor/NoiseSensorActivityList.js.map +1 -1
- package/lib/ui/noise-sensor/NoiseSensorEventItem.d.ts +6 -3
- package/lib/ui/noise-sensor/NoiseSensorEventItem.js +4 -7
- package/lib/ui/noise-sensor/NoiseSensorEventItem.js.map +1 -1
- package/lib/ui/noise-sensor/NoiseThresholdsList.d.ts +2 -2
- package/lib/ui/noise-sensor/NoiseThresholdsList.js.map +1 -1
- package/lib/ui/thermostat/ClimateModeMenu.d.ts +2 -2
- package/lib/ui/thermostat/ClimateModeMenu.js.map +1 -1
- package/lib/ui/thermostat/ClimateSettingControlGroup.d.ts +2 -2
- package/lib/ui/thermostat/ClimateSettingControlGroup.js.map +1 -1
- package/lib/ui/thermostat/ClimateSettingStatus.d.ts +2 -2
- package/lib/ui/thermostat/ClimateSettingStatus.js +2 -2
- package/lib/ui/thermostat/ClimateSettingStatus.js.map +1 -1
- package/lib/ui/thermostat/FanModeMenu.d.ts +2 -2
- package/lib/ui/thermostat/FanModeMenu.js.map +1 -1
- package/lib/ui/thermostat/Temperature.d.ts +1 -1
- package/lib/ui/thermostat/TemperatureControl.d.ts +1 -1
- package/lib/ui/thermostat/TemperatureControlGroup.d.ts +2 -2
- package/lib/ui/thermostat/TemperatureControlGroup.js +1 -1
- package/lib/ui/thermostat/TemperatureControlGroup.js.map +1 -1
- package/lib/ui/thermostat/ThermoModeMenuOption.d.ts +1 -1
- package/lib/ui/thermostat/ThermostatCard.d.ts +2 -2
- package/lib/ui/thermostat/ThermostatCard.js +5 -4
- package/lib/ui/thermostat/ThermostatCard.js.map +1 -1
- package/lib/ui/thermostat/ThermostatSelect.d.ts +1 -1
- package/lib/ui/thermostat/ThermostatSelect.js +2 -2
- package/lib/ui/thermostat/ThermostatSelect.js.map +1 -1
- package/lib/ui/typography/Title.d.ts +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +8 -9
- package/src/index.scss +1 -1
- package/src/lib/object.ts +13 -0
- package/src/lib/seam/SeamProvider.tsx +9 -4
- package/src/lib/seam/access-codes/use-access-code.ts +10 -16
- package/src/lib/seam/access-codes/use-access-codes.ts +11 -18
- package/src/lib/seam/access-codes/use-create-access-code.ts +21 -16
- package/src/lib/seam/access-codes/use-delete-access-code.ts +22 -22
- package/src/lib/seam/access-codes/use-generate-access-code-code.ts +17 -21
- package/src/lib/seam/access-codes/use-update-access-code.ts +33 -25
- package/src/lib/seam/client-sessions/use-client-session.ts +5 -10
- package/src/lib/seam/components/AccessCodeDetails/AccessCodeDetails.tsx +36 -23
- package/src/lib/seam/components/AccessCodeDetails/AccessCodeDevice.tsx +10 -7
- package/src/lib/seam/components/AccessCodeTable/AccessCodeHealthBar.tsx +2 -3
- package/src/lib/seam/components/AccessCodeTable/AccessCodeMainIcon.tsx +3 -2
- package/src/lib/seam/components/AccessCodeTable/AccessCodeMenu.tsx +5 -4
- package/src/lib/seam/components/AccessCodeTable/AccessCodeRow.tsx +3 -2
- package/src/lib/seam/components/AccessCodeTable/AccessCodeTable.tsx +3 -7
- package/src/lib/seam/components/AccessCodeTable/CodeDetails.tsx +12 -8
- package/src/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.tsx +4 -4
- package/src/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.tsx +3 -3
- package/src/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.tsx +6 -4
- package/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRow.tsx +3 -2
- package/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRowDetails.tsx +1 -1
- package/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.tsx +3 -6
- package/src/lib/seam/components/ConnectAccountButton/ConnectAccountButton.tsx +2 -2
- package/src/lib/seam/components/CreateAccessCodeForm/CreateAccessCodeForm.tsx +20 -16
- package/src/lib/seam/components/CreateClimateSettingScheduleForm/CreateClimateSettingScheduleForm.tsx +1 -1
- package/src/lib/seam/components/DeviceDetails/DeviceDetails.tsx +3 -2
- package/src/lib/seam/components/DeviceDetails/DeviceInfo.tsx +5 -3
- package/src/lib/seam/components/DeviceDetails/DeviceModel.tsx +2 -2
- package/src/lib/seam/components/DeviceDetails/LockDeviceDetails.tsx +6 -6
- package/src/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.tsx +1 -1
- package/src/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.tsx +7 -4
- package/src/lib/seam/components/DeviceTable/DeviceHealthBar.tsx +6 -3
- package/src/lib/seam/components/DeviceTable/DeviceRow.tsx +5 -7
- package/src/lib/seam/components/DeviceTable/DeviceTable.tsx +7 -14
- package/src/lib/seam/components/EditAccessCodeForm/EditAccessCodeForm.tsx +6 -7
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.tsx +3 -4
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.tsx +3 -2
- package/src/lib/seam/components/SupportedDeviceTable/use-device-model.ts +9 -14
- package/src/lib/seam/components/SupportedDeviceTable/use-device-models.ts +5 -9
- package/src/lib/seam/components/SupportedDeviceTable/use-manufacturer.ts +7 -12
- package/src/lib/seam/components/SupportedDeviceTable/use-manufacturers.ts +4 -8
- package/src/lib/seam/components/common-props.tsx +8 -4
- package/src/lib/seam/connect-webviews/use-create-connect-webview.ts +15 -17
- package/src/lib/seam/connected-accounts/use-connected-account.ts +17 -21
- package/src/lib/seam/devices/use-device-providers.ts +8 -11
- package/src/lib/seam/devices/use-device.ts +9 -18
- package/src/lib/seam/devices/use-devices.ts +20 -26
- package/src/lib/seam/events/use-events.ts +12 -14
- package/src/lib/seam/filters.ts +9 -8
- package/src/lib/seam/locks/lock-device.ts +9 -0
- package/src/lib/seam/locks/use-toggle-lock.ts +103 -0
- package/src/lib/seam/noise-sensors/noise-sensor-device.ts +10 -0
- package/src/lib/seam/noise-sensors/use-noise-thresholds.ts +12 -15
- package/src/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedule.ts +10 -23
- package/src/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.ts +13 -13
- package/src/lib/seam/thermostats/climate-setting-schedules/use-create-climate-setting-schedule.ts +30 -25
- package/src/lib/seam/thermostats/climate-setting-schedules/use-delete-climate-setting-schedule.ts +26 -28
- package/src/lib/seam/thermostats/climate-setting-schedules/use-update-climate-setting-schedule.ts +32 -41
- package/src/lib/{temperature-bounds.ts → seam/thermostats/temperature-bounds.ts} +8 -5
- package/src/lib/seam/thermostats/thermostat-device.ts +43 -0
- package/src/lib/seam/thermostats/unit-conversion.ts +89 -0
- package/src/lib/seam/thermostats/use-cool-thermostat.ts +77 -47
- package/src/lib/seam/thermostats/use-heat-cool-thermostat.ts +89 -40
- package/src/lib/seam/thermostats/use-heat-thermostat.ts +77 -47
- package/src/lib/seam/thermostats/use-set-thermostat-fan-mode.ts +95 -0
- package/src/lib/seam/thermostats/use-set-thermostat-off.ts +64 -40
- package/src/lib/seam/thermostats/use-update-thermostat.ts +47 -49
- package/src/lib/seam/use-seam-client.ts +11 -22
- package/src/lib/seam/use-seam-query-result.ts +2 -2
- package/src/lib/ui/AccessCodeForm/AccessCodeForm.tsx +18 -24
- package/src/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.tsx +4 -4
- package/src/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.tsx +6 -3
- package/src/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDefaultClimateSetting.tsx +1 -1
- package/src/lib/ui/ClimateSettingForm/set-point-bounds.ts +31 -0
- package/src/lib/ui/clipboard.ts +1 -1
- package/src/lib/ui/device/{BatteryStatus.tsx → BatteryStatusIndicator.tsx} +10 -5
- package/src/lib/ui/device/DeviceImage.tsx +2 -2
- package/src/lib/ui/device/LockStatus.tsx +3 -2
- package/src/lib/ui/device/NoiseLevelStatus.tsx +3 -3
- package/src/lib/ui/device/OnlineStatus.tsx +3 -3
- package/src/lib/ui/noise-sensor/NoiseSensorActivityList.tsx +15 -6
- package/src/lib/ui/noise-sensor/NoiseSensorEventItem.tsx +13 -9
- package/src/lib/ui/noise-sensor/NoiseThresholdsList.tsx +4 -3
- package/src/lib/ui/thermostat/ClimateModeMenu.tsx +1 -2
- package/src/lib/ui/thermostat/ClimateSettingControlGroup.tsx +1 -2
- package/src/lib/ui/thermostat/ClimateSettingStatus.tsx +2 -3
- package/src/lib/ui/thermostat/FanModeMenu.tsx +1 -2
- package/src/lib/ui/thermostat/TemperatureControlGroup.tsx +2 -2
- package/src/lib/ui/thermostat/ThermostatCard.tsx +11 -8
- package/src/lib/ui/thermostat/ThermostatSelect.tsx +4 -10
- package/src/lib/version.ts +1 -1
- package/lib/seam/devices/use-toggle-lock.d.ts +0 -5
- package/lib/seam/devices/use-toggle-lock.js +0 -56
- package/lib/seam/devices/use-toggle-lock.js.map +0 -1
- package/lib/seam/error-handlers.d.ts +0 -5
- package/lib/seam/error-handlers.js +0 -12
- package/lib/seam/error-handlers.js.map +0 -1
- package/lib/seam/thermostats/use-update-fan-mode.d.ts +0 -6
- package/lib/seam/thermostats/use-update-fan-mode.js +0 -42
- package/lib/seam/thermostats/use-update-fan-mode.js.map +0 -1
- package/lib/set-point-bounds.d.ts +0 -4
- package/lib/set-point-bounds.js +0 -24
- package/lib/set-point-bounds.js.map +0 -1
- package/lib/temperature-bounds.js.map +0 -1
- package/lib/ui/device/BatteryStatus.d.ts +0 -7
- package/lib/ui/device/BatteryStatus.js.map +0 -1
- package/src/lib/seam/devices/use-toggle-lock.ts +0 -84
- package/src/lib/seam/error-handlers.ts +0 -19
- package/src/lib/seam/thermostats/use-update-fan-mode.ts +0 -81
- package/src/lib/set-point-bounds.ts +0 -39
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { ClimateSetting } from 'seamapi'
|
|
2
|
-
|
|
3
1
|
import { ThermostatCoolIcon } from 'lib/icons/ThermostatCool.js'
|
|
4
2
|
import { ThermostatHeatIcon } from 'lib/icons/ThermostatHeat.js'
|
|
5
3
|
import { ThermostatHeatCoolIcon } from 'lib/icons/ThermostatHeatCool.js'
|
|
6
4
|
import { ThermostatOffIcon } from 'lib/icons/ThermostatOff.js'
|
|
5
|
+
import type { ClimateSetting } from 'lib/seam/thermostats/thermostat-device.js'
|
|
7
6
|
import { Temperature } from 'lib/ui/thermostat/Temperature.js'
|
|
8
7
|
|
|
9
8
|
interface ClimateSettingStatusProps {
|
|
@@ -93,7 +92,7 @@ function Content(props: {
|
|
|
93
92
|
return null
|
|
94
93
|
}
|
|
95
94
|
|
|
96
|
-
|
|
95
|
+
const isSetPoint = (setPoint: Partial<SetPoint>): setPoint is SetPoint => {
|
|
97
96
|
return setPoint.fahrenheit != null && setPoint.celsius != null
|
|
98
97
|
}
|
|
99
98
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { FanModeSetting } from 'seamapi'
|
|
2
|
-
|
|
3
1
|
import { ChevronDownIcon } from 'lib/icons/ChevronDown.js'
|
|
4
2
|
import { FanIcon } from 'lib/icons/Fan.js'
|
|
5
3
|
import { FanOutlineIcon } from 'lib/icons/FanOutline.js'
|
|
4
|
+
import type { FanModeSetting } from 'lib/seam/thermostats/thermostat-device.js'
|
|
6
5
|
import { Menu } from 'lib/ui/Menu/Menu.js'
|
|
7
6
|
import { ThermoModeMenuOption } from 'lib/ui/thermostat/ThermoModeMenuOption.js'
|
|
8
7
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo } from 'react'
|
|
2
|
-
import type { HvacModeSetting } from 'seamapi'
|
|
3
2
|
|
|
4
3
|
import { ThermostatCoolLargeIcon } from 'lib/icons/ThermostatCoolLarge.js'
|
|
5
4
|
import { ThermostatHeatLargeIcon } from 'lib/icons/ThermostatHeatLarge.js'
|
|
@@ -7,7 +6,8 @@ import {
|
|
|
7
6
|
getCoolBounds,
|
|
8
7
|
getHeatBounds,
|
|
9
8
|
getTemperatureBounds,
|
|
10
|
-
} from 'lib/temperature-bounds.js'
|
|
9
|
+
} from 'lib/seam/thermostats/temperature-bounds.js'
|
|
10
|
+
import type { HvacModeSetting } from 'lib/seam/thermostats/thermostat-device.js'
|
|
11
11
|
import { TemperatureControl } from 'lib/ui/thermostat/TemperatureControl.js'
|
|
12
12
|
|
|
13
13
|
export interface TemperatureControlGroupProps {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames'
|
|
2
2
|
import { useState } from 'react'
|
|
3
|
-
import type { ThermostatDevice, ThermostatDeviceProperties } from 'seamapi'
|
|
4
3
|
|
|
5
4
|
import { FanIcon } from 'lib/icons/Fan.js'
|
|
6
5
|
import { OffIcon } from 'lib/icons/Off.js'
|
|
6
|
+
import type { ThermostatDevice } from 'lib/seam/thermostats/thermostat-device.js'
|
|
7
7
|
import { DeviceImage } from 'lib/ui/device/DeviceImage.js'
|
|
8
8
|
import { ClimateSettingStatus } from 'lib/ui/thermostat/ClimateSettingStatus.js'
|
|
9
9
|
import { Temperature } from 'lib/ui/thermostat/Temperature.js'
|
|
@@ -41,7 +41,7 @@ function Content(props: { device: ThermostatDevice }): JSX.Element | null {
|
|
|
41
41
|
relative_humidity: relativeHumidity,
|
|
42
42
|
} = device.properties
|
|
43
43
|
|
|
44
|
-
const systemStatus = getSystemStatus(device
|
|
44
|
+
const systemStatus = getSystemStatus(device)
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
47
|
<div className='seam-thermostat-card-content'>
|
|
@@ -79,9 +79,11 @@ function Content(props: { device: ThermostatDevice }): JSX.Element | null {
|
|
|
79
79
|
|
|
80
80
|
<p className='seam-thermostat-property-value'>|</p>
|
|
81
81
|
<p className='seam-thermostat-property-label'>{t.humidity}:</p>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
{relativeHumidity != null && (
|
|
83
|
+
<p className='seam-thermostat-property-value'>
|
|
84
|
+
{relativeHumidity * 100}%
|
|
85
|
+
</p>
|
|
86
|
+
)}
|
|
85
87
|
</div>
|
|
86
88
|
|
|
87
89
|
<div className='seam-thermostat-property-block'>
|
|
@@ -130,9 +132,10 @@ function Content(props: { device: ThermostatDevice }): JSX.Element | null {
|
|
|
130
132
|
)
|
|
131
133
|
}
|
|
132
134
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
): 'heating' | 'cooling' | 'fan' | 'off' {
|
|
135
|
+
const getSystemStatus = (
|
|
136
|
+
device: ThermostatDevice
|
|
137
|
+
): 'heating' | 'cooling' | 'fan' | 'off' => {
|
|
138
|
+
const { properties } = device
|
|
136
139
|
const {
|
|
137
140
|
is_heating: isHeating,
|
|
138
141
|
is_cooling: isCooling,
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Device } from '@seamapi/types/connect'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
DeviceTable,
|
|
6
|
-
type UseDevicesData,
|
|
7
|
-
} from 'lib/index.js'
|
|
3
|
+
import { defaultDeviceFilter, DeviceTable } from 'lib/index.js'
|
|
4
|
+
import { isThermostatDevice } from 'lib/seam/thermostats/thermostat-device.js'
|
|
8
5
|
|
|
9
6
|
interface ThermostatSelectProps {
|
|
10
7
|
onSelect: (deviceId: string) => void
|
|
11
8
|
}
|
|
12
9
|
|
|
13
|
-
const deviceFilter = (
|
|
14
|
-
device: UseDevicesData[number],
|
|
15
|
-
searchInputValue: string
|
|
16
|
-
): boolean => {
|
|
10
|
+
const deviceFilter = (device: Device, searchInputValue: string): boolean => {
|
|
17
11
|
if (!isThermostatDevice(device)) return false
|
|
18
12
|
return defaultDeviceFilter(device, searchInputValue)
|
|
19
13
|
}
|
package/src/lib/version.ts
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type UseMutationResult } from '@tanstack/react-query';
|
|
2
|
-
import { type ActionAttempt, type LockDevice, type SeamError } from 'seamapi';
|
|
3
|
-
export declare function useToggleLock({ device_id: deviceId, properties: { locked }, }: LockDevice): UseMutationResult<{
|
|
4
|
-
actionAttempt: ActionAttempt;
|
|
5
|
-
}, SeamError, void>;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { useMutation, useQueryClient, } from '@tanstack/react-query';
|
|
2
|
-
import { isLockDevice, } from 'seamapi';
|
|
3
|
-
import { NullSeamClientError, useSeamClient } from '../../../lib/seam/use-seam-client.js';
|
|
4
|
-
export function useToggleLock({ device_id: deviceId, properties: { locked }, }) {
|
|
5
|
-
const { client } = useSeamClient();
|
|
6
|
-
const queryClient = useQueryClient();
|
|
7
|
-
return useMutation({
|
|
8
|
-
mutationFn: async () => {
|
|
9
|
-
if (client === null)
|
|
10
|
-
throw new NullSeamClientError();
|
|
11
|
-
const toggle = locked ? client.locks.unlockDoor : client.locks.lockDoor;
|
|
12
|
-
return await toggle(deviceId);
|
|
13
|
-
},
|
|
14
|
-
onMutate: () => {
|
|
15
|
-
queryClient.setQueryData(['devices', 'list', {}], (devices) => {
|
|
16
|
-
if (devices == null) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
return devices.map((device) => {
|
|
20
|
-
const isTarget = device.device_id === deviceId;
|
|
21
|
-
if (isTarget && isLockDevice(device)) {
|
|
22
|
-
return {
|
|
23
|
-
...device,
|
|
24
|
-
properties: {
|
|
25
|
-
...device.properties,
|
|
26
|
-
locked: !device.properties.locked,
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
return device;
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
queryClient.setQueryData(['devices', 'get', { device_id: deviceId }], (device) => {
|
|
34
|
-
if (device == null) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
...device,
|
|
39
|
-
properties: {
|
|
40
|
-
...device.properties,
|
|
41
|
-
locked: !device.properties.locked,
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
onSettled: async () => {
|
|
47
|
-
await queryClient.invalidateQueries({
|
|
48
|
-
queryKey: ['devices', 'list'],
|
|
49
|
-
});
|
|
50
|
-
await queryClient.invalidateQueries({
|
|
51
|
-
queryKey: ['devices', 'get', { device_id: deviceId }],
|
|
52
|
-
});
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=use-toggle-lock.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-toggle-lock.js","sourceRoot":"","sources":["../../../src/lib/seam/devices/use-toggle-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEX,cAAc,GACf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAGL,YAAY,GAGb,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAEhF,MAAM,UAAU,aAAa,CAAC,EAC5B,SAAS,EAAE,QAAQ,EACnB,UAAU,EAAE,EAAE,MAAM,EAAE,GACX;IAKX,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IAEpC,OAAO,WAAW,CAA8C;QAC9D,UAAU,EAAE,KAAK,IAAI,EAAE;YACrB,IAAI,MAAM,KAAK,IAAI;gBAAE,MAAM,IAAI,mBAAmB,EAAE,CAAA;YACpD,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAA;YACvE,OAAO,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAA;QAC/B,CAAC;QACD,QAAQ,EAAE,GAAG,EAAE;YACb,WAAW,CAAC,YAAY,CACtB,CAAC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,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { SeamMalformedInputError } from 'seamapi';
|
|
2
|
-
export const getValidationError = (params) => {
|
|
3
|
-
const { error, property } = params;
|
|
4
|
-
if (!(error instanceof SeamMalformedInputError)) {
|
|
5
|
-
return undefined;
|
|
6
|
-
}
|
|
7
|
-
const propertyErrors = (error.validationErrors[property] ?? {
|
|
8
|
-
_errors: [],
|
|
9
|
-
});
|
|
10
|
-
return propertyErrors._errors[0];
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=error-handlers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-handlers.js","sourceRoot":"","sources":["../../src/lib/seam/error-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAEjE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAGlC,EAAsB,EAAE;IACvB,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAA;IAClC,IAAI,CAAC,CAAC,KAAK,YAAY,uBAAuB,CAAC,EAAE,CAAC;QAChD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,cAAc,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI;QAC1D,OAAO,EAAE,EAAE;KACZ,CAEA,CAAA;IAED,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AAClC,CAAC,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type UseMutationResult } from '@tanstack/react-query';
|
|
2
|
-
import type { SeamError, ThermostatSetFanModeRequest } from 'seamapi';
|
|
3
|
-
type UseUpdateFanModeData = Record<string, unknown>;
|
|
4
|
-
type UseUpdateFanModeMutationParams = ThermostatSetFanModeRequest;
|
|
5
|
-
export declare function useUpdateFanMode(): UseMutationResult<UseUpdateFanModeData, SeamError, UseUpdateFanModeMutationParams>;
|
|
6
|
-
export {};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { useMutation, useQueryClient, } from '@tanstack/react-query';
|
|
2
|
-
import { NullSeamClientError, useSeamClient } from '../../../lib/seam/use-seam-client.js';
|
|
3
|
-
export function useUpdateFanMode() {
|
|
4
|
-
const { client } = useSeamClient();
|
|
5
|
-
const queryClient = useQueryClient();
|
|
6
|
-
return useMutation({
|
|
7
|
-
mutationFn: async (mutationParams) => {
|
|
8
|
-
if (client === null)
|
|
9
|
-
throw new NullSeamClientError();
|
|
10
|
-
return await client.thermostats.setFanMode(mutationParams);
|
|
11
|
-
},
|
|
12
|
-
onSuccess: (_data, variables) => {
|
|
13
|
-
queryClient.setQueryData(['devices', 'get', { device_id: variables.device_id }], (thermostat) => {
|
|
14
|
-
if (thermostat == null) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
return getUpdatedThermostat(thermostat, variables);
|
|
18
|
-
});
|
|
19
|
-
queryClient.setQueryData(['devices', 'list', { device_id: variables.device_id }], (thermostats) => {
|
|
20
|
-
if (thermostats == null) {
|
|
21
|
-
return [];
|
|
22
|
-
}
|
|
23
|
-
return thermostats.map((thermostat) => {
|
|
24
|
-
if (thermostat.device_id === variables.device_id) {
|
|
25
|
-
return getUpdatedThermostat(thermostat, variables);
|
|
26
|
-
}
|
|
27
|
-
return thermostat;
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
function getUpdatedThermostat(thermostat, variables) {
|
|
34
|
-
return {
|
|
35
|
-
...thermostat,
|
|
36
|
-
properties: {
|
|
37
|
-
...thermostat.properties,
|
|
38
|
-
fan_mode_setting: variables.fan_mode_setting ?? thermostat.properties.fan_mode_setting,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=use-update-fan-mode.js.map
|
|
@@ -1 +0,0 @@
|
|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AS,KAAK,SAAS,CAAC,SAAS,EAAE,CAAC;wBACjD,OAAO,oBAAoB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;oBACpD,CAAC;oBAED,OAAO,UAAU,CAAA;gBACnB,CAAC,CAAC,CAAA;YACJ,CAAC,CACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,oBAAoB,CAC3B,UAA4B,EAC5B,SAAyC;IAEzC,OAAO;QACL,GAAG,UAAU;QACb,UAAU,EAAE;YACV,GAAG,UAAU,CAAC,UAAU;YACxB,gBAAgB,EACd,SAAS,CAAC,gBAAgB,IAAI,UAAU,CAAC,UAAU,CAAC,gBAAgB;SACvE;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ThermostatDeviceProperties } from 'seamapi';
|
|
2
|
-
import type { TemperatureControlGroupProps } from '../lib/ui/thermostat/TemperatureControlGroup.js';
|
|
3
|
-
export type SetPointBounds = Partial<Pick<TemperatureControlGroupProps, 'minCool' | 'maxCool' | 'minHeat' | 'maxHeat' | 'delta'>>;
|
|
4
|
-
export declare const getSetPointBounds: (properties: ThermostatDeviceProperties) => SetPointBounds;
|
package/lib/set-point-bounds.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export const getSetPointBounds = (properties) => {
|
|
2
|
-
let setPointBounds = {};
|
|
3
|
-
if (properties.is_cooling_available) {
|
|
4
|
-
setPointBounds = {
|
|
5
|
-
minCool: properties.min_cooling_set_point_fahrenheit,
|
|
6
|
-
maxCool: properties.max_cooling_set_point_fahrenheit,
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
if (properties.is_heating_available) {
|
|
10
|
-
setPointBounds = {
|
|
11
|
-
...setPointBounds,
|
|
12
|
-
minHeat: properties.min_heating_set_point_fahrenheit,
|
|
13
|
-
maxHeat: properties.max_heating_set_point_fahrenheit,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
if (properties.is_cooling_available && properties.is_heating_available) {
|
|
17
|
-
setPointBounds = {
|
|
18
|
-
...setPointBounds,
|
|
19
|
-
delta: properties.min_heating_cooling_delta_fahrenheit,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
return setPointBounds;
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=set-point-bounds.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"set-point-bounds.js","sourceRoot":"","sources":["../src/lib/set-point-bounds.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,UAAsC,EACtB,EAAE;IAClB,IAAI,cAAc,GAAmB,EAAE,CAAA;IAEvC,IAAI,UAAU,CAAC,oBAAoB,EAAE,CAAC;QACpC,cAAc,GAAG;YACf,OAAO,EAAE,UAAU,CAAC,gCAAgC;YACpD,OAAO,EAAE,UAAU,CAAC,gCAAgC;SACrD,CAAA;IACH,CAAC;IAED,IAAI,UAAU,CAAC,oBAAoB,EAAE,CAAC;QACpC,cAAc,GAAG;YACf,GAAG,cAAc;YACjB,OAAO,EAAE,UAAU,CAAC,gCAAgC;YACpD,OAAO,EAAE,UAAU,CAAC,gCAAgC;SACrD,CAAA;IACH,CAAC;IAED,IAAI,UAAU,CAAC,oBAAoB,IAAI,UAAU,CAAC,oBAAoB,EAAE,CAAC;QACvE,cAAc,GAAG;YACf,GAAG,cAAc;YACjB,KAAK,EAAE,UAAU,CAAC,oCAAoC;SACvD,CAAA;IACH,CAAC;IACD,OAAO,cAAc,CAAA;AACvB,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"temperature-bounds.js","sourceRoot":"","sources":["../src/lib/temperature-bounds.ts"],"names":[],"mappings":"AAqBA,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC5B,IAAI,EACJ,OAAO,EACP,OAAO,EACP,OAAO,EACP,KAAK,GAC0B,EAAU,EAAE;IAC3C,MAAM,aAAa,G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AK,EAAE,KAAK,GAAI,IACvB,IACN,CACJ,CAAA;IACH,CAAC;IAED,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,CACL,8BACE,KAAC,mBAAmB,KAAG,EACvB,gBAAM,SAAS,EAAC,kBAAkB,aAC/B,CAAC,CAAC,GAAG,EACN,KAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,IACvB,IACN,CACJ,CAAA;IACH,CAAC;IAED,IAAI,MAAM,KAAK,UAAU,EAAE,CAAC;QAC1B,OAAO,CACL,8BACE,KAAC,wBAAwB,KAAG,EAC5B,gBAAM,SAAS,EAAC,kBAAkB,aAC/B,CAAC,CAAC,QAAQ,EACX,KAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,IACvB,IACN,CACJ,CAAA;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,UAAU,CAAC,KAEnB;IACC,IAAI,KAAK,CAAC,KAAK,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IACpC,OAAO,oCAAK,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,UAAM,CAAA;AACjD,CAAC;AAED,MAAM,CAAC,GAAG;IACR,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,MAAM;CACjB,CAAA"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useMutation,
|
|
3
|
-
type UseMutationResult,
|
|
4
|
-
useQueryClient,
|
|
5
|
-
} from '@tanstack/react-query'
|
|
6
|
-
import {
|
|
7
|
-
type ActionAttempt,
|
|
8
|
-
type CommonDevice,
|
|
9
|
-
isLockDevice,
|
|
10
|
-
type LockDevice,
|
|
11
|
-
type SeamError,
|
|
12
|
-
} from 'seamapi'
|
|
13
|
-
|
|
14
|
-
import { NullSeamClientError, useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
15
|
-
|
|
16
|
-
export function useToggleLock({
|
|
17
|
-
device_id: deviceId,
|
|
18
|
-
properties: { locked },
|
|
19
|
-
}: LockDevice): UseMutationResult<
|
|
20
|
-
{ actionAttempt: ActionAttempt },
|
|
21
|
-
SeamError,
|
|
22
|
-
void
|
|
23
|
-
> {
|
|
24
|
-
const { client } = useSeamClient()
|
|
25
|
-
const queryClient = useQueryClient()
|
|
26
|
-
|
|
27
|
-
return useMutation<{ actionAttempt: ActionAttempt }, SeamError>({
|
|
28
|
-
mutationFn: async () => {
|
|
29
|
-
if (client === null) throw new NullSeamClientError()
|
|
30
|
-
const toggle = locked ? client.locks.unlockDoor : client.locks.lockDoor
|
|
31
|
-
return await toggle(deviceId)
|
|
32
|
-
},
|
|
33
|
-
onMutate: () => {
|
|
34
|
-
queryClient.setQueryData<CommonDevice[]>(
|
|
35
|
-
['devices', 'list', {}],
|
|
36
|
-
(devices) => {
|
|
37
|
-
if (devices == null) {
|
|
38
|
-
return
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return devices.map((device) => {
|
|
42
|
-
const isTarget = device.device_id === deviceId
|
|
43
|
-
if (isTarget && isLockDevice(device)) {
|
|
44
|
-
return {
|
|
45
|
-
...device,
|
|
46
|
-
properties: {
|
|
47
|
-
...device.properties,
|
|
48
|
-
locked: !device.properties.locked,
|
|
49
|
-
},
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return device
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
queryClient.setQueryData<LockDevice>(
|
|
59
|
-
['devices', 'get', { device_id: deviceId }],
|
|
60
|
-
(device) => {
|
|
61
|
-
if (device == null) {
|
|
62
|
-
return
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
...device,
|
|
67
|
-
properties: {
|
|
68
|
-
...device.properties,
|
|
69
|
-
locked: !device.properties.locked,
|
|
70
|
-
},
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
)
|
|
74
|
-
},
|
|
75
|
-
onSettled: async () => {
|
|
76
|
-
await queryClient.invalidateQueries({
|
|
77
|
-
queryKey: ['devices', 'list'],
|
|
78
|
-
})
|
|
79
|
-
await queryClient.invalidateQueries({
|
|
80
|
-
queryKey: ['devices', 'get', { device_id: deviceId }],
|
|
81
|
-
})
|
|
82
|
-
},
|
|
83
|
-
})
|
|
84
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type SeamError, SeamMalformedInputError } from 'seamapi'
|
|
2
|
-
|
|
3
|
-
export const getValidationError = (params: {
|
|
4
|
-
error: SeamError
|
|
5
|
-
property: string
|
|
6
|
-
}): string | undefined => {
|
|
7
|
-
const { error, property } = params
|
|
8
|
-
if (!(error instanceof SeamMalformedInputError)) {
|
|
9
|
-
return undefined
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const propertyErrors = (error.validationErrors[property] ?? {
|
|
13
|
-
_errors: [],
|
|
14
|
-
}) as {
|
|
15
|
-
_errors: string[]
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return propertyErrors._errors[0]
|
|
19
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useMutation,
|
|
3
|
-
type UseMutationResult,
|
|
4
|
-
useQueryClient,
|
|
5
|
-
} from '@tanstack/react-query'
|
|
6
|
-
import type {
|
|
7
|
-
SeamError,
|
|
8
|
-
ThermostatDevice,
|
|
9
|
-
ThermostatSetFanModeRequest,
|
|
10
|
-
ThermostatsListResponse,
|
|
11
|
-
} from 'seamapi'
|
|
12
|
-
|
|
13
|
-
import { NullSeamClientError, useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
14
|
-
|
|
15
|
-
// UPSTREAM: Missing ThermostatSetFanModeResponse in seamapi.
|
|
16
|
-
type UseUpdateFanModeData = Record<string, unknown>
|
|
17
|
-
type UseUpdateFanModeMutationParams = ThermostatSetFanModeRequest
|
|
18
|
-
|
|
19
|
-
export function useUpdateFanMode(): UseMutationResult<
|
|
20
|
-
UseUpdateFanModeData,
|
|
21
|
-
SeamError,
|
|
22
|
-
UseUpdateFanModeMutationParams
|
|
23
|
-
> {
|
|
24
|
-
const { client } = useSeamClient()
|
|
25
|
-
const queryClient = useQueryClient()
|
|
26
|
-
|
|
27
|
-
return useMutation<
|
|
28
|
-
UseUpdateFanModeData,
|
|
29
|
-
SeamError,
|
|
30
|
-
UseUpdateFanModeMutationParams
|
|
31
|
-
>({
|
|
32
|
-
mutationFn: async (mutationParams: UseUpdateFanModeMutationParams) => {
|
|
33
|
-
if (client === null) throw new NullSeamClientError()
|
|
34
|
-
|
|
35
|
-
return await client.thermostats.setFanMode(mutationParams)
|
|
36
|
-
},
|
|
37
|
-
onSuccess: (_data, variables) => {
|
|
38
|
-
queryClient.setQueryData<ThermostatDevice | null>(
|
|
39
|
-
['devices', 'get', { device_id: variables.device_id }],
|
|
40
|
-
(thermostat) => {
|
|
41
|
-
if (thermostat == null) {
|
|
42
|
-
return
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return getUpdatedThermostat(thermostat, variables)
|
|
46
|
-
}
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
queryClient.setQueryData<ThermostatsListResponse['thermostats']>(
|
|
50
|
-
['devices', 'list', { device_id: variables.device_id }],
|
|
51
|
-
(thermostats): ThermostatDevice[] => {
|
|
52
|
-
if (thermostats == null) {
|
|
53
|
-
return []
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return thermostats.map((thermostat) => {
|
|
57
|
-
if (thermostat.device_id === variables.device_id) {
|
|
58
|
-
return getUpdatedThermostat(thermostat, variables)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return thermostat
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
)
|
|
65
|
-
},
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function getUpdatedThermostat(
|
|
70
|
-
thermostat: ThermostatDevice,
|
|
71
|
-
variables: UseUpdateFanModeMutationParams
|
|
72
|
-
): ThermostatDevice {
|
|
73
|
-
return {
|
|
74
|
-
...thermostat,
|
|
75
|
-
properties: {
|
|
76
|
-
...thermostat.properties,
|
|
77
|
-
fan_mode_setting:
|
|
78
|
-
variables.fan_mode_setting ?? thermostat.properties.fan_mode_setting,
|
|
79
|
-
},
|
|
80
|
-
}
|
|
81
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { ThermostatDeviceProperties } from 'seamapi'
|
|
2
|
-
|
|
3
|
-
import type { TemperatureControlGroupProps } from 'lib/ui/thermostat/TemperatureControlGroup.js'
|
|
4
|
-
|
|
5
|
-
export type SetPointBounds = Partial<
|
|
6
|
-
Pick<
|
|
7
|
-
TemperatureControlGroupProps,
|
|
8
|
-
'minCool' | 'maxCool' | 'minHeat' | 'maxHeat' | 'delta'
|
|
9
|
-
>
|
|
10
|
-
>
|
|
11
|
-
|
|
12
|
-
export const getSetPointBounds = (
|
|
13
|
-
properties: ThermostatDeviceProperties
|
|
14
|
-
): SetPointBounds => {
|
|
15
|
-
let setPointBounds: SetPointBounds = {}
|
|
16
|
-
|
|
17
|
-
if (properties.is_cooling_available) {
|
|
18
|
-
setPointBounds = {
|
|
19
|
-
minCool: properties.min_cooling_set_point_fahrenheit,
|
|
20
|
-
maxCool: properties.max_cooling_set_point_fahrenheit,
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (properties.is_heating_available) {
|
|
25
|
-
setPointBounds = {
|
|
26
|
-
...setPointBounds,
|
|
27
|
-
minHeat: properties.min_heating_set_point_fahrenheit,
|
|
28
|
-
maxHeat: properties.max_heating_set_point_fahrenheit,
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (properties.is_cooling_available && properties.is_heating_available) {
|
|
33
|
-
setPointBounds = {
|
|
34
|
-
...setPointBounds,
|
|
35
|
-
delta: properties.min_heating_cooling_delta_fahrenheit,
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return setPointBounds
|
|
39
|
-
}
|