1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7269],{3759:e=>{e.exports={formWrapper:"AddressManager_formWrapper___pSMj",submitBtn:"AddressManager_submitBtn__8es6R",utilityBtn:"AddressManager_utilityBtn__vOD6o",btnLink:"AddressManager_btnLink__brbaQ",loadingWrapper:"AddressManager_loadingWrapper__eqoNC",item:"AddressManager_item__HaOMC",name:"AddressManager_name__hY_pE"}},37035:e=>{e.exports={wrapper:"ProgressMeter_wrapper__tX6xX",text:"ProgressMeter_text__DHWBl"}},39636:e=>{e.exports={pageHeader:"shipping_pageHeader__UiiLC",pageWrapper:"shipping_pageWrapper__S2VbT",pageTitle:"shipping_pageTitle__YLO9Z",pageSubtitle:"shipping_pageSubtitle__nG5Vh",sectionHeading:"shipping_sectionHeading__LhI5B",inner:"shipping_inner__DxvRU",ctaWrapper:"shipping_ctaWrapper__2dhg_",priceWrapper:"shipping_priceWrapper__ZCC6L",link:"shipping_link__G3a3H",paymentBtn:"shipping_paymentBtn__r_unU",loadingWrapper:"shipping_loadingWrapper__LM_lj",meta:"shipping_meta__6QG_M",msg:"shipping_msg__HKhPW",btnLink:"shipping_btnLink__6wSQX"}},44438:(e,s,a)=>{"use strict";a.d(s,{A:()=>g});var t=a(37876),r=a(14232),i=a(49995),n=a(61902),l=a(74363),d=a(40880),p=a(40958),c=a(10346),o=a(14462),u=a(98777),m=a(50287),h=a(3759),_=a.n(h);let g=e=>{let{customerData:s,customerId:a,siteSlug:h,refreshExpiration:g,expiration:f}=e,[x,j]=(0,r.useState)(!1),[v,b]=(0,r.useState)({name:s.name||"",line1:s.addressLine1||"",line2:s.addressLine2||"",city:s.addressCity||"",state:s.addressState||"",postalCode:s.addressPostalCode||"",country:s.countryCode||""}),{name:A,line1:y,line2:S,city:N,state:C,postalCode:k,country:E}=v,[W,w]=(0,r.useState)(!0),[B,L]=(0,r.useState)(!1),[P,M]=(0,r.useState)(null),[T,H]=(0,r.useState)(null),D=(0,n.useElements)(),G=(0,n.useStripe)(),I=(e,s)=>{b(a=>({...a,[e]:s}))},O=async e=>{if(e.complete){let s;j(!0);try{s=await (0,l.A)({name:e.value.name,addressLine1:e.value.address.line1,addressLine2:e.value.address.line2,addressCity:e.value.address.city,addressState:e.value.address.state,addressPostalCode:e.value.address.postal_code,countryCode:e.value.address.country},a,h,null,f,g),M(m.A.Success),H("Address updated successfully."),w(!1)}catch(e){(0,d.v)(e,{siteSlug:h}),M(m.A.Error),H("Error updating address. Please try again.")}s&&(I("name",e.value.name),I("line1",e.value.address.line1),I("line2",e.value.address.line2),I("city",e.value.address.city),I("state",e.value.address.state),I("postalCode",e.value.address.postal_code),I("country",e.value.address.country),j(!1))}else M(m.A.Error),w(!0),H("Some required fields are missing. Please try again.")},q=async()=>{let e=null==D?void 0:D.getElement("address");e&&O(await e.getValue())};return((0,r.useEffect)(()=>{A&&y&&N&&k&&w(!1)},[A,y,S,N,k]),G&&D)?W||x?(0,t.jsxs)(t.Fragment,{children:[T?(0,t.jsx)(c.A,{msg:T,status:P}):null,B?(0,t.jsxs)("button",{type:"button",onClick:()=>{w(!1),L(!1)},className:_().btnLink,children:[(0,t.jsx)(o.A,{}),"Go back"]}):null,(0,t.jsxs)("form",{onSubmit:q,children:[(0,t.jsx)(n.AddressElement,{options:{mode:"shipping",defaultValues:{name:A,address:{line1:y,line2:S,city:N,state:C,postal_code:k,country:E}}},id:"address-element"}),(0,t.jsx)("button",{disabled:x||!G||!D,id:"submit",type:"submit",className:x?_().loadingWrapper:_().submitBtn,children:(0,t.jsx)("span",{children:x?(0,t.jsx)(p.A,{variant:u.A.Inline}):"Save"})})]})]}):(0,t.jsxs)("div",{className:_().wrapper,children:[(0,t.jsxs)("div",{className:_().inner,children:[(0,t.jsx)("p",{className:(0,i.A)(_().item,_().name),children:A}),(0,t.jsx)("p",{className:_().item,children:y}),S?(0,t.jsx)("p",{className:_().item,children:S}):null,(0,t.jsxs)("p",{className:_().item,children:[N,", ",C," ",k]}),E?(0,t.jsx)("p",{className:_().item,children:E}):null]}),(0,t.jsx)("button",{type:"button",onClick:()=>{w(!0),L(!0)},className:_().utilityBtn,children:"Edit"})]}):(0,t.jsx)(p.A,{variant:u.A.Inline})}},44497:(e,s,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_sites/[siteSlug]/gift/redeem/shipping",function(){return a(49209)}])},49209:(e,s,a)=>{"use strict";a.r(s),a.d(s,{__N_SSP:()=>A,default:()=>y});var t=a(37876),r=a(4241),i=a(37062),n=a(4309),l=a(40880),d=a(69835),p=a(37036),c=a(98777),o=a(14232),u=a(89099),m=a(81249),h=a(20884),_=a(52066),g=a(40958),f=a(61902),x=a(44438),j=a(14462),v=a(39636),b=a.n(v),A=!0;let y=e=>{let{globalData:s}=e,{siteTitle:a,publisherFeatureFlags:{streetAddressCollection:v=!1}}=s,{push:A,query:{siteSlug:y}}=(0,u.useRouter)(),[S,N]=(0,o.useState)(null),[C,k]=(0,o.useState)(!1),[E,W]=(0,o.useState)(null),[w,B]=(0,o.useState)(null),{userData:{hydrated:L,validated:P,customerId:M,theme:T,expiration:H,refreshExpiration:D}}=(0,n.u)(),G=T===p.B.Dark?"night":"stripe",I=T===p.B.Dark?"#ffffff"
1:"#333333",O=(0,d.A)(G,I),q=(0,o.useCallback)(async()=>{if(M){let e=await fetch("/api/customer/".concat(M),{method:"GET",headers:{"Cache-Control":"no-cache"}});W(await e.json())}},[M]),R=(0,o.useCallback)(async()=>{try{let e=await fetch((0,i.c)("publisherStripe",{siteSlug:y})),{stripeKey:s,stripeAccount:a}=await e.json();if(!s||!a)return void N(null);let t=(0,r.c)(s,{stripeAccount:a});N(t)}catch(e){(0,l.v)(e,{siteSlug:y}),k(!0)}},[y]);return(0,o.useEffect)(()=>{if(L&&!P){var e,s,a,t;let r=null==(s=globalThis)||null==(e=s.document)?void 0:e.referrer,i=null==(t=globalThis)||null==(a=t.location)?void 0:a.origin;if(void 0===r||void 0===i||r.includes(i))A("/login");else{let e=encodeURIComponent("/gift/redeem/shipping");A("/login?redirect=".concat(e))}}},[A,P,L,y]),(0,o.useEffect)(()=>{R()},[R]),(0,o.useEffect)(()=>{q()},[q]),(0,o.useEffect)(()=>{let{name:e,addressLine1:s,addressCity:a,countryCode:t}=E||{};e&&s&&a&&t&&B(!0)},[E]),(0,t.jsxs)(m.A,{...s,title:"".concat(a," | Gift Subscription: Shipping Address"),headerTheme:"simple",footerTheme:"simple",hideAds:!0,children:[(0,t.jsxs)("div",{className:b().pageHeader,children:[(0,t.jsx)("h1",{className:b().pageTitle,children:"Gift Subscription: Shipping Address"}),(0,t.jsx)(_.A,{step:2,total:3})]}),v?(0,t.jsxs)("div",{className:b().pageWrapper,children:[(0,t.jsx)("h2",{className:b().sectionHeading,children:"Your Address"}),(0,t.jsxs)("div",{className:b().inner,children:[(0,t.jsx)("p",{className:b().meta,children:"You are subscribing to a product that requires a shipping address."}),E?(0,t.jsx)(f.Elements,{options:{appearance:O},stripe:S,children:(0,t.jsx)(x.A,{customerData:E,customerId:M,siteSlug:y,expiration:H,refreshExpiration:D})}):(0,t.jsx)("div",{className:b().loadingWrapper,children:(0,t.jsx)(g.A,{variant:c.A.Inline})}),(0,t.jsxs)("div",{className:b().ctaWrapper,children:[(0,t.jsxs)(h.A,{href:"/gift/redeem",className:b().btnLink,children:[(0,t.jsx)(j.A,{}),"Back to gift redemption"]}),w?(0,t.jsx)(h.A,{href:"/gift/redeem/confirm",className:b().paymentBtn,children:"Proceed to gift confirmation"}):(0,t.jsx)("p",{className:b().msg,children:"Complete shipping address to proceed to confirmation."})]})]})]}):(0,t.jsxs)("div",{className:b().pageWrapper,children:[(0,t.jsx)("p",{children:"Product does not require a shipping address."}),(0,t.jsxs)(h.A,{href:"/gift/redeem",className:b().btnLink,children:[(0,t.jsx)(j.A,{}),"Back to gift redemption"]})]}),C?(0,t.jsx)("p",{children:"An error occurred. Please refresh the page or try again later."}):null]})}},52066:(e,s,a)=>{"use strict";a.d(s,{A:()=>l});var t=a(37876),r=a(96043),i=a(37035),n=a.n(i);let l=e=>{let{step:s,total:a}=e,{hideCheckoutProgress:i=!1}=(0,r.A)();return i?null:(0,t.jsx)("div",{className:n().wrapper,children:(0,t.jsxs)("p",{className:n().text,children:["Step ",s," of ",a]})})}},69835:(e,s,a)=>{"use strict";a.d(s,{A:()=>t});let t=function(e,s){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return{theme:e||"stripe",labels:"floating",variables:{fontFamily:"'IBM Plex Sans', Helvetica, sans-serif",borderRadius:"3px",colorTextSecondary:s||"#333333"},...a}}},74363:(e,s,a)=>{"use strict";a.d(s,{A:()=>r});var t=a(37062);let r=async(e,s,a,r,i,n)=>{let l=await fetch((0,t.c)("customer/update"),{method:"POST",headers:{"Content-type":"application/json","Cache-Control":"no-cache, must-revalidate, max-age=0"},body:JSON.stringify({customerData:e,customerId:s,siteSlug:a,avatar:r,expiration:i,refreshExpiration:n})});return l.ok?l.json():l}}},e=>{e.O(0,[1596,6071,8528,1249,636,6593,8792],()=>e(e.s=44497)),_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.