{"version":3,"file":"Examples.B_VzogDe.mjs","names":["useStore","useState"],"sources":["https:/framer.com/m/framer/store.js@^1.0.0","https:/framer.com/m/framer/utils.js@^0.9.0","https:/framerusercontent.com/modules/rvl6wEdBEln3uA3Vhscv/YdcUuxkiTg4GUFTp9anb/Examples.js"],"sourcesContent":["import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map","export const centerContent = {\n    display: \"flex\",\n    justifyContent: \"center\",\n    alignItems: \"center\"\n};\nexport const autoSizingText = {\n    width: \"max-content\",\n    wordBreak: \"break-word\",\n    overflowWrap: \"break-word\",\n    overflow: \"hidden\",\n    whiteSpace: \"pre-wrap\",\n    flexShrink: 0\n};\nexport const defaultContainerStyles = {\n    ...centerContent,\n    overflow: \"hidden\"\n};\nexport const containerStyles = defaultContainerStyles;\nexport const randomColor = ()=>\"#\" + Math.floor(Math.random() * 16777215).toString(16)\n;\n\nexport const __FramerMetadata__ = {\"exports\":{\"centerContent\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"containerStyles\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"autoSizingText\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"defaultContainerStyles\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"randomColor\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}}}}\n//# sourceMappingURL=./Utils.map","// import type { ComponentType } from \"react\"\n// import { createStore } from \"https://framer.com/m/framer/store.js@^1.0.0\"\n// import { randomColor } from \"https://framer.com/m/framer/utils.js@^0.9.0\"\n// // Learn more: https://www.framer.com/docs/guides/overrides/\n// const useStore = createStore({\n//     background: \"#0099FF\",\n// })\n// export function withRotate(Component): ComponentType {\n//     return (props) => {\n//         return (\n//             <Component\n//                 {...props}\n//                 animate={{ rotate: 90 }}\n//                 transition={{ duration: 2 }}\n//             />\n//         )\n//     }\n// }\n// export function withHover(Component): ComponentType {\n//     return (props) => {\n//         return <Component {...props} whileHover={{ scale: 1.05 }} />\n//     }\n// }\n// export function withRandomColor(Component): ComponentType {\n//     return (props) => {\n//         const [store, setStore] = useStore()\n//         return (\n//             <Component\n//                 {...props}\n//                 animate={{\n//                     background: store.background,\n//                 }}\n//                 onClick={() => {\n//                     setStore({ background: randomColor() })\n//                 }}\n//             />\n//         )\n//     }\n// }\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{randomColor}from\"https://framer.com/m/framer/utils.js@^0.9.0\";import{useState,useEffect}from\"react\";// Learn more: https://www.framer.com/docs/guides/overrides/\nconst useStore=createStore({background:\"#0099FF\"});// Rotate animation\nexport function withRotate(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,animate:{rotate:90},transition:{duration:2}});};}// Hover animation\nexport function withHover(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,whileHover:{scale:1.05}});};}// Random background color on click\nexport function withRandomColor(Component){return props=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{...props,animate:{background:store.background},onClick:()=>{setStore({background:randomColor()});}});};}// Redirect on button click\n// Redirect with API call on button click\nexport function withRedirect(Component){return props=>{const handleRedirect=async()=>{try{// Extract parameters from the current URL\nconst params=new URLSearchParams(window.location.search);// Extracting all relevant query parameters\nconst email=params.get(\"email\")||\"default@example.com\"// Fallback value\n;const utm_source=params.get(\"utm_source\")||\"\";const utm_campaign=params.get(\"utm_campaign\")||\"\";const utm_medium=params.get(\"utm_medium\")||\"\";const utm_content=params.get(\"utm_content\")||\"\";const utm_term=params.get(\"utm_term\")||\"\";const creative=params.get(\"creative\")||\"\";const devicemodel=params.get(\"devicemodel\")||\"\";// API endpoint and payload\nconst apiEndpoint=\"https://zjgicpj984.execute-api.ap-south-1.amazonaws.com/create-checkout\"// Replace with your API URL\n;const payload={variant_id:\"438640\",price:18e3,utm_source,utm_campaign,utm_medium,utm_content,utm_term,creative,devicemodel,email};// Make the API call\nconst response=await fetch(apiEndpoint,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify(payload)});// Check response status\nif(!response.ok){console.error(\"API call failed:\",response.statusText);// alert(\"Failed to create checkout. Please try again.\")\nreturn;}// Extract the checkout URL from the API response\nconst data=await response.json();const checkoutUrl=data.checkout_url;if(checkoutUrl){// Redirect to the generated checkout URL\nwindow.location.href=checkoutUrl;}else{console.error(\"Checkout URL not found in API response.\");// alert(\"Checkout URL not available. Please contact support.\")\n}}catch(error){console.error(\"Error during redirect:\",error);// alert(\"An error occurred. Please try again.\")\n}};return /*#__PURE__*/_jsx(Component,{...props,temp:handleRedirect,onClick:handleRedirect});};}export function changeButtonText(Component){return props=>{const[country,setCountry]=useState(\"India\")// Default country\n;const[buttonText,setButtonText]=useState(\"Start Free\")// Default button text\n;// Fetch user's location using a geolocation API\nuseEffect(()=>{const fetchLocation=async()=>{try{const response=await fetch(\"https://ipapi.co/json/\")// CORS-compliant API endpoint\n;if(!response.ok){throw new Error(`HTTP error! status: ${response.status}`);}const data=await response.json();setCountry(data.country_name||\"India\")// Set the country, fallback to \"India\"\n;}catch(error){console.error(\"Error fetching location:\",error);}};fetchLocation();},[]);// Update button text based on the user's country\nuseEffect(()=>{if(country!==\"India\"){setButtonText(\"Let's Start Now\");}else{setButtonText(\"Start Free\");}},[country]);// Render the wrapped component with the updated buttonText\nreturn /*#__PURE__*/_jsx(Component,{...props,text:buttonText});};}\nexport const __FramerMetadata__ = {\"exports\":{\"changeButtonText\":{\"type\":\"reactHoc\",\"name\":\"changeButtonText\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRedirect\":{\"type\":\"reactHoc\",\"name\":\"withRedirect\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Examples.map"],"mappings":"sSAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAG,EAAO,CAAC,CAAC,CAAC,CAClD,EAAa,GAAU,CAC1B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAU,MAAM,EAAE,EAAU,MA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