@hiver/connector-admin 4.7.0 → 4.7.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 CHANGED
@@ -34364,7 +34364,10 @@ const IW = ({
34364
34364
  }
34365
34365
  ) })
34366
34366
  ] });
34367
- }, fW = (e, t) => typeof e[t] == "boolean", BW = (e, t) => typeof e[t] == "object" && typeof e[t].enabled == "boolean", hW = (e) => {
34367
+ }, fW = (e, t) => typeof e[t] == "boolean", BW = (e, t) => {
34368
+ var n;
34369
+ return typeof e[t] == "object" && typeof ((n = e[t]) == null ? void 0 : n.enabled) == "boolean";
34370
+ }, hW = (e) => {
34368
34371
  const t = {};
34369
34372
  for (const n in e)
34370
34373
  BW(e, n) ? t[n] = e[n] : fW(e, n) && (t[n] = {
package/index.umd.js CHANGED
@@ -3125,7 +3125,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
3125
3125
  `,YH=g.styled(g.icons.OpenInNew)`
3126
3126
  height: 18px;
3127
3127
  width: 18px;
3128
- `,JH=({upgradeGuideContent:e,upgradeGuideLink:t})=>u.jsxs(VH,{children:[u.jsxs(g.Stack,{marginBottom:"20px",children:[u.jsxs(g.Stack,{direction:"row",padding:"8px 0",gap:"4px",alignItems:"center",children:[u.jsx(HH,{}),u.jsx(g.Typography,{variant:"body1_medium",color:g.theme.palette.gray.black,children:ZV})]}),u.jsx(g.Typography,{variant:"body2",children:KV})]}),u.jsx(g.Typography,{variant:"body2_medium",marginBottom:"8px",color:g.theme.palette.gray.black,children:$V}),u.jsx(zH,{variant:"body2",dangerouslySetInnerHTML:{__html:e}}),t?u.jsxs(WH,{target:"_blank",underline:"none",href:t,children:[u.jsx(YH,{}),eH]}):null]}),Gm=(e,t)=>{const n=t.authType===$a,r=t.authType===Cm,A=t.authType===ps;if(!e||!e.data)return{authUrl:"",authStatus:r?nt.API_KEY_FAILED:n?nt.BASIC_AUTH_FAILED:A?nt.OAUTH1_FAILED:nt.OAUTH_FAILED};const o=e.data;return r?{authUrl:"",id:o.id,authStatus:nt.API_KEY_SUCCESS}:n?{authUrl:"",id:o.id,authStatus:nt.BASIC_AUTH_SUCCESS}:A?{authUrl:"",id:o.id,authStatus:nt.OAUTH1_SUCCESS}:o.authorizationUrl?{authUrl:o.authorizationUrl,id:o.id,authStatus:nt.PENDING}:{authUrl:"",id:"",authStatus:nt.OAUTH_FAILED}},XH=async e=>{try{const t=await Ke({url:AM,method:cn.POST,data:e});return Gm(t,e.authDetails)}catch(t){return Promise.reject(t)}},UH=async(e,t)=>{try{const n=sM.replace("{{id}}",t),r=await Ke({url:n,method:cn.PATCH,data:e});return Gm(r,e.authDetails)}catch(n){return Promise.reject(n)}},qH=({connectorId:e,onSuccess:t})=>{const n=Vo(),r=y.useMemo(()=>["authDetails",{connectorId:e}],[e]),{data:A}=rl({queryKey:r,queryFn:()=>Promise.resolve({authUrl:"",authStatus:nt.IDLE,id:""}),enabled:!1}),o=Al({mutationFn:a=>"connectorId"in a?UH(a.data,a.connectorId):XH(a.data),onSuccess:a=>{n.setQueryData(r,a),t==null||t()}});y.useEffect(()=>()=>{n.removeQueries({queryKey:r,exact:!0})},[n,r]);const s=y.useCallback(a=>{n.setQueryData(r,i=>i&&{...i,authStatus:a})},[r,n]);return{mutate:o.mutate,isLoading:o.isPending,data:A,mutateStatus:s}},ZH=async e=>{var t;try{const n=await Ke({url:RA(iM,{connectorId:e}),method:cn.GET});return!n||!((t=n==null?void 0:n.data)!=null&&t.status)?{status:"failed"}:n==null?void 0:n.data}catch(n){return Promise.reject(n)}},KH=({connectorId:e,enabled:t=!1})=>{const n=Vo(),r=y.useMemo(()=>["authSuccessStatus",{connectorId:e}],[e]),A=rl({queryKey:r,queryFn:()=>ZH(e),refetchInterval:o=>{var s,a;return((s=o.state.data)==null?void 0:s.status)==="failed"||((a=o.state.data)==null?void 0:a.status)==="success"?!1:500},enabled:t,refetchOnWindowFocus:!1,refetchIntervalInBackground:!0});return y.useEffect(()=>()=>{n.removeQueries({queryKey:r,exact:!0})},[n,r]),A},Vm=({connectorData:e})=>{const{sendTrackingEvent:t,availableFeatures:n}=y.useContext(_t),[r,A]=y.useState(!1),o=Fe(qa),s=Fe(Y0),a=y.useRef(null),i=on(),{id:l=""}=TA(),[c]=Yo(),d=c.get("isEdit")==="true",f=!!(e!=null&&e.showUpgradeButton),B=xr(n,UF),{data:I,mutateStatus:C,isLoading:E,mutate:p}=qH({connectorId:l,onSuccess:()=>{B&&A(!0)}}),h=KH({connectorId:(I==null?void 0:I.id)||"",enabled:r}),{status:Q}=h.data||{},m=(I==null?void 0:I.authStatus)||nt.IDLE,v=(I==null?void 0:I.authUrl)||"",x=wr();y.useEffect(()=>()=>{x(uM())},[x]),y.useEffect(()=>{let b,T;const j=F=>{a.current&&F.origin===window.location.origin&&(F.data===wm||F.data===hC)&&(clearTimeout(b),a.current.close(),a.current=null,C(F.data===hC?nt.OAUTH_SUCCESS:nt.OAUTH_FAILED))};try{if(v){a.current=window.open(v,"_blank");const F=5*60*1e3;b=setTimeout(()=>{var X;(X=a.current)==null||X.close(),a.current=null,C(nt.OAUTH_FAILED)},F),T=setInterval(()=>{var X;(X=a.current)!=null&&X.closed&&(clearInterval(T),a.current=null,C(nt.OAUTH_FAILED))},500),window.addEventListener("message",j)}}catch(F){console.log("Error in Authentication",F)}return()=>{window.removeEventListener("message",j),clearTimeout(b),clearInterval(T)}},[v,x,C]),y.useEffect(()=>{Q&&Q!=="pending"&&a.current&&B&&(a.current.close(),a.current=null,C(Q==="success"?nt.OAUTH_SUCCESS:nt.OAUTH_FAILED))},[Q,C,B]),y.useEffect(()=>{switch((m===nt.OAUTH1_FAILED||m===nt.OAUTH_FAILED||m===nt.API_KEY_FAILED||m===nt.BASIC_AUTH_FAILED)&&i(Ye.BASEPATH),(m===nt.OAUTH1_SUCCESS||m===nt.OAUTH_SUCCESS||m===nt.API_KEY_SUCCESS||m===nt.BASIC_AUTH_SUCCESS)&&I!=null&&I.id&&i(d?Ye.BASEPATH:`${Ye.BASEPATH}${Ye.CONNECTOR_INITIAL_SETUP}/${l}?connectorId=${I.id}`),m){case nt.BASIC_AUTH_SUCCESS:case nt.OAUTH1_SUCCESS:case nt.OAUTH_SUCCESS:{Qn({message:f?Tm:WV,type:Bs}),t(tt.CONNECTOR_AUTH_SUCCESS,{connector_name:e==null?void 0:e.name});break}case nt.BASIC_AUTH_FAILED:case nt.OAUTH1_FAILED:case nt.OAUTH_FAILED:{Qn({message:f?Sm:zV,type:qr});break}case nt.REQUEST_FAILED:{Qn({message:oC,type:qr});break}case nt.API_KEY_SUCCESS:{Qn({message:f?Tm:JV,type:Bs}),t(tt.CONNECTOR_AUTH_SUCCESS,{connector_name:e==null?void 0:e.name});break}case nt.API_KEY_FAILED:{Qn({message:f?Sm:oC,type:qr});break}}},[m,i,f,l,d,e==null?void 0:e.name,t,I==null?void 0:I.id]);const w=o===pe.LOADING||s===pe.LOADING;return u.jsxs(GH,{direction:"row",id:"connectors-auth-page",children:[u.jsx("div",{className:"flex flex-col",children:u.jsx(SH,{connectorId:l,isEdit:d,connectorData:e,authStatus:m,isLoading:w,authMutate:p,isAuthPending:E})}),u.jsxs(g.Stack,{gap:"36px",width:"322px",className:"connector-auth-help",children:[e!=null&&e.upgradeGuideContent?u.jsx(JH,{upgradeGuideContent:e.upgradeGuideContent,upgradeGuideLink:e.upgradeGuideLink}):null,u.jsxs(g.Stack,{gap:"12px",children:[u.jsx(g.Typography,{variant:"h2",marginBottom:"8px",children:aG}),d?null:u.jsx(EC,{isSettingsPage:!0}),u.jsx(jH,{connectorName:e==null?void 0:e.name,supportLinks:e==null?void 0:e.supportLinks})]})]})]})},$H="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_139_3606)'%3e%3cpath%20d='M9.00012%2011.0127C8.46629%2011.0127%207.95432%2010.8006%207.57685%2010.4232C7.19937%2010.0457%206.9873%209.53371%206.9873%208.99988C6.9873%208.46605%207.19937%207.95408%207.57685%207.5766C7.95432%207.19912%208.46629%206.98706%209.00012%206.98706C9.53395%206.98706%2010.0459%207.19912%2010.4234%207.5766C10.8009%207.95408%2011.0129%208.46605%2011.0129%208.99988C11.0129%209.53371%2010.8009%2010.0457%2010.4234%2010.4232C10.0459%2010.8006%209.53395%2011.0127%209.00012%2011.0127ZM9.00012%207.99347C8.73321%207.99347%208.47722%208.0995%208.28848%208.28824C8.09975%208.47698%207.99371%208.73296%207.99371%208.99988C7.99371%209.26679%208.09975%209.52278%208.28848%209.71152C8.47722%209.90025%208.73321%2010.0063%209.00012%2010.0063C9.26704%2010.0063%209.52302%209.90025%209.71176%209.71152C9.9005%209.52278%2010.0065%209.26679%2010.0065%208.99988C10.0065%208.73296%209.9005%208.47698%209.71176%208.28824C9.52302%208.0995%209.26704%207.99347%209.00012%207.99347Z'%20fill='%23344A64'/%3e%3ccircle%20cx='2.96555'%20cy='15.1248'%20r='1.22238'%20fill='%23FFE250'/%3e%3ccircle%20cx='15.133'%20cy='15.1248'%20r='1.22238'%20fill='%23FFE250'/%3e%3ccircle%20cx='15.133'%20cy='2.89426'%20r='1.22238'%20fill='%23FFE250'/%3e%3ccircle%20cx='2.96555'%20cy='2.89426'%20r='1.22238'%20fill='%23FFE250'/%3e%3cpath%20d='M11.4468%2010.5942L14.0483%2013.1948C14.3509%2013.0275%2014.6901%2012.9363%2015.0366%2012.9312H15.0386C15.4553%2012.9312%2015.863%2013.0551%2016.2095%2013.2866C16.5558%2013.5181%2016.8254%2013.8471%2016.9849%2014.2319C17.1444%2014.617%2017.1863%2015.0409%2017.105%2015.4497C17.0236%2015.8584%2016.8235%2016.2341%2016.5288%2016.5288C16.2341%2016.8235%2015.8584%2017.0236%2015.4497%2017.105C15.0409%2017.1863%2014.617%2017.1444%2014.2319%2016.9849C13.8471%2016.8254%2013.5181%2016.5558%2013.2866%2016.2095C13.0551%2015.863%2012.9312%2015.4553%2012.9312%2015.0386V15.0366C12.9363%2014.6898%2013.0272%2014.3501%2013.1948%2014.0474L10.604%2011.437L10.5376%2011.3696L11.3804%2010.5269L11.4468%2010.5942ZM2.96143%2014.1265C2.7196%2014.1265%202.48789%2014.223%202.31689%2014.394C2.14594%2014.5651%202.04932%2014.7968%202.04932%2015.0386C2.04935%2015.2804%202.1459%2015.5121%202.31689%2015.6831C2.48789%2015.8541%202.7196%2015.9507%202.96143%2015.9507C3.20324%2015.9507%203.43494%2015.8541%203.60596%2015.6831C3.77696%2015.5121%203.8735%2015.2804%203.87354%2015.0386C3.87354%2014.7967%203.77698%2014.5651%203.60596%2014.394C3.43493%2014.223%203.20329%2014.1265%202.96143%2014.1265ZM15.0386%2014.1265C14.7967%2014.1265%2014.5651%2014.223%2014.394%2014.394C14.223%2014.5651%2014.1265%2014.7967%2014.1265%2015.0386C14.1265%2015.2804%2014.223%2015.5121%2014.394%2015.6831C14.5651%2015.8541%2014.7968%2015.9507%2015.0386%2015.9507C15.2804%2015.9507%2015.5121%2015.8541%2015.6831%2015.6831C15.8541%2015.5121%2015.9507%2015.2804%2015.9507%2015.0386C15.9507%2014.7968%2015.8541%2014.5651%2015.6831%2014.394C15.5121%2014.223%2015.2804%2014.1265%2015.0386%2014.1265ZM14.2319%201.01514C14.617%200.855643%2015.0409%200.81371%2015.4497%200.89502C15.8584%200.976353%2016.2341%201.17653%2016.5288%201.47119C16.8235%201.76585%2017.0236%202.1416%2017.105%202.55029C17.1863%202.95906%2017.1444%203.38301%2016.9849%203.76807C16.8254%204.15289%2016.5558%204.48189%2016.2095%204.71338C15.863%204.94491%2015.4553%205.06882%2015.0386%205.06885H15.0366C14.69%205.06369%2014.351%204.97171%2014.0483%204.8042L11.437%207.41162L11.3696%207.479L11.3022%207.41064L10.5933%206.68604L10.5278%206.61963L10.5942%206.55322L13.1948%203.95068C13.0277%203.64828%2012.9363%203.3096%2012.9312%202.96338V2.96143C12.9312%202.54469%2013.0551%202.13703%2013.2866%201.79053C13.5181%201.44423%2013.8471%201.17459%2014.2319%201.01514ZM2.55029%200.89502C2.95906%200.81371%203.38301%200.855643%203.76807%201.01514C4.15289%201.17459%204.48189%201.44422%204.71338%201.79053C4.9449%202.13703%205.06882%202.54469%205.06885%202.96143V2.96338C5.06369%203.31005%204.97171%203.64897%204.8042%203.95166L7.396%206.56299L7.4624%206.63037L6.61963%207.47314L6.55322%207.40576L3.95068%204.8042C3.64818%204.97145%203.30976%205.0637%202.96338%205.06885H2.96143C2.54469%205.06882%202.13703%204.9449%201.79053%204.71338C1.44422%204.48189%201.17459%204.15289%201.01514%203.76807C0.855643%203.38301%200.81371%202.95906%200.89502%202.55029C0.976353%202.1416%201.17653%201.76585%201.47119%201.47119C1.76585%201.17653%202.1416%200.976353%202.55029%200.89502ZM2.96143%202.04932C2.7196%202.04935%202.48789%202.1459%202.31689%202.31689C2.1459%202.48789%202.04935%202.7196%202.04932%202.96143C2.04932%203.20324%202.14595%203.43494%202.31689%203.60596C2.48789%203.77695%202.7196%203.8735%202.96143%203.87354C3.20329%203.87354%203.43493%203.77698%203.60596%203.60596C3.77698%203.43493%203.87354%203.20329%203.87354%202.96143C3.8735%202.7196%203.77695%202.48789%203.60596%202.31689C3.43494%202.14595%203.20324%202.04932%202.96143%202.04932ZM15.0386%202.04932C14.7968%202.04932%2014.5651%202.14594%2014.394%202.31689C14.223%202.48789%2014.1265%202.7196%2014.1265%202.96143C14.1265%203.20329%2014.223%203.43493%2014.394%203.60596C14.5651%203.77698%2014.7967%203.87354%2015.0386%203.87354C15.2804%203.8735%2015.5121%203.77696%2015.6831%203.60596C15.8541%203.43494%2015.9507%203.20324%2015.9507%202.96143C15.9507%202.7196%2015.8541%202.48789%2015.6831%202.31689C15.5121%202.1459%2015.2804%202.04935%2015.0386%202.04932ZM5.06885%2015.0386C5.06882%2015.4553%204.94491%2015.863%204.71338%2016.2095C4.48189%2016.5558%204.15289%2016.8254%203.76807%2016.9849C3.38301%2017.1444%202.95906%2017.1863%202.55029%2017.105C2.1416%2017.0236%201.76585%2016.8235%201.47119%2016.5288C1.17653%2016.2341%200.976353%2015.8584%200.89502%2015.4497C0.81371%2015.0409%200.855643%2014.617%201.01514%2014.2319C1.17459%2013.8471%201.44423%2013.5181%201.79053%2013.2866C2.13703%2013.0551%202.54469%2012.9312%202.96143%2012.9312H2.96338C3.3096%2012.9363%203.64828%2013.0277%203.95068%2013.1948L6.56299%2010.5884L6.63037%2010.521L6.69775%2010.5894L7.40674%2011.314L7.47217%2011.3804L4.8042%2014.0483C4.97171%2014.351%205.06369%2014.69%205.06885%2015.0366V15.0386Z'%20fill='%23344A64'%20stroke='%23344A64'%20stroke-width='0.188888'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_139_3606'%3e%3crect%20width='17.0498'%20height='17.0498'%20fill='white'%20transform='translate(0.475098%200.475098)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",eW="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_750_5307)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M4.50021%204.52393L10.5002%2010.5201L16.5002%204.52393L17.378%205.56774V12.9049L16.5002%2014.2872H5.55771L3.7666%2013.6668V4.52393H4.50021Z'%20fill='%23FFE250'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M15.75%203H5.25C4.00736%203%203%204.02335%203%205.28571V12.9048C3%2014.1671%204.00736%2015.1905%205.25%2015.1905H15.75C16.9926%2015.1905%2018%2014.1671%2018%2012.9048V5.28571C18%204.02335%2016.9926%203%2015.75%203ZM15.4425%204.52381L11.0325%209.00381C10.8917%209.14805%2010.7%209.22918%2010.5%209.22918C10.3%209.22918%2010.1083%209.14805%209.9675%209.00381L5.5575%204.52381H15.4425ZM15.75%2013.6667C16.1642%2013.6667%2016.5%2013.3256%2016.5%2012.9048V5.56762L12.09%2010.0476C11.2115%2010.9389%209.78845%2010.9389%208.91%2010.0476L4.5%205.56762V12.9048C4.5%2013.3256%204.83579%2013.6667%205.25%2013.6667H15.75Z'%20fill='%233E4C5A'/%3e%3ccircle%20cx='16.6587'%20cy='14.7451'%20r='3.86133'%20fill='%23F6F8FC'/%3e%3c/g%3e%3cpath%20d='M15.4392%2012.307C15.5441%2012.2488%2015.6577%2012.2474%2015.7683%2012.2972C15.8778%2012.3467%2015.9519%2012.4314%2015.988%2012.5453H15.99C16.0246%2012.649%2016.0227%2012.7548%2015.9851%2012.8578C15.9469%2012.9624%2015.8772%2013.0436%2015.78%2013.099L15.7791%2013.1C15.4768%2013.2667%2015.2361%2013.4968%2015.0564%2013.7914C14.8775%2014.0847%2014.7881%2014.4079%2014.7878%2014.7621C14.7879%2014.9952%2014.8323%2015.2218%2014.9207%2015.4427C14.9935%2015.625%2015.1022%2015.7953%2015.2449%2015.9564V15.7308C15.2449%2015.6126%2015.2862%2015.5087%2015.3689%2015.4261C15.4514%2015.3439%2015.5548%2015.3025%2015.6726%2015.3021C15.7909%2015.3018%2015.8954%2015.3433%2015.9783%2015.4261C16.061%2015.509%2016.1019%2015.6127%2016.1013%2015.7308V17.0443C16.1013%2017.1624%2016.0608%2017.2664%2015.9783%2017.349C15.8957%2017.4316%2015.7916%2017.4722%2015.6736%2017.472V17.473H14.3591C14.241%2017.4729%2014.1369%2017.4317%2014.0544%2017.349C13.9721%2017.2664%2013.9317%2017.1623%2013.9314%2017.0443C13.9312%2016.9261%2013.9725%2016.8223%2014.0554%2016.7396C14.1381%2016.6573%2014.2414%2016.6157%2014.3591%2016.6156H14.6726C14.4106%2016.3679%2014.2213%2016.087%2014.1091%2015.7719C13.9906%2015.4387%2013.9314%2015.1014%2013.9314%2014.7611C13.9315%2014.2287%2014.0675%2013.7433%2014.3406%2013.308C14.613%2012.8737%2014.9797%2012.5393%2015.4392%2012.307ZM18.9578%2012.0179C19.0759%2012.018%2019.1798%2012.0585%2019.2625%2012.141C19.3452%2012.2237%2019.3868%2012.3284%2019.3865%2012.4467C19.3861%2012.5644%2019.3445%2012.6677%2019.2625%2012.7504C19.1799%2012.8334%2019.0761%2012.8738%2018.9578%2012.8734V12.8744H18.6355C18.8857%2013.1365%2019.0745%2013.4199%2019.1951%2013.7279C19.3227%2014.0539%2019.3867%2014.3879%2019.3865%2014.7289C19.3864%2015.2614%2019.2495%2015.7466%2018.9763%2016.182C18.7039%2016.6163%2018.3372%2016.9506%2017.8777%2017.183L17.8767%2017.182C17.7719%2017.2399%2017.6599%2017.2426%2017.5496%2017.1927C17.4395%2017.143%2017.3633%2017.0585%2017.3269%2016.9437C17.2926%2016.8401%2017.2949%2016.735%2017.3328%2016.6322C17.3712%2016.5279%2017.4402%2016.4464%2017.5369%2016.391L17.5378%2016.39C17.8401%2016.2232%2018.0806%2015.993%2018.2605%2015.6986C18.4395%2015.4057%2018.5292%2015.0834%2018.5291%2014.7289C18.5291%2014.4955%2018.4856%2014.2682%2018.3972%2014.0472C18.3241%2013.8647%2018.2153%2013.6934%2018.072%2013.5316V13.7601C18.0719%2013.8782%2018.0315%2013.9822%2017.949%2014.0648C17.8663%2014.1475%2017.7615%2014.1881%2017.6433%2014.1879C17.5256%2014.1875%2017.4221%2014.1469%2017.3396%2014.0648C17.2569%2013.9824%2017.2157%2013.8783%2017.2156%2013.7601V12.4457C17.2157%2012.3275%2017.2569%2012.2234%2017.3396%2012.141C17.4221%2012.0589%2017.5256%2012.0183%2017.6433%2012.0179H18.9578Z'%20fill='%233E4C5A'%20stroke='%233E4C5A'%20stroke-width='0.2'/%3e%3cdefs%3e%3cclipPath%20id='clip0_750_5307'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",tW="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_751_5597)'%3e%3cpath%20d='M15.4999%2014H14.7099L14.4299%2013.73C15.4099%2012.59%2015.9999%2011.11%2015.9999%209.5C15.9999%205.91%2013.0899%203%209.49991%203C6.07991%203%203.27991%205.64%203.02991%209H5.04991C5.29991%206.75%207.17991%205%209.49991%205C11.9899%205%2013.9999%207.01%2013.9999%209.5C13.9999%2011.99%2011.9899%2014%209.49991%2014C9.32991%2014%209.16991%2013.97%208.99991%2013.95V15.97C9.16991%2015.99%209.32991%2016%209.49991%2016C11.1099%2016%2012.5899%2015.41%2013.7299%2014.43L13.9999%2014.71V15.5L18.9999%2020.49L20.4899%2019L15.4999%2014Z'%20fill='%23344A64'/%3e%3c/g%3e%3ccircle%20cx='9.55469'%20cy='9.45557'%20r='4.49316'%20fill='%23FFE250'/%3e%3cg%20clip-path='url(%23clip1_751_5597)'%3e%3cpath%20d='M6.0747%2015.2672C6.00267%2015.2675%205.93225%2015.2459%205.87285%2015.2052C5.81344%2015.1645%205.76788%2015.1066%205.74225%2015.0393L5.17479%2013.5637C5.1633%2013.534%205.14572%2013.5069%205.12318%2013.4844C5.10064%2013.4619%205.07363%2013.4443%205.0439%2013.4328L3.56785%2012.8649C3.50061%2012.8391%203.44278%2012.7935%203.40199%2012.7342C3.36119%2012.6748%203.33936%2012.6045%203.33936%2012.5324C3.33936%2012.4604%203.36119%2012.3901%203.40199%2012.3308C3.44278%2012.2714%203.50061%2012.2258%203.56785%2012.2L5.04347%2011.6326C5.0732%2011.6211%205.10021%2011.6035%205.12275%2011.5809C5.14529%2011.5584%205.16288%2011.5314%205.17437%2011.5017L5.74225%2010.0256C5.76806%209.95838%205.81365%209.90054%205.873%209.85975C5.93235%209.81896%206.00268%209.79712%206.0747%209.79712C6.14671%209.79712%206.21704%209.81896%206.27639%209.85975C6.33574%209.90054%206.38133%209.95838%206.40713%2010.0256L6.9746%2011.5012C6.98609%2011.531%207.00367%2011.558%207.02621%2011.5805C7.04875%2011.6031%207.07575%2011.6206%207.10549%2011.6321L8.57259%2012.1966C8.64255%2012.2225%208.70283%2012.2694%208.74523%2012.3308C8.78756%2012.3923%208.80999%2012.4652%208.80944%2012.5399C8.80835%2012.6106%208.78603%2012.6794%208.74539%2012.7374C8.7048%2012.7953%208.64769%2012.8397%208.58156%2012.8649L7.10592%2013.4324C7.07618%2013.4439%207.04918%2013.4614%207.02664%2013.484C7.0041%2013.5065%206.98652%2013.5335%206.97502%2013.5633L6.40713%2015.0393C6.38151%2015.1066%206.33594%2015.1645%206.27654%2015.2052C6.21714%2015.2459%206.14671%2015.2675%206.0747%2015.2672Z'%20fill='%23FFE250'/%3e%3cpath%20d='M6.11108%209.5376L6.1687%209.5415L6.17651%209.54248C6.21226%209.54793%206.24734%209.55755%206.28101%209.5708L6.37769%209.62256L6.43433%209.66846C6.48712%209.71812%206.52824%209.77915%206.55444%209.84717L7.15503%2011.4067L8.71558%2012.0073C8.80679%2012.0425%208.88418%2012.1052%208.93921%2012.1851C8.99476%2012.2658%209.02515%2012.3618%209.02515%2012.4595C9.02501%2012.5565%208.99584%2012.6521%208.94019%2012.7329C8.88519%2012.8129%208.80718%2012.8754%208.71558%2012.9106L7.15405%2013.5093L6.55444%2015.0698C6.51941%2015.161%206.45806%2015.2401%206.37769%2015.2954C6.29731%2015.3505%206.2015%2015.3802%206.10425%2015.3804C6.00668%2015.3804%205.9105%2015.3508%205.82983%2015.2954C5.7501%2015.2405%205.68737%2015.1624%205.6521%2015.0708L5.05151%2013.5103L3.49194%2012.9097C3.40102%2012.8746%203.32263%2012.8132%203.26733%2012.7329C3.22581%2012.6725%203.19819%2012.6034%203.18726%2012.5317L3.18628%2012.5239L3.18237%2012.4663C3.18201%2012.4614%203.18201%2012.4565%203.18237%2012.4517L3.18628%2012.394L3.18726%2012.3862C3.19817%2012.3143%203.22587%2012.2455%203.26733%2012.1851L3.27124%2012.1792L3.30737%2012.1343L3.31226%2012.1274C3.36209%2012.0743%203.42404%2012.0335%203.49194%2012.0073L5.05151%2011.4067L5.6521%209.84717L5.65503%209.84033L5.67944%209.7876L5.68335%209.78076L5.7478%209.69385C5.77235%209.6672%205.79978%209.64323%205.82983%209.62256L5.83569%209.61768V9.61865L5.8855%209.58936L5.89233%209.58545L5.99487%209.54932C6.03039%209.54112%206.06746%209.5376%206.10425%209.5376H6.11108ZM5.67456%2011.7515C5.65029%2011.8145%205.61303%2011.8726%205.56519%2011.9204C5.51728%2011.9683%205.45923%2012.0055%205.39624%2012.0298L4.28003%2012.4575L5.39624%2012.8882L5.40112%2012.8901L5.43823%2012.9058L5.44312%2012.9087L5.50757%2012.9487C5.52783%2012.9635%205.54744%2012.9798%205.56519%2012.9976C5.6128%2013.0453%205.65032%2013.1026%205.67456%2013.1655L6.10327%2014.2798L6.53296%2013.1655L6.53491%2013.1606L6.55151%2013.1245L6.55347%2013.1196C6.5764%2013.0747%206.60647%2013.0334%206.64233%2012.9976L6.64624%2012.9927L6.67651%2012.9663L6.68042%2012.9634C6.71917%2012.9321%206.76287%2012.9065%206.8103%2012.8882L7.92456%2012.4585L6.8103%2012.0298C6.74749%2012.0056%206.69018%2011.9682%206.64233%2011.9204C6.59453%2011.8726%206.55723%2011.8146%206.53296%2011.7515L6.10229%2010.6353L5.67456%2011.7515Z'%20fill='%23344A64'%20stroke='%23344A64'%20stroke-width='0.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_751_5597'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_751_5597'%3e%3crect%20width='8.06842'%20height='8.06842'%20fill='white'%20transform='translate(3.02979%207.96582)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",nW="integration_sense",Hm="email_log_settings",rW="quick_access",AW="This feature can only be used for one App and is currently enabled for :enabledConnector.",oW=[{id:nW,heading:"Smart Previews",subHeading:"Quickly view details from {{app_name}} by hovering on entities in emails.",icon:$H,featureKey:qF},{id:Hm,heading:"Sync conversation",subHeading:"Save emails from Hiver to {{app_name}} to create a single source of truth for customer information.",icon:eW,featureKey:KF,modalSettings:{title:"Tell us why you no longer want to use this feature",radioOptions:[{label:"We already use another tool for this",value:"already_using_another_extension"},{label:"We don't need to log emails",value:"do_not_have-email_logging_requirement"},{label:"The feature isn't working as expected",value:"not_working_as_expected"},{label:"Other",value:"other"}],textArea:{placeholder:"Tell us more (optional)"}}},{id:rW,heading:"Quick Access",subHeading:"Access your {{app_name}} entities quickly with a single click.",icon:tW,featureKey:ZF}],sW="Advanced settings",aW="Enhance your integrations with contextual insights.",iW=g.styled(({className:e,...t})=>u.jsx(g.Tooltip,{...t,classes:{popper:e}}))(({width:e,height:t,color:n})=>({[`& .${g.tooltipClasses.arrow}`]:{color:n||"#fff !important"},[`& .${g.tooltipClasses.tooltip}`]:{backgroundColor:n||"#fff",maxWidth:e,height:t,width:e,borderRadius:"6px",boxShadow:"0px 2px 10px 0px #00000026"}})),lW=e=>u.jsx(g.Button,{...e,disabled:e.isLoading||e.disabled,children:e.isLoading?u.jsx(g.CircularProgress,{sx:{color:"#97A3B7"},size:20}):e.label}),cW=({onCancel:e,onSubmit:t,isLoading:n,showOptions:r=!0,title:A,feedbackOptions:o,placeholder:s})=>{const[a,i]=y.useState(""),[l,c]=y.useState(""),d=E=>{i(E.target.value)},f=E=>{E.stopPropagation();const{value:p}=(E==null?void 0:E.target)||{};c(p)},B=()=>{t({feedbackOption:a,feedbackComment:l})},I=()=>{e==null||e()},C=r?!a:!l;return u.jsxs("div",{className:"max-h-[420px] w-[510px] rounded-xl p-4 box-border [&>*]:box-border [&_.MuiFormGroup-root]:mb-3",children:[u.jsx(g.Typography,{variant:"h3",children:A}),u.jsx("div",{className:"border-b border-gray-6 mx-[-16px] my-3"}),r?u.jsx(g.FormControl,{children:u.jsx(g.RadioGroup,{"aria-labelledby":"demo-controlled-radio-buttons-group",name:"controlled-radio-buttons-group",value:a,onChange:d,children:o.map(E=>u.jsx(g.FormControlLabel,{value:E.value,control:u.jsx(g.Radio,{}),label:E.label},E.value))})}):null,u.jsx(Kd,{type:"text",placeholder:s,value:l,name:"feedbackComment",inputChangeHandler:f,multiline:!0,rows:5,limit:250,validation:{validate:Ak()}}),u.jsxs("div",{className:"flex justify-end mt-8 gap-2",children:[u.jsx(g.Button,{variant:"text",color:"primary",style:{color:g.theme.palette.gray.gray3},disabled:n,onClick:I,children:"Cancel"}),u.jsx(lW,{variant:"contained",color:"primary",isLoading:n,disabled:C,label:"Submit",onClick:B})]})]})},uW=un+"/connectors/:connectorId/advanced-feature",gW=`${un}/connector/admin-feedback`,dW=async(e,t)=>{try{const n=RA(uW,{connectorId:t})+"?channel_type=email",r=await Ke({url:n,method:cn.PATCH,data:e});return Qn({type:Bs,message:"Successfully updated feature"}),r}catch(n){return Qn({type:qr,message:"Failed to update feature"}),Promise.reject(n)}};function CW(){return Al({mutationKey:["toggle-advanced-feature"],mutationFn:async({connectorId:e,data:t})=>{if(!e)throw new Error("Connector ID is required");const n=await dW(t,e);return n==null?void 0:n.data}})}const EW=async({feedbackData:e})=>{try{const t=await Ke({url:gW+"?channel_type=email",method:"POST",data:e});return t==null?void 0:t.data}catch(t){throw console.error("Error submitting feedback:",t),t}};function fW(){return Al({mutationFn:EW})}const IW=({id:e,heading:t,subHeading:n,isEnabled:r,icon:A,connectorId:o,connectorType:s,modalSettings:a,disabled:i=!1,tooltipContent:l=""})=>{var v;const[c,d]=y.useState(!1),[f,B]=y.useState(r),[I,C]=y.useState(!1),E=Fe(qa)===pe.LOADING,{mutate:p}=CW(),{mutate:h}=fW();y.useEffect(()=>{B(r)},[r]);const Q=x=>{const w=x.target.checked;d(!0),p({connectorId:o,data:{[e]:w}},{onSettled:()=>{d(!1)},onSuccess:b=>{b.enabled!==void 0&&B(b.enabled),!w&&a&&C(!0)}})},m=x=>{const w={feedback_type:"email-logging-disabled",comment:x.feedbackComment,option:x.feedbackOption,connector_id:o,connector_type:s};h({feedbackData:w}),C(!1)};return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"w-full flex justify-between items-center border-1 border-gray-5 rounded-sm p-4 gap-2.5 [&:first-child:last-child]:col-span-2",children:[u.jsxs("div",{className:"flex gap-2.5",children:[u.jsx("div",{className:"h-11 w-10.5 p-3 bg-gray-6a rounded-sm shrink-0",children:u.jsx("img",{src:A,alt:"Smart Previews Icon"})}),u.jsxs("div",{className:"flex flex-col items-start",children:[u.jsx("h3",{className:"font-medium! text-body1",children:t}),u.jsx("p",{className:"text-body2",children:n})]})]}),u.jsx(iW,{title:l,placement:"top",color:"#343C45",arrow:!0,width:"287px",children:u.jsx("div",{className:"w-12",children:u.jsx(xm,{id:`switch_${e}`,checked:f,onClick:x=>x==null?void 0:x.stopPropagation(),onChange:Q,isLoading:c||E,disabled:c||E||i})})})]}),u.jsx(kc,{shown:I,setShown:C,borderRadius:12,sx:{zIndex:15002},children:u.jsx(cW,{onCancel:()=>C(!1),onSubmit:m,isLoading:c,title:(a==null?void 0:a.title)||"",feedbackOptions:(a==null?void 0:a.radioOptions)||[],placeholder:((v=a==null?void 0:a.textArea)==null?void 0:v.placeholder)||""})})]})},BW=(e,t)=>typeof e[t]=="boolean",pW=(e,t)=>typeof e[t]=="object"&&typeof e[t].enabled=="boolean",hW=e=>{const t={};for(const n in e)pW(e,n)?t[n]=e[n]:BW(e,n)&&(t[n]={enabled:e[n],connector:n===Hm?e.connector:void 0});return t},QW=({advancedFeatures:e,connectorId:t,connectorName:n,connectorType:r})=>{const{availableFeatures:A}=y.useContext(_t),o=hW(e),s=oW.filter(l=>xr(A,l.featureKey)&&typeof o[l.id]=="object");if(s.length===0)return null;const a=l=>o[l].enabled,i=l=>{var d;const c=o[l];return!a(l)&&((d=c==null?void 0:c.connector)!=null&&d.id)?{isDisabled:!0,tooltipContent:RA(AW,{enabledConnector:c.connector.name,currentConnector:n})}:{isDisabled:!1,tooltipContent:""}};return u.jsxs("div",{children:[u.jsx("h2",{className:"text-h2 text-[#4D596C]! mt-8 mb-2",children:sW}),u.jsx("p",{className:"text-body2 text-[#6F7C90]!",children:aW}),u.jsx("div",{className:"grid grid-cols-2 mt-6 gap-4",children:s.map(l=>{const{isDisabled:c,tooltipContent:d}=i(l.id);return u.jsx(IW,{id:l.id,heading:l.heading.replace(/\{\{app_name\}\}/g,n),subHeading:l.subHeading.replace(/\{\{app_name\}\}/g,n),isEnabled:a(l.id),icon:l.icon,connectorId:t,connectorType:r,modalSettings:l.modalSettings,disabled:c,tooltipContent:d},l.id)})})]})},mW=({connectorData:e})=>{const{cardList:t=[],name:n="",customCardsList:r=[],advancedFeatures:A={},type:o}=e||{},[s,a]=y.useState(!1),{id:i=""}=TA();return u.jsxs(u.Fragment,{children:[u.jsx(IC,{shown:s,setShown:a,connectorName:n}),u.jsx("h2",{className:"text-h2 text-[#4D596C]!",children:Bj}),u.jsx("p",{className:"text-body2 text-[#6F7C90]! mb-6 mt-2",children:pj}),u.jsx(mm,{setShowEnabledModal:a,currentConnectorId:i,infoCards:[...t,...r]}),u.jsx(QW,{advancedFeatures:A,connectorId:i,connectorName:n,connectorType:o})]})},yW=()=>{const e=wr(),{sendTrackingEvent:t}=y.useContext(_t),n=Fe(iC),r=Fe(qa),A=Fe(Am),o=Fe(Qo),s=Fe(Wa),{id:a=""}=TA(),[i]=Yo(),l=i.get("isEdit")==="true",c=i.get("tabIndex"),[d,f]=y.useState(()=>{const x=Number(c);return Number.isNaN(x)||x<0?0:x>Fc.length-1?Fc.length-1:x}),B=(x,w)=>{f(w)},I=(o==null?void 0:o[a])||null,C=(s==null?void 0:s[a])||null,E=l?I:C,p=!(E!=null&&E.isAuthenticated),h=!!(E!=null&&E.isEnabled),Q=[n,r].includes(pe.LOADING)||p,m=[{name:pc,route:`${Ye.BASEPATH}${Ye.DASHBOARD}`},{name:(E==null?void 0:E.name)||"",route:`${Ye.BASEPATH}${Ye.API_VIEW}/${a}?isEdit=${String(l)}`},{name:kV}],v=(x,w)=>{x==null||x.stopPropagation(),e(Ja({id:w,enabled:x.target.checked})).unwrap().then(()=>{x.target.checked?t(tt.TOGGLE_ENABLED,{connector_name:E==null?void 0:E.name}):(t(tt.TOGGLE_DISABLED,{connector_name:E==null?void 0:E.name}),Qn({message:U0,type:AC}))}).catch(()=>{Qn({message:X0,type:qr})})};return y.useEffect(()=>{e(Xa()),l?(e(Ua(a)),e(Tc(a))):e(za(a))},[l,e,a]),u.jsxs("div",{className:"w-full h-full flex flex-col",children:[u.jsxs("div",{className:`flex flex-row justify-between ${l?"mb-2":"mb-9"}`,children:[u.jsx(vm,{options:m}),l?u.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[u.jsx(jV,{active:h,label:u.jsx(g.Typography,{variant:"body2",children:h?"Active":"Inactive"})}),u.jsx(xm,{isLoading:(A==null?void 0:A[a])===pe.LOADING,id:`switch_${a}`,checked:h,disabled:Q,onClick:x=>x==null?void 0:x.stopPropagation(),onChange:x=>v(x,a)})]}):null]}),l?u.jsxs(u.Fragment,{children:[u.jsx("div",{children:u.jsxs(g.Tabs,{value:d,onChange:B,classes:{flexContainer:"border-b-2 border-[#D6DDE8]"},children:[u.jsx(g.Tab,{label:Fc[0],className:"border-b-0!"}),u.jsx(g.Tab,{label:Fc[1],className:"border-b-0!"})]})}),u.jsx("div",{hidden:d!==0,className:"grow overflow-auto py-6",children:u.jsx(Vm,{connectorData:E})}),u.jsx("div",{hidden:d!==1,className:"grow overflow-auto py-6",children:u.jsx(mW,{connectorData:E})})]}):u.jsx("div",{className:"grow overflow-auto py-0",children:u.jsx(Vm,{connectorData:E})})]})},bW=e=>e.auth.verifyTokenApiStatus,vW=e=>e.auth.authVerificationDone,xW=g.styled(g.Box)`
3128
+ `,JH=({upgradeGuideContent:e,upgradeGuideLink:t})=>u.jsxs(VH,{children:[u.jsxs(g.Stack,{marginBottom:"20px",children:[u.jsxs(g.Stack,{direction:"row",padding:"8px 0",gap:"4px",alignItems:"center",children:[u.jsx(HH,{}),u.jsx(g.Typography,{variant:"body1_medium",color:g.theme.palette.gray.black,children:ZV})]}),u.jsx(g.Typography,{variant:"body2",children:KV})]}),u.jsx(g.Typography,{variant:"body2_medium",marginBottom:"8px",color:g.theme.palette.gray.black,children:$V}),u.jsx(zH,{variant:"body2",dangerouslySetInnerHTML:{__html:e}}),t?u.jsxs(WH,{target:"_blank",underline:"none",href:t,children:[u.jsx(YH,{}),eH]}):null]}),Gm=(e,t)=>{const n=t.authType===$a,r=t.authType===Cm,A=t.authType===ps;if(!e||!e.data)return{authUrl:"",authStatus:r?nt.API_KEY_FAILED:n?nt.BASIC_AUTH_FAILED:A?nt.OAUTH1_FAILED:nt.OAUTH_FAILED};const o=e.data;return r?{authUrl:"",id:o.id,authStatus:nt.API_KEY_SUCCESS}:n?{authUrl:"",id:o.id,authStatus:nt.BASIC_AUTH_SUCCESS}:A?{authUrl:"",id:o.id,authStatus:nt.OAUTH1_SUCCESS}:o.authorizationUrl?{authUrl:o.authorizationUrl,id:o.id,authStatus:nt.PENDING}:{authUrl:"",id:"",authStatus:nt.OAUTH_FAILED}},XH=async e=>{try{const t=await Ke({url:AM,method:cn.POST,data:e});return Gm(t,e.authDetails)}catch(t){return Promise.reject(t)}},UH=async(e,t)=>{try{const n=sM.replace("{{id}}",t),r=await Ke({url:n,method:cn.PATCH,data:e});return Gm(r,e.authDetails)}catch(n){return Promise.reject(n)}},qH=({connectorId:e,onSuccess:t})=>{const n=Vo(),r=y.useMemo(()=>["authDetails",{connectorId:e}],[e]),{data:A}=rl({queryKey:r,queryFn:()=>Promise.resolve({authUrl:"",authStatus:nt.IDLE,id:""}),enabled:!1}),o=Al({mutationFn:a=>"connectorId"in a?UH(a.data,a.connectorId):XH(a.data),onSuccess:a=>{n.setQueryData(r,a),t==null||t()}});y.useEffect(()=>()=>{n.removeQueries({queryKey:r,exact:!0})},[n,r]);const s=y.useCallback(a=>{n.setQueryData(r,i=>i&&{...i,authStatus:a})},[r,n]);return{mutate:o.mutate,isLoading:o.isPending,data:A,mutateStatus:s}},ZH=async e=>{var t;try{const n=await Ke({url:RA(iM,{connectorId:e}),method:cn.GET});return!n||!((t=n==null?void 0:n.data)!=null&&t.status)?{status:"failed"}:n==null?void 0:n.data}catch(n){return Promise.reject(n)}},KH=({connectorId:e,enabled:t=!1})=>{const n=Vo(),r=y.useMemo(()=>["authSuccessStatus",{connectorId:e}],[e]),A=rl({queryKey:r,queryFn:()=>ZH(e),refetchInterval:o=>{var s,a;return((s=o.state.data)==null?void 0:s.status)==="failed"||((a=o.state.data)==null?void 0:a.status)==="success"?!1:500},enabled:t,refetchOnWindowFocus:!1,refetchIntervalInBackground:!0});return y.useEffect(()=>()=>{n.removeQueries({queryKey:r,exact:!0})},[n,r]),A},Vm=({connectorData:e})=>{const{sendTrackingEvent:t,availableFeatures:n}=y.useContext(_t),[r,A]=y.useState(!1),o=Fe(qa),s=Fe(Y0),a=y.useRef(null),i=on(),{id:l=""}=TA(),[c]=Yo(),d=c.get("isEdit")==="true",f=!!(e!=null&&e.showUpgradeButton),B=xr(n,UF),{data:I,mutateStatus:C,isLoading:E,mutate:p}=qH({connectorId:l,onSuccess:()=>{B&&A(!0)}}),h=KH({connectorId:(I==null?void 0:I.id)||"",enabled:r}),{status:Q}=h.data||{},m=(I==null?void 0:I.authStatus)||nt.IDLE,v=(I==null?void 0:I.authUrl)||"",x=wr();y.useEffect(()=>()=>{x(uM())},[x]),y.useEffect(()=>{let b,T;const j=F=>{a.current&&F.origin===window.location.origin&&(F.data===wm||F.data===hC)&&(clearTimeout(b),a.current.close(),a.current=null,C(F.data===hC?nt.OAUTH_SUCCESS:nt.OAUTH_FAILED))};try{if(v){a.current=window.open(v,"_blank");const F=5*60*1e3;b=setTimeout(()=>{var X;(X=a.current)==null||X.close(),a.current=null,C(nt.OAUTH_FAILED)},F),T=setInterval(()=>{var X;(X=a.current)!=null&&X.closed&&(clearInterval(T),a.current=null,C(nt.OAUTH_FAILED))},500),window.addEventListener("message",j)}}catch(F){console.log("Error in Authentication",F)}return()=>{window.removeEventListener("message",j),clearTimeout(b),clearInterval(T)}},[v,x,C]),y.useEffect(()=>{Q&&Q!=="pending"&&a.current&&B&&(a.current.close(),a.current=null,C(Q==="success"?nt.OAUTH_SUCCESS:nt.OAUTH_FAILED))},[Q,C,B]),y.useEffect(()=>{switch((m===nt.OAUTH1_FAILED||m===nt.OAUTH_FAILED||m===nt.API_KEY_FAILED||m===nt.BASIC_AUTH_FAILED)&&i(Ye.BASEPATH),(m===nt.OAUTH1_SUCCESS||m===nt.OAUTH_SUCCESS||m===nt.API_KEY_SUCCESS||m===nt.BASIC_AUTH_SUCCESS)&&I!=null&&I.id&&i(d?Ye.BASEPATH:`${Ye.BASEPATH}${Ye.CONNECTOR_INITIAL_SETUP}/${l}?connectorId=${I.id}`),m){case nt.BASIC_AUTH_SUCCESS:case nt.OAUTH1_SUCCESS:case nt.OAUTH_SUCCESS:{Qn({message:f?Tm:WV,type:Bs}),t(tt.CONNECTOR_AUTH_SUCCESS,{connector_name:e==null?void 0:e.name});break}case nt.BASIC_AUTH_FAILED:case nt.OAUTH1_FAILED:case nt.OAUTH_FAILED:{Qn({message:f?Sm:zV,type:qr});break}case nt.REQUEST_FAILED:{Qn({message:oC,type:qr});break}case nt.API_KEY_SUCCESS:{Qn({message:f?Tm:JV,type:Bs}),t(tt.CONNECTOR_AUTH_SUCCESS,{connector_name:e==null?void 0:e.name});break}case nt.API_KEY_FAILED:{Qn({message:f?Sm:oC,type:qr});break}}},[m,i,f,l,d,e==null?void 0:e.name,t,I==null?void 0:I.id]);const w=o===pe.LOADING||s===pe.LOADING;return u.jsxs(GH,{direction:"row",id:"connectors-auth-page",children:[u.jsx("div",{className:"flex flex-col",children:u.jsx(SH,{connectorId:l,isEdit:d,connectorData:e,authStatus:m,isLoading:w,authMutate:p,isAuthPending:E})}),u.jsxs(g.Stack,{gap:"36px",width:"322px",className:"connector-auth-help",children:[e!=null&&e.upgradeGuideContent?u.jsx(JH,{upgradeGuideContent:e.upgradeGuideContent,upgradeGuideLink:e.upgradeGuideLink}):null,u.jsxs(g.Stack,{gap:"12px",children:[u.jsx(g.Typography,{variant:"h2",marginBottom:"8px",children:aG}),d?null:u.jsx(EC,{isSettingsPage:!0}),u.jsx(jH,{connectorName:e==null?void 0:e.name,supportLinks:e==null?void 0:e.supportLinks})]})]})]})},$H="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_139_3606)'%3e%3cpath%20d='M9.00012%2011.0127C8.46629%2011.0127%207.95432%2010.8006%207.57685%2010.4232C7.19937%2010.0457%206.9873%209.53371%206.9873%208.99988C6.9873%208.46605%207.19937%207.95408%207.57685%207.5766C7.95432%207.19912%208.46629%206.98706%209.00012%206.98706C9.53395%206.98706%2010.0459%207.19912%2010.4234%207.5766C10.8009%207.95408%2011.0129%208.46605%2011.0129%208.99988C11.0129%209.53371%2010.8009%2010.0457%2010.4234%2010.4232C10.0459%2010.8006%209.53395%2011.0127%209.00012%2011.0127ZM9.00012%207.99347C8.73321%207.99347%208.47722%208.0995%208.28848%208.28824C8.09975%208.47698%207.99371%208.73296%207.99371%208.99988C7.99371%209.26679%208.09975%209.52278%208.28848%209.71152C8.47722%209.90025%208.73321%2010.0063%209.00012%2010.0063C9.26704%2010.0063%209.52302%209.90025%209.71176%209.71152C9.9005%209.52278%2010.0065%209.26679%2010.0065%208.99988C10.0065%208.73296%209.9005%208.47698%209.71176%208.28824C9.52302%208.0995%209.26704%207.99347%209.00012%207.99347Z'%20fill='%23344A64'/%3e%3ccircle%20cx='2.96555'%20cy='15.1248'%20r='1.22238'%20fill='%23FFE250'/%3e%3ccircle%20cx='15.133'%20cy='15.1248'%20r='1.22238'%20fill='%23FFE250'/%3e%3ccircle%20cx='15.133'%20cy='2.89426'%20r='1.22238'%20fill='%23FFE250'/%3e%3ccircle%20cx='2.96555'%20cy='2.89426'%20r='1.22238'%20fill='%23FFE250'/%3e%3cpath%20d='M11.4468%2010.5942L14.0483%2013.1948C14.3509%2013.0275%2014.6901%2012.9363%2015.0366%2012.9312H15.0386C15.4553%2012.9312%2015.863%2013.0551%2016.2095%2013.2866C16.5558%2013.5181%2016.8254%2013.8471%2016.9849%2014.2319C17.1444%2014.617%2017.1863%2015.0409%2017.105%2015.4497C17.0236%2015.8584%2016.8235%2016.2341%2016.5288%2016.5288C16.2341%2016.8235%2015.8584%2017.0236%2015.4497%2017.105C15.0409%2017.1863%2014.617%2017.1444%2014.2319%2016.9849C13.8471%2016.8254%2013.5181%2016.5558%2013.2866%2016.2095C13.0551%2015.863%2012.9312%2015.4553%2012.9312%2015.0386V15.0366C12.9363%2014.6898%2013.0272%2014.3501%2013.1948%2014.0474L10.604%2011.437L10.5376%2011.3696L11.3804%2010.5269L11.4468%2010.5942ZM2.96143%2014.1265C2.7196%2014.1265%202.48789%2014.223%202.31689%2014.394C2.14594%2014.5651%202.04932%2014.7968%202.04932%2015.0386C2.04935%2015.2804%202.1459%2015.5121%202.31689%2015.6831C2.48789%2015.8541%202.7196%2015.9507%202.96143%2015.9507C3.20324%2015.9507%203.43494%2015.8541%203.60596%2015.6831C3.77696%2015.5121%203.8735%2015.2804%203.87354%2015.0386C3.87354%2014.7967%203.77698%2014.5651%203.60596%2014.394C3.43493%2014.223%203.20329%2014.1265%202.96143%2014.1265ZM15.0386%2014.1265C14.7967%2014.1265%2014.5651%2014.223%2014.394%2014.394C14.223%2014.5651%2014.1265%2014.7967%2014.1265%2015.0386C14.1265%2015.2804%2014.223%2015.5121%2014.394%2015.6831C14.5651%2015.8541%2014.7968%2015.9507%2015.0386%2015.9507C15.2804%2015.9507%2015.5121%2015.8541%2015.6831%2015.6831C15.8541%2015.5121%2015.9507%2015.2804%2015.9507%2015.0386C15.9507%2014.7968%2015.8541%2014.5651%2015.6831%2014.394C15.5121%2014.223%2015.2804%2014.1265%2015.0386%2014.1265ZM14.2319%201.01514C14.617%200.855643%2015.0409%200.81371%2015.4497%200.89502C15.8584%200.976353%2016.2341%201.17653%2016.5288%201.47119C16.8235%201.76585%2017.0236%202.1416%2017.105%202.55029C17.1863%202.95906%2017.1444%203.38301%2016.9849%203.76807C16.8254%204.15289%2016.5558%204.48189%2016.2095%204.71338C15.863%204.94491%2015.4553%205.06882%2015.0386%205.06885H15.0366C14.69%205.06369%2014.351%204.97171%2014.0483%204.8042L11.437%207.41162L11.3696%207.479L11.3022%207.41064L10.5933%206.68604L10.5278%206.61963L10.5942%206.55322L13.1948%203.95068C13.0277%203.64828%2012.9363%203.3096%2012.9312%202.96338V2.96143C12.9312%202.54469%2013.0551%202.13703%2013.2866%201.79053C13.5181%201.44423%2013.8471%201.17459%2014.2319%201.01514ZM2.55029%200.89502C2.95906%200.81371%203.38301%200.855643%203.76807%201.01514C4.15289%201.17459%204.48189%201.44422%204.71338%201.79053C4.9449%202.13703%205.06882%202.54469%205.06885%202.96143V2.96338C5.06369%203.31005%204.97171%203.64897%204.8042%203.95166L7.396%206.56299L7.4624%206.63037L6.61963%207.47314L6.55322%207.40576L3.95068%204.8042C3.64818%204.97145%203.30976%205.0637%202.96338%205.06885H2.96143C2.54469%205.06882%202.13703%204.9449%201.79053%204.71338C1.44422%204.48189%201.17459%204.15289%201.01514%203.76807C0.855643%203.38301%200.81371%202.95906%200.89502%202.55029C0.976353%202.1416%201.17653%201.76585%201.47119%201.47119C1.76585%201.17653%202.1416%200.976353%202.55029%200.89502ZM2.96143%202.04932C2.7196%202.04935%202.48789%202.1459%202.31689%202.31689C2.1459%202.48789%202.04935%202.7196%202.04932%202.96143C2.04932%203.20324%202.14595%203.43494%202.31689%203.60596C2.48789%203.77695%202.7196%203.8735%202.96143%203.87354C3.20329%203.87354%203.43493%203.77698%203.60596%203.60596C3.77698%203.43493%203.87354%203.20329%203.87354%202.96143C3.8735%202.7196%203.77695%202.48789%203.60596%202.31689C3.43494%202.14595%203.20324%202.04932%202.96143%202.04932ZM15.0386%202.04932C14.7968%202.04932%2014.5651%202.14594%2014.394%202.31689C14.223%202.48789%2014.1265%202.7196%2014.1265%202.96143C14.1265%203.20329%2014.223%203.43493%2014.394%203.60596C14.5651%203.77698%2014.7967%203.87354%2015.0386%203.87354C15.2804%203.8735%2015.5121%203.77696%2015.6831%203.60596C15.8541%203.43494%2015.9507%203.20324%2015.9507%202.96143C15.9507%202.7196%2015.8541%202.48789%2015.6831%202.31689C15.5121%202.1459%2015.2804%202.04935%2015.0386%202.04932ZM5.06885%2015.0386C5.06882%2015.4553%204.94491%2015.863%204.71338%2016.2095C4.48189%2016.5558%204.15289%2016.8254%203.76807%2016.9849C3.38301%2017.1444%202.95906%2017.1863%202.55029%2017.105C2.1416%2017.0236%201.76585%2016.8235%201.47119%2016.5288C1.17653%2016.2341%200.976353%2015.8584%200.89502%2015.4497C0.81371%2015.0409%200.855643%2014.617%201.01514%2014.2319C1.17459%2013.8471%201.44423%2013.5181%201.79053%2013.2866C2.13703%2013.0551%202.54469%2012.9312%202.96143%2012.9312H2.96338C3.3096%2012.9363%203.64828%2013.0277%203.95068%2013.1948L6.56299%2010.5884L6.63037%2010.521L6.69775%2010.5894L7.40674%2011.314L7.47217%2011.3804L4.8042%2014.0483C4.97171%2014.351%205.06369%2014.69%205.06885%2015.0366V15.0386Z'%20fill='%23344A64'%20stroke='%23344A64'%20stroke-width='0.188888'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_139_3606'%3e%3crect%20width='17.0498'%20height='17.0498'%20fill='white'%20transform='translate(0.475098%200.475098)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",eW="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_750_5307)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M4.50021%204.52393L10.5002%2010.5201L16.5002%204.52393L17.378%205.56774V12.9049L16.5002%2014.2872H5.55771L3.7666%2013.6668V4.52393H4.50021Z'%20fill='%23FFE250'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M15.75%203H5.25C4.00736%203%203%204.02335%203%205.28571V12.9048C3%2014.1671%204.00736%2015.1905%205.25%2015.1905H15.75C16.9926%2015.1905%2018%2014.1671%2018%2012.9048V5.28571C18%204.02335%2016.9926%203%2015.75%203ZM15.4425%204.52381L11.0325%209.00381C10.8917%209.14805%2010.7%209.22918%2010.5%209.22918C10.3%209.22918%2010.1083%209.14805%209.9675%209.00381L5.5575%204.52381H15.4425ZM15.75%2013.6667C16.1642%2013.6667%2016.5%2013.3256%2016.5%2012.9048V5.56762L12.09%2010.0476C11.2115%2010.9389%209.78845%2010.9389%208.91%2010.0476L4.5%205.56762V12.9048C4.5%2013.3256%204.83579%2013.6667%205.25%2013.6667H15.75Z'%20fill='%233E4C5A'/%3e%3ccircle%20cx='16.6587'%20cy='14.7451'%20r='3.86133'%20fill='%23F6F8FC'/%3e%3c/g%3e%3cpath%20d='M15.4392%2012.307C15.5441%2012.2488%2015.6577%2012.2474%2015.7683%2012.2972C15.8778%2012.3467%2015.9519%2012.4314%2015.988%2012.5453H15.99C16.0246%2012.649%2016.0227%2012.7548%2015.9851%2012.8578C15.9469%2012.9624%2015.8772%2013.0436%2015.78%2013.099L15.7791%2013.1C15.4768%2013.2667%2015.2361%2013.4968%2015.0564%2013.7914C14.8775%2014.0847%2014.7881%2014.4079%2014.7878%2014.7621C14.7879%2014.9952%2014.8323%2015.2218%2014.9207%2015.4427C14.9935%2015.625%2015.1022%2015.7953%2015.2449%2015.9564V15.7308C15.2449%2015.6126%2015.2862%2015.5087%2015.3689%2015.4261C15.4514%2015.3439%2015.5548%2015.3025%2015.6726%2015.3021C15.7909%2015.3018%2015.8954%2015.3433%2015.9783%2015.4261C16.061%2015.509%2016.1019%2015.6127%2016.1013%2015.7308V17.0443C16.1013%2017.1624%2016.0608%2017.2664%2015.9783%2017.349C15.8957%2017.4316%2015.7916%2017.4722%2015.6736%2017.472V17.473H14.3591C14.241%2017.4729%2014.1369%2017.4317%2014.0544%2017.349C13.9721%2017.2664%2013.9317%2017.1623%2013.9314%2017.0443C13.9312%2016.9261%2013.9725%2016.8223%2014.0554%2016.7396C14.1381%2016.6573%2014.2414%2016.6157%2014.3591%2016.6156H14.6726C14.4106%2016.3679%2014.2213%2016.087%2014.1091%2015.7719C13.9906%2015.4387%2013.9314%2015.1014%2013.9314%2014.7611C13.9315%2014.2287%2014.0675%2013.7433%2014.3406%2013.308C14.613%2012.8737%2014.9797%2012.5393%2015.4392%2012.307ZM18.9578%2012.0179C19.0759%2012.018%2019.1798%2012.0585%2019.2625%2012.141C19.3452%2012.2237%2019.3868%2012.3284%2019.3865%2012.4467C19.3861%2012.5644%2019.3445%2012.6677%2019.2625%2012.7504C19.1799%2012.8334%2019.0761%2012.8738%2018.9578%2012.8734V12.8744H18.6355C18.8857%2013.1365%2019.0745%2013.4199%2019.1951%2013.7279C19.3227%2014.0539%2019.3867%2014.3879%2019.3865%2014.7289C19.3864%2015.2614%2019.2495%2015.7466%2018.9763%2016.182C18.7039%2016.6163%2018.3372%2016.9506%2017.8777%2017.183L17.8767%2017.182C17.7719%2017.2399%2017.6599%2017.2426%2017.5496%2017.1927C17.4395%2017.143%2017.3633%2017.0585%2017.3269%2016.9437C17.2926%2016.8401%2017.2949%2016.735%2017.3328%2016.6322C17.3712%2016.5279%2017.4402%2016.4464%2017.5369%2016.391L17.5378%2016.39C17.8401%2016.2232%2018.0806%2015.993%2018.2605%2015.6986C18.4395%2015.4057%2018.5292%2015.0834%2018.5291%2014.7289C18.5291%2014.4955%2018.4856%2014.2682%2018.3972%2014.0472C18.3241%2013.8647%2018.2153%2013.6934%2018.072%2013.5316V13.7601C18.0719%2013.8782%2018.0315%2013.9822%2017.949%2014.0648C17.8663%2014.1475%2017.7615%2014.1881%2017.6433%2014.1879C17.5256%2014.1875%2017.4221%2014.1469%2017.3396%2014.0648C17.2569%2013.9824%2017.2157%2013.8783%2017.2156%2013.7601V12.4457C17.2157%2012.3275%2017.2569%2012.2234%2017.3396%2012.141C17.4221%2012.0589%2017.5256%2012.0183%2017.6433%2012.0179H18.9578Z'%20fill='%233E4C5A'%20stroke='%233E4C5A'%20stroke-width='0.2'/%3e%3cdefs%3e%3cclipPath%20id='clip0_750_5307'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",tW="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_751_5597)'%3e%3cpath%20d='M15.4999%2014H14.7099L14.4299%2013.73C15.4099%2012.59%2015.9999%2011.11%2015.9999%209.5C15.9999%205.91%2013.0899%203%209.49991%203C6.07991%203%203.27991%205.64%203.02991%209H5.04991C5.29991%206.75%207.17991%205%209.49991%205C11.9899%205%2013.9999%207.01%2013.9999%209.5C13.9999%2011.99%2011.9899%2014%209.49991%2014C9.32991%2014%209.16991%2013.97%208.99991%2013.95V15.97C9.16991%2015.99%209.32991%2016%209.49991%2016C11.1099%2016%2012.5899%2015.41%2013.7299%2014.43L13.9999%2014.71V15.5L18.9999%2020.49L20.4899%2019L15.4999%2014Z'%20fill='%23344A64'/%3e%3c/g%3e%3ccircle%20cx='9.55469'%20cy='9.45557'%20r='4.49316'%20fill='%23FFE250'/%3e%3cg%20clip-path='url(%23clip1_751_5597)'%3e%3cpath%20d='M6.0747%2015.2672C6.00267%2015.2675%205.93225%2015.2459%205.87285%2015.2052C5.81344%2015.1645%205.76788%2015.1066%205.74225%2015.0393L5.17479%2013.5637C5.1633%2013.534%205.14572%2013.5069%205.12318%2013.4844C5.10064%2013.4619%205.07363%2013.4443%205.0439%2013.4328L3.56785%2012.8649C3.50061%2012.8391%203.44278%2012.7935%203.40199%2012.7342C3.36119%2012.6748%203.33936%2012.6045%203.33936%2012.5324C3.33936%2012.4604%203.36119%2012.3901%203.40199%2012.3308C3.44278%2012.2714%203.50061%2012.2258%203.56785%2012.2L5.04347%2011.6326C5.0732%2011.6211%205.10021%2011.6035%205.12275%2011.5809C5.14529%2011.5584%205.16288%2011.5314%205.17437%2011.5017L5.74225%2010.0256C5.76806%209.95838%205.81365%209.90054%205.873%209.85975C5.93235%209.81896%206.00268%209.79712%206.0747%209.79712C6.14671%209.79712%206.21704%209.81896%206.27639%209.85975C6.33574%209.90054%206.38133%209.95838%206.40713%2010.0256L6.9746%2011.5012C6.98609%2011.531%207.00367%2011.558%207.02621%2011.5805C7.04875%2011.6031%207.07575%2011.6206%207.10549%2011.6321L8.57259%2012.1966C8.64255%2012.2225%208.70283%2012.2694%208.74523%2012.3308C8.78756%2012.3923%208.80999%2012.4652%208.80944%2012.5399C8.80835%2012.6106%208.78603%2012.6794%208.74539%2012.7374C8.7048%2012.7953%208.64769%2012.8397%208.58156%2012.8649L7.10592%2013.4324C7.07618%2013.4439%207.04918%2013.4614%207.02664%2013.484C7.0041%2013.5065%206.98652%2013.5335%206.97502%2013.5633L6.40713%2015.0393C6.38151%2015.1066%206.33594%2015.1645%206.27654%2015.2052C6.21714%2015.2459%206.14671%2015.2675%206.0747%2015.2672Z'%20fill='%23FFE250'/%3e%3cpath%20d='M6.11108%209.5376L6.1687%209.5415L6.17651%209.54248C6.21226%209.54793%206.24734%209.55755%206.28101%209.5708L6.37769%209.62256L6.43433%209.66846C6.48712%209.71812%206.52824%209.77915%206.55444%209.84717L7.15503%2011.4067L8.71558%2012.0073C8.80679%2012.0425%208.88418%2012.1052%208.93921%2012.1851C8.99476%2012.2658%209.02515%2012.3618%209.02515%2012.4595C9.02501%2012.5565%208.99584%2012.6521%208.94019%2012.7329C8.88519%2012.8129%208.80718%2012.8754%208.71558%2012.9106L7.15405%2013.5093L6.55444%2015.0698C6.51941%2015.161%206.45806%2015.2401%206.37769%2015.2954C6.29731%2015.3505%206.2015%2015.3802%206.10425%2015.3804C6.00668%2015.3804%205.9105%2015.3508%205.82983%2015.2954C5.7501%2015.2405%205.68737%2015.1624%205.6521%2015.0708L5.05151%2013.5103L3.49194%2012.9097C3.40102%2012.8746%203.32263%2012.8132%203.26733%2012.7329C3.22581%2012.6725%203.19819%2012.6034%203.18726%2012.5317L3.18628%2012.5239L3.18237%2012.4663C3.18201%2012.4614%203.18201%2012.4565%203.18237%2012.4517L3.18628%2012.394L3.18726%2012.3862C3.19817%2012.3143%203.22587%2012.2455%203.26733%2012.1851L3.27124%2012.1792L3.30737%2012.1343L3.31226%2012.1274C3.36209%2012.0743%203.42404%2012.0335%203.49194%2012.0073L5.05151%2011.4067L5.6521%209.84717L5.65503%209.84033L5.67944%209.7876L5.68335%209.78076L5.7478%209.69385C5.77235%209.6672%205.79978%209.64323%205.82983%209.62256L5.83569%209.61768V9.61865L5.8855%209.58936L5.89233%209.58545L5.99487%209.54932C6.03039%209.54112%206.06746%209.5376%206.10425%209.5376H6.11108ZM5.67456%2011.7515C5.65029%2011.8145%205.61303%2011.8726%205.56519%2011.9204C5.51728%2011.9683%205.45923%2012.0055%205.39624%2012.0298L4.28003%2012.4575L5.39624%2012.8882L5.40112%2012.8901L5.43823%2012.9058L5.44312%2012.9087L5.50757%2012.9487C5.52783%2012.9635%205.54744%2012.9798%205.56519%2012.9976C5.6128%2013.0453%205.65032%2013.1026%205.67456%2013.1655L6.10327%2014.2798L6.53296%2013.1655L6.53491%2013.1606L6.55151%2013.1245L6.55347%2013.1196C6.5764%2013.0747%206.60647%2013.0334%206.64233%2012.9976L6.64624%2012.9927L6.67651%2012.9663L6.68042%2012.9634C6.71917%2012.9321%206.76287%2012.9065%206.8103%2012.8882L7.92456%2012.4585L6.8103%2012.0298C6.74749%2012.0056%206.69018%2011.9682%206.64233%2011.9204C6.59453%2011.8726%206.55723%2011.8146%206.53296%2011.7515L6.10229%2010.6353L5.67456%2011.7515Z'%20fill='%23344A64'%20stroke='%23344A64'%20stroke-width='0.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_751_5597'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_751_5597'%3e%3crect%20width='8.06842'%20height='8.06842'%20fill='white'%20transform='translate(3.02979%207.96582)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",nW="integration_sense",Hm="email_log_settings",rW="quick_access",AW="This feature can only be used for one App and is currently enabled for :enabledConnector.",oW=[{id:nW,heading:"Smart Previews",subHeading:"Quickly view details from {{app_name}} by hovering on entities in emails.",icon:$H,featureKey:qF},{id:Hm,heading:"Sync conversation",subHeading:"Save emails from Hiver to {{app_name}} to create a single source of truth for customer information.",icon:eW,featureKey:KF,modalSettings:{title:"Tell us why you no longer want to use this feature",radioOptions:[{label:"We already use another tool for this",value:"already_using_another_extension"},{label:"We don't need to log emails",value:"do_not_have-email_logging_requirement"},{label:"The feature isn't working as expected",value:"not_working_as_expected"},{label:"Other",value:"other"}],textArea:{placeholder:"Tell us more (optional)"}}},{id:rW,heading:"Quick Access",subHeading:"Access your {{app_name}} entities quickly with a single click.",icon:tW,featureKey:ZF}],sW="Advanced settings",aW="Enhance your integrations with contextual insights.",iW=g.styled(({className:e,...t})=>u.jsx(g.Tooltip,{...t,classes:{popper:e}}))(({width:e,height:t,color:n})=>({[`& .${g.tooltipClasses.arrow}`]:{color:n||"#fff !important"},[`& .${g.tooltipClasses.tooltip}`]:{backgroundColor:n||"#fff",maxWidth:e,height:t,width:e,borderRadius:"6px",boxShadow:"0px 2px 10px 0px #00000026"}})),lW=e=>u.jsx(g.Button,{...e,disabled:e.isLoading||e.disabled,children:e.isLoading?u.jsx(g.CircularProgress,{sx:{color:"#97A3B7"},size:20}):e.label}),cW=({onCancel:e,onSubmit:t,isLoading:n,showOptions:r=!0,title:A,feedbackOptions:o,placeholder:s})=>{const[a,i]=y.useState(""),[l,c]=y.useState(""),d=E=>{i(E.target.value)},f=E=>{E.stopPropagation();const{value:p}=(E==null?void 0:E.target)||{};c(p)},B=()=>{t({feedbackOption:a,feedbackComment:l})},I=()=>{e==null||e()},C=r?!a:!l;return u.jsxs("div",{className:"max-h-[420px] w-[510px] rounded-xl p-4 box-border [&>*]:box-border [&_.MuiFormGroup-root]:mb-3",children:[u.jsx(g.Typography,{variant:"h3",children:A}),u.jsx("div",{className:"border-b border-gray-6 mx-[-16px] my-3"}),r?u.jsx(g.FormControl,{children:u.jsx(g.RadioGroup,{"aria-labelledby":"demo-controlled-radio-buttons-group",name:"controlled-radio-buttons-group",value:a,onChange:d,children:o.map(E=>u.jsx(g.FormControlLabel,{value:E.value,control:u.jsx(g.Radio,{}),label:E.label},E.value))})}):null,u.jsx(Kd,{type:"text",placeholder:s,value:l,name:"feedbackComment",inputChangeHandler:f,multiline:!0,rows:5,limit:250,validation:{validate:Ak()}}),u.jsxs("div",{className:"flex justify-end mt-8 gap-2",children:[u.jsx(g.Button,{variant:"text",color:"primary",style:{color:g.theme.palette.gray.gray3},disabled:n,onClick:I,children:"Cancel"}),u.jsx(lW,{variant:"contained",color:"primary",isLoading:n,disabled:C,label:"Submit",onClick:B})]})]})},uW=un+"/connectors/:connectorId/advanced-feature",gW=`${un}/connector/admin-feedback`,dW=async(e,t)=>{try{const n=RA(uW,{connectorId:t})+"?channel_type=email",r=await Ke({url:n,method:cn.PATCH,data:e});return Qn({type:Bs,message:"Successfully updated feature"}),r}catch(n){return Qn({type:qr,message:"Failed to update feature"}),Promise.reject(n)}};function CW(){return Al({mutationKey:["toggle-advanced-feature"],mutationFn:async({connectorId:e,data:t})=>{if(!e)throw new Error("Connector ID is required");const n=await dW(t,e);return n==null?void 0:n.data}})}const EW=async({feedbackData:e})=>{try{const t=await Ke({url:gW+"?channel_type=email",method:"POST",data:e});return t==null?void 0:t.data}catch(t){throw console.error("Error submitting feedback:",t),t}};function fW(){return Al({mutationFn:EW})}const IW=({id:e,heading:t,subHeading:n,isEnabled:r,icon:A,connectorId:o,connectorType:s,modalSettings:a,disabled:i=!1,tooltipContent:l=""})=>{var v;const[c,d]=y.useState(!1),[f,B]=y.useState(r),[I,C]=y.useState(!1),E=Fe(qa)===pe.LOADING,{mutate:p}=CW(),{mutate:h}=fW();y.useEffect(()=>{B(r)},[r]);const Q=x=>{const w=x.target.checked;d(!0),p({connectorId:o,data:{[e]:w}},{onSettled:()=>{d(!1)},onSuccess:b=>{b.enabled!==void 0&&B(b.enabled),!w&&a&&C(!0)}})},m=x=>{const w={feedback_type:"email-logging-disabled",comment:x.feedbackComment,option:x.feedbackOption,connector_id:o,connector_type:s};h({feedbackData:w}),C(!1)};return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"w-full flex justify-between items-center border-1 border-gray-5 rounded-sm p-4 gap-2.5 [&:first-child:last-child]:col-span-2",children:[u.jsxs("div",{className:"flex gap-2.5",children:[u.jsx("div",{className:"h-11 w-10.5 p-3 bg-gray-6a rounded-sm shrink-0",children:u.jsx("img",{src:A,alt:"Smart Previews Icon"})}),u.jsxs("div",{className:"flex flex-col items-start",children:[u.jsx("h3",{className:"font-medium! text-body1",children:t}),u.jsx("p",{className:"text-body2",children:n})]})]}),u.jsx(iW,{title:l,placement:"top",color:"#343C45",arrow:!0,width:"287px",children:u.jsx("div",{className:"w-12",children:u.jsx(xm,{id:`switch_${e}`,checked:f,onClick:x=>x==null?void 0:x.stopPropagation(),onChange:Q,isLoading:c||E,disabled:c||E||i})})})]}),u.jsx(kc,{shown:I,setShown:C,borderRadius:12,sx:{zIndex:15002},children:u.jsx(cW,{onCancel:()=>C(!1),onSubmit:m,isLoading:c,title:(a==null?void 0:a.title)||"",feedbackOptions:(a==null?void 0:a.radioOptions)||[],placeholder:((v=a==null?void 0:a.textArea)==null?void 0:v.placeholder)||""})})]})},BW=(e,t)=>typeof e[t]=="boolean",pW=(e,t)=>{var n;return typeof e[t]=="object"&&typeof((n=e[t])==null?void 0:n.enabled)=="boolean"},hW=e=>{const t={};for(const n in e)pW(e,n)?t[n]=e[n]:BW(e,n)&&(t[n]={enabled:e[n],connector:n===Hm?e.connector:void 0});return t},QW=({advancedFeatures:e,connectorId:t,connectorName:n,connectorType:r})=>{const{availableFeatures:A}=y.useContext(_t),o=hW(e),s=oW.filter(l=>xr(A,l.featureKey)&&typeof o[l.id]=="object");if(s.length===0)return null;const a=l=>o[l].enabled,i=l=>{var d;const c=o[l];return!a(l)&&((d=c==null?void 0:c.connector)!=null&&d.id)?{isDisabled:!0,tooltipContent:RA(AW,{enabledConnector:c.connector.name,currentConnector:n})}:{isDisabled:!1,tooltipContent:""}};return u.jsxs("div",{children:[u.jsx("h2",{className:"text-h2 text-[#4D596C]! mt-8 mb-2",children:sW}),u.jsx("p",{className:"text-body2 text-[#6F7C90]!",children:aW}),u.jsx("div",{className:"grid grid-cols-2 mt-6 gap-4",children:s.map(l=>{const{isDisabled:c,tooltipContent:d}=i(l.id);return u.jsx(IW,{id:l.id,heading:l.heading.replace(/\{\{app_name\}\}/g,n),subHeading:l.subHeading.replace(/\{\{app_name\}\}/g,n),isEnabled:a(l.id),icon:l.icon,connectorId:t,connectorType:r,modalSettings:l.modalSettings,disabled:c,tooltipContent:d},l.id)})})]})},mW=({connectorData:e})=>{const{cardList:t=[],name:n="",customCardsList:r=[],advancedFeatures:A={},type:o}=e||{},[s,a]=y.useState(!1),{id:i=""}=TA();return u.jsxs(u.Fragment,{children:[u.jsx(IC,{shown:s,setShown:a,connectorName:n}),u.jsx("h2",{className:"text-h2 text-[#4D596C]!",children:Bj}),u.jsx("p",{className:"text-body2 text-[#6F7C90]! mb-6 mt-2",children:pj}),u.jsx(mm,{setShowEnabledModal:a,currentConnectorId:i,infoCards:[...t,...r]}),u.jsx(QW,{advancedFeatures:A,connectorId:i,connectorName:n,connectorType:o})]})},yW=()=>{const e=wr(),{sendTrackingEvent:t}=y.useContext(_t),n=Fe(iC),r=Fe(qa),A=Fe(Am),o=Fe(Qo),s=Fe(Wa),{id:a=""}=TA(),[i]=Yo(),l=i.get("isEdit")==="true",c=i.get("tabIndex"),[d,f]=y.useState(()=>{const x=Number(c);return Number.isNaN(x)||x<0?0:x>Fc.length-1?Fc.length-1:x}),B=(x,w)=>{f(w)},I=(o==null?void 0:o[a])||null,C=(s==null?void 0:s[a])||null,E=l?I:C,p=!(E!=null&&E.isAuthenticated),h=!!(E!=null&&E.isEnabled),Q=[n,r].includes(pe.LOADING)||p,m=[{name:pc,route:`${Ye.BASEPATH}${Ye.DASHBOARD}`},{name:(E==null?void 0:E.name)||"",route:`${Ye.BASEPATH}${Ye.API_VIEW}/${a}?isEdit=${String(l)}`},{name:kV}],v=(x,w)=>{x==null||x.stopPropagation(),e(Ja({id:w,enabled:x.target.checked})).unwrap().then(()=>{x.target.checked?t(tt.TOGGLE_ENABLED,{connector_name:E==null?void 0:E.name}):(t(tt.TOGGLE_DISABLED,{connector_name:E==null?void 0:E.name}),Qn({message:U0,type:AC}))}).catch(()=>{Qn({message:X0,type:qr})})};return y.useEffect(()=>{e(Xa()),l?(e(Ua(a)),e(Tc(a))):e(za(a))},[l,e,a]),u.jsxs("div",{className:"w-full h-full flex flex-col",children:[u.jsxs("div",{className:`flex flex-row justify-between ${l?"mb-2":"mb-9"}`,children:[u.jsx(vm,{options:m}),l?u.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[u.jsx(jV,{active:h,label:u.jsx(g.Typography,{variant:"body2",children:h?"Active":"Inactive"})}),u.jsx(xm,{isLoading:(A==null?void 0:A[a])===pe.LOADING,id:`switch_${a}`,checked:h,disabled:Q,onClick:x=>x==null?void 0:x.stopPropagation(),onChange:x=>v(x,a)})]}):null]}),l?u.jsxs(u.Fragment,{children:[u.jsx("div",{children:u.jsxs(g.Tabs,{value:d,onChange:B,classes:{flexContainer:"border-b-2 border-[#D6DDE8]"},children:[u.jsx(g.Tab,{label:Fc[0],className:"border-b-0!"}),u.jsx(g.Tab,{label:Fc[1],className:"border-b-0!"})]})}),u.jsx("div",{hidden:d!==0,className:"grow overflow-auto py-6",children:u.jsx(Vm,{connectorData:E})}),u.jsx("div",{hidden:d!==1,className:"grow overflow-auto py-6",children:u.jsx(mW,{connectorData:E})})]}):u.jsx("div",{className:"grow overflow-auto py-0",children:u.jsx(Vm,{connectorData:E})})]})},bW=e=>e.auth.verifyTokenApiStatus,vW=e=>e.auth.authVerificationDone,xW=g.styled(g.Box)`
3129
3129
  position: fixed;
3130
3130
  z-index: 1000;
3131
3131
  background-color: #fff;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiver/connector-admin",
3
- "version": "4.7.0",
3
+ "version": "4.7.1",
4
4
  "main": "index.es.js",
5
5
  "module": "index.es.js",
6
6
  "types": "index.d.ts",
@@ -1 +1 @@
1
- {"version":3,"file":"connector-template.d.ts","sourceRoot":"","sources":["../../../../../src/v2/testing/mocks/handlers/connector-template.ts"],"names":[],"mappings":"AAgQA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyB,CAAC;AA+CrD,eAAO,MAAM,QAAQ,6BASpB,CAAC"}
1
+ {"version":3,"file":"connector-template.d.ts","sourceRoot":"","sources":["../../../../../src/v2/testing/mocks/handlers/connector-template.ts"],"names":[],"mappings":"AAiQA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyB,CAAC;AA+CrD,eAAO,MAAM,QAAQ,6BASpB,CAAC"}