{"version":3,"file":"TrackingEvent.DqlVo4AS.mjs","names":["React"],"sources":["https:/framerusercontent.com/modules/Mw3aZ3xVHFqwfCO7exyy/ksOa4w67j1KYVPclzm7k/TrackingEvent.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import React from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";// Create a shared store for managing state\nconst useStore=createStore({intialVariant:null});// Higher-order component to observe variant changes\nexport function TrackingEvent(Component){return props=>{const[store,setStore]=useStore();const targetNode=React.useRef(null);React.useEffect(()=>{// Callback function for MutationObserver\nconst callback=mutationsList=>{for(const mutation of mutationsList){if(mutation.type===\"attributes\"&&mutation.attributeName===\"data-framer-name\"){const newVariant=mutation.target.getAttribute(\"data-framer-name\");// Update the store with the new variant\nif(store.intialVariant!==newVariant){setStore({intialVariant:newVariant});// Trigger GTM event when the variant is \"Success\"\nif(newVariant===\"Success\"){console.log(\"Success variant detected! Triggering GTM event...\");if(typeof window!==\"undefined\"){window.dataLayer=window.dataLayer||[];window.dataLayer.push({event:\"order-form-submit\",timestamp:new Date().toISOString()});console.log(\"GTM Event: order-form-submit triggered.\");}window.scrollTo({top:0,behavior:\"smooth\"});}}}}};// Create a MutationObserver instance\nconst observer=new MutationObserver(callback);// Observer configuration: listen for attribute changes\nconst config={attributes:true,attributeFilter:[\"data-framer-name\"]};// Start observing the target node\nif(targetNode.current){setStore({initialVariant:targetNode.current.getAttribute(\"data-framer-name\")});observer.observe(targetNode.current,config);}// Cleanup the observer on component unmount\nreturn()=>{observer.disconnect();};},[]);// React.useEffect(() => {\n//     // Log the initial variant whenever it changes\n//     console.log(Current Variant in Store: ${store.intialVariant})\n// }, [store.intialVariant])\nreturn /*#__PURE__*/_jsx(Component,{ref:targetNode,...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"TrackingEvent\":{\"type\":\"reactHoc\",\"name\":\"TrackingEvent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TrackingEvent.map"],"mappings":"wLAEA,SAAgB,EAAc,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAM,GAAU,GAAU,CAAO,EAAWA,EAAM,OAAO,KAAK,CAW5H,OAX6H,EAAM,cAAc,CAIjJ,IAAM,EAAS,IAAI,iBAHJ,GAAe,CAAC,IAAI,IAAM,KAAY,EAAe,GAAG,EAAS,OAAO,cAAc,EAAS,gBAAgB,mBAAmB,CAAC,IAAM,EAAW,EAAS,OAAO,aAAa,mBAAmB,CAChN,EAAM,gBAAgB,IAAY,EAAS,CAAC,cAAc,EAAW,CAAC,CACtE,IAAa,YAAW,QAAQ,IAAI,oDAAoD,CAAW,IAAS,SAAa,EAAO,UAAU,EAAO,WAAW,EAAE,CAAC,EAAO,UAAU,KAAK,CAAC,MAAM,oBAAoB,UAAU,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,IAAI,0CAA0C,EAAE,EAAO,SAAS,CAAC,IAAI,EAAE,SAAS,SAAS,CAAC,KAC7S,CAG7C,OADG,EAAW,UAAS,EAAS,CAAC,eAAe,EAAW,QAAQ,aAAa,mBAAmB,CAAC,CAAC,CAAC,EAAS,QAAQ,EAAW,QADrH,CAAC,WAAW,GAAK,gBAAgB,CAAC,mBAAmB,CAAC,CAC8E,MACvI,CAAC,EAAS,YAAY,GAAK,EAAE,CAAC,CAIpB,EAAK,EAAU,CAAC,IAAI,EAAW,GAAG,EAAM,CAAC,yBAblB,IAAyB,IAAqE,CACnI,EAAS,EAAY,CAAC,cAAc,KAAK,CAAC"}