1import{r as d,f as B,h as P,i as T,j as e,H as z,B as S,I as _,k as E,l as D}from"./index-Cdxy4NWl.js";try{let s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new s.Error().stack;o&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[o]="52ea1d0f-8ac8-455e-9aa7-bfba861b7d62",s._sentryDebugIdIdentifier="sentry-dbid-52ea1d0f-8ac8-455e-9aa7-bfba861b7d62")}catch{}const R={Fallback:{helpToFix:"Please reload the page.",why:"We couldn't load our available brands due to a technical issue on our end."}},I=[{brandFilter:"Amy's Kitchen",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Amys.png"},{brandFilter:"Bantam Bagel",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Bantam-Bagels.png"},{brandFilter:"Bobo's",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Bobos.png"},{brandFilter:"Dr. Praeger's",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Dr-Praegers.png"},{brandFilter:"Earth's Best",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Earths-Best.png"},{brandFilter:"Eggo",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Eggo.png"},{brandFilter:"Kashi",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Kashi.png"},{brandFilter:"Kodiak Cakes",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Kodiak-Cakes.png"},{brandFilter:"Les Trois Petits Cochons",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Trois-Petits-Cochons.png"},{brandFilter:"Nature's Path",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Natures-Path-Organic.png"},{brandFilter:"Ore-Ida",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Ore-Ida.png"},{brandFilter:"Pillsbury",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Pillsbury.png"},{brandFilter:"Pop-Tarts",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Pop-Tarts.png"},{brandFilter:"Special K",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Special-K.png"},{brandFilter:"Sweet Earth Foods",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Sweet-Earth.png"},{brandFilter:"Teton Waters Ranch",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/TWR.png"},{brandFilter:"Van's",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Vans.png"}],A=[{brandFilter:"Amy's Kitchen",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Amys.png"},{brandFilter:"Annie's Homegrown",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Annies.png"},{brandFilter:"Bagel Bites",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Bagel-Bites.png"},{brandFilter:"California Pizza Kitchen",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/California-Pizza-Kitchen.png"},{brandFilter:"DiGiorno",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/DiGiorno.png"},{brandFilter:"Home Run Inn",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Home-Run-Inn.png"},{brandFilter:"Lean Cuisine",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Lean-Cuisine.png"},{brandFilter:"Outsider's Pizza Company",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Outsiders-Pizza.png"},{brandFilter:"Red Baron",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Red-Baron.png"},{brandFilter:"Stouffer's",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Stouffers.png"},{brandFilter:"Totino's",imageSrc:"//cdn.tovala.com/tovala.com/brands/sts/Totinos.png"}],J=()=>{const[s,o]=d.useState(""),[m,g]=d.useState(null),[n,v]=d.useState("pizza"),[f,b]=d.useState(""),{data:y=[],error:j,isError:F}=B(),h=y.filter(({customer_visible:a})=>a),N=P(T(h.map(({primary_category:a})=>a))),w=h.filter(({brand:a})=>a==="Trader Joe's").length;let t=h;s?t=t.filter(a=>a.brand===s):m?t=t.filter(a=>a.primary_category===m.value):f&&(t=t.filter(a=>{const r=u(a.brand).toLowerCase(),i=u(a.name).toLowerCase();return`${r} ${i}`.includes(u(f).toLowerCase())}));function p(a){o(a),g(null),b(""),x()}function C(a){o(""),g(a),b(""),x()}function k(a){o(""),g(null),b(a),x()}function x(){window.scrollTo(0,document.body.scrollHeight)}let c={label:"Breakfast",value:"breakfast"};n==="breakfast"?c=null:n==="traderJoes"&&(c={label:"Pizza",value:"pizza"});let l={label:"Trader Joe's",value:"traderJoes"};return n==="breakfast"?l={label:"Pizza",value:"pizza"}:n==="traderJoes"&&(l=null),e.jsxs("div",{className:"pb-24",children:[e.jsx(z,{}),e.jsxs("div",{className:"space-y-20",children:[e.jsx("div",{className:"flex h-[400px] items-center bg-cover bg-center bg-no-repeat",children:e.jsxs("div",{className:"w-1/2 space-y-10 px-16 md:w-full md:px-4",children:[e.jsx("h1",{className:"text-k/52_110 md:text-k/36_110",children:"Scan-to-Cook 1,000+ name-brand groceries."}),e.jsx("p",{className:"text-k/18_120",children:"Cook frozen and pantry favorites perfectly with just the scan of a barcode. No preheat required."})]})}),e.jsxs("div",{className:"flex items-center space-x-10 px-16 md:space-x-4 md:px-4",children:[e.jsx("div",{className:"w-32 text-center",children:c&&e.jsx("a",{className:"cursor-pointer text-orange-1 underline",onClick:()=>{c&&v(c.value)},children:c.label})}),e.jsxs("div",{className:"grow",children:[n==="breakfast"&&e.jsxs("div",{className:"space-y-6",children:[e.jsx("h2",{className:"text-center text-h/38_95",children:"Breakfast Products"}),e.jsx("div",{className:"grid auto-rows-max grid-cols-7 gap-4 md:grid-cols-2",children:I.map(({brandFilter:a,imageSrc:r})=>e.jsx("div",{onClick:()=>{p(a)},children:e.jsx("img",{alt:a,className:"h-20 w-20",src:r})},r))})]}),n==="pizza"&&e.jsxs("div",{className:"space-y-6",children:[e.jsx("h2",{className:"text-center text-h/38_95",children:"Pizza Products"}),e.jsx("div",{className:"grid auto-rows-max grid-cols-7 gap-4 md:grid-cols-2",children:A.map(({brandFilter:a,imageSrc:r})=>e.jsx("div",{onClick:()=>{p(a)},children:e.jsx("img",{alt:a,className:"h-20 w-20",src:r})},r))})]}),n==="traderJoes"&&e.jsxs("div",{className:"space-y-6 text-center",children:[e.jsx("h2",{className:"text-h/38_95",children:"Trader Joe's"}),e.jsxs("p",{children:["We have over ",w," items from Trader Joe's."]}),e.jsx("div",{className:"flex justify-center",children:e.jsx(S,{onClick:()=>{p("Trader Joe's")},size:"large",children:"Explore"})})]})]}),e.jsx("div",{className:"w-32 text-center",children:l&&e.jsx("a",{className:"cursor-pointer text-orange-1 underline",onClick:()=>{l&&v(l.value)},children:l.label})})]}),e.jsxs("div",{className:"flex divide-x divide-grey-3 md:flex-col md:divide-x-0 md:divide-y",children:[e.jsxs("div",{className:"w-1/2 space-y-4 bg-grey-2 p-16 md:w-full md:px-4 md:pb-10 md:pt-20",children:[e.jsx("h3",{className:"text-h/38_95 md:text-center md:text-h/34_100",children:"Find your favorite."}),e.jsx("p",{className:"md:text-center",children:"See if your favorite grocery store is a Scan-to-Cook Grocery."}),e.jsxs("form",{className:"flex space-x-4",onSubmit:a=>{a.preventDefault();const i=new FormData(a.target).get("textSearch")??"";typeof i=="string"&&k(i)},children:[e.jsx("div",{className:"grow",children:e.jsx(_,{name:"textSearch",placeholder:"i.e. Eggo Buttermilk Pancakes"})}),e.jsx(S,{size:"large",type:"submit",children:"Search"})]})]}),e.jsxs("div",{className:"w-1/2 space-y-4 bg-grey-2 p-16 md:w-full md:px-4 md:pb-20 md:pt-10",children:[e.jsx("h3",{className:"text-center text-h/38_95 md:text-h/34_100",children:"Browse by category."}),e.jsx("p",{className:"text-center",children:"Just like you'd browse at the grocery store."}),e.jsx(E,{onChange:a=>{C(a)},options:N.map(a=>({label:a,value:a})),placeholder:"Select a category",value:m})]})]}),e.jsxs("div",{className:"space-y-4 px-16 text-center",children:[e.jsx("h3",{className:"text-h/38_95 md:text-h/34_100",children:"Search Results"}),t.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:[t.length," items"]}),e.jsx("div",{className:"mx-auto max-h-80 w-1/2 space-y-4 overflow-auto md:w-full",children:t.map((a,r)=>
1e.jsxs("p",{children:[a.brand," ",a.name]},r))})]}):F?e.jsx(D,{error:j,errorCodeMessageMap:R}):null]})]})]})};function u(s){return s.replace(/['.]/gi,"")}export{J as default}; 2//# sourceMappingURL=SearchGroceryItemsPage-D0Im06FQ.js.map
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.