@hiver/connector-agent 2.0.5 → 2.0.6-addSmIdsToCardLoadedGsEvents-beta.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector-cards.d.ts","sourceRoot":"","sources":["../../src/app/connector-cards.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAgD,MAAM,OAAO,CAAC;AA2EzE,UAAU,SAAS;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"connector-cards.d.ts","sourceRoot":"","sources":["../../src/app/connector-cards.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAgD,MAAM,OAAO,CAAC;AA2EzE,UAAU,SAAS;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,SAAS,CAoRxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../../src/features/connector-cards/components/card-list/Card.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAa,MAAM,eAAe,CAAC;AAiBhE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAmBxC,UAAU,MAAM;IACd,IAAI,EAAE,KAAK,CAAC;IACZ,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;KAC9B,GAAG,IAAI,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,0BAA0B,EAAE;QAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;KAC1B,GAAG,IAAI,CAAC;IACT,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,IAAI,UAAW,MAAM,
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../../src/features/connector-cards/components/card-list/Card.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAa,MAAM,eAAe,CAAC;AAiBhE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAmBxC,UAAU,MAAM;IACd,IAAI,EAAE,KAAK,CAAC;IACZ,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;KAC9B,GAAG,IAAI,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,0BAA0B,EAAE;QAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;KAC1B,GAAG,IAAI,CAAC;IACT,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,IAAI,UAAW,MAAM,4CAoMjC,CAAC"}
|
package/index.es.js
CHANGED
|
@@ -37058,14 +37058,20 @@ Do you want to continue?`, VH = "Select an object to create", HH = "Select an ob
|
|
|
37058
37058
|
(W = !1) => {
|
|
37059
37059
|
const G = W ? kU : SU;
|
|
37060
37060
|
o && h && u && A(xa({ id: h, email: o, conversationId: u, externalResourceId: I })).unwrap().then((Y) => {
|
|
37061
|
-
const K =
|
|
37061
|
+
const K = {
|
|
37062
|
+
...iC(Y, Q, W, !0),
|
|
37063
|
+
sm_ids: p
|
|
37064
|
+
};
|
|
37062
37065
|
c(G, K);
|
|
37063
37066
|
}).catch((Y) => {
|
|
37064
|
-
const K =
|
|
37067
|
+
const K = {
|
|
37068
|
+
...iC(Y, Q, W, !1),
|
|
37069
|
+
sm_ids: p
|
|
37070
|
+
};
|
|
37065
37071
|
c(G, K);
|
|
37066
37072
|
});
|
|
37067
37073
|
},
|
|
37068
|
-
[A, o, h, Q, c, u, I]
|
|
37074
|
+
[A, o, h, Q, c, u, I, p]
|
|
37069
37075
|
);
|
|
37070
37076
|
At(() => {
|
|
37071
37077
|
i && L(!0);
|
|
@@ -41550,7 +41556,8 @@ const ac = (e) => {
|
|
|
41550
41556
|
a(SC.clearConnectorList());
|
|
41551
41557
|
}), [a, k]), At(() => {
|
|
41552
41558
|
m && m.length && o(IU, {
|
|
41553
|
-
numOfCards: m.length
|
|
41559
|
+
numOfCards: m.length,
|
|
41560
|
+
sm_ids: n
|
|
41554
41561
|
});
|
|
41555
41562
|
}, [m, o, n]), At(() => {
|
|
41556
41563
|
i && n && n.length && a(Il({ inboxIds: n, conversationId: i, channelType: "email" }));
|
package/index.umd.js
CHANGED
|
@@ -2432,7 +2432,7 @@ Take a look at the reducer(s) handling this action type: ${B.type}.
|
|
|
2432
2432
|
width: 10px;
|
|
2433
2433
|
}
|
|
2434
2434
|
`,_V=(e,{closeToast:t})=>y.jsx(KV,{children:y.jsx("img",{src:zV,onClick:t})}),Sc=({message:e})=>y.jsxs(YV,{children:[y.jsx(XV,{}),y.jsx(GV,{children:e})]});function fn(e){const{message:t,type:n,autoClose:o}=e,r={closeButton:y.jsx(_V,{}),autoClose:o??5e3,pauseOnHover:!0,position:"bottom-left",rtl:!1,draggable:!0,closeOnClick:!0,hideProgressBar:!0};let i;switch(n){case"success":{i=At.success(y.jsx(Sc,{message:t}),{...r,icon:!1});break}case"error":{i=At.error(y.jsx(Sc,{message:t}),{...r,icon:!1});break}case"info-dark":{i=At.info(y.jsx(Sc,{message:t}),{...r,icon:!1,className:"toast_dark"});break}default:{i=At.info(y.jsx(Sc,{message:t}),{...r,icon:!1});break}}return setTimeout(()=>{ZV(i)},o&&!isNaN(o)?Number(o):5e3),i}function ZV(e){At.dismiss(e)}const WB={updateFormApiStatus:Se.IDLE,createObjectList:[],linkObjectList:[],editObjectList:[],objectDict:null,formFields:null,previewCardData:null,objectListApiStatus:Se.IDLE,unlinkCardApiStatus:Se.IDLE,linkCardApiStatus:Se.IDLE,previewCardApiStatus:Se.IDLE,optionsMap:null,dropdownOptionsApis:Se.IDLE,dependentFieldsMap:{},createFormApiStatus:Se.IDLE,currentResourceDetailsApiStatus:Se.IDLE,currentResourceDetails:null,currentCardInEdit:null,hasUnsavedChanges:!1},Ii="/v1/api",JV=`${Ii}/connectors/forms/list`,qV=`${Ii}/connectors/cards/:id/unlink`,$V=`${Ii}/connectors/forms/:id/link`,eH=`${Ii}/connectors/forms/:id/preview`,tH=`${Ii}/connectors/forms/:formId/field/:fieldName/data`,nH=`${Ii}/connectors/form/:formId`,oH=`${Ii}/connectors/forms/:formId/data`,rH=({inboxIds:e,channelType:t,conversationId:n})=>{const o=new URLSearchParams;return e.forEach(r=>o.append("inbox_ids",r)),o.append("channel_type",t),o.append("conversation_id",String(n)),ko({url:`${JV}?${o.toString()}`,method:rr.GET})},iH=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),ko({url:U2(`${tH}?${o.toString()}`,e),method:rr.POST,data:t})},zB=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),ko({url:U2(`${nH}?${o.toString()}`,e),method:rr.POST,data:t})},sH=(e,t="email",n,o)=>{const r=new URLSearchParams;return r.append("channel_type",t),ko({url:`${qV.replace(":id",e)}?${r.toString()}`,method:rr.POST,data:{externalResourceId:n,conversationId:o}})},aH=(e,t,n="email",o)=>{const r=new URLSearchParams;return r.append("channel_type",n),ko({url:`${$V.replace(":id",e)}?${r.toString()}`,method:rr.POST,data:{externalResourceId:t,conversationId:o}})},AH=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),ko({url:`${eH.replace(":id",e)}?${o.toString()}`,method:rr.POST,data:{args:t}})},lH=(e,t="email",n,o,r)=>{const i=new URLSearchParams;return i.append("channel_type",t),i.append("conversation_id",String(n||"")),i.append("senderEmail",r),i.append("externalResourceId",o),ko({url:`${oH.replace(":formId",e)}?${i.toString()}`,method:rr.GET})},cH="Error in previewing the card",uH="Card linked successfully",dH="Error in linking the card",YB="Please enter a valid URL",gH="Please enter valid ID",fH="Please enter valid input",pH="URL must start with https://",CH="URL should not end with a slash",EH="Invalid email address",IH="Email must be a string",GB="Invalid date",hH="Date cannot be in the past",BH="Date cannot be in the future",mH="Invalid number",QH="Invalid text",vH="New card created",yH="Card creation failed",bH="https://avatars.githubusercontent.com/u/62397590",wH="Create and link objects from different apps to this conversation",xH="Are you sure you want to change the primary object?",TH="Changing the primary object will reset all the information you’ve entered and all data will be lost and can’t be recovered.",FH="Are you sure you want to leave?",SH=`If you go back now, all the information you’ve entered will be lost and can’t be recovered.
|
|
2435
|
-
Do you want to continue?`,OH="Select an object to create",kH="Select an object to link",XB="Select object",MH="Paste URL or ID",DH="Object ID/Link",PH="Card updated",RH="Card updation failed",LH="Required Field",NH="Invalid date",KB=/^https:\/\/([a-z0-9-]+(\.[a-z0-9-]+)+)(:[0-9]{1,5})?(\/[^\s/]*)*$/i,UH=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,jH=(e,t)=>t?Object.values(t).filter(o=>e.values[o]&&!e.errors[o]):[],_B=(e,t)=>t?Object.keys(t).reduce((o,r)=>{let i="";const a=t[r];return e.values&&e.values[a]&&typeof e.values[a]=="object"&&"value"in e.values[a]?i=e.values[a].value:e.values&&e.values[a]&&typeof e.values[a]!="object"?i=e.values[a]:i=null,{...o,[r]:i}},{}):{},ZB=(e,t,n)=>{let o=`${t}_${n}`;return Object.keys(e).forEach(r=>{o=`${o}_${r}:${e[r]}`}),o},VH=e=>t=>{if(t&&typeof t=="string"){const n=t.replace(/\/$/,"");return n.startsWith("https://")?t.endsWith("/")?CH:KB.test(n)?!0:e||YB:pH}return!1},HH=e=>t=>t&&typeof t=="string"?UH.test(t)?!0:e||EH:IH,WH=e=>t=>t==null||t===""?e||LH:!0,zH=e=>(t,n)=>{var o;if(!t||(t==null?void 0:t.toString())===NH)return GB;if(typeof t=="object"){const r=t,i=new Date;i.setHours(0,0,0,0);const a=n.disablePast,A=n.disableFuture;return a&&r<i?e||hH:A&&r>i?e||BH:!0}return typeof t=="string"&&((o=new Date(t))==null?void 0:o.toString())!=="Invalid Date"?!0:GB},YH=e=>(t,n)=>{if(t=Number(t),typeof t=="number"&&!isNaN(t)){const o=n.min,r=n.max;return o!==void 0&&t<o?e||`Value should not be less than ${o}`:r!==void 0&&t>r?e||`Value should not be greater than ${r}`:!0}return e||mH},GH=e=>(t,n)=>{if(typeof t=="string"){const o=n.limit;return o!==void 0&&t.length>o?e||`Maximum characters allowed are ${o}`:!0}return e||QH},XH=e=>t=>typeof t=="string"?t.startsWith("https:")?KB.test(t)?!0:e||YB:t.trim().length>0?!0:e||gH:e||fH,KH=({formFields:e})=>{const t={};return e.forEach(n=>{var o,r,i,a,A,l;if(t[n.name]={},(o=n.validations)!=null&&o.isRequired&&(typeof n.validations.isRequired=="object"?t[n.name].isRequired=WH(n.validations.isRequired.msg):t[n.name].isRequired=!0),n.type==="date"){let c=typeof((r=n.validations)==null?void 0:r.disableFuture)=="object"?n.validations.disableFuture.msg:"";c=typeof((i=n.validations)==null?void 0:i.disablePast)=="object"?n.validations.disablePast.msg:c,t[n.name].validate=zH(c);return}if(n.type==="number"&&((a=n.validations)!=null&&a.range)){t[n.name].validate=YH();return}if(n.type==="text"&&n.limit){t[n.name].validate=GH();return}if((A=n.validations)!=null&&A.isUrl){const c=typeof n.validations.isUrl=="object"?n.validations.isUrl.msg:"";t[n.name].validate=VH(c)}else if((l=n.validations)!=null&&l.isEmail){const c=typeof n.validations.isEmail=="object"?n.validations.isEmail.msg:"";t[n.name].validate=HH(c)}}),t},Ff=(e,t)=>Object.keys(t).reduce((n,o)=>{const r=e.values[t[o]];let i;return Array.isArray(r)?i=r.map(a=>a.value):r&&typeof r=="object"&&"label"in r?i=r.value:r&&typeof r=="object"?i=r.toISOString():i=r||"",n[o]=i,n},{}),_H=e=>typeof e=="string"?/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/.test(e):typeof e=="object"&&"_isValid"in e,JB=e=>Object.keys(e).sort((n,o)=>o.localeCompare(n)).reduce((n,o)=>{var r;return(typeof e[o]=="string"||typeof e[o]=="object"&&e[o]!==null)&&_H(e[o])?n[o]=(r=new Date(`${e[o]}`))==null?void 0:r.toString():n[o]=e[o],n},{}),qB=UB({name:"writeCapability",initialState:WB,reducers:{resetState:()=>WB,resetCurrentResourceDetails:e=>{e.currentResourceDetails=null,e.currentResourceDetailsApiStatus=Se.IDLE},setCurrentCardInEdit:(e,t)=>{e.currentCardInEdit=t.payload},setHasUnsavedChanges:(e,t)=>{e.hasUnsavedChanges=t.payload}},extraReducers:e=>{e.addCase(Oc.pending,t=>{t.objectListApiStatus=Se.LOADING}).addCase(Oc.fulfilled,(t,n)=>{const{createObjectList:o,linkObjectList:r,editObjectList:i,formFields:a,objectDict:A,dependentFieldsMap:l}=n.payload;t.objectListApiStatus=Se.IDLE,t.createObjectList=o,t.linkObjectList=r,t.editObjectList=i,t.formFields=a,t.objectDict=A,t.dependentFieldsMap=l}).addCase(Oc.rejected,t=>{t.objectListApiStatus=Se.FAILED}).addCase(kc.pending,t=>{t.dropdownOptionsApis=Se.LOADING}).addCase(kc.fulfilled,(t,n)=>{const o=t.optionsMap||{},{optionsList:r,hasMore:i,currentPage:a,key:A}=n.payload;t.dropdownOptionsApis=Se.IDLE,t.optionsMap={...o,[A]:{options:r,hasMore:i,currentPage:a}}}).addCase(kc.rejected,t=>{t.dropdownOptionsApis=Se.FAILED}).addCase(Mc.pending,t=>{t.createFormApiStatus=Se.LOADING}).addCase(Mc.fulfilled,t=>{t.createFormApiStatus=Se.IDLE}).addCase(Mc.rejected,t=>{t.createFormApiStatus=Se.FAILED}).addCase(Rc.pending,t=>{t.linkCardApiStatus=Se.LOADING}).addCase(Rc.fulfilled,t=>{t.linkCardApiStatus=Se.IDLE}).addCase(Rc.rejected,t=>{t.linkCardApiStatus=Se.FAILED}).addCase(Pc.pending,t=>{t.unlinkCardApiStatus=Se.LOADING}).addCase(Pc.fulfilled,t=>{t.unlinkCardApiStatus=Se.IDLE}).addCase(Pc.rejected,t=>{t.unlinkCardApiStatus=Se.FAILED}).addCase(aA.pending,t=>{t.previewCardApiStatus=Se.LOADING}).addCase(aA.fulfilled,(t,n)=>{const{data:o}=n.payload;o&&(t.previewCardData=o),t.previewCardApiStatus=Se.IDLE}).addCase(aA.rejected,t=>{t.previewCardApiStatus=Se.FAILED}).addCase(Dc.pending,t=>{t.updateFormApiStatus=Se.LOADING}).addCase(Dc.fulfilled,t=>{t.updateFormApiStatus=Se.IDLE}).addCase(Dc.rejected,t=>{t.updateFormApiStatus=Se.FAILED}).addCase(Lc.pending,t=>{t.currentResourceDetailsApiStatus=Se.LOADING}).addCase(Lc.fulfilled,(t,n)=>{const{data:o}=n.payload;o&&(t.currentResourceDetails=o),t.currentResourceDetailsApiStatus=Se.IDLE}).addCase(Lc.rejected,t=>{t.currentResourceDetailsApiStatus=Se.FAILED})}}),Oc=Mo("writeCapability/fetchObjectList",async e=>{const{inboxIds:t,channelType:n,conversationId:o}=e,r=await rH({inboxIds:t,channelType:n,conversationId:o});if(!r||!r.data||!("formsList"in r.data)||!Array.isArray(r.data.formsList))return{createObjectList:[],linkObjectList:[],editObjectList:[],formFields:null,objectDict:null,dependentFieldsMap:{}};const i=r.data.formsList,a={},A=[],l=[],c=[],u={},p={};return i==null||i.forEach(g=>{var C,f;const B={...g};"fieldList"in B&&delete B.fieldList,p[g.id]=B,a[g.id]||(a[g.id]={}),u[g.id]||(u[g.id]=[]),g.type==="create"&&g.authenticated?A.push({value:g.id,label:g.name,avatarUrl:g.logoUrl}):g.type==="link"&&g.authenticated?l.push({value:g.id,label:g.name,avatarUrl:g.logoUrl}):g.type==="edit"&&g.authenticated&&c.push({value:g.id,label:g.name,avatarUrl:g.logoUrl}),(C=g.fieldList)==null||C.sort((d,E)=>d.priority-E.priority),(f=g.fieldList)==null||f.forEach(d=>{var m,h,Q,I,v,w,x,F,O,M,P,D;let E={};switch(d.type){case"select":case"multi-select":{E={...d,defaultOptions:!!d.interfaceDetails,isInfiniteScrollable:((h=(m=d.interfaceDetails)==null?void 0:m.pagination)==null?void 0:h.enabled)||!1,loadOptionsOnFocus:Object.keys(((Q=d.interfaceDetails)==null?void 0:Q.args)||{}).length>0,isMultiSelect:d.type==="multi-select",type:g.interfaceDetails?"async-select":"select",isClearable:!0};break}case"date":{E={...d,type:"date",disablePast:!!((I=d.validations)!=null&&I.disablePast)||!1,disableFuture:!!((v=d.validations)!=null&&v.disableFuture)||!1};break}case"number":{E={...d,type:"number",min:((x=(w=d.validations)==null?void 0:w.range)==null?void 0:x.min)||Number.MIN_SAFE_INTEGER,max:((O=(F=d.validations)==null?void 0:F.range)==null?void 0:O.max)||Number.MAX_SAFE_INTEGER};break}case"multiline":{E={...d,type:"text",maxRows:((M=d.validations)==null?void 0:M.maxRows)||5,limit:(P=d.validations)==null?void 0:P.maxCharacters,rows:5,multiline:!0};break}case"text":{E={...d,type:"text",limit:(D=d.validations)==null?void 0:D.maxCharacters};break}default:E={...d}}if("value"in E&&(E.defaultValue=E.value,delete E.value),u[g.id]=[...u[g.id],E],d.interfaceDetails&&(d.interfaceDetails.args||d.interfaceDetails.optionalArgs)){const k={...d.interfaceDetails.args,...d.interfaceDetails.optionalArgs};Object.values(k).forEach(N=>{a[g.id][N]?a[g.id][N]=[...a[g.id][N],d.name]:a[g.id][N]=[d.name]})}})}),{createObjectList:A,linkObjectList:l,editObjectList:c,formFields:u,objectDict:p,dependentFieldsMap:a}}),kc=Mo("writeCapability/fetchDropDownOptions",async(e,{getState:t,rejectWithValue:n})=>{var h;const{fieldName:o,formId:r,fieldConfig:i,callback:a,args:A={},interfaceId:l="",pagination:c={enabled:!1}}=e,u=ZB(A||{},r,o),{write:p}=t();let g=!1;i.meta&&"showAvatar"in i.meta&&typeof i.meta.showAvatar=="boolean"&&(g=i.meta.showAvatar);const{options:B=[],hasMore:C=!0,currentPage:f=0}=((h=p.optionsMap)==null?void 0:h[u])||{},{enabled:d,limit:E}=c,m=E||10;try{let Q;const I=d?{pageNumber:f+1,limit:m}:null;if(C?Q=await iH({fieldName:o,formId:r},{pagination:I||{},args:A,interfaceId:l}):a==null||a(B),!Q||!Q.data||!("data"in Q.data)||!Array.isArray(Q.data.data))return{optionsList:[...B],fieldName:"",formId:"",hasMore:!1,currentPage:f,key:u};const w=Q.data.data.map(O=>g?{...O,avatarUrl:O.avatarUrl||bH}:{label:O.label,value:O.value}),x=d?w.length>=m:!1,F=[...B,...w];return a==null||a(F),{optionsList:F,fieldName:o,formId:r,currentPage:f+1,hasMore:x,key:u}}catch(Q){return a==null||a(B),n(Q)}},{condition:(e,{getState:t})=>{var c,u;if(e.isScrollToBottomEvent)return!0;const{fieldName:n,formId:o,callback:r,args:i}=e,a=ZB(i||{},o,n),{write:A}=t(),l=((u=(c=A.optionsMap)==null?void 0:c[a])==null?void 0:u.options)||[];return l&&l.length?(r==null||r(l),!1):!0}}),Mc=Mo("writeCapability/createForm",async(e,{rejectWithValue:t})=>{const{formId:n,successCallback:o,failureCallback:r,args:i={},interfaceId:a,conversationId:A}=e;try{await zB({formId:n},{args:i,interfaceId:a,conversationId:A}),o==null||o(),fn({message:vH,type:Ei})}catch(l){return r==null||r(l),fn({message:yH,type:Tr}),t(l)}}),Dc=Mo("writeCapability/updateForm",async(e,{rejectWithValue:t})=>{const{formId:n,successCallback:o,failureCallback:r,args:i={},interfaceId:a,conversationId:A,externalResourceId:l,previousArgs:c={}}=e;try{await zB({formId:n},{args:i,interfaceId:a,conversationId:A,externalResourceId:l,previousArgs:c}),o==null||o(),fn({message:PH,type:Ei})}catch(u){return r==null||r(u),fn({message:RH,type:Tr}),t(u)}}),Pc=Mo("writeCapability/unlinkCard",async({id:e,channelType:t,externalResourceId:n,conversationId:o})=>{await sH(e,t,n,o)}),Rc=Mo("writeCapability/linkCard",async({id:e,externalResourceId:t,channelType:n,conversationId:o})=>{await aH(e,t,n,o)}),aA=Mo("writeCapability/previewCard",async({id:e,args:t,channelType:n,isRefresh:o})=>{const r=await AH(e,t,n),i=r==null?void 0:r.data;return i?(o&&fn({message:VB,type:Ei}),{data:V2(i)}):(o&&fn({message:jB,type:Tr}),{data:null})}),Lc=Mo("connectorCardLibrary/fetchCurrentResourceDetails",async(e,{rejectWithValue:t})=>{const{id:n,channelType:o,conversationId:r,externalResourceId:i,contactEmail:a}=e;try{const A=await lH(n,o,r,i,a),l=A==null?void 0:A.data,c=A==null?void 0:A.status,u={values:{},errors:{}};return Object.entries(l.formData).forEach(([p,g])=>{"label"in g&&(g.type&&g.type==="date"?u.values[p]=g.label?new Date(parseInt(g.label)).toISOString():"":g.type&&g.type==="multi-select"&&"value"in g&&"label"in g&&g.value&&g.label?u.values[p]=[{value:g.value,label:g.label}]:g.value?u.values[p]={value:g.value,label:g.label}:u.values[p]=g.label)}),{data:u,status:c}}catch(A){return fn({message:HB,type:Tr}),t(A)}}),{resetState:MK,setCurrentCardInEdit:bs,resetCurrentResourceDetails:ZH,setHasUnsavedChanges:$B}=qB.actions,JH=qB.reducer,qH=()=>{const[e,t]=b.useState(null),[n,o]=b.useState({isVertical:!1,isHorizontal:!1,isScrolling:!1}),r=b.useCallback(i=>{t(i)},[]);return b.useEffect(()=>{if(!e)return;e.dataset.prevScrollLeft="0",e.dataset.prevScrollTop="0";let i=null;const a=100;let A=null;const l=150,c=u=>{i||(i=window.setTimeout(()=>{const p=u.target,g=Number(e.dataset.prevScrollLeft)||0,B=Number(e.dataset.prevScrollTop)||0,C=p.scrollLeft,f=p.scrollTop,d=C-g,E=f-B,m=Math.abs(E)>Math.abs(d),h=Math.abs(d)>Math.abs(E);o({isVertical:m,isHorizontal:h,isScrolling:!0}),e.dataset.prevScrollLeft=String(C),e.dataset.prevScrollTop=String(f),i=null},a),A&&window.clearTimeout(A),A=window.setTimeout(()=>{o(p=>({...p,isScrolling:!1})),A=null},l))};return e.addEventListener("scroll",c),()=>{e.removeEventListener("scroll",c),i&&window.clearTimeout(i),A&&window.clearTimeout(A)}},[e]),[n,r]},$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%3cpath%20d='M5.8016%2011.709L12.3416%205.16893L11.4298%204.25712L4.88979%2010.7972V11.709H5.8016ZM6.33618%2012.9987H3.6001V10.2626L10.9739%202.88875C11.0948%202.76786%2011.2588%202.69995%2011.4298%202.69995C11.6008%202.69995%2011.7648%202.76786%2011.8857%202.88875L13.71%204.71302C13.8309%204.83395%2013.8988%204.99794%2013.8988%205.16893C13.8988%205.33992%2013.8309%205.50391%2013.71%205.62484L6.33618%2012.9987ZM3.6001%2014.2884H15.2073V15.578H3.6001V14.2884Z'%20fill='%236C7B94'/%3e%3c/svg%3e",eW=({data:e,title:t,currentCard:n,setShowModal:o})=>{const r=ci(),{sendTrackingEvent:i,currentSmIds:a}=b.useContext(eo),{userGroupId:A}=li()||{},[l,c]=qH(),{isScrolling:u,isVertical:p}=l,g=u&&p,B=b.useMemo(()=>(e==null?void 0:e[0].data.map(E=>E.label))||[],[e]),C=b.useMemo(()=>e.map(E=>{const m={cells:{},externalResourceId:E.externalResourceId};return E.data.forEach((h,Q)=>{if(B[Q]){let I=h.value?h.value:Ic;I&&h.type==="date"&&(I=new Date(parseInt(I)).toLocaleDateString(navigator.language)),m.cells[B[Q]]={label:I,deepLink:h==null?void 0:h.deepLink}}}),m}),[e,B]),f=(E,m)=>y.jsx(aj,{align:"left",children:E.deepLink?y.jsx(Sa,{target:"_blank",underline:"none",href:E.deepLink,children:E.label}):y.jsx(Ge,{variant:"body2",color:"gray.black",children:E.label})},`${m}_${E.label}`),d=E=>{!E||!n||(o(!1),i(H2,{card_title:n.title,connector_name:n.connectorName,ug_id:A,sm_ids:a}),r(bs({...n,externalResourceId:E})))};return y.jsxs(Ne,{maxHeight:"340px",maxWidth:"700px",padding:"32px 0px 32px 32px",overflow:"auto",children:[y.jsx(Ge,{variant:"h2",color:"gray.black",marginBottom:"16px",children:t}),y.jsx(nE,{ref:c,children:y.jsxs($C,{stickyHeader:!0,children:[y.jsx(rj,{children:y.jsxs(Nd,{children:[B.map(E=>y.jsx(ij,{sx:{whiteSpace:"nowrap"},children:y.jsx(Ge,{variant:"overline",color:"gray.gray3",children:E})},E)),y.jsx(lj,{})]})}),y.jsx(tE,{children:C.map((E,m)=>y.jsxs(sj,{children:[Object.values(E.cells).map((h,Q)=>f(h,Q)),y.jsx(Aj,{children:!g&&E.externalResourceId&&y.jsx(Yt,{title:M2,placement:"bottom",children:y.jsx(nn,{className:"row-edit",onClick:()=>d(E.externalResourceId),children:y.jsx("img",{src:$H})})})})]},`id_${m}`))})]})})]})},tW=e=>e.cardList.connectorCards,nW=e=>e.cardList.connectorsEnabled,oW=e=>e.cardList.connectorApiStatus,rW=e=>e.cardList.cardSpecificData,iW=e=>e.cardList.specificConnectorApiStatus,sW=e=>e.cardList.specificConnectorErrorCode,aW="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9%204.8675L14.6475%2014.625H3.3525L9%204.8675ZM9%201.875L0.75%2016.125H17.25L9%201.875Z'%20fill='%23F07530'/%3e%3cpath%20d='M9.75%2012.375H8.25V13.875H9.75V12.375Z'%20fill='%23F07530'/%3e%3cpath%20d='M9.75%207.875H8.25V11.625H9.75V7.875Z'%20fill='%23F07530'/%3e%3c/svg%3e",em=e=>{const t=/\(Error code: (.*?)\)$/,n=e.match(t),o=n?n[1]:null,r=n?e.replace(t,"").trim():e;return{error_code:o,error_message:r}},AW=(e,t)=>`${R2} (Error code: ${e})`.replace(/{{connector_name}}/g,(t==null?void 0:t[0])||""),tm=e=>{const{value:t,error:n,deepLink:o,statusCode:r,isLoading:i,type:a,redirectToAdminTab:A,isFailed:l,connectorNames:c,cardTitle:u,currentCard:p,cardId:g,isCardLevelError:B}=e,C=b.useRef(null),f=b.useRef(null),{email:d,currentSmIds:E,conversationId:m,sendTrackingEvent:h,connectorFunctions:Q}=b.useContext(eo),I=Tt(sW),v=I==null?void 0:I[g],[w,x]=b.useState(!1),F=b.useMemo(()=>{if(n&&B){const{error_message:L}=em(n);return L}return l?R2.replace(/{{connector_name}}/g,(c==null?void 0:c[0])||""):F2},[n,l,c,B]),O=b.useCallback(()=>{const L=n||AW(v,c),{error_code:z,error_message:H}=em(L);h==null||h(CU,{sm_ids:E,frontend_req_params:{email:d,conversationId:m,externalResourceId:p==null?void 0:p.externalResourceId},card_title:u,connector_name:c!=null&&c.length?c:"",error_code:z,error_message:H})},[n,v,h,E,d,m,u,c,p==null?void 0:p.externalResourceId]);b.useEffect(()=>{(n&&B||l&&v)&&O()},[O,v,l,n,B]),b.useEffect(()=>{const L=o?f.current:C.current;if(L){const z=L.scrollHeight>L.clientHeight||L.scrollWidth>L.clientWidth;x(z)}},[t,o]);const M=r==rf.NOT_FOUND;let P=M?Ic:t;a==="date"&&P&&!M&&(P=new Date(parseInt(P)).toLocaleDateString(navigator.language));const D=!!n||l,k=()=>{A?Q==null||Q.redirectToAdmin():window.open(jN,"_blank")},N=L=>{const z=/<>(.*?)<>/g,H=L.split(z);return y.jsx(b.Fragment,{children:H.map(($,R)=>R%2===1?y.jsx(tj,{variant:"body2",onClick:k,children:$},R):$)})};return i?y.jsx(ui,{variant:"rounded",width:"100%",height:16,animation:"wave",margin:"4px 0 0 0"}):D?y.jsxs(tB,{gap:"7px",children:[y.jsx(Ne,{marginTop:"3px",children:y.jsx("img",{src:aW,width:"18px",height:"18px"})}),y.jsx(nB,{variant:"body2",children:F?N(F):F2})]}):y.jsx(Yt,{title:w?P:null,placement:"bottom",children:o?y.jsx(oB,{ref:f,target:"_blank",underline:"none",href:o,fontSize:"13px",children:P||Ic}):y.jsx(oj,{ref:C,variant:"body2",children:P||Ic})})},lW="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_825_73646)'%3e%3cpath%20d='M19%206.41L17.59%205L12%2010.59L6.41%205L5%206.41L10.59%2012L5%2017.59L6.41%2019L12%2013.41L17.59%2019L19%2017.59L13.41%2012L19%206.41Z'%20fill='%236F7C90'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_825_73646'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Sf=({shown:e,setShown:t,children:n,showCloseButton:o=!1,borderRadius:r=4})=>y.jsx(xd,{open:e,onClose:()=>t(!1),PaperProps:{style:{borderRadius:r,padding:0,height:"fit-content",width:"fit-content",maxWidth:"none"}},children:y.jsxs(Ne,{direction:"row",children:[o&&y.jsx(pt,{position:"absolute",right:10,top:10,children:y.jsx(Yt,{title:"Close",placement:"bottom",children:y.jsx(nn,{onClick:()=>t(!1),children:y.jsx("img",{src:lW})})})}),n]})}),nm=e=>{var W,G;const{id:t,cardTitle:n,specificCardData:o,specificConnectorApiStatus:r,isOpen:i,currentCard:a}=e,A=24,l=(r==null?void 0:r[t])===Se.IDLE,c=(r==null?void 0:r[t])===Se.LOADING,u=(r==null?void 0:r[t])===Se.FAILED,{cardType:p,data:g,cardErrorMessage:B,redirectToAdminTab:C,connectorNames:f}=(o==null?void 0:o[t])||{},d=p==="flat",[E,m]=b.useState(!1),[h,Q]=b.useState(!1),[I,v]=b.useState(!1),[w,x]=b.useState(!1),F=b.useMemo(()=>{var Y,K,q,ee;return d&&((Y=g==null?void 0:g.flatDisplay)!=null&&Y.data)?g.flatDisplay.data:!d&&((ee=(q=(K=g==null?void 0:g.listItems)==null?void 0:K.fields)==null?void 0:q[0])!=null&&ee.data)?g.listItems.fields[0].data:[]},[d,g]),O=b.useMemo(()=>F==null?void 0:F.slice(0,5),[F]),[M,P]=b.useState([]),D=b.useRef(null),[k,N]=b.useState(0),L=E?-180:0,z=d?!1:!!((W=g==null?void 0:g.listItems)!=null&&W.errorMessage),H=z||u||B,$=l&&!z&&i&&(I||h);b.useLayoutEffect(()=>{var Y;(Y=D.current)!=null&&Y.scrollHeight&&N(D.current.scrollHeight+A)},[r==null?void 0:r[t],M,D]),b.useEffect(()=>{var ee,X;const Y=((F==null?void 0:F.length)||0)>5,K=!d&&(((X=(ee=g==null?void 0:g.listItems)==null?void 0:ee.fields)==null?void 0:X.length)||0)>1;v(Y&&!K),Q(K)},[g,d,F==null?void 0:F.length]),b.useEffect(()=>{P(E?F:O)},[g,E,O,F]);const R=()=>{I?m(Y=>!Y):x(Y=>!Y)};return y.jsxs(y.Fragment,{children:[y.jsx(Sf,{shown:w,setShown:x,showCloseButton:!0,borderRadius:12,children:y.jsx(eW,{data:((G=g==null?void 0:g.listItems)==null?void 0:G.fields)||[],title:n,currentCard:a,setShowModal:x})}),y.jsx($U,{className:i?"":"slideUp",height:k,children:y.jsx(Ne,{ref:D,gap:1,margin:"12px",children:c&&!(M!=null&&M.length)?y.jsxs(y.Fragment,{children:[y.jsx(ui,{variant:"rounded",width:"100%",height:20,animation:"wave"}),y.jsx(ui,{variant:"rounded",width:"100%",height:20,animation:"wave"})]}):y.jsx(y.Fragment,{children:H?y.jsx(pt,{margin:"8px 0",children:y.jsx(tm,{error:B,isLoading:c,redirectToAdminTab:C,isFailed:u,connectorNames:f,cardId:t,cardTitle:n,currentCard:a,isCardLevelError:!0})}):M!=null&&M.length?M==null?void 0:M.map(Y=>{const{value:K,label:q,deepLink:ee,type:X}=Y,J="errorMessage"in Y?Y.errorMessage:null,_="statusCode"in Y?Y.statusCode:null;return y.jsxs("div",{children:[y.jsx(ej,{variant:"overline",children:q}),y.jsx(tm,{value:K,error:J,deepLink:ee,statusCode:_,isLoading:c,type:X,cardTitle:n,currentCard:a,cardId:t})]},q)}):y.jsx(pt,{margin:"8px 0",children:y.jsx(nB,{children:xN})})})})}),!B&&$&&y.jsx(uj,{variant:"body2_medium",onClick:R,children:I?y.jsxs(y.Fragment,{children:[E?yj:rB,y.jsx(cj,{src:vj,transformAngle:L})]}):rB})]})},cW={connectorCards:null,cardSpecificData:null,connectorApiStatus:Se.IDLE,specificConnectorApiStatus:null,threadId:null,connectorsEnabled:!1,specificConnectorErrorCode:null},om="/v1/api",uW=`${om}/connectors/cards`,dW=`${om}/connectors/cards/:id/data`,gW=({inboxIds:e,conversationId:t,channelType:n="email"})=>{const o=new URLSearchParams;return e.forEach(r=>o.append("inbox_ids",r)),o.append("channel_type",n),o.append("conversation_id",String(t||"")),ko({url:`${uW}?${o.toString()}`,method:rr.GET})},fW=(e,t,n,o)=>{const r=new URLSearchParams;return r.append("senderEmail",t),r.append("conversation_id",String(n||"")),o&&r.append("externalResourceId",o),ko({url:`${dW.replace(":id",e)}?${r.toString()}`,method:rr.GET})},rm=UB({name:"connectorCardLibrary",initialState:cW,reducers:{updateThreadId(e,t){const{payload:n}=t;e.threadId=n.threadId,e.connectorCards=null},clearConnectorList(e){e.connectorCards=null,e.cardSpecificData=null}},extraReducers:e=>{e.addCase(Nc.pending,t=>{t.connectorApiStatus=Se.LOADING}).addCase(Nc.fulfilled,(t,n)=>{t.connectorApiStatus=Se.IDLE,t.connectorCards=n.payload.cards,t.connectorsEnabled=n.payload.connectorsEnabled}).addCase(Nc.rejected,t=>{t.connectorApiStatus=Se.FAILED}).addCase(AA.pending,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg;let i=o;r&&(i=`${i}_${r}`),t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Se.LOADING}}).addCase(AA.fulfilled,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg;let i=o;r&&(i=`${i}_${r}`);const{data:a}=n.payload||{};a&&(t.cardSpecificData={...t.cardSpecificData?t.cardSpecificData:{},[i]:a}),t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Se.IDLE}}).addCase(AA.rejected,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg;let i=o;r&&(i=`${i}_${r}`),t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Se.FAILED};const a=n.payload&&typeof n.payload=="object"&&"code"in n.payload?String(n.payload.code):L2;t.specificConnectorErrorCode={...t.specificConnectorErrorCode??{},[i]:a}})}}),Nc=Mo("connectorCardLibrary/fetchAllCard",async({inboxIds:e,channelType:t,conversationId:n})=>{var A;const o=await gW({inboxIds:e,channelType:t,conversationId:n});if(!Array.isArray((A=o==null?void 0:o.data)==null?void 0:A.cards))return{cards:[],connectorsEnabled:!1};const{cards:r,connectorsEnabled:i=!1}=o.data;return{cards:r.sort((l,c)=>(l==null?void 0:l.priority)-(c==null?void 0:c.priority)),connectorsEnabled:i}}),AA=Mo("connectorCardLibrary/fetchSpecificCard",async({id:e,email:t,conversationId:n,isRefresh:o,externalResourceId:r},i)=>{try{const a=await fW(e,t,n,r),A=a==null?void 0:a.data,l=a==null?void 0:a.status;return A?(o&&fn({message:VB,type:Ei}),{data:V2(A),status:l}):(o&&fn({message:jB,type:Tr}),{data:{},status:l})}catch(a){const A=a;return i.rejectWithValue({...A,code:A.code||L2})}}),pW=rm.reducer,im=rm.actions,sm="data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.76618%202.23341C8.79952%201.26675%207.47285%200.666748%205.99952%200.666748C3.05285%200.666748%200.672852%203.05341%200.672852%206.00008C0.672852%208.94675%203.05285%2011.3334%205.99952%2011.3334C8.48619%2011.3334%2010.5595%209.63341%2011.1529%207.33341H9.76618C9.21952%208.88675%207.73952%2010.0001%205.99952%2010.0001C3.79285%2010.0001%201.99952%208.20675%201.99952%206.00008C1.99952%203.79341%203.79285%202.00008%205.99952%202.00008C7.10618%202.00008%208.09285%202.46008%208.81285%203.18675L6.66618%205.33341H11.3329V0.666748L9.76618%202.23341Z'%20fill='%236C7B94'/%3e%3c/svg%3e",CW="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M11.4587%206.7528C11.2244%206.51848%2010.8445%206.51848%2010.6102%206.7528C10.3759%206.98711%2010.3759%207.36701%2010.6102%207.60132L11.4587%206.7528ZM12.1916%208.33414L12.6158%207.90988L12.1916%208.33414ZM8.33462%2012.1911L8.75888%2011.7668L8.33462%2012.1911ZM7.6018%2010.6097C7.36748%2010.3754%206.98758%2010.3754%206.75327%2010.6097C6.51895%2010.8441%206.51895%2011.224%206.75327%2011.4583L7.6018%2010.6097ZM4.43911%209.14411C4.67343%209.37842%205.05333%209.37842%205.28764%209.14411C5.52196%208.9098%205.52196%208.5299%205.28764%208.29558L4.43911%209.14411ZM3.70629%207.56276L4.13056%207.1385L3.70629%207.56276ZM7.56324%203.70582L7.9875%203.28155L7.56324%203.70582ZM8.29606%205.28716C8.53037%205.52148%208.91027%205.52148%209.14459%205.28716C9.3789%205.05285%209.3789%204.67295%209.14459%204.43864L8.29606%205.28716ZM10.6102%207.60132L11.7673%208.75841L12.6158%207.90988L11.4587%206.7528L10.6102%207.60132ZM11.7673%208.75841C12.1662%209.15735%2012.3904%209.69843%2012.3904%2010.2626L13.5904%2010.2626C13.5904%209.38017%2013.2398%208.53387%2012.6158%207.90988L11.7673%208.75841ZM12.3904%2010.2626C12.3904%2010.8268%2012.1662%2011.3679%2011.7673%2011.7668L12.6158%2012.6154C13.2398%2011.9914%2013.5904%2011.1451%2013.5904%2010.2626L12.3904%2010.2626ZM11.7673%2011.7668C10.9365%2012.5976%209.58963%2012.5976%208.75888%2011.7668L7.91035%2012.6154C9.20973%2013.9147%2011.3164%2013.9147%2012.6158%2012.6154L11.7673%2011.7668ZM8.75888%2011.7668L7.6018%2010.6097L6.75327%2011.4583L7.91035%2012.6154L8.75888%2011.7668ZM5.28764%208.29558L4.13056%207.1385L3.28203%207.98703L4.43911%209.14411L5.28764%208.29558ZM4.13056%207.1385C3.73162%206.73956%203.50749%206.19848%203.50749%205.63429L2.30749%205.63429C2.30749%206.51674%202.65804%207.36304%203.28203%207.98703L4.13056%207.1385ZM3.50749%205.63429C3.50749%205.0701%203.73162%204.52902%204.13056%204.13008L3.28203%203.28155C2.65804%203.90554%202.30749%204.75184%202.30749%205.63429L3.50749%205.63429ZM4.13056%204.13008C4.96131%203.29933%206.30822%203.29933%207.13897%204.13008L7.9875%203.28155C6.68812%201.98217%204.58141%201.98217%203.28203%203.28155L4.13056%204.13008ZM7.13897%204.13008L8.29606%205.28716L9.14459%204.43864L7.9875%203.28155L7.13897%204.13008Z'%20fill='%236C7B94'/%3e%3crect%20x='5.08887'%20y='6.0791'%20width='1.33333'%20height='6.66667'%20rx='0.666667'%20transform='rotate(-45%205.08887%206.0791)'%20fill='%236C7B94'/%3e%3cpath%20d='M5.59961%2014.3998V12.7998'%20stroke='%236C7B94'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M12.7998%205.59961H14.3998'%20stroke='%236C7B94'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M2.40039%2011.2002H4.00039'%20stroke='%236C7B94'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M11.2002%202.40039V4.00039'%20stroke='%236C7B94'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",EW="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_5908_39767)'%3e%3cpath%20d='M9.37333%206.01333L9.98667%206.62667L3.94667%2012.6667H3.33333V12.0533L9.37333%206.01333ZM11.7733%202C11.6067%202%2011.4333%202.06667%2011.3067%202.19333L10.0867%203.41333L12.5867%205.91333L13.8067%204.69333C14.0667%204.43333%2014.0667%204.01333%2013.8067%203.75333L12.2467%202.19333C12.1133%202.06%2011.9467%202%2011.7733%202ZM9.37333%204.12667L2%2011.5V14H4.5L11.8733%206.62667L9.37333%204.12667Z'%20fill='%236C7B94'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_5908_39767'%3e%3crect%20width='16'%20height='16'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",am=e=>e.write.createObjectList,Am=e=>e.write.linkObjectList,IW=e=>e.write.editObjectList,hW=e=>e.write.objectDict,BW=e=>e.write.formFields,mW=e=>e.write.previewCardData,QW=e=>e.write.previewCardApiStatus,vW=e=>e.write.linkCardApiStatus,yW=e=>e.write.unlinkCardApiStatus,bW=e=>e.write.dependentFieldsMap,wW=e=>e.write.createFormApiStatus,xW=e=>e.write.updateFormApiStatus,TW=e=>e.write.currentResourceDetails,FW=e=>e.write.currentResourceDetailsApiStatus,lm=e=>e.write.currentCardInEdit,cm=e=>e.write.hasUnsavedChanges,SW=({showUnlinkModal:e,setShowUnlinkModal:t,cardId:n,onCardUnlinking:o,externalResourceId:r,conversationId:i,connectorName:a})=>{const A=ci(),{sendTrackingEvent:l}=b.useContext(eo),u=Tt(yW)===Se.LOADING,p=()=>{i&&r&&A(Pc({id:n,conversationId:i,externalResourceId:r})).unwrap().then(()=>{l(oU,{connector_name:a,conversation_id:i}),t(!1),o(),fn({message:HV,type:Ei})}).catch(()=>{fn({message:WV,type:Ei})})};return y.jsx(Sf,{shown:e,setShown:t,showCloseButton:!0,children:y.jsxs(Ne,{width:"400px",padding:"20px",gap:"8px",children:[y.jsx(Ge,{variant:"h2",children:DN}),y.jsx(Ge,{variant:"body2",children:PN}),y.jsxs(Ne,{direction:"row",gap:"8px",marginTop:"20px",justifyContent:"flex-end",children:[y.jsx(zt,{variant:"text",onClick:()=>t(!1),children:af}),y.jsx(zt,{disabled:u,color:"error",onClick:p,children:k2})]})]})})},OW=e=>{const{card:t,specificCardData:n,email:o,specificConnectorApiStatus:r,defaultOpenState:i=!1,onCardUnlinking:a}=e,A=ci(),{availableFeatures:l,sendTrackingEvent:c,conversationId:u,currentSmIds:p}=b.useContext(eo),{userGroupId:g}=li()||{},[B,C]=b.useState(!!i),[f,d]=b.useState(!1),[E,m]=b.useState(!1),{id:h,title:Q,externalResourceId:I="",connectorName:v="",forms:w=[]}=t;let x=h;I&&(x=`${x}_${I}`);const{data:F,cardType:O,cardErrorMessage:M}=(n==null?void 0:n[x])??{},P=(r==null?void 0:r[x])===Se.LOADING,D=(r==null?void 0:r[x])===Se.FAILED,k=!!(br(l,T2)&&I),N=b.useMemo(()=>{var W,G;if(M||D||!(br(l,vN)&&w.some(Y=>Y.type==="edit")))return!1;switch(O){case"flat":return!!((F==null?void 0:F.flatDisplay.externalResourceId)??t.externalResourceId);case"flat_with_list":return((W=F==null?void 0:F.listItems)==null?void 0:W.fields.length)===1?(G=F==null?void 0:F.listItems)==null?void 0:G.fields.some(Y=>Y.externalResourceId):!1;default:return!1}},[F,O,l,w,t,M,D]),L=b.useCallback((W=!1)=>{const G=W?AU:aU;o&&h&&u&&A(AA({id:h,email:o,conversationId:u,externalResourceId:I})).unwrap().then(Y=>{const K=j2(Y,Q,W,!0);c(G,K)}).catch(Y=>{const K=j2(Y,Q,W,!1);c(G,K)})},[A,o,h,Q,c,u,I]);b.useEffect(()=>{i&&L(!0)},[i,L]);const z=(W,G)=>{var K;W==null||W.stopPropagation(),A(AA({id:G,email:o,conversationId:u,isRefresh:!0,externalResourceId:I})).unwrap().then(()=>{c(XN,{id:G})});const Y=W.target.tagName==="BUTTON"?(K=W.target)==null?void 0:K.firstChild:W.target;Y.className&&(Y.className=""),setTimeout(()=>Y.className="selected",1)},H=(W,G)=>{W.stopPropagation(),!(n!=null&&n[G])&&!P&&L(),c(B?GN:YN,{id:G}),C(Y=>!Y)},$=W=>{W.stopPropagation();const G=W.currentTarget.offsetWidth<W.currentTarget.scrollWidth;d(!!G)},R=()=>{var G,Y;c(H2,{card_title:Q,connector_name:v,ug_id:g,sm_ids:p});let W;O==="flat"?W=(F==null?void 0:F.flatDisplay.externalResourceId)??t.externalResourceId:O==="flat_with_list"&&(W=(Y=(G=F==null?void 0:F.listItems)==null?void 0:G.fields[0])==null?void 0:Y.externalResourceId),W?A(bs({...t,externalResourceId:W})):fn({message:HB,type:Tr})};return y.jsxs(ZU,{"data-testid":`test_${h}`,children:[y.jsxs(JU,{className:B?"hiver-card-expanded":"",children:[y.jsx(Yt,{title:f?Q:"",placement:"bottom",children:y.jsx(qU,{variant:"h4",onMouseOver:W=>$(W),onMouseLeave:W=>$(W),children:Q})}),y.jsxs(tB,{children:[B&&N?y.jsx(Yt,{title:M2,placement:"bottom",children:y.jsx(di,{onClick:R,children:y.jsx("img",{src:EW})})}):null,B&&k?y.jsx(Yt,{title:k2,placement:"bottom",children:y.jsx(di,{onClick:()=>m(!0),children:y.jsx("img",{src:CW})})}):null,B?y.jsx(Yt,{title:S2,placement:"bottom",children:y.jsx(di,{"data-testid":P?"loading":"reloadIcon",onClick:W=>z(W,h),className:P?"disabled":"",children:y.jsx("img",{src:sm})})}):null,y.jsx(Yt,{title:B?O2:sf,placement:"bottom",children:y.jsx(di,{onClick:W=>H(W,x),children:y.jsx(pf,{className:B?"":"hiver-up"})})})]})]}),y.jsx(nm,{id:x,cardTitle:t.title,currentCard:t,specificCardData:n,specificConnectorApiStatus:r,isOpen:B}),y.jsx(SW,{showUnlinkModal:E,setShowUnlinkModal:m,cardId:h,onCardUnlinking:a,conversationId:u,externalResourceId:I,connectorName:v})]})},kW=Number.MAX_SAFE_INTEGER,MW=({cards:e,email:t,specificCardData:n,specificConnectorApiStatus:o,onCardUnlinking:r})=>{const{availableFeatures:i}=b.useContext(eo),A=br(i,bN)?kW:1;return y.jsx(pt,{flexGrow:1,children:e.map((l,c)=>{const{id:u,externalResourceId:p}=l;let g=u;return p&&(g=`${g}_${p}`),y.jsx("div",{children:y.jsx(OW,{card:l,specificCardData:n,email:t??"",defaultOpenState:c<A,specificConnectorApiStatus:o,onCardUnlinking:r})},g)})})},DW="Bring your favourite tools into Hiver",PW="Plugin image",RW="Integrate tools like Salesforce, HubSpot, and Shopify to boost productivity",LW="Enable Connectors",NW="Learn more",UW="https://help.hiverhq.com/custom-connectors/hiver-s-custom-connectors",jW="Contact your admin to enable this",VW="https://youtu.be/ODcJnzZLb50",HW="connectors-module/assets/connectors-images/connector-mainpage.png",WW="Explore connectors",zW="Connectors",YW=V(Ne)`
|
|
2435
|
+
Do you want to continue?`,OH="Select an object to create",kH="Select an object to link",XB="Select object",MH="Paste URL or ID",DH="Object ID/Link",PH="Card updated",RH="Card updation failed",LH="Required Field",NH="Invalid date",KB=/^https:\/\/([a-z0-9-]+(\.[a-z0-9-]+)+)(:[0-9]{1,5})?(\/[^\s/]*)*$/i,UH=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,jH=(e,t)=>t?Object.values(t).filter(o=>e.values[o]&&!e.errors[o]):[],_B=(e,t)=>t?Object.keys(t).reduce((o,r)=>{let i="";const a=t[r];return e.values&&e.values[a]&&typeof e.values[a]=="object"&&"value"in e.values[a]?i=e.values[a].value:e.values&&e.values[a]&&typeof e.values[a]!="object"?i=e.values[a]:i=null,{...o,[r]:i}},{}):{},ZB=(e,t,n)=>{let o=`${t}_${n}`;return Object.keys(e).forEach(r=>{o=`${o}_${r}:${e[r]}`}),o},VH=e=>t=>{if(t&&typeof t=="string"){const n=t.replace(/\/$/,"");return n.startsWith("https://")?t.endsWith("/")?CH:KB.test(n)?!0:e||YB:pH}return!1},HH=e=>t=>t&&typeof t=="string"?UH.test(t)?!0:e||EH:IH,WH=e=>t=>t==null||t===""?e||LH:!0,zH=e=>(t,n)=>{var o;if(!t||(t==null?void 0:t.toString())===NH)return GB;if(typeof t=="object"){const r=t,i=new Date;i.setHours(0,0,0,0);const a=n.disablePast,A=n.disableFuture;return a&&r<i?e||hH:A&&r>i?e||BH:!0}return typeof t=="string"&&((o=new Date(t))==null?void 0:o.toString())!=="Invalid Date"?!0:GB},YH=e=>(t,n)=>{if(t=Number(t),typeof t=="number"&&!isNaN(t)){const o=n.min,r=n.max;return o!==void 0&&t<o?e||`Value should not be less than ${o}`:r!==void 0&&t>r?e||`Value should not be greater than ${r}`:!0}return e||mH},GH=e=>(t,n)=>{if(typeof t=="string"){const o=n.limit;return o!==void 0&&t.length>o?e||`Maximum characters allowed are ${o}`:!0}return e||QH},XH=e=>t=>typeof t=="string"?t.startsWith("https:")?KB.test(t)?!0:e||YB:t.trim().length>0?!0:e||gH:e||fH,KH=({formFields:e})=>{const t={};return e.forEach(n=>{var o,r,i,a,A,l;if(t[n.name]={},(o=n.validations)!=null&&o.isRequired&&(typeof n.validations.isRequired=="object"?t[n.name].isRequired=WH(n.validations.isRequired.msg):t[n.name].isRequired=!0),n.type==="date"){let c=typeof((r=n.validations)==null?void 0:r.disableFuture)=="object"?n.validations.disableFuture.msg:"";c=typeof((i=n.validations)==null?void 0:i.disablePast)=="object"?n.validations.disablePast.msg:c,t[n.name].validate=zH(c);return}if(n.type==="number"&&((a=n.validations)!=null&&a.range)){t[n.name].validate=YH();return}if(n.type==="text"&&n.limit){t[n.name].validate=GH();return}if((A=n.validations)!=null&&A.isUrl){const c=typeof n.validations.isUrl=="object"?n.validations.isUrl.msg:"";t[n.name].validate=VH(c)}else if((l=n.validations)!=null&&l.isEmail){const c=typeof n.validations.isEmail=="object"?n.validations.isEmail.msg:"";t[n.name].validate=HH(c)}}),t},Ff=(e,t)=>Object.keys(t).reduce((n,o)=>{const r=e.values[t[o]];let i;return Array.isArray(r)?i=r.map(a=>a.value):r&&typeof r=="object"&&"label"in r?i=r.value:r&&typeof r=="object"?i=r.toISOString():i=r||"",n[o]=i,n},{}),_H=e=>typeof e=="string"?/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/.test(e):typeof e=="object"&&"_isValid"in e,JB=e=>Object.keys(e).sort((n,o)=>o.localeCompare(n)).reduce((n,o)=>{var r;return(typeof e[o]=="string"||typeof e[o]=="object"&&e[o]!==null)&&_H(e[o])?n[o]=(r=new Date(`${e[o]}`))==null?void 0:r.toString():n[o]=e[o],n},{}),qB=UB({name:"writeCapability",initialState:WB,reducers:{resetState:()=>WB,resetCurrentResourceDetails:e=>{e.currentResourceDetails=null,e.currentResourceDetailsApiStatus=Se.IDLE},setCurrentCardInEdit:(e,t)=>{e.currentCardInEdit=t.payload},setHasUnsavedChanges:(e,t)=>{e.hasUnsavedChanges=t.payload}},extraReducers:e=>{e.addCase(Oc.pending,t=>{t.objectListApiStatus=Se.LOADING}).addCase(Oc.fulfilled,(t,n)=>{const{createObjectList:o,linkObjectList:r,editObjectList:i,formFields:a,objectDict:A,dependentFieldsMap:l}=n.payload;t.objectListApiStatus=Se.IDLE,t.createObjectList=o,t.linkObjectList=r,t.editObjectList=i,t.formFields=a,t.objectDict=A,t.dependentFieldsMap=l}).addCase(Oc.rejected,t=>{t.objectListApiStatus=Se.FAILED}).addCase(kc.pending,t=>{t.dropdownOptionsApis=Se.LOADING}).addCase(kc.fulfilled,(t,n)=>{const o=t.optionsMap||{},{optionsList:r,hasMore:i,currentPage:a,key:A}=n.payload;t.dropdownOptionsApis=Se.IDLE,t.optionsMap={...o,[A]:{options:r,hasMore:i,currentPage:a}}}).addCase(kc.rejected,t=>{t.dropdownOptionsApis=Se.FAILED}).addCase(Mc.pending,t=>{t.createFormApiStatus=Se.LOADING}).addCase(Mc.fulfilled,t=>{t.createFormApiStatus=Se.IDLE}).addCase(Mc.rejected,t=>{t.createFormApiStatus=Se.FAILED}).addCase(Rc.pending,t=>{t.linkCardApiStatus=Se.LOADING}).addCase(Rc.fulfilled,t=>{t.linkCardApiStatus=Se.IDLE}).addCase(Rc.rejected,t=>{t.linkCardApiStatus=Se.FAILED}).addCase(Pc.pending,t=>{t.unlinkCardApiStatus=Se.LOADING}).addCase(Pc.fulfilled,t=>{t.unlinkCardApiStatus=Se.IDLE}).addCase(Pc.rejected,t=>{t.unlinkCardApiStatus=Se.FAILED}).addCase(aA.pending,t=>{t.previewCardApiStatus=Se.LOADING}).addCase(aA.fulfilled,(t,n)=>{const{data:o}=n.payload;o&&(t.previewCardData=o),t.previewCardApiStatus=Se.IDLE}).addCase(aA.rejected,t=>{t.previewCardApiStatus=Se.FAILED}).addCase(Dc.pending,t=>{t.updateFormApiStatus=Se.LOADING}).addCase(Dc.fulfilled,t=>{t.updateFormApiStatus=Se.IDLE}).addCase(Dc.rejected,t=>{t.updateFormApiStatus=Se.FAILED}).addCase(Lc.pending,t=>{t.currentResourceDetailsApiStatus=Se.LOADING}).addCase(Lc.fulfilled,(t,n)=>{const{data:o}=n.payload;o&&(t.currentResourceDetails=o),t.currentResourceDetailsApiStatus=Se.IDLE}).addCase(Lc.rejected,t=>{t.currentResourceDetailsApiStatus=Se.FAILED})}}),Oc=Mo("writeCapability/fetchObjectList",async e=>{const{inboxIds:t,channelType:n,conversationId:o}=e,r=await rH({inboxIds:t,channelType:n,conversationId:o});if(!r||!r.data||!("formsList"in r.data)||!Array.isArray(r.data.formsList))return{createObjectList:[],linkObjectList:[],editObjectList:[],formFields:null,objectDict:null,dependentFieldsMap:{}};const i=r.data.formsList,a={},A=[],l=[],c=[],u={},p={};return i==null||i.forEach(g=>{var C,f;const B={...g};"fieldList"in B&&delete B.fieldList,p[g.id]=B,a[g.id]||(a[g.id]={}),u[g.id]||(u[g.id]=[]),g.type==="create"&&g.authenticated?A.push({value:g.id,label:g.name,avatarUrl:g.logoUrl}):g.type==="link"&&g.authenticated?l.push({value:g.id,label:g.name,avatarUrl:g.logoUrl}):g.type==="edit"&&g.authenticated&&c.push({value:g.id,label:g.name,avatarUrl:g.logoUrl}),(C=g.fieldList)==null||C.sort((d,E)=>d.priority-E.priority),(f=g.fieldList)==null||f.forEach(d=>{var m,h,Q,I,v,w,x,F,O,M,P,D;let E={};switch(d.type){case"select":case"multi-select":{E={...d,defaultOptions:!!d.interfaceDetails,isInfiniteScrollable:((h=(m=d.interfaceDetails)==null?void 0:m.pagination)==null?void 0:h.enabled)||!1,loadOptionsOnFocus:Object.keys(((Q=d.interfaceDetails)==null?void 0:Q.args)||{}).length>0,isMultiSelect:d.type==="multi-select",type:g.interfaceDetails?"async-select":"select",isClearable:!0};break}case"date":{E={...d,type:"date",disablePast:!!((I=d.validations)!=null&&I.disablePast)||!1,disableFuture:!!((v=d.validations)!=null&&v.disableFuture)||!1};break}case"number":{E={...d,type:"number",min:((x=(w=d.validations)==null?void 0:w.range)==null?void 0:x.min)||Number.MIN_SAFE_INTEGER,max:((O=(F=d.validations)==null?void 0:F.range)==null?void 0:O.max)||Number.MAX_SAFE_INTEGER};break}case"multiline":{E={...d,type:"text",maxRows:((M=d.validations)==null?void 0:M.maxRows)||5,limit:(P=d.validations)==null?void 0:P.maxCharacters,rows:5,multiline:!0};break}case"text":{E={...d,type:"text",limit:(D=d.validations)==null?void 0:D.maxCharacters};break}default:E={...d}}if("value"in E&&(E.defaultValue=E.value,delete E.value),u[g.id]=[...u[g.id],E],d.interfaceDetails&&(d.interfaceDetails.args||d.interfaceDetails.optionalArgs)){const k={...d.interfaceDetails.args,...d.interfaceDetails.optionalArgs};Object.values(k).forEach(N=>{a[g.id][N]?a[g.id][N]=[...a[g.id][N],d.name]:a[g.id][N]=[d.name]})}})}),{createObjectList:A,linkObjectList:l,editObjectList:c,formFields:u,objectDict:p,dependentFieldsMap:a}}),kc=Mo("writeCapability/fetchDropDownOptions",async(e,{getState:t,rejectWithValue:n})=>{var h;const{fieldName:o,formId:r,fieldConfig:i,callback:a,args:A={},interfaceId:l="",pagination:c={enabled:!1}}=e,u=ZB(A||{},r,o),{write:p}=t();let g=!1;i.meta&&"showAvatar"in i.meta&&typeof i.meta.showAvatar=="boolean"&&(g=i.meta.showAvatar);const{options:B=[],hasMore:C=!0,currentPage:f=0}=((h=p.optionsMap)==null?void 0:h[u])||{},{enabled:d,limit:E}=c,m=E||10;try{let Q;const I=d?{pageNumber:f+1,limit:m}:null;if(C?Q=await iH({fieldName:o,formId:r},{pagination:I||{},args:A,interfaceId:l}):a==null||a(B),!Q||!Q.data||!("data"in Q.data)||!Array.isArray(Q.data.data))return{optionsList:[...B],fieldName:"",formId:"",hasMore:!1,currentPage:f,key:u};const w=Q.data.data.map(O=>g?{...O,avatarUrl:O.avatarUrl||bH}:{label:O.label,value:O.value}),x=d?w.length>=m:!1,F=[...B,...w];return a==null||a(F),{optionsList:F,fieldName:o,formId:r,currentPage:f+1,hasMore:x,key:u}}catch(Q){return a==null||a(B),n(Q)}},{condition:(e,{getState:t})=>{var c,u;if(e.isScrollToBottomEvent)return!0;const{fieldName:n,formId:o,callback:r,args:i}=e,a=ZB(i||{},o,n),{write:A}=t(),l=((u=(c=A.optionsMap)==null?void 0:c[a])==null?void 0:u.options)||[];return l&&l.length?(r==null||r(l),!1):!0}}),Mc=Mo("writeCapability/createForm",async(e,{rejectWithValue:t})=>{const{formId:n,successCallback:o,failureCallback:r,args:i={},interfaceId:a,conversationId:A}=e;try{await zB({formId:n},{args:i,interfaceId:a,conversationId:A}),o==null||o(),fn({message:vH,type:Ei})}catch(l){return r==null||r(l),fn({message:yH,type:Tr}),t(l)}}),Dc=Mo("writeCapability/updateForm",async(e,{rejectWithValue:t})=>{const{formId:n,successCallback:o,failureCallback:r,args:i={},interfaceId:a,conversationId:A,externalResourceId:l,previousArgs:c={}}=e;try{await zB({formId:n},{args:i,interfaceId:a,conversationId:A,externalResourceId:l,previousArgs:c}),o==null||o(),fn({message:PH,type:Ei})}catch(u){return r==null||r(u),fn({message:RH,type:Tr}),t(u)}}),Pc=Mo("writeCapability/unlinkCard",async({id:e,channelType:t,externalResourceId:n,conversationId:o})=>{await sH(e,t,n,o)}),Rc=Mo("writeCapability/linkCard",async({id:e,externalResourceId:t,channelType:n,conversationId:o})=>{await aH(e,t,n,o)}),aA=Mo("writeCapability/previewCard",async({id:e,args:t,channelType:n,isRefresh:o})=>{const r=await AH(e,t,n),i=r==null?void 0:r.data;return i?(o&&fn({message:VB,type:Ei}),{data:V2(i)}):(o&&fn({message:jB,type:Tr}),{data:null})}),Lc=Mo("connectorCardLibrary/fetchCurrentResourceDetails",async(e,{rejectWithValue:t})=>{const{id:n,channelType:o,conversationId:r,externalResourceId:i,contactEmail:a}=e;try{const A=await lH(n,o,r,i,a),l=A==null?void 0:A.data,c=A==null?void 0:A.status,u={values:{},errors:{}};return Object.entries(l.formData).forEach(([p,g])=>{"label"in g&&(g.type&&g.type==="date"?u.values[p]=g.label?new Date(parseInt(g.label)).toISOString():"":g.type&&g.type==="multi-select"&&"value"in g&&"label"in g&&g.value&&g.label?u.values[p]=[{value:g.value,label:g.label}]:g.value?u.values[p]={value:g.value,label:g.label}:u.values[p]=g.label)}),{data:u,status:c}}catch(A){return fn({message:HB,type:Tr}),t(A)}}),{resetState:MK,setCurrentCardInEdit:bs,resetCurrentResourceDetails:ZH,setHasUnsavedChanges:$B}=qB.actions,JH=qB.reducer,qH=()=>{const[e,t]=b.useState(null),[n,o]=b.useState({isVertical:!1,isHorizontal:!1,isScrolling:!1}),r=b.useCallback(i=>{t(i)},[]);return b.useEffect(()=>{if(!e)return;e.dataset.prevScrollLeft="0",e.dataset.prevScrollTop="0";let i=null;const a=100;let A=null;const l=150,c=u=>{i||(i=window.setTimeout(()=>{const p=u.target,g=Number(e.dataset.prevScrollLeft)||0,B=Number(e.dataset.prevScrollTop)||0,C=p.scrollLeft,f=p.scrollTop,d=C-g,E=f-B,m=Math.abs(E)>Math.abs(d),h=Math.abs(d)>Math.abs(E);o({isVertical:m,isHorizontal:h,isScrolling:!0}),e.dataset.prevScrollLeft=String(C),e.dataset.prevScrollTop=String(f),i=null},a),A&&window.clearTimeout(A),A=window.setTimeout(()=>{o(p=>({...p,isScrolling:!1})),A=null},l))};return e.addEventListener("scroll",c),()=>{e.removeEventListener("scroll",c),i&&window.clearTimeout(i),A&&window.clearTimeout(A)}},[e]),[n,r]},$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%3cpath%20d='M5.8016%2011.709L12.3416%205.16893L11.4298%204.25712L4.88979%2010.7972V11.709H5.8016ZM6.33618%2012.9987H3.6001V10.2626L10.9739%202.88875C11.0948%202.76786%2011.2588%202.69995%2011.4298%202.69995C11.6008%202.69995%2011.7648%202.76786%2011.8857%202.88875L13.71%204.71302C13.8309%204.83395%2013.8988%204.99794%2013.8988%205.16893C13.8988%205.33992%2013.8309%205.50391%2013.71%205.62484L6.33618%2012.9987ZM3.6001%2014.2884H15.2073V15.578H3.6001V14.2884Z'%20fill='%236C7B94'/%3e%3c/svg%3e",eW=({data:e,title:t,currentCard:n,setShowModal:o})=>{const r=ci(),{sendTrackingEvent:i,currentSmIds:a}=b.useContext(eo),{userGroupId:A}=li()||{},[l,c]=qH(),{isScrolling:u,isVertical:p}=l,g=u&&p,B=b.useMemo(()=>(e==null?void 0:e[0].data.map(E=>E.label))||[],[e]),C=b.useMemo(()=>e.map(E=>{const m={cells:{},externalResourceId:E.externalResourceId};return E.data.forEach((h,Q)=>{if(B[Q]){let I=h.value?h.value:Ic;I&&h.type==="date"&&(I=new Date(parseInt(I)).toLocaleDateString(navigator.language)),m.cells[B[Q]]={label:I,deepLink:h==null?void 0:h.deepLink}}}),m}),[e,B]),f=(E,m)=>y.jsx(aj,{align:"left",children:E.deepLink?y.jsx(Sa,{target:"_blank",underline:"none",href:E.deepLink,children:E.label}):y.jsx(Ge,{variant:"body2",color:"gray.black",children:E.label})},`${m}_${E.label}`),d=E=>{!E||!n||(o(!1),i(H2,{card_title:n.title,connector_name:n.connectorName,ug_id:A,sm_ids:a}),r(bs({...n,externalResourceId:E})))};return y.jsxs(Ne,{maxHeight:"340px",maxWidth:"700px",padding:"32px 0px 32px 32px",overflow:"auto",children:[y.jsx(Ge,{variant:"h2",color:"gray.black",marginBottom:"16px",children:t}),y.jsx(nE,{ref:c,children:y.jsxs($C,{stickyHeader:!0,children:[y.jsx(rj,{children:y.jsxs(Nd,{children:[B.map(E=>y.jsx(ij,{sx:{whiteSpace:"nowrap"},children:y.jsx(Ge,{variant:"overline",color:"gray.gray3",children:E})},E)),y.jsx(lj,{})]})}),y.jsx(tE,{children:C.map((E,m)=>y.jsxs(sj,{children:[Object.values(E.cells).map((h,Q)=>f(h,Q)),y.jsx(Aj,{children:!g&&E.externalResourceId&&y.jsx(Yt,{title:M2,placement:"bottom",children:y.jsx(nn,{className:"row-edit",onClick:()=>d(E.externalResourceId),children:y.jsx("img",{src:$H})})})})]},`id_${m}`))})]})})]})},tW=e=>e.cardList.connectorCards,nW=e=>e.cardList.connectorsEnabled,oW=e=>e.cardList.connectorApiStatus,rW=e=>e.cardList.cardSpecificData,iW=e=>e.cardList.specificConnectorApiStatus,sW=e=>e.cardList.specificConnectorErrorCode,aW="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9%204.8675L14.6475%2014.625H3.3525L9%204.8675ZM9%201.875L0.75%2016.125H17.25L9%201.875Z'%20fill='%23F07530'/%3e%3cpath%20d='M9.75%2012.375H8.25V13.875H9.75V12.375Z'%20fill='%23F07530'/%3e%3cpath%20d='M9.75%207.875H8.25V11.625H9.75V7.875Z'%20fill='%23F07530'/%3e%3c/svg%3e",em=e=>{const t=/\(Error code: (.*?)\)$/,n=e.match(t),o=n?n[1]:null,r=n?e.replace(t,"").trim():e;return{error_code:o,error_message:r}},AW=(e,t)=>`${R2} (Error code: ${e})`.replace(/{{connector_name}}/g,(t==null?void 0:t[0])||""),tm=e=>{const{value:t,error:n,deepLink:o,statusCode:r,isLoading:i,type:a,redirectToAdminTab:A,isFailed:l,connectorNames:c,cardTitle:u,currentCard:p,cardId:g,isCardLevelError:B}=e,C=b.useRef(null),f=b.useRef(null),{email:d,currentSmIds:E,conversationId:m,sendTrackingEvent:h,connectorFunctions:Q}=b.useContext(eo),I=Tt(sW),v=I==null?void 0:I[g],[w,x]=b.useState(!1),F=b.useMemo(()=>{if(n&&B){const{error_message:L}=em(n);return L}return l?R2.replace(/{{connector_name}}/g,(c==null?void 0:c[0])||""):F2},[n,l,c,B]),O=b.useCallback(()=>{const L=n||AW(v,c),{error_code:z,error_message:H}=em(L);h==null||h(CU,{sm_ids:E,frontend_req_params:{email:d,conversationId:m,externalResourceId:p==null?void 0:p.externalResourceId},card_title:u,connector_name:c!=null&&c.length?c:"",error_code:z,error_message:H})},[n,v,h,E,d,m,u,c,p==null?void 0:p.externalResourceId]);b.useEffect(()=>{(n&&B||l&&v)&&O()},[O,v,l,n,B]),b.useEffect(()=>{const L=o?f.current:C.current;if(L){const z=L.scrollHeight>L.clientHeight||L.scrollWidth>L.clientWidth;x(z)}},[t,o]);const M=r==rf.NOT_FOUND;let P=M?Ic:t;a==="date"&&P&&!M&&(P=new Date(parseInt(P)).toLocaleDateString(navigator.language));const D=!!n||l,k=()=>{A?Q==null||Q.redirectToAdmin():window.open(jN,"_blank")},N=L=>{const z=/<>(.*?)<>/g,H=L.split(z);return y.jsx(b.Fragment,{children:H.map(($,R)=>R%2===1?y.jsx(tj,{variant:"body2",onClick:k,children:$},R):$)})};return i?y.jsx(ui,{variant:"rounded",width:"100%",height:16,animation:"wave",margin:"4px 0 0 0"}):D?y.jsxs(tB,{gap:"7px",children:[y.jsx(Ne,{marginTop:"3px",children:y.jsx("img",{src:aW,width:"18px",height:"18px"})}),y.jsx(nB,{variant:"body2",children:F?N(F):F2})]}):y.jsx(Yt,{title:w?P:null,placement:"bottom",children:o?y.jsx(oB,{ref:f,target:"_blank",underline:"none",href:o,fontSize:"13px",children:P||Ic}):y.jsx(oj,{ref:C,variant:"body2",children:P||Ic})})},lW="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_825_73646)'%3e%3cpath%20d='M19%206.41L17.59%205L12%2010.59L6.41%205L5%206.41L10.59%2012L5%2017.59L6.41%2019L12%2013.41L17.59%2019L19%2017.59L13.41%2012L19%206.41Z'%20fill='%236F7C90'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_825_73646'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Sf=({shown:e,setShown:t,children:n,showCloseButton:o=!1,borderRadius:r=4})=>y.jsx(xd,{open:e,onClose:()=>t(!1),PaperProps:{style:{borderRadius:r,padding:0,height:"fit-content",width:"fit-content",maxWidth:"none"}},children:y.jsxs(Ne,{direction:"row",children:[o&&y.jsx(pt,{position:"absolute",right:10,top:10,children:y.jsx(Yt,{title:"Close",placement:"bottom",children:y.jsx(nn,{onClick:()=>t(!1),children:y.jsx("img",{src:lW})})})}),n]})}),nm=e=>{var W,G;const{id:t,cardTitle:n,specificCardData:o,specificConnectorApiStatus:r,isOpen:i,currentCard:a}=e,A=24,l=(r==null?void 0:r[t])===Se.IDLE,c=(r==null?void 0:r[t])===Se.LOADING,u=(r==null?void 0:r[t])===Se.FAILED,{cardType:p,data:g,cardErrorMessage:B,redirectToAdminTab:C,connectorNames:f}=(o==null?void 0:o[t])||{},d=p==="flat",[E,m]=b.useState(!1),[h,Q]=b.useState(!1),[I,v]=b.useState(!1),[w,x]=b.useState(!1),F=b.useMemo(()=>{var Y,K,q,ee;return d&&((Y=g==null?void 0:g.flatDisplay)!=null&&Y.data)?g.flatDisplay.data:!d&&((ee=(q=(K=g==null?void 0:g.listItems)==null?void 0:K.fields)==null?void 0:q[0])!=null&&ee.data)?g.listItems.fields[0].data:[]},[d,g]),O=b.useMemo(()=>F==null?void 0:F.slice(0,5),[F]),[M,P]=b.useState([]),D=b.useRef(null),[k,N]=b.useState(0),L=E?-180:0,z=d?!1:!!((W=g==null?void 0:g.listItems)!=null&&W.errorMessage),H=z||u||B,$=l&&!z&&i&&(I||h);b.useLayoutEffect(()=>{var Y;(Y=D.current)!=null&&Y.scrollHeight&&N(D.current.scrollHeight+A)},[r==null?void 0:r[t],M,D]),b.useEffect(()=>{var ee,X;const Y=((F==null?void 0:F.length)||0)>5,K=!d&&(((X=(ee=g==null?void 0:g.listItems)==null?void 0:ee.fields)==null?void 0:X.length)||0)>1;v(Y&&!K),Q(K)},[g,d,F==null?void 0:F.length]),b.useEffect(()=>{P(E?F:O)},[g,E,O,F]);const R=()=>{I?m(Y=>!Y):x(Y=>!Y)};return y.jsxs(y.Fragment,{children:[y.jsx(Sf,{shown:w,setShown:x,showCloseButton:!0,borderRadius:12,children:y.jsx(eW,{data:((G=g==null?void 0:g.listItems)==null?void 0:G.fields)||[],title:n,currentCard:a,setShowModal:x})}),y.jsx($U,{className:i?"":"slideUp",height:k,children:y.jsx(Ne,{ref:D,gap:1,margin:"12px",children:c&&!(M!=null&&M.length)?y.jsxs(y.Fragment,{children:[y.jsx(ui,{variant:"rounded",width:"100%",height:20,animation:"wave"}),y.jsx(ui,{variant:"rounded",width:"100%",height:20,animation:"wave"})]}):y.jsx(y.Fragment,{children:H?y.jsx(pt,{margin:"8px 0",children:y.jsx(tm,{error:B,isLoading:c,redirectToAdminTab:C,isFailed:u,connectorNames:f,cardId:t,cardTitle:n,currentCard:a,isCardLevelError:!0})}):M!=null&&M.length?M==null?void 0:M.map(Y=>{const{value:K,label:q,deepLink:ee,type:X}=Y,J="errorMessage"in Y?Y.errorMessage:null,_="statusCode"in Y?Y.statusCode:null;return y.jsxs("div",{children:[y.jsx(ej,{variant:"overline",children:q}),y.jsx(tm,{value:K,error:J,deepLink:ee,statusCode:_,isLoading:c,type:X,cardTitle:n,currentCard:a,cardId:t})]},q)}):y.jsx(pt,{margin:"8px 0",children:y.jsx(nB,{children:xN})})})})}),!B&&$&&y.jsx(uj,{variant:"body2_medium",onClick:R,children:I?y.jsxs(y.Fragment,{children:[E?yj:rB,y.jsx(cj,{src:vj,transformAngle:L})]}):rB})]})},cW={connectorCards:null,cardSpecificData:null,connectorApiStatus:Se.IDLE,specificConnectorApiStatus:null,threadId:null,connectorsEnabled:!1,specificConnectorErrorCode:null},om="/v1/api",uW=`${om}/connectors/cards`,dW=`${om}/connectors/cards/:id/data`,gW=({inboxIds:e,conversationId:t,channelType:n="email"})=>{const o=new URLSearchParams;return e.forEach(r=>o.append("inbox_ids",r)),o.append("channel_type",n),o.append("conversation_id",String(t||"")),ko({url:`${uW}?${o.toString()}`,method:rr.GET})},fW=(e,t,n,o)=>{const r=new URLSearchParams;return r.append("senderEmail",t),r.append("conversation_id",String(n||"")),o&&r.append("externalResourceId",o),ko({url:`${dW.replace(":id",e)}?${r.toString()}`,method:rr.GET})},rm=UB({name:"connectorCardLibrary",initialState:cW,reducers:{updateThreadId(e,t){const{payload:n}=t;e.threadId=n.threadId,e.connectorCards=null},clearConnectorList(e){e.connectorCards=null,e.cardSpecificData=null}},extraReducers:e=>{e.addCase(Nc.pending,t=>{t.connectorApiStatus=Se.LOADING}).addCase(Nc.fulfilled,(t,n)=>{t.connectorApiStatus=Se.IDLE,t.connectorCards=n.payload.cards,t.connectorsEnabled=n.payload.connectorsEnabled}).addCase(Nc.rejected,t=>{t.connectorApiStatus=Se.FAILED}).addCase(AA.pending,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg;let i=o;r&&(i=`${i}_${r}`),t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Se.LOADING}}).addCase(AA.fulfilled,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg;let i=o;r&&(i=`${i}_${r}`);const{data:a}=n.payload||{};a&&(t.cardSpecificData={...t.cardSpecificData?t.cardSpecificData:{},[i]:a}),t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Se.IDLE}}).addCase(AA.rejected,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg;let i=o;r&&(i=`${i}_${r}`),t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Se.FAILED};const a=n.payload&&typeof n.payload=="object"&&"code"in n.payload?String(n.payload.code):L2;t.specificConnectorErrorCode={...t.specificConnectorErrorCode??{},[i]:a}})}}),Nc=Mo("connectorCardLibrary/fetchAllCard",async({inboxIds:e,channelType:t,conversationId:n})=>{var A;const o=await gW({inboxIds:e,channelType:t,conversationId:n});if(!Array.isArray((A=o==null?void 0:o.data)==null?void 0:A.cards))return{cards:[],connectorsEnabled:!1};const{cards:r,connectorsEnabled:i=!1}=o.data;return{cards:r.sort((l,c)=>(l==null?void 0:l.priority)-(c==null?void 0:c.priority)),connectorsEnabled:i}}),AA=Mo("connectorCardLibrary/fetchSpecificCard",async({id:e,email:t,conversationId:n,isRefresh:o,externalResourceId:r},i)=>{try{const a=await fW(e,t,n,r),A=a==null?void 0:a.data,l=a==null?void 0:a.status;return A?(o&&fn({message:VB,type:Ei}),{data:V2(A),status:l}):(o&&fn({message:jB,type:Tr}),{data:{},status:l})}catch(a){const A=a;return i.rejectWithValue({...A,code:A.code||L2})}}),pW=rm.reducer,im=rm.actions,sm="data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.76618%202.23341C8.79952%201.26675%207.47285%200.666748%205.99952%200.666748C3.05285%200.666748%200.672852%203.05341%200.672852%206.00008C0.672852%208.94675%203.05285%2011.3334%205.99952%2011.3334C8.48619%2011.3334%2010.5595%209.63341%2011.1529%207.33341H9.76618C9.21952%208.88675%207.73952%2010.0001%205.99952%2010.0001C3.79285%2010.0001%201.99952%208.20675%201.99952%206.00008C1.99952%203.79341%203.79285%202.00008%205.99952%202.00008C7.10618%202.00008%208.09285%202.46008%208.81285%203.18675L6.66618%205.33341H11.3329V0.666748L9.76618%202.23341Z'%20fill='%236C7B94'/%3e%3c/svg%3e",CW="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M11.4587%206.7528C11.2244%206.51848%2010.8445%206.51848%2010.6102%206.7528C10.3759%206.98711%2010.3759%207.36701%2010.6102%207.60132L11.4587%206.7528ZM12.1916%208.33414L12.6158%207.90988L12.1916%208.33414ZM8.33462%2012.1911L8.75888%2011.7668L8.33462%2012.1911ZM7.6018%2010.6097C7.36748%2010.3754%206.98758%2010.3754%206.75327%2010.6097C6.51895%2010.8441%206.51895%2011.224%206.75327%2011.4583L7.6018%2010.6097ZM4.43911%209.14411C4.67343%209.37842%205.05333%209.37842%205.28764%209.14411C5.52196%208.9098%205.52196%208.5299%205.28764%208.29558L4.43911%209.14411ZM3.70629%207.56276L4.13056%207.1385L3.70629%207.56276ZM7.56324%203.70582L7.9875%203.28155L7.56324%203.70582ZM8.29606%205.28716C8.53037%205.52148%208.91027%205.52148%209.14459%205.28716C9.3789%205.05285%209.3789%204.67295%209.14459%204.43864L8.29606%205.28716ZM10.6102%207.60132L11.7673%208.75841L12.6158%207.90988L11.4587%206.7528L10.6102%207.60132ZM11.7673%208.75841C12.1662%209.15735%2012.3904%209.69843%2012.3904%2010.2626L13.5904%2010.2626C13.5904%209.38017%2013.2398%208.53387%2012.6158%207.90988L11.7673%208.75841ZM12.3904%2010.2626C12.3904%2010.8268%2012.1662%2011.3679%2011.7673%2011.7668L12.6158%2012.6154C13.2398%2011.9914%2013.5904%2011.1451%2013.5904%2010.2626L12.3904%2010.2626ZM11.7673%2011.7668C10.9365%2012.5976%209.58963%2012.5976%208.75888%2011.7668L7.91035%2012.6154C9.20973%2013.9147%2011.3164%2013.9147%2012.6158%2012.6154L11.7673%2011.7668ZM8.75888%2011.7668L7.6018%2010.6097L6.75327%2011.4583L7.91035%2012.6154L8.75888%2011.7668ZM5.28764%208.29558L4.13056%207.1385L3.28203%207.98703L4.43911%209.14411L5.28764%208.29558ZM4.13056%207.1385C3.73162%206.73956%203.50749%206.19848%203.50749%205.63429L2.30749%205.63429C2.30749%206.51674%202.65804%207.36304%203.28203%207.98703L4.13056%207.1385ZM3.50749%205.63429C3.50749%205.0701%203.73162%204.52902%204.13056%204.13008L3.28203%203.28155C2.65804%203.90554%202.30749%204.75184%202.30749%205.63429L3.50749%205.63429ZM4.13056%204.13008C4.96131%203.29933%206.30822%203.29933%207.13897%204.13008L7.9875%203.28155C6.68812%201.98217%204.58141%201.98217%203.28203%203.28155L4.13056%204.13008ZM7.13897%204.13008L8.29606%205.28716L9.14459%204.43864L7.9875%203.28155L7.13897%204.13008Z'%20fill='%236C7B94'/%3e%3crect%20x='5.08887'%20y='6.0791'%20width='1.33333'%20height='6.66667'%20rx='0.666667'%20transform='rotate(-45%205.08887%206.0791)'%20fill='%236C7B94'/%3e%3cpath%20d='M5.59961%2014.3998V12.7998'%20stroke='%236C7B94'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M12.7998%205.59961H14.3998'%20stroke='%236C7B94'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M2.40039%2011.2002H4.00039'%20stroke='%236C7B94'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M11.2002%202.40039V4.00039'%20stroke='%236C7B94'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",EW="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_5908_39767)'%3e%3cpath%20d='M9.37333%206.01333L9.98667%206.62667L3.94667%2012.6667H3.33333V12.0533L9.37333%206.01333ZM11.7733%202C11.6067%202%2011.4333%202.06667%2011.3067%202.19333L10.0867%203.41333L12.5867%205.91333L13.8067%204.69333C14.0667%204.43333%2014.0667%204.01333%2013.8067%203.75333L12.2467%202.19333C12.1133%202.06%2011.9467%202%2011.7733%202ZM9.37333%204.12667L2%2011.5V14H4.5L11.8733%206.62667L9.37333%204.12667Z'%20fill='%236C7B94'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_5908_39767'%3e%3crect%20width='16'%20height='16'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",am=e=>e.write.createObjectList,Am=e=>e.write.linkObjectList,IW=e=>e.write.editObjectList,hW=e=>e.write.objectDict,BW=e=>e.write.formFields,mW=e=>e.write.previewCardData,QW=e=>e.write.previewCardApiStatus,vW=e=>e.write.linkCardApiStatus,yW=e=>e.write.unlinkCardApiStatus,bW=e=>e.write.dependentFieldsMap,wW=e=>e.write.createFormApiStatus,xW=e=>e.write.updateFormApiStatus,TW=e=>e.write.currentResourceDetails,FW=e=>e.write.currentResourceDetailsApiStatus,lm=e=>e.write.currentCardInEdit,cm=e=>e.write.hasUnsavedChanges,SW=({showUnlinkModal:e,setShowUnlinkModal:t,cardId:n,onCardUnlinking:o,externalResourceId:r,conversationId:i,connectorName:a})=>{const A=ci(),{sendTrackingEvent:l}=b.useContext(eo),u=Tt(yW)===Se.LOADING,p=()=>{i&&r&&A(Pc({id:n,conversationId:i,externalResourceId:r})).unwrap().then(()=>{l(oU,{connector_name:a,conversation_id:i}),t(!1),o(),fn({message:HV,type:Ei})}).catch(()=>{fn({message:WV,type:Ei})})};return y.jsx(Sf,{shown:e,setShown:t,showCloseButton:!0,children:y.jsxs(Ne,{width:"400px",padding:"20px",gap:"8px",children:[y.jsx(Ge,{variant:"h2",children:DN}),y.jsx(Ge,{variant:"body2",children:PN}),y.jsxs(Ne,{direction:"row",gap:"8px",marginTop:"20px",justifyContent:"flex-end",children:[y.jsx(zt,{variant:"text",onClick:()=>t(!1),children:af}),y.jsx(zt,{disabled:u,color:"error",onClick:p,children:k2})]})]})})},OW=e=>{const{card:t,specificCardData:n,email:o,specificConnectorApiStatus:r,defaultOpenState:i=!1,onCardUnlinking:a}=e,A=ci(),{availableFeatures:l,sendTrackingEvent:c,conversationId:u,currentSmIds:p}=b.useContext(eo),{userGroupId:g}=li()||{},[B,C]=b.useState(!!i),[f,d]=b.useState(!1),[E,m]=b.useState(!1),{id:h,title:Q,externalResourceId:I="",connectorName:v="",forms:w=[]}=t;let x=h;I&&(x=`${x}_${I}`);const{data:F,cardType:O,cardErrorMessage:M}=(n==null?void 0:n[x])??{},P=(r==null?void 0:r[x])===Se.LOADING,D=(r==null?void 0:r[x])===Se.FAILED,k=!!(br(l,T2)&&I),N=b.useMemo(()=>{var W,G;if(M||D||!(br(l,vN)&&w.some(Y=>Y.type==="edit")))return!1;switch(O){case"flat":return!!((F==null?void 0:F.flatDisplay.externalResourceId)??t.externalResourceId);case"flat_with_list":return((W=F==null?void 0:F.listItems)==null?void 0:W.fields.length)===1?(G=F==null?void 0:F.listItems)==null?void 0:G.fields.some(Y=>Y.externalResourceId):!1;default:return!1}},[F,O,l,w,t,M,D]),L=b.useCallback((W=!1)=>{const G=W?AU:aU;o&&h&&u&&A(AA({id:h,email:o,conversationId:u,externalResourceId:I})).unwrap().then(Y=>{const K={...j2(Y,Q,W,!0),sm_ids:p};c(G,K)}).catch(Y=>{const K={...j2(Y,Q,W,!1),sm_ids:p};c(G,K)})},[A,o,h,Q,c,u,I,p]);b.useEffect(()=>{i&&L(!0)},[i,L]);const z=(W,G)=>{var K;W==null||W.stopPropagation(),A(AA({id:G,email:o,conversationId:u,isRefresh:!0,externalResourceId:I})).unwrap().then(()=>{c(XN,{id:G})});const Y=W.target.tagName==="BUTTON"?(K=W.target)==null?void 0:K.firstChild:W.target;Y.className&&(Y.className=""),setTimeout(()=>Y.className="selected",1)},H=(W,G)=>{W.stopPropagation(),!(n!=null&&n[G])&&!P&&L(),c(B?GN:YN,{id:G}),C(Y=>!Y)},$=W=>{W.stopPropagation();const G=W.currentTarget.offsetWidth<W.currentTarget.scrollWidth;d(!!G)},R=()=>{var G,Y;c(H2,{card_title:Q,connector_name:v,ug_id:g,sm_ids:p});let W;O==="flat"?W=(F==null?void 0:F.flatDisplay.externalResourceId)??t.externalResourceId:O==="flat_with_list"&&(W=(Y=(G=F==null?void 0:F.listItems)==null?void 0:G.fields[0])==null?void 0:Y.externalResourceId),W?A(bs({...t,externalResourceId:W})):fn({message:HB,type:Tr})};return y.jsxs(ZU,{"data-testid":`test_${h}`,children:[y.jsxs(JU,{className:B?"hiver-card-expanded":"",children:[y.jsx(Yt,{title:f?Q:"",placement:"bottom",children:y.jsx(qU,{variant:"h4",onMouseOver:W=>$(W),onMouseLeave:W=>$(W),children:Q})}),y.jsxs(tB,{children:[B&&N?y.jsx(Yt,{title:M2,placement:"bottom",children:y.jsx(di,{onClick:R,children:y.jsx("img",{src:EW})})}):null,B&&k?y.jsx(Yt,{title:k2,placement:"bottom",children:y.jsx(di,{onClick:()=>m(!0),children:y.jsx("img",{src:CW})})}):null,B?y.jsx(Yt,{title:S2,placement:"bottom",children:y.jsx(di,{"data-testid":P?"loading":"reloadIcon",onClick:W=>z(W,h),className:P?"disabled":"",children:y.jsx("img",{src:sm})})}):null,y.jsx(Yt,{title:B?O2:sf,placement:"bottom",children:y.jsx(di,{onClick:W=>H(W,x),children:y.jsx(pf,{className:B?"":"hiver-up"})})})]})]}),y.jsx(nm,{id:x,cardTitle:t.title,currentCard:t,specificCardData:n,specificConnectorApiStatus:r,isOpen:B}),y.jsx(SW,{showUnlinkModal:E,setShowUnlinkModal:m,cardId:h,onCardUnlinking:a,conversationId:u,externalResourceId:I,connectorName:v})]})},kW=Number.MAX_SAFE_INTEGER,MW=({cards:e,email:t,specificCardData:n,specificConnectorApiStatus:o,onCardUnlinking:r})=>{const{availableFeatures:i}=b.useContext(eo),A=br(i,bN)?kW:1;return y.jsx(pt,{flexGrow:1,children:e.map((l,c)=>{const{id:u,externalResourceId:p}=l;let g=u;return p&&(g=`${g}_${p}`),y.jsx("div",{children:y.jsx(OW,{card:l,specificCardData:n,email:t??"",defaultOpenState:c<A,specificConnectorApiStatus:o,onCardUnlinking:r})},g)})})},DW="Bring your favourite tools into Hiver",PW="Plugin image",RW="Integrate tools like Salesforce, HubSpot, and Shopify to boost productivity",LW="Enable Connectors",NW="Learn more",UW="https://help.hiverhq.com/custom-connectors/hiver-s-custom-connectors",jW="Contact your admin to enable this",VW="https://youtu.be/ODcJnzZLb50",HW="connectors-module/assets/connectors-images/connector-mainpage.png",WW="Explore connectors",zW="Connectors",YW=V(Ne)`
|
|
2436
2436
|
width: 100%;
|
|
2437
2437
|
height: 97px;
|
|
2438
2438
|
background-color: ${Pe.palette.purple.light};
|
|
@@ -2785,7 +2785,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2785
2785
|
& .content__btn {
|
|
2786
2786
|
margin-left: 8px;
|
|
2787
2787
|
}
|
|
2788
|
-
`,OX=e=>T.createElement("svg",{width:20,height:21,viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},T.createElement("mask",{id:"mask0_4649_80352",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:0,y:0,width:20,height:21},T.createElement("rect",{y:.320312,width:20,height:20,fill:"#D9D9D9"})),T.createElement("g",{mask:"url(#mask0_4649_80352)"},T.createElement("path",{d:"M9.16797 14.4873H10.8346V11.154H14.168V9.4873H10.8346V6.15397H9.16797V9.4873H5.83464V11.154H9.16797V14.4873ZM10.0013 18.654C8.84852 18.654 7.76519 18.4352 6.7513 17.9977C5.73741 17.5602 4.85547 16.9665 4.10547 16.2165C3.35547 15.4665 2.76172 14.5845 2.32422 13.5706C1.88672 12.5567 1.66797 11.4734 1.66797 10.3206C1.66797 9.16786 1.88672 8.08453 2.32422 7.07064C2.76172 6.05675 3.35547 5.1748 4.10547 4.4248C4.85547 3.6748 5.73741 3.08105 6.7513 2.64355C7.76519 2.20605 8.84852 1.9873 10.0013 1.9873C11.1541 1.9873 12.2374 2.20605 13.2513 2.64355C14.2652 3.08105 15.1471 3.6748 15.8971 4.4248C16.6471 5.1748 17.2409 6.05675 17.6784 7.07064C18.1159 8.08453 18.3346 9.16786 18.3346 10.3206C18.3346 11.4734 18.1159 12.5567 17.6784 13.5706C17.2409 14.5845 16.6471 15.4665 15.8971 16.2165C15.1471 16.9665 14.2652 17.5602 13.2513 17.9977C12.2374 18.4352 11.1541 18.654 10.0013 18.654ZM10.0013 16.9873C11.8624 16.9873 13.4388 16.3415 14.7305 15.0498C16.0221 13.7581 16.668 12.1817 16.668 10.3206C16.668 8.45953 16.0221 6.88314 14.7305 5.59147C13.4388 4.2998 11.8624 3.65397 10.0013 3.65397C8.14019 3.65397 6.5638 4.2998 5.27214 5.59147C3.98047 6.88314 3.33464 8.45953 3.33464 10.3206C3.33464 12.1817 3.98047 13.7581 5.27214 15.0498C6.5638 16.3415 8.14019 16.9873 10.0013 16.9873Z",fill:"#4D596C"}))),kX=e=>T.createElement("svg",{width:20,height:21,viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},T.createElement("path",{d:"M14.3462 8.73757C14.0406 8.43198 13.5451 8.43198 13.2395 8.73757C12.9339 9.04316 12.9339 9.53863 13.2395 9.84422L14.3462 8.73757ZM15.2392 10.7372L15.7925 10.1839L15.2392 10.7372ZM16.2377 13.1478L15.4552 13.1478L16.2377 13.1478ZM15.2392 15.5584L14.6859 15.0051L15.2392 15.5584ZM10.418 15.5584L9.86469 16.1118L10.418 15.5584ZM9.52499 13.5588C9.2194 13.2532 8.72393 13.2532 8.41834 13.5588C8.11275 13.8643 8.11275 14.3598 8.41834 14.6654L9.52499 13.5588ZM5.52477 11.7731C5.83036 12.0787 6.32583 12.0787 6.63142 11.7731C6.93701 11.4675 6.93701 10.972 6.63142 10.6665L5.52477 11.7731ZM9.45292 4.95224L10.0062 4.39892L9.45292 4.95224ZM10.346 6.95192C10.6515 7.25752 11.147 7.25752 11.4526 6.95192C11.7582 6.64633 11.7582 6.15087 11.4526 5.84527L10.346 6.95192ZM13.2395 9.84422L14.6859 11.2906L15.7925 10.1839L14.3462 8.73757L13.2395 9.84422ZM14.6859 11.2906C15.1785 11.7832 15.4552 12.4512 15.4552 13.1478L17.0202 13.1478C17.0202 12.0362 16.5786 10.97 15.7925 10.1839L14.6859 11.2906ZM15.4552 13.1478C15.4552 13.8445 15.1785 14.5125 14.6859 15.0051L15.7925 16.1118C16.5786 15.3257 17.0202 14.2595 17.0202 13.1478L15.4552 13.1478ZM14.6859 15.0051C13.6601 16.0308 11.9971 16.0308 10.9713 15.0051L9.86469 16.1118C11.5016 17.7487 14.1556 17.7487 15.7925 16.1118L14.6859 15.0051ZM10.9713 15.0051L9.52499 13.5588L8.41834 14.6654L9.86469 16.1118L10.9713 15.0051ZM6.63142 10.6665L5.18507 9.2201L4.07842 10.3268L5.52477 11.7731L6.63142 10.6665ZM5.18507 9.2201C4.69249 8.72752 4.41576 8.05944 4.41576 7.36283H2.85072C2.85072 8.47452 3.29234 9.54067 4.07842 10.3268L5.18507 9.2201ZM4.41576 7.36283C4.41576 6.66622 4.69249 5.99815 5.18507 5.50557L4.07842 4.39892C3.29234 5.185 2.85072 6.25115 2.85072 7.36283H4.41576ZM5.18507 5.50557C6.21081 4.47983 7.87386 4.47983 8.8996 5.50557L10.0062 4.39892C8.36932 2.76199 5.71534 2.76199 4.07842 4.39892L5.18507 5.50557ZM8.8996 5.50557L10.346 6.95192L11.4526 5.84527L10.0062 4.39892L8.8996 5.50557Z",fill:"#4D596C"}),T.createElement("rect",{x:6.36328,y:7.91895,width:1.66667,height:8.33333,rx:.833333,transform:"rotate(-45 6.36328 7.91895)",fill:"#4D596C"})),MX=({onCreateClick:e,onLinkClick:t,haveCreateObjects:n,haveLinkObjects:o})=>y.jsxs(Ne,{gap:2,marginTop:"12px",children:[y.jsx(Ge,{variant:"body2",color:Pe.palette.gray.gray1,children:wH}),y.jsxs(Ne,{gap:"12px",children:[n?y.jsxs(SX,{fullWidth:!0,onClick:e,size:"medium",children:[y.jsx(OX,{}),y.jsx("span",{className:"content__btn",children:D2})]}):null,o?y.jsxs(FX,{fullWidth:!0,color:"tertiary",variant:"outlined",onClick:t,size:"medium",children:[y.jsx(kX,{}),y.jsx("span",{className:"content__btn",children:P2})]}):null]})]}),DX="data:image/svg+xml,%3csvg%20width='20'%20height='21'%20viewBox='0%200%2020%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_4649_80352'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='20'%20height='21'%3e%3crect%20y='0.320312'%20width='20'%20height='20'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_4649_80352)'%3e%3cpath%20d='M9.16797%2014.4873H10.8346V11.154H14.168V9.4873H10.8346V6.15397H9.16797V9.4873H5.83464V11.154H9.16797V14.4873ZM10.0013%2018.654C8.84852%2018.654%207.76519%2018.4352%206.7513%2017.9977C5.73741%2017.5602%204.85547%2016.9665%204.10547%2016.2165C3.35547%2015.4665%202.76172%2014.5845%202.32422%2013.5706C1.88672%2012.5567%201.66797%2011.4734%201.66797%2010.3206C1.66797%209.16786%201.88672%208.08453%202.32422%207.07064C2.76172%206.05675%203.35547%205.1748%204.10547%204.4248C4.85547%203.6748%205.73741%203.08105%206.7513%202.64355C7.76519%202.20605%208.84852%201.9873%2010.0013%201.9873C11.1541%201.9873%2012.2374%202.20605%2013.2513%202.64355C14.2652%203.08105%2015.1471%203.6748%2015.8971%204.4248C16.6471%205.1748%2017.2409%206.05675%2017.6784%207.07064C18.1159%208.08453%2018.3346%209.16786%2018.3346%2010.3206C18.3346%2011.4734%2018.1159%2012.5567%2017.6784%2013.5706C17.2409%2014.5845%2016.6471%2015.4665%2015.8971%2016.2165C15.1471%2016.9665%2014.2652%2017.5602%2013.2513%2017.9977C12.2374%2018.4352%2011.1541%2018.654%2010.0013%2018.654ZM10.0013%2016.9873C11.8624%2016.9873%2013.4388%2016.3415%2014.7305%2015.0498C16.0221%2013.7581%2016.668%2012.1817%2016.668%2010.3206C16.668%208.45953%2016.0221%206.88314%2014.7305%205.59147C13.4388%204.2998%2011.8624%203.65397%2010.0013%203.65397C8.14019%203.65397%206.5638%204.2998%205.27214%205.59147C3.98047%206.88314%203.33464%208.45953%203.33464%2010.3206C3.33464%2012.1817%203.98047%2013.7581%205.27214%2015.0498C6.5638%2016.3415%208.14019%2016.9873%2010.0013%2016.9873Z'%20fill='%234D596C'/%3e%3c/g%3e%3c/svg%3e",PX="data:image/svg+xml,%3csvg%20width='20'%20height='21'%20viewBox='0%200%2020%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14.3462%208.73757C14.0406%208.43198%2013.5451%208.43198%2013.2395%208.73757C12.9339%209.04316%2012.9339%209.53863%2013.2395%209.84422L14.3462%208.73757ZM15.2392%2010.7372L15.7925%2010.1839L15.2392%2010.7372ZM16.2377%2013.1478L15.4552%2013.1478L16.2377%2013.1478ZM15.2392%2015.5584L14.6859%2015.0051L15.2392%2015.5584ZM10.418%2015.5584L9.86469%2016.1118L10.418%2015.5584ZM9.52499%2013.5588C9.2194%2013.2532%208.72393%2013.2532%208.41834%2013.5588C8.11275%2013.8643%208.11275%2014.3598%208.41834%2014.6654L9.52499%2013.5588ZM5.52477%2011.7731C5.83036%2012.0787%206.32583%2012.0787%206.63142%2011.7731C6.93701%2011.4675%206.93701%2010.972%206.63142%2010.6665L5.52477%2011.7731ZM9.45292%204.95224L10.0062%204.39892L9.45292%204.95224ZM10.346%206.95192C10.6515%207.25752%2011.147%207.25752%2011.4526%206.95192C11.7582%206.64633%2011.7582%206.15087%2011.4526%205.84527L10.346%206.95192ZM13.2395%209.84422L14.6859%2011.2906L15.7925%2010.1839L14.3462%208.73757L13.2395%209.84422ZM14.6859%2011.2906C15.1785%2011.7832%2015.4552%2012.4512%2015.4552%2013.1478L17.0202%2013.1478C17.0202%2012.0362%2016.5786%2010.97%2015.7925%2010.1839L14.6859%2011.2906ZM15.4552%2013.1478C15.4552%2013.8445%2015.1785%2014.5125%2014.6859%2015.0051L15.7925%2016.1118C16.5786%2015.3257%2017.0202%2014.2595%2017.0202%2013.1478L15.4552%2013.1478ZM14.6859%2015.0051C13.6601%2016.0308%2011.9971%2016.0308%2010.9713%2015.0051L9.86469%2016.1118C11.5016%2017.7487%2014.1556%2017.7487%2015.7925%2016.1118L14.6859%2015.0051ZM10.9713%2015.0051L9.52499%2013.5588L8.41834%2014.6654L9.86469%2016.1118L10.9713%2015.0051ZM6.63142%2010.6665L5.18507%209.2201L4.07842%2010.3268L5.52477%2011.7731L6.63142%2010.6665ZM5.18507%209.2201C4.69249%208.72752%204.41576%208.05944%204.41576%207.36283H2.85072C2.85072%208.47452%203.29234%209.54067%204.07842%2010.3268L5.18507%209.2201ZM4.41576%207.36283C4.41576%206.66622%204.69249%205.99815%205.18507%205.50557L4.07842%204.39892C3.29234%205.185%202.85072%206.25115%202.85072%207.36283H4.41576ZM5.18507%205.50557C6.21081%204.47983%207.87386%204.47983%208.8996%205.50557L10.0062%204.39892C8.36932%202.76199%205.71534%202.76199%204.07842%204.39892L5.18507%205.50557ZM8.8996%205.50557L10.346%206.95192L11.4526%205.84527L10.0062%204.39892L8.8996%205.50557Z'%20fill='%234D596C'/%3e%3crect%20x='6.36328'%20y='7.91895'%20width='1.66667'%20height='8.33333'%20rx='0.833333'%20transform='rotate(-45%206.36328%207.91895)'%20fill='%234D596C'/%3e%3c/svg%3e",RX=e=>T.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},T.createElement("path",{d:"M12.3333 0.333008H1.66659C0.933252 0.333008 0.339919 0.933008 0.339919 1.66634L0.333252 13.6663L2.99992 10.9997H12.3333C13.0666 10.9997 13.6666 10.3997 13.6666 9.66634V1.66634C13.6666 0.933008 13.0666 0.333008 12.3333 0.333008ZM12.3333 9.66634H2.44659L2.05325 10.0597L1.66659 10.4463V1.66634H12.3333V9.66634ZM6.33325 6.99967H7.66659V8.33301H6.33325V6.99967ZM6.33325 2.99967H7.66659V5.66634H6.33325V2.99967Z",fill:"#6F7C90"})),LX=({isAdmin:e=!1})=>{const{email:t,currentSmIds:n,sendTrackingEvent:o,availableFeatures:r,conversationId:i}=b.useContext(eo),a=ci(),{userGroupId:A}=li()||{},[l,c]=b.useState(!1),[u,p]=b.useState(!1),[g,B]=b.useState(!1),[C,f]=b.useState(),[d,E]=b.useState(!1),m=Tt(tW),h=Tt(nW),Q=Tt(rW),I=Tt(iW),v=Tt(oW),w=Tt(am),x=Tt(Am),F=Tt(lm),O=Tt(cm),M=br(r,BN),P=br(r,T2),D=br(r,wN),k=b.useCallback(()=>{t&&n.length&&i&&a(Nc({inboxIds:n,conversationId:i}))},[a,t,n,i]),N=b.useCallback((ee,X)=>{ee&&i&&X&&a(Lc({id:ee,channelType:"email",conversationId:i,externalResourceId:X,contactEmail:t})).unwrap().catch(()=>{a(bs(null))})},[a,i,t]);if(b.useEffect(()=>{var ee;if(F){c(!0);const{externalResourceId:X}=F,J=(ee=F.forms.find(_=>_.type==="edit"))==null?void 0:ee.id;N(J,X)}else c(!1),a(ZH())},[F,N,a]),b.useEffect(()=>(k(),()=>{a(im.clearConnectorList())}),[a,k]),b.useEffect(()=>{m&&m.length&&o(KN,{numOfCards:m.length})},[m,o,n]),b.useEffect(()=>{i&&n&&n.length&&a(Oc({inboxIds:n,conversationId:i,channelType:"email"}))},[a,n,i]),!t.length||v===Se.LOADING)return y.jsx(EX,{});const L=()=>{p(!0),o($N)},z=()=>{B(!0),o(eU)},H=ee=>{o(ee,C),O?E(!0):p(!1)},$=ee=>{if(F){const{connectorName:X,title:J}=F;o(ee,{connector_name:X,card_title:J,sm_ids:n,ug_id:A})}O?E(!0):a(bs(null))},R=()=>{p(!1),a(bs(null)),f(void 0),E(!1)},W=()=>{k(),a(im.clearConnectorList())},G=[{label:"Go back",variant:"text",action:R},{label:"Stay",variant:"contained",action:()=>E(!1)}],Y=w.length>0,K=x.length>0,q=()=>Y||K?y.jsx(MX,{haveCreateObjects:Y,haveLinkObjects:K,onCreateClick:()=>p(!0),onLinkClick:()=>B(!0)}):y.jsx(CQ,{isAdmin:e,hideHeading:!0});return y.jsxs(eB,{"data-testid":Array.isArray(m)?"connector-agent":"loading",id:"connector-agent-container",stopOverflow:u||g,children:[y.jsx(QQ,{shown:d,setShown:E,title:FH,description:SH,buttons:G}),y.jsx(_U,{children:h?y.jsxs(y.Fragment,{children:[y.jsxs(Ne,{direction:"row",justifyContent:"space-between",marginBottom:"12px",height:"36px",children:[y.jsxs(Ne,{direction:"row",alignItems:"center",children:[y.jsx(q2,{}),y.jsx($2,{variant:"h2",children:TN})]}),y.jsx(Ne,{direction:"row",gap:"4px",children:P&&(m!=null&&m.length)?y.jsxs(y.Fragment,{children:[Y?y.jsx(Yt,{title:D2,placement:"bottom",children:y.jsx(nn,{onClick:L,children:y.jsx("img",{src:DX,alt:"Add",height:"20px"})})}):null,K?y.jsx(Yt,{title:P2,placement:"bottom",children:y.jsx(nn,{onClick:z,children:y.jsx("img",{src:PX,alt:"Link Task",height:"20px"})})}):null]}):null})]}),M?y.jsx(IX,{}):null,m!=null&&m.length?y.jsxs(Ne,{flexGrow:1,children:[y.jsx(MW,{cards:m,specificCardData:Q,email:t??"",specificConnectorApiStatus:I,onCardUnlinking:k}),D?y.jsx(Qj,{children:y.jsxs(zt,{size:"small",variant:"text",href:IN,target:"_blank",children:[y.jsx(RX,{}),hN]})}):null]}):null,!(m!=null&&m.length)&&P?q():null]}):y.jsx(CQ,{isAdmin:e})}),y.jsx(_f,{onClose:()=>$(gU),isOpen:l,setIsOpen:c,title:RN,portalId:"connector-layover-portal",backButtonTooltip:"Back",children:y.jsx(vQ,{isEdit:!0,onClose:()=>$(dU),onCreateSuccess:W,metaData:C,setMetaData:f})}),y.jsx(_f,{onClose:()=>H(sU),portalId:"connector-layover-portal",isOpen:u,setIsOpen:p,children:y.jsx(vQ,{onClose:()=>H(iU),onCreateSuccess:W,metaData:C,setMetaData:f})}),y.jsx(_f,{onClose:()=>B(!1),portalId:"connector-layover-portal",isOpen:g,setIsOpen:B,children:y.jsx(xX,{setOpenTaskLinking:B,onLinkingSuccess:k})}),!h&&y.jsx(TU,{})]})},NX=({children:e,sendTrackingEvent:t,contactEmail:n,baseUrls:o={},currentSmIds:r=[],metaData:i,availableFeatures:a,conversationId:A,connectorFunctions:l,isAdmin:c=!1})=>{const u=b.useMemo(()=>({email:n,baseUrls:o,currentSmIds:r,metaData:i,conversationId:A,sendTrackingEvent:t||(()=>{}),availableFeatures:a,isAdmin:c,connectorFunctions:l}),[n,o,t,r,i,a,A,c,l]);return y.jsx(eo.Provider,{value:u,children:e})};var eu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},tu=typeof window>"u"||"Deno"in globalThis;function po(){}function UX(e,t){return typeof e=="function"?e(t):e}function jX(e){return typeof e=="number"&&e>=0&&e!==1/0}function VX(e,t){return Math.max(e+(t||0)-Date.now(),0)}function yQ(e,t){return typeof e=="function"?e(t):e}function HX(e,t){return typeof e=="function"?e(t):e}function bQ(e,t){const{type:n="all",exact:o,fetchStatus:r,predicate:i,queryKey:a,stale:A}=e;if(a){if(o){if(t.queryHash!==Zf(a,t.options))return!1}else if(!dA(t.queryKey,a))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof A=="boolean"&&t.isStale()!==A||r&&r!==t.state.fetchStatus||i&&!i(t))}function wQ(e,t){const{exact:n,status:o,predicate:r,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(uA(t.options.mutationKey)!==uA(i))return!1}else if(!dA(t.options.mutationKey,i))return!1}return!(o&&t.state.status!==o||r&&!r(t))}function Zf(e,t){return((t==null?void 0:t.queryKeyHashFn)||uA)(e)}function uA(e){return JSON.stringify(e,(t,n)=>qf(n)?Object.keys(n).sort().reduce((o,r)=>(o[r]=n[r],o),{}):n)}function dA(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!dA(e[n],t[n])):!1}function Jf(e,t){if(e===t)return e;const n=xQ(e)&&xQ(t);if(n||qf(e)&&qf(t)){const o=n?e:Object.keys(e),r=o.length,i=n?t:Object.keys(t),a=i.length,A=n?[]:{};let l=0;for(let c=0;c<a;c++){const u=n?c:i[c];(!n&&o.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(A[u]=void 0,l++):(A[u]=Jf(e[u],t[u]),A[u]===e[u]&&e[u]!==void 0&&l++)}return r===a&&l===r?e:A}return t}function xQ(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function qf(e){if(!TQ(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!TQ(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function TQ(e){return Object.prototype.toString.call(e)==="[object Object]"}function WX(e){return new Promise(t=>{setTimeout(t,e)})}function zX(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Jf(e,t)}catch(o){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${o}`)}return Jf(e,t)}return t}function YX(e,t,n=0){const o=[...e,t];return n&&o.length>n?o.slice(1):o}function GX(e,t,n=0){const o=[t,...e];return n&&o.length>n?o.slice(0,-1):o}var nu=Symbol();function FQ(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===nu&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===nu?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var XX=(LQ=class extends eu{constructor(){super();rt(this,Bi);rt(this,Fr);rt(this,Ts);Ve(this,Ts,t=>{if(!tu&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){oe(this,Fr)||this.setEventListener(oe(this,Ts))}onUnsubscribe(){var t;this.hasListeners()||((t=oe(this,Fr))==null||t.call(this),Ve(this,Fr,void 0))}setEventListener(t){var n;Ve(this,Ts,t),(n=oe(this,Fr))==null||n.call(this),Ve(this,Fr,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus()}))}setFocused(t){oe(this,Bi)!==t&&(Ve(this,Bi,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof oe(this,Bi)=="boolean"?oe(this,Bi):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Bi=new WeakMap,Fr=new WeakMap,Ts=new WeakMap,LQ),SQ=new XX,KX=(NQ=class extends eu{constructor(){super();rt(this,Fs,!0);rt(this,Sr);rt(this,Ss);Ve(this,Ss,t=>{if(!tu&&window.addEventListener){const n=()=>t(!0),o=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",o,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",o)}}})}onSubscribe(){oe(this,Sr)||this.setEventListener(oe(this,Ss))}onUnsubscribe(){var t;this.hasListeners()||((t=oe(this,Sr))==null||t.call(this),Ve(this,Sr,void 0))}setEventListener(t){var n;Ve(this,Ss,t),(n=oe(this,Sr))==null||n.call(this),Ve(this,Sr,t(this.setOnline.bind(this)))}setOnline(t){oe(this,Fs)!==t&&(Ve(this,Fs,t),this.listeners.forEach(o=>{o(t)}))}isOnline(){return oe(this,Fs)}},Fs=new WeakMap,Sr=new WeakMap,Ss=new WeakMap,NQ),ou=new KX;function _X(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});n.status="pending",n.catch(()=>{});function o(r){Object.assign(n,r),delete n.resolve,delete n.reject}return n.resolve=r=>{o({status:"fulfilled",value:r}),e(r)},n.reject=r=>{o({status:"rejected",reason:r}),t(r)},n}function ZX(e){return Math.min(1e3*2**e,3e4)}function OQ(e){return(e??"online")==="online"?ou.isOnline():!0}var kQ=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function $f(e){return e instanceof kQ}function MQ(e){let t=!1,n=0,o=!1,r;const i=_X(),a=f=>{var d;o||(g(new kQ(f)),(d=e.abort)==null||d.call(e))},A=()=>{t=!0},l=()=>{t=!1},c=()=>SQ.isFocused()&&(e.networkMode==="always"||ou.isOnline())&&e.canRun(),u=()=>OQ(e.networkMode)&&e.canRun(),p=f=>{var d;o||(o=!0,(d=e.onSuccess)==null||d.call(e,f),r==null||r(),i.resolve(f))},g=f=>{var d;o||(o=!0,(d=e.onError)==null||d.call(e,f),r==null||r(),i.reject(f))},B=()=>new Promise(f=>{var d;r=E=>{(o||c())&&f(E)},(d=e.onPause)==null||d.call(e)}).then(()=>{var f;r=void 0,o||(f=e.onContinue)==null||f.call(e)}),C=()=>{if(o)return;let f;const d=n===0?e.initialPromise:void 0;try{f=d??e.fn()}catch(E){f=Promise.reject(E)}Promise.resolve(f).then(p).catch(E=>{var v;if(o)return;const m=e.retry??(tu?0:3),h=e.retryDelay??ZX,Q=typeof h=="function"?h(n,E):h,I=m===!0||typeof m=="number"&&n<m||typeof m=="function"&&m(n,E);if(t||!I){g(E);return}n++,(v=e.onFail)==null||v.call(e,n,E),WX(Q).then(()=>c()?void 0:B()).then(()=>{t?g(E):C()})})};return{promise:i,cancel:a,continue:()=>(r==null||r(),i),cancelRetry:A,continueRetry:l,canStart:u,start:()=>(u()?C():B().then(C),i)}}function JX(){let e=[],t=0,n=A=>{A()},o=A=>{A()},r=A=>setTimeout(A,0);const i=A=>{t?e.push(A):r(()=>{n(A)})},a=()=>{const A=e;e=[],A.length&&r(()=>{o(()=>{A.forEach(l=>{n(l)})})})};return{batch:A=>{let l;t++;try{l=A()}finally{t--,t||a()}return l},batchCalls:A=>(...l)=>{i(()=>{A(...l)})},schedule:i,setNotifyFunction:A=>{n=A},setBatchNotifyFunction:A=>{o=A},setScheduler:A=>{r=A}}}var pn=JX(),DQ=(UQ=class{constructor(){rt(this,mi)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),jX(this.gcTime)&&Ve(this,mi,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(tu?1/0:5*60*1e3))}clearGcTimeout(){oe(this,mi)&&(clearTimeout(oe(this,mi)),Ve(this,mi,void 0))}},mi=new WeakMap,UQ),qX=(jQ=class extends DQ{constructor(t){super();rt(this,Co);rt(this,Os);rt(this,ks);rt(this,to);rt(this,Qi);rt(this,An);rt(this,gA);rt(this,vi);Ve(this,vi,!1),Ve(this,gA,t.defaultOptions),this.setOptions(t.options),this.observers=[],Ve(this,Qi,t.client),Ve(this,to,oe(this,Qi).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Ve(this,Os,eK(this.options)),this.state=t.state??oe(this,Os),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=oe(this,An))==null?void 0:t.promise}setOptions(t){this.options={...oe(this,gA),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&oe(this,to).remove(this)}setData(t,n){const o=zX(this.state.data,t,this.options);return ln(this,Co,Ar).call(this,{data:o,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),o}setState(t,n){ln(this,Co,Ar).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var o,r;const n=(o=oe(this,An))==null?void 0:o.promise;return(r=oe(this,An))==null||r.cancel(t),n?n.then(po).catch(po):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(oe(this,Os))}isActive(){return this.observers.some(t=>HX(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===nu||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!VX(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(o=>o.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=oe(this,An))==null||n.continue()}onOnline(){var n;const t=this.observers.find(o=>o.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=oe(this,An))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),oe(this,to).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(oe(this,An)&&(oe(this,vi)?oe(this,An).cancel({revert:!0}):oe(this,An).cancelRetry()),this.scheduleGc()),oe(this,to).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ln(this,Co,Ar).call(this,{type:"invalidate"})}fetch(t,n){var l,c,u;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(oe(this,An))return oe(this,An).continueRetry(),oe(this,An).promise}if(t&&this.setOptions(t),!this.options.queryFn){const p=this.observers.find(g=>g.options.queryFn);p&&this.setOptions(p.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const o=new AbortController,r=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(Ve(this,vi,!0),o.signal)})},i=()=>{const p=FQ(this.options,n),g={client:oe(this,Qi),queryKey:this.queryKey,meta:this.meta};return r(g),Ve(this,vi,!1),this.options.persister?this.options.persister(p,g,this):p(g)},a={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:oe(this,Qi),state:this.state,fetchFn:i};r(a),(l=this.options.behavior)==null||l.onFetch(a,this),Ve(this,ks,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=a.fetchOptions)==null?void 0:c.meta))&&ln(this,Co,Ar).call(this,{type:"fetch",meta:(u=a.fetchOptions)==null?void 0:u.meta});const A=p=>{var g,B,C,f;$f(p)&&p.silent||ln(this,Co,Ar).call(this,{type:"error",error:p}),$f(p)||((B=(g=oe(this,to).config).onError)==null||B.call(g,p,this),(f=(C=oe(this,to).config).onSettled)==null||f.call(C,this.state.data,p,this)),this.scheduleGc()};return Ve(this,An,MQ({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:o.abort.bind(o),onSuccess:p=>{var g,B,C,f;if(p===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),A(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(p)}catch(d){A(d);return}(B=(g=oe(this,to).config).onSuccess)==null||B.call(g,p,this),(f=(C=oe(this,to).config).onSettled)==null||f.call(C,p,this.state.error,this),this.scheduleGc()},onError:A,onFail:(p,g)=>{ln(this,Co,Ar).call(this,{type:"failed",failureCount:p,error:g})},onPause:()=>{ln(this,Co,Ar).call(this,{type:"pause"})},onContinue:()=>{ln(this,Co,Ar).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),oe(this,An).start()}},Os=new WeakMap,ks=new WeakMap,to=new WeakMap,Qi=new WeakMap,An=new WeakMap,gA=new WeakMap,vi=new WeakMap,Co=new WeakSet,Ar=function(t){const n=o=>{switch(t.type){case"failed":return{...o,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...o,fetchStatus:"paused"};case"continue":return{...o,fetchStatus:"fetching"};case"fetch":return{...o,...$X(o.data,this.options),fetchMeta:t.meta??null};case"success":return{...o,data:t.data,dataUpdateCount:o.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const r=t.error;return $f(r)&&r.revert&&oe(this,ks)?{...oe(this,ks),fetchStatus:"idle"}:{...o,error:r,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...o,isInvalidated:!0};case"setState":return{...o,...t.state}}};this.state=n(this.state),pn.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate()}),oe(this,to).notify({query:this,type:"updated",action:t})})},jQ);function $X(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:OQ(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function eK(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,o=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var tK=(VQ=class extends eu{constructor(t={}){super();rt(this,Ro);this.config=t,Ve(this,Ro,new Map)}build(t,n,o){const r=n.queryKey,i=n.queryHash??Zf(r,n);let a=this.get(i);return a||(a=new qX({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(n),state:o,defaultOptions:t.getQueryDefaults(r)}),this.add(a)),a}add(t){oe(this,Ro).has(t.queryHash)||(oe(this,Ro).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=oe(this,Ro).get(t.queryHash);n&&(t.destroy(),n===t&&oe(this,Ro).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){pn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return oe(this,Ro).get(t)}getAll(){return[...oe(this,Ro).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(o=>bQ(n,o))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(o=>bQ(t,o)):n}notify(t){pn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){pn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){pn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ro=new WeakMap,VQ),nK=(HQ=class extends DQ{constructor(t){super();rt(this,No);rt(this,Lo);rt(this,Cn);rt(this,yi);this.mutationId=t.mutationId,Ve(this,Cn,t.mutationCache),Ve(this,Lo,[]),this.state=t.state||oK(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){oe(this,Lo).includes(t)||(oe(this,Lo).push(t),this.clearGcTimeout(),oe(this,Cn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Ve(this,Lo,oe(this,Lo).filter(n=>n!==t)),this.scheduleGc(),oe(this,Cn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){oe(this,Lo).length||(this.state.status==="pending"?this.scheduleGc():oe(this,Cn).remove(this))}continue(){var t;return((t=oe(this,yi))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var r,i,a,A,l,c,u,p,g,B,C,f,d,E,m,h,Q,I,v,w;Ve(this,yi,MQ({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(x,F)=>{ln(this,No,Pr).call(this,{type:"failed",failureCount:x,error:F})},onPause:()=>{ln(this,No,Pr).call(this,{type:"pause"})},onContinue:()=>{ln(this,No,Pr).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>oe(this,Cn).canRun(this)}));const n=this.state.status==="pending",o=!oe(this,yi).canStart();try{if(!n){ln(this,No,Pr).call(this,{type:"pending",variables:t,isPaused:o}),await((i=(r=oe(this,Cn).config).onMutate)==null?void 0:i.call(r,t,this));const F=await((A=(a=this.options).onMutate)==null?void 0:A.call(a,t));F!==this.state.context&&ln(this,No,Pr).call(this,{type:"pending",context:F,variables:t,isPaused:o})}const x=await oe(this,yi).start();return await((c=(l=oe(this,Cn).config).onSuccess)==null?void 0:c.call(l,x,t,this.state.context,this)),await((p=(u=this.options).onSuccess)==null?void 0:p.call(u,x,t,this.state.context)),await((B=(g=oe(this,Cn).config).onSettled)==null?void 0:B.call(g,x,null,this.state.variables,this.state.context,this)),await((f=(C=this.options).onSettled)==null?void 0:f.call(C,x,null,t,this.state.context)),ln(this,No,Pr).call(this,{type:"success",data:x}),x}catch(x){try{throw await((E=(d=oe(this,Cn).config).onError)==null?void 0:E.call(d,x,t,this.state.context,this)),await((h=(m=this.options).onError)==null?void 0:h.call(m,x,t,this.state.context)),await((I=(Q=oe(this,Cn).config).onSettled)==null?void 0:I.call(Q,void 0,x,this.state.variables,this.state.context,this)),await((w=(v=this.options).onSettled)==null?void 0:w.call(v,void 0,x,t,this.state.context)),x}finally{ln(this,No,Pr).call(this,{type:"error",error:x})}}finally{oe(this,Cn).runNext(this)}}},Lo=new WeakMap,Cn=new WeakMap,yi=new WeakMap,No=new WeakSet,Pr=function(t){const n=o=>{switch(t.type){case"failed":return{...o,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...o,isPaused:!0};case"continue":return{...o,isPaused:!1};case"pending":return{...o,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...o,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...o,data:void 0,error:t.error,failureCount:o.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),pn.batch(()=>{oe(this,Lo).forEach(o=>{o.onMutationUpdate(t)}),oe(this,Cn).notify({mutation:this,type:"updated",action:t})})},HQ);function oK(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var rK=(WQ=class extends eu{constructor(t={}){super();rt(this,ar);rt(this,Eo);rt(this,fA);this.config=t,Ve(this,ar,new Set),Ve(this,Eo,new Map),Ve(this,fA,0)}build(t,n,o){const r=new nK({mutationCache:this,mutationId:++lu(this,fA)._,options:t.defaultMutationOptions(n),state:o});return this.add(r),r}add(t){oe(this,ar).add(t);const n=ru(t);if(typeof n=="string"){const o=oe(this,Eo).get(n);o?o.push(t):oe(this,Eo).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(oe(this,ar).delete(t)){const n=ru(t);if(typeof n=="string"){const o=oe(this,Eo).get(n);if(o)if(o.length>1){const r=o.indexOf(t);r!==-1&&o.splice(r,1)}else o[0]===t&&oe(this,Eo).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=ru(t);if(typeof n=="string"){const o=oe(this,Eo).get(n),r=o==null?void 0:o.find(i=>i.state.status==="pending");return!r||r===t}else return!0}runNext(t){var o;const n=ru(t);if(typeof n=="string"){const r=(o=oe(this,Eo).get(n))==null?void 0:o.find(i=>i!==t&&i.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}else return Promise.resolve()}clear(){pn.batch(()=>{oe(this,ar).forEach(t=>{this.notify({type:"removed",mutation:t})}),oe(this,ar).clear(),oe(this,Eo).clear()})}getAll(){return Array.from(oe(this,ar))}find(t){const n={exact:!0,...t};return this.getAll().find(o=>wQ(n,o))}findAll(t={}){return this.getAll().filter(n=>wQ(t,n))}notify(t){pn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return pn.batch(()=>Promise.all(t.map(n=>n.continue().catch(po))))}},ar=new WeakMap,Eo=new WeakMap,fA=new WeakMap,WQ);function ru(e){var t;return(t=e.options.scope)==null?void 0:t.id}function PQ(e){return{onFetch:(t,n)=>{var u,p,g,B,C;const o=t.options,r=(g=(p=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:p.fetchMore)==null?void 0:g.direction,i=((B=t.state.data)==null?void 0:B.pages)||[],a=((C=t.state.data)==null?void 0:C.pageParams)||[];let A={pages:[],pageParams:[]},l=0;const c=async()=>{let f=!1;const d=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(t.signal.aborted?f=!0:t.signal.addEventListener("abort",()=>{f=!0}),t.signal)})},E=FQ(t.options,t.fetchOptions),m=async(h,Q,I)=>{if(f)return Promise.reject();if(Q==null&&h.pages.length)return Promise.resolve(h);const v={client:t.client,queryKey:t.queryKey,pageParam:Q,direction:I?"backward":"forward",meta:t.options.meta};d(v);const w=await E(v),{maxPages:x}=t.options,F=I?GX:YX;return{pages:F(h.pages,w,x),pageParams:F(h.pageParams,Q,x)}};if(r&&i.length){const h=r==="backward",Q=h?iK:RQ,I={pages:i,pageParams:a},v=Q(o,I);A=await m(I,v,h)}else{const h=e??i.length;do{const Q=l===0?a[0]??o.initialPageParam:RQ(o,A);if(l>0&&Q==null)break;A=await m(A,Q),l++}while(l<h)}return A};t.options.persister?t.fetchFn=()=>{var f,d;return(d=(f=t.options).persister)==null?void 0:d.call(f,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function RQ(e,{pages:t,pageParams:n}){const o=t.length-1;return t.length>0?e.getNextPageParam(t[o],t,n[o],n):void 0}function iK(e,{pages:t,pageParams:n}){var o;return t.length>0?(o=e.getPreviousPageParam)==null?void 0:o.call(e,t[0],t,n[0],n):void 0}var sK=(zQ=class{constructor(e={}){rt(this,Ut);rt(this,Or);rt(this,kr);rt(this,Ms);rt(this,Ds);rt(this,Mr);rt(this,Ps);rt(this,Rs);Ve(this,Ut,e.queryCache||new tK),Ve(this,Or,e.mutationCache||new rK),Ve(this,kr,e.defaultOptions||{}),Ve(this,Ms,new Map),Ve(this,Ds,new Map),Ve(this,Mr,0)}mount(){lu(this,Mr)._++,oe(this,Mr)===1&&(Ve(this,Ps,SQ.subscribe(async e=>{e&&(await this.resumePausedMutations(),oe(this,Ut).onFocus())})),Ve(this,Rs,ou.subscribe(async e=>{e&&(await this.resumePausedMutations(),oe(this,Ut).onOnline())})))}unmount(){var e,t;lu(this,Mr)._--,oe(this,Mr)===0&&((e=oe(this,Ps))==null||e.call(this),Ve(this,Ps,void 0),(t=oe(this,Rs))==null||t.call(this),Ve(this,Rs,void 0))}isFetching(e){return oe(this,Ut).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return oe(this,Or).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=oe(this,Ut).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=oe(this,Ut).build(this,t),o=n.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(yQ(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return oe(this,Ut).findAll(e).map(({queryKey:t,state:n})=>{const o=n.data;return[t,o]})}setQueryData(e,t,n){const o=this.defaultQueryOptions({queryKey:e}),r=oe(this,Ut).get(o.queryHash),i=r==null?void 0:r.state.data,a=UX(t,i);if(a!==void 0)return oe(this,Ut).build(this,o).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return pn.batch(()=>oe(this,Ut).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=oe(this,Ut).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=oe(this,Ut);pn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=oe(this,Ut);return pn.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},o=pn.batch(()=>oe(this,Ut).findAll(e).map(r=>r.cancel(n)));return Promise.all(o).then(po).catch(po)}invalidateQueries(e,t={}){return pn.batch(()=>(oe(this,Ut).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},o=pn.batch(()=>oe(this,Ut).findAll(e).filter(r=>!r.isDisabled()).map(r=>{let i=r.fetch(void 0,n);return n.throwOnError||(i=i.catch(po)),r.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(o).then(po)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=oe(this,Ut).build(this,t);return n.isStaleByTime(yQ(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(po).catch(po)}fetchInfiniteQuery(e){return e.behavior=PQ(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(po).catch(po)}ensureInfiniteQueryData(e){return e.behavior=PQ(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ou.isOnline()?oe(this,Or).resumePausedMutations():Promise.resolve()}getQueryCache(){return oe(this,Ut)}getMutationCache(){return oe(this,Or)}getDefaultOptions(){return oe(this,kr)}setDefaultOptions(e){Ve(this,kr,e)}setQueryDefaults(e,t){oe(this,Ms).set(uA(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...oe(this,Ms).values()],n={};return t.forEach(o=>{dA(e,o.queryKey)&&Object.assign(n,o.defaultOptions)}),n}setMutationDefaults(e,t){oe(this,Ds).set(uA(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...oe(this,Ds).values()],n={};return t.forEach(o=>{dA(e,o.mutationKey)&&Object.assign(n,o.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...oe(this,kr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Zf(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===nu&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...oe(this,kr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){oe(this,Ut).clear(),oe(this,Or).clear()}},Ut=new WeakMap,Or=new WeakMap,kr=new WeakMap,Ms=new WeakMap,Ds=new WeakMap,Mr=new WeakMap,Ps=new WeakMap,Rs=new WeakMap,zQ),aK=T.createContext(void 0),AK=({client:e,children:t})=>(T.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),y.jsx(aK.Provider,{value:e,children:t}));const lK=({children:e})=>{const t=new sK;return y.jsx(AK,{client:t,children:e})},cK=AB({cardList:pW,write:JH}),uK=QV({reducer:cK,devTools:!0}),dK=({children:e,extraParams:t,contactEmail:n,baseUrls:o,availableFeatures:r,connectorFunctions:i})=>y.jsx(YU,{store:uK,children:y.jsx(YP,{custom:!0,children:y.jsx(lK,{children:y.jsx(NX,{availableFeatures:r,sendTrackingEvent:t==null?void 0:t.sendTrackingEvent,contactEmail:n,currentSmIds:t==null?void 0:t.currentSmIds,metaData:t==null?void 0:t.metaData,conversationId:t==null?void 0:t.conversationId,baseUrls:o,connectorFunctions:i,isAdmin:t==null?void 0:t.isAdmin,children:y.jsx(b.Suspense,{fallback:y.jsx(y.Fragment,{}),children:e})})})})}),gK=V(pt)`
|
|
2788
|
+
`,OX=e=>T.createElement("svg",{width:20,height:21,viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},T.createElement("mask",{id:"mask0_4649_80352",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:0,y:0,width:20,height:21},T.createElement("rect",{y:.320312,width:20,height:20,fill:"#D9D9D9"})),T.createElement("g",{mask:"url(#mask0_4649_80352)"},T.createElement("path",{d:"M9.16797 14.4873H10.8346V11.154H14.168V9.4873H10.8346V6.15397H9.16797V9.4873H5.83464V11.154H9.16797V14.4873ZM10.0013 18.654C8.84852 18.654 7.76519 18.4352 6.7513 17.9977C5.73741 17.5602 4.85547 16.9665 4.10547 16.2165C3.35547 15.4665 2.76172 14.5845 2.32422 13.5706C1.88672 12.5567 1.66797 11.4734 1.66797 10.3206C1.66797 9.16786 1.88672 8.08453 2.32422 7.07064C2.76172 6.05675 3.35547 5.1748 4.10547 4.4248C4.85547 3.6748 5.73741 3.08105 6.7513 2.64355C7.76519 2.20605 8.84852 1.9873 10.0013 1.9873C11.1541 1.9873 12.2374 2.20605 13.2513 2.64355C14.2652 3.08105 15.1471 3.6748 15.8971 4.4248C16.6471 5.1748 17.2409 6.05675 17.6784 7.07064C18.1159 8.08453 18.3346 9.16786 18.3346 10.3206C18.3346 11.4734 18.1159 12.5567 17.6784 13.5706C17.2409 14.5845 16.6471 15.4665 15.8971 16.2165C15.1471 16.9665 14.2652 17.5602 13.2513 17.9977C12.2374 18.4352 11.1541 18.654 10.0013 18.654ZM10.0013 16.9873C11.8624 16.9873 13.4388 16.3415 14.7305 15.0498C16.0221 13.7581 16.668 12.1817 16.668 10.3206C16.668 8.45953 16.0221 6.88314 14.7305 5.59147C13.4388 4.2998 11.8624 3.65397 10.0013 3.65397C8.14019 3.65397 6.5638 4.2998 5.27214 5.59147C3.98047 6.88314 3.33464 8.45953 3.33464 10.3206C3.33464 12.1817 3.98047 13.7581 5.27214 15.0498C6.5638 16.3415 8.14019 16.9873 10.0013 16.9873Z",fill:"#4D596C"}))),kX=e=>T.createElement("svg",{width:20,height:21,viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},T.createElement("path",{d:"M14.3462 8.73757C14.0406 8.43198 13.5451 8.43198 13.2395 8.73757C12.9339 9.04316 12.9339 9.53863 13.2395 9.84422L14.3462 8.73757ZM15.2392 10.7372L15.7925 10.1839L15.2392 10.7372ZM16.2377 13.1478L15.4552 13.1478L16.2377 13.1478ZM15.2392 15.5584L14.6859 15.0051L15.2392 15.5584ZM10.418 15.5584L9.86469 16.1118L10.418 15.5584ZM9.52499 13.5588C9.2194 13.2532 8.72393 13.2532 8.41834 13.5588C8.11275 13.8643 8.11275 14.3598 8.41834 14.6654L9.52499 13.5588ZM5.52477 11.7731C5.83036 12.0787 6.32583 12.0787 6.63142 11.7731C6.93701 11.4675 6.93701 10.972 6.63142 10.6665L5.52477 11.7731ZM9.45292 4.95224L10.0062 4.39892L9.45292 4.95224ZM10.346 6.95192C10.6515 7.25752 11.147 7.25752 11.4526 6.95192C11.7582 6.64633 11.7582 6.15087 11.4526 5.84527L10.346 6.95192ZM13.2395 9.84422L14.6859 11.2906L15.7925 10.1839L14.3462 8.73757L13.2395 9.84422ZM14.6859 11.2906C15.1785 11.7832 15.4552 12.4512 15.4552 13.1478L17.0202 13.1478C17.0202 12.0362 16.5786 10.97 15.7925 10.1839L14.6859 11.2906ZM15.4552 13.1478C15.4552 13.8445 15.1785 14.5125 14.6859 15.0051L15.7925 16.1118C16.5786 15.3257 17.0202 14.2595 17.0202 13.1478L15.4552 13.1478ZM14.6859 15.0051C13.6601 16.0308 11.9971 16.0308 10.9713 15.0051L9.86469 16.1118C11.5016 17.7487 14.1556 17.7487 15.7925 16.1118L14.6859 15.0051ZM10.9713 15.0051L9.52499 13.5588L8.41834 14.6654L9.86469 16.1118L10.9713 15.0051ZM6.63142 10.6665L5.18507 9.2201L4.07842 10.3268L5.52477 11.7731L6.63142 10.6665ZM5.18507 9.2201C4.69249 8.72752 4.41576 8.05944 4.41576 7.36283H2.85072C2.85072 8.47452 3.29234 9.54067 4.07842 10.3268L5.18507 9.2201ZM4.41576 7.36283C4.41576 6.66622 4.69249 5.99815 5.18507 5.50557L4.07842 4.39892C3.29234 5.185 2.85072 6.25115 2.85072 7.36283H4.41576ZM5.18507 5.50557C6.21081 4.47983 7.87386 4.47983 8.8996 5.50557L10.0062 4.39892C8.36932 2.76199 5.71534 2.76199 4.07842 4.39892L5.18507 5.50557ZM8.8996 5.50557L10.346 6.95192L11.4526 5.84527L10.0062 4.39892L8.8996 5.50557Z",fill:"#4D596C"}),T.createElement("rect",{x:6.36328,y:7.91895,width:1.66667,height:8.33333,rx:.833333,transform:"rotate(-45 6.36328 7.91895)",fill:"#4D596C"})),MX=({onCreateClick:e,onLinkClick:t,haveCreateObjects:n,haveLinkObjects:o})=>y.jsxs(Ne,{gap:2,marginTop:"12px",children:[y.jsx(Ge,{variant:"body2",color:Pe.palette.gray.gray1,children:wH}),y.jsxs(Ne,{gap:"12px",children:[n?y.jsxs(SX,{fullWidth:!0,onClick:e,size:"medium",children:[y.jsx(OX,{}),y.jsx("span",{className:"content__btn",children:D2})]}):null,o?y.jsxs(FX,{fullWidth:!0,color:"tertiary",variant:"outlined",onClick:t,size:"medium",children:[y.jsx(kX,{}),y.jsx("span",{className:"content__btn",children:P2})]}):null]})]}),DX="data:image/svg+xml,%3csvg%20width='20'%20height='21'%20viewBox='0%200%2020%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_4649_80352'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='20'%20height='21'%3e%3crect%20y='0.320312'%20width='20'%20height='20'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_4649_80352)'%3e%3cpath%20d='M9.16797%2014.4873H10.8346V11.154H14.168V9.4873H10.8346V6.15397H9.16797V9.4873H5.83464V11.154H9.16797V14.4873ZM10.0013%2018.654C8.84852%2018.654%207.76519%2018.4352%206.7513%2017.9977C5.73741%2017.5602%204.85547%2016.9665%204.10547%2016.2165C3.35547%2015.4665%202.76172%2014.5845%202.32422%2013.5706C1.88672%2012.5567%201.66797%2011.4734%201.66797%2010.3206C1.66797%209.16786%201.88672%208.08453%202.32422%207.07064C2.76172%206.05675%203.35547%205.1748%204.10547%204.4248C4.85547%203.6748%205.73741%203.08105%206.7513%202.64355C7.76519%202.20605%208.84852%201.9873%2010.0013%201.9873C11.1541%201.9873%2012.2374%202.20605%2013.2513%202.64355C14.2652%203.08105%2015.1471%203.6748%2015.8971%204.4248C16.6471%205.1748%2017.2409%206.05675%2017.6784%207.07064C18.1159%208.08453%2018.3346%209.16786%2018.3346%2010.3206C18.3346%2011.4734%2018.1159%2012.5567%2017.6784%2013.5706C17.2409%2014.5845%2016.6471%2015.4665%2015.8971%2016.2165C15.1471%2016.9665%2014.2652%2017.5602%2013.2513%2017.9977C12.2374%2018.4352%2011.1541%2018.654%2010.0013%2018.654ZM10.0013%2016.9873C11.8624%2016.9873%2013.4388%2016.3415%2014.7305%2015.0498C16.0221%2013.7581%2016.668%2012.1817%2016.668%2010.3206C16.668%208.45953%2016.0221%206.88314%2014.7305%205.59147C13.4388%204.2998%2011.8624%203.65397%2010.0013%203.65397C8.14019%203.65397%206.5638%204.2998%205.27214%205.59147C3.98047%206.88314%203.33464%208.45953%203.33464%2010.3206C3.33464%2012.1817%203.98047%2013.7581%205.27214%2015.0498C6.5638%2016.3415%208.14019%2016.9873%2010.0013%2016.9873Z'%20fill='%234D596C'/%3e%3c/g%3e%3c/svg%3e",PX="data:image/svg+xml,%3csvg%20width='20'%20height='21'%20viewBox='0%200%2020%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14.3462%208.73757C14.0406%208.43198%2013.5451%208.43198%2013.2395%208.73757C12.9339%209.04316%2012.9339%209.53863%2013.2395%209.84422L14.3462%208.73757ZM15.2392%2010.7372L15.7925%2010.1839L15.2392%2010.7372ZM16.2377%2013.1478L15.4552%2013.1478L16.2377%2013.1478ZM15.2392%2015.5584L14.6859%2015.0051L15.2392%2015.5584ZM10.418%2015.5584L9.86469%2016.1118L10.418%2015.5584ZM9.52499%2013.5588C9.2194%2013.2532%208.72393%2013.2532%208.41834%2013.5588C8.11275%2013.8643%208.11275%2014.3598%208.41834%2014.6654L9.52499%2013.5588ZM5.52477%2011.7731C5.83036%2012.0787%206.32583%2012.0787%206.63142%2011.7731C6.93701%2011.4675%206.93701%2010.972%206.63142%2010.6665L5.52477%2011.7731ZM9.45292%204.95224L10.0062%204.39892L9.45292%204.95224ZM10.346%206.95192C10.6515%207.25752%2011.147%207.25752%2011.4526%206.95192C11.7582%206.64633%2011.7582%206.15087%2011.4526%205.84527L10.346%206.95192ZM13.2395%209.84422L14.6859%2011.2906L15.7925%2010.1839L14.3462%208.73757L13.2395%209.84422ZM14.6859%2011.2906C15.1785%2011.7832%2015.4552%2012.4512%2015.4552%2013.1478L17.0202%2013.1478C17.0202%2012.0362%2016.5786%2010.97%2015.7925%2010.1839L14.6859%2011.2906ZM15.4552%2013.1478C15.4552%2013.8445%2015.1785%2014.5125%2014.6859%2015.0051L15.7925%2016.1118C16.5786%2015.3257%2017.0202%2014.2595%2017.0202%2013.1478L15.4552%2013.1478ZM14.6859%2015.0051C13.6601%2016.0308%2011.9971%2016.0308%2010.9713%2015.0051L9.86469%2016.1118C11.5016%2017.7487%2014.1556%2017.7487%2015.7925%2016.1118L14.6859%2015.0051ZM10.9713%2015.0051L9.52499%2013.5588L8.41834%2014.6654L9.86469%2016.1118L10.9713%2015.0051ZM6.63142%2010.6665L5.18507%209.2201L4.07842%2010.3268L5.52477%2011.7731L6.63142%2010.6665ZM5.18507%209.2201C4.69249%208.72752%204.41576%208.05944%204.41576%207.36283H2.85072C2.85072%208.47452%203.29234%209.54067%204.07842%2010.3268L5.18507%209.2201ZM4.41576%207.36283C4.41576%206.66622%204.69249%205.99815%205.18507%205.50557L4.07842%204.39892C3.29234%205.185%202.85072%206.25115%202.85072%207.36283H4.41576ZM5.18507%205.50557C6.21081%204.47983%207.87386%204.47983%208.8996%205.50557L10.0062%204.39892C8.36932%202.76199%205.71534%202.76199%204.07842%204.39892L5.18507%205.50557ZM8.8996%205.50557L10.346%206.95192L11.4526%205.84527L10.0062%204.39892L8.8996%205.50557Z'%20fill='%234D596C'/%3e%3crect%20x='6.36328'%20y='7.91895'%20width='1.66667'%20height='8.33333'%20rx='0.833333'%20transform='rotate(-45%206.36328%207.91895)'%20fill='%234D596C'/%3e%3c/svg%3e",RX=e=>T.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},T.createElement("path",{d:"M12.3333 0.333008H1.66659C0.933252 0.333008 0.339919 0.933008 0.339919 1.66634L0.333252 13.6663L2.99992 10.9997H12.3333C13.0666 10.9997 13.6666 10.3997 13.6666 9.66634V1.66634C13.6666 0.933008 13.0666 0.333008 12.3333 0.333008ZM12.3333 9.66634H2.44659L2.05325 10.0597L1.66659 10.4463V1.66634H12.3333V9.66634ZM6.33325 6.99967H7.66659V8.33301H6.33325V6.99967ZM6.33325 2.99967H7.66659V5.66634H6.33325V2.99967Z",fill:"#6F7C90"})),LX=({isAdmin:e=!1})=>{const{email:t,currentSmIds:n,sendTrackingEvent:o,availableFeatures:r,conversationId:i}=b.useContext(eo),a=ci(),{userGroupId:A}=li()||{},[l,c]=b.useState(!1),[u,p]=b.useState(!1),[g,B]=b.useState(!1),[C,f]=b.useState(),[d,E]=b.useState(!1),m=Tt(tW),h=Tt(nW),Q=Tt(rW),I=Tt(iW),v=Tt(oW),w=Tt(am),x=Tt(Am),F=Tt(lm),O=Tt(cm),M=br(r,BN),P=br(r,T2),D=br(r,wN),k=b.useCallback(()=>{t&&n.length&&i&&a(Nc({inboxIds:n,conversationId:i}))},[a,t,n,i]),N=b.useCallback((ee,X)=>{ee&&i&&X&&a(Lc({id:ee,channelType:"email",conversationId:i,externalResourceId:X,contactEmail:t})).unwrap().catch(()=>{a(bs(null))})},[a,i,t]);if(b.useEffect(()=>{var ee;if(F){c(!0);const{externalResourceId:X}=F,J=(ee=F.forms.find(_=>_.type==="edit"))==null?void 0:ee.id;N(J,X)}else c(!1),a(ZH())},[F,N,a]),b.useEffect(()=>(k(),()=>{a(im.clearConnectorList())}),[a,k]),b.useEffect(()=>{m&&m.length&&o(KN,{numOfCards:m.length,sm_ids:n})},[m,o,n]),b.useEffect(()=>{i&&n&&n.length&&a(Oc({inboxIds:n,conversationId:i,channelType:"email"}))},[a,n,i]),!t.length||v===Se.LOADING)return y.jsx(EX,{});const L=()=>{p(!0),o($N)},z=()=>{B(!0),o(eU)},H=ee=>{o(ee,C),O?E(!0):p(!1)},$=ee=>{if(F){const{connectorName:X,title:J}=F;o(ee,{connector_name:X,card_title:J,sm_ids:n,ug_id:A})}O?E(!0):a(bs(null))},R=()=>{p(!1),a(bs(null)),f(void 0),E(!1)},W=()=>{k(),a(im.clearConnectorList())},G=[{label:"Go back",variant:"text",action:R},{label:"Stay",variant:"contained",action:()=>E(!1)}],Y=w.length>0,K=x.length>0,q=()=>Y||K?y.jsx(MX,{haveCreateObjects:Y,haveLinkObjects:K,onCreateClick:()=>p(!0),onLinkClick:()=>B(!0)}):y.jsx(CQ,{isAdmin:e,hideHeading:!0});return y.jsxs(eB,{"data-testid":Array.isArray(m)?"connector-agent":"loading",id:"connector-agent-container",stopOverflow:u||g,children:[y.jsx(QQ,{shown:d,setShown:E,title:FH,description:SH,buttons:G}),y.jsx(_U,{children:h?y.jsxs(y.Fragment,{children:[y.jsxs(Ne,{direction:"row",justifyContent:"space-between",marginBottom:"12px",height:"36px",children:[y.jsxs(Ne,{direction:"row",alignItems:"center",children:[y.jsx(q2,{}),y.jsx($2,{variant:"h2",children:TN})]}),y.jsx(Ne,{direction:"row",gap:"4px",children:P&&(m!=null&&m.length)?y.jsxs(y.Fragment,{children:[Y?y.jsx(Yt,{title:D2,placement:"bottom",children:y.jsx(nn,{onClick:L,children:y.jsx("img",{src:DX,alt:"Add",height:"20px"})})}):null,K?y.jsx(Yt,{title:P2,placement:"bottom",children:y.jsx(nn,{onClick:z,children:y.jsx("img",{src:PX,alt:"Link Task",height:"20px"})})}):null]}):null})]}),M?y.jsx(IX,{}):null,m!=null&&m.length?y.jsxs(Ne,{flexGrow:1,children:[y.jsx(MW,{cards:m,specificCardData:Q,email:t??"",specificConnectorApiStatus:I,onCardUnlinking:k}),D?y.jsx(Qj,{children:y.jsxs(zt,{size:"small",variant:"text",href:IN,target:"_blank",children:[y.jsx(RX,{}),hN]})}):null]}):null,!(m!=null&&m.length)&&P?q():null]}):y.jsx(CQ,{isAdmin:e})}),y.jsx(_f,{onClose:()=>$(gU),isOpen:l,setIsOpen:c,title:RN,portalId:"connector-layover-portal",backButtonTooltip:"Back",children:y.jsx(vQ,{isEdit:!0,onClose:()=>$(dU),onCreateSuccess:W,metaData:C,setMetaData:f})}),y.jsx(_f,{onClose:()=>H(sU),portalId:"connector-layover-portal",isOpen:u,setIsOpen:p,children:y.jsx(vQ,{onClose:()=>H(iU),onCreateSuccess:W,metaData:C,setMetaData:f})}),y.jsx(_f,{onClose:()=>B(!1),portalId:"connector-layover-portal",isOpen:g,setIsOpen:B,children:y.jsx(xX,{setOpenTaskLinking:B,onLinkingSuccess:k})}),!h&&y.jsx(TU,{})]})},NX=({children:e,sendTrackingEvent:t,contactEmail:n,baseUrls:o={},currentSmIds:r=[],metaData:i,availableFeatures:a,conversationId:A,connectorFunctions:l,isAdmin:c=!1})=>{const u=b.useMemo(()=>({email:n,baseUrls:o,currentSmIds:r,metaData:i,conversationId:A,sendTrackingEvent:t||(()=>{}),availableFeatures:a,isAdmin:c,connectorFunctions:l}),[n,o,t,r,i,a,A,c,l]);return y.jsx(eo.Provider,{value:u,children:e})};var eu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},tu=typeof window>"u"||"Deno"in globalThis;function po(){}function UX(e,t){return typeof e=="function"?e(t):e}function jX(e){return typeof e=="number"&&e>=0&&e!==1/0}function VX(e,t){return Math.max(e+(t||0)-Date.now(),0)}function yQ(e,t){return typeof e=="function"?e(t):e}function HX(e,t){return typeof e=="function"?e(t):e}function bQ(e,t){const{type:n="all",exact:o,fetchStatus:r,predicate:i,queryKey:a,stale:A}=e;if(a){if(o){if(t.queryHash!==Zf(a,t.options))return!1}else if(!dA(t.queryKey,a))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof A=="boolean"&&t.isStale()!==A||r&&r!==t.state.fetchStatus||i&&!i(t))}function wQ(e,t){const{exact:n,status:o,predicate:r,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(uA(t.options.mutationKey)!==uA(i))return!1}else if(!dA(t.options.mutationKey,i))return!1}return!(o&&t.state.status!==o||r&&!r(t))}function Zf(e,t){return((t==null?void 0:t.queryKeyHashFn)||uA)(e)}function uA(e){return JSON.stringify(e,(t,n)=>qf(n)?Object.keys(n).sort().reduce((o,r)=>(o[r]=n[r],o),{}):n)}function dA(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!dA(e[n],t[n])):!1}function Jf(e,t){if(e===t)return e;const n=xQ(e)&&xQ(t);if(n||qf(e)&&qf(t)){const o=n?e:Object.keys(e),r=o.length,i=n?t:Object.keys(t),a=i.length,A=n?[]:{};let l=0;for(let c=0;c<a;c++){const u=n?c:i[c];(!n&&o.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(A[u]=void 0,l++):(A[u]=Jf(e[u],t[u]),A[u]===e[u]&&e[u]!==void 0&&l++)}return r===a&&l===r?e:A}return t}function xQ(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function qf(e){if(!TQ(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!TQ(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function TQ(e){return Object.prototype.toString.call(e)==="[object Object]"}function WX(e){return new Promise(t=>{setTimeout(t,e)})}function zX(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Jf(e,t)}catch(o){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${o}`)}return Jf(e,t)}return t}function YX(e,t,n=0){const o=[...e,t];return n&&o.length>n?o.slice(1):o}function GX(e,t,n=0){const o=[t,...e];return n&&o.length>n?o.slice(0,-1):o}var nu=Symbol();function FQ(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===nu&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===nu?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var XX=(LQ=class extends eu{constructor(){super();rt(this,Bi);rt(this,Fr);rt(this,Ts);Ve(this,Ts,t=>{if(!tu&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){oe(this,Fr)||this.setEventListener(oe(this,Ts))}onUnsubscribe(){var t;this.hasListeners()||((t=oe(this,Fr))==null||t.call(this),Ve(this,Fr,void 0))}setEventListener(t){var n;Ve(this,Ts,t),(n=oe(this,Fr))==null||n.call(this),Ve(this,Fr,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus()}))}setFocused(t){oe(this,Bi)!==t&&(Ve(this,Bi,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof oe(this,Bi)=="boolean"?oe(this,Bi):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Bi=new WeakMap,Fr=new WeakMap,Ts=new WeakMap,LQ),SQ=new XX,KX=(NQ=class extends eu{constructor(){super();rt(this,Fs,!0);rt(this,Sr);rt(this,Ss);Ve(this,Ss,t=>{if(!tu&&window.addEventListener){const n=()=>t(!0),o=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",o,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",o)}}})}onSubscribe(){oe(this,Sr)||this.setEventListener(oe(this,Ss))}onUnsubscribe(){var t;this.hasListeners()||((t=oe(this,Sr))==null||t.call(this),Ve(this,Sr,void 0))}setEventListener(t){var n;Ve(this,Ss,t),(n=oe(this,Sr))==null||n.call(this),Ve(this,Sr,t(this.setOnline.bind(this)))}setOnline(t){oe(this,Fs)!==t&&(Ve(this,Fs,t),this.listeners.forEach(o=>{o(t)}))}isOnline(){return oe(this,Fs)}},Fs=new WeakMap,Sr=new WeakMap,Ss=new WeakMap,NQ),ou=new KX;function _X(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});n.status="pending",n.catch(()=>{});function o(r){Object.assign(n,r),delete n.resolve,delete n.reject}return n.resolve=r=>{o({status:"fulfilled",value:r}),e(r)},n.reject=r=>{o({status:"rejected",reason:r}),t(r)},n}function ZX(e){return Math.min(1e3*2**e,3e4)}function OQ(e){return(e??"online")==="online"?ou.isOnline():!0}var kQ=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function $f(e){return e instanceof kQ}function MQ(e){let t=!1,n=0,o=!1,r;const i=_X(),a=f=>{var d;o||(g(new kQ(f)),(d=e.abort)==null||d.call(e))},A=()=>{t=!0},l=()=>{t=!1},c=()=>SQ.isFocused()&&(e.networkMode==="always"||ou.isOnline())&&e.canRun(),u=()=>OQ(e.networkMode)&&e.canRun(),p=f=>{var d;o||(o=!0,(d=e.onSuccess)==null||d.call(e,f),r==null||r(),i.resolve(f))},g=f=>{var d;o||(o=!0,(d=e.onError)==null||d.call(e,f),r==null||r(),i.reject(f))},B=()=>new Promise(f=>{var d;r=E=>{(o||c())&&f(E)},(d=e.onPause)==null||d.call(e)}).then(()=>{var f;r=void 0,o||(f=e.onContinue)==null||f.call(e)}),C=()=>{if(o)return;let f;const d=n===0?e.initialPromise:void 0;try{f=d??e.fn()}catch(E){f=Promise.reject(E)}Promise.resolve(f).then(p).catch(E=>{var v;if(o)return;const m=e.retry??(tu?0:3),h=e.retryDelay??ZX,Q=typeof h=="function"?h(n,E):h,I=m===!0||typeof m=="number"&&n<m||typeof m=="function"&&m(n,E);if(t||!I){g(E);return}n++,(v=e.onFail)==null||v.call(e,n,E),WX(Q).then(()=>c()?void 0:B()).then(()=>{t?g(E):C()})})};return{promise:i,cancel:a,continue:()=>(r==null||r(),i),cancelRetry:A,continueRetry:l,canStart:u,start:()=>(u()?C():B().then(C),i)}}function JX(){let e=[],t=0,n=A=>{A()},o=A=>{A()},r=A=>setTimeout(A,0);const i=A=>{t?e.push(A):r(()=>{n(A)})},a=()=>{const A=e;e=[],A.length&&r(()=>{o(()=>{A.forEach(l=>{n(l)})})})};return{batch:A=>{let l;t++;try{l=A()}finally{t--,t||a()}return l},batchCalls:A=>(...l)=>{i(()=>{A(...l)})},schedule:i,setNotifyFunction:A=>{n=A},setBatchNotifyFunction:A=>{o=A},setScheduler:A=>{r=A}}}var pn=JX(),DQ=(UQ=class{constructor(){rt(this,mi)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),jX(this.gcTime)&&Ve(this,mi,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(tu?1/0:5*60*1e3))}clearGcTimeout(){oe(this,mi)&&(clearTimeout(oe(this,mi)),Ve(this,mi,void 0))}},mi=new WeakMap,UQ),qX=(jQ=class extends DQ{constructor(t){super();rt(this,Co);rt(this,Os);rt(this,ks);rt(this,to);rt(this,Qi);rt(this,An);rt(this,gA);rt(this,vi);Ve(this,vi,!1),Ve(this,gA,t.defaultOptions),this.setOptions(t.options),this.observers=[],Ve(this,Qi,t.client),Ve(this,to,oe(this,Qi).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Ve(this,Os,eK(this.options)),this.state=t.state??oe(this,Os),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=oe(this,An))==null?void 0:t.promise}setOptions(t){this.options={...oe(this,gA),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&oe(this,to).remove(this)}setData(t,n){const o=zX(this.state.data,t,this.options);return ln(this,Co,Ar).call(this,{data:o,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),o}setState(t,n){ln(this,Co,Ar).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var o,r;const n=(o=oe(this,An))==null?void 0:o.promise;return(r=oe(this,An))==null||r.cancel(t),n?n.then(po).catch(po):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(oe(this,Os))}isActive(){return this.observers.some(t=>HX(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===nu||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!VX(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(o=>o.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=oe(this,An))==null||n.continue()}onOnline(){var n;const t=this.observers.find(o=>o.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=oe(this,An))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),oe(this,to).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(oe(this,An)&&(oe(this,vi)?oe(this,An).cancel({revert:!0}):oe(this,An).cancelRetry()),this.scheduleGc()),oe(this,to).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ln(this,Co,Ar).call(this,{type:"invalidate"})}fetch(t,n){var l,c,u;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(oe(this,An))return oe(this,An).continueRetry(),oe(this,An).promise}if(t&&this.setOptions(t),!this.options.queryFn){const p=this.observers.find(g=>g.options.queryFn);p&&this.setOptions(p.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const o=new AbortController,r=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(Ve(this,vi,!0),o.signal)})},i=()=>{const p=FQ(this.options,n),g={client:oe(this,Qi),queryKey:this.queryKey,meta:this.meta};return r(g),Ve(this,vi,!1),this.options.persister?this.options.persister(p,g,this):p(g)},a={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:oe(this,Qi),state:this.state,fetchFn:i};r(a),(l=this.options.behavior)==null||l.onFetch(a,this),Ve(this,ks,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=a.fetchOptions)==null?void 0:c.meta))&&ln(this,Co,Ar).call(this,{type:"fetch",meta:(u=a.fetchOptions)==null?void 0:u.meta});const A=p=>{var g,B,C,f;$f(p)&&p.silent||ln(this,Co,Ar).call(this,{type:"error",error:p}),$f(p)||((B=(g=oe(this,to).config).onError)==null||B.call(g,p,this),(f=(C=oe(this,to).config).onSettled)==null||f.call(C,this.state.data,p,this)),this.scheduleGc()};return Ve(this,An,MQ({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:o.abort.bind(o),onSuccess:p=>{var g,B,C,f;if(p===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),A(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(p)}catch(d){A(d);return}(B=(g=oe(this,to).config).onSuccess)==null||B.call(g,p,this),(f=(C=oe(this,to).config).onSettled)==null||f.call(C,p,this.state.error,this),this.scheduleGc()},onError:A,onFail:(p,g)=>{ln(this,Co,Ar).call(this,{type:"failed",failureCount:p,error:g})},onPause:()=>{ln(this,Co,Ar).call(this,{type:"pause"})},onContinue:()=>{ln(this,Co,Ar).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),oe(this,An).start()}},Os=new WeakMap,ks=new WeakMap,to=new WeakMap,Qi=new WeakMap,An=new WeakMap,gA=new WeakMap,vi=new WeakMap,Co=new WeakSet,Ar=function(t){const n=o=>{switch(t.type){case"failed":return{...o,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...o,fetchStatus:"paused"};case"continue":return{...o,fetchStatus:"fetching"};case"fetch":return{...o,...$X(o.data,this.options),fetchMeta:t.meta??null};case"success":return{...o,data:t.data,dataUpdateCount:o.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const r=t.error;return $f(r)&&r.revert&&oe(this,ks)?{...oe(this,ks),fetchStatus:"idle"}:{...o,error:r,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...o,isInvalidated:!0};case"setState":return{...o,...t.state}}};this.state=n(this.state),pn.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate()}),oe(this,to).notify({query:this,type:"updated",action:t})})},jQ);function $X(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:OQ(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function eK(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,o=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var tK=(VQ=class extends eu{constructor(t={}){super();rt(this,Ro);this.config=t,Ve(this,Ro,new Map)}build(t,n,o){const r=n.queryKey,i=n.queryHash??Zf(r,n);let a=this.get(i);return a||(a=new qX({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(n),state:o,defaultOptions:t.getQueryDefaults(r)}),this.add(a)),a}add(t){oe(this,Ro).has(t.queryHash)||(oe(this,Ro).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=oe(this,Ro).get(t.queryHash);n&&(t.destroy(),n===t&&oe(this,Ro).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){pn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return oe(this,Ro).get(t)}getAll(){return[...oe(this,Ro).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(o=>bQ(n,o))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(o=>bQ(t,o)):n}notify(t){pn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){pn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){pn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ro=new WeakMap,VQ),nK=(HQ=class extends DQ{constructor(t){super();rt(this,No);rt(this,Lo);rt(this,Cn);rt(this,yi);this.mutationId=t.mutationId,Ve(this,Cn,t.mutationCache),Ve(this,Lo,[]),this.state=t.state||oK(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){oe(this,Lo).includes(t)||(oe(this,Lo).push(t),this.clearGcTimeout(),oe(this,Cn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Ve(this,Lo,oe(this,Lo).filter(n=>n!==t)),this.scheduleGc(),oe(this,Cn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){oe(this,Lo).length||(this.state.status==="pending"?this.scheduleGc():oe(this,Cn).remove(this))}continue(){var t;return((t=oe(this,yi))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var r,i,a,A,l,c,u,p,g,B,C,f,d,E,m,h,Q,I,v,w;Ve(this,yi,MQ({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(x,F)=>{ln(this,No,Pr).call(this,{type:"failed",failureCount:x,error:F})},onPause:()=>{ln(this,No,Pr).call(this,{type:"pause"})},onContinue:()=>{ln(this,No,Pr).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>oe(this,Cn).canRun(this)}));const n=this.state.status==="pending",o=!oe(this,yi).canStart();try{if(!n){ln(this,No,Pr).call(this,{type:"pending",variables:t,isPaused:o}),await((i=(r=oe(this,Cn).config).onMutate)==null?void 0:i.call(r,t,this));const F=await((A=(a=this.options).onMutate)==null?void 0:A.call(a,t));F!==this.state.context&&ln(this,No,Pr).call(this,{type:"pending",context:F,variables:t,isPaused:o})}const x=await oe(this,yi).start();return await((c=(l=oe(this,Cn).config).onSuccess)==null?void 0:c.call(l,x,t,this.state.context,this)),await((p=(u=this.options).onSuccess)==null?void 0:p.call(u,x,t,this.state.context)),await((B=(g=oe(this,Cn).config).onSettled)==null?void 0:B.call(g,x,null,this.state.variables,this.state.context,this)),await((f=(C=this.options).onSettled)==null?void 0:f.call(C,x,null,t,this.state.context)),ln(this,No,Pr).call(this,{type:"success",data:x}),x}catch(x){try{throw await((E=(d=oe(this,Cn).config).onError)==null?void 0:E.call(d,x,t,this.state.context,this)),await((h=(m=this.options).onError)==null?void 0:h.call(m,x,t,this.state.context)),await((I=(Q=oe(this,Cn).config).onSettled)==null?void 0:I.call(Q,void 0,x,this.state.variables,this.state.context,this)),await((w=(v=this.options).onSettled)==null?void 0:w.call(v,void 0,x,t,this.state.context)),x}finally{ln(this,No,Pr).call(this,{type:"error",error:x})}}finally{oe(this,Cn).runNext(this)}}},Lo=new WeakMap,Cn=new WeakMap,yi=new WeakMap,No=new WeakSet,Pr=function(t){const n=o=>{switch(t.type){case"failed":return{...o,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...o,isPaused:!0};case"continue":return{...o,isPaused:!1};case"pending":return{...o,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...o,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...o,data:void 0,error:t.error,failureCount:o.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),pn.batch(()=>{oe(this,Lo).forEach(o=>{o.onMutationUpdate(t)}),oe(this,Cn).notify({mutation:this,type:"updated",action:t})})},HQ);function oK(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var rK=(WQ=class extends eu{constructor(t={}){super();rt(this,ar);rt(this,Eo);rt(this,fA);this.config=t,Ve(this,ar,new Set),Ve(this,Eo,new Map),Ve(this,fA,0)}build(t,n,o){const r=new nK({mutationCache:this,mutationId:++lu(this,fA)._,options:t.defaultMutationOptions(n),state:o});return this.add(r),r}add(t){oe(this,ar).add(t);const n=ru(t);if(typeof n=="string"){const o=oe(this,Eo).get(n);o?o.push(t):oe(this,Eo).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(oe(this,ar).delete(t)){const n=ru(t);if(typeof n=="string"){const o=oe(this,Eo).get(n);if(o)if(o.length>1){const r=o.indexOf(t);r!==-1&&o.splice(r,1)}else o[0]===t&&oe(this,Eo).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=ru(t);if(typeof n=="string"){const o=oe(this,Eo).get(n),r=o==null?void 0:o.find(i=>i.state.status==="pending");return!r||r===t}else return!0}runNext(t){var o;const n=ru(t);if(typeof n=="string"){const r=(o=oe(this,Eo).get(n))==null?void 0:o.find(i=>i!==t&&i.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}else return Promise.resolve()}clear(){pn.batch(()=>{oe(this,ar).forEach(t=>{this.notify({type:"removed",mutation:t})}),oe(this,ar).clear(),oe(this,Eo).clear()})}getAll(){return Array.from(oe(this,ar))}find(t){const n={exact:!0,...t};return this.getAll().find(o=>wQ(n,o))}findAll(t={}){return this.getAll().filter(n=>wQ(t,n))}notify(t){pn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return pn.batch(()=>Promise.all(t.map(n=>n.continue().catch(po))))}},ar=new WeakMap,Eo=new WeakMap,fA=new WeakMap,WQ);function ru(e){var t;return(t=e.options.scope)==null?void 0:t.id}function PQ(e){return{onFetch:(t,n)=>{var u,p,g,B,C;const o=t.options,r=(g=(p=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:p.fetchMore)==null?void 0:g.direction,i=((B=t.state.data)==null?void 0:B.pages)||[],a=((C=t.state.data)==null?void 0:C.pageParams)||[];let A={pages:[],pageParams:[]},l=0;const c=async()=>{let f=!1;const d=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(t.signal.aborted?f=!0:t.signal.addEventListener("abort",()=>{f=!0}),t.signal)})},E=FQ(t.options,t.fetchOptions),m=async(h,Q,I)=>{if(f)return Promise.reject();if(Q==null&&h.pages.length)return Promise.resolve(h);const v={client:t.client,queryKey:t.queryKey,pageParam:Q,direction:I?"backward":"forward",meta:t.options.meta};d(v);const w=await E(v),{maxPages:x}=t.options,F=I?GX:YX;return{pages:F(h.pages,w,x),pageParams:F(h.pageParams,Q,x)}};if(r&&i.length){const h=r==="backward",Q=h?iK:RQ,I={pages:i,pageParams:a},v=Q(o,I);A=await m(I,v,h)}else{const h=e??i.length;do{const Q=l===0?a[0]??o.initialPageParam:RQ(o,A);if(l>0&&Q==null)break;A=await m(A,Q),l++}while(l<h)}return A};t.options.persister?t.fetchFn=()=>{var f,d;return(d=(f=t.options).persister)==null?void 0:d.call(f,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function RQ(e,{pages:t,pageParams:n}){const o=t.length-1;return t.length>0?e.getNextPageParam(t[o],t,n[o],n):void 0}function iK(e,{pages:t,pageParams:n}){var o;return t.length>0?(o=e.getPreviousPageParam)==null?void 0:o.call(e,t[0],t,n[0],n):void 0}var sK=(zQ=class{constructor(e={}){rt(this,Ut);rt(this,Or);rt(this,kr);rt(this,Ms);rt(this,Ds);rt(this,Mr);rt(this,Ps);rt(this,Rs);Ve(this,Ut,e.queryCache||new tK),Ve(this,Or,e.mutationCache||new rK),Ve(this,kr,e.defaultOptions||{}),Ve(this,Ms,new Map),Ve(this,Ds,new Map),Ve(this,Mr,0)}mount(){lu(this,Mr)._++,oe(this,Mr)===1&&(Ve(this,Ps,SQ.subscribe(async e=>{e&&(await this.resumePausedMutations(),oe(this,Ut).onFocus())})),Ve(this,Rs,ou.subscribe(async e=>{e&&(await this.resumePausedMutations(),oe(this,Ut).onOnline())})))}unmount(){var e,t;lu(this,Mr)._--,oe(this,Mr)===0&&((e=oe(this,Ps))==null||e.call(this),Ve(this,Ps,void 0),(t=oe(this,Rs))==null||t.call(this),Ve(this,Rs,void 0))}isFetching(e){return oe(this,Ut).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return oe(this,Or).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=oe(this,Ut).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=oe(this,Ut).build(this,t),o=n.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(yQ(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return oe(this,Ut).findAll(e).map(({queryKey:t,state:n})=>{const o=n.data;return[t,o]})}setQueryData(e,t,n){const o=this.defaultQueryOptions({queryKey:e}),r=oe(this,Ut).get(o.queryHash),i=r==null?void 0:r.state.data,a=UX(t,i);if(a!==void 0)return oe(this,Ut).build(this,o).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return pn.batch(()=>oe(this,Ut).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=oe(this,Ut).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=oe(this,Ut);pn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=oe(this,Ut);return pn.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},o=pn.batch(()=>oe(this,Ut).findAll(e).map(r=>r.cancel(n)));return Promise.all(o).then(po).catch(po)}invalidateQueries(e,t={}){return pn.batch(()=>(oe(this,Ut).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},o=pn.batch(()=>oe(this,Ut).findAll(e).filter(r=>!r.isDisabled()).map(r=>{let i=r.fetch(void 0,n);return n.throwOnError||(i=i.catch(po)),r.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(o).then(po)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=oe(this,Ut).build(this,t);return n.isStaleByTime(yQ(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(po).catch(po)}fetchInfiniteQuery(e){return e.behavior=PQ(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(po).catch(po)}ensureInfiniteQueryData(e){return e.behavior=PQ(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ou.isOnline()?oe(this,Or).resumePausedMutations():Promise.resolve()}getQueryCache(){return oe(this,Ut)}getMutationCache(){return oe(this,Or)}getDefaultOptions(){return oe(this,kr)}setDefaultOptions(e){Ve(this,kr,e)}setQueryDefaults(e,t){oe(this,Ms).set(uA(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...oe(this,Ms).values()],n={};return t.forEach(o=>{dA(e,o.queryKey)&&Object.assign(n,o.defaultOptions)}),n}setMutationDefaults(e,t){oe(this,Ds).set(uA(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...oe(this,Ds).values()],n={};return t.forEach(o=>{dA(e,o.mutationKey)&&Object.assign(n,o.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...oe(this,kr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Zf(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===nu&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...oe(this,kr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){oe(this,Ut).clear(),oe(this,Or).clear()}},Ut=new WeakMap,Or=new WeakMap,kr=new WeakMap,Ms=new WeakMap,Ds=new WeakMap,Mr=new WeakMap,Ps=new WeakMap,Rs=new WeakMap,zQ),aK=T.createContext(void 0),AK=({client:e,children:t})=>(T.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),y.jsx(aK.Provider,{value:e,children:t}));const lK=({children:e})=>{const t=new sK;return y.jsx(AK,{client:t,children:e})},cK=AB({cardList:pW,write:JH}),uK=QV({reducer:cK,devTools:!0}),dK=({children:e,extraParams:t,contactEmail:n,baseUrls:o,availableFeatures:r,connectorFunctions:i})=>y.jsx(YU,{store:uK,children:y.jsx(YP,{custom:!0,children:y.jsx(lK,{children:y.jsx(NX,{availableFeatures:r,sendTrackingEvent:t==null?void 0:t.sendTrackingEvent,contactEmail:n,currentSmIds:t==null?void 0:t.currentSmIds,metaData:t==null?void 0:t.metaData,conversationId:t==null?void 0:t.conversationId,baseUrls:o,connectorFunctions:i,isAdmin:t==null?void 0:t.isAdmin,children:y.jsx(b.Suspense,{fallback:y.jsx(y.Fragment,{}),children:e})})})})}),gK=V(pt)`
|
|
2789
2789
|
height: inherit;
|
|
2790
2790
|
.MuiScopedCssBaseline-root {
|
|
2791
2791
|
height: inherit;
|