ed-widget 1.9.0 → 1.10.0
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
|
@@ -509,7 +509,7 @@ html body {
|
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function U0(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){U0(r,e)}),t.variableDefinitions&&t.variableDefinitions.forEach(function(r){U0(r,e)}),t.definitions&&t.definitions.forEach(function(r){U0(r,e)})}var uT={};(function(){sT.definitions.forEach(function(e){if(e.name){var n=new Set;U0(e,n),uT[e.name.value]=n}})})();function xN(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 IJ(t,e){var n={kind:t.kind,definitions:[xN(t,e)]};t.hasOwnProperty("loc")&&(n.loc=t.loc);var r=uT[e]||new Set,a=new Set,s=new Set;for(r.forEach(function(f){s.add(f)});s.size>0;){var u=s;s=new Set,u.forEach(function(f){if(!a.has(f)){a.add(f);var d=uT[f]||new Set;d.forEach(function(p){s.add(p)})}})}return a.forEach(function(f){var d=xN(t,f);d&&n.definitions.push(d)}),n}const FJ=IJ(sT,"CONVERSATION_ACTIVITY_REALTIME_STATUS_UPDATED"),jJ=({orgBrandSetting:t={}})=>{var O,L,R;const e=V.useRef(null),[n,r]=V.useState([]),[a,s]=V.useState(null),[u,f]=V.useState({messages:[],loadingActivities:!1,optionData:{limit:50,offset:0},isReplying:!1}),{handleCreateOrUpdateRealtimeStatus:d}=D7(),{handleDeleteARealtimeStatus:p}=BG(),m=ih.get("easydesk_chat_widget_conversation_id"),{brand:y}=t,[b,{loading:S}]=Kc(DJ,{errorPolicy:"all",fetchPolicy:"no-cache",onCompleted:D=>{const N=D==null?void 0:D.getConversationActivitiesForPortal;f(F=>{var z;return((z=F==null?void 0:F.optionData)==null?void 0:z.offset)===0?{...F,messages:N==null?void 0:N.data,metaData:N==null?void 0:N.meta_data}:{...F,messages:[...F.messages,...N.data],metaData:N==null?void 0:N.meta_data}})}}),[C]=Kc(PJ,{errorPolicy:"all",fetchPolicy:"no-cache",onCompleted:D=>{var N;r((N=D==null?void 0:D.getChannelsForPortal)==null?void 0:N.data)}}),[w]=Zc(MJ),x=async D=>{var N;try{const{data:F}=await w({variables:{inputData:{conversation_id:m,...D}}}),z=F==null?void 0:F.createAConversationActivityForPortal;z!=null&&z.id&&f(H=>({...H,messages:[...H.messages,z]}))}catch(F){const{message:z,response:H}=F;Zr("error",((N=H==null?void 0:H.data)==null?void 0:N.message)||z,"top-left")}};V.useEffect(()=>((m||a)&&(b({variables:{queryData:{conversation_id:a||m},optionData:{order:[["created_at","asc"]]}}}),d({conversation_id:a||m,is_viewing:!0})),()=>{p(a||m)}),[m||a]),V.useEffect(()=>{pn.size(u==null?void 0:u.messages)===3?C():r([])},[pn.size(u==null?void 0:u.messages)]);const T=((O=u==null?void 0:u.metaData)==null?void 0:O.filtered_rows)&&pn.size(u==null?void 0:u.messages)<((L=u==null?void 0:u.metaData)==null?void 0:L.filtered_rows),k=()=>{f(D=>({...D,loadingActivities:!0,optionData:{...D.optionData,offset:D.optionData.offset+D.optionData.limit}}))};return V.useEffect(()=>{const D=setTimeout(()=>{var z;const N=(z=e.current)==null?void 0:z.querySelectorAll(".single-message"),F=N==null?void 0:N[pn.size(N)-1];F==null||F.scrollIntoView({behavior:"smooth",block:"nearest"})},200);return()=>clearTimeout(D)},[pn.size(u==null?void 0:u.messages)]),Qz(FJ,{errorPolicy:"all",fetchPolicy:"no-cache",variables:{queryData:{conversation_id:a||m}},onData:({data:D})=>{var F;const N=(F=D==null?void 0:D.data)==null?void 0:F.conversationActivityRealtimeStatusUpdated;f(z=>({...z,isReplying:N==null?void 0:N.is_writing_reply,...conversation_activity&&{messages:[...z.messages,N==null?void 0:N.conversation_activity]}}))}}),S?j.jsx("div",{className:"ed-flex ed-justify-center ed-items-center ed-my-10",children:j.jsx(Hu,{})}):j.jsxs("div",{children:[j.jsx("div",{ref:e,id:"activities-scroll-target",className:"ed-flex ed-flex-col ed-pb-5 ed-space-y-5 ed-h-[calc(100vh-200px)] ed-overflow-y-auto no-scrollbar",children:j.jsx(A7,{dataLength:pn.size(u==null?void 0:u.messages),hasMore:T,loader:u!=null&&u.loadingActivities?"Loading...":"",scrollableTarget:"activities-scroll-target",inverse:!0,next:k,children:j.jsxs("div",{className:"ed-flex-1 ed-pt-3",children:[pn.size(u==null?void 0:u.messages)?(R=u==null?void 0:u.messages)==null?void 0:R.map(D=>j.jsx("div",{className:"single-message",children:j.jsx(M7,{author:y,filesData:D==null?void 0:D.files,isFromUser:D==null?void 0:D.is_customer_reply,message:om(D==null?void 0:D.message),timeStamp:qv(D==null?void 0:D.created_at).format("hh:mm A")})},D==null?void 0:D.id)):j.jsx(YG,{orgBrandSetting:t,setSelectedConversationId:s}),pn.size(n)>0&&j.jsx(WG,{channels:n,handleCreateMessage:x}),(u==null?void 0:u.isReplying)&&j.jsx("div",{className:"single-message",children:j.jsx(M7,{author:y,isFromUser:!1,isReplying:!0,timeStamp:qv().format("hh:mm A")})})]})})}),pn.size(u==null?void 0:u.messages)>=4&&j.jsx("div",{className:"ed-sticky ed-bottom-0 ed-bg-white ed-py-5 ed-border-y ed-border-border-light ed--mx-5 ed-px-5",children:j.jsx(AJ,{conversationId:m,handleCreateMessage:x})})]})};var z0={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GET_CATEGORIES"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"queryData"}},type:{kind:"NamedType",name:{kind:"Name",value:"CategoryQueryInput"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"optionData"}},type:{kind:"NamedType",name:{kind:"Name",value:"OptionDataType"}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getCategories"},arguments:[{kind:"Argument",name:{kind:"Name",value:"queryData"},value:{kind:"Variable",name:{kind:"Name",value:"queryData"}}},{kind:"Argument",name:{kind:"Name",value:"optionData"},value:{kind:"Variable",name:{kind:"Name",value:"optionData"}}}],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:[]},{kind:"Field",name:{kind:"Name",value:"total_faqs"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"total_sections"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"organization_brands"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"setting"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"color"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"icon"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"key"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]}]}}]}}]}},{kind:"Field",name:{kind:"Name",value:"icon"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"key"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"description"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"serial"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"total_articles"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"meta_data"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filtered_rows"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"total_rows"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:606}};z0.loc.source={body:`query GET_CATEGORIES($queryData: CategoryQueryInput, $optionData: OptionDataType) {
|
|
512
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function U0(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){U0(r,e)}),t.variableDefinitions&&t.variableDefinitions.forEach(function(r){U0(r,e)}),t.definitions&&t.definitions.forEach(function(r){U0(r,e)})}var uT={};(function(){sT.definitions.forEach(function(e){if(e.name){var n=new Set;U0(e,n),uT[e.name.value]=n}})})();function xN(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 IJ(t,e){var n={kind:t.kind,definitions:[xN(t,e)]};t.hasOwnProperty("loc")&&(n.loc=t.loc);var r=uT[e]||new Set,a=new Set,s=new Set;for(r.forEach(function(f){s.add(f)});s.size>0;){var u=s;s=new Set,u.forEach(function(f){if(!a.has(f)){a.add(f);var d=uT[f]||new Set;d.forEach(function(p){s.add(p)})}})}return a.forEach(function(f){var d=xN(t,f);d&&n.definitions.push(d)}),n}const FJ=IJ(sT,"CONVERSATION_ACTIVITY_REALTIME_STATUS_UPDATED"),jJ=({orgBrandSetting:t={}})=>{var O,L,R;const e=V.useRef(null),[n,r]=V.useState([]),[a,s]=V.useState(null),[u,f]=V.useState({messages:[],loadingActivities:!1,optionData:{limit:50,offset:0},isReplying:!1}),{handleCreateOrUpdateRealtimeStatus:d}=D7(),{handleDeleteARealtimeStatus:p}=BG(),m=ih.get("easydesk_chat_widget_conversation_id"),{brand:y}=t,[b,{loading:S}]=Kc(DJ,{errorPolicy:"all",fetchPolicy:"no-cache",onCompleted:D=>{const N=D==null?void 0:D.getConversationActivitiesForPortal;f(F=>{var z;return((z=F==null?void 0:F.optionData)==null?void 0:z.offset)===0?{...F,messages:N==null?void 0:N.data,metaData:N==null?void 0:N.meta_data}:{...F,messages:[...F.messages,...N.data],metaData:N==null?void 0:N.meta_data}})}}),[C]=Kc(PJ,{errorPolicy:"all",fetchPolicy:"no-cache",onCompleted:D=>{var N;r((N=D==null?void 0:D.getChannelsForPortal)==null?void 0:N.data)}}),[w]=Zc(MJ),x=async D=>{var N;try{const{data:F}=await w({variables:{inputData:{conversation_id:m,...D}}}),z=F==null?void 0:F.createAConversationActivityForPortal;z!=null&&z.id&&f(H=>({...H,messages:[...H.messages,z]}))}catch(F){const{message:z,response:H}=F;Zr("error",((N=H==null?void 0:H.data)==null?void 0:N.message)||z,"top-left")}};V.useEffect(()=>((m||a)&&(b({variables:{queryData:{conversation_id:a||m},optionData:{order:[["created_at","asc"]]}}}),d({conversation_id:a||m,is_viewing:!0})),()=>{p(a||m)}),[m||a]),V.useEffect(()=>{pn.size(u==null?void 0:u.messages)===3?C():r([])},[pn.size(u==null?void 0:u.messages)]);const T=((O=u==null?void 0:u.metaData)==null?void 0:O.filtered_rows)&&pn.size(u==null?void 0:u.messages)<((L=u==null?void 0:u.metaData)==null?void 0:L.filtered_rows),k=()=>{f(D=>({...D,loadingActivities:!0,optionData:{...D.optionData,offset:D.optionData.offset+D.optionData.limit}}))};return V.useEffect(()=>{const D=setTimeout(()=>{var z;const N=(z=e.current)==null?void 0:z.querySelectorAll(".single-message"),F=N==null?void 0:N[pn.size(N)-1];F==null||F.scrollIntoView({behavior:"smooth",block:"nearest"})},200);return()=>clearTimeout(D)},[pn.size(u==null?void 0:u.messages)]),Qz(FJ,{errorPolicy:"all",fetchPolicy:"no-cache",variables:{queryData:{conversation_id:a||m}},onData:({data:D})=>{var F;const N=(F=D==null?void 0:D.data)==null?void 0:F.conversationActivityRealtimeStatusUpdated;f(z=>({...z,isReplying:N==null?void 0:N.is_writing_reply,...(N==null?void 0:N.conversation_activity)&&{messages:[...z.messages,N==null?void 0:N.conversation_activity]}}))}}),S?j.jsx("div",{className:"ed-flex ed-justify-center ed-items-center ed-my-10",children:j.jsx(Hu,{})}):j.jsxs("div",{children:[j.jsx("div",{ref:e,id:"activities-scroll-target",className:"ed-flex ed-flex-col ed-pb-5 ed-space-y-5 ed-h-[calc(100vh-200px)] ed-overflow-y-auto no-scrollbar",children:j.jsx(A7,{dataLength:pn.size(u==null?void 0:u.messages),hasMore:T,loader:u!=null&&u.loadingActivities?"Loading...":"",scrollableTarget:"activities-scroll-target",inverse:!0,next:k,children:j.jsxs("div",{className:"ed-flex-1 ed-pt-3",children:[pn.size(u==null?void 0:u.messages)?(R=u==null?void 0:u.messages)==null?void 0:R.map(D=>j.jsx("div",{className:"single-message",children:j.jsx(M7,{author:y,filesData:D==null?void 0:D.files,isFromUser:D==null?void 0:D.is_customer_reply,message:om(D==null?void 0:D.message),timeStamp:qv(D==null?void 0:D.created_at).format("hh:mm A")})},D==null?void 0:D.id)):j.jsx(YG,{orgBrandSetting:t,setSelectedConversationId:s}),pn.size(n)>0&&j.jsx(WG,{channels:n,handleCreateMessage:x}),(u==null?void 0:u.isReplying)&&j.jsx("div",{className:"single-message",children:j.jsx(M7,{author:y,isFromUser:!1,isReplying:!0,timeStamp:qv().format("hh:mm A")})})]})})}),pn.size(u==null?void 0:u.messages)>=4&&j.jsx("div",{className:"ed-sticky ed-bottom-0 ed-bg-white ed-py-5 ed-border-y ed-border-border-light ed--mx-5 ed-px-5",children:j.jsx(AJ,{conversationId:m,handleCreateMessage:x})})]})};var z0={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GET_CATEGORIES"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"queryData"}},type:{kind:"NamedType",name:{kind:"Name",value:"CategoryQueryInput"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"optionData"}},type:{kind:"NamedType",name:{kind:"Name",value:"OptionDataType"}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getCategories"},arguments:[{kind:"Argument",name:{kind:"Name",value:"queryData"},value:{kind:"Variable",name:{kind:"Name",value:"queryData"}}},{kind:"Argument",name:{kind:"Name",value:"optionData"},value:{kind:"Variable",name:{kind:"Name",value:"optionData"}}}],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:[]},{kind:"Field",name:{kind:"Name",value:"total_faqs"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"total_sections"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"organization_brands"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"setting"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"color"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"icon"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"key"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]}]}}]}}]}},{kind:"Field",name:{kind:"Name",value:"icon"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"key"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"description"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"serial"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"total_articles"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"meta_data"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filtered_rows"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"total_rows"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:606}};z0.loc.source={body:`query GET_CATEGORIES($queryData: CategoryQueryInput, $optionData: OptionDataType) {
|
|
513
513
|
getCategories(queryData: $queryData, optionData: $optionData) {
|
|
514
514
|
data {
|
|
515
515
|
id
|
package/npm/ed-widget.js
CHANGED
|
@@ -329,7 +329,7 @@ html body {
|
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function uf(e,t){if(e.kind==="FragmentSpread")t.add(e.name.value);else if(e.kind==="VariableDefinition"){var r=e.type;r.kind==="NamedType"&&t.add(r.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(n){uf(n,t)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(n){uf(n,t)}),e.definitions&&e.definitions.forEach(function(n){uf(n,t)})}var pm={};(function(){hm.definitions.forEach(function(t){if(t.name){var r=new Set;uf(t,r),pm[t.name.value]=r}})})();function Zx(e,t){for(var r=0;r<e.definitions.length;r++){var n=e.definitions[r];if(n.name&&n.name.value==t)return n}}function uD(e,t){var r={kind:e.kind,definitions:[Zx(e,t)]};e.hasOwnProperty("loc")&&(r.loc=e.loc);var n=pm[t]||new Set,i=new Set,a=new Set;for(n.forEach(function(u){a.add(u)});a.size>0;){var o=a;a=new Set,o.forEach(function(u){if(!i.has(u)){i.add(u);var l=pm[u]||new Set;l.forEach(function(f){a.add(f)})}})}return i.forEach(function(u){var l=Zx(e,u);l&&r.definitions.push(l)}),r}const lD=uD(hm,"CONVERSATION_ACTIVITY_REALTIME_STATUS_UPDATED"),cD=({orgBrandSetting:e={}})=>{var S,C,_;const t=q.useRef(null),[r,n]=q.useState([]),[i,a]=q.useState(null),[o,u]=q.useState({messages:[],loadingActivities:!1,optionData:{limit:50,offset:0},isReplying:!1}),{handleCreateOrUpdateRealtimeStatus:l}=oE(),{handleDeleteARealtimeStatus:f}=m7(),d=ko.get("easydesk_chat_widget_conversation_id"),{brand:h}=e,[p,{loading:v}]=Ra(nD,{errorPolicy:"all",fetchPolicy:"no-cache",onCompleted:T=>{const O=T==null?void 0:T.getConversationActivitiesForPortal;u(k=>{var P;return((P=k==null?void 0:k.optionData)==null?void 0:P.offset)===0?{...k,messages:O==null?void 0:O.data,metaData:O==null?void 0:O.meta_data}:{...k,messages:[...k.messages,...O.data],metaData:O==null?void 0:O.meta_data}})}}),[m]=Ra(aD,{errorPolicy:"all",fetchPolicy:"no-cache",onCompleted:T=>{var O;n((O=T==null?void 0:T.getChannelsForPortal)==null?void 0:O.data)}}),[y]=ka(sD),b=async T=>{var O;try{const{data:k}=await y({variables:{inputData:{conversation_id:d,...T}}}),P=k==null?void 0:k.createAConversationActivityForPortal;P!=null&&P.id&&u(N=>({...N,messages:[...N.messages,P]}))}catch(k){const{message:P,response:N}=k;tr("error",((O=N==null?void 0:N.data)==null?void 0:O.message)||P,"top-left")}};q.useEffect(()=>((d||i)&&(p({variables:{queryData:{conversation_id:i||d},optionData:{order:[["created_at","asc"]]}}}),l({conversation_id:i||d,is_viewing:!0})),()=>{f(i||d)}),[d||i]),q.useEffect(()=>{lt.size(o==null?void 0:o.messages)===3?m():n([])},[lt.size(o==null?void 0:o.messages)]);const w=((S=o==null?void 0:o.metaData)==null?void 0:S.filtered_rows)&<.size(o==null?void 0:o.messages)<((C=o==null?void 0:o.metaData)==null?void 0:C.filtered_rows),E=()=>{u(T=>({...T,loadingActivities:!0,optionData:{...T.optionData,offset:T.optionData.offset+T.optionData.limit}}))};return q.useEffect(()=>{const T=setTimeout(()=>{var P;const O=(P=t.current)==null?void 0:P.querySelectorAll(".single-message"),k=O==null?void 0:O[lt.size(O)-1];k==null||k.scrollIntoView({behavior:"smooth",block:"nearest"})},200);return()=>clearTimeout(T)},[lt.size(o==null?void 0:o.messages)]),_8(lD,{errorPolicy:"all",fetchPolicy:"no-cache",variables:{queryData:{conversation_id:i||d}},onData:({data:T})=>{var k;const O=(k=T==null?void 0:T.data)==null?void 0:k.conversationActivityRealtimeStatusUpdated;u(P=>({...P,isReplying:O==null?void 0:O.is_writing_reply,...conversation_activity&&{messages:[...P.messages,O==null?void 0:O.conversation_activity]}}))}}),v?R.jsx("div",{className:"ed-flex ed-justify-center ed-items-center ed-my-10",children:R.jsx(xi,{})}):R.jsxs("div",{children:[R.jsx("div",{ref:t,id:"activities-scroll-target",className:"ed-flex ed-flex-col ed-pb-5 ed-space-y-5 ed-h-[calc(100vh-200px)] ed-overflow-y-auto no-scrollbar",children:R.jsx(iE,{dataLength:lt.size(o==null?void 0:o.messages),hasMore:w,loader:o!=null&&o.loadingActivities?"Loading...":"",scrollableTarget:"activities-scroll-target",inverse:!0,next:E,children:R.jsxs("div",{className:"ed-flex-1 ed-pt-3",children:[lt.size(o==null?void 0:o.messages)?(_=o==null?void 0:o.messages)==null?void 0:_.map(T=>R.jsx("div",{className:"single-message",children:R.jsx(cE,{author:h,filesData:T==null?void 0:T.files,isFromUser:T==null?void 0:T.is_customer_reply,message:gu(T==null?void 0:T.message),timeStamp:eu(T==null?void 0:T.created_at).format("hh:mm A")})},T==null?void 0:T.id)):R.jsx(w7,{orgBrandSetting:e,setSelectedConversationId:a}),lt.size(r)>0&&R.jsx(y7,{channels:r,handleCreateMessage:b}),(o==null?void 0:o.isReplying)&&R.jsx("div",{className:"single-message",children:R.jsx(cE,{author:h,isFromUser:!1,isReplying:!0,timeStamp:eu().format("hh:mm A")})})]})})}),lt.size(o==null?void 0:o.messages)>=4&&R.jsx("div",{className:"ed-sticky ed-bottom-0 ed-bg-white ed-py-5 ed-border-y ed-border-border-light ed--mx-5 ed-px-5",children:R.jsx(tD,{conversationId:d,handleCreateMessage:b})})]})};var lf={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GET_CATEGORIES"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"queryData"}},type:{kind:"NamedType",name:{kind:"Name",value:"CategoryQueryInput"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"optionData"}},type:{kind:"NamedType",name:{kind:"Name",value:"OptionDataType"}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getCategories"},arguments:[{kind:"Argument",name:{kind:"Name",value:"queryData"},value:{kind:"Variable",name:{kind:"Name",value:"queryData"}}},{kind:"Argument",name:{kind:"Name",value:"optionData"},value:{kind:"Variable",name:{kind:"Name",value:"optionData"}}}],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:[]},{kind:"Field",name:{kind:"Name",value:"total_faqs"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"total_sections"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"organization_brands"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"setting"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"color"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"icon"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"key"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]}]}}]}}]}},{kind:"Field",name:{kind:"Name",value:"icon"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"key"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"description"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"serial"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"total_articles"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"meta_data"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filtered_rows"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"total_rows"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:606}};lf.loc.source={body:`query GET_CATEGORIES($queryData: CategoryQueryInput, $optionData: OptionDataType) {
|
|
332
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};function uf(e,t){if(e.kind==="FragmentSpread")t.add(e.name.value);else if(e.kind==="VariableDefinition"){var r=e.type;r.kind==="NamedType"&&t.add(r.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(n){uf(n,t)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(n){uf(n,t)}),e.definitions&&e.definitions.forEach(function(n){uf(n,t)})}var pm={};(function(){hm.definitions.forEach(function(t){if(t.name){var r=new Set;uf(t,r),pm[t.name.value]=r}})})();function Zx(e,t){for(var r=0;r<e.definitions.length;r++){var n=e.definitions[r];if(n.name&&n.name.value==t)return n}}function uD(e,t){var r={kind:e.kind,definitions:[Zx(e,t)]};e.hasOwnProperty("loc")&&(r.loc=e.loc);var n=pm[t]||new Set,i=new Set,a=new Set;for(n.forEach(function(u){a.add(u)});a.size>0;){var o=a;a=new Set,o.forEach(function(u){if(!i.has(u)){i.add(u);var l=pm[u]||new Set;l.forEach(function(f){a.add(f)})}})}return i.forEach(function(u){var l=Zx(e,u);l&&r.definitions.push(l)}),r}const lD=uD(hm,"CONVERSATION_ACTIVITY_REALTIME_STATUS_UPDATED"),cD=({orgBrandSetting:e={}})=>{var S,C,_;const t=q.useRef(null),[r,n]=q.useState([]),[i,a]=q.useState(null),[o,u]=q.useState({messages:[],loadingActivities:!1,optionData:{limit:50,offset:0},isReplying:!1}),{handleCreateOrUpdateRealtimeStatus:l}=oE(),{handleDeleteARealtimeStatus:f}=m7(),d=ko.get("easydesk_chat_widget_conversation_id"),{brand:h}=e,[p,{loading:v}]=Ra(nD,{errorPolicy:"all",fetchPolicy:"no-cache",onCompleted:T=>{const O=T==null?void 0:T.getConversationActivitiesForPortal;u(k=>{var P;return((P=k==null?void 0:k.optionData)==null?void 0:P.offset)===0?{...k,messages:O==null?void 0:O.data,metaData:O==null?void 0:O.meta_data}:{...k,messages:[...k.messages,...O.data],metaData:O==null?void 0:O.meta_data}})}}),[m]=Ra(aD,{errorPolicy:"all",fetchPolicy:"no-cache",onCompleted:T=>{var O;n((O=T==null?void 0:T.getChannelsForPortal)==null?void 0:O.data)}}),[y]=ka(sD),b=async T=>{var O;try{const{data:k}=await y({variables:{inputData:{conversation_id:d,...T}}}),P=k==null?void 0:k.createAConversationActivityForPortal;P!=null&&P.id&&u(N=>({...N,messages:[...N.messages,P]}))}catch(k){const{message:P,response:N}=k;tr("error",((O=N==null?void 0:N.data)==null?void 0:O.message)||P,"top-left")}};q.useEffect(()=>((d||i)&&(p({variables:{queryData:{conversation_id:i||d},optionData:{order:[["created_at","asc"]]}}}),l({conversation_id:i||d,is_viewing:!0})),()=>{f(i||d)}),[d||i]),q.useEffect(()=>{lt.size(o==null?void 0:o.messages)===3?m():n([])},[lt.size(o==null?void 0:o.messages)]);const w=((S=o==null?void 0:o.metaData)==null?void 0:S.filtered_rows)&<.size(o==null?void 0:o.messages)<((C=o==null?void 0:o.metaData)==null?void 0:C.filtered_rows),E=()=>{u(T=>({...T,loadingActivities:!0,optionData:{...T.optionData,offset:T.optionData.offset+T.optionData.limit}}))};return q.useEffect(()=>{const T=setTimeout(()=>{var P;const O=(P=t.current)==null?void 0:P.querySelectorAll(".single-message"),k=O==null?void 0:O[lt.size(O)-1];k==null||k.scrollIntoView({behavior:"smooth",block:"nearest"})},200);return()=>clearTimeout(T)},[lt.size(o==null?void 0:o.messages)]),_8(lD,{errorPolicy:"all",fetchPolicy:"no-cache",variables:{queryData:{conversation_id:i||d}},onData:({data:T})=>{var k;const O=(k=T==null?void 0:T.data)==null?void 0:k.conversationActivityRealtimeStatusUpdated;u(P=>({...P,isReplying:O==null?void 0:O.is_writing_reply,...(O==null?void 0:O.conversation_activity)&&{messages:[...P.messages,O==null?void 0:O.conversation_activity]}}))}}),v?R.jsx("div",{className:"ed-flex ed-justify-center ed-items-center ed-my-10",children:R.jsx(xi,{})}):R.jsxs("div",{children:[R.jsx("div",{ref:t,id:"activities-scroll-target",className:"ed-flex ed-flex-col ed-pb-5 ed-space-y-5 ed-h-[calc(100vh-200px)] ed-overflow-y-auto no-scrollbar",children:R.jsx(iE,{dataLength:lt.size(o==null?void 0:o.messages),hasMore:w,loader:o!=null&&o.loadingActivities?"Loading...":"",scrollableTarget:"activities-scroll-target",inverse:!0,next:E,children:R.jsxs("div",{className:"ed-flex-1 ed-pt-3",children:[lt.size(o==null?void 0:o.messages)?(_=o==null?void 0:o.messages)==null?void 0:_.map(T=>R.jsx("div",{className:"single-message",children:R.jsx(cE,{author:h,filesData:T==null?void 0:T.files,isFromUser:T==null?void 0:T.is_customer_reply,message:gu(T==null?void 0:T.message),timeStamp:eu(T==null?void 0:T.created_at).format("hh:mm A")})},T==null?void 0:T.id)):R.jsx(w7,{orgBrandSetting:e,setSelectedConversationId:a}),lt.size(r)>0&&R.jsx(y7,{channels:r,handleCreateMessage:b}),(o==null?void 0:o.isReplying)&&R.jsx("div",{className:"single-message",children:R.jsx(cE,{author:h,isFromUser:!1,isReplying:!0,timeStamp:eu().format("hh:mm A")})})]})})}),lt.size(o==null?void 0:o.messages)>=4&&R.jsx("div",{className:"ed-sticky ed-bottom-0 ed-bg-white ed-py-5 ed-border-y ed-border-border-light ed--mx-5 ed-px-5",children:R.jsx(tD,{conversationId:d,handleCreateMessage:b})})]})};var lf={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GET_CATEGORIES"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"queryData"}},type:{kind:"NamedType",name:{kind:"Name",value:"CategoryQueryInput"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"optionData"}},type:{kind:"NamedType",name:{kind:"Name",value:"OptionDataType"}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getCategories"},arguments:[{kind:"Argument",name:{kind:"Name",value:"queryData"},value:{kind:"Variable",name:{kind:"Name",value:"queryData"}}},{kind:"Argument",name:{kind:"Name",value:"optionData"},value:{kind:"Variable",name:{kind:"Name",value:"optionData"}}}],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:[]},{kind:"Field",name:{kind:"Name",value:"total_faqs"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"total_sections"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"organization_brands"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"setting"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"color"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"icon"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"key"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]}]}}]}}]}},{kind:"Field",name:{kind:"Name",value:"icon"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"key"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"description"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"serial"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"total_articles"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"meta_data"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"filtered_rows"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"total_rows"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:606}};lf.loc.source={body:`query GET_CATEGORIES($queryData: CategoryQueryInput, $optionData: OptionDataType) {
|
|
333
333
|
getCategories(queryData: $queryData, optionData: $optionData) {
|
|
334
334
|
data {
|
|
335
335
|
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.
|
|
4
|
+
"version": "1.10.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Gain Solutions AS",
|
|
7
7
|
"license": "MIT",
|