",args:s,abortSignal:r,reason:c})).then(e=>{n(e)}).catch(e=>{(0,O.default)({getState:a}).error(`API call to entities.refs.remove with reason ${c} failed, initiated by generated fetcher`),l(e)})}));function useRemoveRelatedChannel(e,a){let t=(0,l.wA)(),[r,c]=(0,n.useState)(!1),[d,s]=(0,n.useState)(null),o=(0,n.useRef)(null);return(0,n.useEffect)(()=>{s(null),c(!1)},[e]),(0,n.useEffect)(()=>()=>{o.current&&o.current.abort()},[]),{onRemoveRelatedChannel:(0,n.useCallback)(async n=>{let l=n?.trim();if(!l)return!1;c(!0),s(null),o.current=new AbortController;try{if(await t(P({entityId:e,channelId:l,timestamp:"00000000.000000",reason:a??"use_remove_related_channel"})),o.current.signal.aborted)return!1;return c(!1),s(null),!0}catch(e){if(o.current.signal.aborted)return!1;return c(!1),s(e),!1}},[t,e,a]),isLoading:r,error:d}}P.meta={name:"entitiesRefsRemoveFetcher",key:"createFetcherEntitiesRefsRemoveFetcher",description:"entities.refs.remove generated fetcher"};var H=t(0x239e2ae8e),V=t(0xf6ed6f31),U=t(0x24a88897e),q=t(0x155965105),j=t(0x153456a5a),z=t(0xf73286e3);let W=new s.Ay("recordchannels"),$={name:"ellipsis-vertical-filled",size:"20"};function RelatedChannelListItemActionsMenu({channel:e,entityId:a,isUserAddedRelatedChannel:t,isVisible:r}){let c=W.t("More actions"),d=(0,l.wA)(),s=e.id,o=(0,k.d4)(e=>(0,U.r)(e,s)),i=(0,k.d4)(e=>(0,q.Ef)(e,s)),h=(0,g.F)(e),m=W.t("Remove channel"),C=W.t("Leave channel"),{onRemoveRelatedChannel:u}=useRemoveRelatedChannel(a),R=(0,n.useCallback)(async()=>{try{return await d((0,H.mK)({channelId:s,reason:"search_channel_view"}))}catch{}},[s,d]),p=(0,n.useCallback)(async()=>{try{return await d((0,j.F)({channelId:s}))}catch{}},[s,d]),x=(0,n.useCallback)(async()=>{await d((0,z.o)({recordId:a,reason:"related-channels-remove-channel"}))},[d,a]),b=(0,n.useCallback)(async()=>{await u(s)&&x()},[s,u,x]),A=(0,n.useMemo)(()=>{let a=(0,V.bl)(e),t=a&&i.ok,n=!a&&o;return t?{label:C,onClick:p,enabled:!0,danger:!0,autoClogProps:_._f}:n?{label:W.t("Join channel"),onClick:R,enabled:!0,autoClogProps:_.Fz}:{label:W.t("Joined"),onClick:void 0,enabled:!1}},[o,i.ok,e,C,R,p]),E=(0,n.useMemo)(()=>{let e={label:m,danger:!0,enabled:!0,click:b,"aria-label":m,autoClogProps:_.Xg};return h?[...t?[e]:[]]:[...t?[e,{type:"separator"}]:[],{enabled:A.enabled,label:A.label,click:A.onClick,"aria-label":A.label,danger:A.danger,autoClogProps:A.autoClogProps}]},[h,t,A.danger,A.autoClogProps,A.enabled,A.label,A.onClick,b,m]),f=(0,n.useCallback)(e=>n.createElement(L.a,{...e,template:E}),[E]);return!t&&h?null:n.createElement("div",{className:r?"":"hidden"},n.createElement(B.A,{"aria-label":c,"data-qa":"related-channel-list-item-actions-menu",isMenuTrigger:!0,renderMenu:f,svgIconProps:$,tooltipLabel:c,tooltipPosition:"bottom"}))}RelatedChannelListItemActionsMenu.displayName="RelatedChannelListItemActionsMenu";var G=t(0xe849da7d),J=t(0xb25439fa),Q=t(0xa8fcb8c5),X=t(0x196acb3d5),Y=t(0x2130932c2),K=t(0x195df1f06),Z=t(0x5eb1f30d),ee=t.n(Z);let ea=(0,J.J)(X.A),renderMessage=e=>n.createElement(ea,{...e,showExternalOpenTooltip:!0});renderMessage.displayName="renderMessage";let RelatedChannelPeek=({channelId:e})=>{let a=(0,n.useMemo)(()=>n.createElement("div",{className:ee().channel_title},n.createElement(Y.A,{id:e,hideTitleSuffix:!0})),[e]),t=(0,n.useCallback)(()=>n.createElement(K.A,null),[]);return n.createElement(G.A,{header:a,className:ee().peek,classNameSuffix:"related_channel_peek",contentClassName:ee().peek_content},n.createElement(Q.A,{channelId:e,renderMessage:renderMessage,renderEmptyMessage:t}))};RelatedChannelPeek.displayName="RelatedChannelPeek";var et=t(0x12da9ee23),en=t(0x1ecc7f772),el=t(0xc1360909),er=t(0x516c5277),ec=t.n(er);function BaseRelatedChannelListItem({relatedChannel:e,onRelatedChannelClick:a,entityId:t}){let l=(0,k.d4)(a=>(0,v.OL)(a,e?.id)),r=(0,k.d4)(e=>(0,en.SB)(e,l)),c=(0,k.d4)(e=>{let a=(0,el.q8)(e,l?.id);return a?.counts?.member_count}),d=(0,V.bl)(l),s=(0,n.useMemo)(()=>({..._.jA,elementValue:e.id,relatedChannelSource:e.source}),[e.id,e.source]),o=(0,n.useMemo)(()=>n.createElement(w,{channel:l,isChannelMember:d,memberCount:c,showTeamDisambiguation:!0}),[c,l,d]),i=(0,n.useCallback)(()=>{a(e.id)},[e.id,a]),h=(0,n.useCallback)(()=>n.createElement(RelatedChannelPeek,{channelId:e.id}),[e.id]);if(!l)return null;let m=e.source===et.U.UserAdd;return n.createElement(u.A,null,({isHovered:e,hoverProps:a})=>n.createElement(x.A,{id:l.id,className:ec().related_channel_list_item,"aria-labelledby":`related_channel_list_item_button_${l.id}`,...a},n.createElement("div",{className:ec().related_channel_list_item_content},n.createElement(R.Nm,{id:`related_channel_list_item_button_${l.id}`,className:ec().related_channel_list_item_button,"aria-label":r,onClick:i,autoClogProps:s},n.createElement(b.A,{renderContent:h,position:C.yX.BottomLeft,isInline:!0},n.createElement("div",{className:ec().related_channel_list_item_channel_name_wrapper},n.createElement(A.A,{channel:l,className:ec().related_channel_list_item_channel_name}))),n.createElement(p.Q,{"data-qa":"medium_channel_entity_metadata"},o)),n.createElement(RelatedChannelListItemActionsMenu,{channel:l,entityId:t,isVisible:e,isUserAddedRelatedChannel:m}))))}BaseRelatedChannelListItem.displayName="BaseRelatedChannelListItem";let ed=n.memo(BaseRelatedChannelListItem);var es=t(0x249b1763),eo=t(0x1a02c72b5),ei=t(0xd6a16321);let e_=new s.Ay("recordchannels"),eh="see_all_channels_button";function BaseRelatedChannelListSeeAllChannelsItem({onSeeAllClick:e,recordId:a}){let t=(0,l.wA)(),r=(0,k.d4)(es.yH),d=(0,n.useCallback)(()=>{e?e():t((0,eo.o)((0,ei.B6)({recordId:a})))},[t,e,a]);return n.createElement(x.A,{id:eh,"aria-labelledby":`related_channel_list_item_button_${eh}`,className:c()(ec().related_channel_list_item_containing_button,ec().related_channel_list_item_content)},n.createElement(h.A,{"aria-label":r?e_.t("See all"):"See all",onClick:d,className:c()(ec().related_channel_list_item_button,ec().related_channel_list_see_all_channels_item_button),autoClogProps:_.Sf},r?e_.t("See all"):"See all"))}BaseRelatedChannelListSeeAllChannelsItem.displayName="BaseRelatedChannelListSeeAllChannelsItem";let em=n.memo(BaseRelatedChannelListSeeAllChannelsItem);var eC=t(0x1e2e18308);let eu=new s.Ay("recordchannels"),eR="see_all_channels_button";function BaseRelatedChannelList({relatedChannels:e,entityId:a,hideSeeAllChannelsButton:t=!1,onRelatedChannelClick:r}){let d=(0,l.wA)(),s=(0,k.d4)(es.yH),o=(0,n.useCallback)(()=>d((0,eC.C)({entityId:a})),[d,a]),i=(0,n.useMemo)(()=>{let a=[...e];return t||a.push({id:eR,source:"salesforce"}),a},[e,t]),C=(0,n.useCallback)(e=>e.id===eR?n.createElement(em,{recordId:a}):n.createElement(ed,{relatedChannel:e,onRelatedChannelClick:r,entityId:a}),[a,r]);return e.length?n.createElement(m.A,{renderItem:C,items:i,"aria-label":"Related Channel List",className:ec().related_channel_list}):n.createElement(h.A,{id:"related_channel_list_item_button_add_channel_button",autoClogProps:_.qH,onClick:o,className:c()(ec().related_channel_list_item_containing_button,ec().related_channel_list_item_content,ec().related_channel_list_item_button,ec().related_channel_list_add_channel_item_button)},s?eu.t("Add Channel"):"Add Channel")}BaseRelatedChannelList.displayName="BaseRelatedChannelList";let ep=n.memo(BaseRelatedChannelList);var ex=t(0x157317005),eb=t(0x3711e82d),eA=t(0x14236acae),eE=t(0x132352aa7),ef=t.n(eE);let ey=new s.Ay("recordchannels");function BaseRelatedChannelsSection({recordId:e,onRelatedChannelClick:a,truncateRelatedChannelList:t=!1,hideTitle:r}){let s=(0,l.wA)(),h=(0,k.d4)(a=>(0,eA.PQ)(a,e)),m=h?.record_channel_id,C=h?.org?.id,{relatedChannels:u,loading:R,error:p}=(0,ex.t)({recordId:e,reason:"related-channels-section"}),x=(0,n.useMemo)(()=>t&&u.length>5,[u.length,t]),b=(0,n.useMemo)(()=>x?u.slice(0,5):u,[u,x]),A=(0,n.useCallback)(()=>s((0,eC.C)({entityId:e})),[s,e]);return n.createElement(d.A,{uiComponentName:eb.UiComponentName.SALESFORCE_RECORD_RELATED_CHANNELS_SECTION,uiComponentVariant:x?eb.UiComponentVariant.SALESFORCE_RECORD_RELATED_CHANNELS_TRUNCATED:eb.UiComponentVariant.SALESFORCE_RECORD_RELATED_CHANNELS_NOT_TRUNCATED,channelId:m,salesforceOrgId:C},n.createElement("article",{className:c()(ef().related_channels_section,{[ef().hidden_title]:r})},n.createElement("header",{className:ef().related_channels_section_header},n.createElement("div",{className:ef().related_channels_section_title_container},!r&&n.createElement("h2",{className:ef().related_channels_section_title},ey.t("Channels")),r&&n.createElement("p",{className:ef().related_channels_section_description},ey.t("Channels that are connected to related records. You can also manually add relevant channels.")),!!b.length&&n.createElement(i.A,{id:"related_channel_list_item_button_add_channel_button",className:ef().related_channels_section_add_channel,onClick:A,autoClogProps:_.qH},ey.t("Add")))),R&&0===b.length?n.createElement(o.A,null):n.createElement(ep,{relatedChannels:b,entityId:e,hideSeeAllChannelsButton:!x,onRelatedChannelClick:a})))}BaseRelatedChannelsSection.displayName="BaseRelatedChannelsSection";let eg=n.memo(BaseRelatedChannelsSection)},0x157317005:(e,a,t)=>{"use strict";t.d(a,{t:()=>useRelatedChannels});var n=t(0xbad225b5),l=t(0x16cf1da63),r=t(0x226892387),c=t(0x8a69e186),d=t(0xf73286e3);let useRelatedChannels=({recordId:e,reason:a="use-related-channels",skip:t=!1})=>{let s=(0,l.wA)(),o=(0,r.wz)(a=>(0,c.Dm)(a,e)),i=(0,r.d4)(a=>(0,c.tT)(a,e)),_=(0,r.d4)(a=>(0,c.Jw)(a,e)),h=_?Error(_):null;return(0,n.useEffect)(()=>{t||s((0,d.o)({recordId:e,reason:a}))},[s,e,a,t]),{relatedChannels:o,loading:i,error:h,refetch:(0,n.useCallback)(async()=>{t||await s((0,d.o)({recordId:e,reason:a}))},[s,e,a,t])}}},0x1a1880a2:(e,a,t)=>{"use strict";t.d(a,{E:()=>s});var n=t(0xe874a88a),l=t(0x22a29f141),r=t(0x1dfdeb1c8),c=t(0x1ec68d6a3),d=t(0xe747dd27);let s=(0,r.A)("recordChannels.relatedConversations.list generated fetcher",(e,a,t)=>new n.S((n,r)=>{let{abortSignal:s,reason:o,...i}=t,_=(0,d.VA)(i);e((0,l.apiCall)({method:"recordChannels.relatedConversations.list",args:_,abortSignal:s,reason:o})).then(e=>{n(e)}).catch(e=>{(0,c.default)({getState:a}).error(`API call to recordChannels.relatedConversations.list with reason ${o} failed, initiated by generated fetcher`),r(e)})}));s.meta={name:"recordChannelsRelatedConversationsListFetcher",key:"createFetcherRecordChannelsRelatedConversationsListFetcher",description:"recordChannels.relatedConversations.list generated fetcher"}},0x12da9ee23:(e,a,t)=>{"use strict";t.d(a,{U:()=>n});let n={UserAdd:"userAdd",Salesforce:"salesforce"}},0x22a2f5397:(e,a,t)=>{"use strict";t.d(a,{Eo:()=>s,Hw:()=>_,Id:()=>o,WP:()=>r,WU:()=>l,YH:()=>i,wU:()=>c,xe:()=>d});var n=t(0xcf658893);let l=(0,n.Ay)("Sets related channels for a record");l.meta={name:"setRelatedChannelsForRecord",key:"createActionSetRelatedChannelsForRecord",description:"Sets related channels for a record"};let r=(0,n.Ay)("Adds a single related channel to a record");r.meta={name:"addRelatedChannelToRecord",key:"createActionAddRelatedChannelToRecord",description:"Adds a single related channel to a record"};let c=(0,n.Ay)("Removes a related channel from a record");c.meta={name:"removeRelatedChannelFromRecord",key:"createActionRemoveRelatedChannelFromRecord",description:"Removes a related channel from a record"};let d=(0,n.Ay)("Clears all related channels for a record");d.meta={name:"clearRelatedChannelsForRecord",key:"createActionClearRelatedChannelsForRecord",description:"Clears all related channels for a record"};let s=(0,n.Ay)("Bulk sets related channels for multiple records");s.meta={name:"bulkSetRelatedChannels",key:"createActionBulkSetRelatedChannels",description:"Bulk sets related channels for multiple records"};let o=(0,n.Ay)("Sets fetch status for related channels");o.meta={name:"setRelatedChannelsFetchStatus",key:"createActionSetRelatedChannelsFetchStatus",description:"Sets fetch status for related channels"};let i=(0,n.Ay)("Sets error message for related channels fetch");i.meta={name:"setRelatedChannelsError",key:"createActionSetRelatedChannelsError",description:"Sets error message for related channels fetch"};let _=(0,n.Ay)("Sets last fetched timestamp for related channels");_.meta={name:"setRelatedChannelsLastFetched",key:"createActionSetRelatedChannelsLastFetched",description:"Sets last fetched timestamp for related channels"}},0x8a69e186:(e,a,t)=>{"use strict";t.d(a,{Dm:()=>c,Jw:()=>d,cD:()=>o,tT:()=>s});var n=t(0x1df96de4c),l=t(0x1cf0d97e1);let r={data:n.Ml,fetchStatus:"initial",errorMessage:null,lastFetchedAt:0},c=(0,l.Ay)((e,a)=>e.recordRelatedConversations?.channelsByRecordId[a]?.data||n.Ml);c.meta={name:"getRelatedChannelsByRecordId",key:"createSelectorGetRelatedChannelsByRecordId",description:(e,a)=>e.recordRelatedConversations?.channelsByRecordId[a]?.data||n.Ml},(0,l.Ay)((e,a)=>e.recordRelatedConversations?.channelsByRecordId[a]?.fetchStatus||"initial").meta={name:"getRelatedChannelsFetchStatusByRecordId",key:"createSelectorGetRelatedChannelsFetchStatusByRecordId",description:(e,a)=>e.recordRelatedConversations?.channelsByRecordId[a]?.fetchStatus||"initial"};let d=(0,l.Ay)((e,a)=>e.recordRelatedConversations?.channelsByRecordId[a]?.errorMessage||null);d.meta={name:"getRelatedChannelsErrorByRecordId",key:"createSelectorGetRelatedChannelsErrorByRecordId",description:(e,a)=>e.recordRelatedConversations?.channelsByRecordId[a]?.errorMessage||null},(0,l.Ay)((e,a)=>e.recordRelatedConversations?.channelsByRecordId[a]?.lastFetchedAt||0).meta={name:"getRelatedChannelsLastFetchedByRecordId",key:"createSelectorGetRelatedChannelsLastFetchedByRecordId",description:(e,a)=>e.recordRelatedConversations?.channelsByRecordId[a]?.lastFetchedAt||0};let s=(0,l.Ay)((e,a)=>"loading"===(e.recordRelatedConversations?.channelsByRecordId[a]?.fetchStatus||"initial"));s.meta={name:"getRelatedChannelsLoadingByRecordId",key:"createSelectorGetRelatedChannelsLoadingByRecordId",description:(e,a)=>"loading"===(e.recordRelatedConversations?.channelsByRecordId[a]?.fetchStatus||"initial")};let o=(0,l.Ay)((e,a)=>"success"===(e.recordRelatedConversations?.channelsByRecordId[a]?.fetchStatus||"initial"));o.meta={name:"getRelatedChannelsFetchSuccessByRecordId",key:"createSelectorGetRelatedChannelsFetchSuccessByRecordId",description:(e,a)=>"success"===(e.recordRelatedConversations?.channelsByRecordId[a]?.fetchStatus||"initial")},(0,l.Ay)((e,a)=>e.recordRelatedConversations?.channelsByRecordId[a]||r).meta={name:"getRelatedChannelsStateByRecordId",key:"createSelectorGetRelatedChannelsStateByRecordId",description:(e,a)=>e.recordRelatedConversations?.channelsByRecordId[a]||r}},0xf73286e3:(e,a,t)=>{"use strict";t.d(a,{o:()=>d});var n=t(0x1df96de4c),l=t(0x1a1880a2),r=t(0x11c82607b),c=t(0x22a2f5397);let d=(0,r.Ay)("fetch-related-channels-for-record",async(e,a,{recordId:t,reason:r="fetch-related-channels-for-record",skipCache:d=!1})=>{e((0,c.Id)({recordId:t,status:"loading"})),e((0,c.YH)({recordId:t,errorMessage:null}));try{let a=await e((0,l.E)({recordId:t,reason:r,skipCache:d}));if(a.related_channels&&a.related_channels.length>0){let n=a.related_channels.map(e=>({id:e.channel,source:e.source}));return e((0,c.WU)({recordId:t,relatedChannels:n})),e((0,c.Id)({recordId:t,status:"success"})),e((0,c.Hw)({recordId:t,timestamp:Date.now()})),n}return e((0,c.WU)({recordId:t,relatedChannels:n.Ml})),e((0,c.Id)({recordId:t,status:"success"})),e((0,c.Hw)({recordId:t,timestamp:Date.now()})),n.Ml}catch(a){throw e((0,c.Id)({recordId:t,status:"error"})),e((0,c.YH)({recordId:t,errorMessage:a instanceof Error?a.message:"Unknown error occurred"})),a}});d.meta={name:"fetchRelatedChannelsForRecord",key:"createThunkFetchRelatedChannelsForRecord",description:"fetch-related-channels-for-record"}},0xe849da7d:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});var n=t(0xbad225b5),l=t(0x120c268ad),r=t.n(l),c=t(0x1c371dd8b),d=t(0x3711e82d);let PeekView=({header:e,headerButtons:a,className:t,children:l,classNameSuffix:s,contentClassName:o})=>{let i=(0,n.useMemo)(()=>({eventId:d.EventId.TAB_RAIL_PREVIEW,elementName:`${s}_tab_preview`,clogImpression:!0,enableClogImpressionOffScreen:!1,clogImpressionDuration:36e5}),[s]),_=(0,n.useMemo)(()=>({onMouseEnter:{action:d.UiAction.HOVER}}),[]);return n.createElement(c.A,{autoClogProps:i,actionProps:_,elementType:d.ElementType.POPOVER},n.createElement("div",{className:r()("p-peek_card","p-peek_card--as-card","p-peek_card--animate-in",`p-peek_card--${s}`,t),"data-qa":"activity"===s?"activity-tab-rail-hover-menu":void 0},n.createElement("div",{className:"p-peek_card__header"},e,n.createElement("div",{className:"p-peek_card__buttons"},a)),n.createElement("div",{className:r()("p-peek_card__content",o)},l)))};PeekView.displayName="PeekView";let s=PeekView}}]); //# sourceMappingURL=https://slack.com/source-maps/bv1-13/gantry-v2-async-record-related-conversations-list-all-view.18c2179691e069f83e4f.min.js.mapØA —Eoúô