@b3dotfun/sdk 0.0.83-alpha.1 → 0.0.83
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/dist/cjs/anyspend/react/providers/AnyspendProvider.js +13 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +1 -1
- package/dist/esm/anyspend/react/providers/AnyspendProvider.js +13 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/package.json +1 -1
- package/src/anyspend/react/providers/AnyspendProvider.tsx +22 -7
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +2 -6
|
@@ -4,8 +4,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.AnyspendProvider = void 0;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const react_1 = require("../../../global-account/react");
|
|
7
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
8
|
+
const react_2 = require("react");
|
|
7
9
|
const FeatureFlagsContext_1 = require("../contexts/FeatureFlagsContext");
|
|
8
10
|
const StripeRedirectHandler_1 = require("./StripeRedirectHandler");
|
|
11
|
+
const defaultQueryClientConfig = {
|
|
12
|
+
defaultOptions: {
|
|
13
|
+
queries: {
|
|
14
|
+
refetchOnWindowFocus: false,
|
|
15
|
+
retry: false,
|
|
16
|
+
staleTime: 30000,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
9
20
|
/**
|
|
10
21
|
* AnyspendProvider is a top-level provider that wraps your application to provide
|
|
11
22
|
* query caching and state management for all Anyspend hooks.
|
|
@@ -30,6 +41,7 @@ const StripeRedirectHandler_1 = require("./StripeRedirectHandler");
|
|
|
30
41
|
* ```
|
|
31
42
|
*/
|
|
32
43
|
const AnyspendProvider = function AnyspendProvider({ children, featureFlags }) {
|
|
33
|
-
|
|
44
|
+
const [queryClient] = (0, react_2.useState)(() => new react_query_1.QueryClient(defaultQueryClientConfig));
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(FeatureFlagsContext_1.FeatureFlagsProvider, { featureFlags: featureFlags, children: (0, jsx_runtime_1.jsxs)(react_1.TooltipProvider, { children: [(0, jsx_runtime_1.jsx)(StripeRedirectHandler_1.StripeRedirectHandler, {}), children] }) }) }));
|
|
34
46
|
};
|
|
35
47
|
exports.AnyspendProvider = AnyspendProvider;
|
|
@@ -43,7 +43,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, onConnect, connector
|
|
|
43
43
|
(0, react_2.useEffect)(() => {
|
|
44
44
|
(0, client_manager_1.setClientType)(clientType);
|
|
45
45
|
}, [clientType]);
|
|
46
|
-
const wagmiConfig = (0,
|
|
46
|
+
const wagmiConfig = (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors });
|
|
47
47
|
return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, children: (0, jsx_runtime_1.jsxs)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, partnerId: partnerId, createClientReferenceId: createClientReferenceId, enableTurnkey: enableTurnkey, children: [(0, jsx_runtime_1.jsx)(ToastContextConnector, {}), (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" })] })] }) }) }) }) }) }) }));
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { TooltipProvider } from "../../../global-account/react/index.js";
|
|
4
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
5
|
+
import { useState } from "react";
|
|
4
6
|
import { FeatureFlagsProvider } from "../contexts/FeatureFlagsContext.js";
|
|
5
7
|
import { StripeRedirectHandler } from "./StripeRedirectHandler.js";
|
|
8
|
+
const defaultQueryClientConfig = {
|
|
9
|
+
defaultOptions: {
|
|
10
|
+
queries: {
|
|
11
|
+
refetchOnWindowFocus: false,
|
|
12
|
+
retry: false,
|
|
13
|
+
staleTime: 30000,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
6
17
|
/**
|
|
7
18
|
* AnyspendProvider is a top-level provider that wraps your application to provide
|
|
8
19
|
* query caching and state management for all Anyspend hooks.
|
|
@@ -27,5 +38,6 @@ import { StripeRedirectHandler } from "./StripeRedirectHandler.js";
|
|
|
27
38
|
* ```
|
|
28
39
|
*/
|
|
29
40
|
export const AnyspendProvider = function AnyspendProvider({ children, featureFlags }) {
|
|
30
|
-
|
|
41
|
+
const [queryClient] = useState(() => new QueryClient(defaultQueryClientConfig));
|
|
42
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(FeatureFlagsProvider, { featureFlags: featureFlags, children: _jsxs(TooltipProvider, { children: [_jsx(StripeRedirectHandler, {}), children] }) }) }));
|
|
31
43
|
};
|
|
@@ -5,7 +5,7 @@ import { loadGA4Script } from "../../../../global-account/utils/analytics.js";
|
|
|
5
5
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
6
6
|
import "@relayprotocol/relay-kit-ui/styles.css";
|
|
7
7
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
8
|
-
import { useCallback, useEffect,
|
|
8
|
+
import { useCallback, useEffect, useState } from "react";
|
|
9
9
|
import { getLastAuthProvider, ThirdwebProvider, useActiveAccount, useConnectedWallets, useSetActiveWallet, } from "thirdweb/react";
|
|
10
10
|
import { WagmiProvider } from "wagmi";
|
|
11
11
|
import { setClientType } from "../../../client-manager.js";
|
|
@@ -39,7 +39,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, onConnect, connector
|
|
|
39
39
|
useEffect(() => {
|
|
40
40
|
setClientType(clientType);
|
|
41
41
|
}, [clientType]);
|
|
42
|
-
const wagmiConfig =
|
|
42
|
+
const wagmiConfig = createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors });
|
|
43
43
|
return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(ToastProvider, { children: _jsx(LocalSDKProvider, { onConnectCallback: onConnect, children: _jsxs(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, partnerId: partnerId, createClientReferenceId: createClientReferenceId, enableTurnkey: enableTurnkey, children: [_jsx(ToastContextConnector, {}), _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" })] })] }) }) }) }) }) }) }));
|
|
44
44
|
}
|
|
45
45
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { TooltipProvider } from "@b3dotfun/sdk/global-account/react";
|
|
4
|
-
import {
|
|
4
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
5
|
+
import { ReactNode, useState } from "react";
|
|
5
6
|
import { FeatureFlags, FeatureFlagsProvider } from "../contexts/FeatureFlagsContext";
|
|
6
7
|
import { StripeRedirectHandler } from "./StripeRedirectHandler";
|
|
7
8
|
|
|
@@ -10,6 +11,16 @@ interface AnyspendProviderProps {
|
|
|
10
11
|
featureFlags?: FeatureFlags;
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
const defaultQueryClientConfig = {
|
|
15
|
+
defaultOptions: {
|
|
16
|
+
queries: {
|
|
17
|
+
refetchOnWindowFocus: false,
|
|
18
|
+
retry: false,
|
|
19
|
+
staleTime: 30000,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
} as const;
|
|
23
|
+
|
|
13
24
|
/**
|
|
14
25
|
* AnyspendProvider is a top-level provider that wraps your application to provide
|
|
15
26
|
* query caching and state management for all Anyspend hooks.
|
|
@@ -34,12 +45,16 @@ interface AnyspendProviderProps {
|
|
|
34
45
|
* ```
|
|
35
46
|
*/
|
|
36
47
|
export const AnyspendProvider = function AnyspendProvider({ children, featureFlags }: AnyspendProviderProps) {
|
|
48
|
+
const [queryClient] = useState(() => new QueryClient(defaultQueryClientConfig));
|
|
49
|
+
|
|
37
50
|
return (
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
<QueryClientProvider client={queryClient}>
|
|
52
|
+
<FeatureFlagsProvider featureFlags={featureFlags}>
|
|
53
|
+
<TooltipProvider>
|
|
54
|
+
<StripeRedirectHandler />
|
|
55
|
+
{children}
|
|
56
|
+
</TooltipProvider>
|
|
57
|
+
</FeatureFlagsProvider>
|
|
58
|
+
</QueryClientProvider>
|
|
44
59
|
);
|
|
45
60
|
};
|
|
@@ -12,7 +12,7 @@ import { loadGA4Script } from "@b3dotfun/sdk/global-account/utils/analytics";
|
|
|
12
12
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
13
13
|
import "@relayprotocol/relay-kit-ui/styles.css";
|
|
14
14
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
15
|
-
import { useCallback, useEffect,
|
|
15
|
+
import { useCallback, useEffect, useState } from "react";
|
|
16
16
|
import {
|
|
17
17
|
getLastAuthProvider,
|
|
18
18
|
ThirdwebProvider,
|
|
@@ -92,11 +92,7 @@ export function B3Provider({
|
|
|
92
92
|
useEffect(() => {
|
|
93
93
|
setClientType(clientType);
|
|
94
94
|
}, [clientType]);
|
|
95
|
-
|
|
96
|
-
const wagmiConfig = useMemo(
|
|
97
|
-
() => createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }),
|
|
98
|
-
[partnerId, rpcUrls, connectors, overrideDefaultConnectors],
|
|
99
|
-
);
|
|
95
|
+
const wagmiConfig = createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors });
|
|
100
96
|
|
|
101
97
|
return (
|
|
102
98
|
<ThirdwebProvider>
|