Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | 8x 8x 8x 8x 8x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 18x 5x 13x 8x | import { Coupon, GiftCertificate, Tax } from '@bigcommerce/checkout-sdk'; import React, { memo, Fragment, FunctionComponent } from 'react'; import { TranslatedString } from '../locale'; import OrderSummaryDiscount from './OrderSummaryDiscount'; import OrderSummaryPrice from './OrderSummaryPrice'; export interface OrderSummarySubtotalsProps { coupons: Coupon[]; giftCertificates?: GiftCertificate[]; discountAmount?: number; taxes?: Tax[]; giftWrappingAmount?: number; shippingAmount?: number; handlingAmount?: number; storeCreditAmount?: number; subtotalAmount: number; onRemovedGiftCertificate?(code: string): void; onRemovedCoupon?(code: string): void; } const OrderSummarySubtotals: FunctionComponent<OrderSummarySubtotalsProps> = ({ discountAmount, giftCertificates, taxes, giftWrappingAmount, shippingAmount, subtotalAmount, handlingAmount, storeCreditAmount, coupons, onRemovedGiftCertificate, onRemovedCoupon, }) => { return (<Fragment> <OrderSummaryPrice amount={ subtotalAmount } className="cart-priceItem--subtotal" label={ <TranslatedString id="cart.subtotal_text" /> } testId="cart-subtotal" /> { (coupons || []) .map((coupon, index) => <OrderSummaryDiscount amount={ coupon.discountedAmount } code={ coupon.code } key={ index } label={ coupon.displayName } onRemoved={ onRemovedCoupon } testId="cart-coupon" /> ) } { !!discountAmount && <OrderSummaryDiscount amount={ discountAmount } label={ <TranslatedString id="cart.discount_text" /> } testId="cart-discount" /> } { (giftCertificates || []) .map((giftCertificate, index) => <OrderSummaryDiscount amount={ giftCertificate.used } code={ giftCertificate.code } key={ index } label={ <TranslatedString id="cart.gift_certificate_text" /> } onRemoved={ onRemovedGiftCertificate } remaining={ giftCertificate.remaining } testId="cart-gift-certificate" /> ) } { !!giftWrappingAmount && <OrderSummaryPrice amount={ giftWrappingAmount } label={ <TranslatedString id="cart.gift_wrapping_text" /> } testId="cart-gift-wrapping" /> } <OrderSummaryPrice amount={ shippingAmount } label={ <TranslatedString id="cart.shipping_text" /> } testId="cart-shipping" zeroLabel={ <TranslatedString id="cart.free_text" /> } /> { !!handlingAmount && <OrderSummaryPrice amount={ handlingAmount } label={ <TranslatedString id="cart.handling_text" /> } testId="cart-handling" /> } { (taxes || []) .map((tax, index) => <OrderSummaryPrice amount={ tax.amount } key={ index } label={ tax.name } testId="cart-taxes" /> ) } { !!storeCreditAmount && <OrderSummaryDiscount amount={ storeCreditAmount } label={ <TranslatedString id="cart.store_credit_text" /> } testId="cart-store-credit" /> } </Fragment>); }; export default memo(OrderSummarySubtotals); |