diff --git a/project/apps/admin/next-env.d.ts b/project/apps/admin/next-env.d.ts
index ce4e94a..a419cbe 100644
--- a/project/apps/admin/next-env.d.ts
+++ b/project/apps/admin/next-env.d.ts
@@ -1,7 +1,7 @@
///
///
-import "./.next/types/routes.d.ts";
-import "./.next/types/root-params.d.ts";
+import "./.next/dev/types/routes.d.ts";
+import "./.next/dev/types/root-params.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/project/apps/pos/src/app/(terminal)/page.tsx b/project/apps/pos/src/app/(terminal)/page.tsx
index 534eb18..16f2f58 100644
--- a/project/apps/pos/src/app/(terminal)/page.tsx
+++ b/project/apps/pos/src/app/(terminal)/page.tsx
@@ -143,6 +143,7 @@ export default function RegisterPage() {
// POS-SELFPAY-FLOW: optional email for receipt before payment
const [showSelfpayEmail, setShowSelfpayEmail] = useState(false);
const [selfpayEmail, setSelfpayEmail] = useState('');
+ const [selfpayPaymentReady, setSelfpayPaymentReady] = useState(false);
let toastTimer: ReturnType | undefined;
const showAddedToast = (name: string) => {
clearTimeout(toastTimer);
@@ -509,6 +510,12 @@ export default function RegisterPage() {
});
setReceipt(result.receipt);
setRestPaymentFor(null);
+ // POS-SELFPAY-FLOW: send receipt by email if provided
+ if (isSelfpayMode && selfpayEmail.trim()) {
+ void posApi.emailReceipt(result.receipt.orderId, selfpayEmail.trim()).catch(() => {
+ // Non-blocking: email failure shouldn't interrupt the sale
+ });
+ }
void loadPendingSales();
} catch (err) {
setError(err instanceof Error ? err.message : 'No se pudo confirmar la venta');
@@ -783,6 +790,8 @@ export default function RegisterPage() {
setError('');
setSearch('');
setShowClearConfirm(false);
+ setSelfpayPaymentReady(false);
+ setSelfpayEmail('');
};
const searchCustomers = async (query: string) => {
@@ -1649,7 +1658,7 @@ export default function RegisterPage() {
)}
{/* POS-SELFPAY-FLOW: in selfpay mode, hide payment methods until email is captured */}
- {(!isSelfpayMode || selfpayEmail !== undefined) && (
+ {(!isSelfpayMode || selfpayPaymentReady) && (
{config.paymentMethods.map((method) => (