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ack://_N_E/./adapters/model/service/api/buyNowLite.js","webpack://_N_E/./components/ProductOverlay/ProductOverlay.js","webpack://_N_E/"],"sourcesContent":["import {BuyNowLiteConstants} from '../../../helpers/Constants';\n\nexport function generateHeader() {\n let header = new Headers();\n header.append(BuyNowLiteConstants.accessControlAllowOrigin, '*');\n header.append(BuyNowLiteConstants.passKey, process.env.BUY_NOW_LITE_PASS_KEY);\n header.append(BuyNowLiteConstants.ocpApimSubscriptionKey, process.env.BUY_NOW_LITE_SUBSCRIPTION_KEY);\n\n return header;\n}\n\nexport const getBuyNowLiteRetailerList = (sku, onSuccess = function(){}, onFailure = function(){}) => {\n const header = generateHeader();\n\n const requestOptions = {\n method: 'GET',\n headers: header,\n };\n\n let url = process.env.BUY_NOW_LITE_URL.replace('{sku}', sku);\n\n fetch(url, requestOptions)\n .then(response => response.json())\n .then(data => {\n if(data.constructor === Array) {\n onSuccess(data);\n } else {\n onFailure();\n }\n })\n .catch(error => {\n console.error(error);\n onFailure();\n });\n}","import React, { useEffect, useRef, useState } from 'react';\nimport dynamic from 'next/dynamic';\nimport PropTypes from 'prop-types';\nimport throttle from 'lodash/throttle';\nimport Block from '../../adapters/helpers/Block';\nimport { toggleScroll } from '../../adapters/helpers/Utils';\nconst Icon = dynamic(() => import('../Icon/Icon'));\nimport { ProductOverlayConstants } from '../../adapters/helpers/Constants';\nimport { loadScript } from '../../adapters/helpers/Utils';\nimport {getBuyNowLiteRetailerList} from '../../adapters/model/service/api/buyNowLite';\n\nexport default function ProductOverlay(props) {\n const displayBuyNowLite = (process.env.ACTIVATE_BUY_NOW_LITE || false) === 'TRUE';\n\n const { customEvent, onClickCallback, states, extraAttributes } = props;\n const block = new Block(props);\n const [isOverlayOpen, setIsOverlayOpen] = useState(states.isOverlayOpen);\n const [lastButton, setLastButton] = useState(null);\n const [lastScroll, setLastScroll] = useState(0);\n const [productSku, setProductSku] = useState('');\n const KEYCODE_ESC = 27;\n const anchorId = block.getAnchorId();\n const productOverlayRef = useRef();\n const closeOverlayLabel = block.getFieldValue(ProductOverlayConstants.closeOverlayLabel)?.fields?.text;\n const buyNowLiteErrorLabel = block.getFieldValue(ProductOverlayConstants.buyNowLiteErrorLabel)?.fields?.text;\n let classNames = block.getFieldValue(ProductOverlayConstants.classNames) ? block.getFieldValue(ProductOverlayConstants.classNames) : ProductOverlayConstants.empty;\n classNames += `${anchorId}`;\n\n useEffect(() => {\n setLastScroll(window.pageYOffset);\n const productVariants = extraAttributes?.entity?.productOverview?.fields?.productVariants;\n const series = extraAttributes?.entity?.series;\n let initialSku = '';\n if (extraAttributes) {\n if (productVariants?.length > 0 && productVariants[0]?.fields?.sku) {\n\n initialSku = extraAttributes?.entity?.productOverview?.fields?.productVariants[0]?.fields?.sku;\n\n } else if (series?.length > 0 && series[0]?.fields?.featuredProduct?.fields?.productVariants?.length > 0 && series[0]?.fields?.featuredProduct?.fields?.productVariants[0]?.fields?.sku) {\n\n initialSku = extraAttributes?.entity?.series[0]?.fields?.featuredProduct?.fields?.productVariants[0]?.fields?.sku;\n\n }\n }\n setProductSku(initialSku);\n }, []);\n\n const onGetBuyNowLiteRetailerListSuccess = (data) => {\n const buyNowLiteContainer = document.querySelector('.buy-now-lite-container');\n for (const item of data) {\n let linkNode = document.createElement('a');\n linkNode.href = item.BuyNowUrl;\n linkNode.target = '_blank';\n linkNode.rel = 'noopener noreferrer';\n linkNode.className = 'buy-now-lite-link event_buy_now_eretailer_exit';\n linkNode.setAttribute('data-action-detail', `${item?.RetailerName}`);\n let imgNode = document.createElement('img');\n imgNode.src = 'data:image/png;base64,' + item.Retailerlogo;\n imgNode.className = 'buy-now-lite-img';\n imgNode.alt = '';\n linkNode.appendChild(imgNode);\n\n buyNowLiteContainer.appendChild(linkNode);\n }\n\n openBuyNowLiteModal();\n };\n\n const onGetBuyNowLiteRetailerListFailure = () => {\n // close modal and remove buy now lite retailer images from modal.\n const buyNowLiteContainer = document.querySelector('.buy-now-lite-container');\n let paragraphNode = document.createElement('p');\n paragraphNode.className = 'buy-now-lite-error-message';\n paragraphNode.textContent = buyNowLiteErrorLabel;\n\n buyNowLiteContainer.appendChild(paragraphNode);\n\n openBuyNowLiteModal();\n };\n\n useEffect(() => {\n if (!customEvent?.event) {\n return;\n }\n if (customEvent.event instanceof HTMLElement || customEvent.event instanceof Node) {\n if (displayBuyNowLite) {\n customEvent.event.disabled = true;\n }\n const sku = customEvent?.event?.dataset?.sku ? customEvent.event.dataset.sku : '';\n let resetCountryCode = customEvent?.event?.dataset?.resetCountryCode ? customEvent.event.dataset.resetCountryCode : false;\n\n // ACTIVATE_BUY_NOW_LITE is true for japan\n if (process.env.ACTIVATE_BUY_NOW_LITE) {\n if(sku !== '') {\n // Ajax call to get retailer data.\n getBuyNowLiteRetailerList(sku, onGetBuyNowLiteRetailerListSuccess, onGetBuyNowLiteRetailerListFailure);\n } else {\n // If no sku, close modal and remove buy now lite retailer images from modal.\n const buyNowLiteContainer = document.querySelector('.buy-now-lite-container');\n buyNowLiteContainer.innerHTML = '';\n closeBuyNowLiteModal();\n }\n } else { // Price spider buy now case.\n if (sku !== '' && window.PriceSpider === undefined) {\n // script priceSpider with callback\n loadScript(ProductOverlayConstants.priceSpiderSource, (error) => {\n if (error) {\n console.log(ProductOverlayConstants.priceSpiderConsoleLogMessageError);\n } else {\n // script loaded successfully\n setProductSku(sku);\n setLastButton(customEvent.event);\n setIsOverlayOpen(true);\n }\n });\n } else if (sku !== '') {\n // script already loaded\n setProductSku(sku);\n setLastButton(customEvent.event);\n setIsOverlayOpen(true);\n } else {\n setProductSku('');\n setIsOverlayOpen(false);\n }\n\n if (resetCountryCode && window?.PriceSpider) {\n window.PriceSpider.reset();\n }\n }\n }\n }, [customEvent]);\n\n useEffect(() => {\n if (productSku !== '' && window?.PriceSpider) {\n window.PriceSpider.rebind();\n }\n }, [productSku]);\n\n useEffect(() => {\n if (productOverlayRef?.current) {\n toggleOverlay();\n productOverlayRef?.current?.addEventListener(ProductOverlayConstants.keydown, trapFocusInOverlay);\n return () => {\n productOverlayRef?.current?.removeEventListener(ProductOverlayConstants.keydown, trapFocusInOverlay)\n }\n }\n },[isOverlayOpen]);\n\n useEffect(() => {\n const handleScroll = throttle(() => {\n if (!document.body.classList.contains(ProductOverlayConstants.noScroll)) {\n setLastScroll(window.pageYOffset);\n }\n }, 100);\n window.addEventListener(ProductOverlayConstants.scroll, handleScroll);\n return () => {\n window.removeEventListener(ProductOverlayConstants.scroll, handleScroll);\n }\n },[lastScroll]);\n\n const closeBuyNowLiteModal = () => {\n setProductSku('');\n setIsOverlayOpen(false);\n }\n\n const openBuyNowLiteModal = () => {\n if (displayBuyNowLite) {\n customEvent.event.disabled = false;\n }\n setLastButton(customEvent.event);\n setIsOverlayOpen(true);\n }\n\n const toggleOverlay = () => {\n const productOverlayElem = productOverlayRef.current;\n let ele = document.getElementById('ob-product-subnav-scroll');\n\n if (isOverlayOpen) {\n if(ele) {\n ele.setAttribute('style', 'z-index:99 !important');\n }\n productOverlayElem.classList.add(ProductOverlayConstants.isActive);\n productOverlayElem.focus();\n } else {\n if(ele) {\n ele.setAttribute('style', 'z-index:999 !important');\n }\n productOverlayElem.classList.remove(ProductOverlayConstants.isActive);\n document.body.style.top = null;\n document.body.style.height = null;\n if (lastButton) {\n lastButton.focus();\n }\n }\n toggleScroll(isOverlayOpen, lastScroll);\n };\n\n const trapFocusInOverlay = event => {\n if (!isOverlayOpen) {\n return;\n }\n const element = event.currentTarget;\n const focusableElements = element.querySelectorAll(ProductOverlayConstants.querySelectorAll);\n const firstFocusableElement = focusableElements[0];\n const lastFocusableElement = focusableElements[focusableElements.length - 1];\n const KEYCODE_TAB = 9;\n\n const isTabPressed = (event.key === ProductOverlayConstants.Tab || event.keyCode === KEYCODE_TAB);\n\n handleEscapeKeyPress(event);\n\n if (!isTabPressed) {\n return;\n }\n\n if ( event.shiftKey ) /* shift + tab */ {\n if (document.activeElement === firstFocusableElement) {\n lastFocusableElement.focus();\n event.preventDefault();\n }\n } else /* tab */ {\n if (document.activeElement === lastFocusableElement) {\n firstFocusableElement.focus();\n event.preventDefault();\n }\n }\n };\n\n const handleBackgroundClick = event => {\n event.stopPropagation();\n if (event.target === document.querySelector('.ob-product-overlay')) {\n setIsOverlayOpen(false);\n\n if(displayBuyNowLite) {\n // When clicking in background remove buy now lite retailer.\n const buyNowLiteContainer = document.querySelector('.buy-now-lite-container');\n buyNowLiteContainer.innerHTML = '';\n }\n }\n };\n\n const handleEscapeKeyPress = event => {\n if (event.key === ProductOverlayConstants.Escape || event.keyCode === KEYCODE_ESC) {\n setIsOverlayOpen(false);\n }\n }\n\n return (\n
\n
\n {\n isOverlayOpen &&\n \n }\n
\n {displayBuyNowLite ?\n <>\n
\n\n
\n \n :\n <>\n
\n \n }\n\n\n
\n
\n
\n )\n}\n\nProductOverlay.defaultProps = {\n states: {isOverlayOpen: false}\n};\n\nProductOverlay.propTypes = {\n customEvent: PropTypes.object,\n onClickCallback: PropTypes.func,\n states: PropTypes.object,\n children: PropTypes.node,\n extraAttributes: PropTypes.object,\n};\n","\"use strict\";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4238],{14238:function(e,n,t){t.r(n),t.d(n,{default:function(){return b}});var l=t(67294),r=t(5152),o=t.n(r),u=t(23493),i=t.n(u),a=t(40483),c=t(8996),s=t(24036);function d(){var e=new Headers;return e.append(s.t8.accessControlAllowOrigin,\"*\"),e.append(s.t8.passKey,\"dcd5b240-560e-4fd6-a9d5-6027cb7da6c5\"),e.append(s.t8.ocpApimSubscriptionKey,\"f22aa65843484373a0bf8a93d4943148\"),e}var f=t(85893);function v(e,n){var t=\"undefined\"!=typeof Symbol&&e[Symbol.iterator]||e[\"@@iterator\"];if(!t){if(Array.isArray(e)||(t=function(e,n){if(!e)return;if(\"string\"==typeof e)return p(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);\"Object\"===t&&e.constructor&&(t=e.constructor.name);if(\"Map\"===t||\"Set\"===t)return Array.from(e);if(\"Arguments\"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return p(e,n)}(e))||n&&e&&\"number\"==typeof e.length){t&&(e=t);var l=0,r=function(){};return{s:r,n:function(){return l>=e.length?{done:!0}:{done:!1,value:e[l++]}},e:function(e){throw e},f:r}}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}var o,u=!0,i=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return u=e.done,e},e:function(e){i=!0,o=e},f:function(){try{u||null==t.return||t.return()}finally{if(i)throw o}}}}function p(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,l=new Array(n);t0&&(null==(r=E[0])||null==(o=r.fields)?void 0:o.sku))A=null==m||null==(w=m.entity)||null==(h=w.productOverview)||null==(g=h.fields)||null==(j=g.productVariants[0])||null==(k=j.fields)?void 0:k.sku;else if((null==S?void 0:S.length)>0&&(null==(u=S[0])||null==(i=u.fields)||null==(a=i.featuredProduct)||null==(c=a.fields)||null==(s=c.productVariants)?void 0:s.length)>0&&(null==(d=S[0])||null==(f=d.fields)||null==(v=f.featuredProduct)||null==(p=v.fields)||null==(y=p.productVariants[0])||null==(b=y.fields)?void 0:b.sku)){var C,x,N,O,V,P,q;A=null==m||null==(C=m.entity)||null==(x=C.series[0])||null==(N=x.fields)||null==(O=N.featuredProduct)||null==(V=O.fields)||null==(P=V.productVariants[0])||null==(q=P.fields)?void 0:q.sku}L(A)}),[]);var F=function(e){var n,t=document.querySelector(\".buy-now-lite-container\"),l=v(e);try{for(l.s();!(n=l.n()).done;){var r=n.value,o=document.createElement(\"a\");o.href=r.BuyNowUrl,o.target=\"_blank\",o.rel=\"noopener noreferrer\",o.className=\"buy-now-lite-link event_buy_now_eretailer_exit\",o.setAttribute(\"data-action-detail\",\"\".concat(null==r?void 0:r.RetailerName));var u=document.createElement(\"img\");u.src=\"data:image/png;base64,\"+r.Retailerlogo,u.className=\"buy-now-lite-img\",u.alt=\"\",o.appendChild(u),t.appendChild(o)}}catch(e){l.e(e)}finally{l.f()}K()},I=function(){var e=document.querySelector(\".buy-now-lite-container\"),n=document.createElement(\"p\");n.className=\"buy-now-lite-error-message\",n.textContent=q,e.appendChild(n),K()};(0,l.useEffect)((function(){if((null==u?void 0:u.event)&&(u.event instanceof HTMLElement||u.event instanceof Node)){var e,n,t,l;u.event.disabled=!0;var r=(null==u||null==(e=u.event)||null==(n=e.dataset)?void 0:n.sku)?u.event.dataset.sku:\"\";!!(null==u||null==(t=u.event)||null==(l=t.dataset)?void 0:l.resetCountryCode)&&u.event.dataset.resetCountryCode;\"\"!==r?function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},l=d(),r={method:\"GET\",headers:l},o=\"https://csapi.pg.com/brandbuilding/consumer/v1/buynowliteretailers/retailer-api/retailers/{sku}/alphabetic/desired\".replace(\"{sku}\",e);fetch(o,r).then((function(e){return e.json()})).then((function(e){e.constructor===Array?n(e):t()})).catch((function(e){console.error(e),t()}))}(r,F,I):(document.querySelector(\".buy-now-lite-container\").innerHTML=\"\",H())}}),[u]),(0,l.useEffect)((function(){var e;\"\"!==N&&(null==(e=window)?void 0:e.PriceSpider)&&window.PriceSpider.rebind()}),[N]),(0,l.useEffect)((function(){var e;if(null==V?void 0:V.current)return M(),null==V||null==(e=V.current)||e.addEventListener(s.cj.keydown,z),function(){var e;null==V||null==(e=V.current)||e.removeEventListener(s.cj.keydown,z)}}),[g]),(0,l.useEffect)((function(){var e=i()((function(){document.body.classList.contains(s.cj.noScroll)||_(window.pageYOffset)}),100);return window.addEventListener(s.cj.scroll,e),function(){window.removeEventListener(s.cj.scroll,e)}}),[C]);var H=function(){L(\"\"),j(!1)},K=function(){u.event.disabled=!1,S(u.event),j(!0)},M=function(){var e=V.current,n=document.getElementById(\"ob-product-subnav-scroll\");g?(n&&n.setAttribute(\"style\",\"z-index:99 !important\"),e.classList.add(s.cj.isActive),e.focus()):(n&&n.setAttribute(\"style\",\"z-index:999 !important\"),e.classList.remove(s.cj.isActive),document.body.style.top=null,document.body.style.height=null,E&&E.focus()),(0,c.a9)(g,C)},z=function(e){if(g){var n=e.currentTarget.querySelectorAll(s.cj.querySelectorAll),t=n[0],l=n[n.length-1],r=e.key===s.cj.Tab||9===e.keyCode;D(e),r&&(e.shiftKey?document.activeElement===t&&(l.focus(),e.preventDefault()):document.activeElement===l&&(t.focus(),e.preventDefault()))}},D=function(e){e.key!==s.cj.Escape&&27!==e.keyCode||j(!1)};return(0,f.jsx)(\"div\",{role:\"presentation\",onClick:function(e){(e.stopPropagation(),e.target===document.querySelector(\".ob-product-overlay\"))&&(j(!1),document.querySelector(\".buy-now-lite-container\").innerHTML=\"\")},onKeyDown:D,ref:V,className:\"ob-product-overlay \".concat(T),children:(0,f.jsxs)(\"div\",{className:\"ob-product-overlay__wrapper \".concat(\"ob-product-overlay__wrapper--buy-now-lite\"),children:[g&&(0,f.jsx)(\"button\",{\"aria-label\":P,className:\"ob-product-overlay__close-btn\",onClick:function(e){return p(e)},children:(0,f.jsx)(y,{name:s.cj.close,size:2})}),(0,f.jsx)(\"div\",{id:\"ob-product-overlay__content\",children:(0,f.jsx)(f.Fragment,{children:(0,f.jsx)(\"div\",{className:\"buy-now-lite-container\"})})})]})})}b.defaultProps={states:{isOverlayOpen:!1}}}}]);"],"names":["self","webpackChunk_N_E","push","e","n","t","r","d","default","b","l","o","u","i","a","c","s","f","p","length","y","Promise","resolve","then","bind","loadableGenerated","webpack","customEvent","onClickCallback","states","m","extraAttributes","w","Z","h","useState","isOverlayOpen","g","j","k","E","S","A","C","_","x","N","L","O","getAnchorId","V","useRef","P","getFieldValue","cj","closeOverlayLabel","fields","text","q","buyNowLiteErrorLabel","T","classNames","empty","concat","useEffect","window","pageYOffset","v","entity","productOverview","productVariants","series","sku","featuredProduct","F","document","querySelector","Symbol","iterator","Array","isArray","Object","prototype","toString","call","slice","constructor","name","from","test","done","value","next","return","createElement","href","BuyNowUrl","target","rel","className","setAttribute","RetailerName","src","Retailerlogo","alt","appendChild","K","I","textContent","event","HTMLElement","Node","disabled","dataset","resetCountryCode","arguments","Headers","append","t8","accessControlAllowOrigin","passKey","ocpApimSubscriptionKey","replace","fetch","method","headers","json","catch","console","error","innerHTML","H","PriceSpider","rebind","current","M","addEventListener","keydown","z","removeEventListener","body","classList","contains","noScroll","scroll","getElementById","add","isActive","focus","remove","style","top","height","a9","currentTarget","querySelectorAll","key","Tab","keyCode","D","shiftKey","activeElement","preventDefault","Escape","jsx","role","onClick","stopPropagation","onKeyDown","ref","children","jsxs","close","size","id","Fragment","defaultProps"],"sourceRoot":""}