import { useStorefront } from '../context'; import { storefrontText } from '../text'; import { formatPrice } from '../theme'; import type { StoreOrder } from '../types'; import { Container, SfButton } from '../ui'; import { whatsappLink } from '../whatsapp'; /** Where the shopper lands after the payment page: a thank-you, or a "not paid yet" notice. */ export function OrderPage({ order }: { order: StoreOrder }) { const { language, shop, storeName } = useStorefront(); const t = storefrontText(language); const paid = order.status === 'paid'; const address = order.shipping_address; return (

{paid ? t.thankYou : t.orderPendingTitle}

{paid ? t.orderPaid(order.number, order.customer_email) : t.orderPending(order.number)}

{t.orderSummary}

    {order.items.map((item) => (
  • {item.name}{' '} × {item.quantity} {formatPrice(item.line_total)}
  • ))}
{t.subtotal} {formatPrice(order.subtotal)}
{t.shipping} {order.shipping_total === 0 ? t.shippingFree : formatPrice(order.shipping_total)}
{t.total} {formatPrice(order.total)}

{t.deliverTo}

{order.customer_name}
{address.line1} {address.line2 ? `, ${address.line2}` : ''}
{address.postcode} {address.city}, {address.state}
{order.shipped_at && order.shipping_courier && (

{t.shippedVia(order.shipping_courier)}

{order.tracking_number && (

{t.trackingNumber}:{' '} {order.tracking_number}

)}
)}
{paid ? t.continueShopping : t.backToCart} {shop.whatsapp && ( {t.askAboutOrder} )}
); }