@hiver/connector-agent 1.5.2-beta.1 → 1.5.2-beta.2

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.
@@ -6,7 +6,7 @@ export declare const IFRAME_URL = "app/custom-connectors";
6
6
  export declare const LEARN_MORE = "Learn more";
7
7
  export declare const LEARN_MORE_URL = "https://help.hiverhq.com/custom-connectors/hiver-s-custom-connectors";
8
8
  export declare const ASK_ADMIN = "Contact your admin to enable this";
9
- export declare const SETUP_GUIDE_VIDEO_LINK = "https://www.youtube.com/watch?v=Gmg7nYCUB0o";
10
- export declare const SETUP_GUIDE_VIDEO_PREVIEW = "https://i.ytimg.com/vi_webp/Gmg7nYCUB0o/maxresdefault.webp";
9
+ export declare const SETUP_GUIDE_VIDEO_LINK = "https://youtu.be/ODcJnzZLb50";
10
+ export declare const SETUP_GUIDE_VIDEO_PREVIEW = "https://i.ytimg.com/vi/ODcJnzZLb50/maxresdefault.jpg";
11
11
  export declare const SETUP_GUIDE_TEXT = "Explore connectors";
12
12
  //# sourceMappingURL=noConnector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"noConnector.d.ts","sourceRoot":"","sources":["../../src/constants/noConnector.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,0CAA0C,CAAC;AACvE,eAAO,MAAM,WAAW,iBAAiB,CAAC;AAC1C,eAAO,MAAM,WAAW,gFAAgF,CAAC;AACzG,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AACrD,eAAO,MAAM,UAAU,0BAA0B,CAAC;AAClD,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,cAAc,yEAAyE,CAAC;AACrG,eAAO,MAAM,SAAS,sCAAsC,CAAC;AAC7D,eAAO,MAAM,sBAAsB,gDAAgD,CAAC;AACpF,eAAO,MAAM,yBAAyB,+DAA+D,CAAC;AACtG,eAAO,MAAM,gBAAgB,uBAAuB,CAAC"}
1
+ {"version":3,"file":"noConnector.d.ts","sourceRoot":"","sources":["../../src/constants/noConnector.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,0CAA0C,CAAC;AACvE,eAAO,MAAM,WAAW,iBAAiB,CAAC;AAC1C,eAAO,MAAM,WAAW,gFAAgF,CAAC;AACzG,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AACrD,eAAO,MAAM,UAAU,0BAA0B,CAAC;AAClD,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,cAAc,yEAAyE,CAAC;AACrG,eAAO,MAAM,SAAS,sCAAsC,CAAC;AAC7D,eAAO,MAAM,sBAAsB,iCAAiC,CAAC;AACrE,eAAO,MAAM,yBAAyB,yDAAyD,CAAC;AAChG,eAAO,MAAM,gBAAgB,uBAAuB,CAAC"}
package/index.es.js CHANGED
@@ -36721,7 +36721,7 @@ Do you want to continue?`, eV = "Select an object to create", tV = "Select an ob
36721
36721
  }
36722
36722
  )
36723
36723
  ] });
36724
- }, TV = "Bring your favourite tools into Hiver", FV = "Plugin image", kV = "Integrate tools like Salesforce, HubSpot, and Shopify to boost productivity", OV = "Enable Connectors", wB = "app/custom-connectors", SV = "Learn more", MV = "https://help.hiverhq.com/custom-connectors/hiver-s-custom-connectors", RV = "Contact your admin to enable this", DV = "https://www.youtube.com/watch?v=Gmg7nYCUB0o", PV = "https://i.ytimg.com/vi_webp/Gmg7nYCUB0o/maxresdefault.webp", LV = "Explore connectors", UV = j(je)`
36724
+ }, TV = "Bring your favourite tools into Hiver", FV = "Plugin image", kV = "Integrate tools like Salesforce, HubSpot, and Shopify to boost productivity", OV = "Enable Connectors", wB = "app/custom-connectors", SV = "Learn more", MV = "https://help.hiverhq.com/custom-connectors/hiver-s-custom-connectors", RV = "Contact your admin to enable this", DV = "https://youtu.be/ODcJnzZLb50", PV = "https://i.ytimg.com/vi/ODcJnzZLb50/maxresdefault.jpg", LV = "Explore connectors", UV = j(je)`
36725
36725
  width: 250px;
36726
36726
  height: 97px;
36727
36727
  background-color: ${Pe.palette.purple.light};
@@ -40375,7 +40375,7 @@ const ul = (e) => {
40375
40375
  width: 40px;
40376
40376
  height: 40px;
40377
40377
  }
40378
- `, sY = (e) => /* @__PURE__ */ w.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 41, height: 41, viewBox: "0 0 41 41", fill: "none", ...e }, /* @__PURE__ */ w.createElement("g", { clipPath: "url(#clip0_5805_11979)" }, /* @__PURE__ */ w.createElement("path", { d: "M20.5001 3.41663C11.0701 3.41663 3.41675 11.07 3.41675 20.5C3.41675 29.93 11.0701 37.5833 20.5001 37.5833C29.9301 37.5833 37.5834 29.93 37.5834 20.5C37.5834 11.07 29.9301 3.41663 20.5001 3.41663ZM17.0834 28.1875V12.8125L27.3334 20.5L17.0834 28.1875Z", fill: "#4D596C" })), /* @__PURE__ */ w.createElement("defs", null, /* @__PURE__ */ w.createElement("clipPath", { id: "clip0_5805_11979" }, /* @__PURE__ */ w.createElement("rect", { width: 41, height: 41, fill: "white" })))), AY = (e) => {
40378
+ `, sY = (e) => /* @__PURE__ */ w.createElement("svg", { width: 35, height: 35, viewBox: "0 0 35 35", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ w.createElement("rect", { x: 9, y: 9, width: 15, height: 17, fill: "white" }), /* @__PURE__ */ w.createElement("g", { clipPath: "url(#clip0_7787_114457)" }, /* @__PURE__ */ w.createElement("path", { d: "M17.1981 2.86633C9.28704 2.86633 2.86646 9.28691 2.86646 17.198C2.86646 25.1091 9.28704 31.5296 17.1981 31.5296C25.1092 31.5296 31.5298 25.1091 31.5298 17.198C31.5298 9.28691 25.1092 2.86633 17.1981 2.86633ZM14.3318 23.6472V10.7487L22.9308 17.198L14.3318 23.6472Z", fill: "#4D596C" })), /* @__PURE__ */ w.createElement("defs", null, /* @__PURE__ */ w.createElement("clipPath", { id: "clip0_7787_114457" }, /* @__PURE__ */ w.createElement("rect", { width: 34.396, height: 34.396, fill: "white" })))), AY = (e) => {
40379
40379
  const [t, n] = ve(!1);
40380
40380
  return t ? null : /* @__PURE__ */ v.jsxs(aY, { children: [
40381
40381
  /* @__PURE__ */ v.jsx("img", { className: "preview-img", onError: () => n(!0), ...e }),
package/index.umd.js CHANGED
@@ -2386,7 +2386,7 @@ Take a look at the reducer(s) handling this action type: ${h.type}.
2386
2386
  width: 10px;
2387
2387
  }
2388
2388
  `,sj=(e,{closeToast:t})=>v.jsx(ij,{children:v.jsx("img",{src:tj,onClick:t})}),Ul=({message:e})=>v.jsxs(nj,{children:[v.jsx(rj,{}),v.jsx(oj,{children:e})]});function no(e){const{message:t,type:n,autoClose:o}=e,r={closeButton:v.jsx(sj,{}),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(Ul,{message:t}),{...r,icon:!1});break}case"error":{i=ot.error(v.jsx(Ul,{message:t}),{...r,icon:!1});break}case"info-dark":{i=ot.info(v.jsx(Ul,{message:t}),{...r,icon:!1,className:"toast_dark"});break}default:{i=ot.info(v.jsx(Ul,{message:t}),{...r,icon:!1});break}}return setTimeout(()=>{aj(i)},o&&!isNaN(o)?Number(o):5e3),i}function aj(e){ot.dismiss(e)}const Hi="success",pa="error",Mh="Some error occured. Please contact support@hiverhq.com",Dh="Card refreshed successfully",Aj="Card unlinked successfully",lj="Failed to unlink the card",Ph=Sh({name:"connectorCardLibrary",initialState:YN,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(Nl.pending,t=>{t.connectorApiStatus=Ne.LOADING}).addCase(Nl.fulfilled,(t,n)=>{t.connectorApiStatus=Ne.IDLE,t.connectorCards=n.payload.cards,t.connectorsEnabled=n.payload.connectorsEnabled}).addCase(Nl.rejected,t=>{t.connectorApiStatus=Ne.FAILED}).addCase(Ca.pending,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg;let i=o;r&&(i=`${i}_${r}`),t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Ne.LOADING}}).addCase(Ca.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]:Ne.IDLE}}).addCase(Ca.rejected,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg;let i=o;r&&(i=`${i}_${r}`),t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Ne.FAILED}})}}),Nl=ir("connectorCardLibrary/fetchAllCard",async({inboxIds:e,channelType:t,conversationId:n})=>{var A;const o=await KN({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}}),Ca=ir("connectorCardLibrary/fetchSpecificCard",async({id:e,email:t,conversationId:n,isRefresh:o,externalResourceId:r},i)=>{try{const a=await ZN(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:pa}),{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)}}),cj=Ph.reducer,uj=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",dj="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",gj=`${Wi}/connectors/forms/list`,fj=`${Wi}/connectors/cards/:id/unlink`,pj=`${Wi}/connectors/forms/:id/link`,Cj=`${Wi}/connectors/forms/:id/preview`,Ej=`${Wi}/connectors/forms/:formId/field/:fieldName/data`,Ij=`${Wi}/connectors/form/:formId`,hj=({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:`${gj}?${o.toString()}`,method:or.GET})},Bj=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),Lo({url:S2(`${Ej}?${o.toString()}`,e),method:or.POST,data:t})},mj=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),Lo({url:S2(`${Ij}?${o.toString()}`,e),method:or.POST,data:t})},Qj=(e,t="email",n,o)=>{const r=new URLSearchParams;return r.append("channel_type",t),Lo({url:`${fj.replace(":id",e)}?${r.toString()}`,method:or.POST,data:{externalResourceId:n,conversationId:o}})},bj=(e,t,n="email",o)=>{const r=new URLSearchParams;return r.append("channel_type",n),Lo({url:`${pj.replace(":id",e)}?${r.toString()}`,method:or.POST,data:{externalResourceId:t,conversationId:o}})},vj=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),Lo({url:`${Cj.replace(":id",e)}?${o.toString()}`,method:or.POST,data:{args:t}})},yj="Error in previewing the card",wj="Card linked successfully",xj="Error in linking the card",Uh="Please enter a valid URL",Tj="Please enter valid ID",Fj="Please enter valid input",kj="URL must start with https://",Sj="URL should not end with a slash",Oj="Invalid email address",Mj="Email must be a string",Nh="Invalid date",Dj="Date cannot be in the past",Pj="Date cannot be in the future",Rj="Invalid number",Lj="Invalid text",Uj="New card created",Nj="Card creation failed",jj="https://avatars.githubusercontent.com/u/62397590",Vj="Create and link objects from different apps to this conversation",Hj="Are you sure you want to change the primary object?",Wj="Changing the primary object will reset all the information you’ve entered and all data will be lost and can’t be recovered.",zj="Are you sure you want to leave?",Yj=`If you go back now, all the information you’ve entered will be lost and can’t be recovered.
2389
- Do you want to continue?`,Gj="Select an object to create",Xj="Select an object to link",jh="Select object",Kj="Paste URL or ID",Zj="Object ID/Link",Jj="Required Field",_j="Invalid date",Vh=/^https:\/\/([a-z0-9-]+(\.[a-z0-9-]+)+)(:[0-9]{1,5})?(\/[^\s/]*)*$/i,qj=/^[^\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},eV=e=>t=>{if(t&&typeof t=="string"){const n=t.replace(/\/$/,"");return n.startsWith("https://")?t.endsWith("/")?Sj:Vh.test(n)?!0:e||Uh:kj}return!1},tV=e=>t=>t&&typeof t=="string"?qj.test(t)?!0:e||Oj:Mj,nV=e=>t=>t==null||t===""?e||Jj:!0,oV=e=>(t,n)=>{if(!t||(t==null?void 0:t.toString())===_j)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||Dj:a&&o>r?e||Pj:!0}return Nh},rV=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||Rj},iV=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||Lj},sV=e=>t=>typeof t=="string"?t.startsWith("https:")?Vh.test(t)?!0:e||Uh:t.trim().length>0?!0:e||Tj:e||Fj,aV=({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=nV(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=oV(c);return}if(n.type==="number"&&((a=n.validations)!=null&&a.range)){t[n.name].validate=rV();return}if(n.type==="text"&&n.limit){t[n.name].validate=iV();return}if((A=n.validations)!=null&&A.isUrl){const c=typeof n.validations.isUrl=="object"?n.validations.isUrl.msg:"";t[n.name].validate=eV(c)}else if((l=n.validations)!=null&&l.isEmail){const c=typeof n.validations.isEmail=="object"?n.validations.isEmail.msg:"";t[n.name].validate=tV(c)}}),t},AV=Sh({name:"writeCapability",initialState:Lh,reducers:{resetState:()=>Lh},extraReducers:e=>{e.addCase(jl.pending,t=>{t.objectListApiStatus=Ne.LOADING}).addCase(jl.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(jl.rejected,t=>{t.objectListApiStatus=Ne.FAILED}).addCase(Vl.pending,t=>{t.dropdownOptionsApis=Ne.LOADING}).addCase(Vl.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(Vl.rejected,t=>{t.dropdownOptionsApis=Ne.FAILED}).addCase(Hl.pending,t=>{t.createFormApiStatus=Ne.LOADING}).addCase(Hl.fulfilled,t=>{t.createFormApiStatus=Ne.IDLE}).addCase(Hl.rejected,t=>{t.createFormApiStatus=Ne.FAILED}).addCase(zl.pending,t=>{t.linkCardApiStatus=Ne.LOADING}).addCase(zl.fulfilled,t=>{t.linkCardApiStatus=Ne.IDLE}).addCase(zl.rejected,t=>{t.linkCardApiStatus=Ne.FAILED}).addCase(Wl.pending,t=>{t.unlinkCardApiStatus=Ne.LOADING}).addCase(Wl.fulfilled,t=>{t.unlinkCardApiStatus=Ne.IDLE}).addCase(Wl.rejected,t=>{t.unlinkCardApiStatus=Ne.FAILED}).addCase(Ea.pending,t=>{t.previewCardApiStatus=Ne.LOADING}).addCase(Ea.fulfilled,(t,n)=>{const{data:o}=n.payload;o&&(t.previewCardData=o),t.previewCardApiStatus=Ne.IDLE}).addCase(Ea.rejected,t=>{t.previewCardApiStatus=Ne.FAILED})}}),jl=ir("writeCapability/fetchObjectList",async e=>{const{inboxIds:t,channelType:n,conversationId:o}=e,r=await hj({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}}),Vl=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 Bj({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||jj}:{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}}),Hl=ir("writeCapability/createForm",async(e,{rejectWithValue:t})=>{const{formId:n,successCallback:o,failureCallback:r,args:i={},interfaceId:a,conversationId:A}=e;try{await mj({formId:n},{args:i,interfaceId:a,conversationId:A}),o==null||o(),no({message:Uj,type:Hi})}catch(l){return r==null||r(l),no({message:Nj,type:pa}),t(l)}}),Wl=ir("writeCapability/unlinkCard",async({id:e,channelType:t,externalResourceId:n,conversationId:o})=>{await Qj(e,t,n,o)}),zl=ir("writeCapability/linkCard",async({id:e,externalResourceId:t,channelType:n,conversationId:o})=>{await bj(e,t,n,o)}),Ea=ir("writeCapability/previewCard",async({id:e,args:t,channelType:n,isRefresh:o})=>{const r=await vj(e,t,n),i=r==null?void 0:r.data;if(!i)return o&&no({message:Mh,type:pa}),{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}}),lV=AV.reducer,zh=e=>e.write.createObjectList,Yh=e=>e.write.linkObjectList,cV=e=>e.write.objectDict,uV=e=>e.write.formFields,dV=e=>e.write.previewCardData,gV=e=>e.write.previewCardApiStatus,fV=e=>e.write.linkCardApiStatus,pV=e=>e.write.unlinkCardApiStatus,CV=e=>e.write.dependentFieldsMap,EV=e=>e.write.createFormApiStatus,IV=({showUnlinkModal:e,setShowUnlinkModal:t,cardId:n,onCardUnlinking:o,externalResourceId:r,conversationId:i,connectorName:a})=>{const A=Ni(),{sendTrackingEvent:l}=w.useContext(Do),u=Jt(pV)===Ne.LOADING,g=()=>{i&&r&&A(Wl({id:n,conversationId:i,externalResourceId:r})).unwrap().then(()=>{l(dL,{connector_name:a,conversation_id:i}),t(!1),o(),no({message:Aj,type:Hi})}).catch(()=>{no({message:lj,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:YR}),v.jsx(We,{variant:"body2",children:GR}),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})]})]})})},hV=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;let b=d;m&&(b=`${b}_${m}`);const E=(r==null?void 0:r[b])===Ne.LOADING,Q=(ca(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?EL:CL;o&&d&&c&&y(Ca({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(Ca({id:U,email:o,conversationId:c,isRefresh:!0,externalResourceId:m})).unwrap().then(()=>{l(nL,{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?tL:eL,{id:U}),g(M=>!M)},D=O=>{O.stopPropagation();const U=O.currentTarget.offsetWidth<O.currentTarget.scrollWidth;h(!!U)};return v.jsxs(eU,{"data-testid":`test_${d}`,children:[v.jsxs(tU,{className:u?"hiver-card-expanded":"",children:[v.jsx(Zt,{title:C?I:"",placement:"bottom",children:v.jsx(nU,{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:dj})})}):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,b),children:v.jsx(dg,{className:u?"":"hiver-up"})})})]})]}),v.jsx(J2,{id:b,cardTitle:t.title,specificCardData:n,specificConnectorApiStatus:r,isOpen:u}),v.jsx(IV,{showUnlinkModal:f,setShowUnlinkModal:p,cardId:d,onCardUnlinking:a,conversationId:c,externalResourceId:m,connectorName:B})]})},BV="Bring your favourite tools into Hiver",mV="Plugin image",QV="Integrate tools like Salesforce, HubSpot, and Shopify to boost productivity",bV="Enable Connectors",Gh="app/custom-connectors",vV="Learn more",yV="https://help.hiverhq.com/custom-connectors/hiver-s-custom-connectors",wV="Contact your admin to enable this",xV="https://www.youtube.com/watch?v=Gmg7nYCUB0o",TV="https://i.ytimg.com/vi_webp/Gmg7nYCUB0o/maxresdefault.webp",FV="Explore connectors",kV=j(Le)`
2389
+ Do you want to continue?`,Gj="Select an object to create",Xj="Select an object to link",jh="Select object",Kj="Paste URL or ID",Zj="Object ID/Link",Jj="Required Field",_j="Invalid date",Vh=/^https:\/\/([a-z0-9-]+(\.[a-z0-9-]+)+)(:[0-9]{1,5})?(\/[^\s/]*)*$/i,qj=/^[^\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},eV=e=>t=>{if(t&&typeof t=="string"){const n=t.replace(/\/$/,"");return n.startsWith("https://")?t.endsWith("/")?Sj:Vh.test(n)?!0:e||Uh:kj}return!1},tV=e=>t=>t&&typeof t=="string"?qj.test(t)?!0:e||Oj:Mj,nV=e=>t=>t==null||t===""?e||Jj:!0,oV=e=>(t,n)=>{if(!t||(t==null?void 0:t.toString())===_j)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||Dj:a&&o>r?e||Pj:!0}return Nh},rV=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||Rj},iV=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||Lj},sV=e=>t=>typeof t=="string"?t.startsWith("https:")?Vh.test(t)?!0:e||Uh:t.trim().length>0?!0:e||Tj:e||Fj,aV=({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=nV(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=oV(c);return}if(n.type==="number"&&((a=n.validations)!=null&&a.range)){t[n.name].validate=rV();return}if(n.type==="text"&&n.limit){t[n.name].validate=iV();return}if((A=n.validations)!=null&&A.isUrl){const c=typeof n.validations.isUrl=="object"?n.validations.isUrl.msg:"";t[n.name].validate=eV(c)}else if((l=n.validations)!=null&&l.isEmail){const c=typeof n.validations.isEmail=="object"?n.validations.isEmail.msg:"";t[n.name].validate=tV(c)}}),t},AV=Sh({name:"writeCapability",initialState:Lh,reducers:{resetState:()=>Lh},extraReducers:e=>{e.addCase(jl.pending,t=>{t.objectListApiStatus=Ne.LOADING}).addCase(jl.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(jl.rejected,t=>{t.objectListApiStatus=Ne.FAILED}).addCase(Vl.pending,t=>{t.dropdownOptionsApis=Ne.LOADING}).addCase(Vl.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(Vl.rejected,t=>{t.dropdownOptionsApis=Ne.FAILED}).addCase(Hl.pending,t=>{t.createFormApiStatus=Ne.LOADING}).addCase(Hl.fulfilled,t=>{t.createFormApiStatus=Ne.IDLE}).addCase(Hl.rejected,t=>{t.createFormApiStatus=Ne.FAILED}).addCase(zl.pending,t=>{t.linkCardApiStatus=Ne.LOADING}).addCase(zl.fulfilled,t=>{t.linkCardApiStatus=Ne.IDLE}).addCase(zl.rejected,t=>{t.linkCardApiStatus=Ne.FAILED}).addCase(Wl.pending,t=>{t.unlinkCardApiStatus=Ne.LOADING}).addCase(Wl.fulfilled,t=>{t.unlinkCardApiStatus=Ne.IDLE}).addCase(Wl.rejected,t=>{t.unlinkCardApiStatus=Ne.FAILED}).addCase(Ea.pending,t=>{t.previewCardApiStatus=Ne.LOADING}).addCase(Ea.fulfilled,(t,n)=>{const{data:o}=n.payload;o&&(t.previewCardData=o),t.previewCardApiStatus=Ne.IDLE}).addCase(Ea.rejected,t=>{t.previewCardApiStatus=Ne.FAILED})}}),jl=ir("writeCapability/fetchObjectList",async e=>{const{inboxIds:t,channelType:n,conversationId:o}=e,r=await hj({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}}),Vl=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 Bj({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||jj}:{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}}),Hl=ir("writeCapability/createForm",async(e,{rejectWithValue:t})=>{const{formId:n,successCallback:o,failureCallback:r,args:i={},interfaceId:a,conversationId:A}=e;try{await mj({formId:n},{args:i,interfaceId:a,conversationId:A}),o==null||o(),no({message:Uj,type:Hi})}catch(l){return r==null||r(l),no({message:Nj,type:pa}),t(l)}}),Wl=ir("writeCapability/unlinkCard",async({id:e,channelType:t,externalResourceId:n,conversationId:o})=>{await Qj(e,t,n,o)}),zl=ir("writeCapability/linkCard",async({id:e,externalResourceId:t,channelType:n,conversationId:o})=>{await bj(e,t,n,o)}),Ea=ir("writeCapability/previewCard",async({id:e,args:t,channelType:n,isRefresh:o})=>{const r=await vj(e,t,n),i=r==null?void 0:r.data;if(!i)return o&&no({message:Mh,type:pa}),{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}}),lV=AV.reducer,zh=e=>e.write.createObjectList,Yh=e=>e.write.linkObjectList,cV=e=>e.write.objectDict,uV=e=>e.write.formFields,dV=e=>e.write.previewCardData,gV=e=>e.write.previewCardApiStatus,fV=e=>e.write.linkCardApiStatus,pV=e=>e.write.unlinkCardApiStatus,CV=e=>e.write.dependentFieldsMap,EV=e=>e.write.createFormApiStatus,IV=({showUnlinkModal:e,setShowUnlinkModal:t,cardId:n,onCardUnlinking:o,externalResourceId:r,conversationId:i,connectorName:a})=>{const A=Ni(),{sendTrackingEvent:l}=w.useContext(Do),u=Jt(pV)===Ne.LOADING,g=()=>{i&&r&&A(Wl({id:n,conversationId:i,externalResourceId:r})).unwrap().then(()=>{l(dL,{connector_name:a,conversation_id:i}),t(!1),o(),no({message:Aj,type:Hi})}).catch(()=>{no({message:lj,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:YR}),v.jsx(We,{variant:"body2",children:GR}),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})]})]})})},hV=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;let b=d;m&&(b=`${b}_${m}`);const E=(r==null?void 0:r[b])===Ne.LOADING,Q=(ca(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?EL:CL;o&&d&&c&&y(Ca({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(Ca({id:U,email:o,conversationId:c,isRefresh:!0,externalResourceId:m})).unwrap().then(()=>{l(nL,{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?tL:eL,{id:U}),g(M=>!M)},D=O=>{O.stopPropagation();const U=O.currentTarget.offsetWidth<O.currentTarget.scrollWidth;h(!!U)};return v.jsxs(eU,{"data-testid":`test_${d}`,children:[v.jsxs(tU,{className:u?"hiver-card-expanded":"",children:[v.jsx(Zt,{title:C?I:"",placement:"bottom",children:v.jsx(nU,{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:dj})})}):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,b),children:v.jsx(dg,{className:u?"":"hiver-up"})})})]})]}),v.jsx(J2,{id:b,cardTitle:t.title,specificCardData:n,specificConnectorApiStatus:r,isOpen:u}),v.jsx(IV,{showUnlinkModal:f,setShowUnlinkModal:p,cardId:d,onCardUnlinking:a,conversationId:c,externalResourceId:m,connectorName:B})]})},BV="Bring your favourite tools into Hiver",mV="Plugin image",QV="Integrate tools like Salesforce, HubSpot, and Shopify to boost productivity",bV="Enable Connectors",Gh="app/custom-connectors",vV="Learn more",yV="https://help.hiverhq.com/custom-connectors/hiver-s-custom-connectors",wV="Contact your admin to enable this",xV="https://youtu.be/ODcJnzZLb50",TV="https://i.ytimg.com/vi/ODcJnzZLb50/maxresdefault.jpg",FV="Explore connectors",kV=j(Le)`
2390
2390
  width: 250px;
2391
2391
  height: 97px;
2392
2392
  background-color: ${De.palette.purple.light};
@@ -2639,7 +2639,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
2639
2639
  width: 40px;
2640
2640
  height: 40px;
2641
2641
  }
2642
- `,qz=e=>x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:41,height:41,viewBox:"0 0 41 41",fill:"none",...e},x.createElement("g",{clipPath:"url(#clip0_5805_11979)"},x.createElement("path",{d:"M20.5001 3.41663C11.0701 3.41663 3.41675 11.07 3.41675 20.5C3.41675 29.93 11.0701 37.5833 20.5001 37.5833C29.9301 37.5833 37.5834 29.93 37.5834 20.5C37.5834 11.07 29.9301 3.41663 20.5001 3.41663ZM17.0834 28.1875V12.8125L27.3334 20.5L17.0834 28.1875Z",fill:"#4D596C"})),x.createElement("defs",null,x.createElement("clipPath",{id:"clip0_5805_11979"},x.createElement("rect",{width:41,height:41,fill:"white"})))),$z=e=>{const[t,n]=w.useState(!1);return t?null:v.jsxs(_z,{children:[v.jsx("img",{className:"preview-img",onError:()=>n(!0),...e}),v.jsx(qz,{className:"play-icon"})]})},eY=({isAdmin:e=!0})=>{const{sendTrackingEvent:t,availableFeatures:n}=w.useContext(Do),o=ca(n,RR),r=A=>{var l,c;A.stopPropagation(),t(qR),(c=(l=window==null?void 0:window.grexit)==null?void 0:l.iframeHandler)==null||c.openIframe(Gh,!0)},i=A=>{A.stopPropagation(),t($R),window.open(yV,"_blank")},a=()=>{t(BL,{source:"main_tab"})};return v.jsxs("div",{"data-testid":"noConnectors",children:[o?v.jsx(OV,{onClick:a,href:xV,target:"_blank",children:v.jsx($z,{src:TV,alt:FV})}):v.jsxs(kV,{children:[v.jsx(SV,{variant:"body1_medium",children:BV}),v.jsx("img",{src:LV,alt:mV})]}),v.jsx(MV,{variant:"body2",children:QV}),e?v.jsx(Xh,{endIcon:v.jsx(po.ArrowForward,{}),onClick:r,children:bV}):v.jsxs(v.Fragment,{children:[v.jsx(Xh,{onClick:i,children:vV}),v.jsxs(DV,{direction:"row",children:[v.jsx(PV,{}),v.jsx(RV,{variant:"caption",children:wV})]})]})]})},tY=()=>v.jsxs(z2,{children:[v.jsxs(Le,{direction:"row",marginBottom:"12px",height:"36px",alignItems:"center",children:[v.jsx(H2,{}),v.jsx(W2,{variant:"h2",children:"Connectors"})]}),v.jsxs(Le,{gap:"12px",children:[v.jsx(Rr,{variant:"rounded",width:"100%",height:"46px",animation:"wave"}),v.jsx(Rr,{variant:"rounded",width:"100%",height:"46px",animation:"wave"}),v.jsx(Rr,{variant:"rounded",width:"100%",height:"46px",animation:"wave"})]})]}),nY=()=>{const{metaData:e,sendTrackingEvent:t,isAdmin:n}=w.useContext(Do),[o,r]=w.useState(!1),i=w.useRef(null),[a,A]=w.useState(0),{templateUpdates:l}=e||{},{sections:c=[],actionButtons:u=[],title:g}=l||{},{version:C=""}=l||{},h=_R(C),f=w.useMemo(()=>JR(C),[C]),p=w.useMemo(()=>(u==null?void 0:u.filter(({isAdminPanelLink:B})=>!(!n&&B)))??[],[u,n]);if(w.useEffect(()=>{!f&&l&&sg(C,!0)},[f,C,l]),w.useLayoutEffect(()=>{var B;(B=i.current)!=null&&B.scrollHeight&&A(i.current.scrollHeight)},[i]),w.useEffect(()=>{l&&!h&&t(rL,{update_version_id:C})},[]),!l||h)return null;const d=B=>{var b;B.stopPropagation(),r(E=>!E),(b=i.current)!=null&&b.scrollHeight&&A(i.current.scrollHeight),sg(C,!1,!0)},I=(B,b="",E=!1,Q=!1)=>{var y,T,k;if(B.stopPropagation(),E&&Q?t(iL,{update_version_id:C}):Q&&t(sL,{update_version_id:C}),!E&&b){(y=window.open(b,"_blank"))==null||y.focus();return}m(B,!1),(k=(T=window==null?void 0:window.grexit)==null?void 0:T.iframeHandler)==null||k.openIframe(b??Gh,!0)},m=(B,b=!0)=>{B.stopPropagation(),sg(C,!1),r(!1),b&&t(aL,{update_version_id:C})};return v.jsxs(fU,{children:[v.jsxs(pU,{children:[v.jsx(gU,{variant:"h3",children:g}),v.jsxs(dt,{children:[o?v.jsx(Zt,{title:HR,placement:"bottom",children:v.jsx($t,{onClick:m,children:v.jsx(po.Close,{sx:{height:"16px",width:"16px",opacity:"0.8"}})})}):null,v.jsx(Zt,{title:o?VR:og,placement:"bottom",children:v.jsx(ji,{onClick:d,children:v.jsx(dg,{className:o?"":"hiver-up"})})})]})]}),v.jsx(CU,{className:o?"slideDown":"slideUp",ref:i,height:a,children:v.jsxs(EU,{children:[c.map(({title:B,items:b,type:E})=>v.jsxs(QU,{children:[v.jsx(We,{variant:"body2_medium",children:B}),b.map(Q=>{const y=E===XR,{deeplink:T,textHtml:k,imageUrl:S}=Q,D=()=>v.jsx(iU,{className:y?"":"ellipsisClass",component:"div",variant:"body2",dangerouslySetInnerHTML:{__html:k}});return v.jsx(IU,{component:"ul",children:v.jsxs(hU,{component:y?"li":"div",marginLeft:S?"0":"14px",children:[S?v.jsx("img",{src:S}):null,T?v.jsx(X2,{target:"_blank",underline:"none",onClick:O=>I(O,T),fontSize:"13px",children:D()}):D()]})},k)})]},B)),v.jsx(Le,{flexDirection:"row",gap:"8px",marginBottom:"11.5px",children:p.map(({text:B,link:b,isAdminPanelLink:E})=>v.jsx(BU,{variant:E?"contained":"text",children:v.jsx(mU,{variant:"caption",onClick:Q=>I(Q,b,E,!0),children:B})},B))})]})})]})},oY=j(Qo)`
2642
+ `,qz=e=>x.createElement("svg",{width:35,height:35,viewBox:"0 0 35 35",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.createElement("rect",{x:9,y:9,width:15,height:17,fill:"white"}),x.createElement("g",{clipPath:"url(#clip0_7787_114457)"},x.createElement("path",{d:"M17.1981 2.86633C9.28704 2.86633 2.86646 9.28691 2.86646 17.198C2.86646 25.1091 9.28704 31.5296 17.1981 31.5296C25.1092 31.5296 31.5298 25.1091 31.5298 17.198C31.5298 9.28691 25.1092 2.86633 17.1981 2.86633ZM14.3318 23.6472V10.7487L22.9308 17.198L14.3318 23.6472Z",fill:"#4D596C"})),x.createElement("defs",null,x.createElement("clipPath",{id:"clip0_7787_114457"},x.createElement("rect",{width:34.396,height:34.396,fill:"white"})))),$z=e=>{const[t,n]=w.useState(!1);return t?null:v.jsxs(_z,{children:[v.jsx("img",{className:"preview-img",onError:()=>n(!0),...e}),v.jsx(qz,{className:"play-icon"})]})},eY=({isAdmin:e=!0})=>{const{sendTrackingEvent:t,availableFeatures:n}=w.useContext(Do),o=ca(n,RR),r=A=>{var l,c;A.stopPropagation(),t(qR),(c=(l=window==null?void 0:window.grexit)==null?void 0:l.iframeHandler)==null||c.openIframe(Gh,!0)},i=A=>{A.stopPropagation(),t($R),window.open(yV,"_blank")},a=()=>{t(BL,{source:"main_tab"})};return v.jsxs("div",{"data-testid":"noConnectors",children:[o?v.jsx(OV,{onClick:a,href:xV,target:"_blank",children:v.jsx($z,{src:TV,alt:FV})}):v.jsxs(kV,{children:[v.jsx(SV,{variant:"body1_medium",children:BV}),v.jsx("img",{src:LV,alt:mV})]}),v.jsx(MV,{variant:"body2",children:QV}),e?v.jsx(Xh,{endIcon:v.jsx(po.ArrowForward,{}),onClick:r,children:bV}):v.jsxs(v.Fragment,{children:[v.jsx(Xh,{onClick:i,children:vV}),v.jsxs(DV,{direction:"row",children:[v.jsx(PV,{}),v.jsx(RV,{variant:"caption",children:wV})]})]})]})},tY=()=>v.jsxs(z2,{children:[v.jsxs(Le,{direction:"row",marginBottom:"12px",height:"36px",alignItems:"center",children:[v.jsx(H2,{}),v.jsx(W2,{variant:"h2",children:"Connectors"})]}),v.jsxs(Le,{gap:"12px",children:[v.jsx(Rr,{variant:"rounded",width:"100%",height:"46px",animation:"wave"}),v.jsx(Rr,{variant:"rounded",width:"100%",height:"46px",animation:"wave"}),v.jsx(Rr,{variant:"rounded",width:"100%",height:"46px",animation:"wave"})]})]}),nY=()=>{const{metaData:e,sendTrackingEvent:t,isAdmin:n}=w.useContext(Do),[o,r]=w.useState(!1),i=w.useRef(null),[a,A]=w.useState(0),{templateUpdates:l}=e||{},{sections:c=[],actionButtons:u=[],title:g}=l||{},{version:C=""}=l||{},h=_R(C),f=w.useMemo(()=>JR(C),[C]),p=w.useMemo(()=>(u==null?void 0:u.filter(({isAdminPanelLink:B})=>!(!n&&B)))??[],[u,n]);if(w.useEffect(()=>{!f&&l&&sg(C,!0)},[f,C,l]),w.useLayoutEffect(()=>{var B;(B=i.current)!=null&&B.scrollHeight&&A(i.current.scrollHeight)},[i]),w.useEffect(()=>{l&&!h&&t(rL,{update_version_id:C})},[]),!l||h)return null;const d=B=>{var b;B.stopPropagation(),r(E=>!E),(b=i.current)!=null&&b.scrollHeight&&A(i.current.scrollHeight),sg(C,!1,!0)},I=(B,b="",E=!1,Q=!1)=>{var y,T,k;if(B.stopPropagation(),E&&Q?t(iL,{update_version_id:C}):Q&&t(sL,{update_version_id:C}),!E&&b){(y=window.open(b,"_blank"))==null||y.focus();return}m(B,!1),(k=(T=window==null?void 0:window.grexit)==null?void 0:T.iframeHandler)==null||k.openIframe(b??Gh,!0)},m=(B,b=!0)=>{B.stopPropagation(),sg(C,!1),r(!1),b&&t(aL,{update_version_id:C})};return v.jsxs(fU,{children:[v.jsxs(pU,{children:[v.jsx(gU,{variant:"h3",children:g}),v.jsxs(dt,{children:[o?v.jsx(Zt,{title:HR,placement:"bottom",children:v.jsx($t,{onClick:m,children:v.jsx(po.Close,{sx:{height:"16px",width:"16px",opacity:"0.8"}})})}):null,v.jsx(Zt,{title:o?VR:og,placement:"bottom",children:v.jsx(ji,{onClick:d,children:v.jsx(dg,{className:o?"":"hiver-up"})})})]})]}),v.jsx(CU,{className:o?"slideDown":"slideUp",ref:i,height:a,children:v.jsxs(EU,{children:[c.map(({title:B,items:b,type:E})=>v.jsxs(QU,{children:[v.jsx(We,{variant:"body2_medium",children:B}),b.map(Q=>{const y=E===XR,{deeplink:T,textHtml:k,imageUrl:S}=Q,D=()=>v.jsx(iU,{className:y?"":"ellipsisClass",component:"div",variant:"body2",dangerouslySetInnerHTML:{__html:k}});return v.jsx(IU,{component:"ul",children:v.jsxs(hU,{component:y?"li":"div",marginLeft:S?"0":"14px",children:[S?v.jsx("img",{src:S}):null,T?v.jsx(X2,{target:"_blank",underline:"none",onClick:O=>I(O,T),fontSize:"13px",children:D()}):D()]})},k)})]},B)),v.jsx(Le,{flexDirection:"row",gap:"8px",marginBottom:"11.5px",children:p.map(({text:B,link:b,isAdminPanelLink:E})=>v.jsx(BU,{variant:E?"contained":"text",children:v.jsx(mU,{variant:"caption",onClick:Q=>I(Q,b,E,!0),children:B})},B))})]})})]})},oY=j(Qo)`
2643
2643
  width: 100%;
2644
2644
  height: 100%;
2645
2645
  position: absolute;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiver/connector-agent",
3
- "version": "1.5.2-beta.1",
3
+ "version": "1.5.2-beta.2",
4
4
  "main": "index.es.js",
5
5
  "module": "index.es.js",
6
6
  "types": "index.d.ts",