@hiver/connector-agent 4.19.0-attachment-beta.3 → 4.19.0-attachment-beta.5
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/index.es.js +21 -12
- package/index.umd.js +14 -2
- package/package.json +1 -1
package/index.es.js
CHANGED
|
@@ -16601,6 +16601,18 @@ const Ev = () => `att-${Date.now()}-${++Fv}`, mv = ({
|
|
|
16601
16601
|
font-weight: 600;
|
|
16602
16602
|
cursor: default;
|
|
16603
16603
|
text-decoration: none;
|
|
16604
|
+
|
|
16605
|
+
& .badge-hover {
|
|
16606
|
+
display: none;
|
|
16607
|
+
}
|
|
16608
|
+
&:hover .badge-default,
|
|
16609
|
+
&:focus-visible .badge-default {
|
|
16610
|
+
display: none;
|
|
16611
|
+
}
|
|
16612
|
+
&:hover .badge-hover,
|
|
16613
|
+
&:focus-visible .badge-hover {
|
|
16614
|
+
display: inline;
|
|
16615
|
+
}
|
|
16604
16616
|
`, xv = w(M)`
|
|
16605
16617
|
width: 100%;
|
|
16606
16618
|
gap: 8px;
|
|
@@ -16754,23 +16766,20 @@ const Ev = () => `att-${Date.now()}-${++Fv}`, mv = ({
|
|
|
16754
16766
|
padding: 4px;
|
|
16755
16767
|
z-index: 1;
|
|
16756
16768
|
`, Hv = ({ mimeType: e, filename: t, url: u, onPreview: n }) => {
|
|
16757
|
-
const
|
|
16758
|
-
|
|
16759
|
-
|
|
16760
|
-
|
|
16761
|
-
|
|
16762
|
-
};
|
|
16763
|
-
return a && n ? /* @__PURE__ */ f.jsx(ye, { title: r ? D : i, placement: "top", children: /* @__PURE__ */ f.jsx(kv, { type: "button", "aria-label": "Preview attachment", onClick: n, ...d, children: c }) }) : u ? /* @__PURE__ */ f.jsx(ye, { title: r ? D : i, placement: "top", children: /* @__PURE__ */ f.jsx(
|
|
16769
|
+
const r = o8(e), o = r8(e, t), a = r ? "👁" : "⬇", i = r ? "Preview" : "Download", s = /* @__PURE__ */ f.jsxs(f.Fragment, { children: [
|
|
16770
|
+
/* @__PURE__ */ f.jsx("span", { className: "badge-default", children: o }),
|
|
16771
|
+
/* @__PURE__ */ f.jsx("span", { className: "badge-hover", children: a })
|
|
16772
|
+
] });
|
|
16773
|
+
return r && n ? /* @__PURE__ */ f.jsx(ye, { title: i, placement: "top", children: /* @__PURE__ */ f.jsx(kv, { type: "button", "aria-label": "Preview attachment", onClick: n, children: s }) }) : u ? /* @__PURE__ */ f.jsx(ye, { title: i, placement: "top", children: /* @__PURE__ */ f.jsx(
|
|
16764
16774
|
Sv,
|
|
16765
16775
|
{
|
|
16766
16776
|
href: u,
|
|
16767
16777
|
target: "_blank",
|
|
16768
16778
|
rel: "noopener noreferrer",
|
|
16769
|
-
...
|
|
16770
|
-
|
|
16771
|
-
children: c
|
|
16779
|
+
...r ? {} : { download: t },
|
|
16780
|
+
children: s
|
|
16772
16781
|
}
|
|
16773
|
-
) }) : /* @__PURE__ */ f.jsx(ye, { title:
|
|
16782
|
+
) }) : /* @__PURE__ */ f.jsx(ye, { title: o, placement: "top", children: /* @__PURE__ */ f.jsx(Iv, { children: s }) });
|
|
16774
16783
|
}, Uv = ({
|
|
16775
16784
|
item: e,
|
|
16776
16785
|
onRemove: t,
|
|
@@ -18900,7 +18909,7 @@ const Sw = ({
|
|
|
18900
18909
|
const [E, b] = P({}), [m, x] = P({}), [v, B] = P(!1), S = pe(() => Xd(500), []), _ = pe(() => {
|
|
18901
18910
|
if (!Array.isArray(n) || !n.length) return [];
|
|
18902
18911
|
const G = /* @__PURE__ */ new Set();
|
|
18903
|
-
return n.filter((Q) => G.has(Q.name) ? !1 : (G.add(Q.name), !0)).sort((Q, Y) => Q.priority - Y.priority);
|
|
18912
|
+
return n.filter((Q) => Q.type === "attachment" || G.has(Q.name) ? !1 : (G.add(Q.name), !0)).sort((Q, Y) => Q.priority - Y.priority);
|
|
18904
18913
|
}, [n]), T = ({ name: G, value: J }) => {
|
|
18905
18914
|
x((Q) => {
|
|
18906
18915
|
const Y = { ...Q };
|
package/index.umd.js
CHANGED
|
@@ -1696,6 +1696,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1696
1696
|
font-weight: 600;
|
|
1697
1697
|
cursor: default;
|
|
1698
1698
|
text-decoration: none;
|
|
1699
|
+
|
|
1700
|
+
& .badge-hover {
|
|
1701
|
+
display: none;
|
|
1702
|
+
}
|
|
1703
|
+
&:hover .badge-default,
|
|
1704
|
+
&:focus-visible .badge-default {
|
|
1705
|
+
display: none;
|
|
1706
|
+
}
|
|
1707
|
+
&:hover .badge-hover,
|
|
1708
|
+
&:focus-visible .badge-hover {
|
|
1709
|
+
display: inline;
|
|
1710
|
+
}
|
|
1699
1711
|
`,my=s.styled(s.Stack)`
|
|
1700
1712
|
width: 100%;
|
|
1701
1713
|
gap: 8px;
|
|
@@ -1844,7 +1856,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1844
1856
|
top: 8px;
|
|
1845
1857
|
padding: 4px;
|
|
1846
1858
|
z-index: 1;
|
|
1847
|
-
`,Ry=({mimeType:e,filename:t,url:u,onPreview:n})=>{const
|
|
1859
|
+
`,Ry=({mimeType:e,filename:t,url:u,onPreview:n})=>{const r=R2(e),o=P2(e,t),f=r?"👁":"⬇",i=r?"Preview":"Download",D=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"badge-default",children:o}),a.jsx("span",{className:"badge-hover",children:f})]});return r&&n?a.jsx(s.Tooltip,{title:i,placement:"top",children:a.jsx(Sy,{type:"button","aria-label":"Preview attachment",onClick:n,children:D})}):u?a.jsx(s.Tooltip,{title:i,placement:"top",children:a.jsx(vy,{href:u,target:"_blank",rel:"noopener noreferrer",...r?{}:{download:t},children:D})}):a.jsx(s.Tooltip,{title:o,placement:"top",children:a.jsx(wy,{children:D})})},Qy=({item:e,onRemove:t,onRetry:u,onPreview:n,canDeleteExisting:r=!0})=>{const{tempId:o,filename:f,size:i,mimeType:D,status:c,progress:l=0,url:A,isExisting:F}=e,g=!F||r?a.jsx(s.Tooltip,{title:"Remove",placement:"top",children:a.jsx(Iy,{"aria-label":"Remove attachment",onClick:()=>t(o),children:a.jsx(s.icons.Close,{sx:{height:"14px",width:"14px"}})})}):null;return c==="uploading"?a.jsxs(c1,{children:[a.jsxs(l1,{children:[a.jsx(d1,{title:f,children:f}),a.jsx(By,{variant:"determinate",value:l}),a.jsxs(yy,{children:["Uploading… ",Math.round(l),"%"]})]}),g]}):c==="failed"?a.jsxs(c1,{failed:!0,children:[a.jsxs(l1,{children:[a.jsx(d1,{title:f,children:f}),a.jsx(H2,{children:"Upload failed"})]}),a.jsx(ky,{variant:"text",size:"small",onClick:()=>u(o),children:"Retry"}),g]}):a.jsxs(c1,{children:[a.jsx(Ry,{mimeType:D,filename:f,url:A,...n?{onPreview:()=>n(e)}:{}}),a.jsxs(l1,{children:[a.jsx(d1,{title:f,children:f}),a.jsxs(H2,{children:[M2(i)," · ",P2(D,f)]})]}),g]})},Hy=e=>!!e&&/^image\//.test(e),Vy=e=>!!e&&/^video\//.test(e),Gy=e=>e==="application/pdf",V2=({attachment:e,open:t,onClose:u})=>{const[n,r]=h.useState(!1);if(h.useEffect(()=>{r(!1)},[e==null?void 0:e.url]),!e)return null;const{filename:o,url:f,size:i,mimeType:D}=e,c=F=>a.jsx(Ny,{href:f,target:"_blank",rel:"noopener noreferrer",download:o,children:F}),l=a.jsxs(My,{children:[a.jsx("div",{children:"Preview isn’t available for this file."}),f?c("Download instead"):null]}),A=()=>n||!f?l:Hy(D)?a.jsx("img",{src:f,alt:o,onError:()=>r(!0)}):Vy(D)?a.jsx("video",{controls:!0,src:f,onError:()=>r(!0)}):Gy(D)?a.jsx("iframe",{src:f,title:o}):l;return a.jsxs(s.Dialog,{open:t,onClose:u,PaperProps:{style:{borderRadius:12,padding:0,height:"fit-content",width:"fit-content",maxWidth:"none",position:"relative",overflow:"hidden"}},children:[a.jsx(s.Tooltip,{title:"Close",placement:"bottom",children:a.jsx(Py,{"aria-label":"Close preview",onClick:u,children:a.jsx(s.icons.Close,{sx:{height:"18px",width:"18px"}})})}),a.jsxs(Ty,{children:[a.jsxs(Ly,{children:[a.jsx(_y,{title:o,children:o}),i!=null&&i!==""?a.jsx(Oy,{children:M2(i)}):null,f?c("Download"):null]}),a.jsx(jy,{children:A()})]})]})},Wy=e=>T.createElement("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg",...e},T.createElement("path",{d:"M16 16l-4-4-4 4"}),T.createElement("path",{d:"M12 12v9"}),T.createElement("path",{d:"M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"})),Xy=10,Zy=25,zy="*",Jy=e=>Array.isArray(e)?e:[],Yy=({value:e,meta:t,onChange:u,upload:n,onToast:r})=>{const o=h.useRef(null),[f,i]=h.useState(!1),[D,c]=h.useState(null),[l,A]=h.useState(!1),F=L=>{c(L),A(!0)},m=(t==null?void 0:t.maxFiles)??Xy,g=(t==null?void 0:t.maxFileSizeMb)??Zy,p=(t==null?void 0:t.acceptedTypes)??zy,d=(t==null?void 0:t.supportsDelete)!==!1,{items:C,addFiles:E,removeItem:b,retry:y}=hy({initialValue:Jy(e),maxFiles:m,maxFileSizeMb:g,upload:n,onChange:u,onToast:r}),x=C.length>=m,B=()=>{var L;x||(L=o.current)==null||L.click()},v=L=>{const _=L.target.files?Array.from(L.target.files):[];E(_),L.target.value=""},S=L=>{x||(L.preventDefault(),i(!0))},k=()=>i(!1),O=L=>{var j;if(L.preventDefault(),i(!1),x)return;const _=(j=L.dataTransfer)!=null&&j.files?Array.from(L.dataTransfer.files):[];E(_)};return a.jsxs(my,{children:[a.jsx("input",{ref:o,type:"file",multiple:!0,hidden:!0,...p&&p!=="*"?{accept:p}:{},onChange:v}),a.jsxs(xy,{role:"button",tabIndex:0,dragOver:f,disabled:x,onClick:B,onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),B())},onDragOver:S,onDragLeave:k,onDrop:O,children:[a.jsx(Wy,{}),x?`Maximum ${m} files reached`:"Click here to upload"]}),C.length?a.jsx(by,{children:C.map(L=>a.jsx(Qy,{item:L,onRemove:b,onRetry:y,onPreview:F,canDeleteExisting:d},L.tempId))}):null,a.jsx(V2,{attachment:D,open:l,onClose:()=>A(!1)})]})},qy=s.styled(s.Box)`
|
|
1848
1860
|
box-sizing: border-box;
|
|
1849
1861
|
&:not(:has(.${Mo})) {
|
|
1850
1862
|
transform: translate(0, 5px);
|
|
@@ -2378,7 +2390,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2378
2390
|
display: inline-block;
|
|
2379
2391
|
color: inherit;
|
|
2380
2392
|
}
|
|
2381
|
-
`,Bw={borderRadius:"0 !important",padding:"0 !important",width:"max-content !important",maxWidth:"max-content !important",height:"100% !important",maxHeight:"100% !important",position:"fixed",boxSizing:"border-box !important",top:0,bottom:0,right:0,margin:0};function ww(e){return e.name??e.rowId}const vw=({open:e,onClose:t,formId:u,fields:n,variables:r,connectorLogo:o,isSaving:f,title:i,isLoading:D=!1,defaultValues:c,customFields:l,checkMandatory:A=!1,className:F,customFieldsInDropdown:m=!0,showInfo:g=!0,fetchOptions:p,onSave:d,onCancel:C,onFieldChange:E})=>{const[b,y]=h.useState({}),[x,B]=h.useState({}),[v,S]=h.useState(!1),k=h.useMemo(()=>Y3(500),[]),O=h.useMemo(()=>{if(!Array.isArray(n)||!n.length)return[];const H=new Set;return n.filter(P=>H.has(P.name)?!1:(H.add(P.name),!0)).sort((P,z)=>P.priority-z.priority)},[n]),L=({name:H,value:Z})=>{B(P=>{const z={...P};return Z?z[H]=Z:delete z[H],z})};h.useEffect(()=>{c&&e&&y({...c})},[c,e]),h.useEffect(()=>()=>{e||(y({}),B({}))},[e]),h.useEffect(()=>{A&&k(()=>{const Z=n.filter(P=>{var z;return!!((z=P.validations)!=null&&z.isRequired)}).filter(P=>!b[P.name]);S(Z.length>0)})},[k,b,n,A]);const _=()=>{t(),y({})},j=()=>{C==null||C(),y({}),t()},M=()=>{const H={...b};for(const Z in H){const P=H[Z];(P===""||P===null||P===void 0)&&delete H[Z]}d(H)},Q=Object.keys(x).length>0||v;return a.jsx(s.Dialog,{className:F,open:e,onClose:_,PaperProps:{sx:Bw},maxWidth:!1,children:D?a.jsx(s.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",width:"615px"},children:a.jsx(s.CircularProgress,{})}):a.jsxs(gw,{children:[a.jsxs(Fw,{children:[a.jsxs(s.Stack,{direction:"row",alignItems:"center",gap:2,children:[a.jsx(dw,{}),a.jsx(s.Stack,{gap:.5,flex:1,minWidth:0,children:a.jsxs(s.Stack,{direction:"row",alignItems:"center",gap:.5,children:[a.jsx(s.Typography,{variant:"h6",fontSize:18,fontWeight:600,color:s.theme.palette.gray.gray1,children:i}),g&&a.jsx(s.Tooltip,{title:"Set default values to have them pre-filled every time you create a task.",placement:"top",slotProps:{tooltip:{sx:{maxWidth:"260px !important"}}},children:a.jsx(s.IconButton,{size:"small","aria-label":"About mapping fields",sx:{padding:"4px"},children:a.jsx(s.icons.InfoOutlined,{sx:{fontSize:18,color:s.theme.palette.gray.gray3}})})})]})})]}),a.jsx(s.Tooltip,{title:"Close",placement:"bottom",children:a.jsx(s.IconButton,{onClick:_,size:"small","aria-label":"Close",children:a.jsx(s.icons.Close,{sx:{fontSize:20}})})})]}),a.jsx(hw,{children:a.jsxs(Ew,{children:[a.jsxs(s.Stack,{direction:"row",padding:"16px 24px",sx:{backgroundColor:s.theme.palette.gray.gray6a,borderBottom:"1px solid #ECEFF6",borderRadius:"8px 8px 0 0"},children:[a.jsx(pw,{src:o,alt:"Connector"}),a.jsx(s.Typography,{variant:"caption",fontSize:14,fontWeight:600,color:s.theme.palette.gray.gray3,flex:1,children:"Field"}),a.jsx(s.Typography,{variant:"caption",fontSize:14,fontWeight:600,color:s.theme.palette.gray.gray3,width:320,children:"Value"})]}),O.map((H,Z)=>{var ee;const P=ww(H),z=b[P]??"";return a.jsxs(s.Stack,{direction:"row",alignItems:"center",padding:"24px",gap:2,sx:{borderBottom:Z<O.length-1?"1px solid #F6F8FC":void 0,"&:last-child":{borderBottom:"none"}},children:[a.jsx(xw,{children:a.jsxs(s.Typography,{variant:"body2",fontSize:14,color:s.theme.palette.gray.gray2,children:[H.label,A&&((ee=H.validations)!=null&&ee.isRequired)?a.jsx(yw,{}):null]})}),a.jsx(Cw,{width:20,height:20}),a.jsx(bw,{children:a.jsx(cw,{field:H,formId:String(u),value:z,formValues:b,variables:r,customFields:l,errors:x,checkMandatory:A,customFieldsInDropdown:m,setError:L,fetchOptions:p,setFormValues:y,onFieldChange:E})})]},P)})]})}),a.jsxs(mw,{children:[a.jsx(s.Button,{variant:"contained",onClick:M,sx:{textTransform:"none",padding:"3px 32px !important"},disabled:f||Q,children:"Save"}),a.jsx(s.Button,{variant:"outlined",color:"inherit",onClick:j,disabled:f,sx:{textTransform:"none",padding:"3px 12px !important",borderColor:s.theme.palette.gray.gray5},children:"Cancel"})]})]})})},Sw=s.styled(s.Box)`
|
|
2393
|
+
`,Bw={borderRadius:"0 !important",padding:"0 !important",width:"max-content !important",maxWidth:"max-content !important",height:"100% !important",maxHeight:"100% !important",position:"fixed",boxSizing:"border-box !important",top:0,bottom:0,right:0,margin:0};function ww(e){return e.name??e.rowId}const vw=({open:e,onClose:t,formId:u,fields:n,variables:r,connectorLogo:o,isSaving:f,title:i,isLoading:D=!1,defaultValues:c,customFields:l,checkMandatory:A=!1,className:F,customFieldsInDropdown:m=!0,showInfo:g=!0,fetchOptions:p,onSave:d,onCancel:C,onFieldChange:E})=>{const[b,y]=h.useState({}),[x,B]=h.useState({}),[v,S]=h.useState(!1),k=h.useMemo(()=>Y3(500),[]),O=h.useMemo(()=>{if(!Array.isArray(n)||!n.length)return[];const H=new Set;return n.filter(P=>P.type==="attachment"||H.has(P.name)?!1:(H.add(P.name),!0)).sort((P,z)=>P.priority-z.priority)},[n]),L=({name:H,value:Z})=>{B(P=>{const z={...P};return Z?z[H]=Z:delete z[H],z})};h.useEffect(()=>{c&&e&&y({...c})},[c,e]),h.useEffect(()=>()=>{e||(y({}),B({}))},[e]),h.useEffect(()=>{A&&k(()=>{const Z=n.filter(P=>{var z;return!!((z=P.validations)!=null&&z.isRequired)}).filter(P=>!b[P.name]);S(Z.length>0)})},[k,b,n,A]);const _=()=>{t(),y({})},j=()=>{C==null||C(),y({}),t()},M=()=>{const H={...b};for(const Z in H){const P=H[Z];(P===""||P===null||P===void 0)&&delete H[Z]}d(H)},Q=Object.keys(x).length>0||v;return a.jsx(s.Dialog,{className:F,open:e,onClose:_,PaperProps:{sx:Bw},maxWidth:!1,children:D?a.jsx(s.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",width:"615px"},children:a.jsx(s.CircularProgress,{})}):a.jsxs(gw,{children:[a.jsxs(Fw,{children:[a.jsxs(s.Stack,{direction:"row",alignItems:"center",gap:2,children:[a.jsx(dw,{}),a.jsx(s.Stack,{gap:.5,flex:1,minWidth:0,children:a.jsxs(s.Stack,{direction:"row",alignItems:"center",gap:.5,children:[a.jsx(s.Typography,{variant:"h6",fontSize:18,fontWeight:600,color:s.theme.palette.gray.gray1,children:i}),g&&a.jsx(s.Tooltip,{title:"Set default values to have them pre-filled every time you create a task.",placement:"top",slotProps:{tooltip:{sx:{maxWidth:"260px !important"}}},children:a.jsx(s.IconButton,{size:"small","aria-label":"About mapping fields",sx:{padding:"4px"},children:a.jsx(s.icons.InfoOutlined,{sx:{fontSize:18,color:s.theme.palette.gray.gray3}})})})]})})]}),a.jsx(s.Tooltip,{title:"Close",placement:"bottom",children:a.jsx(s.IconButton,{onClick:_,size:"small","aria-label":"Close",children:a.jsx(s.icons.Close,{sx:{fontSize:20}})})})]}),a.jsx(hw,{children:a.jsxs(Ew,{children:[a.jsxs(s.Stack,{direction:"row",padding:"16px 24px",sx:{backgroundColor:s.theme.palette.gray.gray6a,borderBottom:"1px solid #ECEFF6",borderRadius:"8px 8px 0 0"},children:[a.jsx(pw,{src:o,alt:"Connector"}),a.jsx(s.Typography,{variant:"caption",fontSize:14,fontWeight:600,color:s.theme.palette.gray.gray3,flex:1,children:"Field"}),a.jsx(s.Typography,{variant:"caption",fontSize:14,fontWeight:600,color:s.theme.palette.gray.gray3,width:320,children:"Value"})]}),O.map((H,Z)=>{var ee;const P=ww(H),z=b[P]??"";return a.jsxs(s.Stack,{direction:"row",alignItems:"center",padding:"24px",gap:2,sx:{borderBottom:Z<O.length-1?"1px solid #F6F8FC":void 0,"&:last-child":{borderBottom:"none"}},children:[a.jsx(xw,{children:a.jsxs(s.Typography,{variant:"body2",fontSize:14,color:s.theme.palette.gray.gray2,children:[H.label,A&&((ee=H.validations)!=null&&ee.isRequired)?a.jsx(yw,{}):null]})}),a.jsx(Cw,{width:20,height:20}),a.jsx(bw,{children:a.jsx(cw,{field:H,formId:String(u),value:z,formValues:b,variables:r,customFields:l,errors:x,checkMandatory:A,customFieldsInDropdown:m,setError:L,fetchOptions:p,setFormValues:y,onFieldChange:E})})]},P)})]})}),a.jsxs(mw,{children:[a.jsx(s.Button,{variant:"contained",onClick:M,sx:{textTransform:"none",padding:"3px 32px !important"},disabled:f||Q,children:"Save"}),a.jsx(s.Button,{variant:"outlined",color:"inherit",onClick:j,disabled:f,sx:{textTransform:"none",padding:"3px 12px !important",borderColor:s.theme.palette.gray.gray5},children:"Cancel"})]})]})})},Sw=s.styled(s.Box)`
|
|
2382
2394
|
position: fixed;
|
|
2383
2395
|
inset: 0;
|
|
2384
2396
|
z-index: ${({zIndex:e})=>e};
|