@hiver/connector-admin 4.22.0-appsActivation-beta.13 → 4.22.0-appsActivation-beta.14

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 CHANGED
@@ -40832,7 +40832,7 @@ const Tq = S(H)`
40832
40832
  `, rZ = S(ne)`
40833
40833
  display: flex;
40834
40834
  flex-direction: column;
40835
- gap: 8px;
40835
+ gap: 4px;
40836
40836
  min-width: 0;
40837
40837
  `, oZ = S(ne)`
40838
40838
  display: flex;
@@ -41954,7 +41954,9 @@ const yx = S(ne)`
41954
41954
  marginTop: 4,
41955
41955
  minHeight: "auto",
41956
41956
  width: "100%",
41957
- borderBottom: "1px solid var(--connector-admin-border-strong)"
41957
+ /* A 2px inset line, as on the legacy settings tabs (border-b-2 gray-5):
41958
+ the 2px active indicator paints over it, same thickness, same band. */
41959
+ boxShadow: "inset 0 -2px 0 var(--connector-admin-border-strong)"
41958
41960
  },
41959
41961
  children: h.map((w) => /* @__PURE__ */ s.jsx(da, { value: w, label: JZ[w], sx: XZ, className: "border-b-0!" }, w))
41960
41962
  }
package/index.umd.js CHANGED
@@ -3881,7 +3881,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
3881
3881
  `,UU=A.styled(A.Box)`
3882
3882
  display: flex;
3883
3883
  flex-direction: column;
3884
- gap: 8px;
3884
+ gap: 4px;
3885
3885
  min-width: 0;
3886
3886
  `,$U=A.styled(A.Box)`
3887
3887
  display: flex;
@@ -4244,7 +4244,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
4244
4244
  gap: 24px;
4245
4245
  margin-top: 16px;
4246
4246
  align-items: start;
4247
- `,M$=({carouselImages:e,illustrationUrl:t,overviewHelpHeading:n,showScheduleCall:r,templateDescription:o,features:a,supportLinks:s,appName:l})=>{const i=(e??[]).map(({url:u})=>({src:u}));return c.jsxs(P$,{children:[c.jsxs("div",{children:[t?c.jsx(tx,{children:c.jsx("img",{src:t,alt:`${l??"App"} overview`})}):i.length>0&&c.jsx($E,{previewList:i}),o&&c.jsx(A.Typography,{variant:"body2",sx:{color:"var(--connector-admin-text-heading)",marginTop:2},children:c.jsx("span",{dangerouslySetInnerHTML:{__html:o}})}),a&&a.length>0&&c.jsxs(nx,{children:[c.jsx(A.Typography,{sx:{fontWeight:A.theme.typography.fontWeightMedium,fontSize:`${A.theme.typography.body1.fontSize}px`,lineHeight:"24px",letterSpacing:"0.042px",color:"var(--connector-admin-text-primary)",marginBottom:"8px"},children:"Features"}),a.map((u,d)=>c.jsxs(A.Typography,{sx:{fontSize:`${A.theme.typography.body2.fontSize}px`,lineHeight:"20px",color:"var(--connector-admin-text-secondary)"},children:[d+1,". ",u]},d))]})]}),c.jsxs(A.Stack,{gap:"12px",children:[c.jsx(A.Typography,{variant:"h2",marginBottom:"8px",children:n??zE}),r!==!1&&c.jsx(Pi,{isSettingsPage:!0}),c.jsx(Af,{connectorName:l,supportLinks:s})]})]})},ix=e=>jE(e,!1),cx=["Overview","Visibility"],N$={title:"Configuration",visibility:!0},lx={textTransform:"none",fontSize:`${A.theme.typography.body1.fontSize}px`,fontWeight:A.theme.typography.fontWeightMedium,letterSpacing:"0.25px",minHeight:"auto",padding:"0",color:"var(--connector-admin-text-tertiary)","&.Mui-selected":{color:"var(--connector-admin-accent)"}},k$=({mode:e})=>{const t=Pt(),n=fn(),{id:r=""}=Kr(),o=xe(Ha),a=xe(jn),s=xe(du),l=xe(So),i=e==="template"?(o==null?void 0:o[r])??null:null,u=e==="connector"?(a==null?void 0:a[r])??null:null;return m.useEffect(()=>{var d,g;r&&(e==="template"?(d=o==null?void 0:o[r])!=null&&d.apiList||n(Ga(r)):(g=a==null?void 0:a[r])!=null&&g.apiList||n(Ya(r)))},[r,e,o,a,n]),e==="template"?i!=null&&i.apiList?ix(i.type)?c.jsx(ux,{mode:"template",id:r,headerSource:i}):c.jsx(Bs,{to:`${Se.BASEPATH}${Se.API_VIEW}/${r}`,replace:!0}):s===pe.FAILED?c.jsxs(go,{children:[c.jsxs(iA,{onClick:()=>t(`${Se.BASEPATH}${Se.DASHBOARD}`),children:[c.jsx(AA,{"aria-hidden":!0,width:20,height:20}),"Apps Marketplace"]}),c.jsx(A.Typography,{variant:"h6",sx:{marginTop:2,fontWeight:A.theme.typography.fontWeightSemiBold},children:"Couldn’t load app"}),c.jsxs(A.Typography,{variant:"body2",sx:{color:"var(--connector-admin-text-tertiary)"},children:["Template ID “",r,"” couldn’t be fetched. Try refreshing."]})]}):c.jsx(go,{children:c.jsx(ku,{})}):u!=null&&u.apiList?ix(u.type)?c.jsx(ux,{mode:"connector",id:r,headerSource:u}):c.jsx(Bs,{to:`${Se.BASEPATH}${Se.API_VIEW}/${r}?isEdit=true`,replace:!0}):l===pe.FAILED?c.jsxs(go,{children:[c.jsxs(iA,{onClick:()=>t(`${Se.BASEPATH}${Se.DASHBOARD}`),children:[c.jsx(AA,{"aria-hidden":!0,width:20,height:20}),"Apps Marketplace"]}),c.jsx(A.Typography,{variant:"h6",sx:{marginTop:2,fontWeight:A.theme.typography.fontWeightSemiBold},children:"Couldn’t load app"}),c.jsxs(A.Typography,{variant:"body2",sx:{color:"var(--connector-admin-text-tertiary)"},children:["Connector ID “",r,"” couldn’t be fetched. Try refreshing."]})]}):c.jsx(go,{children:c.jsx(ku,{})})},ux=({mode:e,id:t,headerSource:n})=>{const r=Pt(),o=A.useTheme(),[a,s]=yo(),l=m.useMemo(()=>A.createTheme(o,{typography:IE("'Hanken Grotesk', system-ui, sans-serif").typography}),[o]),u=Hy(n.type)({mode:e,id:t}),d=n.logo,g=a.get("tab"),B=g==="overview"?0:g==="visibility"?1:e==="connector"?1:0,[f,C]=m.useState(B),E=(h,p)=>{C(p);const y=new URLSearchParams(a);y.set("tab",p===1?"visibility":"overview"),s(y,{replace:!0})},Q=()=>E({},1);return c.jsx(A.HiverProvider,{theme:l,children:c.jsxs(go,{children:[c.jsxs(iA,{onClick:()=>r(`${Se.BASEPATH}${Se.DASHBOARD}`),children:[c.jsx(AA,{"aria-hidden":!0,width:20,height:20}),"Apps Marketplace"]}),c.jsxs(df,{children:[c.jsxs(gf,{children:[d&&c.jsx(Yb,{children:c.jsx(Jb,{children:c.jsx("img",{src:d,alt:n.name})})}),c.jsxs(L$,{children:[c.jsx(A.Typography,{sx:{fontWeight:A.theme.typography.fontWeightMedium,fontSize:`${A.theme.typography.h1.fontSize}px`,lineHeight:"32px",letterSpacing:"0.2px",color:"var(--connector-admin-app-title)"},children:n.name}),c.jsx(A.Typography,{sx:{fontWeight:A.theme.typography.fontWeightRegular,fontSize:`${A.theme.typography.body1.fontSize}px`,lineHeight:"20px",color:"var(--connector-admin-text-secondary)"},children:n.description})]})]}),e==="template"&&f===0&&c.jsx(F$,{variant:"contained",disableElevation:!0,onClick:Q,children:"Start setup"}),e==="connector"&&c.jsx(O$,{connectorId:t,isEnabled:!!n.isEnabled,isAuthenticated:!!n.isAuthenticated,connectorType:n.type,connectorName:n.name})]}),c.jsxs(A.Tabs,{value:f,onChange:E,TabIndicatorProps:{sx:{backgroundColor:"var(--connector-admin-accent)",height:"2px"}},sx:{marginTop:4,minHeight:"auto",width:"100%",borderBottom:"1px solid var(--connector-admin-border-strong)"},children:[c.jsx(A.Tab,{label:cx[0],sx:lx}),c.jsx(A.Tab,{label:cx[1],sx:lx})]}),c.jsx("div",{hidden:f!==0,style:{paddingTop:24},children:c.jsx(M$,{carouselImages:n.carouselImages,illustrationUrl:n.illustrationUrl,overviewHelpHeading:n.overviewHelpHeading,showScheduleCall:n.showScheduleCall,templateDescription:n.templateDescription,features:n.features,supportLinks:n.supportLinks,appName:n.name})}),c.jsx("div",{hidden:f!==1,style:{paddingTop:24},children:c.jsx(Ax,{schema:n.configuration??N$,controller:u})})]})})},R$=({carouselImages:e,illustrationUrl:t,overviewHelpHeading:n,showScheduleCall:r,templateDescription:o,features:a,apiList:s,appType:l,supportLinks:i,appName:u})=>{const d=(e??[]).map(({url:I})=>({src:I})),g=(s??[]).filter(({keyName:I,name:B})=>!/webhook/i.test(`${I??""} ${B??""}`));return c.jsxs(ex,{children:[c.jsxs("div",{children:[t?c.jsx(tx,{children:c.jsx("img",{src:t,alt:`${u??"App"} overview`})}):d.length>0&&c.jsx($E,{previewList:d}),o&&c.jsx(A.Typography,{variant:"body2",sx:{color:"var(--connector-admin-text-heading)",marginTop:2},children:c.jsx("span",{dangerouslySetInnerHTML:{__html:o}})}),a&&a.length>0&&c.jsxs(nx,{children:[c.jsx(A.Typography,{sx:{fontWeight:A.theme.typography.fontWeightMedium,fontSize:`${A.theme.typography.body1.fontSize}px`,lineHeight:"24px",letterSpacing:"0.042px",color:"var(--connector-admin-text-primary)",marginBottom:"8px"},children:"Features"}),a.map((I,B)=>c.jsxs(A.Typography,{sx:{fontSize:`${A.theme.typography.body2.fontSize}px`,lineHeight:"20px",color:"var(--connector-admin-text-secondary)"},children:[B+1,". ",I]},B))]}),!(a!=null&&a.length)&&g.length>0&&c.jsx(Zy,{apiList:g,connectorName:u,connectorType:l})]}),c.jsxs(C$,{children:[c.jsx(A.Typography,{variant:"h2",marginBottom:"8px",children:n??zE}),r!==!1&&c.jsx(Pi,{isSettingsPage:!0}),c.jsx(Af,{connectorName:u,supportLinks:i})]})]})},j$=[{label:"Active",enabled:!0},{label:"Inactive",enabled:!1}],V$=({connectorId:e,isEnabled:t,isAuthenticated:n,connectorType:r,connectorName:o})=>{const a=fn(),{sendTrackingEvent:s}=m.useContext(nt),l=xe(Us),i=xe(So),u=xe(xu),[d,g]=m.useState(null),I=(u==null?void 0:u[e])===pe.LOADING,f=[l,i].includes(pe.LOADING)||!n||I,C=E=>{g(null),E!==t&&a(za({id:e,enabled:E})).unwrap().then(()=>{r==="slack"&&s(E?st.SLACK_INTEGRATION_ENABLED:st.SLACK_INTEGRATION_DISABLED,{connector_name:o}),E||lt({message:fu,type:vi})}).catch(()=>{lt({message:Eu,type:Kt})})};return c.jsxs(c.Fragment,{children:[c.jsx(u$,{"aria-haspopup":"menu","aria-expanded":d?"true":void 0,disabled:f,onClick:E=>g(E.currentTarget),endIcon:I?c.jsx(A.CircularProgress,{size:16}):c.jsx(Ef,{size:16}),children:t?"Active":"Inactive"}),c.jsx(A.Menu,{anchorEl:d,open:!!d,onClose:()=>g(null),sx:d$,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:j$.map(E=>c.jsx(A.MenuItem,{selected:E.enabled===t,onClick:()=>C(E.enabled),children:E.label},E.label))})]})},H$={overview:"Overview",authentication:"Authentication",visibility:"Visibility"},G$={title:"Configuration",visibility:!0},W$={textTransform:"none",fontSize:`${A.theme.typography.body1.fontSize}px`,fontWeight:A.theme.typography.fontWeightMedium,letterSpacing:"0.25px",minHeight:"auto",padding:"0",color:"var(--connector-admin-text-tertiary)","&.Mui-selected":{color:"var(--connector-admin-accent)"}},dx=({mode:e})=>{const{availableFeatures:t}=m.useContext(nt);return zt(t,ea)?c.jsx(z$,{mode:e}):c.jsx(k$,{mode:e})},z$=({mode:e})=>{const t=Pt(),n=fn(),{id:r=""}=Kr(),o=xe(Ha),a=xe(jn),s=xe(du),l=xe(So),i=e==="template"?(o==null?void 0:o[r])??null:null,u=e==="connector"?(a==null?void 0:a[r])??null:null;m.useEffect(()=>{var g,I;r&&(e==="template"?(g=o==null?void 0:o[r])!=null&&g.apiList||n(Ga(r)):(I=a==null?void 0:a[r])!=null&&I.apiList||n(Ya(r)))},[r,e,o,a,n]);const d=!!u;return m.useEffect(()=>{e!=="connector"||!r||n(ta())},[r,e,n]),m.useEffect(()=>{e!=="connector"||!r||!d||n(wi(r))},[r,e,d,n]),e==="template"?i!=null&&i.apiList?Su(i.type)?c.jsx(gx,{mode:"template",id:r,headerSource:i}):c.jsx(Bs,{to:`${Se.BASEPATH}${Se.API_VIEW}/${r}`,replace:!0}):s===pe.FAILED?c.jsxs(go,{children:[c.jsxs(iA,{onClick:()=>t(`${Se.BASEPATH}${Se.DASHBOARD}`),children:[c.jsx(AA,{"aria-hidden":!0,width:20,height:20}),"Apps Marketplace"]}),c.jsx(A.Typography,{variant:"h6",sx:{marginTop:2,fontWeight:A.theme.typography.fontWeightSemiBold},children:"Couldn’t load app"}),c.jsxs(A.Typography,{variant:"body2",sx:{color:"var(--connector-admin-text-tertiary)"},children:["Template ID “",r,"” couldn’t be fetched. Try refreshing."]})]}):c.jsx(go,{children:c.jsx(ku,{})}):u!=null&&u.apiList?Su(u.type)?c.jsx(gx,{mode:"connector",id:r,headerSource:u}):c.jsx(Bs,{to:`${Se.BASEPATH}${Se.API_VIEW}/${r}?isEdit=true`,replace:!0}):l===pe.FAILED?c.jsxs(go,{children:[c.jsxs(iA,{onClick:()=>t(`${Se.BASEPATH}${Se.DASHBOARD}`),children:[c.jsx(AA,{"aria-hidden":!0,width:20,height:20}),"Apps Marketplace"]}),c.jsx(A.Typography,{variant:"h6",sx:{marginTop:2,fontWeight:A.theme.typography.fontWeightSemiBold},children:"Couldn’t load app"}),c.jsxs(A.Typography,{variant:"body2",sx:{color:"var(--connector-admin-text-tertiary)"},children:["Connector ID “",r,"” couldn’t be fetched. Try refreshing."]})]}):c.jsx(go,{children:c.jsx(ku,{})})},gx=({mode:e,id:t,headerSource:n})=>{const r=Pt(),o=A.useTheme(),[a,s]=yo(),l=m.useMemo(()=>A.createTheme(o,{typography:IE("'Hanken Grotesk', system-ui, sans-serif").typography}),[o]),u=Hy(n.type)({mode:e,id:t}),d=n.logo,g=!(e==="template"&&Di(n.type)),I=e==="connector"||Di(n.type),B=["overview","authentication","visibility"].filter(T=>(T!=="authentication"||I)&&(T!=="visibility"||g)),f=a.get("tab"),C=e==="template"?"overview":n.isAuthenticated?"visibility":"authentication",[E,Q]=m.useState(f&&B.includes(f)?f:B.includes(C)?C:"overview"),h=T=>{Q(T);const L=new URLSearchParams(a);L.set("tab",T),s(L,{replace:!0})},{availableFeatures:p,connectorFunctions:y}=m.useContext(nt),x=()=>g?h("visibility"):r(`${Se.BASEPATH}${Se.CONNECTOR_SETTINGS}/${t}`),w=AJ(n.type)&&zt(p,ea)&&typeof(y==null?void 0:y.openCopilot)=="function",v=e!=="connector"?null:n.isAuthenticated?{status:"connected",label:"Connected"}:n.authPending?null:{status:"failed",label:"Authentication failed"},b=()=>{var T;(T=y==null?void 0:y.openCopilot)==null||T.call(y,{app:n.type,connectorId:t,name:n.name})};return c.jsx(A.HiverProvider,{theme:l,children:c.jsxs(go,{children:[c.jsxs(iA,{onClick:()=>r(`${Se.BASEPATH}${Se.DASHBOARD}`),children:[c.jsx(AA,{"aria-hidden":!0,width:20,height:20}),"Apps Marketplace"]}),c.jsxs(df,{children:[c.jsxs(gf,{children:[d&&c.jsx(Yb,{children:c.jsx(Jb,{children:c.jsx("img",{src:d,alt:n.name})})}),c.jsxs(UU,{children:[c.jsxs($U,{children:[c.jsx(A.Typography,{sx:{fontWeight:A.theme.typography.fontWeightMedium,fontSize:`${A.theme.typography.h1.fontSize}px`,lineHeight:"32px",letterSpacing:"0.2px",color:"var(--connector-admin-app-title)"},children:n.name}),v&&c.jsx(l$,{"data-status":v.status,children:v.label})]}),c.jsx(A.Typography,{sx:{fontWeight:A.theme.typography.fontWeightRegular,fontSize:`${A.theme.typography.body1.fontSize}px`,lineHeight:"20px",color:"var(--connector-admin-text-secondary)"},children:n.description})]})]}),e==="template"&&(w||E==="overview")&&c.jsx(Kb,{children:w?c.jsx($b,{variant:"contained",disableElevation:!0,onClick:b,children:"Setup with AI"}):c.jsx(KU,{variant:"contained",disableElevation:!0,onClick:x,children:"Start setup"})}),e==="connector"&&c.jsxs(Kb,{children:[c.jsx(V$,{connectorId:t,isEnabled:!!n.isEnabled,isAuthenticated:!!n.isAuthenticated,connectorType:n.type,connectorName:n.name}),w&&c.jsxs(c.Fragment,{children:[c.jsx(g$,{role:"separator","aria-orientation":"vertical"}),c.jsx($b,{variant:"contained",disableElevation:!0,onClick:b,children:"Setup with AI"})]})]})]}),c.jsx(A.Tabs,{value:E,onChange:(T,L)=>h(L),TabIndicatorProps:{sx:{backgroundColor:"var(--connector-admin-accent)",height:"2px"}},sx:{marginTop:4,minHeight:"auto",width:"100%",borderBottom:"1px solid var(--connector-admin-border-strong)"},children:B.map(T=>c.jsx(A.Tab,{value:T,label:H$[T],sx:W$,className:"border-b-0!"},T))}),c.jsx("div",{hidden:E!=="overview",style:{paddingTop:24},children:c.jsx(R$,{carouselImages:n.carouselImages,illustrationUrl:n.illustrationUrl,overviewHelpHeading:n.overviewHelpHeading,showScheduleCall:n.showScheduleCall,templateDescription:n.templateDescription,features:n.features,apiList:n.apiList,appType:n.type,supportLinks:n.supportLinks,appName:n.name})}),I&&c.jsx(E$,{hidden:E!=="authentication",style:{paddingTop:24},children:c.jsx(lf,{connectorData:n,isEdit:e==="connector",hideAuthFailedAlert:!0})}),c.jsx("div",{hidden:E!=="visibility",style:{paddingTop:24},children:e==="connector"&&Di(n.type)?c.jsx(Vb,{connectorData:n}):c.jsx(Ax,{schema:n.configuration??G$,controller:u})})]})})},Cx=()=>{const e=Pt();return c.jsxs(A.Stack,{alignItems:"center",gap:2,sx:{padding:6},children:[c.jsx(A.Typography,{variant:"h6",children:"Page not found"}),c.jsx(A.Button,{size:"small",onClick:()=>e(`${Se.BASEPATH}${Se.DASHBOARD}`),children:"Go to Apps"})]})},Ex=[{errorElement:c.jsx(Cx,{}),children:[{path:Se.BASEPATH,element:c.jsx(Xy,{})},{path:Se.DASHBOARD,element:c.jsx(Xy,{})},{path:Se.AUTH_SUCCESS,element:c.jsx(YU,{})},{path:`${Se.API_VIEW}/:id`,element:c.jsx(vq,{})},{path:`${Se.CONNECTOR_SETTINGS}/:id`,element:c.jsx(HU,{})},{path:`${Se.NATIVE_INTEGRATION}/:id`,element:c.jsx(JU,{})},{path:`${Se.CONNECTOR_INITIAL_SETUP}/:id`,element:c.jsx(ZU,{})},{path:`${Se.APP_DETAIL}/:id`,element:c.jsx(dx,{mode:"connector"})},{path:`${Se.TEMPLATE_APP}/:id`,element:c.jsx(dx,{mode:"template"})},{path:"*",element:c.jsx(Cx,{})}]}],Y$=Ex[0].children.filter(e=>e.path!=="*"),J$=(e,t)=>Vh(t?Ex:Y$,{basename:e}),X$=({basename:e="/",metaData:t,userId:n})=>{var s;const{availableFeatures:r}=m.useContext(nt),o=zt(r,ea),a=m.useMemo(()=>J$(e,o),[e,o]);return(s=t==null?void 0:t.templateUpdates)!=null&&s.version&&n&&(GX(t.templateUpdates.version),JX(n)),c.jsx(zh,{router:a})},q$="internal-chat",Z$=A.styled(A.Box)`
4247
+ `,M$=({carouselImages:e,illustrationUrl:t,overviewHelpHeading:n,showScheduleCall:r,templateDescription:o,features:a,supportLinks:s,appName:l})=>{const i=(e??[]).map(({url:u})=>({src:u}));return c.jsxs(P$,{children:[c.jsxs("div",{children:[t?c.jsx(tx,{children:c.jsx("img",{src:t,alt:`${l??"App"} overview`})}):i.length>0&&c.jsx($E,{previewList:i}),o&&c.jsx(A.Typography,{variant:"body2",sx:{color:"var(--connector-admin-text-heading)",marginTop:2},children:c.jsx("span",{dangerouslySetInnerHTML:{__html:o}})}),a&&a.length>0&&c.jsxs(nx,{children:[c.jsx(A.Typography,{sx:{fontWeight:A.theme.typography.fontWeightMedium,fontSize:`${A.theme.typography.body1.fontSize}px`,lineHeight:"24px",letterSpacing:"0.042px",color:"var(--connector-admin-text-primary)",marginBottom:"8px"},children:"Features"}),a.map((u,d)=>c.jsxs(A.Typography,{sx:{fontSize:`${A.theme.typography.body2.fontSize}px`,lineHeight:"20px",color:"var(--connector-admin-text-secondary)"},children:[d+1,". ",u]},d))]})]}),c.jsxs(A.Stack,{gap:"12px",children:[c.jsx(A.Typography,{variant:"h2",marginBottom:"8px",children:n??zE}),r!==!1&&c.jsx(Pi,{isSettingsPage:!0}),c.jsx(Af,{connectorName:l,supportLinks:s})]})]})},ix=e=>jE(e,!1),cx=["Overview","Visibility"],N$={title:"Configuration",visibility:!0},lx={textTransform:"none",fontSize:`${A.theme.typography.body1.fontSize}px`,fontWeight:A.theme.typography.fontWeightMedium,letterSpacing:"0.25px",minHeight:"auto",padding:"0",color:"var(--connector-admin-text-tertiary)","&.Mui-selected":{color:"var(--connector-admin-accent)"}},k$=({mode:e})=>{const t=Pt(),n=fn(),{id:r=""}=Kr(),o=xe(Ha),a=xe(jn),s=xe(du),l=xe(So),i=e==="template"?(o==null?void 0:o[r])??null:null,u=e==="connector"?(a==null?void 0:a[r])??null:null;return m.useEffect(()=>{var d,g;r&&(e==="template"?(d=o==null?void 0:o[r])!=null&&d.apiList||n(Ga(r)):(g=a==null?void 0:a[r])!=null&&g.apiList||n(Ya(r)))},[r,e,o,a,n]),e==="template"?i!=null&&i.apiList?ix(i.type)?c.jsx(ux,{mode:"template",id:r,headerSource:i}):c.jsx(Bs,{to:`${Se.BASEPATH}${Se.API_VIEW}/${r}`,replace:!0}):s===pe.FAILED?c.jsxs(go,{children:[c.jsxs(iA,{onClick:()=>t(`${Se.BASEPATH}${Se.DASHBOARD}`),children:[c.jsx(AA,{"aria-hidden":!0,width:20,height:20}),"Apps Marketplace"]}),c.jsx(A.Typography,{variant:"h6",sx:{marginTop:2,fontWeight:A.theme.typography.fontWeightSemiBold},children:"Couldn’t load app"}),c.jsxs(A.Typography,{variant:"body2",sx:{color:"var(--connector-admin-text-tertiary)"},children:["Template ID “",r,"” couldn’t be fetched. Try refreshing."]})]}):c.jsx(go,{children:c.jsx(ku,{})}):u!=null&&u.apiList?ix(u.type)?c.jsx(ux,{mode:"connector",id:r,headerSource:u}):c.jsx(Bs,{to:`${Se.BASEPATH}${Se.API_VIEW}/${r}?isEdit=true`,replace:!0}):l===pe.FAILED?c.jsxs(go,{children:[c.jsxs(iA,{onClick:()=>t(`${Se.BASEPATH}${Se.DASHBOARD}`),children:[c.jsx(AA,{"aria-hidden":!0,width:20,height:20}),"Apps Marketplace"]}),c.jsx(A.Typography,{variant:"h6",sx:{marginTop:2,fontWeight:A.theme.typography.fontWeightSemiBold},children:"Couldn’t load app"}),c.jsxs(A.Typography,{variant:"body2",sx:{color:"var(--connector-admin-text-tertiary)"},children:["Connector ID “",r,"” couldn’t be fetched. Try refreshing."]})]}):c.jsx(go,{children:c.jsx(ku,{})})},ux=({mode:e,id:t,headerSource:n})=>{const r=Pt(),o=A.useTheme(),[a,s]=yo(),l=m.useMemo(()=>A.createTheme(o,{typography:IE("'Hanken Grotesk', system-ui, sans-serif").typography}),[o]),u=Hy(n.type)({mode:e,id:t}),d=n.logo,g=a.get("tab"),B=g==="overview"?0:g==="visibility"?1:e==="connector"?1:0,[f,C]=m.useState(B),E=(h,p)=>{C(p);const y=new URLSearchParams(a);y.set("tab",p===1?"visibility":"overview"),s(y,{replace:!0})},Q=()=>E({},1);return c.jsx(A.HiverProvider,{theme:l,children:c.jsxs(go,{children:[c.jsxs(iA,{onClick:()=>r(`${Se.BASEPATH}${Se.DASHBOARD}`),children:[c.jsx(AA,{"aria-hidden":!0,width:20,height:20}),"Apps Marketplace"]}),c.jsxs(df,{children:[c.jsxs(gf,{children:[d&&c.jsx(Yb,{children:c.jsx(Jb,{children:c.jsx("img",{src:d,alt:n.name})})}),c.jsxs(L$,{children:[c.jsx(A.Typography,{sx:{fontWeight:A.theme.typography.fontWeightMedium,fontSize:`${A.theme.typography.h1.fontSize}px`,lineHeight:"32px",letterSpacing:"0.2px",color:"var(--connector-admin-app-title)"},children:n.name}),c.jsx(A.Typography,{sx:{fontWeight:A.theme.typography.fontWeightRegular,fontSize:`${A.theme.typography.body1.fontSize}px`,lineHeight:"20px",color:"var(--connector-admin-text-secondary)"},children:n.description})]})]}),e==="template"&&f===0&&c.jsx(F$,{variant:"contained",disableElevation:!0,onClick:Q,children:"Start setup"}),e==="connector"&&c.jsx(O$,{connectorId:t,isEnabled:!!n.isEnabled,isAuthenticated:!!n.isAuthenticated,connectorType:n.type,connectorName:n.name})]}),c.jsxs(A.Tabs,{value:f,onChange:E,TabIndicatorProps:{sx:{backgroundColor:"var(--connector-admin-accent)",height:"2px"}},sx:{marginTop:4,minHeight:"auto",width:"100%",borderBottom:"1px solid var(--connector-admin-border-strong)"},children:[c.jsx(A.Tab,{label:cx[0],sx:lx}),c.jsx(A.Tab,{label:cx[1],sx:lx})]}),c.jsx("div",{hidden:f!==0,style:{paddingTop:24},children:c.jsx(M$,{carouselImages:n.carouselImages,illustrationUrl:n.illustrationUrl,overviewHelpHeading:n.overviewHelpHeading,showScheduleCall:n.showScheduleCall,templateDescription:n.templateDescription,features:n.features,supportLinks:n.supportLinks,appName:n.name})}),c.jsx("div",{hidden:f!==1,style:{paddingTop:24},children:c.jsx(Ax,{schema:n.configuration??N$,controller:u})})]})})},R$=({carouselImages:e,illustrationUrl:t,overviewHelpHeading:n,showScheduleCall:r,templateDescription:o,features:a,apiList:s,appType:l,supportLinks:i,appName:u})=>{const d=(e??[]).map(({url:I})=>({src:I})),g=(s??[]).filter(({keyName:I,name:B})=>!/webhook/i.test(`${I??""} ${B??""}`));return c.jsxs(ex,{children:[c.jsxs("div",{children:[t?c.jsx(tx,{children:c.jsx("img",{src:t,alt:`${u??"App"} overview`})}):d.length>0&&c.jsx($E,{previewList:d}),o&&c.jsx(A.Typography,{variant:"body2",sx:{color:"var(--connector-admin-text-heading)",marginTop:2},children:c.jsx("span",{dangerouslySetInnerHTML:{__html:o}})}),a&&a.length>0&&c.jsxs(nx,{children:[c.jsx(A.Typography,{sx:{fontWeight:A.theme.typography.fontWeightMedium,fontSize:`${A.theme.typography.body1.fontSize}px`,lineHeight:"24px",letterSpacing:"0.042px",color:"var(--connector-admin-text-primary)",marginBottom:"8px"},children:"Features"}),a.map((I,B)=>c.jsxs(A.Typography,{sx:{fontSize:`${A.theme.typography.body2.fontSize}px`,lineHeight:"20px",color:"var(--connector-admin-text-secondary)"},children:[B+1,". ",I]},B))]}),!(a!=null&&a.length)&&g.length>0&&c.jsx(Zy,{apiList:g,connectorName:u,connectorType:l})]}),c.jsxs(C$,{children:[c.jsx(A.Typography,{variant:"h2",marginBottom:"8px",children:n??zE}),r!==!1&&c.jsx(Pi,{isSettingsPage:!0}),c.jsx(Af,{connectorName:u,supportLinks:i})]})]})},j$=[{label:"Active",enabled:!0},{label:"Inactive",enabled:!1}],V$=({connectorId:e,isEnabled:t,isAuthenticated:n,connectorType:r,connectorName:o})=>{const a=fn(),{sendTrackingEvent:s}=m.useContext(nt),l=xe(Us),i=xe(So),u=xe(xu),[d,g]=m.useState(null),I=(u==null?void 0:u[e])===pe.LOADING,f=[l,i].includes(pe.LOADING)||!n||I,C=E=>{g(null),E!==t&&a(za({id:e,enabled:E})).unwrap().then(()=>{r==="slack"&&s(E?st.SLACK_INTEGRATION_ENABLED:st.SLACK_INTEGRATION_DISABLED,{connector_name:o}),E||lt({message:fu,type:vi})}).catch(()=>{lt({message:Eu,type:Kt})})};return c.jsxs(c.Fragment,{children:[c.jsx(u$,{"aria-haspopup":"menu","aria-expanded":d?"true":void 0,disabled:f,onClick:E=>g(E.currentTarget),endIcon:I?c.jsx(A.CircularProgress,{size:16}):c.jsx(Ef,{size:16}),children:t?"Active":"Inactive"}),c.jsx(A.Menu,{anchorEl:d,open:!!d,onClose:()=>g(null),sx:d$,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:j$.map(E=>c.jsx(A.MenuItem,{selected:E.enabled===t,onClick:()=>C(E.enabled),children:E.label},E.label))})]})},H$={overview:"Overview",authentication:"Authentication",visibility:"Visibility"},G$={title:"Configuration",visibility:!0},W$={textTransform:"none",fontSize:`${A.theme.typography.body1.fontSize}px`,fontWeight:A.theme.typography.fontWeightMedium,letterSpacing:"0.25px",minHeight:"auto",padding:"0",color:"var(--connector-admin-text-tertiary)","&.Mui-selected":{color:"var(--connector-admin-accent)"}},dx=({mode:e})=>{const{availableFeatures:t}=m.useContext(nt);return zt(t,ea)?c.jsx(z$,{mode:e}):c.jsx(k$,{mode:e})},z$=({mode:e})=>{const t=Pt(),n=fn(),{id:r=""}=Kr(),o=xe(Ha),a=xe(jn),s=xe(du),l=xe(So),i=e==="template"?(o==null?void 0:o[r])??null:null,u=e==="connector"?(a==null?void 0:a[r])??null:null;m.useEffect(()=>{var g,I;r&&(e==="template"?(g=o==null?void 0:o[r])!=null&&g.apiList||n(Ga(r)):(I=a==null?void 0:a[r])!=null&&I.apiList||n(Ya(r)))},[r,e,o,a,n]);const d=!!u;return m.useEffect(()=>{e!=="connector"||!r||n(ta())},[r,e,n]),m.useEffect(()=>{e!=="connector"||!r||!d||n(wi(r))},[r,e,d,n]),e==="template"?i!=null&&i.apiList?Su(i.type)?c.jsx(gx,{mode:"template",id:r,headerSource:i}):c.jsx(Bs,{to:`${Se.BASEPATH}${Se.API_VIEW}/${r}`,replace:!0}):s===pe.FAILED?c.jsxs(go,{children:[c.jsxs(iA,{onClick:()=>t(`${Se.BASEPATH}${Se.DASHBOARD}`),children:[c.jsx(AA,{"aria-hidden":!0,width:20,height:20}),"Apps Marketplace"]}),c.jsx(A.Typography,{variant:"h6",sx:{marginTop:2,fontWeight:A.theme.typography.fontWeightSemiBold},children:"Couldn’t load app"}),c.jsxs(A.Typography,{variant:"body2",sx:{color:"var(--connector-admin-text-tertiary)"},children:["Template ID “",r,"” couldn’t be fetched. Try refreshing."]})]}):c.jsx(go,{children:c.jsx(ku,{})}):u!=null&&u.apiList?Su(u.type)?c.jsx(gx,{mode:"connector",id:r,headerSource:u}):c.jsx(Bs,{to:`${Se.BASEPATH}${Se.API_VIEW}/${r}?isEdit=true`,replace:!0}):l===pe.FAILED?c.jsxs(go,{children:[c.jsxs(iA,{onClick:()=>t(`${Se.BASEPATH}${Se.DASHBOARD}`),children:[c.jsx(AA,{"aria-hidden":!0,width:20,height:20}),"Apps Marketplace"]}),c.jsx(A.Typography,{variant:"h6",sx:{marginTop:2,fontWeight:A.theme.typography.fontWeightSemiBold},children:"Couldn’t load app"}),c.jsxs(A.Typography,{variant:"body2",sx:{color:"var(--connector-admin-text-tertiary)"},children:["Connector ID “",r,"” couldn’t be fetched. Try refreshing."]})]}):c.jsx(go,{children:c.jsx(ku,{})})},gx=({mode:e,id:t,headerSource:n})=>{const r=Pt(),o=A.useTheme(),[a,s]=yo(),l=m.useMemo(()=>A.createTheme(o,{typography:IE("'Hanken Grotesk', system-ui, sans-serif").typography}),[o]),u=Hy(n.type)({mode:e,id:t}),d=n.logo,g=!(e==="template"&&Di(n.type)),I=e==="connector"||Di(n.type),B=["overview","authentication","visibility"].filter(T=>(T!=="authentication"||I)&&(T!=="visibility"||g)),f=a.get("tab"),C=e==="template"?"overview":n.isAuthenticated?"visibility":"authentication",[E,Q]=m.useState(f&&B.includes(f)?f:B.includes(C)?C:"overview"),h=T=>{Q(T);const L=new URLSearchParams(a);L.set("tab",T),s(L,{replace:!0})},{availableFeatures:p,connectorFunctions:y}=m.useContext(nt),x=()=>g?h("visibility"):r(`${Se.BASEPATH}${Se.CONNECTOR_SETTINGS}/${t}`),w=AJ(n.type)&&zt(p,ea)&&typeof(y==null?void 0:y.openCopilot)=="function",v=e!=="connector"?null:n.isAuthenticated?{status:"connected",label:"Connected"}:n.authPending?null:{status:"failed",label:"Authentication failed"},b=()=>{var T;(T=y==null?void 0:y.openCopilot)==null||T.call(y,{app:n.type,connectorId:t,name:n.name})};return c.jsx(A.HiverProvider,{theme:l,children:c.jsxs(go,{children:[c.jsxs(iA,{onClick:()=>r(`${Se.BASEPATH}${Se.DASHBOARD}`),children:[c.jsx(AA,{"aria-hidden":!0,width:20,height:20}),"Apps Marketplace"]}),c.jsxs(df,{children:[c.jsxs(gf,{children:[d&&c.jsx(Yb,{children:c.jsx(Jb,{children:c.jsx("img",{src:d,alt:n.name})})}),c.jsxs(UU,{children:[c.jsxs($U,{children:[c.jsx(A.Typography,{sx:{fontWeight:A.theme.typography.fontWeightMedium,fontSize:`${A.theme.typography.h1.fontSize}px`,lineHeight:"32px",letterSpacing:"0.2px",color:"var(--connector-admin-app-title)"},children:n.name}),v&&c.jsx(l$,{"data-status":v.status,children:v.label})]}),c.jsx(A.Typography,{sx:{fontWeight:A.theme.typography.fontWeightRegular,fontSize:`${A.theme.typography.body1.fontSize}px`,lineHeight:"20px",color:"var(--connector-admin-text-secondary)"},children:n.description})]})]}),e==="template"&&(w||E==="overview")&&c.jsx(Kb,{children:w?c.jsx($b,{variant:"contained",disableElevation:!0,onClick:b,children:"Setup with AI"}):c.jsx(KU,{variant:"contained",disableElevation:!0,onClick:x,children:"Start setup"})}),e==="connector"&&c.jsxs(Kb,{children:[c.jsx(V$,{connectorId:t,isEnabled:!!n.isEnabled,isAuthenticated:!!n.isAuthenticated,connectorType:n.type,connectorName:n.name}),w&&c.jsxs(c.Fragment,{children:[c.jsx(g$,{role:"separator","aria-orientation":"vertical"}),c.jsx($b,{variant:"contained",disableElevation:!0,onClick:b,children:"Setup with AI"})]})]})]}),c.jsx(A.Tabs,{value:E,onChange:(T,L)=>h(L),TabIndicatorProps:{sx:{backgroundColor:"var(--connector-admin-accent)",height:"2px"}},sx:{marginTop:4,minHeight:"auto",width:"100%",boxShadow:"inset 0 -2px 0 var(--connector-admin-border-strong)"},children:B.map(T=>c.jsx(A.Tab,{value:T,label:H$[T],sx:W$,className:"border-b-0!"},T))}),c.jsx("div",{hidden:E!=="overview",style:{paddingTop:24},children:c.jsx(R$,{carouselImages:n.carouselImages,illustrationUrl:n.illustrationUrl,overviewHelpHeading:n.overviewHelpHeading,showScheduleCall:n.showScheduleCall,templateDescription:n.templateDescription,features:n.features,apiList:n.apiList,appType:n.type,supportLinks:n.supportLinks,appName:n.name})}),I&&c.jsx(E$,{hidden:E!=="authentication",style:{paddingTop:24},children:c.jsx(lf,{connectorData:n,isEdit:e==="connector",hideAuthFailedAlert:!0})}),c.jsx("div",{hidden:E!=="visibility",style:{paddingTop:24},children:e==="connector"&&Di(n.type)?c.jsx(Vb,{connectorData:n}):c.jsx(Ax,{schema:n.configuration??G$,controller:u})})]})})},Cx=()=>{const e=Pt();return c.jsxs(A.Stack,{alignItems:"center",gap:2,sx:{padding:6},children:[c.jsx(A.Typography,{variant:"h6",children:"Page not found"}),c.jsx(A.Button,{size:"small",onClick:()=>e(`${Se.BASEPATH}${Se.DASHBOARD}`),children:"Go to Apps"})]})},Ex=[{errorElement:c.jsx(Cx,{}),children:[{path:Se.BASEPATH,element:c.jsx(Xy,{})},{path:Se.DASHBOARD,element:c.jsx(Xy,{})},{path:Se.AUTH_SUCCESS,element:c.jsx(YU,{})},{path:`${Se.API_VIEW}/:id`,element:c.jsx(vq,{})},{path:`${Se.CONNECTOR_SETTINGS}/:id`,element:c.jsx(HU,{})},{path:`${Se.NATIVE_INTEGRATION}/:id`,element:c.jsx(JU,{})},{path:`${Se.CONNECTOR_INITIAL_SETUP}/:id`,element:c.jsx(ZU,{})},{path:`${Se.APP_DETAIL}/:id`,element:c.jsx(dx,{mode:"connector"})},{path:`${Se.TEMPLATE_APP}/:id`,element:c.jsx(dx,{mode:"template"})},{path:"*",element:c.jsx(Cx,{})}]}],Y$=Ex[0].children.filter(e=>e.path!=="*"),J$=(e,t)=>Vh(t?Ex:Y$,{basename:e}),X$=({basename:e="/",metaData:t,userId:n})=>{var s;const{availableFeatures:r}=m.useContext(nt),o=zt(r,ea),a=m.useMemo(()=>J$(e,o),[e,o]);return(s=t==null?void 0:t.templateUpdates)!=null&&s.version&&n&&(GX(t.templateUpdates.version),JX(n)),c.jsx(zh,{router:a})},q$="internal-chat",Z$=A.styled(A.Box)`
4248
4248
  padding: 43px 0px 0 35px;
4249
4249
  box-sizing: border-box;
4250
4250
  width: 100%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiver/connector-admin",
3
- "version": "4.22.0-appsActivation-beta.13",
3
+ "version": "4.22.0-appsActivation-beta.14",
4
4
  "main": "index.es.js",
5
5
  "module": "index.es.js",
6
6
  "types": "index.d.ts",