1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7417],{46359:(e,s,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/complete-profile",function(){return t(74366)}])},74366:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>y});var i=t(6029),l=t(37890),r=t(81278),a=t(55729),n=t(1909),o=t(52789),c=t(96930),m=t(64713),u=t(58718),d=t(56061),f=t(65403),p=t(73492),v=t(1660),N=t(31078);let x=N.z.object({isProfessional:N.z.boolean(),firstName:N.z.string().min(2,"Veuillez entrer un pr\xe9nom valide").max(64,"Veuillez entrer un pr\xe9nom valide"),lastName:N.z.string().min(2,"Veuillez entrer un nom valide").max(64,"Veuillez entrer un nom valide"),siret:p.xmH.optional(),vat:p.z27.optional(),businessName:N.z.string().optional(),country:N.z.string().optional(),acceptedTerms:N.z.boolean().refine(e=>e,"Veuillez accepter les conditions d'utilisation")}).superRefine((e,s)=>{e.isProfessional&&!e.country&&s.addIssue({code:N.z.ZodIssueCode.custom,message:"Veuillez s\xe9lectionner un pays",path:["country"]}),(0,p.juA)(s,e.vat,e.siret)}),h={firstName:"",lastName:"",isProfessional:!1,businessName:void 0,siret:void 0,vat:void 0,country:void 0,acceptedTerms:!1};var g=t(43685),b=t(35829);let j=()=>{var e;let{user:s,isLoading:t,isAuthenticated:N}=(0,l.u)(),j=(0,r.useRouter)(),{mutateAsync:y,isPending:V,error:z}=(0,p.ZTT)(),w=j.query[b.cd],_="string"==typeof w&&(0,b.XE)(w)?w:"/",[C,E]=(0,a.useState)(!0),[P,T]=(0,a.useState)(!0),S=(0,n.mN)({resolver:(0,o.u)(x),defaultValues:h}),k=S.watch("isProfessional");(0,a.useEffect)(()=>{if(j.isReady&&!t){if(!N)return void j.replace(_);(null==s?void 0:s.profileComplete)&&(async()=>{await (0,v.Y_)("store").catch(()=>void 0),j.replace(_)})()}},[N,t,j,null==s?void 0:s.profileComplete,_]),(0,a.useEffect)(()=>{if(s){var e,t;S.reset({...h,firstName:null!=(e=s.firstName)?e:"",lastName:null!=(t=s.lastName)?t:""})}},[s,S]),(0,a.useEffect)(()=>{k||(S.setValue("vat",void 0),S.setValue("siret",void 0))},[k,S]);let A=async e=>{await y(e),await (0,v.Y_)("store").catch(()=>void 0),j.replace(_)};return t||!N||!s||s.profileComplete?(0,i.jsx)("div",{className:"flex min-h-screen items-center justify-center",children:(0,i.jsx)(c.R,{})}):(0,i.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-gray-50 px-4 py-12",children:(0,i.jsxs)("div",{className:"w-full max-w-lg rounded-2xl bg-white p-8 shadow-lg",children:[(0,i.jsx)("div",{className:"mb-8 flex flex-col items-center gap-4",children:(0,i.jsxs)("div",{className:"text-center",children:[(0,i.jsx)("h1",{className:"text-2xl font-bold",children:"Compl\xe9tez votre profil"}),(0,i.jsx)("p",{className:"mt-2 text-gray-500",children:(null==s?void 0:s.firstName)||(null==s?void 0:s.lastName)?"Vos informations ont \xe9t\xe9 pr\xe9-remplies. Vous pouvez les modifier.":"Veuillez renseigner vos informations pour continuer."})]})}),(0,i.jsx)(m.lV,{...S,children:(0,i.jsxs)("form",{onSubmit:S.handleSubmit(A),className:"space-y-6",children:[(0,i.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,i.jsx)(u.Z,{control:S.control,name:"firstName",label:"Pr\xe9nom",placeholder:"Pr\xe9nom",maxLength:64}),(0,i.jsx)(u.Z,{control:S.control,name:"lastName",label:"Nom",placeholder:"Nom",maxLength:64})]}
1),(0,i.jsx)(g.QT,{control:S.control,name:"isProfessional",hasError:!!S.getFieldState("isProfessional").error}),k&&(0,i.jsx)(g.HI,{control:S.control,setValue:S.setValue,siretName:"siret",vatName:"vat",businessNameName:"businessName",countryName:"country",isSiretVisible:P,isVATVisible:C,onSiretVisibilityChange:T,onVATVisibilityChange:E}),(0,i.jsx)(d.c,{control:S.control,name:"acceptedTerms",checkboxClassNames:S.getFieldState("acceptedTerms").error?"ring-destructive rounded-[5px] ring-1":void 0,labelContent:(0,i.jsx)(g.Ag,{isProfessional:k})}),z&&(0,i.jsx)("p",{className:"text-center text-red-600",children:null!=(e=z.message)?e:"Une erreur est survenue"}),(0,i.jsx)(f.$,{type:"submit",variant:"blue",size:"lg",className:"w-full",disabled:V,children:V?"Enregistrement...":"Continuer"})]})})]})})};j.getLayout=e=>e;let y=j}},e=>{e.O(0,[636,6593,8792],()=>e(e.s=46359)),_N_E=e.O()}]); 2//# sourceMappingURL=complete-profile-f209605c51959db4.js.map
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.