@hiver/connector-agent 4.19.1-slackStyles-beta.0 → 4.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/hig-slack/style.d.ts.map +1 -1
- package/index.es.js +9 -13
- package/index.umd.js +9 -13
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/app/hig-slack/style.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAIvD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,eAAe,CAAC,QAAQ,CAKnD,CAAC;AAEF;iDACiD;AACjD,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,QAAQ,CAarD,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,eAAe,CAAC,QAAQ,CAKhD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/app/hig-slack/style.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAIvD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,eAAe,CAAC,QAAQ,CAKnD,CAAC;AAEF;iDACiD;AACjD,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,QAAQ,CAarD,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,eAAe,CAAC,QAAQ,CAKhD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,eAAe,CAMxD,CAAC;AAEF,0DAA0D;AAC1D,eAAO,MAAM,UAAU,EAAE,eAAe,CAAC,QAAQ,CAehD,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,aAAa,EAAE,eAAe,CAAC,UAAU,CAGrD,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,eAAe,CASxD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,WAAW,CAoBvD,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,UAAU,EAAE,eAAe,CAAC,QAAQ,CAMhD,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,eAAe,CAAC,eAAe,CAMzD,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,eAAe,CAAC,eAAe,CASzD,CAAC;AAEF;4EAC4E;AAC5E,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,QAAQ,CASjD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,eAAe,CAAC,QAAQ,CAoBnD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,UAAU,CAGnD,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAAC,QAAQ,CAKtD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,eAAe,CAAC,eAAe,CAS1D,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,eAAe,CAMxD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,eAAe,CASxD,CAAC;AAEF,kEAAkE;AAClE,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,eAAe,CAWxD,CAAC"}
|
package/index.es.js
CHANGED
|
@@ -22245,7 +22245,7 @@ const qk = w($i)`
|
|
|
22245
22245
|
});
|
|
22246
22246
|
}, CT = (e, t, u, n) => new Promise((r, o) => {
|
|
22247
22247
|
const a = new XMLHttpRequest();
|
|
22248
|
-
a.open("PUT", e, !0),
|
|
22248
|
+
a.open("PUT", e, !0), Object.entries(u ?? {}).forEach(([i, s]) => a.setRequestHeader(i, s)), a.upload && (a.upload.onprogress = (i) => {
|
|
22249
22249
|
i.lengthComputable && (n == null || n(Math.round(i.loaded / i.total * 100)));
|
|
22250
22250
|
}), a.onload = () => {
|
|
22251
22251
|
if (a.status >= 200 && a.status < 300) {
|
|
@@ -33839,7 +33839,7 @@ const JM = ({ channelId: e, message: t, onChannelChange: u, onMessageChange: n }
|
|
|
33839
33839
|
justify-content: space-between;
|
|
33840
33840
|
gap: ${y.space.lg}px;
|
|
33841
33841
|
width: 100%;
|
|
33842
|
-
padding: ${y.space.xxl}px
|
|
33842
|
+
padding: ${y.space.xxl}px ${y.space.xl}px;
|
|
33843
33843
|
cursor: pointer;
|
|
33844
33844
|
user-select: none;
|
|
33845
33845
|
background: none;
|
|
@@ -33852,15 +33852,11 @@ const JM = ({ channelId: e, message: t, onChannelChange: u, onMessageChange: n }
|
|
|
33852
33852
|
gap: ${y.space.lg}px;
|
|
33853
33853
|
min-width: 0;
|
|
33854
33854
|
`, nP = w(K)`
|
|
33855
|
-
|
|
33856
|
-
|
|
33857
|
-
|
|
33858
|
-
|
|
33859
|
-
|
|
33860
|
-
letter-spacing: -0.005em;
|
|
33861
|
-
color: rgb(52, 60, 69);
|
|
33862
|
-
-webkit-font-smoothing: auto;
|
|
33863
|
-
}
|
|
33855
|
+
font-family: ${y.font.family};
|
|
33856
|
+
font-size: 14px;
|
|
33857
|
+
line-height: 20px;
|
|
33858
|
+
font-weight: ${y.font.weightMedium};
|
|
33859
|
+
color: ${y.color.slateTextTitle};
|
|
33864
33860
|
`, rP = w(N)`
|
|
33865
33861
|
display: inline-flex;
|
|
33866
33862
|
align-items: center;
|
|
@@ -33878,7 +33874,7 @@ const JM = ({ channelId: e, message: t, onChannelChange: u, onMessageChange: n }
|
|
|
33878
33874
|
font-weight: ${y.font.weightMedium};
|
|
33879
33875
|
`, ma = w(j)`
|
|
33880
33876
|
gap: ${y.space.xl}px;
|
|
33881
|
-
padding: 0
|
|
33877
|
+
padding: 0 ${y.space.xl}px ${y.space.lg}px;
|
|
33882
33878
|
`, o2 = w(K)`
|
|
33883
33879
|
&& {
|
|
33884
33880
|
width: 100%;
|
|
@@ -34097,7 +34093,7 @@ const JM = ({ channelId: e, message: t, onChannelChange: u, onMessageChange: n }
|
|
|
34097
34093
|
return /* @__PURE__ */ f.jsxs(eP, { children: [
|
|
34098
34094
|
/* @__PURE__ */ f.jsxs(tP, { role: "button", tabIndex: 0, onClick: () => F((M) => !M), children: [
|
|
34099
34095
|
/* @__PURE__ */ f.jsxs(uP, { children: [
|
|
34100
|
-
/* @__PURE__ */ f.jsx(r2, { size:
|
|
34096
|
+
/* @__PURE__ */ f.jsx(r2, { size: 20 }),
|
|
34101
34097
|
/* @__PURE__ */ f.jsx(nP, { children: "Slack" }),
|
|
34102
34098
|
L > 0 && /* @__PURE__ */ f.jsx(rP, { children: L })
|
|
34103
34099
|
] }),
|
package/index.umd.js
CHANGED
|
@@ -2677,7 +2677,7 @@ Do you want to continue?`,kv="Select an object to create",Tv="Select an object t
|
|
|
2677
2677
|
height: 20px;
|
|
2678
2678
|
flex-shrink: 0;
|
|
2679
2679
|
}
|
|
2680
|
-
`,uA=({cardData:e,cardDataApiStatus:t,objectToLink:u,args:n})=>{const r=yt(),[o,a]=h.useState(!1),[i,D]=h.useState(!0),{id:c="",cardTitle:l="",logoUrl:d}=e||{},F=t===se.LOADING,E=p=>{p.stopPropagation();const A=p.currentTarget.offsetWidth<p.currentTarget.scrollWidth;a(!!A)},C=p=>{var g;r(Ir({id:u,args:n,isRefresh:!0}));const A=p.target.tagName==="BUTTON"?(g=p.target)==null?void 0:g.firstChild:p.target;A.className&&(A.className=""),setTimeout(()=>A.className="selected",1)};return f.jsxs(ek,{children:[f.jsxs(tk,{direction:"row",justifyContent:"space-between",children:[F?f.jsxs(s.Stack,{gap:"6px",direction:"row",children:[f.jsx(fu,{width:"16px",height:"24px"}),f.jsx(fu,{width:"100px",height:"24px"})]}):f.jsxs(nk,{children:[d&&f.jsx("img",{src:d,alt:l}),f.jsx(s.Tooltip,{title:o?l:"",children:f.jsx(s.Typography,{variant:"h4",onMouseOver:p=>E(p),onMouseLeave:p=>E(p),children:l})})]}),f.jsxs(s.Stack,{direction:"row",alignItems:"center",children:[i?f.jsx(s.Tooltip,{title:F3,placement:"bottom",children:f.jsx(Fr,{onClick:p=>C(p),children:f.jsx("img",{src:jd})})}):null,f.jsx(s.Tooltip,{title:i?h3:Ua,placement:"bottom",children:f.jsx(Fr,{onClick:()=>D(p=>!p),children:f.jsx(as,{className:i?"":"hiver-up"})})})]})]}),f.jsx(_d,{id:c,cardTitle:l,specificCardData:{[c]:e},specificConnectorApiStatus:{[c]:t},isOpen:i})]})},nA={values:{},errors:{}},Qt={SET_FIELD_VALUE:"SET_FIELD_VALUE",CLEAR_ERROR:"CLEAR_ERROR",SET_FIELD_ERROR:"SET_FIELD_ERROR",SET_FIELDS:"SET_FIELDS",SET_FORM_DEFAULTS:"SET_FORM_DEFAULTS",CLEAR_FIELDS:"CLEAR_FIELDS",RESET_STATE:"RESET_STATE"},rk=(e,t)=>{const{type:u,payload:n}=t;switch(u){case Qt.SET_FIELD_VALUE:{if(!(n!=null&&n.value))return e;const{name:r,value:o}=n.value;return{...e,values:{...e.values,[r]:o}}}case Qt.SET_FIELD_ERROR:{if(!(n!=null&&n.value))return e;const{name:r,value:o}=n.value;return typeof o=="boolean"||typeof o=="string"?{...e,errors:{...e.errors,[r]:o}}:e}case Qt.CLEAR_ERROR:{if(!(n!=null&&n.value))return e;const{name:r}=n.value;return{...e,errors:{...e.errors,[r]:""}}}case Qt.SET_FIELDS:{if(!(n!=null&&n.values))return e;const{values:r}=n;return{...e,values:r}}case Qt.SET_FORM_DEFAULTS:{if(!(n!=null&&n.values))return e;const{values:r}=n,o={...e.errors};for(const a in r??{})r[a]&&delete o[a];return{...e,errors:o,values:{...e.values,...r}}}case Qt.CLEAR_FIELDS:{const{fieldNames:r}=n??{};if(!Array.isArray(r))return e;const o={...e.values},a={...e.errors};for(const i of r)delete o[i],delete a[i];return{...e,values:o,errors:a}}case Qt.RESET_STATE:return nA}return e},rA=()=>h.useReducer(rk,nA),oA=({state:e,dispatch:t,validations:u,dynamicFields:n})=>{const r=e.errors,o=(E,C)=>{t({type:Qt.SET_FIELD_VALUE,payload:{value:{value:C,name:E}}})},a=h.useCallback(E=>{t({type:Qt.SET_FORM_DEFAULTS,payload:{values:E}})},[t]),i=h.useCallback(()=>Object.keys(r).filter(C=>!!r[C]).length>0,[r]),D=E=>{E.stopPropagation();const{name:C,value:p}=(E==null?void 0:E.target)||{};o(C,p)},c=(E,C)=>{E.stopPropagation();const{name:p}=(E==null?void 0:E.target)||{};o(p,C)},l=(E,C)=>{o(E,C||"")},d=(E,C)=>{e.errors[E]!==C&&t({type:Qt.SET_FIELD_ERROR,payload:{value:{name:E,value:C}}})},F=(E,C)=>{if(C){const p=C[E];p==null||p.forEach(A=>{var g;o(A,""),C[A]&&F(A,C),(g=u[A])!=null&&g.isRequired&&d(A,!0)})}};return h.useEffect(()=>{if(Array.isArray(n))return()=>{const E=n.map(C=>C.name);t({type:Qt.CLEAR_FIELDS,payload:{fieldNames:E}})}},[n,t]),{setValue:o,setFormDefaults:a,isErrorInValidations:i,inputChangeHandler:D,checkboxChangeHandler:c,dateChangeHandler:l,handleValidationError:d,clearDependentFields:F}},fA=({formFields:e,formId:t,formState:u,appDispatch:n})=>e.reduce((r,o)=>{if(o.type!=="async-select"||!o.interfaceDetails)return r;const a=o.interfaceDetails,i={loadOptions:(D,c,l,d)=>{let F=a;o.searchInterfaceDetails&&typeof D=="string"&&D.trim().length>0&&!l&&(F=o.searchInterfaceDetails);const E=Ww(u,F==null?void 0:F.args),C=Object.values((F==null?void 0:F.args)||{});if(E.length===C.length){n(zn({fieldName:o.name,formId:String(t),searchTerm:D,fieldConfig:o,interfaceId:F==null?void 0:F.id,pagination:F==null?void 0:F.pagination,callback:c,args:{...Ro(u,F==null?void 0:F.args),...Ro(u,F==null?void 0:F.optionalArgs)},isScrollToBottomEvent:l,controller:d}));return}return c([])}};return{...r,[o.name]:i}},{}),aA=({formFields:e,formId:t,formState:u,conversationId:n,appDispatch:r})=>e.reduce((o,a)=>{if(!a.createOptionInterfaceDetails)return o;const i=a.createOptionInterfaceDetails;return{...o,[a.name]:{createOption:(D,c)=>{var d,F;if(!D)return;const l={values:{name:a.name,value:D},errors:{}};r(Sf({fieldName:a.name,formId:String(t),interfaceId:i.id,conversationId:n,label:D,callback:c,args:{...Ro(u,(d=a==null?void 0:a.interfaceDetails)==null?void 0:d.args),...Ro(u,(F=a==null?void 0:a.interfaceDetails)==null?void 0:F.optionalArgs)},createArgs:{...Ro(l,i.args)}}))}}}},{}),sA=({formFields:e,formState:t,formId:u,conversationId:n})=>{const r=yt(),o=h.useMemo(()=>{if(e&&e.length){const i=fA({formFields:e,formId:u,formState:t,appDispatch:r});return e.reduce((c,l)=>{const d=l.columns;if(!d)return c;const F=fA({formFields:d,formId:u,formState:t,appDispatch:r});return{...c,[l.name]:{loadOptionsList:F}}},i)}return null},[e,t,u,r]),a=h.useMemo(()=>{const i=aA({formFields:e,formId:u,formState:t,conversationId:n,appDispatch:r});return e.reduce((c,l)=>{const d=l.columns;if(!d)return c;const F=aA({formFields:d,formId:u,formState:t,conversationId:n,appDispatch:r});return{...c,[l.name]:{createOptionList:F}}},i)},[e,u,t,n,r]);return{fetchConfig:o,createConfig:a}},ok=async({formId:e})=>{try{const t=await Fe({url:lt(gd,{formId:e}),method:ye.GET}),u=t==null?void 0:t.data;return u.enabled?ul(u.defaults):{}}catch(t){throw console.error(t),t}},iA=({formId:e})=>["Global","WriteForm","FormDefaults",e],fk=({formId:e,enabled:t})=>{const u=h.useRef(!1),n=h.useRef(void 0);e&&e!==n.current&&(u.current=!0,n.current=e);const r=st({queryKey:iA({formId:e}),queryFn:async()=>{const o=await ok({formId:e});return u.current=!1,o},refetchOnMount:!0,enabled:u.current&&t,staleTime:0});return{enabledRef:u,...r}},DA=e=>Array.isArray(e)&&e.length>0,ak=async({formId:e,conversationId:t,inboxIds:u})=>{try{const n=new URLSearchParams;if(t&&n.set("conversation_id",String(t)),DA(u))for(const a of u)n.append("inbox_id",String(a));const r=await Fe({url:lt(dv,{formId:e})+"?"+n.toString(),method:ye.GET}),o=r==null?void 0:r.data;if(!o.enabled)throw new Error("Form default values are not enabled");return ul(o.defaults,!0)}catch(n){throw console.error(n),n}},cA=({formId:e,conversationId:t,inboxIds:u})=>["Global","WriteForm","FormDefaults",e,t,u],lA=({formId:e,conversationId:t,inboxIds:u,enabled:n,fetchOnMount:r=!0})=>{const o=h.useRef(!0),a=h.useRef();e!==a.current&&(o.current=!0,a.current=e);const i=st({queryKey:cA({formId:e,conversationId:t,inboxIds:u}),queryFn:async()=>{const c=await ak({formId:e,conversationId:t,inboxIds:u});return o.current=!1,c},refetchOnMount:r,enabled:o.current&&!!e&&!!t&&DA(u)&&n,staleTime:0}),D=h.useMemo(()=>{if(Object.keys(i.data??{}).length===0&&i.isSuccess)return!0},[i.data,i.isSuccess]);return{enabledRef:o,isNudgeRequired:D,...i}},sk=async({formId:e,data:t})=>{try{return await Fe({url:lt(gd,{formId:e}),data:{defaults:t},method:ye.PUT}),{formId:e,data:t}}catch(u){throw console.error(u),u}},ik=({formId:e,conversationId:t,inboxIds:u,onSuccess:n,onError:r})=>{const o=Lt();return ru({mutationFn:a=>sk({formId:e,data:a}),onSuccess:a=>{o.invalidateQueries({queryKey:iA({formId:e})}),o.invalidateQueries({queryKey:cA({formId:e,conversationId:t,inboxIds:u})}),n==null||n(a),Oe({message:"Form defaults updated successfully",type:hu})},onError:()=>{r==null||r(),Oe({message:"Failed to update form defaults",type:$e})}})},Dk=({open:e,isEdit:t,formId:u,fields:n,connectorLogo:r,variables:o,customFormArgsEnabled:a,customFormArgsMap:i,title:D="Pre-fill fields",isLoading:c=!1,onSuccess:l,onClose:d})=>{const[F,E]=h.useState({}),{conversationId:C,currentSmIds:p}=h.useContext(Ue),{data:A}=kE({formId:u,formData:F,argsMap:i??{},enabled:!!u&&!!a,delay:500}),{data:g,isLoading:m,enabledRef:b}=fk({formId:u,enabled:!t&&!!e&&!!u}),{mutate:x,isPending:y}=ik({formId:u,conversationId:C,inboxIds:p,onSuccess:_=>{b.current=!0,l==null||l(_)}}),B=h.useMemo(()=>A!=null&&A.length?[...n,...A]:n,[n,A]);h.useEffect(()=>{g&&E(g)},[g]);const v=_=>{const L=B.map(j=>({name:j.name,type:j.isMultiSelect?"multi-select":j.type})),O=VE(_,L);x(O)},S=async({args:_,pagination:L},{formId:O,fieldName:j})=>{const M=await Ad({formId:O,fieldName:j},{pagination:L,args:_}),H=Array.isArray(M==null?void 0:M.data.data)?M.data.data:[];return{options:H,hasMore:!!H.length}},I=_=>{if(_.type==="multi-select"){E(O=>({...O,[_.name]:_.value}));return}const L=qc(_.value)?_.value.value:_.value;E(O=>({...O,[_.name]:L}))};return f.jsx(Rw,{open:e,defaultValues:g,formId:u,fields:B,connectorLogo:r,variables:o,title:`Pre-fill fields for ${D}`,isLoading:c||m,isSaving:y,fetchOptions:S,onSave:v,onClose:()=>d==null?void 0:d(),onCancel:()=>d==null?void 0:d(),onFieldChange:I})},ck=async({formId:e,args:t})=>{try{const u=await Fe({url:lt(lv,{formId:e}),data:{args:t},method:ye.POST});return(u==null?void 0:u.data).fieldList.map(r=>b1(r))}catch(u){throw console.error(u),u}},lk=({formId:e,args:t,enabled:u,delay:n=500})=>{const[r,o]=h.useState(t);return h.useEffect(()=>{const a=setTimeout(()=>o(t),n);return()=>clearTimeout(a)},[t,n]),st({queryKey:["Global","WriteForm","CustomFields",e,r],queryFn:()=>ck({formId:e,args:t}),refetchOnMount:!1,enabled:u})},dk=(e,t,u,n)=>new Promise((r,o)=>{const a=new XMLHttpRequest;a.open("PUT",e,!0),a.setRequestHeader("Content-Type",t.type||"application/octet-stream"),Object.entries(u??{}).forEach(([i,D])=>a.setRequestHeader(i,D)),a.upload&&(a.upload.onprogress=i=>{i.lengthComputable&&(n==null||n(Math.round(i.loaded/i.total*100)))}),a.onload=()=>{if(a.status>=200&&a.status<300){r();return}o(Object.assign(new Error(`Upload failed (${a.status})`),{status:a.status}))},a.onerror=()=>o(new Error("upload network error")),a.onabort=()=>o(new Error("upload aborted")),a.send(t)}),Ak=async(e,t)=>{try{const u=await Fe({url:Av,data:{filename:e.name,size:e.size},method:ye.POST}),{attachmentId:n,presignedUrl:r,headers:o}=(u==null?void 0:u.data)??{};return await dk(r,e,o,t),{attachmentId:n,filename:e.name,size:e.size,mimeType:e.type||"application/octet-stream"}}catch(u){throw console.error(u),u}},pk=()=>ru({mutationFn:({file:e,onProgress:t})=>Ak(e,t)}),dA="connector-agent_auto_fill_nudge",Ck=s.styled(s.Stack)`
|
|
2680
|
+
`,uA=({cardData:e,cardDataApiStatus:t,objectToLink:u,args:n})=>{const r=yt(),[o,a]=h.useState(!1),[i,D]=h.useState(!0),{id:c="",cardTitle:l="",logoUrl:d}=e||{},F=t===se.LOADING,E=p=>{p.stopPropagation();const A=p.currentTarget.offsetWidth<p.currentTarget.scrollWidth;a(!!A)},C=p=>{var g;r(Ir({id:u,args:n,isRefresh:!0}));const A=p.target.tagName==="BUTTON"?(g=p.target)==null?void 0:g.firstChild:p.target;A.className&&(A.className=""),setTimeout(()=>A.className="selected",1)};return f.jsxs(ek,{children:[f.jsxs(tk,{direction:"row",justifyContent:"space-between",children:[F?f.jsxs(s.Stack,{gap:"6px",direction:"row",children:[f.jsx(fu,{width:"16px",height:"24px"}),f.jsx(fu,{width:"100px",height:"24px"})]}):f.jsxs(nk,{children:[d&&f.jsx("img",{src:d,alt:l}),f.jsx(s.Tooltip,{title:o?l:"",children:f.jsx(s.Typography,{variant:"h4",onMouseOver:p=>E(p),onMouseLeave:p=>E(p),children:l})})]}),f.jsxs(s.Stack,{direction:"row",alignItems:"center",children:[i?f.jsx(s.Tooltip,{title:F3,placement:"bottom",children:f.jsx(Fr,{onClick:p=>C(p),children:f.jsx("img",{src:jd})})}):null,f.jsx(s.Tooltip,{title:i?h3:Ua,placement:"bottom",children:f.jsx(Fr,{onClick:()=>D(p=>!p),children:f.jsx(as,{className:i?"":"hiver-up"})})})]})]}),f.jsx(_d,{id:c,cardTitle:l,specificCardData:{[c]:e},specificConnectorApiStatus:{[c]:t},isOpen:i})]})},nA={values:{},errors:{}},Qt={SET_FIELD_VALUE:"SET_FIELD_VALUE",CLEAR_ERROR:"CLEAR_ERROR",SET_FIELD_ERROR:"SET_FIELD_ERROR",SET_FIELDS:"SET_FIELDS",SET_FORM_DEFAULTS:"SET_FORM_DEFAULTS",CLEAR_FIELDS:"CLEAR_FIELDS",RESET_STATE:"RESET_STATE"},rk=(e,t)=>{const{type:u,payload:n}=t;switch(u){case Qt.SET_FIELD_VALUE:{if(!(n!=null&&n.value))return e;const{name:r,value:o}=n.value;return{...e,values:{...e.values,[r]:o}}}case Qt.SET_FIELD_ERROR:{if(!(n!=null&&n.value))return e;const{name:r,value:o}=n.value;return typeof o=="boolean"||typeof o=="string"?{...e,errors:{...e.errors,[r]:o}}:e}case Qt.CLEAR_ERROR:{if(!(n!=null&&n.value))return e;const{name:r}=n.value;return{...e,errors:{...e.errors,[r]:""}}}case Qt.SET_FIELDS:{if(!(n!=null&&n.values))return e;const{values:r}=n;return{...e,values:r}}case Qt.SET_FORM_DEFAULTS:{if(!(n!=null&&n.values))return e;const{values:r}=n,o={...e.errors};for(const a in r??{})r[a]&&delete o[a];return{...e,errors:o,values:{...e.values,...r}}}case Qt.CLEAR_FIELDS:{const{fieldNames:r}=n??{};if(!Array.isArray(r))return e;const o={...e.values},a={...e.errors};for(const i of r)delete o[i],delete a[i];return{...e,values:o,errors:a}}case Qt.RESET_STATE:return nA}return e},rA=()=>h.useReducer(rk,nA),oA=({state:e,dispatch:t,validations:u,dynamicFields:n})=>{const r=e.errors,o=(E,C)=>{t({type:Qt.SET_FIELD_VALUE,payload:{value:{value:C,name:E}}})},a=h.useCallback(E=>{t({type:Qt.SET_FORM_DEFAULTS,payload:{values:E}})},[t]),i=h.useCallback(()=>Object.keys(r).filter(C=>!!r[C]).length>0,[r]),D=E=>{E.stopPropagation();const{name:C,value:p}=(E==null?void 0:E.target)||{};o(C,p)},c=(E,C)=>{E.stopPropagation();const{name:p}=(E==null?void 0:E.target)||{};o(p,C)},l=(E,C)=>{o(E,C||"")},d=(E,C)=>{e.errors[E]!==C&&t({type:Qt.SET_FIELD_ERROR,payload:{value:{name:E,value:C}}})},F=(E,C)=>{if(C){const p=C[E];p==null||p.forEach(A=>{var g;o(A,""),C[A]&&F(A,C),(g=u[A])!=null&&g.isRequired&&d(A,!0)})}};return h.useEffect(()=>{if(Array.isArray(n))return()=>{const E=n.map(C=>C.name);t({type:Qt.CLEAR_FIELDS,payload:{fieldNames:E}})}},[n,t]),{setValue:o,setFormDefaults:a,isErrorInValidations:i,inputChangeHandler:D,checkboxChangeHandler:c,dateChangeHandler:l,handleValidationError:d,clearDependentFields:F}},fA=({formFields:e,formId:t,formState:u,appDispatch:n})=>e.reduce((r,o)=>{if(o.type!=="async-select"||!o.interfaceDetails)return r;const a=o.interfaceDetails,i={loadOptions:(D,c,l,d)=>{let F=a;o.searchInterfaceDetails&&typeof D=="string"&&D.trim().length>0&&!l&&(F=o.searchInterfaceDetails);const E=Ww(u,F==null?void 0:F.args),C=Object.values((F==null?void 0:F.args)||{});if(E.length===C.length){n(zn({fieldName:o.name,formId:String(t),searchTerm:D,fieldConfig:o,interfaceId:F==null?void 0:F.id,pagination:F==null?void 0:F.pagination,callback:c,args:{...Ro(u,F==null?void 0:F.args),...Ro(u,F==null?void 0:F.optionalArgs)},isScrollToBottomEvent:l,controller:d}));return}return c([])}};return{...r,[o.name]:i}},{}),aA=({formFields:e,formId:t,formState:u,conversationId:n,appDispatch:r})=>e.reduce((o,a)=>{if(!a.createOptionInterfaceDetails)return o;const i=a.createOptionInterfaceDetails;return{...o,[a.name]:{createOption:(D,c)=>{var d,F;if(!D)return;const l={values:{name:a.name,value:D},errors:{}};r(Sf({fieldName:a.name,formId:String(t),interfaceId:i.id,conversationId:n,label:D,callback:c,args:{...Ro(u,(d=a==null?void 0:a.interfaceDetails)==null?void 0:d.args),...Ro(u,(F=a==null?void 0:a.interfaceDetails)==null?void 0:F.optionalArgs)},createArgs:{...Ro(l,i.args)}}))}}}},{}),sA=({formFields:e,formState:t,formId:u,conversationId:n})=>{const r=yt(),o=h.useMemo(()=>{if(e&&e.length){const i=fA({formFields:e,formId:u,formState:t,appDispatch:r});return e.reduce((c,l)=>{const d=l.columns;if(!d)return c;const F=fA({formFields:d,formId:u,formState:t,appDispatch:r});return{...c,[l.name]:{loadOptionsList:F}}},i)}return null},[e,t,u,r]),a=h.useMemo(()=>{const i=aA({formFields:e,formId:u,formState:t,conversationId:n,appDispatch:r});return e.reduce((c,l)=>{const d=l.columns;if(!d)return c;const F=aA({formFields:d,formId:u,formState:t,conversationId:n,appDispatch:r});return{...c,[l.name]:{createOptionList:F}}},i)},[e,u,t,n,r]);return{fetchConfig:o,createConfig:a}},ok=async({formId:e})=>{try{const t=await Fe({url:lt(gd,{formId:e}),method:ye.GET}),u=t==null?void 0:t.data;return u.enabled?ul(u.defaults):{}}catch(t){throw console.error(t),t}},iA=({formId:e})=>["Global","WriteForm","FormDefaults",e],fk=({formId:e,enabled:t})=>{const u=h.useRef(!1),n=h.useRef(void 0);e&&e!==n.current&&(u.current=!0,n.current=e);const r=st({queryKey:iA({formId:e}),queryFn:async()=>{const o=await ok({formId:e});return u.current=!1,o},refetchOnMount:!0,enabled:u.current&&t,staleTime:0});return{enabledRef:u,...r}},DA=e=>Array.isArray(e)&&e.length>0,ak=async({formId:e,conversationId:t,inboxIds:u})=>{try{const n=new URLSearchParams;if(t&&n.set("conversation_id",String(t)),DA(u))for(const a of u)n.append("inbox_id",String(a));const r=await Fe({url:lt(dv,{formId:e})+"?"+n.toString(),method:ye.GET}),o=r==null?void 0:r.data;if(!o.enabled)throw new Error("Form default values are not enabled");return ul(o.defaults,!0)}catch(n){throw console.error(n),n}},cA=({formId:e,conversationId:t,inboxIds:u})=>["Global","WriteForm","FormDefaults",e,t,u],lA=({formId:e,conversationId:t,inboxIds:u,enabled:n,fetchOnMount:r=!0})=>{const o=h.useRef(!0),a=h.useRef();e!==a.current&&(o.current=!0,a.current=e);const i=st({queryKey:cA({formId:e,conversationId:t,inboxIds:u}),queryFn:async()=>{const c=await ak({formId:e,conversationId:t,inboxIds:u});return o.current=!1,c},refetchOnMount:r,enabled:o.current&&!!e&&!!t&&DA(u)&&n,staleTime:0}),D=h.useMemo(()=>{if(Object.keys(i.data??{}).length===0&&i.isSuccess)return!0},[i.data,i.isSuccess]);return{enabledRef:o,isNudgeRequired:D,...i}},sk=async({formId:e,data:t})=>{try{return await Fe({url:lt(gd,{formId:e}),data:{defaults:t},method:ye.PUT}),{formId:e,data:t}}catch(u){throw console.error(u),u}},ik=({formId:e,conversationId:t,inboxIds:u,onSuccess:n,onError:r})=>{const o=Lt();return ru({mutationFn:a=>sk({formId:e,data:a}),onSuccess:a=>{o.invalidateQueries({queryKey:iA({formId:e})}),o.invalidateQueries({queryKey:cA({formId:e,conversationId:t,inboxIds:u})}),n==null||n(a),Oe({message:"Form defaults updated successfully",type:hu})},onError:()=>{r==null||r(),Oe({message:"Failed to update form defaults",type:$e})}})},Dk=({open:e,isEdit:t,formId:u,fields:n,connectorLogo:r,variables:o,customFormArgsEnabled:a,customFormArgsMap:i,title:D="Pre-fill fields",isLoading:c=!1,onSuccess:l,onClose:d})=>{const[F,E]=h.useState({}),{conversationId:C,currentSmIds:p}=h.useContext(Ue),{data:A}=kE({formId:u,formData:F,argsMap:i??{},enabled:!!u&&!!a,delay:500}),{data:g,isLoading:m,enabledRef:b}=fk({formId:u,enabled:!t&&!!e&&!!u}),{mutate:x,isPending:y}=ik({formId:u,conversationId:C,inboxIds:p,onSuccess:_=>{b.current=!0,l==null||l(_)}}),B=h.useMemo(()=>A!=null&&A.length?[...n,...A]:n,[n,A]);h.useEffect(()=>{g&&E(g)},[g]);const v=_=>{const L=B.map(j=>({name:j.name,type:j.isMultiSelect?"multi-select":j.type})),O=VE(_,L);x(O)},S=async({args:_,pagination:L},{formId:O,fieldName:j})=>{const M=await Ad({formId:O,fieldName:j},{pagination:L,args:_}),H=Array.isArray(M==null?void 0:M.data.data)?M.data.data:[];return{options:H,hasMore:!!H.length}},I=_=>{if(_.type==="multi-select"){E(O=>({...O,[_.name]:_.value}));return}const L=qc(_.value)?_.value.value:_.value;E(O=>({...O,[_.name]:L}))};return f.jsx(Rw,{open:e,defaultValues:g,formId:u,fields:B,connectorLogo:r,variables:o,title:`Pre-fill fields for ${D}`,isLoading:c||m,isSaving:y,fetchOptions:S,onSave:v,onClose:()=>d==null?void 0:d(),onCancel:()=>d==null?void 0:d(),onFieldChange:I})},ck=async({formId:e,args:t})=>{try{const u=await Fe({url:lt(lv,{formId:e}),data:{args:t},method:ye.POST});return(u==null?void 0:u.data).fieldList.map(r=>b1(r))}catch(u){throw console.error(u),u}},lk=({formId:e,args:t,enabled:u,delay:n=500})=>{const[r,o]=h.useState(t);return h.useEffect(()=>{const a=setTimeout(()=>o(t),n);return()=>clearTimeout(a)},[t,n]),st({queryKey:["Global","WriteForm","CustomFields",e,r],queryFn:()=>ck({formId:e,args:t}),refetchOnMount:!1,enabled:u})},dk=(e,t,u,n)=>new Promise((r,o)=>{const a=new XMLHttpRequest;a.open("PUT",e,!0),Object.entries(u??{}).forEach(([i,D])=>a.setRequestHeader(i,D)),a.upload&&(a.upload.onprogress=i=>{i.lengthComputable&&(n==null||n(Math.round(i.loaded/i.total*100)))}),a.onload=()=>{if(a.status>=200&&a.status<300){r();return}o(Object.assign(new Error(`Upload failed (${a.status})`),{status:a.status}))},a.onerror=()=>o(new Error("upload network error")),a.onabort=()=>o(new Error("upload aborted")),a.send(t)}),Ak=async(e,t)=>{try{const u=await Fe({url:Av,data:{filename:e.name,size:e.size},method:ye.POST}),{attachmentId:n,presignedUrl:r,headers:o}=(u==null?void 0:u.data)??{};return await dk(r,e,o,t),{attachmentId:n,filename:e.name,size:e.size,mimeType:e.type||"application/octet-stream"}}catch(u){throw console.error(u),u}},pk=()=>ru({mutationFn:({file:e,onProgress:t})=>Ak(e,t)}),dA="connector-agent_auto_fill_nudge",Ck=s.styled(s.Stack)`
|
|
2681
2681
|
gap: 12px;
|
|
2682
2682
|
align-items: stretch;
|
|
2683
2683
|
border: 1px solid #e0bce8;
|
|
@@ -4753,7 +4753,7 @@ Do you want to continue?`,kv="Select an object to create",Tv="Select an object t
|
|
|
4753
4753
|
justify-content: space-between;
|
|
4754
4754
|
gap: ${w.space.lg}px;
|
|
4755
4755
|
width: 100%;
|
|
4756
|
-
padding: ${w.space.xxl}px
|
|
4756
|
+
padding: ${w.space.xxl}px ${w.space.xl}px;
|
|
4757
4757
|
cursor: pointer;
|
|
4758
4758
|
user-select: none;
|
|
4759
4759
|
background: none;
|
|
@@ -4766,15 +4766,11 @@ Do you want to continue?`,kv="Select an object to create",Tv="Select an object t
|
|
|
4766
4766
|
gap: ${w.space.lg}px;
|
|
4767
4767
|
min-width: 0;
|
|
4768
4768
|
`,rP=s.styled(s.Typography)`
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
letter-spacing: -0.005em;
|
|
4775
|
-
color: rgb(52, 60, 69);
|
|
4776
|
-
-webkit-font-smoothing: auto;
|
|
4777
|
-
}
|
|
4769
|
+
font-family: ${w.font.family};
|
|
4770
|
+
font-size: 14px;
|
|
4771
|
+
line-height: 20px;
|
|
4772
|
+
font-weight: ${w.font.weightMedium};
|
|
4773
|
+
color: ${w.color.slateTextTitle};
|
|
4778
4774
|
`,oP=s.styled(s.Box)`
|
|
4779
4775
|
display: inline-flex;
|
|
4780
4776
|
align-items: center;
|
|
@@ -4792,7 +4788,7 @@ Do you want to continue?`,kv="Select an object to create",Tv="Select an object t
|
|
|
4792
4788
|
font-weight: ${w.font.weightMedium};
|
|
4793
4789
|
`,ri=s.styled(s.Stack)`
|
|
4794
4790
|
gap: ${w.space.xl}px;
|
|
4795
|
-
padding: 0
|
|
4791
|
+
padding: 0 ${w.space.xl}px ${w.space.lg}px;
|
|
4796
4792
|
`,r4=s.styled(s.Typography)`
|
|
4797
4793
|
&& {
|
|
4798
4794
|
width: 100%;
|
|
@@ -4915,7 +4911,7 @@ Do you want to continue?`,kv="Select an object to create",Tv="Select an object t
|
|
|
4915
4911
|
&:hover {
|
|
4916
4912
|
text-decoration: underline;
|
|
4917
4913
|
}
|
|
4918
|
-
`,FP=({expanded:e})=>f.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{transition:"transform 150ms ease",transform:e?"rotate(180deg)":"none"},children:f.jsx("path",{d:"M4 6l4 4 4-4"})}),hP=e=>{if(e.targetKind==="channel"){const t=[];for(const u of e.threads??[])t.push(u.root,...u.replies);return t}return e.messages},EP=e=>e.targetKind==="channel"?(e.threads??[]).reduce((t,u)=>t+1+u.replies.length,0):e.messages.length,mP=e=>{const t=hP(e).filter(u=>!u.deletedAt&&u.subtype!=="tombstone");return t.length===0?null:t.reduce((u,n)=>Number(n.postedAt)>Number(u.postedAt)?n:u)},bP=({onViewAll:e})=>{var j;const{hiverConvId:t,connectorId:u,smId:n,smIds:r,sendTrackingEvent:o,boxedMessages:a,isActive:i=!0}=qu(),D=c8(n,r);Pf(u,!0);const{state:c,connect:l}=Wo(u,{onConnected:()=>o==null?void 0:o(Ja)}),d=c==="connected",F=Zf(t,d,i?VN:0),{data:E,isLoading:C}=F8(t,d&&!!F.data),p=(j=F.data)==null?void 0:j.mentions,A=h.useMemo(()=>{const M=new Map;return(E??[]).forEach(H=>{H.name&&M.set(H.externalUserId,H.name)}),Object.entries(p??{}).forEach(([H,V])=>{V&&!M.has(H)&&M.set(H,V)}),M},[E,p]),[g,m]=h.useState(!0),[b,x]=h.useState(!1),y=c==="in_progress",B=h.useCallback(()=>{const M=c==="reauth_required"||c==="workspace_mismatch";o==null||o(za,{is_reauth:M}),l()},[l,o,c]),v=h.useCallback(()=>{o==null||o(A3),x(!0)},[o]);if(D.isLoading||D.data&&!D.data.enabled)return null;const S=d&&!F.isLoading?F.data:null,I=S?mP(S):null,_=I?a&&I.author.isSelf?"You":`${I.author.name||I.author.externalUserId}${!a&&I.author.isSelf?" (You)":""}`:"",L=()=>d?F.isLoading?null:S?f.jsxs(ri,{children:[f.jsxs(aP,{children:[f.jsx(sP,{children:"Channel:"}),f.jsxs(iP,{children:["#",S.channelName]})]}),I&&f.jsxs(DP,{children:[f.jsx(cP,{"aria-hidden":!0,children:f.jsx(Jf,{url:I.author.avatarUrl,name:I.author.name,fallbackId:I.author.externalUserId})}),f.jsxs(lP,{children:[f.jsxs(dP,{children:[f.jsx(AP,{title:_,children:_}),f.jsx(pP,{children:I8(I.postedAt,!!a)})]}),f.jsx(CP,{children:v8(X1(I.text),A,C)})]})]}),f.jsx(gP,{role:"button",tabIndex:0,onClick:()=>e==null?void 0:e(),children:"View all"})]}):f.jsxs(ri,{children:[f.jsx(r4,{children:"Start an internal discussion about this conversation."}),f.jsx(fP,{variant:"contained",disableElevation:!0,onClick:v,children:"+ Start new"})]}):f.jsxs(ri,{children:[f.jsx(r4,{children:"Discuss this customer issue with your team on Slack from Hiver. Connect Slack to get started."}),f.jsxs(A8,{disableElevation:!0,onClick:B,disabled:y,children:[f.jsx(n4,{size:16}),y?"Connecting…":"Connect Slack"]})]}),O=S?EP(S):0;return f.jsxs(tP,{children:[f.jsxs(uP,{role:"button",tabIndex:0,onClick:()=>m(M=>!M),children:[f.jsxs(nP,{children:[f.jsx(n4,{size:
|
|
4914
|
+
`,FP=({expanded:e})=>f.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{transition:"transform 150ms ease",transform:e?"rotate(180deg)":"none"},children:f.jsx("path",{d:"M4 6l4 4 4-4"})}),hP=e=>{if(e.targetKind==="channel"){const t=[];for(const u of e.threads??[])t.push(u.root,...u.replies);return t}return e.messages},EP=e=>e.targetKind==="channel"?(e.threads??[]).reduce((t,u)=>t+1+u.replies.length,0):e.messages.length,mP=e=>{const t=hP(e).filter(u=>!u.deletedAt&&u.subtype!=="tombstone");return t.length===0?null:t.reduce((u,n)=>Number(n.postedAt)>Number(u.postedAt)?n:u)},bP=({onViewAll:e})=>{var j;const{hiverConvId:t,connectorId:u,smId:n,smIds:r,sendTrackingEvent:o,boxedMessages:a,isActive:i=!0}=qu(),D=c8(n,r);Pf(u,!0);const{state:c,connect:l}=Wo(u,{onConnected:()=>o==null?void 0:o(Ja)}),d=c==="connected",F=Zf(t,d,i?VN:0),{data:E,isLoading:C}=F8(t,d&&!!F.data),p=(j=F.data)==null?void 0:j.mentions,A=h.useMemo(()=>{const M=new Map;return(E??[]).forEach(H=>{H.name&&M.set(H.externalUserId,H.name)}),Object.entries(p??{}).forEach(([H,V])=>{V&&!M.has(H)&&M.set(H,V)}),M},[E,p]),[g,m]=h.useState(!0),[b,x]=h.useState(!1),y=c==="in_progress",B=h.useCallback(()=>{const M=c==="reauth_required"||c==="workspace_mismatch";o==null||o(za,{is_reauth:M}),l()},[l,o,c]),v=h.useCallback(()=>{o==null||o(A3),x(!0)},[o]);if(D.isLoading||D.data&&!D.data.enabled)return null;const S=d&&!F.isLoading?F.data:null,I=S?mP(S):null,_=I?a&&I.author.isSelf?"You":`${I.author.name||I.author.externalUserId}${!a&&I.author.isSelf?" (You)":""}`:"",L=()=>d?F.isLoading?null:S?f.jsxs(ri,{children:[f.jsxs(aP,{children:[f.jsx(sP,{children:"Channel:"}),f.jsxs(iP,{children:["#",S.channelName]})]}),I&&f.jsxs(DP,{children:[f.jsx(cP,{"aria-hidden":!0,children:f.jsx(Jf,{url:I.author.avatarUrl,name:I.author.name,fallbackId:I.author.externalUserId})}),f.jsxs(lP,{children:[f.jsxs(dP,{children:[f.jsx(AP,{title:_,children:_}),f.jsx(pP,{children:I8(I.postedAt,!!a)})]}),f.jsx(CP,{children:v8(X1(I.text),A,C)})]})]}),f.jsx(gP,{role:"button",tabIndex:0,onClick:()=>e==null?void 0:e(),children:"View all"})]}):f.jsxs(ri,{children:[f.jsx(r4,{children:"Start an internal discussion about this conversation."}),f.jsx(fP,{variant:"contained",disableElevation:!0,onClick:v,children:"+ Start new"})]}):f.jsxs(ri,{children:[f.jsx(r4,{children:"Discuss this customer issue with your team on Slack from Hiver. Connect Slack to get started."}),f.jsxs(A8,{disableElevation:!0,onClick:B,disabled:y,children:[f.jsx(n4,{size:16}),y?"Connecting…":"Connect Slack"]})]}),O=S?EP(S):0;return f.jsxs(tP,{children:[f.jsxs(uP,{role:"button",tabIndex:0,onClick:()=>m(M=>!M),children:[f.jsxs(nP,{children:[f.jsx(n4,{size:20}),f.jsx(rP,{children:"Slack"}),O>0&&f.jsx(oP,{children:O})]}),f.jsx(FP,{expanded:g})]}),g&&L(),f.jsx($8,{open:b,onClose:()=>x(!1)})]})},xP=({onViewAll:e,...t})=>f.jsx(u4,{...t,children:f.jsx(bP,{onViewAll:e})});function yP(e){var u;const t=Zf(e,!0,0);return(u=t.data)!=null&&u.channelName?{label:t.data.channelName,isLinked:!0}:{label:"Slack",isLinked:!1}}const BP=e=>Fe({url:Kw,method:ye.POST,data:e}),wP=e=>Fe({url:$w,method:ye.POST,data:e}),vP=5e3,SP=(...e)=>{},IP=e=>{const t=new AbortController,u=async(n=0)=>{try{SP("getConnectorsList",n);const r=await Xc(e);if(t.signal.aborted)throw new Error("Fetch aborted");return r}catch(r){if(t.signal.aborted)throw new Error("Fetch aborted");return n>2?(console.error("Failed to get connectors list after 3 tries",r),[]):u(n+1)}};return{fetchConnectors:u,abort:t.abort.bind(t)}},kP=()=>{const e={connectorApiPending:!1,connectorApiAbort:null,lastInboxKey:null,lastFetchTs:0};if(!Mt())throw new Error("Please initiate bifrost by calling initConnectorsBifrost function before creating app store");const u=OE({name:"app-store",initialState:{}}),n=()=>{const i=u.getData("inboxIds");if(!Array.isArray(i)||!i.length)return;const D=[...i].sort().join(","),c=Date.now();if(D===e.lastInboxKey&&c-e.lastFetchTs<vP)return;e.lastInboxKey=D,e.lastFetchTs=c,e.connectorApiAbort&&e.connectorApiAbort(),e.connectorApiPending=!0;const l={all:"true",inbox_id:i},{fetchConnectors:d,abort:F}=IP(l);e.connectorApiAbort=F,d().then(E=>{Array.isArray(E)&&u.setData(E,"connectors")}).catch(E=>{console.warn("Failed to fetch connectors",E)}).finally(()=>{e.connectorApiPending=!1})},r=i=>{(!Array.isArray(i)||!i.length)&&(i=u.getData("connectors")||[]);const D=u.getData("sideBarTabs")||0,c=[...i].sort((l,d)=>{const F=l.lastAccessed??0,E=d.lastAccessed??0;return F===E?0:F>E?-1:1}).map((l,d)=>({...l,sidebarView:d<D}));u.setData(c,"connectorTabs")},o=()=>{const i=u.getData("connectors");if(!Array.isArray(i))return n();typeof u.getData("sideBarTabs")=="number"&&r()},a=i=>{if(!i)return;const D=u.getData("connectorTabs"),c=D==null?void 0:D.find(d=>d.id===i);if(!c||c.sidebarView)return;const l=new Date().getTime();c.lastAccessed=l,r(D)};return u.subscribe(o,"connectors"),u.subscribe(()=>r(),"sideBarTabs",!1),u.subscribe(a,"connectorId",!1),u.subscribe(n,"inboxIds",!1),u},TP=({children:e})=>f.jsx(s.HiverProvider,{inter:!0,children:e}),LP=s.styled(({className:e,...t})=>f.jsx(s.Tooltip,{...t,classes:{popper:e}}))(()=>({[`& .${s.tooltipClasses.tooltip}`]:{backgroundColor:"#fff",padding:0,width:"min-content",borderRadius:"12px",maxWidth:"90vw",boxShadow:"0px 3px 15px 0px #00000040",color:"#000"},[`& .${s.tooltipClasses.arrow}`]:{color:"#fff !important"}})),_P=s.styled(s.Stack)`
|
|
4919
4915
|
box-sizing: content-box !important;
|
|
4920
4916
|
display: flex;
|
|
4921
4917
|
flex-direction: column;
|