PageSourceSearch

https://mapping.team/_next/static/chunks/pages/teams/[id]-bca1d15bf00daedc.js

js mapping.team collected 2026-10-04 10:46:34 UTC 15,911 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8661],{15891:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/teams/[id]",function(){return n(63826)}])},93798:function(e,t,n){"use strict";n.d(t,{Ah:function(){return g},Ao:function(){return C},Cm:function(){return d},Dg:function(){return h},LK:function(){return l},VP:function(){return u},WP:function(){return p},Yz:function(){return v},fZ:function(){return j},fs:function(){return m},fw:function(){return w},uL:function(){return f},um:function(){return y},wg:function(){return b}});var r=n(80129),s=n.n(r),a=n(34078),i=n.n(a);let o="https://mapping.team",c=i()(o,"/api/teams");async function l(e){let t=s().stringify(e,{arrayFormat:"comma"}),n=await fetch("".concat(c,"?").concat(t));if(200===n.status)return n.json();throw Error("Could not retrieve teams")}async function d(e){let t=await fetch(c,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json; charset=utf-8"}});if(200===t.status)return t.json();throw Error("Could not retrieve teams")}async function h(e,t){let n=await fetch(i()(o,"api","organizations","".concat(e),"teams"),{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json; charset=utf-8"}});if(200===n.status)return n.json();throw Error("Could not retrieve teams")}async function u(e){let t=await fetch(i()(c,"".concat(e)));if(200===t.status)return t.json();{let n=Error("could not retrieve team");throw n.status=t.status,n}}async function m(e,t){return fetch(i()(c,"".concat(e)),{method:"PUT",body:JSON.stringify(t),headers:{"Content-Type":"application/json; charset=utf-8"}})}async function f(e){return fetch(i()(c,"".concat(e)),{method:"DELETE"})}async function p(e){let t=await fetch(i()(c,"".concat(e),"moderators"));if(200===t.status)return t.json();if(401===t.status)return[];{let n=Error("could not retrieve team moderators");throw n.status=t.status,n}}async function x(e,t,n){return fetch(i()(c,"".concat(e),"members"),{method:"PATCH",body:JSON.stringify({add:t,remove:n}),headers:{"Content-Type":"application/json; charset=utf-8"}})}async function j(e,t){return x(e,[t],[])}async function g(e,t){return x(e,[],[t])}async function y(e){return fetch(i()(c,"".concat(e),"join"),{method:"PUT",headers:{"Content-Type":"application/json; charset=utf-8"}})}async function w(e,t){return fetch(i()(c,"".concat(e),"assignModerator","".concat(t)),{method:"PUT",headers:{"Content-Type":"application/json; charset=utf-8"}})}async function b(e,t){return fetch(i()(c,"".concat(e),"removeModerator","".concat(t)),{method:"PUT",headers:{"Content-Type":"application/json; charset=utf-8"}})}async function v(e){let t=await fetch(i()(c,"".concat(e),"invitations"));if(200===t.status)return t.json();{let n=Error("could not retrieve team invitations");throw n.status=t.status,n}}async function C(e){let t=await fetch(i()(c,"".concat(e),"invitations"),{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8"}});if(200===t.status)return t.json();throw Error("Could not retrieve teams")}},63826:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return eb}});var r=n(85893),s=n(67294),a=n(51826),i=n(72593),o=n(30601),c=n(40915),l=n(45596),d=n(5152),h=n.n(d),u=n(33299),m=n(11163),f=n(14418),p=n(23100),x=n(204),j=n(76684),g=n(88911),y=n(96272),w=n(36979),b=n(39849),v=n(81785),C=n(29119),S=n(93798),M=n(44555),k=n(83987),T=n(36986),Z=n.n(T),z=n(45697),P=n.n(z),_=n(15213),O=n(34078),I=n.n(O),A=n(34629),E=n(99292),D=n(36963),N=n(89154),X=n(87626),L=n(31956),U=n(3174),H=n(80129),R=n.n(H),J=n(76368),W=n(74190),q=n(57420),F=n(21586),K=n(86834),V=n(18865),B=n(7256),Y=n(61889),G=n(60155),Q=n(53014);function $(e){let{teamId:t,moderators:n,onUsernameClick:a,displayBadges:l,requesterId:d,organizationId:h,removeMember:u,addModerator:f,removeModerator:p,isRequesterModerator:j,isRequesterOrgOwner:y}=e,w=(0,m.useRouter)(),[b,v]=(0,s.useState)(1),[C,S]=(0,s.useState)(null),[M,k]=(0,s.useState)({key:"name",direction:"asc"}),[T,Z,z,P,O]=(0,A.dQ)("colors",["brand.500","brand.700","red.500","red.700","blue.400"]),H={member:T,moderator:z,manager:Z,owner:P,undefined:O},$=R().stringify({search:C,page:b,sort:M.key,order:M.direction,fields:"badges"}),{result:ee,isLoading:et}=(0,W.z)("/teams/".concat(t,"/members?").concat($)),{members:en}=ee;if(!en)return;let{data:er,pagination:es}=en,ea=(0,i.Z)((0,o.Z)("osm_id"),n),ei=er.map(e=>{let t=(0,V.Z)(e.id,ea);return{...e,role:t?"moderator":"member"}}),eo="This team has no members.";!et&&(null==C?void 0:C.length)>0&&(eo="Search returned no results.");let ec=[{key:"name",sortable:!0,render:e=>(0,r.jsxs)(x.k,{flexDir:"column",children:[(0,r.jsxs)(g.x,{fontWeight:"bold",fontFamily:"body",as:"a",display:"flex",gap:1,onClick:()=>a(e),_hover:{cursor:"pointer"},title:"Display user profile","data-component-name":"username",children:[e.name,(0,r.jsx)(Q.h,{opacity:0,transition:"opacity 0.12s ease-in",sx:{'[data-component-name="username"]:hover &':{opacity:"initial"}},alignSelf:"center"})]}),(0,r.jsx)(g.x,{color:"blackAlpha.600",children:e.id})]})},{key:"role",label:"role",render(e){let{role:t}=e;return(0,r.jsx)(F.Z,{color:H[t.toLowerCase()],children:(0,K.makeTitleCase)(t)})}}
1,{key:"External Profiles",render(e){let{id:t,name:n}=e;return(0,r.jsxs)(x.k,{gap:1,justifyContent:"center",children:[(0,r.jsx)(q.Z,{type:"osm-profile",userId:n,title:"Visit OSM profile"}),"",(0,r.jsx)(q.Z,{type:"hdyc",userId:n,title:"Visit HDYC profile"}),(0,r.jsx)(q.Z,{type:"osmcha",userId:n,title:"Visit OSMCha profile"})]})},alignment:"center"}];return l&&(ec=(0,B.Z)(2,{key:"badges",render(e){let{badges:t}=e;return(0,r.jsxs)(r.Fragment,{children:[(null==t?void 0:t.length)>0&&t.slice(0,3).map(e=>(0,r.jsx)(F.Z,{dot:!0,color:e.color,children:e.name},e.name)),(null==t?void 0:t.length)>3&&(0,r.jsxs)(F.Z,{color:"#222",children:["+",t.slice(3).length]})]})}},ec)),j&&(ec=(0,Y.Z)({key:"Actions",render(e){let t=[];return Number(e.id)!==Number(d)&&t.push({name:"Remove team member",async onClick(){u(e.id)}}),(0,c.Z)(Number(e.id),n.map(e=>Number(e.osm_id)))?n.length>1&&t.push({name:"Remove moderator",async onClick(){p(e.id)}}):t.push({name:"Promote to moderator",async onClick(){f(e.id)}}),h&&y&&t.push({name:"Assign a badge",onClick:()=>w.push(I()("https://mapping.team","/organizations/".concat(h,"/badges/assign/").concat(e.id)))}),(0,r.jsxs)(E.v,{children:[(0,r.jsx)(D.j,{as:N.h,size:"sm",variant:"ghost","aria-label":"User actions menu",title:(null==t?void 0:t.length)>0?"Display user actions menu":"No actions for this user",isDisabled:(null==t?void 0:t.length)===0,icon:(0,r.jsx)(G.Ppk,{})}),(0,r.jsx)(X.q,{children:t.map(e=>(0,r.jsx)(L.s,{fontSize:"sm",onClick:()=>e.onClick(),children:e.name},e.name))})]})},alignment:"center"},ec)),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(J.Z,{"data-cy":"team-members-table",placeholder:"Search by username",onSearch(e){v(1),S(e)}}),(0,r.jsx)(_.Z,{"data-cy":"team-members-table",columns:ec,emptyPlaceHolder:et?"Loading...":eo,showRowNumbers:!0,rows:ei,sort:M,setSort:k}),(null==es?void 0:es.total)>0&&(0,r.jsx)(U.Z,{pagination:es,"data-cy":"team-members-table-pagination",setPage:v})]})}$.defaultProps={rows:[]},$.propTypes={rows:P().array.isRequired,onRowClick:P().func};var ee=n(41664),et=n.n(ee),en=n(33379),er=n(40156),es=n(93863),ea=n(25322),ei=n(28129),eo=n(40782),ec=n(31983);function el(e){let{id:t}=e,[n,a]=(0,s.useState)(null),{onCopy:i,hasCopied:o}=(0,er.V)(n),c=async function(){try{let e=await (0,S.Yz)(t);e.length&&a(I()("https://mapping.team","teams/".concat(t,"/invitations/").concat(e[0].id)))}catch(n){Z().error(n),eo.Am.error(n)}};(0,s.useEffect)(()=>{c()},[]);let l=async function(){try{await (0,S.Ao)(t),c()}catch(e){Z().error(e),eo.Am.error(e)}};return(0,r.jsx)("div",{style:{marginTop:"1rem"},children:n?(0,r.jsxs)(es.B,{size:"sm",children:[(0,r.jsx)(ea.Ui,{bg:"brand.700",fontSize:"xs",px:2,children:"Join Link:"}),(0,r.jsx)(ei.I,{readOnly:!0,textOverflow:"ellipsis",value:n,borderLeftColor:"whiteAlpha.400"}),(0,r.jsx)(ea.xW,{p:0,bg:"brand.500",children:(0,r.jsx)(y.z,{variant:"outline",color:"white",size:"sm",leftIcon:(0,r.jsx)(ec.T,{}),onClick:i,children:o?"Copied!":"Copy"})})]}):(0,r.jsx)(y.z,{size:"sm",onClick:()=>l(t),children:"Create Join Link"})})}var ed=n(92752),eh=n(31963),eu=n(31948),em=n(44504),ef=n(55819),ep=n(73793),ex=n(47018),ej=n(59081);function eg(e){let{isOpen:t,onClose:n,onSubmit:s}=e;return(0,r.jsxs)(ed.u_,{isCentered:!0,isOpen:t,onClose:n,scrollBehavior:"inside",children:[(0,r.jsx)(eh.Z,{}),(0,r.jsxs)(eu.h,{flexDirection:"column",as:"article",gap:2,children:[(0,r.jsxs)(em.x,{gap:4,display:"flex",flexDir:"column",children:[(0,r.jsx)(f.X,{size:"sm",as:"h3",children:"Add Member"}),(0,r.jsx)(ef.o,{onClick:()=>n()})]}),(0,r.jsxs)(ep.f,{display:"flex",flexDirection:"column",gap:2,children:[(0,r.jsxs)(p.xu,{children:[(0,r.jsx)(f.X,{size:"sm",as:"h4",children:"OSM ID"}),(0,r.jsx)(ej.I,{onSubmit:s})]}),(0,r.jsxs)(p.xu,{children:[(0,r.jsx)(f.X,{size:"sm",as:"h4",children:"OSM Username"}),(0,r.jsx)(ej.B,{onSubmit:s})]})]}),(0,r.jsx)(ex.m,{})]})]})}let ey=h()(()=>Promise.all([n.e(9269),n.e(7245),n.e(8820)]).then(n.bind(n,48820)),{loadableGenerated:{webpack:()=>[48820]},ssr:!1});class ew extends s.Component{static getInitialProps(e){let{query:t}=e;return{id:t.id}}async componentDidMount(){this.getTeam(),this.setState({session:await (0,u.getSession)()})}async getTeam(){let{id:e}=this.props;try{let t=await (0,S.VP)(e),n=t.requesterIsMember,r=await (0,S.WP)(e),s=[];s=await (0,M._P)(e);let a=[];
1if(t.org)try{a=(await (0,k.D7)(t.org.organization_id)).owners}catch(i){Z().error("Can't fetch organization owners",i)}this.setState({team:t,teamProfile:s,isMember:n,teamModerators:r,orgOwners:a,loading:!1})}catch(o){Z().error(o),this.setState({error:o,team:null,loading:!1})}}async openProfileModal(e){let{id:t}=this.props,{team:n}=this.state;try{let r=await (0,M._L)(t,e.id);if(n.org){let s=await (0,M.WS)(n.org.organization_id,e.id);r=r.concat(s)}this.setState({profileInfo:r,profileMeta:e,modalIsOpen:!0})}catch(a){Z().error(a),this.setState({error:a,team:null,loading:!1})}}async closeProfileModal(){this.setState({modalIsOpen:!1})}async joinTeam(){let{id:e,user:t}=this.props,n=t.uid;try{await (0,S.um)(e,n),await this.getTeam()}catch(r){Z().error(r),this.setState({error:r})}}renderMap(e){if(!e)return;let t=(0,a.Z)(JSON.parse(e).coordinates);return(0,r.jsx)(ey,{marker:{center:t},style:{height:"260px"}})}async addModerator(e){let{id:t}=this.props;try{await (0,S.fw)(t,e),await this.getTeam()}catch(n){Z().error(n),this.setState({error:n,loading:!1})}}async removeModerator(e){let{id:t}=this.props;try{await (0,S.wg)(t,e),await this.getTeam()}catch(n){Z().error(n),this.setState({error:n,loading:!1})}}async removeMember(e){let{id:t}=this.props;try{await (0,S.Ah)(t,e),this.state.modalIsOpen&&await this.closeProfileModal(),await this.getTeam()}catch(n){Z().error(n),this.setState({error:n,team:null,loading:!1})}}render(){var e,t;let{team:n,error:s,isMember:a,teamProfile:d,teamModerators:h,orgOwners:u}=this.state;if(s)return 401===s.status||403===s.status?(0,r.jsx)(en.Z,{children:(0,r.jsx)(f.X,{color:"white",children:"Unauthorized"})}):404===s.status?(0,r.jsx)(en.Z,{children:(0,r.jsx)(f.X,{color:"white",children:"Team not found"})}):(0,r.jsx)(en.Z,{children:(0,r.jsxs)(f.X,{color:"white",children:["Error: ",s.message]})});if(!n)return null;let m=null===(e=this.state.session)||void 0===e?void 0:e.user_id,M=(0,i.Z)((0,o.Z)("osm_id"),h),k=(0,i.Z)((0,o.Z)("id"),u),T=(0,c.Z)(parseInt(m),M)||(0,c.Z)(parseInt(m),k),Z=(0,c.Z)(parseInt(m),k);return(0,r.jsxs)(p.xu,{as:"main",mb:16,children:[(0,r.jsx)(en.Z,{children:(0,r.jsxs)(x.k,{direction:["column",null,"row"],justifyContent:"space-between",gap:4,children:[(0,r.jsxs)(x.k,{direction:"column",gap:2,children:[(0,r.jsx)(f.X,{color:"white",children:n.name}),(0,r.jsxs)(x.k,{gap:[4,8],children:[n.org&&(0,r.jsxs)(j.K,{as:"dl",spacing:1,children:[(0,r.jsx)(g.x,{as:"dt",variant:"overline",children:"Organization"}),(0,r.jsx)(g.x,{as:"dd",children:(0,r.jsx)(et(),{href:"/organizations/".concat(n.org.organization_id),style:{textDecoration:"underline"},children:n.org.name})})]}),n.hashtag&&(0,r.jsxs)(j.K,{as:"dl",spacing:1,children:[(0,r.jsx)(g.x,{as:"dt",variant:"overline",children:"Hashtag"}),(0,r.jsx)(g.x,{as:"dd",children:n.hashtag})]})]})]}),(0,r.jsxs)(x.k,{direction:"column",alignItems:["stretch",null,"flex-end"],children:[(0,r.jsxs)(x.k,{direction:["column",null,"row"],gap:2,children:[a?(0,r.jsx)(y.z,{variant:"outline",colorScheme:"white",as:et(),href:"/teams/".concat(n.id,"/profile"),children:"Edit Your Profile"}):" ",T?(0,r.jsx)(y.z,{variant:"outline",colorScheme:"white",as:et(),href:"/teams/".concat(n.id,"/edit"),children:"Edit Team"}):""]}),T&&(0,r.jsx)(el,{id:n.id})]})]})}),(0,r.jsxs)(w.W,{maxW:"container.xl",as:"section",children:[n.bio&&(0,r.jsxs)(p.xu,{as:"section",layerStyle:"shadowed",children:[(0,r.jsx)(f.X,{variant:"sectionHead",children:"Team Description"}),(0,r.jsx)(g.x,{children:n.bio})]}),d.length>0&&(0,r.jsxs)(p.xu,{as:"section",layerStyle:"shadowed",children:[(0,r.jsx)(f.X,{variant:"sectionHead",children:"Team Details"}),(0,r.jsxs)(b.M,{columns:[2,null,3],spacing:2,children:[n.org&&(0,r.jsxs)(j.K,{as:"dl",spacing:0,children:[(0,r.jsx)(g.x,{as:"dt",variant:"overline",children:"Organization"}),(0,r.jsx)(g.x,{as:"dd",children:(0,r.jsx)(et(),{href:"/organizations/".concat(n.org.organization_id),style:{textDecoration:"underline"},children:n.org.name})})]}),n.hashtag&&(0,r.jsxs)(j.K,{as:"dl",spacing:0,children:[(0,r.jsx)(g.x,{as:"dt",variant:"overline",children:"Hashtag"}),(0,r.jsx)(g.x,{as:"dd",children:n.hashtag})]}),n.editing_policy&&(0,r.jsx)("a",{href:n.editing_policy,className:"team__editing_policy",children:"Organized editing policy"}),d.map(e=>{if(e.value)return(0,r.jsxs)(j.K,{as:"dl",spacing:0,children:[(0,r.jsx)(g.x,{variant:"overline",as:"dt",children:e.name}),(0,r.jsx)(g.x,{as:"dd",children:e.value})]},e)})]})]}),n.location&&(0,r.jsxs)(p.xu,{as:"section",layerStyle:"shadowed",children:[(0,r.jsx)(f.X,{variant:"sectionHead",children:"Location"}),this.renderMap(n.location)]}),h.length?(0,r.jsx)(p.xu,{as:"section",layerStyle:"shadowed",children:(0,r.jsxs)(p.xu,{mb:2,"data-cy":"team-members-section",children:[(0,r.jsxs)(x.k,{direction:["column","row"],justifyContent:["space-between"],children:[(0,r.jsx)(f.X,{variant:"sectionHead",children:"Team Members"}),(0,r.jsx)("div",{children:T&&(0,r.jsx)(y.z,{textTransform:"lowercase",type:"submit",variant:"outline",loadingText:"Adding",onClick:()=>this.setState({showAddMemberModal:!0}),leftIcon:(0,r.jsx)(v.d,{}),children:"Add Members"})})]}),(0,r.jsx)($,{teamId:this.props.id,organizationId:null===(t=n.org)||void 0===t?void 0:t.organization_id,requesterId:m,displayBadges:!(0,l.Z)((0,o.Z)("org",n)),onUsern
1ameClick:this.openProfileModal.bind(this),moderators:h,isRequesterModerator:T,isRequesterOrgOwner:Z,removeMember:this.removeMember.bind(this),addModerator:this.addModerator.bind(this),removeModerator:this.removeModerator.bind(this)}),(0,r.jsx)(C.Z,{user:this.state.profileMeta,attributes:this.state.profileInfo,onClose:this.closeProfileModal,isOpen:this.state.modalIsOpen}),(0,r.jsx)(eg,{isOpen:this.state.showAddMemberModal,onClose:async()=>{this.setState({showAddMemberModal:!1})},onSubmit:async e=>{let{osmId:t,username:r}=e,s=await (0,S.fZ)(n.id,t);200===s.status?(eo.Am.success(r?"Member ".concat(r," successfully added."):"Member ".concat(t," successfully added.")),this.getTeam()):eo.Am.error(r?"Failed to add ".concat(r," as member."):"Failed to add ".concat(t," as member."))}})]})}):(0,r.jsx)("div",{})]})]})}constructor(e){super(e),this.state={profileInfo:[],profileUserId:"",loading:!0,error:void 0,showAddMemberModal:!1},this.closeProfileModal=this.closeProfileModal.bind(this)}}var eb=(0,m.withRouter)(ew)}},function(e){e.O(0,[260,5062,7478,5683,3804,9014,919,6873,5010,5961,6277,9774,2888,179],function(){return e(e.s=15891)}),_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.