UNPKG

@sendbird/chat

Version:
2 lines (1 loc) 6.72 kB
import{C as e,c as n,W as t,U as s,j as a,_ as r,b as o,an as i,V as u,aC as E,aM as c,u as N,bv as d,aI as l}from"./__bundle-dec0ace5.js";import{am as _,aS as h,af as C,aT as p,a0 as A}from"./__bundle-94d0f78f.js";import{P as f}from"./__bundle-acd77193.js";var m;!function(e){e[e.NONE=0]="NONE",e[e.CHANNEL_ENTER=10102]="CHANNEL_ENTER",e[e.CHANNEL_EXIT=10103]="CHANNEL_EXIT",e[e.USER_CHANNEL_MUTE=10201]="USER_CHANNEL_MUTE",e[e.USER_CHANNEL_UNMUTE=10200]="USER_CHANNEL_UNMUTE",e[e.USER_CHANNEL_BAN=10601]="USER_CHANNEL_BAN",e[e.USER_CHANNEL_UNBAN=10600]="USER_CHANNEL_UNBAN",e[e.CHANNEL_FREEZE=10701]="CHANNEL_FREEZE",e[e.CHANNEL_UNFREEZE=10700]="CHANNEL_UNFREEZE",e[e.TYPING_START=10900]="TYPING_START",e[e.TYPING_END=10901]="TYPING_END",e[e.CHANNEL_JOIN=1e4]="CHANNEL_JOIN",e[e.CHANNEL_LEAVE=10001]="CHANNEL_LEAVE",e[e.CHANNEL_OPERATOR_UPDATE=10002]="CHANNEL_OPERATOR_UPDATE",e[e.CHANNEL_INVITE=10020]="CHANNEL_INVITE",e[e.CHANNEL_ACCEPT_INVITE=10021]="CHANNEL_ACCEPT_INVITE",e[e.CHANNEL_DECLINE_INVITE=10022]="CHANNEL_DECLINE_INVITE",e[e.CHANNEL_PROP_CHANGED=11e3]="CHANNEL_PROP_CHANGED",e[e.CHANNEL_DELETED=12e3]="CHANNEL_DELETED",e[e.CHANNEL_META_DATA_CHANGED=11100]="CHANNEL_META_DATA_CHANGED",e[e.CHANNEL_META_COUNTERS_CHANGED=11200]="CHANNEL_META_COUNTERS_CHANGED",e[e.CHANNEL_HIDE=13e3]="CHANNEL_HIDE",e[e.CHANNEL_UNHIDE=13001]="CHANNEL_UNHIDE",e[e.PINNED_MESSAGE_CHANGED=11300]="PINNED_MESSAGE_CHANGED"}(m||(m={}));var v=function(){function n(e){var n;this.channelUrl=e.channel_url,this.channelType=e.channel_type,this.category=e.cat,this.data=null!==(n=e.data)&&void 0!==n?n:{},this.ts=e.ts}return Object.defineProperty(n.prototype,"isGroupChannelEvent",{get:function(){return this.channelType===e.GROUP},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isOpenChannelEvent",{get:function(){return this.channelType===e.OPEN},enumerable:!1,configurable:!0}),n}(),g=function(e){function t(n,t,s){var a=e.call(this,n,"SYEV",s)||this;return a.event=new v(s),a}return n(t,e),t}(t),T=function(e){function t(n,t,a){var r=e.call(this,n,t,a)||this,o=a.data.operators,i=void 0===o?[]:o;return r.operators=i.map((function(e){return new s(r._iid,e)})),r}return n(t,e),t}(g),H=function(e){function t(n,t,s){var r,o=this;return(o=e.call(this,n,"SYEV",s)||this).pinnedMessageIds=[],o.latestPinnedMessage=null,o.ts=0,s.data&&(o.pinnedMessageIds=null!==(r=s.data.pinned_message_ids)&&void 0!==r?r:[],o.latestPinnedMessage=s.data.latest_pinned_message?_(n,a({},s.data.latest_pinned_message)):null),o.ts=s.ts,o}return n(t,e),t}(t),U=function(e){function t(n,t){var s=e.call(this,n)||this;return s._logger=t.logger,s._sdkState=t.sdkState,s._sessionManager=t.sessionManager,s._requestQueue=t.requestQueue,s._dispatcher=t.dispatcher,s._cacheContext=t.cacheContext,s._channelType=t.channelType,s}return n(t,e),Object.defineProperty(t.prototype,"_messageBroadcast",{get:function(){return h.of(this._iid)},enumerable:!1,configurable:!0}),t.prototype.subscribeMessageEvent=function(e,n){this._messageBroadcast.subscribe(e,n)},t.prototype.unsubscribeMessageEvent=function(e){this._messageBroadcast.unsubscribe(e)},t.prototype.getMessageFromCache=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,null]}))}))},t.prototype.getExactlyMatchingMessagesForTokenFromCache=function(e,n,t){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,[]]}))}))},t.prototype.getMessagesFromCache=function(e,n,t,s,a,i){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,[]]}))}))},t.prototype.getPollMessagesFromCache=function(e,n,t,s){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,[]]}))}))},t.prototype.getCachedMessageCountBetween=function(e,n,t,s){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,0]}))}))},t.prototype.getUnsentMessagesFromCache=function(e,n){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,[]]}))}))},t.prototype.removeFailedMessageFromCache=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2]}))}))},t}(i),M=function(e){function t(n,t,s){var a,r,o,i,c=this;(c=e.call(this,n,"ADMM",s)||this).message=new C(n,s);var N=u.of(n).sdkState;return c.isMentioned=E(c.message.mentionType,null!==(o=null!==(a=c.message.mentionedUserIds)&&void 0!==a?a:null===(r=c.message.mentionedUsers)||void 0===r?void 0:r.map((function(e){return e.userId})))&&void 0!==o?o:[],N.userId),c.forceUpdateLastMessage=null!==(i=s.force_update_last_message)&&void 0!==i&&i,c}return n(t,e),t}(t),L=function(e){function t(n,t,s){var a,r,o,i,E,d=this;(d=e.call(this,n,"AEDI",s)||this).message=new C(n,s);var l=u.of(n).sdkState;return d.mentionCountChange=c({mentionType:null===(a=s.old_values)||void 0===a?void 0:a.mention_type,mentionedUserIds:null!==(o=null===(r=s.old_values)||void 0===r?void 0:r.mentioned_user_ids)&&void 0!==o?o:[]},N({mentionType:d.message.mentionType,mentionedUserIds:null!==(i=d.message.mentionedUserIds)&&void 0!==i?i:null===(E=d.message.mentionedUsers)||void 0===E?void 0:E.map((function(e){return e.userId}))}),l.userId),d}return n(t,e),t}(t),I=function(e){function t(n,t,s){var a=e.call(this,n,"MRCT",s)||this;return a.channelUrl=s.channel_url,a.channelType=s.channel_type,a.event=new p(s),a}return n(t,e),t}(t),D=function(e){function t(n,t,s){var a=e.call(this,n,"MTHD",s)||this;return a.event=new A(n,s),a}return n(t,e),t}(t),y=function(e){function t(n,t,s){var a=e.call(this,n,"MCNT",s)||this;return a.groupChannelMemberCounts=s.group_channels.map((function(e){return{channelUrl:e.channel_url,memberCount:e.member_count,joinedMemberCount:e.joined_member_count,updatedAt:e.ts}})),a.openChannelMemberCounts=s.open_channels.map((function(e){return{channelUrl:e.channel_url,participantCount:e.participant_count,updatedAt:e.ts}})),a}return n(t,e),t}(t),b=function(e){function t(n,t,s){var a=e.call(this,n,"PEDI",s)||this;return a.event=new f(n,s),a.status=d(s.poll.status)||s.poll.status,a.channelUrl=s.channel_url,a.channelType=s.channel_type,a}return n(t,e),t}(t),R=function(){this.onUserMuted=l,this.onUserUnmuted=l,this.onUserBanned=l,this.onUserUnbanned=l,this.onChannelChanged=l,this.onChannelDeleted=l,this.onChannelFrozen=l,this.onChannelUnfrozen=l,this.onOperatorUpdated=l,this.onChannelMemberCountChanged=l,this.onMetaDataCreated=l,this.onMetaDataUpdated=l,this.onMetaDataDeleted=l,this.onMetaCounterCreated=l,this.onMetaCounterUpdated=l,this.onMetaCounterDeleted=l,this.onMessageReceived=l,this.onMessageUpdated=l,this.onMessageDeleted=l,this.onMentionReceived=l,this.onReactionUpdated=l,this.onThreadInfoUpdated=l};export{M as A,U as B,g as C,y as M,T as O,b as P,I as R,D as T,H as U,m as a,L as b,R as c};