{"version":3,"sources":["webpack://checkout/./src/app/order/OrderSummaryPrice.tsx","webpack://checkout/./src/app/order/getItemsCount.ts","webpack://checkout/./src/app/order/OrderSummarySection.tsx","webpack://checkout/./src/app/order/OrderSummaryTotal.tsx","webpack://checkout/./src/app/ui/icon/IconChevronUp.tsx","webpack://checkout/./src/app/ui/icon/IconChevronDown.tsx","webpack://checkout/./src/app/order/mapFromCustom.tsx","webpack://checkout/./src/app/order/getOrderSummaryItemImage.tsx","webpack://checkout/./src/app/order/mapFromDigital.tsx","webpack://checkout/./src/app/order/mapFromGiftCertificate.tsx","webpack://checkout/./src/app/order/mapFromPhysical.tsx","webpack://checkout/./src/app/order/OrderSummaryItem.tsx","webpack://checkout/./src/app/order/OrderSummaryItems.tsx","webpack://checkout/./src/app/order/OrderSummaryDiscount.tsx","webpack://checkout/./src/app/order/OrderSummarySubtotals.tsx","webpack://checkout/./src/app/ui/icon/IconGiftCertificate.tsx","webpack://checkout/./src/app/cart/EditLink.tsx","webpack://checkout/./src/app/cart/mapToCartSummaryProps.ts","webpack://checkout/./src/app/cart/mapToRedeemableProps.ts","webpack://checkout/./src/app/coupon/AppliedCoupon.tsx","webpack://checkout/./src/app/giftCertificate/AppliedGiftCertificate.tsx","webpack://checkout/./src/app/ui/icon/IconRemove.tsx","webpack://checkout/./src/app/cart/AppliedRedeemable.tsx","webpack://checkout/./src/app/cart/AppliedRedeemables.tsx","webpack://checkout/./src/app/cart/Redeemable.tsx","webpack://checkout/./src/app/cart/withRedeemable.tsx","webpack://checkout/./src/app/cart/mapToOrderSummarySubtotalsProps.ts"],"names":["state","highlight","previousAmount","handleTransitionEnd","node","done","addEventListener","setState","getDerivedStateFromProps","props","amount","render","this","actionLabel","onActionTriggered","children","className","currencyCode","label","superscript","testId","zeroLabel","displayValue","getDisplayValue","addEndListener","classNames","in","timeout","href","onClick","isNumberValue","getItemsCount","physicalItems","digitalItems","giftCertificates","customItems","reduce","total","item","quantity","length","shopperCurrencyCode","storeCurrencyCode","orderAmount","currency","hasDifferentCurrency","id","undefined","data","toStoreCurrency","code","withIconContainer","height","viewBox","width","xmlns","d","extendedListPrice","name","getOrderSummaryItemImage","imageUrl","alt","src","getDigitalItemDescription","downloadPageUrl","content","rel","target","TranslatedString","amountAfterDiscount","extendedSalePrice","image","productOptions","options","map","option","value","IconGiftCertificate","extendedComparisonPrice","description","giftWrapping","index","key","ShopperCurrency","handleToggle","isExpanded","items","count","slice","sort","variantId","summaryItemProps","renderActions","getLineItemCount","type","Component","remaining","onRemoved","rest","OrderSummaryPrice","discountAmount","taxes","giftWrappingAmount","shippingAmount","subtotalAmount","handlingAmount","storeCreditAmount","coupons","onRemovedGiftCertificate","onRemovedCoupon","coupon","discountedAmount","displayName","giftCertificate","used","tax","url","mapToCartSummaryProps","context","getConfig","getCustomer","checkout","getCheckout","config","customer","redeemableProps","isStoreCreditApplied","grandTotal","storeCredit","shopperCurrency","cartUrl","links","cartLink","storeCurrency","Math","min","mapToRedeemableProps","checkoutService","getCoupons","getGiftCertificates","statuses","isApplyingCoupon","isApplyingGiftCertificate","isRemovingCoupon","isRemovingGiftCertificate","errors","getApplyCouponError","getApplyGiftCertificateError","getRemoveCouponError","getRemoveGiftCertificateError","appliedRedeemableError","applyCoupon","applyGiftCertificate","clearError","isApplyingRedeemable","removeCoupon","removeGiftCertificate","removedRedeemableError","shouldCollapseCouponCode","checkoutSettings","isCouponCodeCollapsed","isRemoving","onRemove","disabled","AppliedCouponChecklistItem","handleRemove","AppliedGiftCertificateChecklistItem","RedeemableForm","submitForm","handleKeyDown","setSubmitted","event","keyCode","preventDefault","handleSubmit","renderLabel","Label","hidden","htmlFor","renderErrorMessage","errorCode","renderInput","field","Alert","Error","TextInput","onKeyDown","Button","isLoading","variant","Secondary","renderContent","FormField","input","FormProvider","withLanguage","mapPropsToValues","redeemableCode","trim","validationSchema","language","required","translate","showAppliedRedeemables","formProps","Toggle","openByDefault","toggle","isOpen","withRedeemable","OriginalComponent","subtotal","consignments","handlingCostTotal","shippingCostBeforeDiscount","giftWrappingCostTotal","headerLink","hasSelectedShippingOptions","additionalLineItems","Redeemable","lineItems","cart","outstandingBalance"],"mappings":"oLA0CA,6E,OAQI,EAAAA,MAAQ,CACJC,WAAW,EACXC,eAAgB,GA0EZ,EAAAC,oBAAqE,SAACC,EAAMC,GACxE,IAAAH,EAAmB,EAAKF,MAAK,eAErCI,EAAKE,iBAAiB,gBAAgB,SAAC,GAAQ,WAC5BF,IACX,EAAKG,SAAS,CACVN,WAAW,EACXC,eAAc,IAElBG,S,EAIhB,OAjGgC,yBACrB,EAAAG,yBAAP,SAAgCC,EAA+BT,GAC3D,MAAO,CACHC,UAAWQ,EAAMC,SAAWV,EAAME,eAClCA,eAAgBO,EAAMC,SAS9B,YAAAC,OAAA,WACU,MAWFC,KAAKH,MAVLC,EAAM,SACNG,EAAW,cACXC,EAAiB,oBACjBC,EAAQ,WACRC,EAAS,YACTC,EAAY,eACZC,EAAK,QACLC,EAAW,cACXC,EAAM,SACNC,EAAS,YAGLpB,EAAcW,KAAKZ,MAAK,UAC1BsB,EA9Cd,SAAyBZ,EAAwBW,GAG7C,OAAI,MAAOX,EAFa,KAMpBW,GAAwB,IAAXX,EACNW,EAGJX,EAmCkBa,CAAgBb,EAAQW,GAE7C,OACI,qCAAiBD,GACb,kBAAC,gBAAa,CACVI,eAAiBZ,KAAKT,oBACtBsB,WAAW,kBACXC,GAAKzB,EACL0B,QAAU,IAEV,qCACc,SACVX,UAAY,IACR,iBACA,mCACAA,IAGJ,0BAAMA,UAAU,wBACZ,sCAAgB,oBACVE,EACA,MAEJD,GAAgB,0BAAMD,UAAU,+BAC5B,IAAIC,EAAY,MAEpBH,GAAqBD,GAAe,0BAAMG,UAAU,uBAClD,mCACc,sBACVY,KAAK,IACLC,QAAU,YAAef,IAEvBD,KAKd,0BAAMG,UAAU,wBACZ,sCAAgB,oBAtE5C,SAAuBM,GACnB,MAA+B,iBAAjBA,EAsEgBQ,CAAcR,GACZ,kBAAC,IAAe,C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ASoG,KAAKD,UAC1B/G,gBAAkBA,EAClBD,yBAA2BA,EAC3BqB,gBAAkBA,EAClBvB,kBAAoBA,EACpB2B,cAAgBA,EAChBhG,MAAQoF,EAASqG","file":"cart-summary~cart-summary-drawer-9056cb73.js","sourcesContent":["import classNames from 'classnames';\nimport React, { Component, ReactNode } from 'react';\nimport { CSSTransition } from 'react-transition-group';\n\nimport { preventDefault } from '../common/dom';\nimport { ShopperCurrency } from '../currency';\n\nexport interface OrderSummaryPriceProps {\n    label: ReactNode;\n    amount?: number | null;\n    zeroLabel?: ReactNode;\n    className?: string;\n    testId?: string;\n    currencyCode?: string;\n    superscript?: string;\n    actionLabel?: ReactNode;\n    onActionTriggered?(): void;\n}\n\nexport interface OrderSummaryPriceState {\n    highlight: boolean;\n    previousAmount?: number;\n}\n\nfunction getDisplayValue(amount?: number | null, zeroLabel?: ReactNode): ReactNode | number {\n    const notYetSetSymbol = '--';\n\n    if (typeof amount === 'undefined' || amount === null) {\n        return notYetSetSymbol;\n    }\n\n    if (zeroLabel && amount === 0) {\n        return zeroLabel;\n    }\n\n    return amount;\n}\n\nfunction isNumberValue(displayValue: number | ReactNode): displayValue is number {\n    return typeof displayValue === 'number';\n}\n\nclass OrderSummaryPrice extends Component<OrderSummaryPriceProps, OrderSummaryPriceState> {\n    static getDerivedStateFromProps(props: OrderSummaryPriceProps, state: OrderSummaryPriceState) {\n        return {\n            highlight: props.amount !== state.previousAmount,\n            previousAmount: props.amount,\n        };\n    }\n\n    state = {\n        highlight: false,\n        previousAmount: 0,\n    };\n\n    render(): ReactNode {\n        const {\n            amount,\n            actionLabel,\n            onActionTriggered,\n            children,\n            className,\n            currencyCode,\n            label,\n            superscript,\n            testId,\n            zeroLabel,\n        } = this.props;\n\n        const { highlight } = this.state;\n        const displayValue = getDisplayValue(amount, zeroLabel);\n\n        return (\n            <div data-test={ testId }>\n                <CSSTransition\n                    addEndListener={ this.handleTransitionEnd }\n                    classNames=\"changeHighlight\"\n                    in={ highlight }\n                    timeout={ {} }\n                >\n                    <div\n                        aria-live=\"polite\"\n                        className={ classNames(\n                            'cart-priceItem',\n                            'optimizedCheckout-contentPrimary',\n                            className\n                        ) }\n                    >\n                        <span className=\"cart-priceItem-label\">\n                            <span data-test=\"cart-price-label\">\n                                { label }\n                                { '  ' }\n                            </span>\n                            { currencyCode && <span className=\"cart-priceItem-currencyCode\">\n                                { `(${currencyCode}) ` }\n                            </span> }\n                            { onActionTriggered && actionLabel && <span className=\"cart-priceItem-link\">\n                                <a\n                                    data-test=\"cart-price-callback\"\n                                    href=\"#\"\n                                    onClick={ preventDefault(onActionTriggered) }\n                                >\n                                    { actionLabel }\n                                </a>\n                            </span> }\n                        </span>\n\n                        <span className=\"cart-priceItem-value\">\n                            <span data-test=\"cart-price-value\">\n                                { isNumberValue(displayValue) ?\n                                    <ShopperCurrency amount={ displayValue } /> :\n                                    displayValue }\n                            </span>\n\n                            { superscript && <sup data-test=\"cart-price-value-superscript\">\n                                { superscript }\n                            </sup> }\n                        </span>\n\n                        { children }\n                    </div>\n                </CSSTransition>\n            </div>\n        );\n    }\n\n    private handleTransitionEnd: (node: HTMLElement, done: () => void) => void = (node, done) => {\n        const { previousAmount } = this.state;\n\n        node.addEventListener('animationend', ({ target }) => {\n            if (target === node) {\n                this.setState({\n                    highlight: false,\n                    previousAmount,\n                });\n                done();\n            }\n        });\n    };\n}\n\nexport default OrderSummaryPrice;\n","import { LineItemMap } from '@bigcommerce/checkout-sdk';\n\nexport default function getItemsCount({\n    physicalItems,\n    digitalItems,\n    giftCertificates,\n    customItems,\n}: LineItemMap): number {\n    const totalItemsCount = [\n        ...physicalItems,\n        ...digitalItems,\n        ...(customItems || []),\n    ].reduce((total, item) => total += item.quantity, 0);\n\n    return totalItemsCount + giftCertificates.length;\n}\n","import React, { FunctionComponent } from 'react';\n\nconst OrderSummarySection: FunctionComponent = ({\n    children,\n}) => (\n    <section className=\"cart-section optimizedCheckout-orderSummary-cartSection\">\n        { children }\n    </section>\n);\n\nexport default OrderSummarySection;\n","import React, { Fragment, FunctionComponent } from 'react';\n\nimport { withCurrency, TranslatedString, WithCurrencyProps } from '../locale';\n\nimport OrderSummaryPrice from './OrderSummaryPrice';\n\nexport interface OrderSummaryTotalProps {\n    orderAmount: number;\n    shopperCurrencyCode: string;\n    storeCurrencyCode: string;\n}\n\nconst OrderSummaryTotal: FunctionComponent<OrderSummaryTotalProps & WithCurrencyProps> = ({\n    shopperCurrencyCode,\n    storeCurrencyCode,\n    orderAmount,\n    currency,\n}) => {\n\n    const hasDifferentCurrency = shopperCurrencyCode !== storeCurrencyCode;\n    const label = <Fragment>\n        { hasDifferentCurrency ?\n            <TranslatedString id=\"cart.estimated_total_text\" /> :\n            <TranslatedString id=\"cart.total_text\" /> }\n        { ` (${shopperCurrencyCode})` }\n    </Fragment>;\n\n    return (\n        <Fragment>\n            <OrderSummaryPrice\n                amount={ orderAmount }\n                className=\"cart-priceItem--total\"\n                label={ label }\n                superscript={ hasDifferentCurrency ? '*' : undefined }\n                testId=\"cart-total\"\n            />\n            { hasDifferentCurrency && currency && <p\n                className=\"cart-priceItem--totalNote\"\n                data-test=\"cart-price-item-total-note\"\n            >\n                <TranslatedString\n                    data={ {\n                        total: currency.toStoreCurrency(orderAmount),\n                        code: storeCurrencyCode,\n                    } }\n                    id=\"cart.billed_amount_text\"\n                />\n            </p> }\n        </Fragment>\n    );\n};\n\nexport default withCurrency(OrderSummaryTotal);\n","import React, { FunctionComponent } from 'react';\n\nimport withIconContainer from './withIconContainer';\n\nconst IconChevronUp: FunctionComponent = () => (\n    <svg height=\"24\" viewBox=\"0 0 24 24\" width=\"24\" xmlns=\"http://www.w3.org/2000/svg\">\n        <path d=\"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z\" />\n    </svg>\n);\n\nexport default withIconContainer(IconChevronUp);\n","import React, { FunctionComponent } from 'react';\n\nimport withIconContainer from './withIconContainer';\n\nconst IconChevronDown: FunctionComponent = () => (\n    <svg height=\"24\" viewBox=\"0 0 24 24\" width=\"24\" xmlns=\"http://www.w3.org/2000/svg\">\n        <path d=\"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z\" />\n    </svg>\n);\n\nexport default withIconContainer(IconChevronDown);\n","import { CustomItem } from '@bigcommerce/checkout-sdk';\n\nimport { OrderSummaryItemProps } from './OrderSummaryItem';\n\nfunction mapFromCustom(item: CustomItem): OrderSummaryItemProps {\n    return {\n        id: item.id,\n        quantity: item.quantity,\n        amount: item.extendedListPrice,\n        name: item.name,\n    };\n}\n\nexport default mapFromCustom;\n","import { DigitalItem, PhysicalItem } from '@bigcommerce/checkout-sdk';\nimport React, { ReactNode } from 'react';\n\nexport default function getOrderSummaryItemImage(item: DigitalItem | PhysicalItem): ReactNode {\n    if (!item.imageUrl) {\n        return;\n    }\n\n    return <img\n        alt={ item.name }\n        data-test=\"cart-item-image\"\n        src={ item.imageUrl }\n    />;\n}\n","import { DigitalItem } from '@bigcommerce/checkout-sdk';\nimport React from 'react';\n\nimport { TranslatedString } from '../locale';\n\nimport getOrderSummaryItemImage from './getOrderSummaryItemImage';\nimport { OrderSummaryItemOption, OrderSummaryItemProps } from './OrderSummaryItem';\n\nfunction mapFromDigital(item: DigitalItem): OrderSummaryItemProps {\n    return {\n        id: item.id,\n        quantity: item.quantity,\n        amount: item.extendedListPrice,\n        amountAfterDiscount: item.extendedSalePrice,\n        name: item.name,\n        image: getOrderSummaryItemImage(item),\n        productOptions: [\n            ...(item.options || []).map(option => ({\n                testId: 'cart-item-product-option',\n                content: `${option.name} ${option.value}`,\n            })),\n            getDigitalItemDescription(item),\n        ],\n    };\n}\n\nfunction getDigitalItemDescription(item: DigitalItem): OrderSummaryItemOption {\n    if (!item.downloadPageUrl) {\n        return {\n            testId: 'cart-item-digital-product',\n            content: <TranslatedString id=\"cart.digital_item_text\" />,\n        };\n    }\n\n    return {\n        testId: 'cart-item-digital-product-download',\n        content:\n            <a\n                href={ item.downloadPageUrl }\n                rel=\"noopener noreferrer\"\n                target=\"_blank\"\n            >\n                <TranslatedString id=\"cart.downloads_action\" />\n            </a>,\n    };\n}\n\nexport default mapFromDigital;\n","import { GiftCertificateItem } from '@bigcommerce/checkout-sdk';\nimport React from 'react';\n\nimport { IconGiftCertificate } from '../ui/icon';\n\nimport { OrderSummaryItemProps } from './OrderSummaryItem';\n\nfunction mapFromGiftCertificate(item: GiftCertificateItem): OrderSummaryItemProps {\n    return {\n        id: item.id,\n        quantity: 1,\n        amount: item.amount,\n        name: item.name,\n        image:\n            <span\n                className=\"productImage-giftCertificate\"\n                data-test=\"cart-item-gift-certificate\"\n            >\n                <IconGiftCertificate />\n            </span>,\n    };\n}\n\nexport default mapFromGiftCertificate;\n","import { PhysicalItem } from '@bigcommerce/checkout-sdk';\n\nimport getOrderSummaryItemImage from './getOrderSummaryItemImage';\nimport { OrderSummaryItemProps } from './OrderSummaryItem';\n\nfunction mapFromPhysical(item: PhysicalItem): OrderSummaryItemProps {\n    return {\n        id: item.id,\n        quantity: item.quantity,\n        amount: item.extendedComparisonPrice,\n        amountAfterDiscount: item.extendedSalePrice,\n        name: item.name,\n        image: getOrderSummaryItemImage(item),\n        description: item.giftWrapping ? item.giftWrapping.name : undefined,\n        productOptions: (item.options || []).map(option => ({\n            testId: 'cart-item-product-option',\n            content: `${option.name} ${option.value}`,\n        })),\n    };\n}\n\nexport default mapFromPhysical;\n","import classNames from 'classnames';\nimport { isNumber } from 'lodash';\nimport React, { memo, FunctionComponent, ReactNode } from 'react';\n\nimport { ShopperCurrency } from '../currency';\n\nexport interface OrderSummaryItemProps {\n    id: string | number;\n    amount: number;\n    quantity: number;\n    name: string;\n    amountAfterDiscount?: number;\n    image?: ReactNode;\n    description?: ReactNode;\n    productOptions?: OrderSummaryItemOption[];\n}\n\nexport interface OrderSummaryItemOption {\n    testId: string;\n    content: ReactNode;\n}\n\nconst OrderSummaryItem: FunctionComponent<OrderSummaryItemProps> = ({\n    amount,\n    amountAfterDiscount,\n    image,\n    name,\n    productOptions,\n    quantity,\n    description,\n}) => (\n    <div className=\"product\" data-test=\"cart-item\">\n        <figure className=\"product-column product-figure\">\n            { image }\n        </figure>\n\n        <div className=\"product-column product-body\">\n            <h5\n                className=\"product-title optimizedCheckout-contentPrimary\"\n                data-test=\"cart-item-product-title\"\n            >\n                { `${quantity} x ${name}` }\n            </h5>\n            <ul\n                className=\"product-options optimizedCheckout-contentSecondary\"\n                data-test=\"cart-item-product-options\"\n            >\n                { (productOptions || []).map((option, index) =>\n                    <li\n                        className=\"product-option\"\n                        data-test={ option.testId }\n                        key={ index }\n                    >\n                        { option.content }\n                    </li>\n                ) }\n            </ul>\n            { description && <div\n                className=\"product-description optimizedCheckout-contentSecondary\"\n                data-test=\"cart-item-product-description\"\n            >\n                { description }\n            </div> }\n        </div>\n\n        <div className=\"product-column product-actions\">\n            <div\n                className={ classNames(\n                    'product-price',\n                    'optimizedCheckout-contentPrimary',\n                    { 'product-price--beforeDiscount': isNumber(amountAfterDiscount) && amountAfterDiscount !== amount }\n                ) }\n                data-test=\"cart-item-product-price\"\n            >\n                <ShopperCurrency amount={ amount } />\n            </div>\n\n            { isNumber(amountAfterDiscount) && amountAfterDiscount !== amount && <div\n                className=\"product-price\"\n                data-test=\"cart-item-product-price--afterDiscount\"\n            >\n                <ShopperCurrency amount={ amountAfterDiscount } />\n            </div> }\n        </div>\n    </div>\n);\n\nexport default memo(OrderSummaryItem);\n","import { LineItemMap } from '@bigcommerce/checkout-sdk';\nimport React, { Fragment, ReactNode } from 'react';\n\nimport { TranslatedString } from '../locale';\nimport { IconChevronDown, IconChevronUp } from '../ui/icon';\n\nimport getItemsCount from './getItemsCount';\nimport mapFromCustom from './mapFromCustom';\nimport mapFromDigital from './mapFromDigital';\nimport mapFromGiftCertificate from './mapFromGiftCertificate';\nimport mapFromPhysical from './mapFromPhysical';\nimport OrderSummaryItem from './OrderSummaryItem';\n\nconst COLLAPSED_ITEMS_LIMIT = 4;\n\nexport interface OrderSummaryItemsProps {\n    items: LineItemMap;\n}\n\ninterface OrderSummaryItemsState {\n    isExpanded: boolean;\n}\n\nclass OrderSummaryItems extends React.Component<OrderSummaryItemsProps, OrderSummaryItemsState> {\n    constructor(props: OrderSummaryItemsProps) {\n        super(props);\n\n        this.state = {\n            isExpanded: false,\n        };\n    }\n\n    render(): ReactNode {\n        const { items } = this.props;\n        const { isExpanded } = this.state;\n\n        return (<Fragment>\n            <h3\n                className=\"cart-section-heading optimizedCheckout-contentPrimary\"\n                data-test=\"cart-count-total\"\n            >\n                <TranslatedString\n                    data={ { count: getItemsCount(items) } }\n                    id=\"cart.item_count_text\"\n                />\n            </h3>\n\n            <ul aria-live=\"polite\" className=\"productList\">\n                {\n                    [\n                        ...items.physicalItems\n                            .slice()\n                            .sort(item => item.variantId)\n                            .map(mapFromPhysical),\n                        ...items.giftCertificates\n                            .slice()\n                            .map(mapFromGiftCertificate),\n                        ...items.digitalItems\n                            .slice()\n                            .sort(item => item.variantId)\n                            .map(mapFromDigital),\n                        ...(items.customItems || [])\n                            .map(mapFromCustom),\n                    ]\n                        .slice(0, isExpanded ? undefined : COLLAPSED_ITEMS_LIMIT)\n                        .map(summaryItemProps =>\n                            <li\n                                className=\"productList-item is-visible\"\n                                key={ summaryItemProps.id }\n                            >\n                                <OrderSummaryItem { ...summaryItemProps } />\n                            </li>\n                        )\n                }\n            </ul>\n\n            { this.renderActions() }\n        </Fragment>);\n    }\n\n    private renderActions(): ReactNode {\n        const { isExpanded } = this.state;\n\n        if (this.getLineItemCount() < 5) {\n            return;\n        }\n\n        return (\n            <div className=\"cart-actions\">\n                <button\n                    className=\"button button--tertiary button--tiny optimizedCheckout-buttonSecondary\"\n                    onClick={ this.handleToggle }\n                    type=\"button\"\n                >\n                        { isExpanded ?\n                            <Fragment>\n                                <TranslatedString id=\"cart.see_less_action\" />\n                                <IconChevronUp />\n                            </Fragment> :\n                            <Fragment>\n                                <TranslatedString id=\"cart.see_all_action\" />\n                                <IconChevronDown />\n                            </Fragment> }\n                </button>\n            </div>\n        );\n    }\n\n    private getLineItemCount(): number {\n        const { items } = this.props;\n\n        return (items.customItems || []).length +\n            items.physicalItems.length +\n            items.digitalItems.length +\n            items.giftCertificates.length;\n    }\n\n    private handleToggle: () => void = () => {\n        const { isExpanded } = this.state;\n\n        this.setState({ isExpanded: !isExpanded });\n    };\n}\n\nexport default OrderSummaryItems;\n","import React, { memo, FunctionComponent } from 'react';\n\nimport { ShopperCurrency } from '../currency';\nimport { TranslatedString } from '../locale';\n\nimport OrderSummaryPrice, { OrderSummaryPriceProps } from './OrderSummaryPrice';\n\nexport interface OrderSummaryDiscountProps extends OrderSummaryPriceProps {\n    remaining?: number;\n    code?: string;\n    onRemoved?(code: string): void;\n}\n\nconst OrderSummaryDiscount: FunctionComponent<OrderSummaryDiscountProps> = ({\n    code,\n    remaining,\n    amount,\n    onRemoved,\n    ...rest\n}) => (\n    <OrderSummaryPrice\n        { ...rest }\n        { ...(onRemoved && {\n            onActionTriggered: () => code && onRemoved(code),\n            actionLabel: <TranslatedString id=\"cart.remove_action\" />,\n        }) }\n        amount={ -1 * (amount || 0) }\n    >\n        { !!remaining && remaining > 0 && <span\n            className=\"cart-priceItem-postFix optimizedCheckout-contentSecondary\"\n            data-test=\"cart-price-remaining\"\n        >\n            <TranslatedString id=\"cart.remaining_text\" />\n            { ': ' }\n            <ShopperCurrency amount={ remaining } />\n        </span> }\n\n        { code && <span\n            className=\"cart-priceItem-postFix optimizedCheckout-contentSecondary\"\n            data-test=\"cart-price-code\"\n        >\n            { code }\n        </span> }\n    </OrderSummaryPrice>\n);\n\nexport default memo(OrderSummaryDiscount);\n","import { Coupon, GiftCertificate, Tax } from '@bigcommerce/checkout-sdk';\nimport React, { memo, Fragment, FunctionComponent } from 'react';\n\nimport { TranslatedString } from '../locale';\n\nimport OrderSummaryDiscount from './OrderSummaryDiscount';\nimport OrderSummaryPrice from './OrderSummaryPrice';\n\nexport interface OrderSummarySubtotalsProps {\n    coupons: Coupon[];\n    giftCertificates?: GiftCertificate[];\n    discountAmount?: number;\n    taxes?: Tax[];\n    giftWrappingAmount?: number;\n    shippingAmount?: number;\n    handlingAmount?: number;\n    storeCreditAmount?: number;\n    subtotalAmount: number;\n    onRemovedGiftCertificate?(code: string): void;\n    onRemovedCoupon?(code: string): void;\n}\n\nconst OrderSummarySubtotals: FunctionComponent<OrderSummarySubtotalsProps> = ({\n    discountAmount,\n    giftCertificates,\n    taxes,\n    giftWrappingAmount,\n    shippingAmount,\n    subtotalAmount,\n    handlingAmount,\n    storeCreditAmount,\n    coupons,\n    onRemovedGiftCertificate,\n    onRemovedCoupon,\n}) => {\n    return (<Fragment>\n        <OrderSummaryPrice\n            amount={ subtotalAmount }\n            className=\"cart-priceItem--subtotal\"\n            label={ <TranslatedString id=\"cart.subtotal_text\" /> }\n            testId=\"cart-subtotal\"\n        />\n\n        { (coupons || [])\n            .map((coupon, index) =>\n                <OrderSummaryDiscount\n                    amount={ coupon.discountedAmount }\n                    code={ coupon.code }\n                    key={ index }\n                    label={ coupon.displayName }\n                    onRemoved={ onRemovedCoupon }\n                    testId=\"cart-coupon\"\n                />\n        ) }\n\n        { !!discountAmount && <OrderSummaryDiscount\n            amount={ discountAmount }\n            label={ <TranslatedString id=\"cart.discount_text\" /> }\n            testId=\"cart-discount\"\n        /> }\n\n        { (giftCertificates || [])\n            .map((giftCertificate, index) =>\n                <OrderSummaryDiscount\n                    amount={ giftCertificate.used }\n                    code={ giftCertificate.code }\n                    key={ index }\n                    label={ <TranslatedString id=\"cart.gift_certificate_text\" /> }\n                    onRemoved={ onRemovedGiftCertificate }\n                    remaining={ giftCertificate.remaining }\n                    testId=\"cart-gift-certificate\"\n                />\n        ) }\n\n        { !!giftWrappingAmount && <OrderSummaryPrice\n            amount={ giftWrappingAmount }\n            label={ <TranslatedString id=\"cart.gift_wrapping_text\" /> }\n            testId=\"cart-gift-wrapping\"\n        /> }\n\n        <OrderSummaryPrice\n            amount={ shippingAmount }\n            label={ <TranslatedString id=\"cart.shipping_text\" /> }\n            testId=\"cart-shipping\"\n            zeroLabel={ <TranslatedString id=\"cart.free_text\" /> }\n        />\n\n        { !!handlingAmount && <OrderSummaryPrice\n            amount={ handlingAmount }\n            label={ <TranslatedString id=\"cart.handling_text\" /> }\n            testId=\"cart-handling\"\n        /> }\n\n        { (taxes || [])\n            .map((tax, index) =>\n                <OrderSummaryPrice\n                    amount={ tax.amount }\n                    key={ index }\n                    label={ tax.name }\n                    testId=\"cart-taxes\"\n                />\n         ) }\n\n        { !!storeCreditAmount && <OrderSummaryDiscount\n            amount={ storeCreditAmount }\n            label={ <TranslatedString id=\"cart.store_credit_text\" /> }\n            testId=\"cart-store-credit\"\n        /> }\n    </Fragment>);\n};\n\nexport default memo(OrderSummarySubtotals);\n","import React, { FunctionComponent } from 'react';\n\nconst IconGiftCertificate: FunctionComponent = () => (\n    <svg\n        height=\"24\"\n        viewBox=\"0 0 24 24\"\n        width=\"24\"\n        xmlns=\"http://www.w3.org/2000/svg\"\n    >\n        <path d=\"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.68C10.96 2.54 10.05 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zM9 4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm11 15H4v-2h16v2zm0-5H4V8h5.08L7 10.83 8.62 12 11 8.76l1-1.36 1 1.36L15.38 12 17 10.83 14.92 8H20v6z\" />\n    </svg>\n);\n\nexport default IconGiftCertificate;\n","import React, { memo, FunctionComponent } from 'react';\n\nimport { TranslatedString } from '../locale';\n\nexport interface EditLinkProps {\n    className?: string;\n    url: string;\n}\n\nconst EditLink: FunctionComponent<EditLinkProps> = ({ className, url }) => (\n    <a\n        className={ className || 'cart-header-link' }\n        data-test=\"cart-edit-link\"\n        href={ url }\n        id=\"cart-edit-link\"\n        target=\"_top\"\n    >\n        <TranslatedString id=\"cart.edit_cart_action\" />\n    </a>\n);\n\nexport default memo(EditLink);\n","import { CheckoutContextProps } from '../checkout';\n\nimport mapToRedeemableProps from './mapToRedeemableProps';\nimport { WithCheckoutCartSummaryProps } from './CartSummary';\n\nexport default function mapToCartSummaryProps(\n    context: CheckoutContextProps\n): WithCheckoutCartSummaryProps | null {\n    const {\n        checkoutState: {\n            data: { getConfig, getCustomer, getCheckout },\n        },\n    } = context;\n\n    const checkout = getCheckout();\n    const config = getConfig();\n    const customer = getCustomer();\n    const redeemableProps = mapToRedeemableProps(context);\n\n    if (!checkout || !config || !redeemableProps || !customer) {\n        return null;\n    }\n\n    const { isStoreCreditApplied, grandTotal } = checkout;\n    const { storeCredit } = customer;\n\n    return {\n        checkout,\n        shopperCurrency: config.shopperCurrency,\n        cartUrl: config.links.cartLink,\n        storeCurrency: config.currency,\n        storeCreditAmount: isStoreCreditApplied ? Math.min(grandTotal, storeCredit) : undefined,\n        ...redeemableProps,\n    };\n}\n","import { CheckoutContextProps } from '../checkout';\nimport { EMPTY_ARRAY } from '../common/utility';\n\nimport { RedeemableProps } from './Redeemable';\n\nexport default function mapToRedeemableProps(\n    context: CheckoutContextProps\n): RedeemableProps | null {\n    const {\n        checkoutService,\n        checkoutState: {\n            data: {\n                getConfig,\n                getCoupons,\n                getGiftCertificates,\n            },\n            statuses: {\n                isApplyingCoupon,\n                isApplyingGiftCertificate,\n                isRemovingCoupon,\n                isRemovingGiftCertificate,\n            },\n            errors: {\n                getApplyCouponError,\n                getApplyGiftCertificateError,\n                getRemoveCouponError,\n                getRemoveGiftCertificateError,\n            },\n        },\n    } = context;\n\n    const config = getConfig();\n\n    if (!config) {\n        return null;\n    }\n\n    return {\n        appliedRedeemableError: getApplyCouponError() || getApplyGiftCertificateError(),\n        applyCoupon: checkoutService.applyCoupon,\n        applyGiftCertificate: checkoutService.applyGiftCertificate,\n        clearError: checkoutService.clearError,\n        coupons: getCoupons() || EMPTY_ARRAY,\n        giftCertificates: getGiftCertificates() || EMPTY_ARRAY,\n        isApplyingRedeemable: (isApplyingCoupon() || isApplyingGiftCertificate()),\n        isRemovingCoupon: isRemovingCoupon(),\n        isRemovingGiftCertificate: isRemovingGiftCertificate(),\n        onRemovedCoupon: checkoutService.removeCoupon,\n        onRemovedGiftCertificate: checkoutService.removeGiftCertificate,\n        removedRedeemableError: (getRemoveCouponError() || getRemoveGiftCertificateError()),\n        shouldCollapseCouponCode: config.checkoutSettings.isCouponCodeCollapsed,\n    };\n}\n","import { Coupon } from '@bigcommerce/checkout-sdk';\nimport React, { memo, FunctionComponent } from 'react';\n\nimport { TranslatedString } from '../locale';\n\nexport interface AppliedCouponProps {\n    coupon: Coupon;\n}\n\nconst AppliedCoupon: FunctionComponent<AppliedCouponProps> = ({ coupon }) => (\n    <div\n        className=\"redeemable-column redeemable-info\"\n        data-test=\"redeemable-item--coupon\"\n    >\n        <span className=\"redeemable-info-header\">\n            <span\n                className=\"redeemable-info-header--highlight\"\n                data-test=\"coupon-amount\"\n            >\n                { coupon.displayName }\n            </span>\n\n            { ' ' }\n\n            <TranslatedString id=\"redeemable.coupon_text\" />\n        </span>\n\n        <span className=\"redeemable-info-subHeader\" data-test=\"coupon-code\">\n            { coupon.code }\n        </span>\n    </div>\n);\n\nexport default memo(AppliedCoupon);\n","import { GiftCertificate } from '@bigcommerce/checkout-sdk';\nimport React, { memo, FunctionComponent } from 'react';\n\nimport { ShopperCurrency } from '../currency';\nimport { TranslatedString } from '../locale';\n\nexport interface AppliedGiftCertificateProps {\n    giftCertificate: GiftCertificate;\n}\n\nconst AppliedGiftCertificate: FunctionComponent<AppliedGiftCertificateProps> = ({ giftCertificate }) => (\n    <div\n        className=\"redeemable-column redeemable-info\"\n        data-test=\"redeemable-item--giftCertificate\"\n    >\n        <span className=\"redeemable-info-header\">\n            <span className=\"redeemable-info-header--highlight\" data-test=\"giftCertificate-amount\">\n                <ShopperCurrency amount={ giftCertificate.used } />\n            </span>\n\n            { ' ' }\n\n            <TranslatedString id=\"redeemable.gift_certificate_text\" />\n        </span>\n\n        <span className=\"redeemable-info-subHeader\">\n            { giftCertificate.remaining > 0 && <span className=\"redeemable-info-subHeader--remaining\">\n                <TranslatedString id=\"redeemable.gift_certificate_remaining_text\" />\n\n                { ' ' }\n\n                <span data-test=\"giftCertificate-remaining\">\n                    <ShopperCurrency amount={ giftCertificate.remaining } />\n                </span>\n            </span> }\n\n            <span data-test=\"giftCertificate-code\">\n                { giftCertificate.code }\n            </span>\n        </span>\n    </div>\n);\n\nexport default memo(AppliedGiftCertificate);\n","import React, { FunctionComponent } from 'react';\n\nimport withIconContainer from './withIconContainer';\n\nconst IconRemove: FunctionComponent = () => (\n    <svg height=\"24\" viewBox=\"0 0 24 24\" width=\"24\" xmlns=\"http://www.w3.org/2000/svg\">\n        <path d=\"M14.59 8L12 10.59 9.41 8 8 9.41 10.59 12 8 14.59 9.41 16 12 13.41 14.59 16 16 14.59 13.41 12 16 9.41 14.59 8zM12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z\" />\n    </svg>\n);\n\nexport default withIconContainer(IconRemove);\n","import classNames from 'classnames';\nimport React, { FunctionComponent } from 'react';\n\nimport { TranslatedString } from '../locale';\nimport { IconRemove } from '../ui/icon';\n\nimport './AppliedRedeemable.scss';\n\nexport interface AppliedRedeemableProps {\n    isRemoving: boolean;\n    onRemove(): void;\n}\n\nconst AppliedRedeemable: FunctionComponent<AppliedRedeemableProps> = ({\n    children,\n    isRemoving,\n    onRemove,\n}) => (\n    <div className=\"form-checklist-header\">\n        <div className=\"form-checklist-checkbox optimizedCheckout-form-checklist-checkbox\">\n            <span className=\"is-srOnly\">\n                <TranslatedString id=\"redeemable.applied_text\" />\n            </span>\n        </div>\n\n        <div className=\"form-label form-label-redeemable\">\n            <div className=\"redeemable\">\n                { children }\n                <div className=\"redeemable-column redeemable-actions\">\n                    <button\n                        className={ classNames(\n                            'redeemable-remove',\n                            { 'is-loading': isRemoving }\n                        ) }\n                        data-test=\"redeemable-remove\"\n                        disabled={ isRemoving }\n                        onClick={ onRemove }\n                        type=\"button\"\n                    >\n                        <IconRemove />\n                    </button>\n                </div>\n            </div>\n        </div>\n    </div>\n);\n\nexport default AppliedRedeemable;\n","import { Coupon, GiftCertificate } from '@bigcommerce/checkout-sdk';\nimport React, { memo, useCallback, FunctionComponent } from 'react';\n\nimport { AppliedCoupon } from '../coupon';\nimport { AppliedGiftCertificate } from '../giftCertificate';\n\nimport AppliedRedeemable from './AppliedRedeemable';\n\ninterface AppliedCouponProps {\n    coupon: Coupon;\n    isRemoving?: boolean;\n    onRemoved(code: string): void;\n}\n\nconst AppliedCouponChecklistItem: FunctionComponent<AppliedCouponProps> = ({\n    coupon,\n    onRemoved,\n    isRemoving = false,\n}) => {\n    const handleRemove = useCallback(() => {\n        onRemoved(coupon.code);\n    }, [\n        coupon,\n        onRemoved,\n    ]);\n\n    return (\n        <li className=\"form-checklist-item optimizedCheckout-form-checklist-item\">\n            <AppliedRedeemable\n                isRemoving={ isRemoving }\n                onRemove={ handleRemove }\n            >\n                <AppliedCoupon coupon={ coupon } />\n            </AppliedRedeemable>\n        </li>\n    );\n};\n\ninterface AppliedGiftCertificateProps {\n    giftCertificate: GiftCertificate;\n    isRemoving?: boolean;\n    onRemoved(code: string): void;\n}\n\nconst AppliedGiftCertificateChecklistItem: FunctionComponent<AppliedGiftCertificateProps> = ({\n    giftCertificate,\n    onRemoved,\n    isRemoving = false,\n}) => {\n    const handleRemove = useCallback(() => {\n        onRemoved(giftCertificate.code);\n    }, [\n        giftCertificate,\n        onRemoved,\n    ]);\n\n    return (\n        <li className=\"form-checklist-item optimizedCheckout-form-checklist-item\">\n            <AppliedRedeemable\n                isRemoving={ isRemoving }\n                onRemove={ handleRemove }\n            >\n                <AppliedGiftCertificate giftCertificate={ giftCertificate } />\n            </AppliedRedeemable>\n        </li>\n    );\n};\n\nexport interface AppliedRedeemablesProps {\n    coupons?: Coupon[];\n    giftCertificates?: GiftCertificate[];\n    isRemovingGiftCertificate?: boolean;\n    isRemovingCoupon?: boolean;\n    onRemovedCoupon(code: string): void;\n    onRemovedGiftCertificate(code: string): void;\n}\n\nconst AppliedRedeemables: FunctionComponent<AppliedRedeemablesProps> = ({\n    coupons = [],\n    giftCertificates = [],\n    isRemovingCoupon = false,\n    isRemovingGiftCertificate = false,\n    onRemovedCoupon,\n    onRemovedGiftCertificate,\n}) => {\n    if (!coupons.length && !giftCertificates.length) {\n        return null;\n    }\n\n    return (\n        <ul className=\"form-checklist optimizedCheckout-form-checklist\" data-test=\"redeemables-list\">\n            { coupons.map(coupon => (\n                <AppliedCouponChecklistItem\n                    coupon={ coupon }\n                    isRemoving={ isRemovingCoupon }\n                    key={ coupon.code }\n                    onRemoved={ onRemovedCoupon }\n                />\n            )) }\n\n            { giftCertificates.map(giftCertificate => (\n                <AppliedGiftCertificateChecklistItem\n                    giftCertificate={ giftCertificate }\n                    isRemoving={ isRemovingGiftCertificate }\n                    key={ giftCertificate.code }\n                    onRemoved={ onRemovedGiftCertificate }\n                />\n            )) }\n        </ul>\n    );\n};\n\nexport default memo(AppliedRedeemables);\n","import { CheckoutSelectors, RequestError } from '@bigcommerce/checkout-sdk';\nimport { memoizeOne } from '@bigcommerce/memoize';\nimport { withFormik, FieldProps, FormikProps } from 'formik';\nimport { noop } from 'lodash';\nimport React, { memo, useCallback, Fragment, FunctionComponent, KeyboardEvent } from 'react';\nimport { object, string } from 'yup';\n\nimport { preventDefault } from '../common/dom';\nimport { withLanguage, TranslatedString, WithLanguageProps } from '../locale';\nimport { Alert, AlertType } from '../ui/alert';\nimport { Button, ButtonVariant } from '../ui/button';\nimport { FormContextType, FormField, FormProvider, Label, TextInput } from '../ui/form';\nimport { Toggle } from '../ui/toggle';\n\nimport AppliedRedeemables, { AppliedRedeemablesProps } from './AppliedRedeemables';\n\nexport interface RedeemableFormValues {\n    redeemableCode: string;\n}\n\nexport type ReedemableChildrenProps = Pick<RedeemableProps,\n    'onRemovedCoupon' |\n    'onRemovedGiftCertificate' |\n    'isRemovingGiftCertificate' |\n    'isRemovingCoupon' |\n    'coupons' |\n    'giftCertificates'\n>;\n\nexport type RedeemableProps = {\n    appliedRedeemableError?: RequestError;\n    isApplyingRedeemable?: boolean;\n    isRemovingRedeemable?: boolean;\n    removedRedeemableError?: RequestError;\n    showAppliedRedeemables?: boolean;\n    shouldCollapseCouponCode?: boolean;\n    applyCoupon(code: string): Promise<CheckoutSelectors>;\n    applyGiftCertificate(code: string): Promise<CheckoutSelectors>;\n    clearError(error: Error): void;\n} & AppliedRedeemablesProps;\n\nconst Redeemable: FunctionComponent<RedeemableProps & WithLanguageProps & FormikProps<RedeemableFormValues>> = ({\n    shouldCollapseCouponCode,\n    showAppliedRedeemables,\n    ...formProps\n}) => (\n    <Toggle openByDefault={ !shouldCollapseCouponCode }>\n        { ({ toggle, isOpen }) => (\n            <Fragment>\n                { shouldCollapseCouponCode && <a\n                    className=\"redeemable-label\"\n                    data-test=\"redeemable-label\"\n                    href=\"#\"\n                    onClick={ preventDefault(toggle) }\n                >\n                    <TranslatedString id=\"redeemable.toggle_action\" />\n                </a> }\n                { !shouldCollapseCouponCode && <div className=\"redeemable-label\">\n                    <TranslatedString id=\"redeemable.toggle_action\" />\n                </div> }\n                { (isOpen || !shouldCollapseCouponCode) && <div data-test=\"redeemable-collapsable\">\n                    <RedeemableForm { ...formProps } />\n                    { showAppliedRedeemables &&\n                        <AppliedRedeemables { ...formProps } /> }\n                </div> }\n            </Fragment>\n        ) }\n    </Toggle>\n);\n\nconst RedeemableForm: FunctionComponent<Partial<RedeemableProps> & FormikProps<RedeemableFormValues>> = ({\n    appliedRedeemableError,\n    isApplyingRedeemable,\n    clearError = noop,\n    submitForm,\n}) => {\n    const handleKeyDown = useCallback(memoizeOne((setSubmitted: FormContextType['setSubmitted']) => (\n        (event: KeyboardEvent) => {\n            if (appliedRedeemableError) {\n                clearError(appliedRedeemableError);\n            }\n\n            // note: to prevent submitting main form, we manually intercept\n            // the enter key event and submit the \"subform\".\n            if (event.keyCode === 13) {\n                setSubmitted(true);\n                submitForm();\n                event.preventDefault();\n            }\n        }\n    )), [\n        appliedRedeemableError,\n        clearError,\n        submitForm,\n    ]);\n\n    const handleSubmit = useCallback(memoizeOne((setSubmitted: FormContextType['setSubmitted']) => (\n        () => {\n            setSubmitted(true);\n            submitForm();\n        }\n    )), []);\n\n    const renderLabel = useCallback((name: string) => (\n        <Label hidden htmlFor={ name }>\n            <TranslatedString id=\"redeemable.code_label\" />\n        </Label>\n    ), []);\n\n    const renderErrorMessage = useCallback((errorCode: string) => {\n        switch (errorCode) {\n        case 'min_purchase':\n            return <TranslatedString id=\"redeemable.coupon_min_order_total\" />;\n        case 'not_applicable':\n            return <TranslatedString id=\"redeemable.coupon_location_error\" />;\n        default:\n            return <TranslatedString id=\"redeemable.code_invalid_error\" />;\n        }\n    }, []);\n\n    const renderInput = useCallback((setSubmitted: FormContextType['setSubmitted']) => ({ field }: FieldProps) => (\n        <Fragment>\n            { appliedRedeemableError && appliedRedeemableError.errors && appliedRedeemableError.errors[0] &&\n                <Alert type={ AlertType.Error }>\n                    { renderErrorMessage(appliedRedeemableError.errors[0].code) }\n                </Alert> }\n\n            <div className=\"form-prefixPostfix\">\n                <TextInput\n                    { ...field }\n                    className=\"form-input optimizedCheckout-form-input\"\n                    onKeyDown={ handleKeyDown(setSubmitted) }\n                    testId=\"redeemableEntry-input\"\n                />\n\n                <Button\n                    className=\"form-prefixPostfix-button--postfix\"\n                    id=\"applyRedeemableButton\"\n                    isLoading={ isApplyingRedeemable }\n                    onClick={ handleSubmit(setSubmitted) }\n                    testId=\"redeemableEntry-submit\"\n                    variant={ ButtonVariant.Secondary }\n                >\n                    <TranslatedString id=\"redeemable.apply_action\" />\n                </Button>\n            </div>\n        </Fragment>\n    ), [\n        appliedRedeemableError,\n        handleKeyDown,\n        handleSubmit,\n        isApplyingRedeemable,\n        renderErrorMessage,\n    ]);\n\n    const renderContent = useCallback(memoizeOne(({ setSubmitted }: FormContextType) => (\n        <FormField\n            input={ renderInput(setSubmitted) }\n            label={ renderLabel }\n            name=\"redeemableCode\"\n        />\n    )), [\n        renderLabel,\n        renderInput,\n    ]);\n\n    return <fieldset className=\"form-fieldset redeemable-entry\">\n        <FormProvider>\n            { renderContent }\n        </FormProvider>\n    </fieldset>;\n};\n\nexport default withLanguage(withFormik<RedeemableProps & WithLanguageProps, RedeemableFormValues>({\n    mapPropsToValues() {\n        return {\n            redeemableCode: '',\n        };\n    },\n\n    async handleSubmit({ redeemableCode }, { props: { applyCoupon, applyGiftCertificate, clearError } }) {\n        const code = redeemableCode.trim();\n\n        try {\n            await applyGiftCertificate(code);\n        } catch (error) {\n            clearError(error);\n            applyCoupon(code);\n        }\n    },\n\n    validationSchema({ language }: RedeemableProps & WithLanguageProps) {\n        return object({\n            redeemableCode: string()\n                .required(language.translate('redeemable.code_required_error')),\n        });\n    },\n})(memo(Redeemable)));\n","import React, { ComponentType, FunctionComponent } from 'react';\n\nimport { OrderSummaryProps, OrderSummarySubtotalsProps } from '../order';\n\nimport mapToOrderSummarySubtotalsProps from './mapToOrderSummarySubtotalsProps';\nimport { WithCheckoutCartSummaryProps } from './CartSummary';\nimport Redeemable from './Redeemable';\n\nexport default function withRedeemable(\n    OriginalComponent: ComponentType<OrderSummaryProps & OrderSummarySubtotalsProps>\n): FunctionComponent<\n    WithCheckoutCartSummaryProps &\n    { headerLink?: any }\n> {\n    return props => {\n        const {\n            checkout,\n            storeCurrency,\n            shopperCurrency,\n            headerLink,\n            onRemovedCoupon,\n            onRemovedGiftCertificate,\n            storeCreditAmount,\n            ...redeemableProps\n        } = props;\n\n        return (\n            <OriginalComponent\n                { ...mapToOrderSummarySubtotalsProps(checkout) }\n                additionalLineItems={\n                    <Redeemable { ...{\n                        ...redeemableProps,\n                        onRemovedCoupon,\n                        onRemovedGiftCertificate,\n                    } }\n                    />\n                }\n                headerLink={ headerLink }\n                lineItems={ checkout.cart.lineItems }\n                onRemovedCoupon={ onRemovedCoupon }\n                onRemovedGiftCertificate={ onRemovedGiftCertificate }\n                shopperCurrency={ shopperCurrency }\n                storeCreditAmount={ storeCreditAmount }\n                storeCurrency={ storeCurrency }\n                total={ checkout.outstandingBalance }\n            />\n        );\n    };\n}\n","import { Checkout } from '@bigcommerce/checkout-sdk';\n\nimport { OrderSummarySubtotalsProps } from '../order';\nimport { hasSelectedShippingOptions } from '../shipping';\n\nexport default function mapToOrderSummarySubtotalsProps({\n    subtotal,\n    cart: { discountAmount },\n    giftCertificates,\n    consignments,\n    handlingCostTotal,\n    shippingCostBeforeDiscount,\n    giftWrappingCostTotal,\n    coupons,\n    taxes,\n}: Checkout): OrderSummarySubtotalsProps {\n    return {\n        subtotalAmount: subtotal,\n        discountAmount,\n        giftCertificates,\n        giftWrappingAmount: giftWrappingCostTotal,\n        shippingAmount: hasSelectedShippingOptions(consignments) ?\n            shippingCostBeforeDiscount :\n            undefined,\n        handlingAmount: handlingCostTotal,\n        coupons,\n        taxes,\n    };\n}\n"],"sourceRoot":""}