@embarkai/ui-kit 0.4.107 → 0.4.109
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 +37 -16
- package/dist/index.js +38 -17
- 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.109</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.109";
|
|
6346
6346
|
var IframeWallet = class {
|
|
6347
6347
|
// private finchpay: FinchPayRampAPI
|
|
6348
6348
|
// private rampnow: RampnowOnrampAPI
|
package/dist/index.cjs
CHANGED
|
@@ -15709,6 +15709,33 @@ var init_wallets = __esm({
|
|
|
15709
15709
|
}
|
|
15710
15710
|
});
|
|
15711
15711
|
|
|
15712
|
+
// src/internal/lib/connect-errors.ts
|
|
15713
|
+
function someInErrorChain(error, predicate) {
|
|
15714
|
+
let current = error;
|
|
15715
|
+
for (let depth = 0; current && depth < 10; depth++) {
|
|
15716
|
+
if (predicate(current)) return true;
|
|
15717
|
+
current = current.cause;
|
|
15718
|
+
}
|
|
15719
|
+
return false;
|
|
15720
|
+
}
|
|
15721
|
+
async function dropFailedConnectorSession(error, connector, wagmiConfig3) {
|
|
15722
|
+
if (connector.type !== "walletConnect") return;
|
|
15723
|
+
if (isRequestPendingError(error) || isUserRejectedError(error)) return;
|
|
15724
|
+
if (wagmiConfig3.state.connections.has(connector.uid)) return;
|
|
15725
|
+
await connector.disconnect().catch(() => {
|
|
15726
|
+
});
|
|
15727
|
+
}
|
|
15728
|
+
var REQUEST_PENDING_ERROR_CODE, USER_REJECTED_ERROR_CODE, isRequestPendingError, isUserRejectedError, isUnsupportedChainError;
|
|
15729
|
+
var init_connect_errors = __esm({
|
|
15730
|
+
"src/internal/lib/connect-errors.ts"() {
|
|
15731
|
+
REQUEST_PENDING_ERROR_CODE = -32002;
|
|
15732
|
+
USER_REJECTED_ERROR_CODE = 4001;
|
|
15733
|
+
isRequestPendingError = (error) => someInErrorChain(error, (e) => e.code === REQUEST_PENDING_ERROR_CODE);
|
|
15734
|
+
isUserRejectedError = (error) => someInErrorChain(error, (e) => e.code === USER_REJECTED_ERROR_CODE);
|
|
15735
|
+
isUnsupportedChainError = (error) => someInErrorChain(error, (e) => typeof e.message === "string" && e.message.includes("supportedNetworks"));
|
|
15736
|
+
}
|
|
15737
|
+
});
|
|
15738
|
+
|
|
15712
15739
|
// src/internal/auth/providers/types.ts
|
|
15713
15740
|
function getTssUrl3() {
|
|
15714
15741
|
return getServiceUrls().tssUrl;
|
|
@@ -17329,14 +17356,6 @@ function getConnectFlowType(params) {
|
|
|
17329
17356
|
if (!isEmbarkAI) return "auth";
|
|
17330
17357
|
return connectFlow;
|
|
17331
17358
|
}
|
|
17332
|
-
function someInErrorChain(error, predicate) {
|
|
17333
|
-
let current = error;
|
|
17334
|
-
for (let depth = 0; current && depth < 10; depth++) {
|
|
17335
|
-
if (predicate(current)) return true;
|
|
17336
|
-
current = current.cause;
|
|
17337
|
-
}
|
|
17338
|
-
return false;
|
|
17339
|
-
}
|
|
17340
17359
|
function ConnectExternalWalletMenu() {
|
|
17341
17360
|
const { config, callbacksRef } = useProviderConfig();
|
|
17342
17361
|
const allowedWallets = config.current?.wallet?.allowedWallets;
|
|
@@ -17501,7 +17520,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17501
17520
|
onError: (error, { connector }) => reportConnectError(error, connector)
|
|
17502
17521
|
}
|
|
17503
17522
|
});
|
|
17504
|
-
function reportConnectError(error, connector) {
|
|
17523
|
+
async function reportConnectError(error, connector) {
|
|
17505
17524
|
const connectFlowType = getConnectFlowType({
|
|
17506
17525
|
isEmbarkAI: !!embarkAiAddress,
|
|
17507
17526
|
connectFlow: menuParams.current?.connectFlowType || "auth"
|
|
@@ -17532,6 +17551,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17532
17551
|
}
|
|
17533
17552
|
useLayoutStore.getState().setIsDialogForced(false);
|
|
17534
17553
|
}, 100);
|
|
17554
|
+
await dropFailedConnectorSession(error, connector, wagmiConfig3);
|
|
17535
17555
|
}
|
|
17536
17556
|
const visibleConnectors = (0, import_react46.useMemo)(() => {
|
|
17537
17557
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -17610,7 +17630,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17610
17630
|
await disconnectAsync({ connector: connectedConnector });
|
|
17611
17631
|
}
|
|
17612
17632
|
} catch (error) {
|
|
17613
|
-
reportConnectError(error, connector);
|
|
17633
|
+
await reportConnectError(error, connector);
|
|
17614
17634
|
return;
|
|
17615
17635
|
} finally {
|
|
17616
17636
|
setIsPreparingConnect(false);
|
|
@@ -17666,7 +17686,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17666
17686
|
] })
|
|
17667
17687
|
] });
|
|
17668
17688
|
}
|
|
17669
|
-
var import_react_query25, import_lucide_react33, import_react46, import_wagmi3, import_chains, import_jsx_runtime74, SIGN_FALLBACK_CHAIN_ID
|
|
17689
|
+
var import_react_query25, import_lucide_react33, import_react46, import_wagmi3, import_chains, import_jsx_runtime74, SIGN_FALLBACK_CHAIN_ID;
|
|
17670
17690
|
var init_ConnectExternalWalletMenu = __esm({
|
|
17671
17691
|
"src/internal/components/ConnectExternalWalletMenu/ConnectExternalWalletMenu.tsx"() {
|
|
17672
17692
|
init_ProviderContext();
|
|
@@ -17674,6 +17694,7 @@ var init_ConnectExternalWalletMenu = __esm({
|
|
|
17674
17694
|
init_useOpenPage();
|
|
17675
17695
|
init_i18n();
|
|
17676
17696
|
init_wallets();
|
|
17697
|
+
init_connect_errors();
|
|
17677
17698
|
init_linkedProfiles();
|
|
17678
17699
|
import_react_query25 = require("@tanstack/react-query");
|
|
17679
17700
|
import_lucide_react33 = require("lucide-react");
|
|
@@ -17693,9 +17714,6 @@ var init_ConnectExternalWalletMenu = __esm({
|
|
|
17693
17714
|
init_useHasInjectedWallet();
|
|
17694
17715
|
import_jsx_runtime74 = require("react/jsx-runtime");
|
|
17695
17716
|
SIGN_FALLBACK_CHAIN_ID = import_chains.mainnet.id;
|
|
17696
|
-
REQUEST_PENDING_ERROR_CODE = -32002;
|
|
17697
|
-
isRequestPendingError = (error) => someInErrorChain(error, (e) => e.code === REQUEST_PENDING_ERROR_CODE);
|
|
17698
|
-
isUnsupportedChainError = (error) => someInErrorChain(error, (e) => typeof e.message === "string" && e.message.includes("supportedNetworks"));
|
|
17699
17717
|
}
|
|
17700
17718
|
});
|
|
17701
17719
|
|
|
@@ -17704,6 +17722,7 @@ function useExternalWalletConnnect(options) {
|
|
|
17704
17722
|
const { onSuccess, onError } = options || {};
|
|
17705
17723
|
const { config } = useProviderConfig();
|
|
17706
17724
|
const walletMode = config.current?.wallet?.mode;
|
|
17725
|
+
const wagmiConfig3 = (0, import_wagmi4.useConfig)();
|
|
17707
17726
|
const connectors = (0, import_wagmi4.useConnectors)();
|
|
17708
17727
|
const { mutate: disconnect } = (0, import_wagmi4.useDisconnect)();
|
|
17709
17728
|
const { mutate: connect, ...restUseConnect } = (0, import_wagmi4.useConnect)({
|
|
@@ -17719,7 +17738,8 @@ function useExternalWalletConnnect(options) {
|
|
|
17719
17738
|
onSuccess?.({ connected: true, address: signingWalletAddress });
|
|
17720
17739
|
useLayoutStore.getState().setIsDialogForced(false);
|
|
17721
17740
|
},
|
|
17722
|
-
onError: (error, { connector }) => {
|
|
17741
|
+
onError: async (error, { connector }) => {
|
|
17742
|
+
await dropFailedConnectorSession(error, connector, wagmiConfig3);
|
|
17723
17743
|
onError?.({
|
|
17724
17744
|
connected: false,
|
|
17725
17745
|
connector: connector?.name || "Unknown Wallet",
|
|
@@ -17767,6 +17787,7 @@ var init_useExternalWalletConnect = __esm({
|
|
|
17767
17787
|
import_react47 = require("react");
|
|
17768
17788
|
import_wagmi4 = require("wagmi");
|
|
17769
17789
|
init_useLayoutStore();
|
|
17790
|
+
init_connect_errors();
|
|
17770
17791
|
init_useExternalWalletStore();
|
|
17771
17792
|
}
|
|
17772
17793
|
});
|
|
@@ -30021,7 +30042,7 @@ var init_package = __esm({
|
|
|
30021
30042
|
"package.json"() {
|
|
30022
30043
|
package_default = {
|
|
30023
30044
|
name: "@embarkai/ui-kit",
|
|
30024
|
-
version: "0.4.
|
|
30045
|
+
version: "0.4.109",
|
|
30025
30046
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
30026
30047
|
type: "module",
|
|
30027
30048
|
main: "./dist/index.cjs",
|
package/dist/index.js
CHANGED
|
@@ -15667,6 +15667,33 @@ var init_wallets = __esm({
|
|
|
15667
15667
|
}
|
|
15668
15668
|
});
|
|
15669
15669
|
|
|
15670
|
+
// src/internal/lib/connect-errors.ts
|
|
15671
|
+
function someInErrorChain(error, predicate) {
|
|
15672
|
+
let current = error;
|
|
15673
|
+
for (let depth = 0; current && depth < 10; depth++) {
|
|
15674
|
+
if (predicate(current)) return true;
|
|
15675
|
+
current = current.cause;
|
|
15676
|
+
}
|
|
15677
|
+
return false;
|
|
15678
|
+
}
|
|
15679
|
+
async function dropFailedConnectorSession(error, connector, wagmiConfig3) {
|
|
15680
|
+
if (connector.type !== "walletConnect") return;
|
|
15681
|
+
if (isRequestPendingError(error) || isUserRejectedError(error)) return;
|
|
15682
|
+
if (wagmiConfig3.state.connections.has(connector.uid)) return;
|
|
15683
|
+
await connector.disconnect().catch(() => {
|
|
15684
|
+
});
|
|
15685
|
+
}
|
|
15686
|
+
var REQUEST_PENDING_ERROR_CODE, USER_REJECTED_ERROR_CODE, isRequestPendingError, isUserRejectedError, isUnsupportedChainError;
|
|
15687
|
+
var init_connect_errors = __esm({
|
|
15688
|
+
"src/internal/lib/connect-errors.ts"() {
|
|
15689
|
+
REQUEST_PENDING_ERROR_CODE = -32002;
|
|
15690
|
+
USER_REJECTED_ERROR_CODE = 4001;
|
|
15691
|
+
isRequestPendingError = (error) => someInErrorChain(error, (e) => e.code === REQUEST_PENDING_ERROR_CODE);
|
|
15692
|
+
isUserRejectedError = (error) => someInErrorChain(error, (e) => e.code === USER_REJECTED_ERROR_CODE);
|
|
15693
|
+
isUnsupportedChainError = (error) => someInErrorChain(error, (e) => typeof e.message === "string" && e.message.includes("supportedNetworks"));
|
|
15694
|
+
}
|
|
15695
|
+
});
|
|
15696
|
+
|
|
15670
15697
|
// src/internal/auth/providers/types.ts
|
|
15671
15698
|
import { Key as Key3, Mail as Mail3, Wallet2 as Wallet22 } from "lucide-react";
|
|
15672
15699
|
function getTssUrl3() {
|
|
@@ -17292,14 +17319,6 @@ function getConnectFlowType(params) {
|
|
|
17292
17319
|
if (!isEmbarkAI) return "auth";
|
|
17293
17320
|
return connectFlow;
|
|
17294
17321
|
}
|
|
17295
|
-
function someInErrorChain(error, predicate) {
|
|
17296
|
-
let current = error;
|
|
17297
|
-
for (let depth = 0; current && depth < 10; depth++) {
|
|
17298
|
-
if (predicate(current)) return true;
|
|
17299
|
-
current = current.cause;
|
|
17300
|
-
}
|
|
17301
|
-
return false;
|
|
17302
|
-
}
|
|
17303
17322
|
function ConnectExternalWalletMenu() {
|
|
17304
17323
|
const { config, callbacksRef } = useProviderConfig();
|
|
17305
17324
|
const allowedWallets = config.current?.wallet?.allowedWallets;
|
|
@@ -17464,7 +17483,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17464
17483
|
onError: (error, { connector }) => reportConnectError(error, connector)
|
|
17465
17484
|
}
|
|
17466
17485
|
});
|
|
17467
|
-
function reportConnectError(error, connector) {
|
|
17486
|
+
async function reportConnectError(error, connector) {
|
|
17468
17487
|
const connectFlowType = getConnectFlowType({
|
|
17469
17488
|
isEmbarkAI: !!embarkAiAddress,
|
|
17470
17489
|
connectFlow: menuParams.current?.connectFlowType || "auth"
|
|
@@ -17495,6 +17514,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17495
17514
|
}
|
|
17496
17515
|
useLayoutStore.getState().setIsDialogForced(false);
|
|
17497
17516
|
}, 100);
|
|
17517
|
+
await dropFailedConnectorSession(error, connector, wagmiConfig3);
|
|
17498
17518
|
}
|
|
17499
17519
|
const visibleConnectors = useMemo9(() => {
|
|
17500
17520
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -17573,7 +17593,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17573
17593
|
await disconnectAsync({ connector: connectedConnector });
|
|
17574
17594
|
}
|
|
17575
17595
|
} catch (error) {
|
|
17576
|
-
reportConnectError(error, connector);
|
|
17596
|
+
await reportConnectError(error, connector);
|
|
17577
17597
|
return;
|
|
17578
17598
|
} finally {
|
|
17579
17599
|
setIsPreparingConnect(false);
|
|
@@ -17629,7 +17649,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17629
17649
|
] })
|
|
17630
17650
|
] });
|
|
17631
17651
|
}
|
|
17632
|
-
var SIGN_FALLBACK_CHAIN_ID
|
|
17652
|
+
var SIGN_FALLBACK_CHAIN_ID;
|
|
17633
17653
|
var init_ConnectExternalWalletMenu = __esm({
|
|
17634
17654
|
"src/internal/components/ConnectExternalWalletMenu/ConnectExternalWalletMenu.tsx"() {
|
|
17635
17655
|
init_ProviderContext();
|
|
@@ -17637,6 +17657,7 @@ var init_ConnectExternalWalletMenu = __esm({
|
|
|
17637
17657
|
init_useOpenPage();
|
|
17638
17658
|
init_i18n();
|
|
17639
17659
|
init_wallets();
|
|
17660
|
+
init_connect_errors();
|
|
17640
17661
|
init_linkedProfiles();
|
|
17641
17662
|
init_common();
|
|
17642
17663
|
init_wallet();
|
|
@@ -17650,19 +17671,17 @@ var init_ConnectExternalWalletMenu = __esm({
|
|
|
17650
17671
|
init_useConnectExternalWalletMenuParams();
|
|
17651
17672
|
init_useHasInjectedWallet();
|
|
17652
17673
|
SIGN_FALLBACK_CHAIN_ID = mainnet.id;
|
|
17653
|
-
REQUEST_PENDING_ERROR_CODE = -32002;
|
|
17654
|
-
isRequestPendingError = (error) => someInErrorChain(error, (e) => e.code === REQUEST_PENDING_ERROR_CODE);
|
|
17655
|
-
isUnsupportedChainError = (error) => someInErrorChain(error, (e) => typeof e.message === "string" && e.message.includes("supportedNetworks"));
|
|
17656
17674
|
}
|
|
17657
17675
|
});
|
|
17658
17676
|
|
|
17659
17677
|
// src/internal/components/ConnectExternalWalletMenu/useExternalWalletConnect.ts
|
|
17660
17678
|
import { useCallback as useCallback18 } from "react";
|
|
17661
|
-
import { useConnect as useConnect2, useConnectors as useConnectors2, useDisconnect as useDisconnect3 } from "wagmi";
|
|
17679
|
+
import { useConfig as useConfig2, useConnect as useConnect2, useConnectors as useConnectors2, useDisconnect as useDisconnect3 } from "wagmi";
|
|
17662
17680
|
function useExternalWalletConnnect(options) {
|
|
17663
17681
|
const { onSuccess, onError } = options || {};
|
|
17664
17682
|
const { config } = useProviderConfig();
|
|
17665
17683
|
const walletMode = config.current?.wallet?.mode;
|
|
17684
|
+
const wagmiConfig3 = useConfig2();
|
|
17666
17685
|
const connectors = useConnectors2();
|
|
17667
17686
|
const { mutate: disconnect } = useDisconnect3();
|
|
17668
17687
|
const { mutate: connect, ...restUseConnect } = useConnect2({
|
|
@@ -17678,7 +17697,8 @@ function useExternalWalletConnnect(options) {
|
|
|
17678
17697
|
onSuccess?.({ connected: true, address: signingWalletAddress });
|
|
17679
17698
|
useLayoutStore.getState().setIsDialogForced(false);
|
|
17680
17699
|
},
|
|
17681
|
-
onError: (error, { connector }) => {
|
|
17700
|
+
onError: async (error, { connector }) => {
|
|
17701
|
+
await dropFailedConnectorSession(error, connector, wagmiConfig3);
|
|
17682
17702
|
onError?.({
|
|
17683
17703
|
connected: false,
|
|
17684
17704
|
connector: connector?.name || "Unknown Wallet",
|
|
@@ -17723,6 +17743,7 @@ var init_useExternalWalletConnect = __esm({
|
|
|
17723
17743
|
"src/internal/components/ConnectExternalWalletMenu/useExternalWalletConnect.ts"() {
|
|
17724
17744
|
init_ProviderContext();
|
|
17725
17745
|
init_useLayoutStore();
|
|
17746
|
+
init_connect_errors();
|
|
17726
17747
|
init_useExternalWalletStore();
|
|
17727
17748
|
}
|
|
17728
17749
|
});
|
|
@@ -29922,7 +29943,7 @@ var init_package = __esm({
|
|
|
29922
29943
|
"package.json"() {
|
|
29923
29944
|
package_default = {
|
|
29924
29945
|
name: "@embarkai/ui-kit",
|
|
29925
|
-
version: "0.4.
|
|
29946
|
+
version: "0.4.109",
|
|
29926
29947
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
29927
29948
|
type: "module",
|
|
29928
29949
|
main: "./dist/index.cjs",
|