@shipengine/react-api 2.0.0 → 2.0.2

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.
@@ -4,4 +4,4 @@ import { PageableQuery, SortableQuery } from "@shipengine/js-api";
4
4
  */
5
5
  export declare const useGetFundingSourceTransactions: (fundingSourceId: string, params?: {
6
6
  category?: string;
7
- } & PageableQuery & SortableQuery<"amount" | "category">) => import("@tanstack/react-query").UseQueryResult<import("@shipengine/js-api").FundingSourceTransactionsResponse, unknown>;
7
+ } & PageableQuery & SortableQuery<"amount" | "category">) => import("@tanstack/react-query").UseQueryResult<import("@shipengine/js-api").FundingSourceTransactionsResponse, import("@shipengine/js-api").CodedError[]>;
package/index.js CHANGED
@@ -15,6 +15,7 @@ const ShipEngine = ({
15
15
  getToken,
16
16
  onApiError
17
17
  }) => {
18
+ const [queryClient] = react.useState(() => new reactQuery.QueryClient());
18
19
  const [client, setClient] = react.useState(() => {
19
20
  const token = getToken();
20
21
  if (typeof token === "string")
@@ -36,7 +37,6 @@ const ShipEngine = ({
36
37
  );
37
38
  return void 0;
38
39
  });
39
- const queryClient = new reactQuery.QueryClient();
40
40
  if (!client) {
41
41
  return /* @__PURE__ */ jsxRuntime.jsx(
42
42
  "div",
@@ -818,6 +818,7 @@ const useGetFundingSourceTransactions = (fundingSourceId, params) => {
818
818
  return reactQuery.useQuery({
819
819
  enabled: !!fundingSourceId,
820
820
  keepPreviousData: true,
821
+ onError,
821
822
  queryFn: () => client.fundingSources.transactions(fundingSourceId, params),
822
823
  queryKey: ["useGetFundingSourceTransactions", fundingSourceId, params],
823
824
  select: (result) => result.data
package/index.mjs CHANGED
@@ -12,6 +12,7 @@ const ShipEngine = ({
12
12
  getToken,
13
13
  onApiError
14
14
  }) => {
15
+ const [queryClient] = useState(() => new QueryClient());
15
16
  const [client, setClient] = useState(() => {
16
17
  const token = getToken();
17
18
  if (typeof token === "string")
@@ -33,7 +34,6 @@ const ShipEngine = ({
33
34
  );
34
35
  return void 0;
35
36
  });
36
- const queryClient = new QueryClient();
37
37
  if (!client) {
38
38
  return /* @__PURE__ */ jsx(
39
39
  "div",
@@ -815,6 +815,7 @@ const useGetFundingSourceTransactions = (fundingSourceId, params) => {
815
815
  return useQuery({
816
816
  enabled: !!fundingSourceId,
817
817
  keepPreviousData: true,
818
+ onError,
818
819
  queryFn: () => client.fundingSources.transactions(fundingSourceId, params),
819
820
  queryKey: ["useGetFundingSourceTransactions", fundingSourceId, params],
820
821
  select: (result) => result.data
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/react-api",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {