@hiver/connector-agent 1.3.4-beta.23 → 1.3.4-beta.25
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":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/write-form/components/write-form/index.tsx"],"names":[],"mappings":"AAiCA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGrD,UAAU,cAAc;IACtB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/write-form/components/write-form/index.tsx"],"names":[],"mappings":"AAiCA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGrD,UAAU,cAAc;IACtB,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC;CACzE;AACD,QAAA,MAAM,SAAS,8CAA+C,cAAc,4CA6S3E,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/index.es.js
CHANGED
|
@@ -36226,9 +36226,9 @@ const Hi = "success", is = "error", uh = "Some error occured. Please contact sup
|
|
|
36226
36226
|
const t = {};
|
|
36227
36227
|
return e.forEach((n) => {
|
|
36228
36228
|
var o, r, i, s, A, l;
|
|
36229
|
-
if (t[n.name] = {}, (o = n.validations) != null && o.isRequired && (typeof n.validations.isRequired == "object" ? t[n.name].isRequired = Uj(n.validations.isRequired.msg) : t[n.name].isRequired = !0), n.type === "date"
|
|
36230
|
-
let c = typeof n.validations.disableFuture == "object" ? n.validations.disableFuture.msg : "";
|
|
36231
|
-
c = typeof n.validations.disablePast == "object" ? n.validations.disablePast.msg : c, t[n.name].validate = Nj(c);
|
|
36229
|
+
if (t[n.name] = {}, (o = n.validations) != null && o.isRequired && (typeof n.validations.isRequired == "object" ? t[n.name].isRequired = Uj(n.validations.isRequired.msg) : t[n.name].isRequired = !0), n.type === "date") {
|
|
36230
|
+
let c = typeof ((r = n.validations) == null ? void 0 : r.disableFuture) == "object" ? n.validations.disableFuture.msg : "";
|
|
36231
|
+
c = typeof ((i = n.validations) == null ? void 0 : i.disablePast) == "object" ? n.validations.disablePast.msg : c, t[n.name].validate = Nj(c);
|
|
36232
36232
|
return;
|
|
36233
36233
|
}
|
|
36234
36234
|
if (n.type === "number" && ((s = n.validations) != null && s.range)) {
|
|
@@ -40142,6 +40142,7 @@ function Mz(e) {
|
|
|
40142
40142
|
{
|
|
40143
40143
|
inputFormat: e.inputFormat ? e.inputFormat : tm.DATE,
|
|
40144
40144
|
...e,
|
|
40145
|
+
value: e.value || null,
|
|
40145
40146
|
open: t,
|
|
40146
40147
|
onOpen: () => n(!0),
|
|
40147
40148
|
onClose: () => n(!1),
|
|
@@ -40149,37 +40150,33 @@ function Mz(e) {
|
|
|
40149
40150
|
PopperProps: {
|
|
40150
40151
|
anchorEl: o.current
|
|
40151
40152
|
},
|
|
40152
|
-
renderInput: (i) =>
|
|
40153
|
-
|
|
40154
|
-
|
|
40155
|
-
|
|
40156
|
-
|
|
40157
|
-
|
|
40158
|
-
|
|
40159
|
-
|
|
40160
|
-
|
|
40161
|
-
|
|
40162
|
-
|
|
40163
|
-
|
|
40164
|
-
|
|
40165
|
-
|
|
40166
|
-
|
|
40167
|
-
|
|
40168
|
-
|
|
40169
|
-
|
|
40170
|
-
|
|
40171
|
-
|
|
40172
|
-
sx: {
|
|
40173
|
-
"& .MuiOutlinedInput-root": {
|
|
40174
|
-
backgroundColor: "#FFFFFF"
|
|
40175
|
-
}
|
|
40176
|
-
},
|
|
40177
|
-
onClick: () => {
|
|
40178
|
-
t || n(!0);
|
|
40153
|
+
renderInput: (i) => /* @__PURE__ */ v.jsx(
|
|
40154
|
+
VI,
|
|
40155
|
+
{
|
|
40156
|
+
...i,
|
|
40157
|
+
fullWidth: !0,
|
|
40158
|
+
variant: "outlined",
|
|
40159
|
+
disabled: e.disabled,
|
|
40160
|
+
inputRef: o,
|
|
40161
|
+
inputProps: {
|
|
40162
|
+
...i.inputProps,
|
|
40163
|
+
placeholder: e.placeholder
|
|
40164
|
+
},
|
|
40165
|
+
onBlur: e.onBlur,
|
|
40166
|
+
onFocus: e.onFocus,
|
|
40167
|
+
InputProps: {
|
|
40168
|
+
endAdornment: /* @__PURE__ */ v.jsx(qd, { position: "end", sx: { backgroundColor: "#FFFFFF" }, children: /* @__PURE__ */ v.jsx(rr.CalendarTodayOutlinedIcon, {}) })
|
|
40169
|
+
},
|
|
40170
|
+
sx: {
|
|
40171
|
+
"& .MuiOutlinedInput-root": {
|
|
40172
|
+
backgroundColor: "#FFFFFF"
|
|
40179
40173
|
}
|
|
40174
|
+
},
|
|
40175
|
+
onClick: () => {
|
|
40176
|
+
t || n(!0);
|
|
40180
40177
|
}
|
|
40181
|
-
|
|
40182
|
-
|
|
40178
|
+
}
|
|
40179
|
+
)
|
|
40183
40180
|
}
|
|
40184
40181
|
);
|
|
40185
40182
|
}
|
|
@@ -40228,7 +40225,7 @@ const ul = (e) => {
|
|
|
40228
40225
|
}, F = (R, U) => {
|
|
40229
40226
|
c == null || c(R, U), R && !d && E(!0), R && typeof R == "object" && "value" in R && d && A && I(R.value);
|
|
40230
40227
|
}, O = (R, U) => {
|
|
40231
|
-
u == null || u(i, R, U),
|
|
40228
|
+
u == null || u(i, R, U), R && !d && E(!0), d && A && I(R);
|
|
40232
40229
|
}, S = (R) => {
|
|
40233
40230
|
switch (R.type) {
|
|
40234
40231
|
case "select":
|
|
@@ -40716,7 +40713,7 @@ const ul = (e) => {
|
|
|
40716
40713
|
args: W,
|
|
40717
40714
|
interfaceId: L,
|
|
40718
40715
|
successCallback: () => {
|
|
40719
|
-
e(), t();
|
|
40716
|
+
e(!1), t();
|
|
40720
40717
|
}
|
|
40721
40718
|
})
|
|
40722
40719
|
).unwrap().then(() => {
|
|
@@ -40785,7 +40782,7 @@ const ul = (e) => {
|
|
|
40785
40782
|
{
|
|
40786
40783
|
variant: "outlined",
|
|
40787
40784
|
color: "tertiary",
|
|
40788
|
-
onClick: e,
|
|
40785
|
+
onClick: () => e(!0),
|
|
40789
40786
|
disabled: f === Le.LOADING,
|
|
40790
40787
|
children: Dg
|
|
40791
40788
|
}
|
|
@@ -40845,8 +40842,8 @@ const ul = (e) => {
|
|
|
40845
40842
|
l(!0), o(UN);
|
|
40846
40843
|
}, S = () => {
|
|
40847
40844
|
u(!0), o(NN);
|
|
40848
|
-
}, R = (P) => {
|
|
40849
|
-
o(P, g), (g == null ? void 0 : g.fields_filled) !== void 0 && g.fields_filled > 0 ? f(!0) : l(!1);
|
|
40845
|
+
}, R = (P, L) => {
|
|
40846
|
+
o(P, g), (g == null ? void 0 : g.fields_filled) !== void 0 && g.fields_filled > 0 && L ? f(!0) : l(!1);
|
|
40850
40847
|
}, M = [
|
|
40851
40848
|
{
|
|
40852
40849
|
label: "Go back",
|
|
@@ -40915,13 +40912,13 @@ const ul = (e) => {
|
|
|
40915
40912
|
/* @__PURE__ */ v.jsx(
|
|
40916
40913
|
pp,
|
|
40917
40914
|
{
|
|
40918
|
-
onClose: () => R(YN),
|
|
40915
|
+
onClose: () => R(YN, !0),
|
|
40919
40916
|
containerRef: x,
|
|
40920
40917
|
isOpen: A,
|
|
40921
40918
|
children: /* @__PURE__ */ v.jsx(
|
|
40922
40919
|
Hz,
|
|
40923
40920
|
{
|
|
40924
|
-
onClose: () => R(zN),
|
|
40921
|
+
onClose: (P) => R(zN, P),
|
|
40925
40922
|
onCreateSuccess: F,
|
|
40926
40923
|
setMetaData: C
|
|
40927
40924
|
}
|
package/index.umd.js
CHANGED
|
@@ -2333,7 +2333,7 @@ Take a look at the reducer(s) handling this action type: ${B.type}.
|
|
|
2333
2333
|
fill: #ffffff;
|
|
2334
2334
|
width: 10px;
|
|
2335
2335
|
}
|
|
2336
|
-
`,dN=(e,{closeToast:t})=>v.jsx(uN,{children:v.jsx("img",{src:aN,onClick:t})}),Rl=({message:e})=>v.jsxs(AN,{children:[v.jsx(cN,{}),v.jsx(lN,{children:e})]});function no(e){const{message:t,type:n,autoClose:o}=e,r={closeButton:v.jsx(dN,{}),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(Rl,{message:t}),{...r,icon:!1});break}case"error":{i=ot.error(v.jsx(Rl,{message:t}),{...r,icon:!1});break}case"info-dark":{i=ot.info(v.jsx(Rl,{message:t}),{...r,icon:!1,className:"toast_dark"});break}default:{i=ot.info(v.jsx(Rl,{message:t}),{...r,icon:!1});break}}return setTimeout(()=>{gN(i)},o&&!isNaN(o)?Number(o):5e3),i}function gN(e){ot.dismiss(e)}const Hi="success",Ca="error",xB="Some error occured. Please contact support@hiverhq.com",TB="Card refreshed successfully",fN="Card unlinked successfully",pN="Failed to unlink the card",FB=Q2({name:"connectorCardLibrary",initialState:QR,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(Ll.pending,t=>{t.connectorApiStatus=Re.LOADING}).addCase(Ll.fulfilled,(t,n)=>{t.connectorApiStatus=Re.IDLE,t.connectorCards=n.payload.cards,t.connectorsEnabled=n.payload.connectorsEnabled}).addCase(Ll.rejected,t=>{t.connectorApiStatus=Re.FAILED}).addCase(Wi.pending,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg,i=`${o}_${r}`;t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Re.LOADING}}).addCase(Wi.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]:Re.IDLE}}).addCase(Wi.rejected,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg,i=`${o}_${r}`;t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Re.FAILED}})}}),Ll=nr("connectorCardLibrary/fetchAllCard",async({inboxIds:e,channelType:t,conversationId:n})=>{var A;const o=await eN({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}}),Wi=nr("connectorCardLibrary/fetchSpecificCard",async({id:e,email:t,conversationId:n,isRefresh:o,externalResourceId:r})=>{const i=await tN(e,t,n,r),a=i==null?void 0:i.data;if(!a)return o&&no({message:xB,type:Ca}),{data:{}};if(o&&no({message:TB,type:Hi}),a.cardType==="flat"){const A=a.data.flatDisplay.filter(l=>Number(l.statusCode)!==Vd.NOT_FOUND).sort((l,c)=>(l==null?void 0:l.priority)-(c==null?void 0:c.priority));a.data.flatDisplay=A}else{const A=a.data.listItems.fields.map(l=>l.sort((c,u)=>(c==null?void 0:c.priority)-(u==null?void 0:u.priority)));a.data.listItems.fields=A}return{data:a}}),CN=FB.reducer,EN=FB.actions,kB="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",IN="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",BN={email:"",baseUrls:{},currentSmIds:[],metaData:void 0,availableFeatures:{},sendTrackingEvent:()=>{},conversationId:void 0},ir=w.createContext(BN),hN="enable_connectors_clicked",mN="learn_more_clicked",QN="connector_card_expand_clicked",bN="connector_card_collapsed_clicked",vN="connector_card_refresh_clicked",yN="connector_cards_loaded",wN="connector_whats_new_card_viewed",xN="connector_whats_new_explore_now_clicked",TN="connector_whats_new_learn_more_clicked",FN="connector_whats_new_dismissed",kN="connector_create_new_object_clicked",SN="connector_link_new_object_clicked",ON="connector_new_object_created_by_form",MN="connector_new_object_linked_by_form",DN="connector_object_unlinked_by_form",PN="connector_link_preview_clicked",RN="connector_create_panel_cancel_clicked",LN="connector_create_panel_back_clicked",SB={createObjectList:[],linkObjectList:[],objectDict:null,formFields:null,previewCardData:null,objectListApiStatus:Re.IDLE,unlinkCardApiStatus:Re.IDLE,linkCardApiStatus:Re.IDLE,previewCardApiStatus:Re.IDLE,optionsMap:null,dropdownOptionsApis:Re.IDLE,dependentFieldsMap:{},createFormApiStatus:Re.IDLE},bg=e=>{let t=localStorage.getItem(ll);return t=t?JSON.parse(t):!1,t==null?void 0:t[e]},UN=e=>!!bg(e),OB=()=>String(b2()),NN=(e,t=OB())=>{const n=bg(e);return((n==null?void 0:n.isExtensionNew)??[]).includes(t)},MB=(e,t=!1)=>{const n=OB(),o=bg(e);if(t||!o){localStorage.removeItem(ll);const r={[e]:{isExtensionNew:[...t?[]:[n]]}};localStorage.setItem(ll,JSON.stringify(r));return}else{const r=(o==null?void 0:o.isExtensionNew)??[],i={[e]:{...o,isExtensionNew:[...new Set([...r,n])]}};localStorage.setItem(ll,JSON.stringify(i));return}},vg=(e={},t)=>(e==null?void 0:e[t])===!0,DB=(e,t)=>e.replace(/:(\w+)/g,(n,o)=>String(t[o])||""),zi="/v1/api",jN=`${zi}/connectors/forms/list`,VN=`${zi}/connectors/cards/:id/unlink`,HN=`${zi}/connectors/forms/:id/link`,WN=`${zi}/connectors/forms/:id/preview`,zN=`${zi}/connectors/forms/:formId/field/:fieldName/data`,YN=`${zi}/connectors/form/:formId`,GN=({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)),Ro({url:`${jN}?${o.toString()}`,method:er.GET})},XN=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),Ro({url:DB(`${zN}?${o.toString()}`,e),method:er.POST,data:t})},KN=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),Ro({url:DB(`${YN}?${o.toString()}`,e),method:er.POST,data:t})},ZN=(e,t="email",n,o)=>{const r=new URLSearchParams;return r.append("channel_type",t),Ro({url:`${VN.replace(":id",e)}?${r.toString()}`,method:er.POST,data:{externalResourceId:n,conversationId:o}})},JN=(e,t,n="email",o)=>{const r=new URLSearchParams;return r.append("channel_type",n),Ro({url:`${HN.replace(":id",e)}?${r.toString()}`,method:er.POST,data:{externalResourceId:t,conversationId:o}})},_N=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),Ro({url:`${WN.replace(":id",e)}?${o.toString()}`,method:er.POST,data:{args:t}})},qN="Error in previewing the card",$N="Card linked successfully",ej="Error in linking the card",PB="Please enter a valid URL",tj="Please enter valid ID",nj="Please enter valid input",oj="URL must start with https://",rj="URL should not end with a slash",ij="Invalid email address",sj="Email must be a string",RB="Invalid date",aj="Date cannot be in the past",Aj="Date cannot be in the future",lj="Invalid number",cj="Invalid text",uj="New card created",dj="Card creation failed!!",gj="https://avatars.githubusercontent.com/u/62397590",fj="Create and link objects from different apps to this conversation",pj="Are you sure you want to change the primary object?",Cj="Changing the primary object will reset all the information you’ve entered and all data will be lost and can’t be recovered.",Ej="Are you sure you want to leave?",Ij="If you go back now, all the information you’ve entered will be lost and can’t be recovered. Do you want to continue?",Bj="Select an object to create",hj="Select an object to link",LB="Select object",mj="Paste URL or ID",Qj="Object ID/Link",bj="Required Field",vj="Invalid date",UB=/^https:\/\/([a-z0-9-]+(\.[a-z0-9-]+)+)(:[0-9]{1,5})?(\/[^\s/]*)*$/i,yj=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,wj=(e,t)=>t?Object.values(t).filter(o=>e.values[o]&&!e.errors[o]):[],xj=(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]),{...o,[r]:i}},{}):{},NB=(e,t,n)=>{let o=`${t}_${n}`;return Object.keys(e).forEach(r=>{o=`${o}_${r}:${e[r]}`}),o},Tj=e=>t=>{if(t&&typeof t=="string"){const n=t.replace(/\/$/,"");return n.startsWith("https://")?t.endsWith("/")?rj:UB.test(n)?!0:e||PB:oj}return!1},Fj=e=>t=>t&&typeof t=="string"?yj.test(t)?!0:e||ij:sj,kj=e=>t=>t==null||t===""?e||bj:!0,Sj=e=>(t,n)=>{if(!t||(t==null?void 0:t.toString())===vj)return RB;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||aj:a&&o>r?e||Aj:!0}return RB},Oj=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||lj},Mj=e=>(t,n)=>{if(typeof t=="string"){const o=n.maxCharacters;return o!==void 0&&t.length>o?e||`Maximum characters allowed are ${o}`:!0}return e||cj},Dj=e=>t=>typeof t=="string"?t.startsWith("https:")?UB.test(t)?!0:e||PB:t.trim().length>0?!0:e||tj:e||nj,Pj=({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=kj(n.validations.isRequired.msg):t[n.name].isRequired=!0),n.type==="date"&&((r=n.validations)!=null&&r.disableFuture||(i=n.validations)!=null&&i.disablePast)){let c=typeof n.validations.disableFuture=="object"?n.validations.disableFuture.msg:"";c=typeof n.validations.disablePast=="object"?n.validations.disablePast.msg:c,t[n.name].validate=Sj(c);return}if(n.type==="number"&&((a=n.validations)!=null&&a.range)){t[n.name].validate=Oj();return}if(n.type==="text"&&n.multiline&&n.maxCharacters){t[n.name].validate=Mj();return}if((A=n.validations)!=null&&A.isUrl){const c=typeof n.validations.isUrl=="object"?n.validations.isUrl.msg:"";t[n.name].validate=Tj(c)}else if((l=n.validations)!=null&&l.isEmail){const c=typeof n.validations.isEmail=="object"?n.validations.isEmail.msg:"";t[n.name].validate=Fj(c)}}),t},Rj=Q2({name:"writeCapability",initialState:SB,reducers:{resetState:()=>SB},extraReducers:e=>{e.addCase(Ul.pending,t=>{t.objectListApiStatus=Re.LOADING}).addCase(Ul.fulfilled,(t,n)=>{const{createObjectList:o,linkObjectList:r,formFields:i,objectDict:a,dependentFieldsMap:A}=n.payload;t.objectListApiStatus=Re.IDLE,t.createObjectList=o,t.linkObjectList=r,t.formFields=i,t.objectDict=a,t.dependentFieldsMap=A}).addCase(Ul.rejected,t=>{t.objectListApiStatus=Re.FAILED}).addCase(Nl.pending,t=>{t.dropdownOptionsApis=Re.LOADING}).addCase(Nl.fulfilled,(t,n)=>{const o=t.optionsMap||{},{optionsList:r,hasMore:i,currentPage:a,key:A}=n.payload;t.dropdownOptionsApis=Re.IDLE,t.optionsMap={...o,[A]:{options:r,hasMore:i,currentPage:a}}}).addCase(Nl.rejected,t=>{t.dropdownOptionsApis=Re.FAILED}).addCase(jl.pending,t=>{t.createFormApiStatus=Re.LOADING}).addCase(jl.fulfilled,t=>{t.createFormApiStatus=Re.IDLE}).addCase(jl.rejected,t=>{t.createFormApiStatus=Re.FAILED}).addCase(Hl.pending,t=>{t.linkCardApiStatus=Re.LOADING}).addCase(Hl.fulfilled,t=>{t.linkCardApiStatus=Re.IDLE}).addCase(Hl.rejected,t=>{t.linkCardApiStatus=Re.FAILED}).addCase(Vl.pending,t=>{t.unlinkCardApiStatus=Re.LOADING}).addCase(Vl.fulfilled,t=>{t.unlinkCardApiStatus=Re.IDLE}).addCase(Vl.rejected,t=>{t.unlinkCardApiStatus=Re.FAILED}).addCase(Ea.pending,t=>{t.previewCardApiStatus=Re.LOADING}).addCase(Ea.fulfilled,(t,n)=>{const{data:o}=n.payload;o&&(t.previewCardData=o),t.previewCardApiStatus=Re.IDLE}).addCase(Ea.rejected,t=>{t.previewCardApiStatus=Re.FAILED})}}),Ul=nr("writeCapability/fetchObjectList",async e=>{const{inboxIds:t,channelType:n,conversationId:o}=e,r=await GN({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 B,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"?A.push({value:g.id,label:g.name}):g.type==="link"&&l.push({value:g.id,label:g.name}),(B=g.fieldList)==null||B.sort((p,d)=>p.priority-d.priority),(f=g.fieldList)==null||f.forEach(p=>{var E,m,h,b,I,Q,y,T,k,S,O;let d={};switch(p.type){case"select":case"multi-select":{d={...p,defaultOptions:!!p.interfaceDetails,isInfiniteScrollable:((m=(E=p.interfaceDetails)==null?void 0:E.pagination)==null?void 0:m.enabled)||!1,loadOptionsOnFocus:Object.keys(((h=p.interfaceDetails)==null?void 0:h.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:!!((I=p.validations)!=null&&I.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,maxCharacters:((O=p.validations)==null?void 0:O.maxCharacters)||250,rows:5,multiline:!0};break}default:d={...p}}"value"in d&&(d.defaultValue=d.value,delete d.value),c[g.id]=[...c[g.id],d],p.interfaceDetails&&p.interfaceDetails.args&&Object.values(p.interfaceDetails.args).forEach(D=>{a[g.id][D]?a[g.id][D]=[...a[g.id][D],p.name]:a[g.id][D]=[p.name]})})}),{createObjectList:A,linkObjectList:l,formFields:c,objectDict:u,dependentFieldsMap:a}}),Nl=nr("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=NB(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:B=[],hasMore:f=!0,currentPage:p=0}=((h=g.optionsMap)==null?void 0:h[u])||{},{enabled:d,limit:E}=c,m=E||10;try{let b;const I=d?{pageNumber:p+1,limit:m}:null;if(f?b=await XN({fieldName:o,formId:r},{pagination:I||{},args:A,interfaceId:l}):a==null||a(B),!b||!b.data||!("data"in b.data)||!Array.isArray(b.data.data))return{optionsList:[...B],fieldName:"",formId:"",hasMore:!1,currentPage:p,key:u};const y=b.data.data.map(S=>C?{...S,avatarUrl:S.avatarUrl||gj}:{label:S.label,value:S.value}),T=d?y.length>=m:!1,k=[...B,...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(B),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=NB(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}}),jl=nr("writeCapability/createForm",async(e,{rejectWithValue:t})=>{const{formId:n,successCallback:o,failureCallback:r,args:i={},interfaceId:a,conversationId:A}=e;try{await KN({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:dj,type:Ca}),t(l)}}),Vl=nr("writeCapability/unlinkCard",async({id:e,channelType:t,externalResourceId:n,conversationId:o})=>{await ZN(e,t,n,o)}),Hl=nr("writeCapability/linkCard",async({id:e,externalResourceId:t,channelType:n,conversationId:o})=>{await JN(e,t,n,o)}),Ea=nr("writeCapability/previewCard",async({id:e,args:t,channelType:n,isRefresh:o})=>{const r=await _N(e,t,n),i=r==null?void 0:r.data;if(!i)return o&&no({message:xB,type:Ca}),{data:null};if(o&&no({message:TB,type:Hi}),i.cardType==="flat"){const a=i.data.flatDisplay.filter(A=>Number(A.statusCode)!==Vd.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}}),Lj=Rj.reducer,jB=e=>e.write.createObjectList,VB=e=>e.write.linkObjectList,Uj=e=>e.write.objectDict,Nj=e=>e.write.formFields,jj=e=>e.write.previewCardData,Vj=e=>e.write.previewCardApiStatus,Hj=e=>e.write.linkCardApiStatus,Wj=e=>e.write.unlinkCardApiStatus,zj=e=>e.write.dependentFieldsMap,Yj=e=>e.write.createFormApiStatus,Gj=({showUnlinkModal:e,setShowUnlinkModal:t,cardId:n,onCardUnlinking:o,externalResourceId:r,conversationId:i,connectorName:a})=>{const A=Di(),{sendTrackingEvent:l}=w.useContext(ir),u=Jt(Wj)===Re.LOADING,g=()=>{i&&r&&A(Vl({id:n,conversationId:i,externalResourceId:r})).unwrap().then(()=>{l(DN,{connector_name:a,conversation_id:i}),t(!1),o(),no({message:fN,type:Hi})}).catch(()=>{no({message:pN,type:Hi})})};return v.jsx(jd,{shown:e,setShown:t,showCloseButton:!0,children:v.jsxs(ze,{width:"400px",padding:"20px",gap:"8px",children:[v.jsx(Ke,{variant:"h2",children:xD}),v.jsx(Ke,{variant:"body2",children:TD}),v.jsxs(ze,{direction:"row",gap:"8px",marginTop:"20px",justifyContent:"flex-end",children:[v.jsx(zt,{variant:"text",onClick:()=>t(!1),children:Ud}),v.jsx(zt,{disabled:u,color:"error",onClick:g,children:FI})]})]})})},Xj=e=>{const{card:t,specificCardData:n,email:o,specificConnectorApiStatus:r,defaultOpenState:i=!1,onCardUnlinking:a}=e,{availableFeatures:A,sendTrackingEvent:l,conversationId:c}=w.useContext(ir),[u,g]=w.useState(!1),[C,B]=w.useState(!1),[f,p]=w.useState(!1),{id:d,title:E,externalResourceId:m="",connectorName:h=""}=t,b=`${d}_${m}`,I=(r==null?void 0:r[b])===Re.LOADING,Q=(vg(A,NI)&&(t==null?void 0:t.externalResourceId))??!1,y=Di();w.useEffect(()=>{g(!!i)},[i]),w.useEffect(()=>{o&&d&&c&&i&&y(Wi({id:d,email:o,conversationId:c,externalResourceId:m}))},[i,y,d,o,c,m]);const T=(O,D)=>{var M;O==null||O.stopPropagation(),y(Wi({id:D,email:o,conversationId:c,isRefresh:!0,externalResourceId:m})).unwrap().then(()=>{l(vN,{id:D})});const U=O.target.tagName==="BUTTON"?(M=O.target)==null?void 0:M.firstChild:O.target;U.className&&(U.className=""),setTimeout(()=>U.className="selected",1)},k=(O,D)=>{O.stopPropagation(),!(n!=null&&n[b])&&!I&&y(Wi({id:D,email:o,conversationId:c,externalResourceId:m})),l(u?bN:QN,{id:D}),g(U=>!U)},S=O=>{O.stopPropagation();const D=O.currentTarget.offsetWidth<O.currentTarget.scrollWidth;B(!!D)};return v.jsxs(kD,{"data-testid":`test_${d}`,children:[v.jsxs(SD,{className:u?"hiver-card-expanded":"",children:[v.jsx(Zt,{title:C?E:"",placement:"bottom",children:v.jsx(OD,{variant:"h4",onMouseOver:O=>S(O),onMouseLeave:O=>S(O),children:E})}),v.jsxs(PI,{children:[Q?v.jsx(Zt,{title:FI,placement:"bottom",children:v.jsx(Pi,{onClick:()=>p(!0),children:v.jsx("img",{src:IN})})}):null,u?v.jsx(Zt,{title:xI,placement:"bottom",children:v.jsx(Pi,{"data-testid":I?"loading":"reloadIcon",onClick:O=>T(O,d),className:I?"disabled":"",children:v.jsx("img",{src:kB})})}):null,v.jsx(Zt,{title:u?TI:Ld,placement:"bottom",children:v.jsx(Pi,{onClick:O=>k(O,d),children:v.jsx(Nd,{className:u?"":"hiver-up"})})})]})]}),v.jsx(VI,{id:b,cardTitle:t.title,specificCardData:n,specificConnectorApiStatus:r,isOpen:u}),v.jsx(Gj,{showUnlinkModal:f,setShowUnlinkModal:p,cardId:d,onCardUnlinking:a,conversationId:c,externalResourceId:m,connectorName:h})]})},Kj="Bring your favourite tools into Hiver",Zj="Plugin image",Jj="Integrate tools like Salesforce, HubSpot, and Shopify to boost productivity",_j="Enable Connectors",HB="app/custom-connectors",qj="Learn more",$j="https://help.hiverhq.com/custom-connectors/hiver-s-custom-connectors",eV="Contact your admin to enable this",tV=V(ze)`
|
|
2336
|
+
`,dN=(e,{closeToast:t})=>v.jsx(uN,{children:v.jsx("img",{src:aN,onClick:t})}),Rl=({message:e})=>v.jsxs(AN,{children:[v.jsx(cN,{}),v.jsx(lN,{children:e})]});function no(e){const{message:t,type:n,autoClose:o}=e,r={closeButton:v.jsx(dN,{}),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(Rl,{message:t}),{...r,icon:!1});break}case"error":{i=ot.error(v.jsx(Rl,{message:t}),{...r,icon:!1});break}case"info-dark":{i=ot.info(v.jsx(Rl,{message:t}),{...r,icon:!1,className:"toast_dark"});break}default:{i=ot.info(v.jsx(Rl,{message:t}),{...r,icon:!1});break}}return setTimeout(()=>{gN(i)},o&&!isNaN(o)?Number(o):5e3),i}function gN(e){ot.dismiss(e)}const Hi="success",Ca="error",xB="Some error occured. Please contact support@hiverhq.com",TB="Card refreshed successfully",fN="Card unlinked successfully",pN="Failed to unlink the card",FB=Q2({name:"connectorCardLibrary",initialState:QR,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(Ll.pending,t=>{t.connectorApiStatus=Re.LOADING}).addCase(Ll.fulfilled,(t,n)=>{t.connectorApiStatus=Re.IDLE,t.connectorCards=n.payload.cards,t.connectorsEnabled=n.payload.connectorsEnabled}).addCase(Ll.rejected,t=>{t.connectorApiStatus=Re.FAILED}).addCase(Wi.pending,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg,i=`${o}_${r}`;t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Re.LOADING}}).addCase(Wi.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]:Re.IDLE}}).addCase(Wi.rejected,(t,n)=>{const{id:o,externalResourceId:r=""}=n.meta.arg,i=`${o}_${r}`;t.specificConnectorApiStatus={...t.specificConnectorApiStatus??{},[i]:Re.FAILED}})}}),Ll=nr("connectorCardLibrary/fetchAllCard",async({inboxIds:e,channelType:t,conversationId:n})=>{var A;const o=await eN({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}}),Wi=nr("connectorCardLibrary/fetchSpecificCard",async({id:e,email:t,conversationId:n,isRefresh:o,externalResourceId:r})=>{const i=await tN(e,t,n,r),a=i==null?void 0:i.data;if(!a)return o&&no({message:xB,type:Ca}),{data:{}};if(o&&no({message:TB,type:Hi}),a.cardType==="flat"){const A=a.data.flatDisplay.filter(l=>Number(l.statusCode)!==Vd.NOT_FOUND).sort((l,c)=>(l==null?void 0:l.priority)-(c==null?void 0:c.priority));a.data.flatDisplay=A}else{const A=a.data.listItems.fields.map(l=>l.sort((c,u)=>(c==null?void 0:c.priority)-(u==null?void 0:u.priority)));a.data.listItems.fields=A}return{data:a}}),CN=FB.reducer,EN=FB.actions,kB="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",IN="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",BN={email:"",baseUrls:{},currentSmIds:[],metaData:void 0,availableFeatures:{},sendTrackingEvent:()=>{},conversationId:void 0},ir=w.createContext(BN),hN="enable_connectors_clicked",mN="learn_more_clicked",QN="connector_card_expand_clicked",bN="connector_card_collapsed_clicked",vN="connector_card_refresh_clicked",yN="connector_cards_loaded",wN="connector_whats_new_card_viewed",xN="connector_whats_new_explore_now_clicked",TN="connector_whats_new_learn_more_clicked",FN="connector_whats_new_dismissed",kN="connector_create_new_object_clicked",SN="connector_link_new_object_clicked",ON="connector_new_object_created_by_form",MN="connector_new_object_linked_by_form",DN="connector_object_unlinked_by_form",PN="connector_link_preview_clicked",RN="connector_create_panel_cancel_clicked",LN="connector_create_panel_back_clicked",SB={createObjectList:[],linkObjectList:[],objectDict:null,formFields:null,previewCardData:null,objectListApiStatus:Re.IDLE,unlinkCardApiStatus:Re.IDLE,linkCardApiStatus:Re.IDLE,previewCardApiStatus:Re.IDLE,optionsMap:null,dropdownOptionsApis:Re.IDLE,dependentFieldsMap:{},createFormApiStatus:Re.IDLE},bg=e=>{let t=localStorage.getItem(ll);return t=t?JSON.parse(t):!1,t==null?void 0:t[e]},UN=e=>!!bg(e),OB=()=>String(b2()),NN=(e,t=OB())=>{const n=bg(e);return((n==null?void 0:n.isExtensionNew)??[]).includes(t)},MB=(e,t=!1)=>{const n=OB(),o=bg(e);if(t||!o){localStorage.removeItem(ll);const r={[e]:{isExtensionNew:[...t?[]:[n]]}};localStorage.setItem(ll,JSON.stringify(r));return}else{const r=(o==null?void 0:o.isExtensionNew)??[],i={[e]:{...o,isExtensionNew:[...new Set([...r,n])]}};localStorage.setItem(ll,JSON.stringify(i));return}},vg=(e={},t)=>(e==null?void 0:e[t])===!0,DB=(e,t)=>e.replace(/:(\w+)/g,(n,o)=>String(t[o])||""),zi="/v1/api",jN=`${zi}/connectors/forms/list`,VN=`${zi}/connectors/cards/:id/unlink`,HN=`${zi}/connectors/forms/:id/link`,WN=`${zi}/connectors/forms/:id/preview`,zN=`${zi}/connectors/forms/:formId/field/:fieldName/data`,YN=`${zi}/connectors/form/:formId`,GN=({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)),Ro({url:`${jN}?${o.toString()}`,method:er.GET})},XN=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),Ro({url:DB(`${zN}?${o.toString()}`,e),method:er.POST,data:t})},KN=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),Ro({url:DB(`${YN}?${o.toString()}`,e),method:er.POST,data:t})},ZN=(e,t="email",n,o)=>{const r=new URLSearchParams;return r.append("channel_type",t),Ro({url:`${VN.replace(":id",e)}?${r.toString()}`,method:er.POST,data:{externalResourceId:n,conversationId:o}})},JN=(e,t,n="email",o)=>{const r=new URLSearchParams;return r.append("channel_type",n),Ro({url:`${HN.replace(":id",e)}?${r.toString()}`,method:er.POST,data:{externalResourceId:t,conversationId:o}})},_N=(e,t,n="email")=>{const o=new URLSearchParams;return o.append("channel_type",n),Ro({url:`${WN.replace(":id",e)}?${o.toString()}`,method:er.POST,data:{args:t}})},qN="Error in previewing the card",$N="Card linked successfully",ej="Error in linking the card",PB="Please enter a valid URL",tj="Please enter valid ID",nj="Please enter valid input",oj="URL must start with https://",rj="URL should not end with a slash",ij="Invalid email address",sj="Email must be a string",RB="Invalid date",aj="Date cannot be in the past",Aj="Date cannot be in the future",lj="Invalid number",cj="Invalid text",uj="New card created",dj="Card creation failed!!",gj="https://avatars.githubusercontent.com/u/62397590",fj="Create and link objects from different apps to this conversation",pj="Are you sure you want to change the primary object?",Cj="Changing the primary object will reset all the information you’ve entered and all data will be lost and can’t be recovered.",Ej="Are you sure you want to leave?",Ij="If you go back now, all the information you’ve entered will be lost and can’t be recovered. Do you want to continue?",Bj="Select an object to create",hj="Select an object to link",LB="Select object",mj="Paste URL or ID",Qj="Object ID/Link",bj="Required Field",vj="Invalid date",UB=/^https:\/\/([a-z0-9-]+(\.[a-z0-9-]+)+)(:[0-9]{1,5})?(\/[^\s/]*)*$/i,yj=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,wj=(e,t)=>t?Object.values(t).filter(o=>e.values[o]&&!e.errors[o]):[],xj=(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]),{...o,[r]:i}},{}):{},NB=(e,t,n)=>{let o=`${t}_${n}`;return Object.keys(e).forEach(r=>{o=`${o}_${r}:${e[r]}`}),o},Tj=e=>t=>{if(t&&typeof t=="string"){const n=t.replace(/\/$/,"");return n.startsWith("https://")?t.endsWith("/")?rj:UB.test(n)?!0:e||PB:oj}return!1},Fj=e=>t=>t&&typeof t=="string"?yj.test(t)?!0:e||ij:sj,kj=e=>t=>t==null||t===""?e||bj:!0,Sj=e=>(t,n)=>{if(!t||(t==null?void 0:t.toString())===vj)return RB;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||aj:a&&o>r?e||Aj:!0}return RB},Oj=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||lj},Mj=e=>(t,n)=>{if(typeof t=="string"){const o=n.maxCharacters;return o!==void 0&&t.length>o?e||`Maximum characters allowed are ${o}`:!0}return e||cj},Dj=e=>t=>typeof t=="string"?t.startsWith("https:")?UB.test(t)?!0:e||PB:t.trim().length>0?!0:e||tj:e||nj,Pj=({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=kj(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=Sj(c);return}if(n.type==="number"&&((a=n.validations)!=null&&a.range)){t[n.name].validate=Oj();return}if(n.type==="text"&&n.multiline&&n.maxCharacters){t[n.name].validate=Mj();return}if((A=n.validations)!=null&&A.isUrl){const c=typeof n.validations.isUrl=="object"?n.validations.isUrl.msg:"";t[n.name].validate=Tj(c)}else if((l=n.validations)!=null&&l.isEmail){const c=typeof n.validations.isEmail=="object"?n.validations.isEmail.msg:"";t[n.name].validate=Fj(c)}}),t},Rj=Q2({name:"writeCapability",initialState:SB,reducers:{resetState:()=>SB},extraReducers:e=>{e.addCase(Ul.pending,t=>{t.objectListApiStatus=Re.LOADING}).addCase(Ul.fulfilled,(t,n)=>{const{createObjectList:o,linkObjectList:r,formFields:i,objectDict:a,dependentFieldsMap:A}=n.payload;t.objectListApiStatus=Re.IDLE,t.createObjectList=o,t.linkObjectList=r,t.formFields=i,t.objectDict=a,t.dependentFieldsMap=A}).addCase(Ul.rejected,t=>{t.objectListApiStatus=Re.FAILED}).addCase(Nl.pending,t=>{t.dropdownOptionsApis=Re.LOADING}).addCase(Nl.fulfilled,(t,n)=>{const o=t.optionsMap||{},{optionsList:r,hasMore:i,currentPage:a,key:A}=n.payload;t.dropdownOptionsApis=Re.IDLE,t.optionsMap={...o,[A]:{options:r,hasMore:i,currentPage:a}}}).addCase(Nl.rejected,t=>{t.dropdownOptionsApis=Re.FAILED}).addCase(jl.pending,t=>{t.createFormApiStatus=Re.LOADING}).addCase(jl.fulfilled,t=>{t.createFormApiStatus=Re.IDLE}).addCase(jl.rejected,t=>{t.createFormApiStatus=Re.FAILED}).addCase(Hl.pending,t=>{t.linkCardApiStatus=Re.LOADING}).addCase(Hl.fulfilled,t=>{t.linkCardApiStatus=Re.IDLE}).addCase(Hl.rejected,t=>{t.linkCardApiStatus=Re.FAILED}).addCase(Vl.pending,t=>{t.unlinkCardApiStatus=Re.LOADING}).addCase(Vl.fulfilled,t=>{t.unlinkCardApiStatus=Re.IDLE}).addCase(Vl.rejected,t=>{t.unlinkCardApiStatus=Re.FAILED}).addCase(Ea.pending,t=>{t.previewCardApiStatus=Re.LOADING}).addCase(Ea.fulfilled,(t,n)=>{const{data:o}=n.payload;o&&(t.previewCardData=o),t.previewCardApiStatus=Re.IDLE}).addCase(Ea.rejected,t=>{t.previewCardApiStatus=Re.FAILED})}}),Ul=nr("writeCapability/fetchObjectList",async e=>{const{inboxIds:t,channelType:n,conversationId:o}=e,r=await GN({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 B,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"?A.push({value:g.id,label:g.name}):g.type==="link"&&l.push({value:g.id,label:g.name}),(B=g.fieldList)==null||B.sort((p,d)=>p.priority-d.priority),(f=g.fieldList)==null||f.forEach(p=>{var E,m,h,b,I,Q,y,T,k,S,O;let d={};switch(p.type){case"select":case"multi-select":{d={...p,defaultOptions:!!p.interfaceDetails,isInfiniteScrollable:((m=(E=p.interfaceDetails)==null?void 0:E.pagination)==null?void 0:m.enabled)||!1,loadOptionsOnFocus:Object.keys(((h=p.interfaceDetails)==null?void 0:h.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:!!((I=p.validations)!=null&&I.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,maxCharacters:((O=p.validations)==null?void 0:O.maxCharacters)||250,rows:5,multiline:!0};break}default:d={...p}}"value"in d&&(d.defaultValue=d.value,delete d.value),c[g.id]=[...c[g.id],d],p.interfaceDetails&&p.interfaceDetails.args&&Object.values(p.interfaceDetails.args).forEach(D=>{a[g.id][D]?a[g.id][D]=[...a[g.id][D],p.name]:a[g.id][D]=[p.name]})})}),{createObjectList:A,linkObjectList:l,formFields:c,objectDict:u,dependentFieldsMap:a}}),Nl=nr("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=NB(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:B=[],hasMore:f=!0,currentPage:p=0}=((h=g.optionsMap)==null?void 0:h[u])||{},{enabled:d,limit:E}=c,m=E||10;try{let b;const I=d?{pageNumber:p+1,limit:m}:null;if(f?b=await XN({fieldName:o,formId:r},{pagination:I||{},args:A,interfaceId:l}):a==null||a(B),!b||!b.data||!("data"in b.data)||!Array.isArray(b.data.data))return{optionsList:[...B],fieldName:"",formId:"",hasMore:!1,currentPage:p,key:u};const y=b.data.data.map(S=>C?{...S,avatarUrl:S.avatarUrl||gj}:{label:S.label,value:S.value}),T=d?y.length>=m:!1,k=[...B,...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(B),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=NB(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}}),jl=nr("writeCapability/createForm",async(e,{rejectWithValue:t})=>{const{formId:n,successCallback:o,failureCallback:r,args:i={},interfaceId:a,conversationId:A}=e;try{await KN({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:dj,type:Ca}),t(l)}}),Vl=nr("writeCapability/unlinkCard",async({id:e,channelType:t,externalResourceId:n,conversationId:o})=>{await ZN(e,t,n,o)}),Hl=nr("writeCapability/linkCard",async({id:e,externalResourceId:t,channelType:n,conversationId:o})=>{await JN(e,t,n,o)}),Ea=nr("writeCapability/previewCard",async({id:e,args:t,channelType:n,isRefresh:o})=>{const r=await _N(e,t,n),i=r==null?void 0:r.data;if(!i)return o&&no({message:xB,type:Ca}),{data:null};if(o&&no({message:TB,type:Hi}),i.cardType==="flat"){const a=i.data.flatDisplay.filter(A=>Number(A.statusCode)!==Vd.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}}),Lj=Rj.reducer,jB=e=>e.write.createObjectList,VB=e=>e.write.linkObjectList,Uj=e=>e.write.objectDict,Nj=e=>e.write.formFields,jj=e=>e.write.previewCardData,Vj=e=>e.write.previewCardApiStatus,Hj=e=>e.write.linkCardApiStatus,Wj=e=>e.write.unlinkCardApiStatus,zj=e=>e.write.dependentFieldsMap,Yj=e=>e.write.createFormApiStatus,Gj=({showUnlinkModal:e,setShowUnlinkModal:t,cardId:n,onCardUnlinking:o,externalResourceId:r,conversationId:i,connectorName:a})=>{const A=Di(),{sendTrackingEvent:l}=w.useContext(ir),u=Jt(Wj)===Re.LOADING,g=()=>{i&&r&&A(Vl({id:n,conversationId:i,externalResourceId:r})).unwrap().then(()=>{l(DN,{connector_name:a,conversation_id:i}),t(!1),o(),no({message:fN,type:Hi})}).catch(()=>{no({message:pN,type:Hi})})};return v.jsx(jd,{shown:e,setShown:t,showCloseButton:!0,children:v.jsxs(ze,{width:"400px",padding:"20px",gap:"8px",children:[v.jsx(Ke,{variant:"h2",children:xD}),v.jsx(Ke,{variant:"body2",children:TD}),v.jsxs(ze,{direction:"row",gap:"8px",marginTop:"20px",justifyContent:"flex-end",children:[v.jsx(zt,{variant:"text",onClick:()=>t(!1),children:Ud}),v.jsx(zt,{disabled:u,color:"error",onClick:g,children:FI})]})]})})},Xj=e=>{const{card:t,specificCardData:n,email:o,specificConnectorApiStatus:r,defaultOpenState:i=!1,onCardUnlinking:a}=e,{availableFeatures:A,sendTrackingEvent:l,conversationId:c}=w.useContext(ir),[u,g]=w.useState(!1),[C,B]=w.useState(!1),[f,p]=w.useState(!1),{id:d,title:E,externalResourceId:m="",connectorName:h=""}=t,b=`${d}_${m}`,I=(r==null?void 0:r[b])===Re.LOADING,Q=(vg(A,NI)&&(t==null?void 0:t.externalResourceId))??!1,y=Di();w.useEffect(()=>{g(!!i)},[i]),w.useEffect(()=>{o&&d&&c&&i&&y(Wi({id:d,email:o,conversationId:c,externalResourceId:m}))},[i,y,d,o,c,m]);const T=(O,D)=>{var M;O==null||O.stopPropagation(),y(Wi({id:D,email:o,conversationId:c,isRefresh:!0,externalResourceId:m})).unwrap().then(()=>{l(vN,{id:D})});const U=O.target.tagName==="BUTTON"?(M=O.target)==null?void 0:M.firstChild:O.target;U.className&&(U.className=""),setTimeout(()=>U.className="selected",1)},k=(O,D)=>{O.stopPropagation(),!(n!=null&&n[b])&&!I&&y(Wi({id:D,email:o,conversationId:c,externalResourceId:m})),l(u?bN:QN,{id:D}),g(U=>!U)},S=O=>{O.stopPropagation();const D=O.currentTarget.offsetWidth<O.currentTarget.scrollWidth;B(!!D)};return v.jsxs(kD,{"data-testid":`test_${d}`,children:[v.jsxs(SD,{className:u?"hiver-card-expanded":"",children:[v.jsx(Zt,{title:C?E:"",placement:"bottom",children:v.jsx(OD,{variant:"h4",onMouseOver:O=>S(O),onMouseLeave:O=>S(O),children:E})}),v.jsxs(PI,{children:[Q?v.jsx(Zt,{title:FI,placement:"bottom",children:v.jsx(Pi,{onClick:()=>p(!0),children:v.jsx("img",{src:IN})})}):null,u?v.jsx(Zt,{title:xI,placement:"bottom",children:v.jsx(Pi,{"data-testid":I?"loading":"reloadIcon",onClick:O=>T(O,d),className:I?"disabled":"",children:v.jsx("img",{src:kB})})}):null,v.jsx(Zt,{title:u?TI:Ld,placement:"bottom",children:v.jsx(Pi,{onClick:O=>k(O,d),children:v.jsx(Nd,{className:u?"":"hiver-up"})})})]})]}),v.jsx(VI,{id:b,cardTitle:t.title,specificCardData:n,specificConnectorApiStatus:r,isOpen:u}),v.jsx(Gj,{showUnlinkModal:f,setShowUnlinkModal:p,cardId:d,onCardUnlinking:a,conversationId:c,externalResourceId:m,connectorName:h})]})},Kj="Bring your favourite tools into Hiver",Zj="Plugin image",Jj="Integrate tools like Salesforce, HubSpot, and Shopify to boost productivity",_j="Enable Connectors",HB="app/custom-connectors",qj="Learn more",$j="https://help.hiverhq.com/custom-connectors/hiver-s-custom-connectors",eV="Contact your admin to enable this",tV=V(ze)`
|
|
2337
2337
|
width: 250px;
|
|
2338
2338
|
height: 97px;
|
|
2339
2339
|
background-color: ${Ge.palette.purple.light};
|
|
@@ -2555,7 +2555,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2555
2555
|
position: absolute;
|
|
2556
2556
|
margin-left: 5px;
|
|
2557
2557
|
}
|
|
2558
|
-
`;var Bz=["defaultOptions","cacheOptions","loadOptions","options","isLoading","onInputChange","filterOption"];function hz(e){var t=e.defaultOptions,n=t===void 0?!1:t,o=e.cacheOptions,r=o===void 0?!1:o,i=e.loadOptions;e.options;var a=e.isLoading,A=a===void 0?!1:a,l=e.onInputChange,c=e.filterOption,u=c===void 0?null:c,g=po(e,Bz),C=g.inputValue,B=w.useRef(void 0),f=w.useRef(!1),p=w.useState(Array.isArray(n)?n:void 0),d=Gt(p,2),E=d[0],m=d[1],h=w.useState(typeof C<"u"?C:""),b=Gt(h,2),I=b[0],Q=b[1],y=w.useState(n===!0),T=Gt(y,2),k=T[0],S=T[1],O=w.useState(void 0),D=Gt(O,2),U=D[0],M=D[1],R=w.useState([]),L=Gt(R,2),H=L[0],W=L[1],Z=w.useState(!1),P=Gt(Z,2),z=P[0],Y=P[1],G=w.useState({}),K=Gt(G,2),_=K[0],ee=K[1],X=w.useState(void 0),q=Gt(X,2),ne=q[0],Ae=q[1],se=w.useState(void 0),j=Gt(se,2),te=j[0],$=j[1];r!==te&&(ee({}),$(r)),n!==ne&&(m(Array.isArray(n)?n:void 0),Ae(n)),w.useEffect(function(){return f.current=!0,function(){f.current=!1}},[]);var le=w.useCallback(function(xe,Ie){if(!i)return Ie();var be=i(xe,Ie);be&&typeof be.then=="function"&&be.then(Ie,function(){return Ie()})},[i]);w.useEffect(function(){n===!0&&le(I,function(xe){f.current&&(m(xe||[]),S(!!B.current))})},[]);var me=w.useCallback(function(xe,Ie){var be=XV(xe,Ie,l);if(!be){B.current=void 0,Q(""),M(""),W([]),S(!1),Y(!1);return}if(r&&_[be])Q(be),M(be),W(_[be]),S(!1),Y(!1);else{var Be=B.current={};Q(be),S(!0),Y(!U),le(be,function(De){f&&Be===B.current&&(B.current=void 0,S(!1),M(be),W(De||[]),Y(!1),ee(De?Qe(Qe({},_),{},Yi({},be,De)):_))})}},[r,le,U,_,l]),Se=z?[]:I&&U?H:E||[];return Qe(Qe({},g),{},{options:Se,isLoading:k||A,onInputChange:me,filterOption:u})}var mz=w.forwardRef(function(e,t){var n=hz(e),o=KB(n);return x.createElement(Hg,ke({ref:t},o))}),Qz=mz;function bz(e){return v.jsx(Ia.DropdownIndicator,{...e,children:v.jsx(SA,{children:e.selectProps.menuIsOpen?v.jsx(qo.ArrowDropUp,{}):v.jsx(qo.ArrowDropDown,{})})})}function vz(e){const[t,n]=w.useState([]),[o,r]=w.useState(""),[i,a]=w.useState(!1),{loadOptions:A,isApiSearchEnabled:l=!1,isInfiniteScrollable:c=!1,loadOptionsOnFocus:u=!1}=e,g=(E,m)=>{if(r(E),t.length>0&&!l){const b=t.filter(I=>I&&typeof I=="object"&&"label"in I&&typeof I.label=="string"?I.label.toLowerCase().includes(E.toLowerCase()):!1);m(b);return}const h=b=>{m(b),n(b)};A==null||A(E,h,!1)},C=(E,m)=>{a(!1),!(m&&"isError"in m&&m.isError)&&n(E)},B=E=>{var m;(m=e.onMenuScrollToBottom)==null||m.call(e,E),c&&A&&!i&&(a(!0),A(o,C,!0))},f=(E,m)=>{var h;(h=e.onInputChange)==null||h.call(e,E,m),m.action==="input-change"&&l&&(r(E),n([]))},p=E=>{var m;r(""),(m=e.onBlur)==null||m.call(e,E)},d=E=>{var m;(m=e.onFocus)==null||m.call(e,E),!i&&u&&(n([]),a(!0),A==null||A(o,C,!1))};return v.jsx(Qz,{...e,value:e.value?e.value:null,isDisabled:e.disabled,loadOptions:g,onMenuScrollToBottom:B,onInputChange:f,onBlur:p,onFocus:d,isLoading:i,defaultOptions:t.length?t:e.defaultOptions||!1,components:{ClearIndicator:zh,DropdownIndicator:bz,IndicatorSeparator:()=>null,Option:Wh}})}function yz(e){const[t,n]=w.useState(!1),o=w.useRef(null);w.useEffect(()=>{t&&o.current&&o.current.focus()},[t]);const r=(i,a)=>{i===null&&e.onChange(i,a),i&&typeof i.getTime=="function"&&!isNaN(i.getTime())&&e.onChange(i,a),e.onChange(i,a)};return v.jsx(XE,{inputFormat:e.inputFormat?e.inputFormat:Gh.DATE,...e,open:t,onOpen:()=>n(!0),onClose:()=>n(!1),onChange:r,PopperProps:{anchorEl:o.current},renderInput:i=>
|
|
2558
|
+
`;var Bz=["defaultOptions","cacheOptions","loadOptions","options","isLoading","onInputChange","filterOption"];function hz(e){var t=e.defaultOptions,n=t===void 0?!1:t,o=e.cacheOptions,r=o===void 0?!1:o,i=e.loadOptions;e.options;var a=e.isLoading,A=a===void 0?!1:a,l=e.onInputChange,c=e.filterOption,u=c===void 0?null:c,g=po(e,Bz),C=g.inputValue,B=w.useRef(void 0),f=w.useRef(!1),p=w.useState(Array.isArray(n)?n:void 0),d=Gt(p,2),E=d[0],m=d[1],h=w.useState(typeof C<"u"?C:""),b=Gt(h,2),I=b[0],Q=b[1],y=w.useState(n===!0),T=Gt(y,2),k=T[0],S=T[1],O=w.useState(void 0),D=Gt(O,2),U=D[0],M=D[1],R=w.useState([]),L=Gt(R,2),H=L[0],W=L[1],Z=w.useState(!1),P=Gt(Z,2),z=P[0],Y=P[1],G=w.useState({}),K=Gt(G,2),_=K[0],ee=K[1],X=w.useState(void 0),q=Gt(X,2),ne=q[0],Ae=q[1],se=w.useState(void 0),j=Gt(se,2),te=j[0],$=j[1];r!==te&&(ee({}),$(r)),n!==ne&&(m(Array.isArray(n)?n:void 0),Ae(n)),w.useEffect(function(){return f.current=!0,function(){f.current=!1}},[]);var le=w.useCallback(function(xe,Ie){if(!i)return Ie();var be=i(xe,Ie);be&&typeof be.then=="function"&&be.then(Ie,function(){return Ie()})},[i]);w.useEffect(function(){n===!0&&le(I,function(xe){f.current&&(m(xe||[]),S(!!B.current))})},[]);var me=w.useCallback(function(xe,Ie){var be=XV(xe,Ie,l);if(!be){B.current=void 0,Q(""),M(""),W([]),S(!1),Y(!1);return}if(r&&_[be])Q(be),M(be),W(_[be]),S(!1),Y(!1);else{var Be=B.current={};Q(be),S(!0),Y(!U),le(be,function(De){f&&Be===B.current&&(B.current=void 0,S(!1),M(be),W(De||[]),Y(!1),ee(De?Qe(Qe({},_),{},Yi({},be,De)):_))})}},[r,le,U,_,l]),Se=z?[]:I&&U?H:E||[];return Qe(Qe({},g),{},{options:Se,isLoading:k||A,onInputChange:me,filterOption:u})}var mz=w.forwardRef(function(e,t){var n=hz(e),o=KB(n);return x.createElement(Hg,ke({ref:t},o))}),Qz=mz;function bz(e){return v.jsx(Ia.DropdownIndicator,{...e,children:v.jsx(SA,{children:e.selectProps.menuIsOpen?v.jsx(qo.ArrowDropUp,{}):v.jsx(qo.ArrowDropDown,{})})})}function vz(e){const[t,n]=w.useState([]),[o,r]=w.useState(""),[i,a]=w.useState(!1),{loadOptions:A,isApiSearchEnabled:l=!1,isInfiniteScrollable:c=!1,loadOptionsOnFocus:u=!1}=e,g=(E,m)=>{if(r(E),t.length>0&&!l){const b=t.filter(I=>I&&typeof I=="object"&&"label"in I&&typeof I.label=="string"?I.label.toLowerCase().includes(E.toLowerCase()):!1);m(b);return}const h=b=>{m(b),n(b)};A==null||A(E,h,!1)},C=(E,m)=>{a(!1),!(m&&"isError"in m&&m.isError)&&n(E)},B=E=>{var m;(m=e.onMenuScrollToBottom)==null||m.call(e,E),c&&A&&!i&&(a(!0),A(o,C,!0))},f=(E,m)=>{var h;(h=e.onInputChange)==null||h.call(e,E,m),m.action==="input-change"&&l&&(r(E),n([]))},p=E=>{var m;r(""),(m=e.onBlur)==null||m.call(e,E)},d=E=>{var m;(m=e.onFocus)==null||m.call(e,E),!i&&u&&(n([]),a(!0),A==null||A(o,C,!1))};return v.jsx(Qz,{...e,value:e.value?e.value:null,isDisabled:e.disabled,loadOptions:g,onMenuScrollToBottom:B,onInputChange:f,onBlur:p,onFocus:d,isLoading:i,defaultOptions:t.length?t:e.defaultOptions||!1,components:{ClearIndicator:zh,DropdownIndicator:bz,IndicatorSeparator:()=>null,Option:Wh}})}function yz(e){const[t,n]=w.useState(!1),o=w.useRef(null);w.useEffect(()=>{t&&o.current&&o.current.focus()},[t]);const r=(i,a)=>{i===null&&e.onChange(i,a),i&&typeof i.getTime=="function"&&!isNaN(i.getTime())&&e.onChange(i,a),e.onChange(i,a)};return v.jsx(XE,{inputFormat:e.inputFormat?e.inputFormat:Gh.DATE,...e,value:e.value||null,open:t,onOpen:()=>n(!0),onClose:()=>n(!1),onChange:r,PopperProps:{anchorEl:o.current},renderInput:i=>v.jsx(ZE,{...i,fullWidth:!0,variant:"outlined",disabled:e.disabled,inputRef:o,inputProps:{...i.inputProps,placeholder:e.placeholder},onBlur:e.onBlur,onFocus:e.onFocus,InputProps:{endAdornment:v.jsx(Fu,{position:"end",sx:{backgroundColor:"#FFFFFF"},children:v.jsx(qo.CalendarTodayOutlinedIcon,{})})},sx:{"& .MuiOutlinedInput-root":{backgroundColor:"#FFFFFF"}},onClick:()=>{t||n(!0)}})})}const oc=e=>{const{validation:t,helperText:n,id:o,label:r,name:i,validateOnBlur:a=!0,validateOnChange:A=!0,inputChangeHandler:l,selectChangeHandler:c,dateChangeHandler:u,onValidationError:g,iconData:C,isRequired:B,labelSpacing:f=1,loadOptions:p}=e,[d,E]=w.useState(!1),[m,h]=w.useState("");w.useEffect(()=>{d||I(e.value,!1)},[d,e.value]);const b=D=>{D&&!d&&E(!0)};function I(D,U=!0,M){let R="";if((t!=null&&t.isRequired||B)&&(R=D?"":Yh,!D&&typeof(t==null?void 0:t.isRequired)=="function")){const H=t.isRequired(D);H&&typeof H=="boolean"?R=Yh:H&&(R=H)}let L={id:o,name:i,label:r};if(e.type==="date"?L={...L,disableFuture:e.disableFuture,disablePast:e.disablePast}:e.type==="number"?L={...L,min:e.min,max:e.max}:e.type==="text"&&e.multiline&&(L={...L,maxCharacters:e.maxCharacters}),D&&!R&&(t!=null&&t.validate)){const H=t.validate(D,{...L,...M});typeof H=="boolean"&&H===!1?R=Cz:typeof H=="string"&&(R=H)}U&&h(R),g==null||g(i,R)}const Q=D=>{var U;d||E(!0),(U=e.onBlur)==null||U.call(e,D),d&&a&&I(e.value)},y=()=>e.helperText?v.jsx(Kh,{children:n}):d&&m?v.jsx(Kh,{className:"helper--error",children:m}):null,T=D=>{D&&!d&&E(!0),l==null||l(D),d&&A&&I(D.target.value)},k=(D,U)=>{c==null||c(D,U),D&&!d&&E(!0),D&&typeof D=="object"&&"value"in D&&d&&A&&I(D.value)},S=(D,U)=>{u==null||u(i,D,U),D&&!d&&E(!0),d&&A&&I(D)},O=D=>{switch(D.type){case"select":return v.jsx(Xh,{children:v.jsx(pz,{...D,className:`formField__select ${m&&d?"formField__select--error":""} ${D.className||""}`,classNamePrefix:"hiverFormField",onBlur:Q,onChange:k,onFocus:b})});case"async-select":return v.jsx(Xh,{children:v.jsx(vz,{...D,className:`formField__select ${m&&d?"formField__select--error":""} ${D.className||""}`,classNamePrefix:"hiverFormField",onBlur:Q,onChange:k,onFocus:b,loadOptions:p})});case"date":return v.jsx(yz,{...D,label:void 0,onBlur:Q,onFocus:b,onChange:S,error:!!(m&&d)});default:return v.jsx(Ez,{id:o,...D,label:void 0,onBlur:Q,onChange:T,onFocus:b,error:!!(m&&d),inputProps:{type:D.type,min:D.min,max:D.max,...D.inputProps}})}};return v.jsxs(ze,{spacing:f,useFlexGap:!0,children:[r?v.jsxs(Ke,{variant:"h4",component:"label",htmlFor:o,color:Ge.palette.gray.gray1,className:"hiver__field--label",children:[r,t!=null&&t.isRequired||B?v.jsx("span",{className:"required__star",children:"*"}):null]}):null,v.jsxs(Iz,{children:[v.jsx(Zt,{title:e.toolTipTitle,arrow:!0,placement:"right-end",disableHoverListener:!0,children:O(e)}),C!=null&&C.icon?v.jsx(Zt,{title:C.toolTipText,placement:"bottom",children:v.jsx(sn,{className:"form--sideIcon",children:C==null?void 0:C.icon})}):null,y()]})]})},wz=V(ze)`
|
|
2559
2559
|
& .authform__section-title {
|
|
2560
2560
|
margin-top: 32px;
|
|
2561
2561
|
margin-bottom: -12px;
|
|
@@ -2620,7 +2620,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2620
2620
|
border: 1px solid ${Ge.palette.purple.primary} !important;
|
|
2621
2621
|
}
|
|
2622
2622
|
margin-left: 12px;
|
|
2623
|
-
`,Oz=({setOpenTaskLinking:e,onLinkingSuccess:t})=>{const n=Di(),o=Jt(jj),r=Jt(Vj),i=Jt(Hj),a=Jt(VB),[A,l]=w.useState(!1),[c,u]=w.useState(null),[g,C]=w.useState(""),[B,f]=w.useState({}),{conversationId:p,sendTrackingEvent:d}=w.useContext(ir);w.useEffect(()=>{a&&a.length&&u(a[0])},[a]);const E={externalResourceId:g},m=r===Re.LOADING,h=i===Re.LOADING,b=()=>{!A&&c&&"value"in c&&(d(PN,{object_type:c.label}),n(Ea({id:String(c==null?void 0:c.value),args:E})).unwrap().catch(()=>{no({message:qN,type:Ca})})),l(O=>!O)},I=()=>{c&&"value"in c&&p&&n(Hl({id:String(c.value),externalResourceId:g,conversationId:p})).unwrap().then(()=>{d(MN,{object_type:c.label,input_type:g}),no({message:$N,type:Hi}),e(!1),t()}).catch(()=>{no({message:ej,type:Ca})})},Q=()=>{e(!1),l(!1)},y=(O,D)=>{O&&typeof O=="object"&&"label"in O&&typeof O.label=="string"&&"value"in O&&(typeof O.value=="string"||typeof O.value=="number")&&typeof D.name<"u"&&(u({value:O.value,label:O.label}),C(""))},T=O=>{O.stopPropagation();const{value:D}=(O==null?void 0:O.target)||{};C(D),l(!1)},k=(O,D)=>{f(U=>({...U,[O]:!!D}))},S=()=>Object.keys(B).filter(D=>B[D]).length>0;return v.jsxs(_h,{children:[v.jsxs(Jh,{spacing:3,children:[v.jsx(oc,{type:"select",placeholder:LB,options:a,value:c,name:"form-object",selectChangeHandler:y,label:hj,labelSpacing:.5,validation:{isRequired:!0},onValidationError:k}),v.jsx(oc,{type:"text",placeholder:mj,value:g,name:"resourceId",inputChangeHandler:T,label:Qj,labelSpacing:.5,validation:{isRequired:!0,validate:Dj()},onValidationError:k}),A?v.jsx(Sz,{cardData:o,cardDataApiStatus:r,objectToLink:String((c==null?void 0:c.value)||""),args:E}):null,v.jsx(kz,{fullWidth:!0,disabled:S()||m,color:"tertiary",variant:"outlined",size:"small",onClick:b,children:A?nP:tP})]}),v.jsxs(Zh,{children:[v.jsx(zt,{onClick:I,disabled:S()||h,children:yD}),v.jsx(qh,{color:"tertiary",variant:"outlined",onClick:Q,disabled:h,children:Ud})]})]})},$h={values:{},errors:{}},sr={SET_FIELD_VALUE:"SET_FIELD_VALUE",CLEAR_ERROR:"CLEAR_ERROR",SET_FIELD_ERROR:"SET_FIELD_ERROR",SET_FIELDS:"SET_FIELDS",CLEAR_FIELDS:"CLEAR_FIELDS",RESET_STATE:"RESET_STATE"},Mz=(e,t)=>{const{type:n,payload:o}=t;switch(n){case sr.SET_FIELD_VALUE:{if(!o||!("name"in o))return e;const{name:r,value:i}=o;return{...e,values:{...e.values,[r]:i}}}case sr.SET_FIELD_ERROR:{if(!o||!("name"in o))return e;const{name:r,value:i}=o;return typeof i=="boolean"||typeof i=="string"?{...e,errors:{...e.errors,[r]:i}}:e}case sr.CLEAR_ERROR:{if(!o||!("name"in o))return e;const{name:r}=o;return{...e,errors:{...e.errors,[r]:""}}}case sr.SET_FIELDS:{if(!o||"name"in o)return e;const{values:r}=o;return{...e,values:r}}case sr.RESET_STATE:return $h}return e},em=({setShown:e,shown:t,title:n,description:o,buttons:r})=>v.jsx(jd,{shown:t,setShown:e,showCloseButton:!0,children:v.jsxs(ze,{width:"400px",padding:"20px",children:[v.jsx(Ke,{variant:"h2",marginBottom:"8px",children:n}),v.jsx(Ke,{variant:"body2",marginBottom:"20px",children:o}),v.jsx(ze,{direction:"row",justifyContent:"flex-end",gap:"8px",children:r.map(i=>v.jsx(zt,{variant:i.variant,onClick:i.action,children:i.label},i.label.split(" ").join("_").toLowerCase()))})]})}),Dz=({onClose:e,onCreateSuccess:t,setMetaData:n})=>{const[o,r]=w.useState(null),[i,a]=w.useState(!1),[A,l]=w.useReducer(Mz,$h),c=w.useRef(null),u=Jt(jB),g=Jt(Nj),C=Jt(Uj),B=Jt(zj),f=Jt(Yj),{conversationId:p,sendTrackingEvent:d}=w.useContext(ir),E=Di();w.useEffect(()=>{o!==null&&n(R=>({...R,object_type:o.label}))},[o,n]),w.useEffect(()=>{if(A.values){const R=Object.values(A.values).filter(L=>L!=="").length;n(L=>({...L,fields_filled:R}))}},[A,n]),w.useEffect(()=>{u&&u.length&&r(u[0])},[u]);const m=w.useMemo(()=>o&&"value"in o&&g&&g[o.value]&&Array.isArray(g[o.value])?[{id:o.value,formFields:g[o.value]}]:[{id:"emptyFormId",formFields:[]}],[g,o]),h=w.useMemo(()=>{if(m&&m.length){const{formFields:R,id:L}=m[0];return R.filter(Z=>Z.interfaceDetails).reduce((Z,P)=>{var G,K;const z=wj(A,(G=P==null?void 0:P.interfaceDetails)==null?void 0:G.args),Y=Object.values(((K=P==null?void 0:P.interfaceDetails)==null?void 0:K.args)||{});return{...Z,[P.name]:{loadOptions:(_,ee,X)=>{var q,ne,Ae;if(z.length===Y.length){E(Nl({fieldName:P.name,formId:String(L),fieldConfig:P,interfaceId:(q=P.interfaceDetails)==null?void 0:q.id,pagination:(ne=P.interfaceDetails)==null?void 0:ne.pagination,callback:ee,args:xj(A,(Ae=P==null?void 0:P.interfaceDetails)==null?void 0:Ae.args),isScrollToBottomEvent:X}));return}return ee([])}}}},{})}return null},[m,A,E]),b=w.useMemo(()=>{var L;const R=((L=m==null?void 0:m[0])==null?void 0:L.formFields)||[];return Pj({formFields:R})},[m]),I=(R,L)=>{l({type:sr.SET_FIELD_VALUE,payload:{value:L,name:R}})},Q=(R,L)=>{l({type:sr.SET_FIELD_ERROR,payload:{name:R,value:L}})},y=R=>{R.stopPropagation();const{name:L,value:H}=(R==null?void 0:R.target)||{};I(L,H)},T=R=>{if(o!=null&&o.value){const L=B[o.value][R];L==null||L.forEach(H=>{var W;I(H,""),B[o.value][H]&&T(H),(W=b[H])!=null&&W.isRequired&&Q(H,!0)})}},k=()=>{r(c.current),a(!1),l({type:sr.RESET_STATE})},S=(R,L,H)=>{if(L.action==="clear"&&L.name&&(I(L.name,""),T(L.name),b[L.name].isRequired&&Q(L.name,!0)),R&&typeof R=="object"&&"label"in R&&typeof R.label=="string"&&"value"in R&&(typeof R.value=="string"||typeof R.value=="number")&&typeof L.name<"u")if(L.name==="form-object")c.current={value:R.value,label:R.label},A.values&&R.value!==(o==null?void 0:o.value)&&(Object.values(A.values).filter(Z=>Z!=="").length>0?a(!0):k());else{let W=!1;H&&(W=H.isMultiSelect||!1);const Z=W?[{value:R.value,label:R.label}]:{value:R.value,label:R.label};I(L.name,Z),T(L.name)}},O=(R,L)=>{I(R,L||"")},D=()=>Object.keys(A.errors).filter(L=>!!A.errors[L]).length>0,U=()=>{if(!D()&&o&&(C!=null&&C[o.value])&&p){const R=C==null?void 0:C[o.value].interfaceDetails;if(!R)return;const{id:L,args:H={}}=R,W=Object.keys(H).reduce((Z,P)=>{const z=A.values[H[P]];let Y;return Array.isArray(z)?Y=z.map(G=>G.value):z&&typeof z=="object"&&"label"in z?Y=z.value:z&&typeof z=="object"?Y=z.toISOString():Y=z||"",Z[P]=Y,Z},{});E(jl({formId:String(o.value),conversationId:p,args:W,interfaceId:L,successCallback:()=>{e(),t()}})).unwrap().then(()=>{d(ON,{object_type:o})})}},M=[{label:"Cancel",action:()=>a(!1),variant:"text"},{label:"Continue",action:k}];return v.jsxs(_h,{children:[v.jsx(em,{shown:i,setShown:a,title:pj,description:Cj,buttons:M}),v.jsxs(Jh,{spacing:3,children:[v.jsx(oc,{type:"select",placeholder:LB,options:u,value:o,name:"form-object",selectChangeHandler:S,label:Bj,labelSpacing:.5,validation:{isRequired:!0}}),v.jsx(xz,{formConfig:m,selectChangeHandler:S,inputChangeHandler:y,dateChangeHandler:O,onValidationError:Q,fieldsSpacing:3,labelSpacing:.5,fetchConfig:h,values:A.values,validations:b})]}),v.jsxs(Zh,{children:[v.jsx(zt,{disabled:D()||f===Re.LOADING,onClick:U,children:wD}),v.jsx(qh,{variant:"outlined",color:"tertiary",onClick:e,disabled:f===Re.LOADING,children:Ud})]})]})},Pz=V(zt)`
|
|
2623
|
+
`,Oz=({setOpenTaskLinking:e,onLinkingSuccess:t})=>{const n=Di(),o=Jt(jj),r=Jt(Vj),i=Jt(Hj),a=Jt(VB),[A,l]=w.useState(!1),[c,u]=w.useState(null),[g,C]=w.useState(""),[B,f]=w.useState({}),{conversationId:p,sendTrackingEvent:d}=w.useContext(ir);w.useEffect(()=>{a&&a.length&&u(a[0])},[a]);const E={externalResourceId:g},m=r===Re.LOADING,h=i===Re.LOADING,b=()=>{!A&&c&&"value"in c&&(d(PN,{object_type:c.label}),n(Ea({id:String(c==null?void 0:c.value),args:E})).unwrap().catch(()=>{no({message:qN,type:Ca})})),l(O=>!O)},I=()=>{c&&"value"in c&&p&&n(Hl({id:String(c.value),externalResourceId:g,conversationId:p})).unwrap().then(()=>{d(MN,{object_type:c.label,input_type:g}),no({message:$N,type:Hi}),e(!1),t()}).catch(()=>{no({message:ej,type:Ca})})},Q=()=>{e(!1),l(!1)},y=(O,D)=>{O&&typeof O=="object"&&"label"in O&&typeof O.label=="string"&&"value"in O&&(typeof O.value=="string"||typeof O.value=="number")&&typeof D.name<"u"&&(u({value:O.value,label:O.label}),C(""))},T=O=>{O.stopPropagation();const{value:D}=(O==null?void 0:O.target)||{};C(D),l(!1)},k=(O,D)=>{f(U=>({...U,[O]:!!D}))},S=()=>Object.keys(B).filter(D=>B[D]).length>0;return v.jsxs(_h,{children:[v.jsxs(Jh,{spacing:3,children:[v.jsx(oc,{type:"select",placeholder:LB,options:a,value:c,name:"form-object",selectChangeHandler:y,label:hj,labelSpacing:.5,validation:{isRequired:!0},onValidationError:k}),v.jsx(oc,{type:"text",placeholder:mj,value:g,name:"resourceId",inputChangeHandler:T,label:Qj,labelSpacing:.5,validation:{isRequired:!0,validate:Dj()},onValidationError:k}),A?v.jsx(Sz,{cardData:o,cardDataApiStatus:r,objectToLink:String((c==null?void 0:c.value)||""),args:E}):null,v.jsx(kz,{fullWidth:!0,disabled:S()||m,color:"tertiary",variant:"outlined",size:"small",onClick:b,children:A?nP:tP})]}),v.jsxs(Zh,{children:[v.jsx(zt,{onClick:I,disabled:S()||h,children:yD}),v.jsx(qh,{color:"tertiary",variant:"outlined",onClick:Q,disabled:h,children:Ud})]})]})},$h={values:{},errors:{}},sr={SET_FIELD_VALUE:"SET_FIELD_VALUE",CLEAR_ERROR:"CLEAR_ERROR",SET_FIELD_ERROR:"SET_FIELD_ERROR",SET_FIELDS:"SET_FIELDS",CLEAR_FIELDS:"CLEAR_FIELDS",RESET_STATE:"RESET_STATE"},Mz=(e,t)=>{const{type:n,payload:o}=t;switch(n){case sr.SET_FIELD_VALUE:{if(!o||!("name"in o))return e;const{name:r,value:i}=o;return{...e,values:{...e.values,[r]:i}}}case sr.SET_FIELD_ERROR:{if(!o||!("name"in o))return e;const{name:r,value:i}=o;return typeof i=="boolean"||typeof i=="string"?{...e,errors:{...e.errors,[r]:i}}:e}case sr.CLEAR_ERROR:{if(!o||!("name"in o))return e;const{name:r}=o;return{...e,errors:{...e.errors,[r]:""}}}case sr.SET_FIELDS:{if(!o||"name"in o)return e;const{values:r}=o;return{...e,values:r}}case sr.RESET_STATE:return $h}return e},em=({setShown:e,shown:t,title:n,description:o,buttons:r})=>v.jsx(jd,{shown:t,setShown:e,showCloseButton:!0,children:v.jsxs(ze,{width:"400px",padding:"20px",children:[v.jsx(Ke,{variant:"h2",marginBottom:"8px",children:n}),v.jsx(Ke,{variant:"body2",marginBottom:"20px",children:o}),v.jsx(ze,{direction:"row",justifyContent:"flex-end",gap:"8px",children:r.map(i=>v.jsx(zt,{variant:i.variant,onClick:i.action,children:i.label},i.label.split(" ").join("_").toLowerCase()))})]})}),Dz=({onClose:e,onCreateSuccess:t,setMetaData:n})=>{const[o,r]=w.useState(null),[i,a]=w.useState(!1),[A,l]=w.useReducer(Mz,$h),c=w.useRef(null),u=Jt(jB),g=Jt(Nj),C=Jt(Uj),B=Jt(zj),f=Jt(Yj),{conversationId:p,sendTrackingEvent:d}=w.useContext(ir),E=Di();w.useEffect(()=>{o!==null&&n(R=>({...R,object_type:o.label}))},[o,n]),w.useEffect(()=>{if(A.values){const R=Object.values(A.values).filter(L=>L!=="").length;n(L=>({...L,fields_filled:R}))}},[A,n]),w.useEffect(()=>{u&&u.length&&r(u[0])},[u]);const m=w.useMemo(()=>o&&"value"in o&&g&&g[o.value]&&Array.isArray(g[o.value])?[{id:o.value,formFields:g[o.value]}]:[{id:"emptyFormId",formFields:[]}],[g,o]),h=w.useMemo(()=>{if(m&&m.length){const{formFields:R,id:L}=m[0];return R.filter(Z=>Z.interfaceDetails).reduce((Z,P)=>{var G,K;const z=wj(A,(G=P==null?void 0:P.interfaceDetails)==null?void 0:G.args),Y=Object.values(((K=P==null?void 0:P.interfaceDetails)==null?void 0:K.args)||{});return{...Z,[P.name]:{loadOptions:(_,ee,X)=>{var q,ne,Ae;if(z.length===Y.length){E(Nl({fieldName:P.name,formId:String(L),fieldConfig:P,interfaceId:(q=P.interfaceDetails)==null?void 0:q.id,pagination:(ne=P.interfaceDetails)==null?void 0:ne.pagination,callback:ee,args:xj(A,(Ae=P==null?void 0:P.interfaceDetails)==null?void 0:Ae.args),isScrollToBottomEvent:X}));return}return ee([])}}}},{})}return null},[m,A,E]),b=w.useMemo(()=>{var L;const R=((L=m==null?void 0:m[0])==null?void 0:L.formFields)||[];return Pj({formFields:R})},[m]),I=(R,L)=>{l({type:sr.SET_FIELD_VALUE,payload:{value:L,name:R}})},Q=(R,L)=>{l({type:sr.SET_FIELD_ERROR,payload:{name:R,value:L}})},y=R=>{R.stopPropagation();const{name:L,value:H}=(R==null?void 0:R.target)||{};I(L,H)},T=R=>{if(o!=null&&o.value){const L=B[o.value][R];L==null||L.forEach(H=>{var W;I(H,""),B[o.value][H]&&T(H),(W=b[H])!=null&&W.isRequired&&Q(H,!0)})}},k=()=>{r(c.current),a(!1),l({type:sr.RESET_STATE})},S=(R,L,H)=>{if(L.action==="clear"&&L.name&&(I(L.name,""),T(L.name),b[L.name].isRequired&&Q(L.name,!0)),R&&typeof R=="object"&&"label"in R&&typeof R.label=="string"&&"value"in R&&(typeof R.value=="string"||typeof R.value=="number")&&typeof L.name<"u")if(L.name==="form-object")c.current={value:R.value,label:R.label},A.values&&R.value!==(o==null?void 0:o.value)&&(Object.values(A.values).filter(Z=>Z!=="").length>0?a(!0):k());else{let W=!1;H&&(W=H.isMultiSelect||!1);const Z=W?[{value:R.value,label:R.label}]:{value:R.value,label:R.label};I(L.name,Z),T(L.name)}},O=(R,L)=>{I(R,L||"")},D=()=>Object.keys(A.errors).filter(L=>!!A.errors[L]).length>0,U=()=>{if(!D()&&o&&(C!=null&&C[o.value])&&p){const R=C==null?void 0:C[o.value].interfaceDetails;if(!R)return;const{id:L,args:H={}}=R,W=Object.keys(H).reduce((Z,P)=>{const z=A.values[H[P]];let Y;return Array.isArray(z)?Y=z.map(G=>G.value):z&&typeof z=="object"&&"label"in z?Y=z.value:z&&typeof z=="object"?Y=z.toISOString():Y=z||"",Z[P]=Y,Z},{});E(jl({formId:String(o.value),conversationId:p,args:W,interfaceId:L,successCallback:()=>{e(!1),t()}})).unwrap().then(()=>{d(ON,{object_type:o})})}},M=[{label:"Cancel",action:()=>a(!1),variant:"text"},{label:"Continue",action:k}];return v.jsxs(_h,{children:[v.jsx(em,{shown:i,setShown:a,title:pj,description:Cj,buttons:M}),v.jsxs(Jh,{spacing:3,children:[v.jsx(oc,{type:"select",placeholder:LB,options:u,value:o,name:"form-object",selectChangeHandler:S,label:Bj,labelSpacing:.5,validation:{isRequired:!0}}),v.jsx(xz,{formConfig:m,selectChangeHandler:S,inputChangeHandler:y,dateChangeHandler:O,onValidationError:Q,fieldsSpacing:3,labelSpacing:.5,fetchConfig:h,values:A.values,validations:b})]}),v.jsxs(Zh,{children:[v.jsx(zt,{disabled:D()||f===Re.LOADING,onClick:U,children:wD}),v.jsx(qh,{variant:"outlined",color:"tertiary",onClick:()=>e(!0),disabled:f===Re.LOADING,children:Ud})]})]})},Pz=V(zt)`
|
|
2624
2624
|
&:hover {
|
|
2625
2625
|
background-color: #e3e9ff !important;
|
|
2626
2626
|
color: ${Ge.palette.purple.primary} !important;
|
|
@@ -2641,7 +2641,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2641
2641
|
& .content__btn {
|
|
2642
2642
|
margin-left: 8px;
|
|
2643
2643
|
}
|
|
2644
|
-
`,Lz=e=>x.createElement("svg",{width:20,height:21,viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.createElement("mask",{id:"mask0_4649_80352",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:0,y:0,width:20,height:21},x.createElement("rect",{y:.320312,width:20,height:20,fill:"#D9D9D9"})),x.createElement("g",{mask:"url(#mask0_4649_80352)"},x.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"}))),Uz=e=>x.createElement("svg",{width:20,height:21,viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.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"}),x.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"})),Nz=({onCreateClick:e,onLinkClick:t})=>v.jsxs(ze,{gap:2,marginTop:"12px",children:[v.jsx(Ke,{variant:"body2",color:Ge.palette.gray.gray1,children:fj}),v.jsxs(ze,{gap:"12px",children:[v.jsxs(Rz,{fullWidth:!0,onClick:e,children:[v.jsx(Lz,{}),v.jsx("span",{className:"content__btn",children:kI})]}),v.jsxs(Pz,{fullWidth:!0,color:"tertiary",variant:"outlined",onClick:t,children:[v.jsx(Uz,{}),v.jsx("span",{className:"content__btn",children:SI})]})]})]}),jz="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",Vz="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",Hz=({isAdmin:e=!1})=>{const{email:t,currentSmIds:n,sendTrackingEvent:o,availableFeatures:r,conversationId:i}=w.useContext(ir),a=Di(),[A,l]=w.useState(!1),[c,u]=w.useState(!1),[g,C]=w.useState(),[B,f]=w.useState(!1),p=Jt(nN),d=Jt(oN),E=Jt(iN),m=Jt(sN),h=Jt(rN),b=Jt(jB),I=Jt(VB),Q=vg(r,sP),y=vg(r,NI),T=w.useRef(null),k=w.useCallback(()=>{t&&n.length&&i&&a(Ll({inboxIds:n,conversationId:i}))},[a,t,n,i]);if(w.useEffect(()=>(k(),()=>{a(EN.clearConnectorList())}),[a,k]),w.useEffect(()=>{p&&p.length&&o(yN,{numOfCards:p.length})},[p,o,n]),w.useEffect(()=>{i&&n&&n.length&&a(Ul({inboxIds:n,conversationId:i,channelType:"email"}))},[a,n,i]),h===Re.LOADING)return v.jsx(lV,{});const S=()=>{l(!0),o(kN)},O=()=>{u(!0),o(SN)},D=R=>{o(R,g),(g==null?void 0:g.fields_filled)!==void 0&&g.fields_filled>0?f(!0):l(!1)},M=[{label:"Go back",variant:"text",action:()=>{l(!1),C(void 0),f(!1)}},{label:"Stay",variant:"contained",action:()=>f(!1)}];return v.jsxs(DI,{ref:T,"data-testid":Array.isArray(p)?"connector-agent":"loading",stopOverflow:A||c,children:[v.jsx(em,{shown:B,setShown:f,title:Ej,description:Ij,buttons:M}),d?v.jsxs(v.Fragment,{children:[v.jsxs(ze,{direction:"row",justifyContent:"space-between",marginBottom:"12px",height:"36px",children:[v.jsxs(ze,{direction:"row",alignItems:"center",children:[v.jsx(OI,{}),v.jsx(MI,{variant:"h2",children:QD})]}),v.jsx(ze,{direction:"row",gap:"4px",children:y&&(p!=null&&p.length)?v.jsxs(v.Fragment,{children:[b.length?v.jsx(Zt,{title:kI,children:v.jsx(sn,{onClick:S,children:v.jsx("img",{src:jz,alt:"Add",height:"20px"})})}):null,I.length?v.jsx(Zt,{title:SI,children:v.jsx(sn,{onClick:O,children:v.jsx("img",{src:Vz,alt:"Link Task",height:"20px"})})}):null]}):null})]}),Q?v.jsx(cV,{}):null,p==null?void 0:p.map((R,L)=>{const{id:H}=R;return v.jsx("div",{children:v.jsx(Xj,{card:R,specificCardData:E,email:t??"",defaultOpenState:L===0,specificConnectorApiStatus:m,onCardUnlinking:k})},H)}),!(p!=null&&p.length)&&y?v.jsx(Nz,{onCreateClick:()=>l(!0),onLinkClick:()=>u(!0)}):null]}):v.jsx(AV,{isAdmin:e}),v.jsx(zB,{onClose:()=>D(LN),containerRef:T,isOpen:A,children:v.jsx(Dz,{onClose:()=>D(RN),onCreateSuccess:k,setMetaData:C})}),v.jsx(zB,{onClose:()=>u(!1),containerRef:T,isOpen:c,children:v.jsx(Oz,{setOpenTaskLinking:u,onLinkingSuccess:k})})]})},Wz=({children:e,sendTrackingEvent:t,senderEmail:n="",baseUrls:o={},currentSmIds:r=[],metaData:i,availableFeatures:a,conversationId:A})=>{const l=w.useMemo(()=>({email:n,baseUrls:o,currentSmIds:r,metaData:i,conversationId:A,sendTrackingEvent:t||(()=>{}),availableFeatures:a}),[n,o,t,r,i,a,A]);return v.jsx(ir.Provider,{value:l,children:e})},zz=YI({cardList:CN,write:Lj}),Yz=nR({reducer:zz,devTools:!0}),Gz=({children:e,extraParams:t,senderEmail:n,baseUrls:o,availableFeatures:r})=>v.jsx(CD,{store:Yz,children:v.jsx($M,{custom:!0,children:v.jsx(Wz,{availableFeatures:r,sendTrackingEvent:t==null?void 0:t.sendTrackingEvent,senderEmail:n,currentSmIds:t==null?void 0:t.currentSmIds,metaData:t==null?void 0:t.metaData,conversationId:t==null?void 0:t.conversationId,baseUrls:o,children:v.jsx(w.Suspense,{fallback:v.jsx(v.Fragment,{}),children:e})})})}),Xz=V(Et)`
|
|
2644
|
+
`,Lz=e=>x.createElement("svg",{width:20,height:21,viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.createElement("mask",{id:"mask0_4649_80352",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:0,y:0,width:20,height:21},x.createElement("rect",{y:.320312,width:20,height:20,fill:"#D9D9D9"})),x.createElement("g",{mask:"url(#mask0_4649_80352)"},x.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"}))),Uz=e=>x.createElement("svg",{width:20,height:21,viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.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"}),x.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"})),Nz=({onCreateClick:e,onLinkClick:t})=>v.jsxs(ze,{gap:2,marginTop:"12px",children:[v.jsx(Ke,{variant:"body2",color:Ge.palette.gray.gray1,children:fj}),v.jsxs(ze,{gap:"12px",children:[v.jsxs(Rz,{fullWidth:!0,onClick:e,children:[v.jsx(Lz,{}),v.jsx("span",{className:"content__btn",children:kI})]}),v.jsxs(Pz,{fullWidth:!0,color:"tertiary",variant:"outlined",onClick:t,children:[v.jsx(Uz,{}),v.jsx("span",{className:"content__btn",children:SI})]})]})]}),jz="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",Vz="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",Hz=({isAdmin:e=!1})=>{const{email:t,currentSmIds:n,sendTrackingEvent:o,availableFeatures:r,conversationId:i}=w.useContext(ir),a=Di(),[A,l]=w.useState(!1),[c,u]=w.useState(!1),[g,C]=w.useState(),[B,f]=w.useState(!1),p=Jt(nN),d=Jt(oN),E=Jt(iN),m=Jt(sN),h=Jt(rN),b=Jt(jB),I=Jt(VB),Q=vg(r,sP),y=vg(r,NI),T=w.useRef(null),k=w.useCallback(()=>{t&&n.length&&i&&a(Ll({inboxIds:n,conversationId:i}))},[a,t,n,i]);if(w.useEffect(()=>(k(),()=>{a(EN.clearConnectorList())}),[a,k]),w.useEffect(()=>{p&&p.length&&o(yN,{numOfCards:p.length})},[p,o,n]),w.useEffect(()=>{i&&n&&n.length&&a(Ul({inboxIds:n,conversationId:i,channelType:"email"}))},[a,n,i]),h===Re.LOADING)return v.jsx(lV,{});const S=()=>{l(!0),o(kN)},O=()=>{u(!0),o(SN)},D=(R,L)=>{o(R,g),(g==null?void 0:g.fields_filled)!==void 0&&g.fields_filled>0&&L?f(!0):l(!1)},M=[{label:"Go back",variant:"text",action:()=>{l(!1),C(void 0),f(!1)}},{label:"Stay",variant:"contained",action:()=>f(!1)}];return v.jsxs(DI,{ref:T,"data-testid":Array.isArray(p)?"connector-agent":"loading",stopOverflow:A||c,children:[v.jsx(em,{shown:B,setShown:f,title:Ej,description:Ij,buttons:M}),d?v.jsxs(v.Fragment,{children:[v.jsxs(ze,{direction:"row",justifyContent:"space-between",marginBottom:"12px",height:"36px",children:[v.jsxs(ze,{direction:"row",alignItems:"center",children:[v.jsx(OI,{}),v.jsx(MI,{variant:"h2",children:QD})]}),v.jsx(ze,{direction:"row",gap:"4px",children:y&&(p!=null&&p.length)?v.jsxs(v.Fragment,{children:[b.length?v.jsx(Zt,{title:kI,children:v.jsx(sn,{onClick:S,children:v.jsx("img",{src:jz,alt:"Add",height:"20px"})})}):null,I.length?v.jsx(Zt,{title:SI,children:v.jsx(sn,{onClick:O,children:v.jsx("img",{src:Vz,alt:"Link Task",height:"20px"})})}):null]}):null})]}),Q?v.jsx(cV,{}):null,p==null?void 0:p.map((R,L)=>{const{id:H}=R;return v.jsx("div",{children:v.jsx(Xj,{card:R,specificCardData:E,email:t??"",defaultOpenState:L===0,specificConnectorApiStatus:m,onCardUnlinking:k})},H)}),!(p!=null&&p.length)&&y?v.jsx(Nz,{onCreateClick:()=>l(!0),onLinkClick:()=>u(!0)}):null]}):v.jsx(AV,{isAdmin:e}),v.jsx(zB,{onClose:()=>D(LN,!0),containerRef:T,isOpen:A,children:v.jsx(Dz,{onClose:R=>D(RN,R),onCreateSuccess:k,setMetaData:C})}),v.jsx(zB,{onClose:()=>u(!1),containerRef:T,isOpen:c,children:v.jsx(Oz,{setOpenTaskLinking:u,onLinkingSuccess:k})})]})},Wz=({children:e,sendTrackingEvent:t,senderEmail:n="",baseUrls:o={},currentSmIds:r=[],metaData:i,availableFeatures:a,conversationId:A})=>{const l=w.useMemo(()=>({email:n,baseUrls:o,currentSmIds:r,metaData:i,conversationId:A,sendTrackingEvent:t||(()=>{}),availableFeatures:a}),[n,o,t,r,i,a,A]);return v.jsx(ir.Provider,{value:l,children:e})},zz=YI({cardList:CN,write:Lj}),Yz=nR({reducer:zz,devTools:!0}),Gz=({children:e,extraParams:t,senderEmail:n,baseUrls:o,availableFeatures:r})=>v.jsx(CD,{store:Yz,children:v.jsx($M,{custom:!0,children:v.jsx(Wz,{availableFeatures:r,sendTrackingEvent:t==null?void 0:t.sendTrackingEvent,senderEmail:n,currentSmIds:t==null?void 0:t.currentSmIds,metaData:t==null?void 0:t.metaData,conversationId:t==null?void 0:t.conversationId,baseUrls:o,children:v.jsx(w.Suspense,{fallback:v.jsx(v.Fragment,{}),children:e})})})}),Xz=V(Et)`
|
|
2645
2645
|
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
|
|
2646
2646
|
|
|
2647
2647
|
/* Document
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-capability.d.ts","sourceRoot":"","sources":["../../../../src/testing/mocks/handlers/write-capability.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"write-capability.d.ts","sourceRoot":"","sources":["../../../../src/testing/mocks/handlers/write-capability.ts"],"names":[],"mappings":"AAwgBA,eAAO,MAAM,QAAQ,6BAAiF,CAAC"}
|