{"version":3,"file":"MarketoHiddenInputs.C9oaJsGU.mjs","names":["useRef","Cookies"],"sources":["https:/framerusercontent.com/modules/osexi9V3dDpzb62c5ocT/mBrs9Yi7ANRmuiMvPldS/MarketoHiddenInputs.js"],"sourcesContent":["//MarketoHiddenInputs\n//updated October 15, 2026\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useLayoutEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import Cookies from\"js-cookie\";// Click IDs cleared once a form has been submitted, so the next organic\n// submission from this browser doesn't resend a click the visitor didn't make.\n// _fbc is deliberately absent - it belongs to Meta's pixel, not to us.\nconst CLICK_ID_COOKIES=[\"gclid\",\"fbclid\",\"msclkid\",\"linkclid\"];/**\n * The domain our cookies are scoped to, mirroring MarketoCookieTracker.\n * Duplicated rather than imported because Framer code components cannot\n * import from one another. Removing a cookie only works when the domain\n * matches the one it was written with.\n */const getCookieDomain=()=>{if(typeof window===\"undefined\")return undefined;const{hostname}=window.location;for(const domain of[\"podium.com.au\",\"podium.com\"]){if(hostname===domain||hostname.endsWith(`.${domain}`)){return`.${domain}`;}}return undefined;};const getTimeStamp=()=>{const currentDate=new Date;return currentDate.toISOString();};const getOrCreatePrefillToken=()=>{if(typeof window===\"undefined\")return\"\";if(typeof crypto?.randomUUID!==\"function\")return\"\";let existing=\"\";try{existing=sessionStorage.getItem(\"podiumPrefillCid\")||\"\";}catch(_){}if(existing)return existing;let value=crypto.randomUUID();try{sessionStorage.setItem(\"podiumPrefillCid\",value);}catch(_){}return value;};const getData=({shouldLog,lastAssetUrl,lastOffer})=>{// Guard against SSR — navigator, location, and window are browser-only globals.\n// Hidden inputs have no meaningful server-side value; the submit handler\n// re-populates them client-side at submission time.\nif(typeof window===\"undefined\")return{};const searchParams=new URLSearchParams(window.location.search);const re={Ad_Spend_Data_IDs_Concatenated__c:Cookies.get(\"ad-spend-data\"),FBCLID__c:Cookies.get(\"_fbc\")||Cookies.get(\"fbclid\"),GACLIENTID__c:Cookies.get(\"_ga\")?.split(\".\")?.slice(-2)?.join(\".\"),GCLID__c:Cookies.get(\"gclid\"),LINKCLID__c:Cookies.get(\"linkclid\"),Last_Form_Submission_Time__c:getTimeStamp(),Last_Offer_URL__c:window.location.href,Referrer_URL__c:Cookies.get(\"Referrer_URL\"),MSCLKID__c:Cookies.get(\"msclkid\"),Partner_Account__c:searchParams.get(\"partner_id\")||searchParams.get(\"ptnrid\")||\"\",Referred_By_Code__c:Cookies.get(\"ssqt\"),// Fallback added: ~1 in 6 paid sessions arrive with no cookies available\n// (correlates with GA/session tracking failing to load). The campaign ID\n// is reliably present in the URL on those same sessions, so fall back to\n// it rather than silently dropping campaign attribution.\n// NOTE: only fall back to the SCID query param here (per Max) — this field\n// must be a real Salesforce Campaign Id (15/18-char), and utm_id is not\n// guaranteed to be one, so it's intentionally excluded from this fallback.\nSFDC_Campaign_IDs_Concatenated__c:Cookies.get(\"scid\")||searchParams.get(\"SCID\")||\"\",cookiesblocked:!navigator.cookieEnabled,// Left as-is per Will's guidance: this is meant to hold a first-touch\n// value. Falling back to the current URL would quietly turn it into a\n// last-touch value, so do not add a searchParams fallback here.\nfirstUTMMediumm:Cookies.get(\"first-utm-medium\"),uTMCampaignm:searchParams.get(\"utm_campaign\")||\"\",// Left as-is per Will's guidance — same first-touch concern as above,\n// needs manual review before adding any URL fallback.\nuTMMediumm:Cookies.get(\"utm-medium\"),// Fallback added per Max: utm_medium__c is not a first-touch field\n// (unlike firstUTMMediumm/uTMMediumm below), so it's safe to backfill\n// from the URL, consistent with the server-side logic in marketo.utils.ts.\nutm_medium__c:Cookies.get(\"utm_medium\")||searchParams.get(\"utm_medium\")||\"\",// Fallback added: same cookie-availability gap as SFDC_Campaign_IDs_Concatenated__c above.\nutmsource__c:Cookies.get(\"utm_source__c\")||Cookies.get(\"utm_source\")||searchParams.get(\"utm_source__c\")||searchParams.get(\"utm_source\")||\"\",utm_campaign__c:Cookies.get(\"utm_campaign__c\")||Cookies.get(\"utm_campaign\")||searchParams.get(\"utm_campaign__c\")||searchParams.get(\"utm_campaign\")||\"\",utm_content__c:Cookies.get(\"utm_content__c\")||Cookies.get(\"utm_content\")||searchParams.get(\"utm_content__c\")||searchParams.get(\"utm_content\")||\"\",utm_term__c:Cookies.get(\"utm_term__c\")||Cookies.get(\"utm_term\")||searchParams.get(\"utm_term__c\")||searchParams.get(\"utm_term\")||\"\",_mktoReferrer:window.location.href,SMS_Opt_in__c:\"TRUE\",Last_Asset_URL__c:lastAssetUrl,Last_Offer__c:lastOffer,cid:getOrCreatePrefillToken()};if(shouldLog)console.log(\"hidden fields\",re);return re;};/**\n * Renders hidden Marketo tracking fields and wires up two DOM-level hooks:\n *\n * 1. *Submit interceptor* (capture phase) — refreshes hidden input values\n *    synchronously just before Framer's own submit handler reads the form,\n *    avoiding React's async batching delay.\n *\n * 2. *Fetch interceptor* — wraps window.fetch to detect the form submission\n *    to Framer's forms API (/forms/v1/forms/<id>/submit) and, on that response:\n *    - reports the outcome to VWO Form Analytics:\n *      success (2xx) nls.formAnalysis.markSuccess, failure nls.formAnalysis.markFail\n *    - clears the click ID cookies on success, so the next organic submission\n *      from this browser doesn't resend a click the visitor didn't make\n *    Uses window.VWO = window.VWO || [] guard so it is safe when VWO\n *    has not yet loaded. Both hooks are torn down on unmount.\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function MarketoHiddenInputs(props){const{jsonStringify,shouldLog,lastAssetUrl,lastOffer}=props;const hasLastOfferCValue=Object.prototype.hasOwnProperty.call(props,\"lastOfferCValue\");const hasLastOffer=Object.prototype.hasOwnProperty.call(props,\"lastOffer\");const resolvedLastOffer=hasLastOfferCValue?props.lastOfferCValue??\"\":hasLastOffer?lastOffer??\"\":\"\";const data=getData({shouldLog,lastAssetUrl,lastOffer:resolvedLastOffer});// Tracks the most recently submitted form element so the fetch interceptor\n// can pass it to VWO without re-querying the DOM after submission.\nconst lastSubmittedFormRef=useRef(null);useLayoutEffect(()=>{// Refresh hidden input values synchronously just before the form submits,\n// using capture phase to run before Framer's own submit handler reads\n// the form. Direct DOM mutation avoids React's async batching delay.\nconst submitHandler=e=>{const form=e.target.closest(\"form\");if(!form)return;lastSubmittedFormRef.current=form;if(shouldLog){console.log(\"[MarketoHiddenInputs] form submit captured\",form);}const freshData=getData({shouldLog,lastAssetUrl,lastOffer:resolvedLastOffer});Object.entries(freshData).forEach(([key,value])=>{const input=form.querySelector(`input[name=\"${key}\"]`);if(input)input.value=String(value??\"\");});};document.addEventListener(\"submit\",submitHandler,{capture:true});return()=>{document.removeEventListener(\"submit\",submitHandler,{capture:true});};},[shouldLog,lastAssetUrl,resolvedLastOffer]);useLayoutEffect(()=>{if(typeof window===\"undefined\")return;const originalFetch=window.fetch;window.fetch=function(...args){const url=typeof args[0]===\"string\"?args[0]:args[0].url;const fetchPromise=originalFetch.apply(window,args);// Important for form redirect timing: never await here. Let the\n// original fetch promise flow unchanged to the caller, and run\n// analytics side-effects asynchronously.\nfetchPromise.then(response=>{if(shouldLog){console.log(\"[MarketoHiddenInputs] fetch intercepted\",url,response.status);}// Framer posts the form to its own API from the browser and\n// only then calls /api/marketo from a server-side webhook,\n// which this interceptor cannot see. Watching /api/marketo\n// meant none of the below ever ran.\nif(url.includes(\"/forms/v1/forms\")){const form=lastSubmittedFormRef.current;if(shouldLog){console.log(\"[MarketoHiddenInputs] form submit detected — ok:\",response.ok,\"form:\",form);}window.VWO=window.VWO||[];window.VWO.push([response.ok?\"nls.formAnalysis.markSuccess\":\"nls.formAnalysis.markFail\",form]);// Only on success - a failed submission has to keep the\n// click IDs so the visitor can try again.\nif(response.ok){const domain=getCookieDomain();CLICK_ID_COOKIES.forEach(name=>{Cookies.remove(name,{path:\"/\",domain});// Host-only leftovers from before cookies were\n// domain-scoped; a domain-scoped remove misses them.\nCookies.remove(name,{path:\"/\"});});}}}).catch(()=>{// Preserve native behavior — do not swallow or alter\n// errors from the original fetch promise.\n});return fetchPromise;};return()=>{window.fetch=originalFetch;};},[shouldLog]);return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\"},children:[jsonStringify&&/*#__PURE__*/_jsx(\"pre\",{style:{backgroundColor:\"white\",overflow:\"auto\",width:\"100%\",position:\"relative\"},children:JSON.stringify(data,null,2)}),Object.entries(data).map(([key,value],index)=>{return /*#__PURE__*/_jsx(\"input\",{type:\"hidden\",name:key,defaultValue:String(value??\"\")},index);})]});}addPropertyControls(MarketoHiddenInputs,{jsonStringify:{title:\"Display hidden inputs\",type:ControlType.Boolean,defaultValue:true},shouldLog:{title:\"console.log the data\",type:ControlType.Boolean,defaultValue:true},lastAssetUrl:{title:\"Last_Asset_URL__c value\",type:ControlType.String,defaultValue:\"/demo\"},lastOffer:{title:\"Last_Offer__c value\",type:ControlType.String,defaultValue:\"Demo Video: Platform\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MarketoHiddenInputs\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MarketoHiddenInputs.map"],"mappings":"kQA+CG,SAAwB,EAAoB,EAAM,CAAC,GAAK,CAAC,gBAAc,YAAU,eAAa,aAAW,EAAY,EAAmB,OAAO,UAAU,eAAe,KAAK,EAAM,iBAAiB,EAAQ,EAAa,OAAO,UAAU,eAAe,KAAK,EAAM,WAAW,EAAQ,EAAkB,EAAmB,EAAM,iBAAiB,GAAG,EAAa,GAAW,GAAG,GAAS,EAAK,EAAQ,CAAC,YAAU,eAAa,UAAU,CAAiB,CAAC,EAExb,EAAqBA,EAAO,IAAI,EAgB0C,OAhBxC,MAAoB,CAG5D,IAAM,EAAc,GAAG,CAAC,IAAM,EAAK,EAAE,OAAO,QAAQ,MAAM,EAAE,GAAG,CAAC,EAAK,OAAO,EAAqB,QAAQ,EAAQ,G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