@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.
@@ -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.3.0</title>
18
+ <title>EmbarkAI Secure Wallet - iframe version 0.3.2</title>
19
19
 
20
20
  <!-- Styles will be injected by build process -->
21
21
  <style>
@@ -4410,7 +4410,7 @@ var SigningManager = class extends TokenRefreshApiClient {
4410
4410
  };
4411
4411
 
4412
4412
  // src/iframe/main.ts
4413
- var IFRAME_VERSION = "0.3.0";
4413
+ var IFRAME_VERSION = "0.3.2";
4414
4414
  var IframeWallet = class {
4415
4415
  constructor() {
4416
4416
  console.log("=".repeat(60));
package/dist/index.cjs CHANGED
@@ -15573,7 +15573,7 @@ var init_package = __esm({
15573
15573
  "package.json"() {
15574
15574
  package_default = {
15575
15575
  name: "@embarkai/ui-kit",
15576
- version: "0.3.0",
15576
+ version: "0.3.2",
15577
15577
  description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
15578
15578
  type: "module",
15579
15579
  main: "./dist/index.cjs",
@@ -16430,6 +16430,7 @@ function WalletConnectHandler() {
16430
16430
  [qc, passportWalletAddress, setProviderType, setPage, setIsWalletLinking]
16431
16431
  );
16432
16432
  const [hasStartedLinking, setHasStartedLinking] = import_react63.default.useState(false);
16433
+ const [modalWasOpened, setModalWasOpened] = import_react63.default.useState(false);
16433
16434
  (0, import_react63.useEffect)(() => {
16434
16435
  if (isWalletLinking && !hasStartedLinking) {
16435
16436
  console.log("[WalletConnectHandler] Starting wallet link flow:", {
@@ -16439,19 +16440,8 @@ function WalletConnectHandler() {
16439
16440
  });
16440
16441
  setHasStartedLinking(true);
16441
16442
  setProviderType(null);
16442
- if (isConnected) {
16443
- disconnect();
16444
- setTimeout(() => {
16445
- setPage(null);
16446
- if (openConnectModal) {
16447
- openConnectModal();
16448
- } else {
16449
- console.error("[WalletConnectHandler] openConnectModal is undefined!");
16450
- setIsWalletLinking(false);
16451
- setHasStartedLinking(false);
16452
- }
16453
- }, 500);
16454
- } else {
16443
+ disconnect();
16444
+ setTimeout(() => {
16455
16445
  setPage(null);
16456
16446
  if (openConnectModal) {
16457
16447
  openConnectModal();
@@ -16460,10 +16450,11 @@ function WalletConnectHandler() {
16460
16450
  setIsWalletLinking(false);
16461
16451
  setHasStartedLinking(false);
16462
16452
  }
16463
- }
16453
+ }, 500);
16464
16454
  }
16465
16455
  if (!isWalletLinking && hasStartedLinking) {
16466
16456
  setHasStartedLinking(false);
16457
+ setModalWasOpened(false);
16467
16458
  const shouldKeepConnected = walletMode === "direct" || walletMode === "both";
16468
16459
  if (isConnected && !shouldKeepConnected) disconnect();
16469
16460
  }
@@ -16478,12 +16469,18 @@ function WalletConnectHandler() {
16478
16469
  walletMode
16479
16470
  ]);
16480
16471
  (0, import_react63.useEffect)(() => {
16481
- if (hasStartedLinking && !connectModalOpen && !isConnected && isWalletLinking) {
16472
+ if (connectModalOpen && hasStartedLinking) {
16473
+ setModalWasOpened(true);
16474
+ }
16475
+ }, [connectModalOpen, hasStartedLinking]);
16476
+ (0, import_react63.useEffect)(() => {
16477
+ if (modalWasOpened && !connectModalOpen && !isConnected && isWalletLinking) {
16482
16478
  console.log("[WalletConnectHandler] Modal closed without connecting");
16483
16479
  onLinkingComplete(false);
16484
16480
  setHasStartedLinking(false);
16481
+ setModalWasOpened(false);
16485
16482
  }
16486
- }, [connectModalOpen, hasStartedLinking, isConnected, isWalletLinking]);
16483
+ }, [connectModalOpen, modalWasOpened, isConnected, isWalletLinking]);
16487
16484
  (0, import_react63.useEffect)(() => {
16488
16485
  if (isWalletLinking) {
16489
16486
  const timeout = setTimeout(() => {
@@ -16491,6 +16488,13 @@ function WalletConnectHandler() {
16491
16488
  disconnect();
16492
16489
  setIsWalletLinking(false);
16493
16490
  setHasStartedLinking(false);
16491
+ if (passportWalletAddress) {
16492
+ setManageWalletLinkError("Wallet connection timed out. Please try again.");
16493
+ setPage("manage-wallet" /* MANAGE_WALLET */);
16494
+ } else {
16495
+ setAuthError({ title: "Connection timed out", message: "Wallet did not respond. Please try again." });
16496
+ setPage("auth" /* AUTH */);
16497
+ }
16494
16498
  }, 12e4);
16495
16499
  return () => clearTimeout(timeout);
16496
16500
  }