@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.js
CHANGED
|
@@ -2282,13 +2282,7 @@ function useFlowPhase() {
|
|
|
2282
2282
|
function StepProgress({ phase }) {
|
|
2283
2283
|
const { tokens } = useSwypeConfig();
|
|
2284
2284
|
if (phase === "deposit") {
|
|
2285
|
-
return /* @__PURE__ */
|
|
2286
|
-
/* @__PURE__ */ jsx("span", { style: dotStyle(tokens.textMuted) }),
|
|
2287
|
-
/* @__PURE__ */ jsx("span", { style: labelStyle(tokens.textMuted), children: "Link" }),
|
|
2288
|
-
/* @__PURE__ */ jsx("span", { style: lineStyle(tokens.textMuted) }),
|
|
2289
|
-
/* @__PURE__ */ jsx("span", { style: dotStyle(tokens.accent) }),
|
|
2290
|
-
/* @__PURE__ */ jsx("span", { style: labelStyle(tokens.text), children: "Deposit" })
|
|
2291
|
-
] });
|
|
2285
|
+
return /* @__PURE__ */ jsx("img", { src: SWYPE_MASCOT, alt: "Swype", style: mascotStyle });
|
|
2292
2286
|
}
|
|
2293
2287
|
return /* @__PURE__ */ jsxs("div", { style: containerStyle3, children: [
|
|
2294
2288
|
/* @__PURE__ */ jsx("span", { style: dotStyle(tokens.accent) }),
|
|
@@ -2323,16 +2317,102 @@ var labelStyle = (color) => ({
|
|
|
2323
2317
|
color,
|
|
2324
2318
|
whiteSpace: "nowrap"
|
|
2325
2319
|
});
|
|
2326
|
-
|
|
2320
|
+
var mascotStyle = {
|
|
2321
|
+
width: 28,
|
|
2322
|
+
height: 28
|
|
2323
|
+
};
|
|
2324
|
+
function SettingsMenu({ onLogout }) {
|
|
2325
|
+
const { tokens } = useSwypeConfig();
|
|
2326
|
+
const [open, setOpen] = useState(false);
|
|
2327
|
+
const menuRef = useRef(null);
|
|
2328
|
+
const toggle = useCallback(() => setOpen((prev) => !prev), []);
|
|
2329
|
+
useEffect(() => {
|
|
2330
|
+
if (!open) return;
|
|
2331
|
+
const handleClickOutside = (e) => {
|
|
2332
|
+
if (menuRef.current && !menuRef.current.contains(e.target)) {
|
|
2333
|
+
setOpen(false);
|
|
2334
|
+
}
|
|
2335
|
+
};
|
|
2336
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2337
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2338
|
+
}, [open]);
|
|
2339
|
+
return /* @__PURE__ */ jsxs("div", { ref: menuRef, style: containerStyle4, children: [
|
|
2340
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: toggle, style: triggerStyle(tokens.text), "aria-label": "Settings", children: /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: [
|
|
2341
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "5", r: "2", fill: "currentColor" }),
|
|
2342
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "2", fill: "currentColor" }),
|
|
2343
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "19", r: "2", fill: "currentColor" })
|
|
2344
|
+
] }) }),
|
|
2345
|
+
open && /* @__PURE__ */ jsx("div", { style: dropdownStyle(tokens), children: /* @__PURE__ */ jsxs(
|
|
2346
|
+
"button",
|
|
2347
|
+
{
|
|
2348
|
+
type: "button",
|
|
2349
|
+
onClick: () => {
|
|
2350
|
+
setOpen(false);
|
|
2351
|
+
onLogout();
|
|
2352
|
+
},
|
|
2353
|
+
style: menuItemStyle(tokens),
|
|
2354
|
+
children: [
|
|
2355
|
+
/* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { marginRight: 8, flexShrink: 0 }, children: [
|
|
2356
|
+
/* @__PURE__ */ jsx("path", { d: "M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4", stroke: tokens.error, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
2357
|
+
/* @__PURE__ */ jsx("polyline", { points: "16 17 21 12 16 7", stroke: tokens.error, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
2358
|
+
/* @__PURE__ */ jsx("line", { x1: "21", y1: "12", x2: "9", y2: "12", stroke: tokens.error, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
2359
|
+
] }),
|
|
2360
|
+
"Log out"
|
|
2361
|
+
]
|
|
2362
|
+
}
|
|
2363
|
+
) })
|
|
2364
|
+
] });
|
|
2365
|
+
}
|
|
2366
|
+
var containerStyle4 = {
|
|
2367
|
+
position: "relative"
|
|
2368
|
+
};
|
|
2369
|
+
var triggerStyle = (color) => ({
|
|
2370
|
+
background: "transparent",
|
|
2371
|
+
border: "none",
|
|
2372
|
+
cursor: "pointer",
|
|
2373
|
+
padding: 4,
|
|
2374
|
+
color,
|
|
2375
|
+
display: "flex",
|
|
2376
|
+
alignItems: "center",
|
|
2377
|
+
justifyContent: "center"
|
|
2378
|
+
});
|
|
2379
|
+
var dropdownStyle = (tokens) => ({
|
|
2380
|
+
position: "absolute",
|
|
2381
|
+
right: 0,
|
|
2382
|
+
top: "100%",
|
|
2383
|
+
marginTop: 4,
|
|
2384
|
+
minWidth: 140,
|
|
2385
|
+
background: tokens.bgCard,
|
|
2386
|
+
border: `1px solid ${tokens.border}`,
|
|
2387
|
+
borderRadius: 12,
|
|
2388
|
+
boxShadow: tokens.shadow,
|
|
2389
|
+
zIndex: 100,
|
|
2390
|
+
overflow: "hidden"
|
|
2391
|
+
});
|
|
2392
|
+
var menuItemStyle = (tokens) => ({
|
|
2393
|
+
width: "100%",
|
|
2394
|
+
display: "flex",
|
|
2395
|
+
alignItems: "center",
|
|
2396
|
+
padding: "12px 16px",
|
|
2397
|
+
background: "transparent",
|
|
2398
|
+
border: "none",
|
|
2399
|
+
cursor: "pointer",
|
|
2400
|
+
fontFamily: "inherit",
|
|
2401
|
+
fontSize: "0.85rem",
|
|
2402
|
+
fontWeight: 500,
|
|
2403
|
+
color: tokens.error
|
|
2404
|
+
});
|
|
2405
|
+
function ScreenHeader({ title, right, onBack, badge, onLogout }) {
|
|
2327
2406
|
const { tokens } = useSwypeConfig();
|
|
2328
2407
|
const flowPhase = useFlowPhase();
|
|
2408
|
+
const rightContent = onLogout ? /* @__PURE__ */ jsx(SettingsMenu, { onLogout }) : right;
|
|
2329
2409
|
return /* @__PURE__ */ jsxs("div", { style: headerStyle, children: [
|
|
2330
2410
|
/* @__PURE__ */ jsx("div", { style: leftSlotStyle, children: onBack && /* @__PURE__ */ jsx("button", { type: "button", onClick: onBack, style: backButtonStyle(tokens.text), "aria-label": "Go back", children: /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M15 18l-6-6 6-6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }) }),
|
|
2331
2411
|
/* @__PURE__ */ jsx("div", { style: centerSlotStyle, children: flowPhase ? /* @__PURE__ */ jsx(StepProgress, { phase: flowPhase }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2332
2412
|
title && /* @__PURE__ */ jsx("span", { style: titleStyle(tokens.text), children: title }),
|
|
2333
2413
|
badge && /* @__PURE__ */ jsx("span", { style: badgeStyle(tokens.textMuted), children: badge })
|
|
2334
2414
|
] }) }),
|
|
2335
|
-
/* @__PURE__ */ jsx("div", { style: rightSlotStyle, children:
|
|
2415
|
+
/* @__PURE__ */ jsx("div", { style: rightSlotStyle, children: rightContent })
|
|
2336
2416
|
] });
|
|
2337
2417
|
}
|
|
2338
2418
|
var headerStyle = {
|
|
@@ -2373,7 +2453,7 @@ var badgeStyle = (color) => ({
|
|
|
2373
2453
|
});
|
|
2374
2454
|
function PoweredByFooter() {
|
|
2375
2455
|
const { tokens } = useSwypeConfig();
|
|
2376
|
-
return /* @__PURE__ */ jsxs("div", { style:
|
|
2456
|
+
return /* @__PURE__ */ jsxs("div", { style: containerStyle5(tokens.textMuted), children: [
|
|
2377
2457
|
/* @__PURE__ */ jsxs("div", { style: rowStyle, children: [
|
|
2378
2458
|
/* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(
|
|
2379
2459
|
"path",
|
|
@@ -2387,7 +2467,7 @@ function PoweredByFooter() {
|
|
|
2387
2467
|
/* @__PURE__ */ jsx("span", { style: pillStyle(tokens.textMuted, tokens.border), children: "Beta Version" })
|
|
2388
2468
|
] });
|
|
2389
2469
|
}
|
|
2390
|
-
var
|
|
2470
|
+
var containerStyle5 = (color) => ({
|
|
2391
2471
|
display: "flex",
|
|
2392
2472
|
flexDirection: "column",
|
|
2393
2473
|
alignItems: "center",
|
|
@@ -2486,12 +2566,12 @@ var defaultIcon = /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBo
|
|
|
2486
2566
|
) });
|
|
2487
2567
|
function InfoBanner({ children, icon }) {
|
|
2488
2568
|
const { tokens } = useSwypeConfig();
|
|
2489
|
-
return /* @__PURE__ */ jsxs("div", { style:
|
|
2569
|
+
return /* @__PURE__ */ jsxs("div", { style: containerStyle6(tokens.accent), children: [
|
|
2490
2570
|
/* @__PURE__ */ jsx("span", { style: iconStyle, children: icon ?? defaultIcon }),
|
|
2491
2571
|
/* @__PURE__ */ jsx("span", { style: textStyle, children })
|
|
2492
2572
|
] });
|
|
2493
2573
|
}
|
|
2494
|
-
var
|
|
2574
|
+
var containerStyle6 = (accent) => ({
|
|
2495
2575
|
display: "flex",
|
|
2496
2576
|
alignItems: "flex-start",
|
|
2497
2577
|
gap: 10,
|
|
@@ -2509,7 +2589,7 @@ var iconStyle = {
|
|
|
2509
2589
|
};
|
|
2510
2590
|
var textStyle = { flex: 1 };
|
|
2511
2591
|
function WarningBanner({ title, children }) {
|
|
2512
|
-
return /* @__PURE__ */ jsxs("div", { style:
|
|
2592
|
+
return /* @__PURE__ */ jsxs("div", { style: containerStyle7, children: [
|
|
2513
2593
|
/* @__PURE__ */ jsxs("div", { style: headerStyle2, children: [
|
|
2514
2594
|
/* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", style: iconStyle2, children: /* @__PURE__ */ jsx("path", { d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z", fill: "#F57C00" }) }),
|
|
2515
2595
|
/* @__PURE__ */ jsx("strong", { children: title })
|
|
@@ -2517,7 +2597,7 @@ function WarningBanner({ title, children }) {
|
|
|
2517
2597
|
/* @__PURE__ */ jsx("div", { style: bodyStyle2, children })
|
|
2518
2598
|
] });
|
|
2519
2599
|
}
|
|
2520
|
-
var
|
|
2600
|
+
var containerStyle7 = {
|
|
2521
2601
|
padding: "14px 16px",
|
|
2522
2602
|
background: "#FFF8E1",
|
|
2523
2603
|
border: "1px solid #FFE082",
|
|
@@ -2596,7 +2676,7 @@ function OtpInput({ value, onChange, length = 6, disabled }) {
|
|
|
2596
2676
|
onChange(pasted);
|
|
2597
2677
|
focusInput(Math.min(pasted.length, length - 1));
|
|
2598
2678
|
}, [onChange, length, focusInput]);
|
|
2599
|
-
return /* @__PURE__ */ jsx("div", { style:
|
|
2679
|
+
return /* @__PURE__ */ jsx("div", { style: containerStyle8, children: digits.map((digit, i) => /* @__PURE__ */ jsx(
|
|
2600
2680
|
"input",
|
|
2601
2681
|
{
|
|
2602
2682
|
ref: (el) => {
|
|
@@ -2617,7 +2697,7 @@ function OtpInput({ value, onChange, length = 6, disabled }) {
|
|
|
2617
2697
|
i
|
|
2618
2698
|
)) });
|
|
2619
2699
|
}
|
|
2620
|
-
var
|
|
2700
|
+
var containerStyle8 = {
|
|
2621
2701
|
display: "flex",
|
|
2622
2702
|
gap: 8,
|
|
2623
2703
|
justifyContent: "center",
|
|
@@ -2726,7 +2806,7 @@ function SourceCard({
|
|
|
2726
2806
|
}
|
|
2727
2807
|
)
|
|
2728
2808
|
] }),
|
|
2729
|
-
open && hasDropdown && /* @__PURE__ */ jsxs("div", { style:
|
|
2809
|
+
open && hasDropdown && /* @__PURE__ */ jsxs("div", { style: dropdownStyle2(tokens), children: [
|
|
2730
2810
|
accounts.map((account) => {
|
|
2731
2811
|
const preferredWallet = getPreferredDepositWallet(account, depositAmount ?? 0);
|
|
2732
2812
|
const active = hasActiveDepositWallet(account);
|
|
@@ -2847,7 +2927,7 @@ var changeStyle = (color) => ({
|
|
|
2847
2927
|
fontFamily: "inherit",
|
|
2848
2928
|
padding: 0
|
|
2849
2929
|
});
|
|
2850
|
-
var
|
|
2930
|
+
var dropdownStyle2 = (tokens) => ({
|
|
2851
2931
|
position: "absolute",
|
|
2852
2932
|
top: "100%",
|
|
2853
2933
|
left: 0,
|
|
@@ -3000,11 +3080,11 @@ function StepList({ steps }) {
|
|
|
3000
3080
|
/* @__PURE__ */ jsx(
|
|
3001
3081
|
"div",
|
|
3002
3082
|
{
|
|
3003
|
-
style: badgeStyle2(
|
|
3004
|
-
isComplete ? tokens.accent :
|
|
3005
|
-
isComplete
|
|
3083
|
+
style: isActive ? activeBadgeContainerStyle : badgeStyle2(
|
|
3084
|
+
isComplete ? tokens.accent : tokens.border,
|
|
3085
|
+
isComplete
|
|
3006
3086
|
),
|
|
3007
|
-
children: isComplete ? /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: "#fff" }) }) : /* @__PURE__ */ jsx("span", { style:
|
|
3087
|
+
children: isComplete ? /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: "#fff" }) }) : isActive ? /* @__PURE__ */ jsx("span", { style: activeDotStyle(tokens.accent) }) : /* @__PURE__ */ jsx("span", { style: badgeNumberStyle, children: i + 1 })
|
|
3008
3088
|
}
|
|
3009
3089
|
),
|
|
3010
3090
|
/* @__PURE__ */ jsxs("div", { style: labelContainerStyle, children: [
|
|
@@ -3035,11 +3115,26 @@ var badgeStyle2 = (color, filled) => ({
|
|
|
3035
3115
|
justifyContent: "center",
|
|
3036
3116
|
flexShrink: 0
|
|
3037
3117
|
});
|
|
3038
|
-
var
|
|
3118
|
+
var activeBadgeContainerStyle = {
|
|
3119
|
+
width: 28,
|
|
3120
|
+
height: 28,
|
|
3121
|
+
display: "flex",
|
|
3122
|
+
alignItems: "center",
|
|
3123
|
+
justifyContent: "center",
|
|
3124
|
+
flexShrink: 0
|
|
3125
|
+
};
|
|
3126
|
+
var activeDotStyle = (color) => ({
|
|
3127
|
+
width: 8,
|
|
3128
|
+
height: 8,
|
|
3129
|
+
borderRadius: "50%",
|
|
3130
|
+
backgroundColor: color,
|
|
3131
|
+
display: "block"
|
|
3132
|
+
});
|
|
3133
|
+
var badgeNumberStyle = {
|
|
3039
3134
|
fontSize: "0.75rem",
|
|
3040
3135
|
fontWeight: 600,
|
|
3041
|
-
color:
|
|
3042
|
-
}
|
|
3136
|
+
color: "inherit"
|
|
3137
|
+
};
|
|
3043
3138
|
var labelContainerStyle = {
|
|
3044
3139
|
display: "flex",
|
|
3045
3140
|
flexDirection: "column"
|
|
@@ -3053,87 +3148,6 @@ var detailStyle = (color) => ({
|
|
|
3053
3148
|
fontSize: "0.75rem",
|
|
3054
3149
|
color
|
|
3055
3150
|
});
|
|
3056
|
-
function SettingsMenu({ onLogout }) {
|
|
3057
|
-
const { tokens } = useSwypeConfig();
|
|
3058
|
-
const [open, setOpen] = useState(false);
|
|
3059
|
-
const menuRef = useRef(null);
|
|
3060
|
-
const toggle = useCallback(() => setOpen((prev) => !prev), []);
|
|
3061
|
-
useEffect(() => {
|
|
3062
|
-
if (!open) return;
|
|
3063
|
-
const handleClickOutside = (e) => {
|
|
3064
|
-
if (menuRef.current && !menuRef.current.contains(e.target)) {
|
|
3065
|
-
setOpen(false);
|
|
3066
|
-
}
|
|
3067
|
-
};
|
|
3068
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
3069
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
3070
|
-
}, [open]);
|
|
3071
|
-
return /* @__PURE__ */ jsxs("div", { ref: menuRef, style: containerStyle8, children: [
|
|
3072
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: toggle, style: triggerStyle(tokens.text), "aria-label": "Settings", children: /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: [
|
|
3073
|
-
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "5", r: "2", fill: "currentColor" }),
|
|
3074
|
-
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "2", fill: "currentColor" }),
|
|
3075
|
-
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "19", r: "2", fill: "currentColor" })
|
|
3076
|
-
] }) }),
|
|
3077
|
-
open && /* @__PURE__ */ jsx("div", { style: dropdownStyle2(tokens), children: /* @__PURE__ */ jsxs(
|
|
3078
|
-
"button",
|
|
3079
|
-
{
|
|
3080
|
-
type: "button",
|
|
3081
|
-
onClick: () => {
|
|
3082
|
-
setOpen(false);
|
|
3083
|
-
onLogout();
|
|
3084
|
-
},
|
|
3085
|
-
style: menuItemStyle(tokens),
|
|
3086
|
-
children: [
|
|
3087
|
-
/* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { marginRight: 8, flexShrink: 0 }, children: [
|
|
3088
|
-
/* @__PURE__ */ jsx("path", { d: "M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4", stroke: tokens.error, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
3089
|
-
/* @__PURE__ */ jsx("polyline", { points: "16 17 21 12 16 7", stroke: tokens.error, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
3090
|
-
/* @__PURE__ */ jsx("line", { x1: "21", y1: "12", x2: "9", y2: "12", stroke: tokens.error, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
3091
|
-
] }),
|
|
3092
|
-
"Log out"
|
|
3093
|
-
]
|
|
3094
|
-
}
|
|
3095
|
-
) })
|
|
3096
|
-
] });
|
|
3097
|
-
}
|
|
3098
|
-
var containerStyle8 = {
|
|
3099
|
-
position: "relative"
|
|
3100
|
-
};
|
|
3101
|
-
var triggerStyle = (color) => ({
|
|
3102
|
-
background: "transparent",
|
|
3103
|
-
border: "none",
|
|
3104
|
-
cursor: "pointer",
|
|
3105
|
-
padding: 4,
|
|
3106
|
-
color,
|
|
3107
|
-
display: "flex",
|
|
3108
|
-
alignItems: "center",
|
|
3109
|
-
justifyContent: "center"
|
|
3110
|
-
});
|
|
3111
|
-
var dropdownStyle2 = (tokens) => ({
|
|
3112
|
-
position: "absolute",
|
|
3113
|
-
right: 0,
|
|
3114
|
-
top: "100%",
|
|
3115
|
-
marginTop: 4,
|
|
3116
|
-
minWidth: 140,
|
|
3117
|
-
background: tokens.bgCard,
|
|
3118
|
-
border: `1px solid ${tokens.border}`,
|
|
3119
|
-
borderRadius: 12,
|
|
3120
|
-
boxShadow: tokens.shadow,
|
|
3121
|
-
zIndex: 100,
|
|
3122
|
-
overflow: "hidden"
|
|
3123
|
-
});
|
|
3124
|
-
var menuItemStyle = (tokens) => ({
|
|
3125
|
-
width: "100%",
|
|
3126
|
-
display: "flex",
|
|
3127
|
-
alignItems: "center",
|
|
3128
|
-
padding: "12px 16px",
|
|
3129
|
-
background: "transparent",
|
|
3130
|
-
border: "none",
|
|
3131
|
-
cursor: "pointer",
|
|
3132
|
-
fontFamily: "inherit",
|
|
3133
|
-
fontSize: "0.85rem",
|
|
3134
|
-
fontWeight: 500,
|
|
3135
|
-
color: tokens.error
|
|
3136
|
-
});
|
|
3137
3151
|
function LoginScreen({
|
|
3138
3152
|
authInput,
|
|
3139
3153
|
onAuthInputChange,
|
|
@@ -3425,6 +3439,7 @@ var resendStyle = (color, disabled) => ({
|
|
|
3425
3439
|
function PasskeyScreen({
|
|
3426
3440
|
onCreatePasskey,
|
|
3427
3441
|
onBack,
|
|
3442
|
+
onLogout,
|
|
3428
3443
|
creating,
|
|
3429
3444
|
error,
|
|
3430
3445
|
popupFallback = false,
|
|
@@ -3441,7 +3456,7 @@ function PasskeyScreen({
|
|
|
3441
3456
|
/* @__PURE__ */ jsx(PoweredByFooter, {})
|
|
3442
3457
|
] }),
|
|
3443
3458
|
children: [
|
|
3444
|
-
/* @__PURE__ */ jsx(ScreenHeader, { onBack }),
|
|
3459
|
+
/* @__PURE__ */ jsx(ScreenHeader, { onBack, onLogout }),
|
|
3445
3460
|
/* @__PURE__ */ jsxs("div", { style: contentStyle4, children: [
|
|
3446
3461
|
/* @__PURE__ */ jsx("h2", { style: headingStyle3(tokens.text), children: "Secure your account with a passkey" }),
|
|
3447
3462
|
error && /* @__PURE__ */ jsx("div", { style: errorBannerStyle2(tokens), children: error })
|
|
@@ -3531,7 +3546,8 @@ function WalletPickerScreen({
|
|
|
3531
3546
|
onPrepareProvider,
|
|
3532
3547
|
onSelectProvider,
|
|
3533
3548
|
onContinueConnection,
|
|
3534
|
-
onBack
|
|
3549
|
+
onBack,
|
|
3550
|
+
onLogout
|
|
3535
3551
|
}) {
|
|
3536
3552
|
const { tokens } = useSwypeConfig();
|
|
3537
3553
|
const [hoveredId, setHoveredId] = useState(null);
|
|
@@ -3568,7 +3584,7 @@ function WalletPickerScreen({
|
|
|
3568
3584
|
const selectedProvider = displayProviders.find((p) => p.id === selectedProviderId);
|
|
3569
3585
|
if (loading) {
|
|
3570
3586
|
return /* @__PURE__ */ jsxs(ScreenLayout, { children: [
|
|
3571
|
-
/* @__PURE__ */ jsx(ScreenHeader, { title: "Set up Swype", onBack }),
|
|
3587
|
+
/* @__PURE__ */ jsx(ScreenHeader, { title: "Set up Swype", onBack, onLogout }),
|
|
3572
3588
|
/* @__PURE__ */ jsx("div", { style: { textAlign: "center", padding: "48px 0", flex: 1, display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx(Spinner, { label: "Connecting..." }) })
|
|
3573
3589
|
] });
|
|
3574
3590
|
}
|
|
@@ -3598,7 +3614,7 @@ function WalletPickerScreen({
|
|
|
3598
3614
|
/* @__PURE__ */ jsx(PoweredByFooter, {})
|
|
3599
3615
|
] }),
|
|
3600
3616
|
children: [
|
|
3601
|
-
/* @__PURE__ */ jsx(ScreenHeader, { title: "Set up Swype", onBack }),
|
|
3617
|
+
/* @__PURE__ */ jsx(ScreenHeader, { title: "Set up Swype", onBack, onLogout }),
|
|
3602
3618
|
hasPending && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3603
3619
|
/* @__PURE__ */ jsx("h2", { style: headingStyle4(tokens.text), children: "Continue where you left off" }),
|
|
3604
3620
|
/* @__PURE__ */ jsx("p", { style: subtitleStyle2(tokens.textSecondary), children: "You have a wallet that still needs setup" }),
|
|
@@ -3866,6 +3882,7 @@ function SetupScreen({
|
|
|
3866
3882
|
availableBalance,
|
|
3867
3883
|
onSetupOneTap,
|
|
3868
3884
|
onBack,
|
|
3885
|
+
onLogout,
|
|
3869
3886
|
onAdvanced,
|
|
3870
3887
|
loading,
|
|
3871
3888
|
error
|
|
@@ -3874,12 +3891,14 @@ function SetupScreen({
|
|
|
3874
3891
|
const effectiveMax = DEFAULT_MAX;
|
|
3875
3892
|
const effectiveMin = Math.min(ABSOLUTE_MIN, effectiveMax);
|
|
3876
3893
|
const [limit, setLimit] = useState(() => Math.min(availableBalance, effectiveMax));
|
|
3894
|
+
const [activePreset, setActivePreset] = useState(null);
|
|
3877
3895
|
const [editing, setEditing] = useState(false);
|
|
3878
3896
|
const [inputValue, setInputValue] = useState("");
|
|
3879
3897
|
const inputRef = useRef(null);
|
|
3880
3898
|
const startEditing = useCallback(() => {
|
|
3881
3899
|
setInputValue(limit.toFixed(2));
|
|
3882
3900
|
setEditing(true);
|
|
3901
|
+
setActivePreset(null);
|
|
3883
3902
|
requestAnimationFrame(() => inputRef.current?.focus());
|
|
3884
3903
|
}, [limit]);
|
|
3885
3904
|
const commitEdit = useCallback(() => {
|
|
@@ -3887,16 +3906,17 @@ function SetupScreen({
|
|
|
3887
3906
|
if (!isNaN(parsed)) {
|
|
3888
3907
|
setLimit(Math.min(effectiveMax, Math.max(effectiveMin, Math.round(parsed * 100) / 100)));
|
|
3889
3908
|
}
|
|
3909
|
+
setActivePreset(null);
|
|
3890
3910
|
setEditing(false);
|
|
3891
3911
|
}, [inputValue, effectiveMax, effectiveMin]);
|
|
3892
3912
|
const selectPreset = (value) => {
|
|
3893
3913
|
setLimit(Math.min(value, effectiveMax));
|
|
3914
|
+
setActivePreset(value);
|
|
3894
3915
|
};
|
|
3895
3916
|
const selectMax = () => {
|
|
3896
3917
|
setLimit(Math.min(availableBalance, effectiveMax));
|
|
3918
|
+
setActivePreset("max");
|
|
3897
3919
|
};
|
|
3898
|
-
const isPresetActive = (value) => Math.abs(limit - value) < 5e-3;
|
|
3899
|
-
const isMaxActive = Math.abs(limit - Math.min(availableBalance, effectiveMax)) < 5e-3 && !PRESETS.some((p) => isPresetActive(p));
|
|
3900
3920
|
return /* @__PURE__ */ jsxs(
|
|
3901
3921
|
ScreenLayout,
|
|
3902
3922
|
{
|
|
@@ -3913,7 +3933,7 @@ function SetupScreen({
|
|
|
3913
3933
|
/* @__PURE__ */ jsx(PoweredByFooter, {})
|
|
3914
3934
|
] }),
|
|
3915
3935
|
children: [
|
|
3916
|
-
/* @__PURE__ */ jsx(ScreenHeader, { onBack }),
|
|
3936
|
+
/* @__PURE__ */ jsx(ScreenHeader, { onBack, onLogout }),
|
|
3917
3937
|
/* @__PURE__ */ jsx("h2", { style: headingStyle5(tokens.text), children: "Set Spending Limit" }),
|
|
3918
3938
|
error && /* @__PURE__ */ jsx("div", { style: errorBannerStyle3(tokens), children: error }),
|
|
3919
3939
|
/* @__PURE__ */ jsxs("div", { style: amountRowStyle, children: [
|
|
@@ -3974,7 +3994,7 @@ function SetupScreen({
|
|
|
3974
3994
|
{
|
|
3975
3995
|
type: "button",
|
|
3976
3996
|
onClick: () => selectPreset(value),
|
|
3977
|
-
style: presetButtonStyle(tokens,
|
|
3997
|
+
style: presetButtonStyle(tokens, activePreset === value),
|
|
3978
3998
|
children: [
|
|
3979
3999
|
"$",
|
|
3980
4000
|
value.toLocaleString()
|
|
@@ -3987,7 +4007,7 @@ function SetupScreen({
|
|
|
3987
4007
|
{
|
|
3988
4008
|
type: "button",
|
|
3989
4009
|
onClick: selectMax,
|
|
3990
|
-
style: presetButtonStyle(tokens,
|
|
4010
|
+
style: presetButtonStyle(tokens, activePreset === "max"),
|
|
3991
4011
|
children: "Max"
|
|
3992
4012
|
}
|
|
3993
4013
|
)
|
|
@@ -4101,7 +4121,7 @@ function SetupStatusScreen({
|
|
|
4101
4121
|
return /* @__PURE__ */ jsxs(ScreenLayout, { footer: /* @__PURE__ */ jsx(PoweredByFooter, {}), children: [
|
|
4102
4122
|
/* @__PURE__ */ jsx(ScreenHeader, { onBack: onContinue }),
|
|
4103
4123
|
/* @__PURE__ */ jsxs("div", { style: contentStyle5, children: [
|
|
4104
|
-
/* @__PURE__ */ jsx("img", { src: SWYPE_MASCOT, alt: "Swype", style:
|
|
4124
|
+
/* @__PURE__ */ jsx("img", { src: SWYPE_MASCOT, alt: "Swype", style: mascotStyle2 }),
|
|
4105
4125
|
/* @__PURE__ */ jsx("h2", { style: headingStyle6(tokens.text), children: "Done!" }),
|
|
4106
4126
|
/* @__PURE__ */ jsx("p", { style: subtitleStyle3(tokens.textSecondary), children: "Return to the app to try one-tap deposits." })
|
|
4107
4127
|
] })
|
|
@@ -4112,7 +4132,7 @@ function SetupStatusScreen({
|
|
|
4112
4132
|
{ label: "Done", status: "pending" }
|
|
4113
4133
|
];
|
|
4114
4134
|
return /* @__PURE__ */ jsxs(ScreenLayout, { children: [
|
|
4115
|
-
/* @__PURE__ */ jsx(ScreenHeader, {
|
|
4135
|
+
/* @__PURE__ */ jsx(ScreenHeader, { onLogout }),
|
|
4116
4136
|
/* @__PURE__ */ jsxs("div", { style: contentStyle5, children: [
|
|
4117
4137
|
/* @__PURE__ */ jsx(Spinner, { size: 48 }),
|
|
4118
4138
|
/* @__PURE__ */ jsx("h2", { style: headingStyle6(tokens.text), children: "Setting up One-Tap..." }),
|
|
@@ -4131,7 +4151,7 @@ var contentStyle5 = {
|
|
|
4131
4151
|
textAlign: "center",
|
|
4132
4152
|
padding: "0 24px 32px"
|
|
4133
4153
|
};
|
|
4134
|
-
var
|
|
4154
|
+
var mascotStyle2 = {
|
|
4135
4155
|
width: 56,
|
|
4136
4156
|
height: 56
|
|
4137
4157
|
};
|
|
@@ -4201,7 +4221,7 @@ function DepositScreen({
|
|
|
4201
4221
|
const { tokens } = useSwypeConfig();
|
|
4202
4222
|
const amount = initialAmount;
|
|
4203
4223
|
const isLowBalance = availableBalance < MIN_DEPOSIT;
|
|
4204
|
-
const exceedsLimit = amount > remainingLimit && !isLowBalance;
|
|
4224
|
+
const exceedsLimit = remainingLimit != null && amount > remainingLimit && !isLowBalance;
|
|
4205
4225
|
const canDeposit = amount >= MIN_DEPOSIT && !exceedsLimit && !isLowBalance && !processing;
|
|
4206
4226
|
const headerTitle = merchantName ? `Deposit to ${merchantName}` : "Deposit";
|
|
4207
4227
|
if (isLowBalance) {
|
|
@@ -4215,7 +4235,7 @@ function DepositScreen({
|
|
|
4215
4235
|
/* @__PURE__ */ jsx(PoweredByFooter, {})
|
|
4216
4236
|
] }),
|
|
4217
4237
|
children: [
|
|
4218
|
-
/* @__PURE__ */ jsx(ScreenHeader, { title: headerTitle, onBack,
|
|
4238
|
+
/* @__PURE__ */ jsx(ScreenHeader, { title: headerTitle, onBack, onLogout }),
|
|
4219
4239
|
/* @__PURE__ */ jsx(
|
|
4220
4240
|
SourceCard,
|
|
4221
4241
|
{
|
|
@@ -4272,7 +4292,7 @@ function DepositScreen({
|
|
|
4272
4292
|
"Your deposit of $",
|
|
4273
4293
|
amount.toFixed(2),
|
|
4274
4294
|
" exceeds your One-Tap limit of $",
|
|
4275
|
-
remainingLimit
|
|
4295
|
+
remainingLimit?.toFixed(2) ?? "0.00",
|
|
4276
4296
|
". Increase your limit to continue."
|
|
4277
4297
|
] })
|
|
4278
4298
|
] }) : /* @__PURE__ */ jsx(PrimaryButton, { onClick: () => onDeposit(amount), disabled: !canDeposit, loading: processing, children: "Confirm" }),
|
|
@@ -4280,7 +4300,20 @@ function DepositScreen({
|
|
|
4280
4300
|
] }),
|
|
4281
4301
|
children: [
|
|
4282
4302
|
/* @__PURE__ */ jsx(ScreenHeader, { onBack }),
|
|
4283
|
-
/* @__PURE__ */ jsx(
|
|
4303
|
+
/* @__PURE__ */ jsx(
|
|
4304
|
+
SourceCard,
|
|
4305
|
+
{
|
|
4306
|
+
name: sourceName,
|
|
4307
|
+
address: sourceAddress,
|
|
4308
|
+
verified: sourceVerified,
|
|
4309
|
+
accounts,
|
|
4310
|
+
selectedAccountId,
|
|
4311
|
+
depositAmount: amount,
|
|
4312
|
+
onSelectAccount,
|
|
4313
|
+
onAuthorizeAccount,
|
|
4314
|
+
onAddProvider
|
|
4315
|
+
}
|
|
4316
|
+
),
|
|
4284
4317
|
/* @__PURE__ */ jsxs("div", { style: depositCardStyle(tokens), children: [
|
|
4285
4318
|
/* @__PURE__ */ jsx("div", { style: depositLabelStyle(tokens.textMuted), children: "Depositing" }),
|
|
4286
4319
|
/* @__PURE__ */ jsxs("div", { style: amountRowStyle2, children: [
|
|
@@ -4319,7 +4352,7 @@ function DepositScreen({
|
|
|
4319
4352
|
/* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", style: { opacity: 0.4 }, children: /* @__PURE__ */ jsx("path", { d: "M7 10l5-5 5 5M7 14l5 5 5-5", stroke: tokens.textMuted, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
4320
4353
|
] })
|
|
4321
4354
|
] }),
|
|
4322
|
-
/* @__PURE__ */ jsxs("div", { style: spendingLimitStyle(tokens.textMuted), children: [
|
|
4355
|
+
remainingLimit != null && /* @__PURE__ */ jsxs("div", { style: spendingLimitStyle(tokens.textMuted), children: [
|
|
4323
4356
|
"Spending Limit",
|
|
4324
4357
|
" ",
|
|
4325
4358
|
/* @__PURE__ */ jsxs("strong", { style: { color: tokens.text }, children: [
|
|
@@ -4332,15 +4365,6 @@ function DepositScreen({
|
|
|
4332
4365
|
}
|
|
4333
4366
|
);
|
|
4334
4367
|
}
|
|
4335
|
-
var mascotWrapStyle = {
|
|
4336
|
-
display: "flex",
|
|
4337
|
-
justifyContent: "center",
|
|
4338
|
-
marginBottom: 16
|
|
4339
|
-
};
|
|
4340
|
-
var mascotStyle2 = {
|
|
4341
|
-
width: 36,
|
|
4342
|
-
height: 36
|
|
4343
|
-
};
|
|
4344
4368
|
var depositCardStyle = (tokens) => ({
|
|
4345
4369
|
background: tokens.bgInput,
|
|
4346
4370
|
border: `1px solid ${tokens.border}`,
|
|
@@ -4532,12 +4556,7 @@ function SuccessScreen({
|
|
|
4532
4556
|
/* @__PURE__ */ jsx(PoweredByFooter, {})
|
|
4533
4557
|
] }),
|
|
4534
4558
|
children: [
|
|
4535
|
-
/* @__PURE__ */ jsx(
|
|
4536
|
-
ScreenHeader,
|
|
4537
|
-
{
|
|
4538
|
-
right: /* @__PURE__ */ jsx(SettingsMenu, { onLogout })
|
|
4539
|
-
}
|
|
4540
|
-
),
|
|
4559
|
+
/* @__PURE__ */ jsx(ScreenHeader, { onLogout }),
|
|
4541
4560
|
/* @__PURE__ */ jsxs("div", { style: contentStyle6, children: [
|
|
4542
4561
|
succeeded ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4543
4562
|
/* @__PURE__ */ jsx(IconCircle, { variant: "success", size: 64, children: /* @__PURE__ */ jsx("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: tokens.success }) }) }),
|
|
@@ -4704,7 +4723,7 @@ function SelectSourceScreen({
|
|
|
4704
4723
|
{
|
|
4705
4724
|
title: "Select Source",
|
|
4706
4725
|
onBack,
|
|
4707
|
-
|
|
4726
|
+
onLogout
|
|
4708
4727
|
}
|
|
4709
4728
|
),
|
|
4710
4729
|
/* @__PURE__ */ jsx("p", { style: subtitleStyle5(tokens.textMuted), children: "Choose which chain and token to pay from." }),
|
|
@@ -5071,12 +5090,13 @@ function buildSteps(phase) {
|
|
|
5071
5090
|
}
|
|
5072
5091
|
function TransferStatusScreen({
|
|
5073
5092
|
phase,
|
|
5074
|
-
error
|
|
5093
|
+
error,
|
|
5094
|
+
onLogout
|
|
5075
5095
|
}) {
|
|
5076
5096
|
const { tokens } = useSwypeConfig();
|
|
5077
5097
|
const steps = buildSteps(phase);
|
|
5078
5098
|
return /* @__PURE__ */ jsxs(ScreenLayout, { footer: /* @__PURE__ */ jsx(PoweredByFooter, {}), children: [
|
|
5079
|
-
/* @__PURE__ */ jsx(ScreenHeader, {}),
|
|
5099
|
+
/* @__PURE__ */ jsx(ScreenHeader, { onLogout }),
|
|
5080
5100
|
/* @__PURE__ */ jsxs("div", { style: contentStyle7, children: [
|
|
5081
5101
|
/* @__PURE__ */ jsx(Spinner, { size: 64 }),
|
|
5082
5102
|
/* @__PURE__ */ jsx("h2", { style: headingStyle9(tokens.text), children: "Depositing your money..." }),
|
|
@@ -5145,6 +5165,7 @@ function OpenWalletScreen({
|
|
|
5145
5165
|
walletName,
|
|
5146
5166
|
deeplinkUri,
|
|
5147
5167
|
loading,
|
|
5168
|
+
useDeeplink = true,
|
|
5148
5169
|
error,
|
|
5149
5170
|
onRetryStatus,
|
|
5150
5171
|
onBack,
|
|
@@ -5155,16 +5176,44 @@ function OpenWalletScreen({
|
|
|
5155
5176
|
const logoSrc = walletName ? KNOWN_LOGOS[walletName.toLowerCase()] : void 0;
|
|
5156
5177
|
const autoOpenedRef = useRef(null);
|
|
5157
5178
|
useEffect(() => {
|
|
5158
|
-
if (loading || !deeplinkUri || autoOpenedRef.current === deeplinkUri) return;
|
|
5179
|
+
if (!useDeeplink || loading || !deeplinkUri || autoOpenedRef.current === deeplinkUri) return;
|
|
5159
5180
|
autoOpenedRef.current = deeplinkUri;
|
|
5160
5181
|
triggerDeeplink(deeplinkUri);
|
|
5161
|
-
}, [loading, deeplinkUri]);
|
|
5182
|
+
}, [useDeeplink, loading, deeplinkUri]);
|
|
5162
5183
|
const handleOpen = useCallback(() => {
|
|
5163
5184
|
const opened = window.open(deeplinkUri, "_blank");
|
|
5164
5185
|
if (!opened && window === window.parent) {
|
|
5165
5186
|
window.location.href = deeplinkUri;
|
|
5166
5187
|
}
|
|
5167
5188
|
}, [deeplinkUri]);
|
|
5189
|
+
if (!useDeeplink) {
|
|
5190
|
+
return /* @__PURE__ */ jsxs(
|
|
5191
|
+
ScreenLayout,
|
|
5192
|
+
{
|
|
5193
|
+
footer: /* @__PURE__ */ jsxs("div", { style: footerContentStyle, children: [
|
|
5194
|
+
error && /* @__PURE__ */ jsx(InfoBanner, { children: error }),
|
|
5195
|
+
/* @__PURE__ */ jsx(PoweredByFooter, {})
|
|
5196
|
+
] }),
|
|
5197
|
+
children: [
|
|
5198
|
+
/* @__PURE__ */ jsx(ScreenHeader, { onLogout }),
|
|
5199
|
+
/* @__PURE__ */ jsxs("div", { style: contentStyle8, children: [
|
|
5200
|
+
/* @__PURE__ */ jsx("div", { style: logoCircleStyle(tokens.bgInput), children: logoSrc ? /* @__PURE__ */ jsx("img", { src: logoSrc, alt: displayName, style: logoStyle2 }) : /* @__PURE__ */ jsx(Spinner, { size: 32 }) }),
|
|
5201
|
+
/* @__PURE__ */ jsxs("h2", { style: headingStyle10(tokens.text), children: [
|
|
5202
|
+
"Setting up ",
|
|
5203
|
+
displayName,
|
|
5204
|
+
"..."
|
|
5205
|
+
] }),
|
|
5206
|
+
/* @__PURE__ */ jsx("p", { style: subtitleStyle7(tokens.textSecondary), children: "Approve the connection in your wallet extension." }),
|
|
5207
|
+
/* @__PURE__ */ jsxs("div", { style: waitingBadgeStyle(tokens), children: [
|
|
5208
|
+
/* @__PURE__ */ jsx(Spinner, { size: 14 }),
|
|
5209
|
+
/* @__PURE__ */ jsx("span", { children: "Waiting for authorization..." })
|
|
5210
|
+
] }),
|
|
5211
|
+
/* @__PURE__ */ jsx("p", { style: waitHintStyle2(tokens.textMuted), children: "Usually takes a few seconds" })
|
|
5212
|
+
] })
|
|
5213
|
+
]
|
|
5214
|
+
}
|
|
5215
|
+
);
|
|
5216
|
+
}
|
|
5168
5217
|
return /* @__PURE__ */ jsxs(
|
|
5169
5218
|
ScreenLayout,
|
|
5170
5219
|
{
|
|
@@ -5179,7 +5228,7 @@ function OpenWalletScreen({
|
|
|
5179
5228
|
/* @__PURE__ */ jsx(PoweredByFooter, {})
|
|
5180
5229
|
] }),
|
|
5181
5230
|
children: [
|
|
5182
|
-
/* @__PURE__ */ jsx(ScreenHeader, { onBack,
|
|
5231
|
+
/* @__PURE__ */ jsx(ScreenHeader, { onBack, onLogout }),
|
|
5183
5232
|
/* @__PURE__ */ jsxs("div", { style: contentStyle8, children: [
|
|
5184
5233
|
/* @__PURE__ */ jsx("div", { style: logoCircleStyle(tokens.bgInput), children: logoSrc ? /* @__PURE__ */ jsx("img", { src: logoSrc, alt: displayName, style: logoStyle2 }) : /* @__PURE__ */ jsx(Spinner, { size: 32 }) }),
|
|
5185
5234
|
/* @__PURE__ */ jsx("h2", { style: headingStyle10(tokens.text), children: loading ? "Connecting..." : `Open ${displayName}` }),
|
|
@@ -5254,6 +5303,11 @@ var hintStyle = (color) => ({
|
|
|
5254
5303
|
color,
|
|
5255
5304
|
margin: "8px 0 0"
|
|
5256
5305
|
});
|
|
5306
|
+
var waitHintStyle2 = (color) => ({
|
|
5307
|
+
fontSize: "0.82rem",
|
|
5308
|
+
color,
|
|
5309
|
+
margin: "16px 0 0"
|
|
5310
|
+
});
|
|
5257
5311
|
function ConfirmSignScreen({
|
|
5258
5312
|
walletName,
|
|
5259
5313
|
signing,
|
|
@@ -5273,7 +5327,7 @@ function ConfirmSignScreen({
|
|
|
5273
5327
|
!error && /* @__PURE__ */ jsx("p", { style: hintStyle2(tokens.textMuted), children: "You may be prompted for biometric verification" })
|
|
5274
5328
|
] }),
|
|
5275
5329
|
children: [
|
|
5276
|
-
/* @__PURE__ */ jsx(ScreenHeader, {
|
|
5330
|
+
/* @__PURE__ */ jsx(ScreenHeader, { onLogout }),
|
|
5277
5331
|
/* @__PURE__ */ jsxs("div", { style: contentStyle9, children: [
|
|
5278
5332
|
logoSrc ? /* @__PURE__ */ jsx("img", { src: logoSrc, alt: displayName, style: logoStyle3 }) : /* @__PURE__ */ jsx(Spinner, { size: 48 }),
|
|
5279
5333
|
/* @__PURE__ */ jsx("h2", { style: headingStyle11(tokens.text), children: "Wallet authorized" }),
|
|
@@ -5352,6 +5406,7 @@ function TokenPickerScreen({
|
|
|
5352
5406
|
onSelectAuthorized,
|
|
5353
5407
|
onAuthorizeToken,
|
|
5354
5408
|
onBack,
|
|
5409
|
+
onLogout,
|
|
5355
5410
|
depositAmount
|
|
5356
5411
|
}) {
|
|
5357
5412
|
const { tokens: t } = useSwypeConfig();
|
|
@@ -5380,8 +5435,8 @@ function TokenPickerScreen({
|
|
|
5380
5435
|
}
|
|
5381
5436
|
};
|
|
5382
5437
|
return /* @__PURE__ */ jsxs(ScreenLayout, { footer: /* @__PURE__ */ jsx(PoweredByFooter, {}), children: [
|
|
5383
|
-
/* @__PURE__ */ jsx(ScreenHeader, { onBack }),
|
|
5384
|
-
/* @__PURE__ */ jsx("div", { style:
|
|
5438
|
+
/* @__PURE__ */ jsx(ScreenHeader, { onBack, onLogout }),
|
|
5439
|
+
/* @__PURE__ */ jsx("div", { style: mascotWrapStyle, children: /* @__PURE__ */ jsx("img", { src: SWYPE_MASCOT, alt: "Swype", style: mascotImgStyle }) }),
|
|
5385
5440
|
depositAmount != null && /* @__PURE__ */ jsxs("div", { style: depositCardStyle2(t), children: [
|
|
5386
5441
|
/* @__PURE__ */ jsx("div", { style: depositLabelStyle2(t.textMuted), children: "Depositing" }),
|
|
5387
5442
|
/* @__PURE__ */ jsxs("div", { style: depositAmountRowStyle, children: [
|
|
@@ -5434,7 +5489,7 @@ function TokenPickerScreen({
|
|
|
5434
5489
|
}) })
|
|
5435
5490
|
] });
|
|
5436
5491
|
}
|
|
5437
|
-
var
|
|
5492
|
+
var mascotWrapStyle = {
|
|
5438
5493
|
display: "flex",
|
|
5439
5494
|
justifyContent: "center",
|
|
5440
5495
|
marginBottom: 16
|
|
@@ -5685,6 +5740,7 @@ function StepRendererContent({
|
|
|
5685
5740
|
{
|
|
5686
5741
|
onCreatePasskey: handlers.onRegisterPasskey,
|
|
5687
5742
|
onBack: handlers.onLogout,
|
|
5743
|
+
onLogout: handlers.onLogout,
|
|
5688
5744
|
creating: state.registeringPasskey,
|
|
5689
5745
|
error: state.error,
|
|
5690
5746
|
popupFallback: state.passkeyPopupNeeded,
|
|
@@ -5698,6 +5754,7 @@ function StepRendererContent({
|
|
|
5698
5754
|
{
|
|
5699
5755
|
onCreatePasskey: handlers.onRegisterPasskey,
|
|
5700
5756
|
onBack: handlers.onLogout,
|
|
5757
|
+
onLogout: handlers.onLogout,
|
|
5701
5758
|
creating: state.verifyingPasskeyPopup,
|
|
5702
5759
|
error: state.error,
|
|
5703
5760
|
popupFallback: true,
|
|
@@ -5718,21 +5775,26 @@ function StepRendererContent({
|
|
|
5718
5775
|
onPrepareProvider: handlers.onPrepareProvider,
|
|
5719
5776
|
onSelectProvider: handlers.onSelectProvider,
|
|
5720
5777
|
onContinueConnection: handlers.onContinueConnection,
|
|
5721
|
-
onBack: () => handlers.onNavigate(state.activeCredentialId ? "deposit" : "create-passkey")
|
|
5778
|
+
onBack: () => handlers.onNavigate(state.activeCredentialId ? "deposit" : "create-passkey"),
|
|
5779
|
+
onLogout: handlers.onLogout
|
|
5722
5780
|
}
|
|
5723
5781
|
);
|
|
5724
5782
|
}
|
|
5725
5783
|
if (step === "open-wallet") {
|
|
5726
5784
|
const providerName = state.providers.find((p) => p.id === state.selectedProviderId)?.name ?? null;
|
|
5785
|
+
const useDeeplink = !shouldUseWalletConnector({
|
|
5786
|
+
userAgent: typeof navigator === "undefined" ? void 0 : navigator.userAgent
|
|
5787
|
+
});
|
|
5727
5788
|
return /* @__PURE__ */ jsx(
|
|
5728
5789
|
OpenWalletScreen,
|
|
5729
5790
|
{
|
|
5730
5791
|
walletName: providerName,
|
|
5731
5792
|
deeplinkUri: state.deeplinkUri ?? "",
|
|
5732
|
-
loading: state.creatingTransfer || !state.deeplinkUri,
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5793
|
+
loading: useDeeplink ? state.creatingTransfer || !state.deeplinkUri : state.creatingTransfer,
|
|
5794
|
+
useDeeplink,
|
|
5795
|
+
error: state.error || (useDeeplink ? pollingError : authExecutorError),
|
|
5796
|
+
onRetryStatus: useDeeplink ? handlers.onRetryMobileStatus : void 0,
|
|
5797
|
+
onBack: useDeeplink ? () => handlers.onNavigate("wallet-picker") : void 0,
|
|
5736
5798
|
onLogout: handlers.onLogout
|
|
5737
5799
|
}
|
|
5738
5800
|
);
|
|
@@ -5800,7 +5862,7 @@ function StepRendererContent({
|
|
|
5800
5862
|
sourceAddress,
|
|
5801
5863
|
sourceVerified,
|
|
5802
5864
|
availableBalance: selectedSource ? selectedSource.balance.available.amount : selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
|
|
5803
|
-
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ??
|
|
5865
|
+
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? null,
|
|
5804
5866
|
tokenCount,
|
|
5805
5867
|
initialAmount: parsedAmt,
|
|
5806
5868
|
processing: state.creatingTransfer,
|
|
@@ -5833,6 +5895,7 @@ function StepRendererContent({
|
|
|
5833
5895
|
onSelectAuthorized: handlers.onSelectAuthorizedToken,
|
|
5834
5896
|
onAuthorizeToken: handlers.onAuthorizeToken,
|
|
5835
5897
|
onBack: () => handlers.onNavigate(state.previousStep === "setup" ? "setup" : "deposit"),
|
|
5898
|
+
onLogout: handlers.onLogout,
|
|
5836
5899
|
depositAmount: depositAmount ?? void 0
|
|
5837
5900
|
}
|
|
5838
5901
|
);
|
|
@@ -5880,7 +5943,8 @@ function StepRendererContent({
|
|
|
5880
5943
|
merchantName,
|
|
5881
5944
|
sourceName,
|
|
5882
5945
|
remainingLimit: succeeded ? (() => {
|
|
5883
|
-
const limit = selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ??
|
|
5946
|
+
const limit = selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? null;
|
|
5947
|
+
if (limit == null) return null;
|
|
5884
5948
|
return limit > displayAmount ? limit - displayAmount : 0;
|
|
5885
5949
|
})() : void 0,
|
|
5886
5950
|
onDone: onDismiss ?? handlers.onNewPayment,
|
|
@@ -5898,7 +5962,7 @@ function StepRendererContent({
|
|
|
5898
5962
|
sourceAddress,
|
|
5899
5963
|
sourceVerified,
|
|
5900
5964
|
availableBalance: 0,
|
|
5901
|
-
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ??
|
|
5965
|
+
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? null,
|
|
5902
5966
|
tokenCount,
|
|
5903
5967
|
initialAmount: depositAmount ?? 5,
|
|
5904
5968
|
processing: false,
|
|
@@ -6689,7 +6753,7 @@ function useProviderHandlers(deps) {
|
|
|
6689
6753
|
});
|
|
6690
6754
|
if (!isMobile) {
|
|
6691
6755
|
dispatch({ type: "PAY_STARTED", isSetupRedirect: false });
|
|
6692
|
-
dispatch({ type: "NAVIGATE", step: "
|
|
6756
|
+
dispatch({ type: "NAVIGATE", step: "open-wallet" });
|
|
6693
6757
|
}
|
|
6694
6758
|
try {
|
|
6695
6759
|
let accountId;
|
|
@@ -6844,7 +6908,7 @@ function useProviderHandlers(deps) {
|
|
|
6844
6908
|
dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: session.uri });
|
|
6845
6909
|
triggerDeeplink(session.uri);
|
|
6846
6910
|
} else {
|
|
6847
|
-
dispatch({ type: "NAVIGATE", step: "
|
|
6911
|
+
dispatch({ type: "NAVIGATE", step: "open-wallet" });
|
|
6848
6912
|
await authExecutor.executeSessionById(session.id);
|
|
6849
6913
|
await reloadAccounts();
|
|
6850
6914
|
dispatch({ type: "NAVIGATE", step: "deposit" });
|
|
@@ -6937,7 +7001,7 @@ function useProviderHandlers(deps) {
|
|
|
6937
7001
|
dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: session.uri });
|
|
6938
7002
|
triggerDeeplink(session.uri);
|
|
6939
7003
|
} else {
|
|
6940
|
-
dispatch({ type: "NAVIGATE", step: "
|
|
7004
|
+
dispatch({ type: "NAVIGATE", step: "open-wallet" });
|
|
6941
7005
|
await authExecutor.executeSessionById(session.id);
|
|
6942
7006
|
await reloadAccounts();
|
|
6943
7007
|
dispatch({ type: "SELECT_TOKEN", walletId: _walletId, tokenSymbol });
|
|
@@ -7012,7 +7076,7 @@ function useOneTapSetupHandlers(deps) {
|
|
|
7012
7076
|
}
|
|
7013
7077
|
oneTapLimitSavedDuringSetupRef.current = true;
|
|
7014
7078
|
authExecutor.resolveSelectSource({ chainName, tokenSymbol });
|
|
7015
|
-
dispatch({ type: "NAVIGATE", step: "
|
|
7079
|
+
dispatch({ type: "NAVIGATE", step: "open-wallet" });
|
|
7016
7080
|
} else if (authExecutor.pendingOneTapSetup) {
|
|
7017
7081
|
authExecutor.resolveOneTapSetup();
|
|
7018
7082
|
} else {
|
|
@@ -7650,7 +7714,7 @@ function usePaymentEffects(deps) {
|
|
|
7650
7714
|
useWalletConnector: useWalletConnectorProp,
|
|
7651
7715
|
userAgent: typeof navigator === "undefined" ? void 0 : navigator.userAgent
|
|
7652
7716
|
});
|
|
7653
|
-
if (isDesktop && state.step === "setup-status") {
|
|
7717
|
+
if (isDesktop && (state.step === "setup-status" || state.step === "open-wallet")) {
|
|
7654
7718
|
preSelectSourceStepRef.current = state.step;
|
|
7655
7719
|
dispatch({ type: "NAVIGATE", step: "setup" });
|
|
7656
7720
|
return;
|
|
@@ -7665,7 +7729,7 @@ function usePaymentEffects(deps) {
|
|
|
7665
7729
|
const pendingOneTapSetupAction = authExecutor.pendingOneTapSetup;
|
|
7666
7730
|
const preOneTapSetupStepRef = useRef(null);
|
|
7667
7731
|
useEffect(() => {
|
|
7668
|
-
if (pendingOneTapSetupAction && state.step === "setup-status") {
|
|
7732
|
+
if (pendingOneTapSetupAction && (state.step === "setup-status" || state.step === "open-wallet")) {
|
|
7669
7733
|
if (oneTapLimitSavedDuringSetupRef.current) {
|
|
7670
7734
|
oneTapLimitSavedDuringSetupRef.current = false;
|
|
7671
7735
|
authExecutor.resolveOneTapSetup();
|