@embarkai/ui-kit 0.3.2 → 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 +31 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -17
- 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);
|
|
@@ -16431,6 +16432,7 @@ function WalletConnectHandler() {
|
|
|
16431
16432
|
);
|
|
16432
16433
|
const [hasStartedLinking, setHasStartedLinking] = import_react63.default.useState(false);
|
|
16433
16434
|
const [modalWasOpened, setModalWasOpened] = import_react63.default.useState(false);
|
|
16435
|
+
const [pendingModalOpen, setPendingModalOpen] = import_react63.default.useState(false);
|
|
16434
16436
|
(0, import_react63.useEffect)(() => {
|
|
16435
16437
|
if (isWalletLinking && !hasStartedLinking) {
|
|
16436
16438
|
console.log("[WalletConnectHandler] Starting wallet link flow:", {
|
|
@@ -16440,21 +16442,22 @@ function WalletConnectHandler() {
|
|
|
16440
16442
|
});
|
|
16441
16443
|
setHasStartedLinking(true);
|
|
16442
16444
|
setProviderType(null);
|
|
16443
|
-
|
|
16444
|
-
|
|
16445
|
-
|
|
16446
|
-
|
|
16447
|
-
|
|
16448
|
-
|
|
16449
|
-
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
}
|
|
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
|
+
}
|
|
16454
16456
|
}
|
|
16455
16457
|
if (!isWalletLinking && hasStartedLinking) {
|
|
16456
16458
|
setHasStartedLinking(false);
|
|
16457
16459
|
setModalWasOpened(false);
|
|
16460
|
+
setPendingModalOpen(false);
|
|
16458
16461
|
const shouldKeepConnected = walletMode === "direct" || walletMode === "both";
|
|
16459
16462
|
if (isConnected && !shouldKeepConnected) disconnect();
|
|
16460
16463
|
}
|
|
@@ -16468,6 +16471,12 @@ function WalletConnectHandler() {
|
|
|
16468
16471
|
setProviderType,
|
|
16469
16472
|
walletMode
|
|
16470
16473
|
]);
|
|
16474
|
+
(0, import_react63.useEffect)(() => {
|
|
16475
|
+
if (pendingModalOpen && !isConnected && openConnectModal) {
|
|
16476
|
+
setPendingModalOpen(false);
|
|
16477
|
+
openConnectModal();
|
|
16478
|
+
}
|
|
16479
|
+
}, [pendingModalOpen, isConnected, openConnectModal]);
|
|
16471
16480
|
(0, import_react63.useEffect)(() => {
|
|
16472
16481
|
if (connectModalOpen && hasStartedLinking) {
|
|
16473
16482
|
setModalWasOpened(true);
|
|
@@ -16495,7 +16504,7 @@ function WalletConnectHandler() {
|
|
|
16495
16504
|
setAuthError({ title: "Connection timed out", message: "Wallet did not respond. Please try again." });
|
|
16496
16505
|
setPage("auth" /* AUTH */);
|
|
16497
16506
|
}
|
|
16498
|
-
},
|
|
16507
|
+
}, 3e5);
|
|
16499
16508
|
return () => clearTimeout(timeout);
|
|
16500
16509
|
}
|
|
16501
16510
|
}, [isWalletLinking, setIsWalletLinking, disconnect]);
|
|
@@ -16522,7 +16531,7 @@ function WalletConnectHandler() {
|
|
|
16522
16531
|
const signature = await Promise.race([
|
|
16523
16532
|
signMessageAsync({ message, account: signingWalletAddress }),
|
|
16524
16533
|
new Promise(
|
|
16525
|
-
(_, 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)
|
|
16526
16535
|
)
|
|
16527
16536
|
]);
|
|
16528
16537
|
if (!signature) {
|
|
@@ -16577,6 +16586,7 @@ function WalletConnectHandler() {
|
|
|
16577
16586
|
onLinkingComplete(false);
|
|
16578
16587
|
setHasStartedLinking(false);
|
|
16579
16588
|
setLinkIsLoading(false);
|
|
16589
|
+
setAuthStep("signin");
|
|
16580
16590
|
const errorMsg = err?.message || (isAuthFlow ? "Wallet login failed" : "Failed to link wallet");
|
|
16581
16591
|
if (errorMsg.includes("User rejected") || errorMsg.includes("User denied")) {
|
|
16582
16592
|
if (passportWalletAddress) {
|
|
@@ -16601,11 +16611,15 @@ function WalletConnectHandler() {
|
|
|
16601
16611
|
}
|
|
16602
16612
|
});
|
|
16603
16613
|
(0, import_react63.useEffect)(() => {
|
|
16604
|
-
if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking) {
|
|
16614
|
+
if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking && modalWasOpened && !pendingModalOpen) {
|
|
16605
16615
|
console.log("[WalletConnectHandler] handleWalletSign triggered");
|
|
16616
|
+
if (!passportWalletAddress) {
|
|
16617
|
+
setPage("auth" /* AUTH */);
|
|
16618
|
+
setAuthStep("loading");
|
|
16619
|
+
}
|
|
16606
16620
|
handleWalletSign({ chainId: chain.id, signingWalletAddress: walletAddress });
|
|
16607
16621
|
}
|
|
16608
|
-
}, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking]);
|
|
16622
|
+
}, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking, modalWasOpened, pendingModalOpen]);
|
|
16609
16623
|
(0, import_react63.useEffect)(() => {
|
|
16610
16624
|
if (isConnected && !chain?.id && isWalletLinking && hasStartedLinking && !connectModalOpen && !isWalletSigning) {
|
|
16611
16625
|
const timeout = setTimeout(() => {
|
|
@@ -19536,7 +19550,7 @@ function Provider(props) {
|
|
|
19536
19550
|
[config, updateConfig, callbacks, updateCallbacks]
|
|
19537
19551
|
);
|
|
19538
19552
|
if (!!initialConfig?.wallet?.enabled)
|
|
19539
|
-
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 }) }) });
|
|
19540
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 }) }) });
|
|
19541
19555
|
}
|
|
19542
19556
|
var import_error_tracking4, import_lodash_es6, import_react67, import_jsx_runtime96, UIContext, useProviderConfig;
|