@b3dotfun/sdk 0.0.83-alpha.0 → 0.0.83-alpha.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/dist/cjs/anyspend/react/providers/AnyspendProvider.js +1 -13
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +1 -1
- package/dist/esm/anyspend/react/providers/AnyspendProvider.js +1 -13
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/package.json +1 -1
- package/src/anyspend/react/providers/AnyspendProvider.tsx +7 -22
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +6 -2
|
@@ -4,19 +4,8 @@ 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");
|
|
9
7
|
const FeatureFlagsContext_1 = require("../contexts/FeatureFlagsContext");
|
|
10
8
|
const StripeRedirectHandler_1 = require("./StripeRedirectHandler");
|
|
11
|
-
const defaultQueryClientConfig = {
|
|
12
|
-
defaultOptions: {
|
|
13
|
-
queries: {
|
|
14
|
-
refetchOnWindowFocus: false,
|
|
15
|
-
retry: false,
|
|
16
|
-
staleTime: 30000,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
9
|
/**
|
|
21
10
|
* AnyspendProvider is a top-level provider that wraps your application to provide
|
|
22
11
|
* query caching and state management for all Anyspend hooks.
|
|
@@ -41,7 +30,6 @@ const defaultQueryClientConfig = {
|
|
|
41
30
|
* ```
|
|
42
31
|
*/
|
|
43
32
|
const AnyspendProvider = function AnyspendProvider({ children, featureFlags }) {
|
|
44
|
-
|
|
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] }) }) }));
|
|
33
|
+
return ((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] }) }));
|
|
46
34
|
};
|
|
47
35
|
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, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors });
|
|
46
|
+
const wagmiConfig = (0, react_2.useMemo)(() => (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [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,19 +1,8 @@
|
|
|
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";
|
|
6
4
|
import { FeatureFlagsProvider } from "../contexts/FeatureFlagsContext.js";
|
|
7
5
|
import { StripeRedirectHandler } from "./StripeRedirectHandler.js";
|
|
8
|
-
const defaultQueryClientConfig = {
|
|
9
|
-
defaultOptions: {
|
|
10
|
-
queries: {
|
|
11
|
-
refetchOnWindowFocus: false,
|
|
12
|
-
retry: false,
|
|
13
|
-
staleTime: 30000,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
6
|
/**
|
|
18
7
|
* AnyspendProvider is a top-level provider that wraps your application to provide
|
|
19
8
|
* query caching and state management for all Anyspend hooks.
|
|
@@ -38,6 +27,5 @@ const defaultQueryClientConfig = {
|
|
|
38
27
|
* ```
|
|
39
28
|
*/
|
|
40
29
|
export const AnyspendProvider = function AnyspendProvider({ children, featureFlags }) {
|
|
41
|
-
|
|
42
|
-
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(FeatureFlagsProvider, { featureFlags: featureFlags, children: _jsxs(TooltipProvider, { children: [_jsx(StripeRedirectHandler, {}), children] }) }) }));
|
|
30
|
+
return (_jsx(FeatureFlagsProvider, { featureFlags: featureFlags, children: _jsxs(TooltipProvider, { children: [_jsx(StripeRedirectHandler, {}), children] }) }));
|
|
43
31
|
};
|
|
@@ -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, useState } from "react";
|
|
8
|
+
import { useCallback, useEffect, useMemo, 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 = createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors });
|
|
42
|
+
const wagmiConfig = useMemo(() => createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [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,8 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { TooltipProvider } from "@b3dotfun/sdk/global-account/react";
|
|
4
|
-
import {
|
|
5
|
-
import { ReactNode, useState } from "react";
|
|
4
|
+
import { ReactNode } from "react";
|
|
6
5
|
import { FeatureFlags, FeatureFlagsProvider } from "../contexts/FeatureFlagsContext";
|
|
7
6
|
import { StripeRedirectHandler } from "./StripeRedirectHandler";
|
|
8
7
|
|
|
@@ -11,16 +10,6 @@ interface AnyspendProviderProps {
|
|
|
11
10
|
featureFlags?: FeatureFlags;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
const defaultQueryClientConfig = {
|
|
15
|
-
defaultOptions: {
|
|
16
|
-
queries: {
|
|
17
|
-
refetchOnWindowFocus: false,
|
|
18
|
-
retry: false,
|
|
19
|
-
staleTime: 30000,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
} as const;
|
|
23
|
-
|
|
24
13
|
/**
|
|
25
14
|
* AnyspendProvider is a top-level provider that wraps your application to provide
|
|
26
15
|
* query caching and state management for all Anyspend hooks.
|
|
@@ -45,16 +34,12 @@ const defaultQueryClientConfig = {
|
|
|
45
34
|
* ```
|
|
46
35
|
*/
|
|
47
36
|
export const AnyspendProvider = function AnyspendProvider({ children, featureFlags }: AnyspendProviderProps) {
|
|
48
|
-
const [queryClient] = useState(() => new QueryClient(defaultQueryClientConfig));
|
|
49
|
-
|
|
50
37
|
return (
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
</FeatureFlagsProvider>
|
|
58
|
-
</QueryClientProvider>
|
|
38
|
+
<FeatureFlagsProvider featureFlags={featureFlags}>
|
|
39
|
+
<TooltipProvider>
|
|
40
|
+
<StripeRedirectHandler />
|
|
41
|
+
{children}
|
|
42
|
+
</TooltipProvider>
|
|
43
|
+
</FeatureFlagsProvider>
|
|
59
44
|
);
|
|
60
45
|
};
|
|
@@ -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, useState } from "react";
|
|
15
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
16
16
|
import {
|
|
17
17
|
getLastAuthProvider,
|
|
18
18
|
ThirdwebProvider,
|
|
@@ -92,7 +92,11 @@ export function B3Provider({
|
|
|
92
92
|
useEffect(() => {
|
|
93
93
|
setClientType(clientType);
|
|
94
94
|
}, [clientType]);
|
|
95
|
-
|
|
95
|
+
|
|
96
|
+
const wagmiConfig = useMemo(
|
|
97
|
+
() => createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }),
|
|
98
|
+
[partnerId, rpcUrls, connectors, overrideDefaultConnectors],
|
|
99
|
+
);
|
|
96
100
|
|
|
97
101
|
return (
|
|
98
102
|
<ThirdwebProvider>
|