@swype-org/react-sdk 0.2.26 → 0.2.31

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.cjs CHANGED
@@ -244,9 +244,6 @@ async function checkServerForPasskeyByToken(authToken, apiBaseUrl, verificationT
244
244
  function shouldUsePasskeySignupPopup() {
245
245
  return isSafari() && isInCrossOriginIframe();
246
246
  }
247
- function shouldUsePasskeyLoginPopup() {
248
- return isSafari() && isInCrossOriginIframe();
249
- }
250
247
  var SIGNUP_POPUP_TIMEOUT_MS = 12e4;
251
248
  function signupWithPasskeyViaPopup() {
252
249
  return new Promise((resolve, reject) => {
@@ -3501,7 +3498,7 @@ var FALLBACK = "Biometric verification";
3501
3498
  function getDeviceBiometricUnlockText() {
3502
3499
  const ua = typeof navigator !== "undefined" && typeof navigator.userAgent === "string" ? navigator.userAgent : "";
3503
3500
  if (/iPhone|iPad|iPod/i.test(ua)) {
3504
- return "Face ID or Touch ID";
3501
+ return "Face ID";
3505
3502
  }
3506
3503
  if (/Android/i.test(ua)) {
3507
3504
  return "Fingerprint or face unlock";
@@ -4910,30 +4907,6 @@ var waitHintStyle = (color) => ({
4910
4907
  color,
4911
4908
  margin: 0
4912
4909
  });
4913
-
4914
- // src/feeFormat.ts
4915
- function isPreciseMoneyNonPositive(fee) {
4916
- const raw = fee.value.trim();
4917
- if (!/^-?\d+(\.\d*)?$/.test(raw)) return false;
4918
- const n = Number(raw);
4919
- return Number.isFinite(n) && n <= 0;
4920
- }
4921
- function formatNonPositiveFeeDisplay(fee) {
4922
- return "< $0.01";
4923
- }
4924
- function formatPreciseMoneyForDisplay(fee) {
4925
- const raw = fee.value.trim();
4926
- if (fee.currency === "USD") {
4927
- if (!/^\d+(\.\d*)?$/.test(raw)) {
4928
- return `$${raw}`;
4929
- }
4930
- const [whole, frac = ""] = raw.split(".");
4931
- const dec = `${frac}00`.slice(0, 2);
4932
- const intFmt = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
4933
- return `$${intFmt}.${dec}`;
4934
- }
4935
- return `${raw} ${fee.currency}`;
4936
- }
4937
4910
  function formatUsdTwoDecimals(value) {
4938
4911
  const n = Number(value);
4939
4912
  return (Number.isFinite(n) ? n : 0).toLocaleString("en-US", {
@@ -5105,10 +5078,9 @@ function DepositScreen({
5105
5078
  return /* @__PURE__ */ jsxRuntime.jsx(WarningBanner, { title: "Fee estimate unavailable", children: quoteError });
5106
5079
  }
5107
5080
  if (quoteFee) {
5108
- const feeText = isPreciseMoneyNonPositive(quoteFee) ? formatNonPositiveFeeDisplay() : formatPreciseMoneyForDisplay(quoteFee);
5109
5081
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: feeRowContainerStyle, "aria-live": "polite", children: [
5110
5082
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: feeRowLabelStyle(tokens.textMuted), children: "Fee estimate: " }),
5111
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: feeRowAmountStyle(tokens.textSecondary), children: feeText })
5083
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: feeRowAmountStyle(tokens.textSecondary), children: "Free" })
5112
5084
  ] });
5113
5085
  }
5114
5086
  return null;
@@ -6674,6 +6646,30 @@ var selectCircleSelectedStyle = (color) => ({
6674
6646
  justifyContent: "center",
6675
6647
  flexShrink: 0
6676
6648
  });
6649
+
6650
+ // src/feeFormat.ts
6651
+ function isPreciseMoneyNonPositive(fee) {
6652
+ const raw = fee.value.trim();
6653
+ if (!/^-?\d+(\.\d*)?$/.test(raw)) return false;
6654
+ const n = Number(raw);
6655
+ return Number.isFinite(n) && n <= 0;
6656
+ }
6657
+ function formatNonPositiveFeeDisplay(fee) {
6658
+ return "< $0.01";
6659
+ }
6660
+ function formatPreciseMoneyForDisplay(fee) {
6661
+ const raw = fee.value.trim();
6662
+ if (fee.currency === "USD") {
6663
+ if (!/^\d+(\.\d*)?$/.test(raw)) {
6664
+ return `$${raw}`;
6665
+ }
6666
+ const [whole, frac = ""] = raw.split(".");
6667
+ const dec = `${frac}00`.slice(0, 2);
6668
+ const intFmt = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
6669
+ return `$${intFmt}.${dec}`;
6670
+ }
6671
+ return `${raw} ${fee.currency}`;
6672
+ }
6677
6673
  function entryKey(entry) {
6678
6674
  return `${entry.sourceChainId}-${entry.tokenAddress.toLowerCase()}`;
6679
6675
  }
@@ -6728,7 +6724,6 @@ function GuestTokenPickerScreen({
6728
6724
  const [limitInputValue, setLimitInputValue] = react.useState("");
6729
6725
  const limitInputRef = react.useRef(null);
6730
6726
  const [managingAllowance, setManagingAllowance] = react.useState(false);
6731
- const biometricText = getDeviceBiometricUnlockText();
6732
6727
  react.useEffect(() => {
6733
6728
  if (!tokenListOpen) return;
6734
6729
  const handleMouseDown = (e) => {
@@ -6762,8 +6757,6 @@ function GuestTokenPickerScreen({
6762
6757
  const canConfirm = Boolean(pendingEntry && !quoteLoading && (!confirmNeedsQuote || quoteFee));
6763
6758
  const ctaLabel = confirmLabel ?? (variant === "auth-setup" ? "Continue" : providerName ? `Open ${providerName} to Deposit` : "Open Wallet to Deposit");
6764
6759
  const tokenCardLabel = selectionLabel ?? (variant === "auth-setup" ? "Token for one-tap" : "Deposit");
6765
- const oneTapSubtitle = variant === "auth-setup" ? `Skip wallet next time \u2014 just ${biometricText}` : `Skip ${providerName ?? "wallet"} next time \u2014 just ${biometricText}`;
6766
- const oneTapBody = variant === "auth-setup" ? `Future deposits up to your allowance are confirmed with just ${biometricText} \u2014 no wallet pop-up.` : `Future deposits up to your allowance are confirmed with just ${biometricText} \u2014 no wallet pop-up. You'll re-authorize with ${providerName ?? "your wallet"} when you need to top up.`;
6767
6760
  const feeLine = (() => {
6768
6761
  if (quoteLoading && pendingEntry) {
6769
6762
  return /* @__PURE__ */ jsxRuntime.jsx("div", { style: feeRowContainerStyle2, "aria-live": "polite", children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: feeRowLabelStyle2(t.textMuted), children: "Getting fee estimate\u2026" }) });
@@ -6980,10 +6973,25 @@ function GuestTokenPickerScreen({
6980
6973
  !tokenListOpen && !isBridging && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: oneTapCardStyle(t, oneTapEnabled), children: [
6981
6974
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: oneTapHeaderRowStyle, children: [
6982
6975
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: oneTapHeaderLeftStyle, children: [
6983
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: lightningIconStyle, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13 2L3 14h9l-1 8 10-12h-9l1-8z", fill: "#F5A623", stroke: "#F5A623", strokeWidth: "1", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
6976
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: lightningIconStyle, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "36", height: "36", viewBox: "0 0 80 80", children: /* @__PURE__ */ jsxRuntime.jsx("g", { stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ jsxRuntime.jsx("g", { fill: "#000000", children: /* @__PURE__ */ jsxRuntime.jsx("g", { children: /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
6977
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { fillRule: "nonzero", children: [
6978
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4.11428571,21.9428571 L4.11428571,13.0285714 C4.11428571,7.99327149 7.99327149,4.11428571 13.0285714,4.11428571 L21.9428571,4.11428571 C23.0789858,4.11428571 24,3.19327149 24,2.05714286 C24,0.921014229 23.0789858,0 21.9428571,0 L13.0285714,0 C5.72101423,0 0,5.72101423 0,13.0285714 L0,21.9428571 C0,23.0789858 0.921014229,24 2.05714286,24 C3.19327149,24 4.11428571,23.0789858 4.11428571,21.9428571 Z" }),
6979
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4.11428571,21.9428571 L4.11428571,13.0285714 C4.11428571,7.99327149 7.99327149,4.11428571 13.0285714,4.11428571 L21.9428571,4.11428571 C23.0789858,4.11428571 24,3.19327149 24,2.05714286 C24,0.921014229 23.0789858,0 21.9428571,0 L13.0285714,0 C5.72101423,0 0,5.72101423 0,13.0285714 L0,21.9428571 C0,23.0789858 0.921014229,24 2.05714286,24 C3.19327149,24 4.11428571,23.0789858 4.11428571,21.9428571 Z", transform: "translate(68.070175, 11.929825) scale(-1, 1) translate(-68.070175, -11.929825) translate(56.140351, 0.000000)" }),
6980
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4.11428571,21.9428571 L4.11428571,13.0285714 C4.11428571,7.99327149 7.99327149,4.11428571 13.0285714,4.11428571 L21.9428571,4.11428571 C23.0789858,4.11428571 24,3.19327149 24,2.05714286 C24,0.921014229 23.0789858,0 21.9428571,0 L13.0285714,0 C5.72101423,0 0,5.72101423 0,13.0285714 L0,21.9428571 C0,23.0789858 0.921014229,24 2.05714286,24 C3.19327149,24 4.11428571,23.0789858 4.11428571,21.9428571 Z", transform: "translate(11.929825, 68.070175) scale(1, -1) translate(-11.929825, -68.070175) translate(0.000000, 56.140351)" }),
6981
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4.11428571,21.9428571 L4.11428571,13.0285714 C4.11428571,7.99327149 7.99327149,4.11428571 13.0285714,4.11428571 L21.9428571,4.11428571 C23.0789858,4.11428571 24,3.19327149 24,2.05714286 C24,0.921014229 23.0789858,0 21.9428571,0 L13.0285714,0 C5.72101423,0 0,5.72101423 0,13.0285714 L0,21.9428571 C0,23.0789858 0.921014229,24 2.05714286,24 C3.19327149,24 4.11428571,23.0789858 4.11428571,21.9428571 Z", transform: "translate(68.070175, 68.070175) scale(-1, -1) translate(-68.070175, -68.070175) translate(56.140351, 56.140351)" })
6982
+ ] }),
6983
+ /* @__PURE__ */ jsxRuntime.jsx("g", { transform: "translate(21.754386, 28.070175)", fillRule: "nonzero", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,2.14285714 L0,7.86037654 C0,9.04384386 0.8954305,10.0032337 2,10.0032337 C3.1045695,10.0032337 4,9.04384386 4,7.86037654 L4,2.14285714 C4,0.959389822 3.1045695,0 2,0 C0.8954305,0 0,0.959389822 0,2.14285714 Z" }) }),
6984
+ /* @__PURE__ */ jsxRuntime.jsx("g", { transform: "translate(54.736842, 28.070175)", fillRule: "nonzero", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,2.14285714 L0,7.86037654 C0,9.04384386 0.8954305,10.0032337 2,10.0032337 C3.1045695,10.0032337 4,9.04384386 4,7.86037654 L4,2.14285714 C4,0.959389822 3.1045695,0 2,0 C0.8954305,0 0,0.959389822 0,2.14285714 Z" }) }),
6985
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M25.9319616,59.0829234 C29.8331111,62.7239962 34.5578726,64.5614035 40,64.5614035 C45.4421274,64.5614035 50.1668889,62.7239962 54.0680384,59.0829234 C54.9180398,58.2895887 54.9639773,56.9574016 54.1706427,56.1074002 C53.377308,55.2573988 52.0451209,55.2114613 51.1951195,56.0047959 C48.0787251,58.9134307 44.382434,60.3508772 40,60.3508772 C35.617566,60.3508772 31.9212749,58.9134307 28.8048805,56.0047959 C27.9548791,55.2114613 26.622692,55.2573988 25.8293573,56.1074002 C25.0360227,56.9574016 25.0819602,58.2895887 25.9319616,59.0829234 Z", fillRule: "nonzero" }),
6986
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M40,30.1754386 L40,44.9122807 C40,45.85537 39.539042,46.3157895 38.5912711,46.3157895 L37.1929825,46.3157895 C36.0302777,46.3157895 35.0877193,47.2583479 35.0877193,48.4210526 C35.0877193,49.5837574 36.0302777,50.5263158 37.1929825,50.5263158 L38.5912711,50.5263158 C41.8633505,50.5263158 44.2105263,48.1818819 44.2105263,44.9122807 L44.2105263,30.1754386 C44.2105263,29.0127339 43.2679679,28.0701754 42.1052632,28.0701754 C40.9425584,28.0701754 40,29.0127339 40,30.1754386 Z", fillRule: "nonzero" })
6987
+ ] }) }) }) }) }) }),
6984
6988
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
6985
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: oneTapTitleStyle(t.text), children: "Enable one-tap deposits" }),
6986
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: oneTapSubtitleStyle(t.textMuted), children: oneTapSubtitle })
6989
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: oneTapTitleStyle(t.text), children: [
6990
+ "Deposit with ",
6991
+ getDeviceBiometricUnlockText(),
6992
+ " next time"
6993
+ ] }),
6994
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: oneTapSubtitleStyle(t.textMuted), children: "No need to reopen your wallet every time. Your money stays under your control." })
6987
6995
  ] })
6988
6996
  ] }),
6989
6997
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -7000,7 +7008,6 @@ function GuestTokenPickerScreen({
7000
7008
  )
7001
7009
  ] }),
7002
7010
  oneTapEnabled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7003
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: oneTapBodyStyle(t.textMuted), children: oneTapBody }),
7004
7011
  /* @__PURE__ */ jsxRuntime.jsxs(
7005
7012
  "button",
7006
7013
  {
@@ -7325,8 +7332,6 @@ var oneTapHeaderLeftStyle = {
7325
7332
  var lightningIconStyle = {
7326
7333
  width: 36,
7327
7334
  height: 36,
7328
- borderRadius: 10,
7329
- background: "linear-gradient(135deg, #e8f5e9 0%, #fffde7 100%)",
7330
7335
  display: "flex",
7331
7336
  alignItems: "center",
7332
7337
  justifyContent: "center",
@@ -7368,12 +7373,6 @@ var toggleThumbStyle = (on) => ({
7368
7373
  transition: "transform 0.2s ease",
7369
7374
  transform: on ? "translateX(0)" : "translateX(0)"
7370
7375
  });
7371
- var oneTapBodyStyle = (color) => ({
7372
- fontSize: "0.84rem",
7373
- color,
7374
- lineHeight: 1.55,
7375
- margin: "10px 0 0"
7376
- });
7377
7376
  var manageAllowanceBtnStyle = (color) => ({
7378
7377
  display: "flex",
7379
7378
  alignItems: "center",
@@ -8146,10 +8145,6 @@ function useAuthHandlers(dispatch, apiBaseUrl, popupAuthRef) {
8146
8145
  },
8147
8146
  onError: (error) => {
8148
8147
  captureException(new Error(String(error)));
8149
- if (isInCrossOriginIframe()) {
8150
- handlePopupLogin();
8151
- return;
8152
- }
8153
8148
  dispatch({
8154
8149
  type: "SET_ERROR",
8155
8150
  error: typeof error === "string" ? error : "Passkey login failed. Try again or create an account."
@@ -8203,10 +8198,6 @@ function useAuthHandlers(dispatch, apiBaseUrl, popupAuthRef) {
8203
8198
  const passkeyAuthError = loginState.status === "error" ? loginState.error?.message ?? "Passkey login failed." : signupState.status === "error" ? signupState.error?.message ?? "Passkey signup failed." : null;
8204
8199
  const handleLoginWithPasskey = react.useCallback(() => {
8205
8200
  dispatch({ type: "SET_ERROR", error: null });
8206
- if (shouldUsePasskeyLoginPopup()) {
8207
- handlePopupLogin();
8208
- return;
8209
- }
8210
8201
  loginWithPasskey();
8211
8202
  }, [loginWithPasskey, dispatch, handlePopupLogin]);
8212
8203
  const handleSignupWithPasskey = react.useCallback(() => {