PageSourceSearch

https://bottled-poetry-fine-wine-and-spirits.onrender.com/assets/CheckoutGroupSummary-BQSwI_9G.js

js bottled-poetry-fine-wine-and-spirits.onrender.com collected 2026-10-03 11:40:54 UTC 4,403 bytes, 1 lines download raw bytes

1import{r as d,j as a}from"./jsx-runtime-D2HyDbKh.js";import{u as b}from"./useCheckoutLineUpdate-Cye6vycD.js";import{J as I,u as U,K as q,L as z}from"./root-B5djlNud.js";import{m as O}from"./motion-FGmiHZpJ.js";function M({title:s,titleId:r,...l},o){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":r},l),s?d.createElement("title",{id:r},s):null,d.createElement("path",{fillRule:"evenodd",d:"M11.47 7.72a.75.75 0 0 1 1.06 0l7.5 7.5a.75.75 0 1 1-1.06 1.06L12 9.31l-6.97 6.97a.75.75 0 0 1-1.06-1.06l7.5-7.5Z",clipRule:"evenodd"}))}const F=d.forwardRef(M),k=({storeName:s,totalItems:r,expanded:l,onClick:o})=>a.jsx("button",{className:"flex flex-col",type:"button",onClick:o,children:a.jsxs("div",{className:"flex w-full items-center justify-between py-2",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-semibold",children:s}),a.jsxs("span",{className:"text-sm text-gray-500 ml-2",children:["(",r," item",r>1?"s":"",")"]})]}),a.jsx(O.div,{className:"p-1 rounded-full bg-gray-50 hover:bg-gray-100 hover:cursor-pointer",animate:{rotate:l?0:180},children:a.jsx(F,{width:16})})]})}),D=({checkoutId:s,id:r,totalCostPerUnit:l,amountPerQuantity:o,modifiers:t,displayName:x,image:h,...n})=>{var N;const[g,i]=d.useState(!1),[e,j]=d.useState((n==null?void 0:n.quantity)??1),{onCheckoutLineUpdate:f,fetcher:m}=b(),u=c=>{i(!0),j(c)},T=d.useCallback(()=>{u(e+1)},[e]),L=d.useCallback(()=>{e-1<=0?(i(!1),f({checkoutId:s,lines:[{checkoutLineId:r,quantity:0}]})):u(e-1)},[e,f,s,r]),w=d.useCallback(()=>{u(0)},[]);d.useEffect(()=>{if(!g)return;const c=setTimeout(()=>{f({checkoutId:s,lines:[{checkoutLineId:r,quantity:e}]}),i(!1)},500);return()=>clearTimeout(c)},[g,e,r,s,f]);const R=m.state!=="idle",E=t!=null&&t.length?t.map(c=>{var v,p,y;const C=((y=(p=(v=c==null?void 0:c.modifier)==null?void 0:v.name)==null?void 0:p.trim)==null?void 0:y.call(p))??"";return C?(c==null?void 0:c.quantity)>1?`${C} (${c.quantity})`:C:""}).filter(Boolean).join(", "):null,$=((N=n==null?void 0:n.name)==null?void 0:N.length)>0?n.name:x??"No Name Provided";return a.jsx(I,{...n,image:h,productName:$,uom:n.uom,containerType:n.containerType,packSize:n.packSize,size:n.size,loading:R,quantity:e,onIncrement:T,onDecrement:L,onRemove:w,totalCostPerUnit:l,modifiers:t,amountPerQuantity:o,ingredientsList:E})},V=({totalItems:s,storeName:r,lines:l,checkoutId:o,discounts:t})=>{const[x,h]=d.useState(!0),{ENV:{STOREFRONT:n="PLATFORM"}}=U(),g=()=>{n==="PLATFORM"&&h(e=>!e)},i=t==null?void 0:t.some(e=>e.isValidOnCart);return a.jsxs("div",{className:"grid grid-cols-1",children:[n==="PLATFORM"&&a.jsx(k,{storeName:r,totalItems:s,expanded:x,onClick:g}),a.jsx("div",{className:`grid grid-cols-1 gap-${x?"6":"0"}`,children:l==null?void 0:l.map((e,j)=>{var f,m,u;return a.jsx(D,{expanded:!0,checkoutId:o,id:e.checkoutLineId,quantity:e.quantity,containerType:e.containerType??"",imageUrl:((f=e.image)==null?void 0:f.url)??"",image:e==null?void 0:e.image,name:e.name,displayName:e.displayName??"",packSize:e.packSize??0,size:e.size??0,uom:e.uom??"",hasControls:!1,modifiers:e.modifiers,amountPerQuantity:((m=e.totalCostPerUnit)==null?void 0:m.presentation)??e.unitPrice.presentation,totalCostPerUnit:(u=e.totalCostPerUnit)==null?void 0:u.presentation},`${e.checkoutLineId} ${j}`)})}),t==null?void 0:t.map((e,j)=>a.jsx(q,{isValid:i,code:(e==null?void 0:e.name)??e.code,message:z(e)},`${e.code} ${j}`))]})},K=({checkoutGroupSummaries:s,hasControls:r=!0})=>{const{fetcher:l}=b(),o=d.useMemo(()=>{var t;return((t=l.data)==null?void 0:t.errors)??[]},[l.data]);return a.jsxs("div",{className:"w-full py-2 flex flex-col gap-3 lg:h-[60%] h-fit overflow-auto noScrollBar",children:[o.length>0&&a.jsxs("div",{className:"p-4 mt-4 rounded-xl bg-red-50",children:[a.jsx("h5",{className:"font-semibold text-red-500 text-md",children:"Errors found"}),a.jsx("ul",{children:o==null?void 0:o.map((t,x)=>a.jsx("li",{className:"text-xs font-light text-red-500",children:t},`${t}-${x}`))})]}),s==null?void 0:s.map((t,x)=>{var n;const h=(n=t==null?void 0:t.lines)==null?void 0:n.reduce((g,i)=>g+((i==null?void 0:i.quantity)??0),0);return a.jsx(V,{storeName:t.store.name,totalItems:h,checkoutId:t.checkoutId,lines:t.lines,hasControls:r,discounts:t.discount?[t.discount]:[]},`${t.checkoutId??t.cartId}-${x}`)})]})};export{K as C};

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.