@swype-org/react-sdk 0.1.26 → 0.1.27

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
@@ -77,6 +77,26 @@ var wagmiConfig = wagmi.createConfig({
77
77
  [chains.base.id]: wagmi.http()
78
78
  }
79
79
  });
80
+ var PRIVY_MODAL_CENTER_CSS = `
81
+ @media (max-width: 440px) {
82
+ #privy-dialog [data-headlessui-state] {
83
+ position: static !important;
84
+ bottom: auto !important;
85
+ margin: auto !important;
86
+ width: 360px !important;
87
+ max-width: calc(100vw - 32px) !important;
88
+ box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15) !important;
89
+ border-radius: var(--privy-border-radius-lg) !important;
90
+ transform: none !important;
91
+ transition: opacity 100ms ease-in !important;
92
+ }
93
+ #privy-dialog [data-headlessui-state].entering,
94
+ #privy-dialog [data-headlessui-state].leaving {
95
+ opacity: 0 !important;
96
+ transform: none !important;
97
+ }
98
+ }
99
+ `;
80
100
  var SwypeContext = react.createContext(null);
81
101
  function SwypeProvider({
82
102
  apiBaseUrl,
@@ -87,6 +107,15 @@ function SwypeProvider({
87
107
  if (!queryClientRef.current) {
88
108
  queryClientRef.current = new reactQuery.QueryClient();
89
109
  }
110
+ react.useEffect(() => {
111
+ const style = document.createElement("style");
112
+ style.setAttribute("data-swype", "privy-modal-center");
113
+ style.textContent = PRIVY_MODAL_CENTER_CSS;
114
+ document.head.appendChild(style);
115
+ return () => {
116
+ style.remove();
117
+ };
118
+ }, []);
90
119
  const [depositAmount, setDepositAmountRaw] = react.useState(null);
91
120
  const setDepositAmount = react.useCallback((amount) => {
92
121
  setDepositAmountRaw(amount);
@@ -3025,7 +3054,7 @@ function SwypePayment({
3025
3054
  ]
3026
3055
  }
3027
3056
  ),
3028
- /* @__PURE__ */ jsxRuntime.jsxs(
3057
+ /* @__PURE__ */ jsxRuntime.jsx(
3029
3058
  "div",
3030
3059
  {
3031
3060
  style: {
@@ -3038,74 +3067,39 @@ function SwypePayment({
3038
3067
  border: `1px solid ${tokens.border}`,
3039
3068
  lineHeight: 1.7
3040
3069
  },
3041
- children: [
3042
- /* @__PURE__ */ jsxRuntime.jsxs(
3043
- "div",
3044
- {
3045
- style: { display: "flex", justifyContent: "space-between" },
3046
- children: [
3047
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "To" }),
3048
- /* @__PURE__ */ jsxRuntime.jsxs(
3049
- "span",
3050
- {
3051
- style: {
3052
- fontFamily: '"SF Mono", "Fira Code", monospace',
3053
- fontSize: "0.8rem"
3054
- },
3055
- children: [
3056
- destination.address.slice(0, 6),
3057
- "...",
3058
- destination.address.slice(-4)
3059
- ]
3060
- }
3061
- )
3062
- ]
3063
- }
3064
- ),
3065
- /* @__PURE__ */ jsxRuntime.jsxs(
3066
- "div",
3067
- {
3068
- style: { display: "flex", justifyContent: "space-between" },
3069
- children: [
3070
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Token" }),
3071
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 600 }, children: destination.token.symbol })
3072
- ]
3073
- }
3074
- ),
3075
- /* @__PURE__ */ jsxRuntime.jsxs(
3076
- "div",
3077
- {
3078
- style: {
3079
- display: "flex",
3080
- justifyContent: "space-between",
3081
- alignItems: "center"
3082
- },
3083
- children: [
3084
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "From" }),
3085
- noAccounts ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 500, color: tokens.textMuted }, children: "New account" }) : /* @__PURE__ */ jsxRuntime.jsx(
3086
- AccountDropdown,
3087
- {
3088
- accounts,
3089
- selectedAccountId,
3090
- selectedWalletId,
3091
- onSelect: (id) => {
3092
- setSelectedAccountId(id);
3093
- setSelectedWalletId(null);
3094
- setConnectingNewAccount(false);
3095
- setSelectedProviderId(null);
3096
- },
3097
- onWalletSelect: (accountId, walletId) => {
3098
- setSelectedAccountId(accountId);
3099
- setSelectedWalletId(walletId);
3100
- setConnectingNewAccount(false);
3101
- setSelectedProviderId(null);
3102
- }
3070
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3071
+ "div",
3072
+ {
3073
+ style: {
3074
+ display: "flex",
3075
+ justifyContent: "space-between",
3076
+ alignItems: "center"
3077
+ },
3078
+ children: noAccounts ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3079
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "From" }),
3080
+ /* @__PURE__ */ jsxRuntime.jsx(
3081
+ AccountDropdown,
3082
+ {
3083
+ accounts,
3084
+ selectedAccountId,
3085
+ selectedWalletId,
3086
+ onSelect: (id) => {
3087
+ setSelectedAccountId(id);
3088
+ setSelectedWalletId(null);
3089
+ setConnectingNewAccount(false);
3090
+ setSelectedProviderId(null);
3091
+ },
3092
+ onWalletSelect: (accountId, walletId) => {
3093
+ setSelectedAccountId(accountId);
3094
+ setSelectedWalletId(walletId);
3095
+ setConnectingNewAccount(false);
3096
+ setSelectedProviderId(null);
3103
3097
  }
3104
- )
3105
- ]
3106
- }
3107
- )
3108
- ]
3098
+ }
3099
+ )
3100
+ ] })
3101
+ }
3102
+ )
3109
3103
  }
3110
3104
  ),
3111
3105
  noAccounts && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: "16px" }, children: [
@@ -3371,10 +3365,9 @@ function SwypePayment({
3371
3365
  }
3372
3366
  };
3373
3367
  const regMsg = getRegistrationMessage();
3374
- const transferStatus = getDisplayTransferStatus(polling.transfer, transfer);
3375
- const transferIdSuffix = getTransferIdSuffix(polling.transfer, transfer);
3376
- const statusLabel = creatingTransfer ? "Creating transfer..." : mobileFlow ? "Waiting for authorization..." : authExecutor.executing && regMsg.label ? regMsg.label : authExecutor.executing ? "Authorizing..." : transferSigning.signing ? "Preparing transfer..." : polling.isPolling ? "Processing payment..." : "Please wait...";
3377
- const statusDescription = creatingTransfer ? "Setting up your transfer..." : mobileFlow ? "Complete the authorization in your wallet app, then return here." : authExecutor.executing && regMsg.description ? regMsg.description : authExecutor.executing ? "Complete the wallet prompts to authorize this payment." : transferSigning.signing ? "Waiting for backend to prepare your transfer payload..." : polling.isPolling ? "Your payment is being processed. This usually takes a few moments." : "Hang tight...";
3368
+ getDisplayTransferStatus(polling.transfer, transfer);
3369
+ getTransferIdSuffix(polling.transfer, transfer);
3370
+ const statusLabel = creatingTransfer ? "Creating Transfer" : mobileFlow ? "Waiting for Authorization" : authExecutor.executing && regMsg.label ? regMsg.label : authExecutor.executing ? "Authorizing" : transferSigning.signing ? "Sending transfer" : polling.isPolling ? "Transfer Sent" : "Please wait...";
3378
3371
  return /* @__PURE__ */ jsxRuntime.jsx("div", { style: cardStyle, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "center", padding: "16px 0" }, children: [
3379
3372
  /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 48 }),
3380
3373
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -3388,36 +3381,6 @@ function SwypePayment({
3388
3381
  children: statusLabel
3389
3382
  }
3390
3383
  ),
3391
- /* @__PURE__ */ jsxRuntime.jsx(
3392
- "p",
3393
- {
3394
- style: {
3395
- fontSize: "0.85rem",
3396
- color: tokens.textSecondary,
3397
- margin: 0,
3398
- lineHeight: 1.5
3399
- },
3400
- children: statusDescription
3401
- }
3402
- ),
3403
- /* @__PURE__ */ jsxRuntime.jsxs(
3404
- "p",
3405
- {
3406
- style: {
3407
- marginTop: "12px",
3408
- marginBottom: 0,
3409
- fontSize: "0.8rem",
3410
- color: tokens.textSecondary
3411
- },
3412
- children: [
3413
- "Current status: ",
3414
- /* @__PURE__ */ jsxRuntime.jsx("strong", { style: { color: tokens.text }, children: transferStatus }),
3415
- " \xB7 ",
3416
- "Transfer: ",
3417
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: tokens.textMuted }, children: transferIdSuffix })
3418
- ]
3419
- }
3420
- ),
3421
3384
  polling.error && /* @__PURE__ */ jsxRuntime.jsxs(
3422
3385
  "p",
3423
3386
  {