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