@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
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PhoneChannel = 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)("PhoneChannel");
|
|
12
12
|
const PhoneChannel = ({ userId, jwtToken, smsChannel, whatsappChannel, isSMSConnected, isWhatsAppConnected, isOptimisticallySMSConnected, isOptimisticallyWhatsAppConnected, onConnectionChange, onToggle, }) => {
|
|
13
|
-
const { partnerId } = (0,
|
|
14
|
-
const [phoneNumber, setPhoneNumber] = (0,
|
|
15
|
-
const [isConnectingSMS, setIsConnectingSMS] = (0,
|
|
16
|
-
const [isConnectingWhatsApp, setIsConnectingWhatsApp] = (0,
|
|
17
|
-
const [showInput, setShowInput] = (0,
|
|
13
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
14
|
+
const [phoneNumber, setPhoneNumber] = (0, react_2.useState)("");
|
|
15
|
+
const [isConnectingSMS, setIsConnectingSMS] = (0, react_2.useState)(false);
|
|
16
|
+
const [isConnectingWhatsApp, setIsConnectingWhatsApp] = (0, react_2.useState)(false);
|
|
17
|
+
const [showInput, setShowInput] = (0, react_2.useState)(false);
|
|
18
18
|
// Detect if we're disconnecting
|
|
19
19
|
const isDisconnecting = (isSMSConnected && !isOptimisticallySMSConnected) || (isWhatsAppConnected && !isOptimisticallyWhatsAppConnected);
|
|
20
20
|
const handleConnectSMS = async () => {
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TelegramChannel = 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)("TelegramChannel");
|
|
12
12
|
const TelegramChannel = ({ userId, jwtToken, telegramChannel, isConnected, isOptimisticallyConnected, onConnectionChange, onToggle, }) => {
|
|
13
|
-
const { partnerId } = (0,
|
|
14
|
-
const [isConnecting, setIsConnecting] = (0,
|
|
15
|
-
const [status, setStatus] = (0,
|
|
13
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
14
|
+
const [isConnecting, setIsConnecting] = (0, react_2.useState)(false);
|
|
15
|
+
const [status, setStatus] = (0, react_2.useState)("idle");
|
|
16
16
|
// Detect if we're disconnecting
|
|
17
17
|
const isDisconnecting = isConnected && !isOptimisticallyConnected;
|
|
18
18
|
const handleConnect = async () => {
|
|
@@ -6,23 +6,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.RequestPermissions = RequestPermissions;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_1 = require("../../../../global-account/react");
|
|
9
|
-
const react_2 = require("../../../../global-account/react");
|
|
10
9
|
const debug_1 = require("../../../../shared/utils/debug");
|
|
11
10
|
const formatAddress_1 = require("../../../../shared/utils/formatAddress");
|
|
12
11
|
const lucide_react_1 = require("lucide-react");
|
|
13
|
-
const
|
|
12
|
+
const react_2 = require("react");
|
|
14
13
|
const react_timeago_1 = __importDefault(require("react-timeago"));
|
|
15
|
-
const
|
|
14
|
+
const react_3 = require("thirdweb/react");
|
|
16
15
|
const debug = (0, debug_1.debugB3React)("RequestPermissions");
|
|
17
16
|
/**
|
|
18
17
|
* Component for requesting permissions to access user accounts and contracts
|
|
19
18
|
* Allows users to approve session keys with specific permission settings
|
|
20
19
|
*/
|
|
21
20
|
function RequestPermissions({ onSuccess, onError, chain, sessionKeyAddress, permissions, }) {
|
|
22
|
-
const [isApproving, setIsApproving] = (0,
|
|
23
|
-
const account = (0,
|
|
24
|
-
const { defaultPermissions } = (0, react_1.
|
|
25
|
-
const DEFAULT_PERMISSIONS = (0,
|
|
21
|
+
const [isApproving, setIsApproving] = (0, react_2.useState)(false);
|
|
22
|
+
const account = (0, react_3.useActiveAccount)();
|
|
23
|
+
const { defaultPermissions } = (0, react_1.useB3Config)();
|
|
24
|
+
const DEFAULT_PERMISSIONS = (0, react_2.useMemo)(() => permissions ?? defaultPermissions, [defaultPermissions, permissions]);
|
|
26
25
|
const { refetch: refetchSigners } = (0, react_1.useGetAllTWSigners)({
|
|
27
26
|
chain,
|
|
28
27
|
accountAddress: account?.address,
|
|
@@ -41,7 +40,7 @@ function RequestPermissions({ onSuccess, onError, chain, sessionKeyAddress, perm
|
|
|
41
40
|
},
|
|
42
41
|
chain,
|
|
43
42
|
});
|
|
44
|
-
const handleApprove = (0,
|
|
43
|
+
const handleApprove = (0, react_2.useCallback)(async () => {
|
|
45
44
|
debug("@@handleApprove");
|
|
46
45
|
try {
|
|
47
46
|
setIsApproving(true);
|
|
@@ -71,7 +70,7 @@ function RequestPermissions({ onSuccess, onError, chain, sessionKeyAddress, perm
|
|
|
71
70
|
timeStyle: "short",
|
|
72
71
|
}).format(date);
|
|
73
72
|
};
|
|
74
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("h2", { className: "mb-2 text-2xl font-bold", children: "Allow Access" }), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-react-muted-foreground opacity-70", children: "This app would like permission to:" })] }), (0, jsx_runtime_1.jsx)(
|
|
73
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("h2", { className: "mb-2 text-2xl font-bold", children: "Allow Access" }), (0, jsx_runtime_1.jsx)("p", { className: "text-b3-react-muted-foreground opacity-70", children: "This app would like permission to:" })] }), (0, jsx_runtime_1.jsx)(react_1.PermissionItem, { title: "Make transactions on your behalf", description: (0, jsx_runtime_1.jsxs)("span", { children: ["Up to", " ", (0, jsx_runtime_1.jsxs)("span", { className: "text-b3-react-primary font-medium", children: [DEFAULT_PERMISSIONS.nativeTokenLimitPerTransaction, " ETH"] }), " ", "per transaction"] }), icon: (0, jsx_runtime_1.jsx)(lucide_react_1.CreditCard, { className: "h-5 w-5" }) }), (0, jsx_runtime_1.jsx)(react_1.PermissionItem, { title: "View your account", description: "See your wallet address and balance", icon: (0, jsx_runtime_1.jsx)(lucide_react_1.Eye, { className: "h-5 w-5" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-card rounded-lg border p-5 py-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "mb-2 text-base font-medium", children: "Approved Contracts" }), (0, jsx_runtime_1.jsx)("div", { className: "space-y-2", children: DEFAULT_PERMISSIONS.approvedTargets.map((target) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-b3-react-background text-b3-react-muted-foreground rounded-md border px-3 py-2 font-mono text-sm", children: (0, formatAddress_1.formatAddress)(target) }), (0, jsx_runtime_1.jsx)("span", { className: "text-b3-react-muted-foreground text-sm", children: "\u2022 Game Contract" })] }, target))) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-card rounded-lg border p-5 py-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "mb-2 text-base font-medium", children: "Permission" }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-1 text-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-b3-react-muted-foreground", children: [(0, jsx_runtime_1.jsx)("span", { children: `Valid for ` }), (0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)(react_timeago_1.default, { date: DEFAULT_PERMISSIONS.endDate, live: false, formatter: (value, unit) => {
|
|
75
74
|
if (unit === "year") {
|
|
76
75
|
return "1 year";
|
|
77
76
|
}
|
|
@@ -15,7 +15,7 @@ const react_4 = require("thirdweb/react");
|
|
|
15
15
|
const ManageAccountButton_1 = require("../custom/ManageAccountButton");
|
|
16
16
|
function SignIn(props) {
|
|
17
17
|
const { className } = props;
|
|
18
|
-
const { automaticallySetFirstEoa, partnerId } = (0, react_1.
|
|
18
|
+
const { automaticallySetFirstEoa, partnerId } = (0, react_1.useB3Config)();
|
|
19
19
|
const { address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, } = (0, react_1.useAccountWallet)();
|
|
20
20
|
const { data: walletImage } = (0, react_4.useWalletImage)(connectedEOAWallet?.id);
|
|
21
21
|
const isMobile = (0, react_1.useIsMobile)();
|
|
@@ -7,7 +7,7 @@ const debug_1 = require("../../../../shared/utils/debug");
|
|
|
7
7
|
const react_2 = require("react");
|
|
8
8
|
const debug = (0, debug_1.debugB3React)("SignInWithB3Privy");
|
|
9
9
|
function SignInWithB3Privy({ onSuccess, onError, chain }) {
|
|
10
|
-
const { partnerId } = (0, react_1.
|
|
10
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
11
11
|
const { isLoading, connectTw, fullToken } = (0, react_1.useHandleConnectWithPrivy)(chain, onSuccess);
|
|
12
12
|
const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
|
|
13
13
|
const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
|
|
@@ -19,7 +19,7 @@ function LoginStepContainer({ children, partnerId }) {
|
|
|
19
19
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex flex-col items-center justify-center pt-6", children: [partnerLogo && ((0, jsx_runtime_1.jsx)("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 h-12 w-auto object-contain" })), children] }));
|
|
20
20
|
}
|
|
21
21
|
function LoginStep({ onSuccess, chain }) {
|
|
22
|
-
const { partnerId, theme } = (0, react_1.
|
|
22
|
+
const { partnerId, theme } = (0, react_1.useB3Config)();
|
|
23
23
|
const wallet = (0, wallets_1.ecosystemWallet)(constants_1.ecosystemWalletId, {
|
|
24
24
|
partnerId: partnerId,
|
|
25
25
|
});
|
|
@@ -10,7 +10,7 @@ const react_3 = require("thirdweb/react");
|
|
|
10
10
|
const wallets_1 = require("thirdweb/wallets");
|
|
11
11
|
const debug = (0, debug_1.debugB3React)("LoginStepCustom");
|
|
12
12
|
function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
|
|
13
|
-
const { partnerId } = (0, react_1.
|
|
13
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
14
14
|
const [isLoading, setIsLoading] = (0, react_2.useState)(false);
|
|
15
15
|
const [showAllWallets, setShowAllWallets] = (0, react_2.useState)(false);
|
|
16
16
|
const { connect } = (0, react_1.useConnect)(partnerId, chain);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StyleRoot = StyleRoot;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const useB3Config_1 = require("./B3Provider/useB3Config");
|
|
6
6
|
function StyleRoot({ children, id }) {
|
|
7
|
-
const { theme
|
|
8
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "b3-root", id: id, "data-theme":
|
|
7
|
+
const { theme } = (0, useB3Config_1.useB3Config)();
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "b3-root", id: id, "data-theme": theme, children: children }));
|
|
9
9
|
}
|
|
@@ -5,9 +5,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("../../../../global-account/react");
|
|
6
6
|
const utils_1 = require("../../../../shared/utils");
|
|
7
7
|
function ManageAccountButton(props) {
|
|
8
|
-
const { partnerId } = (0, react_1.useB3)();
|
|
9
8
|
const { setB3ModalOpen, setB3ModalContentType } = (0, react_1.useModalStore)();
|
|
10
|
-
const { isConnected } = (0, react_1.
|
|
9
|
+
const { isConnected } = (0, react_1.useUser)();
|
|
11
10
|
const handleClickManageAccount = () => {
|
|
12
11
|
setB3ModalContentType({
|
|
13
12
|
...props,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { B3DynamicModal } from "./B3DynamicModal";
|
|
2
|
-
export { B3Provider
|
|
2
|
+
export { B3Provider } from "./B3Provider/B3Provider";
|
|
3
3
|
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
4
|
-
export { B3Context, type B3ContextType } from "./B3Provider/types";
|
|
5
4
|
export { useB3 } from "./B3Provider/useB3";
|
|
6
5
|
export { useB3Account } from "./B3Provider/useB3Account";
|
|
7
6
|
export { useB3Config } from "./B3Provider/useB3Config";
|
|
@@ -3,20 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DialogClose = exports.Dialog = exports.CommandShortcut = exports.CommandSeparator = exports.CommandList = exports.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.SendERC20Button = exports.SendETHButton = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.IPFSMediaRenderer = exports.Send = exports.Deposit = exports.ManageAccount = exports.TurnkeyAuthModal = exports.isWalletType = exports.getConnectOptionsFromStrategy = exports.LoginStepContainer = exports.SignInWithB3Privy = exports.SignInWithB3Flow = exports.SignInWithB3 = exports.WalletRow = exports.PermissionItem = exports.AuthButton = exports.StyleRoot = exports.useB3Config = exports.useB3Account = exports.useB3 = exports.
|
|
7
|
-
exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DropdownMenuTrigger = exports.DropdownMenuSeparator = exports.DropdownMenuItem = exports.DropdownMenuContent = exports.DropdownMenu = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer = exports.DialogTrigger = exports.DialogTitle = exports.DialogPortal = exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter =
|
|
8
|
-
exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast =
|
|
6
|
+
exports.DialogDescription = exports.DialogContent = exports.DialogClose = exports.Dialog = exports.CommandShortcut = exports.CommandSeparator = exports.CommandList = exports.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.SendERC20Button = exports.SendETHButton = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.IPFSMediaRenderer = exports.Send = exports.Deposit = exports.ManageAccount = exports.TurnkeyAuthModal = exports.isWalletType = exports.getConnectOptionsFromStrategy = exports.LoginStepContainer = exports.SignInWithB3Privy = exports.SignInWithB3Flow = exports.SignInWithB3 = exports.WalletRow = exports.PermissionItem = exports.AuthButton = exports.StyleRoot = exports.useB3Config = exports.useB3Account = exports.useB3 = exports.RelayKitProviderWrapper = exports.B3Provider = exports.B3DynamicModal = void 0;
|
|
7
|
+
exports.toast = exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DropdownMenuTrigger = exports.DropdownMenuSeparator = exports.DropdownMenuItem = exports.DropdownMenuContent = exports.DropdownMenu = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer = exports.DialogTrigger = exports.DialogTitle = exports.DialogPortal = exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter = void 0;
|
|
8
|
+
exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast = void 0;
|
|
9
9
|
// TODO woj: Barrel file for all components, this might be reason of bundle size issues
|
|
10
10
|
// Core Components
|
|
11
11
|
var B3DynamicModal_1 = require("./B3DynamicModal");
|
|
12
12
|
Object.defineProperty(exports, "B3DynamicModal", { enumerable: true, get: function () { return B3DynamicModal_1.B3DynamicModal; } });
|
|
13
13
|
var B3Provider_1 = require("./B3Provider/B3Provider");
|
|
14
14
|
Object.defineProperty(exports, "B3Provider", { enumerable: true, get: function () { return B3Provider_1.B3Provider; } });
|
|
15
|
-
Object.defineProperty(exports, "InnerProvider", { enumerable: true, get: function () { return B3Provider_1.InnerProvider; } });
|
|
16
15
|
var RelayKitProviderWrapper_1 = require("./B3Provider/RelayKitProviderWrapper");
|
|
17
16
|
Object.defineProperty(exports, "RelayKitProviderWrapper", { enumerable: true, get: function () { return RelayKitProviderWrapper_1.RelayKitProviderWrapper; } });
|
|
18
|
-
var types_1 = require("./B3Provider/types");
|
|
19
|
-
Object.defineProperty(exports, "B3Context", { enumerable: true, get: function () { return types_1.B3Context; } });
|
|
20
17
|
var useB3_1 = require("./B3Provider/useB3");
|
|
21
18
|
Object.defineProperty(exports, "useB3", { enumerable: true, get: function () { return useB3_1.useB3; } });
|
|
22
19
|
var useB3Account_1 = require("./B3Provider/useB3Account");
|
|
@@ -43,3 +43,4 @@ export { useTokensFromAddress } from "./useTokensFromAddress";
|
|
|
43
43
|
export { useTurnkeyAuth } from "./useTurnkeyAuth";
|
|
44
44
|
export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
|
|
45
45
|
export { useURLParams } from "./useURLParams";
|
|
46
|
+
export { useUser } from "./useUser";
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.useURLParams = exports.useUnifiedChainSwitchAndExecute = exports.useTurnkeyAuth = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalanceDirect = exports.useTokenBalance = exports.useSiwe = exports.useSimSvmBalance = exports.useSimBalance = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfileSettings = exports.useProfilePreference = exports.useProfile = exports.useDisplayName = exports.useOneBalance = exports.useNotifications = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGlobalAccount = exports.useGetGeo = exports.useGetAllTWSigners = exports.useFirstEOA = exports.useExchangeRate = exports.useConnect = exports.useClient = exports.useChainSwitchWithAction = exports.useB3EnsName = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAuth = exports.useAnalytics = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = exports.createWagmiConfig = void 0;
|
|
17
|
+
exports.useUser = exports.useURLParams = exports.useUnifiedChainSwitchAndExecute = exports.useTurnkeyAuth = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalanceDirect = exports.useTokenBalance = exports.useSiwe = exports.useSimSvmBalance = exports.useSimBalance = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfileSettings = exports.useProfilePreference = exports.useProfile = exports.useDisplayName = exports.useOneBalance = exports.useNotifications = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGlobalAccount = exports.useGetGeo = exports.useGetAllTWSigners = exports.useFirstEOA = exports.useExchangeRate = exports.useConnect = exports.useClient = exports.useChainSwitchWithAction = exports.useB3EnsName = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAuth = exports.useAnalytics = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = exports.createWagmiConfig = void 0;
|
|
18
18
|
var createWagmiConfig_1 = require("../utils/createWagmiConfig");
|
|
19
19
|
Object.defineProperty(exports, "createWagmiConfig", { enumerable: true, get: function () { return createWagmiConfig_1.createWagmiConfig; } });
|
|
20
20
|
var useAccountAssets_1 = require("./useAccountAssets");
|
|
@@ -109,3 +109,5 @@ var useUnifiedChainSwitchAndExecute_1 = require("./useUnifiedChainSwitchAndExecu
|
|
|
109
109
|
Object.defineProperty(exports, "useUnifiedChainSwitchAndExecute", { enumerable: true, get: function () { return useUnifiedChainSwitchAndExecute_1.useUnifiedChainSwitchAndExecute; } });
|
|
110
110
|
var useURLParams_1 = require("./useURLParams");
|
|
111
111
|
Object.defineProperty(exports, "useURLParams", { enumerable: true, get: function () { return useURLParams_1.useURLParams; } });
|
|
112
|
+
var useUser_1 = require("./useUser");
|
|
113
|
+
Object.defineProperty(exports, "useUser", { enumerable: true, get: function () { return useUser_1.useUser; } });
|
|
@@ -17,7 +17,6 @@ const wallets_1 = require("thirdweb/wallets");
|
|
|
17
17
|
const in_app_1 = require("thirdweb/wallets/in-app");
|
|
18
18
|
const wagmi_1 = require("wagmi");
|
|
19
19
|
const LocalSDKProvider_1 = require("../components/B3Provider/LocalSDKProvider");
|
|
20
|
-
const useB3_1 = require("../components/B3Provider/useB3");
|
|
21
20
|
const createWagmiConfig_1 = require("../utils/createWagmiConfig");
|
|
22
21
|
const useSearchParamsSSR_1 = require("./useSearchParamsSSR");
|
|
23
22
|
const useUserQuery_1 = require("./useUserQuery");
|
|
@@ -45,7 +44,7 @@ function useAuth() {
|
|
|
45
44
|
const hasStartedConnecting = (0, react_1.useAuthStore)(state => state.hasStartedConnecting);
|
|
46
45
|
const useAutoConnectLoadingPrevious = (0, react_2.useRef)(false);
|
|
47
46
|
const referralCode = (0, useSearchParamsSSR_1.useSearchParam)("referralCode");
|
|
48
|
-
const { partnerId } = (0,
|
|
47
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
49
48
|
const wagmiConfig = (0, createWagmiConfig_1.createWagmiConfig)({ partnerId });
|
|
50
49
|
const { connect } = (0, wagmi_1.useConnect)();
|
|
51
50
|
const activeWagmiAccount = (0, wagmi_1.useAccount)();
|
|
@@ -8,7 +8,7 @@ const client_manager_1 = require("../../client-manager");
|
|
|
8
8
|
* Hook to access the current FeathersJS client and client management utilities
|
|
9
9
|
*/
|
|
10
10
|
function useClient() {
|
|
11
|
-
const { clientType } = (0, react_1.
|
|
11
|
+
const { clientType } = (0, react_1.useB3Config)();
|
|
12
12
|
const getCurrentClient = (0, react_2.useCallback)(() => {
|
|
13
13
|
return (0, client_manager_1.getClient)();
|
|
14
14
|
}, []);
|
|
@@ -11,7 +11,7 @@ const debug = (0, debug_1.debugB3React)("@@b3:useHandleConnectWithPrivy");
|
|
|
11
11
|
* Currently, this is for the basement-privy strategy
|
|
12
12
|
*/
|
|
13
13
|
function useHandleConnectWithPrivy(chain, onSuccess) {
|
|
14
|
-
const { partnerId } = (0, react_1.
|
|
14
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
15
15
|
if (!chain) {
|
|
16
16
|
throw new Error("Chain is required");
|
|
17
17
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useNotifications = useNotifications;
|
|
4
|
+
const react_1 = require("../../../global-account/react");
|
|
4
5
|
const auth_token_1 = require("../../../shared/utils/auth-token");
|
|
5
6
|
const debug_1 = require("../../../shared/utils/debug");
|
|
6
|
-
const
|
|
7
|
-
const components_1 = require("../components");
|
|
7
|
+
const react_2 = require("react");
|
|
8
8
|
const notificationsAPI_1 = require("../utils/notificationsAPI");
|
|
9
9
|
const useUserQuery_1 = require("./useUserQuery");
|
|
10
10
|
const debug = (0, debug_1.debugB3React)("useNotifications");
|
|
@@ -30,14 +30,14 @@ const debug = (0, debug_1.debugB3React)("useNotifications");
|
|
|
30
30
|
*/
|
|
31
31
|
function useNotifications() {
|
|
32
32
|
const { user } = (0, useUserQuery_1.useUserQuery)();
|
|
33
|
-
const { partnerId } = (0,
|
|
34
|
-
const [userData, setUserData] = (0,
|
|
35
|
-
const [loading, setLoading] = (0,
|
|
36
|
-
const [error, setError] = (0,
|
|
37
|
-
const [telegramStatus, setTelegramStatus] = (0,
|
|
33
|
+
const { partnerId } = (0, react_1.useB3Config)();
|
|
34
|
+
const [userData, setUserData] = (0, react_2.useState)(null);
|
|
35
|
+
const [loading, setLoading] = (0, react_2.useState)(true);
|
|
36
|
+
const [error, setError] = (0, react_2.useState)(null);
|
|
37
|
+
const [telegramStatus, setTelegramStatus] = (0, react_2.useState)("idle");
|
|
38
38
|
const userId = user?.userId;
|
|
39
39
|
const jwtToken = (0, auth_token_1.getAuthToken)();
|
|
40
|
-
const loadUserData = (0,
|
|
40
|
+
const loadUserData = (0, react_2.useCallback)(async () => {
|
|
41
41
|
if (!userId || !jwtToken) {
|
|
42
42
|
setLoading(false);
|
|
43
43
|
return;
|
|
@@ -66,10 +66,10 @@ function useNotifications() {
|
|
|
66
66
|
setLoading(false);
|
|
67
67
|
}
|
|
68
68
|
}, [userId, jwtToken]);
|
|
69
|
-
(0,
|
|
69
|
+
(0, react_2.useEffect)(() => {
|
|
70
70
|
loadUserData();
|
|
71
71
|
}, [loadUserData]);
|
|
72
|
-
const createDefaultNotificationSettings = (0,
|
|
72
|
+
const createDefaultNotificationSettings = (0, react_2.useCallback)(async () => {
|
|
73
73
|
if (!userId || !jwtToken)
|
|
74
74
|
return;
|
|
75
75
|
try {
|
|
@@ -80,7 +80,7 @@ function useNotifications() {
|
|
|
80
80
|
debug("Error creating default notification settings:", err);
|
|
81
81
|
}
|
|
82
82
|
}, [userId, jwtToken, partnerId]);
|
|
83
|
-
const connectEmail = (0,
|
|
83
|
+
const connectEmail = (0, react_2.useCallback)(async (email) => {
|
|
84
84
|
if (!userId || !jwtToken) {
|
|
85
85
|
throw new Error("User not authenticated");
|
|
86
86
|
}
|
|
@@ -94,7 +94,7 @@ function useNotifications() {
|
|
|
94
94
|
throw new Error("Failed to connect email");
|
|
95
95
|
}
|
|
96
96
|
}, [userId, jwtToken, loadUserData, createDefaultNotificationSettings]);
|
|
97
|
-
const connectTelegram = (0,
|
|
97
|
+
const connectTelegram = (0, react_2.useCallback)(async () => {
|
|
98
98
|
if (!userId || !jwtToken) {
|
|
99
99
|
throw new Error("User not authenticated");
|
|
100
100
|
}
|
|
@@ -138,7 +138,7 @@ function useNotifications() {
|
|
|
138
138
|
throw new Error("Failed to connect Telegram");
|
|
139
139
|
}
|
|
140
140
|
}, [userId, jwtToken, loadUserData, createDefaultNotificationSettings]);
|
|
141
|
-
const disconnectChannel = (0,
|
|
141
|
+
const disconnectChannel = (0, react_2.useCallback)(async (channelType) => {
|
|
142
142
|
if (!userId || !jwtToken) {
|
|
143
143
|
throw new Error("User not authenticated");
|
|
144
144
|
}
|
|
@@ -154,7 +154,7 @@ function useNotifications() {
|
|
|
154
154
|
throw new Error(`Failed to disconnect ${channelType}`);
|
|
155
155
|
}
|
|
156
156
|
}, [userId, jwtToken, loadUserData]);
|
|
157
|
-
const sendTestNotification = (0,
|
|
157
|
+
const sendTestNotification = (0, react_2.useCallback)(async () => {
|
|
158
158
|
if (!userId || !jwtToken) {
|
|
159
159
|
throw new Error("User not authenticated");
|
|
160
160
|
}
|
|
@@ -9,7 +9,7 @@ const thirdweb_insights_1 = require("../../../shared/utils/thirdweb-insights");
|
|
|
9
9
|
const react_query_1 = require("@tanstack/react-query");
|
|
10
10
|
const react_2 = require("react");
|
|
11
11
|
function useTokenBalance({ token, address }) {
|
|
12
|
-
const
|
|
12
|
+
const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
|
|
13
13
|
const account = (0, react_1.useAccountWallet)();
|
|
14
14
|
const effectiveAddress = address || account?.address;
|
|
15
15
|
const { data: tokenBalance, isLoading, isFetching, refetch, } = (0, react_query_1.useQuery)({
|
|
@@ -41,7 +41,7 @@ function useTokenBalance({ token, address }) {
|
|
|
41
41
|
}
|
|
42
42
|
return { formatted: "0", raw: null };
|
|
43
43
|
},
|
|
44
|
-
enabled:
|
|
44
|
+
enabled: isAuthenticated && !!effectiveAddress,
|
|
45
45
|
staleTime: 30000,
|
|
46
46
|
gcTime: 5 * 60 * 1000,
|
|
47
47
|
retry: 2,
|
|
@@ -49,12 +49,12 @@ function useTokenBalance({ token, address }) {
|
|
|
49
49
|
});
|
|
50
50
|
// Force a refetch when the wallet or token changes
|
|
51
51
|
(0, react_2.useEffect)(() => {
|
|
52
|
-
if (
|
|
52
|
+
if (isAuthenticated && effectiveAddress) {
|
|
53
53
|
refetch();
|
|
54
54
|
}
|
|
55
|
-
}, [
|
|
55
|
+
}, [isAuthenticated, effectiveAddress, token.address, token.chainId, token.symbol, refetch]);
|
|
56
56
|
// Determine if we're actually loading
|
|
57
|
-
const isActuallyLoading = !
|
|
57
|
+
const isActuallyLoading = !isAuthenticated || !effectiveAddress || isLoading || (isFetching && !tokenBalance);
|
|
58
58
|
return {
|
|
59
59
|
rawBalance: tokenBalance?.raw || BigInt(0),
|
|
60
60
|
formattedBalance: tokenBalance?.formatted || "0",
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preferred Hook to get the user data
|
|
3
|
+
*/
|
|
4
|
+
export declare function useUser(): {
|
|
5
|
+
user: {
|
|
6
|
+
email?: string | undefined;
|
|
7
|
+
username?: string | undefined;
|
|
8
|
+
telNumber?: string | undefined;
|
|
9
|
+
ens?: string | undefined;
|
|
10
|
+
avatar?: string | undefined;
|
|
11
|
+
preferences?: {} | undefined;
|
|
12
|
+
referredBy?: string | {} | undefined;
|
|
13
|
+
sourceApp?: string | undefined;
|
|
14
|
+
referralCode?: string | undefined;
|
|
15
|
+
userGroups?: number[] | undefined;
|
|
16
|
+
isMigratedFromBSMNT?: boolean | undefined;
|
|
17
|
+
privyLinkedAccounts?: {
|
|
18
|
+
name?: string | undefined;
|
|
19
|
+
address?: string | undefined;
|
|
20
|
+
email?: string | undefined;
|
|
21
|
+
chain_type?: string | undefined;
|
|
22
|
+
lv?: number | undefined;
|
|
23
|
+
wallet_client_type?: string | undefined;
|
|
24
|
+
smart_wallet_type?: string | undefined;
|
|
25
|
+
subject?: string | undefined;
|
|
26
|
+
type: string;
|
|
27
|
+
}[] | undefined;
|
|
28
|
+
twProfiles?: {
|
|
29
|
+
type: string;
|
|
30
|
+
details: {
|
|
31
|
+
id?: string | undefined;
|
|
32
|
+
name?: string | undefined;
|
|
33
|
+
address?: string | undefined;
|
|
34
|
+
email?: string | undefined;
|
|
35
|
+
username?: string | undefined;
|
|
36
|
+
phone?: string | undefined;
|
|
37
|
+
fid?: string | undefined;
|
|
38
|
+
};
|
|
39
|
+
}[] | undefined;
|
|
40
|
+
turnkeySubOrgs?: {
|
|
41
|
+
hasDelegatedUser?: boolean | undefined;
|
|
42
|
+
subOrgId: string;
|
|
43
|
+
accounts: Record<string, any>[];
|
|
44
|
+
}[] | undefined;
|
|
45
|
+
_id: string | {};
|
|
46
|
+
userId: string;
|
|
47
|
+
smartAccountAddress: string;
|
|
48
|
+
createdAt: number;
|
|
49
|
+
updatedAt: number;
|
|
50
|
+
partnerIds: {
|
|
51
|
+
privyId?: string | undefined;
|
|
52
|
+
thirdwebId?: string | undefined;
|
|
53
|
+
turnkeyId?: string | undefined;
|
|
54
|
+
turnkeyOtpId?: string | undefined;
|
|
55
|
+
};
|
|
56
|
+
} | null;
|
|
57
|
+
isConnecting: boolean;
|
|
58
|
+
isConnected: boolean;
|
|
59
|
+
isAuthenticating: boolean;
|
|
60
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useUser = useUser;
|
|
4
|
+
const react_1 = require("../../../global-account/react");
|
|
5
|
+
const userStore_1 = require("../stores/userStore");
|
|
6
|
+
/**
|
|
7
|
+
* Preferred Hook to get the user data
|
|
8
|
+
*/
|
|
9
|
+
function useUser() {
|
|
10
|
+
const user = (0, userStore_1.useUserStore)(state => state.user);
|
|
11
|
+
const isConnecting = (0, react_1.useAuthStore)(state => state.isConnecting);
|
|
12
|
+
const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
|
|
13
|
+
const isAuthenticating = (0, react_1.useAuthStore)(state => state.isAuthenticating);
|
|
14
|
+
return {
|
|
15
|
+
user,
|
|
16
|
+
isConnecting,
|
|
17
|
+
isConnected,
|
|
18
|
+
isAuthenticating,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -1,35 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useUserQuery = useUserQuery;
|
|
4
|
-
const debug_1 = require("../../../shared/utils/debug");
|
|
5
4
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
7
|
-
const middleware_1 = require("zustand/middleware");
|
|
8
|
-
const debug = (0, debug_1.debugB3React)("useUserQuery");
|
|
5
|
+
const userStore_1 = require("../stores/userStore");
|
|
9
6
|
const USER_QUERY_KEY = ["b3-user"];
|
|
10
|
-
/**
|
|
11
|
-
* Zustand store for managing user state
|
|
12
|
-
* Persists user data to localStorage
|
|
13
|
-
*/
|
|
14
|
-
const useUserStore = (0, zustand_1.create)()((0, middleware_1.persist)(set => ({
|
|
15
|
-
user: null,
|
|
16
|
-
setUser: (newUser) => {
|
|
17
|
-
const userToSave = newUser ?? null;
|
|
18
|
-
set({ user: userToSave });
|
|
19
|
-
debug("User updated", userToSave);
|
|
20
|
-
},
|
|
21
|
-
clearUser: () => {
|
|
22
|
-
set({ user: null });
|
|
23
|
-
debug("User cleared");
|
|
24
|
-
},
|
|
25
|
-
}), {
|
|
26
|
-
name: "b3-user",
|
|
27
|
-
onRehydrateStorage: () => (_, error) => {
|
|
28
|
-
if (error) {
|
|
29
|
-
console.warn("Failed to rehydrate user store:", error);
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
}));
|
|
33
7
|
/**
|
|
34
8
|
* NOTE: THIS IS ONLY MEANT FOR INTERNAL USE, from useOnConnect
|
|
35
9
|
*
|
|
@@ -37,9 +11,9 @@ const useUserStore = (0, zustand_1.create)()((0, middleware_1.persist)(set => ({
|
|
|
37
11
|
* This allows for invalidation and refetching of user data
|
|
38
12
|
*/
|
|
39
13
|
function useUserQuery() {
|
|
40
|
-
const user = useUserStore(state => state.user);
|
|
41
|
-
const setUserStore = useUserStore(state => state.setUser);
|
|
42
|
-
const clearUserStore = useUserStore(state => state.clearUser);
|
|
14
|
+
const user = (0, userStore_1.useUserStore)(state => state.user);
|
|
15
|
+
const setUserStore = (0, userStore_1.useUserStore)(state => state.setUser);
|
|
16
|
+
const clearUserStore = (0, userStore_1.useUserStore)(state => state.clearUser);
|
|
43
17
|
// Listen for storage events from other tabs/windows
|
|
44
18
|
(0, react_1.useEffect)(() => {
|
|
45
19
|
const handleStorageChange = (e) => {
|
|
@@ -51,14 +25,14 @@ function useUserQuery() {
|
|
|
51
25
|
const parsed = JSON.parse(stored);
|
|
52
26
|
// Zustand persist format: { state: { user: ... }, version: ... }
|
|
53
27
|
const userData = parsed?.state?.user ?? parsed?.user ?? null;
|
|
54
|
-
useUserStore.setState({ user: userData });
|
|
28
|
+
userStore_1.useUserStore.setState({ user: userData });
|
|
55
29
|
}
|
|
56
30
|
catch (error) {
|
|
57
31
|
console.warn("Failed to parse user from storage event:", error);
|
|
58
32
|
}
|
|
59
33
|
}
|
|
60
34
|
else {
|
|
61
|
-
useUserStore.setState({ user: null });
|
|
35
|
+
userStore_1.useUserStore.setState({ user: null });
|
|
62
36
|
}
|
|
63
37
|
}
|
|
64
38
|
};
|
|
@@ -81,16 +55,16 @@ function useUserQuery() {
|
|
|
81
55
|
const parsed = JSON.parse(stored);
|
|
82
56
|
// Zustand persist format: { state: { user: ... }, version: ... }
|
|
83
57
|
const userData = parsed?.state?.user ?? parsed?.user ?? null;
|
|
84
|
-
useUserStore.setState({ user: userData });
|
|
58
|
+
userStore_1.useUserStore.setState({ user: userData });
|
|
85
59
|
return userData ?? undefined;
|
|
86
60
|
}
|
|
87
61
|
catch (error) {
|
|
88
62
|
console.warn("Failed to refetch user from localStorage:", error);
|
|
89
63
|
// Fallback to current store state
|
|
90
|
-
return useUserStore.getState().user ?? undefined;
|
|
64
|
+
return userStore_1.useUserStore.getState().user ?? undefined;
|
|
91
65
|
}
|
|
92
66
|
}
|
|
93
|
-
useUserStore.setState({ user: null });
|
|
67
|
+
userStore_1.useUserStore.setState({ user: null });
|
|
94
68
|
return undefined;
|
|
95
69
|
};
|
|
96
70
|
// Helper function to clear user
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export { B3Provider } from "./components/B3Provider/B3Provider.native";
|
|
2
|
-
export { B3Context, type B3ContextType } from "./components/B3Provider/types";
|
|
3
|
-
export { useB3 } from "./components/B3Provider/useB3";
|
|
4
2
|
export { useAccountWallet } from "./hooks/useAccountWallet";
|
|
5
3
|
export { useAuthentication } from "./hooks/useAuthentication";
|
|
6
4
|
export { useProfile } from "./hooks/useProfile";
|
|
@@ -3,14 +3,10 @@
|
|
|
3
3
|
// export * from "./hooks";
|
|
4
4
|
// export * from "./stores";
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useAuthStore = exports.useSiwe = exports.useProfile = exports.useAuthentication = exports.useAccountWallet = exports.
|
|
6
|
+
exports.useAuthStore = exports.useSiwe = exports.useProfile = exports.useAuthentication = exports.useAccountWallet = exports.B3Provider = void 0;
|
|
7
7
|
// We only export the components and hooks that are needed for the native app
|
|
8
8
|
var B3Provider_native_1 = require("./components/B3Provider/B3Provider.native");
|
|
9
9
|
Object.defineProperty(exports, "B3Provider", { enumerable: true, get: function () { return B3Provider_native_1.B3Provider; } });
|
|
10
|
-
var types_1 = require("./components/B3Provider/types");
|
|
11
|
-
Object.defineProperty(exports, "B3Context", { enumerable: true, get: function () { return types_1.B3Context; } });
|
|
12
|
-
var useB3_1 = require("./components/B3Provider/useB3");
|
|
13
|
-
Object.defineProperty(exports, "useB3", { enumerable: true, get: function () { return useB3_1.useB3; } });
|
|
14
10
|
var useAccountWallet_1 = require("./hooks/useAccountWallet");
|
|
15
11
|
Object.defineProperty(exports, "useAccountWallet", { enumerable: true, get: function () { return useAccountWallet_1.useAccountWallet; } });
|
|
16
12
|
var useAuthentication_1 = require("./hooks/useAuthentication");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CreateOnrampOrderParams } from "../../../anyspend/react/hooks/useAnyspendCreateOnrampOrder";
|
|
2
|
+
import { CreateOrderParams } from "../../../anyspend/react/hooks/useAnyspendCreateOrder";
|
|
3
|
+
import { PermissionsConfig } from "../../../global-account/types/permissions";
|
|
4
|
+
import { Account } from "thirdweb/wallets";
|
|
5
|
+
import { ClientType } from "../../client-manager";
|
|
6
|
+
interface ConfigStore {
|
|
7
|
+
accountOverride?: Account;
|
|
8
|
+
automaticallySetFirstEoa: boolean;
|
|
9
|
+
environment: "development" | "production";
|
|
10
|
+
defaultPermissions: PermissionsConfig;
|
|
11
|
+
theme: "light" | "dark";
|
|
12
|
+
clientType: ClientType;
|
|
13
|
+
partnerId: string;
|
|
14
|
+
stripePublishableKey?: string;
|
|
15
|
+
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
16
|
+
enableTurnkey: boolean;
|
|
17
|
+
setConfig: (config: Partial<Omit<ConfigStore, "setConfig">>) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Zustand store for B3 configuration
|
|
21
|
+
* NOT persisted - these are developer-set configuration values
|
|
22
|
+
*/
|
|
23
|
+
export declare const useB3ConfigStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ConfigStore>>;
|
|
24
|
+
export {};
|