PageSourceSearch

https://www.aurlom.com/assets/MesInformations-BjKQZPSA.js

js aurlom.com collected 2026-10-07 23:06:12 UTC 3,701 bytes, 1 lines download raw bytes

1import{r as l,j as s}from"./vendor-react-Ca1Y_V7A.js";import{C as y}from"./CompteLayout-5BGLlb2y.js";import{e as C,s as f,n as S,t as N}from"./index-BfnJTNAL.js";import"./log-out-C0YwZZcg.js";function L(){const{user:t}=C(),[d,c]=l.useState(!0),[i,m]=l.useState(!1),[u,x]=l.useState(""),[p,g]=l.useState(""),[b,h]=l.useState(""),[j,v]=l.useState(""),[a,o]=l.useState({});l.useEffect(()=>{t&&(async()=>{const{data:e}=await f.from("ec_profiles").select("first_name, last_name, email, phone, billing_address").eq("user_id",t.id).maybeSingle(),r=t.user_metadata??{};x((e==null?void 0:e.first_name)??r.first_name??""),g((e==null?void 0:e.last_name)??r.last_name??""),h((e==null?void 0:e.email)??t.email??""),v((e==null?void 0:e.phone)??""),o((e==null?void 0:e.billing_address)??{}),c(!1)})()},[t]);const _=async e=>{if(e.preventDefault(),!!t){m(!0);try{const{error:r}=await f.from("ec_profiles").upsert([{user_id:t.id,first_name:u.trim()||null,last_name:p.trim()||null,email:b.trim()||null,phone:j.trim()||null,billing_address:a}],{onConflict:"user_id"});if(r)throw r;await f.auth.updateUser({data:{first_name:u.trim(),last_name:p.trim()}}),N({title:"Informations enregistrées"})}catch(r){N({title:"Enregistrement impossible",description:r instanceof Error?r.message:"Réessayez dans un instant.",variant:"destructive"})}finally{m(!1)}}};return s.jsx(y,{kicker:"Mon profil",title:"Mes informations",children:d?s.jsx("p",{className:"text-sm text-muted-foreground",children:"Chargement…"}):s.jsxs("form",{onSubmit:_,className:"max-w-2xl space-y-8",children:[s.jsxs("section",{className:"border border-border/60 rounded-xl p-6 bg-muted/20",children:[s.jsx("p",{className:"font-poppins font-bold text-foreground",children:"Identité et coordonnées"}),s.jsxs("div",{className:"mt-5 grid sm:grid-cols-2 gap-4",children:[s.jsx(n,{label:"Prénom",value:u,onChange:x}),s.jsx(n,{label:"Nom",value:p,onChange:g}),s.jsx(n,{label:"Email de contact",type:"email",value:b,onChange:h}),s.jsx(n,{label:"Téléphone",value:j,onChange:v})]}),s.jsxs("p",{className:"mt-4 text-xs text-muted-foreground",children:["Votre identifiant de connexion reste ",t==null?void 0:t.email,"."]})]}),s.jsxs("section",{className:"border border-border/60 rounded-xl p-6 bg-muted/20",children:[s.jsx("p",{className:"font-poppins font-bold text-foreground",children:"Adresse de facturation"}),s.jsxs("div",{className:"mt-5 grid sm:grid-cols-2 gap-4",children:[s.jsx("div",{className:"sm:col-span-2",children:s.jsx(n,{label:"Adresse",value:a.ligne1??"",onChange:e=>o({...a,ligne1:e})})}),s.jsx("div",{className:"sm:col-span-2",children:s.jsx(n,{label:"Complément d'adresse",value:a.ligne2??"",onChange:e=>o({...a,ligne2:e})})}),s.jsx(n,{label:"Code postal",value:a.code_postal??"",onChange:e=>o({...a,code_postal:e})}),s.jsx(n,{label:"Ville",value:a.ville??"",onChange:e=>o({...a,ville:e})}),s.jsx(n,{label:"Pays",value:a.pays??"",onChange:e=>o({...a,pays:e})})]})]}),s.jsxs("button",{type:"submit",disabled:i,className:"inline-flex items-center justify-center h-12 px-8 rounded-full bg-primary text-primary-foreground font-poppins font-bold text-sm uppercase tracking-wider hover:opacity-90 transition disabled:opacity-50",children:[i&&s.jsx(S,{className:"w-4 h-4 mr-2 animate-spin"}),"Enregistrer"]})]})})}function n({label:t,value:d,onChange:c,type:i="text"}){return s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"text-[11px] uppercase tracking-widest text-muted-foreground",children:t}),s.jsx("input",{type:i,value:d,onChange:m=>c(m.target.value),className:"mt-2 w-full h-11 px-4 rounded-lg border border-border bg-background text-sm focus:outline-none focus:border-foreground transition"})]})}export{L 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.