(() => { 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); }; // 상단 카테고리 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); }, }); } })();