1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
exports.id=724,exports.ids=[724],exports.modules={4923:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,3219,23)),Promise.resolve().then(r.t.bind(r,4863,23)),Promise.resolve().then(r.t.bind(r,5155,23)),Promise.resolve().then(r.t.bind(r,802,23)),Promise.resolve().then(r.t.bind(r,9350,23)),Promise.resolve().then(r.t.bind(r,8530,23)),Promise.resolve().then(r.t.bind(r,8921,23))},947:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,6959,23)),Promise.resolve().then(r.t.bind(r,3875,23)),Promise.resolve().then(r.t.bind(r,8903,23)),Promise.resolve().then(r.t.bind(r,7174,23)),Promise.resolve().then(r.t.bind(r,4178,23)),Promise.resolve().then(r.t.bind(r,7190,23)),Promise.resolve().then(r.t.bind(r,1365,23))},5752:(e,t,r)=>{Promise.resolve().then(r.bind(r,3157)),Promise.resolve().then(r.bind(r,1752)),Promise.resolve().then(r.bind(r,4223)),Promise.resolve().then(r.bind(r,1285))},5480:(e,t,r)=>{Promise.resolve().then(r.bind(r,3249)),Promise.resolve().then(r.bind(r,1492)),Promise.resolve().then(r.bind(r,7195)),Promise.resolve().then(r.bind(r,6544))},3249:(e,t,r)=>{"use strict";r.d(t,{AuthProvider:()=>i});var s=r(5512);r(8009);var a=r(3730),o=r(6235);function i({children:e}){let{checkAuth:t,isInitialized:r}=(0,a.B)();return r?(0,s.jsx)(s.Fragment,{children:e}):(0,s.jsx)("div",{className:"flex min-h-screen items-center justify-center",children:(0,s.jsx)(o.A,{className:"h-8 w-8 animate-spin text-blue-600"})})}},1492:(e,t,r)=>{"use strict";r.d(t,{ThemeProvider:()=>o});var s=r(5512);r(8009);var a=r(3371);function o({children:e,...t}){return(0,s.jsx)(a.N,{...t,children:e})}},9400:(e,t,r)=>{"use strict";r.d(t,{$:()=>d});var s=r(5512),a=r(8009),o=r(2705),i=r(1643),n=r(2743);let l=(0,i.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=a.forwardRef(({className:e,variant:t,size:r,asChild:a=!1,...i},d)=>{let c=a?o.DX:"button";return(0,s.jsx)(c,{className:(0,n.cn)(l({variant:t,size:r,className:e})),ref:d,...i})});d.displayName="Button"},7195:(e,t,r)=>{"use strict";r.d(t,{Toaster:()=>i});var s=r(5512),a=r(3371),o=r(1542);let i=({...e})=>{let{theme:t="system"}=(0,a.D)();return(0,s.jsx)(o.l$,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toaster]:text-muted-foreground",actionButton:"group-[.toaster]:bg-primary group-[.toaster]:text-primary-foreground",cancelButton:"group-[.toaster]:bg-muted group-[.toaster]:text-muted-foreground"}},...e})}},3730:(e,t,r)=>{"use strict";r.d(t,{B:()=>i});var s=r(2803),a=r(66),o=r(7311);let i=(0,s.v)((e,t)=>({user:null,isAuth:!1,isLoading:!1,isInitialized:!1,checkAuth:async()=>{if(!(0,a.getCookie)("accessToken")){e({isInitialized:!0,isAuth:!1});return}e({isLoading:!0});try{await t().getProfile(),e({isAuth:!0,isInitialized:!0})}catch(t){console.error("Auth check failed",t),(0,a.deleteCookie)("accessToken"),(0,a.deleteCookie)("refreshToken"),e({user:null,isAuth:!1,isInitialized:!0})}finally{e({isLoading:!1})}},login:async(r,s)=>{e({isLoading:!0});try{let{accessToken:i,refreshToken:n}=(await o.F.post("/auth/login",{phone:r,password:s})).data;(0,a.setCookie)("accessToken",i),(0,a.setCookie)("refreshToken",n),e({isAuth:!0}),await t().getProfile()}finally{e({isLoading:!1})}},register:async t=>{e({isLoading:!0});try{let{confirmPassword:e,...r}=t;await o.F.post("/auth/register",r)}finally{e({isLoading:!1})}},logout:()=>{(0,a.deleteCookie)("accessToken"),(0,a.deleteCookie)("refreshToken"),e({user:null,isAuth:!1})},getProfile:async()=>{try{let t=await o.F.get("/profile",{params:{_t:Date.now()}});e({user:t.data,isAuth:!0})}catch(e){console.error("Profile load failed",e)}},updateProfile:async r=>{e({isLoading:!0});try{await o.F.put("/profile",r),await t().getProfile()}finally{e({isLoading:!1})}},changePhone:async r=>{e({isLoading:!0});try{await o.F.post("/profile/change-phone",{newPhone:r}),await t().getProfile()}finally{e({isLoading:!1})}},becomePerformer:async()=>{e({isLoading:!0});try{await o.F.post("/profile/become-performer"),await t().getProfile()}finally{e({isLoading:!1})}},becomePerformerFull:async r=>{e({isLoading:!0});try{await o.F.post("/profile/become-performer",{description:r.description,competencies:r.competencies,location:r.location,currentLocation:null,isAlwaysReady:r.workSchedule.isAlwaysReady,workingDays:r.workSchedule.isAlwaysReady?null:JSON.stringify(r.workSchedule.schedulePerDay)}),await t().getProfile()}finally{e({isLoading:!1})}},updateCompetencies:async r=>{e({isLoading:!0});try{await o.F.put("/profile/competencies",{Competencies:r}),await t().getProfile()}finally{e({isLoading:!1})}},uploadAvatar:async r=>{e({isLoading:!0});try{let e=new FormData;e.append("file",r),await o.F.post("/profile/avatar",e,{headers:{"Content-Type":"multipart/form-data"}}),await t().getProfile()}finally{e({isLoading:!1})}},changePassword:async(r,s)=>{e({isLoading:!0});try{let e=t().user?.id;if(!e)throw Error("Пользователь не авторизован");await o.F.post("/profile/change-password",{accountId:e,oldPassword:r,newPassword:s})}finally{e({isLoading:!1})}},updateLocation:async(r,s)=>{e({isLoading:!0});try{let e=t().user?.id;if(!e)throw Error("Пользователь не авторизован");await o.F.put("/profile/location",{accountId:e,location:r,currentLocation:s}),await t().getProfile()}finally{e({isLoading:!1})}},updateSchedule:async(r,s)=>{e({isLoading:!0});try{let e=t().user?.id;if(!e)throw Error("Пользователь не авторизован");let a=r?"[]":JSON.stringify(s||{});await o.F.put("/profile/schedule",{accountId:e,isAlwaysReady:r,workingDaysJson:a}),await t().getProfile()}finally{e({isLoading:!1})}}}))},7311:(e,t,r)=>{"use strict";r.d(t,{F:()=>o});var s=r(4361),a=r(66);let o=s.A.create({baseURL:"http://127.0.0.1:5000/api",headers:{"Content-Type":"application/json"}});o.interceptors.request.use(e=>{let t=(0,a.getCookie)("accessToken");return t&&e.headers&&(e.headers.Authorization=`Bearer ${t}`),console.log(`🚀 Sending request to: ${e.baseURL}${e.url}`),e});let i=!1,n=[],l=(e,t=null)=>{n.forEach(r=>{e?r.reject(e):r.resolve(t)}),n=[]};o.interceptors.response.use(e=>e,async e=>{let t=e.config;if(e.response?.status===401&&!t._retry){if(i)return new Promise((e,t)=>{n.push({resolve:e,reject:t})}).then(e=>(t.headers.Authorization=`Bearer ${e}`,o(t))).catch(e=>Promise.reject(e));t._retry=!0,i=!0;let e=(0,a.getCookie)("refreshToken");try{let{accessToken:r,refreshToken:i}=(await s.A.post("http://127.0.0.1:5000/api/auth/refresh",{refreshToken:e})).data;return(0,a.setCookie)("accessToken",r),(0,a.setCookie)("refreshToken",i),o.defaults.headers.common.Authorization=`Bearer ${r}`,l(null,r),o(t)}catch(e){return l(e,null),(0,a.deleteCookie)("accessToken"),(0,a.deleteCookie)("refreshToken"),Promise.reject(e)}finally{i=!1}}return Promise.reject(e)})},2743:(e,t,r)=>{"use strict";r.d(t,{cn:()=>o,n:()=>i});var s=r(2281),a=r(4805);function o(...e){return(0,a.QP)((0,s.$)(e))}function i(e){if(!e)return"—";let t=e.replace(/\D/g,"");if(11===t.length){let e="8"===t[0]?"8":"+7";return`${e} (${t.slice(1,4)}) ${t.slice(4,7)}-${t.slice(7,9)}-${t.slice(9,11)}`}return e}},6544:(e,t,r)=>{"use strict";r.d(t,{Header:()=>P});var s=r(5512),a=r(8531),o=r.n(a),i=r(8009),n=r(2411),l=r(2848),d=r(3371),c=r(9400),m=r(4626),u=r(9905),f=r(4849),h=r(3689),p=r(2743);let g=m.bL,x=m.l9;m.YJ,m.ZL,m.Pb,m.z6,i.forwardRef(({className:e,inset:t,children:r,...a},o)=>(0,s.jsxs)(m.ZP,{ref:o,className:(0,p.cn)("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...a,children:[r,(0,s.jsx)(u.A,{className:"ml-auto h-4 w-4"})]})).displayName=m.ZP.displayName,i.forwardRef(({className:e,...t},r)=>(0,s.jsx)(m.G5,{ref:r,className:(0,p.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})).displayName=m.G5.displayName;let b=i.forwardRef(({className:e,sideOffset:t=4,...r},a)=>(0,s.jsx)(m.ZL,{children:(0,s.jsx)(m.UC,{ref:a,sideOffset:t,className:(0,p.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));b.displayName=m.UC.displayName;let v=i.forwardRef(({className:e,inset:t,...r},a)=>(0,s.jsx)(m.q7,{ref:a,className:(0,p.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));function y(){let{setTheme:e}=(0,d.D)();return(0,s.jsxs)(g,{children:[(0,s.jsx)(x,{asChild:!0,children:(0,s.jsxs)(c.$,{variant:"outline",size:"icon",className:"rounded-full",children:[(0,s.jsx)(n.A,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),(0,s.jsx)(l.A,{className:"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),(0,s.jsx)("span",{className:"sr-only",children:"Toggle theme"})]})}),(0,s.jsxs)(b,{align:"end",children:[(0,s.jsx)(v,{onClick:()=>e("light"),children:"Светлая"}),(0,s.jsx)(v,{onClick:()=>e("dark"),children:"Темная"}),(0,s.jsx)(v,{onClick:()=>e("system"),children:"Системная"})]})]})}v.displayName=m.q7.displayName,i.forwardRef(({className:e,children:t,checked:r,...a},o)=>(0,s.jsxs)(m.H_,{ref:o,className:(0,p.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...a,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(m.VF,{children:(0,s.jsx)(f.A,{className:"h-4 w-4"})})}),t]})).displayName=m.H_.displayName,i.forwardRef(({className:e,children:t,...r},a)=>(0,s.jsxs)(m.hN,{ref:a,className:(0,p.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(m.VF,{children:(0,s.jsx)(h.A,{className:"h-2 w-2 fill-current"})})}),t]})).displayName=m.hN.displayName,i.forwardRef(({className:e,inset:t,...r},a)=>(0,s.jsx)(m.JU,{ref:a,className:(0,p.cn)("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r})).displayName=m.JU.displayName,i.forwardRef(({className:e,...t},r)=>(0,s.jsx)(m.wv,{ref:r,className:(0,p.cn)("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=m.wv.displayName;var w=r(6873),N=r(7798),j=r(3730);function P(){let{isAuth:e,user:t}=(0,j.B)(),r=t?.roles?.includes("Master")||t?.roles?.includes("Company");return(0,s.jsx)("header",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:(0,s.jsxs)("div",{className:"container mx-auto flex h-16 items-center justify-between px-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-8",children:[(0,s.jsx)(o(),{href:"/",className:"flex items-center space-x-2",children:(0,s.jsx)("span",{className:"text-2xl font-black tracking-tight text-blue-600 dark:text-blue-500",children:"Nashel"})}),(0,s.jsxs)("nav",{className:"hidden md:flex gap-6 items-center text-sm font-medium transition-colors",children:[(0,s.jsxs)(o(),{href:"/map",className:"flex items-center gap-2 hover:text-blue-600",children:[(0,s.jsx)(w.A,{className:"h-4 w-4"}),"Поиск"]}),(0,s.jsx)(o(),{href:"/orders",className:"hover:text-blue-600",children:"Мои заказы"})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(y,{}),e?(0,s.jsx)(c.$,{variant:"ghost",asChild:!0,className:"hidden sm:flex items-center gap-2",children:(0,s.jsxs)(o(),{href:"/dashboard/profile",children:[(0,s.jsx)(N.A,{className:"h-4 w-4"}),t?.roles?.includes("Company")&&t?.companyName?t.companyName:t?.firstName&&t?.lastName?`${t.firstName} ${t.lastName}`:"Профиль"]})}):(0,s.jsx)(c.$,{variant:"ghost",asChild:!0,className:"hidden sm:flex items-center gap-2",children:(0,s.jsxs)(o(),{href:"/auth/login",children:[(0,s.jsx)(N.A,{className:"h-4 w-4"}),"Войти"]})}),r?(0,s.jsx)(c.$,{className:"bg-blue-600 hover:bg-blue-700 text-white",asChild:!0,children:(0,s.jsx)(o(),{href:"/orders",children:"Подобрать заказы"})}):(0,s.jsx)(c.$,{className:"bg-blue-600 hover:bg-blue-700 text-white",asChild:!0,children:(0,s.jsx)(o(),{href:"/dashboard/become-performer",children:"Стать исполнителем"})})]})]})})}},1354:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>m,metadata:()=>c});var s=r(2740),a=r(1358),o=r.n(a);r(1135);var i=r(1752),n=r(1285),l=r(4223),d=r(3157);let c={title:"Nashel - Маркетплейс услуг",description:"Найди мастера за 60 минут"};function m({children:e}){return(0,s.jsx)("html",{lang:"ru",suppressHydrationWarning:!0,children:(0,s.jsx)("body",{className:`${o().className} min-h-screen bg-background text-foreground antialiased`,children:(0,s.jsx)(i.ThemeProvider,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:(0,s.jsxs)(d.AuthProvider,{children:[(0,s.jsxs)("div",{className:"relative flex min-h-screen flex-col",children:[(0,s.jsx)(n.Header,{}),(0,s.jsx)("main",{className:"flex-1",children:e})]}),(0,s.jsx)(l.Toaster,{})]})})})})}},3157:(e,t,r)=>{"use strict";r.d(t,{AuthProvider:()=>s});let s=(0,r(6760).registerClientReference)(function(){throw Error("Attempted to call AuthProvider() from the server but AuthProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"E:\\GIT\\mvp\\nashel-frontend\\src\\components\\auth\\AuthProvider.tsx","AuthProvider")},1752:(e,t,r)=>{"use strict";r.d(t,{ThemeProvider:()=>s});let s=(0,r(6760).registerClientReference)(function(){throw Error("Attempted to call ThemeProvider() from the server but ThemeProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"E:\\GIT\\mvp\\nashel-frontend\\src\\components\\theme\\theme-provider.tsx","ThemeProvider")},4223:(e,t,r)=>{"use strict";r.d(t,{Toaster:()=>s});let s=(0,r(6760).registerClientReference)(function(){throw Error("Attempted to call Toaster() from the server but Toaster is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"E:\\GIT\\mvp\\nashel-frontend\\src\\components\\ui\\sonner.tsx","Toaster")},1285:(e,t,r)=>{"use strict";r.d(t,{Header:()=>s});let s=(0,r(6760).registerClientReference)(function(){throw Error("Attempted to call Header() from the server but Header is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"E:\\GIT\\mvp\\nashel-frontend\\src\\widgets\\Header.tsx","Header")},1135:()=>{}}; |