diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ae8873..9893fed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog +## v3.0.124(MAY 23, 2020) + +- Bug-fix: Failure in `getMessageList()`. + ## v3.0.123(MAY 22, 2020) + - Added message thread feature support - Added `parentMessageId`, `parentMessageText`, `threadInfo` in `UserMessage` and `FileMessage`. - Added `onThreadInfoUpdated()` in `ChannelHandler`. diff --git a/README.md b/README.md index e5f93ec..1839315 100644 --- a/README.md +++ b/README.md @@ -45,19 +45,11 @@ Check out [Basic Sample with SyncManager](https://github.com/sendbird/SendBird-J # [Documentation](https://docs.sendbird.com/javascript) -## v3.0.123(MAY 22, 2020) +## v3.0.124(MAY 23, 2020) If you want to check the record of other version, go to [Change Log](https://github.com/sendbird/SendBird-SDK-JavaScript/blob/master/CHANGELOG.md). -- Added message thread feature support - - Added `parentMessageId`, `parentMessageText`, `threadInfo` in `UserMessage` and `FileMessage`. - - Added `onThreadInfoUpdated()` in `ChannelHandler`. - - Added `getThreadedMessagesByTimestamp()`, `applyThreadInfoUpdateEvent()` in `UserMessage` and `FileMessage`. - - Added thread-related parameters in `GroupChannelListQuery`. -- Added emoji feature support - - Added `getAllEmoji()`, `getEmojiCategory()`, and `getEmoji()` in `SendBird`. -- Added parameter classes for message retrieval. -- Bug-fix: Crash on IE strict mode. +- Bug-fix: Failure in `getMessageList()`. ## [Change Log](https://github.com/sendbird/SendBird-SDK-JavaScript/blob/master/CHANGELOG.md) diff --git a/SendBird.d.ts b/SendBird.d.ts index ba6384d..5fd3b05 100644 --- a/SendBird.d.ts +++ b/SendBird.d.ts @@ -1,5 +1,5 @@ /** - * Type Definitions for SendBird SDK v3.0.123 + * Type Definitions for SendBird SDK v3.0.124 * homepage: https://sendbird.com/ * git: https://github.com/sendbird/SendBird-SDK-JavaScript */ @@ -344,7 +344,11 @@ declare namespace SendBird { serialize(): Object; getMetaArraysByKeys(keys: Array): Array; applyReactionEvent(event: ReactionEvent): void; - getThreadedMessagesByTimestamp(timestamp: number, params: ThreadedMessageListParams, callback: threadedMessageListCallback): void; + getThreadedMessagesByTimestamp( + timestamp: number, + params: ThreadedMessageListParams, + callback: messageListCallback + ): void; applyThreadInfoUpdateEvent(threadInfoUpdateEvent: ThreadInfoUpdateEvent): boolean; metaArray: Object; // DEPRECATED @@ -621,8 +625,16 @@ declare namespace SendBird { callback: getMessageChangeLogsHandler ): void; - getMessageChangeLogsSinceToken(token: string, params: MessageChangeLogsParams, callback: getMessageChangeLogsHandler): void; - getMessageChangeLogsSinceTimestamp(timestamp: number, params: MessageChangeLogsParams, callback: getMessageChangeLogsHandler): void; + getMessageChangeLogsSinceToken( + token: string, + params: MessageChangeLogsParams, + callback: getMessageChangeLogsHandler + ): void; + getMessageChangeLogsSinceTimestamp( + timestamp: number, + params: MessageChangeLogsParams, + callback: getMessageChangeLogsHandler + ): void; getMyMutedInfo(callback: getMyMutedInfoHandler): void; createOperatorListQuery(): OperatorListQuery; @@ -1173,13 +1185,10 @@ declare namespace SendBird { } type threadedMessageList = { - parentMessage: UserMessage | FileMessage | AdminMessage, - threadedReplies: Array + parentMessage: UserMessage | FileMessage | AdminMessage; + threadedReplies: Array; }; - type threadedMessageCallback = ( - threadedMessageList: threadedMessageList, - error: SendBirdError - ) => void; + type threadedMessageCallback = (threadedMessageList: threadedMessageList, error: SendBirdError) => void; interface PreviousMessageListQuery { hasMore: boolean; @@ -1494,7 +1503,7 @@ declare namespace SendBird { interface ThreadInfo { new (): ThreadInfo; replyCount: number; - mostRepliedUsers: Array + mostRepliedUsers: Array; lastRepliedAt: number; } interface ThreadInfoUpdateEvent { diff --git a/SendBird.min.js b/SendBird.min.js index cb3d0bc..012d3f9 100644 --- a/SendBird.min.js +++ b/SendBird.min.js @@ -1,6 +1,6 @@ /** * Copyright (c) 2016 SendBird DBA (Smile Family, Inc.) - * SendBird JavaScript SDK v3.0.123 + * SendBird JavaScript SDK v3.0.124 */ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("ws")):"function"==typeof define&&define.amd?define(["ws"],n):(e=e||self).SendBird=n(e.WebSocket)}(this,function(r){"use strict";function de(e){return(de="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function i(e,n){for(var t=0;te.length)&&(n=e.length);for(var t=0,r=new Array(n);t=e.total&&a()}),i.onreadystatechange=function(){if(i&&i.readyState===i.DONE){var e=i.status,n=null;if(200<=e&&e<400){var t=!0;try{n=JSON.parse(i.responseText)}catch(e){t=!1,n=null}t?i.callback(null,n):i.callback(new fe("Request failed.",fe.REQUEST_FAILED),null),a&&"function"==typeof a&&a(),i=null}else{var r={status:e,statusText:i.statusText,response:i.responseText};ge.debug(r),i&&i.isAbort?i.onabort():(i.callback(s._parseError(r),null),i=null)}}},i.onabort=function(){i&&(i.callback(new fe("Request has been canceled.",fe.REQUEST_CANCELED),null),a&&"function"==typeof a&&a()),i=null},i.onerror=function(){i&&(i.callback(new fe("There was a network error.",fe.NETWORK_ERROR),null),a&&"function"==typeof a&&a()),i=null},i.ontimeout=function(){i&&(i.callback(new fe("Request is timeout.",fe.REQUEST_FAILED),null),a&&"function"==typeof a&&a()),i=null}}catch(e){ge.debug("setting request event is failed. - ",e)}}},{key:"_createWithEncodedGetParams",value:function(e){try{var n="";for(var t in e.data)if(e.data.hasOwnProperty(t)){var r=e.data[t];if(null!=r){n+=t+"="+("object"===de(r)?Array.isArray(r)?r.map(function(e){return encodeURIComponent(e)}).join(","):encodeURIComponent(JSON.stringify(r)):encodeURIComponent(r))+"&"}}n&&(e.url=e.url+"?"+n.substring(0,n.length-1))}catch(e){ge.debug("createWithEncodedGetParams is failed. - ",e)}}},{key:"_sendRequest",value:function(e,n){try{switch(e){case"GET":n.send();break;default:if("undefined"!=typeof FormData&&FormData&&n.data instanceof FormData)if(A()){var t=n.data.getHeaders();n.setRequestHeader("Content-Type",t["content-type"]);var r=[];n.data.on("data",function(e){return r.push(e)}),n.data.on("end",function(){return n.send(r)}),n.data.resume()}else n.send(n.data);else n.setRequestHeader("Content-Type","application/json; charset=utf-8"),n.send(JSON.stringify(n.data))}}catch(e){ge.debug("sending a request is failed. - ",e)}}},{key:"get",value:function(o,l,u){var c=this;this.checkRouting(function(e,n){if(e)u(new fe("Request failed.",fe.REQUEST_FAILED),null);else{var t=pe.get(c.sb._iid).container,r=t.auth,i=t.nodeJs,a=i?i.XMLHttpRequest:XMLHttpRequest;if(a){var s=new a;s.url="".concat(n.apiHost,"/v").concat(he.SDK_MAJOR_VERSION).concat(o),s.data=l?l.yield():{},s.callback=u,c._createWithEncodedGetParams(s),s.open("GET",s.url,!0),c._setRequestEvent(s),c._setDefaultHeader(s,r.sessionKey),c._sendRequest("GET",s)}else u(new fe("Request failed. XMLHttpRequest not found.",fe.REQUEST_FAILED),null)}})}},{key:"dummyCall",value:function(o){var l=this;this.checkRouting(function(e,n){if(e)o(new fe("Request failed.",fe.REQUEST_FAILED),null);else{var t=pe.get(l.sb._iid).container,r=t.auth,i=t.nodeJs,a=i?i.XMLHttpRequest:XMLHttpRequest;if(a){var s=new a;s.url="".concat(n.apiHost),s.data={},s.callback=o,l._createWithEncodedGetParams(s),s.open("GET",s.url,!0),l._setRequestEvent(s),l._setDefaultHeader(s,r.sessionKey),l._sendRequest("GET",s)}else o(new fe("Request failed. XMLHttpRequest not found.",fe.REQUEST_FAILED),null)}})}},{key:"post",value:function(u,c,d){var h=this;this.checkRouting(function(e,n){if(e)d(new fe("Request failed.",fe.REQUEST_FAILED),null);else{var t=pe.get(h.sb._iid).container,r=t.auth,i=t.nodeJs,a=i?i.XMLHttpRequest:XMLHttpRequest;if(a){var s=new a;s.url="".concat(n.apiHost,"/v").concat(he.SDK_MAJOR_VERSION).concat(u),s.data=c?c.yield():{},s.callback=d,s.open("POST",s.url,!0),c.upload||(c.upload={});var o=h.cls.FileMessageQueue,l=c.upload.reqId;l&&(o.uploadRequest[l]=s),h._setRequestEvent(s,c.upload.deleteRequest,c.upload.progressHandler),h._setDefaultHeader(s,r.sessionKey),h._sendRequest("POST",s)}else d(new fe("Request failed. XMLHttpRequest not found.",fe.REQUEST_FAILED),null)}})}},{key:"put",value:function(o,l,u){var c=this;this.checkRouting(function(e,n){if(e)u(new fe("Request failed.",fe.REQUEST_FAILED),null);else{var t=pe.get(c.sb._iid).container,r=t.auth,i=t.nodeJs,a=i?i.XMLHttpRequest:XMLHttpRequest;if(a){var s=new a;s.url="".concat(n.apiHost,"/v").concat(he.SDK_MAJOR_VERSION).concat(o),s.data=l?l.yield():{},s.callback=u,s.open("PUT",s.url,!0),c._setRequestEvent(s),c._setDefaultHeader(s,r.sessionKey),c._sendRequest("PUT",s)}else u(new fe("Request failed. XMLHttpRequest not found.",fe.REQUEST_FAILED),null)}})}},{key:"delete",value:function(o,l,u){var c=this;this.checkRouting(function(e,n){if(e)u(new fe("Request failed.",fe.REQUEST_FAILED),null);else{var t=pe.get(c.sb._iid).container,r=t.auth,i=t.nodeJs,a=i?i.XMLHttpRequest:XMLHttpRequest;if(a){var s=new a;s.url="".concat(n.apiHost,"/v").concat(he.SDK_MAJOR_VERSION).concat(o),s.data=l?l.yield():{},s.callback=u,c._createWithEncodedGetParams(s),s.open("DELETE",s.url,!0),c._setRequestEvent(s),c._setDefaultHeader(s,r.sessionKey),c._sendRequest("DELETE",s)}else u(new fe("Request failed. XMLHttpRequest not found.",fe.REQUEST_FAILED),null)}})}},{key:"updateCurrentUserInfo",value:function(e,i){var a=this,s=e.nickname,o=e.profileUrl,l=e.profileImage,u=e.preferredLanguages;this.sb.ConnectionManager.ready(function(e,n){if(e)i(e,null);else{var t=b.Path.USERS_USERID.replace("%s",encodeURIComponent(n.userId)),r=new k;s&&r.add("nickname",s),o&&r.add("profile_url",o),l&&r.add("profile_file",l,l.name),u&&r.add("preferred_languages",u),a.put(t,r,i)}})}},{key:"getMyGroupChannelChangeLogs",value:function(e,i){var a=this,s=e.ts,o=e.token,l=e.customTypes,u=e.includeEmpty;this.sb.ConnectionManager.ready(function(e,n){if(e)i(e,null);else{var t=b.Path.USERS_USERID_MY_GROUP_CHANNEL_CHANGELOGS.replace("%s",encodeURIComponent(n.userId)),r=new k({show_read_receipt:!0,show_delivery_receipt:!0,show_member:!0});o&&r.add("token",o),s&&r.add("change_ts",s),l&&0this.reconnectParams.retryCount){for(var c in this.disconnect({clearSession:!1,err:new fe("Websocket connection failed.",fe.WEBSOCKET_CONNECTION_FAILED)},null),this.reconnectCount=0,this.sb.connectionHandlers){this.sb.connectionHandlers[c].onReconnectFailed()}return this.sb.connecting=!1,this.sb.reconnecting=!1,this.sb.isReconnectingOnError=!1,void this.sb.ConnectionManager.errorAllReadyHandler()}this.sb.onReconnectTimerCancel=function(){i.reconnectCount=0},this.sb.reconnectTimer=setTimeout(function(){i.sb.reconnectTimer=null,i.sb.onReconnectTimerCancel=null,i.ws&&i.ws.disconnect(!0);var e=new M.ConnectionHandler;i.ws=new M(i.sb,e),i.sb.loginHandler=function(){for(var e in i.reconnectCount=0,i.sb.connecting=!1,i.sb.reconnecting=!1,i.sb.isReconnectingOnError=!1,i.sb.connectionHandlers){i.sb.connectionHandlers[e].onReconnectSucceeded()}if(i.sb.ConnectionManager.processAllReadyHandler(null),i.sb.isReconnectingOnError)for(var n in i.sb.ConnectionManager.networkHandlers)i.sb.ConnectionManager.networkHandlers[n].onReconnected();Object.keys(l.enteredChannels).forEach(function(r){l.enteredChannels[r].enter(function(e,n){if(e){var t=i.cls.FileMessageQueue;delete l.enteredChannels[r],t.delete(r)}})})},e.onOpen=function(){ge.debug("reconnect onOpen"),i.sb.loginTimer=setTimeout(function(){ge.debug("reconnect loginTimer timeout"),i.sb.loginTimer=null,i.reconnect(t,!0)},he.COMMAND_ACK_TIMEOUT),i.sb.onLoginTimerCancel=null,i.sb.reconnecting=!1},e.onMessage=function(e){o.onRawCommandReceived(e)},e.onError=function(e){ge.debug("reconnect onError",e),i.sb.isReconnectingOnError=!0,i.sb.ConnectionManager.errorAllReadyHandler(),i.reconnect(t,!0)},e.onClose=function(){ge.debug("reconnect onClose"),i.sb.reconnecting=!1},s.checkRouting(function(e,n){e?i.reconnect(t,!0):(i.sb.getCurrentApiHost()!==n.apiHost&&s.get("/",null,function(){}),i.ws.connect(t,null,n.wsHost))})},this.reconnectDelay)}}},{key:"disconnect",value:function(e,n){var t=pe.get(this.sb._iid),r=t.container.ackStateMap,i=this.cls,a=i.GroupChannel,s=i.OpenChannel,o=e.clearSession,l=e.err;if(this.sb.loginTimer&&(clearTimeout(this.sb.loginTimer),this.sb.onLoginTimerCancel&&(this.sb.onLoginTimerCancel(),this.sb.onLoginTimerCancel=null),this.sb.loginTimer=null),this.sb.reconnectTimer&&(clearTimeout(this.sb.reconnectTimer),this.sb.onReconnectTimerCancel&&(this.sb.onReconnectTimerCancel(),this.sb.onReconnectTimerCancel=null),this.sb.reconnectTimer=null),this.ws&&(this.reconnectCount=0,this.ws.disconnect(!0),this.ws=null),o){for(var u in s.clearEnteredChannels(),s.clearCache(),a.clearCache(),this.sb.globalTimer&&(clearInterval(this.sb.globalTimer),this.sb.globalTimer=null),r)clearTimeout(r[u].timer);this.sb.currentUser=null,t.set("ackStateMap",{}),t.set("subscribedUnreadMessageCount",{all:0,custom_types:{},ts:0}),t.set("auth",new E)}l&&(this.flushConnectionCallbacks(l,null),this.sb.connecting=!1,this.sb.reconnecting=!1,this.sb.isReconnectingOnError=!1),n&&n(null,null)}},{key:"flushConnectionCallbacks",value:function(n,t){var e=this.sb.connectionCallbacks;this.sb.connectionCallbacks=[],e.forEach(function(e){return e(n,t)})}}]),n}(),O=function(){function f(e){var n=e.type,t=e.nullable,r=void 0!==t&&t,i=e.optional,a=void 0!==i&&i,s=e.optionalIf,o=void 0===s?null:s,l=e.ignoreIf,u=void 0===l?null:l,c=e.defaultValue,d=void 0===c?null:c,h=e.constraint,p=void 0===h?null:h;v(this,f),this.type=n,this.nullable=r,this.optional=a,this.optionalIf=o,this.ignoreIf=u,this.defaultValue=d,this.constraint=p}return s(f,[{key:"isMatchingType",value:function(t){function n(e,n){return"string"==typeof n?de(e)===n||"array"===n&&Array.isArray(e)||"file"===n&&_e.isFile(e)||"null"===n&&null===e||"date"===n&&e instanceof Date:"function"==typeof n?e instanceof n:"object"===de(n)&&-1m.ts){if(m.all!==b.unread_cnt.all&&(S=!0),m.all=0<=b.unread_cnt.all?b.unread_cnt.all:0,b.unread_cnt.custom_types)for(var A in b.unread_cnt.custom_types)m.custom_types[A]!==b.unread_cnt.custom_types[A]&&(S=!0),m.custom_types[A]=b.unread_cnt.custom_types[A];S=S&&0=H.createAt,a=v.sb.currentUser;a&&H._sender&&a.userId===H._sender.userId&&(a.nickname!==H._sender.nickname&&(a.nickname=H._sender.nickname),a.profileUrl!==H._sender.profileUrl&&(a.profileUrl=H._sender.profileUrl),_e.deepEqual(a.metaData,H._sender.metaData)||(a.metaData=H._sender.metaData));var s=!1;if((!H.sender||H.sender.userId!==G)&&!i&&b&&b.hasOwnProperty("old_values")){var o=b.old_values.mention_type||H.mentionType,l=b.old_values.mentioned_user_ids||H.mentionedUsers.map(function(e){return e.userId});if(o===C.MentionType.USERS&&H.mentionType===C.MentionType.USERS){for(var u=!1,c=!1,d=0;d=Ce.get(this)&&(Ce.set(this,t),this.memberCount=e,this.joinedMemberCount=n)}},{key:"hide",value:function(i,a,e){var n,s=this,t=_(O.parse(arguments,[new O({type:"boolean",optional:!0,defaultValue:!1}),new O({type:"boolean",optional:!0,defaultValue:!0}),new O({type:"callback"})]),4);return n=t[0],i=t[1],a=t[2],e=t[3],z(this._iid,function(r){n?r(n,null):pe.get(s._iid).container.apiClient.hideGroupChannel({channelUrl:s.url,hidePreviousMessages:i,allowAutoUnhide:a},function(e,n){if(!e){var t=D.get(s._iid).GroupChannel;s.isHidden=!0,s.hiddenState=a?t.HiddenState.HIDDEN_ALLOW_AUTO_UNHIDE:t.HiddenState.HIDDEN_PREVENT_AUTO_UNHIDE,i&&s._setGroupChannelUnreadCount(0,0),n.hasOwnProperty("ts_message_offset")&&(s._messageOffsetTimestamp=n.ts_message_offset),t.cachedChannels[s.url]=s}r(e,n)})},e)}},{key:"unhide",value:function(e){var i=this;return z(this._iid,function(r){pe.get(i._iid).container.apiClient.unhideGroupChannel({channelUrl:i.url},function(e,n){if(!e){var t=D.get(i._iid).GroupChannel;i.isHidden=!1,i.hiddenState=t.HiddenState.UNHIDDEN,t.cachedChannels[i.url]=i}r(e,n)})},e)}},{key:"freeze",value:function(e){var r=this;return z(this._iid,function(t){pe.get(r._iid).container.apiClient.freeze({channelUrl:r.url,isGroupChannel:!0,freezing:!0},function(e,n){e||D.get(r._iid).GroupChannel.upsert(n);t(e,null)})},e)}},{key:"unfreeze",value:function(e){var r=this;return z(this._iid,function(t){pe.get(r._iid).container.apiClient.freeze({channelUrl:r.url,isGroupChannel:!0,freezing:!1},function(e,n){e||D.get(r._iid).GroupChannel.upsert(n);t(e,null)})},e)}},{key:"delete",value:function(e){var r=this;return z(this._iid,function(t){pe.get(r._iid).container.apiClient.deleteGroupChannel({channelUrl:r.url},function(e,n){e||D.get(r._iid).GroupChannel.removeCachedChannel(r.url);t(e,n)})},e)}},{key:"markAsRead",value:function(){var i=this,e=D.get(this._iid).Command,a=Cn.getInstance(this._iid),n=e.bRead({channelUrl:this.url});a.sendCommand(n,function(e,n){if(a.getErrorFirstCallback()){var t=[e,n];n=t[0],e=t[1]}if(!n&&a.currentUser&&(i.updateReadReceipt(a.currentUser.userId,e.getJsonElement().ts),0=e.createdAt&&i.push(s)}return i}return[]}},{key:"getUnreadMembers",value:function(e,n){var t=1=t){r.end=0,r.start=n;var i=D.get(this._iid).Command.bTypeStart({channelUrl:this.url,time:r.start});e.sendCommand(i,null)}}},{key:"endTyping",value:function(){var e=Cn.getInstance(this._iid),n=(new Date).getTime(),t=e.Options.typingIndicatorThrottle;("number"!=typeof t||t<1e3||9e3=t){r.start=0,r.end=n;var i=D.get(this._iid).Command.bTypeEnd({channelUrl:this.url,time:r.end});e.sendCommand(i,null)}}},{key:"invalidateTypingStatus",value:function(){var e=ue.get(this),n=(new Date).getTime(),t=!1;for(var r in e){1e4<=n-e[r]&&(delete e[r],t=!0)}return t}},{key:"getTypingMembers",value:function(){var e=ue.get(this),n=[];for(var t in e){var r=this.memberMap[t];r&&n.push(r)}return n}},{key:"updateTypingStatus",value:function(e,n){var t=ue.get(this);n?t[e.userId]=(new Date).getTime():delete t[e.userId]}},{key:"isTyping",value:function(){var e=ue.get(this);return 0!==Object.keys(e).length}},{key:"registerScheduledUserMessage",value:function(e,n){var t,a=this,r=D.get(this._iid),s=r.ScheduledUserMessage,i=r.ScheduledUserMessageParams,o=_(O.parse(arguments,[new O({type:i,constraint:function(e){return"string"==typeof e.message&&"string"==typeof e._getScheduleString()}}),new O({type:"callback"})]),3);return t=o[0],e=o[1],n=o[2],z(this._iid,function(i){t?i(t,null):pe.get(a._iid).container.apiClient.registerScheduledUserMessage({groupChannelParams:e,channelUrl:a.url,isOpenChannel:!1},function(e,n){var t=null;if(!e){t=new s(n);var r=Cn.getInstance(a._iid).currentUser;r&&t._sender&&r.userId===t._sender.userId&&(r.nickname=t._sender.nickname,r.profileUrl=t._sender.profileUrl,r.metaData=t._sender.metaData)}i(e,t)})},n)}},{key:"getPushPreference",value:function(e){var i=this;return z(this._iid,function(r){pe.get(i._iid).container.apiClient.getMyPushTriggerOption({channelUrl:i.url},function(e,n){var t=null;if(!e){try{t=n.enable}catch(e){t=!1}i.isPushEnabled=t}r&&r(e,t)})},e)}},{key:"setPushPreference",value:function(e,n){var i=this;return z(this._iid,function(t){var r=D.get(i._iid).GroupChannel;pe.get(i._iid).container.apiClient.setMyPushTriggerOption({channelUrl:i.url,enable:e},function(e,n){e||(i.isPushEnabled=n.enable,i.isPushEnabled||(i.myPushTriggerOption=r.PushTriggerOption.OFF)),t(e,n)})},n)}},{key:"getMyPushTriggerOption",value:function(e){var i=this;return z(this._iid,function(r){pe.get(i._iid).container.apiClient.getMyPushTriggerOption({channelUrl:i.url},function(e,n){var t=null;if(!e){try{t=n.push_trigger_option||a.PushTriggerOption.DEFAULT}catch(e){ge.debug(e)}i.myPushTriggerOption=t}r(e,t)})},e)}},{key:"setMyPushTriggerOption",value:function(e,n){var t,i=this,r=D.get(this._iid).GroupChannel,a=_(O.parse(arguments,[new O({type:r.PushTriggerOption}),new O({type:"callback"})]),3);return t=a[0],e=a[1],n=a[2],z(this._iid,function(r){t?r(t,null):pe.get(i._iid).container.apiClient.setMyPushTriggerOption({channelUrl:i.url,pushTriggerOption:e},function(e,n){var t=null;if(!e){try{t=n.push_trigger_option}catch(e){ge.debug(e)}i.myPushTriggerOption=t}r(e,t)})},n)}},{key:"setMyCountPreference",value:function(e,n){var t,i=this,a=D.get(this._iid).GroupChannel,r=_(O.parse(arguments,[new O({type:a.CountPreference}),new O({type:"callback"})]),3);return t=r[0],e=r[1],n=r[2],z(this._iid,function(r){t?r(t,null):pe.get(i._iid).container.apiClient.setMyCountPreference({channelUrl:i.url,countPreference:e},function(e,n){var t=null;e||(t=i.myCountPreference=n.count_preference,i._setGroupChannelUnreadCount(i.unreadMessageCount,i.unreadMentionCount),a.cachedChannels[i.url]=i),r(e,t)})},n)}},{key:"resetMyHistory",value:function(e){var i=this;return z(this._iid,function(r){pe.get(i._iid).container.apiClient.resetMyHistory({channelUrl:i.url},function(e,n){if(!e&&n.hasOwnProperty("ts_message_offset")){var t=D.get(i._iid).GroupChannel;i._messageOffsetTimestamp=n.ts_message_offset,t.cachedChannels[i.url]=i}r(e,n)})},e)}},{key:"messageOffsetTimestamp",get:function(){return this._messageOffsetTimestamp}}],[{key:"buildFromSerializedData",value:function(e){var n,t=D.get(this._iid),r=t.User,i=t.Member,a=t.GroupChannel,s=t.BaseMessage,o=t.UserMessage,l=t.FileMessage,u=t.AdminMessage,c=q.deserialize(e);return new a({channel_url:c.url,name:c.name,cover_url:c.coverUrl,data:c.data,custom_type:c.customType,invited_at:c.invitedAt,created_at:c.createdAt/1e3,is_access_code_required:c.isAccessCodeRequired,is_distinct:c.isDistinct,is_super:c.isSuper,is_broadcast:c.isBroadcast,is_public:c.isPublic,is_discoverable:c.isDiscoverable,freeze:c.isFrozen,is_ephemeral:c.isEphemeral,unread_message_count:c.unreadMessageCount,unread_mention_count:c.unreadMentionCount,is_push_enabled:c.isPushEnabled,push_trigger_option:c.myPushTriggerOption,count_preference:c.myCountPreference,is_hidden:c.isHidden,hidden_state:c.hiddenState,member_count:c.memberCount,joined_member_count:c.joinedMemberCount,member_state:c.myMemberState,my_role:c.myRole,is_muted:c.myMutedState,user_last_read:c.myLastRead,ts_message_offset:c.messageOffsetTimestamp,message_survival_seconds:c.messageSurvivalSeconds,read_receipt:c.cachedReadReceiptStatus,delivery_receipt:c.cachedDeliveryReceiptStatus,members:c.members.map(function(e){return i.build(r.build(e.userId,e.nickname,e.profileUrl,e.connectionStatus,e.lastSeenAt,e.metaData,e.isActive,e.friendDiscoveryKey,e.friendName),e.state,e.role,e.isBlockedByMe,e.isBlockingMe)}),last_message:null!=(n=c.lastMessage)&&"object"===de(n)?n.messageType===s.MESSAGE_TYPE_USER?new o(o.build(n.reqId,n.messageId,n.user,{url:n.channelUrl,channelType:n.channelType},n.message,n.data,n.customType,n.translations,n.isGlobalBlocked,n.createdAt,n.updatedAt,n.metaArrays,n.mentionType,n.mentionedUsers,n.mentionedUserIds,n.sendingStatus,n.requestedMentionUserIds)):n.messageType===s.MESSAGE_TYPE_FILE?new l(l.build(n.reqId,n.messageId,n.user,{url:n.channelUrl,channelType:n.channelType},n.url,n.name,n.type,n.size,n.data,n.customType,n.isGlobalBlocked,n.createdAt,n.thumbnails,n.requireAuth,n.updatedAt,n.metaArrays,n.mentionType,n.mentionedUsers,n.mentionedUserIds,n.sendingStatus,n.requestedMentionUserIds)):new u(u.build(n.messageId,{url:n.channelUrl,channelType:n.channelType},n.message,n.data,n.customType,n.translations,n.createdAt,n.updatedAt,n.metaArrays,n.mentionType,n.mentionedUsers)):null,inviter:null!==c.inviter&&void 0!==c.inviter&&"object"===de(c.inviter)?r.build.apply(r,S(["userId","nickname","profileUrl","connectionStatus","lastSeenAt","metaData","isActive","friendDiscoveryKey","friendName"].map(function(e){return c.inviter[e]}))):null,__wk:c.__wk})}},{key:"upsert",value:function(e){var n=D.get(this._iid).GroupChannel,t=new n(e);if(n.cachedChannels.hasOwnProperty(t.url)){if(t.isEphemeral){var r=n.cachedChannels[t.url];e.last_message=r.lastMessage,e.unread_message_count=r.unreadMessageCount}n.cachedChannels[t.url].update(e)}else n.cachedChannels[t.url]=t;return n.cachedChannels[t.url]}},{key:"removeCachedChannel",value:function(e){var n=D.get(this._iid),t=n.GroupChannel,r=n.FileMessageQueue;t.cachedChannels[e]&&delete t.cachedChannels[e],r.delete(e)}},{key:"clearCache",value:function(){oe[this._iid]={},D.get(this._iid).FileMessageQueue.clear()}},{key:"getChannel",value:function(n,e){var t,r=_(O.parse(arguments,[new O({type:"string"}),new O({type:"callback"})]),3);if(t=r[0],n=r[1],e=r[2],t)return z(this._iid,function(e){e(t,null)},e);var i=D.get(this._iid).GroupChannel;return i.cachedChannels[n]?z(this._iid,function(e){e(null,i.cachedChannels[n])},e):i.getChannelWithoutCache(n,e)}},{key:"getChannelWithoutCache",value:function(e,n){var t,i=this,r=_(O.parse(arguments,[new O({type:"string"}),new O({type:"callback"})]),3);return t=r[0],e=r[1],n=r[2],z(this._iid,function(r){t?r(t,null):pe.get(i._iid).container.apiClient.getGroupChannel({channelUrl:e,showMember:!0},function(e,n){var t=null;e||(t=D.get(i._iid).GroupChannel.upsert(n));r(e,t)})},n)}},{key:"createDistinctChannelIfNotExist",value:function(e,n){var t,a=this,r=D.get(this._iid).GroupChannelParams,i=_(O.parse(arguments,[new O({type:r,constraint:function(e){return e._validate()}}),new O({type:"callback"})]),3);return t=i[0],e=i[1],n=i[2],z(this._iid,function(i){t?i(t,null):(e.isPublic||(e.accessCode=null),pe.get(a._iid).container.apiClient.createGroupChannel(g(g({},e),{},{isDistinct:!0}),function(e,n){var t=null;if(!e){var r=D.get(a._iid).GroupChannel;t={channel:new r(n),isCreated:n.is_created},r.cachedChannels[t.channel.url]=t.channel}i(e,t)}))},n)}},{key:"createChannel",value:function(){var n=this,t=O.toArray(arguments),e=void 0;"function"==typeof t[t.length-1]&&(e=t.pop());var r=D.get(this._iid),i=r.GroupChannel,a=r.GroupChannelParams;if(t[0]instanceof a&&1===t.length)return z(this._iid,function(r){var e=t[0];(e.isPublic||(e.accessCode=null),e._validate())?pe.get(n._iid).container.apiClient.createGroupChannel(e,function(e,n){var t=null;e||(t=new i(n),i.cachedChannels[t.url]=t),r(e,t)}):r(O.error,null)},e);if(Array.isArray(t[0])){var s=new a;switch(t.length){case 1:s.addUsers(t[0]);break;case 2:s.addUsers(t[0]),s.isDistinct=t[1];break;case 3:s.addUsers(t[0]),s.isDistinct=t[1],s.customType=t[2];break;case 5:s.addUsers(t[0]),s.isDistinct=t[1],s.name=t[2],"string"==typeof t[3]?s.coverUrl=t[3]:s.coverImage=t[3],s.data=t[4];break;case 6:s.addUsers(t[0]),s.isDistinct=t[1],s.name=t[2],"string"==typeof t[3]?s.coverUrl=t[3]:s.coverImage=t[3],s.data=t[4],s.customType=t[5];break;default:return z(this._iid,function(e){return e(O.error,null)},e)}return i.createChannel(s,e)}return z(this._iid,function(e){return e(O.error,null)},e)}},{key:"createChannelWithUserIds",value:function(){var e=O.toArray(arguments),n=void 0;"function"==typeof e[e.length-1]&&(n=e.pop());var t=D.get(this._iid),r=t.GroupChannel,i=new t.GroupChannelParams;switch(e.length){case 1:i.addUserIds(e[0]);break;case 2:i.addUserIds(e[0]),i.isDistinct=e[1];break;case 3:i.addUserIds(e[0]),i.isDistinct=e[1],i.customType=e[2];break;case 5:i.addUserIds(e[0]),i.isDistinct=e[1],i.name=e[2],"string"==typeof e[3]?i.coverUrl=e[3]:i.coverImage=e[3],i.data=e[4];break;case 6:i.addUserIds(e[0]),i.isDistinct=e[1],i.name=e[2],"string"==typeof e[3]?i.coverUrl=e[3]:i.coverImage=e[3],i.data=e[4],i.customType=e[5];break;default:return z(this._iid,function(e){return e(O.error,null)},n)}return r.createChannel(i,n)}},{key:"createMyGroupChannelListQuery",value:function(){return new(D.get(this._iid).GroupChannelListQuery)}},{key:"createPublicGroupChannelListQuery",value:function(){return new(D.get(this._iid).PublicGroupChannelListQuery)}},{key:"getChannelCount",value:function(e,n){return Cn.getInstance(this._iid).getGroupChannelCount(e,n)}},{key:"getUnreadItemCount",value:function(e,n){return Cn.getInstance(this._iid).getUnreadItemCount(e,n)}},{key:"getTotalUnreadMessageCount",value:function(){var e=O.toArray(arguments),n="function"==typeof e[e.length-1]?e.pop():null,t=Cn.getInstance(this._iid);return t.getTotalUnreadMessageCount.apply(t,S(e).concat([n]))}},{key:"getTotalUnreadChannelCount",value:function(e){return Cn.getInstance(this._iid).getTotalUnreadChannelCount(e)}},{key:"MemberStateFilter",get:function(){return{ALL:"all",JOINED:"joined_only",INVITED:"invited_only",INVITED_BY_FRIEND:"invited_by_friend",INVITED_BY_NON_FRIEND:"invited_by_non_friend"}}},{key:"PushTriggerOption",get:function(){return{DEFAULT:"default",ALL:"all",MENTION_ONLY:"mention_only",OFF:"off"}}},{key:"CountPreference",get:function(){return{ALL:"all",UNREAD_MESSAGE_COUNT_ONLY:"unread_message_count_only",UNREAD_MENTION_COUNT_ONLY:"unread_mention_count_only",OFF:"off"}}},{key:"HiddenState",get:function(){return{UNHIDDEN:"unhidden",HIDDEN_ALLOW_AUTO_UNHIDE:"hidden_allow_auto_unhide",HIDDEN_PREVENT_AUTO_UNHIDE:"hidden_prevent_auto_unhide"}}},{key:"PublicChannelFilter",get:function(){return{ALL:"all",PUBLIC:"public",PRIVATE:"private"}}},{key:"SuperChannelFilter",get:function(){return{ALL:"all",SUPER:"super",NON_SUPER:"nonsuper"}}},{key:"UnreadChannelFilter",get:function(){return{ALL:"all",UNREAD_MESSAGE:"unread_message"}}},{key:"HiddenChannelFilter",get:function(){return{UNHIDDEN:"unhidden_only",HIDDEN:"hidden_only",HIDDEN_ALLOW_AUTO_UNHIDE:"hidden_allow_auto_unhide",HIDDEN_PREVENT_AUTO_UNHIDE:"hidden_prevent_auto_unhide"}}},{key:"Role",get:function(){return{OPERATOR:"operator",NONE:"none"}}},{key:"UnreadItemKey",get:function(){return{GROUP_CHANNEL_UNREAD_MENTION_COUNT:"group_channel_unread_mention_count",NONSUPER_UNREAD_MENTION_COUNT:"non_super_group_channel_unread_mention_count",SUPER_UNREAD_MENTION_COUNT:"super_group_channel_unread_mention_count",GROUP_CHANNEL_UNREAD_MESSAGE_COUNT:"group_channel_unread_message_count",NONSUPER_UNREAD_MESSAGE_COUNT:"non_super_group_channel_unread_message_count",SUPER_UNREAD_MESSAGE_COUNT:"super_group_channel_unread_message_count",GROUP_CHANNEL_INVITATION_COUNT:"group_channel_invitation_count",NONSUPER_INVITATION_COUNT:"non_super_group_channel_invitation_count",SUPER_INVITATION_COUNT:"super_group_channel_invitation_count"}}},{key:"cachedChannels",get:function(){return oe[this._iid]||(oe[this._iid]={}),oe[this._iid]}},{key:"markAsReadAllLastSentAt",get:function(){return le[this._iid]||0},set:function(e){le[this._iid]=e}}]),a}(),Ue=function(){o(r,W);var t=h(r);function r(e){var n;return v(this,r),(n=t.call(this,e)).state="",n.role="",n.isBlockedByMe=!1,n.isBlockingMe=!1,e&&n._update(e),n}return s(r,[{key:"_update",value:function(e){this.state=e.state,this.role=e.role||Ee.Role.NONE,e.hasOwnProperty("is_blocked_by_me")&&(this.isBlockedByMe=e.is_blocked_by_me),e.hasOwnProperty("is_blocking_me")&&(this.isBlockingMe=e.is_blocking_me)}},{key:"parse",value:function(e){this._update(e)}}],[{key:"build",value:function(e,n,t,r,i){var a=e;return a.state=n,a.role=t||"",a.is_blocked_by_me=r||!1,a.is_blocking_me=i||!1,a}},{key:"buildFromSerializedData",value:function(e){var n=D.get(this._iid),t=n.User,r=n.Member,i=q.deserialize(e);return new r(r.build(t.build(i.userId,i.nickname,i.profileUrl,i.connectionStatus,i.lastSeenAt,i.metaData,i.isActive,i.friendDiscoveryKey,i.friendName),i.state,i.role,i.isBlockedByMe,i.isBlockingMe))}},{key:"JOINED",get:function(){return"joined"}},{key:"INVITED",get:function(){return"invited"}}]),r}(),be=function(){o(r,W);var t=h(r);function r(e){var n;return v(this,r),(n=t.call(this,e)).isBlockedByMe=!1,e&&n._update(e),n}return s(r,[{key:"parse",value:function(e){this._update(e)}},{key:"_update",value:function(e){e.hasOwnProperty("is_blocked_by_me")&&(this.isBlockedByMe=e.is_blocked_by_me)}}],[{key:"build",value:function(e,n){var t=e;return t.is_blocked_by_me=n||!1,t}},{key:"buildFromSerializedData",value:function(e){var n=D.get(this._iid),t=n.User,r=n.Sender,i=q.deserialize(e);return new r(r.build(t.build.apply(t,S(["userId","nickname","profileUrl","connectionStatus","lastSeenAt","metaData","isActive","friendDiscoveryKey","friendName"].map(function(e){return i[e]}))),i.isBlockedByMe))}}]),r}(),Se=function(){function n(e){v(this,n),this.emojiHash=null,this.emojiCategories=null,e&&this._update(e)}return s(n,[{key:"_update",value:function(e){var n=D.get(this._iid).EmojiCategory;this.emojiHash=e.emoji_hash||"",this.emojiCategories=e.emoji_categories?e.emoji_categories.map(function(e){return new n(e)}):[]}}]),n}(),Ie=function(){function n(e){v(this,n),this.id=null,this.name=null,this.url=null,this.emojis=null,e&&this._update(e)}return s(n,[{key:"_update",value:function(e){var n=D.get(this._iid).Emoji;this.id=e.id||"",this.name=e.name||"",this.url=e.url||"",this.emojis=e.emojis?e.emojis.map(function(e){return new n(e)}):[]}}]),n}(),Ae=function(){function n(e){v(this,n),this.key=null,this.url=null,e&&this._update(e)}return s(n,[{key:"_update",value:function(e){this.key=e.key,this.url=e.url}}]),n}(),Ne={},ke={},Re=function(){o(r,J);var t=h(r);function r(e){var n;return v(this,r),(n=t.call(this,e)).channelType=J.CHANNEL_TYPE_OPEN,n.participantCount=0,n.operators=[],e&&n._update(e),n}return s(r,[{key:"_update",value:function(e){var n=D.get(this._iid).User;if(e.hasOwnProperty("participant_count")&&(this.participantCount=parseInt(e.participant_count)),e.hasOwnProperty("operators")&&e.operators){this.operators=[];for(var t=0;te.length)&&(n=e.length);for(var t=0,r=new Array(n);t=e.total&&a()}),i.onreadystatechange=function(){if(i&&i.readyState===i.DONE){var e=i.status,n=null;if(200<=e&&e<400){var t=!0;try{n=JSON.parse(i.responseText)}catch(e){t=!1,n=null}t?i.callback(null,n):i.callback(new fe("Request failed.",fe.REQUEST_FAILED),null),a&&"function"==typeof a&&a(),i=null}else{var r={status:e,statusText:i.statusText,response:i.responseText};_e.debug(r),i&&i.isAbort?i.onabort():(i.callback(s._parseError(r),null),i=null)}}},i.onabort=function(){i&&(i.callback(new fe("Request has been canceled.",fe.REQUEST_CANCELED),null),a&&"function"==typeof a&&a()),i=null},i.onerror=function(){i&&(i.callback(new fe("There was a network error.",fe.NETWORK_ERROR),null),a&&"function"==typeof a&&a()),i=null},i.ontimeout=function(){i&&(i.callback(new fe("Request is timeout.",fe.REQUEST_FAILED),null),a&&"function"==typeof a&&a()),i=null}}catch(e){_e.debug("setting request event is failed. - ",e)}}},{key:"_createWithEncodedGetParams",value:function(e){try{var n="";for(var t in e.data)if(e.data.hasOwnProperty(t)){var r=e.data[t];if(null!=r){n+=t+"="+("object"===de(r)?Array.isArray(r)?r.map(function(e){return encodeURIComponent(e)}).join(","):encodeURIComponent(JSON.stringify(r)):encodeURIComponent(r))+"&"}}n&&(e.url=e.url+"?"+n.substring(0,n.length-1))}catch(e){_e.debug("createWithEncodedGetParams is failed. - ",e)}}},{key:"_sendRequest",value:function(e,n){try{switch(e){case"GET":n.send();break;default:if("undefined"!=typeof FormData&&FormData&&n.data instanceof FormData)if(I()){var t=n.data.getHeaders();n.setRequestHeader("Content-Type",t["content-type"]);var r=[];n.data.on("data",function(e){return r.push(e)}),n.data.on("end",function(){return n.send(r)}),n.data.resume()}else n.send(n.data);else n.setRequestHeader("Content-Type","application/json; charset=utf-8"),n.send(JSON.stringify(n.data))}}catch(e){_e.debug("sending a request is failed. - ",e)}}},{key:"get",value:function(o,l,u){var c=this;this.checkRouting(function(e,n){if(e)u(new fe("Request failed.",fe.REQUEST_FAILED),null);else{var t=pe.get(c.sb._iid).container,r=t.auth,i=t.nodeJs,a=i?i.XMLHttpRequest:XMLHttpRequest;if(a){var s=new a;s.url="".concat(n.apiHost,"/v").concat(he.SDK_MAJOR_VERSION).concat(o),s.data=l?l.yield():{},s.callback=u,c._createWithEncodedGetParams(s),s.open("GET",s.url,!0),c._setRequestEvent(s),c._setDefaultHeader(s,r.sessionKey),c._sendRequest("GET",s)}else u(new fe("Request failed. XMLHttpRequest not found.",fe.REQUEST_FAILED),null)}})}},{key:"dummyCall",value:function(o){var l=this;this.checkRouting(function(e,n){if(e)o(new fe("Request failed.",fe.REQUEST_FAILED),null);else{var t=pe.get(l.sb._iid).container,r=t.auth,i=t.nodeJs,a=i?i.XMLHttpRequest:XMLHttpRequest;if(a){var s=new a;s.url="".concat(n.apiHost),s.data={},s.callback=o,l._createWithEncodedGetParams(s),s.open("GET",s.url,!0),l._setRequestEvent(s),l._setDefaultHeader(s,r.sessionKey),l._sendRequest("GET",s)}else o(new fe("Request failed. XMLHttpRequest not found.",fe.REQUEST_FAILED),null)}})}},{key:"post",value:function(u,c,d){var h=this;this.checkRouting(function(e,n){if(e)d(new fe("Request failed.",fe.REQUEST_FAILED),null);else{var t=pe.get(h.sb._iid).container,r=t.auth,i=t.nodeJs,a=i?i.XMLHttpRequest:XMLHttpRequest;if(a){var s=new a;s.url="".concat(n.apiHost,"/v").concat(he.SDK_MAJOR_VERSION).concat(u),s.data=c?c.yield():{},s.callback=d,s.open("POST",s.url,!0),c.upload||(c.upload={});var o=h.cls.FileMessageQueue,l=c.upload.reqId;l&&(o.uploadRequest[l]=s),h._setRequestEvent(s,c.upload.deleteRequest,c.upload.progressHandler),h._setDefaultHeader(s,r.sessionKey),h._sendRequest("POST",s)}else d(new fe("Request failed. XMLHttpRequest not found.",fe.REQUEST_FAILED),null)}})}},{key:"put",value:function(o,l,u){var c=this;this.checkRouting(function(e,n){if(e)u(new fe("Request failed.",fe.REQUEST_FAILED),null);else{var t=pe.get(c.sb._iid).container,r=t.auth,i=t.nodeJs,a=i?i.XMLHttpRequest:XMLHttpRequest;if(a){var s=new a;s.url="".concat(n.apiHost,"/v").concat(he.SDK_MAJOR_VERSION).concat(o),s.data=l?l.yield():{},s.callback=u,s.open("PUT",s.url,!0),c._setRequestEvent(s),c._setDefaultHeader(s,r.sessionKey),c._sendRequest("PUT",s)}else u(new fe("Request failed. XMLHttpRequest not found.",fe.REQUEST_FAILED),null)}})}},{key:"delete",value:function(o,l,u){var c=this;this.checkRouting(function(e,n){if(e)u(new fe("Request failed.",fe.REQUEST_FAILED),null);else{var t=pe.get(c.sb._iid).container,r=t.auth,i=t.nodeJs,a=i?i.XMLHttpRequest:XMLHttpRequest;if(a){var s=new a;s.url="".concat(n.apiHost,"/v").concat(he.SDK_MAJOR_VERSION).concat(o),s.data=l?l.yield():{},s.callback=u,c._createWithEncodedGetParams(s),s.open("DELETE",s.url,!0),c._setRequestEvent(s),c._setDefaultHeader(s,r.sessionKey),c._sendRequest("DELETE",s)}else u(new fe("Request failed. XMLHttpRequest not found.",fe.REQUEST_FAILED),null)}})}},{key:"updateCurrentUserInfo",value:function(e,i){var a=this,s=e.nickname,o=e.profileUrl,l=e.profileImage,u=e.preferredLanguages;this.sb.ConnectionManager.ready(function(e,n){if(e)i(e,null);else{var t=b.Path.USERS_USERID.replace("%s",encodeURIComponent(n.userId)),r=new k;s&&r.add("nickname",s),o&&r.add("profile_url",o),l&&r.add("profile_file",l,l.name),u&&r.add("preferred_languages",u),a.put(t,r,i)}})}},{key:"getMyGroupChannelChangeLogs",value:function(e,i){var a=this,s=e.ts,o=e.token,l=e.customTypes,u=e.includeEmpty;this.sb.ConnectionManager.ready(function(e,n){if(e)i(e,null);else{var t=b.Path.USERS_USERID_MY_GROUP_CHANNEL_CHANGELOGS.replace("%s",encodeURIComponent(n.userId)),r=new k({show_read_receipt:!0,show_delivery_receipt:!0,show_member:!0});o&&r.add("token",o),s&&r.add("change_ts",s),l&&0this.reconnectParams.retryCount){for(var c in this.disconnect({clearSession:!1,err:new fe("Websocket connection failed.",fe.WEBSOCKET_CONNECTION_FAILED)},null),this.reconnectCount=0,this.sb.connectionHandlers){this.sb.connectionHandlers[c].onReconnectFailed()}return this.sb.connecting=!1,this.sb.reconnecting=!1,this.sb.isReconnectingOnError=!1,void this.sb.ConnectionManager.errorAllReadyHandler()}this.sb.onReconnectTimerCancel=function(){i.reconnectCount=0},this.sb.reconnectTimer=setTimeout(function(){i.sb.reconnectTimer=null,i.sb.onReconnectTimerCancel=null,i.ws&&i.ws.disconnect(!0);var e=new M.ConnectionHandler;i.ws=new M(i.sb,e),i.sb.loginHandler=function(){for(var e in i.reconnectCount=0,i.sb.connecting=!1,i.sb.reconnecting=!1,i.sb.isReconnectingOnError=!1,i.sb.connectionHandlers){i.sb.connectionHandlers[e].onReconnectSucceeded()}if(i.sb.ConnectionManager.processAllReadyHandler(null),i.sb.isReconnectingOnError)for(var n in i.sb.ConnectionManager.networkHandlers)i.sb.ConnectionManager.networkHandlers[n].onReconnected();Object.keys(l.enteredChannels).forEach(function(r){l.enteredChannels[r].enter(function(e,n){if(e){var t=i.cls.FileMessageQueue;delete l.enteredChannels[r],t.delete(r)}})})},e.onOpen=function(){_e.debug("reconnect onOpen"),i.sb.loginTimer=setTimeout(function(){_e.debug("reconnect loginTimer timeout"),i.sb.loginTimer=null,i.reconnect(t,!0)},he.COMMAND_ACK_TIMEOUT),i.sb.onLoginTimerCancel=null,i.sb.reconnecting=!1},e.onMessage=function(e){o.onRawCommandReceived(e)},e.onError=function(e){_e.debug("reconnect onError",e),i.sb.isReconnectingOnError=!0,i.sb.ConnectionManager.errorAllReadyHandler(),i.reconnect(t,!0)},e.onClose=function(){_e.debug("reconnect onClose"),i.sb.reconnecting=!1},s.checkRouting(function(e,n){e?i.reconnect(t,!0):(i.sb.getCurrentApiHost()!==n.apiHost&&s.get("/",null,function(){}),i.ws.connect(t,null,n.wsHost))})},this.reconnectDelay)}}},{key:"disconnect",value:function(e,n){var t=pe.get(this.sb._iid),r=t.container.ackStateMap,i=this.cls,a=i.GroupChannel,s=i.OpenChannel,o=e.clearSession,l=e.err;if(this.sb.loginTimer&&(clearTimeout(this.sb.loginTimer),this.sb.onLoginTimerCancel&&(this.sb.onLoginTimerCancel(),this.sb.onLoginTimerCancel=null),this.sb.loginTimer=null),this.sb.reconnectTimer&&(clearTimeout(this.sb.reconnectTimer),this.sb.onReconnectTimerCancel&&(this.sb.onReconnectTimerCancel(),this.sb.onReconnectTimerCancel=null),this.sb.reconnectTimer=null),this.ws&&(this.reconnectCount=0,this.ws.disconnect(!0),this.ws=null),o){for(var u in s.clearEnteredChannels(),s.clearCache(),a.clearCache(),this.sb.globalTimer&&(clearInterval(this.sb.globalTimer),this.sb.globalTimer=null),r)clearTimeout(r[u].timer);this.sb.currentUser=null,t.set("ackStateMap",{}),t.set("subscribedUnreadMessageCount",{all:0,custom_types:{},ts:0}),t.set("auth",new E)}l&&(this.flushConnectionCallbacks(l,null),this.sb.connecting=!1,this.sb.reconnecting=!1,this.sb.isReconnectingOnError=!1),n&&n(null,null)}},{key:"flushConnectionCallbacks",value:function(n,t){var e=this.sb.connectionCallbacks;this.sb.connectionCallbacks=[],e.forEach(function(e){return e(n,t)})}}]),n}(),O=function(){function f(e){var n=e.type,t=e.nullable,r=void 0!==t&&t,i=e.optional,a=void 0!==i&&i,s=e.optionalIf,o=void 0===s?null:s,l=e.ignoreIf,u=void 0===l?null:l,c=e.defaultValue,d=void 0===c?null:c,h=e.constraint,p=void 0===h?null:h;v(this,f),this.type=n,this.nullable=r,this.optional=a,this.optionalIf=o,this.ignoreIf=u,this.defaultValue=d,this.constraint=p}return s(f,[{key:"isMatchingType",value:function(t){function n(e,n){return"string"==typeof n?de(e)===n||"array"===n&&Array.isArray(e)||"file"===n&&ge.isFile(e)||"null"===n&&null===e||"date"===n&&e instanceof Date:"function"==typeof n?e instanceof n:"object"===de(n)&&-1m.ts){if(m.all!==b.unread_cnt.all&&(S=!0),m.all=0<=b.unread_cnt.all?b.unread_cnt.all:0,b.unread_cnt.custom_types)for(var I in b.unread_cnt.custom_types)m.custom_types[I]!==b.unread_cnt.custom_types[I]&&(S=!0),m.custom_types[I]=b.unread_cnt.custom_types[I];S=S&&0=H.createAt,a=v.sb.currentUser;a&&H._sender&&a.userId===H._sender.userId&&(a.nickname!==H._sender.nickname&&(a.nickname=H._sender.nickname),a.profileUrl!==H._sender.profileUrl&&(a.profileUrl=H._sender.profileUrl),ge.deepEqual(a.metaData,H._sender.metaData)||(a.metaData=H._sender.metaData));var s=!1;if((!H.sender||H.sender.userId!==G)&&!i&&b&&b.hasOwnProperty("old_values")){var o=b.old_values.mention_type||H.mentionType,l=b.old_values.mentioned_user_ids||H.mentionedUsers.map(function(e){return e.userId});if(o===C.MentionType.USERS&&H.mentionType===C.MentionType.USERS){for(var u=!1,c=!1,d=0;d=Ce.get(this)&&(Ce.set(this,t),this.memberCount=e,this.joinedMemberCount=n)}},{key:"hide",value:function(i,a,e){var n,s=this,t=C(O.parse(arguments,[new O({type:"boolean",optional:!0,defaultValue:!1}),new O({type:"boolean",optional:!0,defaultValue:!0}),new O({type:"callback"})]),4);return n=t[0],i=t[1],a=t[2],e=t[3],Q(this._iid,function(r){n?r(n,null):pe.get(s._iid).container.apiClient.hideGroupChannel({channelUrl:s.url,hidePreviousMessages:i,allowAutoUnhide:a},function(e,n){if(!e){var t=D.get(s._iid).GroupChannel;s.isHidden=!0,s.hiddenState=a?t.HiddenState.HIDDEN_ALLOW_AUTO_UNHIDE:t.HiddenState.HIDDEN_PREVENT_AUTO_UNHIDE,i&&s._setGroupChannelUnreadCount(0,0),n.hasOwnProperty("ts_message_offset")&&(s._messageOffsetTimestamp=n.ts_message_offset),t.cachedChannels[s.url]=s}r(e,n)})},e)}},{key:"unhide",value:function(e){var i=this;return Q(this._iid,function(r){pe.get(i._iid).container.apiClient.unhideGroupChannel({channelUrl:i.url},function(e,n){if(!e){var t=D.get(i._iid).GroupChannel;i.isHidden=!1,i.hiddenState=t.HiddenState.UNHIDDEN,t.cachedChannels[i.url]=i}r(e,n)})},e)}},{key:"freeze",value:function(e){var r=this;return Q(this._iid,function(t){pe.get(r._iid).container.apiClient.freeze({channelUrl:r.url,isGroupChannel:!0,freezing:!0},function(e,n){e||D.get(r._iid).GroupChannel.upsert(n);t(e,null)})},e)}},{key:"unfreeze",value:function(e){var r=this;return Q(this._iid,function(t){pe.get(r._iid).container.apiClient.freeze({channelUrl:r.url,isGroupChannel:!0,freezing:!1},function(e,n){e||D.get(r._iid).GroupChannel.upsert(n);t(e,null)})},e)}},{key:"delete",value:function(e){var r=this;return Q(this._iid,function(t){pe.get(r._iid).container.apiClient.deleteGroupChannel({channelUrl:r.url},function(e,n){e||D.get(r._iid).GroupChannel.removeCachedChannel(r.url);t(e,n)})},e)}},{key:"markAsRead",value:function(){var i=this,e=D.get(this._iid).Command,a=Cn.getInstance(this._iid),n=e.bRead({channelUrl:this.url});a.sendCommand(n,function(e,n){if(a.getErrorFirstCallback()){var t=[e,n];n=t[0],e=t[1]}if(!n&&a.currentUser&&(i.updateReadReceipt(a.currentUser.userId,e.getJsonElement().ts),0=e.createdAt&&i.push(s)}return i}return[]}},{key:"getUnreadMembers",value:function(e,n){var t=1=t){r.end=0,r.start=n;var i=D.get(this._iid).Command.bTypeStart({channelUrl:this.url,time:r.start});e.sendCommand(i,null)}}},{key:"endTyping",value:function(){var e=Cn.getInstance(this._iid),n=(new Date).getTime(),t=e.Options.typingIndicatorThrottle;("number"!=typeof t||t<1e3||9e3=t){r.start=0,r.end=n;var i=D.get(this._iid).Command.bTypeEnd({channelUrl:this.url,time:r.end});e.sendCommand(i,null)}}},{key:"invalidateTypingStatus",value:function(){var e=ue.get(this),n=(new Date).getTime(),t=!1;for(var r in e){1e4<=n-e[r]&&(delete e[r],t=!0)}return t}},{key:"getTypingMembers",value:function(){var e=ue.get(this),n=[];for(var t in e){var r=this.memberMap[t];r&&n.push(r)}return n}},{key:"updateTypingStatus",value:function(e,n){var t=ue.get(this);n?t[e.userId]=(new Date).getTime():delete t[e.userId]}},{key:"isTyping",value:function(){var e=ue.get(this);return 0!==Object.keys(e).length}},{key:"registerScheduledUserMessage",value:function(e,n){var t,a=this,r=D.get(this._iid),s=r.ScheduledUserMessage,i=r.ScheduledUserMessageParams,o=C(O.parse(arguments,[new O({type:i,constraint:function(e){return"string"==typeof e.message&&"string"==typeof e._getScheduleString()}}),new O({type:"callback"})]),3);return t=o[0],e=o[1],n=o[2],Q(this._iid,function(i){t?i(t,null):pe.get(a._iid).container.apiClient.registerScheduledUserMessage({groupChannelParams:e,channelUrl:a.url,isOpenChannel:!1},function(e,n){var t=null;if(!e){t=new s(n);var r=Cn.getInstance(a._iid).currentUser;r&&t._sender&&r.userId===t._sender.userId&&(r.nickname=t._sender.nickname,r.profileUrl=t._sender.profileUrl,r.metaData=t._sender.metaData)}i(e,t)})},n)}},{key:"getPushPreference",value:function(e){var i=this;return Q(this._iid,function(r){pe.get(i._iid).container.apiClient.getMyPushTriggerOption({channelUrl:i.url},function(e,n){var t=null;if(!e){try{t=n.enable}catch(e){t=!1}i.isPushEnabled=t}r&&r(e,t)})},e)}},{key:"setPushPreference",value:function(e,n){var i=this;return Q(this._iid,function(t){var r=D.get(i._iid).GroupChannel;pe.get(i._iid).container.apiClient.setMyPushTriggerOption({channelUrl:i.url,enable:e},function(e,n){e||(i.isPushEnabled=n.enable,i.isPushEnabled||(i.myPushTriggerOption=r.PushTriggerOption.OFF)),t(e,n)})},n)}},{key:"getMyPushTriggerOption",value:function(e){var i=this;return Q(this._iid,function(r){pe.get(i._iid).container.apiClient.getMyPushTriggerOption({channelUrl:i.url},function(e,n){var t=null;if(!e){try{t=n.push_trigger_option||a.PushTriggerOption.DEFAULT}catch(e){_e.debug(e)}i.myPushTriggerOption=t}r(e,t)})},e)}},{key:"setMyPushTriggerOption",value:function(e,n){var t,i=this,r=D.get(this._iid).GroupChannel,a=C(O.parse(arguments,[new O({type:r.PushTriggerOption}),new O({type:"callback"})]),3);return t=a[0],e=a[1],n=a[2],Q(this._iid,function(r){t?r(t,null):pe.get(i._iid).container.apiClient.setMyPushTriggerOption({channelUrl:i.url,pushTriggerOption:e},function(e,n){var t=null;if(!e){try{t=n.push_trigger_option}catch(e){_e.debug(e)}i.myPushTriggerOption=t}r(e,t)})},n)}},{key:"setMyCountPreference",value:function(e,n){var t,i=this,a=D.get(this._iid).GroupChannel,r=C(O.parse(arguments,[new O({type:a.CountPreference}),new O({type:"callback"})]),3);return t=r[0],e=r[1],n=r[2],Q(this._iid,function(r){t?r(t,null):pe.get(i._iid).container.apiClient.setMyCountPreference({channelUrl:i.url,countPreference:e},function(e,n){var t=null;e||(t=i.myCountPreference=n.count_preference,i._setGroupChannelUnreadCount(i.unreadMessageCount,i.unreadMentionCount),a.cachedChannels[i.url]=i),r(e,t)})},n)}},{key:"resetMyHistory",value:function(e){var i=this;return Q(this._iid,function(r){pe.get(i._iid).container.apiClient.resetMyHistory({channelUrl:i.url},function(e,n){if(!e&&n.hasOwnProperty("ts_message_offset")){var t=D.get(i._iid).GroupChannel;i._messageOffsetTimestamp=n.ts_message_offset,t.cachedChannels[i.url]=i}r(e,n)})},e)}},{key:"messageOffsetTimestamp",get:function(){return this._messageOffsetTimestamp}}],[{key:"buildFromSerializedData",value:function(e){var n,t=D.get(this._iid),r=t.User,i=t.Member,a=t.GroupChannel,s=t.BaseMessage,o=t.UserMessage,l=t.FileMessage,u=t.AdminMessage,c=q.deserialize(e);return new a({channel_url:c.url,name:c.name,cover_url:c.coverUrl,data:c.data,custom_type:c.customType,invited_at:c.invitedAt,created_at:c.createdAt/1e3,is_access_code_required:c.isAccessCodeRequired,is_distinct:c.isDistinct,is_super:c.isSuper,is_broadcast:c.isBroadcast,is_public:c.isPublic,is_discoverable:c.isDiscoverable,freeze:c.isFrozen,is_ephemeral:c.isEphemeral,unread_message_count:c.unreadMessageCount,unread_mention_count:c.unreadMentionCount,is_push_enabled:c.isPushEnabled,push_trigger_option:c.myPushTriggerOption,count_preference:c.myCountPreference,is_hidden:c.isHidden,hidden_state:c.hiddenState,member_count:c.memberCount,joined_member_count:c.joinedMemberCount,member_state:c.myMemberState,my_role:c.myRole,is_muted:c.myMutedState,user_last_read:c.myLastRead,ts_message_offset:c.messageOffsetTimestamp,message_survival_seconds:c.messageSurvivalSeconds,read_receipt:c.cachedReadReceiptStatus,delivery_receipt:c.cachedDeliveryReceiptStatus,members:c.members.map(function(e){return i.build(r.build(e.userId,e.nickname,e.profileUrl,e.connectionStatus,e.lastSeenAt,e.metaData,e.isActive,e.friendDiscoveryKey,e.friendName),e.state,e.role,e.isBlockedByMe,e.isBlockingMe)}),last_message:null!=(n=c.lastMessage)&&"object"===de(n)?n.messageType===s.MESSAGE_TYPE_USER?new o(o.build(n.reqId,n.messageId,n.user,{url:n.channelUrl,channelType:n.channelType},n.message,n.data,n.customType,n.translations,n.isGlobalBlocked,n.createdAt,n.updatedAt,n.metaArrays,n.mentionType,n.mentionedUsers,n.mentionedUserIds,n.sendingStatus,n.requestedMentionUserIds)):n.messageType===s.MESSAGE_TYPE_FILE?new l(l.build(n.reqId,n.messageId,n.user,{url:n.channelUrl,channelType:n.channelType},n.url,n.name,n.type,n.size,n.data,n.customType,n.isGlobalBlocked,n.createdAt,n.thumbnails,n.requireAuth,n.updatedAt,n.metaArrays,n.mentionType,n.mentionedUsers,n.mentionedUserIds,n.sendingStatus,n.requestedMentionUserIds)):new u(u.build(n.messageId,{url:n.channelUrl,channelType:n.channelType},n.message,n.data,n.customType,n.translations,n.createdAt,n.updatedAt,n.metaArrays,n.mentionType,n.mentionedUsers)):null,inviter:null!==c.inviter&&void 0!==c.inviter&&"object"===de(c.inviter)?r.build.apply(r,S(["userId","nickname","profileUrl","connectionStatus","lastSeenAt","metaData","isActive","friendDiscoveryKey","friendName"].map(function(e){return c.inviter[e]}))):null,__wk:c.__wk})}},{key:"upsert",value:function(e){var n=D.get(this._iid).GroupChannel,t=new n(e);if(n.cachedChannels.hasOwnProperty(t.url)){if(t.isEphemeral){var r=n.cachedChannels[t.url];e.last_message=r.lastMessage,e.unread_message_count=r.unreadMessageCount}n.cachedChannels[t.url].update(e)}else n.cachedChannels[t.url]=t;return n.cachedChannels[t.url]}},{key:"removeCachedChannel",value:function(e){var n=D.get(this._iid),t=n.GroupChannel,r=n.FileMessageQueue;t.cachedChannels[e]&&delete t.cachedChannels[e],r.delete(e)}},{key:"clearCache",value:function(){oe[this._iid]={},D.get(this._iid).FileMessageQueue.clear()}},{key:"getChannel",value:function(n,e){var t,r=C(O.parse(arguments,[new O({type:"string"}),new O({type:"callback"})]),3);if(t=r[0],n=r[1],e=r[2],t)return Q(this._iid,function(e){e(t,null)},e);var i=D.get(this._iid).GroupChannel;return i.cachedChannels[n]?Q(this._iid,function(e){e(null,i.cachedChannels[n])},e):i.getChannelWithoutCache(n,e)}},{key:"getChannelWithoutCache",value:function(e,n){var t,i=this,r=C(O.parse(arguments,[new O({type:"string"}),new O({type:"callback"})]),3);return t=r[0],e=r[1],n=r[2],Q(this._iid,function(r){t?r(t,null):pe.get(i._iid).container.apiClient.getGroupChannel({channelUrl:e,showMember:!0},function(e,n){var t=null;e||(t=D.get(i._iid).GroupChannel.upsert(n));r(e,t)})},n)}},{key:"createDistinctChannelIfNotExist",value:function(e,n){var t,a=this,r=D.get(this._iid).GroupChannelParams,i=C(O.parse(arguments,[new O({type:r,constraint:function(e){return e._validate()}}),new O({type:"callback"})]),3);return t=i[0],e=i[1],n=i[2],Q(this._iid,function(i){t?i(t,null):(e.isPublic||(e.accessCode=null),pe.get(a._iid).container.apiClient.createGroupChannel(_(_({},e),{},{isDistinct:!0}),function(e,n){var t=null;if(!e){var r=D.get(a._iid).GroupChannel;t={channel:new r(n),isCreated:n.is_created},r.cachedChannels[t.channel.url]=t.channel}i(e,t)}))},n)}},{key:"createChannel",value:function(){var n=this,t=O.toArray(arguments),e=void 0;"function"==typeof t[t.length-1]&&(e=t.pop());var r=D.get(this._iid),i=r.GroupChannel,a=r.GroupChannelParams;if(t[0]instanceof a&&1===t.length)return Q(this._iid,function(r){var e=t[0];(e.isPublic||(e.accessCode=null),e._validate())?pe.get(n._iid).container.apiClient.createGroupChannel(e,function(e,n){var t=null;e||(t=new i(n),i.cachedChannels[t.url]=t),r(e,t)}):r(O.error,null)},e);if(Array.isArray(t[0])){var s=new a;switch(t.length){case 1:s.addUsers(t[0]);break;case 2:s.addUsers(t[0]),s.isDistinct=t[1];break;case 3:s.addUsers(t[0]),s.isDistinct=t[1],s.customType=t[2];break;case 5:s.addUsers(t[0]),s.isDistinct=t[1],s.name=t[2],"string"==typeof t[3]?s.coverUrl=t[3]:s.coverImage=t[3],s.data=t[4];break;case 6:s.addUsers(t[0]),s.isDistinct=t[1],s.name=t[2],"string"==typeof t[3]?s.coverUrl=t[3]:s.coverImage=t[3],s.data=t[4],s.customType=t[5];break;default:return Q(this._iid,function(e){return e(O.error,null)},e)}return i.createChannel(s,e)}return Q(this._iid,function(e){return e(O.error,null)},e)}},{key:"createChannelWithUserIds",value:function(){var e=O.toArray(arguments),n=void 0;"function"==typeof e[e.length-1]&&(n=e.pop());var t=D.get(this._iid),r=t.GroupChannel,i=new t.GroupChannelParams;switch(e.length){case 1:i.addUserIds(e[0]);break;case 2:i.addUserIds(e[0]),i.isDistinct=e[1];break;case 3:i.addUserIds(e[0]),i.isDistinct=e[1],i.customType=e[2];break;case 5:i.addUserIds(e[0]),i.isDistinct=e[1],i.name=e[2],"string"==typeof e[3]?i.coverUrl=e[3]:i.coverImage=e[3],i.data=e[4];break;case 6:i.addUserIds(e[0]),i.isDistinct=e[1],i.name=e[2],"string"==typeof e[3]?i.coverUrl=e[3]:i.coverImage=e[3],i.data=e[4],i.customType=e[5];break;default:return Q(this._iid,function(e){return e(O.error,null)},n)}return r.createChannel(i,n)}},{key:"createMyGroupChannelListQuery",value:function(){return new(D.get(this._iid).GroupChannelListQuery)}},{key:"createPublicGroupChannelListQuery",value:function(){return new(D.get(this._iid).PublicGroupChannelListQuery)}},{key:"getChannelCount",value:function(e,n){return Cn.getInstance(this._iid).getGroupChannelCount(e,n)}},{key:"getUnreadItemCount",value:function(e,n){return Cn.getInstance(this._iid).getUnreadItemCount(e,n)}},{key:"getTotalUnreadMessageCount",value:function(){var e=O.toArray(arguments),n="function"==typeof e[e.length-1]?e.pop():null,t=Cn.getInstance(this._iid);return t.getTotalUnreadMessageCount.apply(t,S(e).concat([n]))}},{key:"getTotalUnreadChannelCount",value:function(e){return Cn.getInstance(this._iid).getTotalUnreadChannelCount(e)}},{key:"MemberStateFilter",get:function(){return{ALL:"all",JOINED:"joined_only",INVITED:"invited_only",INVITED_BY_FRIEND:"invited_by_friend",INVITED_BY_NON_FRIEND:"invited_by_non_friend"}}},{key:"PushTriggerOption",get:function(){return{DEFAULT:"default",ALL:"all",MENTION_ONLY:"mention_only",OFF:"off"}}},{key:"CountPreference",get:function(){return{ALL:"all",UNREAD_MESSAGE_COUNT_ONLY:"unread_message_count_only",UNREAD_MENTION_COUNT_ONLY:"unread_mention_count_only",OFF:"off"}}},{key:"HiddenState",get:function(){return{UNHIDDEN:"unhidden",HIDDEN_ALLOW_AUTO_UNHIDE:"hidden_allow_auto_unhide",HIDDEN_PREVENT_AUTO_UNHIDE:"hidden_prevent_auto_unhide"}}},{key:"PublicChannelFilter",get:function(){return{ALL:"all",PUBLIC:"public",PRIVATE:"private"}}},{key:"SuperChannelFilter",get:function(){return{ALL:"all",SUPER:"super",NON_SUPER:"nonsuper"}}},{key:"UnreadChannelFilter",get:function(){return{ALL:"all",UNREAD_MESSAGE:"unread_message"}}},{key:"HiddenChannelFilter",get:function(){return{UNHIDDEN:"unhidden_only",HIDDEN:"hidden_only",HIDDEN_ALLOW_AUTO_UNHIDE:"hidden_allow_auto_unhide",HIDDEN_PREVENT_AUTO_UNHIDE:"hidden_prevent_auto_unhide"}}},{key:"Role",get:function(){return{OPERATOR:"operator",NONE:"none"}}},{key:"UnreadItemKey",get:function(){return{GROUP_CHANNEL_UNREAD_MENTION_COUNT:"group_channel_unread_mention_count",NONSUPER_UNREAD_MENTION_COUNT:"non_super_group_channel_unread_mention_count",SUPER_UNREAD_MENTION_COUNT:"super_group_channel_unread_mention_count",GROUP_CHANNEL_UNREAD_MESSAGE_COUNT:"group_channel_unread_message_count",NONSUPER_UNREAD_MESSAGE_COUNT:"non_super_group_channel_unread_message_count",SUPER_UNREAD_MESSAGE_COUNT:"super_group_channel_unread_message_count",GROUP_CHANNEL_INVITATION_COUNT:"group_channel_invitation_count",NONSUPER_INVITATION_COUNT:"non_super_group_channel_invitation_count",SUPER_INVITATION_COUNT:"super_group_channel_invitation_count"}}},{key:"cachedChannels",get:function(){return oe[this._iid]||(oe[this._iid]={}),oe[this._iid]}},{key:"markAsReadAllLastSentAt",get:function(){return le[this._iid]||0},set:function(e){le[this._iid]=e}}]),a}(),Ue=function(){o(r,V);var t=h(r);function r(e){var n;return v(this,r),(n=t.call(this,e)).state="",n.role="",n.isBlockedByMe=!1,n.isBlockingMe=!1,e&&n._update(e),n}return s(r,[{key:"_update",value:function(e){this.state=e.state,this.role=e.role||Ee.Role.NONE,e.hasOwnProperty("is_blocked_by_me")&&(this.isBlockedByMe=e.is_blocked_by_me),e.hasOwnProperty("is_blocking_me")&&(this.isBlockingMe=e.is_blocking_me)}},{key:"parse",value:function(e){this._update(e)}}],[{key:"build",value:function(e,n,t,r,i){var a=e;return a.state=n,a.role=t||"",a.is_blocked_by_me=r||!1,a.is_blocking_me=i||!1,a}},{key:"buildFromSerializedData",value:function(e){var n=D.get(this._iid),t=n.User,r=n.Member,i=q.deserialize(e);return new r(r.build(t.build(i.userId,i.nickname,i.profileUrl,i.connectionStatus,i.lastSeenAt,i.metaData,i.isActive,i.friendDiscoveryKey,i.friendName),i.state,i.role,i.isBlockedByMe,i.isBlockingMe))}},{key:"JOINED",get:function(){return"joined"}},{key:"INVITED",get:function(){return"invited"}}]),r}(),be=function(){o(r,V);var t=h(r);function r(e){var n;return v(this,r),(n=t.call(this,e)).isBlockedByMe=!1,e&&n._update(e),n}return s(r,[{key:"parse",value:function(e){this._update(e)}},{key:"_update",value:function(e){e.hasOwnProperty("is_blocked_by_me")&&(this.isBlockedByMe=e.is_blocked_by_me)}}],[{key:"build",value:function(e,n){var t=e;return t.is_blocked_by_me=n||!1,t}},{key:"buildFromSerializedData",value:function(e){var n=D.get(this._iid),t=n.User,r=n.Sender,i=q.deserialize(e);return new r(r.build(t.build.apply(t,S(["userId","nickname","profileUrl","connectionStatus","lastSeenAt","metaData","isActive","friendDiscoveryKey","friendName"].map(function(e){return i[e]}))),i.isBlockedByMe))}}]),r}(),Se=function(){function n(e){v(this,n),this.emojiHash=null,this.emojiCategories=null,e&&this._update(e)}return s(n,[{key:"_update",value:function(e){var n=D.get(this._iid).EmojiCategory;this.emojiHash=e.emoji_hash||"",this.emojiCategories=e.emoji_categories?e.emoji_categories.map(function(e){return new n(e)}):[]}}]),n}(),Ae=function(){function n(e){v(this,n),this.id=null,this.name=null,this.url=null,this.emojis=null,e&&this._update(e)}return s(n,[{key:"_update",value:function(e){var n=D.get(this._iid).Emoji;this.id=e.id||"",this.name=e.name||"",this.url=e.url||"",this.emojis=e.emojis?e.emojis.map(function(e){return new n(e)}):[]}}]),n}(),Ie=function(){function n(e){v(this,n),this.key=null,this.url=null,e&&this._update(e)}return s(n,[{key:"_update",value:function(e){this.key=e.key,this.url=e.url}}]),n}(),Ne={},ke={},Re=function(){o(r,J);var t=h(r);function r(e){var n;return v(this,r),(n=t.call(this,e)).channelType=J.CHANNEL_TYPE_OPEN,n.participantCount=0,n.operators=[],e&&n._update(e),n}return s(r,[{key:"_update",value:function(e){var n=D.get(this._iid).User;if(e.hasOwnProperty("participant_count")&&(this.participantCount=parseInt(e.participant_count)),e.hasOwnProperty("operators")&&e.operators){this.operators=[];for(var t=0;t"], "homepage": "https://github.com/sendbird/SendBird-SDK-JavaScript", "description": "SendBird JavaScript SDK", diff --git a/package.json b/package.json index 85d508e..7ce1050 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sendbird", - "version": "3.0.123", + "version": "3.0.124", "description": "SendBird JavaScript SDK", "main": "SendBird.min.js", "dependencies": {