1import{S as I,j as t}from"./constants-GDyudX3t.js";import{u as h,f as T,p as C,s as A,j as L,t as W,i as M,L as q,W as w,v as D}from"./Loading-BHGVJLob.js";import{e as G}from"./ProfileSettingsMenu-DaDsrYdI.js";import{e as O}from"./components-Bc5E3RVO.js";import{M as Q}from"./MessageBlockPage-CBkAjrPK.js";import{u as K}from"./useNavigate-CTVMBfrl.js";import{d as j,A as v}from"./events-BQwPjomh.js";import{B as y}from"./useDispatchEvent-Do1K-Pg_.js";import{S as z}from"./SomethingWentWrongPage-DkSdVLSE.js";import{R as H}from"./useErrorFallback-EdRkLSR6.js";import{a as k}from"./Modal-qO3GT9CY.js";import{S as N,u as J,a as X}from"./useSignUpInitialValues-BX88mok3.js";import"./context-CjJKLtB3.js";import"./index-CvHK6Ik1.js";import"./UnauthorizedError-BcFCC5_3.js";import"./Button-DbtDf4mr.js";import"./typeform-BpYVhgDr.js";import"./mapValues-BBMzutht.js";import"./InfoCircle-DYOqYoDc.js";import"./MessageBlock-CvMGuXYS.js";import"./useSanitizeContent-CDFxBEOV.js";import"./ErrorPage-BGys6pLO.js";import"./iframe-BsOo2mJb.js";import"./Button-BsH6922b.js";import"./react-error-boundary.esm-BZzaV6Wb.js";import"./auth-DNokco_n.js";import"./toDate-qOSwr3PX.js";import"./keyBy-4IgKLTcT.js";import"./useCountries-DGTnCjY-.js";import"./index-BjIhP61M.js";import"./PrivateApp-DfPBgT6e.js";import"./preload-helper-BXl3LOEh.js";import"./device-lyYMygEk.js";import"./CheckboxInput-NToUWx27.js";import"./Checkbox-Bw7kXoKQ.js";import"./CountryInput-BwIK_nbl.js";import"./SelectInput-DLTpGyP_.js";import"./Select-wtpkIEUA.js";import"./EyeOffIcon-D_DvxIrj.js";import"./CloseIcon-DjldikCm.js";import"./CalendarIcon-DZAVa8sk.js";import"./DatePickerInput-3d1zyCm2.js";import"./LocalizedFlatpickr-BNSXIZ-S.js";import"./date-CsP5szcg.js";import"./format-ZQFBQQKg.js";import"./defaultOptions-Bu1fQcF6.js";import"./differenceInCalendarDays-BNKawyq7.js";import"./startOfWeek-DNiSTQ3G.js";import"./en-US-BGXVOZEr.js";import"./match-DN4VZKeM.js";import"./buildMatchPatternFn-_eSDZv-o.js";import"./addMonths-DHijYAia.js";import"./GenderIDentityInput-B-Ib1u_H.js";import"./GenderInput-peqdDcOs.js";import"./LocaleInput-DyYnuvaA.js";import"./PhoneNumberInput-_lD9xR2Z.js";import"./index-DlTOfxrp.js";import"./TextInput-CpQbEpvr.js";import"./CalendarInput-B50MkZCx.js";import"./Calendar-CY9FeDbo.js";import"./isBefore-DuJnhAXP.js";import"./getDate-CLMDbDXq.js";import"./addDays-BlcGyyQp.js";import"./getMonth-CwBXqN0c.js";import"./PhoneNumberInput-CXz2oc8i.js";import"./InputLabel-D0vuoYUf.js";import"./TextInput-DmGyZRVJ.js";import"./consents-DKFfCfKr.js";import"./useConsentCallbackUrl-DIlsU6se.js";import"./locale-YyVcxY-c.js";const Y=({hiddenFields:i,disabledFields:n}={hiddenFields:[],disabledFields:[]})=>{const o=k(),s=o.use_gender_identity,a=o.identity_configuration.signup&&I.includes(o.identity_provider),e=o.profile.editable.includes("document_id"),m=o.allow_commercial_communications,r=["email","password","name","surname","birth_date","gender","country","phone","phone_prefix","locale","client_code"].filter(l=>!i.includes(l));s&&r.push("gender_identity"),a&&r.push("ssn"),m&&r.push("commercial_communications"),e&&r.push("document_id");const c=r.filter(l=>!n.includes(l));return{availableFields:r,editableFields:c}},ft=()=>{const{t:i}=h(),{enable_activation_sign_up_step:n,allow_create_clients:o}=k(),{type:s}=O(),[a]=T(),e=C(a.get("q")),m=K(),r=e.hidden_fields??[],c=A({relation_token:e.relation_token,email:e.email,name:e.name,surname:e.surname,gender:e.gender,gender_identity:e.gender_identity,country:e.country,locale:e.language||e.locale,client_code:e.client_code||e.document,phone:e.phone,phone_prefix:e.phone_prefix},Boolean),{availableConsents:l,isLoading:P,isError:E,error:F}=J(),U=X({prepopulatedValues:c,availableConsents:l}),{editableFields:B,availableFields:R}=Y({hiddenFields:r,disabledFields:Object.keys(c)}),{email:g,relation_token:u}=c,p=["beneficiary","invitation"].includes(s??""),S=n&&!p,x=L({queryKey:["validate-relation-token",g,u],queryFn:()=>D({email:g??"",token:u??""}),enabled:p&&!!g&&!!u}),_=G({mutationFn:W,onSuccess:f=>{_.reset();const d=M(f);S||j(v.USER_SIGN_UP_SUCCESS,{user:d,type:s}),j(v.PAGE_VIEW,{pageName:"signin:thanks",user:d}
1),m("/thanks",{state:{title:i("register.success.title"),message:i(S?"register.success.email_sent":"register.success.text"),iconName:"email",continueUrl:"/login",continueLabel:i("register.success.action")}})}}),V=(f,d)=>{_.mutate(f,{onError:()=>{d.setSubmitting(!1)}})};if(!o&&!p)return t.jsx(H,{url:"/404"});if(P||x.isLoading)return t.jsx(q,{});if(E)return t.jsx(z,{error:F});if(x.isError||p&&!u)return t.jsx(Q,{type:"error",title:i("register.error.invitation.title"),message:i("register.error.invitation.text")});const b={isInvitation:p,initialValues:U,editableFields:B,availableFields:R,availableConsents:l,handleSumbit:V,signupMutation:_};return t.jsx(w,{fallback:t.jsx(Z,{...b}),v3:t.jsx($,{...b})})},Z=({isInvitation:i,initialValues:n,editableFields:o,availableFields:s,availableConsents:a,handleSumbit:e,signupMutation:m})=>{const{t:r}=h();return t.jsx("div",{className:"o-form-block",children:t.jsxs("div",{className:"o-form-block__form",children:[!i&&t.jsx(y,{url:"/login"}),t.jsx(N,{title:r("register.title"),initialValues:n,editableFields:o,availableFields:s,availableConsents:a,onSubmit:e,error:m.error})]})})},$=({isInvitation:i,initialValues:n,editableFields:o,availableFields:s,availableConsents:a,handleSumbit:e,signupMutation:m})=>{const{t:r}=h();return t.jsx("div",{className:"l-register",children:t.jsxs("main",{className:"l-register__container",children:[!i&&t.jsx("div",{className:"l-register__back h-d-none h-d-md-block",children:t.jsx(y,{url:"/login"})}),t.jsx("div",{className:"l-register__card",children:t.jsx(N,{title:r("register.title"),initialValues:n,editableFields:o,availableFields:s,availableConsents:a,onSubmit:e,error:m.error})})]})})};export{Z as V2SignUpSection,$ as V3SignUpSection,ft as default};
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.