PageSourceSearch

https://rare-reserve-production.onrender.com/assets/_kiosk.kiosk._index-CR34v2Rv.js

js rare-reserve-production.onrender.com collected 2026-10-03 11:44:56 UTC 17,058 bytes, 6 lines download raw bytes

1import{r,j as e}from"./jsx-runtime-D2HyDbKh.js";import{u as se,p as re,X as ae}from"./root-BQbCojMu.js";import{K as O}from"./KioskProductCard-D4A2RN_Z.js";import{a as W,u as ne,b as le}from"./components-SDhFL-zL.js";import{c as ie}from"./createLucideIcon-iJ9pEJd7.js";import{C as oe}from"./circle-alert-9e1ZjEZ4.js";import{c as ce}from"./Button-DN0gBET_.js";import{P as de,K as me}from"./KioskProductDetail-CI5tcYte.js";import{X as B,P as ue}from"./index-CSgRVgty.js";import{u as xe}from"./CartProvider-DRDkNzgb.js";import{A as fe}from"./index-C9Ymd-py.js";import{m as z}from"./motion-FGmiHZpJ.js";import{C as pe}from"./circle-check-CUS1uQO8.js";import{C as he}from"./check-DLhAKf5E.js";import{S as ge}from"./shopping-cart-CgbSuC5_.js";import{d as ye,e as be}from"./index-OGzYKti1.js";import"./index-DXqQCM1T.js";import"./useFirstRender-BfqRfFrL.js";import"./formatProductVariantAttributes-B4dzlm21.js";import"./index.esm--4BB0KQy.js";import"./firebase.client-CKNaDRR2.js";import"./performance-0E6KhFrC.js";import"./hub-lKrYKKAf.js";import"./node-5jBVRjIE.js";import"./scroll-restoration-z6xYfQi5.js";import"./Input-CZhQOuOd.js";import"./Divider-DTIW_4YD.js";import"./arrow-left-6qDR8OYQ.js";import"./Loader-B3AeGKAp.js";import"./index-BzOSxPQb.js";/**
2 * @license lucide-react v0.429.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const je=ie("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);function ve(){const{siteConfigs:t,ENV:a}=se(),[c,o]=r.useState(!1),b=(t==null?void 0:t.storeName)??"Store",l=b.charAt(0).toUpperCase(),d=t==null?void 0:t.logo,{src:u}=re({image:d,strapiUrl:a.STRAPI_URL,strapiUploadUrl:a.STRAPI_UPLOAD_URL,presetType:"original"});return e.jsx("div",{className:"relative py-4 px-4 pt-[calc(1rem+env(safe-area-inset-top))]",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[u&&!c?e.jsx("img",{src:u,alt:`${b} logo`,className:"h-12 w-12 md:h-16 md:w-16 rounded-full object-contain",onError:()=>o(!0)}):e.jsx("div",{className:"flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-full bg-cta-primary-500 text-white",children:e.jsx("span",{className:"text-xl font-bold",children:l})}),e.jsx("h1",{className:"text-2xl md:text-3xl font-bold text-gray-900",children:b})]})})}function Ne({collection:t,storeId:a,merchantId:c,isFirst:o=!1,onProductTap:b,totalProducts:l}){const d=t.products.edges.filter(({node:u})=>u.defaultAvailableVariant!=null);return d.length===0?null:e.jsxs("section",{id:`category-${t.slug||t.name.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`,className:`scroll-mt-28 ${o?"":"mt-6 border-t border-gray-200 pt-4"}`,children:[e.jsxs("div",{className:"flex items-center justify-between px-4 mb-3",children:[e.jsx("h2",{className:"text-lg font-bold text-gray-900",children:t.name}),l!=null&&l>d.length&&e.jsx(W,{to:`/kiosk/collection/${t.slug}`,prefetch:"intent",className:"flex min-h-12 items-center text-sm font-medium text-cta-primary-500 active:text-cta-primary-700 transition-colors",children:"View all →"})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 px-4",children:d.map(({node:u},v)=>e.jsx("div",{className:v===0?"col-span-2 md:col-span-1":"",children:e.jsx(O,{product:u,storeId:a,merchantId:c,index:v,onProductTap:b,hero:!1,badge:v===0?"Popular":void 0})},u.id))})]})}function we(){return e.jsxs("div",{className:"animate-pulse",children:[e.jsxs("div",{className:"py-4 px-4 flex flex-col items-center gap-2",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-gray-200"}),e.jsx("div",{className:"h-6 w-36 rounded bg-gray-200"})]}),e.jsx("div",{className:"flex gap-3 px-4 py-2",children:[...Array(4)].map((t,a)=>e.jsx("div",{className:"h-9 w-20 flex-shrink-0 rounded-full bg-gray-200"},a))}),[0,1].map(t=>e.jsxs("div",{className:t===0?"mt-4":"mt-6",children:[e.jsx("div",{className:"px-4 mb-3",children:e.jsx("div",{className:"h-5 w-28 rounded bg-gray-200"})}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 px-4",children:[...Array(4)].map((a,c)=>e.jsxs("div",{className:"rounded-lg border border-gray-100 overflow-hidden",children:[e.jsx("div",{className:"aspect-square bg-gray-200"}),e.jsxs("div",{className:"p-3 space-y-2",children:[e.jsx("div",{className:"h-4 w-full rounded bg-gray-200"}),e.jsx("div",{className:"h-3 w-3/4 rounded bg-gray-200"}),e.jsx("div",{className:"h-4 w-1/3 rounded bg-gray-200"})]})]},c))})]},t))]})}function H({type:t,onRetry:a}){return t==="empty"?e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] px-8 text-center",children:[e.jsx(je,{className:"h-16 w-16 text-gray-300 mb-4"}),e.jsx("p",{className:"text-lg font-medium text-gray-700",children:"This menu is being set up."}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Please order at the counter."})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] px-8 text-center",children:[e.jsx(oe,{className:"h-16 w-16 text-gray-300 mb-4"}),e.jsx("p",{className:"text-lg font-medium text-gray-700",children:"Something went wrong."}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Tap to retry."}),a&&e.jsx("button",{type:"button",onClick:a,className:"mt-6 min-h-12 flex items-center justify-center rounded-full bg-cta-primary-500 px-8 py-3 text-sm font-semibold text-white active:scale-95 transition-transform",children:"Try Again"})]})}function Se({categories:t,activeCategory:a,onCategoryTap:c}){const o=r.useRef(null),b=r.useRef(new Map);return r.useEffect(()=>{if(!a)return;const l=o.current,d=b.current.get(a);if(!l||!d)return;const u=l.offsetWidth,v=d.offsetLeft,f=d.offsetWidth,k=v-u/2+f/2;l.scrollTo({left:k,behavior:"smooth"})},[a]),e.jsx("div",{ref:o,className:"sticky top-0 z-10 bg-white border-b border-gray-100 overflow-x-auto no-scrollbar pt-[env(safe-area-inset-top)]",children:e.jsx("div",{className:"flex gap-2 px-4 py-2",children:t.map(l=>{const d=a===l.slug;return e.jsx("button",{ref:u=>{u&&b.current.set(l.slug,u)},type:"button",onClick:()=>c(l.slug),className:ce("flex-shrink-0 min-h-12 flex items-center rounded-full px-4 py-2 text-sm font-medium whitespace-nowrap transition-colors",d?"bg-cta-primary-500 text-white":"bg-gray-100 text-gray-700"),children:l.name},l.slug)})})})}function ke({value:t,onChange:a,onClear:c}){return e.jsxs("div",{className:"relative",children:[e.jsx(ae,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsx("input",{type:"text",inputMode:"search",enterKeyHint:"search",value:t,onChange:o=>a(o.target.value),onKeyDown:o=>{o.key==="Enter"&&o.currentTarget.blur()},placeholder:"Search menu...",className:"w-full min-h-12 rounded-full bg-gray-100 pl-10 pr-10 text-base text-gray-900 placeholder:text-gray-400 outline-none transition-colors focus:bg-white focus:ring-2 focus:ring-cta-primary-300"}),t&&e.jsx("button",{type:"button",onClick:c,className:"absolute right-1 top-1/2 -translate-y-1/2 flex min-h-12 min-w-12 items-center justify-center rounded-full text-gray-400 hover:text-gray-600 transition-colors touch-manipulation","aria-label":"Clear search",children:e.jsx(B,{className:"h-4 w-4"})})]})}function Ce({open:t,onClose:a,addedProductName:c,suggestions:o,merchantId:b}){const{addToCart:l}=xe(),[d,u]=r.useState(new Set),[v,f]=r.useState(new Set),[k,w]=r.useState(new Set),N=r.useRef(null);r.useEffect(()=>(t&&(u(new Set),f(new Set),w(new Set),N.current=setTimeout(a,8e3)),()=>{N.current&&clearTimeout(N.current)}),[t,a]);const A=r.useCallback(async n=>{if(!(d.has(n.id)||v.has(n.id))){f(x=>new Set(x).add(n.id));try{const x=`kiosk-upsell-${n.variantId}-${Date.now()}`,i=await l(n.variantId,1,b,x,[]);i!=null&&i.success?(u(p=>new Set(p).add(n.id)),N.current&&clearTimeout(N.current),N.current=setTimeout(a,8e3)):(w(p=>new Set(p).add(n.id)),setTimeout(()=>{w(p=>{const I=new Set(p);return I.delete(n.id),I})},2e3))}catch(x){console.error("[kiosk-upsell] Failed to add suggestion:",n.id,x),w(i=>new Set(i).add(n.id)),setTimeout(()=>{w(i=>{const p=new Set(i);return p.delete(n.id),p})},2e3)}finally{f(x=>{const i=new Set(x);return i.delete(n.id),i})}}},[l,b,d,v]);return o.length===0?null:e.jsx(fe,{children:t&&e.jsxs(e.Fragment,{children:[e.jsx(z.div,{initial:{opacity:0}
6,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-40 bg-black/40 pointer-events-none"},"upsell-backdrop"),e.jsxs(z.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{type:"spring",damping:25,stiffness:300},drag:"y",dragConstraints:{top:0},dragElastic:.2,onDragEnd:(n,x)=>{(x.offset.y>80||x.velocity.y>300)&&a()},className:"fixed bottom-0 left-0 right-0 z-50 rounded-t-2xl bg-white pb-[env(safe-area-inset-bottom)] md:left-1/2 md:right-auto md:w-full md:max-w-lg md:-translate-x-1/2 md:shadow-2xl touch-none",children:[e.jsx("div",{className:"flex justify-center py-3",children:e.jsx("div",{className:"h-1 w-10 rounded-full bg-gray-300"})}),e.jsxs("div",{className:"flex items-center gap-2 px-5 pb-3",children:[e.jsx(pe,{className:"h-5 w-5 text-green-500 shrink-0"}),e.jsxs("p",{className:"text-base font-semibold text-gray-900",children:["Added ",c,"!"]})]}),e.jsxs("div",{className:"px-5 pb-2",children:[e.jsx("p",{className:"mb-3 text-sm font-medium text-gray-600",children:"Complete your order:"}),e.jsx("div",{className:"flex gap-3 overflow-x-auto pb-2 md:overflow-x-visible",children:o.map(n=>{const x=d.has(n.id),i=v.has(n.id),p=k.has(n.id);return e.jsxs("div",{className:"flex min-w-[120px] max-w-[140px] shrink-0 flex-col rounded-lg border border-gray-100 bg-white shadow-sm overflow-hidden md:max-w-none md:flex-1 md:shrink",children:[n.imageUrl?e.jsx("img",{src:n.imageUrl,srcSet:n.imageSrcSet,alt:n.name,className:"aspect-square w-full object-cover"}):e.jsx("div",{className:"flex aspect-square w-full items-center justify-center bg-gray-100",children:e.jsx(de,{className:"h-8 w-8 text-gray-300"})}),e.jsxs("div",{className:"flex flex-1 flex-col p-2",children:[e.jsx("p",{className:"text-xs font-medium text-gray-900 line-clamp-1",children:n.name}),e.jsx("p",{className:"text-xs font-semibold text-gray-700 mt-0.5",children:n.price}),e.jsx("button",{type:"button",onClick:()=>A(n),disabled:x||i||p,className:`mt-2 flex min-h-8 items-center justify-center rounded-full text-xs font-semibold transition-colors ${x?"bg-green-100 text-green-700":p?"bg-red-100 text-red-600":i?"bg-cta-primary-400 text-white":"bg-cta-primary-500 text-white active:bg-cta-primary-600"}`,children:x?e.jsx(he,{className:"h-4 w-4"}):i?e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}):p?e.jsx(B,{className:"h-4 w-4"}):e.jsx(ue,{className:"h-4 w-4"})})]})]},n.id)})})]}),e.jsxs("div",{className:"flex gap-3 px-5 pb-4",children:[e.jsx("button",{type:"button",onClick:a,className:"flex min-h-12 flex-1 items-center justify-center rounded-lg border-2 border-gray-200 text-sm font-semibold text-gray-600 transition-colors active:bg-gray-50",children:"Continue browsing"}),e.jsxs(W,{to:"/kiosk/cart",onClick:a,className:"flex min-h-12 flex-1 items-center justify-center gap-2 rounded-lg bg-cta-primary-500 text-sm font-semibold text-white transition-colors active:bg-cta-primary-600",children:[e.jsx(ge,{className:"h-4 w-4"}),"View Cart"]})]})]},"upsell-sheet")]})})}const Ae=["/kiosk/cart","/kiosk/checkout","/kiosk/payment","/kiosk/collection"];function at({currentUrl:t,formMethod:a}){if(a&&a!=="GET")return!0;const c=t.pathname;return!Ae.some(o=>c.startsWith(o))}function nt(){const{collections:t,storeId:a,merchantId:c,error:o}=ne(),b=ye(),l=be(),d=r.useRef(0);r.useEffect(()=>{o&&d.current<1&&(d.current+=1,l.revalidate())},[o,l]);const u=b.state==="loading"||l.state==="loading",v=()=>{l.revalidate()},f=r.useMemo(()=>!t||t.length===0?[]:t.filter(s=>{var g;return(((g=s.products)==null?void 0:g.edges)??[]).some(y=>y.node.defaultAvailableVariant!=null)}).map(s=>({name:s.name,slug:s.slug||s.name.toLowerCase().replace(/[^a-z0-9]+/g,"-")})),[t]),[k,w]=r.useState(()=>{var s;return((s=f[0])==null?void 0:s.slug)??null});r.useEffect(()=>{f.length>0&&!k&&w(f[0].slug)},[f,k]);const N=r.useRef(null),A=r.useRef(!1),n=r.useRef(null);r.useEffect(()=>{if(f.length===0||!N.current)return;let s=null,m=null;const g=new IntersectionObserver(y=>{if(!A.current){for(const j of y)j.isIntersecting&&(m=j.target.id.replace("category-",""));m!==null&&(s!==null&&cancelAnimationFrame(s),s=requestAnimationFrame(()=>{m!==null&&(w(m),m=null),s=null}))}},{root:N.current,rootMargin:"-72px 0px -50% 0px",threshold:0});for(const y of f){const j=document.getElementById(`category-${y.slug}`);j&&g.observe(j)}return()=>{g.disconnect(),s!==null&&cancelAnimationFrame(s)}},[f]);const x=r.useCallback(s=>{const m=N.current,g=document.getElementById(`category-${s}`);if(!m||!g)return;const y=m.querySelector(".sticky"),j=y?y.offsetHeight:64,h=g.offsetTop-j-8;n.current!==null&&clearTimeout(n.current),A.current=!0,w(s),m.scrollTo({top:Math.max(0,h),behavior:"smooth"}),n.current=setTimeout(()=>{const S=g.offsetTop-j-8;Math.abs(m.scrollTop-S)>20&&m.scrollTo({top:Math.max(0,S),behavior:"instant"}),A.current=!1,n.current=null},700)},[]),[i,p]=r.useState(""),I=r.useCallback(()=>p(""),[]),T=le(),R=r.useRef(null);r.useEffect(()=>{R.current&&clearTimeout(R.current);const s=i.trim();if(s)return R.current=setTimeout(()=>{T.load(`/api/kiosk/search?q=${encodeURIComponent(s)}`)},200),()=>{R.current&&clearTimeout(R.current)}},[i]);const C=r.useMemo(()=>!i.trim()||!T.data?null:(T.data.products??[]).map(s=>s.node),[i,T.data]),L=i.trim().length>0,G=L&&T.state!=="idle",[K,U]=r.useState(null),[Q,V]=r.useState(null),X=K!==null,$=r.useCallback((s,m)=>{U(s),V(m??null)},[]),J=r.useCallback(()=>{U(null),V(null)},[]),[M,F]=r.useState({open:!1,productName:"",suggestions:[]}),Y=r.useCallback(s=>{if(!t)return;const m=t.flatMap(g=>{var y;return(((y=g.products)==null?void 0:y.edges)??[]).filter(j=>{var S;const h=j.node;return h.defaultAvailableVariant!=null&&h.slug!==s.slug&&!((S=h.modifierGroup)!=null&&S.some(te=>te.min>0))}).map(j=>{var S;const h=j.node;return{id:h.id,name:h.name,slug:h.slug,variantId:h.defaultAvailableVariant.id,price:h.defaultAvailableVariant.price.presentation,imageUrl:((S=h.defaultAvailableVariant.image)==null?void 0:S.scale1x)??null,imageSrcSet:h.defaultAvailableVariant.image?`${h.defaultAvailableVariant.image.scale1x} 1x, ${h.defaultAvailableVariant.image.scale2x} 2x`:void 0}})}).slice(0,3);F({open:!0,productName:s.name,suggestions:m})},[t]),Z=r.useCallback(()=>{F(s=>({...s,open:!1}))},[]),E=u&&!t,P=!E&&(o||!Array.isArray(t)),D=P?[]:t,_=!E&&!P&&D.length===0,q=!E&&!P&&!_;function ee(){return L?G?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-4 pt-12",children:[e.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-gray-300 border-t-gray-600"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Searching..."})]}):C&&C.length>0?e.jsxs("div",{className:"px-4 pt-4",children:[e.jsxs("p",{className:"mb-3 text-sm text-gray-500",children:[C.length," result",C.length!==1?"s":""," ","for “",i,"”"]}
6),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:C.map(s=>e.jsx(O,{product:s,storeId:a,merchantId:c,onProductTap:$},s.id))})]}):C?e.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 pt-12",children:[e.jsx("p",{className:"text-base font-medium text-gray-900",children:"No results found"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Try a different search term"})]}):null:D.map((s,m)=>{var g,y;return e.jsx(Ne,{collection:s,storeId:a,merchantId:c,isFirst:m===0,onProductTap:$,totalProducts:(y=(g=s.products)==null?void 0:g.pageInfo)==null?void 0:y.totalEdges},s.slug||s.name)})}return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex h-full flex-col",children:e.jsxs("div",{ref:N,className:`relative min-h-0 flex-1 overflow-y-auto${q?" pb-[60vh]":""}`,children:[e.jsx(ve,{}),E&&e.jsx(we,{}),P&&e.jsx(H,{type:"error",onRetry:v}),_&&e.jsx(H,{type:"empty"}),q&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white px-4 py-2 shadow-sm",children:e.jsx(ke,{value:i,onChange:p,onClear:I})}),!L&&f.length>=2&&e.jsx(Se,{categories:f,activeCategory:k,onCategoryTap:x}),ee()]})]})}),e.jsx(me,{open:X,onClose:J,productSlug:K,storeId:a,merchantId:c,onAddSuccess:Y,initialImageUrl:Q}),e.jsx(Ce,{open:M.open,onClose:Z,addedProductName:M.productName,suggestions:M.suggestions,merchantId:c})]})}export{nt as default,at as shouldRevalidate};

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.