@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.mjs CHANGED
@@ -4571,7 +4571,9 @@ var Header = ({
4571
4571
  onNavigate("/portfolio");
4572
4572
  }
4573
4573
  };
4574
- const userPrimaryLabel = currentUser?.displayName?.trim() || "User";
4574
+ const rawDisplayName = currentUser?.displayName;
4575
+ const normalizedDisplayName = typeof rawDisplayName === "string" ? rawDisplayName.trim() : void 0;
4576
+ const userPrimaryLabel = normalizedDisplayName || currentUser?.email || currentUser?.walletAddress || "User";
4575
4577
  const resolveAuthReturnUrl = () => {
4576
4578
  if (getAuthReturnUrl) {
4577
4579
  return getAuthReturnUrl();
@@ -5426,6 +5428,7 @@ var LoginPopup = ({
5426
5428
  logoAlt = DEFAULT_LOGO_ALT,
5427
5429
  autoCloseOnAuth = true,
5428
5430
  onKycStart,
5431
+ renderKycWidget,
5429
5432
  onFundWallet,
5430
5433
  initialView
5431
5434
  }) => {
@@ -5438,6 +5441,7 @@ var LoginPopup = ({
5438
5441
  const [isSignUp, setIsSignUp] = useState(false);
5439
5442
  const [fundingAmount, setFundingAmount] = useState("");
5440
5443
  const [kycLoading, setKycLoading] = useState(false);
5444
+ const [showKycWidget, setShowKycWidget] = useState(false);
5441
5445
  const [fundingLoading, setFundingLoading] = useState(false);
5442
5446
  const [fundingError, setFundingError] = useState("");
5443
5447
  const suppressAutoCloseRef = React5__default.useRef(false);
@@ -5632,7 +5636,19 @@ var LoginPopup = ({
5632
5636
  setLoading(false);
5633
5637
  }
5634
5638
  };
5639
+ const handleKycWidgetResult = (result) => {
5640
+ setShowKycWidget(false);
5641
+ if (result.passed) {
5642
+ setView("kyc-success");
5643
+ } else {
5644
+ setView("kyc-failed");
5645
+ }
5646
+ };
5635
5647
  const handleKycStart = async () => {
5648
+ if (renderKycWidget) {
5649
+ setShowKycWidget(true);
5650
+ return;
5651
+ }
5636
5652
  if (!onKycStart) {
5637
5653
  setView("kyc-success");
5638
5654
  return;
@@ -5845,18 +5861,25 @@ var LoginPopup = ({
5845
5861
  ] }) });
5846
5862
  }
5847
5863
  if (view === "kyc") {
5848
- return /* @__PURE__ */ jsx(Overlay2, { children: /* @__PURE__ */ jsxs(PopupContainer, { onClick: (event) => event.stopPropagation(), children: [
5849
- /* @__PURE__ */ jsx(CloseButton, { onClick: onClose, "aria-label": "Close login popup", children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ 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" }) }) }),
5850
- /* @__PURE__ */ jsxs(OnboardingStepContainer, { children: [
5851
- /* @__PURE__ */ jsx(OnboardingHeading, { children: "KYC to Continue" }),
5852
- /* @__PURE__ */ jsx(OnboardingSubtext, { children: "Loaf requires all users to KYC before they can start purchasing properties." }),
5853
- /* @__PURE__ */ jsxs(OnboardingButtonGroup, { children: [
5854
- /* @__PURE__ */ jsx(SubmitButton, { onClick: handleKycStart, disabled: kycLoading, children: kycLoading ? "Verifying\u2026" : "KYC me now" }),
5855
- /* @__PURE__ */ jsx(OnboardingSkipButton, { onClick: handleKycSkip, children: "I'll do this later, I want to see the properties first" })
5856
- ] }),
5857
- error && /* @__PURE__ */ jsx(StatusMessage, { $error: true, children: error })
5858
- ] })
5859
- ] }) });
5864
+ return /* @__PURE__ */ jsx(Overlay2, { children: /* @__PURE__ */ jsxs(
5865
+ KycPopupContainer,
5866
+ {
5867
+ onClick: (event) => event.stopPropagation(),
5868
+ $expanded: showKycWidget,
5869
+ children: [
5870
+ /* @__PURE__ */ jsx(CloseButton, { onClick: onClose, "aria-label": "Close login popup", children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ 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" }) }) }),
5871
+ showKycWidget && renderKycWidget ? /* @__PURE__ */ jsx(KycWidgetContainer, { children: renderKycWidget(handleKycWidgetResult) }) : /* @__PURE__ */ jsxs(OnboardingStepContainer, { children: [
5872
+ /* @__PURE__ */ jsx(OnboardingHeading, { children: "KYC to Continue" }),
5873
+ /* @__PURE__ */ jsx(OnboardingSubtext, { children: "Loaf requires all users to KYC before they can start purchasing properties." }),
5874
+ /* @__PURE__ */ jsxs(OnboardingButtonGroup, { children: [
5875
+ /* @__PURE__ */ jsx(SubmitButton, { onClick: handleKycStart, disabled: kycLoading, children: kycLoading ? "Verifying\u2026" : "KYC me now" }),
5876
+ /* @__PURE__ */ jsx(OnboardingSkipButton, { onClick: handleKycSkip, children: "I'll do this later, I want to see the properties first" })
5877
+ ] }),
5878
+ error && /* @__PURE__ */ jsx(StatusMessage, { $error: true, children: error })
5879
+ ] })
5880
+ ]
5881
+ }
5882
+ ) });
5860
5883
  }
5861
5884
  if (view === "kyc-success") {
5862
5885
  return /* @__PURE__ */ jsx(Overlay2, { children: /* @__PURE__ */ jsxs(PopupContainer, { onClick: (event) => event.stopPropagation(), children: [
@@ -5986,6 +6009,40 @@ var PopupContainer = styled23.div`
5986
6009
  max-width: 90%;
5987
6010
  }
5988
6011
  `;
6012
+ var KycPopupContainer = styled23.div`
6013
+ background-color: var(--color-background, #0a0a0a);
6014
+ border: 1px solid rgba(230, 198, 86, 0.3);
6015
+ border-radius: var(--border-radius, 12px);
6016
+ padding: 2.5rem;
6017
+ max-width: ${(props) => props.$expanded ? "680px" : "440px"};
6018
+ width: 90%;
6019
+ position: relative;
6020
+ animation: slideUp 0.3s ease-out;
6021
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
6022
+ transition: max-width 0.3s ease;
6023
+
6024
+ @keyframes slideUp {
6025
+ from {
6026
+ transform: translateY(20px);
6027
+ opacity: 0;
6028
+ }
6029
+ to {
6030
+ transform: translateY(0);
6031
+ opacity: 1;
6032
+ }
6033
+ }
6034
+
6035
+ @media (max-width: 768px) {
6036
+ padding: 1.5rem;
6037
+ max-width: 95%;
6038
+ }
6039
+ `;
6040
+ var KycWidgetContainer = styled23.div`
6041
+ min-height: 500px;
6042
+ width: 100%;
6043
+ display: flex;
6044
+ flex-direction: column;
6045
+ `;
5989
6046
  var CloseButton = styled23.button`
5990
6047
  position: absolute;
5991
6048
  top: 1rem;