1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4074],{28868:function(e,a,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/account/edit",function(){return t(67030)}])},31554:function(e,a,t){"use strict";t.d(a,{oL:function(){return d},CT:function(){return c},WN:function(){return u}});var n=t(69297),r=t(33944),s=t(29204),l=t(103),i=t(95591),o=t(49770);let c=()=>{let e=!!localStorage.getItem("accessToken"),{data:a,isLoading:t,error:n}=(0,o.Z)(e?"/auth/users/me/":null,e=>r.h.get(e).then(e=>e.data));return{me:a,isLoading:t,error:n}},d=e=>{var a;return(0,s.IZ)(e)&&!!(null===(a=e.response)||void 0===a?void 0:a.data)&&"email"in e.response.data},u=e=>{let{onFulfilled:a,onError:t}=e||{},{mutate:r}=(0,i.kY)(),[{loading:s,error:o},c]=(0,l.Z)(async e=>{let{user:s}=e;try{let e=await (0,n.PR)({body:{...s}});await r("/auth/users/me/",e,{revalidate:!1}),null==a||a()}catch(e){throw null==t||t(),e}});return{handlePutAuthUserMe:c,isLoading:s,error:o}}},67030:function(e,a,t){"use strict";t.r(a),t.d(a,{default:function(){return b}});var n=t(85893),r=t(62750),s=t(7009),l=t(31554),i=t(67294),o=t(10682),c=t(34051),d=t(31555),u=t(41330),m=t(76515),x=t(51852),v=t(35005),p=t(97535),f=t(76743),h=t(92199),_=t.n(h),g=t(56899),j=t(103),N=t(69297),Z=t(71507);let y=()=>{var e,a,t,h,y,b;let{t:w}=(0,Z.m)(),[C,E]=(0,i.useState)(!1),[L,k]=(0,i.useState)({avatar_raw:"",first_name:"",last_name:"",email:"",introduction:"",instagram_account:"",customer_id:""}),[R,T]=(0,i.useState)(null),G=e=>{k(a=>(a[e.target.id]=e.target.value,{...a}))},{showToast:$}=(0,s.pm)(),{me:P}=(0,l.CT)(),{handlePutAuthUserMe:O,error:I}=(0,l.WN)({onFulfilled(){$({variant:"success",title:w.toaster.success.title,message:w.toaster.success.message})},onError(){$({variant:"danger",title:w.toaster.error.title,message:w.toaster.error.message})}}),{error:S,handlePutUploadPhoto:U}=(0,f.LZ)({onFulfilled(){$({variant:"success",title:w.toaster.success.title,message:w.toaster.success.message})},onError(){$({variant:"danger",title:w.toaster.error.title,message:w.toaster.error.message})}}),A=(0,i.useMemo)(()=>{if((0,l.oL)(I)){var e,a;return null!==(a=null===(e=I.response)||void 0===e?void 0:e.data)&&void 0!==a?a:{}}return{}},[I]),[{error:F},M]=(0,j.Z)(N.yX),D=async e=>{if(e.preventDefault(),!P){$({variant:"danger",title:w.toaster.error.title,message:w.toaster.error.message});return}E(!0);try{var a,t;if(R){let e=R?await M({filename:R.name,contentType:R.type}):void 0;if(!(null==e?void 0:e.url))return;await U({url:e.url,file:R,type:R.type});let a=new URL(e.url);await O({user:{customer_id:L.customer_id,email:L.email,first_name:L.first_name,instagram_account:L.instagram_account,introduction:L.introduction,last_name:L.last_name,avatar_raw:"".concat(a.origin).concat(a.pathname)}})}else await O({user:{customer_id:L.customer_id,email:L.email,first_name:L.first_name,instagram_account:L.instagram_account,introduction:L.introduction,last_name:L.last_name,avatar:P.avatar}});if(I)throw Error((a="errorOnPutAuthUserMe : "+I.message,void 0!==a)?a:"");if(S)throw Error((t="putUploadPhotoErr : "+S.message,void 0!==t)?t:"")}catch(e){console.log(e)}finally{E(!1)}};return(0,i.useEffect)(()=>{(async()=>{var e,a,t,n,r,s;P&&k({avatar_raw:null!==(e=null==P?void 0:P.avatar_raw)&&void 0!==e?e:g.Fz,first_name:null!==(a=null==P?void 0:P.first_name)&&void 0!==a?a:"",last_name:null!==(t=null==P?void 0:P.last_name)&&void 0!==t?t:"",email:P.email,introduction:null!==(n=null==P?void 0:P.introduction)&&void 0!==n?n:"",instagram_account:null!==(r=null==P?void 0:P.instagram_account)&&void 0!==r?r:"",customer_id:null!==(s=null==P?void 0:P.customer_id)&&void 0!==s?s:""})})()},[P]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(o.Z,{className:"p-1 pt-5 ".concat(_().container),children:[(0,n.jsx)("h3",{className:"text-md-start mb-3 px-3 text-center ".concat(_().head),children:w.accountEdit.title}),(0,n.jsx)(p.Z,{onSubmit:D,method:"PUT",encType:"multipart/form-data",children:(0,n.jsxs)(c.Z,{className:"m-0",children:[(0,n.jsxs)(d.Z,{md:3,className:"m-0",children:[(0,n.jsxs)(p.Z.Group,{className:"w-100 d-flex flex-column align-items-center",style:{padding:"3px"},children:[(0,n.jsx)(u.Z,{src:"".concat(L.avatar_raw),className:"rounded-circle mb-2 border ".concat(_().avatar),width:"80px",height:"80px"}),(0,n.jsx)(p.Z.Label,{className:"w-100",children:(0,n.jsxs)(v.Z,{variant:"outline-info",className:"".concat(_().btn," position-relative"),children:[w.accountEdit.changePhoto,(0,n.jsx)(p.Z.Control,{id:"avatar",name:"avatar",type:"file",className:"position-absolute w-100 h-100 end-0 top-0 opacity-0",onChange:e=>{if(e.target.files&&e.target.files[0]&&e.target.files[0].type.startsWith("image")){let a=e.target.files[0];k(e=>({...e,avatar:URL.createObjectURL(a)})),T(a)}}})]})})]}),A.avatar_raw?(0,n.jsx)("p",{className:"text-danger pt-2",children:null===(e=A.avatar_raw)||void 0===e?void 0:e.join(",")}):null]}),(0,n.jsxs)(d.Z,{md:9,className:"m-0",style:{padding:"-3px"},children:[(0,n.jsxs)(c.Z,{children:[(0,n.jsxs)(d.Z,{md:6,className:"mb-4",children:[(0,n.jsxs)(p.Z.Group,{className:"",children:[(0,n.jsx)(p.Z.Label,{children:w.accountEdit.firstName}),(0,n.jsx)(p.Z.Control,{id:"last_name",name:"last_name",value:L.last_name,required:!0,type:"text",className:"px-3 py-0 ".concat(_().formControl),onChange:G})]}),A.last_name?(0,n.jsx)("p",{className:"text-danger pt-2",children:null===(a=A.last_name)||void 0===a?void 0:a.join(",")}):null]}),(0,n.jsxs)(d.Z,{md:6,className:"mb-4",children:[(0,n.jsxs)(p.Z.Group,{className:"",children:[(0,n.jsx)(p.Z.Label,{children:w.accountEdit.lastName}),(0,n.jsx)(p.Z.Control,{name:"first_name",id:"first_name",type:"text",value:L.first_name,required:!0,className:"px-3 py-0 ".concat(_().formControl),onChange:G})]}),A.first_name?(0,n.jsx)("p",{className:"text-danger pt-2",children:null===(t=A.first_name)||void 0===t?void 0:t.join(",")}):null]})]}),(0,n.jsxs)(c.Z,{className:"mb-4",children:[(0,n.jsxs)(p.Z.Group,{className:"",children:[(0,n.jsx)(p.Z.Label,{children:w.accountEdit.email}),(0,n.jsx)(p.Z.Control,{id:"email",name:"email",type:"email",value:L.email,className:"px-3 py-0 ".concat(_().formControl),disabled:!0})]}),A.email?(0,n.jsx)("p",{className:"text-danger pt-2",children:null===(h=A.email)||void 0===h?void 0:h.join(",")}):null]}),(0,n.jsxs)(c.Z,{className:"mb-4",children:[(0,n.jsxs)(p.Z.Group,{className:"",children:[(0,n.jsx)(p.Z.Label,{children:w.accountEdit.introduction}),(0,n.jsx)(p.Z.Control,{as:"textarea",id:"introduction",name:"introduction",value:L.introduction,rows:5,maxLength:300,className:"px-3 ".concat(_().formControl," ").concat(_().textarea),style:{resize:"none"},onChange:G})]}),A.introduction?(0,n.jsx)("p",{className:"text-danger pt-2",children:null===(y=A.introduction)||void 0===y?void 0:y.join(",")}):null]}),(0,n.jsxs)(c.Z,{className:"mb-4",children:[(0,n.jsxs)(p.Z.Group,{children:[(0,n.jsx)(p.Z.Label,{children:w.accountEdit.instragram}),(0,n.jsxs)(m.Z,{children:[(0,n.jsx)(m.Z.Text,{children:"@"}),(0,n.jsx)(p.Z.Control,{id:"instagram_account",name:"instagram_account",value:L.instagram_account,type:"text",className:"px-3 py-0 pl-5 ".concat(_().formControl),onChange:G})]})]}),A.instagram_account?(0,n.jsx)("p",{className:"text-danger pt-2",children:null===(b=A.instagram_account)||void 0===b?void 0:b.join(",")}):null]}),F?(0,n.jsx)(x.Z,{variant:"danger",children:F.message}):null,(0,n.jsxs)(c.Z,{className:"mb-4",children:[(0,n.jsx)(d.Z,{md:6}),(0,n.jsx)(d.Z,{md:6,className:"m-0 mt-3 ps-4",children:(0,n.jsx)(v.Z,{type:"submit",style:{height:"48px"},className:"w-100 py-2",children:w.accountEdit.updateButton})})]})]})]})})]}),C?(0,n.jsx)(r.g,{}):null]})};var b=()=>(0,n.jsx)(y,{})},92199:function(e){e.exports={head:"styles_head__327D8",container:"styles_container__DJGFr",formControl:"styles_formControl__MnrBe",textarea:"styles_textarea__Tku0J",btn:"styles_btn__KMjqW",avatar:"styles_avatar__1s96z"}},51852:function(e,a,t){"use strict";t.d(a,{Z:function(){return _}});var n=t(93967),r=t.n(n),s=t(67294),l=t(47150),i=t(78146),o=t(76792),c=t(39602),d=t(85893);let u=(0,c.Z)("h4");u.displayName="DivStyledAsH4";let m=s.forwardRef(({className:e,bsPrefix:a,as:t=u,...n},s)=>
1(a=(0,o.vE)(a,"alert-heading"),(0,d.jsx)(t,{ref:s,className:r()(e,a),...n})));m.displayName="AlertHeading";var x=t(13551);let v=s.forwardRef(({className:e,bsPrefix:a,as:t=x.Z,...n},s)=>(a=(0,o.vE)(a,"alert-link"),(0,d.jsx)(t,{ref:s,className:r()(e,a),...n})));v.displayName="AlertLink";var p=t(41068),f=t(41485);let h=s.forwardRef((e,a)=>{let{bsPrefix:t,show:n=!0,closeLabel:s="Close alert",closeVariant:c,className:u,children:m,variant:x="primary",onClose:v,dismissible:h,transition:_=p.Z,...g}=(0,l.Ch)(e,{show:"onClose"}),j=(0,o.vE)(t,"alert"),N=(0,i.Z)(e=>{v&&v(!1,e)}),Z=!0===_?p.Z:_,y=(0,d.jsxs)("div",{role:"alert",...Z?void 0:g,ref:a,className:r()(u,j,x&&`${j}-${x}`,h&&`${j}-dismissible`),children:[h&&(0,d.jsx)(f.Z,{onClick:N,"aria-label":s,variant:c}),m]});return Z?(0,d.jsx)(Z,{unmountOnExit:!0,...g,ref:void 0,in:n,children:y}):n?y:null});h.displayName="Alert";var _=Object.assign(h,{Link:v,Heading:m})},10682:function(e,a,t){"use strict";var n=t(93967),r=t.n(n),s=t(67294),l=t(76792),i=t(85893);let o=s.forwardRef(({bsPrefix:e,fluid:a=!1,as:t="div",className:n,...s},o)=>{let c=(0,l.vE)(e,"container"),d="string"==typeof a?`-${a}`:"-fluid";return(0,i.jsx)(t,{ref:o,...s,className:r()(n,a?`${c}${d}`:c)})});o.displayName="Container",a.Z=o},41330:function(e,a,t){"use strict";var n=t(93967),r=t.n(n),s=t(67294),l=t(45697),i=t.n(l),o=t(76792),c=t(85893);i().string,i().bool,i().bool,i().bool,i().bool;let d=s.forwardRef(({bsPrefix:e,className:a,fluid:t=!1,rounded:n=!1,roundedCircle:s=!1,thumbnail:l=!1,...i},d)=>(e=(0,o.vE)(e,"img"),(0,c.jsx)("img",{ref:d,...i,className:r()(a,t&&`${e}-fluid`,n&&"rounded",s&&"rounded-circle",l&&`${e}-thumbnail`)})));d.displayName="Image",a.Z=d},76515:function(e,a,t){"use strict";t.d(a,{Z:function(){return m}});var n=t(93967),r=t.n(n),s=t(67294),l=t(76792),i=t(6558),o=t(23045),c=t(85893);let d=s.forwardRef(({className:e,bsPrefix:a,as:t="span",...n},s)=>(a=(0,l.vE)(a,"input-group-text"),(0,c.jsx)(t,{ref:s,className:r()(e,a),...n})));d.displayName="InputGroupText";let u=s.forwardRef(({bsPrefix:e,size:a,hasValidation:t,className:n,as:i="div",...d},u)=>{e=(0,l.vE)(e,"input-group");let m=(0,s.useMemo)(()=>({}),[]);return(0,c.jsx)(o.Z.Provider,{value:m,children:(0,c.jsx)(i,{ref:u,...d,className:r()(n,e,a&&`${e}-${a}`,t&&"has-validation")})})});u.displayName="InputGroup";var m=Object.assign(u,{Text:d,Radio:e=>(0,c.jsx)(d,{children:(0,c.jsx)(i.Z,{type:"radio",...e})}),Checkbox:e=>(0,c.jsx)(d,{children:(0,c.jsx)(i.Z,{type:"checkbox",...e})})})},23045:function(e,a,t){"use strict";let n=t(67294).createContext(null);n.displayName="InputGroupContext",a.Z=n}},function(e){e.O(0,[6646,9770,9774,2888,179],function(){return e(e.s=28868)}),_N_E=e.O()}]);
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.