1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9190],{61742:function(e,l,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/cart",function(){return s(65036)}])},65036:function(e,l,s){"use strict";s.r(l);var i=s(85893),t=s(67294),r=s(41664),d=s.n(r),o=s(60970),n=s(65997),a=s(55678),c=s(11163),u=s(35238),m=s(26963),x=s(28753),v=s(62627);l.default=()=>{let{user:e,isUserLoading:l,logout:s}=(0,x.aC)(),{data:r,amountDetails:d,isValidating:n,mutate:a}=(0,x.YE)("cart"),u=(0,c.useRouter)(),m=!(null==r?void 0:r.length)&&!n;return(0,t.useEffect)(()=>{l||((null==e?void 0:e._id)||u.push("/"),(null==e?void 0:e.role)!=="USER"&&(s(),u.push("/login")))},[l,e,u]),(0,i.jsx)(o.YG,{title:"Cart | Dori Handcrafts",children:(0,i.jsx)("section",{className:"main-container py-10 pt-[100px] md:pt-[120px] ",children:(0,i.jsxs)("main",{className:"w-full flex flex-col gap-5",children:[(0,i.jsxs)("h1",{className:"text-gray-800 text-2xl font-semibold px-2",children:["My Cart (",(null==r?void 0:r.length)||0,")"]}),m?(0,i.jsx)("div",{className:"w-full h-[60vh] flex items-center justify-center",children:(0,i.jsx)("p",{className:"text-gray-600 text-lg font-semibold",children:"Cart Is Empty"})}):(0,i.jsxs)("div",{className:"w-full flex flex-col md:flex-row md:gap-10 gap-5 items-start",children:[(0,i.jsxs)("div",{className:"lg:w-[70%] md:w-[80%] w-full md:hidden flex flex-col gap-3",children:[(0,i.jsx)("hr",{}),Array.isArray(r)&&(null==r?void 0:r.map(e=>(0,i.jsxs)(t.Fragment,{children:[(0,i.jsx)(h,{item:e,mutate:a}),(0,i.jsx)("hr",{})]},null==e?void 0:e._id)))]}),(0,i.jsxs)("div",{className:"lg:w-[70%] md:w-[80%] w-full hidden md:flex flex-col gap-3",children:[(0,i.jsx)("hr",{}),Array.isArray(r)&&(null==r?void 0:r.map(e=>(0,i.jsxs)(t.Fragment,{children:[(0,i.jsx)(p,{item:e,mutate:a}),(0,i.jsx)("hr",{})]},null==e?void 0:e._id)))]}),(0,i.jsx)("div",{className:"md:w-[50%] w-full sticky top-[120px] bg-white shadow-md rounded-lg p-4",children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{className:"w-full flex items-center justify-between gap-2",children:[(0,i.jsx)("h2",{className:"text-2xl text-gray-500 font-semibold uppercase",children:"Price Details"}),(0,i.jsxs)("p",{className:"lg:px-6 px-2.5 py-1 lg:text-base text-xs rounded-md bg-green-400 text-white font-medium",children:[null==d?void 0:d.totalDiscount,"% Off"]})]}),(0,i.jsx)("hr",{}),(0,i.jsxs)("div",{className:"flex justify-between",children:[(0,i.jsx)("span",{children:"Total Price"}),(0,i.jsxs)("span",{children:["â¹",null==d?void 0:d.totalMrp]})]}),(0,i.jsxs)("div",{className:"flex justify-between",children:[(0,i.jsx)("span",{children:"Discount"}),(0,i.jsxs)("span",{className:"font-medium text-green-500",children:["â¹",null==d?void 0:d.totalDiscountValue]})]}),(0,i.jsxs)("div",{className:"flex justify-between",children:[(0,i.jsx)("span",{children:"Delivery Charges"}),(0,i.jsx)("span",{children:"â¹25"})]}),(0,i.jsx)("hr",{}),(0,i.jsxs)("div",{className:"flex justify-between text-lg",children:[(0,i.jsx)("span",{className:"font-semibold text-gray-600",children:"Total Amount"}),(0,i.jsxs)("span",{className:"font-semibold",children:["â¹",((null==d?void 0:d.totalPrice)||0)+25]})]}),(0,i.jsx)("hr",{}),(0,i.jsxs)("div",{className:"text-green-600 font-medium",children:["You will save â¹",null==d?void 0:d.totalDiscountValue," on this order"]}),(0,i.jsx)("hr",{}),(0,i.jsx)("div",{onClick:()=>u.push("/checkout"),className:"flex justify-end",children:(0,i.jsx)(v.zx,{type:"submit",children:"Proceed to Checkout"})})]})})]})]})})})};let p=e=>{var l,s,t,r,o,n,v,p,h,g,j,N,w,y;let{item:b,mutate:A}=e,{isLoading:E,mutation:_}=(0,x.Db)(),k=(0,c.useRouter)(),C=async e=>{try{var l,s;let i=await _("cart/".concat(e),{method:"DELETE",isAlert:!0});(null==i?void 0:i.status)===200?(A(),a.Am.success(null==i?void 0:null===(l=i.results)||void 0===l?void 0:l.msg)):a.Am.error(null==i?void 0:null===(s=i.results)||void 0===s?void 0:s.msg)}catch(e){a.Am.error(e instanceof Error?e.message:"Error removing item")}};return(0,i.jsx)("article",{className:"w-full flex flex-col gap-3 md:items-start items-center justify-start lg:px-10",children:(0,i.jsxs)("div",{className:"flex flex-col md:flex-row md:gap-7 gap-5 items-center",children:[(0,i.jsxs)("div",{className:"flex flex-col gap-3 items-center",children:[(0,i.jsx)(d(),{href:"/products/".concat(null==b?void 0:null===(l=b.product)||void 0===l?void 0:l._id,"?variantId=").concat(null==b?void 0:null===(s=b.product)||void 0===s?void 0:s.variantId),className:"md:h-36 h-fit md:w-30 w-40 rounded-lg bg-slate-100 p-2",children:(0,i.jsx)("img",{src:(null==b?void 0:null===(o=b.product)||void 0===o?void 0:null===(r=o.images)||void 0===r?void 0:null===(t=r[0])||void 0===t?void 0:t.imageUrl)||"/home/productimgenotavailable.jpg",className:"h-full w-full object-cover rounded-lg",alt:null==b?void 0:null===(n=b.product)||void 0===n?void 0:n.name})}),(0,i.jsx)(f,{item:b,mutate:A})]}),(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,i.jsx)("span",{className:"text-xl text-gray-800 font-semibold",children:null==b?void 0:null===(v=b.product)||void 0===v?void 0:v.name}),(0,i.jsx)("span",{className:"text-sm",children:null==b?void 0:b.categoryName}),(0,i.jsxs)("span",{className:"text-xs text-gray-400 font-light capitalize",children:["Pack of ",null==b?void 0:b.quantity,", ",null==b?void 0:null===(h=b.product)||void 0===h?void 0:null===(p=h.color)||void 0===p?void 0:p.name," , ",null==b?void 0:null===(j=b.product)||void 0===j?void 0:null===(g=j.category)||void 0===g?void 0:g.name]}),(0,i.jsx)("p",{className:"flex items-center gap-0.5",children:[void 0,void 0,void 0,void 0,void 0].map((e,l)=>{var s;return(null==b?void 0:null===(s=b.product)||void 0===s?void 0:s.star)>=l+1?(0,i.jsx)(m.QJe,{className:"text-amber-500"},l):(0,i.jsx)(u.pIY,{fontSize:"inherit",color:"inherit"},l)})})]}),(0,i.jsxs)("div",{className:"flex gap-1 items-center",children:[(0,i.jsx)("p",{className:"text-sm",children:" Size:"}),(0,i.jsx)("p",{className:"text-sm border rounded-md w-fit py-1 px-3",children:null==b?void 0:b.productSize})]}),(0,i.jsxs)("p",{className:"flex flex-row md:items-center gap-2",children:[(0,i.jsxs)("span",{className:"text-sm line-through font-semibold text-gray-400",children:["â¹",null==b?void 0:null===(N=b.product)||void 0===N?void 0:N.mrp]}),(0,i.jsxs)("span",{className:"text-gray-800 font-semibold text-lg",children:["â¹",null==b?void 0:null===(w=b.product)||void 0===w?void 0:w.price]}),(0,i.jsxs)("span",{className:"text-center px-5 py-1 text-white bg-green-500 rounded-md text-xs font-semibold",children:[null==b?void 0:null===(y=b.product)||void 0===y?void 0:y.discount,"% Off"]})]}),(0,i.jsxs)("div",{className:"w-full flex items-center gap-5",children:[(0,i.jsx)("div",{onClick:()=>C(null==b?void 0:b._id),className:"px-5 py-1 cursor-pointer rounded-md bg-red-500 text-white font-medium text-xs",children:E?(0,i.jsx)("div",{className:"w-5 h-5 rounded-full animate-spin border-y border-solid border-white border-t-transparent shadow-md"}):"Remove"}),(0,i.jsx)("div",{onClick:()=>k.push("/checkout/".concat(null==b?void 0:b._id)),className:"px-5 cursor-pointer py-1 rounded-md bg-[#7B3F00] text-white font-medium text-xs",children:"Buy Now"})]})]})]})})},h=e=>{var l,s,t,r,d,o,n,v,p,h,f;let{item:j,mutate:N}=e,w=(0,c.useRouter)(),{isLoading:y,mutation:b}=(0,x.Db)(),A=async e=>{try{var l,s;let i=await b("cart/".concat(e),{method:"DELETE",isAlert:!0});(null==i?void 0:i.status)===200?(N(),a.Am.success(null==i?void 0:null===(l=i.results)||void 0===l?void 0:l.msg)):a.Am.error(null==i?void 0:null===(s=i.results)||void 0===s?void 0:s.msg)}catch(e){a.Am.error(e instanceof Error?e.message:"Error removing item")}};return(0,i.jsxs)("div",{className:"w-full h-fit flex items-center gap-3 rounded-md bg-white shadow-md p-3",children:[(0,i.jsxs)("div",{className:"flex flex-col gap-2 items-center",children:[(0,i.jsx)("img",{onClick:()=>{var e,l;return w.push("/products/".concat(null==j?void 0:null===(e=j.product)||void 0===e?void 0:e._id,"?variantId=").concat(null==j?void 0:null===(l=j.product)||void 0===l?void 0:l.variantId))},src:null==j?void 0:null===(t=j.product)||void 0===t?void 0:null===(s=t.images)||void 0===s?void 0:null===(l=s[0])||void 0===l?void 0:l.imageUrl,className:"w-32 h-36 object-fill rounded-lg cursor-pointer",alt:null==j?void 0:null===(r=j.product)||void 0===r?void 0:r.name}),(0,i.jsx)(g,{item:j,mutate:N})]}),(0,i.jsxs)("div",{className:"w-full flex items-start flex-col gap-2",children:[(0,i.jsx)("p",{className:"text-gray-900 text-lg font-semibold",children:null==j?void 0:null===(d=j.product)||void 0===d?void 0:d.name}),(0,i.jsxs)("p",{className:"text-xs text-gray-400 font-light capitalize",children:["Pack of ",null==j?void 0:j.quantity,", ",null==j?void 0:null===(n=j.product)||void 0===n?void 0:null===(o=n.color)||void 0===o?void 0:o.name," , ",null==j?void 0:null===(v=j.category)||void 0===v?void 0:v.name]}),(0,i.jsx)("p",{className:"flex items-center",children:[void 0,void 0,void 0,void 0,void 0].map((e,l)=>{var s;return(null==j?void 0:null===(s=j.product)||void 0===s?void 0:s.star)>=l+1?(0,i.jsx)(m.QJe,{className:"text-amber-500"},l):(0,i.jsx)(u.pIY,{fontSize:"inherit",color:"inherit"},l)})}),(0,i.jsxs)("div",{className:"flex gap-1 items-center",children:[(0,i.jsx)("p",{className:"text-sm",children:" Size:"}),(0,i.jsx)("p",{className:"text-sm border rounded-md w-fit py-1 px-3",children:null==j?void 0:j.productSize})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsxs)("p",{className:"flex items-center",children:[(0,i.jsx)(m.NWQ,{className:"text-green-500"}),(0,i.jsxs)("span",{className:"font-semibold text-green-500",children:[null==j?void 0:null===(p=j.product)||void 0===p?void 0:p.discount,"%"]})]}),(0,i.jsxs)("p",{className:"font-semibold text-gray-400 line-through",children:["â¹",null==j?void 0:null===(h=j.product)||void 0===h?void 0:h.mrp]}),(0,i.jsxs)("p",{className:"font-semibold text-lg text-gray-900",children:["â¹",null==j?void 0:null===(f=j.product)||void 0===f?void 0:f.price]})]}),(0,i.jsxs)("div",{className:"w-full flex items-center justify-evenly gap-2",children:[(0,i.jsx)("div",{onClick:()=>A(null==j?void 0:j._id),className:"px-4 py-1 cursor-pointer rounded-md bg-red-500 text-white font-medium text-sm",children:y?(0,i.jsx)("div",{className:"w-5 h-5 rounded-full animate-spin border-y border-solid border-white border-t-transparent shadow-md"}):"Remove"}),(0,i.jsx)("div",{onClick:()=>w.push("/checkout/".concat(null==j?void 0:j._id)),className:"px-4 py-1 cursor-pointer rounded-md bg-yellow-400 text-white font-medium text-sm",children:"Buy Now"})]})]})]})},f=e=>{let{item:l,mutate:s}=e,{isLoading:t,mutation:r}=(0,x.Db)(),{isLoading:d,mutation:o}=(0,x.Db)(),c=async e=>{try{var l,i;let t=await r("cart/increase/".concat(e),{method:"PUT",isAlert:!0});(null==t?void 0:t.status)===200?(s(),a.Am.success(null==t?void 0:null===(l=t.results)||void 0===l?void 0:l.msg)):a.Am.error(null==t?void 0:null===(i=t.results)||void 0===i?void 0:i.msg)}catch(e){a.Am.error(e instanceof Error?e.message:"Error increasing quantity")}},u=async e=>{try{var l,i;let t=await o("cart/decrease/".concat(e),{method:"PUT",isAlert:!0});(null==t?void 0:t.status)===200?(s(),a.Am.success(null==t?void 0:null===(l=t.results)||void 0===l?void 0:l.msg)):a.Am.error(null==t?void 0:null===(i=t.results)||void 0===i?void 0:i.msg)}catch(e){a.Am.error(e instanceof Error?e.message:"Error decreasing quantity")}};return(0,i.jsxs)("p",{className:"flex items-center gap-8 bg-slate-100 p-1 rounded-full",children:[(0,i.jsx)(n.O$V,{onClick:()=>u(null==l?void 0:l._id),className:"p-2 bg-white rounded-full text-orange-600 text-4xl cursor-pointer"}),d||t?(0,i.jsx)("div",{className:"w-3 h-3 rounded-full animate-spin border-y border-solid border-green-500 border-t-transparent shadow-md"}):(0,i.jsx)("span",{children:null==l?void 0:l.quantity}),(0,i.jsx)(n.B4F,{onClick:()=>c(null==l?void 0:l._id),className:"p-2 bg-white rounded-full text-orange-600 text-4xl cursor-pointer"})]})},g=e=>{let{item:l,mutate:s}=e,{isLoading:t,mutation:r}=(0,x.Db)(),{isLoading:d,mutation:o}=(0,x.Db)(),c=async e=>{try{var l,i;let t=await r("cart/increase/".concat(e),{method:"PUT",isAlert:!0});(null==t?void 0:t.status)===200?(s(),a.Am.success(null==t?void 0:null===(l=t.results)||void 0===l?void 0:l.msg)):a.Am.error(null==t?void 0:null===(i=t.results)||void 0===i?void 0:i.msg)}catch(e){a.Am.error(e instanceof Error?e.message:"Error increasing quantity")}},u=async e=>{try{var l,i;let t=await o("cart/decrease/".concat(e),{method:"PUT",isAlert:!0});(null==t?void 0:t.status)===200?(s(),a.Am.success(null==t?void 0:null===(l=t.results)||void 0===l?void 0:l.msg)):a.Am.error(null==t?void 0:null===(i=t.results)||void 0===i?void 0:i.msg)}catch(e){a.Am.error(e instanceof Error?e.message:"Error decreasing quantity")}};return(0,i.jsxs)("p",{className:"flex items-center gap-5 bg-slate-100 p-1 rounded-full",children:[(0,i.jsx)(n.O$V,{onClick:()=>u(null==l?void 0:l._id),className:"p-2 bg-white rounded-full text-orange-600 text-3xl cursor-pointer"}),d||t?(0,i.jsx)("div",{className:"w-3 h-3 rounded-full animate-spin border-y border-solid border-green-500 border-t-transparent shadow-md"}):(0,i.jsx)("span",{children:null==l?void 0:l.quantity}),(0,i.jsx)(n.B4F,{onClick:()=>c(null==l?void 0:l._id),className:"p-2 bg-white rounded-full text-orange-600 text-3xl cursor-pointer"})]})}},9008:function(e,l,s){e.exports=s(7828)}},function(e){e.O(0,[5445,6556,5937,9866,1739,8166,955,1664,9169,307,485,5670,970,2888,9774,179],function(){return e(e.s=61742)}),_N_E=e.O()}]);
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.