PageSourceSearch

https://www.sommpicks.com/_next/static/chunks/4508-1317ccf17d25236e.js

js sommpicks.com collected 2026-10-04 13:23:21 UTC 7,897 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4508],{4508:(e,t,r)=>{r.d(t,{A:()=>T,c:()=>L});var n=r(5155),o=r(2115),u=r(3321),l=r(593),s=r(2348),i=r(1286);let a="sommpicks:auth-changed";var c=r(2815),d=r(8921),m=r(5848),f=r(7297),h=r(9931);let w=(0,o.createContext)(null),p="sommpicks:pending-login-return-to",g=e=>{let t=e.querySelector("dialog[open], .dialog[open]");if(t)return t;for(let t of e.querySelectorAll("shopify-store, shopify-account")){if(!(t instanceof HTMLElement)||!t.shadowRoot)continue;let e=t.shadowRoot.querySelector("dialog[open], .dialog[open]");if(e)return e}return null},v=e=>{let t="string"==typeof e?e.trim():"";if(!t)return null;try{let e=t.startsWith("/")?new URL(t,window.location.origin):new URL(t);if(e.origin!==window.location.origin)return null;return`${e.pathname}${e.search}${e.hash}`}catch{return null}},b=()=>`${window.location.pathname}${window.location.search}${window.location.hash}`,y=e=>{try{let t=v(e);if(t)return void window.sessionStorage.setItem(p,t);window.sessionStorage.removeItem(p)}catch{}},E=e=>{if(!(e instanceof HTMLAnchorElement)||e.hasAttribute("download"))return null;let t=(e.getAttribute("href")??"").trim();if(!t||"#"===t||t.toLowerCase().startsWith("javascript:"))return null;let r=v(e.href);if(!r)return null;let n=v(b());if(!n)return r;try{let e=new URL(n,window.location.origin),t=new URL(r,window.location.origin);if(t.pathname===e.pathname&&t.search===e.search&&t.hash)return null}catch{}return r};function L(){let e=(0,o.useContext)(w);if(!e)throw Error("useAuthUi must be used within an AuthUiProvider");return e}function T({authBypassEnabled:e,children:t,initialCustomer:r,initialAuthenticated:L,shopifyAccountConfig:T}){let A=(0,u.usePathname)()||"/",I=(0,u.useRouter)(),k=(0,u.useSearchParams)(),{market:S}=(0,l.h)(),[R,C]=(0,o.useState)(L),[x,M]=(0,o.useState)(r),[P,$]=(0,o.useState)(null),F=(0,o.useRef)(null),K=(0,o.useRef)(null),D=(0,o.useRef)(L),[H,j]=(0,o.useState)(!1),N=(0,o.useRef)(null),U=(0,o.useRef)(null),W=(0,o.useRef)(null),q=(0,o.useRef)(0),_=(0,o.useCallback)((e,t=!1)=>{let r=D.current!==e;return D.current=e,C(t=>t===e?t:e),r&&t&&I.refresh(),r},[I]),B=(0,o.useCallback)(e=>{let t=v(e);if(t)return t;let r=v(b());if(r)return r;let n=k?.toString()??"";return n?`${A}?${n}`:A},[A,k]),O=(0,o.useCallback)(e=>{let t=v(e)??(()=>{try{return v(window.sessionStorage.getItem(p))}catch{return null}})();return!!t&&((y(null),$(null),v(b())===t)?I.refresh():((0,d.r0)(t),I.push(t)),!0)},[I]);(0,o.useEffect)(()=>{"u">typeof document&&(document.body.classList.toggle("user-logged-in",R),document.body.classList.toggle("user-logged-out",!R))},[R]),(0,o.useEffect)(()=>{if("u">typeof document)return document.body.classList.toggle("shopify-auth-dialog-open",H),()=>{document.body.classList.remove("shopify-auth-dialog-open")}},[H]);let z=(0,o.useCallback)(async e=>{try{let t=await fetch("/api/auth/status",{cache:"no-store",signal:e});if(!t.ok)throw Error(`Failed loading auth status: ${t.status}`);let r=await t.json();if(e?.aborted)return;M({customerEmail:"string"==typeof r.customerEmail?r.customerEmail:null,customerId:"number"==typeof r.customerId&&Number.isFinite(r.customerId)&&r.customerId>0?Math.floor(r.customerId):null,shopAddress:"string"==typeof r.shopAddress?r.shopAddress:null});let n=!0===r.authenticated&&O(),o=_(!0===r.authenticated,!n);n||!0!==r.refreshed||o||I.refresh()}catch(t){if(e?.aborted)return;console.error("Failed loading auth status",t)}},[O,I,_]);(0,o.useEffect)(()=>{let e=new AbortController;z(e.signal);let t=()=>{z()},r=()=>{"visible"===document.visibilityState&&z()},n=()=>{z()},o=window.setInterval(()=>{z()},6e5);return window.addEventListener("focus",t),window.addEventListener(a,n),document.addEventListener("visibilitychange",r),()=>{e.abort(),window.clearInterval(o),window.removeEventListener("focus",t),window.removeEventListener(a,n),document.removeEventListener("visibilitychange",r)}},[z]),(0,o.useEffect)(()=>()=>{null!==N.current&&window.clearTimeout(N.current),null!==U.current&&window.clearInterval(U.current),null!==W.current&&window.clearTimeout(W.current)},[]);let G=(0,o.useCallback)(t=>{if(e||R)return;let r=B(t?.returnTo);if($(r),y(r),F.current){j(!0),null!==U.current&&window.clearInterval(U.current),null!==W.current&&window.clearTimeout(W.current);let e=!1;U.current=window.setInterval(()=>{if(null!==g(K.current??document)||null!==g(document)){e=!0,j(!0);return}e&&(j(!1),null!==U.current&&(window.clearInterval(U.current),U.current=null))},150),W.current=window.setTimeout(()=>{null!==U.current&&(window.clearInterval(U.current),U.current=null),e||j(!1)},1e4),null!==N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>{N.current=null,(0,h.m)().then(()=>{let e=0,t=()=>{let r=F.current;null!==g(K.current??document)||null!==g(document)?j(!0):(r&&r.click(),(e+=1)>=20||window.requestAnimationFrame(t))};window.requestAnimationFrame(t)}).catch(e=>{console.error("Failed opening embedded Shopify login",e),j(!1);let t=(0,i.lo)({market:S,returnTo:r});(0,d.r0)(t),I.push(t)})},0);return}let n=(0,i.lo)({market:S,returnTo:r});(0,d.r0)(n),I.push(n)},[e,R,S,B,I]);(0,o.useEffect)(()=>{(0,c.CR)({authenticated:R,customerId:x.customerId,shopAddress:x.shopAddress})},[R,x.customerId,x.shopAddress]),(0,o.useEffect)(()=>
1{if(!R||!x.customerId)return;let e=()=>{"visible"===document.visibilityState&&(0,c.TI)()};return window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[R,x.customerId]),(0,o.useEffect)(()=>{(0,m.FF)({authenticated:R,customerId:x.customerId,shopAddress:x.shopAddress,openLogin:G})},[R,x.customerId,x.shopAddress,G]),(0,o.useEffect)(()=>{R&&x.customerEmail&&(0,f.Et)(x.customerEmail)},[R,x.customerEmail]),(0,o.useEffect)(()=>{R&&(j(!1),null!==U.current&&(window.clearInterval(U.current),U.current=null),null!==W.current&&(window.clearTimeout(W.current),W.current=null))},[R]),(0,o.useEffect)(()=>{if(e||R||H||A.startsWith("/admin")||A.startsWith("/account/login")||A.startsWith("/account/logout")||A.startsWith("/auth/"))return;let t=e=>{let t=e instanceof HTMLElement?e:null;if(!t||t.closest('[data-login-gate-ignore="true"]')||t.closest("dialog[open], .dialog[open]"))return null;let r=t.closest('a[href], button, input:not([type="hidden"]), select, textarea, summary, label, [role="button"]');return!r||(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLSelectElement||r instanceof HTMLTextAreaElement?r.disabled:"true"===r.getAttribute("aria-disabled"))?null:r},r=e=>{if(!e.isTrusted||e.defaultPrevented||0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let r=t(e.target);r&&(e.preventDefault(),e.stopPropagation(),q.current=Date.now()+500,G({returnTo:E(r)}))},n=e=>{if(!e.isTrusted||e.defaultPrevented||0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;if(Date.now()<q.current){e.preventDefault(),e.stopPropagation();return}let r=t(e.target);r&&(e.preventDefault(),e.stopPropagation(),G({returnTo:E(r)}))};return document.addEventListener("pointerdown",r,!0),document.addEventListener("click",n,!0),()=>{document.removeEventListener("pointerdown",r,!0),document.removeEventListener("click",n,!0)}},[e,R,H,G,A]);let J=(0,o.useMemo)(()=>({authenticated:R,openLogin:G}),[R,G]);return(0,n.jsxs)(w.Provider,{value:J,children:[T&&!R?(0,n.jsx)("div",{ref:K,className:"sommpicks-shopify-account-launcher-shell","data-login-gate-ignore":"true",children:(0,n.jsx)(s.A,{autoloadScript:!0,buttonClassName:"sr-only",className:"sommpicks-shopify-account sommpicks-shopify-account--launcher",customerAccessToken:T.customerAccessToken,label:"Account",publicAccessToken:T.publicAccessToken,publicStoreDomain:T.publicStoreDomain,returnToOverride:P,slotContent:(0,n.jsx)("span",{}),triggerRef:F,triggerTabIndex:-1})}):null,t]})}}}]);

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.