@loafmarkets/ui 0.1.364 → 0.1.365

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
@@ -6439,6 +6439,7 @@ var LoginPopup = ({
6439
6439
  onClose,
6440
6440
  onOpenEarlyAccess,
6441
6441
  onWalletLogin,
6442
+ onWalletSignup,
6442
6443
  onPasskeyLogin,
6443
6444
  isAuthenticated,
6444
6445
  currentUser,
@@ -6524,7 +6525,7 @@ var LoginPopup = ({
6524
6525
  if (suppressAutoCloseRef.current) {
6525
6526
  return;
6526
6527
  }
6527
- if (view === "kyc" || view === "kyc-success" || view === "kyc-failed" || view === "funding" || view === "receive" || view === "referral") {
6528
+ if (view === "kyc" || view === "kyc-success" || view === "kyc-failed" || view === "funding" || view === "receive" || view === "referral" || view === "wallet-handle") {
6528
6529
  return;
6529
6530
  }
6530
6531
  if (isAuthenticated || currentUser) {
@@ -6540,12 +6541,21 @@ var LoginPopup = ({
6540
6541
  }, [onClose]);
6541
6542
  const handleWalletLogin = async () => {
6542
6543
  if (onWalletLogin) {
6544
+ suppressAutoCloseRef.current = true;
6543
6545
  try {
6544
- await onWalletLogin();
6546
+ const result = await onWalletLogin();
6547
+ if (result && result.needsHandle && onWalletSignup) {
6548
+ setHandle("");
6549
+ setError("");
6550
+ setView("wallet-handle");
6551
+ return;
6552
+ }
6553
+ suppressAutoCloseRef.current = false;
6545
6554
  onClose();
6546
6555
  return;
6547
6556
  } catch (err) {
6548
6557
  console.error("[LoginTrace][Popup] Wallet login failed", err);
6558
+ suppressAutoCloseRef.current = false;
6549
6559
  }
6550
6560
  }
6551
6561
  onClose();
@@ -6553,6 +6563,31 @@ var LoginPopup = ({
6553
6563
  onOpenEarlyAccess();
6554
6564
  }
6555
6565
  };
6566
+ const handleWalletSignupSubmit = async (event) => {
6567
+ event?.preventDefault();
6568
+ if (!handle.trim()) {
6569
+ setError("Please claim a handle to continue");
6570
+ return;
6571
+ }
6572
+ if (!onWalletSignup) {
6573
+ onClose();
6574
+ return;
6575
+ }
6576
+ setLoading(true);
6577
+ setError("");
6578
+ try {
6579
+ await onWalletSignup(handle.trim());
6580
+ if (onSubmitReferralCode) {
6581
+ setView("referral");
6582
+ } else {
6583
+ onClose();
6584
+ }
6585
+ } catch (err) {
6586
+ setError(err instanceof Error ? err.message : "Couldn't complete sign up. Please try again.");
6587
+ } finally {
6588
+ setLoading(false);
6589
+ }
6590
+ };
6556
6591
  const handlePasskeyLogin = async () => {
6557
6592
  if (!onPasskeyLogin) return;
6558
6593
  setError("");
@@ -6879,6 +6914,31 @@ var LoginPopup = ({
6879
6914
  isSignUp && /* @__PURE__ */ jsx(MiniLiveFeed, {})
6880
6915
  ] }) });
6881
6916
  }
6917
+ if (view === "wallet-handle") {
6918
+ return /* @__PURE__ */ jsx(Overlay2, { onClick: loading ? void 0 : onClose, children: /* @__PURE__ */ jsxs(PopupContainer, { onClick: (event) => event.stopPropagation(), children: [
6919
+ !loading && /* @__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" }) }) }),
6920
+ /* @__PURE__ */ jsxs(Title, { children: [
6921
+ /* @__PURE__ */ jsx(LogoContainer3, { children: /* @__PURE__ */ jsx(LogoImage, { src: logoSrc, alt: logoAlt }) }),
6922
+ "Claim your handle"
6923
+ ] }),
6924
+ /* @__PURE__ */ jsx("form", { onSubmit: handleWalletSignupSubmit, children: /* @__PURE__ */ jsxs(EmailFormContainer, { children: [
6925
+ /* @__PURE__ */ jsx(
6926
+ EmailInput,
6927
+ {
6928
+ type: "text",
6929
+ placeholder: "Claim your handle (e.g. Landlord)",
6930
+ value: handle,
6931
+ onChange: (event) => setHandle(event.target.value),
6932
+ autoFocus: true
6933
+ }
6934
+ ),
6935
+ /* @__PURE__ */ jsx(SubmitButton, { type: "submit", disabled: loading || !handle.trim(), children: loading ? "Setting up your account\u2026" : "Continue" }),
6936
+ error && /* @__PURE__ */ jsx(StatusMessage, { $error: true, children: error })
6937
+ ] }) }),
6938
+ /* @__PURE__ */ jsx(InfoText, { children: "Pick a public handle for your Loaf profile." }),
6939
+ /* @__PURE__ */ jsx(MiniLiveFeed, {})
6940
+ ] }) });
6941
+ }
6882
6942
  if (view === "otp") {
6883
6943
  return /* @__PURE__ */ jsx(Overlay2, { onClick: loading ? void 0 : onClose, children: /* @__PURE__ */ jsxs(PopupContainer, { onClick: (event) => event.stopPropagation(), children: [
6884
6944
  !loading && /* @__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" }) }) }),
@@ -7097,7 +7157,7 @@ var LoginPopup = ({
7097
7157
  }
7098
7158
  };
7099
7159
  const handleJoinWaitlistSkip = async () => {
7100
- if (!onJoinWaitlist) {
7160
+ if (!onJoinWaitlist || !email) {
7101
7161
  onClose();
7102
7162
  return;
7103
7163
  }
@@ -7171,7 +7231,7 @@ var LoginPopup = ({
7171
7231
  onClick: () => void handleJoinWaitlistSkip(),
7172
7232
  disabled: waitlistLoading,
7173
7233
  style: { marginTop: "0.75rem" },
7174
- children: waitlistLoading ? "Joining\u2026" : "Skip for now & join Waitlist"
7234
+ children: waitlistLoading ? "Joining\u2026" : email ? "Skip for now & join Waitlist" : "Skip for now"
7175
7235
  }
7176
7236
  )
7177
7237
  ] })