@swype-org/react-sdk 0.1.187 → 0.1.190

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.js CHANGED
@@ -2720,357 +2720,6 @@ var inputStyle = (tokens, filled) => ({
2720
2720
  caretColor: tokens.borderFocus,
2721
2721
  transition: "border-color 0.15s ease"
2722
2722
  });
2723
- function SourceCard({
2724
- name,
2725
- address,
2726
- verified,
2727
- accounts,
2728
- selectedAccountId,
2729
- depositAmount,
2730
- onSelectAccount,
2731
- onAuthorizeAccount,
2732
- onAddProvider
2733
- }) {
2734
- const { tokens } = useSwypeConfig();
2735
- const [open, setOpen] = useState(false);
2736
- const containerRef = useRef(null);
2737
- const hasDropdown = accounts != null && accounts.length > 0;
2738
- useEffect(() => {
2739
- if (!open) return;
2740
- const handleClick = (e) => {
2741
- if (containerRef.current && !containerRef.current.contains(e.target)) {
2742
- setOpen(false);
2743
- }
2744
- };
2745
- document.addEventListener("mousedown", handleClick);
2746
- return () => document.removeEventListener("mousedown", handleClick);
2747
- }, [open]);
2748
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, style: { position: "relative" }, children: [
2749
- /* @__PURE__ */ jsxs("div", { style: cardContainerStyle(tokens), children: [
2750
- /* @__PURE__ */ jsxs("div", { style: leftStyle, children: [
2751
- KNOWN_LOGOS[name.toLowerCase()] ? /* @__PURE__ */ jsx(
2752
- "img",
2753
- {
2754
- src: KNOWN_LOGOS[name.toLowerCase()],
2755
- alt: name,
2756
- style: logoImgStyle
2757
- }
2758
- ) : /* @__PURE__ */ jsx("div", { style: iconStyle3(tokens.textMuted), children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(
2759
- "path",
2760
- {
2761
- d: "M21 7H3c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2zm0 8H3V9h18v6z",
2762
- fill: "currentColor"
2763
- }
2764
- ) }) }),
2765
- /* @__PURE__ */ jsxs("div", { children: [
2766
- /* @__PURE__ */ jsxs("div", { style: nameRowStyle, children: [
2767
- /* @__PURE__ */ jsx("span", { style: nameStyle(tokens.text), children: name }),
2768
- verified && /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: tokens.accent }) })
2769
- ] }),
2770
- address && /* @__PURE__ */ jsx("span", { style: addressStyle(tokens.textMuted), children: address })
2771
- ] })
2772
- ] }),
2773
- hasDropdown && /* @__PURE__ */ jsxs(
2774
- "button",
2775
- {
2776
- type: "button",
2777
- onClick: () => setOpen(!open),
2778
- style: changeStyle(tokens.accent),
2779
- children: [
2780
- "Change source",
2781
- /* @__PURE__ */ jsx(
2782
- "svg",
2783
- {
2784
- width: "10",
2785
- height: "10",
2786
- viewBox: "0 0 24 24",
2787
- fill: "none",
2788
- style: {
2789
- marginLeft: 4,
2790
- transform: open ? "rotate(180deg)" : "rotate(0deg)",
2791
- transition: "transform 0.15s ease"
2792
- },
2793
- children: /* @__PURE__ */ jsx(
2794
- "path",
2795
- {
2796
- d: "M7 10l5 5 5-5",
2797
- stroke: tokens.accent,
2798
- strokeWidth: "2.5",
2799
- strokeLinecap: "round",
2800
- strokeLinejoin: "round"
2801
- }
2802
- )
2803
- }
2804
- )
2805
- ]
2806
- }
2807
- )
2808
- ] }),
2809
- open && hasDropdown && /* @__PURE__ */ jsxs("div", { style: dropdownStyle2(tokens), children: [
2810
- accounts.map((account) => {
2811
- const preferredWallet = getPreferredDepositWallet(account, depositAmount ?? 0);
2812
- const active = hasActiveDepositWallet(account);
2813
- const isSelected = account.id === selectedAccountId;
2814
- const displayName = account.nickname ?? account.name;
2815
- const walletAddress = preferredWallet ? getWalletAddress(preferredWallet) : null;
2816
- const hasAllowance = active && account.remainingAllowance != null;
2817
- const exceedsLimit = hasAllowance && depositAmount != null && depositAmount > account.remainingAllowance;
2818
- return /* @__PURE__ */ jsxs(
2819
- "button",
2820
- {
2821
- type: "button",
2822
- onClick: () => {
2823
- if (active) {
2824
- onSelectAccount?.(account.id);
2825
- } else {
2826
- onAuthorizeAccount?.(account.id);
2827
- }
2828
- setOpen(false);
2829
- },
2830
- style: dropdownRowStyle(tokens, active, isSelected),
2831
- children: [
2832
- /* @__PURE__ */ jsxs("div", { style: dropdownRowLeftStyle, children: [
2833
- KNOWN_LOGOS[account.name.toLowerCase()] ? /* @__PURE__ */ jsx(
2834
- "img",
2835
- {
2836
- src: KNOWN_LOGOS[account.name.toLowerCase()],
2837
- alt: account.name,
2838
- style: dropdownLogoStyle
2839
- }
2840
- ) : /* @__PURE__ */ jsx("div", { style: dropdownFallbackIconStyle(active ? tokens.textMuted : tokens.border), children: account.name.charAt(0) }),
2841
- /* @__PURE__ */ jsxs("div", { style: dropdownNameColumnStyle, children: [
2842
- /* @__PURE__ */ jsx("span", { style: dropdownNameStyle(active ? tokens.text : tokens.textMuted), children: displayName }),
2843
- walletAddress && /* @__PURE__ */ jsx("span", { style: dropdownAddressStyle(active ? tokens.textMuted : tokens.border), children: walletAddress }),
2844
- hasAllowance && /* @__PURE__ */ jsxs("span", { style: remainingAllowanceStyle(exceedsLimit ? tokens.warning : tokens.textMuted), children: [
2845
- "$",
2846
- account.remainingAllowance.toFixed(2),
2847
- " remaining"
2848
- ] })
2849
- ] })
2850
- ] }),
2851
- /* @__PURE__ */ jsx("div", { style: dropdownRowRightStyle, children: active ? exceedsLimit ? /* @__PURE__ */ jsx("span", { style: exceedsLimitBadgeStyle(tokens), children: "Exceeds limit" }) : /* @__PURE__ */ jsx("span", { style: activeBadgeStyle(tokens), children: "Active" }) : /* @__PURE__ */ jsx("span", { style: inactiveBadgeStyle(tokens), children: "Setup incomplete" }) })
2852
- ]
2853
- },
2854
- account.id
2855
- );
2856
- }),
2857
- onAddProvider && /* @__PURE__ */ jsxs(Fragment, { children: [
2858
- /* @__PURE__ */ jsx("div", { style: dropdownDividerStyle(tokens.border) }),
2859
- /* @__PURE__ */ jsxs(
2860
- "button",
2861
- {
2862
- type: "button",
2863
- onClick: () => {
2864
- onAddProvider();
2865
- setOpen(false);
2866
- },
2867
- style: addProviderStyle(tokens),
2868
- children: [
2869
- /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M12 5v14M5 12h14", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }) }),
2870
- "Add Account"
2871
- ]
2872
- }
2873
- )
2874
- ] })
2875
- ] })
2876
- ] });
2877
- }
2878
- var cardContainerStyle = (tokens) => ({
2879
- display: "flex",
2880
- alignItems: "center",
2881
- justifyContent: "space-between",
2882
- padding: "12px 16px",
2883
- background: tokens.bgInput,
2884
- border: `1px solid ${tokens.border}`,
2885
- borderRadius: 16
2886
- });
2887
- var leftStyle = {
2888
- display: "flex",
2889
- alignItems: "center",
2890
- gap: 10
2891
- };
2892
- var logoImgStyle = {
2893
- width: 20,
2894
- height: 20,
2895
- borderRadius: "50%",
2896
- objectFit: "contain"
2897
- };
2898
- var iconStyle3 = (color) => ({
2899
- color,
2900
- display: "flex",
2901
- alignItems: "center"
2902
- });
2903
- var nameRowStyle = {
2904
- display: "flex",
2905
- alignItems: "center",
2906
- gap: 4
2907
- };
2908
- var nameStyle = (color) => ({
2909
- fontWeight: 600,
2910
- fontSize: "0.9rem",
2911
- color
2912
- });
2913
- var addressStyle = (color) => ({
2914
- fontSize: "0.72rem",
2915
- color,
2916
- fontFamily: '"SF Mono", "Fira Code", monospace'
2917
- });
2918
- var changeStyle = (color) => ({
2919
- display: "flex",
2920
- alignItems: "center",
2921
- background: "transparent",
2922
- border: "none",
2923
- color,
2924
- fontWeight: 600,
2925
- fontSize: "0.82rem",
2926
- cursor: "pointer",
2927
- fontFamily: "inherit",
2928
- padding: 0
2929
- });
2930
- var dropdownStyle2 = (tokens) => ({
2931
- position: "absolute",
2932
- top: "100%",
2933
- left: 0,
2934
- right: 0,
2935
- marginTop: 4,
2936
- background: tokens.bgCard,
2937
- border: `1px solid ${tokens.border}`,
2938
- borderRadius: tokens.radiusLg,
2939
- boxShadow: tokens.shadowLg,
2940
- zIndex: 50,
2941
- overflow: "hidden"
2942
- });
2943
- var dropdownRowStyle = (tokens, active, isSelected) => ({
2944
- display: "flex",
2945
- alignItems: "center",
2946
- justifyContent: "space-between",
2947
- width: "100%",
2948
- padding: "10px 14px",
2949
- background: isSelected ? tokens.accent + "12" : "transparent",
2950
- border: "none",
2951
- borderBottom: `1px solid ${tokens.border}`,
2952
- cursor: "pointer",
2953
- fontFamily: "inherit",
2954
- fontSize: "0.85rem",
2955
- textAlign: "left",
2956
- outline: "none",
2957
- opacity: active ? 1 : 0.55,
2958
- transition: "background 0.1s ease"
2959
- });
2960
- var dropdownRowLeftStyle = {
2961
- display: "flex",
2962
- alignItems: "center",
2963
- gap: 10,
2964
- minWidth: 0,
2965
- flex: 1
2966
- };
2967
- var dropdownRowRightStyle = {
2968
- display: "flex",
2969
- alignItems: "center",
2970
- gap: 8,
2971
- flexShrink: 0
2972
- };
2973
- var dropdownLogoStyle = {
2974
- width: 20,
2975
- height: 20,
2976
- borderRadius: "50%",
2977
- objectFit: "contain",
2978
- flexShrink: 0
2979
- };
2980
- var dropdownFallbackIconStyle = (color) => ({
2981
- width: 20,
2982
- height: 20,
2983
- borderRadius: "50%",
2984
- display: "flex",
2985
- alignItems: "center",
2986
- justifyContent: "center",
2987
- fontSize: "0.72rem",
2988
- fontWeight: 700,
2989
- color,
2990
- flexShrink: 0
2991
- });
2992
- var dropdownNameColumnStyle = {
2993
- display: "flex",
2994
- flexDirection: "column",
2995
- gap: 2,
2996
- minWidth: 0
2997
- };
2998
- var dropdownNameStyle = (color) => ({
2999
- fontWeight: 500,
3000
- color,
3001
- whiteSpace: "nowrap",
3002
- overflow: "hidden",
3003
- textOverflow: "ellipsis"
3004
- });
3005
- var dropdownAddressStyle = (color) => ({
3006
- fontSize: "0.72rem",
3007
- color,
3008
- fontFamily: '"SF Mono", "Fira Code", monospace',
3009
- whiteSpace: "nowrap",
3010
- overflow: "hidden",
3011
- textOverflow: "ellipsis"
3012
- });
3013
- var activeBadgeStyle = (tokens) => ({
3014
- fontSize: "0.6rem",
3015
- fontWeight: 600,
3016
- color: tokens.success,
3017
- background: tokens.successBg,
3018
- padding: "2px 7px",
3019
- borderRadius: 999,
3020
- textTransform: "uppercase",
3021
- letterSpacing: "0.03em",
3022
- whiteSpace: "nowrap"
3023
- });
3024
- var inactiveBadgeStyle = (tokens) => ({
3025
- fontSize: "0.6rem",
3026
- fontWeight: 600,
3027
- color: tokens.warning,
3028
- background: tokens.warningBg ?? `${tokens.warning}1a`,
3029
- padding: "2px 7px",
3030
- borderRadius: 999,
3031
- textTransform: "uppercase",
3032
- letterSpacing: "0.03em",
3033
- whiteSpace: "nowrap"
3034
- });
3035
- var dropdownDividerStyle = (borderColor) => ({
3036
- height: 0,
3037
- borderTop: `1px solid ${borderColor}`
3038
- });
3039
- var remainingAllowanceStyle = (color) => ({
3040
- fontSize: "0.68rem",
3041
- color,
3042
- fontWeight: 500,
3043
- whiteSpace: "nowrap",
3044
- overflow: "hidden",
3045
- textOverflow: "ellipsis"
3046
- });
3047
- var exceedsLimitBadgeStyle = (tokens) => ({
3048
- fontSize: "0.6rem",
3049
- fontWeight: 600,
3050
- color: tokens.warning,
3051
- background: tokens.warningBg ?? `${tokens.warning}1a`,
3052
- padding: "2px 7px",
3053
- borderRadius: 999,
3054
- textTransform: "uppercase",
3055
- letterSpacing: "0.03em",
3056
- whiteSpace: "nowrap"
3057
- });
3058
- var addProviderStyle = (tokens) => ({
3059
- display: "flex",
3060
- alignItems: "center",
3061
- gap: 8,
3062
- width: "100%",
3063
- padding: "10px 14px",
3064
- background: "transparent",
3065
- border: "none",
3066
- color: tokens.accent,
3067
- fontWeight: 600,
3068
- fontSize: "0.85rem",
3069
- cursor: "pointer",
3070
- fontFamily: "inherit",
3071
- textAlign: "left",
3072
- outline: "none"
3073
- });
3074
2723
  function StepList({ steps }) {
3075
2724
  const { tokens } = useSwypeConfig();
3076
2725
  return /* @__PURE__ */ jsx("div", { style: listStyle, children: steps.map((step, i) => {
@@ -3080,11 +2729,11 @@ function StepList({ steps }) {
3080
2729
  /* @__PURE__ */ jsx(
3081
2730
  "div",
3082
2731
  {
3083
- style: isActive ? activeBadgeContainerStyle : badgeStyle2(
3084
- isComplete ? tokens.accent : tokens.border,
2732
+ style: badgeStyle2(
2733
+ isComplete || isActive ? tokens.accent : tokens.border,
3085
2734
  isComplete
3086
2735
  ),
3087
- children: isComplete ? /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: "#fff" }) }) : isActive ? /* @__PURE__ */ jsx("span", { style: activeDotStyle(tokens.accent) }) : /* @__PURE__ */ jsx("span", { style: badgeNumberStyle, children: i + 1 })
2736
+ children: isComplete ? /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: "#fff" }) }) : /* @__PURE__ */ jsx("span", { style: isActive ? activeBadgeNumberStyle(tokens.accent) : badgeNumberStyle, children: i + 1 })
3088
2737
  }
3089
2738
  ),
3090
2739
  /* @__PURE__ */ jsxs("div", { style: labelContainerStyle, children: [
@@ -3115,26 +2764,16 @@ var badgeStyle2 = (color, filled) => ({
3115
2764
  justifyContent: "center",
3116
2765
  flexShrink: 0
3117
2766
  });
3118
- var activeBadgeContainerStyle = {
3119
- width: 28,
3120
- height: 28,
3121
- display: "flex",
3122
- alignItems: "center",
3123
- justifyContent: "center",
3124
- flexShrink: 0
3125
- };
3126
- var activeDotStyle = (color) => ({
3127
- width: 8,
3128
- height: 8,
3129
- borderRadius: "50%",
3130
- backgroundColor: color,
3131
- display: "block"
3132
- });
3133
2767
  var badgeNumberStyle = {
3134
2768
  fontSize: "0.75rem",
3135
2769
  fontWeight: 600,
3136
2770
  color: "inherit"
3137
2771
  };
2772
+ var activeBadgeNumberStyle = (color) => ({
2773
+ fontSize: "0.75rem",
2774
+ fontWeight: 600,
2775
+ color
2776
+ });
3138
2777
  var labelContainerStyle = {
3139
2778
  display: "flex",
3140
2779
  flexDirection: "column"
@@ -3636,7 +3275,7 @@ function WalletPickerScreen({
3636
3275
  {
3637
3276
  src: KNOWN_LOGOS[acct.name.toLowerCase()],
3638
3277
  alt: acct.name,
3639
- style: logoImgStyle2
3278
+ style: logoImgStyle
3640
3279
  }
3641
3280
  ) : /* @__PURE__ */ jsx("span", { style: emojiStyle, children: WALLET_EMOJIS[acct.name.toLowerCase()] ?? acct.name.charAt(0) }) }),
3642
3281
  /* @__PURE__ */ jsxs("div", { style: pendingInfoStyle, children: [
@@ -3697,10 +3336,10 @@ function WalletPickerScreen({
3697
3336
  {
3698
3337
  src: logoSrc,
3699
3338
  alt: p.name,
3700
- style: logoImgStyle2
3339
+ style: logoImgStyle
3701
3340
  }
3702
3341
  ) : /* @__PURE__ */ jsx("span", { style: emojiStyle, children: emoji }),
3703
- /* @__PURE__ */ jsx("span", { style: nameStyle2(tokens.text), children: p.name })
3342
+ /* @__PURE__ */ jsx("span", { style: nameStyle(tokens.text), children: p.name })
3704
3343
  ]
3705
3344
  },
3706
3345
  p.id
@@ -3753,13 +3392,13 @@ var emojiStyle = {
3753
3392
  fontSize: "1.75rem",
3754
3393
  lineHeight: 1
3755
3394
  };
3756
- var logoImgStyle2 = {
3395
+ var logoImgStyle = {
3757
3396
  width: 32,
3758
3397
  height: 32,
3759
3398
  borderRadius: 8,
3760
3399
  objectFit: "contain"
3761
3400
  };
3762
- var nameStyle2 = (color) => ({
3401
+ var nameStyle = (color) => ({
3763
3402
  fontSize: "0.88rem",
3764
3403
  fontWeight: 600,
3765
3404
  color
@@ -4195,9 +3834,6 @@ var waitHintStyle = (color) => ({
4195
3834
  var MIN_DEPOSIT = 0.25;
4196
3835
  function DepositScreen({
4197
3836
  merchantName,
4198
- sourceName,
4199
- sourceAddress,
4200
- sourceVerified,
4201
3837
  availableBalance,
4202
3838
  remainingLimit,
4203
3839
  tokenCount,
@@ -4220,6 +3856,22 @@ function DepositScreen({
4220
3856
  }) {
4221
3857
  const { tokens } = useSwypeConfig();
4222
3858
  const amount = initialAmount;
3859
+ const [accountPickerOpen, setAccountPickerOpen] = useState(false);
3860
+ const pickerRef = useRef(null);
3861
+ useEffect(() => {
3862
+ if (!accountPickerOpen) return;
3863
+ const handleClick = (e) => {
3864
+ if (pickerRef.current && !pickerRef.current.contains(e.target)) {
3865
+ setAccountPickerOpen(false);
3866
+ }
3867
+ };
3868
+ document.addEventListener("mousedown", handleClick);
3869
+ return () => document.removeEventListener("mousedown", handleClick);
3870
+ }, [accountPickerOpen]);
3871
+ const selectedAccount = accounts?.find((a) => a.id === selectedAccountId);
3872
+ const selectedProviderName = selectedAccount?.name ?? "Wallet";
3873
+ const selectedProviderLogo = KNOWN_LOGOS[selectedProviderName.toLowerCase()];
3874
+ const hasMultipleAccounts = accounts != null && accounts.length > 1;
4223
3875
  const isLowBalance = availableBalance < MIN_DEPOSIT;
4224
3876
  const exceedsLimit = remainingLimit != null && amount > remainingLimit && !isLowBalance;
4225
3877
  const canDeposit = amount >= MIN_DEPOSIT && !exceedsLimit && !isLowBalance && !processing;
@@ -4236,20 +3888,6 @@ function DepositScreen({
4236
3888
  ] }),
4237
3889
  children: [
4238
3890
  /* @__PURE__ */ jsx(ScreenHeader, { title: headerTitle, onBack, onLogout }),
4239
- /* @__PURE__ */ jsx(
4240
- SourceCard,
4241
- {
4242
- name: sourceName,
4243
- address: sourceAddress,
4244
- verified: sourceVerified,
4245
- accounts,
4246
- selectedAccountId,
4247
- depositAmount: amount,
4248
- onSelectAccount,
4249
- onAuthorizeAccount,
4250
- onAddProvider
4251
- }
4252
- ),
4253
3891
  /* @__PURE__ */ jsx("div", { style: lowBalanceAmountDisplayStyle, children: /* @__PURE__ */ jsxs("span", { style: lowBalanceAmountStyle, children: [
4254
3892
  "$",
4255
3893
  amount.toFixed(2)
@@ -4281,7 +3919,6 @@ function DepositScreen({
4281
3919
  }
4282
3920
  );
4283
3921
  }
4284
- const providerLogo = KNOWN_LOGOS[sourceName.toLowerCase()];
4285
3922
  return /* @__PURE__ */ jsxs(
4286
3923
  ScreenLayout,
4287
3924
  {
@@ -4300,56 +3937,116 @@ function DepositScreen({
4300
3937
  ] }),
4301
3938
  children: [
4302
3939
  /* @__PURE__ */ jsx(ScreenHeader, { onBack }),
4303
- /* @__PURE__ */ jsx(
4304
- SourceCard,
4305
- {
4306
- name: sourceName,
4307
- address: sourceAddress,
4308
- verified: sourceVerified,
4309
- accounts,
4310
- selectedAccountId,
4311
- depositAmount: amount,
4312
- onSelectAccount,
4313
- onAuthorizeAccount,
4314
- onAddProvider
4315
- }
4316
- ),
4317
- /* @__PURE__ */ jsxs("div", { style: depositCardStyle(tokens), children: [
4318
- /* @__PURE__ */ jsx("div", { style: depositLabelStyle(tokens.textMuted), children: "Depositing" }),
4319
- /* @__PURE__ */ jsxs("div", { style: amountRowStyle2, children: [
4320
- /* @__PURE__ */ jsxs("div", { style: amountValueStyle(tokens.text), children: [
4321
- "$",
4322
- amount.toLocaleString("en-US", { minimumFractionDigits: 0, maximumFractionDigits: 2 })
3940
+ /* @__PURE__ */ jsxs("div", { ref: pickerRef, style: depositCardWrapStyle, children: [
3941
+ /* @__PURE__ */ jsxs("div", { style: depositCardStyle(tokens), children: [
3942
+ /* @__PURE__ */ jsx("div", { style: depositLabelStyle(tokens.textMuted), children: "Depositing" }),
3943
+ /* @__PURE__ */ jsxs("div", { style: amountRowStyle2, children: [
3944
+ /* @__PURE__ */ jsxs("div", { style: amountValueStyle(tokens.text), children: [
3945
+ "$",
3946
+ amount.toLocaleString("en-US", { minimumFractionDigits: 0, maximumFractionDigits: 2 })
3947
+ ] }),
3948
+ /* @__PURE__ */ jsxs(
3949
+ "button",
3950
+ {
3951
+ type: "button",
3952
+ onClick: onSelectToken,
3953
+ style: tokenIconButtonStyle2(!!onSelectToken),
3954
+ children: [
3955
+ /* @__PURE__ */ jsxs("div", { style: tokenIconWrapStyle2, children: [
3956
+ /* @__PURE__ */ jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", children: [
3957
+ /* @__PURE__ */ jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#2DB84B" }),
3958
+ /* @__PURE__ */ jsx("text", { x: "18", y: "23", textAnchor: "middle", fontSize: "18", fill: "#fff", fontWeight: "700", children: "$" })
3959
+ ] }),
3960
+ /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", style: checkBadgeStyle2, children: [
3961
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "8", fill: "#2775CA" }),
3962
+ /* @__PURE__ */ jsx("path", { d: "M5 8l2 2 4-4", stroke: "#fff", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" })
3963
+ ] })
3964
+ ] }),
3965
+ /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", style: { opacity: 0.5 }, children: /* @__PURE__ */ jsx("path", { d: "M6 9l6 6 6-6", stroke: tokens.textMuted, strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
3966
+ ]
3967
+ }
3968
+ )
4323
3969
  ] }),
4324
3970
  /* @__PURE__ */ jsxs(
4325
3971
  "button",
4326
3972
  {
4327
3973
  type: "button",
4328
- onClick: onSelectToken,
4329
- style: tokenIconButtonStyle2(!!onSelectToken),
3974
+ onClick: hasMultipleAccounts ? () => setAccountPickerOpen(!accountPickerOpen) : void 0,
3975
+ style: walletBalanceRowStyle(hasMultipleAccounts),
4330
3976
  children: [
4331
- /* @__PURE__ */ jsxs("div", { style: tokenIconWrapStyle2, children: [
4332
- /* @__PURE__ */ jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", children: [
4333
- /* @__PURE__ */ jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#2DB84B" }),
4334
- /* @__PURE__ */ jsx("text", { x: "18", y: "23", textAnchor: "middle", fontSize: "18", fill: "#fff", fontWeight: "700", children: "$" })
4335
- ] }),
4336
- /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", style: checkBadgeStyle2, children: [
4337
- /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "8", fill: "#2775CA" }),
4338
- /* @__PURE__ */ jsx("path", { d: "M5 8l2 2 4-4", stroke: "#fff", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" })
4339
- ] })
3977
+ selectedProviderLogo ? /* @__PURE__ */ jsx("img", { src: selectedProviderLogo, alt: selectedProviderName, style: providerLogoStyle }) : /* @__PURE__ */ jsx("div", { style: providerFallbackStyle(tokens.textMuted), children: selectedProviderName.charAt(0) }),
3978
+ /* @__PURE__ */ jsxs("span", { style: walletBalanceStyle(tokens.text), children: [
3979
+ "$",
3980
+ availableBalance.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })
4340
3981
  ] }),
4341
- /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", style: { opacity: 0.5 }, children: /* @__PURE__ */ jsx("path", { d: "M6 9l6 6 6-6", stroke: tokens.textMuted, strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
3982
+ hasMultipleAccounts && /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", style: { opacity: 0.4 }, children: /* @__PURE__ */ jsx("path", { d: "M7 10l5-5 5 5M7 14l5 5 5-5", stroke: tokens.textMuted, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
4342
3983
  ]
4343
3984
  }
4344
3985
  )
4345
3986
  ] }),
4346
- /* @__PURE__ */ jsxs("div", { style: walletBalanceRowStyle, children: [
4347
- providerLogo ? /* @__PURE__ */ jsx("img", { src: providerLogo, alt: sourceName, style: providerLogoStyle }) : /* @__PURE__ */ jsx("div", { style: providerFallbackStyle(tokens.textMuted), children: sourceName.charAt(0) }),
4348
- /* @__PURE__ */ jsxs("span", { style: walletBalanceStyle(tokens.text), children: [
4349
- "$",
4350
- availableBalance.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })
4351
- ] }),
4352
- /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", style: { opacity: 0.4 }, children: /* @__PURE__ */ jsx("path", { d: "M7 10l5-5 5 5M7 14l5 5 5-5", stroke: tokens.textMuted, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
3987
+ accountPickerOpen && accounts && accounts.length > 0 && /* @__PURE__ */ jsxs("div", { style: accountDropdownOuterStyle(tokens), children: [
3988
+ /* @__PURE__ */ jsx("div", { style: accountDropdownLabelStyle(tokens.textMuted), children: "Choose account" }),
3989
+ /* @__PURE__ */ jsxs("div", { style: accountDropdownInnerStyle(tokens), children: [
3990
+ accounts.map((account) => {
3991
+ const preferredWallet = getPreferredDepositWallet(account, amount);
3992
+ const active = hasActiveDepositWallet(account);
3993
+ const isSelected = account.id === selectedAccountId;
3994
+ const walletAddress = preferredWallet ? getWalletAddress(preferredWallet) : null;
3995
+ const truncatedAddress = walletAddress ? `${walletAddress.slice(0, 6)}...${walletAddress.slice(-4)}` : null;
3996
+ const accountBalance = account.wallets.reduce(
3997
+ (sum, w) => sum + w.balance.available.amount,
3998
+ 0
3999
+ );
4000
+ const providerLogo = KNOWN_LOGOS[account.name.toLowerCase()];
4001
+ return /* @__PURE__ */ jsxs(
4002
+ "button",
4003
+ {
4004
+ type: "button",
4005
+ onClick: () => {
4006
+ if (active) {
4007
+ onSelectAccount?.(account.id);
4008
+ } else {
4009
+ onAuthorizeAccount?.(account.id);
4010
+ }
4011
+ setAccountPickerOpen(false);
4012
+ },
4013
+ style: accountRowStyle(tokens, isSelected),
4014
+ children: [
4015
+ /* @__PURE__ */ jsxs("div", { style: accountRowLeftStyle, children: [
4016
+ providerLogo ? /* @__PURE__ */ jsx("img", { src: providerLogo, alt: account.name, style: accountLogoStyle }) : /* @__PURE__ */ jsx("div", { style: accountFallbackIconStyle(tokens.textMuted), children: account.name.charAt(0) }),
4017
+ /* @__PURE__ */ jsxs("div", { style: accountInfoStyle, children: [
4018
+ /* @__PURE__ */ jsx("span", { style: accountAddressStyle(tokens.text), children: truncatedAddress ?? account.nickname ?? account.name }),
4019
+ /* @__PURE__ */ jsxs("span", { style: accountBalanceTextStyle(tokens.textMuted), children: [
4020
+ "$",
4021
+ accountBalance.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })
4022
+ ] })
4023
+ ] })
4024
+ ] }),
4025
+ isSelected ? /* @__PURE__ */ jsxs("svg", { width: "22", height: "22", viewBox: "0 0 22 22", fill: "none", children: [
4026
+ /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "11", fill: tokens.success }),
4027
+ /* @__PURE__ */ jsx("path", { d: "M7 11l3 3 5-5", stroke: "#fff", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
4028
+ ] }) : /* @__PURE__ */ jsx("div", { style: radioEmptyStyle(tokens.border) })
4029
+ ]
4030
+ },
4031
+ account.id
4032
+ );
4033
+ }),
4034
+ onAddProvider && /* @__PURE__ */ jsxs(
4035
+ "button",
4036
+ {
4037
+ type: "button",
4038
+ onClick: () => {
4039
+ onAddProvider();
4040
+ setAccountPickerOpen(false);
4041
+ },
4042
+ style: addAccountBtnStyle(tokens),
4043
+ children: [
4044
+ /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M12 5v14M5 12h14", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }) }),
4045
+ "Add Account"
4046
+ ]
4047
+ }
4048
+ )
4049
+ ] })
4353
4050
  ] })
4354
4051
  ] }),
4355
4052
  remainingLimit != null && /* @__PURE__ */ jsxs("div", { style: spendingLimitStyle(tokens.textMuted), children: [
@@ -4365,12 +4062,15 @@ function DepositScreen({
4365
4062
  }
4366
4063
  );
4367
4064
  }
4065
+ var depositCardWrapStyle = {
4066
+ position: "relative",
4067
+ marginBottom: 20
4068
+ };
4368
4069
  var depositCardStyle = (tokens) => ({
4369
4070
  background: tokens.bgInput,
4370
4071
  border: `1px solid ${tokens.border}`,
4371
4072
  borderRadius: tokens.radiusLg,
4372
- padding: "16px 20px",
4373
- marginBottom: 20
4073
+ padding: "16px 20px"
4374
4074
  });
4375
4075
  var depositLabelStyle = (color) => ({
4376
4076
  fontSize: "0.75rem",
@@ -4410,11 +4110,17 @@ var checkBadgeStyle2 = {
4410
4110
  bottom: -1,
4411
4111
  right: -3
4412
4112
  };
4413
- var walletBalanceRowStyle = {
4113
+ var walletBalanceRowStyle = (clickable) => ({
4414
4114
  display: "flex",
4415
4115
  alignItems: "center",
4416
- gap: 8
4417
- };
4116
+ gap: 8,
4117
+ background: "transparent",
4118
+ border: "none",
4119
+ padding: 0,
4120
+ cursor: clickable ? "pointer" : "default",
4121
+ fontFamily: "inherit",
4122
+ outline: "none"
4123
+ });
4418
4124
  var providerLogoStyle = {
4419
4125
  width: 18,
4420
4126
  height: 18,
@@ -4438,6 +4144,113 @@ var walletBalanceStyle = (color) => ({
4438
4144
  fontWeight: 600,
4439
4145
  color
4440
4146
  });
4147
+ var accountDropdownOuterStyle = (tokens) => ({
4148
+ position: "absolute",
4149
+ top: "100%",
4150
+ left: 0,
4151
+ right: 0,
4152
+ marginTop: 4,
4153
+ background: tokens.bgCard,
4154
+ border: `1px solid ${tokens.border}`,
4155
+ borderRadius: tokens.radiusLg,
4156
+ boxShadow: tokens.shadowLg,
4157
+ zIndex: 50,
4158
+ padding: "12px 14px 14px"
4159
+ });
4160
+ var accountDropdownLabelStyle = (color) => ({
4161
+ fontSize: "0.78rem",
4162
+ fontWeight: 500,
4163
+ color,
4164
+ marginBottom: 8
4165
+ });
4166
+ var accountDropdownInnerStyle = (tokens) => ({
4167
+ background: tokens.bgInput,
4168
+ border: `1px solid ${tokens.border}`,
4169
+ borderRadius: tokens.radiusLg,
4170
+ overflow: "hidden"
4171
+ });
4172
+ var accountRowStyle = (tokens, isSelected) => ({
4173
+ display: "flex",
4174
+ alignItems: "center",
4175
+ justifyContent: "space-between",
4176
+ width: "100%",
4177
+ padding: "14px 16px",
4178
+ background: isSelected ? `${tokens.accent}10` : "transparent",
4179
+ border: "none",
4180
+ borderBottom: `1px solid ${tokens.border}`,
4181
+ cursor: "pointer",
4182
+ fontFamily: "inherit",
4183
+ textAlign: "left",
4184
+ outline: "none"
4185
+ });
4186
+ var accountRowLeftStyle = {
4187
+ display: "flex",
4188
+ alignItems: "center",
4189
+ gap: 12,
4190
+ minWidth: 0,
4191
+ flex: 1
4192
+ };
4193
+ var accountLogoStyle = {
4194
+ width: 28,
4195
+ height: 28,
4196
+ borderRadius: "50%",
4197
+ objectFit: "contain",
4198
+ flexShrink: 0
4199
+ };
4200
+ var accountFallbackIconStyle = (color) => ({
4201
+ width: 28,
4202
+ height: 28,
4203
+ borderRadius: "50%",
4204
+ display: "flex",
4205
+ alignItems: "center",
4206
+ justifyContent: "center",
4207
+ fontSize: "0.75rem",
4208
+ fontWeight: 700,
4209
+ color,
4210
+ flexShrink: 0
4211
+ });
4212
+ var accountInfoStyle = {
4213
+ display: "flex",
4214
+ flexDirection: "column",
4215
+ gap: 2,
4216
+ minWidth: 0
4217
+ };
4218
+ var accountAddressStyle = (color) => ({
4219
+ fontWeight: 600,
4220
+ fontSize: "0.88rem",
4221
+ color,
4222
+ whiteSpace: "nowrap",
4223
+ overflow: "hidden",
4224
+ textOverflow: "ellipsis"
4225
+ });
4226
+ var accountBalanceTextStyle = (color) => ({
4227
+ fontSize: "0.76rem",
4228
+ color,
4229
+ fontWeight: 500
4230
+ });
4231
+ var radioEmptyStyle = (borderColor) => ({
4232
+ width: 22,
4233
+ height: 22,
4234
+ borderRadius: "50%",
4235
+ border: `2px solid ${borderColor}`,
4236
+ flexShrink: 0
4237
+ });
4238
+ var addAccountBtnStyle = (tokens) => ({
4239
+ display: "flex",
4240
+ alignItems: "center",
4241
+ gap: 8,
4242
+ width: "100%",
4243
+ padding: "12px 16px",
4244
+ background: "transparent",
4245
+ border: "none",
4246
+ color: tokens.accent,
4247
+ fontWeight: 600,
4248
+ fontSize: "0.85rem",
4249
+ cursor: "pointer",
4250
+ fontFamily: "inherit",
4251
+ textAlign: "left",
4252
+ outline: "none"
4253
+ });
4441
4254
  var spendingLimitStyle = (color) => ({
4442
4255
  textAlign: "center",
4443
4256
  fontSize: "0.84rem",
@@ -5673,8 +5486,6 @@ function StepRendererContent({
5673
5486
  pendingConnections,
5674
5487
  depositEligibleAccounts,
5675
5488
  sourceName,
5676
- sourceAddress,
5677
- sourceVerified,
5678
5489
  maxSourceBalance,
5679
5490
  tokenCount,
5680
5491
  selectedAccount,
@@ -5858,9 +5669,6 @@ function StepRendererContent({
5858
5669
  DepositScreen,
5859
5670
  {
5860
5671
  merchantName,
5861
- sourceName,
5862
- sourceAddress,
5863
- sourceVerified,
5864
5672
  availableBalance: selectedSource ? selectedSource.balance.available.amount : selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
5865
5673
  remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? null,
5866
5674
  tokenCount,
@@ -5958,9 +5766,6 @@ function StepRendererContent({
5958
5766
  DepositScreen,
5959
5767
  {
5960
5768
  merchantName,
5961
- sourceName,
5962
- sourceAddress,
5963
- sourceVerified,
5964
5769
  availableBalance: 0,
5965
5770
  remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? null,
5966
5771
  tokenCount,
@@ -6018,7 +5823,7 @@ var PaymentErrorBoundary = class extends Component {
6018
5823
  return this.props.children;
6019
5824
  }
6020
5825
  return /* @__PURE__ */ jsxs("div", { style: containerStyle9, children: [
6021
- /* @__PURE__ */ jsx("div", { style: iconStyle4, children: /* @__PURE__ */ jsxs("svg", { width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", children: [
5826
+ /* @__PURE__ */ jsx("div", { style: iconStyle3, children: /* @__PURE__ */ jsxs("svg", { width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", children: [
6022
5827
  /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "#ef4444", strokeWidth: "1.5" }),
6023
5828
  /* @__PURE__ */ jsx("path", { d: "M12 8v5", stroke: "#ef4444", strokeWidth: "1.5", strokeLinecap: "round" }),
6024
5829
  /* @__PURE__ */ jsx("circle", { cx: "12", cy: "16", r: "0.75", fill: "#ef4444" })
@@ -6040,7 +5845,7 @@ var containerStyle9 = {
6040
5845
  maxWidth: 420,
6041
5846
  margin: "0 auto"
6042
5847
  };
6043
- var iconStyle4 = {
5848
+ var iconStyle3 = {
6044
5849
  marginBottom: 20
6045
5850
  };
6046
5851
  var headingStyle12 = {
@@ -6082,8 +5887,6 @@ function useDerivedState(state) {
6082
5887
  return selectedWallet.sources.find((s) => s.token.status === "AUTHORIZED") ?? selectedWallet.sources[0] ?? null;
6083
5888
  }, [selectedWallet, state.selectedTokenSymbol]);
6084
5889
  const sourceName = selectedAccount?.name ?? selectedWallet?.chain.name ?? "Wallet";
6085
- const sourceAddress = selectedWallet ? `${selectedWallet.name.slice(0, 6)}...${selectedWallet.name.slice(-4)}` : void 0;
6086
- const sourceVerified = selectedWallet?.status === "ACTIVE";
6087
5890
  const pendingConnections = useMemo(
6088
5891
  () => state.accounts.filter(
6089
5892
  (a) => a.wallets.length > 0 && !a.wallets.some((w) => w.status === "ACTIVE")
@@ -6125,8 +5928,6 @@ function useDerivedState(state) {
6125
5928
  selectedWallet,
6126
5929
  selectedSource,
6127
5930
  sourceName,
6128
- sourceAddress,
6129
- sourceVerified,
6130
5931
  pendingConnections,
6131
5932
  depositEligibleAccounts,
6132
5933
  maxSourceBalance,
@@ -7982,8 +7783,6 @@ function SwypePaymentInner({
7982
7783
  pendingConnections: derived.pendingConnections,
7983
7784
  depositEligibleAccounts: derived.depositEligibleAccounts,
7984
7785
  sourceName: derived.sourceName,
7985
- sourceAddress: derived.sourceAddress,
7986
- sourceVerified: derived.sourceVerified,
7987
7786
  maxSourceBalance: derived.maxSourceBalance,
7988
7787
  tokenCount: derived.tokenCount,
7989
7788
  selectedAccount: derived.selectedAccount,