@cometchat/chat-uikit-react-native 4.0.1 → 4.1.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 +1 -1
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/7.4/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/gradle.xml +13 -0
- package/android/.idea/misc.xml +9 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/src/main/java/com/reactnativecometchatuikit/{RNSoundModule.java → CometChatSoundModule.java} +22 -22
- package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +1 -1
- package/ios/{RNSound.h → CometChatSoundModule.h} +1 -1
- package/ios/{RNSound.m → CometChatSoundModule.m} +2 -2
- package/lib/CometChatConversations/ConversationsConfiguration.d.ts +1 -0
- package/lib/CometChatDetails/DetailsConfiguration.d.ts +1 -0
- package/lib/CometChatGroupMembers/GroupMemberConfiguration.d.ts +1 -0
- package/lib/CometChatGroups/GroupsConfiguration.d.ts +1 -0
- package/lib/CometChatMessageComposer/CometChatMessageComposer.js +1 -7
- package/lib/CometChatMessageComposer/CometChatMessageComposer.js.map +1 -1
- package/lib/CometChatMessageHeader/MessageHeaderConfiguration.d.ts +1 -0
- package/lib/CometChatMessageList/CometChatMessageList.js +18 -49
- package/lib/CometChatMessageList/CometChatMessageList.js.map +1 -1
- package/lib/CometChatMessageList/MessageListConfiguration.d.ts +1 -0
- package/lib/CometChatMessages/MessagesConfiguration.d.ts +1 -0
- package/lib/CometChatTabs/TabItems.d.ts +1 -0
- package/lib/CometChatThreadedMessages/ThreadedMessagesConfiguration.d.ts +1 -0
- package/lib/calls/CometChatCallDetails/CallDetailsConfiguration.d.ts +1 -0
- package/lib/calls/CometChatCallHistory/CallHistoryConfiguration.d.ts +1 -0
- package/lib/calls/CometChatIncomingCall/CometChatIncomingCall.js +3 -3
- package/lib/calls/CometChatIncomingCall/CometChatIncomingCall.js.map +1 -1
- package/lib/extensions/ImageModeration/ImageModerationDecorator.d.ts +1 -0
- package/lib/extensions/ImageModeration/ImageModerationFilter.js +4 -4
- package/lib/extensions/ImageModeration/ImageModerationFilter.js.map +1 -1
- package/lib/extensions/LinkPreview/LinkPreviewExtentionDecorator.d.ts +1 -0
- package/lib/extensions/MessageTranslation/MessageTranslationDecorator.d.ts +1 -0
- package/lib/extensions/SmartReplies/SmartRepliesDecorator.js +1 -1
- package/lib/extensions/SmartReplies/SmartRepliesDecorator.js.map +1 -1
- package/lib/extensions/Stickers/StickersExtensionDecorator.d.ts +1 -1
- package/lib/extensions/Stickers/StickersExtensionDecorator.js +2 -4
- package/lib/extensions/Stickers/StickersExtensionDecorator.js.map +1 -1
- package/lib/extensions/TextModeration/TextModerationExtensionDecorator.d.ts +1 -0
- package/lib/index.d.ts +0 -13
- package/lib/index.js +0 -14
- package/lib/index.js.map +1 -1
- package/lib/shared/CometChatUiKit/CometChatUIKit.d.ts +0 -2
- package/lib/shared/CometChatUiKit/CometChatUIKit.js +2 -13
- package/lib/shared/CometChatUiKit/CometChatUIKit.js.map +1 -1
- package/lib/shared/CometChatUiKit/UIKitSettings.d.ts +1 -5
- package/lib/shared/CometChatUiKit/UIKitSettings.js +1 -3
- package/lib/shared/CometChatUiKit/UIKitSettings.js.map +1 -1
- package/lib/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.js +0 -2
- package/lib/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.js.map +1 -1
- package/lib/shared/events/CometChatUIEventHandler/Listener.d.ts +1 -3
- package/lib/shared/events/CometChatUIEventHandler/Listener.js +1 -4
- package/lib/shared/events/CometChatUIEventHandler/Listener.js.map +1 -1
- package/lib/shared/events/CometChatUIEvents.d.ts +1 -2
- package/lib/shared/events/CometChatUIEvents.js +0 -1
- package/lib/shared/events/CometChatUIEvents.js.map +1 -1
- package/lib/shared/framework/DataSource.d.ts +2 -1
- package/lib/shared/framework/DataSourceDecorator.d.ts +2 -1
- package/lib/shared/framework/DataSourceDecorator.js +2 -2
- package/lib/shared/framework/DataSourceDecorator.js.map +1 -1
- package/lib/shared/framework/MessageDataSource.d.ts +1 -1
- package/lib/shared/framework/MessageDataSource.js +2 -2
- package/lib/shared/framework/MessageDataSource.js.map +1 -1
- package/lib/shared/helper/types/index.d.ts +1 -0
- package/lib/shared/modals/CometChatDetailsOption.d.ts +1 -0
- package/lib/shared/modals/CometChatMessageOption.d.ts +1 -0
- package/lib/shared/modals/CometChatMessageTemplate.d.ts +1 -0
- package/lib/shared/resources/CometChatLocalize/CometChatLocalize.d.ts +153 -230
- package/lib/shared/resources/CometChatLocalize/resources/ar/translation.json +0 -4
- package/lib/shared/resources/CometChatLocalize/resources/de/translation.json +0 -4
- package/lib/shared/resources/CometChatLocalize/resources/en/translation.json +0 -4
- package/lib/shared/resources/CometChatLocalize/resources/es/translation.json +0 -4
- package/lib/shared/resources/CometChatLocalize/resources/fr/translation.json +0 -4
- package/lib/shared/resources/CometChatLocalize/resources/hi/translation.json +0 -4
- package/lib/shared/resources/CometChatLocalize/resources/lt/translation.json +0 -4
- package/lib/shared/resources/CometChatLocalize/resources/ms/translation.json +0 -4
- package/lib/shared/resources/CometChatLocalize/resources/pt/translation.json +0 -4
- package/lib/shared/resources/CometChatLocalize/resources/ru/translation.json +0 -4
- package/lib/shared/resources/CometChatLocalize/resources/sv/translation.json +0 -4
- package/lib/shared/resources/CometChatLocalize/resources/zh/translation.json +0 -4
- package/lib/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +0 -4
- package/package.json +3 -3
- package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +164 -0
- package/src/AI/AIAssistBot/AIAssistBotExtension.tsx +22 -0
- package/src/AI/AIAssistBot/AIAssistBotStyle.ts +43 -0
- package/src/AI/AIAssistBot/AIAssistBotView.tsx +294 -0
- package/src/AI/AIAssistBot/configuration.ts +22 -0
- package/src/AI/AIAssistBot/resources/index.ts +5 -0
- package/src/AI/{configuration.ts → AIBaseConfiguration.ts} +3 -6
- package/src/AI/AIBaseStyle.ts +58 -0
- package/src/AI/AIConversationStarter/AIConversationStarter.ts +5 -19
- package/src/AI/AIConversationStarter/AIConversationStarterDecorator.tsx +145 -132
- package/src/AI/AIConversationStarter/AIConversationStarterStyle.ts +11 -6
- package/src/AI/AIConversationStarter/configuration.ts +10 -17
- package/src/AI/AIConversationSummary/AIConversationSummaryDecorator.tsx +175 -0
- package/src/AI/AIConversationSummary/AIConversationSummaryExtension.ts +21 -0
- package/src/AI/AIConversationSummary/AIConversationSummaryStyle.tsx +20 -0
- package/src/AI/AIConversationSummary/AIConversationSummaryView.tsx +190 -0
- package/src/AI/AIConversationSummary/configuration.ts +14 -0
- package/src/AI/AIConversationSummary/resources/close.png +0 -0
- package/src/AI/AIConversationSummary/resources/index.ts +5 -0
- package/src/AI/AIExtensionDataSource.ts +17 -12
- package/src/AI/AIOptionsStyle.ts +14 -0
- package/src/AI/AISmartReplies/AISmartReplies.ts +6 -15
- package/src/AI/AISmartReplies/AISmartRepliesDecorator.tsx +302 -0
- package/src/AI/AISmartReplies/AISmartRepliesStyle.ts +1 -1
- package/src/AI/AISmartReplies/configuration.ts +4 -11
- package/src/AI/resources/index.ts +0 -2
- package/src/AI/utils.ts +3 -3
- package/src/CometChatConversations/CometChatConversations.tsx +56 -46
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +118 -5
- package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +3 -0
- package/src/CometChatMessageComposer/resources/index.ts +2 -0
- package/src/CometChatMessageComposer/styles.ts +1 -4
- package/src/CometChatMessageHeader/listners.ts +5 -4
- package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +35 -35
- package/src/CometChatMessageList/CometChatMessageList.tsx +284 -166
- package/src/CometChatMessages/CometChatMessages.tsx +8 -16
- package/src/CometChatMessages/MessagesConfiguration.ts +2 -2
- package/src/CometChatTabs/CometChatTabs.tsx +1 -1
- package/src/calls/CallUtils.ts +106 -45
- package/src/calls/CallingDetailsUtils.tsx +133 -15
- package/src/calls/CallingPackage.ts +16 -2
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +9 -10
- package/src/calls/CometChatCallLogDetails/CallLogDetailsConfiguration.ts +116 -0
- package/src/calls/CometChatCallLogDetails/CallLogDetailsStyle.ts +36 -0
- package/src/calls/CometChatCallLogDetails/CometChatCallLogDetails.tsx +308 -0
- package/src/calls/CometChatCallLogDetails/index.ts +12 -0
- package/src/calls/CometChatCallLogDetails/resources/CloseIcon.png +0 -0
- package/src/calls/{CometChatCallDetails → CometChatCallLogDetails}/style.ts +1 -0
- package/src/calls/{CometChatCallHistory/CallHistoryConfiguration.ts → CometChatCallLogHistory/CallLogHistoryConfiguration.ts} +15 -27
- package/src/calls/CometChatCallLogHistory/CallLogHistoryStyle.ts +46 -0
- package/src/calls/CometChatCallLogHistory/CometChatCallLogHistory.tsx +337 -0
- package/src/calls/CometChatCallLogHistory/index.ts +12 -0
- package/src/calls/CometChatCallLogHistory/resources/incomingcall.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/incomingvideo.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/index.ts +29 -0
- package/src/calls/CometChatCallLogHistory/resources/missedcall.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/missedvideo.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/outgoingcall.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/outgoingvideo.png +0 -0
- package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/style.ts +2 -1
- package/src/calls/CometChatCallLogParticipants/CallLogParticipantsConfiguration.ts +61 -0
- package/src/calls/CometChatCallLogParticipants/CallLogParticipantsStyle.ts +59 -0
- package/src/calls/CometChatCallLogParticipants/CometChatCallLogParticipants.tsx +220 -0
- package/src/calls/CometChatCallLogParticipants/index.ts +12 -0
- package/src/calls/CometChatCallLogParticipants/resources/Back.png +0 -0
- package/src/calls/CometChatCallLogParticipants/resources/index.ts +4 -0
- package/src/calls/CometChatCallLogParticipants/style.ts +24 -0
- package/src/calls/CometChatCallLogRecordings/CallLogRecordingsConfiguration.ts +63 -0
- package/src/calls/CometChatCallLogRecordings/CallLogRecordingsStyle.ts +63 -0
- package/src/calls/CometChatCallLogRecordings/CometChatCallLogRecordings.tsx +253 -0
- package/src/calls/CometChatCallLogRecordings/index.ts +12 -0
- package/src/calls/CometChatCallLogRecordings/resources/Back.png +0 -0
- package/src/calls/CometChatCallLogRecordings/resources/download.png +0 -0
- package/src/calls/CometChatCallLogRecordings/resources/index.ts +6 -0
- package/src/calls/CometChatCallLogRecordings/style.ts +24 -0
- package/src/calls/CometChatCallLogs/CallLogsConfiguration.ts +87 -0
- package/src/calls/CometChatCallLogs/CallLogsStyle.ts +95 -0
- package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +482 -0
- package/src/calls/CometChatCallLogs/index.ts +12 -0
- package/src/calls/CometChatCallLogs/resources/Back.png +0 -0
- package/src/calls/CometChatCallLogs/resources/Info.png +0 -0
- package/src/calls/CometChatCallLogs/resources/Selection.png +0 -0
- package/src/calls/CometChatCallLogs/resources/Spinner.png +0 -0
- package/src/calls/CometChatCallLogs/resources/check.png +0 -0
- package/src/calls/CometChatCallLogs/resources/incomingcall.png +0 -0
- package/src/calls/CometChatCallLogs/resources/incomingvideo.png +0 -0
- package/src/calls/CometChatCallLogs/resources/index.ts +25 -0
- package/src/calls/CometChatCallLogs/resources/missedcall.png +0 -0
- package/src/calls/CometChatCallLogs/resources/missedvideo.png +0 -0
- package/src/calls/CometChatCallLogs/resources/outgoingcall.png +0 -0
- package/src/calls/CometChatCallLogs/resources/outgoingvideo.png +0 -0
- package/src/calls/CometChatCallLogs/style.ts +24 -0
- package/src/calls/CometChatCallLogsWithDetails/CallLogsWithDetailsConfiguration.ts +9 -0
- package/src/calls/{CometChatCallHistoryWithDetails/CometChatCallHistoryWithDetails.tsx → CometChatCallLogsWithDetails/CometChatCallLogsWithDetails.tsx} +17 -16
- package/src/calls/CometChatCallLogsWithDetails/index.ts +7 -0
- package/src/calls/index.ts +40 -1
- package/src/calls/resources/index.ts +3 -1
- package/src/calls/resources/nextarrow.png +0 -0
- package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +6 -14
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +1 -1
- package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +5 -3
- package/src/extensions/ThumbnailGeneration/resources/empty.png +0 -0
- package/src/extensions/ThumbnailGeneration/resources/index.ts +5 -0
- package/src/index.ts +134 -17
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +175 -63
- package/src/shared/CometChatUiKit/UIKitSettings.ts +2 -2
- package/src/shared/constants/UIKitConstants.ts +81 -47
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +47 -3
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +61 -2
- package/src/shared/events/ListenerInitializer.ts +73 -0
- package/src/shared/events/messages.ts +14 -0
- package/src/shared/framework/DataSource.ts +15 -0
- package/src/shared/framework/DataSourceDecorator.tsx +40 -0
- package/src/shared/framework/MessageDataSource.tsx +87 -4
- package/src/shared/index.ts +48 -0
- package/src/shared/modals/CometChatCallLogDetailsOptions.ts +23 -0
- package/src/shared/modals/CometChatCallLogDetailsTemplate.ts +16 -0
- package/src/shared/modals/InteractiveData/InteractiveActions/APIAction.ts +118 -0
- package/src/shared/modals/InteractiveData/InteractiveActions/CustomAction.ts +19 -0
- package/src/shared/modals/InteractiveData/InteractiveActions/URLNavigationAction.ts +34 -0
- package/src/shared/modals/InteractiveData/InteractiveActions/index.ts +3 -0
- package/src/shared/modals/InteractiveData/InteractiveData/InteractiveCardData.ts +69 -0
- package/src/shared/modals/InteractiveData/InteractiveData/InteractiveFormData.ts +119 -0
- package/src/shared/modals/InteractiveData/InteractiveData/index.ts +2 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/BaseInputElement.ts +102 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/BaseInteractiveElement.ts +45 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/ButtonElement.ts +61 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/CheckboxElement.ts +75 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/DropdownElement.ts +83 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/LabelElement.ts +32 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/OptionElement.ts +39 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/RadioButtonElement.ts +76 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/SingleSelectElement.ts +76 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/TextInputElement.ts +101 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/index.ts +10 -0
- package/src/shared/modals/InteractiveData/InteractiveEntities/ActionEntity.ts +41 -0
- package/src/shared/modals/InteractiveData/InteractiveEntities/ElementEntity.ts +64 -0
- package/src/shared/modals/InteractiveData/InteractiveEntities/index.ts +2 -0
- package/src/shared/modals/InteractiveData/InteractiveMessage/CardMessage.ts +142 -0
- package/src/shared/modals/InteractiveData/InteractiveMessage/CustomInteractiveMessage.ts +38 -0
- package/src/shared/modals/InteractiveData/InteractiveMessage/FormMessage.ts +152 -0
- package/src/shared/modals/InteractiveData/InteractiveMessage/index.ts +3 -0
- package/src/shared/modals/InteractiveData/index.ts +28 -0
- package/src/shared/modals/index.ts +23 -0
- package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +22 -5
- package/src/shared/resources/CometChatLocalize/resources/de/translation.json +22 -5
- package/src/shared/resources/CometChatLocalize/resources/en/translation.json +24 -7
- package/src/shared/resources/CometChatLocalize/resources/es/translation.json +22 -5
- package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +22 -5
- package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +22 -5
- package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +22 -5
- package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +22 -5
- package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +22 -5
- package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +22 -5
- package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +22 -5
- package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +22 -4
- package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +22 -5
- package/src/shared/resources/CometChatSoundManager/CometChatSoundManager.js +2 -2
- package/src/shared/resources/CometChatSoundManager/sound.js +35 -35
- package/src/shared/resources/CometChatTheme/Palette.ts +16 -0
- package/src/shared/utils/DetailsUtils/DetailsUtils.tsx +1 -1
- package/src/shared/utils/InteractiveMessageUtils.ts +20 -0
- package/src/shared/utils/NetworkUtils.tsx +20 -0
- package/src/shared/utils/conversationUtils.ts +9 -6
- package/src/shared/views/CometChatAICard/CometChatAICard.tsx +71 -0
- package/src/shared/views/CometChatAICard/resources/errormessage.png +0 -0
- package/src/shared/views/CometChatAICard/resources/index.ts +4 -0
- package/src/shared/views/CometChatAICard/resources/nomessage.png +0 -0
- package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +4 -0
- package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +11 -7
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +56 -47
- package/src/shared/views/CometChatBottomSheet/style.ts +0 -2
- package/src/shared/views/CometChatButton/CometChatButton.tsx +32 -22
- package/src/shared/views/CometChatCardBubble/CardBubbleStyle.tsx +47 -0
- package/src/shared/views/CometChatCardBubble/CometChatCardBubble.tsx +173 -0
- package/src/shared/views/CometChatCardBubble/index.tsx +1 -0
- package/src/shared/views/CometChatCheckBox/CheckBoxStyle.tsx +43 -0
- package/src/shared/views/CometChatCheckBox/CometChatCheckBox.tsx +79 -0
- package/src/shared/views/CometChatDate/CometChatDate.tsx +9 -6
- package/src/shared/views/CometChatDate/DateConfiguration.ts +4 -0
- package/src/shared/views/CometChatDate/style.ts +1 -1
- package/src/shared/views/CometChatDropDown/CometChatDropDown.tsx +126 -0
- package/src/shared/views/CometChatDropDown/DropDownStyle.tsx +39 -0
- package/src/shared/views/CometChatDropDown/resources/downArrowIcon.png +0 -0
- package/src/shared/views/CometChatDropDown/resources/index.js +5 -0
- package/src/shared/views/CometChatFormBubble/CometChatFormBubble.tsx +464 -0
- package/src/shared/views/CometChatFormBubble/FormBubbleStyle.tsx +91 -0
- package/src/shared/views/CometChatFormBubble/index.tsx +1 -0
- package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +13 -5
- package/src/shared/views/CometChatImageBubble/ImageBubbleStyle.ts +14 -3
- package/src/shared/views/CometChatLabel/CometChatLabel.tsx +27 -0
- package/src/shared/views/CometChatLabel/LabelStyle.ts +19 -0
- package/src/shared/views/CometChatListItem/CometChatListItem.tsx +31 -19
- package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +5 -4
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +1 -2
- package/src/shared/views/CometChatPanel/CometChatPanel.tsx +51 -0
- package/src/shared/views/CometChatPanel/PanelStyle.tsx +43 -0
- package/src/shared/views/CometChatPanel/resources/CloseIcon.png +0 -0
- package/src/shared/views/CometChatPanel/resources/index.ts +5 -0
- package/src/shared/views/CometChatQuickView/CometChatQuickView.tsx +66 -0
- package/src/shared/views/CometChatQuickView/QuickViewStyle.ts +55 -0
- package/src/shared/views/CometChatRadioButton/CometChatRadioButton.tsx +67 -0
- package/src/shared/views/CometChatRadioButton/RadioButtonStyle.tsx +38 -0
- package/src/shared/views/CometChatSingleSelect/CometChatSingleSelect.tsx +63 -0
- package/src/shared/views/CometChatSingleSelect/SingleStyle.tsx +35 -0
- package/src/shared/views/CometChatTextInput/CometChatTextInput.tsx +67 -0
- package/src/shared/views/CometChatTextInput/TextInputStyle.tsx +26 -0
- package/src/shared/views/index.ts +7 -1
- package/lib/AI/AIConversationStarter/AIConversationStarter.d.ts +0 -12
- package/lib/AI/AIConversationStarter/AIConversationStarter.js +0 -31
- package/lib/AI/AIConversationStarter/AIConversationStarter.js.map +0 -1
- package/lib/AI/AIConversationStarter/AIConversationStarterDecorator.d.ts +0 -25
- package/lib/AI/AIConversationStarter/AIConversationStarterDecorator.js +0 -175
- package/lib/AI/AIConversationStarter/AIConversationStarterDecorator.js.map +0 -1
- package/lib/AI/AIConversationStarter/AIConversationStarterStyle.d.ts +0 -4
- package/lib/AI/AIConversationStarter/AIConversationStarterStyle.js +0 -8
- package/lib/AI/AIConversationStarter/AIConversationStarterStyle.js.map +0 -1
- package/lib/AI/AIConversationStarter/configuration.d.ts +0 -14
- package/lib/AI/AIConversationStarter/configuration.js +0 -16
- package/lib/AI/AIConversationStarter/configuration.js.map +0 -1
- package/lib/AI/AIConversationStarter/style.d.ts +0 -31
- package/lib/AI/AIConversationStarter/style.js +0 -62
- package/lib/AI/AIConversationStarter/style.js.map +0 -1
- package/lib/AI/AIEnabler.d.ts +0 -10
- package/lib/AI/AIEnabler.js +0 -102
- package/lib/AI/AIEnabler.js.map +0 -1
- package/lib/AI/AIEnablerDecorator.d.ts +0 -43
- package/lib/AI/AIEnablerDecorator.js +0 -251
- package/lib/AI/AIEnablerDecorator.js.map +0 -1
- package/lib/AI/AIExtensionDataSource.d.ts +0 -6
- package/lib/AI/AIExtensionDataSource.js +0 -10
- package/lib/AI/AIExtensionDataSource.js.map +0 -1
- package/lib/AI/AISmartReplies/AISmartReplies.d.ts +0 -10
- package/lib/AI/AISmartReplies/AISmartReplies.js +0 -23
- package/lib/AI/AISmartReplies/AISmartReplies.js.map +0 -1
- package/lib/AI/AISmartReplies/AISmartRepliesDecorator.d.ts +0 -7
- package/lib/AI/AISmartReplies/AISmartRepliesDecorator.js +0 -12
- package/lib/AI/AISmartReplies/AISmartRepliesDecorator.js.map +0 -1
- package/lib/AI/AISmartReplies/AISmartRepliesStyle.d.ts +0 -12
- package/lib/AI/AISmartReplies/AISmartRepliesStyle.js +0 -15
- package/lib/AI/AISmartReplies/AISmartRepliesStyle.js.map +0 -1
- package/lib/AI/AISmartReplies/configuration.d.ts +0 -14
- package/lib/AI/AISmartReplies/configuration.js +0 -16
- package/lib/AI/AISmartReplies/configuration.js.map +0 -1
- package/lib/AI/CardView.d.ts +0 -19
- package/lib/AI/CardView.js +0 -45
- package/lib/AI/CardView.js.map +0 -1
- package/lib/AI/CardViewStyle.d.ts +0 -29
- package/lib/AI/CardViewStyle.js +0 -36
- package/lib/AI/CardViewStyle.js.map +0 -1
- package/lib/AI/configuration.d.ts +0 -14
- package/lib/AI/configuration.js +0 -16
- package/lib/AI/configuration.js.map +0 -1
- package/lib/AI/resources/index.d.ts +0 -5
- package/lib/AI/resources/index.js +0 -6
- package/lib/AI/resources/index.js.map +0 -1
- package/lib/AI/style.d.ts +0 -115
- package/lib/AI/style.js +0 -139
- package/lib/AI/style.js.map +0 -1
- package/lib/AI/utils.d.ts +0 -38
- package/lib/AI/utils.js +0 -28
- package/lib/AI/utils.js.map +0 -1
- package/src/AI/AIEnabler.ts +0 -115
- package/src/AI/AIEnablerDecorator.tsx +0 -324
- package/src/AI/AISmartReplies/AISmartRepliesDecorator.ts +0 -18
- package/src/calls/CometChatCallDetails/CallDetailsConfiguration.ts +0 -68
- package/src/calls/CometChatCallDetails/CallDetailsStyle.ts +0 -52
- package/src/calls/CometChatCallDetails/CometChatCallDetails.tsx +0 -268
- package/src/calls/CometChatCallDetails/index.ts +0 -9
- package/src/calls/CometChatCallHistory/CallHistoryStyle.ts +0 -34
- package/src/calls/CometChatCallHistory/CometChatCallHistory.tsx +0 -422
- package/src/calls/CometChatCallHistory/index.ts +0 -9
- package/src/calls/CometChatCallHistory/resources/index.ts +0 -17
- package/src/calls/CometChatCallHistoryWithDetails/HistoryWithDetailsConfiguration.ts +0 -7
- package/src/calls/CometChatCallHistoryWithDetails/HistoryWithDetailsStyle.ts +0 -3
- package/src/calls/CometChatCallHistoryWithDetails/index.ts +0 -8
- /package/src/{calls/CometChatCallDetails → AI/AIAssistBot}/resources/CloseIcon.png +0 -0
- /package/src/{AI → CometChatMessageComposer}/resources/ai.png +0 -0
- /package/src/calls/{CometChatCallDetails → CometChatCallLogDetails}/resources/index.ts +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Back.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Call.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Info.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Selection.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Spineer.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Video.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/check.png +0 -0
- /package/src/calls/{CometChatCallHistoryWithDetails → CometChatCallLogsWithDetails}/style.ts +0 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { View, Text, NativeModules } from 'react-native'
|
|
2
|
+
import React, { useEffect, useContext } from 'react'
|
|
3
|
+
import { APIAction, ButtonElement, CardMessage, URLNavigationAction } from '../../modals/InteractiveData'
|
|
4
|
+
import { CometChatImageBubble } from '../CometChatImageBubble';
|
|
5
|
+
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
6
|
+
import { CometChatContextType } from '../../base';
|
|
7
|
+
import { CometChatContext } from '../../CometChatContext';
|
|
8
|
+
import { CometChatButton } from '../CometChatButton';
|
|
9
|
+
import { ButtonAction, HTTPSRequestMethods } from '../../constants/UIKitConstants';
|
|
10
|
+
import { CometChatNetworkUtils } from '../../utils/NetworkUtils';
|
|
11
|
+
import { CardBubbleStyle, CardBubbleStyleInterface } from './CardBubbleStyle';
|
|
12
|
+
|
|
13
|
+
const WebView = NativeModules['WebViewManager'];
|
|
14
|
+
export interface CometChatCardBubbleInterface {
|
|
15
|
+
message: CardMessage, // Expect JSON object
|
|
16
|
+
style?: CardBubbleStyleInterface,
|
|
17
|
+
onSubmitClick?: (data: any) => void
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const CometChatCardBubble = (props: CometChatCardBubbleInterface) => {
|
|
21
|
+
const {
|
|
22
|
+
message, onSubmitClick, style
|
|
23
|
+
} = props;
|
|
24
|
+
|
|
25
|
+
const { theme } = useContext<CometChatContextType>(CometChatContext);
|
|
26
|
+
const [loggedInUser, setLoggedInUser] = React.useState<CometChat.User>(null);
|
|
27
|
+
|
|
28
|
+
const [interactedElements, setInteractedElements] = React.useState<CometChat.Interaction[]>([]);
|
|
29
|
+
|
|
30
|
+
const _style = new CardBubbleStyle({
|
|
31
|
+
backgroundColor: theme.palette.getBackgroundColor(),
|
|
32
|
+
borderRadius: 5,
|
|
33
|
+
padding: 5,
|
|
34
|
+
imageStyle: {
|
|
35
|
+
aspectRatio: 16 / 9,
|
|
36
|
+
width: "100%",
|
|
37
|
+
borderRadius: 5,
|
|
38
|
+
},
|
|
39
|
+
imageResizeMode: 'cover',
|
|
40
|
+
buttonStyle: {
|
|
41
|
+
backgroundColor: theme.palette.getBackgroundColor(),
|
|
42
|
+
border: { borderWidth: 0 },
|
|
43
|
+
textColor: theme.palette.getPrimary(),
|
|
44
|
+
textFont: { fontSize: 14 },
|
|
45
|
+
height: 35,
|
|
46
|
+
borderRadius: 0,
|
|
47
|
+
},
|
|
48
|
+
textColor: theme.palette.getAccent600(),
|
|
49
|
+
...style,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const {
|
|
53
|
+
backgroundColor,
|
|
54
|
+
borderRadius,
|
|
55
|
+
buttonStyle,
|
|
56
|
+
imageResizeMode,
|
|
57
|
+
imageStyle,
|
|
58
|
+
padding,
|
|
59
|
+
textColor,
|
|
60
|
+
textFont,
|
|
61
|
+
} = _style;
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
CometChat.getLoggedinUser()
|
|
65
|
+
.then(u => {
|
|
66
|
+
setLoggedInUser(u);
|
|
67
|
+
})
|
|
68
|
+
.catch(e => {
|
|
69
|
+
console.log("Error while getting loggedInUser");
|
|
70
|
+
setLoggedInUser(null);
|
|
71
|
+
});
|
|
72
|
+
setInteractedElements(message.getInteractions() || []);
|
|
73
|
+
}, []);
|
|
74
|
+
|
|
75
|
+
const _renderButton = (data: ButtonElement, isSubmitElement?: boolean) => {
|
|
76
|
+
function onClick() {
|
|
77
|
+
_handleButtonClick(data.getAction(), data.getElementId(), isSubmitElement);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function isDisabled() {
|
|
81
|
+
let isSender = message.getSender()?.getUid() == loggedInUser?.['uid'];
|
|
82
|
+
|
|
83
|
+
let allowInteraction = isSender ? message?.["data"]?.["allowSenderInteraction"] : true;
|
|
84
|
+
|
|
85
|
+
let disableAfterInteracted: boolean;
|
|
86
|
+
if (data.getDisableAfterInteracted()) {
|
|
87
|
+
disableAfterInteracted = interactedElements?.some(
|
|
88
|
+
(element) => element.getElementId() === data.getElementId()
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return (disableAfterInteracted || !allowInteraction);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<View style={{ borderTopWidth: 1, borderTopColor: theme.palette.getAccent100(), opacity: isDisabled() ? .7 : 1 }}>
|
|
96
|
+
<CometChatButton
|
|
97
|
+
onPress={isDisabled() ? () => { } : onClick}
|
|
98
|
+
text={data.getButtonText()}
|
|
99
|
+
style={{...buttonStyle, textColor: isDisabled() ? theme.palette.getAccent600() : buttonStyle.textColor }}
|
|
100
|
+
/>
|
|
101
|
+
</View>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function markAsInteracted(elementId: string) {
|
|
106
|
+
CometChat.markAsInteracted(message?.getId(), elementId).then(
|
|
107
|
+
(response) => {
|
|
108
|
+
const interaction = new CometChat.Interaction(
|
|
109
|
+
elementId,
|
|
110
|
+
new Date().getTime()
|
|
111
|
+
);
|
|
112
|
+
let clonedInteractedElements = [...interactedElements];
|
|
113
|
+
clonedInteractedElements.push(interaction);
|
|
114
|
+
setInteractedElements(clonedInteractedElements);
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
.catch((error) => {
|
|
118
|
+
console.log("error while markAsInteracted", error);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function _handleButtonClick(action: ButtonElement["action"], elementId: string, isSubmitElement?: boolean) {
|
|
123
|
+
if (isSubmitElement && onSubmitClick) {
|
|
124
|
+
onSubmitClick((action as APIAction).getPayload())
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
switch (action.getActionType()) {
|
|
128
|
+
case ButtonAction.apiAction:
|
|
129
|
+
CometChatNetworkUtils.fetcher({
|
|
130
|
+
url: (action as APIAction).getURL(),
|
|
131
|
+
method: (action as APIAction).getMethod() || HTTPSRequestMethods.POST,
|
|
132
|
+
body: { ...action.getPayload(), cometchatSenderUid: loggedInUser?.['uid'] || "" },
|
|
133
|
+
headers: (action as APIAction).getHeaders(),
|
|
134
|
+
})
|
|
135
|
+
.then((response) => {
|
|
136
|
+
if (response.status === 200) {
|
|
137
|
+
markAsInteracted(elementId);
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
.catch((error) => {
|
|
141
|
+
console.log("CometChatNetworkUtils.fetcher error", error);
|
|
142
|
+
});
|
|
143
|
+
break;
|
|
144
|
+
case ButtonAction.urlNavigation:
|
|
145
|
+
const url = (action as URLNavigationAction)?.getURL();
|
|
146
|
+
WebView.openUrl(url);
|
|
147
|
+
markAsInteracted(elementId);
|
|
148
|
+
break;
|
|
149
|
+
case ButtonAction.custom:
|
|
150
|
+
markAsInteracted(elementId);
|
|
151
|
+
break;
|
|
152
|
+
default:
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<View style={{ padding: 5 }}>
|
|
159
|
+
<View style={{ backgroundColor, borderRadius, padding }}>
|
|
160
|
+
{Boolean(message.getImageUrl()) &&
|
|
161
|
+
<CometChatImageBubble
|
|
162
|
+
imageUrl={{ uri: message.getImageUrl() }}
|
|
163
|
+
thumbnailUrl={{ uri: message.getImageUrl() }}
|
|
164
|
+
style={imageStyle}
|
|
165
|
+
resizeMode={imageResizeMode}
|
|
166
|
+
/>
|
|
167
|
+
}
|
|
168
|
+
<Text style={[textFont, { marginVertical: 10, color: textColor }]}>{message.getText()}</Text>
|
|
169
|
+
</View>
|
|
170
|
+
{(message.getCardActions())?.map((action, index) => <React.Fragment key={index}>{_renderButton(action)}</React.Fragment>)}
|
|
171
|
+
</View>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CometChatCardBubble, CometChatCardBubbleInterface } from './CometChatCardBubble'
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BorderStyle, BorderStyleInterface, FontStyle } from "../../base";
|
|
2
|
+
|
|
3
|
+
export interface CheckBoxStyleInterface {
|
|
4
|
+
titleFont?: FontStyle;
|
|
5
|
+
titleColor?: string;
|
|
6
|
+
border?: BorderStyleInterface;
|
|
7
|
+
activeBackgroundColor?: string;
|
|
8
|
+
inactiveBackgroundColor?: string;
|
|
9
|
+
optionColor?: string;
|
|
10
|
+
optionFont?: FontStyle;
|
|
11
|
+
checkboxTintColor?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class CheckBoxStyle {
|
|
15
|
+
titleFont?: FontStyle;
|
|
16
|
+
titleColor?: string;
|
|
17
|
+
border?: BorderStyleInterface;
|
|
18
|
+
activeBackgroundColor?: string;
|
|
19
|
+
inactiveBackgroundColor?: string;
|
|
20
|
+
optionColor?: string;
|
|
21
|
+
optionFont?: FontStyle;
|
|
22
|
+
checkboxTintColor?: string;
|
|
23
|
+
|
|
24
|
+
constructor({
|
|
25
|
+
titleFont = new FontStyle({}),
|
|
26
|
+
titleColor = "",
|
|
27
|
+
border = new BorderStyle({}),
|
|
28
|
+
activeBackgroundColor = "",
|
|
29
|
+
inactiveBackgroundColor = "",
|
|
30
|
+
optionColor = "",
|
|
31
|
+
optionFont = new FontStyle({}),
|
|
32
|
+
checkboxTintColor = "",
|
|
33
|
+
}: CheckBoxStyleInterface) {
|
|
34
|
+
this.titleFont = titleFont;
|
|
35
|
+
this.titleColor = titleColor;
|
|
36
|
+
this.border = border;
|
|
37
|
+
this.activeBackgroundColor = activeBackgroundColor;
|
|
38
|
+
this.inactiveBackgroundColor = inactiveBackgroundColor;
|
|
39
|
+
this.optionColor = optionColor;
|
|
40
|
+
this.optionFont = optionFont;
|
|
41
|
+
this.checkboxTintColor = checkboxTintColor;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { View, Text, TouchableOpacity, Image } from 'react-native'
|
|
2
|
+
import React, { useContext } from 'react'
|
|
3
|
+
import { CheckboxElement, OptionElement } from '../../modals/InteractiveData'
|
|
4
|
+
import { ICONS } from '../../assets/images';
|
|
5
|
+
import { CometChatContextType } from '../../base';
|
|
6
|
+
import { CometChatContext } from '../../CometChatContext';
|
|
7
|
+
import { CheckBoxStyle, CheckBoxStyleInterface } from './CheckBoxStyle';
|
|
8
|
+
|
|
9
|
+
export interface CometChatCheckBoxInterface {
|
|
10
|
+
onChange?: (option: OptionElement) => void,
|
|
11
|
+
data: CheckboxElement,
|
|
12
|
+
showError: boolean,
|
|
13
|
+
selectedOptions: string[],
|
|
14
|
+
style?: CheckBoxStyleInterface,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const CometChatCheckBox = (props: CometChatCheckBoxInterface) => {
|
|
18
|
+
const { onChange, data, showError, selectedOptions, style } = props;
|
|
19
|
+
|
|
20
|
+
const { theme } = useContext<CometChatContextType>(CometChatContext);
|
|
21
|
+
const _style = new CheckBoxStyle({
|
|
22
|
+
activeBackgroundColor: theme.palette.getPrimary(),
|
|
23
|
+
inactiveBackgroundColor: theme.palette.getBackgroundColor(),
|
|
24
|
+
titleFont: theme.typography.subtitle1,
|
|
25
|
+
border: { borderWidth: 1, borderColor: theme.palette.getAccent200() },
|
|
26
|
+
checkboxTintColor: theme.palette.getBackgroundColor(),
|
|
27
|
+
titleColor: theme.palette.getAccent(),
|
|
28
|
+
optionColor: theme.palette.getAccent(),
|
|
29
|
+
optionFont: theme.typography.subtitle1,
|
|
30
|
+
...style,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const {
|
|
34
|
+
activeBackgroundColor,
|
|
35
|
+
checkboxTintColor,
|
|
36
|
+
inactiveBackgroundColor,
|
|
37
|
+
optionColor,
|
|
38
|
+
optionFont,
|
|
39
|
+
titleColor,
|
|
40
|
+
titleFont,
|
|
41
|
+
border,
|
|
42
|
+
} = _style;
|
|
43
|
+
|
|
44
|
+
function _checkSelectedOption(option: OptionElement) {
|
|
45
|
+
return selectedOptions.find((selectedOption) => selectedOption === option.getValue()) ? true : false;
|
|
46
|
+
}
|
|
47
|
+
return (
|
|
48
|
+
<View style={{ marginVertical: 10 }}>
|
|
49
|
+
|
|
50
|
+
<Text style={[titleFont, { color: titleColor }]}>{data.getLabel()}{!data.getOptional() && "*"}</Text>
|
|
51
|
+
|
|
52
|
+
{data.getOptions().map((option, index) => (
|
|
53
|
+
<View key={index} style={{ flexDirection: "row", alignItems: "center", marginTop: 3 }}>
|
|
54
|
+
<TouchableOpacity style={{
|
|
55
|
+
height: 20, width: 20, backgroundColor: _checkSelectedOption(option) ? activeBackgroundColor : inactiveBackgroundColor,
|
|
56
|
+
borderRadius: 5, marginRight: 5, alignItems: "center", justifyContent: "center",
|
|
57
|
+
borderColor: showError ? theme.palette.getError() : border.borderColor,
|
|
58
|
+
borderWidth: border.borderWidth,
|
|
59
|
+
}}
|
|
60
|
+
onPress={() => onChange(option)}
|
|
61
|
+
>
|
|
62
|
+
{_checkSelectedOption(option) && <Image
|
|
63
|
+
style={{
|
|
64
|
+
height: 15,
|
|
65
|
+
width: 15,
|
|
66
|
+
tintColor: checkboxTintColor,
|
|
67
|
+
}}
|
|
68
|
+
source={ICONS.CHECK_MARK}
|
|
69
|
+
/>}
|
|
70
|
+
</TouchableOpacity>
|
|
71
|
+
<Text style={[optionFont, { color: optionColor }]}>{option.getLabel()}</Text>
|
|
72
|
+
</View>
|
|
73
|
+
))}
|
|
74
|
+
|
|
75
|
+
</View>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default CometChatCheckBox
|
|
@@ -65,17 +65,21 @@ export interface CometChatDateInterface {
|
|
|
65
65
|
* object of DateStyle class.
|
|
66
66
|
*/
|
|
67
67
|
style?: DateStyleInterface;
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
*/
|
|
71
|
+
dateAlignment?: "auto" | "left" | "right" | "center" | "justify" | undefined;
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
export const CometChatDate = (props: CometChatDateInterface) => {
|
|
71
75
|
const { theme } = useContext<CometChatContextType>(CometChatContext);
|
|
72
|
-
const { timeStamp, pattern, customDateString } = props;
|
|
76
|
+
const { timeStamp, pattern, customDateString, dateAlignment } = props;
|
|
73
77
|
|
|
74
78
|
const defaultStyleProps = new DateStyle({
|
|
75
79
|
textFont: theme.typography.caption1,
|
|
76
80
|
textColor: theme.palette.getAccent500(),
|
|
77
81
|
});
|
|
78
|
-
|
|
82
|
+
|
|
79
83
|
const style = {
|
|
80
84
|
...defaultStyleProps,
|
|
81
85
|
...props.style,
|
|
@@ -108,9 +112,8 @@ export const CometChatDate = (props: CometChatDateInterface) => {
|
|
|
108
112
|
|
|
109
113
|
const getTimeFormat = () => {
|
|
110
114
|
let timeString = date.getHours();
|
|
111
|
-
let postString = 'AM';
|
|
112
|
-
if (timeString
|
|
113
|
-
postString = 'PM';
|
|
115
|
+
let postString = timeString >= 12 ? 'PM' : 'AM';
|
|
116
|
+
if (timeString > 12) {
|
|
114
117
|
timeString = timeString - 12;
|
|
115
118
|
}
|
|
116
119
|
let minutes: any = date.getMinutes();
|
|
@@ -172,7 +175,7 @@ export const CometChatDate = (props: CometChatDateInterface) => {
|
|
|
172
175
|
]}
|
|
173
176
|
>
|
|
174
177
|
<Text
|
|
175
|
-
style={[Style.textStyle, style.textFont, { color: style.textColor }]}
|
|
178
|
+
style={[Style.textStyle, style.textFont, { color: style.textColor, textAlign: dateAlignment }]}
|
|
176
179
|
>
|
|
177
180
|
{customDateString ? customDateString : getFormattedDate()}
|
|
178
181
|
</Text>
|
|
@@ -7,6 +7,7 @@ import { DateStyle, DateStyleInterface } from './DateStyle';
|
|
|
7
7
|
export class DateConfiguration {
|
|
8
8
|
pattern?: string;
|
|
9
9
|
style?: DateConfigurationStyle;
|
|
10
|
+
dateAlignment?: "auto" | "left" | "right" | "center" | "justify" | undefined;
|
|
10
11
|
/**
|
|
11
12
|
* @param {Object} param0
|
|
12
13
|
* @field pattern - pattern in which time should be displayed. One of ["timeFormat","dayDateFormat","dayDateTimeFormat"]
|
|
@@ -15,9 +16,11 @@ export class DateConfiguration {
|
|
|
15
16
|
constructor({
|
|
16
17
|
style = new DateStyle({}),
|
|
17
18
|
pattern = 'timeFormat',
|
|
19
|
+
dateAlignment,
|
|
18
20
|
}: DateConfigurationInterface) {
|
|
19
21
|
this.pattern = pattern;
|
|
20
22
|
this.style = style;
|
|
23
|
+
this.dateAlignment = dateAlignment;
|
|
21
24
|
}
|
|
22
25
|
}
|
|
23
26
|
|
|
@@ -25,4 +28,5 @@ type DateConfigurationStyle = DateStyleInterface;
|
|
|
25
28
|
export interface DateConfigurationInterface {
|
|
26
29
|
pattern?: string;
|
|
27
30
|
style?: DateConfigurationStyle;
|
|
31
|
+
dateAlignment?: "auto" | "left" | "right" | "center" | "justify" | undefined;
|
|
28
32
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import React, { useState, useContext, useEffect } from 'react';
|
|
2
|
+
import { View, Text, TouchableOpacity, StyleSheet, Image, ScrollView } from 'react-native';
|
|
3
|
+
import { DownArrow } from './resources';
|
|
4
|
+
import { CometChatContextType } from '../../base';
|
|
5
|
+
import { CometChatContext } from '../../CometChatContext';
|
|
6
|
+
import { DropDownStyle, DropDownStyleInterface } from './DropDownStyle';
|
|
7
|
+
|
|
8
|
+
export interface CometChatButtonInterface {
|
|
9
|
+
options: any[],
|
|
10
|
+
arrowIconURL?: string,
|
|
11
|
+
dropdownStyle?: object,
|
|
12
|
+
onOptionChange?: any,
|
|
13
|
+
selectedOption?: any,
|
|
14
|
+
data: any,
|
|
15
|
+
showError: boolean,
|
|
16
|
+
style?: DropDownStyleInterface
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const CometChatDropdown = (props: CometChatButtonInterface) => {
|
|
20
|
+
const { options,
|
|
21
|
+
arrowIconURL = DownArrow,
|
|
22
|
+
dropdownStyle = {},
|
|
23
|
+
onOptionChange,
|
|
24
|
+
selectedOption, data, showError, style } = props;
|
|
25
|
+
const { theme } = useContext<CometChatContextType>(CometChatContext);
|
|
26
|
+
|
|
27
|
+
const _style = new DropDownStyle({
|
|
28
|
+
activeBackgroundColor: theme.palette.getPrimary(),
|
|
29
|
+
inactiveBackgroundColor: theme.palette.getBackgroundColor(),
|
|
30
|
+
border: { borderWidth: 1, borderColor: theme.palette.getAccent200() },
|
|
31
|
+
titleFont: theme.typography.subtitle1,
|
|
32
|
+
optionColor: theme.palette.getAccent(),
|
|
33
|
+
titleColor: theme.palette.getAccent(),
|
|
34
|
+
...style,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const {
|
|
38
|
+
activeBackgroundColor,
|
|
39
|
+
inactiveBackgroundColor,
|
|
40
|
+
optionColor,
|
|
41
|
+
optionFont,
|
|
42
|
+
titleColor,
|
|
43
|
+
titleFont,
|
|
44
|
+
border,
|
|
45
|
+
} = _style;
|
|
46
|
+
|
|
47
|
+
const [openDropdown, setOpenDropdown] = useState(false);
|
|
48
|
+
const [currentOption, setCurrentOption] = useState({ label: selectedOption || "Select an option" });
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (!selectedOption) return;
|
|
52
|
+
let selectedObj = options.find((option) => option.value === selectedOption);
|
|
53
|
+
selectedObj && setCurrentOption(selectedObj);
|
|
54
|
+
}, [selectedOption])
|
|
55
|
+
|
|
56
|
+
const onDropDownToggle = () => {
|
|
57
|
+
setOpenDropdown(!openDropdown);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const onOptionSelect = option => {
|
|
61
|
+
setCurrentOption(option);
|
|
62
|
+
onOptionChange && onOptionChange(option); // Assuming that onOptionChange function is passed as a prop
|
|
63
|
+
onDropDownToggle();
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<View style={{ ...styles.defaultDropdownStyle, ...dropdownStyle }}>
|
|
68
|
+
<Text style={[titleFont, { color: titleColor }]}>{data.getLabel()}{!data.getOptional() && "*"}</Text>
|
|
69
|
+
|
|
70
|
+
<View style={{ position: "relative" }}>
|
|
71
|
+
<TouchableOpacity onPress={onDropDownToggle} style={[styles.dropdownButton, { borderColor: showError ? theme.palette.getError() : border.borderColor, borderWidth: border.borderWidth }]}>
|
|
72
|
+
<Text style={[optionFont, { color: optionColor }]}>{currentOption.label}</Text>
|
|
73
|
+
{/* Display arrow icon */}
|
|
74
|
+
{arrowIconURL && <Image source={arrowIconURL} style={[styles.dropdownArrow, openDropdown && { transform: [{ rotate: '180deg' }] }]} />}
|
|
75
|
+
</TouchableOpacity>
|
|
76
|
+
|
|
77
|
+
{openDropdown && (
|
|
78
|
+
<ScrollView style={[styles.dropdownOptions, { borderColor: border.borderColor, borderWidth: border.borderWidth, backgroundColor: inactiveBackgroundColor }]}>
|
|
79
|
+
{options.map((option, index) => (
|
|
80
|
+
<TouchableOpacity
|
|
81
|
+
activeOpacity={1}
|
|
82
|
+
style={{
|
|
83
|
+
backgroundColor: currentOption.label === option.label ? activeBackgroundColor : inactiveBackgroundColor,
|
|
84
|
+
height: 35,
|
|
85
|
+
justifyContent: "center", paddingHorizontal: 8
|
|
86
|
+
}}
|
|
87
|
+
key={index} onPress={() => onOptionSelect(option)}>
|
|
88
|
+
<Text style={[optionFont, { color: optionColor }]}>{option.label}</Text>
|
|
89
|
+
</TouchableOpacity>
|
|
90
|
+
))}
|
|
91
|
+
</ScrollView>
|
|
92
|
+
)}
|
|
93
|
+
</View>
|
|
94
|
+
|
|
95
|
+
</View>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const styles = StyleSheet.create({
|
|
100
|
+
defaultDropdownStyle: {
|
|
101
|
+
// position: "relative",
|
|
102
|
+
zIndex: 1,
|
|
103
|
+
marginVertical: 10,
|
|
104
|
+
// Your default dropdown style here
|
|
105
|
+
},
|
|
106
|
+
dropdownButton: {
|
|
107
|
+
borderWidth: 1, flexDirection: "row",
|
|
108
|
+
justifyContent: "space-between", height: 35,
|
|
109
|
+
alignItems: "center", paddingHorizontal: 8, marginTop: 5,
|
|
110
|
+
// Your dropdown button style here
|
|
111
|
+
},
|
|
112
|
+
dropdownArrow: {
|
|
113
|
+
height: 15, width: 15,
|
|
114
|
+
// Your dropdown arrow style here
|
|
115
|
+
},
|
|
116
|
+
dropdownOptions: {
|
|
117
|
+
maxHeight: 150,
|
|
118
|
+
position: "absolute",
|
|
119
|
+
top: 40, width: "100%",
|
|
120
|
+
borderWidth: 1,
|
|
121
|
+
borderTopWidth: 0,
|
|
122
|
+
// Your dropdown options style here
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
export default CometChatDropdown;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { BorderStyle, BorderStyleInterface, FontStyle } from "../../base";
|
|
2
|
+
|
|
3
|
+
export interface DropDownStyleInterface {
|
|
4
|
+
titleFont?: FontStyle;
|
|
5
|
+
titleColor?: string;
|
|
6
|
+
border?: BorderStyleInterface;
|
|
7
|
+
activeBackgroundColor?: string;
|
|
8
|
+
inactiveBackgroundColor?: string;
|
|
9
|
+
optionColor?: string;
|
|
10
|
+
optionFont?: FontStyle;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class DropDownStyle {
|
|
14
|
+
titleFont?: FontStyle;
|
|
15
|
+
titleColor?: string;
|
|
16
|
+
border?: BorderStyleInterface;
|
|
17
|
+
activeBackgroundColor?: string;
|
|
18
|
+
inactiveBackgroundColor?: string;
|
|
19
|
+
optionColor?: string;
|
|
20
|
+
optionFont?: FontStyle;
|
|
21
|
+
|
|
22
|
+
constructor({
|
|
23
|
+
titleFont = new FontStyle({}),
|
|
24
|
+
titleColor = "",
|
|
25
|
+
border = new BorderStyle({}),
|
|
26
|
+
activeBackgroundColor = "",
|
|
27
|
+
inactiveBackgroundColor = "",
|
|
28
|
+
optionColor = "",
|
|
29
|
+
optionFont = new FontStyle({}),
|
|
30
|
+
}: DropDownStyleInterface) {
|
|
31
|
+
this.titleFont = titleFont;
|
|
32
|
+
this.titleColor = titleColor;
|
|
33
|
+
this.border = border;
|
|
34
|
+
this.activeBackgroundColor = activeBackgroundColor;
|
|
35
|
+
this.inactiveBackgroundColor = inactiveBackgroundColor;
|
|
36
|
+
this.optionColor = optionColor;
|
|
37
|
+
this.optionFont = optionFont;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
Binary file
|