@seamapi/react 2.19.1 → 3.0.0-beta.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 +19704 -25713
- package/dist/elements.js.map +1 -1
- package/lib/icons/NoiseLevelsRed.d.ts +2 -0
- package/lib/icons/NoiseLevelsRed.js +5 -0
- package/lib/icons/NoiseLevelsRed.js.map +1 -0
- 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 +10 -5
- 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 +7 -8
- package/src/index.scss +1 -1
- package/src/lib/icons/NoiseLevelsRed.tsx +33 -0
- 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 +17 -5
- 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,15 +1,16 @@
|
|
|
1
|
+
import type { SeamHttpApiError } from '@seamapi/http/connect'
|
|
1
2
|
import type {
|
|
2
3
|
Manufacturer,
|
|
3
4
|
RouteRequestParams,
|
|
4
5
|
RouteResponse,
|
|
5
6
|
} from '@seamapi/types/devicedb'
|
|
6
7
|
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
|
7
|
-
import type { SeamError } from 'seamapi'
|
|
8
8
|
|
|
9
9
|
import { useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
10
10
|
import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
|
|
11
11
|
|
|
12
12
|
export type UseManufacturersParams = ManufacturersListParams
|
|
13
|
+
|
|
13
14
|
export type UseManufacturersData = Manufacturer[]
|
|
14
15
|
|
|
15
16
|
export function useManufacturers(
|
|
@@ -18,10 +19,7 @@ export function useManufacturers(
|
|
|
18
19
|
const { client: seam } = useSeamClient()
|
|
19
20
|
const queryClient = useQueryClient()
|
|
20
21
|
|
|
21
|
-
const { data, ...rest } = useQuery<
|
|
22
|
-
ManufacturersListResponse['manufacturers'],
|
|
23
|
-
SeamError
|
|
24
|
-
>({
|
|
22
|
+
const { data, ...rest } = useQuery<UseManufacturersData, SeamHttpApiError>({
|
|
25
23
|
enabled: seam != null,
|
|
26
24
|
queryKey: ['internal', 'manufacturers', 'list', params],
|
|
27
25
|
queryFn: async () => {
|
|
@@ -32,9 +30,6 @@ export function useManufacturers(
|
|
|
32
30
|
'/internal/devicedb/v1/manufacturers/list',
|
|
33
31
|
{ params }
|
|
34
32
|
)
|
|
35
|
-
return manufacturers
|
|
36
|
-
},
|
|
37
|
-
onSuccess: (manufacturers) => {
|
|
38
33
|
for (const manufacturer of manufacturers) {
|
|
39
34
|
queryClient.setQueryData(
|
|
40
35
|
[
|
|
@@ -46,6 +41,7 @@ export function useManufacturers(
|
|
|
46
41
|
manufacturer
|
|
47
42
|
)
|
|
48
43
|
}
|
|
44
|
+
return manufacturers
|
|
49
45
|
},
|
|
50
46
|
})
|
|
51
47
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { ComponentType } from 'react'
|
|
2
1
|
import type {
|
|
3
2
|
AccessCodeError,
|
|
3
|
+
AccessCodeWarning,
|
|
4
4
|
ConnectedAccountError,
|
|
5
|
+
ConnectedAccountWarning,
|
|
5
6
|
DeviceError,
|
|
6
|
-
|
|
7
|
-
} from 'seamapi'
|
|
7
|
+
DeviceWarning,
|
|
8
|
+
} from '@seamapi/types/connect'
|
|
9
|
+
import type { ComponentType } from 'react'
|
|
8
10
|
|
|
9
11
|
export interface RequiredCommonProps {
|
|
10
12
|
className: string | undefined
|
|
@@ -12,7 +14,9 @@ export interface RequiredCommonProps {
|
|
|
12
14
|
errorFilter: (
|
|
13
15
|
error: ConnectedAccountError | DeviceError | AccessCodeError
|
|
14
16
|
) => boolean
|
|
15
|
-
warningFilter: (
|
|
17
|
+
warningFilter: (
|
|
18
|
+
warning: ConnectedAccountWarning | DeviceWarning | AccessCodeWarning
|
|
19
|
+
) => boolean
|
|
16
20
|
disableDeleteAccessCode: boolean | undefined
|
|
17
21
|
disableCreateAccessCode: boolean | undefined
|
|
18
22
|
disableEditAccessCode: boolean | undefined
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { useMutation, type UseMutationResult } from '@tanstack/react-query'
|
|
2
1
|
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '
|
|
2
|
+
ConnectWebviewsCreateBody,
|
|
3
|
+
SeamHttpApiError,
|
|
4
|
+
} from '@seamapi/http/connect'
|
|
5
|
+
import type { ConnectWebview } from '@seamapi/types/connect'
|
|
6
|
+
import { useMutation, type UseMutationResult } from '@tanstack/react-query'
|
|
8
7
|
|
|
9
8
|
import { useClientSession } from 'lib/seam/client-sessions/use-client-session.js'
|
|
10
9
|
import { NullSeamClientError, useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
@@ -14,34 +13,33 @@ export interface UseCreateConnectWebviewParams {
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export type UseCreateConnectWebviewData = ConnectWebview
|
|
17
|
-
|
|
16
|
+
|
|
17
|
+
export type UseCreateConnectWebviewMutationVariables = ConnectWebviewsCreateBody
|
|
18
18
|
|
|
19
19
|
export function useCreateConnectWebview({
|
|
20
20
|
willNavigateToWebview = false,
|
|
21
21
|
}: UseCreateConnectWebviewParams = {}): UseMutationResult<
|
|
22
22
|
UseCreateConnectWebviewData,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
SeamHttpApiError,
|
|
24
|
+
UseCreateConnectWebviewMutationVariables
|
|
25
25
|
> {
|
|
26
26
|
const { client } = useSeamClient()
|
|
27
27
|
const { clientSession } = useClientSession()
|
|
28
28
|
|
|
29
29
|
return useMutation<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
UseCreateConnectWebviewData,
|
|
31
|
+
SeamHttpApiError,
|
|
32
|
+
UseCreateConnectWebviewMutationVariables
|
|
33
33
|
>({
|
|
34
|
-
mutationFn: async (
|
|
35
|
-
mutationParams: UseCreateConnectWebviewMutationParams
|
|
36
|
-
) => {
|
|
34
|
+
mutationFn: async (variables) => {
|
|
37
35
|
if (client === null) throw new NullSeamClientError()
|
|
38
36
|
return await client.connectWebviews.create({
|
|
39
37
|
custom_metadata: {
|
|
40
38
|
client_session_id: clientSession?.client_session_id ?? null,
|
|
41
39
|
user_identifier_key: clientSession?.user_identifier_key ?? null,
|
|
42
|
-
...
|
|
40
|
+
...variables.custom_metadata,
|
|
43
41
|
},
|
|
44
|
-
...
|
|
42
|
+
...variables,
|
|
45
43
|
})
|
|
46
44
|
},
|
|
47
45
|
onSuccess: ({ url }) => {
|
|
@@ -1,35 +1,31 @@
|
|
|
1
|
-
import { useQuery } from '@tanstack/react-query'
|
|
2
1
|
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '
|
|
2
|
+
ConnectedAccountsGetParams,
|
|
3
|
+
SeamHttpApiError,
|
|
4
|
+
} from '@seamapi/http/connect'
|
|
5
|
+
import type { ConnectedAccount } from '@seamapi/types/connect'
|
|
6
|
+
import { useQuery } from '@tanstack/react-query'
|
|
8
7
|
|
|
9
8
|
import { useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
10
9
|
import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
|
|
11
10
|
|
|
12
|
-
export type UseConnectedAccountParams =
|
|
11
|
+
export type UseConnectedAccountParams = ConnectedAccountsGetParams
|
|
12
|
+
|
|
13
13
|
export type UseConnectedAccountData = ConnectedAccount | null
|
|
14
14
|
|
|
15
15
|
export function useConnectedAccount(
|
|
16
16
|
params: UseConnectedAccountParams
|
|
17
17
|
): UseSeamQueryResult<'connectedAccount', UseConnectedAccountData> {
|
|
18
|
-
const normalizedParams =
|
|
19
|
-
typeof params === 'string' ? { connected_account_id: params } : params
|
|
20
|
-
|
|
21
18
|
const { client } = useSeamClient()
|
|
22
|
-
const { data, ...rest } = useQuery<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
})
|
|
19
|
+
const { data, ...rest } = useQuery<UseConnectedAccountData, SeamHttpApiError>(
|
|
20
|
+
{
|
|
21
|
+
enabled: client != null,
|
|
22
|
+
queryKey: ['connected_accounts', 'get', params],
|
|
23
|
+
queryFn: async () => {
|
|
24
|
+
if (client == null) return null
|
|
25
|
+
return await client.connectedAccounts.get(params)
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
)
|
|
33
29
|
|
|
34
30
|
return { ...rest, connectedAccount: data }
|
|
35
31
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { useQuery } from '@tanstack/react-query'
|
|
2
1
|
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '
|
|
2
|
+
DevicesListDeviceProvidersParams,
|
|
3
|
+
SeamHttpApiError,
|
|
4
|
+
} from '@seamapi/http/connect'
|
|
5
|
+
import type { DeviceProvider } from '@seamapi/types/connect'
|
|
6
|
+
import { useQuery } from '@tanstack/react-query'
|
|
8
7
|
|
|
9
8
|
import { useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
10
9
|
import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
|
|
11
10
|
|
|
12
|
-
export type UseDeviceProvidersParams =
|
|
11
|
+
export type UseDeviceProvidersParams = DevicesListDeviceProvidersParams
|
|
12
|
+
|
|
13
13
|
export type UseDeviceProvidersData = DeviceProvider[]
|
|
14
14
|
|
|
15
15
|
export function useDeviceProviders(
|
|
@@ -17,10 +17,7 @@ export function useDeviceProviders(
|
|
|
17
17
|
): UseSeamQueryResult<'deviceProviders', UseDeviceProvidersData> {
|
|
18
18
|
const { client } = useSeamClient()
|
|
19
19
|
|
|
20
|
-
const { data, ...rest } = useQuery<
|
|
21
|
-
DeviceProvidersListResponse['device_providers'],
|
|
22
|
-
SeamError
|
|
23
|
-
>({
|
|
20
|
+
const { data, ...rest } = useQuery<UseDeviceProvidersData, SeamHttpApiError>({
|
|
24
21
|
enabled: client != null,
|
|
25
22
|
queryKey: ['devices', 'list_device_providers', params],
|
|
26
23
|
queryFn: async () => {
|
|
@@ -1,33 +1,24 @@
|
|
|
1
|
+
import type { DevicesGetParams, SeamHttpApiError } from '@seamapi/http/connect'
|
|
2
|
+
import type { Device } from '@seamapi/types/connect'
|
|
1
3
|
import { useQuery } from '@tanstack/react-query'
|
|
2
|
-
import type {
|
|
3
|
-
CommonDevice,
|
|
4
|
-
DeviceGetRequest,
|
|
5
|
-
DeviceGetResponse,
|
|
6
|
-
SeamError,
|
|
7
|
-
} from 'seamapi'
|
|
8
4
|
|
|
9
5
|
import { useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
10
6
|
import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
|
|
11
7
|
|
|
12
|
-
export type UseDeviceParams =
|
|
13
|
-
|
|
8
|
+
export type UseDeviceParams = DevicesGetParams
|
|
9
|
+
|
|
10
|
+
export type UseDeviceData = Device | null
|
|
14
11
|
|
|
15
12
|
export function useDevice(
|
|
16
|
-
params:
|
|
13
|
+
params: UseDeviceParams
|
|
17
14
|
): UseSeamQueryResult<'device', UseDeviceData> {
|
|
18
|
-
const normalizedParams =
|
|
19
|
-
typeof params === 'string' ? { device_id: params } : params
|
|
20
|
-
|
|
21
15
|
const { client } = useSeamClient()
|
|
22
|
-
const { data, ...rest } = useQuery<
|
|
23
|
-
DeviceGetResponse['device'] | null,
|
|
24
|
-
SeamError
|
|
25
|
-
>({
|
|
16
|
+
const { data, ...rest } = useQuery<UseDeviceData, SeamHttpApiError>({
|
|
26
17
|
enabled: client != null,
|
|
27
|
-
queryKey: ['devices', 'get',
|
|
18
|
+
queryKey: ['devices', 'get', params],
|
|
28
19
|
queryFn: async () => {
|
|
29
20
|
if (client == null) return null
|
|
30
|
-
return await client.devices.get(
|
|
21
|
+
return await client.devices.get(params)
|
|
31
22
|
},
|
|
32
23
|
})
|
|
33
24
|
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
+
import type { DevicesListParams, SeamHttpApiError } from '@seamapi/http/connect'
|
|
2
|
+
import type { Device } from '@seamapi/types/connect'
|
|
1
3
|
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
|
2
|
-
import type {
|
|
3
|
-
CommonDevice,
|
|
4
|
-
DevicesListRequest,
|
|
5
|
-
DevicesListResponse,
|
|
6
|
-
SeamError,
|
|
7
|
-
} from 'seamapi'
|
|
8
4
|
|
|
9
5
|
import { useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
10
6
|
import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
|
|
11
7
|
|
|
12
|
-
export type UseDevicesParams =
|
|
13
|
-
|
|
8
|
+
export type UseDevicesParams = DevicesListParams
|
|
9
|
+
|
|
10
|
+
export type UseDevicesData = Device[]
|
|
14
11
|
|
|
15
12
|
export function useDevices(
|
|
16
13
|
params?: UseDevicesParams
|
|
@@ -18,24 +15,21 @@ export function useDevices(
|
|
|
18
15
|
const { client } = useSeamClient()
|
|
19
16
|
const queryClient = useQueryClient()
|
|
20
17
|
|
|
21
|
-
const { data, ...rest } = useQuery<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
}
|
|
38
|
-
)
|
|
18
|
+
const { data, ...rest } = useQuery<UseDevicesData, SeamHttpApiError>({
|
|
19
|
+
enabled: client != null,
|
|
20
|
+
queryKey: ['devices', 'list', params],
|
|
21
|
+
queryFn: async () => {
|
|
22
|
+
if (client == null) return []
|
|
23
|
+
const devices = await client.devices.list(params)
|
|
24
|
+
for (const device of devices) {
|
|
25
|
+
queryClient.setQueryData(
|
|
26
|
+
['devices', 'get', { device_id: device.device_id }],
|
|
27
|
+
device
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
return devices
|
|
31
|
+
},
|
|
32
|
+
})
|
|
39
33
|
|
|
40
34
|
return { ...rest, devices: data }
|
|
41
35
|
}
|
|
@@ -1,43 +1,41 @@
|
|
|
1
|
+
import type { EventsListParams, SeamHttpApiError } from '@seamapi/http/connect'
|
|
2
|
+
import type { SeamEvent } from '@seamapi/types/connect'
|
|
1
3
|
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
|
2
|
-
import type {
|
|
3
|
-
Event,
|
|
4
|
-
EventsListRequest,
|
|
5
|
-
EventsListResponse,
|
|
6
|
-
SeamError,
|
|
7
|
-
} from 'seamapi'
|
|
8
4
|
|
|
9
5
|
import { useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
10
6
|
import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
|
|
11
7
|
|
|
12
|
-
export type UseEventsParams =
|
|
13
|
-
|
|
8
|
+
export type UseEventsParams = EventsListParams
|
|
9
|
+
|
|
10
|
+
export type UseEventsData = SeamEvent[]
|
|
11
|
+
|
|
14
12
|
export interface UseEventsOptions {
|
|
15
13
|
refetchInterval?: number
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
export function useEvents(
|
|
19
17
|
params?: UseEventsParams,
|
|
20
|
-
|
|
18
|
+
{ refetchInterval }: UseEventsOptions = {}
|
|
21
19
|
): UseSeamQueryResult<'events', UseEventsData> {
|
|
22
20
|
const { client } = useSeamClient()
|
|
23
21
|
const queryClient = useQueryClient()
|
|
24
22
|
|
|
25
|
-
const { data, ...rest } = useQuery<
|
|
23
|
+
const { data, ...rest } = useQuery<UseEventsData, SeamHttpApiError>({
|
|
26
24
|
enabled: client != null,
|
|
27
25
|
queryKey: ['events', 'list', params],
|
|
28
26
|
queryFn: async () => {
|
|
29
27
|
if (client == null) return []
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
onSuccess: (events) => {
|
|
28
|
+
const events = await client.events.list(params)
|
|
33
29
|
for (const event of events) {
|
|
34
30
|
queryClient.setQueryData(
|
|
35
31
|
['events', 'get', { event_id: event.event_id }],
|
|
36
32
|
event
|
|
37
33
|
)
|
|
38
34
|
}
|
|
35
|
+
// UPSTREAM: Response type does not match SeamEvent[].
|
|
36
|
+
return events as SeamEvent[]
|
|
39
37
|
},
|
|
40
|
-
refetchInterval
|
|
38
|
+
refetchInterval,
|
|
41
39
|
})
|
|
42
40
|
|
|
43
41
|
return { ...rest, events: data }
|
package/src/lib/seam/filters.ts
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
AccessCodeError,
|
|
3
|
+
AccessCodeWarning,
|
|
3
4
|
ConnectedAccountError,
|
|
4
5
|
DeviceError,
|
|
5
|
-
|
|
6
|
-
} from 'seamapi'
|
|
6
|
+
DeviceWarning,
|
|
7
|
+
} from '@seamapi/types/connect'
|
|
7
8
|
|
|
8
|
-
type
|
|
9
|
+
type SeamResourceError = ConnectedAccountError | DeviceError | AccessCodeError
|
|
9
10
|
|
|
10
|
-
export const accessCodeErrorFilter = (error:
|
|
11
|
+
export const accessCodeErrorFilter = (error: SeamResourceError): boolean => {
|
|
11
12
|
return 'is_access_code_error' in error && error.is_access_code_error
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
export const accessCodeWarningFilter = (_:
|
|
15
|
+
export const accessCodeWarningFilter = (_: AccessCodeWarning): boolean => {
|
|
15
16
|
return true
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
export const deviceErrorFilter = (error:
|
|
19
|
+
export const deviceErrorFilter = (error: SeamResourceError): boolean => {
|
|
19
20
|
return 'is_device_error' in error && error.is_device_error
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
export const deviceWarningFilter = (_:
|
|
23
|
+
export const deviceWarningFilter = (_: DeviceWarning): boolean => {
|
|
23
24
|
return true
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export const connectedAccountErrorFilter = (
|
|
27
|
-
error:
|
|
28
|
+
error: SeamResourceError
|
|
28
29
|
): boolean => {
|
|
29
30
|
return (
|
|
30
31
|
'is_connected_account_error' in error && error.is_connected_account_error
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Device } from '@seamapi/types/connect'
|
|
2
|
+
|
|
3
|
+
export type LockDevice = Omit<Device, 'properties'> & {
|
|
4
|
+
properties: Device['properties'] &
|
|
5
|
+
NonNullable<Required<Pick<Device['properties'], 'locked'>>>
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const isLockDevice = (device: Device): device is LockDevice =>
|
|
9
|
+
'locked' in device.properties
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SeamActionAttemptFailedError,
|
|
3
|
+
SeamActionAttemptTimeoutError,
|
|
4
|
+
SeamHttpApiError,
|
|
5
|
+
} from '@seamapi/http/connect'
|
|
6
|
+
import type { ActionAttempt, Device } from '@seamapi/types/connect'
|
|
7
|
+
import {
|
|
8
|
+
useMutation,
|
|
9
|
+
type UseMutationResult,
|
|
10
|
+
useQueryClient,
|
|
11
|
+
} from '@tanstack/react-query'
|
|
12
|
+
|
|
13
|
+
import { NullSeamClientError, useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
14
|
+
|
|
15
|
+
export type UseToggleLockParams = never
|
|
16
|
+
|
|
17
|
+
export type UseToggleLockData = undefined
|
|
18
|
+
|
|
19
|
+
export type UseToggleLockMutationVariables = Pick<Device, 'device_id'> & {
|
|
20
|
+
properties: Required<Pick<Device['properties'], 'locked'>>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type ToggleLockActionAttempt =
|
|
24
|
+
| Extract<ActionAttempt, { action_type: 'LOCK_DOOR' }>
|
|
25
|
+
| Extract<ActionAttempt, { action_type: 'UNLOCK_DOOR' }>
|
|
26
|
+
|
|
27
|
+
type MutationError =
|
|
28
|
+
| SeamHttpApiError
|
|
29
|
+
| SeamActionAttemptFailedError<ToggleLockActionAttempt>
|
|
30
|
+
| SeamActionAttemptTimeoutError<ToggleLockActionAttempt>
|
|
31
|
+
|
|
32
|
+
export function useToggleLock(): UseMutationResult<
|
|
33
|
+
UseToggleLockData,
|
|
34
|
+
MutationError,
|
|
35
|
+
UseToggleLockMutationVariables
|
|
36
|
+
> {
|
|
37
|
+
const { client } = useSeamClient()
|
|
38
|
+
const queryClient = useQueryClient()
|
|
39
|
+
|
|
40
|
+
return useMutation<
|
|
41
|
+
UseToggleLockData,
|
|
42
|
+
MutationError,
|
|
43
|
+
UseToggleLockMutationVariables
|
|
44
|
+
>({
|
|
45
|
+
mutationFn: async (variables) => {
|
|
46
|
+
const {
|
|
47
|
+
device_id: deviceId,
|
|
48
|
+
properties: { locked },
|
|
49
|
+
} = variables
|
|
50
|
+
if (client === null) throw new NullSeamClientError()
|
|
51
|
+
if (locked == null) return
|
|
52
|
+
if (locked) await client.locks.unlockDoor({ device_id: deviceId })
|
|
53
|
+
if (!locked) await client.locks.lockDoor({ device_id: deviceId })
|
|
54
|
+
},
|
|
55
|
+
onMutate: (variables) => {
|
|
56
|
+
queryClient.setQueryData<Device[]>(['devices', 'list', {}], (devices) => {
|
|
57
|
+
if (devices == null) {
|
|
58
|
+
return devices
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return devices.map((device) => {
|
|
62
|
+
if (
|
|
63
|
+
device.device_id !== variables.device_id ||
|
|
64
|
+
device.properties.locked == null
|
|
65
|
+
) {
|
|
66
|
+
return device
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
...device,
|
|
71
|
+
properties: {
|
|
72
|
+
...device.properties,
|
|
73
|
+
locked: !variables.properties.locked,
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
queryClient.setQueryData<Device>(
|
|
80
|
+
['devices', 'get', { device_id: variables.device_id }],
|
|
81
|
+
(device) => {
|
|
82
|
+
if (device?.properties.locked == null) return device
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
...device,
|
|
86
|
+
properties: {
|
|
87
|
+
...device.properties,
|
|
88
|
+
locked: !variables.properties.locked,
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
},
|
|
94
|
+
onError: async (_error, variables) => {
|
|
95
|
+
await queryClient.invalidateQueries({
|
|
96
|
+
queryKey: ['devices', 'list'],
|
|
97
|
+
})
|
|
98
|
+
await queryClient.invalidateQueries({
|
|
99
|
+
queryKey: ['devices', 'get', { device_id: variables.device_id }],
|
|
100
|
+
})
|
|
101
|
+
},
|
|
102
|
+
})
|
|
103
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Device } from '@seamapi/types/connect'
|
|
2
|
+
|
|
3
|
+
export type NoiseSensorDevice = Omit<Device, 'properties'> & {
|
|
4
|
+
properties: Device['properties'] &
|
|
5
|
+
NonNullable<Required<Pick<Device['properties'], 'noise_level_decibels'>>>
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const isNoiseSensorDevice = (
|
|
9
|
+
device: Device
|
|
10
|
+
): device is NoiseSensorDevice => 'noise_level_decibels' in device.properties
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
|
2
1
|
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '
|
|
2
|
+
NoiseSensorsNoiseThresholdsListParams,
|
|
3
|
+
SeamHttpApiError,
|
|
4
|
+
} from '@seamapi/http/connect'
|
|
5
|
+
import type { NoiseThreshold } from '@seamapi/types/connect'
|
|
6
|
+
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
|
8
7
|
|
|
9
8
|
import { useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
10
9
|
import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
|
|
11
10
|
|
|
12
|
-
export type UseNoiseThresholdsParams =
|
|
13
|
-
|
|
11
|
+
export type UseNoiseThresholdsParams = NoiseSensorsNoiseThresholdsListParams
|
|
12
|
+
|
|
13
|
+
export type UseNoiseThresholdsData = NoiseThreshold[]
|
|
14
14
|
|
|
15
15
|
export function useNoiseThresholds(
|
|
16
16
|
params: UseNoiseThresholdsParams
|
|
@@ -18,17 +18,13 @@ export function useNoiseThresholds(
|
|
|
18
18
|
const { client } = useSeamClient()
|
|
19
19
|
const queryClient = useQueryClient()
|
|
20
20
|
|
|
21
|
-
const { data, ...rest } = useQuery<
|
|
22
|
-
NoiseThresholdsListResponse['noise_thresholds'],
|
|
23
|
-
SeamError
|
|
24
|
-
>({
|
|
21
|
+
const { data, ...rest } = useQuery<UseNoiseThresholdsData, SeamHttpApiError>({
|
|
25
22
|
enabled: client != null,
|
|
26
23
|
queryKey: ['noise_thresholds', 'list', params],
|
|
27
24
|
queryFn: async () => {
|
|
28
25
|
if (client == null) return []
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
onSuccess: (noiseThresholds) => {
|
|
26
|
+
const noiseThresholds =
|
|
27
|
+
await client.noiseSensors.noiseThresholds.list(params)
|
|
32
28
|
for (const noiseThreshold of noiseThresholds) {
|
|
33
29
|
queryClient.setQueryData(
|
|
34
30
|
[
|
|
@@ -39,6 +35,7 @@ export function useNoiseThresholds(
|
|
|
39
35
|
noiseThreshold
|
|
40
36
|
)
|
|
41
37
|
}
|
|
38
|
+
return noiseThresholds
|
|
42
39
|
},
|
|
43
40
|
})
|
|
44
41
|
|
|
@@ -1,45 +1,32 @@
|
|
|
1
|
-
import { useQuery } from '@tanstack/react-query'
|
|
2
1
|
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '
|
|
2
|
+
SeamHttpApiError,
|
|
3
|
+
ThermostatsClimateSettingSchedulesGetParams,
|
|
4
|
+
} from '@seamapi/http/connect'
|
|
5
|
+
import type { ClimateSettingSchedule } from '@seamapi/types/connect'
|
|
6
|
+
import { useQuery } from '@tanstack/react-query'
|
|
8
7
|
|
|
9
8
|
import { useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
10
9
|
import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
|
|
11
10
|
|
|
12
11
|
export type UseClimateSettingScheduleParams =
|
|
13
|
-
|
|
14
|
-
| string
|
|
12
|
+
ThermostatsClimateSettingSchedulesGetParams
|
|
15
13
|
|
|
16
14
|
export type UseClimateSettingScheduleData = ClimateSettingSchedule | null
|
|
17
15
|
|
|
18
16
|
export function useClimateSettingSchedule(
|
|
19
17
|
params: UseClimateSettingScheduleParams
|
|
20
18
|
): UseSeamQueryResult<'climateSettingSchedule', UseClimateSettingScheduleData> {
|
|
21
|
-
const normalizedParams =
|
|
22
|
-
typeof params === 'string'
|
|
23
|
-
? { climate_setting_schedule_id: params }
|
|
24
|
-
: params
|
|
25
19
|
const { client } = useSeamClient()
|
|
26
20
|
|
|
27
21
|
const { data, ...rest } = useQuery<
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
UseClimateSettingScheduleData,
|
|
23
|
+
SeamHttpApiError
|
|
30
24
|
>({
|
|
31
25
|
enabled: client != null,
|
|
32
|
-
queryKey: [
|
|
33
|
-
'thermostats',
|
|
34
|
-
'climate_setting_schedules',
|
|
35
|
-
'get',
|
|
36
|
-
normalizedParams,
|
|
37
|
-
],
|
|
26
|
+
queryKey: ['thermostats', 'climate_setting_schedules', 'get', params],
|
|
38
27
|
queryFn: async () => {
|
|
39
28
|
if (client == null) return null
|
|
40
|
-
return await client.thermostats.climateSettingSchedules.get(
|
|
41
|
-
normalizedParams
|
|
42
|
-
)
|
|
29
|
+
return await client.thermostats.climateSettingSchedules.get(params)
|
|
43
30
|
},
|
|
44
31
|
})
|
|
45
32
|
|