@swype-org/react-sdk 0.1.33 → 0.1.34
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 +332 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +332 -40
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1727,7 +1727,7 @@ var circleStyle = (bg, size) => ({
|
|
|
1727
1727
|
function OtpInput({ value, onChange, length = 6, disabled }) {
|
|
1728
1728
|
const { tokens } = useSwypeConfig();
|
|
1729
1729
|
const inputsRef = react.useRef([]);
|
|
1730
|
-
const digits = value.padEnd(length
|
|
1730
|
+
const digits = value.padEnd(length).split("").slice(0, length);
|
|
1731
1731
|
const focusInput = react.useCallback((index) => {
|
|
1732
1732
|
const clamped = Math.max(0, Math.min(index, length - 1));
|
|
1733
1733
|
inputsRef.current[clamped]?.focus();
|
|
@@ -3011,8 +3011,7 @@ function DepositScreen({
|
|
|
3011
3011
|
onLogout
|
|
3012
3012
|
}) {
|
|
3013
3013
|
const { tokens } = useSwypeConfig();
|
|
3014
|
-
const
|
|
3015
|
-
const sliderMax = Math.min(remainingLimit, availableBalance, 500);
|
|
3014
|
+
const amount = initialAmount;
|
|
3016
3015
|
const isLowBalance = availableBalance < MIN_DEPOSIT;
|
|
3017
3016
|
const canDeposit = amount >= MIN_DEPOSIT && amount <= remainingLimit && !isLowBalance && !processing;
|
|
3018
3017
|
const headerTitle = merchantName ? `Deposit to ${merchantName}` : "Deposit";
|
|
@@ -3124,17 +3123,6 @@ function DepositScreen({
|
|
|
3124
3123
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: chevronStyle2, children: ">" })
|
|
3125
3124
|
] })
|
|
3126
3125
|
] }),
|
|
3127
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3128
|
-
LimitSlider,
|
|
3129
|
-
{
|
|
3130
|
-
value: amount,
|
|
3131
|
-
min: MIN_DEPOSIT,
|
|
3132
|
-
max: sliderMax > MIN_DEPOSIT ? sliderMax : 20,
|
|
3133
|
-
step: 0.5,
|
|
3134
|
-
ticks: [MIN_DEPOSIT, 1, 5, 10, 20].filter((t) => t <= sliderMax || t <= 20),
|
|
3135
|
-
onChange: setAmount
|
|
3136
|
-
}
|
|
3137
|
-
),
|
|
3138
3126
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: detailsStyle, children: [
|
|
3139
3127
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: detailRowStyle(tokens.textMuted), children: [
|
|
3140
3128
|
"Remaining limit: ",
|
|
@@ -3259,14 +3247,45 @@ function SuccessScreen({
|
|
|
3259
3247
|
onDone,
|
|
3260
3248
|
onLogout,
|
|
3261
3249
|
onIncreaseLimits,
|
|
3262
|
-
onManageAccount
|
|
3250
|
+
onManageAccount,
|
|
3251
|
+
autoCloseSeconds
|
|
3263
3252
|
}) {
|
|
3264
3253
|
const { tokens } = useSwypeConfig();
|
|
3254
|
+
const [countdown, setCountdown] = react.useState(autoCloseSeconds ?? 0);
|
|
3255
|
+
const doneCalledRef = react.useRef(false);
|
|
3256
|
+
const handleDone = react.useCallback(() => {
|
|
3257
|
+
if (doneCalledRef.current) return;
|
|
3258
|
+
doneCalledRef.current = true;
|
|
3259
|
+
onDone();
|
|
3260
|
+
}, [onDone]);
|
|
3261
|
+
react.useEffect(() => {
|
|
3262
|
+
if (!autoCloseSeconds || autoCloseSeconds <= 0) return;
|
|
3263
|
+
const intervalId = window.setInterval(() => {
|
|
3264
|
+
setCountdown((prev) => {
|
|
3265
|
+
if (prev <= 1) {
|
|
3266
|
+
window.clearInterval(intervalId);
|
|
3267
|
+
return 0;
|
|
3268
|
+
}
|
|
3269
|
+
return prev - 1;
|
|
3270
|
+
});
|
|
3271
|
+
}, 1e3);
|
|
3272
|
+
return () => window.clearInterval(intervalId);
|
|
3273
|
+
}, [autoCloseSeconds]);
|
|
3274
|
+
react.useEffect(() => {
|
|
3275
|
+
if (autoCloseSeconds && countdown === 0) {
|
|
3276
|
+
handleDone();
|
|
3277
|
+
}
|
|
3278
|
+
}, [autoCloseSeconds, countdown, handleDone]);
|
|
3265
3279
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3266
3280
|
ScreenLayout,
|
|
3267
3281
|
{
|
|
3268
3282
|
footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3269
|
-
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick:
|
|
3283
|
+
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: handleDone, children: "Done" }),
|
|
3284
|
+
autoCloseSeconds != null && autoCloseSeconds > 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: countdownStyle(tokens.textMuted), children: [
|
|
3285
|
+
"Returning to app in ",
|
|
3286
|
+
countdown,
|
|
3287
|
+
"s\u2026"
|
|
3288
|
+
] }),
|
|
3270
3289
|
onManageAccount && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onManageAccount, style: manageStyle(tokens.textMuted), children: "Manage Swype account \u2192" }),
|
|
3271
3290
|
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
3272
3291
|
] }),
|
|
@@ -3390,6 +3409,12 @@ var upsellLinkStyle = (color) => ({
|
|
|
3390
3409
|
fontFamily: "inherit",
|
|
3391
3410
|
padding: 0
|
|
3392
3411
|
});
|
|
3412
|
+
var countdownStyle = (color) => ({
|
|
3413
|
+
fontSize: "0.82rem",
|
|
3414
|
+
color,
|
|
3415
|
+
margin: "10px 0 0",
|
|
3416
|
+
textAlign: "center"
|
|
3417
|
+
});
|
|
3393
3418
|
var manageStyle = (color) => ({
|
|
3394
3419
|
background: "transparent",
|
|
3395
3420
|
border: "none",
|
|
@@ -3403,6 +3428,233 @@ var manageStyle = (color) => ({
|
|
|
3403
3428
|
textAlign: "center",
|
|
3404
3429
|
padding: "12px 0 0"
|
|
3405
3430
|
});
|
|
3431
|
+
function SelectSourceScreen({
|
|
3432
|
+
choices,
|
|
3433
|
+
selectedChainName,
|
|
3434
|
+
selectedTokenSymbol,
|
|
3435
|
+
recommended,
|
|
3436
|
+
onChainChange,
|
|
3437
|
+
onTokenChange,
|
|
3438
|
+
onConfirm,
|
|
3439
|
+
onLogout
|
|
3440
|
+
}) {
|
|
3441
|
+
const { tokens } = useSwypeConfig();
|
|
3442
|
+
const selectedChain = choices.find((c) => c.chainName === selectedChainName) ?? choices[0];
|
|
3443
|
+
const tokenChoices = selectedChain?.tokens ?? [];
|
|
3444
|
+
const canConfirm = !!selectedChainName && !!selectedTokenSymbol;
|
|
3445
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3446
|
+
ScreenLayout,
|
|
3447
|
+
{
|
|
3448
|
+
footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3449
|
+
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onConfirm, disabled: !canConfirm, children: "Confirm source" }),
|
|
3450
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
3451
|
+
] }),
|
|
3452
|
+
children: [
|
|
3453
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3454
|
+
ScreenHeader,
|
|
3455
|
+
{
|
|
3456
|
+
title: "Select Source",
|
|
3457
|
+
right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout })
|
|
3458
|
+
}
|
|
3459
|
+
),
|
|
3460
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle7(tokens.textMuted), children: "Choose which chain and token to pay from." }),
|
|
3461
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { style: labelStyle2(tokens.textSecondary), children: "Chain" }),
|
|
3462
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: optionListStyle, children: choices.map((chain) => {
|
|
3463
|
+
const isSelected = chain.chainName === selectedChainName;
|
|
3464
|
+
const isRecommended = chain.chainName === recommended?.chainName;
|
|
3465
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3466
|
+
"button",
|
|
3467
|
+
{
|
|
3468
|
+
type: "button",
|
|
3469
|
+
onClick: () => onChainChange(chain.chainName),
|
|
3470
|
+
style: optionButtonStyle(tokens, isSelected),
|
|
3471
|
+
children: [
|
|
3472
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: optionContentStyle, children: [
|
|
3473
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: optionNameStyle(tokens.text), children: [
|
|
3474
|
+
chain.chainName,
|
|
3475
|
+
isRecommended && /* @__PURE__ */ jsxRuntime.jsx("span", { style: recommendedBadgeStyle(tokens.accent), children: " recommended" })
|
|
3476
|
+
] }),
|
|
3477
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: optionBalanceStyle(tokens.textMuted), children: [
|
|
3478
|
+
"$",
|
|
3479
|
+
chain.balance.toFixed(2)
|
|
3480
|
+
] })
|
|
3481
|
+
] }),
|
|
3482
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: radioStyle(tokens, isSelected), children: isSelected && /* @__PURE__ */ jsxRuntime.jsx("div", { style: radioDotStyle(tokens.accent) }) })
|
|
3483
|
+
]
|
|
3484
|
+
},
|
|
3485
|
+
chain.chainName
|
|
3486
|
+
);
|
|
3487
|
+
}) }),
|
|
3488
|
+
tokenChoices.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3489
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { style: labelStyle2(tokens.textSecondary), children: "Token" }),
|
|
3490
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: optionListStyle, children: tokenChoices.map((token) => {
|
|
3491
|
+
const isSelected = token.tokenSymbol === selectedTokenSymbol;
|
|
3492
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3493
|
+
"button",
|
|
3494
|
+
{
|
|
3495
|
+
type: "button",
|
|
3496
|
+
onClick: () => onTokenChange(token.tokenSymbol),
|
|
3497
|
+
style: optionButtonStyle(tokens, isSelected),
|
|
3498
|
+
children: [
|
|
3499
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: optionContentStyle, children: [
|
|
3500
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: optionNameStyle(tokens.text), children: token.tokenSymbol }),
|
|
3501
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: optionBalanceStyle(tokens.textMuted), children: [
|
|
3502
|
+
"$",
|
|
3503
|
+
token.balance.toFixed(2)
|
|
3504
|
+
] })
|
|
3505
|
+
] }),
|
|
3506
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: radioStyle(tokens, isSelected), children: isSelected && /* @__PURE__ */ jsxRuntime.jsx("div", { style: radioDotStyle(tokens.accent) }) })
|
|
3507
|
+
]
|
|
3508
|
+
},
|
|
3509
|
+
token.tokenSymbol
|
|
3510
|
+
);
|
|
3511
|
+
}) })
|
|
3512
|
+
] })
|
|
3513
|
+
]
|
|
3514
|
+
}
|
|
3515
|
+
);
|
|
3516
|
+
}
|
|
3517
|
+
var subtitleStyle7 = (color) => ({
|
|
3518
|
+
fontSize: "0.85rem",
|
|
3519
|
+
color,
|
|
3520
|
+
margin: "0 0 20px",
|
|
3521
|
+
lineHeight: 1.5
|
|
3522
|
+
});
|
|
3523
|
+
var labelStyle2 = (color) => ({
|
|
3524
|
+
display: "block",
|
|
3525
|
+
fontSize: "0.75rem",
|
|
3526
|
+
fontWeight: 600,
|
|
3527
|
+
color,
|
|
3528
|
+
textTransform: "uppercase",
|
|
3529
|
+
letterSpacing: "0.05em",
|
|
3530
|
+
marginBottom: 8
|
|
3531
|
+
});
|
|
3532
|
+
var optionListStyle = {
|
|
3533
|
+
display: "flex",
|
|
3534
|
+
flexDirection: "column",
|
|
3535
|
+
gap: 8,
|
|
3536
|
+
marginBottom: 20
|
|
3537
|
+
};
|
|
3538
|
+
var optionButtonStyle = (tokens, selected) => ({
|
|
3539
|
+
display: "flex",
|
|
3540
|
+
alignItems: "center",
|
|
3541
|
+
justifyContent: "space-between",
|
|
3542
|
+
padding: "14px 16px",
|
|
3543
|
+
background: tokens.bgInput,
|
|
3544
|
+
border: `1.5px solid ${selected ? tokens.accent : tokens.border}`,
|
|
3545
|
+
borderRadius: 14,
|
|
3546
|
+
cursor: "pointer",
|
|
3547
|
+
fontFamily: "inherit",
|
|
3548
|
+
textAlign: "left",
|
|
3549
|
+
transition: "border-color 0.15s ease"
|
|
3550
|
+
});
|
|
3551
|
+
var optionContentStyle = {
|
|
3552
|
+
display: "flex",
|
|
3553
|
+
flexDirection: "column",
|
|
3554
|
+
gap: 2
|
|
3555
|
+
};
|
|
3556
|
+
var optionNameStyle = (color) => ({
|
|
3557
|
+
fontSize: "0.9rem",
|
|
3558
|
+
fontWeight: 600,
|
|
3559
|
+
color
|
|
3560
|
+
});
|
|
3561
|
+
var recommendedBadgeStyle = (color) => ({
|
|
3562
|
+
fontSize: "0.7rem",
|
|
3563
|
+
fontWeight: 500,
|
|
3564
|
+
color,
|
|
3565
|
+
marginLeft: 6
|
|
3566
|
+
});
|
|
3567
|
+
var optionBalanceStyle = (color) => ({
|
|
3568
|
+
fontSize: "0.78rem",
|
|
3569
|
+
color
|
|
3570
|
+
});
|
|
3571
|
+
var radioStyle = (tokens, selected) => ({
|
|
3572
|
+
width: 20,
|
|
3573
|
+
height: 20,
|
|
3574
|
+
borderRadius: "50%",
|
|
3575
|
+
border: `2px solid ${selected ? tokens.accent : tokens.border}`,
|
|
3576
|
+
display: "flex",
|
|
3577
|
+
alignItems: "center",
|
|
3578
|
+
justifyContent: "center",
|
|
3579
|
+
flexShrink: 0
|
|
3580
|
+
});
|
|
3581
|
+
var radioDotStyle = (color) => ({
|
|
3582
|
+
width: 10,
|
|
3583
|
+
height: 10,
|
|
3584
|
+
borderRadius: "50%",
|
|
3585
|
+
background: color
|
|
3586
|
+
});
|
|
3587
|
+
var STEP_LABELS = ["Creating transfer", "Verifying", "Sent", "Done"];
|
|
3588
|
+
var PHASE_ACTIVE_INDEX = {
|
|
3589
|
+
creating: 0,
|
|
3590
|
+
verifying: 1,
|
|
3591
|
+
sent: 2,
|
|
3592
|
+
done: 4
|
|
3593
|
+
};
|
|
3594
|
+
function buildSteps(phase) {
|
|
3595
|
+
const activeIdx = PHASE_ACTIVE_INDEX[phase];
|
|
3596
|
+
return STEP_LABELS.map((label, i) => ({
|
|
3597
|
+
label,
|
|
3598
|
+
status: i < activeIdx ? "complete" : i === activeIdx ? "active" : "pending"
|
|
3599
|
+
}));
|
|
3600
|
+
}
|
|
3601
|
+
function TransferStatusScreen({
|
|
3602
|
+
phase,
|
|
3603
|
+
error,
|
|
3604
|
+
onLogout
|
|
3605
|
+
}) {
|
|
3606
|
+
const { tokens } = useSwypeConfig();
|
|
3607
|
+
const steps = buildSteps(phase);
|
|
3608
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ScreenLayout, { children: [
|
|
3609
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout }) }),
|
|
3610
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle6, children: [
|
|
3611
|
+
/* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 48 }),
|
|
3612
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle8(tokens.text), children: "Processing Transfer..." }),
|
|
3613
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle6(tokens), children: error }),
|
|
3614
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: stepsWrapStyle2, children: /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps }) }),
|
|
3615
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: waitHintStyle2(tokens.textMuted), children: "Usually takes a few seconds" })
|
|
3616
|
+
] })
|
|
3617
|
+
] });
|
|
3618
|
+
}
|
|
3619
|
+
var contentStyle6 = {
|
|
3620
|
+
flex: 1,
|
|
3621
|
+
display: "flex",
|
|
3622
|
+
flexDirection: "column",
|
|
3623
|
+
alignItems: "center",
|
|
3624
|
+
justifyContent: "center",
|
|
3625
|
+
textAlign: "center",
|
|
3626
|
+
padding: "0 24px"
|
|
3627
|
+
};
|
|
3628
|
+
var headingStyle8 = (color) => ({
|
|
3629
|
+
fontSize: "1.45rem",
|
|
3630
|
+
fontWeight: 700,
|
|
3631
|
+
letterSpacing: "-0.02em",
|
|
3632
|
+
color,
|
|
3633
|
+
margin: "20px 0 16px"
|
|
3634
|
+
});
|
|
3635
|
+
var errorBannerStyle6 = (tokens) => ({
|
|
3636
|
+
background: tokens.errorBg,
|
|
3637
|
+
border: `1px solid ${tokens.error}66`,
|
|
3638
|
+
borderRadius: 16,
|
|
3639
|
+
padding: "11px 14px",
|
|
3640
|
+
color: tokens.error,
|
|
3641
|
+
fontSize: "0.84rem",
|
|
3642
|
+
marginBottom: 14,
|
|
3643
|
+
lineHeight: 1.5,
|
|
3644
|
+
width: "100%",
|
|
3645
|
+
textAlign: "left"
|
|
3646
|
+
});
|
|
3647
|
+
var stepsWrapStyle2 = {
|
|
3648
|
+
width: "100%",
|
|
3649
|
+
maxWidth: 280,
|
|
3650
|
+
textAlign: "left",
|
|
3651
|
+
marginBottom: 16
|
|
3652
|
+
};
|
|
3653
|
+
var waitHintStyle2 = (color) => ({
|
|
3654
|
+
fontSize: "0.82rem",
|
|
3655
|
+
color,
|
|
3656
|
+
margin: 0
|
|
3657
|
+
});
|
|
3406
3658
|
var ACTIVE_CREDENTIAL_STORAGE_KEY = "swype_active_credential_id";
|
|
3407
3659
|
var MIN_SEND_AMOUNT_USD = 0.25;
|
|
3408
3660
|
function computeSmartDefaults(accts, transferAmount) {
|
|
@@ -3481,7 +3733,9 @@ function SwypePayment({
|
|
|
3481
3733
|
idempotencyKey,
|
|
3482
3734
|
merchantAuthorization,
|
|
3483
3735
|
merchantName,
|
|
3484
|
-
onBack
|
|
3736
|
+
onBack,
|
|
3737
|
+
onDismiss,
|
|
3738
|
+
autoCloseSeconds
|
|
3485
3739
|
}) {
|
|
3486
3740
|
const { apiBaseUrl, tokens, depositAmount } = useSwypeConfig();
|
|
3487
3741
|
const { ready, authenticated, user, logout, getAccessToken } = reactAuth.usePrivy();
|
|
@@ -3807,6 +4061,26 @@ function SwypePayment({
|
|
|
3807
4061
|
}
|
|
3808
4062
|
initializedSelectSourceActionRef.current = pendingSelectSourceAction.id;
|
|
3809
4063
|
}, [pendingSelectSourceAction, selectSourceChoices, selectSourceRecommended]);
|
|
4064
|
+
react.useEffect(() => {
|
|
4065
|
+
if (pendingSelectSourceAction && step === "processing") {
|
|
4066
|
+
setStep("select-source");
|
|
4067
|
+
} else if (!pendingSelectSourceAction && step === "select-source") {
|
|
4068
|
+
setStep("processing");
|
|
4069
|
+
}
|
|
4070
|
+
}, [pendingSelectSourceAction, step]);
|
|
4071
|
+
const handleSelectSourceChainChange = react.useCallback(
|
|
4072
|
+
(chainName) => {
|
|
4073
|
+
setSelectSourceChainName(chainName);
|
|
4074
|
+
const chain = selectSourceChoices.find((c) => c.chainName === chainName);
|
|
4075
|
+
if (!chain || chain.tokens.length === 0) return;
|
|
4076
|
+
const recommendedToken = selectSourceRecommended?.chainName === chainName ? selectSourceRecommended.tokenSymbol : null;
|
|
4077
|
+
const hasRecommended = !!recommendedToken && chain.tokens.some((t) => t.tokenSymbol === recommendedToken);
|
|
4078
|
+
setSelectSourceTokenSymbol(
|
|
4079
|
+
hasRecommended ? recommendedToken : chain.tokens[0].tokenSymbol
|
|
4080
|
+
);
|
|
4081
|
+
},
|
|
4082
|
+
[selectSourceChoices, selectSourceRecommended]
|
|
4083
|
+
);
|
|
3810
4084
|
const selectedAccount = accounts.find((a) => a.id === selectedAccountId);
|
|
3811
4085
|
const selectedWallet = selectedAccount?.wallets.find((w) => w.id === selectedWalletId);
|
|
3812
4086
|
const sourceName = selectedAccount?.name ?? selectedWallet?.chain.name ?? "Wallet";
|
|
@@ -4111,6 +4385,9 @@ function SwypePayment({
|
|
|
4111
4385
|
}
|
|
4112
4386
|
);
|
|
4113
4387
|
}
|
|
4388
|
+
if ((step === "login" || step === "otp-verify") && authenticated) {
|
|
4389
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ScreenLayout, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { textAlign: "center", padding: "48px 0", flex: 1, display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { label: "Verifying your passkey..." }) }) });
|
|
4390
|
+
}
|
|
4114
4391
|
if (step === "create-passkey") {
|
|
4115
4392
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4116
4393
|
CreatePasskeyScreen,
|
|
@@ -4176,7 +4453,7 @@ function SwypePayment({
|
|
|
4176
4453
|
sourceAddress,
|
|
4177
4454
|
sourceVerified,
|
|
4178
4455
|
availableBalance: maxSourceBalance,
|
|
4179
|
-
remainingLimit: oneTapLimit,
|
|
4456
|
+
remainingLimit: selectedAccount?.remainingAllowance ?? oneTapLimit,
|
|
4180
4457
|
tokenCount,
|
|
4181
4458
|
initialAmount: parsedAmt,
|
|
4182
4459
|
processing: creatingTransfer,
|
|
@@ -4190,25 +4467,36 @@ function SwypePayment({
|
|
|
4190
4467
|
);
|
|
4191
4468
|
}
|
|
4192
4469
|
if (step === "processing") {
|
|
4193
|
-
const currentActionType = authExecutor.currentAction?.type;
|
|
4194
4470
|
const polledStatus = polling.transfer?.status;
|
|
4195
|
-
const
|
|
4196
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4471
|
+
const transferPhase = creatingTransfer ? "creating" : mobileFlow || authExecutor.executing || transferSigning.signing ? "verifying" : polledStatus === "SENDING" || polledStatus === "SENT" || polling.isPolling ? "sent" : "creating";
|
|
4472
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4473
|
+
TransferStatusScreen,
|
|
4474
|
+
{
|
|
4475
|
+
phase: transferPhase,
|
|
4476
|
+
error: error || authExecutor.error || transferSigning.error || polling.error,
|
|
4477
|
+
onLogout: handleLogout
|
|
4478
|
+
}
|
|
4479
|
+
);
|
|
4480
|
+
}
|
|
4481
|
+
if (step === "select-source") {
|
|
4482
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4483
|
+
SelectSourceScreen,
|
|
4484
|
+
{
|
|
4485
|
+
choices: selectSourceChoices,
|
|
4486
|
+
selectedChainName: selectSourceChainName,
|
|
4487
|
+
selectedTokenSymbol: selectSourceTokenSymbol,
|
|
4488
|
+
recommended: selectSourceRecommended,
|
|
4489
|
+
onChainChange: handleSelectSourceChainChange,
|
|
4490
|
+
onTokenChange: setSelectSourceTokenSymbol,
|
|
4491
|
+
onConfirm: () => {
|
|
4492
|
+
authExecutor.resolveSelectSource({
|
|
4493
|
+
chainName: selectSourceChainName,
|
|
4494
|
+
tokenSymbol: selectSourceTokenSymbol
|
|
4495
|
+
});
|
|
4496
|
+
},
|
|
4497
|
+
onLogout: handleLogout
|
|
4498
|
+
}
|
|
4499
|
+
);
|
|
4212
4500
|
}
|
|
4213
4501
|
if (step === "success") {
|
|
4214
4502
|
transfer?.status === "COMPLETED";
|
|
@@ -4221,9 +4509,13 @@ function SwypePayment({
|
|
|
4221
4509
|
currency: displayCurrency,
|
|
4222
4510
|
merchantName,
|
|
4223
4511
|
sourceName,
|
|
4224
|
-
remainingLimit:
|
|
4225
|
-
|
|
4226
|
-
|
|
4512
|
+
remainingLimit: (() => {
|
|
4513
|
+
const limit = selectedAccount?.remainingAllowance ?? oneTapLimit;
|
|
4514
|
+
return limit > displayAmount ? limit - displayAmount : 0;
|
|
4515
|
+
})(),
|
|
4516
|
+
onDone: onDismiss ?? handleNewPayment,
|
|
4517
|
+
onLogout: handleLogout,
|
|
4518
|
+
autoCloseSeconds
|
|
4227
4519
|
}
|
|
4228
4520
|
);
|
|
4229
4521
|
}
|
|
@@ -4236,7 +4528,7 @@ function SwypePayment({
|
|
|
4236
4528
|
sourceAddress,
|
|
4237
4529
|
sourceVerified,
|
|
4238
4530
|
availableBalance: 0,
|
|
4239
|
-
remainingLimit: oneTapLimit,
|
|
4531
|
+
remainingLimit: selectedAccount?.remainingAllowance ?? oneTapLimit,
|
|
4240
4532
|
tokenCount,
|
|
4241
4533
|
initialAmount: depositAmount ?? 5,
|
|
4242
4534
|
processing: false,
|