@embarkai/ui-kit 0.3.1 → 0.3.3
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 +41 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -19
- package/dist/index.js.map +1 -1
- 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.3.
|
|
18
|
+
<title>EmbarkAI Secure Wallet - iframe version 0.3.3</title>
|
|
19
19
|
|
|
20
20
|
<!-- Styles will be injected by build process -->
|
|
21
21
|
<style>
|
package/dist/iframe/main.js
CHANGED
|
@@ -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.
|
|
4413
|
+
var IFRAME_VERSION = "0.3.3";
|
|
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.
|
|
15576
|
+
version: "0.3.3",
|
|
15577
15577
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
15578
15578
|
type: "module",
|
|
15579
15579
|
main: "./dist/index.cjs",
|
|
@@ -16392,6 +16392,7 @@ function WalletConnectHandler() {
|
|
|
16392
16392
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16393
16393
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
16394
16394
|
const setAuthError = useAuthStore((st) => st.setAlert);
|
|
16395
|
+
const setAuthStep = useAuthStore((st) => st.setStep);
|
|
16395
16396
|
const setManageWalletLinkError = useManageWalletStore((st) => st.setLinkError);
|
|
16396
16397
|
const setLinkIsLoading = useManageWalletStore((st) => st.setLinkIsLoading);
|
|
16397
16398
|
const setProviderType = useManageWalletStore((st) => st.setProviderType);
|
|
@@ -16430,6 +16431,8 @@ function WalletConnectHandler() {
|
|
|
16430
16431
|
[qc, passportWalletAddress, setProviderType, setPage, setIsWalletLinking]
|
|
16431
16432
|
);
|
|
16432
16433
|
const [hasStartedLinking, setHasStartedLinking] = import_react63.default.useState(false);
|
|
16434
|
+
const [modalWasOpened, setModalWasOpened] = import_react63.default.useState(false);
|
|
16435
|
+
const [pendingModalOpen, setPendingModalOpen] = import_react63.default.useState(false);
|
|
16433
16436
|
(0, import_react63.useEffect)(() => {
|
|
16434
16437
|
if (isWalletLinking && !hasStartedLinking) {
|
|
16435
16438
|
console.log("[WalletConnectHandler] Starting wallet link flow:", {
|
|
@@ -16439,20 +16442,22 @@ function WalletConnectHandler() {
|
|
|
16439
16442
|
});
|
|
16440
16443
|
setHasStartedLinking(true);
|
|
16441
16444
|
setProviderType(null);
|
|
16442
|
-
|
|
16443
|
-
|
|
16444
|
-
|
|
16445
|
-
|
|
16446
|
-
|
|
16447
|
-
|
|
16448
|
-
|
|
16449
|
-
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
}
|
|
16445
|
+
setPage(null);
|
|
16446
|
+
if (isConnected) {
|
|
16447
|
+
disconnect();
|
|
16448
|
+
setPendingModalOpen(true);
|
|
16449
|
+
} else if (openConnectModal) {
|
|
16450
|
+
openConnectModal();
|
|
16451
|
+
} else {
|
|
16452
|
+
console.error("[WalletConnectHandler] openConnectModal is undefined!");
|
|
16453
|
+
setIsWalletLinking(false);
|
|
16454
|
+
setHasStartedLinking(false);
|
|
16455
|
+
}
|
|
16453
16456
|
}
|
|
16454
16457
|
if (!isWalletLinking && hasStartedLinking) {
|
|
16455
16458
|
setHasStartedLinking(false);
|
|
16459
|
+
setModalWasOpened(false);
|
|
16460
|
+
setPendingModalOpen(false);
|
|
16456
16461
|
const shouldKeepConnected = walletMode === "direct" || walletMode === "both";
|
|
16457
16462
|
if (isConnected && !shouldKeepConnected) disconnect();
|
|
16458
16463
|
}
|
|
@@ -16467,12 +16472,24 @@ function WalletConnectHandler() {
|
|
|
16467
16472
|
walletMode
|
|
16468
16473
|
]);
|
|
16469
16474
|
(0, import_react63.useEffect)(() => {
|
|
16470
|
-
if (
|
|
16475
|
+
if (pendingModalOpen && !isConnected && openConnectModal) {
|
|
16476
|
+
setPendingModalOpen(false);
|
|
16477
|
+
openConnectModal();
|
|
16478
|
+
}
|
|
16479
|
+
}, [pendingModalOpen, isConnected, openConnectModal]);
|
|
16480
|
+
(0, import_react63.useEffect)(() => {
|
|
16481
|
+
if (connectModalOpen && hasStartedLinking) {
|
|
16482
|
+
setModalWasOpened(true);
|
|
16483
|
+
}
|
|
16484
|
+
}, [connectModalOpen, hasStartedLinking]);
|
|
16485
|
+
(0, import_react63.useEffect)(() => {
|
|
16486
|
+
if (modalWasOpened && !connectModalOpen && !isConnected && isWalletLinking) {
|
|
16471
16487
|
console.log("[WalletConnectHandler] Modal closed without connecting");
|
|
16472
16488
|
onLinkingComplete(false);
|
|
16473
16489
|
setHasStartedLinking(false);
|
|
16490
|
+
setModalWasOpened(false);
|
|
16474
16491
|
}
|
|
16475
|
-
}, [connectModalOpen,
|
|
16492
|
+
}, [connectModalOpen, modalWasOpened, isConnected, isWalletLinking]);
|
|
16476
16493
|
(0, import_react63.useEffect)(() => {
|
|
16477
16494
|
if (isWalletLinking) {
|
|
16478
16495
|
const timeout = setTimeout(() => {
|
|
@@ -16487,7 +16504,7 @@ function WalletConnectHandler() {
|
|
|
16487
16504
|
setAuthError({ title: "Connection timed out", message: "Wallet did not respond. Please try again." });
|
|
16488
16505
|
setPage("auth" /* AUTH */);
|
|
16489
16506
|
}
|
|
16490
|
-
},
|
|
16507
|
+
}, 3e5);
|
|
16491
16508
|
return () => clearTimeout(timeout);
|
|
16492
16509
|
}
|
|
16493
16510
|
}, [isWalletLinking, setIsWalletLinking, disconnect]);
|
|
@@ -16514,7 +16531,7 @@ function WalletConnectHandler() {
|
|
|
16514
16531
|
const signature = await Promise.race([
|
|
16515
16532
|
signMessageAsync({ message, account: signingWalletAddress }),
|
|
16516
16533
|
new Promise(
|
|
16517
|
-
(_, reject) => setTimeout(() => reject(new Error("Signature request timed out. Please try again.")),
|
|
16534
|
+
(_, reject) => setTimeout(() => reject(new Error("Signature request timed out. Please try again.")), 12e4)
|
|
16518
16535
|
)
|
|
16519
16536
|
]);
|
|
16520
16537
|
if (!signature) {
|
|
@@ -16569,6 +16586,7 @@ function WalletConnectHandler() {
|
|
|
16569
16586
|
onLinkingComplete(false);
|
|
16570
16587
|
setHasStartedLinking(false);
|
|
16571
16588
|
setLinkIsLoading(false);
|
|
16589
|
+
setAuthStep("signin");
|
|
16572
16590
|
const errorMsg = err?.message || (isAuthFlow ? "Wallet login failed" : "Failed to link wallet");
|
|
16573
16591
|
if (errorMsg.includes("User rejected") || errorMsg.includes("User denied")) {
|
|
16574
16592
|
if (passportWalletAddress) {
|
|
@@ -16593,11 +16611,15 @@ function WalletConnectHandler() {
|
|
|
16593
16611
|
}
|
|
16594
16612
|
});
|
|
16595
16613
|
(0, import_react63.useEffect)(() => {
|
|
16596
|
-
if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking) {
|
|
16614
|
+
if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking && modalWasOpened && !pendingModalOpen) {
|
|
16597
16615
|
console.log("[WalletConnectHandler] handleWalletSign triggered");
|
|
16616
|
+
if (!passportWalletAddress) {
|
|
16617
|
+
setPage("auth" /* AUTH */);
|
|
16618
|
+
setAuthStep("loading");
|
|
16619
|
+
}
|
|
16598
16620
|
handleWalletSign({ chainId: chain.id, signingWalletAddress: walletAddress });
|
|
16599
16621
|
}
|
|
16600
|
-
}, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking]);
|
|
16622
|
+
}, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking, modalWasOpened, pendingModalOpen]);
|
|
16601
16623
|
(0, import_react63.useEffect)(() => {
|
|
16602
16624
|
if (isConnected && !chain?.id && isWalletLinking && hasStartedLinking && !connectModalOpen && !isWalletSigning) {
|
|
16603
16625
|
const timeout = setTimeout(() => {
|
|
@@ -19528,7 +19550,7 @@ function Provider(props) {
|
|
|
19528
19550
|
[config, updateConfig, callbacks, updateCallbacks]
|
|
19529
19551
|
);
|
|
19530
19552
|
if (!!initialConfig?.wallet?.enabled)
|
|
19531
|
-
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
19553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(RainbowKitProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(SessionProvider, { children }) }) });
|
|
19532
19554
|
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(WagmiProvider2, { children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(SessionProvider, { children }) }) });
|
|
19533
19555
|
}
|
|
19534
19556
|
var import_error_tracking4, import_lodash_es6, import_react67, import_jsx_runtime96, UIContext, useProviderConfig;
|