@hiver/connector-agent 1.3.8-beta.8 → 1.3.8-beta.9

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":"style.d.ts","sourceRoot":"","sources":["../../../../../src/features/connector-cards/components/card-list/style.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,eAAe,EACf,SAAS,EACT,aAAa,EACb,UAAU,EACV,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,YAAY,CAIxD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,eAAe,CAO5D,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,eAAe,CAAC,SAAS,GAAG;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,CA0BrF,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,QAAQ,CAIpD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,QAAQ,CAGjD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,QAAQ,CAKjD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,UAAU,CAYnD,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,eAAe,CAAC,UAAU,CAG/C,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,eAAe,CAMxD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAAC,QAAQ,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAW9E,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,eAAe,CAAC,eAAe,CAGt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AC;AAEF,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,QAAQ,CAGrD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,UAAU,CAQtD,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,eAAe,CAAC,QAAQ,CAW7D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,eAAe,CAAC,QAAQ,CAI5D,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,QAAQ,CAMpD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,UAAU,CActD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,WAAW,CAIvD,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,eAAe,CAAC,eAAe,CAGvD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,QAAQ,CAIpD,CAAC"}
@@ -14,7 +14,7 @@ export declare const FUTURE_DISABLED_MSG = "Date cannot be in the future";
14
14
  export declare const INVALID_NUMBER = "Invalid number";
15
15
  export declare const INVALID_TEXT = "Invalid text";
16
16
  export declare const NEW_CARD_CREATED = "New card created";
17
- export declare const CARD_CREATION_FAILED = "Card creation failed!!";
17
+ export declare const CARD_CREATION_FAILED = "Card creation failed";
18
18
  export declare const DEFAULT_AVATAR_URL = "https://avatars.githubusercontent.com/u/62397590";
19
19
  export declare const CREATE_CARD_MESSAGE = "Create and link objects from different apps to this conversation";
20
20
  export declare const OBJECT_CHANGE_CONFIRMATION_TITLE = "Are you sure you want to change the primary object?";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/write-form/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,iCAAiC,CAAC;AACrE,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAChE,eAAO,MAAM,mBAAmB,8BAA8B,CAAC;AAC/D,eAAO,MAAM,eAAe,6BAA6B,CAAC;AAC1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UAAU,0BAA0B,CAAC;AAClD,eAAO,MAAM,aAAa,6BAA6B,CAAC;AACxD,eAAO,MAAM,yBAAyB,iCAAiC,CAAC;AACxE,eAAO,MAAM,6BAA6B,oCAAoC,CAAC;AAC/E,eAAO,MAAM,aAAa,0BAA0B,CAAC;AACrD,eAAO,MAAM,YAAY,2BAA2B,CAAC;AACrD,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAC/C,eAAO,MAAM,iBAAiB,+BAA+B,CAAC;AAC9D,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAClE,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAC/C,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAC3D,eAAO,MAAM,kBAAkB,qDAAqD,CAAC;AACrF,eAAO,MAAM,mBAAmB,qEAAqE,CAAC;AACtG,eAAO,MAAM,gCAAgC,wDAAwD,CAAC;AACtG,eAAO,MAAM,sCAAsC,0IAC4E,CAAC;AAChI,eAAO,MAAM,qBAAqB,oCAAoC,CAAC;AACvE,eAAO,MAAM,2BAA2B,oIAA0H,CAAC;AACnK,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AACvE,eAAO,MAAM,wBAAwB,6BAA6B,CAAC;AACnE,eAAO,MAAM,yBAAyB,kBAAkB,CAAC;AACzD,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AACvD,eAAO,MAAM,eAAe,mBAAmB,CAAC"}
package/index.es.js CHANGED
@@ -34320,7 +34320,6 @@ const hU = j(Et)`
34320
34320
  line-height: 28px;
34321
34321
  font-weight: 600;
34322
34322
  `, RU = j(Et)`
34323
- /* max-width: 255px; */
34324
34323
  border: 1px solid ${se.gray.gray5};
34325
34324
  border-radius: 4px;
34326
34325
  `, DU = j(je)`
@@ -36275,7 +36274,7 @@ const Vi = "success", is = "error", Eh = "Some error occured. Please contact sup
36275
36274
  args: t
36276
36275
  }
36277
36276
  });
36278
- }, Oj = "Error in previewing the card", Sj = "Card linked successfully", Mj = "Error in linking the card", mh = "Please enter a valid URL", Rj = "Please enter valid ID", Dj = "Please enter valid input", Pj = "URL must start with https://", Lj = "URL should not end with a slash", Uj = "Invalid email address", Nj = "Email must be a string", pp = "Invalid date", jj = "Date cannot be in the past", Vj = "Date cannot be in the future", Hj = "Invalid number", Wj = "Invalid text", zj = "New card created", Yj = "Card creation failed!!", Gj = "https://avatars.githubusercontent.com/u/62397590", Xj = "Create and link objects from different apps to this conversation", Kj = "Are you sure you want to change the primary object?", Zj = "Changing the primary object will reset all the information you’ve entered and all data will be lost and can’t be recovered.", Jj = "Are you sure you want to leave?", _j = `If you go back now, all the information you’ve entered will be lost and can’t be recovered.
36277
+ }, Oj = "Error in previewing the card", Sj = "Card linked successfully", Mj = "Error in linking the card", mh = "Please enter a valid URL", Rj = "Please enter valid ID", Dj = "Please enter valid input", Pj = "URL must start with https://", Lj = "URL should not end with a slash", Uj = "Invalid email address", Nj = "Email must be a string", pp = "Invalid date", jj = "Date cannot be in the past", Vj = "Date cannot be in the future", Hj = "Invalid number", Wj = "Invalid text", zj = "New card created", Yj = "Card creation failed", Gj = "https://avatars.githubusercontent.com/u/62397590", Xj = "Create and link objects from different apps to this conversation", Kj = "Are you sure you want to change the primary object?", Zj = "Changing the primary object will reset all the information you’ve entered and all data will be lost and can’t be recovered.", Jj = "Are you sure you want to leave?", _j = `If you go back now, all the information you’ve entered will be lost and can’t be recovered.
36279
36278
  Do you want to continue?`, qj = "Select an object to create", $j = "Select an object to link", Qh = "Select object", eV = "Paste URL or ID", tV = "Object ID/Link", nV = "Required Field", oV = "Invalid date", bh = /^https:\/\/([a-z0-9-]+(\.[a-z0-9-]+)+)(:[0-9]{1,5})?(\/[^\s/]*)*$/i, rV = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, iV = (e, t) => t ? Object.values(t).filter((o) => e.values[o] && !e.errors[o]) : [], Cp = (e, t) => t ? Object.keys(t).reduce(
36280
36279
  (o, r) => {
36281
36280
  let i = "";
package/index.umd.js CHANGED
@@ -2302,7 +2302,6 @@ Selectors that return the entire state are almost certainly a mistake, as they w
2302
2302
  line-height: 28px;
2303
2303
  font-weight: 600;
2304
2304
  `,dU=j(pt)`
2305
- /* max-width: 255px; */
2306
2305
  border: 1px solid ${ae.gray.gray5};
2307
2306
  border-radius: 4px;
2308
2307
  `,gU=j(Le)`
@@ -2386,7 +2385,7 @@ Take a look at the reducer(s) handling this action type: ${h.type}.
2386
2385
  fill: #ffffff;
2387
2386
  width: 10px;
2388
2387
  }
2389
- `,rj=(e,{closeToast:t})=>v.jsx(oj,{children:v.jsx("img",{src:$N,onClick:t})}),Ll=({message:e})=>v.jsxs(ej,{children:[v.jsx(nj,{}),v.jsx(tj,{children:e})]});function no(e){const{message:t,type:n,autoClose:o}=e,r={closeButton:v.jsx(rj,{}),autoClose:o??5e3,pauseOnHover:!0,position:"bottom-left",rtl:!1,draggable:!0,closeOnClick:!0,hideProgressBar:!0};let i;switch(n){case"success":{i=ot.success(v.jsx(Ll,{message:t}),{...r,icon:!1});break}case"error":{i=ot.error(v.jsx(Ll,{message:t}),{...r,icon:!1});break}case"info-dark":{i=ot.info(v.jsx(Ll,{message:t}),{...r,icon:!1,className:"toast_dark"});break}default:{i=ot.info(v.jsx(Ll,{message:t}),{...r,icon:!1});break}}return setTimeout(()=>{ij(i)},o&&!isNaN(o)?Number(o):5e3),i}function ij(e){ot.dismiss(e)}const Hi="success",fa="error",Mh="Some error occured. Please contact support@hiverhq.com",Dh="Card refreshed successfully",sj="Card unlinked successfully",aj="Failed to unlink the card",Ph=Sh({name:"connectorCardLibrary",initialState:WN,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(Ul.pending,t=>{t.connectorApiStatus=Ne.LOADING}).addCase(Ul.fulfilled,(t,n)=>{t.connectorApiStatus=Ne.IDLE,t.connectorCards=n.payload.cards,t.connectorsEnabled=n.payload.connectorsEnabled}).addCase(Ul.rejected,t=>{t.connectorApiStatus=Ne.FAILED}).addCase(pa.pending,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg,i=`${o}_${r}`;t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Ne.LOADING}}).addCase(pa.fulfilled,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg,i=`${o}_${r}`,{data:a}=n.payload||{};a&&(t.cardSpecificData={...t.cardSpecificData?t.cardSpecificData:{},[i]:a}),t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Ne.IDLE}}).addCase(pa.rejected,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg,i=`${o}_${r}`;t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Ne.FAILED}})}}),Ul=ir("connectorCardLibrary/fetchAllCard",async({inboxIds:e,channelType:t,conversationId:n})=>{var A;const o=await GN({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}}),pa=ir("connectorCardLibrary/fetchSpecificCard",async({id:e,email:t,conversationId:n,isRefresh:o,externalResourceId:r},i)=>{try{const a=await XN(e,t,n,r),A=a==null?void 0:a.data,l=a==null?void 0:a.status;if(!A)return o&&no({message:Mh,type:fa}),{data:{},status:l};if(o&&no({message:Dh,type:Hi}),A.cardType==="flat"){const c=A.data.flatDisplay.filter(u=>Number(u.statusCode)!==ng.NOT_FOUND).sort((u,g)=>(u==null?void 0:u.priority)-(g==null?void 0:g.priority));A.data.flatDisplay=c}else{const c=A.data.listItems.fields.map(u=>u.sort((g,C)=>(g==null?void 0:g.priority)-(C==null?void 0:C.priority)));A.data.listItems.fields=c}return{data:A,status:l}}catch(a){return i.rejectWithValue(a)}}),Aj=Ph.reducer,lj=Ph.actions,Rh="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",cj="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",Lh={createObjectList:[],linkObjectList:[],objectDict:null,formFields:null,previewCardData:null,objectListApiStatus:Ne.IDLE,unlinkCardApiStatus:Ne.IDLE,linkCardApiStatus:Ne.IDLE,previewCardApiStatus:Ne.IDLE,optionsMap:null,dropdownOptionsApis:Ne.IDLE,dependentFieldsMap:{},createFormApiStatus:Ne.IDLE},Wi="/v1/api",uj=`${Wi}/connectors/forms/list`,dj=`${Wi}/connectors/cards/:id/unlink`,gj=`${Wi}/connectors/forms/:id/link`,fj=`${Wi}/connectors/forms/:id/preview`,pj=`${Wi}/connectors/forms/:formId/field/:fieldName/data`,Cj=`${Wi}/connectors/form/:formId`,Ej=({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)),Lo({url:`${uj}?${o.toString()}`,method:or.GET})},Ij=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),Lo({url:S2(`${pj}?${o.toString()}`,e),method:or.POST,data:t})},hj=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),Lo({url:S2(`${Cj}?${o.toString()}`,e),method:or.POST,data:t})},Bj=(e,t="email",n,o)=>{const r=new URLSearchParams;return r.append("channel_type",t),Lo({url:`${dj.replace(":id",e)}?${r.toString()}`,method:or.POST,data:{externalResourceId:n,conversationId:o}})},mj=(e,t,n="email",o)=>{const r=new URLSearchParams;return r.append("channel_type",n),Lo({url:`${gj.replace(":id",e)}?${r.toString()}`,method:or.POST,data:{externalResourceId:t,conversationId:o}})},Qj=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),Lo({url:`${fj.replace(":id",e)}?${o.toString()}`,method:or.POST,data:{args:t}})},bj="Error in previewing the card",vj="Card linked successfully",yj="Error in linking the card",Uh="Please enter a valid URL",wj="Please enter valid ID",xj="Please enter valid input",Tj="URL must start with https://",Fj="URL should not end with a slash",kj="Invalid email address",Sj="Email must be a string",Nh="Invalid date",Oj="Date cannot be in the past",Mj="Date cannot be in the future",Dj="Invalid number",Pj="Invalid text",Rj="New card created",Lj="Card creation failed!!",Uj="https://avatars.githubusercontent.com/u/62397590",Nj="Create and link objects from different apps to this conversation",jj="Are you sure you want to change the primary object?",Vj="Changing the primary object will reset all the information you’ve entered and all data will be lost and can’t be recovered.",Hj="Are you sure you want to leave?",Wj=`If you go back now, all the information you’ve entered will be lost and can’t be recovered.
2388
+ `,rj=(e,{closeToast:t})=>v.jsx(oj,{children:v.jsx("img",{src:$N,onClick:t})}),Ll=({message:e})=>v.jsxs(ej,{children:[v.jsx(nj,{}),v.jsx(tj,{children:e})]});function no(e){const{message:t,type:n,autoClose:o}=e,r={closeButton:v.jsx(rj,{}),autoClose:o??5e3,pauseOnHover:!0,position:"bottom-left",rtl:!1,draggable:!0,closeOnClick:!0,hideProgressBar:!0};let i;switch(n){case"success":{i=ot.success(v.jsx(Ll,{message:t}),{...r,icon:!1});break}case"error":{i=ot.error(v.jsx(Ll,{message:t}),{...r,icon:!1});break}case"info-dark":{i=ot.info(v.jsx(Ll,{message:t}),{...r,icon:!1,className:"toast_dark"});break}default:{i=ot.info(v.jsx(Ll,{message:t}),{...r,icon:!1});break}}return setTimeout(()=>{ij(i)},o&&!isNaN(o)?Number(o):5e3),i}function ij(e){ot.dismiss(e)}const Hi="success",fa="error",Mh="Some error occured. Please contact support@hiverhq.com",Dh="Card refreshed successfully",sj="Card unlinked successfully",aj="Failed to unlink the card",Ph=Sh({name:"connectorCardLibrary",initialState:WN,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(Ul.pending,t=>{t.connectorApiStatus=Ne.LOADING}).addCase(Ul.fulfilled,(t,n)=>{t.connectorApiStatus=Ne.IDLE,t.connectorCards=n.payload.cards,t.connectorsEnabled=n.payload.connectorsEnabled}).addCase(Ul.rejected,t=>{t.connectorApiStatus=Ne.FAILED}).addCase(pa.pending,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg,i=`${o}_${r}`;t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Ne.LOADING}}).addCase(pa.fulfilled,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg,i=`${o}_${r}`,{data:a}=n.payload||{};a&&(t.cardSpecificData={...t.cardSpecificData?t.cardSpecificData:{},[i]:a}),t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Ne.IDLE}}).addCase(pa.rejected,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg,i=`${o}_${r}`;t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Ne.FAILED}})}}),Ul=ir("connectorCardLibrary/fetchAllCard",async({inboxIds:e,channelType:t,conversationId:n})=>{var A;const o=await GN({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}}),pa=ir("connectorCardLibrary/fetchSpecificCard",async({id:e,email:t,conversationId:n,isRefresh:o,externalResourceId:r},i)=>{try{const a=await XN(e,t,n,r),A=a==null?void 0:a.data,l=a==null?void 0:a.status;if(!A)return o&&no({message:Mh,type:fa}),{data:{},status:l};if(o&&no({message:Dh,type:Hi}),A.cardType==="flat"){const c=A.data.flatDisplay.filter(u=>Number(u.statusCode)!==ng.NOT_FOUND).sort((u,g)=>(u==null?void 0:u.priority)-(g==null?void 0:g.priority));A.data.flatDisplay=c}else{const c=A.data.listItems.fields.map(u=>u.sort((g,C)=>(g==null?void 0:g.priority)-(C==null?void 0:C.priority)));A.data.listItems.fields=c}return{data:A,status:l}}catch(a){return i.rejectWithValue(a)}}),Aj=Ph.reducer,lj=Ph.actions,Rh="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",cj="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",Lh={createObjectList:[],linkObjectList:[],objectDict:null,formFields:null,previewCardData:null,objectListApiStatus:Ne.IDLE,unlinkCardApiStatus:Ne.IDLE,linkCardApiStatus:Ne.IDLE,previewCardApiStatus:Ne.IDLE,optionsMap:null,dropdownOptionsApis:Ne.IDLE,dependentFieldsMap:{},createFormApiStatus:Ne.IDLE},Wi="/v1/api",uj=`${Wi}/connectors/forms/list`,dj=`${Wi}/connectors/cards/:id/unlink`,gj=`${Wi}/connectors/forms/:id/link`,fj=`${Wi}/connectors/forms/:id/preview`,pj=`${Wi}/connectors/forms/:formId/field/:fieldName/data`,Cj=`${Wi}/connectors/form/:formId`,Ej=({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)),Lo({url:`${uj}?${o.toString()}`,method:or.GET})},Ij=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),Lo({url:S2(`${pj}?${o.toString()}`,e),method:or.POST,data:t})},hj=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),Lo({url:S2(`${Cj}?${o.toString()}`,e),method:or.POST,data:t})},Bj=(e,t="email",n,o)=>{const r=new URLSearchParams;return r.append("channel_type",t),Lo({url:`${dj.replace(":id",e)}?${r.toString()}`,method:or.POST,data:{externalResourceId:n,conversationId:o}})},mj=(e,t,n="email",o)=>{const r=new URLSearchParams;return r.append("channel_type",n),Lo({url:`${gj.replace(":id",e)}?${r.toString()}`,method:or.POST,data:{externalResourceId:t,conversationId:o}})},Qj=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),Lo({url:`${fj.replace(":id",e)}?${o.toString()}`,method:or.POST,data:{args:t}})},bj="Error in previewing the card",vj="Card linked successfully",yj="Error in linking the card",Uh="Please enter a valid URL",wj="Please enter valid ID",xj="Please enter valid input",Tj="URL must start with https://",Fj="URL should not end with a slash",kj="Invalid email address",Sj="Email must be a string",Nh="Invalid date",Oj="Date cannot be in the past",Mj="Date cannot be in the future",Dj="Invalid number",Pj="Invalid text",Rj="New card created",Lj="Card creation failed",Uj="https://avatars.githubusercontent.com/u/62397590",Nj="Create and link objects from different apps to this conversation",jj="Are you sure you want to change the primary object?",Vj="Changing the primary object will reset all the information you’ve entered and all data will be lost and can’t be recovered.",Hj="Are you sure you want to leave?",Wj=`If you go back now, all the information you’ve entered will be lost and can’t be recovered.
2390
2389
  Do you want to continue?`,zj="Select an object to create",Yj="Select an object to link",jh="Select object",Gj="Paste URL or ID",Xj="Object ID/Link",Kj="Required Field",Zj="Invalid date",Vh=/^https:\/\/([a-z0-9-]+(\.[a-z0-9-]+)+)(:[0-9]{1,5})?(\/[^\s/]*)*$/i,Jj=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,_j=(e,t)=>t?Object.values(t).filter(o=>e.values[o]&&!e.errors[o]):[],Hh=(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}},{}):{},Wh=(e,t,n)=>{let o=`${t}_${n}`;return Object.keys(e).forEach(r=>{o=`${o}_${r}:${e[r]}`}),o},qj=e=>t=>{if(t&&typeof t=="string"){const n=t.replace(/\/$/,"");return n.startsWith("https://")?t.endsWith("/")?Fj:Vh.test(n)?!0:e||Uh:Tj}return!1},$j=e=>t=>t&&typeof t=="string"?Jj.test(t)?!0:e||kj:Sj,eV=e=>t=>t==null||t===""?e||Kj:!0,tV=e=>(t,n)=>{if(!t||(t==null?void 0:t.toString())===Zj)return Nh;if(typeof t=="object"){const o=t,r=new Date;r.setHours(0,0,0,0);const i=n.disablePast,a=n.disableFuture;return i&&o<r?e||Oj:a&&o>r?e||Mj:!0}return Nh},nV=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||Dj},oV=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||Pj},rV=e=>t=>typeof t=="string"?t.startsWith("https:")?Vh.test(t)?!0:e||Uh:t.trim().length>0?!0:e||wj:e||xj,iV=({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=eV(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=tV(c);return}if(n.type==="number"&&((a=n.validations)!=null&&a.range)){t[n.name].validate=nV();return}if(n.type==="text"&&n.limit){t[n.name].validate=oV();return}if((A=n.validations)!=null&&A.isUrl){const c=typeof n.validations.isUrl=="object"?n.validations.isUrl.msg:"";t[n.name].validate=qj(c)}else if((l=n.validations)!=null&&l.isEmail){const c=typeof n.validations.isEmail=="object"?n.validations.isEmail.msg:"";t[n.name].validate=$j(c)}}),t},sV=Sh({name:"writeCapability",initialState:Lh,reducers:{resetState:()=>Lh},extraReducers:e=>{e.addCase(Nl.pending,t=>{t.objectListApiStatus=Ne.LOADING}).addCase(Nl.fulfilled,(t,n)=>{const{createObjectList:o,linkObjectList:r,formFields:i,objectDict:a,dependentFieldsMap:A}=n.payload;t.objectListApiStatus=Ne.IDLE,t.createObjectList=o,t.linkObjectList=r,t.formFields=i,t.objectDict=a,t.dependentFieldsMap=A}).addCase(Nl.rejected,t=>{t.objectListApiStatus=Ne.FAILED}).addCase(jl.pending,t=>{t.dropdownOptionsApis=Ne.LOADING}).addCase(jl.fulfilled,(t,n)=>{const o=t.optionsMap||{},{optionsList:r,hasMore:i,currentPage:a,key:A}=n.payload;t.dropdownOptionsApis=Ne.IDLE,t.optionsMap={...o,[A]:{options:r,hasMore:i,currentPage:a}}}).addCase(jl.rejected,t=>{t.dropdownOptionsApis=Ne.FAILED}).addCase(Vl.pending,t=>{t.createFormApiStatus=Ne.LOADING}).addCase(Vl.fulfilled,t=>{t.createFormApiStatus=Ne.IDLE}).addCase(Vl.rejected,t=>{t.createFormApiStatus=Ne.FAILED}).addCase(Wl.pending,t=>{t.linkCardApiStatus=Ne.LOADING}).addCase(Wl.fulfilled,t=>{t.linkCardApiStatus=Ne.IDLE}).addCase(Wl.rejected,t=>{t.linkCardApiStatus=Ne.FAILED}).addCase(Hl.pending,t=>{t.unlinkCardApiStatus=Ne.LOADING}).addCase(Hl.fulfilled,t=>{t.unlinkCardApiStatus=Ne.IDLE}).addCase(Hl.rejected,t=>{t.unlinkCardApiStatus=Ne.FAILED}).addCase(Ca.pending,t=>{t.previewCardApiStatus=Ne.LOADING}).addCase(Ca.fulfilled,(t,n)=>{const{data:o}=n.payload;o&&(t.previewCardData=o),t.previewCardApiStatus=Ne.IDLE}).addCase(Ca.rejected,t=>{t.previewCardApiStatus=Ne.FAILED})}}),Nl=ir("writeCapability/fetchObjectList",async e=>{const{inboxIds:t,channelType:n,conversationId:o}=e,r=await Ej({inboxIds:t,channelType:n,conversationId:o});if(!r||!r.data||!("formsList"in r.data)||!Array.isArray(r.data.formsList))return{createObjectList:[],linkObjectList:[],formFields:null,objectDict:null,dependentFieldsMap:{}};const i=r.data.formsList,a={},A=[],l=[],c={},u={};return i==null||i.forEach(g=>{var h,f;const C={...g};"fieldList"in C&&delete C.fieldList,u[g.id]=C,a[g.id]||(a[g.id]={}),c[g.id]||(c[g.id]=[]),g.type==="create"&&g.authenticated?A.push({value:g.id,label:g.name}):g.type==="link"&&g.authenticated&&l.push({value:g.id,label:g.name}),(h=g.fieldList)==null||h.sort((p,d)=>p.priority-d.priority),(f=g.fieldList)==null||f.forEach(p=>{var I,m,B,b,E,Q,y,T,k,S,D,O;let d={};switch(p.type){case"select":case"multi-select":{d={...p,defaultOptions:!!p.interfaceDetails,isInfiniteScrollable:((m=(I=p.interfaceDetails)==null?void 0:I.pagination)==null?void 0:m.enabled)||!1,loadOptionsOnFocus:Object.keys(((B=p.interfaceDetails)==null?void 0:B.args)||{}).length>0,isMultiSelect:p.type==="multi-select",type:g.interfaceDetails?"async-select":"select",isClearable:!0};break}case"date":{d={...p,type:"date",disablePast:!!((b=p.validations)!=null&&b.disablePast)||!1,disableFuture:!!((E=p.validations)!=null&&E.disableFuture)||!1};break}case"number":{d={...p,type:"number",min:((y=(Q=p.validations)==null?void 0:Q.range)==null?void 0:y.min)||Number.MIN_SAFE_INTEGER,max:((k=(T=p.validations)==null?void 0:T.range)==null?void 0:k.max)||Number.MAX_SAFE_INTEGER};break}case"multiline":{d={...p,type:"text",maxRows:((S=p.validations)==null?void 0:S.maxRows)||5,limit:(D=p.validations)==null?void 0:D.maxCharacters,rows:5,multiline:!0};break}case"text":{d={...p,type:"text",limit:(O=p.validations)==null?void 0:O.maxCharacters};break}default:d={...p}}if("value"in d&&(d.defaultValue=d.value,delete d.value),c[g.id]=[...c[g.id],d],p.interfaceDetails&&(p.interfaceDetails.args||p.interfaceDetails.optionalArgs)){const U={...p.interfaceDetails.args,...p.interfaceDetails.optionalArgs};Object.values(U).forEach(M=>{a[g.id][M]?a[g.id][M]=[...a[g.id][M],p.name]:a[g.id][M]=[p.name]})}})}),{createObjectList:A,linkObjectList:l,formFields:c,objectDict:u,dependentFieldsMap:a}}),jl=ir("writeCapability/fetchDropDownOptions",async(e,{getState:t,rejectWithValue:n})=>{var B;const{fieldName:o,formId:r,fieldConfig:i,callback:a,args:A={},interfaceId:l="",pagination:c={enabled:!1}}=e,u=Wh(A||{},r,o),{write:g}=t();let C=!1;i.meta&&"showAvatar"in i.meta&&typeof i.meta.showAvatar=="boolean"&&(C=i.meta.showAvatar);const{options:h=[],hasMore:f=!0,currentPage:p=0}=((B=g.optionsMap)==null?void 0:B[u])||{},{enabled:d,limit:I}=c,m=I||10;try{let b;const E=d?{pageNumber:p+1,limit:m}:null;if(f?b=await Ij({fieldName:o,formId:r},{pagination:E||{},args:A,interfaceId:l}):a==null||a(h),!b||!b.data||!("data"in b.data)||!Array.isArray(b.data.data))return{optionsList:[...h],fieldName:"",formId:"",hasMore:!1,currentPage:p,key:u};const y=b.data.data.map(S=>C?{...S,avatarUrl:S.avatarUrl||Uj}:{label:S.label,value:S.value}),T=d?y.length>=m:!1,k=[...h,...y];return a==null||a(k),{optionsList:k,fieldName:o,formId:r,currentPage:p+1,hasMore:T,key:u}}catch(b){return a==null||a(h),n(b)}},{condition:(e,{getState:t})=>{var c,u;if(e.isScrollToBottomEvent)return!0;const{fieldName:n,formId:o,callback:r,args:i}=e,a=Wh(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}}),Vl=ir("writeCapability/createForm",async(e,{rejectWithValue:t})=>{const{formId:n,successCallback:o,failureCallback:r,args:i={},interfaceId:a,conversationId:A}=e;try{await hj({formId:n},{args:i,interfaceId:a,conversationId:A}),o==null||o(),no({message:Rj,type:Hi})}catch(l){return r==null||r(l),no({message:Lj,type:fa}),t(l)}}),Hl=ir("writeCapability/unlinkCard",async({id:e,channelType:t,externalResourceId:n,conversationId:o})=>{await Bj(e,t,n,o)}),Wl=ir("writeCapability/linkCard",async({id:e,externalResourceId:t,channelType:n,conversationId:o})=>{await mj(e,t,n,o)}),Ca=ir("writeCapability/previewCard",async({id:e,args:t,channelType:n,isRefresh:o})=>{const r=await Qj(e,t,n),i=r==null?void 0:r.data;if(!i)return o&&no({message:Mh,type:fa}),{data:null};if(o&&no({message:Dh,type:Hi}),i.cardType==="flat"){const a=i.data.flatDisplay.filter(A=>Number(A.statusCode)!==ng.NOT_FOUND).sort((A,l)=>(A==null?void 0:A.priority)-(l==null?void 0:l.priority));i.data.flatDisplay=a}else{const a=i.data.listItems.fields.map(A=>A.sort((l,c)=>(l==null?void 0:l.priority)-(c==null?void 0:c.priority)));i.data.listItems.fields=a}return{data:i}}),aV=sV.reducer,zh=e=>e.write.createObjectList,Yh=e=>e.write.linkObjectList,AV=e=>e.write.objectDict,lV=e=>e.write.formFields,cV=e=>e.write.previewCardData,uV=e=>e.write.previewCardApiStatus,dV=e=>e.write.linkCardApiStatus,gV=e=>e.write.unlinkCardApiStatus,fV=e=>e.write.dependentFieldsMap,pV=e=>e.write.createFormApiStatus,CV=({showUnlinkModal:e,setShowUnlinkModal:t,cardId:n,onCardUnlinking:o,externalResourceId:r,conversationId:i,connectorName:a})=>{const A=Ni(),{sendTrackingEvent:l}=w.useContext(Do),u=Jt(gV)===Ne.LOADING,g=()=>{i&&r&&A(Hl({id:n,conversationId:i,externalResourceId:r})).unwrap().then(()=>{l(uL,{connector_name:a,conversation_id:i}),t(!1),o(),no({message:sj,type:Hi})}).catch(()=>{no({message:aj,type:Hi})})};return v.jsx(gg,{shown:e,setShown:t,showCloseButton:!0,children:v.jsxs(Le,{width:"400px",padding:"20px",gap:"8px",children:[v.jsx(We,{variant:"h2",children:zR}),v.jsx(We,{variant:"body2",children:YR}),v.jsxs(Le,{direction:"row",gap:"8px",marginTop:"20px",justifyContent:"flex-end",children:[v.jsx(Ht,{variant:"text",onClick:()=>t(!1),children:rg}),v.jsx(Ht,{disabled:u,color:"error",onClick:g,children:x2})]})]})})},EV=e=>{const{card:t,specificCardData:n,email:o,specificConnectorApiStatus:r,defaultOpenState:i=!1,onCardUnlinking:a}=e,{availableFeatures:A,sendTrackingEvent:l,conversationId:c}=w.useContext(Do),[u,g]=w.useState(!1),[C,h]=w.useState(!1),[f,p]=w.useState(!1),{id:d,title:I,externalResourceId:m="",connectorName:B=""}=t,b=`${d}_${m}`,E=(r==null?void 0:r[b])===Ne.LOADING,Q=(yl(A,v2)&&(t==null?void 0:t.externalResourceId))??!1,y=Ni();w.useEffect(()=>{g(!!i)},[i]);const T=w.useCallback((O=!1)=>{const U=O?CL:pL;o&&d&&c&&y(pa({id:d,email:o,conversationId:c,externalResourceId:m})).unwrap().then(M=>{const R=O2(M,I,O,!0);l(U,R)}).catch(M=>{const R=O2(M,I,O,!1);l(U,R)})},[y,o,d,I,l,c,m]);w.useEffect(()=>{i&&T(!0)},[i,T]);const k=(O,U)=>{var R;O==null||O.stopPropagation(),y(pa({id:U,email:o,conversationId:c,isRefresh:!0,externalResourceId:m})).unwrap().then(()=>{l(tL,{id:U})});const M=O.target.tagName==="BUTTON"?(R=O.target)==null?void 0:R.firstChild:O.target;M.className&&(M.className=""),setTimeout(()=>M.className="selected",1)},S=(O,U)=>{O.stopPropagation(),!(n!=null&&n[U])&&!E&&T(),l(u?eL:$R,{id:U}),g(M=>!M)},D=O=>{O.stopPropagation();const U=O.currentTarget.offsetWidth<O.currentTarget.scrollWidth;h(!!U)};return v.jsxs(qL,{"data-testid":`test_${d}`,children:[v.jsxs($L,{className:u?"hiver-card-expanded":"",children:[v.jsx(Zt,{title:C?I:"",placement:"bottom",children:v.jsx(eU,{variant:"h4",onMouseOver:O=>D(O),onMouseLeave:O=>D(O),children:I})}),v.jsxs(Y2,{children:[Q?v.jsx(Zt,{title:x2,placement:"bottom",children:v.jsx(ji,{onClick:()=>p(!0),children:v.jsx("img",{src:cj})})}):null,u?v.jsx(Zt,{title:y2,placement:"bottom",children:v.jsx(ji,{"data-testid":E?"loading":"reloadIcon",onClick:O=>k(O,d),className:E?"disabled":"",children:v.jsx("img",{src:Rh})})}):null,v.jsx(Zt,{title:u?w2:og,placement:"bottom",children:v.jsx(ji,{onClick:O=>S(O,d),children:v.jsx(dg,{className:u?"":"hiver-up"})})})]})]}),v.jsx(J2,{id:b,cardTitle:t.title,specificCardData:n,specificConnectorApiStatus:r,isOpen:u}),v.jsx(CV,{showUnlinkModal:f,setShowUnlinkModal:p,cardId:d,onCardUnlinking:a,conversationId:c,externalResourceId:m,connectorName:B})]})},IV="Bring your favourite tools into Hiver",hV="Plugin image",BV="Integrate tools like Salesforce, HubSpot, and Shopify to boost productivity",mV="Enable Connectors",Gh="app/custom-connectors",QV="Learn more",bV="https://help.hiverhq.com/custom-connectors/hiver-s-custom-connectors",vV="Contact your admin to enable this",yV=j(Le)`
2391
2390
  width: 250px;
2392
2391
  height: 97px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiver/connector-agent",
3
- "version": "1.3.8-beta.8",
3
+ "version": "1.3.8-beta.9",
4
4
  "main": "index.es.js",
5
5
  "module": "index.es.js",
6
6
  "types": "index.d.ts",