PageSourceSearch

https://www.karispizza.fi/assets/ProfilePage-519a60ee.js

js karispizza.fi collected 2026-09-25 12:14:58 UTC 8,085 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-radix-0e72cabc.js";import{u as s,r as a}from"./vendor-react-9016e4a2.js";import{M as r,x as t,w as i,B as l,z as n,A as c,C as d,E as o,L as m,I as x,O as h,Q as g,S as p}from"./index-31192add.js";import{g as u,a as j,u as N,b as f}from"./customerProfileService-bda51590.js";import{t as b,I as v,u as y,J as w,K as k,N as C,O as _,Q as S,V as O,Y as L,_ as A,d as z}from"./vendor-icons-e8b10069.js";import"./vendor-supabase-36eb0853.js";import"./vendor-capacitor-43d743f6.js";import"./vendor-motion-a26fe6c4.js";function I(){const p=s(),{user:z,signOut:I}=r(),{toast:F}=t(),{t:K}=i(),[M,$]=a.useState(!0),[D,U]=a.useState({full_name:"",phone:"",email:""}),[Q,B]=a.useState(!1),[J,V]=a.useState({firstName:"",lastName:"",phone:""}),[Y,q]=a.useState({marketing_emails:!1,order_notifications:!0,dark_mode:!1});a.useEffect(()=>{z?G():p("/",{replace:!0})},[z,p]);const G=async()=>{try{$(!0);const[e,s]=await Promise.all([u(z.id),j(z.id)]);e&&U({firstName:e.firstName||"",lastName:e.lastName||"",full_name:`${e.firstName||""} ${e.lastName||""}`.trim(),phone:e.phone||"",email:e.email||""}),s&&q(s)}catch(e){F({title:K("errorOccurred"),description:K("profileLoadFailed"),variant:"destructive"})}finally{$(!1)}},H=async(e,s)=>{q(a=>({...a,[e]:s}));try{const{error:a}=await f(z.id,{[e]:s});if(a)throw a;F({title:K("success"),description:K("settingsUpdated")})}catch(a){q(a=>({...a,[e]:!s})),F({title:K("errorOccurred"),description:K("updateFailed"),variant:"destructive"})}};return M?e.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gray-50",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-orange-500"})}):e.jsxs("div",{className:"min-h-screen bg-gray-50 pb-24",children:[e.jsx("div",{className:"bg-white border-b sticky top-0 z-10",children:e.jsxs("div",{className:"max-w-md lg:max-w-2xl mx-auto px-4 h-16 flex items-center gap-3",children:[e.jsx(l,{variant:"ghost",size:"icon",className:"-ml-2 text-gray-500 hover:text-gray-900",onClick:()=>p(-1),children:e.jsx(b,{className:"h-6 w-6"})}),e.jsx("h1",{className:"text-xl font-bold text-gray-900",children:K("myAccount")})]})}),e.jsxs("div",{className:"max-w-md lg:max-w-2xl mx-auto px-4 py-6 lg:py-8 space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-2xl p-6 shadow-sm border border-gray-100 flex items-center gap-4",children:[e.jsx("div",{className:"h-16 w-16 rounded-full bg-orange-100 flex items-center justify-center text-orange-600 text-2xl font-bold border-2 border-white shadow-sm",children:(D.full_name||z?.email||"?").charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"text-lg font-bold text-gray-900 truncate",children:D.full_name||z?.email?.split("@")[0]||""}),e.jsx("p",{className:"text-sm text-gray-500 truncate",children:z?.email}),D.phone&&e.jsx("p",{className:"text-sm text-gray-400 mt-0.5",children:D.phone})]}),e.jsx(l,{variant:"ghost",size:"icon",className:"text-gray-400",children:e.jsx(v,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-white rounded-2xl overflow-hidden shadow-sm border border-gray-100",children:[e.jsx("div",{className:"p-4 border-b border-gray-50 bg-gray-50/50",children:e.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:K("accountSettings")})}),e.jsxs("div",{className:"divide-y divide-gray-50",children:[e.jsx(P,{icon:y,label:K("personalInfo"),subLabel:K("personalInfoSub"),onClick:()=>{V({firstName:D.firstName,lastName:D.lastName,phone:D.phone}),B(!0)}}),e.jsx(P,{icon:w,label:K("myAddresses"),subLabel:K("myAddressesSub"),onClick:()=>p("/profile/addresses")}),e.jsx(P,{icon:k,label:K("paymentMethods"),subLabel:K("paymentMethodsSub")})]})]}),e.jsxs("div",{className:"bg-white rounded-2xl overflow-hidden shadow-sm border border-gray-100",children:[e.jsx("div",{className:"p-4 border-b border-gray-50 bg-gray-50/50",children:e.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:K("preferences")})}),e.jsxs("div",{className:"divide-y divide-gray-50",children:[e.jsx(E,{icon:C,label:K("orderNotifications"),checked:Y.order_notifications,onChange:e=>H("order_notifications",e)}),e.jsx(E,{icon:_,label:K("marketingEmails"),checked:Y.marketing_emails,onChange:e=>H("marketing_emails",e)}
1),e.jsx(E,{icon:S,label:K("darkMode"),checked:Y.dark_mode,onChange:e=>H("dark_mode",e)})]})]}),e.jsx("div",{className:"bg-white rounded-2xl overflow-hidden shadow-sm border border-gray-100",children:e.jsxs("div",{className:"divide-y divide-gray-50",children:[e.jsx(P,{icon:O,label:K("privacySecurity"),subLabel:K("privacySecuritySub"),onClick:()=>p("/profile/privacy")}),e.jsx(P,{icon:L,label:K("appAbout"),subLabel:"v2.5.0"})]})}),e.jsxs(l,{variant:"ghost",className:"w-full text-red-500 hover:text-red-600 hover:bg-red-50 h-12 rounded-xl font-medium",onClick:async()=>{try{await I(),F({title:K("success"),description:K("signedOut")})}catch(e){F({title:K("errorOccurred"),description:K("signOutFailed"),variant:"destructive"})}},children:[e.jsx(A,{className:"h-5 w-5 mr-2"}),K("logOut")]}),e.jsx("div",{className:"text-center pb-6",children:e.jsx("p",{className:"text-xs text-gray-400",children:"pitza.fi © 2024"})})]})]}),e.jsx(n,{open:Q,onOpenChange:B,children:e.jsx(c,{children:e.jsxs("div",{className:"mx-auto w-full max-w-sm",children:[e.jsx(d,{children:e.jsx(o,{children:K("personalInfo")})}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:K("firstName")}),e.jsx(x,{value:J.firstName,onChange:e=>V(s=>({...s,firstName:e.target.value})),onKeyDown:e=>e.stopPropagation()})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:K("lastName")}),e.jsx(x,{value:J.lastName,onChange:e=>V(s=>({...s,lastName:e.target.value})),onKeyDown:e=>e.stopPropagation()})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:K("phoneNumber")}),e.jsx(x,{value:J.phone,onChange:e=>V(s=>({...s,phone:e.target.value})),onKeyDown:e=>e.stopPropagation(),type:"tel"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:K("emailLocked")}),e.jsx(x,{value:D.email,disabled:!0,className:"bg-gray-50 text-gray-500"})]})]}),e.jsxs(h,{children:[e.jsx(l,{onClick:async()=>{try{await N(z.id,{firstName:J.firstName,lastName:J.lastName,phone:J.phone}),U(e=>({...e,firstName:J.firstName,lastName:J.lastName,full_name:`${J.firstName} ${J.lastName}`.trim(),phone:J.phone})),B(!1),F({title:K("success"),description:K("profileUpdated")})}catch(e){F({title:K("errorOccurred"),description:K("updateFailed"),variant:"destructive"})}},className:"bg-orange-500 hover:bg-orange-600",children:K("saveChanges")}),e.jsx(g,{asChild:!0,children:e.jsx(l,{variant:"outline",children:K("cancelAction")})})]})]})})})]})}function P({icon:s,label:a,subLabel:r,onClick:t}){return e.jsxs("button",{onClick:t,className:"w-full flex items-center gap-4 p-4 hover:bg-gray-50 transition-colors text-left group",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-50 flex items-center justify-center text-orange-600 group-hover:scale-110 transition-transform",children:e.jsx(s,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-sm font-medium text-gray-900",children:a}),r&&e.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:r})]}),e.jsx(z,{className:"h-5 w-5 text-gray-300"})]})}function E({icon:s,label:a,checked:r,onChange:t}){return e.jsxs("div",{className:"flex items-center justify-between p-4 hover:bg-gray-50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-gray-100 flex items-center justify-center text-gray-600",children:e.jsx(s,{className:"h-5 w-5"})}),e.jsx("span",{className:"text-sm font-medium text-gray-900",children:a})]}),e.jsx(p,{checked:r,onCheckedChange:t,className:"data-[state=checked]:bg-orange-500"})]})}export{I 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.