@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.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:
|
|
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" }) }) :
|
|
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:
|
|
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:
|
|
3342
|
+
style: logoImgStyle
|
|
3704
3343
|
}
|
|
3705
3344
|
) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: emojiStyle, children: emoji }),
|
|
3706
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style:
|
|
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
|
|
3398
|
+
var logoImgStyle = {
|
|
3760
3399
|
width: 32,
|
|
3761
3400
|
height: 32,
|
|
3762
3401
|
borderRadius: 8,
|
|
3763
3402
|
objectFit: "contain"
|
|
3764
3403
|
};
|
|
3765
|
-
var
|
|
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,
|
|
@@ -4239,20 +3875,6 @@ function DepositScreen({
|
|
|
4239
3875
|
] }),
|
|
4240
3876
|
children: [
|
|
4241
3877
|
/* @__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
3878
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: lowBalanceAmountDisplayStyle, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { style: lowBalanceAmountStyle, children: [
|
|
4257
3879
|
"$",
|
|
4258
3880
|
amount.toFixed(2)
|
|
@@ -4284,7 +3906,6 @@ function DepositScreen({
|
|
|
4284
3906
|
}
|
|
4285
3907
|
);
|
|
4286
3908
|
}
|
|
4287
|
-
const providerLogo = KNOWN_LOGOS[sourceName.toLowerCase()];
|
|
4288
3909
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4289
3910
|
ScreenLayout,
|
|
4290
3911
|
{
|
|
@@ -4303,20 +3924,6 @@ function DepositScreen({
|
|
|
4303
3924
|
] }),
|
|
4304
3925
|
children: [
|
|
4305
3926
|
/* @__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
3927
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: depositCardStyle(tokens), children: [
|
|
4321
3928
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: depositLabelStyle(tokens.textMuted), children: "Depositing" }),
|
|
4322
3929
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: amountRowStyle2, children: [
|
|
@@ -4345,14 +3952,66 @@ function DepositScreen({
|
|
|
4345
3952
|
]
|
|
4346
3953
|
}
|
|
4347
3954
|
)
|
|
4348
|
-
] })
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
3955
|
+
] })
|
|
3956
|
+
] }),
|
|
3957
|
+
accounts && accounts.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: accountSectionStyle, children: [
|
|
3958
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: accountSectionLabelStyle(tokens.textMuted), children: "Choose account" }),
|
|
3959
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: accountListStyle(tokens), children: [
|
|
3960
|
+
accounts.map((account) => {
|
|
3961
|
+
const preferredWallet = getPreferredDepositWallet(account, amount);
|
|
3962
|
+
const active = hasActiveDepositWallet(account);
|
|
3963
|
+
const isSelected = account.id === selectedAccountId;
|
|
3964
|
+
const walletAddress = preferredWallet ? getWalletAddress(preferredWallet) : null;
|
|
3965
|
+
const truncatedAddress = walletAddress ? `${walletAddress.slice(0, 6)}...${walletAddress.slice(-4)}` : null;
|
|
3966
|
+
const accountBalance = account.wallets.reduce(
|
|
3967
|
+
(sum, w) => sum + w.balance.available.amount,
|
|
3968
|
+
0
|
|
3969
|
+
);
|
|
3970
|
+
const providerLogo = KNOWN_LOGOS[account.name.toLowerCase()];
|
|
3971
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3972
|
+
"button",
|
|
3973
|
+
{
|
|
3974
|
+
type: "button",
|
|
3975
|
+
onClick: () => {
|
|
3976
|
+
if (active) {
|
|
3977
|
+
onSelectAccount?.(account.id);
|
|
3978
|
+
} else {
|
|
3979
|
+
onAuthorizeAccount?.(account.id);
|
|
3980
|
+
}
|
|
3981
|
+
},
|
|
3982
|
+
style: accountRowStyle(tokens),
|
|
3983
|
+
children: [
|
|
3984
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: accountRowLeftStyle, children: [
|
|
3985
|
+
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) }),
|
|
3986
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: accountInfoStyle, children: [
|
|
3987
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: accountAddressStyle(tokens.text), children: truncatedAddress ?? account.nickname ?? account.name }),
|
|
3988
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: accountBalanceTextStyle(tokens.textMuted), children: [
|
|
3989
|
+
"$",
|
|
3990
|
+
accountBalance.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
|
3991
|
+
] })
|
|
3992
|
+
] })
|
|
3993
|
+
] }),
|
|
3994
|
+
isSelected ? /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "22", height: "22", viewBox: "0 0 22 22", fill: "none", children: [
|
|
3995
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "11", cy: "11", r: "11", fill: tokens.success }),
|
|
3996
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7 11l3 3 5-5", stroke: "#fff", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
3997
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: radioEmptyStyle(tokens.border) })
|
|
3998
|
+
]
|
|
3999
|
+
},
|
|
4000
|
+
account.id
|
|
4001
|
+
);
|
|
4002
|
+
}),
|
|
4003
|
+
onAddProvider && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4004
|
+
"button",
|
|
4005
|
+
{
|
|
4006
|
+
type: "button",
|
|
4007
|
+
onClick: onAddProvider,
|
|
4008
|
+
style: addAccountBtnStyle(tokens),
|
|
4009
|
+
children: [
|
|
4010
|
+
/* @__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" }) }),
|
|
4011
|
+
"Add Account"
|
|
4012
|
+
]
|
|
4013
|
+
}
|
|
4014
|
+
)
|
|
4356
4015
|
] })
|
|
4357
4016
|
] }),
|
|
4358
4017
|
remainingLimit != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: spendingLimitStyle(tokens.textMuted), children: [
|
|
@@ -4413,33 +4072,102 @@ var checkBadgeStyle2 = {
|
|
|
4413
4072
|
bottom: -1,
|
|
4414
4073
|
right: -3
|
|
4415
4074
|
};
|
|
4416
|
-
var
|
|
4075
|
+
var accountSectionStyle = {
|
|
4076
|
+
marginBottom: 20
|
|
4077
|
+
};
|
|
4078
|
+
var accountSectionLabelStyle = (color) => ({
|
|
4079
|
+
fontSize: "0.78rem",
|
|
4080
|
+
fontWeight: 500,
|
|
4081
|
+
color,
|
|
4082
|
+
marginBottom: 8
|
|
4083
|
+
});
|
|
4084
|
+
var accountListStyle = (tokens) => ({
|
|
4085
|
+
background: tokens.bgInput,
|
|
4086
|
+
border: `1px solid ${tokens.border}`,
|
|
4087
|
+
borderRadius: tokens.radiusLg,
|
|
4088
|
+
overflow: "hidden"
|
|
4089
|
+
});
|
|
4090
|
+
var accountRowStyle = (tokens, isSelected) => ({
|
|
4417
4091
|
display: "flex",
|
|
4418
4092
|
alignItems: "center",
|
|
4419
|
-
|
|
4093
|
+
justifyContent: "space-between",
|
|
4094
|
+
width: "100%",
|
|
4095
|
+
padding: "14px 16px",
|
|
4096
|
+
background: "transparent",
|
|
4097
|
+
border: "none",
|
|
4098
|
+
borderBottom: `1px solid ${tokens.border}`,
|
|
4099
|
+
cursor: "pointer",
|
|
4100
|
+
fontFamily: "inherit",
|
|
4101
|
+
textAlign: "left",
|
|
4102
|
+
outline: "none"
|
|
4103
|
+
});
|
|
4104
|
+
var accountRowLeftStyle = {
|
|
4105
|
+
display: "flex",
|
|
4106
|
+
alignItems: "center",
|
|
4107
|
+
gap: 12,
|
|
4108
|
+
minWidth: 0,
|
|
4109
|
+
flex: 1
|
|
4420
4110
|
};
|
|
4421
|
-
var
|
|
4422
|
-
width:
|
|
4423
|
-
height:
|
|
4111
|
+
var accountLogoStyle = {
|
|
4112
|
+
width: 28,
|
|
4113
|
+
height: 28,
|
|
4424
4114
|
borderRadius: "50%",
|
|
4425
|
-
objectFit: "contain"
|
|
4115
|
+
objectFit: "contain",
|
|
4116
|
+
flexShrink: 0
|
|
4426
4117
|
};
|
|
4427
|
-
var
|
|
4428
|
-
width:
|
|
4429
|
-
height:
|
|
4118
|
+
var accountFallbackIconStyle = (color) => ({
|
|
4119
|
+
width: 28,
|
|
4120
|
+
height: 28,
|
|
4430
4121
|
borderRadius: "50%",
|
|
4431
4122
|
display: "flex",
|
|
4432
4123
|
alignItems: "center",
|
|
4433
4124
|
justifyContent: "center",
|
|
4434
|
-
fontSize: "0.
|
|
4125
|
+
fontSize: "0.75rem",
|
|
4435
4126
|
fontWeight: 700,
|
|
4436
4127
|
color,
|
|
4437
4128
|
flexShrink: 0
|
|
4438
4129
|
});
|
|
4439
|
-
var
|
|
4440
|
-
|
|
4130
|
+
var accountInfoStyle = {
|
|
4131
|
+
display: "flex",
|
|
4132
|
+
flexDirection: "column",
|
|
4133
|
+
gap: 2,
|
|
4134
|
+
minWidth: 0
|
|
4135
|
+
};
|
|
4136
|
+
var accountAddressStyle = (color) => ({
|
|
4441
4137
|
fontWeight: 600,
|
|
4442
|
-
|
|
4138
|
+
fontSize: "0.88rem",
|
|
4139
|
+
color,
|
|
4140
|
+
whiteSpace: "nowrap",
|
|
4141
|
+
overflow: "hidden",
|
|
4142
|
+
textOverflow: "ellipsis"
|
|
4143
|
+
});
|
|
4144
|
+
var accountBalanceTextStyle = (color) => ({
|
|
4145
|
+
fontSize: "0.76rem",
|
|
4146
|
+
color,
|
|
4147
|
+
fontWeight: 500
|
|
4148
|
+
});
|
|
4149
|
+
var radioEmptyStyle = (borderColor) => ({
|
|
4150
|
+
width: 22,
|
|
4151
|
+
height: 22,
|
|
4152
|
+
borderRadius: "50%",
|
|
4153
|
+
border: `2px solid ${borderColor}`,
|
|
4154
|
+
flexShrink: 0
|
|
4155
|
+
});
|
|
4156
|
+
var addAccountBtnStyle = (tokens) => ({
|
|
4157
|
+
display: "flex",
|
|
4158
|
+
alignItems: "center",
|
|
4159
|
+
gap: 8,
|
|
4160
|
+
width: "100%",
|
|
4161
|
+
padding: "12px 16px",
|
|
4162
|
+
background: "transparent",
|
|
4163
|
+
border: "none",
|
|
4164
|
+
color: tokens.accent,
|
|
4165
|
+
fontWeight: 600,
|
|
4166
|
+
fontSize: "0.85rem",
|
|
4167
|
+
cursor: "pointer",
|
|
4168
|
+
fontFamily: "inherit",
|
|
4169
|
+
textAlign: "left",
|
|
4170
|
+
outline: "none"
|
|
4443
4171
|
});
|
|
4444
4172
|
var spendingLimitStyle = (color) => ({
|
|
4445
4173
|
textAlign: "center",
|
|
@@ -5676,8 +5404,6 @@ function StepRendererContent({
|
|
|
5676
5404
|
pendingConnections,
|
|
5677
5405
|
depositEligibleAccounts,
|
|
5678
5406
|
sourceName,
|
|
5679
|
-
sourceAddress,
|
|
5680
|
-
sourceVerified,
|
|
5681
5407
|
maxSourceBalance,
|
|
5682
5408
|
tokenCount,
|
|
5683
5409
|
selectedAccount,
|
|
@@ -5861,9 +5587,6 @@ function StepRendererContent({
|
|
|
5861
5587
|
DepositScreen,
|
|
5862
5588
|
{
|
|
5863
5589
|
merchantName,
|
|
5864
|
-
sourceName,
|
|
5865
|
-
sourceAddress,
|
|
5866
|
-
sourceVerified,
|
|
5867
5590
|
availableBalance: selectedSource ? selectedSource.balance.available.amount : selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
|
|
5868
5591
|
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? null,
|
|
5869
5592
|
tokenCount,
|
|
@@ -5961,9 +5684,6 @@ function StepRendererContent({
|
|
|
5961
5684
|
DepositScreen,
|
|
5962
5685
|
{
|
|
5963
5686
|
merchantName,
|
|
5964
|
-
sourceName,
|
|
5965
|
-
sourceAddress,
|
|
5966
|
-
sourceVerified,
|
|
5967
5687
|
availableBalance: 0,
|
|
5968
5688
|
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? null,
|
|
5969
5689
|
tokenCount,
|
|
@@ -6021,7 +5741,7 @@ var PaymentErrorBoundary = class extends react.Component {
|
|
|
6021
5741
|
return this.props.children;
|
|
6022
5742
|
}
|
|
6023
5743
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: containerStyle9, children: [
|
|
6024
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style:
|
|
5744
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: iconStyle3, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", children: [
|
|
6025
5745
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "#ef4444", strokeWidth: "1.5" }),
|
|
6026
5746
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 8v5", stroke: "#ef4444", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
6027
5747
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "16", r: "0.75", fill: "#ef4444" })
|
|
@@ -6043,7 +5763,7 @@ var containerStyle9 = {
|
|
|
6043
5763
|
maxWidth: 420,
|
|
6044
5764
|
margin: "0 auto"
|
|
6045
5765
|
};
|
|
6046
|
-
var
|
|
5766
|
+
var iconStyle3 = {
|
|
6047
5767
|
marginBottom: 20
|
|
6048
5768
|
};
|
|
6049
5769
|
var headingStyle12 = {
|
|
@@ -6085,8 +5805,6 @@ function useDerivedState(state) {
|
|
|
6085
5805
|
return selectedWallet.sources.find((s) => s.token.status === "AUTHORIZED") ?? selectedWallet.sources[0] ?? null;
|
|
6086
5806
|
}, [selectedWallet, state.selectedTokenSymbol]);
|
|
6087
5807
|
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
5808
|
const pendingConnections = react.useMemo(
|
|
6091
5809
|
() => state.accounts.filter(
|
|
6092
5810
|
(a) => a.wallets.length > 0 && !a.wallets.some((w) => w.status === "ACTIVE")
|
|
@@ -6128,8 +5846,6 @@ function useDerivedState(state) {
|
|
|
6128
5846
|
selectedWallet,
|
|
6129
5847
|
selectedSource,
|
|
6130
5848
|
sourceName,
|
|
6131
|
-
sourceAddress,
|
|
6132
|
-
sourceVerified,
|
|
6133
5849
|
pendingConnections,
|
|
6134
5850
|
depositEligibleAccounts,
|
|
6135
5851
|
maxSourceBalance,
|
|
@@ -7985,8 +7701,6 @@ function SwypePaymentInner({
|
|
|
7985
7701
|
pendingConnections: derived.pendingConnections,
|
|
7986
7702
|
depositEligibleAccounts: derived.depositEligibleAccounts,
|
|
7987
7703
|
sourceName: derived.sourceName,
|
|
7988
|
-
sourceAddress: derived.sourceAddress,
|
|
7989
|
-
sourceVerified: derived.sourceVerified,
|
|
7990
7704
|
maxSourceBalance: derived.maxSourceBalance,
|
|
7991
7705
|
tokenCount: derived.tokenCount,
|
|
7992
7706
|
selectedAccount: derived.selectedAccount,
|