Redesign create invoice modal

This commit is contained in:
xmrcheckout
2026-01-08 16:43:11 +00:00
parent 6a3156991a
commit 0148caf501
2 changed files with 599 additions and 603 deletions
+9 -7
View File
@@ -77,12 +77,12 @@ export async function createInvoiceAction(
const isFiat = amountMode === "fiat"; const isFiat = amountMode === "fiat";
const instantConfirmation = formData.get("instant_confirmation") === "1"; const instantConfirmation = formData.get("instant_confirmation") === "1";
const confirmationRaw = String(formData.get("confirmation_target") ?? "").trim(); const confirmationRaw = String(formData.get("confirmation_target") ?? "").trim();
const confirmationTarget = instantConfirmation ? 0 : Number(confirmationRaw); let confirmationTarget: number | null = null;
if ( if (instantConfirmation) {
Number.isNaN(confirmationTarget) || confirmationTarget = 0;
confirmationTarget < 0 || } else if (confirmationRaw) {
confirmationTarget > 10 const parsed = Number(confirmationRaw);
) { if (Number.isNaN(parsed) || parsed < 0 || parsed > 10) {
return { return {
error: "Confirmation target must be between 0 and 10.", error: "Confirmation target must be between 0 and 10.",
invoiceId: null, invoiceId: null,
@@ -94,6 +94,8 @@ export async function createInvoiceAction(
warnings: null, warnings: null,
}; };
} }
confirmationTarget = parsed;
}
const amountRaw = String( const amountRaw = String(
formData.get(isFiat ? "amount_fiat" : "amount_xmr") ?? "" formData.get(isFiat ? "amount_fiat" : "amount_xmr") ?? ""
).trim(); ).trim();
@@ -245,7 +247,7 @@ export async function createInvoiceAction(
amount_xmr: isFiat ? null : amountRaw, amount_xmr: isFiat ? null : amountRaw,
amount_fiat: isFiat ? amountRaw : null, amount_fiat: isFiat ? amountRaw : null,
currency: isFiat ? currency : null, currency: isFiat ? currency : null,
confirmation_target: confirmationTarget, ...(confirmationTarget !== null ? { confirmation_target: confirmationTarget } : {}),
expires_at: expiresAt, expires_at: expiresAt,
checkout_continue_url: checkoutContinueUrlRaw || null, checkout_continue_url: checkoutContinueUrlRaw || null,
metadata: metadata:
File diff suppressed because it is too large Load Diff