PageSourceSearch

https://farcaster.xyz/assets/useUserChannelRole-D0qYbPi3.js

js farcaster.xyz collected 2026-09-24 08:33:11 UTC 1,875 bytes, 1 lines download raw bytes

1import{f,r as h}from"./vendor-wagmi-CRHMQcRy.js";import{$ as d,bi as y,dv as w,dw as v,dx as c,H as b,dy as x,dz as p,dA as R,dB as u,ba as g}from"./index-CjDX1y09.js";const M=()=>{const{apiClient:t}=d(),e=f(),{trackEvent:l}=y(),C=w(),m=v(),n=c();return h.useCallback(async({removeFid:r,channelKey:o,actorFid:s})=>{try{l(b.RemoveFromChannelRole,{channelKey:o,role:"member",removeFid:r}),x({queryClient:e,channelKey:o,fid:r}),r===s&&(C({updates:{key:o,viewerContext:{isMember:!1}}}),m({category:"member",channelKey:o,fid:s})),await t.removeChannelUserFromRole({channelKey:o,removeFid:r,role:"member"}),r===s&&n({category:"follow",fid:s})}catch(a){throw p({queryClient:e,channelKey:o}),r===s&&(C({updates:{key:o,viewerContext:{isMember:!0}}}),n({category:"member",fid:s})),a}},[t,n,C,e,m,l])},A=()=>{const{apiClient:t}=d(),e=f(),{trackEvent:l}=y(),C=v(),m=c();return h.useCallback(async({fid:n,channelKey:r,actorFid:o})=>{try{R({queryClient:e,channelKey:r,fid:n,update:s=>({...s,relation:"member"})}),o===n&&(e.setQueryData(u(),s=>{if(!s)return;const a=(s.modOfChannelKeys??[]).filter(i=>i!==r);return{...s,modOfChannelKeys:a}}),C({category:"moderate",channelKey:r,fid:o})),l(b.RemoveFromChannelRole,{channelKey:r,role:"moderator"}),await t.removeChannelUserFromRole({channelKey:r,removeFid:n,role:"moderator"}),o===n&&m({category:"member",fid:o})}catch(s){throw p({queryClient:e,channelKey:r}),o===n&&(e.setQueryData(u(),a=>{if(!a)return;const i=(a.modOfChannelKeys??[]).filter(U=>U!==r);return{...a,modOfChannelKeys:[...i,r]}}),m({category:"moderate",fid:o})),s}},[t,m,e,C,l])},E=t=>{const e=g();if(e.adminForChannelKeys.has(t))return"owner";if(e.modOfChannelKeys.has(t))return"moderator"},I=t=>{const e=g();return e.adminForChannelKeys.has(t.key)?"owner":e.modOfChannelKeys.has(t.key)?"moderator":t.viewerContext.isMember?"member":null};export{I as a,A as b,M as c,E as u};

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.