@sendbird/uikit-react-native 3.1.2 → 3.2.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 +67 -42
- package/lib/commonjs/components/ChannelInput/MessageToReplyPreview.js +145 -0
- package/lib/commonjs/components/ChannelInput/MessageToReplyPreview.js.map +1 -0
- package/lib/commonjs/components/ChannelInput/SendInput.js +147 -312
- package/lib/commonjs/components/ChannelInput/SendInput.js.map +1 -1
- package/lib/commonjs/components/ChannelInput/VoiceMessageInput.js +238 -0
- package/lib/commonjs/components/ChannelInput/VoiceMessageInput.js.map +1 -0
- package/lib/commonjs/components/ChannelInput/index.js +5 -1
- package/lib/commonjs/components/ChannelInput/index.js.map +1 -1
- package/lib/commonjs/components/ChannelMessageList/index.js +1 -1
- package/lib/commonjs/components/ChannelMessageList/index.js.map +1 -1
- package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js +24 -13
- package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js.map +1 -1
- package/lib/commonjs/components/GroupChannelMessageRenderer/index.js +100 -5
- package/lib/commonjs/components/GroupChannelMessageRenderer/index.js.map +1 -1
- package/lib/commonjs/components/MessageSearchResultItem.js +1 -0
- package/lib/commonjs/components/MessageSearchResultItem.js.map +1 -1
- package/lib/commonjs/components/OpenChannelMessageRenderer/index.js +1 -0
- package/lib/commonjs/components/OpenChannelMessageRenderer/index.js.map +1 -1
- package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +2 -2
- package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -1
- package/lib/commonjs/components/ReactionBottomSheets/index.js.map +1 -1
- package/lib/commonjs/components/StatusComposition.js.map +1 -1
- package/lib/commonjs/constants.js +5 -1
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js +1 -0
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/commonjs/containers/InternalErrorBoundaryContainer.js.map +1 -1
- package/lib/commonjs/containers/SendbirdUIKitContainer.js +72 -34
- package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/commonjs/contexts/PlatformServiceCtx.js +16 -12
- package/lib/commonjs/contexts/PlatformServiceCtx.js.map +1 -1
- package/lib/commonjs/contexts/ReactionCtx.js +3 -2
- package/lib/commonjs/contexts/ReactionCtx.js.map +1 -1
- package/lib/commonjs/contexts/SendbirdChatCtx.js +2 -0
- package/lib/commonjs/contexts/SendbirdChatCtx.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +27 -42
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/module/moduleContext.js +109 -5
- 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/userList/types.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelFragment.js +30 -4
- package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/commonjs/fragments/createMessageSearchFragment.js +1 -1
- package/lib/commonjs/fragments/createMessageSearchFragment.js.map +1 -1
- package/lib/commonjs/hooks/useChannelInputItems.js +211 -0
- package/lib/commonjs/hooks/useChannelInputItems.js.map +1 -0
- package/lib/commonjs/hooks/useConnection.js +1 -1
- package/lib/commonjs/hooks/useConnection.js.map +1 -1
- package/lib/commonjs/hooks/useVoiceMessageInput.js +207 -0
- package/lib/commonjs/hooks/useVoiceMessageInput.js.map +1 -0
- package/lib/commonjs/index.js +32 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/libs/MentionManager.js.map +1 -1
- package/lib/commonjs/libs/SBUUtils.js +4 -0
- package/lib/commonjs/libs/SBUUtils.js.map +1 -1
- package/lib/commonjs/libs/VoiceMessageConfig.js +30 -0
- package/lib/commonjs/libs/VoiceMessageConfig.js.map +1 -0
- package/lib/commonjs/localization/StringSet.type.js.map +1 -1
- package/lib/commonjs/localization/createBaseStringSet.js +24 -9
- package/lib/commonjs/localization/createBaseStringSet.js.map +1 -1
- package/lib/commonjs/platform/createFileService.expo.js +10 -0
- package/lib/commonjs/platform/createFileService.expo.js.map +1 -1
- package/lib/commonjs/platform/createFileService.native.js +19 -0
- package/lib/commonjs/platform/createFileService.native.js.map +1 -1
- package/lib/commonjs/platform/createPlayerService.expo.js +137 -0
- package/lib/commonjs/platform/createPlayerService.expo.js.map +1 -0
- package/lib/commonjs/platform/createPlayerService.native.js +139 -0
- package/lib/commonjs/platform/createPlayerService.native.js.map +1 -0
- package/lib/commonjs/platform/createRecorderService.expo.js +158 -0
- package/lib/commonjs/platform/createRecorderService.expo.js.map +1 -0
- package/lib/commonjs/platform/createRecorderService.native.js +157 -0
- package/lib/commonjs/platform/createRecorderService.native.js.map +1 -0
- 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/ChannelInput/MessageToReplyPreview.js +137 -0
- package/lib/module/components/ChannelInput/MessageToReplyPreview.js.map +1 -0
- package/lib/module/components/ChannelInput/SendInput.js +149 -314
- package/lib/module/components/ChannelInput/SendInput.js.map +1 -1
- package/lib/module/components/ChannelInput/VoiceMessageInput.js +228 -0
- package/lib/module/components/ChannelInput/VoiceMessageInput.js.map +1 -0
- package/lib/module/components/ChannelInput/index.js +5 -1
- package/lib/module/components/ChannelInput/index.js.map +1 -1
- package/lib/module/components/ChannelMessageList/index.js +2 -2
- package/lib/module/components/ChannelMessageList/index.js.map +1 -1
- package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js +24 -13
- package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js.map +1 -1
- package/lib/module/components/GroupChannelMessageRenderer/index.js +99 -6
- package/lib/module/components/GroupChannelMessageRenderer/index.js.map +1 -1
- package/lib/module/components/MessageSearchResultItem.js +2 -1
- package/lib/module/components/MessageSearchResultItem.js.map +1 -1
- package/lib/module/components/OpenChannelMessageRenderer/index.js +1 -0
- package/lib/module/components/OpenChannelMessageRenderer/index.js.map +1 -1
- package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +2 -2
- package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -1
- package/lib/module/components/ReactionBottomSheets/index.js.map +1 -1
- package/lib/module/components/StatusComposition.js.map +1 -1
- package/lib/module/constants.js +2 -0
- package/lib/module/constants.js.map +1 -1
- package/lib/module/containers/GroupChannelPreviewContainer.js +2 -1
- package/lib/module/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/module/containers/InternalErrorBoundaryContainer.js.map +1 -1
- package/lib/module/containers/SendbirdUIKitContainer.js +74 -36
- package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/module/contexts/PlatformServiceCtx.js +14 -11
- package/lib/module/contexts/PlatformServiceCtx.js.map +1 -1
- package/lib/module/contexts/ReactionCtx.js +3 -2
- package/lib/module/contexts/ReactionCtx.js.map +1 -1
- package/lib/module/contexts/SendbirdChatCtx.js +2 -0
- package/lib/module/contexts/SendbirdChatCtx.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +28 -43
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/module/domain/groupChannel/module/moduleContext.js +111 -7
- 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/userList/types.js.map +1 -1
- package/lib/module/fragments/createGroupChannelFragment.js +32 -6
- package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/module/fragments/createMessageSearchFragment.js +1 -1
- package/lib/module/fragments/createMessageSearchFragment.js.map +1 -1
- package/lib/module/hooks/useChannelInputItems.js +203 -0
- package/lib/module/hooks/useChannelInputItems.js.map +1 -0
- package/lib/module/hooks/useConnection.js +1 -1
- package/lib/module/hooks/useConnection.js.map +1 -1
- package/lib/module/hooks/useVoiceMessageInput.js +199 -0
- package/lib/module/hooks/useVoiceMessageInput.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/libs/MentionManager.js.map +1 -1
- package/lib/module/libs/SBUUtils.js +4 -0
- package/lib/module/libs/SBUUtils.js.map +1 -1
- package/lib/module/libs/VoiceMessageConfig.js +23 -0
- package/lib/module/libs/VoiceMessageConfig.js.map +1 -0
- package/lib/module/localization/StringSet.type.js.map +1 -1
- package/lib/module/localization/createBaseStringSet.js +25 -10
- package/lib/module/localization/createBaseStringSet.js.map +1 -1
- package/lib/module/platform/createFileService.expo.js +10 -0
- package/lib/module/platform/createFileService.expo.js.map +1 -1
- package/lib/module/platform/createFileService.native.js +19 -0
- package/lib/module/platform/createFileService.native.js.map +1 -1
- package/lib/module/platform/createPlayerService.expo.js +129 -0
- package/lib/module/platform/createPlayerService.expo.js.map +1 -0
- package/lib/module/platform/createPlayerService.native.js +132 -0
- package/lib/module/platform/createPlayerService.native.js.map +1 -0
- package/lib/module/platform/createRecorderService.expo.js +150 -0
- package/lib/module/platform/createRecorderService.expo.js.map +1 -0
- package/lib/module/platform/createRecorderService.native.js +149 -0
- package/lib/module/platform/createRecorderService.native.js.map +1 -0
- 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/src/components/ChannelCover.d.ts +2 -1
- package/lib/typescript/src/components/ChannelInput/AttachmentsButton.d.ts +2 -1
- package/lib/typescript/src/components/ChannelInput/MessageToReplyPreview.d.ts +7 -0
- package/lib/typescript/src/components/ChannelInput/VoiceMessageInput.d.ts +11 -0
- package/lib/typescript/src/components/ChannelInput/index.d.ts +7 -3
- package/lib/typescript/src/components/ChannelMessageList/index.d.ts +1 -1
- package/lib/typescript/src/components/FileViewer.d.ts +2 -1
- package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageDateSeparator.d.ts +2 -1
- package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.d.ts +1 -1
- package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageOutgoingStatus.d.ts +1 -1
- package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.d.ts +4 -2
- package/lib/typescript/src/components/NewMessagesButton.d.ts +1 -1
- package/lib/typescript/src/components/OpenChannelMessageRenderer/OpenChannelMessageDateSeparator.d.ts +2 -1
- package/lib/typescript/src/components/ProviderLayout.d.ts +1 -1
- package/lib/typescript/src/components/ReactionAddons/BottomSheetReactionAddon.d.ts +2 -1
- package/lib/typescript/src/components/ReactionAddons/MessageReactionAddon.d.ts +2 -1
- package/lib/typescript/src/components/ReactionAddons/ReactionRoundedButton.d.ts +3 -2
- package/lib/typescript/src/components/ReactionAddons/index.d.ts +3 -2
- package/lib/typescript/src/components/ReactionBottomSheets/ReactionListBottomSheet.d.ts +2 -1
- package/lib/typescript/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.d.ts +2 -1
- package/lib/typescript/src/components/ReactionBottomSheets/index.d.ts +4 -4
- package/lib/typescript/src/components/ScrollToBottomButton.d.ts +1 -1
- package/lib/typescript/src/components/StatusComposition.d.ts +4 -4
- package/lib/typescript/src/components/TypedPlaceholder.d.ts +2 -1
- package/lib/typescript/src/components/UserActionBar.d.ts +2 -1
- package/lib/typescript/src/components/UserSelectableBar.d.ts +2 -1
- package/lib/typescript/src/constants.d.ts +2 -0
- package/lib/typescript/src/containers/GroupChannelPreviewContainer.d.ts +2 -1
- package/lib/typescript/src/containers/InternalErrorBoundaryContainer.d.ts +3 -3
- package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +19 -8
- package/lib/typescript/src/contexts/LocalizationCtx.d.ts +1 -1
- package/lib/typescript/src/contexts/PlatformServiceCtx.d.ts +8 -8
- package/lib/typescript/src/contexts/ReactionCtx.d.ts +5 -2
- package/lib/typescript/src/contexts/SendbirdChatCtx.d.ts +6 -3
- package/lib/typescript/src/contexts/UserProfileCtx.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelMessageList.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelSuggestedMentionList.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannel/types.d.ts +45 -0
- package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListList.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListTypeSelector.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelModeration/component/GroupChannelModerationHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelModeration/component/GroupChannelModerationMenu.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelNotifications/component/GroupChannelNotificationsView.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsList.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsInfo.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.d.ts +2 -1
- package/lib/typescript/src/domain/messageSearch/component/MessageSearchHeader.d.ts +2 -1
- package/lib/typescript/src/domain/messageSearch/component/MessageSearchList.d.ts +2 -1
- package/lib/typescript/src/domain/messageSearch/component/MessageSearchStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/messageSearch/component/MessageSearchStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/openChannel/component/OpenChannelHeader.d.ts +2 -2
- package/lib/typescript/src/domain/openChannel/component/OpenChannelInput.d.ts +1 -1
- package/lib/typescript/src/domain/openChannel/component/OpenChannelMessageList.d.ts +1 -1
- package/lib/typescript/src/domain/openChannel/component/OpenChannelStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/openChannel/component/OpenChannelStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersHeader.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersList.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelCreate/component/OpenChannelCreateHeader.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelCreate/component/OpenChannelCreateProfileInput.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelCreate/component/OpenChannelCreateStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelList/component/OpenChannelListHeader.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelList/component/OpenChannelListList.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelList/component/OpenChannelListStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelList/component/OpenChannelListStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelModeration/component/OpenChannelModerationHeader.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelModeration/component/OpenChannelModerationMenu.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsHeader.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsList.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsHeader.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsList.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelSettings/component/OpenChannelSettingsHeader.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelSettings/component/OpenChannelSettingsInfo.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelSettings/component/OpenChannelSettingsMenu.d.ts +2 -1
- package/lib/typescript/src/domain/userList/component/UserListHeader.d.ts +3 -3
- package/lib/typescript/src/domain/userList/component/UserListList.d.ts +1 -1
- package/lib/typescript/src/domain/userList/component/UserListStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/userList/component/UserListStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/userList/types.d.ts +2 -2
- package/lib/typescript/src/hooks/useChannelInputItems.d.ts +10 -0
- package/lib/typescript/src/hooks/useVoiceMessageInput.d.ts +53 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/libs/MentionManager.d.ts +2 -1
- package/lib/typescript/src/libs/SBUUtils.d.ts +1 -0
- package/lib/typescript/src/libs/VoiceMessageConfig.d.ts +25 -0
- package/lib/typescript/src/localization/StringSet.type.d.ts +7 -0
- package/lib/typescript/src/platform/createPlayerService.expo.d.ts +7 -0
- package/lib/typescript/src/platform/createPlayerService.native.d.ts +9 -0
- package/lib/typescript/src/platform/createRecorderService.expo.d.ts +7 -0
- package/lib/typescript/src/platform/createRecorderService.native.d.ts +9 -0
- package/lib/typescript/src/platform/types.d.ts +100 -1
- package/lib/typescript/src/types.d.ts +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +9 -11
- package/src/components/ChannelInput/MessageToReplyPreview.tsx +133 -0
- package/src/components/ChannelInput/SendInput.tsx +129 -320
- package/src/components/ChannelInput/VoiceMessageInput.tsx +206 -0
- package/src/components/ChannelInput/index.tsx +12 -4
- package/src/components/ChannelMessageList/index.tsx +3 -1
- package/src/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.tsx +24 -11
- package/src/components/GroupChannelMessageRenderer/index.tsx +80 -3
- package/src/components/MessageSearchResultItem.tsx +2 -1
- package/src/components/OpenChannelMessageRenderer/index.tsx +1 -0
- package/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.tsx +2 -2
- package/src/components/ReactionBottomSheets/index.tsx +3 -2
- package/src/components/StatusComposition.tsx +3 -3
- package/src/constants.ts +2 -0
- package/src/containers/GroupChannelPreviewContainer.tsx +2 -0
- package/src/containers/InternalErrorBoundaryContainer.tsx +1 -1
- package/src/containers/SendbirdUIKitContainer.tsx +103 -59
- package/src/contexts/PlatformServiceCtx.tsx +22 -20
- package/src/contexts/ReactionCtx.tsx +7 -5
- package/src/contexts/SendbirdChatCtx.tsx +10 -2
- package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +29 -43
- package/src/domain/groupChannel/module/moduleContext.tsx +119 -7
- package/src/domain/groupChannel/types.ts +41 -0
- package/src/domain/userList/types.ts +2 -2
- package/src/fragments/createGroupChannelFragment.tsx +32 -5
- package/src/fragments/createMessageSearchFragment.tsx +1 -1
- package/src/hooks/useChannelInputItems.ts +215 -0
- package/src/hooks/useConnection.ts +1 -1
- package/src/hooks/useVoiceMessageInput.ts +237 -0
- package/src/index.ts +4 -0
- package/src/libs/MentionManager.tsx +1 -1
- package/src/libs/SBUUtils.ts +5 -0
- package/src/libs/VoiceMessageConfig.ts +28 -0
- package/src/localization/StringSet.type.ts +8 -0
- package/src/localization/createBaseStringSet.ts +27 -11
- package/src/platform/createFileService.expo.ts +10 -0
- package/src/platform/createFileService.native.ts +19 -0
- package/src/platform/createPlayerService.expo.tsx +142 -0
- package/src/platform/createPlayerService.native.tsx +148 -0
- package/src/platform/createRecorderService.expo.tsx +160 -0
- package/src/platform/createRecorderService.native.tsx +170 -0
- package/src/platform/types.ts +114 -1
- package/src/types.ts +1 -1
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useLayoutEffect","useMemo","useRef","useState","Platform","SafeAreaProvider","Sendbird","DeviceOsPlatform","SendbirdPlatform","SendbirdProduct","GroupChannelModule","OpenChannelModule","DialogProvider","Header","HeaderStyleProvider","LightUIKitTheme","ToastProvider","UIKitThemeProvider","UIKitConfigProvider","NOOP","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","USE_USER_ID_FOR_NICKNAME","IMAGE_COMPRESSION","SendbirdUIKitContainer","_ref","children","appId","chatOptions","uikitOptions","platformServices","localization","styles","errorBoundary","toast","userProfile","userMention","imageCompression","localCacheStorage","Error","defaultStringSet","stringSet","isFirstMount","unsubscribes","internalStorage","sdkInstance","setSdkInstance","sendbird","initializeSendbird","current","chatSDK","emojiManager","mentionManager","config","mentionLimit","MENTION_LIMIT","suggestionLimit","SUGGESTION_LIMIT","debounceMills","DEBOUNCE_MILLS","delimiter","DELIMITER","trigger","TRIGGER","imageCompressionConfig","compressionRate","COMPRESSION_RATE","width","height","forEach","u","renderChildren","disabled","createElement","storage","localConfigs","common","groupChannel","channel","channelList","groupChannelList","setting","groupChannelSettings","openChannel","enableAutoPushTokenRegistration","enableUseUserIdForNickname","enableImageCompression","fileService","file","notificationService","notification","clipboardService","clipboard","mediaService","media","theme","HeaderComponent","defaultTitleAlign","defaultHeaderTitleAlign","statusBarTranslucent","dismissTimeout","onCreateChannel","onBeforeCreateChannel","Consumer","value","STRINGS","defaultLabels","alert","ok","DIALOG","ALERT_DEFAULT_OK","prompt","PROMPT_DEFAULT_OK","cancel","PROMPT_DEFAULT_CANCEL","placeholder","PROMPT_DEFAULT_PLACEHOLDER","options","localCacheEncryption","onInitialized","init","newInstance","modules","localCacheEnabled","Boolean","useAsyncStorageStore","platform","getDeviceOSPlatform","deviceOSInfo","version","String","Version","customData","platform_version","getReactNativeVersion","uikitExtension","product","UIKIT_CHAT","REACT_NATIVE","addSendbirdExtensions","addExtension","addEventListener","_chatSDK$setOnlineLis","_chatSDK","_chatSDK$setOfflineLi","_chatSDK2","listener","callback","callbackType","callCount","unsubscribe","state","online","isConnected","isInternetReachable","push","setOnlineListener","call","onOnline","setOfflineListener","onOffline","ANDROID","IOS","WEB","WINDOWS","undefined","major","minor","patch","constants","reactNativeVersion"],"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, { DeviceOsPlatform, SendbirdPlatform, SendbirdProduct } 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 { SBUConfig, UIKitConfigProvider } from '@sendbird/uikit-tools';\nimport type {\n PartialDeep,\n SendbirdChatSDK,\n SendbirdEncryption,\n SendbirdGroupChannel,\n SendbirdGroupChannelCreateParams,\n SendbirdMember,\n SendbirdUser,\n} from '@sendbird/uikit-utils';\nimport { NOOP, useIsFirstMount } from '@sendbird/uikit-utils';\n\nimport { LocalizationContext, LocalizationProvider } from '../contexts/LocalizationCtx';\nimport { PlatformServiceProvider } from '../contexts/PlatformServiceCtx';\nimport { ReactionProvider } from '../contexts/ReactionCtx';\nimport type { ChatRelatedFeaturesInUIKit } 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');\ntype UnimplementedFeatures = 'enableVoiceMessage' | 'threadReplySelectType' | 'replyType';\nexport const SendbirdUIKit = Object.freeze({\n VERSION,\n PLATFORM: Platform.OS.toLowerCase(),\n DEFAULT: {\n AUTO_PUSH_TOKEN_REGISTRATION: true,\n USE_USER_ID_FOR_NICKNAME: 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 localCacheEncryption?: SendbirdEncryption;\n onInitialized?: (sdkInstance: SendbirdChatSDK) => SendbirdChatSDK;\n } & Partial<ChatRelatedFeaturesInUIKit>;\n uikitOptions?: PartialDeep<{\n common: SBUConfig['common'];\n groupChannel: Omit<SBUConfig['groupChannel']['channel'], UnimplementedFeatures> & {\n replyType: Extract<SBUConfig['groupChannel']['channel']['replyType'], 'none' | 'quote_reply'>;\n };\n groupChannelList: SBUConfig['groupChannel']['channelList'];\n groupChannelSettings: SBUConfig['groupChannel']['setting'];\n openChannel: SBUConfig['openChannel']['channel'];\n }>;\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 disabled?: boolean;\n onError?: (props: ErrorBoundaryProps) => void;\n ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;\n };\n toast?: {\n dismissTimeout?: number;\n };\n userProfile?: {\n onCreateChannel: (channel: SendbirdGroupChannel) => 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 uikitOptions,\n platformServices,\n localization,\n styles,\n errorBoundary,\n toast,\n userProfile,\n userMention,\n imageCompression,\n}: SendbirdUIKitContainerProps) => {\n if (!chatOptions.localCacheStorage) {\n throw new Error('SendbirdUIKitContainer: chatOptions.localCacheStorage is required');\n }\n\n const defaultStringSet = localization?.stringSet ?? StringSetEn;\n\n const isFirstMount = useIsFirstMount();\n const unsubscribes = useRef<Array<() => void>>([]);\n\n const [internalStorage] = useState(() => new InternalLocalCacheStorage(chatOptions.localCacheStorage));\n const [sdkInstance, setSdkInstance] = useState<SendbirdChatSDK>(() => {\n const sendbird = initializeSendbird(appId, { internalStorage, ...chatOptions });\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);\n }, [userMention?.mentionLimit, userMention?.suggestionLimit, userMention?.debounceMills]);\n\n const imageCompressionConfig = useMemo(() => {\n return 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 useLayoutEffect(() => {\n if (!isFirstMount) {\n const sendbird = initializeSendbird(appId, { internalStorage, ...chatOptions });\n setSdkInstance(sendbird.chatSDK);\n unsubscribes.current = sendbird.unsubscribes;\n }\n\n return () => {\n unsubscribes.current.forEach((u) => {\n try {\n u();\n } catch {}\n });\n };\n }, [appId, internalStorage]);\n\n const renderChildren = () => {\n if (errorBoundary?.disabled) {\n return children;\n } else {\n return <InternalErrorBoundaryContainer {...errorBoundary}>{children}</InternalErrorBoundaryContainer>;\n }\n };\n\n return (\n <SafeAreaProvider>\n <UIKitConfigProvider\n storage={internalStorage}\n localConfigs={{\n common: uikitOptions?.common,\n groupChannel: {\n channel: uikitOptions?.groupChannel,\n channelList: uikitOptions?.groupChannelList,\n setting: uikitOptions?.groupChannelSettings,\n },\n openChannel: {\n channel: uikitOptions?.openChannel,\n },\n }}\n >\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 enableUseUserIdForNickname={\n chatOptions.enableUseUserIdForNickname ?? SendbirdUIKit.DEFAULT.USE_USER_ID_FOR_NICKNAME\n }\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 statusBarTranslucent={styles?.statusBarTranslucent ?? true}\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 {renderChildren()}\n </DialogProvider>\n );\n }}\n </LocalizationContext.Consumer>\n </ReactionProvider>\n </UserProfileProvider>\n </ToastProvider>\n </HeaderStyleProvider>\n </UIKitThemeProvider>\n </PlatformServiceProvider>\n </LocalizationProvider>\n </SendbirdChatProvider>\n </UIKitConfigProvider>\n </SafeAreaProvider>\n );\n};\n\nconst initializeSendbird = (\n appId: string,\n options: {\n internalStorage?: InternalLocalCacheStorage;\n onInitialized?: (sdk: SendbirdChatSDK) => SendbirdChatSDK;\n localCacheEncryption?: SendbirdEncryption;\n },\n) => {\n let chatSDK: SendbirdChatSDK;\n const unsubscribes: Array<() => void> = [];\n const { internalStorage, localCacheEncryption, onInitialized } = options;\n\n chatSDK = Sendbird.init({\n appId,\n newInstance: true,\n modules: [new GroupChannelModule(), new OpenChannelModule()],\n localCacheEnabled: Boolean(internalStorage),\n useAsyncStorageStore: internalStorage as never,\n localCacheEncryption,\n });\n\n if (onInitialized) {\n chatSDK = onInitialized(chatSDK);\n }\n\n const platform = getDeviceOSPlatform();\n if (SendbirdUIKit.VERSION && platform) {\n const deviceOSInfo = { platform, version: String(Platform.Version) };\n const customData = { platform_version: getReactNativeVersion() };\n const uikitExtension = {\n product: SendbirdProduct.UIKIT_CHAT,\n version: SendbirdUIKit.VERSION,\n platform: SendbirdPlatform.REACT_NATIVE,\n };\n\n chatSDK.addSendbirdExtensions([uikitExtension], deviceOSInfo, customData);\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 try {\n // NOTE: For removing buggy behavior of NetInfo.addEventListener\n // When you first add an event listener, it is assumed that the initialization of the internal event detector is done simultaneously.\n // In other words, when you call the first event listener two events are triggered immediately\n // - the one that is called when adding the event listener\n // - and the internal initialization event\n NetInfo.addEventListener(NOOP)();\n } catch {}\n\n const listener = (callback: () => void, callbackType: 'online' | 'offline') => {\n let callCount = 0;\n const unsubscribe = NetInfo.addEventListener((state) => {\n const online = Boolean(state.isConnected) || Boolean(state.isInternetReachable);\n\n // NOTE: When NetInfo.addEventListener is called\n // the event is immediately triggered regardless of whether the event actually occurred.\n // This is why it filters the first event.\n if (callCount === 0) {\n callCount++;\n return;\n }\n\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\nfunction getDeviceOSPlatform() {\n switch (Platform.OS) {\n case 'android':\n return DeviceOsPlatform.ANDROID;\n case 'ios':\n return DeviceOsPlatform.IOS;\n case 'web':\n return DeviceOsPlatform.WEB;\n case 'windows':\n return DeviceOsPlatform.WINDOWS;\n default:\n return undefined;\n }\n}\n\nfunction getReactNativeVersion() {\n const { major, minor, patch } = Platform.constants.reactNativeVersion;\n return `${major}.${minor}.${patch}`;\n}\n\nexport default SendbirdUIKitContainer;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,eAAe,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACzE,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,gBAAgB,QAAQ,gCAAgC;AAEjE,OAAOC,QAAQ,IAAIC,gBAAgB,EAAEC,gBAAgB,EAAEC,eAAe,QAAQ,gBAAgB;AAC9F,SAASC,kBAAkB,QAAQ,6BAA6B;AAChE,SAASC,iBAAiB,QAAQ,4BAA4B;AAE9D,SACEC,cAAc,EACdC,MAAM,EACNC,mBAAmB,EACnBC,eAAe,EACfC,aAAa,EACbC,kBAAkB,QACb,yCAAyC;AAChD,SAAoBC,mBAAmB,QAAQ,uBAAuB;AAUtE,SAASC,IAAI,EAAEC,eAAe,QAAQ,uBAAuB;AAE7D,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,6BAA6B;AACvF,SAASC,uBAAuB,QAAQ,gCAAgC;AACxE,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,oBAAoB,QAAQ,6BAA6B;AAClE,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,OAAOC,YAAY,MAAM,sBAAsB;AAE/C,OAAOC,sBAAsB,MAAM,gCAAgC;AACnE,OAAOC,yBAAyB,M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C9B,OAAOA,WAAW;IACpB,CAAC;IACD,CAAAR,qBAAA,IAAAC,QAAA,GAAA7F,OAAO,EAAC0G,iBAAiB,cAAAd,qBAAA,uBAAzBA,qBAAA,CAAAe,IAAA,CAAAd,QAAA,EAA6Be,QAAQ,IAAKZ,QAAQ,CAACY,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACvE,CAAAd,qBAAA,IAAAC,SAAA,GAAA/F,OAAO,EAAC6G,kBAAkB,cAAAf,qBAAA,uBAA1BA,qBAAA,CAAAa,IAAA,CAAAZ,SAAA,EAA8Be,SAAS,IAAKd,QAAQ,CAACc,SAAS,EAAE,SAAS,CAAC,CAAC;EAC7E;EACA,OAAO;IAAE9G,OAAO;IAAEP;EAAa,CAAC;AAClC,CAAC;AAED,SAASoF,mBAAmBA,CAAA,EAAG;EAC7B,QAAQnJ,QAAQ,CAACsC,EAAE;IACjB,KAAK,SAAS;MACZ,OAAOnC,gBAAgB,CAACkL,OAAO;IACjC,KAAK,KAAK;MACR,OAAOlL,gBAAgB,CAACmL,GAAG;IAC7B,KAAK,KAAK;MACR,OAAOnL,gBAAgB,CAACoL,GAAG;IAC7B,KAAK,SAAS;MACZ,OAAOpL,gBAAgB,CAACqL,OAAO;IACjC;MACE,OAAOC,SAAS;EAAC;AAEvB;AAEA,SAAS/B,qBAAqBA,CAAA,EAAG;EAC/B,MAAM;IAAEgC,KAAK;IAAEC,KAAK;IAAEC;EAAM,CAAC,GAAG5L,QAAQ,CAAC6L,SAAS,CAACC,kBAAkB;EACrE,OAAQ,GAAEJ,KAAM,IAAGC,KAAM,IAAGC,KAAM,EAAC;AACrC;AAEA,eAAehJ,sBAAsB"}
|
|
1
|
+
{"version":3,"names":["React","useLayoutEffect","useMemo","useRef","useState","Platform","SafeAreaProvider","SendbirdChat","DeviceOsPlatform","SendbirdPlatform","SendbirdProduct","GroupChannelModule","OpenChannelModule","DialogProvider","Header","HeaderStyleProvider","LightUIKitTheme","ToastProvider","UIKitThemeProvider","UIKitConfigProvider","NOOP","useIsFirstMount","LocalizationContext","LocalizationProvider","PlatformServiceProvider","ReactionProvider","SendbirdChatProvider","UserProfileProvider","EmojiManager","ImageCompressionConfig","InternalLocalCacheStorage","MentionConfig","MentionManager","VoiceMessageConfig","StringSetEn","SBUDynamicModule","VERSION","InternalErrorBoundaryContainer","NetInfo","get","SendbirdUIKit","Object","freeze","PLATFORM","OS","toLowerCase","DEFAULT","AUTO_PUSH_TOKEN_REGISTRATION","USE_USER_ID_FOR_NICKNAME","IMAGE_COMPRESSION","chatOmitKeys","sanitizeChatOptions","chatOptions","opts","forEach","key","SendbirdUIKitContainer","props","children","appId","uikitOptions","platformServices","localization","styles","errorBoundary","toast","userProfile","reaction","localCacheStorage","Error","defaultStringSet","stringSet","isFirstMount","unsubscribes","internalStorage","sdkInstance","setSdkInstance","sendbird","initializeSendbird","current","chatSDK","imageCompressionConfig","voiceMessageConfig","mentionConfig","useConfigInstance","emojiManager","mentionManager","u","renderChildren","disabled","createElement","storage","localConfigs","common","groupChannel","channel","channelList","groupChannelList","setting","groupChannelSettings","openChannel","enableAutoPushTokenRegistration","enableUseUserIdForNickname","enableImageCompression","fileService","file","notificationService","notification","clipboardService","clipboard","mediaService","media","playerService","player","recorderService","recorder","theme","HeaderComponent","defaultTitleAlign","defaultHeaderTitleAlign","statusBarTranslucent","dismissTimeout","_extends","Consumer","value","STRINGS","defaultLabels","alert","ok","DIALOG","ALERT_DEFAULT_OK","prompt","PROMPT_DEFAULT_OK","cancel","PROMPT_DEFAULT_CANCEL","placeholder","PROMPT_DEFAULT_PLACEHOLDER","options","onInitialized","chatInitParams","init","newInstance","modules","localCacheEnabled","useAsyncStorageStore","platform","getDeviceOSPlatform","deviceOSInfo","version","String","Version","customData","platform_version","getReactNativeVersion","uikitExtension","product","UIKIT_CHAT","REACT_NATIVE","addSendbirdExtensions","addExtension","addEventListener","_chatSDK$setOnlineLis","_chatSDK","_chatSDK$setOfflineLi","_chatSDK2","listener","callback","callbackType","callCount","unsubscribe","state","online","Boolean","isConnected","isInternetReachable","push","setOnlineListener","call","onOnline","setOfflineListener","onOffline","ANDROID","IOS","WEB","WINDOWS","undefined","major","minor","patch","constants","reactNativeVersion","_ref","_voiceMessage$recorde3","_voiceMessage$recorde4","imageCompression","userMention","voiceMessage","mentionLimit","MENTION_LIMIT","suggestionLimit","SUGGESTION_LIMIT","debounceMills","DEBOUNCE_MILLS","delimiter","DELIMITER","trigger","TRIGGER","compressionRate","COMPRESSION_RATE","width","height","_voiceMessage$recorde","_voiceMessage$recorde2","minDuration","RECORDER","MIN_DURATION","maxDuration","MAX_DURATION"],"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 SendbirdChat, { DeviceOsPlatform, SendbirdChatParams, SendbirdPlatform, SendbirdProduct } 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 { SBUConfig, UIKitConfigProvider } from '@sendbird/uikit-tools';\nimport type {\n PartialDeep,\n SendbirdChatSDK,\n SendbirdGroupChannel,\n SendbirdGroupChannelCreateParams,\n SendbirdMember,\n SendbirdUser,\n} from '@sendbird/uikit-utils';\nimport { NOOP, useIsFirstMount } from '@sendbird/uikit-utils';\n\nimport { LocalizationContext, LocalizationProvider } from '../contexts/LocalizationCtx';\nimport { PlatformServiceProvider } from '../contexts/PlatformServiceCtx';\nimport { ReactionProvider } from '../contexts/ReactionCtx';\nimport type { ChatRelatedFeaturesInUIKit } 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 VoiceMessageConfig, { VoiceMessageConfigInterface } from '../libs/VoiceMessageConfig';\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 PlayerServiceInterface,\n RecorderServiceInterface,\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');\nexport const SendbirdUIKit = Object.freeze({\n VERSION,\n PLATFORM: Platform.OS.toLowerCase(),\n DEFAULT: {\n AUTO_PUSH_TOKEN_REGISTRATION: true,\n USE_USER_ID_FOR_NICKNAME: false,\n IMAGE_COMPRESSION: true,\n },\n});\n\ntype UnimplementedFeatures = 'threadReplySelectType' | 'replyType';\nexport type ChatOmittedInitParams = Omit<\n SendbirdChatParams<[GroupChannelModule, OpenChannelModule]>,\n (typeof chatOmitKeys)[number]\n>;\n\nconst chatOmitKeys = [\n 'appId',\n 'newInstance',\n 'modules',\n 'debugMode',\n 'appVersion',\n 'localCacheEnabled',\n 'useAsyncStorageStore',\n] as const;\nfunction sanitizeChatOptions<T extends Record<string, unknown>>(chatOptions: T): T {\n const opts = { ...chatOptions };\n chatOmitKeys.forEach((key) => delete opts[key]);\n return opts;\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 player: PlayerServiceInterface;\n recorder: RecorderServiceInterface;\n };\n chatOptions: {\n localCacheStorage: LocalCacheStorage;\n onInitialized?: (sdkInstance: SendbirdChatSDK) => SendbirdChatSDK;\n } & Partial<ChatOmittedInitParams> &\n Partial<ChatRelatedFeaturesInUIKit>;\n uikitOptions?: PartialDeep<{\n common: SBUConfig['common'];\n groupChannel: Omit<SBUConfig['groupChannel']['channel'], UnimplementedFeatures> & {\n replyType: Extract<SBUConfig['groupChannel']['channel']['replyType'], 'none' | 'quote_reply'>;\n };\n groupChannelList: SBUConfig['groupChannel']['channelList'];\n groupChannelSettings: SBUConfig['groupChannel']['setting'];\n openChannel: SBUConfig['openChannel']['channel'];\n }>;\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 disabled?: boolean;\n onError?: (props: ErrorBoundaryProps) => void;\n ErrorInfoComponent?: (props: ErrorBoundaryProps) => React.ReactNode;\n };\n toast?: {\n dismissTimeout?: number;\n };\n userProfile?: {\n onCreateChannel: (channel: SendbirdGroupChannel) => void;\n onBeforeCreateChannel?: (\n channelParams: SendbirdGroupChannelCreateParams,\n users: SendbirdUser[] | SendbirdMember[],\n ) => SendbirdGroupChannelCreateParams | Promise<SendbirdGroupChannelCreateParams>;\n };\n reaction?: {\n onPressUserProfile?: (user: SendbirdUser | SendbirdMember) => void;\n };\n userMention?: Pick<Partial<MentionConfigInterface>, 'mentionLimit' | 'suggestionLimit' | 'debounceMills'>;\n imageCompression?: Partial<ImageCompressionConfigInterface>;\n voiceMessage?: PartialDeep<VoiceMessageConfigInterface>;\n}>;\n\nconst SendbirdUIKitContainer = (props: SendbirdUIKitContainerProps) => {\n const {\n children,\n appId,\n chatOptions,\n uikitOptions,\n platformServices,\n localization,\n styles,\n errorBoundary,\n toast,\n userProfile,\n reaction,\n } = props;\n\n if (!chatOptions.localCacheStorage) {\n throw new Error('SendbirdUIKitContainer: chatOptions.localCacheStorage is required');\n }\n\n const defaultStringSet = localization?.stringSet ?? StringSetEn;\n\n const isFirstMount = useIsFirstMount();\n const unsubscribes = useRef<Array<() => void>>([]);\n\n const [internalStorage] = useState(() => new InternalLocalCacheStorage(chatOptions.localCacheStorage));\n const [sdkInstance, setSdkInstance] = useState<SendbirdChatSDK>(() => {\n const sendbird = initializeSendbird(appId, { internalStorage, ...sanitizeChatOptions(chatOptions) });\n unsubscribes.current = sendbird.unsubscribes;\n return sendbird.chatSDK;\n });\n\n const { imageCompressionConfig, voiceMessageConfig, mentionConfig } = useConfigInstance(props);\n const emojiManager = useMemo(() => new EmojiManager(internalStorage), [internalStorage]);\n const mentionManager = useMemo(() => new MentionManager(mentionConfig), [mentionConfig]);\n\n useLayoutEffect(() => {\n if (!isFirstMount) {\n const sendbird = initializeSendbird(appId, { internalStorage, ...sanitizeChatOptions(chatOptions) });\n setSdkInstance(sendbird.chatSDK);\n unsubscribes.current = sendbird.unsubscribes;\n }\n\n return () => {\n unsubscribes.current.forEach((u) => {\n try {\n u();\n } catch {}\n });\n };\n }, [appId, internalStorage]);\n\n const renderChildren = () => {\n if (errorBoundary?.disabled) {\n return children;\n } else {\n return <InternalErrorBoundaryContainer {...errorBoundary}>{children}</InternalErrorBoundaryContainer>;\n }\n };\n\n return (\n <SafeAreaProvider>\n <UIKitConfigProvider\n storage={internalStorage}\n localConfigs={{\n common: uikitOptions?.common,\n groupChannel: {\n channel: uikitOptions?.groupChannel,\n channelList: uikitOptions?.groupChannelList,\n setting: uikitOptions?.groupChannelSettings,\n },\n openChannel: {\n channel: uikitOptions?.openChannel,\n },\n }}\n >\n <SendbirdChatProvider\n sdkInstance={sdkInstance}\n emojiManager={emojiManager}\n mentionManager={mentionManager}\n imageCompressionConfig={imageCompressionConfig}\n voiceMessageConfig={voiceMessageConfig}\n enableAutoPushTokenRegistration={\n chatOptions.enableAutoPushTokenRegistration ?? SendbirdUIKit.DEFAULT.AUTO_PUSH_TOKEN_REGISTRATION\n }\n enableUseUserIdForNickname={\n chatOptions.enableUseUserIdForNickname ?? SendbirdUIKit.DEFAULT.USE_USER_ID_FOR_NICKNAME\n }\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 playerService={platformServices.player}\n recorderService={platformServices.recorder}\n voiceMessageConfig={voiceMessageConfig}\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 {...userProfile} statusBarTranslucent={styles?.statusBarTranslucent ?? true}>\n <ReactionProvider {...reaction}>\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 {renderChildren()}\n </DialogProvider>\n );\n }}\n </LocalizationContext.Consumer>\n </ReactionProvider>\n </UserProfileProvider>\n </ToastProvider>\n </HeaderStyleProvider>\n </UIKitThemeProvider>\n </PlatformServiceProvider>\n </LocalizationProvider>\n </SendbirdChatProvider>\n </UIKitConfigProvider>\n </SafeAreaProvider>\n );\n};\n\ninterface InitOptions extends ChatOmittedInitParams {\n internalStorage: InternalLocalCacheStorage;\n onInitialized?: (sdk: SendbirdChatSDK) => SendbirdChatSDK;\n}\nconst initializeSendbird = (appId: string, options: InitOptions) => {\n let chatSDK: SendbirdChatSDK;\n const unsubscribes: Array<() => void> = [];\n const { internalStorage, onInitialized, ...chatInitParams } = options;\n\n chatSDK = SendbirdChat.init({\n ...chatInitParams,\n appId,\n newInstance: true,\n modules: [new GroupChannelModule(), new OpenChannelModule()],\n localCacheEnabled: true,\n useAsyncStorageStore: internalStorage as never,\n });\n\n if (onInitialized) {\n chatSDK = onInitialized(chatSDK);\n }\n\n const platform = getDeviceOSPlatform();\n if (SendbirdUIKit.VERSION && platform) {\n const deviceOSInfo = { platform, version: String(Platform.Version) };\n const customData = { platform_version: getReactNativeVersion() };\n const uikitExtension = {\n product: SendbirdProduct.UIKIT_CHAT,\n version: SendbirdUIKit.VERSION,\n platform: SendbirdPlatform.REACT_NATIVE,\n };\n\n chatSDK.addSendbirdExtensions([uikitExtension], deviceOSInfo, customData);\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 try {\n // NOTE: For removing buggy behavior of NetInfo.addEventListener\n // When you first add an event listener, it is assumed that the initialization of the internal event detector is done simultaneously.\n // In other words, when you call the first event listener two events are triggered immediately\n // - the one that is called when adding the event listener\n // - and the internal initialization event\n NetInfo.addEventListener(NOOP)();\n } catch {}\n\n const listener = (callback: () => void, callbackType: 'online' | 'offline') => {\n let callCount = 0;\n const unsubscribe = NetInfo.addEventListener((state) => {\n const online = Boolean(state.isConnected) || Boolean(state.isInternetReachable);\n\n // NOTE: When NetInfo.addEventListener is called\n // the event is immediately triggered regardless of whether the event actually occurred.\n // This is why it filters the first event.\n if (callCount === 0) {\n callCount++;\n return;\n }\n\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\nfunction getDeviceOSPlatform() {\n switch (Platform.OS) {\n case 'android':\n return DeviceOsPlatform.ANDROID;\n case 'ios':\n return DeviceOsPlatform.IOS;\n case 'web':\n return DeviceOsPlatform.WEB;\n case 'windows':\n return DeviceOsPlatform.WINDOWS;\n default:\n return undefined;\n }\n}\n\nfunction getReactNativeVersion() {\n const { major, minor, patch } = Platform.constants.reactNativeVersion;\n return `${major}.${minor}.${patch}`;\n}\n\nconst useConfigInstance = ({ imageCompression, userMention, voiceMessage }: SendbirdUIKitContainerProps) => {\n const mentionConfig = useMemo(() => {\n return 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 }, [userMention?.mentionLimit, userMention?.suggestionLimit, userMention?.debounceMills]);\n\n const imageCompressionConfig = useMemo(() => {\n return 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 const voiceMessageConfig = useMemo(() => {\n return new VoiceMessageConfig({\n recorder: {\n minDuration: voiceMessage?.recorder?.minDuration ?? VoiceMessageConfig.DEFAULT.RECORDER.MIN_DURATION,\n maxDuration: voiceMessage?.recorder?.maxDuration ?? VoiceMessageConfig.DEFAULT.RECORDER.MAX_DURATION,\n },\n });\n }, [voiceMessage?.recorder?.minDuration, voiceMessage?.recorder?.maxDuration]);\n\n return {\n mentionConfig,\n imageCompressionConfig,\n voiceMessageConfig,\n };\n};\n\nexport default SendbirdUIKitContainer;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,eAAe,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACzE,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,gBAAgB,QAAQ,gCAAgC;AAEjE,OAAOC,YAAY,IAAIC,gBAAgB,EAAsBC,gBAAgB,EAAEC,eAAe,QAAQ,gBAAgB;AACtH,SAASC,kBAAkB,QAAQ,6BAA6B;AAChE,SAASC,iBAAiB,QAAQ,4BAA4B;AAE9D,SACEC,cAAc,EACdC,MAAM,EACNC,mBAAmB,EACnBC,eAAe,EACfC,aAAa,EACbC,kBAAkB,QACb,yCAAyC;AAChD,SAAoBC,mBAAmB,QAAQ,uBAAuB;AAStE,SAASC,IAAI,EAAEC,eAAe,QAAQ,uBAAuB;AAE7D,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,6BAA6B;AACvF,SAASC,uBAAuB,QAAQ,gCAAgC;AACxE,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,oBAAoB,QAAQ,6BAA6B;AAClE,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,OAAOC,YAAY,MAAM,sBAAsB;AAE/C,OAAOC,sBAAsB,MAAM,gCAAgC;AACnE,OAAOC,yBAAyB,MAAM,mCAAmC;AACzE,OAAOC,aAAa,MAAkC,uBAAuB;AAC7E,OAAOC,cAAc,MAAM,wBAAwB;AACnD,OAAOC,kBAAkB,MAAuC,4BAA4B;AAC5F,OAAOC,WAAW,MAAM,8BAA8B;AAEtD,OAAOC,gBAAgB,MAAM,2BAA2B;AAUxD,OAAOC,OAAO,MAAM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';
|
|
2
|
+
import { useAppState } from '@sendbird/uikit-utils';
|
|
2
3
|
export const PlatformServiceContext = /*#__PURE__*/React.createContext(null);
|
|
3
4
|
export const PlatformServiceProvider = _ref => {
|
|
4
5
|
let {
|
|
5
6
|
children,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
notificationService,
|
|
9
|
-
mediaService
|
|
7
|
+
voiceMessageConfig,
|
|
8
|
+
...services
|
|
10
9
|
} = _ref;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
services.recorderService.options.minDuration = voiceMessageConfig.recorder.minDuration;
|
|
12
|
+
services.recorderService.options.maxDuration = voiceMessageConfig.recorder.maxDuration;
|
|
13
|
+
}, [voiceMessageConfig]);
|
|
14
|
+
useAppState('change', state => {
|
|
15
|
+
if (state !== 'active') {
|
|
16
|
+
Promise.allSettled([services.playerService.reset(), services.recorderService.reset()]);
|
|
17
17
|
}
|
|
18
|
+
});
|
|
19
|
+
return /*#__PURE__*/React.createElement(PlatformServiceContext.Provider, {
|
|
20
|
+
value: services
|
|
18
21
|
}, children);
|
|
19
22
|
};
|
|
20
23
|
//# sourceMappingURL=PlatformServiceCtx.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","PlatformServiceContext","createContext","PlatformServiceProvider","_ref","children","
|
|
1
|
+
{"version":3,"names":["React","useEffect","useAppState","PlatformServiceContext","createContext","PlatformServiceProvider","_ref","children","voiceMessageConfig","services","recorderService","options","minDuration","recorder","maxDuration","state","Promise","allSettled","playerService","reset","createElement","Provider","value"],"sources":["PlatformServiceCtx.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\n\nimport { useAppState } from '@sendbird/uikit-utils';\n\nimport VoiceMessageConfig from '../libs/VoiceMessageConfig';\nimport type {\n ClipboardServiceInterface,\n FileServiceInterface,\n MediaServiceInterface,\n NotificationServiceInterface,\n PlayerServiceInterface,\n RecorderServiceInterface,\n} from '../platform/types';\n\nexport type PlatformServiceContextType = {\n fileService: FileServiceInterface;\n clipboardService: ClipboardServiceInterface;\n notificationService: NotificationServiceInterface;\n mediaService: MediaServiceInterface;\n recorderService: RecorderServiceInterface;\n playerService: PlayerServiceInterface;\n};\ntype Props = React.PropsWithChildren<PlatformServiceContextType & { voiceMessageConfig: VoiceMessageConfig }>;\n\nexport const PlatformServiceContext = React.createContext<PlatformServiceContextType | null>(null);\nexport const PlatformServiceProvider = ({ children, voiceMessageConfig, ...services }: Props) => {\n useEffect(() => {\n services.recorderService.options.minDuration = voiceMessageConfig.recorder.minDuration;\n services.recorderService.options.maxDuration = voiceMessageConfig.recorder.maxDuration;\n }, [voiceMessageConfig]);\n\n useAppState('change', (state) => {\n if (state !== 'active') {\n Promise.allSettled([services.playerService.reset(), services.recorderService.reset()]);\n }\n });\n\n return <PlatformServiceContext.Provider value={services}>{children}</PlatformServiceContext.Provider>;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AAExC,SAASC,WAAW,QAAQ,uBAAuB;AAsBnD,OAAO,MAAMC,sBAAsB,gBAAGH,KAAK,CAACI,aAAa,CAAoC,IAAI,CAAC;AAClG,OAAO,MAAMC,uBAAuB,GAAGC,IAAA,IAA0D;EAAA,IAAzD;IAAEC,QAAQ;IAAEC,kBAAkB;IAAE,GAAGC;EAAgB,CAAC,GAAAH,IAAA;EAC1FL,SAAS,CAAC,MAAM;IACdQ,QAAQ,CAACC,eAAe,CAACC,OAAO,CAACC,WAAW,GAAGJ,kBAAkB,CAACK,QAAQ,CAACD,WAAW;IACtFH,QAAQ,CAACC,eAAe,CAACC,OAAO,CAACG,WAAW,GAAGN,kBAAkB,CAACK,QAAQ,CAACC,WAAW;EACxF,CAAC,EAAE,CAACN,kBAAkB,CAAC,CAAC;EAExBN,WAAW,CAAC,QAAQ,EAAGa,KAAK,IAAK;IAC/B,IAAIA,KAAK,KAAK,QAAQ,EAAE;MACtBC,OAAO,CAACC,UAAU,CAAC,CAACR,QAAQ,CAACS,aAAa,CAACC,KAAK,EAAE,EAAEV,QAAQ,CAACC,eAAe,CAACS,KAAK,EAAE,CAAC,CAAC;IACxF;EACF,CAAC,CAAC;EAEF,oBAAOnB,KAAA,CAAAoB,aAAA,CAACjB,sBAAsB,CAACkB,QAAQ;IAACC,KAAK,EAAEb;EAAS,GAAEF,QAAQ,CAAmC;AACvG,CAAC"}
|
|
@@ -8,7 +8,8 @@ import { UserProfileContext } from '../contexts/UserProfileCtx';
|
|
|
8
8
|
export const ReactionContext = /*#__PURE__*/React.createContext(null);
|
|
9
9
|
export const ReactionProvider = _ref => {
|
|
10
10
|
let {
|
|
11
|
-
children
|
|
11
|
+
children,
|
|
12
|
+
onPressUserProfile
|
|
12
13
|
} = _ref;
|
|
13
14
|
const chatCtx = useContext(SendbirdChatContext);
|
|
14
15
|
const localizationCtx = useContext(LocalizationContext);
|
|
@@ -63,7 +64,7 @@ export const ReactionProvider = _ref => {
|
|
|
63
64
|
chatCtx,
|
|
64
65
|
reactionCtx,
|
|
65
66
|
localizationCtx,
|
|
66
|
-
userProfileCtx,
|
|
67
|
+
onPressUserProfile: onPressUserProfile ?? userProfileCtx.show,
|
|
67
68
|
onDismiss: () => {
|
|
68
69
|
var _closeResolver$curren;
|
|
69
70
|
setState({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useContext","useReducer","useRef","useState","NOOP","ReactionBottomSheets","LocalizationContext","SendbirdChatContext","UserProfileContext","ReactionContext","createContext","ReactionProvider","_ref","children","chatCtx","localizationCtx","userProfileCtx","Error","state","setState","prev","next","reactionListVisible","setReactionListVisible","reactionUserListVisible","setReactionUserListVisible","reactionUserListFocusIndex","setReactionUserListFocusIndex","closeResolver","openReactionList","params","openReactionUserList","_ref2","channel","message","focusIndex","updateReactionFocusedItem","createOnCloseWithResolver","callback","Promise","resolve","current","reactionCtx","sheetProps","onDismiss","_closeResolver$curren","call","createElement","Provider","value","UserList","_extends","visible","onClose","ReactionList"],"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,KAAK,IAAIC,WAAW,EAAEC,UAAU,EAAEC,UAAU,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAGpF,SAASC,IAAI,QAAQ,uBAAuB;AAE5C,
|
|
1
|
+
{"version":3,"names":["React","useCallback","useContext","useReducer","useRef","useState","NOOP","ReactionBottomSheets","LocalizationContext","SendbirdChatContext","UserProfileContext","ReactionContext","createContext","ReactionProvider","_ref","children","onPressUserProfile","chatCtx","localizationCtx","userProfileCtx","Error","state","setState","prev","next","reactionListVisible","setReactionListVisible","reactionUserListVisible","setReactionUserListVisible","reactionUserListFocusIndex","setReactionUserListFocusIndex","closeResolver","openReactionList","params","openReactionUserList","_ref2","channel","message","focusIndex","updateReactionFocusedItem","createOnCloseWithResolver","callback","Promise","resolve","current","reactionCtx","sheetProps","show","onDismiss","_closeResolver$curren","call","createElement","Provider","value","UserList","_extends","visible","onClose","ReactionList"],"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 { ReactionBottomSheetProps, 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 onPressUserProfile?: ReactionBottomSheetProps['onPressUserProfile'];\n}>;\n\nexport const ReactionContext = React.createContext<ReactionContextType | null>(null);\nexport const ReactionProvider = ({ children, onPressUserProfile }: 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: Omit<ReactionBottomSheetProps, 'visible' | 'onClose'> = {\n chatCtx,\n reactionCtx,\n localizationCtx,\n onPressUserProfile: onPressUserProfile ?? userProfileCtx.show,\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,KAAK,IAAIC,WAAW,EAAEC,UAAU,EAAEC,UAAU,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAGpF,SAASC,IAAI,QAAQ,uBAAuB;AAE5C,SAAmCC,oBAAoB,QAAQ,oCAAoC;AACnG,SAASC,mBAAmB,QAAQ,6BAA6B;AACjE,SAASC,mBAAmB,QAAQ,6BAA6B;AACjE,SAASC,kBAAkB,QAAQ,4BAA4B;AAiB/D,OAAO,MAAMC,eAAe,gBAAGX,KAAK,CAACY,aAAa,CAA6B,IAAI,CAAC;AACpF,OAAO,MAAMC,gBAAgB,GAAGC,IAAA,IAA6C;EAAA,IAA5C;IAAEC,QAAQ;IAAEC;EAA0B,CAAC,GAAAF,IAAA;EACtE,MAAMG,OAAO,GAAGf,UAAU,CAACO,mBAAmB,CAAC;EAC/C,MAAMS,eAAe,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AAA,KAC5BT,UAAU;IACdU,OAAO,EAAE/B,mBAAoB;IAC7BgC,OAAO,EAAEjB,yBAAyB,CAAC,MAAMd,sBAAsB,CAAC,KAAK,CAAC;EAAE,GACxE,CACuB;AAE/B,CAAC"}
|
|
@@ -10,6 +10,7 @@ export const SendbirdChatProvider = _ref => {
|
|
|
10
10
|
emojiManager,
|
|
11
11
|
mentionManager,
|
|
12
12
|
imageCompressionConfig,
|
|
13
|
+
voiceMessageConfig,
|
|
13
14
|
enableAutoPushTokenRegistration,
|
|
14
15
|
enableUseUserIdForNickname,
|
|
15
16
|
enableImageCompression
|
|
@@ -65,6 +66,7 @@ export const SendbirdChatProvider = _ref => {
|
|
|
65
66
|
emojiManager,
|
|
66
67
|
mentionManager,
|
|
67
68
|
imageCompressionConfig,
|
|
69
|
+
voiceMessageConfig,
|
|
68
70
|
currentUser,
|
|
69
71
|
setCurrentUser,
|
|
70
72
|
updateCurrentUserInfo,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useState","useAppFeatures","useUIKitConfig","confirmAndMarkAsDelivered","useAppState","useForceUpdate","SendbirdChatContext","createContext","SendbirdChatProvider","_ref","children","sdkInstance","emojiManager","mentionManager","imageCompressionConfig","enableAutoPushTokenRegistration","enableUseUserIdForNickname","enableImageCompression","currentUser","_setCurrentUser","forceUpdate","appFeatures","configs","configsWithAppAttr","setCurrentUser","user","updateCurrentUserInfo","nickname","profile","Error","params","profileUrl","profileImage","markAsDeliveredWithChannel","channel","deliveryReceiptEnabled","status","connectionState","setForegroundState","setBackgroundState","disconnect","then","undefined","value","sdk","sbOptions","appInfo","uikit","uikitWithAppInfo","chat","autoPushTokenRegistrationEnabled","useUserIdForNicknameEnabled","imageCompressionEnabled","createElement","Provider"],"sources":["SendbirdChatCtx.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from 'react';\n\nimport { useAppFeatures } from '@sendbird/uikit-chat-hooks';\nimport { SBUConfig, useUIKitConfig } from '@sendbird/uikit-tools';\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 ChatRelatedFeaturesInUIKit {\n enableAutoPushTokenRegistration: boolean;\n enableUseUserIdForNickname: boolean;\n enableImageCompression: boolean;\n}\n\ninterface Props extends ChatRelatedFeaturesInUIKit, React.PropsWithChildren {\n sdkInstance: SendbirdChatSDK;\n emojiManager: EmojiManager;\n mentionManager: MentionManager;\n imageCompressionConfig: ImageCompressionConfig;\n}\n\nexport type SendbirdChatContextType = {\n sdk: SendbirdChatSDK;\n
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useState","useAppFeatures","useUIKitConfig","confirmAndMarkAsDelivered","useAppState","useForceUpdate","SendbirdChatContext","createContext","SendbirdChatProvider","_ref","children","sdkInstance","emojiManager","mentionManager","imageCompressionConfig","voiceMessageConfig","enableAutoPushTokenRegistration","enableUseUserIdForNickname","enableImageCompression","currentUser","_setCurrentUser","forceUpdate","appFeatures","configs","configsWithAppAttr","setCurrentUser","user","updateCurrentUserInfo","nickname","profile","Error","params","profileUrl","profileImage","markAsDeliveredWithChannel","channel","deliveryReceiptEnabled","status","connectionState","setForegroundState","setBackgroundState","disconnect","then","undefined","value","sdk","sbOptions","appInfo","uikit","uikitWithAppInfo","chat","autoPushTokenRegistrationEnabled","useUserIdForNicknameEnabled","imageCompressionEnabled","createElement","Provider"],"sources":["SendbirdChatCtx.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from 'react';\n\nimport { useAppFeatures } from '@sendbird/uikit-chat-hooks';\nimport { SBUConfig, useUIKitConfig } from '@sendbird/uikit-tools';\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 VoiceMessageConfig from '../libs/VoiceMessageConfig';\nimport type { FileType } from '../platform/types';\n\nexport interface ChatRelatedFeaturesInUIKit {\n enableAutoPushTokenRegistration: boolean;\n enableUseUserIdForNickname: boolean;\n enableImageCompression: boolean;\n}\n\ninterface Props extends ChatRelatedFeaturesInUIKit, React.PropsWithChildren {\n sdkInstance: SendbirdChatSDK;\n\n emojiManager: EmojiManager;\n mentionManager: MentionManager;\n imageCompressionConfig: ImageCompressionConfig;\n voiceMessageConfig: VoiceMessageConfig;\n}\n\nexport type SendbirdChatContextType = {\n sdk: SendbirdChatSDK;\n currentUser?: SendbirdUser;\n setCurrentUser: React.Dispatch<React.SetStateAction<SendbirdUser | undefined>>;\n\n // feature related instances\n emojiManager: EmojiManager;\n mentionManager: MentionManager;\n imageCompressionConfig: ImageCompressionConfig;\n voiceMessageConfig: VoiceMessageConfig;\n\n // helper functions\n updateCurrentUserInfo: (nickname?: string, profile?: string | FileType) => Promise<SendbirdUser>;\n markAsDeliveredWithChannel: (channel: SendbirdGroupChannel) => void;\n\n sbOptions: {\n // UIKit options\n uikit: SBUConfig;\n uikitWithAppInfo: {\n groupChannel: {\n channel: {\n enableReactions: boolean;\n enableOgtag: boolean;\n };\n setting: {\n enableMessageSearch: boolean;\n };\n };\n openChannel: {\n channel: {\n enableOgtag: boolean;\n };\n };\n };\n\n // Chat related options in UIKit\n chat: {\n imageCompressionEnabled: boolean;\n useUserIdForNicknameEnabled: boolean;\n autoPushTokenRegistrationEnabled: boolean; // RN only\n };\n\n // Sendbird application options\n appInfo: {\n deliveryReceiptEnabled: boolean;\n broadcastChannelEnabled: boolean;\n superGroupChannelEnabled: boolean;\n reactionEnabled: boolean;\n };\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 voiceMessageConfig,\n enableAutoPushTokenRegistration,\n enableUseUserIdForNickname,\n enableImageCompression,\n}: Props) => {\n const [currentUser, _setCurrentUser] = useState<SendbirdUser>();\n const forceUpdate = useForceUpdate();\n const appFeatures = useAppFeatures(sdkInstance);\n const { configs, configsWithAppAttr } = useUIKitConfig();\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 useEffect(() => {\n return () => {\n sdkInstance.disconnect().then(() => _setCurrentUser(undefined));\n };\n }, [sdkInstance]);\n\n const value: SendbirdChatContextType = {\n sdk: sdkInstance,\n emojiManager,\n mentionManager,\n imageCompressionConfig,\n voiceMessageConfig,\n currentUser,\n setCurrentUser,\n\n updateCurrentUserInfo,\n markAsDeliveredWithChannel,\n\n // TODO: Options should be moved to the common area at the higher level to be passed to the context of each product.\n // For example, common -> chat context, common -> calls context\n sbOptions: {\n appInfo: appFeatures,\n uikit: configs,\n uikitWithAppInfo: configsWithAppAttr(sdkInstance),\n chat: {\n autoPushTokenRegistrationEnabled: enableAutoPushTokenRegistration,\n useUserIdForNicknameEnabled: enableUseUserIdForNickname,\n imageCompressionEnabled: enableImageCompression,\n },\n },\n };\n\n return <SendbirdChatContext.Provider value={value}>{children}</SendbirdChatContext.Provider>;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE/D,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAAoBC,cAAc,QAAQ,uBAAuB;AAOjE,SAASC,yBAAyB,EAAEC,WAAW,EAAEC,cAAc,QAAQ,uBAAuB;AA2E9F,OAAO,MAAMC,mBAAmB,gBAAGT,KAAK,CAACU,aAAa,CAAiC,IAAI,CAAC;AAC5F,OAAO,MAAMC,oBAAoB,GAAGC,IAAA,IAUvB;EAAA,IAVwB;IACnCC,QAAQ;IACRC,WAAW;IACXC,YAAY;IACZC,cAAc;IACdC,sBAAsB;IACtBC,kBAAkB;IAClBC,+BAA+B;IAC/BC,0BAA0B;IAC1BC;EACK,CAAC,GAAAT,IAAA;EACN,MAAM,CAACU,WAAW,EAAEC,eAAe,CAAC,GAAGpB,QAAQ,EAAgB;EAC/D,MAAMqB,WAAW,GAAGhB,cAAc,EA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@@
|
|
|
1
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
|
-
import React, { useContext, useEffect
|
|
2
|
+
import React, { useContext, useEffect } from 'react';
|
|
3
3
|
import { useChannelHandler } from '@sendbird/uikit-chat-hooks';
|
|
4
4
|
import { useToast } from '@sendbird/uikit-react-native-foundation';
|
|
5
5
|
import { isDifferentChannel, useFreshCallback, useIsFirstMount, useUniqHandlerId } from '@sendbird/uikit-utils';
|
|
@@ -22,39 +22,14 @@ const GroupChannelMessageList = props => {
|
|
|
22
22
|
const {
|
|
23
23
|
subscribe
|
|
24
24
|
} = useContext(GroupChannelContexts.PubSub);
|
|
25
|
+
const {
|
|
26
|
+
flatListRef,
|
|
27
|
+
lazyScrollToBottom,
|
|
28
|
+
lazyScrollToIndex
|
|
29
|
+
} = useContext(GroupChannelContexts.MessageList);
|
|
25
30
|
const id = useUniqHandlerId('GroupChannelMessageList');
|
|
26
|
-
const ref = useRef(null);
|
|
27
31
|
const isFirstMount = useIsFirstMount();
|
|
28
|
-
|
|
29
|
-
// FIXME: Workaround, should run after data has been applied to UI.
|
|
30
|
-
const lazyScrollToBottom = function () {
|
|
31
|
-
let animated = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
32
|
-
let timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
33
|
-
setTimeout(() => {
|
|
34
|
-
var _ref$current;
|
|
35
|
-
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.scrollToOffset({
|
|
36
|
-
offset: 0,
|
|
37
|
-
animated
|
|
38
|
-
});
|
|
39
|
-
}, timeout);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// FIXME: Workaround, should run after data has been applied to UI.
|
|
43
|
-
const lazyScrollToIndex = function () {
|
|
44
|
-
let index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
45
|
-
let animated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
46
|
-
let timeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
47
|
-
setTimeout(() => {
|
|
48
|
-
var _ref$current2;
|
|
49
|
-
(_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.scrollToIndex({
|
|
50
|
-
index,
|
|
51
|
-
animated,
|
|
52
|
-
viewPosition: 0.5
|
|
53
|
-
});
|
|
54
|
-
}, timeout);
|
|
55
|
-
};
|
|
56
|
-
const scrollToMessage = useFreshCallback(function (createdAt) {
|
|
57
|
-
let focusAnimated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
32
|
+
const scrollToMessageWithCreatedAt = useFreshCallback((createdAt, focusAnimated, timeout) => {
|
|
58
33
|
const foundMessageIndex = props.messages.findIndex(it => it.createdAt === createdAt);
|
|
59
34
|
const isIncludedInList = foundMessageIndex > -1;
|
|
60
35
|
if (isIncludedInList) {
|
|
@@ -63,7 +38,11 @@ const GroupChannelMessageList = props => {
|
|
|
63
38
|
startingPoint: createdAt
|
|
64
39
|
}), MESSAGE_FOCUS_ANIMATION_DELAY);
|
|
65
40
|
}
|
|
66
|
-
lazyScrollToIndex(
|
|
41
|
+
lazyScrollToIndex({
|
|
42
|
+
index: foundMessageIndex,
|
|
43
|
+
animated: true,
|
|
44
|
+
timeout
|
|
45
|
+
});
|
|
67
46
|
} else {
|
|
68
47
|
if (props.channel.messageOffsetTimestamp <= createdAt) {
|
|
69
48
|
if (focusAnimated) props.onUpdateSearchItem({
|
|
@@ -83,10 +62,14 @@ const GroupChannelMessageList = props => {
|
|
|
83
62
|
props.onScrolledAwayFromBottom(false);
|
|
84
63
|
props.onResetMessageList(() => {
|
|
85
64
|
props.onScrolledAwayFromBottom(false);
|
|
86
|
-
lazyScrollToBottom(
|
|
65
|
+
lazyScrollToBottom({
|
|
66
|
+
animated
|
|
67
|
+
});
|
|
87
68
|
});
|
|
88
69
|
} else {
|
|
89
|
-
lazyScrollToBottom(
|
|
70
|
+
lazyScrollToBottom({
|
|
71
|
+
animated
|
|
72
|
+
});
|
|
90
73
|
}
|
|
91
74
|
});
|
|
92
75
|
useChannelHandler(sdk, id, {
|
|
@@ -96,7 +79,10 @@ const GroupChannelMessageList = props => {
|
|
|
96
79
|
const isRecentMessage = recentMessage && recentMessage.messageId === event.messageId;
|
|
97
80
|
const scrollReachedBottomAndCanScroll = !props.scrolledAwayFromBottom && !props.hasNext();
|
|
98
81
|
if (isRecentMessage && scrollReachedBottomAndCanScroll) {
|
|
99
|
-
lazyScrollToBottom(
|
|
82
|
+
lazyScrollToBottom({
|
|
83
|
+
animated: true,
|
|
84
|
+
timeout: 250
|
|
85
|
+
});
|
|
100
86
|
}
|
|
101
87
|
}
|
|
102
88
|
});
|
|
@@ -122,21 +108,20 @@ const GroupChannelMessageList = props => {
|
|
|
122
108
|
}
|
|
123
109
|
});
|
|
124
110
|
}, [props.scrolledAwayFromBottom]);
|
|
125
|
-
|
|
126
|
-
// Only trigger once when message list mount with initial props.searchItem
|
|
127
|
-
// - Search screen + searchItem > mount message list
|
|
128
|
-
// - Reset message list + searchItem > re-mount message list
|
|
129
111
|
useEffect(() => {
|
|
112
|
+
// Only trigger once when message list mount with initial props.searchItem
|
|
113
|
+
// - Search screen + searchItem > mount message list
|
|
114
|
+
// - Reset message list + searchItem > re-mount message list
|
|
130
115
|
if (isFirstMount && props.searchItem) {
|
|
131
|
-
|
|
116
|
+
scrollToMessageWithCreatedAt(props.searchItem.startingPoint, false, MESSAGE_SEARCH_SAFE_SCROLL_DELAY);
|
|
132
117
|
}
|
|
133
118
|
}, [isFirstMount]);
|
|
134
119
|
const onPressParentMessage = useFreshCallback(message => {
|
|
135
|
-
const canScrollToParent =
|
|
120
|
+
const canScrollToParent = scrollToMessageWithCreatedAt(message.createdAt, true, 0);
|
|
136
121
|
if (!canScrollToParent) toast.show(STRINGS.TOAST.FIND_PARENT_MSG_ERROR, 'error');
|
|
137
122
|
});
|
|
138
123
|
return /*#__PURE__*/React.createElement(ChannelMessageList, _extends({}, props, {
|
|
139
|
-
ref:
|
|
124
|
+
ref: flatListRef,
|
|
140
125
|
onReplyMessage: setMessageToReply,
|
|
141
126
|
onEditMessage: setMessageToEdit,
|
|
142
127
|
onPressParentMessage: onPressParentMessage,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useContext","useEffect","useRef","useChannelHandler","useToast","isDifferentChannel","useFreshCallback","useIsFirstMount","useUniqHandlerId","ChannelMessageList","MESSAGE_FOCUS_ANIMATION_DELAY","MESSAGE_SEARCH_SAFE_SCROLL_DELAY","useLocalization","useSendbirdChat","GroupChannelContexts","GroupChannelMessageList","props","toast","STRINGS","sdk","setMessageToEdit","setMessageToReply","Fragment","subscribe","PubSub","id","ref","isFirstMount","lazyScrollToBottom","animated","arguments","length","undefined","timeout","setTimeout","_ref$current","current","scrollToOffset","offset","lazyScrollToIndex","index","_ref$current2","scrollToIndex","viewPosition","scrollToMessage","createdAt","focusAnimated","foundMessageIndex","messages","findIndex","it","isIncludedInList","onUpdateSearchItem","startingPoint","channel","messageOffsetTimestamp","onResetMessageListWithStartingPoint","scrollToBottom","hasNext","onScrolledAwayFromBottom","onResetMessageList","onReactionUpdated","event","recentMessage","isRecentMessage","messageId","scrollReachedBottomAndCanScroll","scrolledAwayFromBottom","_ref","type","searchItem","onPressParentMessage","message","canScrollToParent","show","TOAST","FIND_PARENT_MSG_ERROR","createElement","_extends","onReplyMessage","onEditMessage","onPressNewMessagesButton","onPressScrollToBottomButton","memo"],"sources":["GroupChannelMessageList.tsx"],"sourcesContent":["import React, { useContext, useEffect, useRef } from 'react';\nimport type { FlatList } from 'react-native';\n\nimport { useChannelHandler } from '@sendbird/uikit-chat-hooks';\nimport { useToast } from '@sendbird/uikit-react-native-foundation';\nimport type { SendbirdMessage } from '@sendbird/uikit-utils';\nimport { isDifferentChannel, useFreshCallback, useIsFirstMount, useUniqHandlerId } from '@sendbird/uikit-utils';\n\nimport ChannelMessageList from '../../../components/ChannelMessageList';\nimport { MESSAGE_FOCUS_ANIMATION_DELAY, MESSAGE_SEARCH_SAFE_SCROLL_DELAY } from '../../../constants';\nimport { useLocalization, useSendbirdChat } from '../../../hooks/useContext';\nimport { GroupChannelContexts } from '../module/moduleContext';\nimport type { GroupChannelProps } from '../types';\n\nconst GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {\n const toast = useToast();\n const { STRINGS } = useLocalization();\n const { sdk } = useSendbirdChat();\n const { setMessageToEdit, setMessageToReply } = useContext(GroupChannelContexts.Fragment);\n const { subscribe } = useContext(GroupChannelContexts.PubSub);\n\n const id = useUniqHandlerId('GroupChannelMessageList');\n const ref = useRef<FlatList<SendbirdMessage>>(null);\n const isFirstMount = useIsFirstMount();\n\n // FIXME: Workaround, should run after data has been applied to UI.\n const lazyScrollToBottom = (animated = false, timeout = 0) => {\n setTimeout(() => {\n ref.current?.scrollToOffset({ offset: 0, animated });\n }, timeout);\n };\n\n // FIXME: Workaround, should run after data has been applied to UI.\n const lazyScrollToIndex = (index = 0, animated = false, timeout = 0) => {\n setTimeout(() => {\n ref.current?.scrollToIndex({ index, animated, viewPosition: 0.5 });\n }, timeout);\n };\n\n const scrollToMessage = useFreshCallback((createdAt: number, focusAnimated = false): boolean => {\n const foundMessageIndex = props.messages.findIndex((it) => it.createdAt === createdAt);\n const isIncludedInList = foundMessageIndex > -1;\n\n if (isIncludedInList) {\n if (focusAnimated) {\n setTimeout(() => props.onUpdateSearchItem({ startingPoint: createdAt }), MESSAGE_FOCUS_ANIMATION_DELAY);\n }\n lazyScrollToIndex(foundMessageIndex, true, isFirstMount ? MESSAGE_SEARCH_SAFE_SCROLL_DELAY : 0);\n } else {\n if (props.channel.messageOffsetTimestamp <= createdAt) {\n if (focusAnimated) props.onUpdateSearchItem({ startingPoint: createdAt });\n props.onResetMessageListWithStartingPoint(createdAt);\n } else {\n return false;\n }\n }\n\n return true;\n });\n\n const scrollToBottom = useFreshCallback((animated = false) => {\n if (props.hasNext()) {\n props.onUpdateSearchItem(undefined);\n props.onScrolledAwayFromBottom(false);\n\n props.onResetMessageList(() => {\n props.onScrolledAwayFromBottom(false);\n lazyScrollToBottom(animated);\n });\n } else {\n lazyScrollToBottom(animated);\n }\n });\n\n useChannelHandler(sdk, id, {\n onReactionUpdated(channel, event) {\n if (isDifferentChannel(channel, props.channel)) return;\n const recentMessage = props.messages[0];\n const isRecentMessage = recentMessage && recentMessage.messageId === event.messageId;\n const scrollReachedBottomAndCanScroll = !props.scrolledAwayFromBottom && !props.hasNext();\n if (isRecentMessage && scrollReachedBottomAndCanScroll) {\n lazyScrollToBottom(true, 250);\n }\n },\n });\n\n useEffect(() => {\n return subscribe(({ type }) => {\n switch (type) {\n case 'MESSAGES_RECEIVED': {\n if (!props.scrolledAwayFromBottom) {\n scrollToBottom(true);\n }\n break;\n }\n case 'MESSAGE_SENT_SUCCESS':\n case 'MESSAGE_SENT_PENDING': {\n scrollToBottom(false);\n break;\n }\n }\n });\n }, [props.scrolledAwayFromBottom]);\n\n // Only trigger once when message list mount with initial props.searchItem\n // - Search screen + searchItem > mount message list\n // - Reset message list + searchItem > re-mount message list\n useEffect(() => {\n if (isFirstMount && props.searchItem) {\n scrollToMessage(props.searchItem.startingPoint);\n }\n }, [isFirstMount]);\n\n const onPressParentMessage = useFreshCallback((message: SendbirdMessage) => {\n const canScrollToParent = scrollToMessage(message.createdAt, true);\n if (!canScrollToParent) toast.show(STRINGS.TOAST.FIND_PARENT_MSG_ERROR, 'error');\n });\n\n return (\n <ChannelMessageList\n {...props}\n ref={ref}\n onReplyMessage={setMessageToReply}\n onEditMessage={setMessageToEdit}\n onPressParentMessage={onPressParentMessage}\n onPressNewMessagesButton={scrollToBottom}\n onPressScrollToBottomButton={scrollToBottom}\n />\n );\n};\n\nexport default React.memo(GroupChannelMessage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QAAA,KACb9D,KAAK;IACTU,GAAG,EAAEA,GAAI;IACTqD,cAAc,EAAE1D,iBAAkB;IAClC2D,aAAa,EAAE5D,gBAAiB;IAChCmD,oBAAoB,EAAEA,oBAAqB;IAC3CU,wBAAwB,EAAExB,cAAe;IACzCyB,2BAA2B,EAAEzB;EAAe,GAC5C;AAEN,CAAC;AAED,4BAAe1D,KAAK,CAACoF,IAAI,CAACpE,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"names":["React","useContext","useEffect","useChannelHandler","useToast","isDifferentChannel","useFreshCallback","useIsFirstMount","useUniqHandlerId","ChannelMessageList","MESSAGE_FOCUS_ANIMATION_DELAY","MESSAGE_SEARCH_SAFE_SCROLL_DELAY","useLocalization","useSendbirdChat","GroupChannelContexts","GroupChannelMessageList","props","toast","STRINGS","sdk","setMessageToEdit","setMessageToReply","Fragment","subscribe","PubSub","flatListRef","lazyScrollToBottom","lazyScrollToIndex","MessageList","id","isFirstMount","scrollToMessageWithCreatedAt","createdAt","focusAnimated","timeout","foundMessageIndex","messages","findIndex","it","isIncludedInList","setTimeout","onUpdateSearchItem","startingPoint","index","animated","channel","messageOffsetTimestamp","onResetMessageListWithStartingPoint","scrollToBottom","arguments","length","undefined","hasNext","onScrolledAwayFromBottom","onResetMessageList","onReactionUpdated","event","recentMessage","isRecentMessage","messageId","scrollReachedBottomAndCanScroll","scrolledAwayFromBottom","_ref","type","searchItem","onPressParentMessage","message","canScrollToParent","show","TOAST","FIND_PARENT_MSG_ERROR","createElement","_extends","ref","onReplyMessage","onEditMessage","onPressNewMessagesButton","onPressScrollToBottomButton","memo"],"sources":["GroupChannelMessageList.tsx"],"sourcesContent":["import React, { useContext, useEffect } from 'react';\n\nimport { useChannelHandler } from '@sendbird/uikit-chat-hooks';\nimport { useToast } from '@sendbird/uikit-react-native-foundation';\nimport type { SendbirdMessage } from '@sendbird/uikit-utils';\nimport { isDifferentChannel, useFreshCallback, useIsFirstMount, useUniqHandlerId } from '@sendbird/uikit-utils';\n\nimport ChannelMessageList from '../../../components/ChannelMessageList';\nimport { MESSAGE_FOCUS_ANIMATION_DELAY, MESSAGE_SEARCH_SAFE_SCROLL_DELAY } from '../../../constants';\nimport { useLocalization, useSendbirdChat } from '../../../hooks/useContext';\nimport { GroupChannelContexts } from '../module/moduleContext';\nimport type { GroupChannelProps } from '../types';\n\nconst GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {\n const toast = useToast();\n const { STRINGS } = useLocalization();\n const { sdk } = useSendbirdChat();\n const { setMessageToEdit, setMessageToReply } = useContext(GroupChannelContexts.Fragment);\n const { subscribe } = useContext(GroupChannelContexts.PubSub);\n const { flatListRef, lazyScrollToBottom, lazyScrollToIndex } = useContext(GroupChannelContexts.MessageList);\n\n const id = useUniqHandlerId('GroupChannelMessageList');\n const isFirstMount = useIsFirstMount();\n\n const scrollToMessageWithCreatedAt = useFreshCallback(\n (createdAt: number, focusAnimated: boolean, timeout: number): boolean => {\n const foundMessageIndex = props.messages.findIndex((it) => it.createdAt === createdAt);\n const isIncludedInList = foundMessageIndex > -1;\n\n if (isIncludedInList) {\n if (focusAnimated) {\n setTimeout(() => props.onUpdateSearchItem({ startingPoint: createdAt }), MESSAGE_FOCUS_ANIMATION_DELAY);\n }\n lazyScrollToIndex({ index: foundMessageIndex, animated: true, timeout });\n } else {\n if (props.channel.messageOffsetTimestamp <= createdAt) {\n if (focusAnimated) props.onUpdateSearchItem({ startingPoint: createdAt });\n props.onResetMessageListWithStartingPoint(createdAt);\n } else {\n return false;\n }\n }\n return true;\n },\n );\n\n const scrollToBottom = useFreshCallback((animated = false) => {\n if (props.hasNext()) {\n props.onUpdateSearchItem(undefined);\n props.onScrolledAwayFromBottom(false);\n\n props.onResetMessageList(() => {\n props.onScrolledAwayFromBottom(false);\n lazyScrollToBottom({ animated });\n });\n } else {\n lazyScrollToBottom({ animated });\n }\n });\n\n useChannelHandler(sdk, id, {\n onReactionUpdated(channel, event) {\n if (isDifferentChannel(channel, props.channel)) return;\n const recentMessage = props.messages[0];\n const isRecentMessage = recentMessage && recentMessage.messageId === event.messageId;\n const scrollReachedBottomAndCanScroll = !props.scrolledAwayFromBottom && !props.hasNext();\n if (isRecentMessage && scrollReachedBottomAndCanScroll) {\n lazyScrollToBottom({ animated: true, timeout: 250 });\n }\n },\n });\n\n useEffect(() => {\n return subscribe(({ type }) => {\n switch (type) {\n case 'MESSAGES_RECEIVED': {\n if (!props.scrolledAwayFromBottom) {\n scrollToBottom(true);\n }\n break;\n }\n case 'MESSAGE_SENT_SUCCESS':\n case 'MESSAGE_SENT_PENDING': {\n scrollToBottom(false);\n break;\n }\n }\n });\n }, [props.scrolledAwayFromBottom]);\n\n useEffect(() => {\n // Only trigger once when message list mount with initial props.searchItem\n // - Search screen + searchItem > mount message list\n // - Reset message list + searchItem > re-mount message list\n if (isFirstMount && props.searchItem) {\n scrollToMessageWithCreatedAt(props.searchItem.startingPoint, false, MESSAGE_SEARCH_SAFE_SCROLL_DELAY);\n }\n }, [isFirstMount]);\n\n const onPressParentMessage = useFreshCallback((message: SendbirdMessage) => {\n const canScrollToParent = scrollToMessageWithCreatedAt(message.createdAt, true, 0);\n if (!canScrollToParent) toast.show(STRINGS.TOAST.FIND_PARENT_MSG_ERROR, 'error');\n });\n\n return (\n <ChannelMessageList\n {...props}\n ref={flatListRef}\n onReplyMessage={setMessageToReply}\n onEditMessage={setMessageToEdit}\n onPressParentMessage={onPressParentMessage}\n onPressNewMessagesButton={scrollToBottom}\n onPressScrollToBottomButton={scrollToBottom}\n />\n );\n};\n\nexport default React.memo(GroupChannelMessageList);\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAEpD,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,QAAQ,QAAQ,yCAAyC;AAElE,SAASC,kBAAkB,EAAEC,gBAAgB,EAAEC,eAAe,EAAEC,gBAAgB,QAAQ,uBAAuB;AAE/G,OAAOC,kBAAkB,MAAM,wC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