@sendbird/uikit-chat-hooks 3.0.4 → 3.1.1
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/lib/commonjs/channel/useChannelMessagesReducer.js +60 -11
- package/lib/commonjs/channel/useChannelMessagesReducer.js.map +1 -1
- package/lib/commonjs/channel/useGroupChannelMessages/useGroupChannelMessagesWithCollection.js +94 -83
- package/lib/commonjs/channel/useGroupChannelMessages/useGroupChannelMessagesWithCollection.js.map +1 -1
- package/lib/commonjs/channel/useGroupChannelMessages/useGroupChannelMessagesWithQuery.js +44 -26
- package/lib/commonjs/channel/useGroupChannelMessages/useGroupChannelMessagesWithQuery.js.map +1 -1
- package/lib/commonjs/channel/useOpenChannelMessages/useOpenChannelMessagesWithQuery.js +46 -28
- package/lib/commonjs/channel/useOpenChannelMessages/useOpenChannelMessagesWithQuery.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/channel/useChannelMessagesReducer.js +61 -12
- package/lib/module/channel/useChannelMessagesReducer.js.map +1 -1
- package/lib/module/channel/useGroupChannelMessages/useGroupChannelMessagesWithCollection.js +96 -85
- package/lib/module/channel/useGroupChannelMessages/useGroupChannelMessagesWithCollection.js.map +1 -1
- package/lib/module/channel/useGroupChannelMessages/useGroupChannelMessagesWithQuery.js +44 -26
- package/lib/module/channel/useGroupChannelMessages/useGroupChannelMessagesWithQuery.js.map +1 -1
- package/lib/module/channel/useOpenChannelMessages/useOpenChannelMessagesWithQuery.js +46 -28
- package/lib/module/channel/useOpenChannelMessages/useOpenChannelMessagesWithQuery.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/src/types.d.ts +1 -0
- package/package.json +5 -5
- package/src/channel/useChannelMessagesReducer.ts +66 -17
- package/src/channel/useGroupChannelMessages/useGroupChannelMessagesWithCollection.ts +75 -84
- package/src/channel/useGroupChannelMessages/useGroupChannelMessagesWithQuery.ts +26 -22
- package/src/channel/useOpenChannelMessages/useOpenChannelMessagesWithQuery.ts +31 -26
- package/src/types.ts +1 -0
package/lib/commonjs/channel/useGroupChannelMessages/useGroupChannelMessagesWithCollection.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_groupChannel","_uikitUtils","_useChannelHandler","_useChannelMessagesReducer","MESSAGE_LIMIT","DEFAULT","SEARCH","createMessageCollection","channel","limit","options","collectionCreator","startingPoint","filter","MessageFilter","replyType","isNotEmpty","arr","length","useGroupChannelMessagesWithCollection","sdk","userId","initialStartingPoint","Number","MAX_SAFE_INTEGER","initialLimit","forceUpdate","useForceUpdate","collectionRef","useRef","collectionInitializedRef","handlerId","useUniqHandlerId","loading","refreshing","messages","newMessages","updateMessages","updateNewMessages","deleteNewMessages","deleteMessages","updateLoading","updateRefreshing","useChannelMessagesReducer","sortComparator","channelMarkAsRead","source","MessageEventSource","EVENT_MESSAGE_RECEIVED","EVENT_MESSAGE_SENT_SUCCESS","SYNC_MESSAGE_FILL","undefined","confirmAndMarkAsRead","e","Logger","warn","updateUnsendMessages","pendingMessages","failedMessages","current","currentUser","init","useFreshCallback","callback","_collectionRef$curren","_collectionRef$curren2","dispose","setMessageCollectionHandler","onMessagesAdded","_","__","incomingMessages","it","EVENT_MESSAGE_SENT_PENDING","EVENT_MESSAGE_SENT_FAILED","isMyMessage","_options$shouldCountN","shouldCountNewMessages","call","_options$onMessagesRe","onMessagesReceived","onMessagesUpdated","EVENT_MESSAGE_UPDATED","_options$shouldCountN2","onMessagesDeleted","messageIds","onChannelDeleted","_options$onChannelDel","onChannelUpdated","eventChannel","isGroupChannel","isDifferentChannel","onHugeGapDetected","initialize","MessageCollectionInitPolicy","CACHE_AND_REPLACE_BY_API","onCacheResult","err","isCacheEnabled","error","debug","onApiResult","_options$onMessagesRe2","useChannelHandler","onUserBanned","bannedUser","_options$onChannelDel2","useEffect","setTimeout","url","_collectionRef$curren3","refresh","prev","_collectionRef$curren4","hasPrevious","_collectionRef$curren5","list","loadPrevious","hasPrev","next","_collectionRef$curren6","hasNext","_collectionRef$curren7","fetchedList","loadNext","sendUserMessage","params","onPending","Promise","resolve","reject","pendingMessage","isUserMessage","onSucceeded","sentMessage","onFailed","failedMessage","sendFileMessage","isFileMessage","updateUserMessage","messageId","updatedMessage","updateFileMessage","resendMessage","resentMessage","resendUserMessage","resendFileMessage","deleteMessage","message","sendingStatus","_collectionRef$curren8","removeFailedMessage","reqId","resetNewMessages","resetWithStartingPoint","exports"],"sources":["useGroupChannelMessagesWithCollection.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nimport { MessageCollectionInitPolicy, MessageEventSource, MessageFilter } from '@sendbird/chat/groupChannel';\nimport type { SendbirdFileMessage, SendbirdGroupChannel, SendbirdMessageCollection } from '@sendbird/uikit-utils';\nimport {\n Logger,\n confirmAndMarkAsRead,\n isDifferentChannel,\n isMyMessage,\n useForceUpdate,\n useFreshCallback,\n useUniqHandlerId,\n} from '@sendbird/uikit-utils';\n\nimport { useChannelHandler } from '../../handler/useChannelHandler';\nimport type { UseGroupChannelMessages, UseGroupChannelMessagesOptions } from '../../types';\nimport { useChannelMessagesReducer } from '../useChannelMessagesReducer';\n\nconst MESSAGE_LIMIT = {\n DEFAULT: 50,\n SEARCH: 20,\n};\n\nconst createMessageCollection = (\n channel: SendbirdGroupChannel,\n limit: number,\n options: UseGroupChannelMessagesOptions,\n) => {\n if (options?.collectionCreator) return options?.collectionCreator({ startingPoint: options?.startingPoint });\n\n const filter = new MessageFilter();\n if (options.replyType) filter.replyType = options.replyType;\n\n return channel.createMessageCollection({ filter, limit, startingPoint: options?.startingPoint });\n};\n\nfunction isNotEmpty(arr?: unknown[]): arr is unknown[] {\n if (!arr) return false;\n return arr.length !== 0;\n}\n\nexport const useGroupChannelMessagesWithCollection: UseGroupChannelMessages = (sdk, channel, userId, options) => {\n const initialStartingPoint = options?.startingPoint ?? Number.MAX_SAFE_INTEGER;\n const initialLimit = typeof options?.startingPoint === 'number' ? MESSAGE_LIMIT.SEARCH : MESSAGE_LIMIT.DEFAULT;\n\n const forceUpdate = useForceUpdate();\n const collectionRef = useRef<SendbirdMessageCollection>();\n const collectionInitializedRef = useRef(false);\n const handlerId = useUniqHandlerId('useGroupChannelMessagesWithCollection');\n\n const {\n loading,\n refreshing,\n messages,\n newMessages,\n updateMessages,\n updateNewMessages,\n deleteNewMessages,\n deleteMessages,\n updateLoading,\n updateRefreshing,\n } = useChannelMessagesReducer(options?.sortComparator);\n\n const channelMarkAsRead = async (source?: MessageEventSource) => {\n try {\n switch (source) {\n case MessageEventSource.EVENT_MESSAGE_RECEIVED:\n case MessageEventSource.EVENT_MESSAGE_SENT_SUCCESS:\n case MessageEventSource.SYNC_MESSAGE_FILL:\n case undefined:\n await confirmAndMarkAsRead([channel]);\n break;\n }\n } catch (e) {\n Logger.warn('[useGroupChannelMessagesWithCollection/channelMarkAsRead]', e);\n }\n };\n\n const updateUnsendMessages = () => {\n const { pendingMessages, failedMessages } = collectionRef.current ?? {};\n if (isNotEmpty(pendingMessages)) updateMessages(pendingMessages, false, sdk.currentUser.userId);\n if (isNotEmpty(failedMessages)) updateMessages(failedMessages, false, sdk.currentUser.userId);\n };\n\n const init = useFreshCallback(async (startingPoint: number, limit: number, callback?: () => void) => {\n if (collectionRef.current) collectionRef.current?.dispose();\n\n channelMarkAsRead();\n updateNewMessages([], true, sdk.currentUser.userId);\n\n collectionInitializedRef.current = false;\n collectionRef.current = createMessageCollection(channel, limit, {\n ...options,\n startingPoint,\n });\n\n collectionRef.current?.setMessageCollectionHandler({\n onMessagesAdded: (_, __, messages) => {\n channelMarkAsRead(_.source);\n\n const incomingMessages = messages.filter((it) => {\n switch (_.source) {\n case MessageEventSource.EVENT_MESSAGE_SENT_PENDING:\n case MessageEventSource.EVENT_MESSAGE_SENT_SUCCESS:\n case MessageEventSource.EVENT_MESSAGE_SENT_FAILED:\n return !isMyMessage(it, sdk.currentUser.userId);\n default:\n return true;\n }\n });\n\n if (incomingMessages.length > 0) {\n updateMessages(incomingMessages, false, sdk.currentUser.userId);\n\n if (options?.shouldCountNewMessages?.()) {\n updateNewMessages(incomingMessages, false, sdk.currentUser.userId);\n }\n\n switch (_.source) {\n case MessageEventSource.EVENT_MESSAGE_RECEIVED:\n case MessageEventSource.SYNC_MESSAGE_FILL: {\n options?.onMessagesReceived?.(incomingMessages);\n }\n }\n }\n },\n onMessagesUpdated: (_, __, messages) => {\n channelMarkAsRead(_.source);\n\n const incomingMessages = messages.filter((it) => {\n switch (_.source) {\n case MessageEventSource.EVENT_MESSAGE_UPDATED:\n return !isMyMessage(it, sdk.currentUser.userId);\n default:\n return true;\n }\n });\n\n if (incomingMessages.length > 0) {\n // NOTE: admin message is not added via onMessagesAdded handler, not checked yet is this a bug.\n updateMessages(messages, false, sdk.currentUser.userId);\n\n if (options?.shouldCountNewMessages?.()) {\n if (_.source === MessageEventSource.EVENT_MESSAGE_RECEIVED) {\n updateNewMessages(messages, false, sdk.currentUser.userId);\n }\n }\n }\n },\n onMessagesDeleted: (_, __, messageIds) => {\n deleteMessages(messageIds, []);\n deleteNewMessages(messageIds, []);\n },\n onChannelDeleted: () => {\n options?.onChannelDeleted?.();\n },\n onChannelUpdated: (_, eventChannel) => {\n if (eventChannel.isGroupChannel() && !isDifferentChannel(eventChannel, channel)) {\n forceUpdate();\n }\n },\n onHugeGapDetected: () => {\n init(Number.MAX_SAFE_INTEGER, MESSAGE_LIMIT.DEFAULT);\n },\n });\n\n collectionRef.current\n .initialize(MessageCollectionInitPolicy.CACHE_AND_REPLACE_BY_API)\n .onCacheResult((err, messages) => {\n if (err) sdk.isCacheEnabled && Logger.error('[useGroupChannelMessagesWithCollection/onCacheResult]', err);\n else {\n Logger.debug('[useGroupChannelMessagesWithCollection/onCacheResult]', 'message length:', messages.length);\n\n updateMessages(messages, true, sdk.currentUser.userId);\n updateUnsendMessages();\n }\n\n callback?.();\n })\n .onApiResult((err, messages) => {\n if (err) Logger.warn('[useGroupChannelMessagesWithCollection/onApiResult]', err);\n else {\n Logger.debug('[useGroupChannelMessagesWithCollection/onApiResult]', 'message length:', messages.length);\n\n updateMessages(messages, true, sdk.currentUser.userId);\n if (!options?.startingPoint) options?.onMessagesReceived?.(messages);\n if (sdk.isCacheEnabled) updateUnsendMessages();\n }\n\n collectionInitializedRef.current = true;\n callback?.();\n });\n });\n\n useChannelHandler(sdk, handlerId, {\n onUserBanned(channel, bannedUser) {\n if (channel.isGroupChannel() && !isDifferentChannel(channel, channel)) {\n if (bannedUser.userId === sdk.currentUser.userId) {\n options?.onChannelDeleted?.();\n } else {\n forceUpdate();\n }\n }\n },\n });\n\n useEffect(() => {\n // NOTE: Cache read is heavy task, and it prevents smooth ui transition\n setTimeout(async () => {\n updateLoading(true);\n init(initialStartingPoint, initialLimit, () => updateLoading(false));\n }, 0);\n }, [channel.url, userId]);\n\n useEffect(() => {\n return () => {\n if (collectionRef.current) collectionRef.current?.dispose();\n };\n }, []);\n\n const refresh: ReturnType<UseGroupChannelMessages>['refresh'] = useFreshCallback(async () => {\n updateRefreshing(true);\n init(Number.MAX_SAFE_INTEGER, MESSAGE_LIMIT.DEFAULT, () => updateRefreshing(false));\n });\n\n const prev: ReturnType<UseGroupChannelMessages>['prev'] = useFreshCallback(async () => {\n if (collectionRef.current && collectionRef.current?.hasPrevious) {\n try {\n const list = await collectionRef.current?.loadPrevious();\n updateMessages(list, false, sdk.currentUser.userId);\n } catch {}\n }\n });\n\n const hasPrev: ReturnType<UseGroupChannelMessages>['hasPrev'] = useFreshCallback(() => {\n if (collectionInitializedRef.current && collectionRef.current) {\n return collectionRef.current.hasPrevious;\n } else {\n return false;\n }\n });\n\n const next: ReturnType<UseGroupChannelMessages>['next'] = useFreshCallback(async () => {\n if (collectionRef.current && collectionRef.current?.hasNext) {\n try {\n const fetchedList = await collectionRef.current?.loadNext();\n updateMessages(fetchedList, false, sdk.currentUser.userId);\n } catch {}\n }\n });\n\n const hasNext: ReturnType<UseGroupChannelMessages>['hasNext'] = useFreshCallback(() => {\n if (collectionInitializedRef.current && collectionRef.current) {\n return collectionRef.current.hasNext;\n } else {\n return false;\n }\n });\n\n const sendUserMessage: ReturnType<UseGroupChannelMessages>['sendUserMessage'] = useFreshCallback(\n (params, onPending) => {\n return new Promise((resolve, reject) => {\n channel\n .sendUserMessage(params)\n .onPending((pendingMessage) => {\n if (pendingMessage.isUserMessage()) {\n onPending?.(pendingMessage);\n updateMessages([pendingMessage], false, sdk.currentUser.userId);\n }\n })\n .onSucceeded((sentMessage) => {\n if (sentMessage.isUserMessage()) {\n updateMessages([sentMessage], false, sdk.currentUser.userId);\n resolve(sentMessage);\n }\n })\n .onFailed((err, failedMessage) => {\n updateMessages([failedMessage], false, sdk.currentUser.userId);\n reject(err);\n });\n });\n },\n );\n const sendFileMessage: ReturnType<UseGroupChannelMessages>['sendFileMessage'] = useFreshCallback(\n (params, onPending) => {\n return new Promise((resolve, reject) => {\n channel\n .sendFileMessage(params)\n .onPending((pendingMessage) => {\n if (pendingMessage.isFileMessage()) {\n updateMessages([pendingMessage], false, sdk.currentUser.userId);\n onPending?.(pendingMessage);\n }\n })\n .onSucceeded((sentMessage) => {\n if (sentMessage.isFileMessage()) {\n updateMessages([sentMessage], false, sdk.currentUser.userId);\n resolve(sentMessage as SendbirdFileMessage);\n }\n })\n .onFailed((err, failedMessage) => {\n updateMessages([failedMessage], false, sdk.currentUser.userId);\n reject(err);\n });\n });\n },\n );\n const updateUserMessage: ReturnType<UseGroupChannelMessages>['updateUserMessage'] = useFreshCallback(\n async (messageId, params) => {\n const updatedMessage = await channel.updateUserMessage(messageId, params);\n updateMessages([updatedMessage], false, sdk.currentUser.userId);\n return updatedMessage;\n },\n );\n const updateFileMessage: ReturnType<UseGroupChannelMessages>['updateFileMessage'] = useFreshCallback(\n async (messageId, params) => {\n const updatedMessage = await channel.updateFileMessage(messageId, params);\n updateMessages([updatedMessage], false, sdk.currentUser.userId);\n return updatedMessage;\n },\n );\n const resendMessage: ReturnType<UseGroupChannelMessages>['resendMessage'] = useFreshCallback(\n async (failedMessage) => {\n const resentMessage = await (() => {\n if (failedMessage.isUserMessage()) return channel.resendUserMessage(failedMessage);\n if (failedMessage.isFileMessage()) return channel.resendFileMessage(failedMessage);\n return null;\n })();\n\n if (resentMessage) updateMessages([resentMessage], false, sdk.currentUser.userId);\n },\n );\n const deleteMessage: ReturnType<UseGroupChannelMessages>['deleteMessage'] = useFreshCallback(async (message) => {\n if (message.sendingStatus === 'succeeded') {\n if (message.isUserMessage()) await channel.deleteMessage(message);\n if (message.isFileMessage()) await channel.deleteMessage(message);\n } else {\n try {\n await collectionRef.current?.removeFailedMessage(message.reqId);\n } finally {\n deleteMessages([message.messageId], [message.reqId]);\n }\n }\n });\n const resetNewMessages: ReturnType<UseGroupChannelMessages>['resetNewMessages'] = useFreshCallback(() => {\n updateNewMessages([], true, sdk.currentUser.userId);\n });\n const resetWithStartingPoint: ReturnType<UseGroupChannelMessages>['resetWithStartingPoint'] = useFreshCallback(\n (startingPoint, callback) => {\n updateLoading(true);\n updateMessages([], true, sdk.currentUser.userId);\n init(startingPoint, MESSAGE_LIMIT.DEFAULT, () => {\n updateLoading(false);\n callback?.();\n });\n },\n );\n\n return {\n loading,\n refreshing,\n refresh,\n messages,\n next,\n hasNext,\n prev,\n hasPrev,\n newMessages,\n resetNewMessages,\n sendUserMessage,\n sendFileMessage,\n updateUserMessage,\n updateFileMessage,\n resendMessage,\n deleteMessage,\n resetWithStartingPoint,\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAUA,IAAAG,kBAAA,GAAAH,OAAA;AAEA,IAAAI,0BAAA,GAAAJ,OAAA;AAEA,MAAMK,aAAa,GAAG;EACpBC,OAAO,EAAE,EAAE;EACXC,MAAM,EAAE;AACV,CAAC;AAED,MAAMC,uBAAuB,GAAGA,CAC9BC,OAA6B,EAC7BC,KAAa,EACbC,OAAuC,KACpC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AAC;IACnBJ,cAAc,CAAC,EAAE,EAAE,IAAI,EAAEjB,GAAG,CAACwC,WAAW,CAACvC,MAAM,CAAC;IAChDwC,IAAI,CAACjD,aAAa,EAAER,aAAa,CAACC,OAAO,EAAE,MAAM;MAC/CoC,aAAa,CAAC,KAAK,CAAC;MACpBsB,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,EAAI;IACd,CAAC,CAAC;EACJ,CAAC,CACF;EAED,OAAO;IACL9B,OAAO;IACPC,UAAU;IACV6E,OAAO;IACP5E,QAAQ;IACRoF,IAAI;IACJE,OAAO;IACPT,IAAI;IACJM,OAAO;IACPlF,WAAW;IACXqH,gBAAgB;IAChB5B,eAAe;IACfY,eAAe;IACfE,iBAAiB;IACjBG,iBAAiB;IACjBC,aAAa;IACbI,aAAa;IACbO;EACF,CAAC;AACH,CAAC;AAACC,OAAA,CAAAxI,qCAAA,GAAAA,qCAAA"}
|
|
1
|
+
{"version":3,"names":["_react","require","_chat","_groupChannel","_uikitUtils","_useChannelHandler","_useChannelMessagesReducer","MESSAGE_LIMIT","DEFAULT","SEARCH","createMessageCollection","channel","limit","options","collectionCreator","startingPoint","filter","MessageFilter","replyType","isNotEmpty","arr","length","shouldUseSearchLimit","Date","now","useGroupChannelMessagesWithCollection","sdk","userId","initialStartingPoint","Number","MAX_SAFE_INTEGER","initialLimit","forceUpdate","useForceUpdate","collectionRef","useRef","collectionInitializedRef","handlerId","useUniqHandlerId","loading","refreshing","messages","newMessages","updateMessages","updateNewMessages","deleteNewMessages","deleteMessages","updateLoading","updateRefreshing","useChannelMessagesReducer","sortComparator","channelMarkAsRead","source","CollectionEventSource","EVENT_MESSAGE_RECEIVED","EVENT_MESSAGE_SENT_SUCCESS","SYNC_MESSAGE_FILL","undefined","confirmAndMarkAsRead","e","Logger","warn","updateNewMessagesReceived","incomingMessages","it","_sdk$currentUser","isMyMessage","currentUser","_options$shouldCountN","_sdk$currentUser2","_options$onMessagesRe","shouldCountNewMessages","call","onMessagesReceived","updateUnsentMessages","_sdk$currentUser3","_sdk$currentUser4","pendingMessages","failedMessages","current","init","useFreshCallback","callback","_collectionRef$curren","_sdk$currentUser5","_collectionRef$curren2","dispose","setMessageCollectionHandler","onMessagesAdded","ctx","__","_sdk$currentUser6","onMessagesUpdated","_sdk$currentUser7","EVENT_MESSAGE_UPDATED","_options$onMessagesUp","onMessagesDeleted","_","___","msgIds","map","messageId","reqIds","isSendableMessage","reqId","onChannelDeleted","_options$onChannelDel","onChannelUpdated","eventChannel","isGroupChannel","isDifferentChannel","onHugeGapDetected","initialize","MessageCollectionInitPolicy","CACHE_AND_REPLACE_BY_API","onCacheResult","err","isCacheEnabled","error","_sdk$currentUser8","debug","onApiResult","_sdk$currentUser9","_options$onMessagesRe2","useChannelHandler","onUserBanned","bannedUser","_sdk$currentUser10","_options$onChannelDel2","useEffect","setTimeout","url","_collectionRef$curren3","refresh","prev","_collectionRef$curren4","hasPrevious","_collectionRef$curren5","_sdk$currentUser11","list","loadPrevious","hasPrev","next","_collectionRef$curren6","hasNext","_collectionRef$curren7","_sdk$currentUser12","fetchedList","loadNext","sendUserMessage","params","onPending","Promise","resolve","reject","pendingMessage","isUserMessage","_sdk$currentUser13","onSucceeded","sentMessage","_sdk$currentUser14","onFailed","failedMessage","_sdk$currentUser15","sendFileMessage","isFileMessage","_sdk$currentUser16","_sdk$currentUser17","_sdk$currentUser18","updateUserMessage","_sdk$currentUser19","updatedMessage","updateFileMessage","_sdk$currentUser20","resendMessage","_sdk$currentUser21","resentMessage","resendUserMessage","resendFileMessage","deleteMessage","message","sendingStatus","_collectionRef$curren8","removeFailedMessage","resetNewMessages","_sdk$currentUser22","resetWithStartingPoint","_sdk$currentUser23","exports"],"sources":["useGroupChannelMessagesWithCollection.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nimport { CollectionEventSource } from '@sendbird/chat';\nimport { MessageCollectionInitPolicy, MessageFilter } from '@sendbird/chat/groupChannel';\nimport type { SendbirdFileMessage, SendbirdGroupChannel, SendbirdMessageCollection } from '@sendbird/uikit-utils';\nimport {\n Logger,\n SendbirdBaseMessage,\n confirmAndMarkAsRead,\n isDifferentChannel,\n isMyMessage,\n isSendableMessage,\n useForceUpdate,\n useFreshCallback,\n useUniqHandlerId,\n} from '@sendbird/uikit-utils';\n\nimport { useChannelHandler } from '../../handler/useChannelHandler';\nimport type { UseGroupChannelMessages, UseGroupChannelMessagesOptions } from '../../types';\nimport { useChannelMessagesReducer } from '../useChannelMessagesReducer';\n\nconst MESSAGE_LIMIT = {\n DEFAULT: 50,\n SEARCH: 20,\n};\n\nconst createMessageCollection = (\n channel: SendbirdGroupChannel,\n limit: number,\n options: UseGroupChannelMessagesOptions,\n) => {\n if (options?.collectionCreator) return options?.collectionCreator({ startingPoint: options?.startingPoint });\n\n const filter = new MessageFilter();\n if (options.replyType) filter.replyType = options.replyType;\n\n return channel.createMessageCollection({ filter, limit, startingPoint: options?.startingPoint });\n};\n\nfunction isNotEmpty(arr?: unknown[]): arr is unknown[] {\n if (!arr) return false;\n return arr.length !== 0;\n}\n\nfunction shouldUseSearchLimit(startingPoint: number) {\n return startingPoint < Date.now();\n}\n\nexport const useGroupChannelMessagesWithCollection: UseGroupChannelMessages = (sdk, channel, userId, options) => {\n const initialStartingPoint = options?.startingPoint ?? Number.MAX_SAFE_INTEGER;\n const initialLimit = shouldUseSearchLimit(initialStartingPoint) ? MESSAGE_LIMIT.SEARCH : MESSAGE_LIMIT.DEFAULT;\n\n const forceUpdate = useForceUpdate();\n const collectionRef = useRef<SendbirdMessageCollection>();\n const collectionInitializedRef = useRef(false);\n const handlerId = useUniqHandlerId('useGroupChannelMessagesWithCollection');\n\n const {\n loading,\n refreshing,\n messages,\n newMessages,\n updateMessages,\n updateNewMessages,\n deleteNewMessages,\n deleteMessages,\n updateLoading,\n updateRefreshing,\n } = useChannelMessagesReducer(options?.sortComparator);\n\n const channelMarkAsRead = async (source?: CollectionEventSource) => {\n try {\n switch (source) {\n case CollectionEventSource.EVENT_MESSAGE_RECEIVED:\n case CollectionEventSource.EVENT_MESSAGE_SENT_SUCCESS:\n case CollectionEventSource.SYNC_MESSAGE_FILL:\n case undefined:\n await confirmAndMarkAsRead([channel]);\n break;\n }\n } catch (e) {\n Logger.warn('[useGroupChannelMessagesWithCollection/channelMarkAsRead]', e);\n }\n };\n const updateNewMessagesReceived = (source: CollectionEventSource, messages: SendbirdBaseMessage[]) => {\n const incomingMessages = messages.filter((it) => !isMyMessage(it, sdk.currentUser?.userId));\n if (incomingMessages.length > 0) {\n switch (source) {\n case CollectionEventSource.EVENT_MESSAGE_RECEIVED:\n case CollectionEventSource.SYNC_MESSAGE_FILL: {\n if (options?.shouldCountNewMessages?.()) updateNewMessages(incomingMessages, false, sdk.currentUser?.userId);\n options?.onMessagesReceived?.(incomingMessages);\n break;\n }\n }\n }\n };\n\n const updateUnsentMessages = () => {\n const { pendingMessages, failedMessages } = collectionRef.current ?? {};\n if (isNotEmpty(pendingMessages)) updateMessages(pendingMessages, false, sdk.currentUser?.userId);\n if (isNotEmpty(failedMessages)) updateMessages(failedMessages, false, sdk.currentUser?.userId);\n };\n\n const init = useFreshCallback(async (startingPoint: number, limit: number, callback?: () => void) => {\n if (collectionRef.current) collectionRef.current?.dispose();\n\n channelMarkAsRead();\n updateNewMessages([], true, sdk.currentUser?.userId);\n\n collectionInitializedRef.current = false;\n collectionRef.current = createMessageCollection(channel, limit, {\n ...options,\n startingPoint,\n });\n\n collectionRef.current?.setMessageCollectionHandler({\n onMessagesAdded: (ctx, __, messages) => {\n channelMarkAsRead(ctx.source);\n updateNewMessagesReceived(ctx.source, messages);\n\n updateMessages(messages, false, sdk.currentUser?.userId);\n },\n onMessagesUpdated: (ctx, __, messages) => {\n channelMarkAsRead(ctx.source);\n updateNewMessagesReceived(ctx.source, messages); // NOTE: admin message is not added via onMessagesAdded handler, not checked yet is this a bug.\n\n updateMessages(messages, false, sdk.currentUser?.userId);\n\n if (ctx.source === CollectionEventSource.EVENT_MESSAGE_UPDATED) {\n options?.onMessagesUpdated?.(messages);\n }\n },\n onMessagesDeleted: (_, __, ___, messages) => {\n const msgIds = messages.map((it) => it.messageId);\n const reqIds = messages.filter(isSendableMessage).map((it) => it.reqId);\n deleteMessages(msgIds, reqIds);\n deleteNewMessages(msgIds, reqIds);\n },\n onChannelDeleted: () => {\n options?.onChannelDeleted?.();\n },\n onChannelUpdated: (_, eventChannel) => {\n if (eventChannel.isGroupChannel() && !isDifferentChannel(eventChannel, channel)) {\n forceUpdate();\n }\n },\n onHugeGapDetected: () => {\n init(Number.MAX_SAFE_INTEGER, MESSAGE_LIMIT.DEFAULT);\n },\n });\n\n collectionRef.current\n .initialize(MessageCollectionInitPolicy.CACHE_AND_REPLACE_BY_API)\n .onCacheResult((err, messages) => {\n if (err) sdk.isCacheEnabled && Logger.error('[useGroupChannelMessagesWithCollection/onCacheResult]', err);\n else if (messages) {\n Logger.debug('[useGroupChannelMessagesWithCollection/onCacheResult]', 'message length:', messages.length);\n\n updateMessages(messages, true, sdk.currentUser?.userId);\n updateUnsentMessages();\n }\n\n callback?.();\n })\n .onApiResult((err, messages) => {\n if (err) Logger.warn('[useGroupChannelMessagesWithCollection/onApiResult]', err);\n else if (messages) {\n Logger.debug('[useGroupChannelMessagesWithCollection/onApiResult]', 'message length:', messages.length);\n\n updateMessages(messages, true, sdk.currentUser?.userId);\n if (!options?.startingPoint) options?.onMessagesReceived?.(messages);\n if (sdk.isCacheEnabled) updateUnsentMessages();\n }\n\n collectionInitializedRef.current = true;\n callback?.();\n });\n });\n\n useChannelHandler(sdk, handlerId, {\n onUserBanned(channel, bannedUser) {\n if (channel.isGroupChannel() && !isDifferentChannel(channel, channel)) {\n if (bannedUser.userId === sdk.currentUser?.userId) {\n options?.onChannelDeleted?.();\n } else {\n forceUpdate();\n }\n }\n },\n });\n\n useEffect(() => {\n // NOTE: Cache read is heavy task, and it prevents smooth ui transition\n setTimeout(async () => {\n updateLoading(true);\n init(initialStartingPoint, initialLimit, () => updateLoading(false));\n }, 0);\n }, [channel.url, userId, options?.replyType]);\n\n useEffect(() => {\n return () => {\n if (collectionRef.current) collectionRef.current?.dispose();\n };\n }, []);\n\n const refresh: ReturnType<UseGroupChannelMessages>['refresh'] = useFreshCallback(async () => {\n updateRefreshing(true);\n init(Number.MAX_SAFE_INTEGER, MESSAGE_LIMIT.DEFAULT, () => updateRefreshing(false));\n });\n\n const prev: ReturnType<UseGroupChannelMessages>['prev'] = useFreshCallback(async () => {\n if (collectionRef.current && collectionRef.current?.hasPrevious) {\n try {\n const list = await collectionRef.current?.loadPrevious();\n updateMessages(list, false, sdk.currentUser?.userId);\n } catch {}\n }\n });\n\n const hasPrev: ReturnType<UseGroupChannelMessages>['hasPrev'] = useFreshCallback(() => {\n if (collectionInitializedRef.current && collectionRef.current) {\n return collectionRef.current.hasPrevious;\n } else {\n return false;\n }\n });\n\n const next: ReturnType<UseGroupChannelMessages>['next'] = useFreshCallback(async () => {\n if (collectionRef.current && collectionRef.current?.hasNext) {\n try {\n const fetchedList = await collectionRef.current?.loadNext();\n updateMessages(fetchedList, false, sdk.currentUser?.userId);\n } catch {}\n }\n });\n\n const hasNext: ReturnType<UseGroupChannelMessages>['hasNext'] = useFreshCallback(() => {\n if (collectionInitializedRef.current && collectionRef.current) {\n return collectionRef.current.hasNext;\n } else {\n return false;\n }\n });\n\n const sendUserMessage: ReturnType<UseGroupChannelMessages>['sendUserMessage'] = useFreshCallback(\n (params, onPending) => {\n return new Promise((resolve, reject) => {\n channel\n .sendUserMessage(params)\n .onPending((pendingMessage) => {\n if (pendingMessage.isUserMessage()) {\n onPending?.(pendingMessage);\n updateMessages([pendingMessage], false, sdk.currentUser?.userId);\n }\n })\n .onSucceeded((sentMessage) => {\n if (sentMessage.isUserMessage()) {\n updateMessages([sentMessage], false, sdk.currentUser?.userId);\n resolve(sentMessage);\n }\n })\n .onFailed((err, failedMessage) => {\n if (failedMessage) {\n updateMessages([failedMessage], false, sdk.currentUser?.userId);\n }\n reject(err);\n });\n });\n },\n );\n const sendFileMessage: ReturnType<UseGroupChannelMessages>['sendFileMessage'] = useFreshCallback(\n (params, onPending) => {\n return new Promise((resolve, reject) => {\n channel\n .sendFileMessage(params)\n .onPending((pendingMessage) => {\n if (pendingMessage.isFileMessage()) {\n updateMessages([pendingMessage], false, sdk.currentUser?.userId);\n onPending?.(pendingMessage);\n }\n })\n .onSucceeded((sentMessage) => {\n if (sentMessage.isFileMessage()) {\n updateMessages([sentMessage], false, sdk.currentUser?.userId);\n resolve(sentMessage as SendbirdFileMessage);\n }\n })\n .onFailed((err, failedMessage) => {\n if (failedMessage) {\n updateMessages([failedMessage], false, sdk.currentUser?.userId);\n }\n reject(err);\n });\n });\n },\n );\n const updateUserMessage: ReturnType<UseGroupChannelMessages>['updateUserMessage'] = useFreshCallback(\n async (messageId, params) => {\n const updatedMessage = await channel.updateUserMessage(messageId, params);\n updateMessages([updatedMessage], false, sdk.currentUser?.userId);\n return updatedMessage;\n },\n );\n const updateFileMessage: ReturnType<UseGroupChannelMessages>['updateFileMessage'] = useFreshCallback(\n async (messageId, params) => {\n const updatedMessage = await channel.updateFileMessage(messageId, params);\n updateMessages([updatedMessage], false, sdk.currentUser?.userId);\n return updatedMessage;\n },\n );\n const resendMessage: ReturnType<UseGroupChannelMessages>['resendMessage'] = useFreshCallback(\n async (failedMessage) => {\n const resentMessage = await (() => {\n if (failedMessage.isUserMessage()) return channel.resendUserMessage(failedMessage);\n if (failedMessage.isFileMessage()) return channel.resendFileMessage(failedMessage);\n return null;\n })();\n\n if (resentMessage) updateMessages([resentMessage], false, sdk.currentUser?.userId);\n },\n );\n const deleteMessage: ReturnType<UseGroupChannelMessages>['deleteMessage'] = useFreshCallback(async (message) => {\n if (message.sendingStatus === 'succeeded') {\n if (message.isUserMessage()) await channel.deleteMessage(message);\n if (message.isFileMessage()) await channel.deleteMessage(message);\n } else {\n try {\n await collectionRef.current?.removeFailedMessage(message.reqId);\n } finally {\n deleteMessages([message.messageId], [message.reqId]);\n }\n }\n });\n const resetNewMessages: ReturnType<UseGroupChannelMessages>['resetNewMessages'] = useFreshCallback(() => {\n updateNewMessages([], true, sdk.currentUser?.userId);\n });\n const resetWithStartingPoint: ReturnType<UseGroupChannelMessages>['resetWithStartingPoint'] = useFreshCallback(\n (startingPoint, callback) => {\n const limit = shouldUseSearchLimit(startingPoint) ? MESSAGE_LIMIT.SEARCH : MESSAGE_LIMIT.DEFAULT;\n updateLoading(true);\n updateMessages([], true, sdk.currentUser?.userId);\n init(startingPoint, limit, () => {\n updateLoading(false);\n callback?.();\n });\n },\n );\n\n return {\n loading,\n refreshing,\n refresh,\n messages,\n next,\n hasNext,\n prev,\n hasPrev,\n newMessages,\n resetNewMessages,\n sendUserMessage,\n sendFileMessage,\n updateUserMessage,\n updateFileMessage,\n resendMessage,\n deleteMessage,\n resetWithStartingPoint,\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AAYA,IAAAI,kBAAA,GAAAJ,OAAA;AAEA,IAAAK,0BAAA,GAAAL,OAAA;AAEA,MAAMM,aAAa,GAAG;EACpBC,OAAO,EAAE,EAAE;EACXC,MAAM,EAAE;AACV,CAAC;AAED,MAAMC,uBAAuB,GAAGA,CAC9BC,OAA6B,EAC7BC,KAAa,EACbC,OAAuC,KACpC;EACH,IAAIA,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEC,iBAAiB,EAAE,OAAOD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,iBAAiB,CAAC;IAAEC,aAAa,EAAEF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE;EAAc,CAAC,CAAC;EAE5G,MAAMC,MAAM,GAAG,IAAIC,2BAAa,EAAE;EAClC,IAAIJ,OAAO,CAACK,SAAS,EAAEF,MAAM,CAACE,SAAS,GAAGL,OAAO,CAACK,SAAS;EAE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CAACP,aAAa,CAAC,GAAGR,aAAa,CAACE,MAAM,GAAGF,aAAa,CAACC,OAAO;IAChGuC,aAAa,CAAC,IAAI,CAAC;IACnBJ,cAAc,CAAC,EAAE,EAAE,IAAI,GAAAgJ,kBAAA,GAAEjK,GAAG,CAACyC,WAAW,cAAAwH,kBAAA,uBAAfA,kBAAA,CAAiBhK,MAAM,CAAC;IACjDqD,IAAI,CAACjE,aAAa,EAAEH,KAAK,EAAE,MAAM;MAC/BmC,aAAa,CAAC,KAAK,CAAC;MACpBmC,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,EAAI;IACd,CAAC,CAAC;EACJ,CAAC,CACF;EAED,OAAO;IACL3C,OAAO;IACPC,UAAU;IACV6F,OAAO;IACP5F,QAAQ;IACRqG,IAAI;IACJE,OAAO;IACPV,IAAI;IACJO,OAAO;IACPnG,WAAW;IACX8I,gBAAgB;IAChBnC,eAAe;IACfe,eAAe;IACfK,iBAAiB;IACjBG,iBAAiB;IACjBE,aAAa;IACbK,aAAa;IACbO;EACF,CAAC;AACH,CAAC;AAACE,OAAA,CAAAnK,qCAAA,GAAAA,qCAAA"}
|
|
@@ -42,14 +42,14 @@ const useGroupChannelMessagesWithQuery = (sdk, channel, userId, options) => {
|
|
|
42
42
|
};
|
|
43
43
|
const init = (0, _uikitUtils.useFreshCallback)(async uid => {
|
|
44
44
|
if (uid) {
|
|
45
|
-
var _queryRef$current;
|
|
45
|
+
var _sdk$currentUser, _queryRef$current;
|
|
46
46
|
channelMarkAsRead();
|
|
47
|
-
updateNewMessages([], true, sdk.currentUser.userId);
|
|
47
|
+
updateNewMessages([], true, (_sdk$currentUser = sdk.currentUser) === null || _sdk$currentUser === void 0 ? void 0 : _sdk$currentUser.userId);
|
|
48
48
|
queryRef.current = createMessageQuery(channel, options);
|
|
49
49
|
if ((_queryRef$current = queryRef.current) !== null && _queryRef$current !== void 0 && _queryRef$current.hasNext) {
|
|
50
|
-
var _queryRef$current2;
|
|
50
|
+
var _queryRef$current2, _sdk$currentUser2;
|
|
51
51
|
const list = await ((_queryRef$current2 = queryRef.current) === null || _queryRef$current2 === void 0 ? void 0 : _queryRef$current2.load());
|
|
52
|
-
updateMessages(list, true, sdk.currentUser.userId);
|
|
52
|
+
updateMessages(list, true, (_sdk$currentUser2 = sdk.currentUser) === null || _sdk$currentUser2 === void 0 ? void 0 : _sdk$currentUser2.userId);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
});
|
|
@@ -61,22 +61,24 @@ const useGroupChannelMessagesWithQuery = (sdk, channel, userId, options) => {
|
|
|
61
61
|
(0, _useChannelHandler.useChannelHandler)(sdk, handlerId, {
|
|
62
62
|
// Messages
|
|
63
63
|
onMessageReceived(eventChannel, message) {
|
|
64
|
-
var _options$shouldCountN;
|
|
64
|
+
var _sdk$currentUser3, _sdk$currentUser4, _options$shouldCountN;
|
|
65
65
|
if ((0, _uikitUtils.isDifferentChannel)(channel, eventChannel)) return;
|
|
66
|
-
if ((0, _uikitUtils.isMyMessage)(message, sdk.currentUser.userId)) return;
|
|
66
|
+
if ((0, _uikitUtils.isMyMessage)(message, (_sdk$currentUser3 = sdk.currentUser) === null || _sdk$currentUser3 === void 0 ? void 0 : _sdk$currentUser3.userId)) return;
|
|
67
67
|
channelMarkAsRead();
|
|
68
|
-
updateMessages([message], false, sdk.currentUser.userId);
|
|
68
|
+
updateMessages([message], false, (_sdk$currentUser4 = sdk.currentUser) === null || _sdk$currentUser4 === void 0 ? void 0 : _sdk$currentUser4.userId);
|
|
69
69
|
if (options !== null && options !== void 0 && (_options$shouldCountN = options.shouldCountNewMessages) !== null && _options$shouldCountN !== void 0 && _options$shouldCountN.call(options)) {
|
|
70
|
-
|
|
70
|
+
var _sdk$currentUser5;
|
|
71
|
+
updateNewMessages([message], false, (_sdk$currentUser5 = sdk.currentUser) === null || _sdk$currentUser5 === void 0 ? void 0 : _sdk$currentUser5.userId);
|
|
71
72
|
}
|
|
72
73
|
if (options !== null && options !== void 0 && options.onMessagesReceived) {
|
|
73
74
|
options.onMessagesReceived([message]);
|
|
74
75
|
}
|
|
75
76
|
},
|
|
76
77
|
onMessageUpdated(eventChannel, message) {
|
|
78
|
+
var _sdk$currentUser6, _sdk$currentUser7;
|
|
77
79
|
if ((0, _uikitUtils.isDifferentChannel)(channel, eventChannel)) return;
|
|
78
|
-
if ((0, _uikitUtils.isMyMessage)(message, sdk.currentUser.userId)) return;
|
|
79
|
-
updateMessages([message], false, sdk.currentUser.userId);
|
|
80
|
+
if ((0, _uikitUtils.isMyMessage)(message, (_sdk$currentUser6 = sdk.currentUser) === null || _sdk$currentUser6 === void 0 ? void 0 : _sdk$currentUser6.userId)) return;
|
|
81
|
+
updateMessages([message], false, (_sdk$currentUser7 = sdk.currentUser) === null || _sdk$currentUser7 === void 0 ? void 0 : _sdk$currentUser7.userId);
|
|
80
82
|
},
|
|
81
83
|
onMessageDeleted(eventChannel, messageId) {
|
|
82
84
|
if ((0, _uikitUtils.isDifferentChannel)(channel, eventChannel)) return;
|
|
@@ -84,6 +86,7 @@ const useGroupChannelMessagesWithQuery = (sdk, channel, userId, options) => {
|
|
|
84
86
|
deleteNewMessages([messageId], []);
|
|
85
87
|
},
|
|
86
88
|
async onReactionUpdated(eventChannel, reactionEvent) {
|
|
89
|
+
var _sdk$currentUser8;
|
|
87
90
|
if ((0, _uikitUtils.isDifferentChannel)(channel, eventChannel)) return;
|
|
88
91
|
const message = await sdk.message.getMessage({
|
|
89
92
|
messageId: reactionEvent.messageId,
|
|
@@ -94,7 +97,7 @@ const useGroupChannelMessagesWithQuery = (sdk, channel, userId, options) => {
|
|
|
94
97
|
channelUrl: channel.url,
|
|
95
98
|
channelType: channel.channelType
|
|
96
99
|
});
|
|
97
|
-
updateMessages([message], false, sdk.currentUser.userId);
|
|
100
|
+
if (message) updateMessages([message], false, (_sdk$currentUser8 = sdk.currentUser) === null || _sdk$currentUser8 === void 0 ? void 0 : _sdk$currentUser8.userId);
|
|
98
101
|
},
|
|
99
102
|
// Channels
|
|
100
103
|
onChannelChanged: channelUpdater,
|
|
@@ -119,8 +122,9 @@ const useGroupChannelMessagesWithQuery = (sdk, channel, userId, options) => {
|
|
|
119
122
|
onUserMuted: channelUpdater,
|
|
120
123
|
onUserUnmuted: channelUpdater,
|
|
121
124
|
onUserBanned(eventChannel, bannedUser) {
|
|
125
|
+
var _sdk$currentUser9;
|
|
122
126
|
if ((0, _uikitUtils.isDifferentChannel)(channel, eventChannel)) return;
|
|
123
|
-
if (bannedUser.userId === sdk.currentUser.userId) {
|
|
127
|
+
if (bannedUser.userId === ((_sdk$currentUser9 = sdk.currentUser) === null || _sdk$currentUser9 === void 0 ? void 0 : _sdk$currentUser9.userId)) {
|
|
124
128
|
var _options$onChannelDel2;
|
|
125
129
|
options === null || options === void 0 ? void 0 : (_options$onChannelDel2 = options.onChannelDeleted) === null || _options$onChannelDel2 === void 0 ? void 0 : _options$onChannelDel2.call(options);
|
|
126
130
|
} else {
|
|
@@ -141,9 +145,9 @@ const useGroupChannelMessagesWithQuery = (sdk, channel, userId, options) => {
|
|
|
141
145
|
const prev = (0, _uikitUtils.useFreshCallback)(async () => {
|
|
142
146
|
var _queryRef$current3;
|
|
143
147
|
if (queryRef.current && (_queryRef$current3 = queryRef.current) !== null && _queryRef$current3 !== void 0 && _queryRef$current3.hasNext) {
|
|
144
|
-
var _queryRef$current4;
|
|
148
|
+
var _queryRef$current4, _sdk$currentUser10;
|
|
145
149
|
const list = await ((_queryRef$current4 = queryRef.current) === null || _queryRef$current4 === void 0 ? void 0 : _queryRef$current4.load());
|
|
146
|
-
updateMessages(list, false, sdk.currentUser.userId);
|
|
150
|
+
updateMessages(list, false, (_sdk$currentUser10 = sdk.currentUser) === null || _sdk$currentUser10 === void 0 ? void 0 : _sdk$currentUser10.userId);
|
|
147
151
|
}
|
|
148
152
|
});
|
|
149
153
|
const hasPrev = (0, _uikitUtils.useFreshCallback)(() => {
|
|
@@ -156,16 +160,21 @@ const useGroupChannelMessagesWithQuery = (sdk, channel, userId, options) => {
|
|
|
156
160
|
return new Promise((resolve, reject) => {
|
|
157
161
|
channel.sendUserMessage(params).onPending(pendingMessage => {
|
|
158
162
|
if (pendingMessage.isUserMessage()) {
|
|
159
|
-
|
|
163
|
+
var _sdk$currentUser11;
|
|
164
|
+
updateMessages([pendingMessage], false, (_sdk$currentUser11 = sdk.currentUser) === null || _sdk$currentUser11 === void 0 ? void 0 : _sdk$currentUser11.userId);
|
|
160
165
|
onPending === null || onPending === void 0 ? void 0 : onPending(pendingMessage);
|
|
161
166
|
}
|
|
162
167
|
}).onSucceeded(sentMessage => {
|
|
163
168
|
if (sentMessage.isUserMessage()) {
|
|
164
|
-
|
|
169
|
+
var _sdk$currentUser12;
|
|
170
|
+
updateMessages([sentMessage], false, (_sdk$currentUser12 = sdk.currentUser) === null || _sdk$currentUser12 === void 0 ? void 0 : _sdk$currentUser12.userId);
|
|
165
171
|
resolve(sentMessage);
|
|
166
172
|
}
|
|
167
|
-
}).onFailed((err,
|
|
168
|
-
|
|
173
|
+
}).onFailed((err, failedMessage) => {
|
|
174
|
+
if (failedMessage) {
|
|
175
|
+
var _sdk$currentUser13;
|
|
176
|
+
updateMessages([failedMessage], false, (_sdk$currentUser13 = sdk.currentUser) === null || _sdk$currentUser13 === void 0 ? void 0 : _sdk$currentUser13.userId);
|
|
177
|
+
}
|
|
169
178
|
reject(err);
|
|
170
179
|
});
|
|
171
180
|
});
|
|
@@ -174,37 +183,45 @@ const useGroupChannelMessagesWithQuery = (sdk, channel, userId, options) => {
|
|
|
174
183
|
return new Promise((resolve, reject) => {
|
|
175
184
|
channel.sendFileMessage(params).onPending(pendingMessage => {
|
|
176
185
|
if (pendingMessage.isFileMessage()) {
|
|
177
|
-
|
|
186
|
+
var _sdk$currentUser14;
|
|
187
|
+
updateMessages([pendingMessage], false, (_sdk$currentUser14 = sdk.currentUser) === null || _sdk$currentUser14 === void 0 ? void 0 : _sdk$currentUser14.userId);
|
|
178
188
|
onPending === null || onPending === void 0 ? void 0 : onPending(pendingMessage);
|
|
179
189
|
}
|
|
180
190
|
}).onSucceeded(sentMessage => {
|
|
181
191
|
if (sentMessage.isFileMessage()) {
|
|
182
|
-
|
|
192
|
+
var _sdk$currentUser15;
|
|
193
|
+
updateMessages([sentMessage], false, (_sdk$currentUser15 = sdk.currentUser) === null || _sdk$currentUser15 === void 0 ? void 0 : _sdk$currentUser15.userId);
|
|
183
194
|
resolve(sentMessage);
|
|
184
195
|
}
|
|
185
|
-
}).onFailed((err,
|
|
186
|
-
|
|
196
|
+
}).onFailed((err, failedMessage) => {
|
|
197
|
+
if (failedMessage) {
|
|
198
|
+
var _sdk$currentUser16;
|
|
199
|
+
updateMessages([failedMessage], false, (_sdk$currentUser16 = sdk.currentUser) === null || _sdk$currentUser16 === void 0 ? void 0 : _sdk$currentUser16.userId);
|
|
200
|
+
}
|
|
187
201
|
reject(err);
|
|
188
202
|
});
|
|
189
203
|
});
|
|
190
204
|
});
|
|
191
205
|
const updateUserMessage = (0, _uikitUtils.useFreshCallback)(async (messageId, params) => {
|
|
206
|
+
var _sdk$currentUser17;
|
|
192
207
|
const updatedMessage = await channel.updateUserMessage(messageId, params);
|
|
193
|
-
updateMessages([updatedMessage], false, sdk.currentUser.userId);
|
|
208
|
+
updateMessages([updatedMessage], false, (_sdk$currentUser17 = sdk.currentUser) === null || _sdk$currentUser17 === void 0 ? void 0 : _sdk$currentUser17.userId);
|
|
194
209
|
return updatedMessage;
|
|
195
210
|
});
|
|
196
211
|
const updateFileMessage = (0, _uikitUtils.useFreshCallback)(async (messageId, params) => {
|
|
212
|
+
var _sdk$currentUser18;
|
|
197
213
|
const updatedMessage = await channel.updateFileMessage(messageId, params);
|
|
198
|
-
updateMessages([updatedMessage], false, sdk.currentUser.userId);
|
|
214
|
+
updateMessages([updatedMessage], false, (_sdk$currentUser18 = sdk.currentUser) === null || _sdk$currentUser18 === void 0 ? void 0 : _sdk$currentUser18.userId);
|
|
199
215
|
return updatedMessage;
|
|
200
216
|
});
|
|
201
217
|
const resendMessage = (0, _uikitUtils.useFreshCallback)(async failedMessage => {
|
|
218
|
+
var _sdk$currentUser19;
|
|
202
219
|
const message = await (() => {
|
|
203
220
|
if (failedMessage.isUserMessage()) return channel.resendUserMessage(failedMessage);
|
|
204
221
|
if (failedMessage.isFileMessage()) return channel.resendFileMessage(failedMessage);
|
|
205
222
|
return null;
|
|
206
223
|
})();
|
|
207
|
-
if (message) updateMessages([message], false, sdk.currentUser.userId);
|
|
224
|
+
if (message) updateMessages([message], false, (_sdk$currentUser19 = sdk.currentUser) === null || _sdk$currentUser19 === void 0 ? void 0 : _sdk$currentUser19.userId);
|
|
208
225
|
});
|
|
209
226
|
const deleteMessage = (0, _uikitUtils.useFreshCallback)(async message => {
|
|
210
227
|
if (message.sendingStatus === 'succeeded') {
|
|
@@ -215,7 +232,8 @@ const useGroupChannelMessagesWithQuery = (sdk, channel, userId, options) => {
|
|
|
215
232
|
}
|
|
216
233
|
});
|
|
217
234
|
const resetNewMessages = (0, _uikitUtils.useFreshCallback)(() => {
|
|
218
|
-
|
|
235
|
+
var _sdk$currentUser20;
|
|
236
|
+
updateNewMessages([], true, (_sdk$currentUser20 = sdk.currentUser) === null || _sdk$currentUser20 === void 0 ? void 0 : _sdk$currentUser20.userId);
|
|
219
237
|
});
|
|
220
238
|
return {
|
|
221
239
|
loading,
|
package/lib/commonjs/channel/useGroupChannelMessages/useGroupChannelMessagesWithQuery.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_uikitUtils","_useChannelHandler","_useChannelMessagesReducer","createMessageQuery","channel","options","queryCreator","params","limit","reverse","replyType","createPreviousMessageListQuery","useGroupChannelMessagesWithQuery","sdk","userId","queryRef","useRef","handlerId","useUniqHandlerId","forceUpdate","useForceUpdate","loading","refreshing","messages","newMessages","updateMessages","deleteMessages","updateNewMessages","deleteNewMessages","updateLoading","updateRefreshing","useChannelMessagesReducer","sortComparator","channelMarkAsRead","confirmAndMarkAsRead","e","Logger","warn","init","useFreshCallback","uid","_queryRef$current","currentUser","current","hasNext","_queryRef$current2","list","load","channelUpdater","isGroupChannel","isDifferentChannel","useChannelHandler","onMessageReceived","eventChannel","message","_options$shouldCountN","isMyMessage","shouldCountNewMessages","call","onMessagesReceived","onMessageUpdated","onMessageDeleted","messageId","onReactionUpdated","reactionEvent","getMessage","includeReactions","includeParentMessageInfo","includeThreadInfo","includeMetaArray","channelUrl","url","channelType","onChannelChanged","onChannelFrozen","onChannelUnfrozen","onChannelHidden","onChannelMemberCountChanged","channels","foundChannel","find","c","onChannelDeleted","_options$onChannelDel","onOperatorUpdated","onUserLeft","onUserJoined","onUserUnbanned","onUserMuted","onUserUnmuted","onUserBanned","bannedUser","_options$onChannelDel2","useAsyncEffect","refresh","prev","_queryRef$current3","_queryRef$current4","hasPrev","_queryRef$current5","next","ASYNC_NOOP","sendUserMessage","onPending","Promise","resolve","reject","pendingMessage","isUserMessage","onSucceeded","sentMessage","onFailed","err","sendFileMessage","isFileMessage","updateUserMessage","updatedMessage","updateFileMessage","resendMessage","failedMessage","resendUserMessage","resendFileMessage","deleteMessage","sendingStatus","reqId","resetNewMessages","resetWithStartingPoint","exports"],"sources":["useGroupChannelMessagesWithQuery.ts"],"sourcesContent":["import { useRef } from 'react';\n\nimport type { PreviousMessageListQueryParams } from '@sendbird/chat/message';\nimport type {\n SendbirdBaseChannel,\n SendbirdGroupChannel,\n SendbirdPreviousMessageListQuery,\n} from '@sendbird/uikit-utils';\nimport {\n ASYNC_NOOP,\n Logger,\n confirmAndMarkAsRead,\n isDifferentChannel,\n isMyMessage,\n useAsyncEffect,\n useForceUpdate,\n useFreshCallback,\n useUniqHandlerId,\n} from '@sendbird/uikit-utils';\n\nimport { useChannelHandler } from '../../handler/useChannelHandler';\nimport type { UseGroupChannelMessages, UseGroupChannelMessagesOptions } from '../../types';\nimport { useChannelMessagesReducer } from '../useChannelMessagesReducer';\n\nconst createMessageQuery = (channel: SendbirdGroupChannel, options?: UseGroupChannelMessagesOptions) => {\n if (options?.queryCreator) return options.queryCreator();\n\n const params: PreviousMessageListQueryParams = { limit: 100, reverse: true };\n if (options?.replyType) params.replyType = options.replyType;\n\n return channel.createPreviousMessageListQuery(params);\n};\n\nexport const useGroupChannelMessagesWithQuery: UseGroupChannelMessages = (sdk, channel, userId, options) => {\n const queryRef = useRef<SendbirdPreviousMessageListQuery>();\n const handlerId = useUniqHandlerId('useGroupChannelMessagesWithQuery');\n\n const forceUpdate = useForceUpdate();\n\n const {\n loading,\n refreshing,\n messages,\n newMessages,\n updateMessages,\n deleteMessages,\n updateNewMessages,\n deleteNewMessages,\n updateLoading,\n updateRefreshing,\n } = useChannelMessagesReducer(options?.sortComparator);\n\n const channelMarkAsRead = async () => {\n try {\n await confirmAndMarkAsRead([channel]);\n } catch (e) {\n Logger.warn('[useGroupChannelMessagesWithQuery/channelMarkAsRead]', e);\n }\n };\n\n const init = useFreshCallback(async (uid?: string) => {\n if (uid) {\n channelMarkAsRead();\n updateNewMessages([], true, sdk.currentUser.userId);\n\n queryRef.current = createMessageQuery(channel, options);\n if (queryRef.current?.hasNext) {\n const list = await queryRef.current?.load();\n updateMessages(list, true, sdk.currentUser.userId);\n }\n }\n });\n\n const channelUpdater = (channel: SendbirdBaseChannel) => {\n if (channel.isGroupChannel() && !isDifferentChannel(channel, channel)) {\n forceUpdate();\n }\n };\n\n useChannelHandler(sdk, handlerId, {\n // Messages\n onMessageReceived(eventChannel, message) {\n if (isDifferentChannel(channel, eventChannel)) return;\n if (isMyMessage(message, sdk.currentUser.userId)) return;\n\n channelMarkAsRead();\n\n updateMessages([message], false, sdk.currentUser.userId);\n if (options?.shouldCountNewMessages?.()) {\n updateNewMessages([message], false, sdk.currentUser.userId);\n }\n if (options?.onMessagesReceived) {\n options.onMessagesReceived([message]);\n }\n },\n onMessageUpdated(eventChannel, message) {\n if (isDifferentChannel(channel, eventChannel)) return;\n if (isMyMessage(message, sdk.currentUser.userId)) return;\n\n updateMessages([message], false, sdk.currentUser.userId);\n },\n onMessageDeleted(eventChannel, messageId) {\n if (isDifferentChannel(channel, eventChannel)) return;\n deleteMessages([messageId], []);\n deleteNewMessages([messageId], []);\n },\n async onReactionUpdated(eventChannel, reactionEvent) {\n if (isDifferentChannel(channel, eventChannel)) return;\n\n const message = await sdk.message.getMessage({\n messageId: reactionEvent.messageId,\n includeReactions: true,\n includeParentMessageInfo: true,\n includeThreadInfo: true,\n includeMetaArray: true,\n channelUrl: channel.url,\n channelType: channel.channelType,\n });\n updateMessages([message], false, sdk.currentUser.userId);\n },\n // Channels\n onChannelChanged: channelUpdater,\n onChannelFrozen: channelUpdater,\n onChannelUnfrozen: channelUpdater,\n onChannelHidden: channelUpdater,\n onChannelMemberCountChanged(channels) {\n const foundChannel = channels.find((c) => !isDifferentChannel(c, channel));\n if (foundChannel) channelUpdater(foundChannel);\n },\n onChannelDeleted(channelUrl: string) {\n if (channel.url === channelUrl) options?.onChannelDeleted?.();\n },\n // Users\n onOperatorUpdated: channelUpdater,\n onUserLeft: channelUpdater,\n // onUserEntered: channelUpdater,\n // onUserExited: channelUpdater,\n onUserJoined: channelUpdater,\n onUserUnbanned: channelUpdater,\n onUserMuted: channelUpdater,\n onUserUnmuted: channelUpdater,\n onUserBanned(eventChannel, bannedUser) {\n if (isDifferentChannel(channel, eventChannel)) return;\n\n if (bannedUser.userId === sdk.currentUser.userId) {\n options?.onChannelDeleted?.();\n } else {\n channelUpdater(eventChannel);\n }\n },\n });\n\n useAsyncEffect(async () => {\n updateLoading(true);\n await init(userId);\n updateLoading(false);\n }, [channel.url, userId]);\n\n const refresh: ReturnType<UseGroupChannelMessages>['refresh'] = useFreshCallback(async () => {\n updateRefreshing(true);\n await init(userId);\n updateRefreshing(false);\n });\n\n const prev: ReturnType<UseGroupChannelMessages>['prev'] = useFreshCallback(async () => {\n if (queryRef.current && queryRef.current?.hasNext) {\n const list = await queryRef.current?.load();\n updateMessages(list, false, sdk.currentUser.userId);\n }\n });\n const hasPrev: ReturnType<UseGroupChannelMessages>['hasPrev'] = useFreshCallback(\n () => queryRef.current?.hasNext ?? false,\n );\n\n const next: ReturnType<UseGroupChannelMessages>['next'] = useFreshCallback(ASYNC_NOOP);\n const hasNext: ReturnType<UseGroupChannelMessages>['hasNext'] = useFreshCallback(() => false);\n\n const sendUserMessage: ReturnType<UseGroupChannelMessages>['sendUserMessage'] = useFreshCallback(\n (params, onPending) => {\n return new Promise((resolve, reject) => {\n channel\n .sendUserMessage(params)\n .onPending((pendingMessage) => {\n if (pendingMessage.isUserMessage()) {\n updateMessages([pendingMessage], false, sdk.currentUser.userId);\n onPending?.(pendingMessage);\n }\n })\n .onSucceeded((sentMessage) => {\n if (sentMessage.isUserMessage()) {\n updateMessages([sentMessage], false, sdk.currentUser.userId);\n resolve(sentMessage);\n }\n })\n .onFailed((err, sentMessage) => {\n updateMessages([sentMessage], false, sdk.currentUser.userId);\n reject(err);\n });\n });\n },\n );\n const sendFileMessage: ReturnType<UseGroupChannelMessages>['sendFileMessage'] = useFreshCallback(\n (params, onPending) => {\n return new Promise((resolve, reject) => {\n channel\n .sendFileMessage(params)\n .onPending((pendingMessage) => {\n if (pendingMessage.isFileMessage()) {\n updateMessages([pendingMessage], false, sdk.currentUser.userId);\n onPending?.(pendingMessage);\n }\n })\n .onSucceeded((sentMessage) => {\n if (sentMessage.isFileMessage()) {\n updateMessages([sentMessage], false, sdk.currentUser.userId);\n resolve(sentMessage);\n }\n })\n .onFailed((err, sentMessage) => {\n updateMessages([sentMessage], false, sdk.currentUser.userId);\n reject(err);\n });\n });\n },\n );\n const updateUserMessage: ReturnType<UseGroupChannelMessages>['updateUserMessage'] = useFreshCallback(\n async (messageId, params) => {\n const updatedMessage = await channel.updateUserMessage(messageId, params);\n updateMessages([updatedMessage], false, sdk.currentUser.userId);\n return updatedMessage;\n },\n );\n const updateFileMessage: ReturnType<UseGroupChannelMessages>['updateFileMessage'] = useFreshCallback(\n async (messageId, params) => {\n const updatedMessage = await channel.updateFileMessage(messageId, params);\n updateMessages([updatedMessage], false, sdk.currentUser.userId);\n return updatedMessage;\n },\n );\n const resendMessage: ReturnType<UseGroupChannelMessages>['resendMessage'] = useFreshCallback(\n async (failedMessage) => {\n const message = await (() => {\n if (failedMessage.isUserMessage()) return channel.resendUserMessage(failedMessage);\n if (failedMessage.isFileMessage()) return channel.resendFileMessage(failedMessage);\n return null;\n })();\n\n if (message) updateMessages([message], false, sdk.currentUser.userId);\n },\n );\n const deleteMessage: ReturnType<UseGroupChannelMessages>['deleteMessage'] = useFreshCallback(async (message) => {\n if (message.sendingStatus === 'succeeded') {\n if (message.isUserMessage()) await channel.deleteMessage(message);\n if (message.isFileMessage()) await channel.deleteMessage(message);\n } else {\n deleteMessages([message.messageId], [message.reqId]);\n }\n });\n const resetNewMessages: ReturnType<UseGroupChannelMessages>['resetNewMessages'] = useFreshCallback(() => {\n updateNewMessages([], true, sdk.currentUser.userId);\n });\n\n return {\n loading,\n refreshing,\n refresh,\n messages,\n newMessages,\n resetNewMessages,\n next,\n hasNext,\n prev,\n hasPrev,\n sendUserMessage,\n sendFileMessage,\n updateUserMessage,\n updateFileMessage,\n resendMessage,\n deleteMessage,\n resetWithStartingPoint() {\n Logger.warn('resetWithStartingPoint is not supported in Query, please use Collection instead.');\n },\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAAC,WAAA,GAAAD,OAAA;AAYA,IAAAE,kBAAA,GAAAF,OAAA;AAEA,IAAAG,0BAAA,GAAAH,OAAA;AAEA,MAAMI,kBAAkB,GAAGA,CAACC,OAA6B,EAAEC,OAAwC,KAAK;EACtG,IAAIA,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEC,YAAY,EAAE,OAAOD,OAAO,CAACC,YAAY,EAAE;EAExD,MAAMC,MAAsC,GAAG;IAAEC,KAAK,EAAE,GAAG;IAAEC,OAAO,EAAE;EAAK,CAAC;EAC5E,IAAIJ,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEK,SAAS,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,aAAa;IACbI,aAAa;IACbI,sBAAsBA,CAAA,EAAG;MACvB1F,kBAAM,CAACC,IAAI,CAAC,kFAAkF,CAAC;IACjG;EACF,CAAC;AACH,CAAC;AAAC0F,OAAA,CAAAnH,gCAAA,GAAAA,gCAAA"}
|
|
1
|
+
{"version":3,"names":["_react","require","_uikitUtils","_useChannelHandler","_useChannelMessagesReducer","createMessageQuery","channel","options","queryCreator","params","limit","reverse","replyType","createPreviousMessageListQuery","useGroupChannelMessagesWithQuery","sdk","userId","queryRef","useRef","handlerId","useUniqHandlerId","forceUpdate","useForceUpdate","loading","refreshing","messages","newMessages","updateMessages","deleteMessages","updateNewMessages","deleteNewMessages","updateLoading","updateRefreshing","useChannelMessagesReducer","sortComparator","channelMarkAsRead","confirmAndMarkAsRead","e","Logger","warn","init","useFreshCallback","uid","_sdk$currentUser","_queryRef$current","currentUser","current","hasNext","_queryRef$current2","_sdk$currentUser2","list","load","channelUpdater","isGroupChannel","isDifferentChannel","useChannelHandler","onMessageReceived","eventChannel","message","_sdk$currentUser3","_sdk$currentUser4","_options$shouldCountN","isMyMessage","shouldCountNewMessages","call","_sdk$currentUser5","onMessagesReceived","onMessageUpdated","_sdk$currentUser6","_sdk$currentUser7","onMessageDeleted","messageId","onReactionUpdated","reactionEvent","_sdk$currentUser8","getMessage","includeReactions","includeParentMessageInfo","includeThreadInfo","includeMetaArray","channelUrl","url","channelType","onChannelChanged","onChannelFrozen","onChannelUnfrozen","onChannelHidden","onChannelMemberCountChanged","channels","foundChannel","find","c","onChannelDeleted","_options$onChannelDel","onOperatorUpdated","onUserLeft","onUserJoined","onUserUnbanned","onUserMuted","onUserUnmuted","onUserBanned","bannedUser","_sdk$currentUser9","_options$onChannelDel2","useAsyncEffect","refresh","prev","_queryRef$current3","_queryRef$current4","_sdk$currentUser10","hasPrev","_queryRef$current5","next","ASYNC_NOOP","sendUserMessage","onPending","Promise","resolve","reject","pendingMessage","isUserMessage","_sdk$currentUser11","onSucceeded","sentMessage","_sdk$currentUser12","onFailed","err","failedMessage","_sdk$currentUser13","sendFileMessage","isFileMessage","_sdk$currentUser14","_sdk$currentUser15","_sdk$currentUser16","updateUserMessage","_sdk$currentUser17","updatedMessage","updateFileMessage","_sdk$currentUser18","resendMessage","_sdk$currentUser19","resendUserMessage","resendFileMessage","deleteMessage","sendingStatus","reqId","resetNewMessages","_sdk$currentUser20","resetWithStartingPoint","exports"],"sources":["useGroupChannelMessagesWithQuery.ts"],"sourcesContent":["import { useRef } from 'react';\n\nimport type { PreviousMessageListQueryParams } from '@sendbird/chat/message';\nimport type {\n SendbirdBaseChannel,\n SendbirdGroupChannel,\n SendbirdPreviousMessageListQuery,\n} from '@sendbird/uikit-utils';\nimport {\n ASYNC_NOOP,\n Logger,\n confirmAndMarkAsRead,\n isDifferentChannel,\n isMyMessage,\n useAsyncEffect,\n useForceUpdate,\n useFreshCallback,\n useUniqHandlerId,\n} from '@sendbird/uikit-utils';\n\nimport { useChannelHandler } from '../../handler/useChannelHandler';\nimport type { UseGroupChannelMessages, UseGroupChannelMessagesOptions } from '../../types';\nimport { useChannelMessagesReducer } from '../useChannelMessagesReducer';\n\nconst createMessageQuery = (channel: SendbirdGroupChannel, options?: UseGroupChannelMessagesOptions) => {\n if (options?.queryCreator) return options.queryCreator();\n\n const params: PreviousMessageListQueryParams = { limit: 100, reverse: true };\n if (options?.replyType) params.replyType = options.replyType;\n\n return channel.createPreviousMessageListQuery(params);\n};\n\nexport const useGroupChannelMessagesWithQuery: UseGroupChannelMessages = (sdk, channel, userId, options) => {\n const queryRef = useRef<SendbirdPreviousMessageListQuery>();\n const handlerId = useUniqHandlerId('useGroupChannelMessagesWithQuery');\n\n const forceUpdate = useForceUpdate();\n\n const {\n loading,\n refreshing,\n messages,\n newMessages,\n updateMessages,\n deleteMessages,\n updateNewMessages,\n deleteNewMessages,\n updateLoading,\n updateRefreshing,\n } = useChannelMessagesReducer(options?.sortComparator);\n\n const channelMarkAsRead = async () => {\n try {\n await confirmAndMarkAsRead([channel]);\n } catch (e) {\n Logger.warn('[useGroupChannelMessagesWithQuery/channelMarkAsRead]', e);\n }\n };\n\n const init = useFreshCallback(async (uid?: string) => {\n if (uid) {\n channelMarkAsRead();\n updateNewMessages([], true, sdk.currentUser?.userId);\n\n queryRef.current = createMessageQuery(channel, options);\n if (queryRef.current?.hasNext) {\n const list = await queryRef.current?.load();\n updateMessages(list, true, sdk.currentUser?.userId);\n }\n }\n });\n\n const channelUpdater = (channel: SendbirdBaseChannel) => {\n if (channel.isGroupChannel() && !isDifferentChannel(channel, channel)) {\n forceUpdate();\n }\n };\n\n useChannelHandler(sdk, handlerId, {\n // Messages\n onMessageReceived(eventChannel, message) {\n if (isDifferentChannel(channel, eventChannel)) return;\n if (isMyMessage(message, sdk.currentUser?.userId)) return;\n\n channelMarkAsRead();\n\n updateMessages([message], false, sdk.currentUser?.userId);\n if (options?.shouldCountNewMessages?.()) {\n updateNewMessages([message], false, sdk.currentUser?.userId);\n }\n if (options?.onMessagesReceived) {\n options.onMessagesReceived([message]);\n }\n },\n onMessageUpdated(eventChannel, message) {\n if (isDifferentChannel(channel, eventChannel)) return;\n if (isMyMessage(message, sdk.currentUser?.userId)) return;\n\n updateMessages([message], false, sdk.currentUser?.userId);\n },\n onMessageDeleted(eventChannel, messageId) {\n if (isDifferentChannel(channel, eventChannel)) return;\n deleteMessages([messageId], []);\n deleteNewMessages([messageId], []);\n },\n async onReactionUpdated(eventChannel, reactionEvent) {\n if (isDifferentChannel(channel, eventChannel)) return;\n\n const message = await sdk.message.getMessage({\n messageId: reactionEvent.messageId,\n includeReactions: true,\n includeParentMessageInfo: true,\n includeThreadInfo: true,\n includeMetaArray: true,\n channelUrl: channel.url,\n channelType: channel.channelType,\n });\n if (message) updateMessages([message], false, sdk.currentUser?.userId);\n },\n // Channels\n onChannelChanged: channelUpdater,\n onChannelFrozen: channelUpdater,\n onChannelUnfrozen: channelUpdater,\n onChannelHidden: channelUpdater,\n onChannelMemberCountChanged(channels) {\n const foundChannel = channels.find((c) => !isDifferentChannel(c, channel));\n if (foundChannel) channelUpdater(foundChannel);\n },\n onChannelDeleted(channelUrl: string) {\n if (channel.url === channelUrl) options?.onChannelDeleted?.();\n },\n // Users\n onOperatorUpdated: channelUpdater,\n onUserLeft: channelUpdater,\n // onUserEntered: channelUpdater,\n // onUserExited: channelUpdater,\n onUserJoined: channelUpdater,\n onUserUnbanned: channelUpdater,\n onUserMuted: channelUpdater,\n onUserUnmuted: channelUpdater,\n onUserBanned(eventChannel, bannedUser) {\n if (isDifferentChannel(channel, eventChannel)) return;\n\n if (bannedUser.userId === sdk.currentUser?.userId) {\n options?.onChannelDeleted?.();\n } else {\n channelUpdater(eventChannel);\n }\n },\n });\n\n useAsyncEffect(async () => {\n updateLoading(true);\n await init(userId);\n updateLoading(false);\n }, [channel.url, userId]);\n\n const refresh: ReturnType<UseGroupChannelMessages>['refresh'] = useFreshCallback(async () => {\n updateRefreshing(true);\n await init(userId);\n updateRefreshing(false);\n });\n\n const prev: ReturnType<UseGroupChannelMessages>['prev'] = useFreshCallback(async () => {\n if (queryRef.current && queryRef.current?.hasNext) {\n const list = await queryRef.current?.load();\n updateMessages(list, false, sdk.currentUser?.userId);\n }\n });\n const hasPrev: ReturnType<UseGroupChannelMessages>['hasPrev'] = useFreshCallback(\n () => queryRef.current?.hasNext ?? false,\n );\n\n const next: ReturnType<UseGroupChannelMessages>['next'] = useFreshCallback(ASYNC_NOOP);\n const hasNext: ReturnType<UseGroupChannelMessages>['hasNext'] = useFreshCallback(() => false);\n\n const sendUserMessage: ReturnType<UseGroupChannelMessages>['sendUserMessage'] = useFreshCallback(\n (params, onPending) => {\n return new Promise((resolve, reject) => {\n channel\n .sendUserMessage(params)\n .onPending((pendingMessage) => {\n if (pendingMessage.isUserMessage()) {\n updateMessages([pendingMessage], false, sdk.currentUser?.userId);\n onPending?.(pendingMessage);\n }\n })\n .onSucceeded((sentMessage) => {\n if (sentMessage.isUserMessage()) {\n updateMessages([sentMessage], false, sdk.currentUser?.userId);\n resolve(sentMessage);\n }\n })\n .onFailed((err, failedMessage) => {\n if (failedMessage) {\n updateMessages([failedMessage], false, sdk.currentUser?.userId);\n }\n reject(err);\n });\n });\n },\n );\n const sendFileMessage: ReturnType<UseGroupChannelMessages>['sendFileMessage'] = useFreshCallback(\n (params, onPending) => {\n return new Promise((resolve, reject) => {\n channel\n .sendFileMessage(params)\n .onPending((pendingMessage) => {\n if (pendingMessage.isFileMessage()) {\n updateMessages([pendingMessage], false, sdk.currentUser?.userId);\n onPending?.(pendingMessage);\n }\n })\n .onSucceeded((sentMessage) => {\n if (sentMessage.isFileMessage()) {\n updateMessages([sentMessage], false, sdk.currentUser?.userId);\n resolve(sentMessage);\n }\n })\n .onFailed((err, failedMessage) => {\n if (failedMessage) {\n updateMessages([failedMessage], false, sdk.currentUser?.userId);\n }\n reject(err);\n });\n });\n },\n );\n const updateUserMessage: ReturnType<UseGroupChannelMessages>['updateUserMessage'] = useFreshCallback(\n async (messageId, params) => {\n const updatedMessage = await channel.updateUserMessage(messageId, params);\n updateMessages([updatedMessage], false, sdk.currentUser?.userId);\n return updatedMessage;\n },\n );\n const updateFileMessage: ReturnType<UseGroupChannelMessages>['updateFileMessage'] = useFreshCallback(\n async (messageId, params) => {\n const updatedMessage = await channel.updateFileMessage(messageId, params);\n updateMessages([updatedMessage], false, sdk.currentUser?.userId);\n return updatedMessage;\n },\n );\n const resendMessage: ReturnType<UseGroupChannelMessages>['resendMessage'] = useFreshCallback(\n async (failedMessage) => {\n const message = await (() => {\n if (failedMessage.isUserMessage()) return channel.resendUserMessage(failedMessage);\n if (failedMessage.isFileMessage()) return channel.resendFileMessage(failedMessage);\n return null;\n })();\n\n if (message) updateMessages([message], false, sdk.currentUser?.userId);\n },\n );\n const deleteMessage: ReturnType<UseGroupChannelMessages>['deleteMessage'] = useFreshCallback(async (message) => {\n if (message.sendingStatus === 'succeeded') {\n if (message.isUserMessage()) await channel.deleteMessage(message);\n if (message.isFileMessage()) await channel.deleteMessage(message);\n } else {\n deleteMessages([message.messageId], [message.reqId]);\n }\n });\n const resetNewMessages: ReturnType<UseGroupChannelMessages>['resetNewMessages'] = useFreshCallback(() => {\n updateNewMessages([], true, sdk.currentUser?.userId);\n });\n\n return {\n loading,\n refreshing,\n refresh,\n messages,\n newMessages,\n resetNewMessages,\n next,\n hasNext,\n prev,\n hasPrev,\n sendUserMessage,\n sendFileMessage,\n updateUserMessage,\n updateFileMessage,\n resendMessage,\n deleteMessage,\n resetWithStartingPoint() {\n Logger.warn('resetWithStartingPoint is not supported in Query, please use Collection instead.');\n },\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAAC,WAAA,GAAAD,OAAA;AAYA,IAAAE,kBAAA,GAAAF,OAAA;AAEA,IAAAG,0BAAA,GAAAH,OAAA;AAEA,MAAMI,kBAAkB,GAAGA,CAACC,OAA6B,EAAEC,OAAwC,KAAK;EACtG,IAAIA,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEC,YAAY,EAAE,OAAOD,OAAO,CAACC,YAAY,EAAE;EAExD,MAAMC,MAAsC,GAAG;IAAEC,KAAK,EAAE,GAAG;IAAEC,OAAO,EAAE;EAAK,CAAC;EAC5E,IAAIJ,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEK,SAAS,EAAEH,MAAM,CAACG,SAAS,GAAGL,OAAO,CAACK,SAAS;EAE5D,OAAON,OAAO,CAACO,8BAA8B,CAACJ,MAAM,CAAC;AACvD,CAAC;AAEM,MAAMK,gCAAyD,GAAGA,CAACC,GAAG,EAAET,OAAO,EAAEU,MAAM,EAAET,OAAO,KAAK;EAC1G,MAAMU,QAAQ,GAAG,IAAAC,aAAM,GAAoC;EAC3D,MAAMC,SAAS,GAAG,IAAAC,4BAAgB,EAAC,kCAAkC,CAAC;EAEtE,MAAMC,WAAW,GAAG,IAAAC,0BAAc,GAAE;EAEpC,MAAM;IACJC,OAAO;IACPC,UAAU;IACVC,QAAQ;IAC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