{"version":3,"file":"ButtonClickTracker.DM34n_EX.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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