PageSourceSearch

https://order.potolo.com/assets/ShopProductList-rtDpb4ld.js

js potolo.com collected 2026-10-01 14:28:19 UTC 3,851 bytes, 1 lines download raw bytes

1import{p as K,bl as V,k as H,l as J,aT as O,aV as q,r as u,dh as w,a$ as B,j as G,ba as U}from"./index-C6BSuULo.js";import{s as W}from"./config-C88VQwap.js";import{i as Y}from"./useShopProductModal-BAPAtIIb.js";import{u as Z}from"./useShopZoneIds-DOv2gdMQ.js";import{S as z}from"./ShopProductGridPage-BsNSpirM.js";import{c as Q,f as X,p as _,a as ee,h as te}from"./shopHomeCache-BCWFhkxa.js";import"./restaurantMappers-BatFheho.js";import"./BogoBadge-mtrhr1Vd.js";/* empty css                           */import"./StoreEmptyState--O6IezUO.js";import"./ShopProductCard-D_JXq_rD.js";const T={popular:"Popular Products","most-reviewed":"Best Reviewed Products","recently-viewed":"Recently Viewed",campaigns:"Item Campaigns",featured:"Featured Products","under-price":"Under Price",latest:"All Products"},I={popular:{title:"No popular products yet",message:"We don't have popular products for your area right now. Try again a little later."},"most-reviewed":{title:"No reviewed products yet",message:"Nothing here has been reviewed yet. Check back once customers start rating products."},"recently-viewed":{title:"Nothing viewed yet",message:"Products you open will show up here so you can find them again quickly."},campaigns:{title:"No campaigns running",message:"There are no item campaigns in your area at the moment."},featured:{title:"No featured products",message:"Nothing is featured for your area right now."},"under-price":{title:"No products in this price range",message:"Nothing is listed in this bucket for your area right now."},latest:{title:"No products yet",message:"There are no products listed for your area right now. Try again a little later."}},$=U("shop:product-list",8),re=(r,g,i,c,f,d)=>{var s;if(r==="popular"||r==="featured"||r==="campaigns"||r==="most-reviewed"){const t=_.get(JSON.stringify(i));return t?r==="popular"?t.popular:r==="featured"?t.featured:r==="campaigns"?t.campaigns:t.reviewed:void 0}const n=ee.get(te(i,c,f,0,d));if(n)return r==="latest"?n.latestProducts:r==="recently-viewed"?n.recentlyViewed:g?(s=n.underPrice.find(t=>t.key===g))==null?void 0:s.products:n.underPrice.flatMap(t=>t.products)},fe=()=>{const{type:r}=K(),[g]=V(),i=g.get("bucket")??"",c=H(),f=J(e=>{var o;return(o=e==null?void 0:e.userData)==null?void 0:o.location}),{lat:d,lng:n}=O(f),s=Z(f),{deliveryTypeNum:t}=q(),a=T[r??""]?r:"popular",y=JSON.stringify([a,i,s,Q(d,n)]),P=()=>$.get(y)??re(a,i,s,d,n,t),[h,m]=u.useState(()=>P()??[]),[j,v]=u.useState(()=>{var e;return(((e=P())==null?void 0:e.length)??0)===0}),[A,M]=u.useState(!1),[L,S]=u.useState(!1),N=u.useRef(1),C=u.useRef(0),b=u.useCallback(async e=>{if(a==="popular")return{raw:await w.getPopularProducts(c,s),hasMore:!1};if(a==="most-reviewed")return{raw:await w.getReviewedProducts(c,s),hasMore:!1};if(a==="campaigns")return{raw:await w.getItemCampaigns(c,s),hasMore:!1};if(a==="featured")return{raw:await w.getFeaturedProducts(c,s),hasMore:!1};const{raw:o,hasMore:p}=await X(c,a,e,{zones:s,lat:d,lng:n,deliveryType:t,bucket:i});return{raw:o,hasMore:p}},[a,i,c,s,d,n,t]),x=e=>(Array.isArray(e)?e:[]).filter(Y).map(W.mapProduct);u.useEffect(()=>{let e=!1;return N.current=1,C.current+=1,(async()=>{const o=P();o&&o.length>0?(m(o),v(!1)):(m([]),v(!0)),S(!1),await B();const{raw:p,hasMore:R}=await b(1),l=x(p);l.length>0&&$.set(y,l),!e&&(m(l),S(R),v(!1),M(!1))})(),()=>{e=!0}},[y,b]);const D=async()=>{if(A)return;M(!0);const e=C.current,o=N.current+1,{raw:p,hasMore:R}=await b(o);if(e!==C.current)return;N.current=o;const l=x(p);m(E=>{const F=new Set(E.map(k=>k.id));return[...E,...l.filter(k=>!F.has(k.id))]}),S(R),M(!1)};return G.jsx(z,{title:a==="under-price"&&i?i:T[a],subtitle:h.length>0?`${h.length}${L?"+":""} product${h.length===1?"":"s"}`:void 0,products:h,loading:j,emptyTitle:I[a].title,emptyMessage:I[a].message,hasMore:L,loadingMore:A,onLoadMore:D})};export{fe as default};

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.