PageSourceSearch

https://www.finn.com/_next/static/chunks/2421-f1181528240b8dd3.js

js finn.com collected 2026-09-24 18:31:17 UTC 27,902 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2421],{73222:(e,t,a)=>{a.d(t,{C:()=>o});var r=a(7620),s=a(27795),i=a(33611);let o=(e,t)=>{let a=(0,s.i)(e=>e.track),[o,n]=(0,r.useState)([]),l=e.watch(),c=(0,r.useMemo)(()=>Object.keys(l||{}).flatMap(e=>{let t=l[e];return"object"!=typeof t||null===t||t instanceof Date?[{name:e,value:t}]:Object.keys(t).map(a=>({name:`${e}.${a}`,value:t[a]}))}),[l]),u=c.map(e=>e.name),d=c.map(e=>"object"==typeof e.value&&null!==e.value?e.value?.toString?.():e.value),m=JSON.stringify(d||[]);(0,r.useEffect)(()=>{if(0===o.length)return void n(d);let e=d.reduce((e,t,a)=>(t!==o?.[a]&&e.push(a),e),[]);u.forEach((r,s)=>{if(!e.includes(s))return;let o=c[s].value;((e,t)=>{switch(e){case"phone":return t?.length>7;case"birthday":return t instanceof Date;default:return!!(t||"")?.trim?.()}})(r,o)&&a(i.fC.FORM_FIELD_ENTERED,{fieldName:r,once:!0,location:t}),!0===o&&a(i.fC.CHECKBOX_CLICKED,{fieldName:r,once:!0,location:t})}),n(d)},[m])}},74834:(e,t,a)=>{a.d(t,{s:()=>u});var r=a(59770),s=a(38039),i=a(82993),o=a(28461),n=a.n(o),l=a(19027),c=a.n(l);n().extend(c());let u=({birthday:e,intl:t})=>{if(!e)return null;let a="string"==typeof e?n()(e,"DD.MM.YYYY"):n()(e);if(!a.isValid())return null;let o=n()().diff(a,"year");
1if(o<r.Ak.MIN_EXCEPTIONAL)return null;let l=o<r.Ak.YOUNG_DRIVER_THRESHOLD,c=o>r.Ak.OLD_DRIVER_THRESHOLD,u=(()=>{if((0,s.S)())return!1;let e=(0,i.d)()?.code;return!!e&&e.startsWith("dbb_")})();return l?{label:t.formatMessage("checkout.addons.youngOld.youngDriverSurchargeLabel"),message:t.formatMessage("checkout.addons.youngOld.youngDriverMessage"),surcharge:r.TQ,addonId:r.t0}:c&&!u?{label:t.formatMessage("checkout.addons.youngOld.oldDriverSurchargeLabel"),message:t.formatMessage("checkout.addons.youngOld.oldDriverMessage"),surcharge:r.uO,addonId:r.E1}:null}},75446:(e,t,a)=>{a.d(t,{a:()=>l,e:()=>n});var r=a(54568),s=a(59770),i=a(51744),o=a(25177);let n=async()=>{let e=window?.grecaptcha,t=new Promise(t=>{e.ready(()=>{e.execute(s._A,{action:"submit"}).then(t)})});return await t},l=()=>{let e=(0,i.t)();return(0,r.jsxs)("div",{className:"body-14-light py-2 [&_a]:font-semibold [&_a]:underline",children:[(0,r.jsx)(o.default,{src:`https://www.google.com/recaptcha/api.js?render=${s._A}`}),e.formatMessage("general.recaptchaPrivacyText")]})}},76841:(e,t,a)=>{a.d(t,{a:()=>eL});var r=a(54568),s=a(7646),i=a(73222),o=a(14567),n=a(7620),l=a(42584),c=a(60974),u=a(56390),d=a(66866),m=a(92088),g=a(27795),h=a(33611),f=a(75446),p=a(51744),_=a(89718),C=a(71255),b=a(36742),k=a(17217),E=a(93160);let x=()=>{let e=(0,p.t)();return(0,E.CW)()?(0,r.jsxs)(k.Hi,{className:"-mb-4",children:[(0,r.jsx)(k.xN,{children:e.formatMessage("general.jobauto.authBanner.title")}),(0,r.jsx)(k.Ty,{children:e.formatMessage("general.jobauto.authBanner.description")})]}):null};var S=a(60233),L=a(1956);let A=e=>{let t=(0,p.t)();return(0,r.jsx)(S.aF,{open:e.open,onOpenChange:e.onClose,variant:"small",children:(0,r.jsxs)(S.$m,{"data-testid":"modal-content",children:[(0,r.jsxs)(S.rQ,{children:[(0,r.jsx)(S.wt,{children:(0,L.Kk)(t.formatMessage("general.jobauto.authFailedModal.title"))}),(0,r.jsx)(S.Wn,{children:t.formatMessage("general.jobauto.authFailedModal.description")})]}),(0,r.jsx)(S.jl,{children:(0,r.jsx)(c.$,{href:"/de-DE/subscribe",variant:"primary",children:t.formatMessage("general.jobauto.authFailedModal.primaryCTA")})})]})})},w=({open:e,onClose:t,email:a})=>{let s=(0,p.t)(),i=(0,g.i)(e=>e.track),o=(0,n.useCallback)(()=>{i(h.fC.CTA_CLICKED,{location:"B2B Login"})},[i]),l=s.formatMessage("userAccount.login.fleet_prompt.fleet.title"),u=s.formatMessage("userAccount.login.fleet_prompt.fleet.accountDetected",{email:a}),d=s.formatMessage("userAccount.login.fleet_prompt.fleet.link_href"),m=s.formatMessage("userAccount.login.fleet_prompt.fleet.link_text"),f=s.formatMessage("checkout.cancel");return(0,r.jsx)(S.aF,{variant:"small",open:e,onOpenChange:e=>{e||t()},children:(0,r.jsxs)(S.$m,{children:[(0,r.jsx)(S.rQ,{children:(0,r.jsx)(S.wt,{children:l})}),(0,r.jsx)("p",{className:"body-14-regular",children:u}),(0,r.jsxs)(S.jl,{children:[(0,r.jsx)(c.$,{href:d,onClick:o,children:m}),(0,r.jsx)(c.$,{variant:"outline",onClick:t,children:f})]})]})})};var j=a(63579),M=a(43752);let N=({label:e})=>{let t=(0,l.xW)(),a=(0,M.i)(e=>e.formValues),s=(0,M.i)(e=>e.loginScreen),i=(0,M.i)(e=>e.setLoginScreen),o=s===M.a.loginForm,c=[M.a.magicLinkSuccess,M.a.forgotPasswordSuccess].includes(s),u=t?.watch("email"),d=a?.email,m=s===M.a.completeRegistration;return(0,n.useEffect)(()=>{o&&u!==d&&i(M.a.emailCheckForm)},[u,o,d,i]),c?(0,r.jsx)(l.xI,{control:t.control,name:"email",render:({field:e})=>(0,r.jsx)("input",{type:"hidden",name:"email",value:e?.value},"email")}):(0,r.jsx)(j.i,{name:"email",label:e,form:t,disabled:m})};var I=a(42154),O=a(31961),y=a(74834);let v="checkout.pageData.input_field_placeholders",D=()=>{let e=(0,l.xW)(),t=(0,p.t)(),a=t.formatMessage(`${v}.firstname`),s=t.formatMessage(`${v}.lastname`),i=(0,l.FH)({name:"birthday"}),o=(0,y.s)({birthday:i,intl:t});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(j.i,{name:"firstname",label:a,form:e,autoFocus:!0}),(0,r.jsx)(j.i,{name:"lastname",label:s,form:e}),(0,r.jsx)(I.U,{name:"birthday",label:t.formatMessage(`${v}.birthday`),form:e}),o&&(0,r.jsx)("p",{className:"body-14-light",children:o.message}),(0,r.jsx)(O.o,{name:"phone",label:t.formatMessage(`${v}.phone`),placeholder:t.formatMessage(`${v}.phone_number_format`),form:e}),(0,r.jsx)("p",{className:"body-14-light",children:t.formatMessage("checkout.pageData.registration_phone_helper_text",{defaultMessage:"Wir nutzen deine Mobilnummer f\xfcr wichtige Updates zu deinem Auto-Abo (bspw. Lieferank\xfcndigungen)."})})]})};var F=a(96073),T=a(34457),R=a(46879),P=a(86461),$=a(45371),G=a(67371),V=a(96971),B=a(86103),U=a(83671),K=a(52817),H=a(5216),q=a(57392),Y=a(36631),W=a(38039);let z=({withResetLink:e})=>{let t=(0,l.xW)(),a=(0,p.t)(),r=(0,M.i)(e=>e.magicLinkSentCount),s=(0,M.i)(e=>e.setMagicLinkSentCount),i=(0,M.i)(e=>e.setLoginScreen),o=(0,g.i)(e=>e.track);return(0,n.useCallback)(async()=>
1{if((0,W.S)())return;let n=t.getValues(),l=(0,C.K)(),c="";c=window.location.href.includes("authv2")?"/":window.location.href,await B.A.post("/api/auth/custom/magicLink",{email:n.email,nextUrl:c,origin:window.location.origin,isApp:l,withResetLink:e}),i(e?M.a.forgotPasswordSuccess:M.a.magicLinkSuccess),l||sessionStorage.setItem("magicLinkSent","yes"),r&&(0,Y.P0)({status:"success",description:a.formatMessage("userAccount.magicLinkModal.sent.resentToast")}),o(r?e?h.fC.FORGOT_PASSWORD_FORM_RE_SUBMITTED:h.fC.MAGIC_LINK_FORM_RE_SUBMITTED:e?h.fC.FORGOT_PASSWORD_FORM_SUBMITTED:h.fC.MAGIC_LINK_FORM_SUBMITTED,{additionalProps:{values:n,retryCount:r}}),s(r+1)},[t,a,r,i,s,e])};var J=a(32133),Q=a(28461),Z=a.n(Q),X=a(72061),ee=a(63537),et=a(82382),ea=a(58593);let er=({label:e})=>{let t=(0,M.i)(e=>e.loginScreen),a=(0,M.i)(e=>e.serverErrorCode),s=(0,M.i)(e=>e.setLoginScreen),i=t===M.a.registrationForm,o=!i,u=(0,l.xW)(),d=(0,p.t)(),[m,f]=(0,n.useState)(o),[_,C]=(0,n.useState)(!1),[b,k]=(0,n.useState)(!1),E=u.watch("password"),x=(0,g.i)(e=>e.track),S=(0,n.useCallback)(e=>{x(h.fC.CTA_CLICKED,{location:"Forgot Password",additionalProps:{authenticationMethod:"email",...e||{}}})},[x]),L=(0,n.useCallback)(()=>{m||f(!0)},[m]);(0,n.useEffect)(()=>{E?.length?k(!0):k(!1)},[E]),(0,n.useEffect)(()=>{a&&!i&&k(!1)},[a,i]);let A=(0,n.useCallback)(()=>{C(!_)},[_]),w=(0,n.useCallback)(()=>{S({source:"unified-login"}),s(M.a.forgotPasswordForm)},[s,S]);return(0,r.jsx)("div",{className:"relative",children:(0,r.jsx)(l.xI,{control:u.control,name:"password",render:({field:t,fieldState:a})=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(et.y,{id:"password",label:d.formatMessage("userAccount.field.password"),enablePasswordStrengthCheck:m&&i,type:_?"text":"password",validationError:a?.error?.message,autoFocus:o,onFocus:L,...t}),b&&(0,r.jsx)(c.$,{variant:"icon",size:"sm",className:(0,ea.cn)("absolute top-3 right-2 border-transparent p-2","hover:bg-white hover:fill-black"),onClick:A,children:_?(0,r.jsx)(ee.E,{className:"min-w-5"}):(0,r.jsx)(X.N,{className:"min-w-5"})}),!i&&(0,r.jsx)(c.$,{variant:"action",size:"md",className:"pt-4",onClick:w,children:e})]})})})};var es=a(16184);let ei=()=>{let e=(0,p.t)(),t=(0,M.i)(e=>e.setLoginScreen),a=(0,g.i)(e=>e.track),s=e.formatMessage("userAccount.button.magicLink");return(0,r.jsxs)(c.$,{onClick:()=>{a(h.fC.LOGIN_METHOD_CLICKED,{additionalProps:{loginMethod:"MagicLink",method:"magic_link"}}),sessionStorage.setItem("finn_login_method","magic_link"),t(M.a.magicLinkForm)},variant:"outline",className:"border-pewter hover:bg-snow w-full hover:fill-black hover:text-black",children:[(0,r.jsx)(es.N,{className:"mr-2"}),(0,r.jsx)("span",{className:"body-14-semibold",children:s})]})};var eo=a(34113),en=a(765),el=a(43574),ec=a(79748),eu=a(68338),ed=a(94251);let em=({method:e})=>{switch(e){case"Google":return(0,r.jsx)(ed.z,{width:24,height:24});case"Apple":return(0,r.jsx)(eu.e,{width:24,height:24});default:return null}},eg=({method:e})=>{let t=(0,p.t)(),[a,s]=(0,n.useState)(!1),i=(0,ec.usePathname)(),o=(0,g.i)(e=>e.track),l=(0,C.K)();(0,n.useEffect)(()=>{let e=(0,eo.c)();e&&(e.stopLoading=()=>{a&&s(!1)})},[a]);let u=t.formatMessage(`userAccount.button.${e}`);return(0,r.jsxs)(c.$,{loading:a,onClick:()=>{(t=>{if(s(!0),l){let e=(0,eo.c)(),a=e?.getTrackingProps().app_version,r=!!a&&(0,el.Z)(a,"1.47.0")>=0;if(a&&(0,el.Z)(a,"1.48.0")>=0)e?.sendMessageToApp({type:"event:native_social_login",value:t});else if(r){let e=i?.includes("/checkout/")?i:"account";window.location.assign(`/mobile/loginredirect?method=${t}&deepLink=${e}`),s(!1)}else window.location.assign(`/mobile/loginredirect?method=${t}&deepLink=${i?.includes("/mobile/checkout/")?i.replace("/mobile/checkout/","").replace("?undefined=",""):"subscribe"}#appkey=/b2b`),s(!1)}else{let t="Google"===e?q.g$.GOOGLE:q.g$.APPLE,a=`${window.location.pathname}${window.location.search}`;(0,K.l3)(t,a).then(()=>{setTimeout(()=>{s(!1)},3e3)}).catch(t=>{sessionStorage.removeItem("finn_login_method"),o(h.fC.LOGIN_FAILED,{additionalProps:{method:e.toLowerCase(),error_type:t instanceof Error?t.message:"sign_in_rejected"}}),s(!1)})}o(h.fC.LOGIN_METHOD_CLICKED,{additionalProps:{loginMethod:t,method:e.toLowerCase()}}),(0,G.sx)("Account Logged In",{loginMethod:t}),sessionStorage.setItem("finn_login_method",e.toLowerCase()),(0,en.q2)(en.cY.IMPERSONATION_ACTIVE,null)})(e)},variant:"outline",className:"border-pewter hover:bg-snow w-full hover:fill-black hover:text-black",children:[(0,r.jsx)("span",{className:"mt-1 mr-2 inline-block",children:(0,r.jsx)(em,{method:e})}),(0,r.jsx)("span",{className:"body-14-semibold",children:u})]})},eh=["Google","Apple"],ef=({socialButtonSeparator:e,hideSocialLogin:t})=>(0,r.jsxs)("div",{className:"mt-2",children:[!t&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"finn-social-button-separator body-16-light mb-6 text-center",children:e}),eh.map(e=>(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(eg,{method:e})},e))]}),(0,r.jsx)(ei,{})]}),ep=()=>{let e=(0,p.t)(),t=e.formatMessage("userAccount.registration.alreadyHaveAccount"),a=e.formatMessage("userAccount.login.subtitle"),s=(0,M.i)(e=>e.loginScreen),i=(0,M.i)(e=>e.setLoginScreen);return s===M.a.registrationForm?(0,r.jsxs)("div",{className:"mt-1 inline-flex items-center gap-2",children:[(0,r.jsx)("div",{className:"body-16-light",children:t}),(0,r.jsx)(c.$,{size:"lg",variant:"action","data-testid":"switch-to-login",onClick:()=>{i(M.a.emailCheckForm)},children:a})]}):null},e_=({loginHeaderComponent:e,isLoadingRestore:t,isAttemptingDirectCheckout:a,cartURL:s,hideSocialLogin:i,createLead:o,setExtendedAccountInProgress:k,extendedAccountInProgress:S})=>{let L=(0,p.t)();(()=>{let[e]=(0,q.wV)(),t=(0,M.i)(e=>e.loginScreen),a=(0,g.i)(e=>e.track);(0,n.useEffect)(()=>
1{if(null===e)switch(t){case M.a.emailCheckForm:a(h.fC.LOGIN_OPTION_FORM_OPENED,{once:!0});break;case M.a.loginForm:a(h.fC.LOGIN_FORM_OPENED,{});break;case M.a.magicLinkForm:a(h.fC.MAGIC_LINK_FORM_OPENED,{});break;case M.a.magicLinkSuccess:a(h.fC.MAGIC_LINK_SUCCESS_FORM_OPENED,{});break;case M.a.registrationForm:a(h.fC.REGISTER_FORM_OPENED,{});break;case M.a.completeRegistration:a(h.fC.COMPLETE_REGISTRATION_FORM_OPENED,{});break;case M.a.forgotPasswordForm:a(h.fC.FORGOT_PASSWORD_FORM_OPENED,{});break;case M.a.forgotPasswordSuccess:a(h.fC.FORGOT_PASSWORD_SUCCESS_FORM_OPENED,{})}},[t,a,e])})();let{isDE:j}=(0,_.n)(),I=(0,M.i)(e=>e.loginScreen),O=(0,M.i)(e=>e.setLoginScreen),y=(0,M.i)(e=>e.hasBusinessAccount),v=(0,M.i)(e=>e.magicLinkSentCount),Y=(0,M.i)(e=>e.serverErrorCode),W=(0,M.i)(e=>e.setHasBusinessAccount),Q=(0,M.i)(e=>e.sessionEmail),X=(0,g.i)(e=>e.track),ee=(0,g.i)(e=>e.resetTrackedCount),et=L.formatMessage("checkout.pageData.registration_subscription_checkbox_text",{defaultMessage:"Sieh neue Autos zuerst, erfahre von Aktionen und Rabatten und erhalte Erinnerungen an deine Bestellung – per E-Mail oder Textnachricht. Du kannst dich jederzeit abmelden."}),ea=v>=3&&[M.a.magicLinkSuccess,M.a.forgotPasswordSuccess].includes(I),es=(0,l.xW)(),ei=(({createLead:e,setExtendedAccountInProgress:t})=>{let a,r,s,i,o=(0,M.i)(e=>e.loginScreen),c=(a=(0,M.i)(e=>e.setLoginScreen),r=(0,M.i)(e=>e.setFormValues),s=(0,l.xW)(),i=(0,g.i)(e=>e.track),(0,n.useCallback)(async()=>{let e=s?.getValues("email");r(s?.getValues()||{}),i(h.fC.LOGIN_METHOD_CLICKED,{additionalProps:{loginMethod:"Email",method:"password"}}),sessionStorage.setItem("finn_login_method","email");let{success:t}=await (0,U.H)({email:e.toLowerCase()},{},null);t?a(M.a.loginForm):a(M.a.registrationForm)},[s,r,a,i])),u=(()=>{let{isUSA:e}=(0,_.n)(),t=(0,g.i)(e=>e.track),a=(0,n.useCallback)(e=>{t(h.fC.CTA_CLICKED,{location:"login",additionalProps:{authenticationMethod:"email",...e||{}}})},[t]),r=(0,n.useCallback)((e="",a)=>{t(h.fC.ACCOUNT_LOGIN_FAILED,{additionalProps:{authenticationMethod:"email",error:e,...a||{}}})},[t]),s=(0,l.xW)(),i=(0,M.i)(e=>e.setServerErrorCode),o=(0,M.i)(e=>e.setFormValues),c=(0,M.i)(e=>e.setSubmittedLogin),u=(0,d.Hl)(),f=(0,d.t6)();return(0,n.useCallback)(async()=>{o(s?.getValues()||{});let e=s?.getValues("email")||"",n=s?.getValues("password")||"";i(null),a({source:"unified-login"}),c(!0);let l=await (0,K.iD)(e,n);if(l.ok){let e=await (0,q.Ht)();t(h.fC.LOGIN_SUCCEEDED,{additionalProps:{method:"email"}}),sessionStorage.removeItem("finn_login_method"),!e?.user?.is_job_auto&&(0,E.CW)()?f(m.t.JOB_AUTO_AUTH_FAILED):u(m.t.LOGIN),e&&((0,G.sx)("Account Logged In",{contact_id:e.user.hs_contact_id||"",origin:"checkout",loginMethod:"email"}),await (0,H.Q)({session:e}))}else r(l.error??"Login error",{source:"unified-login"}),t(h.fC.LOGIN_FAILED,{additionalProps:{method:"email",error_type:l.error??"unknown"}}),i(l.error);c(!1)},[f,o,s,i,a,c,e,t,r])})(),p=(({createLead:e,setExtendedAccountInProgress:t})=>{let{locale:a}=(0,_.n)(),r=(0,l.xW)(),s=(0,M.i)(e=>e.setServerErrorCode),i=(0,M.i)(e=>e.setFormValues),o=(0,n.useCallback)(e=>{(0,R._J)(h.fC.REGISTER_CTA_CLICKED,{authenticationMethod:"email",...e||{}})},[]),c=(0,n.useCallback)((e="",t)=>{(0,R._J)(h.fC.ACCOUNT_CREATION_FAILED,{authenticationMethod:"email",error:e,...t||{}})},[]),u=(0,g.i)(e=>e.track),p=(0,P.Y)(),C=p?.asPath.includes("cart"),b=(0,M.i)(e=>e.setSubmittedLogin),k=(0,d.Hl)(),x=(0,d.t6)();return(0,n.useCallback)(async()=>{i(r?.getValues()||{});let n=r?.getValues("email")||"",l=r?.getValues("password")||"",d=r?.getValues("firstname")||"",g=r?.getValues("lastname")||"",p=r?.getValues("phone")||"",_=r?.getValues("birthday")||"",S=r?.getValues("emailSubscription")||!1,L=!!(d&&g&&p&&_&&C);s(null),o({source:"embedded-login"}),L&&t?.(!0),b(!0);let A=await (0,f.e)();(0,V.Sp)(V.$K.REGISTRATION_DATA_SUBMITTED,n);let w=await (0,K.kz)(n,l,a,A,(0,V.ok)(V.$K.E2E_SECRET)||"",{firstname:d,lastname:g,phone:p,birthday:(0,J.EB)(Z()(_)?.toDate())?.getTime()?.toString(),emailSubscription:S});if(w.ok){let a=await (0,q.Ht)();if(u(h.fC.LOGIN_SUCCEEDED,{additionalProps:{method:"email"}}),sessionStorage.removeItem("finn_login_method"),L)try{await e?.(r?.getValues())}catch{b(!1),t?.(!1)}!a?.user?.is_job_auto&&(0,E.CW)()?x(m.t.JOB_AUTO_AUTH_FAILED):k(m.t.LOGIN),(0,G.sx)("Account Created",{contact_id:"",origin:"checkout"}),await (0,H.Q)({session:a})}else c(w.error??"Registration error",{source:"embedded-login"}),u(h.fC.LOGIN_FAILED,{additionalProps:{method:"email",error_type:w.error??"unknown"}}),s(w.error);L||b(!1)},[x,i,r,C,s,o,b,a,t,e,c,k,u])})({createLead:e,setExtendedAccountInProgress:t}),C=(({createLead:e,setExtendedAccountInProgress:t})=>{let a=(0,l.xW)(),r=(0,M.i)(e=>e.setServerErrorCode),s=(0,M.i)(e=>e.setFormValues),i=(0,M.i)(e=>e.setLoginScreen),o=(0,M.i)(e=>e.setIsRegistrationIncomplete),c=(0,n.useCallback)(e=>{(0,R._J)(h.fC.CTA_CLICKED,{location:"registration-completion",...e||{}})},[]),u=(0,n.useCallback)((e="",t)=>{(0,R._J)(h.fC.REGISTRATION_DATA_UPDATE_FAILED,{location:"registration-completion",error:e,...t||{}})},[]),f=(0,g.i)(e=>e.track),p=(0,P.Y)(),_=p?.asPath.includes("cart"),C=(0,M.i)(e=>e.setSubmittedLogin),b=(0,d.Hl)();return(0,n.useCallback)(async()=>{let n=a?.getValues()||{};s(n);
1let{email:l,firstname:d="",lastname:g="",phone:p="",birthday:k="",emailSubscription:E=!1}=n,x=!!(d&&g&&p&&k&&_);r(null),c({source:"registration-completion"}),x&&t?.(!0),C(!0);try{if(await B.A.patch("/api/checkout/v2/contact",{firstname:d,lastname:g,phone:p,birthday:(0,T.po)(k,"DD.MM.YYYY"),emailSubscription:E},{headers:(0,$.Gb)()}),b(m.t.LOGIN),(0,G.sx)("Registration Data Completed",{contact_id:"",origin:"checkout"}),f(h.fC.LOGIN_SUCCEEDED,{additionalProps:{method:"email"}}),sessionStorage.removeItem("finn_login_method"),x)try{await e?.(n)}catch{C(!1),t?.(!1)}o(!1,""),i(M.a.loginForm),(0,V.Sp)(V.$K.REGISTRATION_DATA_SUBMITTED,l)}catch{u("ERROR",{source:"registration-completion"}),f(h.fC.LOGIN_FAILED,{additionalProps:{method:"email",error_type:"registration_completion_failed"}}),r("Registration data update failed")}x||C(!1)},[s,a,_,r,c,C,t,b,e,o,i,u,f])})({createLead:e,setExtendedAccountInProgress:t}),b=z({withResetLink:!1}),k=z({withResetLink:!0});switch(o){case M.a.completeRegistration:return C;case M.a.registrationForm:return p;case M.a.loginForm:return u;case M.a.magicLinkForm:case M.a.magicLinkSuccess:return b;case M.a.forgotPasswordForm:case M.a.forgotPasswordSuccess:return k;default:return c}})({createLead:o,setExtendedAccountInProgress:k,cartURL:s}),eo=(0,n.useCallback)(e=>{X(h.fC.FORM_VALIDATION_ERROR,{location:I,additionalProps:{error:e}})},[I,X]),en=(0,d.t6)(),el=es.watch("email");(0,n.useEffect)(()=>{W(el)},[el,W]),(0,n.useEffect)(()=>{y&&(X(h.fC.BUSINESS_ACCOUNT_DETECTED,{location:I}),en(m.t.BUSINESS_ACCOUNT_DETECTED))},[y,en]);let ec=(0,b.Q)({}),eu=I===M.a.emailCheckForm,ed=I===M.a.loginForm,em=I===M.a.registrationForm,eg=I===M.a.completeRegistration,eh=!!(ed||em),e_=[M.a.magicLinkForm,M.a.magicLinkSuccess,M.a.forgotPasswordForm,M.a.forgotPasswordSuccess].includes(I),eC=es.setValue;(0,n.useEffect)(()=>{Q&&eg&&eC("email",Q)},[eC,Q,eg]);let eb=(0,F.S)(),ek=window.location.href,eE=(0,C.K)()&&ek.includes("mobile/auth")&&!ek.includes("mobile/authv2");return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("form",{onSubmit:es.handleSubmit(ei,eo),"data-testid":"login-registration-form",className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{ref:ec,className:"flex flex-col gap-4",children:[e||(0,r.jsxs)("div",{className:"mb-4 flex flex-col gap-4",children:[(0,r.jsx)("h2",{className:"mobile-t4-semibold md:web-t4-semibold",children:eb.title}),!(0,E.CW)()&&(0,r.jsx)("p",{className:"body-16-light",children:eb.subtitle}),(0,r.jsx)(x,{})]}),(0,r.jsx)(N,{label:eb.emailLabel}),(em||eg)&&(0,r.jsx)(D,{}),eh&&(0,r.jsx)(er,{label:eb.forgotPasswordLabel}),(em||eg)&&(0,r.jsx)("div",{className:"[&_a]:!text-black [&_a]:link-14 [&_a]:after:inline [&_a]:before:inline flex flex-col gap-4",children:(0,r.jsx)(u.L,{form:es,name:"emailSubscription",children:et})}),(em||eg)&&(0,r.jsx)(f.a,{})]}),Y&&(0,r.jsx)("p",{className:"text-red body-14-light m-0",children:eb.errorMessage}),!ea&&(0,r.jsx)(c.$,{"data-cy":"submit",loading:es.formState.isSubmitting||t||a||S,className:"w-full sm:min-w-44",size:"lg",type:"submit",onClick:()=>{ee(),X(h.fC.CTA_CLICKED,{location:I})},children:eb.buttonLabel??L.formatMessage("checkout.pageData.next_step_button")})]}),e_&&(0,r.jsx)(c.$,{variant:"outline",className:"w-full",disabled:es.formState.isSubmitting,onClick:()=>{ee(),X(h.fC.CTA_CLICKED,{location:I,additionalProps:{cta_type:"secondary"}}),O(M.a.emailCheckForm)},children:eb.backButtonLabel}),(0,r.jsx)(ep,{}),eu&&!eE&&j&&(0,r.jsx)(ef,{socialButtonSeparator:eb.socialButtonSeparator,cartURL:s,hideSocialLogin:i})]}),(0,r.jsx)(d.Bs,{modalKey:m.t.BUSINESS_ACCOUNT_DETECTED,email:el,ModalComponent:w}),(0,r.jsx)(d.Bs,{modalKey:m.t.JOB_AUTO_AUTH_FAILED,ModalComponent:A})]})};var eC=a(81068),eb=a(90515),ek=a(59770),eE=a(8415);let ex=eE.Ik().shape({email:eE.Yj().email("yup.email").required("yup.required")}),eS=eE.Ik().shape({email:eE.Yj().email("yup.email").required("yup.required"),password:eE.Yj().required("yup.required")}),eL=({loginHeaderComponent:e,isLoadingRestore:t,isAttemptingDirectCheckout:a,vehiclePower:c,cartURL:u,hideSocialLogin:d,createLead:m,setExtendedAccountInProgress:g,extendedAccountInProgress:h})=>{let f=(0,M.i)(e=>e.loginScreen),p=(0,M.i)(e=>e.setLoginScreen),_=(0,M.i)(e=>e.formValues),C=(0,M.i)(e=>e.setFormValues),b=(0,M.i)(e=>e.setServerErrorCode),k=f!==M.a.completeRegistration&&(0,s.t8)(window.location.search)?(0,s.Du)(window.location.search)?M.a.magicLink
1Form:M.a.emailCheckForm:null,E=(0,n.useRef)(f===M.a.completeRegistration);(0,n.useEffect)(()=>{k&&!E.current&&(E.current=!0,f!==k&&p(k))},[k,f,p]);let x=(0,l.mN)({mode:"onChange",resolver:(0,o.t)(((e,t)=>{let a=!!t&&t>ek.eh;switch(e){case M.a.registrationForm:return eE.Ik().shape({email:eE.Yj().email("yup.email").required("yup.required"),password:eE.Yj().matches(eC.jk,{message:"yup.validPassword",excludeEmptyString:!0}).required("yup.required"),firstname:eE.Yj().matches(eb.$p,{message:"yup.string",excludeEmptyString:!0}).nullable().required("yup.required"),lastname:eE.Yj().matches(eb.$p,{message:"yup.string",excludeEmptyString:!0}).nullable().required("yup.required"),phone:(0,eb.BH)("phoneNumber"),birthday:eE.p6().test("Valid date","yup.validDate",e=>Z()(e).isValid()).test("DOB",a?"yup.age>=23":"yup.age>=20",e=>{let t=a?ek.Ak.MIN_NORMAL:ek.Ak.MIN_EXCEPTIONAL;return Z()().diff(e,"year")>=t}).nullable().required("yup.required")});case M.a.completeRegistration:return eE.Ik().shape({firstname:eE.Yj().matches(eb.$p,{message:"yup.string",excludeEmptyString:!0}).nullable().required("yup.required"),lastname:eE.Yj().matches(eb.$p,{message:"yup.string",excludeEmptyString:!0}).nullable().required("yup.required"),phone:(0,eb.BH)("phoneNumber"),birthday:eE.p6().test("Valid date","yup.validDate",e=>Z()(e).isValid()).test("DOB",a?"yup.age>=23":"yup.age>=20",e=>{let t=a?ek.Ak.MIN_NORMAL:ek.Ak.MIN_EXCEPTIONAL;return Z()().diff(e,"year")>=t}).nullable().required("yup.required")});case M.a.loginForm:return eS;default:return ex}})(f,c??null)),defaultValues:_});return((0,i.C)(x,f),(0,n.useEffect)(()=>()=>{C(x?.getValues()||{}),b(null)},[x,C,b]),!E.current&&k&&f!==k)?null:(0,r.jsx)(l.Op,{...x,children:(0,r.jsx)(e_,{loginHeaderComponent:e,isLoadingRestore:t,isAttemptingDirectCheckout:a,cartURL:u,hideSocialLogin:d,createLead:m,setExtendedAccountInProgress:g,extendedAccountInProgress:h})})}},81068:(e,t,a)=>{a.d(t,{DT:()=>s,Oj:()=>o,jk:()=>i});let r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,s=e=>r.test(String(e).toLowerCase()),i=/^(?=.*\d)(?=.*[a-zA-Z]).{8,}$/,o=e=>i.test(e)},82382:(e,t,a)=>{a.d(t,{y:()=>d});var r=a(54568),s=a(21975),i=a(51744),o=a(36742),n=a(18844),l=a(96753),c=a(58593);let u=({value:e})=>{let t=e??"",a=(0,i.t)(),s=[{message:a.formatMessage("userAccount.passwordStrength.min8"),validation:e=>e.length>7},{message:a.formatMessage("userAccount.passwordStrength.containLetter"),validation:e=>/[a-zA-Z]/g.test(e)},{message:a.formatMessage("userAccount.passwordStrength.containNumber"),validation:e=>/\d/g.test(e)}];return(0,r.jsx)("div",{className:"mt-4",children:s.map(e=>{let a=e.validation(t);return(0,r.jsxs)("div",{className:"mb-2 flex items-center",children:[a?(0,r.jsx)(n.h,{}):(0,r.jsx)(l.l,{className:"fill-pearl"}),(0,r.jsx)("p",{className:(0,c.cn)("body-14-regular ml-2 text-black"),children:e.message})]},e.message)})})},d=e=>{let t=(0,i.t)(),{inputRef:a,enablePasswordStrengthCheck:n,validationError:l,...c}=e,d=(0,o.Q)({}),m="string"==typeof l?l:"";return(0,r.jsxs)("div",{ref:d,children:[(0,r.jsx)(s.p,{type:"password",autoComplete:"off",ref:a,error:m?t.formatMessage(m):"",...c},"password"),n&&(0,r.jsx)(u,{value:c.value})]})}},82421:(e,t,a)=>{a.d(t,{z:()=>n});var r=a(54568),s=a(60233),i=a(51896),o=a(76841);let n=({open:e,onClose:t,className:a,cartURL:n,onCloseCallback:l,fullScreen:c=!1})=>{let u=(0,i.U)("sm");return(0,r.jsx)(s.aF,{variant:u&&c?"large":"small",open:e,onOpenChange:e=>{e||t(),e||l?.()},children:(0,r.jsx)(s.$m,{children:(0,r.jsx)("div",{className:a,children:(0,r.jsx)(o.a,{cartURL:n})})})})}},96073:(e,t,a)=>{a.d(t,{S:()=>l});var r=a(51744),s=a(86461),i=a(42584),o=a(43752);let n=new Set(["wrong_password","user_does_not_exist","user_already_exists","invalid_domain"]),l=()=>{let e=(0,r.t)(),t=(0,s.Y)(),a=(0,o.i)(e=>e.serverErrorCode),l=(0,o.i)(e=>e.loginScreen),c=(0,i.xW)(),u=t?.asPath?.includes("cart"),d=e.formatMessage((e=>{switch(e){case o.a.loginForm:return"checkout.loginTitle";case o.a.registrationForm:return"userAccount.loginScreen.registrationTitle";
1case o.a.magicLinkForm:return"userAccount.magicLinkModal.title";case o.a.magicLinkSuccess:return"userAccount.magicLinkModal.sent.title";case o.a.forgotPasswordForm:return"userAccount.resetPassword.title";case o.a.forgotPasswordSuccess:return"userAccount.resetPassword.successTitle";case o.a.completeRegistration:return"userAccount.completeRegistration.title";default:return"userAccount.loginScreen.initialTitle"}})(l)),m=e.formatMessage(((e,t)=>{switch(e){case o.a.loginForm:return"userAccount.login.description";case o.a.registrationForm:return`userAccount.loginScreen.registrationSubtitle${t?"Checkout":""}`;case o.a.magicLinkForm:return"userAccount.magicLinkModal.description";case o.a.magicLinkSuccess:return"userAccount.magicLinkModal.sent.description";case o.a.forgotPasswordForm:return"userAccount.resetPassword.description";case o.a.forgotPasswordSuccess:return"userAccount.resetPassword.successDescription";case o.a.completeRegistration:return"userAccount.completeRegistration.description";default:return`userAccount.loginScreen.initialSubtitle${t?"Checkout":""}`}})(l,u),{email:c.getValues("email")}),g=e.formatMessage((e=>{switch(e){case o.a.loginForm:return"userAccount.button.loginNow";case o.a.registrationForm:return"userAccount.button.signUpNow";case o.a.magicLinkForm:return"userAccount.magicLinkModal.ctaLabel";case o.a.magicLinkSuccess:return"userAccount.magicLinkModal.sent.ctaLabel";case o.a.forgotPasswordForm:return"userAccount.resetPassword.ctaLabel";case o.a.forgotPasswordSuccess:return"userAccount.magicLinkModal.sent.ctaLabel";case o.a.completeRegistration:return"userAccount.completeRegistration.ctaLabel";default:return"userAccount.button.initialCta"}})(l)),h=e.formatMessage("userAccount.serverErrors.generalError");a&&n.has(a)&&(h=e.formatMessage(`userAccount.serverErrors.${a}`));let f=e.formatMessage("userAccount.link.forgetPassword"),p=e.formatMessage("userAccount.field.email");return{title:d,subtitle:m,buttonLabel:g,errorMessage:h,emailLabel:p,forgotPasswordLabel:f,socialButtonSeparator:e.formatMessage("userAccount.login.socialButtonSeparator"),backButtonLabel:e.formatMessage("userAccount.magicLinkModal.backButtonLabel")}}}}]);

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.