PageSourceSearch

https://cdn.shef.com/assets/index-96a257cd.js

js shef.com collected 2026-10-02 03:48:40 UTC 8,306 bytes, 2 lines download raw bytes

1import{aa as H,r as g,l as u,j as s,c as Y,D as q,aJ as F}from"./vendor-4dc6bb9b.js";import{k as J,oF as Q,$ as j,pH as X,N as y,b6 as O,nY as w,co as Z,c5 as ee,nX as se,br as te,pM as ie,a9 as re,R,pI as ne}from"./index-53eeb11a.js";import{M as D}from"./MealPlanConstants-968cc978.js";import{u as ae}from"./useMealPlanForUser-a5d7e875.js";import{C as P,a as C}from"./Container-a8612170.js";import{P as oe}from"./PriceBreakdown-906729ce.js";import{B as le}from"./BackBar-4bd04424.js";import{C as $}from"./ComprehensionSection-26c6b090.js";import"./useIsConsolidatedCheckout-b34bfeca.js";import"./useIsReusablePackagingEligibleZip-19871aba.js";import"./useIsReusablePackagingRegionSuspended-c3c796a4.js";import"./utils-16e28326.js";import"./dates-39f1e4ec.js";import"./consts-f461c7c0.js";const ce=({mealPlanTypeOptions:t,currentMealPlanType:e,upcomingDeliveryDates:c,upcomingMealPlanTypes:r,mealPlanId:l,promoCodeApplied:m,isInPricingExperimentTreatment:d})=>{const f=H(),p=J(),{isTreatment:b}=Q(),v=b||d,{refetchMealPlanForUser:M}=ae(),[n,_]=g.useState(e.numServings),[a,E]=g.useState(e.unit),x=g.useMemo(()=>{const o=t.map(({numServings:i})=>{const S=t.some(({numServings:A,unit:U})=>U===a&&A===i),k=a*i<D||!S;return{value:i,isDisabled:k}});return u.uniqBy(o,"value")},[t,a]),N=g.useMemo(()=>[...new Set(t.filter(({numServings:i})=>i===n).map(({unit:i})=>i))].filter(i=>i*n>=D).sort((i,S)=>i-S).map(i=>({value:i,isDisabled:!1})),[t,n]),h=N.some(o=>o.value===a),W=g.useCallback(o=>{p.track(j.MEAL_PLANNING_PLAN_SETTINGS_INPUT_CLICK,{action:"servings_per_week"}),o&&_(o)},[]),V=g.useCallback(o=>{p.track(j.MEAL_PLANNING_PLAN_SETTINGS_INPUT_CLICK,{action:"units_per_week"}),o&&E(o)},[]),[L]=X({variables:{input:{id:l}}}),B=g.useCallback(async()=>{var A;p.track(j.MEAL_PLAN_MODIFIED_CLICKED,{action:"edit_dishes_per_week"});const o=t.find(({numServings:U,unit:z})=>U===n&&z===a);if(u.isNil(o)){y.warning("An error occurred when saving your selection. Please make your selection again and try again."),_(e.numServings),E(e.unit);return}const{errors:i,data:S}=await L({variables:{input:{id:l,mealPlanTypeId:o.id}}}),k=((A=S==null?void 0:S.modifyMealPlan)==null?void 0:A.success)===!1;if(i||k){y.error("An error occurred when saving your selection. Please try again later."),p.track(j.MEAL_PLANNING_MODIFY_PLAN_FAILURE,{action:"edit_dishes_per_week"});return}M().catch(()=>{}),f.push(`${O.CONSUMER_MEAL_PLANS_MANAGE}?success=true`)},[e.numServings,e.unit,f,l,t,L,n,a,M]),K=n!==e.numServings||a!==e.unit,I=g.useMemo(()=>t.find(({numServings:o,unit:i})=>o===n&&i===a)??e,[t,n,a,e]);return s.jsxs("div",{children:[s.jsx(le,{route:O.CONSUMER_MEAL_PLANS_MANAGE}),s.jsx(P,{containerWidth:C.Narrow,className:"border-t border-neutral-100",noPadding:!0,children:s.jsxs("div",{className:"flex flex-col justify-center gap-4 p-4",children:[s.jsx("h1",{className:"text-h5-bold uppercase text-eggplant",children:"PLAN SETTINGS"}),s.jsxs("section",{className:"w-full",children:[s.jsx("p",{className:"mb-4 text-body-600 text-eggplant",children:"Meals per week"}),s.jsx(G,{options:N,selectedValue:a,onSelect:V}),!h&&s.jsxs("p",{className:"mt-2 text-caption-400 text-eggplant-500",children:[a," meals × ",n," ",w("serving",n)," isn't available — pick a meal count above."]})]}),s.jsxs("section",{className:"w-full",children:[s.jsx("p",{className:"mb-4 text-body-600 text-eggplant",children:"Servings per meal"}),s.jsx(G,{options:x,selectedValue:n,onSelect:W})]})]})}),s.jsxs("div",{className:"mb-40 bg-rice pt-6",children:[s.jsxs(P,{className:"flex w-full flex-col gap-2.5 px-4",containerWidth:C.Narrow,children:[s.jsx("p",{className:"text-caption-700-caps text-eggplant-500",children:"UPCOMING DELIVERIES"}),c.map((o,i)=>s.jsx(de,{currentNumServings:(r[i]??e).numServings??e.numServings,currentUnitsPerWeek:(r[i]??e).unit??e.unit,deliveryDate:o,selectedNumServings:n,selectedUnitsPerWeek:a},i))]},"upcoming-deliveries"),s.jsxs(P,{className:"mb-16 mt-4 flex w-full flex-col gap-2.5 border-t border-eggplant-100 bg-rice px-4 py-6",containerWidth:C.Narrow,children:[s.jsx("p",{className:"text-caption-700-caps text-eggplant-500",children:"WEEKLY SERVICE"}),s.jsx(me,{currentNumServings:e.numServings,currentUnitsPerWeek:e.unit,selectedNumServings:n,selectedUnitsPerWeek:a,selectedMealPlanType:I,isInPricingExperimentTreatment:d})]},"recurring-weekly-preferences")]}),s.jsxs("div",{className:"fixed inset-x-0 bottom-0",children:[s.jsx("div",{className:"mb-2",children:s.jsx(oe,{isFloating:!0,mealPlanType:I,mode:"manage",promoCodeApplied:m,isVariableServiceFeeTreatment:v,isInPricingExperimentTreatment:d})}),s.jsx("div",{className:"bg-white",children:s.jsx(P,{containerWidth:C.Narrow,className:"flex px-4 py-3",children:s.jsx(Z,{renderFullWidth:!0,disabled:!K||u.isNil(n)||u.isNil(a)||!h,onClick:B,children:"Update"})})})]})]})},G=({options:t,selectedValue:e,onSelect:c}
1)=>s.jsxs("div",{className:"relative -mx-4",children:[s.jsx("div",{className:"overflow-x-auto px-4 [&::-webkit-scrollbar]:hidden",children:s.jsx("div",{className:"flex w-fit gap-2 md:w-full",children:t.map(({value:r,isDisabled:l})=>{const m=r===e;return s.jsx("button",{type:"button",disabled:l,onClick:()=>c(r),className:Y("flex h-16 w-[53px] shrink-0 items-center justify-center rounded-md border-2 text-caption-700","md:w-auto md:min-w-0 md:flex-1",m?"border-eggplant-500 bg-eggplant-500 text-milk":l?"cursor-default border-eggplant-50 bg-milk text-eggplant-300 opacity-90":"border-eggplant-50 bg-milk text-eggplant"),children:r},r)})})}),s.jsx("div",{className:"pointer-events-none absolute left-0 top-0 z-40 h-full w-[35px] bg-gradient-to-r from-white to-transparent md:hidden"}),s.jsx("div",{className:"pointer-events-none absolute right-0 top-0 z-40 h-full w-[35px] bg-gradient-to-l from-white to-transparent md:hidden"})]}),de=({selectedNumServings:t,selectedUnitsPerWeek:e,currentNumServings:c,currentUnitsPerWeek:r,deliveryDate:l})=>{const m=t!==c||e!==r,{isPastCutoffDate:d}=ee(l.toISO()),f=(b,v)=>`${b} meals x ${v} ${w("serving",v)} each`,p=d?"isPastCutoff":m?"isUpdated":null;return s.jsx($,{iconName:"calendar",textStyle:null,subTextStyle:p,subText:f(d?r:e,d?c:t),text:l.toFormat("cccc, MMMM d")})},me=({currentNumServings:t,currentUnitsPerWeek:e,selectedNumServings:c,selectedUnitsPerWeek:r,selectedMealPlanType:l,isInPricingExperimentTreatment:m})=>{const d=c!==t,f=r!==e,p=se(l);return s.jsx($,{iconName:"main",textStyle:f?"isUpdated":null,subTextStyle:d?"isUpdated":null,subText:`${c} ${w("serving",c)} per meal`,text:`${r} ${w("meal",r)} per week`,tertiaryText:m?`${te(p)}/serving`:void 0})},je=({currentUser:t})=>{var p,b,v,M,n,_,a,E;const{data:e,loading:c}=ie({variables:{userId:t.id??""},skip:u.isNil(t.id)}),r=g.useMemo(()=>{var x;return(x=e==null?void 0:e.getMealPlanTypeOptions)==null?void 0:x.options.map(({mealPlanType:N})=>N).sort((N,h)=>T(N)-T(h))},[(p=e==null?void 0:e.getMealPlanTypeOptions)==null?void 0:p.options]),l=g.useMemo(()=>{var x,N;return((N=(x=e==null?void 0:e.getUpcomingMealPlanGroupOrders)==null?void 0:x.groupOrders)==null?void 0:N.map(({mealPlanType:h})=>h).filter(h=>!u.isNil(h)))||[]},[(b=e==null?void 0:e.getUpcomingMealPlanGroupOrders)==null?void 0:b.groupOrders]),{getMealPlanUpcomingOrder:m}=e??{};if(c)return s.jsx(re,{});const d=(M=(v=e==null?void 0:e.getUpcomingMealPlanGroupOrders)==null?void 0:v.groupOrders)==null?void 0:M.map(({deliveryDate:x})=>q.fromISO(x)).slice(0,2);if(u.isNil(e)||u.isNil(r)||u.isNil(e==null?void 0:e.getActiveMealPlanForUser)||u.isNil((n=e==null?void 0:e.getActiveMealPlanForUser)==null?void 0:n.mealPlanType)||u.isNil(d))return s.jsx(F,{to:R.CONSUMER_MEAL_PLANS_PREFERENCES});const f=e.getActiveMealPlanForUser.pauseEndDate?new Date(e.getActiveMealPlanForUser.pauseEndDate):null;return ne(f)?s.jsx(F,{to:R.CONSUMER_MEAL_PLANS_MANAGE}):s.jsx(ce,{mealPlanTypeOptions:r,currentMealPlanType:e.getActiveMealPlanForUser.mealPlanType,upcomingDeliveryDates:d,upcomingMealPlanTypes:l,mealPlanId:((_=e==null?void 0:e.getActiveMealPlanForUser)==null?void 0:_.id)??"",promoCodeApplied:((a=m==null?void 0:m.mealPlanUpcomingOrder)==null?void 0:a.promoCodeApplied)??null,isInPricingExperimentTreatment:((E=e.getMealPlanTypeOptions)==null?void 0:E.isInPricingExperimentTreatment)??!1})},T=({numServings:t,unit:e})=>t*10+e;export{je as default};
2//# sourceMappingURL=index-96a257cd.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.