{"version":3,"file":"Buttons.FD3JAXJs.mjs","names":["useStore","useState"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/zUXmPjA2FvuC0Rtmad60/1tqwTBqnluyAlkq1tzIZ/Analytics.js","https:/framerusercontent.com/modules/gKio7v6aeg3qMR2hngca/fXy1jRwC8Vf2sY0FTfqB/Buttons.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","// Note: use in case a/b test\nexport function getExperimentVariant(){return localStorage.getItem(\"landing_variant\");}export async function openLinkWithAttribution(link){const currentUrlParams=new URLSearchParams(window.location.search);const amplitudeParams=getAmplitudeParams();const allParams=new URLSearchParams;currentUrlParams.forEach((value,key)=>{allParams.append(key,value);});amplitudeParams.forEach((value,key)=>{allParams.append(key,value);});const params=allParams.toString();const destinationUrl=`${link}${params?\"?\"+params:\"\"}`;console.debug(`Updated destinationUrl: ${destinationUrl}`);window.location.href=destinationUrl;}export async function logClick(){logPlausibleEvent(\"Click: Onboarding\");logAmplitudeEvent(\"onboarding_clicked\");await sleep(200)// Wait a bit before redirect\n;}function logPlausibleEvent(eventName){if(typeof plausible===\"function\"){plausible(eventName);console.debug(`Log plausible event: ${eventName}`);}else{console.warn(`No plausible instance`);}}function logAmplitudeEvent(eventName,eventProperties){const amplitude=window.amplitude;if(amplitude&&typeof amplitude===\"object\"){amplitude.track(eventName,eventProperties);amplitude.flush();console.debug(`Log amplitude event: ${eventName}`,eventProperties);}else{console.warn(`No amplitude instance`);}}function getAmplitudeParams(){const newParams=new URLSearchParams;const amplitude=window.amplitude;if(amplitude&&typeof amplitude===\"object\"){const deviceId=amplitude.getDeviceId();const sessionId=amplitude.getSessionId();if(deviceId){console.log(`Amplitude deviceId: ${deviceId}`);newParams.set(\"ampDeviceId\",deviceId);}else{console.warn(`No amplitude deviceId`);}if(sessionId){console.log(`Amplitude sessionId: ${sessionId}`);newParams.set(\"ampSessionId\",sessionId.toString());}else{console.warn(`No amplitude sessionId`);}}else{console.warn(`No amplitude instance`);}return newParams;}function sleep(ms){return new Promise(resolve=>setTimeout(resolve,ms));}\nexport const __FramerMetadata__ = {\"exports\":{\"getExperimentVariant\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"logClick\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"openLinkWithAttribution\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Analytics.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{logClick,openLinkWithAttribution}from\"https://framerusercontent.com/modules/zUXmPjA2FvuC0Rtmad60/1tqwTBqnluyAlkq1tzIZ/Analytics.js\";// Learn more: https://www.framer.com/developers/overrides/\nconst useStore=createStore({is_pronunciation:false,is_grammar:false,is_fluency:false,is_vocabulary:false,is_any:false});export function withPronunciation(Component){return props=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{...props,variant:store.is_pronunciation?\"Selected\":\"Default\",onClick:()=>setStore({is_pronunciation:!store.is_pronunciation})});};}export function withGrammar(Component){return props=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{...props,variant:store.is_grammar?\"Selected\":\"Default\",onClick:()=>setStore({is_grammar:!store.is_grammar})});};}export function withFluency(Component){return props=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{...props,variant:store.is_fluency?\"Selected\":\"Default\",onClick:()=>setStore({is_fluency:!store.is_fluency})});};}export function withVocabulary(Component){return props=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{...props,variant:store.is_vocabulary?\"Selected\":\"Default\",onClick:()=>setStore({is_vocabulary:!store.is_vocabulary})});};}// 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// }\nexport function withSubmitButton(Component){return props=>{const[store,setStore]=useStore();const isAny=store.is_pronunciation||store.is_grammar||store.is_fluency||store.is_vocabulary;const handleClick=async(e,link)=>{e.preventDefault();logClick();openLinkWithAttribution(link);};return /*#__PURE__*/_jsx(Component,{...props,variant:isAny?\"White\":\"Invisible\",onClick:e=>handleClick(e,props.link)});};}export function withLogClick(Component){return props=>{const handleClick=async(e,link)=>{e.preventDefault();logClick();openLinkWithAttribution(link);};return /*#__PURE__*/_jsx(Component,{...props,onClick:e=>handleClick(e,props.link)});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withLogClick\":{\"type\":\"reactHoc\",\"name\":\"withLogClick\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withVocabulary\":{\"type\":\"reactHoc\",\"name\":\"withVocabulary\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPronunciation\":{\"type\":\"reactHoc\",\"name\":\"withPronunciation\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSubmitButton\":{\"type\":\"reactHoc\",\"name\":\"withSubmitButton\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withGrammar\":{\"type\":\"reactHoc\",\"name\":\"withGrammar\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFluency\":{\"type\":\"reactHoc\",\"name\":\"withFluency\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"gMAA8E,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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