@loafmarkets/ui 0.1.364 → 0.1.366
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 +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +72 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +72 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -524,7 +524,7 @@ type DemoLoginResult = {
|
|
|
524
524
|
success: boolean;
|
|
525
525
|
};
|
|
526
526
|
type DemoLoginHandler = (email: string, handle?: string | null) => Promise<DemoLoginResult | void> | DemoLoginResult | void;
|
|
527
|
-
type LoginPopupView = "main" | "email" | "otp" | "kyc" | "kyc-success" | "kyc-failed" | "funding" | "receive" | "referral";
|
|
527
|
+
type LoginPopupView = "main" | "email" | "otp" | "kyc" | "kyc-success" | "kyc-failed" | "funding" | "receive" | "referral" | "wallet-handle";
|
|
528
528
|
type FundWalletParams = {
|
|
529
529
|
amount: string;
|
|
530
530
|
mode?: "crypto" | "fiat";
|
|
@@ -586,8 +586,18 @@ type LoginPopupProps = {
|
|
|
586
586
|
onSubmitReferralCode?: (code: string) => Promise<void> | void;
|
|
587
587
|
/** Called when the user skips the referral code and joins the waitlist. Receives their signup email. Resolves to a success message. */
|
|
588
588
|
onJoinWaitlist?: (email: string) => Promise<string> | void;
|
|
589
|
-
/**
|
|
590
|
-
|
|
589
|
+
/**
|
|
590
|
+
* Handler invoked when the user selects "Sign in with Wallet". Returns
|
|
591
|
+
* `{ needsHandle: true }` when the connected account has no handle yet, so the
|
|
592
|
+
* popup collects one (mirroring the email signup flow) instead of closing.
|
|
593
|
+
*/
|
|
594
|
+
onWalletLogin?: () => Promise<{
|
|
595
|
+
needsHandle: boolean;
|
|
596
|
+
} | void> | {
|
|
597
|
+
needsHandle: boolean;
|
|
598
|
+
} | void;
|
|
599
|
+
/** Handler invoked when a new wallet user submits their chosen handle. */
|
|
600
|
+
onWalletSignup?: (handle: string) => Promise<void> | void;
|
|
591
601
|
/** Handler invoked when the user selects "Sign in with Passkey". When omitted, the button is hidden. */
|
|
592
602
|
onPasskeyLogin?: () => Promise<void> | void;
|
|
593
603
|
/** Current KYC status — used to show "Resume Verification" when previously started. */
|
|
@@ -902,6 +912,7 @@ interface PortfolioPosition {
|
|
|
902
912
|
readonly propertyId: number;
|
|
903
913
|
readonly tokenName: string;
|
|
904
914
|
readonly quantity: number;
|
|
915
|
+
readonly totalQuantity: number;
|
|
905
916
|
readonly totalTokens: number;
|
|
906
917
|
readonly averageEntryPrice: number;
|
|
907
918
|
readonly marketPrice: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -524,7 +524,7 @@ type DemoLoginResult = {
|
|
|
524
524
|
success: boolean;
|
|
525
525
|
};
|
|
526
526
|
type DemoLoginHandler = (email: string, handle?: string | null) => Promise<DemoLoginResult | void> | DemoLoginResult | void;
|
|
527
|
-
type LoginPopupView = "main" | "email" | "otp" | "kyc" | "kyc-success" | "kyc-failed" | "funding" | "receive" | "referral";
|
|
527
|
+
type LoginPopupView = "main" | "email" | "otp" | "kyc" | "kyc-success" | "kyc-failed" | "funding" | "receive" | "referral" | "wallet-handle";
|
|
528
528
|
type FundWalletParams = {
|
|
529
529
|
amount: string;
|
|
530
530
|
mode?: "crypto" | "fiat";
|
|
@@ -586,8 +586,18 @@ type LoginPopupProps = {
|
|
|
586
586
|
onSubmitReferralCode?: (code: string) => Promise<void> | void;
|
|
587
587
|
/** Called when the user skips the referral code and joins the waitlist. Receives their signup email. Resolves to a success message. */
|
|
588
588
|
onJoinWaitlist?: (email: string) => Promise<string> | void;
|
|
589
|
-
/**
|
|
590
|
-
|
|
589
|
+
/**
|
|
590
|
+
* Handler invoked when the user selects "Sign in with Wallet". Returns
|
|
591
|
+
* `{ needsHandle: true }` when the connected account has no handle yet, so the
|
|
592
|
+
* popup collects one (mirroring the email signup flow) instead of closing.
|
|
593
|
+
*/
|
|
594
|
+
onWalletLogin?: () => Promise<{
|
|
595
|
+
needsHandle: boolean;
|
|
596
|
+
} | void> | {
|
|
597
|
+
needsHandle: boolean;
|
|
598
|
+
} | void;
|
|
599
|
+
/** Handler invoked when a new wallet user submits their chosen handle. */
|
|
600
|
+
onWalletSignup?: (handle: string) => Promise<void> | void;
|
|
591
601
|
/** Handler invoked when the user selects "Sign in with Passkey". When omitted, the button is hidden. */
|
|
592
602
|
onPasskeyLogin?: () => Promise<void> | void;
|
|
593
603
|
/** Current KYC status — used to show "Resume Verification" when previously started. */
|
|
@@ -902,6 +912,7 @@ interface PortfolioPosition {
|
|
|
902
912
|
readonly propertyId: number;
|
|
903
913
|
readonly tokenName: string;
|
|
904
914
|
readonly quantity: number;
|
|
915
|
+
readonly totalQuantity: number;
|
|
905
916
|
readonly totalTokens: number;
|
|
906
917
|
readonly averageEntryPrice: number;
|
|
907
918
|
readonly marketPrice: number;
|
package/dist/index.js
CHANGED
|
@@ -6465,6 +6465,7 @@ var LoginPopup = ({
|
|
|
6465
6465
|
onClose,
|
|
6466
6466
|
onOpenEarlyAccess,
|
|
6467
6467
|
onWalletLogin,
|
|
6468
|
+
onWalletSignup,
|
|
6468
6469
|
onPasskeyLogin,
|
|
6469
6470
|
isAuthenticated,
|
|
6470
6471
|
currentUser,
|
|
@@ -6550,7 +6551,7 @@ var LoginPopup = ({
|
|
|
6550
6551
|
if (suppressAutoCloseRef.current) {
|
|
6551
6552
|
return;
|
|
6552
6553
|
}
|
|
6553
|
-
if (view === "kyc" || view === "kyc-success" || view === "kyc-failed" || view === "funding" || view === "receive" || view === "referral") {
|
|
6554
|
+
if (view === "kyc" || view === "kyc-success" || view === "kyc-failed" || view === "funding" || view === "receive" || view === "referral" || view === "wallet-handle") {
|
|
6554
6555
|
return;
|
|
6555
6556
|
}
|
|
6556
6557
|
if (isAuthenticated || currentUser) {
|
|
@@ -6566,12 +6567,21 @@ var LoginPopup = ({
|
|
|
6566
6567
|
}, [onClose]);
|
|
6567
6568
|
const handleWalletLogin = async () => {
|
|
6568
6569
|
if (onWalletLogin) {
|
|
6570
|
+
suppressAutoCloseRef.current = true;
|
|
6569
6571
|
try {
|
|
6570
|
-
await onWalletLogin();
|
|
6572
|
+
const result = await onWalletLogin();
|
|
6573
|
+
if (result && result.needsHandle && onWalletSignup) {
|
|
6574
|
+
setHandle("");
|
|
6575
|
+
setError("");
|
|
6576
|
+
setView("wallet-handle");
|
|
6577
|
+
return;
|
|
6578
|
+
}
|
|
6579
|
+
suppressAutoCloseRef.current = false;
|
|
6571
6580
|
onClose();
|
|
6572
6581
|
return;
|
|
6573
6582
|
} catch (err) {
|
|
6574
6583
|
console.error("[LoginTrace][Popup] Wallet login failed", err);
|
|
6584
|
+
suppressAutoCloseRef.current = false;
|
|
6575
6585
|
}
|
|
6576
6586
|
}
|
|
6577
6587
|
onClose();
|
|
@@ -6579,6 +6589,31 @@ var LoginPopup = ({
|
|
|
6579
6589
|
onOpenEarlyAccess();
|
|
6580
6590
|
}
|
|
6581
6591
|
};
|
|
6592
|
+
const handleWalletSignupSubmit = async (event) => {
|
|
6593
|
+
event?.preventDefault();
|
|
6594
|
+
if (!handle.trim()) {
|
|
6595
|
+
setError("Please claim a handle to continue");
|
|
6596
|
+
return;
|
|
6597
|
+
}
|
|
6598
|
+
if (!onWalletSignup) {
|
|
6599
|
+
onClose();
|
|
6600
|
+
return;
|
|
6601
|
+
}
|
|
6602
|
+
setLoading(true);
|
|
6603
|
+
setError("");
|
|
6604
|
+
try {
|
|
6605
|
+
await onWalletSignup(handle.trim());
|
|
6606
|
+
if (onSubmitReferralCode) {
|
|
6607
|
+
setView("referral");
|
|
6608
|
+
} else {
|
|
6609
|
+
onClose();
|
|
6610
|
+
}
|
|
6611
|
+
} catch (err) {
|
|
6612
|
+
setError(err instanceof Error ? err.message : "Couldn't complete sign up. Please try again.");
|
|
6613
|
+
} finally {
|
|
6614
|
+
setLoading(false);
|
|
6615
|
+
}
|
|
6616
|
+
};
|
|
6582
6617
|
const handlePasskeyLogin = async () => {
|
|
6583
6618
|
if (!onPasskeyLogin) return;
|
|
6584
6619
|
setError("");
|
|
@@ -6905,6 +6940,31 @@ var LoginPopup = ({
|
|
|
6905
6940
|
isSignUp && /* @__PURE__ */ jsxRuntime.jsx(MiniLiveFeed, {})
|
|
6906
6941
|
] }) });
|
|
6907
6942
|
}
|
|
6943
|
+
if (view === "wallet-handle") {
|
|
6944
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Overlay2, { onClick: loading ? void 0 : onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(PopupContainer, { onClick: (event) => event.stopPropagation(), children: [
|
|
6945
|
+
!loading && /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: onClose, "aria-label": "Close login popup", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) }) }),
|
|
6946
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Title, { children: [
|
|
6947
|
+
/* @__PURE__ */ jsxRuntime.jsx(LogoContainer3, { children: /* @__PURE__ */ jsxRuntime.jsx(LogoImage, { src: logoSrc, alt: logoAlt }) }),
|
|
6948
|
+
"Claim your handle"
|
|
6949
|
+
] }),
|
|
6950
|
+
/* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit: handleWalletSignupSubmit, children: /* @__PURE__ */ jsxRuntime.jsxs(EmailFormContainer, { children: [
|
|
6951
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6952
|
+
EmailInput,
|
|
6953
|
+
{
|
|
6954
|
+
type: "text",
|
|
6955
|
+
placeholder: "Claim your handle (e.g. Landlord)",
|
|
6956
|
+
value: handle,
|
|
6957
|
+
onChange: (event) => setHandle(event.target.value),
|
|
6958
|
+
autoFocus: true
|
|
6959
|
+
}
|
|
6960
|
+
),
|
|
6961
|
+
/* @__PURE__ */ jsxRuntime.jsx(SubmitButton, { type: "submit", disabled: loading || !handle.trim(), children: loading ? "Setting up your account\u2026" : "Continue" }),
|
|
6962
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(StatusMessage, { $error: true, children: error })
|
|
6963
|
+
] }) }),
|
|
6964
|
+
/* @__PURE__ */ jsxRuntime.jsx(InfoText, { children: "Pick a public handle for your Loaf profile." }),
|
|
6965
|
+
/* @__PURE__ */ jsxRuntime.jsx(MiniLiveFeed, {})
|
|
6966
|
+
] }) });
|
|
6967
|
+
}
|
|
6908
6968
|
if (view === "otp") {
|
|
6909
6969
|
return /* @__PURE__ */ jsxRuntime.jsx(Overlay2, { onClick: loading ? void 0 : onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(PopupContainer, { onClick: (event) => event.stopPropagation(), children: [
|
|
6910
6970
|
!loading && /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: onClose, "aria-label": "Close login popup", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) }) }),
|
|
@@ -7123,7 +7183,7 @@ var LoginPopup = ({
|
|
|
7123
7183
|
}
|
|
7124
7184
|
};
|
|
7125
7185
|
const handleJoinWaitlistSkip = async () => {
|
|
7126
|
-
if (!onJoinWaitlist) {
|
|
7186
|
+
if (!onJoinWaitlist || !email) {
|
|
7127
7187
|
onClose();
|
|
7128
7188
|
return;
|
|
7129
7189
|
}
|
|
@@ -7197,7 +7257,7 @@ var LoginPopup = ({
|
|
|
7197
7257
|
onClick: () => void handleJoinWaitlistSkip(),
|
|
7198
7258
|
disabled: waitlistLoading,
|
|
7199
7259
|
style: { marginTop: "0.75rem" },
|
|
7200
|
-
children: waitlistLoading ? "Joining\u2026" : "Skip for now & join Waitlist"
|
|
7260
|
+
children: waitlistLoading ? "Joining\u2026" : email ? "Skip for now & join Waitlist" : "Skip for now"
|
|
7201
7261
|
}
|
|
7202
7262
|
)
|
|
7203
7263
|
] })
|
|
@@ -13583,9 +13643,9 @@ function PortfolioActivityPanel({
|
|
|
13583
13643
|
case "asset":
|
|
13584
13644
|
return dir * a.tokenName.localeCompare(b.tokenName);
|
|
13585
13645
|
case "units":
|
|
13586
|
-
return dir * (a.
|
|
13646
|
+
return dir * (a.totalQuantity - b.totalQuantity);
|
|
13587
13647
|
case "value":
|
|
13588
|
-
return dir * (a.
|
|
13648
|
+
return dir * (a.totalQuantity * a.marketPrice - b.totalQuantity * b.marketPrice);
|
|
13589
13649
|
case "avgPrice":
|
|
13590
13650
|
return dir * (a.averageEntryPrice - b.averageEntryPrice);
|
|
13591
13651
|
case "currentPrice":
|
|
@@ -13754,8 +13814,8 @@ function PortfolioActivityPanel({
|
|
|
13754
13814
|
] })
|
|
13755
13815
|
] }),
|
|
13756
13816
|
sortedPositions.map((pos) => {
|
|
13757
|
-
const currentValue = pos.
|
|
13758
|
-
const costBasis = pos.
|
|
13817
|
+
const currentValue = pos.totalQuantity * pos.marketPrice;
|
|
13818
|
+
const costBasis = pos.totalQuantity * pos.averageEntryPrice;
|
|
13759
13819
|
const pnl = pos.propertyPnl ?? currentValue - costBasis;
|
|
13760
13820
|
const pnlPercent = pos.propertyPnlPercent ?? pos.percentChange ?? 0;
|
|
13761
13821
|
const isPositive = pnl >= 0;
|
|
@@ -13772,7 +13832,7 @@ function PortfolioActivityPanel({
|
|
|
13772
13832
|
] }),
|
|
13773
13833
|
/* @__PURE__ */ jsxRuntime.jsxs(CUnitsCell, { children: [
|
|
13774
13834
|
/* @__PURE__ */ jsxRuntime.jsx(CCellLabel, { children: "Units" }),
|
|
13775
|
-
formatNumber2(pos.
|
|
13835
|
+
formatNumber2(pos.totalQuantity, pos.totalQuantity >= 100 ? 0 : 2),
|
|
13776
13836
|
" ",
|
|
13777
13837
|
ticker
|
|
13778
13838
|
] }),
|
|
@@ -13845,15 +13905,15 @@ function PortfolioActivityPanel({
|
|
|
13845
13905
|
onClosePosition && /* @__PURE__ */ jsxRuntime.jsx(PositionsHeaderCell, { children: /* @__PURE__ */ jsxRuntime.jsx(CloseAllHeaderBtn, { onClick: () => setCloseAllOpen(true), children: "Sell All" }) })
|
|
13846
13906
|
] }),
|
|
13847
13907
|
sortedPositions.map((pos) => {
|
|
13848
|
-
const currentValue = pos.
|
|
13849
|
-
const costBasis = pos.
|
|
13908
|
+
const currentValue = pos.totalQuantity * pos.marketPrice;
|
|
13909
|
+
const costBasis = pos.totalQuantity * pos.averageEntryPrice;
|
|
13850
13910
|
const pnl = pos.propertyPnl ?? currentValue - costBasis;
|
|
13851
13911
|
const pnlPercent = pos.propertyPnlPercent ?? pos.percentChange ?? 0;
|
|
13852
13912
|
const isPositive = pnl >= 0;
|
|
13853
13913
|
return /* @__PURE__ */ jsxRuntime.jsxs(PositionsRow, { $hasClose: !!onClosePosition, children: [
|
|
13854
13914
|
/* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { children: /* @__PURE__ */ jsxRuntime.jsx(HoldingsPropertyLink, { onClick: () => onPositionClick?.(pos.tokenName, pos.isIpoAllocation), children: pos.tokenName }) }),
|
|
13855
13915
|
/* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { children: /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: "#fff", fontSize: "0.8rem" }, children: [
|
|
13856
|
-
formatNumber2(pos.
|
|
13916
|
+
formatNumber2(pos.totalQuantity),
|
|
13857
13917
|
" ",
|
|
13858
13918
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "rgba(255,255,255,0.4)", fontSize: "0.7rem" }, children: pos.tokenName.toUpperCase() })
|
|
13859
13919
|
] }) }),
|