{"version":3,"file":"ProgramSuccessRedirect.c_OODFya.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/ZNFdUH9I2SIEtS8glvzK/tLEtzvumxPMK0KiMghyq/ProgramSuccessRedirect.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Runs only in the native submit button's successful state.\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ProgramSuccessRedirect(props){const{enabled=false,audience=\"formacion\"}=props;const isStatic=useIsStaticRenderer();const redirected=useRef(false);useEffect(()=>{if(isStatic||typeof window===\"undefined\")return;if(!enabled){redirected.current=false;return;}if(redirected.current)return;if(audience!==\"formacion\"&&audience!==\"curso\")return;const formPath=`/${audience}/formulario`;if(window.location.pathname.replace(/\\/+$/,\"\")!==formPath)return;// Responsive copies and remounts share one confirmation per submission.\n// The site's tracking script rearms this guard only on a new form submit.\nconst confirmed=Reflect.get(window,\"__commindConfirmedSubmissionsV2\")??{};if(confirmed[audience])return;redirected.current=true;// Only the native form's successful state can create this receipt.\n// Keep personal details out of storage, URLs, and Meta parameters.\nconst eventId=window.crypto?.randomUUID?.()??`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;const createdAt=Date.now();confirmed[audience]={eventId,createdAt};Reflect.set(window,\"__commindConfirmedSubmissionsV2\",confirmed);try{window.sessionStorage.setItem(`commind:lead:pending:${audience}`,JSON.stringify({version:1,audience,eventId,createdAt}));}catch{// A successful request still reaches its confirmation if storage\n// is unavailable; tracking then fails closed to avoid false leads.\n}window.location.assign(audience===\"curso\"?\"/curso/success\":\"/formacion/success\");},[enabled,audience,isStatic]);return /*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{...props.style,position:\"relative\",width:1,height:1,opacity:0,pointerEvents:\"none\"}});}addPropertyControls(ProgramSuccessRedirect,{enabled:{type:ControlType.Boolean,title:\"Env\\xedo confirmado\",defaultValue:false},audience:{type:ControlType.Enum,title:\"Programa\",options:[\"formacion\",\"curso\"],optionTitles:[\"Formaci\\xf3n para psic\\xf3logos\",\"Curso p\\xfablico general\"],defaultValue:\"formacion\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ProgramSuccessRedirect\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProgramSuccessRedirect.map"],"mappings":"uMAIG,SAAwB,EAAuB,EAAM,CAAC,GAAK,CAAC,UAAQ,GAAM,WAAS,aAAa,EAAY,EAAS,EAAoB,EAAQ,EAAWA,EAAO,EAAK,EAM1D,OAN4D,MAAc,CAAC,GAAG,GAAiB,IAAS,OAAY,OAAO,GAAG,CAAC,EAAQ,CAAC,EAAW,QAAQ,GAAM,MAAO,CAA8B,GAA1B,EAAW,SAAkB,IAAW,aAAa,IAAW,QAAQ,OAAO,IAAM,EAAS,IAAI,EAAS,aAAa,GAAG,EAAO,SAAS,SAAS,QAAQ,OAAO,EAAE,IAAI,EAAS,OAE/c,IAAM,EAAU,QAAQ,IAAI,EAAO,iCAAiC,GAAG,CAAC,EAAE,GAAG,EAAU,GAAU,OAAO,EAAW,QAAQ,GAE3H,IAAM,EAAQ,EAAO,QAAQ,aAAa,GAAG,GAAG,KAAK,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,IAAU,EAAU,KAAK,IAAI,EAAE,EAAU,GAAU,CAAC,UAAQ,WAAS,EAAE,QAAQ,IAAI,EAAO,kCAAkC,CAAS,EAAE,GAA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