1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7713],{47713:function(e,t,i){i.r(t),i.d(t,{OrderHistoryList:function(){return w}});var o=i(27573),r=i(7653),d=i(64070),s=i(64387),l=i(4148),n=i(51699),a=i(48057),c=i(35661),u=i.n(c),v=i(10607),m=i(83125),p=i(15514);let h=(e,t)=>"Scheduled"===e||"In Progress"===e||!!("Completed"===e&&t&&30>=x(t)),x=e=>{let t=u()().format("HH:mm"),i=u()().format("YYYY-MM-DD"),o=u()(e,"YYYYMMDD HH:mm").format("YYYY-MM-DD HH:mm"),r=u()(i+" "+t,"YYYY-MM-DD HH:mm"),d=u()(o,"YYYY-MM-DD HH:mm");return Math.floor(r.diff(d,"minutes"))};var y=i(40387),D=i(79386),f=i(47488),j=i(5463),Y=i(596),N=i(41592),H=i(29729),S=i(60329);let g=(0,d.default)(async()=>(await i.e(1566).then(i.bind(i,95235))).NoOrderHistory,{loadableGenerated:{webpack:()=>[95235]}}),w=()=>{let{checkoutHeader_burst_Icon:e,breadCrumb_ChevronArrow_Right_Icon:t,fbrWelcome_ChevronArrow_RightIcon:i}=p.assets,{t:d}=(0,n.$G)(),{rewardsMaintenance:c,isAtomicComponent:x}=(0,l.Vb)(),w=(0,S.TL)(),{showApiFailure:b}=(0,y.useToast)(),{getOrderConfirmationDetails:C,getOrderHistory:O}=(0,N.Z)(),[P,k]=(0,r.useState)([]),[_,I]=(0,r.useState)(!1),[E,J]=(0,r.useState)(!1),A=(0,s.useSession)();(0,r.useEffect)(()=>{var e,t;(null==A?void 0:null===(t=A.data)||void 0===t?void 0:null===(e=t.user)||void 0===e?void 0:e.code)!=="error"&&G()},[]);let G=async()=>{I(!0);try{let{data:e}=await O();k(e),w((0,H.jW)({orderHistoryDetails:e}))}catch(e){b()}finally{I(!1)}},L=async(e,t,i)=>{try{I(!0);let{data:o}=await C(e,void 0,void 0,i),r=e.slice(0,7);w((0,H.XM)(r)),w((0,H.jW)({orderConfirmationDetails:o,orderHistorySection:m.O8o,isGroupOrderDetail:i})),t!==m.Qcz&&(null===D.wJS||void 0===D.wJS||D.wJS.set("activeOrderHistory","active"))}catch(e){b()}},T=(e,t,i)=>e===m.aiX.toLowerCase()?t:i===m.wF8.toLowerCase()?m.wYp:i,Z=E?M(P):M(null==P?void 0:P.slice(0,3));return _?(0,o.jsx)(Y.PageLoader,{placementType:"page",typeOfLoader:"default"}):(0,o.jsxs)("div",{className:"orderHistoryWrapper","data-testid":"order-history-list",children:[(0,o.jsxs)("div",{className:"flex",children:[(0,o.jsx)("h2",{className:"accountSectionTitle",children:d("account.orderHistory")}),!m.mJY&&(0,o.jsx)("span",{className:"accountBurstIcon",children:(0,o.jsx)(j.Z,{...e,id:"img_order_history_menu"})})]}),(null==Z?void 0:Z.length)>0?Z.map(e=>{var i;let r=u()(e.date,"YYYYMMDD HH:mm").format("MMMM DD, YYYY"),s=null==e?void 0:e.orderHistoryDetails.map(e=>{var t,i,r,s,l,n;let a=e.orderStatus===m.J$l?d("account.canceled.text"):"";return e.orderStatus!==m.J$l&&h(e.orderStatus,e.deliveryDate)&&(a=d("account.active.text")),{orderHistory:[{id:null==e?void 0:e.orderId,location:T(null==e?void 0:e.handOff,null==e?void 0:null===(i=e.deliveryAddress)||void 0===i?void 0:null===(t=i.streetAddress1)||void 0===t?void 0:t.slice(0,16),null==e?void 0:e.locationName.slice(0,16)),itemCount:null==e?void 0:e.itemCount,mode:T(e.handOff,d("storeinfo.ordertypes.deliveryicon.title"),e.handOff),price:Number(null==e?void 0:e.totalAmount.toFixed(2)),status:a,isGroupOrder:null==e?void 0:e.isGroupOrder,pointsDetails:(null==c?void 0:c.isRewardMaintenance)?void 0:(0,o.jsxs)("div",{className:"pointsDetais",children:[!!(null==e?void 0:e.earnedPoints)&&(0,o.jsx)("p",{className:"pointsEarnedDetails",children:d("account.pointsEarned",{earnPoints:(0,D._k8)(null==e?void 0:null===(r=e.earnedPoints)||void 0===r?void 0:r.toString())})}),!!(null==e?void 0:e.redeemedPoints)&&!m.bCn&&!m.mJY&&(0,o.jsx)("p",{className:"pointsEarnedDetails",children:d("account.pointsRedeemed",{redeemPoints:(0,D._k8)(null!==(n=null==e?void 0:null===(s=e.pointsSpent)||void 0===s?void 0:s.toString())&&void 0!==n?n:null==e?void 0:null===(l=e.redeemedPoints)||void 0===l?void 0:l.toString())})})]})}]}});return x?(0,o.jsx)(a.MQ,{onClick:L,orders:s,formattedDate:r,verticalDivider:!(m.lwK||m.bCn||m.gsH||m.mJY)}):(0,o.jsxs)("div",{className:"orderHistoryCtr",children:[(0,o.jsx)("h3",{className:"accountNavHeading",children:r}),null==e?void 0:null===(i=e.orderHistoryDetails)||void 0===i?void 0:i.map(e=>{var i,s,l,n,a,u,v;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{"data-testid":"order-history-item-".concat(e.orderId),className:"orderHistoryContainer",role:"button","aria-label":d("order.history.details.item.label",{formattedDate:r,itemCount:e.itemCount,totalAmount:e.totalAmount}),tabIndex:0,onClick:()=>L(null==e?void 0:e.orderId,e.orderStatus,null==e?void 0:e.isGroupOrder),onKeyDown:t=>{"Enter"===t.key&&L(null==e?void 0:e.orderId,e.orderStatus,null==e?void 0:e.isGroupOrder)},children:[(0,o.jsxs)("div",{className:"orderHistoryItems",children:[(0,o.jsxs)("div",{className:"orderItemAndPrice",children:[(0,o.jsxs)("p",{className:"orderITemText",children:[d("checkout.summaryTotalItems.text",{count:e.itemCount}),(0,o.jsx)("span",{className:"dotSeperator bgBlackDot align-middle"}),"$",null===(i=e.totalAmount)||void 0===i?void 0:i.toFixed(2)]}),h(e.orderStatus,e.deliveryDate)&&(0,o.jsx)("p",{className:"activeBadges",children:d("account.active.text")}),(null==e?void 0:e.orderStatus)===m.J$l&&(0,o.jsx)("p",{className:"canceledBadges",children:d("account.canceled.text")})]}),(0,o.jsxs)("div",{className:"expireDate",children:[(0,o.jsx)("span",{children:T(null==e?void 0:e.handOff,null==e?void 0:null===(l=e.deliveryAddress)||void 0===l?void 0:null===(s=l.streetAddress1)||void 0===s?void 0:s.slice(0,16),null==e?void 0:e.locationName.slice(0,16))}),!(m.lwK||m.bCn||m.gsH||m.mJY)&&(0,o.jsx)("span",{className:"dividerSmall mx-2",children:"|"}),(0,o.jsx)("span",{className:"capitalize",children:T(e.handOff,d("storeinfo.ordertypes.deliveryicon.title"),e.handOff)})]})]}
1),(0,o.jsx)(f.Z,{...t,id:"breadcrumbs_name_id"})]},e.orderId),!(null==c?void 0:c.isRewardMaintenance)&&(0,o.jsxs)("div",{className:"pointsDetais",children:[!!(null==e?void 0:e.earnedPoints)&&(0,o.jsx)("p",{className:"pointsEarnedDetails",children:d("account.pointsEarned",{earnPoints:(0,D._k8)(null==e?void 0:null===(n=e.earnedPoints)||void 0===n?void 0:n.toString())})}),!!(null==e?void 0:e.redeemedPoints)&&!m.bCn&&!m.mJY&&(0,o.jsx)("p",{className:"pointsEarnedDetails",children:d("account.pointsRedeemed",{redeemPoints:(0,D._k8)(null!==(v=null==e?void 0:null===(a=e.pointsSpent)||void 0===a?void 0:a.toString())&&void 0!==v?v:null==e?void 0:null===(u=e.redeemedPoints)||void 0===u?void 0:u.toString())})})]})]})})]},e.date)}):(0,o.jsx)(g,{}),(null==P?void 0:P.length)>3&&(0,o.jsxs)("p",{className:"showMorePage","data-testid":"btn_show_more",onClick:()=>{J(!E)},children:[E?d("account.showLess"):d("account.showMore"),(0,o.jsx)("p",{className:(0,v.Z)({"ml-0.5 mt-1 rotate-[90deg]":!E,"rotate-[274deg]":E}),children:(0,o.jsx)(f.Z,{...i,id:"show-more-icon"})})]})]})},M=e=>{let t={};return(null==e?void 0:e.length)>0&&(null==e||e.forEach(e=>{let i=e.orderDate.split(" ")[0];t[i]||(t[i]={date:i,orderHistoryDetails:[]}),t[i].orderHistoryDetails.push(e)})),Object.values(t).reverse()}}}]);
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.