@embarkai/ui-kit 0.4.12 → 0.4.13

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.4.12</title>
18
+ <title>EmbarkAI Secure Wallet - iframe version 0.4.13</title>
19
19
 
20
20
  <!-- Styles will be injected by build process -->
21
21
  <style>
@@ -6262,7 +6262,7 @@ var SigningManager = class extends TokenRefreshApiClient {
6262
6262
  };
6263
6263
 
6264
6264
  // src/iframe/main.ts
6265
- var IFRAME_VERSION = "0.4.12";
6265
+ var IFRAME_VERSION = "0.4.13";
6266
6266
  var IframeWallet = class {
6267
6267
  constructor() {
6268
6268
  console.log("=".repeat(60));
package/dist/index.cjs CHANGED
@@ -15862,11 +15862,20 @@ function useConnectedApps() {
15862
15862
  enabled: !!userId,
15863
15863
  queryKey: [CONNECTED_TRUSTED_APPS_QUERY, userId],
15864
15864
  queryFn: async () => {
15865
+ const response = await tssClient.get("/api/auth/connected-apps", true);
15866
+ if (!response.success || !response.data) {
15867
+ const error = response.error || "Failed to fetch connected apps";
15868
+ throw new Error(error);
15869
+ }
15865
15870
  const iframeManager = getIframeManager();
15866
- return await iframeManager.getTrustedApps(userId).catch(() => {
15867
- console.error("[ConnectedApps] Failed to load connected apps from iframe");
15871
+ const trustedApps = await iframeManager.getTrustedApps(userId).catch(() => {
15872
+ console.error("[ConnectedApps] Failed to load trusted apps from iframe");
15868
15873
  return [];
15869
15874
  });
15875
+ return response.data.apps.map((app) => ({
15876
+ ...app,
15877
+ trustedMeta: trustedApps.find((ta) => ta.projectId === app.projectId) || null
15878
+ }));
15870
15879
  }
15871
15880
  });
15872
15881
  }
@@ -15896,6 +15905,7 @@ var init_hooks2 = __esm({
15896
15905
  init_SessionContext();
15897
15906
  import_react_query42 = require("@tanstack/react-query");
15898
15907
  init_keyshare();
15908
+ init_httpClient();
15899
15909
  init_iframe_manager();
15900
15910
  init_vaultClient();
15901
15911
  init_constants6();
@@ -15904,9 +15914,16 @@ var init_hooks2 = __esm({
15904
15914
 
15905
15915
  // src/internal/components/SecurityMenu/ConnectedApps.tsx
15906
15916
  function Application(props) {
15907
- const { appLogo, appName, origin, trustedAt, untrustApp } = props;
15917
+ const {
15918
+ logo,
15919
+ name,
15920
+ // domains,
15921
+ firstConnectedAt,
15922
+ trustedMeta,
15923
+ untrustApp
15924
+ } = props;
15908
15925
  const { t } = useT();
15909
- const isAppTrusted = trustedAt && (0, import_dayjs5.default)(trustedAt).isValid() && (0, import_dayjs5.default)(trustedAt).isBefore((0, import_dayjs5.default)());
15926
+ const resolvedLogo = logo || trustedMeta?.appLogo || null;
15910
15927
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
15911
15928
  "div",
15912
15929
  {
@@ -15925,8 +15942,8 @@ function Application(props) {
15925
15942
  "rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg)]"
15926
15943
  ),
15927
15944
  children: [
15928
- appLogo ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "w-full h-full p-1", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("img", { src: appLogo, alt: appName, className: "w-full h-full object-contain" }) }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_lucide_react52.AppWindowMac, { className: "w-6 h-6 text-[var(--ui-kit-fg)]" }),
15929
- isAppTrusted && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
15945
+ resolvedLogo ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "w-full h-full p-1", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("img", { src: resolvedLogo, alt: name, className: "w-full h-full object-contain" }) }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_lucide_react52.AppWindowMac, { className: "w-6 h-6 text-[var(--ui-kit-fg)]" }),
15946
+ !!trustedMeta && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
15930
15947
  "div",
15931
15948
  {
15932
15949
  className: cn(
@@ -15940,21 +15957,26 @@ function Application(props) {
15940
15957
  }
15941
15958
  ),
15942
15959
  /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "flex-1 min-w-0", children: [
15943
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "font-semibold truncate", children: appName || new URL(origin).hostname }),
15944
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "text-[var(--ui-kit-fg-muted)] truncate", children: new URL(origin).hostname }),
15945
- isAppTrusted ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "text-[var(--ui-kit-fg)] truncate", children: t("passport:securityMenu.connectedApps.trustedAt", {
15946
- time: (0, import_dayjs5.default)(trustedAt).format("MMM D, YYYY HH:mm")
15960
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "font-semibold truncate", children: name }),
15961
+ trustedMeta?.origin && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "text-[var(--ui-kit-fg-muted)] truncate", children: new URL(trustedMeta.origin).hostname }),
15962
+ !!trustedMeta ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "text-[var(--ui-kit-fg)] truncate", children: t("passport:securityMenu.connectedApps.trustedAt", {
15963
+ time: (0, import_dayjs5.default)(trustedMeta.trustedAt).format("MMM D, YYYY HH:mm")
15947
15964
  }) }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "text-[var(--ui-kit-fg-muted)] truncate", children: t("passport:securityMenu.connectedApps.connectedAt", {
15948
- time: (0, import_dayjs5.default)(trustedAt).format("MMM D, YYYY HH:mm")
15965
+ time: (0, import_dayjs5.default)(firstConnectedAt).format("MMM D, YYYY HH:mm")
15949
15966
  }) })
15950
15967
  ] }),
15951
- isAppTrusted && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
15968
+ !!trustedMeta && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
15952
15969
  Button,
15953
15970
  {
15954
15971
  variant: "outline",
15955
15972
  size: "icon",
15956
15973
  className: "text-[var(--ui-kit-bg-error)] flex-none rounded-[var(--ui-kit-el-bdrs)]",
15957
- onClick: () => untrustApp({ ...(0, import_lodash_es7.omit)(props, "untrustApp"), hostname: new URL(origin).hostname }),
15974
+ onClick: () => {
15975
+ untrustApp({
15976
+ ...(0, import_lodash_es7.omit)(props, "untrustApp"),
15977
+ hostname: new URL(trustedMeta.origin).hostname
15978
+ });
15979
+ },
15958
15980
  children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_lucide_react52.ShieldBanIcon, { className: "h-4 w-4" })
15959
15981
  }
15960
15982
  )
@@ -15974,13 +15996,7 @@ function ConnectedApps(props) {
15974
15996
  /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { children: t("passport:securityMenu.connectedApps.noConnectedApps") })
15975
15997
  ] });
15976
15998
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
15977
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("span", { className: "font-medium text-xs text-[var(--ui-kit-fg)]", children: [
15978
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { children: t("passport:securityMenu.connectedApps.connectedApps") }),
15979
- connectedApps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("span", { children: [
15980
- " ",
15981
- connectedApps.length
15982
- ] })
15983
- ] }),
15999
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "font-medium text-xs text-[var(--ui-kit-fg)]", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { children: t("passport:securityMenu.connectedApps.connectedApps") }) }),
15984
16000
  /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: connectedApps.map((app, index) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Application, { ...app, untrustApp }, index)) })
15985
16001
  ] });
15986
16002
  }
@@ -19280,7 +19296,7 @@ var init_package = __esm({
19280
19296
  "package.json"() {
19281
19297
  package_default = {
19282
19298
  name: "@embarkai/ui-kit",
19283
- version: "0.4.12",
19299
+ version: "0.4.13",
19284
19300
  description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
19285
19301
  type: "module",
19286
19302
  main: "./dist/index.cjs",
package/dist/index.d.cts CHANGED
@@ -1802,13 +1802,16 @@ declare function getUserProfile(): Promise<UserProfile>;
1802
1802
  */
1803
1803
  declare function updateUserProfile(updates: UpdateProfileRequest): Promise<UserProfile>;
1804
1804
 
1805
- declare function useConnectedApps(): _tanstack_react_query.UseQueryResult<any[] | {
1806
- userId: string;
1805
+ declare function useConnectedApps(): _tanstack_react_query.UseQueryResult<{
1806
+ trustedMeta: any;
1807
1807
  projectId: string;
1808
- origin: string;
1809
- trustedAt: number;
1810
- appName?: string;
1811
- appLogo?: string;
1808
+ name: string;
1809
+ logo: string;
1810
+ domains: unknown;
1811
+ providers: unknown;
1812
+ smartWalletAddress: string;
1813
+ firstConnectedAt: string;
1814
+ lastActiveAt: string;
1812
1815
  }[], Error>;
1813
1816
  declare function useKeyshareRecoveryStats(): _tanstack_react_query.UseQueryResult<{
1814
1817
  keyshareInfo: {
package/dist/index.d.ts CHANGED
@@ -1802,13 +1802,16 @@ declare function getUserProfile(): Promise<UserProfile>;
1802
1802
  */
1803
1803
  declare function updateUserProfile(updates: UpdateProfileRequest): Promise<UserProfile>;
1804
1804
 
1805
- declare function useConnectedApps(): _tanstack_react_query.UseQueryResult<any[] | {
1806
- userId: string;
1805
+ declare function useConnectedApps(): _tanstack_react_query.UseQueryResult<{
1806
+ trustedMeta: any;
1807
1807
  projectId: string;
1808
- origin: string;
1809
- trustedAt: number;
1810
- appName?: string;
1811
- appLogo?: string;
1808
+ name: string;
1809
+ logo: string;
1810
+ domains: unknown;
1811
+ providers: unknown;
1812
+ smartWalletAddress: string;
1813
+ firstConnectedAt: string;
1814
+ lastActiveAt: string;
1812
1815
  }[], Error>;
1813
1816
  declare function useKeyshareRecoveryStats(): _tanstack_react_query.UseQueryResult<{
1814
1817
  keyshareInfo: {
package/dist/index.js CHANGED
@@ -15795,11 +15795,20 @@ function useConnectedApps() {
15795
15795
  enabled: !!userId,
15796
15796
  queryKey: [CONNECTED_TRUSTED_APPS_QUERY, userId],
15797
15797
  queryFn: async () => {
15798
+ const response = await tssClient.get("/api/auth/connected-apps", true);
15799
+ if (!response.success || !response.data) {
15800
+ const error = response.error || "Failed to fetch connected apps";
15801
+ throw new Error(error);
15802
+ }
15798
15803
  const iframeManager = getIframeManager();
15799
- return await iframeManager.getTrustedApps(userId).catch(() => {
15800
- console.error("[ConnectedApps] Failed to load connected apps from iframe");
15804
+ const trustedApps = await iframeManager.getTrustedApps(userId).catch(() => {
15805
+ console.error("[ConnectedApps] Failed to load trusted apps from iframe");
15801
15806
  return [];
15802
15807
  });
15808
+ return response.data.apps.map((app) => ({
15809
+ ...app,
15810
+ trustedMeta: trustedApps.find((ta) => ta.projectId === app.projectId) || null
15811
+ }));
15803
15812
  }
15804
15813
  });
15805
15814
  }
@@ -15827,6 +15836,7 @@ var init_hooks2 = __esm({
15827
15836
  "src/internal/components/SecurityMenu/hooks.ts"() {
15828
15837
  init_SessionContext();
15829
15838
  init_keyshare();
15839
+ init_httpClient();
15830
15840
  init_iframe_manager();
15831
15841
  init_vaultClient();
15832
15842
  init_constants6();
@@ -15839,9 +15849,16 @@ import { omit } from "lodash-es";
15839
15849
  import { AppWindowMac, Info as Info5, ShieldBanIcon, ShieldCheckIcon } from "lucide-react";
15840
15850
  import { Fragment as Fragment32, jsx as jsx82, jsxs as jsxs75 } from "react/jsx-runtime";
15841
15851
  function Application(props) {
15842
- const { appLogo, appName, origin, trustedAt, untrustApp } = props;
15852
+ const {
15853
+ logo,
15854
+ name,
15855
+ // domains,
15856
+ firstConnectedAt,
15857
+ trustedMeta,
15858
+ untrustApp
15859
+ } = props;
15843
15860
  const { t } = useT();
15844
- const isAppTrusted = trustedAt && dayjs5(trustedAt).isValid() && dayjs5(trustedAt).isBefore(dayjs5());
15861
+ const resolvedLogo = logo || trustedMeta?.appLogo || null;
15845
15862
  return /* @__PURE__ */ jsxs75(
15846
15863
  "div",
15847
15864
  {
@@ -15860,8 +15877,8 @@ function Application(props) {
15860
15877
  "rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg)]"
15861
15878
  ),
15862
15879
  children: [
15863
- appLogo ? /* @__PURE__ */ jsx82("div", { className: "w-full h-full p-1", children: /* @__PURE__ */ jsx82("img", { src: appLogo, alt: appName, className: "w-full h-full object-contain" }) }) : /* @__PURE__ */ jsx82(AppWindowMac, { className: "w-6 h-6 text-[var(--ui-kit-fg)]" }),
15864
- isAppTrusted && /* @__PURE__ */ jsx82(
15880
+ resolvedLogo ? /* @__PURE__ */ jsx82("div", { className: "w-full h-full p-1", children: /* @__PURE__ */ jsx82("img", { src: resolvedLogo, alt: name, className: "w-full h-full object-contain" }) }) : /* @__PURE__ */ jsx82(AppWindowMac, { className: "w-6 h-6 text-[var(--ui-kit-fg)]" }),
15881
+ !!trustedMeta && /* @__PURE__ */ jsx82(
15865
15882
  "div",
15866
15883
  {
15867
15884
  className: cn(
@@ -15875,21 +15892,26 @@ function Application(props) {
15875
15892
  }
15876
15893
  ),
15877
15894
  /* @__PURE__ */ jsxs75("div", { className: "flex-1 min-w-0", children: [
15878
- /* @__PURE__ */ jsx82("div", { className: "font-semibold truncate", children: appName || new URL(origin).hostname }),
15879
- /* @__PURE__ */ jsx82("div", { className: "text-[var(--ui-kit-fg-muted)] truncate", children: new URL(origin).hostname }),
15880
- isAppTrusted ? /* @__PURE__ */ jsx82("div", { className: "text-[var(--ui-kit-fg)] truncate", children: t("passport:securityMenu.connectedApps.trustedAt", {
15881
- time: dayjs5(trustedAt).format("MMM D, YYYY HH:mm")
15895
+ /* @__PURE__ */ jsx82("div", { className: "font-semibold truncate", children: name }),
15896
+ trustedMeta?.origin && /* @__PURE__ */ jsx82("div", { className: "text-[var(--ui-kit-fg-muted)] truncate", children: new URL(trustedMeta.origin).hostname }),
15897
+ !!trustedMeta ? /* @__PURE__ */ jsx82("div", { className: "text-[var(--ui-kit-fg)] truncate", children: t("passport:securityMenu.connectedApps.trustedAt", {
15898
+ time: dayjs5(trustedMeta.trustedAt).format("MMM D, YYYY HH:mm")
15882
15899
  }) }) : /* @__PURE__ */ jsx82("div", { className: "text-[var(--ui-kit-fg-muted)] truncate", children: t("passport:securityMenu.connectedApps.connectedAt", {
15883
- time: dayjs5(trustedAt).format("MMM D, YYYY HH:mm")
15900
+ time: dayjs5(firstConnectedAt).format("MMM D, YYYY HH:mm")
15884
15901
  }) })
15885
15902
  ] }),
15886
- isAppTrusted && /* @__PURE__ */ jsx82(
15903
+ !!trustedMeta && /* @__PURE__ */ jsx82(
15887
15904
  Button,
15888
15905
  {
15889
15906
  variant: "outline",
15890
15907
  size: "icon",
15891
15908
  className: "text-[var(--ui-kit-bg-error)] flex-none rounded-[var(--ui-kit-el-bdrs)]",
15892
- onClick: () => untrustApp({ ...omit(props, "untrustApp"), hostname: new URL(origin).hostname }),
15909
+ onClick: () => {
15910
+ untrustApp({
15911
+ ...omit(props, "untrustApp"),
15912
+ hostname: new URL(trustedMeta.origin).hostname
15913
+ });
15914
+ },
15893
15915
  children: /* @__PURE__ */ jsx82(ShieldBanIcon, { className: "h-4 w-4" })
15894
15916
  }
15895
15917
  )
@@ -15909,13 +15931,7 @@ function ConnectedApps(props) {
15909
15931
  /* @__PURE__ */ jsx82("span", { children: t("passport:securityMenu.connectedApps.noConnectedApps") })
15910
15932
  ] });
15911
15933
  return /* @__PURE__ */ jsxs75(Fragment32, { children: [
15912
- /* @__PURE__ */ jsxs75("span", { className: "font-medium text-xs text-[var(--ui-kit-fg)]", children: [
15913
- /* @__PURE__ */ jsx82("span", { children: t("passport:securityMenu.connectedApps.connectedApps") }),
15914
- connectedApps.length > 0 && /* @__PURE__ */ jsxs75("span", { children: [
15915
- " ",
15916
- connectedApps.length
15917
- ] })
15918
- ] }),
15934
+ /* @__PURE__ */ jsx82("span", { className: "font-medium text-xs text-[var(--ui-kit-fg)]", children: /* @__PURE__ */ jsx82("span", { children: t("passport:securityMenu.connectedApps.connectedApps") }) }),
15919
15935
  /* @__PURE__ */ jsx82("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: connectedApps.map((app, index) => /* @__PURE__ */ jsx82(Application, { ...app, untrustApp }, index)) })
15920
15936
  ] });
15921
15937
  }
@@ -19198,7 +19214,7 @@ var init_package = __esm({
19198
19214
  "package.json"() {
19199
19215
  package_default = {
19200
19216
  name: "@embarkai/ui-kit",
19201
- version: "0.4.12",
19217
+ version: "0.4.13",
19202
19218
  description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
19203
19219
  type: "module",
19204
19220
  main: "./dist/index.cjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embarkai/ui-kit",
3
- "version": "0.4.12",
3
+ "version": "0.4.13",
4
4
  "description": "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",