@loafmarkets/ui 0.1.18 → 0.1.20
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 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +85 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +85 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -470,6 +470,14 @@ type LoginPopupProps = {
|
|
|
470
470
|
onKycStart?: () => Promise<{
|
|
471
471
|
passed: boolean;
|
|
472
472
|
}> | void;
|
|
473
|
+
/**
|
|
474
|
+
* Render prop for embedding an inline KYC widget (e.g. Sumsub). When provided, clicking
|
|
475
|
+
* "KYC me now" will display this widget inside the popup. The callback should be invoked
|
|
476
|
+
* when the verification flow completes.
|
|
477
|
+
*/
|
|
478
|
+
renderKycWidget?: (onResult: (result: {
|
|
479
|
+
passed: boolean;
|
|
480
|
+
}) => void) => React__default.ReactNode;
|
|
473
481
|
/**
|
|
474
482
|
* Handler called when the user clicks "Fund my account". Should open the funding UI (e.g. Coinbase onramp)
|
|
475
483
|
* and resolve with { funded: boolean } when the user exits.
|
package/dist/index.d.ts
CHANGED
|
@@ -470,6 +470,14 @@ type LoginPopupProps = {
|
|
|
470
470
|
onKycStart?: () => Promise<{
|
|
471
471
|
passed: boolean;
|
|
472
472
|
}> | void;
|
|
473
|
+
/**
|
|
474
|
+
* Render prop for embedding an inline KYC widget (e.g. Sumsub). When provided, clicking
|
|
475
|
+
* "KYC me now" will display this widget inside the popup. The callback should be invoked
|
|
476
|
+
* when the verification flow completes.
|
|
477
|
+
*/
|
|
478
|
+
renderKycWidget?: (onResult: (result: {
|
|
479
|
+
passed: boolean;
|
|
480
|
+
}) => void) => React__default.ReactNode;
|
|
473
481
|
/**
|
|
474
482
|
* Handler called when the user clicks "Fund my account". Should open the funding UI (e.g. Coinbase onramp)
|
|
475
483
|
* and resolve with { funded: boolean } when the user exits.
|
package/dist/index.js
CHANGED
|
@@ -4596,7 +4596,9 @@ var Header = ({
|
|
|
4596
4596
|
onNavigate("/portfolio");
|
|
4597
4597
|
}
|
|
4598
4598
|
};
|
|
4599
|
-
const
|
|
4599
|
+
const rawDisplayName = currentUser?.displayName;
|
|
4600
|
+
const normalizedDisplayName = typeof rawDisplayName === "string" ? rawDisplayName.trim() : void 0;
|
|
4601
|
+
const userPrimaryLabel = normalizedDisplayName || currentUser?.email || currentUser?.walletAddress || "User";
|
|
4600
4602
|
const resolveAuthReturnUrl = () => {
|
|
4601
4603
|
if (getAuthReturnUrl) {
|
|
4602
4604
|
return getAuthReturnUrl();
|
|
@@ -4704,25 +4706,25 @@ var Header = ({
|
|
|
4704
4706
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4705
4707
|
NavLink,
|
|
4706
4708
|
{
|
|
4707
|
-
href:
|
|
4708
|
-
className:
|
|
4709
|
+
href: resolvedPortfolioPath,
|
|
4710
|
+
className: portfolioActive ? "active" : "",
|
|
4709
4711
|
onClick: (event) => {
|
|
4710
4712
|
event.preventDefault();
|
|
4711
|
-
|
|
4713
|
+
handleNavigation(resolvedPortfolioPath);
|
|
4712
4714
|
},
|
|
4713
|
-
children: "
|
|
4715
|
+
children: "Portfolio"
|
|
4714
4716
|
}
|
|
4715
4717
|
),
|
|
4716
4718
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4717
4719
|
NavLink,
|
|
4718
4720
|
{
|
|
4719
|
-
href:
|
|
4720
|
-
className:
|
|
4721
|
+
href: resolvedTradePath,
|
|
4722
|
+
className: tradeActive ? "active" : "",
|
|
4721
4723
|
onClick: (event) => {
|
|
4722
4724
|
event.preventDefault();
|
|
4723
|
-
|
|
4725
|
+
handleTradeNavigation();
|
|
4724
4726
|
},
|
|
4725
|
-
children: "
|
|
4727
|
+
children: "Trade"
|
|
4726
4728
|
}
|
|
4727
4729
|
),
|
|
4728
4730
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4799,6 +4801,13 @@ var Header = ({
|
|
|
4799
4801
|
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "text", placeholder: "Search..." })
|
|
4800
4802
|
] }),
|
|
4801
4803
|
/* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { onClick: () => handleNavigation(resolvedHomePath), children: "Home" }),
|
|
4804
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4805
|
+
MobileNavItem,
|
|
4806
|
+
{
|
|
4807
|
+
onClick: () => handleNavigation(resolvedPortfolioPath),
|
|
4808
|
+
children: "Portfolio"
|
|
4809
|
+
}
|
|
4810
|
+
),
|
|
4802
4811
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4803
4812
|
MobileNavItem,
|
|
4804
4813
|
{
|
|
@@ -4808,7 +4817,6 @@ var Header = ({
|
|
|
4808
4817
|
children: "Trade"
|
|
4809
4818
|
}
|
|
4810
4819
|
),
|
|
4811
|
-
/* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { onClick: () => handleNavigation(resolvedPortfolioPath), children: "Portfolio" }),
|
|
4812
4820
|
/* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { onClick: () => handleNavigation(offeringsHref), children: "Initial Offerings" }),
|
|
4813
4821
|
/* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { onClick: () => handleNavigation(resolvedPropertyMapPath), children: "Property Map" }),
|
|
4814
4822
|
/* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { onClick: () => handleNavigation(resolvedLearnPath), children: "Learn" }),
|
|
@@ -5451,6 +5459,7 @@ var LoginPopup = ({
|
|
|
5451
5459
|
logoAlt = DEFAULT_LOGO_ALT,
|
|
5452
5460
|
autoCloseOnAuth = true,
|
|
5453
5461
|
onKycStart,
|
|
5462
|
+
renderKycWidget,
|
|
5454
5463
|
onFundWallet,
|
|
5455
5464
|
initialView
|
|
5456
5465
|
}) => {
|
|
@@ -5463,6 +5472,7 @@ var LoginPopup = ({
|
|
|
5463
5472
|
const [isSignUp, setIsSignUp] = React5.useState(false);
|
|
5464
5473
|
const [fundingAmount, setFundingAmount] = React5.useState("");
|
|
5465
5474
|
const [kycLoading, setKycLoading] = React5.useState(false);
|
|
5475
|
+
const [showKycWidget, setShowKycWidget] = React5.useState(false);
|
|
5466
5476
|
const [fundingLoading, setFundingLoading] = React5.useState(false);
|
|
5467
5477
|
const [fundingError, setFundingError] = React5.useState("");
|
|
5468
5478
|
const suppressAutoCloseRef = React5__namespace.default.useRef(false);
|
|
@@ -5657,7 +5667,19 @@ var LoginPopup = ({
|
|
|
5657
5667
|
setLoading(false);
|
|
5658
5668
|
}
|
|
5659
5669
|
};
|
|
5670
|
+
const handleKycWidgetResult = (result) => {
|
|
5671
|
+
setShowKycWidget(false);
|
|
5672
|
+
if (result.passed) {
|
|
5673
|
+
setView("kyc-success");
|
|
5674
|
+
} else {
|
|
5675
|
+
setView("kyc-failed");
|
|
5676
|
+
}
|
|
5677
|
+
};
|
|
5660
5678
|
const handleKycStart = async () => {
|
|
5679
|
+
if (renderKycWidget) {
|
|
5680
|
+
setShowKycWidget(true);
|
|
5681
|
+
return;
|
|
5682
|
+
}
|
|
5661
5683
|
if (!onKycStart) {
|
|
5662
5684
|
setView("kyc-success");
|
|
5663
5685
|
return;
|
|
@@ -5870,18 +5892,25 @@ var LoginPopup = ({
|
|
|
5870
5892
|
] }) });
|
|
5871
5893
|
}
|
|
5872
5894
|
if (view === "kyc") {
|
|
5873
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Overlay2, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5880
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5895
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Overlay2, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5896
|
+
KycPopupContainer,
|
|
5897
|
+
{
|
|
5898
|
+
onClick: (event) => event.stopPropagation(),
|
|
5899
|
+
$expanded: showKycWidget,
|
|
5900
|
+
children: [
|
|
5901
|
+
/* @__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" }) }) }),
|
|
5902
|
+
showKycWidget && renderKycWidget ? /* @__PURE__ */ jsxRuntime.jsx(KycWidgetContainer, { children: renderKycWidget(handleKycWidgetResult) }) : /* @__PURE__ */ jsxRuntime.jsxs(OnboardingStepContainer, { children: [
|
|
5903
|
+
/* @__PURE__ */ jsxRuntime.jsx(OnboardingHeading, { children: "KYC to Continue" }),
|
|
5904
|
+
/* @__PURE__ */ jsxRuntime.jsx(OnboardingSubtext, { children: "Loaf requires all users to KYC before they can start purchasing properties." }),
|
|
5905
|
+
/* @__PURE__ */ jsxRuntime.jsxs(OnboardingButtonGroup, { children: [
|
|
5906
|
+
/* @__PURE__ */ jsxRuntime.jsx(SubmitButton, { onClick: handleKycStart, disabled: kycLoading, children: kycLoading ? "Verifying\u2026" : "KYC me now" }),
|
|
5907
|
+
/* @__PURE__ */ jsxRuntime.jsx(OnboardingSkipButton, { onClick: handleKycSkip, children: "I'll do this later, I want to see the properties first" })
|
|
5908
|
+
] }),
|
|
5909
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(StatusMessage, { $error: true, children: error })
|
|
5910
|
+
] })
|
|
5911
|
+
]
|
|
5912
|
+
}
|
|
5913
|
+
) });
|
|
5885
5914
|
}
|
|
5886
5915
|
if (view === "kyc-success") {
|
|
5887
5916
|
return /* @__PURE__ */ jsxRuntime.jsx(Overlay2, { children: /* @__PURE__ */ jsxRuntime.jsxs(PopupContainer, { onClick: (event) => event.stopPropagation(), children: [
|
|
@@ -6011,6 +6040,40 @@ var PopupContainer = styled23__default.default.div`
|
|
|
6011
6040
|
max-width: 90%;
|
|
6012
6041
|
}
|
|
6013
6042
|
`;
|
|
6043
|
+
var KycPopupContainer = styled23__default.default.div`
|
|
6044
|
+
background-color: var(--color-background, #0a0a0a);
|
|
6045
|
+
border: 1px solid rgba(230, 198, 86, 0.3);
|
|
6046
|
+
border-radius: var(--border-radius, 12px);
|
|
6047
|
+
padding: 2.5rem;
|
|
6048
|
+
max-width: ${(props) => props.$expanded ? "680px" : "440px"};
|
|
6049
|
+
width: 90%;
|
|
6050
|
+
position: relative;
|
|
6051
|
+
animation: slideUp 0.3s ease-out;
|
|
6052
|
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
|
|
6053
|
+
transition: max-width 0.3s ease;
|
|
6054
|
+
|
|
6055
|
+
@keyframes slideUp {
|
|
6056
|
+
from {
|
|
6057
|
+
transform: translateY(20px);
|
|
6058
|
+
opacity: 0;
|
|
6059
|
+
}
|
|
6060
|
+
to {
|
|
6061
|
+
transform: translateY(0);
|
|
6062
|
+
opacity: 1;
|
|
6063
|
+
}
|
|
6064
|
+
}
|
|
6065
|
+
|
|
6066
|
+
@media (max-width: 768px) {
|
|
6067
|
+
padding: 1.5rem;
|
|
6068
|
+
max-width: 95%;
|
|
6069
|
+
}
|
|
6070
|
+
`;
|
|
6071
|
+
var KycWidgetContainer = styled23__default.default.div`
|
|
6072
|
+
min-height: 500px;
|
|
6073
|
+
width: 100%;
|
|
6074
|
+
display: flex;
|
|
6075
|
+
flex-direction: column;
|
|
6076
|
+
`;
|
|
6014
6077
|
var CloseButton = styled23__default.default.button`
|
|
6015
6078
|
position: absolute;
|
|
6016
6079
|
top: 1rem;
|