/*! 2024. 5. 2. 오후 4:59:11 */ /******/ (() => { // webpackBootstrap var __webpack_exports__ = {}; (() => { const { pageHelper, EventManager } = ShopbySkin; const withdrawalHelper = pageHelper.withdrawalHelper(); const containerEl = document.querySelector('[shopby-helper-key="withdrawal"]'); withdrawalHelper.initialize({ helperKey: 'withdrawal', platform: 'PC', profileNonMasking: true, }); EventManager.on('PROCESS_AUTHENTICATION', ({ status }) => { if (status === 'success') { const modifyMember = document.querySelector('.withdrawal-form'); modifyMember?.classList.remove('unauthentication'); } const buttonEl = document.querySelector("[shopby-btn='authentication']"); if (!buttonEl) return; if (status === 'pending') { buttonEl.disabled = true; } if (status === 'finish') { buttonEl.disabled = false; } }); const fetchConfirmMessage = (helper) => { const { couponCnt, hasOrder, accumulationAmount: accumulation } = helper.getState().helperState; const accumulationAmount = Number(accumulation ?? 0).toLocaleString(); if (hasOrder) { return !!couponCnt || !!accumulationAmount ? `There are orders in progress.
If you withdraw, you will not be able to access the shopping mall or check your order history, and all accumulated points and coupons will be deleted.
Do you want to withdraw?
${couponCnt} of available coupons / ${accumulationAmount} won of accumulated points` : 'There are orders in progress.
When you cancel your membership, you will not be able to access the shopping mall or check your order details.
Do you want to cancel?'; } return `When you withdraw, you will not be able to access the shopping mall and all accumulated points and coupons will be deleted.
Do you want to cancel?
${couponCnt} of available coupons / ${accumulationAmount} won of accumulated points`; }; const handleWithdrawal = (helper) => { const { withdrawalProfileForm } = helper.getState(); if (!withdrawalProfileForm.reason) { EventManager.fire('MODAL_ALERT_OPEN', { noticeType: 'CAUTION', message: 'Please enter the reason for withdrawal.', }); return; } if (!withdrawalProfileForm.termAgreed) { EventManager.fire('MODAL_ALERT_OPEN', { noticeType: 'CAUTION', message: 'You can withdraw your membership after agreeing to withdraw your membership.', }); return; } EventManager.fire('MODAL_CONFIRM_OPEN', { noticeType: 'WARNING', message: `${fetchConfirmMessage(helper)}`, onConfirm: async () => { await helper.withdrawal({ reason: withdrawalProfileForm.reason, }); EventManager.fire('MODAL_ALERT_OPEN', { noticeType: 'SUCCESS', message: 'Your membership withdrawal has been completed.', onClose: () => { location.replace('/'); }, }); }, }); }; const CLICK_EVENT_HANDLER_MAP = { OPEN_ID_CLICK: (target) => { const provider = target.getAttribute('shopby-provider'); if (provider === 'app-card') { EventManager.fire('OPEN_LAYER_MODAL', { name: 'app-card-authenticate', classModifier: 'app-card-authenticate', isFull: false, data: { nextPath: location.href, previousPath: location.href, provider, redirectUri: `${location.origin}/callback/auth-callback.html`, }, }); return; } const passwordAuthenticationLayerModalHelper = pageHelper.passwordAuthenticationLayerModalHelper(); passwordAuthenticationLayerModalHelper.openIdSignIn({ nextPath: location.href, previousPath: location.href, provider, redirectUri: `${location.origin}/callback/auth-callback.html`, }); }, CANCEL_AUTHENTICATION: () => { location.replace('/pages/my/my-page.html'); }, }; const clickEventListener = ({ target }) => { const action = target.getAttribute('shopby-action'); if (action === 'CLICK_WITHDRAWAL') { handleWithdrawal(withdrawalHelper); } }; containerEl.addEventListener('click', clickEventListener); document.querySelector('check-my-authentication')?.addEventListener('click', ({ target }) => { CLICK_EVENT_HANDLER_MAP[target.getAttribute('shopby-action')]?.(target); }); })(); /******/ })() ;