{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/nOtVN52ui0CJLSiOQs2R/5fvLOKFpwYjO3bt1pgOw/FormOverride.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef}from\"react\";/**\n * A factory that creates a Higher-Order Component for form submission analytics.\n * @param eventName The name of the analytics event to capture.\n * @param captureFn The function to call for capturing the event (e.g., posthog.capture).\n * @returns A Higher-Order Component.\n */function createWithFormSubmitAnalytics(eventName,captureFn){return function withFormAnalytics(Component){const WrappedComponent=/*#__PURE__*/forwardRef((props,ref)=>{const internalRef=useRef(null);// Use the forwarded ref from the parent, or the internal one as a fallback\nconst formRef=ref||internalRef;useEffect(()=>{const form=formRef.current;if(!form)return;const handleSubmit=event=>{// event.preventDefault()\nconsole.log(formRef.current);const formData=new FormData(form);const properties=Object.fromEntries(formData.entries());// pass the injected function and event name to Posthog\ncaptureFn(eventName,properties);};form.addEventListener(\"submit\",handleSubmit,{capture:true});return()=>form.removeEventListener(\"submit\",handleSubmit,{capture:true});},[formRef])// Effect depends on the ref\n;return /*#__PURE__*/_jsx(Component,{...props,ref:formRef});});WrappedComponent.displayName=`withFormAnalytics(${Component.displayName||Component.name})`;return WrappedComponent;};}//----------------------------------------------\n//----------------------------------------------\n// 1. Define the capture function once, isolating the global dependency.\nconst posthogCapture=(eventName,properties)=>{// This check ensures 'posthog' is only accessed if it exists on the window.\nif(typeof posthog!==\"undefined\"){// NOTE: the email field is case sensitive. The email field must have the name \"email\"\nposthog.identify(crypto.randomUUID(),{...properties,eventName,browserLanguage:navigator.language});posthog.capture(eventName,{$set:properties});}};// 2. Create your specific HOCs by calling the factory.\n/**\n * Wraps a component to track form submissions for \"ezGoal_form-submit\".\n * @param Component The React component to wrap.\n * @returns The wrapped component with analytics.\n */export function withPostHogSubmit(Component){return createWithFormSubmitAnalytics(\"ezGoal_form-submit\",posthogCapture)(Component);}/**\n * Wraps a component to track form submissions for \"homepage-subscribe-form-submitted\".\n * @param Component The React component to wrap.\n * @returns The wrapped component with analytics.\n */export function withHomepageSubscribeSubmit(Component){return createWithFormSubmitAnalytics(\"homepage_subscribe-form-submitted\",posthogCapture)(Component);}/**\n * Wraps a component to track form submissions for \"homepage-contact-form-submitted\".\n * @param Component The React component to wrap.\n * @returns The wrapped component with analytics.\n */export function withHomepageContactSubmit(Component){return createWithFormSubmitAnalytics(\"homepage_contact-form-submitted\",posthogCapture)(Component);}export function withEnhancedHomepageContactSubmit(Component){return withHomepageContactSubmit(withEnterSubmit(withClickSubmit(Component)));}export function withHomepageUsecaseSubmit(Component){return createWithFormSubmitAnalytics(\"homepage_usecase-form-submitted\",posthogCapture)(Component);}export function withContactUsSubmit(Component){return createWithFormSubmitAnalytics(\"contact-us_form-submitted\",posthogCapture)(Component);}// ----------------------------------------------------\n// --- NEW OVERRIDE FOR TEXTAREA 'ENTER' KEY SUBMISSION ---\n// Apply this override ONLY to the TextArea layer.\nexport const withEnterSubmit=Component=>{return /*#__PURE__*/forwardRef((props,ref)=>{const handleKeyDown=event=>{// Submit on 'Enter' only, exclude 'Shift + Enter'\nif(event.key===\"Enter\"&&!event.shiftKey){// 1. Prevent the default action (inserting a new line).\n// event.preventDefault()\n// 2. Find the parent form and programmatically request a submission.\n// This triggers a proper 'submit' event that both our analytics\n// override and Framer's native system can listen to.\nconst form=event.currentTarget.closest(\"form\");if(form){form.requestSubmit();}}// Call any existing onKeyDown prop to avoid breaking other functionality.\nif(typeof props.onKeyDown===\"function\"){props.onKeyDown(event);}};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onKeyDown:handleKeyDown});});};/**\n * USE THIS ON THE SUBMIT BUTTON\n * This override intercepts the button's click event to ensure a native\n * form submission is triggered, allowing for HTML5 validation and\n * firing 'submit' event listeners.\n */export const withClickSubmit=Component=>{return props=>{const handleClick=event=>{// 1. Stop Framer's default click handling.\n// event.preventDefault();\n// event.stopPropagation();\n// 2. Find the parent form.\nconst form=event.currentTarget.closest(\"form\");// 3. Trigger a native, validating submit event.\n// requestSubmit() respects 'required' fields.\nif(form){form.requestSubmit();}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};};\nexport const __FramerMetadata__ = {\"exports\":{\"withEnterSubmit\":{\"type\":\"reactHoc\",\"name\":\"withEnterSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withContactUsSubmit\":{\"type\":\"reactHoc\",\"name\":\"withContactUsSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPostHogSubmit\":{\"type\":\"reactHoc\",\"name\":\"withPostHogSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHomepageUsecaseSubmit\":{\"type\":\"reactHoc\",\"name\":\"withHomepageUsecaseSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withClickSubmit\":{\"type\":\"reactHoc\",\"name\":\"withClickSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withEnhancedHomepageContactSubmit\":{\"type\":\"reactHoc\",\"name\":\"withEnhancedHomepageContactSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHomepageContactSubmit\":{\"type\":\"reactHoc\",\"name\":\"withHomepageContactSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHomepageSubscribeSubmit\":{\"type\":\"reactHoc\",\"name\":\"withHomepageSubscribeSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FormOverride.map"],
  "mappings": "uGAKG,SAASA,EAA8BC,EAAUC,EAAU,CAAC,OAAO,SAA2BC,EAAU,CAAC,IAAMC,EAA8BC,EAAW,CAACC,EAAMC,IAAM,CAAC,IAAMC,EAAYC,EAAO,IAAI,EAChMC,EAAQH,GAAKC,EAAY,OAAAG,EAAU,IAAI,CAAC,IAAMC,EAAKF,EAAQ,QAAQ,GAAG,CAACE,EAAK,OAAO,IAAMC,EAAaC,GAAO,CACnH,QAAQ,IAAIJ,EAAQ,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AK,cAAc,CAAG,CAC3E,OAAOJ,EAAM,WAAY,YAAYA,EAAM,UAAUG,CAAK,CAAG,CAA8E,CAAC,CAAG",
  "names": ["createWithFormSubmitAnalytics", "eventName", "captureFn", "Component", "WrappedComponent", "Y", "props", "ref", "internalRef", "pe", "formRef", "ue", "form", "handleSubmit", "event", "formData", "properties", "p", "posthogCapture", "navigator", "withPostHogSubmit", "withHomepageSubscribeSubmit", "withHomepageContactSubmit", "withHomepageUsecaseSubmit", "Component", "createWithFormSubmitAnalytics", "posthogCapture", "withEnterSubmit", "Component", "Y", "props", "ref", "p", "event", "form"]
}
