{"version":3,"file":"Paddle.BLHlQeB0.mjs","names":[],"sources":["https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/v93KVF89fhpaI7Irj3uy/eSoOD0CLfAawknmM9Mlf/Paddle.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","import{jsx as _jsx}from\"react/jsx-runtime\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{useEffect}from\"react\";function isDev(){return window.location.host!==\"motion.dev\";}const referralKey=\"motion-plus-referral\";if(typeof window!==\"undefined\"){const urlParams=new URLSearchParams(window.location.search);const referral=urlParams.get(\"referral\");if(referral){localStorage.setItem(referralKey,referral);}}function openStripe(devId,prodId){return()=>{const id=isDev()?devId:prodId;window.location.assign(\"https://buy.stripe.com/\"+id);};}function openPaddle(devId,prodId,successUrl=\"https://motion.dev/sponsor/success\"){return()=>{if(typeof window.Paddle===\"undefined\"){return;}const items=[{priceId:isDev()?devId:prodId,quantity:1}];window.Paddle.Checkout.open({settings:{displayMode:\"overlay\",theme:\"dark\",successUrl},items,customData:{referralPath:localStorage.getItem(referralKey)}});};}const useState=createStore({type:null});let isCheckingType=false;function useCheckoutType(){return\"paddle\";const[state,setState]=useState();useEffect(()=>{if(state.status!==null||isCheckingType)return;isCheckingType=true;fetch(\"https://api.motion.dev/pricing\").then(res=>res.json()).then(({useStripe})=>{setState({type:useStripe?\"stripe\":\"paddle\"});}).catch(()=>{setState({type:\"paddle\"});});},[state]);return state.status;}export function withMotionPlusCheckout(Component){return props=>{let action=()=>null;const checkoutType=useCheckoutType();if(checkoutType===\"paddle\"){action=openPaddle(\"pri_01jd2ffprfsnjyefy3j5ba6wc9\",\"pri_01jd2ey8hv33gvmtpy916bkb44\",\"https://motion.dev/plus/success\");}else if(checkoutType===\"stripe\"){action=openStripe(\"test_8wMcOc6RH9qA45GeUU\",\"6oE2940iTeatcBa6or\");}return /*#__PURE__*/_jsx(Component,{...props,onClick:action});};}export function withMotionPlusTeamCheckout(Component){return props=>{let action=()=>null;const checkoutType=useCheckoutType();if(checkoutType===\"paddle\"){action=openPaddle(\"pri_01jd2ffprfsnjyefy3j5ba6wc9\",\"pri_01jedm91jawc9j60yw8k0xk9kw\",\"https://motion.dev/plus/success\");}else if(checkoutType===\"stripe\"){action=openStripe(\"test_bIY6pOfod46geKk7st\",\"aEU6pkc1B5DX0SseUW\");}return /*#__PURE__*/_jsx(Component,{...props,onClick:action});};}export function withPersonalCheckout(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,onClick:openPaddle(\"pri_01j93jgdh7hxrrnm414psqkpdx\",\"pri_01j93hw4jax328q8gspzx64emp\")});};}export function withEnthusiastCheckout(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,onClick:openPaddle(\"pri_01j93jh5tgxkczechr0b7mr7j5\",\"pri_01j93hwr0095tx8tnac8cssq2p\")});};}export function withSmallBusinessCheckout(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,onClick:openPaddle(\"pri_01j93jhzyskw69063hta2bgfrk\",\"pri_01j93j1ebj2yz5kpxg3ky6xecc\")});};}export function withBusinessCheckout(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,onClick:openPaddle(\"pri_01j93jjhmkh3zxvzqfkeehv9nq\",\"pri_01j93j2crj8xxvak1tyx50268k\")});};}export function withPlatinumCheckout(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,onClick:openPaddle(\"pri_01jcg0x4tz44mww7w6y8j6kndb\",\"pri_01jcg0zkb74vve0q592fxgs51e\")});};}export function withSetPaddleReferral(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,onPointerDown:()=>{localStorage.setItem(referralKey,window.location.pathname);}});};}export function withSetPaddleReferralHeader(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,onPointerDown:()=>{localStorage.setItem(referralKey,\"Site header at \"+window.location.pathname);}});};}export function withSetPaddleReferralFooter(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,onPointerDown:()=>{localStorage.setItem(referralKey,\"Site footer at \"+window.location.pathname);}});};}export function withSetPaddleReferralUpsell(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,onPointerDown:()=>{localStorage.setItem(referralKey,\"Upsell at \"+window.location.pathname);}});};}export function withSetPaddleReferralExclusive(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,onPointerDown:()=>{localStorage.setItem(referralKey,\"Motion+ Exclusive badge at \"+window.location.pathname);}});};}export function withSetPaddleReferralHomepage(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,onPointerDown:()=>{localStorage.setItem(referralKey,\"Motion+ block on homepage\");}});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withSmallBusinessCheckout\":{\"type\":\"reactHoc\",\"name\":\"withSmallBusinessCheckout\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withBusinessCheckout\":{\"type\":\"reactHoc\",\"name\":\"withBusinessCheckout\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMotionPlusTeamCheckout\":{\"type\":\"reactHoc\",\"name\":\"withMotionPlusTeamCheckout\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMotionPlusCheckout\":{\"type\":\"reactHoc\",\"name\":\"withMotionPlusCheckout\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSetPaddleReferralHomepage\":{\"type\":\"reactHoc\",\"name\":\"withSetPaddleReferralHomepage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withEnthusiastCheckout\":{\"type\":\"reactHoc\",\"name\":\"withEnthusiastCheckout\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSetPaddleReferralHeader\":{\"type\":\"reactHoc\",\"name\":\"withSetPaddleReferralHeader\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSetPaddleReferralExclusive\":{\"type\":\"reactHoc\",\"name\":\"withSetPaddleReferralExclusive\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSetPaddleReferral\":{\"type\":\"reactHoc\",\"name\":\"withSetPaddleReferral\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSetPaddleReferralFooter\":{\"type\":\"reactHoc\",\"name\":\"withSetPaddleReferralFooter\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPersonalCheckout\":{\"type\":\"reactHoc\",\"name\":\"withPersonalCheckout\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSetPaddleReferralUpsell\":{\"type\":\"reactHoc\",\"name\":\"withSetPaddleReferralUpsell\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPlatinumCheckout\":{\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