class CustomCommonFooter extends ShopbySkin.modules.ShopbyFooter { async setup() { super.setup(); // [Jay] 메인 하단 공지사항 관련 영역 const noticeParams = { queryString: { pageNumber: 1, pageSize: 10, }, }; const noticeBoardId = 'notice'; const { result: noticeDataList } = await callShopApiFetch( `/boards/${noticeBoardId}/articles?`, 'GET', noticeParams, ); // [Jay] 공지사항 공지글 아닌것만 필터링 const noticeData = noticeDataList.items?.filter( (article) => article.notice === false, ); this.store.attach('noticeData', (state) => { this.updateSlot(state, 'noticeData'); }); this.store.setState({ noticeData, }); } } customElements.define('custom-shopby-footer', CustomCommonFooter); (async () => { const { EventManager, utils } = ShopbySkin; const { createPageScriptInstance } = utils; const pageScriptInstance = createPageScriptInstance('PC'); EventManager.on('PAGE_LOAD_COMPLETED', () => { pageScriptInstance.appendPageScript('COMMON_FOOTER'); const APP_DOWNLOAD_EVENT = { 'DOWNLOAD_ANDROID': () => { window.open('https://play.google.com/store/apps/details?id=com.app.sbgolf') }, 'DOWNLOAD_APPLE': () => { window.open('https://apps.apple.com/kr/app/sb%EA%B3%A8%ED%94%84/id6743790539') }, 'DOWNLOAD_QR': async () => { const params = { method: 'GET' } try { const url = 'https://sbgolf.co.kr/pages/service/app-bridge.html'; // QR 생성 document.querySelector('.qr_cont').classList.add('active') qrcode.toCanvas(document.getElementById('app-download__qr'), url, { width: 300, height: 300 }, function (error) { if (error) { throw new Error(error) } }); } catch (error) { console.log(error); ShopbySkin.EventManager.fire('MODAL_ALERT_OPEN', { noticeType: 'CAUTION', message: `QR코드 생성 중 오류가 발생하였습니다.`, onClose: () => { location.reload(); }, }); } } } document.querySelector('.app').addEventListener('click', ({ target }) => { const actions = target.closest('button')?.getAttribute('shopby-action') APP_DOWNLOAD_EVENT[actions]?.(); }) document.querySelector('.qr_close_btn').addEventListener('click', () => { document.querySelector('.qr_cont').classList.remove('active') }) }); })();