@vechain/vechain-kit 1.8.4 → 1.9.0

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.cjs CHANGED
@@ -34,9 +34,9 @@ var md = require('react-icons/md');
34
34
  var fc = require('react-icons/fc');
35
35
  var io = require('react-icons/io');
36
36
  var ci = require('react-icons/ci');
37
+ var ri = require('react-icons/ri');
37
38
  var vsc = require('react-icons/vsc');
38
39
  var fi = require('react-icons/fi');
39
- var ri = require('react-icons/ri');
40
40
  var gr = require('react-icons/gr');
41
41
  var gi = require('react-icons/gi');
42
42
  var bs = require('react-icons/bs');
@@ -4810,7 +4810,7 @@ var AddressDisplay = ({
4810
4810
 
4811
4811
  // package.json
4812
4812
  var package_default = {
4813
- version: "1.8.4"};
4813
+ version: "1.9.0"};
4814
4814
  var VersionFooter = ({ ...props }) => {
4815
4815
  const { darkMode: isDark } = useVeChainKitConfig();
4816
4816
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4878,9 +4878,11 @@ var StickyHeaderContainer = ({ children }) => {
4878
4878
  left: "0",
4879
4879
  w: "full",
4880
4880
  borderRadius: "24px 24px 0px 0px",
4881
- bg: isDark ? "rgb(31 31 30 / 90%)" : "rgb(255 255 255 / 69%)",
4882
- backdropFilter: "blur(12px)",
4883
- style: { WebkitBackdropFilter: "blur(12px)" },
4881
+ bg: hasContentBelow ? isDark ? "rgba(21, 21, 21, 0.6)" : "rgba(255, 255, 255, 0.6)" : "transparent",
4882
+ backdropFilter: hasContentBelow ? "blur(15px)" : "none",
4883
+ style: hasContentBelow ? { WebkitBackdropFilter: "blur(15px)" } : {
4884
+ WebkitBackdropFilter: "none"
4885
+ },
4884
4886
  zIndex: 1e3,
4885
4887
  boxShadow: hasContentBelow ? "0px 2px 4px 1px rgb(0 0 0 / 10%)" : "none",
4886
4888
  transition: "box-shadow 0.2s ease-in-out",
@@ -11198,23 +11200,74 @@ var MainContent = ({ setCurrentContent, onClose }) => {
11198
11200
  ) }) }) : /* @__PURE__ */ jsxRuntime.jsx(react.ModalFooter, { pt: 0, pb: "5px" })
11199
11201
  ] });
11200
11202
  };
11203
+ var ModalSettingsButton = ({
11204
+ onClick,
11205
+ ...props
11206
+ }) => {
11207
+ const { smartAccount, connectedWallet, connection } = useWallet();
11208
+ const [isFirstVisit, setIsFirstVisit] = React10.useState(false);
11209
+ React10.useEffect(() => {
11210
+ const hasVisited = localStorage.getItem("app-first-visit");
11211
+ setIsFirstVisit(!hasVisited);
11212
+ }, []);
11213
+ const { data: upgradeRequired } = useUpgradeRequired(
11214
+ smartAccount?.address ?? "",
11215
+ connectedWallet?.address ?? "",
11216
+ 3
11217
+ );
11218
+ const showRedDot = connection.isConnectedWithPrivy && upgradeRequired || isFirstVisit;
11219
+ const handleOnClick = () => {
11220
+ if (isFirstVisit) {
11221
+ localStorage.setItem("app-first-visit", "true");
11222
+ setIsFirstVisit(false);
11223
+ }
11224
+ onClick();
11225
+ };
11226
+ return /* @__PURE__ */ jsxRuntime.jsx(
11227
+ react.IconButton,
11228
+ {
11229
+ "aria-label": "Notifications",
11230
+ size: "sm",
11231
+ variant: "ghost",
11232
+ _hover: { bg: "blackAlpha.100" },
11233
+ _dark: { _hover: { bg: "whiteAlpha.100" } },
11234
+ position: "absolute",
11235
+ borderRadius: "50%",
11236
+ left: "10px",
11237
+ top: "10px",
11238
+ onClick: handleOnClick,
11239
+ icon: /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { position: "relative", children: [
11240
+ /* @__PURE__ */ jsxRuntime.jsx(io.IoMdSettings, { fontSize: "20px" }),
11241
+ showRedDot && /* @__PURE__ */ jsxRuntime.jsx(
11242
+ react.Box,
11243
+ {
11244
+ position: "absolute",
11245
+ top: "-1px",
11246
+ right: "-1px",
11247
+ minWidth: "8px",
11248
+ height: "8px",
11249
+ bg: "red.500",
11250
+ borderRadius: "full"
11251
+ }
11252
+ )
11253
+ ] }),
11254
+ ...props
11255
+ }
11256
+ );
11257
+ };
11201
11258
  var AccountMainContent = ({ setCurrentContent, wallet }) => {
11202
11259
  const { t } = reactI18next.useTranslation();
11203
11260
  const { network } = useVeChainKitConfig();
11204
- const { getNotifications } = useNotifications();
11205
- const notifications = getNotifications();
11206
- const hasUnreadNotifications = notifications.some((n) => !n.isRead);
11207
11261
  return /* @__PURE__ */ jsxRuntime.jsxs(ScrollToTopWrapper, { children: [
11208
11262
  /* @__PURE__ */ jsxRuntime.jsxs(StickyHeaderContainer, { children: [
11209
11263
  /* @__PURE__ */ jsxRuntime.jsx(
11210
- ModalNotificationButton,
11264
+ ModalSettingsButton,
11211
11265
  {
11212
11266
  onClick: () => {
11213
11267
  Analytics.notifications.viewed();
11214
- setCurrentContent("notifications");
11268
+ setCurrentContent("settings");
11215
11269
  },
11216
- hasUnreadNotifications,
11217
- "data-testid": "notifications-button"
11270
+ "data-testid": "settings-button"
11218
11271
  }
11219
11272
  ),
11220
11273
  /* @__PURE__ */ jsxRuntime.jsx(react.ModalHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -11265,7 +11318,8 @@ var AccountMainContent = ({ setCurrentContent, wallet }) => {
11265
11318
  onClick: () => {
11266
11319
  setCurrentContent("profile");
11267
11320
  },
11268
- wallet
11321
+ wallet,
11322
+ setCurrentContent
11269
11323
  }
11270
11324
  ),
11271
11325
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -11431,9 +11485,11 @@ var AccountSelector = ({
11431
11485
  size = "md",
11432
11486
  onClick,
11433
11487
  mt,
11434
- style
11488
+ style,
11489
+ setCurrentContent
11435
11490
  }) => {
11436
11491
  const [copied, setCopied] = React10.useState(false);
11492
+ const { disconnect } = useWallet();
11437
11493
  const copyToClipboard = async () => {
11438
11494
  await navigator.clipboard.writeText(
11439
11495
  wallet?.domain ?? wallet?.address ?? ""
@@ -11443,6 +11499,11 @@ var AccountSelector = ({
11443
11499
  setCopied(false);
11444
11500
  }, 2e3);
11445
11501
  };
11502
+ const handleLogout = () => {
11503
+ Analytics.auth.trackAuth("disconnect_initiated");
11504
+ disconnect();
11505
+ Analytics.auth.logoutCompleted();
11506
+ };
11446
11507
  return /* @__PURE__ */ jsxRuntime.jsxs(
11447
11508
  react.HStack,
11448
11509
  {
@@ -11504,6 +11565,25 @@ var AccountSelector = ({
11504
11565
  opacity: 0.5,
11505
11566
  _hover: { opacity: 0.8 }
11506
11567
  }
11568
+ ),
11569
+ /* @__PURE__ */ jsxRuntime.jsx(
11570
+ react.IconButton,
11571
+ {
11572
+ "aria-label": "Logout",
11573
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { as: ri.RiLogoutBoxLine }),
11574
+ onClick: () => setCurrentContent({
11575
+ type: "disconnect-confirm",
11576
+ props: {
11577
+ onDisconnect: handleLogout,
11578
+ onBack: () => setCurrentContent("main")
11579
+ }
11580
+ }),
11581
+ variant: "ghost",
11582
+ size: "sm",
11583
+ opacity: 0.5,
11584
+ _hover: { opacity: 0.8 },
11585
+ colorScheme: "red"
11586
+ }
11507
11587
  )
11508
11588
  ]
11509
11589
  }
@@ -11631,7 +11711,7 @@ var BalanceSection = ({
11631
11711
  }, 1500);
11632
11712
  };
11633
11713
  return /* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { w: "full", justifyContent: "start", spacing: 2, mt, mb, children: [
11634
- /* @__PURE__ */ jsxRuntime.jsx(react.Heading, { size: "xs", fontWeight: "500", w: "full", opacity: 0.5, children: t("Balance") }),
11714
+ /* @__PURE__ */ jsxRuntime.jsx(react.Heading, { size: "xs", fontWeight: "500", w: "full", opacity: 0.8, children: t("Balance") }),
11635
11715
  /* @__PURE__ */ jsxRuntime.jsxs(
11636
11716
  react.HStack,
11637
11717
  {
@@ -11718,11 +11798,11 @@ var BalanceSection = ({
11718
11798
  };
11719
11799
  var QUICK_ACTIONS = [
11720
11800
  {
11721
- icon: md.MdSwapHoriz,
11722
- label: "Swap",
11801
+ icon: io.IoMdApps,
11802
+ label: "Ecosystem",
11723
11803
  onClick: (setCurrentContent) => {
11724
- Analytics.swap.opened();
11725
- setCurrentContent("swap-token");
11804
+ Analytics.ecosystem.opened();
11805
+ setCurrentContent("ecosystem");
11726
11806
  }
11727
11807
  },
11728
11808
  {
@@ -11744,38 +11824,13 @@ var QUICK_ACTIONS = [
11744
11824
  }
11745
11825
  }),
11746
11826
  isDisabled: (hasAnyBalance) => !hasAnyBalance
11747
- },
11748
- {
11749
- icon: ri.RiSwap3Line,
11750
- label: "Bridge",
11751
- onClick: (setCurrentContent) => {
11752
- Analytics.bridge.opened();
11753
- setCurrentContent("bridge");
11754
- }
11755
- },
11756
- {
11757
- icon: io.IoMdApps,
11758
- label: "Ecosystem",
11759
- onClick: (setCurrentContent) => {
11760
- Analytics.ecosystem.opened();
11761
- setCurrentContent("ecosystem");
11762
- }
11763
- },
11764
- {
11765
- icon: io.IoMdSettings,
11766
- label: "Settings",
11767
- onClick: (setCurrentContent) => {
11768
- Analytics.settings.opened("general");
11769
- setCurrentContent("settings");
11770
- }
11771
11827
  }
11772
11828
  ];
11773
11829
  var QuickActionButton = ({
11774
11830
  icon,
11775
11831
  label,
11776
11832
  onClick,
11777
- isDisabled,
11778
- showRedDot
11833
+ isDisabled
11779
11834
  }) => {
11780
11835
  const { t } = reactI18next.useTranslation();
11781
11836
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -11788,67 +11843,37 @@ var QuickActionButton = ({
11788
11843
  isDisabled,
11789
11844
  icon: /* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { spacing: 4, children: [
11790
11845
  /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { as: icon, boxSize: 5, opacity: 0.9 }),
11791
- /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { p: 0, alignItems: "baseline", spacing: 1, children: [
11792
- /* @__PURE__ */ jsxRuntime.jsx(
11793
- react.Text,
11794
- {
11795
- fontSize: "sm",
11796
- fontWeight: "600",
11797
- "data-testid": `${label.toLowerCase()}-button-label`,
11798
- children: t(label, label)
11799
- }
11800
- ),
11801
- showRedDot && /* @__PURE__ */ jsxRuntime.jsx(
11802
- react.Box,
11803
- {
11804
- minWidth: "8px",
11805
- height: "8px",
11806
- bg: "red.500",
11807
- borderRadius: "full",
11808
- display: "flex",
11809
- alignItems: "center",
11810
- justifyContent: "center"
11811
- }
11812
- )
11813
- ] })
11846
+ /* @__PURE__ */ jsxRuntime.jsx(react.HStack, { p: 0, alignItems: "baseline", spacing: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
11847
+ react.Text,
11848
+ {
11849
+ fontSize: "sm",
11850
+ fontWeight: "600",
11851
+ "data-testid": `${label.toLowerCase()}-button-label`,
11852
+ children: t(label, label)
11853
+ }
11854
+ ) })
11814
11855
  ] }),
11815
11856
  onClick
11816
11857
  }
11817
11858
  );
11818
11859
  };
11819
11860
  var QuickActionsSection = ({ mt, setCurrentContent }) => {
11820
- const { account, smartAccount, connectedWallet, connection } = useWallet();
11861
+ const { account } = useWallet();
11821
11862
  const { hasAnyBalance } = useTotalBalance({
11822
11863
  address: account?.address ?? ""
11823
11864
  });
11824
11865
  const { t } = reactI18next.useTranslation();
11825
- const [isFirstVisit, setIsFirstVisit] = React10.useState(false);
11826
- React10.useEffect(() => {
11827
- const hasVisited = localStorage.getItem("app-first-visit");
11828
- setIsFirstVisit(!hasVisited);
11829
- }, []);
11830
- const { data: upgradeRequired } = useUpgradeRequired(
11831
- smartAccount?.address ?? "",
11832
- connectedWallet?.address ?? "",
11833
- 3
11834
- );
11835
- const showRedDot = connection.isConnectedWithPrivy && upgradeRequired || isFirstVisit;
11836
11866
  return /* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { w: "full", mt, spacing: 4, children: [
11837
- /* @__PURE__ */ jsxRuntime.jsx(react.Heading, { size: "xs", fontWeight: "500", w: "full", opacity: 0.5, children: t("Tools") }),
11867
+ /* @__PURE__ */ jsxRuntime.jsx(react.Heading, { size: "xs", fontWeight: "500", w: "full", opacity: 0.8, children: t("Tools") }),
11838
11868
  /* @__PURE__ */ jsxRuntime.jsx(react.Grid, { templateColumns: "repeat(3, 1fr)", gap: 2, w: "full", children: QUICK_ACTIONS.map((action) => /* @__PURE__ */ jsxRuntime.jsx(
11839
11869
  QuickActionButton,
11840
11870
  {
11841
11871
  icon: action.icon,
11842
11872
  label: action.label,
11843
11873
  onClick: () => {
11844
- if (isFirstVisit) {
11845
- localStorage.setItem("app-first-visit", "true");
11846
- setIsFirstVisit(false);
11847
- }
11848
11874
  action.onClick(setCurrentContent);
11849
11875
  },
11850
- isDisabled: action.isDisabled?.(hasAnyBalance),
11851
- showRedDot: showRedDot && action.label === "Settings"
11876
+ isDisabled: action.isDisabled?.(hasAnyBalance)
11852
11877
  },
11853
11878
  action.label
11854
11879
  )) })
@@ -12412,7 +12437,6 @@ var SettingsContent = ({
12412
12437
  /* @__PURE__ */ jsxRuntime.jsx(
12413
12438
  ActionButton,
12414
12439
  {
12415
- variant: "vechainKitLogout",
12416
12440
  style: {
12417
12441
  borderTopRadius: "0px"
12418
12442
  },
@@ -22044,19 +22068,19 @@ var VeChainKitProvider = (props) => {
22044
22068
  themeVariables: {
22045
22069
  "--vdk-modal-z-index": "10000",
22046
22070
  "--vdk-modal-width": "22rem",
22047
- "--vdk-modal-backdrop-filter": "blur(3px)",
22071
+ "--vdk-modal-backdrop-filter": "blur(15px)",
22048
22072
  "--vdk-border-dark-source-card": `1px solid ${"#ffffff0a"}`,
22049
22073
  "--vdk-border-light-source-card": `1px solid ${"#ebebeb"}`,
22050
22074
  // Dark mode colors
22051
- "--vdk-color-dark-primary": "transparent",
22075
+ "--vdk-color-dark-primary": "rgba(21, 21, 21, 0.4)",
22052
22076
  "--vdk-color-dark-primary-hover": "rgba(255, 255, 255, 0.05)",
22053
22077
  "--vdk-color-dark-primary-active": "rgba(255, 255, 255, 0.1)",
22054
- "--vdk-color-dark-secondary": "#1f1f1e",
22078
+ "--vdk-color-dark-secondary": "rgba(21, 21, 21, 0.6)",
22055
22079
  // Light mode colors
22056
- "--vdk-color-light-primary": "#ffffff",
22057
- "--vdk-color-light-primary-hover": "#f8f8f8",
22058
- "--vdk-color-light-primary-active": "#f0f0f0",
22059
- "--vdk-color-light-secondary": "white",
22080
+ "--vdk-color-light-primary": "rgba(255, 255, 255, 0.4)",
22081
+ "--vdk-color-light-primary-hover": "rgba(248, 248, 248, 0.5)",
22082
+ "--vdk-color-light-primary-active": "rgba(240, 240, 240, 0.6)",
22083
+ "--vdk-color-light-secondary": "rgba(255, 255, 255, 0.6)",
22060
22084
  // Font settings
22061
22085
  "--vdk-font-family": "var(--chakra-fonts-body)",
22062
22086
  "--vdk-font-size-medium": "14px",
@@ -22089,7 +22113,8 @@ var variants = {
22089
22113
  overflowX: "hidden",
22090
22114
  maxHeight: "550px",
22091
22115
  borderRadius: "24px",
22092
- backgroundColor: props.colorMode === "dark" ? "#1f1f1e" : "white"
22116
+ backgroundColor: props.colorMode === "dark" ? "rgba(21, 21, 21, 0.4)" : "rgba(255, 255, 255, 0.4)",
22117
+ backdropFilter: "blur(15px)"
22093
22118
  },
22094
22119
  closeButton: {
22095
22120
  borderRadius: "50%"
@@ -22100,6 +22125,9 @@ var variants = {
22100
22125
  fontSize: "md",
22101
22126
  fontWeight: "700",
22102
22127
  textAlign: "center"
22128
+ },
22129
+ overlay: {
22130
+ backgroundColor: props.colorMode === "dark" ? "#00000026" : "#00000024"
22103
22131
  }
22104
22132
  }),
22105
22133
  vechainKitTransactionToast: (props) => definePartsStyle({