{"version":3,"file":"Button_Tracker.2yQLfD78.mjs","names":[],"sources":["https:/framerusercontent.com/modules/d8klr3CW4QYggKC7vyc9/wf6C8enxQqmsDK1p7PW5/Button_Tracker.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===\"/onboarding\")return\"onboarding\";if(pathname===\"/contact\")return\"contact\";if(pathname.startsWith(\"/documents/\"))return\"document\";if(pathname.startsWith(\"/seminar/\"))return\"seminar\";return\"productDetail\";};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=`b2b_${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\",\"courseApply\",\"courseCasebook\",\"courseIntroduction\",\"courseCurriculum\",\"courseOnline\",\"courseTitle\"],optionTitles:[\"선택 안함 (이벤트 전송 안함)\",\"교육 문의\",\"사례집 신청\",\"소개서 신청\",\"커리큘럼 신청\",\"온라인 소개서 신청\",\"교육 상세\"],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=./Button_Tracker.map"],"mappings":"iLAE2R,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