@embarkai/ui-kit 0.2.5 → 0.2.6
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 +2 -7
- package/dist/iframe/main.js.map +1 -1
- package/dist/index.cjs +63 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +63 -62
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2719,12 +2719,12 @@ function useListenIframeAuthEvents() {
|
|
|
2719
2719
|
const setIsIframeReady = useSession((state) => state.setIsIframeReady);
|
|
2720
2720
|
const handleIframeMessage = (0, import_react6.useCallback)(
|
|
2721
2721
|
(event) => {
|
|
2722
|
-
if (event.data?.type === "
|
|
2722
|
+
if (event.data?.type === "IFRAME_MSG_IFRAME_READY") {
|
|
2723
2723
|
console.log("[ IFRAME MESSAGE CACTHED ] Iframe is ready");
|
|
2724
2724
|
setIsIframeReady(true);
|
|
2725
|
-
} else if (event.data?.type === "
|
|
2725
|
+
} else if (event.data?.type === "IFRAME_MSG_SHOW_IFRAME") {
|
|
2726
2726
|
console.log("[ IFRAME MESSAGE CACTHED ] Consent screen shown - hiding auth modal");
|
|
2727
|
-
} else if (event.data?.type === "
|
|
2727
|
+
} else if (event.data?.type === "IFRAME_MSG_HIDE_IFRAME") {
|
|
2728
2728
|
console.log("[ IFRAME MESSAGE CACTHED ] Consent screen hidden");
|
|
2729
2729
|
} else if (event.data?.type === "KEYSHARE_RECOVERY_NEEDED") {
|
|
2730
2730
|
console.log("[ IFRAME MESSAGE CACTHED] recovery neede");
|
|
@@ -10595,7 +10595,7 @@ function ProviderCard(props) {
|
|
|
10595
10595
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "w-full flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
|
|
10596
10596
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "w-12 h-12 flex items-center justify-center flex-none border border-[var(--ui-kit-bd)] rounded-full", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(IconComponent, { className: "w-5 h-5" }) }),
|
|
10597
10597
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex flex-col gap-1 flex-1", children: [
|
|
10598
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "block w-full text-[10px] font-medium", children: info.name }),
|
|
10598
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "block w-full text-[10px] font-medium", children: props.meta?.walletName || info.name }),
|
|
10599
10599
|
props.externalId && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
10600
10600
|
"span",
|
|
10601
10601
|
{
|
|
@@ -10681,19 +10681,19 @@ function ManageWalletMenu() {
|
|
|
10681
10681
|
if (name === "x") return "twitter";
|
|
10682
10682
|
return name;
|
|
10683
10683
|
};
|
|
10684
|
-
const usedProviders = (0, import_lodash_es4.fromPairs)(providers.map((p) => [normalizeProviderName(p.provider), true]));
|
|
10685
10684
|
const used = [];
|
|
10686
10685
|
const unused = [];
|
|
10687
|
-
POSSIBLE_PROVIDERS.forEach((provider
|
|
10686
|
+
POSSIBLE_PROVIDERS.forEach((provider) => {
|
|
10688
10687
|
if (!configuredProviders[provider]) return;
|
|
10689
10688
|
const Icon2 = PROVIDERS_META[provider].icon;
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10689
|
+
const matches = providers.filter((p) => normalizeProviderName(p.provider) === provider);
|
|
10690
|
+
matches.forEach((providerData, idx) => {
|
|
10691
|
+
used.push(
|
|
10692
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ProviderCard, { ...providerData }, `${provider}-${providerData.externalId || idx}`)
|
|
10693
|
+
);
|
|
10694
|
+
});
|
|
10695
|
+
const isMulti = MULTI_PROVIDERS.includes(provider);
|
|
10696
|
+
if (isMulti || matches.length === 0) {
|
|
10697
10697
|
unused.push(
|
|
10698
10698
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
10699
10699
|
Button,
|
|
@@ -10738,7 +10738,7 @@ function ManageWalletMenu() {
|
|
|
10738
10738
|
] })
|
|
10739
10739
|
]
|
|
10740
10740
|
},
|
|
10741
|
-
|
|
10741
|
+
`add-${provider}`
|
|
10742
10742
|
)
|
|
10743
10743
|
);
|
|
10744
10744
|
}
|
|
@@ -10800,7 +10800,7 @@ function ManageWalletMenu() {
|
|
|
10800
10800
|
}
|
|
10801
10801
|
);
|
|
10802
10802
|
}
|
|
10803
|
-
var import_lodash_es4, import_lucide_react33, import_react40, import_jsx_runtime56, POSSIBLE_PROVIDERS;
|
|
10803
|
+
var import_lodash_es4, import_lucide_react33, import_react40, import_jsx_runtime56, POSSIBLE_PROVIDERS, MULTI_PROVIDERS;
|
|
10804
10804
|
var init_ManageWallet = __esm({
|
|
10805
10805
|
"src/internal/components/ManageWalletMenu/ManageWallet.tsx"() {
|
|
10806
10806
|
init_useLayoutDataStore();
|
|
@@ -10832,6 +10832,7 @@ var init_ManageWallet = __esm({
|
|
|
10832
10832
|
"passkey",
|
|
10833
10833
|
"wallet"
|
|
10834
10834
|
];
|
|
10835
|
+
MULTI_PROVIDERS = ["email", "wallet"];
|
|
10835
10836
|
}
|
|
10836
10837
|
});
|
|
10837
10838
|
|
|
@@ -15544,7 +15545,7 @@ var init_package = __esm({
|
|
|
15544
15545
|
"package.json"() {
|
|
15545
15546
|
package_default = {
|
|
15546
15547
|
name: "@embarkai/ui-kit",
|
|
15547
|
-
version: "0.2.
|
|
15548
|
+
version: "0.2.6",
|
|
15548
15549
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
15549
15550
|
type: "module",
|
|
15550
15551
|
main: "./dist/index.cjs",
|
|
@@ -17882,7 +17883,7 @@ var init_iframe_manager = __esm({
|
|
|
17882
17883
|
const response = await this.sendMessage("SDK_AUTH", {
|
|
17883
17884
|
projectId: this.projectId
|
|
17884
17885
|
});
|
|
17885
|
-
if (response.type === "
|
|
17886
|
+
if (response.type === "IFRAME_MSG_SDK_AUTH_SUCCESS") {
|
|
17886
17887
|
this.channelToken = response.sessionToken;
|
|
17887
17888
|
} else {
|
|
17888
17889
|
throw new Error("SDK channel authentication failed");
|
|
@@ -17972,23 +17973,23 @@ var init_iframe_manager = __esm({
|
|
|
17972
17973
|
return;
|
|
17973
17974
|
}
|
|
17974
17975
|
const validIframeTypes = [
|
|
17975
|
-
"
|
|
17976
|
-
"
|
|
17977
|
-
"
|
|
17978
|
-
"
|
|
17979
|
-
"
|
|
17980
|
-
"
|
|
17981
|
-
"
|
|
17982
|
-
"
|
|
17983
|
-
"
|
|
17984
|
-
"
|
|
17985
|
-
"
|
|
17986
|
-
"
|
|
17987
|
-
"
|
|
17988
|
-
"
|
|
17989
|
-
"
|
|
17990
|
-
"
|
|
17991
|
-
"
|
|
17976
|
+
"IFRAME_MSG_IFRAME_READY",
|
|
17977
|
+
"IFRAME_MSG_WALLET_READY",
|
|
17978
|
+
"IFRAME_MSG_SHOW_IFRAME",
|
|
17979
|
+
"IFRAME_MSG_HIDE_IFRAME",
|
|
17980
|
+
"IFRAME_MSG_SDK_AUTH_SUCCESS",
|
|
17981
|
+
"IFRAME_MSG_AUTH_SUCCESS",
|
|
17982
|
+
"IFRAME_MSG_DKG_SUCCESS",
|
|
17983
|
+
"IFRAME_MSG_SIGNATURE",
|
|
17984
|
+
"IFRAME_MSG_ADDRESS",
|
|
17985
|
+
"IFRAME_MSG_KEYSHARE_STATUS",
|
|
17986
|
+
"IFRAME_MSG_TRUSTED_APPS_LIST",
|
|
17987
|
+
"IFRAME_MSG_TRUSTED_APP_REMOVED",
|
|
17988
|
+
"IFRAME_MSG_REQUEST_NEW_TOKEN",
|
|
17989
|
+
"IFRAME_MSG_TOKEN_REFRESHED",
|
|
17990
|
+
"IFRAME_MSG_HEARTBEAT_RESPONSE",
|
|
17991
|
+
"IFRAME_MSG_RESPONSE",
|
|
17992
|
+
"IFRAME_MSG_ERROR"
|
|
17992
17993
|
];
|
|
17993
17994
|
if (!validIframeTypes.includes(message.type) && !message.messageId) {
|
|
17994
17995
|
return;
|
|
@@ -18001,31 +18002,31 @@ var init_iframe_manager = __esm({
|
|
|
18001
18002
|
});
|
|
18002
18003
|
return;
|
|
18003
18004
|
}
|
|
18004
|
-
if (message.type === "
|
|
18005
|
-
this.log("[IframeManager] \u{1F4E8} Received
|
|
18005
|
+
if (message.type === "IFRAME_MSG_IFRAME_READY") {
|
|
18006
|
+
this.log("[IframeManager] \u{1F4E8} Received IFRAME_MSG_IFRAME_READY");
|
|
18006
18007
|
this.isReady = true;
|
|
18007
18008
|
this.readyResolve();
|
|
18008
18009
|
return;
|
|
18009
18010
|
}
|
|
18010
|
-
if (message.type === "
|
|
18011
|
-
this.log("[IframeManager] \u{1F4E8} Received
|
|
18011
|
+
if (message.type === "IFRAME_MSG_WALLET_READY") {
|
|
18012
|
+
this.log("[IframeManager] \u{1F4E8} Received IFRAME_MSG_WALLET_READY", message.data);
|
|
18012
18013
|
if (this.onWalletReadyCallback) {
|
|
18013
18014
|
this.onWalletReadyCallback(message.data);
|
|
18014
18015
|
}
|
|
18015
18016
|
return;
|
|
18016
18017
|
}
|
|
18017
|
-
if (message.type === "
|
|
18018
|
-
this.log("[IframeManager] \u{1F4E8} Received
|
|
18018
|
+
if (message.type === "IFRAME_MSG_SHOW_IFRAME") {
|
|
18019
|
+
this.log("[IframeManager] \u{1F4E8} Received IFRAME_MSG_SHOW_IFRAME");
|
|
18019
18020
|
this.showIframe();
|
|
18020
18021
|
return;
|
|
18021
18022
|
}
|
|
18022
|
-
if (message.type === "
|
|
18023
|
-
this.log("[IframeManager] \u{1F4E8} Received
|
|
18023
|
+
if (message.type === "IFRAME_MSG_HIDE_IFRAME") {
|
|
18024
|
+
this.log("[IframeManager] \u{1F4E8} Received IFRAME_MSG_HIDE_IFRAME");
|
|
18024
18025
|
this.hideIframe();
|
|
18025
18026
|
return;
|
|
18026
18027
|
}
|
|
18027
|
-
if (message.type === "
|
|
18028
|
-
this.log("[IframeManager] \u{1F4E8} Received
|
|
18028
|
+
if (message.type === "IFRAME_MSG_REQUEST_NEW_TOKEN") {
|
|
18029
|
+
this.log("[IframeManager] \u{1F4E8} Received IFRAME_MSG_REQUEST_NEW_TOKEN");
|
|
18029
18030
|
this.handleTokenRefreshRequest(message).catch((error) => {
|
|
18030
18031
|
this.log("[IframeManager] \u274C Token refresh error:", error);
|
|
18031
18032
|
});
|
|
@@ -18035,7 +18036,7 @@ var init_iframe_manager = __esm({
|
|
|
18035
18036
|
const pending = this.pendingRequests.get(message.messageId);
|
|
18036
18037
|
if (pending) {
|
|
18037
18038
|
this.pendingRequests.delete(message.messageId);
|
|
18038
|
-
if (message.type === "
|
|
18039
|
+
if (message.type === "IFRAME_MSG_ERROR") {
|
|
18039
18040
|
const passportError = createAccountAbstractionError({
|
|
18040
18041
|
message: message.error || "Unknown error",
|
|
18041
18042
|
code: message.code
|
|
@@ -18060,7 +18061,7 @@ var init_iframe_manager = __esm({
|
|
|
18060
18061
|
const iframeOrigin = new URL(this.iframeUrl).origin;
|
|
18061
18062
|
this.iframe.contentWindow.postMessage(
|
|
18062
18063
|
{
|
|
18063
|
-
type: "
|
|
18064
|
+
type: "IFRAME_MSG_TOKEN_REFRESHED",
|
|
18064
18065
|
messageId: message.messageId,
|
|
18065
18066
|
accessToken: newAccessToken,
|
|
18066
18067
|
timestamp: Date.now()
|
|
@@ -18073,7 +18074,7 @@ var init_iframe_manager = __esm({
|
|
|
18073
18074
|
const iframeOrigin = new URL(this.iframeUrl).origin;
|
|
18074
18075
|
this.iframe.contentWindow.postMessage(
|
|
18075
18076
|
{
|
|
18076
|
-
type: "
|
|
18077
|
+
type: "IFRAME_MSG_TOKEN_REFRESHED",
|
|
18077
18078
|
messageId: message.messageId,
|
|
18078
18079
|
error: "Token refresh failed",
|
|
18079
18080
|
timestamp: Date.now()
|
|
@@ -18087,7 +18088,7 @@ var init_iframe_manager = __esm({
|
|
|
18087
18088
|
const iframeOrigin = new URL(this.iframeUrl).origin;
|
|
18088
18089
|
this.iframe.contentWindow.postMessage(
|
|
18089
18090
|
{
|
|
18090
|
-
type: "
|
|
18091
|
+
type: "IFRAME_MSG_TOKEN_REFRESHED",
|
|
18091
18092
|
messageId: message.messageId,
|
|
18092
18093
|
error: error instanceof Error ? error.message : "Unknown error",
|
|
18093
18094
|
timestamp: Date.now()
|
|
@@ -18338,7 +18339,7 @@ var init_iframe_manager = __esm({
|
|
|
18338
18339
|
avatar,
|
|
18339
18340
|
displayName
|
|
18340
18341
|
});
|
|
18341
|
-
if (response.type === "
|
|
18342
|
+
if (response.type === "IFRAME_MSG_AUTH_SUCCESS") {
|
|
18342
18343
|
return {
|
|
18343
18344
|
userId: response.userId,
|
|
18344
18345
|
address: response.address
|
|
@@ -18356,7 +18357,7 @@ var init_iframe_manager = __esm({
|
|
|
18356
18357
|
accessToken
|
|
18357
18358
|
// Pass access token for TSS API authentication
|
|
18358
18359
|
});
|
|
18359
|
-
if (response.type === "
|
|
18360
|
+
if (response.type === "IFRAME_MSG_DKG_SUCCESS") {
|
|
18360
18361
|
return response.ownerAddress;
|
|
18361
18362
|
}
|
|
18362
18363
|
throw new Error("DKG failed");
|
|
@@ -18379,7 +18380,7 @@ var init_iframe_manager = __esm({
|
|
|
18379
18380
|
avatar,
|
|
18380
18381
|
displayName
|
|
18381
18382
|
});
|
|
18382
|
-
if (response.type === "
|
|
18383
|
+
if (response.type === "IFRAME_MSG_SIGNATURE") {
|
|
18383
18384
|
return response.signature;
|
|
18384
18385
|
}
|
|
18385
18386
|
throw new Error("Transaction signing failed");
|
|
@@ -18412,7 +18413,7 @@ var init_iframe_manager = __esm({
|
|
|
18412
18413
|
type: response.type,
|
|
18413
18414
|
hasSignature: !!response.signature
|
|
18414
18415
|
});
|
|
18415
|
-
if (response.type === "
|
|
18416
|
+
if (response.type === "IFRAME_MSG_EIP712_SIGNATURE") {
|
|
18416
18417
|
return response.signature;
|
|
18417
18418
|
}
|
|
18418
18419
|
throw new Error("EIP712 signing failed");
|
|
@@ -18424,7 +18425,7 @@ var init_iframe_manager = __esm({
|
|
|
18424
18425
|
const response = await this.sendMessage("GET_ADDRESS", {
|
|
18425
18426
|
userId
|
|
18426
18427
|
});
|
|
18427
|
-
if (response.type === "
|
|
18428
|
+
if (response.type === "IFRAME_MSG_ADDRESS") {
|
|
18428
18429
|
return response.address;
|
|
18429
18430
|
}
|
|
18430
18431
|
return void 0;
|
|
@@ -18436,7 +18437,7 @@ var init_iframe_manager = __esm({
|
|
|
18436
18437
|
const response = await this.sendMessage("CHECK_KEYSHARE", {
|
|
18437
18438
|
userId
|
|
18438
18439
|
});
|
|
18439
|
-
if (response.type === "
|
|
18440
|
+
if (response.type === "IFRAME_MSG_KEYSHARE_STATUS") {
|
|
18440
18441
|
return {
|
|
18441
18442
|
hasKeyshare: response.hasKeyshare,
|
|
18442
18443
|
address: response.address
|
|
@@ -18832,7 +18833,7 @@ var init_iframe_manager = __esm({
|
|
|
18832
18833
|
const response = await this.sendMessage("GET_TRUSTED_APPS", {
|
|
18833
18834
|
userId
|
|
18834
18835
|
});
|
|
18835
|
-
if (response.type === "
|
|
18836
|
+
if (response.type === "IFRAME_MSG_TRUSTED_APPS_LIST") {
|
|
18836
18837
|
return response.apps || [];
|
|
18837
18838
|
}
|
|
18838
18839
|
return [];
|
|
@@ -18846,7 +18847,7 @@ var init_iframe_manager = __esm({
|
|
|
18846
18847
|
projectId,
|
|
18847
18848
|
appOrigin: origin
|
|
18848
18849
|
});
|
|
18849
|
-
if (response.type === "
|
|
18850
|
+
if (response.type === "IFRAME_MSG_TRUSTED_APP_REMOVED") {
|
|
18850
18851
|
return response.success;
|
|
18851
18852
|
}
|
|
18852
18853
|
return false;
|
|
@@ -18877,7 +18878,7 @@ var init_iframe_manager = __esm({
|
|
|
18877
18878
|
accessToken
|
|
18878
18879
|
// Pass access token for TSS API authentication
|
|
18879
18880
|
});
|
|
18880
|
-
if (response.type === "
|
|
18881
|
+
if (response.type === "IFRAME_MSG_BACKUP_CREATED") {
|
|
18881
18882
|
return response.result;
|
|
18882
18883
|
}
|
|
18883
18884
|
throw new Error("Unexpected response type");
|
|
@@ -18892,7 +18893,7 @@ var init_iframe_manager = __esm({
|
|
|
18892
18893
|
accessToken
|
|
18893
18894
|
// Pass access token for TSS API authentication
|
|
18894
18895
|
});
|
|
18895
|
-
if (response.type === "
|
|
18896
|
+
if (response.type === "IFRAME_MSG_BACKUP_RESTORED") {
|
|
18896
18897
|
return response.result;
|
|
18897
18898
|
}
|
|
18898
18899
|
throw new Error("Unexpected response type");
|
|
@@ -18906,7 +18907,7 @@ var init_iframe_manager = __esm({
|
|
|
18906
18907
|
userId,
|
|
18907
18908
|
password
|
|
18908
18909
|
});
|
|
18909
|
-
if (response.type === "
|
|
18910
|
+
if (response.type === "IFRAME_MSG_BACKUP_ENCRYPTED") {
|
|
18910
18911
|
return response.encryptedData;
|
|
18911
18912
|
}
|
|
18912
18913
|
throw new Error("Unexpected response type");
|
|
@@ -18920,7 +18921,7 @@ var init_iframe_manager = __esm({
|
|
|
18920
18921
|
fileContent,
|
|
18921
18922
|
password
|
|
18922
18923
|
});
|
|
18923
|
-
if (response.type === "
|
|
18924
|
+
if (response.type === "IFRAME_MSG_FILE_RESTORED") {
|
|
18924
18925
|
return response.result;
|
|
18925
18926
|
}
|
|
18926
18927
|
throw new Error("Unexpected response type");
|
|
@@ -18932,7 +18933,7 @@ var init_iframe_manager = __esm({
|
|
|
18932
18933
|
const response = await this.sendMessage("GET_BACKUP_STATUS", {
|
|
18933
18934
|
userId
|
|
18934
18935
|
});
|
|
18935
|
-
if (response.type === "
|
|
18936
|
+
if (response.type === "IFRAME_MSG_BACKUP_STATUS") {
|
|
18936
18937
|
return response.status;
|
|
18937
18938
|
}
|
|
18938
18939
|
throw new Error("Unexpected response type");
|
|
@@ -18942,7 +18943,7 @@ var init_iframe_manager = __esm({
|
|
|
18942
18943
|
*/
|
|
18943
18944
|
async getCloudProviders() {
|
|
18944
18945
|
const response = await this.sendMessage("GET_CLOUD_PROVIDERS", {});
|
|
18945
|
-
if (response.type === "
|
|
18946
|
+
if (response.type === "IFRAME_MSG_CLOUD_PROVIDERS") {
|
|
18946
18947
|
return response.providers;
|
|
18947
18948
|
}
|
|
18948
18949
|
throw new Error("Unexpected response type");
|