{"version":3,"sources":["webpack:///./cartridges/app_storefront_widgets/cartridge/client/default/js/widgets/cart/CartMgr.js","webpack:///./cartridges/app_storefront_widgets/cartridge/client/default/js/widgets/cart/PromoCodeDisclosure.js","webpack:///./cartridges/app_storefront_widgets/cartridge/client/default/js/widgets/forms/CouponForm.js"],"names":["Widget","CartMgr","prefs","cartGetUrl","accessibilityAlerts","actionUrls","tauAttrRemoveProductConfirmationPopUp","items","shipments","valid","error","redirectUrl","couponAction","init","cart","onDestroy","timeout","renderCart","then","eventBus","emit","on","onProductUpdated","response","cartModel","accessibilityAlert","productupdated","onCouponUpdated","Promise","reject","Error","map","item","itemObject","quantityOptions","quantityOptionsList","range","minOrderQuantity","maxOrderQuantity","qty","index","selected","quantity","push","shipment","shippingMethods","shippingMethod","ID","selectedShippingMethod","length","noShippingMethodsAvailable","selectedShippingMethodObject","find","render","ref","updateQty","inputSelect","showProgressBar","uuid","data","submitFormJson","pid","getValue","resp","renderCartResponse","quantitychanged","catch","errorMessage","message","renderCartWithItemLevelActionError","finally","hideProgressBar","window","location","assign","editProduct","editBtn","getContentByUrl","getById","editProductModal","showModal","body","attributes","removeProduct","removeButton","confirmDialog","productName","onProductLinkClick","link","itemUUID","existingOldItem","cartItem","UUID","returnItem","actionErrorMessage","confirmedRemoveProduct","button","movedToWishlist","removeButtonUUID","confirmationRemoveCallback","basket","undefined","moveProductToWishlist","movedtowishlist","productremoved","attr","proceedToCheckout","btn","event","preventDefault","scrollToError","cartErrorMessage","get","scrollWindowTo","Disclosure","PromoCodeDisclosure","toggleContent","shown","couponForm","focusInput","AjaxForm","CouponForm","msgEmptyCoupon","couponInput","couponCodeContent","couponDeletionMsg","removeCouponUrl","classesShow","onSubmitted","params","search","URLSearchParams","pageViewData","document","getElementById","isBOPIS","customerInfo","getAttribute","isLoggedIn","JSON","parse","customerLoggedIn","value","has","totals","isZeroTotal","grandTotal","reload","input","setError","fieldErrors","Object","keys","forEach","errorKey","setValue","onError","removeCoupon","errMsg","setText","h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,IAAqCA,KAAK,CAACiB,KAAN,EAA5E;AACH;;AAnH6B;;AAsHlC,SAAO5C,UAAP;AACH,C","file":"cart.widgets.bundle.js","sourcesContent":["import { range, timeout } from 'widgets/toolbox/util';\nimport { submitFormJson, getContentByUrl } from 'widgets/toolbox/ajax';\nimport { scrollWindowTo } from 'widgets/toolbox/scroll';\n\n/**\n * @typedef {typeof import('widgets/Widget').default} Widget\n * @typedef {InstanceType>} inputSelect\n * @typedef {InstanceType} refElement\n * @typedef {InstanceType>} confirmDialog\n * @typedef {InstanceType>} modal\n * @typedef {{items: Array, shipments: Array, valid: object, error: string, redirectUrl: string, couponAction: string}|undefined} Cart\n */\n\n/**\n * @description Base CartMgr implementation\n * @param {Widget} Widget Base widget for extending\n * @returns {typeof CartMgr} Cart Manager class\n */\nexport default function (Widget) {\n /**\n * @category widgets\n * @subcategory cart\n * @class CartMgr\n * @augments Widget\n * @classdesc CartMgr component on Cart page. Renders the whole cart template on each update e.g. quantity/coupon/product edit etc.\n * Widget manages next actions:\n * 1. Edit product in a cart\n * 2. Change product quantity\n * 3. Remove product (move to Wish list) from Cart\n * 4. Communicate actions results\n * 5. Re-render Cart including products list and cart summary in case of actions like: product updated, coupon applied etc.\n * 6. Enable/disable \"Secure Checkout\" button to move to Checkout process depending on if there are errors in cart, which prevents moving to Checkout\n * @property {string} data-widget - Widget name `cartMgr`\n * @property {Array} data-items - Cart items list\n * @property {Array} data-approaching-discounts - Cart approaching discounts list\n * @property {object} data-action-urls - Cart action URLs\n * @property {object} data-totals - Cart totals\n * @property {Array} data-shipments - Cart shipments list\n * @property {boolean} data-valid - Is Cart valid\n * @property {number} data-num-items - Number of items in Cart\n * @property {string} data-cart-get-url - An URL to get updated Cart object from server\n * @property {object} data-accessibility-alerts - Accessibility alerts messages for different user actions\n * Possible values are: `quantitychanged`, `productupdated`, `productremoved`,\n * `promocodeadded`, `promocodeapplied`, `promocoderemoved`, `addedtowishlist`\n * @example Example of CartMgr widget markup\n * \n *
\n * \n * \n */\n class CartMgr extends Widget {\n prefs() {\n return {\n cartGetUrl: '',\n accessibilityAlerts: {},\n actionUrls: {},\n tauAttrRemoveProductConfirmationPopUp: 'remove_item_confirmation_dialog',\n items: [],\n shipments: [],\n valid: true,\n error: '',\n redirectUrl: '',\n couponAction: '',\n ...super.prefs()\n };\n }\n\n /**\n * @description Widget initialisation\n * @listens \"minicart.updated\"\n * @listens \"product.updated\"\n * @listens \"coupon.updated\"\n * @emits \"cart.rendered\"\n * @returns {void}\n */\n init() {\n this.cart = this.prefs();\n // render in next tick so will not block initialization\n this.onDestroy(timeout(() => {\n this.renderCart(this.cart).then(() => {\n this.eventBus().emit('cart.rendered');\n });\n }, 0));\n\n this.eventBus().on('minicart.updated', 'renderCart');\n this.eventBus().on('product.updated', 'onProductUpdated');\n this.eventBus().on('coupon.updated', 'onCouponUpdated');\n }\n\n /**\n * @description Executes on product updated in Quick View\n * @param {object} response Response object from server\n * @returns {void}\n */\n onProductUpdated(response) {\n const cart = response.cartModel;\n\n if (cart) {\n this.renderCart(cart)\n .then(() => this.accessibilityAlert(this.prefs().accessibilityAlerts.productupdated));\n }\n }\n\n /**\n * @description Executes on product updated in Quick View\n * @param {Cart} cart Cart object\n * @returns {void}\n */\n onCouponUpdated(cart) {\n this.renderCart(cart)\n .then(() => {\n if (cart) {\n const accessibilityAlert = this.prefs().accessibilityAlerts[`promocode${cart.couponAction}`];\n this.accessibilityAlert(accessibilityAlert);\n }\n });\n }\n\n /**\n * @description Renders Cart object and saves it as a current cart state\n * Adds some information into Cart object proior to rendering,\n * to make the whole object mustache template friendly\n * @emits \"cart.updated\"\n * @param {Cart} cart - Cart object to reflect in template\n * @returns {Promise} result\n */\n renderCart(cart) {\n if (!cart) {\n return Promise.reject(new Error());\n }\n\n cart.items = cart.items.map(item => {\n const itemObject = { ...item };\n\n if (!item.quantityOptions) {\n return itemObject;\n }\n\n itemObject.quantityOptionsList = range(\n item.quantityOptions.minOrderQuantity,\n item.quantityOptions.maxOrderQuantity + 1\n ).map(qty => ({\n index: qty,\n selected: qty === item.quantity ? 'selected' : ''\n }));\n\n if (item.quantity > item.quantityOptions.maxOrderQuantity) {\n itemObject.quantityOptionsList.push({\n index: item.quantity,\n selected: 'selected'\n });\n }\n\n return itemObject;\n });\n\n cart.shipments = (cart.shipments || []).map(shipment => {\n shipment.shippingMethods = (shipment.shippingMethods || []).map(shippingMethod => ({\n ...shippingMethod,\n selected: shippingMethod.ID === shipment.selectedShippingMethod ? 'selected' : ''\n }));\n if (!shipment.shippingMethods.length) {\n shipment.noShippingMethodsAvailable = true;\n }\n shipment.selectedShippingMethodObject = (shipment.shippingMethods || [])\n .find(shippingMethod => shippingMethod.ID === shipment.selectedShippingMethod);\n return shipment;\n });\n\n this.cart = cart;\n\n /**\n * @description Event, indicates that cart content was updated\n * @event \"cart.updated\"\n */\n this.eventBus().emit('cart.updated', cart);\n\n return this.render('cartTemplate', cart, this.ref('cartContainer'));\n }\n\n /**\n * @description Updates quantity of choosen product in Cart page\n * @param {inputSelect} inputSelect - Select quantity input\n * @returns {void}\n */\n updateQty(inputSelect) {\n this.showProgressBar();\n const uuid = inputSelect.data('uuid');\n submitFormJson(inputSelect.data('action'), {\n pid: inputSelect.data('pid'),\n uuid: uuid,\n quantity: inputSelect.getValue()\n }, 'GET')\n .then((resp) => {\n this.renderCartResponse(resp);\n this.accessibilityAlert(this.prefs().accessibilityAlerts.quantitychanged);\n })\n .catch((error) => {\n if (error && error.error && error.errorMessage) {\n this.render('errorTemplate', { message: error.errorMessage }, this.ref('errorMsgs'));\n } else {\n this.renderCartWithItemLevelActionError(uuid, error.message);\n }\n })\n .finally(() => {\n this.hideProgressBar();\n });\n }\n\n /**\n * @description Fires `alert.show` event to be handled with Global Alerting System\n * @param {string} accessibilityAlert - alert string\n * @emits \"alert.show\"\n * @returns {void}\n */\n accessibilityAlert(accessibilityAlert) {\n this.eventBus().emit('alert.show', {\n accessibilityAlert\n });\n }\n\n /**\n * @description Renders cart response from server.\n * Follows redirect URL in case if cart was not found on server\n * (request to update product/quantity etc)\n * @param {Cart} resp - server response\n * @returns {void}\n */\n renderCartResponse(resp) {\n if (resp && resp.error && resp.redirectUrl) {\n window.location.assign(resp.redirectUrl);\n } else {\n this.renderCart(resp);\n }\n }\n\n /**\n * @description Handler for \"Edit\" product button in a Cart\n * @param {refElement} editBtn - Target \"Edit\" button\n * @emits \"product.tile.qv.open.edit\"\n * @returns {void}\n */\n editProduct(editBtn) {\n this.showProgressBar();\n const uuid = editBtn.data('uuid');\n\n getContentByUrl(editBtn.data('href'), { uuid })\n .then((response) => {\n this.getById('editProductModal', (/** @type {modal} */ editProductModal) => editProductModal\n .showModal({\n body: response,\n attributes: {\n 'data-tau-unique': 'edit_product_dialog'\n }\n }));\n\n this.eventBus().emit('product.tile.qv.open.edit', editBtn);\n })\n .catch(error => {\n this.renderCartWithItemLevelActionError(uuid, error.message);\n })\n .finally(() => {\n this.hideProgressBar();\n });\n }\n\n /**\n * @description Handler for \"Remove\" product button in a Cart\n * Stores clicked button instance to property because of \"Remove Popup\" displaying and further interaction\n * @param {refElement} removeButton - Clicked \"Remove\" product button\n * @returns {void}\n */\n removeProduct(removeButton) {\n this.removeButton = removeButton;\n this.getById('confirmDialog', (/** @type {confirmDialog} */ confirmDialog) => {\n confirmDialog.showModal({\n productName: removeButton.data('name'),\n attributes: {\n 'data-tau': this.prefs().tauAttrRemoveProductConfirmationPopUp\n }\n });\n });\n }\n\n /**\n * @description Executes when user clicks on product details link in the cart.\n * Usually used by analytics etc.\n * @emits \"cart.product.link.click\"\n * @param {refElement} link - clicked product tile link\n * @returns {void}\n */\n onProductLinkClick(link) {\n this.eventBus().emit('cart.product.link.click', link);\n }\n\n /**\n * @description Renders Cart with error message on Cart Item level.\n * Usually it may happens when in parallel tab user removed product from cart.\n * As far as we should display error on product, which was removed, thus we don't need\n * to update this exact item in a stored earlier cart object\n * @param {string} itemUUID - Product item identifier\n * @param {string} error - an error response from the server\n * @returns {void}\n */\n renderCartWithItemLevelActionError(itemUUID, error) {\n if (!this.cart) {\n return;\n }\n\n this.cart.items = this.cart.items.map(item => {\n const existingOldItem = this.cart && this.cart.items.find((cartItem) => cartItem.UUID === item.UUID);\n const returnItem = !existingOldItem ? item : existingOldItem;\n return {\n ...returnItem,\n actionErrorMessage: (itemUUID === item.UUID) ? error : ''\n };\n });\n\n this.cart.valid.error = true;\n\n this.renderCart(this.cart);\n }\n\n /**\n * @description A callback, which is executed, when customer agreed to remove product in confirmation popup\n * @param {refElement|null} button - Button, pressed in confirmation modal\n * @param {boolean} [movedToWishlist] - Indicates if product was moved to wishlist\n * @emits \"cart.remove.product\"\n * @returns {void}\n */\n confirmedRemoveProduct(button, movedToWishlist = false) {\n if (this.removeButton) {\n const removeButtonUUID = this.removeButton.data('uuid');\n this.eventBus().emit('cart.remove.product', this);\n this.showProgressBar();\n submitFormJson(this.removeButton.data('removeAction') || this.removeButton.data('action'), {\n pid: this.removeButton.data('pid'),\n uuid: removeButtonUUID\n }, 'POST')\n .then((response) => {\n this.confirmationRemoveCallback(response.basket, movedToWishlist);\n })\n .catch(error => {\n this.renderCartWithItemLevelActionError(removeButtonUUID, error.message);\n })\n .finally(() => {\n this.hideProgressBar();\n });\n this.removeButton = undefined;\n }\n }\n\n /**\n * @description Move product from cart to wishlist.\n * In fact this functionality implemented in 2 steps:\n * 1. Add product to wishlist\n * 2. Remove product from cart\n * This is done due to possible backend code duplication in one universal endpoint\n * @returns {void}\n */\n moveProductToWishlist() {\n if (this.removeButton) {\n const removeButtonUUID = this.removeButton.data('uuid');\n this.showProgressBar();\n submitFormJson(this.prefs().actionUrls.moveProductToWishlist, {\n pid: this.removeButton.data('pid')\n }).then(() => {\n this.confirmedRemoveProduct(null, true);\n }).catch(error => {\n this.renderCartWithItemLevelActionError(removeButtonUUID, error.message);\n }).finally(() => {\n this.hideProgressBar();\n });\n }\n }\n\n /**\n * @description A callback, which is executed once `remove` product server call was performed\n * @param {Cart} cart - server response object\n * @param {boolean} [movedToWishlist] - Indicates if product was moved to wishlist\n * @returns {void}\n */\n confirmationRemoveCallback(cart, movedToWishlist = false) {\n this.renderCart(cart)\n .then(() => this.accessibilityAlert(\n movedToWishlist\n ? this.prefs().accessibilityAlerts.movedtowishlist\n : this.prefs().accessibilityAlerts.productremoved\n ));\n }\n\n /**\n * @description Shows progress bar\n * @returns {void}\n */\n showProgressBar() {\n this.ref('cartContainer').attr('aria-busy', 'true');\n }\n\n /**\n * @description Hides progress bar\n * @returns {void}\n */\n hideProgressBar() {\n this.ref('cartContainer').attr('aria-busy', 'false');\n }\n\n /**\n * @description Handles `proceed to checkout` button click.\n *
In case of error - to not allow Customer to enter checkout flow and scroll to cart error message\n * @param {refElement} btn - clicked button\n * @param {Event} event - target event\n * @emits \"cart.page.submitted\"\n * @returns {void}\n */\n proceedToCheckout(btn, event) {\n if (btn.data('error')) {\n event.preventDefault();\n this.scrollToError();\n }\n\n this.eventBus().emit('cart.page.submitted', this);\n }\n\n /**\n * @description Scrolls cart error messages into viewport\n * @returns {void}\n */\n scrollToError() {\n const cartErrorMessage = this.ref('errorMsgs').get();\n if (cartErrorMessage) {\n scrollWindowTo(cartErrorMessage);\n }\n }\n }\n\n return CartMgr;\n}\n","/**\n * @typedef {ReturnType} Disclosure\n * @typedef {InstanceType>} couponForm\n */\n\n/**\n * @description Base PromoCodeDisclosure implementation\n * @param {Disclosure} Disclosure Base widget for extending\n * @returns {typeof PromoCodeDisclosure} BackToTop class\n */\nexport default function (Disclosure) {\n /**\n * @category widgets\n * @subcategory cart\n * @class PromoCodeDisclosure\n * @augments Disclosure\n * @classdesc PromoCodeDisclosure component.\n * Based on {@link Disclosure} [accessibility component](https://www.w3.org/TR/wai-aria-practices/#disclosure)\n * Used to manage specific action on coupon application form - set focus on coupon input once opened.\n * @property {string} data-widget - Widget name `promoCodeDisclosure`\n * @property {string} data-show-on-init - If we need to show disclosure content on init\n * @example PromoCodeDisclosure widget markup\n * \n * Open me\n *