@swype-org/react-sdk 0.1.142 → 0.1.148

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
@@ -1681,24 +1681,34 @@ function hasActiveDepositWallet(account) {
1681
1681
  function getPreferredDepositWallet(account, transferAmount) {
1682
1682
  const wallets = getAddressableWallets(account);
1683
1683
  if (wallets.length === 0) return null;
1684
+ let bestWithAllowance = null;
1685
+ let bestWithAllowanceBal = -1;
1686
+ let bestActive = null;
1687
+ let bestActiveBal = -1;
1688
+ let bestAny = null;
1689
+ let bestAnyBal = -1;
1684
1690
  for (const wallet of wallets) {
1685
- if (wallet.status === "ACTIVE" && wallet.sources.some((source) => source.balance.available.amount >= transferAmount)) {
1686
- return wallet;
1687
- }
1688
- }
1689
- let bestWallet = null;
1690
- let bestBalance = -1;
1691
- let bestIsActive = false;
1692
- for (const wallet of wallets) {
1693
- const walletBal = wallet.balance.available.amount;
1694
1691
  const isActive = wallet.status === "ACTIVE";
1695
- if (walletBal > bestBalance || walletBal === bestBalance && isActive && !bestIsActive) {
1696
- bestBalance = walletBal;
1697
- bestWallet = wallet;
1698
- bestIsActive = isActive;
1692
+ const walletBal = wallet.balance.available.amount;
1693
+ if (isActive) {
1694
+ const hasFullyEligibleSource = wallet.sources.some(
1695
+ (s) => s.balance.available.amount >= transferAmount && s.remainingAllowance != null && s.remainingAllowance >= transferAmount
1696
+ );
1697
+ if (hasFullyEligibleSource && walletBal > bestWithAllowanceBal) {
1698
+ bestWithAllowance = wallet;
1699
+ bestWithAllowanceBal = walletBal;
1700
+ }
1701
+ if (walletBal > bestActiveBal) {
1702
+ bestActive = wallet;
1703
+ bestActiveBal = walletBal;
1704
+ }
1705
+ }
1706
+ if (walletBal > bestAnyBal) {
1707
+ bestAny = wallet;
1708
+ bestAnyBal = walletBal;
1699
1709
  }
1700
1710
  }
1701
- return bestWallet ?? wallets[0];
1711
+ return bestWithAllowance ?? bestActive ?? bestAny ?? wallets[0];
1702
1712
  }
1703
1713
  function getDepositEligibleAccounts(accounts) {
1704
1714
  return accounts.filter((account) => getAddressableWallets(account).length > 0);
@@ -1718,7 +1728,9 @@ function resolveDepositSelection(accounts, transferAmount, selectedAccountId) {
1718
1728
  }
1719
1729
  for (const account of eligibleAccounts) {
1720
1730
  const fullyEligibleWallet = getAddressableWallets(account).find(
1721
- (wallet) => wallet.status === "ACTIVE" && wallet.sources.some((source) => source.balance.available.amount >= transferAmount)
1731
+ (wallet) => wallet.status === "ACTIVE" && wallet.sources.some(
1732
+ (source) => source.balance.available.amount >= transferAmount && source.remainingAllowance != null && source.remainingAllowance >= transferAmount
1733
+ )
1722
1734
  );
1723
1735
  if (fullyEligibleWallet) {
1724
1736
  return {
@@ -2238,9 +2250,7 @@ function PoweredByFooter() {
2238
2250
  fill: "currentColor"
2239
2251
  }
2240
2252
  ) }),
2241
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Powered by Swype" }),
2242
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: dotStyle, children: "\xB7" }),
2243
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Non-custodial" })
2253
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Powered by Blink" })
2244
2254
  ] });
2245
2255
  }
2246
2256
  var containerStyle3 = (color) => ({
@@ -2252,7 +2262,6 @@ var containerStyle3 = (color) => ({
2252
2262
  color,
2253
2263
  padding: "12px 0 4px"
2254
2264
  });
2255
- var dotStyle = { opacity: 0.5 };
2256
2265
  function PrimaryButton({ children, onClick, disabled, loading, icon }) {
2257
2266
  const { tokens } = useSwypeConfig();
2258
2267
  const isDisabled = disabled || loading;
@@ -3035,7 +3044,7 @@ function LoginScreen({
3035
3044
  ScreenLayout,
3036
3045
  {
3037
3046
  footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3038
- /* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onSubmit, disabled, loading: sending, children: "Continue" }),
3047
+ /* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onSubmit, disabled, loading: sending, children: "Next" }),
3039
3048
  onSocialLogin && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3040
3049
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: dividerStyle(tokens), children: [
3041
3050
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: dividerLineStyle(tokens.border) }),
@@ -3053,10 +3062,6 @@ function LoginScreen({
3053
3062
  provider
3054
3063
  )) })
3055
3064
  ] }),
3056
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: walletSectionStyle, children: [
3057
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: walletLabelStyle(tokens.textMuted), children: "Works with" }),
3058
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: walletLogosStyle, children: walletIcons.map(({ key, logo }) => /* @__PURE__ */ jsxRuntime.jsx("img", { src: logo, alt: key, style: walletLogoImgStyle }, key)) })
3059
- ] }),
3060
3065
  /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
3061
3066
  ] }),
3062
3067
  children: [
@@ -3069,8 +3074,7 @@ function LoginScreen({
3069
3074
  ),
3070
3075
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle2, children: [
3071
3076
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: iconBoxStyle(tokens.accent), children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: iconLetterStyle, children: "S" }) }),
3072
- /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle(tokens.text), children: "One-time setup.\nOne-tap deposits after." }),
3073
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle(tokens.textSecondary), children: "Protected by Face ID." }),
3077
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle(tokens.text), children: "Your Money. Any App. One Tap." }),
3074
3078
  error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorStyle(tokens), children: error }),
3075
3079
  /* @__PURE__ */ jsxRuntime.jsx(
3076
3080
  "input",
@@ -3093,11 +3097,6 @@ function LoginScreen({
3093
3097
  }
3094
3098
  );
3095
3099
  }
3096
- var walletIcons = [
3097
- { key: "metamask", logo: KNOWN_LOGOS["metamask"] },
3098
- { key: "base", logo: KNOWN_LOGOS["base"] },
3099
- { key: "trust wallet", logo: KNOWN_LOGOS["trust wallet"] }
3100
- ];
3101
3100
  function socialLabel(provider) {
3102
3101
  switch (provider) {
3103
3102
  case "google":
@@ -3140,12 +3139,6 @@ var headingStyle = (color) => ({
3140
3139
  margin: "20px 0 8px",
3141
3140
  whiteSpace: "pre-line"
3142
3141
  });
3143
- var subtitleStyle = (color) => ({
3144
- fontSize: "0.84rem",
3145
- color,
3146
- margin: "0 0 24px",
3147
- lineHeight: 1.5
3148
- });
3149
3142
  var inputStyle2 = (tokens) => ({
3150
3143
  width: "100%",
3151
3144
  padding: "15px 16px",
@@ -3200,27 +3193,6 @@ var socialButtonStyle = (tokens) => ({
3200
3193
  fontFamily: "inherit",
3201
3194
  cursor: "pointer"
3202
3195
  });
3203
- var walletSectionStyle = {
3204
- textAlign: "center",
3205
- marginBottom: 8,
3206
- marginTop: 4
3207
- };
3208
- var walletLabelStyle = (color) => ({
3209
- fontSize: "0.78rem",
3210
- color,
3211
- display: "block",
3212
- marginBottom: 10
3213
- });
3214
- var walletLogosStyle = {
3215
- display: "flex",
3216
- justifyContent: "center",
3217
- gap: 16
3218
- };
3219
- var walletLogoImgStyle = {
3220
- width: 24,
3221
- height: 24,
3222
- objectFit: "contain"
3223
- };
3224
3196
  var avatarStyle = (tokens) => ({
3225
3197
  width: 28,
3226
3198
  height: 28,
@@ -3278,40 +3250,38 @@ function OtpVerifyScreen({
3278
3250
  });
3279
3251
  }, 1e3);
3280
3252
  }, [cooldown, onResend]);
3281
- return /* @__PURE__ */ jsxRuntime.jsxs(ScreenLayout, { footer: /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {}), children: [
3282
- /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack }),
3283
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle3, children: [
3284
- /* @__PURE__ */ jsxRuntime.jsx(IconCircle, { variant: "accent", size: 56, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
3285
- "path",
3286
- {
3287
- d: "M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4z",
3288
- fill: tokens.accent
3289
- }
3290
- ) }) }),
3291
- /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle2(tokens.text), children: "Check your email" }),
3292
- /* @__PURE__ */ jsxRuntime.jsxs("p", { style: subtitleStyle2(tokens.textSecondary), children: [
3293
- "We sent a 6-digit code to",
3294
- "\n",
3295
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: maskedIdentifier })
3296
- ] }),
3297
- error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle(tokens), children: error }),
3298
- /* @__PURE__ */ jsxRuntime.jsx(OtpInput, { value: otpCode, onChange: onOtpChange, disabled: verifying }),
3299
- /* @__PURE__ */ jsxRuntime.jsx(
3300
- "button",
3301
- {
3302
- type: "button",
3303
- onClick: handleResend,
3304
- disabled: cooldown > 0,
3305
- style: resendStyle(tokens.textMuted, cooldown > 0),
3306
- children: cooldown > 0 ? `Resend code in ${cooldown}s` : "Resend code"
3307
- }
3308
- ),
3309
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: actionStyle, children: [
3253
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3254
+ ScreenLayout,
3255
+ {
3256
+ footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3310
3257
  /* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onVerify, disabled, loading: verifying, children: "Verify" }),
3311
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: hintStyle(tokens.textMuted), children: "Didn't get the code? Check your spam folder" })
3312
- ] })
3313
- ] })
3314
- ] });
3258
+ /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
3259
+ ] }),
3260
+ children: [
3261
+ /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack }),
3262
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle3, children: [
3263
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle2(tokens.text), children: "Confirm it is you" }),
3264
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { style: subtitleStyle(tokens.textSecondary), children: [
3265
+ "We sent a 6-digit code to",
3266
+ "\n",
3267
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: maskedIdentifier })
3268
+ ] }),
3269
+ error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle(tokens), children: error }),
3270
+ /* @__PURE__ */ jsxRuntime.jsx(OtpInput, { value: otpCode, onChange: onOtpChange, disabled: verifying }),
3271
+ /* @__PURE__ */ jsxRuntime.jsx(
3272
+ "button",
3273
+ {
3274
+ type: "button",
3275
+ onClick: handleResend,
3276
+ disabled: cooldown > 0,
3277
+ style: resendStyle(tokens.textMuted, cooldown > 0),
3278
+ children: cooldown > 0 ? `Resend code in ${cooldown}s` : "Resend code"
3279
+ }
3280
+ )
3281
+ ] })
3282
+ ]
3283
+ }
3284
+ );
3315
3285
  }
3316
3286
  var contentStyle3 = {
3317
3287
  textAlign: "center",
@@ -3327,7 +3297,7 @@ var headingStyle2 = (color) => ({
3327
3297
  color,
3328
3298
  margin: "20px 0 8px"
3329
3299
  });
3330
- var subtitleStyle2 = (color) => ({
3300
+ var subtitleStyle = (color) => ({
3331
3301
  fontSize: "0.88rem",
3332
3302
  color,
3333
3303
  margin: "0 0 28px",
@@ -3357,16 +3327,6 @@ var resendStyle = (color, disabled) => ({
3357
3327
  padding: 0,
3358
3328
  opacity: disabled ? 0.6 : 1
3359
3329
  });
3360
- var actionStyle = {
3361
- width: "100%",
3362
- marginTop: 32
3363
- };
3364
- var hintStyle = (color) => ({
3365
- textAlign: "center",
3366
- fontSize: "0.78rem",
3367
- color,
3368
- margin: "12px 0 0"
3369
- });
3370
3330
  function PasskeyScreen({
3371
3331
  onCreatePasskey,
3372
3332
  onBack,
@@ -3377,7 +3337,7 @@ function PasskeyScreen({
3377
3337
  }) {
3378
3338
  const { tokens } = useSwypeConfig();
3379
3339
  const handleCreate = popupFallback && onCreatePasskeyViaPopup ? onCreatePasskeyViaPopup : onCreatePasskey;
3380
- const buttonLabel = popupFallback ? "Open passkey window" : "Create or verify passkey";
3340
+ const buttonLabel = popupFallback ? "Open passkey window" : "Verify PassKey";
3381
3341
  return /* @__PURE__ */ jsxRuntime.jsxs(
3382
3342
  ScreenLayout,
3383
3343
  {
@@ -3388,16 +3348,8 @@ function PasskeyScreen({
3388
3348
  children: [
3389
3349
  /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack }),
3390
3350
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle4, children: [
3391
- /* @__PURE__ */ jsxRuntime.jsx(IconCircle, { variant: "accent", size: 64, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "36", height: "36", viewBox: "0 0 24 24", fill: "none", children: [
3392
- /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "4", y: "4", width: "16", height: "16", rx: "3", stroke: tokens.accent, strokeWidth: "1.5", strokeDasharray: "3 2" }),
3393
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "9", cy: "10", r: "1", fill: tokens.accent }),
3394
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "15", cy: "10", r: "1", fill: tokens.accent }),
3395
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 14c0 1.5 1.34 2.5 3 2.5s3-1 3-2.5", stroke: tokens.accent, strokeWidth: "1.2", strokeLinecap: "round" })
3396
- ] }) }),
3397
- /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle3(tokens.text), children: "Create or verify your passkey" }),
3398
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle3(tokens.textSecondary), children: popupFallback ? "Your browser requires a separate window to continue. Tap the button below to continue." : "Use Face ID to sign in instantly \u2014 no passwords, no codes." }),
3399
- error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle2(tokens), children: error }),
3400
- /* @__PURE__ */ jsxRuntime.jsx(InfoBanner, { children: "Your passkey is stored securely on your device. Swype never sees your biometric data." })
3351
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle3(tokens.text), children: "Secure your account with a passkey" }),
3352
+ error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle2(tokens), children: error })
3401
3353
  ] })
3402
3354
  ]
3403
3355
  }
@@ -3418,13 +3370,6 @@ var headingStyle3 = (color) => ({
3418
3370
  color,
3419
3371
  margin: "24px 0 8px"
3420
3372
  });
3421
- var subtitleStyle3 = (color) => ({
3422
- fontSize: "0.9rem",
3423
- color,
3424
- margin: "0 0 28px",
3425
- lineHeight: 1.5,
3426
- maxWidth: 280
3427
- });
3428
3373
  var errorBannerStyle2 = (tokens) => ({
3429
3374
  background: tokens.errorBg,
3430
3375
  border: `1px solid ${tokens.error}66`,
@@ -3493,6 +3438,8 @@ function WalletPickerScreen({
3493
3438
  }) {
3494
3439
  const { tokens } = useSwypeConfig();
3495
3440
  const [hoveredId, setHoveredId] = react.useState(null);
3441
+ const [selectedProviderId, setSelectedProviderId] = react.useState(null);
3442
+ const [cryptoExpanded, setCryptoExpanded] = react.useState(false);
3496
3443
  const hasPending = pendingConnections != null && pendingConnections.length > 0;
3497
3444
  const displayProviders = providers.length > 0 ? providers : [
3498
3445
  { id: "metamask", name: "MetaMask" },
@@ -3500,6 +3447,7 @@ function WalletPickerScreen({
3500
3447
  { id: "ora", name: "Ora" },
3501
3448
  { id: "phantom", name: "Phantom" }
3502
3449
  ];
3450
+ const selectedProvider = displayProviders.find((p) => p.id === selectedProviderId);
3503
3451
  if (loading) {
3504
3452
  return /* @__PURE__ */ jsxRuntime.jsxs(ScreenLayout, { children: [
3505
3453
  /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: "Set up Swype", onBack }),
@@ -3510,14 +3458,18 @@ function WalletPickerScreen({
3510
3458
  ScreenLayout,
3511
3459
  {
3512
3460
  footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3513
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: hintStyle2(tokens.textMuted), children: "You'll set your deposit limit in your wallet app." }),
3461
+ selectedProvider && /* @__PURE__ */ jsxRuntime.jsxs(PrimaryButton, { onClick: () => onSelectProvider(selectedProvider.id), children: [
3462
+ "Open ",
3463
+ selectedProvider.name,
3464
+ " to Link"
3465
+ ] }),
3514
3466
  /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
3515
3467
  ] }),
3516
3468
  children: [
3517
3469
  /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: "Set up Swype", onBack }),
3518
3470
  hasPending && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3519
3471
  /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle4(tokens.text), children: "Continue where you left off" }),
3520
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle4(tokens.textSecondary), children: "You have a wallet that still needs setup" }),
3472
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle2(tokens.textSecondary), children: "You have a wallet that still needs setup" }),
3521
3473
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: pendingListStyle, children: pendingConnections.map((acct) => {
3522
3474
  const wallet = acct.wallets[0];
3523
3475
  const address = wallet ? truncateAddress(wallet.name) : void 0;
@@ -3556,21 +3508,41 @@ function WalletPickerScreen({
3556
3508
  }) }),
3557
3509
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: dividerStyle2(tokens.border), children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: dividerTextStyle(tokens.textMuted), children: "Or connect a new wallet" }) })
3558
3510
  ] }),
3559
- !hasPending && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3560
- /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle4(tokens.text), children: "Where are your stablecoins?" }),
3561
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle4(tokens.textSecondary), children: "Select the wallet you want to deposit from" })
3562
- ] }),
3563
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: gridStyle, children: displayProviders.map((p) => {
3511
+ !hasPending && /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle4(tokens.text), children: "Where is your money?" }),
3512
+ /* @__PURE__ */ jsxRuntime.jsxs(
3513
+ "button",
3514
+ {
3515
+ type: "button",
3516
+ onClick: () => setCryptoExpanded((v) => !v),
3517
+ style: categoryRowStyle(tokens, cryptoExpanded),
3518
+ children: [
3519
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: categoryLabelStyle, children: "Crypto Wallet" }),
3520
+ /* @__PURE__ */ jsxRuntime.jsx(
3521
+ "svg",
3522
+ {
3523
+ width: "18",
3524
+ height: "18",
3525
+ viewBox: "0 0 24 24",
3526
+ fill: "none",
3527
+ style: { transform: cryptoExpanded ? "rotate(180deg)" : "none", transition: "transform 0.2s ease" },
3528
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z", fill: "currentColor" })
3529
+ }
3530
+ )
3531
+ ]
3532
+ }
3533
+ ),
3534
+ cryptoExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { style: gridStyle, children: displayProviders.map((p) => {
3564
3535
  const logoSrc = "logoURI" in p && p.logoURI || KNOWN_LOGOS[p.name.toLowerCase()];
3565
3536
  const emoji = WALLET_EMOJIS[p.name.toLowerCase()] ?? p.name.charAt(0);
3537
+ const isSelected = selectedProviderId === p.id;
3566
3538
  const isHovered = hoveredId === p.id;
3567
3539
  return /* @__PURE__ */ jsxRuntime.jsxs(
3568
3540
  "button",
3569
3541
  {
3570
- onClick: () => onSelectProvider(p.id),
3542
+ onClick: () => setSelectedProviderId(p.id),
3571
3543
  onMouseEnter: () => setHoveredId(p.id),
3572
3544
  onMouseLeave: () => setHoveredId(null),
3573
- style: cardStyle(tokens, isHovered),
3545
+ style: cardStyle(tokens, isHovered, isSelected),
3574
3546
  children: [
3575
3547
  logoSrc ? /* @__PURE__ */ jsxRuntime.jsx(
3576
3548
  "img",
@@ -3585,7 +3557,11 @@ function WalletPickerScreen({
3585
3557
  },
3586
3558
  p.id
3587
3559
  );
3588
- }) })
3560
+ }) }),
3561
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: categoryRowStyle(tokens, false, true), children: [
3562
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: categoryLabelStyle, children: "Bank Account" }),
3563
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: comingSoonBadgeStyle(tokens), children: "Coming Soon" })
3564
+ ] })
3589
3565
  ]
3590
3566
  }
3591
3567
  );
@@ -3597,7 +3573,7 @@ var headingStyle4 = (color) => ({
3597
3573
  color,
3598
3574
  margin: "8px 0 4px"
3599
3575
  });
3600
- var subtitleStyle4 = (color) => ({
3576
+ var subtitleStyle2 = (color) => ({
3601
3577
  fontSize: "0.88rem",
3602
3578
  color,
3603
3579
  margin: "0 0 24px"
@@ -3605,9 +3581,11 @@ var subtitleStyle4 = (color) => ({
3605
3581
  var gridStyle = {
3606
3582
  display: "grid",
3607
3583
  gridTemplateColumns: "1fr 1fr",
3608
- gap: 12
3584
+ gap: 12,
3585
+ marginBottom: 12
3609
3586
  };
3610
- var cardStyle = (tokens, hovered) => ({
3587
+ var SELECTED_GREEN = "#22c55e";
3588
+ var cardStyle = (tokens, hovered, selected) => ({
3611
3589
  display: "flex",
3612
3590
  flexDirection: "column",
3613
3591
  alignItems: "center",
@@ -3615,11 +3593,12 @@ var cardStyle = (tokens, hovered) => ({
3615
3593
  gap: 8,
3616
3594
  padding: "20px 12px",
3617
3595
  background: hovered ? tokens.bgHover : tokens.bgInput,
3618
- border: `1.5px solid ${tokens.border}`,
3596
+ border: selected ? `2px solid ${SELECTED_GREEN}` : `1.5px solid ${tokens.border}`,
3597
+ boxShadow: selected ? `0 0 0 2px ${SELECTED_GREEN}44` : "none",
3619
3598
  borderRadius: 16,
3620
3599
  cursor: "pointer",
3621
3600
  fontFamily: "inherit",
3622
- transition: "background 0.15s ease",
3601
+ transition: "background 0.15s ease, border 0.15s ease, box-shadow 0.15s ease",
3623
3602
  outline: "none"
3624
3603
  });
3625
3604
  var emojiStyle = {
@@ -3637,11 +3616,36 @@ var nameStyle2 = (color) => ({
3637
3616
  fontWeight: 600,
3638
3617
  color
3639
3618
  });
3640
- var hintStyle2 = (color) => ({
3641
- textAlign: "center",
3642
- fontSize: "0.82rem",
3643
- color,
3644
- margin: "0 0 4px"
3619
+ var categoryRowStyle = (tokens, expanded, disabled) => ({
3620
+ display: "flex",
3621
+ alignItems: "center",
3622
+ justifyContent: "space-between",
3623
+ width: "100%",
3624
+ padding: "16px 18px",
3625
+ background: tokens.bgInput,
3626
+ border: `1.5px solid ${tokens.border}`,
3627
+ borderRadius: 14,
3628
+ cursor: disabled ? "default" : "pointer",
3629
+ fontFamily: "inherit",
3630
+ fontSize: "0.95rem",
3631
+ fontWeight: 600,
3632
+ color: disabled ? tokens.textMuted : tokens.text,
3633
+ opacity: disabled ? 0.6 : 1,
3634
+ outline: "none",
3635
+ marginBottom: expanded ? 12 : 12,
3636
+ boxSizing: "border-box"
3637
+ });
3638
+ var categoryLabelStyle = {
3639
+ lineHeight: 1
3640
+ };
3641
+ var comingSoonBadgeStyle = (tokens) => ({
3642
+ fontSize: "0.72rem",
3643
+ fontWeight: 600,
3644
+ color: tokens.textMuted,
3645
+ background: `${tokens.border}88`,
3646
+ padding: "3px 10px",
3647
+ borderRadius: 6,
3648
+ whiteSpace: "nowrap"
3645
3649
  });
3646
3650
  var pendingListStyle = {
3647
3651
  display: "flex",
@@ -3766,15 +3770,14 @@ function SetupScreen({
3766
3770
  onClick: () => onSetupOneTap(limit),
3767
3771
  disabled: loading,
3768
3772
  loading,
3769
- children: "Set up One-Tap"
3773
+ children: "Approve"
3770
3774
  }
3771
3775
  ),
3772
3776
  /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
3773
3777
  ] }),
3774
3778
  children: [
3775
3779
  /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: "Swype Setup", onBack, right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout }) }),
3776
- /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle5(tokens.text), children: "Set up One-Tap deposits" }),
3777
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle5(tokens.textSecondary), children: "Set your limit for instant deposits. Like a contactless card \u2014 you choose the max." }),
3780
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle5(tokens.text), children: "Set Spending Limit" }),
3778
3781
  error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle3(tokens), children: error }),
3779
3782
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: balanceRowStyle, children: [
3780
3783
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: balanceLeftStyle, children: [
@@ -3844,14 +3847,6 @@ function SetupScreen({
3844
3847
  ]
3845
3848
  }
3846
3849
  )
3847
- ] }),
3848
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: bannerWrapStyle, children: /* @__PURE__ */ jsxRuntime.jsx(InfoBanner, { children: "Funds stay in your wallet until you deposit. Swype never holds your money." }) }),
3849
- /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", style: linkStyle(tokens.accent), children: [
3850
- /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", style: { marginRight: 6 }, children: [
3851
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "2" }),
3852
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 16v-4M12 8h.01", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })
3853
- ] }),
3854
- "How does this work?"
3855
3850
  ] })
3856
3851
  ]
3857
3852
  }
@@ -3864,12 +3859,6 @@ var headingStyle5 = (color) => ({
3864
3859
  color,
3865
3860
  margin: "8px 0 4px"
3866
3861
  });
3867
- var subtitleStyle5 = (color) => ({
3868
- fontSize: "0.86rem",
3869
- color,
3870
- margin: "0 0 24px",
3871
- lineHeight: 1.5
3872
- });
3873
3862
  var errorBannerStyle3 = (tokens) => ({
3874
3863
  background: tokens.errorBg,
3875
3864
  border: `1px solid ${tokens.error}66`,
@@ -3973,20 +3962,6 @@ var limitInputStyle = (color) => ({
3973
3962
  fontFamily: "inherit",
3974
3963
  padding: 0
3975
3964
  });
3976
- var bannerWrapStyle = { marginBottom: 16 };
3977
- var linkStyle = (color) => ({
3978
- background: "transparent",
3979
- border: "none",
3980
- color,
3981
- cursor: "pointer",
3982
- fontFamily: "inherit",
3983
- fontSize: "0.82rem",
3984
- fontWeight: 500,
3985
- display: "flex",
3986
- alignItems: "center",
3987
- padding: 0,
3988
- marginBottom: 16
3989
- });
3990
3965
  function SetupStatusScreen({
3991
3966
  complete,
3992
3967
  limit,
@@ -4451,14 +4426,14 @@ function SuccessScreen({
4451
4426
  amount.toFixed(2),
4452
4427
  " deposited"
4453
4428
  ] }),
4454
- merchantName && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: subtitleStyle6(tokens.textSecondary), children: [
4429
+ merchantName && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: subtitleStyle3(tokens.textSecondary), children: [
4455
4430
  "to ",
4456
4431
  merchantName
4457
4432
  ] })
4458
4433
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4459
4434
  /* @__PURE__ */ jsxRuntime.jsx(IconCircle, { variant: "error", size: 64, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z", fill: tokens.error }) }) }),
4460
4435
  /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle7(tokens.text), children: "Transfer failed" }),
4461
- error && /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle6(tokens.error), children: error })
4436
+ error && /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle3(tokens.error), children: error })
4462
4437
  ] }),
4463
4438
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: summaryCardStyle(tokens), children: [
4464
4439
  sourceName && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: summaryRowStyle, children: [
@@ -4504,7 +4479,7 @@ var headingStyle7 = (color) => ({
4504
4479
  color,
4505
4480
  margin: "20px 0 4px"
4506
4481
  });
4507
- var subtitleStyle6 = (color) => ({
4482
+ var subtitleStyle3 = (color) => ({
4508
4483
  fontSize: "0.9rem",
4509
4484
  color,
4510
4485
  margin: "0 0 20px"
@@ -4612,7 +4587,7 @@ function SelectSourceScreen({
4612
4587
  right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout })
4613
4588
  }
4614
4589
  ),
4615
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle7(tokens.textMuted), children: "Choose which chain and token to pay from." }),
4590
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle4(tokens.textMuted), children: "Choose which chain and token to pay from." }),
4616
4591
  /* @__PURE__ */ jsxRuntime.jsx("label", { style: labelStyle2(tokens.textSecondary), children: "Chain" }),
4617
4592
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: optionListStyle, children: choices.map((chain) => {
4618
4593
  const isSelected = chain.chainName === selectedChainName;
@@ -4669,7 +4644,7 @@ function SelectSourceScreen({
4669
4644
  }
4670
4645
  );
4671
4646
  }
4672
- var subtitleStyle7 = (color) => ({
4647
+ var subtitleStyle4 = (color) => ({
4673
4648
  fontSize: "0.85rem",
4674
4649
  color,
4675
4650
  margin: "0 0 20px",
@@ -4785,7 +4760,7 @@ function AdvancedSourceScreen({
4785
4760
  }
4786
4761
  ),
4787
4762
  /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle8(tokens.text), children: "Set up One-Tap deposits" }),
4788
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle8(tokens.textSecondary), children: "Select a token source for your One-Tap deposits." }),
4763
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle5(tokens.textSecondary), children: "Select a token source for your One-Tap deposits." }),
4789
4764
  /* @__PURE__ */ jsxRuntime.jsx("label", { style: labelStyle3(tokens.textSecondary), children: "Select tokens to approve" }),
4790
4765
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: chainListStyle, children: choices.map((chain) => {
4791
4766
  const isExpanded = expandedChain === chain.chainName;
@@ -4855,7 +4830,7 @@ var headingStyle8 = (color) => ({
4855
4830
  color,
4856
4831
  margin: "8px 0 4px"
4857
4832
  });
4858
- var subtitleStyle8 = (color) => ({
4833
+ var subtitleStyle5 = (color) => ({
4859
4834
  fontSize: "0.86rem",
4860
4835
  color,
4861
4836
  margin: "0 0 20px",
@@ -5087,14 +5062,14 @@ function OpenWalletScreen({
5087
5062
  displayName
5088
5063
  ] }),
5089
5064
  error && onRetryStatus && /* @__PURE__ */ jsxRuntime.jsx(OutlineButton, { onClick: onRetryStatus, children: "Retry status check" }),
5090
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: hintStyle3(tokens.textMuted), children: loading ? "Preparing authorization..." : error ? "Retry the status check after returning to the browser, or reopen your wallet if needed." : "If your wallet didn't open automatically, tap the button above" })
5065
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: hintStyle(tokens.textMuted), children: loading ? "Preparing authorization..." : error ? "Retry the status check after returning to the browser, or reopen your wallet if needed." : "If your wallet didn't open automatically, tap the button above" })
5091
5066
  ] }),
5092
5067
  children: [
5093
5068
  /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack, right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout }) }),
5094
5069
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle8, children: [
5095
5070
  logoSrc ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logoSrc, alt: displayName, style: logoStyle }) : /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 48 }),
5096
5071
  /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle10(tokens.text), children: loading ? "Connecting..." : `Open ${displayName}` }),
5097
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle9(tokens.textSecondary), children: loading ? "Creating transfer and preparing your wallet link..." : `Continue in ${displayName} to authorize this connection.` }),
5072
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle6(tokens.textSecondary), children: loading ? "Creating transfer and preparing your wallet link..." : `Continue in ${displayName} to authorize this connection.` }),
5098
5073
  !loading && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: waitingBadgeStyle(tokens), children: [
5099
5074
  /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 14 }),
5100
5075
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Waiting for authorization..." })
@@ -5131,7 +5106,7 @@ var headingStyle10 = (color) => ({
5131
5106
  color,
5132
5107
  margin: "20px 0 8px"
5133
5108
  });
5134
- var subtitleStyle9 = (color) => ({
5109
+ var subtitleStyle6 = (color) => ({
5135
5110
  fontSize: "0.9rem",
5136
5111
  color,
5137
5112
  margin: "0 0 24px",
@@ -5149,7 +5124,7 @@ var waitingBadgeStyle = (tokens) => ({
5149
5124
  color: tokens.textMuted,
5150
5125
  fontSize: "0.82rem"
5151
5126
  });
5152
- var hintStyle3 = (color) => ({
5127
+ var hintStyle = (color) => ({
5153
5128
  textAlign: "center",
5154
5129
  fontSize: "0.82rem",
5155
5130
  color,
@@ -5171,14 +5146,14 @@ function ConfirmSignScreen({
5171
5146
  footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5172
5147
  /* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onSign, disabled: signing, children: signing ? "Confirming..." : "Confirm payment" }),
5173
5148
  error && /* @__PURE__ */ jsxRuntime.jsx("p", { style: errorStyle2(tokens.textMuted), children: error }),
5174
- !error && /* @__PURE__ */ jsxRuntime.jsx("p", { style: hintStyle4(tokens.textMuted), children: "You may be prompted for biometric verification" })
5149
+ !error && /* @__PURE__ */ jsxRuntime.jsx("p", { style: hintStyle2(tokens.textMuted), children: "You may be prompted for biometric verification" })
5175
5150
  ] }),
5176
5151
  children: [
5177
5152
  /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout }) }),
5178
5153
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle9, children: [
5179
5154
  logoSrc ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logoSrc, alt: displayName, style: logoStyle2 }) : /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 48 }),
5180
5155
  /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle11(tokens.text), children: "Wallet authorized" }),
5181
- /* @__PURE__ */ jsxRuntime.jsxs("p", { style: subtitleStyle10(tokens.textSecondary), children: [
5156
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { style: subtitleStyle7(tokens.textSecondary), children: [
5182
5157
  displayName,
5183
5158
  " approved the connection. Tap below to confirm your payment."
5184
5159
  ] }),
@@ -5213,7 +5188,7 @@ var headingStyle11 = (color) => ({
5213
5188
  color,
5214
5189
  margin: "20px 0 8px"
5215
5190
  });
5216
- var subtitleStyle10 = (color) => ({
5191
+ var subtitleStyle7 = (color) => ({
5217
5192
  fontSize: "0.9rem",
5218
5193
  color,
5219
5194
  margin: "0 0 24px",
@@ -5235,7 +5210,7 @@ var checkmarkStyle = {
5235
5210
  fontWeight: 700,
5236
5211
  fontSize: "0.9rem"
5237
5212
  };
5238
- var hintStyle4 = (color) => ({
5213
+ var hintStyle2 = (color) => ({
5239
5214
  textAlign: "center",
5240
5215
  fontSize: "0.82rem",
5241
5216
  color,
@@ -5310,7 +5285,7 @@ function TokenPickerScreen({
5310
5285
  ] }),
5311
5286
  children: [
5312
5287
  /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: "Select Token", onBack }),
5313
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle11(themeTokens.textSecondary), children: "Choose a token to deposit with. Tokens that haven't been authorized yet will require a one-time wallet approval." }),
5288
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle8(themeTokens.textSecondary), children: "Choose a token to deposit with. Tokens that haven't been authorized yet will require a one-time wallet approval." }),
5314
5289
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: chainListStyle2, children: [...chainGroups.entries()].map(([chainName, chainEntries]) => {
5315
5290
  const isExpanded = expandedChain === chainName;
5316
5291
  const chainTotal = chainEntries.reduce((sum, e) => sum + e.balance, 0);
@@ -5366,7 +5341,7 @@ function TokenPickerScreen({
5366
5341
  }
5367
5342
  );
5368
5343
  }
5369
- var subtitleStyle11 = (color) => ({
5344
+ var subtitleStyle8 = (color) => ({
5370
5345
  fontSize: "0.86rem",
5371
5346
  color,
5372
5347
  margin: "0 0 20px",
@@ -6474,6 +6449,9 @@ function useProviderHandlers(deps) {
6474
6449
  useWalletConnectorProp,
6475
6450
  activeCredentialId,
6476
6451
  selectedAccountId,
6452
+ selectedWalletId,
6453
+ selectedTokenSymbol,
6454
+ chains,
6477
6455
  accounts,
6478
6456
  providers,
6479
6457
  authExecutor,
@@ -6600,11 +6578,17 @@ function useProviderHandlers(deps) {
6600
6578
  try {
6601
6579
  const token = await getAccessToken();
6602
6580
  if (!token) throw new Error("Not authenticated");
6581
+ const wallet = acct?.wallets.find((w) => w.id === selectedWalletId);
6582
+ const source = wallet?.sources.find(
6583
+ (s) => selectedTokenSymbol ? s.token.symbol === selectedTokenSymbol : s.token.status === "AUTHORIZED"
6584
+ );
6585
+ const evmChainId = chains.find((c) => c.name === wallet?.chain.name)?.commonId ?? void 0;
6603
6586
  const session = await createAccountAuthorizationSession(
6604
6587
  apiBaseUrl,
6605
6588
  token,
6606
6589
  selectedAccountId,
6607
- activeCredentialId
6590
+ activeCredentialId,
6591
+ { tokenAddress: source?.address, chainId: evmChainId }
6608
6592
  );
6609
6593
  const isMobile = !shouldUseWalletConnector({
6610
6594
  useWalletConnector: useWalletConnectorProp,
@@ -6642,6 +6626,9 @@ function useProviderHandlers(deps) {
6642
6626
  }
6643
6627
  }, [
6644
6628
  selectedAccountId,
6629
+ selectedWalletId,
6630
+ selectedTokenSymbol,
6631
+ chains,
6645
6632
  activeCredentialId,
6646
6633
  accounts,
6647
6634
  providers,
@@ -7507,6 +7494,9 @@ function SwypePaymentInner({
7507
7494
  useWalletConnectorProp,
7508
7495
  activeCredentialId: state.activeCredentialId,
7509
7496
  selectedAccountId: state.selectedAccountId,
7497
+ selectedWalletId: state.selectedWalletId,
7498
+ selectedTokenSymbol: state.selectedTokenSymbol,
7499
+ chains: state.chains,
7510
7500
  accounts: state.accounts,
7511
7501
  providers: state.providers,
7512
7502
  authExecutor,