@embarkai/ui-kit 0.6.12 → 0.6.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.
package/dist/index.js CHANGED
@@ -323,7 +323,7 @@ import { getSdkVersion, sdkVersionHeaders, setSdkVersion } from "@embarkai/core/
323
323
  var UI_KIT_VERSION;
324
324
  var init_sdk_version = __esm({
325
325
  "src/internal/lib/sdk-version.ts"() {
326
- UI_KIT_VERSION = "0.6.12";
326
+ UI_KIT_VERSION = "0.6.13";
327
327
  if (UI_KIT_VERSION) setSdkVersion(UI_KIT_VERSION);
328
328
  }
329
329
  });
@@ -22302,6 +22302,29 @@ var init_DevicesMenu = __esm({
22302
22302
  }
22303
22303
  });
22304
22304
 
22305
+ // src/internal/hooks/useHasAuthSession.ts
22306
+ import { useSyncExternalStore as useSyncExternalStore2 } from "react";
22307
+ function useHasAuthSession() {
22308
+ return useSyncExternalStore2(subscribe, hasAuthSession, hasAuthSession);
22309
+ }
22310
+ var subscribe, hasAuthSession;
22311
+ var init_useHasAuthSession = __esm({
22312
+ "src/internal/hooks/useHasAuthSession.ts"() {
22313
+ init_auth();
22314
+ subscribe = (onChange) => jwtTokenManager3.subscribe(onChange);
22315
+ hasAuthSession = () => !!jwtTokenManager3.getUserId();
22316
+ }
22317
+ });
22318
+
22319
+ // src/internal/components/KeyshareRestoreMenu/backup-check.ts
22320
+ function canCheckBackup(sessionStatus, hasAuthSession2) {
22321
+ return sessionStatus !== "disconnecting" && hasAuthSession2;
22322
+ }
22323
+ var init_backup_check = __esm({
22324
+ "src/internal/components/KeyshareRestoreMenu/backup-check.ts"() {
22325
+ }
22326
+ });
22327
+
22305
22328
  // src/internal/components/ui/tooltip.tsx
22306
22329
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
22307
22330
  import { InfoIcon as InfoIcon4 } from "lucide-react";
@@ -24589,6 +24612,7 @@ var init_KeyshareRestoreMenu = __esm({
24589
24612
  init_SessionContext();
24590
24613
  init_i18n();
24591
24614
  init_useSafeDisconnect();
24615
+ init_useHasAuthSession();
24592
24616
  init_useLayoutDataStore();
24593
24617
  init_useLayoutStore();
24594
24618
  init_security_status();
@@ -24597,6 +24621,7 @@ var init_KeyshareRestoreMenu = __esm({
24597
24621
  init_Expandable2();
24598
24622
  init_button();
24599
24623
  init_highlight();
24624
+ init_backup_check();
24600
24625
  init_components2();
24601
24626
  init_constants5();
24602
24627
  init_hooks();
@@ -24614,6 +24639,8 @@ var init_KeyshareRestoreMenu = __esm({
24614
24639
  const { callbacksRef } = useProviderConfig();
24615
24640
  const { t } = useT();
24616
24641
  const address = useSession((st) => st.address);
24642
+ const sessionStatus = useSession((st) => st.status);
24643
+ const hasAuthSession2 = useHasAuthSession();
24617
24644
  const error = useRestoreStore((st) => st.error);
24618
24645
  const success = useRestoreStore((st) => st.success);
24619
24646
  const currentRestoreMethod = useRestoreStore((st) => st.method);
@@ -24656,6 +24683,7 @@ var init_KeyshareRestoreMenu = __esm({
24656
24683
  isError: isBackupStatusUnavailable
24657
24684
  } = useQuery15({
24658
24685
  retry: false,
24686
+ enabled: canCheckBackup(sessionStatus, hasAuthSession2),
24659
24687
  queryKey: [CHECK_BACKUP_QUERY_KEY, address],
24660
24688
  queryFn: async () => await readShareRecoveryStats()
24661
24689
  });
@@ -24679,7 +24707,7 @@ var init_KeyshareRestoreMenu = __esm({
24679
24707
  return { disconnectedUserId: userId };
24680
24708
  },
24681
24709
  onSuccess: async ({ disconnectedUserId }) => {
24682
- await qc.resetQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY] });
24710
+ qc.removeQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY] });
24683
24711
  if (!!useExternalWalletStore.getState().externalAddress) wagmiDisconnect();
24684
24712
  const { setStatus, setIsLoading, setSession, setAddress } = useSession.getState();
24685
24713
  setSession(null);
@@ -24810,6 +24838,8 @@ function KeyshareBackupMenu() {
24810
24838
  const qc = useQueryClient18();
24811
24839
  const { t } = useT();
24812
24840
  const address = useSession((st) => st.address);
24841
+ const sessionStatus = useSession((st) => st.status);
24842
+ const hasAuthSession2 = useHasAuthSession();
24813
24843
  const isBackupRequired = useLayoutStore((st) => st.isBackupRequired);
24814
24844
  const isBackupFailureNotice = useLayoutStore((st) => st.isBackupFailureNotice);
24815
24845
  const currentBackupMethod = useRestoreStore((st) => st.method);
@@ -24834,7 +24864,7 @@ function KeyshareBackupMenu() {
24834
24864
  isError: isRecoveryUnavailable
24835
24865
  } = useQuery16({
24836
24866
  retry: false,
24837
- enabled: !!address,
24867
+ enabled: !!address && canCheckBackup(sessionStatus, hasAuthSession2),
24838
24868
  queryKey: [CHECK_BACKUP_QUERY_KEY, address],
24839
24869
  queryFn: async () => await readShareRecoveryStats()
24840
24870
  });
@@ -25010,6 +25040,7 @@ var init_KeyshareBackupMenu = __esm({
25010
25040
  init_SessionContext();
25011
25041
  init_i18n();
25012
25042
  init_embarkAI2();
25043
+ init_useHasAuthSession();
25013
25044
  init_useLayoutDataStore();
25014
25045
  init_useLayoutStore();
25015
25046
  init_security_status();
@@ -25018,6 +25049,7 @@ var init_KeyshareBackupMenu = __esm({
25018
25049
  init_Onboarding();
25019
25050
  init_button();
25020
25051
  init_highlight();
25052
+ init_backup_check();
25021
25053
  init_components2();
25022
25054
  init_constants5();
25023
25055
  init_hooks();
@@ -32686,7 +32718,7 @@ var init_SendMenu2 = __esm({
32686
32718
  });
32687
32719
 
32688
32720
  // src/internal/lib/pro-mode.ts
32689
- import { useSyncExternalStore as useSyncExternalStore2 } from "react";
32721
+ import { useSyncExternalStore as useSyncExternalStore3 } from "react";
32690
32722
  function isProMode() {
32691
32723
  try {
32692
32724
  return localStorage.getItem(STORAGE_KEY) === "1";
@@ -32704,7 +32736,7 @@ function enableProMode() {
32704
32736
  return false;
32705
32737
  }
32706
32738
  }
32707
- function subscribe(callback) {
32739
+ function subscribe2(callback) {
32708
32740
  const handler = () => callback();
32709
32741
  window.addEventListener(EVENT_NAME, handler);
32710
32742
  return () => window.removeEventListener(EVENT_NAME, handler);
@@ -32716,7 +32748,7 @@ function getServerSnapshot() {
32716
32748
  return false;
32717
32749
  }
32718
32750
  function useProMode() {
32719
- return useSyncExternalStore2(subscribe, getSnapshot, getServerSnapshot);
32751
+ return useSyncExternalStore3(subscribe2, getSnapshot, getServerSnapshot);
32720
32752
  }
32721
32753
  var STORAGE_KEY, EVENT_NAME;
32722
32754
  var init_pro_mode = __esm({
@@ -34789,7 +34821,7 @@ var init_package = __esm({
34789
34821
  "package.json"() {
34790
34822
  package_default = {
34791
34823
  name: "@embarkai/ui-kit",
34792
- version: "0.6.12",
34824
+ version: "0.6.13",
34793
34825
  description: "React UI components and hooks for embarkAI authentication and Account Abstraction",
34794
34826
  type: "module",
34795
34827
  main: "./dist/index.cjs",
@@ -34929,7 +34961,7 @@ function Footer() {
34929
34961
  return { disconnectedUserId: userId, disconnectAddress };
34930
34962
  },
34931
34963
  onSuccess: async ({ disconnectAddress, disconnectedUserId }) => {
34932
- await qc.resetQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY] });
34964
+ qc.removeQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY] });
34933
34965
  if (!!useExternalWalletStore.getState().externalAddress) wagmiDisconnect();
34934
34966
  const { setError, setStatus, setIsLoading, setSession, setAddress } = useSession.getState();
34935
34967
  setSession(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embarkai/ui-kit",
3
- "version": "0.6.12",
3
+ "version": "0.6.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",
@@ -52,7 +52,7 @@
52
52
  "viem": "^2.57.12",
53
53
  "wagmi": "^3.7.9",
54
54
  "zustand": "^5.0.16",
55
- "@embarkai/core": "0.6.2"
55
+ "@embarkai/core": "0.6.4"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@svgr/core": "^8.1.0",