PageSourceSearch

https://www.sageappliances.com/account/_next/static/chunks/4937.284e295075cafd9f.js

js sageappliances.com collected 2026-10-01 10:45:54 UTC 161,386 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[204,3299,4937,6583,9364],{6032:e=>{e.exports={actions:"SubscriptionCard_actions__WsKUu"}},11576:e=>{e.exports={dateField:"ScheduleDateField_dateField__Mnhen",dateEmpty:"ScheduleDateField_dateEmpty__IOl7g",dateFilled:"ScheduleDateField_dateFilled__la_uq",dateFocused:"ScheduleDateField_dateFocused__Gbijt"}},13299:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>r});var i=t(37876);let r=e=>{let{color:s="#421540"}=e;return(0,i.jsxs)("svg",{width:"117",height:"27",viewBox:"0 0 117 27",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.786 12.3947C15.786 12.3947 18.7508 10.7966 18.7508 6.59146C18.7508 1.54079 15.0432 -2.28882e-05 11.4749 -2.28882e-05H0V26.1686H11.3418C16.7793 26.1686 19.4883 23.1735 19.4883 18.6488C19.4883 13.1992 15.786 12.3947 15.786 12.3947ZM11.2669 19.2009C10.7344 20.1617 9.54226 20.3658 8.33347 20.3658H7.46687V15.1272H9.09089C10.0362 15.1272 10.8578 15.3813 11.3104 16.1197C11.6822 16.7257 11.7711 18.29 11.2669 19.2009ZM7.46687 5.26411H9.31211C10.4162 5.26411 11.3818 6.1019 11.3818 7.43651C11.3818 9.14902 10.1885 9.69009 8.4317 9.69009H7.46687V5.26411Z",fill:s}),(0,i.jsx)("path",{d:"M79.4588 26.1687H86.597V3.1304H79.4588V26.1687Z",fill:s}),(0,i.jsx)("path",{d:"M95.9157 26.1687H88.801V3.1304H95.9157V26.1687Z",fill:s}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M113.667 15.4699L105.475 22.3792C106.742 23.3286 108.851 22.7997 111.105 20.4463L113.651 23.3842C111.579 25.855 109.153 27 105.839 27C101.06 27 97.2429 23.4573 97.2429 19.0877C97.2429 14.7385 101.096 11.0869 105.882 11.0869C109.588 11.0869 112.278 12.8331 113.667 15.4699ZM107.724 16.3905C107.724 16.3905 105.75 14.5233 103.598 16.3905C101.685 18.0364 103.21 20.1569 103.21 20.1569L107.724 16.3905Z",fill:s}),(0,i.jsx)("path",{d:"M76.9584 7.26414C76.9584 9.05459 75.515 10.487 73.684 10.487C71.9345 10.487 70.4972 9.05459 70.4972 7.26414C70.4972 5.4737 71.9345 4.02625 73.684 4.02625C75.515 4.02625 76.9584 5.4737 76.9584 7.26414Z",fill:s}),(0,i.jsx)("path",{d:"M70.1836 26.1687H77.2812V11.9774H70.1836V26.1687Z",fill:s}),(0,i.jsx)("path",{d:"M58.7775 11.9261L60.9832 18.1633L63.225 11.9761H69.0818L63.3865 26.1685H57.0784L51.5187 11.9261H58.7775Z",fill:s}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M43.5983 11.0866C38.8566 11.0866 34.9603 14.7381 34.9603 19.0874C34.9603 23.4553 38.8172 26.9984 43.5837 26.9984C46.932 26.9984 49.3386 25.855 51.4039 23.381L48.8978 20.4463C46.5895 22.7981 44.4962 23.3283 43.2399 22.3793L51.4636 15.4695C50.0417 12.8332 47.3619 11.0866 43.5983 11.0866ZM40.9597 20.1561C40.9597 20.1561 39.4351 18.0336 41.3798 16.3901C43.5023 14.5233 45.4673 16.3901 45.4673 16.3901L40.9597 20.1561Z",fill:s}),(0,i.jsx)("path",{d:"M34.396 15.3584C34.396 17.1492 32.953 18.5817 31.1207 18.5817C29.752 18.5817 28.5749 17.7045 28.1276 16.4653C28.1276 16.4653 28.0626 16.5607 28.035 16.6394C28.0152 16.6865 28.0152 16.7819 28.0152 16.7819V26.1684H20.909V11.9451H28.0152V13.8196C28.0152 13.9142 28.035 13.9767 28.1004 14.0936C28.1532 14.1865 28.1637 14.1484 28.1637 14.1484L28.1698 14.1395C28.6455 12.955 29.7934 12.1213 31.1207 12.1213C32.953 12.1213 34.396 13.5688 34.396 15.3584Z",fill:s}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M114.788 12.4618H115.049V11.7539H115.233C115.445 11.7539 115.548 11.8318 115.588 12.0413C115.62 12.2588 115.66 12.409 115.699 12.4618H115.977C115.947 12.409 115.91 12.3108 115.87 12.0547C115.838 11.8115 115.741 11.6812 115.593 11.6548V11.6415C115.772 11.5899 115.916 11.4588 115.916 11.2424C115.916 11.0841 115.863 10.9721 115.765 10.8999C115.667 10.8292 115.502 10.7761 115.252 10.7761C115.062 10.7761 114.931 10.7952 114.797 10.8146L114.788 10.8158V12.4618ZM115.24 11.5509H115.049V10.9928C115.096 10.9859 115.155 10.979 115.24 10.979C115.536 10.979 115.64 11.1235 115.64 11.2676C115.64 11.4713 115.457 11.5509 115.24 11.5509Z",fill:s}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M116.782 11.6021C116.782 10.7822 116.139 10.1271 115.332 10.1271H115.325C114.517 10.1271 113.862 10.7822 113.862 11.6021C113.862 12.4346 114.517 13.0841 115.325 13.0841C116.139 13.0841 116.782 12.4346 116.782 11.6021ZM114.145 11.6022C114.145 10.9138 114.678 10.3561 115.326 10.3561H115.333C115.989 10.3561 116.513 10.9138 116.513 11.6091C116.513 12.3053 115.989 12.8618 115.333 12.8553C114.678 
112.8553 114.145 12.3053 114.145 11.6022Z",fill:s})]})}},14937:(e,s,t)=>{"use strict";t.r(s),t.d(s,{ChangeCoffee:()=>sF,ChefstepsSubscriptionCard:()=>em,ManageAddress:()=>sw,ManageSubscriptions:()=>st,OrderSummary:()=>sL,PaymentMethod:()=>sO,ProductSection:()=>eC,Promotion:()=>sV,SubscriptionCard:()=>ei,SubscriptionDetails:()=>sS,SubscriptionHistory:()=>sR,SubscriptionItems:()=>ex,Subscriptions:()=>ey});var i=t(37876),r=t(14232),a=t(84034),n=t(84357),l=t(7135),o=t(59874),c=t(5716),d=t(63645),u=t(15039),p=t.n(u);t(60718);var m=t(5334);let h=e=>{let{cardType:s,cardNumber:t,cardNumberTextType:r="p2",cardNumberFirst:n=!1}=e;return(0,i.jsxs)("div",{className:p()("payment-summary--payment-card",{"card-number-first":n}),children:[(0,i.jsx)("div",{className:"payment-summary--payment-icon",children:(0,i.jsx)(a.Image,{src:s&&(e=>{switch(null==e?void 0:e.toLowerCase()){case"paypal":return"https://assets-dam.foodthinkers.com/ZKCA55LU/at/vq4jwk5m6ct664vp569qjtz/pay-pal.svg";case"visa":return"https://assets-dam.foodthinkers.com/ZKCA55LU/at/6c3b3km4n9p5t8q5g5t4tk/visa.svg";case"mastercard":case"mc":return"https://assets-dam.foodthinkers.com/ZKCA55LU/at/f4bvr74g9kx9c77mhkkbkk/mastercard.svg";case"amex":return"https://assets-dam.foodthinkers.com/ZKCA55LU/at/qfg92f46ns6nk495jn58vfq/amex.svg";case"dinersclub":case"diners":return"https://assets-dam.foodthinkers.com/ZKCA55LU/at/3z7cr59pxhk73f3rrvsf5jg/diners.svg";case"applepay":return"https://assets-dam.foodthinkers.com/ZKCA55LU/at/rsr5nh6vqtk5chz9qhh7k9k/ApplePay.svg";case"jcb":return"https://assets-dam.foodthinkers.com/ZKCA55LU/at/rghpw6whbm9zrfc846vnf/jcb.svg";case"discover":return"https://assets-dam.foodthinkers.com/ZKCA55LU/at/kjgpb634hgjtvxxgvrvsjx7s/discover.svg";case"googlepay":return"https://assets-dam.foodthinkers.com/ZKCA55LU/at/cnqfrswc5mcm9vjwgm9kcg8/googlepay.svg";case"maestro":return"https://assets-dam.foodthinkers.com/ZKCA55LU/at/9s6mbxcpqp6vrmjvksbbp/maestro.svg";default:return null}})(s),alt:null==s?void 0:s.toLowerCase()})}),t&&(0,i.jsxs)(a.Text,{type:r,tag:"p",children:[" ",t," "]})]})};var b=t(19305),g=t(90142),f=t(99375),x=t(33117),y=t(20880);let v=async()=>{try{var e;let s=await (0,y.SP)();return(null==s||null==(e=s.data)?void 0:e.ip)||"192.0.2.1"}catch(e){return x.v.error("Fetching IP address failed ".concat(e)),"192.0.2.1"}},C=async e=>{try{var s;return null==(s=(await (0,y.Lt)({query:"query me($id:String!){ me{payment(id:$id){version } }}",variables:{id:e}})).data)?void 0:s.data.me.payment.version}catch(e){x.v.error("Fetching payment version failed : ".concat(e));return}},j=async e=>{let{adyenState:s,paymentID:t,locale:i,currencyCode:r,isRedirectResult:a}=e;if(!s.isValid)return{success:!1,data:void 0,error:"Invalid Adyen state"};try{var n,l;let e,o=null==(l=s.data)||null==(n=l.riskData)?void 0:n.clientData,c=window.location.href,[d,u]=await Promise.all([v(),C(t)]);e=a?((e,s)=>{var t;return{version:s,actions:[{action:"setCustomField",name:"submitAdditionalPaymentDetailsRequest",value:JSON.stringify({details:null==(t=e.data)?void 0:t.details})}]}})(s,u):((e,s,t,i,r)=>{var a,n,l,o,c,d,u,p;let{adyenState:m,currencyCode:h,locale:b}=e,g=null==m||null==(a=m.data)?void 0:a.paymentMethod;return{version:s,additionalData:{allow3DS2:!0},threeDSAuthenticationOnly:!1,actions:[{action:"setCustomField",name:"makePaymentRequest",value:JSON.stringify({amount:{currency:h,value:100},paymentMethod:{type:"scheme",encryptedCardNumber:null!=(l=null==g?void 0:g.encryptedCardNumber)?l:"",encryptedExpiryMonth:null!=(o=null==g?void 0:g.encryptedExpiryMonth)?o:"",encryptedExpiryYear:null!=(c=null==g?void 0:g.encryptedExpiryYear)?c:"",encryptedSecurityCode:null!=(d=null==g?void 0:g.encryptedSecurityCode)?d:"",holderName:null!=(u=null==g?void 0:g.holderName)?u:""},returnUrl:r||"",shopperEmail:null!=(p=null==g?void 0:g.userEmail)?p:"",browserInfo:null==(n=m.data)?void 0:n.browserInfo,channel:"web",shopperIP:t,deviceFingerprint:i,shopperLocale:b})}]}})({adyenState:s,paymentID:t,locale:i,currencyCode:r},u,d,o,c);let p=await (0,y.Sl)(e,t);return(e=>{try{var s,t;if(!e.success||!e.data)return x.v.error("MakeCard Payment API failed: ".concat(e.error)),{success:!1,data:void 0,error:e.error};let i=null==(t=e.data.custom)||null==(s=t.fields)?void 0:s.makePaymentResponse,r=i?JSON.parse(i):void 0;return{success:!0,data:r,error:void 0}}catch(e){return x.v.error("Error parsing Adyen response",e),{success:!1,data:void 0,error:"Error parsing Adyen response"}}})(p)}catch(e){return x.v.error("Error in makeCardPayment:",e),{success:!1,data:void 0,error:"Payment processing failed: ".concat(e)}}};var _=t(42727);let N=async(e,s,t,i)=>
1{if(s.action){g.vF.info("3DS Action received:",s.action.type),(0,_.uA)("Subscription_Payment_3ds_action_received",{actionType:s.action.type});try{let e={locale:t,environment:null==i?void 0:i.environment,clientKey:null==i?void 0:i.adyenClientKey},r=(await (0,b.A)(e)).createFromAction(s.action),a="#card-container";document.querySelector("#existing-container")&&(a="#existing-container");let n=document.querySelector(a);return n||((n=document.createElement("div")).id="adyen-3ds-container",document.body.appendChild(n),a="#adyen-3ds-container"),n.innerHTML="",r.mount(a),g.vF.info("3DS component mounted to ".concat(a)),(0,_.uA)("Subscription_Payment_3ds_component_mounted",{containerSelector:a}),!0}catch(s){return g.vF.error("Error handling 3DS redirect:",s),(0,_.nB)((0,_.Fz)(s),{},_.Er),(null==e?void 0:e.current)&&e.current.setStatus("error",{message:"Failed to initialize 3D Secure authentication"}),!1}}return g.vF.error("3DS redirect requested but Adyen response has no action"),(0,_.nB)(Error("3DS redirect requested but Adyen response has no action"),{},_.Er),!1},P=async function(e,s){var t;let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e3;null==(t=e.current)||t.setStatus("success"),f.t.removeItem("paymentID"),s&&s(),i&&setTimeout(()=>{window.location.reload()},r)},S=async function(e){var s,t,i,r,a;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{state:l,paymentID:o,locale:c,currencyCode:d,componentRef:u}=e,{onSuccess:p,reloadOnSuccess:m=!0,successDelay:h=1500,onLoadingStart:b,onLoadingEnd:f,onShowErrorModal:x}=n;try{if(!o){let e="Payment ID not found in localStorage";g.vF.error(e),(0,_.nB)(Error(e),{},_.Er),null==(t=u.current)||t.setStatus("error",{message:"Payment ID not found"}),null==f||f();return}null==b||b(),null==(s=u.current)||s.setStatus("loading"),(0,_.uA)("Subscription_Payment_api_call_started",{paymentID:o});let e=await j({adyenState:l,paymentID:o,locale:c,currencyCode:d});if((null==e?void 0:e.success)&&e.data){let s=e.data;if("Authorised"===s.resultCode)(0,_.uA)("Subscription_Payment_api_call_success",{resultCode:s.resultCode}),await P(u,p,m,h);else if("RedirectShopper"===s.resultCode)(0,_.uA)("Subscription_Payment_3ds_redirect_initiated",{resultCode:s.resultCode}),await N(u,s,c,n.configureAction)||(null==f||f(),null==x||x());else{let e;(0,_.nB)(Error("Adyen Payment Error: ".concat(s.resultCode)),{resultCode:s.resultCode,message:s.message},_.Er);let{resultCode:t,message:i}=s;switch(t){case"Refused":e="Payment was refused message: ".concat(i);break;case"Error":e="Payment processing error message: ".concat(i);break;default:e="Payment status: ".concat(t||"Unknown"," message: ").concat(i||"No additional information")}null==(a=u.current)||a.setStatus("error",{message:e}),null==x||x(),null==f||f()}}else{let s=(null==e?void 0:e.error)||"Payment processing failed";g.vF.error("Adyen Payment Error: ".concat(s)),(0,_.nB)(Error("Adyen Payment API Error: ".concat(s)),{paymentID:o},_.Er),null==(i=u.current)||i.setStatus("error",{message:s}),null==f||f(),null==x||x()}}catch(e){g.vF.error("Payment submission error:",e),(0,_.nB)((0,_.Fz)(e),{paymentID:o},_.Er),null==(r=u.current)||r.setStatus("error",{message:"An unexpected error occurred during payment processing"}),null==f||f(),null==x||x()}},w=(e,s,t,i)=>async r=>{let a=f.t.getItem("paymentID");await S({state:r,paymentID:a,locale:e,currencyCode:s,componentRef:t},i)},L=e=>{let{isOpen:s,onClose:t}=e,{t:n}=(0,l.Bd)(),[o,c]=(0,r.useState)(!1);return(0,i.jsxs)(i.Fragment,{children:[o&&(0,i.jsx)(a.Loader,{isLoading:o}),(0,i.jsx)(a.Modal,{isOpen:s,onClose:()=>{c(!0),t&&t()},titleType:"h6",className:p()("payment-error-modal"),children:(0,i.jsxs)("div",{className:"payment-error-modal-content",children:[(0,i.jsxs)("div",{className:"payment-error-modal-header",children:[(0,i.jsx)(a.Text,{type:"h3",children:n("globalProfile.subscription.paymentMethod.error","Sorry, Something went wrong")}),(0,i.jsx)(a.Text,{type:"p1",children:n("globalProfile.subscription.paymentMethod.errorDescription","Please check your payment details and submit your order again, or contact our support team")})]}),(0,i.jsx)("div",{className:"payment-error-modal-actions",children:(0,i.jsx)(a.ButtonV2,{type:"button",size:"fullWidth",onClick:t,children:n("globalProfile.subscription.paymentMethod.close","Close")})})]})})]})},k=async e=>{let{standingOrderId:s,storeCode:t,countryCode:i,currencyCode:r,authorizationType:a}=e;try{let e=await (0,y.J5)({amountPlanned:{currencyCode:r,centAmount:100},paymentMethodInfo:{paymentInterface:"ctp-adyen-integration"},custom:{type:{typeId:"type",key:"ctp-adyen-integration-web-components-payment-type"},fields:{getPaymentMethodsRequest:'{"countryCode":"'.concat(i,'"}'),standingOrderId:s,authorizationType:a,storeCode:t}}});return e.success||x.v.error("Get Payment API error: ".concat(e.error)),{success:e.success,data:e.data,error:e.error}}catch(e){return x.v.error("Failed to fetch get Payment:",e),{success:!1,data:null,error:"Network error while fetching get Payment"}}},T=e=>{let{registerSubmit:s,adyenClientKey:t,subscription:n,paymentModelClose:c}=e,{globalConfig:{countryCode:d,locale:u,adyenEnvironment:p,currencyCode:m}}=(0,o.h5)(),[h,x]=(0,r.useState)(!1),[y,v]=(0,r.useState)(!1),[C,j]=(0,r.useState)(!1),{t:_}=(0,l.Bd)(),N=(0,r.useRef)(null),P=(0,r.useRef)(null);(0,r.useEffect)(()=>{x(!0),(async()=>{try{let e=await k({standingOrderId:n.standingorderid,storeCode:n.storecode,currencyCode:m,countryCode:d,authorizationType:"UPDATE_CARD_EXPIRY_DATE"});e.success&&(null==e?void 0:e.data)&&f.t.setItem("paymentID",e.data.id)}catch(e){g.vF.error("Error retrieving payment method:",e)}finally{j(!0),x(!1)}})()},[n.standingorderid,n.storecode,m,d]);let S=w(u,m,N,{reloadOnSuccess:!0,successDelay:1e3,onLoadingStart:()=>x(!0),onLoadingEnd:()=>x(!1),onShowErrorModal:()=>v(!0),configureAction:{environment:p,adyenClientKey:t}}),T=async e=>{try{let i={countryCode:d,locale:u.replace("-","_"),environment:p,clientKey:t,showPayButton:!1,setStatusAutomatically:!1,onSubmit:S},r=await (0,b.A)(i);if(e.current)return;P.current=r;let a=r.create("securedfields",{autoFocus:!0});N.current=a,a.mount("#existing-container"),null==s||s(()=>{try{var e;if(null==(e=N.current)?void 0:e.submit)return N.current.submit(),g.vF.info("Secured fields submission triggered"),!0;return g.vF.error("Adyen component has no submit() method"),!1}catch(e){return g.vF.error("Error triggering Adyen submission:",e),!1}})}catch(e){g.vF.error("Failed to initialize Adyen checkout:",e)}};return(0,r.useLayoutEffect)(()=>
1{if(!C)return;let e={current:!1};return T(e),()=>{if(e.current=!0,N.current&&"function"==typeof N.current.unmount)try{N.current.unmount(),N.current=null}catch(e){g.vF.error("Error unmounting Adyen component:",e)}}},[C,t,p,d,u,S,s,T]),(0,i.jsxs)(i.Fragment,{children:[h&&(0,i.jsx)(a.Loader,{isLoading:h,transparent:!0}),(0,i.jsx)(L,{isOpen:y,onClose:()=>{null==c||c(),v(!1)}}),(0,i.jsx)("div",{id:"existing-container",children:(0,i.jsx)("div",{className:"adyen-checkout__card-input CardInput-module_card-input__wrapper__2tAzu adyen-checkout__card-input--credit",children:(0,i.jsxs)("div",{className:"adyen-checkout__card__exp-cvc adyen-checkout__field-wrapper",children:[(0,i.jsx)("div",{className:"adyen-checkout__field adyen-checkout__field--50 adyen-checkout__field--expiryDate",children:(0,i.jsxs)("p",{className:"adyen-checkout__label",children:[(0,i.jsx)(a.Text,{tag:"span",type:"p3-bold",className:"adyen-checkout__label__text",children:_("globalProfile.subscription.editPayment.expiryDate","Expiration Date")}),(0,i.jsx)("span",{className:"adyen-checkout__input","data-cse":"encryptedExpiryDate"})]})}),(0,i.jsx)("div",{className:"adyen-checkout__field adyen-checkout__field--50 adyen-checkout__field__cvc adyen-checkout__field--securityCode",children:(0,i.jsxs)("p",{className:"adyen-checkout__label",children:[(0,i.jsx)(a.Text,{tag:"span",type:"p3-bold",className:"adyen-checkout__label__text",children:_("globalProfile.subscription.editPayment.securityCode","Security Code")}),(0,i.jsx)("span",{className:"adyen-checkout__input","data-cse":"encryptedSecurityCode"})]})})]})})})]})},A=e=>{let{registerSubmit:s,adyenClientKey:t,subscription:n,paymentModelClose:l}=e,{globalConfig:{countryCode:c,locale:d,adyenEnvironment:u,currencyCode:p}}=(0,o.h5)(),[m,h]=(0,r.useState)(!0),[x,y]=(0,r.useState)(!1),[v,C]=(0,r.useState)(!1),j=(0,r.useRef)(null),_=(0,r.useRef)(null),N=(0,r.useRef)(null),[P,S]=(0,r.useState)([]);(0,r.useEffect)(()=>{let e=!0;return h(!0),C(!1),(async function(e,s,t){let i=await k({standingOrderId:e.standingorderid,storeCode:e.storecode,currencyCode:s,countryCode:t,authorizationType:"ADD_NEW_CARD_PAYMENT"});if(!i.success||!i.data)return g.vF.error("Error retrieving payment method: API response unsuccessful or missing data"),[];f.t.setItem("paymentID",i.data.id);let r=function(e){try{return JSON.parse(e)}catch(e){return g.vF.error("Failed to parse getPaymentMethodsResponse JSON:",e),null}}(null!=(l=null==(n=i.data.custom)||null==(a=n.fields)?void 0:a.getPaymentMethodsResponse)?l:"");if(!r||!Array.isArray(r.paymentMethods))return[];var a,n,l,o=r.paymentMethods;if(!Array.isArray(o))return[];for(let e of o)if(Array.isArray(e.brands)&&e.brands.length>0)return e.brands;return[]})(n,p,c).then(s=>{e&&S(s)}).catch(e=>{g.vF.error("Error in fetchSupportedPaymentMethods:",e)}).finally(()=>{e&&(C(!0),h(!1))}),()=>{e=!1}},[n.standingorderid,n.storecode,p,c]);let T=w(d,p,j,{reloadOnSuccess:!0,successDelay:1e3,onLoadingStart:()=>h(!0),onLoadingEnd:()=>h(!1),onShowErrorModal:()=>y(!0),configureAction:{environment:u,adyenClientKey:t}});return((0,r.useLayoutEffect)(()=>{if(!v)return;let e=!1,i={countryCode:c,locale:d.replace("-","_"),environment:u,clientKey:t,showPayButton:!1,setStatusAutomatically:!1,onSubmit:T},r=async()=>{try{let t=await (0,b.A)(i);if(e)return;_.current=t;let r=t.create("card",{hasHolderName:!0,holderNameRequired:!0,positionHolderNameOnTop:!0,brands:P});j.current=r,N.current?r.mount(N.current):g.vF.error("Adyen container ref is not available for mounting."),null==s||s(()=>{try{var e;if(null==(e=j.current)?void 0:e.submit)return j.current.submit(),g.vF.info("Card submission triggered"),!0;return g.vF.error("No submit method available"),!1}catch(e){return g.vF.error("Error triggering Adyen submission:",e),!1}})}catch(e){g.vF.error("Failed to initialize Adyen checkout:",e)}};return m||r(),()=>{if(e=!0,j.current&&"function"==typeof j.current.unmount)try{j.current.unmount(),j.current=null}catch(e){g.vF.error("Error unmounting Adyen component:",e)}}},[v,t,u,c,d,T,s,P,m]),m)?(0,i.jsx)(a.Loader,{isLoading:m,transparent:!0}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(L,{isOpen:x,onClose:()=>{l&&l(),y(!1)}}),(0,i.jsx)("div",{ref:N})]})},E=e=>{let{isOpen:s,onClose:t,subscription:n,paymentMethod:c,setPaymentMethod:u,hideExistingCard:b=!1}=e,{globalConfig:{brevilleAdyenClientKey:g,baratzaAdyenClientKey:f,beanzAdyenClientKey:x,lelitAdyenClientKey:y,chefstepsAdyenClientKey:v,currencySymbol:C}}=(0,o.h5)(),{t:j}=(0,l.Bd)(),N=(0,r.useRef)(null),P=(0,r.useRef)(null),S=(0,r.useCallback)(e=>{N.current=e},[]),w=(0,r.useCallback)(e=>{P.current=e},[]),L=(0,r.useCallback)(e=>{var s,t;e.preventDefault(),(0,_.uA)("Subscription_Payment_save_clicked",{paymentMethod:c,subscriptionId:n.standingorderid}),"existing"===c?null==(s=N.current)||s.call(N):null==(t=P.current)||t.call(P)}
1,[c,n.standingorderid]),k={breville:g,baratza:f,lelit:y,beanz:x,sage:g,chefsteps:v}[(0,d.qe)(n.storecode)],E=(0,i.jsxs)("div",{className:"edit-payment-modal-content-actions",children:[(0,i.jsx)(a.ButtonV2,{fill:"outlined",variant:"primary",size:"lg",onClick:t,children:j("globalProfile.subscription.editPayment.cancelBtnLabel","Cancel")}),(0,i.jsx)(a.ButtonV2,{fill:"filled",variant:"primary",size:"lg",onClick:L,children:j("globalProfile.subscription.editPayment.saveBtnLabel","Save")})]}),D=j("globalProfile.subscription.editPayment.tempChargesMessage","A temporary ".concat(C,"1 charge will be made to verify your credit card. Once the card is verified, this ").concat(C,"1 transaction is then cancelled.")),B=j("globalProfile.subscription.editPayment.title","Edit Payment");return(0,i.jsx)(a.Modal,{isOpen:s,title:B,onClose:t,titleType:"h6",footer:E,className:"edit-payment-modal",children:(0,i.jsxs)("div",{className:"edit-payment-modal__panel",children:[!b&&(0,i.jsxs)("div",{className:p()("edit-payment-modal__panel-address",{active:"existing"===c}),children:[(0,i.jsx)(m.s,{checked:"existing"===c,name:"payment-method",id:"existing-payment",onChange:()=>u("existing")}),(0,i.jsxs)("div",{className:"edit-payment-modal__panel-address-block",children:[(0,i.jsx)(h,{cardType:n.cardType,cardNumber:n.cardNumber,cardNumberTextType:"p2-bold"}),"existing"===c?(0,i.jsx)(T,{registerSubmit:S,adyenClientKey:k,subscription:n,paymentModelClose:t}):null]})]}),(0,i.jsxs)("div",{className:p()("edit-payment-modal__panel-address",{active:b||"new"===c}),children:[!b&&(0,i.jsx)(m.s,{checked:"new"===c,name:"payment-method",id:"new-payment",onChange:()=>u("new")}),(0,i.jsxs)("div",{className:"edit-payment-modal__panel-address-block",children:[(0,i.jsxs)(a.Text,{type:"p2-bold",children:[" ",j("globalProfile.subscription.addNewCard","Add a new card")," "]}),b||"new"===c?(0,i.jsx)(A,{registerSubmit:w,adyenClientKey:k,subscription:n,paymentModelClose:t}):null]})]}),(0,i.jsx)(a.Alert,{type:"info",message:D,inline:!0})]})})},D=e=>{var s;let{subscription:t,inline:n=!1}=e,{t:o}=(0,l.Bd)(),[c,d]=(0,r.useState)(!1),u=(null==t||null==(s=t.cardNumber)?void 0:s.slice(-4))==="XXXX"||!(null==t?void 0:t.isPaymentCaptured),[p,m]=(0,r.useState)(u?"new":"existing"),h=async()=>{d(!0)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.Alert,{inline:n,className:"subscription-card__alert",message:(0,i.jsxs)("div",{children:[o("globalProfile.subscription.payment-issue-prefix","Payment issue detected —")," ",(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"borderless",onClick:h,children:(0,i.jsxs)("span",{className:"subscription-card__alert-text",children:[" ",o("globalProfile.subscription.update-payment","update your payment method")," "]})})," ",o("globalProfile.subscription.payment-issue-suffix","to reactivate your subscription.")]}),type:"caution"}),t&&(0,i.jsx)(E,{subscription:t,isOpen:c,onClose:()=>{d(!1),m(u?"new":"existing")},paymentMethod:p,setPaymentMethod:m})]})};var B=t(98351),I=t(59962),F=t(49918),O=t(38533);let V=()=>({minDate:(0,d.tP)(2),maxDate:(0,d.tP)(90)}),M=[1,2,3,4,6,8].map(e=>({days:7*e,value:1===e?"1-week":"".concat(e,"-weeks")})),z=e=>{var s;let t=null!=(s=e.find(e=>e.selected))?s:e.at(0);if(!t)return 7;let{interval:i,unit:r}=t;switch(null==r?void 0:r.toUpperCase()){case"DAY":return i;case"MONTH":return 30*i;default:return 7*i}};var R=t(11576),H=t.n(R);let q=e=>{let{id:s,i18nNamespace:t,t:n,value:l,onChange:o}=e,{minDate:c,maxDate:d}=V(),[u,p]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(l)return;let e=document.getElementById(s);if(!e)return;let t=e.style.display;e.style.display="none",e.getBoundingClientRect(),e.style.display=t},[l,s]);let m=[H().dateField,l?H().dateFilled:H().dateEmpty,u?H().dateFocused:""].filter(Boolean).join(" ");return(0,i.jsx)(a.TextField,{type:"date",id:s,name:"resumeDate",label:n("".concat(t,".resumeDateLabel"),"Your subscription resumes on"),min:c,max:d,value:l,onChange:o,onFocus:()=>p(!0),onBlur:()=>p(!1),placeholder:n("".concat(t,".resumeDatePlaceholder"),"dd/mm/yyyy"),className:m,...l?{"data-display-date":(e=>e?e.split("-").reverse().join("/"):"")(l)}:{}})};var U=t(86484),Z=t.n(U);let W={"1-week":"1 week","2-weeks":"2 weeks","3-weeks":"3 weeks","4-weeks":"4 weeks","6-weeks":"6 weeks","8-weeks":"8 weeks"},Y=e=>{let{isOpen:s,onClose:t,subscription:n}=e,{setSubscriptionsLoading:o,fetchAndProcessSubscriptions:c}=(0,F.Q)(),{trackSubscriptionAction:u}=(0,O.O)("subscriptions"),{t:p}=(0,l.Bd)(),[m,h]=(0,r.useState)(null),[b,f]=(0,r.useState)(null),[x,v]=(0,r.useState)(""),{minDate:C,maxDate:j}=V();(0,r.useEffect)(()=>{s&&(h(null),f(null),v(""))},[s]);let _=!!x&&x>=C&&x<=j,N=async()=>
1{if(!_)return;o(!0);let e=z(n.plandetails),s=null===b?1:Math.max(1,Math.ceil(b/e));try{null==t||t();let e=await (0,y.ys)({iteration_number:s,pausedate:x,standing_order_id:n.standingorderid.toString()});if(!e.success||(0,I.HF)(e.data))throw Error(e.error||"Failed to pause subscription.");u("pause",n.standingorderid.toString(),{resumeDate:x,iterationNumber:s}),await c(!0)}catch(e){g.vF.error("Failed to pause subscription.",e)}finally{o(!1)}},P=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.ButtonV2,{fill:"outlined",variant:"primary",size:"lg",onClick:t,children:p("globalProfile.subscription.pauseSubscription.cancel","Cancel")}),(0,i.jsx)(a.ButtonV2,{fill:"filled",variant:"primary",size:"lg",onClick:N,disabled:!_,children:p("globalProfile.subscription.pauseSubscription.save","Save")})]});return(0,i.jsxs)(a.Modal,{isOpen:s,onClose:t,title:p("globalProfile.subscription.pauseSubscription.title","Pause subscription"),titleType:"h5",className:Z().container,footer:P,children:[(0,i.jsx)(a.Text,{className:Z().durationHeading,type:"p2-bold",children:p("globalProfile.subscription.pauseSubscription.durationHeading","How long?")}),(0,i.jsx)("div",{className:Z().durationOptions,children:M.map(e=>(0,i.jsx)(a.PillButton,{text:p("globalProfile.subscription.pauseSubscription.duration-".concat(e.value),W[e.value]),active:m===e.value,onClick:()=>((e,s)=>{h(e),f(s),v((0,d.tP)(s))})(e.value,e.days)},e.value))}),(0,i.jsx)(q,{id:"pause-subscription-resume-date",i18nNamespace:"globalProfile.subscription.pauseSubscription",t:p,value:x,onChange:e=>{h(null),f(null),v(e.target.value)}}),(0,i.jsx)(a.Text,{type:"p3",className:Z().helper,children:p("globalProfile.subscription.pauseSubscription.resumeDateHelperText","Not the right date? Edit it directly.")})]})};var G=t(28834),K=t.n(G);let Q="Failed to resume subscription.",X=e=>{var s,t;let{isOpen:r,onClose:n,subscription:{productName:o,productId:c,standingorderid:d}}=e,{products:u}=(0,B.Q)(),{setSubscriptionsLoading:p,fetchAndProcessSubscriptions:m}=(0,F.Q)(),{trackSubscriptionAction:h}=(0,O.O)("subscriptions"),{t:b}=(0,l.Bd)(),f=async()=>{p(!0);try{null==n||n();let e=await (0,y.fK)({standing_order_id:d.toString()});if(!e.success||(0,I.HF)(e.data))throw Error(e.error||Q);h("resume",d.toString()),await m(!0)}catch(e){g.vF.error(Q,e)}finally{p(!1)}};return(0,i.jsxs)(a.Modal,{isOpen:r,onClose:n,titleType:"h6",className:"resume-subscription-modal",children:[(0,i.jsxs)(a.Text,{className:"resume-subscription-modal--title",type:"h3",children:[" ",b("globalProfile.subscription.resumeSubscription.title","Resume Subscription?")," "]}),(0,i.jsx)(a.Text,{className:"resume-subscription-modal--desc",type:"p1",children:b("globalProfile.subscription.resumeSubscription.description",{defaultValue:"Your {{name}} subscription will restart, with the next order scheduled.",name:null!=(t=null!=o?o:null==u||null==(s=u[c])?void 0:s.productName)?t:""})}),(0,i.jsxs)("div",{className:"resume-subscription-modal--cta",children:[(0,i.jsx)(a.ButtonV2,{fill:"outlined",variant:"primary",size:"lg",onClick:n,children:b("globalProfile.subscription.resumeSubscription.cancel","Cancel")}),(0,i.jsx)(a.ButtonV2,{fill:"filled",variant:"primary",size:"lg",onClick:f,children:b("globalProfile.subscription.resumeSubscription.resume","Resume")})]})]})},J=e=>{let{isOpen:s,onClose:t,subscription:n}=e,{setSubscriptionsLoading:o,fetchAndProcessSubscriptions:c}=(0,F.Q)(),{trackSubscriptionAction:d}=(0,O.O)("subscriptions"),{t:u}=(0,l.Bd)(),{minDate:p,maxDate:m}=V(),[h,b]=(0,r.useState)(n.nextdeliverydate);(0,r.useEffect)(()=>{s&&b(n.nextdeliverydate)},[s,n.nextdeliverydate]);let f=!!h&&h>=p&&h<=m,x=async()=>{if(f){o(!0);try{null==t||t();let e=await (0,y.fK)({standing_order_id:n.standingorderid.toString(),pausedate:h});if(!e.success||(0,I.HF)(e.data))throw Error(e.error||Q);d("resume",n.standingorderid.toString(),{resumeDate:h}),await c(!0)}catch(e){g.vF.error(Q,e)}finally{o(!1)}}},v=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.ButtonV2,{fill:"outlined",variant:"primary",size:"lg",onClick:t,children:u("globalProfile.subscription.resumeSubscriptionDatePicker.cancel","Cancel")}),(0,i.jsx)(a.ButtonV2,{fill:"filled",variant:"primary",size:"lg",onClick:x,disabled:!f,children:u("globalProfile.subscription.resumeSubscriptionDatePicker.save","Save")})]});return(0,i.jsxs)(a.Modal,{isOpen:s,onClose:t,title:u("globalProfile.subscription.resumeSubscriptionDatePicker.title","Resume subscription"),titleType:"h5",className:K().container,footer:v,children:[(0,i.jsx)(a.Text,{type:"p2",className:K().description,children:u("globalProfile.subscription.resumeSubscriptionDatePicker.description","Choose when your subscription resumes.")}),(0,i.jsx)(q,{id:"resume-subscription-date",i18nNamespace:"globalProfile.subscription.resumeSubscriptionDatePicker",t:u,value:h,onChange:e=>{b(e.target.value)}}),(0,i.jsx)(a.Text,{type:"p3",className:K().helper,children:u("globalProfile.subscription.resumeSubscriptionDatePicker.helperText","Pick any date within your available range.")})]})},$=e=>e.subscription.isBeanz?(0,i.jsx)(J,{...e}):(0,i.jsx)(X,{...e});var ee=t(2853),es=t(6032),et=t.n(es);let ei=e=>{var s,t;let{t:u}=(0,l.Bd)(),{globalConfig:{locale:p,currencyCode:m}}=(0,o.h5)(),{switchRouteTo:h}=(0,c.b)(),{isCanister:b,products:g}=(0,B.Q)(),[f,x]=(0,r.useState)(null),y=(0,n.s)({locale:p,currencyCode:m,fractionDigits:2}),{className:v,...C}=e,{nextdeliverydate:j,status:_,totalamount:N,standingorderid:P,isExpired:S,productId:w,productName:L,iterationPaymentFailedCount:k}=C,T=null!=(t=null!=L?L:null==(s=g[w])?void 0:s.productName)?t:u("globalProfile.subscription.title","Subscription"),A=b(w),E=C.isBeanz&&!A,I=k>=ee.Q9,F=E&&"PAUSED"===_&&!S&&!I,O="subscription-card ".concat(v||"").trim();return(0,i.jsxs)("div",{className:O,children:[E&&"ACTIVE"===_&&(0,i.jsx)(Y,{subscription:C,isOpen:"pause"===f,onClose:()=>x(null)}),F&&(0,i.jsx)($,{subscription:C,isOpen:"resume"===f,onClose:()=>x(null)}),(0,i.jsxs)("div",{className:"subscription-card__content",children:[("ACTIVE"===_||"PAUSED"===_)&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"subscription-card__header",children:[(0,i.jsx)("div",{className:"subscription-card__order-info",children:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(a.Text,{tag:"span",type:"p3",className:"subscription-card__label",children:[u("globalProfile.subscription.nextOrder","Next Order Processing Date"),":"]}),(0,i.jsx)(a.Text,{tag:"span",type:"h5",className:"subscription-card__date",children:A?u("globalProfile.subscription.whenExchanged","When exchanged"):(0,d.Yq)(j)})]})}),(0,i.jsx)("div",{className:"subscription-card__price",children:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(a.Text,{tag:"span",type:"h6",className:"subscription-card__amount",children:[y(N)," ",""]}),(0,i.jsx)(a.Text,{tag:"span",type:"p3",className:"subscription-card__frequency",children:u("globalProfile.subscription.perDelivery","per delivery")})]})})]}),(S||I)&&(0,i.jsx)(D,{subscription:C,inline:!0}),(0,i.jsx)(a.Divider,{className:"subscription-card__divider"})]}),(0,i.jsxs)("div",{className:"subscription-card__product",children:[(0,i.jsx)(eC,{subscription:{...C},enableInfoIcon:!!(C.maximumBagSize&&C.minimumBagSize),commonWeight:C.productId.endsWith("LG")?null==C?void 0:C.minimumBagSize:null==C?void 0:C.maximumBagSize}),"ACTIVE"!==_&&"PAUSED"!==_?(0,i.jsxs)("div",{children:[(0,i.jsx)(a.ButtonV2,{href:"#",variant:"primary",fill:"borderless",className:"subscription-card__view-detail-desktop",icon:{iconName:"
1chevron-right",iconSize:"3x",iconPrefix:"fak"},onClick:()=>h("subscriptions",P.toString()),ariaLabel:u("globalProfile.subscription.view-detail-aria-label","View details for {{ productName }} subscription",{productName:T}),children:u("globalProfile.subscription.view-details","View details")}),(0,i.jsx)(a.ButtonV2,{href:"#",variant:"primary",fill:"borderless",className:"subscription-card__view-detail-mobile",icon:{iconName:"chevron-right",iconSize:"3x",iconPrefix:"fak"},onClick:()=>h("subscriptions",P.toString()),ariaLabel:u("globalProfile.subscription.view-detail-aria-label","View details for {{ productName }} subscription",{productName:T})})]}):(0,i.jsxs)("div",{className:"subscription-card__actions ".concat(et().actions),children:[(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"outlined",size:"sm",onClick:()=>h("subscriptions",P.toString()),ariaLabel:u("globalProfile.subscription.manage-aria-label","Manage {{ productName }} subscription",{productName:T}),children:u("globalProfile.subscription.manage-subscriptions","Manage Subscription")}),E&&"ACTIVE"===_&&(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"outlined",size:"sm",onClick:()=>x("pause"),disabled:!C.isEditable,ariaLabel:u("globalProfile.subscription.pause-aria-label","Pause {{ productName }} subscription",{productName:T}),children:u("globalProfile.subscription.pauseSubscription.title","Pause subscription")}),F&&(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"outlined",size:"sm",onClick:()=>x("resume"),ariaLabel:u("globalProfile.subscription.resume-aria-label","Resume {{ productName }} subscription",{productName:T}),children:u("globalProfile.subscription.resume","Resume Subscription")})]})]})]})]})};var er=t(91351),ea=t(45859),en=t(94666);let el=()=>{let{state:e}=(0,en.KE)();return{products:e.chefsteps.digitalProducts.data,isLoading:e.chefsteps.digitalProducts.isLoading}};var eo=t(14285),ec=t(84375);let ed=e=>{var s;return"PAUSED"===e.status&&!e.isExpired&&(null!=(s=e.iterationPaymentFailedCount)?s:0)<ee.Q9},eu=e=>e("globalProfile.subscription.chefsteps-status-paused","Paused"),ep=e=>{let{productDetails:s,isLoading:t}=e;if(t)return(0,i.jsx)(a.Skeleton,{height:140,width:140});if(null==s?void 0:s.imageUrl){var r;return(0,i.jsx)(a.AspectRatio,{ratio:"1-1",rounded:!0,className:"subscription-card__chefsteps-aspect-ratio",children:(0,i.jsx)(a.Image,{src:s.imageUrl,alt:null!=(r=s.title)?r:""})})}return(0,i.jsx)("div",{className:"subscription-card__chefsteps-thumbnail-placeholder"})},em=e=>{var s;let{subscription:t,productDetails:r,isProductLoading:u,className:p}=e,{t:m}=(0,l.Bd)(),{globalConfig:{locale:h,currencyCode:b}}=(0,o.h5)(),{switchRouteTo:g}=(0,c.b)(),{status:f,nextdeliverydate:x,subscriptionunitamount:y,standingorderid:v,isExpired:C,frequencyLabel:j,plandetails:_}=t,N="TRIAL_ACTIVE"===f,P="SCHEDULED"===f,S=ed(t),w="CANCEL_SCHEDULED"===f?m("globalProfile.subscription.chefsteps-subscription-ends-on","Subscription Ends On"):N?m("globalProfile.subscription.chefsteps-first-billing-date","First Billing Date"):P?m("globalProfile.subscription.chefsteps-activates","Activates"):"ACTIVE"===f?m("globalProfile.subscription.chefsteps-renews","Renews"):S?eu(m):m("globalProfile.subscription.chefsteps-next-renewal-date","Renewal Date"),L=(e=>{let s=e.find(e=>e.selected);if((null==s?void 0:s.unit)!=="MONTH")return;let t=Number(s.interval);return 12===t?"yearly":1===t?"monthly":void 0})(_),k=((e,s,t)=>"yearly"===e?t("globalProfile.subscription.chefsteps-annual-pass","Annual pass"):"monthly"===e?t("globalProfile.subscription.chefsteps-monthly-pass","Monthly pass"):s)(L,j,m),T=((e,s,t,i,r)=>{let a=Number.isInteger(e),l=(0,n.s)({locale:t,currencyCode:i,fractionDigits:2*!a})(e);return"yearly"===s?r("globalProfile.subscription.chefsteps-price-yearly","{{amount}}/year",{amount:l}):"monthly"===s?r("globalProfile.subscription.chefsteps-price-monthly","{{amount}}/month",{amount:l}):"".concat(l," ").concat(r("globalProfile.subscription.chefsteps-per-pass","per pass"))})(y,L,h,b,m),A=()=>g("subscriptions",v.toString()),E=null!=(s=null==r?void 0:r.features)?s:[],B=()=>{var e;return(0,i.jsxs)("div",{className:"subscription-card__chefsteps-product",children:[(0,i.jsx)("div",{className:"subscription-card__chefsteps-thumbnail",children:(0,i.jsx)(ep,{productDetails:r,isLoading:u})}),(0,i.jsxs)("div",{className:"subscription-card__chefsteps-product-info",children:[u?(0,i.jsx)(a.Skeleton,{height:22,width:"70%"}):(0,i.jsx)(a.Text,{type:"h6",className:"subscription-card__chefsteps-product-name",children:null!=(e=null==r?void 0:r.title)?e:""}),(0,i.jsx)(a.Text,{type:"p3",className:"subscription-card__chefsteps-plan-label",children:k}),!u&&E.length>0&&(0,i.jsx)("div",{className:"subscription-card__chefsteps-features",children:E.map((e,s)=>(0,i.jsx)(a.Text,{type:"p3",tag:"span",className:"subscription-card__chefsteps-feature",children:e},"".concat(e,"-").concat(s)))})]})]})};return"CANCELLED"===f?(0,i.jsx)("div",{className:"subscription-card subscription-card--chefsteps-cancelled ".concat(null!=p?p:"").trim(),children:(0,i.jsxs)("div",{className:"subscription-card__product",children:[B(),(0,i.jsx)("div",{className:"subscription-card__chefsteps-cancelled-actions",children:(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"borderless",icon:{iconName:"
1chevron-right",iconSize:"3x",iconPrefix:"fak"},onClick:A,children:m("globalProfile.subscription.view-details","View details")})})]})}):(0,i.jsx)("div",{className:"subscription-card ".concat(null!=p?p:"").trim(),children:(0,i.jsxs)("div",{className:"subscription-card__content",children:[(0,i.jsxs)("div",{className:"subscription-card__header",children:[(0,i.jsxs)("div",{className:"subscription-card__order-info",children:[(0,i.jsx)(a.Text,{tag:"span",type:"p3",className:"subscription-card__label",children:w}),!S&&(0,i.jsx)(a.Text,{tag:"span",type:"h5",className:"subscription-card__date",children:(0,d.Yq)(x)})]}),(0,i.jsx)("div",{className:"subscription-card__price",children:(0,i.jsx)(a.Text,{tag:"span",type:"h6",children:T})})]}),C&&(0,i.jsx)(D,{subscription:t,inline:!0}),N&&(0,i.jsx)(a.Alert,{inline:!0,type:"info",className:"subscription-card__alert",message:m("globalProfile.subscription.chefsteps-trial-active-alert","You are currently on a free trial. Your first billing will be on {{date}}.",{date:(0,d.Yq)(x)})}),P&&(0,i.jsx)(a.Alert,{inline:!0,type:"info",className:"subscription-card__alert",message:m("globalProfile.subscription.chefsteps-subscription-change-alert","Subscription Change: Your upcoming subscription will take affect {{date}}",{date:(0,d.Yq)(x)})}),S&&(0,i.jsx)(a.Alert,{inline:!0,type:"info",className:"subscription-card__alert",message:m("globalProfile.subscription.chefsteps-paused-alert","This membership is on hold while your other subscription is active.")}),(0,i.jsx)(a.Divider,{className:"subscription-card__divider"}),(0,i.jsxs)("div",{className:"subscription-card__product",children:[B(),(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"outlined",size:"sm",className:"subscription-card__actions",onClick:A,children:m("globalProfile.subscription.chefsteps-manage-subscription","Manage subscription")})]})]})})};var eh=t(4583),eb=t(7559),eg=t(40081);let ef=e=>(0,eb.e)(e.storecode),ex=()=>{let{t:e}=(0,l.Bd)(),{subscriptionsData:s,fetchAndProcessSubscriptions:t,isLoading:n,hasExecuted:o}=(0,F.Q)(),{getProducts:c}=(0,B.Q)(),{products:d,isLoading:u}=el(),{trackPageView:p}=(0,O.O)("subscriptions"),{fetchIdToken:m}=(0,eg.x)();(0,r.useEffect)(()=>{t()},[t]);let h=(0,r.useCallback)(e=>{let s=ef(e);return s===eh.O_&&(!s||Object.hasOwn(d,e.skucode))},[d]),{isPolling:b}=(0,ea.mk)({subscriptions:s,isLoading:n,hasExecuted:o,fetchAndProcessSubscriptions:t,isChefstepsSubscriptionVisible:h,onPollSuccess:()=>{m()}});if((0,r.useEffect)(()=>{let e=Object.values(s).flat();c(eh.O_?[]:e.filter(e=>!ef(e)).map(e=>e.productId)).catch(()=>{})},[s,c]),(0,r.useEffect)(()=>{if(!n&&!b&&s){var e,t,i,r,a;let n=Object.values(s).flat().length,l=(null==(e=s.ACTIVE)?void 0:e.length)||0;p({totalSubscriptions:n,activeCount:l,pausedCount:eh.O_?(null==(t=s.SCHEDULED)?void 0:t.length)||0:(null==(i=s.PAUSED)?void 0:i.length)||0,cancelledCount:eh.O_?(null==(r=s.EXPIRED)?void 0:r.length)||0:(null==(a=s.CANCELLED)?void 0:a.length)||0})}},[n,b,s,p]),n||b)return(0,i.jsx)(ec.k,{count:4});if(s&&Object.values(s).every(e=>0===e.filter(e=>h(e)).length))return(0,i.jsx)(eo.p,{pageName:"subscription",hideButton:!0});let g={ACTIVE:e("globalProfile.subscription.status-active","ACTIVE"),PAUSED:e("globalProfile.subscription.status-paused","INACTIVE"),CANCELLED:e("globalProfile.subscription.status-cancelled","CANCELLED"),INACTIVE:e("globalProfile.subscription.status-inactive","INACTIVE"),SCHEDULED:e("globalProfile.subscription.status-scheduled","SCHEDULED"),EXPIRED:e("globalProfile.subscription.status-expired","EXPIRED")};return(0,i.jsx)("div",{className:"subscription__container",children:Object.entries(s).map(e=>{let[s,t]=e,r=t.filter(e=>h(e));return r.length>0&&(0,i.jsxs)("div",{className:"subscription__group subscription__group--".concat(s),children:[(0,i.jsx)("div",{className:"subscription__status-section",children:(0,i.jsx)(a.Text,{type:"caps-label",className:"subscription__status-title",children:g[s]})}),(0,i.jsx)("div",{className:"subscription__items",children:r.map((e,t)=>{var r;return(0,i.jsx)("div",{className:"subscription__list",children:ef(e)?(0,i.jsx)(em,{subscription:e,productDetails:null!=(r=d[e.skucode])?r:null,isProductLoading:u}):(0,i.jsx)(ei,{...e})},"".concat(s,"-").concat(t))})})]},s)})})},ey=()=>{let{t:e}=(0,l.Bd)();return(0,i.jsx)(er.k,{title:e("globalProfile.subscription.title","Subscription"),children:(0,i.jsx)(ex,{})})};var ev=t(3153);
1let eC=e=>{var s,t,c,d;let{t:u}=(0,l.Bd)(),{globalConfig:p}=(0,o.h5)(),{currencySymbol:m,collectionConfig:h}=p,{getProducts:b,products:g,isLoading:f}=(0,B.Q)(),{className:x,productNameProps:y={type:"h6"},subscription:v,enableInfoIcon:C,commonWeight:j}=e,{productName:_,tileImageUrl:N,productId:P}=v;(0,r.useEffect)(()=>{b([P])},[P]);let S=null==h||null==(s=h[P])?void 0:s.name,w=((e,s,t,i,r,a)=>{let{isBeanz:l,quantity:o,frequencyLabel:c,bagSize:d,maximumBagSize:u,minimumBagSize:p}=e,m=s("globalProfile.subscription.".concat(l?"beanz":"breville","Delivery").concat(1===o?"Container":"Containers"),{quantity:o}),h=s("globalProfile.subscription.every","every"),b=c?"".concat(m," ").concat(h," ").concat(c.toLowerCase()):m;if(l){var g,f,x;return[{text:null!=a?a:""},{text:null!=(g=e.flavourNote)?g:""},{text:null!=(f=e.brewingMethod)?f:""},{text:null!=(x=e.grind)?x:""},{text:d?((e,s,t,i)=>{var r;if(!e.isBeanz||!e.bagSize)return"";let a=(0,n.s)({locale:t,currencyCode:i,fractionDigits:2}),l=s("globalProfile.beanzDeliveryContainer",{quantity:e.bagSize,defaultValue:"{{quantity}}"}),o=a(e.subscriptionunitamount),c=s("globalProfile.pricePerUnit",{defaultValue:"{{formattedAmount}} per {{unit}}",formattedAmount:a(Number(null==(r=e.unitPricing)?void 0:r.unitPrice)),unit:(e=>{let{weightUnit:s,unitWeight:t}=e.unitPricing||{};return s&&t?t>1?"".concat(t," ").concat(s):"".concat(s):""})(e)});return"".concat(l," | ").concat(o," | ").concat(c)})(e,s,i,r):""},{text:p&&u?"".concat(p," - ").concat(u," ").concat(s("globalProfile.subscription.bags","bags")):"",showIcon:!!(p&&u)},{text:b}].filter(e=>e.text)}return[{text:null!=a?a:""},{text:b}].filter(e=>e.text)})(v,u,0,p.locale,p.currencyCode,S),L=null!=N?N:null==(t=g[P])?void 0:t.pdpImageUrl,k=(0,r.useMemo)(()=>{if(!j)return null;let e=u("globalProfile.subscription.summary.bagSizeInfo",{size:j});return(0,i.jsx)(a.Tooltip,{id:"bagSizeInfo-".concat(P),place:"right",tooltipContent:e,triggerClassName:"order-summary__tooltip",children:(0,i.jsx)(a.Icon,{iconName:"
1circle-info",iconPrefix:"fak",iconSize:"3x"})})},[j,u]);return(0,i.jsxs)("div",{className:"product-section ".concat(x||""),children:[L&&(0,i.jsx)("div",{className:"product-section__image",children:(0,i.jsx)(a.AspectRatio,{ratio:"1-1",rounded:!0,className:"product-section__image-aspect-ratio",children:(0,i.jsx)(a.Image,{src:L,alt:_})})}),(0,i.jsxs)("div",{className:"product-section__details",children:[(0,i.jsxs)("div",{className:"product-section__title",children:[f&&(0,i.jsx)(a.Skeleton,{height:20,width:"100%"}),!f&&(null==(c=g[P])?void 0:c.vendorName)&&(0,i.jsx)(a.Text,{type:"caps-label",children:g[P].vendorName}),(0,i.jsx)(a.Text,{...y,children:null!=_?_:null==(d=g[P])?void 0:d.productName})]}),w.length>0&&(0,i.jsx)("div",{className:"product-section__specs",children:w.map(e=>(0,i.jsxs)("div",{className:"product-detail-item",children:[(0,i.jsx)(a.Text,{type:"p3",tag:"span",className:"product-explanation",children:e.text}),(null==e?void 0:e.showIcon)&&C&&(0,i.jsxs)(i.Fragment,{children:[" ",k]})]},(0,ev.A)()))})]})]})};var ej=t(89099),e_=t(7818),eN=t(88992);let eP={},eS=/^[a-z]{2}$/;function ew(e){var s,t;let{id:n="addressLine1",onSearch:o,countryCode:c,googleMapsApiKey:d,registerOptions:u,label:p,countryStates:m,value:h,stateList:b}=e,g="addressLine1",{register:f,formState:x}=(0,eN.xW)(),{t:y}=(0,l.Bd)(["common"]);((e,s,t,i,n,l)=>{let o,c="address_autocomplete",d=(0,r.useRef)(0),u=(0,r.useRef)(l);(0,r.useEffect)(()=>{u.current=l},[l]),(0,r.useEffect)(()=>{function t(){let e=document.getElementById(c);e&&e.remove()}return window.gm_authFailure=()=>{let s=document.getElementById(e);s&&(s.disabled=!1,s.placeholder="",s.style.background="none",s.focus())},d.current&&window.clearTimeout(d.current),d.current=window.setTimeout(function(){t();let e=document.createElement("script");e.id=c,e.src="https://maps.googleapis.com/maps/api/js?key=".concat(s,"&libraries=places"),e.onload=m,document.body.appendChild(e)},250),()=>{d.current&&window.clearTimeout(d.current),h(),t()}},[n]);let p=()=>{var s;let r=null==(s=eP[e])?void 0:s.getPlace();r&&i((0,a.extractDataFromAutocomplete)(r,t,u.current))},m=()=>{let s=document.getElementById(e);if(!s)return;let t=null==n?void 0:n.trim().toLowerCase(),i={country:t&&eS.test(t)?[t]:[]};eP[e]=new google.maps.places.Autocomplete(s,{componentRestrictions:i,fields:["address_components","formatted_address"],types:["address"]}),o=google.maps.event.addListener(eP[e],"place_changed",p)},h=()=>{o&&(google.maps.event.removeListener(o),o=void 0),eP[e]&&(google.maps.event.clearInstanceListeners(eP[e]),eP[e]=void 0)}})(n,d,m,o,c,b);let v=null==x||null==(t=x.errors)||null==(s=t[g])?void 0:s.message;return(0,i.jsx)(a.TextField,{id:n,label:p,errorText:y(v,v),...f(g,u),autoComplete:"no-autofill",name:g,type:"text",value:h})}let eL=e=>{var s,t,n,l,c,d,u,p,m,h;let{ccValue:b,isDefault:g,defaultState:f,isSubscription:x=!1,shouldShowRequired:v=!0,setIsLoading:C,globalizationPrefix:j="globalProfile.accountSettings.addressForm",addressType:_}=e,{t:N}=(0,e_.B)(["common"]),{globalConfig:{googleMapsApiKey:P,euFlag:S,disabledZipCodePrefixes:w}}=(0,o.h5)(),L="shippingAddress"===_&&w&&w.length>0?[{zipCodes:w,errorMessage:N("ga-validation-non-shippable-zipcode-message","We do not deliver to this zipcode")}]:[],k=(0,a.generateValidationRules)((b||"us").toLowerCase(),N,"true"===S,L),{register:T,formState:{errors:A},setValue:E,watch:D,getValues:B}=(0,eN.xW)(),I="address-form-group",F="address-form-input",O=D("state"),V=B(),M=(0,r.useRef)([]),[z,R]=(0,r.useState)([]),H=(0,r.useCallback)(async e=>{C(!0);let s=await (0,y.B4)(e);if(s.success){var t,i;let e=(null==(i=s.data)||null==(t=i.body)?void 0:t.states)||[];M.current=e,R(e),setTimeout(()=>{var s;E("state",null!=f?f:(null==(s=e[0])?void 0:s.value)||"")},100)}C(!1)},[C,E,f]);(0,r.useEffect)(()=>{b&&H(b)},[b,H]);let q=e=>v?"".concat(e," *"):e;return(0,i.jsxs)(i.Fragment,{children:[x&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:I,children:[(0,i.jsx)("div",{className:F,children:(0,i.jsx)(a.TextField,{label:N("".concat(j,".firstName"),"First Name"),id:"firstName",...T("firstName",k.firstName),errorText:N(null==A||null==(s=A.firstName)?void 0:s.message),value:V.firstName})}),(0,i.jsx)("div",{className:F,children:(0,i.jsx)(a.TextField,{label:N("".concat(j,".lastName"),"Last Name"),id:"lastName",...T("lastName",k.lastName),errorText:N(null==A||null==(t=A.lastName)?void 0:t.message),value:V.lastName})})]}),(0,i.jsx)(a.TextField,{label:N("".concat(j,".company"),"Company"),id:"companyName",...T("companyName",{maxLength:{value:30,message:N("".concat(j,".companyMaxLength"),"Company name must be less than 30 characters")}}),errorText:N(null==A||null==(n=A.companyName)?void 0:n.message),value:V.companyName}),(0,i.jsx)(a.TextField,{label:N("bof-form-phone-number","Phone Number"),id:"phone",...T("phone",k.phone),errorText:N(null==A||null==(l=A.phone)?void 0:l.message),value:V.phone})]}),(0,i.jsx)(ew,{googleMapsApiKey:P,countryStates:"true",countryCode:b,stateList:z,label:q(N("".concat(j,".address1"),"Address 1")),id:"addressLine1",registerOptions:k.address,onSearch:e=>{var s;let t={addressLine1:e.streetName,city:e.city,state:e.state,postalCode:e.postalCode,addressLine2:e.additionalStreetInfo};t.state=(null==(s=M.current.find(s=>
1s.value===e.state))?void 0:s.value)||"",Object.entries(t).forEach(e=>{let[s,t]=e;return E(s,t,{shouldValidate:!0})})},value:V.addressLine1}),(0,i.jsx)(a.TextField,{label:N("".concat(j,".address2"),"Address 2"),id:"address-2",...T("addressLine2",{maxLength:null==(c=k.address)?void 0:c.maxLength}),errorText:N(null==A||null==(d=A.addressLine2)?void 0:d.message),value:V.addressLine2}),(0,i.jsxs)("div",{className:I,children:[!x&&(0,i.jsx)("div",{className:F,children:(0,i.jsx)(a.TextField,{label:N("".concat(j,".country"),"Country"),id:"country",...T("countryCode"),disabled:!0,value:b&&eh.kf[b]||b||""})}),(0,i.jsx)("div",{className:F,children:(0,i.jsx)(a.TextField,{label:q(N("".concat(j,".city"),"City")),id:"city",...T("city",k.city),errorText:N(null==A||null==(u=A.city)?void 0:u.message),value:V.city})}),x&&(0,i.jsx)("div",{className:F,children:(0,i.jsx)(a.TextField,{label:q(N("".concat(j,".zipCode"),"Zip code")),id:"zip-code",...T("postalCode",k.zipCode),errorText:N(null==A||null==(p=A.postalCode)?void 0:p.message),value:V.postalCode})})]}),(z.length>0||!x)&&(0,i.jsxs)("div",{className:I,children:[z.length>0&&(0,i.jsx)("div",{className:F,children:(0,i.jsx)(a.Dropdown,{options:z,t:N,label:q(N("".concat(j,".state"),"State")),id:"state",...T("state",k.state),errorText:N(null==A||null==(m=A.state)?void 0:m.message),value:O})}),!x&&(0,i.jsx)("div",{className:F,children:(0,i.jsx)(a.TextField,{label:q(N("".concat(j,".zipCode"),"Zip code")),id:"zip-code",...T("postalCode",k.zipCode),errorText:N(null==A||null==(h=A.postalCode)?void 0:h.message),value:V.postalCode})})]}),!x&&!g&&(0,i.jsx)("div",{className:I,children:(0,i.jsx)(a.CheckBox,{label:N("".concat(j,".setAsDefault"),"Set as default"),id:"is-default",...T("isDefault")})})]})};var ek=t(88852);let eT=e=>{let{verificationData:s,selectedAddress:t,setSelectedAddress:r}=e,{t:n}=(0,e_.B)(["common"]),l=n("globalProfile.subscription.editAddress.verificationMessage","Avoid delivery delays by using a verified address. Please check your submitted address or use the suggested, verified address.");return(0,i.jsxs)("div",{className:"verification-address-content",children:[(0,i.jsx)(a.Text,{type:"p2",children:l}),s.map(e=>(0,i.jsxs)("label",{className:p()("verification-address-content-list-item",{active:e.type===t}),htmlFor:e.type,children:[(0,i.jsx)(m.s,{checked:e.type===t,name:e.type,id:e.type,onChange:()=>r(e.type)}),(0,i.jsxs)("div",{className:"verification-address-content-list-item-details",children:[(0,i.jsx)("div",{className:"verification-address-content-list-item-details-label",children:(0,i.jsx)(a.Text,{type:"p2-bold",children:"verified"===e.type?n("globalProfile.subscription.editAddress.suggestedAddress","Suggested, verified address"):n("globalProfile.subscription.editAddress.submittedAddress","Submitted, unverified address")})}),(0,i.jsxs)("div",{className:"verification-address-content-list-item-details-address",children:[(0,i.jsxs)(a.Text,{type:"p2",children:[e.addressLine1," ",e.addressLine2&&", ".concat(e.addressLine2," ")]}),(0,i.jsxs)(a.Text,{type:"p2",children:[e.city,", ",e.state," "]}),(0,i.jsxs)(a.Text,{type:"p2",children:[e.country," ",e.postalCode]})]})]})]},e.type))]})};var eA=t(14993);let eE=e=>{let{verificationData:s}=e,{t}=(0,e_.B)(["common"]),r=t("globalProfile.subscription.editAddress.nonShippableMessage","We are not able to ship to the address you have submitted. Please change the address to a verified address to avoid delivery delays.");return(0,i.jsxs)("div",{className:"verification-address-content",children:[(0,i.jsx)(a.Text,{type:"p2",children:r}),s.map(e=>(0,i.jsx)("label",{className:p()("verification-address-content-list-item"),htmlFor:e.type,children:(0,i.jsxs)("div",{className:"verification-address-content-list-item-details",children:[(0,i.jsx)("div",{className:"verification-address-content-list-item-details-label",children:(0,i.jsx)(a.Text,{type:"p2-bold",children:t("globalProfile.subscription.editAddress.nonShippableAddress","Submitted, Non-Shippable Address")})}),(0,i.jsxs)("div",{className:"verification-address-content-list-item-details-address",children:[(0,i.jsxs)(a.Text,{type:"p2",children:[e.addressLine1," ",e.addressLine2&&", ".concat(e.addressLine2," ")]}),(0,i.jsxs)(a.Text,{type:"p2",children:[e.city,", ",e.state," "]}),(0,i.jsxs)(a.Text,{type:"p2",children:[e.country," ",e.postalCode]})]})]})},e.type))]})},eD=e=>{let{isOpen:s,onClose:t,type:n,address:l,subscriptionId:c,alertInfo:d,setAlertInfo:u}=e,{t:p}=(0,e_.B)(["common"]),[m,h]=(0,r.useState)(!1),[b,g]=(0,r.useState)(null),[f,x]=(0,r.useState)([]),[v,C]=(0,r.useState)("verified"),{globalConfig:{countryCode:j}}=(0,o.h5)(),{phone:_,firstname:N,lastname:P,companyName:S,addressline1:w,addressline2:L,city:k,state:T,region:A,postalcode:E,country:D}=null!=l?l:{},B=eh.O_?"US":D||j.toUpperCase(),I=null!=T?T:A,F=(0,eN.mN)({mode:"all",defaultValues:{firstName:N,lastName:P,companyName:S,phone:_,addressLine1:w,addressLine2:L,city:k,state:T,postalCode:E,countryCode:B}}),{handleSubmit:O,getValues:V}=F,M=async e=>{h(!0);let s={address:{countryName:e.countryCode,streetAddress:e.addressLine1,extendedAddress:e.addressLine2,locality:e.city,postalCode:e.postalCode,...A&&{region:e.state},...(T||!A)&&{state:e.state}},name:{givenName:e.firstName,familyName:e.lastName},phone:{phoneNumber:e.phone},organization:{companyName:e.companyName},standingOrderDetails:{standingOrderId:c,billingShippingRef:n.charAt(0).toUpperCase()+n.slice(1)}};(await (0,y.P8)(s)).success?(u({type:"success",message:p("globalProfile.subscription.editAddress.success","Address updated successfully")}),R(!0)):u({type:"error",message:p("globalProfile.subscription.editAddress.error","Error updating address")}),h(!1)},z=async e=>{h(!0);let s=await (0,eA.gD)(e);s.length>0&&"nonShippable"!==s[0].type?(x(s),g("verification"),1===s.length&&C(s[0].type)):s.length>0&&"nonShippable"===s[0].type?(g("nonShippable"),x(s)):u({type:"error",message:p("globalProfile.subscription.editAddress.verificationError","Error verifying address")}),h(!1)},R=e=>{g(null),t(null!=e&&e)};(0,r.useEffect)(()=>{s&&g(n)},[s,n]);let H=(0,i.jsxs)("div",{className:"edit-address-modal-content-actions",children:["nonShippable"!==b&&(0,i.jsx)(a.ButtonV2,{fill:"outlined",variant:"primary",size:"sm",onClick:()=>R(),disabled:m,children:p("globalProfile.subscription.editAddress.cancelBtnLabel","Cancel")}),("verification"===b||"billingAddress"===b)&&(0,i.jsx)(a.ButtonV2,{fill:"filled",variant:"primary",size:"sm",onClick:"verification"===b?()=>{let e=f.find(e=>e.type===v),s=V();e&&(s.addressLine1=e.addressLine1,s.addressLine2=e.addressLine2,s.city=e.city,s.state=e.state,s.postalCode=e.postalCode,s.countryCode=e.country),M(s)}:O(e=>e&&M(e),e=>{Object.keys(e).length>0&&u({type:"error",message:p("globalProfile.subscription.editAddress.fieldError","Please correct the errors below")})}),disabled:m,children:p("globalProfile.subscription.editAddress.saveBtnLabel","Save")}),"shippingAddress"===b&&(0,i.jsx)(a.ButtonV2,{fill:"filled",variant:"primary",size:"sm",onClick:O(e=>e&&z(e)),disabled:m,children:p("globalProfile.subscription.editAddress.verifyBtnLabel","Verify")}),"nonShippable"===b&&(0,i.jsx)(a.ButtonV2,{fill:"filled",variant:"primary",size:"sm",onClick:()=>{g("shippingAddress"),C("verified")},disabled:m,children:p("globalProfile.subscription.editAddress.nonShippableBtnLabel","Change address")})]}),q=p("globalProfile.subscription.editAddress.".concat(b,"Title"),"Edit Address");return(0,i.jsxs)(a.Modal,{isOpen:s,onClose:()=>R(),titleType:"h6",className:"edit-address-modal",title:q,footer:H,children:[["shippingAddress","billingAddress"].includes(null!=b?b:"")&&(0,i.jsxs)(eN.Op,{...F,children:[(0,i.jsx)(ek.z,{alertInfo:d}),(0,i.jsx)("div",{className:"subscription-address-form",children:(0,i.jsx)(eL,{ccValue:B,setIsLoading:h,defaultState:I,isSubscription:!0,globalizationPrefix:"globalProfile.subscription.editAddress",shouldShowRequired:!1,addressType:b})})]}),"verification"===b&&(0,i.jsx)(eT,{verificationData:f,selectedAddress:v,setSelectedAddress:C}),"nonShippable"===b&&(0,i.jsx)(eE,{verificationData:f}),(0,i.jsx)(a.Loader,{isLoading:m})]})};var eB=t(54024),eI=t(81796);let eF=e=>{var s;
1let{promoDetails:t,subscription:c,setCancelModalType:d,setLoading:u}=e,{t:p}=(0,l.Bd)(),{products:m}=(0,B.Q)(),{user:h}=(0,eI.WB)(),{globalConfig:b}=(0,o.h5)(),{locale:g,currencyCode:f}=b,{productName:x,tileImageUrl:y,productId:v,subscriptionunitamount:C,bagSize:j}=c,_=(0,r.useMemo)(()=>(0,n.s)({locale:g,currencyCode:f,fractionDigits:2}),[g,f]),N=_(C-C*t.discount.percent_off/100),P=async()=>{var e;let s={customerExternalId:(0,eB.zz)({}),voucherCode:t.code,campaignName:t.metadata.ASSOCIATED_CAMPAIGN,standingOrderId:c.standingorderid,customerNumber:null!=(e=null==h?void 0:h.email)?e:""};u(!0);let i=await (0,eA.dk)(s);u(!1),(null==i?void 0:i.success)?d("offerRedeemed"):d("error")};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"cancellation-promo-header",children:[(0,i.jsx)(a.Text,{type:"h3",children:p("globalProfile.subscription.cancelSubscription.offerTitle","Care to negotiate?")}),(0,i.jsx)(a.Text,{type:"p1-bold",children:p("globalProfile.subscription.cancelSubscription.offerDescription","Get 20% off your subscription for 3 months")})]}),(0,i.jsx)("div",{className:"cancellation-promo-image",children:y&&(0,i.jsx)(a.AspectRatio,{ratio:"1-1",rounded:!0,className:"product-section__image-aspect-ratio",children:(0,i.jsx)(a.Image,{src:y,alt:x})})}),(0,i.jsxs)("div",{className:"cancellation-promo-content",children:[(0,i.jsx)(a.Text,{type:"p1-bold",children:null!=x?x:null==(s=m[v])?void 0:s.productName}),(0,i.jsxs)("div",{className:"cancellation-promo-content-price",children:[(0,i.jsx)(a.Text,{type:"h4-alternative",className:"cancellation-promo-content-price-original",children:_(C)}),(0,i.jsx)(a.Text,{type:"h4",children:N}),j&&(0,i.jsx)(a.Text,{type:"p4",children:p("globalProfile.subscription.cancelSubscription.perBag","per bag")})]})]}),(0,i.jsxs)("div",{className:"cancel-subscription-modal-actions",children:[(0,i.jsx)(a.ButtonV2,{type:"button",size:"fullWidth",onClick:P,children:p("globalProfile.subscription.cancelSubscription.offerBtnLabel","Redeem Offer")}),(0,i.jsx)(a.ButtonV2,{type:"button",fill:"borderless",onClick:()=>{d("cancellationSurvey")},children:p("globalProfile.subscription.cancelSubscription.offerCancelBtnLabel","Continue Cancelling")})]})]})},eO=e=>{let{onClose:s}=e,{t}=(0,l.Bd)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"cancel-promo-offer-redeemed-header",children:[(0,i.jsx)(a.Text,{type:"h3",children:t("globalProfile.subscription.cancelSubscription.thankYou","Thanks for sticking around")}),(0,i.jsx)(a.Text,{type:"p1-bold",children:t("globalProfile.subscription.cancelSubscription.thankYouDescription","Your subscription has been updated")})]}),(0,i.jsx)("div",{className:"cancel-subscription-modal-actions",children:(0,i.jsx)(a.ButtonV2,{type:"button",size:"fullWidth",onClick:s,children:t("globalProfile.subscription.cancelSubscription.close","Close")})})]})};var eV=t(54965);let eM=e=>{var s;let{setCancelModalType:t,setIsLoading:n,surveyDetails:c,subscription:d}=e,[u,p]=(0,r.useState)(null),[h,b]=(0,r.useState)(!1),{t:g}=(0,l.Bd)(),{globalConfig:f}=(0,o.h5)(),{countryCode:x}=f,{register:y,formState:{errors:v},getValues:C,handleSubmit:j,trigger:_}=(0,eN.mN)(),N=async e=>{if(!(null==u?void 0:u.key))return void b(!0);try{n(!0);let s={standing_order_action:"Cancelled",standing_order_id:String(d.standingorderid)},i=await (0,eA.M2)(s);if(null==i?void 0:i.status){let s={CancellationRequest:{StandingOrderId:String(d.standingorderid),Reason:null==u?void 0:u.value,Reasontext:null==u?void 0:u.value,Comments:e.comments,SurveyRegion:x,SKUCode:d.skucode,Brand:"Beanz"}};await (0,eA.S2)(s)?t("cancellationSuccess"):t("error")}else t("error")}catch(e){t("error")}finally{n(!1)}};(0,r.useEffect)(()=>{(null==u?void 0:u.key)&&(b(!1),v.comments&&_("comments"))},[u,v,_]);let P=C(),S=(null==u?void 0:u.key)==="Other"&&g("globalProfile.subscription.cancelSubscription.surveyCommentsRequired","Please enter comments");return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"cancellation-promo-header",children:[(0,i.jsx)(a.Text,{type:"h3",children:g("globalProfile.subscription.cancelSubscription.surveyTitle","Help us understand why you're leaving")}),(0,i.jsx)(a.Text,{type:"p1-bold",children:g("globalProfile.subscription.cancelSubscription.surveyDescription","Please select the reason you are cancelling")})]}),(0,i.jsxs)("div",{className:"cancellation-promo-survey-content",children:[c.map(e=>
1(0,i.jsx)(m.s,{checked:e.key===(null==u?void 0:u.key),name:e.key,id:e.key,onChange:()=>p(e),label:e.value},e.key)),h&&(0,i.jsx)(a.Alert,{type:"error",inline:!0,message:g("globalProfile.subscription.cancelSubscription.surveyError","Please select the reason")})]}),(0,i.jsx)("div",{className:"cancellation-promo-survey-comments",children:(0,i.jsx)(a.TextField,{label:g("globalProfile.subscription.cancelSubscription.surveyComments","Additional comments"),id:"comments",...y("comments",{required:S}),errorText:g(null==v||null==(s=v.comments)?void 0:s.message),placeholder:g("globalProfile.subscription.cancelSubscription.surveyCommentsPlaceholder","Please add any further comments..."),value:P.comments})}),(0,i.jsx)("div",{className:"cancel-subscription-modal-actions",children:(0,i.jsx)(a.ButtonV2,{type:"button",size:"fullWidth",onClick:j(e=>e&&N(e)),children:g("globalProfile.subscription.cancelSubscription.cancelBtnLabel","Cancel my subscription")})})]})},ez=e=>{let{onClose:s}=e,{t}=(0,l.Bd)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"cancel-promo-offer-redeemed-header",children:[(0,i.jsx)(a.Text,{type:"h3",children:t("globalProfile.subscription.cancelSubscription.error","Oops !")}),(0,i.jsx)(a.Text,{type:"p1",children:t("globalProfile.subscription.cancelSubscription.errorDescription","Something went wrong, please try again!")})]}),(0,i.jsx)("div",{className:"cancel-subscription-modal-actions",children:(0,i.jsx)(a.ButtonV2,{type:"button",size:"fullWidth",onClick:s,children:t("globalProfile.subscription.cancelSubscription.close","Close")})})]})},eR=e=>{let{onClose:s}=e,{t}=(0,l.Bd)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"cancel-promo-offer-redeemed-header",children:[(0,i.jsx)(a.Text,{type:"h3",children:t("globalProfile.subscription.cancelSubscription.cancellationSuccess","Subscription cancelled")}),(0,i.jsx)(a.Text,{type:"p1",children:t("globalProfile.subscription.cancelSubscription.cancellationSuccessDescription","Thanks for being part of our coffee journey. We’ll miss you!")})]}),(0,i.jsx)("div",{className:"cancel-subscription-modal-actions",children:(0,i.jsx)(a.ButtonV2,{type:"button",size:"fullWidth",onClick:s,children:t("globalProfile.subscription.cancelSubscription.close","Close")})})]})},eH=e=>{let{isOpen:s,onClose:t,subscription:n}=e,[l,c]=(0,r.useState)(null),[d,u]=(0,r.useState)(!0),[m,h]=(0,r.useState)(null),[b,f]=(0,r.useState)(null),{userActiveLoyalty:x}=(0,eV.I)(),{globalConfig:y}=(0,o.h5)(),{cancellation_promotion_voucher:v="Can_Disc_01",cancellationSurvey:C}=y,j=()=>{t(["offerRedeemed","cancellationSuccess","error"].includes(null!=l?l:""))},_=async()=>{u(!0);let e=await (0,eA.fq)(v);u(!1),e?h(e):(h(null),c("cancellationSurvey"))},N=async()=>{if(b)return void u(!1);let e=(0,eA.wu)(C);e&&e.length>0?(f(e),u(!1)):(g.vF.warn("fetchSurveyDetails: No survey questions available, proceeding with direct cancellation"),u(!0),await P())},P=async()=>{try{let e={standing_order_action:"Cancelled",standing_order_id:String(n.standingorderid)},s=await (0,eA.M2)(e);(null==s?void 0:s.status)?c("cancellationSuccess"):(g.vF.error("Direct cancellation failed"),c("error"))}catch(e){g.vF.error("Direct cancellation error:",e),c("error")}finally{u(!1)}};return((0,r.useEffect)(()=>{s?c((null==x?void 0:x.hasLoyalty)||(null==n?void 0:n.isOnPromotion)||(null==n?void 0:n.isFreeBagDiscount)||(null==n?void 0:n.isGiftSubscription)||null==n||!n.isBeanz||!v?"cancellationSurvey":"promo"):(c(null),u(!0))},[v,s,n,x]),(0,r.useEffect)(()=>{if(!l)return void u(!1);"promo"===l?_():"cancellationSurvey"!==l||b||N()},[l,b]),s&&d)?(0,i.jsx)(a.Loader,{isLoading:d,transparent:!0}):(0,i.jsx)(a.Modal,{isOpen:s,onClose:j,titleType:"h6",className:p()("cancel-subscription-modal",{"cancel-subscription-modal-survey":"cancellationSurvey"===l}),children:(0,i.jsxs)("div",{className:"cancel-subscription-modal-content",children:["promo"===l&&m&&(0,i.jsx)(eF,{promoDetails:m,subscription:n,setCancelModalType:c,setLoading:u}),"offerRedeemed"===l&&(0,i.jsx)(eO,{onClose:j}),"cancellationSurvey"===l&&b&&(0,i.jsx)(eM,{subscription:n,setCancelModalType:c,setIsLoading:u,surveyDetails:b}),"error"===l&&(0,i.jsx)(ez,{onClose:j}),"cancellationSuccess"===l&&(0,i.jsx)(eR,{onClose:j})]})})},eq=async e=>{let{redirectResult:s,paymentID:t,locale:i,currencyCode:r,componentRef:a}=e;g.vF.info("3DS redirect result detected, processing payment completion..."),(0,_.uA)("Subscription_Payment_3ds_additional_details_api_call_started",{paymentID:t});try{(e=>{(null==e?void 0:e.current)&&e.current.setStatus("loading")})(a);let e=await j({adyenState:{data:{details:{redirectResult:s}},isValid:!0},paymentID:t,locale:i,currencyCode:r,isRedirectResult:!0});if(null==e||!e.success||!e.data)return((e,s)=>{let t=(null==e?void 0:e.error)||"3DS payment processing failed";g.vF.error("3DS Payment API Error: ".concat(t)),(0,_.nB)(Error("3DS Payment API Error: ".concat(t)),{},_.Er),(null==s?void 0:s.current)&&s.current.setStatus("error",{message:t})})(e,a),!1;{let s=e.data;
1if((0,_.uA)("Subscription_Payment_3ds_result_code_received",{paymentID:t,resultCode:s.resultCode}),"Authorised"===s.resultCode||"RedirectShopper"===s.resultCode)return(e=>{g.vF.info("3DS payment completed successfully"),(0,_.uA)("Subscription_Payment_3ds_success",{}),(null==e?void 0:e.current)&&e.current.setStatus("success"),f.t.removeItem("paymentID");let s=new URL(window.location.href);s.searchParams.delete("redirectResult"),window.history.replaceState({},"",s.toString()),setTimeout(()=>{window.location.reload()},1e3)})(a),!0;return((e,s)=>{let t="3DS Payment failed: ".concat(e.resultCode," - ").concat(e.message||e.errorCode||"Unknown error");g.vF.error(t),(0,_.nB)(Error(t),{resultCode:e.resultCode,message:e.message},_.Er),(null==s?void 0:s.current)&&s.current.setStatus("error",{message:t})})(s,a),!1}}catch(e){return((e,s)=>{g.vF.error("3DS redirect processing error:",e),(0,_.nB)((0,_.Fz)(e),{},_.Er),(null==s?void 0:s.current)&&s.current.setStatus("error",{message:"Failed to process 3D Secure authentication result"})})(e,a),!1}},eU=async e=>{let{locale:s,currencyCode:t,redirectResult:i}=e;if(i){g.vF.info("Processing 3DS redirect result...");try{let e=f.t.getItem("paymentID");if(e)(0,_.uA)("Subscription_Payment_3ds_resume_started",{paymentID:e}),await eq({redirectResult:i,paymentID:e,locale:s,currencyCode:t});else{g.vF.error("No paymentID found for 3DS redirect processing"),(0,_.nB)(Error("No paymentID found for 3DS redirect processing"),{},_.Er);let e=new URL(window.location.href);e.searchParams.delete("redirectResult"),window.history.replaceState({},"",e.toString()),setTimeout(()=>{window.location.reload()},100)}}catch(s){g.vF.error("Error processing 3DS redirect:",s),(0,_.nB)((0,_.Fz)(s),{},_.Er);let e=new URL(window.location.href);e.searchParams.delete("redirectResult"),window.history.replaceState({},"",e.toString())}}};var eZ=t(94458);let eW=e=>{let{productDetails:s,isLoading:t}=e;if(t)return(0,i.jsx)(a.Skeleton,{height:180,width:180});if(null==s?void 0:s.imageUrl){var r;return(0,i.jsx)(a.AspectRatio,{ratio:"1-1",rounded:!0,className:"chefsteps-product-hero__aspect-ratio",children:(0,i.jsx)(a.Image,{src:s.imageUrl,alt:null!=(r=s.title)?r:""})})}return(0,i.jsx)("div",{className:"chefsteps-product-hero__thumbnail-placeholder"})},eY=e=>{var s,t;let{subscription:r,productDetails:n,isProductLoading:o,hasOtherPlans:c=!1,onExploreOtherPlans:u=()=>{}}=e,{t:p}=(0,l.Bd)(),{nextdeliverydate:m,plandetails:h,frequencyLabel:b,status:g}=r,f=((e,s,t)=>{let i=e.find(e=>e.selected);if(!i)return s;let r=Number(i.interval);return"MONTH"===i.unit&&12===r?t("globalProfile.subscription.chefsteps-annual-pass","Annual pass"):"MONTH"===i.unit&&1===r?t("globalProfile.subscription.chefsteps-monthly-pass","Monthly pass"):s})(h,b,p),x=null!=(s=null==n?void 0:n.features)?s:[],y=ed(r),v="CANCEL_SCHEDULED"===g?p("globalProfile.subscription.chefsteps-subscription-ends-on","Subscription Ends On"):"TRIAL_ACTIVE"===g?p("globalProfile.subscription.chefsteps-first-billing-date","First Billing Date"):"ACTIVE"===g?p("globalProfile.subscription.chefsteps-renews","Renews"):y?eu(p):p("globalProfile.subscription.chefsteps-next-renewal-date","Renewal Date");return(0,i.jsx)("div",{className:"chefsteps-product-hero manage-subscriptions__container",children:(0,i.jsxs)("div",{className:"chefsteps-product-hero__layout",children:[(0,i.jsx)("div",{className:"chefsteps-product-hero__thumbnail",children:(0,i.jsx)(eW,{productDetails:n,isLoading:o})}),(0,i.jsxs)("div",{className:"chefsteps-product-hero__content",children:[o?(0,i.jsx)(a.Skeleton,{height:40,width:"60%"}):(0,i.jsx)(a.Text,{type:"h3",className:"chefsteps-product-hero__title",children:null!=(t=null==n?void 0:n.title)?t:""}),(0,i.jsxs)("div",{className:"chefsteps-product-hero__details",children:[(0,i.jsx)(a.Text,{type:"p3",className:"chefsteps-product-hero__plan-label",children:f}),x.length>0&&(0,i.jsx)("div",{className:"chefsteps-product-hero__features",children:x.map((e,s)=>(0,i.jsx)(a.Text,{type:"p3",tag:"span",className:"chefsteps-product-hero__feature",children:e},"".concat(e,"-").concat(s)))}),"CANCELLED"!==g&&(0,i.jsx)(a.Text,{type:"p3",className:"chefsteps-product-hero__renew-date",children:y?v:(0,i.jsxs)(i.Fragment,{children:[v," ",(0,d.Yq)(m)]})}),c&&"ACTIVE"===g&&(0,i.jsx)(a.ButtonV2,{onClick:u,fill:"borderless",underLineOnHover:!1,className:"chefsteps-product-hero__explore-other-plans",children:(0,i.jsx)(a.Text,{type:"p3",tag:"span",children:p("globalProfile.subscription.explore-other-plans","Explore other plans")})})]})]})]})})},eG={ACTIVE:"Active",PAUSED:"Paused",CANCELLED:"Canceled",CANCEL_SCHEDULED:"Auto-renew off",TRIAL_ACTIVE:"Trial",SCHEDULED:"Upcoming"},eK=e=>{let{label:s,value:t}=e;return(0,i.jsxs)("div",{className:"chefsteps-subscription-detail
1s__row",children:[(0,i.jsx)(a.Text,{type:"p2-bold",tag:"span",className:"chefsteps-subscription-details__label",children:s}),(0,i.jsx)(a.Text,{type:"p2",tag:"span",className:"chefsteps-subscription-details__value",children:t})]})},eQ=e=>{var s,t;let{className:r,subscription:a,productDetails:n}=e,{t:o}=(0,l.Bd)(),{nextdeliverydate:c,plandetails:u,status:p}=a,m=((e,s)=>{let t=e.find(e=>e.selected);if(!t)return"";let i=Number(t.interval);return"MONTH"===t.unit&&12===i?s("globalProfile.subscription.chefsteps-billing-cycle-annual","Annual"):"MONTH"===t.unit&&1===i?s("globalProfile.subscription.chefsteps-billing-cycle-monthly","Monthly"):"".concat(i," ").concat(t.unit.charAt(0)+t.unit.slice(1).toLowerCase())})(u,o),h=null!=(s=null==n?void 0:n.title)?s:"",b=null!=(t=eG[p])?t:p,g="CANCEL_SCHEDULED"===p,f="TRIAL_ACTIVE"===p,x=ed(a),y=g?o("globalProfile.subscription.chefsteps-subscription-ends-on","Subscription Ends On"):f?o("globalProfile.subscription.chefsteps-first-billing-date","First Billing Date"):o("globalProfile.subscription.chefsteps-next-renewal-date","Renewal Date");return(0,i.jsxs)("div",{className:"chefsteps-subscription-details ".concat(null!=r?r:"").trim(),children:[h&&(0,i.jsx)(eK,{label:o("globalProfile.subscription.chefsteps-membership-tier","Subscription"),value:h}),"CANCELLED"!==p&&!x&&(0,i.jsx)(eK,{label:y,value:(0,d.Yq)(c)}),m&&(0,i.jsx)(eK,{label:o("globalProfile.subscription.chefsteps-billing-cycle","Billing Cycle"),value:m}),(0,i.jsx)(eK,{label:o("globalProfile.subscription.chefsteps-status","Status"),value:b})]})},eX=e=>{var s;let{details:t,isRecommended:r,isSelected:n,onSelect:l}=e,{t:o}=(0,e_.B)();return(0,i.jsxs)("button",{type:"button",className:p()("chefsteps-downgrade-modal__plan",{"chefsteps-downgrade-modal__plan--selected":n}),onClick:l,children:[(0,i.jsx)("div",{className:"chefsteps-downgrade-modal__plan-image",children:(0,i.jsx)(a.AspectRatio,{ratio:"1-1",children:(0,i.jsx)(a.Image,{src:t.imageUrl,alt:t.title})})}),(0,i.jsxs)("div",{className:"chefsteps-downgrade-modal__plan-body",children:[r&&(0,i.jsx)(a.Tag,{tagText:o("globalProfile.subscription.recommended","Recommended"),tagBg:"persistent-black",tagTextColor:"persistent-white",tagType:"caps-label",className:"chefsteps-downgrade-modal__plan-badge"}),(0,i.jsx)(a.Text,{tag:"p",type:"p2-bold",className:"chefsteps-downgrade-modal__plan-name",children:t.title}),(0,i.jsx)(a.Text,{tag:"p",type:"p3",className:"chefsteps-downgrade-modal__plan-desc",children:null!=(s=t.features.at(0))?s:""})]}),(0,i.jsxs)("div",{className:"chefsteps-downgrade-modal__plan-price",children:[(0,i.jsxs)(a.Text,{tag:"span",type:"h4",children:["$",t.price]}),(0,i.jsx)(a.Text,{tag:"span",type:"p3",className:"chefsteps-downgrade-modal__plan-price-label",children:o("globalProfile.subscription.per-year","per year")})]})]})},eJ=e=>{let{isSwitching:s,switchError:t,canSwitch:r,onSwitchPlan:n,isCancelIntercept:l,onContinueCancelling:o}=e,{t:c}=(0,e_.B)();return(0,i.jsxs)("div",{className:"chefsteps-downgrade-modal__actions",children:[(0,i.jsx)(a.ButtonV2,{text:c("globalProfile.subscription.switch-plan","Switch Plan"),onClick:n,disabled:s||!r,fill:"outlined",size:"lg"}),t&&(0,i.jsx)(a.Text,{tag:"p",type:"p4",className:"chefsteps-downgrade-modal__error",children:c("globalProfile.subscription.switch-plan-error","We could not switch your plan. Please try again.")}),l&&(0,i.jsx)(a.ButtonV2,{text:c("globalProfile.subscription.continue-cancelling","Continue canceling"),onClick:o,disabled:s,fill:"borderless"}),!l&&!t&&(0,i.jsx)(a.Text,{tag:"p",type:"p4",children:c("globalProfile.subscription.downgrade-effective-next-billing-cycle","Downgrade take affect at your next billing cycle")})]})},e$=e=>{let{subscription:s,cheaperPlans:t,onSwitchSuccess:n,onContinueCancelling:l}=e,{t:o}=(0,e_.B)(),[c,d]=(0,r.useState)(!1),[u,p]=(0,r.useState)(!1),[m,h]=(0,r.useState)(null),b=!!l;(0,r.useEffect)(()=>{var e;let s=null==(e=t.at(0))?void 0:e[0];s&&!m&&h(s)},[t,m]);let g=async()=>{if(!c&&m){d(!0),p(!1);try{(await (0,eA.pp)({standingOrderId:String(s.standingorderid),newPlanSku:m})).success?n():p(!0)}catch(e){p(!0)}finally{d(!1)}}};return(0,i.jsxs)("div",{className:"chefsteps-downgrade-modal__content",children:[c&&(0,i.jsx)(a.Loader,{isLoading:!0,transparent:!0}),(0,i.jsxs)("div",{className:"chefsteps-downgrade-modal__header",children:[(0,i.jsx)(a.Text,{tag:"h2",type:"h3",className:"chefsteps-downgrade-modal__heading",children:b?o("globalProfile.subscription.before-you-go","Before you go..."):o("globalProfile.subscription.time-to-switch","Time to switch?")}),(0,i.jsx)(a.Text,{tag:"p",type:"p2",className:"chefsteps-downgrade-modal__subtitle",children:o("globalProfile.subscription.keep-access-lower-price","Keep access to ChefSteps at a lower price")})]}),(0,i.jsx)("div",{className:"chefsteps-downgrade-modal__plans",children:t.map((e,s)=>{let[t,r]=e;return(0,i.jsx)(eX,{details:r,isRecommended:0===s,isSelected:m===t,onSelect:()=>h(t)},t)}
1)}),(0,i.jsx)(eJ,{isSwitching:c,switchError:u,canSwitch:!!m,onSwitchPlan:g,isCancelIntercept:b,onContinueCancelling:l})]})},e1=e=>{let{isOpen:s,subscription:t,onClose:n,onSuccess:l}=e,{t:o}=(0,e_.B)(),[c,u]=(0,r.useState)("idle");(0,r.useEffect)(()=>{s&&u("idle")},[s]);let p=async()=>{u("loading");try{let e={standing_order_action:"Cancelled",standing_order_id:String(t.standingorderid)},s=await (0,eA.M2)(e);(null==s?void 0:s.status)?(l(),n()):(g.vF.error("ChefstepsPlanChangeModal: cancel failed"),u("error"))}catch(e){g.vF.error("ChefstepsPlanChangeModal: cancel error",e),u("error")}},m=(0,d.Yq)(t.nextdeliverydate);return(0,i.jsxs)(i.Fragment,{children:["loading"===c&&(0,i.jsx)(a.Loader,{isLoading:!0,transparent:!0}),"idle"===c&&(0,i.jsxs)("div",{className:"chefsteps-cancel-modal__content",children:[(0,i.jsx)("h2",{className:"chefsteps-cancel-modal__heading",children:o("globalProfile.subscription.turn-off-auto-renew-confirm","Turn off auto-renew")}),(0,i.jsx)("p",{className:"chefsteps-cancel-modal__body",children:o("globalProfile.subscription.turn-off-auto-renew-body","Your subscription will continue until {{endDate}}. After that, it will not renew automatically.",{endDate:m})}),(0,i.jsxs)("div",{className:"chefsteps-cancel-modal__actions",children:[(0,i.jsx)(a.ButtonV2,{variant:"primary",text:o("globalProfile.subscription.turn-off-auto-renew-confirm","Turn off auto-renew"),onClick:p}),(0,i.jsx)(a.ButtonV2,{fill:"borderless",underLineOnHover:!0,text:o("globalProfile.subscription.keep-my-subscription","Keep my subscription"),onClick:n})]})]}),"error"===c&&(0,i.jsxs)("div",{className:"chefsteps-cancel-modal__content",children:[(0,i.jsx)("h2",{className:"chefsteps-cancel-modal__heading",children:o("globalProfile.somethingWentWrong","Something went wrong")}),(0,i.jsx)("p",{className:"chefsteps-cancel-modal__body",children:o("globalProfile.subscription.turn-off-auto-renew-error","We could not turn off auto-renew. Please try again.")}),(0,i.jsxs)("div",{className:"chefsteps-cancel-modal__actions",children:[(0,i.jsx)(a.ButtonV2,{variant:"primary",text:o("globalProfile.subscription.tryAgain","Try again"),onClick:()=>u("idle")}),(0,i.jsx)(a.ButtonV2,{fill:"borderless",text:o("globalProfile.subscription.close","Close"),onClick:n})]})]})]})},e0=e=>{let{isOpen:s,onClose:t}=e;return"switch-plan"===e.modalType?(0,i.jsx)(a.Modal,{isOpen:s,onClose:t,titleType:"h6",className:"chefsteps-downgrade-modal",children:(0,i.jsx)(e$,{subscription:e.subscription,cheaperPlans:e.cheaperPlans,onSwitchSuccess:e.onSwitchSuccess,onContinueCancelling:e.onContinueCancelling})}):(0,i.jsx)(a.Modal,{isOpen:s,onClose:t,className:"chefsteps-cancel-modal",children:(0,i.jsx)(e1,{isOpen:s,subscription:e.subscription,onClose:t,onSuccess:e.onSuccess})})},e2=[{key:"Too expensive.",value:"Too expensive."},{key:"Content wasn't for me.",value:"Content wasn't for me."},{key:"I wasn't using my subscription as much as I had hoped.",value:"I wasn't using my subscription as much as I had hoped."},{key:"Not enough new content.",value:"Not enough new content."},{key:"I have too many subscriptions.",value:"I have too many subscriptions."},{key:"Other",value:"Other"}],e7=e=>(null==e?void 0:e.trim().toLowerCase())==="other",e3=e=>{var s;let{isOpen:t,subscription:n,onClose:l,onCancelSuccess:c}=e,{t:d}=(0,e_.B)(),{globalConfig:u}=(0,o.h5)(),{countryCode:p="",cancellationSurvey:m}=u,h=null!=(s=(0,eA.wu)(m))?s:e2,[b,f]=(0,r.useState)(null),[x,y]=(0,r.useState)(""),[v,C]=(0,r.useState)("idle"),[j,_]=(0,r.useState)(!1),[N,P]=(0,r.useState)(!1);(0,r.useEffect)(()=>{t&&(f(null),y(""),C("idle"),_(!1),P(!1))},[t]);let S=async e=>{let s={CancellationRequest:{StandingOrderId:String(n.standingorderid),Reason:e,Reasontext:e,Comments:x,SurveyRegion:p,SKUCode:n.skucode,Brand:"ChefSteps"}};try{let e=await (0,eA.S2)(s);null==e&&g.vF.error("ChefstepsFeedbackModal: survey submission returned no response")}catch(e){g.vF.error("ChefstepsFeedbackModal: survey submission error",e)}},w=async()=>{if("loading"!==v){if(!b)return void _(!0);if(e7(b)&&!x.trim())return void P(!0);C("loading");try{let e={standing_order_action:"Cancelled",standing_order_id:String(n.standingorderid)},s=await (0,eA.M2)(e);(null==s?void 0:s.status)?(await S(b),c()):(g.vF.error("ChefstepsFeedbackModal: cancel failed"),C("error"))}catch(e){g.vF.error("ChefstepsFeedbackModal: cancel error",e),C("error")}}};return(0,i.jsxs)(a.Modal,{isOpen:t,onClose:l,className:"chefsteps-feedback-modal",children:["loading"===v&&(0,i.jsx)(a.Loader,{isLoading:!0,transparent:!0}),(0,i.jsxs)("div",{className:"chefsteps-feedback-modal__content",children:[(0,i.jsxs)("div",{className:"chefsteps-feedback-modal__header",children:[(0,i.jsx)(a.Text,{tag:"h2",type:"h3",className:"chefsteps-feedback-modal__heading",children:d("globalProfile.subscription.cancel-survey-title","Before you go")}),(0,i.jsx)(a.Text,{tag:"p",type:"p2-bold",className:"chefsteps-feedback-modal__subtitle",children:d("globalProfile.subscription.cancel-survey-question","Mind telling us why you're canceling your subscription?")})]}),(0,i.jsxs)("div",{className:"chefsteps-feedback-modal__reasons",children:[h.map(e=>{let{key:s,value:t}=e;return(0,i.jsxs)("label",{className:"chefsteps-feedback-modal__reason",children:[(0,i.jsx)("input",{type:"radio",name:"cancel-reason",value:s,checked:b===s,onChange:()=>(e=>{f(e),_(!1),e7(e)||P(!1)})(s),className:"chefsteps-feedback-modal__reason-radio"}),(0,i.jsx)(a.Text,{tag:"span",type:"p2",children:t})]},s)}),j&&(0,i.jsx)(a.Alert,{type:"error",inline:!0,message:d("globalProfile.subscription.select-reason-error","Please select the reason")})]}),(0,i.jsx)(a.TextField,{id:"cancel-comment",label:d("globalProfile.subscription.additional-comments","Additional comments"),value:x,onChange:e=>{y(e.target.value),e.target.value.trim()&&P(!1)},errorText:N?d("globalProfile.subscription.comment-required","Please enter comments"):void 0,placeholder:d("globalProfile.subscription.additional-comments-placeholder","Please add any further comments...")}),"error"===v&&(0,i.jsx)(a.Text,{tag:"p",type:"p3",className:"chefsteps-feedback-modal__error",children:d("globalProfile.subscription.cancel-error","We could not cancel your subscription. Please try again.")}),(0,i.jsx)(a.ButtonV2,{variant:"primary",text:d("globalProfile.subscription.cancel-my-subscription","Cancel Subscription"),onClick:w,disabled:"loading"===v})]})]})},e6=e=>{let{isOpen:s,onClose:t}=e,{t:r}=(0,e_.B)();return(0,i.jsx)(a.Modal,{isOpen:s,onClose:t,className:"chefsteps-cancelled-modal",children:(0,i.jsxs)("div",{className:"chefsteps-cancelled-modal__content",children:[(0,i.jsx)(a.Text,{tag:"h2",type:"h3",className:"chefsteps-cancelled-modal__heading",children:r("globalProfile.subscription.subscription-cancelled","Subscription canceled")}),(0,i.jsx)(a.Text,{tag:"p",type:"p1",className:"chefsteps-cancelled-modal__body",children:r("globalProfile.subscription.cancelled-body","Thanks for being part of our community. We'll miss you!")}),(0,i.jsx)(a.ButtonV2,{variant:"primary",text:r("globalProfile.subscription.got-it","Got it"),onClick:t})]})})},e4=e=>{let{upgradePlans:s,onUpgrade:t,disabledMessage:r}=e,{t:n}=(0,e_.B)(),l=!!r;return(0,i.jsxs)("div",{className:"chefsteps-upgrade-banner",children:[(0,i.jsx)(a.Text,{tag:"h3",type:"h6",className:"chefsteps-upgrade-banner__heading",children:n("globalProfile.subscription.upgrade-membership","Upgrade your membership")}),r&&(0,i.jsx)(a.Alert,{type:"caution",message:r,className:"chefsteps-upgrade-banner__disabled-alert"}),(0,i.jsx)("div",{className:"chefsteps-upgrade-banner__plans",children:s.map((e,s)=>{let[r,o]=e;return(0,i.jsxs)("div",{className:"chefsteps-upgrade-banner__plan",children:[(0,i.jsxs)("div",{className:"chefsteps-upgrade-banner__plan-header",children:[(0,i.jsxs)("div",{className:"chefsteps-upgrade-banner__plan-info",children:[(0,i.jsxs)("div",{className:"chefsteps-upgrade-banner__plan-name-price",children:[(0,i.jsx)(a.Text,{tag:"h6",type:"h6",className:"chefsteps-upgrade-banner__plan-name",children:o.title}),(0,i.jsxs)(a.Text,{tag:"h4",type:"h4",className:"chefsteps-upgrade-banner__plan-price",children:["$",o.price,"/year"]})]}),0===s&&(0,i.jsx)(a.Tag,{tagText:n("globalProfile.subscription.best-value","BEST VALUE"),tagBg:"accent"}),1===s&&(0,i.jsx)(a.Tag,{tagText:n("globalProfile.subscription.most-popular","MOST POPULAR"),tagBg:"persistent-black"})]}),(0,i.jsx)("div",{className:"chefsteps-upgrade-banner__plan-image",children:(0,i.jsx)(a.AspectRatio,{ratio:"1-1",children:(0,i.jsx)(a.Image,{src:o.imageUrl,alt:o.title})})})]}),(0,i.jsx)("ul",{className:"chefsteps-upgrade-banner__plan-features",children:o.features.filter(
1Boolean).map(e=>(0,i.jsx)("li",{className:"chefsteps-upgrade-banner__plan-feature",children:(0,i.jsx)(a.Text,{tag:"span",type:"p2",children:e})},e))}),(0,i.jsx)("div",{className:"chefsteps-upgrade-banner__plan-cta",children:(0,i.jsx)(a.ButtonV2,{variant:"primary",size:"fullWidth",text:n("globalProfile.subscription.upgrade-to","Upgrade to {{planName}}",{planName:o.title}),onClick:()=>(e=>{g.vF.warn("ChefstepsUpgradeBanner: upgrade plan not yet implemented",{skuId:e}),t(e)})(r),disabled:l})})]},r)})})]})},e5="manage-subscriptions__container",e8="CANCEL_SCHEDULED",e9="TRIAL_ACTIVE",se="SCHEDULED",ss=e=>{var s,t;let{subscription:n,subscriptionId:l,isLoading:u,fetchAndProcessSubscriptions:p}=e,{t:m}=(0,e_.B)(),h=(0,ej.useRouter)(),{switchRouteTo:b}=(0,c.b)(),{globalConfig:g}=(0,o.h5)(),{products:f,isLoading:x}=el(),[y,v]=(0,r.useState)(null),[C,j]=(0,r.useState)(null),[_,N]=(0,r.useState)(!1),[P,S]=(0,r.useState)(!1),[w,L]=(0,r.useState)(!1),[k,T]=(0,r.useState)(!1),[A,E]=(0,r.useState)(!1),[B,I]=(0,r.useState)(!1),[F,O]=(0,r.useState)(!1),[V,M]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(!C)return;let e=setTimeout(()=>j(null),5e3);return()=>clearTimeout(e)},[C]),(0,r.useEffect)(()=>{if("upgradeFailed"!==h.query.ref)return;j({type:"error",message:m("globalProfile.subscription.chefsteps-upgrade-error","We could not upgrade your membership. Please try again.")});let{ref:e,...s}=h.query;h.replace({pathname:h.pathname,query:s},void 0,{shallow:!0})},[h.query.ref]),(0,r.useEffect)(()=>{let e=e=>{e.persisted&&O(!1)};return window.addEventListener("pageshow",e),()=>window.removeEventListener("pageshow",e)},[]);let z=async()=>{if(!B){I(!0);try{let s=await (0,eA.ZS)(l);if(s.success){var e;j({type:"success",message:m("globalProfile.subscription.chefsteps-reactivate-success","Your subscription has been reactivated. Your next order is scheduled for {{nextOrderDate}}.",{nextOrderDate:(0,d.Yq)(null!=(e=s.nextOrderDate)?e:n.nextdeliverydate)})}),p(!0)}else j({type:"error",message:m("globalProfile.subscription.chefsteps-reactivate-error","We could not reactivate your subscription. Please try again.")})}catch(e){j({type:"error",message:m("globalProfile.subscription.chefsteps-reactivate-error","We could not reactivate your subscription. Please try again.")})}finally{I(!1)}}},R=null!=(t=f[n.skucode])?t:null,H=null==R?void 0:R.tierRanking,q=Object.entries(f).filter(e=>{let[s,t]=e,i=null==t?void 0:t.tierRanking;return s!==n.skucode&&void 0!==H&&void 0!==i&&i<H&&(null==t?void 0:t.isAvailableForPurchase)!==!1}).sort((e,s)=>{var t,i;let[,r]=e,[,a]=s;return(null!=(t=a.tierRanking)?t:0)-(null!=(i=r.tierRanking)?i:0)}),U=Object.entries(f).filter(e=>{let[s,t]=e,i=null==t?void 0:t.tierRanking;return s!==n.skucode&&void 0!==H&&void 0!==i&&i>H&&(null==t?void 0:t.isAvailableForPurchase)!==!1}).sort((e,s)=>{var t,i;let[,r]=e,[,a]=s;return(null!=(t=r.tierRanking)?t:0)-(null!=(i=a.tierRanking)?i:0)}),Z=async()=>{if(!V){M(!0);try{(await (0,eA.HP)({newStandingOrderId:String(n.standingorderid)})).success?(j({type:"success",message:m("globalProfile.subscription.chefsteps-cancel-scheduled-downgrade-success","Your scheduled downgrade has been canceled.")}),p(!0)):j({type:"error",message:m("globalProfile.subscription.chefsteps-cancel-scheduled-downgrade-error","We could not cancel your scheduled downgrade. Please try again.")})}catch(e){j({type:"error",message:m("globalProfile.subscription.chefsteps-cancel-scheduled-downgrade-error","We could not cancel your scheduled downgrade. Please try again.")})}finally{M(!1)}}},W=u||B||F||V,Y=n.status===e8,G="CANCELLED"===n.status,K=n.status===e9,Q=n.status===se,X=ed(n),J=((e,s)=>{let{isCancelScheduled:t,isScheduled:i,isPaused:r,nextDeliveryDate:a}=e;return t?s("globalProfile.subscription.chefsteps-cancel-scheduled-alert","This subscription is scheduled to cancel. If this was an error please click the reactivate subscription button"):i?s("globalProfile.subscription.chefsteps-subscription-change-alert","Subscription Change: Your upcoming subscription will take affect {{date}}",{date:(0,d.Yq)(a)}):r?s("globalProfile.subscription.chefsteps-paused-alert","This membership is on hold while your other subscription is active."):s("globalProfile.subscription.chefsteps-cancelled-alert","Your subscription has been canceled.")})({isCancelScheduled:Y,isScheduled:Q,isPaused:X,nextDeliveryDate:n.nextdeliverydate},m),$=m("globalProfile.subscription.chefsteps-trial-active-alert","You are currently on a free trial. Your first billing will be on {{date}}.",{date:(0,d.Yq)(n.nextdeliverydate)}),ee=((e,s)=>{let{isTrialActive:t,isCancelScheduled:i}=e;return t?s("globalProfile.subscription.chefsteps-upgrade-trial-disabled","You can't upgrade your membership during your free trial. This will be available once your first billing begins."):i?s("globalProfile.subscription.chefsteps-upgrade-cancel-scheduled-disabled","You can't upgrade your membership while your subscription is scheduled to cancel. Turn on auto-renew to upgrade."):void 0})({isTrialActive:K,isCancelScheduled:Y},m),es=["ACTIVE",e8,e9].includes(n.status),et=["ACTIVE","PAUSED",e8,e9].includes(n.status)&&!["paypal","googlepay"].includes(n.paymentType),ei=!(null==(s=n.billingAddress)?void 0:s.addressline1),er=!1===n.isPaymentInfoAvailable||!n.paymentType||"card"===n.paymentType&&(!n.cardNumber||!n.cardType),ea=n.isGiftSubscription&&(ei||er),en=(0,i.jsxs)("div",{children:[(0,i.jsx)(a.Text,{tag:"p",type:"p3",className:"manage-subscriptions__gift-alert-title",children:(0,i.jsx)("strong",{children:m("globalProfile.subscription.chefsteps-gift-alert-title","This membership is a gift")})}),(0,i.jsx)(a.Text,{tag:"p",type:"p3",children:m("globalProfile.subscription.chefsteps-gift-alert-message","Add a billing address and a payment method to upgrade or renew your membership.")})]});return(0,i.jsxs)(a.Grid,{children:[W&&(0,i.jsx)(a.Loader,{isLoading:!0}),(0,i.jsx)(a.Row,{}),(0,i.jsxs)(a.Row,{className:"manage-subscriptions",children:[(0,i.jsxs)(a.Col,{xl:10,md:12,children:[(0,i.jsx)(a.Spacer,{size:"md"}),(0,i.jsx)(a.ButtonV2,{text:m("globalProfile.subscription.backButtonLabel","All Subscriptions"),onClick:()=>b("subscriptions"),alignIcon:"left",fill:"borderless",underLineOnHover:!0,icon:{iconName:"
1chevron-left",iconSize:"4x",iconPrefix:"fak"},className:""})]}),(0,i.jsx)(ek.z,{alertInfo:C}),(0,i.jsxs)(a.Col,{xl:10,md:12,className:"manage-subscriptions__wrapper",children:[ea&&(0,i.jsx)(a.Row,{noGutters:!0,children:(0,i.jsx)(a.Col,{xs:12,children:(0,i.jsx)(a.Alert,{type:"info",message:en})})}),n.isExpired&&"CANCELLED"!==n.status&&(0,i.jsx)(a.Row,{noGutters:!0,children:(0,i.jsx)(a.Col,{xs:12,children:(0,i.jsx)(D,{subscription:n})})}),(Y||G||Q||X)&&(0,i.jsx)(a.Row,{noGutters:!0,children:(0,i.jsx)(a.Col,{xs:12,children:(0,i.jsx)(a.Alert,{type:"info",message:J})})}),K&&(0,i.jsx)(a.Row,{noGutters:!0,children:(0,i.jsx)(a.Col,{xs:12,children:(0,i.jsx)(a.Alert,{type:"info",message:$})})}),(0,i.jsx)(a.Row,{noGutters:!0,children:(0,i.jsx)(a.Col,{xs:12,children:(0,i.jsx)(eY,{subscription:n,productDetails:R,isProductLoading:x,hasOtherPlans:0===U.length&&q.length>0,onExploreOtherPlans:()=>L(!0)})})}),(0,i.jsxs)(a.Row,{noGutters:!0,className:"manage-subscriptions__section",children:[(0,i.jsx)(a.Col,{sm:12,md:6,className:"manage-subscriptions__left-section",children:(0,i.jsx)(eQ,{className:e5,subscription:n,productDetails:R})}),(0,i.jsxs)(a.Col,{sm:12,md:6,className:"manage-subscriptions__right-section",children:[(0,i.jsx)(sw,{className:e5,title:m("globalProfile.subscription.billingAddress","Billing Address"),address:n.billingAddress,type:"billingAddress",onEdit:e=>{v({type:e,address:n[e]})},enableEdit:es}),(0,i.jsx)(sO,{className:e5,cardType:n.cardType,paymentType:n.paymentType,cardNumber:n.cardNumber,enableEdit:et,subscription:n})]})]}),"CANCELLED"!==n.status&&!Q&&!X&&(x?(0,i.jsx)(a.Row,{noGutters:!0,children:(0,i.jsx)(a.Col,{xs:12,children:(0,i.jsx)(a.Skeleton,{width:"100%",height:200,borderRadius:!0})})}):U.length>0&&(0,i.jsx)(a.Row,{noGutters:!0,children:(0,i.jsx)(a.Col,{xs:12,children:(0,i.jsx)(e4,{upgradePlans:U,onUpgrade:e=>{if(F)return;if(O(!0),!(0,eZ.PC)({newPlanSku:e,oldStandingOrderId:l})){O(!1),j({type:"error",message:m("globalProfile.subscription.chefsteps-upgrade-error","We could not upgrade your membership. Please try again.")});return}let s=g.locale?"/transaction/".concat(g.locale.toLowerCase(),"/express-checkout"):"/transaction/en-us/express-checkout";globalThis.location.assign(s)},disabledMessage:ee})})})),(0,i.jsx)(a.Row,{noGutters:!0,children:(0,i.jsx)(a.Col,{xs:12,children:(0,i.jsx)(sL,{className:e5,title:m("globalProfile.subscription.chefsteps-subscription-summary","Subscription summary"),cost:n.subscriptionunitamount,discount:n.promotionaldiscountamount,tax:n.taxamount,quantity:n.quantity,orderTotal:n.totalamount})})})]}),(0,i.jsxs)(a.Col,{xl:10,md:12,children:[(0,i.jsxs)("div",{className:"manage-subscriptions__cta-section",children:[Y&&(0,i.jsx)(a.ButtonV2,{variant:"primary",size:"sm",text:m("globalProfile.subscription.chefsteps-reactivate-subscription","Reactivate subscription"),onClick:z,disabled:B}),"CANCELLED"!==n.status&&!Y&&!X&&(0,i.jsx)(a.ButtonV2,{variant:"primary",size:"sm",text:m("globalProfile.subscription.cancelSubscription.btnLabel","Cancel subscription"),onClick:()=>{if(n.status===se)return void Z();q.length>0?S(!0):T(!0)},disabled:V})]}),(0,i.jsx)(a.Spacer,{size:"lg"})]})]}),y&&(0,i.jsx)(eD,{alertInfo:C,setAlertInfo:j,isOpen:!0,subscriptionId:l,onClose:e=>{v(null),e&&p(!0)},...y}),_&&(0,i.jsx)(e0,{modalType:"cancel",isOpen:_,subscription:n,onClose:()=>N(!1),onSuccess:()=>{j({type:"success",message:m("globalProfile.subscription.turn-off-auto-renew-success","Auto-renew has been turned off. Your subscription continues until {{endDate}}.",{endDate:(0,d.Yq)(n.nextdeliverydate)})}),p(!0)}}),k&&(0,i.jsx)(e3,{isOpen:k,subscription:n,onClose:()=>T(!1),onCancelSuccess:()=>{T(!1),E(!0)}}),A&&(0,i.jsx)(e6,{isOpen:A,onClose:()=>{E(!1),p(!0)}}),P&&(0,i.jsx)(e0,{modalType:"switch-plan",isOpen:P,subscription:n,cheaperPlans:q,onClose:()=>S(!1),onContinueCancelling:()=>{S(!1),T(!0)},onSwitchSuccess:()=>{S(!1),p(!0)}}),w&&(0,i.jsx)(e0,{modalType:"switch-plan",isOpen:w,subscription:n,cheaperPlans:q,onClose:()=>L(!1),onSwitchSuccess:()=>{L(!1),p(!0)}})]})},st=()=>{var e;let s,{t}=(0,e_.B)(),n=(0,ej.useRouter)(),{switchRouteTo:l}=(0,c.b)(),d=(0,c.CR)(),{subscriptionsData:u,fetchAndProcessSubscriptions:p,isLoading:m,hasExecuted:h,setSubscriptionsLoading:b}=(0,F.Q)(),{isCanister:g,products:f}=(0,B.Q)(),{fetchIdToken:x}=(0,eg.x)(),[y,v]=(0,r.useState)(null),[C,j]=(0,r.useState)(null),[N,P]=(0,r.useState)(!1),[S,w]=(0,r.useState)(!1),[L,k]=(0,r.useState)(!1),[T,A]=(0,r.useState)(!1),{globalConfig:{locale:E,currencyCode:I}}=(0,o.h5)(),O="manage-subscriptions__container",V=n.query[ea.W4]===ea.EZ,M=null==(e=Object.values(u).flat())?void 0:e.find(e=>e.standingorderid.toString()===d),z=new URLSearchParams(window.location.search).get("redirectResult");if((0,r.useEffect)(()=>{z&&d&&(0,_.uA)("Subscription_Payment_3ds_redirect_returned",{subscriptionId:d})},[z,d]),(0,r.useEffect)(()=>{z&&!S&&(async()=>{w(!0),b(!0);try{await eU({locale:E,currencyCode:I,redirectResult:z})}catch(e){b(!1),w(!1)}})()},[z,E,I,b,S]),(0,r.useEffect)(()=>
1{if(!C)return;let e=setTimeout(()=>j(null),5e3);return()=>clearTimeout(e)},[C]),(0,r.useEffect)(()=>{V&&!L&&p(!0).then(e=>{k(!0),(e=>"object"==typeof e&&null!==e&&Object.hasOwn(e,"success")&&"boolean"==typeof e.success)(e)&&!0===e.success&&A(!0);let{[ea.W4]:s,...t}=n.query;n.replace({pathname:n.pathname,query:t},void 0,{shallow:!0})})},[V,L]),(0,r.useEffect)(()=>{if(!T)return;let e=setTimeout(()=>{x()},500);return()=>clearTimeout(e)},[T]),(0,r.useEffect)(()=>{V||p()},[p,V]),m&&!h||z||S||V&&!L)return(0,i.jsx)(a.Loader,{isLoading:!0,transparent:!0});if(!M)return(0,i.jsx)(a.PageNotFound,{errorCode:t("404","404 - Page Not Found"),errorText:t("page-not-found","Uh oh! Looks like this page needs a tune up."),btnLabel:t("error-go-to-homepage","Go to Homepage"),btnLink:"/my-account/dashboard"});if((0,eb.e)(M.storecode))return(0,i.jsx)(ss,{subscription:M,subscriptionId:d,isLoading:m,fetchAndProcessSubscriptions:p});let R=M.iterationPaymentFailedCount>=ee.Q9,H="CANCELLED"!==M.status&&(M.isExpired||R),q=e=>{v({type:e,address:M[e]})},U=(e,s)=>{"cancelSubscription"===s?P(!1):"editAddress"===s&&v(null),e&&p(!0)};M.bagSize?s=M.bagSize:M.maximumBagSize&&M.minimumBagSize&&(s="".concat(M.minimumBagSize," - ").concat(M.maximumBagSize));let Z=g(M.productId),W=f[M.productId],Y=!!(M.maximumBagSize&&M.minimumBagSize),G=M.productId.endsWith("LG")?null==M?void 0:M.minimumBagSize:null==M?void 0:M.maximumBagSize;return(0,i.jsxs)(a.Grid,{children:[m&&(0,i.jsx)(a.Loader,{isLoading:m}),(0,i.jsx)(a.Row,{}),(0,i.jsxs)(a.Row,{className:"manage-subscriptions",children:[(0,i.jsxs)(a.Col,{xl:10,md:12,children:[(0,i.jsx)(a.Spacer,{size:"md"}),(0,i.jsx)(a.ButtonV2,{text:t("globalProfile.subscription.backButtonLabel","All Subscriptions"),onClick:()=>l("subscriptions"),alignIcon:"left",fill:"borderless",underLineOnHover:!0,icon:{iconName:"chevron-left",iconSize:"4x",iconPrefix:"fak"},className:""})]}),(0,i.jsx)(ek.z,{alertInfo:C}),(0,i.jsxs)(a.Col,{xl:10,md:12,className:"manage-subscriptions__wrapper",children:[H?(0,i.jsx)(a.Row,{noGutters:!0,children:(0,i.jsx)(a.Col,{xs:12,children:(0,i.jsx)(D,{subscription:M})})}):null,M.isBeanz&&M.isFreeBagDiscount&&(0,i.jsx)(a.Row,{noGutters:!0,children:(0,i.jsx)(a.Col,{xs:12,children:(0,i.jsx)(a.Alert,{type:"caution",message:t("globalProfile.subscription.changeCoffeeFreeBagInfo","Change coffee will become available once all free bags are used")})})}),(0,i.jsx)(a.Row,{noGutters:!0,children:(0,i.jsx)(a.Col,{xs:12,children:(0,i.jsx)(eC,{className:O,productNameProps:{type:"h3"},subscription:M,enableInfoIcon:Y,commonWeight:G})})}),(0,i.jsxs)(a.Row,{noGutters:!0,className:"manage-subscriptions__section",children:[(0,i.jsx)(a.Col,{sm:12,md:6,className:"manage-subscriptions__left-section",children:(0,i.jsx)(sS,{className:"manage-subscriptions__container",subscription:M,isProductCanister:Z,productName:null==W?void 0:W.productName,enableInfoIcon:Y,commonWeight:G})}),(0,i.jsxs)(a.Col,{sm:12,md:6,className:"manage-subscriptions__right-section",children:[(0,i.jsx)(sw,{className:O,title:t("globalProfile.subscription.shippingAddress","Shipping Address"),address:M.shippingAddress,type:"shippingAddress",onEdit:q,enableEdit:"ACTIVE"===M.status}),(0,i.jsx)(sw,{className:O,title:t("globalProfile.subscription.billingAddress","Billing Address"),address:M.billingAddress,type:"billingAddress",onEdit:q,enableEdit:"ACTIVE"===M.status}),(0,i.jsx)(sO,{className:O,cardType:M.cardType,paymentType:M.paymentType,cardNumber:M.cardNumber,enableEdit:["ACTIVE","PAUSED"].includes(M.status)&&!["paypal","googlepay"].includes(M.paymentType),subscription:M})]})]}),M.isOnPromotion&&(0,i.jsx)(a.Row,{noGutters:!0,children:(0,i.jsx)(a.Col,{xs:12,children:(0,i.jsx)(sV,{subscription:M,className:O})})}),(0,i.jsx)(a.Row,{noGutters:!0,children:(0,i.jsx)(a.Col,{xs:12,children:(0,i.jsx)(sL,{className:O,productId:M.productId,cost:M.subscriptionunitamount,discount:M.promotionaldiscountamount,tax:M.taxamount,quantity:M.quantity,orderTotal:M.totalamount,bagSize:s,enableInfoIcon:Y,commonWeight:G})})})]}),(0,i.jsxs)(a.Col,{xl:10,md:12,children:[(0,i.jsxs)("div",{className:"manage-subscriptions__cta-section",children:[(0,i.jsx)(a.ButtonV2,{variant:"primary",size:"sm",text:t("globalProfile.subscription.history.btnLabel","History"),onClick:()=>l("subscriptions",d,"history")}),"CANCELLED"!==M.status&&(0,i.jsx)(a.ButtonV2,{variant:"primary",size:"sm",text:t("globalProfile.subscription.cancelSubscription.btnLabel","Cancel subscription"),onClick:()=>P(!0)})]}),(0,i.jsx)(a.Spacer,{size:"lg"})]})]}),y&&(0,i.jsx)(eD,{alertInfo:C,setAlertInfo:j,isOpen:!!(null==y?void 0:y.address),subscriptionId:d,onClose:e=>U(e,"editAddress"),...y}),N&&(0,i.jsx)(eH,{isOpen:N,onClose:e=>U(e,"cancelSubscription"),subscription:M})]})},si=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US";if("string"==typeof e.value)return e.value.replaceAll(/"/g,"");let t=e.value;return(t[s]||t["en-US"]||"").replaceAll(/"/g,"")},sr=function(e,s){var t,i,r;let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"en-US",n=null==(r=e.data)||null==(i=r.products)||null==(t=i.results)?void 0:t[0];if(!n)return null;let l=n.masterData.current,o=s.split("_")[0],c=s.split("_").pop()||"",d="",u=0,p=[],m="baristas-choice"===l.slug,h=(e,s)=>
1{e.forEach(e=>{switch(e.name){case"WEB_BAGSIZE":d=si(e,a);break;case"weightInGrams":u=Number.parseFloat(si(e,a));break;case"WEB_GRIND":s&&m||(p=(e=>{try{return JSON.parse(e).map(e=>({value:Object.keys(e)[0],label:Object.values(e)[0]}))}catch(e){return[]}})("string"==typeof e.value?e.value:e.value[a]||""))}})};h(l.masterVariant.attributesRaw,!0);let b=l.variants.find(e=>e.sku===s);b&&h(b.attributesRaw,!1);let g=((e,s)=>{let t=e.split("_")[0];return s.map(e=>{var s;return(null==(s=e.sku.split("_"))?void 0:s[0])===t&&e.sku.includes("PLAN_WEEKLY")?e.sku:""}).filter(Boolean).map(e=>Number(e.split("_").pop())).sort((e,s)=>e-s).map(e=>({value:"".concat(t,"_PLAN_WEEKLY_").concat(e),weekCount:e}))})(s,l.variants),f=((e,s)=>{var t,i;let r=null==e||null==(i=e.toLowerCase())||null==(t=i.split("_"))?void 0:t[0],a=(null==r?void 0:r.startsWith("discovery"))&&(null==r?void 0:r.endsWith("lg")),n=(null==r?void 0:r.startsWith("mbc"))&&(null==r?void 0:r.endsWith("lg")),l=a||n||s>=900?1:2;return Array.from({length:5-l+1},(e,s)=>({value:l+s}))})(s,u);return{grindOptions:p,frequencyOptions:g,quantityOptions:f,bagSize:d,weightInGrams:u,isBaristaChoice:m,parentSkuCode:o,currentFrequency:c}},sa=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US",[t,i]=(0,r.useState)({data:null,isLoading:!0,error:null});return(0,r.useEffect)(()=>{(async()=>{if(!e)return i({data:null,isLoading:!1,error:null});i(e=>({...e,isLoading:!0,error:null}));try{let t=await (0,y.qY)({where:'masterData(current(masterVariant(sku in ("'.concat(e,'"))))  or masterData(current(variants(sku in ("').concat(e,'"))))'),includeNames:["WEB_GRIND","WEB_BAGSIZE","WEB_STATUS","weightInGrams"],locale:s}),r=t.data?sr(t.data,e,s):null;i({data:r,isLoading:!1,error:r?null:"Failed to transform data"})}catch(e){g.vF.error("Error fetching subscription details:",e),i({data:null,isLoading:!1,error:"Failed to load details"})}})()},[e,s]),{details:t.data,isLoading:t.isLoading,error:t.error}},sn=e=>{let{nextOrderDate:s,t,details:n,grindType:l,frequency:o,quantity:c,standingOrderId:u,formId:p}=e,{fetchAndProcessSubscriptions:m,setSubscriptionsLoading:h}=(0,F.Q)(),[b,g]=(0,r.useState)(s),{register:f,handleSubmit:x}=(0,eN.mN)({shouldUnregister:!0,mode:"all",defaultValues:{grindType:l,quantity:c,frequency:o,nextOrderDate:s}}),v=async s=>{var t;let i={standing_order_id:u.toString(),new_plan_id:s.frequency.split("".concat(s.frequency.split("_")[0],"_"))[1],quantity:Number(s.quantity),grind:s.grindType,sku:s.frequency,nextDropDate:b};null==(t=e.onClose)||t.call(e),h(!0),await (0,y.Yd)(i),await m(!0)};if(!n)return(0,i.jsx)(a.Text,{type:"p2",children:t("globalProfile.subscription.somethingWentWrong","Something went wrong. Please try again. If you encounter this error for a second time, please contact support.")});let C=n.frequencyOptions.map(e=>({value:e.value,label:t("globalProfile.subscription.every-frequency-".concat(1===e.weekCount?"week":"weeks"),{frequency:e.weekCount,defaultValue:"Every {{frequency}} weeks"})})),j=n.quantityOptions.map(e=>({value:e.value,label:t("globalProfile.subscription.delivery-".concat(1===e.value?"bag":"bags"),{quantity:e.value,defaultValue:"{{quantity}} bags"})}));return(0,i.jsxs)("form",{id:p,onSubmit:x(v),className:"subscription-details-form",children:[(0,i.jsx)(a.TextField,{type:"date",id:"nextOrder",label:"".concat(t("globalProfile.subscription.editDetails.nextOrderDate","Next Order Date")),required:!0,min:(0,d.tP)(2),max:(0,d.tP)(90),value:b,onChange:e=>g(e.target.value),name:"nextOrderDate"}),(0,i.jsx)(a.Dropdown,{t:t,id:"grindType",label:"".concat(t("globalProfile.subscription.editDetails.grindType","GrindType")),options:n.grindOptions,...f("grindType")}),(0,i.jsx)(a.Dropdown,{t:t,id:"bagsCount",label:"".concat(t("globalProfile.subscription.editDetails.bagsCount","Bags Each Delivery")),options:j,...f("quantity")}),(0,i.jsx)(a.Dropdown,{t:t,id:"frequency",label:"".concat(t("globalProfile.subscription.editDetails.frequency","Frequency")),options:C,...f("frequency")})]})},sl=e=>{var s,t,r;let{t:n,formId:l,subscription:c,nextDropDates:u}
1=e,{plandetails:p,skucode:m,quantity:h,standingorderid:b,isBeanz:g}=c,{fetchAndProcessSubscriptions:f,setSubscriptionsLoading:x}=(0,F.Q)(),{globalConfig:{locale:v}}=(0,o.h5)(),C=null==m?void 0:m.split("_")[0],j=(null==(s=p.find(e=>e.selected))?void 0:s.planid)||m.split("_").slice(-3).join("_"),{register:_,handleSubmit:N}=(0,eN.mN)({shouldUnregister:!0,mode:"all",defaultValues:{quantity:h,frequency:j,nextDropDate:null}}),P=async s=>{var t;let[i,r]=s.nextDropDate?s.nextDropDate.split("+"):[],a={standing_order_id:b.toString(),new_plan_id:s.frequency,quantity:Number(s.quantity),sku:"".concat(C,"_").concat((null==s?void 0:s.frequency)||"")||"",subscriptionamount:(0,d.ZV)((null==c?void 0:c.subscriptionunitamount)*Number.parseInt(null==s?void 0:s.quantity),v,2)};null==(t=e.onClose)||t.call(e),x(!0),g&&await (0,y.Yd)(a),r&&i&&await (0,y.ys)({standing_order_id:b.toString(),iteration_number:r,pausedate:i}),await f(!0)},S=Array.from({length:Number(4)},(e,s)=>({label:"".concat(s+1),value:"".concat(s+1)})),w=p.map(e=>{var s;return{label:(null==(s=e.displayvalues.find(e=>e.locale.toLowerCase()===v.toLowerCase()))?void 0:s.displayname)||"".concat(e.interval," ").concat(e.unit.toLowerCase()),value:e.planid}}),L=u&&null!=(r=null==(t=u.NextOrders)?void 0:t.map(e=>({label:e.date,value:"".concat(e.date,"+").concat(e.iteration)})))?r:[];return L.length>0&&L.unshift({label:n("globalProfile.subscription.editDetails.pauseSubscriptionPlaceholder","Select a date to pause subscription"),value:""}),(0,i.jsxs)("form",{id:l,onSubmit:N(P),className:"subscription-details-form",children:[(null==L?void 0:L.length)>0?(0,i.jsx)(a.Dropdown,{t:n,id:"pause-subscription-list",label:"".concat(n("globalProfile.subscription.editDetails.pauseSubscription","Pause Subscription")),options:L,..._("nextDropDate")}):null,(0,i.jsx)(a.Dropdown,{t:n,id:"quantity",label:"".concat(n("globalProfile.subscription.editDetails.quantity","Quantity")),options:S,disabled:!g,..._("quantity")}),(0,i.jsx)(a.Dropdown,{t:n,id:"frequency",label:"".concat(n("globalProfile.subscription.editDetails.frequency","Frequency")),options:w,disabled:!g,..._("frequency")})]})};var so=t(63481);let sc="edit-subscription-details",sd=e=>{var s;let{isOpen:t,onClose:n,title:d}=e,{subscriptionsData:u}=(0,F.Q)(),{globalConfig:{locale:p}}=(0,o.h5)(),m=(0,c.CR)(),{t:h}=(0,l.Bd)(),b=null==(s=Object.values(u).flat())?void 0:s.find(e=>e.standingorderid.toString()===m),{details:f,isLoading:x}=sa(null==b?void 0:b.skucode,p),{details:v,isLoading:C}=(e=>{let[s,t]=(0,r.useState)({data:null,isLoading:!0,error:null});return(0,r.useEffect)(()=>{(async()=>{let s=(0,so.getStoreBrand)(e),{standingorderid:i}=e;if(!i||"breville"!==s)return t({data:null,isLoading:!1,error:null});t(e=>({...e,isLoading:!0,error:null}));try{let e=await (0,y.Ku)({standing_order_id:i.toString()});t({data:e.data||null,isLoading:!1,error:null})}catch(e){g.vF.error("Error fetching subscription next drop dates details:",e),t({data:null,isLoading:!1,error:"Failed to load next drop dates"})}})()},[e]),{details:s.data,isLoading:s.isLoading,error:s.error}})(b),j=(0,i.jsxs)("div",{className:"remove-address-modal-content-actions",children:[(0,i.jsx)(a.ButtonV2,{fill:"outlined",variant:"primary",size:"lg",onClick:n,children:h("globalProfile.subscription.editDetails.cancelBtnLabel","Cancel")}),(0,i.jsx)(a.ButtonV2,{fill:"filled",variant:"primary",size:"lg",type:"submit",form:sc,children:h("globalProfile.subscription.editDetails.saveBtnLabel","Save")})]});return(0,i.jsx)(a.Modal,{isOpen:t,onClose:n,titleType:"h6",title:d,footer:j,className:"edit-subscription-modal",children:(()=>{if(x||C)return(0,i.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[100,90,80,70].map(e=>(0,i.jsx)(a.Skeleton,{width:"".concat(e,"%"),height:20},e))});if(b.isBeanz){var e;return(0,i.jsx)(sn,{standingOrderId:b.standingorderid,nextOrderDate:b.nextdeliverydate,grindType:null!=(e=b.grindValue)?e:"",frequency:b.skucode,quantity:b.quantity,details:f,onClose:n,formId:sc,t:h},b.standingorderid)}return["breville","sage"].includes((0,so.getStoreBrand)(b))?(0,i.jsx)(sl,{subscription:b,nextDropDates:v,onClose:n,formId:sc,t:h},b.standingorderid):(0,i.jsx)(i.Fragment,{})})()})};var su=t(23904),sp=t.n(su);let sm=e=>(0,d.Yq)(e,{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}),sh=e=>{let{isOpen:s,onClose:t,subscription:r}=e,{setSubscriptionsLoading:n,fetchAndProcessSubscriptions:o}=(0,F.Q)(),{trackSubscriptionAction:c}=(0,O.O)("subscriptions"),{t:d}=(0,l.Bd)(),u=r.nextdeliverydate,p=((e,s)=>{let t=new Date(e);return t.setUTCDate(t.getUTCDate()+s),t.toISOString().split("T")[0]}
1)(u,z(r.plandetails)),m=async()=>{n(!0);try{null==t||t();let e=await (0,y.Yd)(((e,s)=>{var t,i;let r=null!=(t=e.plandetails.find(e=>e.selected))?t:e.plandetails.at(0);return{standing_order_id:e.standingorderid.toString(),new_plan_id:null!=(i=null==r?void 0:r.planid)?i:"",quantity:e.quantity,sku:e.skucode,grind:e.isBeanz?e.grindValue:void 0,nextDropDate:s}})(r,p));if(!e.success||(0,I.HF)(e.data))throw Error(e.error||"Failed to skip next order.");c("skip",r.standingorderid.toString(),{skippedDate:u,newNextOrderDate:p}),await o(!0)}catch(e){g.vF.error("Failed to skip next order.",e)}finally{n(!1)}},h=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.ButtonV2,{fill:"outlined",variant:"primary",size:"lg",onClick:t,children:d("globalProfile.subscription.skipNextOrder.cancel","Cancel")}),(0,i.jsx)(a.ButtonV2,{fill:"filled",variant:"primary",size:"lg",onClick:m,children:d("globalProfile.subscription.skipNextOrder.save","Save")})]});return(0,i.jsxs)(a.Modal,{isOpen:s,onClose:t,title:d("globalProfile.subscription.skipNextOrder.title","Skip next order"),titleType:"h5",className:sp().container,footer:h,children:[(0,i.jsxs)("div",{className:sp().row,children:[(0,i.jsx)(a.Text,{type:"p2-bold",className:sp().label,children:d("globalProfile.subscription.skipNextOrder.skippingLabel","Skipping")}),(0,i.jsx)(a.Text,{type:"h6",children:sm(u)})]}),(0,i.jsxs)("div",{className:sp().row,children:[(0,i.jsx)(a.Text,{type:"p2-bold",className:sp().label,children:d("globalProfile.subscription.skipNextOrder.nextOrderLabel","Next order processed on")}),(0,i.jsx)(a.Text,{type:"h6",children:sm(p)})]})]})},sb={modal:"order-help-modal",container:"order-help-modal-container",section:"order-help-modal-container__section",sectionTitle:"order-help-modal-container__section-title",sectionDescription:"order-help-modal-container__section-description"},sg=e=>{let{t:s}=(0,l.Bd)(),{isOpen:t,onClose:n}=e,o=s("globalProfile.subscription.orderHelp.title",""),c=(0,r.useMemo)(()=>[{title:s("globalProfile.subscription.orderHelp.frequency",""),description:s("globalProfile.subscription.orderHelp.frequencyDescription","")},{title:s("globalProfile.subscription.orderHelp.quantity",""),description:s("globalProfile.subscription.orderHelp.quantityDescription","")},{title:s("globalProfile.subscription.orderHelp.grind",""),description:s("globalProfile.subscription.orderHelp.grindDescription","")},{title:s("globalProfile.subscription.orderHelp.price",""),description:s("globalProfile.subscription.orderHelp.priceDescription","")}].filter(e=>!!(e.title&&e.description)),[s]);return 0===c.length?null:(0,i.jsx)(a.Modal,{isOpen:t,onClose:n,title:o,titleType:"h5",className:sb.modal,"aria-describedby":"order-help-description",children:(0,i.jsx)("div",{className:sb.container,id:"order-help-description",children:c.map((e,s)=>(0,i.jsxs)(r.Fragment,{children:[(0,i.jsxs)("div",{className:sb.section,role:"article","aria-labelledby":"help-title-".concat(s),children:[(0,i.jsx)("div",{className:sb.sectionTitle,children:(0,i.jsx)(a.Text,{type:"h6",id:"help-title-".concat(s),children:e.title})}),(0,i.jsx)("div",{className:sb.sectionDescription,children:(0,i.jsx)(a.Text,{type:"p3",children:e.description})})]}),s+1===c.length?null:(0,i.jsx)(a.Divider,{})]},"help-item-".concat(s)))})})},sf=e=>{var s,t,n;let{t:l}=(0,e_.B)(),{standingorderid:o,productName:c}=e,[d,u]=(0,r.useState)({isLoading:!1,link:null});(0,r.useEffect)(()=>{let e=!1,s=null;return(async()=>{u({link:"",isLoading:!0});try{var t;let i={url:String(o)},r=await (0,y.vt)(i),a=null==r||null==(t=r.data)?void 0:t.data;if(!a||0===a.length)throw Error("No data in return label response");let n=new Blob([new Uint8Array(a)],{type:"application/pdf"});s=URL.createObjectURL(n),e||u({link:s,isLoading:!1})}catch(s){g.vF.error(s),e||u(e=>({...e,isLoading:!1}))}})(),()=>{e=!0,s&&(URL.revokeObjectURL(s),s=null)}},[o]);let p=((t=new Date,false),null==(s=t.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"})))?void 0:s.replaceAll(/[\s,]+/g,""),m=null==c?void 0:c.replace(" ","-"),h="".concat(m,"_").concat(l("eh-return-label-file-name"),"_").concat(p);return d.isLoading?(0,i.jsx)(a.Skeleton,{width:"100%",height:30}):d.isLoading||d.link?(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"outlined",size:"sm",href:null!=(n=d.link)?n:"#",className:"btn-fullWidth",download:h,children:l("eh-print-return-label","Print Return Label")}):(0,i.jsx)(a.Alert,{type:"info",message:"Not Yet Generated"})};var sx=t(21116),sy=t.n(sx);let sv="btn-fullWidth",sC=e=>{let{status:s}=e,{t}=(0,l.Bd)();return(0,i.jsx)(a.Text,{tag:"span",type:"p2-bold",className:"subscription-detail
1s__label",children:"CANCELLED"===s?t("globalProfile.subscription.cancelled","Cancelled"):t("globalProfile.subscription.nextOrder","Next Order Processing Date")})},sj=e=>{let{status:s,isProductCanister:t,canisterLabel:r,nextdeliverydate:n}=e;return"CANCELLED"===s?null:(0,i.jsx)(a.Text,{tag:"span",type:"p2",className:"subscription-details__value",children:t?r:(0,d.Yq)(n)})},s_=e=>{let{bagSize:s,minimumBagSize:t,maximumBagSize:n,enableInfoIcon:o,commonWeight:c}=e,{t:d}=(0,l.Bd)(),u=(0,r.useMemo)(()=>{if(!c)return null;let e=d("globalProfile.subscription.summary.bagSizeInfo",{size:c});return(0,i.jsx)(a.Tooltip,{id:"bagSizeInfo",place:"right",tooltipContent:e,triggerClassName:"order-summary__tooltip",children:(0,i.jsx)(a.Icon,{iconName:"circle-info",iconPrefix:"fak",iconSize:"3x"})})},[c,d]);return s||t&&n?(0,i.jsxs)("div",{className:"subscription-details__option-group",children:[(0,i.jsx)(a.Text,{tag:"span",type:"p2-bold",className:"subscription-details__label",children:d("globalProfile.subscription.bagSize","Bag Size")}),(0,i.jsxs)(a.Text,{tag:"span",type:"p3",className:"subscription-details__value",children:[s||"".concat(t," - ").concat(n)," ",o&&u]})]}):null},sN=e=>{let{subscription:s,disableEditCTA:t,showChangeCoffee:r,disableChangeCoffee:n,canShowSkipAndPause:o,onOpenModal:c}=e,{t:d}=(0,l.Bd)(),u=d("globalProfile.subscription.alertMessage","Updates to existing subscriptions must be made 24 hours prior to the next order date.");return(0,i.jsxs)("div",{className:"subscription-details__actions ".concat(sy().compactActions),children:[(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"outlined",size:"sm",className:sv,onClick:()=>c("editDetails"),disabled:t,children:d("globalProfile.subscription.edit","Edit")}),r&&(0,i.jsx)(sF,{standingOrderId:s.standingorderid,skuCode:s.skucode,promotionName:s.isOnPromotion?s.promotionName:void 0,disableChangeCoffee:n,className:sy().changeCoffeeFullWidth}),o&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"outlined",size:"sm",className:sv,onClick:()=>c("skipNextOrder"),disabled:t,children:d("globalProfile.subscription.skipNextOrder.title","Skip next order")}),(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"outlined",size:"sm",className:sv,onClick:()=>c("pauseSubscription"),disabled:t,children:d("globalProfile.subscription.pause","Pause")})]}),r&&(0,i.jsx)("div",{className:sy().alertWrapper,children:(0,i.jsx)(a.Alert,{message:u,type:"info",inline:!0})})]})},sP=e=>{let{subscription:s,currentOpenedModal:t,canRenderEditDetailsModal:r,canRenderResumeSubscription:a,canRenderOrderHelp:n,canShowSkipAndPause:l,onCloseModal:o,editTitle:c}=e;return(0,i.jsxs)(i.Fragment,{children:[r&&(0,i.jsx)(sd,{isOpen:"editDetails"===t,onClose:o,title:c}),a&&(0,i.jsx)($,{subscription:s,isOpen:"resumeSubscription"===t,onClose:o}),n&&(0,i.jsx)(sg,{isOpen:"orderHelp"===t,onClose:o}),l&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(sh,{subscription:s,isOpen:"skipNextOrder"===t,onClose:o}),(0,i.jsx)(Y,{subscription:s,isOpen:"pauseSubscription"===t,onClose:o})]})]})},sS=e=>{var s,t,n;let{className:c,subscription:d,isProductCanister:u,productName:p,enableInfoIcon:m,commonWeight:h}=e,{t:b}=(0,l.Bd)(),{globalConfig:{collectionConfig:g}}=(0,o.h5)(),f=null==g||null==(s=g[d.productId])?void 0:s.name,[x,y]=(0,r.useState)(null),v=d.isBeanz&&"CANCELLED"!==d.status,C=v&&("ACTIVE"!==d.status||!d.isEditable||d.isFreeBagDiscount),j="CANCELLED"!==d.status&&d.isEditable&&!u,_=d.plandetail
1s.length>0&&!u&&"ACTIVE"===d.status,N=d.iterationPaymentFailedCount>=ee.Q9,P="PAUSED"===d.status&&!d.isExpired&&!N,S=d.isBeanz,w=!d.isEditable,L=_&&d.isBeanz,k=b((t=d.isBeanz,n=d.quantity,"globalProfile.subscription.".concat(t?"beanz":"breville","Delivery").concat(1===n?"Container":"Containers")),{quantity:d.quantity});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(sP,{subscription:d,currentOpenedModal:x,canRenderEditDetailsModal:j,canRenderResumeSubscription:P,canRenderOrderHelp:S,canShowSkipAndPause:L,onCloseModal:()=>y(null),editTitle:b("globalProfile.subscription.editTitle")}),(0,i.jsxs)("div",{className:"subscription-details ".concat(c||""),children:[(0,i.jsxs)("div",{className:"subscription-details__content",children:[(0,i.jsxs)("div",{className:"subscription-details__option-group",children:[(0,i.jsxs)("div",{className:"subscription-details__row",children:[(0,i.jsx)(sC,{status:d.status}),S?(0,i.jsx)("div",{className:"subscription-details__info-icon",children:(0,i.jsx)("button",{type:"button",onClick:()=>y("orderHelp"),className:"subscription-details__info-icon-btn",children:(0,i.jsx)(a.Icon,{iconName:"
1circle-question",iconSize:"4x",iconPrefix:"fak"})})}):null]}),(0,i.jsx)(sj,{status:d.status,nextdeliverydate:d.nextdeliverydate,isProductCanister:u,canisterLabel:b("globalProfile.subscription.whenExchanged","When exchanged")})]}),(0,i.jsxs)(i.Fragment,{children:[!!f&&(0,i.jsxs)("div",{className:"subscription-details__option-group",children:[(0,i.jsx)(a.Text,{tag:"span",type:"p2-bold",className:"subscription-details__label",children:b("bc-collection","Collection")}),(0,i.jsx)(a.Text,{tag:"span",type:"p2",className:"subscription-details__value",children:f})]}),d.isBeanz&&!!d.grind&&(0,i.jsxs)("div",{className:"subscription-details__option-group",children:[(0,i.jsx)(a.Text,{tag:"span",type:"p2-bold",className:"subscription-details__label",children:b("globalProfile.subscription.grind","Grind")}),(0,i.jsx)(a.Text,{tag:"span",type:"p2",className:"subscription-details__value",children:d.grind})]}),!!d.quantity&&(0,i.jsxs)("div",{className:"subscription-details__option-group",children:[(0,i.jsx)(a.Text,{tag:"span",type:"p2-bold",className:"subscription-details__label",children:b("globalProfile.subscription.quantity","Quantity")}),(0,i.jsx)(a.Text,{tag:"span",type:"p2",className:"subscription-details__value",children:k})]}),!!d.frequencyLabel&&(0,i.jsxs)("div",{className:"subscription-details__option-group",children:[(0,i.jsx)(a.Text,{tag:"span",type:"p2-bold",className:"subscription-details__label",children:b("globalProfile.subscription.frequency","Frequency")}),(0,i.jsx)(a.Text,{tag:"span",type:"p3",className:"subscription-details__value",children:d.frequencyLabel})]}),(0,i.jsx)(s_,{bagSize:d.bagSize,minimumBagSize:d.minimumBagSize,maximumBagSize:d.maximumBagSize,enableInfoIcon:m,commonWeight:h})]})]}),_&&(0,i.jsx)(sN,{subscription:d,disableEditCTA:w,showChangeCoffee:v,disableChangeCoffee:C,canShowSkipAndPause:L,onOpenModal:y}),P?(0,i.jsx)("div",{className:"subscription-details__actions",children:(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"outlined",size:"sm",onClick:()=>y("resumeSubscription"),className:sv,children:b("globalProfile.subscription.resume","Resume Subscription")})}):null,u?(0,i.jsx)("div",{className:"subscription-details__actions",children:(0,i.jsx)(sf,{productName:p,standingorderid:d.standingorderid})}):null]})]})},sw=e=>{let{title:s="Shipping Addresses",address:t,className:r,type:n="shippingAddress",onEdit:o,enableEdit:c=!1}=e,{t:d}=(0,l.Bd)();return(0,i.jsxs)("div",{className:"manage-address ".concat(r||""),children:[(0,i.jsxs)("div",{className:"manage-address__header",children:[(0,i.jsx)(a.Text,{tag:"h3",type:"h6",className:"manage-address__title",children:s}),c&&!!(null==t?void 0:t.addressline1)&&(0,i.jsx)("div",{className:"manage-address__edit-action",children:(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"borderless",size:"sm",onClick:()=>null==o?void 0:o(n),className:"manage-address__edit-button",children:d("globalProfile.subscription.editAddress.editBtnLabel","Edit")})})]}),(0,i.jsx)("div",{className:"manage-address__content",children:(null==t?void 0:t.addressline1)?(0,i.jsxs)("div",{className:"manage-address__address",children:[(0,i.jsx)(a.Text,{tag:"p",type:"p2",className:"manage-address__address-line",children:t.name}),(0,i.jsx)(a.Text,{tag:"p",type:"p2",className:"manage-address__address-line",children:t.addressline1}),t.addressline2&&(0,i.jsx)(a.Text,{tag:"p",type:"p2",className:"manage-address__address-line",children:t.addressline2}),(0,i.jsxs)(a.Text,{tag:"p",type:"p2",className:"manage-address__address-line",children:[t.city," ",t.state," ",t.postalcode]}),(0,i.jsx)(a.Text,{tag:"p",type:"p2",className:"manage-address__address-line",children:t.country})]}):(0,i.jsxs)("div",{className:"manage-address__no-address",children:[(0,i.jsx)(a.Text,{tag:"p",type:"p3",className:"manage-address__no-address-text",children:d("globalProfile.subscription.editAddress.noAddress","No address on file")}),c&&(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"outlined",size:"sm",onClick:()=>null==o?void 0:o(n),className:"manage-address__add-button",children:d("globalProfile.subscription.editAddress.addAddress","Add address")})]})})]})},sL=e=>{let{t:s}=(0,l.Bd)(),{className:t,orderTotal:r,quantity:c,shipping:d,tax:u,cost:p,discount:m,bagSize:h,enableInfoIcon:b,commonWeight:g,title:f}=e,{globalConfig:x}=(0,o.h5)(),{locale:y,currencyCode:v}=x,C=(0,n.s)({locale:y,currencyCode:v,fractionDigits:2}),j=[{label:s("globalProfile.subscription.summary.cost","Cost"),value:p,quantity:c},{label:s("globalProfile.subscription.summary.discount","Discount"),value:m,disabled:!m,isDiscount:!0},{label:s("globalProfile.subscription.summary.shipping","Shipping"),value:d},{label:s("globalProfile.subscription.summary.tax","Tax"),value:u},{label:s("globalProfile.subscription.summary.orderTotal","Order Total"),value:r,isTotal:!0}],_=s("globalProfile.subscription.summary.bagSizeInfo",{size:g});return(0,i.jsxs)("div",{className:"order-summary ".concat(t||""),children:[(0,i.jsx)("div",{className:"order-summary__header",children:(0,i.jsx)(a.Text,{tag:"h3",type:"p2-bold",className:"order-summary__title",children:null!=f?f:s("globalProfile.subscription.orderSummary","Order summary")}
1)}),(0,i.jsxs)("div",{className:"order-summary__content",children:[h&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(a.Text,{tag:"span",type:"p2",className:"order-summary__label",children:[c," x ",h," ",s("globalProfile.subscription.Bags","Bags")," ",b?(0,i.jsx)(()=>(0,i.jsx)(a.Tooltip,{id:"bagSizeInfo",place:"right",tooltipContent:_,triggerClassName:"order-summary__tooltip",children:(0,i.jsx)(a.Icon,{iconName:"circle-info",iconPrefix:"fak",iconSize:"4x"})}),{}):null," | ",C(null!=p?p:0)," ",s("globalProfile.subscription.perBag","per bag")]}),(0,i.jsx)(a.Divider,{})]}),j.filter(e=>!e.disabled).map((e,s)=>{var t;return(0,i.jsxs)(i.Fragment,{children:[e.isTotal?(0,i.jsx)(a.Divider,{}):null,(0,i.jsxs)("div",{className:"order-summary__row",children:[(0,i.jsx)(a.Text,{tag:"span",type:e.isTotal?"p2-bold":"p2",className:"order-summary__label",children:e.label}),(0,i.jsxs)(a.Text,{tag:"span",type:e.isTotal?"p2-bold":"p2",className:"order-summary__value",children:[e.isDiscount?"-":"",e.quantity?"".concat(e.quantity," x "):""," ",C(null!=(t=e.value)?t:0)]})]},"".concat(e.label," - ").concat(s))]})})]})]})};var sk=t(13299),sT=t(30204);let sA=()=>(0,i.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 16 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"brand-arrow",children:(0,i.jsx)("path",{d:"M15.1821 5.60849C15.5958 6.02215 15.5958 6.69568 15.1821 7.10934L9.88408 12.4074C9.58179 12.7097 9.1257 12.7998 8.72795 12.6354C8.3302 12.471 8.07563 12.0839 8.07563 11.6543V8.4776H2.24726C1.3722 8.4776 0.65625 7.76695 0.65625 6.8866V5.82593C0.65625 4.95087 1.3669 4.23492 2.24726 4.23492H8.07563V1.05821C8.07563 0.628643 8.3355 0.241498 8.73325 0.0770944C9.131 -0.0873095 9.58179 0.00284761 9.88938 0.305139L15.1874 5.60319L15.1821 5.60849Z",fill:"#010101"})});function sE(e){var s,t,i,r;let{subscriptionId:a,skuCode:n,locale:l,brand:o,myAccountUrl:c,myAuthUrl:d,pagePath:u,brandDomains:p}=e,m=null!=(i=null==l?void 0:l.toLowerCase())?i:"en-us",h="".concat(null!=(r=null==p?void 0:p.beanz)?r:"https://www.beanz.com","/").concat(m),b=new URL("".concat(h,"/").concat(u));if(b.searchParams.set("subscription-id",a.toString()),b.searchParams.set("sku",n),b.searchParams.set("callback-url",(null==(t=window)||null==(s=t.location)?void 0:s.href)||c),"beanz"===o.toLowerCase())return b.toString();let g=new URL(d);return g.searchParams.set("action","session_transfer"),g.searchParams.set("forwarding_url",b.toString()),g.toString()}var sD=t(76583),sB=t(29364);let sI=e=>{var s,t;let{standingOrderId:r,skuCode:n,promotionName:c,isOpen:d,onClose:u}=e,{t:p}=(0,l.Bd)(),{globalConfig:{locale:m,beanzBaseUrl:h,myAccountUrl:b,myAuthUrl:g,brand:f,brandDomains:x}}=(0,o.h5)(),y={subscriptionId:r,skuCode:n,locale:m,brand:f,myAccountUrl:b,brandDomains:x,beanzBaseUrl:h,myAuthUrl:g},v=c&&p("globalProfile.subscription.changeCoffee.discountAlert",{message:c,defaultValue:"Your 20% Off For 12 Months Friends and Family Discount will apply to your newly selected coffee"});return(0,i.jsx)(a.Modal,{isOpen:d,onClose:u,className:"change-coffee-modal",children:(0,i.jsxs)("div",{className:"change-coffee-modal__content",children:[(0,i.jsx)("div",{className:"change-coffee-modal__header",children:(0,i.jsx)(a.Text,{type:"h5",children:p("globalProfile.subscription.changeCoffee.title","Let's find your next favorite coffee")})}),(0,i.jsxs)("div",{className:"change-coffee-modal__body",children:["beanz"!==f.toLowerCase()&&(0,i.jsxs)("div",{className:"change-coffee-modal__description",children:[(0,i.jsx)(a.Text,{type:"p2",children:p("globalProfile.subscription.changeCoffee.description","You will be redirected to beanz.com to change your coffee subscription")}),(0,i.jsxs)("div",{className:"change-coffee-modal__logo",children:["breville"===f.toLowerCase()&&(0,i.jsx)(sk.default,{color:"#282726"}),"baratza"===f.toLowerCase()&&(0,i.jsx)(sD.default,{color:"#282726"}),"sage"===f.toLowerCase()&&(0,i.jsx)(sB.default,{color:"#282726",className:"sage-logo"}),(0,i.jsx)(sA,{}),(0,i.jsx)(sT.default,{color:"black"})]})]}),(0,i.jsxs)("div",{className:"change-coffee-modal__options",children:[(0,i.jsx)("div",{className:"change-coffee-modal__card",children:(0,i.jsxs)("div",{className:"change-coffee-modal__card-content",children:[(0,i.jsx)("div",{className:"change-coffee-modal__card-content-icon",children:(0,i.jsx)(a.Icon,{iconName:"search",iconSize:"4x",iconPrefix:"fak"})}),(0,i.jsx)(a.Text,{type:"p2-bold",children:p("globalProfile.subscription.changeCoffee.chooseYourOwn","Choose your own")}),(0,i.jsx)(a.Text,{type:"p3",children:p("globalProfile.subscription.changeCoffee.exploreByRoast","Explore by roast, origin, flavor or brew method")}),(0,i.jsx)("div",{className:"change-coffee-modal__card-content-cta",children:(0,i.jsx)(a.ButtonV2,{fill:"outlined",size:"sm",onClick:u,href:sE({...y,pagePath:"change-coffee"}),text:p("globalProfile.subscription.changeCoffee.browseCoffees","Browse Coffees"),icon:{iconName:"arrow-up-right-from-square",iconSize:"4x",iconPrefix:"fak"},openInNewTab:(null==(s=y.brand)?void 0:s.toLowerCase())!=="beanz"})})]})}),(0,i.jsx)("div",{className:"change-coffee-modal__card",children:(0,i.jsxs)("div",{className:"change-coffee-modal__card-content",children:[(0,i.jsx)("div",{className:"change-coffee-modal__card-content-icon",children:(0,i.jsx)(a.Icon,{iconName:"search",iconSize:"4x",iconPrefix:"fak"})}),(0,i.jsx)(a.Text,{type:"p2-bold",children:p("globalProfile.subscription.changeCoffee.letUsChoose","Let us choose for you")}),(0,i.jsx)(a.Text,{type:"p3",children:p("globalProfile.subscription.changeCoffee.baristasPicks","Barista's picks based on your preferences")}),(0,i.jsx)("div",{className:"change-coffee-modal__card-content-cta",children:(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"outlined",size:"sm",onClick:u,href:sE({...y,pagePath:"change-coffee/baristas-choice"}),icon:{iconName:"arrow-up-right-from-square",iconSize:"4x",iconPrefix:"fak"},text:p("globalProfile.subscription.changeCoffee.getBaristasChoice","Get Barista's Choice"),openInNewTab:(null==(t=y.brand)?void 0:t.toLowerCase())!=="beanz"})})]})})]}),c&&(0,i.jsx)(a.Alert,{className:"change-coffee-modal__promotion-alert",message:v,type:"info"}),(0,i.jsx)(a.ButtonV2,{fill:"borderless",onClick:u,children:(0,i.jsx)(a.Text,{tag:"span",type:"p3",children:p("globalProfile.subscription.changeCoffee.cancel","Cancel – Keep my current coffee")})})]})]})})},sF=e=>{let{standingOrderId:s,skuCode:t,disableChangeCoffee:n,promotionName:o,onChangeCoffee:c,className:d}=e,{t:u}=(0,l.Bd)(),[p,m]=(0,r.useState)(!1);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"change-coffee ".concat(d||""),children:(0,i.jsx)("div",{className:"change-coffee__button-section",children:(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"outlined",size:"sm",onClick:()=>{m(!0),null==c||c()},className:"btn-fullWidth",disabled:n,children:u("globalProfile.subscription.changeCoffee.btnLabel","Change Coffee")})})}),(0,i.jsx)(sI,{standingOrderId:s,skuCode:t,promotionName:o,isOpen:p,onClose:()=>{m(!1)}})]})},sO=e=>{var s;let{className:t,cardType:n,paymentType:o,cardNumber:c,enableEdit:d=!1,subscription:u}=e,{t:p}=(0,l.Bd)(),m="card"===o,b=!1===u.isPaymentInfoAvailable||!o||m&&(!c||!n),g=b||(null==(s=u.cardNumber)?void 0:s.slice(-4))==="XXXX"||!u.isPaymentCaptured,[f,x]=(0,r.useState)(!1),[y,v]=(0,r.useState)(g?"new":"existing"),C=async()=>{x(!0)};return(0,i.jsxs)("div",{className:"payment-method ".concat(t||""),children:[d?(0,i.jsx)(E,{subscription:u,isOpen:f,onClose:()=>{x(!1),v(g?"new":"existing")},paymentMethod:y,setPaymentMethod:v,hideExistingCard:b}):null,(0,i.jsxs)("div",{className:"payment-method__header",children:[(0,i.jsx)(a.Text,{tag:"h3",type:"h6",className:"payment-method__title",children:p("globalProfile.subscription.paymentMethod.title","Payment Method")}),d&&!b&&(0,i.jsx)("div",{className:"payment-method__edit-action",children:(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"borderless",size:"sm",onClick:()=>C(),className:"payment-method__edit-button",children:p("globalProfile.subscription.paymentMethod.editBtnLabel","Edit")})})]}),(0,i.jsx)("div",{className:"payment-method__content",children:b?(0,i.jsxs)("div",{className:"payment-method__no-payment",children:[(0,i.jsx)(a.Text,{type:"p3",className:"payment-method__no-payment-text",children:p("globalProfile.subscription.paymentMethod.noPaymentOnFile","No payment method on file")}),d&&(0,i.jsx)(a.ButtonV2,{variant:"primary",fill:"outlined",size:"sm",onClick:()=>C(),className:"payment-method__add-button",children:p("globalProfile.subscription.paymentMethod.addPaymentMethod","Add payment method")})]}):(0,i.jsxs)(i.Fragment,{children:["card"===o&&(0,i.jsx)(h,{cardType:n,cardNumber:c}),["paypal","googlepay"].includes(o)&&(0,i.jsx)(h,{cardType:o})]})})]})},sV=e=>{let{t:s}=(0,e_.B)(),{globalConfig:t}=(0,o.h5)(),{subscription:l,className:c}=e,u=(0,r.useMemo)(()=>(0,n.s)({locale:t.locale,currencyCode:t.currencyCode||"USD"}),[t.locale,t.currencyCode]),p=(0,r.useMemo)(()=>
1{if(!l.milestoneConfig)return null;try{var e;let s=l.milestoneConfig;if("string"==typeof s&&(s=JSON.parse(s)),!Array.isArray(s))return null;let t=s.map(e=>({cashbackValue:e.amount||e.cashbackValue||0,cashbackType:e.cashbackType||"amount",milestone:e.minimumBags||e.milestone||0})),i=(null==(e=s[s.length-1])?void 0:e.milestone)||0,r=(null==l?void 0:l.currentMilestoneLevel)||0,a=(null==l?void 0:l.promobagsConsumed)||0,n=s[r]||{},o=(null==n?void 0:n.milestone)||0,c=Math.max(0,o-a),d=(null==n?void 0:n.cashbackValue)||(null==n?void 0:n.amount)||0;return{promoName:l.discountDescription||l.promotionName||"Opia Cashback",totalBags:i,consumedBags:a,nextMilestoneAmount:d,nextMilestoneBags:c,isActive:!0,milestoneConfig:t,currentMilestone:r,nextMilestoneObject:n}}catch(e){return null}},[l.milestoneConfig,l.promobagsConsumed,l.currentMilestoneLevel,l.promotionName,l.discountDescription]),{promotionExpiryDate:m,discountDescription:h,totalFreeBags:b,consumedFreeBags:g}=l;if(p)return(0,i.jsxs)("div",{className:"promotion ".concat(c||""),children:[(0,i.jsx)("div",{className:"promotion__header",children:(0,i.jsx)(a.Text,{tag:"span",type:"p1-bold",children:p.promoName})}),(0,i.jsx)("div",{className:"promotion__content",children:(0,i.jsx)(a.RewardsProgressBar,{promoName:p.promoName,totalBags:p.totalBags,consumedBags:p.consumedBags,nextMilestoneAmount:p.nextMilestoneAmount,nextMilestoneBags:p.nextMilestoneBags,milestones:p.milestoneConfig,showPromoName:!1,bagsShippedText:s("globalProfile.rewards.bagsShipped"," bags shipped",{consumedBags:p.consumedBags}),bagsUntilRewardText:s("globalProfile.rewards.bagsUntilReward","{{bags}} more bags until {{amount}} cashback",{bags:p.nextMilestoneBags,amount:u(p.nextMilestoneAmount)}),cashbackProgressText:s("globalProfile.rewards.cashbackProgress","Your cashback progress updates when coffee is shipped."),className:"rewards-progress-managesubscriptions"})})]});if(!h)return null;let f=h;return m&&(f="".concat(h,". ").concat(s("globalProfile.subscription.expires","Expires")," ").concat((0,d.Yq)(m,{month:"long",day:"numeric",year:"numeric"}))),(0,i.jsxs)("div",{className:"promotion ".concat(c||""),children:[(0,i.jsxs)("div",{className:"promotion__header",children:[(0,i.jsx)(a.Icon,{iconName:"tag",iconSize:"4x",iconPrefix:"fak"}),(0,i.jsx)(a.Text,{tag:"span",type:"p1-bold",children:s("globalProfile.subscription.promotion","Promotion")})]}),(0,i.jsxs)("div",{className:"promotion__content",children:[(0,i.jsx)(a.Text,{tag:"span",type:"p2",children:f}),b&&g&&(0,i.jsxs)(a.Text,{tag:"span",type:"p2",children:[" - "," ",s("globalProfile.subscription.promotionProgress","- {consumedFreeBags} of {totalFreeBags} bags claimed",{consumedFreeBags:g,totalFreeBags:b})]})]})]})};var sM=t(30948),sz=t(89391);let sR=()=>{let{t:e}=(0,l.Bd)(),{fetchOrders:s,isLoading:t,orders:n}=(0,sM.useOrders)(),{switchRouteTo:o}=(0,c.b)(),d=(0,c.CR)(),{subscriptionsData:u,fetchAndProcessSubscriptions:p,isLoading:m}=(0,F.Q)();if((0,r.useEffect)(()=>{s(),p()},[s,p]),t)return(0,i.jsx)(ec.k,{count:4});let h=n.filter(e=>e.items.map(e=>e.epStandingOrderId).includes(d)),b=Object.values(u).flat().find(e=>e.standingorderid.toString()===d);return(0,i.jsxs)(a.Grid,{children:[(0,i.jsx)(a.Spacer,{size:"lg"}),(0,i.jsx)(a.Row,{negativeGutters:!0,alignItems:"center",children:(0,i.jsxs)(a.Col,{className:"subscriptions-history-details",xs:12,children:[(0,i.jsx)(a.ButtonV2,{text:e("globalProfile.subscription.history.backButtonLabel",{defaultValue:"{{ label }} Subscription",label:null==b?void 0:b.productName}),onClick:()=>o("subscriptions",d),alignIcon:"left",fill:"borderless",underLineOnHover:!0,icon:{iconName:"chevron-left",iconSize:"4x",iconPrefix:"fak"}}),(0,i.jsxs)("div",{className:"subscriptions-history-details__header",children:[m&&(0,i.jsx)(a.Skeleton,{width:"100%",height:30}),!m&&(0,i.jsxs)(a.Text,{type:"h2",tag:"h1",children:[null==b?void 0:b.productName," ",e("globalProfile.subscription.history.title","Order History")]})]}),(0,i.jsx)("div",{className:"subscriptions-history-details__list",children:(0,i.jsx)(a.Grid,{fluid:!0,children:(0,i.jsx)(a.Row,{negativeGutters:!0,className:"order-items",children:h.map((e,s)=>(0,i.jsx)(a.Col,{lg:3,md:4,xs:6,className:"order-overview-col",children:(0,r.createElement)(sz.A,{...e,key:(0,ev.A)()})},"".concat(e.orderNumber,"-").concat(s)))})})})]})}),(0,i.jsx)(a.Spacer,{size:"lg"})]})}},21116:e=>
1{e.exports={compactActions:"SubscriptionDetails_compactActions__8Zcb8",alertWrapper:"SubscriptionDetails_alertWrapper__KVzHd",changeCoffeeFullWidth:"SubscriptionDetails_changeCoffeeFullWidth__ghJGL"}},23904:e=>{e.exports={container:"SkipNextOrder_container__CMtYU",row:"SkipNextOrder_row__VCA0F",label:"SkipNextOrder_label__aTnpn"}},28834:e=>{e.exports={container:"ResumeSubscription_container__mXVWB",description:"ResumeSubscription_description__VS3A8",helper:"ResumeSubscription_helper__C8HAr"}},29364:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>r});var i=t(37876);t(14232);let r=e=>{let{color:s="#421540",className:t}=e;return(0,i.jsx)("svg",{width:"78",height:"34",viewBox:"0 0 78 34",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false","data-testid":"breville-sage-logo sage-svg",className:t,children:(0,i.jsx)("path",{d:"M62.5351 11.8439C60.3061 13.8039 62.0837 16.2897 62.0837 16.2897L67.2705 11.8298C67.2705 11.8298 65.0157 9.66324 62.5351 11.8462V11.8439ZM48.2348 18.1346C48.6848 17.7807 49.0486 17.3295 49.2987 16.815C49.5488 16.3005 49.6787 15.736 49.6787 15.1641C49.6787 14.5922 49.5488 14.0278 49.2987 13.5132C49.0486 12.9987 48.6848 12.5475 48.2348 12.1936C47.6608 11.6768 46.9152 11.3908 46.1422 11.3908C45.3692 11.3908 44.6237 11.6768 44.0496 12.1936C43.5992 12.5473 43.2351 12.9984 42.9848 13.5129C42.7344 14.0275 42.6043 14.5921 42.6043 15.1641C42.6043 15.7362 42.7344 16.3008 42.9848 16.8153C43.2351 17.3299 43.5992 17.781 44.0496 18.1346C44.6237 18.6514 45.3692 18.9374 46.1422 18.9374C46.9152 18.9374 47.6608 18.6514 48.2348 18.1346V18.1346ZM29.6835 17.9468C30.1326 17.6034 30.4964 17.1614 30.7469 16.6551C30.9973 16.1487 31.1275 15.5915 31.1275 15.0268C31.1275 14.4621 30.9973 13.9049 30.7469 13.3986C30.4964 12.8922 30.1326 12.4502 29.6835 12.1068C29.1049 11.5984 28.3605 11.318 27.5898 11.318C26.819 11.318 26.0746 11.5984 25.496 12.1068C25.0469 12.4502 24.6831 12.8922 24.4326 13.3986C24.1822 13.9049 24.052 14.4621 24.052 15.0268C24.052 15.5915 24.1822 16.1487 24.4326 16.6551C24.6831 17.1614 25.0469 17.6034 25.496 17.9468C26.0746 18.4552 26.819 18.7356 27.5898 18.7356C28.3605 18.7356 29.1049 18.4552 29.6835 17.9468ZM64.6935 18.9069C66.1466 20.0195 68.566 19.4116 71.1783 16.6699L74.0844 20.097C71.7073 23.0076 68.9516 24.3644 65.098 24.3644C60.8281 24.3644 57.1954 21.8128 55.8152 18.2356V24.8573C55.8152 29.8359 52.3237 33.8545 47.0028 34H46.9769C40.5416 34 37.3556 30.1997 37.3556 25.2211H43.6076C43.6076 27.3618 44.407 28.6529 46.4761 28.6529C48.5452 28.6529 49.4105 27.3525 49.4105 25.2235V24.0944C48.7062 24.3433 47.9729 24.5011 47.2285 24.5639C46.8737 24.6125 46.5166 24.6423 46.1587 24.6531H46.1187C45.1883 24.6274 44.2658 24.4742 43.3772 24.1977C41.7323 23.768 40.2536 22.8574 39.1308 21.5828C38.3398 20.764 37.7027 19.8099 37.2498 18.7661V23.4278H31.6304C30.3655 24.0103 28.9951 24.3298 27.6027 24.3667H27.5768C23.8148 24.2634 20.556 22.1438 18.9783 19.1487C18.4964 20.4672 17.5694 21.5769 16.3567 22.287C13.2013 24.5193 8.47062 24.0498 8.47062 24.0498C5.30114 24.0052 3.11214 22.7611 1.75782 21.0664C0.347074 19.4914 -0.0761503 17.4938 0.0108457 15.6817L0.0343582 15.4892H6.86942V15.7779C6.88823 16.8788 7.23151 17.9468 7.87105 18.4421C8.81155 19.1651 10.2223 19.0266 10.8877 18.5032C12.0069 17.5807 12.0422 15.5174 8.67048 14.9564C5.17418 14.1912 -0.231333 13.0175 0.217755 6.67982C0.711516 -0.291644 9.64389 0.00176868 9.64389 0.00176868C16.7823 0.100355 18.6915 4.40529 18.5222 8.38631H12.0257C12.1315 5.94512 11.0523 4.9663 9.49341 4.94517C7.56539 4.91701 6.1711 8.21496 10.3116 8.93558C13.3494 9.59986 16.7305 10.0951 18.28 12.7077C19.3616 8.80882 23.1095 5.84419 27.5839 5.72213H27.6097C29.2151 5.76176 30.7884 6.17916 32.2017 6.94037H37.2592V11.5833C38.0276 9.86604 39.2676 8.40122 40.8356 7.3585C42.4035 6.31578 44.2353 5.73784 46.1187 5.69161H46.1446C47.7043 5.73434 49.2332 6.13599 50.6119 6.86526L54.9382 6.90282H55.7941V11.703C57.0967 8.16097 60.4966 5.60007 65.1168 5.60007C69.4242 5.60007 72.5091 7.63752 74.1056 10.7641L64.6935 18.9069ZM75.9372 5.58833C75.6678 5.58414 75.4033 5.66011 75.1773 5.80657C74.9513 5.95303 74.7741 6.16334 74.6683 6.4107C74.5625 6.65806 74.5329 6.93126 74.5832 7.1955C74.6335 7.45973 74.7615 7.70302 74.9509 7.89437C75.1402 8.08572 75.3823 8.21646 75.6464 8.26992C75.9104 8.32338 76.1844 8.29715 76.4335 8.19457C76.6825 8.09199 76.8953 7.9177 77.0448 7.69391C77.1943 7.47013 77.2736 7.20699 77.2727 6.93803C77.2739 6.76182 77.2404 6.58709 77.1739 6.42386C77.10
174 6.26062 77.0093 6.11206 76.8853 5.9867C76.7613 5.86134 76.6137 5.76163 76.451 5.69327C76.2883 5.62491 76.1137 5.58925 75.9372 5.58833V5.58833ZM75.9372 5.79724C76.1665 5.7855 76.394 5.84269 76.5904 5.96142C76.7867 6.08015 76.9429 6.25496 77.0387 6.46324C77.1345 6.67153 77.1655 6.90371 77.1277 7.12978C77.0899 7.35584 76.9851 7.56539 76.8267 7.73133C76.6684 7.89727 76.4638 8.01198 76.2394 8.06061C76.0151 8.10924 75.7813 8.08957 75.5683 8.00414C75.3552 7.91871 75.1728 7.77145 75.0445 7.58139C74.9162 7.39133 74.8479 7.16722 74.8486 6.93803C74.8445 6.79163 74.8695 6.64588 74.9221 6.50917C74.9747 6.37245 75.0539 6.24748 75.1551 6.14144C75.2562 6.03541 75.3774 5.95041 75.5117 5.89133C75.6459 5.83226 75.7905 5.80028 75.9372 5.79724ZM75.6785 7.07652H75.8455C75.8847 7.07057 75.9247 7.07287 75.963 7.08327C76.0013 7.09368 76.0369 7.11195 76.0677 7.13693C76.0985 7.16191 76.1237 7.19303 76.1417 7.22831C76.1597 7.26358 76.1701 7.30223 76.1723 7.34176C76.1821 7.47443 76.2164 7.60414 76.2734 7.72437H76.5273C76.4747 7.607 76.4421 7.48163 76.4309 7.3535C76.4004 7.11877 76.311 7.01079 76.177 6.98732C76.2606 6.96906 76.3353 6.92275 76.3888 6.85611C76.4423 6.78947 76.4713 6.70653 76.4709 6.62114C76.4758 6.5619 76.466 6.50237 76.4422 6.44788C76.4184 6.39339 76.3814 6.34566 76.3345 6.30895C76.1934 6.22329 76.0292 6.18313 75.8643 6.19393C75.7216 6.19465 75.5793 6.20721 75.4387 6.23149V7.73611H75.6738L75.6785 7.07652ZM75.6785 6.37233C75.736 6.36261 75.7942 6.3579 75.8525 6.35824C76.1229 6.35824 76.2193 6.49204 76.2193 6.62349C76.2193 6.80893 76.0524 6.88169 75.8525 6.88169H75.6785V6.37233Z",fill:s})})}},30204:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>r});var i=t(37876);let r=e=>{let{color:s="white"}=e;return(0,i.jsxs)("svg",{role:"img","aria-label":"Home",width:"154",height:"28",viewBox:"0 0 154 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("title",{children:"Home"}),(0,i.jsxs)("g",{clipPath:"url(#clip0_4144_111772)",children:[(0,i.jsx)("path",{d:"M3.06097 0.22145C2.82602 0.252904 2.60807 0.361183 2.44108 0.52942C2.27408 0.697656 2.16742 0.916401 2.13771 1.15158L2.09996 1.49479C2.09228 1.56687 2.10571 1.63963 2.13862 1.70422C2.17152 1.7688 2.22247 1.82244 2.28529 1.85861C3.01291 2.27391 3.10559 3.05302 3.01979 3.94197L1.09775 24.1062C1.09775 24.1439 1.09775 24.1989 1.09775 24.2641L0.998214 25.2937C0.891815 25.7914 0.775126 26.265 0.243134 26.3234C0.123006 26.3234 0.0303286 26.5396 0.020032 26.6666C0.0193697 26.7354 0.045185 26.8017 0.092116 26.8519C0.744235 27.734 1.7739 28.012 3.06441 28.012C4.78051 28.012 5.65916 27.8301 6.15339 27.2844C7.01831 27.7031 8.50446 27.8919 10.0146 27.8919C13.7489 27.8919 16.4191 25.7674 17.9087 23.3854L17.9671 23.2756C18.5521 22.2871 19.0034 21.2252 19.309 20.1179C20.3387 14.8495 17.9808 9.94487 11.9607 9.94487C10.7311 9.99165 9.51948 10.2542 8.3809 10.7206C8.3809 10.7206 8.94032 5.22904 9.12565 3.3173L9.25951 1.92726C9.40709 0.369035 8.18869 0.0120854 6.51377 0.0120854C5.36611 0.00959234 4.21954 0.0829725 3.08157 0.231746L3.06097 0.22145ZM12.2524 21.2506C11.8502 20.2198 11.216 19.2956 10.399 18.5494C9.61253 17.8235 9.10298 16.8468 8.95753 15.7865C8.85793 15.1653 8.71035 14.3313 8.97807 13.7272C9.03124 13.6055 9.12625 13.5069 9.24579 13.4492C9.63204 13.4447 10.0174 13.4897 10.3922 13.583C10.7705 13.6833 11.1374 13.8225 11.487 13.9983C12.6471 14.6024 15.0016 17.4477 14.9193 20.6328C14.9266 21.4353 14.7205 22.2254 14.3221 22.922C14.0601 23.3374 13.7197 23.6976 13.3198 23.9826C13.1585 24.0307 13.0315 24.0101 12.9766 23.8831C12.575 23.0799 12.575 22.088 12.2318 21.2437L12.2524 21.2506ZM5.86166 17.3035C5.86166 16.0611 6.07101 15.4433 6.26322 15.0589C6.47137 14.6097 6.79612 14.2245 7.20365 13.9434C7.43904 13.7871 7.69888 13.671 7.97246 13.6002C8.04819 13.5925 8.12407 13.6132 8.18525 13.6586C8.20056 13.6722 8.21334 13.6885 8.22302 13.7066C8.40492 14.0223 8.24704 15.0177 8.24704 15.0177C8.19212 15.3437 8.29852 15.7282 8.50445 16.4935C8.86167 17.9224 9.60222 19.2266 10.6462 20.2655C11.8886 21.3673 12.1494 22.6681 12.0705 24.1851C12.0718 24.2659 12.0499 24.3455 12.0073 24.4143C11.9647 24.4831 11.9
1033 24.5381 11.8302 24.5729C10.8418 24.7205 9.81899 24.4013 8.7584 23.5879C7.87901 22.9363 7.15174 22.1013 6.62703 21.1408C5.88568 19.7302 5.87538 18.5151 5.86166 17.307",fill:s}),(0,i.jsx)("path",{d:"M52.9722 26.2376C51.9426 26.1277 51.9769 25.1805 52.0868 24.0238L52.8418 16.2877L52.9345 15.3163L53.3121 11.3246C53.3498 10.9059 53.2297 10.6691 52.8006 10.5833C52.7286 10.5833 52.4952 10.5318 52.4197 10.525C51.3436 10.3919 50.2566 10.3711 49.1762 10.4632C48.7718 10.4791 48.3738 10.5699 48.0024 10.7309C47.2136 10.2987 46.3276 10.0755 45.4283 10.0822C40.3246 10.1989 36.2642 14.8049 36.3294 20.0699C35.2877 21.5618 33.7798 22.6652 32.0426 23.207C31.4898 23.3998 30.8996 23.4615 30.3189 23.387C29.7381 23.3125 29.1825 23.104 28.6962 22.7779C28.4496 22.6454 28.2468 22.4438 28.1127 22.1978C28.3102 22.0727 28.5141 21.9581 28.7237 21.8546C30.0794 21.1167 31.4694 20.4577 32.7908 19.6581C33.916 18.988 34.8195 18.0022 35.3891 16.823C36.3294 14.8804 35.8112 13.0064 33.975 11.6198C32.6297 10.5833 30.9669 10.0449 29.2694 10.0959C24.0525 10.2126 19.8857 14.901 20.1432 20.3136C20.3183 23.9346 22.9198 27.377 26.8154 27.734C30.2888 28.0498 33.1409 26.8691 35.5538 24.645C35.9897 24.24 36.3981 23.8076 36.8202 23.3854C36.9816 23.2515 36.9232 23.2207 36.9816 23.2515L37.0194 23.3614C38.049 25.7399 40.1941 27.607 43.0085 27.8644C44.3393 27.9817 45.6791 27.7866 46.9213 27.2947C47.1066 27.813 47.745 27.9812 49.4233 27.9812C50.7309 27.9716 52.0028 27.554 53.0615 26.7867C53.0913 26.7651 53.1162 26.7374 53.1346 26.7054C53.1529 26.6735 53.1642 26.638 53.1679 26.6014C53.1679 26.4813 53.0924 26.2341 52.9722 26.2238V26.2376ZM28.1334 19.435C27.869 19.6649 26.7193 20.4474 26.3383 18.7485C26.2174 18.2653 26.1744 17.7659 26.2113 17.2692C26.2731 16.6033 26.4173 14.9319 27.6253 13.9605C27.845 13.7855 28.2843 13.432 28.7306 13.5178C29.1767 13.6036 29.417 14.1631 29.5372 14.4582C30.0691 15.8585 29.3861 17.3619 28.9674 18.2817C28.7773 18.7236 28.4925 19.1184 28.1334 19.4384V19.435ZM45.9328 22.3249C44.6972 23.2447 42.7237 22.826 42.3564 21.1819C42.1777 20.538 42.1195 19.8666 42.1848 19.2015C42.2844 18.0552 42.4457 16.2156 43.846 15.0382C44.6114 14.3931 45.9568 14.1871 45.9568 14.1871C45.9568 14.1871 47.1718 14.0326 47.4498 14.5303C47.5021 14.6367 47.52 14.7565 47.5013 14.8735C46.9728 20.4646 46.8938 21.6247 45.9328 22.342",fill:s}),(0,i.jsx)("path",{d:"M58.443 10.4632C59.881 10.4632 60.9347 10.8064 60.8008 12.2342L60.7837 12.4058C61.3566 11.5648 62.1234 10.8741 63.0195 10.392C63.9156 9.90991 64.9146 9.65062 65.932 9.63597C66.6634 9.63069 67.3875 9.78133 68.056 10.0778C68.7247 10.3742 69.3224 10.8097 69.8095 11.3553C70.2967 11.9009 70.662 12.5439 70.881 13.2417C71.1002 13.9396 71.1681 14.676 71.0803 15.4021L70.9979 16.2876L70.2223 24.041C70.1125 25.1976 70.0781 26.1449 71.1078 26.2548C71.2279 26.2548 71.3171 26.5122 71.3034 26.6323C71.2997 26.669 71.2884 26.7044 71.2701 26.7364C71.2517 26.7683 71.2268 26.796 71.197 26.8176C71.0287 26.9471 70.8495 27.0619 70.6616 27.1609C69.7159 27.6863 68.6544 27.9682 67.5726 27.9812C64.3532 27.9812 64.4149 27.2947 64.6689 24.6313L65.4103 16.8128C65.4432 16.5342 65.4168 16.2517 65.333 15.984C65.249 15.7163 65.1096 15.4694 64.9235 15.2594C64.7375 15.0494 64.5092 14.881 64.2536 14.7655C63.9979 14.6499 63.7208 14.5896 63.4403 14.5887C62.8209 14.6002 62.227 14.8374 61.7701 15.2558C61.3132 15.6741 61.0247 16.2448 60.9587 16.8608L59.9909 27.0922C59.9684 27.2971 59.872 27.4868 59.7197 27.6258C59.5675 27.7647 59.3698 27.8435 59.1637 27.8473H55.0519C54.9557 27.8478 54.8605 27.828 54.7724 27.7893C54.6843 27.7506 54.6053 27.6938 54.5405 27.6226C54.4759 27.5514 54.4268 27.4674 54.3966 27.376C54.3665 27.2847 54.3559 27.188 54.3655 27.0922L55.3952 16.3117L55.5805 14.1871C55.6594 13.3668 55.5152 12.646 54.8941 12.2617C54.8371 12.2261 54.7917 12.1747 54.7636 12.1137C54.7356 12.0527 54.726 11.9848 54.7362 11.9184L54.7876 11.5203C54.8094 11.3083 54.9 11.1092 55.0457 10.9536C55.1914 10.798 55.3841 10.6944 55.5942 10.6588C56.542 10.5224 57.4993 10.4627 58.4567 10.4803",fill:s}),(0,i.jsx)("path",{d:"M85.1628 21.9027C85.107 21.9013 85.0521 21.9179 85.0064 21.9501C84.960
17 21.9822 84.9265 22.0281 84.9089 22.0812C84.7441 22.8465 84.0028 23.0594 83.0588 23.1109H78.7172L84.6343 15.7556C85.1906 15.0395 85.5364 14.1826 85.6326 13.281L85.7843 11.7606C85.8039 11.6017 85.7903 11.4406 85.7434 11.2874C85.6974 11.1343 85.619 10.9926 85.5151 10.8713C85.4102 10.7501 85.2816 10.652 85.1373 10.5835C84.9927 10.515 84.8354 10.4775 84.6755 10.4735C82.8117 10.4254 81.8782 10.3945 79.081 10.3945C76.2837 10.3945 75.8547 10.4254 73.9739 10.4735C73.7925 10.4773 73.6187 10.547 73.4848 10.6696C73.3509 10.792 73.2661 10.9589 73.2462 11.1393L73.0369 13.3565C73.0172 13.5193 73.0327 13.6845 73.0823 13.8408C73.1319 13.9971 73.2145 14.1409 73.3244 14.2626C73.4344 14.3843 73.5691 14.481 73.7197 14.5461C73.8702 14.6112 74.0329 14.6433 74.197 14.6402H78.6588L73.8537 20.8902C72.8389 22.1549 72.231 23.6973 72.1101 25.3143L71.9557 26.5293C71.9345 26.6796 71.9436 26.8327 71.9825 26.9795C72.0213 27.1263 72.0891 27.2638 72.1818 27.384C72.2745 27.5043 72.3903 27.6047 72.5225 27.6796C72.6545 27.7544 72.8002 27.8021 72.951 27.8198H81.765C84.2842 27.8198 85.9453 27.7238 86.1959 25.074C86.3083 23.9716 85.9973 22.8677 85.3276 21.9851C85.3046 21.961 85.2765 21.9418 85.2458 21.9288C85.2151 21.9158 85.1824 21.9093 85.1491 21.9096",fill:s}),(0,i.jsx)("path",{d:"M89.8478 10.6107L89.3195 11.8772L89.0272 10.6107H88.4683L88.2927 12.471H88.6668L88.7938 11.1462L89.1201 12.4744H89.3774L89.9645 11.1462L89.8375 12.471H90.2218L90.3965 10.6107H89.8478Z",fill:s}),(0,i.jsx)("path",{d:"M86.5801 10.9951H87.1672L87.0266 12.471H87.4518L87.5889 10.9951H88.1726L88.2075 10.6107H86.615L86.5801 10.9951Z",fill:s}),(0,i.jsx)("path",{d:"M153.8 26.1003C152.77 25.9904 152.804 25.0432 152.911 23.8899L153.669 16.1469L153.752 15.2648C153.841 14.5384 153.772 13.8016 153.553 13.1034C153.335 12.4052 152.97 11.7616 152.482 11.2157C151.995 10.6698 151.398 10.234 150.729 9.93726C150.06 9.64057 149.336 9.48992 148.604 9.49529C147.589 9.51258 146.594 9.77323 145.701 10.2552C144.808 10.7372 144.043 11.4264 143.473 12.2651L143.27 12.5396C142.84 11.6711 142.178 10.9387 141.357 10.4242C140.536 9.90974 139.588 9.63332 138.619 9.62565C137.602 9.64116 136.603 9.90079 135.708 10.3828C134.811 10.8648 134.044 11.5551 133.471 12.3955V12.2239C133.605 10.7858 132.551 10.4529 131.113 10.4529C130.155 10.4355 129.198 10.4951 128.251 10.6313C128.04 10.667 127.848 10.7705 127.702 10.9261C127.557 11.0817 127.466 11.2807 127.444 11.4928L127.393 11.8909C127.383 11.9573 127.392 12.0252 127.42 12.0862C127.448 12.1472 127.493 12.1987 127.551 12.2341C128.179 12.6186 128.323 13.3394 128.236 14.1597L128.052 16.2841L127.022 27.0647C127.012 27.1604 127.023 27.2571 127.053 27.3486C127.084 27.4399 127.132 27.5239 127.197 27.5952C127.262 27.6663 127.341 27.7231 127.429 27.7618C127.516 27.8005 127.612 27.8203 127.708 27.8198H131.865C132.071 27.816 132.269 27.7373 132.421 27.5983C132.573 27.4593 132.669 27.2697 132.692 27.0647L133.646 16.8333C133.712 16.2173 134.001 15.6466 134.458 15.2282C134.914 14.8099 135.508 14.5727 136.128 14.5612C136.408 14.5622 136.685 14.6224 136.94 14.738C137.196 14.8536 137.424 15.0219 137.611 15.2319C137.797 15.4419 137.937 15.6888 138.02 15.9565C138.104 16.2242 138.131 16.5066 138.098 16.7853L138.018 17.6159L137.119 26.9343C137.11 27.0301 137.12 27.1267 137.151 27.2181C137.181 27.3095 137.23 27.3935 137.294 27.4647C137.359 27.5359 137.438 27.5927 137.527 27.6314C137.614 27.6701 137.71 27.6898 137.806 27.6894H141.842C142.048 27.6849 142.246 27.6059 142.397 27.467C142.55 27.3282 142.646 27.139 142.669 26.9343L143.637 16.7029C143.703 16.0869 143.991 15.5162 144.448 15.0979C144.906 14.6795 145.5 14.4423 146.119 14.4308C146.399 14.4311 146.676 14.491 146.932 14.6065C147.188 14.7219 147.417 14.8902 147.603 15.1004C147.788 15.3106 147.927 15.5578 148.011 15.8258C148.094 16.0938 148.119 16.3763 148.086 16.6548L147.344 24.4734C147.093 27.1436 147.032 27.8233 150.251 27.8233C151.333 27.8124 152.395 27.5315 153.34 27.0064C153.528 26.9058 153.709 26.7911 153.879 26.6632C153.938 26.6165 153.976 26.5487 153.985 26.4743C153.985 26.3577 153.906 26.1106 153.789 26.0969",fill:s}),(0,i.jsx)("path",{d:"M120.36 10.2229C119.581 10.1714 118.957 10.1748 118.957 10.1748C113.808 10.2916 109.665 14.8701 109.823 20.2072C108.788 21.6314 107.321 22.6835 105.639 23.207C104.531 23.5502 103.353 23.5502 102.293 22.778C100.622 21.5595 100.114 20.3067 99.87 19.0231C99.7805 18.4464 99.7601 17.8611 99.8078 17.2795C99.87 16.6137 100.014 14.9422 101.222 13.9709C101.442 13.7958 101.881 13.4423 102.327 13.5281C102.774 13.6139 103.013 14.1734 103.133 14.4686C103.398 15.2417 103.398 16.0808 103.133 16.854C103.018 17.2563 103.061 17.6875 103.253 18.0597C103.444 18.432 103.769 18.7175 104.164 18.8583C105.034 19.1697 105.987 19.1584 106.85 18.8264C107.713 18.4945 108.428 17.864 108.865 17.0496C108.907 16.9706 108.948 16.8917 108.986 16.8127C109.926 14.8701 109.412 12.9962 107.572 11.6095C106.226 10.5731 104.563 10.0346 102.866 10.0856C97.6529 10.2023 93.4828 14.8907 93.7435 20.3033C93.9148 23.9243 96.5162 27.3667 100.412 27.7238C103.886 28.0395 106.738 26.8588 109.151 24.6347C109.549 24.2675 110.087 23.7081 110.496 23.2928C111.526 25.6953 113.671 27.6001 116.499 27.8267C116.966 27.8789 117.436 27.8949 117.906 27.8748C123.123 27.7546 127.29 23.0696 127.033 17.6536C126.857 14.0361 124.266 10.4906 120.36 10.2366V10.2229ZM119.993 21.7036C119.67 22.4504 119.189 23.1179 118.583 23.66C118.133 24.0513 116.18 25.3761 115.541 22.493C115.339 21.6743 115.266 20.8289 115.325 19.9876C115.432 18.8652 115.668 16.0337 117.728 14.3896C118.095 14.0944 118.84 13.4973 119.595 13.6379C120.415 13.7958 120.772 14.7294 120.967 15.2305C121.87 17.6022 120.71 20.1489 120.003 21.7036",fill:s}),(0,i.jsx)("path",{d:"M91.1764 22.1155C90.9565 22.1155 90.7818 22.1155 90.7818 22.1155C90.4231 22.1344 90.0729 22.2238 89.7491 22.3788C89.4262 22.5338 89.1365 22.7512 88.897 23.0186C88.6585 23.2859 88.4744 23.5979 88.3568 23.9365C88.2392 24.2751 88.1898 24.6338 88.2111 24.9917C88.2188 25.5078 88.4139 26.0036 88.759 26.3877C89.1041 26.7717 89.5761 27.0182 90.0882 27.0819C90.2195 27.0913 90.351
15 27.0913 90.4828 27.0819C90.8406 27.0631 91.1917 26.9736 91.5146 26.8186C91.8384 26.6636 92.1281 26.4461 92.3667 26.1789C92.6061 25.9115 92.7893 25.5995 92.9069 25.2609C93.0254 24.9223 93.0748 24.5637 93.0535 24.2057C93.0024 23.176 92.2747 22.1875 91.1764 22.1155Z",fill:s})]}),(0,i.jsx)("defs",{children:(0,i.jsx)("clipPath",{id:"clip0_4144_111772",children:(0,i.jsx)("rect",{width:"154",height:"28",fill:s})})})]})}},45859:(e,s,t)=>{"use strict";t.d(s,{EZ:()=>o,W4:()=>l,mk:()=>c});var i=t(14232),r=t(89099),a=t(82851),n=t.n(a);let l="ref",o="post-purchase",c=e=>{let{subscriptions:s,isLoading:t,hasExecuted:a,fetchAndProcessSubscriptions:c,isChefstepsSubscriptionVisible:d,onPollSuccess:u}=e,p=(0,r.useRouter)(),m=(0,i.useMemo)(()=>{var e;return null!=(e=p.query)?e:{}},[p.query]),h=(0,i.useRef)(0),b=(0,i.useRef)(!1),g=(0,i.useRef)(new Date().toISOString().slice(0,10)),f=(0,i.useMemo)(()=>{var e,s,t;return new URLSearchParams(null!=(t=null==(s=p.asPath)||null==(e=s.split("?")[1])?void 0:e.split("#")[0])?t:"")},[p.asPath]),x=m[l]===o||f.get(l)===o,[y,v]=(0,i.useState)(x),C=(0,i.useRef)(u);return(0,i.useEffect)(()=>{C.current=u}),(0,i.useEffect)(()=>{v(x&&!b.current)},[x]),(0,i.useEffect)(()=>{let e;if(!x||b.current||!a||t)return;let i=(e=g.current,Object.values(s).some(s=>s.some(s=>d(s)&&s.createdDate.slice(0,10)===e)));if(i||h.current>=9){var r,o;if(b.current=!0,v(!1),i&&(null==(r=C.current)||r.call(C)),Object.keys(m).length>0)p.replace({pathname:p.pathname,query:n().omit(m,l)},void 0,{shallow:!0});else{let[e]=(null!=(o=p.asPath)?o:"").split("?"),s=new URLSearchParams(f);s.delete(l);let t=s.toString();p.replace(t?"".concat(e,"?").concat(t):e,void 0,{shallow:!0})}return}let u=setTimeout(()=>{h.current+=1,c(!0)},500);return()=>clearTimeout(u)},[x,t,a,s,c,p,m,f,d]),{isPolling:y}}},76583:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>r});var i=t(37876);let r=e=>{let{color:s="#282726"}=e;return(0,i.jsx)("svg",{width:"91",height:"15",viewBox:"0 0 91 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{d:"M8.69141 10.543C8.69141 13.3359 7.1875 14.8398 3.96484 14.8398H0.3125V0.875H3.75C6.75781 0.875 8.26172 1.94922 8.26172 4.09766C8.26172 5.60156 7.40234 6.89062 6.11328 7.10547C7.83203 7.32031 8.69141 8.82422 8.69141 10.543ZM3.10547 2.80859V6.46094H3.75C4.82422 6.46094 5.25391 5.81641 5.25391 4.52734C5.25391 3.23828 4.82422 2.80859 3.75 2.80859H3.10547ZM5.46875 10.543C5.46875 9.03906 5.03906 8.17969 3.96484 8.17969H3.10547V13.1211H3.96484C5.03906 13.1211 5.46875 12.2617 5.46875 10.543ZM19.2188 11.832H15.9961L15.3516 14.8398H13.418L16.6406 0.875H19.6484L22.8711 14.8398H19.8633L19.0039 11.832H19.2188ZM18.7891 10.1133L17.5 4.74219L16.4258 10.1133H18.7891ZM31.25 9.89844V14.8398H28.2422V0.875H32.1094C34.9023 0.875 36.6211 2.16406 36.6211 5.17188C36.6211 7.10547 35.9766 8.39453 34.9023 9.03906L37.2656 14.8398H34.2578L32.3242 9.89844H31.25ZM31.8945 7.96484C33.1836 7.96484 33.6133 7.32031 33.6133 5.17188C33.6133 3.45312 32.9688 2.80859 31.8945 2.80859H31.25V7.96484H31.8945ZM47.5781 11.832H44.5703L43.9258 14.8398H41.9922L45.2148 0.875H48.2227L51.4453 14.8398H48.4375L47.5781 11.832ZM47.3633 10.1133L46.0742 4.74219L45 10.1133H47.3633ZM60.4688 2.80859V14.8398H57.4609V2.80859H54.668V0.875H63.2617V2.80859H60.4688ZM75.7227 13.1211V14.8398H68.2031L72.0703 2.59375H68.418V0.875H75.5078L71.8555 13.1211H75.7227ZM83.2422 11.832L82.5977 14.8398H80.6641L83.8867 0.875H86.8945L90.1172 14.8398H87.1094L86.4648 11.832H83.2422ZM84.7461 4.74219L83.6719 10.1133H86.0352L84.7461 4.74219Z",fill:s})})}},86484:e=>{e.exports={container:"PauseSubscription_container__XnnoX",durationHeading:"PauseSubscription_durationHeading__fr4UK",durationOptions:"PauseSubscription_durationOptions__r8TDj",helper:"PauseSubscription_helper__lu_jk"}},88852:(e,s,t)=>{"use strict";t.d(s,{z:()=>n});var i=t(37876),r=t(14232),a=t(84034);let n=e=>{var s,t;let{alertInfo:n}=e,l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(l.current){let e=l.current.getBoundingClientRect();e.top>=0&&e.bottom<=window.innerHeight||l.current.scrollIntoView({behavior:"smooth"})}},[n]),(0,i.jsx)(i.Fragment,{children:n&&(0,i.jsxs)("div",{ref:l,className:"account-setting-alert",children:[(0,i.jsx)(a.Alert,{type:null!=(s=null==n?void 0:n.type)?s:"success",message:null!=(t=null==n?void 0:n.message)?t:""}),(0,i.jsx)(a.Spacer,{size:"xs"})]})})}}}]);

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.