{"version":3,"file":"PostcodeFieldOverride.Cn242pFm.mjs","names":["__legacyOverrideHOC_DataObserverContext","_jsx","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/V8SYnICIksXalRgolohy/uY5vPsOnV49wdLamGuLs/PostcodeErrorOverride.js","https:/framerusercontent.com/modules/7SvWmzCpho3KPuLiJflK/kCqbeE5nCk99ZhQdQ6vn/PostcodeFieldOverride.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useForm}from\"https://framerusercontent.com/modules/pAKpEYfV0qPdAFNu0stc/kV7PBubgHCWaIn5RAKQI/FormStore.js\";export function PostcodeErrorMessage(props){const{fields}=useForm();const{status,error,touched}=fields.postcode;const isInvalid=status===\"invalid\"&&touched;const isValid=status===\"valid\";const isOutside=status===\"outside\"&&touched;// 1️⃣ Determine text\nconst text=isValid?props.validText||\"✅ Gute Nachrichten! Wir k\\xf6nnen Sie in Ihrer Region beliefern.\":isInvalid?props.invalidText||error:isOutside?props.outsideText||\"ℹ️ Wir sind derzeit in Ihrer Region noch nicht aktiv.\":\"\";// 2️⃣ Determine color\nconst color=isValid?props.validColor||\"#2d5a27\"// green\n:isInvalid?props.invalidColor||\"#e53e3e\"// red\n:isOutside?props.outsideColor||\"#e6a700\"// amber/orange info\n:\"transparent\";return{text};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withPostcodeErrorMessage(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...PostcodeErrorMessage(props)});};}withPostcodeErrorMessage.displayName=\"PostcodeErrorMessage\";\nexport const __FramerMetadata__ = {\"exports\":{\"PostcodeErrorMessage\":{\"type\":\"override\",\"name\":\"PostcodeErrorMessage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPostcodeErrorMessage\":{\"type\":\"reactHoc\",\"name\":\"withPostcodeErrorMessage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import{useForm}from\"https://framerusercontent.com/modules/pAKpEYfV0qPdAFNu0stc/kV7PBubgHCWaIn5RAKQI/FormStore.js\";import{validatePostcode,triggerShake}from\"https://framerusercontent.com/modules/2ye8TUk5kux4ft44zSAe/zxSvEqN0p34uVEdeqXN3/Utils.js\";export function PostcodeFieldOverride(){const{setField}=useForm();return{onChange:e=>{const val=e.target.value.trim();setField(\"postcode\",\"value\",val);// 1️⃣ Empty: reset to default\nif(!val){setField(\"postcode\",\"status\",\"default\");setField(\"postcode\",\"error\",\"\");return;}// 2️⃣ Not 4 digits → invalid\nconst isFourDigits=/^\\d{4}$/.test(val);if(!isFourDigits){setField(\"postcode\",\"status\",\"invalid\");setField(\"postcode\",\"error\",\"❌ Keine g\\xfcltige Postleitzahl\");triggerShake(\"Postcode\");return;}// 3️⃣ Check service area\nif(!validatePostcode(val)){// Outside area → submit allowed but marked as outside\nsetField(\"postcode\",\"status\",\"outside\");setField(\"postcode\",\"error\",\"ℹ️ Wir sind derzeit in Ihrer Region noch nicht aktiv.\");// 🔹 No shake for outside, because it's still submit-able\n}else{// Valid postcode\nsetField(\"postcode\",\"status\",\"valid\");setField(\"postcode\",\"error\",\"\");}},onBlur:()=>{setField(\"postcode\",\"touched\",true);}};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withPostcodeFieldOverride(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...PostcodeFieldOverride(props)});};}withPostcodeFieldOverride.displayName=\"PostcodeFieldOverride\";\nexport const __FramerMetadata__ = {\"exports\":{\"PostcodeFieldOverride\":{\"type\":\"override\",\"name\":\"PostcodeFieldOverride\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPostcodeFieldOverride\":{\"type\":\"reactHoc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