{"version":3,"file":"3a5d258b.js","sources":["../../../node_modules/@shopify/hydrogen/dist/esnext/components/CartLineProvider/CartLineProvider.client.js","../../../node_modules/@shopify/hydrogen/dist/esnext/components/CartLineImage/CartLineImage.client.js","../../../node_modules/@shopify/hydrogen/dist/esnext/components/CartLineQuantity/CartLineQuantity.client.js","../../../node_modules/@shopify/hydrogen/dist/esnext/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.js","../../../node_modules/@shopify/hydrogen/dist/esnext/components/CartLines/CartLines.client.js","../../../src/helpers/note-from-tag.ts","../../../src/components/globals/cart/Cart.client.tsx"],"sourcesContent":["import React from 'react';\nimport { CartLineContext } from './context.js';\n/**\n * The `CartLineProvider` component creates a context for using a cart line.\n */\nexport function CartLineProvider({ children, line, }) {\n return (React.createElement(CartLineContext.Provider, { value: line }, children));\n}\n","import React from 'react';\nimport { useCartLine } from '../CartLineProvider/index.js';\nimport { Image } from '../Image/index.js';\n/**\n * The `CartLineImage` component renders an `Image` component for the cart line merchandise's image.\n * It must be a descendent of a `CartLineProvider` component.\n */\nexport function CartLineImage(props) {\n const cartLine = useCartLine();\n return cartLine.merchandise.image ? (React.createElement(Image, { ...props, data: cartLine.merchandise.image })) : null;\n}\n","import React from 'react';\nimport { useCartLine } from '../CartLineProvider/index.js';\n/**\n * The `CartLineQuantity` component renders a `span` element (or the type of HTML element\n * specified by the `as` prop) with the cart line's quantity. It must be a descendent of a `CartLineProvider` component.\n */\nexport function CartLineQuantity(props) {\n const cartLine = useCartLine();\n const { as, ...passthroughProps } = props;\n const Wrapper = as ? as : 'span';\n return React.createElement(Wrapper, { ...passthroughProps }, cartLine.quantity);\n}\n","import React, { useCallback } from 'react';\nimport { useCart } from '../CartProvider/index.js';\nimport { useCartLine } from '../CartLineProvider/index.js';\nimport { BaseButton } from '../BaseButton/index.js';\n/**\n * The `CartLineQuantityAdjustButton` component renders a button that adjusts the cart line's quantity when pressed.\n * It must be a descendent of a `CartLineProvider` component.\n */\nexport function CartLineQuantityAdjustButton(props) {\n const { status, linesRemove, linesUpdate } = useCart();\n const cartLine = useCartLine();\n const { children, adjust, onClick, ...passthroughProps } = props;\n const handleAdjust = useCallback(() => {\n if (adjust === 'remove') {\n linesRemove([cartLine.id]);\n return;\n }\n const quantity = adjust === 'decrease' ? cartLine.quantity - 1 : cartLine.quantity + 1;\n if (quantity <= 0) {\n linesRemove([cartLine.id]);\n return;\n }\n linesUpdate([{ id: cartLine.id, quantity }]);\n }, [adjust, cartLine.id, cartLine.quantity, linesRemove, linesUpdate]);\n return (React.createElement(BaseButton, { disabled: status !== 'idle', onClick: onClick, defaultOnClick: handleAdjust, ...passthroughProps }, children));\n}\n","import React, { Fragment } from 'react';\nimport { useCart } from '../CartProvider/index.js';\nimport { CartLineProvider } from '../CartLineProvider/index.js';\n/**\n * The `CartLines` component iterates over each cart line and renders its `children` within\n * a `CartLineProvider` for each cart line.\n */\nexport function CartLines(props) {\n const { lines } = useCart();\n const { as, children, ...passthroughProps } = props;\n const Wrapper = as ?? Fragment;\n const ChildWrapper = Wrapper === 'ul' ? 'li' : Fragment;\n return (React.createElement(Wrapper, { ...passthroughProps }, lines.map((line) => {\n return (React.createElement(ChildWrapper, { key: line.id },\n React.createElement(CartLineProvider, { line: line }, children)));\n })));\n}\n","/**\n * Note From Tag\n */\n\nconst noteFromTag = function (tagsArr: Array) {\n let note;\n\n if (tagsArr.includes('final-sale')) {\n note = 'Final Sale';\n }\n\n return note;\n};\n\nexport default noteFromTag;\n","import {\n useCart,\n Link,\n Image,\n CartLines,\n CartLineImage,\n CartLineQuantityAdjustButton,\n CartLineQuantity,\n useCartLine,\n ClientAnalytics,\n Money,\n useLocalization,\n useServerProps,\n} from '@shopify/hydrogen';\nimport clsx from 'clsx';\nimport {useEffect, useState} from 'react';\nimport {getCookie, getCookiFromPartial} from 'Js/lib/cookies';\nimport {CartCheckoutButton} from './CartCheckoutButton.client';\nimport CartRecs from './CartRecs.client';\nimport EmptyCartRecs from './EmptyCartRecs.client';\nimport {useCartUI} from './CartUIProvider.client';\nimport {\n DEFAULT_CLASSES,\n BUTTON_SECONDARY_CLASSES,\n} from '@base/button/Button.client';\nimport Text from '@base/text/Text';\nimport {Drawer} from '@base/drawer/Drawer.client';\nimport BaseModal from '@base/modal/Modal.client';\nimport productTitle from 'Js/helpers/product-title';\nimport noteFromTag from 'Js/helpers/note-from-tag';\nimport {getIdFromGid} from 'Js/lib/gid';\nimport CartTwoHourDelivery from './CartTwoHourDelivery.client';\nimport {CartItemBundleTag} from './cart-item-bundle-tag/CartItemBundleTag.client';\nimport {useGlobalSettings} from 'Js/hooks/useGlobalSettings';\n\n// TODO: 2 hour delivery\n\n/**\n * A client component that contains the merchandise that a customer intends to purchase, and the estimated cost associated with the cart\n */\nexport function Cart({cartData}: {cartData: any}) {\n const [showCart, setShowCart] = useState(false);\n const {isCartOpen, closeCart} = useCartUI();\n const {status} = useCart();\n const {pending} = useServerProps();\n\n useEffect(() => {\n if (status !== 'updating') {\n if (isCartOpen) {\n setShowCart(true);\n } else {\n setShowCart(false);\n }\n }\n }, [status, isCartOpen]);\n\n useEffect(() => {\n if (pending && closeCart) closeCart();\n }, [pending, closeCart]);\n\n return (\n \n \n \n );\n}\n\nexport function CartDetails({\n cartData,\n isMiniBag,\n}: {\n cartData: any;\n isMiniBag: boolean;\n}) {\n const {totalQuantity, lines} = useCart();\n\n // Two Hour Delivery\n const {cartTwoHourDelivery} = cartData || {};\n const {cartHeadingError} = cartTwoHourDelivery || {};\n const includesTwoHourDelivery = !!lines.find((line) => {\n return !!line.attributes.find((attr) => attr.key === '2 Hour Delivery');\n });\n const allItemsTwoHourDelivery = lines.every((line) => {\n const attr = line.attributes.find((attr) => attr.key === '2 Hour Delivery');\n return !!attr;\n });\n const invalidCartItems = !includesTwoHourDelivery || !allItemsTwoHourDelivery;\n\n return (\n \n \n {totalQuantity === 0 ? (\n \n ) : (\n <>\n {!isMiniBag && includesTwoHourDelivery && invalidCartItems && (\n
\n

\n {cartHeadingError}\n

\n
\n )}\n {!isMiniBag && (\n