@seamapi/react 4.12.1 → 4.13.0

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 (140) hide show
  1. package/README.md +2 -17
  2. package/dist/elements.js +8340 -8097
  3. package/dist/elements.js.map +1 -1
  4. package/index.d.ts +1 -0
  5. package/index.js +1 -0
  6. package/index.js.map +1 -1
  7. package/lib/index.d.ts +0 -1
  8. package/lib/index.js +0 -1
  9. package/lib/index.js.map +1 -1
  10. package/lib/seam/SeamProvider.d.ts +1 -1
  11. package/lib/seam/SeamProvider.js +1 -1
  12. package/lib/seam/SeamProvider.js.map +1 -1
  13. package/lib/seam/access-codes/use-access-code.js +1 -1
  14. package/lib/seam/access-codes/use-access-code.js.map +1 -1
  15. package/lib/seam/access-codes/use-access-codes.js +1 -1
  16. package/lib/seam/access-codes/use-access-codes.js.map +1 -1
  17. package/lib/seam/access-codes/use-create-access-code.d.ts +1 -1
  18. package/lib/seam/access-codes/use-create-access-code.js +1 -1
  19. package/lib/seam/access-codes/use-create-access-code.js.map +1 -1
  20. package/lib/seam/access-codes/use-delete-access-code.js +1 -1
  21. package/lib/seam/access-codes/use-delete-access-code.js.map +1 -1
  22. package/lib/seam/access-codes/use-generate-access-code-code.js +1 -1
  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.js +1 -1
  25. package/lib/seam/access-codes/use-update-access-code.js.map +1 -1
  26. package/lib/seam/client-sessions/use-client-session.js +1 -1
  27. package/lib/seam/client-sessions/use-client-session.js.map +1 -1
  28. package/lib/seam/components/SupportedDeviceTable/use-device-model.js +1 -1
  29. package/lib/seam/components/SupportedDeviceTable/use-device-model.js.map +1 -1
  30. package/lib/seam/components/SupportedDeviceTable/use-device-models.js +1 -1
  31. package/lib/seam/components/SupportedDeviceTable/use-device-models.js.map +1 -1
  32. package/lib/seam/components/SupportedDeviceTable/use-manufacturer.js +1 -1
  33. package/lib/seam/components/SupportedDeviceTable/use-manufacturer.js.map +1 -1
  34. package/lib/seam/components/SupportedDeviceTable/use-manufacturers.js +1 -1
  35. package/lib/seam/components/SupportedDeviceTable/use-manufacturers.js.map +1 -1
  36. package/lib/seam/connect-webviews/use-create-connect-webview.js +1 -1
  37. package/lib/seam/connect-webviews/use-create-connect-webview.js.map +1 -1
  38. package/lib/seam/connected-accounts/use-connected-account.js +1 -1
  39. package/lib/seam/connected-accounts/use-connected-account.js.map +1 -1
  40. package/lib/seam/devices/use-device-providers.js +1 -1
  41. package/lib/seam/devices/use-device-providers.js.map +1 -1
  42. package/lib/seam/devices/use-device.js +1 -1
  43. package/lib/seam/devices/use-device.js.map +1 -1
  44. package/lib/seam/devices/use-devices.js +1 -1
  45. package/lib/seam/devices/use-devices.js.map +1 -1
  46. package/lib/seam/devices/use-update-device-name.js +1 -1
  47. package/lib/seam/devices/use-update-device-name.js.map +1 -1
  48. package/lib/seam/events/use-events.js +1 -1
  49. package/lib/seam/events/use-events.js.map +1 -1
  50. package/lib/seam/index.d.ts +0 -6
  51. package/lib/seam/index.js +0 -6
  52. package/lib/seam/index.js.map +1 -1
  53. package/lib/seam/locks/use-toggle-lock.js +1 -1
  54. package/lib/seam/locks/use-toggle-lock.js.map +1 -1
  55. package/lib/seam/noise-sensors/use-noise-thresholds.js +1 -1
  56. package/lib/seam/noise-sensors/use-noise-thresholds.js.map +1 -1
  57. package/lib/seam/thermostats/use-cool-thermostat.js +1 -1
  58. package/lib/seam/thermostats/use-cool-thermostat.js.map +1 -1
  59. package/lib/seam/thermostats/use-create-thermostat-climate-preset.js +1 -1
  60. package/lib/seam/thermostats/use-create-thermostat-climate-preset.js.map +1 -1
  61. package/lib/seam/thermostats/use-delete-thermostat-climate-preset.js +1 -1
  62. package/lib/seam/thermostats/use-delete-thermostat-climate-preset.js.map +1 -1
  63. package/lib/seam/thermostats/use-heat-cool-thermostat.js +1 -1
  64. package/lib/seam/thermostats/use-heat-cool-thermostat.js.map +1 -1
  65. package/lib/seam/thermostats/use-heat-thermostat.js +1 -1
  66. package/lib/seam/thermostats/use-heat-thermostat.js.map +1 -1
  67. package/lib/seam/thermostats/use-set-thermostat-fan-mode.js +1 -1
  68. package/lib/seam/thermostats/use-set-thermostat-fan-mode.js.map +1 -1
  69. package/lib/seam/thermostats/use-set-thermostat-off.js +1 -1
  70. package/lib/seam/thermostats/use-set-thermostat-off.js.map +1 -1
  71. package/lib/seam/thermostats/use-update-thermostat-climate-preset.js +1 -1
  72. package/lib/seam/thermostats/use-update-thermostat-climate-preset.js.map +1 -1
  73. package/lib/telemetry/hooks.js +1 -1
  74. package/lib/telemetry/hooks.js.map +1 -1
  75. package/lib/ui/DateTimePicker/DateTimePicker.d.ts +1 -1
  76. package/lib/version.d.ts +1 -1
  77. package/lib/version.js +1 -1
  78. package/package.json +5 -5
  79. package/src/index.ts +1 -0
  80. package/src/lib/index.ts +0 -1
  81. package/src/lib/seam/SeamProvider.tsx +4 -4
  82. package/src/lib/seam/access-codes/use-access-code.ts +1 -1
  83. package/src/lib/seam/access-codes/use-access-codes.ts +1 -1
  84. package/src/lib/seam/access-codes/use-create-access-code.ts +2 -3
  85. package/src/lib/seam/access-codes/use-delete-access-code.ts +1 -2
  86. package/src/lib/seam/access-codes/use-generate-access-code-code.ts +1 -2
  87. package/src/lib/seam/access-codes/use-update-access-code.ts +1 -2
  88. package/src/lib/seam/client-sessions/use-client-session.ts +1 -1
  89. package/src/lib/seam/components/SupportedDeviceTable/use-device-model.ts +1 -1
  90. package/src/lib/seam/components/SupportedDeviceTable/use-device-models.ts +1 -1
  91. package/src/lib/seam/components/SupportedDeviceTable/use-manufacturer.ts +1 -1
  92. package/src/lib/seam/components/SupportedDeviceTable/use-manufacturers.ts +1 -1
  93. package/src/lib/seam/connect-webviews/use-create-connect-webview.ts +1 -1
  94. package/src/lib/seam/connected-accounts/use-connected-account.ts +1 -1
  95. package/src/lib/seam/devices/use-device-providers.ts +1 -1
  96. package/src/lib/seam/devices/use-device.ts +1 -1
  97. package/src/lib/seam/devices/use-devices.ts +1 -1
  98. package/src/lib/seam/devices/use-update-device-name.ts +1 -2
  99. package/src/lib/seam/events/use-events.ts +1 -1
  100. package/src/lib/seam/index.ts +0 -6
  101. package/src/lib/seam/locks/use-toggle-lock.ts +1 -2
  102. package/src/lib/seam/noise-sensors/use-noise-thresholds.ts +1 -1
  103. package/src/lib/seam/thermostats/use-cool-thermostat.ts +1 -1
  104. package/src/lib/seam/thermostats/use-create-thermostat-climate-preset.ts +1 -1
  105. package/src/lib/seam/thermostats/use-delete-thermostat-climate-preset.ts +1 -1
  106. package/src/lib/seam/thermostats/use-heat-cool-thermostat.ts +1 -1
  107. package/src/lib/seam/thermostats/use-heat-thermostat.ts +1 -1
  108. package/src/lib/seam/thermostats/use-set-thermostat-fan-mode.ts +1 -2
  109. package/src/lib/seam/thermostats/use-set-thermostat-off.ts +1 -2
  110. package/src/lib/seam/thermostats/use-update-thermostat-climate-preset.ts +1 -1
  111. package/src/lib/telemetry/hooks.ts +1 -1
  112. package/src/lib/version.ts +1 -1
  113. package/lib/seam/SeamQueryProvider.d.ts +0 -40
  114. package/lib/seam/SeamQueryProvider.js +0 -180
  115. package/lib/seam/SeamQueryProvider.js.map +0 -1
  116. package/lib/seam/use-seam-client.d.ts +0 -14
  117. package/lib/seam/use-seam-client.js +0 -134
  118. package/lib/seam/use-seam-client.js.map +0 -1
  119. package/lib/seam/use-seam-infinite-query.d.ts +0 -15
  120. package/lib/seam/use-seam-infinite-query.js +0 -47
  121. package/lib/seam/use-seam-infinite-query.js.map +0 -1
  122. package/lib/seam/use-seam-mutation-without-workspace.d.ts +0 -9
  123. package/lib/seam/use-seam-mutation-without-workspace.js +0 -17
  124. package/lib/seam/use-seam-mutation-without-workspace.js.map +0 -1
  125. package/lib/seam/use-seam-mutation.d.ts +0 -10
  126. package/lib/seam/use-seam-mutation.js +0 -17
  127. package/lib/seam/use-seam-mutation.js.map +0 -1
  128. package/lib/seam/use-seam-query-without-workspace.d.ts +0 -11
  129. package/lib/seam/use-seam-query-without-workspace.js +0 -25
  130. package/lib/seam/use-seam-query-without-workspace.js.map +0 -1
  131. package/lib/seam/use-seam-query.d.ts +0 -12
  132. package/lib/seam/use-seam-query.js +0 -25
  133. package/lib/seam/use-seam-query.js.map +0 -1
  134. package/src/lib/seam/SeamQueryProvider.tsx +0 -356
  135. package/src/lib/seam/use-seam-client.ts +0 -225
  136. package/src/lib/seam/use-seam-infinite-query.ts +0 -103
  137. package/src/lib/seam/use-seam-mutation-without-workspace.ts +0 -56
  138. package/src/lib/seam/use-seam-mutation.ts +0 -64
  139. package/src/lib/seam/use-seam-query-without-workspace.ts +0 -59
  140. package/src/lib/seam/use-seam-query.ts +0 -66
@@ -1,56 +0,0 @@
1
- import type {
2
- SeamHttpApiError,
3
- SeamHttpEndpointsWithoutWorkspace,
4
- SeamHttpEndpointWithoutWorkspaceMutationPaths,
5
- SeamHttpInvalidInputError,
6
- } from '@seamapi/http/connect'
7
- import {
8
- useMutation,
9
- type UseMutationOptions,
10
- type UseMutationResult,
11
- } from '@tanstack/react-query'
12
-
13
- import { NullSeamClientError, useSeamClient } from 'lib/seam/use-seam-client.js'
14
-
15
- export type UseSeamMutationWithoutWorkspaceVariables<
16
- T extends SeamHttpEndpointWithoutWorkspaceMutationPaths,
17
- > = Parameters<SeamHttpEndpointsWithoutWorkspace[T]>[0]
18
-
19
- export type UseSeamMutationWithoutWorkspaceResult<
20
- T extends SeamHttpEndpointWithoutWorkspaceMutationPaths,
21
- > = UseMutationResult<
22
- MutationData<T>,
23
- MutationError,
24
- UseSeamMutationWithoutWorkspaceVariables<T>
25
- >
26
-
27
- export function useSeamMutationWithoutWorkspace<
28
- T extends SeamHttpEndpointWithoutWorkspaceMutationPaths,
29
- >(
30
- endpointPath: T,
31
- options: Parameters<SeamHttpEndpointsWithoutWorkspace[T]>[1] &
32
- MutationOptions<
33
- MutationData<T>,
34
- MutationError,
35
- UseSeamMutationWithoutWorkspaceVariables<T>
36
- > = {}
37
- ): UseSeamMutationWithoutWorkspaceResult<T> {
38
- const { endpointClient: client } = useSeamClient()
39
- return useMutation({
40
- ...options,
41
- mutationFn: async (variables) => {
42
- if (client === null) throw new NullSeamClientError()
43
- // Using @ts-expect-error over any is preferred, but not possible here because TypeScript will run out of memory.
44
- // Type assertion is needed here for performance reasons. The types are correct at runtime.
45
- const endpoint = client[endpointPath] as (...args: any) => Promise<any>
46
- return await endpoint(variables, options)
47
- },
48
- })
49
- }
50
-
51
- type MutationData<T extends SeamHttpEndpointWithoutWorkspaceMutationPaths> =
52
- Awaited<ReturnType<SeamHttpEndpointsWithoutWorkspace[T]>>
53
-
54
- type MutationError = Error | SeamHttpApiError | SeamHttpInvalidInputError
55
-
56
- type MutationOptions<X, Y, Z> = Omit<UseMutationOptions<X, Y, Z>, 'mutationFn'>
@@ -1,64 +0,0 @@
1
- import type {
2
- SeamActionAttemptFailedError,
3
- SeamActionAttemptTimeoutError,
4
- SeamHttpApiError,
5
- SeamHttpEndpointMutationPaths,
6
- SeamHttpEndpoints,
7
- SeamHttpInvalidInputError,
8
- } from '@seamapi/http/connect'
9
- import type { ActionAttempt } from '@seamapi/types/connect'
10
- import {
11
- useMutation,
12
- type UseMutationOptions,
13
- type UseMutationResult,
14
- } from '@tanstack/react-query'
15
-
16
- import { NullSeamClientError, useSeamClient } from 'lib/seam/use-seam-client.js'
17
-
18
- export type UseSeamMutationVariables<T extends SeamHttpEndpointMutationPaths> =
19
- Parameters<SeamHttpEndpoints[T]>[0]
20
-
21
- export type UseSeamMutationResult<T extends SeamHttpEndpointMutationPaths> =
22
- UseMutationResult<
23
- MutationData<T>,
24
- MutationError<T>,
25
- UseSeamMutationVariables<T>
26
- >
27
-
28
- export function useSeamMutation<T extends SeamHttpEndpointMutationPaths>(
29
- endpointPath: T,
30
- options: Parameters<SeamHttpEndpoints[T]>[1] &
31
- MutationOptions<
32
- MutationData<T>,
33
- MutationError<T>,
34
- UseSeamMutationVariables<T>
35
- > = {}
36
- ): UseSeamMutationResult<T> {
37
- const { endpointClient: client } = useSeamClient()
38
- return useMutation({
39
- ...options,
40
- mutationFn: async (variables) => {
41
- if (client === null) throw new NullSeamClientError()
42
- // Using @ts-expect-error over any is preferred, but not possible here because TypeScript will run out of memory.
43
- // Type assertion is needed here for performance reasons. The types are correct at runtime.
44
- const endpoint = client[endpointPath] as (...args: any) => Promise<any>
45
- return await endpoint(variables, options)
46
- },
47
- })
48
- }
49
-
50
- type MutationData<T extends SeamHttpEndpointMutationPaths> = Awaited<
51
- ReturnType<SeamHttpEndpoints[T]>
52
- >
53
-
54
- type MutationError<T extends SeamHttpEndpointMutationPaths> =
55
- | Error
56
- | SeamHttpApiError
57
- | SeamHttpInvalidInputError
58
- | (MutationData<T> extends ActionAttempt
59
- ?
60
- | SeamActionAttemptFailedError<MutationData<T>>
61
- | SeamActionAttemptTimeoutError<MutationData<T>>
62
- : never)
63
-
64
- type MutationOptions<X, Y, Z> = Omit<UseMutationOptions<X, Y, Z>, 'mutationFn'>
@@ -1,59 +0,0 @@
1
- import type {
2
- SeamHttpApiError,
3
- SeamHttpEndpointsWithoutWorkspace,
4
- SeamHttpEndpointWithoutWorkspaceQueryPaths,
5
- SeamHttpInvalidInputError,
6
- } from '@seamapi/http/connect'
7
- import {
8
- type QueryKey,
9
- useQuery,
10
- type UseQueryOptions,
11
- type UseQueryResult,
12
- } from '@tanstack/react-query'
13
-
14
- import { useSeamClient } from 'lib/seam/use-seam-client.js'
15
-
16
- export type UseSeamQueryWithoutWorkspaceParameters<
17
- T extends SeamHttpEndpointWithoutWorkspaceQueryPaths,
18
- > = Parameters<SeamHttpEndpointsWithoutWorkspace[T]>[0]
19
-
20
- export type UseSeamQueryWithoutWorkspaceResult<
21
- T extends SeamHttpEndpointWithoutWorkspaceQueryPaths,
22
- > = UseQueryResult<QueryData<T>, QueryError>
23
-
24
- export function useSeamQueryWithoutWorkspace<
25
- T extends SeamHttpEndpointWithoutWorkspaceQueryPaths,
26
- >(
27
- endpointPath: T,
28
- parameters: UseSeamQueryWithoutWorkspaceParameters<T> = {},
29
- options: Parameters<SeamHttpEndpointsWithoutWorkspace[T]>[1] &
30
- QueryOptions<QueryData<T>, QueryError> = {}
31
- ): UseSeamQueryWithoutWorkspaceResult<T> & { queryKey: QueryKey } {
32
- const { endpointClient: client, queryKeyPrefixes } = useSeamClient()
33
- const queryKey = [
34
- ...queryKeyPrefixes,
35
- ...endpointPath.split('/').filter((v) => v !== ''),
36
- parameters ?? {},
37
- ]
38
- const result = useQuery({
39
- enabled: client != null,
40
- ...options,
41
- queryKey,
42
- queryFn: async () => {
43
- if (client == null) return null
44
- // Using @ts-expect-error over any is preferred, but not possible here because TypeScript will run out of memory.
45
- // Type assertion is needed here for performance reasons. The types are correct at runtime.
46
- const endpoint = client[endpointPath] as (...args: any) => Promise<any>
47
- return await endpoint(parameters, options)
48
- },
49
- })
50
- return { ...result, queryKey }
51
- }
52
-
53
- type QueryData<T extends SeamHttpEndpointWithoutWorkspaceQueryPaths> = Awaited<
54
- ReturnType<SeamHttpEndpointsWithoutWorkspace[T]>
55
- >
56
-
57
- type QueryError = Error | SeamHttpApiError | SeamHttpInvalidInputError
58
-
59
- type QueryOptions<X, Y> = Omit<UseQueryOptions<X, Y>, 'queryKey' | 'queryFn'>
@@ -1,66 +0,0 @@
1
- import type {
2
- SeamActionAttemptFailedError,
3
- SeamActionAttemptTimeoutError,
4
- SeamHttpApiError,
5
- SeamHttpEndpointQueryPaths,
6
- SeamHttpEndpoints,
7
- SeamHttpInvalidInputError,
8
- } from '@seamapi/http/connect'
9
- import type { ActionAttempt } from '@seamapi/types/connect'
10
- import {
11
- type QueryKey,
12
- useQuery,
13
- type UseQueryOptions,
14
- type UseQueryResult,
15
- } from '@tanstack/react-query'
16
-
17
- import { useSeamClient } from 'lib/seam/use-seam-client.js'
18
-
19
- export type UseSeamQueryParameters<T extends SeamHttpEndpointQueryPaths> =
20
- Parameters<SeamHttpEndpoints[T]>[0]
21
-
22
- export type UseSeamQueryResult<T extends SeamHttpEndpointQueryPaths> =
23
- UseQueryResult<QueryData<T>, QueryError<T>>
24
-
25
- export function useSeamQuery<T extends SeamHttpEndpointQueryPaths>(
26
- endpointPath: T,
27
- parameters: UseSeamQueryParameters<T> = {},
28
- options: Parameters<SeamHttpEndpoints[T]>[1] &
29
- QueryOptions<QueryData<T>, SeamHttpApiError> = {}
30
- ): UseSeamQueryResult<T> & { queryKey: QueryKey } {
31
- const { endpointClient: client, queryKeyPrefixes } = useSeamClient()
32
- const queryKey = [
33
- ...queryKeyPrefixes,
34
- ...endpointPath.split('/').filter((v) => v !== ''),
35
- parameters ?? {},
36
- ]
37
- const result = useQuery({
38
- enabled: client != null,
39
- ...options,
40
- queryKey,
41
- queryFn: async () => {
42
- if (client == null) return null
43
- // Using @ts-expect-error over any is preferred, but not possible here because TypeScript will run out of memory.
44
- // Type assertion is needed here for performance reasons. The types are correct at runtime.
45
- const endpoint = client[endpointPath] as (...args: any) => Promise<any>
46
- return await endpoint(parameters, options)
47
- },
48
- })
49
- return { ...result, queryKey }
50
- }
51
-
52
- type QueryData<T extends SeamHttpEndpointQueryPaths> = Awaited<
53
- ReturnType<SeamHttpEndpoints[T]>
54
- >
55
-
56
- type QueryError<T extends SeamHttpEndpointQueryPaths> =
57
- | Error
58
- | SeamHttpApiError
59
- | SeamHttpInvalidInputError
60
- | (QueryData<T> extends ActionAttempt
61
- ?
62
- | SeamActionAttemptFailedError<QueryData<T>>
63
- | SeamActionAttemptTimeoutError<QueryData<T>>
64
- : never)
65
-
66
- type QueryOptions<X, Y> = Omit<UseQueryOptions<X, Y>, 'queryKey' | 'queryFn'>