PageSourceSearch

https://www.theceshop.com/assets/route-inactivity-logout.6eeeecfa.js

js theceshop.com collected 2026-09-27 20:55:27 UTC 16,043 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkSITE=self.webpackChunkSITE||[]).push([[248],{7129:(t,n,e)=>{e.d(n,{initializeInactivityLogout:()=>N});const o=9e5,i=12e4,a=1e3,r="ces_last_activity",c="ces_logout_triggered",s="ces_warning_dismissed",l=!1;if(i>=o)throw new Error(`[Inactivity Logout] Configuration error: WARNING_BEFORE_LOGOUT_MS (${i/6e4}min) must be less than INACTIVITY_TIMEOUT_MS (${o/6e4}min)`);if(i<=0)throw new Error("[Inactivity Logout] Configuration error: WARNING_BEFORE_LOGOUT_MS must be greater than 0");if(o<=0)throw new Error("[Inactivity Logout] Configuration error: INACTIVITY_TIMEOUT_MS must be greater than 0");let u=null,d=null,g=!1,m=!1;function f(t){l&&console.log(`[${(new Date).toLocaleTimeString("en-US",{hour12:!1})}] [Inactivity Logout] ${t}`)}function v(){try{const t=Date.now();localStorage.setItem(r,t.toString()),localStorage.removeItem(s),f("Activity detected - timer reset"),m&&(f("Warning modal dismissed due to activity"),E())}catch(t){f(`⚠️  Error updating localStorage: ${t}. System may not work correctly in private browsing.`)}}function h(){try{const t=localStorage.getItem(r);return t?parseInt(t,10):null}catch(t){return f(`⚠️  Error reading from localStorage: ${t}`),null}}function y(){const t=h();return t?Date.now()-t:0}function p(){return y()>=o}function w(){const t=y();return t>=o-i&&t<o}function b(){const t=y();return Math.max(0,o-t)}function S(){const t=document.querySelector("plat-auth-toggle");if(!t)return!1;const n=t.querySelector('[slot="unauthenticated-user-content"]');return!!n&&n.hasAttribute("hidden")}function I(){if(m)return void f("Warning modal already shown, skipping");const t=y();f(`Inactivity threshold reached: ${Math.floor(t/6e4)}m ${Math.floor(t%6e4/1e3)}s`),f("Showing warning modal with 2-minute countdown");const n=document.getElementById("ces-inactivity-warning-modal");n&&n.remove();const e=document.createElement("plat-modal");e.id="ces-inactivity-warning-modal",e.isOpen=!0,e.modalTitle="You will be logged out soon!",e.innerHTML='\n    <div class="space-y-6">\n      <p class="text-lg">\n        For security reasons and due to inactivity you will be logged out in <span id="ces-inactivity-countdown" class="font-semibold">2:00</span>.\n      </p>\n      <div class="flex flex-col gap-3">\n        <plat-button\n          id="ces-inactivity-logout-btn"\n          variant="gray"\n          button-class="w-full justify-center ces-logout-btn-teal"\n          icon="xmark"\n          text="Log out now"\n        ></plat-button>\n        <plat-button\n          id="ces-inactivity-continue-btn"\n          button-class="w-full justify-center"\n          icon="square-up-right"\n          text="Continue session"\n        ></plat-button>\n      </div>\n    </div>\n  ',document.body.appendChild(e),m=!0,e.addEventListener("requestClose",(t=>{t.preventDefault(),t.stopPropagation(),f("User attempted to close warning modal - prevented")})),setTimeout((()=>{const t=document.getElementById("ces-inactivity-continue-btn"),n=document.getElementById("ces-inactivity-logout-btn");t?.addEventListener("click",$),n?.addEventListener("click",k)}),100),function(){d&&clearInterval(d);d=window.setInterval((()=>{const t=b(),n=document.getElementById("ces-inactivity-countdown");n&&(n.textContent=function(t){const n=Math.ceil(t/1e3);return`${Math.floor(n/60)}:${(n%60).toString().padStart(2,"0")}`}(t)),t<=0&&(f("Countdown reached zero - triggering logout"),d&&(clearInterval(d),d=null),L())}),a)}(),f("Warning modal shown")}function E(){const t=document.getElementById("ces-inactivity-warning-modal");t&&(t.isOpen=!1,setTimeout((()=>{t.remove()}),300),f("Warning modal hidden")),m=!1,d&&(clearInterval(d),d=null)}function $(){f('User clicked "Continue Session" button'),v(),E(),f("Session continued - timer reset to 15 minutes")}function k(){f('User clicked "Log Out Now" button'),E(),L()}function x(){f("🍞 showErrorToast() called");const t=document.getElementById("ces-inactivity-error-toast");t&&(f("Removing existing toast"),t.remove()),f("Creating toast element...");const n=document.createElement("div");
1n.id="ces-inactivity-error-toast",n.className="ces-inactivity-toast ces-inactivity-toast-error",n.innerHTML='\n    <div class="ces-inactivity-toast-content">\n      <i class="fa-solid fa-triangle-exclamation"></i>\n      <span>You’ve been logged out due to inactivity. Please log back in.</span>\n      <button class="ces-inactivity-toast-close" aria-label="Close notification">\n        <i class="fa-solid fa-xmark"></i>\n      </button>\n    </div>\n  ',f("Appending toast to document.body"),document.body.appendChild(n),f(`Toast appended. Element in DOM: ${!!document.getElementById("ces-inactivity-error-toast")}`);const e=n.querySelector(".ces-inactivity-toast-close");e&&e.addEventListener("click",(()=>{f("User clicked close button on toast"),n.remove()}))}function L(){const t=y();f(`⏱️  Logout triggered after ${Math.floor(t/6e4)}m ${Math.floor(t%6e4/1e3)}s of inactivity`),E(),f("Broadcasting logout event to all tabs via localStorage");try{localStorage.setItem(c,Date.now().toString())}catch(t){f(`⚠️  Error broadcasting logout to localStorage: ${t}`)}!function(){f("🚪 Performing logout action"),_();const t=document.querySelector("plat-auth-toggle");t?function(t){const n=t.querySelector('a[href*="signout"], a[href*="logout"]');n?(f(`Found logout link in plat-auth-toggle (${n.href}), clicking...`),C(n),n.click(),f("Logout link clicked - Cognito logout initiated")):(f("No logout/signout link found in plat-auth-toggle"),function(){f("Attempting fallback: dispatching custom event");const t=new CustomEvent("ces-force-logout",{bubbles:!0,composed:!0,detail:{reason:"inactivity"}});document.dispatchEvent(t),f("Fallback: Redirecting to /signout.html in 2 seconds"),setTimeout((()=>{window.location.href="/signout.html"}),2e3)}())}(t):(f("No plat-auth-toggle component found"),f("Fallback: Redirecting to /signout.html"),setTimeout((()=>{window.location.href="/signout.html"}),2e3));!function(){f("Cleaning up localStorage activity tracking");try{localStorage.removeItem(r),localStorage.removeItem(s)}catch(t){f(`⚠️  Error cleaning up localStorage: ${t}`)}}()}()}function _(){try{sessionStorage.setItem("ces_inactivity_logout_occurred","true"),localStorage.setItem("ces_inactivity_logout_occurred","true"),f("Set flag in both sessionStorage and localStorage to show toast notification after redirect")}catch(t){f(`⚠️  Error setting logout flag: ${t}`)}}function C(t){try{const n=new URL(t.href,window.location.origin);n.searchParams.set("inactivity_logout","1"),t.href=n.toString(),f(`Modified logout URL to include query parameter: ${t.href}`)}catch(t){f(`⚠️  Could not modify logout URL: ${t}`)}}let T=-1;function M(){if(!S())return E(),void(T=-1);const t=y(),n=Math.floor(t/6e4),e=Math.floor(t%6e4/1e3);if(function(t,n){t!==T&&t>0&&(f(`📊 Inactivity status: ${t}m ${n}s elapsed`),T=t)}(n,e),p())return f(`⚠️  15-minute threshold exceeded (${n}m ${e}s) - initiating logout`),void L();w()&&!m&&function(t,n){try{localStorage.getItem(s)||(f(`⚠️  Warning threshold reached (${t}m ${n}s elapsed, ${i/6e4}min until logout)`),I())}catch(e){f(`⚠️  Error checking warning dismissed flag: ${e}`),f(`⚠️  Warning threshold reached (${t}m ${n}s elapsed, ${i/6e4}min until logout)`),I()}}(n,e)}function U(){const t=document.querySelector("plat-auth-toggle");if(!t)return f("No plat-auth-toggle found in cross-tab event, redirecting to /signout.html"),void setTimeout((()=>{window.location.href="/signout.html"}),2e3);const n=t.querySelector('a[href*="signout"], a[href*="logout"]');n?function(t){f("Clicking logout link in response to cross-tab event"),C(t),setTimeout((()=>{t.click()}),100)}(n):(f("No logout link found in cross-tab event, redirecting to /signout.html"),setTimeout((()=>{window.location.href="/signout.html"}),2e3))}function R(){f("📡 Logout event received from another tab - synchronizing logout"),E(),function(){f("Showing session timeout modal (cross-tab logout)"),x();const t=document.getElementById("ces-session-timeout-modal");t&&t.remove();const n=document.createElement("plat-modal");n.id="ces-session-timeout-modal",n.isOpen=!0,n.modalTitle="Session timeout",n.innerHTML='\n    <div class="space-y-4">\n      <p class="text-base text-gray-700">\n        You\'ve been logged out due to inactivity.\n      </p>\n      <div class="flex gap-3 justify-end">\n        <plat-button\n          id="ces-session-timeout-login-btn"\n          text="Log in"\n        ></plat-button>\n        <plat-button\n          id="ces-session-timeout-close-btn"\n          variant="gray"\n          text="Close"\n        ></plat-button>\n      </div>\n    </div>\n  ',document.body.appendChild(n),n.addEventListener("requestClose",(t=>{t.preventDefault(),t.stopPropagation(),f("User attempted to close session timeout modal - prevented")})),setTimeout((()=>{const t=document.getElementById("ces-session-timeout-login-btn"),e=d
1ocument.getElementById("ces-session-timeout-close-btn");t?.addEventListener("click",(()=>{window.location.href="/login/"})),e?.addEventListener("click",(()=>{n.remove(),window.location.href="/"}))}),100),f("Session timeout modal shown")}(),_(),U()}function O(t){t.key===c&&t.newValue?R():t.key===r&&t.newValue&&m&&(f("📡 Activity detected in another tab - dismissing warning modal"),E())}let A=null;function B(){A||(v(),A=window.setTimeout((()=>{A=null}),1e3))}function N(){if(g)return void f("⚠️  Already initialized, skipping");f("🚀 Initializing inactivity logout system"),f("Configuration:"),f(`  - Logout after: ${o/6e4} minutes (${o/1e3}s) of inactivity`),f(`  - Warning shown: ${i/6e4} minutes (${i/1e3}s) before logout`),f(`  - Check interval: ${a}ms`),i<3e4&&f(`⚠️  Warning: WARNING_BEFORE_LOGOUT_MS is very short (${i/1e3}s). Users may not have enough time to respond.`);const t=i/o*100;t>50&&f(`⚠️  Warning: WARNING_BEFORE_LOGOUT_MS is ${t.toFixed(0)}% of total timeout. Consider reducing it.`),function(){if(document.getElementById("ces-inactivity-logout-styles"))return;const t=document.createElement("style");t.id="ces-inactivity-logout-styles",t.textContent="\n    .ces-inactivity-toast {\n      position: fixed;\n      top: 20px;\n      left: 50%;\n      transform: translateX(-50%);\n      z-index: 10001;\n      border-radius: var(--Border-radius-rounded, 8px);\n      padding: 16px 20px;\n      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n      animation: ces-toast-slide-in 0.3s ease-out;\n    }\n\n    @keyframes ces-toast-slide-in {\n      from {\n        transform: translateX(-50%) translateY(-20px);\n        opacity: 0;\n      }\n      to {\n        transform: translateX(-50%) translateY(0);\n        opacity: 1;\n      }\n    }\n\n    .ces-inactivity-toast-error {\n      background: var(--Red-red-surface, #FAE9EA);\n    }\n\n    .ces-inactivity-toast-content {\n      display: flex;\n      align-items: center;\n      gap: 12px;\n      color: var(--Red-red-default, #F1291C);\n      font-family: Lato;\n      font-size: var(--text-sizing-base, 16px);\n      font-style: normal;\n      font-weight: 500;\n      line-height: var(--text-sizing-2xl, 24px);\n    }\n\n    .ces-inactivity-toast-content i {\n      color: var(--Red-red-default, #F1291C);\n      font-size: var(--text-sizing-base, 16px);\n    }\n\n    .ces-inactivity-toast-close {\n      background: none;\n      border: none;\n      cursor: pointer;\n      padding: 0;\n      margin-left: auto;\n      display: flex;\n      align-items: center;\n      justify-content: center;\n      color: var(--Red-red-default, #F1291C);\n      opacity: 0.7;\n      transition: opacity 0.2s;\n    }\n\n    .ces-inactivity-toast-close:hover {\n      opacity: 1;\n    }\n\n    .ces-inactivity-toast-close i {\n      font-size: 18px;\n    }\n\n    /* Light teal background for logout button - matches info notification */\n    plat-button#ces-inactivity-logout-btn::part(button),\n    plat-button#ces-inactivity-logout-btn button {\n      background-color: #d1ecf1 !important;\n      color: #0c5460 !important;\n      border: none !important;\n      box-shadow: none !important;\n    }\n\n    plat-button#ces-inactivity-logout-btn::part(button):hover,\n    plat-button#ces-inactivity-logout-btn button:hover {\n      background-color: #bee5eb !important;\n      border: none !important;\n    }\n\n    /* Ensure Continue session button text is white */\n    plat-button#ces-inactivity-continue-btn::part(button),\n    plat-button#ces-inactivity-continue-btn button {\n      color: white !important;\n    }\n\n    /* Make warning modal narrower */\n    plat-modal#ces-inactivity-warning-modal::part(modal),\n    plat-modal#ces-inactivity-warning-modal {\n      max-width: 400px !important;\n    }\n  ",document.head.appendChild(t)}(),v(),document.addEventListener("mousemove",B),f("Mouse movement listener registered"),window.addEventListener("storage",O),f("Cross-tab storage event listener registered"),u=window.setInterval(M,a),f("Periodic inactivity check started"),setTimeout((()=>{const t=S();f("Initial authentication check: "+(t?"User is logged in":"User is not logged in")),t||f("⚠️  Inactivity tracking will not start until user logs in")}),2e3),function(){f("Checking for inactivity logout flag..."),f(`Current page: ${window.location.pathname}`),f(`Current URL: ${window.location.href}`);try{if(function(){const t=new URLSearchParams(window.location.search),n=t.get("inactivity_logout");if(f(`URL parameter inactivity_logout: ${n}`),"1"!==n)return!1;if(F())return f("On signout page - URL parameter detected, will carry through"),!0;f("✅ Detected inactivity logout via URL parameter - showing toast notification"),t.delete("inactivity_logout");const e=window.location.pathname+(t.toString()?"?"+t.toString():"");return window.history.replaceState({},"",e),f("Removed inactivity_logout parameter from URL"),D(),!0}())return;if(function(){const t=sessionStorage.getItem("ces_inactivity_logout_occurred");if(f(`SessionStorage flag value: ${t}`),"true"!==t)return!1;if(F())return f("On signout page - preserving sessionStorage flag for next redirect"),!0;return f("✅ Detected inactivity logout flag in sessionStorage - showing toast notification"),sessionStorage.removeItem("ces_inactivity_logout_occurred"),D(),!0}())return;if(function(){const t=localStorage.getItem("ces_inactivity_logout_occurred");if(f(`LocalStorage flag value: ${t}`),"true"!==t)return!1;if(F())return f("On signout page - preserving localStorage flag for next redirect"),!0;return f("✅ Detected inactivity logout flag in localStorage - showing toast notification"),localStorage.removeItem("ces_inactivity_logout_occurred"),D(),!0}())return;f("No inactivity logout flag found in URL, sessionStorage, or localStorage")}catch(t){f(`⚠️  Error checking inactivity logout flag: ${t}`)}}(),g=!0,f("✅ Initialization complete")}function F(){return window.location.pathname.includes("/signout")}function D(){setTimeout((()=>{f("Executing showErrorToast() after delay"),x(),f("showErrorToast() completed")}),500)}"undefined"!=typeof window&&(window.inactivityLogoutDebug=l?function(){const t=y(),n=Math.floor(t/6e4),e=Math.floor(t%6e4/1e3),a=b(),l=Math.floor(a/6e4),u=Math.floor(a%6e4/1e3),d=S(),f=document.querySelector("plat-auth-toggle"),v=f?.querySelector('[slot="unauthenticated-user-content"]'),I=v?.hasAttribute("hidden");let E;try{E={lastActivity:localStorage.getItem(r),logoutTriggered:localStorage.getItem(c),warningDismissed:localStorage.getItem(s)}}catch(t){E={error:`Cannot access localStorage: ${t}`}}const $={initialized:g,authenticated:d,authDetection:{platAuthToggleFound:!!f,unauthContentFound:!!v,unauthContentHidden:I||!1},inactiveTime:`${n}m ${e}s`,timeUntilWarning:w()?"Warning threshold reached!":`${Math.max(0,Math.floor((o-i-t)/6e4))}m remaining`,timeUntilLogout:p()?"Logout threshold reached!":`${l}m ${u}s`,warningShown:m,lastActivity:new Date(h()??0).toLocaleTimeString(),localStorage:E};
1return console.table($),console.log("[Inactivity Logout Debug] Full status:",$),$}:()=>{})}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.