1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[541],{1567:(e,a,t)=>{"use strict";t.d(a,{A:()=>o});var l=t(14232),r=t(4309),s=t(46217),i=t(8349),n=t(96043),c=t(17708);let o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onLoading:a,onError:t,onRedirect:o,collectAddress:u=!1,collectPhone:p=!1}=e,[d,m]=(0,l.useState)(!1),[h,x]=(0,l.useState)(null),_=(0,c.A)(),{userData:{customerId:g,email:f,productCart:y,productInterval:b,beaconSessionData:v}}=(0,r.u)(),N=(0,s.A)(),{publisherCurrency:j}=(0,n.A)(),A=(0,l.useCallback)(()=>{x(null)},[]),T=(0,l.useCallback)(async e=>{m(!0),x(null),null==a||a();try{let a=await fetch("/api/checkout/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteSlug:_,customerId:g,email:f,collectAddress:u,collectPhone:p,beaconUserTrackingId:null==v?void 0:v.userTrackingId,beaconSessionId:null==v?void 0:v.sessionId,beaconSessionSequence:null==v?void 0:v.sessionSequence,...e})});if(!a.ok){let e=(await a.json().catch(()=>({}))).message||"Failed to create checkout session";x(e),null==t||t(e),m(!1);return}let r=await a.json();if(!r.url){let e="No checkout URL returned";x(e),null==t||t(e),m(!1);return}if(N){let a={};if(y&&b){var l;let e=(0,i.A)(y,b,j||"usd");a.currency=e.currency,a.value=parseFloat((null==(l=e.price)?void 0:l.toString())||"0"),a.items=[e]}else e.donationAmount&&(a.currency=(j||"usd").toLowerCase(),a.value=e.donationAmount,a.items=[]);N("begin_checkout",a)}null==o||o(r.url),window.location.href=r.url}catch(a){let e=a instanceof Error?a.message:"An unexpected error occurred";x(e),null==t||t(e),m(!1)}},[_,g,f,u,p,v,a,t,o,N,y,b,j]),k=(0,l.useCallback)(async e=>{await T({productId:e.productId,interval:e.interval,couponCode:e.couponCode,applyTax:e.applyTax,successUrl:e.successUrl,cancelUrl:e.cancelUrl,saleKey:e.saleKey,...void 0!==e.collectAddress&&{collectAddress:e.collectAddress},...void 0!==e.shipToCountry&&{shipToCountry:e.shipToCountry},...void 0!==e.cyoAmount&&{cyoAmount:e.cyoAmount}})},[T]),w=(0,l.useCallback)(async e=>{await T({productId:e.productId,interval:e.interval,couponCode:e.couponCode,applyTax:e.applyTax,isGift:!0,giftRecipient:e.giftRecipient,email:e.email,successUrl:e.successUrl,cancelUrl:e.cancelUrl,saleKey:e.saleKey})},[T]),C=(0,l.useCallback)(async e=>{await T({isDonation:!0,donationAmount:e.amount,email:e.email,successUrl:e.successUrl,cancelUrl:e.cancelUrl,...void 0!==e.collectAddress&&{collectAddress:e.collectAddress}})},[T]),U=(0,l.useCallback)(async e=>{await T({isGiftRedemption:!0,promotionCode:e.promotionCode,stripePriceId:e.stripePriceId,applyTax:e.applyTax,successUrl:e.successUrl,cancelUrl:e.cancelUrl,...void 0!==e.collectAddress&&{collectAddress:e.collectAddress}})},[T]),S=(0,l.useCallback)(async e=>{m(!0),x(null),null==a||a();try{let a=await fetch("/api/checkout/portal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteSlug:_,customerId:g,...e})});if(!a.ok){let e=(await a.json().catch(()=>({}))).message||"Failed to create portal session";x(e),null==t||t(e),m(!1);return}let l=await a.json();if(!l.url){let e="No portal URL returned";x(e),null==t||t(e),m(!1);return}null==o||o(l.url),window.location.href=l.url}catch(a){let e=a instanceof Error?a.message:"An unexpected error occurred";x(e),null==t||t(e),m(!1)}},[_,g,a,t,o]);return{isLoading:d,error:h,startCheckout:k,startGiftCheckout:w,startDonationCheckout:C,startGiftRedemptionCheckout:U,startUpgradePortal:(0,l.useCallback)(async e=>{await S({flow:"subscription_update",subscriptionId:e.subscriptionId,returnUrl:e.returnUrl})},[S]),startPaymentMethodUpdate:(0,l.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};await S({flow:"payment_method_update",subscriptionId:e.subscriptionId,returnUrl:e.returnUrl})},[S]),clearError:A}}
1},8349:(e,a,t)=>{"use strict";t.d(a,{A:()=>l});let l=(e,a,t)=>{var l;let r="annual"===a||"one-time"===a?e.annualPrice:e.monthlyPrice;return{item_id:(null==e||null==(l=e.id)?void 0:l.toString())||null,item_name:null==e?void 0:e.name,item_variant:a,currency:t,price:parseFloat(r),quantity:1}}},19872:e=>{e.exports={pageWrapper:"recipient_pageWrapper__eu4bz",pageTitle:"recipient_pageTitle__RsAB0",paymentBtn:"recipient_paymentBtn__Z_FNr",backLink:"recipient_backLink__BA7gK",form:"recipient_form__4SKR9",inputWrapper:"recipient_inputWrapper__WJVvY",labelText:"recipient_labelText__WpUP0",input:"recipient_input__OoeEc",textarea:"recipient_textarea__xek2O",textareaLabelText:"recipient_textareaLabelText__JauIp"}},35629:(e,a,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_sites/[siteSlug]/gift/recipient",function(){return t(40301)}])},37035:e=>{e.exports={wrapper:"ProgressMeter_wrapper__tX6xX",text:"ProgressMeter_text__DHWBl"}},40301:(e,a,t)=>{"use strict";t.r(a),t.d(a,{__N_SSP:()=>x,default:()=>_});var l=t(37876),r=t(14232),s=t(4309),i=t(1567),n=t(67685),c=t(50287),o=t(81249),u=t(20884),p=t(52066),d=t(10346),m=t(19872),h=t.n(m),x=!0;let _=e=>{let{globalData:a}=e,{siteTitle:t}=a,{userData:m,updateUserData:x}=(0,s.u)(),{productCart:_,productInterval:g=n.IX.Monthly,gift:f,email:y}=m,{recipient:b}=f||{},{email:v="",name:N="",message:j=""}=b||{},[A,T]=(0,r.useState)(""),[k,w]=(0,r.useState)(null),[C,U]=(0,r.useState)(v),[S,E]=(0,r.useState)(N),[P,I]=(0,r.useState)(j),[R,L]=(0,r.useState)(y||""),{startGiftCheckout:W,isLoading:M}=(0,i.A)({onError:e=>{T(e),w(c.A.Error)}}),F=(0,r.useCallback)(async()=>{let e=y||R;if(!e){T("Please enter your email address."),w(c.A.Error);return}if(!_||!_.id){T("Please select a product before proceeding."),w(c.A.Error);return}x({email:e,gift:{recipient:{email:C,name:S,message:P}}}),await W({productId:_.id,interval:g,email:e,giftRecipient:{email:C,name:S,message:P}})},[C,S,P,R,y,_,g,x,W]);return(0,l.jsx)(o.A,{...a,title:"".concat(t," | Gift Payment"),headerTheme:"simple",footerTheme:"simple",hideAds:!0,children:(0,l.jsxs)("div",{className:h().pageWrapper,children:[(0,l.jsx)("h1",{className:h().pageTitle,children:"Provide Gift Recipient Information"}),(0,l.jsx)(p.A,{step:2,total:3}),(0,l.jsx)(u.A,{href:_&&_.productGroup?"/gift/products/".concat(_.productGroup.name):"/gift/products",className:h().backLink,children:(0,l.jsx)("span",{children:"Return to product selection"})}),A&&k?(0,l.jsx)(d.A,{msg:A,status:k}):null,(0,l.jsxs)("form",{className:h().form,method:"post",onSubmit:e=>{e.preventDefault(),F()},children:[(0,l.jsx)("div",{className:h().inputWrapper,children:(0,l.jsxs)("label",{htmlFor:"recipientEmail",className:h().label,children:[(0,l.jsx)("input",{type:"email",id:"recipientEmail",name:"recipientEmail",placeholder:"Recipient Email",required:!0,className:h().input,value:C,onChange:e=>U(e.target.value)}),(0,l.jsx)("span",{className:h().labelText,children:"Recipient Email"})]})}),(0,l.jsx)("div",{className:h().inputWrapper,children:(0,l.jsxs)("label",{htmlFor:"recipientName",className:h().label,children:[(0,l.jsx)("input",{type:"text",id:"recipientName",name:"recipientName",maxLength:500,className:h().input,value:S,onChange:e=>E(e.target.value),placeholder:"Recipient Name (optional)"}),(0,l.jsxs)("span",{className:h().labelText,children:["Recipient Name ",(0,l.jsx)("em",{children:"(optional)"})]})]})}),(0,l.jsx)("div",{className:h().inputWrapper,children:(0,l.jsxs)("label",{htmlFor:"giftMessage",className:h().label,children:[(0,l.jsxs)("span",{className:h().labelText,children:["Gift Message ",(0,l.jsx)("em",{children:"(optional)"})]}),(0,l.jsx)("textarea",{maxLength:500,rows:4,id:"giftMessage",name:"giftMessage",className:h().textarea,value:P,onChange:e=>I(e.target.value),placeholder:"Gift Message (optional)"}),(0,l.jsxs)("span",{className:h().textareaLabelText,children:["Gift Message ",(0,l.jsx)("em",{children:"(optional)"})]})]})}),y?null:(0,l.jsx)("div",{className:h().inputWrapper,children:(0,l.jsxs)("label",{htmlFor:"purchaserEmail",className:h().label,children:[(0,l.jsx)("input",{type:"email",id:"purchaserEmail",n
1ame:"purchaserEmail",placeholder:"Your Email",required:!0,className:h().input,value:R,onChange:e=>L(e.target.value)}),(0,l.jsx)("span",{className:h().labelText,children:"Your Email"})]})}),(0,l.jsx)("button",{type:"submit",className:h().paymentBtn,disabled:M,children:M?"Loading...":"Continue to Payment"})]})]})})}},52066:(e,a,t)=>{"use strict";t.d(a,{A:()=>n});var l=t(37876),r=t(96043),s=t(37035),i=t.n(s);let n=e=>{let{step:a,total:t}=e,{hideCheckoutProgress:s=!1}=(0,r.A)();return s?null:(0,l.jsx)("div",{className:i().wrapper,children:(0,l.jsxs)("p",{className:i().text,children:["Step ",a," of ",t]})})}}},e=>{e.O(0,[1596,6071,1249,636,6593,8792],()=>e(e.s=35629)),_N_E=e.O()}]);
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.