@embarkai/ui-kit 0.3.0 → 0.3.2
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 +21 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15499,7 +15499,7 @@ var init_package = __esm({
|
|
|
15499
15499
|
"package.json"() {
|
|
15500
15500
|
package_default = {
|
|
15501
15501
|
name: "@embarkai/ui-kit",
|
|
15502
|
-
version: "0.3.
|
|
15502
|
+
version: "0.3.2",
|
|
15503
15503
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
15504
15504
|
type: "module",
|
|
15505
15505
|
main: "./dist/index.cjs",
|
|
@@ -16357,6 +16357,7 @@ function WalletConnectHandler() {
|
|
|
16357
16357
|
[qc, passportWalletAddress, setProviderType, setPage, setIsWalletLinking]
|
|
16358
16358
|
);
|
|
16359
16359
|
const [hasStartedLinking, setHasStartedLinking] = React8.useState(false);
|
|
16360
|
+
const [modalWasOpened, setModalWasOpened] = React8.useState(false);
|
|
16360
16361
|
useEffect36(() => {
|
|
16361
16362
|
if (isWalletLinking && !hasStartedLinking) {
|
|
16362
16363
|
console.log("[WalletConnectHandler] Starting wallet link flow:", {
|
|
@@ -16366,19 +16367,8 @@ function WalletConnectHandler() {
|
|
|
16366
16367
|
});
|
|
16367
16368
|
setHasStartedLinking(true);
|
|
16368
16369
|
setProviderType(null);
|
|
16369
|
-
|
|
16370
|
-
|
|
16371
|
-
setTimeout(() => {
|
|
16372
|
-
setPage(null);
|
|
16373
|
-
if (openConnectModal) {
|
|
16374
|
-
openConnectModal();
|
|
16375
|
-
} else {
|
|
16376
|
-
console.error("[WalletConnectHandler] openConnectModal is undefined!");
|
|
16377
|
-
setIsWalletLinking(false);
|
|
16378
|
-
setHasStartedLinking(false);
|
|
16379
|
-
}
|
|
16380
|
-
}, 500);
|
|
16381
|
-
} else {
|
|
16370
|
+
disconnect();
|
|
16371
|
+
setTimeout(() => {
|
|
16382
16372
|
setPage(null);
|
|
16383
16373
|
if (openConnectModal) {
|
|
16384
16374
|
openConnectModal();
|
|
@@ -16387,10 +16377,11 @@ function WalletConnectHandler() {
|
|
|
16387
16377
|
setIsWalletLinking(false);
|
|
16388
16378
|
setHasStartedLinking(false);
|
|
16389
16379
|
}
|
|
16390
|
-
}
|
|
16380
|
+
}, 500);
|
|
16391
16381
|
}
|
|
16392
16382
|
if (!isWalletLinking && hasStartedLinking) {
|
|
16393
16383
|
setHasStartedLinking(false);
|
|
16384
|
+
setModalWasOpened(false);
|
|
16394
16385
|
const shouldKeepConnected = walletMode === "direct" || walletMode === "both";
|
|
16395
16386
|
if (isConnected && !shouldKeepConnected) disconnect();
|
|
16396
16387
|
}
|
|
@@ -16405,12 +16396,18 @@ function WalletConnectHandler() {
|
|
|
16405
16396
|
walletMode
|
|
16406
16397
|
]);
|
|
16407
16398
|
useEffect36(() => {
|
|
16408
|
-
if (
|
|
16399
|
+
if (connectModalOpen && hasStartedLinking) {
|
|
16400
|
+
setModalWasOpened(true);
|
|
16401
|
+
}
|
|
16402
|
+
}, [connectModalOpen, hasStartedLinking]);
|
|
16403
|
+
useEffect36(() => {
|
|
16404
|
+
if (modalWasOpened && !connectModalOpen && !isConnected && isWalletLinking) {
|
|
16409
16405
|
console.log("[WalletConnectHandler] Modal closed without connecting");
|
|
16410
16406
|
onLinkingComplete(false);
|
|
16411
16407
|
setHasStartedLinking(false);
|
|
16408
|
+
setModalWasOpened(false);
|
|
16412
16409
|
}
|
|
16413
|
-
}, [connectModalOpen,
|
|
16410
|
+
}, [connectModalOpen, modalWasOpened, isConnected, isWalletLinking]);
|
|
16414
16411
|
useEffect36(() => {
|
|
16415
16412
|
if (isWalletLinking) {
|
|
16416
16413
|
const timeout = setTimeout(() => {
|
|
@@ -16418,6 +16415,13 @@ function WalletConnectHandler() {
|
|
|
16418
16415
|
disconnect();
|
|
16419
16416
|
setIsWalletLinking(false);
|
|
16420
16417
|
setHasStartedLinking(false);
|
|
16418
|
+
if (passportWalletAddress) {
|
|
16419
|
+
setManageWalletLinkError("Wallet connection timed out. Please try again.");
|
|
16420
|
+
setPage("manage-wallet" /* MANAGE_WALLET */);
|
|
16421
|
+
} else {
|
|
16422
|
+
setAuthError({ title: "Connection timed out", message: "Wallet did not respond. Please try again." });
|
|
16423
|
+
setPage("auth" /* AUTH */);
|
|
16424
|
+
}
|
|
16421
16425
|
}, 12e4);
|
|
16422
16426
|
return () => clearTimeout(timeout);
|
|
16423
16427
|
}
|