import Area from '@components/common/Area.js';
import { useAppState } from '@components/common/context/app.js';
import { _ } from '@evershop/evershop/lib/locale/translate/_';
import React from 'react';
const Total: React.FC<{
total: string;
totalTaxAmount: string;
priceIncludingTax: boolean;
}> = ({ total, totalTaxAmount, priceIncludingTax }) => {
return (
{(priceIncludingTax && (
{_('Total')}
({_('Inclusive of tax ${totalTaxAmount}', { totalTaxAmount })})
)) ||
{_('Total')}}
);
};
const Tax: React.FC<{
showPriceIncludingTax: boolean;
amount: string;
}> = ({ showPriceIncludingTax, amount }) => {
if (showPriceIncludingTax) {
return null;
}
return (
);
};
const Subtotal: React.FC<{ subTotal: string }> = ({ subTotal }) => {
return (
{_('Sub total')}
{subTotal}
);
};
const Discount: React.FC<{
discountAmount: string;
coupon: string | undefined;
}> = ({ discountAmount, coupon }) => {
if (!coupon) {
return null;
}
return (
{_('Discount(${coupon})', { coupon })}
- {discountAmount}
);
};
const Shipping: React.FC<{
method: string | undefined;
cost: string | undefined;
}> = ({ method, cost }) => {
return (
{method && (
<>
{_('Shipping (${method})', { method })}
{cost}
>
)}
{!method && (
<>
{_('Shipping')}
{_('No shipping is required for this order')}
>
)}
);
};
const OrderTotalSummary: React.FC<{
subTotal: string;
discountAmount: string;
coupon: string | undefined;
shippingMethod: string | undefined;
shippingCost: string | undefined;
taxAmount: string;
total: string;
}> = ({
subTotal,
discountAmount,
coupon,
shippingMethod,
shippingCost,
taxAmount,
total
}) => {
const {
config: {
tax: { priceIncludingTax }
}
} = useAppState();
return (
);
};
export { OrderTotalSummary, Subtotal, Discount, Shipping, Tax, Total };