@loafmarkets/ui 0.1.18 → 0.1.19
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 +70 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +70 -13
- 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();
|
|
@@ -5451,6 +5453,7 @@ var LoginPopup = ({
|
|
|
5451
5453
|
logoAlt = DEFAULT_LOGO_ALT,
|
|
5452
5454
|
autoCloseOnAuth = true,
|
|
5453
5455
|
onKycStart,
|
|
5456
|
+
renderKycWidget,
|
|
5454
5457
|
onFundWallet,
|
|
5455
5458
|
initialView
|
|
5456
5459
|
}) => {
|
|
@@ -5463,6 +5466,7 @@ var LoginPopup = ({
|
|
|
5463
5466
|
const [isSignUp, setIsSignUp] = React5.useState(false);
|
|
5464
5467
|
const [fundingAmount, setFundingAmount] = React5.useState("");
|
|
5465
5468
|
const [kycLoading, setKycLoading] = React5.useState(false);
|
|
5469
|
+
const [showKycWidget, setShowKycWidget] = React5.useState(false);
|
|
5466
5470
|
const [fundingLoading, setFundingLoading] = React5.useState(false);
|
|
5467
5471
|
const [fundingError, setFundingError] = React5.useState("");
|
|
5468
5472
|
const suppressAutoCloseRef = React5__namespace.default.useRef(false);
|
|
@@ -5657,7 +5661,19 @@ var LoginPopup = ({
|
|
|
5657
5661
|
setLoading(false);
|
|
5658
5662
|
}
|
|
5659
5663
|
};
|
|
5664
|
+
const handleKycWidgetResult = (result) => {
|
|
5665
|
+
setShowKycWidget(false);
|
|
5666
|
+
if (result.passed) {
|
|
5667
|
+
setView("kyc-success");
|
|
5668
|
+
} else {
|
|
5669
|
+
setView("kyc-failed");
|
|
5670
|
+
}
|
|
5671
|
+
};
|
|
5660
5672
|
const handleKycStart = async () => {
|
|
5673
|
+
if (renderKycWidget) {
|
|
5674
|
+
setShowKycWidget(true);
|
|
5675
|
+
return;
|
|
5676
|
+
}
|
|
5661
5677
|
if (!onKycStart) {
|
|
5662
5678
|
setView("kyc-success");
|
|
5663
5679
|
return;
|
|
@@ -5870,18 +5886,25 @@ var LoginPopup = ({
|
|
|
5870
5886
|
] }) });
|
|
5871
5887
|
}
|
|
5872
5888
|
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
|
-
|
|
5889
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Overlay2, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5890
|
+
KycPopupContainer,
|
|
5891
|
+
{
|
|
5892
|
+
onClick: (event) => event.stopPropagation(),
|
|
5893
|
+
$expanded: showKycWidget,
|
|
5894
|
+
children: [
|
|
5895
|
+
/* @__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" }) }) }),
|
|
5896
|
+
showKycWidget && renderKycWidget ? /* @__PURE__ */ jsxRuntime.jsx(KycWidgetContainer, { children: renderKycWidget(handleKycWidgetResult) }) : /* @__PURE__ */ jsxRuntime.jsxs(OnboardingStepContainer, { children: [
|
|
5897
|
+
/* @__PURE__ */ jsxRuntime.jsx(OnboardingHeading, { children: "KYC to Continue" }),
|
|
5898
|
+
/* @__PURE__ */ jsxRuntime.jsx(OnboardingSubtext, { children: "Loaf requires all users to KYC before they can start purchasing properties." }),
|
|
5899
|
+
/* @__PURE__ */ jsxRuntime.jsxs(OnboardingButtonGroup, { children: [
|
|
5900
|
+
/* @__PURE__ */ jsxRuntime.jsx(SubmitButton, { onClick: handleKycStart, disabled: kycLoading, children: kycLoading ? "Verifying\u2026" : "KYC me now" }),
|
|
5901
|
+
/* @__PURE__ */ jsxRuntime.jsx(OnboardingSkipButton, { onClick: handleKycSkip, children: "I'll do this later, I want to see the properties first" })
|
|
5902
|
+
] }),
|
|
5903
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(StatusMessage, { $error: true, children: error })
|
|
5904
|
+
] })
|
|
5905
|
+
]
|
|
5906
|
+
}
|
|
5907
|
+
) });
|
|
5885
5908
|
}
|
|
5886
5909
|
if (view === "kyc-success") {
|
|
5887
5910
|
return /* @__PURE__ */ jsxRuntime.jsx(Overlay2, { children: /* @__PURE__ */ jsxRuntime.jsxs(PopupContainer, { onClick: (event) => event.stopPropagation(), children: [
|
|
@@ -6011,6 +6034,40 @@ var PopupContainer = styled23__default.default.div`
|
|
|
6011
6034
|
max-width: 90%;
|
|
6012
6035
|
}
|
|
6013
6036
|
`;
|
|
6037
|
+
var KycPopupContainer = styled23__default.default.div`
|
|
6038
|
+
background-color: var(--color-background, #0a0a0a);
|
|
6039
|
+
border: 1px solid rgba(230, 198, 86, 0.3);
|
|
6040
|
+
border-radius: var(--border-radius, 12px);
|
|
6041
|
+
padding: 2.5rem;
|
|
6042
|
+
max-width: ${(props) => props.$expanded ? "680px" : "440px"};
|
|
6043
|
+
width: 90%;
|
|
6044
|
+
position: relative;
|
|
6045
|
+
animation: slideUp 0.3s ease-out;
|
|
6046
|
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
|
|
6047
|
+
transition: max-width 0.3s ease;
|
|
6048
|
+
|
|
6049
|
+
@keyframes slideUp {
|
|
6050
|
+
from {
|
|
6051
|
+
transform: translateY(20px);
|
|
6052
|
+
opacity: 0;
|
|
6053
|
+
}
|
|
6054
|
+
to {
|
|
6055
|
+
transform: translateY(0);
|
|
6056
|
+
opacity: 1;
|
|
6057
|
+
}
|
|
6058
|
+
}
|
|
6059
|
+
|
|
6060
|
+
@media (max-width: 768px) {
|
|
6061
|
+
padding: 1.5rem;
|
|
6062
|
+
max-width: 95%;
|
|
6063
|
+
}
|
|
6064
|
+
`;
|
|
6065
|
+
var KycWidgetContainer = styled23__default.default.div`
|
|
6066
|
+
min-height: 500px;
|
|
6067
|
+
width: 100%;
|
|
6068
|
+
display: flex;
|
|
6069
|
+
flex-direction: column;
|
|
6070
|
+
`;
|
|
6014
6071
|
var CloseButton = styled23__default.default.button`
|
|
6015
6072
|
position: absolute;
|
|
6016
6073
|
top: 1rem;
|