\n \n
{t('cart.cardTotal.subTotal')}
\n
\n {isFetchingPrice ? : formatPrice(totalPriceWithoutDiscount)}\n
\n
\n\n {/* Subscription */}\n {totalSubscriptionDiscountPrice > 0 && (\n \n
\n {t('cart.cardTotal.savedWithSubscription')}\n
\n
\n {isFetchingPrice ? : `- ${formatPrice(totalSubscriptionDiscountPrice)}`}\n
\n
\n )}\n\n {/* Promo code */}\n {promotion?.discountPrice && promotion.discountPrice > 0 && (\n \n
\n {promotion.marketingName}\n
\n
\n {isFetchingPrice ? : `- ${formatPrice(promotion.discountPrice)}`}\n
\n
\n )}\n\n {/* Delivery fees / shipping discount */}\n {shippingDiscount > 0 ? (\n <>\n \n
\n {t('cart.cardTotal.shipping')}\n
\n
{isFetchingPrice ? : formatPrice(deliveryFees)}
\n
\n \n
\n {t('cart.cardTotal.shippingDiscount')}\n
\n
\n {isFetchingPrice ? : `- ${formatPrice(shippingDiscount)}`}\n
\n
\n >\n ) : (\n \n
\n {t('cart.cardTotal.deliveryFees')}\n
\n
\n {isFetchingPrice ? : formattedDeliveryFees}\n
\n
\n )}\n \n );\n};\n","\n import API from \"!../../../../../node_modules/.pnpm/style-loader@4.0.0_webpack@5.91.0_webpack-cli@5.1.4_/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../../../node_modules/.pnpm/style-loader@4.0.0_webpack@5.91.0_webpack-cli@5.1.4_/node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../../../node_modules/.pnpm/style-loader@4.0.0_webpack@5.91.0_webpack-cli@5.1.4_/node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../../../node_modules/.pnpm/style-loader@4.0.0_webpack@5.91.0_webpack-cli@5.1.4_/node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../../../node_modules/.pnpm/style-loader@4.0.0_webpack@5.91.0_webpack-cli@5.1.4_/node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../../../node_modules/.pnpm/style-loader@4.0.0_webpack@5.91.0_webpack-cli@5.1.4_/node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../../../node_modules/.pnpm/css-loader@7.1.1_webpack@5.91.0_webpack-cli@5.1.4_/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!../../../../../node_modules/.pnpm/sass-loader@14.2.1_node-sass@9.0.0_sass@1.75.0_webpack@5.91.0_webpack-cli@5.1.4_/node_modules/sass-loader/dist/cjs.js!../../../../../node_modules/.pnpm/postcss-loader@8.1.1_postcss@8.4.38_typescript@5.5.3_webpack@5.91.0_webpack-cli@5.1.4_/node_modules/postcss-loader/dist/cjs.js!./CartTotalPromotion.module.scss\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\noptions.insert = insertFn.bind(null, \"head\");\noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../../../node_modules/.pnpm/css-loader@7.1.1_webpack@5.91.0_webpack-cli@5.1.4_/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!../../../../../node_modules/.pnpm/sass-loader@14.2.1_node-sass@9.0.0_sass@1.75.0_webpack@5.91.0_webpack-cli@5.1.4_/node_modules/sass-loader/dist/cjs.js!../../../../../node_modules/.pnpm/postcss-loader@8.1.1_postcss@8.4.38_typescript@5.5.3_webpack@5.91.0_webpack-cli@5.1.4_/node_modules/postcss-loader/dist/cjs.js!./CartTotalPromotion.module.scss\";\n export default content && content.locals ? content.locals : undefined;\n","import { ANALYTIC_EVENTS, CartStore, retrieveCartPriceDetailsQuery } from '@rc-d2c/context-manager';\nimport { useFormattedPrice, useGlobalSettingsStore } from '@rc-d2c/shared-behavior';\nimport { RcButton, RcButtonIcon, RcInput, RcMessage } from '@rc-d2c/shared-ui';\nimport classnames from 'classnames/bind';\nimport React, { ChangeEvent, FormEvent, useEffect, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useStore } from 'zustand';\n\nimport { getErrorMsgKey } from '../../utils/errorMessageUtils';\nimport styles from './CartTotalPromotion.module.scss';\n\nconst cx = classnames.bind(styles);\n\ntype CartTotalPromotionProps = {\n isDisabled?: boolean;\n};\n\nexport const CartTotalPromotion = ({ isDisabled }: CartTotalPromotionProps) => {\n const { t } = useTranslation();\n\n const { promotion, setCurrentPromotionCodeApplied, setPromotion, currentPromotionCodeApplied } = useStore(CartStore, (state) => state);\n const country = useGlobalSettingsStore.use.country();\n const { formatPrice } = useFormattedPrice();\n\n const [currentPromoCode, setCurrentPromoCode] = useState('');\n const [showInputPromoCode, setShowInputPromoCode] = useState(false);\n\n useEffect(\n function initPromotion() {\n if (promotion?.showMessage) {\n window.dataLayer.push({\n event: ANALYTIC_EVENTS.CART_PROMO_CODE_CLICK,\n [ANALYTIC_EVENTS.CART_PROMO_CODE_CLICK]: {\n status: promotion.type === 'success' ? 'Success' : 'Failure',\n promoCodeName: currentPromoCode,\n },\n });\n }\n\n if (!promotion || promotion.type === 'success') {\n setCurrentPromoCode('');\n }\n\n if (promotion?.type === 'success') {\n setShowInputPromoCode(true);\n }\n },\n [promotion],\n );\n\n const handleChangePromotionCode = (event: ChangeEvent