{"version":3,"file":"ButtonClickTracker.UzACHfWo.mjs","names":[],"sources":["https:/framerusercontent.com/modules/tOeVAAURkV3ZErlu6hrO/Ws8w2wQUj07zJWdmiQ7c/ButtonClickTracker.js"],"sourcesContent":["// ButtonClickTracker.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{Frame,addPropertyControls,ControlType}from\"framer\";// 페이지 카테고리 감지 함수\nconst getPageCategory=pathname=>{if(pathname===\"/\")return\"main\";if(pathname===\"/inquiry\")return\"inquiry\";if(pathname.startsWith(\"/document/\"))return\"document\";if(pathname.startsWith(\"/seminar/\"))return\"seminar\";};export function ButtonClickTracker(props){const{location,buttonCategory,buttonTitle,title,...rest}=props;const handleTap=e=>{e.stopPropagation();// Server-side rendering 체크\nif(typeof window===\"undefined\")return;// buttonCategory가 null이면 이벤트 전송 안함\nif(!buttonCategory||buttonCategory.trim()===\"\"||buttonCategory===\"null\"){return;}const pathname=window.location.pathname;const pageCategory=getPageCategory(pathname);// ① 이벤트명 생성: b2b_{pageCategory}_button_click\nconst eventName=`jp_${pageCategory}_button_click`;// ② UTM 파라미터 수집\nconst utmKeys=[\"source\",\"medium\",\"campaign\",\"term\",\"content\"];const utmProps={};utmKeys.forEach(key=>{const initialItem=typeof window!==\"undefined\"?localStorage.getItem(`initial_utm_${key}`):null;const lastItem=typeof window!==\"undefined\"?localStorage.getItem(`last_utm_${key}`):null;utmProps[`initial_utm_${key}`]=initialItem||\"unknown\";utmProps[`last_utm_${key}`]=lastItem||\"unknown\";});// ③ 기본 이벤트 속성 (UTM)\nconst eventProps={...utmProps};// ④ 페이지 카테고리별 title 속성 추가 (title이 있을 때만)\nif(title&&title.trim()){switch(pageCategory){case\"productDetail\":eventProps.productTitle=title.trim();break;case\"document\":eventProps.documentTitle=title.trim();break;case\"seminar\":eventProps.seminarTitle=title.trim();break;}}// ⑤ 버튼 관련 속성들 추가 (있을 때만)\nif(location&&location.trim()){eventProps.location=location.trim();}if(buttonCategory&&buttonCategory.trim()&&buttonCategory!==\"null\"){eventProps.buttonCategory=buttonCategory.trim();}if(buttonTitle&&buttonTitle.trim()){eventProps.buttonTitle=buttonTitle.trim();}// ⑥ GTM 데이터 레이어로 이벤트 push\nif(typeof window!==\"undefined\"&&window.dataLayer){window.dataLayer.push({event:eventName,...eventProps});}else if(typeof window!==\"undefined\"){window.dataLayer=window.dataLayer||[];window.dataLayer.push({event:eventName,...eventProps});}// ⑦ Amplitude에 동일 이벤트 전송\nif(typeof window!==\"undefined\"&&window.amplitude?.getInstance){window.amplitude.getInstance()?.logEvent(eventName,eventProps);}};return /*#__PURE__*/_jsx(Frame,{...rest,background:\"none\",style:{pointerEvents:\"auto\",cursor:\"pointer\"},onTap:handleTap});}ButtonClickTracker.defaultProps={width:1,height:1,location:\"\",buttonCategory:\"null\",buttonTitle:\"\",title:\"\"};addPropertyControls(ButtonClickTracker,{location:{type:ControlType.String,title:\"Location\",placeholder:\"div 이름 (hero, feature, wrapUp 등)\",defaultValue:\"\"},buttonCategory:{type:ControlType.Enum,title:\"Button Category\",options:[\"null\",\"inquiry\",\"companyInfo\",\"caseStudies\",\"learning-journey\",\"customer-interview\",\"curriculum-detail\",\"curri-genAI\",\"curri-python\",\"curri-excel\"],optionTitles:[\"선택 안함 (이벤트 전송 안함)\",\"問い合わせ\",\"会社紹介書\",\"事例集\",\"受講の流れ\",\"お顧客の声\",\"カリキュラム\",\"生成AI入門\",\"python\",\"excel\"],defaultValue:\"null\"},buttonTitle:{type:ControlType.String,title:\"Button Title\",placeholder:\"버튼 텍스트\",defaultValue:\"\"},title:{type:ControlType.String,title:\"Title\",placeholder:\"페이지 제목 (상세/세미나/자료집 페이지용)\",defaultValue:\"\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"ButtonClickTracker\":{\"type\":\"reactComponent\",\"name\":\"ButtonClickTracker\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ButtonClickTracker.map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