@embarkai/ui-kit 0.4.109 → 0.4.111
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/iframe/index.html +1 -1
- package/dist/iframe/main.js +1 -1
- package/dist/index.cjs +81 -82
- package/dist/index.js +71 -66
- package/package.json +1 -1
package/dist/iframe/index.html
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<meta http-equiv="X-Content-Type-Options" content="nosniff" />
|
|
16
16
|
<meta http-equiv="Referrer-Policy" content="strict-origin-when-cross-origin" />
|
|
17
17
|
|
|
18
|
-
<title>EmbarkAI Secure Wallet - iframe version 0.4.
|
|
18
|
+
<title>EmbarkAI Secure Wallet - iframe version 0.4.111</title>
|
|
19
19
|
|
|
20
20
|
<!-- Styles will be injected by build process -->
|
|
21
21
|
<style>
|
package/dist/iframe/main.js
CHANGED
|
@@ -6342,7 +6342,7 @@ var SigningManager = class extends TokenRefreshApiClient {
|
|
|
6342
6342
|
};
|
|
6343
6343
|
|
|
6344
6344
|
// src/iframe/main.ts
|
|
6345
|
-
var IFRAME_VERSION = "0.4.
|
|
6345
|
+
var IFRAME_VERSION = "0.4.111";
|
|
6346
6346
|
var IframeWallet = class {
|
|
6347
6347
|
// private finchpay: FinchPayRampAPI
|
|
6348
6348
|
// private rampnow: RampnowOnrampAPI
|
package/dist/index.cjs
CHANGED
|
@@ -17635,14 +17635,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17635
17635
|
} finally {
|
|
17636
17636
|
setIsPreparingConnect(false);
|
|
17637
17637
|
}
|
|
17638
|
-
|
|
17639
|
-
case (connector.id === "metaMaskSDK" && !hasInjectedWallet2):
|
|
17640
|
-
closeEmbarkAI();
|
|
17641
|
-
break;
|
|
17642
|
-
default:
|
|
17643
|
-
useLayoutStore.getState().setIsDialogForced(true);
|
|
17644
|
-
break;
|
|
17645
|
-
}
|
|
17638
|
+
useLayoutStore.getState().setIsDialogForced(true);
|
|
17646
17639
|
try {
|
|
17647
17640
|
await connect({ connector });
|
|
17648
17641
|
} catch {
|
|
@@ -17724,66 +17717,73 @@ function useExternalWalletConnnect(options) {
|
|
|
17724
17717
|
const walletMode = config.current?.wallet?.mode;
|
|
17725
17718
|
const wagmiConfig3 = (0, import_wagmi4.useConfig)();
|
|
17726
17719
|
const connectors = (0, import_wagmi4.useConnectors)();
|
|
17727
|
-
const
|
|
17728
|
-
const { mutate: connect, ...restUseConnect } = (0, import_wagmi4.useConnect)(
|
|
17729
|
-
|
|
17730
|
-
|
|
17731
|
-
|
|
17732
|
-
|
|
17733
|
-
|
|
17734
|
-
|
|
17735
|
-
chainId,
|
|
17736
|
-
connectorName: connector.name || "Unknown Wallet"
|
|
17737
|
-
});
|
|
17738
|
-
onSuccess?.({ connected: true, address: signingWalletAddress });
|
|
17739
|
-
useLayoutStore.getState().setIsDialogForced(false);
|
|
17740
|
-
},
|
|
17741
|
-
onError: async (error, { connector }) => {
|
|
17742
|
-
await dropFailedConnectorSession(error, connector, wagmiConfig3);
|
|
17743
|
-
onError?.({
|
|
17744
|
-
connected: false,
|
|
17745
|
-
connector: connector?.name || "Unknown Wallet",
|
|
17746
|
-
error
|
|
17747
|
-
});
|
|
17748
|
-
useLayoutStore.getState().setIsDialogForced(false);
|
|
17749
|
-
}
|
|
17750
|
-
}
|
|
17751
|
-
});
|
|
17752
|
-
const disconnectExternalWallet = (0, import_react47.useCallback)(() => {
|
|
17753
|
-
try {
|
|
17754
|
-
disconnect();
|
|
17755
|
-
} catch {
|
|
17756
|
-
return;
|
|
17757
|
-
}
|
|
17758
|
-
useExternalWalletStore.getState().clearExternalWallet();
|
|
17759
|
-
}, [disconnect]);
|
|
17720
|
+
const connections = (0, import_wagmi4.useConnections)();
|
|
17721
|
+
const { mutate: connect, mutateAsync: connectAsync, ...restUseConnect } = (0, import_wagmi4.useConnect)();
|
|
17722
|
+
const { mutateAsync: disconnectAsync } = (0, import_wagmi4.useDisconnect)();
|
|
17723
|
+
const disconnectExternalWallet = (0, import_react47.useCallback)(async () => {
|
|
17724
|
+
await disconnectAsync();
|
|
17725
|
+
const { externalAddress, clearExternalWallet } = useExternalWalletStore.getState();
|
|
17726
|
+
if (!!externalAddress) clearExternalWallet();
|
|
17727
|
+
}, [disconnectAsync]);
|
|
17760
17728
|
const connectExternalWallet = (0, import_react47.useCallback)(
|
|
17761
17729
|
async (walletConnectorType) => {
|
|
17762
|
-
disconnectExternalWallet();
|
|
17763
17730
|
const connector = connectors.find((c) => c.id === walletConnectorType);
|
|
17764
17731
|
if (!connector) {
|
|
17765
|
-
console.
|
|
17732
|
+
console.warn("[useExternalWalletConnect] Connector not found for:", walletConnectorType);
|
|
17766
17733
|
return;
|
|
17767
17734
|
}
|
|
17735
|
+
const existingConnection = connections.find((c) => c.connector.uid === connector.uid);
|
|
17736
|
+
if (!!existingConnection?.connector) {
|
|
17737
|
+
console.warn("[useExternalWalletConnect] Disconnecting existing connection");
|
|
17738
|
+
await disconnectExternalWallet();
|
|
17739
|
+
}
|
|
17768
17740
|
useLayoutStore.getState().setIsDialogForced(true);
|
|
17769
17741
|
try {
|
|
17770
|
-
|
|
17771
|
-
|
|
17742
|
+
connect(
|
|
17743
|
+
{ connector },
|
|
17744
|
+
{
|
|
17745
|
+
onSuccess: (connectionData, { connector: connector2 }) => {
|
|
17746
|
+
const { chainId, accounts } = connectionData;
|
|
17747
|
+
const signingWalletAddress = accounts[0];
|
|
17748
|
+
useExternalWalletStore.getState().setExternalWallet({
|
|
17749
|
+
address: signingWalletAddress,
|
|
17750
|
+
chainId,
|
|
17751
|
+
connectorName: connector2.name || "Unknown Wallet"
|
|
17752
|
+
});
|
|
17753
|
+
onSuccess?.({ connected: true, address: signingWalletAddress });
|
|
17754
|
+
setTimeout(() => useLayoutStore.getState().setIsDialogForced(false), 100);
|
|
17755
|
+
},
|
|
17756
|
+
onError: async (error, { connector: connector2 }) => {
|
|
17757
|
+
await dropFailedConnectorSession(error, connector2, wagmiConfig3);
|
|
17758
|
+
onError?.({
|
|
17759
|
+
connected: false,
|
|
17760
|
+
connector: connector2?.name || "Unknown Wallet",
|
|
17761
|
+
error
|
|
17762
|
+
});
|
|
17763
|
+
setTimeout(() => useLayoutStore.getState().setIsDialogForced(false), 100);
|
|
17764
|
+
}
|
|
17765
|
+
}
|
|
17766
|
+
);
|
|
17767
|
+
} catch (connectionError) {
|
|
17768
|
+
console.warn("[useExternalWalletConnect] Error:", connectionError);
|
|
17769
|
+
return;
|
|
17772
17770
|
}
|
|
17773
17771
|
},
|
|
17774
|
-
[connectors]
|
|
17772
|
+
[connections, connectors, onSuccess, onError]
|
|
17775
17773
|
);
|
|
17776
17774
|
return {
|
|
17777
17775
|
isAvailable: walletMode === "direct" || walletMode === "both",
|
|
17778
17776
|
mutate: connectExternalWallet,
|
|
17777
|
+
mutateAsync: connectExternalWallet,
|
|
17779
17778
|
disconnect: disconnectExternalWallet,
|
|
17780
|
-
...restUseConnect
|
|
17779
|
+
...(0, import_lodash_es13.omit)(restUseConnect, ["mutate", "mutateAsync"])
|
|
17781
17780
|
};
|
|
17782
17781
|
}
|
|
17783
|
-
var import_react47, import_wagmi4;
|
|
17782
|
+
var import_lodash_es13, import_react47, import_wagmi4;
|
|
17784
17783
|
var init_useExternalWalletConnect = __esm({
|
|
17785
17784
|
"src/internal/components/ConnectExternalWalletMenu/useExternalWalletConnect.ts"() {
|
|
17786
17785
|
init_ProviderContext();
|
|
17786
|
+
import_lodash_es13 = require("lodash-es");
|
|
17787
17787
|
import_react47 = require("react");
|
|
17788
17788
|
import_wagmi4 = require("wagmi");
|
|
17789
17789
|
init_useLayoutStore();
|
|
@@ -22848,7 +22848,7 @@ function useNicknameAvailability(currentNickname) {
|
|
|
22848
22848
|
useNicknameStore.getState().setError(error?.message || "Failed to check nickname availability");
|
|
22849
22849
|
}
|
|
22850
22850
|
});
|
|
22851
|
-
const debouncedCheckAvailability = (0, import_react68.useCallback)((0,
|
|
22851
|
+
const debouncedCheckAvailability = (0, import_react68.useCallback)((0, import_lodash_es14.debounce)(checkAvailability, DEBOUNCE_MS), [checkAvailability]);
|
|
22852
22852
|
(0, import_react68.useEffect)(() => {
|
|
22853
22853
|
if (!currentNickname) return;
|
|
22854
22854
|
const normalizedInputValue = normalizeNickname(nicknameValue);
|
|
@@ -22863,12 +22863,12 @@ function useNicknameAvailability(currentNickname) {
|
|
|
22863
22863
|
}, [nicknameValue, currentNickname, debouncedCheckAvailability]);
|
|
22864
22864
|
return { isCheckingAvailability };
|
|
22865
22865
|
}
|
|
22866
|
-
var import_react_query39,
|
|
22866
|
+
var import_react_query39, import_lodash_es14, import_react68, DEBOUNCE_MS;
|
|
22867
22867
|
var init_useNicknameAvailability = __esm({
|
|
22868
22868
|
"src/internal/components/NicknameMenu/useNicknameAvailability.ts"() {
|
|
22869
22869
|
init_i18n();
|
|
22870
22870
|
import_react_query39 = require("@tanstack/react-query");
|
|
22871
|
-
|
|
22871
|
+
import_lodash_es14 = require("lodash-es");
|
|
22872
22872
|
import_react68 = require("react");
|
|
22873
22873
|
init_nickname();
|
|
22874
22874
|
init_nickname_errors();
|
|
@@ -24659,7 +24659,7 @@ var init_UserPolicies2 = __esm({
|
|
|
24659
24659
|
function useSecurityMenuParams() {
|
|
24660
24660
|
(0, import_react76.useEffect)(() => {
|
|
24661
24661
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
24662
|
-
if (!pageParams || !(0,
|
|
24662
|
+
if (!pageParams || !(0, import_lodash_es15.keys)(pageParams).length) return;
|
|
24663
24663
|
const { submenu } = pageParams;
|
|
24664
24664
|
setTimeout(() => {
|
|
24665
24665
|
switch (submenu) {
|
|
@@ -24681,10 +24681,10 @@ function useSecurityMenuParams() {
|
|
|
24681
24681
|
setPageParams(null);
|
|
24682
24682
|
}, []);
|
|
24683
24683
|
}
|
|
24684
|
-
var
|
|
24684
|
+
var import_lodash_es15, import_react76;
|
|
24685
24685
|
var init_useSecurityMenuParams = __esm({
|
|
24686
24686
|
"src/internal/components/SecurityMenu/useSecurityMenuParams.ts"() {
|
|
24687
|
-
|
|
24687
|
+
import_lodash_es15 = require("lodash-es");
|
|
24688
24688
|
import_react76 = require("react");
|
|
24689
24689
|
init_useLayoutDataStore();
|
|
24690
24690
|
init_UserPolicies2();
|
|
@@ -28475,7 +28475,7 @@ function useSendMenuParams() {
|
|
|
28475
28475
|
const { config } = useProviderConfig();
|
|
28476
28476
|
(0, import_react94.useEffect)(() => {
|
|
28477
28477
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
28478
|
-
if (!pageParams || !(0,
|
|
28478
|
+
if (!pageParams || !(0, import_lodash_es16.keys)(pageParams).length) return;
|
|
28479
28479
|
const { sendFlow, send, bridge } = pageParams || {};
|
|
28480
28480
|
if (sendFlow === "bridge" && !config?.current?.features?.showAssetBridge) {
|
|
28481
28481
|
setPageParams(null);
|
|
@@ -28526,11 +28526,11 @@ function useSendMenuParams() {
|
|
|
28526
28526
|
setPageParams(null);
|
|
28527
28527
|
}, []);
|
|
28528
28528
|
}
|
|
28529
|
-
var
|
|
28529
|
+
var import_lodash_es16, import_react94;
|
|
28530
28530
|
var init_useSendMenuParams = __esm({
|
|
28531
28531
|
"src/internal/components/SendMenu/useSendMenuParams.ts"() {
|
|
28532
28532
|
init_ProviderContext();
|
|
28533
|
-
|
|
28533
|
+
import_lodash_es16 = require("lodash-es");
|
|
28534
28534
|
import_react94 = require("react");
|
|
28535
28535
|
init_useLayoutDataStore();
|
|
28536
28536
|
init_useBridgeStore();
|
|
@@ -30042,7 +30042,7 @@ var init_package = __esm({
|
|
|
30042
30042
|
"package.json"() {
|
|
30043
30043
|
package_default = {
|
|
30044
30044
|
name: "@embarkai/ui-kit",
|
|
30045
|
-
version: "0.4.
|
|
30045
|
+
version: "0.4.111",
|
|
30046
30046
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
30047
30047
|
type: "module",
|
|
30048
30048
|
main: "./dist/index.cjs",
|
|
@@ -30527,17 +30527,17 @@ function useDecideContentStyles() {
|
|
|
30527
30527
|
return {
|
|
30528
30528
|
isClosing,
|
|
30529
30529
|
isMobileView,
|
|
30530
|
-
style: (0,
|
|
30530
|
+
style: (0, import_lodash_es17.merge)({}, mobileStyles)
|
|
30531
30531
|
};
|
|
30532
30532
|
}
|
|
30533
|
-
var DialogPrimitive,
|
|
30533
|
+
var DialogPrimitive, import_lodash_es17, import_lucide_react85, import_react101, import_jsx_runtime133, Dialog, DialogPortal, DialogOverlay, CONTENT_BG_SETUP, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
|
|
30534
30534
|
var init_dialog = __esm({
|
|
30535
30535
|
"src/internal/components/ui/dialog.tsx"() {
|
|
30536
30536
|
init_utils();
|
|
30537
30537
|
init_SessionContext();
|
|
30538
30538
|
init_i18n();
|
|
30539
30539
|
DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
30540
|
-
|
|
30540
|
+
import_lodash_es17 = require("lodash-es");
|
|
30541
30541
|
import_lucide_react85 = require("lucide-react");
|
|
30542
30542
|
import_react101 = require("react");
|
|
30543
30543
|
init_useLayoutDataStore();
|
|
@@ -30546,23 +30546,21 @@ var init_dialog = __esm({
|
|
|
30546
30546
|
import_jsx_runtime133 = require("react/jsx-runtime");
|
|
30547
30547
|
Dialog = DialogPrimitive.Root;
|
|
30548
30548
|
DialogPortal = DialogPrimitive.Portal;
|
|
30549
|
-
DialogOverlay = (0, import_react101.forwardRef)(
|
|
30550
|
-
|
|
30551
|
-
|
|
30552
|
-
|
|
30553
|
-
|
|
30554
|
-
|
|
30555
|
-
|
|
30556
|
-
|
|
30557
|
-
|
|
30558
|
-
|
|
30559
|
-
|
|
30560
|
-
|
|
30561
|
-
|
|
30562
|
-
|
|
30563
|
-
|
|
30564
|
-
);
|
|
30565
|
-
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
30549
|
+
DialogOverlay = (0, import_react101.forwardRef)(({ className, closing, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30550
|
+
"div",
|
|
30551
|
+
{
|
|
30552
|
+
ref,
|
|
30553
|
+
style: { backdropFilter: "blur(var(--ui-kit-backdrop-blur))" },
|
|
30554
|
+
className: cn2(
|
|
30555
|
+
"w-[100dvw] h-[100dvh]",
|
|
30556
|
+
"fixed inset-0 z-[9998] bg-[var(--ui-kit-overlay)]",
|
|
30557
|
+
closing ? "animate-dialog-out" : "animate-dialog-in",
|
|
30558
|
+
className
|
|
30559
|
+
),
|
|
30560
|
+
...props
|
|
30561
|
+
}
|
|
30562
|
+
));
|
|
30563
|
+
DialogOverlay.displayName = "DialogOverlay";
|
|
30566
30564
|
CONTENT_BG_SETUP = {
|
|
30567
30565
|
backgroundColor: "var(--ui-kit-bg)",
|
|
30568
30566
|
border: "1px solid var(--ui-kit-bd)",
|
|
@@ -30723,6 +30721,7 @@ function Dialog2() {
|
|
|
30723
30721
|
Dialog,
|
|
30724
30722
|
{
|
|
30725
30723
|
open: isDialogOpen,
|
|
30724
|
+
modal: false,
|
|
30726
30725
|
onOpenChange: (open) => {
|
|
30727
30726
|
if (isDialogForced) return;
|
|
30728
30727
|
if (!open) {
|
|
@@ -33392,7 +33391,7 @@ function Provider(props) {
|
|
|
33392
33391
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
33393
33392
|
const callbacksRef = (0, import_react107.useRef)(callbacks);
|
|
33394
33393
|
(0, import_react107.useEffect)(() => notifyNoProjetctId(projectId), [projectId]);
|
|
33395
|
-
const config = (0, import_react107.useRef)((0,
|
|
33394
|
+
const config = (0, import_react107.useRef)((0, import_lodash_es18.merge)({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
|
|
33396
33395
|
const wagmiConfig3 = (0, import_react107.useRef)((0, import_core9.getWagmiConfig)(config.current?.wallet?.walletConnectId || null));
|
|
33397
33396
|
const updateConfig = (0, import_react107.useCallback)((updates) => {
|
|
33398
33397
|
const prev = config.current;
|
|
@@ -33435,7 +33434,7 @@ function Provider(props) {
|
|
|
33435
33434
|
}, []);
|
|
33436
33435
|
(0, import_react107.useEffect)(() => {
|
|
33437
33436
|
if (typeof window === "undefined" || !projectId) return;
|
|
33438
|
-
const mergedConfig = (0,
|
|
33437
|
+
const mergedConfig = (0, import_lodash_es18.merge)(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
33439
33438
|
updateConfig(mergedConfig);
|
|
33440
33439
|
if (mergedConfig.wallet?.enabled) {
|
|
33441
33440
|
clearLegacyWagmiStorage();
|
|
@@ -33495,12 +33494,12 @@ function Provider(props) {
|
|
|
33495
33494
|
);
|
|
33496
33495
|
return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_wagmi11.WagmiProvider, { config: wagmiConfig3.current, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(SessionProvider, { children }) }) });
|
|
33497
33496
|
}
|
|
33498
|
-
var import_core9, import_error_tracking4,
|
|
33497
|
+
var import_core9, import_error_tracking4, import_lodash_es18, import_react107, import_wagmi11, import_jsx_runtime137, UIContext, useProviderConfig;
|
|
33499
33498
|
var init_ProviderContext = __esm({
|
|
33500
33499
|
"src/context/ProviderContext.tsx"() {
|
|
33501
33500
|
import_core9 = require("@embarkai/core");
|
|
33502
33501
|
import_error_tracking4 = require("@embarkai/core/internal/error-tracking");
|
|
33503
|
-
|
|
33502
|
+
import_lodash_es18 = require("lodash-es");
|
|
33504
33503
|
import_react107 = require("react");
|
|
33505
33504
|
import_wagmi11 = require("wagmi");
|
|
33506
33505
|
init_initial();
|
package/dist/index.js
CHANGED
|
@@ -17598,14 +17598,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17598
17598
|
} finally {
|
|
17599
17599
|
setIsPreparingConnect(false);
|
|
17600
17600
|
}
|
|
17601
|
-
|
|
17602
|
-
case (connector.id === "metaMaskSDK" && !hasInjectedWallet2):
|
|
17603
|
-
closeEmbarkAI();
|
|
17604
|
-
break;
|
|
17605
|
-
default:
|
|
17606
|
-
useLayoutStore.getState().setIsDialogForced(true);
|
|
17607
|
-
break;
|
|
17608
|
-
}
|
|
17601
|
+
useLayoutStore.getState().setIsDialogForced(true);
|
|
17609
17602
|
try {
|
|
17610
17603
|
await connect({ connector });
|
|
17611
17604
|
} catch {
|
|
@@ -17675,68 +17668,81 @@ var init_ConnectExternalWalletMenu = __esm({
|
|
|
17675
17668
|
});
|
|
17676
17669
|
|
|
17677
17670
|
// src/internal/components/ConnectExternalWalletMenu/useExternalWalletConnect.ts
|
|
17671
|
+
import { omit as omit2 } from "lodash-es";
|
|
17678
17672
|
import { useCallback as useCallback18 } from "react";
|
|
17679
|
-
import {
|
|
17673
|
+
import {
|
|
17674
|
+
useConfig as useConfig2,
|
|
17675
|
+
useConnect as useConnect2,
|
|
17676
|
+
useConnections as useConnections3,
|
|
17677
|
+
useConnectors as useConnectors2,
|
|
17678
|
+
useDisconnect as useDisconnect3
|
|
17679
|
+
} from "wagmi";
|
|
17680
17680
|
function useExternalWalletConnnect(options) {
|
|
17681
17681
|
const { onSuccess, onError } = options || {};
|
|
17682
17682
|
const { config } = useProviderConfig();
|
|
17683
17683
|
const walletMode = config.current?.wallet?.mode;
|
|
17684
17684
|
const wagmiConfig3 = useConfig2();
|
|
17685
17685
|
const connectors = useConnectors2();
|
|
17686
|
-
const
|
|
17687
|
-
const { mutate: connect, ...restUseConnect } = useConnect2(
|
|
17688
|
-
|
|
17689
|
-
|
|
17690
|
-
|
|
17691
|
-
|
|
17692
|
-
|
|
17693
|
-
|
|
17694
|
-
chainId,
|
|
17695
|
-
connectorName: connector.name || "Unknown Wallet"
|
|
17696
|
-
});
|
|
17697
|
-
onSuccess?.({ connected: true, address: signingWalletAddress });
|
|
17698
|
-
useLayoutStore.getState().setIsDialogForced(false);
|
|
17699
|
-
},
|
|
17700
|
-
onError: async (error, { connector }) => {
|
|
17701
|
-
await dropFailedConnectorSession(error, connector, wagmiConfig3);
|
|
17702
|
-
onError?.({
|
|
17703
|
-
connected: false,
|
|
17704
|
-
connector: connector?.name || "Unknown Wallet",
|
|
17705
|
-
error
|
|
17706
|
-
});
|
|
17707
|
-
useLayoutStore.getState().setIsDialogForced(false);
|
|
17708
|
-
}
|
|
17709
|
-
}
|
|
17710
|
-
});
|
|
17711
|
-
const disconnectExternalWallet = useCallback18(() => {
|
|
17712
|
-
try {
|
|
17713
|
-
disconnect();
|
|
17714
|
-
} catch {
|
|
17715
|
-
return;
|
|
17716
|
-
}
|
|
17717
|
-
useExternalWalletStore.getState().clearExternalWallet();
|
|
17718
|
-
}, [disconnect]);
|
|
17686
|
+
const connections = useConnections3();
|
|
17687
|
+
const { mutate: connect, mutateAsync: connectAsync, ...restUseConnect } = useConnect2();
|
|
17688
|
+
const { mutateAsync: disconnectAsync } = useDisconnect3();
|
|
17689
|
+
const disconnectExternalWallet = useCallback18(async () => {
|
|
17690
|
+
await disconnectAsync();
|
|
17691
|
+
const { externalAddress, clearExternalWallet } = useExternalWalletStore.getState();
|
|
17692
|
+
if (!!externalAddress) clearExternalWallet();
|
|
17693
|
+
}, [disconnectAsync]);
|
|
17719
17694
|
const connectExternalWallet = useCallback18(
|
|
17720
17695
|
async (walletConnectorType) => {
|
|
17721
|
-
disconnectExternalWallet();
|
|
17722
17696
|
const connector = connectors.find((c) => c.id === walletConnectorType);
|
|
17723
17697
|
if (!connector) {
|
|
17724
|
-
console.
|
|
17698
|
+
console.warn("[useExternalWalletConnect] Connector not found for:", walletConnectorType);
|
|
17725
17699
|
return;
|
|
17726
17700
|
}
|
|
17701
|
+
const existingConnection = connections.find((c) => c.connector.uid === connector.uid);
|
|
17702
|
+
if (!!existingConnection?.connector) {
|
|
17703
|
+
console.warn("[useExternalWalletConnect] Disconnecting existing connection");
|
|
17704
|
+
await disconnectExternalWallet();
|
|
17705
|
+
}
|
|
17727
17706
|
useLayoutStore.getState().setIsDialogForced(true);
|
|
17728
17707
|
try {
|
|
17729
|
-
|
|
17730
|
-
|
|
17708
|
+
connect(
|
|
17709
|
+
{ connector },
|
|
17710
|
+
{
|
|
17711
|
+
onSuccess: (connectionData, { connector: connector2 }) => {
|
|
17712
|
+
const { chainId, accounts } = connectionData;
|
|
17713
|
+
const signingWalletAddress = accounts[0];
|
|
17714
|
+
useExternalWalletStore.getState().setExternalWallet({
|
|
17715
|
+
address: signingWalletAddress,
|
|
17716
|
+
chainId,
|
|
17717
|
+
connectorName: connector2.name || "Unknown Wallet"
|
|
17718
|
+
});
|
|
17719
|
+
onSuccess?.({ connected: true, address: signingWalletAddress });
|
|
17720
|
+
setTimeout(() => useLayoutStore.getState().setIsDialogForced(false), 100);
|
|
17721
|
+
},
|
|
17722
|
+
onError: async (error, { connector: connector2 }) => {
|
|
17723
|
+
await dropFailedConnectorSession(error, connector2, wagmiConfig3);
|
|
17724
|
+
onError?.({
|
|
17725
|
+
connected: false,
|
|
17726
|
+
connector: connector2?.name || "Unknown Wallet",
|
|
17727
|
+
error
|
|
17728
|
+
});
|
|
17729
|
+
setTimeout(() => useLayoutStore.getState().setIsDialogForced(false), 100);
|
|
17730
|
+
}
|
|
17731
|
+
}
|
|
17732
|
+
);
|
|
17733
|
+
} catch (connectionError) {
|
|
17734
|
+
console.warn("[useExternalWalletConnect] Error:", connectionError);
|
|
17735
|
+
return;
|
|
17731
17736
|
}
|
|
17732
17737
|
},
|
|
17733
|
-
[connectors]
|
|
17738
|
+
[connections, connectors, onSuccess, onError]
|
|
17734
17739
|
);
|
|
17735
17740
|
return {
|
|
17736
17741
|
isAvailable: walletMode === "direct" || walletMode === "both",
|
|
17737
17742
|
mutate: connectExternalWallet,
|
|
17743
|
+
mutateAsync: connectExternalWallet,
|
|
17738
17744
|
disconnect: disconnectExternalWallet,
|
|
17739
|
-
...restUseConnect
|
|
17745
|
+
...omit2(restUseConnect, ["mutate", "mutateAsync"])
|
|
17740
17746
|
};
|
|
17741
17747
|
}
|
|
17742
17748
|
var init_useExternalWalletConnect = __esm({
|
|
@@ -29943,7 +29949,7 @@ var init_package = __esm({
|
|
|
29943
29949
|
"package.json"() {
|
|
29944
29950
|
package_default = {
|
|
29945
29951
|
name: "@embarkai/ui-kit",
|
|
29946
|
-
version: "0.4.
|
|
29952
|
+
version: "0.4.111",
|
|
29947
29953
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
29948
29954
|
type: "module",
|
|
29949
29955
|
main: "./dist/index.cjs",
|
|
@@ -30446,23 +30452,21 @@ var init_dialog = __esm({
|
|
|
30446
30452
|
init_button();
|
|
30447
30453
|
Dialog = DialogPrimitive.Root;
|
|
30448
30454
|
DialogPortal = DialogPrimitive.Portal;
|
|
30449
|
-
DialogOverlay = forwardRef6(
|
|
30450
|
-
|
|
30451
|
-
|
|
30452
|
-
|
|
30453
|
-
|
|
30454
|
-
|
|
30455
|
-
|
|
30456
|
-
|
|
30457
|
-
|
|
30458
|
-
|
|
30459
|
-
|
|
30460
|
-
|
|
30461
|
-
|
|
30462
|
-
|
|
30463
|
-
|
|
30464
|
-
);
|
|
30465
|
-
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
30455
|
+
DialogOverlay = forwardRef6(({ className, closing, ...props }, ref) => /* @__PURE__ */ jsx133(
|
|
30456
|
+
"div",
|
|
30457
|
+
{
|
|
30458
|
+
ref,
|
|
30459
|
+
style: { backdropFilter: "blur(var(--ui-kit-backdrop-blur))" },
|
|
30460
|
+
className: cn2(
|
|
30461
|
+
"w-[100dvw] h-[100dvh]",
|
|
30462
|
+
"fixed inset-0 z-[9998] bg-[var(--ui-kit-overlay)]",
|
|
30463
|
+
closing ? "animate-dialog-out" : "animate-dialog-in",
|
|
30464
|
+
className
|
|
30465
|
+
),
|
|
30466
|
+
...props
|
|
30467
|
+
}
|
|
30468
|
+
));
|
|
30469
|
+
DialogOverlay.displayName = "DialogOverlay";
|
|
30466
30470
|
CONTENT_BG_SETUP = {
|
|
30467
30471
|
backgroundColor: "var(--ui-kit-bg)",
|
|
30468
30472
|
border: "1px solid var(--ui-kit-bd)",
|
|
@@ -30626,6 +30630,7 @@ function Dialog2() {
|
|
|
30626
30630
|
Dialog,
|
|
30627
30631
|
{
|
|
30628
30632
|
open: isDialogOpen,
|
|
30633
|
+
modal: false,
|
|
30629
30634
|
onOpenChange: (open) => {
|
|
30630
30635
|
if (isDialogForced) return;
|
|
30631
30636
|
if (!open) {
|