{"version":3,"sources":["cart.ts"],"names":["_regeneratorRuntime","e","t","r","Object","prototype","n","hasOwnProperty","o","defineProperty","value","i","Symbol","a","iterator","c","asyncIterator","u","toStringTag","define","enumerable","configurable","writable","wrap","Generator","create","Context","h","f","Error","s","done","method","arg","delegate","maybeInvokeDelegate","TypeError","y","tryCatch","type","resultName","next","nextLoc","sent","_sent","dispatchException","abrupt","p","l","call","GeneratorFunction","GeneratorFunctionPrototype","d","this","getPrototypeOf","v","values","g","defineIteratorMethods","forEach","_invoke","AsyncIterator","callInvokeWithMethodAndArg","invoke","_typeof","resolve","__await","then","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","isNaN","length","displayName","isGeneratorFunction","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","keys","reverse","pop","prev","charAt","slice","stop","rval","handle","complete","finish","catch","delegateYield","asyncGeneratorStep","_asyncToGenerator","arguments","apply","_next","_throw","checkoutButton","subtotalInUI","modalSubtotalInUI","defaultcheckoutButtonText","loadingList","GA4Items","formatPrice","price","formattedPrice","replace","sanitizeToJson","data","JSON","parse","addLoadingBarToSubtotals","innerHTML","classList","add","updateCartUI","totalQuantity","subtotal","Table","CuryTotMerch","toFixed","toString","remove","concat","document","querySelectorAll","productQuantity","valueAsNumber","querySelector","disabled","removeEmptySpaceInString","text","updateCartItemUI","basketID","cartItem","modalCartItem","Table1","product","basketid","curytotord","quantity","setAttribute","deleteCartItemUI","parentNode","removeChild","emptyCart","cartItemsHeader","cartItemsContainer","cartItemsCheckoutContainer","modalCartContainer","modalCartQuantityCountSum","insertAdjacentHTML","updateProductQuantityInCart","_x","_x2","_x3","_updateProductQuantityInCart","_callee","productID","quantityInput","deleteItem","request","index","_context","Number","alert","isInteger","parseFloat","Math","round","params","$","ajax","url","cache","indexOf","splice","deleteProductInCart","_x4","_x5","_deleteProductInCart","_callee2","deletedItemGA4","jsonData","_context2","dataLayer","ecommerce","event","currency","items","event_value","itemid","toLowerCase","includes","doEmptyCart","confirm","getElementById","submit","checkout","on","_this","delayDebounceFn","setTimeout","invtId","basketId","clearTimeout","preventDefault"],"mappings":"6RACAA,oBAAA,WAAA,OAAAC,CAAA,EAAA,IAAAC,EAAAD,EAAA,GAAAE,EAAAC,OAAAC,UAAAC,EAAAH,EAAAI,eAAAC,EAAAJ,OAAAK,gBAAA,SAAAP,EAAAD,EAAAE,GAAAD,EAAAD,GAAAE,EAAAO,KAAA,EAAAC,EAAA,YAAA,OAAAC,OAAAA,OAAA,GAAAC,EAAAF,EAAAG,UAAA,aAAAC,EAAAJ,EAAAK,eAAA,kBAAAC,EAAAN,EAAAO,aAAA,gBAAA,SAAAC,EAAAjB,EAAAD,EAAAE,GAAA,OAAAC,OAAAK,eAAAP,EAAAD,EAAA,CAAAS,MAAAP,EAAAiB,WAAA,CAAA,EAAAC,aAAA,CAAA,EAAAC,SAAA,CAAA,CAAA,CAAA,EAAApB,EAAAD,EAAA,CAAA,IAAAkB,EAAA,GAAA,EAAA,CAAA,CAAA,MAAAjB,GAAAiB,EAAA,SAAAjB,EAAAD,EAAAE,GAAA,OAAAD,EAAAD,GAAAE,CAAA,CAAA,CAAA,SAAAoB,EAAArB,EAAAD,EAAAE,EAAAG,GAAA,IAAAL,EAAAE,EAAAG,EAAAE,EAAAG,EAAAV,GAAAA,EAAAI,qBAAAmB,EAAAvB,EAAAuB,EAAAX,EAAAT,OAAAqB,OAAAd,EAAAN,SAAA,EAAAU,EAAA,IAAAW,EAAApB,GAAA,EAAA,EAAA,OAAAE,EAAAK,EAAA,UAAA,CAAAH,OAAAT,EAAAC,EAAAC,EAAAA,EAAAG,EAAAS,EAAAP,EAAAmB,EAAA,SAAAhB,EAAAE,GAAA,GAAAL,IAAAoB,EAAA,MAAAC,MAAA,8BAAA,EAAA,GAAArB,IAAAsB,EAAA,CAAA,GAAA,UAAAnB,EAAA,MAAAE,EAAA,MAAA,CAAAH,MAAAR,EAAA6B,KAAA,CAAA,CAAA,CAAA,C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F,CAAC","file":"../cart.min.js","sourcesContent":["// Declare variables for various UI elements\nlet checkoutButton\nlet subtotalInUI\n//let subtotalPointsInUI\nlet modalSubtotalInUI\n//let modalSubtotalPointsInUI\nlet defaultcheckoutButtonText = 'Checkout'\n// Declare a list to keep track of loading operations\nlet loadingList = []\n//Declare variable for basketID-GA4 item properties\nlet GA4Items=[];\n$(function () {\n\tcheckoutButton = document.querySelector('#btn_cart_checkout')\n\tsubtotalInUI = document.querySelector('#subtotalInUI')\n\tmodalSubtotalInUI = document.querySelector('#hdSubtotal')\n\t//event listener for the qty input\n\t$('.quantity-input').on('input', function () {\n\t\taddLoadingBarToSubtotals();\n\t\t(this.parentNode as Element).classList.add('loader-absolute-right')\n\t\tconst delayDebounceFn = setTimeout(() => {\n\t\t\tvar invtId = $(this).data('invtid')\n\t\t\tvar basketId = $(this).data('basketid')\n\t\t\tupdateProductQuantityInCart(invtId, this as HTMLInputElement, basketId)\n\t\t\tthis['oldvalue'] = (this as HTMLInputElement).value\n\t\t}, 2000)\n\t\treturn () => clearTimeout(delayDebounceFn)\n\t})\n\t//event listener for the delete button\n\t$('.delete-product').on('click', function (e) {\n\t\te.preventDefault()\n\t\tvar invtId = $(this).data('invtid')\n\t\tvar basketId = $(this).data('basketid')\n\t\tdeleteProductInCart(invtId, basketId)\n\t})\n})\nfunction formatPrice(price) {\n\t// Remove non-digit characters\n\tlet formattedPrice = price.replace(/\\D/g, '')\n\t// Add a decimal point before the last two digits\n\tformattedPrice = formattedPrice.replace(/(\\d)(\\d{2})$/, '$1.$2')\n\t// Add commas as thousand separators\n\tformattedPrice = formattedPrice.replace(/(?=(\\d{3})+(\\D))\\B/g, ',')\n\treturn formattedPrice\n}\n/**\n * Sanitize a string and parse it into a JSON object.\n * @param {string} data - The string to sanitize and parse.\n * @return {Object} The parsed JSON object.\n */\nfunction sanitizeToJson(data: string) {\n\t// Remove all newline characters from the string\n\tdata = data.replace(/\\n/g, '')\n\t// Remove all characters from the start of the string up to the first '{'\n\tdata = data.replace(/^[^{]*/g, '')\n\t// Parse the sanitized string into a JSON object\n\tconst jsonData = JSON.parse(data)\n\treturn jsonData\n}\n/**\n * Add a loading bar to the subtotal elements in the UI.\n */\nfunction addLoadingBarToSubtotals() {\n\t// Define the HTML for the loading bar\n\tconst loadingHtml = '\"loading\"'\n\t// Add the loading bar to the subtotal elements in the main UI\n\tsubtotalInUI.innerHTML = ''\n\tsubtotalInUI.classList.add('loader-dark-small', 'loader-pull-right')\n\t// Add the loading bar to the subtotal elements in the modal UI\n\tmodalSubtotalInUI.innerHTML = ''\n\tmodalSubtotalInUI.classList.add('loader-dark-small')\n}\n/**\n * Update the cart UI with the given data.\n * @param {string} data - The data to update the cart UI with.\n */\nfunction updateCartUI(data: string) {\n\t// If there are still items loading, don't update the UI\n\tif (loadingList.length > 0) return\n\t// Sanitize the data and parse it into a JSON object\n\tconst jsonData = sanitizeToJson(data)\n\t// Get the subtotal and subtotal points from the JSON data\n\tconst subtotal = jsonData.Table[0].CuryTotMerch.toFixed(2).toString()\n\t//const subtotalPoints = jsonData.Table[0].User6\n\t// Update the subtotal and subtotal points in the main UI\n\tsubtotalInUI.classList.remove('loader-dark-small', 'loader-pull-right')\n\tsubtotalInUI.innerHTML = `$${formatPrice(subtotal)}`\n\t// Update the subtotal and subtotal points in the modal UI\n\tmodalSubtotalInUI.classList.remove('loader-dark-small')\n\tmodalSubtotalInUI.innerHTML = `$${formatPrice(subtotal)}`\n\t// Calculate the total quantity of items in the cart\n\tlet totalQuantity = 0\n\tconst productQuantities: NodeListOf = document.querySelectorAll('[id*=\\'cartQty\\']')\n\tproductQuantities.forEach(productQuantity => {\n\t\ttotalQuantity += productQuantity.valueAsNumber\n\t})\n\t// Update the total quantity in the UI\n\tdocument.querySelector('#bubble-cnt').innerHTML = totalQuantity.toString()\n\t// Enable the checkout button\n\tcheckoutButton.disabled = false\n\tcheckoutButton.classList.remove('loader-light', 'loader-center')\n\tcheckoutButton.classList.remove('disabled')\n}\n/**\n * Remove all whitespace characters in a string.\n * @param {string} text - The string to remove whitespace from.\n * @return {string} The string with all whitespace removed.\n */\nfunction removeEmptySpaceInString(text: string) {\n\t// If the text is falsy (e.g., null, undefined, empty string), return it as is\n\tif (!text) return text\n\t// Use a regular expression to replace all whitespace characters with nothing\n\tconst noWhitespaceText = text.replace(/\\s/g, '')\n\treturn noWhitespaceText\n}\n/**\n * Update the UI for a specific cart item with the given data.\n * @param {string} basketID - The ID of the product to update the UI for.\n * @param {string} data - The data to update the cart item UI with.\n */\nfunction updateCartItemUI(basketID: string, data: string) {\n\t// Select the cart item elements in the main UI and the modal UI\n\tconst cartItem = document.querySelector(`#cart-item-${basketID}`)\n\tconst modalCartItem = document.querySelector(`#modal-cart-item-${basketID}`)\n\t// Sanitize the data and parse it into a JSON object\n\tconst jsonData = sanitizeToJson(data)\n\t// Loop through each product in the JSON data\n\tjsonData.Table1.forEach((product) => {\n\t\t// If the product ID in the JSON data doesn't match the given product ID, skip this iteration\n\t\tif (removeEmptySpaceInString(product.basketid) !== basketID) return\n\t\t// Update the product quantity price in the main UI\n\t\tcartItem.querySelector('#product-quantity-price').innerHTML = `$${formatPrice(product.curytotord.toFixed(2).toString())}`\n\t\t// Update the product quantity in the modal UI\n\t\tmodalCartItem.querySelector('#cart-modal-product-quantity').innerHTML = product.quantity\n\t\tdocument.querySelector(`#cart-item-${basketID} .delete-product`).setAttribute('data-quantity', product.quantity.toString())\n\t})\n}\n/**\n * Delete the UI elements for a specific cart item.\n * @param {string} basketID - The ID of the product to delete the UI elements for.\n */\nfunction deleteCartItemUI(basketID: string) {\n\t// Select the cart item elements in the main UI and the modal UI\n\tconst cartItem: HTMLElement = document.querySelector(`#cart-item-${basketID}`)\n\tconst modalCartItem: HTMLElement = document.querySelector(`#modal-cart-item-${basketID}`)\n\t// If the cart item element exists in the main UI, remove it\n\tif (cartItem) {\n\t\tcartItem.parentNode.removeChild(cartItem)\n\t}\n\t// If the cart item element exists in the modal UI, remove it\n\tif (modalCartItem) {\n\t\tmodalCartItem.parentNode.removeChild(modalCartItem)\n\t}\n}\n/**\n * Empty the cart by removing the cart items from the UI and displaying a message that the cart is empty.\n */\nfunction emptyCart() {\n\t// Select the cart item elements in the main UI\n\tconst cartItemsHeader = document.querySelector('#cart-items-header')\n\tconst cartItemsContainer = document.querySelector('#cart-items-container')\n\tconst cartItemsCheckoutContainer = document.querySelector('#cart-items-checkout-container')\n\t// Select the cart item elements in the modal UI\n\tconst modalCartContainer = document.querySelector('#div_drop-shopcart')\n\tconst modalCartQuantityCountSum = document.querySelector('#cartSumQty')\n\t// If the cart item elements exist in the main UI, remove them\n\tif (cartItemsHeader) {\n\t\tcartItemsHeader.parentNode.removeChild(cartItemsHeader)\n\t}\n\tif (cartItemsCheckoutContainer) {\n\t\tcartItemsCheckoutContainer.parentNode.removeChild(cartItemsCheckoutContainer)\n\t}\n\tif (modalCartQuantityCountSum) {\n\t\tmodalCartQuantityCountSum.parentNode.removeChild(modalCartQuantityCountSum)\n\t}\n\t// Define the HTML for the empty cart message\n\tconst htmlString = '
'\n\tconst modalHtmlString = '
'\n\t// Update the cart items container in the main UI with the empty cart message\n\tcartItemsContainer.innerHTML = htmlString\n\t// Update the cart items container in the modal UI with the empty cart message\n\tmodalCartContainer.innerHTML = ''\n\tmodalCartContainer.insertAdjacentHTML('beforeend', modalHtmlString)\n}\n/**\n * Update the quantity of a product in the cart.\n * @param {string} productID - The ID of the product to update.\n * @param {HTMLElement} quantityInput - The input element for the product quantity.\n * @param {string} basketID - The ID of the basket that contains the product.\n */\nasync function updateProductQuantityInCart(productID: string, quantityInput: HTMLInputElement, basketID: string) {\n\tlet deleteItem = false\n\t// If the quantity is 0 or less, confirm with the user if they want to remove the item\n\tif (Number(quantityInput.value) <= 0) {\n\t\tdeleteItem = true\n\t}\n\t// If the quantity is more than 99, alert the user and revert the quantity\n\tif (Number(quantityInput.value) > 99) {\n\t\talert('Value must be less than or equal to 99.')\n\t\tquantityInput.value = quantityInput['oldvalue']\n\t\treturn\n\t}\n\t\n\t//If the quantity is float, alert the user and revert the quantity\n\tif (!Number.isInteger(parseFloat(quantityInput.value))) {\n\t\tquantityInput.value = Math.round(parseFloat(quantityInput.value)).toString()\n\t\treturn\n\t}\n\t// Add a loading bar to the subtotals\n\taddLoadingBarToSubtotals()\n\t// Add the product ID to the loading list\n\tloadingList.push(productID);\n\t// Add a loading image next to the quantity input\n\t(quantityInput.parentNode as Element).classList.add('loader-absolute-right')\n\t// Disable the checkout button and the quantity input\n\tcheckoutButton.classList.add('disabled')\n\tcheckoutButton.classList.add('loader-light', 'loader-center') \n\t//checkoutButton.innerText = ''\n\tcheckoutButton.disabled = true\n\tquantityInput.disabled = true\n\t// Define the URL and parameters for the AJAX request\n\tconst ajaxCartUrl = '/ajax/newCart.aspx'\n\tlet params = `&actionType=CARTUPDATE&basketId=${basketID}&productID=${productID}&quantity=${quantityInput.value}&posting=TRUE`\n\t// Send the AJAX request\n\tconst request = await $.ajax({\n\t\turl: ajaxCartUrl,\n\t\ttype: 'POST',\n\t\tcache: false,\n\t\tdata: params,\n\t\tasync: true\n\t})\n\t// Remove the product ID from the loading list\n\tconst index = loadingList.indexOf(productID)\n\tif (index !== -1) {\n\t\tloadingList.splice(index, 1)\n\t}\n\t// If the item was deleted, update the UI accordingly\n\tif (deleteItem) {\n\t\tdeleteCartItemUI(basketID)\n\t\tconst jsonData = sanitizeToJson(request)\n\t\tif (jsonData.Table1.length <= 0) {\n\t\t\temptyCart()\n\t\t}\n\t} else {\n\t\t// If the item was not deleted, update the cart item UI and enable the quantity input\n\t\tupdateCartItemUI(basketID, request)\n\t\tquantityInput.disabled = false\n\t}\n\t// Remove the loading image\n\t(quantityInput.parentNode as Element).classList.remove('loader-absolute-right')\n\t// Update the cart UI\n\tupdateCartUI(request)\n}\n/**\n * Delete a product from the cart.\n * @param {string} productID - The ID of the product to delete.\n * @param {string} basketID - The ID of the basket that contains the product.\n */\nasync function deleteProductInCart(productID, basketID) {\n\t// Add a loading bar to the subtotals\n\taddLoadingBarToSubtotals()\n\tconst deletedItemGA4 = GA4Items[basketID]\n\t// remove the delete button with a loader\n\tconst deleteButton = document.querySelector(`#cart-item-${basketID} .Update`);\n\tdeleteButton.innerHTML = '\"loading\"'\n\t// Disable the checkout button\n\tcheckoutButton.classList.add('disabled')\n\tcheckoutButton.classList.add('loader-light', 'loader-center')\n\t//checkoutButton.innerText = ''\n\tcheckoutButton.disabled = true\n\t// Define the URL and parameters for the AJAX request\n\tconst ajaxCartUrl = '/ajax/newCart.aspx'\n\tlet params = `&actionType=CARTDELETE&basketId=${basketID}&productID=${productID}&posting=TRUE`\n\t// Send the AJAX request\n\tconst request = await $.ajax({\n\t\turl: ajaxCartUrl,\n\t\ttype: 'POST',\n\t\tcache: false,\n\t\tdata: params,\n\t\tasync: true\n\t})\n\tdataLayer.push({ ecommerce: null }) // Clear the previous ecommerce object.\n\tdataLayer.push({\n\t\t'event': 'remove_from_cart',\n\t\t'ecommerce': {\n\t\t\t'currency': 'USD',\n\t\t\t'value': Number((deletedItemGA4.price * deletedItemGA4.quantity).toFixed(2)),\n\t\t\t'items': deletedItemGA4\n\t\t},\n\t\t'event_value': Number((deletedItemGA4.price * deletedItemGA4.quantity).toFixed(2))\n\t})\n\t// Delete the cart item UI for the product\n\tdeleteCartItemUI(basketID)\n\t// Update the cart UI with the response from the AJAX request\n\tupdateCartUI(request)\n\t// Sanitize the response and parse it into a JSON object\n\tconst jsonData = sanitizeToJson(request)\n\t// If the cart only has GWP product left, remove it\n\tif (jsonData.Table1.length === 1 && jsonData.Table1[0].itemid.toLowerCase().includes('gwp')) {\n\t\tdeleteProductInCart(jsonData.Table1[0].itemid, jsonData.Table1[0].basketid)\n\t}\n\t// If there are no more items in the cart, empty the cart\n\tif (jsonData.Table1.length <= 0) {\n\t\temptyCart()\n\t}\n}\n/**\n * Empty the entire cart.\n * This function will prompt the user for confirmation before emptying the cart.\n * If the user confirms, it will set the 'actionType' input's value to 'CARTEMPTY' and submit the 'OCForm1' form.\n */\nfunction doEmptyCart() {\n\t// Prompt the user for confirmation\n\tconst userConfirmed = confirm('Warning: This will empty your entire cart!\\n')\n\t// If the user confirmed, empty the cart\n\tif (userConfirmed) {\n\t\t// Get the 'actionType' input element\n\t\tconst actionTypeInput = document.getElementById('actionType') as HTMLInputElement\n\t\t// Set the 'actionType' input's value to 'CARTEMPTY'\n\t\tactionTypeInput.value = 'CARTEMPTY'\n\t\t// Get the 'OCForm1' form element\n\t\tconst form = document.getElementById('OCForm1') as HTMLFormElement\n\t\t// Submit the 'OCForm1' form\n\t\tform.submit()\n\t}\n}\n/**\n * Proceed to checkout.\n * This function will set the 'actionType' input's value to its current value plus ',CARTCHECKOUT' and submit the 'OCForm1' form.\n * This effectively signals that the user wants to proceed to checkout.\n */\nfunction checkout() {\n\t// Get the 'actionType' input element\n\tconst actionTypeInput = document.getElementById('actionType') as HTMLInputElement\n\t// Append ',CARTCHECKOUT' to the 'actionType' input's value\n\tactionTypeInput.value += ',CARTCHECKOUT'\n\t// Get the 'OCForm1' form element\n\tconst form = document.getElementById('OCForm1') as HTMLFormElement\n\t// Submit the 'OCForm1' form\n\tform.submit()\n}"]}