@sendbird/uikit-chat-hooks 2.0.2 → 2.0.3
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/common/useMessageOutgoingStatus.js +0 -1
- package/lib/commonjs/common/useMessageOutgoingStatus.js.map +1 -1
- package/lib/module/common/useMessageOutgoingStatus.js +0 -1
- package/lib/module/common/useMessageOutgoingStatus.js.map +1 -1
- package/package.json +3 -3
- package/src/common/useMessageOutgoingStatus.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HOOK_NAME","useMessageOutgoingStatus","sdk","channel","message","features","useAppFeatures","forceUpdate","useForceUpdate","currentUser","uniqId","useUniqId","useChannelHandler","onUndeliveredMemberStatusUpdated","eventChannel","isDifferentChannel","isMyMessage","userId","onUnreadMemberStatusUpdated","
|
|
1
|
+
{"version":3,"names":["HOOK_NAME","useMessageOutgoingStatus","sdk","channel","message","features","useAppFeatures","forceUpdate","useForceUpdate","currentUser","uniqId","useUniqId","useChannelHandler","onUndeliveredMemberStatusUpdated","eventChannel","isDifferentChannel","isMyMessage","userId","onUnreadMemberStatusUpdated","sendingStatus","getUnreadMemberCount","deliveryReceiptEnabled","getUndeliveredMemberCount"],"sources":["useMessageOutgoingStatus.ts"],"sourcesContent":["import type { SendbirdChatSDK, SendbirdGroupChannel, SendbirdMessage } from '@sendbird/uikit-utils';\nimport { isDifferentChannel, isMyMessage, useForceUpdate, useUniqId } from '@sendbird/uikit-utils';\n\nimport { useChannelHandler } from '../handler/useChannelHandler';\nimport { useAppFeatures } from './useAppFeatures';\n\nconst HOOK_NAME = 'useMessageOutgoingStatus';\n\nexport type SBUOutgoingStatus = 'NONE' | 'PENDING' | 'FAILED' | 'UNDELIVERED' | 'DELIVERED' | 'UNREAD' | 'READ';\n\nexport const useMessageOutgoingStatus = (\n sdk: SendbirdChatSDK,\n channel: SendbirdGroupChannel,\n message?: SendbirdMessage | null,\n): SBUOutgoingStatus => {\n const features = useAppFeatures(sdk);\n const forceUpdate = useForceUpdate();\n const currentUser = sdk.currentUser;\n\n const uniqId = useUniqId(HOOK_NAME);\n useChannelHandler(sdk, `${HOOK_NAME}_${uniqId}`, {\n onUndeliveredMemberStatusUpdated(eventChannel) {\n if (isDifferentChannel(channel, eventChannel)) return;\n if (!isMyMessage(message, currentUser?.userId)) return;\n\n forceUpdate();\n },\n onUnreadMemberStatusUpdated(eventChannel) {\n if (isDifferentChannel(channel, eventChannel)) return;\n if (!isMyMessage(message, currentUser?.userId)) return;\n\n forceUpdate();\n },\n });\n\n if (!message) return 'NONE';\n\n if ('sendingStatus' in message) {\n if (message.sendingStatus === 'pending') return 'PENDING';\n if (message.sendingStatus === 'failed') return 'FAILED';\n }\n\n if (channel.getUnreadMemberCount(message) === 0) return 'READ';\n\n if (features.deliveryReceiptEnabled) {\n if (channel.getUndeliveredMemberCount(message) === 0) return 'DELIVERED';\n return 'UNDELIVERED';\n }\n\n return 'UNREAD';\n};\n"],"mappings":";;;;;;;AACA;;AAEA;;AACA;;AAEA,MAAMA,SAAS,GAAG,0BAAlB;;AAIO,MAAMC,wBAAwB,GAAG,CACtCC,GADsC,EAEtCC,OAFsC,EAGtCC,OAHsC,KAIhB;EACtB,MAAMC,QAAQ,GAAG,IAAAC,8BAAA,EAAeJ,GAAf,CAAjB;EACA,MAAMK,WAAW,GAAG,IAAAC,0BAAA,GAApB;EACA,MAAMC,WAAW,GAAGP,GAAG,CAACO,WAAxB;EAEA,MAAMC,MAAM,GAAG,IAAAC,qBAAA,EAAUX,SAAV,CAAf;EACA,IAAAY,oCAAA,EAAkBV,GAAlB,EAAwB,GAAEF,SAAU,IAAGU,MAAO,EAA9C,EAAiD;IAC/CG,gCAAgC,CAACC,YAAD,EAAe;MAC7C,IAAI,IAAAC,8BAAA,EAAmBZ,OAAnB,EAA4BW,YAA5B,CAAJ,EAA+C;MAC/C,IAAI,CAAC,IAAAE,uBAAA,EAAYZ,OAAZ,EAAqBK,WAArB,aAAqBA,WAArB,uBAAqBA,WAAW,CAAEQ,MAAlC,CAAL,EAAgD;MAEhDV,WAAW;IACZ,CAN8C;;IAO/CW,2BAA2B,CAACJ,YAAD,EAAe;MACxC,IAAI,IAAAC,8BAAA,EAAmBZ,OAAnB,EAA4BW,YAA5B,CAAJ,EAA+C;MAC/C,IAAI,CAAC,IAAAE,uBAAA,EAAYZ,OAAZ,EAAqBK,WAArB,aAAqBA,WAArB,uBAAqBA,WAAW,CAAEQ,MAAlC,CAAL,EAAgD;MAEhDV,WAAW;IACZ;;EAZ8C,CAAjD;EAeA,IAAI,CAACH,OAAL,EAAc,OAAO,MAAP;;EAEd,IAAI,mBAAmBA,OAAvB,EAAgC;IAC9B,IAAIA,OAAO,CAACe,aAAR,KAA0B,SAA9B,EAAyC,OAAO,SAAP;IACzC,IAAIf,OAAO,CAACe,aAAR,KAA0B,QAA9B,EAAwC,OAAO,QAAP;EACzC;;EAED,IAAIhB,OAAO,CAACiB,oBAAR,CAA6BhB,OAA7B,MAA0C,CAA9C,EAAiD,OAAO,MAAP;;EAEjD,IAAIC,QAAQ,CAACgB,sBAAb,EAAqC;IACnC,IAAIlB,OAAO,CAACmB,yBAAR,CAAkClB,OAAlC,MAA+C,CAAnD,EAAsD,OAAO,WAAP;IACtD,OAAO,aAAP;EACD;;EAED,OAAO,QAAP;AACD,CAxCM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isDifferentChannel","isMyMessage","useForceUpdate","useUniqId","useChannelHandler","useAppFeatures","HOOK_NAME","useMessageOutgoingStatus","sdk","channel","message","features","forceUpdate","currentUser","uniqId","onUndeliveredMemberStatusUpdated","eventChannel","userId","onUnreadMemberStatusUpdated","
|
|
1
|
+
{"version":3,"names":["isDifferentChannel","isMyMessage","useForceUpdate","useUniqId","useChannelHandler","useAppFeatures","HOOK_NAME","useMessageOutgoingStatus","sdk","channel","message","features","forceUpdate","currentUser","uniqId","onUndeliveredMemberStatusUpdated","eventChannel","userId","onUnreadMemberStatusUpdated","sendingStatus","getUnreadMemberCount","deliveryReceiptEnabled","getUndeliveredMemberCount"],"sources":["useMessageOutgoingStatus.ts"],"sourcesContent":["import type { SendbirdChatSDK, SendbirdGroupChannel, SendbirdMessage } from '@sendbird/uikit-utils';\nimport { isDifferentChannel, isMyMessage, useForceUpdate, useUniqId } from '@sendbird/uikit-utils';\n\nimport { useChannelHandler } from '../handler/useChannelHandler';\nimport { useAppFeatures } from './useAppFeatures';\n\nconst HOOK_NAME = 'useMessageOutgoingStatus';\n\nexport type SBUOutgoingStatus = 'NONE' | 'PENDING' | 'FAILED' | 'UNDELIVERED' | 'DELIVERED' | 'UNREAD' | 'READ';\n\nexport const useMessageOutgoingStatus = (\n sdk: SendbirdChatSDK,\n channel: SendbirdGroupChannel,\n message?: SendbirdMessage | null,\n): SBUOutgoingStatus => {\n const features = useAppFeatures(sdk);\n const forceUpdate = useForceUpdate();\n const currentUser = sdk.currentUser;\n\n const uniqId = useUniqId(HOOK_NAME);\n useChannelHandler(sdk, `${HOOK_NAME}_${uniqId}`, {\n onUndeliveredMemberStatusUpdated(eventChannel) {\n if (isDifferentChannel(channel, eventChannel)) return;\n if (!isMyMessage(message, currentUser?.userId)) return;\n\n forceUpdate();\n },\n onUnreadMemberStatusUpdated(eventChannel) {\n if (isDifferentChannel(channel, eventChannel)) return;\n if (!isMyMessage(message, currentUser?.userId)) return;\n\n forceUpdate();\n },\n });\n\n if (!message) return 'NONE';\n\n if ('sendingStatus' in message) {\n if (message.sendingStatus === 'pending') return 'PENDING';\n if (message.sendingStatus === 'failed') return 'FAILED';\n }\n\n if (channel.getUnreadMemberCount(message) === 0) return 'READ';\n\n if (features.deliveryReceiptEnabled) {\n if (channel.getUndeliveredMemberCount(message) === 0) return 'DELIVERED';\n return 'UNDELIVERED';\n }\n\n return 'UNREAD';\n};\n"],"mappings":"AACA,SAASA,kBAAT,EAA6BC,WAA7B,EAA0CC,cAA1C,EAA0DC,SAA1D,QAA2E,uBAA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P;;EAEjD,IAAIC,QAAQ,CAACU,sBAAb,EAAqC;IACnC,IAAIZ,OAAO,CAACa,yBAAR,CAAkCZ,OAAlC,MAA+C,CAAnD,EAAsD,OAAO,WAAP;IACtD,OAAO,aAAP;EACD;;EAED,OAAO,QAAP;AACD,CAxCM"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendbird/uikit-chat-hooks",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "React hooks that built with SendbirdChat SDK",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@sendbird/uikit-utils": "2.0.
|
|
41
|
+
"@sendbird/uikit-utils": "2.0.3"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/react": "*",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"readmeFile": "./README.md",
|
|
70
70
|
"displayName": "@sendbird/uikit-chat-hooks"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "e3a34ae962741ffd2b647a466cf97e38f5006379"
|
|
73
73
|
}
|