@embarkai/ui-kit 0.4.121 → 0.4.123

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
@@ -1256,9 +1256,11 @@ declare class Onboarder {
1256
1256
  /** deferred DOM observer */
1257
1257
  private domObserverTimer;
1258
1258
  private domObserver;
1259
+ private onDomMutation;
1259
1260
  /** deferred resize observer */
1260
1261
  private resizeObserverTimer;
1261
1262
  private resizeObserver;
1263
+ private onResize;
1262
1264
  /** TOUR */
1263
1265
  startTour(tour: TourStep[]): void;
1264
1266
  endTour(): void;
package/dist/index.d.ts CHANGED
@@ -1256,9 +1256,11 @@ declare class Onboarder {
1256
1256
  /** deferred DOM observer */
1257
1257
  private domObserverTimer;
1258
1258
  private domObserver;
1259
+ private onDomMutation;
1259
1260
  /** deferred resize observer */
1260
1261
  private resizeObserverTimer;
1261
1262
  private resizeObserver;
1263
+ private onResize;
1262
1264
  /** TOUR */
1263
1265
  startTour(tour: TourStep[]): void;
1264
1266
  endTour(): void;
package/dist/index.js CHANGED
@@ -11745,9 +11745,9 @@ var init_useOnboardingStore = __esm({
11745
11745
  useOnboardingStore = create6((set) => ({
11746
11746
  isTourAvailable: false,
11747
11747
  setIsTourAvailable: (isTourAvailable) => set({ isTourAvailable }),
11748
- elRect: { x: window.innerWidth / 2, y: window.innerHeight / 2, width: 0, height: 0 },
11748
+ elRect: { x: 0, y: 0, width: 0, height: 0 },
11749
11749
  setElRect: (elRect) => set({ elRect }),
11750
- mountIntoNode: document.body,
11750
+ mountIntoNode: null,
11751
11751
  setMountIntoNode: (mountIntoNode) => set({ mountIntoNode })
11752
11752
  }));
11753
11753
  }
@@ -11767,7 +11767,8 @@ var init_onboarder = __esm({
11767
11767
  elements = /* @__PURE__ */ new Map();
11768
11768
  /** deferred DOM observer */
11769
11769
  domObserverTimer = null;
11770
- domObserver = new MutationObserver(([domMutation]) => {
11770
+ domObserver = null;
11771
+ onDomMutation = ([domMutation]) => {
11771
11772
  if (this.domObserverTimer) clearTimeout(this.domObserverTimer);
11772
11773
  this.domObserverTimer = setTimeout(() => {
11773
11774
  const elId = this.tour[this.tourPointer]?.elId;
@@ -11777,10 +11778,11 @@ var init_onboarder = __esm({
11777
11778
  elementRef.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
11778
11779
  useOnboardingStore.getState().setElRect({ x, y, width, height });
11779
11780
  }, 200);
11780
- });
11781
+ };
11781
11782
  /** deferred resize observer */
11782
11783
  resizeObserverTimer = null;
11783
- resizeObserver = new ResizeObserver((entries) => {
11784
+ resizeObserver = null;
11785
+ onResize = (entries) => {
11784
11786
  if (this.resizeObserverTimer) clearTimeout(this.resizeObserverTimer);
11785
11787
  this.resizeObserverTimer = setTimeout(() => {
11786
11788
  for (const entry of entries) {
@@ -11797,16 +11799,19 @@ var init_onboarder = __esm({
11797
11799
  useOnboardingStore.getState().setElRect(elRectData);
11798
11800
  }
11799
11801
  }, 200);
11800
- });
11802
+ };
11801
11803
  /** TOUR */
11802
11804
  startTour(tour) {
11803
11805
  if (!tour || tour.length === 0) return;
11804
11806
  this.tourPointer = 0;
11805
11807
  this.tour = tour;
11808
+ useOnboardingStore.getState().setElRect({ x: window.innerWidth / 2, y: window.innerHeight / 2, width: 0, height: 0 });
11806
11809
  useLayoutDataStore.getInitialState().setIsOnboarding(true);
11807
11810
  useLayoutStore.getInitialState().setIsDialogForced(true);
11808
11811
  const startElRef = this.elements.get(tour[0].elId)?.deref();
11809
11812
  if (!!startElRef) {
11813
+ this.domObserver ??= new MutationObserver(this.onDomMutation);
11814
+ this.resizeObserver ??= new ResizeObserver(this.onResize);
11810
11815
  this.domObserver.observe(startElRef, { childList: true, subtree: true });
11811
11816
  this.resizeObserver.observe(startElRef);
11812
11817
  this.resizeObserver.observe(document.body);
@@ -11815,8 +11820,8 @@ var init_onboarder = __esm({
11815
11820
  endTour() {
11816
11821
  this.tour = null;
11817
11822
  this.tourPointer = 0;
11818
- this.domObserver.disconnect();
11819
- this.resizeObserver.disconnect();
11823
+ this.domObserver?.disconnect();
11824
+ this.resizeObserver?.disconnect();
11820
11825
  useOnboardingStore.getState().setElRect({ x: window.innerWidth / 2, y: window.innerHeight / 2, width: 0, height: 0 });
11821
11826
  setTimeout(() => {
11822
11827
  useLayoutDataStore.getInitialState().setIsOnboarding(false);
@@ -11828,14 +11833,16 @@ var init_onboarder = __esm({
11828
11833
  const curStep = this.tour[this.tourPointer];
11829
11834
  curStep?.onNext?.();
11830
11835
  if (this.tourPointer === this.tour.length - 1) return this.endTour();
11831
- this.resizeObserver.disconnect();
11832
- this.domObserver.disconnect();
11836
+ this.resizeObserver?.disconnect();
11837
+ this.domObserver?.disconnect();
11833
11838
  setTimeout(() => {
11834
11839
  const nextStepPointer = this.tourPointer + 1;
11835
11840
  this.tourPointer = nextStepPointer;
11836
11841
  const nextStep = this.tour[nextStepPointer];
11837
11842
  const nextElRef = this.elements.get(nextStep.elId)?.deref();
11838
11843
  if (!!nextElRef) {
11844
+ this.domObserver ??= new MutationObserver(this.onDomMutation);
11845
+ this.resizeObserver ??= new ResizeObserver(this.onResize);
11839
11846
  this.domObserver.observe(nextElRef, { childList: true, subtree: true });
11840
11847
  this.resizeObserver.observe(nextElRef);
11841
11848
  this.resizeObserver.observe(document.body);
@@ -22835,32 +22842,98 @@ var init_onboarding_setup5 = __esm({
22835
22842
  }
22836
22843
  });
22837
22844
 
22845
+ // src/internal/components/MainMenu/constants.ts
22846
+ import { ArrowRightLeftIcon, ChevronLeft, ChevronRight as ChevronRight4, DollarSign as DollarSign2 } from "lucide-react";
22847
+ var MAIN_MENU_BUTTONS;
22848
+ var init_constants7 = __esm({
22849
+ "src/internal/components/MainMenu/constants.ts"() {
22850
+ MAIN_MENU_BUTTONS = [
22851
+ {
22852
+ id: "send",
22853
+ page: "send" /* SEND */,
22854
+ onboardingId: "mainmenu-send-button" /* sendButton */,
22855
+ label: "passport:main.send",
22856
+ icon: ChevronRight4,
22857
+ pageParams: { sendFlow: "send" }
22858
+ },
22859
+ {
22860
+ id: "bridge",
22861
+ page: "send" /* SEND */,
22862
+ onboardingId: "mainmenu-bridge-button" /* bridgeButton */,
22863
+ label: "passport:main.bridge",
22864
+ icon: ArrowRightLeftIcon,
22865
+ pageParams: { sendFlow: "bridge" }
22866
+ },
22867
+ {
22868
+ id: "receive",
22869
+ page: "receive" /* RECEIVE */,
22870
+ onboardingId: "mainmenu-receive-button" /* receiveButton */,
22871
+ label: "passport:main.receive",
22872
+ icon: ChevronLeft,
22873
+ pageParams: {}
22874
+ },
22875
+ {
22876
+ id: "buy",
22877
+ page: "buy" /* BUY */,
22878
+ onboardingId: "mainmenu-buy-button" /* buyButton */,
22879
+ label: "passport:main.buy",
22880
+ icon: DollarSign2,
22881
+ pageParams: {}
22882
+ }
22883
+ ];
22884
+ }
22885
+ });
22886
+
22838
22887
  // src/internal/components/MainMenu/MainMenu.tsx
22839
- import { ArrowRightLeftIcon, ChevronLeft, ChevronRight as ChevronRight4, DollarSign as DollarSign2, ListIcon } from "lucide-react";
22888
+ import { ListIcon } from "lucide-react";
22840
22889
  import { jsx as jsx97, jsxs as jsxs88 } from "react/jsx-runtime";
22841
22890
  function MainMenu() {
22891
+ const { config } = useProviderConfig();
22842
22892
  const { t } = useT();
22843
22893
  const { open: openEmbarkAI } = useOpenPage();
22844
22894
  const address = useSession((st) => st.address);
22845
22895
  useOnboardingTourAvailable(true);
22846
22896
  useProvidersList();
22897
+ const menuButtons = MAIN_MENU_BUTTONS.filter(({ id }) => {
22898
+ switch (id) {
22899
+ case "bridge":
22900
+ return !!config.current?.features?.showAssetBridge;
22901
+ default:
22902
+ return true;
22903
+ }
22904
+ });
22847
22905
  return /* @__PURE__ */ jsxs88(Expandable, { isExpanded: true, contentClassName: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
22848
- /* @__PURE__ */ jsx97("div", { className: "w-full grid grid-cols-4 gap-0 md:gap-[var(--ui-kit-gap)] py-[10px] md:py-1", children: MAIN_MENU_BUTTONS.map(({ page, onboardingId, label, icon: Icon2, pageParams }, btnIdx) => /* @__PURE__ */ jsxs88(
22849
- Button,
22906
+ /* @__PURE__ */ jsx97(
22907
+ "div",
22850
22908
  {
22851
- ref: (inst) => onboarder.registerElement(onboardingId, inst),
22852
- size: "large",
22853
- variant: "ghost",
22854
- disabled: !address,
22855
- className: "flex-col w-full h-fit p-0",
22856
- onClick: () => openEmbarkAI(page, pageParams),
22857
- children: [
22858
- /* @__PURE__ */ jsx97(Icon2, { className: "w-5 h-5 md:w-8 md:h-8" }),
22859
- /* @__PURE__ */ jsx97("span", { className: "text-xs font-semibold", children: t(label) })
22860
- ]
22861
- },
22862
- `${page}-${btnIdx}`
22863
- )) }),
22909
+ className: cn(
22910
+ //
22911
+ "grid w-full",
22912
+ "gap-0 md:gap-[var(--ui-kit-gap)]",
22913
+ "py-[10px] md:py-1",
22914
+ {
22915
+ "grid-cols-4": menuButtons.length === 4,
22916
+ "grid-cols-3": menuButtons.length < 4
22917
+ }
22918
+ ),
22919
+ children: menuButtons.map(({ page, onboardingId, label, icon: Icon2, pageParams }, btnIdx) => /* @__PURE__ */ jsxs88(
22920
+ Button,
22921
+ {
22922
+ ref: (inst) => onboarder.registerElement(onboardingId, inst),
22923
+ size: "large",
22924
+ variant: "ghost",
22925
+ disabled: !address,
22926
+ className: cn("flex-col w-full h-fit p-0"),
22927
+ onClick: () => openEmbarkAI(page, pageParams),
22928
+ children: [
22929
+ /* @__PURE__ */ jsx97(Icon2, { className: "w-5 h-5 md:w-8 md:h-8" }),
22930
+ /* @__PURE__ */ jsx97("span", { className: "text-xs font-semibold", children: t(label) })
22931
+ ]
22932
+ },
22933
+ `${page}-${btnIdx}`
22934
+ ))
22935
+ }
22936
+ ),
22864
22937
  /* @__PURE__ */ jsx97("div", { className: "w-full border-b border-[var(--ui-kit-bd)]" }),
22865
22938
  /* @__PURE__ */ jsxs88("div", { className: "w-full flex justify-between items-center", children: [
22866
22939
  /* @__PURE__ */ jsx97("span", { className: "pl-[var(--ui-kit-pd)] text-xl font-semibold", children: t("passport:main.assets") }),
@@ -22881,54 +22954,20 @@ function MainMenu() {
22881
22954
  /* @__PURE__ */ jsx97("div", { ref: (inst) => onboarder.registerElement("mainmenu-portfolio-section" /* portfolioSection */, inst), className: "w-full", children: /* @__PURE__ */ jsx97(PortfolioList, {}) })
22882
22955
  ] });
22883
22956
  }
22884
- var MAIN_MENU_BUTTONS;
22885
22957
  var init_MainMenu = __esm({
22886
22958
  "src/internal/components/MainMenu/MainMenu.tsx"() {
22959
+ init_ProviderContext();
22887
22960
  init_SessionContext();
22888
22961
  init_useOpenPage();
22889
22962
  init_useT();
22890
22963
  init_useLayoutDataStore();
22964
+ init_cn();
22891
22965
  init_Expandable2();
22892
22966
  init_ManageWalletMenu();
22893
22967
  init_Onboarding();
22894
22968
  init_PortfolioMenu2();
22895
22969
  init_button();
22896
- MAIN_MENU_BUTTONS = [
22897
- {
22898
- page: "send" /* SEND */,
22899
- onboardingId: "mainmenu-send-button" /* sendButton */,
22900
- label: "passport:main.send",
22901
- icon: ChevronRight4,
22902
- pageParams: { sendFlow: "send" }
22903
- },
22904
- {
22905
- page: "send" /* SEND */,
22906
- onboardingId: "mainmenu-bridge-button" /* bridgeButton */,
22907
- label: "passport:main.bridge",
22908
- icon: ArrowRightLeftIcon,
22909
- pageParams: { sendFlow: "bridge" }
22910
- },
22911
- {
22912
- page: "receive" /* RECEIVE */,
22913
- onboardingId: "mainmenu-receive-button" /* receiveButton */,
22914
- label: "passport:main.receive",
22915
- icon: ChevronLeft,
22916
- pageParams: {}
22917
- },
22918
- {
22919
- page: "buy" /* BUY */,
22920
- onboardingId: "mainmenu-buy-button" /* buyButton */,
22921
- label: "passport:main.buy",
22922
- icon: DollarSign2,
22923
- pageParams: {}
22924
- }
22925
- // {
22926
- // page: PageKey.ASSETS,
22927
- // onboardingId: MainMenuOnboardingID.portfolioButton,
22928
- // label: 'passport:main.assets',
22929
- // icon: Wallet2
22930
- // }
22931
- ];
22970
+ init_constants7();
22932
22971
  }
22933
22972
  });
22934
22973
 
@@ -23483,7 +23522,7 @@ var init_nickname_fingerprint = __esm({
23483
23522
 
23484
23523
  // src/internal/components/ReceiveMenu/ReceiveMenu.tsx
23485
23524
  import { useQuery as useQuery21 } from "@tanstack/react-query";
23486
- import { ArrowLeft as ArrowLeft19, AtSignIcon as AtSignIcon2, CheckCircle2 as CheckCircle24, Copy as Copy2, FingerprintIcon, LoaderIcon as LoaderIcon13, Wallet2Icon as Wallet2Icon4 } from "lucide-react";
23525
+ import { ArrowLeft as ArrowLeft19, AtSignIcon as AtSignIcon2, CheckCircle2 as CheckCircle24, Copy as Copy2, FingerprintIcon, LoaderIcon as LoaderIcon13, Wallet2Icon as Wallet2Icon3 } from "lucide-react";
23487
23526
  import QRCode from "qrcode";
23488
23527
  import { useEffect as useEffect40, useMemo as useMemo15, useState as useState24 } from "react";
23489
23528
  import { Fragment as Fragment35, jsx as jsx100, jsxs as jsxs91 } from "react/jsx-runtime";
@@ -23554,7 +23593,7 @@ function ReceiveMenu() {
23554
23593
  setTimeout(() => setAddressCopied(false), 2e3);
23555
23594
  },
23556
23595
  children: [
23557
- /* @__PURE__ */ jsx100(Wallet2Icon4, { className: "h-4 w-4 flex-none" }),
23596
+ /* @__PURE__ */ jsx100(Wallet2Icon3, { className: "h-4 w-4 flex-none" }),
23558
23597
  /* @__PURE__ */ jsxs91("span", { className: cn2("text-[10px] flex-1 block", { "text-[var(--ui-kit-bg-success)]": isAddressCopied }), children: [
23559
23598
  address.slice(0, 10),
23560
23599
  "...",
@@ -23720,7 +23759,7 @@ var init_useSecurityStore = __esm({
23720
23759
 
23721
23760
  // src/internal/components/SecurityMenu/constants.ts
23722
23761
  var KEYSHARE_RECOVERY_STATS_QUERY, CONNECTED_TRUSTED_APPS_QUERY;
23723
- var init_constants7 = __esm({
23762
+ var init_constants8 = __esm({
23724
23763
  "src/internal/components/SecurityMenu/constants.ts"() {
23725
23764
  KEYSHARE_RECOVERY_STATS_QUERY = "keyshare-recovery-stats-query";
23726
23765
  CONNECTED_TRUSTED_APPS_QUERY = "connected-trusted-apps-query";
@@ -23749,7 +23788,7 @@ var init_useConnectedApps = __esm({
23749
23788
  "src/internal/components/SecurityMenu/ConnectedApps/useConnectedApps.ts"() {
23750
23789
  init_SessionContext();
23751
23790
  init_httpClient();
23752
- init_constants7();
23791
+ init_constants8();
23753
23792
  }
23754
23793
  });
23755
23794
 
@@ -23974,7 +24013,7 @@ var init_UntrustApplication = __esm({
23974
24013
  init_iframe_manager();
23975
24014
  init_button();
23976
24015
  init_highlight();
23977
- init_constants7();
24016
+ init_constants8();
23978
24017
  init_useSecurityStore();
23979
24018
  }
23980
24019
  });
@@ -24130,7 +24169,7 @@ var init_useKeyshareRecoveryStats = __esm({
24130
24169
  init_keyshare();
24131
24170
  init_iframe_manager();
24132
24171
  init_vaultClient();
24133
- init_constants7();
24172
+ init_constants8();
24134
24173
  }
24135
24174
  });
24136
24175
 
@@ -24646,7 +24685,7 @@ var init_PolicyForm = __esm({
24646
24685
 
24647
24686
  // src/internal/components/SecurityMenu/UserPolicies/constants.ts
24648
24687
  var DEFAULT_POLICY_RULES;
24649
- var init_constants8 = __esm({
24688
+ var init_constants9 = __esm({
24650
24689
  "src/internal/components/SecurityMenu/UserPolicies/constants.ts"() {
24651
24690
  DEFAULT_POLICY_RULES = {
24652
24691
  destinations: { allow: [], deny: [] },
@@ -24839,7 +24878,7 @@ var init_UserPolicies = __esm({
24839
24878
  init_button();
24840
24879
  init_highlight();
24841
24880
  init_api4();
24842
- init_constants8();
24881
+ init_constants9();
24843
24882
  init_usePolicyForm();
24844
24883
  init_useUserAssetsPolicies();
24845
24884
  }
@@ -24853,7 +24892,7 @@ var init_UserPolicies2 = __esm({
24853
24892
  init_useUserAssetsPolicies();
24854
24893
  init_usePolicyForm();
24855
24894
  init_api4();
24856
- init_constants8();
24895
+ init_constants9();
24857
24896
  }
24858
24897
  });
24859
24898
 
@@ -26348,7 +26387,7 @@ var init_useBridgeBalance = __esm({
26348
26387
  });
26349
26388
 
26350
26389
  // src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx
26351
- import { ArrowLeftRightIcon, ArrowRightLeftIcon as ArrowRightLeftIcon2, LoaderIcon as LoaderIcon18, Wallet2Icon as Wallet2Icon5, XIcon as XIcon2 } from "lucide-react";
26390
+ import { ArrowLeftRightIcon, ArrowRightLeftIcon as ArrowRightLeftIcon2, LoaderIcon as LoaderIcon18, Wallet2Icon as Wallet2Icon4, XIcon as XIcon2 } from "lucide-react";
26352
26391
  import { Fragment as Fragment39 } from "react";
26353
26392
  import { Fragment as Fragment40, jsx as jsx111, jsxs as jsxs101 } from "react/jsx-runtime";
26354
26393
  function SelectStep(props) {
@@ -26567,7 +26606,7 @@ function SelectStep(props) {
26567
26606
  disabled: isQuoteEstimating || !originChain || !destinationChain || !hyperRoute,
26568
26607
  placeholder: t("passport:bridgeMenu.labels.optionalRecipient") + " (ex: 0x...)",
26569
26608
  value: recipient || "",
26570
- Icon: Wallet2Icon5,
26609
+ Icon: Wallet2Icon4,
26571
26610
  onChange: (e) => {
26572
26611
  useFlowSelectorStore.getState().setError(null);
26573
26612
  useBridgeStore.getState().setRecipient(e.target.value);
@@ -29836,7 +29875,7 @@ var init_TransactionsMenu2 = __esm({
29836
29875
  // src/internal/components/SettingsMenu/constants.ts
29837
29876
  import { ActivityIcon, ArrowLeftRight, AtSign as AtSign4, DatabaseBackup as DatabaseBackup2, Link2, LockKeyhole, UsersRound } from "lucide-react";
29838
29877
  var NAV_BUTTONS;
29839
- var init_constants9 = __esm({
29878
+ var init_constants10 = __esm({
29840
29879
  "src/internal/components/SettingsMenu/constants.ts"() {
29841
29880
  init_icons();
29842
29881
  NAV_BUTTONS = [
@@ -29932,7 +29971,7 @@ var init_SettingsMenu = __esm({
29932
29971
  init_Onboarding();
29933
29972
  init_TransactionsMenu2();
29934
29973
  init_button();
29935
- init_constants9();
29974
+ init_constants10();
29936
29975
  }
29937
29976
  });
29938
29977
 
@@ -30294,7 +30333,7 @@ var init_package = __esm({
30294
30333
  "package.json"() {
30295
30334
  package_default = {
30296
30335
  name: "@embarkai/ui-kit",
30297
- version: "0.4.121",
30336
+ version: "0.4.123",
30298
30337
  description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
30299
30338
  type: "module",
30300
30339
  main: "./dist/index.cjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embarkai/ui-kit",
3
- "version": "0.4.121",
3
+ "version": "0.4.123",
4
4
  "description": "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",