{"version":3,"sources":["webpack://checkout/./src/app/ui/form/CheckboxInput.tsx","webpack://checkout/./src/app/ui/form/TextArea.tsx","webpack://checkout/./src/app/ui/form/CheckboxFormField.tsx","webpack://checkout/./src/app/ui/modal/ModalTrigger.tsx","webpack://checkout/./src/app/cart/mapToRedeemableProps.ts","webpack://checkout/./src/app/common/utility/parseAnchor.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/static/img/installment.png","webpack://checkout/./src/app/termsConditions/TermsConditionsField.tsx","webpack://checkout/./src/app/ui/modal/ModalLink.tsx","webpack://checkout/./src/app/ui/text/MultiLineText.tsx","webpack://checkout/./src/app/payment/mapSubmitOrderErrorMessage.ts","webpack://checkout/./src/app/payment/creditCard/unformatCreditCardExpiryDate.ts","webpack://checkout/./src/app/payment/paymentMethod/PaymentMethodProviderType.ts","webpack://checkout/./src/app/payment/paymentMethod/getUniquePaymentMethodId.ts","webpack://checkout/./src/app/payment/mapToOrderRequestBody.ts","webpack://checkout/./src/app/payment/creditCard/unformatCreditCardNumber.ts","webpack://checkout/./src/app/payment/paymentMethod/PaymentMethodId.ts","webpack://checkout/./src/app/payment/PaymentContext.tsx","webpack://checkout/./src/app/termsConditions/TermsConditions.tsx","webpack://checkout/./src/app/payment/getPaymentValidationSchema.ts","webpack://checkout/./src/app/termsConditions/getTermsConditionsValidationSchema.ts","webpack://checkout/./src/app/ui/tooltip/TooltipTrigger.tsx","webpack://checkout/./src/app/ui/tooltip/Tooltip.tsx","webpack://checkout/./src/app/payment/storeCredit/StoreCreditField.tsx","webpack://checkout/./src/app/payment/PaymentRedeemables.tsx","webpack://checkout/./src/app/payment/SpamProtectionField.tsx","webpack://checkout/./src/app/payment/PaymentForm.tsx","webpack://checkout/./src/app/payment/bcsPayment/hooks/usePayments.ts","webpack://checkout/./src/app/payment/bcsPayment/BcsPaymentBambooCard.tsx","webpack://checkout/./src/app/payment/bcsPayment/BcsPaymentButton.tsx","webpack://checkout/./src/app/payment/bcsPayment/BcsPaymentBambooPhysicalNetwork.tsx","webpack://checkout/./src/app/payment/bcsPayment/BcsPaymentFieldPayment.tsx","webpack://checkout/./src/app/payment/bcsPayment/BcsPaymentOffline.tsx","webpack://checkout/./src/app/payment/bcsPayment/BcsPaymentListOfPayment.tsx","webpack://checkout/./src/app/payment/bcsPayment/BcsPayment.tsx","webpack://checkout/./src/app/payment/Payment.tsx","webpack://checkout/./src/app/common/error/isCartChangedError.ts"],"names":["CheckboxInput","ref","additionalClassName","label","id","rest","className","type","htmlFor","TextArea","testId","disabled","labelContent","onChange","name","renderField","field","checked","value","render","state","isOpen","canHandleEvent","handleOpen","setState","handleClose","componentDidMount","this","componentWillUnmount","props","children","modal","onClick","onRequestClose","mapToRedeemableProps","context","checkoutService","data","getConfig","getCoupons","getGiftCertificates","statuses","isApplyingCoupon","isApplyingGiftCertificate","isRemovingCoupon","isRemovingGiftCertificate","errors","getApplyCouponError","getApplyGiftCertificateError","getRemoveCouponError","getRemoveGiftCertificateError","config","appliedRedeemableError","applyCoupon","applyGiftCertificate","clearError","coupons","giftCertificates","isApplyingRedeemable","onRemovedCoupon","removeCoupon","onRemovedGiftCertificate","removeGiftCertificate","removedRedeemableError","shouldCollapseCouponCode","checkoutSettings","isCouponCodeCollapsed","parseAnchor","text","div","document","createElement","innerHTML","anchor","querySelector","anchorSiblings","split","outerHTML","coupon","displayName","TranslatedString","code","giftCertificate","ShopperCurrency","amount","used","remaining","withIconContainer","height","viewBox","width","xmlns","d","isRemoving","onRemove","AppliedCouponChecklistItem","onRemoved","handleRemove","AppliedGiftCertificateChecklistItem","length","map","key","RedeemableForm","submitForm","handleKeyDown","setSubmitted","event","keyCode","preventDefault","handleSubmit","renderLabel","Label","hidden","renderErrorMessage","errorCode","renderInput","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","href","module","exports","TermsConditionsType","body","header","renderModal","Modal","additionalBodyClassName","footer","size","Small","shouldShowCloseButton","ModalTrigger","line","TermsConditionsModalCheckboxField","terms","translatedLabel","url","parsedLabel","ModalHeader","CheckboxFormField","TermsConditionsCheckboxField","TranslatedHtml","TermsConditionsTextField","defaultValue","readOnly","Fieldset","legend","Legend","isTermsConditionsTextArea","isTermsConditionModal","mapSubmitOrderErrorMessage","error","shouldLocalise","message","err","join","mapSubmitOrderErrorTitle","unformatCreditCardExpiryDate","RegExp","month","year","test","slice","PaymentMethodProviderType","getUniquePaymentMethodId","methodId","gatewayId","mapToOrderRequestBody","isPaymentDataRequired","paymentProviderRadio","values","separator","indexOf","undefined","parseUniquePaymentMethodId","payload","payment","paymentData","ccExpiry","ccNumber","replace","PaymentMethodId","TermsConditions","termsConditionsUrl","termsConditionsText","TermsConditionsField","Link","getPaymentValidationSchema","additionalValidation","isTermsConditionsRequired","schemaFields","schemaFieldsWithTerms","concat","oneOf","getTermsConditionsValidationSchema","shouldShow","handleShow","handleHide","placement","tooltip","onBlur","onFocus","onMouseEnter","onMouseLeave","modifiers","hide","enabled","flip","preventOverflow","style","defaultProps","withCurrency","availableStoreCredit","currency","usableStoreCredit","isStoreCreditApplied","handleChange","target","storeCredit","toCustomerCurrency","withCheckout","redeemableProps","Redeemable","shouldShowRetryButton","handleRetry","verify","isExecutingSpamCheck","LoadingOverlay","didExceedSpamLimit","executeSpamCheck","onUnhandledError","paymentFormConfig","defaultGatewayId","ccCustomerCode","ccCvv","ccDocument","customerEmail","customerMobile","ccName","instrumentId","shouldSaveInstrument","hostedForm","cardType","cardCode","cardCodeVerification","cardExpiry","cardName","cardNumber","cardNumberVerification","onSubmit","onStoreCreditChange","shouldExecuteSpamCheck","Form","payments","setPayments","singular_suffix","plural_suffix","installmentsPreffix","setInstallmentsPreffix","loading","setLoading","paymentMethodsData","storeid","window","BcsPayments","BCSuite","getPaymentMethods","checkoutConfig","checkoutId","then","paymentMethods","installment","account","storeEntity","getAccount","response","init","reloadPayments","handleSelect","installments","selectOption","options","display","alt","src","option","frameBorder","setMessage","bcSuite","storeId","siteId","siteEntity","processPurchase","res","status","urlRedirect","show","pathQuery","includes","location","origin","color","dangerouslySetInnerHTML","__html","description","checkoutDisplayFormat","paymentBrandLogos","logo","image","paymentButtonText","isVisible","setIsVisible","setInstallments","current","handleCardPayment","PWCheckout","SetProperties","email","email_hide","button_label","form_id","autoSubmit","iframeId","empty","SetStyle","backgroundColor","buttonColor","checkoutStyleConfig","buttonPrimary","buttonHoverColor","backgroundColorHover","buttonTextColor","buttonTextHoverColor","colorHover","inputBackgroundColor","inputTextColor","inputErrorColor","inputAddonBackgroundColor","labelColor","Bind","token","bcsPayments","Installments","brandId","brand","bankId","bank","paymentType","paymentTypeId","LoadIframe","Number","checkoutPaymentSelected","provider","setTimeout","preferenceId","MercadoPago","publicKey","locale","checkout","preference","container","handleMercadoPago","CheckoutContext","checkoutState","console","log","getState","getOrder","baseAmount","isReady","shouldDisableSubmit","shouldHidePaymentSubmitButton","validationSchemas","submitFunctions","getContextValue","disableSubmit","setSubmit","setValidationSchema","hidePaymentSubmitButton","method","uniqueId","gateway","handleBeforeUnload","defaultMethod","isSubmittingOrder","selectedMethod","Hosted","PPSDK","Amazon","AmazonPay","Checkoutcom","Converge","Laybuy","Quadpay","SagePay","Sezzle","Zip","AdyenV2","AdyenV2GooglePay","Afterpay","Clearpay","Mollie","StripeV3","returnValue","handleCloseModal","_","cartUrl","loadCheckout","errorType","isRequestError","headers","top","assign","handleStoreCreditChange","useStoreCredit","applyStoreCredit","loadPaymentMethods","onCartChangedError","onSubmitError","submitOrder","customSubmit","setSelectedMethod","fn","schema","finalizeOrderIfNeeded","onFinalize","onFinalizeError","onReady","addEventListener","componentDidUpdate","checkEmbeddedSupport","removeEventListener","isInitializingPayment","isUsingMultiShipping","methods","uniqueSelectedMethodId","Provider","unmountContentWhenLoading","defaultMethodId","onMethodSelect","renderOrderErrorModal","renderEmbeddedSupportErrorModal","finalizeOrderError","shouldLocaliseErrorMessages","ErrorModal","bind","onClose","title","mapToPaymentProps","getCheckout","getCustomer","getConsignments","getPaymentMethod","getFinalizeOrderError","getSubmitOrderError","customer","consignments","isComplete","selectedPaymentMethod","filteredMethods","isTermsConditionsEnabled","features","termsConditionsType","termsCondtitionsText","termsCondtitionsUrl","selectedPayment","providerType","filter","Bolt","initializationData","showInCheckout","providerId","hasDefaultStoredInstrument","links","cartLink","submitOrderError","grandTotal","Math","min"],"mappings":"0KAaMA,EAAgB,sBAAW,SAC7B,EAMAC,GALI,IAAAC,EAAmB,sBACnBC,EAAK,QACLC,EAAE,KACCC,EAAI,mBAJX,sCAOC,OACD,oCACI,kBAAC,IAAK,sBACGA,EAAI,CACTC,UAAY,IACR,gBACA,kCACAJ,GAEJE,GAAKA,EACLH,IAAMA,EACNM,KAAK,cAET,kBAAC,IAAK,CAACC,QAAUJ,GACXD,OAKC,O,8EChCTM,EAAW,sBAAW,SACxB,EACAR,GADE,IAAAC,EAAmB,sBAAEQ,EAAM,SAAEJ,EAAS,YAAKD,EAAI,mBAAjD,8CAEC,OACD,mDACSA,EAAI,CACTC,UAAYA,GAAa,IACrB,aACA,+BACAJ,GACH,YACWQ,EACZT,IAAMA,QAIC,O,iGC+BA,oBAtCsD,SAAC,G,IAClEC,EAAmB,sBACnB,IAAAS,gBAAQ,IAAG,GAAK,EAChBC,EAAY,eACZC,EAAQ,WACRC,EAAI,OACJV,EAAE,KAEIW,EAAc,uBAAY,SAAC,G,IAAEC,EAAK,QAAmB,OACvD,kBAAC,WAAQ,KACH,kBAAC,IAAa,sBACPA,EAAK,CACVC,UAAYD,EAAME,MAClBP,SAAWA,EACXP,GAAKA,G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JyC,kBAAmBgJ,EAASsH,WAAa,EACrCC,KAAKC,IAAIxH,EAASsH,WAAYrB,EAAS7O,aAAe,GAAK,GAIxD,iBAAAjH,EAAA,GAAa,OAAAmH,EAAA,GAAaoO,GAAb,CAAgC","file":"payment-0be974b5.js","sourcesContent":["import classNames from 'classnames';\nimport React, { forwardRef, ReactNode, Ref } from 'react';\n\nimport Input, { InputProps } from './Input';\nimport Label from './Label';\n\nexport interface CheckboxInputProps extends InputProps {\n    additionalClassName?: string;\n    label: ReactNode;\n    value: string;\n    checked: boolean;\n}\n\nconst CheckboxInput = forwardRef((\n    {\n        additionalClassName,\n        label,\n        id,\n        ...rest\n    }: CheckboxInputProps,\n    ref: Ref<HTMLInputElement>\n) => (\n    <>\n        <Input\n            { ...rest }\n            className={ classNames(\n                'form-checkbox',\n                'optimizedCheckout-form-checkbox',\n                additionalClassName\n            ) }\n            id={ id }\n            ref={ ref }\n            type=\"checkbox\"\n        />\n        <Label htmlFor={ id }>\n            { label }\n        </Label>\n    </>\n));\n\nexport default CheckboxInput;\n","import classNames from 'classnames';\nimport React, { forwardRef, Ref, TextareaHTMLAttributes } from 'react';\n\nexport interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n    additionalClassName?: string;\n    testId?: string;\n}\n\nconst TextArea = forwardRef((\n    { additionalClassName, testId, className, ...rest }: TextAreaProps,\n    ref: Ref<HTMLTextAreaElement>\n) => (\n    <textarea\n        { ...rest }\n        className={ className || classNames(\n            'form-input',\n            'optimizedCheckout-form-input',\n            additionalClassName\n        ) }\n        data-test={ testId }\n        ref={ ref }\n    />\n));\n\nexport default TextArea;\n","import { FieldProps } from 'formik';\nimport { kebabCase } from 'lodash';\nimport React, { memo, useCallback, Fragment, FunctionComponent, ReactNode } from 'react';\n\nimport BasicFormField from './BasicFormField';\nimport CheckboxInput from './CheckboxInput';\nimport FormFieldError from './FormFieldError';\n\nexport interface CheckboxFormFieldProps {\n    additionalClassName?: string;\n    disabled?: boolean;\n    name: string;\n    id?: string;\n    labelContent: ReactNode;\n    onChange?(isChecked: boolean): void;\n}\n\nconst CheckboxFormField: FunctionComponent<CheckboxFormFieldProps> = ({\n    additionalClassName,\n    disabled = false,\n    labelContent,\n    onChange,\n    name,\n    id,\n}) => {\n    const renderField = useCallback(({ field }: FieldProps) => (\n        <Fragment>\n            { <CheckboxInput\n                { ...field }\n                checked={ !!field.value }\n                disabled={ disabled }\n                id={ id || field.name }\n                label={ labelContent }\n            /> }\n\n            <FormFieldError\n                name={ name }\n                testId={ `${kebabCase(name)}-field-error-message` }\n            />\n        </Fragment>\n    ), [\n        disabled,\n        id,\n        labelContent,\n        name,\n    ]);\n\n    return <BasicFormField\n        additionalClassName={ additionalClassName }\n        name={ name }\n        onChange={ onChange }\n        render={ renderField }\n    />;\n};\n\nexport default memo(CheckboxFormField);\n","import React, { Component, Fragment, MouseEventHandler, ReactNode } from 'react';\n\nexport interface ModalTriggerProps {\n    children(props: { onClick: MouseEventHandler }): ReactNode;\n    modal(props: ModalTriggerModalProps): ReactNode;\n}\n\nexport interface ModalTriggerModalProps {\n    isOpen: boolean;\n    onRequestClose(): void;\n}\n\nexport interface ModalTriggerState {\n    isOpen: boolean;\n}\n\nexport default class ModalTrigger extends Component<ModalTriggerProps, ModalTriggerState> {\n    state = {\n        isOpen: false,\n    };\n\n    private canHandleEvent: boolean = false;\n\n    componentDidMount(): void {\n        this.canHandleEvent = true;\n    }\n\n    componentWillUnmount(): void {\n        this.canHandleEvent = false;\n    }\n\n    render() {\n        const { children, modal } = this.props;\n        const { isOpen } = this.state;\n\n        return (\n            <Fragment>\n                { children({ onClick: this.handleOpen }) }\n\n                { modal({\n                    isOpen,\n                    onRequestClose: this.handleClose,\n                }) }\n            </Fragment>\n        );\n    }\n\n    private handleOpen: () => void = () => {\n        if (!this.canHandleEvent) {\n            return;\n        }\n\n        this.setState({\n            isOpen: true,\n        });\n    };\n\n    private handleClose: () => void = () => {\n        if (!this.canHandleEvent) {\n            return;\n        }\n\n        this.setState({\n            isOpen: false,\n        });\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","export default function parseAnchor(text: string): string[] {\n    const div = document.createElement('div');\n    div.innerHTML = text;\n\n    const anchor = div.querySelector('a');\n\n    if (!anchor) {\n        return [];\n    }\n\n    const anchorSiblings = div.innerHTML.split(anchor.outerHTML);\n\n    return [ anchorSiblings[0], anchor.text, anchorSiblings[1] ];\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","module.exports = __webpack_public_path__ + \"static/installment-8d8e4845.png\";","import { FieldProps } from 'formik';\nimport React, { memo, useCallback, useMemo, FunctionComponent } from 'react';\n\nimport { parseAnchor } from '../common/utility';\nimport { withLanguage, TranslatedHtml, TranslatedString, WithLanguageProps } from '../locale';\nimport { CheckboxFormField, Fieldset, FormField, Legend, TextArea } from '../ui/form';\nimport { ModalHeader, ModalLink } from '../ui/modal';\nimport { MultiLineText } from '../ui/text';\n\nexport enum TermsConditionsType {\n    Link = 'link',\n    TextArea = 'textarea',\n    Modal = 'modal',\n}\n\nexport type TermsConditionsFieldProps = TermsConditionsLinkFieldProps | TermsConditionsTextAreaFieldProps;\n\ninterface TermsConditionsLinkFieldProps {\n    name: string;\n    type: TermsConditionsType.Link;\n    url: string;\n}\n\ninterface TermsConditionsTextAreaFieldProps {\n    name: string;\n    terms: string;\n    type: TermsConditionsType.TextArea | TermsConditionsType.Modal;\n}\n\ninterface TermsConditionsTextFieldProps {\n    name: string;\n    terms: string;\n}\n\nconst BaseTermsConditionsModalCheckboxField: FunctionComponent<TermsConditionsTextFieldProps & WithLanguageProps> = ({\n    language,\n    name,\n    terms,\n}) => {\n    const translatedLabel = language.translate('terms_and_conditions.agreement_with_link_text', { url: '' });\n    const parsedLabel = parseAnchor(translatedLabel);\n\n    const labelContent = parsedLabel ?\n        (<>\n            { parsedLabel[0] }\n            <ModalLink\n                body={ <MultiLineText>{ terms }</MultiLineText> }\n                header={\n                    <ModalHeader>\n                        <TranslatedString id=\"terms_and_conditions.heading\" />\n                    </ModalHeader>\n                }\n            >\n                { parsedLabel[1] }\n            </ModalLink>\n            { parsedLabel[2] }\n        </>) :\n        translatedLabel;\n\n    return (\n        <CheckboxFormField\n            labelContent={ labelContent }\n            name={ name }\n        />\n    );\n};\n\nconst TermsConditionsModalCheckboxField = withLanguage(BaseTermsConditionsModalCheckboxField);\n\ninterface TermsConditionsCheckboxFieldProps {\n    name: string;\n    type: TermsConditionsType;\n    url?: string;\n}\n\nconst TermsConditionsCheckboxField: FunctionComponent<TermsConditionsCheckboxFieldProps> = ({\n    name,\n    url,\n}) => {\n    const labelContent = useMemo(() => (url ?\n        <TranslatedHtml data={ { url } } id=\"terms_and_conditions.agreement_with_link_text\" /> :\n        <TranslatedString id=\"terms_and_conditions.agreement_text\" />\n    ), [url]);\n\n    return (\n        <CheckboxFormField\n            labelContent={ labelContent }\n            name={ name }\n        />\n    );\n};\n\nconst TermsConditionsTextField: FunctionComponent<TermsConditionsTextFieldProps> = ({\n    name,\n    terms,\n}) => {\n    const renderInput = useCallback(({ field }: FieldProps) => (\n        <TextArea\n            defaultValue={ terms }\n            name={ field.name }\n            readOnly\n        />\n    ), [terms]);\n\n    return (\n        <FormField\n            input={ renderInput }\n            name={ `${name}Text` }\n        />\n    );\n};\n\nconst TermsConditionsFieldset: FunctionComponent<TermsConditionsFieldProps> = props => {\n    const { type } = props;\n\n    return (\n        <Fieldset\n            additionalClassName=\"checkout-terms\"\n            legend={ (\n                <Legend>\n                    <TranslatedString id=\"terms_and_conditions.terms_and_conditions_heading\" />\n                </Legend>\n            ) }\n        >\n            { isTermsConditionsTextArea(props) && <TermsConditionsTextField { ...props } /> }\n            { isTermsConditionModal(props) && type === TermsConditionsType.Modal ?\n                <TermsConditionsModalCheckboxField { ...props } /> :\n                <TermsConditionsCheckboxField { ...props } /> }\n        </Fieldset>\n    );\n};\n\nfunction isTermsConditionsTextArea(props: any): props is TermsConditionsTextFieldProps {\n    return props.type === TermsConditionsType.TextArea;\n}\n\nfunction isTermsConditionModal(props: any): props is TermsConditionsTextFieldProps {\n    return props.type === TermsConditionsType.Modal;\n}\n\nexport default memo(TermsConditionsFieldset);\n","import React, { useCallback, FunctionComponent, ReactNode } from 'react';\n\nimport { preventDefault } from '../../common/dom';\nimport { TranslatedString } from '../../locale';\nimport { Button, ButtonSize } from '../button';\n\nimport Modal from './Modal';\nimport './ModalLink.scss';\nimport ModalTrigger, { ModalTriggerModalProps } from './ModalTrigger';\n\nexport interface ModalLinkProps {\n    header: ReactNode;\n    body: ReactNode;\n}\n\nconst ModalLink: FunctionComponent<ModalLinkProps> = ({\n    children,\n    body,\n    header,\n}) => {\n    const renderModal = useCallback((props: ModalTriggerModalProps) => (\n        <Modal\n            { ...props }\n            additionalBodyClassName=\"modal--withText\"\n            footer={ (\n                <Button\n                    onClick={ props.onRequestClose }\n                    size={ ButtonSize.Small }\n                >\n                    <TranslatedString id=\"common.ok_action\" />\n                </Button>\n            ) }\n            header={ header }\n            shouldShowCloseButton={ true }\n        >\n            { body }\n        </Modal>\n    ), [header, body]);\n\n    return (\n        <ModalTrigger modal={ renderModal }>\n            { ({ onClick }) => (\n                <a onClick={ preventDefault(onClick) }>\n                    { children }\n                </a>\n            ) }\n        </ModalTrigger>\n    );\n};\n\nexport default ModalLink;\n","import React, { Fragment, FunctionComponent } from 'react';\n\nconst MultiLineText: FunctionComponent<{ children: string }> = ({ children }) => (\n    <>\n        { children.split('\\n').map((line, key) =>\n            <Fragment key={ key }>\n                { line }\n                <br />\n            </Fragment>\n        ) }\n    </>\n);\n\nexport default MultiLineText;\n","import { TranslationData } from '@bigcommerce/checkout-sdk';\nimport { includes } from 'lodash';\n\nexport default function mapSubmitOrderErrorMessage(\n    error: any,\n    translate: (key: string, data?: TranslationData) => string,\n    shouldLocalise: boolean\n): string {\n    switch (error.type) {\n        case 'payment_cancelled':\n            return translate('payment.payment_cancelled');\n\n        case 'payment_method_invalid':\n            return translate('payment.payment_method_disabled_error');\n\n        case 'cart_changed':\n            return translate('shipping.cart_change_error');\n\n        default:\n            if (includes([\n                'order_could_not_be_finalized_error',\n                'provider_fatal_error',\n                'payment_invalid',\n                'provider_error',\n                'provider_widget_error',\n                'user_payment_error',\n            ], error.body && error.body.type)) {\n                return translate('payment.payment_method_error', { message: error.message });\n            }\n\n            if (shouldLocalise && error.body && error.body.errors && error.body.errors.length) {\n                const messages = error.body.errors.map((err: { code: any }) => translate(`payment.errors.${err.code}`));\n\n                return messages.join(' ');\n            }\n\n            if (error.message) {\n                return error.message;\n            }\n\n            return error.type === 'unrecoverable' ?\n                translate('common.unavailable_error') :\n                translate('payment.place_order_error');\n    }\n}\n\nexport function mapSubmitOrderErrorTitle(\n    error: any,\n    translate: (key: string, data?: TranslationData) => string\n): string {\n    if (error.type === 'unrecoverable') {\n        return translate('common.unavailable_heading');\n    }\n\n    return translate('common.error_heading');\n}\n","export interface ExpiryDate {\n    month: string;\n    year: string;\n}\n\nexport default function unformatCreditCardExpiryDate(value: string): ExpiryDate {\n    const separator = '/';\n    const [month = '', year = ''] = value.split(new RegExp(`\\\\s*${separator}\\\\s*`));\n\n    if (!/^\\d+$/.test(month) || !/^\\d+$/.test(year)) {\n        return { month: '', year: '' };\n    }\n\n    return {\n        month: month.length === 1 ? `0${month}` : month.slice(0, 2),\n        year: year.length === 2 ? `20${year}` : year.slice(0, 4),\n    };\n}\n","enum PaymentMethodProviderType {\n    Api = 'PAYMENT_TYPE_API',\n    Hosted = 'PAYMENT_TYPE_HOSTED',\n    Offline = 'PAYMENT_TYPE_OFFLINE',\n    PPSDK = 'PAYMENT_TYPE_SDK',\n}\n\nexport default PaymentMethodProviderType;\n","import { compact } from 'lodash';\n\nexport default function getUniquePaymentMethodId(methodId: string, gatewayId?: string): string {\n    return compact([gatewayId, methodId]).join('-');\n}\n\nexport function parseUniquePaymentMethodId(value: string): { methodId: string; gatewayId?: string } {\n    const [gatewayId, methodId] = value.indexOf('-') > -1 ? value.split('-') : [undefined, value];\n\n    return { gatewayId, methodId };\n}\n","import { OrderPaymentRequestBody, OrderRequestBody } from '@bigcommerce/checkout-sdk';\nimport { isEmpty, isNil, omitBy } from 'lodash';\n\nimport { unformatCreditCardExpiryDate, unformatCreditCardNumber } from './creditCard';\nimport { parseUniquePaymentMethodId } from './paymentMethod';\nimport { PaymentFormValues } from './PaymentForm';\n\nexport default function mapToOrderRequestBody(\n    { paymentProviderRadio, ...values }: PaymentFormValues,\n    isPaymentDataRequired: boolean\n): OrderRequestBody {\n    if (!isPaymentDataRequired) {\n        return {};\n    }\n\n    const { methodId, gatewayId } = parseUniquePaymentMethodId(paymentProviderRadio);\n    const payload: OrderRequestBody = {\n        payment: { gatewayId, methodId },\n    };\n    const paymentData = omitBy({\n        ...values,\n        ccExpiry: 'ccExpiry' in values && values.ccExpiry ? unformatCreditCardExpiryDate(values.ccExpiry) : null,\n        ccNumber: 'ccNumber' in values && values.ccNumber ? unformatCreditCardNumber(values.ccNumber) : null,\n    }, isNil) as OrderPaymentRequestBody['paymentData'];\n\n    if (payload.payment && !isEmpty(paymentData)) {\n        payload.payment.paymentData = paymentData;\n    }\n\n    return payload;\n}\n","import { number } from 'card-validator';\n\nexport default function unformatCreditCardNumber(value: string, separator: string = ' '): string {\n    const { card } = number(value);\n\n    if (!card) {\n        return value;\n    }\n\n    return value.replace(new RegExp(separator, 'g'), '');\n}\n","enum PaymentMethodId {\n    Adyen = 'adyen',\n    AdyenV2 = 'adyenv2',\n    AdyenV2GooglePay = 'googlepayadyenv2',\n    Affirm = 'affirm',\n    Afterpay = 'afterpay',\n    Amazon = 'amazon',\n    AmazonPay = 'amazonpay',\n    Barclaycard = 'barclaycard',\n    BlueSnapV2 = 'bluesnapv2',\n    Boleto = 'boleto',\n    Bolt = 'bolt',\n    Braintree = 'braintree',\n    AuthorizeNetGooglePay = 'googlepayauthorizenet',\n    BraintreeGooglePay = 'googlepaybraintree',\n    BraintreeVisaCheckout = 'braintreevisacheckout',\n    CCAvenueMars = 'ccavenuemars',\n    ChasePay = 'chasepay',\n    Checkoutcom = 'checkoutcom',\n    CheckoutcomGooglePay = 'googlepaycheckoutcom',\n    Clearpay = 'clearpay',\n    Converge = 'converge',\n    CybersourceV2GooglePay = 'googlepaycybersourcev2',\n    DigitalRiver = 'digitalriver',\n    Fawry = 'fawry',\n    Ideal = 'ideal',\n    Klarna = 'klarna',\n    Laybuy = 'laybuy',\n    Masterpass = 'masterpass',\n    Mollie = 'mollie',\n    Moneris = 'moneris',\n    Oxxo = 'oxxo',\n    OrbitalGooglePay = 'googlepayorbital',\n    PaypalExpress = 'paypalexpress',\n    PaypalPaymentsPro = 'paypal',\n    PaypalCommerce = 'paypalcommerce',\n    PaypalCommerceCredit = 'paypalcommercecredit',\n    PaypalCommerceCreditCards = 'paypalcommercecreditcards',\n    PaypalCommerceAlternativeMethod = 'paypalcommercealternativemethods',\n    Qpay = 'qpay',\n    Quadpay = 'quadpay',\n    SagePay = 'sagepay',\n    Sepa = 'sepa',\n    Sezzle = 'sezzle',\n    SquareV2 = 'squarev2',\n    StripeGooglePay = 'googlepaystripe',\n    StripeV3 = 'stripev3',\n    Zip = 'zip',\n}\n\nexport default PaymentMethodId;\n","import { PaymentMethod } from '@bigcommerce/checkout-sdk';\nimport { createContext } from 'react';\nimport { ObjectSchema } from 'yup';\n\nimport { PaymentFormValues } from './PaymentForm';\n\nexport interface PaymentContextProps {\n    disableSubmit(method: PaymentMethod, disabled?: boolean): void;\n    // NOTE: This prop allows certain payment methods to override the default\n    // form submission behaviour. It is not recommended to use it because\n    // generally speaking we want to avoid method-specific snowflake behaviours.\n    // Nevertheless, because of some product / UX decisions made in the past\n    // (i.e.: Amazon), we have to have this backdoor so we can preserve these\n    // snowflake behaviours. In the future, if we decide to change the UX, we\n    // can remove this prop.\n    setSubmit(method: PaymentMethod, fn: ((values: PaymentFormValues) => void) | null): void;\n    setValidationSchema(method: PaymentMethod, schema: ObjectSchema<Partial<PaymentFormValues>> | null): void;\n    hidePaymentSubmitButton(method: PaymentMethod, hidden?: boolean): void;\n}\n\nconst PaymentContext = createContext<PaymentContextProps | undefined>(undefined);\n\nexport default PaymentContext;\n","import React, { FunctionComponent } from 'react';\n\nimport TermsConditionsField, { TermsConditionsType } from './TermsConditionsField';\n\nexport interface TermsConditionsProps {\n    termsConditionsText?: string;\n    termsConditionsUrl?: string;\n}\n\nexport const TermsConditions: FunctionComponent<TermsConditionsProps> = ({\n    termsConditionsUrl,\n    termsConditionsText = '',\n}) => (\n    <>\n        { termsConditionsUrl ?\n            <TermsConditionsField\n                name=\"terms\"\n                type={ TermsConditionsType.Link }\n                url={ termsConditionsUrl }\n            /> :\n            <TermsConditionsField\n                name=\"terms\"\n                terms={ termsConditionsText }\n                type={ TermsConditionsType.TextArea }\n            /> }\n    </>\n);\n","import { LanguageService } from '@bigcommerce/checkout-sdk';\nimport { object, string, ObjectSchema, StringSchema } from 'yup';\n\nimport { getTermsConditionsValidationSchema } from '../termsConditions';\n\nimport { PaymentFormValues } from './PaymentForm';\n\nexport interface PaymentValidationSchemaOptions {\n    additionalValidation?: ObjectSchema<Partial<PaymentFormValues>>;\n    isTermsConditionsRequired: boolean;\n    language: LanguageService;\n}\n\nexport default function getPaymentValidationSchema({\n    additionalValidation,\n    isTermsConditionsRequired,\n    language,\n}: PaymentValidationSchemaOptions): ObjectSchema<PaymentFormValues> {\n    const schemaFields: {\n        paymentProviderRadio: StringSchema;\n    } = {\n        paymentProviderRadio: string().required(),\n    };\n\n    const schemaFieldsWithTerms = object(schemaFields)\n        .concat(getTermsConditionsValidationSchema({ isTermsConditionsRequired, language }));\n\n    return additionalValidation ?\n        schemaFieldsWithTerms.concat(additionalValidation as any) :\n        schemaFieldsWithTerms;\n}\n","import { LanguageService } from '@bigcommerce/checkout-sdk';\nimport { boolean, object, BooleanSchema, ObjectSchema } from 'yup';\n\nexport interface TermsConditionValidationSchemaOptions {\n    isTermsConditionsRequired: boolean;\n    language: LanguageService;\n}\n\nexport default function getTermsConditionsValidationSchema({\n    isTermsConditionsRequired,\n    language,\n}: TermsConditionValidationSchemaOptions): ObjectSchema<{ terms?: boolean }> {\n    const schemaFields: {\n        terms?: BooleanSchema;\n    } = {};\n\n    if (isTermsConditionsRequired) {\n        schemaFields.terms = boolean()\n            .oneOf([true], language.translate('terms_and_conditions.agreement_required_error'));\n    }\n\n    return object(schemaFields);\n}\n","import { Placement } from 'popper.js';\nimport React, { Component, ReactEventHandler, ReactNode } from 'react';\nimport { Manager, Popper, Reference } from 'react-popper';\n\nexport interface TooltipTriggerProps {\n    placement?: Placement;\n    tooltip: ReactNode;\n}\n\nexport interface TooltipTriggerState {\n    shouldShow: boolean;\n}\n\nexport default class TooltipTrigger extends Component<TooltipTriggerProps, TooltipTriggerState> {\n    static defaultProps = {\n        placement: 'bottom',\n    };\n\n    state: Readonly<TooltipTriggerState> = {\n        shouldShow: false,\n    };\n\n    render() {\n        const { children, placement, tooltip } = this.props;\n        const { shouldShow } = this.state;\n\n        return (\n            <Manager>\n                <Reference>\n                    { ({ ref }) => (\n                        <span\n                            onBlur={ this.handleHide }\n                            onFocus={ this.handleShow }\n                            onMouseEnter={ this.handleShow }\n                            onMouseLeave={ this.handleHide }\n                            ref={ ref }\n                        >\n                            { children }\n                        </span>\n                    ) }\n                </Reference>\n\n                <Popper\n                    modifiers={ {\n                        hide: { enabled: false },\n                        flip: { enabled: false },\n                        preventOverflow: { enabled: false },\n                    } }\n                    placement={ placement }\n                >\n                    { ({ ref, style }) => (\n                        shouldShow && <div\n                            ref={ ref }\n                            style={ style }\n                        >\n                            { tooltip }\n                        </div>\n                    ) }\n                </Popper>\n            </Manager>\n        );\n    }\n\n    private handleShow: ReactEventHandler<HTMLElement> = () => {\n        this.setState({ shouldShow: true });\n    };\n\n    private handleHide: ReactEventHandler<HTMLElement> = () => {\n        this.setState({ shouldShow: false });\n    };\n}\n","import React, { FunctionComponent } from 'react';\n\nimport './Tooltip.scss';\n\nexport interface TooltipProps {\n    testId?: string;\n}\n\nconst Tooltip: FunctionComponent<TooltipProps> = ({\n    children,\n    testId,\n}) => (\n    <span\n        className=\"tooltip tooltip--basic\"\n        data-test={ testId }\n    >\n        { children }\n    </span>\n);\n\nexport default Tooltip;\n","import { noop } from 'lodash';\nimport React, { useCallback, useMemo, FunctionComponent } from 'react';\n\nimport { preventDefault } from '../../common/dom';\nimport { withCurrency, TranslatedString, WithCurrencyProps } from '../../locale';\nimport { CheckboxInput } from '../../ui/form';\nimport { Tooltip, TooltipTrigger } from '../../ui/tooltip';\n\nexport interface StoreCreditFieldProps {\n    availableStoreCredit: number;\n    name: string;\n    usableStoreCredit: number;\n    isStoreCreditApplied: boolean;\n    onChange?(value: boolean): void;\n}\n\nconst StoreCreditField: FunctionComponent<StoreCreditFieldProps & WithCurrencyProps> = ({\n    availableStoreCredit,\n    currency,\n    name,\n    onChange = noop,\n    usableStoreCredit,\n    isStoreCreditApplied,\n}) => {\n    const handleChange = useCallback(event => onChange(event.target.checked), [onChange]);\n    const labelContent = useMemo(() => (\n        <>\n            <TranslatedString id=\"redeemable.apply_store_credit_before_action\" />\n\n            { ' ' }\n\n            <TooltipTrigger\n                placement=\"top-start\"\n                tooltip={\n                    <Tooltip testId=\"payment-store-credit-tooltip\">\n                        <TranslatedString\n                            data={ { storeCredit: currency.toCustomerCurrency(availableStoreCredit) } }\n                            id=\"redeemable.store_credit_available_text\"\n                        />\n                    </Tooltip>\n                }\n            >\n                <a href=\"#\" onClick={ preventDefault() }>\n                    { currency.toCustomerCurrency(usableStoreCredit) }\n                </a>\n            </TooltipTrigger>\n\n            { ' ' }\n\n            <TranslatedString id=\"redeemable.apply_store_credit_after_action\" />\n        </>\n    ), [\n        availableStoreCredit,\n        currency,\n        usableStoreCredit,\n    ]);\n\n    return <CheckboxInput\n        checked={ isStoreCreditApplied }\n        id={ name }\n        label={ labelContent }\n        name={ name }\n        onChange={ handleChange }\n        value={ name }\n    />;\n};\n\nexport default withCurrency(StoreCreditField);\n","import React, { memo, FunctionComponent } from 'react';\n\nimport { mapToRedeemableProps, Redeemable, RedeemableProps } from '../cart';\nimport { withCheckout } from '../checkout';\nimport { Fieldset } from '../ui/form';\n\nconst PaymentRedeemables: FunctionComponent<RedeemableProps> = redeemableProps => (\n    <Fieldset additionalClassName=\"redeemable-payments\">\n        <Redeemable\n            { ...redeemableProps }\n            showAppliedRedeemables={ true }\n        />\n    </Fieldset>\n);\n\nexport default withCheckout(mapToRedeemableProps)(memo(PaymentRedeemables));\n","import { CheckoutSelectors } from '@bigcommerce/checkout-sdk';\nimport { noop } from 'lodash';\nimport React, { Component, MouseEvent, ReactNode } from 'react';\n\nimport { withCheckout, CheckoutContextProps } from '../checkout';\nimport { TranslatedString } from '../locale';\nimport { LoadingOverlay } from '../ui/loading';\n\nexport interface SpamProtectionProps {\n    didExceedSpamLimit?: boolean;\n    onUnhandledError?(error: Error): void;\n}\n\ninterface SpamProtectionState {\n    shouldShowRetryButton: boolean;\n}\n\ninterface WithCheckoutSpamProtectionProps {\n    isExecutingSpamCheck: boolean;\n    executeSpamCheck(): Promise<CheckoutSelectors>;\n}\n\nfunction mapToSpamProtectionProps(\n    { checkoutService, checkoutState }: CheckoutContextProps\n): WithCheckoutSpamProtectionProps {\n    return {\n        isExecutingSpamCheck: checkoutState.statuses.isExecutingSpamCheck(),\n        executeSpamCheck: checkoutService.executeSpamCheck,\n    };\n}\n\nclass SpamProtectionField extends Component<\n    SpamProtectionProps & WithCheckoutSpamProtectionProps,\n    SpamProtectionState\n> {\n    state = {\n        shouldShowRetryButton: false,\n    };\n\n    async componentDidMount() {\n        const { didExceedSpamLimit } = this.props;\n\n        if (didExceedSpamLimit) {\n            return;\n        }\n\n        this.verify();\n    }\n\n    render() {\n        const { isExecutingSpamCheck } = this.props;\n\n        return (\n            <div className=\"spamProtection-container\">\n                <LoadingOverlay isLoading={ isExecutingSpamCheck }>\n                    { this.renderContent() }\n                </LoadingOverlay>\n            </div>\n        );\n    }\n\n    private renderContent(): ReactNode {\n        const { didExceedSpamLimit } = this.props;\n        const { shouldShowRetryButton } = this.state;\n\n        if (!didExceedSpamLimit && !shouldShowRetryButton) {\n            return;\n        }\n\n        return <div className=\"spamProtection-panel optimizedCheckout-overlay\">\n            <a\n                className=\"spamProtection-panel-message optimizedCheckout-primaryContent\"\n                data-test=\"spam-protection-verify-button\"\n                onClick={ this.handleRetry }\n            >\n                <TranslatedString\n                    id=\"spam_protection.verify_action\"\n                />\n            </a>\n        </div>;\n    }\n\n    private async verify(): Promise<void> {\n        const {\n            executeSpamCheck,\n            onUnhandledError = noop,\n        } = this.props;\n\n        try {\n            await executeSpamCheck();\n        } catch (error) {\n            this.setState({ shouldShowRetryButton: true });\n\n            // Notify the parent component if the user experiences a problem other than cancelling the reCaptcha challenge.\n            if (error && error.type !== 'spam_protection_challenge_not_completed') {\n                onUnhandledError(error);\n            }\n        }\n    }\n\n    private handleRetry: (event: MouseEvent) => void = event => {\n        event.preventDefault();\n\n        this.verify();\n    };\n}\n\nexport default withCheckout(mapToSpamProtectionProps)(SpamProtectionField);\n","import { PaymentMethod } from '@bigcommerce/checkout-sdk';\nimport { withFormik, FormikProps, WithFormikConfig } from 'formik';\nimport { isNil, noop, omitBy } from 'lodash';\nimport React, { memo, FunctionComponent } from 'react';\nimport { ObjectSchema } from 'yup';\n\nimport { withLanguage, WithLanguageProps } from '../locale';\nimport { TermsConditions } from '../termsConditions';\nimport { Form } from '../ui/form';\n\nimport { DocumentOnlyCustomFormFieldsetValues, FawryCustomFormFieldsetValues, IdealCustomFormFieldsetValues, SepaCustomFormFieldsetValues } from './checkoutcomFieldsets';\nimport { CreditCardFieldsetValues } from './creditCard';\nimport getPaymentValidationSchema from './getPaymentValidationSchema';\nimport { HostedCreditCardFieldsetValues } from './hostedCreditCard';\nimport { getUniquePaymentMethodId } from './paymentMethod';\nimport { CardInstrumentFieldsetValues } from './storedInstrument';\nimport { StoreCreditField } from './storeCredit';\nimport PaymentRedeemables from './PaymentRedeemables';\n// import PaymentSubmitButton from './PaymentSubmitButton';\nimport SpamProtectionField from './SpamProtectionField';\n\nexport interface PaymentFormProps {\n    availableStoreCredit?: number;\n    defaultGatewayId?: string;\n    defaultMethodId: string;\n    didExceedSpamLimit?: boolean;\n    isEmbedded?: boolean;\n    isInitializingPayment?: boolean;\n    isTermsConditionsRequired?: boolean;\n    isUsingMultiShipping?: boolean;\n    isStoreCreditApplied: boolean;\n    methods: PaymentMethod[];\n    selectedMethod?: PaymentMethod;\n    shouldShowStoreCredit?: boolean;\n    shouldDisableSubmit?: boolean;\n    shouldHidePaymentSubmitButton?: boolean;\n    shouldExecuteSpamCheck?: boolean;\n    termsConditionsText?: string;\n    termsConditionsUrl?: string;\n    usableStoreCredit?: number;\n    validationSchema?: ObjectSchema<Partial<PaymentFormValues>>;\n    isPaymentDataRequired(): boolean;\n    onMethodSelect?(method: PaymentMethod): void;\n    onStoreCreditChange?(useStoreCredit?: boolean): void;\n    onSubmit?(values: PaymentFormValues): void;\n    onUnhandledError?(error: Error): void;\n}\n\nexport type PaymentFormValues = (\n    CreditCardFieldsetValues & PaymentFormCommonValues |\n    CardInstrumentFieldsetValues & PaymentFormCommonValues |\n    HostedCreditCardFieldsetValues & PaymentFormCommonValues |\n    HostedWidgetPaymentMethodValues & PaymentFormCommonValues |\n    DocumentOnlyCustomFormFieldsetValues & PaymentFormCommonValues |\n    SepaCustomFormFieldsetValues & PaymentFormCommonValues |\n    FawryCustomFormFieldsetValues & PaymentFormCommonValues |\n    IdealCustomFormFieldsetValues & PaymentFormCommonValues |\n    PaymentFormCommonValues\n);\n\nexport interface PaymentFormCommonValues {\n    paymentProviderRadio: string; // TODO: Give this property a better name. We need to keep it for now because of legacy reasons.\n    terms?: boolean;\n}\n\nexport interface HostedWidgetPaymentMethodValues {\n    shouldSaveInstrument: boolean;\n}\n\nconst PaymentForm: FunctionComponent<PaymentFormProps & FormikProps<PaymentFormValues> & WithLanguageProps> = ({\n    availableStoreCredit = 0,\n    didExceedSpamLimit,\n    // isEmbedded,\n    // isInitializingPayment,\n    // isPaymentDataRequired,\n    isTermsConditionsRequired,\n    isStoreCreditApplied,\n    // isUsingMultiShipping,\n    // language,\n    // methods,\n    // onMethodSelect,\n    onStoreCreditChange,\n    onUnhandledError,\n    // resetForm,\n    // selectedMethod,\n    // shouldDisableSubmit,\n    // shouldHidePaymentSubmitButton,\n    shouldExecuteSpamCheck,\n    termsConditionsText = '',\n    termsConditionsUrl,\n    usableStoreCredit = 0,\n    // values,\n}) => {\n    // const selectedMethodId = useMemo(() => {\n    //     if (!selectedMethod) {\n    //         return;\n    //     }\n\n    //     switch (selectedMethod.id) {\n    //     case PaymentMethodId.AmazonPay:\n    //         if (selectedMethod.initializationData.paymentToken) {\n    //             return;\n    //         }\n\n    //         return selectedMethod.id;\n\n    //     default:\n    //         return selectedMethod.id;\n    //     }\n    // }, [selectedMethod]);\n\n    if (shouldExecuteSpamCheck) {\n        return <SpamProtectionField\n            didExceedSpamLimit={ didExceedSpamLimit }\n            onUnhandledError={ onUnhandledError }\n        />;\n    }\n\n    return (\n        <Form\n            className=\"checkout-form\"\n            testId=\"payment-form\"\n        >\n            { usableStoreCredit > 0 && <StoreCreditField\n                availableStoreCredit={ availableStoreCredit }\n                isStoreCreditApplied={ isStoreCreditApplied }\n                name=\"useStoreCredit\"\n                onChange={ onStoreCreditChange }\n                usableStoreCredit={ usableStoreCredit }\n            /> }\n\n            {/* <PaymentMethodListFieldset\n                isEmbedded={ isEmbedded }\n                isInitializingPayment={ isInitializingPayment }\n                isPaymentDataRequired={ isPaymentDataRequired }\n                isUsingMultiShipping={ isUsingMultiShipping }\n                methods={ methods }\n                onMethodSelect={ onMethodSelect }\n                onUnhandledError={ onUnhandledError }\n                resetForm={ resetForm }\n                values={ values }\n            /> */}\n\n            <PaymentRedeemables />\n\n            { isTermsConditionsRequired && <TermsConditions\n                termsConditionsText={ termsConditionsText }\n                termsConditionsUrl={ termsConditionsUrl }\n            /> }\n\n            {/* <div className=\"form-actions\">\n                { shouldHidePaymentSubmitButton ?\n                    <PaymentMethodSubmitButtonContainer /> :\n                    <PaymentSubmitButton\n                        initialisationStrategyType={ selectedMethod && selectedMethod.initializationStrategy?.type }\n                        isDisabled={ shouldDisableSubmit }\n                        methodGateway={ selectedMethod && selectedMethod.gateway }\n                        methodId={ selectedMethodId }\n                        methodName={ selectedMethod && getPaymentMethodName(language)(selectedMethod) }\n                        methodType={ selectedMethod && selectedMethod.method }\n                    /> }\n            </div> */}\n        </Form>\n    );\n};\n\n// const PaymentMethodSubmitButtonContainer: FunctionComponent = () => {\n//     return <div className=\"submitButtonContainer\" id=\"checkout-payment-continue\" />;\n// };\n\n// interface PaymentMethodListFieldsetProps {\n//     isEmbedded?: boolean;\n//     isInitializingPayment?: boolean;\n//     isUsingMultiShipping?: boolean;\n//     methods: PaymentMethod[];\n//     values: PaymentFormValues;\n//     isPaymentDataRequired(): boolean;\n//     onMethodSelect?(method: PaymentMethod): void;\n//     onUnhandledError?(error: Error): void;\n//     resetForm(nextValues?: PaymentFormValues): void;\n// }\n\n// const PaymentMethodListFieldset: FunctionComponent<PaymentMethodListFieldsetProps> = ({\n//     isEmbedded,\n//     isInitializingPayment,\n//     isPaymentDataRequired,\n//     isUsingMultiShipping,\n//     methods,\n//     onMethodSelect = noop,\n//     onUnhandledError,\n//     resetForm,\n//     values,\n// }) => {\n//     const { setSubmitted } = useContext(FormContext);\n\n//     const commonValues = useMemo(\n//         () => ({ terms: values.terms }),\n//         [values.terms]\n//     );\n\n//     const handlePaymentMethodSelect = useCallback((method: PaymentMethod) => {\n//         resetForm({\n//             ...commonValues,\n//             ccCustomerCode: '',\n//             ccCvv: '',\n//             ccDocument: '',\n//             customerEmail: '',\n//             customerMobile: '',\n//             ccExpiry: '',\n//             ccName: '',\n//             ccNumber: '',\n//             instrumentId: '',\n//             paymentProviderRadio: getUniquePaymentMethodId(method.id, method.gateway),\n//             shouldSaveInstrument: false,\n//         });\n\n//         setSubmitted(false);\n//         onMethodSelect(method);\n//     }, [\n//         commonValues,\n//         onMethodSelect,\n//         resetForm,\n//         setSubmitted,\n//     ]);\n\n//     return (\n//         <Fieldset>\n//             { !isPaymentDataRequired() && <StoreCreditOverlay /> }\n\n//             <PaymentMethodList\n//                 isEmbedded={ isEmbedded }\n//                 isInitializingPayment={ isInitializingPayment }\n//                 isUsingMultiShipping={ isUsingMultiShipping }\n//                 methods={ methods }\n//                 onSelect={ handlePaymentMethodSelect }\n//                 onUnhandledError={ onUnhandledError }\n//             />\n//         </Fieldset>\n//     );\n// };\n\nconst paymentFormConfig: WithFormikConfig<PaymentFormProps & WithLanguageProps, PaymentFormValues> = {\n    mapPropsToValues: ({\n        defaultGatewayId,\n        defaultMethodId,\n\n    }) => ({\n        ccCustomerCode: '',\n        ccCvv: '',\n        ccDocument: '',\n        customerEmail: '',\n        customerMobile: '',\n        ccExpiry: '',\n        ccName: '',\n        ccNumber: '',\n        paymentProviderRadio: getUniquePaymentMethodId(defaultMethodId, defaultGatewayId),\n        instrumentId: '',\n        shouldSaveInstrument: false,\n        terms: false,\n        hostedForm: {\n            cardType: '',\n            errors: {\n                cardCode: '',\n                cardCodeVerification: '',\n                cardExpiry: '',\n                cardName: '',\n                cardNumber: '',\n                cardNumberVerification: '',\n            },\n        },\n    }),\n\n    handleSubmit: (values, { props: { onSubmit = noop } }) => {\n        onSubmit(omitBy(values, (value, key) =>\n            isNil(value) || value === '' || key === 'hostedForm'\n        ));\n    },\n\n    validationSchema: ({\n        language,\n        isTermsConditionsRequired = false,\n        validationSchema,\n    }: PaymentFormProps & WithLanguageProps) => (\n        getPaymentValidationSchema({\n            additionalValidation: validationSchema,\n            isTermsConditionsRequired,\n            language,\n        })\n    ),\n};\n\nexport default withLanguage(withFormik(paymentFormConfig)(memo(PaymentForm)));\n","import { useEffect, useState } from 'react';\n\nimport { InstallmentPreffix, Payment } from '../types';\n\nexport interface Response {\n  storeEntity: {\n    id: string;\n  };\n}\n\ninterface Results {\n  paymentMethods: Payment[];\n  installment: InstallmentPreffix;\n}\n\n//let mockData = {\n//  \"paymentMethods\": [\n//      {\n//              \"id\": 93216,\n//              \"label\": \"Pagalo en 12 cuotas de $5790\",\n//              \"description\": null,\n//              \"image\": \"https://ws.bcsuite.app/sites/default/files/bp/payment_method/image/mercadopago_0.png\",\n//              \"checkoutDisplayFormat\": \"label_desc_brands_r_img\",\n//              \"provider\": \"mercadopago\",\n//              \"type\": \"card\",\n//              \"amount\": 69480,\n//              \"installments\": [\n//                  1,\n//                  2,\n//                  3,\n//                  4,\n//                  5,\n//                  6,\n//                  12\n//              ],\n//              \"paymentBrands\": [\n//                  {\n//                      \"name\": \"VISA\",\n//                      \"brandId\": 1,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/visa.png\"\n//                  },\n//                  {\n//                      \"name\": \"MASTERCARD\",\n//                      \"brandId\": null,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/mastercard.png\"\n//                  },\n//                  {\n//                      \"name\": \"SCOTIA\",\n//                      \"brandId\": null,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/scotiabank.png\"\n//                  },\n//                  {\n//                      \"name\": \"OCA\",\n//                      \"brandId\": 4,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/oca.png\"\n//                  },\n//                  {\n//                      \"name\": \"CREDITEL\",\n//                      \"brandId\": null,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/creditel.png\"\n//                  }\n//              ],\n//              \"payload\": {\n//                  \"preferenceId\": \"136882441-9ec10dd8-7e84-49b7-87d8-2e764005c2c4\",\n//                  \"publicKey\": \"APP_USR-1b69257a-4583-470d-b79e-113b6b77c0fe\"\n//              }\n//      },\n//      {\n//              \"id\": 93214,\n//              \"label\": \"Pagá en cualquier local de Redpagos o Abitab\",\n//              \"description\": \"<p>Seleccioná esta opción si preferís pagar por Redpago o Abitab.</p>\\r\\n\",\n//              \"image\": null,\n//              \"checkoutDisplayFormat\": \"label_desc_brands_r_img\",\n//              \"provider\": \"offline\",\n//              \"type\": \"redirect\",\n//              \"amount\": 69480,\n//              \"installments\": [\n//                  1\n//              ],\n//              \"paymentBrands\": [\n//                  {\n//                      \"name\": \"ABITAB\",\n//                      \"brandId\": null,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/abitab.jpg\"\n//                  },\n//                  {\n//                      \"name\": \"REDPAGOS\",\n//                      \"brandId\": null,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/red-pagos.png\"\n//                  }\n//              ]\n//      },\n//      {\n//              \"id\": 93213,\n//              \"label\": \"Pagá con tu tarjeta en forma telefónica\",\n//              \"description\": \"<p>Pagar en línea con tu tarjeta es absolutamente seguro, pero si preferís pasarnos tus datos en forma telefónica, elegí esta opción y coordinaremos la llamada.</p>\\r\\n\",\n//              \"image\": null,\n//              \"checkoutDisplayFormat\": \"label_desc_brands_r_img\",\n//              \"provider\": \"offline\",\n//              \"type\": \"redirect\",\n//              \"amount\": 69480,\n//              \"installments\": [\n//                  1\n//              ],\n//              \"paymentBrands\": [\n//                  {\n//                      \"name\": \"OCA\",\n//                      \"brandId\": 4,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/oca.png\"\n//                  },\n//                  {\n//                      \"name\": \"VISA\",\n//                      \"brandId\": 1,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/visa.png\"\n//                  },\n//                  {\n//                      \"name\": \"CRÉDITOS DIRECTOS\",\n//                      \"brandId\": null,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/creditos-directos.png\"\n//                  },\n//                  {\n//                      \"name\": \"PASSCARD\",\n//                      \"brandId\": null,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/pass-card.png\"\n//                  },\n//                  {\n//                      \"name\": \"CREDITEL\",\n//                      \"brandId\": null,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/creditel.png\"\n//                  }\n//              ]\n//      },\n//      {\n//              \"id\": 93215,\n//              \"label\": \"Financiá tu compra con Crédito de la casa y obtenelo ya\",\n//              \"description\": null,\n//              \"image\": \"https://ws.bcsuite.app/sites/default/files/bp/payment_method/image/credito-de-la-casa.png\",\n//              \"checkoutDisplayFormat\": \"label_desc_r_img\",\n//              \"provider\": \"offline\",\n//              \"type\": \"redirect\",\n//              \"amount\": 69480,\n//              \"installments\": [\n//                  1\n//              ],\n//              \"paymentBrands\": [\n//                  {\n//                      \"name\": \"CRÉDITO DE LA CASA\",\n//                      \"brandId\": null,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/credito-de-la-casa.png\"\n//                  }\n//              ]\n//      },\n//      {\n//              \"id\": 93212,\n//              \"label\": \"Pagá hasta en  12 cuotas con Creditel, Créditos Directos o PassCard\",\n//              \"description\": \"<p>Pagalo en hasta <strong>12 cuotas</strong> de <strong>$5790</strong>.</p>\\r\\n\",\n//              \"image\": null,\n//              \"checkoutDisplayFormat\": \"label_desc_brands_r_img\",\n//              \"provider\": \"bamboo\",\n//              \"type\": \"card\",\n//              \"amount\": 69480,\n//              \"installments\": [\n//                  1,\n//                  2,\n//                  3,\n//                  4,\n//                  5,\n//                  6,\n//                  12\n//              ],\n//              \"paymentBrands\": [\n//                  {\n//                      \"name\": \"CRÉDITOS DIRECTOS\",\n//                      \"brandId\": null,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/creditos-directos.png\"\n//                  },\n//                  {\n//                      \"name\": \"PASSCARD\",\n//                      \"brandId\": null,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/pass-card.png\"\n//                  },\n//                  {\n//                      \"name\": \"CREDITEL\",\n//                      \"brandId\": null,\n//                      \"image\": \"https://ws.bcsuite.app/sites/default/files/payment_brand/image/creditel.png\"\n//                  }\n//              ],\n//              \"payload\": {\n//                  \"email\": \"odskdso@adodm.com\"\n//              }\n//      }\n//  ],\n//  \"installment\": {\n//      \"singular_suffix\": \"pago\",\n//      \"plural_suffix\": \"cuotas\"\n//  }\n//};\n\nconst usePayments = () => {\n  const [payments, setPayments] = useState<Payment[]>([]);\n  // const [storeId, setStoreId] = useState<null | string>(null);\n  const [installmentsPreffix, setInstallmentsPreffix] = useState<InstallmentPreffix>({ singular_suffix: '', plural_suffix: '' });\n  const [loading, setLoading] = useState<boolean>(false);\n\n  const paymentMethodsData = (storeid: string) => {\n    if (typeof window.BcsPayments !== 'object') {\n      window.BcsPayments = new window.BcsPayments(window.BCSuite);\n    }\n    window.BcsPayments.getPaymentMethods(storeid, window.checkoutConfig.checkoutId)\n      .then(\n        ({ paymentMethods, installment }: Results) => {\n          setPayments(paymentMethods);\n          setInstallmentsPreffix(installment);\n          setLoading(false);\n        },\n        (error: string) => {\n          throw new Error(error);\n        }\n      );\n  };\n\n  useEffect(() => {\n    setLoading(true);\n\n    if (typeof window.BCSuite === 'object') {\n      if (window.BCSuite.account) {\n        paymentMethodsData(window.BCSuite.account.storeEntity.id);\n      } else {\n        window.BCSuite.getAccount().then((response: Response) => {\n          paymentMethodsData(response.storeEntity.id);\n        })\n      }\n    } else {\n      window.BCSuite = new window.BCSuite();\n      window.BCSuite.init()\n        .then((response: Response) => {\n          paymentMethodsData(response.storeEntity.id);\n        });\n    }\n  }, []);\n\n\n\n  return { payments, installmentsPreffix, loading, reloadPayments: paymentMethodsData, setLoading };\n};\n\nexport default usePayments;\n","import React from 'react';\n\nimport { InstallmentPreffix } from './types';\n\nimport installmentIcon from '../../../static/img/installment.png';\n\ninterface Props {\n  loading: boolean;\n  handleSelect: (e: React.ChangeEvent<HTMLSelectElement>) => void;\n  installments: string;\n  installmentsPreffix: InstallmentPreffix;\n  selectOption: React.LegacyRef<HTMLSelectElement>;\n  options: [];\n  message: Message;\n}\n\ninterface Message {\n  state: string;\n}\n\nconst BcsPaymentBambooCard = ({loading, handleSelect, installments, installmentsPreffix, selectOption, options, message}: Props) => (\n  <div className=\"bcsPayment-container-iframe\" id=\"iframeDiv\">\n    {\n      options.length > 1 &&\n        <div className=\"bcsPayment-form-select\" style={ { display: !loading ? 'flex' : 'none' } }>\n          <figure>\n            <img alt=\"Installment Icon\" src={ installmentIcon } />\n          </figure>\n          <select\n              disabled={ message.state === 'warning' }\n              name=\"select\"\n              onChange={ handleSelect }\n              ref={ selectOption }\n              value={ installments }\n          >\n            {\n              options.map(option => (\n                <option key={ option } value={ option }>{ option === 1 ? `${option} ${installmentsPreffix.singular_suffix}` : `${option} ${installmentsPreffix.plural_suffix}` }</option>\n              ))\n            }\n          </select>\n        </div>\n    }\n    <div style={ {display: 'inline-block'} }>\n      <iframe frameBorder=\"0\" id=\"custom_iframe\" style={ { height: !loading ? '280px' : '0' } } />\n    </div>\n  </div>\n);\n\nexport default BcsPaymentBambooCard;\n","import React, { useState } from 'react';\nimport Loader from 'react-loader-spinner';\n\nimport { Payment } from './types';\n\nimport { FaCheck } from 'react-icons/fa';\n\ninterface Props {\n  value: string;\n  payment: Payment;\n  message: Message;\n  setMessage: ({ }: Message) => void;\n}\n\ninterface Message {\n  message?: string;\n  urlRedirect?: string;\n  state: string;\n  show: boolean;\n}\n\ninterface DataResponse {\n  status: {\n    message: string;\n    code: number | string;\n  };\n  data: Message;\n}\n\nconst BcsPaymentButton = ({ value, payment, message, setMessage }: Props) => {\n  const [loading, setLoading] = useState<boolean>(false);\n\n  const handleClick = () => {\n    setLoading(true);\n    const bcSuite = window.BCSuite;\n    const storeId = bcSuite.account.storeEntity.id;\n    const siteId = bcSuite.account.storeEntity.siteEntity.id;\n    window.BcsPayments.processPurchase(storeId, window.checkoutConfig.checkoutId, payment.id, { body: '' })\n      .then((res: DataResponse) => {\n        if (res.status.code === 0) {\n          setMessage({\n            ...message,\n            message: res.data.message,\n            urlRedirect: res.data.urlRedirect,\n            state: 'success',\n            show: true,\n          });\n          const pathQuery = `?site=${siteId}&store=${storeId}&checkout=${window.checkoutConfig.checkoutId}&payment_method=${payment.id}`;\n          setLoading(false);\n          if (res.data.urlRedirect?.includes('http')) {\n            window.location.replace(`${res.data.urlRedirect}${pathQuery}`);\n          } else {\n            window.location.replace(`${window.location.origin}${res.data.urlRedirect}${pathQuery}`);\n          }\n        } else {\n          setMessage({\n            ...message,\n            message: res.status.message,\n            state: 'warning',\n            show: true,\n          });\n          setLoading(false);\n        }\n      });\n  };\n\n  return (\n    <a onClick={handleClick} className=\"optimizedCheckout-buttonPrimary\">\n      {\n        loading\n          ? <Loader\n            color=\"#dfdfdf\"\n            height={20}\n            type=\"TailSpin\"\n            width={20}\n          />\n          : (\n            <>\n              {value}\n              <FaCheck />\n            </>\n          )\n      }\n    </a>\n  );\n};\n\nexport default BcsPaymentButton;\n","import React from 'react';\n\nimport { Payment } from './types';\nimport BcsPaymentButton from './BcsPaymentButton';\ninterface Props {\n  payment: Payment;\n  loading: boolean;\n  message: Message;\n  setMessage: ({}: Message) => void;\n}\n\ninterface Message {\n  message?: string;\n  urlRedirect?: string;\n  state: string;\n  show: boolean;\n}\n\nconst BcsPaymentBambooPhysicalNetwork = ({payment, loading, message, setMessage}: Props) => (\n  <div className=\"bcsPayment-button-payment\">\n    {\n      !loading &&\n        <BcsPaymentButton\n            message={ message }\n            payment={ payment }\n            setMessage={ setMessage }\n            value={ `Pagar UYU ${payment.amount}` }\n        />\n    }\n  </div>\n);\n\nexport default BcsPaymentBambooPhysicalNetwork;\n","import React from 'react';\n\nimport { Payment } from './types';\n\ninterface Props {\n  payment: Payment;\n  handleChange: (payment: Payment) => void;\n}\n\nconst BcsPaymentFieldPayment = ({ payment, handleChange }: Props) => {\n  return (\n    <div className=\"bcsPayment-field\">\n      <input\n        id={`radio-${payment.id}`}\n        name=\"payment\"\n        onChange={() => handleChange(payment)}\n        type=\"radio\"\n        value={payment.id}\n      />\n      <label htmlFor={`radio-${payment.id}`}>\n        <div className=\"bscPayment-info\">\n          <h4 className=\"bcsPayment-name\" dangerouslySetInnerHTML={{ __html: payment.label }} />\n          <span className=\"bcsPayment-body\" dangerouslySetInnerHTML={{ __html: payment.description }} />\n          {\n            payment.checkoutDisplayFormat.includes('brands') && (\n              <ul className=\"bcsPayment-image-list\">\n                {\n                  payment.paymentBrandLogos.map(logo => (\n                    <li className=\"bcsPayment-image-item\" key={logo}>\n                      <img alt={`Payment Icon`} src={logo} />\n                    </li>\n                  ))\n                }\n              </ul>\n            )\n          }\n        </div>\n        {\n          payment.image &&\n          <figure className=\"bcsPayment-image\">\n            <img alt={`Logo ${payment.label}`} src={payment.image} />\n          </figure>\n        }\n      </label>\n    </div>\n  );\n};\n\nexport default BcsPaymentFieldPayment;\n","import React from 'react';\n\nimport { Payment } from './types';\nimport BcsPaymentButton from './BcsPaymentButton';\n\ninterface Props {\n  payment: Payment;\n  message: Message;\n  setMessage: ({ }: Message) => void;\n}\n\ninterface Message {\n  message?: string;\n  urlRedirect?: string;\n  state: string;\n  show: boolean;\n}\n\nconst BcsPaymentOffline = ({ payment, message, setMessage }: Props) => (\n  <div className=\"bcsPayment-button-payment\">\n    <BcsPaymentButton\n      message={message}\n      payment={payment}\n      setMessage={setMessage}\n      value={payment.paymentButtonText}\n    />\n  </div>\n);\n\nexport default BcsPaymentOffline;\n","import React, { useCallback, useRef, useState } from 'react';\nimport ContentLoader from 'react-content-loader';\n\nimport { InstallmentPreffix, Payment } from './types';\nimport BcsPaymentBambooCard from './BcsPaymentBambooCard';\nimport BcsPaymentBambooPhysicalNetwork from './BcsPaymentBambooPhysicalNetwork';\nimport BcsPaymentFieldPayment from './BcsPaymentFieldPayment';\nimport BcsPaymentOffline from './BcsPaymentOffline';\n\ninterface Props {\n  payments: Payment[];\n  installmentsPreffix: InstallmentPreffix;\n}\n\ninterface Message {\n  message?: string;\n  urlRedirect?: string;\n  state: string;\n  show: boolean;\n}\n\ninterface DataResponse {\n  status: {\n    message: string;\n    code: number | string;\n  };\n  data: Message;\n}\n\ninterface TokenObject {\n  Installments: string;\n}\n\ndeclare global {\n  interface Window {\n    checkoutStyleConfig: {\n      buttonPrimary: {\n        color: string,\n        colorHover: string,\n        colorActive: string,\n        backgroundColor: string,\n        backgroundColorHover: string,\n        backgroundColorActive: string,\n        borderColor: string,\n        borderColorHover: string,\n        borderColorActive: string,\n        borderColorDisabled: string,\n        backgroundColorDisabled: string,\n        colorDisabled: string,\n      };\n    }\n  }\n}\n\nconst BcsPaymentListOfPayment = ({ payments, installmentsPreffix }: Props) => {\n  const [loading, setLoading] = useState<boolean>(false);\n  const [message, setMessage] = useState<Message>({ message: '', urlRedirect: '', state: '', show: false });\n  const [isVisible, setIsVisible] = useState<number>(0);\n  const [installments, setInstallments] = useState<string>('1');\n  const selectOption = useRef<HTMLSelectElement>(document.createElement('select'));\n\n  const handleSelect = useCallback(() => {\n    setInstallments(selectOption.current.value);\n  }, []);\n\n  const handleClose = (payment: Payment) => {\n    handleCardPayment(payment);\n    setInstallments('1');\n    setMessage({\n      ...message,\n      show: false,\n      state: '',\n    });\n  };\n\n  const handleCardPayment = (payment: Payment) => {\n    window.PWCheckout.SetProperties(\n      {\n        email: payment.payload.email,\n        email_hide: 'true',\n        button_label: payment.paymentButtonText,\n        description: '',\n        currency: 'UYU',\n        amount: payment.amount,\n        form_id: 'commerce_form',\n        autoSubmit: 'false',\n        iframeId: 'custom_iframe',\n        empty: 'true',\n      }\n    );\n\n    window.PWCheckout.SetStyle(\n      {\n        backgroundColor: 'f2f2f2',\n        buttonColor: window?.checkoutStyleConfig?.buttonPrimary?.backgroundColor?.slice(1),\n        buttonHoverColor: window?.checkoutStyleConfig?.buttonPrimary?.backgroundColorHover?.slice(1),\n        buttonTextColor: window?.checkoutStyleConfig?.buttonPrimary?.color?.slice(1),\n        buttonTextHoverColor: window?.checkoutStyleConfig?.buttonPrimary?.colorHover?.slice(1),\n        inputBackgroundColor: 'ffffff',\n        inputTextColor: '767676',\n        inputErrorColor: 'ff0000',\n        inputAddonBackgroundColor: 'ffffff',\n        labelColor: '494949',\n      }\n    );\n\n    window.PWCheckout.Bind('tokenCreated', (token: TokenObject) => {\n      const bcSuite = window.BCSuite;\n      const bcsPayments = window.BcsPayments;\n      const storeId = bcSuite.account.storeEntity.id;\n      const siteId = bcSuite.account.storeEntity.siteEntity.id;\n      token.Installments = selectOption.current && selectOption.current.value !== '' ? selectOption.current.value : '1';\n      bcsPayments.processPurchase(storeId, window.checkoutConfig.checkoutId, payment.id, token)\n        .then((res: DataResponse) => {\n          if (res.status.code === 0) {\n            setMessage({\n              ...message,\n              message: res.data.message,\n              urlRedirect: res.data.urlRedirect,\n              state: 'success',\n              show: true,\n            });\n            const pathQuery = `?site=${siteId}&store=${storeId}&checkout=${window.checkoutConfig.checkoutId}&payment_method=${payment.id}`;\n            if (res.data.urlRedirect?.includes('http')) {\n              window.location.replace(`${res.data.urlRedirect}${pathQuery}`);\n            } else {\n              window.location.replace(`${window.location.origin}${res.data.urlRedirect}${pathQuery}`);\n            }\n          } else {\n            setMessage({\n              ...message,\n              message: res.status.message,\n              state: 'warning',\n              show: true,\n            });\n          }\n        });\n    });\n\n    window.PWCheckout.Bind('opened', () => {\n      setLoading(false);\n    });\n\n    const brandId = payment.brand ?? '';\n    const bankId = payment.bank ?? '';\n    const paymentType = payment.paymentTypeId ?? '';\n\n    window.PWCheckout.LoadIframe(brandId, bankId, paymentType);\n  };\n\n  const handleOfflinePayment = () => {\n    setLoading(false);\n  };\n\n  const handleMercadoPago = (payment: Payment) => {\n    setTimeout(() => {\n      if (payment.payload.preferenceId !== '') {\n        const mp = new window.MercadoPago(payment.payload.publicKey, {\n          locale: 'es-UY',\n        });\n        // Init checkout\n        mp.checkout({\n          preference: {\n            id: payment.payload.preferenceId,\n          },\n          render: {\n            container: '.button-mp',\n            label: payment.paymentButtonText,\n          },\n        });\n      } else {\n        setMessage({\n          ...message,\n          message: payment.payload.message,\n          state: 'error',\n          show: true,\n        });\n      }\n      setLoading(false);\n    }, 2000);\n  };\n\n  const handleChange = (payment: Payment): void => {\n    setLoading(true);\n    setIsVisible(Number(payment.id));\n\n    window.BcsPayments.checkoutPaymentSelected(window.BCSuite.account.storeEntity.id, window.checkoutConfig.checkoutId, payment.id)\n    //  .then()\n    //  .catch((err: object) => console.error(err));\n\n    switch (`${payment.provider}_${payment.type}`) {\n      case 'bamboo_card':\n        handleCardPayment(payment);\n        break;\n      case 'mercadopago_card':\n        handleMercadoPago(payment);\n        break;\n      default:\n        handleOfflinePayment();\n    }\n  };\n\n  return (\n    <ul className=\"bcsPayment-list\">\n      {\n        payments.map(payment => (\n          <li className=\"bcsPayment-item\" key={payment.id} onClick={message.state === 'warning' ? () => handleClose(payment) : () => { }}>\n            <BcsPaymentFieldPayment\n              handleChange={handleChange}\n              payment={payment}\n            />\n            {\n              Number(isVisible) === Number(payment.id)\n              && (\n                <div className=\"bcsPayment-form\">\n                  {\n                    message.show && <div className={`bcsPayment-message ${message.state}`}>\n                      {message.message}\n                      {\n                        message.state === 'warning' && <button className=\"bcsPayment-message-button\" onClick={() => handleClose(payment)} type=\"button\">Cerrar</button>\n                      }\n                    </div>\n                  }\n                  {\n                    loading && <ContentLoader />\n                  }\n                  {\n                    `${payment.provider}_${payment.type}` === 'bamboo_card' && (\n                      <BcsPaymentBambooCard\n                        handleSelect={handleSelect}\n                        installments={installments}\n                        installmentsPreffix={installmentsPreffix}\n                        loading={loading}\n                        message={message}\n                        options={payment.installments}\n                        selectOption={selectOption}\n                      />\n                    )\n                  }\n                  {\n                    `${payment.provider}_${payment.type}` === 'bamboo_physical_network' && (\n                      <BcsPaymentBambooPhysicalNetwork loading={loading} message={message} payment={payment} setMessage={setMessage} />\n                    )\n                  }\n                  {\n                    `${payment.provider}_${payment.type}` === 'offline_redirect' && (\n                      !loading && <BcsPaymentOffline message={message} payment={payment} setMessage={setMessage} />\n                    )\n                  }\n                  {\n                    `${payment.provider}_${payment.type}` === 'mercadopago_card' && (\n                      <div className=\"bcsPayment-button-payment button-mp\" />\n                    )\n                  }\n                </div>\n              )\n            }\n          </li>\n        ))\n      }\n    </ul>\n  );\n};\n\nexport default BcsPaymentListOfPayment;\n","import React, { useContext, useEffect } from 'react';\nimport { BulletList } from 'react-content-loader';\n\n\nimport { CheckoutContext } from '../../checkout';\nimport './bscPayment.scss';\nimport usePayments from './hooks/usePayments';\nimport BcsPaymentListOfPayment from './BcsPaymentListOfPayment';\nimport { Response } from './hooks/usePayments';\n\ndeclare global {\n  interface Window {\n    PWCheckout: any;\n    BCSuite: any;\n    BcsPayments: any;\n    MercadoPago: any;\n    checkoutConfig: any;\n    storeHash: any;\n  }\n}\n\nconst BcsPayment = () => {\n  const { loading, payments, installmentsPreffix, reloadPayments, setLoading } = usePayments();\n  const { checkoutState, checkoutService } = useContext(CheckoutContext) || {};\n  console.log(checkoutService?.getState().data.getOrder()?.baseAmount)\n\n  useEffect(() => {\n    console.log('alo');\n    console.log(checkoutService?.getState());\n    if (checkoutState?.statuses.isApplyingCoupon() || checkoutState?.statuses.isRemovingCoupon()) {\n      setLoading(true);\n      setTimeout(() => {\n        if (typeof window.BCSuite === 'object') {\n          reloadPayments(window.BCSuite.account.storeEntity.id);\n        } else {\n          window.BCSuite = new window.BCSuite();\n          window.BCSuite.init()\n            .then((response: Response) => {\n              reloadPayments(response.storeEntity.id);\n            });\n        }\n      }, 1000);\n    }\n  }, [checkoutState])\n\n  return (\n    <section className=\"checkout-form\">\n      <input id=\"PWToken\" type=\"hidden\" />\n      <div className=\"form-body\">\n        {\n          loading ? <BulletList /> : <BcsPaymentListOfPayment installmentsPreffix={installmentsPreffix} payments={payments} />\n        }\n      </div>\n    </section>\n  );\n};\n\nexport default BcsPayment;\n","import { CartChangedError, CheckoutSelectors, CheckoutSettings, OrderRequestBody, PaymentMethod } from '@bigcommerce/checkout-sdk';\nimport { memoizeOne } from '@bigcommerce/memoize';\nimport { compact, find, isEmpty, noop } from 'lodash';\nimport React, { Component, ReactNode } from 'react';\nimport { ObjectSchema } from 'yup';\n\nimport { withCheckout, CheckoutContextProps } from '../checkout';\nimport { isCartChangedError, isRequestError, ErrorModal, ErrorModalOnCloseProps } from '../common/error';\nimport { EMPTY_ARRAY } from '../common/utility';\nimport { withLanguage, WithLanguageProps } from '../locale';\nimport { TermsConditionsType } from '../termsConditions';\nimport { LoadingOverlay } from '../ui/loading';\n\nimport mapSubmitOrderErrorMessage, { mapSubmitOrderErrorTitle } from './mapSubmitOrderErrorMessage';\nimport mapToOrderRequestBody from './mapToOrderRequestBody';\nimport { getUniquePaymentMethodId, PaymentMethodId, PaymentMethodProviderType } from './paymentMethod';\nimport PaymentContext from './PaymentContext';\nimport PaymentForm, { PaymentFormValues } from './PaymentForm';\nimport BcsPayment from './bcsPayment/BcsPayment';\n\nexport interface PaymentProps {\n    isEmbedded?: boolean;\n    isUsingMultiShipping?: boolean;\n    checkEmbeddedSupport?(methodIds: string[]): void; // TODO: We're currently doing this check in multiple places, perhaps we should move it up so this check get be done in a single place instead.\n    onCartChangedError?(error: CartChangedError): void;\n    onFinalize?(): void;\n    onFinalizeError?(error: Error): void;\n    onReady?(): void;\n    onSubmit?(): void;\n    onSubmitError?(error: Error): void;\n    onUnhandledError?(error: Error): void;\n}\n\ninterface WithCheckoutPaymentProps {\n    availableStoreCredit: number;\n    cartUrl: string;\n    defaultMethod?: PaymentMethod;\n    finalizeOrderError?: Error;\n    isInitializingPayment: boolean;\n    isSubmittingOrder: boolean;\n    isStoreCreditApplied: boolean;\n    isTermsConditionsRequired: boolean;\n    methods: PaymentMethod[];\n    shouldExecuteSpamCheck: boolean;\n    shouldLocaliseErrorMessages: boolean;\n    submitOrderError?: Error;\n    termsConditionsText?: string;\n    termsConditionsUrl?: string;\n    usableStoreCredit: number;\n    applyStoreCredit(useStoreCredit: boolean): Promise<CheckoutSelectors>;\n    clearError(error: Error): void;\n    finalizeOrderIfNeeded(): Promise<CheckoutSelectors>;\n    isPaymentDataRequired(): boolean;\n    loadCheckout(): Promise<CheckoutSelectors>;\n    loadPaymentMethods(): Promise<CheckoutSelectors>;\n    submitOrder(values: OrderRequestBody): Promise<CheckoutSelectors>;\n}\n\ninterface PaymentState {\n    didExceedSpamLimit: boolean;\n    isReady: boolean;\n    selectedMethod?: PaymentMethod;\n    shouldDisableSubmit: { [key: string]: boolean };\n    shouldHidePaymentSubmitButton: { [key: string]: boolean };\n    submitFunctions: { [key: string]: ((values: PaymentFormValues) => void) | null };\n    validationSchemas: { [key: string]: ObjectSchema<Partial<PaymentFormValues>> | null };\n}\n\nclass Payment extends Component<PaymentProps & WithCheckoutPaymentProps & WithLanguageProps, PaymentState> {\n    state: PaymentState = {\n        didExceedSpamLimit: false,\n        isReady: false,\n        shouldDisableSubmit: {},\n        shouldHidePaymentSubmitButton: {},\n        validationSchemas: {},\n        submitFunctions: {},\n    };\n\n    private getContextValue = memoizeOne(() => {\n        return {\n            disableSubmit: this.disableSubmit,\n            setSubmit: this.setSubmit,\n            setValidationSchema: this.setValidationSchema,\n            hidePaymentSubmitButton: this.hidePaymentSubmitButton,\n        };\n    });\n\n    async componentDidMount(): Promise<void> {\n        const {\n            finalizeOrderIfNeeded,\n            loadPaymentMethods,\n            onFinalize = noop,\n            onFinalizeError = noop,\n            onReady = noop,\n            onUnhandledError = noop,\n        } = this.props;\n\n        try {\n            await loadPaymentMethods();\n        } catch (error) {\n            onUnhandledError(error);\n        }\n\n        try {\n            await finalizeOrderIfNeeded();\n            onFinalize();\n        } catch (error) {\n            if (error.type !== 'order_finalization_not_required') {\n                return onFinalizeError(error);\n            }\n        }\n\n        window.addEventListener('beforeunload', this.handleBeforeUnload);\n        this.setState({ isReady: true });\n        onReady();\n    }\n\n    componentDidUpdate(): void {\n        const {\n            checkEmbeddedSupport = noop,\n            methods,\n        } = this.props;\n\n        checkEmbeddedSupport(methods.map(({ id }) => id));\n    }\n\n    componentWillUnmount(): void {\n        window.removeEventListener('beforeunload', this.handleBeforeUnload);\n    }\n\n    render(): ReactNode {\n        const {\n            defaultMethod,\n            finalizeOrderError,\n            isInitializingPayment,\n            isUsingMultiShipping,\n            methods,\n            applyStoreCredit,\n            ...rest\n        } = this.props;\n\n        const {\n            didExceedSpamLimit,\n            isReady,\n            selectedMethod = defaultMethod,\n            shouldDisableSubmit,\n            validationSchemas,\n            shouldHidePaymentSubmitButton,\n        } = this.state;\n\n        const uniqueSelectedMethodId = (\n            selectedMethod &&\n            getUniquePaymentMethodId(selectedMethod.id, selectedMethod.gateway)\n        );\n\n        return (\n            <PaymentContext.Provider value={ this.getContextValue() }>\n                <LoadingOverlay\n                    isLoading={ !isReady }\n                    unmountContentWhenLoading\n                >\n                    <BcsPayment />\n                    { !isEmpty(methods) && defaultMethod && <PaymentForm\n                        { ...rest }\n                        defaultGatewayId={ defaultMethod.gateway }\n                        defaultMethodId={ defaultMethod.id }\n                        didExceedSpamLimit={ didExceedSpamLimit }\n                        isInitializingPayment={ isInitializingPayment }\n                        isUsingMultiShipping={ isUsingMultiShipping }\n                        methods={ methods }\n                        onMethodSelect={ this.setSelectedMethod }\n                        onStoreCreditChange={ this.handleStoreCreditChange }\n                        onSubmit={ this.handleSubmit }\n                        selectedMethod={ selectedMethod }\n                        shouldDisableSubmit={ uniqueSelectedMethodId && shouldDisableSubmit[uniqueSelectedMethodId] || undefined }\n                        shouldHidePaymentSubmitButton={ uniqueSelectedMethodId && shouldHidePaymentSubmitButton[uniqueSelectedMethodId] || undefined }\n                        validationSchema={ uniqueSelectedMethodId && validationSchemas[uniqueSelectedMethodId] || undefined }\n                    /> }\n                </LoadingOverlay>\n\n                { this.renderOrderErrorModal() }\n                { this.renderEmbeddedSupportErrorModal() }\n            </PaymentContext.Provider>\n        );\n    }\n\n    private renderOrderErrorModal(): ReactNode {\n        const {\n            finalizeOrderError,\n            language,\n            shouldLocaliseErrorMessages,\n            submitOrderError,\n        } = this.props;\n\n        // FIXME: Export correct TS interface\n        const error: any = submitOrderError || finalizeOrderError;\n\n        if (!error ||\n            error.type === 'order_finalization_not_required' ||\n            error.type === 'payment_cancelled' ||\n            error.type === 'payment_invalid_form' ||\n            error.type === 'spam_protection_not_completed' ||\n            error.type === 'invalid_hosted_form_value') {\n            return null;\n        }\n\n        return (\n            <ErrorModal\n                error={ error }\n                message={ mapSubmitOrderErrorMessage(error, language.translate.bind(language), shouldLocaliseErrorMessages) }\n                onClose={ this.handleCloseModal }\n                title={ mapSubmitOrderErrorTitle(error, language.translate.bind(language)) }\n            />\n        );\n    }\n\n    private renderEmbeddedSupportErrorModal(): ReactNode {\n        const {\n            checkEmbeddedSupport = noop,\n            methods,\n        } = this.props;\n\n        try {\n            checkEmbeddedSupport(methods.map(({ id }) => id));\n        } catch (error) {\n            return (\n                <ErrorModal\n                    error={ error }\n                    onClose={ this.handleCloseModal }\n                />\n            );\n        }\n\n        return null;\n    }\n\n    private disableSubmit: (\n        method: PaymentMethod,\n        disabled?: boolean\n    ) => void = (method, disabled = true) => {\n        const uniqueId = getUniquePaymentMethodId(method.id, method.gateway);\n        const { shouldDisableSubmit } = this.state;\n\n        if (shouldDisableSubmit[uniqueId] === disabled) {\n            return;\n        }\n\n        this.setState({\n            shouldDisableSubmit: {\n                ...shouldDisableSubmit,\n                [uniqueId]: disabled,\n            },\n        });\n    };\n\n    private hidePaymentSubmitButton: (\n        method: PaymentMethod,\n        disabled?: boolean\n    ) => void = (method, disabled = true) => {\n        const uniqueId = getUniquePaymentMethodId(method.id, method.gateway);\n        const { shouldHidePaymentSubmitButton } = this.state;\n\n        if (shouldHidePaymentSubmitButton[uniqueId] === disabled) {\n            return;\n        }\n\n        this.setState({\n            shouldHidePaymentSubmitButton: {\n                ...shouldHidePaymentSubmitButton,\n                [uniqueId]: disabled,\n            },\n        });\n    };\n\n    // tslint:disable:cyclomatic-complexity\n    private handleBeforeUnload: (event: BeforeUnloadEvent) => string | undefined = event => {\n        const { defaultMethod, isSubmittingOrder, language } = this.props;\n        const { selectedMethod = defaultMethod } = this.state;\n\n        // TODO: Perhaps there is a better way to handle `adyen`, `afterpay`, `amazon`,\n        // `checkout.com`, `converge`, `sagepay`, `stripev3` and `sezzle`. They require\n        //  a redirection to another website during the payment flow but are not\n        //  categorised as hosted payment methods.\n        if (!isSubmittingOrder ||\n            !selectedMethod ||\n            selectedMethod.type === PaymentMethodProviderType.Hosted ||\n            selectedMethod.type === PaymentMethodProviderType.PPSDK ||\n            selectedMethod.id === PaymentMethodId.Amazon ||\n            selectedMethod.id === PaymentMethodId.AmazonPay ||\n            selectedMethod.id === PaymentMethodId.Checkoutcom ||\n            selectedMethod.id === PaymentMethodId.Converge ||\n            selectedMethod.id === PaymentMethodId.Laybuy ||\n            selectedMethod.id === PaymentMethodId.Quadpay ||\n            selectedMethod.id === PaymentMethodId.SagePay ||\n            selectedMethod.id === PaymentMethodId.Sezzle ||\n            selectedMethod.id === PaymentMethodId.Zip ||\n            selectedMethod.gateway === PaymentMethodId.AdyenV2 ||\n            selectedMethod.gateway === PaymentMethodId.AdyenV2GooglePay ||\n            selectedMethod.gateway === PaymentMethodId.Afterpay ||\n            selectedMethod.gateway === PaymentMethodId.Clearpay ||\n            selectedMethod.gateway === PaymentMethodId.Checkoutcom ||\n            selectedMethod.gateway === PaymentMethodId.Mollie ||\n            selectedMethod.gateway === PaymentMethodId.StripeV3) {\n            return;\n        }\n\n        const message = language.translate('common.leave_warning');\n\n        event.returnValue = message;\n\n        return message;\n    };\n\n    private handleCloseModal: (\n        event: Event,\n        props: ErrorModalOnCloseProps\n    ) => Promise<void> = async (_, { error }) => {\n        if (!error) {\n            return;\n        }\n\n        const { cartUrl, clearError, loadCheckout } = this.props;\n        const { type: errorType } = error as any; // FIXME: Export correct TS interface\n\n        if (errorType === 'provider_fatal_error' ||\n            errorType === 'order_could_not_be_finalized_error') {\n            window.location.replace(cartUrl || '/');\n        }\n\n        if (isRequestError(error)) {\n            const { body, headers, status } = error;\n\n            if (body.type === 'provider_error' && headers.location) {\n                window.top.location.assign(headers.location);\n            }\n\n            // Reload the checkout object to get the latest `shouldExecuteSpamCheck` value,\n            // which will in turn make `SpamProtectionField` visible again.\n            // NOTE: As a temporary fix, we're checking the status code instead of the error\n            // type because of an issue with Nginx config, which causes the server to return\n            // HTML page instead of JSON response when there is a 429 error.\n            if (status === 429 || body.type === 'spam_protection_expired' || body.type === 'spam_protection_failed') {\n                this.setState({ didExceedSpamLimit: true });\n\n                await loadCheckout();\n            }\n        }\n\n        clearError(error);\n    };\n\n    private handleStoreCreditChange: (useStoreCredit: boolean) => void = async useStoreCredit => {\n        const {\n            applyStoreCredit,\n            onUnhandledError = noop,\n        } = this.props;\n\n        try {\n            await applyStoreCredit(useStoreCredit);\n        } catch (e) {\n            onUnhandledError(e);\n        }\n    };\n\n    private handleSubmit: (values: PaymentFormValues) => void = async values => {\n        const {\n            defaultMethod,\n            loadPaymentMethods,\n            isPaymentDataRequired,\n            onCartChangedError = noop,\n            onSubmit = noop,\n            onSubmitError = noop,\n            submitOrder,\n        } = this.props;\n\n        const {\n            selectedMethod = defaultMethod,\n            submitFunctions,\n        } = this.state;\n\n        const customSubmit = selectedMethod && submitFunctions[\n            getUniquePaymentMethodId(selectedMethod.id, selectedMethod.gateway)\n        ];\n\n        if (customSubmit) {\n            return customSubmit(values);\n        }\n\n        try {\n            await submitOrder(mapToOrderRequestBody(values, isPaymentDataRequired()));\n            onSubmit();\n        } catch (error) {\n            if (error.type === 'payment_method_invalid') {\n                return loadPaymentMethods();\n            }\n\n            if (isCartChangedError(error)) {\n                return onCartChangedError(error);\n            }\n\n            onSubmitError(error);\n        }\n    };\n\n    private setSelectedMethod: (method?: PaymentMethod) => void = method => {\n        const { selectedMethod } = this.state;\n\n        if (selectedMethod === method) {\n            return;\n        }\n\n        this.setState({ selectedMethod: method });\n    };\n\n    private setSubmit: (\n        method: PaymentMethod,\n        fn: (values: PaymentFormValues) => void | null\n    ) => void = (method, fn) => {\n        const uniqueId = getUniquePaymentMethodId(method.id, method.gateway);\n        const { submitFunctions } = this.state;\n\n        if (submitFunctions[uniqueId] === fn) {\n            return;\n        }\n\n        this.setState({\n            submitFunctions: {\n                ...submitFunctions,\n                [uniqueId]: fn,\n            },\n        });\n    };\n\n    private setValidationSchema: (\n        method: PaymentMethod,\n        schema: ObjectSchema<Partial<PaymentFormValues>> | null\n    ) => void = (method, schema) => {\n        const uniqueId = getUniquePaymentMethodId(method.id, method.gateway);\n        const { validationSchemas } = this.state;\n\n        if (validationSchemas[uniqueId] === schema) {\n            return;\n        }\n\n        this.setState({\n            validationSchemas: {\n                ...validationSchemas,\n                [uniqueId]: schema,\n            },\n        });\n    };\n}\n\nexport function mapToPaymentProps({\n    checkoutService,\n    checkoutState,\n}: CheckoutContextProps): WithCheckoutPaymentProps | null {\n    const {\n        data: {\n            getCheckout,\n            getConfig,\n            getCustomer,\n            getConsignments,\n            getOrder,\n            getPaymentMethod,\n            getPaymentMethods,\n            isPaymentDataRequired,\n        },\n        errors: {\n            getFinalizeOrderError,\n            getSubmitOrderError,\n        },\n        statuses: {\n            isInitializingPayment,\n            isSubmittingOrder,\n        },\n    } = checkoutState;\n\n    const checkout = getCheckout();\n    const config = getConfig();\n    const customer = getCustomer();\n    const consignments = getConsignments();\n    const { isComplete = false } = getOrder() || {};\n    const methods = getPaymentMethods() || EMPTY_ARRAY;\n\n    if (!checkout || !config || !customer || isComplete) {\n        return null;\n    }\n\n    const {\n        enableTermsAndConditions: isTermsConditionsEnabled,\n        features,\n        orderTermsAndConditionsType: termsConditionsType,\n        orderTermsAndConditions: termsCondtitionsText,\n        orderTermsAndConditionsLink: termsCondtitionsUrl,\n    } = config.checkoutSettings as CheckoutSettings & { orderTermsAndConditionsLocation: string };\n\n    const isTermsConditionsRequired = isTermsConditionsEnabled;\n    const selectedPayment = find(checkout.payments, { providerType: PaymentMethodProviderType.Hosted });\n\n    const { isStoreCreditApplied } = checkout;\n\n    let selectedPaymentMethod;\n    let filteredMethods;\n\n    filteredMethods = methods.filter((method: PaymentMethod) => {\n        if (method.id === PaymentMethodId.Bolt && method.initializationData) {\n            return !!method.initializationData.showInCheckout;\n        }\n\n        return true;\n    });\n\n    if (consignments && consignments.length > 1) {\n        const multiShippingIncompatibleMethodIds: string[] = [\n            PaymentMethodId.AmazonPay,\n            PaymentMethodId.Amazon,\n        ];\n\n        filteredMethods = methods.filter((method: PaymentMethod) => {\n            return multiShippingIncompatibleMethodIds.indexOf(method.id) === -1;\n        });\n    }\n\n    if (selectedPayment) {\n        selectedPaymentMethod = getPaymentMethod(selectedPayment.providerId, selectedPayment.gatewayId);\n        filteredMethods = selectedPaymentMethod ? compact([selectedPaymentMethod]) : filteredMethods;\n    } else {\n        selectedPaymentMethod = find(filteredMethods, { config: { hasDefaultStoredInstrument: true } });\n        filteredMethods = filteredMethods;\n    }\n\n    return {\n        applyStoreCredit: checkoutService.applyStoreCredit,\n        availableStoreCredit: customer.storeCredit,\n        cartUrl: config.links.cartLink,\n        clearError: checkoutService.clearError,\n        defaultMethod: selectedPaymentMethod ? selectedPaymentMethod : filteredMethods[0],\n        finalizeOrderError: getFinalizeOrderError(),\n        finalizeOrderIfNeeded: checkoutService.finalizeOrderIfNeeded,\n        loadCheckout: checkoutService.loadCheckout,\n        isInitializingPayment: isInitializingPayment(),\n        isPaymentDataRequired,\n        isStoreCreditApplied,\n        isSubmittingOrder: isSubmittingOrder(),\n        isTermsConditionsRequired,\n        loadPaymentMethods: checkoutService.loadPaymentMethods,\n        methods: filteredMethods,\n        shouldExecuteSpamCheck: checkout.shouldExecuteSpamCheck,\n        shouldLocaliseErrorMessages: features['PAYMENTS-6799.localise_checkout_payment_error_messages'],\n        submitOrder: checkoutService.submitOrder,\n        submitOrderError: getSubmitOrderError(),\n        termsConditionsText: isTermsConditionsRequired && termsConditionsType === TermsConditionsType.TextArea ?\n            termsCondtitionsText :\n            undefined,\n        termsConditionsUrl: isTermsConditionsRequired && termsConditionsType === TermsConditionsType.Link ?\n            termsCondtitionsUrl :\n            undefined,\n        usableStoreCredit: checkout.grandTotal > 0 ?\n            Math.min(checkout.grandTotal, customer.storeCredit || 0) : 0,\n    };\n}\n\nexport default withLanguage(withCheckout(mapToPaymentProps)(Payment));\n","import { CartChangedError } from '@bigcommerce/checkout-sdk';\n\nexport default function isCartChangedError(error: Error): error is CartChangedError {\n    const requestError = error as CartChangedError;\n\n    return requestError.type === 'cart_changed';\n}\n"],"sourceRoot":""}