{"version":3,"file":"CheckoutEmbed.DlUmEycP.mjs","names":["e","t"],"sources":["https:/framerusercontent.com/modules/Z5Bjxsak94hnU0pxRVRl/ta2kBRNBSuWvdei19ncF/Shortcuts.js","https:/framerusercontent.com/modules/LjweC6ClHfwJfoeOLubv/HY9bD7vleJV5xJYyw0kv/CheckoutEmbed.js"],"sourcesContent":["import{jsx as e}from\"react/jsx-runtime\";import t from\"react\";export function withKeyboardShortcuts(r){let n=e=>{// Don't capture input if the user is typing in an input field/textarea or a meta key is pressed\nif(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.shiftKey||e.ctrlKey||e.altKey||e.metaKey)return;// Save pressed keys to session storage\nlet t=JSON.parse(sessionStorage.getItem(\"pressedKeys\")||\"[]\");if(t.push(e.key),t.length>1&&t.shift(),sessionStorage.setItem(\"pressedKeys\",JSON.stringify(t)),\"undefined\"!=typeof window){// Notify other components\nlet e=new CustomEvent(\"pressedKeysChanged\",{detail:t});window.dispatchEvent(e);}},o=()=>{sessionStorage.removeItem(\"pressedKeys\");};return s=>(\"undefined\"!=typeof window&&t.useEffect(()=>(// Focus window on load\n        window.focus(),window.addEventListener(\"keydown\",n),window.addEventListener(\"beforeunload\",o),()=>{window.removeEventListener(\"keydown\",n),window.removeEventListener(\"beforeunload\",o);}),[]),/*#__PURE__*/e(r,{...s}));}export function withShortcutTrigger(r){let n=(e,t,r)=>{let n=e.detail;// Check if the last pressed key matches the shortcut\nn[n.length-1].toLowerCase()===t.toLowerCase()&&(e.preventDefault(),setTimeout(()=>{if(r.current){let e=r.current.querySelector(\"button\"),n=r.current.querySelector(\"a\");e?e.click():n?n.click():console.error(`🦎 Error: The shortcut trigger element ${t} isn't working properly. Check the docs for help.`);}else console.error(`🦎 Error: The shortcut trigger element ${t} isn't working properly. Check the docs for help.`);sessionStorage.removeItem(\"pressedKeys\");},0));};return o=>{var s;let i=null===(s=o.name)||void 0===s?void 0:s.match(/\\[(.*?)\\]/),d=\"\",a=t.useRef(null);return i?d=i[1]:console.error(`🦎 Error: Your shortcut trigger layer (${o.name}) is missing a key in its layer name.`),\"undefined\"!=typeof window&&t.useEffect(()=>{window.addEventListener(\"pressedKeysChanged\",e=>{n(e,d,a);});},[]),/*#__PURE__*/e(\"span\",{ref:a,\"data-lizard-shortcuts-trigger\":d,children:/*#__PURE__*/e(r,{...o})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withShortcutTrigger\":{\"type\":\"reactHoc\",\"name\":\"withShortcutTrigger\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withKeyboardShortcuts\":{\"type\":\"reactHoc\",\"name\":\"withKeyboardShortcuts\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Shortcuts.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";function useEmbed(){useEffect(()=>{var _window;if((_window=window)===null||_window===void 0?void 0:_window.checkoutPage)return;const script=document.createElement(\"script\");script.src=\"https://checkoutpage.co/js/overlay.js\";script.async=true;document.body.appendChild(script);return()=>{document.body.removeChild(script);};},[]);return null;}export default function CheckoutEmbed({checkout,style}){useEmbed();useEffect(()=>{var _window_checkoutPage,_window;(_window=window)===null||_window===void 0?void 0:(_window_checkoutPage=_window.checkoutPage)===null||_window_checkoutPage===void 0?void 0:_window_checkoutPage.initEmbeds();},[checkout]);return /*#__PURE__*/_jsx(\"div\",{style:style,children:/*#__PURE__*/_jsx(\"div\",{className:\"cp-checkout\",\"data-checkout\":checkout})});}// Add a form id field in the properties panel\naddPropertyControls(CheckoutEmbed,{checkout:{title:\"Checkout\",type:ControlType.Link,placeholder:\"Your checkout link\",defaultValue:\"https://checkoutpage.co/c/examples/customize-this-checkout\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CheckoutEmbed\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__Fram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