@seamapi/react 4.8.2 → 4.9.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.
- package/README.md +17 -2
- package/dist/elements.js +22049 -18031
- package/dist/elements.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/seam/SeamProvider.d.ts +7 -16
- package/lib/seam/SeamProvider.js +12 -101
- package/lib/seam/SeamProvider.js.map +1 -1
- package/lib/seam/SeamQueryProvider.d.ts +32 -0
- package/lib/seam/SeamQueryProvider.js +127 -0
- package/lib/seam/SeamQueryProvider.js.map +1 -0
- package/lib/seam/access-codes/use-access-code.d.ts +2 -2
- package/lib/seam/access-codes/use-access-codes.d.ts +2 -2
- package/lib/seam/access-codes/use-create-access-code.d.ts +2 -7
- package/lib/seam/access-codes/use-create-access-code.js +3 -9
- package/lib/seam/access-codes/use-create-access-code.js.map +1 -1
- package/lib/seam/access-codes/use-generate-access-code-code.d.ts +2 -2
- package/lib/seam/client-sessions/use-client-session.d.ts +2 -2
- package/lib/seam/components/SupportedDeviceTable/use-device-model.d.ts +2 -2
- package/lib/seam/components/SupportedDeviceTable/use-device-models.d.ts +2 -2
- package/lib/seam/components/SupportedDeviceTable/use-manufacturer.d.ts +2 -2
- package/lib/seam/components/SupportedDeviceTable/use-manufacturers.d.ts +2 -2
- package/lib/seam/connected-accounts/use-connected-account.d.ts +2 -2
- package/lib/seam/devices/use-device-providers.d.ts +2 -2
- package/lib/seam/devices/use-device.d.ts +2 -2
- package/lib/seam/devices/use-devices.d.ts +2 -2
- package/lib/seam/events/use-events.d.ts +2 -2
- package/lib/seam/index.d.ts +2 -0
- package/lib/seam/index.js +2 -0
- package/lib/seam/index.js.map +1 -1
- package/lib/seam/noise-sensors/use-noise-thresholds.d.ts +2 -2
- package/lib/seam/thermostats/use-delete-thermostat-climate-preset.d.ts +2 -2
- package/lib/seam/use-seam-client.d.ts +2 -1
- package/lib/seam/use-seam-client.js +23 -9
- package/lib/seam/use-seam-client.js.map +1 -1
- package/lib/seam/use-seam-mutation.d.ts +8 -0
- package/lib/seam/use-seam-mutation.js +17 -0
- package/lib/seam/use-seam-mutation.js.map +1 -0
- package/lib/seam/use-seam-query-result.d.ts +1 -1
- package/lib/seam/use-seam-query.d.ts +8 -0
- package/lib/seam/use-seam-query.js +19 -0
- package/lib/seam/use-seam-query.js.map +1 -0
- package/lib/telemetry/hooks.js +2 -2
- package/lib/telemetry/hooks.js.map +1 -1
- package/lib/ui/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +3 -2
- package/src/lib/index.ts +1 -0
- package/src/lib/seam/SeamProvider.tsx +28 -183
- package/src/lib/seam/SeamQueryProvider.tsx +248 -0
- package/src/lib/seam/access-codes/use-access-code.ts +2 -2
- package/src/lib/seam/access-codes/use-access-codes.ts +2 -2
- package/src/lib/seam/access-codes/use-create-access-code.ts +7 -32
- package/src/lib/seam/access-codes/use-generate-access-code-code.ts +2 -2
- package/src/lib/seam/client-sessions/use-client-session.ts +2 -2
- package/src/lib/seam/components/SupportedDeviceTable/use-device-model.ts +2 -2
- package/src/lib/seam/components/SupportedDeviceTable/use-device-models.ts +2 -2
- package/src/lib/seam/components/SupportedDeviceTable/use-manufacturer.ts +2 -2
- package/src/lib/seam/components/SupportedDeviceTable/use-manufacturers.ts +2 -2
- package/src/lib/seam/connected-accounts/use-connected-account.ts +2 -2
- package/src/lib/seam/devices/use-device-providers.ts +2 -2
- package/src/lib/seam/devices/use-device.ts +2 -2
- package/src/lib/seam/devices/use-devices.ts +2 -2
- package/src/lib/seam/events/use-events.ts +2 -2
- package/src/lib/seam/index.ts +2 -0
- package/src/lib/seam/noise-sensors/use-noise-thresholds.ts +2 -2
- package/src/lib/seam/thermostats/use-delete-thermostat-climate-preset.ts +2 -2
- package/src/lib/seam/use-seam-client.ts +29 -10
- package/src/lib/seam/use-seam-mutation.ts +50 -0
- package/src/lib/seam/use-seam-query-result.ts +6 -4
- package/src/lib/seam/use-seam-query.ts +45 -0
- package/src/lib/telemetry/hooks.ts +2 -2
- package/src/lib/version.ts +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { SeamHttp
|
|
2
|
-
import { QueryClient } from '@tanstack/react-query';
|
|
1
|
+
import type { SeamHttp } from '@seamapi/http/connect';
|
|
2
|
+
import type { QueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { type PropsWithChildren } from 'react';
|
|
4
|
+
import { type SeamQueryProviderPropsWithClient, type SeamQueryProviderPropsWithClientSessionToken, type SeamQueryProviderPropsWithPublishableKey } from '../../lib/seam/SeamQueryProvider.js';
|
|
4
5
|
import { type TelemetryClient } from '../../lib/telemetry/index.js';
|
|
5
6
|
declare global {
|
|
6
7
|
var seam: SeamProviderProps | undefined;
|
|
@@ -8,21 +9,15 @@ declare global {
|
|
|
8
9
|
var seamTelemetryClient: TelemetryClient | undefined;
|
|
9
10
|
}
|
|
10
11
|
export interface SeamContext {
|
|
11
|
-
client: SeamHttp | null;
|
|
12
|
-
clientOptions?: SeamProviderClientOptions | undefined;
|
|
13
|
-
publishableKey?: string | undefined;
|
|
14
|
-
userIdentifierKey?: string | undefined;
|
|
15
|
-
clientSessionToken?: string | undefined;
|
|
16
12
|
}
|
|
17
13
|
export type SeamProviderProps = SeamProviderPropsWithClient | SeamProviderPropsWithPublishableKey | SeamProviderPropsWithClientSessionToken;
|
|
18
|
-
export interface SeamProviderPropsWithClient extends SeamProviderBaseProps {
|
|
19
|
-
client: SeamHttp;
|
|
14
|
+
export interface SeamProviderPropsWithClient extends SeamQueryProviderPropsWithClient, SeamProviderBaseProps {
|
|
20
15
|
}
|
|
21
|
-
export interface SeamProviderPropsWithPublishableKey extends SeamProviderBaseProps,
|
|
16
|
+
export interface SeamProviderPropsWithPublishableKey extends SeamProviderBaseProps, SeamQueryProviderPropsWithPublishableKey {
|
|
22
17
|
publishableKey: string;
|
|
23
18
|
userIdentifierKey?: string;
|
|
24
19
|
}
|
|
25
|
-
export interface SeamProviderPropsWithClientSessionToken extends SeamProviderBaseProps,
|
|
20
|
+
export interface SeamProviderPropsWithClientSessionToken extends SeamProviderBaseProps, SeamQueryProviderPropsWithClientSessionToken {
|
|
26
21
|
clientSessionToken: string;
|
|
27
22
|
}
|
|
28
23
|
interface SeamProviderBaseProps extends PropsWithChildren {
|
|
@@ -34,10 +29,6 @@ interface SeamProviderBaseProps extends PropsWithChildren {
|
|
|
34
29
|
telemetryClient?: TelemetryClient | undefined;
|
|
35
30
|
onSessionUpdate?: (client: SeamHttp) => void;
|
|
36
31
|
}
|
|
37
|
-
type SeamClientOptions = SeamHttpOptionsWithClientSessionToken;
|
|
38
|
-
export type SeamProviderClientOptions = Pick<SeamClientOptions, 'endpoint'>;
|
|
39
32
|
export declare const seamComponentsClassName = "seam-components";
|
|
40
|
-
export declare function SeamProvider({ children, disableTelemetry, disableCssInjection, disableFontInjection, unminifiyCss,
|
|
41
|
-
export declare const seamContext: import("react").Context<SeamContext>;
|
|
42
|
-
export declare function useSeamContext(): SeamContext;
|
|
33
|
+
export declare function SeamProvider({ children, disableTelemetry, disableCssInjection, disableFontInjection, unminifiyCss, telemetryClient, ...props }: SeamProviderProps): JSX.Element;
|
|
43
34
|
export {};
|
package/lib/seam/SeamProvider.js
CHANGED
|
@@ -1,130 +1,41 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { createContext, useMemo } from 'react';
|
|
3
|
+
import { SeamQueryProvider, } from '../../lib/seam/SeamQueryProvider.js';
|
|
4
4
|
import { useSeamFont } from '../../lib/seam/use-seam-font.js';
|
|
5
5
|
import { useSeamStyles } from '../../lib/seam/use-seam-styles.js';
|
|
6
6
|
import { TelemetryProvider, useUserTelemetry, } from '../../lib/telemetry/index.js';
|
|
7
|
-
import { useSeamClient } from './use-seam-client.js';
|
|
8
|
-
const defaultQueryClient = new QueryClient();
|
|
9
7
|
export const seamComponentsClassName = 'seam-components';
|
|
10
|
-
export function SeamProvider({ children, disableTelemetry = false, disableCssInjection = false, disableFontInjection = false, unminifiyCss = false,
|
|
8
|
+
export function SeamProvider({ children, disableTelemetry = false, disableCssInjection = false, disableFontInjection = false, unminifiyCss = false, telemetryClient, ...props }) {
|
|
11
9
|
useSeamStyles({ disabled: disableCssInjection, unminified: unminifiyCss });
|
|
12
10
|
useSeamFont({ disabled: disableFontInjection });
|
|
11
|
+
const { Provider } = seamContext;
|
|
12
|
+
const endpoint = 'endpoint' in props ? props.endpoint : undefined;
|
|
13
13
|
const value = useMemo(() => {
|
|
14
14
|
const context = createSeamContextValue(props);
|
|
15
|
-
if (context.client == null &&
|
|
16
|
-
context.publishableKey == null &&
|
|
17
|
-
context.clientSessionToken == null) {
|
|
18
|
-
return defaultSeamContextValue;
|
|
19
|
-
}
|
|
20
15
|
return context;
|
|
21
16
|
}, [props]);
|
|
22
|
-
|
|
23
|
-
value.publishableKey == null &&
|
|
24
|
-
value.clientSessionToken == null) {
|
|
25
|
-
throw new Error(`Must provide either a Seam client, clientSessionToken, or a publishableKey.`);
|
|
26
|
-
}
|
|
27
|
-
const { Provider } = seamContext;
|
|
28
|
-
const endpoint = 'endpoint' in props ? props.endpoint : undefined;
|
|
29
|
-
return (_jsx("div", { className: seamComponentsClassName, children: _jsx(TelemetryProvider, { client: telemetryClient ?? globalThis.seamTelemetryClient, disabled: disableTelemetry, endpoint: endpoint, children: _jsx(QueryClientProvider, { client: queryClient ?? globalThis.seamQueryClient ?? defaultQueryClient, children: _jsx(Provider, { value: value, children: _jsx(Wrapper, { onSessionUpdate: onSessionUpdate, children: children }) }) }) }) }));
|
|
17
|
+
return (_jsx("div", { className: seamComponentsClassName, children: _jsx(TelemetryProvider, { client: telemetryClient ?? globalThis.seamTelemetryClient, disabled: disableTelemetry, endpoint: endpoint, children: _jsx(SeamQueryProvider, { ...props, children: _jsx(Provider, { value: value, children: _jsx(Telemetry, { children: children }) }) }) }) }));
|
|
30
18
|
}
|
|
31
|
-
function
|
|
19
|
+
function Telemetry({ children }) {
|
|
32
20
|
useUserTelemetry();
|
|
33
|
-
const { client } = useSeamClient();
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (client != null)
|
|
36
|
-
onSessionUpdate(client);
|
|
37
|
-
}, [onSessionUpdate, client]);
|
|
38
21
|
return _jsx(_Fragment, { children: children });
|
|
39
22
|
}
|
|
40
23
|
const createDefaultSeamContextValue = () => {
|
|
41
24
|
try {
|
|
42
25
|
if (globalThis.seam == null) {
|
|
43
|
-
return {
|
|
26
|
+
return {};
|
|
44
27
|
}
|
|
45
28
|
return createSeamContextValue(globalThis.seam);
|
|
46
29
|
}
|
|
47
30
|
catch (err) {
|
|
48
31
|
// eslint-disable-next-line no-console
|
|
49
32
|
console.warn(err);
|
|
50
|
-
return {
|
|
33
|
+
return {};
|
|
51
34
|
}
|
|
52
35
|
};
|
|
53
|
-
const createSeamContextValue = (
|
|
54
|
-
|
|
55
|
-
return options;
|
|
56
|
-
}
|
|
57
|
-
if (isSeamProviderPropsWithClientSessionToken(options)) {
|
|
58
|
-
const { clientSessionToken, ...clientOptions } = options;
|
|
59
|
-
return {
|
|
60
|
-
clientSessionToken,
|
|
61
|
-
clientOptions,
|
|
62
|
-
client: null,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
if (isSeamProviderPropsWithPublishableKey(options)) {
|
|
66
|
-
const { publishableKey, userIdentifierKey, ...clientOptions } = options;
|
|
67
|
-
return {
|
|
68
|
-
publishableKey,
|
|
69
|
-
userIdentifierKey,
|
|
70
|
-
clientOptions,
|
|
71
|
-
client: null,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
return { client: null };
|
|
36
|
+
const createSeamContextValue = (_options) => {
|
|
37
|
+
return {};
|
|
75
38
|
};
|
|
76
39
|
const defaultSeamContextValue = createDefaultSeamContextValue();
|
|
77
|
-
|
|
78
|
-
export function useSeamContext() {
|
|
79
|
-
return useContext(seamContext);
|
|
80
|
-
}
|
|
81
|
-
const isSeamProviderPropsWithClient = (props) => {
|
|
82
|
-
if (!('client' in props))
|
|
83
|
-
return false;
|
|
84
|
-
const { client, ...otherProps } = props;
|
|
85
|
-
if (client == null)
|
|
86
|
-
return false;
|
|
87
|
-
const otherNonNullProps = Object.values(otherProps).filter((v) => v != null);
|
|
88
|
-
if (otherNonNullProps.length > 0) {
|
|
89
|
-
throw new InvalidSeamProviderProps(`The client prop cannot be used with ${otherNonNullProps.join(' or ')}.`);
|
|
90
|
-
}
|
|
91
|
-
return true;
|
|
92
|
-
};
|
|
93
|
-
const isSeamProviderPropsWithPublishableKey = (props) => {
|
|
94
|
-
if (!('publishableKey' in props))
|
|
95
|
-
return false;
|
|
96
|
-
const { publishableKey } = props;
|
|
97
|
-
if (publishableKey == null)
|
|
98
|
-
return false;
|
|
99
|
-
if ('client' in props && props.client != null) {
|
|
100
|
-
throw new InvalidSeamProviderProps('The client prop cannot be used with the publishableKey prop.');
|
|
101
|
-
}
|
|
102
|
-
if ('clientSessionToken' in props && props.clientSessionToken != null) {
|
|
103
|
-
throw new InvalidSeamProviderProps('The clientSessionToken prop cannot be used with the publishableKey prop.');
|
|
104
|
-
}
|
|
105
|
-
return true;
|
|
106
|
-
};
|
|
107
|
-
const isSeamProviderPropsWithClientSessionToken = (props) => {
|
|
108
|
-
if (!('clientSessionToken' in props))
|
|
109
|
-
return false;
|
|
110
|
-
const { clientSessionToken } = props;
|
|
111
|
-
if (clientSessionToken == null)
|
|
112
|
-
return false;
|
|
113
|
-
if ('client' in props && props.client != null) {
|
|
114
|
-
throw new InvalidSeamProviderProps('The client prop cannot be used with the clientSessionToken prop.');
|
|
115
|
-
}
|
|
116
|
-
if ('publishableKey' in props && props.publishableKey != null) {
|
|
117
|
-
throw new InvalidSeamProviderProps('The publishableKey prop cannot be used with the clientSessionToken prop.');
|
|
118
|
-
}
|
|
119
|
-
if ('userIdentifierKey' in props && props.userIdentifierKey != null) {
|
|
120
|
-
throw new InvalidSeamProviderProps('The userIdentifierKey prop cannot be used with the clientSessionToken prop.');
|
|
121
|
-
}
|
|
122
|
-
return true;
|
|
123
|
-
};
|
|
124
|
-
class InvalidSeamProviderProps extends Error {
|
|
125
|
-
constructor(message) {
|
|
126
|
-
super(`SeamProvider received invalid props: ${message}`);
|
|
127
|
-
this.name = this.constructor.name;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
40
|
+
const seamContext = createContext(defaultSeamContextValue);
|
|
130
41
|
//# sourceMappingURL=SeamProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SeamProvider.js","sourceRoot":"","sources":["../../src/lib/seam/SeamProvider.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SeamProvider.js","sourceRoot":"","sources":["../../src/lib/seam/SeamProvider.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAA0B,OAAO,EAAE,MAAM,OAAO,CAAA;AAEtE,OAAO,EACL,iBAAiB,GAIlB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EAEL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ED,MAAM,6BAA6B,GAAG,GAAgB,EAAE;IACtD,IAAI,CAAC;QACH,IAAI,UAAU,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;YAC5B,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;IAChD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACjB,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC,CAAA;AAED,MAAM,sBAAsB,GAAG,CAAC,QAA2B,EAAe,EAAE;IAC1E,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAED,MAAM,uBAAuB,GAAG,6BAA6B,EAAE,CAAA;AAE/D,MAAM,WAAW,GAAG,aAAa,CAAc,uBAAuB,CAAC,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SeamHttp, SeamHttpEndpoints, SeamHttpOptionsWithClientSessionToken } from '@seamapi/http/connect';
|
|
2
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
3
|
+
import { type PropsWithChildren } from 'react';
|
|
4
|
+
export interface SeamQueryContext {
|
|
5
|
+
client: SeamHttp | null;
|
|
6
|
+
endpointClient: SeamHttpEndpoints | null;
|
|
7
|
+
clientOptions?: SeamQueryProviderClientOptions | undefined;
|
|
8
|
+
publishableKey?: string | undefined;
|
|
9
|
+
userIdentifierKey?: string | undefined;
|
|
10
|
+
clientSessionToken?: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
export type SeamQueryProviderProps = SeamQueryProviderPropsWithClient | SeamQueryProviderPropsWithPublishableKey | SeamQueryProviderPropsWithClientSessionToken;
|
|
13
|
+
export interface SeamQueryProviderPropsWithClient extends SeamQueryProviderBaseProps {
|
|
14
|
+
client: SeamHttp;
|
|
15
|
+
}
|
|
16
|
+
export interface SeamQueryProviderPropsWithPublishableKey extends SeamQueryProviderBaseProps, SeamQueryProviderClientOptions {
|
|
17
|
+
publishableKey: string;
|
|
18
|
+
userIdentifierKey?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface SeamQueryProviderPropsWithClientSessionToken extends SeamQueryProviderBaseProps, SeamQueryProviderClientOptions {
|
|
21
|
+
clientSessionToken: string;
|
|
22
|
+
}
|
|
23
|
+
interface SeamQueryProviderBaseProps extends PropsWithChildren {
|
|
24
|
+
queryClient?: QueryClient | undefined;
|
|
25
|
+
onSessionUpdate?: (client: SeamHttp) => void;
|
|
26
|
+
}
|
|
27
|
+
type SeamClientOptions = SeamHttpOptionsWithClientSessionToken;
|
|
28
|
+
export type SeamQueryProviderClientOptions = Pick<SeamClientOptions, 'endpoint'>;
|
|
29
|
+
export declare function SeamQueryProvider({ children, onSessionUpdate, queryClient, ...props }: SeamQueryProviderProps): JSX.Element;
|
|
30
|
+
export declare const seamContext: import("react").Context<SeamQueryContext>;
|
|
31
|
+
export declare function useSeamQueryContext(): SeamQueryContext;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
|
+
import { createContext, useContext, useEffect, useMemo, } from 'react';
|
|
4
|
+
import { useSeamClient } from './use-seam-client.js';
|
|
5
|
+
const defaultQueryClient = new QueryClient();
|
|
6
|
+
export function SeamQueryProvider({ children, onSessionUpdate = () => { }, queryClient, ...props }) {
|
|
7
|
+
const value = useMemo(() => {
|
|
8
|
+
const context = createSeamQueryContextValue(props);
|
|
9
|
+
if (context.client == null &&
|
|
10
|
+
context.publishableKey == null &&
|
|
11
|
+
context.clientSessionToken == null) {
|
|
12
|
+
return defaultSeamQueryContextValue;
|
|
13
|
+
}
|
|
14
|
+
return context;
|
|
15
|
+
}, [props]);
|
|
16
|
+
if (value.client == null &&
|
|
17
|
+
value.publishableKey == null &&
|
|
18
|
+
value.clientSessionToken == null) {
|
|
19
|
+
throw new Error(`Must provide either a Seam client, clientSessionToken, or a publishableKey.`);
|
|
20
|
+
}
|
|
21
|
+
const { Provider } = seamContext;
|
|
22
|
+
return (_jsx(QueryClientProvider, { client: queryClient ?? globalThis.seamQueryClient ?? defaultQueryClient, children: _jsx(Provider, { value: value, children: _jsx(Session, { onSessionUpdate: onSessionUpdate, children: children }) }) }));
|
|
23
|
+
}
|
|
24
|
+
function Session({ onSessionUpdate, children, }) {
|
|
25
|
+
const { client } = useSeamClient();
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (client != null)
|
|
28
|
+
onSessionUpdate(client);
|
|
29
|
+
}, [onSessionUpdate, client]);
|
|
30
|
+
return _jsx(_Fragment, { children: children });
|
|
31
|
+
}
|
|
32
|
+
const createDefaultSeamQueryContextValue = () => {
|
|
33
|
+
try {
|
|
34
|
+
if (globalThis.seam == null) {
|
|
35
|
+
return { client: null, endpointClient: null };
|
|
36
|
+
}
|
|
37
|
+
return createSeamQueryContextValue(globalThis.seam);
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
// eslint-disable-next-line no-console
|
|
41
|
+
console.warn(err);
|
|
42
|
+
return { client: null, endpointClient: null };
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const createSeamQueryContextValue = (options) => {
|
|
46
|
+
if (isSeamQueryProviderPropsWithClient(options)) {
|
|
47
|
+
return {
|
|
48
|
+
...options,
|
|
49
|
+
endpointClient: null,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (isSeamQueryProviderPropsWithClientSessionToken(options)) {
|
|
53
|
+
const { clientSessionToken, ...clientOptions } = options;
|
|
54
|
+
return {
|
|
55
|
+
clientSessionToken,
|
|
56
|
+
clientOptions,
|
|
57
|
+
client: null,
|
|
58
|
+
endpointClient: null,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (isSeamQueryProviderPropsWithPublishableKey(options)) {
|
|
62
|
+
const { publishableKey, userIdentifierKey, ...clientOptions } = options;
|
|
63
|
+
return {
|
|
64
|
+
publishableKey,
|
|
65
|
+
userIdentifierKey,
|
|
66
|
+
clientOptions,
|
|
67
|
+
client: null,
|
|
68
|
+
endpointClient: null,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return { client: null, endpointClient: null };
|
|
72
|
+
};
|
|
73
|
+
const defaultSeamQueryContextValue = createDefaultSeamQueryContextValue();
|
|
74
|
+
export const seamContext = createContext(defaultSeamQueryContextValue);
|
|
75
|
+
export function useSeamQueryContext() {
|
|
76
|
+
return useContext(seamContext);
|
|
77
|
+
}
|
|
78
|
+
const isSeamQueryProviderPropsWithClient = (props) => {
|
|
79
|
+
if (!('client' in props))
|
|
80
|
+
return false;
|
|
81
|
+
const { client, ...otherProps } = props;
|
|
82
|
+
if (client == null)
|
|
83
|
+
return false;
|
|
84
|
+
const otherNonNullProps = Object.values(otherProps).filter((v) => v != null);
|
|
85
|
+
if (otherNonNullProps.length > 0) {
|
|
86
|
+
throw new InvalidSeamQueryProviderProps(`The client prop cannot be used with ${otherNonNullProps.join(' or ')}.`);
|
|
87
|
+
}
|
|
88
|
+
return true;
|
|
89
|
+
};
|
|
90
|
+
const isSeamQueryProviderPropsWithPublishableKey = (props) => {
|
|
91
|
+
if (!('publishableKey' in props))
|
|
92
|
+
return false;
|
|
93
|
+
const { publishableKey } = props;
|
|
94
|
+
if (publishableKey == null)
|
|
95
|
+
return false;
|
|
96
|
+
if ('client' in props && props.client != null) {
|
|
97
|
+
throw new InvalidSeamQueryProviderProps('The client prop cannot be used with the publishableKey prop.');
|
|
98
|
+
}
|
|
99
|
+
if ('clientSessionToken' in props && props.clientSessionToken != null) {
|
|
100
|
+
throw new InvalidSeamQueryProviderProps('The clientSessionToken prop cannot be used with the publishableKey prop.');
|
|
101
|
+
}
|
|
102
|
+
return true;
|
|
103
|
+
};
|
|
104
|
+
const isSeamQueryProviderPropsWithClientSessionToken = (props) => {
|
|
105
|
+
if (!('clientSessionToken' in props))
|
|
106
|
+
return false;
|
|
107
|
+
const { clientSessionToken } = props;
|
|
108
|
+
if (clientSessionToken == null)
|
|
109
|
+
return false;
|
|
110
|
+
if ('client' in props && props.client != null) {
|
|
111
|
+
throw new InvalidSeamQueryProviderProps('The client prop cannot be used with the clientSessionToken prop.');
|
|
112
|
+
}
|
|
113
|
+
if ('publishableKey' in props && props.publishableKey != null) {
|
|
114
|
+
throw new InvalidSeamQueryProviderProps('The publishableKey prop cannot be used with the clientSessionToken prop.');
|
|
115
|
+
}
|
|
116
|
+
if ('userIdentifierKey' in props && props.userIdentifierKey != null) {
|
|
117
|
+
throw new InvalidSeamQueryProviderProps('The userIdentifierKey prop cannot be used with the clientSessionToken prop.');
|
|
118
|
+
}
|
|
119
|
+
return true;
|
|
120
|
+
};
|
|
121
|
+
class InvalidSeamQueryProviderProps extends Error {
|
|
122
|
+
constructor(message) {
|
|
123
|
+
super(`SeamQueryProvider received invalid props: ${message}`);
|
|
124
|
+
this.name = this.constructor.name;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=SeamQueryProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeamQueryProvider.js","sourceRoot":"","sources":["../../src/lib/seam/SeamQueryProvider.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AACxE,OAAO,EACL,aAAa,EAEb,UAAU,EACV,SAAS,EACT,OAAO,GACR,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AA2CpD,MAAM,kBAAkB,GAAG,IAAI,WAAW,EAAE,CAAA;AAE5C,MAAM,UAAU,iBAAiB,CAAC,EAChC,QAAQ,EACR,eAAe,GAAG,GAAG,EAAE,GAAE,CAAC,EAC1B,WAAW,EACX,GAAG,KAAK,EACe;IACvB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE;QACz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BAAoB,IAAI,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IAElD,MAAM,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAA;IACpC,IAAI,kBAAkB,IAAI,IAAI;QAAE,OAAO,KAAK,CAAA;IAE5C,IAAI,QAAQ,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;QAC9C,MAAM,IAAI,6BAA6B,CACrC,kEAAkE,CACnE,CAAA;IACH,CAAC;IAED,IAAI,gBAAgB,IAAI,KAAK,IAAI,KAAK,CAAC,cAAc,IAAI,IAAI,EAAE,CAAC;QAC9D,MAAM,IAAI,6BAA6B,CACrC,0EAA0E,CAC3E,CAAA;IACH,CAAC;IAED,IAAI,mBAAmB,IAAI,KAAK,IAAI,KAAK,CAAC,iBAAiB,IAAI,IAAI,EAAE,CAAC;QACpE,MAAM,IAAI,6BAA6B,CACrC,6EAA6E,CAC9E,CAAA;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,6BAA8B,SAAQ,KAAK;IAC/C,YAAY,OAAe;QACzB,KAAK,CAAC,6CAA6C,OAAO,EAAE,CAAC,CAAA;QAC7D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;IACnC,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AccessCodesGetParams } from '@seamapi/http/connect';
|
|
2
2
|
import type { AccessCode } from '@seamapi/types/connect';
|
|
3
|
-
import type {
|
|
3
|
+
import type { UseSeamQueryResultLegacy } from '../../../lib/seam/use-seam-query-result.js';
|
|
4
4
|
export type UseAccessCodeParams = AccessCodesGetParams;
|
|
5
5
|
export type UseAccessCodeData = AccessCode | null;
|
|
6
|
-
export declare function useAccessCode(params: UseAccessCodeParams):
|
|
6
|
+
export declare function useAccessCode(params: UseAccessCodeParams): UseSeamQueryResultLegacy<'accessCode', UseAccessCodeData>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AccessCodesListParams } from '@seamapi/http/connect';
|
|
2
2
|
import type { AccessCode } from '@seamapi/types/connect';
|
|
3
|
-
import type {
|
|
3
|
+
import type { UseSeamQueryResultLegacy } from '../../../lib/seam/use-seam-query-result.js';
|
|
4
4
|
export type UseAccessCodesParams = AccessCodesListParams;
|
|
5
5
|
export type UseAccessCodesData = AccessCode[];
|
|
6
|
-
export declare function useAccessCodes(params: UseAccessCodesParams):
|
|
6
|
+
export declare function useAccessCodes(params: UseAccessCodesParams): UseSeamQueryResultLegacy<'accessCodes', UseAccessCodesData>;
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { type UseMutationResult } from '@tanstack/react-query';
|
|
4
|
-
export type UseCreateAccessCodeParams = never;
|
|
5
|
-
export type UseCreateAccessCodeData = AccessCode;
|
|
6
|
-
export type UseCreateAccessCodeMutationVariables = AccessCodesCreateBody;
|
|
7
|
-
export declare function useCreateAccessCode(): UseMutationResult<UseCreateAccessCodeData, SeamHttpApiError, UseCreateAccessCodeMutationVariables>;
|
|
1
|
+
import { type UseSeamMutationResult } from '../use-seam-mutation.js';
|
|
2
|
+
export declare function useCreateAccessCode(): UseSeamMutationResult<'/access_codes/create'>;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { useSeamMutation, } from '../use-seam-mutation.js';
|
|
3
3
|
export function useCreateAccessCode() {
|
|
4
|
-
const { client } = useSeamClient();
|
|
5
4
|
const queryClient = useQueryClient();
|
|
6
|
-
return
|
|
7
|
-
mutationFn: async (variables) => {
|
|
8
|
-
if (client === null)
|
|
9
|
-
throw new NullSeamClientError();
|
|
10
|
-
return await client.accessCodes.create(variables);
|
|
11
|
-
},
|
|
5
|
+
return useSeamMutation('/access_codes/create', {
|
|
12
6
|
onSuccess: (data) => {
|
|
13
7
|
queryClient.setQueryData(['access_codes', 'get', { access_code_id: data.access_code_id }], data);
|
|
14
8
|
void queryClient.invalidateQueries({ queryKey: ['access_codes', 'list'] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-create-access-code.js","sourceRoot":"","sources":["../../../src/lib/seam/access-codes/use-create-access-code.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-create-access-code.js","sourceRoot":"","sources":["../../../src/lib/seam/access-codes/use-create-access-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,EACL,eAAe,GAEhB,MAAM,yBAAyB,CAAA;AAEhC,MAAM,UAAU,mBAAmB;IACjC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IAEpC,OAAO,eAAe,CAAC,sBAAsB,EAAE;QAC7C,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE;YAClB,WAAW,CAAC,YAAY,CACtB,CAAC,cAAc,EAAE,KAAK,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,EAChE,IAAI,CACL,CAAA;YACD,KAAK,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;QAC5E,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AccessCodesGenerateCodeParams, SeamHttpApiError } from '@seamapi/http/connect';
|
|
2
2
|
import { type UseMutationResult } from '@tanstack/react-query';
|
|
3
3
|
export type UseGenerateAccessCodeCodeParams = never;
|
|
4
4
|
export type UseGenerateAccessCodeCodeData = string;
|
|
5
|
-
export type UseGenerateAccessCodeCodeMutationVariables =
|
|
5
|
+
export type UseGenerateAccessCodeCodeMutationVariables = AccessCodesGenerateCodeParams;
|
|
6
6
|
export declare function useGenerateAccessCodeCode(): UseMutationResult<UseGenerateAccessCodeCodeData, SeamHttpApiError, UseGenerateAccessCodeCodeMutationVariables>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ClientSession } from '@seamapi/types/connect';
|
|
2
|
-
import type {
|
|
2
|
+
import type { UseSeamQueryResultLegacy } from '../../../lib/seam/use-seam-query-result.js';
|
|
3
3
|
export type UseClientSessionParams = never;
|
|
4
4
|
export type UseClientSessionData = ClientSession | null;
|
|
5
|
-
export declare function useClientSession():
|
|
5
|
+
export declare function useClientSession(): UseSeamQueryResultLegacy<'clientSession', UseClientSessionData>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DeviceModel, RouteRequestParams } from '@seamapi/types/devicedb';
|
|
2
|
-
import type {
|
|
2
|
+
import type { UseSeamQueryResultLegacy } from '../../../../lib/seam/use-seam-query-result.js';
|
|
3
3
|
export type UseDeviceModelParams = DeviceModelsGetParams;
|
|
4
4
|
export type UseDeviceModelData = DeviceModel | null;
|
|
5
|
-
export declare function useDeviceModel(params: UseDeviceModelParams):
|
|
5
|
+
export declare function useDeviceModel(params: UseDeviceModelParams): UseSeamQueryResultLegacy<'deviceModel', UseDeviceModelData>;
|
|
6
6
|
type DeviceModelsGetParams = RouteRequestParams<'/v1/device_models/get'>;
|
|
7
7
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DeviceModel, RouteRequestParams } from '@seamapi/types/devicedb';
|
|
2
|
-
import type {
|
|
2
|
+
import type { UseSeamQueryResultLegacy } from '../../../../lib/seam/use-seam-query-result.js';
|
|
3
3
|
export type UseDeviceModelsParams = DeviceModelsListParams;
|
|
4
4
|
export type UseDeviceModelsData = DeviceModel[];
|
|
5
|
-
export declare function useDeviceModels(params?: UseDeviceModelsParams):
|
|
5
|
+
export declare function useDeviceModels(params?: UseDeviceModelsParams): UseSeamQueryResultLegacy<'deviceModels', UseDeviceModelsData>;
|
|
6
6
|
type DeviceModelsListParams = RouteRequestParams<'/v1/device_models/list'>;
|
|
7
7
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Manufacturer, RouteRequestParams } from '@seamapi/types/devicedb';
|
|
2
|
-
import type {
|
|
2
|
+
import type { UseSeamQueryResultLegacy } from '../../../../lib/seam/use-seam-query-result.js';
|
|
3
3
|
export type UseManufacturerParams = ManufacturersGetParams;
|
|
4
4
|
export type UseManufacturerData = Manufacturer | null;
|
|
5
|
-
export declare function useManufacturer(params: UseManufacturerParams):
|
|
5
|
+
export declare function useManufacturer(params: UseManufacturerParams): UseSeamQueryResultLegacy<'manufacturer', UseManufacturerData>;
|
|
6
6
|
type ManufacturersGetParams = RouteRequestParams<'/v1/manufacturers/get'>;
|
|
7
7
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Manufacturer, RouteRequestParams } from '@seamapi/types/devicedb';
|
|
2
|
-
import type {
|
|
2
|
+
import type { UseSeamQueryResultLegacy } from '../../../../lib/seam/use-seam-query-result.js';
|
|
3
3
|
export type UseManufacturersParams = ManufacturersListParams;
|
|
4
4
|
export type UseManufacturersData = Manufacturer[];
|
|
5
|
-
export declare function useManufacturers(params?: UseManufacturersParams):
|
|
5
|
+
export declare function useManufacturers(params?: UseManufacturersParams): UseSeamQueryResultLegacy<'manufacturers', UseManufacturersData>;
|
|
6
6
|
type ManufacturersListParams = RouteRequestParams<'/v1/manufacturers/list'>;
|
|
7
7
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ConnectedAccountsGetParams } from '@seamapi/http/connect';
|
|
2
2
|
import type { ConnectedAccount } from '@seamapi/types/connect';
|
|
3
|
-
import type {
|
|
3
|
+
import type { UseSeamQueryResultLegacy } from '../../../lib/seam/use-seam-query-result.js';
|
|
4
4
|
export type UseConnectedAccountParams = ConnectedAccountsGetParams;
|
|
5
5
|
export type UseConnectedAccountData = ConnectedAccount | null;
|
|
6
|
-
export declare function useConnectedAccount(params: UseConnectedAccountParams):
|
|
6
|
+
export declare function useConnectedAccount(params: UseConnectedAccountParams): UseSeamQueryResultLegacy<'connectedAccount', UseConnectedAccountData>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DevicesListDeviceProvidersParams } from '@seamapi/http/connect';
|
|
2
2
|
import type { DeviceProvider } from '@seamapi/types/connect';
|
|
3
|
-
import type {
|
|
3
|
+
import type { UseSeamQueryResultLegacy } from '../../../lib/seam/use-seam-query-result.js';
|
|
4
4
|
export type UseDeviceProvidersParams = DevicesListDeviceProvidersParams;
|
|
5
5
|
export type UseDeviceProvidersData = DeviceProvider[];
|
|
6
|
-
export declare function useDeviceProviders(params?: UseDeviceProvidersParams):
|
|
6
|
+
export declare function useDeviceProviders(params?: UseDeviceProvidersParams): UseSeamQueryResultLegacy<'deviceProviders', UseDeviceProvidersData>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DevicesGetParams } from '@seamapi/http/connect';
|
|
2
2
|
import type { Device } from '@seamapi/types/connect';
|
|
3
|
-
import type {
|
|
3
|
+
import type { UseSeamQueryResultLegacy } from '../../../lib/seam/use-seam-query-result.js';
|
|
4
4
|
export type UseDeviceParams = DevicesGetParams;
|
|
5
5
|
export type UseDeviceData = Device | null;
|
|
6
|
-
export declare function useDevice(params: UseDeviceParams):
|
|
6
|
+
export declare function useDevice(params: UseDeviceParams): UseSeamQueryResultLegacy<'device', UseDeviceData>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DevicesListParams } from '@seamapi/http/connect';
|
|
2
2
|
import type { Device } from '@seamapi/types/connect';
|
|
3
|
-
import type {
|
|
3
|
+
import type { UseSeamQueryResultLegacy } from '../../../lib/seam/use-seam-query-result.js';
|
|
4
4
|
export type UseDevicesParams = DevicesListParams;
|
|
5
5
|
export type UseDevicesData = Device[];
|
|
6
|
-
export declare function useDevices(params?: UseDevicesParams):
|
|
6
|
+
export declare function useDevices(params?: UseDevicesParams): UseSeamQueryResultLegacy<'devices', UseDevicesData>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { EventsListParams } from '@seamapi/http/connect';
|
|
2
2
|
import type { SeamEvent } from '@seamapi/types/connect';
|
|
3
|
-
import type {
|
|
3
|
+
import type { UseSeamQueryResultLegacy } from '../../../lib/seam/use-seam-query-result.js';
|
|
4
4
|
export type UseEventsParams = EventsListParams;
|
|
5
5
|
export type UseEventsData = SeamEvent[];
|
|
6
6
|
export interface UseEventsOptions {
|
|
7
7
|
refetchInterval?: number;
|
|
8
8
|
}
|
|
9
|
-
export declare function useEvents(params?: UseEventsParams, { refetchInterval }?: UseEventsOptions):
|
|
9
|
+
export declare function useEvents(params?: UseEventsParams, { refetchInterval }?: UseEventsOptions): UseSeamQueryResultLegacy<'events', UseEventsData>;
|
package/lib/seam/index.d.ts
CHANGED
|
@@ -12,4 +12,6 @@ export * from './devices/use-device-providers.js';
|
|
|
12
12
|
export * from './devices/use-devices.js';
|
|
13
13
|
export * from './SeamProvider.js';
|
|
14
14
|
export * from './use-seam-client.js';
|
|
15
|
+
export * from './use-seam-mutation.js';
|
|
16
|
+
export * from './use-seam-query.js';
|
|
15
17
|
export * from './use-seam-query-result.js';
|
package/lib/seam/index.js
CHANGED
|
@@ -12,5 +12,7 @@ export * from './devices/use-device-providers.js';
|
|
|
12
12
|
export * from './devices/use-devices.js';
|
|
13
13
|
export * from './SeamProvider.js';
|
|
14
14
|
export * from './use-seam-client.js';
|
|
15
|
+
export * from './use-seam-mutation.js';
|
|
16
|
+
export * from './use-seam-query.js';
|
|
15
17
|
export * from './use-seam-query-result.js';
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
package/lib/seam/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/seam/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA;AACjD,cAAc,oCAAoC,CAAA;AAClD,cAAc,0CAA0C,CAAA;AACxD,cAAc,0CAA0C,CAAA;AACxD,cAAc,iDAAiD,CAAA;AAC/D,cAAc,0CAA0C,CAAA;AACxD,cAAc,yCAAyC,CAAA;AACvD,cAAc,kDAAkD,CAAA;AAChE,cAAc,+CAA+C,CAAA;AAC7D,cAAc,yBAAyB,CAAA;AACvC,cAAc,mCAAmC,CAAA;AACjD,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/seam/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA;AACjD,cAAc,oCAAoC,CAAA;AAClD,cAAc,0CAA0C,CAAA;AACxD,cAAc,0CAA0C,CAAA;AACxD,cAAc,iDAAiD,CAAA;AAC/D,cAAc,0CAA0C,CAAA;AACxD,cAAc,yCAAyC,CAAA;AACvD,cAAc,kDAAkD,CAAA;AAChE,cAAc,+CAA+C,CAAA;AAC7D,cAAc,yBAAyB,CAAA;AACvC,cAAc,mCAAmC,CAAA;AACjD,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NoiseSensorsNoiseThresholdsListParams } from '@seamapi/http/connect';
|
|
2
2
|
import type { NoiseThreshold } from '@seamapi/types/connect';
|
|
3
|
-
import type {
|
|
3
|
+
import type { UseSeamQueryResultLegacy } from '../../../lib/seam/use-seam-query-result.js';
|
|
4
4
|
export type UseNoiseThresholdsParams = NoiseSensorsNoiseThresholdsListParams;
|
|
5
5
|
export type UseNoiseThresholdsData = NoiseThreshold[];
|
|
6
|
-
export declare function useNoiseThresholds(params: UseNoiseThresholdsParams):
|
|
6
|
+
export declare function useNoiseThresholds(params: UseNoiseThresholdsParams): UseSeamQueryResultLegacy<'noiseThresholds', UseNoiseThresholdsData>;
|