{"version":3,"file":"PlanBuyButton.BnAqPH2q.mjs","names":["useState","useRef","Spainner"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/xjkhQV5Ve1Xnoo6Rj6Wd/M8tWzxBSuuC9SbaaWGP1/Spainner.js","https:/framer.com/m/Spainner-9KnC2N.js@M8tWzxBSuuC9SbaaWGP1","https:/framerusercontent.com/modules/DvCVNCd3YiGLpgmb2iT1/afwbYJsyea7i5Keya41s/PlanBuyButton.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","/*\n * createStore (framer/store@1.0.1)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{motion}from\"framer-motion\";export default function Spinner({loadingColor}){return /*#__PURE__*/_jsx(motion.svg,{width:\"14\",height:\"14\",viewBox:\"0 0 100 100\",animate:{rotate:360},transition:{duration:1,repeat:Infinity,ease:\"linear\"},children:/*#__PURE__*/_jsx(\"circle\",{cx:\"50\",cy:\"50\",r:\"35\",fill:\"none\",stroke:loadingColor,strokeWidth:\"10\",strokeLinecap:\"round\",strokeDasharray:\"164.9 56.9\"})});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Spinner\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Spainner.map","/*\n * Spainner\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/xjkhQV5Ve1Xnoo6Rj6Wd/M8tWzxBSuuC9SbaaWGP1/Spainner.js\"\nexport { default } from \"https://framerusercontent.com/modules/xjkhQV5Ve1Xnoo6Rj6Wd/M8tWzxBSuuC9SbaaWGP1/Spainner.js\"\n","import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import Spainner from\"https://framer.com/m/Spainner-9KnC2N.js@M8tWzxBSuuC9SbaaWGP1\";const useButtonStore=createStore({loadingId:null});export default function PlanBuyButton(props){const[store,setStore]=useButtonStore();const timerRef=useRef(null);const controllerRef=useRef(null);const{text,price_id,plan,page,textColor,font,fontSize,background,padding,boxShadow,border,borderRadius}=props;const isLoading=store.loadingId===plan;const handleClickBuyPlanButton=async()=>{setStore({loadingId:plan});const storageName=`Track_${page}_${plan}`;const storagePlan=sessionStorage.getItem(storageName);if(storagePlan!==\"true\"){sessionStorage.setItem(storageName,\"true\");window.fbq(\"track\",\"InitiateCheckout\");window.fbq(\"track\",\"SKU_CLICK\",{plan,page});window.gtag(\"event\",\"click_plan\",{plan,page});}if(isLoading)return;const session_url=await getCheckoutUrl();sessionStorage.removeItem(storageName);window.location.href=session_url;};const getCheckoutUrl=async()=>{controllerRef.current?.abort();controllerRef.current=new AbortController;const url=\"https://ingetin-langgraph-602223151053.us-central1.run.app\";let cancel_url=\"\";switch(page){case\"Home_Page\":cancel_url=\"/\";break;case\"Landing_Page\":cancel_url=\"/landing-page\";break;case\"Landing_V1_N\":cancel_url=\"/landing-v1-n\";break;case\"Landing_V1_9o\":cancel_url=\"/landing-v1-9o\";break;case\"Landing_V1_5o\":cancel_url=\"/landing-v1-9o\";break;case\"Landing_V2.0\":cancel_url=\"/landing-v2\";break;}try{const clientId=await getGaClientId();const response=await fetch(`${url}/api/checkout/session`,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({price_id:price_id,cancel_url:`https://ingetin.ai${cancel_url}`,client_id:clientId,page:cancel_url}),signal:controllerRef.current.signal});const{checkout_url}=await response.json();return checkout_url;}catch(error){if(error.name!==\"AbortError\"){console.error(error);}}finally{setStore(current=>({loadingId:current.loadingId===plan?null:current.loadingId}));}};const getGaClientId=()=>{return new Promise(resolve=>{if(typeof window===\"undefined\"||typeof window.gtag!==\"function\"){resolve(null);return;}let settled=false;const timer=window.setTimeout(()=>{if(!settled){settled=true;resolve(null);}},1500);window.gtag(\"get\",\"G-HZF9JBZ9C1\",\"client_id\",clientId=>{if(settled)return;settled=true;window.clearTimeout(timer);resolve(clientId||null);});});};return /*#__PURE__*/_jsxs(\"div\",{id:plan,\"data-framer-name\":\"Price Buy\",style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:12,color:textColor,background,padding,boxShadow,textAlign:\"center\",fontSize,...border,borderRadius,fontFamily:\"Instrument Sans\",...font,cursor:\"pointer\"},onClick:handleClickBuyPlanButton,children:[isLoading?/*#__PURE__*/_jsx(Spainner,{loadingColor:textColor}):null,/*#__PURE__*/_jsx(\"p\",{style:{margin:0},children:text})]});}addPropertyControls(PlanBuyButton,{text:{type:ControlType.String,defaultValue:\"Default\"},price_id:{type:ControlType.String},plan:{type:ControlType.String,defaultValue:\"Pro_Monthly\"},page:{type:ControlType.String},textColor:{type:ControlType.Color,defaultValue:\"#2E2F35\"},font:{type:ControlType.Font},fontSize:{type:ControlType.String},background:{type:ControlType.String,defaultValue:\"linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.01) 100%)\"},padding:{type:ControlType.Padding},boxShadow:{type:ControlType.BoxShadow},border:{type:ControlType.Border},borderRadius:{type:ControlType.BorderRadius}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PlanBuyButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PlanBuyButton.map"],"mappings":"6QAA8E,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,MAAM,OAAO,OAAO,CAAC,GAAG,EAAU,MAAM,GAAG,EAAS,CAAC,EAChI,EAAW,OAAO,GAAS,SAAS,OAAO,OAAO,CAAC,GAAG,EAAO,CAAC,CAAC,EAC7D,EAAa,IAAI,IACjB,EAAc,GAAU,CAC3B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAW,EAAE,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