{"version":3,"file":"../cart-ajax-220.min.js","sources":["cart-ajax-220.js"],"sourcesContent":["/**\n * Manage cart items ajax actions.\n *\n * DEPENDS ON:\n * - jQuery // Interact with WooCommerce events\n */\n (function (root, factory) {\n\tif ( typeof define === 'function' && define.amd ) {\n\t\tdefine([], factory(root));\n\t} else if ( typeof exports === 'object' ) {\n\t\tmodule.exports = factory(root);\n\t} else {\n\t\troot.CartAjax = factory(root);\n\t}\n})(typeof global !== 'undefined' ? global : this.window || this.global, function (root) {\n\n\t'use strict';\n\n\tvar $ = jQuery;\n\tvar _hasJQuery = ( $ != null );\n\n\tvar _hasInitialized = false;\n\tvar _animationEndEvent = window.whichAnimationEnd ? window.whichAnimationEnd() : 'animationend';\n\tvar _publicMethods = {};\n\tvar _settings = {\n\t\tbodyClass: 'has-fc-cart-ajax--activated',\n\n\t\tmessagesWrapperSelector: '.woocommerce-notices-wrapper, .woocommerce-NoticeGroup-checkout',\n\n\t\tdataAttributePrefix: 'data-',\n\n\t\tremoveItemButtonSelector: '.cart_item .remove',\n\t\trestoreItemButtonSelector: '.cart_item .restore-item',\n\t\trestoreItemDismissButtonSelector: '.cart_item .restore-item-dismiss',\n\t\tcartItemSelector: '.cart_item',\n\t\tcartItemBlockUIElementSelector: '.cart_item td',\n\t\tcartItemAnimationElementSelector: '.cart_item td',\n\t\tcartItemRemovedTemplate: '##CONTENT##',\n\t\tcartItemRemoveAnimationClass: 'fade-out-right',\n\t\tcartItemRemoveAnimationName: 'fade-out-right',\n\t\tcartItemRemovingClass: 'removing',\n\t\tcartItemRemovedClass: 'removed',\n\t\tcartItemUndoClass: 'undo',\n\t\tcartItemKeyAttribute: 'data-cart_item_key',\n\t\tcartItemDataFieldsSelector: 'input, select, textarea',\n\t\t\n\t\tcartItemsListSelector: '.woocommerce-cart-form__contents tbody',\n\t\tcartItemRestoreSelector: '.cart_item.removed.undo',\n\t\tcartItemNotRemovedSelector: '.cart_item:not( .removed ):not( .undo )',\n\t\t\n\t\taddToCartButtonSelector: '.add_to_cart_button.ajax_add_to_cart',\n\t\tproductIdAttribute: 'data-product_id',\n\t\taddToCartButtonAddedClass: 'added',\n\t\taddToCartButtonLoadingClass: 'loading',\n\n\t\tquantityWrapperSelector: '.cart_item .quantity',\n\t\tquantityInputSelector: '.cart_item input.qty',\n\t\tquantitySpinnerButtonSelector: '.cart_item .fc-number-spin-button',\n\t\tquantityAttribute: 'data-quantity',\n\t\tquantityMinAttribute: 'min',\n\t\tquantityMaxAttribute: 'max',\n\n\t\tquantityLimitAnimationEnabled: 'yes',\n\t\tquantityLimitAnimationClass: 'shake',\n\t\tquantityLimitAnimationName: 'shake',\n\n\t\tformSubmitFieldsSelector: 'input:not( [type=\"button\"] ):not( [type=\"submit\"] ):not( [type=\"reset\"] ):not( [type=\"file\"] ):not( [type=\"image\"] )',\n\n\t\tuiProcessingClass: 'processing',\n\n\t\tupdateWaitTime: 500,\n\n\t\tfragmentsUpdateEvent: 'wc_fragment_refresh',\n\t\tfragmentsReplacedEvent: 'wc_fragments_refreshed',\n\n\t\taddToCartNonce: '', // Value updated during runtime\n\t\tremoveCartItemNonce: '', // Value updated during runtime\n\t\trestoreCartItemNonce: '', // Value updated during runtime\n\t\tupdateCartItemNonce: '', // Value updated during runtime\n\t};\n\tvar _restoreItemsMatrix = [];\n\n\n\n\t/**\n\t * METHODS\n\t */\n\n\n\n\t/**\n\t * Remove all notices from the top of the page.\n\t *\n\t * @param HTML content HTML content to be displayed.\n\t */\n\tvar clearNotices = function() {\n\t\tvar messagesWrappers = document.querySelectorAll( _settings.messagesWrapperSelector );\n\t\tfor ( var i = 0; i < messagesWrappers.length; i++ ) {\n\t\t\tvar wrapper = messagesWrappers[ i ];\n\t\t\twrapper.innerHTML = '';\n\t\t}\n\t}\n\n\t/**\n\t * Add notices at the top of the page, then scroll to display it on the screen.\n\t *\n\t * @param HTML content HTML content to be displayed.\n\t */\n\tvar showNotices = function( content ) {\n\t\tvar messagesWrapper = document.querySelector( _settings.messagesWrapperSelector );\n\t\tmessagesWrapper.innerHTML = content;\n\n\t\t// Maybe scroll notices into view\n\t\tif ( window.CartUpdate ) {\n\t\t\tCartUpdate.scrollToNotices();\n\t\t}\n\t}\n\n\n\n\t/**\n\t * Use the same method that WooCommerce uses to block other parts of the checkout form while updating.\n\t * The UI is unblocked by the WooCommerce `checkout.js` script (which is replaced with a modified version but keeps the same behavior)\n\t * using the checkout fragment selector, then unblocking after the checkout update is completed.\n\t *\n\t * @param HTMLElement element Element to block the UI and show the loading indicator.\n\t */\n\tvar blockUI = function( element ) {\n\t\t$( element ).addClass( _settings.uiProcessingClass ).block( {\n\t\t\tmessage: null,\n\t\t\toverlayCSS: {\n\t\t\t\tbackground: '#fff',\n\t\t\t\topacity: 0.6\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * Unblock UI element to be used again.\n\t *\n\t * @param HTMLElement element Element to get the UI unblocked.\n\t *\n\t * @see blockUI\n\t */\n\tvar unblockUI = function( element ) {\n\t\t$( element ).removeClass( _settings.uiProcessingClass ).unblock();\n\t}\n\n\n\n\t/**\n\t * Play the animation for quantity limit reached for a cart item.\n\t * \n\t * @param {HTMLElement} cartItem The cart item element.\n\t */\n\tvar playLimitReachedAnimation = function( cartItem ) {\n\t\t// Bail if quantity limit animation is not enabled\n\t\tif ( 'yes' !== _settings.quantityLimitAnimationEnabled ) { return; }\n\n\t\t// Bail if cart item not valid\n\t\tif ( ! cartItem ) { return; }\n\n\t\t// Get cart item quantity wrapper element\n\t\tvar quantityWrapper = cartItem.querySelector( _settings.quantityWrapperSelector );\n\n\t\t// Bail if quantity wrapper not found\n\t\tif ( ! quantityWrapper ) { return; }\n\n\t\t// Prepare to remove animating class when transition ends\n\t\tquantityWrapper.addEventListener( _animationEndEvent, function endRemovingItemAnimation( e ) {\n\t\t\tif ( e.animationName == _settings.quantityLimitAnimationName ) {\n\t\t\t\tquantityWrapper.classList.remove( _settings.quantityLimitAnimationClass );\n\t\t\t}\n\t\t} );\n\n\t\tquantityWrapper.classList.add( _settings.quantityLimitAnimationClass );\n\t}\n\n\n\n\t/**\n\t * Set the quantity attribute value for quantity fields.\n\t */\n\tvar setAllQuantityAttributes = function() {\n\t\tvar quantityFields = document.querySelectorAll( _settings.quantityInputSelector );\n\t\tfor ( var i = 0; i < quantityFields.length; i++ ) {\n\t\t\tvar input = quantityFields[ i ];\n\t\t\tinput.setAttribute( _settings.quantityAttribute, input.value );\n\t\t}\n\t};\n\n\n\n\t/**\n\t * Check whether the product quantity field value has changed.\n\t *\n\t * @param HTMLElement qtyField The product quantity field.\n\t *\n\t * @return bool Whether the product quantity value has changed.\n\t */\n\tvar hasQuantityChanged = function( qtyField ) {\n\t\tif ( qtyField.getAttribute( _settings.quantityAttribute ) != qtyField.value ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Maybe update cart items quantity and other attributes for all products in cart.\n\t */\n\tvar maybeUpdateCartItemQuantities = function( e ) {\n\t\t// Bail if target is not a quantity field or buttons\n\t\tif ( ! e.target.matches( _settings.quantityInputSelector ) && ! e.target.matches( _settings.quantitySpinnerButtonSelector ) ) { return; }\n\n\t\tvar allQuantityFields = document.querySelectorAll( _settings.quantityInputSelector );\n\t\tfor ( var i = 0; i < allQuantityFields.length; i++ ) {\n\t\t\tvar qtyField = allQuantityFields[i];\n\t\t\tvar cartItemElement = qtyField.closest( _settings.cartItemSelector );\n\n\t\t\t// Maybe trigger update item\n\t\t\tif ( hasQuantityChanged( qtyField ) ) {\n\t\t\t\tprocessUpdateCartItem( cartItemElement );\n\t\t\t}\n\t\t\t// Maybe play animation for quantity limit reached\n\t\t\telse if (\n\t\t\t\t\tcartItemElement == e.target.closest( _settings.cartItemSelector )\n\t\t\t\t\t&& ( qtyField.value == qtyField.getAttribute( _settings.quantityMinAttribute ) || qtyField.value == qtyField.getAttribute( _settings.quantityMaxAttribute ) )\n\t\t\t\t) {\n\t\t\t\tplayLimitReachedAnimation( cartItemElement );\n\t\t\t}\n\t\t}\n\t}\n\tvar debouncedMaybeUpdateQuantities;\n\t\n\t\n\n\t/**\n\t * Play the animation for removing the cart item.\n\t *\n\t * @param HTMLElement cartItemElement The cart item list element.\n\t */\n\tvar playRemovingItemAnimation = function( cartItemElement ) {\n\t\t// Bail if cart item is not valid\n\t\tif ( ! cartItemElement ) { return; }\n\n\t\t// Get cart item UI elements\n\t\tvar blockUIElement = cartItemElement.matches( _settings.cartItemBlockUIElementSelector ) ? cartItemElement : cartItemElement.querySelector( _settings.cartItemBlockUIElementSelector );\n\t\tvar animationElement = cartItemElement.matches( _settings.cartItemAnimationElementSelector ) ? cartItemElement : cartItemElement.querySelector( _settings.cartItemAnimationElementSelector );\n\n\t\t// Bail if animated element was not found\n\t\tif ( ! animationElement ) { return; }\n\n\t\t// Prepare to remove animating class when transition ends\n\t\tanimationElement.addEventListener( _animationEndEvent, function endRemovingItemAnimation( e ) {\n\t\t\tif ( e.animationName == _settings.cartItemRemoveAnimationName ) {\n\t\t\t\tcartItemElement.classList.add( _settings.cartItemRemovedClass );\n\t\t\t\tcartItemElement.classList.remove( _settings.cartItemRemovingClass );\n\t\t\t\tanimationElement.classList.remove( _settings.cartItemRemoveAnimationClass );\t\n\t\t\t\tanimationElement.removeEventListener( _animationEndEvent, endRemovingItemAnimation );\n\n\t\t\t\t// Block the element from further changes\n\t\t\t\tblockUI( blockUIElement );\n\t\t\t}\n\t\t} );\n\n\t\tcartItemElement.classList.add( _settings.cartItemRemovingClass );\n\t\tanimationElement.classList.add( _settings.cartItemRemoveAnimationClass );\n\t}\n\n\n\n\t/**\n\t * Remove a removed cart item message from the cart items list.\n\t *\n\t * @param string cartItemKey The cart item key.\n\t */\n\tvar removeCartItemElement = function( cartItemKey ) {\n\t\t// Bail if cart item key not provided\n\t\tif ( ! cartItemKey ) { return; }\n\n\t\t// Get cart item element\n\t\tvar cartItemElementSelector = _settings.cartItemSelector + '[' + _settings.cartItemKeyAttribute + '=\"' + cartItemKey + '\"]';\n\t\tvar cartItemElement = document.querySelector( cartItemElementSelector );\n\n\t\t// Try to remove the cart item element\n\t\tif ( cartItemElement ) {\n\t\t\tcartItemElement.parentElement.removeChild( cartItemElement );\n\t\t}\n\t}\n\n\t/**\n\t * Process the removal of a cart item from the cart item element.\n\t *\n\t * @param HTMLElement cartItemElement The cart item element.\n\t */\n\tvar processRemoveCartItem = function( cartItemElement ) {\n\t\tvar cartItemKey = cartItemElement.getAttribute( _settings.cartItemKeyAttribute );\n\t\t_publicMethods.removeCartItem( cartItemKey );\n\t}\n\n\t/**\n\t * Process restoring a removed cart item from the restore button.\n\t *\n\t * @param HTMLElement restoreButton The restore cart item button element.\n\t */\n\tvar processRestoreCartItem = function( restoreButton ) {\n\t\tvar cartItemKey = restoreButton.getAttribute( _settings.cartItemKeyAttribute );\n\t\t_publicMethods.restoreCartItem( cartItemKey );\n\t}\n\n\t/**\n\t * Process dismissing message for removed cart item from the dismiss button.\n\t *\n\t * @param HTMLElement dismissButton The dismiss cart item button element.\n\t */\n\tvar processRestoreCartItemDismiss = function( dismissButton ) {\n\t\tvar cartItemKey = dismissButton.getAttribute( _settings.cartItemKeyAttribute );\n\t\tremoveCartItemElement( cartItemKey );\n\t}\n\n\t/**\n\t * Process the update of a cart item from the cart item element.\n\t *\n\t * @param HTMLElement cartItemElement The cart item element.\n\t */\n\tvar processUpdateCartItem = function( cartItemElement ) {\n\t\tvar cartItemKey = cartItemElement.getAttribute( _settings.cartItemKeyAttribute );\n\n\t\t// Get cart item data\n\t\tvar data = {};\n\t\tvar cartItemFields = cartItemElement.querySelectorAll( _settings.cartItemDataFieldsSelector );\n\t\tfor ( var i = 0; i < cartItemFields.length; i++ ) {\n\t\t\tvar field = cartItemFields[ i ];\n\t\t\tvar fieldName = field.name;\n\t\t\tvar fieldValue = field.value;\n\n\t\t\t// Skip field if it does not have a name attribute\n\t\t\tif ( ! fieldName ) { continue; }\n\n\t\t\t// Skip radio buttons not checked\n\t\t\tif ( 'radio' === field.type && ! field.checked ) { continue; }\n\n\t\t\t// Maybe set checkbox field value as empty\n\t\t\tif ( 'checkbox' === field.type && ! field.checked ) {\n\t\t\t\tfieldValue = '';\n\t\t\t}\n\n\t\t\tdata[ fieldName ] = fieldValue;\n\t\t}\n\n\t\t_publicMethods.updateCartItem( cartItemKey, data );\n\t}\n\n\t/**\n\t * Process adding a new product to the cart from the add to cart button.\n\t *\n\t * @param HTMLElement addToCartButton The cart item element.\n\t */\n\tvar processAddToCart = function( addToCartButton ) {\n\t\t// Bail if add to cart button not provided\n\t\tif ( ! addToCartButton ) { return; }\n\n\t\tvar $thisbutton = $( addToCartButton );\n\n\t\t// Bail if button does not have the product id attribute\n\t\tif ( ! addToCartButton.hasAttribute( _settings.productIdAttribute ) ) { return; }\n\n\t\t// Change button state classes\n\t\taddToCartButton.classList.remove( _settings.addToCartButtonAddedClass );\n\t\taddToCartButton.classList.add( _settings.addToCartButtonLoadingClass );\n\n\t\t// TODO: Maybe allow 3rd parties to validate and quit early.\n\t\t// \t// Allow 3rd parties to validate and quit early.\n\t\t// \tif ( false === $( document.body ).triggerHandler( 'should_send_ajax_request.adding_to_cart', [ $thisbutton ] ) ) { \n\t\t// \t\t$( document.body ).trigger( 'ajax_request_not_sent.adding_to_cart', [ false, false, $thisbutton ] );\n\t\t// \t\treturn true;\n\t\t// \t}\n\n\t\tvar data = {};\n\n\t\t// TODO: Maybe fetch data from jQuery.data() structure\n\t\t// \t// Fetch changes that are directly added by calling $thisbutton.data( key, value )\n\t\t// \t$.each( $thisbutton.data(), function( key, value ) {\n\t\t// \t\tdata[ key ] = value;\n\t\t// \t});\n\n\t\t// Get product add to cart data\n\t\tvar attrs = addToCartButton.attributes;\n\t\tfor( var i = attrs.length - 1; i >= 0; i-- ) {\n\t\t\tvar attrName = attrs[ i ].name;\n\n\t\t\t// Maybe skip attribute\n\t\t\tif ( 0 !== attrName.indexOf( _settings.dataAttributePrefix ) ) { continue; }\n\n\t\t\tvar dataAttrName = attrs[ i ].name.substring( _settings.dataAttributePrefix.length );\n\t\t\tdata[ dataAttrName ] = attrs[i].value;\n\t\t}\n\n\t\t// Trigger event.\n\t\t$( document.body ).trigger( 'adding_to_cart', [ $thisbutton, data ] );\n\n\t\t_publicMethods.addToCart( data );\n\t}\n\n\n\n\t/**\n\t * Handle document clicks and route to the appropriate function.\n\t */\n\tvar handleClick = function( e ) {\n\t\t// ADD TO CART\n\t\tif ( e.target.closest( _settings.addToCartButtonSelector ) ) {\n\t\t\te.preventDefault();\n\t\t\tvar addToCartButton = e.target.closest( _settings.addToCartButtonSelector );\n\t\t\tprocessAddToCart( addToCartButton );\n\t\t}\n\t\t// REMOVE ITEM\n\t\telse if ( e.target.closest( _settings.removeItemButtonSelector ) ) {\n\t\t\te.preventDefault();\n\t\t\tvar cartItemElement = e.target.closest( _settings.cartItemSelector );\n\t\t\tprocessRemoveCartItem( cartItemElement );\n\t\t}\n\t\t// RESTORE ITEM\n\t\telse if ( e.target.closest( _settings.restoreItemButtonSelector ) ) {\n\t\t\te.preventDefault();\n\t\t\tprocessRestoreCartItem( e.target.closest( _settings.restoreItemButtonSelector ) );\n\t\t}\n\t\t// RESTORE ITEM DISMISS\n\t\telse if ( e.target.closest( _settings.restoreItemDismissButtonSelector ) ) {\n\t\t\te.preventDefault();\n\t\t\tprocessRestoreCartItemDismiss( e.target.closest( _settings.restoreItemDismissButtonSelector ) );\n\t\t}\n\t};\n\n\t/**\n\t * Handle keypress event.\n\t */\n\tvar handleKeyDown = function( e ) {\n\t\t// Should do nothing if the default action has been cancelled\n\t\tif ( e.defaultPrevented ) { return; }\n\n\t\t// ENTER on input fields\n\t\tif ( FCUtils.keyboardKeys.ENTER === e.key && e.target.closest( _settings.cartItemSelector ) && e.target.matches( _settings.formSubmitFieldsSelector ) ) {\n\t\t\t// Prevents submitting form\n\t\t\te.preventDefault();\n\t\t}\n\t};\n\n\n\n\t/**\n\t * Maybe update the cart contents via the CartUpdate when available.\n\t */\n\tvar maybeUpdateCartFragments = function() {\n\t\t// Bail if CartUpdate is not available\n\t\tif ( ! window.CartUpdate ) { return; }\n\n\t\tCartUpdate.updateCartFragments();\n\t}\n\n\n\n\t/**\n\t * Run processes before sending request to update cart fragments.\n\t */\n\t var processBeforeFragmentsUpdate = function() {\n\t\t// Build matrix of \"undo removed item\" elements and their positions\n\t\tvar _restoreItems = document.querySelectorAll( _settings.cartItemRestoreSelector );\n\t\t_restoreItemsMatrix = [];\n\t\tfor ( var i = 0; i < _restoreItems.length; i++ ) {\n\t\t\tvar cartItem = _restoreItems[ i ];\n\t\t\tvar position = Array.prototype.indexOf.call( cartItem.parentElement.children, cartItem );\n\t\t\t_restoreItemsMatrix.push( [ position, cartItem ] );\n\t\t}\n\t}\n\n\t/**\n\t * Run processes after cart fragments are replaced on the page.\n\t */\n\tvar processAfterFragmentsReplaced = function() {\n\t\t// Get cart items list element\n\t\tvar cartItemsList = document.querySelector( _settings.cartItemsListSelector );\n\n\t\t// Maybe trigger event `wc_cart_emptied` if cart items list not found, then bail.\n\t\tif ( ! cartItemsList ) {\n\t\t\t$( document.body ).trigger( 'wc_cart_emptied' );\n\t\t\treturn;\n\t\t}\n\n\t\t// Maybe restore \"undo removed item\" elements\n\t\tfor ( var j = 0; j < _restoreItemsMatrix.length; j++ ) {\n\t\t\tvar restoreItem = _restoreItemsMatrix[ j ];\n\t\t\tvar position = restoreItem[ 0 ];\n\t\t\tvar cartItem = restoreItem[ 1 ];\n\t\t\tvar refereceItem = cartItemsList.children[ position ];\n\t\t\tvar productId = cartItem.getAttribute( _settings.productIdAttribute );\n\n\t\t\t// Skip \"restore\" item if a cart item with same product ID already exists\n\t\t\tvar cartItemProductIdSelector = _settings.cartItemSelector + '[' + _settings.productIdAttribute + '=\"' + productId + '\"]' + ':not(.' + _settings.cartItemUndoClass + ')';\n\t\t\tif ( document.querySelector( cartItemProductIdSelector ) ) { continue; }\n\n\t\t\t// Unblock the element\n\t\t\tunblockUI( cartItem );\n\n\t\t\tcartItemsList.insertBefore( cartItem, refereceItem );\n\t\t}\n\n\t\t// Get cart items\n\t\tvar cartItems = cartItemsList.querySelectorAll( _settings.cartItemNotRemovedSelector );\n\n\t\t// Maybe trigger cart emptied event\n\t\tif ( 0 === cartItems.length ) {\n\t\t\t$( document.body ).trigger( 'wc_cart_emptied' );\n\t\t}\n\t\t// Maybe unblock cart items that got stuck on processing\n\t\telse {\n\t\t\tfor ( var k = 0; k < cartItems.length; k++ ) {\n\t\t\t\tvar cartItemElement = cartItems[ k ];\n\t\t\t\tvar blockUIElement = cartItemElement.matches( _settings.cartItemBlockUIElementSelector ) ? cartItemElement : cartItemElement.querySelector( _settings.cartItemBlockUIElementSelector );\n\n\t\t\t\t// Unblock cart item\n\t\t\t\tunblockUI( blockUIElement );\n\t\t\t}\n\t\t}\n\t}\n\n\n\n\t/**\n\t * Add a product to the cart.\n\t *\n\t * @param object data The product data to add to the cart.\n\t */\n\t_publicMethods.addToCart = function( data ) {\n\t\t// Bail if data object was not provided\n\t\tif ( ! data ) { return; }\n\n\t\t// Add security nonce\n\t\tdata[ 'security' ] = _settings.addToCartNonce;\n\n\t\t$.ajax({\n\t\t\ttype:\t\t'POST',\n\t\t\turl:\t\tfcSettings.wcAjaxUrl.toString().replace( '%%endpoint%%', 'fc_pro_add_to_cart' ),\n\t\t\tdata:\t\tdata,\n\t\t\tdataType: 'json',\n\t\t\tsuccess:\tfunction( response ) {\n\n\t\t\t\tif ( response.result && 'success' === response.result ) {\n\t\t\t\t\t$( document.body ).trigger( _settings.fragmentsUpdateEvent );\n\t\t\t\t\tclearNotices();\n\t\t\t\t}\n\t\t\t\telse if ( response.result && 'error' === response.result ) {\n\t\t\t\t\tshowNotices( response.message );\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t});\n\t};\n\n\n\n\t/**\n\t * Remove a item from the cart.\n\t *\n\t * @param string cartItemKey The cart item key.\n\t */\n\t_publicMethods.removeCartItem = function( cartItemKey ) {\n\t\tvar cartItemElementSelector = _settings.cartItemSelector + '[' + _settings.cartItemKeyAttribute + '=\"' + cartItemKey + '\"]';\n\t\tvar cartItemElement = document.querySelector( cartItemElementSelector );\n\n\t\t// Play removing item animation then block element from further changes\n\t\tplayRemovingItemAnimation( cartItemElement );\n\n\t\tvar data = {\n\t\t\tsecurity: _settings.removeCartItemNonce,\n\t\t\tcart_item_key: cartItemKey,\n\t\t};\n\n\t\t$.ajax({\n\t\t\ttype:\t\t'POST',\n\t\t\turl:\t\tfcSettings.wcAjaxUrl.toString().replace( '%%endpoint%%', 'fc_pro_remove_cart_item' ),\n\t\t\tdata:\t\tdata,\n\t\t\tdataType: 'json',\n\t\t\tsuccess:\tfunction( response ) {\n\n\t\t\t\tif ( response.result && 'success' === response.result ) {\n\t\t\t\t\t// Get cart item element\n\t\t\t\t\tvar cartItemElementSelector = _settings.cartItemSelector + '[' + _settings.cartItemKeyAttribute + '=\"' + response.cart_item_key + '\"]';\n\t\t\t\t\tvar cartItemElement = document.querySelector( cartItemElementSelector );\n\n\t\t\t\t\t// Try to replace the cart item with a message and link to undo action\n\t\t\t\t\tif ( cartItemElement && response.message ) {\n\t\t\t\t\t\tcartItemElement.classList.remove( _settings.cartItemRemovingClass );\n\t\t\t\t\t\tcartItemElement.classList.add( _settings.cartItemRemovedClass, _settings.cartItemUndoClass );\n\t\t\t\t\t\tcartItemElement.innerHTML = _settings.cartItemRemovedTemplate.replace( '##CONTENT##', response.message );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Try to set focus to the restore item button\n\t\t\t\t\tvar restoreButton = cartItemElement.querySelector( _settings.restoreItemButtonSelector );\n\t\t\t\t\tif ( restoreButton ) {\n\t\t\t\t\t\trequestAnimationFrame( function() { restoreButton.focus(); } );\n\t\t\t\t\t}\n\n\t\t\t\t\t$( document.body ).trigger( _settings.fragmentsUpdateEvent );\n\n\t\t\t\t\tclearNotices();\n\t\t\t\t}\n\t\t\t\telse if ( response.result && 'error' === response.result ) {\n\t\t\t\t\t// Unblock cart item\n\t\t\t\t\tvar cartItemElementSelector = _settings.cartItemSelector + '[' + _settings.cartItemKeyAttribute + '=\"' + response.cart_item_key + '\"]';\n\t\t\t\t\tvar cartItemElement = document.querySelector( cartItemElementSelector );\n\t\t\t\t\tvar blockUIElement = cartItemElement.matches( _settings.cartItemBlockUIElementSelector ) ? cartItemElement : cartItemElement.querySelector( _settings.cartItemBlockUIElementSelector );\n\n\t\t\t\t\t// Unblock cart item\n\t\t\t\t\tunblockUI( blockUIElement );\n\n\t\t\t\t\tshowNotices( response.message );\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t});\n\t};\n\n\n\n\t/**\n\t * Restore a cart item from the cart.\n\t *\n\t * @param string cartItemKey The cart item key.\n\t */\n\t_publicMethods.restoreCartItem = function( cartItemKey ) {\n\t\t// Get cart item elements\n\t\tvar cartItemElementSelector = _settings.cartItemSelector + '[' + _settings.cartItemKeyAttribute + '=\"' + cartItemKey + '\"]';\n\t\tvar cartItemElement = document.querySelector( cartItemElementSelector );\n\t\tvar blockUIElement = cartItemElement.matches( _settings.cartItemBlockUIElementSelector ) ? cartItemElement : cartItemElement.querySelector( _settings.cartItemBlockUIElementSelector );\n\n\t\t// Block the element from further changes\n\t\tblockUI( blockUIElement );\n\n\t\tvar data = {\n\t\t\tsecurity: _settings.restoreCartItemNonce,\n\t\t\tcart_item_key: cartItemKey,\n\t\t};\n\n\t\t$.ajax({\n\t\t\ttype:\t\t'POST',\n\t\t\turl:\t\tfcSettings.wcAjaxUrl.toString().replace( '%%endpoint%%', 'fc_pro_restore_cart_item' ),\n\t\t\tdata:\t\tdata,\n\t\t\tdataType: 'json',\n\t\t\tsuccess:\tfunction( response ) {\n\n\t\t\t\tif ( response.result && 'success' === response.result ) {\n\t\t\t\t\t$( document.body ).trigger( _settings.fragmentsUpdateEvent );\n\t\t\t\t\tclearNotices();\n\t\t\t\t}\n\t\t\t\telse if ( response.result && 'error' === response.result ) {\n\t\t\t\t\t// Get cart item elements\n\t\t\t\t\tvar cartItemElementSelector = _settings.cartItemSelector + '[' + _settings.cartItemKeyAttribute + '=\"' + response.cart_item_key + '\"]';\n\t\t\t\t\tvar cartItemElement = document.querySelector( cartItemElementSelector );\n\t\t\t\t\tvar blockUIElement = cartItemElement.matches( _settings.cartItemBlockUIElementSelector ) ? cartItemElement : cartItemElement.querySelector( _settings.cartItemBlockUIElementSelector );\n\n\t\t\t\t\t// Unblock cart item\n\t\t\t\t\tunblockUI( blockUIElement );\n\n\t\t\t\t\tshowNotices( response.message );\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t});\n\t};\n\n\n\n\t/**\n\t * Update the cart item data.\n\t *\n\t * @param string cartItemKey The cart item key.\n\t * @param object data The cart item data to be updated.\n\t */\n\t_publicMethods.updateCartItem = function( cartItemKey, data ) {\n\t\tvar cartItemElementSelector = _settings.cartItemSelector + '[' + _settings.cartItemKeyAttribute + '=\"' + cartItemKey + '\"]';\n\t\tvar cartItemElement = document.querySelector( cartItemElementSelector );\n\t\tvar animationElement = cartItemElement.matches( _settings.cartItemAnimationElementSelector ) ? cartItemElement : cartItemElement.querySelector( _settings.cartItemAnimationElementSelector );\n\n\t\t// Get quantity value from data\n\t\tvar quantity = 0;\n\t\tvar dataProperties = Object.keys( data );\n\t\tfor ( var i = 0; i < dataProperties.length; i++ ) {\n\t\t\tvar propertyName = dataProperties[ i ];\n\t\t\tif ( propertyName.indexOf( '[qty]' ) >= 0 ) {\n\t\t\t\tquantity = data[ propertyName ];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Remove item if quantity is zero or less\n\t\tif ( ! quantity || quantity <= 0 || quantity == '' ) {\n\t\t\tprocessRemoveCartItem( cartItemElement );\n\t\t\treturn;\n\t\t}\n\n\t\t// Block the element from further changes\n\t\tblockUI( animationElement );\n\n\t\t// Set quantity field (original) quantity attribute to avoid other functions from triggering update again without the need to\n\t\tvar quantityField = cartItemElement.querySelector( _settings.quantityInputSelector );\n\t\tif ( quantityField ) {\n\t\t\tquantityField.setAttribute( _settings.quantityAttribute, quantity );\n\t\t}\n\n\t\t// Add security and cart item key\n\t\tdata = FCUtils.extendObject( data, {\n\t\t\tsecurity: _settings.updateCartItemNonce,\n\t\t\tcart_item_key: cartItemKey,\n\t\t} );\n\n\t\t$.ajax({\n\t\t\ttype:\t\t'POST',\n\t\t\turl:\t\tfcSettings.wcAjaxUrl.toString().replace( '%%endpoint%%', 'fc_pro_update_cart_item' ),\n\t\t\tdata:\t\tdata,\n\t\t\tdataType: 'json',\n\t\t\tsuccess:\tfunction( response ) {\n\n\t\t\t\tif ( response.result && 'success' === response.result ) {\n\t\t\t\t\t$( document.body ).trigger( _settings.fragmentsUpdateEvent );\n\t\t\t\t\tclearNotices();\n\t\t\t\t}\n\t\t\t\telse if ( response.result && 'error' === response.result ) {\n\t\t\t\t\t// Unblock cart item\n\t\t\t\t\tvar cartItemElementSelector = _settings.cartItemSelector + '[' + _settings.cartItemKeyAttribute + '=\"' + response.cart_item_key + '\"]';\n\t\t\t\t\tvar cartItemElement = document.querySelector( cartItemElementSelector );\n\t\t\t\t\tvar blockUIElement = cartItemElement.matches( _settings.cartItemBlockUIElementSelector ) ? cartItemElement : cartItemElement.querySelector( _settings.cartItemBlockUIElementSelector );\n\n\t\t\t\t\t// Unblock cart item\n\t\t\t\t\tunblockUI( blockUIElement );\n\n\t\t\t\t\tshowNotices( response.message );\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t});\n\t};\n\n\n\n\t/**\n\t * Initialize component and set related handlers.\n\t */\n\t_publicMethods.init = function( options ) {\n\t\tif ( _hasInitialized ) return;\n\n\t\t// Merge settings\n\t\t_settings = FCUtils.extendObject( _settings, options );\n\n\t\t// Set quantity attribute for quantity fields at initialization\n\t\tsetAllQuantityAttributes();\n\n\t\t// Add event listeners\n\t\tdocument.addEventListener( 'click', handleClick, true );\n\t\tdocument.addEventListener( 'keydown', handleKeyDown, true );\n\n\t\t// Add event listeners for quantity updates\n\t\tdebouncedMaybeUpdateQuantities = FCUtils.debounce( maybeUpdateCartItemQuantities, _settings.updateWaitTime );\n\t\tdocument.addEventListener( 'click', debouncedMaybeUpdateQuantities, true );\n\t\tdocument.addEventListener( 'keydown', debouncedMaybeUpdateQuantities, true );\n\t\tdocument.addEventListener( 'change', debouncedMaybeUpdateQuantities, true );\n\n\t\tif ( _hasJQuery ) {\n\t\t\t// Handle 'wc_update_cart' jQuery event to update fragments via cart-update.js\n\t\t\t$( document.body ).on( 'wc_update_cart', maybeUpdateCartFragments );\n\n\t\t\t// After fragments has been updated\n\t\t\t$( document.body ).on( _settings.fragmentsReplacedEvent, setAllQuantityAttributes );\n\n\t\t\t// Cart item restore\n\t\t\t$( document.body ).on( _settings.fragmentsUpdateEvent, processBeforeFragmentsUpdate );\n\t\t\t$( document.body ).on( _settings.fragmentsReplacedEvent, processAfterFragmentsReplaced );\n\t\t}\n\n\t\t// Add init class\n\t\tdocument.body.classList.add( _settings.bodyClass );\n\n\t\t_hasInitialized = true;\n\t};\n\n\n\n\t//\n\t// Public APIs\n\t//\n\treturn _publicMethods;\n\n});\n"],"names":["root","factory","define","amd","exports","module","CartAjax","global","this","window","clearNotices","messagesWrappers","document","querySelectorAll","_settings","messagesWrapperSelector","i","length","innerHTML","showNotices","content","querySelector","CartUpdate","scrollToNotices","blockUI","element","$","addClass","uiProcessingClass","block","message","overlayCSS","background","opacity","unblockUI","removeClass","unblock","setAllQuantityAttributes","quantityFields","quantityInputSelector","input","setAttribute","quantityAttribute","value","maybeUpdateCartItemQuantities","e","target","matches","quantitySpinnerButtonSelector","allQuantityFields","qtyField","cartItemElement","closest","cartItemSelector","getAttribute","fieldValue","fieldName","field","cartItemFields","data","cartItemKey","processUpdateCartItem","cartItemKeyAttribute","cartItemDataFieldsSelector","name","type","checked","_publicMethods","updateCartItem","quantityMinAttribute","quantityMaxAttribute","playLimitReachedAnimation","cartItem","quantityWrapper","quantityLimitAnimationEnabled","quantityWrapperSelector","addEventListener","_animationEndEvent","animationName","quantityLimitAnimationName","classList","remove","quantityLimitAnimationClass","add","processRemoveCartItem","removeCartItem","handleClick","addToCartButtonSelector","preventDefault","addToCartButton","$thisbutton","hasAttribute","productIdAttribute","addToCartButtonAddedClass","addToCartButtonLoadingClass","attrs","attributes","indexOf","dataAttributePrefix","substring","body","trigger","addToCart","removeItemButtonSelector","restoreItemButtonSelector","restoreButton","restoreCartItem","restoreItemDismissButtonSelector","dismissButton","removeCartItemElement","handleKeyDown","defaultPrevented","FCUtils","keyboardKeys","ENTER","key","formSubmitFieldsSelector","maybeUpdateCartFragments","updateCartFragments","processBeforeFragmentsUpdate","_restoreItems","cartItemRestoreSelector","_restoreItemsMatrix","position","Array","prototype","call","parentElement","children","push","processAfterFragmentsReplaced","cartItemsList","cartItemsListSelector","j","restoreItem","refereceItem","productId","cartItemProductIdSelector","cartItemUndoClass","insertBefore","cartItems","cartItemNotRemovedSelector","k","blockUIElement","cartItemBlockUIElementSelector","debouncedMaybeUpdateQuantities","jQuery","_hasJQuery","_hasInitialized","whichAnimationEnd","bodyClass","cartItemAnimationElementSelector","cartItemRemovedTemplate","cartItemRemoveAnimationClass","cartItemRemoveAnimationName","cartItemRemovingClass","cartItemRemovedClass","updateWaitTime","fragmentsUpdateEvent","fragmentsReplacedEvent","addToCartNonce","removeCartItemNonce","restoreCartItemNonce","updateCartItemNonce","cartItemElementSelector","removeChild","ajax","url","fcSettings","wcAjaxUrl","toString","replace","dataType","success","response","result","animationElement","endRemovingItemAnimation","removeEventListener","security","cart_item_key","requestAnimationFrame","focus","quantity","dataProperties","Object","keys","propertyName","quantityField","extendObject","init","options","debounce","on"],"mappings":"AAMC,CAAA,SAAWA,EAAMC,GACM,YAAlB,OAAOC,QAAyBA,OAAOC,IAC3CD,OAAO,GAAID,EAAY,CAAC,EACM,UAAnB,OAAOG,QAClBC,OAAOD,QAAUH,EAAY,EAE7BD,EAAKM,SAAWL,EAAY,CAE7B,EAAoB,aAAlB,OAAOM,OAAyBA,OAASC,KAAKC,QAAUD,KAAKD,OAAQ,SAAUP,GAEjF,aA+EmB,SAAfU,IAEH,IADA,IAAIC,EAAmBC,SA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