PageSourceSearch

https://cooknenjoy.com/_next/static/chunks/104gisfwx091o.js

js cooknenjoy.com collected 2026-10-03 22:23:00 UTC 11,339 bytes, 5 lines download raw bytes

1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="66b27a32-d493-e37a-d603-4bed433a3369")}catch(e){}}();
2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,404315,e=>{"use strict";var t=e.i(249676),s=e.i(846350),r=e.i(469719),a=e.i(7284);function l({isFiltersOpen:e,searchQuery:s,setSearchQuery:r,sortBy:d,setSortBy:i,sortOrder:c,setSortOrder:m,onSaleOnly:u,setOnSaleOnly:p,updateQuery:x,activeListSlug:f}){return(0,t.jsx)("div",{className:(0,a.default)("ease-bezier-[0.4,0,0.2,1] mt-4 overflow-hidden bg-white transition-all duration-500",e?"h-auto pb-2":"h-0"),children:(0,t.jsxs)("form",{className:"grid gap-3 md:grid-cols-[1fr_180px_180px_auto]",onSubmit:e=>{e.preventDefault(),x({q:s.trim()||void 0,sortBy:d,sortOrder:c,onSale:u?"true":void 0,page:"1",list:f||void 0})},children:[(0,t.jsxs)("label",{className:"mr-1 text-sm font-semibold tracking-wide uppercase md:mr-0",children:[(0,t.jsx)("span",{className:"hidden md:block",children:"Buscar"}),(0,t.jsx)("input",{name:"productSearch",value:s,onChange:e=>r(e.target.value),placeholder:"Nome, slug ou URL",className:"searchBar mt-1 w-full px-3 py-2 text-lg outline-none focus:border-[#f97316] md:text-xl"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 md:hidden",children:[(0,t.jsx)(n,{sortBy:d,setSortBy:i}),(0,t.jsx)(o,{sortOrder:c,setSortOrder:m,className:"mr-1 md:mr-0"})]}),(0,t.jsx)(n,{sortBy:d,setSortBy:i,className:"hidden md:block"}),(0,t.jsx)(o,{sortOrder:c,setSortOrder:m,className:"hidden md:block"}),(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsx)("button",{type:"submit",className:"iframeBorder bg-secondary w-full rounded border-2 py-1 leading-7 font-bold uppercase transition-all hover:scale-95 md:w-fit md:px-5 md:py-2.5 md:text-lg",children:(0,t.jsx)("span",{children:"Filtrar"})}),(0,t.jsx)("button",{type:"button",onClick:()=>{r(""),i("updatedAt"),m("desc"),p(!1),x({list:f||void 0,q:void 0,sortBy:void 0,sortOrder:void 0,onSale:void 0,page:"1"})},className:"iframeBorder bg-primary p p mr-1 w-full rounded border-2 border-black py-1 leading-7 font-bold text-white uppercase transition-all hover:scale-95 md:w-fit md:px-5 md:py-2.5 md:text-lg",children:"Limpar"})]}),(0,t.jsxs)("label",{className:"text mt-3 inline-flex items-center gap-2 font-bold uppercase",children:[(0,t.jsx)("input",{type:"checkbox",checked:u,onChange:e=>{p(e.target.checked),x({onSale:e.target.checked?"true":void 0,page:"1"})},className:"searchBar"}),"Apenas em promoção"]})]})})}function n({sortBy:e,setSortBy:s,className:r}){return(0,t.jsxs)("label",{className:`text-sm font-semibold tracking-wide uppercase ${r}`,children:[(0,t.jsx)("span",{className:"hidden md:block",children:"Ordenar por"}),(0,t.jsxs)("select",{name:"sortBy",value:e,onChange:e=>s(e.target.value),className:"searchBar mt-1 w-full cursor-pointer border border-zinc-200 px-3 py-2.5 text-lg outline-none focus:border-[#f97316] md:text-xl",children:[(0,t.jsx)("option",{value:"updatedAt",children:"Recentes"}),(0,t.jsx)("option",{value:"name",children:"Nome"}),(0,t.jsx)("option",{value:"price",children:"Preco"}),(0,t.jsx)("option",{value:"discount",children:"Desconto"})]})]})}function o({sortOrder:e,setSortOrder:s,className:r}){return(0,t.jsxs)("label",{className:`text-sm font-semibold tracking-wide uppercase ${r}`,children:[(0,t.jsx)("span",{className:"hidden md:block",children:"Ordem"}),(0,t.jsxs)("select",{name:"sortOrder",value:e,onChange:e=>s(e.target.value),className:"searchBar mt-1 w-full cursor-pointer px-3 py-2.5 text-lg outline-none focus:border-[#f97316] md:text-xl",children:[(0,t.jsx)("option",{value:"desc",children:"Decrescente"}),(0,t.jsx)("option",{value:"asc",children:"Crescente"})]})]})}function d({label:e="Filtros",setIsOpen:s,isOpen:r}){return(0,t.jsx)("div",{className:"mt-6 mr-1 flex items-center justify-center md:mt-0 md:justify-end",children:(0,t.jsxs)("div",{role:"button",className:"iframeBorder flex w-full cursor-pointer items-center justify-center rounded border-2 border-black bg-stone-200 px-4 py-2 text-sm font-bold uppercase transition-all hover:scale-95 md:w-fit md:text-base",onClick:()=>s(!r),children:[(0,t.jsxs)("div",{className:(0,a.default)("ease-bezier-[
20.4,0,0.2,1] relative mr-2 flex h-2 w-2 items-center justify-center transition-all duration-300",r&&"rotate-45"),children:[(0,t.jsx)("div",{className:"absolute h-0.75 w-3 rounded bg-black shadow-[1px_1px_0px_rgba(255,255,255,1)]"}),(0,t.jsx)("div",{className:"absolute h-0.75 w-3 rotate-90 rounded bg-black"})]}),(0,t.jsx)("span",{children:e})]})})}function i({pagination:e,updateQuery:s}){return(0,t.jsxs)("div",{className:"mt-8 flex flex-wrap items-center justify-center gap-2",children:[(0,t.jsx)("button",{type:"button",disabled:!e.hasPrev,onClick:()=>{s({page:String(Math.max(1,e.page-1))})},className:"rounded-full border border-zinc-200 px-2 py-2 text-xs font-semibold tracking-wide uppercase disabled:cursor-not-allowed disabled:opacity-50",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"size-4",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M7.72 12.53a.75.75 0 0 1 0-1.06l7.5-7.5a.75.75 0 1 1 1.06 1.06L9.31 12l6.97 6.97a.75.75 0 1 1-1.06 1.06l-7.5-7.5Z",clipRule:"evenodd"})})}),Array.from({length:e.totalPages},(e,t)=>t+1).slice(Math.max(0,e.page-4),Math.min(e.totalPages,e.page+4)).map(r=>(0,t.jsx)("button",{type:"button",onClick:()=>s({page:String(r)}),className:"min-w-8.5 rounded-full border px-3 py-2 text-xs font-semibold tracking-wide uppercase",style:{borderColor:r===e.page?"#f97316":"#e4e4e7",color:r===e.page?"#f97316":"#52525b",backgroundColor:r===e.page?"#fff7ed":"#fff"},children:r},r)),(0,t.jsx)("button",{type:"button",disabled:!e.hasNext,onClick:()=>s({page:String(e.page+1)}),className:"flex rounded-full border border-zinc-200 px-2 py-2 text-xs font-semibold tracking-wide uppercase disabled:cursor-not-allowed disabled:opacity-50",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"size-4",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M16.28 11.47a.75.75 0 0 1 0 1.06l-7.5 7.5a.75.75 0 0 1-1.06-1.06L14.69 12 7.72 5.03a.75.75 0 0 1 1.06-1.06l7.5 7.5Z",clipRule:"evenodd"})})})]})}function c({product:e,handleProductClick:s}){return(0,t.jsxs)("article",{className:"flex h-full flex-col",children:[e.imageUrl?(0,t.jsx)("a",{href:e.productUrl,target:"_blank",rel:"noreferrer",onClick:()=>{s(e)},className:"relative mb-1 block h-49.75 overflow-hidden rounded after:absolute after:left-0 after:z-10 after:h-full after:w-full after:rounded after:bg-[rgba(0,0,0,0.03)] after:content-['']",children:(0,t.jsx)("img",{src:e.imageUrl,alt:e.name,loading:"lazy",className:"absolute top-0 right-0 bottom-0 left-0 m-auto max-h-43.5 max-w-52.5"})}):null,(0,t.jsx)("span",{className:"line-clamp-2 overflow-hidden text-base font-bold text-zinc-900",children:e.brand}),(0,t.jsx)("span",{className:"line-clamp-2 overflow-hidden text-base text-zinc-900",children:e.name}),(0,t.jsxs)("div",{className:"jus my-2 items-center gap-2 md:flex",children:[e.discountPercent?(0,t.jsxs)("h4",{className:"flex w-fit items-center rounded bg-rose-700 px-2 py-1 text-xs font-semibold text-white",children:[e.discountPercent," % off"]}):null,e.badge?(0,t.jsx)("span",{className:"inline-flex w-fit rounded bg-rose-50 px-2 py-1 text-xs font-semibold tracking-wide text-rose-700",children:e.badge}):null]}),(e.offerPriceText||e.listPriceText)&&(0,t.jsxs)("div",{className:"mt-2 mb-4",children:[e.listPriceText?(0,t.jsxs)("span",{className:"block text-xs text-zinc-500",children:["Preço sugerido:"," ",(0,t.jsx)("span",{className:"line-through",children:e.listPriceText})]}):null,e.offerPriceText?(0,t.jsx)("span",{className:"block text-xl font-bold text-zinc-900",children:e.offerPriceText}):null]}),(0,t.jsx)("a",{href:e.productUrl,target:"_blank",rel:"noreferrer",onClick:()=>{s(e)},className:"mx-auto mt-auto w-[90%] rounded-full border border-zinc-300 px-4 py-2 text-center text-xs font-semibold tracking-wide text-zinc-900 shadow-sm transition-all hover:bg-zinc-100",children:"Ver detalhes"})]},e._id)}let m="store-product-views";async function u(e,t){try{await fetch(`${e}/api/store/analytics/events`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0})}catch{}}e.s(["default",0,function({apiBaseUrl:e,storefront:a,lists:n,products:o,pagination:p,selectedListSlug:x}
2){let f=(0,s.usePathname)(),h=(0,s.useRouter)(),g=(0,s.useSearchParams)(),[b,j]=(0,r.useState)(x||""),[v,y]=(0,r.useState)(g.get("q")||""),[N,w]=(0,r.useState)(!1),[S,k]=(0,r.useState)(g.get("sortBy")||"updatedAt"),[O,P]=(0,r.useState)(g.get("sortOrder")||"desc"),[B,_]=(0,r.useState)("true"===g.get("onSale"));function C(e){let t=new URLSearchParams(g.toString());Object.entries(e).forEach(([e,s])=>{s&&s.length>0?t.set(e,s):t.delete(e)});let s=t.toString();h.replace(s?`${f}?${s}`:f,{scroll:!1})}async function z(t){await u(e,{eventType:"product_click",vendor:a.vendor,storefrontId:a._id,storefrontName:a.displayName,productId:t._id,productName:t.name,path:`/lojas/${a.slug}`})}return(0,r.useEffect)(()=>{j(x||"")},[x]),(0,r.useEffect)(()=>{y(g.get("q")||""),k(g.get("sortBy")||"updatedAt"),P(g.get("sortOrder")||"desc"),_("true"===g.get("onSale"))},[g]),(0,r.useEffect)(()=>{u(e,{eventType:"storefront_view",vendor:a.vendor,storefrontId:a._id,storefrontName:a.displayName,path:`/lojas/${a.slug}`})},[e,a._id,a.displayName,a.slug,a.vendor]),(0,r.useEffect)(()=>{let t=sessionStorage.getItem(m),s=new Set(t?JSON.parse(t):[]);o.slice(0,p.limit).forEach(t=>{s.has(t._id)||(s.add(t._id),u(e,{eventType:"product_view",vendor:a.vendor,storefrontId:a._id,storefrontName:a.displayName,productId:t._id,productName:t.name,path:`/lojas/${a.slug}`}))}),sessionStorage.setItem(m,JSON.stringify(Array.from(s).slice(-400)))},[e,o,a._id,a.displayName,a.slug,a.vendor]),(0,r.useMemo)(()=>n.find(e=>e.slug===b),[b,n]),(0,t.jsxs)("section",{className:"mx-auto w-full max-w-360 px-6 pb-10",children:[(0,t.jsxs)("header",{className:"mt-8 items-center justify-between bg-white md:flex",children:[(0,t.jsx)("h2",{className:"mt-2 text-2xl font-normal text-zinc-900 md:text-5xl",children:"Ofertas CKNJ"}),(0,t.jsx)(d,{setIsOpen:w,isOpen:N})]}),(0,t.jsx)(l,{isFiltersOpen:N,searchQuery:v,setSearchQuery:y,sortBy:S,setSortBy:k,sortOrder:O,setSortOrder:P,onSaleOnly:B,setOnSaleOnly:_,updateQuery:C,activeListSlug:b}),(0,t.jsxs)("div",{className:"mt-6 flex items-center justify-between text-sm text-zinc-600",children:[(0,t.jsxs)("span",{children:[p.total," produto(s) encontrado(s)"]}),(0,t.jsxs)("span",{children:["Pagina ",p.page," de ",p.totalPages]})]}),(0,t.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-4 md:grid-cols-4 xl:grid-cols-5",children:o.map(e=>(0,t.jsx)(c,{product:e,handleProductClick:z},e._id))}),0===o.length?(0,t.jsx)("p",{className:"mt-6 text-sm text-zinc-600",children:"Nenhum produto encontrado para este filtro."}):null,p.totalPages>1?(0,t.jsx)(i,{pagination:p,updateQuery:C}):null]})}],404315)}]);
3
4//# debugId=66b27a32-d493-e37a-d603-4bed433a3369
5//# sourceMappingURL=0.m3_8p12~_.8.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.