@vechain/vechain-kit 1.8.4 → 1.9.1

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.d.cts CHANGED
@@ -3672,12 +3672,13 @@ declare const ActionButton: ({ leftIcon, rightIcon, title, onClick, leftImage, h
3672
3672
 
3673
3673
  type Props$d = {
3674
3674
  wallet: Wallet;
3675
+ setCurrentContent: React.Dispatch<React.SetStateAction<AccountModalContentTypes>>;
3675
3676
  size?: string;
3676
3677
  onClick?: () => void;
3677
3678
  mt?: number;
3678
3679
  style?: StackProps;
3679
3680
  };
3680
- declare const AccountSelector: ({ wallet, size, onClick, mt, style, }: Props$d) => react_jsx_runtime.JSX.Element;
3681
+ declare const AccountSelector: ({ wallet, size, onClick, mt, style, setCurrentContent, }: Props$d) => react_jsx_runtime.JSX.Element;
3681
3682
 
3682
3683
  declare const BalanceSection: ({ mb, mt, onAssetsClick, }: {
3683
3684
  mb?: number;
package/dist/index.d.ts CHANGED
@@ -3672,12 +3672,13 @@ declare const ActionButton: ({ leftIcon, rightIcon, title, onClick, leftImage, h
3672
3672
 
3673
3673
  type Props$d = {
3674
3674
  wallet: Wallet;
3675
+ setCurrentContent: React.Dispatch<React.SetStateAction<AccountModalContentTypes>>;
3675
3676
  size?: string;
3676
3677
  onClick?: () => void;
3677
3678
  mt?: number;
3678
3679
  style?: StackProps;
3679
3680
  };
3680
- declare const AccountSelector: ({ wallet, size, onClick, mt, style, }: Props$d) => react_jsx_runtime.JSX.Element;
3681
+ declare const AccountSelector: ({ wallet, size, onClick, mt, style, setCurrentContent, }: Props$d) => react_jsx_runtime.JSX.Element;
3681
3682
 
3682
3683
  declare const BalanceSection: ({ mb, mt, onAssetsClick, }: {
3683
3684
  mb?: number;
package/dist/index.js CHANGED
@@ -31,13 +31,13 @@ import { isMobile } from 'react-device-detect';
31
31
  import { ThorClient, ProviderInternalBaseWallet, VeChainProvider, signerUtils } from '@vechain/sdk-network';
32
32
  import { ABIContract, Address, Clause } from '@vechain/sdk-core';
33
33
  import { LuMail, LuArrowDownToLine } from 'react-icons/lu';
34
- import { MdOutlineNavigateNext, MdSwapHoriz, MdOutlineSettingsBackupRestore, MdPhotoCamera, MdCurrencyExchange, MdPrivacyTip, MdOutlineRefresh, MdOutlineErrorOutline, MdEmail, MdGavel, MdCheck } from 'react-icons/md';
34
+ import { MdOutlineNavigateNext, MdOutlineSettingsBackupRestore, MdPhotoCamera, MdCurrencyExchange, MdPrivacyTip, MdOutlineRefresh, MdOutlineErrorOutline, MdEmail, MdGavel, MdCheck } from 'react-icons/md';
35
35
  import { FcGoogle, FcCheckmark } from 'react-icons/fc';
36
- import { IoIosFingerPrint, IoIosArrowForward, IoMdApps, IoMdSettings, IoIosCheckmarkCircleOutline } from 'react-icons/io';
36
+ import { IoIosFingerPrint, IoIosArrowForward, IoMdApps, IoIosCheckmarkCircleOutline, IoMdSettings } from 'react-icons/io';
37
37
  import { CiCircleMore, CiSearch } from 'react-icons/ci';
38
+ import { RiLogoutBoxLine, RiEdit2Line, RiTwitterXFill } from 'react-icons/ri';
38
39
  import { VscRefresh, VscDebugDisconnect } from 'react-icons/vsc';
39
40
  import { FiSend, FiSlash, FiArrowDown, FiExternalLink } from 'react-icons/fi';
40
- import { RiSwap3Line, RiLogoutBoxLine, RiEdit2Line, RiTwitterXFill } from 'react-icons/ri';
41
41
  import { GrUserAdmin } from 'react-icons/gr';
42
42
  import { GiHouseKeys } from 'react-icons/gi';
43
43
  import { BsQuestionCircle, BsCheck, BsBookmarkFill, BsBookmark } from 'react-icons/bs';
@@ -4804,7 +4804,7 @@ var AddressDisplay = ({
4804
4804
 
4805
4805
  // package.json
4806
4806
  var package_default = {
4807
- version: "1.8.4"};
4807
+ version: "1.9.1"};
4808
4808
  var VersionFooter = ({ ...props }) => {
4809
4809
  const { darkMode: isDark } = useVeChainKitConfig();
4810
4810
  return /* @__PURE__ */ jsxs(
@@ -4872,9 +4872,11 @@ var StickyHeaderContainer = ({ children }) => {
4872
4872
  left: "0",
4873
4873
  w: "full",
4874
4874
  borderRadius: "24px 24px 0px 0px",
4875
- bg: isDark ? "rgb(31 31 30 / 90%)" : "rgb(255 255 255 / 69%)",
4876
- backdropFilter: "blur(12px)",
4877
- style: { WebkitBackdropFilter: "blur(12px)" },
4875
+ bg: hasContentBelow ? isDark ? "rgba(21, 21, 21, 0.6)" : "rgba(255, 255, 255, 0.6)" : "transparent",
4876
+ backdropFilter: hasContentBelow ? "blur(15px)" : "none",
4877
+ style: hasContentBelow ? { WebkitBackdropFilter: "blur(15px)" } : {
4878
+ WebkitBackdropFilter: "none"
4879
+ },
4878
4880
  zIndex: 1e3,
4879
4881
  boxShadow: hasContentBelow ? "0px 2px 4px 1px rgb(0 0 0 / 10%)" : "none",
4880
4882
  transition: "box-shadow 0.2s ease-in-out",
@@ -4918,7 +4920,7 @@ var BaseModal = ({
4918
4920
  closeOnOverlayClick = true,
4919
4921
  blockScrollOnMount = false,
4920
4922
  allowExternalFocus = false,
4921
- backdropFilter,
4923
+ backdropFilter = "blur(2px)",
4922
4924
  isCloseable = true
4923
4925
  }) => {
4924
4926
  const [isDesktop] = useMediaQuery("(min-width: 768px)");
@@ -11192,23 +11194,74 @@ var MainContent = ({ setCurrentContent, onClose }) => {
11192
11194
  ) }) }) : /* @__PURE__ */ jsx(ModalFooter, { pt: 0, pb: "5px" })
11193
11195
  ] });
11194
11196
  };
11197
+ var ModalSettingsButton = ({
11198
+ onClick,
11199
+ ...props
11200
+ }) => {
11201
+ const { smartAccount, connectedWallet, connection } = useWallet();
11202
+ const [isFirstVisit, setIsFirstVisit] = useState(false);
11203
+ useEffect(() => {
11204
+ const hasVisited = localStorage.getItem("app-first-visit");
11205
+ setIsFirstVisit(!hasVisited);
11206
+ }, []);
11207
+ const { data: upgradeRequired } = useUpgradeRequired(
11208
+ smartAccount?.address ?? "",
11209
+ connectedWallet?.address ?? "",
11210
+ 3
11211
+ );
11212
+ const showRedDot = connection.isConnectedWithPrivy && upgradeRequired || isFirstVisit;
11213
+ const handleOnClick = () => {
11214
+ if (isFirstVisit) {
11215
+ localStorage.setItem("app-first-visit", "true");
11216
+ setIsFirstVisit(false);
11217
+ }
11218
+ onClick();
11219
+ };
11220
+ return /* @__PURE__ */ jsx(
11221
+ IconButton,
11222
+ {
11223
+ "aria-label": "Notifications",
11224
+ size: "sm",
11225
+ variant: "ghost",
11226
+ _hover: { bg: "blackAlpha.100" },
11227
+ _dark: { _hover: { bg: "whiteAlpha.100" } },
11228
+ position: "absolute",
11229
+ borderRadius: "50%",
11230
+ left: "10px",
11231
+ top: "10px",
11232
+ onClick: handleOnClick,
11233
+ icon: /* @__PURE__ */ jsxs(Box, { position: "relative", children: [
11234
+ /* @__PURE__ */ jsx(IoMdSettings, { fontSize: "20px" }),
11235
+ showRedDot && /* @__PURE__ */ jsx(
11236
+ Box,
11237
+ {
11238
+ position: "absolute",
11239
+ top: "-1px",
11240
+ right: "-1px",
11241
+ minWidth: "8px",
11242
+ height: "8px",
11243
+ bg: "red.500",
11244
+ borderRadius: "full"
11245
+ }
11246
+ )
11247
+ ] }),
11248
+ ...props
11249
+ }
11250
+ );
11251
+ };
11195
11252
  var AccountMainContent = ({ setCurrentContent, wallet }) => {
11196
11253
  const { t } = useTranslation();
11197
11254
  const { network } = useVeChainKitConfig();
11198
- const { getNotifications } = useNotifications();
11199
- const notifications = getNotifications();
11200
- const hasUnreadNotifications = notifications.some((n) => !n.isRead);
11201
11255
  return /* @__PURE__ */ jsxs(ScrollToTopWrapper, { children: [
11202
11256
  /* @__PURE__ */ jsxs(StickyHeaderContainer, { children: [
11203
11257
  /* @__PURE__ */ jsx(
11204
- ModalNotificationButton,
11258
+ ModalSettingsButton,
11205
11259
  {
11206
11260
  onClick: () => {
11207
11261
  Analytics.notifications.viewed();
11208
- setCurrentContent("notifications");
11262
+ setCurrentContent("settings");
11209
11263
  },
11210
- hasUnreadNotifications,
11211
- "data-testid": "notifications-button"
11264
+ "data-testid": "settings-button"
11212
11265
  }
11213
11266
  ),
11214
11267
  /* @__PURE__ */ jsx(ModalHeader, { children: /* @__PURE__ */ jsxs(
@@ -11259,7 +11312,8 @@ var AccountMainContent = ({ setCurrentContent, wallet }) => {
11259
11312
  onClick: () => {
11260
11313
  setCurrentContent("profile");
11261
11314
  },
11262
- wallet
11315
+ wallet,
11316
+ setCurrentContent
11263
11317
  }
11264
11318
  ),
11265
11319
  /* @__PURE__ */ jsx(
@@ -11425,9 +11479,11 @@ var AccountSelector = ({
11425
11479
  size = "md",
11426
11480
  onClick,
11427
11481
  mt,
11428
- style
11482
+ style,
11483
+ setCurrentContent
11429
11484
  }) => {
11430
11485
  const [copied, setCopied] = useState(false);
11486
+ const { disconnect } = useWallet();
11431
11487
  const copyToClipboard = async () => {
11432
11488
  await navigator.clipboard.writeText(
11433
11489
  wallet?.domain ?? wallet?.address ?? ""
@@ -11437,6 +11493,11 @@ var AccountSelector = ({
11437
11493
  setCopied(false);
11438
11494
  }, 2e3);
11439
11495
  };
11496
+ const handleLogout = () => {
11497
+ Analytics.auth.trackAuth("disconnect_initiated");
11498
+ disconnect();
11499
+ Analytics.auth.logoutCompleted();
11500
+ };
11440
11501
  return /* @__PURE__ */ jsxs(
11441
11502
  HStack,
11442
11503
  {
@@ -11498,6 +11559,25 @@ var AccountSelector = ({
11498
11559
  opacity: 0.5,
11499
11560
  _hover: { opacity: 0.8 }
11500
11561
  }
11562
+ ),
11563
+ /* @__PURE__ */ jsx(
11564
+ IconButton,
11565
+ {
11566
+ "aria-label": "Logout",
11567
+ icon: /* @__PURE__ */ jsx(Icon, { as: RiLogoutBoxLine }),
11568
+ onClick: () => setCurrentContent({
11569
+ type: "disconnect-confirm",
11570
+ props: {
11571
+ onDisconnect: handleLogout,
11572
+ onBack: () => setCurrentContent("main")
11573
+ }
11574
+ }),
11575
+ variant: "ghost",
11576
+ size: "sm",
11577
+ opacity: 0.5,
11578
+ _hover: { opacity: 0.8 },
11579
+ colorScheme: "red"
11580
+ }
11501
11581
  )
11502
11582
  ]
11503
11583
  }
@@ -11625,7 +11705,7 @@ var BalanceSection = ({
11625
11705
  }, 1500);
11626
11706
  };
11627
11707
  return /* @__PURE__ */ jsxs(VStack, { w: "full", justifyContent: "start", spacing: 2, mt, mb, children: [
11628
- /* @__PURE__ */ jsx(Heading, { size: "xs", fontWeight: "500", w: "full", opacity: 0.5, children: t("Balance") }),
11708
+ /* @__PURE__ */ jsx(Heading, { size: "xs", fontWeight: "500", w: "full", opacity: 0.8, children: t("Balance") }),
11629
11709
  /* @__PURE__ */ jsxs(
11630
11710
  HStack,
11631
11711
  {
@@ -11712,11 +11792,11 @@ var BalanceSection = ({
11712
11792
  };
11713
11793
  var QUICK_ACTIONS = [
11714
11794
  {
11715
- icon: MdSwapHoriz,
11716
- label: "Swap",
11795
+ icon: IoMdApps,
11796
+ label: "Ecosystem",
11717
11797
  onClick: (setCurrentContent) => {
11718
- Analytics.swap.opened();
11719
- setCurrentContent("swap-token");
11798
+ Analytics.ecosystem.opened();
11799
+ setCurrentContent("ecosystem");
11720
11800
  }
11721
11801
  },
11722
11802
  {
@@ -11738,38 +11818,13 @@ var QUICK_ACTIONS = [
11738
11818
  }
11739
11819
  }),
11740
11820
  isDisabled: (hasAnyBalance) => !hasAnyBalance
11741
- },
11742
- {
11743
- icon: RiSwap3Line,
11744
- label: "Bridge",
11745
- onClick: (setCurrentContent) => {
11746
- Analytics.bridge.opened();
11747
- setCurrentContent("bridge");
11748
- }
11749
- },
11750
- {
11751
- icon: IoMdApps,
11752
- label: "Ecosystem",
11753
- onClick: (setCurrentContent) => {
11754
- Analytics.ecosystem.opened();
11755
- setCurrentContent("ecosystem");
11756
- }
11757
- },
11758
- {
11759
- icon: IoMdSettings,
11760
- label: "Settings",
11761
- onClick: (setCurrentContent) => {
11762
- Analytics.settings.opened("general");
11763
- setCurrentContent("settings");
11764
- }
11765
11821
  }
11766
11822
  ];
11767
11823
  var QuickActionButton = ({
11768
11824
  icon,
11769
11825
  label,
11770
11826
  onClick,
11771
- isDisabled,
11772
- showRedDot
11827
+ isDisabled
11773
11828
  }) => {
11774
11829
  const { t } = useTranslation();
11775
11830
  return /* @__PURE__ */ jsx(
@@ -11782,67 +11837,37 @@ var QuickActionButton = ({
11782
11837
  isDisabled,
11783
11838
  icon: /* @__PURE__ */ jsxs(VStack, { spacing: 4, children: [
11784
11839
  /* @__PURE__ */ jsx(Icon, { as: icon, boxSize: 5, opacity: 0.9 }),
11785
- /* @__PURE__ */ jsxs(HStack, { p: 0, alignItems: "baseline", spacing: 1, children: [
11786
- /* @__PURE__ */ jsx(
11787
- Text,
11788
- {
11789
- fontSize: "sm",
11790
- fontWeight: "600",
11791
- "data-testid": `${label.toLowerCase()}-button-label`,
11792
- children: t(label, label)
11793
- }
11794
- ),
11795
- showRedDot && /* @__PURE__ */ jsx(
11796
- Box,
11797
- {
11798
- minWidth: "8px",
11799
- height: "8px",
11800
- bg: "red.500",
11801
- borderRadius: "full",
11802
- display: "flex",
11803
- alignItems: "center",
11804
- justifyContent: "center"
11805
- }
11806
- )
11807
- ] })
11840
+ /* @__PURE__ */ jsx(HStack, { p: 0, alignItems: "baseline", spacing: 1, children: /* @__PURE__ */ jsx(
11841
+ Text,
11842
+ {
11843
+ fontSize: "sm",
11844
+ fontWeight: "600",
11845
+ "data-testid": `${label.toLowerCase()}-button-label`,
11846
+ children: t(label, label)
11847
+ }
11848
+ ) })
11808
11849
  ] }),
11809
11850
  onClick
11810
11851
  }
11811
11852
  );
11812
11853
  };
11813
11854
  var QuickActionsSection = ({ mt, setCurrentContent }) => {
11814
- const { account, smartAccount, connectedWallet, connection } = useWallet();
11855
+ const { account } = useWallet();
11815
11856
  const { hasAnyBalance } = useTotalBalance({
11816
11857
  address: account?.address ?? ""
11817
11858
  });
11818
11859
  const { t } = useTranslation();
11819
- const [isFirstVisit, setIsFirstVisit] = useState(false);
11820
- useEffect(() => {
11821
- const hasVisited = localStorage.getItem("app-first-visit");
11822
- setIsFirstVisit(!hasVisited);
11823
- }, []);
11824
- const { data: upgradeRequired } = useUpgradeRequired(
11825
- smartAccount?.address ?? "",
11826
- connectedWallet?.address ?? "",
11827
- 3
11828
- );
11829
- const showRedDot = connection.isConnectedWithPrivy && upgradeRequired || isFirstVisit;
11830
11860
  return /* @__PURE__ */ jsxs(VStack, { w: "full", mt, spacing: 4, children: [
11831
- /* @__PURE__ */ jsx(Heading, { size: "xs", fontWeight: "500", w: "full", opacity: 0.5, children: t("Tools") }),
11861
+ /* @__PURE__ */ jsx(Heading, { size: "xs", fontWeight: "500", w: "full", opacity: 0.8, children: t("Tools") }),
11832
11862
  /* @__PURE__ */ jsx(Grid, { templateColumns: "repeat(3, 1fr)", gap: 2, w: "full", children: QUICK_ACTIONS.map((action) => /* @__PURE__ */ jsx(
11833
11863
  QuickActionButton,
11834
11864
  {
11835
11865
  icon: action.icon,
11836
11866
  label: action.label,
11837
11867
  onClick: () => {
11838
- if (isFirstVisit) {
11839
- localStorage.setItem("app-first-visit", "true");
11840
- setIsFirstVisit(false);
11841
- }
11842
11868
  action.onClick(setCurrentContent);
11843
11869
  },
11844
- isDisabled: action.isDisabled?.(hasAnyBalance),
11845
- showRedDot: showRedDot && action.label === "Settings"
11870
+ isDisabled: action.isDisabled?.(hasAnyBalance)
11846
11871
  },
11847
11872
  action.label
11848
11873
  )) })
@@ -12406,7 +12431,6 @@ var SettingsContent = ({
12406
12431
  /* @__PURE__ */ jsx(
12407
12432
  ActionButton,
12408
12433
  {
12409
- variant: "vechainKitLogout",
12410
12434
  style: {
12411
12435
  borderTopRadius: "0px"
12412
12436
  },
@@ -22038,19 +22062,19 @@ var VeChainKitProvider = (props) => {
22038
22062
  themeVariables: {
22039
22063
  "--vdk-modal-z-index": "10000",
22040
22064
  "--vdk-modal-width": "22rem",
22041
- "--vdk-modal-backdrop-filter": "blur(3px)",
22065
+ "--vdk-modal-backdrop-filter": "blur(15px)",
22042
22066
  "--vdk-border-dark-source-card": `1px solid ${"#ffffff0a"}`,
22043
22067
  "--vdk-border-light-source-card": `1px solid ${"#ebebeb"}`,
22044
22068
  // Dark mode colors
22045
- "--vdk-color-dark-primary": "transparent",
22069
+ "--vdk-color-dark-primary": "rgba(21, 21, 21, 0.4)",
22046
22070
  "--vdk-color-dark-primary-hover": "rgba(255, 255, 255, 0.05)",
22047
22071
  "--vdk-color-dark-primary-active": "rgba(255, 255, 255, 0.1)",
22048
- "--vdk-color-dark-secondary": "#1f1f1e",
22072
+ "--vdk-color-dark-secondary": "rgba(21, 21, 21, 0.6)",
22049
22073
  // Light mode colors
22050
- "--vdk-color-light-primary": "#ffffff",
22051
- "--vdk-color-light-primary-hover": "#f8f8f8",
22052
- "--vdk-color-light-primary-active": "#f0f0f0",
22053
- "--vdk-color-light-secondary": "white",
22074
+ "--vdk-color-light-primary": "rgba(255, 255, 255, 0.4)",
22075
+ "--vdk-color-light-primary-hover": "rgba(248, 248, 248, 0.5)",
22076
+ "--vdk-color-light-primary-active": "rgba(240, 240, 240, 0.6)",
22077
+ "--vdk-color-light-secondary": "rgba(255, 255, 255, 0.6)",
22054
22078
  // Font settings
22055
22079
  "--vdk-font-family": "var(--chakra-fonts-body)",
22056
22080
  "--vdk-font-size-medium": "14px",
@@ -22083,7 +22107,8 @@ var variants = {
22083
22107
  overflowX: "hidden",
22084
22108
  maxHeight: "550px",
22085
22109
  borderRadius: "24px",
22086
- backgroundColor: props.colorMode === "dark" ? "#1f1f1e" : "white"
22110
+ backgroundColor: props.colorMode === "dark" ? "rgba(21, 21, 21, 0.4)" : "rgba(255, 255, 255, 0.4)",
22111
+ backdropFilter: "blur(15px)"
22087
22112
  },
22088
22113
  closeButton: {
22089
22114
  borderRadius: "50%"
@@ -22094,6 +22119,9 @@ var variants = {
22094
22119
  fontSize: "md",
22095
22120
  fontWeight: "700",
22096
22121
  textAlign: "center"
22122
+ },
22123
+ overlay: {
22124
+ backgroundColor: props.colorMode === "dark" ? "#00000026" : "#00000024"
22097
22125
  }
22098
22126
  }),
22099
22127
  vechainKitTransactionToast: (props) => definePartsStyle({