(() => { /* 사용자 공통 js 파일입니다. 공통으로 적용할 스크립트를 작성해주세요. */ })(); /* HELLO GREENCY external-member login: PC skin only. Native token keys stay SDK-owned. */ (() => { if (window.HelloGreencyNativeAuthReady) return; window.HelloGreencyNativeAuthReady = new Promise((resolve, reject) => { const script = document.createElement('script'); script.src = '/libs/hello-greency-auth-native3.js?v=20261016-community-seo1'; script.onload = () => window.HelloGreencyNativeAuth ? resolve(window.HelloGreencyNativeAuth) : reject(new Error('auth_unavailable')); script.onerror = () => reject(new Error('auth_unavailable')); document.head.append(script); }); // Attach a rejection handler immediately; the login page also presents an accessible error. window.HelloGreencyNativeAuthReady.catch(() => { const show = () => { const message = document.querySelector('[data-hg-error], #hg-auth-error'); const status = document.querySelector('[data-hg-status], #hg-auth-status'); if (status) status.textContent = ''; if (message) { message.textContent = '로그인 연결을 불러오지 못했어요. 페이지를 새로고침해 주세요.'; message.hidden = false; } document.querySelectorAll('[data-hg-provider]').forEach(button => { button.disabled = true; }); }; if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', show, { once: true }); else show(); }); let loggingOut = false; document.addEventListener('click', async event => { const target = event.target instanceof Element ? event.target.closest('[shopby-action="SIGN_OUT"]') : null; if (!target) return; event.preventDefault(); event.stopImmediatePropagation(); if (loggingOut) return; loggingOut = true; try { const auth = await window.HelloGreencyNativeAuthReady; await auth.signOut(); } catch (_) { loggingOut = false; window.alert('로그아웃을 완료하지 못했어요. 잠시 후 다시 시도해 주세요.'); } }, true); function replaceJoinLinks() { document.querySelectorAll('a[href]').forEach(link => { try { const url = new URL(link.getAttribute('href'), location.href); if (url.origin === location.origin && url.pathname === '/pages/sign-up/sign-up-method.html') link.href = '/pages/sign-in/sign-in.html'; } catch (_) { /* Ignore non-URL anchors. */ } }); } document.addEventListener('DOMContentLoaded', () => { replaceJoinLinks(); new MutationObserver(replaceJoinLinks).observe(document.body, { childList: true, subtree: true }); }, { once: true }); })();