/* Products listing, Product Detail, Cart, Order Success. Exposes window.AXShop. */ (function(){ const { Button, IconButton, Badge, Rating, PriceTag, QuantityStepper, Eyebrow, ProductCard } = window.AXUI; const Ic=()=>window.AXIcons; const D=()=>window.AX_DATA; const wrap={maxWidth:'var(--container-max)',margin:'0 auto',padding:'0 var(--gutter)'}; const cats=['Short Sleeve Tees','Hoodies & Sweatshirts','Tops','Caps','Hanfu Dresses','Plaid Shirts','Pants','Outerwear']; const sorts=[['featured','Featured'],['price-asc','Price: Low to High'],['price-desc','Price: High to Low'],['newest','Newest']]; /* ---------------- PRODUCTS ---------------- */ function Products({ initialLabel, query, onAdd, onView, onNav }){ const labelCat = cats.includes(initialLabel) ? [initialLabel] : []; const [selCats,setSelCats]=React.useState(labelCat); const [maxPrice,setMaxPrice]=React.useState(150); const [minRating,setMinRating]=React.useState(0); const [sort,setSort]=React.useState('featured'); const i=Ic(); const toggle=(c)=>setSelCats(s=>s.includes(c)?s.filter(x=>x!==c):[...s,c]); let list=D().products.filter(p=> (selCats.length===0||selCats.includes(p.category)) && p.price<=maxPrice && p.rating>=minRating && (!query||p.name.toLowerCase().includes(query.toLowerCase())||p.category.toLowerCase().includes(query.toLowerCase())) ); if(sort==='price-asc')list=[...list].sort((a,b)=>a.price-b.price); if(sort==='price-desc')list=[...list].sort((a,b)=>b.price-a.price); if(sort==='newest')list=[...list].sort((a,b)=>(b.badge==='New')-(a.badge==='New')); const title = initialLabel && !cats.includes(initialLabel) ? initialLabel : (selCats.length===1?selCats[0]:'All Products'); return
Shop

{title}

{list.length} products
{list.length===0 ?
No products match your filters.
:
{list.map(p=>)}
}
; } function FilterBlock({ title, children }){ return
{title}
{children}
; } /* ---------------- PRODUCT DETAIL ---------------- */ function ProductDetail({ product, onAdd, onBuy, onView, onNav }){ const [qty,setQty]=React.useState(1); const [tab,setTab]=React.useState('Description'); const [active,setActive]=React.useState(0); const i=Ic(); const tiles=[product.image || product.accent,'linear-gradient(135deg,#EEF2FF,#E0F7FB)','linear-gradient(135deg,#F4F7FF,#FDEFF6)','linear-gradient(135deg,#EAFBF2,#E7F1FF)']; const related=D().products.filter(p=>p.category===product.category&&p.id!==product.id).slice(0,4); const tabs=['Description','Features','Specifications','Shipping & Returns','Reviews']; return
{product.badge &&
{product.badge}
} {active===0&&product.image ? {product.name} : {product.name.charAt(0)}}
{tiles.map((t,k)=>)}
{product.category}

{product.name}

· {React.createElement(i.Check,{size:15})} In stock · {product.stock} left

{product.description}

{[['Truck','Free shipping over $49'],['Refresh','30-day returns'],['Shield','2-year warranty']].map(([ic,t])=>{React.createElement(i[ic],{size:17,style:{color:'var(--blue-600)'}})}{t})}
{tabs.map(t=>)}
{tab==='Description' &&

{product.description} Designed and quality-checked by AshopNexa, every order ships carbon-neutral and is backed by our satisfaction guarantee.

} {tab==='Features' &&
    {product.features.map(f=>
  • {React.createElement(i.Check,{size:16,sw:2.5})}{f}
  • )}
} {tab==='Specifications' && {Object.entries(product.specifications).map(([k,v])=>)}
{k}{v}
} {tab==='Shipping & Returns' &&

Free standard shipping on orders over $49 (3–5 business days). Express options at checkout. Not the right fit? Return any unused item within 30 days for a full refund — we even cover return shipping on your first order.

} {tab==='Reviews' &&
{D().reviews.map((r,k)=>
{r.name}

“{r.body}”

)}
}

Related products

{related.map(p=>onAdd(pp,1)} onView={onView}/>)}
; } /* ---------------- CART ---------------- */ function Cart({ items, onQty, onRemove, onNav, onCheckout }){ const i=Ic(); const sub=items.reduce((s,it)=>s+it.price*it.qty,0); const ship=sub>49||sub===0?0:6.99; const tax=+(sub*0.08).toFixed(2); const total=+(sub+ship+tax).toFixed(2); if(items.length===0) return
{React.createElement(i.Cart,{size:32})}

Your cart is empty

Looks like you haven't added anything yet.

; return

Shopping cart ({items.length})

{items.map(it=>
{it.name.charAt(0)}
{it.category} {it.name}
onQty(it.id,q)} max={it.stock}/>
)}
; } function OrderSummary({ sub, ship, tax, total, onCheckout, cta='Proceed to Checkout' }){ const i=Ic(); const row=(l,v,strong)=>
{l}{v}
; return
Order summary {row('Subtotal','$'+sub.toFixed(2))} {row('Shipping',ship===0?'Free':'$'+ship.toFixed(2))} {row('Estimated tax','$'+tax.toFixed(2))} {sub>0 && sub<49 &&
Add ${(49-sub).toFixed(2)} more for free shipping
}
{row('Total','$'+total.toFixed(2),true)}
{React.createElement(i.Lock,{size:14})} Secure 256-bit checkout
; } /* ---------------- ORDER SUCCESS ---------------- */ function OrderSuccess({ orderNo, onNav }){ const i=Ic(); return
{React.createElement(i.CheckCircle,{size:42})}

Thank you for your order!

Your order is confirmed. A receipt is on its way to you@example.com.

Order number
{orderNo}
; } window.AXShop = { Products, ProductDetail, Cart, OrderSummary, OrderSuccess }; })();