@hiver/connector-agent 4.12.0-oneClickAuto-beta.2 → 4.12.0-oneClickAuto-beta.3

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 CHANGED
@@ -15796,12 +15796,12 @@ const al = (e) => !!e && typeof e == "object" && "value" in e && "label" in e, E
15796
15796
  }
15797
15797
  }, G8 = (e) => ({
15798
15798
  fontSize: 14,
15799
- lineHeight: "18px",
15799
+ lineHeight: "20px",
15800
15800
  minHeight: 36,
15801
- py: 0.75,
15802
- pl: 1,
15803
- pr: 1.5,
15804
- mx: 1,
15801
+ py: 1,
15802
+ pl: 2,
15803
+ pr: 2.5,
15804
+ mx: 0,
15805
15805
  borderRadius: "4px",
15806
15806
  color: "#343C45",
15807
15807
  backgroundColor: e ? "#F6F8FC" : "transparent",
@@ -16048,7 +16048,7 @@ const al = (e) => !!e && typeof e == "object" && "value" in e && "label" in e, E
16048
16048
  paddingBottom: 1
16049
16049
  }, q8 = {
16050
16050
  lineHeight: 1,
16051
- padding: "12px",
16051
+ padding: "12px 12px 2px",
16052
16052
  backgroundColor: "#FFFFFF",
16053
16053
  position: "sticky",
16054
16054
  top: 0,
@@ -16099,14 +16099,14 @@ const al = (e) => !!e && typeof e == "object" && "value" in e && "label" in e, E
16099
16099
  display: "grid",
16100
16100
  gridTemplateColumns: "1fr 1fr",
16101
16101
  alignItems: "center",
16102
- backgroundColor: "#ECEFF6",
16102
+ backgroundColor: "#F6F8FC",
16103
16103
  borderRadius: "8px",
16104
16104
  padding: "3px"
16105
16105
  }, a0 = (e) => ({
16106
16106
  border: "none",
16107
16107
  borderRadius: "8px",
16108
16108
  backgroundColor: e ? "#FFFFFF" : "transparent",
16109
- color: e ? "#2066D7" : "#343C45",
16109
+ color: e ? "#196fe0" : "#343C45",
16110
16110
  lineHeight: "24px",
16111
16111
  padding: "4px 12px",
16112
16112
  cursor: "pointer"
@@ -16562,16 +16562,7 @@ const al = (e) => !!e && typeof e == "object" && "value" in e && "label" in e, E
16562
16562
  type: "button",
16563
16563
  sx: a0(m === "options"),
16564
16564
  onClick: Y("options"),
16565
- children: /* @__PURE__ */ u.jsx(
16566
- K,
16567
- {
16568
- variant: "caption",
16569
- fontSize: 14,
16570
- fontWeight: 500,
16571
- color: m === "options" ? V.palette.gray.gray1 : V.palette.gray.gray3,
16572
- children: "Options"
16573
- }
16574
- )
16565
+ children: /* @__PURE__ */ u.jsx(K, { variant: "caption", fontSize: 14, fontWeight: 400, color: "inherit", children: "Options" })
16575
16566
  }
16576
16567
  ),
16577
16568
  /* @__PURE__ */ u.jsx(
@@ -16581,16 +16572,7 @@ const al = (e) => !!e && typeof e == "object" && "value" in e && "label" in e, E
16581
16572
  type: "button",
16582
16573
  sx: a0(m === "custom"),
16583
16574
  onClick: Y("custom"),
16584
- children: /* @__PURE__ */ u.jsx(
16585
- K,
16586
- {
16587
- variant: "caption",
16588
- fontSize: 14,
16589
- fontWeight: 500,
16590
- color: m === "custom" ? V.palette.gray.gray1 : V.palette.gray.gray3,
16591
- children: "Custom Object"
16592
- }
16593
- )
16575
+ children: /* @__PURE__ */ u.jsx(K, { variant: "caption", fontSize: 14, fontWeight: 400, color: "inherit", children: "Custom Object" })
16594
16576
  }
16595
16577
  )
16596
16578
  ] }) }),
@@ -16603,7 +16585,7 @@ const al = (e) => !!e && typeof e == "object" && "value" in e && "label" in e, E
16603
16585
  observerProps: I,
16604
16586
  optionsProps: _,
16605
16587
  setSearch: R,
16606
- searchOffset: 62
16588
+ searchOffset: 52
16607
16589
  }) : s.map((q) => {
16608
16590
  const ne = q.options.length > 0;
16609
16591
  return /* @__PURE__ */ u.jsxs(
@@ -16830,7 +16812,7 @@ const ME = ({
16830
16812
  variables: o,
16831
16813
  connectorLogo: i,
16832
16814
  isSaving: s,
16833
- title: a = "Pre-fill fields",
16815
+ title: a,
16834
16816
  isLoading: c = !1,
16835
16817
  defaultValues: l,
16836
16818
  customFields: d,
@@ -16878,10 +16860,7 @@ const ME = ({
16878
16860
  /* @__PURE__ */ u.jsxs(j, { direction: "row", alignItems: "center", gap: 2, children: [
16879
16861
  /* @__PURE__ */ u.jsx(IE, {}),
16880
16862
  /* @__PURE__ */ u.jsx(j, { gap: 0.5, flex: 1, minWidth: 0, children: /* @__PURE__ */ u.jsxs(j, { direction: "row", alignItems: "center", gap: 0.5, children: [
16881
- /* @__PURE__ */ u.jsxs(K, { variant: "h6", fontSize: 18, fontWeight: 600, color: V.palette.gray.gray1, children: [
16882
- "Pre-fill fields for ",
16883
- a
16884
- ] }),
16863
+ /* @__PURE__ */ u.jsx(K, { variant: "h6", fontSize: 18, fontWeight: 600, color: V.palette.gray.gray1, children: a }),
16885
16864
  /* @__PURE__ */ u.jsx(xe, { title: "Assign default values to create fields", placement: "top", children: /* @__PURE__ */ u.jsx(it, { size: "small", "aria-label": "About mapping fields", sx: { padding: "4px" }, children: /* @__PURE__ */ u.jsx(Qe.InfoOutlined, { sx: { fontSize: 18, color: V.palette.gray.gray3 } }) }) })
16886
16865
  ] }) })
16887
16866
  ] }),
@@ -19105,7 +19084,7 @@ const i_ = T(yl)`
19105
19084
  fields: w,
19106
19085
  connectorLogo: o,
19107
19086
  variables: i,
19108
- title: c,
19087
+ title: `Pre-fill fields for ${c}`,
19109
19088
  isLoading: l || v,
19110
19089
  isSaving: C,
19111
19090
  fetchOptions: I,
package/index.umd.js CHANGED
@@ -1035,7 +1035,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1035
1035
  width: 40px;
1036
1036
  height: 40px;
1037
1037
  }
1038
- `,F8=e=>T.createElement("svg",{width:35,height:35,viewBox:"0 0 35 35",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},T.createElement("rect",{x:9,y:9,width:15,height:17,fill:"white"}),T.createElement("g",{clipPath:"url(#clip0_7787_114457)"},T.createElement("path",{d:"M17.1981 2.86633C9.28704 2.86633 2.86646 9.28691 2.86646 17.198C2.86646 25.1091 9.28704 31.5296 17.1981 31.5296C25.1092 31.5296 31.5298 25.1091 31.5298 17.198C31.5298 9.28691 25.1092 2.86633 17.1981 2.86633ZM14.3318 23.6472V10.7487L22.9308 17.198L14.3318 23.6472Z",fill:"#4D596C"})),T.createElement("defs",null,T.createElement("clipPath",{id:"clip0_7787_114457"},T.createElement("rect",{width:34.396,height:34.396,fill:"white"})))),k8=({aspectRatio:e="auto",...t})=>{const[n,r]=I.useState(!1);return n?null:d.jsxs(O8,{aspectRatio:e,children:[d.jsx("img",{className:"preview-img",onError:()=>r(!0),...t}),d.jsx(F8,{className:"play-icon"})]})},X1=u.styled(({className:e,...t})=>d.jsx(u.Tooltip,{...t,classes:{popper:e}}))(({tooltipStyle:e,arrowStyle:t})=>({[`& .${u.tooltipClasses.arrow}`]:{...t},[`& .${u.tooltipClasses.tooltip}`]:{...e}}));function D8(e){return!!e.interfaceDetails||!!e.searchInterfaceDetails}const ol=e=>!!e&&typeof e=="object"&&"value"in e&&"label"in e,z1=e=>typeof e=="string"&&e.startsWith("{{")&&e.endsWith("}}")&&e.includes("."),N8=e=>{if(!e||!z1(e.value))return null;const t=String(e.value).replace(/\{|\}/g,"").split("."),n=e.label.split(".");return{name:n[0],id:t[0],option:{label:n[1],value:t[1]}}},Y1=e=>e?{label:`${e.name} > ${e.option.label}`,value:`{{${e.name}.${e.option.label}}}`}:null,R8=/\{\{([^}]*)\}\}/g,M8=/^[a-zA-Z0-9._]+$/,P8="Invalid variable format. Please check inserted variables.",j8=e=>{if(!e)return;const t=e.matchAll(R8);for(const[,n]of[...t])if(!M8.test(n))return P8},B8=e=>{if(!e||e.includes("{{")&&e.includes("}}"))return;const t=new Date(e),n=/^\d{4}-\d{2}-\d{2}$/;if(isNaN(t.getTime())||!n.test(e))return"Invalid date format. Required date format is YYYY-MM-DD"},V8=({argsMap:e,optionalArgsMap:t,data:n})=>{const{args:r,enabled:o}=I.useMemo(()=>{const s={};for(const a in e){const i=e[a],c=n[i];if(!c)return{args:{},enabled:!1};s[a]=ol(c)?c.value:c}for(const a in t){const i=t[a],c=n[i];s[a]=ol(c)?c.value:c,s[a]||(s[a]=null)}return{args:s,enabled:!0}},[e,t,n]);return{args:r,enabled:o}},G8=({args:e,enabled:t,searchTerm:n,pagination:r,queryKey:o,debounceTime:s=500,fetchOptions:a})=>{const[i,c]=I.useState({args:e,enabled:t,searchTerm:n,pagination:r});I.useEffect(()=>{const x=setTimeout(()=>{c({args:e,enabled:t,searchTerm:n,pagination:r})},s);return()=>clearTimeout(x)},[e,t,n,r,s]);const l=I.useMemo(()=>{var x,v;return{searchTerm:i.searchTerm,limit:((x=i.pagination)==null?void 0:x.limit)??10,enabled:((v=i.pagination)==null?void 0:v.enabled)??!1}},[i]),{data:f,isLoading:g,isError:y,isFetching:C,isFetchingNextPage:b,hasNextPage:h,fetchNextPage:p}=Dh({queryKey:["fetch-options",o,i.args,l],queryFn:({pageParam:x})=>a({args:i.args,pagination:{...l,pageNumber:x}}),getNextPageParam:(x,v)=>x.hasMore?v.length+1:void 0,initialPageParam:1,enabled:i.enabled,refetchOnMount:!0});return{options:I.useMemo(()=>(f==null?void 0:f.pages.flatMap(x=>x.options))??[],[f]),isLoading:g,isError:y,isFetching:C,isFetchingNextPage:b,hasNextPage:h,fetchNextPage:p}},sl=e=>e instanceof Element,H8=({onIntersect:e,threshold:t,rootMargin:n,enabled:r=!0})=>{const[o,s]=I.useState(!1),a=I.useRef(null),i=I.useRef(null),c=I.useRef(e);c.current=e;const l=I.useCallback(g=>{sl(g)&&(i.current||(i.current=new IntersectionObserver(y=>{var b;const C=y[y.length-1];C.isIntersecting&&((b=c.current)==null||b.call(c,C))},{root:g,threshold:t,rootMargin:n}),s(!0)))},[t,n]),f=I.useCallback(g=>{var y,C;sl(a.current)&&((y=i.current)==null||y.unobserve(a.current)),sl(g)&&r&&o&&((C=i.current)==null||C.observe(g))},[r,o]);return I.useEffect(()=>()=>{i.current&&(i.current.disconnect(),i.current=null)},[]),{parentRef:l,childRef:f}},J1=({value:e,interfaceDetails:t,formData:n,fieldKey:r,hasApiSearch:o,fetchOptions:s})=>{var v;const[a,i]=I.useState(""),{selectedOption:c,selectedValue:l}=I.useMemo(()=>ol(e)?{selectedOption:e,selectedValue:e.value}:{selectedOption:null,selectedValue:e},[e]),{args:f,enabled:g}=V8({argsMap:t==null?void 0:t.args,optionalArgsMap:t==null?void 0:t.optionalArgs,data:n}),y=G8({args:f,enabled:g,queryKey:r,searchTerm:o?a:"",pagination:t==null?void 0:t.pagination,fetchOptions:s}),C=y.options,b=!!((v=t==null?void 0:t.pagination)!=null&&v.enabled),h=b&&!!y.hasNextPage,p=H8({onIntersect:()=>y.fetchNextPage(),threshold:.1,enabled:h}),m=I.useMemo(()=>{let w=C;c&&(w=[c],w.push(...C.filter(_=>_.value!==c.value)));const E=a.trim().toLowerCase();return!E||o?w:w.filter(_=>String(_.label).toLowerCase().includes(E))},[C,a,c,o]),x=I.useMemo(()=>{const w={};for(const E of C)w[E.value]=E.label;return w},[C]);return{selectedOption:c,selectedValue:l,search:a,optionsProps:y,observerProps:p,filteredOptions:m,labelsMap:x,paginationEnabled:b,setSearch:i}},W8=e=>T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:12,height:10,viewBox:"0 0 12 10",fill:"none",...e},T.createElement("path",{d:"M4.0001 8.0299L1.2201 5.2499L0.273438 6.1899L4.0001 9.91656L12.0001 1.91656L11.0601 0.976562L4.0001 8.0299Z"})),Z8={borderRadius:"8px",boxShadow:"0px 3px 15px 0px rgba(0, 0, 0, 0.25)",mt:.5,backgroundColor:"#FFFFFF"},X8={maxHeight:280,overflow:"auto",paddingTop:0,paddingBottom:1},z8={lineHeight:1,padding:"12px 12px 8px",backgroundColor:"#FFFFFF"},Y8={display:"flex",alignItems:"center",gap:"4px",padding:"8px",border:"1px solid #ECEFF6",borderRadius:"6px",width:"100%",boxSizing:"border-box"},J8={flex:1,minWidth:0,fontSize:13,lineHeight:"18px","& .MuiInputBase-input":{padding:0,"&::placeholder":{color:"#97A3B7",opacity:1}}},q8={fontSize:"14px",width:"100%",minWidth:200,height:"40px",background:"#F6F8FC",borderRadius:"8px",fontWeight:400,"& .MuiOutlinedInput-notchedOutline":{borderColor:"#ECEFF6"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#ECEFF6"},"& .MuiSelect-select":{display:"flex",alignItems:"center",paddingLeft:"12px",paddingRight:"8px"},"& .MuiSelect-icon":{color:"#97A3B7"}},Q8=e=>({fontSize:14,lineHeight:"18px",minHeight:36,py:.75,pl:1,pr:1.5,mx:1,borderRadius:"4px",color:"#343C45",backgroundColor:e?"#F6F8FC":"transparent","&:hover":{backgroundColor:"#F6F8FC"},"&.Mui-selected":{backgroundColor:"#F6F8FC","&:hover":{backgroundColor:"#F6F8FC"}}}),$8=u.styled(u.Box)`
1038
+ `,F8=e=>T.createElement("svg",{width:35,height:35,viewBox:"0 0 35 35",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},T.createElement("rect",{x:9,y:9,width:15,height:17,fill:"white"}),T.createElement("g",{clipPath:"url(#clip0_7787_114457)"},T.createElement("path",{d:"M17.1981 2.86633C9.28704 2.86633 2.86646 9.28691 2.86646 17.198C2.86646 25.1091 9.28704 31.5296 17.1981 31.5296C25.1092 31.5296 31.5298 25.1091 31.5298 17.198C31.5298 9.28691 25.1092 2.86633 17.1981 2.86633ZM14.3318 23.6472V10.7487L22.9308 17.198L14.3318 23.6472Z",fill:"#4D596C"})),T.createElement("defs",null,T.createElement("clipPath",{id:"clip0_7787_114457"},T.createElement("rect",{width:34.396,height:34.396,fill:"white"})))),k8=({aspectRatio:e="auto",...t})=>{const[n,r]=I.useState(!1);return n?null:d.jsxs(O8,{aspectRatio:e,children:[d.jsx("img",{className:"preview-img",onError:()=>r(!0),...t}),d.jsx(F8,{className:"play-icon"})]})},X1=u.styled(({className:e,...t})=>d.jsx(u.Tooltip,{...t,classes:{popper:e}}))(({tooltipStyle:e,arrowStyle:t})=>({[`& .${u.tooltipClasses.arrow}`]:{...t},[`& .${u.tooltipClasses.tooltip}`]:{...e}}));function D8(e){return!!e.interfaceDetails||!!e.searchInterfaceDetails}const ol=e=>!!e&&typeof e=="object"&&"value"in e&&"label"in e,z1=e=>typeof e=="string"&&e.startsWith("{{")&&e.endsWith("}}")&&e.includes("."),N8=e=>{if(!e||!z1(e.value))return null;const t=String(e.value).replace(/\{|\}/g,"").split("."),n=e.label.split(".");return{name:n[0],id:t[0],option:{label:n[1],value:t[1]}}},Y1=e=>e?{label:`${e.name} > ${e.option.label}`,value:`{{${e.name}.${e.option.label}}}`}:null,R8=/\{\{([^}]*)\}\}/g,M8=/^[a-zA-Z0-9._]+$/,P8="Invalid variable format. Please check inserted variables.",j8=e=>{if(!e)return;const t=e.matchAll(R8);for(const[,n]of[...t])if(!M8.test(n))return P8},B8=e=>{if(!e||e.includes("{{")&&e.includes("}}"))return;const t=new Date(e),n=/^\d{4}-\d{2}-\d{2}$/;if(isNaN(t.getTime())||!n.test(e))return"Invalid date format. Required date format is YYYY-MM-DD"},V8=({argsMap:e,optionalArgsMap:t,data:n})=>{const{args:r,enabled:o}=I.useMemo(()=>{const s={};for(const a in e){const i=e[a],c=n[i];if(!c)return{args:{},enabled:!1};s[a]=ol(c)?c.value:c}for(const a in t){const i=t[a],c=n[i];s[a]=ol(c)?c.value:c,s[a]||(s[a]=null)}return{args:s,enabled:!0}},[e,t,n]);return{args:r,enabled:o}},G8=({args:e,enabled:t,searchTerm:n,pagination:r,queryKey:o,debounceTime:s=500,fetchOptions:a})=>{const[i,c]=I.useState({args:e,enabled:t,searchTerm:n,pagination:r});I.useEffect(()=>{const x=setTimeout(()=>{c({args:e,enabled:t,searchTerm:n,pagination:r})},s);return()=>clearTimeout(x)},[e,t,n,r,s]);const l=I.useMemo(()=>{var x,v;return{searchTerm:i.searchTerm,limit:((x=i.pagination)==null?void 0:x.limit)??10,enabled:((v=i.pagination)==null?void 0:v.enabled)??!1}},[i]),{data:f,isLoading:g,isError:y,isFetching:C,isFetchingNextPage:b,hasNextPage:h,fetchNextPage:p}=Dh({queryKey:["fetch-options",o,i.args,l],queryFn:({pageParam:x})=>a({args:i.args,pagination:{...l,pageNumber:x}}),getNextPageParam:(x,v)=>x.hasMore?v.length+1:void 0,initialPageParam:1,enabled:i.enabled,refetchOnMount:!0});return{options:I.useMemo(()=>(f==null?void 0:f.pages.flatMap(x=>x.options))??[],[f]),isLoading:g,isError:y,isFetching:C,isFetchingNextPage:b,hasNextPage:h,fetchNextPage:p}},sl=e=>e instanceof Element,H8=({onIntersect:e,threshold:t,rootMargin:n,enabled:r=!0})=>{const[o,s]=I.useState(!1),a=I.useRef(null),i=I.useRef(null),c=I.useRef(e);c.current=e;const l=I.useCallback(g=>{sl(g)&&(i.current||(i.current=new IntersectionObserver(y=>{var b;const C=y[y.length-1];C.isIntersecting&&((b=c.current)==null||b.call(c,C))},{root:g,threshold:t,rootMargin:n}),s(!0)))},[t,n]),f=I.useCallback(g=>{var y,C;sl(a.current)&&((y=i.current)==null||y.unobserve(a.current)),sl(g)&&r&&o&&((C=i.current)==null||C.observe(g))},[r,o]);return I.useEffect(()=>()=>{i.current&&(i.current.disconnect(),i.current=null)},[]),{parentRef:l,childRef:f}},J1=({value:e,interfaceDetails:t,formData:n,fieldKey:r,hasApiSearch:o,fetchOptions:s})=>{var v;const[a,i]=I.useState(""),{selectedOption:c,selectedValue:l}=I.useMemo(()=>ol(e)?{selectedOption:e,selectedValue:e.value}:{selectedOption:null,selectedValue:e},[e]),{args:f,enabled:g}=V8({argsMap:t==null?void 0:t.args,optionalArgsMap:t==null?void 0:t.optionalArgs,data:n}),y=G8({args:f,enabled:g,queryKey:r,searchTerm:o?a:"",pagination:t==null?void 0:t.pagination,fetchOptions:s}),C=y.options,b=!!((v=t==null?void 0:t.pagination)!=null&&v.enabled),h=b&&!!y.hasNextPage,p=H8({onIntersect:()=>y.fetchNextPage(),threshold:.1,enabled:h}),m=I.useMemo(()=>{let w=C;c&&(w=[c],w.push(...C.filter(_=>_.value!==c.value)));const E=a.trim().toLowerCase();return!E||o?w:w.filter(_=>String(_.label).toLowerCase().includes(E))},[C,a,c,o]),x=I.useMemo(()=>{const w={};for(const E of C)w[E.value]=E.label;return w},[C]);return{selectedOption:c,selectedValue:l,search:a,optionsProps:y,observerProps:p,filteredOptions:m,labelsMap:x,paginationEnabled:b,setSearch:i}},W8=e=>T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:12,height:10,viewBox:"0 0 12 10",fill:"none",...e},T.createElement("path",{d:"M4.0001 8.0299L1.2201 5.2499L0.273438 6.1899L4.0001 9.91656L12.0001 1.91656L11.0601 0.976562L4.0001 8.0299Z"})),Z8={borderRadius:"8px",boxShadow:"0px 3px 15px 0px rgba(0, 0, 0, 0.25)",mt:.5,backgroundColor:"#FFFFFF"},X8={maxHeight:280,overflow:"auto",paddingTop:0,paddingBottom:1},z8={lineHeight:1,padding:"12px 12px 8px",backgroundColor:"#FFFFFF"},Y8={display:"flex",alignItems:"center",gap:"4px",padding:"8px",border:"1px solid #ECEFF6",borderRadius:"6px",width:"100%",boxSizing:"border-box"},J8={flex:1,minWidth:0,fontSize:13,lineHeight:"18px","& .MuiInputBase-input":{padding:0,"&::placeholder":{color:"#97A3B7",opacity:1}}},q8={fontSize:"14px",width:"100%",minWidth:200,height:"40px",background:"#F6F8FC",borderRadius:"8px",fontWeight:400,"& .MuiOutlinedInput-notchedOutline":{borderColor:"#ECEFF6"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#ECEFF6"},"& .MuiSelect-select":{display:"flex",alignItems:"center",paddingLeft:"12px",paddingRight:"8px"},"& .MuiSelect-icon":{color:"#97A3B7"}},Q8=e=>({fontSize:14,lineHeight:"20px",minHeight:36,py:1,pl:2,pr:2.5,mx:0,borderRadius:"4px",color:"#343C45",backgroundColor:e?"#F6F8FC":"transparent","&:hover":{backgroundColor:"#F6F8FC"},"&.Mui-selected":{backgroundColor:"#F6F8FC","&:hover":{backgroundColor:"#F6F8FC"}}}),$8=u.styled(u.Box)`
1039
1039
  height: 28px;
1040
1040
  width: 28px;
1041
1041
  border-radius: 50%;
@@ -1110,7 +1110,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1110
1110
  overflow: hidden;
1111
1111
  text-overflow: ellipsis;
1112
1112
  padding-top: 2px;
1113
- `,rv=e=>{const t=n=>{var o;const r=n.target;r&&((o=e.onChange)==null||o.call(e,r.value))};return d.jsx(tv,{...e,variant:"outlined",onChange:t,...e.multiline?{rows:4}:null})},$1=()=>{const[e,t]=I.useState(null),[n,r]=I.useState(null),o=I.useRef(null);return{activeField:e,anchorEl:n,onEnter:i=>{o.current&&clearTimeout(o.current),i&&(t(i.field),r(i.currentTarget))},onLeave:()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{t(null),r(null)},100)}}},ov={borderRadius:"8px",boxShadow:"0px 3px 15px 0px rgba(0, 0, 0, 0.25)",mt:.5,backgroundColor:"#FFFFFF",minWidth:337},sv={maxHeight:280,overflow:"auto",paddingTop:0,paddingBottom:1},av={lineHeight:1,padding:"12px",backgroundColor:"#FFFFFF",position:"sticky",top:0,zIndex:2},iv={m:0,minWidth:0,width:"100%"},cv={fontSize:"14px",width:"100%",minWidth:200,height:"40px",background:"#F6F8FC",borderRadius:"8px",fontWeight:500,"& .MuiOutlinedInput-notchedOutline":{borderColor:"#ECEFF6"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#ECEFF6"},"& .MuiSelect-select":{display:"flex",alignItems:"center",paddingLeft:"12px",paddingRight:"8px"},"& .MuiSelect-icon":{color:"#97A3B7"}},lv={fontSize:14,lineHeight:"18px",minHeight:36,py:.75,pl:2,pr:1.5,color:"#343C45",display:"flex",alignItems:"center",justifyContent:"space-between",gap:1,boxSizing:"border-box"},uv=e=>({...lv,backgroundColor:e?"#F6F8FC":"transparent",cursor:"pointer",fontWeight:400,"&:hover":{backgroundColor:"#F6F8FC"}}),dv={display:"grid",gridTemplateColumns:"1fr 1fr",alignItems:"center",backgroundColor:"#ECEFF6",borderRadius:"8px",padding:"3px"},U1=e=>({border:"none",borderRadius:"8px",backgroundColor:e?"#FFFFFF":"transparent",color:e?"#2066D7":"#343C45",lineHeight:"24px",padding:"4px 12px",cursor:"pointer"}),fv={fontSize:12,color:"#6F7C90",flexShrink:0},pv={display:"flex",flexDirection:"column",alignItems:"stretch",py:0},hv=e=>({fontSize:14,fontWeight:400,lineHeight:"18px",minHeight:36,py:.75,px:1.5,pl:2,pr:1.5,color:"#343C45",textTransform:"none",justifyContent:"flex-start",backgroundColor:e?"#F6F8FC":"transparent","&:hover":{backgroundColor:"#F6F8FC"}}),gv={color:"#97A3B7",fontSize:13,px:2,py:1.5},mv=u.styled(u.Stack)`
1113
+ `,rv=e=>{const t=n=>{var o;const r=n.target;r&&((o=e.onChange)==null||o.call(e,r.value))};return d.jsx(tv,{...e,variant:"outlined",onChange:t,...e.multiline?{rows:4}:null})},$1=()=>{const[e,t]=I.useState(null),[n,r]=I.useState(null),o=I.useRef(null);return{activeField:e,anchorEl:n,onEnter:i=>{o.current&&clearTimeout(o.current),i&&(t(i.field),r(i.currentTarget))},onLeave:()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{t(null),r(null)},100)}}},ov={borderRadius:"8px",boxShadow:"0px 3px 15px 0px rgba(0, 0, 0, 0.25)",mt:.5,backgroundColor:"#FFFFFF",minWidth:337},sv={maxHeight:280,overflow:"auto",paddingTop:0,paddingBottom:1},av={lineHeight:1,padding:"12px 12px 2px",backgroundColor:"#FFFFFF",position:"sticky",top:0,zIndex:2},iv={m:0,minWidth:0,width:"100%"},cv={fontSize:"14px",width:"100%",minWidth:200,height:"40px",background:"#F6F8FC",borderRadius:"8px",fontWeight:500,"& .MuiOutlinedInput-notchedOutline":{borderColor:"#ECEFF6"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#ECEFF6"},"& .MuiSelect-select":{display:"flex",alignItems:"center",paddingLeft:"12px",paddingRight:"8px"},"& .MuiSelect-icon":{color:"#97A3B7"}},lv={fontSize:14,lineHeight:"18px",minHeight:36,py:.75,pl:2,pr:1.5,color:"#343C45",display:"flex",alignItems:"center",justifyContent:"space-between",gap:1,boxSizing:"border-box"},uv=e=>({...lv,backgroundColor:e?"#F6F8FC":"transparent",cursor:"pointer",fontWeight:400,"&:hover":{backgroundColor:"#F6F8FC"}}),dv={display:"grid",gridTemplateColumns:"1fr 1fr",alignItems:"center",backgroundColor:"#F6F8FC",borderRadius:"8px",padding:"3px"},U1=e=>({border:"none",borderRadius:"8px",backgroundColor:e?"#FFFFFF":"transparent",color:e?"#196fe0":"#343C45",lineHeight:"24px",padding:"4px 12px",cursor:"pointer"}),fv={fontSize:12,color:"#6F7C90",flexShrink:0},pv={display:"flex",flexDirection:"column",alignItems:"stretch",py:0},hv=e=>({fontSize:14,fontWeight:400,lineHeight:"18px",minHeight:36,py:.75,px:1.5,pl:2,pr:1.5,color:"#343C45",textTransform:"none",justifyContent:"flex-start",backgroundColor:e?"#F6F8FC":"transparent","&:hover":{backgroundColor:"#F6F8FC"}}),gv={color:"#97A3B7",fontSize:13,px:2,py:1.5},mv=u.styled(u.Stack)`
1114
1114
  flex-flow: row nowrap;
1115
1115
  align-items: center;
1116
1116
  color: #343c45;
@@ -1210,7 +1210,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1210
1210
  font-size: 13px;
1211
1211
  font-weight: 600;
1212
1212
  line-height: 14px;
1213
- `,_v=({name:e,variables:t,customFields:n,onOptionClick:r})=>{const[o,s]=I.useState(""),a=I.useMemo(()=>t.filter(h=>h.title.toLowerCase().includes(o.toLowerCase())),[t,o]),{activeField:i,anchorEl:c,onEnter:l,onLeave:f}=$1(),g=h=>{var p;s(((p=h==null?void 0:h.target)==null?void 0:p.value)||"")},y=h=>{if(!h)return;const p=Y1(h);r({title:(p==null?void 0:p.label)||"",value:p==null?void 0:p.value})},C=n&&n.length>0,b=!!i&&Array.isArray(i==null?void 0:i.options)&&i.options.length>0;return d.jsxs(Cv,{children:[d.jsx(wv,{value:o,onChange:g,InputProps:{startAdornment:d.jsx(Iv,{children:d.jsx(u.icons.Search,{sx:{fontSize:18,color:u.theme.palette.gray.gray3,flexShrink:0}})})},placeholder:"Search variables",variant:"outlined"}),C&&d.jsx(d.Fragment,{children:d.jsx(np,{variant:"body2_medium",children:"Variables"})}),a.map(({value:h,title:p},m)=>d.jsx(u.Tooltip,{title:p,placement:"top",arrow:!0,children:d.jsx(ep,{onClick:()=>r({title:p,value:h}),children:d.jsx(tp,{variant:"body2",children:p})})},`${p}-${h}-${m}`)),C&&d.jsxs(d.Fragment,{children:[d.jsx(np,{variant:"h2",children:"Custom Objects"}),n==null?void 0:n.map(({id:h,name:p,options:m})=>d.jsx(u.Tooltip,{title:p,placement:"top",arrow:!0,children:d.jsx(ep,{onPointerEnter:x=>{x.pointerType==="touch"||!m.length||l({field:{id:h,name:p,options:m},currentTarget:x.currentTarget})},onPointerLeave:x=>{x.pointerType==="touch"||!m.length||f()},sx:{cursor:m.length?"pointer":"default"},children:d.jsx(tp,{variant:"body2",children:p})})},h))]}),d.jsx(K1,{name:e,customValue:null,popperOpen:b,anchorEl:c,zIndex:xv.POPPER,activeField:i,onEnter:l,onLeave:f,onChange:y})]})},Sv=({setOpen:e})=>{const t=()=>{e(n=>!n)};return d.jsx(vv,{onClick:t,tabIndex:0,children:d.jsx(u.icons.Add,{sx:{fontSize:"12px",color:"#4d596c"}})})},Av=({name:e,variables:t,customFields:n,onOptionClick:r})=>{const[o,s]=I.useState(!1),a=i=>{s(!1),r(i)};return d.jsx(u.ClickAwayListener,{onClickAway:()=>{s(!1)},children:d.jsx(u.Box,{children:d.jsx(u.Tooltip,{title:d.jsx(_v,{name:e,variables:t,customFields:n,onOptionClick:a}),placement:"bottom-end",arrow:!1,open:o,PopperProps:{sx:{"& .MuiTooltip-popper":{zIndex:2e3},"& .MuiTooltip-tooltip":{backgroundColor:"transparent",color:"inherit",padding:0,boxShadow:"none",fontSize:"inherit"}}},children:d.jsx(u.Box,{children:d.jsx(Sv,{setOpen:s})})})})})},Tv=()=>{const e=I.useRef(0),t=I.useRef(null);return{onBlur:s=>{var i;const a=((i=s==null?void 0:s.target)==null?void 0:i.selectionStart)??0;e.current=a},inputRef:t,focusInput:(s=0)=>{var l;const a=t.current;if(!a)return;const i=e.current+s;(l=a.focus)==null||l.call(a),(window.requestAnimationFrame??window.setTimeout)(()=>{var f;(f=a.setSelectionRange)==null||f.call(a,i,i)})},insertVariable:(s,a)=>{const i=e.current;return s.slice(0,i)+a+s.slice(i)}}},Lv=({name:e,type:t,value:n,label:r,variables:o,hasError:s,limit:a,multiline:i=!1,customFields:c,isRequired:l=!1,onChange:f,setError:g})=>{const{onBlur:y,inputRef:C,focusInput:b,insertVariable:h}=Tv(),p=t==="date"?o.filter(w=>w.isDate):o,m=M1(w=>{let E=j8(w);t==="date"&&(E=B8(w)),l&&!w&&(E=`${r} is required`),g(E)},1e3),x=w=>{f(w),m(w)},v=({value:w})=>{const E=h(n,w);x(E),b(w==null?void 0:w.length)};return d.jsx(rv,{inputRef:C,value:n,onChange:x,onBlur:y,placeholder:"Value",hasError:s,limit:a,multiline:i,InputProps:{endAdornment:p.length>0?d.jsx(Ev,{style:{justifyContent:i?"flex-end":"center",padding:"10px"},children:d.jsx(Av,{name:e,variables:p,customFields:c,onOptionClick:v})}):null}})},Ov=({name:e,value:t,placeholder:n,searchPlaceholder:r="Search",formData:o,interfaceDetails:s,customFields:a=[],className:i,hasApiSearch:c=!1,zIndex:l=3e3,fetchOptions:f,onChange:g})=>{const[y,C]=I.useState(!1),[b,h]=I.useState("options"),{activeField:p,anchorEl:m,onEnter:x,onLeave:v}=$1(),w=N8(t),{selectedValue:E,search:_,optionsProps:A,observerProps:S,filteredOptions:L,paginationEnabled:N,labelsMap:D,setSearch:k}=J1({value:w?void 0:t,interfaceDetails:s,formData:o,fieldKey:e,hasApiSearch:c,fetchOptions:f}),{parentRef:M}=S,j=q=>{const U=Y1(q);U&&(g(U),v(),C(!1))},G=q=>{const U=String(q.target.value);if(U===q1)return;const te=D[U];g({value:U,label:te}),v(),C(!1)},Y=q=>U=>{U.preventDefault(),U.stopPropagation(),h(q),v()},J=b==="custom"&&Array.isArray(p==null?void 0:p.options)&&p.options.length>0,z=()=>{if(!t)return d.jsx(Da,{children:n});const[q,U]=t.label.split(" > ");return w?d.jsxs(mv,{children:[d.jsx(Da,{children:q}),d.jsx(u.icons.ChevronRightOutlined,{sx:{fontSize:"18px"}}),d.jsx(Da,{children:U})]}):d.jsx(Da,{children:t.label})};return I.useEffect(()=>{if(!(t!=null&&t.value)||!y)return;const q=z1(t.value)?"custom":"options";h(q)},[t,y]),d.jsxs(u.FormControl,{fullWidth:!0,sx:iv,className:i,children:[d.jsxs(u.Select,{id:e,displayEmpty:!0,value:E,variant:"outlined",size:"small",sx:cv,open:y,onOpen:()=>{C(!0),h("options")},onClose:()=>{C(!1),v()},renderValue:z,MenuProps:{autoFocus:!1,sx:{zIndex:l},PaperProps:{sx:ov},MenuListProps:{sx:sv,ref:M}},onChange:G,children:[d.jsx(u.ListSubheader,{sx:av,children:d.jsxs(u.Box,{sx:dv,children:[d.jsx(u.Box,{component:"button",type:"button",sx:U1(b==="options"),onClick:Y("options"),children:d.jsx(u.Typography,{variant:"caption",fontSize:14,fontWeight:500,color:b==="options"?u.theme.palette.gray.gray1:u.theme.palette.gray.gray3,children:"Options"})}),d.jsx(u.Box,{component:"button",type:"button",sx:U1(b==="custom"),onClick:Y("custom"),children:d.jsx(u.Typography,{variant:"caption",fontSize:14,fontWeight:500,color:b==="custom"?u.theme.palette.gray.gray1:u.theme.palette.gray.gray3,children:"Custom Object"})})]})}),b==="options"?Q1({selectedValue:E,search:_,searchPlaceholder:r,paginationEnabled:N,filteredOptions:L,observerProps:S,optionsProps:A,setSearch:k,searchOffset:62}):a.map(q=>{const U=q.options.length>0;return d.jsxs(u.ListSubheader,{onPointerEnter:te=>{te.pointerType==="touch"||!U||x({field:q,currentTarget:te.currentTarget})},onPointerLeave:te=>{te.pointerType==="touch"||!U||v()},sx:uv(U&&(p==null?void 0:p.id)===q.id),"data-field-id":q.id,children:[d.jsx("span",{style:{minWidth:0,flex:1,textAlign:"left"},children:q.name}),U?d.jsx(u.icons.PlayArrow,{sx:fv}):null]},q.id)})]}),d.jsx(K1,{name:e,customValue:w,popperOpen:J,anchorEl:m,zIndex:l,activeField:p,onEnter:x,onLeave:v,onChange:j})]})},Fv=({field:e,formId:t,value:n,formValues:r,variables:o,customFields:s,errors:a,checkMandatory:i,setError:c,fetchOptions:l,setFormValues:f,onFieldChange:g})=>{var v,w;const y=I.useMemo(()=>of(500),[]),C=E=>{f(_=>({..._,[e.name]:E})),y(()=>{g==null||g({name:e.name,value:E,type:e.type})})},b=a[e.name],h=b?d.jsx(u.Tooltip,{title:b,placement:"bottom",children:d.jsx(nv,{variant:"body2",fontSize:"13px",color:u.theme.palette.error.main,children:b})}):null,m=Array.isArray(s)&&s.length>0?d.jsx(Ov,{customFields:s??[],interfaceDetails:e.interfaceDetails??e.searchInterfaceDetails,formData:r,fetchOptions:E=>l(E,{formId:t,fieldName:e.name}),name:e.name,value:n,placeholder:"Select object",hasApiSearch:!!e.searchInterfaceDetails,onChange:C}):d.jsx(ev,{fieldKey:`${t}-${e.name}`,interfaceDetails:e.interfaceDetails??e.searchInterfaceDetails,value:n,fetchOptions:E=>l(E,{formId:t,fieldName:e.name}),disabled:e.disabled,placeholder:e.placeholder??"Select",menuZIndex:yv,formData:r,hasApiSearch:!!e.searchInterfaceDetails,onChange:C}),x=D8(e)?m:d.jsx(Lv,{name:e.name,label:e.label,type:e.type,variables:o,value:r[e.name]??"",isRequired:i&&!!((v=e.validations)!=null&&v.isRequired),onChange:C,hasError:!!b,limit:(w=e.validations)==null?void 0:w.maxCharacters,multiline:e.type==="multiline",setError:E=>c({name:e.name,value:E}),customFields:s});return d.jsxs(u.Stack,{direction:"row",alignItems:"center",gap:"4px",position:"relative",children:[x,h]})},kv=e=>T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},T.createElement("g",{clipPath:"url(#clip0_833_38792)"},T.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.4 2.52266C11.4 2.86744 11.537 3.1981 11.7808 3.4419C12.0246 3.68569 12.3552 3.82266 12.7 3.82266C13.0448 3.82266 13.3754 3.68569 13.6192 3.4419C13.863 3.1981 14 2.86744 14 2.52266C14 2.17788 13.863 1.84722 13.6192 1.60342C13.3754 1.35962 13.0448 1.22266 12.7 1.22266C12.3552 1.22266 12.0246 1.35962 11.7808 1.60342C11.537 1.84722 11.4 2.17788 11.4 2.52266ZM1 2.52266C1 2.86744 1.13696 3.1981 1.38076 3.44189C1.62456 3.68569 1.95522 3.82266 2.3 3.82266C2.64478 3.82266 2.97544 3.68569 3.21924 3.44189C3.46304 3.1981 3.6 2.86744 3.6 2.52266C3.6 2.17788 3.46304 1.84721 3.21924 1.60342C2.97544 1.35962 2.64478 1.22266 2.3 1.22266C1.95522 1.22266 1.62456 1.35962 1.38076 1.60342C1.13696 1.84721 1 2.17787 1 2.52266Z",fill:"#7853FF",stroke:"#7853FF",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.4 12.3449C11.4 12.6897 11.537 13.0204 11.7808 13.2642C12.0246 13.508 12.3552 13.6449 12.7 13.6449C13.0448 13.6449 13.3754 13.508 13.6192 13.2642C13.863 13.0204 14 12.6897 14 12.3449C14 12.0001 13.863 11.6695 13.6192 11.4257C13.3754 11.1819 13.0448 11.0449 12.7 11.0449C12.3552 11.0449 12.0246 11.1819 11.7808 11.4257C11.537 11.6695 11.4 12.0001 11.4 12.3449ZM1 12.3449C1 12.6897 1.13696 13.0204 1.38076 13.2642C1.62456 13.508 1.95522 13.6449 2.3 13.6449C2.64478 13.6449 2.97544 13.508 3.21924 13.2642C3.46304 13.0204 3.6 12.6897 3.6 12.3449C3.6 12.0001 3.46304 11.6695 3.21924 11.4257C2.97544 11.1819 2.64478 11.0449 2.3 11.0449C1.95522 11.0449 1.62456 11.1819 1.38076 11.4257C1.13696 11.6695 1 12.0001 1 12.3449Z",fill:"#7853FF",stroke:"#7853FF",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{d:"M11.3984 2.52344L3.59844 2.52344L5.77656 2.52344",stroke:"#7853FF",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{d:"M11.3984 12.3457L3.59844 12.3457L5.77656 12.3457",stroke:"#7853FF",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round"})),T.createElement("defs",null,T.createElement("clipPath",{id:"clip0_833_38792"},T.createElement("rect",{width:15,height:15,fill:"white",transform:"translate(15) rotate(90)"})))),al={outer:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,bgcolor:"#f3ebff",p:"6px",borderRadius:"8px"},frame:{width:24,height:24,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},rotate:{display:"flex",alignItems:"center",justifyContent:"center",transform:"rotate(180deg)",transformOrigin:"center","& svg":{width:15,height:15,display:"block"}}},Dv=()=>d.jsx(u.Box,{"aria-hidden":!0,component:"span",sx:al.outer,children:d.jsx(u.Box,{component:"span",sx:al.frame,children:d.jsx(u.Box,{component:"span",sx:al.rotate,children:d.jsx(kv,{})})})}),Nv=u.styled("img")`
1213
+ `,_v=({name:e,variables:t,customFields:n,onOptionClick:r})=>{const[o,s]=I.useState(""),a=I.useMemo(()=>t.filter(h=>h.title.toLowerCase().includes(o.toLowerCase())),[t,o]),{activeField:i,anchorEl:c,onEnter:l,onLeave:f}=$1(),g=h=>{var p;s(((p=h==null?void 0:h.target)==null?void 0:p.value)||"")},y=h=>{if(!h)return;const p=Y1(h);r({title:(p==null?void 0:p.label)||"",value:p==null?void 0:p.value})},C=n&&n.length>0,b=!!i&&Array.isArray(i==null?void 0:i.options)&&i.options.length>0;return d.jsxs(Cv,{children:[d.jsx(wv,{value:o,onChange:g,InputProps:{startAdornment:d.jsx(Iv,{children:d.jsx(u.icons.Search,{sx:{fontSize:18,color:u.theme.palette.gray.gray3,flexShrink:0}})})},placeholder:"Search variables",variant:"outlined"}),C&&d.jsx(d.Fragment,{children:d.jsx(np,{variant:"body2_medium",children:"Variables"})}),a.map(({value:h,title:p},m)=>d.jsx(u.Tooltip,{title:p,placement:"top",arrow:!0,children:d.jsx(ep,{onClick:()=>r({title:p,value:h}),children:d.jsx(tp,{variant:"body2",children:p})})},`${p}-${h}-${m}`)),C&&d.jsxs(d.Fragment,{children:[d.jsx(np,{variant:"h2",children:"Custom Objects"}),n==null?void 0:n.map(({id:h,name:p,options:m})=>d.jsx(u.Tooltip,{title:p,placement:"top",arrow:!0,children:d.jsx(ep,{onPointerEnter:x=>{x.pointerType==="touch"||!m.length||l({field:{id:h,name:p,options:m},currentTarget:x.currentTarget})},onPointerLeave:x=>{x.pointerType==="touch"||!m.length||f()},sx:{cursor:m.length?"pointer":"default"},children:d.jsx(tp,{variant:"body2",children:p})})},h))]}),d.jsx(K1,{name:e,customValue:null,popperOpen:b,anchorEl:c,zIndex:xv.POPPER,activeField:i,onEnter:l,onLeave:f,onChange:y})]})},Sv=({setOpen:e})=>{const t=()=>{e(n=>!n)};return d.jsx(vv,{onClick:t,tabIndex:0,children:d.jsx(u.icons.Add,{sx:{fontSize:"12px",color:"#4d596c"}})})},Av=({name:e,variables:t,customFields:n,onOptionClick:r})=>{const[o,s]=I.useState(!1),a=i=>{s(!1),r(i)};return d.jsx(u.ClickAwayListener,{onClickAway:()=>{s(!1)},children:d.jsx(u.Box,{children:d.jsx(u.Tooltip,{title:d.jsx(_v,{name:e,variables:t,customFields:n,onOptionClick:a}),placement:"bottom-end",arrow:!1,open:o,PopperProps:{sx:{"& .MuiTooltip-popper":{zIndex:2e3},"& .MuiTooltip-tooltip":{backgroundColor:"transparent",color:"inherit",padding:0,boxShadow:"none",fontSize:"inherit"}}},children:d.jsx(u.Box,{children:d.jsx(Sv,{setOpen:s})})})})})},Tv=()=>{const e=I.useRef(0),t=I.useRef(null);return{onBlur:s=>{var i;const a=((i=s==null?void 0:s.target)==null?void 0:i.selectionStart)??0;e.current=a},inputRef:t,focusInput:(s=0)=>{var l;const a=t.current;if(!a)return;const i=e.current+s;(l=a.focus)==null||l.call(a),(window.requestAnimationFrame??window.setTimeout)(()=>{var f;(f=a.setSelectionRange)==null||f.call(a,i,i)})},insertVariable:(s,a)=>{const i=e.current;return s.slice(0,i)+a+s.slice(i)}}},Lv=({name:e,type:t,value:n,label:r,variables:o,hasError:s,limit:a,multiline:i=!1,customFields:c,isRequired:l=!1,onChange:f,setError:g})=>{const{onBlur:y,inputRef:C,focusInput:b,insertVariable:h}=Tv(),p=t==="date"?o.filter(w=>w.isDate):o,m=M1(w=>{let E=j8(w);t==="date"&&(E=B8(w)),l&&!w&&(E=`${r} is required`),g(E)},1e3),x=w=>{f(w),m(w)},v=({value:w})=>{const E=h(n,w);x(E),b(w==null?void 0:w.length)};return d.jsx(rv,{inputRef:C,value:n,onChange:x,onBlur:y,placeholder:"Value",hasError:s,limit:a,multiline:i,InputProps:{endAdornment:p.length>0?d.jsx(Ev,{style:{justifyContent:i?"flex-end":"center",padding:"10px"},children:d.jsx(Av,{name:e,variables:p,customFields:c,onOptionClick:v})}):null}})},Ov=({name:e,value:t,placeholder:n,searchPlaceholder:r="Search",formData:o,interfaceDetails:s,customFields:a=[],className:i,hasApiSearch:c=!1,zIndex:l=3e3,fetchOptions:f,onChange:g})=>{const[y,C]=I.useState(!1),[b,h]=I.useState("options"),{activeField:p,anchorEl:m,onEnter:x,onLeave:v}=$1(),w=N8(t),{selectedValue:E,search:_,optionsProps:A,observerProps:S,filteredOptions:L,paginationEnabled:N,labelsMap:D,setSearch:k}=J1({value:w?void 0:t,interfaceDetails:s,formData:o,fieldKey:e,hasApiSearch:c,fetchOptions:f}),{parentRef:M}=S,j=q=>{const U=Y1(q);U&&(g(U),v(),C(!1))},G=q=>{const U=String(q.target.value);if(U===q1)return;const te=D[U];g({value:U,label:te}),v(),C(!1)},Y=q=>U=>{U.preventDefault(),U.stopPropagation(),h(q),v()},J=b==="custom"&&Array.isArray(p==null?void 0:p.options)&&p.options.length>0,z=()=>{if(!t)return d.jsx(Da,{children:n});const[q,U]=t.label.split(" > ");return w?d.jsxs(mv,{children:[d.jsx(Da,{children:q}),d.jsx(u.icons.ChevronRightOutlined,{sx:{fontSize:"18px"}}),d.jsx(Da,{children:U})]}):d.jsx(Da,{children:t.label})};return I.useEffect(()=>{if(!(t!=null&&t.value)||!y)return;const q=z1(t.value)?"custom":"options";h(q)},[t,y]),d.jsxs(u.FormControl,{fullWidth:!0,sx:iv,className:i,children:[d.jsxs(u.Select,{id:e,displayEmpty:!0,value:E,variant:"outlined",size:"small",sx:cv,open:y,onOpen:()=>{C(!0),h("options")},onClose:()=>{C(!1),v()},renderValue:z,MenuProps:{autoFocus:!1,sx:{zIndex:l},PaperProps:{sx:ov},MenuListProps:{sx:sv,ref:M}},onChange:G,children:[d.jsx(u.ListSubheader,{sx:av,children:d.jsxs(u.Box,{sx:dv,children:[d.jsx(u.Box,{component:"button",type:"button",sx:U1(b==="options"),onClick:Y("options"),children:d.jsx(u.Typography,{variant:"caption",fontSize:14,fontWeight:400,color:"inherit",children:"Options"})}),d.jsx(u.Box,{component:"button",type:"button",sx:U1(b==="custom"),onClick:Y("custom"),children:d.jsx(u.Typography,{variant:"caption",fontSize:14,fontWeight:400,color:"inherit",children:"Custom Object"})})]})}),b==="options"?Q1({selectedValue:E,search:_,searchPlaceholder:r,paginationEnabled:N,filteredOptions:L,observerProps:S,optionsProps:A,setSearch:k,searchOffset:52}):a.map(q=>{const U=q.options.length>0;return d.jsxs(u.ListSubheader,{onPointerEnter:te=>{te.pointerType==="touch"||!U||x({field:q,currentTarget:te.currentTarget})},onPointerLeave:te=>{te.pointerType==="touch"||!U||v()},sx:uv(U&&(p==null?void 0:p.id)===q.id),"data-field-id":q.id,children:[d.jsx("span",{style:{minWidth:0,flex:1,textAlign:"left"},children:q.name}),U?d.jsx(u.icons.PlayArrow,{sx:fv}):null]},q.id)})]}),d.jsx(K1,{name:e,customValue:w,popperOpen:J,anchorEl:m,zIndex:l,activeField:p,onEnter:x,onLeave:v,onChange:j})]})},Fv=({field:e,formId:t,value:n,formValues:r,variables:o,customFields:s,errors:a,checkMandatory:i,setError:c,fetchOptions:l,setFormValues:f,onFieldChange:g})=>{var v,w;const y=I.useMemo(()=>of(500),[]),C=E=>{f(_=>({..._,[e.name]:E})),y(()=>{g==null||g({name:e.name,value:E,type:e.type})})},b=a[e.name],h=b?d.jsx(u.Tooltip,{title:b,placement:"bottom",children:d.jsx(nv,{variant:"body2",fontSize:"13px",color:u.theme.palette.error.main,children:b})}):null,m=Array.isArray(s)&&s.length>0?d.jsx(Ov,{customFields:s??[],interfaceDetails:e.interfaceDetails??e.searchInterfaceDetails,formData:r,fetchOptions:E=>l(E,{formId:t,fieldName:e.name}),name:e.name,value:n,placeholder:"Select object",hasApiSearch:!!e.searchInterfaceDetails,onChange:C}):d.jsx(ev,{fieldKey:`${t}-${e.name}`,interfaceDetails:e.interfaceDetails??e.searchInterfaceDetails,value:n,fetchOptions:E=>l(E,{formId:t,fieldName:e.name}),disabled:e.disabled,placeholder:e.placeholder??"Select",menuZIndex:yv,formData:r,hasApiSearch:!!e.searchInterfaceDetails,onChange:C}),x=D8(e)?m:d.jsx(Lv,{name:e.name,label:e.label,type:e.type,variables:o,value:r[e.name]??"",isRequired:i&&!!((v=e.validations)!=null&&v.isRequired),onChange:C,hasError:!!b,limit:(w=e.validations)==null?void 0:w.maxCharacters,multiline:e.type==="multiline",setError:E=>c({name:e.name,value:E}),customFields:s});return d.jsxs(u.Stack,{direction:"row",alignItems:"center",gap:"4px",position:"relative",children:[x,h]})},kv=e=>T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:15,height:15,viewBox:"0 0 15 15",fill:"none",...e},T.createElement("g",{clipPath:"url(#clip0_833_38792)"},T.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.4 2.52266C11.4 2.86744 11.537 3.1981 11.7808 3.4419C12.0246 3.68569 12.3552 3.82266 12.7 3.82266C13.0448 3.82266 13.3754 3.68569 13.6192 3.4419C13.863 3.1981 14 2.86744 14 2.52266C14 2.17788 13.863 1.84722 13.6192 1.60342C13.3754 1.35962 13.0448 1.22266 12.7 1.22266C12.3552 1.22266 12.0246 1.35962 11.7808 1.60342C11.537 1.84722 11.4 2.17788 11.4 2.52266ZM1 2.52266C1 2.86744 1.13696 3.1981 1.38076 3.44189C1.62456 3.68569 1.95522 3.82266 2.3 3.82266C2.64478 3.82266 2.97544 3.68569 3.21924 3.44189C3.46304 3.1981 3.6 2.86744 3.6 2.52266C3.6 2.17788 3.46304 1.84721 3.21924 1.60342C2.97544 1.35962 2.64478 1.22266 2.3 1.22266C1.95522 1.22266 1.62456 1.35962 1.38076 1.60342C1.13696 1.84721 1 2.17787 1 2.52266Z",fill:"#7853FF",stroke:"#7853FF",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.4 12.3449C11.4 12.6897 11.537 13.0204 11.7808 13.2642C12.0246 13.508 12.3552 13.6449 12.7 13.6449C13.0448 13.6449 13.3754 13.508 13.6192 13.2642C13.863 13.0204 14 12.6897 14 12.3449C14 12.0001 13.863 11.6695 13.6192 11.4257C13.3754 11.1819 13.0448 11.0449 12.7 11.0449C12.3552 11.0449 12.0246 11.1819 11.7808 11.4257C11.537 11.6695 11.4 12.0001 11.4 12.3449ZM1 12.3449C1 12.6897 1.13696 13.0204 1.38076 13.2642C1.62456 13.508 1.95522 13.6449 2.3 13.6449C2.64478 13.6449 2.97544 13.508 3.21924 13.2642C3.46304 13.0204 3.6 12.6897 3.6 12.3449C3.6 12.0001 3.46304 11.6695 3.21924 11.4257C2.97544 11.1819 2.64478 11.0449 2.3 11.0449C1.95522 11.0449 1.62456 11.1819 1.38076 11.4257C1.13696 11.6695 1 12.0001 1 12.3449Z",fill:"#7853FF",stroke:"#7853FF",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{d:"M11.3984 2.52344L3.59844 2.52344L5.77656 2.52344",stroke:"#7853FF",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round"}),T.createElement("path",{d:"M11.3984 12.3457L3.59844 12.3457L5.77656 12.3457",stroke:"#7853FF",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round"})),T.createElement("defs",null,T.createElement("clipPath",{id:"clip0_833_38792"},T.createElement("rect",{width:15,height:15,fill:"white",transform:"translate(15) rotate(90)"})))),al={outer:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,bgcolor:"#f3ebff",p:"6px",borderRadius:"8px"},frame:{width:24,height:24,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},rotate:{display:"flex",alignItems:"center",justifyContent:"center",transform:"rotate(180deg)",transformOrigin:"center","& svg":{width:15,height:15,display:"block"}}},Dv=()=>d.jsx(u.Box,{"aria-hidden":!0,component:"span",sx:al.outer,children:d.jsx(u.Box,{component:"span",sx:al.frame,children:d.jsx(u.Box,{component:"span",sx:al.rotate,children:d.jsx(kv,{})})})}),Nv=u.styled("img")`
1214
1214
  width: 16px;
1215
1215
  height: auto;
1216
1216
  object-fit: cover;
@@ -1270,7 +1270,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1270
1270
  display: inline-block;
1271
1271
  color: inherit;
1272
1272
  }
1273
- `,Xv={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 zv(e){return e.name??e.rowId}const Yv=({open:e,onClose:t,formId:n,fields:r,variables:o,connectorLogo:s,isSaving:a,title:i="Pre-fill fields",isLoading:c=!1,defaultValues:l,customFields:f,checkMandatory:g=!1,fetchOptions:y,onSave:C,onCancel:b,onFieldChange:h})=>{const[p,m]=I.useState({}),[x,v]=I.useState({}),[w,E]=I.useState(!1),_=I.useMemo(()=>of(500),[]),A=I.useMemo(()=>{if(!Array.isArray(r)||!r.length)return[];const M=new Set;return r.filter(G=>M.has(G.name)?!1:(M.add(G.name),!0)).sort((G,Y)=>G.priority-Y.priority)},[r]),S=({name:M,value:j})=>{v(G=>{const Y={...G};return j?Y[M]=j:delete Y[M],Y})};I.useEffect(()=>{l&&e&&m({...l})},[l,e]),I.useEffect(()=>()=>{e||(m({}),v({}))},[e]),I.useEffect(()=>{g&&_(()=>{const j=r.filter(G=>{var Y;return!!((Y=G.validations)!=null&&Y.isRequired)}).filter(G=>!p[G.name]);E(j.length>0)})},[_,p,r,g]);const L=()=>{t(),m({})},N=()=>{b==null||b(),m({}),t()},D=()=>{const M={...p};for(const j in M)M[j]||delete M[j];C(M)},k=Object.keys(x).length>0||w;return d.jsx(u.Dialog,{open:e,onClose:L,PaperProps:{sx:Xv},maxWidth:!1,children:c?d.jsx(u.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",width:"615px"},children:d.jsx(u.CircularProgress,{})}):d.jsxs(Pv,{children:[d.jsxs(jv,{children:[d.jsxs(u.Stack,{direction:"row",alignItems:"center",gap:2,children:[d.jsx(Dv,{}),d.jsx(u.Stack,{gap:.5,flex:1,minWidth:0,children:d.jsxs(u.Stack,{direction:"row",alignItems:"center",gap:.5,children:[d.jsxs(u.Typography,{variant:"h6",fontSize:18,fontWeight:600,color:u.theme.palette.gray.gray1,children:["Pre-fill fields for ",i]}),d.jsx(u.Tooltip,{title:"Assign default values to create fields",placement:"top",children:d.jsx(u.IconButton,{size:"small","aria-label":"About mapping fields",sx:{padding:"4px"},children:d.jsx(u.icons.InfoOutlined,{sx:{fontSize:18,color:u.theme.palette.gray.gray3}})})})]})})]}),d.jsx(u.Tooltip,{title:"Close",placement:"bottom",children:d.jsx(u.IconButton,{onClick:L,size:"small","aria-label":"Close",children:d.jsx(u.icons.Close,{sx:{fontSize:20}})})})]}),d.jsx(Bv,{children:d.jsxs(Vv,{children:[d.jsxs(u.Stack,{direction:"row",padding:"16px 24px",sx:{backgroundColor:u.theme.palette.gray.gray6a,borderBottom:"1px solid #ECEFF6",borderRadius:"8px 8px 0 0"},children:[d.jsx(Rv,{src:s,alt:"Connector"}),d.jsx(u.Typography,{variant:"caption",fontSize:14,fontWeight:600,color:u.theme.palette.gray.gray3,flex:1,children:"Field"}),d.jsx(u.Typography,{variant:"caption",fontSize:14,fontWeight:600,color:u.theme.palette.gray.gray3,width:320,children:"Map to"})]}),A.map((M,j)=>{var J;const G=zv(M),Y=p[G]??"";return d.jsxs(u.Stack,{direction:"row",alignItems:"center",padding:"24px",gap:2,sx:{borderBottom:j<A.length-1?"1px solid #F6F8FC":void 0,"&:last-child":{borderBottom:"none"}},children:[d.jsx(Wv,{children:d.jsxs(u.Typography,{variant:"body2",fontSize:14,color:u.theme.palette.gray.gray2,children:[M.label,g&&((J=M.validations)!=null&&J.isRequired)?d.jsx(Zv,{}):null]})}),d.jsx(Mv,{width:20,height:20}),d.jsx(Hv,{children:d.jsx(Fv,{field:M,formId:String(n),value:Y,formValues:p,variables:o,customFields:f,errors:x,checkMandatory:g,setError:S,fetchOptions:y,setFormValues:m,onFieldChange:h})})]},G)})]})}),d.jsxs(Gv,{children:[d.jsx(u.Button,{variant:"contained",onClick:D,sx:{textTransform:"none",padding:"3px 32px !important"},disabled:a||k,children:"Save"}),d.jsx(u.Button,{variant:"outlined",color:"inherit",onClick:N,disabled:a,sx:{textTransform:"none",padding:"3px 12px !important",borderColor:u.theme.palette.gray.gray5},children:"Cancel"})]})]})})},Jv=u.styled(u.Box)`
1273
+ `,Xv={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 zv(e){return e.name??e.rowId}const Yv=({open:e,onClose:t,formId:n,fields:r,variables:o,connectorLogo:s,isSaving:a,title:i,isLoading:c=!1,defaultValues:l,customFields:f,checkMandatory:g=!1,fetchOptions:y,onSave:C,onCancel:b,onFieldChange:h})=>{const[p,m]=I.useState({}),[x,v]=I.useState({}),[w,E]=I.useState(!1),_=I.useMemo(()=>of(500),[]),A=I.useMemo(()=>{if(!Array.isArray(r)||!r.length)return[];const M=new Set;return r.filter(G=>M.has(G.name)?!1:(M.add(G.name),!0)).sort((G,Y)=>G.priority-Y.priority)},[r]),S=({name:M,value:j})=>{v(G=>{const Y={...G};return j?Y[M]=j:delete Y[M],Y})};I.useEffect(()=>{l&&e&&m({...l})},[l,e]),I.useEffect(()=>()=>{e||(m({}),v({}))},[e]),I.useEffect(()=>{g&&_(()=>{const j=r.filter(G=>{var Y;return!!((Y=G.validations)!=null&&Y.isRequired)}).filter(G=>!p[G.name]);E(j.length>0)})},[_,p,r,g]);const L=()=>{t(),m({})},N=()=>{b==null||b(),m({}),t()},D=()=>{const M={...p};for(const j in M)M[j]||delete M[j];C(M)},k=Object.keys(x).length>0||w;return d.jsx(u.Dialog,{open:e,onClose:L,PaperProps:{sx:Xv},maxWidth:!1,children:c?d.jsx(u.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",width:"615px"},children:d.jsx(u.CircularProgress,{})}):d.jsxs(Pv,{children:[d.jsxs(jv,{children:[d.jsxs(u.Stack,{direction:"row",alignItems:"center",gap:2,children:[d.jsx(Dv,{}),d.jsx(u.Stack,{gap:.5,flex:1,minWidth:0,children:d.jsxs(u.Stack,{direction:"row",alignItems:"center",gap:.5,children:[d.jsx(u.Typography,{variant:"h6",fontSize:18,fontWeight:600,color:u.theme.palette.gray.gray1,children:i}),d.jsx(u.Tooltip,{title:"Assign default values to create fields",placement:"top",children:d.jsx(u.IconButton,{size:"small","aria-label":"About mapping fields",sx:{padding:"4px"},children:d.jsx(u.icons.InfoOutlined,{sx:{fontSize:18,color:u.theme.palette.gray.gray3}})})})]})})]}),d.jsx(u.Tooltip,{title:"Close",placement:"bottom",children:d.jsx(u.IconButton,{onClick:L,size:"small","aria-label":"Close",children:d.jsx(u.icons.Close,{sx:{fontSize:20}})})})]}),d.jsx(Bv,{children:d.jsxs(Vv,{children:[d.jsxs(u.Stack,{direction:"row",padding:"16px 24px",sx:{backgroundColor:u.theme.palette.gray.gray6a,borderBottom:"1px solid #ECEFF6",borderRadius:"8px 8px 0 0"},children:[d.jsx(Rv,{src:s,alt:"Connector"}),d.jsx(u.Typography,{variant:"caption",fontSize:14,fontWeight:600,color:u.theme.palette.gray.gray3,flex:1,children:"Field"}),d.jsx(u.Typography,{variant:"caption",fontSize:14,fontWeight:600,color:u.theme.palette.gray.gray3,width:320,children:"Map to"})]}),A.map((M,j)=>{var J;const G=zv(M),Y=p[G]??"";return d.jsxs(u.Stack,{direction:"row",alignItems:"center",padding:"24px",gap:2,sx:{borderBottom:j<A.length-1?"1px solid #F6F8FC":void 0,"&:last-child":{borderBottom:"none"}},children:[d.jsx(Wv,{children:d.jsxs(u.Typography,{variant:"body2",fontSize:14,color:u.theme.palette.gray.gray2,children:[M.label,g&&((J=M.validations)!=null&&J.isRequired)?d.jsx(Zv,{}):null]})}),d.jsx(Mv,{width:20,height:20}),d.jsx(Hv,{children:d.jsx(Fv,{field:M,formId:String(n),value:Y,formValues:p,variables:o,customFields:f,errors:x,checkMandatory:g,setError:S,fetchOptions:y,setFormValues:m,onFieldChange:h})})]},G)})]})}),d.jsxs(Gv,{children:[d.jsx(u.Button,{variant:"contained",onClick:D,sx:{textTransform:"none",padding:"3px 32px !important"},disabled:a||k,children:"Save"}),d.jsx(u.Button,{variant:"outlined",color:"inherit",onClick:N,disabled:a,sx:{textTransform:"none",padding:"3px 12px !important",borderColor:u.theme.palette.gray.gray5},children:"Cancel"})]})]})})},Jv=u.styled(u.Box)`
1274
1274
  position: fixed;
1275
1275
  inset: 0;
1276
1276
  z-index: ${({zIndex:e})=>e};
@@ -1393,7 +1393,7 @@ Do you want to continue?`,ME="Select an object to create",PE="Select an object t
1393
1393
  height: 20px;
1394
1394
  flex-shrink: 0;
1395
1395
  }
1396
- `,Rp=({cardData:e,cardDataApiStatus:t,objectToLink:n,args:r})=>{const o=Qt(),[s,a]=I.useState(!1),[i,c]=I.useState(!0),{id:l="",cardTitle:f="",logoUrl:g}=e||{},y=t===ee.LOADING,C=h=>{h.stopPropagation();const p=h.currentTarget.offsetWidth<h.currentTarget.scrollWidth;a(!!p)},b=h=>{var m;o(co({id:n,args:r,isRefresh:!0}));const p=h.target.tagName==="BUTTON"?(m=h.target)==null?void 0:m.firstChild:h.target;p.className&&(p.className=""),setTimeout(()=>p.className="selected",1)};return d.jsxs(xI,{children:[d.jsxs(CI,{direction:"row",justifyContent:"space-between",children:[y?d.jsxs(u.Stack,{gap:"6px",direction:"row",children:[d.jsx(jn,{width:"16px",height:"24px"}),d.jsx(jn,{width:"100px",height:"24px"})]}):d.jsxs(EI,{children:[g&&d.jsx("img",{src:g,alt:f}),d.jsx(u.Tooltip,{title:s?f:"",children:d.jsx(u.Typography,{variant:"h4",onMouseOver:h=>C(h),onMouseLeave:h=>C(h),children:f})})]}),d.jsxs(u.Stack,{direction:"row",alignItems:"center",children:[i?d.jsx(u.Tooltip,{title:Dd,placement:"bottom",children:d.jsx(Ur,{onClick:h=>b(h),children:d.jsx("img",{src:wp})})}):null,d.jsx(u.Tooltip,{title:i?Nd:$i,placement:"bottom",children:d.jsx(Ur,{onClick:()=>c(h=>!h),children:d.jsx(ac,{className:i?"":"hiver-up"})})})]})]}),d.jsx(xp,{id:l,cardTitle:f,specificCardData:{[l]:e},specificConnectorApiStatus:{[l]:t},isOpen:i})]})},Mp={values:{},errors:{}},wt={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"},wI=(e,t)=>{const{type:n,payload:r}=t;switch(n){case wt.SET_FIELD_VALUE:{if(!(r!=null&&r.value))return e;const{name:o,value:s}=r.value;return{...e,values:{...e.values,[o]:s}}}case wt.SET_FIELD_ERROR:{if(!(r!=null&&r.value))return e;const{name:o,value:s}=r.value;return typeof s=="boolean"||typeof s=="string"?{...e,errors:{...e.errors,[o]:s}}:e}case wt.CLEAR_ERROR:{if(!(r!=null&&r.value))return e;const{name:o}=r.value;return{...e,errors:{...e.errors,[o]:""}}}case wt.SET_FIELDS:{if(!(r!=null&&r.values))return e;const{values:o}=r;return{...e,values:o}}case wt.SET_FORM_DEFAULTS:{if(!(r!=null&&r.values))return e;const{values:o}=r,s={...e.errors};for(const a in o??{})o[a]&&delete s[a];return{...e,errors:s,values:{...e.values,...o}}}case wt.CLEAR_FIELDS:{const{fieldNames:o}=r??{};if(!Array.isArray(o))return e;const s={...e.values},a={...e.errors};for(const i of o)delete s[i],delete a[i];return{...e,values:s,errors:a}}case wt.RESET_STATE:return Mp}return e},Pp=()=>I.useReducer(wI,Mp),jp=({state:e,dispatch:t,validations:n,dynamicFields:r})=>{const o=e.errors,s=(C,b)=>{t({type:wt.SET_FIELD_VALUE,payload:{value:{value:b,name:C}}})},a=I.useCallback(C=>{t({type:wt.SET_FORM_DEFAULTS,payload:{values:C}})},[t]),i=I.useCallback(()=>Object.keys(o).filter(b=>!!o[b]).length>0,[o]),c=C=>{C.stopPropagation();const{name:b,value:h}=(C==null?void 0:C.target)||{};s(b,h)},l=(C,b)=>{C.stopPropagation();const{name:h}=(C==null?void 0:C.target)||{};s(h,b)},f=(C,b)=>{s(C,b||"")},g=(C,b)=>{e.errors[C]!==b&&t({type:wt.SET_FIELD_ERROR,payload:{value:{name:C,value:b}}})},y=(C,b)=>{if(b){const h=b[C];h==null||h.forEach(p=>{var m;s(p,""),b[p]&&y(p,b),(m=n[p])!=null&&m.isRequired&&g(p,!0)})}};return I.useEffect(()=>{if(Array.isArray(r))return()=>{const C=r.map(b=>b.name);t({type:wt.CLEAR_FIELDS,payload:{fieldNames:C}})}},[r,t]),{setValue:s,setFormDefaults:a,isErrorInValidations:i,inputChangeHandler:c,checkboxChangeHandler:l,dateChangeHandler:f,handleValidationError:g,clearDependentFields:y}},Bp=({formFields:e,formId:t,formState:n,appDispatch:r})=>e.reduce((o,s)=>{if(s.type!=="async-select"||!s.interfaceDetails)return o;const a=s.interfaceDetails,i={loadOptions:(c,l,f,g)=>{let y=a;s.searchInterfaceDetails&&typeof c=="string"&&c.trim().length>0&&!f&&(y=s.searchInterfaceDetails);const C=Uv(n,y==null?void 0:y.args),b=Object.values((y==null?void 0:y.args)||{});if(C.length===b.length){r(Ir({fieldName:s.name,formId:String(t),searchTerm:c,fieldConfig:s,interfaceId:y==null?void 0:y.id,pagination:y==null?void 0:y.pagination,callback:l,args:{...rs(n,y==null?void 0:y.args),...rs(n,y==null?void 0:y.optionalArgs)},isScrollToBottomEvent:f,controller:g}));return}return l([])}};return{...o,[s.name]:i}},{}),Vp=({formFields:e,formId:t,formState:n,conversationId:r,appDispatch:o})=>e.reduce((s,a)=>{if(!a.createOptionInterfaceDetails)return s;const i=a.createOptionInterfaceDetails;return{...s,[a.name]:{createOption:(c,l)=>{var g,y;if(!c)return;const f={values:{name:a.name,value:c},errors:{}};o(Ra({fieldName:a.name,formId:String(t),interfaceId:i.id,conversationId:r,label:c,callback:l,args:{...rs(n,(g=a==null?void 0:a.interfaceDetails)==null?void 0:g.args),...rs(n,(y=a==null?void 0:a.interfaceDetails)==null?void 0:y.optionalArgs)},createArgs:{...rs(f,i.args)}}))}}}},{}),Gp=({formFields:e,formState:t,formId:n,conversationId:r})=>{const o=Qt(),s=I.useMemo(()=>{if(e&&e.length){const i=Bp({formFields:e,formId:n,formState:t,appDispatch:o});return e.reduce((l,f)=>{const g=f.columns;if(!g)return l;const y=Bp({formFields:g,formId:n,formState:t,appDispatch:o});return{...l,[f.name]:{loadOptionsList:y}}},i)}return null},[e,t,n,o]),a=I.useMemo(()=>{const i=Vp({formFields:e,formId:n,formState:t,conversationId:r,appDispatch:o});return e.reduce((l,f)=>{const g=f.columns;if(!g)return l;const y=Vp({formFields:g,formId:n,formState:t,conversationId:r,appDispatch:o});return{...l,[f.name]:{createOptionList:y}}},i)},[e,n,t,r,o]);return{fetchConfig:s,createConfig:a}},II=async({formId:e})=>{try{const t=await ve({url:rt(ip,{formId:e}),method:Oe.GET}),n=t==null?void 0:t.data;return n.enabled?af(n.defaults):{}}catch(t){throw console.error(t),t}},Hp=({formId:e})=>["Global","WriteForm","FormDefaults",e],_I=({formId:e,enabled:t})=>{const n=I.useRef(!1),r=I.useRef(void 0);e&&e!==r.current&&(n.current=!0,r.current=e);const o=Zt({queryKey:Hp({formId:e}),queryFn:async()=>{const s=await II({formId:e});return n.current=!1,s},refetchOnMount:!0,enabled:n.current&&t,staleTime:0});return{enabledRef:n,...o}},Wp=e=>Array.isArray(e)&&e.length>0,SI=async({formId:e,conversationId:t,inboxIds:n})=>{try{const r=new URLSearchParams;if(t&&r.set("conversation_id",String(t)),Wp(n))for(const a of n)r.append("inbox_id",String(a));const o=await ve({url:rt(CE,{formId:e})+"?"+r.toString(),method:Oe.GET}),s=o==null?void 0:o.data;if(!s.enabled)throw new Error("Form default values are not enabled");return af(s.defaults,!0)}catch(r){throw console.error(r),r}},Zp=({formId:e,conversationId:t,inboxIds:n})=>["Global","WriteForm","FormDefaults",e,t,n],Xp=({formId:e,conversationId:t,inboxIds:n,enabled:r,fetchOnMount:o=!0})=>{const s=I.useRef(!0),a=I.useRef();e!==a.current&&(s.current=!0,a.current=e);const i=Zt({queryKey:Zp({formId:e,conversationId:t,inboxIds:n}),queryFn:async()=>{const l=await SI({formId:e,conversationId:t,inboxIds:n});return s.current=!1,l},refetchOnMount:o,enabled:s.current&&!!e&&!!t&&Wp(n)&&r,staleTime:0}),c=I.useMemo(()=>{if(Object.keys(i.data??{}).length===0&&i.isSuccess)return!0},[i.data,i.isSuccess]);return{enabledRef:s,isNudgeRequired:c,...i}},AI=async({formId:e,data:t})=>{try{return await ve({url:rt(ip,{formId:e}),data:{defaults:t},method:Oe.PUT}),{formId:e,data:t}}catch(n){throw console.error(n),n}},TI=({formId:e,conversationId:t,inboxIds:n,onSuccess:r,onError:o})=>{const s=Zr();return Xt({mutationFn:a=>AI({formId:e,data:a}),onSuccess:a=>{s.invalidateQueries({queryKey:Hp({formId:e})}),s.invalidateQueries({queryKey:Zp({formId:e,conversationId:t,inboxIds:n})}),r==null||r(a),Se({message:"Form defaults updated successfully",type:Ut})},onError:()=>{o==null||o(),Se({message:"Failed to update form defaults",type:qe})}})},LI=({open:e,isEdit:t,formId:n,fields:r,connectorLogo:o,variables:s,customFormArgsEnabled:a,customFormArgsMap:i,title:c="Pre-fill fields",isLoading:l=!1,onSuccess:f,onClose:g})=>{const[y,C]=I.useState({}),{conversationId:b,currentSmIds:h}=I.useContext(He),{data:p}=O6({formId:n,formData:y,argsMap:i??{},enabled:!!n&&!!a,delay:500}),{data:m,isLoading:x,enabledRef:v}=_I({formId:n,enabled:!t&&!!e&&!!n}),{mutate:w,isPending:E}=TI({formId:n,conversationId:b,inboxIds:h,onSuccess:N=>{v.current=!0,f==null||f(N)}}),_=I.useMemo(()=>p!=null&&p.length?[...r,...p]:r,[r,p]);I.useEffect(()=>{m&&C(m)},[m]);const A=N=>{const D=_.map(M=>({name:M.name,type:M.isMultiSelect?"multi-select":M.type})),k=H6(N,D);w(k)},S=async({args:N,pagination:D},{formId:k,fieldName:M})=>{const j=await op({formId:k,fieldName:M},{pagination:D,args:N}),G=Array.isArray(j==null?void 0:j.data.data)?j.data.data:[];return{options:G,hasMore:!!G.length}},L=N=>{const D=nf(N.value)?N.value.value:N.value,k=D&&N.type==="multi-select"?[D]:D;C(M=>({...M,[N.name]:k}))};return d.jsx(Yv,{open:e,defaultValues:m,formId:n,fields:_,connectorLogo:o,variables:s,title:c,isLoading:l||x,isSaving:E,fetchOptions:S,onSave:A,onClose:()=>g==null?void 0:g(),onCancel:()=>g==null?void 0:g(),onFieldChange:L})},OI=async({formId:e,args:t})=>{try{const n=await ve({url:rt(xE,{formId:e}),data:{args:t},method:Oe.POST});return(n==null?void 0:n.data).fieldList.map(o=>ll(o))}catch(n){throw console.error(n),n}},FI=({formId:e,args:t,enabled:n,delay:r=500})=>{const[o,s]=I.useState(t);return I.useEffect(()=>{const a=setTimeout(()=>s(t),r);return()=>clearTimeout(a)},[t,r]),Zt({queryKey:["Global","WriteForm","CustomFields",e,o],queryFn:()=>OI({formId:e,args:t}),refetchOnMount:!1,enabled:n})},zp="connector-agent_auto_fill_nudge",kI=u.styled(u.Stack)`
1396
+ `,Rp=({cardData:e,cardDataApiStatus:t,objectToLink:n,args:r})=>{const o=Qt(),[s,a]=I.useState(!1),[i,c]=I.useState(!0),{id:l="",cardTitle:f="",logoUrl:g}=e||{},y=t===ee.LOADING,C=h=>{h.stopPropagation();const p=h.currentTarget.offsetWidth<h.currentTarget.scrollWidth;a(!!p)},b=h=>{var m;o(co({id:n,args:r,isRefresh:!0}));const p=h.target.tagName==="BUTTON"?(m=h.target)==null?void 0:m.firstChild:h.target;p.className&&(p.className=""),setTimeout(()=>p.className="selected",1)};return d.jsxs(xI,{children:[d.jsxs(CI,{direction:"row",justifyContent:"space-between",children:[y?d.jsxs(u.Stack,{gap:"6px",direction:"row",children:[d.jsx(jn,{width:"16px",height:"24px"}),d.jsx(jn,{width:"100px",height:"24px"})]}):d.jsxs(EI,{children:[g&&d.jsx("img",{src:g,alt:f}),d.jsx(u.Tooltip,{title:s?f:"",children:d.jsx(u.Typography,{variant:"h4",onMouseOver:h=>C(h),onMouseLeave:h=>C(h),children:f})})]}),d.jsxs(u.Stack,{direction:"row",alignItems:"center",children:[i?d.jsx(u.Tooltip,{title:Dd,placement:"bottom",children:d.jsx(Ur,{onClick:h=>b(h),children:d.jsx("img",{src:wp})})}):null,d.jsx(u.Tooltip,{title:i?Nd:$i,placement:"bottom",children:d.jsx(Ur,{onClick:()=>c(h=>!h),children:d.jsx(ac,{className:i?"":"hiver-up"})})})]})]}),d.jsx(xp,{id:l,cardTitle:f,specificCardData:{[l]:e},specificConnectorApiStatus:{[l]:t},isOpen:i})]})},Mp={values:{},errors:{}},wt={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"},wI=(e,t)=>{const{type:n,payload:r}=t;switch(n){case wt.SET_FIELD_VALUE:{if(!(r!=null&&r.value))return e;const{name:o,value:s}=r.value;return{...e,values:{...e.values,[o]:s}}}case wt.SET_FIELD_ERROR:{if(!(r!=null&&r.value))return e;const{name:o,value:s}=r.value;return typeof s=="boolean"||typeof s=="string"?{...e,errors:{...e.errors,[o]:s}}:e}case wt.CLEAR_ERROR:{if(!(r!=null&&r.value))return e;const{name:o}=r.value;return{...e,errors:{...e.errors,[o]:""}}}case wt.SET_FIELDS:{if(!(r!=null&&r.values))return e;const{values:o}=r;return{...e,values:o}}case wt.SET_FORM_DEFAULTS:{if(!(r!=null&&r.values))return e;const{values:o}=r,s={...e.errors};for(const a in o??{})o[a]&&delete s[a];return{...e,errors:s,values:{...e.values,...o}}}case wt.CLEAR_FIELDS:{const{fieldNames:o}=r??{};if(!Array.isArray(o))return e;const s={...e.values},a={...e.errors};for(const i of o)delete s[i],delete a[i];return{...e,values:s,errors:a}}case wt.RESET_STATE:return Mp}return e},Pp=()=>I.useReducer(wI,Mp),jp=({state:e,dispatch:t,validations:n,dynamicFields:r})=>{const o=e.errors,s=(C,b)=>{t({type:wt.SET_FIELD_VALUE,payload:{value:{value:b,name:C}}})},a=I.useCallback(C=>{t({type:wt.SET_FORM_DEFAULTS,payload:{values:C}})},[t]),i=I.useCallback(()=>Object.keys(o).filter(b=>!!o[b]).length>0,[o]),c=C=>{C.stopPropagation();const{name:b,value:h}=(C==null?void 0:C.target)||{};s(b,h)},l=(C,b)=>{C.stopPropagation();const{name:h}=(C==null?void 0:C.target)||{};s(h,b)},f=(C,b)=>{s(C,b||"")},g=(C,b)=>{e.errors[C]!==b&&t({type:wt.SET_FIELD_ERROR,payload:{value:{name:C,value:b}}})},y=(C,b)=>{if(b){const h=b[C];h==null||h.forEach(p=>{var m;s(p,""),b[p]&&y(p,b),(m=n[p])!=null&&m.isRequired&&g(p,!0)})}};return I.useEffect(()=>{if(Array.isArray(r))return()=>{const C=r.map(b=>b.name);t({type:wt.CLEAR_FIELDS,payload:{fieldNames:C}})}},[r,t]),{setValue:s,setFormDefaults:a,isErrorInValidations:i,inputChangeHandler:c,checkboxChangeHandler:l,dateChangeHandler:f,handleValidationError:g,clearDependentFields:y}},Bp=({formFields:e,formId:t,formState:n,appDispatch:r})=>e.reduce((o,s)=>{if(s.type!=="async-select"||!s.interfaceDetails)return o;const a=s.interfaceDetails,i={loadOptions:(c,l,f,g)=>{let y=a;s.searchInterfaceDetails&&typeof c=="string"&&c.trim().length>0&&!f&&(y=s.searchInterfaceDetails);const C=Uv(n,y==null?void 0:y.args),b=Object.values((y==null?void 0:y.args)||{});if(C.length===b.length){r(Ir({fieldName:s.name,formId:String(t),searchTerm:c,fieldConfig:s,interfaceId:y==null?void 0:y.id,pagination:y==null?void 0:y.pagination,callback:l,args:{...rs(n,y==null?void 0:y.args),...rs(n,y==null?void 0:y.optionalArgs)},isScrollToBottomEvent:f,controller:g}));return}return l([])}};return{...o,[s.name]:i}},{}),Vp=({formFields:e,formId:t,formState:n,conversationId:r,appDispatch:o})=>e.reduce((s,a)=>{if(!a.createOptionInterfaceDetails)return s;const i=a.createOptionInterfaceDetails;return{...s,[a.name]:{createOption:(c,l)=>{var g,y;if(!c)return;const f={values:{name:a.name,value:c},errors:{}};o(Ra({fieldName:a.name,formId:String(t),interfaceId:i.id,conversationId:r,label:c,callback:l,args:{...rs(n,(g=a==null?void 0:a.interfaceDetails)==null?void 0:g.args),...rs(n,(y=a==null?void 0:a.interfaceDetails)==null?void 0:y.optionalArgs)},createArgs:{...rs(f,i.args)}}))}}}},{}),Gp=({formFields:e,formState:t,formId:n,conversationId:r})=>{const o=Qt(),s=I.useMemo(()=>{if(e&&e.length){const i=Bp({formFields:e,formId:n,formState:t,appDispatch:o});return e.reduce((l,f)=>{const g=f.columns;if(!g)return l;const y=Bp({formFields:g,formId:n,formState:t,appDispatch:o});return{...l,[f.name]:{loadOptionsList:y}}},i)}return null},[e,t,n,o]),a=I.useMemo(()=>{const i=Vp({formFields:e,formId:n,formState:t,conversationId:r,appDispatch:o});return e.reduce((l,f)=>{const g=f.columns;if(!g)return l;const y=Vp({formFields:g,formId:n,formState:t,conversationId:r,appDispatch:o});return{...l,[f.name]:{createOptionList:y}}},i)},[e,n,t,r,o]);return{fetchConfig:s,createConfig:a}},II=async({formId:e})=>{try{const t=await ve({url:rt(ip,{formId:e}),method:Oe.GET}),n=t==null?void 0:t.data;return n.enabled?af(n.defaults):{}}catch(t){throw console.error(t),t}},Hp=({formId:e})=>["Global","WriteForm","FormDefaults",e],_I=({formId:e,enabled:t})=>{const n=I.useRef(!1),r=I.useRef(void 0);e&&e!==r.current&&(n.current=!0,r.current=e);const o=Zt({queryKey:Hp({formId:e}),queryFn:async()=>{const s=await II({formId:e});return n.current=!1,s},refetchOnMount:!0,enabled:n.current&&t,staleTime:0});return{enabledRef:n,...o}},Wp=e=>Array.isArray(e)&&e.length>0,SI=async({formId:e,conversationId:t,inboxIds:n})=>{try{const r=new URLSearchParams;if(t&&r.set("conversation_id",String(t)),Wp(n))for(const a of n)r.append("inbox_id",String(a));const o=await ve({url:rt(CE,{formId:e})+"?"+r.toString(),method:Oe.GET}),s=o==null?void 0:o.data;if(!s.enabled)throw new Error("Form default values are not enabled");return af(s.defaults,!0)}catch(r){throw console.error(r),r}},Zp=({formId:e,conversationId:t,inboxIds:n})=>["Global","WriteForm","FormDefaults",e,t,n],Xp=({formId:e,conversationId:t,inboxIds:n,enabled:r,fetchOnMount:o=!0})=>{const s=I.useRef(!0),a=I.useRef();e!==a.current&&(s.current=!0,a.current=e);const i=Zt({queryKey:Zp({formId:e,conversationId:t,inboxIds:n}),queryFn:async()=>{const l=await SI({formId:e,conversationId:t,inboxIds:n});return s.current=!1,l},refetchOnMount:o,enabled:s.current&&!!e&&!!t&&Wp(n)&&r,staleTime:0}),c=I.useMemo(()=>{if(Object.keys(i.data??{}).length===0&&i.isSuccess)return!0},[i.data,i.isSuccess]);return{enabledRef:s,isNudgeRequired:c,...i}},AI=async({formId:e,data:t})=>{try{return await ve({url:rt(ip,{formId:e}),data:{defaults:t},method:Oe.PUT}),{formId:e,data:t}}catch(n){throw console.error(n),n}},TI=({formId:e,conversationId:t,inboxIds:n,onSuccess:r,onError:o})=>{const s=Zr();return Xt({mutationFn:a=>AI({formId:e,data:a}),onSuccess:a=>{s.invalidateQueries({queryKey:Hp({formId:e})}),s.invalidateQueries({queryKey:Zp({formId:e,conversationId:t,inboxIds:n})}),r==null||r(a),Se({message:"Form defaults updated successfully",type:Ut})},onError:()=>{o==null||o(),Se({message:"Failed to update form defaults",type:qe})}})},LI=({open:e,isEdit:t,formId:n,fields:r,connectorLogo:o,variables:s,customFormArgsEnabled:a,customFormArgsMap:i,title:c="Pre-fill fields",isLoading:l=!1,onSuccess:f,onClose:g})=>{const[y,C]=I.useState({}),{conversationId:b,currentSmIds:h}=I.useContext(He),{data:p}=O6({formId:n,formData:y,argsMap:i??{},enabled:!!n&&!!a,delay:500}),{data:m,isLoading:x,enabledRef:v}=_I({formId:n,enabled:!t&&!!e&&!!n}),{mutate:w,isPending:E}=TI({formId:n,conversationId:b,inboxIds:h,onSuccess:N=>{v.current=!0,f==null||f(N)}}),_=I.useMemo(()=>p!=null&&p.length?[...r,...p]:r,[r,p]);I.useEffect(()=>{m&&C(m)},[m]);const A=N=>{const D=_.map(M=>({name:M.name,type:M.isMultiSelect?"multi-select":M.type})),k=H6(N,D);w(k)},S=async({args:N,pagination:D},{formId:k,fieldName:M})=>{const j=await op({formId:k,fieldName:M},{pagination:D,args:N}),G=Array.isArray(j==null?void 0:j.data.data)?j.data.data:[];return{options:G,hasMore:!!G.length}},L=N=>{const D=nf(N.value)?N.value.value:N.value,k=D&&N.type==="multi-select"?[D]:D;C(M=>({...M,[N.name]:k}))};return d.jsx(Yv,{open:e,defaultValues:m,formId:n,fields:_,connectorLogo:o,variables:s,title:`Pre-fill fields for ${c}`,isLoading:l||x,isSaving:E,fetchOptions:S,onSave:A,onClose:()=>g==null?void 0:g(),onCancel:()=>g==null?void 0:g(),onFieldChange:L})},OI=async({formId:e,args:t})=>{try{const n=await ve({url:rt(xE,{formId:e}),data:{args:t},method:Oe.POST});return(n==null?void 0:n.data).fieldList.map(o=>ll(o))}catch(n){throw console.error(n),n}},FI=({formId:e,args:t,enabled:n,delay:r=500})=>{const[o,s]=I.useState(t);return I.useEffect(()=>{const a=setTimeout(()=>s(t),r);return()=>clearTimeout(a)},[t,r]),Zt({queryKey:["Global","WriteForm","CustomFields",e,o],queryFn:()=>OI({formId:e,args:t}),refetchOnMount:!1,enabled:n})},zp="connector-agent_auto_fill_nudge",kI=u.styled(u.Stack)`
1397
1397
  gap: 12px;
1398
1398
  align-items: stretch;
1399
1399
  border: 1px solid #e0bce8;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiver/connector-agent",
3
- "version": "4.12.0-oneClickAuto-beta.2",
3
+ "version": "4.12.0-oneClickAuto-beta.3",
4
4
  "main": "index.es.js",
5
5
  "module": "index.es.js",
6
6
  "types": "index.d.ts",