@sendbird/uikit-utils 3.11.2 → 3.11.4

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.
@@ -220,8 +220,7 @@ Object.keys(_types).forEach(function (key) {
220
220
  }
221
221
  });
222
222
  });
223
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
224
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
223
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
225
224
  const NOOP = () => void 0;
226
225
  exports.NOOP = NOOP;
227
226
  const ASYNC_NOOP = async () => void 0;
@@ -1 +1 @@
1
- {"version":3,"names":["_logger","require","_arrayToMap","_interopRequireWildcard","_regex","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_bufferedRequest","_file","_rtl","_shared","_hooks","_reactNative","_groupChannel","_openChannel","_common","_channel","_message","_attrs","_user","_types","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","NOOP","ASYNC_NOOP","PASS","val","toMegabyte","byte","isFunction","param","ifThenOr","cond","then","or","SBErrorCode","UNAUTHORIZED_REQUEST","RESOURCE_NOT_FOUND","BANNED_USER_SEND_MESSAGE_NOT_ALLOWED","CHANNEL_NOT_FOUND","SBErrorMessage","ACL"],"sources":["index.ts"],"sourcesContent":["export { Logger } from './shared/logger';\nexport { default as arrayToMap, arrayToMapWithGetter } from './shared/arrayToMap';\nexport * from './shared/regex';\nexport * from './shared/bufferedRequest';\nexport * from './shared/file';\nexport * from './shared/rtl';\nexport * from './shared';\n\nexport * from './hooks';\nexport * from './hooks/react-native';\nexport * from './ui-format/groupChannel';\nexport * from './ui-format/openChannel';\nexport * from './ui-format/common';\nexport * from './sendbird/channel';\nexport * from './sendbird/message';\nexport * from './sendbird/attrs';\nexport * from './sendbird/user';\n\nexport const NOOP: () => void = () => void 0;\nexport const ASYNC_NOOP = async () => void 0;\nexport const PASS = <T>(val: T) => val;\nexport const toMegabyte = (byte: number) => byte / 1024 / 1024;\nexport const isFunction = (param?: unknown): param is Function => typeof param === 'function';\n\nexport function ifThenOr<T>(cond: boolean, then: T): T | undefined;\nexport function ifThenOr<T, V>(cond: boolean, then: T, or: V): T | V;\nexport function ifThenOr(cond: boolean, then: unknown, or?: unknown) {\n if (cond) return then;\n return or;\n}\n\nexport const SBErrorCode = {\n UNAUTHORIZED_REQUEST: 400108,\n RESOURCE_NOT_FOUND: 400201,\n BANNED_USER_SEND_MESSAGE_NOT_ALLOWED: 900100,\n CHANNEL_NOT_FOUND: 900500,\n};\nexport const SBErrorMessage = {\n ACL:\n 'Sendbird provides various access control options when using the Chat SDK.\\n' +\n 'By default, the Allow retrieving user list attribute is turned on to facilitate creating sample apps.\\n' +\n 'However, this may grant access to unwanted data or operations, leading to potential security concerns.\\n' +\n 'To manage your access control settings, you can turn on or off each set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I;EACrB,OAAOC,EAAE;AACX;AAEO,MAAMC,WAAW,GAAA7C,OAAA,CAAA6C,WAAA,GAAG;EACzBC,oBAAoB,EAAE,MAAM;EAC5BC,kBAAkB,EAAE,MAAM;EAC1BC,oCAAoC,EAAE,MAAM;EAC5CC,iBAAiB,EAAE;AACrB,CAAC;AACM,MAAMC,cAAc,GAAAlD,OAAA,CAAAkD,cAAA,GAAG;EAC5BC,GAAG,EACD,6EAA6E,GAC7E,yGAAyG,GACzG,0GAA0G,GAC1G;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_logger","require","_arrayToMap","_interopRequireWildcard","_regex","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_bufferedRequest","_file","_rtl","_shared","_hooks","_reactNative","_groupChannel","_openChannel","_common","_channel","_message","_attrs","_user","_types","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","set","getOwnPropertyDescriptor","NOOP","ASYNC_NOOP","PASS","val","toMegabyte","byte","isFunction","param","ifThenOr","cond","then","or","SBErrorCode","UNAUTHORIZED_REQUEST","RESOURCE_NOT_FOUND","BANNED_USER_SEND_MESSAGE_NOT_ALLOWED","CHANNEL_NOT_FOUND","SBErrorMessage","ACL"],"sources":["index.ts"],"sourcesContent":["export { Logger } from './shared/logger';\nexport { default as arrayToMap, arrayToMapWithGetter } from './shared/arrayToMap';\nexport * from './shared/regex';\nexport * from './shared/bufferedRequest';\nexport * from './shared/file';\nexport * from './shared/rtl';\nexport * from './shared';\n\nexport * from './hooks';\nexport * from './hooks/react-native';\nexport * from './ui-format/groupChannel';\nexport * from './ui-format/openChannel';\nexport * from './ui-format/common';\nexport * from './sendbird/channel';\nexport * from './sendbird/message';\nexport * from './sendbird/attrs';\nexport * from './sendbird/user';\n\nexport const NOOP: () => void = () => void 0;\nexport const ASYNC_NOOP = async () => void 0;\nexport const PASS = <T>(val: T) => val;\nexport const toMegabyte = (byte: number) => byte / 1024 / 1024;\nexport const isFunction = (param?: unknown): param is Function => typeof param === 'function';\n\nexport function ifThenOr<T>(cond: boolean, then: T): T | undefined;\nexport function ifThenOr<T, V>(cond: boolean, then: T, or: V): T | V;\nexport function ifThenOr(cond: boolean, then: unknown, or?: unknown) {\n if (cond) return then;\n return or;\n}\n\nexport const SBErrorCode = {\n UNAUTHORIZED_REQUEST: 400108,\n RESOURCE_NOT_FOUND: 400201,\n BANNED_USER_SEND_MESSAGE_NOT_ALLOWED: 900100,\n CHANNEL_NOT_FOUND: 900500,\n};\nexport const SBErrorMessage = {\n ACL:\n 'Sendbird provides various access control options when using the Chat SDK.\\n' +\n 'By default, the Allow retrieving user list attribute is turned on to facilitate creating sample apps.\\n' +\n 'However, this may grant access to unwanted data or operations, leading to potential security concerns.\\n' +\n 'To manage your access control settings, you can turn on or off each setting on Sendbird Dashboard.',\n};\n\nexport * from './types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAAI,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,MAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,MAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,gBAAA,GAAAhB,OAAA;AAAAI,MAAA,CAAAC,IAAA,CAAAW,gBAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,I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C,GAAM,IAAKA,GAAG;AAACnC,OAAA,CAAAkC,IAAA,GAAAA,IAAA;AAChC,MAAME,UAAU,GAAIC,IAAY,IAAKA,IAAI,GAAG,IAAI,GAAG,IAAI;AAACrC,OAAA,CAAAoC,UAAA,GAAAA,UAAA;AACxD,MAAME,UAAU,GAAIC,KAAe,IAAwB,OAAOA,KAAK,KAAK,UAAU;AAACvC,OAAA,CAAAsC,UAAA,GAAAA,UAAA;AAIvF,SAASE,QAAQA,CAACC,IAAa,EAAEC,IAAa,EAAEC,EAAY,EAAE;EACnE,IAAIF,IAAI,EAAE,OAAOC,IAAI;EACrB,OAAOC,EAAE;AACX;AAEO,MAAMC,WAAW,GAAA5C,OAAA,CAAA4C,WAAA,GAAG;EACzBC,oBAAoB,EAAE,MAAM;EAC5BC,kBAAkB,EAAE,MAAM;EAC1BC,oCAAoC,EAAE,MAAM;EAC5CC,iBAAiB,EAAE;AACrB,CAAC;AACM,MAAMC,cAAc,GAAAjD,OAAA,CAAAiD,cAAA,GAAG;EAC5BC,GAAG,EACD,6EAA6E,GAC7E,yGAAyG,GACzG,0GAA0G,GAC1G;AACJ,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_message","require","_file","_common","isNewMessage","msg","currentUserId","myMessage","isMyMessage","isAdminMessage","updatedAt","isSendableMessage","undefined","_msg$sender","sender","userId","messageKeyExtractor","message","getMessageUniqId","messageComparator","a","b","aStatusOffset","bStatusOffset","sendingStatus","Number","MAX_SAFE_INTEGER","createdAt","hasSameSender","_a$sender","_b$sender","calcMessageGrouping","groupEnabled","curr","prev","next","isReplyThreadType","hasParentMessageUI","getPrev","parentMessageId","threadInfo","getMessageTimeFormat","Date","getNext","groupWithPrev","groupWithNext","isUserMessage","isFileMessage","String","messageId","reqId","getThumbnailUriFromFileMessage","thumbnails","length","url","getAvailableUriFromFileMessage","_message$messageParam","messageParams","file","uri","isSendbirdNotification","dataPayload","Boolean","parseSendbirdNotification","sendbird","JSON","parse","shouldRenderParentMessage","hide","_message$parentMessag","_message$parentMessag2","parentMessage","shouldRenderReaction","channel","reactionEnabled","isOpenChannel","isGroupChannel","isBroadcast","isEphemeral","isChatNotification","getReactionCount","reaction","count","fileIconMapper","getFileTypeFromMessage","getFileType","type","getFileExtension","name","convertFileTypeToMessageType","fileType","exports","getFileIconFromMessageType","messageType","getFileIconFromMessage","getMessageType","ogMetaData","isVoiceMessage","getDefaultMessageSearchQueryParams","keyword","channelUrl","messageTimestampFrom","Math","max","joinedAt","invitedAt","order","MessageSearchOrder","TIMESTAMP","SBU_MIME_PARAM_KEY","SBU_MIME_PARAM_VOICE_MESSAGE_VALUE","parameters","parseMimeType","getVoiceMessageFileObject","extension","getVoiceMessageMimeType","size"],"sources":["message.ts"],"sourcesContent":["import { MessageSearchOrder } from '@sendbird/chat/message';\n\nimport { getFileExtension, getFileType, parseMimeType } from '../shared/file';\nimport type {\n SendbirdBaseChannel,\n SendbirdBaseMessage,\n SendbirdDataPayload,\n SendbirdFileMessage,\n SendbirdGroupChannel,\n SendbirdMessage,\n SendbirdReaction,\n SendbirdSendableMessage,\n SendbirdUserMessage,\n} from '../types';\nimport { getMessageTimeFormat } from '../ui-format/common';\n\nexport function isNewMessage(msg: SendbirdMessage, currentUserId?: string) {\n const myMessage = isMyMessage(msg, currentUserId);\n if (myMessage) return false;\n if (msg.isAdminMessage()) return false;\n return msg.updatedAt === 0;\n}\n\nexport function isSendableMessage(msg?: SendbirdMessage | null): msg is SendbirdSendableMessage {\n return msg !== undefined && msg !== null && 'sendingStatus' in msg;\n}\n\nexport function isMyMessage(\n msg?: SendbirdMessage | null,\n currentUserId = '##__USER_ID_IS_NOT_PROVIDED__##',\n): msg is SendbirdSendableMessage {\n if (!isSendableMessage(msg)) return false;\n return msg.sender?.userId === currentUserId;\n}\n\nexport function messageKeyExtractor(message: SendbirdMessage): string {\n return getMessageUniqId(message);\n}\n\n// |-------------------|-------------------|-----------------|-------------------|\n// | sending status | reqId | messageId | createdAt |\n// |-------------------|-------------------|-----------------|-------------------|\n// | pending | timestamp(A) | 0 | timestamp(B) |\n// | canceled | timestamp(A) | 0 | ? |\n// | failed | timestamp(A) | 0 | ? |\n// | succeeded | timestamp(A) / '' | id from DB | timestamp(C) |\n// |-------------------|-------------------|-----------------|-------------------|\nexport function messageComparator(a: SendbirdMessage, b: SendbirdMessage) {\n let aStatusOffset = 0;\n let bStatusOffset = 0;\n\n if (isSendableMessage(a) && a.sendingStatus !== 'succeeded') aStatusOffset = Number.MAX_SAFE_INTEGER;\n if (isSendableMessage(b) && b.sendingStatus !== 'succeeded') bStatusOffset = Number.MAX_SAFE_INTEGER;\n\n return b.createdAt + bStatusOffset - (a.createdAt + aStatusOffset);\n}\n\nexport function hasSameSender(a?: SendbirdMessage, b?: SendbirdMessage) {\n if (!a || !b) return false;\n if ('sender' in a && 'sender' in b) return a.sender?.userId === b.sender?.userId;\n return false;\n}\n\nexport function calcMessageGrouping(\n groupEnabled: boolean,\n curr: SendbirdMessage,\n prev?: SendbirdMessage,\n next?: SendbirdMessage,\n isReplyThreadType?: boolean,\n hasParentMessageUI?: boolean,\n) {\n const getPrev = () => {\n if (!groupEnabled) return false;\n if (!prev) return false;\n if (curr.isAdminMessage()) return false;\n if (!hasSameSender(curr, prev)) return false;\n if (hasParentMessageUI && curr.parentMessageId) return false;\n if (isReplyThreadType && curr.threadInfo) return false;\n if (getMessageTimeFormat(new Date(curr.createdAt)) !== getMessageTimeFormat(new Date(prev.createdAt))) return false;\n return true;\n };\n\n const getNext = () => {\n if (!groupEnabled) return false;\n if (!next) return false;\n if (curr.isAdminMessage()) return false;\n if (!hasSameSender(curr, next)) return false;\n if (hasParentMessageUI && curr.parentMessageId) return false;\n if (isReplyThreadType && curr.threadInfo) return false;\n if (getMessageTimeFormat(new Date(curr.createdAt)) !== getMessageTimeFormat(new Date(next.createdAt))) return false;\n return true;\n };\n\n return { groupWithPrev: getPrev(), groupWithNext: getNext() };\n}\n\nexport function getMessageUniqId(msg: SendbirdBaseMessage) {\n if (msg.isUserMessage() || msg.isFileMessage()) {\n if (msg.sendingStatus === 'succeeded') return String(msg.messageId);\n return msg.reqId;\n }\n\n return String(msg.messageId);\n}\n\nexport function getThumbnailUriFromFileMessage(message: SendbirdFileMessage) {\n if (message.thumbnails && message.thumbnails.length > 0) {\n return message.thumbnails[0].url;\n }\n\n return getAvailableUriFromFileMessage(message);\n}\n\nexport function getAvailableUriFromFileMessage(message: SendbirdFileMessage) {\n if (!message.url && message.messageParams?.file && 'uri' in message.messageParams.file) {\n return message.messageParams.file.uri;\n }\n\n return message.url;\n}\n\ntype RawSendbirdDataPayload = { sendbird: string | object };\nexport function isSendbirdNotification(dataPayload?: {\n [key: string]: string | object;\n}): dataPayload is RawSendbirdDataPayload {\n if (!dataPayload) return false;\n return Boolean(dataPayload['sendbird']);\n}\n\nexport function parseSendbirdNotification(dataPayload: RawSendbirdDataPayload): SendbirdDataPayload {\n return typeof dataPayload.sendbird === 'string' ? JSON.parse(dataPayload.sendbird) : dataPayload.sendbird;\n}\n\nexport function shouldRenderParentMessage(\n message: SendbirdMessage,\n hide = false,\n): message is (SendbirdUserMessage | SendbirdFileMessage) & {\n parentMessage: SendbirdUserMessage | SendbirdFileMessage;\n} {\n if (hide) return false;\n return !!(\n (message.isFileMessage() || message.isUserMessage()) &&\n (message.parentMessage?.isFileMessage() || message.parentMessage?.isUserMessage())\n );\n}\n\nexport function shouldRenderReaction(channel: SendbirdBaseChannel, reactionEnabled: boolean) {\n if (channel.isOpenChannel()) {\n return false;\n }\n\n if (channel.isGroupChannel()) {\n if (channel.isBroadcast) return false;\n if (channel.isEphemeral) return false;\n if (channel.isChatNotification) return false;\n }\n\n return reactionEnabled;\n}\n\nexport function getReactionCount(reaction: SendbirdReaction) {\n return reaction.count;\n}\n\nexport type MessageType =\n | 'user'\n | 'admin'\n | 'file'\n | 'unknown'\n | `user.${'opengraph'}`\n | `file.${'image' | 'video' | 'audio' | 'voice'}`;\n\nexport type FileType = 'file' | 'image' | 'audio' | 'video';\n\nconst fileIconMapper = {\n 'audio': 'file-audio',\n 'image': 'photo',\n 'video': 'play',\n 'file': 'file-document',\n} as const;\n\ntype ValueOf<T> = T[keyof T];\nexport type FileIcon = ValueOf<typeof fileIconMapper>;\n\nexport function getFileTypeFromMessage(message: SendbirdFileMessage): FileType {\n return getFileType(message.type || getFileExtension(message.name));\n}\nexport const convertFileTypeToMessageType = (fileType: FileType = 'file'): MessageType => {\n switch (fileType) {\n case 'audio':\n case 'image':\n case 'video':\n return `file.${fileType}`;\n case 'file':\n return fileType;\n }\n};\nexport const getFileIconFromMessageType = (messageType: MessageType): FileIcon => {\n switch (messageType) {\n case 'file':\n return fileIconMapper['file'];\n case 'file.image':\n return fileIconMapper['image'];\n case 'file.video':\n return fileIconMapper['video'];\n case 'file.audio':\n return fileIconMapper['audio'];\n default:\n return fileIconMapper['file'];\n }\n};\nexport const getFileIconFromMessage = (message: SendbirdFileMessage): FileIcon => {\n const fileType = getFileTypeFromMessage(message);\n const messageType = convertFileTypeToMessageType(fileType);\n return getFileIconFromMessageType(messageType);\n};\n\nexport function getMessageType(message: SendbirdMessage): MessageType {\n if (message.isAdminMessage()) {\n return 'admin';\n }\n\n if (message.isUserMessage()) {\n if (message.ogMetaData) {\n return 'user.opengraph';\n }\n return 'user';\n }\n\n if (message.isFileMessage()) {\n if (isVoiceMessage(message)) {\n return 'file.voice';\n }\n\n const fileType = getFileTypeFromMessage(message);\n switch (fileType) {\n case 'image':\n case 'video': {\n return `file.${fileType}`;\n }\n case 'audio': {\n return `file.${fileType}`;\n }\n default: {\n return 'file';\n }\n }\n }\n\n return 'unknown';\n}\n\nexport function getDefaultMessageSearchQueryParams(channel: SendbirdGroupChannel, keyword: string) {\n return {\n keyword,\n channelUrl: channel.url,\n messageTimestampFrom: Math.max(channel.joinedAt, channel.invitedAt),\n order: MessageSearchOrder.TIMESTAMP,\n };\n}\n\nconst SBU_MIME_PARAM_KEY = 'sbu_type';\nconst SBU_MIME_PARAM_VOICE_MESSAGE_VALUE = 'voice';\n\nexport function isVoiceMessage(message: SendbirdMessage): message is SendbirdFileMessage {\n if (!message.isFileMessage()) return false;\n\n const { parameters } = parseMimeType(message.type);\n return !!parameters[SBU_MIME_PARAM_KEY] && parameters[SBU_MIME_PARAM_KEY] === SBU_MIME_PARAM_VOICE_MESSAGE_VALUE;\n}\n\nexport function getVoiceMessageFileObject(uri: string, extension = 'm4a') {\n return {\n uri,\n type: getVoiceMessageMimeType(extension),\n name: `Voice_message.${extension}`,\n size: 0,\n };\n}\n\nexport function getVoiceMessageMimeType(extension = 'm4a') {\n return `audio/${extension};${SBU_MIME_PARAM_KEY}=${SBU_MIME_PARAM_VOICE_MESSAGE_VALUE}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAYA,IAAAE,OAAA,GAAAF,OAAA;AAEO,SAASG,YAAYA,CAACC,GAAoB,EAAEC,aAAsB,EAAE;EACzE,MAAMC,SAAS,GAAGC,WAAW,CAACH,GAAG,EAAEC,aAAa,CAAC;EACjD,IAAIC,SAAS,EAAE,OAAO,KAAK;EAC3B,IAAIF,GAAG,CAACI,cAAc,CAAC,CAAC,EAAE,OAAO,KAAK;EACtC,OAAOJ,GAAG,CAACK,SAAS,KAAK,CAAC;AAC5B;AAEO,SAASC,iBAAiBA,CAACN,GAA4B,EAAkC;EAC9F,OAAOA,GAAG,KAAKO,SAAS,IAAIP,GAAG,KAAK,IAAI,IAAI,eAAe,IAAIA,GAAG;AACpE;AAEO,SAASG,WAAWA,CACzBH,GAA4B,EAC5BC,aAAa,GAAG,iCAAiC,EACjB;EAAA,IAAAO,WAAA;EAChC,IAAI,CAACF,iBAAiB,CAACN,GAAG,CAAC,EAAE,OAAO,KAAK;EACzC,OAAO,EAAAQ,WAAA,GAAAR,GAAG,CAACS,MAAM,cAAAD,WAAA,uBAAVA,WAAA,CAAYE,MAAM,M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AAS,IAAIL,kBAAkB,IAAIC,kCAAkC,EAAE;AACzF","ignoreList":[]}
1
+ {"version":3,"names":["_message","require","_file","_common","isNewMessage","msg","currentUserId","myMessage","isMyMessage","isAdminMessage","updatedAt","isSendableMessage","undefined","_msg$sender","sender","userId","messageKeyExtractor","message","getMessageUniqId","messageComparator","a","b","aStatusOffset","bStatusOffset","sendingStatus","Number","MAX_SAFE_INTEGER","createdAt","hasSameSender","_a$sender","_b$sender","calcMessageGrouping","groupEnabled","curr","prev","next","isReplyThreadType","hasParentMessageUI","getPrev","parentMessageId","threadInfo","getMessageTimeFormat","Date","getNext","groupWithPrev","groupWithNext","isUserMessage","isFileMessage","String","messageId","reqId","getThumbnailUriFromFileMessage","thumbnails","length","url","getAvailableUriFromFileMessage","_message$messageParam","messageParams","file","uri","isSendbirdNotification","dataPayload","Boolean","parseSendbirdNotification","sendbird","JSON","parse","shouldRenderParentMessage","hide","_message$parentMessag","_message$parentMessag2","parentMessage","shouldRenderReaction","channel","reactionEnabled","isOpenChannel","isGroupChannel","isBroadcast","isEphemeral","isChatNotification","getReactionCount","reaction","count","fileIconMapper","getFileTypeFromMessage","getFileType","type","getFileExtension","name","convertFileTypeToMessageType","fileType","exports","getFileIconFromMessageType","messageType","getFileIconFromMessage","getMessageType","ogMetaData","isVoiceMessage","getDefaultMessageSearchQueryParams","keyword","channelUrl","messageTimestampFrom","Math","max","joinedAt","invitedAt","order","MessageSearchOrder","TIMESTAMP","SBU_MIME_PARAM_KEY","SBU_MIME_PARAM_VOICE_MESSAGE_VALUE","parameters","parseMimeType","getVoiceMessageFileObject","extension","getVoiceMessageMimeType","size"],"sources":["message.ts"],"sourcesContent":["import { MessageSearchOrder } from '@sendbird/chat/message';\n\nimport { getFileExtension, getFileType, parseMimeType } from '../shared/file';\nimport type {\n SendbirdBaseChannel,\n SendbirdBaseMessage,\n SendbirdDataPayload,\n SendbirdFileMessage,\n SendbirdGroupChannel,\n SendbirdMessage,\n SendbirdReaction,\n SendbirdSendableMessage,\n SendbirdUserMessage,\n} from '../types';\nimport { getMessageTimeFormat } from '../ui-format/common';\n\nexport function isNewMessage(msg: SendbirdMessage, currentUserId?: string) {\n const myMessage = isMyMessage(msg, currentUserId);\n if (myMessage) return false;\n if (msg.isAdminMessage()) return false;\n return msg.updatedAt === 0;\n}\n\nexport function isSendableMessage(msg?: SendbirdMessage | null): msg is SendbirdSendableMessage {\n return msg !== undefined && msg !== null && 'sendingStatus' in msg;\n}\n\nexport function isMyMessage(\n msg?: SendbirdMessage | null,\n currentUserId = '##__USER_ID_IS_NOT_PROVIDED__##',\n): msg is SendbirdSendableMessage {\n if (!isSendableMessage(msg)) return false;\n return msg.sender?.userId === currentUserId;\n}\n\nexport function messageKeyExtractor(message: SendbirdMessage): string {\n return getMessageUniqId(message);\n}\n\n// |-------------------|-------------------|-----------------|-------------------|\n// | sending status | reqId | messageId | createdAt |\n// |-------------------|-------------------|-----------------|-------------------|\n// | pending | timestamp(A) | 0 | timestamp(B) |\n// | canceled | timestamp(A) | 0 | ? |\n// | failed | timestamp(A) | 0 | ? |\n// | succeeded | timestamp(A) / '' | id from DB | timestamp(C) |\n// |-------------------|-------------------|-----------------|-------------------|\nexport function messageComparator(a: SendbirdMessage, b: SendbirdMessage) {\n let aStatusOffset = 0;\n let bStatusOffset = 0;\n\n if (isSendableMessage(a) && a.sendingStatus !== 'succeeded') aStatusOffset = Number.MAX_SAFE_INTEGER;\n if (isSendableMessage(b) && b.sendingStatus !== 'succeeded') bStatusOffset = Number.MAX_SAFE_INTEGER;\n\n return b.createdAt + bStatusOffset - (a.createdAt + aStatusOffset);\n}\n\nexport function hasSameSender(a?: SendbirdMessage, b?: SendbirdMessage) {\n if (!a || !b) return false;\n if ('sender' in a && 'sender' in b) return a.sender?.userId === b.sender?.userId;\n return false;\n}\n\nexport function calcMessageGrouping(\n groupEnabled: boolean,\n curr: SendbirdMessage,\n prev?: SendbirdMessage,\n next?: SendbirdMessage,\n isReplyThreadType?: boolean,\n hasParentMessageUI?: boolean,\n) {\n const getPrev = () => {\n if (!groupEnabled) return false;\n if (!prev) return false;\n if (curr.isAdminMessage()) return false;\n if (!hasSameSender(curr, prev)) return false;\n if (hasParentMessageUI && curr.parentMessageId) return false;\n if (isReplyThreadType && curr.threadInfo) return false;\n if (getMessageTimeFormat(new Date(curr.createdAt)) !== getMessageTimeFormat(new Date(prev.createdAt))) return false;\n return true;\n };\n\n const getNext = () => {\n if (!groupEnabled) return false;\n if (!next) return false;\n if (curr.isAdminMessage()) return false;\n if (!hasSameSender(curr, next)) return false;\n if (hasParentMessageUI && curr.parentMessageId) return false;\n if (isReplyThreadType && curr.threadInfo) return false;\n if (getMessageTimeFormat(new Date(curr.createdAt)) !== getMessageTimeFormat(new Date(next.createdAt))) return false;\n return true;\n };\n\n return { groupWithPrev: getPrev(), groupWithNext: getNext() };\n}\n\nexport function getMessageUniqId(msg: SendbirdBaseMessage) {\n if (msg.isUserMessage() || msg.isFileMessage()) {\n if (msg.sendingStatus === 'succeeded') return String(msg.messageId);\n return msg.reqId;\n }\n\n return String(msg.messageId);\n}\n\nexport function getThumbnailUriFromFileMessage(message: SendbirdFileMessage) {\n if (message.thumbnails && message.thumbnails.length > 0) {\n return message.thumbnails[0].url;\n }\n\n return getAvailableUriFromFileMessage(message);\n}\n\nexport function getAvailableUriFromFileMessage(message: SendbirdFileMessage) {\n if (!message.url && message.messageParams?.file && 'uri' in message.messageParams.file) {\n return message.messageParams.file.uri;\n }\n\n return message.url;\n}\n\ntype RawSendbirdDataPayload = { sendbird: string | SendbirdDataPayload };\nexport function isSendbirdNotification(dataPayload?: {\n [key: string]: string | object;\n}): dataPayload is RawSendbirdDataPayload {\n if (!dataPayload) return false;\n return Boolean(dataPayload['sendbird']);\n}\n\nexport function parseSendbirdNotification(dataPayload: RawSendbirdDataPayload): SendbirdDataPayload {\n return typeof dataPayload.sendbird === 'string'\n ? JSON.parse(dataPayload.sendbird)\n : (dataPayload.sendbird as SendbirdDataPayload);\n}\n\nexport function shouldRenderParentMessage(\n message: SendbirdMessage,\n hide = false,\n): message is (SendbirdUserMessage | SendbirdFileMessage) & {\n parentMessage: SendbirdUserMessage | SendbirdFileMessage;\n} {\n if (hide) return false;\n return !!(\n (message.isFileMessage() || message.isUserMessage()) &&\n (message.parentMessage?.isFileMessage() || message.parentMessage?.isUserMessage())\n );\n}\n\nexport function shouldRenderReaction(channel: SendbirdBaseChannel, reactionEnabled: boolean) {\n if (channel.isOpenChannel()) {\n return false;\n }\n\n if (channel.isGroupChannel()) {\n if (channel.isBroadcast) return false;\n if (channel.isEphemeral) return false;\n if (channel.isChatNotification) return false;\n }\n\n return reactionEnabled;\n}\n\nexport function getReactionCount(reaction: SendbirdReaction) {\n return reaction.count;\n}\n\nexport type MessageType =\n | 'user'\n | 'admin'\n | 'file'\n | 'unknown'\n | `user.${'opengraph'}`\n | `file.${'image' | 'video' | 'audio' | 'voice'}`;\n\nexport type FileType = 'file' | 'image' | 'audio' | 'video';\n\nconst fileIconMapper = {\n 'audio': 'file-audio',\n 'image': 'photo',\n 'video': 'play',\n 'file': 'file-document',\n} as const;\n\ntype ValueOf<T> = T[keyof T];\nexport type FileIcon = ValueOf<typeof fileIconMapper>;\n\nexport function getFileTypeFromMessage(message: SendbirdFileMessage): FileType {\n return getFileType(message.type || getFileExtension(message.name));\n}\nexport const convertFileTypeToMessageType = (fileType: FileType = 'file'): MessageType => {\n switch (fileType) {\n case 'audio':\n case 'image':\n case 'video':\n return `file.${fileType}`;\n case 'file':\n return fileType;\n }\n};\nexport const getFileIconFromMessageType = (messageType: MessageType): FileIcon => {\n switch (messageType) {\n case 'file':\n return fileIconMapper['file'];\n case 'file.image':\n return fileIconMapper['image'];\n case 'file.video':\n return fileIconMapper['video'];\n case 'file.audio':\n return fileIconMapper['audio'];\n default:\n return fileIconMapper['file'];\n }\n};\nexport const getFileIconFromMessage = (message: SendbirdFileMessage): FileIcon => {\n const fileType = getFileTypeFromMessage(message);\n const messageType = convertFileTypeToMessageType(fileType);\n return getFileIconFromMessageType(messageType);\n};\n\nexport function getMessageType(message: SendbirdMessage): MessageType {\n if (message.isAdminMessage()) {\n return 'admin';\n }\n\n if (message.isUserMessage()) {\n if (message.ogMetaData) {\n return 'user.opengraph';\n }\n return 'user';\n }\n\n if (message.isFileMessage()) {\n if (isVoiceMessage(message)) {\n return 'file.voice';\n }\n\n const fileType = getFileTypeFromMessage(message);\n switch (fileType) {\n case 'image':\n case 'video': {\n return `file.${fileType}`;\n }\n case 'audio': {\n return `file.${fileType}`;\n }\n default: {\n return 'file';\n }\n }\n }\n\n return 'unknown';\n}\n\nexport function getDefaultMessageSearchQueryParams(channel: SendbirdGroupChannel, keyword: string) {\n return {\n keyword,\n channelUrl: channel.url,\n messageTimestampFrom: Math.max(channel.joinedAt, channel.invitedAt),\n order: MessageSearchOrder.TIMESTAMP,\n };\n}\n\nconst SBU_MIME_PARAM_KEY = 'sbu_type';\nconst SBU_MIME_PARAM_VOICE_MESSAGE_VALUE = 'voice';\n\nexport function isVoiceMessage(message: SendbirdMessage): message is SendbirdFileMessage {\n if (!message.isFileMessage()) return false;\n\n const { parameters } = parseMimeType(message.type);\n return !!parameters[SBU_MIME_PARAM_KEY] && parameters[SBU_MIME_PARAM_KEY] === SBU_MIME_PARAM_VOICE_MESSAGE_VALUE;\n}\n\nexport function getVoiceMessageFileObject(uri: string, extension = 'm4a') {\n return {\n uri,\n type: getVoiceMessageMimeType(extension),\n name: `Voice_message.${extension}`,\n size: 0,\n };\n}\n\nexport function getVoiceMessageMimeType(extension = 'm4a') {\n return `audio/${extension};${SBU_MIME_PARAM_KEY}=${SBU_MIME_PARAM_VOICE_MESSAGE_VALUE}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAYA,IAAAE,OAAA,GAAAF,OAAA;AAEO,SAASG,YAAYA,CAACC,GAAoB,EAAEC,aAAsB,EAAE;EACz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,SAASb,cAAcA,CAAChF,OAAwB,EAAkC;EACvF,IAAI,CAACA,OAAO,CAAC8B,aAAa,CAAC,CAAC,EAAE,OAAO,KAAK;EAE1C,MAAM;IAAEgE;EAAW,CAAC,GAAG,IAAAC,mBAAa,EAAC/F,OAAO,CAACqE,IAAI,CAAC;EAClD,OAAO,CAAC,CAACyB,UAAU,CAACF,kBAAkB,CAAC,IAAIE,UAAU,CAACF,kBAAkB,CAAC,KAAKC,kCAAkC;AAClH;AAEO,SAASG,yBAAyBA,CAACtD,GAAW,EAAEuD,SAAS,GAAG,KAAK,EAAE;EACxE,OAAO;IACLvD,GAAG;IACH2B,IAAI,EAAE6B,uBAAuB,CAACD,SAAS,CAAC;IACxC1B,IAAI,EAAE,iBAAiB0B,SAAS,EAAE;IAClCE,IAAI,EAAE;EACR,CAAC;AACH;AAEO,SAASD,uBAAuBA,CAACD,SAAS,GAAG,KAAK,EAAE;EACzD,OAAO,SAASA,SAAS,IAAIL,kBAAkB,IAAIC,kCAAkC,EAAE;AACzF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["MessageSearchOrder","getFileExtension","getFileType","parseMimeType","getMessageTimeFormat","isNewMessage","msg","currentUserId","myMessage","isMyMessage","isAdminMessage","updatedAt","isSendableMessage","undefined","_msg$sender","sender","userId","messageKeyExtractor","message","getMessageUniqId","messageComparator","a","b","aStatusOffset","bStatusOffset","sendingStatus","Number","MAX_SAFE_INTEGER","createdAt","hasSameSender","_a$sender","_b$sender","calcMessageGrouping","groupEnabled","curr","prev","next","isReplyThreadType","hasParentMessageUI","getPrev","parentMessageId","threadInfo","Date","getNext","groupWithPrev","groupWithNext","isUserMessage","isFileMessage","String","messageId","reqId","getThumbnailUriFromFileMessage","thumbnails","length","url","getAvailableUriFromFileMessage","_message$messageParam","messageParams","file","uri","isSendbirdNotification","dataPayload","Boolean","parseSendbirdNotification","sendbird","JSON","parse","shouldRenderParentMessage","hide","_message$parentMessag","_message$parentMessag2","parentMessage","shouldRenderReaction","channel","reactionEnabled","isOpenChannel","isGroupChannel","isBroadcast","isEphemeral","isChatNotification","getReactionCount","reaction","count","fileIconMapper","getFileTypeFromMessage","type","name","convertFileTypeToMessageType","fileType","getFileIconFromMessageType","messageType","getFileIconFromMessage","getMessageType","ogMetaData","isVoiceMessage","getDefaultMessageSearchQueryParams","keyword","channelUrl","messageTimestampFrom","Math","max","joinedAt","invitedAt","order","TIMESTAMP","SBU_MIME_PARAM_KEY","SBU_MIME_PARAM_VOICE_MESSAGE_VALUE","parameters","getVoiceMessageFileObject","extension","getVoiceMessageMimeType","size"],"sources":["message.ts"],"sourcesContent":["import { MessageSearchOrder } from '@sendbird/chat/message';\n\nimport { getFileExtension, getFileType, parseMimeType } from '../shared/file';\nimport type {\n SendbirdBaseChannel,\n SendbirdBaseMessage,\n SendbirdDataPayload,\n SendbirdFileMessage,\n SendbirdGroupChannel,\n SendbirdMessage,\n SendbirdReaction,\n SendbirdSendableMessage,\n SendbirdUserMessage,\n} from '../types';\nimport { getMessageTimeFormat } from '../ui-format/common';\n\nexport function isNewMessage(msg: SendbirdMessage, currentUserId?: string) {\n const myMessage = isMyMessage(msg, currentUserId);\n if (myMessage) return false;\n if (msg.isAdminMessage()) return false;\n return msg.updatedAt === 0;\n}\n\nexport function isSendableMessage(msg?: SendbirdMessage | null): msg is SendbirdSendableMessage {\n return msg !== undefined && msg !== null && 'sendingStatus' in msg;\n}\n\nexport function isMyMessage(\n msg?: SendbirdMessage | null,\n currentUserId = '##__USER_ID_IS_NOT_PROVIDED__##',\n): msg is SendbirdSendableMessage {\n if (!isSendableMessage(msg)) return false;\n return msg.sender?.userId === currentUserId;\n}\n\nexport function messageKeyExtractor(message: SendbirdMessage): string {\n return getMessageUniqId(message);\n}\n\n// |-------------------|-------------------|-----------------|-------------------|\n// | sending status | reqId | messageId | createdAt |\n// |-------------------|-------------------|-----------------|-------------------|\n// | pending | timestamp(A) | 0 | timestamp(B) |\n// | canceled | timestamp(A) | 0 | ? |\n// | failed | timestamp(A) | 0 | ? |\n// | succeeded | timestamp(A) / '' | id from DB | timestamp(C) |\n// |-------------------|-------------------|-----------------|-------------------|\nexport function messageComparator(a: SendbirdMessage, b: SendbirdMessage) {\n let aStatusOffset = 0;\n let bStatusOffset = 0;\n\n if (isSendableMessage(a) && a.sendingStatus !== 'succeeded') aStatusOffset = Number.MAX_SAFE_INTEGER;\n if (isSendableMessage(b) && b.sendingStatus !== 'succeeded') bStatusOffset = Number.MAX_SAFE_INTEGER;\n\n return b.createdAt + bStatusOffset - (a.createdAt + aStatusOffset);\n}\n\nexport function hasSameSender(a?: SendbirdMessage, b?: SendbirdMessage) {\n if (!a || !b) return false;\n if ('sender' in a && 'sender' in b) return a.sender?.userId === b.sender?.userId;\n return false;\n}\n\nexport function calcMessageGrouping(\n groupEnabled: boolean,\n curr: SendbirdMessage,\n prev?: SendbirdMessage,\n next?: SendbirdMessage,\n isReplyThreadType?: boolean,\n hasParentMessageUI?: boolean,\n) {\n const getPrev = () => {\n if (!groupEnabled) return false;\n if (!prev) return false;\n if (curr.isAdminMessage()) return false;\n if (!hasSameSender(curr, prev)) return false;\n if (hasParentMessageUI && curr.parentMessageId) return false;\n if (isReplyThreadType && curr.threadInfo) return false;\n if (getMessageTimeFormat(new Date(curr.createdAt)) !== getMessageTimeFormat(new Date(prev.createdAt))) return false;\n return true;\n };\n\n const getNext = () => {\n if (!groupEnabled) return false;\n if (!next) return false;\n if (curr.isAdminMessage()) return false;\n if (!hasSameSender(curr, next)) return false;\n if (hasParentMessageUI && curr.parentMessageId) return false;\n if (isReplyThreadType && curr.threadInfo) return false;\n if (getMessageTimeFormat(new Date(curr.createdAt)) !== getMessageTimeFormat(new Date(next.createdAt))) return false;\n return true;\n };\n\n return { groupWithPrev: getPrev(), groupWithNext: getNext() };\n}\n\nexport function getMessageUniqId(msg: SendbirdBaseMessage) {\n if (msg.isUserMessage() || msg.isFileMessage()) {\n if (msg.sendingStatus === 'succeeded') return String(msg.messageId);\n return msg.reqId;\n }\n\n return String(msg.messageId);\n}\n\nexport function getThumbnailUriFromFileMessage(message: SendbirdFileMessage) {\n if (message.thumbnails && message.thumbnails.length > 0) {\n return message.thumbnails[0].url;\n }\n\n return getAvailableUriFromFileMessage(message);\n}\n\nexport function getAvailableUriFromFileMessage(message: SendbirdFileMessage) {\n if (!message.url && message.messageParams?.file && 'uri' in message.messageParams.file) {\n return message.messageParams.file.uri;\n }\n\n return message.url;\n}\n\ntype RawSendbirdDataPayload = { sendbird: string | object };\nexport function isSendbirdNotification(dataPayload?: {\n [key: string]: string | object;\n}): dataPayload is RawSendbirdDataPayload {\n if (!dataPayload) return false;\n return Boolean(dataPayload['sendbird']);\n}\n\nexport function parseSendbirdNotification(dataPayload: RawSendbirdDataPayload): SendbirdDataPayload {\n return typeof dataPayload.sendbird === 'string' ? JSON.parse(dataPayload.sendbird) : dataPayload.sendbird;\n}\n\nexport function shouldRenderParentMessage(\n message: SendbirdMessage,\n hide = false,\n): message is (SendbirdUserMessage | SendbirdFileMessage) & {\n parentMessage: SendbirdUserMessage | SendbirdFileMessage;\n} {\n if (hide) return false;\n return !!(\n (message.isFileMessage() || message.isUserMessage()) &&\n (message.parentMessage?.isFileMessage() || message.parentMessage?.isUserMessage())\n );\n}\n\nexport function shouldRenderReaction(channel: SendbirdBaseChannel, reactionEnabled: boolean) {\n if (channel.isOpenChannel()) {\n return false;\n }\n\n if (channel.isGroupChannel()) {\n if (channel.isBroadcast) return false;\n if (channel.isEphemeral) return false;\n if (channel.isChatNotification) return false;\n }\n\n return reactionEnabled;\n}\n\nexport function getReactionCount(reaction: SendbirdReaction) {\n return reaction.count;\n}\n\nexport type MessageType =\n | 'user'\n | 'admin'\n | 'file'\n | 'unknown'\n | `user.${'opengraph'}`\n | `file.${'image' | 'video' | 'audio' | 'voice'}`;\n\nexport type FileType = 'file' | 'image' | 'audio' | 'video';\n\nconst fileIconMapper = {\n 'audio': 'file-audio',\n 'image': 'photo',\n 'video': 'play',\n 'file': 'file-document',\n} as const;\n\ntype ValueOf<T> = T[keyof T];\nexport type FileIcon = ValueOf<typeof fileIconMapper>;\n\nexport function getFileTypeFromMessage(message: SendbirdFileMessage): FileType {\n return getFileType(message.type || getFileExtension(message.name));\n}\nexport const convertFileTypeToMessageType = (fileType: FileType = 'file'): MessageType => {\n switch (fileType) {\n case 'audio':\n case 'image':\n case 'video':\n return `file.${fileType}`;\n case 'file':\n return fileType;\n }\n};\nexport const getFileIconFromMessageType = (messageType: MessageType): FileIcon => {\n switch (messageType) {\n case 'file':\n return fileIconMapper['file'];\n case 'file.image':\n return fileIconMapper['image'];\n case 'file.video':\n return fileIconMapper['video'];\n case 'file.audio':\n return fileIconMapper['audio'];\n default:\n return fileIconMapper['file'];\n }\n};\nexport const getFileIconFromMessage = (message: SendbirdFileMessage): FileIcon => {\n const fileType = getFileTypeFromMessage(message);\n const messageType = convertFileTypeToMessageType(fileType);\n return getFileIconFromMessageType(messageType);\n};\n\nexport function getMessageType(message: SendbirdMessage): MessageType {\n if (message.isAdminMessage()) {\n return 'admin';\n }\n\n if (message.isUserMessage()) {\n if (message.ogMetaData) {\n return 'user.opengraph';\n }\n return 'user';\n }\n\n if (message.isFileMessage()) {\n if (isVoiceMessage(message)) {\n return 'file.voice';\n }\n\n const fileType = getFileTypeFromMessage(message);\n switch (fileType) {\n case 'image':\n case 'video': {\n return `file.${fileType}`;\n }\n case 'audio': {\n return `file.${fileType}`;\n }\n default: {\n return 'file';\n }\n }\n }\n\n return 'unknown';\n}\n\nexport function getDefaultMessageSearchQueryParams(channel: SendbirdGroupChannel, keyword: string) {\n return {\n keyword,\n channelUrl: channel.url,\n messageTimestampFrom: Math.max(channel.joinedAt, channel.invitedAt),\n order: MessageSearchOrder.TIMESTAMP,\n };\n}\n\nconst SBU_MIME_PARAM_KEY = 'sbu_type';\nconst SBU_MIME_PARAM_VOICE_MESSAGE_VALUE = 'voice';\n\nexport function isVoiceMessage(message: SendbirdMessage): message is SendbirdFileMessage {\n if (!message.isFileMessage()) return false;\n\n const { parameters } = parseMimeType(message.type);\n return !!parameters[SBU_MIME_PARAM_KEY] && parameters[SBU_MIME_PARAM_KEY] === SBU_MIME_PARAM_VOICE_MESSAGE_VALUE;\n}\n\nexport function getVoiceMessageFileObject(uri: string, extension = 'm4a') {\n return {\n uri,\n type: getVoiceMessageMimeType(extension),\n name: `Voice_message.${extension}`,\n size: 0,\n };\n}\n\nexport function getVoiceMessageMimeType(extension = 'm4a') {\n return `audio/${extension};${SBU_MIME_PARAM_KEY}=${SBU_MIME_PARAM_VOICE_MESSAGE_VALUE}`;\n}\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,wBAAwB;AAE3D,SAASC,gBAAgB,EAAEC,WAAW,EAAEC,aAAa,QAAQ,gBAAgB;AAY7E,SAASC,oBAAoB,QAAQ,qBAAqB;AAE1D,OAAO,SAASC,YAAYA,CAACC,GAAoB,EAAEC,aAAsB,EAAE;EACzE,MAAMC,SAAS,GAAGC,WAAW,CAACH,GAAG,EAAEC,aAAa,CAAC;EACjD,IAAIC,SAAS,EAAE,OAAO,KAAK;EAC3B,IAAIF,GAAG,CAACI,cAAc,CAAC,CAAC,EAAE,OAAO,KAAK;EACtC,OAAOJ,GAAG,CAACK,SAAS,KAAK,CAAC;AAC5B;AAEA,OAAO,SAASC,iBAAiBA,CAACN,GAA4B,EAAkC;EAC9F,OAAOA,GAAG,KAAKO,SAAS,IAAIP,GAAG,KAAK,IAAI,IAAI,eAAe,IAAIA,GAAG;AACpE;AAEA,OAAO,SAASG,WAAWA,CACzBH,GAA4B,EAC5BC,aAAa,GAAG,iCAAiC,EACjB;EAAA,IAAAO,WAAA;EAChC,IAAI,CAACF,iBAAiB,CAACN,GAAG,CAAC,EAAE,OAAO,KAAK;EACzC,OAAO,EAAAQ,WAAA,GAAAR,GAAG,CAACS,MAAM,cAAAD,WAAA,uBAAVA,WAAA,CAAYE,MAAM,MAAKT,aAAa;AAC7C;AAEA,OAAO,SAASU,mBAAmBA,CAACC,OAAwB,E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der","getFileExtension","getFileType","parseMimeType","getMessageTimeFormat","isNewMessage","msg","currentUserId","myMessage","isMyMessage","isAdminMessage","updatedAt","isSendableMessage","undefined","_msg$sender","sender","userId","messageKeyExtractor","message","getMessageUniqId","messageComparator","a","b","aStatusOffset","bStatusOffset","sendingStatus","Number","MAX_SAFE_INTEGER","createdAt","hasSameSender","_a$sender","_b$sender","calcMessageGrouping","groupEnabled","curr","prev","next","isReplyThreadType","hasParentMessageUI","getPrev","parentMessageId","threadInfo","Date","getNext","groupWithPrev","groupWithNext","isUserMessage","isFileMessage","String","messageId","reqId","getThumbnailUriFromFileMessage","thumbnails","length","url","getAvailableUriFromFileMessage","_message$messageParam","messageParams","file","uri","isSendbirdNotification","dataPayload","Boolean","parseSendbirdNotification","sendbird","JSON","parse","shouldRenderParentMessage","hide","_message$parentMessag","_message$parentMessag2","parentMessage","shouldRenderReaction","channel","reactionEnabled","isOpenChannel","isGroupChannel","isBroadcast","isEphemeral","isChatNotification","getReactionCount","reaction","count","fileIconMapper","getFileTypeFromMessage","type","name","convertFileTypeToMessageType","fileType","getFileIconFromMessageType","messageType","getFileIconFromMessage","getMessageType","ogMetaData","isVoiceMessage","getDefaultMessageSearchQueryParams","keyword","channelUrl","messageTimestampFrom","Math","max","joinedAt","invitedAt","order","TIMESTAMP","SBU_MIME_PARAM_KEY","SBU_MIME_PARAM_VOICE_MESSAGE_VALUE","parameters","getVoiceMessageFileObject","extension","getVoiceMessageMimeType","size"],"sources":["message.ts"],"sourcesContent":["import { MessageSearchOrder } from '@sendbird/chat/message';\n\nimport { getFileExtension, getFileType, parseMimeType } from '../shared/file';\nimport type {\n SendbirdBaseChannel,\n SendbirdBaseMessage,\n SendbirdDataPayload,\n SendbirdFileMessage,\n SendbirdGroupChannel,\n SendbirdMessage,\n SendbirdReaction,\n SendbirdSendableMessage,\n SendbirdUserMessage,\n} from '../types';\nimport { getMessageTimeFormat } from '../ui-format/common';\n\nexport function isNewMessage(msg: SendbirdMessage, currentUserId?: string) {\n const myMessage = isMyMessage(msg, currentUserId);\n if (myMessage) return false;\n if (msg.isAdminMessage()) return false;\n return msg.updatedAt === 0;\n}\n\nexport function isSendableMessage(msg?: SendbirdMessage | null): msg is SendbirdSendableMessage {\n return msg !== undefined && msg !== null && 'sendingStatus' in msg;\n}\n\nexport function isMyMessage(\n msg?: SendbirdMessage | null,\n currentUserId = '##__USER_ID_IS_NOT_PROVIDED__##',\n): msg is SendbirdSendableMessage {\n if (!isSendableMessage(msg)) return false;\n return msg.sender?.userId === currentUserId;\n}\n\nexport function messageKeyExtractor(message: SendbirdMessage): string {\n return getMessageUniqId(message);\n}\n\n// |-------------------|-------------------|-----------------|-------------------|\n// | sending status | reqId | messageId | createdAt |\n// |-------------------|-------------------|-----------------|-------------------|\n// | pending | timestamp(A) | 0 | timestamp(B) |\n// | canceled | timestamp(A) | 0 | ? |\n// | failed | timestamp(A) | 0 | ? |\n// | succeeded | timestamp(A) / '' | id from DB | timestamp(C) |\n// |-------------------|-------------------|-----------------|-------------------|\nexport function messageComparator(a: SendbirdMessage, b: SendbirdMessage) {\n let aStatusOffset = 0;\n let bStatusOffset = 0;\n\n if (isSendableMessage(a) && a.sendingStatus !== 'succeeded') aStatusOffset = Number.MAX_SAFE_INTEGER;\n if (isSendableMessage(b) && b.sendingStatus !== 'succeeded') bStatusOffset = Number.MAX_SAFE_INTEGER;\n\n return b.createdAt + bStatusOffset - (a.createdAt + aStatusOffset);\n}\n\nexport function hasSameSender(a?: SendbirdMessage, b?: SendbirdMessage) {\n if (!a || !b) return false;\n if ('sender' in a && 'sender' in b) return a.sender?.userId === b.sender?.userId;\n return false;\n}\n\nexport function calcMessageGrouping(\n groupEnabled: boolean,\n curr: SendbirdMessage,\n prev?: SendbirdMessage,\n next?: SendbirdMessage,\n isReplyThreadType?: boolean,\n hasParentMessageUI?: boolean,\n) {\n const getPrev = () => {\n if (!groupEnabled) return false;\n if (!prev) return false;\n if (curr.isAdminMessage()) return false;\n if (!hasSameSender(curr, prev)) return false;\n if (hasParentMessageUI && curr.parentMessageId) return false;\n if (isReplyThreadType && curr.threadInfo) return false;\n if (getMessageTimeFormat(new Date(curr.createdAt)) !== getMessageTimeFormat(new Date(prev.createdAt))) return false;\n return true;\n };\n\n const getNext = () => {\n if (!groupEnabled) return false;\n if (!next) return false;\n if (curr.isAdminMessage()) return false;\n if (!hasSameSender(curr, next)) return false;\n if (hasParentMessageUI && curr.parentMessageId) return false;\n if (isReplyThreadType && curr.threadInfo) return false;\n if (getMessageTimeFormat(new Date(curr.createdAt)) !== getMessageTimeFormat(new Date(next.createdAt))) return false;\n return true;\n };\n\n return { groupWithPrev: getPrev(), groupWithNext: getNext() };\n}\n\nexport function getMessageUniqId(msg: SendbirdBaseMessage) {\n if (msg.isUserMessage() || msg.isFileMessage()) {\n if (msg.sendingStatus === 'succeeded') return String(msg.messageId);\n return msg.reqId;\n }\n\n return String(msg.messageId);\n}\n\nexport function getThumbnailUriFromFileMessage(message: SendbirdFileMessage) {\n if (message.thumbnails && message.thumbnails.length > 0) {\n return message.thumbnails[0].url;\n }\n\n return getAvailableUriFromFileMessage(message);\n}\n\nexport function getAvailableUriFromFileMessage(message: SendbirdFileMessage) {\n if (!message.url && message.messageParams?.file && 'uri' in message.messageParams.file) {\n return message.messageParams.file.uri;\n }\n\n return message.url;\n}\n\ntype RawSendbirdDataPayload = { sendbird: string | SendbirdDataPayload };\nexport function isSendbirdNotification(dataPayload?: {\n [key: string]: string | object;\n}): dataPayload is RawSendbirdDataPayload {\n if (!dataPayload) return false;\n return Boolean(dataPayload['sendbird']);\n}\n\nexport function parseSendbirdNotification(dataPayload: RawSendbirdDataPayload): SendbirdDataPayload {\n return typeof dataPayload.sendbird === 'string'\n ? JSON.parse(dataPayload.sendbird)\n : (dataPayload.sendbird as SendbirdDataPayload);\n}\n\nexport function shouldRenderParentMessage(\n message: SendbirdMessage,\n hide = false,\n): message is (SendbirdUserMessage | SendbirdFileMessage) & {\n parentMessage: SendbirdUserMessage | SendbirdFileMessage;\n} {\n if (hide) return false;\n return !!(\n (message.isFileMessage() || message.isUserMessage()) &&\n (message.parentMessage?.isFileMessage() || message.parentMessage?.isUserMessage())\n );\n}\n\nexport function shouldRenderReaction(channel: SendbirdBaseChannel, reactionEnabled: boolean) {\n if (channel.isOpenChannel()) {\n return false;\n }\n\n if (channel.isGroupChannel()) {\n if (channel.isBroadcast) return false;\n if (channel.isEphemeral) return false;\n if (channel.isChatNotification) return false;\n }\n\n return reactionEnabled;\n}\n\nexport function getReactionCount(reaction: SendbirdReaction) {\n return reaction.count;\n}\n\nexport type MessageType =\n | 'user'\n | 'admin'\n | 'file'\n | 'unknown'\n | `user.${'opengraph'}`\n | `file.${'image' | 'video' | 'audio' | 'voice'}`;\n\nexport type FileType = 'file' | 'image' | 'audio' | 'video';\n\nconst fileIconMapper = {\n 'audio': 'file-audio',\n 'image': 'photo',\n 'video': 'play',\n 'file': 'file-document',\n} as const;\n\ntype ValueOf<T> = T[keyof T];\nexport type FileIcon = ValueOf<typeof fileIconMapper>;\n\nexport function getFileTypeFromMessage(message: SendbirdFileMessage): FileType {\n return getFileType(message.type || getFileExtension(message.name));\n}\nexport const convertFileTypeToMessageType = (fileType: FileType = 'file'): MessageType => {\n switch (fileType) {\n case 'audio':\n case 'image':\n case 'video':\n return `file.${fileType}`;\n case 'file':\n return fileType;\n }\n};\nexport const getFileIconFromMessageType = (messageType: MessageType): FileIcon => {\n switch (messageType) {\n case 'file':\n return fileIconMapper['file'];\n case 'file.image':\n return fileIconMapper['image'];\n case 'file.video':\n return fileIconMapper['video'];\n case 'file.audio':\n return fileIconMapper['audio'];\n default:\n return fileIconMapper['file'];\n }\n};\nexport const getFileIconFromMessage = (message: SendbirdFileMessage): FileIcon => {\n const fileType = getFileTypeFromMessage(message);\n const messageType = convertFileTypeToMessageType(fileType);\n return getFileIconFromMessageType(messageType);\n};\n\nexport function getMessageType(message: SendbirdMessage): MessageType {\n if (message.isAdminMessage()) {\n return 'admin';\n }\n\n if (message.isUserMessage()) {\n if (message.ogMetaData) {\n return 'user.opengraph';\n }\n return 'user';\n }\n\n if (message.isFileMessage()) {\n if (isVoiceMessage(message)) {\n return 'file.voice';\n }\n\n const fileType = getFileTypeFromMessage(message);\n switch (fileType) {\n case 'image':\n case 'video': {\n return `file.${fileType}`;\n }\n case 'audio': {\n return `file.${fileType}`;\n }\n default: {\n return 'file';\n }\n }\n }\n\n return 'unknown';\n}\n\nexport function getDefaultMessageSearchQueryParams(channel: SendbirdGroupChannel, keyword: string) {\n return {\n keyword,\n channelUrl: channel.url,\n messageTimestampFrom: Math.max(channel.joinedAt, channel.invitedAt),\n order: MessageSearchOrder.TIMESTAMP,\n };\n}\n\nconst SBU_MIME_PARAM_KEY = 'sbu_type';\nconst SBU_MIME_PARAM_VOICE_MESSAGE_VALUE = 'voice';\n\nexport function isVoiceMessage(message: SendbirdMessage): message is SendbirdFileMessage {\n if (!message.isFileMessage()) return false;\n\n const { parameters } = parseMimeType(message.type);\n return !!parameters[SBU_MIME_PARAM_KEY] && parameters[SBU_MIME_PARAM_KEY] === SBU_MIME_PARAM_VOICE_MESSAGE_VALUE;\n}\n\nexport function getVoiceMessageFileObject(uri: string, extension = 'm4a') {\n return {\n uri,\n type: getVoiceMessageMimeType(extension),\n name: `Voice_message.${extension}`,\n size: 0,\n };\n}\n\nexport function getVoiceMessageMimeType(extension = 'm4a') {\n return `audio/${extension};${SBU_MIME_PARAM_KEY}=${SBU_MIME_PARAM_VOICE_MESSAGE_VALUE}`;\n}\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,wBAAwB;AAE3D,SAASC,gBAAgB,EAAEC,WAAW,EAAEC,aAAa,QAAQ,gBAAgB;AAY7E,SAASC,oBAAoB,QAAQ,qBAAqB;AAE1D,OAAO,SAASC,YAAYA,CAACC,GAAoB,EAAEC,aAAsB,EAAE;EACzE,MAAMC,SAAS,GAAGC,WAAW,CAACH,GAAG,EAAEC,aAAa,CAAC;EACjD,IAAIC,SAAS,EAAE,OAA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E1C,MAAM;IAAE4D;EAAW,CAAC,GAAGxG,aAAa,CAACe,OAAO,CAACmE,IAAI,CAAC;EAClD,OAAO,CAAC,CAACsB,UAAU,CAACF,kBAAkB,CAAC,IAAIE,UAAU,CAACF,kBAAkB,CAAC,KAAKC,kCAAkC;AAClH;AAEA,OAAO,SAASE,yBAAyBA,CAACjD,GAAW,EAAEkD,SAAS,GAAG,KAAK,EAAE;EACxE,OAAO;IACLlD,GAAG;IACH0B,IAAI,EAAEyB,uBAAuB,CAACD,SAAS,CAAC;IACxCvB,IAAI,EAAE,iBAAiBuB,SAAS,EAAE;IAClCE,IAAI,EAAE;EACR,CAAC;AACH;AAEA,OAAO,SAASD,uBAAuBA,CAACD,SAAS,GAAG,KAAK,EAAE;EACzD,OAAO,SAASA,SAAS,IAAIJ,kBAAkB,IAAIC,kCAAkC,EAAE;AACzF","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { AppStateEvent, AppStateStatus } from 'react-native';
3
2
  import { EdgeInsets } from 'react-native-safe-area-context';
4
3
  type EdgePaddingMap = {
@@ -7,7 +6,7 @@ type EdgePaddingMap = {
7
6
  top: 'paddingTop';
8
7
  bottom: 'paddingBottom';
9
8
  };
10
- export declare const useSafeAreaPadding: <T extends keyof EdgeInsets, Result extends { [key in EdgePaddingMap[T]]: EdgeInsets[T]; }>(edges: T[], direction?: 'ltr' | 'rtl') => Result;
9
+ export declare const useSafeAreaPadding: <T extends keyof EdgeInsets, Result extends { [key in EdgePaddingMap[T]]: EdgeInsets[T]; }>(edges: T[], direction?: "ltr" | "rtl") => Result;
11
10
  type AppStateListener = (status: AppStateStatus) => void;
12
11
  export declare const useAppState: (type: AppStateEvent, listener: AppStateListener) => void;
13
12
  /**
@@ -14,7 +14,7 @@ export declare function getMessageUniqId(msg: SendbirdBaseMessage): string;
14
14
  export declare function getThumbnailUriFromFileMessage(message: SendbirdFileMessage): string;
15
15
  export declare function getAvailableUriFromFileMessage(message: SendbirdFileMessage): string;
16
16
  type RawSendbirdDataPayload = {
17
- sendbird: string | object;
17
+ sendbird: string | SendbirdDataPayload;
18
18
  };
19
19
  export declare function isSendbirdNotification(dataPayload?: {
20
20
  [key: string]: string | object;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendbird/uikit-utils",
3
- "version": "3.11.2",
3
+ "version": "3.11.4",
4
4
  "description": "A collection of utility functions and constants for building chat UI components with Sendbird UIKit.",
5
5
  "keywords": [
6
6
  "sendbird",
@@ -15,6 +15,15 @@
15
15
  "types": "lib/typescript/src/index.d.ts",
16
16
  "react-native": "src/index",
17
17
  "source": "src/index",
18
+ "exports": {
19
+ "./package.json": "./package.json",
20
+ ".": {
21
+ "types": "./lib/typescript/src/index.d.ts",
22
+ "react-native": "./src/index.ts",
23
+ "require": "./lib/commonjs/index.js",
24
+ "import": "./lib/module/index.js"
25
+ }
26
+ },
18
27
  "files": [
19
28
  "src",
20
29
  "lib",
@@ -50,13 +59,13 @@
50
59
  "@types/react": "*",
51
60
  "@types/react-native": "*",
52
61
  "date-fns": ">=2.28.0",
53
- "react": "18.2.0",
54
- "react-native": "0.74.3",
62
+ "react": "19.1.1",
63
+ "react-native": "0.82.1",
55
64
  "react-native-builder-bob": "^0.18.0",
56
- "typescript": "5.2.2"
65
+ "typescript": "5.8.3"
57
66
  },
58
67
  "peerDependencies": {
59
- "@sendbird/chat": "^4.19.2",
68
+ "@sendbird/chat": "^4.20.2",
60
69
  "date-fns": ">=2.28.0",
61
70
  "react": ">=17.0.2",
62
71
  "react-native": ">=0.65.0"
@@ -83,5 +92,5 @@
83
92
  ]
84
93
  ]
85
94
  },
86
- "gitHead": "2df681bc6eefb1296d78f33982f3beecd3769c66"
95
+ "gitHead": "2c3e4a178540abaedf0ba33e8680f572808d243f"
87
96
  }
@@ -119,7 +119,7 @@ export function getAvailableUriFromFileMessage(message: SendbirdFileMessage) {
119
119
  return message.url;
120
120
  }
121
121
 
122
- type RawSendbirdDataPayload = { sendbird: string | object };
122
+ type RawSendbirdDataPayload = { sendbird: string | SendbirdDataPayload };
123
123
  export function isSendbirdNotification(dataPayload?: {
124
124
  [key: string]: string | object;
125
125
  }): dataPayload is RawSendbirdDataPayload {
@@ -128,7 +128,9 @@ export function isSendbirdNotification(dataPayload?: {
128
128
  }
129
129
 
130
130
  export function parseSendbirdNotification(dataPayload: RawSendbirdDataPayload): SendbirdDataPayload {
131
- return typeof dataPayload.sendbird === 'string' ? JSON.parse(dataPayload.sendbird) : dataPayload.sendbird;
131
+ return typeof dataPayload.sendbird === 'string'
132
+ ? JSON.parse(dataPayload.sendbird)
133
+ : (dataPayload.sendbird as SendbirdDataPayload);
132
134
  }
133
135
 
134
136
  export function shouldRenderParentMessage(