Ship Expo Router screens, seeded stores, and polished UX so auth, shop, checkout, prescriptions, loyalty, family, and account processes work end-to-end offline. Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
647 B
TypeScript
22 lines
647 B
TypeScript
/** Shared commerce numbers so cart, checkout and orders stay consistent. */
|
|
export const DELIVERY_FEE = 80;
|
|
export const DEMO_VOUCHER = "GISHEN10";
|
|
export const DEMO_VOUCHER_PCT = 0.1;
|
|
export const DEMO_OTP = "1234";
|
|
|
|
export function voucherDiscount(subtotal: number, code: string | null | undefined) {
|
|
if (!code) return 0;
|
|
if (code.trim().toUpperCase() === DEMO_VOUCHER) {
|
|
return Math.round(subtotal * DEMO_VOUCHER_PCT);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
export function orderSubtotalTotal(input: {
|
|
subtotal: number;
|
|
deliveryFee: number;
|
|
discount?: number;
|
|
}) {
|
|
return Math.max(0, input.subtotal + input.deliveryFee - (input.discount ?? 0));
|
|
}
|