ed-widget 1.47.5 → 1.47.6
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/dist/ed-widget.js +1 -1
- package/npm/ed-widget.js +1 -1
- package/package.json +1 -1
package/dist/ed-widget.js
CHANGED
|
@@ -772,7 +772,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
772
772
|
id
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function b0(t,e){if(t.kind==="FragmentSpread")e.add(t.name.value);else if(t.kind==="VariableDefinition"){var n=t.type;n.kind==="NamedType"&&e.add(n.name.value)}t.selectionSet&&t.selectionSet.selections.forEach(function(i){b0(i,e)}),t.variableDefinitions&&t.variableDefinitions.forEach(function(i){b0(i,e)}),t.definitions&&t.definitions.forEach(function(i){b0(i,e)})}var Ix={};(function(){jx.definitions.forEach(function(e){if(e.name){var n=new Set;b0(e,n),Ix[e.name.value]=n}})})();function pM(t,e){for(var n=0;n<t.definitions.length;n++){var i=t.definitions[n];if(i.name&&i.name.value==e)return i}}function SZ(t,e){var n={kind:t.kind,definitions:[pM(t,e)]};t.hasOwnProperty("loc")&&(n.loc=t.loc);var i=Ix[e]||new Set,o=new Set,s=new Set;for(i.forEach(function(f){s.add(f)});s.size>0;){var u=s;s=new Set,u.forEach(function(f){if(!o.has(f)){o.add(f);var m=Ix[f]||new Set;m.forEach(function(p){s.add(p)})}})}return o.forEach(function(f){var m=pM(t,f);m&&n.definitions.push(m)}),n}const EZ=SZ(jx,"CREATE_OR_UPDATE_A_CONVERSATION_ACTIVITY_REALTIME_STATUS"),CZ=()=>{const[t]=Zl(EZ);return{handleCreateOrUpdateRealtimeStatus:async(n,i=()=>{})=>{try{const{data:o}=await t({variables:{inputData:n}});i(o==null?void 0:o.createOrUpdateAConversationActivityRealtimeStatus)}catch(o){console.error(o)}}}},xZ=["image/jpeg","image/png","application/pdf"],wZ=({conversationId:t,handleCreateMessage:e})=>{const n=U.useRef(null),i=U.useRef(null),o=U.useRef(null),[s,u]=U.useState(""),[f,m]=U.useState([]),[p,g]=U.useState(!1),{handleCreateOrUpdateRealtimeStatus:y}=CZ(),E=async A=>{var ae;const D=A==null?void 0:A.name,j=(ae=D==null?void 0:D.split)==null?void 0:ae.call(D,"."),q=pt.last(j),G=`${h2()}.${q}`,ie=await _2({name:G,sub_type:t,type:"conversation_activity_attachment"});return ie!=null&&ie.url?{name:G,file:A,title:D,policy:ie}:(zr("error",`${D} cannot be uploaded`,"top-left"),null)},b=async A=>{A.preventDefault();const D=5*1024*1024,j=Array.from(A.target.files);let q="";if(pt.forEach(j,G=>{if(!xZ.includes(G.type)){q=`${G.name} is not supported. `;return}if(G.size>D){q="Each file must be under 5MB";return}}),q){zr("error",q,"top-left");return}try{const G=[];for(let ae=0;ae<j.length;ae+=1)G.push(E(j[ae]));const ie=await Promise.all(G);m(ae=>[...ae,...ie.filter(oe=>oe!==null)])}catch(G){console.error("Error occurred while fetching policies:",G)}o.current.value=null},w=A=>{m(D=>D.filter((j,q)=>q!==A)),o.current&&(o.current.value="")};U.useEffect(()=>{const A=n.current,D=i.current;if(A&&D){A.style.height="auto";const q=D.offsetWidth*.5,G=Math.min(A.scrollHeight,q);A.style.height=`${G}px`,D.style.height=`${G+16}px`,A.style.overflowY=A.scrollHeight>q?"auto":"hidden"}},[s,f]);const T=f.slice(0,5),_=Math.max(0,f.length-5),L=async A=>{if(A&&A.preventDefault(),!(!s&&!f.length)){g(!0);try{const D=pt.size(f)&&await gZ(f,t);await e({message:s,is_customer_reply:!0,...D&&{files:D}}),u(""),m([]),setTimeout(()=>{n.current&&n.current.focus()},150)}catch(D){console.error("Error sending message:",D)}finally{g(!1)}}},N=U.useMemo(()=>!Hz(s)&&!pt.size(f)||p,[s,f,p]),I=async A=>{A?await y({conversation_id:t,is_writing_reply:!0}):await y({conversation_id:t,is_writing_reply:!1})},M=A=>{A.key==="Enter"&&!A.shiftKey&&!p&&!N&&(A.preventDefault(),L(A))};return R.jsxs(R.Fragment,{children:[f.length>0&&R.jsxs("div",{className:"ed-flex ed-flex-wrap ed-items-center ed-gap-2 ed-mb-2",children:[T.map((A,D)=>R.jsxs("div",{className:"ed-flex ed-items-center ed-gap-2 ed-text-12 ed-font-medium ed-text-border-regular ed-bg-white-light ed-p-1.5 ed-rounded-full",children:[R.jsx("span",{className:"ed-truncate ed-max-w-[100px]",children:A.name}),R.jsx("button",{type:"button",onClick:()=>w(D),className:"ed-text-border hover:ed-text-border-dark ed-flex-shrink-0",children:R.jsx(ms,{size:14})})]},A)),_>0&&R.jsxs("span",{className:"ed-text-12 ed-text-border-regular",children:["+",_," ",_===1?"item":"items"]})]}),R.jsxs("div",{ref:i,className:"ed-border ed-border-border-light ed-rounded-3xl ed-flex ed-justify-between ed-transition-all ed-duration-200",style:{padding:"8px 16px"},children:[R.jsx("div",{className:"ed-flex-1 ed-flex ed-flex-col ed-min-w-0",children:R.jsx("textarea",{ref:n,value:s,onBlur:()=>I(!1),onChange:A=>u(A.target.value),onFocus:()=>I(!0),onKeyDown:A=>M(A),rows:1,className:"ed-w-full ed-text-14 ed-min-h-[24px] ed-resize-none ed-overflow-x-auto ed-outline-none ed-bg-transparent ed-no-scrollbar",placeholder:"Enter your message",disabled:p})}),R.jsxs("div",{className:"ed-flex ed-items-center ed-gap-2.5 ed-ml-2 ed-flex-shrink-0",children:[R.jsx("input",{type:"file",ref:o,onChange:b,className:"ed-hidden",accept:".pdf, .png, .jpeg, .jpg",multiple:!0,disabled:p}),R.jsx(cM,{content:R.jsx("p",{className:"ed-text-12 ed-text-center ed-font-medium ed-text-regular",children:"Supported file types: jpg, png, pdf (max 5MB)"}),children:R.jsx("button",{type:"button",onClick:()=>{var A;return(A=o.current)==null?void 0:A.click()},className:"ed-text-border hover:ed-text-border-dark",children:R.jsx(UC,{className:"ed-size-5 ed-cursor-pointer ed-mt-2"})})}),R.jsx("button",{onClick:L,type:"button",disabled:N,children:p?R.jsx(al,{className:"ed-size-5"}):R.jsx(YC,{className:`${N?"ed-text-border":"ed-text-brand"} ed-size-5`})})]})]})]})};var Fx={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GET_CHANNELS_FOR_PORTAL"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getChannelsForPortal"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"data"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:100}};Fx.loc.source={body:`query GET_CHANNELS_FOR_PORTAL {
|
|
775
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function b0(t,e){if(t.kind==="FragmentSpread")e.add(t.name.value);else if(t.kind==="VariableDefinition"){var n=t.type;n.kind==="NamedType"&&e.add(n.name.value)}t.selectionSet&&t.selectionSet.selections.forEach(function(i){b0(i,e)}),t.variableDefinitions&&t.variableDefinitions.forEach(function(i){b0(i,e)}),t.definitions&&t.definitions.forEach(function(i){b0(i,e)})}var Ix={};(function(){jx.definitions.forEach(function(e){if(e.name){var n=new Set;b0(e,n),Ix[e.name.value]=n}})})();function pM(t,e){for(var n=0;n<t.definitions.length;n++){var i=t.definitions[n];if(i.name&&i.name.value==e)return i}}function SZ(t,e){var n={kind:t.kind,definitions:[pM(t,e)]};t.hasOwnProperty("loc")&&(n.loc=t.loc);var i=Ix[e]||new Set,o=new Set,s=new Set;for(i.forEach(function(f){s.add(f)});s.size>0;){var u=s;s=new Set,u.forEach(function(f){if(!o.has(f)){o.add(f);var m=Ix[f]||new Set;m.forEach(function(p){s.add(p)})}})}return o.forEach(function(f){var m=pM(t,f);m&&n.definitions.push(m)}),n}const EZ=SZ(jx,"CREATE_OR_UPDATE_A_CONVERSATION_ACTIVITY_REALTIME_STATUS"),CZ=()=>{const[t]=Zl(EZ);return{handleCreateOrUpdateRealtimeStatus:async(n,i=()=>{})=>{try{const{data:o}=await t({variables:{inputData:n}});i(o==null?void 0:o.createOrUpdateAConversationActivityRealtimeStatus)}catch(o){console.error(o)}}}},xZ=["image/jpeg","image/png","application/pdf"],wZ=({conversationId:t,handleCreateMessage:e})=>{const n=U.useRef(null),i=U.useRef(null),o=U.useRef(null),[s,u]=U.useState(""),[f,m]=U.useState([]),[p,g]=U.useState(!1),{handleCreateOrUpdateRealtimeStatus:y}=CZ(),E=async A=>{var ae;const D=A==null?void 0:A.name,j=(ae=D==null?void 0:D.split)==null?void 0:ae.call(D,"."),q=pt.last(j),G=`${h2()}.${q}`,ie=await _2({name:G,sub_type:t,type:"conversation_activity_attachment"});return ie!=null&&ie.url?{name:G,file:A,title:D,policy:ie}:(zr("error",`${D} cannot be uploaded`,"top-left"),null)},b=async A=>{A.preventDefault();const D=5*1024*1024,j=Array.from(A.target.files);let q="";if(pt.forEach(j,G=>{if(!xZ.includes(G.type)){q=`${G.name} is not supported. `;return}if(G.size>D){q="Each file must be under 5MB";return}}),q){zr("error",q,"top-left");return}try{const G=[];for(let ae=0;ae<j.length;ae+=1)G.push(E(j[ae]));const ie=await Promise.all(G);m(ae=>[...ae,...ie.filter(oe=>oe!==null)])}catch(G){console.error("Error occurred while fetching policies:",G)}o.current.value=null},w=A=>{m(D=>D.filter((j,q)=>q!==A)),o.current&&(o.current.value="")};U.useEffect(()=>{const A=n.current,D=i.current;if(A&&D){A.style.height="auto";const q=D.offsetWidth*.5,G=Math.min(A.scrollHeight,q);A.style.height=`${G}px`,D.style.height=`${G+16}px`,A.style.overflowY=A.scrollHeight>q?"auto":"hidden"}},[s,f]);const T=f.slice(0,5),_=Math.max(0,f.length-5),L=async A=>{if(A&&A.preventDefault(),!(!s&&!f.length)){g(!0);try{const D=pt.size(f)&&await gZ(f,t);await e({message:s,is_customer_reply:!0,...D&&{files:D}}),u(""),m([]),setTimeout(()=>{n.current&&n.current.focus()},150)}catch(D){console.error("Error sending message:",D)}finally{g(!1)}}},N=U.useMemo(()=>!Hz(s)&&!pt.size(f)||p,[s,f,p]),I=async A=>{A?await y({conversation_id:t,is_writing_reply:!0}):await y({conversation_id:t,is_writing_reply:!1})},M=A=>{A.key==="Enter"&&!A.shiftKey&&!p&&!N&&(A.preventDefault(),L(A))};return R.jsxs(R.Fragment,{children:[f.length>0&&R.jsxs("div",{className:"ed-flex ed-flex-wrap ed-items-center ed-gap-2 ed-mb-2",children:[T.map((A,D)=>R.jsxs("div",{className:"ed-flex ed-items-center ed-gap-2 ed-text-12 ed-font-medium ed-text-border-regular ed-bg-white-light ed-p-1.5 ed-rounded-full",children:[R.jsx("span",{className:"ed-truncate ed-max-w-[100px]",children:A.name}),R.jsx("button",{type:"button",onClick:()=>w(D),className:"ed-text-border hover:ed-text-border-dark ed-flex-shrink-0",children:R.jsx(ms,{size:14})})]},A)),_>0&&R.jsxs("span",{className:"ed-text-12 ed-text-border-regular",children:["+",_," ",_===1?"item":"items"]})]}),R.jsxs("div",{ref:i,className:"ed-border ed-border-border-light ed-rounded-3xl ed-flex ed-justify-between ed-transition-all ed-duration-200",style:{padding:"8px 16px",border:"1px solid #D8E0ED",borderRadius:"24px"},children:[R.jsx("div",{className:"ed-flex-1 ed-flex ed-flex-col ed-min-w-0",children:R.jsx("textarea",{ref:n,value:s,onBlur:()=>I(!1),onChange:A=>u(A.target.value),onFocus:()=>I(!0),onKeyDown:A=>M(A),rows:1,className:"ed-w-full ed-text-14 ed-min-h-[24px] ed-resize-none ed-overflow-x-auto ed-outline-none ed-bg-transparent ed-no-scrollbar",placeholder:"Enter your message",disabled:p,style:{border:"none",outline:"none",fontSize:"14px",fontFamily:"inherit",color:"inherit",lineHeight:"1.5",padding:0,margin:0}})}),R.jsxs("div",{className:"ed-flex ed-items-center ed-gap-2.5 ed-ml-2 ed-flex-shrink-0",children:[R.jsx("input",{type:"file",ref:o,onChange:b,className:"ed-hidden",accept:".pdf, .png, .jpeg, .jpg",multiple:!0,disabled:p}),R.jsx(cM,{content:R.jsx("p",{className:"ed-text-12 ed-text-center ed-font-medium ed-text-regular",children:"Supported file types: jpg, png, pdf (max 5MB)"}),children:R.jsx("button",{type:"button",onClick:()=>{var A;return(A=o.current)==null?void 0:A.click()},className:"ed-text-border hover:ed-text-border-dark",children:R.jsx(UC,{className:"ed-size-5 ed-cursor-pointer ed-mt-2"})})}),R.jsx("button",{onClick:L,type:"button",disabled:N,children:p?R.jsx(al,{className:"ed-size-5"}):R.jsx(YC,{className:`${N?"ed-text-border":"ed-text-brand"} ed-size-5`})})]})]})]})};var Fx={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GET_CHANNELS_FOR_PORTAL"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getChannelsForPortal"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"data"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:100}};Fx.loc.source={body:`query GET_CHANNELS_FOR_PORTAL {
|
|
776
776
|
getChannelsForPortal {
|
|
777
777
|
data {
|
|
778
778
|
id
|
package/npm/ed-widget.js
CHANGED
|
@@ -571,7 +571,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
571
571
|
id
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function wc(t,e){if(t.kind==="FragmentSpread")e.add(t.name.value);else if(t.kind==="VariableDefinition"){var n=t.type;n.kind==="NamedType"&&e.add(n.name.value)}t.selectionSet&&t.selectionSet.selections.forEach(function(r){wc(r,e)}),t.variableDefinitions&&t.variableDefinitions.forEach(function(r){wc(r,e)}),t.definitions&&t.definitions.forEach(function(r){wc(r,e)})}var Dp={};(function(){Fp.definitions.forEach(function(e){if(e.name){var n=new Set;wc(e,n),Dp[e.name.value]=n}})})();function Z8(t,e){for(var n=0;n<t.definitions.length;n++){var r=t.definitions[n];if(r.name&&r.name.value==e)return r}}function dI(t,e){var n={kind:t.kind,definitions:[Z8(t,e)]};t.hasOwnProperty("loc")&&(n.loc=t.loc);var r=Dp[e]||new Set,i=new Set,o=new Set;for(r.forEach(function(l){o.add(l)});o.size>0;){var s=o;o=new Set,s.forEach(function(l){if(!i.has(l)){i.add(l);var u=Dp[l]||new Set;u.forEach(function(f){o.add(f)})}})}return i.forEach(function(l){var u=Z8(t,l);u&&n.definitions.push(u)}),n}const hI=dI(Fp,"CREATE_OR_UPDATE_A_CONVERSATION_ACTIVITY_REALTIME_STATUS"),pI=()=>{const[t]=Nr(hI);return{handleCreateOrUpdateRealtimeStatus:async(n,r=()=>{})=>{try{const{data:i}=await t({variables:{inputData:n}});r(i==null?void 0:i.createOrUpdateAConversationActivityRealtimeStatus)}catch(i){console.error(i)}}}},mI=["image/jpeg","image/png","application/pdf"],gI=({conversationId:t,handleCreateMessage:e})=>{const n=N.useRef(null),r=N.useRef(null),i=N.useRef(null),[o,s]=N.useState(""),[l,u]=N.useState([]),[f,d]=N.useState(!1),{handleCreateOrUpdateRealtimeStatus:p}=pI(),g=async E=>{var H;const k=E==null?void 0:E.name,T=(H=k==null?void 0:k.split)==null?void 0:H.call(k,"."),I=Ee.last(T),j=`${ph()}.${I}`,z=await kh({name:j,sub_type:t,type:"conversation_activity_attachment"});return z!=null&&z.url?{name:j,file:E,title:k,policy:z}:(Tt("error",`${k} cannot be uploaded`,"top-left"),null)},m=async E=>{E.preventDefault();const k=5*1024*1024,T=Array.from(E.target.files);let I="";if(Ee.forEach(T,j=>{if(!mI.includes(j.type)){I=`${j.name} is not supported. `;return}if(j.size>k){I="Each file must be under 5MB";return}}),I){Tt("error",I,"top-left");return}try{const j=[];for(let H=0;H<T.length;H+=1)j.push(g(T[H]));const z=await Promise.all(j);u(H=>[...H,...z.filter(Y=>Y!==null)])}catch(j){console.error("Error occurred while fetching policies:",j)}i.current.value=null},b=E=>{u(k=>k.filter((T,I)=>I!==E)),i.current&&(i.current.value="")};N.useEffect(()=>{const E=n.current,k=r.current;if(E&&k){E.style.height="auto";const I=k.offsetWidth*.5,j=Math.min(E.scrollHeight,I);E.style.height=`${j}px`,k.style.height=`${j+16}px`,E.style.overflowY=E.scrollHeight>I?"auto":"hidden"}},[o,l]);const S=l.slice(0,5),y=Math.max(0,l.length-5),w=async E=>{if(E&&E.preventDefault(),!(!o&&!l.length)){d(!0);try{const k=Ee.size(l)&&await cI(l,t);await e({message:o,is_customer_reply:!0,...k&&{files:k}}),s(""),u([]),setTimeout(()=>{n.current&&n.current.focus()},150)}catch(k){console.error("Error sending message:",k)}finally{d(!1)}}},_=N.useMemo(()=>!jw(o)&&!Ee.size(l)||f,[o,l,f]),O=async E=>{E?await p({conversation_id:t,is_writing_reply:!0}):await p({conversation_id:t,is_writing_reply:!1})},C=E=>{E.key==="Enter"&&!E.shiftKey&&!f&&!_&&(E.preventDefault(),w(E))};return v.jsxs(v.Fragment,{children:[l.length>0&&v.jsxs("div",{className:"ed-flex ed-flex-wrap ed-items-center ed-gap-2 ed-mb-2",children:[S.map((E,k)=>v.jsxs("div",{className:"ed-flex ed-items-center ed-gap-2 ed-text-12 ed-font-medium ed-text-border-regular ed-bg-white-light ed-p-1.5 ed-rounded-full",children:[v.jsx("span",{className:"ed-truncate ed-max-w-[100px]",children:E.name}),v.jsx("button",{type:"button",onClick:()=>b(k),className:"ed-text-border hover:ed-text-border-dark ed-flex-shrink-0",children:v.jsx(Qn,{size:14})})]},E)),y>0&&v.jsxs("span",{className:"ed-text-12 ed-text-border-regular",children:["+",y," ",y===1?"item":"items"]})]}),v.jsxs("div",{ref:r,className:"ed-border ed-border-border-light ed-rounded-3xl ed-flex ed-justify-between ed-transition-all ed-duration-200",style:{padding:"8px 16px"},children:[v.jsx("div",{className:"ed-flex-1 ed-flex ed-flex-col ed-min-w-0",children:v.jsx("textarea",{ref:n,value:o,onBlur:()=>O(!1),onChange:E=>s(E.target.value),onFocus:()=>O(!0),onKeyDown:E=>C(E),rows:1,className:"ed-w-full ed-text-14 ed-min-h-[24px] ed-resize-none ed-overflow-x-auto ed-outline-none ed-bg-transparent ed-no-scrollbar",placeholder:"Enter your message",disabled:f})}),v.jsxs("div",{className:"ed-flex ed-items-center ed-gap-2.5 ed-ml-2 ed-flex-shrink-0",children:[v.jsx("input",{type:"file",ref:i,onChange:m,className:"ed-hidden",accept:".pdf, .png, .jpeg, .jpg",multiple:!0,disabled:f}),v.jsx(H8,{content:v.jsx("p",{className:"ed-text-12 ed-text-center ed-font-medium ed-text-regular",children:"Supported file types: jpg, png, pdf (max 5MB)"}),children:v.jsx("button",{type:"button",onClick:()=>{var E;return(E=i.current)==null?void 0:E.click()},className:"ed-text-border hover:ed-text-border-dark",children:v.jsx(Bd,{className:"ed-size-5 ed-cursor-pointer ed-mt-2"})})}),v.jsx("button",{onClick:w,type:"button",disabled:_,children:f?v.jsx(hr,{className:"ed-size-5"}):v.jsx(Zd,{className:`${_?"ed-text-border":"ed-text-brand"} ed-size-5`})})]})]})]})};var Vp={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GET_CHANNELS_FOR_PORTAL"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getChannelsForPortal"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"data"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:100}};Vp.loc.source={body:`query GET_CHANNELS_FOR_PORTAL {
|
|
574
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function wc(t,e){if(t.kind==="FragmentSpread")e.add(t.name.value);else if(t.kind==="VariableDefinition"){var n=t.type;n.kind==="NamedType"&&e.add(n.name.value)}t.selectionSet&&t.selectionSet.selections.forEach(function(r){wc(r,e)}),t.variableDefinitions&&t.variableDefinitions.forEach(function(r){wc(r,e)}),t.definitions&&t.definitions.forEach(function(r){wc(r,e)})}var Dp={};(function(){Fp.definitions.forEach(function(e){if(e.name){var n=new Set;wc(e,n),Dp[e.name.value]=n}})})();function Z8(t,e){for(var n=0;n<t.definitions.length;n++){var r=t.definitions[n];if(r.name&&r.name.value==e)return r}}function dI(t,e){var n={kind:t.kind,definitions:[Z8(t,e)]};t.hasOwnProperty("loc")&&(n.loc=t.loc);var r=Dp[e]||new Set,i=new Set,o=new Set;for(r.forEach(function(l){o.add(l)});o.size>0;){var s=o;o=new Set,s.forEach(function(l){if(!i.has(l)){i.add(l);var u=Dp[l]||new Set;u.forEach(function(f){o.add(f)})}})}return i.forEach(function(l){var u=Z8(t,l);u&&n.definitions.push(u)}),n}const hI=dI(Fp,"CREATE_OR_UPDATE_A_CONVERSATION_ACTIVITY_REALTIME_STATUS"),pI=()=>{const[t]=Nr(hI);return{handleCreateOrUpdateRealtimeStatus:async(n,r=()=>{})=>{try{const{data:i}=await t({variables:{inputData:n}});r(i==null?void 0:i.createOrUpdateAConversationActivityRealtimeStatus)}catch(i){console.error(i)}}}},mI=["image/jpeg","image/png","application/pdf"],gI=({conversationId:t,handleCreateMessage:e})=>{const n=N.useRef(null),r=N.useRef(null),i=N.useRef(null),[o,s]=N.useState(""),[l,u]=N.useState([]),[f,d]=N.useState(!1),{handleCreateOrUpdateRealtimeStatus:p}=pI(),g=async E=>{var H;const k=E==null?void 0:E.name,T=(H=k==null?void 0:k.split)==null?void 0:H.call(k,"."),I=Ee.last(T),j=`${ph()}.${I}`,z=await kh({name:j,sub_type:t,type:"conversation_activity_attachment"});return z!=null&&z.url?{name:j,file:E,title:k,policy:z}:(Tt("error",`${k} cannot be uploaded`,"top-left"),null)},m=async E=>{E.preventDefault();const k=5*1024*1024,T=Array.from(E.target.files);let I="";if(Ee.forEach(T,j=>{if(!mI.includes(j.type)){I=`${j.name} is not supported. `;return}if(j.size>k){I="Each file must be under 5MB";return}}),I){Tt("error",I,"top-left");return}try{const j=[];for(let H=0;H<T.length;H+=1)j.push(g(T[H]));const z=await Promise.all(j);u(H=>[...H,...z.filter(Y=>Y!==null)])}catch(j){console.error("Error occurred while fetching policies:",j)}i.current.value=null},b=E=>{u(k=>k.filter((T,I)=>I!==E)),i.current&&(i.current.value="")};N.useEffect(()=>{const E=n.current,k=r.current;if(E&&k){E.style.height="auto";const I=k.offsetWidth*.5,j=Math.min(E.scrollHeight,I);E.style.height=`${j}px`,k.style.height=`${j+16}px`,E.style.overflowY=E.scrollHeight>I?"auto":"hidden"}},[o,l]);const S=l.slice(0,5),y=Math.max(0,l.length-5),w=async E=>{if(E&&E.preventDefault(),!(!o&&!l.length)){d(!0);try{const k=Ee.size(l)&&await cI(l,t);await e({message:o,is_customer_reply:!0,...k&&{files:k}}),s(""),u([]),setTimeout(()=>{n.current&&n.current.focus()},150)}catch(k){console.error("Error sending message:",k)}finally{d(!1)}}},_=N.useMemo(()=>!jw(o)&&!Ee.size(l)||f,[o,l,f]),O=async E=>{E?await p({conversation_id:t,is_writing_reply:!0}):await p({conversation_id:t,is_writing_reply:!1})},C=E=>{E.key==="Enter"&&!E.shiftKey&&!f&&!_&&(E.preventDefault(),w(E))};return v.jsxs(v.Fragment,{children:[l.length>0&&v.jsxs("div",{className:"ed-flex ed-flex-wrap ed-items-center ed-gap-2 ed-mb-2",children:[S.map((E,k)=>v.jsxs("div",{className:"ed-flex ed-items-center ed-gap-2 ed-text-12 ed-font-medium ed-text-border-regular ed-bg-white-light ed-p-1.5 ed-rounded-full",children:[v.jsx("span",{className:"ed-truncate ed-max-w-[100px]",children:E.name}),v.jsx("button",{type:"button",onClick:()=>b(k),className:"ed-text-border hover:ed-text-border-dark ed-flex-shrink-0",children:v.jsx(Qn,{size:14})})]},E)),y>0&&v.jsxs("span",{className:"ed-text-12 ed-text-border-regular",children:["+",y," ",y===1?"item":"items"]})]}),v.jsxs("div",{ref:r,className:"ed-border ed-border-border-light ed-rounded-3xl ed-flex ed-justify-between ed-transition-all ed-duration-200",style:{padding:"8px 16px",border:"1px solid #D8E0ED",borderRadius:"24px"},children:[v.jsx("div",{className:"ed-flex-1 ed-flex ed-flex-col ed-min-w-0",children:v.jsx("textarea",{ref:n,value:o,onBlur:()=>O(!1),onChange:E=>s(E.target.value),onFocus:()=>O(!0),onKeyDown:E=>C(E),rows:1,className:"ed-w-full ed-text-14 ed-min-h-[24px] ed-resize-none ed-overflow-x-auto ed-outline-none ed-bg-transparent ed-no-scrollbar",placeholder:"Enter your message",disabled:f,style:{border:"none",outline:"none",fontSize:"14px",fontFamily:"inherit",color:"inherit",lineHeight:"1.5",padding:0,margin:0}})}),v.jsxs("div",{className:"ed-flex ed-items-center ed-gap-2.5 ed-ml-2 ed-flex-shrink-0",children:[v.jsx("input",{type:"file",ref:i,onChange:m,className:"ed-hidden",accept:".pdf, .png, .jpeg, .jpg",multiple:!0,disabled:f}),v.jsx(H8,{content:v.jsx("p",{className:"ed-text-12 ed-text-center ed-font-medium ed-text-regular",children:"Supported file types: jpg, png, pdf (max 5MB)"}),children:v.jsx("button",{type:"button",onClick:()=>{var E;return(E=i.current)==null?void 0:E.click()},className:"ed-text-border hover:ed-text-border-dark",children:v.jsx(Bd,{className:"ed-size-5 ed-cursor-pointer ed-mt-2"})})}),v.jsx("button",{onClick:w,type:"button",disabled:_,children:f?v.jsx(hr,{className:"ed-size-5"}):v.jsx(Zd,{className:`${_?"ed-text-border":"ed-text-brand"} ed-size-5`})})]})]})]})};var Vp={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GET_CHANNELS_FOR_PORTAL"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getChannelsForPortal"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"data"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:100}};Vp.loc.source={body:`query GET_CHANNELS_FOR_PORTAL {
|
|
575
575
|
getChannelsForPortal {
|
|
576
576
|
data {
|
|
577
577
|
id
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ed-widget",
|
|
3
3
|
"description": "A flexible and lightweight EasyDesk chat widget for React apps and websites. Supports both React integration and CDN-based embedding for fast, real-time customer support.",
|
|
4
|
-
"version": "1.47.
|
|
4
|
+
"version": "1.47.6",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Gain Solutions AS",
|
|
7
7
|
"license": "MIT",
|