@sendbird/uikit-react-native 2.1.0 → 2.3.0
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/README.md +42 -17
- package/lib/commonjs/components/ChatFlatList.js +2 -1
- package/lib/commonjs/components/ChatFlatList.js.map +1 -1
- package/lib/commonjs/components/FileViewer.js +2 -5
- package/lib/commonjs/components/FileViewer.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/FileMessage/BaseFileMessage.js +11 -6
- package/lib/commonjs/components/MessageRenderer/FileMessage/BaseFileMessage.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/FileMessage/ImageFileMessage.js +12 -2
- package/lib/commonjs/components/MessageRenderer/FileMessage/ImageFileMessage.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js +26 -11
- package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/FileMessage/index.js +1 -6
- package/lib/commonjs/components/MessageRenderer/FileMessage/index.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/UserMessage/BaseUserMessage.js +86 -10
- package/lib/commonjs/components/MessageRenderer/UserMessage/BaseUserMessage.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js +102 -15
- package/lib/commonjs/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/UserMessage/index.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/index.js +22 -3
- package/lib/commonjs/components/MessageRenderer/index.js.map +1 -1
- package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js +150 -0
- package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -0
- package/lib/commonjs/components/ReactionAddons/MessageReactionAddon.js +135 -0
- package/lib/commonjs/components/ReactionAddons/MessageReactionAddon.js.map +1 -0
- package/lib/commonjs/components/ReactionAddons/ReactionRoundedButton.js +87 -0
- package/lib/commonjs/components/ReactionAddons/ReactionRoundedButton.js.map +1 -0
- package/lib/commonjs/components/ReactionAddons/index.js +19 -0
- package/lib/commonjs/components/ReactionAddons/index.js.map +1 -0
- package/lib/commonjs/components/ReactionBottomSheets/ReactionListBottomSheet.js +150 -0
- package/lib/commonjs/components/ReactionBottomSheets/ReactionListBottomSheet.js.map +1 -0
- package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +276 -0
- package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -0
- package/lib/commonjs/components/ReactionBottomSheets/index.js +19 -0
- package/lib/commonjs/components/ReactionBottomSheets/index.js.map +1 -0
- package/lib/commonjs/constants.js +3 -1
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js +4 -1
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/commonjs/containers/SendbirdUIKitContainer.js +130 -79
- package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/commonjs/contexts/PlatformServiceCtx.js.map +1 -1
- package/lib/commonjs/contexts/ReactionCtx.js +107 -0
- package/lib/commonjs/contexts/ReactionCtx.js.map +1 -0
- package/lib/commonjs/contexts/SendbirdChatCtx.js +26 -18
- package/lib/commonjs/contexts/SendbirdChatCtx.js.map +1 -1
- package/lib/commonjs/contexts/UserProfileCtx.js +9 -0
- package/lib/commonjs/contexts/UserProfileCtx.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/EditInput.js +33 -37
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/EditInput.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js +95 -23
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/index.js +121 -31
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/index.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +34 -13
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelSuggestedMentionList.js +210 -0
- package/lib/commonjs/domain/groupChannel/component/GroupChannelSuggestedMentionList.js.map +1 -0
- package/lib/commonjs/domain/groupChannel/index.js +8 -0
- package/lib/commonjs/domain/groupChannel/index.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/module/createGroupChannelModule.js +4 -0
- package/lib/commonjs/domain/groupChannel/module/createGroupChannelModule.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/module/moduleContext.js +4 -4
- package/lib/commonjs/domain/groupChannel/module/moduleContext.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
- package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js +3 -2
- package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js.map +1 -1
- package/lib/commonjs/domain/groupChannelList/component/GroupChannelListList.js +2 -1
- package/lib/commonjs/domain/groupChannelList/component/GroupChannelListList.js.map +1 -1
- package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js +2 -1
- package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js.map +1 -1
- package/lib/commonjs/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.js +39 -0
- package/lib/commonjs/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.js.map +1 -0
- package/lib/commonjs/domain/groupChannelNotifications/component/GroupChannelNotificationsView.js +140 -0
- package/lib/commonjs/domain/groupChannelNotifications/component/GroupChannelNotificationsView.js.map +1 -0
- package/lib/commonjs/domain/groupChannelNotifications/index.js +46 -0
- package/lib/commonjs/domain/groupChannelNotifications/index.js.map +1 -0
- package/lib/commonjs/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.js +33 -0
- package/lib/commonjs/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.js.map +1 -0
- package/lib/commonjs/domain/groupChannelNotifications/module/moduleContext.js +45 -0
- package/lib/commonjs/domain/groupChannelNotifications/module/moduleContext.js.map +1 -0
- package/lib/commonjs/domain/groupChannelNotifications/types.js +6 -0
- package/lib/commonjs/domain/groupChannelNotifications/types.js.map +1 -0
- package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsList.js +2 -1
- package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsList.js.map +1 -1
- package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js +49 -6
- package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js.map +1 -1
- package/lib/commonjs/domain/groupChannelSettings/module/moduleContext.js +11 -16
- package/lib/commonjs/domain/groupChannelSettings/module/moduleContext.js.map +1 -1
- package/lib/commonjs/domain/groupChannelSettings/types.js.map +1 -1
- package/lib/commonjs/domain/groupChannelUserList/types.js.map +1 -1
- package/lib/commonjs/domain/userList/component/UserListList.js +4 -1
- package/lib/commonjs/domain/userList/component/UserListList.js.map +1 -1
- package/lib/commonjs/domain/userList/module/createUserListModule.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelCreateFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelFragment.js +11 -4
- package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelInviteFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelListFragment.js +4 -14
- package/lib/commonjs/fragments/createGroupChannelListFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelNotificationsFragment.js +34 -0
- package/lib/commonjs/fragments/createGroupChannelNotificationsFragment.js.map +1 -0
- package/lib/commonjs/fragments/createGroupChannelSettingsFragment.js +3 -1
- package/lib/commonjs/fragments/createGroupChannelSettingsFragment.js.map +1 -1
- package/lib/commonjs/hooks/useConnection.js +3 -0
- package/lib/commonjs/hooks/useConnection.js.map +1 -1
- package/lib/commonjs/hooks/useContext.js +11 -1
- package/lib/commonjs/hooks/useContext.js.map +1 -1
- package/lib/commonjs/hooks/useKeyboardStatus.js +97 -0
- package/lib/commonjs/hooks/useKeyboardStatus.js.map +1 -0
- package/lib/commonjs/hooks/useMentionSuggestion.js +110 -0
- package/lib/commonjs/hooks/useMentionSuggestion.js.map +1 -0
- package/lib/commonjs/hooks/useMentionTextInput.js +139 -0
- package/lib/commonjs/hooks/useMentionTextInput.js.map +1 -0
- package/lib/commonjs/index.js +95 -40
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/libs/EmojiManager.js +100 -0
- package/lib/commonjs/libs/EmojiManager.js.map +1 -0
- package/lib/commonjs/libs/ImageCompressionConfig.js +38 -0
- package/lib/commonjs/libs/ImageCompressionConfig.js.map +1 -0
- package/lib/commonjs/libs/MentionConfig.js +47 -0
- package/lib/commonjs/libs/MentionConfig.js.map +1 -0
- package/lib/commonjs/libs/MentionManager.js +235 -0
- package/lib/commonjs/libs/MentionManager.js.map +1 -0
- package/lib/commonjs/libs/SBUUtils.js +27 -0
- package/lib/commonjs/libs/SBUUtils.js.map +1 -1
- package/lib/commonjs/localization/StringSet.type.js +20 -5
- package/lib/commonjs/localization/StringSet.type.js.map +1 -1
- package/lib/commonjs/platform/createMediaService.expo.js +35 -1
- package/lib/commonjs/platform/createMediaService.expo.js.map +1 -1
- package/lib/commonjs/platform/createMediaService.native.js +41 -6
- package/lib/commonjs/platform/createMediaService.native.js.map +1 -1
- package/lib/commonjs/platform/dynamicModule.js +9 -57
- package/lib/commonjs/platform/dynamicModule.js.map +1 -1
- package/lib/commonjs/platform/types.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/components/ChatFlatList.js +3 -2
- package/lib/module/components/ChatFlatList.js.map +1 -1
- package/lib/module/components/FileViewer.js +2 -5
- package/lib/module/components/FileViewer.js.map +1 -1
- package/lib/module/components/MessageRenderer/FileMessage/BaseFileMessage.js +11 -6
- package/lib/module/components/MessageRenderer/FileMessage/BaseFileMessage.js.map +1 -1
- package/lib/module/components/MessageRenderer/FileMessage/ImageFileMessage.js +12 -2
- package/lib/module/components/MessageRenderer/FileMessage/ImageFileMessage.js.map +1 -1
- package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js +26 -11
- package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +1 -1
- package/lib/module/components/MessageRenderer/FileMessage/index.js +1 -5
- package/lib/module/components/MessageRenderer/FileMessage/index.js.map +1 -1
- package/lib/module/components/MessageRenderer/UserMessage/BaseUserMessage.js +86 -12
- package/lib/module/components/MessageRenderer/UserMessage/BaseUserMessage.js.map +1 -1
- package/lib/module/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js +103 -19
- package/lib/module/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js.map +1 -1
- package/lib/module/components/MessageRenderer/UserMessage/index.js.map +1 -1
- package/lib/module/components/MessageRenderer/index.js +21 -4
- package/lib/module/components/MessageRenderer/index.js.map +1 -1
- package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js +132 -0
- package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -0
- package/lib/module/components/ReactionAddons/MessageReactionAddon.js +118 -0
- package/lib/module/components/ReactionAddons/MessageReactionAddon.js.map +1 -0
- package/lib/module/components/ReactionAddons/ReactionRoundedButton.js +74 -0
- package/lib/module/components/ReactionAddons/ReactionRoundedButton.js.map +1 -0
- package/lib/module/components/ReactionAddons/index.js +7 -0
- package/lib/module/components/ReactionAddons/index.js.map +1 -0
- package/lib/module/components/ReactionBottomSheets/ReactionListBottomSheet.js +135 -0
- package/lib/module/components/ReactionBottomSheets/ReactionListBottomSheet.js.map +1 -0
- package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +259 -0
- package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -0
- package/lib/module/components/ReactionBottomSheets/index.js +7 -0
- package/lib/module/components/ReactionBottomSheets/index.js.map +1 -0
- package/lib/module/constants.js +1 -0
- package/lib/module/constants.js.map +1 -1
- package/lib/module/containers/GroupChannelPreviewContainer.js +4 -1
- package/lib/module/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/module/containers/SendbirdUIKitContainer.js +127 -81
- package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/module/contexts/PlatformServiceCtx.js.map +1 -1
- package/lib/module/contexts/ReactionCtx.js +85 -0
- package/lib/module/contexts/ReactionCtx.js.map +1 -0
- package/lib/module/contexts/SendbirdChatCtx.js +28 -18
- package/lib/module/contexts/SendbirdChatCtx.js.map +1 -1
- package/lib/module/contexts/UserProfileCtx.js +7 -0
- package/lib/module/contexts/UserProfileCtx.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelInput/EditInput.js +34 -39
- package/lib/module/domain/groupChannel/component/GroupChannelInput/EditInput.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js +92 -26
- package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelInput/index.js +118 -33
- package/lib/module/domain/groupChannel/component/GroupChannelInput/index.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +35 -16
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelSuggestedMentionList.js +188 -0
- package/lib/module/domain/groupChannel/component/GroupChannelSuggestedMentionList.js.map +1 -0
- package/lib/module/domain/groupChannel/index.js +1 -0
- package/lib/module/domain/groupChannel/index.js.map +1 -1
- package/lib/module/domain/groupChannel/module/createGroupChannelModule.js +3 -0
- package/lib/module/domain/groupChannel/module/createGroupChannelModule.js.map +1 -1
- package/lib/module/domain/groupChannel/module/moduleContext.js +4 -4
- package/lib/module/domain/groupChannel/module/moduleContext.js.map +1 -1
- package/lib/module/domain/groupChannel/types.js.map +1 -1
- package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js +4 -3
- package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js.map +1 -1
- package/lib/module/domain/groupChannelList/component/GroupChannelListList.js +3 -2
- package/lib/module/domain/groupChannelList/component/GroupChannelListList.js.map +1 -1
- package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js +3 -2
- package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js.map +1 -1
- package/lib/module/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.js +25 -0
- package/lib/module/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.js.map +1 -0
- package/lib/module/domain/groupChannelNotifications/component/GroupChannelNotificationsView.js +122 -0
- package/lib/module/domain/groupChannelNotifications/component/GroupChannelNotificationsView.js.map +1 -0
- package/lib/module/domain/groupChannelNotifications/index.js +5 -0
- package/lib/module/domain/groupChannelNotifications/index.js.map +1 -0
- package/lib/module/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.js +21 -0
- package/lib/module/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.js.map +1 -0
- package/lib/module/domain/groupChannelNotifications/module/moduleContext.js +25 -0
- package/lib/module/domain/groupChannelNotifications/module/moduleContext.js.map +1 -0
- package/lib/module/domain/groupChannelNotifications/types.js +2 -0
- package/lib/module/domain/groupChannelNotifications/types.js.map +1 -0
- package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsList.js +3 -2
- package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsList.js.map +1 -1
- package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js +46 -6
- package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js.map +1 -1
- package/lib/module/domain/groupChannelSettings/module/moduleContext.js +12 -17
- package/lib/module/domain/groupChannelSettings/module/moduleContext.js.map +1 -1
- package/lib/module/domain/groupChannelSettings/types.js.map +1 -1
- package/lib/module/domain/groupChannelUserList/types.js.map +1 -1
- package/lib/module/domain/userList/component/UserListList.js +3 -1
- package/lib/module/domain/userList/component/UserListList.js.map +1 -1
- package/lib/module/domain/userList/module/createUserListModule.js.map +1 -1
- package/lib/module/fragments/createGroupChannelCreateFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelFragment.js +11 -4
- package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelInviteFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelListFragment.js +5 -9
- package/lib/module/fragments/createGroupChannelListFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelNotificationsFragment.js +22 -0
- package/lib/module/fragments/createGroupChannelNotificationsFragment.js.map +1 -0
- package/lib/module/fragments/createGroupChannelSettingsFragment.js +3 -1
- package/lib/module/fragments/createGroupChannelSettingsFragment.js.map +1 -1
- package/lib/module/hooks/useConnection.js +3 -0
- package/lib/module/hooks/useConnection.js.map +1 -1
- package/lib/module/hooks/useContext.js +6 -0
- package/lib/module/hooks/useContext.js.map +1 -1
- package/lib/module/hooks/useKeyboardStatus.js +78 -0
- package/lib/module/hooks/useKeyboardStatus.js.map +1 -0
- package/lib/module/hooks/useMentionSuggestion.js +100 -0
- package/lib/module/hooks/useMentionSuggestion.js.map +1 -0
- package/lib/module/hooks/useMentionTextInput.js +128 -0
- package/lib/module/hooks/useMentionTextInput.js.map +1 -0
- package/lib/module/index.js +8 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/libs/EmojiManager.js +90 -0
- package/lib/module/libs/EmojiManager.js.map +1 -0
- package/lib/module/libs/ImageCompressionConfig.js +30 -0
- package/lib/module/libs/ImageCompressionConfig.js.map +1 -0
- package/lib/module/libs/MentionConfig.js +39 -0
- package/lib/module/libs/MentionConfig.js.map +1 -0
- package/lib/module/libs/MentionManager.js +223 -0
- package/lib/module/libs/MentionManager.js.map +1 -0
- package/lib/module/libs/SBUUtils.js +26 -1
- package/lib/module/libs/SBUUtils.js.map +1 -1
- package/lib/module/localization/StringSet.type.js +21 -6
- package/lib/module/localization/StringSet.type.js.map +1 -1
- package/lib/module/platform/createMediaService.expo.js +33 -1
- package/lib/module/platform/createMediaService.expo.js.map +1 -1
- package/lib/module/platform/createMediaService.native.js +38 -5
- package/lib/module/platform/createMediaService.native.js.map +1 -1
- package/lib/module/platform/dynamicModule.js +10 -56
- package/lib/module/platform/dynamicModule.js.map +1 -1
- package/lib/module/platform/types.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/__template__/types.d.ts +3 -3
- package/lib/typescript/src/components/ChannelCover.d.ts +1 -1
- package/lib/typescript/src/components/ChatFlatList.d.ts +1 -1
- package/lib/typescript/src/components/FileViewer.d.ts +1 -1
- package/lib/typescript/src/components/MessageRenderer/AdminMessage/index.d.ts +1 -1
- package/lib/typescript/src/components/MessageRenderer/FileMessage/BaseFileMessage.d.ts +2 -2
- package/lib/typescript/src/components/MessageRenderer/FileMessage/ImageFileMessage.d.ts +1 -1
- package/lib/typescript/src/components/MessageRenderer/FileMessage/VideoFileMessage.d.ts +1 -1
- package/lib/typescript/src/components/MessageRenderer/FileMessage/index.d.ts +11 -2
- package/lib/typescript/src/components/MessageRenderer/MessageDateSeparator.d.ts +1 -1
- package/lib/typescript/src/components/MessageRenderer/MessageIncomingAvatar.d.ts +1 -1
- package/lib/typescript/src/components/MessageRenderer/MessageIncomingSenderName.d.ts +1 -1
- package/lib/typescript/src/components/MessageRenderer/MessageOutgoingStatus.d.ts +1 -1
- package/lib/typescript/src/components/MessageRenderer/MessageTime.d.ts +1 -1
- package/lib/typescript/src/components/MessageRenderer/UnknownMessage/index.d.ts +1 -1
- package/lib/typescript/src/components/MessageRenderer/UserMessage/BaseUserMessage.d.ts +1 -1
- package/lib/typescript/src/components/MessageRenderer/UserMessage/OpenGraphUserMessage.d.ts +2 -2
- package/lib/typescript/src/components/MessageRenderer/UserMessage/index.d.ts +4 -1
- package/lib/typescript/src/components/MessageRenderer/index.d.ts +4 -3
- package/lib/typescript/src/components/NewMessagesButton.d.ts +1 -1
- package/lib/typescript/src/components/ReactionAddons/BottomSheetReactionAddon.d.ts +8 -0
- package/lib/typescript/src/components/ReactionAddons/MessageReactionAddon.d.ts +6 -0
- package/lib/typescript/src/components/ReactionAddons/ReactionRoundedButton.d.ts +14 -0
- package/lib/typescript/src/components/ReactionAddons/index.d.ts +11 -0
- package/lib/typescript/src/components/ReactionBottomSheets/ReactionListBottomSheet.d.ts +3 -0
- package/lib/typescript/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.d.ts +3 -0
- package/lib/typescript/src/components/ReactionBottomSheets/index.d.ts +20 -0
- package/lib/typescript/src/components/ScrollToBottomButton.d.ts +1 -1
- package/lib/typescript/src/components/StatusComposition.d.ts +1 -1
- package/lib/typescript/src/components/TypedPlaceholder.d.ts +1 -1
- package/lib/typescript/src/components/UserActionBar.d.ts +1 -1
- package/lib/typescript/src/components/UserSelectableBar.d.ts +1 -1
- package/lib/typescript/src/constants.d.ts +1 -0
- package/lib/typescript/src/containers/GroupChannelPreviewContainer.d.ts +1 -1
- package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +20 -8
- package/lib/typescript/src/contexts/LocalizationCtx.d.ts +2 -2
- package/lib/typescript/src/contexts/PlatformServiceCtx.d.ts +9 -3
- package/lib/typescript/src/contexts/ReactionCtx.d.ts +18 -0
- package/lib/typescript/src/contexts/SendbirdChatCtx.d.ts +16 -3
- package/lib/typescript/src/contexts/UserProfileCtx.d.ts +4 -4
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput/EditInput.d.ts +35 -7
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput/SendInput.d.ts +32 -5
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput/index.d.ts +19 -2
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelSuggestedMentionList.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannel/index.d.ts +1 -0
- package/lib/typescript/src/domain/groupChannel/module/createGroupChannelModule.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannel/types.d.ts +24 -7
- package/lib/typescript/src/domain/groupChannelBannedUsers/types.d.ts +3 -3
- package/lib/typescript/src/domain/groupChannelList/types.d.ts +2 -2
- package/lib/typescript/src/domain/groupChannelModeration/types.d.ts +3 -3
- package/lib/typescript/src/domain/groupChannelMutedMembers/types.d.ts +3 -3
- package/lib/typescript/src/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelNotifications/component/GroupChannelNotificationsView.d.ts +2 -0
- package/lib/typescript/src/domain/groupChannelNotifications/index.d.ts +4 -0
- package/lib/typescript/src/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelNotifications/module/moduleContext.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelNotifications/types.d.ts +33 -0
- package/lib/typescript/src/domain/groupChannelOperators/types.d.ts +3 -3
- package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannelSettings/types.d.ts +3 -1
- package/lib/typescript/src/domain/groupChannelUserList/types.d.ts +6 -6
- package/lib/typescript/src/domain/userList/component/UserListList.d.ts +2 -1
- package/lib/typescript/src/domain/userList/module/createUserListModule.d.ts +2 -1
- package/lib/typescript/src/fragments/createGroupChannelCreateFragment.d.ts +1 -1
- package/lib/typescript/src/fragments/createGroupChannelInviteFragment.d.ts +1 -1
- package/lib/typescript/src/fragments/createGroupChannelNotificationsFragment.d.ts +3 -0
- package/lib/typescript/src/hooks/useConnection.d.ts +1 -1
- package/lib/typescript/src/hooks/useContext.d.ts +3 -26
- package/lib/typescript/src/hooks/useKeyboardStatus.d.ts +6 -0
- package/lib/typescript/src/hooks/useMentionSuggestion.d.ts +17 -0
- package/lib/typescript/src/hooks/useMentionTextInput.d.ts +18 -0
- package/lib/typescript/src/index.d.ts +8 -3
- package/lib/typescript/src/libs/EmojiManager.d.ts +16 -0
- package/lib/typescript/src/libs/ImageCompressionConfig.d.ts +16 -0
- package/lib/typescript/src/libs/MentionConfig.d.ts +24 -0
- package/lib/typescript/src/libs/MentionManager.d.ts +61 -0
- package/lib/typescript/src/libs/SBUUtils.d.ts +6 -0
- package/lib/typescript/src/localization/StringSet.type.d.ts +19 -2
- package/lib/typescript/src/platform/createMediaService.expo.d.ts +6 -2
- package/lib/typescript/src/platform/createMediaService.native.d.ts +8 -6
- package/lib/typescript/src/platform/dynamicModule.d.ts +8 -13
- package/lib/typescript/src/platform/types.d.ts +33 -8
- package/lib/typescript/src/types.d.ts +13 -4
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +16 -6
- package/src/components/ChatFlatList.tsx +2 -1
- package/src/components/FileViewer.tsx +2 -5
- package/src/components/MessageRenderer/FileMessage/BaseFileMessage.tsx +17 -12
- package/src/components/MessageRenderer/FileMessage/ImageFileMessage.tsx +30 -18
- package/src/components/MessageRenderer/FileMessage/VideoFileMessage.tsx +21 -11
- package/src/components/MessageRenderer/FileMessage/index.tsx +1 -4
- package/src/components/MessageRenderer/UserMessage/BaseUserMessage.tsx +82 -14
- package/src/components/MessageRenderer/UserMessage/OpenGraphUserMessage.tsx +136 -62
- package/src/components/MessageRenderer/UserMessage/index.tsx +8 -1
- package/src/components/MessageRenderer/index.tsx +39 -7
- package/src/components/ReactionAddons/BottomSheetReactionAddon.tsx +106 -0
- package/src/components/ReactionAddons/MessageReactionAddon.tsx +123 -0
- package/src/components/ReactionAddons/ReactionRoundedButton.tsx +71 -0
- package/src/components/ReactionAddons/index.tsx +7 -0
- package/src/components/ReactionBottomSheets/ReactionListBottomSheet.tsx +113 -0
- package/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.tsx +249 -0
- package/src/components/ReactionBottomSheets/index.tsx +24 -0
- package/src/constants.ts +2 -0
- package/src/containers/GroupChannelPreviewContainer.tsx +3 -1
- package/src/containers/SendbirdUIKitContainer.tsx +165 -88
- package/src/contexts/PlatformServiceCtx.tsx +9 -2
- package/src/contexts/ReactionCtx.tsx +102 -0
- package/src/contexts/SendbirdChatCtx.tsx +46 -21
- package/src/contexts/UserProfileCtx.tsx +9 -0
- package/src/domain/groupChannel/component/GroupChannelInput/EditInput.tsx +56 -30
- package/src/domain/groupChannel/component/GroupChannelInput/SendInput.tsx +129 -32
- package/src/domain/groupChannel/component/GroupChannelInput/index.tsx +138 -43
- package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +30 -12
- package/src/domain/groupChannel/component/GroupChannelSuggestedMentionList.tsx +173 -0
- package/src/domain/groupChannel/index.ts +1 -0
- package/src/domain/groupChannel/module/createGroupChannelModule.tsx +12 -1
- package/src/domain/groupChannel/module/moduleContext.tsx +4 -4
- package/src/domain/groupChannel/types.ts +28 -5
- package/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.tsx +3 -2
- package/src/domain/groupChannelList/component/GroupChannelListList.tsx +2 -1
- package/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.tsx +2 -1
- package/src/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.tsx +14 -0
- package/src/domain/groupChannelNotifications/component/GroupChannelNotificationsView.tsx +128 -0
- package/src/domain/groupChannelNotifications/index.ts +4 -0
- package/src/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.tsx +15 -0
- package/src/domain/groupChannelNotifications/module/moduleContext.tsx +31 -0
- package/src/domain/groupChannelNotifications/types.ts +38 -0
- package/src/domain/groupChannelOperators/component/GroupChannelOperatorsList.tsx +2 -1
- package/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.tsx +42 -3
- package/src/domain/groupChannelSettings/module/moduleContext.tsx +17 -14
- package/src/domain/groupChannelSettings/types.ts +2 -0
- package/src/domain/groupChannelUserList/types.ts +7 -2
- package/src/domain/userList/component/UserListList.tsx +5 -1
- package/src/domain/userList/module/createUserListModule.tsx +3 -1
- package/src/fragments/createGroupChannelCreateFragment.tsx +8 -2
- package/src/fragments/createGroupChannelFragment.tsx +19 -6
- package/src/fragments/createGroupChannelInviteFragment.tsx +2 -2
- package/src/fragments/createGroupChannelListFragment.tsx +5 -9
- package/src/fragments/createGroupChannelNotificationsFragment.tsx +27 -0
- package/src/fragments/createGroupChannelSettingsFragment.tsx +2 -0
- package/src/hooks/useConnection.ts +3 -1
- package/src/hooks/useContext.ts +7 -0
- package/src/hooks/useKeyboardStatus.ts +59 -0
- package/src/hooks/useMentionSuggestion.ts +106 -0
- package/src/hooks/useMentionTextInput.ts +139 -0
- package/src/index.ts +14 -2
- package/src/libs/EmojiManager.ts +80 -0
- package/src/libs/ImageCompressionConfig.ts +31 -0
- package/src/libs/MentionConfig.ts +40 -0
- package/src/libs/MentionManager.tsx +240 -0
- package/src/libs/SBUUtils.ts +28 -1
- package/src/localization/StringSet.type.ts +45 -8
- package/src/platform/createMediaService.expo.tsx +24 -1
- package/src/platform/createMediaService.native.tsx +31 -9
- package/src/platform/dynamicModule.ts +17 -59
- package/src/platform/types.ts +29 -7
- package/src/types.ts +12 -0
- package/src/version.ts +1 -1
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
3
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
4
4
|
import Sendbird from '@sendbird/chat';
|
|
5
5
|
import { GroupChannelModule } from '@sendbird/chat/groupChannel';
|
|
6
6
|
import { OpenChannelModule } from '@sendbird/chat/openChannel';
|
|
7
7
|
import { DialogProvider, Header, HeaderStyleProvider, LightUIKitTheme, ToastProvider, UIKitThemeProvider } from '@sendbird/uikit-react-native-foundation';
|
|
8
|
-
import {
|
|
8
|
+
import { useIsFirstMount } from '@sendbird/uikit-utils';
|
|
9
|
+
import { LocalizationContext, LocalizationProvider } from '../contexts/LocalizationCtx';
|
|
9
10
|
import { PlatformServiceProvider } from '../contexts/PlatformServiceCtx';
|
|
11
|
+
import { ReactionProvider } from '../contexts/ReactionCtx';
|
|
10
12
|
import { SendbirdChatProvider } from '../contexts/SendbirdChatCtx';
|
|
11
13
|
import { UserProfileProvider } from '../contexts/UserProfileCtx';
|
|
12
|
-
import
|
|
14
|
+
import EmojiManager from '../libs/EmojiManager';
|
|
15
|
+
import ImageCompressionConfig from '../libs/ImageCompressionConfig';
|
|
13
16
|
import InternalLocalCacheStorage from '../libs/InternalLocalCacheStorage';
|
|
17
|
+
import MentionConfig from '../libs/MentionConfig';
|
|
18
|
+
import MentionManager from '../libs/MentionManager';
|
|
14
19
|
import StringSetEn from '../localization/StringSet.en';
|
|
15
20
|
import SBUDynamicModule from '../platform/dynamicModule';
|
|
16
21
|
import VERSION from '../version';
|
|
@@ -18,7 +23,15 @@ import InternalErrorBoundaryContainer from './InternalErrorBoundaryContainer';
|
|
|
18
23
|
const NetInfo = SBUDynamicModule.get('@react-native-community/netinfo', 'warn');
|
|
19
24
|
export const SendbirdUIKit = Object.freeze({
|
|
20
25
|
VERSION,
|
|
21
|
-
PLATFORM: Platform.OS.toLowerCase()
|
|
26
|
+
PLATFORM: Platform.OS.toLowerCase(),
|
|
27
|
+
DEFAULT: {
|
|
28
|
+
AUTO_PUSH_TOKEN_REGISTRATION: true,
|
|
29
|
+
CHANNEL_LIST_TYPING_INDICATOR: false,
|
|
30
|
+
CHANNEL_LIST_MESSAGE_RECEIPT_STATUS: false,
|
|
31
|
+
USE_USER_ID_FOR_NICKNAME: false,
|
|
32
|
+
USER_MENTION: false,
|
|
33
|
+
IMAGE_COMPRESSION: true
|
|
34
|
+
}
|
|
22
35
|
});
|
|
23
36
|
|
|
24
37
|
const SendbirdUIKitContainer = _ref => {
|
|
@@ -29,73 +42,67 @@ const SendbirdUIKitContainer = _ref => {
|
|
|
29
42
|
platformServices,
|
|
30
43
|
localization,
|
|
31
44
|
styles,
|
|
45
|
+
errorBoundary,
|
|
32
46
|
toast,
|
|
33
47
|
userProfile,
|
|
34
|
-
|
|
48
|
+
userMention,
|
|
49
|
+
imageCompression
|
|
35
50
|
} = _ref;
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
const defaultStringSet = (localization === null || localization === void 0 ? void 0 : localization.stringSet) ?? StringSetEn;
|
|
52
|
+
const isFirstMount = useIsFirstMount();
|
|
53
|
+
const unsubscribes = useRef([]);
|
|
54
|
+
const internalStorage = useMemo(() => chatOptions !== null && chatOptions !== void 0 && chatOptions.localCacheStorage ? new InternalLocalCacheStorage(chatOptions.localCacheStorage) : undefined, [chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.localCacheStorage]);
|
|
55
|
+
const [sdkInstance, setSdkInstance] = useState(() => {
|
|
56
|
+
const sendbird = initializeSendbird(appId, internalStorage, chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.onInitialized);
|
|
57
|
+
unsubscribes.current = sendbird.unsubscribes;
|
|
58
|
+
return sendbird.chatSDK;
|
|
59
|
+
});
|
|
60
|
+
const emojiManager = useMemo(() => new EmojiManager(internalStorage), [internalStorage]);
|
|
61
|
+
const mentionManager = useMemo(() => {
|
|
62
|
+
const config = new MentionConfig({
|
|
63
|
+
mentionLimit: (userMention === null || userMention === void 0 ? void 0 : userMention.mentionLimit) || MentionConfig.DEFAULT.MENTION_LIMIT,
|
|
64
|
+
suggestionLimit: (userMention === null || userMention === void 0 ? void 0 : userMention.suggestionLimit) || MentionConfig.DEFAULT.SUGGESTION_LIMIT,
|
|
65
|
+
debounceMills: (userMention === null || userMention === void 0 ? void 0 : userMention.debounceMills) ?? MentionConfig.DEFAULT.DEBOUNCE_MILLS,
|
|
66
|
+
delimiter: MentionConfig.DEFAULT.DELIMITER,
|
|
67
|
+
trigger: MentionConfig.DEFAULT.TRIGGER
|
|
46
68
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (NetInfo !== null && NetInfo !== void 0 && NetInfo.addEventListener) {
|
|
61
|
-
var _sdk$setOnlineListene, _sdk, _sdk$setOfflineListen, _sdk2;
|
|
62
|
-
|
|
63
|
-
const listener = (callback, callbackType) => {
|
|
64
|
-
const unsubscribe = NetInfo.addEventListener(state => {
|
|
65
|
-
const online = Boolean(state.isConnected) || Boolean(state.isInternetReachable);
|
|
66
|
-
if (online && callbackType === 'online') callback();
|
|
67
|
-
if (!online && callbackType === 'offline') callback();
|
|
68
|
-
});
|
|
69
|
-
unsubscribes.push(unsubscribe);
|
|
70
|
-
return unsubscribe;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
(_sdk$setOnlineListene = (_sdk = sdk).setOnlineListener) === null || _sdk$setOnlineListene === void 0 ? void 0 : _sdk$setOnlineListene.call(_sdk, onOnline => listener(onOnline, 'online'));
|
|
74
|
-
(_sdk$setOfflineListen = (_sdk2 = sdk).setOfflineListener) === null || _sdk$setOfflineListen === void 0 ? void 0 : _sdk$setOfflineListen.call(_sdk2, onOffline => listener(onOffline, 'offline'));
|
|
69
|
+
return new MentionManager(config, (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableUserMention) ?? SendbirdUIKit.DEFAULT.USER_MENTION);
|
|
70
|
+
}, [userMention === null || userMention === void 0 ? void 0 : userMention.mentionLimit, userMention === null || userMention === void 0 ? void 0 : userMention.suggestionLimit, userMention === null || userMention === void 0 ? void 0 : userMention.debounceMills]);
|
|
71
|
+
const imageCompressionConfig = useMemo(() => new ImageCompressionConfig({
|
|
72
|
+
compressionRate: (imageCompression === null || imageCompression === void 0 ? void 0 : imageCompression.compressionRate) || ImageCompressionConfig.DEFAULT.COMPRESSION_RATE,
|
|
73
|
+
width: imageCompression === null || imageCompression === void 0 ? void 0 : imageCompression.width,
|
|
74
|
+
height: imageCompression === null || imageCompression === void 0 ? void 0 : imageCompression.height
|
|
75
|
+
}), [imageCompression === null || imageCompression === void 0 ? void 0 : imageCompression.compressionRate, imageCompression === null || imageCompression === void 0 ? void 0 : imageCompression.width, imageCompression === null || imageCompression === void 0 ? void 0 : imageCompression.height]);
|
|
76
|
+
useLayoutEffect(() => {
|
|
77
|
+
if (!isFirstMount) {
|
|
78
|
+
const sendbird = initializeSendbird(appId, internalStorage, chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.onInitialized);
|
|
79
|
+
setSdkInstance(sendbird.chatSDK);
|
|
80
|
+
unsubscribes.current = sendbird.unsubscribes;
|
|
75
81
|
}
|
|
76
82
|
|
|
77
|
-
return sdk;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const [sdkInstance, setSdkInstance] = useState(getSendbirdSDK);
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
setSdkInstance(getSendbirdSDK);
|
|
83
83
|
return () => {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
if (!isFirstMount) {
|
|
85
|
+
unsubscribes.current.forEach(u => {
|
|
86
|
+
try {
|
|
87
|
+
u();
|
|
88
|
+
} catch {}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
89
91
|
};
|
|
90
|
-
}, [appId,
|
|
92
|
+
}, [appId, internalStorage]);
|
|
91
93
|
return /*#__PURE__*/React.createElement(SafeAreaProvider, null, /*#__PURE__*/React.createElement(SendbirdChatProvider, {
|
|
92
94
|
sdkInstance: sdkInstance,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
emojiManager: emojiManager,
|
|
96
|
+
mentionManager: mentionManager,
|
|
97
|
+
imageCompressionConfig: imageCompressionConfig,
|
|
98
|
+
enableAutoPushTokenRegistration: (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableAutoPushTokenRegistration) ?? SendbirdUIKit.DEFAULT.AUTO_PUSH_TOKEN_REGISTRATION,
|
|
99
|
+
enableChannelListTypingIndicator: (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableChannelListTypingIndicator) ?? SendbirdUIKit.DEFAULT.CHANNEL_LIST_TYPING_INDICATOR,
|
|
100
|
+
enableChannelListMessageReceiptStatus: (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableChannelListMessageReceiptStatus) ?? SendbirdUIKit.DEFAULT.CHANNEL_LIST_MESSAGE_RECEIPT_STATUS,
|
|
101
|
+
enableUseUserIdForNickname: (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableUseUserIdForNickname) ?? SendbirdUIKit.DEFAULT.USE_USER_ID_FOR_NICKNAME,
|
|
102
|
+
enableUserMention: (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableUserMention) ?? SendbirdUIKit.DEFAULT.USER_MENTION,
|
|
103
|
+
enableImageCompression: (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableImageCompression) ?? SendbirdUIKit.DEFAULT.IMAGE_COMPRESSION
|
|
97
104
|
}, /*#__PURE__*/React.createElement(LocalizationProvider, {
|
|
98
|
-
stringSet:
|
|
105
|
+
stringSet: defaultStringSet
|
|
99
106
|
}, /*#__PURE__*/React.createElement(PlatformServiceProvider, {
|
|
100
107
|
fileService: platformServices.file,
|
|
101
108
|
notificationService: platformServices.notification,
|
|
@@ -107,33 +114,72 @@ const SendbirdUIKitContainer = _ref => {
|
|
|
107
114
|
HeaderComponent: (styles === null || styles === void 0 ? void 0 : styles.HeaderComponent) ?? Header,
|
|
108
115
|
defaultTitleAlign: (styles === null || styles === void 0 ? void 0 : styles.defaultHeaderTitleAlign) ?? 'left',
|
|
109
116
|
statusBarTranslucent: (styles === null || styles === void 0 ? void 0 : styles.statusBarTranslucent) ?? true
|
|
110
|
-
}, /*#__PURE__*/React.createElement(
|
|
117
|
+
}, /*#__PURE__*/React.createElement(ToastProvider, {
|
|
111
118
|
dismissTimeout: toast === null || toast === void 0 ? void 0 : toast.dismissTimeout
|
|
112
119
|
}, /*#__PURE__*/React.createElement(UserProfileProvider, {
|
|
113
120
|
onCreateChannel: userProfile === null || userProfile === void 0 ? void 0 : userProfile.onCreateChannel,
|
|
114
121
|
onBeforeCreateChannel: userProfile === null || userProfile === void 0 ? void 0 : userProfile.onBeforeCreateChannel
|
|
115
|
-
}, /*#__PURE__*/React.createElement(
|
|
122
|
+
}, /*#__PURE__*/React.createElement(ReactionProvider, null, /*#__PURE__*/React.createElement(LocalizationContext.Consumer, null, value => {
|
|
123
|
+
const STRINGS = (value === null || value === void 0 ? void 0 : value.STRINGS) || defaultStringSet;
|
|
124
|
+
return /*#__PURE__*/React.createElement(DialogProvider, {
|
|
125
|
+
defaultLabels: {
|
|
126
|
+
alert: {
|
|
127
|
+
ok: STRINGS.DIALOG.ALERT_DEFAULT_OK
|
|
128
|
+
},
|
|
129
|
+
prompt: {
|
|
130
|
+
ok: STRINGS.DIALOG.PROMPT_DEFAULT_OK,
|
|
131
|
+
cancel: STRINGS.DIALOG.PROMPT_DEFAULT_CANCEL,
|
|
132
|
+
placeholder: STRINGS.DIALOG.PROMPT_DEFAULT_PLACEHOLDER
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}, /*#__PURE__*/React.createElement(InternalErrorBoundaryContainer, errorBoundary, children));
|
|
136
|
+
}))))))))));
|
|
116
137
|
};
|
|
117
138
|
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
139
|
+
const initializeSendbird = (appId, internalStorage, onInitialized) => {
|
|
140
|
+
const unsubscribes = [];
|
|
141
|
+
let chatSDK;
|
|
142
|
+
chatSDK = Sendbird.init({
|
|
143
|
+
appId,
|
|
144
|
+
modules: [new GroupChannelModule(), new OpenChannelModule()],
|
|
145
|
+
localCacheEnabled: Boolean(internalStorage),
|
|
146
|
+
useAsyncStorageStore: internalStorage,
|
|
147
|
+
newInstance: true
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
if (onInitialized) {
|
|
151
|
+
chatSDK = onInitialized(chatSDK);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (SendbirdUIKit.VERSION) {
|
|
155
|
+
chatSDK.addExtension('sb_uikit', SendbirdUIKit.VERSION);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (SendbirdUIKit.PLATFORM) {
|
|
159
|
+
chatSDK.addExtension('device-os-platform', SendbirdUIKit.PLATFORM);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (NetInfo !== null && NetInfo !== void 0 && NetInfo.addEventListener) {
|
|
163
|
+
var _chatSDK$setOnlineLis, _chatSDK, _chatSDK$setOfflineLi, _chatSDK2;
|
|
164
|
+
|
|
165
|
+
const listener = (callback, callbackType) => {
|
|
166
|
+
const unsubscribe = NetInfo.addEventListener(state => {
|
|
167
|
+
const online = Boolean(state.isConnected) || Boolean(state.isInternetReachable);
|
|
168
|
+
if (online && callbackType === 'online') callback();
|
|
169
|
+
if (!online && callbackType === 'offline') callback();
|
|
170
|
+
});
|
|
171
|
+
unsubscribes.push(unsubscribe);
|
|
172
|
+
return unsubscribe;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
(_chatSDK$setOnlineLis = (_chatSDK = chatSDK).setOnlineListener) === null || _chatSDK$setOnlineLis === void 0 ? void 0 : _chatSDK$setOnlineLis.call(_chatSDK, onOnline => listener(onOnline, 'online'));
|
|
176
|
+
(_chatSDK$setOfflineLi = (_chatSDK2 = chatSDK).setOfflineListener) === null || _chatSDK$setOfflineLi === void 0 ? void 0 : _chatSDK$setOfflineLi.call(_chatSDK2, onOffline => listener(onOffline, 'offline'));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
chatSDK,
|
|
181
|
+
unsubscribes
|
|
182
|
+
};
|
|
137
183
|
};
|
|
138
184
|
|
|
139
185
|
export default SendbirdUIKitContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useRef","useState","Platform","SafeAreaProvider","Sendbird","GroupChannelModule","OpenChannelModule","DialogProvider","Header","HeaderStyleProvider","LightUIKitTheme","ToastProvider","UIKitThemeProvider","LocalizationProvider","PlatformServiceProvider","SendbirdChatProvider","UserProfileProvider","useLocalization","InternalLocalCacheStorage","StringSetEn","SBUDynamicModule","VERSION","InternalErrorBoundaryContainer","NetInfo","get","SendbirdUIKit","Object","freeze","PLATFORM","OS","toLowerCase","SendbirdUIKitContainer","children","appId","chatOptions","platformServices","localization","styles","toast","userProfile","errorBoundary","unsubscribes","current","getSendbirdSDK","sdk","init","modules","localCacheEnabled","Boolean","localCacheStorage","useAsyncStorageStore","undefined","onInitialized","addExtension","addEventListener","listener","callback","callbackType","unsubscribe","state","online","isConnected","isInternetReachable","push","setOnlineListener","onOnline","setOfflineListener","onOffline","sdkInstance","setSdkInstance","forEach","u","enableAutoPushTokenRegistration","enableChannelListTypingIndicator","enableChannelListMessageReceiptStatus","enableUseUserIdForNickname","stringSet","file","notification","clipboard","media","theme","HeaderComponent","defaultHeaderTitleAlign","statusBarTranslucent","dismissTimeout","onCreateChannel","onBeforeCreateChannel","LocalizedDialogProvider","STRINGS","alert","ok","DIALOG","ALERT_DEFAULT_OK","prompt","PROMPT_DEFAULT_OK","cancel","PROMPT_DEFAULT_CANCEL","placeholder","PROMPT_DEFAULT_PLACEHOLDER"],"sources":["SendbirdUIKitContainer.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport Sendbird from '@sendbird/chat';\nimport { GroupChannelModule } from '@sendbird/chat/groupChannel';\nimport { OpenChannelModule } from '@sendbird/chat/openChannel';\nimport type { HeaderStyleContextType, UIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport {\n DialogProvider,\n Header,\n HeaderStyleProvider,\n LightUIKitTheme,\n ToastProvider,\n UIKitThemeProvider,\n} from '@sendbird/uikit-react-native-foundation';\nimport type {\n SendbirdBaseChannel,\n SendbirdChatSDK,\n SendbirdGroupChannelCreateParams,\n SendbirdMember,\n SendbirdUser,\n} from '@sendbird/uikit-utils';\n\nimport { LocalizationProvider } from '../contexts/LocalizationCtx';\nimport { PlatformServiceProvider } from '../contexts/PlatformServiceCtx';\nimport type { UIKitFeaturesInSendbirdChatContext } from '../contexts/SendbirdChatCtx';\nimport { SendbirdChatProvider } from '../contexts/SendbirdChatCtx';\nimport { UserProfileProvider } from '../contexts/UserProfileCtx';\nimport { useLocalization } from '../hooks/useContext';\nimport InternalLocalCacheStorage from '../libs/InternalLocalCacheStorage';\nimport StringSetEn from '../localization/StringSet.en';\nimport type { StringSet } from '../localization/StringSet.type';\nimport SBUDynamicModule from '../platform/dynamicModule';\nimport type {\n ClipboardServiceInterface,\n FileServiceInterface,\n MediaServiceInterface,\n NotificationServiceInterface,\n} from '../platform/types';\nimport type { ErrorBoundaryProps, LocalCacheStorage } from '../types';\nimport VERSION from '../version';\nimport InternalErrorBoundaryContainer from './InternalErrorBoundaryContainer';\n\nconst NetInfo = SBUDynamicModule.get('@react-native-community/netinfo', 'warn');\n\nexport const SendbirdUIKit = Object.freeze({\n VERSION,\n PLATFORM: Platform.OS.toLowerCase(),\n});\n\nexport type SendbirdUIKitContainerProps = React.PropsWithChildren<{\n appId: string;\n platformServices: {\n file: FileServiceInterface;\n notification: NotificationServiceInterface;\n clipboard: ClipboardServiceInterface;\n media?: MediaServiceInterface;\n };\n chatOptions?: {\n localCacheStorage?: LocalCacheStorage;\n onInitialized?: (sdkInstance: SendbirdChatSDK) => SendbirdChatSDK;\n } & Partial<UIKitFeaturesInSendbirdChatContext>;\n localization?: {\n stringSet?: StringSet;\n };\n styles?: {\n theme?: UIKitTheme;\n statusBarTranslucent?: boolean;\n defaultHeaderTitleAlign?: 'left' | 'center';\n defaultHeaderHeight?: number;\n HeaderComponent?: HeaderStyleContextType['HeaderComponent'];\n };\n toast?: {\n dismissTimeout?: number;\n };\n userProfile?: {\n onCreateChannel: (channel: SendbirdBaseChannel) => void;\n onBeforeCreateChannel?: (\n channelParams: SendbirdGroupChannelCreateParams,\n users: SendbirdUser[] | SendbirdMember[],\n ) => SendbirdGroupChannelCreateParams | Promise<SendbirdGroupChannelCreateParams>;\n };\n errorBoundary?: {\n onError?: (props: ErrorBoundaryProps) => void;\n ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;\n };\n}>;\n\nconst SendbirdUIKitContainer = ({\n children,\n appId,\n chatOptions,\n platformServices,\n localization,\n styles,\n toast,\n userProfile,\n errorBoundary,\n}: SendbirdUIKitContainerProps) => {\n const unsubscribes = useRef<(() => void)[]>([]).current;\n const getSendbirdSDK = () => {\n let sdk: SendbirdChatSDK;\n\n sdk = Sendbird.init({\n appId,\n modules: [new GroupChannelModule(), new OpenChannelModule()],\n localCacheEnabled: Boolean(chatOptions?.localCacheStorage),\n // @ts-ignore\n useAsyncStorageStore: chatOptions?.localCacheStorage\n ? new InternalLocalCacheStorage(chatOptions.localCacheStorage)\n : undefined,\n });\n\n if (chatOptions?.onInitialized) {\n sdk = chatOptions?.onInitialized(sdk);\n }\n\n if (SendbirdUIKit.VERSION) {\n sdk.addExtension('sb_uikit', SendbirdUIKit.VERSION);\n }\n\n if (SendbirdUIKit.PLATFORM) {\n sdk.addExtension('device-os-platform', SendbirdUIKit.PLATFORM);\n }\n\n if (NetInfo?.addEventListener) {\n const listener = (callback: () => void, callbackType: 'online' | 'offline') => {\n const unsubscribe = NetInfo.addEventListener((state) => {\n const online = Boolean(state.isConnected) || Boolean(state.isInternetReachable);\n if (online && callbackType === 'online') callback();\n if (!online && callbackType === 'offline') callback();\n });\n unsubscribes.push(unsubscribe);\n return unsubscribe;\n };\n sdk.setOnlineListener?.((onOnline) => listener(onOnline, 'online'));\n sdk.setOfflineListener?.((onOffline) => listener(onOffline, 'offline'));\n }\n return sdk;\n };\n\n const [sdkInstance, setSdkInstance] = useState<SendbirdChatSDK>(getSendbirdSDK);\n\n useEffect(() => {\n setSdkInstance(getSendbirdSDK);\n return () => {\n unsubscribes.forEach((u) => {\n try {\n u();\n } catch {}\n });\n };\n }, [appId, chatOptions?.localCacheStorage]);\n\n return (\n <SafeAreaProvider>\n <SendbirdChatProvider\n sdkInstance={sdkInstance}\n enableAutoPushTokenRegistration={chatOptions?.enableAutoPushTokenRegistration ?? true}\n enableChannelListTypingIndicator={chatOptions?.enableChannelListTypingIndicator ?? false}\n enableChannelListMessageReceiptStatus={chatOptions?.enableChannelListMessageReceiptStatus ?? false}\n enableUseUserIdForNickname={chatOptions?.enableUseUserIdForNickname ?? false}\n >\n <LocalizationProvider stringSet={localization?.stringSet ?? StringSetEn}>\n <PlatformServiceProvider\n fileService={platformServices.file}\n notificationService={platformServices.notification}\n clipboardService={platformServices.clipboard}\n mediaService={platformServices.media}\n >\n <UIKitThemeProvider theme={styles?.theme ?? LightUIKitTheme}>\n <HeaderStyleProvider\n HeaderComponent={styles?.HeaderComponent ?? Header}\n defaultTitleAlign={styles?.defaultHeaderTitleAlign ?? 'left'}\n statusBarTranslucent={styles?.statusBarTranslucent ?? true}\n >\n <LocalizedDialogProvider>\n <ToastProvider dismissTimeout={toast?.dismissTimeout}>\n <UserProfileProvider\n onCreateChannel={userProfile?.onCreateChannel}\n onBeforeCreateChannel={userProfile?.onBeforeCreateChannel}\n >\n <InternalErrorBoundaryContainer {...errorBoundary}>{children}</InternalErrorBoundaryContainer>\n </UserProfileProvider>\n </ToastProvider>\n </LocalizedDialogProvider>\n </HeaderStyleProvider>\n </UIKitThemeProvider>\n </PlatformServiceProvider>\n </LocalizationProvider>\n </SendbirdChatProvider>\n </SafeAreaProvider>\n );\n};\n\nconst LocalizedDialogProvider = ({ children }: React.PropsWithChildren) => {\n const { STRINGS } = useLocalization();\n return (\n <DialogProvider\n defaultLabels={{\n alert: {\n ok: STRINGS.DIALOG.ALERT_DEFAULT_OK,\n },\n prompt: {\n ok: STRINGS.DIALOG.PROMPT_DEFAULT_OK,\n cancel: STRINGS.DIALOG.PROMPT_DEFAULT_CANCEL,\n placeholder: STRINGS.DIALOG.PROMPT_DEFAULT_PLACEHOLDER,\n },\n }}\n >\n {children}\n </DialogProvider>\n );\n};\n\nexport default SendbirdUIKitContainer;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,MAA3B,EAAmCC,QAAnC,QAAmD,OAAnD;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,gBAAT,QAAiC,gCAAjC;AAEA,OAAOC,QAAP,MAAqB,gBAArB;AACA,SAASC,kBAAT,QAAmC,6BAAnC;AACA,SAASC,iBAAT,QAAkC,4BAAlC;AAEA,SACEC,cADF,EAEEC,MAFF,EAGEC,mBAHF,EAIEC,eAJF,EAKEC,aALF,EAMEC,kBANF,QAOO,yCAPP;AAgBA,SAASC,oBAAT,QAAqC,6BAArC;AACA,SAASC,uBAAT,QAAwC,gCAAxC;AAEA,SAASC,oBAAT,QAAqC,6BAArC;AACA,SAASC,mBAAT,QAAoC,4BAApC;AACA,SAASC,eAAT,QAAgC,qBAAhC;AACA,OAAOC,yBAAP,MAAsC,mCAAtC;AACA,OAAOC,WAAP,MAAwB,8BAAxB;AAEA,OAAOC,gBAAP,MAA6B,2BAA7B;AAQA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,8BAAP,MAA2C,kCAA3C;AAEA,MAAMC,OAAO,GAAGH,gBAAgB,CAACI,GAAjB,CAAqB,iCAArB,EAAwD,MAAxD,CAAhB;AAEA,OAAO,MAAMC,aA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D,qBACE,oBAAC,aAAD;IAAe,cAAc,EAAE9C,KAAF,aAAEA,KAAF,uBAAEA,KAAK,CAAE+C;EAAtC,gBACE,oBAAC,mBAAD;IACE,eAAe,EAAE9C,WAAF,aAAEA,WAAF,uBAAEA,WAAW,CAAE+C,eADhC;IAEE,qBAAqB,EAAE/C,WAAF,aAAEA,WAAF,uBAAEA,WAAW,CAAEgD;EAFtC,gBAIE,oBAAC,8BAAD,EAAoC/C,aAApC,EAAoDR,QAApD,CAJF,CADF,CADF,CALF,CADF,CANF,CADF,CAPF,CADF,CADF;AAuCD,CAzGD;;AA2GA,MAAMwD,uBAAuB,GAAG,SAA2C;EAAA,IAA1C;IAAExD;EAAF,CAA0C;EACzE,MAAM;IAAEyD;EAAF,IAAcxE,eAAe,EAAnC;EACA,oBACE,oBAAC,cAAD;IACE,aAAa,EAAE;MACbyE,KAAK,EAAE;QACLC,EAAE,EAAEF,OAAO,CAACG,MAAR,CAAeC;MADd,CADM;MAIbC,MAAM,EAAE;QACNH,EAAE,EAAEF,OAAO,CAACG,MAAR,CAAeG,iBADb;QAENC,MAAM,EAAEP,OAAO,CAACG,MAAR,CAAeK,qBAFjB;QAGNC,WAAW,EAAET,OAAO,CAACG,MAAR,CAAeO;MAHtB;IAJK;EADjB,GAYGnE,QAZH,CADF;AAgBD,CAlBD;;AAoBA,eAAeD,sBAAf"}
|
|
1
|
+
{"version":3,"names":["React","useLayoutEffect","useMemo","useRef","useState","Platform","SafeAreaProvider","Sendbird","GroupChannelModule","OpenChannelModule","DialogProvider","Header","HeaderStyleProvider","LightUIKitTheme","ToastProvider","UIKitThemeProvider","useIsFirstMount","LocalizationContext","LocalizationProvider","PlatformServiceProvider","ReactionProvider","SendbirdChatProvider","UserProfileProvider","EmojiManager","ImageCompressionConfig","InternalLocalCacheStorage","MentionConfig","MentionManager","StringSetEn","SBUDynamicModule","VERSION","InternalErrorBoundaryContainer","NetInfo","get","SendbirdUIKit","Object","freeze","PLATFORM","OS","toLowerCase","DEFAULT","AUTO_PUSH_TOKEN_REGISTRATION","CHANNEL_LIST_TYPING_INDICATOR","CHANNEL_LIST_MESSAGE_RECEIPT_STATUS","USE_USER_ID_FOR_NICKNAME","USER_MENTION","IMAGE_COMPRESSION","SendbirdUIKitContainer","children","appId","chatOptions","platformServices","localization","styles","errorBoundary","toast","userProfile","userMention","imageCompression","defaultStringSet","stringSet","isFirstMount","unsubscribes","internalStorage","localCacheStorage","undefined","sdkInstance","setSdkInstance","sendbird","initializeSendbird","onInitialized","current","chatSDK","emojiManager","mentionManager","config","mentionLimit","MENTION_LIMIT","suggestionLimit","SUGGESTION_LIMIT","debounceMills","DEBOUNCE_MILLS","delimiter","DELIMITER","trigger","TRIGGER","enableUserMention","imageCompressionConfig","compressionRate","COMPRESSION_RATE","width","height","forEach","u","enableAutoPushTokenRegistration","enableChannelListTypingIndicator","enableChannelListMessageReceiptStatus","enableUseUserIdForNickname","enableImageCompression","file","notification","clipboard","media","theme","HeaderComponent","defaultHeaderTitleAlign","statusBarTranslucent","dismissTimeout","onCreateChannel","onBeforeCreateChannel","value","STRINGS","alert","ok","DIALOG","ALERT_DEFAULT_OK","prompt","PROMPT_DEFAULT_OK","cancel","PROMPT_DEFAULT_CANCEL","placeholder","PROMPT_DEFAULT_PLACEHOLDER","init","modules","localCacheEnabled","Boolean","useAsyncStorageStore","newInstance","addExtension","addEventListener","listener","callback","callbackType","unsubscribe","state","online","isConnected","isInternetReachable","push","setOnlineListener","onOnline","setOfflineListener","onOffline"],"sources":["SendbirdUIKitContainer.tsx"],"sourcesContent":["import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport Sendbird from '@sendbird/chat';\nimport { GroupChannelModule } from '@sendbird/chat/groupChannel';\nimport { OpenChannelModule } from '@sendbird/chat/openChannel';\nimport type { HeaderStyleContextType, UIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport {\n DialogProvider,\n Header,\n HeaderStyleProvider,\n LightUIKitTheme,\n ToastProvider,\n UIKitThemeProvider,\n} from '@sendbird/uikit-react-native-foundation';\nimport type {\n SendbirdBaseChannel,\n SendbirdChatSDK,\n SendbirdGroupChannelCreateParams,\n SendbirdMember,\n SendbirdUser,\n} from '@sendbird/uikit-utils';\nimport { useIsFirstMount } from '@sendbird/uikit-utils';\n\nimport { LocalizationContext, LocalizationProvider } from '../contexts/LocalizationCtx';\nimport { PlatformServiceProvider } from '../contexts/PlatformServiceCtx';\nimport { ReactionProvider } from '../contexts/ReactionCtx';\nimport type { UIKitFeaturesInSendbirdChatContext } from '../contexts/SendbirdChatCtx';\nimport { SendbirdChatProvider } from '../contexts/SendbirdChatCtx';\nimport { UserProfileProvider } from '../contexts/UserProfileCtx';\nimport EmojiManager from '../libs/EmojiManager';\nimport type { ImageCompressionConfigInterface } from '../libs/ImageCompressionConfig';\nimport ImageCompressionConfig from '../libs/ImageCompressionConfig';\nimport InternalLocalCacheStorage from '../libs/InternalLocalCacheStorage';\nimport MentionConfig, { MentionConfigInterface } from '../libs/MentionConfig';\nimport MentionManager from '../libs/MentionManager';\nimport StringSetEn from '../localization/StringSet.en';\nimport type { StringSet } from '../localization/StringSet.type';\nimport SBUDynamicModule from '../platform/dynamicModule';\nimport type {\n ClipboardServiceInterface,\n FileServiceInterface,\n MediaServiceInterface,\n NotificationServiceInterface,\n} from '../platform/types';\nimport type { ErrorBoundaryProps, LocalCacheStorage } from '../types';\nimport VERSION from '../version';\nimport InternalErrorBoundaryContainer from './InternalErrorBoundaryContainer';\n\nconst NetInfo = SBUDynamicModule.get('@react-native-community/netinfo', 'warn');\n\nexport const SendbirdUIKit = Object.freeze({\n VERSION,\n PLATFORM: Platform.OS.toLowerCase(),\n DEFAULT: {\n AUTO_PUSH_TOKEN_REGISTRATION: true,\n CHANNEL_LIST_TYPING_INDICATOR: false,\n CHANNEL_LIST_MESSAGE_RECEIPT_STATUS: false,\n USE_USER_ID_FOR_NICKNAME: false,\n USER_MENTION: false,\n IMAGE_COMPRESSION: true,\n },\n});\n\nexport type SendbirdUIKitContainerProps = React.PropsWithChildren<{\n appId: string;\n platformServices: {\n file: FileServiceInterface;\n notification: NotificationServiceInterface;\n clipboard: ClipboardServiceInterface;\n media: MediaServiceInterface;\n };\n chatOptions?: {\n localCacheStorage?: LocalCacheStorage;\n onInitialized?: (sdkInstance: SendbirdChatSDK) => SendbirdChatSDK;\n } & Partial<UIKitFeaturesInSendbirdChatContext>;\n localization?: {\n stringSet?: StringSet;\n };\n styles?: {\n theme?: UIKitTheme;\n statusBarTranslucent?: boolean;\n defaultHeaderTitleAlign?: 'left' | 'center';\n defaultHeaderHeight?: number;\n HeaderComponent?: HeaderStyleContextType['HeaderComponent'];\n };\n errorBoundary?: {\n onError?: (props: ErrorBoundaryProps) => void;\n ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;\n };\n toast?: {\n dismissTimeout?: number;\n };\n userProfile?: {\n onCreateChannel: (channel: SendbirdBaseChannel) => void;\n onBeforeCreateChannel?: (\n channelParams: SendbirdGroupChannelCreateParams,\n users: SendbirdUser[] | SendbirdMember[],\n ) => SendbirdGroupChannelCreateParams | Promise<SendbirdGroupChannelCreateParams>;\n };\n userMention?: Pick<Partial<MentionConfigInterface>, 'mentionLimit' | 'suggestionLimit' | 'debounceMills'>;\n imageCompression?: Partial<ImageCompressionConfigInterface>;\n}>;\n\nconst SendbirdUIKitContainer = ({\n children,\n appId,\n chatOptions,\n platformServices,\n localization,\n styles,\n errorBoundary,\n toast,\n userProfile,\n userMention,\n imageCompression,\n}: SendbirdUIKitContainerProps) => {\n const defaultStringSet = localization?.stringSet ?? StringSetEn;\n\n const isFirstMount = useIsFirstMount();\n const unsubscribes = useRef<Array<() => void>>([]);\n const internalStorage = useMemo(\n () => (chatOptions?.localCacheStorage ? new InternalLocalCacheStorage(chatOptions.localCacheStorage) : undefined),\n [chatOptions?.localCacheStorage],\n );\n\n const [sdkInstance, setSdkInstance] = useState<SendbirdChatSDK>(() => {\n const sendbird = initializeSendbird(appId, internalStorage, chatOptions?.onInitialized);\n unsubscribes.current = sendbird.unsubscribes;\n return sendbird.chatSDK;\n });\n\n const emojiManager = useMemo(() => new EmojiManager(internalStorage), [internalStorage]);\n\n const mentionManager = useMemo(() => {\n const config = new MentionConfig({\n mentionLimit: userMention?.mentionLimit || MentionConfig.DEFAULT.MENTION_LIMIT,\n suggestionLimit: userMention?.suggestionLimit || MentionConfig.DEFAULT.SUGGESTION_LIMIT,\n debounceMills: userMention?.debounceMills ?? MentionConfig.DEFAULT.DEBOUNCE_MILLS,\n delimiter: MentionConfig.DEFAULT.DELIMITER,\n trigger: MentionConfig.DEFAULT.TRIGGER,\n });\n return new MentionManager(config, chatOptions?.enableUserMention ?? SendbirdUIKit.DEFAULT.USER_MENTION);\n }, [userMention?.mentionLimit, userMention?.suggestionLimit, userMention?.debounceMills]);\n\n const imageCompressionConfig = useMemo(\n () =>\n new ImageCompressionConfig({\n compressionRate: imageCompression?.compressionRate || ImageCompressionConfig.DEFAULT.COMPRESSION_RATE,\n width: imageCompression?.width,\n height: imageCompression?.height,\n }),\n [imageCompression?.compressionRate, imageCompression?.width, imageCompression?.height],\n );\n\n useLayoutEffect(() => {\n if (!isFirstMount) {\n const sendbird = initializeSendbird(appId, internalStorage, chatOptions?.onInitialized);\n setSdkInstance(sendbird.chatSDK);\n unsubscribes.current = sendbird.unsubscribes;\n }\n\n return () => {\n if (!isFirstMount) {\n unsubscribes.current.forEach((u) => {\n try {\n u();\n } catch {}\n });\n }\n };\n }, [appId, internalStorage]);\n\n return (\n <SafeAreaProvider>\n <SendbirdChatProvider\n sdkInstance={sdkInstance}\n emojiManager={emojiManager}\n mentionManager={mentionManager}\n imageCompressionConfig={imageCompressionConfig}\n enableAutoPushTokenRegistration={\n chatOptions?.enableAutoPushTokenRegistration ?? SendbirdUIKit.DEFAULT.AUTO_PUSH_TOKEN_REGISTRATION\n }\n enableChannelListTypingIndicator={\n chatOptions?.enableChannelListTypingIndicator ?? SendbirdUIKit.DEFAULT.CHANNEL_LIST_TYPING_INDICATOR\n }\n enableChannelListMessageReceiptStatus={\n chatOptions?.enableChannelListMessageReceiptStatus ??\n SendbirdUIKit.DEFAULT.CHANNEL_LIST_MESSAGE_RECEIPT_STATUS\n }\n enableUseUserIdForNickname={\n chatOptions?.enableUseUserIdForNickname ?? SendbirdUIKit.DEFAULT.USE_USER_ID_FOR_NICKNAME\n }\n enableUserMention={chatOptions?.enableUserMention ?? SendbirdUIKit.DEFAULT.USER_MENTION}\n enableImageCompression={chatOptions?.enableImageCompression ?? SendbirdUIKit.DEFAULT.IMAGE_COMPRESSION}\n >\n <LocalizationProvider stringSet={defaultStringSet}>\n <PlatformServiceProvider\n fileService={platformServices.file}\n notificationService={platformServices.notification}\n clipboardService={platformServices.clipboard}\n mediaService={platformServices.media}\n >\n <UIKitThemeProvider theme={styles?.theme ?? LightUIKitTheme}>\n <HeaderStyleProvider\n HeaderComponent={styles?.HeaderComponent ?? Header}\n defaultTitleAlign={styles?.defaultHeaderTitleAlign ?? 'left'}\n statusBarTranslucent={styles?.statusBarTranslucent ?? true}\n >\n <ToastProvider dismissTimeout={toast?.dismissTimeout}>\n <UserProfileProvider\n onCreateChannel={userProfile?.onCreateChannel}\n onBeforeCreateChannel={userProfile?.onBeforeCreateChannel}\n >\n <ReactionProvider>\n <LocalizationContext.Consumer>\n {(value) => {\n const STRINGS = value?.STRINGS || defaultStringSet;\n return (\n <DialogProvider\n defaultLabels={{\n alert: { ok: STRINGS.DIALOG.ALERT_DEFAULT_OK },\n prompt: {\n ok: STRINGS.DIALOG.PROMPT_DEFAULT_OK,\n cancel: STRINGS.DIALOG.PROMPT_DEFAULT_CANCEL,\n placeholder: STRINGS.DIALOG.PROMPT_DEFAULT_PLACEHOLDER,\n },\n }}\n >\n <InternalErrorBoundaryContainer {...errorBoundary}>\n {children}\n </InternalErrorBoundaryContainer>\n </DialogProvider>\n );\n }}\n </LocalizationContext.Consumer>\n </ReactionProvider>\n </UserProfileProvider>\n </ToastProvider>\n </HeaderStyleProvider>\n </UIKitThemeProvider>\n </PlatformServiceProvider>\n </LocalizationProvider>\n </SendbirdChatProvider>\n </SafeAreaProvider>\n );\n};\n\nconst initializeSendbird = (\n appId: string,\n internalStorage?: InternalLocalCacheStorage,\n onInitialized?: (sdk: SendbirdChatSDK) => SendbirdChatSDK,\n) => {\n const unsubscribes: Array<() => void> = [];\n let chatSDK: SendbirdChatSDK;\n\n chatSDK = Sendbird.init({\n appId,\n modules: [new GroupChannelModule(), new OpenChannelModule()],\n localCacheEnabled: Boolean(internalStorage),\n useAsyncStorageStore: internalStorage as never,\n newInstance: true,\n });\n\n if (onInitialized) {\n chatSDK = onInitialized(chatSDK);\n }\n\n if (SendbirdUIKit.VERSION) {\n chatSDK.addExtension('sb_uikit', SendbirdUIKit.VERSION);\n }\n\n if (SendbirdUIKit.PLATFORM) {\n chatSDK.addExtension('device-os-platform', SendbirdUIKit.PLATFORM);\n }\n\n if (NetInfo?.addEventListener) {\n const listener = (callback: () => void, callbackType: 'online' | 'offline') => {\n const unsubscribe = NetInfo.addEventListener((state) => {\n const online = Boolean(state.isConnected) || Boolean(state.isInternetReachable);\n if (online && callbackType === 'online') callback();\n if (!online && callbackType === 'offline') callback();\n });\n unsubscribes.push(unsubscribe);\n return unsubscribe;\n };\n chatSDK.setOnlineListener?.((onOnline) => listener(onOnline, 'online'));\n chatSDK.setOfflineListener?.((onOffline) => listener(onOffline, 'offline'));\n }\n return { chatSDK, unsubscribes };\n};\n\nexport default SendbirdUIKitContainer;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,eAAhB,EAAiCC,OAAjC,EAA0CC,MAA1C,EAAkDC,QAAlD,QAAkE,OAAlE;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,gBAAT,QAAiC,gCAAjC;AAEA,OAAOC,QAAP,MAAqB,gBAArB;AACA,SAASC,kBAAT,QAAmC,6BAAnC;AACA,SAASC,iBAAT,Q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,YAAR,CAAqB,UAArB,EAAiC9F,aAAa,CAACJ,OAA/C;EACD;;EAED,IAAII,aAAa,CAACG,QAAlB,EAA4B;IAC1BmC,OAAO,CAACwD,YAAR,CAAqB,oBAArB,EAA2C9F,aAAa,CAACG,QAAzD;EACD;;EAED,IAAIL,OAAJ,aAAIA,OAAJ,eAAIA,OAAO,CAAEiG,gBAAb,EAA+B;IAAA;;IAC7B,MAAMC,QAAQ,GAAG,CAACC,QAAD,EAAuBC,YAAvB,KAA8D;MAC7E,MAAMC,WAAW,GAAGrG,OAAO,CAACiG,gBAAR,CAA0BK,KAAD,IAAW;QACtD,MAAMC,MAAM,GAAGV,OAAO,CAACS,KAAK,CAACE,WAAP,CAAP,IAA8BX,OAAO,CAACS,KAAK,CAACG,mBAAP,CAApD;QACA,IAAIF,MAAM,IAAIH,YAAY,KAAK,QAA/B,EAAyCD,QAAQ;QACjD,IAAI,CAACI,MAAD,IAAWH,YAAY,KAAK,SAAhC,EAA2CD,QAAQ;MACpD,CAJmB,CAApB;MAKArE,YAAY,CAAC4E,IAAb,CAAkBL,WAAlB;MACA,OAAOA,WAAP;IACD,CARD;;IASA,qCAAA7D,OAAO,EAACmE,iBAAR,+FAA6BC,QAAD,IAAcV,QAAQ,CAACU,QAAD,EAAW,QAAX,CAAlD;IACA,sCAAApE,OAAO,EAACqE,kBAAR,gGAA8BC,SAAD,IAAeZ,QAAQ,CAACY,SAAD,EAAY,SAAZ,CAApD;EACD;;EACD,OAAO;IAAEtE,OAAF;IAAWV;EAAX,CAAP;AACD,CA1CD;;AA4CA,eAAef,sBAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","PlatformServiceContext","createContext","PlatformServiceProvider","children","fileService","clipboardService","notificationService","mediaService"],"sources":["PlatformServiceCtx.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {\n ClipboardServiceInterface,\n FileServiceInterface,\n MediaServiceInterface,\n NotificationServiceInterface,\n} from '../platform/types';\n\ntype Props = React.PropsWithChildren<{\n fileService: FileServiceInterface;\n clipboardService: ClipboardServiceInterface;\n notificationService: NotificationServiceInterface;\n mediaService
|
|
1
|
+
{"version":3,"names":["React","PlatformServiceContext","createContext","PlatformServiceProvider","children","fileService","clipboardService","notificationService","mediaService"],"sources":["PlatformServiceCtx.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {\n ClipboardServiceInterface,\n FileServiceInterface,\n MediaServiceInterface,\n NotificationServiceInterface,\n} from '../platform/types';\n\ntype Props = React.PropsWithChildren<{\n fileService: FileServiceInterface;\n clipboardService: ClipboardServiceInterface;\n notificationService: NotificationServiceInterface;\n mediaService: MediaServiceInterface;\n}>;\n\nexport type PlatformServiceContextType = {\n fileService: FileServiceInterface;\n clipboardService: ClipboardServiceInterface;\n notificationService: NotificationServiceInterface;\n mediaService: MediaServiceInterface;\n};\n\nexport const PlatformServiceContext = React.createContext<PlatformServiceContextType | null>(null);\nexport const PlatformServiceProvider = ({\n children,\n fileService,\n clipboardService,\n notificationService,\n mediaService,\n}: Props) => {\n return (\n <PlatformServiceContext.Provider value={{ fileService, clipboardService, notificationService, mediaService }}>\n {children}\n </PlatformServiceContext.Provider>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAuBA,OAAO,MAAMC,sBAAsB,gBAAGD,KAAK,CAACE,aAAN,CAAuD,IAAvD,CAA/B;AACP,OAAO,MAAMC,uBAAuB,GAAG,QAM1B;EAAA,IAN2B;IACtCC,QADsC;IAEtCC,WAFsC;IAGtCC,gBAHsC;IAItCC,mBAJsC;IAKtCC;EALsC,CAM3B;EACX,oBACE,oBAAC,sBAAD,CAAwB,QAAxB;IAAiC,KAAK,EAAE;MAAEH,WAAF;MAAeC,gBAAf;MAAiCC,mBAAjC;MAAsDC;IAAtD;EAAxC,GACGJ,QADH,CADF;AAKD,CAZM"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import React, { useCallback, useContext, useReducer, useRef, useState } from 'react';
|
|
4
|
+
import { NOOP } from '@sendbird/uikit-utils';
|
|
5
|
+
import { ReactionBottomSheets } from '../components/ReactionBottomSheets';
|
|
6
|
+
import { LocalizationContext } from '../contexts/LocalizationCtx';
|
|
7
|
+
import { SendbirdChatContext } from '../contexts/SendbirdChatCtx';
|
|
8
|
+
import { UserProfileContext } from '../contexts/UserProfileCtx';
|
|
9
|
+
export const ReactionContext = /*#__PURE__*/React.createContext(null);
|
|
10
|
+
export const ReactionProvider = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
children
|
|
13
|
+
} = _ref;
|
|
14
|
+
const chatCtx = useContext(SendbirdChatContext);
|
|
15
|
+
const localizationCtx = useContext(LocalizationContext);
|
|
16
|
+
const userProfileCtx = useContext(UserProfileContext);
|
|
17
|
+
if (!chatCtx) throw new Error('SendbirdChatContext is not provided');
|
|
18
|
+
if (!localizationCtx) throw new Error('LocalizationContext is not provided');
|
|
19
|
+
if (!userProfileCtx) throw new Error('UserProfileContext is not provided');
|
|
20
|
+
const [state, setState] = useReducer((prev, next) => ({ ...prev,
|
|
21
|
+
...next
|
|
22
|
+
}), {});
|
|
23
|
+
const [reactionListVisible, setReactionListVisible] = useState(false);
|
|
24
|
+
const [reactionUserListVisible, setReactionUserListVisible] = useState(false);
|
|
25
|
+
const [reactionUserListFocusIndex, setReactionUserListFocusIndex] = useState(0);
|
|
26
|
+
const closeResolver = useRef(NOOP);
|
|
27
|
+
const openReactionList = useCallback(params => {
|
|
28
|
+
setState(params);
|
|
29
|
+
setReactionListVisible(true);
|
|
30
|
+
}, []);
|
|
31
|
+
const openReactionUserList = useCallback(_ref2 => {
|
|
32
|
+
let {
|
|
33
|
+
channel,
|
|
34
|
+
message,
|
|
35
|
+
focusIndex = 0
|
|
36
|
+
} = _ref2;
|
|
37
|
+
setState({
|
|
38
|
+
channel,
|
|
39
|
+
message
|
|
40
|
+
});
|
|
41
|
+
setReactionUserListFocusIndex(focusIndex);
|
|
42
|
+
setReactionUserListVisible(true);
|
|
43
|
+
}, []);
|
|
44
|
+
const updateReactionFocusedItem = useCallback(params => {
|
|
45
|
+
if (params) setState(params);else setState({});
|
|
46
|
+
}, []);
|
|
47
|
+
|
|
48
|
+
const createOnCloseWithResolver = callback => {
|
|
49
|
+
return () => {
|
|
50
|
+
return new Promise(resolve => {
|
|
51
|
+
closeResolver.current = resolve;
|
|
52
|
+
callback();
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const reactionCtx = { ...state,
|
|
58
|
+
openReactionList,
|
|
59
|
+
openReactionUserList,
|
|
60
|
+
updateReactionFocusedItem,
|
|
61
|
+
focusIndex: reactionUserListFocusIndex
|
|
62
|
+
};
|
|
63
|
+
const sheetProps = {
|
|
64
|
+
chatCtx,
|
|
65
|
+
reactionCtx,
|
|
66
|
+
localizationCtx,
|
|
67
|
+
userProfileCtx,
|
|
68
|
+
onDismiss: () => {
|
|
69
|
+
var _closeResolver$curren;
|
|
70
|
+
|
|
71
|
+
setState({});
|
|
72
|
+
(_closeResolver$curren = closeResolver.current) === null || _closeResolver$curren === void 0 ? void 0 : _closeResolver$curren.call(closeResolver);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return /*#__PURE__*/React.createElement(ReactionContext.Provider, {
|
|
76
|
+
value: reactionCtx
|
|
77
|
+
}, children, /*#__PURE__*/React.createElement(ReactionBottomSheets.UserList, _extends({}, sheetProps, {
|
|
78
|
+
visible: reactionUserListVisible,
|
|
79
|
+
onClose: createOnCloseWithResolver(() => setReactionUserListVisible(false))
|
|
80
|
+
})), /*#__PURE__*/React.createElement(ReactionBottomSheets.ReactionList, _extends({}, sheetProps, {
|
|
81
|
+
visible: reactionListVisible,
|
|
82
|
+
onClose: createOnCloseWithResolver(() => setReactionListVisible(false))
|
|
83
|
+
})));
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=ReactionCtx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","useContext","useReducer","useRef","useState","NOOP","ReactionBottomSheets","LocalizationContext","SendbirdChatContext","UserProfileContext","ReactionContext","createContext","ReactionProvider","children","chatCtx","localizationCtx","userProfileCtx","Error","state","setState","prev","next","reactionListVisible","setReactionListVisible","reactionUserListVisible","setReactionUserListVisible","reactionUserListFocusIndex","setReactionUserListFocusIndex","closeResolver","openReactionList","params","openReactionUserList","channel","message","focusIndex","updateReactionFocusedItem","createOnCloseWithResolver","callback","Promise","resolve","current","reactionCtx","sheetProps","onDismiss"],"sources":["ReactionCtx.tsx"],"sourcesContent":["import React, { useCallback, useContext, useReducer, useRef, useState } from 'react';\n\nimport type { SendbirdBaseChannel, SendbirdBaseMessage } from '@sendbird/uikit-utils';\nimport { NOOP } from '@sendbird/uikit-utils';\n\nimport { ReactionBottomSheets } from '../components/ReactionBottomSheets';\nimport { LocalizationContext } from '../contexts/LocalizationCtx';\nimport { SendbirdChatContext } from '../contexts/SendbirdChatCtx';\nimport { UserProfileContext } from '../contexts/UserProfileCtx';\n\ntype State = {\n message?: SendbirdBaseMessage;\n channel?: SendbirdBaseChannel;\n};\nexport type ReactionContextType = {\n openReactionList(param: Required<State>): void;\n openReactionUserList(param: Required<State> & { focusIndex?: number }): void;\n updateReactionFocusedItem(param?: State): void;\n focusIndex: number;\n} & State;\n\ntype Props = React.PropsWithChildren<{}>;\n\nexport const ReactionContext = React.createContext<ReactionContextType | null>(null);\nexport const ReactionProvider = ({ children }: Props) => {\n const chatCtx = useContext(SendbirdChatContext);\n const localizationCtx = useContext(LocalizationContext);\n const userProfileCtx = useContext(UserProfileContext);\n if (!chatCtx) throw new Error('SendbirdChatContext is not provided');\n if (!localizationCtx) throw new Error('LocalizationContext is not provided');\n if (!userProfileCtx) throw new Error('UserProfileContext is not provided');\n\n const [state, setState] = useReducer((prev: State, next: State) => ({ ...prev, ...next }), {});\n const [reactionListVisible, setReactionListVisible] = useState(false);\n const [reactionUserListVisible, setReactionUserListVisible] = useState(false);\n const [reactionUserListFocusIndex, setReactionUserListFocusIndex] = useState(0);\n\n const closeResolver = useRef<() => void>(NOOP);\n\n const openReactionList: ReactionContextType['openReactionList'] = useCallback((params) => {\n setState(params);\n setReactionListVisible(true);\n }, []);\n\n const openReactionUserList: ReactionContextType['openReactionUserList'] = useCallback(\n ({ channel, message, focusIndex = 0 }) => {\n setState({ channel, message });\n setReactionUserListFocusIndex(focusIndex);\n setReactionUserListVisible(true);\n },\n [],\n );\n\n const updateReactionFocusedItem: ReactionContextType['updateReactionFocusedItem'] = useCallback((params) => {\n if (params) setState(params);\n else setState({});\n }, []);\n\n const createOnCloseWithResolver = (callback: () => void) => {\n return () => {\n return new Promise<void>((resolve) => {\n closeResolver.current = resolve;\n callback();\n });\n };\n };\n\n const reactionCtx = {\n ...state,\n openReactionList,\n openReactionUserList,\n updateReactionFocusedItem,\n focusIndex: reactionUserListFocusIndex,\n };\n\n const sheetProps = {\n chatCtx,\n reactionCtx,\n localizationCtx,\n userProfileCtx,\n onDismiss: () => {\n setState({});\n closeResolver.current?.();\n },\n };\n\n return (\n <ReactionContext.Provider value={reactionCtx}>\n {children}\n <ReactionBottomSheets.UserList\n {...sheetProps}\n visible={reactionUserListVisible}\n onClose={createOnCloseWithResolver(() => setReactionUserListVisible(false))}\n />\n <ReactionBottomSheets.ReactionList\n {...sheetProps}\n visible={reactionListVisible}\n onClose={createOnCloseWithResolver(() => setReactionListVisible(false))}\n />\n </ReactionContext.Provider>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,UAA7B,EAAyCC,UAAzC,EAAqDC,MAArD,EAA6DC,QAA7D,QAA6E,OAA7E;AAGA,SAASC,IAAT,QAAqB,uBAArB;AAEA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A0B,CAAC,KAAD,CAAjC;EAHpC,GAFF,eAOE,oBAAC,oBAAD,CAAsB,YAAtB,eACMiB,UADN;IAEE,OAAO,EAAEpB,mBAFX;IAGE,OAAO,EAAEc,yBAAyB,CAAC,MAAMb,sBAAsB,CAAC,KAAD,CAA7B;EAHpC,GAPF,CADF;AAeD,CA7EM"}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import React, { useCallback,
|
|
2
|
-
import { AppState } from 'react-native';
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
3
2
|
import { useAppFeatures } from '@sendbird/uikit-chat-hooks';
|
|
4
|
-
import { confirmAndMarkAsDelivered, useForceUpdate } from '@sendbird/uikit-utils';
|
|
3
|
+
import { confirmAndMarkAsDelivered, useAppState, useForceUpdate } from '@sendbird/uikit-utils';
|
|
5
4
|
export const SendbirdChatContext = /*#__PURE__*/React.createContext(null);
|
|
6
5
|
export const SendbirdChatProvider = _ref => {
|
|
7
6
|
let {
|
|
8
7
|
children,
|
|
9
8
|
sdkInstance,
|
|
9
|
+
emojiManager,
|
|
10
|
+
mentionManager,
|
|
11
|
+
imageCompressionConfig,
|
|
10
12
|
enableAutoPushTokenRegistration,
|
|
11
13
|
enableChannelListMessageReceiptStatus,
|
|
12
14
|
enableChannelListTypingIndicator,
|
|
13
|
-
enableUseUserIdForNickname
|
|
15
|
+
enableUseUserIdForNickname,
|
|
16
|
+
enableUserMention,
|
|
17
|
+
enableImageCompression
|
|
14
18
|
} = _ref;
|
|
15
19
|
const [currentUser, _setCurrentUser] = useState();
|
|
16
20
|
const forceUpdate = useForceUpdate();
|
|
@@ -24,11 +28,17 @@ export const SendbirdChatProvider = _ref => {
|
|
|
24
28
|
const updateCurrentUserInfo = useCallback(async (nickname, profile) => {
|
|
25
29
|
let user = currentUser;
|
|
26
30
|
if (!user) throw new Error('Current user is not defined, please connect using `useConnection()` hook first');
|
|
27
|
-
const params = {
|
|
28
|
-
nickname
|
|
29
|
-
};
|
|
31
|
+
const params = {};
|
|
30
32
|
|
|
31
|
-
if (
|
|
33
|
+
if (!nickname) {
|
|
34
|
+
params.nickname = user.nickname;
|
|
35
|
+
} else {
|
|
36
|
+
params.nickname = nickname;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!profile) {
|
|
40
|
+
params.profileUrl = user.profileUrl;
|
|
41
|
+
} else if (typeof profile === 'string') {
|
|
32
42
|
params.profileUrl = profile;
|
|
33
43
|
} else if (typeof profile === 'object') {
|
|
34
44
|
params.profileImage = profile;
|
|
@@ -43,17 +53,15 @@ export const SendbirdChatProvider = _ref => {
|
|
|
43
53
|
const markAsDeliveredWithChannel = useCallback(channel => {
|
|
44
54
|
if (appFeatures.deliveryReceiptEnabled) confirmAndMarkAsDelivered([channel]);
|
|
45
55
|
}, [sdkInstance, appFeatures.deliveryReceiptEnabled]);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const subscriber = AppState.addEventListener('change', listener);
|
|
53
|
-
return () => subscriber.remove();
|
|
54
|
-
}, [sdkInstance]);
|
|
56
|
+
useAppState('change', status => {
|
|
57
|
+
// 'active' | 'background' | 'inactive' | 'unknown' | 'extension';
|
|
58
|
+
if (status === 'active') sdkInstance.connectionState === 'CLOSED' && sdkInstance.setForegroundState();else if (status === 'background') sdkInstance.connectionState === 'OPEN' && sdkInstance.setBackgroundState();
|
|
59
|
+
});
|
|
55
60
|
const value = {
|
|
56
61
|
sdk: sdkInstance,
|
|
62
|
+
emojiManager,
|
|
63
|
+
mentionManager,
|
|
64
|
+
imageCompressionConfig,
|
|
57
65
|
currentUser,
|
|
58
66
|
setCurrentUser,
|
|
59
67
|
updateCurrentUserInfo,
|
|
@@ -62,7 +70,9 @@ export const SendbirdChatProvider = _ref => {
|
|
|
62
70
|
autoPushTokenRegistrationEnabled: enableAutoPushTokenRegistration,
|
|
63
71
|
channelListTypingIndicatorEnabled: enableChannelListTypingIndicator,
|
|
64
72
|
channelListMessageReceiptStatusEnabled: enableChannelListMessageReceiptStatus,
|
|
65
|
-
useUserIdForNicknameEnabled: enableUseUserIdForNickname
|
|
73
|
+
useUserIdForNicknameEnabled: enableUseUserIdForNickname,
|
|
74
|
+
userMentionEnabled: enableUserMention,
|
|
75
|
+
imageCompressionEnabled: enableImageCompression
|
|
66
76
|
}
|
|
67
77
|
};
|
|
68
78
|
return /*#__PURE__*/React.createElement(SendbirdChatContext.Provider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","
|
|
1
|
+
{"version":3,"names":["React","useCallback","useState","useAppFeatures","confirmAndMarkAsDelivered","useAppState","useForceUpdate","SendbirdChatContext","createContext","SendbirdChatProvider","children","sdkInstance","emojiManager","mentionManager","imageCompressionConfig","enableAutoPushTokenRegistration","enableChannelListMessageReceiptStatus","enableChannelListTypingIndicator","enableUseUserIdForNickname","enableUserMention","enableImageCompression","currentUser","_setCurrentUser","forceUpdate","appFeatures","setCurrentUser","user","updateCurrentUserInfo","nickname","profile","Error","params","profileUrl","profileImage","markAsDeliveredWithChannel","channel","deliveryReceiptEnabled","status","connectionState","setForegroundState","setBackgroundState","value","sdk","features","autoPushTokenRegistrationEnabled","channelListTypingIndicatorEnabled","channelListMessageReceiptStatusEnabled","useUserIdForNicknameEnabled","userMentionEnabled","imageCompressionEnabled"],"sources":["SendbirdChatCtx.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\n\nimport { useAppFeatures } from '@sendbird/uikit-chat-hooks';\nimport type {\n SendbirdChatSDK,\n SendbirdGroupChannel,\n SendbirdUser,\n SendbirdUserUpdateParams,\n} from '@sendbird/uikit-utils';\nimport { confirmAndMarkAsDelivered, useAppState, useForceUpdate } from '@sendbird/uikit-utils';\n\nimport type EmojiManager from '../libs/EmojiManager';\nimport type ImageCompressionConfig from '../libs/ImageCompressionConfig';\nimport type MentionManager from '../libs/MentionManager';\nimport type { FileType } from '../platform/types';\n\nexport interface UIKitFeaturesInSendbirdChatContext {\n enableAutoPushTokenRegistration: boolean;\n enableChannelListTypingIndicator: boolean;\n enableChannelListMessageReceiptStatus: boolean;\n enableUseUserIdForNickname: boolean;\n enableUserMention: boolean;\n enableImageCompression: boolean;\n}\n\ninterface Props extends UIKitFeaturesInSendbirdChatContext, React.PropsWithChildren {\n sdkInstance: SendbirdChatSDK;\n emojiManager: EmojiManager;\n mentionManager: MentionManager;\n imageCompressionConfig: ImageCompressionConfig;\n}\n\nexport type SendbirdChatContextType = {\n sdk: SendbirdChatSDK;\n emojiManager: EmojiManager;\n mentionManager: MentionManager;\n imageCompressionConfig: ImageCompressionConfig;\n currentUser?: SendbirdUser;\n setCurrentUser: React.Dispatch<React.SetStateAction<SendbirdUser | undefined>>;\n\n // helper functions\n updateCurrentUserInfo: (nickname?: string, profile?: string | FileType) => Promise<SendbirdUser>;\n markAsDeliveredWithChannel: (channel: SendbirdGroupChannel) => void;\n\n features: {\n // UIKit features\n autoPushTokenRegistrationEnabled: boolean;\n channelListTypingIndicatorEnabled: boolean;\n channelListMessageReceiptStatusEnabled: boolean;\n useUserIdForNicknameEnabled: boolean;\n userMentionEnabled: boolean;\n imageCompressionEnabled: boolean;\n\n // Sendbird application features\n deliveryReceiptEnabled: boolean;\n broadcastChannelEnabled: boolean;\n superGroupChannelEnabled: boolean;\n reactionEnabled: boolean;\n };\n};\n\nexport const SendbirdChatContext = React.createContext<SendbirdChatContextType | null>(null);\nexport const SendbirdChatProvider = ({\n children,\n sdkInstance,\n emojiManager,\n mentionManager,\n imageCompressionConfig,\n enableAutoPushTokenRegistration,\n enableChannelListMessageReceiptStatus,\n enableChannelListTypingIndicator,\n enableUseUserIdForNickname,\n enableUserMention,\n enableImageCompression,\n}: Props) => {\n const [currentUser, _setCurrentUser] = useState<SendbirdUser>();\n const forceUpdate = useForceUpdate();\n const appFeatures = useAppFeatures(sdkInstance);\n\n const setCurrentUser: SendbirdChatContextType['setCurrentUser'] = useCallback((user) => {\n // NOTE: Sendbird SDK handle User object is always same object, so force update after setCurrentUser\n _setCurrentUser(user);\n forceUpdate();\n }, []);\n\n const updateCurrentUserInfo: SendbirdChatContextType['updateCurrentUserInfo'] = useCallback(\n async (nickname, profile) => {\n let user = currentUser;\n\n if (!user) throw new Error('Current user is not defined, please connect using `useConnection()` hook first');\n\n const params: SendbirdUserUpdateParams = {};\n\n if (!nickname) {\n params.nickname = user.nickname;\n } else {\n params.nickname = nickname;\n }\n\n if (!profile) {\n params.profileUrl = user.profileUrl;\n } else if (typeof profile === 'string') {\n params.profileUrl = profile;\n } else if (typeof profile === 'object') {\n params.profileImage = profile;\n } else {\n throw new Error(`Cannot update profile, not supported profile type(${typeof profile})`);\n }\n\n user = await sdkInstance.updateCurrentUserInfo(params);\n\n setCurrentUser(user);\n return user;\n },\n [sdkInstance, currentUser, setCurrentUser],\n );\n\n const markAsDeliveredWithChannel: SendbirdChatContextType['markAsDeliveredWithChannel'] = useCallback(\n (channel: SendbirdGroupChannel) => {\n if (appFeatures.deliveryReceiptEnabled) confirmAndMarkAsDelivered([channel]);\n },\n [sdkInstance, appFeatures.deliveryReceiptEnabled],\n );\n\n useAppState('change', (status) => {\n // 'active' | 'background' | 'inactive' | 'unknown' | 'extension';\n if (status === 'active') sdkInstance.connectionState === 'CLOSED' && sdkInstance.setForegroundState();\n else if (status === 'background') sdkInstance.connectionState === 'OPEN' && sdkInstance.setBackgroundState();\n });\n\n const value: SendbirdChatContextType = {\n sdk: sdkInstance,\n emojiManager,\n mentionManager,\n imageCompressionConfig,\n currentUser,\n setCurrentUser,\n\n updateCurrentUserInfo,\n markAsDeliveredWithChannel,\n\n features: {\n ...appFeatures,\n autoPushTokenRegistrationEnabled: enableAutoPushTokenRegistration,\n channelListTypingIndicatorEnabled: enableChannelListTypingIndicator,\n channelListMessageReceiptStatusEnabled: enableChannelListMessageReceiptStatus,\n useUserIdForNicknameEnabled: enableUseUserIdForNickname,\n userMentionEnabled: enableUserMention,\n imageCompressionEnabled: enableImageCompression,\n },\n };\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AE,EACR,GAAGnB,WADK;MAERoB,gCAAgC,EAAE7B,+BAF1B;MAGR8B,iCAAiC,EAAE5B,gCAH3B;MAIR6B,sCAAsC,EAAE9B,qCAJhC;MAKR+B,2BAA2B,EAAE7B,0BALrB;MAMR8B,kBAAkB,EAAE7B,iBANZ;MAOR8B,uBAAuB,EAAE7B;IAPjB;EAX2B,CAAvC;EAsBA,oBAAO,oBAAC,mBAAD,CAAqB,QAArB;IAA8B,KAAK,EAAEqB;EAArC,GAA6C/B,QAA7C,CAAP;AACD,CA3FM"}
|
|
@@ -4,6 +4,7 @@ import { Modal, OutlinedButton, ProfileCard, createStyleSheet } from '@sendbird/
|
|
|
4
4
|
import { Logger, PASS, useIIFE } from '@sendbird/uikit-utils';
|
|
5
5
|
import { LocalizationContext } from '../contexts/LocalizationCtx';
|
|
6
6
|
import { SendbirdChatContext } from '../contexts/SendbirdChatCtx';
|
|
7
|
+
let WARN_onCreateChannel = false;
|
|
7
8
|
export const UserProfileContext = /*#__PURE__*/React.createContext(null);
|
|
8
9
|
export const UserProfileProvider = _ref => {
|
|
9
10
|
let {
|
|
@@ -15,6 +16,12 @@ export const UserProfileProvider = _ref => {
|
|
|
15
16
|
const localizationContext = useContext(LocalizationContext);
|
|
16
17
|
if (!chatContext) throw new Error('SendbirdChatContext is not provided');
|
|
17
18
|
if (!localizationContext) throw new Error('LocalizationContext is not provided');
|
|
19
|
+
|
|
20
|
+
if (__DEV__ && !WARN_onCreateChannel && !onCreateChannel) {
|
|
21
|
+
Logger.warn('You should pass `userProfile.onCreateChannel` prop to SendbirdUIKitContainer if want to use message in a user profile');
|
|
22
|
+
WARN_onCreateChannel = true;
|
|
23
|
+
}
|
|
24
|
+
|
|
18
25
|
const {
|
|
19
26
|
bottom,
|
|
20
27
|
left,
|