{"version":3,"file":"Front_db_Button.B_egfALD.mjs","names":["p"],"sources":["https:/framerusercontent.com/modules/BI5yuKARRPQaLPuvPUJx/yCIj5Wafmbqzmt5joMfA/Front_db_Button.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import mixpanel from\"mixpanel-browser\";// Mixpanel 초기화\nmixpanel.init(\"9c4217481189fc04533c750772297e42\",{debug:true,track_pageview:true,persistence:\"localStorage\",record_sessions_percent:100});export function SubmitButton(props){const{text,middleText,width,height,backgroundColor,textColor}=props;const getSearchParams=()=>{const searchParamsObject={};const params=new URLSearchParams(window.location.search);for(let p of params){const key=p[0];const value=p[1];searchParamsObject[key]=value;}return searchParamsObject;};const[isSubmitted,setIsSubmitted]=React.useState(false);const handleClick=async()=>{try{const name=sessionStorage.getItem(\"name\")||\"\";const phone=sessionStorage.getItem(\"phone\")||\"\";const category=sessionStorage.getItem(\"category\")||\"\";const businessNumber=sessionStorage.getItem(\"businessNumber\")||\"\";const selectedFreebie=sessionStorage.getItem(\"selectedFreebie\")||\"[]\";const time=sessionStorage.getItem(\"ConsultationTimeSelector\")||\"\";if(phone===\"\"||phone.length!==11){alert(\"전화번호를 다시 확인해주세요\");return false;}// 요거는 Mixpanel에서 사용자 프로필을 생성\nmixpanel.identify(phone);if(!category){alert(\"업종을 입력해주세요\");return false;}console.log(name+phone+category+businessNumber+selectedFreebie+window.location.href);if(window.fbq){window.fbq(\"track\",\"FormSubmission\",{content_name:\"상담 신청\",category,phone,businessNumber});}const newUrl=new URL(window.location.href);newUrl.searchParams.set(\"submitted\",\"true\");window.history.pushState({},\"\",newUrl);alert(\"접수 되었어요. 전화를 기다려주세요\");// Criteo 세일즈 태그 전환 트리거\nif(window.criteo_q){const deviceType=/iPad/.test(navigator.userAgent)?\"t\":/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent)?\"m\":\"d\";window.criteo_q.push({event:\"setAccount\",account:122238},{event:\"setEmail\",email:\"\",hash_method:\"sha256\"},{event:\"setEmail\",email:\"\",hash_method:\"md5\"},{event:\"setZipcode\",zipcode:\"\"},{event:\"setSiteType\",type:deviceType},{event:\"trackTransaction\",id:Math.floor(Math.random()*99999999999),item:[{id:\"lead_submission\",price:0,quantity:1}]});}//버튼 비활성화\nsetIsSubmitted(true);//인풋에 초기화 이벤트 전달\nwindow.dispatchEvent(new Event(\"resetForm\"));await fetch(\"https://public-api.ishopcare.bz/public/inquiry/leads/by-framer\",{method:\"POST\",mode:\"cors\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({name,category,businessNumber,phone,etcInfo:selectedFreebie,windowLocationHref:newUrl.href,isAgreedMarketing:false})});mixpanel.track(\"Submit Lead\",{host:newUrl.host,utmSource:newUrl.searchParams.get(\"utm_source\")??undefined,utmMedium:newUrl.searchParams.get(\"utm_medium\")??undefined,utmCampaign:newUrl.searchParams.get(\"utm_campaign\")??undefined,utmTerm:newUrl.searchParams.get(\"utm_term\")??undefined,utmContent:newUrl.searchParams.get(\"utm_content\")??undefined,referrer:newUrl.searchParams.get(\"referrer\")??undefined});sessionStorage.removeItem(\"name\");sessionStorage.removeItem(\"phone\");sessionStorage.setItem(\"selectedFreebie\",JSON.stringify([\"인터넷\"]));}catch(error){console.error(error);alert(\"접수에 실패했어요. 다시 시도해주세요\");}};return /*#__PURE__*/_jsxs(\"button\",{disabled:isSubmitted,onClick:e=>{e.preventDefault();handleClick();},style:{width:\"100%\",height:53,backgroundColor:backgroundColor,color:textColor,border:\"none\",borderRadius:\"9px\",fontSize:\"17px\",fontFamily:\"Toss Product Sans, sans-serif\",fontWeight:500,cursor:\"pointer\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\"},children:[text,/*#__PURE__*/_jsx(\"span\",{style:{fontSize:\"16px\",marginTop:\"4px\"},children:middleText})]});}// 기본 속성 설정\nSubmitButton.defaultProps={middleText:\"중간에 들어갈 텍스트\",width:340,height:53,backgroundColor:\"#007BFF\",textColor:\"#FFFFFF\"};// 속성 패널에 표시될 속성 추가\naddPropertyControls(SubmitButton,{middleText:{type:ControlType.String,title:\"Middle Text\"},width:{type:ControlType.Number,title:\"Width\",defaultValue:340},height:{type:ControlType.Number,title:\"Height\",defaultValue:55},backgroundColor:{type:ControlType.Color,title:\"Background Color\"},textColor:{type:ControlType.Color,title:\"Text Color\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"SubmitButton\":{\"type\":\"reactComponent\",\"name\":\"SubmitButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Front_db_Button.map"],"mappings":"qYAC0I,SAAgB,EAAa,EAAM,CAAC,GAAK,CAAC,OAAK,aAAW,QAAM,SAAO,kBAAgB,YAAU,CAAC,EAAY,EAAgB,IAAI,CAAC,IAAM,EAAmB,CAAE,EAAO,EAAO,IAAI,gBAAgB,EAAO,SAAS,QAAQ,IAAI,IAAIA,KAAK,EAAO,CAAC,IAAM,EAAIA,EAAE,GAAS,EAAMA,EAAE,GAAG,EAAmB,GAAK,CAAO,QAAO,CAAoB,EAAM,CAAC,EAAY,EAAe,CAAC,GAAe,EAAM,CAAO,EAAY,SAAS,CAAC,GAAG,CAAC,IAAM,EAAK,eAAe,QAAQ,OAAO,EAAE,GAAS,EAAM,eAAe,QAAQ,QAAQ,EAAE,GAAS,EAAS,eAAe,QAAQ,WAAW,EAAE,GAAS,EAAe,eAAe,QAAQ,iBAAiB,EAAE,GAAS,EAAgB,eAAe,QAAQ,kBAAkB,EAAE,KAAW,EAAK,eAAe,QAAQ,2BAA2B,EAAE,GAAG,GAAG,IAAQ,IAAI,EAAM,SAAS,GAA6B,MAAzB,OAAM,kBAAkB,EAAQ,EACj7B,GAAzB,EAAS,SAAS,EAAM,EAAK,EAA8B,MAApB,OAAM,aAAa,EAAQ,EAA4F,QAA7E,IAAI,EAAK,EAAM,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