@swype-org/react-sdk 0.1.187 → 0.1.189
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 +157 -443
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +157 -443
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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:
|
|
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" }) }) :
|
|
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:
|
|
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:
|
|
3339
|
+
style: logoImgStyle
|
|
3701
3340
|
}
|
|
3702
3341
|
) : /* @__PURE__ */ jsx("span", { style: emojiStyle, children: emoji }),
|
|
3703
|
-
/* @__PURE__ */ jsx("span", { style:
|
|
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
|
|
3395
|
+
var logoImgStyle = {
|
|
3757
3396
|
width: 32,
|
|
3758
3397
|
height: 32,
|
|
3759
3398
|
borderRadius: 8,
|
|
3760
3399
|
objectFit: "contain"
|
|
3761
3400
|
};
|
|
3762
|
-
var
|
|
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,
|
|
@@ -4236,20 +3872,6 @@ function DepositScreen({
|
|
|
4236
3872
|
] }),
|
|
4237
3873
|
children: [
|
|
4238
3874
|
/* @__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
3875
|
/* @__PURE__ */ jsx("div", { style: lowBalanceAmountDisplayStyle, children: /* @__PURE__ */ jsxs("span", { style: lowBalanceAmountStyle, children: [
|
|
4254
3876
|
"$",
|
|
4255
3877
|
amount.toFixed(2)
|
|
@@ -4281,7 +3903,6 @@ function DepositScreen({
|
|
|
4281
3903
|
}
|
|
4282
3904
|
);
|
|
4283
3905
|
}
|
|
4284
|
-
const providerLogo = KNOWN_LOGOS[sourceName.toLowerCase()];
|
|
4285
3906
|
return /* @__PURE__ */ jsxs(
|
|
4286
3907
|
ScreenLayout,
|
|
4287
3908
|
{
|
|
@@ -4300,20 +3921,6 @@ function DepositScreen({
|
|
|
4300
3921
|
] }),
|
|
4301
3922
|
children: [
|
|
4302
3923
|
/* @__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
3924
|
/* @__PURE__ */ jsxs("div", { style: depositCardStyle(tokens), children: [
|
|
4318
3925
|
/* @__PURE__ */ jsx("div", { style: depositLabelStyle(tokens.textMuted), children: "Depositing" }),
|
|
4319
3926
|
/* @__PURE__ */ jsxs("div", { style: amountRowStyle2, children: [
|
|
@@ -4342,14 +3949,66 @@ function DepositScreen({
|
|
|
4342
3949
|
]
|
|
4343
3950
|
}
|
|
4344
3951
|
)
|
|
4345
|
-
] })
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
3952
|
+
] })
|
|
3953
|
+
] }),
|
|
3954
|
+
accounts && accounts.length > 0 && /* @__PURE__ */ jsxs("div", { style: accountSectionStyle, children: [
|
|
3955
|
+
/* @__PURE__ */ jsx("div", { style: accountSectionLabelStyle(tokens.textMuted), children: "Choose account" }),
|
|
3956
|
+
/* @__PURE__ */ jsxs("div", { style: accountListStyle(tokens), children: [
|
|
3957
|
+
accounts.map((account) => {
|
|
3958
|
+
const preferredWallet = getPreferredDepositWallet(account, amount);
|
|
3959
|
+
const active = hasActiveDepositWallet(account);
|
|
3960
|
+
const isSelected = account.id === selectedAccountId;
|
|
3961
|
+
const walletAddress = preferredWallet ? getWalletAddress(preferredWallet) : null;
|
|
3962
|
+
const truncatedAddress = walletAddress ? `${walletAddress.slice(0, 6)}...${walletAddress.slice(-4)}` : null;
|
|
3963
|
+
const accountBalance = account.wallets.reduce(
|
|
3964
|
+
(sum, w) => sum + w.balance.available.amount,
|
|
3965
|
+
0
|
|
3966
|
+
);
|
|
3967
|
+
const providerLogo = KNOWN_LOGOS[account.name.toLowerCase()];
|
|
3968
|
+
return /* @__PURE__ */ jsxs(
|
|
3969
|
+
"button",
|
|
3970
|
+
{
|
|
3971
|
+
type: "button",
|
|
3972
|
+
onClick: () => {
|
|
3973
|
+
if (active) {
|
|
3974
|
+
onSelectAccount?.(account.id);
|
|
3975
|
+
} else {
|
|
3976
|
+
onAuthorizeAccount?.(account.id);
|
|
3977
|
+
}
|
|
3978
|
+
},
|
|
3979
|
+
style: accountRowStyle(tokens),
|
|
3980
|
+
children: [
|
|
3981
|
+
/* @__PURE__ */ jsxs("div", { style: accountRowLeftStyle, children: [
|
|
3982
|
+
providerLogo ? /* @__PURE__ */ jsx("img", { src: providerLogo, alt: account.name, style: accountLogoStyle }) : /* @__PURE__ */ jsx("div", { style: accountFallbackIconStyle(tokens.textMuted), children: account.name.charAt(0) }),
|
|
3983
|
+
/* @__PURE__ */ jsxs("div", { style: accountInfoStyle, children: [
|
|
3984
|
+
/* @__PURE__ */ jsx("span", { style: accountAddressStyle(tokens.text), children: truncatedAddress ?? account.nickname ?? account.name }),
|
|
3985
|
+
/* @__PURE__ */ jsxs("span", { style: accountBalanceTextStyle(tokens.textMuted), children: [
|
|
3986
|
+
"$",
|
|
3987
|
+
accountBalance.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
|
3988
|
+
] })
|
|
3989
|
+
] })
|
|
3990
|
+
] }),
|
|
3991
|
+
isSelected ? /* @__PURE__ */ jsxs("svg", { width: "22", height: "22", viewBox: "0 0 22 22", fill: "none", children: [
|
|
3992
|
+
/* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "11", fill: tokens.success }),
|
|
3993
|
+
/* @__PURE__ */ jsx("path", { d: "M7 11l3 3 5-5", stroke: "#fff", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
3994
|
+
] }) : /* @__PURE__ */ jsx("div", { style: radioEmptyStyle(tokens.border) })
|
|
3995
|
+
]
|
|
3996
|
+
},
|
|
3997
|
+
account.id
|
|
3998
|
+
);
|
|
3999
|
+
}),
|
|
4000
|
+
onAddProvider && /* @__PURE__ */ jsxs(
|
|
4001
|
+
"button",
|
|
4002
|
+
{
|
|
4003
|
+
type: "button",
|
|
4004
|
+
onClick: onAddProvider,
|
|
4005
|
+
style: addAccountBtnStyle(tokens),
|
|
4006
|
+
children: [
|
|
4007
|
+
/* @__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" }) }),
|
|
4008
|
+
"Add Account"
|
|
4009
|
+
]
|
|
4010
|
+
}
|
|
4011
|
+
)
|
|
4353
4012
|
] })
|
|
4354
4013
|
] }),
|
|
4355
4014
|
remainingLimit != null && /* @__PURE__ */ jsxs("div", { style: spendingLimitStyle(tokens.textMuted), children: [
|
|
@@ -4410,33 +4069,102 @@ var checkBadgeStyle2 = {
|
|
|
4410
4069
|
bottom: -1,
|
|
4411
4070
|
right: -3
|
|
4412
4071
|
};
|
|
4413
|
-
var
|
|
4072
|
+
var accountSectionStyle = {
|
|
4073
|
+
marginBottom: 20
|
|
4074
|
+
};
|
|
4075
|
+
var accountSectionLabelStyle = (color) => ({
|
|
4076
|
+
fontSize: "0.78rem",
|
|
4077
|
+
fontWeight: 500,
|
|
4078
|
+
color,
|
|
4079
|
+
marginBottom: 8
|
|
4080
|
+
});
|
|
4081
|
+
var accountListStyle = (tokens) => ({
|
|
4082
|
+
background: tokens.bgInput,
|
|
4083
|
+
border: `1px solid ${tokens.border}`,
|
|
4084
|
+
borderRadius: tokens.radiusLg,
|
|
4085
|
+
overflow: "hidden"
|
|
4086
|
+
});
|
|
4087
|
+
var accountRowStyle = (tokens, isSelected) => ({
|
|
4414
4088
|
display: "flex",
|
|
4415
4089
|
alignItems: "center",
|
|
4416
|
-
|
|
4090
|
+
justifyContent: "space-between",
|
|
4091
|
+
width: "100%",
|
|
4092
|
+
padding: "14px 16px",
|
|
4093
|
+
background: "transparent",
|
|
4094
|
+
border: "none",
|
|
4095
|
+
borderBottom: `1px solid ${tokens.border}`,
|
|
4096
|
+
cursor: "pointer",
|
|
4097
|
+
fontFamily: "inherit",
|
|
4098
|
+
textAlign: "left",
|
|
4099
|
+
outline: "none"
|
|
4100
|
+
});
|
|
4101
|
+
var accountRowLeftStyle = {
|
|
4102
|
+
display: "flex",
|
|
4103
|
+
alignItems: "center",
|
|
4104
|
+
gap: 12,
|
|
4105
|
+
minWidth: 0,
|
|
4106
|
+
flex: 1
|
|
4417
4107
|
};
|
|
4418
|
-
var
|
|
4419
|
-
width:
|
|
4420
|
-
height:
|
|
4108
|
+
var accountLogoStyle = {
|
|
4109
|
+
width: 28,
|
|
4110
|
+
height: 28,
|
|
4421
4111
|
borderRadius: "50%",
|
|
4422
|
-
objectFit: "contain"
|
|
4112
|
+
objectFit: "contain",
|
|
4113
|
+
flexShrink: 0
|
|
4423
4114
|
};
|
|
4424
|
-
var
|
|
4425
|
-
width:
|
|
4426
|
-
height:
|
|
4115
|
+
var accountFallbackIconStyle = (color) => ({
|
|
4116
|
+
width: 28,
|
|
4117
|
+
height: 28,
|
|
4427
4118
|
borderRadius: "50%",
|
|
4428
4119
|
display: "flex",
|
|
4429
4120
|
alignItems: "center",
|
|
4430
4121
|
justifyContent: "center",
|
|
4431
|
-
fontSize: "0.
|
|
4122
|
+
fontSize: "0.75rem",
|
|
4432
4123
|
fontWeight: 700,
|
|
4433
4124
|
color,
|
|
4434
4125
|
flexShrink: 0
|
|
4435
4126
|
});
|
|
4436
|
-
var
|
|
4437
|
-
|
|
4127
|
+
var accountInfoStyle = {
|
|
4128
|
+
display: "flex",
|
|
4129
|
+
flexDirection: "column",
|
|
4130
|
+
gap: 2,
|
|
4131
|
+
minWidth: 0
|
|
4132
|
+
};
|
|
4133
|
+
var accountAddressStyle = (color) => ({
|
|
4438
4134
|
fontWeight: 600,
|
|
4439
|
-
|
|
4135
|
+
fontSize: "0.88rem",
|
|
4136
|
+
color,
|
|
4137
|
+
whiteSpace: "nowrap",
|
|
4138
|
+
overflow: "hidden",
|
|
4139
|
+
textOverflow: "ellipsis"
|
|
4140
|
+
});
|
|
4141
|
+
var accountBalanceTextStyle = (color) => ({
|
|
4142
|
+
fontSize: "0.76rem",
|
|
4143
|
+
color,
|
|
4144
|
+
fontWeight: 500
|
|
4145
|
+
});
|
|
4146
|
+
var radioEmptyStyle = (borderColor) => ({
|
|
4147
|
+
width: 22,
|
|
4148
|
+
height: 22,
|
|
4149
|
+
borderRadius: "50%",
|
|
4150
|
+
border: `2px solid ${borderColor}`,
|
|
4151
|
+
flexShrink: 0
|
|
4152
|
+
});
|
|
4153
|
+
var addAccountBtnStyle = (tokens) => ({
|
|
4154
|
+
display: "flex",
|
|
4155
|
+
alignItems: "center",
|
|
4156
|
+
gap: 8,
|
|
4157
|
+
width: "100%",
|
|
4158
|
+
padding: "12px 16px",
|
|
4159
|
+
background: "transparent",
|
|
4160
|
+
border: "none",
|
|
4161
|
+
color: tokens.accent,
|
|
4162
|
+
fontWeight: 600,
|
|
4163
|
+
fontSize: "0.85rem",
|
|
4164
|
+
cursor: "pointer",
|
|
4165
|
+
fontFamily: "inherit",
|
|
4166
|
+
textAlign: "left",
|
|
4167
|
+
outline: "none"
|
|
4440
4168
|
});
|
|
4441
4169
|
var spendingLimitStyle = (color) => ({
|
|
4442
4170
|
textAlign: "center",
|
|
@@ -5673,8 +5401,6 @@ function StepRendererContent({
|
|
|
5673
5401
|
pendingConnections,
|
|
5674
5402
|
depositEligibleAccounts,
|
|
5675
5403
|
sourceName,
|
|
5676
|
-
sourceAddress,
|
|
5677
|
-
sourceVerified,
|
|
5678
5404
|
maxSourceBalance,
|
|
5679
5405
|
tokenCount,
|
|
5680
5406
|
selectedAccount,
|
|
@@ -5858,9 +5584,6 @@ function StepRendererContent({
|
|
|
5858
5584
|
DepositScreen,
|
|
5859
5585
|
{
|
|
5860
5586
|
merchantName,
|
|
5861
|
-
sourceName,
|
|
5862
|
-
sourceAddress,
|
|
5863
|
-
sourceVerified,
|
|
5864
5587
|
availableBalance: selectedSource ? selectedSource.balance.available.amount : selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
|
|
5865
5588
|
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? null,
|
|
5866
5589
|
tokenCount,
|
|
@@ -5958,9 +5681,6 @@ function StepRendererContent({
|
|
|
5958
5681
|
DepositScreen,
|
|
5959
5682
|
{
|
|
5960
5683
|
merchantName,
|
|
5961
|
-
sourceName,
|
|
5962
|
-
sourceAddress,
|
|
5963
|
-
sourceVerified,
|
|
5964
5684
|
availableBalance: 0,
|
|
5965
5685
|
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? null,
|
|
5966
5686
|
tokenCount,
|
|
@@ -6018,7 +5738,7 @@ var PaymentErrorBoundary = class extends Component {
|
|
|
6018
5738
|
return this.props.children;
|
|
6019
5739
|
}
|
|
6020
5740
|
return /* @__PURE__ */ jsxs("div", { style: containerStyle9, children: [
|
|
6021
|
-
/* @__PURE__ */ jsx("div", { style:
|
|
5741
|
+
/* @__PURE__ */ jsx("div", { style: iconStyle3, children: /* @__PURE__ */ jsxs("svg", { width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", children: [
|
|
6022
5742
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "#ef4444", strokeWidth: "1.5" }),
|
|
6023
5743
|
/* @__PURE__ */ jsx("path", { d: "M12 8v5", stroke: "#ef4444", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
6024
5744
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "16", r: "0.75", fill: "#ef4444" })
|
|
@@ -6040,7 +5760,7 @@ var containerStyle9 = {
|
|
|
6040
5760
|
maxWidth: 420,
|
|
6041
5761
|
margin: "0 auto"
|
|
6042
5762
|
};
|
|
6043
|
-
var
|
|
5763
|
+
var iconStyle3 = {
|
|
6044
5764
|
marginBottom: 20
|
|
6045
5765
|
};
|
|
6046
5766
|
var headingStyle12 = {
|
|
@@ -6082,8 +5802,6 @@ function useDerivedState(state) {
|
|
|
6082
5802
|
return selectedWallet.sources.find((s) => s.token.status === "AUTHORIZED") ?? selectedWallet.sources[0] ?? null;
|
|
6083
5803
|
}, [selectedWallet, state.selectedTokenSymbol]);
|
|
6084
5804
|
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
5805
|
const pendingConnections = useMemo(
|
|
6088
5806
|
() => state.accounts.filter(
|
|
6089
5807
|
(a) => a.wallets.length > 0 && !a.wallets.some((w) => w.status === "ACTIVE")
|
|
@@ -6125,8 +5843,6 @@ function useDerivedState(state) {
|
|
|
6125
5843
|
selectedWallet,
|
|
6126
5844
|
selectedSource,
|
|
6127
5845
|
sourceName,
|
|
6128
|
-
sourceAddress,
|
|
6129
|
-
sourceVerified,
|
|
6130
5846
|
pendingConnections,
|
|
6131
5847
|
depositEligibleAccounts,
|
|
6132
5848
|
maxSourceBalance,
|
|
@@ -7982,8 +7698,6 @@ function SwypePaymentInner({
|
|
|
7982
7698
|
pendingConnections: derived.pendingConnections,
|
|
7983
7699
|
depositEligibleAccounts: derived.depositEligibleAccounts,
|
|
7984
7700
|
sourceName: derived.sourceName,
|
|
7985
|
-
sourceAddress: derived.sourceAddress,
|
|
7986
|
-
sourceVerified: derived.sourceVerified,
|
|
7987
7701
|
maxSourceBalance: derived.maxSourceBalance,
|
|
7988
7702
|
tokenCount: derived.tokenCount,
|
|
7989
7703
|
selectedAccount: derived.selectedAccount,
|