@hiver/connector-agent 4.19.4-rightPanel-beta.0 → 4.19.4-rightPanel-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.es.js +2 -1
- package/index.umd.js +1 -1
- package/package.json +1 -1
package/index.es.js
CHANGED
|
@@ -34214,7 +34214,8 @@ const cQ = (e) => Te({
|
|
|
34214
34214
|
e.connectorApiPending = !1;
|
|
34215
34215
|
});
|
|
34216
34216
|
}, r = (i) => {
|
|
34217
|
-
(!Array.isArray(i) || !i.length)
|
|
34217
|
+
if (!Array.isArray(i) || !i.length)
|
|
34218
|
+
return;
|
|
34218
34219
|
const s = u.getData("sideBarTabs") || 0, D = [...i].sort((c, l) => {
|
|
34219
34220
|
const h = c.lastAccessed ?? 0, g = l.lastAccessed ?? 0;
|
|
34220
34221
|
return h === g ? 0 : h > g ? -1 : 1;
|
package/index.umd.js
CHANGED
|
@@ -4911,7 +4911,7 @@ Do you want to continue?`,Ov="Select an object to create",Nv="Select an object t
|
|
|
4911
4911
|
&:hover {
|
|
4912
4912
|
text-decoration: underline;
|
|
4913
4913
|
}
|
|
4914
|
-
`,bP=({expanded:e})=>a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{transition:"transform 150ms ease",transform:e?"rotate(180deg)":"none"},children:a.jsx("path",{d:"M4 6l4 4 4-4"})}),xP=e=>{if(e.targetKind==="channel"){const t=[];for(const u of e.threads??[])t.push(u.root,...u.replies);return t}return e.messages},yP=e=>e.targetKind==="channel"?(e.threads??[]).reduce((t,u)=>t+1+u.replies.length,0):e.messages.length,BP=e=>{const t=xP(e).filter(u=>!u.deletedAt&&u.subtype!=="tombstone");return t.length===0?null:t.reduce((u,n)=>Number(n.postedAt)>Number(u.postedAt)?n:u)},f4=({onViewAll:e,headerless:t=!1})=>{var M;const{hiverConvId:u,connectorId:n,smId:r,smIds:o,sendTrackingEvent:f,boxedMessages:i,isActive:D=!0}=qu(),c=A8(r,o);Pf(n,!0);const{state:l,connect:d}=Wo(n,{onConnected:()=>f==null?void 0:f(Ja)}),F=l==="connected",E=Zf(u,F,D?XN:0),{data:C,isLoading:p}=m8(u,F&&!!E.data),A=(M=E.data)==null?void 0:M.mentions,g=h.useMemo(()=>{const H=new Map;return(C??[]).forEach(V=>{V.name&&H.set(V.externalUserId,V.name)}),Object.entries(A??{}).forEach(([V,W])=>{W&&!H.has(V)&&H.set(V,W)}),H},[C,A]),[m,b]=h.useState(!0),[x,y]=h.useState(!1),B=l==="in_progress",v=h.useCallback(()=>{const H=l==="reauth_required"||l==="workspace_mismatch";f==null||f(za,{is_reauth:H}),d()},[d,f,l]),S=h.useCallback(()=>{f==null||f(p3),y(!0)},[f]);if(c.isLoading||c.data&&!c.data.enabled)return null;const k=F&&!E.isLoading?E.data:null,O=k?BP(k):null,L=O?i&&O.author.isSelf?"You":`${O.author.name||O.author.externalUserId}${!i&&O.author.isSelf?" (You)":""}`:"",_=()=>F?E.isLoading?null:k?a.jsxs(oi,{headerless:t,children:[a.jsxs(cP,{children:[a.jsx(lP,{children:"Channel:"}),a.jsxs(dP,{children:["#",k.channelName]})]}),O&&a.jsxs(AP,{children:[a.jsx(pP,{"aria-hidden":!0,children:a.jsx(Jf,{url:O.author.avatarUrl,name:O.author.name,fallbackId:O.author.externalUserId})}),a.jsxs(CP,{children:[a.jsxs(gP,{children:[a.jsx(FP,{title:L,children:L}),a.jsx(hP,{children:L8(O.postedAt,!!i)})]}),a.jsx(EP,{children:k8(Z1(O.text),g,p)})]})]}),a.jsx(mP,{role:"button",tabIndex:0,onClick:()=>e==null?void 0:e(),children:"View all"})]}):a.jsxs(oi,{headerless:t,children:[a.jsx(o4,{children:"Start an internal discussion about this conversation."}),a.jsx(DP,{variant:"contained",disableElevation:!0,onClick:S,children:"+ Start new"})]}):a.jsxs(oi,{headerless:t,children:[a.jsx(o4,{children:"Discuss this customer issue with your team on Slack from Hiver. Connect Slack to get started."}),a.jsxs(g8,{disableElevation:!0,onClick:v,disabled:B,children:[a.jsx(r4,{size:16}),B?"Connecting…":"Connect Slack"]})]});if(t)return a.jsxs(a.Fragment,{children:[_(),a.jsx(ni,{open:x,onClose:()=>y(!1)})]});const j=k?yP(k):0;return a.jsxs(oP,{children:[a.jsxs(fP,{role:"button",tabIndex:0,onClick:()=>b(H=>!H),children:[a.jsxs(aP,{children:[a.jsx(r4,{size:20}),a.jsx(sP,{children:"Slack"}),j>0&&a.jsx(iP,{children:j})]}),a.jsx(bP,{expanded:m})]}),m&&_(),a.jsx(ni,{open:x,onClose:()=>y(!1)})]})},wP=({onViewAll:e,...t})=>a.jsx(ri,{...t,children:a.jsx(f4,{onViewAll:e})}),vP=({onViewAll:e,...t})=>a.jsx(ri,{...t,children:a.jsx(f4,{onViewAll:e,headerless:!0})});function SP(e){var u;const t=Zf(e,!0,0);return(u=t.data)!=null&&u.channelName?{label:t.data.channelName,isLinked:!0}:{label:"Slack",isLinked:!1}}const IP=e=>Fe({url:uv,method:ye.POST,data:e}),kP=e=>Fe({url:nv,method:ye.POST,data:e}),TP=5e3,LP=(...e)=>{},_P=e=>{const t=new AbortController,u=async(n=0)=>{try{LP("getConnectorsList",n);const r=await zc(e);if(t.signal.aborted)throw new Error("Fetch aborted");return r}catch(r){if(t.signal.aborted)throw new Error("Fetch aborted");return n>2?(console.error("Failed to get connectors list after 3 tries",r),[]):u(n+1)}};return{fetchConnectors:u,abort:t.abort.bind(t)}},OP=()=>{const e={connectorApiPending:!1,connectorApiAbort:null,lastInboxKey:null,lastFetchTs:0};if(!Mt())throw new Error("Please initiate bifrost by calling initConnectorsBifrost function before creating app store");const u=jE({name:"app-store",initialState:{}}),n=()=>{const i=u.getData("inboxIds");if(!Array.isArray(i)||!i.length)return;const D=[...i].sort().join(","),c=Date.now();if(D===e.lastInboxKey&&c-e.lastFetchTs<TP)return;e.lastInboxKey=D,e.lastFetchTs=c,e.connectorApiAbort&&e.connectorApiAbort(),e.connectorApiPending=!0;const l={all:"true",inbox_id:i},{fetchConnectors:d,abort:F}=_P(l);e.connectorApiAbort=F,d().then(E=>{Array.isArray(E)&&u.setData(E,"connectors")}).catch(E=>{console.warn("Failed to fetch connectors",E)}).finally(()=>{e.connectorApiPending=!1})},r=i=>{(!Array.isArray(i)||!i.length)
|
|
4914
|
+
`,bP=({expanded:e})=>a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{transition:"transform 150ms ease",transform:e?"rotate(180deg)":"none"},children:a.jsx("path",{d:"M4 6l4 4 4-4"})}),xP=e=>{if(e.targetKind==="channel"){const t=[];for(const u of e.threads??[])t.push(u.root,...u.replies);return t}return e.messages},yP=e=>e.targetKind==="channel"?(e.threads??[]).reduce((t,u)=>t+1+u.replies.length,0):e.messages.length,BP=e=>{const t=xP(e).filter(u=>!u.deletedAt&&u.subtype!=="tombstone");return t.length===0?null:t.reduce((u,n)=>Number(n.postedAt)>Number(u.postedAt)?n:u)},f4=({onViewAll:e,headerless:t=!1})=>{var M;const{hiverConvId:u,connectorId:n,smId:r,smIds:o,sendTrackingEvent:f,boxedMessages:i,isActive:D=!0}=qu(),c=A8(r,o);Pf(n,!0);const{state:l,connect:d}=Wo(n,{onConnected:()=>f==null?void 0:f(Ja)}),F=l==="connected",E=Zf(u,F,D?XN:0),{data:C,isLoading:p}=m8(u,F&&!!E.data),A=(M=E.data)==null?void 0:M.mentions,g=h.useMemo(()=>{const H=new Map;return(C??[]).forEach(V=>{V.name&&H.set(V.externalUserId,V.name)}),Object.entries(A??{}).forEach(([V,W])=>{W&&!H.has(V)&&H.set(V,W)}),H},[C,A]),[m,b]=h.useState(!0),[x,y]=h.useState(!1),B=l==="in_progress",v=h.useCallback(()=>{const H=l==="reauth_required"||l==="workspace_mismatch";f==null||f(za,{is_reauth:H}),d()},[d,f,l]),S=h.useCallback(()=>{f==null||f(p3),y(!0)},[f]);if(c.isLoading||c.data&&!c.data.enabled)return null;const k=F&&!E.isLoading?E.data:null,O=k?BP(k):null,L=O?i&&O.author.isSelf?"You":`${O.author.name||O.author.externalUserId}${!i&&O.author.isSelf?" (You)":""}`:"",_=()=>F?E.isLoading?null:k?a.jsxs(oi,{headerless:t,children:[a.jsxs(cP,{children:[a.jsx(lP,{children:"Channel:"}),a.jsxs(dP,{children:["#",k.channelName]})]}),O&&a.jsxs(AP,{children:[a.jsx(pP,{"aria-hidden":!0,children:a.jsx(Jf,{url:O.author.avatarUrl,name:O.author.name,fallbackId:O.author.externalUserId})}),a.jsxs(CP,{children:[a.jsxs(gP,{children:[a.jsx(FP,{title:L,children:L}),a.jsx(hP,{children:L8(O.postedAt,!!i)})]}),a.jsx(EP,{children:k8(Z1(O.text),g,p)})]})]}),a.jsx(mP,{role:"button",tabIndex:0,onClick:()=>e==null?void 0:e(),children:"View all"})]}):a.jsxs(oi,{headerless:t,children:[a.jsx(o4,{children:"Start an internal discussion about this conversation."}),a.jsx(DP,{variant:"contained",disableElevation:!0,onClick:S,children:"+ Start new"})]}):a.jsxs(oi,{headerless:t,children:[a.jsx(o4,{children:"Discuss this customer issue with your team on Slack from Hiver. Connect Slack to get started."}),a.jsxs(g8,{disableElevation:!0,onClick:v,disabled:B,children:[a.jsx(r4,{size:16}),B?"Connecting…":"Connect Slack"]})]});if(t)return a.jsxs(a.Fragment,{children:[_(),a.jsx(ni,{open:x,onClose:()=>y(!1)})]});const j=k?yP(k):0;return a.jsxs(oP,{children:[a.jsxs(fP,{role:"button",tabIndex:0,onClick:()=>b(H=>!H),children:[a.jsxs(aP,{children:[a.jsx(r4,{size:20}),a.jsx(sP,{children:"Slack"}),j>0&&a.jsx(iP,{children:j})]}),a.jsx(bP,{expanded:m})]}),m&&_(),a.jsx(ni,{open:x,onClose:()=>y(!1)})]})},wP=({onViewAll:e,...t})=>a.jsx(ri,{...t,children:a.jsx(f4,{onViewAll:e})}),vP=({onViewAll:e,...t})=>a.jsx(ri,{...t,children:a.jsx(f4,{onViewAll:e,headerless:!0})});function SP(e){var u;const t=Zf(e,!0,0);return(u=t.data)!=null&&u.channelName?{label:t.data.channelName,isLinked:!0}:{label:"Slack",isLinked:!1}}const IP=e=>Fe({url:uv,method:ye.POST,data:e}),kP=e=>Fe({url:nv,method:ye.POST,data:e}),TP=5e3,LP=(...e)=>{},_P=e=>{const t=new AbortController,u=async(n=0)=>{try{LP("getConnectorsList",n);const r=await zc(e);if(t.signal.aborted)throw new Error("Fetch aborted");return r}catch(r){if(t.signal.aborted)throw new Error("Fetch aborted");return n>2?(console.error("Failed to get connectors list after 3 tries",r),[]):u(n+1)}};return{fetchConnectors:u,abort:t.abort.bind(t)}},OP=()=>{const e={connectorApiPending:!1,connectorApiAbort:null,lastInboxKey:null,lastFetchTs:0};if(!Mt())throw new Error("Please initiate bifrost by calling initConnectorsBifrost function before creating app store");const u=jE({name:"app-store",initialState:{}}),n=()=>{const i=u.getData("inboxIds");if(!Array.isArray(i)||!i.length)return;const D=[...i].sort().join(","),c=Date.now();if(D===e.lastInboxKey&&c-e.lastFetchTs<TP)return;e.lastInboxKey=D,e.lastFetchTs=c,e.connectorApiAbort&&e.connectorApiAbort(),e.connectorApiPending=!0;const l={all:"true",inbox_id:i},{fetchConnectors:d,abort:F}=_P(l);e.connectorApiAbort=F,d().then(E=>{Array.isArray(E)&&u.setData(E,"connectors")}).catch(E=>{console.warn("Failed to fetch connectors",E)}).finally(()=>{e.connectorApiPending=!1})},r=i=>{if(!Array.isArray(i)||!i.length)return;const D=u.getData("sideBarTabs")||0,c=[...i].sort((l,d)=>{const F=l.lastAccessed??0,E=d.lastAccessed??0;return F===E?0:F>E?-1:1}).map((l,d)=>({...l,sidebarView:d<D}));u.setData(c,"connectorTabs")},o=()=>{const i=u.getData("connectors");if(!Array.isArray(i))return n();typeof u.getData("sideBarTabs")=="number"&&r()},f=i=>{if(!i)return;const D=u.getData("connectorTabs"),c=D==null?void 0:D.find(d=>d.id===i);if(!c||c.sidebarView)return;const l=new Date().getTime();c.lastAccessed=l,r(D)};return u.subscribe(o,"connectors"),u.subscribe(()=>r(),"sideBarTabs",!1),u.subscribe(f,"connectorId",!1),u.subscribe(n,"inboxIds",!1),u},NP=({children:e})=>a.jsx(s.HiverProvider,{inter:!0,children:e}),jP=s.styled(({className:e,...t})=>a.jsx(s.Tooltip,{...t,classes:{popper:e}}))(()=>({[`& .${s.tooltipClasses.tooltip}`]:{backgroundColor:"#fff",padding:0,width:"min-content",borderRadius:"12px",maxWidth:"90vw",boxShadow:"0px 3px 15px 0px #00000040",color:"#000"},[`& .${s.tooltipClasses.arrow}`]:{color:"#fff !important"}})),MP=s.styled(s.Stack)`
|
|
4915
4915
|
box-sizing: content-box !important;
|
|
4916
4916
|
display: flex;
|
|
4917
4917
|
flex-direction: column;
|