@loafmarkets/ui 0.1.16 → 0.1.18
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.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +231 -68
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +231 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4437,15 +4437,15 @@ var PriceBlock = styled23__default.default.span`
|
|
|
4437
4437
|
border-left: 1px solid rgba(255, 255, 255, 0.25);
|
|
4438
4438
|
min-height: 1.5rem;
|
|
4439
4439
|
`;
|
|
4440
|
-
var DEFAULT_TRADE_URL = "https://loafx-frontend-web.vercel.app/";
|
|
4441
4440
|
var DEFAULT_TRADE_PATH = "/trade";
|
|
4442
4441
|
var DEFAULT_HOME_PATH = "/";
|
|
4443
4442
|
var DEFAULT_ABOUT_PATH = "/about";
|
|
4444
|
-
var
|
|
4443
|
+
var DEFAULT_LEARN_PATH = "/learn";
|
|
4445
4444
|
var DEFAULT_PROPERTY_MAP_PATH = "/map";
|
|
4445
|
+
var DEFAULT_PORTFOLIO_PATH = "/portfolio";
|
|
4446
4446
|
var DEFAULT_LOAF_LIQUIDITY_PATH = "/loaf-liquidity";
|
|
4447
|
-
var DEFAULT_AUTH_LOGIN_URL = "http://localhost:5174/";
|
|
4448
4447
|
var DEFAULT_AUTH_RETURN_PARAM = "returnTo";
|
|
4448
|
+
var LOGIN_POPUP_EVENT = "loaf:open-login-popup";
|
|
4449
4449
|
var Header = ({
|
|
4450
4450
|
currentUser,
|
|
4451
4451
|
isAuthenticated = false,
|
|
@@ -4455,14 +4455,15 @@ var Header = ({
|
|
|
4455
4455
|
onLogout,
|
|
4456
4456
|
onSignInClick,
|
|
4457
4457
|
loginPopupComponent: LoginPopupComponent,
|
|
4458
|
-
tradeUrl = DEFAULT_TRADE_URL,
|
|
4459
4458
|
tradePath = DEFAULT_TRADE_PATH,
|
|
4460
4459
|
homePath = DEFAULT_HOME_PATH,
|
|
4461
4460
|
aboutPath = DEFAULT_ABOUT_PATH,
|
|
4462
|
-
|
|
4461
|
+
learnPath = DEFAULT_LEARN_PATH,
|
|
4462
|
+
offeringsPath,
|
|
4463
4463
|
propertyMapPath = DEFAULT_PROPERTY_MAP_PATH,
|
|
4464
|
+
portfolioPath = DEFAULT_PORTFOLIO_PATH,
|
|
4464
4465
|
loafLiquidityPath = DEFAULT_LOAF_LIQUIDITY_PATH,
|
|
4465
|
-
authLoginUrl
|
|
4466
|
+
authLoginUrl,
|
|
4466
4467
|
authReturnParam = DEFAULT_AUTH_RETURN_PARAM,
|
|
4467
4468
|
getAuthReturnUrl,
|
|
4468
4469
|
logoHref,
|
|
@@ -4478,13 +4479,23 @@ var Header = ({
|
|
|
4478
4479
|
const [isMoreMenuOpen, setIsMoreMenuOpen] = React5.useState(false);
|
|
4479
4480
|
const [showLoginPopup, setShowLoginPopup] = React5.useState(false);
|
|
4480
4481
|
const [loginPopupInitialView, setLoginPopupInitialView] = React5.useState(void 0);
|
|
4482
|
+
React5.useEffect(() => {
|
|
4483
|
+
console.log("[LoginTrace][Header] mounted");
|
|
4484
|
+
return () => console.log("[LoginTrace][Header] unmounted");
|
|
4485
|
+
}, []);
|
|
4486
|
+
React5.useEffect(() => {
|
|
4487
|
+
console.log("[LoginTrace][Header] showLoginPopup changed", { showLoginPopup, loginPopupInitialView });
|
|
4488
|
+
}, [showLoginPopup, loginPopupInitialView]);
|
|
4489
|
+
React5.useEffect(() => {
|
|
4490
|
+
console.log("[LoginTrace][Header] loginPopupComponent updated", { hasComponent: Boolean(LoginPopupComponent) });
|
|
4491
|
+
}, [LoginPopupComponent]);
|
|
4481
4492
|
React5.useEffect(() => {
|
|
4482
4493
|
const handleClickOutside = (event) => {
|
|
4483
4494
|
const target = event.target;
|
|
4484
4495
|
if (!target) return;
|
|
4485
4496
|
const clickedInsideUserMenu = target.closest(".user-menu") || target.closest(".user-menu-dropdown");
|
|
4486
4497
|
if (isUserMenuOpen && !clickedInsideUserMenu) {
|
|
4487
|
-
console.log("[Header] Closing user menu due to outside click");
|
|
4498
|
+
console.log("[LoginTrace][Header] Closing user menu due to outside click");
|
|
4488
4499
|
setIsUserMenuOpen(false);
|
|
4489
4500
|
}
|
|
4490
4501
|
if (isMobileMenuOpen && !target.closest(".mobile-menu") && !target.closest(".mobile-menu-button")) {
|
|
@@ -4499,6 +4510,19 @@ var Header = ({
|
|
|
4499
4510
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
4500
4511
|
};
|
|
4501
4512
|
}, [isUserMenuOpen, isMobileMenuOpen, isMoreMenuOpen]);
|
|
4513
|
+
React5.useEffect(() => {
|
|
4514
|
+
if (typeof window === "undefined") return;
|
|
4515
|
+
const handleExternalLoginPopup = (event) => {
|
|
4516
|
+
const customEvent = event;
|
|
4517
|
+
setLoginPopupInitialView(customEvent.detail?.initialView);
|
|
4518
|
+
console.log("[LoginTrace][Header] Received LOGIN_POPUP_EVENT", customEvent.detail);
|
|
4519
|
+
setShowLoginPopup(true);
|
|
4520
|
+
};
|
|
4521
|
+
window.addEventListener(LOGIN_POPUP_EVENT, handleExternalLoginPopup);
|
|
4522
|
+
return () => {
|
|
4523
|
+
window.removeEventListener(LOGIN_POPUP_EVENT, handleExternalLoginPopup);
|
|
4524
|
+
};
|
|
4525
|
+
}, []);
|
|
4502
4526
|
const closeMenus = () => {
|
|
4503
4527
|
setIsMobileMenuOpen(false);
|
|
4504
4528
|
setIsUserMenuOpen(false);
|
|
@@ -4506,7 +4530,7 @@ var Header = ({
|
|
|
4506
4530
|
};
|
|
4507
4531
|
const handleUserMenuToggle = () => {
|
|
4508
4532
|
const nextState = !isUserMenuOpen;
|
|
4509
|
-
console.log("[Header] User dropdown toggle clicked", { nextState });
|
|
4533
|
+
console.log("[LoginTrace][Header] User dropdown toggle clicked", { nextState });
|
|
4510
4534
|
setIsUserMenuOpen(nextState);
|
|
4511
4535
|
};
|
|
4512
4536
|
const performNavigation = (path) => {
|
|
@@ -4535,7 +4559,7 @@ var Header = ({
|
|
|
4535
4559
|
onLoafLiquidityClick();
|
|
4536
4560
|
return;
|
|
4537
4561
|
}
|
|
4538
|
-
performNavigation(
|
|
4562
|
+
performNavigation(resolvedLoafLiquidityPath);
|
|
4539
4563
|
};
|
|
4540
4564
|
const handleTradeNavigation = () => {
|
|
4541
4565
|
closeMenus();
|
|
@@ -4543,20 +4567,18 @@ var Header = ({
|
|
|
4543
4567
|
onTradeClick();
|
|
4544
4568
|
return;
|
|
4545
4569
|
}
|
|
4546
|
-
|
|
4547
|
-
window.location.href = tradeUrl;
|
|
4548
|
-
}
|
|
4570
|
+
performNavigation(resolvedTradePath);
|
|
4549
4571
|
};
|
|
4550
4572
|
const handleLogoutClick = async (event) => {
|
|
4551
4573
|
event?.preventDefault();
|
|
4552
4574
|
closeMenus();
|
|
4553
|
-
console.log("[Header] Logout option selected, invoking onLogout handler");
|
|
4575
|
+
console.log("[LoginTrace][Header] Logout option selected, invoking onLogout handler");
|
|
4554
4576
|
await onLogout?.();
|
|
4555
4577
|
};
|
|
4556
4578
|
const handleAddFundingClick = (event) => {
|
|
4557
4579
|
event?.preventDefault();
|
|
4558
4580
|
closeMenus();
|
|
4559
|
-
console.log("[Header] Add funding selected");
|
|
4581
|
+
console.log("[LoginTrace][Header] Add funding selected");
|
|
4560
4582
|
if (LoginPopupComponent) {
|
|
4561
4583
|
setLoginPopupInitialView("funding");
|
|
4562
4584
|
setShowLoginPopup(true);
|
|
@@ -4565,7 +4587,7 @@ var Header = ({
|
|
|
4565
4587
|
const handlePortfolioNavigate = (event) => {
|
|
4566
4588
|
event?.preventDefault();
|
|
4567
4589
|
closeMenus();
|
|
4568
|
-
console.log("[Header] Portfolio selected");
|
|
4590
|
+
console.log("[LoginTrace][Header] Portfolio selected");
|
|
4569
4591
|
if (_onOrdersNavigate) {
|
|
4570
4592
|
_onOrdersNavigate();
|
|
4571
4593
|
return;
|
|
@@ -4607,6 +4629,7 @@ var Header = ({
|
|
|
4607
4629
|
return false;
|
|
4608
4630
|
};
|
|
4609
4631
|
const handleSignIn = () => {
|
|
4632
|
+
console.log("[LoginTrace][Header] handleSignIn invoked", { hasCustomHandler: Boolean(onSignInClick) });
|
|
4610
4633
|
if (onSignInClick) {
|
|
4611
4634
|
onSignInClick();
|
|
4612
4635
|
return;
|
|
@@ -4615,15 +4638,32 @@ var Header = ({
|
|
|
4615
4638
|
return;
|
|
4616
4639
|
}
|
|
4617
4640
|
if (LoginPopupComponent) {
|
|
4641
|
+
console.log("[LoginTrace][Header] Opening login popup via handleSignIn");
|
|
4618
4642
|
setShowLoginPopup(true);
|
|
4619
4643
|
}
|
|
4620
4644
|
};
|
|
4645
|
+
const handleLoginPopupClose = React5__namespace.default.useCallback(() => {
|
|
4646
|
+
console.log("[LoginTrace][Header] Closing login popup via onClose handler");
|
|
4647
|
+
setShowLoginPopup(false);
|
|
4648
|
+
setLoginPopupInitialView(void 0);
|
|
4649
|
+
}, []);
|
|
4650
|
+
const resolvedTradePath = tradePath ?? DEFAULT_TRADE_PATH;
|
|
4651
|
+
const resolvedHomePath = homePath ?? DEFAULT_HOME_PATH;
|
|
4652
|
+
const resolvedAboutPath = aboutPath ?? DEFAULT_ABOUT_PATH;
|
|
4653
|
+
const resolvedLearnPath = learnPath ?? DEFAULT_LEARN_PATH;
|
|
4654
|
+
const resolvedOfferingsPath = offeringsPath ?? void 0;
|
|
4655
|
+
const offeringsHref = resolvedOfferingsPath ?? resolvedHomePath;
|
|
4656
|
+
const resolvedPropertyMapPath = propertyMapPath ?? DEFAULT_PROPERTY_MAP_PATH;
|
|
4657
|
+
const resolvedPortfolioPath = portfolioPath ?? DEFAULT_PORTFOLIO_PATH;
|
|
4658
|
+
const resolvedLoafLiquidityPath = loafLiquidityPath ?? DEFAULT_LOAF_LIQUIDITY_PATH;
|
|
4621
4659
|
const inferredActiveTab = (() => {
|
|
4622
|
-
if (locationPath ===
|
|
4623
|
-
if (locationPath ===
|
|
4624
|
-
if (locationPath ===
|
|
4625
|
-
if (locationPath
|
|
4626
|
-
if (
|
|
4660
|
+
if (locationPath === resolvedTradePath) return "trade";
|
|
4661
|
+
if (locationPath === resolvedHomePath) return "home";
|
|
4662
|
+
if (locationPath === resolvedAboutPath) return "about";
|
|
4663
|
+
if (locationPath === resolvedLearnPath) return "learn";
|
|
4664
|
+
if (resolvedOfferingsPath && locationPath.startsWith(resolvedOfferingsPath)) return "offerings";
|
|
4665
|
+
if (locationPath === resolvedPropertyMapPath) return "propertyMap";
|
|
4666
|
+
if (locationPath === resolvedPortfolioPath) return "portfolio";
|
|
4627
4667
|
return null;
|
|
4628
4668
|
})();
|
|
4629
4669
|
const resolvedActiveTab = activeTab ?? inferredActiveTab;
|
|
@@ -4632,12 +4672,14 @@ var Header = ({
|
|
|
4632
4672
|
const offeringsActive = resolvedActiveTab === "offerings";
|
|
4633
4673
|
const propertyMapActive = resolvedActiveTab === "propertyMap";
|
|
4634
4674
|
const aboutActive = resolvedActiveTab === "about";
|
|
4675
|
+
const portfolioActive = resolvedActiveTab === "portfolio";
|
|
4676
|
+
const learnActive = resolvedActiveTab === "learn";
|
|
4635
4677
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4636
4678
|
/* @__PURE__ */ jsxRuntime.jsx(Overlay, { $isOpen: isMobileMenuOpen, onClick: () => setIsMobileMenuOpen(false) }),
|
|
4637
4679
|
/* @__PURE__ */ jsxRuntime.jsxs(HeaderContainer, { children: [
|
|
4638
4680
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
4639
4681
|
/* @__PURE__ */ jsxRuntime.jsxs(Logo, { children: [
|
|
4640
|
-
/* @__PURE__ */ jsxRuntime.jsx(LogoLink, { href: logoHref ??
|
|
4682
|
+
/* @__PURE__ */ jsxRuntime.jsx(LogoLink, { href: logoHref ?? resolvedHomePath, onClick: handleLogoNavigation, children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: Loaf_logo_Banner_default, alt: "LOAF Logo" }) }),
|
|
4641
4683
|
/* @__PURE__ */ jsxRuntime.jsx("h1", { children: "LOAF" })
|
|
4642
4684
|
] }),
|
|
4643
4685
|
/* @__PURE__ */ jsxRuntime.jsxs(Nav, { $isOpen: isMobileMenuOpen, className: "mobile-menu", children: [
|
|
@@ -4650,11 +4692,11 @@ var Header = ({
|
|
|
4650
4692
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4651
4693
|
NavLink,
|
|
4652
4694
|
{
|
|
4653
|
-
href:
|
|
4695
|
+
href: resolvedHomePath,
|
|
4654
4696
|
className: homeActive ? "active" : "",
|
|
4655
4697
|
onClick: (event) => {
|
|
4656
4698
|
event.preventDefault();
|
|
4657
|
-
handleNavigation(
|
|
4699
|
+
handleNavigation(resolvedHomePath);
|
|
4658
4700
|
},
|
|
4659
4701
|
children: "Home"
|
|
4660
4702
|
}
|
|
@@ -4662,7 +4704,7 @@ var Header = ({
|
|
|
4662
4704
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4663
4705
|
NavLink,
|
|
4664
4706
|
{
|
|
4665
|
-
href:
|
|
4707
|
+
href: resolvedTradePath,
|
|
4666
4708
|
className: tradeActive ? "active" : "",
|
|
4667
4709
|
onClick: (event) => {
|
|
4668
4710
|
event.preventDefault();
|
|
@@ -4674,23 +4716,35 @@ var Header = ({
|
|
|
4674
4716
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4675
4717
|
NavLink,
|
|
4676
4718
|
{
|
|
4677
|
-
href:
|
|
4719
|
+
href: resolvedPortfolioPath,
|
|
4720
|
+
className: portfolioActive ? "active" : "",
|
|
4721
|
+
onClick: (event) => {
|
|
4722
|
+
event.preventDefault();
|
|
4723
|
+
handleNavigation(resolvedPortfolioPath);
|
|
4724
|
+
},
|
|
4725
|
+
children: "Portfolio"
|
|
4726
|
+
}
|
|
4727
|
+
),
|
|
4728
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4729
|
+
NavLink,
|
|
4730
|
+
{
|
|
4731
|
+
href: offeringsHref,
|
|
4678
4732
|
className: offeringsActive ? "active" : "",
|
|
4679
4733
|
onClick: (event) => {
|
|
4680
4734
|
event.preventDefault();
|
|
4681
|
-
handleNavigation(
|
|
4735
|
+
handleNavigation(offeringsHref);
|
|
4682
4736
|
},
|
|
4683
|
-
children: "Offerings"
|
|
4737
|
+
children: "Initial Offerings"
|
|
4684
4738
|
}
|
|
4685
4739
|
),
|
|
4686
4740
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4687
4741
|
NavLink,
|
|
4688
4742
|
{
|
|
4689
|
-
href:
|
|
4743
|
+
href: resolvedPropertyMapPath,
|
|
4690
4744
|
className: propertyMapActive ? "active" : "",
|
|
4691
4745
|
onClick: (event) => {
|
|
4692
4746
|
event.preventDefault();
|
|
4693
|
-
handleNavigation(
|
|
4747
|
+
handleNavigation(resolvedPropertyMapPath);
|
|
4694
4748
|
},
|
|
4695
4749
|
children: "Property Map"
|
|
4696
4750
|
}
|
|
@@ -4698,11 +4752,23 @@ var Header = ({
|
|
|
4698
4752
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4699
4753
|
NavLink,
|
|
4700
4754
|
{
|
|
4701
|
-
href:
|
|
4755
|
+
href: resolvedLearnPath,
|
|
4756
|
+
className: learnActive ? "active" : "",
|
|
4757
|
+
onClick: (event) => {
|
|
4758
|
+
event.preventDefault();
|
|
4759
|
+
handleNavigation(resolvedLearnPath);
|
|
4760
|
+
},
|
|
4761
|
+
children: "Learn"
|
|
4762
|
+
}
|
|
4763
|
+
),
|
|
4764
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4765
|
+
NavLink,
|
|
4766
|
+
{
|
|
4767
|
+
href: resolvedAboutPath,
|
|
4702
4768
|
className: aboutActive ? "active" : "",
|
|
4703
4769
|
onClick: (event) => {
|
|
4704
4770
|
event.preventDefault();
|
|
4705
|
-
handleNavigation(
|
|
4771
|
+
handleNavigation(resolvedAboutPath);
|
|
4706
4772
|
},
|
|
4707
4773
|
children: "About"
|
|
4708
4774
|
}
|
|
@@ -4732,7 +4798,7 @@ var Header = ({
|
|
|
4732
4798
|
/* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zM5 9.5C5 7.01 7.01 5 9.5 5S14 7.01 14 9.5 11.99 14 9.5 14 5 11.99 5 9.5z" }) }),
|
|
4733
4799
|
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "text", placeholder: "Search..." })
|
|
4734
4800
|
] }),
|
|
4735
|
-
/* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { onClick: () => handleNavigation(
|
|
4801
|
+
/* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { onClick: () => handleNavigation(resolvedHomePath), children: "Home" }),
|
|
4736
4802
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4737
4803
|
MobileNavItem,
|
|
4738
4804
|
{
|
|
@@ -4742,9 +4808,11 @@ var Header = ({
|
|
|
4742
4808
|
children: "Trade"
|
|
4743
4809
|
}
|
|
4744
4810
|
),
|
|
4745
|
-
/* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { onClick: () => handleNavigation(
|
|
4746
|
-
/* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { onClick: () => handleNavigation(
|
|
4747
|
-
/* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { onClick: () => handleNavigation(
|
|
4811
|
+
/* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { onClick: () => handleNavigation(resolvedPortfolioPath), children: "Portfolio" }),
|
|
4812
|
+
/* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { onClick: () => handleNavigation(offeringsHref), children: "Initial Offerings" }),
|
|
4813
|
+
/* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { onClick: () => handleNavigation(resolvedPropertyMapPath), children: "Property Map" }),
|
|
4814
|
+
/* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { onClick: () => handleNavigation(resolvedLearnPath), children: "Learn" }),
|
|
4815
|
+
/* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { onClick: () => handleNavigation(resolvedAboutPath), children: "About" }),
|
|
4748
4816
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { borderTop: "1px solid #2b3139", margin: "8px 0" } }),
|
|
4749
4817
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4750
4818
|
MobileNavItem,
|
|
@@ -4799,7 +4867,7 @@ var Header = ({
|
|
|
4799
4867
|
{
|
|
4800
4868
|
type: "button",
|
|
4801
4869
|
onClick: (event) => {
|
|
4802
|
-
console.log("[Header] Add funding menu item clicked");
|
|
4870
|
+
console.log("[LoginTrace][Header] Add funding menu item clicked");
|
|
4803
4871
|
handleAddFundingClick(event);
|
|
4804
4872
|
},
|
|
4805
4873
|
children: /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { children: "Add funding" })
|
|
@@ -4810,7 +4878,7 @@ var Header = ({
|
|
|
4810
4878
|
{
|
|
4811
4879
|
type: "button",
|
|
4812
4880
|
onClick: (event) => {
|
|
4813
|
-
console.log("[Header] Logout menu item clicked");
|
|
4881
|
+
console.log("[LoginTrace][Header] Logout menu item clicked");
|
|
4814
4882
|
void handleLogoutClick(event);
|
|
4815
4883
|
},
|
|
4816
4884
|
children: /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { className: "logout", children: "Logout" })
|
|
@@ -4845,10 +4913,7 @@ var Header = ({
|
|
|
4845
4913
|
LoginPopupComponent && showLoginPopup && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4846
4914
|
LoginPopupComponent,
|
|
4847
4915
|
{
|
|
4848
|
-
onClose:
|
|
4849
|
-
setShowLoginPopup(false);
|
|
4850
|
-
setLoginPopupInitialView(void 0);
|
|
4851
|
-
},
|
|
4916
|
+
onClose: handleLoginPopupClose,
|
|
4852
4917
|
initialView: loginPopupInitialView
|
|
4853
4918
|
}
|
|
4854
4919
|
)
|
|
@@ -5376,6 +5441,7 @@ var OTP_INPUT_LENGTH = 6;
|
|
|
5376
5441
|
var LoginPopup = ({
|
|
5377
5442
|
onClose,
|
|
5378
5443
|
onOpenEarlyAccess,
|
|
5444
|
+
onWalletLogin,
|
|
5379
5445
|
isAuthenticated,
|
|
5380
5446
|
currentUser,
|
|
5381
5447
|
onSendEmailCode,
|
|
@@ -5400,38 +5466,74 @@ var LoginPopup = ({
|
|
|
5400
5466
|
const [fundingLoading, setFundingLoading] = React5.useState(false);
|
|
5401
5467
|
const [fundingError, setFundingError] = React5.useState("");
|
|
5402
5468
|
const suppressAutoCloseRef = React5__namespace.default.useRef(false);
|
|
5469
|
+
React5.useEffect(() => {
|
|
5470
|
+
console.log("[LoginTrace][Popup] mounted");
|
|
5471
|
+
return () => console.log("[LoginTrace][Popup] unmounted");
|
|
5472
|
+
}, []);
|
|
5473
|
+
React5.useEffect(() => {
|
|
5474
|
+
console.log("[LoginTrace][Popup] view updated", { view });
|
|
5475
|
+
}, [view]);
|
|
5476
|
+
React5.useEffect(() => {
|
|
5477
|
+
console.log("[LoginTrace][Popup] auth props updated", { isAuthenticated, hasUser: Boolean(currentUser) });
|
|
5478
|
+
}, [isAuthenticated, currentUser]);
|
|
5403
5479
|
React5.useEffect(() => {
|
|
5404
5480
|
if (typeof initialView === "string") {
|
|
5481
|
+
console.log("[LoginTrace][Popup] initialView prop changed", { initialView });
|
|
5405
5482
|
setView(initialView);
|
|
5406
5483
|
}
|
|
5407
5484
|
}, [initialView]);
|
|
5408
5485
|
React5.useEffect(() => {
|
|
5409
5486
|
if (!autoCloseOnAuth) {
|
|
5487
|
+
console.log("[LoginTrace][Popup] autoClose disabled", { autoCloseOnAuth, view });
|
|
5410
5488
|
return;
|
|
5411
5489
|
}
|
|
5412
5490
|
if (suppressAutoCloseRef.current) {
|
|
5491
|
+
console.log("[LoginTrace][Popup] autoClose suppressed", { view });
|
|
5413
5492
|
return;
|
|
5414
5493
|
}
|
|
5415
5494
|
if (view === "kyc" || view === "kyc-success" || view === "kyc-failed" || view === "funding") {
|
|
5495
|
+
console.log("[LoginTrace][Popup] autoClose skipped due to onboarding view", { view });
|
|
5416
5496
|
return;
|
|
5417
5497
|
}
|
|
5498
|
+
console.log("[LoginTrace][Popup] autoClose effect evaluating", {
|
|
5499
|
+
autoCloseOnAuth,
|
|
5500
|
+
isAuthenticated,
|
|
5501
|
+
hasUser: Boolean(currentUser),
|
|
5502
|
+
view
|
|
5503
|
+
});
|
|
5418
5504
|
if (isAuthenticated || currentUser) {
|
|
5505
|
+
console.log("[LoginTrace][Popup] autoClose triggered", { isAuthenticated, hasUser: Boolean(currentUser), view });
|
|
5419
5506
|
onClose();
|
|
5420
5507
|
}
|
|
5421
5508
|
}, [autoCloseOnAuth, currentUser, isAuthenticated, onClose, view]);
|
|
5422
|
-
const handleWalletLogin = () => {
|
|
5509
|
+
const handleWalletLogin = async () => {
|
|
5510
|
+
console.log("[LoginTrace][Popup] Wallet login clicked, onWalletLogin:", !!onWalletLogin);
|
|
5511
|
+
if (onWalletLogin) {
|
|
5512
|
+
try {
|
|
5513
|
+
console.log("[LoginTrace][Popup] Calling onWalletLogin...");
|
|
5514
|
+
await onWalletLogin();
|
|
5515
|
+
console.log("[LoginTrace][Popup] onWalletLogin completed, closing popup");
|
|
5516
|
+
onClose();
|
|
5517
|
+
return;
|
|
5518
|
+
} catch (err) {
|
|
5519
|
+
console.error("[LoginTrace][Popup] Wallet login failed", err);
|
|
5520
|
+
}
|
|
5521
|
+
}
|
|
5522
|
+
console.log("[LoginTrace][Popup] No onWalletLogin handler, closing popup");
|
|
5423
5523
|
onClose();
|
|
5424
5524
|
if (onOpenEarlyAccess) {
|
|
5425
5525
|
onOpenEarlyAccess();
|
|
5426
5526
|
}
|
|
5427
5527
|
};
|
|
5428
5528
|
const handleEmailClick = (signUp = false) => {
|
|
5529
|
+
console.log("[LoginTrace][Popup] handleEmailClick", { signUp });
|
|
5429
5530
|
setIsSignUp(signUp);
|
|
5430
5531
|
setView("email");
|
|
5431
5532
|
setError("");
|
|
5432
5533
|
};
|
|
5433
5534
|
const handleSendCode = async (event) => {
|
|
5434
5535
|
event?.preventDefault();
|
|
5536
|
+
console.log("[LoginTrace][Popup] handleSendCode invoked", { email, isSignUp, handle, eventType: event?.type });
|
|
5435
5537
|
if (!email || !email.includes("@")) {
|
|
5436
5538
|
setError("Please enter a valid email address");
|
|
5437
5539
|
return;
|
|
@@ -5444,13 +5546,15 @@ var LoginPopup = ({
|
|
|
5444
5546
|
setError("");
|
|
5445
5547
|
const normalizedHandle = isSignUp ? handle.trim() : void 0;
|
|
5446
5548
|
try {
|
|
5549
|
+
console.log("[LoginTrace][Popup] Attempting demo login fallback", { hasDemoHandler: Boolean(onDemoLogin) });
|
|
5447
5550
|
const demoResult = await onDemoLogin?.(email, normalizedHandle ?? null);
|
|
5448
5551
|
if (demoResult && demoResult.success) {
|
|
5552
|
+
console.log("[LoginTrace][Popup] Demo login succeeded, skipping OTP flow");
|
|
5449
5553
|
setLoading(false);
|
|
5450
5554
|
return;
|
|
5451
5555
|
}
|
|
5452
5556
|
} catch (err) {
|
|
5453
|
-
console.warn("Demo login failed, attempting email OTP", err);
|
|
5557
|
+
console.warn("[LoginTrace][Popup] Demo login failed, attempting email OTP", err);
|
|
5454
5558
|
}
|
|
5455
5559
|
if (!onSendEmailCode) {
|
|
5456
5560
|
setError("Email authentication is not configured for this popup.");
|
|
@@ -5458,10 +5562,13 @@ var LoginPopup = ({
|
|
|
5458
5562
|
return;
|
|
5459
5563
|
}
|
|
5460
5564
|
try {
|
|
5565
|
+
console.log("[LoginTrace][Popup] Calling onSendEmailCode", { email, isSignUp, normalizedHandle });
|
|
5461
5566
|
await onSendEmailCode({ email, isSignUp, handle: normalizedHandle ?? null });
|
|
5567
|
+
console.log("[LoginTrace][Popup] onSendEmailCode resolved, switching to OTP view");
|
|
5462
5568
|
setView("otp");
|
|
5463
5569
|
setOtp(Array(OTP_INPUT_LENGTH).fill(""));
|
|
5464
5570
|
} catch (err) {
|
|
5571
|
+
console.error("[LoginTrace][Popup] onSendEmailCode threw", err);
|
|
5465
5572
|
setError(err instanceof Error ? err.message : "Failed to send verification code");
|
|
5466
5573
|
} finally {
|
|
5467
5574
|
setLoading(false);
|
|
@@ -5494,9 +5601,32 @@ var LoginPopup = ({
|
|
|
5494
5601
|
document.getElementById(`otp-${index - 1}`)?.focus();
|
|
5495
5602
|
}
|
|
5496
5603
|
};
|
|
5604
|
+
const handleOTPInput = (index, event) => {
|
|
5605
|
+
const rawValue = event.currentTarget.value ?? "";
|
|
5606
|
+
const nativeEvent = event.nativeEvent;
|
|
5607
|
+
const isPasteLike = nativeEvent?.inputType === "insertFromPaste" || rawValue.length > 1;
|
|
5608
|
+
if (isPasteLike) {
|
|
5609
|
+
handleOTPChange(index, rawValue);
|
|
5610
|
+
}
|
|
5611
|
+
};
|
|
5612
|
+
const handleOTPPaste = (event) => {
|
|
5613
|
+
event.preventDefault();
|
|
5614
|
+
const pasted = event.clipboardData?.getData("text") ?? "";
|
|
5615
|
+
const digits = pasted.replace(/\D/g, "").slice(0, OTP_INPUT_LENGTH).split("");
|
|
5616
|
+
if (digits.length === 0) return;
|
|
5617
|
+
const next = Array.from({ length: OTP_INPUT_LENGTH }, (_, i) => digits[i] ?? "");
|
|
5618
|
+
setOtp(next);
|
|
5619
|
+
const lastIndex = Math.min(digits.length, OTP_INPUT_LENGTH) - 1;
|
|
5620
|
+
if (lastIndex >= 0) {
|
|
5621
|
+
requestAnimationFrame(() => {
|
|
5622
|
+
document.getElementById(`otp-${lastIndex}`)?.focus();
|
|
5623
|
+
});
|
|
5624
|
+
}
|
|
5625
|
+
};
|
|
5497
5626
|
const handleVerifyCode = async (event) => {
|
|
5498
5627
|
event.preventDefault();
|
|
5499
5628
|
const code = otp.join("");
|
|
5629
|
+
console.log("[LoginTrace][Popup] handleVerifyCode", { codeLength: code.length, isSignUp });
|
|
5500
5630
|
if (code.length !== OTP_INPUT_LENGTH) {
|
|
5501
5631
|
setError("Please enter the 6-digit code");
|
|
5502
5632
|
return;
|
|
@@ -5511,13 +5641,16 @@ var LoginPopup = ({
|
|
|
5511
5641
|
suppressAutoCloseRef.current = true;
|
|
5512
5642
|
}
|
|
5513
5643
|
try {
|
|
5644
|
+
console.log("[LoginTrace][Popup] Calling onVerifyEmailCode");
|
|
5514
5645
|
await onVerifyEmailCode({ code, email });
|
|
5515
5646
|
if (isSignUp) {
|
|
5647
|
+
console.log("[LoginTrace][Popup] Signup OTP verified, moving to KYC view");
|
|
5516
5648
|
setView("kyc");
|
|
5517
5649
|
setLoading(false);
|
|
5518
5650
|
return;
|
|
5519
5651
|
}
|
|
5520
5652
|
} catch (err) {
|
|
5653
|
+
console.error("[LoginTrace][Popup] onVerifyEmailCode threw", err);
|
|
5521
5654
|
suppressAutoCloseRef.current = false;
|
|
5522
5655
|
setError(err instanceof Error ? err.message : "Invalid verification code");
|
|
5523
5656
|
} finally {
|
|
@@ -5702,6 +5835,9 @@ var LoginPopup = ({
|
|
|
5702
5835
|
value: digit,
|
|
5703
5836
|
onChange: (event) => handleOTPChange(index, event.target.value),
|
|
5704
5837
|
onKeyDown: (event) => handleOTPKeyDown(index, event),
|
|
5838
|
+
onInput: (event) => handleOTPInput(index, event),
|
|
5839
|
+
onPaste: handleOTPPaste,
|
|
5840
|
+
autoComplete: index === 0 ? "one-time-code" : "off",
|
|
5705
5841
|
autoFocus: index === 0
|
|
5706
5842
|
},
|
|
5707
5843
|
index
|
|
@@ -8685,6 +8821,7 @@ function OrderPanel({
|
|
|
8685
8821
|
statusLabel,
|
|
8686
8822
|
statusColor,
|
|
8687
8823
|
ipoStarted,
|
|
8824
|
+
isAuthenticated,
|
|
8688
8825
|
tokenPrice,
|
|
8689
8826
|
feeRate,
|
|
8690
8827
|
supplyToSell,
|
|
@@ -8702,11 +8839,14 @@ function OrderPanel({
|
|
|
8702
8839
|
setSliderValue,
|
|
8703
8840
|
setManualOrderAmount,
|
|
8704
8841
|
onOrderButtonClick,
|
|
8842
|
+
onSignInClick,
|
|
8705
8843
|
orderButtonText,
|
|
8706
8844
|
isOrderButtonDisabled,
|
|
8707
8845
|
hasInsufficientFunds,
|
|
8708
8846
|
onPlaceAnotherOrder,
|
|
8709
|
-
onDeposit
|
|
8847
|
+
onDeposit,
|
|
8848
|
+
tokenDisplayName,
|
|
8849
|
+
tokenSymbol
|
|
8710
8850
|
}) {
|
|
8711
8851
|
const [payInputValue, setPayInputValue] = React5.useState("");
|
|
8712
8852
|
const [receiveInputValue, setReceiveInputValue] = React5.useState("");
|
|
@@ -8764,10 +8904,10 @@ function OrderPanel({
|
|
|
8764
8904
|
] }),
|
|
8765
8905
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "success-body", children: [
|
|
8766
8906
|
[
|
|
8767
|
-
{ label: "Units Acquired", value: `${lastOrderDetails?.tokens?.toFixed(2) || "0.00"}
|
|
8907
|
+
{ label: "Units Acquired", value: `${lastOrderDetails?.tokens?.toFixed(2) || "0.00"} ${tokenSymbol}` },
|
|
8768
8908
|
{ label: "Price Per Unit", value: `$${tokenPrice.toFixed(2)}` },
|
|
8769
8909
|
{
|
|
8770
|
-
label:
|
|
8910
|
+
label: `${tokenDisplayName} Exposure`,
|
|
8771
8911
|
value: `${((lastOrderDetails?.tokens ?? 0) / supplyToSell * 100).toFixed(3)}%`
|
|
8772
8912
|
}
|
|
8773
8913
|
].map((row) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "success-row", children: [
|
|
@@ -8829,13 +8969,19 @@ function OrderPanel({
|
|
|
8829
8969
|
] }),
|
|
8830
8970
|
/* @__PURE__ */ jsxRuntime.jsxs(FundsRow, { children: [
|
|
8831
8971
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
8832
|
-
"Available Funds:
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
availableBalance.toLocaleString()
|
|
8836
|
-
] })
|
|
8972
|
+
"Available Funds:",
|
|
8973
|
+
" ",
|
|
8974
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: isAuthenticated ? `$${availableBalance.toLocaleString()}` : "\u2014" })
|
|
8837
8975
|
] }),
|
|
8838
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8976
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8977
|
+
DepositButton,
|
|
8978
|
+
{
|
|
8979
|
+
type: "button",
|
|
8980
|
+
onClick: isAuthenticated ? onDeposit : void 0,
|
|
8981
|
+
disabled: !isAuthenticated,
|
|
8982
|
+
children: "+ Deposit"
|
|
8983
|
+
}
|
|
8984
|
+
)
|
|
8839
8985
|
] }),
|
|
8840
8986
|
/* @__PURE__ */ jsxRuntime.jsx(Divider2, { children: "\u2193" }),
|
|
8841
8987
|
/* @__PURE__ */ jsxRuntime.jsxs(Card2, { children: [
|
|
@@ -8867,7 +9013,7 @@ function OrderPanel({
|
|
|
8867
9013
|
}
|
|
8868
9014
|
}
|
|
8869
9015
|
),
|
|
8870
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children:
|
|
9016
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: tokenDisplayName })
|
|
8871
9017
|
] })
|
|
8872
9018
|
] }),
|
|
8873
9019
|
/* @__PURE__ */ jsxRuntime.jsxs(OrderSummary, { children: [
|
|
@@ -8883,7 +9029,8 @@ function OrderPanel({
|
|
|
8883
9029
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Buying" }),
|
|
8884
9030
|
/* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
|
|
8885
9031
|
tokenQuantity.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 }),
|
|
8886
|
-
"
|
|
9032
|
+
" ",
|
|
9033
|
+
tokenSymbol
|
|
8887
9034
|
] })
|
|
8888
9035
|
] }),
|
|
8889
9036
|
/* @__PURE__ */ jsxRuntime.jsxs(SummaryRow, { children: [
|
|
@@ -8894,7 +9041,8 @@ function OrderPanel({
|
|
|
8894
9041
|
] }),
|
|
8895
9042
|
/* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
|
|
8896
9043
|
feeInTokens.toFixed(2),
|
|
8897
|
-
"
|
|
9044
|
+
" ",
|
|
9045
|
+
tokenSymbol
|
|
8898
9046
|
] })
|
|
8899
9047
|
] }),
|
|
8900
9048
|
/* @__PURE__ */ jsxRuntime.jsxs(SummaryTotal, { children: [
|
|
@@ -8913,11 +9061,17 @@ function OrderPanel({
|
|
|
8913
9061
|
type: "button",
|
|
8914
9062
|
disabled: isOrderButtonDisabled,
|
|
8915
9063
|
"data-green": orderButtonText === "Place Order",
|
|
8916
|
-
onClick:
|
|
9064
|
+
onClick: () => {
|
|
9065
|
+
if (!isAuthenticated) {
|
|
9066
|
+
onSignInClick();
|
|
9067
|
+
return;
|
|
9068
|
+
}
|
|
9069
|
+
onOrderButtonClick();
|
|
9070
|
+
},
|
|
8917
9071
|
children: orderButtonText
|
|
8918
9072
|
}
|
|
8919
9073
|
),
|
|
8920
|
-
/* @__PURE__ */ jsxRuntime.jsxs(BalanceCards, { children: [
|
|
9074
|
+
isAuthenticated && /* @__PURE__ */ jsxRuntime.jsxs(BalanceCards, { children: [
|
|
8921
9075
|
/* @__PURE__ */ jsxRuntime.jsxs(BalanceCard, { children: [
|
|
8922
9076
|
/* @__PURE__ */ jsxRuntime.jsx(BalanceLabel, { children: "Available to Invest" }),
|
|
8923
9077
|
/* @__PURE__ */ jsxRuntime.jsxs(BalanceValue, { children: [
|
|
@@ -8927,18 +9081,26 @@ function OrderPanel({
|
|
|
8927
9081
|
/* @__PURE__ */ jsxRuntime.jsx(BalanceAction, { onClick: onDeposit, style: { cursor: onDeposit ? "pointer" : "default" }, children: "+ Deposit" })
|
|
8928
9082
|
] }),
|
|
8929
9083
|
/* @__PURE__ */ jsxRuntime.jsxs(BalanceCard, { children: [
|
|
8930
|
-
/* @__PURE__ */ jsxRuntime.jsx(BalanceLabel, { children:
|
|
9084
|
+
/* @__PURE__ */ jsxRuntime.jsx(BalanceLabel, { children: `${tokenDisplayName} Owned` }),
|
|
8931
9085
|
/* @__PURE__ */ jsxRuntime.jsxs(BalanceValue, { children: [
|
|
8932
9086
|
displayedOwnedTokens.toFixed(2),
|
|
9087
|
+
" ",
|
|
9088
|
+
tokenSymbol,
|
|
8933
9089
|
ownedTokensJustUpdated && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
8934
9090
|
"+",
|
|
8935
|
-
lastOrderQuantity.toFixed(2)
|
|
9091
|
+
lastOrderQuantity.toFixed(2),
|
|
9092
|
+
" ",
|
|
9093
|
+
tokenSymbol
|
|
8936
9094
|
] })
|
|
8937
9095
|
] }),
|
|
8938
9096
|
/* @__PURE__ */ jsxRuntime.jsxs(BalanceSub, { children: [
|
|
8939
9097
|
"$",
|
|
8940
|
-
(displayedOwnedTokens * tokenPrice).toLocaleString(
|
|
8941
|
-
|
|
9098
|
+
(displayedOwnedTokens * tokenPrice).toLocaleString("en-US", {
|
|
9099
|
+
minimumFractionDigits: 0,
|
|
9100
|
+
maximumFractionDigits: 0
|
|
9101
|
+
}),
|
|
9102
|
+
" ",
|
|
9103
|
+
"\u2022 ",
|
|
8942
9104
|
(displayedOwnedTokens / supplyToSell * 100).toFixed(3),
|
|
8943
9105
|
"%"
|
|
8944
9106
|
] })
|
|
@@ -10067,8 +10229,10 @@ var ButtonRow = styled23__default.default.div`
|
|
|
10067
10229
|
}
|
|
10068
10230
|
`;
|
|
10069
10231
|
function PropertyBuy({
|
|
10070
|
-
propertyName = "
|
|
10071
|
-
propertyLocation: propertyLocationLabel = "
|
|
10232
|
+
propertyName = "Loaf Property",
|
|
10233
|
+
propertyLocation: propertyLocationLabel = "Sydney, NSW",
|
|
10234
|
+
tokenDisplayName = "Property Token",
|
|
10235
|
+
tokenSymbol = "LOAF",
|
|
10072
10236
|
isAuthenticated,
|
|
10073
10237
|
onSignIn,
|
|
10074
10238
|
saleData,
|
|
@@ -10135,10 +10299,6 @@ function PropertyBuy({
|
|
|
10135
10299
|
}
|
|
10136
10300
|
}, [walletPropertyTokenBalance]);
|
|
10137
10301
|
const handleOrderButtonClick = () => {
|
|
10138
|
-
if (!isAuthenticated) {
|
|
10139
|
-
onSignIn();
|
|
10140
|
-
return;
|
|
10141
|
-
}
|
|
10142
10302
|
if (!ipoStarted || tokenQuantity === 0) {
|
|
10143
10303
|
return;
|
|
10144
10304
|
}
|
|
@@ -10185,7 +10345,7 @@ function PropertyBuy({
|
|
|
10185
10345
|
setTimeout(() => setOwnedTokensJustUpdated(false), 2e3);
|
|
10186
10346
|
const optimisticEntry = {
|
|
10187
10347
|
propertyName,
|
|
10188
|
-
tokenSymbol
|
|
10348
|
+
tokenSymbol,
|
|
10189
10349
|
tokens: tokenAmountInt,
|
|
10190
10350
|
value: orderTotal,
|
|
10191
10351
|
avgPrice: tokenPrice,
|
|
@@ -10262,6 +10422,8 @@ function PropertyBuy({
|
|
|
10262
10422
|
statusLabel,
|
|
10263
10423
|
statusColor,
|
|
10264
10424
|
ipoStarted,
|
|
10425
|
+
tokenDisplayName,
|
|
10426
|
+
tokenSymbol,
|
|
10265
10427
|
isAuthenticated,
|
|
10266
10428
|
tokenPrice,
|
|
10267
10429
|
feeRate,
|
|
@@ -10279,6 +10441,7 @@ function PropertyBuy({
|
|
|
10279
10441
|
manualOrderAmount,
|
|
10280
10442
|
setSliderValue,
|
|
10281
10443
|
setManualOrderAmount,
|
|
10444
|
+
onSignInClick: onSignIn,
|
|
10282
10445
|
onOrderButtonClick: handleOrderButtonClick,
|
|
10283
10446
|
orderButtonText: getOrderButtonText(),
|
|
10284
10447
|
isOrderButtonDisabled: isOrderButtonDisabled(),
|