@swype-org/react-sdk 0.1.31 → 0.1.32
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 +166 -134
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +166 -134
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1801,7 +1801,7 @@ function LimitSlider({
|
|
|
1801
1801
|
(e) => onChange(Number(e.target.value)),
|
|
1802
1802
|
[onChange]
|
|
1803
1803
|
);
|
|
1804
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: wrapperStyle, children: [
|
|
1804
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "swype-slider-wrap", style: wrapperStyle, children: [
|
|
1805
1805
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: trackContainerStyle, children: [
|
|
1806
1806
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: trackBgStyle(tokens.border) }),
|
|
1807
1807
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: trackFillStyle(tokens.accent, pct) }),
|
|
@@ -1815,7 +1815,7 @@ function LimitSlider({
|
|
|
1815
1815
|
value,
|
|
1816
1816
|
onChange: handleChange,
|
|
1817
1817
|
disabled,
|
|
1818
|
-
style: rangeInputStyle
|
|
1818
|
+
style: rangeInputStyle
|
|
1819
1819
|
}
|
|
1820
1820
|
)
|
|
1821
1821
|
] }),
|
|
@@ -1849,17 +1849,19 @@ var trackFillStyle = (color, pct) => ({
|
|
|
1849
1849
|
borderRadius: 2,
|
|
1850
1850
|
background: color
|
|
1851
1851
|
});
|
|
1852
|
-
var rangeInputStyle =
|
|
1852
|
+
var rangeInputStyle = {
|
|
1853
1853
|
position: "absolute",
|
|
1854
1854
|
left: 0,
|
|
1855
1855
|
right: 0,
|
|
1856
1856
|
width: "100%",
|
|
1857
1857
|
height: 28,
|
|
1858
1858
|
margin: 0,
|
|
1859
|
-
opacity: 0,
|
|
1860
1859
|
cursor: "pointer",
|
|
1861
|
-
zIndex: 2
|
|
1862
|
-
|
|
1860
|
+
zIndex: 2,
|
|
1861
|
+
WebkitAppearance: "none",
|
|
1862
|
+
appearance: "none",
|
|
1863
|
+
background: "transparent"
|
|
1864
|
+
};
|
|
1863
1865
|
var ticksStyle = {
|
|
1864
1866
|
display: "flex",
|
|
1865
1867
|
justifyContent: "space-between",
|
|
@@ -1871,10 +1873,8 @@ var tickLabelStyle = (color) => ({
|
|
|
1871
1873
|
color
|
|
1872
1874
|
});
|
|
1873
1875
|
var sliderThumbCss = (accent) => `
|
|
1874
|
-
.swype-slider-wrap input[type="range"] {
|
|
1875
|
-
|
|
1876
|
-
appearance: none;
|
|
1877
|
-
opacity: 1 !important;
|
|
1876
|
+
.swype-slider-wrap input[type="range"]::-webkit-slider-runnable-track {
|
|
1877
|
+
height: 4px;
|
|
1878
1878
|
background: transparent;
|
|
1879
1879
|
}
|
|
1880
1880
|
.swype-slider-wrap input[type="range"]::-webkit-slider-thumb {
|
|
@@ -1886,6 +1886,21 @@ var sliderThumbCss = (accent) => `
|
|
|
1886
1886
|
border: 3px solid #fff;
|
|
1887
1887
|
box-shadow: 0 2px 6px rgba(0,0,0,0.15);
|
|
1888
1888
|
cursor: pointer;
|
|
1889
|
+
margin-top: -8px;
|
|
1890
|
+
}
|
|
1891
|
+
.swype-slider-wrap input[type="range"]::-moz-range-track {
|
|
1892
|
+
height: 4px;
|
|
1893
|
+
background: transparent;
|
|
1894
|
+
border: none;
|
|
1895
|
+
}
|
|
1896
|
+
.swype-slider-wrap input[type="range"]::-moz-range-thumb {
|
|
1897
|
+
width: 14px;
|
|
1898
|
+
height: 14px;
|
|
1899
|
+
border-radius: 50%;
|
|
1900
|
+
background: ${accent};
|
|
1901
|
+
border: 3px solid #fff;
|
|
1902
|
+
box-shadow: 0 2px 6px rgba(0,0,0,0.15);
|
|
1903
|
+
cursor: pointer;
|
|
1889
1904
|
}
|
|
1890
1905
|
`;
|
|
1891
1906
|
function SourceCard({ name, address, verified, onChangeSource }) {
|
|
@@ -2016,6 +2031,87 @@ var detailStyle = (color) => ({
|
|
|
2016
2031
|
fontSize: "0.75rem",
|
|
2017
2032
|
color
|
|
2018
2033
|
});
|
|
2034
|
+
function SettingsMenu({ onLogout }) {
|
|
2035
|
+
const { tokens } = useSwypeConfig();
|
|
2036
|
+
const [open, setOpen] = react.useState(false);
|
|
2037
|
+
const menuRef = react.useRef(null);
|
|
2038
|
+
const toggle = react.useCallback(() => setOpen((prev) => !prev), []);
|
|
2039
|
+
react.useEffect(() => {
|
|
2040
|
+
if (!open) return;
|
|
2041
|
+
const handleClickOutside = (e) => {
|
|
2042
|
+
if (menuRef.current && !menuRef.current.contains(e.target)) {
|
|
2043
|
+
setOpen(false);
|
|
2044
|
+
}
|
|
2045
|
+
};
|
|
2046
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2047
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2048
|
+
}, [open]);
|
|
2049
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: menuRef, style: containerStyle7, children: [
|
|
2050
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: toggle, style: triggerStyle(tokens.text), "aria-label": "Settings", children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: [
|
|
2051
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "5", r: "2", fill: "currentColor" }),
|
|
2052
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "2", fill: "currentColor" }),
|
|
2053
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "19", r: "2", fill: "currentColor" })
|
|
2054
|
+
] }) }),
|
|
2055
|
+
open && /* @__PURE__ */ jsxRuntime.jsx("div", { style: dropdownStyle(tokens), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2056
|
+
"button",
|
|
2057
|
+
{
|
|
2058
|
+
type: "button",
|
|
2059
|
+
onClick: () => {
|
|
2060
|
+
setOpen(false);
|
|
2061
|
+
onLogout();
|
|
2062
|
+
},
|
|
2063
|
+
style: menuItemStyle(tokens),
|
|
2064
|
+
children: [
|
|
2065
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { marginRight: 8, flexShrink: 0 }, children: [
|
|
2066
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4", stroke: tokens.error, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
2067
|
+
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "16 17 21 12 16 7", stroke: tokens.error, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
2068
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "21", y1: "12", x2: "9", y2: "12", stroke: tokens.error, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
2069
|
+
] }),
|
|
2070
|
+
"Log out"
|
|
2071
|
+
]
|
|
2072
|
+
}
|
|
2073
|
+
) })
|
|
2074
|
+
] });
|
|
2075
|
+
}
|
|
2076
|
+
var containerStyle7 = {
|
|
2077
|
+
position: "relative"
|
|
2078
|
+
};
|
|
2079
|
+
var triggerStyle = (color) => ({
|
|
2080
|
+
background: "transparent",
|
|
2081
|
+
border: "none",
|
|
2082
|
+
cursor: "pointer",
|
|
2083
|
+
padding: 4,
|
|
2084
|
+
color,
|
|
2085
|
+
display: "flex",
|
|
2086
|
+
alignItems: "center",
|
|
2087
|
+
justifyContent: "center"
|
|
2088
|
+
});
|
|
2089
|
+
var dropdownStyle = (tokens) => ({
|
|
2090
|
+
position: "absolute",
|
|
2091
|
+
right: 0,
|
|
2092
|
+
top: "100%",
|
|
2093
|
+
marginTop: 4,
|
|
2094
|
+
minWidth: 140,
|
|
2095
|
+
background: tokens.bgCard,
|
|
2096
|
+
border: `1px solid ${tokens.border}`,
|
|
2097
|
+
borderRadius: 12,
|
|
2098
|
+
boxShadow: tokens.shadow,
|
|
2099
|
+
zIndex: 100,
|
|
2100
|
+
overflow: "hidden"
|
|
2101
|
+
});
|
|
2102
|
+
var menuItemStyle = (tokens) => ({
|
|
2103
|
+
width: "100%",
|
|
2104
|
+
display: "flex",
|
|
2105
|
+
alignItems: "center",
|
|
2106
|
+
padding: "12px 16px",
|
|
2107
|
+
background: "transparent",
|
|
2108
|
+
border: "none",
|
|
2109
|
+
cursor: "pointer",
|
|
2110
|
+
fontFamily: "inherit",
|
|
2111
|
+
fontSize: "0.85rem",
|
|
2112
|
+
fontWeight: 500,
|
|
2113
|
+
color: tokens.error
|
|
2114
|
+
});
|
|
2019
2115
|
function LoginScreen({
|
|
2020
2116
|
authInput,
|
|
2021
2117
|
onAuthInputChange,
|
|
@@ -2503,21 +2599,36 @@ var hintStyle2 = (color) => ({
|
|
|
2503
2599
|
color,
|
|
2504
2600
|
margin: "0 0 4px"
|
|
2505
2601
|
});
|
|
2506
|
-
var DEFAULT_TICKS = [25, 100, 250, 500];
|
|
2507
|
-
var DEFAULT_MIN = 25;
|
|
2508
2602
|
var DEFAULT_MAX = 500;
|
|
2603
|
+
var ABSOLUTE_MIN = 1;
|
|
2604
|
+
function buildTicks(min, max) {
|
|
2605
|
+
if (max <= min) return [min];
|
|
2606
|
+
const range = max - min;
|
|
2607
|
+
const candidates = [1, 2, 5, 10, 25, 50, 100, 250];
|
|
2608
|
+
const step = candidates.find((s) => range / s <= 5) ?? Math.ceil(range / 4);
|
|
2609
|
+
const ticks = [];
|
|
2610
|
+
for (let v = min; v <= max; v += step) {
|
|
2611
|
+
ticks.push(Math.round(v * 100) / 100);
|
|
2612
|
+
}
|
|
2613
|
+
if (ticks[ticks.length - 1] !== max) ticks.push(max);
|
|
2614
|
+
return ticks;
|
|
2615
|
+
}
|
|
2509
2616
|
function SetupScreen({
|
|
2510
2617
|
availableBalance,
|
|
2511
2618
|
tokenCount,
|
|
2512
2619
|
sourceName,
|
|
2513
2620
|
onSetupOneTap,
|
|
2514
2621
|
onBack,
|
|
2622
|
+
onLogout,
|
|
2515
2623
|
loading,
|
|
2516
2624
|
error
|
|
2517
2625
|
}) {
|
|
2518
2626
|
const { tokens } = useSwypeConfig();
|
|
2519
|
-
const [limit, setLimit] = react.useState(100);
|
|
2520
2627
|
const effectiveMax = Math.min(DEFAULT_MAX, availableBalance > 0 ? availableBalance : DEFAULT_MAX);
|
|
2628
|
+
const effectiveMin = Math.min(ABSOLUTE_MIN, effectiveMax);
|
|
2629
|
+
const sliderStep = effectiveMax <= 10 ? 0.5 : effectiveMax <= 50 ? 1 : 5;
|
|
2630
|
+
const ticks = buildTicks(effectiveMin, effectiveMax);
|
|
2631
|
+
const [limit, setLimit] = react.useState(() => Math.min(100, effectiveMax));
|
|
2521
2632
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2522
2633
|
ScreenLayout,
|
|
2523
2634
|
{
|
|
@@ -2534,7 +2645,7 @@ function SetupScreen({
|
|
|
2534
2645
|
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
2535
2646
|
] }),
|
|
2536
2647
|
children: [
|
|
2537
|
-
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: "Swype Setup", badge: "Simple", onBack }),
|
|
2648
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: "Swype Setup", badge: "Simple", onBack, right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout }) }),
|
|
2538
2649
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle5(tokens.text), children: "Set up One-Tap deposits" }),
|
|
2539
2650
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle5(tokens.textSecondary), children: "Set your limit for instant deposits. Like a contactless card \u2014 you choose the max." }),
|
|
2540
2651
|
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle3(tokens), children: error }),
|
|
@@ -2569,10 +2680,10 @@ function SetupScreen({
|
|
|
2569
2680
|
LimitSlider,
|
|
2570
2681
|
{
|
|
2571
2682
|
value: limit,
|
|
2572
|
-
min:
|
|
2683
|
+
min: effectiveMin,
|
|
2573
2684
|
max: effectiveMax,
|
|
2574
|
-
step:
|
|
2575
|
-
ticks
|
|
2685
|
+
step: sliderStep,
|
|
2686
|
+
ticks,
|
|
2576
2687
|
onChange: setLimit
|
|
2577
2688
|
}
|
|
2578
2689
|
)
|
|
@@ -2692,6 +2803,7 @@ function SetupStatusScreen({
|
|
|
2692
2803
|
currentStepLabel,
|
|
2693
2804
|
merchantName,
|
|
2694
2805
|
onContinue,
|
|
2806
|
+
onLogout,
|
|
2695
2807
|
error
|
|
2696
2808
|
}) {
|
|
2697
2809
|
const { tokens } = useSwypeConfig();
|
|
@@ -2709,26 +2821,29 @@ function SetupStatusScreen({
|
|
|
2709
2821
|
},
|
|
2710
2822
|
{ label: "Done", status: "pending" }
|
|
2711
2823
|
];
|
|
2712
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
2824
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2713
2825
|
ScreenLayout,
|
|
2714
2826
|
{
|
|
2715
2827
|
footer: complete ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2716
2828
|
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onContinue, children: merchantName ? `Return to ${merchantName}` : "Continue" }),
|
|
2717
2829
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: swipeHintStyle(tokens.textMuted), children: "Swipe to deposit \u2014 no approvals needed." })
|
|
2718
2830
|
] }) : void 0,
|
|
2719
|
-
children:
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2831
|
+
children: [
|
|
2832
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout }) }),
|
|
2833
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle4, children: [
|
|
2834
|
+
complete ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2835
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconCircle, { variant: "success", size: 64, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "32", height: "32", 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.success }) }) }),
|
|
2836
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle6(tokens.text), children: "You're all set!" })
|
|
2837
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2838
|
+
/* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 48 }),
|
|
2839
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle6(tokens.text), children: "Setting up One-Tap..." })
|
|
2840
|
+
] }),
|
|
2841
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle4(tokens), children: error }),
|
|
2842
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: stepsWrapStyle, children: /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps }) }),
|
|
2843
|
+
!complete && /* @__PURE__ */ jsxRuntime.jsx("p", { style: waitHintStyle(tokens.textMuted), children: "Usually takes a few seconds" }),
|
|
2844
|
+
complete && /* @__PURE__ */ jsxRuntime.jsx("p", { style: readyHintStyle(tokens.textSecondary), children: "You can now deposit instantly from any partner app." })
|
|
2845
|
+
] })
|
|
2846
|
+
]
|
|
2732
2847
|
}
|
|
2733
2848
|
);
|
|
2734
2849
|
}
|
|
@@ -2801,7 +2916,8 @@ function DepositScreen({
|
|
|
2801
2916
|
onDeposit,
|
|
2802
2917
|
onChangeSource,
|
|
2803
2918
|
onSwitchWallet,
|
|
2804
|
-
onBack
|
|
2919
|
+
onBack,
|
|
2920
|
+
onLogout
|
|
2805
2921
|
}) {
|
|
2806
2922
|
const { tokens } = useSwypeConfig();
|
|
2807
2923
|
const [amount, setAmount] = react.useState(initialAmount);
|
|
@@ -2809,30 +2925,6 @@ function DepositScreen({
|
|
|
2809
2925
|
const isLowBalance = availableBalance < MIN_DEPOSIT;
|
|
2810
2926
|
const canDeposit = amount >= MIN_DEPOSIT && amount <= remainingLimit && !isLowBalance && !processing;
|
|
2811
2927
|
const headerTitle = merchantName ? `Deposit to ${merchantName}` : "Deposit";
|
|
2812
|
-
const trackRef = react.useRef(null);
|
|
2813
|
-
const [swipeX, setSwipeX] = react.useState(0);
|
|
2814
|
-
const [swiping, setSwiping] = react.useState(false);
|
|
2815
|
-
const startXRef = react.useRef(0);
|
|
2816
|
-
const handleTouchStart = react.useCallback((e) => {
|
|
2817
|
-
if (!canDeposit) return;
|
|
2818
|
-
startXRef.current = e.touches[0].clientX - swipeX;
|
|
2819
|
-
setSwiping(true);
|
|
2820
|
-
}, [canDeposit, swipeX]);
|
|
2821
|
-
const handleTouchMove = react.useCallback((e) => {
|
|
2822
|
-
if (!swiping || !trackRef.current) return;
|
|
2823
|
-
const trackWidth = trackRef.current.offsetWidth - 52;
|
|
2824
|
-
const x = Math.max(0, Math.min(e.touches[0].clientX - startXRef.current, trackWidth));
|
|
2825
|
-
setSwipeX(x);
|
|
2826
|
-
}, [swiping]);
|
|
2827
|
-
const handleTouchEnd = react.useCallback(() => {
|
|
2828
|
-
if (!trackRef.current) return;
|
|
2829
|
-
const trackWidth = trackRef.current.offsetWidth - 52;
|
|
2830
|
-
if (swipeX > trackWidth * 0.75) {
|
|
2831
|
-
onDeposit(amount);
|
|
2832
|
-
}
|
|
2833
|
-
setSwipeX(0);
|
|
2834
|
-
setSwiping(false);
|
|
2835
|
-
}, [swipeX, amount, onDeposit]);
|
|
2836
2928
|
if (isLowBalance) {
|
|
2837
2929
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2838
2930
|
ScreenLayout,
|
|
@@ -2844,7 +2936,7 @@ function DepositScreen({
|
|
|
2844
2936
|
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
2845
2937
|
] }),
|
|
2846
2938
|
children: [
|
|
2847
|
-
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: headerTitle, onBack }),
|
|
2939
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: headerTitle, onBack, right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout }) }),
|
|
2848
2940
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2849
2941
|
SourceCard,
|
|
2850
2942
|
{
|
|
@@ -2889,30 +2981,10 @@ function DepositScreen({
|
|
|
2889
2981
|
ScreenLayout,
|
|
2890
2982
|
{
|
|
2891
2983
|
footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2892
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2893
|
-
"div",
|
|
2894
|
-
{
|
|
2895
|
-
ref: trackRef,
|
|
2896
|
-
style: swipeTrackStyle(tokens),
|
|
2897
|
-
onTouchStart: handleTouchStart,
|
|
2898
|
-
onTouchMove: handleTouchMove,
|
|
2899
|
-
onTouchEnd: handleTouchEnd,
|
|
2900
|
-
children: [
|
|
2901
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2902
|
-
"div",
|
|
2903
|
-
{
|
|
2904
|
-
style: swipeThumbStyle(tokens, swipeX),
|
|
2905
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 5l8 7-8 7", stroke: "#fff", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
2906
|
-
}
|
|
2907
|
-
),
|
|
2908
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: swipeLabelStyle, children: processing ? "Processing..." : `Deposit $${amount.toFixed(2)}` })
|
|
2909
|
-
]
|
|
2910
|
-
}
|
|
2911
|
-
),
|
|
2912
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: desktopFallbackStyle, children: /* @__PURE__ */ jsxRuntime.jsxs(PrimaryButton, { onClick: () => onDeposit(amount), disabled: !canDeposit, loading: processing, children: [
|
|
2984
|
+
/* @__PURE__ */ jsxRuntime.jsxs(PrimaryButton, { onClick: () => onDeposit(amount), disabled: !canDeposit, loading: processing, children: [
|
|
2913
2985
|
"Deposit $",
|
|
2914
2986
|
amount.toFixed(2)
|
|
2915
|
-
] })
|
|
2987
|
+
] }),
|
|
2916
2988
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: noApprovalStyle(tokens.textMuted), children: "No approval needed \xB7 within your One-Tap limit" }),
|
|
2917
2989
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { style: routeStyle(tokens.textMuted), children: [
|
|
2918
2990
|
"From ",
|
|
@@ -2923,7 +2995,7 @@ function DepositScreen({
|
|
|
2923
2995
|
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
2924
2996
|
] }),
|
|
2925
2997
|
children: [
|
|
2926
|
-
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: headerTitle, badge: "Simple", onBack }),
|
|
2998
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: headerTitle, badge: "Simple", onBack, right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout }) }),
|
|
2927
2999
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2928
3000
|
SourceCard,
|
|
2929
3001
|
{
|
|
@@ -3066,45 +3138,6 @@ var errorBannerStyle5 = (tokens) => ({
|
|
|
3066
3138
|
marginTop: 8,
|
|
3067
3139
|
lineHeight: 1.5
|
|
3068
3140
|
});
|
|
3069
|
-
var swipeTrackStyle = (tokens) => ({
|
|
3070
|
-
position: "relative",
|
|
3071
|
-
height: 56,
|
|
3072
|
-
borderRadius: 999,
|
|
3073
|
-
background: `linear-gradient(180deg, ${tokens.accent}, ${tokens.accent}dd)`,
|
|
3074
|
-
overflow: "hidden",
|
|
3075
|
-
display: "flex",
|
|
3076
|
-
alignItems: "center",
|
|
3077
|
-
touchAction: "none",
|
|
3078
|
-
userSelect: "none"
|
|
3079
|
-
});
|
|
3080
|
-
var swipeThumbStyle = (tokens, x) => ({
|
|
3081
|
-
position: "absolute",
|
|
3082
|
-
left: 4 + x,
|
|
3083
|
-
top: 4,
|
|
3084
|
-
width: 48,
|
|
3085
|
-
height: 48,
|
|
3086
|
-
borderRadius: "50%",
|
|
3087
|
-
background: `${tokens.accent}`,
|
|
3088
|
-
border: "2px solid rgba(255,255,255,0.4)",
|
|
3089
|
-
display: "flex",
|
|
3090
|
-
alignItems: "center",
|
|
3091
|
-
justifyContent: "center",
|
|
3092
|
-
zIndex: 2,
|
|
3093
|
-
transition: x === 0 ? "left 0.25s ease" : "none",
|
|
3094
|
-
cursor: "grab"
|
|
3095
|
-
});
|
|
3096
|
-
var swipeLabelStyle = {
|
|
3097
|
-
flex: 1,
|
|
3098
|
-
textAlign: "center",
|
|
3099
|
-
color: "#fff",
|
|
3100
|
-
fontWeight: 700,
|
|
3101
|
-
fontSize: "0.95rem",
|
|
3102
|
-
zIndex: 1,
|
|
3103
|
-
pointerEvents: "none"
|
|
3104
|
-
};
|
|
3105
|
-
var desktopFallbackStyle = {
|
|
3106
|
-
marginTop: 8
|
|
3107
|
-
};
|
|
3108
3141
|
var noApprovalStyle = (color) => ({
|
|
3109
3142
|
textAlign: "center",
|
|
3110
3143
|
fontSize: "0.78rem",
|
|
@@ -3133,6 +3166,7 @@ function SuccessScreen({
|
|
|
3133
3166
|
sourceName,
|
|
3134
3167
|
remainingLimit,
|
|
3135
3168
|
onDone,
|
|
3169
|
+
onLogout,
|
|
3136
3170
|
onIncreaseLimits,
|
|
3137
3171
|
onManageAccount
|
|
3138
3172
|
}) {
|
|
@@ -3149,7 +3183,7 @@ function SuccessScreen({
|
|
|
3149
3183
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3150
3184
|
ScreenHeader,
|
|
3151
3185
|
{
|
|
3152
|
-
right: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3186
|
+
right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout })
|
|
3153
3187
|
}
|
|
3154
3188
|
),
|
|
3155
3189
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle5, children: [
|
|
@@ -3265,15 +3299,6 @@ var upsellLinkStyle = (color) => ({
|
|
|
3265
3299
|
fontFamily: "inherit",
|
|
3266
3300
|
padding: 0
|
|
3267
3301
|
});
|
|
3268
|
-
var closeButtonStyle = (color) => ({
|
|
3269
|
-
background: "transparent",
|
|
3270
|
-
border: "none",
|
|
3271
|
-
cursor: "pointer",
|
|
3272
|
-
color,
|
|
3273
|
-
padding: 4,
|
|
3274
|
-
display: "flex",
|
|
3275
|
-
alignItems: "center"
|
|
3276
|
-
});
|
|
3277
3302
|
var manageStyle = (color) => ({
|
|
3278
3303
|
background: "transparent",
|
|
3279
3304
|
border: "none",
|
|
@@ -3852,13 +3877,14 @@ function SwypePayment({
|
|
|
3852
3877
|
if (!sourceId) {
|
|
3853
3878
|
throw new Error("No wallet selected for setup.");
|
|
3854
3879
|
}
|
|
3880
|
+
const setupAmount = depositAmount ?? MIN_SEND_AMOUNT_USD;
|
|
3855
3881
|
const t = await createTransfer(apiBaseUrl, token, {
|
|
3856
3882
|
credentialId: activeCredentialId ?? "",
|
|
3857
3883
|
merchantAuthorization,
|
|
3858
3884
|
sourceType,
|
|
3859
3885
|
sourceId,
|
|
3860
3886
|
destination,
|
|
3861
|
-
amount:
|
|
3887
|
+
amount: setupAmount
|
|
3862
3888
|
});
|
|
3863
3889
|
if (t.authorizationSessions && t.authorizationSessions.length > 0) {
|
|
3864
3890
|
const shouldUseConnector = shouldUseWalletConnector({
|
|
@@ -3889,7 +3915,8 @@ function SwypePayment({
|
|
|
3889
3915
|
merchantAuthorization,
|
|
3890
3916
|
useWalletConnector,
|
|
3891
3917
|
authExecutor,
|
|
3892
|
-
onError
|
|
3918
|
+
onError,
|
|
3919
|
+
depositAmount
|
|
3893
3920
|
]);
|
|
3894
3921
|
const handleSelectProvider = react.useCallback((providerId) => {
|
|
3895
3922
|
setSelectedProviderId(providerId);
|
|
@@ -4008,6 +4035,7 @@ function SwypePayment({
|
|
|
4008
4035
|
sourceName,
|
|
4009
4036
|
onSetupOneTap: handleSetupOneTap,
|
|
4010
4037
|
onBack: () => setStep("wallet-picker"),
|
|
4038
|
+
onLogout: handleLogout,
|
|
4011
4039
|
loading: loadingData,
|
|
4012
4040
|
error
|
|
4013
4041
|
}
|
|
@@ -4023,6 +4051,7 @@ function SwypePayment({
|
|
|
4023
4051
|
currentStepLabel: setupStepLabel,
|
|
4024
4052
|
merchantName,
|
|
4025
4053
|
onContinue: () => setStep("deposit"),
|
|
4054
|
+
onLogout: handleLogout,
|
|
4026
4055
|
error
|
|
4027
4056
|
}
|
|
4028
4057
|
);
|
|
@@ -4050,7 +4079,8 @@ function SwypePayment({
|
|
|
4050
4079
|
onDeposit: handlePay,
|
|
4051
4080
|
onChangeSource: () => setStep("wallet-picker"),
|
|
4052
4081
|
onSwitchWallet: () => setStep("wallet-picker"),
|
|
4053
|
-
onBack: onBack ?? (() => handleLogout())
|
|
4082
|
+
onBack: onBack ?? (() => handleLogout()),
|
|
4083
|
+
onLogout: handleLogout
|
|
4054
4084
|
}
|
|
4055
4085
|
);
|
|
4056
4086
|
}
|
|
@@ -4086,7 +4116,8 @@ function SwypePayment({
|
|
|
4086
4116
|
merchantName,
|
|
4087
4117
|
sourceName,
|
|
4088
4118
|
remainingLimit: oneTapLimit > displayAmount ? oneTapLimit - displayAmount : 0,
|
|
4089
|
-
onDone: handleNewPayment
|
|
4119
|
+
onDone: handleNewPayment,
|
|
4120
|
+
onLogout: handleLogout
|
|
4090
4121
|
}
|
|
4091
4122
|
);
|
|
4092
4123
|
}
|
|
@@ -4107,7 +4138,8 @@ function SwypePayment({
|
|
|
4107
4138
|
onDeposit: handlePay,
|
|
4108
4139
|
onChangeSource: () => setStep("wallet-picker"),
|
|
4109
4140
|
onSwitchWallet: () => setStep("wallet-picker"),
|
|
4110
|
-
onBack: onBack ?? (() => handleLogout())
|
|
4141
|
+
onBack: onBack ?? (() => handleLogout()),
|
|
4142
|
+
onLogout: handleLogout
|
|
4111
4143
|
}
|
|
4112
4144
|
);
|
|
4113
4145
|
}
|