1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4243],{97369:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});var n=s(84297);let r=(0,n.Z)("CheckCircle2",[["path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z",key:"14v8dr"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},45077:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});var n=s(84297);let r=(0,n.Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},28463:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});var n=s(84297);let r=(0,n.Z)("Package",[["path",{d:"M16.5 9.4 7.55 4.24",key:"10qotr"}],["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]])},24349:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});var n=s(84297);let r=(0,n.Z)("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]])},55392:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});var n=s(84297);let r=(0,n.Z)("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2v0a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12v0a2 2 0 0 1-2-2V7",key:"jon5kx"}]])},42027:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});var n=s(84297);let r=(0,n.Z)("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},64975:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_sites/[site]/v2/orders",function(){return s(77487)}])},79706:function(e,t,s){"use strict";s.d(t,{B5:function(){return i},OY:function(){return d},yh:function(){return l}});var n=s(57456);let r=[n.R$.CANCELED,n.R$.CANCELLED,n.R$.FAILED,n.R$.REVERSED],a=e=>!!e&&r.includes(e);function l(e){let t=[],s=[];return Array.isArray(e)&&e.forEach(e=>{e&&(a(e.status)?s.push(e):t.push(e))}),{inProgress:t,terminal:s}}function i(e,t){let s=new Set,n=e=>!(!e||s.has(e.id))&&(s.add(e.id),!0),r=(null!=e?e:[]).filter(n),a=(null!=t?t:[]).filter(n);return a.length?[...r,...a].sort((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()):r}let c={creation_scheduled:"scheduled",created:"created",preparing:"preparing",ready:"ready",in_transit:"inTransit",inTransit:"inTransit",completed:"completed",canceled:"canceled",cancelled:"canceled",failed:"failed",reversed:"reversed"},d=e=>e&&c[e]||null},77487:function(e,t,s){"use strict";s.r(t),s.d(t,{__N_SSG:function(){return eD},default:function(){return ew}});var n=s(85893),r=s(67294),a=s(64192),l=s(31974),i=s(62609),c=s(45123),d=s(51776),o=s(98609);s(519);var u=s(27484),m=s.n(u),x=s(26982),h=s(31955),p=s(97369),f=s(84297);let v=(0,f.Z)("ChefHat",[["path",{d:"M6 13.87A4 4 0 0 1 7.41 6a5.11 5.11 0 0 1 1.05-1.54 5 5 0 0 1 7.08 0A5.11 5.11 0 0 1 16.59 6 4 4 0 0 1 18 13.87V21H6Z",key:"z3ra2g"}],["line",{x1:"6",x2:"18",y1:"17",y2:"17",key:"12q60k"}]]);var j=s(28463);let N=(0,f.Z)("Truck",[["path",{d:"M5 18H3c-.6 0-1-.4-1-1V7c0-.6.4-1 1-1h10c.6 0 1 .4 1 1v11",key:"hs4xqm"}],["path",{d:"M14 9h4l4 4v4c0 .6-.4 1-1 1h-2",key:"11fp61"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}]]);var y=s(42027),b=s(45077),R=s(24349),E=s(41664),g=s.n(E),D=s(11163),w=s(26628),C=s(82586),A=s(53218),O=s(19034),T=s(57456),k=s(80006),S=s(86606),P=s.n(S),Z=s(18672),$=s(31089),L=s(4606),I=s(44674),M=s(79706),z=s(1832);s(20585);var _=s(54976),V=s(55392);let H=(0,f.Z)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);var Y=s(5152),q=s.n(Y),F=s(53307),U=s(48218),B=s(42117);let G=q()(()=>s.e(8181).then(s.bind(s,58181)).then(e=>e.MapContainer),{loadableGenerated:{webpack:()=>[58181]},ssr:!1}),X=q()(()=>s.e(8181).then(s.bind(s,58181)).then(e=>e.TileLayer),{loadableGenerated:{webpack:()=>[58181]},ssr:!1}),K=q()(()=>s.e(8181).then(s.bind(s,58181)).then(e=>e.Marker),{loadableGenerated:{webpack:()=>[58181]},ssr:!1}),Q=q()(()=>s.e(8181).then(s.bind(s,58181)).then(e=>{let{useMap:t}=e,s=e=>{let{boundsKey:s,boundsCoords:n}=e,a=t(),l=(0,r.useRef)(n);l.current=n;let i=(0,r.useCallback)(()=>{let e=l.current;1===e.length?a.setView(e[0],14,{animate:!1}):e.length>1&&a.fitBounds(e,{padding:[24,24],maxZoom:15,animate:!1})},[a]);return(0,r.useEffect)(()=>{let e=a.getContainer();a.invalidateSize();let t=requestAnimationFrame(()=>a.invalidateSize()),s=new ResizeObserver(()=>a.invalidateSize());s.observe(e);let n=new IntersectionObserver(e=>{var t;(null===(t=e[0])||void 0===t?void 0:t.isIntersecting)&&(a.invalidateSize(),i(),n.disconnect())},{threshold:.01});return n.observe(e),()=>{cancelAnimationFrame(t),s.disconnect(),n.disconnect()}},[a,i]),(0,r.useEffect)(()=>{i()},[s,i]),null};return s.displayName="MapController",s}),{loadableGenerated:{webpack:()=>[58181]},ssr:!1}),W=[T.R$.READY,T.R$.IN_TRANSIT],J={NEAR_DROPOFF:"NEAR_DROPOFF",COMPLETED:"COMPLETED"},ee=s(45243);function et(e,t,s){if(ee)return ee.divIcon({html:e,iconSize:[t,s],iconAnchor:[t/2,s],className:""})}let es="var(--brand-primary, #6366f1)",en=e=>'<svg fill="none" height="35" width="30" viewBox="0 0 30 35" xmlns="http://www.w3.org/2000/svg"><path d="'.concat("m28.2 0h-26.4c-.47739 0-.935228.189641-1.272794.527206-.337565.337566-.527206.795404-.527206 1.272794v26.4c0 .4774.189641.9352.527206 1.2728.337566.3376.795404.5272 1.272794.5272h8.7l4.5 4.5 4.5-4.5h8.7c.4774 0 .9352-.1896 1.2728-.5272s.5272-.7954.5272-1.2728v-26.4c0-.47739-.1896-.935228-.5272-1.272794-.3376-.337565-.7954-.527206-1.2728-.527206z",'" fill="').concat(es,'"/><path d="').concat(e,'" fill="#fff"/></svg>'),er=et(en("m8 9h14c.55 0 1-.45 1-1s-.45-1-1-1h-14c-.55 0-1 .45-1 1s.45 1 1 1zm15.16 1.8c-.09-.46-.5-.8-.98-.8h-14.36c-.48 0-.89.34-.98.8l-1 5c-.12.62.35 1.2.98 1.2h.18v5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1v-5h4v5c0 .55.45 1 1 1s1-.45 1-1v-5h.18c.63 0 1.1-.58.98-1.2zm-8.16 10.2h-6v-4h6z"),30,35),ea=et(en("m15 5c-3.87 0-7 3.13-7 7 0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"),30,35),el=et('<svg fill="none" height="50" width="42" viewBox="0 0 42 50" xmlns="http://www.w3.org/2000/svg"><path d="m34.9391 34.95-.1463.1464v.0647l-14.1126 14.1307-14.20784-14.2765-.00084-.0008-.06451-.0645c-2.82081-2.8226-4.74169-6.4186-5.519713-10.3333-.778024-3.9147-.378241-7.9722 1.148773-11.6596 1.52701-3.6874 4.11267-6.83901 7.43001-9.05633 3.31732-2.21731 7.21742-3.40077 11.20702-3.40077s7.8896 1.18346 11.207 3.40077c3.3173 2.21732 5.903 5.36893 7.43 9.05633s1.9268 7.7449 1.1488 11.6596c-.7781 3.9147-2.6989 7.5107-5.5198 10.3333z" fill="#fff" stroke="'.concat(es,'"/><g fill="').concat(es,'">
1<path d="m28.7062 14.9256c0-1.2626-1.0337-2.2957-2.297-2.2957h-2.297c-.6317 0-1.1485.5165-1.1485 1.1479 0 .6313.5168 1.1478 1.1485 1.1478h2.297v3.0419l-3.9968 4.9932h-4.0427v-4.5915c0-.6313-.5169-1.1478-1.1485-1.1478h-3.4456c-2.5382 0-4.59397 2.0546-4.59397 4.5914v2.2958c0 .6313.51682 1.1478 1.14847 1.1478h1.1485c0 1.9055 1.539 3.4436 3.4455 3.4436 1.9066 0 3.4456-1.5381 3.4456-3.4436h4.0427c.7006 0 1.3552-.3214 1.7917-.8609l3.9967-4.9932c.3331-.4132.5054-.9183.5054-1.4348zm-13.7821 11.4787c-.6316 0-1.1485-.5165-1.1485-1.1479h2.297c0 .6314-.5168 1.1479-1.1485 1.1479z"/><path d="m13.7756 13.7778h3.4456c.6316 0 1.1485.5166 1.1485 1.1479s-.5169 1.1479-1.1485 1.1479h-3.4456c-.6316 0-1.1485-.5166-1.1485-1.1479s.5169-1.1479 1.1485-1.1479z"/><path d="m28.7062 21.8127c-1.9065 0-3.4455 1.5382-3.4455 3.4436 0 1.9055 1.539 3.4436 3.4455 3.4436s3.4455-1.5381 3.4455-3.4436c0-1.9054-1.539-3.4436-3.4455-3.4436zm0 4.5915c-.6317 0-1.1485-.5165-1.1485-1.1479 0-.6313.5168-1.1478 1.1485-1.1478s1.1485.5165 1.1485 1.1478c0 .6314-.5168 1.1479-1.1485 1.1479z"/></g></svg>'),42,50);function ei(e){let{orderId:t,orderStatus:s}=e,[a,l]=(0,r.useState)(null),i=(0,r.useRef)(null),c=(0,B.V)(s),d=W.includes(c)&&!!U.c3;if((0,r.useEffect)(()=>{if(!d)return;let e=()=>{F.Z.getActiveOrders().then(e=>{var s;let{data:n}=e;if(!(null==n?void 0:n.page))return;let r=Array.isArray(s=n.page)?s.reduce((e,t)=>{var s,n;let r=null===(s=t.deliveries)||void 0===s?void 0:s[0];if(!r)return e;let a=t.store||{},l=r.estimatedTime||r.deliveryTime,i=null;if(l){let e=m()(l).diff(m()(),"m");i=Number.isFinite(e)?e:null}return e[t.id]={delivery:{status:r.status},destination:{address:t.userAddress||"",coords:[r.latitude,r.longitude],hasCoords:!!(r.latitude&&r.longitude)},driver:{name:r.riderName||"",coords:[r.currentLatitude,r.currentLongitude],hasCoords:!!(r.currentLatitude&&r.currentLongitude),estimatedTimeArrival:i},store:{address:[a.textAddress,a.commune].filter(Boolean).join(", "),coords:[a.latitude,a.longitude],hasCoords:!!(a.latitude&&a.longitude)},pinCode:null!==(n=r.pinCode)&&void 0!==n?n:null},e},{}):{};r[t]&&l(r[t])}).catch(()=>{})};return e(),i.current=setInterval(e,15e3),()=>{i.current&&clearInterval(i.current)}},[d,t]),!d||!a)return null;let{destination:o,store:u,driver:h,pinCode:p,delivery:f}=a,v=[];if(u.hasCoords&&v.push(u.coords),o.hasCoords&&v.push(o.coords),h.hasCoords&&v.push(h.coords),0===v.length)return null;let j=v.map(e=>"".concat(e[0],",").concat(e[1])).join("|"),y=(()=>{if(f.status===J.COMPLETED)return null;if(f.status===J.NEAR_DROPOFF||null!==h.estimatedTimeArrival&&h.estimatedTimeArrival<=0)return x.ZP.t("OrderTracking:nearDropoff","Por llegar");if(null!==h.estimatedTimeArrival&&Number.isInteger(h.estimatedTimeArrival)){let e=h.estimatedTimeArrival,t=1===e?x.ZP.t("OrderTracking:minute","minuto"):x.ZP.t("OrderTracking:minutes","minutos");return"~".concat(e," ").concat(t)}return null})();return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"relative h-48 w-full overflow-hidden rounded-xl sm:h-64",children:(0,n.jsxs)(G,{bounds:v.length>1?v:void 0,boundsOptions:{padding:[24,24],maxZoom:15},center:1===v.length?v[0]:void 0,zoom:14,scrollWheelZoom:!1,dragging:!1,className:"h-full w-full",style:{zIndex:0},children:[(0,n.jsx)(X,{url:"".concat(U.LP,"?access_token=").concat(U.c3),tileSize:512,zoomOffset:-1}),u.hasCoords&&(0,n.jsx)(K,{icon:er,position:u.coords}),o.hasCoords&&(0,n.jsx)(K,{icon:ea,position:o.coords}),h.hasCoords&&(0,n.jsx)(K,{icon:el,position:h.coords}),(0,n.jsx)(Q,{boundsKey:j,boundsCoords:v})]})}),(0,n.jsxs)("div",{className:"space-y-2 rounded-xl bg-surface-subtle p-3",children:[y&&(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(b.Z,{size:16,className:"shrink-0 text-primary"}),(0,n.jsx)("span",{className:"text-sm font-semibold text-content",children:y})]}),o.address&&(0,n.jsxs)("div",{className:"flex items-start gap-2",children:[(0,n.jsx)(_.Z,{size:16,className:"mt-0.5 shrink-0 text-content-subtle"}),(0,n.jsx)("span",{className:"text-sm text-content-tertiary",children:o.address})]}),u.address&&(0,n.jsxs)("div",{className:"flex items-start gap-2",children:[(0,n.jsx)(V.Z,{size:16,className:"mt-0.5 shrink-0 text-content-subtle"}),(0,n.jsx)("span",{className:"text-sm text-content-tertiary",children:u.address})]}),h.name&&(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(H,{size:16,className:"shrink-0 text-content-subtle"}),(0,n.jsx)("span",{className:"text-sm text-content-tertiary",children:h.name})]}),p&&(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(N,{size:16,className:"shrink-0 text-content-subtle"}),(0,n.jsxs)("span",{className:"text-sm font-semibold text-content",children:["PIN: ",p]})]})]})]})}let ec=[T.R$.SCHEDULED,T.R$.CREATED,T.R$.PREPARING,T.R$.IN_TRANSIT],ed=[T.R$.SCHEDULED,T.R$.CREATED,T.R$.PREPARING,T.R$.READY],eo={[T.R$.SCHEDULED]:x.ZP.t("V2OrderStatus:scheduled"),[T.R$.CREATED]:x.ZP.t("V2OrderStatus:created"),[T.R$.PREPARING]:x.ZP.t("V2OrderStatus:preparing"),[T.R$.READY]:x.ZP.t("V2OrderStatus:ready"),[T.R$.IN_TRANSIT]:x.ZP.t("V2OrderStatus:inTransit"),[T.R$.COMPLETED]:x.ZP.t("V2OrderStatus:completed"),[T.R$.CANCELLED]:x.ZP.t("V2OrderStatus:cancelled"),[T.R$.CANCELED]:x.ZP.t("V2OrderStatus:cancelled"),[T.R$.FAILED]:x.ZP.t("V2OrderStatus:failed"),[T.R$.REVERSED]:x.ZP.t("V2OrderStatus:reversed")},eu={[T.R$.CREATED]:p.Z,[T.R$.PREPARING]:v,[T.R$.READY]:j.Z,[T.R$.IN_TRANSIT]:N,[T.R$.COMPLETED]:p.Z,[T.R$.CANCELLED]:y.Z,[T.R$.CANCELED]:y.Z,[T.R$.REVERSED]:y.Z,[T.R$.SCHEDULED]:b.Z};function em(e){var t,s;let n=e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),r={creation_scheduled:T.R$.SCHEDULED,creationScheduled:T.R$.SCHEDULED,created:T.R$.CREATED,preparing:T.R$.PREPARING,ready:T.R$.READY,inTransit:T.R$.IN_TRANSIT,in_transit:T.R$.IN_TRANSIT,completed:T.R$.COMPLETED,cancelled:T.R$.CANCELLED,canceled:T.R$.CANCELED,failed:T.R$.FAILED,reversed:T.R$.REVERSED};return null!==(s=null!==(t=r[n])&&void 0!==t?t:r[e])&&void 0!==s?s:e}function ex(e){let t=em(e);return t===T.R$.COMPLETED?"success":t===T.R$.CANCELLED||t===T.R$.CANCELED||t===T.R$.FAILED||t===T.R$.REVERSED?"error":"primary"}function eh(e){let{order:t}=e,s=em(t.status),r=t.dispatchMethod===Z.CK.DELIVERY,a=r?ec:ed,l=s===T.R$.SCHEDULED,i=l?a:a.filter(e=>e!==T.R$.SCHEDULED),c=r&&s===T.R$.READY?T.R$.IN_TRANSIT:s,d=i.indexOf(c),o=s===T.R$.CANCELLED||s===T.R$.CANCELED;if(o){var u;return(0,n.jsxs)("div",{className:"flex items-center gap-2 rounded-lg bg-error-soft px-3 py-2 text-sm text-error-emphasis",children:[(0,n.jsx)(y.Z,{className:"h-4 w-4 shrink-0"}),(0,n.jsx)("span",{className:"font-medium",children:null!==(u=eo[s])&&void 0!==u?u:x.ZP.t("V2OrderStatus:cancelled")})]})}return(0,n.jsx)("div",{className:"flex w-full items-center gap-1",children:i.map((e,t)=>{var s;let r=t<=d,a=t===d,l=null!==(s=eu[e])&&void 0!==s?s:p.Z;return(0,n.jsxs)("div",{className:"flex flex-1 flex-col items-center gap-1",children:[(0,n.jsxs)("div",{className:"flex w-full items-center",children:[t>0&&(0,n.jsx)("div",{className:"h-0.5 flex-1 transition-colors ".concat(r?"bg-primary":"bg-line")}),(0,n.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-colors ".concat(a?"bg-primary text-content-inverse":r?"bg-primary/20 text-primary":"bg-surface-muted text-content-subtle"),children:(0,n.jsx)(l,{className:"h-4 w-4"})}),t<i.length-1&&(0,n.jsx)("div",{className:"h-0.5 flex-1 transition-colors ".concat(r&&t<d?"bg-primary":"bg-line")})]}),(0,n.jsx)("span",{className:"text-center text-xs ".concat(a?"font-semibold text-primary":"text-content-muted"),children:eo[e]})]},e)})})}function ep(e){var t,s,r,a,l;let{order:i}=e,c=null!==(l=null!==(a=null===(t=i.payments)||void 0===t?void 0:null===(s=t[0])||void 0===s?void 0:s.type)&&void 0!==a?a:i.paymentMethod)&&void 0!==l?l:"---";return(0,n.jsxs)("div",{className:"space-y-4 rounded-2xl border border-line-subtle bg-surface p-4 shadow-sm",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)(k.Ct,{variant:"primary",children:["#",i.id]}),(0,n.jsx)("span",{className:"text-xs text-content-subtle",children:m()(i.createdAt).format("DD/MM/YYYY HH:mm")}
1)]}),(0,n.jsx)(eh,{order:i}),(0,n.jsx)(ei,{orderId:i.id,orderStatus:i.status}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-content-muted",children:x.ZP.t("OrderData:paymentMethod")}),(0,n.jsx)("p",{className:"font-medium text-content",children:x.ZP.t("PaymentMethods:".concat(c))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-content-muted",children:x.ZP.t("OrderData:store")}),(0,n.jsx)("p",{className:"font-medium text-content",children:i.storeName})]})]}),(0,n.jsx)("div",{className:"border-t border-line-subtle pt-3",children:(0,n.jsx)("ul",{className:"space-y-1 text-sm text-content-secondary",children:null===(r=i.items)||void 0===r?void 0:r.map(e=>(0,n.jsx)("li",{className:"flex justify-between",children:(0,n.jsxs)("span",{children:[e.quantity,"x ",e.name]})},e.id))})}),(0,n.jsxs)("div",{className:"flex items-center justify-between border-t border-line-subtle pt-3",children:[(0,n.jsx)("span",{className:"text-sm font-semibold text-content",children:"Total"}),(0,n.jsx)("span",{className:"text-base font-bold text-content",children:(0,I.T4)(i.totalPrice)})]})]})}function ef(){return(0,n.jsxs)("div",{className:"space-y-4 rounded-2xl border border-line-subtle bg-surface p-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)(k.Od,{className:"h-5 w-16"}),(0,n.jsx)(k.Od,{className:"h-4 w-24"})]}),(0,n.jsx)("div",{className:"flex gap-2",children:[1,2,3,4].map(e=>(0,n.jsxs)("div",{className:"flex flex-1 flex-col items-center gap-1",children:[(0,n.jsx)(k.Od,{className:"h-8 w-8",rounded:"full"}),(0,n.jsx)(k.Od,{className:"h-3 w-12"})]},e))}),(0,n.jsx)(k.Od,{className:"h-16 w-full"}),(0,n.jsx)(k.Od,{className:"h-8 w-full"})]})}function ev(e){var t,s,r;let{order:a,onClick:l}=e,i=null!==(s=null===(t=a.items)||void 0===t?void 0:t.length)&&void 0!==s?s:0;return(0,n.jsxs)("button",{type:"button",onClick:l,className:"flex w-full items-center gap-4 roun
1ded-xl border border-line-subtle bg-surface p-4 text-left shadow-sm transition-shadow hover:shadow-md",children:[(0,n.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-surface-muted",children:(0,n.jsx)(R.Z,{className:"h-5 w-5 text-content-muted"})}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"truncate text-sm font-semibold text-content",children:"Pedido #".concat(a.id)}),(0,n.jsxs)("p",{className:"text-xs text-content-muted",children:[m()(a.createdAt).format("DD/MM/YYYY HH:mm")," \xb7"," ",i," ",1===i?"producto":"productos"]})]}),(0,n.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,n.jsx)("span",{className:"text-sm font-bold text-content",children:(0,I.T4)(a.totalPrice)}),(0,n.jsx)(k.Ct,{variant:ex(a.status),children:null!==(r=eo[em(a.status)])&&void 0!==r?r:em(a.status)})]})]})}function ej(){return(0,n.jsx)("div",{className:"space-y-3",children:[1,2,3].map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-4 rounded-xl border border-line-subtle bg-surface p-4",children:[(0,n.jsx)(k.Od,{className:"h-10 w-10",rounded:"full"}),(0,n.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,n.jsx)(k.Od,{className:"h-4 w-40"}),(0,n.jsx)(k.Od,{className:"h-3 w-28"})]}),(0,n.jsx)(k.Od,{className:"h-5 w-20"})]},e))})}function eN(e){var t,s,r,a,l,i,c,d,o;let{order:u}=e,h=null!==(c=null!==(i=null===(t=u.payments)||void 0===t?void 0:null===(s=t[0])||void 0===s?void 0:s.type)&&void 0!==i?i:u.paymentMethod)&&void 0!==c?c:"---",p=(null!==(d=u.items)&&void 0!==d?d:[]).reduce((e,t)=>e+(0,z.xj)(t.modifiers,t.quantity,t.price),0);return(0,n.jsxs)("div",{className:"space-y-4 p-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)(k.Ct,{variant:"primary",children:["#",u.id]}),(0,n.jsx)(k.Ct,{variant:ex(u.status),children:null!==(o=eo[em(u.status)])&&void 0!==o?o:em(u.status)})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-content-muted",children:"Fecha"}),(0,n.jsx)("p",{className:"font-medium text-content",children:m()(u.createdAt).format("DD/MM/YYYY HH:mm")})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-content-muted",children:x.ZP.t("OrderData:paymentMethod")}),(0,n.jsx)("p",{className:"font-medium text-content",children:x.ZP.t("PaymentMethods:".concat(h))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-content-muted",children:x.ZP.t("OrderData:store")}),(0,n.jsx)("p",{className:"font-medium text-content",children:u.storeName})]})]}),(null===(r=u.store)||void 0===r?void 0:r.phone)&&(0,n.jsxs)("div",{className:"border-t border-line-subtle pt-3 text-sm text-content-tertiary",children:[(0,n.jsxs)("span",{className:"text-content-muted",children:[x.ZP.t("OrderData:storePhone",{defaultValue:"Tel\xe9fono"}),":"," "]}),u.store.phone]}),(0,n.jsxs)("div",{className:"border-t border-line-subtle pt-3",children:[(0,n.jsx)("h3",{className:"mb-2 text-sm font-semibold text-content",children:"Productos"}),(0,n.jsx)("ul",{className:"space-y-2 text-sm",children:null===(a=u.items)||void 0===a?void 0:a.map(e=>(0,n.jsxs)("li",{className:"text-content-secondary",children:[(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsxs)("span",{children:[e.quantity,"x ",e.name]}),(0,n.jsx)("span",{className:"font-medium",children:(0,I.T4)((0,z.xj)(e.modifiers,e.quantity,e.price))})]}),e.modifiers&&e.modifiers.length>0&&(0,n.jsx)("ul",{className:"ml-4 mt-0.5 space-y-0.5",children:e.modifiers.map((t,s)=>(0,n.jsxs)("li",{className:"text-xs text-content-muted",children:[t.quantity&&t.quantity>1?"".concat(t.quantity,"x "):"",t.name]},"".concat(e.id,"-mod-").concat(s)))})]},e.id))})]}),(0,n.jsxs)("div",{className:"space-y-1 border-t border-line-subtle pt-3 text-sm",children:[(0,n.jsxs)("div",{className:"flex justify-between text-content-tertiary",children:[(0,n.jsx)("span",{children:"Subtotal"}),(0,n.jsx)("span",{children:(0,I.T4)(p)})]}),null!=u.delivery&&u.delivery>0&&(0,n.jsxs)("div",{className:"flex justify-between text-content-tertiary",children:[(0,n.jsx)("span",{children:x.ZP.t("OrderDetail
1:deliveryFee",{defaultValue:"Env\xedo"})}),(0,n.jsx)("span",{children:(0,I.T4)(u.delivery)})]}),null!=u.tip&&u.tip>0&&(0,n.jsxs)("div",{className:"flex justify-between text-content-tertiary",children:[(0,n.jsx)("span",{children:"Propina"}),(0,n.jsx)("span",{children:(0,I.T4)(u.tip)})]}),null!=u.discount&&u.discount>0&&(0,n.jsxs)("div",{className:"flex justify-between text-success",children:[(0,n.jsx)("span",{children:"Descuento"}),(0,n.jsxs)("span",{children:["-",(0,I.T4)(u.discount)]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[(0,n.jsx)("span",{className:"font-semibold text-content",children:"Total"}),(0,n.jsx)("span",{className:"text-lg font-bold text-content",children:(0,I.T4)(u.totalPrice)})]})]}),em(u.status)===T.R$.COMPLETED&&(0,n.jsx)("div",{className:"border-t border-line-subtle pt-3",children:(0,n.jsx)(g(),{href:"".concat(L.FK||(null===(l=A.IQ.NPS)||void 0===l?void 0:l.path)||"/nps","?order_id=").concat(u.id),children:(0,n.jsx)(k.zx,{variant:"ghost",fullWidth:!0,className:"!text-primary",children:x.ZP.t("Orders:rateOrder",{defaultValue:"Calificar pedido"})})})})]})}let ey=[{id:$.w9.ORDERS,label:"Pedidos activos"},{id:$.w9.ORDERS_HISTORY,label:"Historial"}];function eb(){return(0,n.jsxs)("div",{className:"flex flex-col items-center gap-4 py-16 text-center",children:[(0,n.jsx)("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-surface-muted",children:(0,n.jsx)(R.Z,{className:"h-10 w-10 text-content-subtle"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-base font-semibold text-content-secondary",children:x.ZP.t("Orders:noOrders")}),(0,n.jsx)("p",{className:"mt-1 text-sm text-content-muted",children:"Tus pedidos aparecer\xe1n aqu\xed"})]}),(0,n.jsx)(g(),{href:"/",children:(0,n.jsx)(k.zx,{variant:"primary",size:"md",children:"Ir al men\xfa"})})]})}function eR(){let e=(0,w.I0)(),t=(0,D.useRouter)(),s=h.Z.get(C.r.accessToken),a=h.Z.get(C.r.guestUserToken);(0,r.useEffect)(()=>{s||a||t.push("/")},[s,a,t]);let{activeOrders:l,activeOrdersLoading:i,ordersTab:c,orders:d,ordersLoading:o}=(0,w.v9)(e=>e.order),{activeList:u,historyList:m}=(0,r.useMemo)(()=>{let{inProgress:e,terminal:t}=(0,M.yh)(null==l?void 0:l.page);return{activeList:e,historyList:(0,M.B5)(null==d?void 0:d.page,t)}},[null==l?void 0:l.page,null==d?void 0:d.page]);(0,r.useEffect)(()=>{e(O.default.getActiveOrders());let t=setInterval(()=>{e(O.default.getActiveOrders())},3e4);return()=>clearInterval(t)},[e]),function(){let e=(0,w.I0)(),t=(0,w.v9)(e=>{var t;return null===(t=e.core.settings)||void 0===t?void 0:t.tenant}),s=(0,r.useRef)(null);(0,r.useEffect)(()=>{let n="319e90ca300ad912821a";if(!n||!t)return;let r=new(P())(n,{cluster:"us2"});s.current=r;let a="".concat(t,"-kds-update-status-channel"),l=r.subscribe(a);return l.bind("new-status",t=>{t.order&&e(O.default.getActiveOrders())}),()=>{l.unbind_all(),r.unsubscribe(a),r.disconnect(),s.current=null}},[e,t])}();let p="1"===t.query.fromCheckout,f=u.length>0,v=f||c===$.w9.ORDERS?$.w9.ORDERS:$.w9.ORDERS_HISTORY,[j,N]=(0,r.useState)(v),y=(0,r.useRef)(!1),b=Array.isArray(null==l?void 0:l.page),R=u.length;(0,r.useEffect)(()=>{p||i||!b||0!==R||N($.w9.ORDERS_HISTORY)},[i,R,b,p]),(0,r.useEffect)(()=>{j!==$.w9.ORDERS_HISTORY||y.current||(y.current=!0,e(O.default.getOrders()))},[j,e]);let E=(()=>{let e=t.query.order,s=Array.isArray(e)?e[0]:e,n=s?parseInt(s,10):NaN;return Number.isFinite(n)?n:null})(),g=null!==E&&(u.find(e=>e.id===E)||m.find(e=>e.id===E))||null,A=(0,r.useCallback)(e=>{t.replace({pathname:t.pathname,query:{...t.query,order:e.id}},void 0,{shallow:!0})},[t]),T=(0,r.useCallback)(()=>{let e={...t.query};delete e.order,t.replace({pathname:t.pathname,query:e},void 0,{shallow:!0})},[t]),S=f||p?ey:ey.filter(e=>e.id!==$.w9.ORDERS);return(0,n.jsxs)("div",{className:"mx-auto max-w-2xl px-4 py-6 lg:py-8",children:[(0,n.jsx)("h1",{className:"mb-6 text-2xl font-bold text-content",children:x.ZP.t("Commerce:orders")}),(0,n.jsx)("div",{className:"mb-6 flex gap-2 border-b border-line",children:S.map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>N(e.id),className:"relative pb-3 text-sm font-semibold transition-colors ".concat(j===e.id?"text-primary":"text-content-muted hover:text-content-secondary"),children:[e.label,j===e.id&&(0,n.jsx)("span",{className:"absolute bottom-0 inset-x-0 h-0.5 rounded-full bg-primary"})]},e.id))}),j===$.w9.ORDERS&&(0,n.jsx)("div",{className:"space-y-4",children:i&&0===u.length?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ef,{}),(0,n.jsx)(ef,{})]}):u.length>0?u.map(e=>(0,n.jsx)(ep,{order:e},e.id)):(0,n.jsx)(eb,{})}),j===$.w9.ORDERS_HISTORY&&(0,n.jsx)("div",{className:"space-y-3",children:o&&0===m.length?(0,n.jsx)(ej,{}):m.length>0?m.map(e=>(0,n.jsx)(ev,{order:e,onClick:()=>A(e)},e.id)):(0,n.jsx)(eb,{})}),(0,n.jsx)(k.dy,{open:!!g,onClose:T,title:g?"Pedido #".concat(g.id):"Detalle",children:g&&(0,n.jsx)(eN,{order:g})})]})}var eE=s(17251);let eg=()=>{(0,c.X)();let[e,t]=(0,r.useState)(!1);return((0,r.useEffect)(()=>{t(!0)},[]),e)?(0,n.jsx)(i.SV,{scope:"OrdersScreen",children:(0,n.jsx)(eR,{})}):null};eg.getLayout=function(e){return(0,n.jsxs)(l.p,{children:[(0,n.jsx)(d.Vw,{showCartBar:!1,showBrandBackgroun
1d:!1,children:e}),(0,n.jsx)(eE.Q,{}),(0,n.jsx)(o.O,{}),(0,n.jsx)(a.D,{})]})};var eD=!0,ew=eg},20585:function(){}},function(e){e.O(0,[9774,3176,9269,7662,9306,9403,5039,2237,436,2300,4862,5675,1974,4596,6515,8459,1776,6,7905,7927,3023,7251,2888,179],function(){return e(e.s=64975)}),_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.