{"version":3,"file":"CopyEmailOnDesktop.BK1pZoIL.mjs","names":["useRef","useCallback","__esmMin","init_ssg_sandbox_shims","navigator","ne","window","c","J","ce","init_npm_react_18_3_1","de","CopyEmailOnDesktop","rootRef","restoreTextRef","timeoutRef","assignRefs","node","ref","isDesktopOrTablet","clearFeedbackTimeout","restoreLabel","findFirstTextNode","walker","rootElement","current","showCopiedFeedback","textNode","copyEmailToClipboard","email","textArea","didCopy","handleDesktopCopy","handleClick","event","props","handleKeyDown","Component","init_CopyEmailOnDesktop","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/zfiwlrp9XZeYQzfomiqx/38H8HWBpDyhi4NcM7m2z/CopyEmailOnDesktop.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useRef}from\"react\";// User request: 1) Update `ContactProductInquiryEmail.tsx` so the Contact email CTA behaves as follows:\n// - On desktop/tablet viewports (width 810px or wider), clicking copies `ofaa.atelier@gmail.com` to the clipboard, prevents the email navigation, and temporarily changes only the CTA’s visible label to `Copied ✓` for about 1.6 seconds before restoring it. Use `navigator.clipboard.writeText` with a safe fallback when unavailable. Preserve canvas styling and accessibility. This behavior wins even when a `product` query parameter is present.\n// - On phone widths (below 810px), keep the existing behavior exactly: when `product` is in the query, open the current prefilled product mailto; otherwise preserve the component’s native email action.\n//\n// 2) Create a code override export named `CopyEmailOnDesktop` in a new file. It will be applied to a simple canvas email link wrapper. On width 810px or wider, it copies `ofaa.atelier@gmail.com`, prevents mailto navigation, and temporarily changes the wrapper’s visible text to `Copied ✓` for 1.6 seconds before restoring it. On phone widths, it must allow the canvas element’s normal mailto link behavior unchanged. Preserve ref, props, styling, keyboard activation, and add a safe clipboard fallback. Do not create a new visual component; overrides only.\nexport function CopyEmailOnDesktop(Component){return /*#__PURE__*/forwardRef(function CopyEmailOnDesktopOverride(props,ref){const rootRef=useRef(null);const restoreTextRef=useRef(null);const timeoutRef=useRef(null);const assignRefs=useCallback(node=>{rootRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&typeof ref===\"object\"){ref.current=node;}},[ref]);const isDesktopOrTablet=()=>{if(typeof window===\"undefined\")return false;return window.innerWidth>=810;};const clearFeedbackTimeout=useCallback(()=>{if(timeoutRef.current===null||typeof window===\"undefined\")return;window.clearTimeout(timeoutRef.current);timeoutRef.current=null;},[]);const restoreLabel=useCallback(()=>{if(!restoreTextRef.current)return;restoreTextRef.current.node.textContent=restoreTextRef.current.value;restoreTextRef.current=null;},[]);const findFirstTextNode=rootElement=>{const walker=document.createTreeWalker(rootElement,NodeFilter.SHOW_TEXT);let current=walker.nextNode();while(current){if(current.textContent?.trim())return current;current=walker.nextNode();}return null;};const showCopiedFeedback=useCallback(()=>{if(typeof document===\"undefined\")return;const rootElement=rootRef.current;if(!rootElement)return;clearFeedbackTimeout();restoreLabel();const textNode=findFirstTextNode(rootElement);if(!textNode)return;restoreTextRef.current={node:textNode,value:textNode.textContent??\"\"};textNode.textContent=\"Copied ✓\";timeoutRef.current=window.setTimeout(()=>{restoreLabel();timeoutRef.current=null;},1600);},[clearFeedbackTimeout,restoreLabel]);const copyEmailToClipboard=async()=>{const email=\"ofaa.atelier@gmail.com\";if(typeof navigator!==\"undefined\"&&navigator.clipboard?.writeText){try{await navigator.clipboard.writeText(email);return true;}catch(_error){}}if(typeof document===\"undefined\")return false;try{const textArea=document.createElement(\"textarea\");textArea.value=email;textArea.setAttribute(\"readonly\",\"\");textArea.style.position=\"fixed\";textArea.style.opacity=\"0\";textArea.style.pointerEvents=\"none\";document.body.appendChild(textArea);textArea.focus();textArea.select();const didCopy=document.execCommand(\"copy\");document.body.removeChild(textArea);return didCopy;}catch(_error){return false;}};const handleDesktopCopy=async()=>{const copied=await copyEmailToClipboard();if(copied)showCopiedFeedback();};const handleClick=event=>{if(!isDesktopOrTablet()){if(typeof props.onClick===\"function\"){props.onClick(event);}return;}event.preventDefault();event.stopPropagation();void handleDesktopCopy();};const handleKeyDown=event=>{const isActivateKey=event.key===\"Enter\"||event.key===\" \";if(!isActivateKey){if(typeof props.onKeyDown===\"function\"){props.onKeyDown(event);}return;}if(!isDesktopOrTablet()){if(typeof props.onKeyDown===\"function\"){props.onKeyDown(event);}return;}event.preventDefault();event.stopPropagation();void handleDesktopCopy();};useEffect(()=>{return()=>{clearFeedbackTimeout();restoreLabel();};},[clearFeedbackTimeout,restoreLabel]);return /*#__PURE__*/_jsx(Component,{ref:assignRefs,...props,onClick:handleClick,onKeyDown:handleKeyDown});});}\nexport const __FramerMetadata__ = {\"exports\":{\"CopyEmailOnDesktop\":{\"type\":\"reactHoc\",\"name\":\"CopyEmailOnDesktop\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CopyEmailOnDesktop.map"],"mappings":"A,uJAKA,SAAgBY,EAAmB,EAAU,CAAC,MAAoB,gBAAW,SAAoC,EAAM,EAAI,CAAC,IAAMC,EAAQb,EAAO,IAAI,EAAQc,EAAed,EAAO,IAAI,EAAQe,EAAWf,EAAO,IAAI,EAAQgB,EAAWf,EAAY,GAAM,CAAC,EAAQ,QAAQgB,EAAQ,OAAOC,GAAM,WAAYA,EAAID,CAAI,EAAWC,GAAK,OAAOA,GAAM,WAAU,EAAI,QAAQD,EAAM,EAAE,CAACC,CAAG,CAAC,EAAQC,MAAiCb,IAAS,QAAgCA,EAAO,YAAY,IAAYc,EAAqBnB,MAAgB,CAAIc,EAAW,UAAU,MAAaT,IAAS,SAAmBA,EAAO,aAAaS,EAAW,OAAO,EAAE,EAAW,QAAQ,KAAK,EAAE,CAAC,CAAC,EAAQM,EAAapB,MAAgB,CAAC,AAAuGa,EAAe,WAApF,EAAe,QAAQ,KAAK,YAAYA,EAAe,QAAQ,MAA6B,KAAK,EAAE,CAAC,CAAC,EAAQQ,EAAkB,GAAa,CAAC,IAAMC,EAAO,SAAS,iBAAiBC,EAAY,WAAW,SAAS,EAAMC,EAAQF,EAAO,SAAS,EAA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