@swype-org/react-sdk 0.1.182 → 0.1.187
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 +227 -163
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +227 -163
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2285,13 +2285,7 @@ function useFlowPhase() {
|
|
|
2285
2285
|
function StepProgress({ phase }) {
|
|
2286
2286
|
const { tokens } = useSwypeConfig();
|
|
2287
2287
|
if (phase === "deposit") {
|
|
2288
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
2289
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: dotStyle(tokens.textMuted) }),
|
|
2290
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: labelStyle(tokens.textMuted), children: "Link" }),
|
|
2291
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: lineStyle(tokens.textMuted) }),
|
|
2292
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: dotStyle(tokens.accent) }),
|
|
2293
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: labelStyle(tokens.text), children: "Deposit" })
|
|
2294
|
-
] });
|
|
2288
|
+
return /* @__PURE__ */ jsxRuntime.jsx("img", { src: SWYPE_MASCOT, alt: "Swype", style: mascotStyle });
|
|
2295
2289
|
}
|
|
2296
2290
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: containerStyle3, children: [
|
|
2297
2291
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: dotStyle(tokens.accent) }),
|
|
@@ -2326,16 +2320,102 @@ var labelStyle = (color) => ({
|
|
|
2326
2320
|
color,
|
|
2327
2321
|
whiteSpace: "nowrap"
|
|
2328
2322
|
});
|
|
2329
|
-
|
|
2323
|
+
var mascotStyle = {
|
|
2324
|
+
width: 28,
|
|
2325
|
+
height: 28
|
|
2326
|
+
};
|
|
2327
|
+
function SettingsMenu({ onLogout }) {
|
|
2328
|
+
const { tokens } = useSwypeConfig();
|
|
2329
|
+
const [open, setOpen] = react.useState(false);
|
|
2330
|
+
const menuRef = react.useRef(null);
|
|
2331
|
+
const toggle = react.useCallback(() => setOpen((prev) => !prev), []);
|
|
2332
|
+
react.useEffect(() => {
|
|
2333
|
+
if (!open) return;
|
|
2334
|
+
const handleClickOutside = (e) => {
|
|
2335
|
+
if (menuRef.current && !menuRef.current.contains(e.target)) {
|
|
2336
|
+
setOpen(false);
|
|
2337
|
+
}
|
|
2338
|
+
};
|
|
2339
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2340
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2341
|
+
}, [open]);
|
|
2342
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: menuRef, style: containerStyle4, children: [
|
|
2343
|
+
/* @__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: [
|
|
2344
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "5", r: "2", fill: "currentColor" }),
|
|
2345
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "2", fill: "currentColor" }),
|
|
2346
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "19", r: "2", fill: "currentColor" })
|
|
2347
|
+
] }) }),
|
|
2348
|
+
open && /* @__PURE__ */ jsxRuntime.jsx("div", { style: dropdownStyle(tokens), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2349
|
+
"button",
|
|
2350
|
+
{
|
|
2351
|
+
type: "button",
|
|
2352
|
+
onClick: () => {
|
|
2353
|
+
setOpen(false);
|
|
2354
|
+
onLogout();
|
|
2355
|
+
},
|
|
2356
|
+
style: menuItemStyle(tokens),
|
|
2357
|
+
children: [
|
|
2358
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { marginRight: 8, flexShrink: 0 }, children: [
|
|
2359
|
+
/* @__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" }),
|
|
2360
|
+
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "16 17 21 12 16 7", stroke: tokens.error, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
2361
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "21", y1: "12", x2: "9", y2: "12", stroke: tokens.error, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
2362
|
+
] }),
|
|
2363
|
+
"Log out"
|
|
2364
|
+
]
|
|
2365
|
+
}
|
|
2366
|
+
) })
|
|
2367
|
+
] });
|
|
2368
|
+
}
|
|
2369
|
+
var containerStyle4 = {
|
|
2370
|
+
position: "relative"
|
|
2371
|
+
};
|
|
2372
|
+
var triggerStyle = (color) => ({
|
|
2373
|
+
background: "transparent",
|
|
2374
|
+
border: "none",
|
|
2375
|
+
cursor: "pointer",
|
|
2376
|
+
padding: 4,
|
|
2377
|
+
color,
|
|
2378
|
+
display: "flex",
|
|
2379
|
+
alignItems: "center",
|
|
2380
|
+
justifyContent: "center"
|
|
2381
|
+
});
|
|
2382
|
+
var dropdownStyle = (tokens) => ({
|
|
2383
|
+
position: "absolute",
|
|
2384
|
+
right: 0,
|
|
2385
|
+
top: "100%",
|
|
2386
|
+
marginTop: 4,
|
|
2387
|
+
minWidth: 140,
|
|
2388
|
+
background: tokens.bgCard,
|
|
2389
|
+
border: `1px solid ${tokens.border}`,
|
|
2390
|
+
borderRadius: 12,
|
|
2391
|
+
boxShadow: tokens.shadow,
|
|
2392
|
+
zIndex: 100,
|
|
2393
|
+
overflow: "hidden"
|
|
2394
|
+
});
|
|
2395
|
+
var menuItemStyle = (tokens) => ({
|
|
2396
|
+
width: "100%",
|
|
2397
|
+
display: "flex",
|
|
2398
|
+
alignItems: "center",
|
|
2399
|
+
padding: "12px 16px",
|
|
2400
|
+
background: "transparent",
|
|
2401
|
+
border: "none",
|
|
2402
|
+
cursor: "pointer",
|
|
2403
|
+
fontFamily: "inherit",
|
|
2404
|
+
fontSize: "0.85rem",
|
|
2405
|
+
fontWeight: 500,
|
|
2406
|
+
color: tokens.error
|
|
2407
|
+
});
|
|
2408
|
+
function ScreenHeader({ title, right, onBack, badge, onLogout }) {
|
|
2330
2409
|
const { tokens } = useSwypeConfig();
|
|
2331
2410
|
const flowPhase = useFlowPhase();
|
|
2411
|
+
const rightContent = onLogout ? /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout }) : right;
|
|
2332
2412
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: headerStyle, children: [
|
|
2333
2413
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: leftSlotStyle, children: onBack && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onBack, style: backButtonStyle(tokens.text), "aria-label": "Go back", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 18l-6-6 6-6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }) }),
|
|
2334
2414
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: centerSlotStyle, children: flowPhase ? /* @__PURE__ */ jsxRuntime.jsx(StepProgress, { phase: flowPhase }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2335
2415
|
title && /* @__PURE__ */ jsxRuntime.jsx("span", { style: titleStyle(tokens.text), children: title }),
|
|
2336
2416
|
badge && /* @__PURE__ */ jsxRuntime.jsx("span", { style: badgeStyle(tokens.textMuted), children: badge })
|
|
2337
2417
|
] }) }),
|
|
2338
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: rightSlotStyle, children:
|
|
2418
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: rightSlotStyle, children: rightContent })
|
|
2339
2419
|
] });
|
|
2340
2420
|
}
|
|
2341
2421
|
var headerStyle = {
|
|
@@ -2376,7 +2456,7 @@ var badgeStyle = (color) => ({
|
|
|
2376
2456
|
});
|
|
2377
2457
|
function PoweredByFooter() {
|
|
2378
2458
|
const { tokens } = useSwypeConfig();
|
|
2379
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style:
|
|
2459
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: containerStyle5(tokens.textMuted), children: [
|
|
2380
2460
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: rowStyle, children: [
|
|
2381
2461
|
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2382
2462
|
"path",
|
|
@@ -2390,7 +2470,7 @@ function PoweredByFooter() {
|
|
|
2390
2470
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: pillStyle(tokens.textMuted, tokens.border), children: "Beta Version" })
|
|
2391
2471
|
] });
|
|
2392
2472
|
}
|
|
2393
|
-
var
|
|
2473
|
+
var containerStyle5 = (color) => ({
|
|
2394
2474
|
display: "flex",
|
|
2395
2475
|
flexDirection: "column",
|
|
2396
2476
|
alignItems: "center",
|
|
@@ -2489,12 +2569,12 @@ var defaultIcon = /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "
|
|
|
2489
2569
|
) });
|
|
2490
2570
|
function InfoBanner({ children, icon }) {
|
|
2491
2571
|
const { tokens } = useSwypeConfig();
|
|
2492
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style:
|
|
2572
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: containerStyle6(tokens.accent), children: [
|
|
2493
2573
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: iconStyle, children: icon ?? defaultIcon }),
|
|
2494
2574
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: textStyle, children })
|
|
2495
2575
|
] });
|
|
2496
2576
|
}
|
|
2497
|
-
var
|
|
2577
|
+
var containerStyle6 = (accent) => ({
|
|
2498
2578
|
display: "flex",
|
|
2499
2579
|
alignItems: "flex-start",
|
|
2500
2580
|
gap: 10,
|
|
@@ -2512,7 +2592,7 @@ var iconStyle = {
|
|
|
2512
2592
|
};
|
|
2513
2593
|
var textStyle = { flex: 1 };
|
|
2514
2594
|
function WarningBanner({ title, children }) {
|
|
2515
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style:
|
|
2595
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: containerStyle7, children: [
|
|
2516
2596
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: headerStyle2, children: [
|
|
2517
2597
|
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", style: iconStyle2, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z", fill: "#F57C00" }) }),
|
|
2518
2598
|
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: title })
|
|
@@ -2520,7 +2600,7 @@ function WarningBanner({ title, children }) {
|
|
|
2520
2600
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: bodyStyle2, children })
|
|
2521
2601
|
] });
|
|
2522
2602
|
}
|
|
2523
|
-
var
|
|
2603
|
+
var containerStyle7 = {
|
|
2524
2604
|
padding: "14px 16px",
|
|
2525
2605
|
background: "#FFF8E1",
|
|
2526
2606
|
border: "1px solid #FFE082",
|
|
@@ -2599,7 +2679,7 @@ function OtpInput({ value, onChange, length = 6, disabled }) {
|
|
|
2599
2679
|
onChange(pasted);
|
|
2600
2680
|
focusInput(Math.min(pasted.length, length - 1));
|
|
2601
2681
|
}, [onChange, length, focusInput]);
|
|
2602
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { style:
|
|
2682
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: containerStyle8, children: digits.map((digit, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2603
2683
|
"input",
|
|
2604
2684
|
{
|
|
2605
2685
|
ref: (el) => {
|
|
@@ -2620,7 +2700,7 @@ function OtpInput({ value, onChange, length = 6, disabled }) {
|
|
|
2620
2700
|
i
|
|
2621
2701
|
)) });
|
|
2622
2702
|
}
|
|
2623
|
-
var
|
|
2703
|
+
var containerStyle8 = {
|
|
2624
2704
|
display: "flex",
|
|
2625
2705
|
gap: 8,
|
|
2626
2706
|
justifyContent: "center",
|
|
@@ -2729,7 +2809,7 @@ function SourceCard({
|
|
|
2729
2809
|
}
|
|
2730
2810
|
)
|
|
2731
2811
|
] }),
|
|
2732
|
-
open && hasDropdown && /* @__PURE__ */ jsxRuntime.jsxs("div", { style:
|
|
2812
|
+
open && hasDropdown && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: dropdownStyle2(tokens), children: [
|
|
2733
2813
|
accounts.map((account) => {
|
|
2734
2814
|
const preferredWallet = getPreferredDepositWallet(account, depositAmount ?? 0);
|
|
2735
2815
|
const active = hasActiveDepositWallet(account);
|
|
@@ -2850,7 +2930,7 @@ var changeStyle = (color) => ({
|
|
|
2850
2930
|
fontFamily: "inherit",
|
|
2851
2931
|
padding: 0
|
|
2852
2932
|
});
|
|
2853
|
-
var
|
|
2933
|
+
var dropdownStyle2 = (tokens) => ({
|
|
2854
2934
|
position: "absolute",
|
|
2855
2935
|
top: "100%",
|
|
2856
2936
|
left: 0,
|
|
@@ -3003,11 +3083,11 @@ function StepList({ steps }) {
|
|
|
3003
3083
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3004
3084
|
"div",
|
|
3005
3085
|
{
|
|
3006
|
-
style: badgeStyle2(
|
|
3007
|
-
isComplete ? tokens.accent :
|
|
3008
|
-
isComplete
|
|
3086
|
+
style: isActive ? activeBadgeContainerStyle : badgeStyle2(
|
|
3087
|
+
isComplete ? tokens.accent : tokens.border,
|
|
3088
|
+
isComplete
|
|
3009
3089
|
),
|
|
3010
|
-
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:
|
|
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 })
|
|
3011
3091
|
}
|
|
3012
3092
|
),
|
|
3013
3093
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: labelContainerStyle, children: [
|
|
@@ -3038,11 +3118,26 @@ var badgeStyle2 = (color, filled) => ({
|
|
|
3038
3118
|
justifyContent: "center",
|
|
3039
3119
|
flexShrink: 0
|
|
3040
3120
|
});
|
|
3041
|
-
var
|
|
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
|
+
var badgeNumberStyle = {
|
|
3042
3137
|
fontSize: "0.75rem",
|
|
3043
3138
|
fontWeight: 600,
|
|
3044
|
-
color:
|
|
3045
|
-
}
|
|
3139
|
+
color: "inherit"
|
|
3140
|
+
};
|
|
3046
3141
|
var labelContainerStyle = {
|
|
3047
3142
|
display: "flex",
|
|
3048
3143
|
flexDirection: "column"
|
|
@@ -3056,87 +3151,6 @@ var detailStyle = (color) => ({
|
|
|
3056
3151
|
fontSize: "0.75rem",
|
|
3057
3152
|
color
|
|
3058
3153
|
});
|
|
3059
|
-
function SettingsMenu({ onLogout }) {
|
|
3060
|
-
const { tokens } = useSwypeConfig();
|
|
3061
|
-
const [open, setOpen] = react.useState(false);
|
|
3062
|
-
const menuRef = react.useRef(null);
|
|
3063
|
-
const toggle = react.useCallback(() => setOpen((prev) => !prev), []);
|
|
3064
|
-
react.useEffect(() => {
|
|
3065
|
-
if (!open) return;
|
|
3066
|
-
const handleClickOutside = (e) => {
|
|
3067
|
-
if (menuRef.current && !menuRef.current.contains(e.target)) {
|
|
3068
|
-
setOpen(false);
|
|
3069
|
-
}
|
|
3070
|
-
};
|
|
3071
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
3072
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
3073
|
-
}, [open]);
|
|
3074
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: menuRef, style: containerStyle8, children: [
|
|
3075
|
-
/* @__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: [
|
|
3076
|
-
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "5", r: "2", fill: "currentColor" }),
|
|
3077
|
-
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "2", fill: "currentColor" }),
|
|
3078
|
-
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "19", r: "2", fill: "currentColor" })
|
|
3079
|
-
] }) }),
|
|
3080
|
-
open && /* @__PURE__ */ jsxRuntime.jsx("div", { style: dropdownStyle2(tokens), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3081
|
-
"button",
|
|
3082
|
-
{
|
|
3083
|
-
type: "button",
|
|
3084
|
-
onClick: () => {
|
|
3085
|
-
setOpen(false);
|
|
3086
|
-
onLogout();
|
|
3087
|
-
},
|
|
3088
|
-
style: menuItemStyle(tokens),
|
|
3089
|
-
children: [
|
|
3090
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { marginRight: 8, flexShrink: 0 }, children: [
|
|
3091
|
-
/* @__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" }),
|
|
3092
|
-
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "16 17 21 12 16 7", stroke: tokens.error, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
3093
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "21", y1: "12", x2: "9", y2: "12", stroke: tokens.error, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
3094
|
-
] }),
|
|
3095
|
-
"Log out"
|
|
3096
|
-
]
|
|
3097
|
-
}
|
|
3098
|
-
) })
|
|
3099
|
-
] });
|
|
3100
|
-
}
|
|
3101
|
-
var containerStyle8 = {
|
|
3102
|
-
position: "relative"
|
|
3103
|
-
};
|
|
3104
|
-
var triggerStyle = (color) => ({
|
|
3105
|
-
background: "transparent",
|
|
3106
|
-
border: "none",
|
|
3107
|
-
cursor: "pointer",
|
|
3108
|
-
padding: 4,
|
|
3109
|
-
color,
|
|
3110
|
-
display: "flex",
|
|
3111
|
-
alignItems: "center",
|
|
3112
|
-
justifyContent: "center"
|
|
3113
|
-
});
|
|
3114
|
-
var dropdownStyle2 = (tokens) => ({
|
|
3115
|
-
position: "absolute",
|
|
3116
|
-
right: 0,
|
|
3117
|
-
top: "100%",
|
|
3118
|
-
marginTop: 4,
|
|
3119
|
-
minWidth: 140,
|
|
3120
|
-
background: tokens.bgCard,
|
|
3121
|
-
border: `1px solid ${tokens.border}`,
|
|
3122
|
-
borderRadius: 12,
|
|
3123
|
-
boxShadow: tokens.shadow,
|
|
3124
|
-
zIndex: 100,
|
|
3125
|
-
overflow: "hidden"
|
|
3126
|
-
});
|
|
3127
|
-
var menuItemStyle = (tokens) => ({
|
|
3128
|
-
width: "100%",
|
|
3129
|
-
display: "flex",
|
|
3130
|
-
alignItems: "center",
|
|
3131
|
-
padding: "12px 16px",
|
|
3132
|
-
background: "transparent",
|
|
3133
|
-
border: "none",
|
|
3134
|
-
cursor: "pointer",
|
|
3135
|
-
fontFamily: "inherit",
|
|
3136
|
-
fontSize: "0.85rem",
|
|
3137
|
-
fontWeight: 500,
|
|
3138
|
-
color: tokens.error
|
|
3139
|
-
});
|
|
3140
3154
|
function LoginScreen({
|
|
3141
3155
|
authInput,
|
|
3142
3156
|
onAuthInputChange,
|
|
@@ -3428,6 +3442,7 @@ var resendStyle = (color, disabled) => ({
|
|
|
3428
3442
|
function PasskeyScreen({
|
|
3429
3443
|
onCreatePasskey,
|
|
3430
3444
|
onBack,
|
|
3445
|
+
onLogout,
|
|
3431
3446
|
creating,
|
|
3432
3447
|
error,
|
|
3433
3448
|
popupFallback = false,
|
|
@@ -3444,7 +3459,7 @@ function PasskeyScreen({
|
|
|
3444
3459
|
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
3445
3460
|
] }),
|
|
3446
3461
|
children: [
|
|
3447
|
-
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack }),
|
|
3462
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack, onLogout }),
|
|
3448
3463
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle4, children: [
|
|
3449
3464
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle3(tokens.text), children: "Secure your account with a passkey" }),
|
|
3450
3465
|
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle2(tokens), children: error })
|
|
@@ -3534,7 +3549,8 @@ function WalletPickerScreen({
|
|
|
3534
3549
|
onPrepareProvider,
|
|
3535
3550
|
onSelectProvider,
|
|
3536
3551
|
onContinueConnection,
|
|
3537
|
-
onBack
|
|
3552
|
+
onBack,
|
|
3553
|
+
onLogout
|
|
3538
3554
|
}) {
|
|
3539
3555
|
const { tokens } = useSwypeConfig();
|
|
3540
3556
|
const [hoveredId, setHoveredId] = react.useState(null);
|
|
@@ -3571,7 +3587,7 @@ function WalletPickerScreen({
|
|
|
3571
3587
|
const selectedProvider = displayProviders.find((p) => p.id === selectedProviderId);
|
|
3572
3588
|
if (loading) {
|
|
3573
3589
|
return /* @__PURE__ */ jsxRuntime.jsxs(ScreenLayout, { children: [
|
|
3574
|
-
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: "Set up Swype", onBack }),
|
|
3590
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: "Set up Swype", onBack, onLogout }),
|
|
3575
3591
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { textAlign: "center", padding: "48px 0", flex: 1, display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { label: "Connecting..." }) })
|
|
3576
3592
|
] });
|
|
3577
3593
|
}
|
|
@@ -3601,7 +3617,7 @@ function WalletPickerScreen({
|
|
|
3601
3617
|
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
3602
3618
|
] }),
|
|
3603
3619
|
children: [
|
|
3604
|
-
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: "Set up Swype", onBack }),
|
|
3620
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: "Set up Swype", onBack, onLogout }),
|
|
3605
3621
|
hasPending && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3606
3622
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle4(tokens.text), children: "Continue where you left off" }),
|
|
3607
3623
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle2(tokens.textSecondary), children: "You have a wallet that still needs setup" }),
|
|
@@ -3869,6 +3885,7 @@ function SetupScreen({
|
|
|
3869
3885
|
availableBalance,
|
|
3870
3886
|
onSetupOneTap,
|
|
3871
3887
|
onBack,
|
|
3888
|
+
onLogout,
|
|
3872
3889
|
onAdvanced,
|
|
3873
3890
|
loading,
|
|
3874
3891
|
error
|
|
@@ -3877,12 +3894,14 @@ function SetupScreen({
|
|
|
3877
3894
|
const effectiveMax = DEFAULT_MAX;
|
|
3878
3895
|
const effectiveMin = Math.min(ABSOLUTE_MIN, effectiveMax);
|
|
3879
3896
|
const [limit, setLimit] = react.useState(() => Math.min(availableBalance, effectiveMax));
|
|
3897
|
+
const [activePreset, setActivePreset] = react.useState(null);
|
|
3880
3898
|
const [editing, setEditing] = react.useState(false);
|
|
3881
3899
|
const [inputValue, setInputValue] = react.useState("");
|
|
3882
3900
|
const inputRef = react.useRef(null);
|
|
3883
3901
|
const startEditing = react.useCallback(() => {
|
|
3884
3902
|
setInputValue(limit.toFixed(2));
|
|
3885
3903
|
setEditing(true);
|
|
3904
|
+
setActivePreset(null);
|
|
3886
3905
|
requestAnimationFrame(() => inputRef.current?.focus());
|
|
3887
3906
|
}, [limit]);
|
|
3888
3907
|
const commitEdit = react.useCallback(() => {
|
|
@@ -3890,16 +3909,17 @@ function SetupScreen({
|
|
|
3890
3909
|
if (!isNaN(parsed)) {
|
|
3891
3910
|
setLimit(Math.min(effectiveMax, Math.max(effectiveMin, Math.round(parsed * 100) / 100)));
|
|
3892
3911
|
}
|
|
3912
|
+
setActivePreset(null);
|
|
3893
3913
|
setEditing(false);
|
|
3894
3914
|
}, [inputValue, effectiveMax, effectiveMin]);
|
|
3895
3915
|
const selectPreset = (value) => {
|
|
3896
3916
|
setLimit(Math.min(value, effectiveMax));
|
|
3917
|
+
setActivePreset(value);
|
|
3897
3918
|
};
|
|
3898
3919
|
const selectMax = () => {
|
|
3899
3920
|
setLimit(Math.min(availableBalance, effectiveMax));
|
|
3921
|
+
setActivePreset("max");
|
|
3900
3922
|
};
|
|
3901
|
-
const isPresetActive = (value) => Math.abs(limit - value) < 5e-3;
|
|
3902
|
-
const isMaxActive = Math.abs(limit - Math.min(availableBalance, effectiveMax)) < 5e-3 && !PRESETS.some((p) => isPresetActive(p));
|
|
3903
3923
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3904
3924
|
ScreenLayout,
|
|
3905
3925
|
{
|
|
@@ -3916,7 +3936,7 @@ function SetupScreen({
|
|
|
3916
3936
|
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
3917
3937
|
] }),
|
|
3918
3938
|
children: [
|
|
3919
|
-
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack }),
|
|
3939
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack, onLogout }),
|
|
3920
3940
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle5(tokens.text), children: "Set Spending Limit" }),
|
|
3921
3941
|
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle3(tokens), children: error }),
|
|
3922
3942
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: amountRowStyle, children: [
|
|
@@ -3977,7 +3997,7 @@ function SetupScreen({
|
|
|
3977
3997
|
{
|
|
3978
3998
|
type: "button",
|
|
3979
3999
|
onClick: () => selectPreset(value),
|
|
3980
|
-
style: presetButtonStyle(tokens,
|
|
4000
|
+
style: presetButtonStyle(tokens, activePreset === value),
|
|
3981
4001
|
children: [
|
|
3982
4002
|
"$",
|
|
3983
4003
|
value.toLocaleString()
|
|
@@ -3990,7 +4010,7 @@ function SetupScreen({
|
|
|
3990
4010
|
{
|
|
3991
4011
|
type: "button",
|
|
3992
4012
|
onClick: selectMax,
|
|
3993
|
-
style: presetButtonStyle(tokens,
|
|
4013
|
+
style: presetButtonStyle(tokens, activePreset === "max"),
|
|
3994
4014
|
children: "Max"
|
|
3995
4015
|
}
|
|
3996
4016
|
)
|
|
@@ -4104,7 +4124,7 @@ function SetupStatusScreen({
|
|
|
4104
4124
|
return /* @__PURE__ */ jsxRuntime.jsxs(ScreenLayout, { footer: /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {}), children: [
|
|
4105
4125
|
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack: onContinue }),
|
|
4106
4126
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle5, children: [
|
|
4107
|
-
/* @__PURE__ */ jsxRuntime.jsx("img", { src: SWYPE_MASCOT, alt: "Swype", style:
|
|
4127
|
+
/* @__PURE__ */ jsxRuntime.jsx("img", { src: SWYPE_MASCOT, alt: "Swype", style: mascotStyle2 }),
|
|
4108
4128
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle6(tokens.text), children: "Done!" }),
|
|
4109
4129
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle3(tokens.textSecondary), children: "Return to the app to try one-tap deposits." })
|
|
4110
4130
|
] })
|
|
@@ -4115,7 +4135,7 @@ function SetupStatusScreen({
|
|
|
4115
4135
|
{ label: "Done", status: "pending" }
|
|
4116
4136
|
];
|
|
4117
4137
|
return /* @__PURE__ */ jsxRuntime.jsxs(ScreenLayout, { children: [
|
|
4118
|
-
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, {
|
|
4138
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onLogout }),
|
|
4119
4139
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle5, children: [
|
|
4120
4140
|
/* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 48 }),
|
|
4121
4141
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle6(tokens.text), children: "Setting up One-Tap..." }),
|
|
@@ -4134,7 +4154,7 @@ var contentStyle5 = {
|
|
|
4134
4154
|
textAlign: "center",
|
|
4135
4155
|
padding: "0 24px 32px"
|
|
4136
4156
|
};
|
|
4137
|
-
var
|
|
4157
|
+
var mascotStyle2 = {
|
|
4138
4158
|
width: 56,
|
|
4139
4159
|
height: 56
|
|
4140
4160
|
};
|
|
@@ -4204,7 +4224,7 @@ function DepositScreen({
|
|
|
4204
4224
|
const { tokens } = useSwypeConfig();
|
|
4205
4225
|
const amount = initialAmount;
|
|
4206
4226
|
const isLowBalance = availableBalance < MIN_DEPOSIT;
|
|
4207
|
-
const exceedsLimit = amount > remainingLimit && !isLowBalance;
|
|
4227
|
+
const exceedsLimit = remainingLimit != null && amount > remainingLimit && !isLowBalance;
|
|
4208
4228
|
const canDeposit = amount >= MIN_DEPOSIT && !exceedsLimit && !isLowBalance && !processing;
|
|
4209
4229
|
const headerTitle = merchantName ? `Deposit to ${merchantName}` : "Deposit";
|
|
4210
4230
|
if (isLowBalance) {
|
|
@@ -4218,7 +4238,7 @@ function DepositScreen({
|
|
|
4218
4238
|
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
4219
4239
|
] }),
|
|
4220
4240
|
children: [
|
|
4221
|
-
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: headerTitle, onBack,
|
|
4241
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: headerTitle, onBack, onLogout }),
|
|
4222
4242
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4223
4243
|
SourceCard,
|
|
4224
4244
|
{
|
|
@@ -4275,7 +4295,7 @@ function DepositScreen({
|
|
|
4275
4295
|
"Your deposit of $",
|
|
4276
4296
|
amount.toFixed(2),
|
|
4277
4297
|
" exceeds your One-Tap limit of $",
|
|
4278
|
-
remainingLimit
|
|
4298
|
+
remainingLimit?.toFixed(2) ?? "0.00",
|
|
4279
4299
|
". Increase your limit to continue."
|
|
4280
4300
|
] })
|
|
4281
4301
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: () => onDeposit(amount), disabled: !canDeposit, loading: processing, children: "Confirm" }),
|
|
@@ -4283,7 +4303,20 @@ function DepositScreen({
|
|
|
4283
4303
|
] }),
|
|
4284
4304
|
children: [
|
|
4285
4305
|
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack }),
|
|
4286
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
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
|
+
),
|
|
4287
4320
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: depositCardStyle(tokens), children: [
|
|
4288
4321
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: depositLabelStyle(tokens.textMuted), children: "Depositing" }),
|
|
4289
4322
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: amountRowStyle2, children: [
|
|
@@ -4322,7 +4355,7 @@ function DepositScreen({
|
|
|
4322
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" }) })
|
|
4323
4356
|
] })
|
|
4324
4357
|
] }),
|
|
4325
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: spendingLimitStyle(tokens.textMuted), children: [
|
|
4358
|
+
remainingLimit != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: spendingLimitStyle(tokens.textMuted), children: [
|
|
4326
4359
|
"Spending Limit",
|
|
4327
4360
|
" ",
|
|
4328
4361
|
/* @__PURE__ */ jsxRuntime.jsxs("strong", { style: { color: tokens.text }, children: [
|
|
@@ -4335,15 +4368,6 @@ function DepositScreen({
|
|
|
4335
4368
|
}
|
|
4336
4369
|
);
|
|
4337
4370
|
}
|
|
4338
|
-
var mascotWrapStyle = {
|
|
4339
|
-
display: "flex",
|
|
4340
|
-
justifyContent: "center",
|
|
4341
|
-
marginBottom: 16
|
|
4342
|
-
};
|
|
4343
|
-
var mascotStyle2 = {
|
|
4344
|
-
width: 36,
|
|
4345
|
-
height: 36
|
|
4346
|
-
};
|
|
4347
4371
|
var depositCardStyle = (tokens) => ({
|
|
4348
4372
|
background: tokens.bgInput,
|
|
4349
4373
|
border: `1px solid ${tokens.border}`,
|
|
@@ -4535,12 +4559,7 @@ function SuccessScreen({
|
|
|
4535
4559
|
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
4536
4560
|
] }),
|
|
4537
4561
|
children: [
|
|
4538
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4539
|
-
ScreenHeader,
|
|
4540
|
-
{
|
|
4541
|
-
right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout })
|
|
4542
|
-
}
|
|
4543
|
-
),
|
|
4562
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onLogout }),
|
|
4544
4563
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle6, children: [
|
|
4545
4564
|
succeeded ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4546
4565
|
/* @__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 }) }) }),
|
|
@@ -4707,7 +4726,7 @@ function SelectSourceScreen({
|
|
|
4707
4726
|
{
|
|
4708
4727
|
title: "Select Source",
|
|
4709
4728
|
onBack,
|
|
4710
|
-
|
|
4729
|
+
onLogout
|
|
4711
4730
|
}
|
|
4712
4731
|
),
|
|
4713
4732
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle5(tokens.textMuted), children: "Choose which chain and token to pay from." }),
|
|
@@ -5074,12 +5093,13 @@ function buildSteps(phase) {
|
|
|
5074
5093
|
}
|
|
5075
5094
|
function TransferStatusScreen({
|
|
5076
5095
|
phase,
|
|
5077
|
-
error
|
|
5096
|
+
error,
|
|
5097
|
+
onLogout
|
|
5078
5098
|
}) {
|
|
5079
5099
|
const { tokens } = useSwypeConfig();
|
|
5080
5100
|
const steps = buildSteps(phase);
|
|
5081
5101
|
return /* @__PURE__ */ jsxRuntime.jsxs(ScreenLayout, { footer: /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {}), children: [
|
|
5082
|
-
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, {}),
|
|
5102
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onLogout }),
|
|
5083
5103
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle7, children: [
|
|
5084
5104
|
/* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 64 }),
|
|
5085
5105
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle9(tokens.text), children: "Depositing your money..." }),
|
|
@@ -5148,6 +5168,7 @@ function OpenWalletScreen({
|
|
|
5148
5168
|
walletName,
|
|
5149
5169
|
deeplinkUri,
|
|
5150
5170
|
loading,
|
|
5171
|
+
useDeeplink = true,
|
|
5151
5172
|
error,
|
|
5152
5173
|
onRetryStatus,
|
|
5153
5174
|
onBack,
|
|
@@ -5158,16 +5179,44 @@ function OpenWalletScreen({
|
|
|
5158
5179
|
const logoSrc = walletName ? KNOWN_LOGOS[walletName.toLowerCase()] : void 0;
|
|
5159
5180
|
const autoOpenedRef = react.useRef(null);
|
|
5160
5181
|
react.useEffect(() => {
|
|
5161
|
-
if (loading || !deeplinkUri || autoOpenedRef.current === deeplinkUri) return;
|
|
5182
|
+
if (!useDeeplink || loading || !deeplinkUri || autoOpenedRef.current === deeplinkUri) return;
|
|
5162
5183
|
autoOpenedRef.current = deeplinkUri;
|
|
5163
5184
|
triggerDeeplink(deeplinkUri);
|
|
5164
|
-
}, [loading, deeplinkUri]);
|
|
5185
|
+
}, [useDeeplink, loading, deeplinkUri]);
|
|
5165
5186
|
const handleOpen = react.useCallback(() => {
|
|
5166
5187
|
const opened = window.open(deeplinkUri, "_blank");
|
|
5167
5188
|
if (!opened && window === window.parent) {
|
|
5168
5189
|
window.location.href = deeplinkUri;
|
|
5169
5190
|
}
|
|
5170
5191
|
}, [deeplinkUri]);
|
|
5192
|
+
if (!useDeeplink) {
|
|
5193
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5194
|
+
ScreenLayout,
|
|
5195
|
+
{
|
|
5196
|
+
footer: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: footerContentStyle, children: [
|
|
5197
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(InfoBanner, { children: error }),
|
|
5198
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
5199
|
+
] }),
|
|
5200
|
+
children: [
|
|
5201
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onLogout }),
|
|
5202
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle8, children: [
|
|
5203
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: logoCircleStyle(tokens.bgInput), children: logoSrc ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logoSrc, alt: displayName, style: logoStyle2 }) : /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 32 }) }),
|
|
5204
|
+
/* @__PURE__ */ jsxRuntime.jsxs("h2", { style: headingStyle10(tokens.text), children: [
|
|
5205
|
+
"Setting up ",
|
|
5206
|
+
displayName,
|
|
5207
|
+
"..."
|
|
5208
|
+
] }),
|
|
5209
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle7(tokens.textSecondary), children: "Approve the connection in your wallet extension." }),
|
|
5210
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: waitingBadgeStyle(tokens), children: [
|
|
5211
|
+
/* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 14 }),
|
|
5212
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Waiting for authorization..." })
|
|
5213
|
+
] }),
|
|
5214
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: waitHintStyle2(tokens.textMuted), children: "Usually takes a few seconds" })
|
|
5215
|
+
] })
|
|
5216
|
+
]
|
|
5217
|
+
}
|
|
5218
|
+
);
|
|
5219
|
+
}
|
|
5171
5220
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5172
5221
|
ScreenLayout,
|
|
5173
5222
|
{
|
|
@@ -5182,7 +5231,7 @@ function OpenWalletScreen({
|
|
|
5182
5231
|
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
5183
5232
|
] }),
|
|
5184
5233
|
children: [
|
|
5185
|
-
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack,
|
|
5234
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack, onLogout }),
|
|
5186
5235
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle8, children: [
|
|
5187
5236
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: logoCircleStyle(tokens.bgInput), children: logoSrc ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logoSrc, alt: displayName, style: logoStyle2 }) : /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 32 }) }),
|
|
5188
5237
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle10(tokens.text), children: loading ? "Connecting..." : `Open ${displayName}` }),
|
|
@@ -5257,6 +5306,11 @@ var hintStyle = (color) => ({
|
|
|
5257
5306
|
color,
|
|
5258
5307
|
margin: "8px 0 0"
|
|
5259
5308
|
});
|
|
5309
|
+
var waitHintStyle2 = (color) => ({
|
|
5310
|
+
fontSize: "0.82rem",
|
|
5311
|
+
color,
|
|
5312
|
+
margin: "16px 0 0"
|
|
5313
|
+
});
|
|
5260
5314
|
function ConfirmSignScreen({
|
|
5261
5315
|
walletName,
|
|
5262
5316
|
signing,
|
|
@@ -5276,7 +5330,7 @@ function ConfirmSignScreen({
|
|
|
5276
5330
|
!error && /* @__PURE__ */ jsxRuntime.jsx("p", { style: hintStyle2(tokens.textMuted), children: "You may be prompted for biometric verification" })
|
|
5277
5331
|
] }),
|
|
5278
5332
|
children: [
|
|
5279
|
-
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, {
|
|
5333
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onLogout }),
|
|
5280
5334
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle9, children: [
|
|
5281
5335
|
logoSrc ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logoSrc, alt: displayName, style: logoStyle3 }) : /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 48 }),
|
|
5282
5336
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle11(tokens.text), children: "Wallet authorized" }),
|
|
@@ -5355,6 +5409,7 @@ function TokenPickerScreen({
|
|
|
5355
5409
|
onSelectAuthorized,
|
|
5356
5410
|
onAuthorizeToken,
|
|
5357
5411
|
onBack,
|
|
5412
|
+
onLogout,
|
|
5358
5413
|
depositAmount
|
|
5359
5414
|
}) {
|
|
5360
5415
|
const { tokens: t } = useSwypeConfig();
|
|
@@ -5383,8 +5438,8 @@ function TokenPickerScreen({
|
|
|
5383
5438
|
}
|
|
5384
5439
|
};
|
|
5385
5440
|
return /* @__PURE__ */ jsxRuntime.jsxs(ScreenLayout, { footer: /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {}), children: [
|
|
5386
|
-
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack }),
|
|
5387
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style:
|
|
5441
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack, onLogout }),
|
|
5442
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: mascotWrapStyle, children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: SWYPE_MASCOT, alt: "Swype", style: mascotImgStyle }) }),
|
|
5388
5443
|
depositAmount != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: depositCardStyle2(t), children: [
|
|
5389
5444
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: depositLabelStyle2(t.textMuted), children: "Depositing" }),
|
|
5390
5445
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: depositAmountRowStyle, children: [
|
|
@@ -5437,7 +5492,7 @@ function TokenPickerScreen({
|
|
|
5437
5492
|
}) })
|
|
5438
5493
|
] });
|
|
5439
5494
|
}
|
|
5440
|
-
var
|
|
5495
|
+
var mascotWrapStyle = {
|
|
5441
5496
|
display: "flex",
|
|
5442
5497
|
justifyContent: "center",
|
|
5443
5498
|
marginBottom: 16
|
|
@@ -5688,6 +5743,7 @@ function StepRendererContent({
|
|
|
5688
5743
|
{
|
|
5689
5744
|
onCreatePasskey: handlers.onRegisterPasskey,
|
|
5690
5745
|
onBack: handlers.onLogout,
|
|
5746
|
+
onLogout: handlers.onLogout,
|
|
5691
5747
|
creating: state.registeringPasskey,
|
|
5692
5748
|
error: state.error,
|
|
5693
5749
|
popupFallback: state.passkeyPopupNeeded,
|
|
@@ -5701,6 +5757,7 @@ function StepRendererContent({
|
|
|
5701
5757
|
{
|
|
5702
5758
|
onCreatePasskey: handlers.onRegisterPasskey,
|
|
5703
5759
|
onBack: handlers.onLogout,
|
|
5760
|
+
onLogout: handlers.onLogout,
|
|
5704
5761
|
creating: state.verifyingPasskeyPopup,
|
|
5705
5762
|
error: state.error,
|
|
5706
5763
|
popupFallback: true,
|
|
@@ -5721,21 +5778,26 @@ function StepRendererContent({
|
|
|
5721
5778
|
onPrepareProvider: handlers.onPrepareProvider,
|
|
5722
5779
|
onSelectProvider: handlers.onSelectProvider,
|
|
5723
5780
|
onContinueConnection: handlers.onContinueConnection,
|
|
5724
|
-
onBack: () => handlers.onNavigate(state.activeCredentialId ? "deposit" : "create-passkey")
|
|
5781
|
+
onBack: () => handlers.onNavigate(state.activeCredentialId ? "deposit" : "create-passkey"),
|
|
5782
|
+
onLogout: handlers.onLogout
|
|
5725
5783
|
}
|
|
5726
5784
|
);
|
|
5727
5785
|
}
|
|
5728
5786
|
if (step === "open-wallet") {
|
|
5729
5787
|
const providerName = state.providers.find((p) => p.id === state.selectedProviderId)?.name ?? null;
|
|
5788
|
+
const useDeeplink = !shouldUseWalletConnector({
|
|
5789
|
+
userAgent: typeof navigator === "undefined" ? void 0 : navigator.userAgent
|
|
5790
|
+
});
|
|
5730
5791
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5731
5792
|
OpenWalletScreen,
|
|
5732
5793
|
{
|
|
5733
5794
|
walletName: providerName,
|
|
5734
5795
|
deeplinkUri: state.deeplinkUri ?? "",
|
|
5735
|
-
loading: state.creatingTransfer || !state.deeplinkUri,
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5796
|
+
loading: useDeeplink ? state.creatingTransfer || !state.deeplinkUri : state.creatingTransfer,
|
|
5797
|
+
useDeeplink,
|
|
5798
|
+
error: state.error || (useDeeplink ? pollingError : authExecutorError),
|
|
5799
|
+
onRetryStatus: useDeeplink ? handlers.onRetryMobileStatus : void 0,
|
|
5800
|
+
onBack: useDeeplink ? () => handlers.onNavigate("wallet-picker") : void 0,
|
|
5739
5801
|
onLogout: handlers.onLogout
|
|
5740
5802
|
}
|
|
5741
5803
|
);
|
|
@@ -5803,7 +5865,7 @@ function StepRendererContent({
|
|
|
5803
5865
|
sourceAddress,
|
|
5804
5866
|
sourceVerified,
|
|
5805
5867
|
availableBalance: selectedSource ? selectedSource.balance.available.amount : selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
|
|
5806
|
-
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ??
|
|
5868
|
+
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? null,
|
|
5807
5869
|
tokenCount,
|
|
5808
5870
|
initialAmount: parsedAmt,
|
|
5809
5871
|
processing: state.creatingTransfer,
|
|
@@ -5836,6 +5898,7 @@ function StepRendererContent({
|
|
|
5836
5898
|
onSelectAuthorized: handlers.onSelectAuthorizedToken,
|
|
5837
5899
|
onAuthorizeToken: handlers.onAuthorizeToken,
|
|
5838
5900
|
onBack: () => handlers.onNavigate(state.previousStep === "setup" ? "setup" : "deposit"),
|
|
5901
|
+
onLogout: handlers.onLogout,
|
|
5839
5902
|
depositAmount: depositAmount ?? void 0
|
|
5840
5903
|
}
|
|
5841
5904
|
);
|
|
@@ -5883,7 +5946,8 @@ function StepRendererContent({
|
|
|
5883
5946
|
merchantName,
|
|
5884
5947
|
sourceName,
|
|
5885
5948
|
remainingLimit: succeeded ? (() => {
|
|
5886
|
-
const limit = selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ??
|
|
5949
|
+
const limit = selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? null;
|
|
5950
|
+
if (limit == null) return null;
|
|
5887
5951
|
return limit > displayAmount ? limit - displayAmount : 0;
|
|
5888
5952
|
})() : void 0,
|
|
5889
5953
|
onDone: onDismiss ?? handlers.onNewPayment,
|
|
@@ -5901,7 +5965,7 @@ function StepRendererContent({
|
|
|
5901
5965
|
sourceAddress,
|
|
5902
5966
|
sourceVerified,
|
|
5903
5967
|
availableBalance: 0,
|
|
5904
|
-
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ??
|
|
5968
|
+
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? null,
|
|
5905
5969
|
tokenCount,
|
|
5906
5970
|
initialAmount: depositAmount ?? 5,
|
|
5907
5971
|
processing: false,
|
|
@@ -6692,7 +6756,7 @@ function useProviderHandlers(deps) {
|
|
|
6692
6756
|
});
|
|
6693
6757
|
if (!isMobile) {
|
|
6694
6758
|
dispatch({ type: "PAY_STARTED", isSetupRedirect: false });
|
|
6695
|
-
dispatch({ type: "NAVIGATE", step: "
|
|
6759
|
+
dispatch({ type: "NAVIGATE", step: "open-wallet" });
|
|
6696
6760
|
}
|
|
6697
6761
|
try {
|
|
6698
6762
|
let accountId;
|
|
@@ -6847,7 +6911,7 @@ function useProviderHandlers(deps) {
|
|
|
6847
6911
|
dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: session.uri });
|
|
6848
6912
|
triggerDeeplink(session.uri);
|
|
6849
6913
|
} else {
|
|
6850
|
-
dispatch({ type: "NAVIGATE", step: "
|
|
6914
|
+
dispatch({ type: "NAVIGATE", step: "open-wallet" });
|
|
6851
6915
|
await authExecutor.executeSessionById(session.id);
|
|
6852
6916
|
await reloadAccounts();
|
|
6853
6917
|
dispatch({ type: "NAVIGATE", step: "deposit" });
|
|
@@ -6940,7 +7004,7 @@ function useProviderHandlers(deps) {
|
|
|
6940
7004
|
dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: session.uri });
|
|
6941
7005
|
triggerDeeplink(session.uri);
|
|
6942
7006
|
} else {
|
|
6943
|
-
dispatch({ type: "NAVIGATE", step: "
|
|
7007
|
+
dispatch({ type: "NAVIGATE", step: "open-wallet" });
|
|
6944
7008
|
await authExecutor.executeSessionById(session.id);
|
|
6945
7009
|
await reloadAccounts();
|
|
6946
7010
|
dispatch({ type: "SELECT_TOKEN", walletId: _walletId, tokenSymbol });
|
|
@@ -7015,7 +7079,7 @@ function useOneTapSetupHandlers(deps) {
|
|
|
7015
7079
|
}
|
|
7016
7080
|
oneTapLimitSavedDuringSetupRef.current = true;
|
|
7017
7081
|
authExecutor.resolveSelectSource({ chainName, tokenSymbol });
|
|
7018
|
-
dispatch({ type: "NAVIGATE", step: "
|
|
7082
|
+
dispatch({ type: "NAVIGATE", step: "open-wallet" });
|
|
7019
7083
|
} else if (authExecutor.pendingOneTapSetup) {
|
|
7020
7084
|
authExecutor.resolveOneTapSetup();
|
|
7021
7085
|
} else {
|
|
@@ -7653,7 +7717,7 @@ function usePaymentEffects(deps) {
|
|
|
7653
7717
|
useWalletConnector: useWalletConnectorProp,
|
|
7654
7718
|
userAgent: typeof navigator === "undefined" ? void 0 : navigator.userAgent
|
|
7655
7719
|
});
|
|
7656
|
-
if (isDesktop && state.step === "setup-status") {
|
|
7720
|
+
if (isDesktop && (state.step === "setup-status" || state.step === "open-wallet")) {
|
|
7657
7721
|
preSelectSourceStepRef.current = state.step;
|
|
7658
7722
|
dispatch({ type: "NAVIGATE", step: "setup" });
|
|
7659
7723
|
return;
|
|
@@ -7668,7 +7732,7 @@ function usePaymentEffects(deps) {
|
|
|
7668
7732
|
const pendingOneTapSetupAction = authExecutor.pendingOneTapSetup;
|
|
7669
7733
|
const preOneTapSetupStepRef = react.useRef(null);
|
|
7670
7734
|
react.useEffect(() => {
|
|
7671
|
-
if (pendingOneTapSetupAction && state.step === "setup-status") {
|
|
7735
|
+
if (pendingOneTapSetupAction && (state.step === "setup-status" || state.step === "open-wallet")) {
|
|
7672
7736
|
if (oneTapLimitSavedDuringSetupRef.current) {
|
|
7673
7737
|
oneTapLimitSavedDuringSetupRef.current = false;
|
|
7674
7738
|
authExecutor.resolveOneTapSetup();
|