1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3979],{24188:e=>{e.exports={pageWrapper:"ActivateGiftCardPage_pageWrapper__VCOi4",container:"ActivateGiftCardPage_container__XZU7N",checkoutMain:"ActivateGiftCardPage_checkoutMain__bocO5",errorWrapper:"ActivateGiftCardPage_errorWrapper__HwIJ1",errorMessage:"ActivateGiftCardPage_errorMessage__SiD7e",activationError:"ActivateGiftCardPage_activationError__Y_4Ws"}},53979:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>k});var a=r(99362),i=r(95594),n=r(66345),s=r(72754),o=r(61419),c=r(5760),l=r(63219),d=r(17398),u=r(15929),m=r(24188),h=r.n(m),p=r(77734),f=r.n(p),v=r(63147);let g=e=>{let{email:t,giftCardNumber:r,setGiftCardNumber:n,setFirstName:o,setLastName:l,setValidDateRange:u,isUserEligibleForActivation:m=!1,onNext:h}=e,{t:p}=(0,s.B)(),[g,x]=(0,i.useState)(null),[_,C]=(0,i.useState)(!1);(0,i.useEffect)(()=>{m||x(p("checkout:form.gift-card-number-existsing-customer"))},[m]);let b=async()=>{if(m){if(x(null),""===r.trim())return x(p("checkout:form.gift-code-error")),!1;C(!0);try{var e,a,i,n;let s={email:t,gift_card_number:r.replace(/-/g,"")},c=await d.Ay.validationApi.validateGiftCardNumber(s);c.valid?(o(null==(a=c.data)?void 0:a.gift_first_name),l(null==(i=c.data)?void 0:i.gift_last_name),u(null==(n=c.data)?void 0:n.date_range),h&&h()):(x((null==(e=c.errors)?void 0:e.gift_card_number)||p("checkout:form.gift-card-number-error")),setTimeout(()=>{let e=document.querySelector('input[class*="error"]');e&&(e.scrollIntoView({behavior:"smooth",block:"center"}),e.focus())},100))}catch(e){console.error("Error validating gift card number:",e),x(p("checkout:form.gift-card-number-error")),setTimeout(()=>{let e=document.querySelector('input[class*="error"]');e&&(e.scrollIntoView({behavior:"smooth",block:"center"}),e.focus())},100)}finally{C(!1)}return!0}};return(0,a.jsxs)("div",{className:f().formContainer,children:[(0,a.jsx)("div",{className:f().nameFieldsContainer,children:(0,a.jsx)("div",{className:f().nameField,children:(0,a.jsx)(c.pd,{label:p("checkout:form.gift-card-number","Geschenkkartennummer"),placeholder:p("checkout:form.gift-card-number-placeholder"),value:r,onChange:e=>{n((e=>{var t;return((null==(t=e.replace(/\D/g,"").match(/.{1,3}/g))?void 0:t.join("-"))||"").slice(0,11)})(e))},onBlur:b,leftIcon:(0,a.jsx)("img",{src:(0,v.D)("card.svg"),alt:"card icon"}),className:f().nameField,error:!!g,helper:g||void 0})})}),(0,a.jsx)("p",{className:f().membershipText,children:p("checkout:form.gift-card-number-helper")}),(0,a.jsx)("div",{className:f().buttonContainer,children:h&&(0,a.jsx)(c.$n,{variant:"primary",size:"medium",onClick:()=>b(),className:f().nextButton,children:_?(0,a.jsx)("div",{style:{width:"20px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,a.jsx)("div",{style:{width:"20px",height:"20px",border:"2px solid rgba(255, 255, 255, 0.3)",borderTopColor:"transparent",borderRadius:"50%",animation:"checkout-spin 0.6s linear infinite"}})}):p("checkout:button.verify-hc-number")})})]})};var x=r(29064),_=r(30113),C=r(96766),b=r(55365),y=r(26628);let j=e=>{let{message:t,onRetry:r}=e;return(0,a.jsxs)("div",{className:h().errorWrapper,role:"alert",children:[(0,a.jsx)("p",{className:h().errorMessage,children:t}),(0,a.jsx)("button",{onClick:r,children:"Try Again"})]})},k=()=>{var e;let{t}=(0,s.B)(),{isDesktop:r}=(0,c.Qs)(),{startRedirect:m}=(0,o.w)(),p=(0,l._)(),{data:f,isLoading:v,isError:k,error:N,refetch:S}=(0,_.G)(),F=(0,b.u)(p,f),A=(0,y.D)(f),{locale:w,currency:G,isAuthenticated:P,isUserEligibleForActivation:E}=F,{email:I,salutation:D,firstName:T,lastName:W,phoneCode:M,phoneCountryId:R,phoneNumber:V,address:B,city:z,zipCode:L,countryId:q,countryCode:O}=A,[H,K]=(0,i.useState)(1),[U,Y]=(0,i.useState)(I),[Z,J]=(0,i.useState)(D),[Q,X]=(0,i.useState)(T),[$,ee]=(0,i.useState)(W),[et,er]=(0,i.useState)(M),[ea,ei]=(0,i.useState)(R),[en,es]=(0,i.useState)(V),[eo,ec]=(0,i.useState)(q),[el,ed]=(0,i.useState)(O),[eu,em]=(0,i.useState)("Switzerland"),[eh,ep]=(0,i.useState)(B),[ef,ev]=(0,i.useState)(L),[eg,ex]=(0,i.useState)(z),[e_,eC]=(0,i.useState)(""),[eb,ey]=(0,i.useState)(""),[ej,ek]=(0,i.useState)(""),[eN,eS]=(0,i.useState)(null),eF=async()=>
1{if(P&&1==H)return void K(3);H<3&&K(H+1)},eA=async()=>{eS(null);try{let e=await d.Ay.checkoutApi.activateGiftCard({card_number:ej.replace(/-/g,""),currency:G,email:U||"",salutation:Z||"",first_name:Q||"",last_name:$||"",phone_code:et||"",phone_country_id:ea||"",phone_number:en||"",country_code:el||"",country_id:eo||"",street:eh||"",zip_code:ef||"",city:eg||"",locale:w||""});if(e.valid&&e.success_url)return void m(e.success_url);eS(t("checkout:form.general-validation-error"))}catch(e){console.error("Failed to activate the gift card:",e),eS(t("checkout:form.general-validation-error"))}},ew=[{number:1,heading:t("checkout:subheadline.your-hotelcard"),content:(0,a.jsx)(g,{email:U,giftCardNumber:ej,setGiftCardNumber:ek,setFirstName:X,setLastName:ee,setValidDateRange:ey,isUserEligibleForActivation:E,onNext:eF}),summary:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:ej}),(0,a.jsx)("p",{children:eb}),(0,a.jsxs)("p",{children:[Q," - ",$]})]})},{number:2,heading:t("checkout:subheadline.set-up-login"),content:(0,a.jsx)(u.co,{email:U,setEmail:Y,onNext:eF,selectedProductId:null,isLocked:!1,isGift:!1,isActivationPage:!0}),summary:P||H>2?(0,a.jsx)(a.Fragment,{children:U}):void 0,showEditButton:!P},{number:3,heading:t("checkout:subheadline.personal-details"),content:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.Wc,{salutation:Z,setSalutation:J,firstName:Q,setFirstName:X,company:"",lastName:$,setLastName:ee,phoneCode:et,setPhoneCode:er,phoneCountryId:ea,setPhoneCountryId:ei,phoneNumber:en,setPhoneNumber:es,country:eo,setCountry:ec,countryCode:el,setCountryCode:ed,countryName:eu,setCountryName:em,address:eh,setAddress:ep,zipCode:ef,setZipCode:ev,city:eg,setCity:ex,onNext:eA,isAuthenticated:P,isGift:!1,initiatePersonalCardPurchase:()=>{},isActivationPage:!0,isVoucherPage:!1,googleApiKey:null==f||null==(e=f.checkoutData)?void 0:e.googleApiKey}),eN&&(0,a.jsx)("div",{className:h().activationError,role:"alert",children:eN})]}),summary:P||H>3?(0,a.jsx)(a.Fragment,{children:Q&&$&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[Z," ",Q," ",$]}),(0,a.jsxs)("div",{children:[et," ",en]}),(0,a.jsxs)("div",{children:[eh,", ",ef," ",eg,", ",eo]})]})}):void 0}];return((0,i.useEffect)(()=>{f&&(Y(I),J(D),X(T),ee(W),er(M),ei(R),es(V),ep(B),ev(L),ex(z),ec(q),ed(O))},[f]),v)?(0,a.jsx)(C.h,{windowData:p}):k?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.Vs,{}),(0,a.jsx)("main",{className:h().checkoutMain,children:(0,a.jsx)(j,{message:null!=N?N:"Failed to load checkout data.",onRetry:S})}),(0,a.jsx)(c.wi,{})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.m,{children:(0,a.jsx)("title",{children:t("checkout:meta.page-title-order")})}),(0,a.jsxs)("div",{className:h().pageWrapper,children:[(0,a.jsx)(c.Vs,{}),(0,a.jsx)("div",{className:h().container,children:(0,a.jsx)(x.R,{title:t("checkout:headline.activate-gift"),subtitle:t("checkout:subheadline.gift-activate-flow"),onBack:()=>(0,x.t)(w),steps:ew,currentStep:H,onEditStep:e=>{K(e)},editLabel:t("checkout:link.edit"),sidebar:r?(0,a.jsx)(u.DH,{email:U,discountCode:e_,setDiscountCode:eC,currentProduct:null,products:[],isLocked:!1,isRenewalOrder:!1,selectedPaymentMethodId:0,openDiscountSection:!1,xmasGiftDiscountCode:"",currency:G,activateGiftCard:!0}):void 0})}),(0,a.jsx)(c.wi,{})]})]})}},61419:(e,t,r)=>{"use strict";r.d(t,{w:()=>i});var a=r(95594);let i=()=>{let[e,t]=(0,a.useState)(3);return{startRedirect:e=>{if(""===e.trim())return;let r=setInterval(()=>{t(e=>e<=1?(clearInterval(r),0):e-1)},1);setTimeout(()=>{window.location.href=e},3)},countdown:e}}},77734:e=>{e.exports={nameFieldsContainer:"ActivateGiftCardForm_nameFieldsContainer__rFSya",nameField:"ActivateGiftCardForm_nameField__h82ej",buttonContainer:"ActivateGiftCardForm_buttonContainer__0R63v",membershipText:"ActivateGiftCardForm_membershipText__fESYq"}}}]);
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.