var g=Object.defineProperty;var c=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var m=(a,t,e)=>t in a?g(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,l=(a,t)=>{for(var e in t||(t={}))h.call(t,e)&&m(a,e,t[e]);if(c)for(var e of c(t))F.call(t,e)&&m(a,e,t[e]);return a};import{b as f,_ as r}from"./main.2.8.10.js";import{u as _}from"./Note.DalStCGz.js";const q=(a,t,e,n,i,o,s,d,b)=>{const u=l({},t);u[a.target.name]=a.target.value,e(l({},u))},B=(a,t,e,n,i)=>{n(!0);const o={formID:a,password:t.password,userName:t.userName};f(o,"fluent_support_get_all_support_staff").then(s=>{if(s&&s.success){const d=l({},t);d.default||(d.default={}),s.data&&(d.default.agents=s.data),i({show:!0,msg:r("Support Staff refreshed","bit-integrations")}),e(l({},d))}else i({show:!0,msg:r("Support Staff refresh failed. please try again","bit-integrations")});n(!1)}).catch(()=>n(!1))},N=(a,t,e,n)=>{e(!0),f(null,"fluent_support_get_custom_fields").then(i=>{t(o=>_(o,s=>{i&&i.success&&i.data?(s.fluentSupportFields=[...s.basicFields,...i.data],s.field_map=p([...s.basicFields,...i.data]),i.data.length>0?n({show:!0,msg:r("Custom Ticket Fields refreshed","bit-integrations")}):n({show:!0,msg:r("Custom Ticket Fields not found!","bit-integrations")})):(s.fluentSupportFields=s.basicFields,s.field_map=p(s.basicFields),n({show:!0,msg:(i==null?void 0:i.data)||r("Custom Ticket Fields failed. please try again","bit-integrations")}))})),e(!1)}).catch(()=>e(!1))},S=(a,t,e,n,i)=>{n(!0),f("","fluent_support_get_all_business_inboxes").then(o=>{if(o&&o.success){const s=l({},t);s.default||(s.default={}),o.data&&(s.default.businessInboxes=o.data),i({show:!0,msg:r("Business Inboxes refreshed","bit-integrations")}),e(l({},s))}else i({show:!0,msg:r("Business Inboxes refresh failed. please try again","bit-integrations")});n(!1)}).catch(()=>n(!1))},p=a=>{const t=a.filter(e=>e.required===!0);return t.length>0?t.map(e=>({formField:"",fluentSupportFormField:e.key})):[{formField:"",fluentSupportFormField:""}]},T=a=>!((a!=null&&a.field_map?a.field_map.filter(e=>!e.formField||!e.fluentSupportFormField||!e.formField==="custom"&&!e.customValue):[]).length>0),$=(a,t,e,n,i,o)=>{e({}),i(!0),f(null,"fluentSupport_authorization").then(s=>s).then(s=>{if(s&&s.success){const d=l({},a);t(d),n(!0),o({show:!0,msg:r("Connected Successfully","bit-integrations")})}else s&&s.data&&s.data.data||!s.success&&typeof s.data=="string"?o({show:!0,msg:`${r("Cunnection failed Cause:","bit-integrations")}${s.data.data||s.data}. ${r("please try again","bit-integrations")}`}):o({show:!0,msg:r("Cunnection failed. please try again","bit-integrations")});i(!1)})};export{N as a,$ as b,T as c,S as g,q as h,B as s};
