@seamapi/react 2.20.0 → 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.
Files changed (402) hide show
  1. package/README.md +4 -4
  2. package/dist/elements.js +19676 -25734
  3. package/dist/elements.js.map +1 -1
  4. package/lib/object.d.ts +5 -0
  5. package/lib/object.js +14 -0
  6. package/lib/object.js.map +1 -0
  7. package/lib/seam/SeamProvider.d.ts +5 -4
  8. package/lib/seam/SeamProvider.js.map +1 -1
  9. package/lib/seam/access-codes/use-access-code.d.ts +3 -2
  10. package/lib/seam/access-codes/use-access-code.js +2 -3
  11. package/lib/seam/access-codes/use-access-code.js.map +1 -1
  12. package/lib/seam/access-codes/use-access-codes.d.ts +3 -2
  13. package/lib/seam/access-codes/use-access-codes.js +3 -5
  14. package/lib/seam/access-codes/use-access-codes.js.map +1 -1
  15. package/lib/seam/access-codes/use-create-access-code.d.ts +4 -3
  16. package/lib/seam/access-codes/use-create-access-code.js +5 -4
  17. package/lib/seam/access-codes/use-create-access-code.js.map +1 -1
  18. package/lib/seam/access-codes/use-delete-access-code.d.ts +4 -6
  19. package/lib/seam/access-codes/use-delete-access-code.js +10 -8
  20. package/lib/seam/access-codes/use-delete-access-code.js.map +1 -1
  21. package/lib/seam/access-codes/use-generate-access-code-code.d.ts +4 -4
  22. package/lib/seam/access-codes/use-generate-access-code-code.js +3 -2
  23. package/lib/seam/access-codes/use-generate-access-code-code.js.map +1 -1
  24. package/lib/seam/access-codes/use-update-access-code.d.ts +4 -4
  25. package/lib/seam/access-codes/use-update-access-code.js +9 -7
  26. package/lib/seam/access-codes/use-update-access-code.js.map +1 -1
  27. package/lib/seam/client-sessions/use-client-session.d.ts +1 -1
  28. package/lib/seam/client-sessions/use-client-session.js +1 -1
  29. package/lib/seam/client-sessions/use-client-session.js.map +1 -1
  30. package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.d.ts +1 -1
  31. package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.js +14 -6
  32. package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.js.map +1 -1
  33. package/lib/seam/components/AccessCodeDetails/AccessCodeDevice.d.ts +1 -1
  34. package/lib/seam/components/AccessCodeDetails/AccessCodeDevice.js +9 -6
  35. package/lib/seam/components/AccessCodeDetails/AccessCodeDevice.js.map +1 -1
  36. package/lib/seam/components/AccessCodeTable/AccessCodeHealthBar.d.ts +3 -4
  37. package/lib/seam/components/AccessCodeTable/AccessCodeHealthBar.js.map +1 -1
  38. package/lib/seam/components/AccessCodeTable/AccessCodeMainIcon.d.ts +3 -3
  39. package/lib/seam/components/AccessCodeTable/AccessCodeMainIcon.js.map +1 -1
  40. package/lib/seam/components/AccessCodeTable/AccessCodeMenu.d.ts +3 -3
  41. package/lib/seam/components/AccessCodeTable/AccessCodeMenu.js +1 -1
  42. package/lib/seam/components/AccessCodeTable/AccessCodeMenu.js.map +1 -1
  43. package/lib/seam/components/AccessCodeTable/AccessCodeRow.d.ts +3 -3
  44. package/lib/seam/components/AccessCodeTable/AccessCodeRow.js.map +1 -1
  45. package/lib/seam/components/AccessCodeTable/AccessCodeTable.d.ts +2 -4
  46. package/lib/seam/components/AccessCodeTable/AccessCodeTable.js +1 -1
  47. package/lib/seam/components/AccessCodeTable/AccessCodeTable.js.map +1 -1
  48. package/lib/seam/components/AccessCodeTable/CodeDetails.d.ts +2 -2
  49. package/lib/seam/components/AccessCodeTable/CodeDetails.js +5 -2
  50. package/lib/seam/components/AccessCodeTable/CodeDetails.js.map +1 -1
  51. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.d.ts +1 -1
  52. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.js +3 -1
  53. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.js.map +1 -1
  54. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.d.ts +1 -1
  55. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.js +3 -1
  56. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.js.map +1 -1
  57. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.d.ts +1 -1
  58. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.js +3 -3
  59. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.js.map +1 -1
  60. package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRow.d.ts +3 -3
  61. package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRow.js.map +1 -1
  62. package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRowDetails.d.ts +2 -2
  63. package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRowDetails.js.map +1 -1
  64. package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.d.ts +2 -2
  65. package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.js +1 -1
  66. package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.js.map +1 -1
  67. package/lib/seam/components/ConnectAccountButton/ConnectAccountButton.d.ts +1 -1
  68. package/lib/seam/components/ConnectAccountButton/ConnectAccountButton.js +2 -2
  69. package/lib/seam/components/CreateAccessCodeForm/CreateAccessCodeForm.d.ts +3 -3
  70. package/lib/seam/components/CreateAccessCodeForm/CreateAccessCodeForm.js +12 -9
  71. package/lib/seam/components/CreateAccessCodeForm/CreateAccessCodeForm.js.map +1 -1
  72. package/lib/seam/components/CreateClimateSettingScheduleForm/CreateClimateSettingScheduleForm.d.ts +1 -1
  73. package/lib/seam/components/CreateClimateSettingScheduleForm/CreateClimateSettingScheduleForm.js +1 -1
  74. package/lib/seam/components/DeviceDetails/DeviceDetails.d.ts +1 -1
  75. package/lib/seam/components/DeviceDetails/DeviceDetails.js +3 -1
  76. package/lib/seam/components/DeviceDetails/DeviceDetails.js.map +1 -1
  77. package/lib/seam/components/DeviceDetails/DeviceInfo.d.ts +3 -3
  78. package/lib/seam/components/DeviceDetails/DeviceInfo.js +3 -1
  79. package/lib/seam/components/DeviceDetails/DeviceInfo.js.map +1 -1
  80. package/lib/seam/components/DeviceDetails/DeviceModel.d.ts +3 -3
  81. package/lib/seam/components/DeviceDetails/LockDeviceDetails.d.ts +2 -2
  82. package/lib/seam/components/DeviceDetails/LockDeviceDetails.js +5 -5
  83. package/lib/seam/components/DeviceDetails/LockDeviceDetails.js.map +1 -1
  84. package/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.d.ts +2 -2
  85. package/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.js.map +1 -1
  86. package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.d.ts +2 -2
  87. package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.js +3 -3
  88. package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.js.map +1 -1
  89. package/lib/seam/components/DeviceTable/DeviceHealthBar.d.ts +3 -4
  90. package/lib/seam/components/DeviceTable/DeviceHealthBar.js.map +1 -1
  91. package/lib/seam/components/DeviceTable/DeviceRow.d.ts +4 -3
  92. package/lib/seam/components/DeviceTable/DeviceRow.js +2 -2
  93. package/lib/seam/components/DeviceTable/DeviceRow.js.map +1 -1
  94. package/lib/seam/components/DeviceTable/DeviceTable.d.ts +3 -6
  95. package/lib/seam/components/DeviceTable/DeviceTable.js +4 -2
  96. package/lib/seam/components/DeviceTable/DeviceTable.js.map +1 -1
  97. package/lib/seam/components/EditAccessCodeForm/EditAccessCodeForm.d.ts +1 -1
  98. package/lib/seam/components/EditAccessCodeForm/EditAccessCodeForm.js +2 -2
  99. package/lib/seam/components/EditAccessCodeForm/EditAccessCodeForm.js.map +1 -1
  100. package/lib/seam/components/SupportedDeviceTable/FilterCategoryMenu.d.ts +1 -1
  101. package/lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.d.ts +1 -1
  102. package/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.d.ts +1 -1
  103. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.d.ts +1 -1
  104. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js +2 -2
  105. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js.map +1 -1
  106. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.d.ts +3 -3
  107. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.js.map +1 -1
  108. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceManufacturerSection.d.ts +1 -1
  109. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.d.ts +1 -1
  110. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.d.ts +1 -1
  111. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.d.ts +1 -1
  112. package/lib/seam/components/SupportedDeviceTable/use-device-model.d.ts +2 -2
  113. package/lib/seam/components/SupportedDeviceTable/use-device-model.js +3 -4
  114. package/lib/seam/components/SupportedDeviceTable/use-device-model.js.map +1 -1
  115. package/lib/seam/components/SupportedDeviceTable/use-device-models.js +2 -4
  116. package/lib/seam/components/SupportedDeviceTable/use-device-models.js.map +1 -1
  117. package/lib/seam/components/SupportedDeviceTable/use-manufacturer.d.ts +2 -2
  118. package/lib/seam/components/SupportedDeviceTable/use-manufacturer.js +2 -3
  119. package/lib/seam/components/SupportedDeviceTable/use-manufacturer.js.map +1 -1
  120. package/lib/seam/components/SupportedDeviceTable/use-manufacturers.js +1 -3
  121. package/lib/seam/components/SupportedDeviceTable/use-manufacturers.js.map +1 -1
  122. package/lib/seam/components/common-props.d.ts +2 -2
  123. package/lib/seam/components/common-props.js.map +1 -1
  124. package/lib/seam/connect-webviews/use-create-connect-webview.d.ts +4 -3
  125. package/lib/seam/connect-webviews/use-create-connect-webview.js +3 -3
  126. package/lib/seam/connect-webviews/use-create-connect-webview.js.map +1 -1
  127. package/lib/seam/connected-accounts/use-connected-account.d.ts +3 -2
  128. package/lib/seam/connected-accounts/use-connected-account.js +2 -3
  129. package/lib/seam/connected-accounts/use-connected-account.js.map +1 -1
  130. package/lib/seam/devices/use-device-providers.d.ts +3 -2
  131. package/lib/seam/devices/use-device-providers.js.map +1 -1
  132. package/lib/seam/devices/use-device.d.ts +5 -4
  133. package/lib/seam/devices/use-device.js +2 -3
  134. package/lib/seam/devices/use-device.js.map +1 -1
  135. package/lib/seam/devices/use-devices.d.ts +4 -3
  136. package/lib/seam/devices/use-devices.js +2 -3
  137. package/lib/seam/devices/use-devices.js.map +1 -1
  138. package/lib/seam/events/use-events.d.ts +5 -4
  139. package/lib/seam/events/use-events.js +5 -5
  140. package/lib/seam/events/use-events.js.map +1 -1
  141. package/lib/seam/filters.d.ts +7 -7
  142. package/lib/seam/filters.js.map +1 -1
  143. package/lib/seam/locks/lock-device.d.ts +5 -0
  144. package/lib/seam/locks/lock-device.js +2 -0
  145. package/lib/seam/locks/lock-device.js.map +1 -0
  146. package/lib/seam/locks/use-toggle-lock.d.ts +16 -0
  147. package/lib/seam/locks/use-toggle-lock.js +59 -0
  148. package/lib/seam/locks/use-toggle-lock.js.map +1 -0
  149. package/lib/seam/noise-sensors/noise-sensor-device.d.ts +5 -0
  150. package/lib/seam/noise-sensors/noise-sensor-device.js +2 -0
  151. package/lib/seam/noise-sensors/noise-sensor-device.js.map +1 -0
  152. package/lib/seam/noise-sensors/use-noise-thresholds.d.ts +4 -3
  153. package/lib/seam/noise-sensors/use-noise-thresholds.js +2 -3
  154. package/lib/seam/noise-sensors/use-noise-thresholds.js.map +1 -1
  155. package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedule.d.ts +3 -2
  156. package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedule.js +2 -10
  157. package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedule.js.map +1 -1
  158. package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.d.ts +3 -2
  159. package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.js +3 -4
  160. package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.js.map +1 -1
  161. package/lib/seam/thermostats/climate-setting-schedules/use-create-climate-setting-schedule.d.ts +5 -3
  162. package/lib/seam/thermostats/climate-setting-schedules/use-create-climate-setting-schedule.js +10 -6
  163. package/lib/seam/thermostats/climate-setting-schedules/use-create-climate-setting-schedule.js.map +1 -1
  164. package/lib/seam/thermostats/climate-setting-schedules/use-delete-climate-setting-schedule.d.ts +5 -4
  165. package/lib/seam/thermostats/climate-setting-schedules/use-delete-climate-setting-schedule.js +13 -13
  166. package/lib/seam/thermostats/climate-setting-schedules/use-delete-climate-setting-schedule.js.map +1 -1
  167. package/lib/seam/thermostats/climate-setting-schedules/use-update-climate-setting-schedule.d.ts +5 -5
  168. package/lib/seam/thermostats/climate-setting-schedules/use-update-climate-setting-schedule.js +12 -17
  169. package/lib/seam/thermostats/climate-setting-schedules/use-update-climate-setting-schedule.js.map +1 -1
  170. package/lib/{temperature-bounds.d.ts → seam/thermostats/temperature-bounds.d.ts} +1 -1
  171. package/lib/{temperature-bounds.js → seam/thermostats/temperature-bounds.js} +4 -4
  172. package/lib/seam/thermostats/temperature-bounds.js.map +1 -0
  173. package/lib/seam/thermostats/thermostat-device.d.ts +17 -0
  174. package/lib/seam/thermostats/thermostat-device.js +2 -0
  175. package/lib/seam/thermostats/thermostat-device.js.map +1 -0
  176. package/lib/seam/thermostats/unit-conversion.d.ts +19 -0
  177. package/lib/seam/thermostats/unit-conversion.js +43 -0
  178. package/lib/seam/thermostats/unit-conversion.js.map +1 -0
  179. package/lib/seam/thermostats/use-cool-thermostat.d.ts +10 -4
  180. package/lib/seam/thermostats/use-cool-thermostat.js +34 -27
  181. package/lib/seam/thermostats/use-cool-thermostat.js.map +1 -1
  182. package/lib/seam/thermostats/use-heat-cool-thermostat.d.ts +10 -4
  183. package/lib/seam/thermostats/use-heat-cool-thermostat.js +34 -22
  184. package/lib/seam/thermostats/use-heat-cool-thermostat.js.map +1 -1
  185. package/lib/seam/thermostats/use-heat-thermostat.d.ts +10 -4
  186. package/lib/seam/thermostats/use-heat-thermostat.js +34 -27
  187. package/lib/seam/thermostats/use-heat-thermostat.js.map +1 -1
  188. package/lib/seam/thermostats/use-set-thermostat-fan-mode.d.ts +12 -0
  189. package/lib/seam/thermostats/use-set-thermostat-fan-mode.js +46 -0
  190. package/lib/seam/thermostats/use-set-thermostat-fan-mode.js.map +1 -0
  191. package/lib/seam/thermostats/use-set-thermostat-off.d.ts +10 -4
  192. package/lib/seam/thermostats/use-set-thermostat-off.js +36 -25
  193. package/lib/seam/thermostats/use-set-thermostat-off.js.map +1 -1
  194. package/lib/seam/thermostats/use-update-thermostat.d.ts +5 -5
  195. package/lib/seam/thermostats/use-update-thermostat.js +28 -27
  196. package/lib/seam/thermostats/use-update-thermostat.js.map +1 -1
  197. package/lib/seam/use-seam-client.d.ts +3 -3
  198. package/lib/seam/use-seam-client.js +5 -21
  199. package/lib/seam/use-seam-client.js.map +1 -1
  200. package/lib/seam/use-seam-query-result.d.ts +2 -2
  201. package/lib/ui/AccessCodeForm/AccessCodeForm.d.ts +5 -7
  202. package/lib/ui/AccessCodeForm/AccessCodeForm.js +9 -14
  203. package/lib/ui/AccessCodeForm/AccessCodeForm.js.map +1 -1
  204. package/lib/ui/AccessCodeForm/AccessCodeFormDatePicker.d.ts +1 -1
  205. package/lib/ui/AccessCodeForm/AccessCodeFormTimeZonePicker.d.ts +1 -1
  206. package/lib/ui/AccessCodeForm/AccessCodeFormTimes.d.ts +1 -1
  207. package/lib/ui/Checkbox.d.ts +1 -1
  208. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.d.ts +2 -2
  209. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.js +1 -1
  210. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.js.map +1 -1
  211. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.d.ts +1 -1
  212. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.js +3 -3
  213. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.js.map +1 -1
  214. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDefaultClimateSetting.d.ts +1 -1
  215. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDefaultClimateSetting.js.map +1 -1
  216. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDeviceSelect.d.ts +1 -1
  217. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormNameAndSchedule.d.ts +1 -1
  218. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormTimeZonePicker.d.ts +1 -1
  219. package/lib/ui/ClimateSettingForm/set-point-bounds.d.ts +4 -0
  220. package/lib/ui/ClimateSettingForm/set-point-bounds.js +17 -0
  221. package/lib/ui/ClimateSettingForm/set-point-bounds.js.map +1 -0
  222. package/lib/ui/DateTimePicker/DateTimePicker.d.ts +1 -1
  223. package/lib/ui/FormField.d.ts +1 -1
  224. package/lib/ui/IconButton.d.ts +1 -1
  225. package/lib/ui/LoadingToast/LoadingToast.d.ts +1 -1
  226. package/lib/ui/RadioField/Radio.d.ts +1 -1
  227. package/lib/ui/RadioField/RadioField.d.ts +1 -1
  228. package/lib/ui/Snackbar/Snackbar.d.ts +1 -1
  229. package/lib/ui/Spinner/Spinner.d.ts +1 -1
  230. package/lib/ui/Switch/Switch.d.ts +1 -1
  231. package/lib/ui/TabSet.d.ts +1 -1
  232. package/lib/ui/Table/EmptyPlaceholder.d.ts +1 -1
  233. package/lib/ui/Table/TableCell.d.ts +1 -1
  234. package/lib/ui/Table/TableFilterBar/TableFilterBar.d.ts +1 -1
  235. package/lib/ui/Table/TableFilterBar/TableFilterItem.d.ts +1 -1
  236. package/lib/ui/Table/TableRow.d.ts +1 -1
  237. package/lib/ui/TextButton.d.ts +1 -1
  238. package/lib/ui/TextField/SearchTextField.d.ts +1 -1
  239. package/lib/ui/TimeZonePicker/TimeZonePicker.d.ts +1 -1
  240. package/lib/ui/clipboard.d.ts +1 -1
  241. package/lib/ui/clipboard.js +2 -2
  242. package/lib/ui/clipboard.js.map +1 -1
  243. package/lib/ui/device/BatteryStatusIndicator.d.ts +7 -0
  244. package/lib/ui/device/{BatteryStatus.js → BatteryStatusIndicator.js} +2 -2
  245. package/lib/ui/device/BatteryStatusIndicator.js.map +1 -0
  246. package/lib/ui/device/DeviceImage.d.ts +2 -2
  247. package/lib/ui/device/LockStatus.d.ts +3 -3
  248. package/lib/ui/device/LockStatus.js +1 -1
  249. package/lib/ui/device/LockStatus.js.map +1 -1
  250. package/lib/ui/device/NoiseLevelStatus.d.ts +2 -2
  251. package/lib/ui/device/NoiseLevelStatus.js +4 -4
  252. package/lib/ui/device/NoiseLevelStatus.js.map +1 -1
  253. package/lib/ui/device/OnlineStatus.d.ts +4 -4
  254. package/lib/ui/device/OnlineStatus.js.map +1 -1
  255. package/lib/ui/layout/ContentHeader.d.ts +1 -1
  256. package/lib/ui/layout/DotDivider.d.ts +1 -1
  257. package/lib/ui/noise-sensor/NoiseSensorActivityList.d.ts +2 -2
  258. package/lib/ui/noise-sensor/NoiseSensorActivityList.js +4 -2
  259. package/lib/ui/noise-sensor/NoiseSensorActivityList.js.map +1 -1
  260. package/lib/ui/noise-sensor/NoiseSensorEventItem.d.ts +6 -3
  261. package/lib/ui/noise-sensor/NoiseSensorEventItem.js +4 -7
  262. package/lib/ui/noise-sensor/NoiseSensorEventItem.js.map +1 -1
  263. package/lib/ui/noise-sensor/NoiseThresholdsList.d.ts +2 -2
  264. package/lib/ui/noise-sensor/NoiseThresholdsList.js.map +1 -1
  265. package/lib/ui/thermostat/ClimateModeMenu.d.ts +2 -2
  266. package/lib/ui/thermostat/ClimateModeMenu.js.map +1 -1
  267. package/lib/ui/thermostat/ClimateSettingControlGroup.d.ts +2 -2
  268. package/lib/ui/thermostat/ClimateSettingControlGroup.js.map +1 -1
  269. package/lib/ui/thermostat/ClimateSettingStatus.d.ts +2 -2
  270. package/lib/ui/thermostat/ClimateSettingStatus.js +2 -2
  271. package/lib/ui/thermostat/ClimateSettingStatus.js.map +1 -1
  272. package/lib/ui/thermostat/FanModeMenu.d.ts +2 -2
  273. package/lib/ui/thermostat/FanModeMenu.js.map +1 -1
  274. package/lib/ui/thermostat/Temperature.d.ts +1 -1
  275. package/lib/ui/thermostat/TemperatureControl.d.ts +1 -1
  276. package/lib/ui/thermostat/TemperatureControlGroup.d.ts +2 -2
  277. package/lib/ui/thermostat/TemperatureControlGroup.js +1 -1
  278. package/lib/ui/thermostat/TemperatureControlGroup.js.map +1 -1
  279. package/lib/ui/thermostat/ThermoModeMenuOption.d.ts +1 -1
  280. package/lib/ui/thermostat/ThermostatCard.d.ts +2 -2
  281. package/lib/ui/thermostat/ThermostatCard.js +5 -4
  282. package/lib/ui/thermostat/ThermostatCard.js.map +1 -1
  283. package/lib/ui/thermostat/ThermostatSelect.d.ts +1 -1
  284. package/lib/ui/thermostat/ThermostatSelect.js +2 -2
  285. package/lib/ui/thermostat/ThermostatSelect.js.map +1 -1
  286. package/lib/ui/typography/Title.d.ts +1 -1
  287. package/lib/version.d.ts +1 -1
  288. package/lib/version.js +1 -1
  289. package/lib/version.js.map +1 -1
  290. package/package.json +7 -8
  291. package/src/index.scss +1 -1
  292. package/src/lib/object.ts +13 -0
  293. package/src/lib/seam/SeamProvider.tsx +9 -4
  294. package/src/lib/seam/access-codes/use-access-code.ts +10 -16
  295. package/src/lib/seam/access-codes/use-access-codes.ts +11 -18
  296. package/src/lib/seam/access-codes/use-create-access-code.ts +21 -16
  297. package/src/lib/seam/access-codes/use-delete-access-code.ts +22 -22
  298. package/src/lib/seam/access-codes/use-generate-access-code-code.ts +17 -21
  299. package/src/lib/seam/access-codes/use-update-access-code.ts +33 -25
  300. package/src/lib/seam/client-sessions/use-client-session.ts +5 -10
  301. package/src/lib/seam/components/AccessCodeDetails/AccessCodeDetails.tsx +36 -23
  302. package/src/lib/seam/components/AccessCodeDetails/AccessCodeDevice.tsx +10 -7
  303. package/src/lib/seam/components/AccessCodeTable/AccessCodeHealthBar.tsx +2 -3
  304. package/src/lib/seam/components/AccessCodeTable/AccessCodeMainIcon.tsx +3 -2
  305. package/src/lib/seam/components/AccessCodeTable/AccessCodeMenu.tsx +5 -4
  306. package/src/lib/seam/components/AccessCodeTable/AccessCodeRow.tsx +3 -2
  307. package/src/lib/seam/components/AccessCodeTable/AccessCodeTable.tsx +3 -7
  308. package/src/lib/seam/components/AccessCodeTable/CodeDetails.tsx +12 -8
  309. package/src/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.tsx +4 -4
  310. package/src/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.tsx +3 -3
  311. package/src/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.tsx +6 -4
  312. package/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRow.tsx +3 -2
  313. package/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRowDetails.tsx +1 -1
  314. package/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.tsx +3 -6
  315. package/src/lib/seam/components/ConnectAccountButton/ConnectAccountButton.tsx +2 -2
  316. package/src/lib/seam/components/CreateAccessCodeForm/CreateAccessCodeForm.tsx +20 -16
  317. package/src/lib/seam/components/CreateClimateSettingScheduleForm/CreateClimateSettingScheduleForm.tsx +1 -1
  318. package/src/lib/seam/components/DeviceDetails/DeviceDetails.tsx +3 -2
  319. package/src/lib/seam/components/DeviceDetails/DeviceInfo.tsx +5 -3
  320. package/src/lib/seam/components/DeviceDetails/DeviceModel.tsx +2 -2
  321. package/src/lib/seam/components/DeviceDetails/LockDeviceDetails.tsx +6 -6
  322. package/src/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.tsx +1 -1
  323. package/src/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.tsx +7 -4
  324. package/src/lib/seam/components/DeviceTable/DeviceHealthBar.tsx +6 -3
  325. package/src/lib/seam/components/DeviceTable/DeviceRow.tsx +5 -7
  326. package/src/lib/seam/components/DeviceTable/DeviceTable.tsx +7 -14
  327. package/src/lib/seam/components/EditAccessCodeForm/EditAccessCodeForm.tsx +6 -7
  328. package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.tsx +3 -4
  329. package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.tsx +3 -2
  330. package/src/lib/seam/components/SupportedDeviceTable/use-device-model.ts +9 -14
  331. package/src/lib/seam/components/SupportedDeviceTable/use-device-models.ts +5 -9
  332. package/src/lib/seam/components/SupportedDeviceTable/use-manufacturer.ts +7 -12
  333. package/src/lib/seam/components/SupportedDeviceTable/use-manufacturers.ts +4 -8
  334. package/src/lib/seam/components/common-props.tsx +8 -4
  335. package/src/lib/seam/connect-webviews/use-create-connect-webview.ts +15 -17
  336. package/src/lib/seam/connected-accounts/use-connected-account.ts +17 -21
  337. package/src/lib/seam/devices/use-device-providers.ts +8 -11
  338. package/src/lib/seam/devices/use-device.ts +9 -18
  339. package/src/lib/seam/devices/use-devices.ts +20 -26
  340. package/src/lib/seam/events/use-events.ts +12 -14
  341. package/src/lib/seam/filters.ts +9 -8
  342. package/src/lib/seam/locks/lock-device.ts +9 -0
  343. package/src/lib/seam/locks/use-toggle-lock.ts +103 -0
  344. package/src/lib/seam/noise-sensors/noise-sensor-device.ts +10 -0
  345. package/src/lib/seam/noise-sensors/use-noise-thresholds.ts +12 -15
  346. package/src/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedule.ts +10 -23
  347. package/src/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.ts +13 -13
  348. package/src/lib/seam/thermostats/climate-setting-schedules/use-create-climate-setting-schedule.ts +30 -25
  349. package/src/lib/seam/thermostats/climate-setting-schedules/use-delete-climate-setting-schedule.ts +26 -28
  350. package/src/lib/seam/thermostats/climate-setting-schedules/use-update-climate-setting-schedule.ts +32 -41
  351. package/src/lib/{temperature-bounds.ts → seam/thermostats/temperature-bounds.ts} +8 -5
  352. package/src/lib/seam/thermostats/thermostat-device.ts +43 -0
  353. package/src/lib/seam/thermostats/unit-conversion.ts +89 -0
  354. package/src/lib/seam/thermostats/use-cool-thermostat.ts +77 -47
  355. package/src/lib/seam/thermostats/use-heat-cool-thermostat.ts +89 -40
  356. package/src/lib/seam/thermostats/use-heat-thermostat.ts +77 -47
  357. package/src/lib/seam/thermostats/use-set-thermostat-fan-mode.ts +95 -0
  358. package/src/lib/seam/thermostats/use-set-thermostat-off.ts +64 -40
  359. package/src/lib/seam/thermostats/use-update-thermostat.ts +47 -49
  360. package/src/lib/seam/use-seam-client.ts +11 -22
  361. package/src/lib/seam/use-seam-query-result.ts +2 -2
  362. package/src/lib/ui/AccessCodeForm/AccessCodeForm.tsx +18 -24
  363. package/src/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.tsx +4 -4
  364. package/src/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.tsx +6 -3
  365. package/src/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDefaultClimateSetting.tsx +1 -1
  366. package/src/lib/ui/ClimateSettingForm/set-point-bounds.ts +31 -0
  367. package/src/lib/ui/clipboard.ts +1 -1
  368. package/src/lib/ui/device/{BatteryStatus.tsx → BatteryStatusIndicator.tsx} +10 -5
  369. package/src/lib/ui/device/DeviceImage.tsx +2 -2
  370. package/src/lib/ui/device/LockStatus.tsx +3 -2
  371. package/src/lib/ui/device/NoiseLevelStatus.tsx +3 -3
  372. package/src/lib/ui/device/OnlineStatus.tsx +3 -3
  373. package/src/lib/ui/noise-sensor/NoiseSensorActivityList.tsx +15 -6
  374. package/src/lib/ui/noise-sensor/NoiseSensorEventItem.tsx +13 -9
  375. package/src/lib/ui/noise-sensor/NoiseThresholdsList.tsx +4 -3
  376. package/src/lib/ui/thermostat/ClimateModeMenu.tsx +1 -2
  377. package/src/lib/ui/thermostat/ClimateSettingControlGroup.tsx +1 -2
  378. package/src/lib/ui/thermostat/ClimateSettingStatus.tsx +2 -3
  379. package/src/lib/ui/thermostat/FanModeMenu.tsx +1 -2
  380. package/src/lib/ui/thermostat/TemperatureControlGroup.tsx +2 -2
  381. package/src/lib/ui/thermostat/ThermostatCard.tsx +11 -8
  382. package/src/lib/ui/thermostat/ThermostatSelect.tsx +4 -10
  383. package/src/lib/version.ts +1 -1
  384. package/lib/seam/devices/use-toggle-lock.d.ts +0 -5
  385. package/lib/seam/devices/use-toggle-lock.js +0 -56
  386. package/lib/seam/devices/use-toggle-lock.js.map +0 -1
  387. package/lib/seam/error-handlers.d.ts +0 -5
  388. package/lib/seam/error-handlers.js +0 -12
  389. package/lib/seam/error-handlers.js.map +0 -1
  390. package/lib/seam/thermostats/use-update-fan-mode.d.ts +0 -6
  391. package/lib/seam/thermostats/use-update-fan-mode.js +0 -42
  392. package/lib/seam/thermostats/use-update-fan-mode.js.map +0 -1
  393. package/lib/set-point-bounds.d.ts +0 -4
  394. package/lib/set-point-bounds.js +0 -24
  395. package/lib/set-point-bounds.js.map +0 -1
  396. package/lib/temperature-bounds.js.map +0 -1
  397. package/lib/ui/device/BatteryStatus.d.ts +0 -7
  398. package/lib/ui/device/BatteryStatus.js.map +0 -1
  399. package/src/lib/seam/devices/use-toggle-lock.ts +0 -84
  400. package/src/lib/seam/error-handlers.ts +0 -19
  401. package/src/lib/seam/thermostats/use-update-fan-mode.ts +0 -81
  402. package/src/lib/set-point-bounds.ts +0 -39
@@ -1,10 +1,9 @@
1
- import { useMutation, type UseMutationResult } from '@tanstack/react-query'
2
1
  import type {
3
- ConnectWebview,
4
- ConnectWebviewCreateRequest,
5
- ConnectWebviewCreateResponse,
6
- SeamError,
7
- } from 'seamapi'
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
- export type UseCreateConnectWebviewMutationParams = ConnectWebviewCreateRequest
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
- SeamError,
24
- UseCreateConnectWebviewMutationParams
23
+ SeamHttpApiError,
24
+ UseCreateConnectWebviewMutationVariables
25
25
  > {
26
26
  const { client } = useSeamClient()
27
27
  const { clientSession } = useClientSession()
28
28
 
29
29
  return useMutation<
30
- ConnectWebviewCreateResponse['connect_webview'],
31
- SeamError,
32
- ConnectWebviewCreateRequest
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
- ...mutationParams.custom_metadata,
40
+ ...variables.custom_metadata,
43
41
  },
44
- ...mutationParams,
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
- ConnectedAccount,
4
- ConnectedAccountsGetRequest,
5
- ConnectedAccountsGetResponse,
6
- SeamError,
7
- } from 'seamapi'
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 = ConnectedAccountsGetRequest | string
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
- ConnectedAccountsGetResponse['connected_account'] | null,
24
- SeamError
25
- >({
26
- enabled: client != null,
27
- queryKey: ['connected_accounts', 'get', normalizedParams],
28
- queryFn: async () => {
29
- if (client == null) return null
30
- return await client.connectedAccounts.get(normalizedParams)
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
- DeviceProvider,
4
- DeviceProvidersListRequest,
5
- DeviceProvidersListResponse,
6
- SeamError,
7
- } from 'seamapi'
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 = DeviceProvidersListRequest
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 = DeviceGetRequest | string
13
- export type UseDeviceData = CommonDevice | null
8
+ export type UseDeviceParams = DevicesGetParams
9
+
10
+ export type UseDeviceData = Device | null
14
11
 
15
12
  export function useDevice(
16
- params: DeviceGetRequest
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', normalizedParams],
18
+ queryKey: ['devices', 'get', params],
28
19
  queryFn: async () => {
29
20
  if (client == null) return null
30
- return await client.devices.get(normalizedParams)
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 = DevicesListRequest
13
- export type UseDevicesData = CommonDevice[]
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<DevicesListResponse['devices'], SeamError>(
22
- {
23
- enabled: client != null,
24
- queryKey: ['devices', 'list', params],
25
- queryFn: async () => {
26
- if (client == null) return []
27
- return await client.devices.list(params)
28
- },
29
- onSuccess: (devices) => {
30
- for (const device of devices) {
31
- queryClient.setQueryData(
32
- ['devices', 'get', { device_id: device.device_id }],
33
- device
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 = EventsListRequest
13
- export type UseEventsData = Event[]
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
- options?: UseEventsOptions
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<EventsListResponse['events'], SeamError>({
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
- return await client.events.list(params)
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: options?.refetchInterval ?? 30_000,
38
+ refetchInterval,
41
39
  })
42
40
 
43
41
  return { ...rest, events: data }
@@ -1,30 +1,31 @@
1
1
  import type {
2
2
  AccessCodeError,
3
+ AccessCodeWarning,
3
4
  ConnectedAccountError,
4
5
  DeviceError,
5
- SeamWarning,
6
- } from 'seamapi'
6
+ DeviceWarning,
7
+ } from '@seamapi/types/connect'
7
8
 
8
- type SeamCompositeError = ConnectedAccountError | DeviceError | AccessCodeError
9
+ type SeamResourceError = ConnectedAccountError | DeviceError | AccessCodeError
9
10
 
10
- export const accessCodeErrorFilter = (error: SeamCompositeError): boolean => {
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 = (_: SeamWarning): boolean => {
15
+ export const accessCodeWarningFilter = (_: AccessCodeWarning): boolean => {
15
16
  return true
16
17
  }
17
18
 
18
- export const deviceErrorFilter = (error: SeamCompositeError): boolean => {
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 = (_: SeamWarning): boolean => {
23
+ export const deviceWarningFilter = (_: DeviceWarning): boolean => {
23
24
  return true
24
25
  }
25
26
 
26
27
  export const connectedAccountErrorFilter = (
27
- error: SeamCompositeError
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
- NoiseThresholds,
4
- NoiseThresholdsListRequest,
5
- NoiseThresholdsListResponse,
6
- SeamError,
7
- } from 'seamapi'
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 = NoiseThresholdsListRequest
13
- export type UseNoiseThresholdsData = NoiseThresholds[]
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
- return await client.noiseThresholds.list(params)
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
- ClimateSettingSchedule,
4
- ClimateSettingScheduleGetRequest,
5
- ClimateSettingScheduleGetResponse,
6
- SeamError,
7
- } from 'seamapi'
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
- | ClimateSettingScheduleGetRequest
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
- ClimateSettingScheduleGetResponse['climate_setting_schedule'] | null,
29
- SeamError
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
 
@@ -1,16 +1,16 @@
1
- import { useQuery, useQueryClient } from '@tanstack/react-query'
2
1
  import type {
3
- ClimateSettingSchedule,
4
- ClimateSettingSchedulesListRequest,
5
- ClimateSettingSchedulesListResponse,
6
- SeamError,
7
- } from 'seamapi'
2
+ SeamHttpApiError,
3
+ ThermostatsClimateSettingSchedulesListParams,
4
+ } from '@seamapi/http/connect'
5
+ import type { ClimateSettingSchedule } 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
11
  export type UseClimateSettingSchedulesParams =
13
- ClimateSettingSchedulesListRequest
12
+ ThermostatsClimateSettingSchedulesListParams
13
+
14
14
  export type UseClimateSettingSchedulesData = ClimateSettingSchedule[]
15
15
 
16
16
  export function useClimateSettingSchedules(
@@ -23,17 +23,16 @@ export function useClimateSettingSchedules(
23
23
  const queryClient = useQueryClient()
24
24
 
25
25
  const { data, ...rest } = useQuery<
26
- ClimateSettingSchedulesListResponse['climate_setting_schedules'],
27
- SeamError
26
+ UseClimateSettingSchedulesData,
27
+ SeamHttpApiError
28
28
  >({
29
29
  enabled: client != null,
30
30
  queryKey: ['thermostats', 'climate_setting_schedules', 'list', params],
31
31
  queryFn: async () => {
32
32
  if (client == null) return []
33
- return await client.thermostats.climateSettingSchedules.list(params)
34
- },
35
- onSuccess: (schedules) => {
36
- for (const schedule of schedules) {
33
+ const climateSettingSchedules =
34
+ await client.thermostats.climateSettingSchedules.list(params)
35
+ for (const schedule of climateSettingSchedules) {
37
36
  queryClient.setQueryData(
38
37
  [
39
38
  'thermostats',
@@ -46,6 +45,7 @@ export function useClimateSettingSchedules(
46
45
  schedule
47
46
  )
48
47
  }
48
+ return climateSettingSchedules
49
49
  },
50
50
  })
51
51