{"id":84,"date":"2026-04-03T13:31:18","date_gmt":"2026-04-03T13:31:18","guid":{"rendered":"https:\/\/wp.gapshop.net\/index.php\/account\/"},"modified":"2026-04-03T13:31:18","modified_gmt":"2026-04-03T13:31:18","slug":"account","status":"publish","type":"page","link":"https:\/\/wp.gapshop.net\/index.php\/account\/","title":{"rendered":"Account"},"content":{"rendered":"    <div class=\"gapshop-wrap\" id=\"gs-acct-wrap\">\r\n        <div class=\"gapshop-loading\">Loading...<\/div>\r\n    <\/div>\r\n    <script>\r\n    document.addEventListener('DOMContentLoaded', function() {\r\n        var token = localStorage.getItem('gapshop_token');\r\n        if (token) gsRenderAccount(); else gsRenderLogin();\r\n    });\r\n    function gsRenderLogin() {\r\n        document.getElementById('gs-acct-wrap').innerHTML =\r\n            '<div style=\"max-width:400px;margin:0 auto;background:#fff;border-radius:10px;padding:32px;box-shadow:0 1px 8px rgba(0,0,0,.08)\">'\r\n            + '<h2 style=\"margin:0 0 8px;font-size:1.3rem;font-weight:700\">Sign In<\/h2>'\r\n            + '<p style=\"color:#888;font-size:.88rem;margin:0 0 20px\">Enter your email to receive a login code.<\/p>'\r\n            + '<div id=\"gs-step1\">'\r\n            + '<input id=\"gs-email\" class=\"gapshop-field\" type=\"email\" placeholder=\"Email address\" \/>'\r\n            + '<button onclick=\"gsReqOtp()\" class=\"gapshop-btn gapshop-btn-primary\" style=\"width:100%;padding:13px\">Send Login Code<\/button>'\r\n            + '<\/div>'\r\n            + '<div id=\"gs-step2\" style=\"display:none\">'\r\n            + '<p style=\"font-size:.88rem;color:#555;margin:0 0 16px\">Check your email for a 6-digit code.<\/p>'\r\n            + '<input id=\"gs-otp\" class=\"gapshop-field\" type=\"text\" maxlength=\"6\" placeholder=\"000000\" style=\"font-size:1.3rem;letter-spacing:10px;text-align:center\" \/>'\r\n            + '<button onclick=\"gsVerOtp()\" class=\"gapshop-btn gapshop-btn-primary\" style=\"width:100%;padding:13px\">Verify Code<\/button>'\r\n            + '<button onclick=\"document.getElementById(\\'gs-step1\\').style.display=\\'block\\';document.getElementById(\\'gs-step2\\').style.display=\\'none\\';\" style=\"background:none;border:none;color:#aaa;font-size:.82rem;cursor:pointer;margin-top:8px;width:100%\">\u2190 Use a different email<\/button>'\r\n            + '<\/div>'\r\n            + '<div id=\"gs-acct-err\" class=\"gapshop-msg-error\" style=\"display:none;margin-top:12px\"><\/div>'\r\n            + '<\/div>';\r\n    }\r\n    async function gsReqOtp() {\r\n        var email = document.getElementById('gs-email').value;\r\n        var err   = document.getElementById('gs-acct-err');\r\n        if (!email) { err.textContent='Email is required.'; err.style.display='block'; return; }\r\n        var res = await fetch(\"https:\\\/\\\/api.gapshop.net\\\/api\\\/auth\\\/otp\\\/request\", {\r\n            method: 'POST',\r\n            headers: { 'Content-Type':'application\/json', 'X-Tenant-Domain':window.location.hostname },\r\n            body: JSON.stringify({ email: email })\r\n        });\r\n        if (res.ok) {\r\n            document.getElementById('gs-step1').style.display = 'none';\r\n            document.getElementById('gs-step2').style.display = 'block';\r\n            err.style.display = 'none';\r\n        } else {\r\n            err.textContent = 'Could not send code. Please try again.';\r\n            err.style.display = 'block';\r\n        }\r\n    }\r\n    async function gsVerOtp() {\r\n        var email = document.getElementById('gs-email').value;\r\n        var otp   = document.getElementById('gs-otp').value;\r\n        var err   = document.getElementById('gs-acct-err');\r\n        var res = await fetch(\"https:\\\/\\\/api.gapshop.net\\\/api\\\/auth\\\/otp\\\/verify\", {\r\n            method: 'POST',\r\n            headers: { 'Content-Type':'application\/json', 'X-Tenant-Domain':window.location.hostname },\r\n            body: JSON.stringify({ email: email, otp: otp })\r\n        });\r\n        if (res.ok) {\r\n            var d = await res.json();\r\n            localStorage.setItem('gapshop_token', d.token);\r\n            localStorage.setItem('gapshop_customer', JSON.stringify(d.customer));\r\n            gsRenderAccount();\r\n        } else {\r\n            err.textContent = 'Invalid or expired code.';\r\n            err.style.display = 'block';\r\n        }\r\n    }\r\n    function gsRenderAccount() {\r\n        var c = JSON.parse(localStorage.getItem('gapshop_customer') || '{}');\r\n        document.getElementById('gs-acct-wrap').innerHTML =\r\n            '<div style=\"display:flex;justify-content:space-between;align-items:center;margin-bottom:24px\">'\r\n            + '<div><h2 style=\"margin:0 0 4px;font-size:1.3rem;font-weight:700\">My Account<\/h2>'\r\n            + '<p style=\"margin:0;color:#888;font-size:.88rem\">'+(c.email||'')+'<\/p><\/div>'\r\n            + '<button onclick=\"gsSignOut()\" class=\"gapshop-btn gapshop-btn-outline\" style=\"font-size:.82rem;padding:8px 18px\">Sign Out<\/button>'\r\n            + '<\/div>'\r\n            + '<div style=\"background:#fff;border-radius:10px;padding:24px;box-shadow:0 1px 8px rgba(0,0,0,.08)\">'\r\n            + '<h3 style=\"margin:0 0 16px;font-size:1rem;font-weight:700\">Order History<\/h3>'\r\n            + '<p style=\"color:#aaa;text-align:center;padding:32px 0\">No orders yet. <a href=\"\/\" style=\"color:#1565c0\">Start shopping<\/a>.<\/p>'\r\n            + '<\/div>';\r\n    }\r\n    function gsSignOut() {\r\n        localStorage.removeItem('gapshop_token');\r\n        localStorage.removeItem('gapshop_customer');\r\n        gsRenderLogin();\r\n    }\r\n    <\/script>\r\n    \n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-84","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/wp.gapshop.net\/index.php\/wp-json\/wp\/v2\/pages\/84","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.gapshop.net\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/wp.gapshop.net\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/wp.gapshop.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.gapshop.net\/index.php\/wp-json\/wp\/v2\/comments?post=84"}],"version-history":[{"count":0,"href":"https:\/\/wp.gapshop.net\/index.php\/wp-json\/wp\/v2\/pages\/84\/revisions"}],"wp:attachment":[{"href":"https:\/\/wp.gapshop.net\/index.php\/wp-json\/wp\/v2\/media?parent=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}