(() => { const { EventManager, utils, constants } = ShopbySkin; const { isMobileDevice } = utils; const headerEl = document.querySelector('shopby-header-v2'); // 외부스크립트 등록 기능. 삭제금지 ShopbyExternalScript?.initialize({ apiOption: { platform: 'PC', }, }).then(() => { EventManager.fire('QUERY_PAGE_SCRIPTS', ShopbyExternalScript?.scripts); }); // 클릭이벤트 맵 // 1. SIGN_OUT : 로그아웃 const headerActionMap = { SIGN_OUT: () => { EventManager.fire('SIGN_OUT'); }, GO_MY_MENU: (e) => { if (!utils.isSignedIn()) { e.preventDefault(); const from = e.target.href; const nextUrl = `${location.origin}/pages/sign-in/sign-in.html`; location.href = `${nextUrl}?from=${encodeURIComponent(from)}`; } }, }; // 클릭이벤트 핸들러 const clickEventListener = (e) => { const action = e?.target?.closest('[shopby-action]')?.getAttribute('shopby-action'); headerActionMap[action]?.(e); // 튜닝 : 사이드 메뉴에서 카테고리 하위 카테고리 Show/Hide 토글처리 if (e.target.classList.contains('btn_more')) { const li = e.target.closest('li'); const depth = li.querySelector('.depth_01'); depth?.classList.toggle('on'); const strong = li.querySelector('strong'); strong?.classList.toggle('on'); } // 튜닝 : 사이드 메뉴 Show/Hide 토글처리 if (e.target.classList.contains('all_cate_dimm')) { const section = e.target.closest('section'); section?.classList.toggle('is-active'); } // 튜닝 : 돋보기 아이콘 클릭시 검색창 Show/Hide 토글처리 if (e.target.classList.contains('btnSearch')) { const memberEl = e.target.closest('.member.fadeDown'); if (!memberEl) return; const searchArea = memberEl.querySelector('.search_area'); if (!searchArea) return; const currentDisplay = getComputedStyle(searchArea).display; searchArea.style.display = (currentDisplay === 'none') ? 'block' : 'none'; } }; // 상단 카테고리 slider 초기화 EventManager.on('PAGE_LOAD_COMPLETED', ({ profile }) => { EventManager.fire('INIT_CATEGORY_SLIDER', { direction: 'horizontal', effect: 'slide', slidesPerView: 'auto', spaceBetween: 20, }); // 외부스크립트 등록 기능. 삭제금지 ShopbyExternalScript?.setGlobalObjectSb({ getPlatform: () => (isMobileDevice ? 'MOBILE_WEB' : 'PC'), profile, }); }); headerEl?.addEventListener('click', clickEventListener); const searchParams = new URLSearchParams(location.search); const trackingKey = searchParams.get('trackingKey'); const channelType = searchParams.get('channelType'); const { setTrackingKey, setChannelType } = ShopbySkin.utils; setTrackingKey(trackingKey); setChannelType(channelType); const requireMarketingPrivacyAgreeNotification = sessionStorage.getItem( constants.REQUIRE_MARKETING_PRIVACY_AGREE_NOTIFICATION ); if (requireMarketingPrivacyAgreeNotification) { sessionStorage.removeItem(constants.REQUIRE_MARKETING_PRIVACY_AGREE_NOTIFICATION); if (!utils.isSignIn()) return; const excludePages = new Set(['/pages/sign-in/expired-password-change-form.html', '/pages/my/modify-member.html']); if (excludePages.has(location.pathname)) return; EventManager.fire('MODAL_ALERT_OPEN', { noticeType: '', message: '이메일 및 SMS 수신을 위해
마케팅 목적의 개인정보 수집·이용에 동의해 주세요.', onClose: () => { const nextUrl = `${location.origin}/pages/my/modify-member.html`; location.replace(nextUrl); }, }); } })();