{"version":3,"file":"copy_coupon.08c04651.js","mappings":"6HAAO,ICIDA,EAAiBC,SAASC,cAAc,6BAE9C,GAAuB,OAAnBF,EAAyB,CAC3B,IAAMG,EAAqBF,SAASC,cAAc,wCAC5CE,EAAyBH,SAASC,cAAc,wCAAwCG,UACxFC,EAA2BL,SAASC,cAAc,0CAA0CG,UAC5FE,EAAqBN,SAASC,cAAc,0CAC5CM,EAAgBP,SAASC,cAAc,4BAE7CF,EAAeS,iBAAiB,SAAS,WACvCD,EAAcE,gBAAgB,YAC9BF,EAAcG,SAEd,IACiBV,SAASW,YAAY,UAElCT,EAAmBE,UAAYC,EAC/BC,EAAmBM,UAAUC,OAAO,gBACpCd,EAAea,UAAUC,OAAO,YAChCd,EAAee,aAAa,YAAY,GACxCC,YAAW,WACTb,EAAmBE,UAAYD,EAC/BG,EAAmBM,UAAUC,OAAO,gBACpCd,EAAea,UAAUC,OAAO,YAChCd,EAAeU,gBAAgB,WACjC,GD7BsC,KC+B1C,CAAE,MAAOO,GACPC,QAAQC,MAAMF,EAChB,CAEA,IAAMG,EAAYC,OAAOC,aAAeD,OAAOC,eAAiBrB,SAASmB,UACrEA,IACEA,EAAUG,gBACZH,EAAUG,kBACDH,EAAUI,OACnBJ,EAAUI,SAIdhB,EAAcO,aAAa,YAAY,EACzC,GACF,C","sources":["webpack://fitflop-storefront/./core-app/grails-app/assets/javascripts/app/cmscomponents/copyCoupon/copyCouponConstants.js","webpack://fitflop-storefront/./core-app/grails-app/assets/javascripts/app/cmscomponents/copyCoupon/copyCoupon.js"],"sourcesContent":["export const COPY_BUTTON_HIGHLIGHT_DURATION = 3000;\n","import { COPY_BUTTON_HIGHLIGHT_DURATION } from './copyCouponConstants';\nimport './copy-coupon.scss';\n// Beware, this component requires to import at least 1 module!\n\nconst copyCodeButton = document.querySelector('.copy-coupon__code-button');\n\nif (copyCodeButton !== null) {\n const copyCodeButtonText = document.querySelector('.copy-coupon__code-button--copy-text');\n const copyCodeButtonCopyText = document.querySelector('.copy-coupon__code-button--copy-text').innerText;\n const copyCodeButtonCopiedText = document.querySelector('.copy-coupon__code-button--copied-text').innerText;\n const copyCodeButtonIcon = document.querySelector('.copy-coupon__code-button--copied-icon');\n const copyCodeInput = document.querySelector('.copy-coupon__code-input');\n\n copyCodeButton.addEventListener('click', () => {\n copyCodeInput.removeAttribute('disabled');\n copyCodeInput.select();\n\n try {\n const copied = document.execCommand('copy');\n if (copied) {\n copyCodeButtonText.innerText = copyCodeButtonCopiedText;\n copyCodeButtonIcon.classList.toggle('display-none');\n copyCodeButton.classList.toggle('disabled');\n copyCodeButton.setAttribute('disabled', true);\n setTimeout(() => {\n copyCodeButtonText.innerText = copyCodeButtonCopyText;\n copyCodeButtonIcon.classList.toggle('display-none');\n copyCodeButton.classList.toggle('disabled');\n copyCodeButton.removeAttribute('disabled');\n }, COPY_BUTTON_HIGHLIGHT_DURATION);\n }\n } catch (err) {\n console.error(err);\n }\n\n const selection = window.getSelection ? window.getSelection() : document.selection;\n if (selection) {\n if (selection.removeAllRanges) {\n selection.removeAllRanges();\n } else if (selection.empty) {\n selection.empty();\n }\n }\n\n copyCodeInput.setAttribute('disabled', true);\n });\n}\n"],"names":["copyCodeButton","document","querySelector","copyCodeButtonText","copyCodeButtonCopyText","innerText","copyCodeButtonCopiedText","copyCodeButtonIcon","copyCodeInput","addEventListener","removeAttribute","select","execCommand","classList","toggle","setAttribute","setTimeout","err","console","error","selection","window","getSelection","removeAllRanges","empty"],"sourceRoot":""}