@b3dotfun/sdk 0.0.88-alpha.5 → 0.0.88-alpha.6
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/components/AnySpend.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +1 -1
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +3 -4
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +1 -1
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -3
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +12 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +23 -57
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +38 -35
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +14 -4
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +4 -11
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +5 -2
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +18 -17
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +1 -2
- package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +6 -6
- package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +7 -7
- package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +5 -5
- package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +8 -9
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
- package/dist/cjs/global-account/react/components/StyleRoot.js +3 -3
- package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +1 -2
- package/dist/cjs/global-account/react/components/index.d.ts +1 -2
- package/dist/cjs/global-account/react/components/index.js +3 -6
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/index.js +3 -1
- package/dist/cjs/global-account/react/hooks/useAuth.js +1 -2
- package/dist/cjs/global-account/react/hooks/useClient.js +1 -1
- package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +1 -1
- package/dist/cjs/global-account/react/hooks/useNotifications.js +14 -14
- package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
- package/dist/cjs/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/cjs/global-account/react/hooks/useUser.js +20 -0
- package/dist/cjs/global-account/react/hooks/useUserQuery.js +9 -35
- package/dist/cjs/global-account/react/index.native.d.ts +0 -2
- package/dist/cjs/global-account/react/index.native.js +1 -5
- package/dist/cjs/global-account/react/stores/configStore.d.ts +24 -0
- package/dist/cjs/global-account/react/stores/configStore.js +30 -0
- package/dist/cjs/global-account/react/stores/index.d.ts +1 -0
- package/dist/cjs/global-account/react/stores/index.js +3 -1
- package/dist/cjs/global-account/react/stores/userStore.d.ts +22 -0
- package/dist/cjs/global-account/react/stores/userStore.js +30 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +2 -2
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +3 -4
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +2 -2
- package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +2 -2
- package/dist/esm/global-account/react/components/B3DynamicModal.js +3 -4
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +10 -0
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +22 -58
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +36 -36
- package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +14 -4
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +4 -11
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +5 -2
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +18 -17
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +2 -3
- package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +2 -2
- package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +2 -3
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
- package/dist/esm/global-account/react/components/StyleRoot.js +3 -3
- package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +2 -3
- package/dist/esm/global-account/react/components/index.d.ts +1 -2
- package/dist/esm/global-account/react/components/index.js +1 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useAuth.js +2 -3
- package/dist/esm/global-account/react/hooks/useClient.js +2 -2
- package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
- package/dist/esm/global-account/react/hooks/useNotifications.js +2 -2
- package/dist/esm/global-account/react/hooks/useTokenBalance.js +6 -6
- package/dist/esm/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/esm/global-account/react/hooks/useUser.js +17 -0
- package/dist/esm/global-account/react/hooks/useUserQuery.js +1 -27
- package/dist/esm/global-account/react/index.native.d.ts +0 -2
- package/dist/esm/global-account/react/index.native.js +0 -2
- package/dist/esm/global-account/react/stores/configStore.d.ts +24 -0
- package/dist/esm/global-account/react/stores/configStore.js +27 -0
- package/dist/esm/global-account/react/stores/index.d.ts +1 -0
- package/dist/esm/global-account/react/stores/index.js +1 -0
- package/dist/esm/global-account/react/stores/userStore.d.ts +22 -0
- package/dist/esm/global-account/react/stores/userStore.js +27 -0
- package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +14 -4
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
- package/dist/types/global-account/react/components/index.d.ts +1 -2
- package/dist/types/global-account/react/hooks/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useUser.d.ts +60 -0
- package/dist/types/global-account/react/index.native.d.ts +0 -2
- package/dist/types/global-account/react/stores/configStore.d.ts +24 -0
- package/dist/types/global-account/react/stores/index.d.ts +1 -0
- package/dist/types/global-account/react/stores/userStore.d.ts +22 -0
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +2 -2
- package/src/anyspend/react/components/common/OrderDetails.tsx +2 -2
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +3 -4
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -2
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -2
- package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +2 -2
- package/src/global-account/react/components/B3DynamicModal.tsx +3 -4
- package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +19 -0
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +43 -54
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +32 -117
- package/src/global-account/react/components/B3Provider/useB3.ts +4 -13
- package/src/global-account/react/components/B3Provider/useB3Account.ts +6 -2
- package/src/global-account/react/components/B3Provider/useB3Config.ts +18 -31
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +2 -4
- package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +2 -2
- package/src/global-account/react/components/RequestPermissions/RequestPermissions.tsx +4 -4
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
- package/src/global-account/react/components/StyleRoot.tsx +3 -3
- package/src/global-account/react/components/custom/ManageAccountButton.tsx +2 -3
- package/src/global-account/react/components/index.ts +1 -2
- package/src/global-account/react/hooks/index.ts +1 -0
- package/src/global-account/react/hooks/useAuth.ts +2 -3
- package/src/global-account/react/hooks/useClient.ts +2 -2
- package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +2 -2
- package/src/global-account/react/hooks/useNotifications.ts +2 -2
- package/src/global-account/react/hooks/useTokenBalance.tsx +8 -7
- package/src/global-account/react/hooks/useUser.ts +20 -0
- package/src/global-account/react/hooks/useUserQuery.ts +1 -40
- package/src/global-account/react/index.native.ts +0 -2
- package/src/global-account/react/stores/configStore.ts +51 -0
- package/src/global-account/react/stores/index.ts +1 -0
- package/src/global-account/react/stores/userStore.ts +41 -0
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +0 -27
- package/dist/cjs/global-account/react/components/B3Provider/types.js +0 -24
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +0 -27
- package/dist/esm/global-account/react/components/B3Provider/types.js +0 -21
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +0 -27
- package/src/global-account/react/components/B3Provider/types.ts +0 -50
|
@@ -60,7 +60,7 @@ function AnySpend(props) {
|
|
|
60
60
|
function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, onSuccess, customUsdInputValues, hideHeader, hideBottomNavigation = false, disableUrlParamManagement = false, }) {
|
|
61
61
|
const searchParams = (0, react_2.useSearchParamsSSR)();
|
|
62
62
|
const router = (0, react_2.useRouter)();
|
|
63
|
-
const { partnerId } = (0, react_2.
|
|
63
|
+
const { partnerId } = (0, react_2.useB3Config)();
|
|
64
64
|
const setB3ModalContentType = (0, react_2.useModalStore)(state => state.setB3ModalContentType);
|
|
65
65
|
// Determine if we're in "buy mode" based on whether destination token props are provided
|
|
66
66
|
const isBuyMode = !!(destinationTokenAddress && destinationTokenChainId);
|
|
@@ -141,7 +141,7 @@ exports.OrderDetails = (0, react_5.memo)(function OrderDetails({ mode = "modal",
|
|
|
141
141
|
const router = (0, hooks_1.useRouter)();
|
|
142
142
|
const searchParams = (0, hooks_1.useSearchParams)();
|
|
143
143
|
// Get theme from B3Provider context
|
|
144
|
-
const { theme } = (0, react_1.
|
|
144
|
+
const { theme } = (0, react_1.useB3Config)();
|
|
145
145
|
const colorMode = theme || "light";
|
|
146
146
|
// Read crypto payment method from URL parameters
|
|
147
147
|
const cryptoPaymentMethodFromUrl = searchParams.get("cryptoPaymentMethod");
|
|
@@ -5,11 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.default = PaymentStripeWeb2;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const payment_utils_1 = require("../../../../shared/utils/payment.utils");
|
|
9
8
|
const react_1 = require("../../../../anyspend/react");
|
|
10
9
|
const react_2 = require("../../../../global-account/react");
|
|
11
10
|
const number_1 = require("../../../../shared/utils/number");
|
|
12
|
-
const
|
|
11
|
+
const payment_utils_1 = require("../../../../shared/utils/payment.utils");
|
|
13
12
|
const react_stripe_js_1 = require("@stripe/react-stripe-js");
|
|
14
13
|
const lucide_react_1 = require("lucide-react");
|
|
15
14
|
const react_3 = require("react");
|
|
@@ -17,7 +16,7 @@ const AnySpendFingerprintWrapper_1 = require("../AnySpendFingerprintWrapper");
|
|
|
17
16
|
const HowItWorks_1 = __importDefault(require("./HowItWorks"));
|
|
18
17
|
const PaymentMethodIcons_1 = __importDefault(require("./PaymentMethodIcons"));
|
|
19
18
|
function PaymentStripeWeb2({ order, stripePaymentIntentId, onPaymentSuccess }) {
|
|
20
|
-
const { theme, stripePublishableKey } = (0, react_2.
|
|
19
|
+
const { theme, stripePublishableKey } = (0, react_2.useB3Config)();
|
|
21
20
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
22
21
|
const { clientSecret, isLoadingStripeClientSecret, stripeClientSecretError } = (0, react_1.useStripeClientSecret)(stripePaymentIntentId);
|
|
23
22
|
if (isLoadingStripeClientSecret) {
|
|
@@ -59,7 +58,7 @@ function StripePaymentForm({ order, clientSecret, onPaymentSuccess, }) {
|
|
|
59
58
|
try {
|
|
60
59
|
const paymentIntent = await stripe.retrievePaymentIntent(clientSecret);
|
|
61
60
|
const amount = paymentIntent.paymentIntent?.amount
|
|
62
|
-
? (0,
|
|
61
|
+
? (0, payment_utils_1.formatStripeAmount)(paymentIntent.paymentIntent.amount)
|
|
63
62
|
: null;
|
|
64
63
|
setAmount(amount);
|
|
65
64
|
}
|
|
@@ -17,7 +17,7 @@ const useValidatedClientReferenceId_1 = require("./useValidatedClientReferenceId
|
|
|
17
17
|
*/
|
|
18
18
|
function useAnyspendCreateOnrampOrder({ onSuccess, onError } = {}) {
|
|
19
19
|
// Get B3 context values
|
|
20
|
-
const { partnerId } = (0, react_1.
|
|
20
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
21
21
|
// Get validated client reference ID from B3 context
|
|
22
22
|
const createValidatedClientReferenceId = (0, useValidatedClientReferenceId_1.useValidatedClientReferenceId)();
|
|
23
23
|
// Get fingerprint data
|
|
@@ -15,7 +15,7 @@ const useValidatedClientReferenceId_1 = require("./useValidatedClientReferenceId
|
|
|
15
15
|
*/
|
|
16
16
|
function useAnyspendCreateOrder({ onSuccess, onError } = {}) {
|
|
17
17
|
// Get B3 context values
|
|
18
|
-
const { partnerId } = (0, react_1.
|
|
18
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
19
19
|
// Get validated client reference ID from B3 context
|
|
20
20
|
const createValidatedClientReferenceId = (0, useValidatedClientReferenceId_1.useValidatedClientReferenceId)();
|
|
21
21
|
// Get fingerprint data
|
|
@@ -12,7 +12,7 @@ const react_2 = require("react");
|
|
|
12
12
|
* This order type doesn't require srcAmount - the user deposits tokens after the order is created.
|
|
13
13
|
*/
|
|
14
14
|
function useCreateDepositFirstOrder({ onSuccess, onError } = {}) {
|
|
15
|
-
const { partnerId } = (0, react_1.
|
|
15
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
16
16
|
const { data: fpData } = (0, fingerprintjs_pro_react_1.useVisitorData)({ extendedResult: true }, { immediate: true });
|
|
17
17
|
const visitorData = fpData && {
|
|
18
18
|
requestId: fpData.requestId,
|
|
@@ -9,7 +9,7 @@ const react_2 = require("react");
|
|
|
9
9
|
* Gets the createClientReferenceId function from B3 context and validates the result
|
|
10
10
|
*/
|
|
11
11
|
function useValidatedClientReferenceId() {
|
|
12
|
-
const { createClientReferenceId } = (0, react_1.
|
|
12
|
+
const { createClientReferenceId } = (0, react_1.useB3Config)();
|
|
13
13
|
const createValidatedClientReferenceId = (0, react_2.useCallback)(async (params) => {
|
|
14
14
|
// If no function provided, return undefined
|
|
15
15
|
if (!createClientReferenceId) {
|
|
@@ -17,7 +17,6 @@ const framer_motion_1 = require("framer-motion");
|
|
|
17
17
|
const react_3 = require("react");
|
|
18
18
|
const react_4 = require("thirdweb/react");
|
|
19
19
|
const AvatarEditor_1 = require("./AvatarEditor/AvatarEditor");
|
|
20
|
-
const useB3_1 = require("./B3Provider/useB3");
|
|
21
20
|
const Deposit_1 = require("./Deposit/Deposit");
|
|
22
21
|
const LinkAccount_1 = require("./LinkAccount/LinkAccount");
|
|
23
22
|
const LinkNewAccount_1 = require("./LinkAccount/LinkNewAccount");
|
|
@@ -26,8 +25,8 @@ const NotificationsContent_1 = __importDefault(require("./ManageAccount/Notifica
|
|
|
26
25
|
const RequestPermissions_1 = require("./RequestPermissions/RequestPermissions");
|
|
27
26
|
const Send_1 = require("./Send/Send");
|
|
28
27
|
const SignInWithB3Flow_1 = require("./SignInWithB3/SignInWithB3Flow");
|
|
29
|
-
const TurnkeyAuthModal_1 = require("./TurnkeyAuthModal");
|
|
30
28
|
const index_1 = require("./Toast/index");
|
|
29
|
+
const TurnkeyAuthModal_1 = require("./TurnkeyAuthModal");
|
|
31
30
|
const dialog_1 = require("./ui/dialog");
|
|
32
31
|
const drawer_1 = require("./ui/drawer");
|
|
33
32
|
const debug = (0, debug_1.debugB3React)("B3DynamicModal");
|
|
@@ -36,7 +35,7 @@ function B3DynamicModal() {
|
|
|
36
35
|
const setB3ModalOpen = (0, react_2.useModalStore)(state => state.setB3ModalOpen);
|
|
37
36
|
const contentType = (0, react_2.useModalStore)(state => state.contentType);
|
|
38
37
|
const navigateBack = (0, react_2.useModalStore)(state => state.navigateBack);
|
|
39
|
-
const { theme } = (0,
|
|
38
|
+
const { theme } = (0, react_2.useB3Config)();
|
|
40
39
|
const isMobile = (0, react_2.useIsMobile)();
|
|
41
40
|
const prevIsOpenRef = (0, react_3.useRef)(isOpen);
|
|
42
41
|
const { wallet } = (0, react_2.useGlobalAccount)();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const hooks_1 = require("../../hooks");
|
|
4
|
+
const useAutoSelectWallet_1 = require("../../hooks/useAutoSelectWallet");
|
|
5
|
+
const AuthenticationProvider = ({ partnerId, automaticallySetFirstEoa, }) => {
|
|
6
|
+
(0, hooks_1.useAuthentication)(partnerId);
|
|
7
|
+
(0, useAutoSelectWallet_1.useAutoSelectWallet)({
|
|
8
|
+
enabled: automaticallySetFirstEoa,
|
|
9
|
+
});
|
|
10
|
+
return null;
|
|
11
|
+
};
|
|
12
|
+
exports.default = AuthenticationProvider;
|
|
@@ -5,15 +5,14 @@ import "@relayprotocol/relay-kit-ui/styles.css";
|
|
|
5
5
|
import { Account, Wallet } from "thirdweb/wallets";
|
|
6
6
|
import { CreateConnectorFn } from "wagmi";
|
|
7
7
|
import { ClientType } from "../../../client-manager";
|
|
8
|
-
import { B3ContextType } from "./types";
|
|
9
8
|
/**
|
|
10
9
|
* Main B3Provider component
|
|
11
10
|
*/
|
|
12
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors, createClientReferenceId, enableTurnkey, }: {
|
|
11
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors, createClientReferenceId, enableTurnkey, defaultPermissions, }: {
|
|
13
12
|
theme: "light" | "dark";
|
|
14
13
|
children: React.ReactNode;
|
|
15
14
|
accountOverride?: Account;
|
|
16
|
-
environment
|
|
15
|
+
environment?: "development" | "production";
|
|
17
16
|
automaticallySetFirstEoa?: boolean;
|
|
18
17
|
simDuneApiKey?: string;
|
|
19
18
|
toaster?: {
|
|
@@ -30,20 +29,5 @@ export declare function B3Provider({ theme, children, accountOverride, environme
|
|
|
30
29
|
overrideDefaultConnectors?: boolean;
|
|
31
30
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
32
31
|
enableTurnkey?: boolean;
|
|
33
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
34
|
-
/**
|
|
35
|
-
* Inner provider component that provides the actual B3Context
|
|
36
|
-
*/
|
|
37
|
-
export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }: {
|
|
38
|
-
children: React.ReactNode;
|
|
39
|
-
accountOverride?: Account;
|
|
40
|
-
environment: B3ContextType["environment"];
|
|
41
32
|
defaultPermissions?: PermissionsConfig;
|
|
42
|
-
automaticallySetFirstEoa: boolean;
|
|
43
|
-
theme: "light" | "dark";
|
|
44
|
-
clientType?: ClientType;
|
|
45
|
-
partnerId: string;
|
|
46
|
-
stripePublishableKey?: string;
|
|
47
|
-
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
48
|
-
enableTurnkey?: boolean;
|
|
49
33
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.B3Provider = B3Provider;
|
|
4
|
-
exports.InnerProvider = InnerProvider;
|
|
5
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
8
|
const react_1 = require("../../../../global-account/react");
|
|
7
|
-
const useAutoSelectWallet_1 = require("../../../../global-account/react/hooks/useAutoSelectWallet");
|
|
8
9
|
const createWagmiConfig_1 = require("../../../../global-account/react/utils/createWagmiConfig");
|
|
9
10
|
const analytics_1 = require("../../../../global-account/utils/analytics");
|
|
10
11
|
require("@relayprotocol/relay-kit-ui/styles.css");
|
|
@@ -13,19 +14,11 @@ const react_2 = require("react");
|
|
|
13
14
|
const react_3 = require("thirdweb/react");
|
|
14
15
|
const wagmi_1 = require("wagmi");
|
|
15
16
|
const client_manager_1 = require("../../../client-manager");
|
|
17
|
+
const configStore_1 = require("../../stores/configStore");
|
|
16
18
|
const StyleRoot_1 = require("../StyleRoot");
|
|
17
19
|
const index_1 = require("../Toast/index");
|
|
20
|
+
const AuthenticationProvider_1 = __importDefault(require("./AuthenticationProvider"));
|
|
18
21
|
const LocalSDKProvider_1 = require("./LocalSDKProvider");
|
|
19
|
-
const types_1 = require("./types");
|
|
20
|
-
/**
|
|
21
|
-
* Default permissions configuration for B3 provider
|
|
22
|
-
*/
|
|
23
|
-
const DEFAULT_PERMISSIONS = {
|
|
24
|
-
approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"], // Example contract
|
|
25
|
-
nativeTokenLimitPerTransaction: 0.1, // in ETH
|
|
26
|
-
startDate: new Date(),
|
|
27
|
-
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
28
|
-
};
|
|
29
22
|
// Create queryClient instance
|
|
30
23
|
const queryClient = new react_query_1.QueryClient();
|
|
31
24
|
/**
|
|
@@ -33,7 +26,23 @@ const queryClient = new react_query_1.QueryClient();
|
|
|
33
26
|
*/
|
|
34
27
|
function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey,
|
|
35
28
|
// deprecated since v0.0.87
|
|
36
|
-
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, }) {
|
|
29
|
+
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, connectors, overrideDefaultConnectors = false, createClientReferenceId, enableTurnkey = false, defaultPermissions, }) {
|
|
30
|
+
const setConfig = (0, configStore_1.useB3ConfigStore)(state => state.setConfig);
|
|
31
|
+
// Initialize config store on mount - props are static and never change
|
|
32
|
+
(0, react_2.useEffect)(() => {
|
|
33
|
+
setConfig({
|
|
34
|
+
accountOverride,
|
|
35
|
+
environment: environment ?? "development",
|
|
36
|
+
automaticallySetFirstEoa: !!automaticallySetFirstEoa,
|
|
37
|
+
theme,
|
|
38
|
+
clientType,
|
|
39
|
+
partnerId,
|
|
40
|
+
stripePublishableKey,
|
|
41
|
+
createClientReferenceId,
|
|
42
|
+
enableTurnkey,
|
|
43
|
+
defaultPermissions,
|
|
44
|
+
});
|
|
45
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
37
46
|
// Initialize Google Analytics on mount
|
|
38
47
|
(0, react_2.useEffect)(() => {
|
|
39
48
|
(0, analytics_1.loadGA4Script)();
|
|
@@ -43,50 +52,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
43
52
|
(0, client_manager_1.setClientType)(clientType);
|
|
44
53
|
}, [clientType]);
|
|
45
54
|
const wagmiConfig = (0, react_2.useMemo)(() => (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
|
|
46
|
-
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.
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Inner provider component that provides the actual B3Context
|
|
50
|
-
*/
|
|
51
|
-
function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }) {
|
|
52
|
-
const activeAccount = (0, react_3.useActiveAccount)();
|
|
53
|
-
const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
|
|
54
|
-
//const isConnected = useAuthStore(state => state.isConnected);
|
|
55
|
-
//const justCompletedLogin = useAuthStore(state => state.justCompletedLogin);
|
|
56
|
-
// Note: This fixes a bug where useAuthentication is no longer rendered on every page, as of this PR https://github.com/b3-fun/b3/pull/385/files#diff-3ef996931b8fc8e49021ba1b42ddaa97535214681610dc5fdacf63542e261af7
|
|
57
|
-
// The above PR removes useAuthentication from the overall B3Provider. useAuthentication should be everywhere the provider is, since it sets the overall auth state
|
|
58
|
-
// By just calling it manually, we fix that issue
|
|
59
|
-
// As a follow up, we should fix the SDK directly
|
|
60
|
-
(0, react_1.useAuthentication)(partnerId);
|
|
61
|
-
// Use given accountOverride or activeAccount from thirdweb
|
|
62
|
-
// WOJ: why if isAuthenticated is false, we don't use activeAccount, which should be undefined?
|
|
63
|
-
// skip isAuthenticated check ?
|
|
64
|
-
const effectiveAccount = isAuthenticated ? accountOverride || activeAccount : undefined;
|
|
65
|
-
// Wrapper to set active wallet via thirdweb
|
|
66
|
-
// Note: `wallet` in context is deprecated - use useActiveWallet() from thirdweb/react instead
|
|
67
|
-
// Auto-select first EOA wallet when enabled
|
|
68
|
-
(0, useAutoSelectWallet_1.useAutoSelectWallet)({
|
|
69
|
-
enabled: automaticallySetFirstEoa,
|
|
70
|
-
});
|
|
71
|
-
return ((0, jsx_runtime_1.jsx)(types_1.B3Context.Provider, { value: {
|
|
72
|
-
account: effectiveAccount,
|
|
73
|
-
// setWallet,
|
|
74
|
-
//wallet: undefined, // Deprecated: use useActiveWallet() from thirdweb/react instead
|
|
75
|
-
//user,
|
|
76
|
-
//setUser,
|
|
77
|
-
//refetchUser,
|
|
78
|
-
initialized: true,
|
|
79
|
-
ready: !!effectiveAccount,
|
|
80
|
-
automaticallySetFirstEoa,
|
|
81
|
-
environment,
|
|
82
|
-
defaultPermissions,
|
|
83
|
-
theme,
|
|
84
|
-
clientType,
|
|
85
|
-
partnerId: partnerId,
|
|
86
|
-
stripePublishableKey,
|
|
87
|
-
createClientReferenceId,
|
|
88
|
-
enableTurnkey,
|
|
89
|
-
}, children: children }));
|
|
55
|
+
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.jsxs)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, 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" })] }), (0, jsx_runtime_1.jsx)(AuthenticationProvider_1.default, { partnerId: partnerId, automaticallySetFirstEoa: !!automaticallySetFirstEoa })] }) }) }) }) }) }));
|
|
90
56
|
}
|
|
91
57
|
/**
|
|
92
58
|
* Component to connect the toast context to the global toast API
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { PermissionsConfig } from "../../../../global-account/types/permissions";
|
|
2
2
|
import { Account, Wallet } from "thirdweb/wallets";
|
|
3
3
|
import { ClientType } from "../../../client-manager";
|
|
4
|
-
import { B3ContextType } from "./types";
|
|
5
4
|
/**
|
|
6
5
|
* Main B3Provider component
|
|
7
6
|
*/
|
|
8
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, onConnect, }: {
|
|
7
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, onConnect, defaultPermissions, }: {
|
|
9
8
|
theme: "light" | "dark";
|
|
10
9
|
children: React.ReactNode;
|
|
11
10
|
accountOverride?: Account;
|
|
12
|
-
environment
|
|
11
|
+
environment?: "development" | "production";
|
|
13
12
|
clientType?: ClientType;
|
|
14
13
|
partnerId: string;
|
|
15
14
|
rpcUrls?: Record<number, string>;
|
|
16
15
|
onConnect?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
16
|
+
defaultPermissions?: PermissionsConfig;
|
|
17
17
|
}): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
/**
|
|
19
|
-
* Inner provider component
|
|
19
|
+
* Inner provider component for native
|
|
20
20
|
*/
|
|
21
21
|
export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme, clientType, partnerId, rpcUrls, }: {
|
|
22
22
|
children: React.ReactNode;
|
|
23
23
|
accountOverride?: Account;
|
|
24
|
-
environment
|
|
24
|
+
environment?: "development" | "production";
|
|
25
25
|
defaultPermissions?: PermissionsConfig;
|
|
26
26
|
theme: "light" | "dark";
|
|
27
27
|
clientType?: ClientType;
|
|
@@ -1,54 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.B3Provider = B3Provider;
|
|
4
7
|
exports.InnerProvider = InnerProvider;
|
|
5
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
9
|
const react_query_1 = require("@tanstack/react-query");
|
|
7
|
-
const react_1 = require("
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const react_2 = require("thirdweb/react");
|
|
8
12
|
const wagmi_1 = require("wagmi");
|
|
13
|
+
const configStore_1 = require("../../stores/configStore");
|
|
9
14
|
const createWagmiConfig_1 = require("../../utils/createWagmiConfig");
|
|
15
|
+
const AuthenticationProvider_1 = __importDefault(require("./AuthenticationProvider"));
|
|
10
16
|
const LocalSDKProvider_1 = require("./LocalSDKProvider");
|
|
11
|
-
const types_1 = require("./types");
|
|
12
|
-
/**
|
|
13
|
-
* Default permissions configuration for B3 provider
|
|
14
|
-
*/
|
|
15
|
-
const DEFAULT_PERMISSIONS = {
|
|
16
|
-
approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"], // Example contract
|
|
17
|
-
nativeTokenLimitPerTransaction: 0.1, // in ETH
|
|
18
|
-
startDate: new Date(),
|
|
19
|
-
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
20
|
-
};
|
|
21
17
|
// Create queryClient instance
|
|
22
18
|
const queryClient = new react_query_1.QueryClient();
|
|
23
19
|
/**
|
|
24
20
|
* Main B3Provider component
|
|
25
21
|
*/
|
|
26
|
-
function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls, onConnect, }) {
|
|
27
|
-
|
|
22
|
+
function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls, onConnect, defaultPermissions, }) {
|
|
23
|
+
const setConfig = (0, configStore_1.useB3ConfigStore)(state => state.setConfig);
|
|
24
|
+
// Initialize config store on mount - props are static and never change
|
|
25
|
+
(0, react_1.useEffect)(() => {
|
|
26
|
+
setConfig({
|
|
27
|
+
accountOverride,
|
|
28
|
+
environment: environment ?? "development",
|
|
29
|
+
automaticallySetFirstEoa: false,
|
|
30
|
+
theme,
|
|
31
|
+
clientType,
|
|
32
|
+
partnerId,
|
|
33
|
+
defaultPermissions,
|
|
34
|
+
});
|
|
35
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(react_2.ThirdwebProvider, { children: (0, jsx_runtime_1.jsxs)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, children: [children, (0, jsx_runtime_1.jsx)(AuthenticationProvider_1.default, { partnerId: partnerId, automaticallySetFirstEoa: false })] }) }));
|
|
28
37
|
}
|
|
29
38
|
/**
|
|
30
|
-
* Inner provider component
|
|
39
|
+
* Inner provider component for native
|
|
31
40
|
*/
|
|
32
|
-
function InnerProvider({ children, accountOverride, environment, defaultPermissions
|
|
33
|
-
const
|
|
34
|
-
//const { user, setUser, refetchUser } = useAuthentication(partnerId);
|
|
41
|
+
function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme = "light", clientType = "socket", partnerId, rpcUrls, }) {
|
|
42
|
+
const setConfig = (0, configStore_1.useB3ConfigStore)(state => state.setConfig);
|
|
35
43
|
const wagmiConfig = (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls });
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
theme,
|
|
50
|
-
clientType,
|
|
51
|
-
partnerId,
|
|
52
|
-
//refetchUser,
|
|
53
|
-
}, children: children }) }) }));
|
|
44
|
+
// Initialize config store on mount - props are static and never change
|
|
45
|
+
(0, react_1.useEffect)(() => {
|
|
46
|
+
setConfig({
|
|
47
|
+
accountOverride,
|
|
48
|
+
environment: environment ?? "development",
|
|
49
|
+
automaticallySetFirstEoa: false,
|
|
50
|
+
theme,
|
|
51
|
+
clientType,
|
|
52
|
+
partnerId,
|
|
53
|
+
defaultPermissions,
|
|
54
|
+
});
|
|
55
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: children }) }));
|
|
54
57
|
}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hook to access the B3
|
|
3
|
-
* @
|
|
4
|
-
* @deprecated Use useB3Config or useB3Account instead
|
|
2
|
+
* Hook to access the B3 configuration
|
|
3
|
+
* @deprecated This is just an alias for useB3Config. Use useB3Config directly instead.
|
|
5
4
|
*/
|
|
6
|
-
export declare function useB3():
|
|
5
|
+
export declare function useB3(): {
|
|
6
|
+
automaticallySetFirstEoa: boolean;
|
|
7
|
+
environment: "development" | "production";
|
|
8
|
+
theme: "light" | "dark";
|
|
9
|
+
clientType: import("../../../client-manager").ClientType;
|
|
10
|
+
partnerId: string;
|
|
11
|
+
createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
|
|
12
|
+
enableTurnkey: boolean;
|
|
13
|
+
stripePublishableKey: string | undefined;
|
|
14
|
+
defaultPermissions: import("../../../types/permissions").PermissionsConfig;
|
|
15
|
+
accountOverride: import("thirdweb/wallets").Account | undefined;
|
|
16
|
+
};
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useB3 = useB3;
|
|
4
|
-
const
|
|
5
|
-
const types_1 = require("./types");
|
|
4
|
+
const useB3Config_1 = require("./useB3Config");
|
|
6
5
|
/**
|
|
7
|
-
* Hook to access the B3
|
|
8
|
-
* @
|
|
9
|
-
* @deprecated Use useB3Config or useB3Account instead
|
|
6
|
+
* Hook to access the B3 configuration
|
|
7
|
+
* @deprecated This is just an alias for useB3Config. Use useB3Config directly instead.
|
|
10
8
|
*/
|
|
11
9
|
function useB3() {
|
|
12
|
-
|
|
13
|
-
if (!context.initialized) {
|
|
14
|
-
throw new Error("useB3 must be used within a B3Provider");
|
|
15
|
-
}
|
|
16
|
-
// Return a stable reference
|
|
17
|
-
return (0, react_1.useMemo)(() => context, [context]);
|
|
10
|
+
return (0, useB3Config_1.useB3Config)();
|
|
18
11
|
}
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useB3Account = void 0;
|
|
4
4
|
const react_1 = require("thirdweb/react");
|
|
5
|
+
const useAuthStore_1 = require("../../stores/useAuthStore");
|
|
5
6
|
// Wrapper around useActiveAccount
|
|
6
7
|
const useB3Account = () => {
|
|
7
|
-
const
|
|
8
|
-
|
|
8
|
+
const isAuthenticated = (0, useAuthStore_1.useAuthStore)(state => state.isAuthenticated);
|
|
9
|
+
const activeAccount = (0, react_1.useActiveAccount)();
|
|
10
|
+
const effectiveAccount = isAuthenticated ? activeAccount : undefined;
|
|
11
|
+
return effectiveAccount;
|
|
9
12
|
};
|
|
10
13
|
exports.useB3Account = useB3Account;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to access B3 configuration
|
|
3
|
+
* Returns all config values from the Zustand store
|
|
4
|
+
* Since config is static (set once at initialization), destructuring is fine here
|
|
5
|
+
*/
|
|
1
6
|
export declare const useB3Config: () => {
|
|
2
7
|
automaticallySetFirstEoa: boolean;
|
|
3
|
-
environment: "development" | "production"
|
|
8
|
+
environment: "development" | "production";
|
|
4
9
|
theme: "light" | "dark";
|
|
5
10
|
clientType: import("../../../client-manager").ClientType;
|
|
6
11
|
partnerId: string;
|
|
7
12
|
createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
|
|
8
|
-
enableTurnkey: boolean
|
|
13
|
+
enableTurnkey: boolean;
|
|
14
|
+
stripePublishableKey: string | undefined;
|
|
15
|
+
defaultPermissions: import("../../../types/permissions").PermissionsConfig;
|
|
16
|
+
accountOverride: import("thirdweb/wallets").Account | undefined;
|
|
9
17
|
};
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useB3Config = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const configStore_1 = require("../../stores/configStore");
|
|
5
|
+
/**
|
|
6
|
+
* Hook to access B3 configuration
|
|
7
|
+
* Returns all config values from the Zustand store
|
|
8
|
+
* Since config is static (set once at initialization), destructuring is fine here
|
|
9
|
+
*/
|
|
6
10
|
const useB3Config = () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
createClientReferenceId,
|
|
20
|
-
enableTurnkey,
|
|
21
|
-
}), [automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey]);
|
|
11
|
+
return (0, configStore_1.useB3ConfigStore)(state => ({
|
|
12
|
+
automaticallySetFirstEoa: state.automaticallySetFirstEoa,
|
|
13
|
+
environment: state.environment,
|
|
14
|
+
theme: state.theme,
|
|
15
|
+
clientType: state.clientType,
|
|
16
|
+
partnerId: state.partnerId,
|
|
17
|
+
createClientReferenceId: state.createClientReferenceId,
|
|
18
|
+
enableTurnkey: state.enableTurnkey,
|
|
19
|
+
stripePublishableKey: state.stripePublishableKey,
|
|
20
|
+
defaultPermissions: state.defaultPermissions,
|
|
21
|
+
accountOverride: state.accountOverride,
|
|
22
|
+
}));
|
|
22
23
|
};
|
|
23
24
|
exports.useB3Config = useB3Config;
|
|
@@ -17,8 +17,7 @@ const ProfileSection = () => {
|
|
|
17
17
|
address: eoaAddress || account?.address,
|
|
18
18
|
fresh: true,
|
|
19
19
|
});
|
|
20
|
-
const {
|
|
21
|
-
const { user } = (0, react_1.useAuthentication)(partnerId);
|
|
20
|
+
const { user } = (0, react_1.useUser)();
|
|
22
21
|
const setB3ModalOpen = (0, react_1.useModalStore)(state => state.setB3ModalOpen);
|
|
23
22
|
const setB3ModalContentType = (0, react_1.useModalStore)(state => state.setB3ModalContentType);
|
|
24
23
|
const navigateBack = (0, react_1.useModalStore)(state => state.navigateBack);
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DiscordChannel = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("../../../../../global-account/react");
|
|
5
6
|
const debug_1 = require("../../../../../shared/utils/debug");
|
|
6
|
-
const
|
|
7
|
+
const react_2 = require("react");
|
|
7
8
|
const notificationsAPI_1 = require("../../../utils/notificationsAPI");
|
|
8
|
-
const useB3_1 = require("../../B3Provider/useB3");
|
|
9
9
|
const toastApi_1 = require("../../Toast/toastApi");
|
|
10
10
|
const NotificationChannel_1 = require("../NotificationChannel");
|
|
11
11
|
const debug = (0, debug_1.debugB3React)("DiscordChannel");
|
|
12
12
|
const DiscordChannel = ({ userId, jwtToken, discordChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
|
|
13
|
-
const { partnerId } = (0,
|
|
14
|
-
const [discordId, setDiscordId] = (0,
|
|
15
|
-
const [isConnecting, setIsConnecting] = (0,
|
|
16
|
-
const [showInput, setShowInput] = (0,
|
|
13
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
14
|
+
const [discordId, setDiscordId] = (0, react_2.useState)("");
|
|
15
|
+
const [isConnecting, setIsConnecting] = (0, react_2.useState)(false);
|
|
16
|
+
const [showInput, setShowInput] = (0, react_2.useState)(false);
|
|
17
17
|
// Detect if we're disconnecting
|
|
18
18
|
const isDisconnecting = isConnected && !isOptimisticallyConnected;
|
|
19
19
|
const handleConnect = async () => {
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EmailChannel = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("../../../../../global-account/react");
|
|
5
6
|
const debug_1 = require("../../../../../shared/utils/debug");
|
|
6
|
-
const
|
|
7
|
+
const react_2 = require("react");
|
|
7
8
|
const notificationsAPI_1 = require("../../../utils/notificationsAPI");
|
|
8
|
-
const useB3_1 = require("../../B3Provider/useB3");
|
|
9
9
|
const toastApi_1 = require("../../Toast/toastApi");
|
|
10
10
|
const NotificationChannel_1 = require("../NotificationChannel");
|
|
11
11
|
const debug = (0, debug_1.debugB3React)("EmailChannel");
|
|
@@ -14,11 +14,11 @@ const validateEmail = (email) => {
|
|
|
14
14
|
return emailRegex.test(email);
|
|
15
15
|
};
|
|
16
16
|
const EmailChannel = ({ userId, jwtToken, emailChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
|
|
17
|
-
const { partnerId } = (0,
|
|
18
|
-
const [email, setEmail] = (0,
|
|
19
|
-
const [emailError, setEmailError] = (0,
|
|
20
|
-
const [isConnecting, setIsConnecting] = (0,
|
|
21
|
-
const [showInput, setShowInput] = (0,
|
|
17
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
18
|
+
const [email, setEmail] = (0, react_2.useState)("");
|
|
19
|
+
const [emailError, setEmailError] = (0, react_2.useState)(null);
|
|
20
|
+
const [isConnecting, setIsConnecting] = (0, react_2.useState)(false);
|
|
21
|
+
const [showInput, setShowInput] = (0, react_2.useState)(false);
|
|
22
22
|
// Detect if we're disconnecting by comparing real vs optimistic state
|
|
23
23
|
const isDisconnecting = isConnected && !isOptimisticallyConnected;
|
|
24
24
|
const handleConnect = async () => {
|