{"version":3,"file":"DataInput.DfbH40RC.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/Kuwa4LRQnmmppaTnEydr/hOjeEgRD7HbeoXLeV1zv/DataInput.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useState}from\"react\";import{HiddenComponentLabel}from\"https://framerusercontent.com/modules/DwWOdDzQZGCuvkNlbUjZ/hMz2wp3CWZkNwPJFGPgQ/FramerFormsShared.js\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n * @framerDisableUnlink\n */export default function DataInput(props){const{type}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[value,setValue]=useState(\"\");let text=\"\";switch(type){case\"url\":text=\"Current URL\";break;case\"utmTags\":text=\"UTM Tags\";break;case\"urlParameter\":text=`${props.urlParameter} URL Parameter`;break;case\"referrerUrl\":text=\"Referrer URL\";break;}useEffect(()=>{switch(type){case\"url\":setValue(window.location.href);break;case\"utmTags\":const utms={};const queryParams=new URLSearchParams(window.location.search);queryParams.forEach((value,key)=>{// Check if the key starts with 'utm_' (indicating it's a UTM parameter)\nif(key.startsWith(\"utm_\")){utms[key]=value;}});setValue(utms);break;case\"urlParameter\":setValue(new URLSearchParams(window.location.search).get(props.urlParameter)??\"\");break;case\"referrerUrl\":setValue(document.referrer);break;}},[type,props.urlParameter]);return /*#__PURE__*/_jsx(HiddenComponentLabel,{text:text,subtext:\"Hidden Field\",children:!isCanvas&&/*#__PURE__*/_jsx(\"div\",{style:{display:\"hidden\"},children:type==\"utmTags\"?value?Object.keys(value).map(key=>/*#__PURE__*/_jsx(\"input\",{type:\"hidden\",name:key,value:value[key],\"data-framerforms-no-prefill\":true})):null:/*#__PURE__*/_jsx(\"input\",{type:\"hidden\",name:props.name,value:value,\"data-framerforms-no-prefill\":true})})});}DataInput.displayName=\"URL Data Collector\";addPropertyControls(DataInput,{type:{type:ControlType.Enum,options:[\"url\",\"utmTags\",\"referrerUrl\",\"urlParameter\"],optionTitles:[\"Current URL\",\"UTM Tags\",\"Referrer URL\",\"URL Parameter\"],displaySegmentedControl:true,segmentedControlDirection:\"vertical\"},name:{type:ControlType.String,defaultValue:\"Data\",preventLocalization:true,hidden:props=>props.type==\"utmTags\"},urlParameter:{type:ControlType.String,defaultValue:\"\",placeholder:\"Parameter Name\",title:\"URL Param\",preventLocalization:true,hidden:props=>props.type!==\"urlParameter\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DataInput\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"mQAIG,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,QAAM,EAAY,EAAS,EAAa,QAAQ,IAAI,EAAa,OAAY,CAAC,EAAM,GAAUA,EAAS,EAAE,EAAM,EAAK,GAAG,OAAO,EAAP,CAAa,IAAI,MAAM,EAAK,cAAc,MAAM,IAAI,UAAU,EAAK,WAAW,MAAM,IAAI,eAAe,EAAK,GAAG,EAAM,aAAa,gBAAgB,MAAM,IAAI,cAAc,EAAK,eAAe,KAAM,CAC5G,OAD6G,MAAc,CAAC,OAAO,EAAP,CAAa,IAAI,MAAM,EAAS,EAAO,SAAS,IAAI,EAAE,MAAM,IAAI,UAAU,IAAM,EAAK,CAAC,EAAgE,IAAxC,gBAAgB,EAAO,SAAS,MAAkB,CAAC,CAAC,SAAS,EAAM,IAAM,CACjjB,EAAI,WAAW,MAAM,IAAG,EAAK,GAAK,EAAO,CAAC,EAAE,EAAS,CAAI,EAAE,MAAM,IAAI,eAAe,EAAS,IAAI,gBAAgB,EAAO,SAAS,MAAM,CAAC,CAAC,IAAI,EAAM,YAAY,GAAG,EAAE,EAAE,MAAM,IAAI,cAAc,EAAS,SAAS,QAAQ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