1import{r as h,j as e,P as c,u as M,a as T,F as E,R as L,N as R,t as S,D as A,b as D,c as C,d as _,e as q,f as O,g as F,h as V,L as B,i as U,T as H,S as W,A as $,k as Q}from"./index-BQ6UpNnR.js";import{T as z}from"./Tabs-DeMz3Pxe.js";import"./index-D17ekaCX.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new s.Error().stack;t&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[t]="3289129e-7ce0-46bb-903e-75d52b6ecc33",s._sentryDebugIdIdentifier="sentry-dbid-3289129e-7ce0-46bb-903e-75d52b6ecc33")}catch{}})();(function(){var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s._sentryModuleMetadata=s._sentryModuleMetadata||{},(function(){var t,n=new s.Error().stack,i=s._sentryModuleMetadata[n]||{},r={"_sentryBundlerPluginAppKey:mm-sentry-boysenberry":!0},l={};for(t in i)i.hasOwnProperty(t)&&(l[t]=i[t]);for(t in r)r.hasOwnProperty(t)&&(l[t]=r[t]);s._sentryModuleMetadata[n]=l})()})();function G({title:s,titleId:t,...n},i){return h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:i,"aria-labelledby":t},n),s?h.createElement("title",{id:t},s):null,h.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 15.75l7.5-7.5 7.5 7.5"}))}const K=h.forwardRef(G);function v({brandColors:s,width:t}){return e.jsx("svg",{width:t,viewBox:"0 0 30 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M13.4973 9.45742C12.7465 8.43733 11.791 6.37693 8.87575 6.64963C5.97025 6.91223 3.35724 9.61902 3.54249 13.0126C3.72774 16.4163 5.52175 19.4564 7.90075 21.7491C10.2798 24.0418 12.0348 25.1225 12.8343 25.375C13.663 25.1629 18.265 22.8399 20.293 20.2341C22.3308 17.6182 24.3978 15.5376 23.1595 10.8916C21.9213 6.24563 17.4221 6.625 15.925 7.77072C15.1999 8.27941 13.4973 9.44732 13.4973 9.44732V9.45742Z",className:s?"stroke-kale if:stroke-beet":"stroke-black",strokeWidth:"1.64062",strokeMiterlimit:"10",strokeLinejoin:"round"})})}v.propTypes={brandColors:c.bool,width:c.number};v.defaultProps={brandColors:!1,width:28};const w="my-5 flex items-center font-grotesk-bold text-body-xs";function k({listType:s,preference:t,setInfo:n}){const{addDislikedUserPreference:i,addLikedUserPreference:r,addRecurringUserPreference:l,removeUserPreference:o}=M({preferenceID:t.id}),d=f=>{setTimeout(()=>{n(f)},200)},u=f=>{S("item preference update",{new_preference:f,source:"account_preferences",path:window.location.pathname,isNative:!!window.isNativeApp,product_name:t.name,product_id:t.id})},x=async f=>{n(""),f==="favorite"?(r(),u("liked"),d("Added to your Liked List")):f==="dislike"?(i(),u("disliked"),d("Added to your Never List")):f==="recurring"?(l(),u("recurring"),d("Added to your Recurring List")):(o(),u("none"),d("Moved back to your Neutral List"))},p=()=>{x("favorite")},a=()=>{x("dislike")},b=()=>{x("recurring")};return e.jsx("div",{className:"flex rounded-lg border-2 border-off-white bg-white p-10 if:border-oat",children:e.jsxs("div",{className:"flex items-center gap-10",children:[e.jsx("img",{className:"h-[120px] w-[120px]",src:t.photoSmall||T,alt:t.name,width:"300",height:"300"}),e.jsxs("div",{className:"text-body-sm",children:[t.brand&&e.jsx("p",{className:"text-grey",children:t.brand}),e.jsx("p",{children:t.name}),s!=="neutral"?e.jsxs("button",{className:w,type:"button",onClick:()=>x(),children:[e.jsx(E,{className:"w-15 stroke-[2px]"}),e.jsx("span",{className:"ml-5 font-grotesk-bold",children:"Remove"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:w,type:"button",onClick:b,children:[e.jsx(L,{width:22}),e.jsx("span",{className:"mt-5 ml-5",children:"Set Recurring"})]}),e.jsxs("button",{className:w,type:"button",onClick:p,children:[e.jsx(v,{width:22}),e.jsx("span",{className:"mt-5 ml-5",children:"Move to Liked"})]}),e.jsxs("button",{className:w,type:"button",onClick:a,children:[e.jsx(R,{width:22}),e.jsx("span",{className:"mt-5 ml-5",children:"Move to Never"})]})]})]})]})},t.id)}k.propTypes={listType:c.string.isRequired,preference:c.shape({}).isRequired,setInfo:c.func.isRequired};function I({items:s,itemsPerPage:t,page:n,setPage:i}){const[r,l]=h.useState([]),[o,d]=h.useState(1),[u,x]=h.useState([]),p=(s==null?void 0:s.length)>t,a=(r==null?void 0:r.length)||0,b=3,f=a<=o*b,g=m=>{i(m),window.scrollTo({top:0,left:100,behavior:"smooth"})},y=m=>{d(m)};return h.useEffect(()=>{p?l(Array.from(Array(Math.ceil(Number(s==null?void 0:s.length)/t)).keys())):(i(1),l([]))},[s]),h.useEffect(()=>{x(r==null?void 0:r.filter(m=>m<b*o&&m>=b*(o-1)))},[r,o]),p?e.jsxs("nav",{className:"mt-20 flex justify-center gap-10",role:"navigation","aria-label":"Pagination Navigation",children:[a>3&&e.jsx("button",{type:"button",onClick:()=>y(o-1),disabled:o===1,"aria-label":"Previous Page Set",children:e.jsx(A,{width:25,disabled:o===1})}),e.jsx("button",{type:"button",onClick:()=>g(n-1),disabled:n===1,"aria-label":"Previous Page",children:e.jsx(D,{width:25,disabled:n===1})}),u==null?void 0:u.map(m=>e.jsx("button",{type:"button",className:C("h-25 w-25 rounded-full",{"bg-mango":m+1===n}),onClick:()=>g(m+1),"aria-label":`Page ${m+1}`,"aria-current":m+1===n,children:e.jsx("span",{className:"font-grotesk-bold",children:m+1})},m)),u[u.length-1]+1<a&&a>3&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"â¦"}),e.jsx("button",{type:"button",className:C("h-25 w-25 rounded-full",{"bg-mango":a===n}),onClick:()=>g(a),"aria-label":`Page ${a}`,"aria-current":a===n,children:e.jsx("span",{className:"font-grotesk-bold",children:a})})]}),e.jsx("button",{type:"button",onClick:()=>g(n+1),disabled:a===n,"aria-label":"Next Page",children:e.jsx(_,{width:25,disabled:a===n})}),a>3&&e.jsx("button",{type:"button",onClick:()=>y(o+1),disabled:f,"aria-label":"Next Page Set",children:e.jsx(q,{width:25,disabled:f})})]}):null}I.propTypes={items:c.arrayOf(c.shape({})).isRequired,itemsPerPage:c.number.isRequired,page:c.number.isRequired,setPage:c.func.isRequired};function N({listType:s,packs:t,setInfo:n}){const[i,r]=h.useState(1),l=10,o=t[0][s]||[],d=o==null?void 0:o.slice(l*(i-1),l*i);return e.jsxs("div",{children:[e.jsx("div",{className:"mt-30 grid gap-20 lg:grid-cols-2",children:d.map(u=>e.jsx(k,{setInfo:n,preference:u,listType:s},u.id))}),e.jsx(I,{page:i,setPage:r,items:o,itemsPerPage:l})]})}N.propTypes={listType:c.string.isRequired,packs:c.arrayOf(c.shape({})),setInfo:c.func.isRequired};N.defaultProps={packs:[]};function P({listType:s,packs:t,setInfo:n}){const i=(t==null?void 0:t.filter(r=>{var l;return((l=r[s])==null?void 0:l.length)>0}))||[];return e.jsx("div",{children:i.map((r,l)=>{var o;return e.jsxs("div",{children:[e.jsxs("details",{open:!0,className:"[&_svg]:open:rotate-0",children:[e.jsxs("summary",{className:"text-body-sm flex cursor-pointer list-none justify-between font-grotesk-bold",children:[e.jsxs("h3",{className:"after:opacity-0 after:transition-opacity after:duration-300 after:content-[''] hover:after:opacity-100 after:if:from-beet-hover",children:[r.name," (",r[s].length,")"]}),e.jsx(K,{width:24,className:"rotate-180 transition-all duration-300"})]}),e.jsx("div",{className:"mt-30 grid gap-20 lg:grid-cols-2",children:(o=r[s])==null?void 0:o.map(d=>e.jsx(k,{setInfo:n,preference:d,listType:s},d.id))})]}),l<i.length-1&&e.jsx(O,{color:"grey-light"})]},r.name)})})}P.propTypes={listType:c.string.isRequired,packs:c.arrayOf(c.shape({})),setInfo:c.func.isRequired};P.defaultProps={packs:[]};const Z={favorites:e.jsx("p",{children:"Tell us what you like so that our cart recommendations are more personalized."}),recurring:e.jsx("p",{children:"Set an item as Recurring to automatically add it in addition to your pre-filled cart (subject to availability), which means the cost of your cart will increase to account for the inclusion of your favorite items."}),dislikes:e.jsx("p",{children:"Let us know your dislikes so we can avoid adding them to future orders."}),neutral:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"Set an item as Recurring to automatically add it to your order in addition to items in your weekly pre-filled cart*. Move an item to Liked and we'll add it to your cart more often. Mark an item as Never to avoid having it added it to future orders."}),e.jsx("p",{className:"text-body-xs mt-5 text-grey",children:"*Recurring items will increase the cost of your cart to account for the inclusion of your favorite items. Items are subject to availability"})]})};function j({listType:s,setInfo:t}){const{data:n={}}=F(),{data:i={},isLoading:r}=V(),{planType:l}=n,{packPreferences:o,recurring:d}=i,[u,x]=h.useState(!1),p=s==="recurring",a=p?d:o||[],b=l==="v2";return h.useEffect(()=>{if((a==null?void 0:a.length)>0){const f=[];a==null||a.forEach(g=>
1g[s].forEach(y=>f.push(y))),x((f==null?void 0:f.length)>0)}},[a]),!n||r?e.jsx("div",{className:"flex h-[300px] items-center justify-center",children:e.jsx(B,{width:"60px"})}):e.jsxs("div",{children:[Z[s],e.jsx("div",{className:"mt-30",children:u?e.jsx("div",{children:!b||p?e.jsx(N,{packs:a,setInfo:t,listType:s}):e.jsx(P,{packs:a,setInfo:t,listType:s})}):e.jsx("p",{className:"font-grotesk-bold",children:s==="neutral"?"Items will show after you make your next order":"No items in this list yet"})})]})}j.propTypes={listType:c.string.isRequired,setInfo:c.func.isRequired};function ee(){const s=U(),[t,n]=h.useState(""),[i,r]=h.useState("tab1"),l=d=>{r(d)},o=[{id:1,name:"Past Items",content:e.jsx(j,{listType:"neutral",setInfo:n})},{id:2,name:e.jsxs("p",{children:[e.jsx("span",{className:"relative top-[3px] inline-flex",children:e.jsx(L,{width:18,brandColors:i==="tab2"})}),e.jsx("span",{className:"ml-5",children:"Recurring List"})]}),content:e.jsx(j,{listType:"recurring",setInfo:n})},{id:3,name:e.jsxs("p",{children:[e.jsx("span",{className:"relative top-[3px] inline-flex",children:e.jsx(v,{width:18,brandColors:i==="tab3"})}),e.jsx("span",{className:"ml-5",children:"Liked List"})]}),content:e.jsx(j,{listType:"favorites",setInfo:n})},{id:4,name:e.jsxs("p",{children:[e.jsx("span",{className:"relative top-[3px] inline-flex",children:e.jsx(R,{width:18,brandColors:i==="tab4"})}),e.jsx("span",{className:"ml-5",children:"Never List"})]}),content:e.jsx(j,{listType:"dislikes",setInfo:n})}];return e.jsxs("section",{children:[t!==""&&e.jsx(H,{open:!0,handleClose:()=>n(""),autoHideDuration:3e3,copy:t,nanoBannerVisible:s}),e.jsx("h1",{className:"text-heading-sm my-20 mt-0",children:"Food Preferences"}),e.jsx(W,{className:"mb-20"}),e.jsx("div",{className:"mb-20",children:e.jsxs($,{children:["Need to update your aisles? Visit the"," ",e.jsx(Q,{className:"link text-black!",to:"/account/plan",children:"My Plan"})," ","page."]})}),e.jsx(z,{tabOptions:o,onValueChange:l,tabWrapperClasses:"overflow-x-scroll whitespace-nowrap w-[90vw] md:w-auto"})]})}export{ee as Component}; 2//# sourceMappingURL=FoodPreferences-4tkUkAN1.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.