PageSourceSearch

https://www.imperfectfoods.com/assets/ShopWithPoints-DVfl3DE2.js

js imperfectfoods.com collected 2026-09-24 17:13:24 UTC 6,202 bytes, 2 lines download raw bytes

1import{g as c,bG as N,b8 as T,j as t,eJ as D,eK as P,P as d,co as M,as as w,E as g,ak as R,l as E,r as p,eL as k,S as _,b9 as A,L as C}from"./index-CVUXbWDK.js";import{B}from"./Breadcrumbs-CcG9y1mh.js";import{L as O}from"./LoyaltyPointsBanner-SeRygG-Z.js";import{T as q}from"./Tabs-CHfGuKEA.js";import{s as j}from"./AisleContent-Bp-ftWbp.js";import{M as S}from"./MaxLoyaltyPointsSpendAlert-Bkf_FosY.js";import"./BackButton-Biq-2jqL.js";import"./index-1fq4Pb41.js";import"./ChevronDownIcon-DxIiIRv9.js";import"./arrayUtils-J12NMbFi.js";import"./ProductSpotlight-Bn2K4F0J.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new s.Error().stack;e&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[e]="7c8aad41-6ea9-49fb-a45a-319af8a552f6",s._sentryDebugIdIdentifier="sentry-dbid-7c8aad41-6ea9-49fb-a45a-319af8a552f6")}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 e,a=new s.Error().stack,i=s._sentryModuleMetadata[a]||{},o={"_sentryBundlerPluginAppKey:mm-sentry-boysenberry":!0},r={};for(e in i)i.hasOwnProperty(e)&&(r[e]=i[e]);for(e in o)o.hasOwnProperty(e)&&(r[e]=o[e]);s._sentryModuleMetadata[a]=r})()})();const G="shop-with-points-products",K=36e5,F=s=>s==null?void 0:s.filter(e=>!e.isGift).sort((e,a)=>e.pointPrice<a.pointPrice?-1:1),Q=({queryOptions:s={}}={})=>{var o;const{data:e={}}=c(),a=(o=e==null?void 0:e.nextOrder)==null?void 0:o.chargeID;return N({queryKey:[G,a],queryFn:()=>T(a),select:r=>r.msg==="Success"?F(r.data.items):[],enabled:!!a,staleTime:K,...s})};function y({products:s,showMaxLoyaltyPointsSpendAlert:e}){var a;return t.jsxs(t.Fragment,{children:[e&&t.jsx(S,{}),t.jsx("p",{className:"text-body-md my-20",children:"Shop with Points allows you to purchase items with your loyalty points. Redeemed items will be visible in your cart, and shipped with your next order. Points are not officially redeemed until your shopping window closes."}),s.length>0?t.jsx("div",{className:j.aisleSectionV2,children:(a=D(s))==null?void 0:a.map(i=>t.jsx(P,{data:i,metaData:{aisleID:null,carouselID:null,carouselName:null,customAisle:!0,isCarouselModalCard:!1,searchRecommendation:!1},variant:"PERK"},i.name))}):t.jsx("p",{className:"text-body-md",children:"Sorry, there are no Shop with Points items available at this time."})]})}y.propTypes={products:d.arrayOf(d.shape({})).isRequired,showMaxLoyaltyPointsSpendAlert:d.bool};y.defaultProps={showMaxLoyaltyPointsSpendAlert:!1};function f({selections:s,setCurrentTab:e,showMaxLoyaltyPointsSpendAlert:a}){var o;const i=(o=s==null?void 0:s.selected)==null?void 0:o.filter(r=>r==null?void 0:r.isPerk);return t.jsxs(t.Fragment,{children:[a&&t.jsx(S,{}),t.jsx("p",{className:"text-body-md my-20",children:"You may edit redeemed items until your shopping window closes. Gift items will be shipped with your order!"}),t.jsxs("div",{className:j.aisleSectionV2,children:[i.map((r,l)=>{const m=`${r.id}-${l}`;return t.jsx(P,{data:r,metaData:{aisleID:null,carouselID:null,carouselName:null,customAisle:!0,isCarouselModalCard:!1,searchRecommendation:!1},variant:"PERK-REDEEMED"},m)}),t.jsx("button",{type:"button",onClick:()=>e("tab1"),className:"mb-60 flex min-h-[180px] cursor-pointer items-center justify-center rounded-md border border-dashed border-kale md:mb-0 md:min-h-[300px] if:border-beet",children:t.jsx(M,{className:"w-20 stroke-[3px]"})})]})]})}f.propTypes={selections:d.shape({selected:d.arrayOf(d.shape({isPerk:d.bool}))}).isRequired,setCurrentTab:d.func.isRequired,showMaxLoyaltyPointsSpendAlert:d.bool};f.defaultProps={showMaxLoyaltyPointsSpendAlert:!1};const x={tab1:"/shop/browse/misfits+perks",tab2:"/shop/browse/misfits+perks/redeemed"};function v({products:s}){var h,b;const{data:e={}}=c(),{data:a={}}=w(),i=g(),o=R(x.tab2),{alerts:r}=E(),[l,m]=p.useState(o?"tab2":"tab1"),u=(r==null?void 0:r.includes("maxLoyaltyPointsSpendAlert"))||((h=a==null?void 0:a.selected)==null?void 0:h.some(n=>n==null?void 0:n.isPerk));p.useEffect(()=>{o&&m("tab2")},[o]),p.useEffect(()=>{i(x[l])},[l]),p.useEffect(()=>{var n;u&&((n=document.getElementById("max-loyalty-point-spend-alert"))==null||n.scrollIntoView({behavior:"smooth"}))},[u]);const I=(((b=a==null?void 0:a.selected)==null?void 0:b.filter(n=>n==null?void 0:n.isPerk))??[]).reduce((n,L)=>n+L.qty,0);return t.jsx(q,{onValueChange:n=>m(n),tabOptions:[{id:1,name:"Available Gifts",content:t.jsx(y,{currentLoyaltyPoints:e==null?void 0:e.currentLoyaltyPoints,isDeliveredByImperfect:e==null?void 0:e.isDeliveredByImperfect,showMaxLoyaltyPointsSpendAlert:u,products:s}
1)},{id:2,name:t.jsxs(t.Fragment,{children:["Redeemed (",I,")"]}),content:t.jsx(f,{currentLoyaltyPoints:e==null?void 0:e.currentLoyaltyPoints,isDeliveredByImperfect:e==null?void 0:e.isDeliveredByImperfect,showMaxLoyaltyPointsSpendAlert:u,setCurrentTab:m,selections:a})}],tabWrapperClasses:"bg-off-white flex justify-center pt-15 -mx-10 md:mx-0",value:l})}v.propTypes={products:d.arrayOf(d.shape({pointPrice:d.number.isRequired})).isRequired};function se(){const s=g(),{data:e={}}=c(),{data:a=[]}=w(),{data:i,isLoading:o}=Q(),r=[{id:1,title:"Home",url:"/shop"},{id:2,title:"Shop with Points",subtitle:o?"":`(${i.length})`}];return t.jsxs("section",{className:"md:mx-10",children:[t.jsx("div",{className:"mx-10 mb-10 pt-20 md:mx-0 md:mt-0 md:pt-40",children:t.jsx(B,{breadcrumbs:r,showLast:!0,className:"md:mb-20 md:pt-20"})}),t.jsxs("div",{className:"mx-10 mb-20 flex items-center gap-10 md:mx-0",children:[t.jsx("button",{onClick:()=>s("/shop"),type:"button",className:"shadow-base mr-5 rounded-full p-[3px]",children:t.jsx(k,{className:"h-[24px] w-[24px]"})}),t.jsx("h1",{className:"text-heading-xs",children:"Shop with Points"})]}),t.jsx(_,{className:"mb-20 px-10"}),t.jsx(O,{points:A(e==null?void 0:e.currentLoyaltyPoints,a),roundedBottom:!1}),o?t.jsx("div",{className:"my-40 flex justify-center",children:t.jsx(C,{width:"60"})}):t.jsx("div",{className:"mx-10 md:mx-0",children:t.jsx(v,{products:i})})]})}export{se as Component};
2//# sourceMappingURL=ShopWithPoints-DVfl3DE2.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.