{"version":3,"file":"tracking_utils.DZgMEMsK.mjs","names":["useState","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/6UtPpKQ4XWQbVUZ8TCXH/PjHKReg11cggnAzUENNW/useFetch.js","https:/framerusercontent.com/modules/RoyLn3Rsr2xd0OGTHlbC/gQSAKBSdfZpN3TosPB9Y/tracking_utils.js"],"sourcesContent":["import{useCallback,useMemo,useState}from\"react\";export function useFetch({urlPath,method}){const[data,setData]=useState(null);const[status,setStatus]=useState(\"uninitialized\");const rootUrl=useMemo(()=>{if(typeof window===\"undefined\"){return;}const hostname=window.location.hostname;const isProd=hostname.includes(\"www.rocketloans.com\");if(isProd){return\"https://www.rocketloans.com/api\";}return\"https://qa2.rockloans.com/api\";},[]);const trigger=useCallback(async payload=>{const fullUrl=`${rootUrl}${urlPath}`;const body=payload?JSON.stringify(payload):undefined;try{const results=await fetch(fullUrl,{method,headers:{...payload&&{\"Content-Type\":\"application/json\"},Accept:\"application/json\"},body});if(results.ok){const resultsData=await results.json();setData(resultsData);setStatus(\"success\");return resultsData;}throw new Error(`Error when fetching`);}catch(err){console.error(`${err}`);throw new Error(`${err}`);}},[rootUrl,method,urlPath]);return{data,trigger,status};}\nexport const __FramerMetadata__ = {\"exports\":{\"useFetch\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./useFetch.map","/**\n * @description Get properties for a page view event\n */export function getPageViewProperties(){const params=new URLSearchParams(window.location.search);return{page_path:window.location.pathname,page_domain:window.location.hostname,page_url:window.location.href,referrer:document.referrer,utm_campaign:params.get(\"utm_campaign\")||null,utm_content:params.get(\"utm_content\")||null,utm_medium:params.get(\"utm_medium\")||null,utm_source:params.get(\"utm_source\")||null,utm_term:params.get(\"utm_term\")||null,utm_audience:params.get(\"utm_audience\")||null};}/**\n * @description Get the page context object, sent in all event requests in context.page\n */export function getPageContext(){return{pathname:window.location.pathname,referrer:document.referrer,search:window.location.search,title:document.title,url:window.location.href};}/**\n * @description Get a context object for any event\n */export function getEventContext(){const pageContext=getPageContext();return{timestamp:String(new Date().getTime()),page:pageContext};}/**\n * @description Send a click event to FullStory\n */export function sendFullstoryButtonClickEvent(button_name){const buttonName=button_name.toUpperCase();if(window.FS){window.FS(\"trackEvent\",{name:buttonName,properties:{event_name:\"CLICK\",page:{path:window.location.pathname}}});}else{console.log(\"FULLSTORY: SDK is not available.\");}}export const getCookie=name=>{const cookies=document.cookie.split(\"; \");const targetCookie=cookies.find(row=>row.startsWith(`${name}=`));return targetCookie?targetCookie.split(\"=\")[1]:null;};\nexport const __FramerMetadata__ = {\"exports\":{\"getEventContext\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getPageContext\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getPageViewProperties\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"sendFullstoryButtonClickEvent\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getCookie\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./tracking_utils.map"],"mappings":"gIAAgD,SAAgB,EAAS,CAAC,UAAQ,UAAQ,CAAC,GAAK,CAAC,EAAK,GAASA,EAAS,KAAK,CAAM,CAAC,EAAO,GAAWA,EAAS,gBAAgB,CAAO,EAAQC,MAAY,CAAI,GAAO,IAAS,OAAuK,OAAnI,EAAO,SAAS,SAA+B,SAAS,sBAAsB,CAAkB,kCAAyC,iCAAkC,EAAE,CAAC,CAAogB,MAAM,CAAC,OAAK,QAAjgBC,EAAY,KAAM,IAAS,CAAC,IAAM,EAAQ,GAAG,IAAU,IAAgB,EAAK,EAAQ,KAAK,UAAU,EAAQ,CAAC,IAAA,GAAU,GAAG,CAAC,IAAM,EAAQ,MAAM,MAAM,EAAQ,CAAC,SAAO,QAAQ,CAAC,GA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