@seamapi/react 4.11.2 → 4.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -102,7 +102,7 @@ export function App() {
102
102
  <seam-device-table publishable-key="your_publishable_key"></seam-device-table>
103
103
  <script
104
104
  type="module"
105
- src="https://react.seam.co/v/4.11.2/dist/elements.js"
105
+ src="https://react.seam.co/v/4.12.1/dist/elements.js"
106
106
  ></script>
107
107
  </body>
108
108
  ```
@@ -230,7 +230,7 @@ or place the following in the `<head>` tag:
230
230
  ```html
231
231
  <link
232
232
  rel="stylesheet"
233
- href="https://react.seam.co/v/4.11.2/dist/index.min.css"
233
+ href="https://react.seam.co/v/4.12.1/dist/index.min.css"
234
234
  />
235
235
  ```
236
236
 
package/dist/elements.js CHANGED
@@ -17240,7 +17240,7 @@ const v2 = "https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;60
17240
17240
  const t = globalThis.document.createElement("link");
17241
17241
  t.rel = "stylesheet", t.type = "text/css", t.href = v2, globalThis.document.head.appendChild(t);
17242
17242
  }, [n]);
17243
- }, nx = "4.11.2", sj = "https://react.seam.co", rj = ({
17243
+ }, nx = "4.12.1", sj = "https://react.seam.co", rj = ({
17244
17244
  disabled: n = !1,
17245
17245
  unminified: e = !1
17246
17246
  }) => {
@@ -1,9 +1,11 @@
1
1
  import type { SeamActionAttemptFailedError, SeamActionAttemptTimeoutError, SeamHttpApiError, SeamHttpEndpointPaginatedQueryPaths, SeamHttpEndpoints, SeamHttpInvalidInputError, SeamPageCursor } from '@seamapi/http/connect';
2
2
  import type { ActionAttempt } from '@seamapi/types/connect';
3
- import { type UseInfiniteQueryOptions, type UseInfiniteQueryResult } from '@tanstack/react-query';
3
+ import { type QueryKey, type UseInfiniteQueryOptions, type UseInfiniteQueryResult } from '@tanstack/react-query';
4
4
  export type UseSeamInfiniteQueryParameters<T extends SeamHttpEndpointPaginatedQueryPaths> = Parameters<SeamHttpEndpoints[T]>[0];
5
5
  export type UseSeamInfiniteQueryResult<T extends SeamHttpEndpointPaginatedQueryPaths> = UseInfiniteQueryResult<QueryData<T>, QueryError<T>>;
6
- export declare function useSeamInfiniteQuery<T extends SeamHttpEndpointPaginatedQueryPaths>(endpointPath: T, parameters?: UseSeamInfiniteQueryParameters<T>, options?: Parameters<SeamHttpEndpoints[T]>[1] & QueryOptions<QueryData<T>, QueryError<T>>): UseSeamInfiniteQueryResult<T>;
6
+ export declare function useSeamInfiniteQuery<T extends SeamHttpEndpointPaginatedQueryPaths>(endpointPath: T, parameters?: UseSeamInfiniteQueryParameters<T>, options?: Parameters<SeamHttpEndpoints[T]>[1] & QueryOptions<QueryData<T>, QueryError<T>>): UseSeamInfiniteQueryResult<T> & {
7
+ queryKey: QueryKey;
8
+ };
7
9
  interface QueryData<T extends SeamHttpEndpointPaginatedQueryPaths> {
8
10
  data: Awaited<ReturnType<SeamHttpEndpoints[T]>>;
9
11
  nextPageCursor: SeamPageCursor | null;
@@ -1,15 +1,19 @@
1
1
  import { useInfiniteQuery, } from '@tanstack/react-query';
2
2
  import { useSeamClient } from '../../lib/seam/use-seam-client.js';
3
- export function useSeamInfiniteQuery(endpointPath, parameters, options = {}) {
3
+ export function useSeamInfiniteQuery(endpointPath, parameters = {}, options = {}) {
4
4
  const { endpointClient: client, queryKeyPrefixes } = useSeamClient();
5
- return useInfiniteQuery({
5
+ if ('page_cursor' in (parameters ?? {})) {
6
+ throw new Error('Cannot use page_cursor with useSeamInfiniteQuery');
7
+ }
8
+ const queryKey = [
9
+ ...queryKeyPrefixes,
10
+ ...endpointPath.split('/').filter((v) => v !== ''),
11
+ parameters ?? {},
12
+ ];
13
+ const result = useInfiniteQuery({
6
14
  enabled: client != null,
7
15
  ...options,
8
- queryKey: [
9
- ...queryKeyPrefixes,
10
- ...endpointPath.split('/').filter((v) => v !== ''),
11
- parameters,
12
- ],
16
+ queryKey,
13
17
  initialPageParam: null,
14
18
  getNextPageParam: (lastPage) => lastPage.nextPageCursor,
15
19
  queryFn: async ({ pageParam }) => {
@@ -38,5 +42,6 @@ export function useSeamInfiniteQuery(endpointPath, parameters, options = {}) {
38
42
  };
39
43
  },
40
44
  });
45
+ return { ...result, queryKey };
41
46
  }
42
47
  //# sourceMappingURL=use-seam-infinite-query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-seam-infinite-query.js","sourceRoot":"","sources":["../../src/lib/seam/use-seam-infinite-query.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,gBAAgB,GAGjB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAU3D,MAAM,UAAU,oBAAoB,CAGlC,YAAe,EACf,UAA8C,EAC9C,UAC8C,EAAE;IAEhD,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,aAAa,EAAE,CAAA;IACpE,OAAO,gBAAgB,CAAC;QACtB,OAAO,EAAE,MAAM,IAAI,IAAI;QACvB,GAAG,OAAO;QACV,QAAQ,EAAE;YACR,GAAG,gBAAgB;YACnB,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YAClD,UAAU;SACX;QACD,gBAAgB,EAAE,IAAI;QACtB,gBAAgB,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,cAAc;QACvD,OAAO,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;YAC/B,IAAI,MAAM,IAAI,IAAI;gBAChB,OAAO;oBACL,IAAI,EAAE,EAA+C;oBACrD,cAAc,EAAE,IAAI;iBACrB,CAAA;YACH,iHAAiH;YACjH,2FAA2F;YAC3F,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAA0B,CAAA;YAC9D,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;YAC7C,MAAM,KAAK,GAAG,MAAM,CAAC,eAAe,CAAC,OAAoC,CAAC,CAAA;YAC1E,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;gBACtB,MAAM,CAAC,IAAI,EAAE,EAAE,cAAc,EAAE,CAAC,GAAG,MAAM,KAAK,CAAC,SAAS,EAAE,CAAA;gBAC1D,OAAO;oBACL,IAAI,EAAE,IAAiD;oBACvD,cAAc;iBACf,CAAA;YACH,CAAC;YACD,+FAA+F;YAC/F,MAAM,CAAC,IAAI,EAAE,EAAE,cAAc,EAAE,CAAC,GAAG,MAAM,KAAK,CAAC,QAAQ,CACrD,SAA2B,CAC5B,CAAA;YACD,OAAO;gBACL,IAAI,EAAE,IAAiD;gBACvD,cAAc;aACf,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"use-seam-infinite-query.js","sourceRoot":"","sources":["../../src/lib/seam/use-seam-infinite-query.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,gBAAgB,GAGjB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAU3D,MAAM,UAAU,oBAAoB,CAGlC,YAAe,EACf,aAAgD,EAAE,EAClD,UAC8C,EAAE;IAEhD,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,aAAa,EAAE,CAAA;IAEpE,IAAI,aAAa,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;IACrE,CAAC;IAED,MAAM,QAAQ,GAAG;QACf,GAAG,gBAAgB;QACnB,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;QAClD,UAAU,IAAI,EAAE;KACjB,CAAA;IACD,MAAM,MAAM,GAAG,gBAAgB,CAAC;QAC9B,OAAO,EAAE,MAAM,IAAI,IAAI;QACvB,GAAG,OAAO;QACV,QAAQ;QACR,gBAAgB,EAAE,IAAI;QACtB,gBAAgB,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,cAAc;QACvD,OAAO,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;YAC/B,IAAI,MAAM,IAAI,IAAI;gBAChB,OAAO;oBACL,IAAI,EAAE,EAA+C;oBACrD,cAAc,EAAE,IAAI;iBACrB,CAAA;YACH,iHAAiH;YACjH,2FAA2F;YAC3F,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAA0B,CAAA;YAC9D,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;YAC7C,MAAM,KAAK,GAAG,MAAM,CAAC,eAAe,CAAC,OAAoC,CAAC,CAAA;YAC1E,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;gBACtB,MAAM,CAAC,IAAI,EAAE,EAAE,cAAc,EAAE,CAAC,GAAG,MAAM,KAAK,CAAC,SAAS,EAAE,CAAA;gBAC1D,OAAO;oBACL,IAAI,EAAE,IAAiD;oBACvD,cAAc;iBACf,CAAA;YACH,CAAC;YACD,+FAA+F;YAC/F,MAAM,CAAC,IAAI,EAAE,EAAE,cAAc,EAAE,CAAC,GAAG,MAAM,KAAK,CAAC,QAAQ,CACrD,SAA2B,CAC5B,CAAA;YACD,OAAO;gBACL,IAAI,EAAE,IAAiD;gBACvD,cAAc;aACf,CAAA;QACH,CAAC;KACF,CAAC,CAAA;IACF,OAAO,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,CAAA;AAChC,CAAC"}
@@ -1,8 +1,10 @@
1
1
  import type { SeamHttpApiError, SeamHttpEndpointsWithoutWorkspace, SeamHttpEndpointWithoutWorkspaceQueryPaths, SeamHttpInvalidInputError } from '@seamapi/http/connect';
2
- import { type UseQueryOptions, type UseQueryResult } from '@tanstack/react-query';
2
+ import { type QueryKey, type UseQueryOptions, type UseQueryResult } from '@tanstack/react-query';
3
3
  export type UseSeamQueryWithoutWorkspaceParameters<T extends SeamHttpEndpointWithoutWorkspaceQueryPaths> = Parameters<SeamHttpEndpointsWithoutWorkspace[T]>[0];
4
4
  export type UseSeamQueryWithoutWorkspaceResult<T extends SeamHttpEndpointWithoutWorkspaceQueryPaths> = UseQueryResult<QueryData<T>, QueryError>;
5
- export declare function useSeamQueryWithoutWorkspace<T extends SeamHttpEndpointWithoutWorkspaceQueryPaths>(endpointPath: T, parameters?: UseSeamQueryWithoutWorkspaceParameters<T>, options?: Parameters<SeamHttpEndpointsWithoutWorkspace[T]>[1] & QueryOptions<QueryData<T>, QueryError>): UseSeamQueryWithoutWorkspaceResult<T>;
5
+ export declare function useSeamQueryWithoutWorkspace<T extends SeamHttpEndpointWithoutWorkspaceQueryPaths>(endpointPath: T, parameters?: UseSeamQueryWithoutWorkspaceParameters<T>, options?: Parameters<SeamHttpEndpointsWithoutWorkspace[T]>[1] & QueryOptions<QueryData<T>, QueryError>): UseSeamQueryWithoutWorkspaceResult<T> & {
6
+ queryKey: QueryKey;
7
+ };
6
8
  type QueryData<T extends SeamHttpEndpointWithoutWorkspaceQueryPaths> = Awaited<ReturnType<SeamHttpEndpointsWithoutWorkspace[T]>>;
7
9
  type QueryError = Error | SeamHttpApiError | SeamHttpInvalidInputError;
8
10
  type QueryOptions<X, Y> = Omit<UseQueryOptions<X, Y>, 'queryKey' | 'queryFn'>;
@@ -1,15 +1,16 @@
1
1
  import { useQuery, } from '@tanstack/react-query';
2
2
  import { useSeamClient } from '../../lib/seam/use-seam-client.js';
3
- export function useSeamQueryWithoutWorkspace(endpointPath, parameters, options = {}) {
3
+ export function useSeamQueryWithoutWorkspace(endpointPath, parameters = {}, options = {}) {
4
4
  const { endpointClient: client, queryKeyPrefixes } = useSeamClient();
5
- return useQuery({
5
+ const queryKey = [
6
+ ...queryKeyPrefixes,
7
+ ...endpointPath.split('/').filter((v) => v !== ''),
8
+ parameters ?? {},
9
+ ];
10
+ const result = useQuery({
6
11
  enabled: client != null,
7
12
  ...options,
8
- queryKey: [
9
- ...queryKeyPrefixes,
10
- ...endpointPath.split('/').filter((v) => v !== ''),
11
- parameters,
12
- ],
13
+ queryKey,
13
14
  queryFn: async () => {
14
15
  if (client == null)
15
16
  return null;
@@ -19,5 +20,6 @@ export function useSeamQueryWithoutWorkspace(endpointPath, parameters, options =
19
20
  return await endpoint(parameters, options);
20
21
  },
21
22
  });
23
+ return { ...result, queryKey };
22
24
  }
23
25
  //# sourceMappingURL=use-seam-query-without-workspace.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-seam-query-without-workspace.js","sourceRoot":"","sources":["../../src/lib/seam/use-seam-query-without-workspace.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,GAGT,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAU3D,MAAM,UAAU,4BAA4B,CAG1C,YAAe,EACf,UAAsD,EACtD,UAC2C,EAAE;IAE7C,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,aAAa,EAAE,CAAA;IACpE,OAAO,QAAQ,CAAC;QACd,OAAO,EAAE,MAAM,IAAI,IAAI;QACvB,GAAG,OAAO;QACV,QAAQ,EAAE;YACR,GAAG,gBAAgB;YACnB,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YAClD,UAAU;SACX;QACD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,MAAM,IAAI,IAAI;gBAAE,OAAO,IAAI,CAAA;YAC/B,iHAAiH;YACjH,2FAA2F;YAC3F,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAmC,CAAA;YACvE,OAAO,MAAM,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;QAC5C,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"use-seam-query-without-workspace.js","sourceRoot":"","sources":["../../src/lib/seam/use-seam-query-without-workspace.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,QAAQ,GAGT,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAU3D,MAAM,UAAU,4BAA4B,CAG1C,YAAe,EACf,aAAwD,EAAE,EAC1D,UAC2C,EAAE;IAE7C,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,aAAa,EAAE,CAAA;IACpE,MAAM,QAAQ,GAAG;QACf,GAAG,gBAAgB;QACnB,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;QAClD,UAAU,IAAI,EAAE;KACjB,CAAA;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC;QACtB,OAAO,EAAE,MAAM,IAAI,IAAI;QACvB,GAAG,OAAO;QACV,QAAQ;QACR,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,MAAM,IAAI,IAAI;gBAAE,OAAO,IAAI,CAAA;YAC/B,iHAAiH;YACjH,2FAA2F;YAC3F,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAmC,CAAA;YACvE,OAAO,MAAM,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;QAC5C,CAAC;KACF,CAAC,CAAA;IACF,OAAO,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,CAAA;AAChC,CAAC"}
@@ -1,9 +1,11 @@
1
1
  import type { SeamActionAttemptFailedError, SeamActionAttemptTimeoutError, SeamHttpApiError, SeamHttpEndpointQueryPaths, SeamHttpEndpoints, SeamHttpInvalidInputError } from '@seamapi/http/connect';
2
2
  import type { ActionAttempt } from '@seamapi/types/connect';
3
- import { type UseQueryOptions, type UseQueryResult } from '@tanstack/react-query';
3
+ import { type QueryKey, type UseQueryOptions, type UseQueryResult } from '@tanstack/react-query';
4
4
  export type UseSeamQueryParameters<T extends SeamHttpEndpointQueryPaths> = Parameters<SeamHttpEndpoints[T]>[0];
5
5
  export type UseSeamQueryResult<T extends SeamHttpEndpointQueryPaths> = UseQueryResult<QueryData<T>, QueryError<T>>;
6
- export declare function useSeamQuery<T extends SeamHttpEndpointQueryPaths>(endpointPath: T, parameters?: UseSeamQueryParameters<T>, options?: Parameters<SeamHttpEndpoints[T]>[1] & QueryOptions<QueryData<T>, SeamHttpApiError>): UseSeamQueryResult<T>;
6
+ export declare function useSeamQuery<T extends SeamHttpEndpointQueryPaths>(endpointPath: T, parameters?: UseSeamQueryParameters<T>, options?: Parameters<SeamHttpEndpoints[T]>[1] & QueryOptions<QueryData<T>, SeamHttpApiError>): UseSeamQueryResult<T> & {
7
+ queryKey: QueryKey;
8
+ };
7
9
  type QueryData<T extends SeamHttpEndpointQueryPaths> = Awaited<ReturnType<SeamHttpEndpoints[T]>>;
8
10
  type QueryError<T extends SeamHttpEndpointQueryPaths> = Error | SeamHttpApiError | SeamHttpInvalidInputError | (QueryData<T> extends ActionAttempt ? SeamActionAttemptFailedError<QueryData<T>> | SeamActionAttemptTimeoutError<QueryData<T>> : never);
9
11
  type QueryOptions<X, Y> = Omit<UseQueryOptions<X, Y>, 'queryKey' | 'queryFn'>;
@@ -1,15 +1,16 @@
1
1
  import { useQuery, } from '@tanstack/react-query';
2
2
  import { useSeamClient } from '../../lib/seam/use-seam-client.js';
3
- export function useSeamQuery(endpointPath, parameters, options = {}) {
3
+ export function useSeamQuery(endpointPath, parameters = {}, options = {}) {
4
4
  const { endpointClient: client, queryKeyPrefixes } = useSeamClient();
5
- return useQuery({
5
+ const queryKey = [
6
+ ...queryKeyPrefixes,
7
+ ...endpointPath.split('/').filter((v) => v !== ''),
8
+ parameters ?? {},
9
+ ];
10
+ const result = useQuery({
6
11
  enabled: client != null,
7
12
  ...options,
8
- queryKey: [
9
- ...queryKeyPrefixes,
10
- ...endpointPath.split('/').filter((v) => v !== ''),
11
- parameters,
12
- ],
13
+ queryKey,
13
14
  queryFn: async () => {
14
15
  if (client == null)
15
16
  return null;
@@ -19,5 +20,6 @@ export function useSeamQuery(endpointPath, parameters, options = {}) {
19
20
  return await endpoint(parameters, options);
20
21
  },
21
22
  });
23
+ return { ...result, queryKey };
22
24
  }
23
25
  //# sourceMappingURL=use-seam-query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-seam-query.js","sourceRoot":"","sources":["../../src/lib/seam/use-seam-query.ts"],"names":[],"mappings":"AASA,OAAO,EACL,QAAQ,GAGT,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAQ3D,MAAM,UAAU,YAAY,CAC1B,YAAe,EACf,UAAsC,EACtC,UACiD,EAAE;IAEnD,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,aAAa,EAAE,CAAA;IACpE,OAAO,QAAQ,CAAC;QACd,OAAO,EAAE,MAAM,IAAI,IAAI;QACvB,GAAG,OAAO;QACV,QAAQ,EAAE;YACR,GAAG,gBAAgB;YACnB,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YAClD,UAAU;SACX;QACD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,MAAM,IAAI,IAAI;gBAAE,OAAO,IAAI,CAAA;YAC/B,iHAAiH;YACjH,2FAA2F;YAC3F,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAmC,CAAA;YACvE,OAAO,MAAM,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;QAC5C,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"use-seam-query.js","sourceRoot":"","sources":["../../src/lib/seam/use-seam-query.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,QAAQ,GAGT,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAQ3D,MAAM,UAAU,YAAY,CAC1B,YAAe,EACf,aAAwC,EAAE,EAC1C,UACiD,EAAE;IAEnD,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,aAAa,EAAE,CAAA;IACpE,MAAM,QAAQ,GAAG;QACf,GAAG,gBAAgB;QACnB,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;QAClD,UAAU,IAAI,EAAE;KACjB,CAAA;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC;QACtB,OAAO,EAAE,MAAM,IAAI,IAAI;QACvB,GAAG,OAAO;QACV,QAAQ;QACR,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,MAAM,IAAI,IAAI;gBAAE,OAAO,IAAI,CAAA;YAC/B,iHAAiH;YACjH,2FAA2F;YAC3F,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAmC,CAAA;YACvE,OAAO,MAAM,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;QAC5C,CAAC;KACF,CAAC,CAAA;IACF,OAAO,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,CAAA;AAChC,CAAC"}
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const seamapiReactVersion = "4.11.2";
1
+ declare const seamapiReactVersion = "4.12.1";
2
2
  export default seamapiReactVersion;
package/lib/version.js CHANGED
@@ -1,3 +1,3 @@
1
- const seamapiReactVersion = '4.11.2';
1
+ const seamapiReactVersion = '4.12.1';
2
2
  export default seamapiReactVersion;
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamapi/react",
3
- "version": "4.11.2",
3
+ "version": "4.12.1",
4
4
  "description": "Seam Components.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -111,10 +111,10 @@
111
111
  "peerDependencies": {
112
112
  "@seamapi/http": "^1.37.0",
113
113
  "@seamapi/types": "^1.395.3",
114
- "@types/react": "^18.0.0",
115
- "@types/react-dom": "^18.0.0",
116
- "react": "^18.0.0",
117
- "react-dom": "^18.0.0"
114
+ "@types/react": "^18.0.0 || ^19.0.0",
115
+ "@types/react-dom": "^18.0.0 || ^19.0.0",
116
+ "react": "^18.0.0 || ^19.0.0",
117
+ "react-dom": "^18.0.0 || ^19.0.0"
118
118
  },
119
119
  "peerDependenciesMeta": {
120
120
  "@seamapi/types": {
@@ -10,6 +10,7 @@ import type {
10
10
  } from '@seamapi/http/connect'
11
11
  import type { ActionAttempt } from '@seamapi/types/connect'
12
12
  import {
13
+ type QueryKey,
13
14
  useInfiniteQuery,
14
15
  type UseInfiniteQueryOptions,
15
16
  type UseInfiniteQueryResult,
@@ -29,19 +30,25 @@ export function useSeamInfiniteQuery<
29
30
  T extends SeamHttpEndpointPaginatedQueryPaths,
30
31
  >(
31
32
  endpointPath: T,
32
- parameters?: UseSeamInfiniteQueryParameters<T>,
33
+ parameters: UseSeamInfiniteQueryParameters<T> = {},
33
34
  options: Parameters<SeamHttpEndpoints[T]>[1] &
34
35
  QueryOptions<QueryData<T>, QueryError<T>> = {}
35
- ): UseSeamInfiniteQueryResult<T> {
36
+ ): UseSeamInfiniteQueryResult<T> & { queryKey: QueryKey } {
36
37
  const { endpointClient: client, queryKeyPrefixes } = useSeamClient()
37
- return useInfiniteQuery({
38
+
39
+ if ('page_cursor' in (parameters ?? {})) {
40
+ throw new Error('Cannot use page_cursor with useSeamInfiniteQuery')
41
+ }
42
+
43
+ const queryKey = [
44
+ ...queryKeyPrefixes,
45
+ ...endpointPath.split('/').filter((v) => v !== ''),
46
+ parameters ?? {},
47
+ ]
48
+ const result = useInfiniteQuery({
38
49
  enabled: client != null,
39
50
  ...options,
40
- queryKey: [
41
- ...queryKeyPrefixes,
42
- ...endpointPath.split('/').filter((v) => v !== ''),
43
- parameters,
44
- ],
51
+ queryKey,
45
52
  initialPageParam: null,
46
53
  getNextPageParam: (lastPage) => lastPage.nextPageCursor,
47
54
  queryFn: async ({ pageParam }) => {
@@ -72,6 +79,7 @@ export function useSeamInfiniteQuery<
72
79
  }
73
80
  },
74
81
  })
82
+ return { ...result, queryKey }
75
83
  }
76
84
 
77
85
  interface QueryData<T extends SeamHttpEndpointPaginatedQueryPaths> {
@@ -5,6 +5,7 @@ import type {
5
5
  SeamHttpInvalidInputError,
6
6
  } from '@seamapi/http/connect'
7
7
  import {
8
+ type QueryKey,
8
9
  useQuery,
9
10
  type UseQueryOptions,
10
11
  type UseQueryResult,
@@ -24,19 +25,20 @@ export function useSeamQueryWithoutWorkspace<
24
25
  T extends SeamHttpEndpointWithoutWorkspaceQueryPaths,
25
26
  >(
26
27
  endpointPath: T,
27
- parameters?: UseSeamQueryWithoutWorkspaceParameters<T>,
28
+ parameters: UseSeamQueryWithoutWorkspaceParameters<T> = {},
28
29
  options: Parameters<SeamHttpEndpointsWithoutWorkspace[T]>[1] &
29
30
  QueryOptions<QueryData<T>, QueryError> = {}
30
- ): UseSeamQueryWithoutWorkspaceResult<T> {
31
+ ): UseSeamQueryWithoutWorkspaceResult<T> & { queryKey: QueryKey } {
31
32
  const { endpointClient: client, queryKeyPrefixes } = useSeamClient()
32
- return useQuery({
33
+ const queryKey = [
34
+ ...queryKeyPrefixes,
35
+ ...endpointPath.split('/').filter((v) => v !== ''),
36
+ parameters ?? {},
37
+ ]
38
+ const result = useQuery({
33
39
  enabled: client != null,
34
40
  ...options,
35
- queryKey: [
36
- ...queryKeyPrefixes,
37
- ...endpointPath.split('/').filter((v) => v !== ''),
38
- parameters,
39
- ],
41
+ queryKey,
40
42
  queryFn: async () => {
41
43
  if (client == null) return null
42
44
  // Using @ts-expect-error over any is preferred, but not possible here because TypeScript will run out of memory.
@@ -45,6 +47,7 @@ export function useSeamQueryWithoutWorkspace<
45
47
  return await endpoint(parameters, options)
46
48
  },
47
49
  })
50
+ return { ...result, queryKey }
48
51
  }
49
52
 
50
53
  type QueryData<T extends SeamHttpEndpointWithoutWorkspaceQueryPaths> = Awaited<
@@ -8,6 +8,7 @@ import type {
8
8
  } from '@seamapi/http/connect'
9
9
  import type { ActionAttempt } from '@seamapi/types/connect'
10
10
  import {
11
+ type QueryKey,
11
12
  useQuery,
12
13
  type UseQueryOptions,
13
14
  type UseQueryResult,
@@ -23,19 +24,20 @@ export type UseSeamQueryResult<T extends SeamHttpEndpointQueryPaths> =
23
24
 
24
25
  export function useSeamQuery<T extends SeamHttpEndpointQueryPaths>(
25
26
  endpointPath: T,
26
- parameters?: UseSeamQueryParameters<T>,
27
+ parameters: UseSeamQueryParameters<T> = {},
27
28
  options: Parameters<SeamHttpEndpoints[T]>[1] &
28
29
  QueryOptions<QueryData<T>, SeamHttpApiError> = {}
29
- ): UseSeamQueryResult<T> {
30
+ ): UseSeamQueryResult<T> & { queryKey: QueryKey } {
30
31
  const { endpointClient: client, queryKeyPrefixes } = useSeamClient()
31
- return useQuery({
32
+ const queryKey = [
33
+ ...queryKeyPrefixes,
34
+ ...endpointPath.split('/').filter((v) => v !== ''),
35
+ parameters ?? {},
36
+ ]
37
+ const result = useQuery({
32
38
  enabled: client != null,
33
39
  ...options,
34
- queryKey: [
35
- ...queryKeyPrefixes,
36
- ...endpointPath.split('/').filter((v) => v !== ''),
37
- parameters,
38
- ],
40
+ queryKey,
39
41
  queryFn: async () => {
40
42
  if (client == null) return null
41
43
  // Using @ts-expect-error over any is preferred, but not possible here because TypeScript will run out of memory.
@@ -44,6 +46,7 @@ export function useSeamQuery<T extends SeamHttpEndpointQueryPaths>(
44
46
  return await endpoint(parameters, options)
45
47
  },
46
48
  })
49
+ return { ...result, queryKey }
47
50
  }
48
51
 
49
52
  type QueryData<T extends SeamHttpEndpointQueryPaths> = Awaited<
@@ -1,3 +1,3 @@
1
- const seamapiReactVersion = '4.11.2'
1
+ const seamapiReactVersion = '4.12.1'
2
2
 
3
3
  export default seamapiReactVersion