@hiver/connector-admin 4.4.6-emailLogAdmin-beta.2 → 4.4.6-emailLogAdmin-beta.3

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
@@ -34098,17 +34098,17 @@ const LH = T(V)`
34098
34098
  },
34099
34099
  {
34100
34100
  id: JH,
34101
- heading: "Log Emails",
34101
+ heading: "Sync conversation",
34102
34102
  subHeading: "Save emails from Hiver to {{app_name}} to create a single source of truth for customer information.",
34103
34103
  icon: zH,
34104
34104
  featureKey: Jk,
34105
- singletonMessage: "This feature is already enabled for ':enabledConnector'. Disable it to enable for ':currentConnector'.",
34105
+ singletonMessage: "This feature can only be used for one App and is currently enabled for :enabledConnector.",
34106
34106
  modalSettings: {
34107
- title: "Please provide us feedback on why you are disabling email logging?",
34107
+ title: "Tell us why you no longer want to use this feature",
34108
34108
  radioOptions: [
34109
- { label: "We are already using another extension for this", value: "already_using_another_extension" },
34110
- { label: "Don’t have email logging requirement", value: "do_not_have-email_logging_requirement" },
34111
- { label: "Not working as expected", value: "not_working_as_expected" },
34109
+ { label: "We already use another tool for this", value: "already_using_another_extension" },
34110
+ { label: "We don't need to log emails", value: "do_not_have-email_logging_requirement" },
34111
+ { label: "The feature isn't working as expected", value: "not_working_as_expected" },
34112
34112
  { label: "Other", value: "other" }
34113
34113
  ],
34114
34114
  textArea: {
package/index.umd.js CHANGED
@@ -3116,7 +3116,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
3116
3116
  `,MH=g.styled(g.icons.OpenInNew)`
3117
3117
  height: 18px;
3118
3118
  width: 18px;
3119
- `,jH=({upgradeGuideContent:e,upgradeGuideLink:t})=>u.jsxs(NH,{children:[u.jsxs(g.Stack,{marginBottom:"20px",children:[u.jsxs(g.Stack,{direction:"row",padding:"8px 0",gap:"4px",alignItems:"center",children:[u.jsx(kH,{}),u.jsx(g.Typography,{variant:"body1_medium",color:g.theme.palette.gray.black,children:WV})]}),u.jsx(g.Typography,{variant:"body2",children:zV})]}),u.jsx(g.Typography,{variant:"body2_medium",marginBottom:"8px",color:g.theme.palette.gray.black,children:YV}),u.jsx(PH,{variant:"body2",dangerouslySetInnerHTML:{__html:e}}),t?u.jsxs(FH,{target:"_blank",underline:"none",href:t,children:[u.jsx(MH,{}),JV]}):null]}),jm=(e,t)=>{const n=t.authType===$a,r=t.authType===dm,A=t.authType===ps;if(!e||!e.data)return{authUrl:"",authStatus:r?tt.API_KEY_FAILED:n?tt.BASIC_AUTH_FAILED:A?tt.OAUTH1_FAILED:tt.OAUTH_FAILED};const o=e.data;return r?{authUrl:"",id:o.id,authStatus:tt.API_KEY_SUCCESS}:n?{authUrl:"",id:o.id,authStatus:tt.BASIC_AUTH_SUCCESS}:A?{authUrl:"",id:o.id,authStatus:tt.OAUTH1_SUCCESS}:o.authorizationUrl?{authUrl:o.authorizationUrl,id:o.id,authStatus:tt.PENDING}:{authUrl:"",id:"",authStatus:tt.OAUTH_FAILED}},GH=async e=>{try{const t=await rt({url:eM,method:cn.POST,data:e});return jm(t,e.authDetails)}catch(t){return Promise.reject(t)}},VH=async(e,t)=>{try{const n=nM.replace("{{id}}",t),r=await rt({url:n,method:cn.PATCH,data:e});return jm(r,e.authDetails)}catch(n){return Promise.reject(n)}},HH=({connectorId:e,onSuccess:t})=>{const n=Vo(),r=y.useMemo(()=>["authDetails",{connectorId:e}],[e]),{data:A}=rl({queryKey:r,queryFn:()=>Promise.resolve({authUrl:"",authStatus:tt.IDLE,id:""}),enabled:!1}),o=qu({mutationFn:a=>"connectorId"in a?VH(a.data,a.connectorId):GH(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}},WH=async e=>{var t;try{const n=await rt({url:RA(AM,{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)}},zH=({connectorId:e,enabled:t=!1})=>{const n=Vo(),r=y.useMemo(()=>["authSuccessStatus",{connectorId:e}],[e]),A=rl({queryKey:r,queryFn:()=>WH(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},Gm=({connectorData:e})=>{const{sendTrackingEvent:t,availableFeatures:n}=y.useContext(jt),[r,A]=y.useState(!1),o=Fe(qa),s=Fe(z0),a=y.useRef(null),i=on(),{id:l=""}=TA(),[c]=Yo(),d=c.get("isEdit")==="true",I=!!(e!=null&&e.showUpgradeButton),B=lr(n,JP),{data:f,mutateStatus:C,isLoading:E,mutate:p}=HH({connectorId:l,onSuccess:()=>{B&&A(!0)}}),h=zH({connectorId:(f==null?void 0:f.id)||"",enabled:r}),{status:Q}=h.data||{},m=(f==null?void 0:f.authStatus)||tt.IDLE,v=(f==null?void 0:f.authUrl)||"",x=wr();y.useEffect(()=>()=>{x(aM())},[x]),y.useEffect(()=>{let b,T;const j=F=>{a.current&&F.origin===window.location.origin&&(F.data===xm||F.data===hC)&&(clearTimeout(b),a.current.close(),a.current=null,C(F.data===hC?tt.OAUTH_SUCCESS:tt.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(tt.OAUTH_FAILED)},F),T=setInterval(()=>{var X;(X=a.current)!=null&&X.closed&&(clearInterval(T),a.current=null,C(tt.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"?tt.OAUTH_SUCCESS:tt.OAUTH_FAILED))},[Q,C,B]),y.useEffect(()=>{switch((m===tt.OAUTH1_FAILED||m===tt.OAUTH_FAILED||m===tt.API_KEY_FAILED||m===tt.BASIC_AUTH_FAILED)&&i(Ye.BASEPATH),(m===tt.OAUTH1_SUCCESS||m===tt.OAUTH_SUCCESS||m===tt.API_KEY_SUCCESS||m===tt.BASIC_AUTH_SUCCESS)&&f!=null&&f.id&&i(d?Ye.BASEPATH:`${Ye.BASEPATH}${Ye.CONNECTOR_INITIAL_SETUP}/${l}?connectorId=${f.id}`),m){case tt.BASIC_AUTH_SUCCESS:case tt.OAUTH1_SUCCESS:case tt.OAUTH_SUCCESS:{Qn({message:I?wm:FV,type:Bs}),t(et.CONNECTOR_AUTH_SUCCESS,{connector_name:e==null?void 0:e.name});break}case tt.BASIC_AUTH_FAILED:case tt.OAUTH1_FAILED:case tt.OAUTH_FAILED:{Qn({message:I?Tm:PV,type:qr});break}case tt.REQUEST_FAILED:{Qn({message:oC,type:qr});break}case tt.API_KEY_SUCCESS:{Qn({message:I?wm:jV,type:Bs}),t(et.CONNECTOR_AUTH_SUCCESS,{connector_name:e==null?void 0:e.name});break}case tt.API_KEY_FAILED:{Qn({message:I?Tm:oC,type:qr});break}}},[m,i,I,l,d,e==null?void 0:e.name,t,f==null?void 0:f.id]);const w=o===pe.LOADING||s===pe.LOADING;return u.jsxs(RH,{direction:"row",id:"connectors-auth-page",children:[u.jsx("div",{className:"flex flex-col",children:u.jsx(mH,{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:eG}),d?null:u.jsx(EC,{isSettingsPage:!0}),u.jsx(LH,{connectorName:e==null?void 0:e.name,supportLinks:e==null?void 0:e.supportLinks})]})]})]})},YH=[{id:"integration_sense",heading:"Smart Previews",subHeading:"Quickly view details from {{app_name}} by hovering on entities in emails.",icon:"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",featureKey:XP},{id:"email_log_settings",heading:"Log Emails",subHeading:"Save emails from Hiver to {{app_name}} to create a single source of truth for customer information.",icon:"data:image/svg+xml,%3csvg%20width='21'%20height='20'%20viewBox='0%200%2021%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_167_67028)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M5.00021%204.52344L11.0002%2010.5196L17.0002%204.52344L17.878%205.56725V12.9044L17.0002%2014.2868H6.05771L4.2666%2013.6663V4.52344H5.00021Z'%20fill='%23FFE250'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M16.25%203H5.75C4.50736%203%203.5%204.02335%203.5%205.28571V12.9048C3.5%2014.1671%204.50736%2015.1905%205.75%2015.1905H16.25C17.4926%2015.1905%2018.5%2014.1671%2018.5%2012.9048V5.28571C18.5%204.02335%2017.4926%203%2016.25%203ZM15.9425%204.52344L11.5325%209.00344C11.3917%209.14768%2011.2%209.22881%2011%209.22881C10.8%209.22881%2010.6083%209.14768%2010.4675%209.00344L6.0575%204.52344H15.9425ZM16.25%2013.6667C16.6642%2013.6667%2017%2013.3256%2017%2012.9048V5.56762L12.59%2010.0476C11.7115%2010.9389%2010.2885%2010.9389%209.41%2010.0476L5%205.56762V12.9048C5%2013.3256%205.33579%2013.6667%205.75%2013.6667H16.25Z'%20fill='%233E4C5A'/%3e%3ccircle%20cx='17.1587'%20cy='14.7451'%20r='3.86133'%20fill='%23F6F8FC'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_167_67028'%3e%3crect%20width='20'%20height='20'%20fill='white'%20transform='translate(0.5)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",featureKey:UP,singletonMessage:"This feature is already enabled for ':enabledConnector'. Disable it to enable for ':currentConnector'.",modalSettings:{title:"Please provide us feedback on why you are disabling email logging?",radioOptions:[{label:"We are already using another extension for this",value:"already_using_another_extension"},{label:"Don’t have email logging requirement",value:"do_not_have-email_logging_requirement"},{label:"Not working as expected",value:"not_working_as_expected"},{label:"Other",value:"other"}],textArea:{placeholder:"Tell us more (optional)"}}}],JH="Advanced settings",XH="Enhance your integrations with contextual insights.",UH=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"}})),qH=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}),ZH=({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)},I=E=>{E.stopPropagation();const{value:p}=(E==null?void 0:E.target)||{};c(p)},B=()=>{t({feedbackOption:a,feedbackComment:l})},f=()=>{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:I,multiline:!0,rows:5,limit:250,validation:{validate:nF()}}),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:f,children:"Cancel"}),u.jsx(qH,{variant:"contained",color:"primary",isLoading:n,disabled:C,label:"Submit",onClick:B})]})]})},KH=En+"/connectors/:connectorId/advanced-feature",$H=async(e,t)=>{try{const n=RA(KH,{connectorId:t})+"?channel_type=email",r=await rt({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 eW(){return qu({mutationKey:["toggle-advanced-feature"],mutationFn:async({connectorId:e,data:t})=>{if(!e)throw new Error("Connector ID is required");const n=await $H(t,e);return n==null?void 0:n.data}})}const tW=({id:e,heading:t,subHeading:n,isEnabled:r,icon:A,connectorId:o,modalSettings:s,disabled:a=!1,tooltipContent:i=""})=>{var Q;const[l,c]=y.useState(!1),[d,I]=y.useState(r),[B,f]=y.useState(!1),C=Fe(qa)===pe.LOADING,{mutate:E}=eW();y.useEffect(()=>{I(r)},[r]);const p=m=>{const v=m.target.checked;c(!0),E({connectorId:o,data:{[e]:v}},{onSettled:()=>{c(!1)},onSuccess:x=>{x.enabled!==void 0&&I(x.enabled),!v&&s&&f(!0)}})},h=m=>{console.log("debug::feedbackoptions",m.feedbackOption,m.feedbackComment),f(!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",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",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(UH,{title:i,placement:"top",color:"#343C45",arrow:!0,width:"287px",children:u.jsx("div",{className:"w-12",children:u.jsx(vm,{id:`switch_${e}`,checked:d,onClick:m=>m==null?void 0:m.stopPropagation(),onChange:p,isLoading:l||C,disabled:l||C||a})})})]}),u.jsx(Nc,{shown:B,setShown:f,borderRadius:12,sx:{zIndex:15002},children:u.jsx(ZH,{onCancel:()=>f(!1),onSubmit:h,isLoading:l,title:(s==null?void 0:s.title)||"",feedbackOptions:(s==null?void 0:s.radioOptions)||[],placeholder:((Q=s==null?void 0:s.textArea)==null?void 0:Q.placeholder)||""})})]})},nW=({advancedFeatures:e,connectorId:t,connectorName:n})=>{const{availableFeatures:r}=y.useContext(jt),A=YH.filter(a=>lr(r,a.featureKey)&&typeof(e==null?void 0:e[a.id])<"u"&&e[a.id]!==null);if(A.length===0)return null;const o=a=>typeof(e==null?void 0:e[a])=="boolean"&&e[a],s=(a,i)=>{var l;return i&&!o(a)&&((l=e==null?void 0:e.connector)!=null&&l.id)?{isDisabled:!0,tooltipContent:RA(i,{enabledConnector:e.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:JH}),u.jsx("p",{className:"text-body2 text-[#6F7C90]!",children:XH}),u.jsx("div",{className:"flex flex-wrap mt-6 gap-4",children:A.map(a=>{const{isDisabled:i,tooltipContent:l}=s(a.id,a.singletonMessage);return u.jsx(tW,{id:a.id,heading:a.heading.replace(/\{\{app_name\}\}/g,n),subHeading:a.subHeading.replace(/\{\{app_name\}\}/g,n),isEnabled:o(a.id),icon:a.icon,connectorId:t,modalSettings:a.modalSettings,disabled:i,tooltipContent:l},a.id)})})]})},rW=({connectorData:e})=>{const{cardList:t=[],name:n="",customCardsList:r=[],advancedFeatures:A={}}=e||{},[o,s]=y.useState(!1),{id:a=""}=TA();return u.jsxs(u.Fragment,{children:[u.jsx(fC,{shown:o,setShown:s,connectorName:n}),u.jsx("h2",{className:"text-h2 text-[#4D596C]!",children:Cj}),u.jsx("p",{className:"text-body2 text-[#6F7C90]! mb-6 mt-2",children:Ej}),u.jsx(Qm,{setShowEnabledModal:s,currentConnectorId:a,infoCards:[...t,...r]}),u.jsx(nW,{advancedFeatures:A,connectorId:a,connectorName:n})]})},AW=()=>{const e=wr(),{sendTrackingEvent:t}=y.useContext(jt),n=Fe(iC),r=Fe(qa),A=Fe(rm),o=Fe(Qo),s=Fe(Wa),{id:a=""}=TA(),[i]=Yo(),l=i.get("isEdit")==="true",c=i.get("tabIndex"),[d,I]=y.useState(()=>{const x=Number(c);return Number.isNaN(x)||x<0?0:x>kc.length-1?kc.length-1:x}),B=(x,w)=>{I(w)},f=(o==null?void 0:o[a])||null,C=(s==null?void 0:s[a])||null,E=l?f:C,p=!(E!=null&&E.isAuthenticated),h=!!(E!=null&&E.isEnabled),Q=[n,r].includes(pe.LOADING)||p,m=[{name:Bc,route:`${Ye.BASEPATH}${Ye.DASHBOARD}`},{name:(E==null?void 0:E.name)||"",route:`${Ye.BASEPATH}${Ye.API_VIEW}/${a}?isEdit=${String(l)}`},{name:SV}],v=(x,w)=>{x==null||x.stopPropagation(),e(Ja({id:w,enabled:x.target.checked})).unwrap().then(()=>{x.target.checked?t(et.TOGGLE_ENABLED,{connector_name:E==null?void 0:E.name}):(t(et.TOGGLE_DISABLED,{connector_name:E==null?void 0:E.name}),Qn({message:X0,type:AC}))}).catch(()=>{Qn({message:J0,type:qr})})};return y.useEffect(()=>{e(Xa()),l?(e(Ua(a)),e(wc(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(bm,{options:m}),l?u.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[u.jsx(LV,{active:h,label:u.jsx(g.Typography,{variant:"body2",children:h?"Active":"Inactive"})}),u.jsx(vm,{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:kc[0],className:"border-b-0!"}),u.jsx(g.Tab,{label:kc[1],className:"border-b-0!"})]})}),u.jsx("div",{hidden:d!==0,className:"grow overflow-auto py-6",children:u.jsx(Gm,{connectorData:E})}),u.jsx("div",{hidden:d!==1,className:"grow overflow-auto py-6",children:u.jsx(rW,{connectorData:E})})]}):u.jsx("div",{className:"grow overflow-auto py-0",children:u.jsx(Gm,{connectorData:E})})]})},oW=e=>e.auth.verifyTokenApiStatus,sW=e=>e.auth.authVerificationDone,aW=g.styled(g.Box)`
3119
+ `,jH=({upgradeGuideContent:e,upgradeGuideLink:t})=>u.jsxs(NH,{children:[u.jsxs(g.Stack,{marginBottom:"20px",children:[u.jsxs(g.Stack,{direction:"row",padding:"8px 0",gap:"4px",alignItems:"center",children:[u.jsx(kH,{}),u.jsx(g.Typography,{variant:"body1_medium",color:g.theme.palette.gray.black,children:WV})]}),u.jsx(g.Typography,{variant:"body2",children:zV})]}),u.jsx(g.Typography,{variant:"body2_medium",marginBottom:"8px",color:g.theme.palette.gray.black,children:YV}),u.jsx(PH,{variant:"body2",dangerouslySetInnerHTML:{__html:e}}),t?u.jsxs(FH,{target:"_blank",underline:"none",href:t,children:[u.jsx(MH,{}),JV]}):null]}),jm=(e,t)=>{const n=t.authType===$a,r=t.authType===dm,A=t.authType===ps;if(!e||!e.data)return{authUrl:"",authStatus:r?tt.API_KEY_FAILED:n?tt.BASIC_AUTH_FAILED:A?tt.OAUTH1_FAILED:tt.OAUTH_FAILED};const o=e.data;return r?{authUrl:"",id:o.id,authStatus:tt.API_KEY_SUCCESS}:n?{authUrl:"",id:o.id,authStatus:tt.BASIC_AUTH_SUCCESS}:A?{authUrl:"",id:o.id,authStatus:tt.OAUTH1_SUCCESS}:o.authorizationUrl?{authUrl:o.authorizationUrl,id:o.id,authStatus:tt.PENDING}:{authUrl:"",id:"",authStatus:tt.OAUTH_FAILED}},GH=async e=>{try{const t=await rt({url:eM,method:cn.POST,data:e});return jm(t,e.authDetails)}catch(t){return Promise.reject(t)}},VH=async(e,t)=>{try{const n=nM.replace("{{id}}",t),r=await rt({url:n,method:cn.PATCH,data:e});return jm(r,e.authDetails)}catch(n){return Promise.reject(n)}},HH=({connectorId:e,onSuccess:t})=>{const n=Vo(),r=y.useMemo(()=>["authDetails",{connectorId:e}],[e]),{data:A}=rl({queryKey:r,queryFn:()=>Promise.resolve({authUrl:"",authStatus:tt.IDLE,id:""}),enabled:!1}),o=qu({mutationFn:a=>"connectorId"in a?VH(a.data,a.connectorId):GH(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}},WH=async e=>{var t;try{const n=await rt({url:RA(AM,{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)}},zH=({connectorId:e,enabled:t=!1})=>{const n=Vo(),r=y.useMemo(()=>["authSuccessStatus",{connectorId:e}],[e]),A=rl({queryKey:r,queryFn:()=>WH(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},Gm=({connectorData:e})=>{const{sendTrackingEvent:t,availableFeatures:n}=y.useContext(jt),[r,A]=y.useState(!1),o=Fe(qa),s=Fe(z0),a=y.useRef(null),i=on(),{id:l=""}=TA(),[c]=Yo(),d=c.get("isEdit")==="true",I=!!(e!=null&&e.showUpgradeButton),B=lr(n,JP),{data:f,mutateStatus:C,isLoading:E,mutate:p}=HH({connectorId:l,onSuccess:()=>{B&&A(!0)}}),h=zH({connectorId:(f==null?void 0:f.id)||"",enabled:r}),{status:Q}=h.data||{},m=(f==null?void 0:f.authStatus)||tt.IDLE,v=(f==null?void 0:f.authUrl)||"",x=wr();y.useEffect(()=>()=>{x(aM())},[x]),y.useEffect(()=>{let b,T;const j=F=>{a.current&&F.origin===window.location.origin&&(F.data===xm||F.data===hC)&&(clearTimeout(b),a.current.close(),a.current=null,C(F.data===hC?tt.OAUTH_SUCCESS:tt.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(tt.OAUTH_FAILED)},F),T=setInterval(()=>{var X;(X=a.current)!=null&&X.closed&&(clearInterval(T),a.current=null,C(tt.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"?tt.OAUTH_SUCCESS:tt.OAUTH_FAILED))},[Q,C,B]),y.useEffect(()=>{switch((m===tt.OAUTH1_FAILED||m===tt.OAUTH_FAILED||m===tt.API_KEY_FAILED||m===tt.BASIC_AUTH_FAILED)&&i(Ye.BASEPATH),(m===tt.OAUTH1_SUCCESS||m===tt.OAUTH_SUCCESS||m===tt.API_KEY_SUCCESS||m===tt.BASIC_AUTH_SUCCESS)&&f!=null&&f.id&&i(d?Ye.BASEPATH:`${Ye.BASEPATH}${Ye.CONNECTOR_INITIAL_SETUP}/${l}?connectorId=${f.id}`),m){case tt.BASIC_AUTH_SUCCESS:case tt.OAUTH1_SUCCESS:case tt.OAUTH_SUCCESS:{Qn({message:I?wm:FV,type:Bs}),t(et.CONNECTOR_AUTH_SUCCESS,{connector_name:e==null?void 0:e.name});break}case tt.BASIC_AUTH_FAILED:case tt.OAUTH1_FAILED:case tt.OAUTH_FAILED:{Qn({message:I?Tm:PV,type:qr});break}case tt.REQUEST_FAILED:{Qn({message:oC,type:qr});break}case tt.API_KEY_SUCCESS:{Qn({message:I?wm:jV,type:Bs}),t(et.CONNECTOR_AUTH_SUCCESS,{connector_name:e==null?void 0:e.name});break}case tt.API_KEY_FAILED:{Qn({message:I?Tm:oC,type:qr});break}}},[m,i,I,l,d,e==null?void 0:e.name,t,f==null?void 0:f.id]);const w=o===pe.LOADING||s===pe.LOADING;return u.jsxs(RH,{direction:"row",id:"connectors-auth-page",children:[u.jsx("div",{className:"flex flex-col",children:u.jsx(mH,{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:eG}),d?null:u.jsx(EC,{isSettingsPage:!0}),u.jsx(LH,{connectorName:e==null?void 0:e.name,supportLinks:e==null?void 0:e.supportLinks})]})]})]})},YH=[{id:"integration_sense",heading:"Smart Previews",subHeading:"Quickly view details from {{app_name}} by hovering on entities in emails.",icon:"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",featureKey:XP},{id:"email_log_settings",heading:"Sync conversation",subHeading:"Save emails from Hiver to {{app_name}} to create a single source of truth for customer information.",icon:"data:image/svg+xml,%3csvg%20width='21'%20height='20'%20viewBox='0%200%2021%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_167_67028)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M5.00021%204.52344L11.0002%2010.5196L17.0002%204.52344L17.878%205.56725V12.9044L17.0002%2014.2868H6.05771L4.2666%2013.6663V4.52344H5.00021Z'%20fill='%23FFE250'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M16.25%203H5.75C4.50736%203%203.5%204.02335%203.5%205.28571V12.9048C3.5%2014.1671%204.50736%2015.1905%205.75%2015.1905H16.25C17.4926%2015.1905%2018.5%2014.1671%2018.5%2012.9048V5.28571C18.5%204.02335%2017.4926%203%2016.25%203ZM15.9425%204.52344L11.5325%209.00344C11.3917%209.14768%2011.2%209.22881%2011%209.22881C10.8%209.22881%2010.6083%209.14768%2010.4675%209.00344L6.0575%204.52344H15.9425ZM16.25%2013.6667C16.6642%2013.6667%2017%2013.3256%2017%2012.9048V5.56762L12.59%2010.0476C11.7115%2010.9389%2010.2885%2010.9389%209.41%2010.0476L5%205.56762V12.9048C5%2013.3256%205.33579%2013.6667%205.75%2013.6667H16.25Z'%20fill='%233E4C5A'/%3e%3ccircle%20cx='17.1587'%20cy='14.7451'%20r='3.86133'%20fill='%23F6F8FC'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_167_67028'%3e%3crect%20width='20'%20height='20'%20fill='white'%20transform='translate(0.5)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",featureKey:UP,singletonMessage:"This feature can only be used for one App and is currently enabled for :enabledConnector.",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)"}}}],JH="Advanced settings",XH="Enhance your integrations with contextual insights.",UH=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"}})),qH=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}),ZH=({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)},I=E=>{E.stopPropagation();const{value:p}=(E==null?void 0:E.target)||{};c(p)},B=()=>{t({feedbackOption:a,feedbackComment:l})},f=()=>{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:I,multiline:!0,rows:5,limit:250,validation:{validate:nF()}}),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:f,children:"Cancel"}),u.jsx(qH,{variant:"contained",color:"primary",isLoading:n,disabled:C,label:"Submit",onClick:B})]})]})},KH=En+"/connectors/:connectorId/advanced-feature",$H=async(e,t)=>{try{const n=RA(KH,{connectorId:t})+"?channel_type=email",r=await rt({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 eW(){return qu({mutationKey:["toggle-advanced-feature"],mutationFn:async({connectorId:e,data:t})=>{if(!e)throw new Error("Connector ID is required");const n=await $H(t,e);return n==null?void 0:n.data}})}const tW=({id:e,heading:t,subHeading:n,isEnabled:r,icon:A,connectorId:o,modalSettings:s,disabled:a=!1,tooltipContent:i=""})=>{var Q;const[l,c]=y.useState(!1),[d,I]=y.useState(r),[B,f]=y.useState(!1),C=Fe(qa)===pe.LOADING,{mutate:E}=eW();y.useEffect(()=>{I(r)},[r]);const p=m=>{const v=m.target.checked;c(!0),E({connectorId:o,data:{[e]:v}},{onSettled:()=>{c(!1)},onSuccess:x=>{x.enabled!==void 0&&I(x.enabled),!v&&s&&f(!0)}})},h=m=>{console.log("debug::feedbackoptions",m.feedbackOption,m.feedbackComment),f(!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",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",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(UH,{title:i,placement:"top",color:"#343C45",arrow:!0,width:"287px",children:u.jsx("div",{className:"w-12",children:u.jsx(vm,{id:`switch_${e}`,checked:d,onClick:m=>m==null?void 0:m.stopPropagation(),onChange:p,isLoading:l||C,disabled:l||C||a})})})]}),u.jsx(Nc,{shown:B,setShown:f,borderRadius:12,sx:{zIndex:15002},children:u.jsx(ZH,{onCancel:()=>f(!1),onSubmit:h,isLoading:l,title:(s==null?void 0:s.title)||"",feedbackOptions:(s==null?void 0:s.radioOptions)||[],placeholder:((Q=s==null?void 0:s.textArea)==null?void 0:Q.placeholder)||""})})]})},nW=({advancedFeatures:e,connectorId:t,connectorName:n})=>{const{availableFeatures:r}=y.useContext(jt),A=YH.filter(a=>lr(r,a.featureKey)&&typeof(e==null?void 0:e[a.id])<"u"&&e[a.id]!==null);if(A.length===0)return null;const o=a=>typeof(e==null?void 0:e[a])=="boolean"&&e[a],s=(a,i)=>{var l;return i&&!o(a)&&((l=e==null?void 0:e.connector)!=null&&l.id)?{isDisabled:!0,tooltipContent:RA(i,{enabledConnector:e.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:JH}),u.jsx("p",{className:"text-body2 text-[#6F7C90]!",children:XH}),u.jsx("div",{className:"flex flex-wrap mt-6 gap-4",children:A.map(a=>{const{isDisabled:i,tooltipContent:l}=s(a.id,a.singletonMessage);return u.jsx(tW,{id:a.id,heading:a.heading.replace(/\{\{app_name\}\}/g,n),subHeading:a.subHeading.replace(/\{\{app_name\}\}/g,n),isEnabled:o(a.id),icon:a.icon,connectorId:t,modalSettings:a.modalSettings,disabled:i,tooltipContent:l},a.id)})})]})},rW=({connectorData:e})=>{const{cardList:t=[],name:n="",customCardsList:r=[],advancedFeatures:A={}}=e||{},[o,s]=y.useState(!1),{id:a=""}=TA();return u.jsxs(u.Fragment,{children:[u.jsx(fC,{shown:o,setShown:s,connectorName:n}),u.jsx("h2",{className:"text-h2 text-[#4D596C]!",children:Cj}),u.jsx("p",{className:"text-body2 text-[#6F7C90]! mb-6 mt-2",children:Ej}),u.jsx(Qm,{setShowEnabledModal:s,currentConnectorId:a,infoCards:[...t,...r]}),u.jsx(nW,{advancedFeatures:A,connectorId:a,connectorName:n})]})},AW=()=>{const e=wr(),{sendTrackingEvent:t}=y.useContext(jt),n=Fe(iC),r=Fe(qa),A=Fe(rm),o=Fe(Qo),s=Fe(Wa),{id:a=""}=TA(),[i]=Yo(),l=i.get("isEdit")==="true",c=i.get("tabIndex"),[d,I]=y.useState(()=>{const x=Number(c);return Number.isNaN(x)||x<0?0:x>kc.length-1?kc.length-1:x}),B=(x,w)=>{I(w)},f=(o==null?void 0:o[a])||null,C=(s==null?void 0:s[a])||null,E=l?f:C,p=!(E!=null&&E.isAuthenticated),h=!!(E!=null&&E.isEnabled),Q=[n,r].includes(pe.LOADING)||p,m=[{name:Bc,route:`${Ye.BASEPATH}${Ye.DASHBOARD}`},{name:(E==null?void 0:E.name)||"",route:`${Ye.BASEPATH}${Ye.API_VIEW}/${a}?isEdit=${String(l)}`},{name:SV}],v=(x,w)=>{x==null||x.stopPropagation(),e(Ja({id:w,enabled:x.target.checked})).unwrap().then(()=>{x.target.checked?t(et.TOGGLE_ENABLED,{connector_name:E==null?void 0:E.name}):(t(et.TOGGLE_DISABLED,{connector_name:E==null?void 0:E.name}),Qn({message:X0,type:AC}))}).catch(()=>{Qn({message:J0,type:qr})})};return y.useEffect(()=>{e(Xa()),l?(e(Ua(a)),e(wc(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(bm,{options:m}),l?u.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[u.jsx(LV,{active:h,label:u.jsx(g.Typography,{variant:"body2",children:h?"Active":"Inactive"})}),u.jsx(vm,{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:kc[0],className:"border-b-0!"}),u.jsx(g.Tab,{label:kc[1],className:"border-b-0!"})]})}),u.jsx("div",{hidden:d!==0,className:"grow overflow-auto py-6",children:u.jsx(Gm,{connectorData:E})}),u.jsx("div",{hidden:d!==1,className:"grow overflow-auto py-6",children:u.jsx(rW,{connectorData:E})})]}):u.jsx("div",{className:"grow overflow-auto py-0",children:u.jsx(Gm,{connectorData:E})})]})},oW=e=>e.auth.verifyTokenApiStatus,sW=e=>e.auth.authVerificationDone,aW=g.styled(g.Box)`
3120
3120
  position: fixed;
3121
3121
  z-index: 1000;
3122
3122
  background-color: #fff;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiver/connector-admin",
3
- "version": "4.4.6-emailLogAdmin-beta.2",
3
+ "version": "4.4.6-emailLogAdmin-beta.3",
4
4
  "main": "index.es.js",
5
5
  "module": "index.es.js",
6
6
  "types": "index.d.ts",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/advanced-features/constants/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AACxD,eAAO,MAAM,gBAAgB,uBAAuB,CAAC;AACrD,eAAO,MAAM,iBAAiB,EAAE,eAAe,EA6B9C,CAAC;AAEF,eAAO,MAAM,KAAK,sBAAsB,CAAC;AACzC,eAAO,MAAM,SAAS,wDAAwD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/advanced-features/constants/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AACxD,eAAO,MAAM,gBAAgB,uBAAuB,CAAC;AACrD,eAAO,MAAM,iBAAiB,EAAE,eAAe,EA4B9C,CAAC;AAEF,eAAO,MAAM,KAAK,sBAAsB,CAAC;AACzC,eAAO,MAAM,SAAS,wDAAwD,CAAC"}