PageSourceSearch

https://patisserie-valerie.co.uk/cdn/shop/t/238/assets/product-promo-copy.js?v=75201271047387954051790583258

js patisserie-valerie.co.uk collected 2026-10-03 20:38:00 UTC 7,230 bytes, 2 lines download raw bytes

1if(!window.productPromoCopyListenerReady){window.productPromoCopyListenerReady=!0;const fallbackCopy=value=>{const focusedElement=document.activeElement,textarea=document.createElement("textarea");textarea.value=value,textarea.setAttribute("readonly",""),textarea.style.position="fixed",textarea.style.opacity="0",document.body.appendChild(textarea);try{return textarea.select(),document.execCommand("copy")}catch{return!1}finally{textarea.remove(),focusedElement instanceof HTMLElement&&focusedElement.focus()}},copyPromoCode=async value=>{if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function"&&window.isSecureContext)try{return await navigator.clipboard.writeText(value),!0}catch{return fallbackCopy(value)}return fallbackCopy(value)},promoPayload=notice=>({promotion_id:notice?.dataset.promoId||notice?.dataset.promoCode||"product-promo",promotion_name:notice?.dataset.promoName||notice?.textContent?.trim()||"",promo_code:notice?.dataset.promoCode||"",product_id:notice?.dataset.promoProductId||"",product_title:notice?.dataset.promoProductTitle||"",page_type:notice?.dataset.promoPageType||"",page_url:window.location.href}),publishPromoEvent=(eventName,payload,retryCount=0)=>{if(window.Shopify&&window.Shopify.analytics&&typeof window.Shopify.analytics.publish=="function"){Promise.resolve(window.Shopify.analytics.publish(eventName,payload)).catch(()=>{});return}retryCount<20&&window.setTimeout(()=>publishPromoEvent(eventName,payload,retryCount+1),250)},promoGa4CurrentId="G-489FD2QNZN",promoGa4DestinationIds=[promoGa4CurrentId,"G-3G3MQF5QTX"],pendingGa4Events=[];let promoGa4RetryCount=0,promoGa4RetryTimer,promoGa4CurrentConfigured=!1;const flushPendingGa4Events=()=>{if(!pendingGa4Events.length)return;if(!window.analyzify?.ga4Initiated||!Array.isArray(window.dataLayer)){promoGa4RetryCount<240&&!promoGa4RetryTimer&&(promoGa4RetryCount+=1,promoGa4RetryTimer=window.setTimeout(()=>{promoGa4RetryTimer=void 0,flushPendingGa4Events()},500));return}const promoGtag=function(){window.dataLayer.push(arguments)};for(promoGa4CurrentConfigured||(promoGtag("config",promoGa4CurrentId,{send_page_view:!1}),promoGa4CurrentConfigured=!0);pendingGa4Events.length;){const{eventName,eventPayload}=pendingGa4Events.shift();promoGtag("event",eventName,eventPayload)}promoGa4RetryCount=0},sendGa4Event=(eventName,payload)=>{const creativeSlot=`${payload.page_type||"unknown"}_promo_notice`,item={item_id:payload.product_id||void 0,item_name:payload.product_title||void 0,promotion_id:payload.promotion_id,promotion_name:payload.promotion_name,creative_slot:creativeSlot,coupon:payload.promo_code||void 0};promoGa4RetryCount=0,pendingGa4Events.push({eventName,eventPayload:{send_to:promoGa4DestinationIds,event_category:"promotion",promotion_id:payload.promotion_id,promotion_name:payload.promotion_name,creative_slot:creativeSlot,coupon:payload.promo_code||void 0,promo_code:payload.promo_code,product_id:payload.product_id,product_name:payload.product_title,page_type:payload.page_type,interaction_type:payload.interaction_type||void 0,page_location:payload.page_url||window.location.href,debug_mode:new URLSearchParams(window.location.search).has("pv_promo_debug")||void 0,items:[item]}}),flushPendingGa4Events()};document.addEventListener("visitorConsentCollected",flushPendingGa4Events),document.addEventListener("AnalyzifyConsent",flushPendingGa4Events),window.pvPromoAnalytics={send:sendGa4Event,flush:flushPendingGa4Events};const trackPromoEvent=(shopifyEventName,ga4EventName,notice,extra={})=>{const payload={...promoPayload(notice),...extra};publishPromoEvent(shopifyEventName,payload),sendGa4Event(ga4EventName,payload)},trackPromoCodeCopy=button=>{const notice=button.closest(".product-price__promo-notice");trackPromoEvent("pv:promo_code_copy","select_promotion",notice,{promo_code:button.dataset.promoCopyCode||"",interaction_type:"copy_code"})},observedPromoNotices=new WeakSet,viewedPromoKeys=new Set,promoObserver=new IntersectionObserver(entries=>{entries.forEach(entry=>{if(!entry.isIntersecting||entry.intersectionRatio<.5)return;const notice=entry.target,payload=promoPayload(notice),viewKey=`${payload.promotion_id}|${payload.product_id}|${payload.page_type}`;promoObserver.unobserve(notice),!viewedPromoKeys.has(viewKey)&&(viewedPromoKeys.add(viewKey),trackPromoEvent("pv:promo_view","view_promotion",notice))})},{threshold:.5}),observePromoNotices=()=>{document.querySelectorAll(".product-price__promo-notice").forEach(notice=>{observedPromoNotices.has(notice)||(observedPromoNotices.add(notice),promoObserver.observe(notice))})},startPromoNoticeTracking=()=>{observePromoNotices(),new MutationObserver(observePromoNotices).observe(document.body,{childList:!0,subtree:!0})};document.body?startPromoNoticeTracking():document.addEventListener("DOMContentLoaded",startPromoNoticeTracking,{once:!0}),document.addEventListener("click",async event=>{if(!(event.target instanceof Element))return;const button=event.target.closest(".product-price__promo-code[data-
1promo-copy-code]");if(!button){if(!event.target.closest('.product-form-buttons button[type="submit"], button[name="add"], [data-add-to-cart]'))return;const notice=document.querySelector('.product-price__promo-notice[data-promo-page-type="product"]:not([hidden])');notice&&trackPromoEvent("pv:promo_add_to_cart","promo_add_to_cart",notice,{interaction_type:"add_to_cart"});return}const copied=await copyPromoCode(button.dataset.promoCopyCode),status=button.closest(".product-price__promo-notice")?.querySelector("[data-promo-copy-status]");status&&(status.textContent=copied?`Code ${button.dataset.promoCopyCode} copied`:"Could not copy code"),copied&&(trackPromoCodeCopy(button),button.classList.add("is-copied"),button.setAttribute("aria-label",`Code ${button.dataset.promoCopyCode} copied`),window.clearTimeout(button.productPromoCopyTimer),button.productPromoCopyTimer=window.setTimeout(()=>{button.classList.remove("is-copied"),button.setAttribute("aria-label",`Copy code ${button.dataset.promoCopyCode}`),status&&(status.textContent="")},1600))})}if(!window.productPromoPlacementReady){window.productPromoPlacementReady=!0;const positionProductPromoNotice=()=>{const purchaseButtons=document.querySelector(".buy-buttons-block .product-form-buttons");if(!purchaseButtons)return;const notice=(purchaseButtons.closest(".shopify-section")||document).querySelector('.product-price__promo-notice[data-promo-page-type="product"]');if(!notice)return;const block=notice.closest("pv-promo-notices")||notice;if(purchaseButtons.nextElementSibling===block)return;const previous=purchaseButtons.nextElementSibling;previous&&previous.hasAttribute("data-promo-placed")&&previous.remove(),block.setAttribute("data-promo-placed",""),(block.matches(".product-price__promo-notice")?[block]:block.querySelectorAll(".product-price__promo-notice")).forEach(item=>item.classList.add("product-price__promo-notice--after-buttons")),purchaseButtons.insertAdjacentElement("afterend",block)};positionProductPromoNotice(),new MutationObserver(()=>{window.requestAnimationFrame(positionProductPromoNotice)}).observe(document.body,{childList:!0,subtree:!0})}
2//# sourceMappingURL=/cdn/shop/t/238/assets/product-promo-copy.js.map?v=75201271047387954051790583258

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.