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,wBAA2C,WAAjB4B,GACrCvC,IAAE,yCAAyCwB,YAAY,UACvDxB,IAAE,6BAA6BuB,SAAS,YAExCvB,IAAE,6BAA6BwB,YAAY,UAC3CxB,IAAE,yCAAyCuB,SAAS,WAGX,eAAzCsB,EAAMlC,KAAK,4BACXX,IAAE,yCAAyCuB,SAAS,UACpDvB,IAAE,6BAA6BuB,SAAS,UACxCvB,IAAE,6EAA6EuB,SAAS,WAIxFsB,EAAMlC,KAAK,gBAEXiB,EADYiB,EAAMlC,KAAK,eAG/B,IAOA2B,EAAc0E,MAAK,WAEXhH,IAAEc,MAAM4F,SAAS,kBACjB1G,IAAEc,MAAM6F,QAAQ,sBACXM,GAAG,aAERjH,IAAEc,MAAMT,OAEhB,IAMJ,IC7VA,IAAM6G,EAA0B,WAC5B,IAAMC,EAAOnH,IAAE,uBACf,KAAImH,EAAK/G,QAAU,GAAnB,CAIA,IAAMgH,EAAOD,EAAKN,KAAK,+BAEvBO,EAAKC,IAAI,CAAEC,OAAQF,EAAKG,OAAOC,eAJ/B,CAKJ,EAEAxH,KAAE,WACOA,IAAE,uBAAuBI,SAI9BJ,IAAEmB,QAAQsG,QAAO,WACbX,YAAW,WACPI,GACJ,GAAG,IACP,IAEAA,IACJ,G","sources":["webpack://fed-boilerplate/./src/4-sections/product-panel/add-to-cart/c-product-panel-add-to-cart.js","webpack://fed-boilerplate/./src/js/utils/touchEvent.js","webpack://fed-boilerplate/./src/4-sections/product-panel/color-switcher/c-product-panel-color-switcher.js","webpack://fed-boilerplate/./src/4-sections/product-panel/s-product-panel.js"],"sourcesContent":["import $ from 'jquery';\n\nfunction initQtyControl() {\n const $qtyMin = $('.c-product-panel-add-to-cart .js-min');\n const $qtyPlus = $('.c-product-panel-add-to-cart .js-plus');\n const $qtyInput = $('.c-product-panel-add-to-cart .js-product-qty');\n if (!$qtyInput.length || !$qtyMin.length || !$qtyPlus.length) {\n return;\n }\n\n $qtyMin.click(e => {\n e.preventDefault();\n const oldQty = $qtyInput.val();\n if (parseInt(oldQty, 10) > 1) {\n $qtyInput.val(parseInt(oldQty, 10) - 1);\n $qtyInput.data('old-value', $qtyInput.val());\n }\n });\n\n $qtyPlus.click(e => {\n e.preventDefault();\n const oldQty = $qtyInput.val();\n $qtyInput.val(parseInt(oldQty, 10) + 1);\n $qtyInput.data('old-value', $qtyInput.val());\n });\n}\n\nfunction initInputValidate() {\n const $qtyInput = $('.c-product-panel-add-to-cart .js-product-qty');\n if (!$qtyInput.length) {\n return;\n }\n\n $qtyInput.change(function() {\n const $input = $(this);\n const oldValue = $input.data('old-value');\n\n // Numbers only\n const reg = /^\\d+$/;\n if (!reg.test($input.val())) {\n $input.val(oldValue);\n }\n\n // Must be greater than 1\n const intValue = parseInt($input.val(), 10);\n if (intValue < 1) {\n $input.val(oldValue);\n }\n\n $input.data('old-value', $input.val());\n });\n}\n\nfunction initAddToCart() {\n const $addBtn = $('.c-product-panel-add-to-cart .js-product-add-to-cart');\n const $qtyInput = $('.c-product-panel-add-to-cart .js-product-qty');\n if (!$addBtn.length || !$qtyInput.length) {\n return;\n }\n\n $addBtn.click(function(e) {\n e.preventDefault();\n\n if (!window.addAppCartItem) {\n // eslint-disable-next-line no-alert\n alert('Something error, please refresh');\n return;\n }\n\n const $btn = $(this);\n const productNo = $btn.data('product-no');\n\n $btn.addClass('is-loading');\n window.addAppCartItem(\n productNo,\n parseInt($qtyInput.val(), 10),\n () => {\n $btn.removeClass('is-loading');\n },\n () => {\n $btn.removeClass('is-loading');\n }\n );\n });\n}\n\n// Run the functions on document ready\n$(() => {\n initQtyControl();\n initInputValidate();\n initAddToCart();\n});\n","// Touch event or click event, based on document support\nconst supportsTouch = 'touchend' in document;\nconst touchEvent = !supportsTouch ? 'click' : 'touchend click';\nexport default touchEvent;\n","import $ from 'jquery';\nimport touchEvent from 'utils/touchEvent';\n\n// Display Color RRP message\nfunction setColorPriceMessage(version) {\n const $disclaimer = $('.footer-bottom .disclaimer-message');\n const messageVer = $disclaimer.data(`rrp-message-${version}`);\n\n // Display message\n $disclaimer.text(messageVer);\n}\n\nfunction initColorSwitcher() {\n const contentRange = $('.pp-title .range');\n const contentName = $('.pp-title .name');\n const contentDesc = $('.pp-title .desc');\n const defaultDesc = contentDesc[0].innerText.split('|')[0].trim();\n const $colorChanger = $('.c-product-panel-color-switcher .js-pick-color');\n const $colorSwitcher = $('.c-product-panel-color-switcher');\n const $productView = $colorSwitcher.data('product-view');\n\n // if (!$colorChanger.length || $colorSwitcherWrapper.hasClass('hidden')) {\n if (!$colorChanger.length) {\n return;\n }\n\n // Set RRP message on initial load\n if ($($colorChanger[0]).data('rrp-message')) {\n const ver = $($colorChanger[0]).data('rrp-message');\n setColorPriceMessage(ver);\n }\n\n // Setup the touch / click events on the color selection\n $colorChanger.on(touchEvent, function(e) {\n e.preventDefault();\n const $this = $(this);\n\n // Switch the colors names in displaying label\n const color = $this.data('color-name');\n const colorCode = $this.data('color-code');\n const colorName = $this.data('color-name');\n const variantRange = $this.data('variant-range');\n const variantName = $this.data('variant-name');\n const variantDesc = $this.data('variant-desc');\n $('.js-choosen-color').empty()\n .text(`${color}`);\n $('.js-choosen-color-code').empty()\n .text(`${colorCode}`);\n\n if (contentDesc[0].innerText.includes('|')) {\n contentDesc.empty().text(`${defaultDesc} | ${colorName}`);\n } else {\n contentDesc.empty().text(`${colorName}`);\n }\n\n if (variantRange) {\n contentRange.empty().text(`${variantRange}`);\n }\n if (variantName) {\n contentName.empty().text(`${variantName}`);\n }\n if (variantDesc) {\n contentDesc.empty().text(`${variantDesc} | ${colorName}`);\n } else {\n contentDesc.empty().text(`${colorName}`);\n }\n\n // Change the selected color to this one\n $colorChanger.removeClass('color-selected');\n $this.addClass('color-selected');\n\n const commercialStatusCode = $this.data('commercial-status-code');\n const commercialStatusText = $this.data('commercial-status-text');\n switch (commercialStatusCode) {\n case 'DISCONTINUED':\n $('.commercial-status').removeClass('to-be-discontinued');\n $('.commercial-status').removeClass('limited-stock');\n $('.commercial-status').removeClass('coming-soon');\n $('.commercial-status').removeClass('temporary-block');\n $('.commercial-status').addClass('discontinued');\n break;\n case 'TOBEDISCONTINUED':\n $('.commercial-status').removeClass('discontinued');\n $('.commercial-status').removeClass('limited-stock');\n $('.commercial-status').removeClass('coming-soon');\n $('.commercial-status').removeClass('temporary-block');\n $('.commercial-status').addClass('to-be-discontinued');\n break;\n case 'LIMITEDSTOCK':\n $('.commercial-status').removeClass('discontinued');\n $('.commercial-status').removeClass('to-be-discontinued');\n $('.commercial-status').removeClass('coming-soon');\n $('.commercial-status').removeClass('temporary-block');\n $('.commercial-status').addClass('limited-stock');\n break;\n case 'COMINGSOON':\n $('.commercial-status').removeClass('discontinued');\n $('.commercial-status').removeClass('to-be-discontinued');\n $('.commercial-status').removeClass('limited-stock');\n $('.commercial-status').removeClass('temporary-block');\n $('.commercial-status').addClass('coming-soon');\n break;\n case 'TEMPORARYBLOCK':\n $('.commercial-status').removeClass('discontinued');\n $('.commercial-status').removeClass('to-be-discontinued');\n $('.commercial-status').removeClass('limited-stock');\n $('.commercial-status').removeClass('coming-soon');\n $('.commercial-status').addClass('temporary-block');\n break;\n default:\n $('.commercial-status').removeClass('discontinued');\n $('.commercial-status').removeClass('to-be-discontinued');\n $('.commercial-status').removeClass('limited-stock');\n $('.commercial-status').removeClass('coming-soon');\n $('.commercial-status').removeClass('temporary-block');\n break;\n }\n\n $('.commercial-status')[0].innerText = commercialStatusText;\n\n // Update the pricing display, do note that some user will not have some of the\n // price span on the screen\n const retailPrice = $this.data('price-retail');\n const tradePrice = $this.data('itrade');\n const staffPrice = $this.data('price-staff');\n $('.js-product-retail-price').empty()\n .text(`${retailPrice}`);\n $('.js-product-trade-price').empty()\n .text(`${tradePrice}`);\n $('.js-product-staff-price').empty()\n .text(`${staffPrice}`);\n\n // Update the UOM and qty step size\n const uom = $this.data('uom');\n const per = $this.data('per');\n $('.js-product-uom').empty()\n .text(`${uom}`);\n $('.js-product-per').empty()\n .text(`${per}`);\n\n // Update the product number on the add to cart btn\n const productNo = $this.data('product-no');\n $('.js-product-add-to-cart').data('product-no', productNo);\n\n // update catalog number\n const $catNo = $('.js-pp-catalog-number');\n if ($catNo.length > 0) {\n $catNo.text(productNo);\n }\n\n // update query string `itemno`\n // eslint-disable-next-line no-restricted-globals\n if (history.pushState) {\n const newParams = [];\n const paramsArray = window.location.search.substr(1).split('&');\n let params = {};\n\n // split and create query object\n for (let i = 0; i < paramsArray.length; i += 1) {\n const param = paramsArray[i].split('=', 2);\n // eslint-disable-next-line no-continue\n if (param.length !== 2) {\n // eslint-disable-next-line no-continue\n continue;\n }\n params[param[0]] = decodeURIComponent(\n param[1].replace(/\\+/g, ' ')\n );\n }\n\n // update query object\n params = {\n ...params,\n itemno: productNo,\n };\n\n // loop and create array\n Object.keys(params).forEach(key => {\n newParams.push(`${key}=${params[key]}`);\n });\n\n // merge and update query string\n const newUrl = `?${newParams.join('&')}`;\n\n // remove the pushState for now and use replaceState\n window.history.replaceState({ path: newUrl }, '', newUrl);\n }\n\n // Check the allow for sale and in stock flag and display the correct msg on screen\n const allowSale = $this.data('allowforsale') || '';\n const inStock = $this.data('instock') || '';\n if (allowSale.toLowerCase() === 'false') {\n $('.js-product-msg').addClass('no-sale');\n $('.js-product-msg').removeClass('no-stock');\n $('.js-product-add-to-cart').addClass('btn-disabled');\n $('.js-add-to-cart-qty').addClass('disabled');\n $('.js-add-to-cart-qty input').prop('disabled', 'disabled');\n } else if (inStock.toLowerCase() === 'false') {\n $('.js-product-msg').removeClass('no-sale');\n $('.js-product-msg').addClass('no-stock');\n $('.js-product-add-to-cart').addClass('btn-disabled');\n $('.js-add-to-cart-qty').addClass('disabled');\n $('.js-add-to-cart-qty input').prop('disabled', 'disabled');\n } else {\n $('.js-product-msg').removeClass('no-sale');\n $('.js-product-msg').removeClass('no-stock');\n $('.js-product-add-to-cart').removeClass('btn-disabled');\n $('.js-add-to-cart-qty').removeClass('disabled');\n $('.js-add-to-cart-qty input').prop('disabled', '');\n }\n\n // Check and display the price unit\n const priceUnit = $this.data('price-unit');\n $('.js-product-price-unit')\n .empty()\n .text(priceUnit ? `/ ${priceUnit}` : '');\n\n // Check and display the price unit\n const qtyMsg = $this.data('quantity-message');\n if (qtyMsg) {\n $('.js-each-unit-msg').show();\n $('.js-each-unit-msg').empty()\n .text(`${qtyMsg}`);\n } else {\n $('.js-each-unit-msg').hide();\n $('.js-each-unit-msg').empty();\n }\n\n // Logic to switch the datasheet download link when swatch color is clicked\n const downloadUrl = $this.data('sheet-url');\n const downloadThumbnail = $this.data('sheet-thumbnail') || '';\n const downloadDate = $this.data('sheet-date') || '';\n const downloadSize = $this.data('sheet-size') || '';\n const downloadExist = $this.data('sheet-exist') || false;\n const barcode = $this.data('barcode') || [];\n const downloadLink = $('.js-download-sheet');\n const datasheetContainer = $('.js-datasheet');\n const barcodeContainer = $('.js-barcode');\n const $sliderNav = $('.js-slider-nav:not(:hidden)');\n\n // update datasheet\n if (datasheetContainer.length > 0) {\n if (downloadExist) {\n downloadLink.attr('href', downloadUrl);\n\n $('.js-datasheet-thumbnail').attr({ src: downloadThumbnail });\n if (downloadDate || downloadSize) {\n $('.js-datasheet-thumbnail').attr({ title: [downloadDate, downloadSize].join(' - ') });\n }\n $('.js-datasheet-date').text(downloadDate);\n $('.js-datasheet-size').text(downloadSize);\n\n datasheetContainer.removeClass('hidden');\n } else {\n datasheetContainer.addClass('hidden');\n }\n } else if (downloadLink.length > 0) {\n downloadLink.attr('href', downloadUrl);\n }\n\n // update barcode\n if (barcodeContainer.length > 0) {\n for (let i = 0; i < 3; i += 1) {\n if (barcode[i] && $(`.js-barcode-${i}`).length > 0) {\n $(`.js-barcode-${i}`).removeClass('hidden');\n\n $(`.js-qty-${i}`).text(barcode[i][0]);\n $(`.js-uom-${i}`).text(barcode[i][1]);\n $(`.js-ean-${i}`).text(barcode[i][2]);\n $(`.js-color-${i}`).text(barcode[i][3]);\n } else {\n $(`.js-barcode-${i}`).addClass('hidden');\n }\n }\n }\n\n // update slider\n if ($sliderNav.length > 0) {\n // if slider has flag, dont trigger it, just remove the flag\n // slider will have class `scrolled` on `js-slider-nav` as a flag\n if ($sliderNav.hasClass('scrolled')) {\n $sliderNav.removeClass('scrolled');\n return;\n }\n\n // if slider did not have flag, trigger it, and flag on color switcher parent\n // add flag `triggered` on `js-color-switcher` as a flag\n // make sure to get slick index above and equal 0 or it will scroll up and down\n $this.closest('.js-color-switcher').addClass('triggering');\n const currentActiveThumb = $sliderNav.find(\n '.slick-slide.slick-current div.image-holder'\n );\n // We only want to click the thumb if the active thumb's color code is different to the swatch color code\n setTimeout(() => {\n if (currentActiveThumb.data('color-code') !== colorCode) {\n const $thumb = $sliderNav\n .find(\n `div[data-product-no=\"${productNo}\"][data-color-code=\"${colorCode}\"]`\n )\n .filter(function() {\n return (\n $(this)\n .closest('.slick-slide')\n .data('slick-index') >= 0\n );\n });\n\n $thumb.closest('.slick-slide').click();\n }\n }, 0);\n }\n\n // show hide price and show discontinued if it is\n if ($this.data('contact-distributor') && $productView === 'Retail') {\n $('.js-product-panel-contact-distributor').removeClass('hidden');\n $('.js-product-panel-pricing').addClass('hidden');\n } else {\n $('.js-product-panel-pricing').removeClass('hidden');\n $('.js-product-panel-contact-distributor').addClass('hidden');\n }\n\n if ($this.data('commercial-status-code') === 'COMINGSOON') {\n $('.js-product-panel-contact-distributor').addClass('hidden');\n $('.js-product-panel-pricing').addClass('hidden');\n $('.product-section.last-product-detail-item .btn-skin-1[data-bv-type=\"CTA\"]').addClass('hidden');\n }\n\n // Update RRP Message in the footer based on selected color\n if ($this.data('rrp-message')) {\n const ver = $this.data('rrp-message');\n setColorPriceMessage(ver);\n }\n });\n\n /**\n * Click the first-display item on visible slider\n * We use 2 slider with colour switcher each, on e for mobile, one for desktop\n * Make sure it only click visible one\n */\n $colorChanger.each(function() {\n if (\n $(this).hasClass('first-display') &&\n $(this).closest('.js-slider-preview')\n .is(':visible')\n ) {\n $(this).click();\n }\n });\n}\n\n// Run the functions on document ready\n$(() => {\n initColorSwitcher();\n});\n","import $ from 'jquery';\nimport './add-to-cart/c-product-panel-add-to-cart';\nimport './color-switcher/c-product-panel-color-switcher';\n\nconst resizeVerticalThumbnail = () => {\n const $con = $('.js-perfect-product');\n if ($con.length <= 0) {\n return;\n }\n\n const $nav = $con.find('.js-slider-nav:not(:hidden)');\n\n $nav.css({ height: $nav.prev().outerHeight() });\n};\n\n$(() => {\n if (!$('.js-perfect-product').length) {\n return;\n }\n\n $(window).resize(() => {\n setTimeout(() => {\n resizeVerticalThumbnail();\n }, 100);\n });\n\n resizeVerticalThumbnail();\n});\n"],"names":["$","$qtyMin","$qtyPlus","$qtyInput","length","click","e","preventDefault","oldQty","val","parseInt","data","change","$input","this","oldValue","test","initInputValidate","$addBtn","window","addAppCartItem","$btn","productNo","addClass","removeClass","alert","initAddToCart","document","setColorPriceMessage","version","$disclaimer","messageVer","concat","text","contentRange","contentName","contentDesc","defaultDesc","$colorChanger","$productView","innerText","split","trim","on","touchEvent","$this","color","colorCode","colorName","variantRange","variantName","variantDesc","empty","includes","commercialStatusCode","commercialStatusText","retailPrice","tradePrice","staffPrice","uom","per","$catNo","history","pushState","newParams","paramsArray","location","search","substr","params","i","param","decodeURIComponent","replace","_objectSpread","itemno","Object","keys","forEach","key","push","newUrl","join","replaceState","path","allowSale","inStock","toLowerCase","prop","priceUnit","qtyMsg","show","hide","downloadUrl","downloadThumbnail","downloadDate","downloadSize","downloadExist","barcode","downloadLink","datasheetContainer","barcodeContainer","$sliderNav","attr","src","title","hasClass","closest","currentActiveThumb","find","setTimeout","filter","each","is","resizeVerticalThumbnail","$con","$nav","css","height","prev","outerHeight","resize"],"sourceRoot":""}