1import{j as e,cQ as ye,P as p,l as fe,r as x,a8 as ge,A as Y,aS as Se,B as W,cR as be,cS as ve,a3 as we,bk as je,C as ke,p as q,_ as De,z as se,cT as Ce,t as te,cU as Oe,a7 as Ne,cV as Ee,a6 as Me,a9 as Re,cW as Pe,a5 as Te,E as Ae,i as Le,g as Ue,as as Ie,at as Be,n as _e,au as Qe,av as Ke,v as qe,ac as We,o as Ye,L as ze,ad as ae,ae as Fe,af as ne,ag as Ve,ah as He,ai as $e,cX as Ge,aj as Je,T as Xe,cY as Ze}from"./index-BQ6UpNnR.js";import{P as es}from"./PausedBanner-DPBBUYlp.js";import{I as ie}from"./IncompleteOrder-BB2iVqT_.js";import{O as ss}from"./OrderCard-CM-esk0y.js";import{D as ts,U as $}from"./UpcomingOrder-DvL3a9Qp.js";import{D as as}from"./DeliverySettings-DC3Ddxvg.js";import{o as ns}from"./subscriptionData-0cNGdvLo.js";import{S as is}from"./Select-DyLfFmok.js";import{C as rs}from"./CustomizeAlertCopy-DWnSBwm9.js";import"./CancelOrderModal-UL57Mu3q.js";import"./OrderCountdownTimer-CfEZo7po.js";import"./ExpirationIcon-BCI5PL0G.js";import"./Radio-BhjJBX7u.js";import"./index-D17ekaCX.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="f36aae7a-d65c-4f80-83ab-70046d119a26",t._sentryDebugIdIdentifier="sentry-dbid-f36aae7a-d65c-4f80-83ab-70046d119a26")}catch{}})();(function(){var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t._sentryModuleMetadata=t._sentryModuleMetadata||{},(function(){var a,s=new t.Error().stack,i=t._sentryModuleMetadata[s]||{},l={"_sentryBundlerPluginAppKey:mm-sentry-boysenberry":!0},c={};for(a in i)i.hasOwnProperty(a)&&(c[a]=i[a]);for(a in l)l.hasOwnProperty(a)&&(c[a]=l[a]);t._sentryModuleMetadata[s]=c})()})();function P({chargeDate:t}){return t&&e.jsx("p",{className:"text-body-lg mt-30 mb-15 font-grotesk-bold md:mt-40",children:ye(t.date,!0)})}P.propTypes={chargeDate:p.shape({})};P.defaultProps={chargeDate:{}};function re({chargeID:t,setSkipModule:a}){const{isMisfitsTheme:s}=fe(),[i,l]=x.useState(""),[c,y]=x.useState(""),[w,n]=x.useState(""),E=ns.map(o=>({value:o,itemCopy:o,name:o})),j=()=>{be(),a(""),n(""),l(""),y("")},b=async()=>{const o=i==="Other"?`Other: ${c}`:i;try{(await ve(t,{reason:o})).msg==="Success"?j():n("Please try again")}catch{n("Please try again")}},k=o=>{l(o.target.value)},D=o=>{y(o.target.value)};return e.jsxs("div",{id:`skipChargeModule${t}`,className:"relative mt-20 rounded-md border border-black bg-malt p-20 md:px-60 md:py-40",children:[e.jsx("button",{className:"absolute top-10 right-10",type:"button",onClick:j,children:e.jsx(ge,{className:"mt-[2px] w-[24px]"})}),w!==""&&e.jsx(Y,{variant:"error",children:w}),e.jsxs("div",{className:"gap-60 md:flex",children:[e.jsx("img",{src:"https://img-cdn.misfitsmarket.com/boysenberry/images/skipped-order.svg",alt:"Donate",className:"w-70 md:w-[120px]"}),e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"mb-15",children:[e.jsx("p",{className:"text-body-lg mt-20 font-grotesk-bold md:mt-0",children:"Your order is skipped!"}),e.jsx("p",{className:"text-body-sm mt-5",children:"Care to tell us why?"})]}),e.jsxs("div",{className:"max-w-[calc(100vw-80px)] sm:max-w-[calc(100vw-120px)] md:w-auto",children:[e.jsx(is,{labelId:"skip-reason-select",id:"skipReasonSelect",label:"Skip reason",value:i,menuItems:E,onChange:k,isMisfits:s,required:!0}),i==="Other"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-body-sm mt-30 mb-15",children:"Please let us know your reason for skipping"}),e.jsx(Se,{name:"skipReasonOther",id:"skipReasonOther",label:"Other",placeholder:"Enter",value:c,onChange:D,rows:2,multiline:!0})]}),e.jsx("div",{className:"mt-20",children:e.jsx(W,{id:`submitSkipReason${t}`,size:"md",disabled:!i||i==="Other"&&c==="",onClick:b,children:"Submit"})})]})]})]})]})}re.propTypes={chargeID:p.number.isRequired,setSkipModule:p.func.isRequired};function G({account:t,charge:a,chargeID:s,handleToast:i,next:l,setAlert:c,setSkipModule:y,skipModule:w}){var U,S;const n=we(),E=je(),{cartMinimum:j,marketplaceOpen:b,nextOrder:k}=t,[D,o]=x.useState(!1),T=a.status==="SCHEDULED",f=a.status==="SKIPPED",m=a.status==="PLEDGED",C=d=>{n.invalidateQueries({queryKey:[Ne]}),n.invalidateQueries({queryKey:[Ee]}),n.invalidateQueries({queryKey:[Me]}),i(d)},M=async()=>{var d;
1try{await Oe(s),o(!1),te("order donate complete"),C("Thank you! Your upcoming box will be donated."),window.scrollTo({top:0,behavior:"smooth"}),window.isNativeApp&&((d=window.ReactNativeWebView)==null||d.postMessage(JSON.stringify({reload:!0})))}catch{i("Unable to donate box.")}},O=async()=>{var d;try{await Te(s),C("You're all set. We've undone the donation"),window.scrollTo({top:0,behavior:"smooth"}),b&&s===k.chargeID&&c("customize"),window.isNativeApp&&((d=window.ReactNativeWebView)==null||d.postMessage(JSON.stringify({reload:!0})))}catch{i("Unable to undo donation")}},z=async()=>{var d;try{await Ce(s,{reason:""}),te("order skip complete",{path:E.pathname,date:q(a.estimatedDeliveryDate.date,!0)}),C("Delivery was skipped."),y(s),window.isNativeApp&&((d=window.ReactNativeWebView)==null||d.postMessage(JSON.stringify({reload:!0})))}catch{i("Unable to skip delivery.")}},A=async()=>{var d;try{await Re(s),C("Delivery was unskipped."),y(""),Pe({sessionKey:s}),b&&s===k.chargeID&&c("customize"),window.isNativeApp&&((d=window.ReactNativeWebView)==null||d.postMessage(JSON.stringify({reload:!0})))}catch{i("Unable to unskip delivery.")}},L=()=>f?A():O();return e.jsxs(ke,{id:`upcomingCharge${s}`,marginClasses:"mb-20",children:[T&&e.jsxs("div",{className:"items-center justify-between md:flex",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"font-grotesk-bold",children:[q(a.estimatedDeliveryDate.date,!0)," Delivery"]}),l&&!b&&!f&&!m&&e.jsx("div",{className:"text-body-sm mt-10",children:e.jsxs(Y,{children:["Shopping window opens"," ",e.jsxs("span",{className:"font-grotesk-bold",children:[q((U=a==null?void 0:a.marketOpen)==null?void 0:U.date)," at"," ",De((S=t==null?void 0:t.marketOpenDate)==null?void 0:S.date)]})]})})]}),!D&&e.jsxs("div",{className:"mt-20 flex gap-10 md:mt-0 md:w-[300px]",children:[e.jsx(W,{size:"md",variant:"secondary",id:`donateBtn${s}`,onClick:()=>o(!0),children:"Donate"}),e.jsx(W,{size:"md",id:`skipBtn${s}`,onClick:z,children:"Skip"})]})]}),(f||m)&&e.jsxs("div",{className:"items-center justify-between md:flex",children:[e.jsxs("p",{className:"flex items-center font-grotesk-bold",children:[e.jsxs("span",{className:"mr-10",children:[q(a.scheduledAt.date,!0)," Charge"]}),f?e.jsx(se,{variant:"dark",children:"SKIPPED"}):e.jsx(se,{bgColor:"lime",variant:"dark",children:"DONATED"})]}),e.jsx("div",{className:"mt-20 md:mt-0 md:w-[300px]",children:e.jsx(W,{id:`undoBtn${s}`,size:"md",variant:"secondary",onClick:L,children:"Undo"})})]}),D&&e.jsx(ts,{chargeID:s,donateBox:M,donationAmount:j,setDonateModule:o}),w===s&&e.jsx(re,{chargeID:s,setSkipModule:y})]})}G.propTypes={account:p.shape({}),chargeID:p.number.isRequired,handleToast:p.func.isRequired,next:p.bool,setAlert:p.func.isRequired,setSkipModule:p.func.isRequired,skipModule:p.oneOfType([p.number,p.string]).isRequired};G.defaultProps={account:{},next:!1};function vs(){const t=Ae(),a=Le(),{data:s={},isLoading:i}=Ue(),{data:l={},isLoading:c}=Ie(),{data:y={},isLoading:w}=Be(),{data:n={},isLoading:E}=_e(),{data:j={},isLoading:b}=Qe(),{data:k={},isLoading:D}=Ke(),{plusMembershipEligibleOrder:o,shippingFees:T}=qe(),{isOrderMinMet:f}=We(),[m,C]=x.useState([]),[M,O]=x.useState(""),[z,A]=x.useState(""),[L,U]=x.useState(""),[S,d]=x.useState(!1),[oe,N]=x.useState("");if(x.useEffect(()=>{var r,v;if(n!=null&&n.id){n.variant!=="autoship"&&t("/account");const H=(r=n.charges)==null?void 0:r.filter(u=>(u.status==="SCHEDULED"||u.status==="SKIPPED"||u.status==="PLEDGED")&&u.scheduledAt&&Ye(new Date().toISOString().slice(0,10),u.scheduledAt.date));C(H);const g=(v=y==null?void 0:y.orders)==null?void 0:v.filter(u=>{var X,Z,ee;return((X=u.shipments[0])==null?void 0:X.shippingStatus)==="IN TRANSIT"||((Z=u.shipments[0])==null?void 0:Z.shippingStatus)==="OUT FOR DELIVERY"||((ee=u.shipments[0])==null?void 0:ee.shippingStatus)==="SHIPPED"})[0];d(g||!1)}},[n]),i||w||c||E||b||D)return e.jsx("div",{className:"flex h-[300px] items-center justify-center",children:e.jsx(ze,{width:"60px"})});const{marketplaceOpen:R,nextOrder:h,pendingOrder:I}=s??{},{plusMembershipShippingFee:de}=T??{},le=(n==null?void 0:n.status)==="PAUSED",ce=(I==null?void 0:I.status)==="SCHEDULED"?I:h,F=o?ae.PLUS_MEMBER:ae.DEFAULT,B=Fe(l),ue=ne({options:{priceType:F},products:B}),_=Ve(l),J=He(l),pe=ne({options:{priceType:F},products:_}),V=$e({account:s,credits:j,discounts:k,options:{priceType:F,isOrderMinMet:f},plusMembership:{plusMembershipShippingFee:de},selections:l}),Q=r=>{M?(O(""),setTimeout(()=>O(r),200)):O(r)},me=Ge(m),he=h.status==="PLEDGED"||h.status==="SKIPPED",K=Je({selections:l}),xe=()=>!he&&R?e.jsxs(e.Fragment,{children:[f&&K&&e.jsx($,{marketplaceOpen:R,selections:[...B,..._],nextOrder:h,orderTotal:V,handleToast:Q,setSkipModule:N,onDeliverySchedulePage:!0,groceryAndWineOrder:!0}),f&&!K&&e.jsx($,{marketplaceOpen:R,selections:B,nextOrder:h,orderTotal:V,handleToast:Q,setSkipModule:N,onDeliverySchedulePage:!0}
1),!f&&e.jsx(ie,{nextOrderDate:h.orderScheduledDate.date,selections:B,orderTotal:ue,nextOrderStatus:h.status,handleToast:Q,setSkipModule:N,onDeliverySchedulePage:!0}),K&&!f&&e.jsx($,{marketplaceOpen:R,selections:_,nextOrder:h,orderTotal:V,setSkipModule:N,wineOrder:!0}),!K&&J>0&&e.jsx(ie,{nextOrderDate:ce.orderScheduledDate.date,selections:_,orderTotal:pe,setSkipModule:N,wineBottles:J,wineOrder:!0})]}):null;return e.jsxs("section",{children:[!window.isNativeApp&&e.jsx("h1",{className:"text-heading-sm my-20 mt-0",children:"Upcoming Deliveries"}),L!==""&&e.jsx("div",{className:"mb-20",children:e.jsx(Y,{variant:"error",children:L})}),z!==""&&e.jsx(Y,{variant:"success",onClose:()=>A(""),children:e.jsx(rs,{})}),e.jsx(Xe,{copy:M,open:M!=="",handleClose:(r,v)=>v==="timeout"&&O(""),nanoBannerVisible:a}),le&&e.jsx(es,{account:s}),e.jsx(as,{account:s,subscription:n,setError:U}),S&&e.jsxs(e.Fragment,{children:[e.jsx(P,{chargeDate:{date:S.createdOn}}),e.jsx("div",{className:"my-20",children:e.jsx(ss,{order:S,nextOrder:h})},S.orderNumber)]}),!S&&(m==null?void 0:m.length)>0&&e.jsx(P,{chargeDate:m[0].estimatedDeliveryDate?m[0].estimatedDeliveryDate:m[0].scheduledAt}),xe(),n.status!=="CANCELLED"&&e.jsx("div",{children:m.map((r,v)=>{const H=r.status==="PLEDGED"||r.status==="SKIPPED";if(r.id===h.chargeID&&R&&!H)return null;const g=r.estimatedDeliveryDate||r.scheduledAt,u=(g==null?void 0:g.date)&&Ze(g==null?void 0:g.date).split("/")[1];return e.jsxs("div",{children:[(u<=7&&n.orderUnitInterval===1&&v!==0||u<=14&&n.orderUnitInterval!==1&&v!==0)&&e.jsx(P,{chargeDate:g}),e.jsx(G,{account:s,charge:r,chargeID:r.id||h.chargeID,next:me.id===r.id,handleToast:Q,skipModule:oe,setSkipModule:N,setAlert:A})]},r.id)})})]})}export{vs as Component}; 2//# sourceMappingURL=UpcomingDeliveries-BwO6GDZu.js.map
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.