Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 7x 7x 305x 305x 305x 305x 305x 305x 305x 305x 305x 305x 305x 305x 305x 305x 610x 305x 305x 1x 304x | import { CheckoutContextProps } from '../checkout'; import { EMPTY_ARRAY } from '../common/utility'; import { RedeemableProps } from './Redeemable'; export default function mapToRedeemableProps( context: CheckoutContextProps ): RedeemableProps | null { const { checkoutService, checkoutState: { data: { getConfig, getCoupons, getGiftCertificates, }, statuses: { isApplyingCoupon, isApplyingGiftCertificate, isRemovingCoupon, isRemovingGiftCertificate, }, errors: { getApplyCouponError, getApplyGiftCertificateError, getRemoveCouponError, getRemoveGiftCertificateError, }, }, } = context; const config = getConfig(); if (!config) { return null; } return { appliedRedeemableError: getApplyCouponError() || getApplyGiftCertificateError(), applyCoupon: checkoutService.applyCoupon, applyGiftCertificate: checkoutService.applyGiftCertificate, clearError: checkoutService.clearError, coupons: getCoupons() || EMPTY_ARRAY, giftCertificates: getGiftCertificates() || EMPTY_ARRAY, isApplyingRedeemable: (isApplyingCoupon() || isApplyingGiftCertificate()), isRemovingCoupon: isRemovingCoupon(), isRemovingGiftCertificate: isRemovingGiftCertificate(), onRemovedCoupon: checkoutService.removeCoupon, onRemovedGiftCertificate: checkoutService.removeGiftCertificate, removedRedeemableError: (getRemoveCouponError() || getRemoveGiftCertificateError()), shouldCollapseCouponCode: config.checkoutSettings.isCouponCodeCollapsed, }; } |